pdf.worker.js 2.0 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111511125111351114511155111651117511185111951120511215112251123511245112551126511275112851129511305113151132511335113451135511365113751138511395114051141511425114351144511455114651147511485114951150511515115251153511545115551156511575115851159511605116151162511635116451165511665116751168511695117051171511725117351174511755117651177511785117951180511815118251183511845118551186511875118851189511905119151192511935119451195511965119751198511995120051201512025120351204512055120651207512085120951210512115121251213512145121551216512175121851219512205122151222512235122451225512265122751228512295123051231512325123351234512355123651237512385123951240512415124251243512445124551246512475124851249512505125151252512535125451255512565125751258512595126051261512625126351264512655126651267512685126951270512715127251273512745127551276512775127851279512805128151282512835128451285512865128751288512895129051291512925129351294512955129651297512985129951300513015130251303513045130551306513075130851309513105131151312513135131451315513165131751318513195132051321513225132351324513255132651327513285132951330513315133251333513345133551336513375133851339513405134151342513435134451345513465134751348513495135051351513525135351354513555135651357513585135951360513615136251363513645136551366513675136851369513705137151372513735137451375513765137751378513795138051381513825138351384513855138651387513885138951390513915139251393513945139551396513975139851399514005140151402514035140451405514065140751408514095141051411514125141351414514155141651417514185141951420514215142251423514245142551426514275142851429514305143151432514335143451435514365143751438514395144051441514425144351444514455144651447514485144951450514515145251453514545145551456514575145851459514605146151462514635146451465514665146751468514695147051471514725147351474514755147651477514785147951480514815148251483514845148551486514875148851489514905149151492514935149451495514965149751498514995150051501515025150351504515055150651507515085150951510515115151251513515145151551516515175151851519515205152151522515235152451525515265152751528515295153051531515325153351534515355153651537515385153951540515415154251543515445154551546515475154851549515505155151552515535155451555515565155751558515595156051561515625156351564515655156651567515685156951570515715157251573515745157551576515775157851579515805158151582515835158451585515865158751588515895159051591515925159351594515955159651597515985159951600516015160251603516045160551606516075160851609516105161151612516135161451615516165161751618516195162051621516225162351624516255162651627516285162951630516315163251633516345163551636516375163851639516405164151642516435164451645516465164751648516495165051651516525165351654516555165651657516585165951660516615166251663516645166551666516675166851669516705167151672516735167451675516765167751678516795168051681516825168351684516855168651687516885168951690516915169251693516945169551696516975169851699517005170151702517035170451705517065170751708517095171051711517125171351714517155171651717517185171951720517215172251723517245172551726517275172851729517305173151732517335173451735517365173751738517395174051741517425174351744517455174651747517485174951750517515175251753517545175551756517575175851759517605176151762517635176451765517665176751768517695177051771517725177351774517755177651777517785177951780517815178251783517845178551786517875178851789517905179151792517935179451795517965179751798517995180051801518025180351804518055180651807518085180951810518115181251813518145181551816518175181851819518205182151822518235182451825518265182751828518295183051831518325183351834518355183651837518385183951840518415184251843518445184551846518475184851849518505185151852518535185451855518565185751858518595186051861518625186351864518655186651867518685186951870518715187251873518745187551876518775187851879518805188151882518835188451885518865188751888518895189051891518925189351894518955189651897518985189951900519015190251903519045190551906519075190851909519105191151912519135191451915519165191751918519195192051921519225192351924519255192651927519285192951930519315193251933519345193551936519375193851939519405194151942519435194451945519465194751948519495195051951519525195351954519555195651957519585195951960519615196251963519645196551966519675196851969519705197151972519735197451975519765197751978519795198051981519825198351984519855198651987519885198951990519915199251993519945199551996519975199851999520005200152002520035200452005520065200752008520095201052011520125201352014520155201652017520185201952020520215202252023520245202552026520275202852029520305203152032520335203452035520365203752038520395204052041520425204352044520455204652047520485204952050520515205252053520545205552056520575205852059520605206152062520635206452065520665206752068520695207052071520725207352074520755207652077520785207952080520815208252083520845208552086520875208852089520905209152092520935209452095520965209752098520995210052101521025210352104521055210652107521085210952110521115211252113521145211552116521175211852119521205212152122521235212452125521265212752128521295213052131521325213352134521355213652137521385213952140521415214252143521445214552146521475214852149521505215152152521535215452155521565215752158521595216052161521625216352164521655216652167521685216952170521715217252173521745217552176521775217852179521805218152182521835218452185521865218752188521895219052191521925219352194521955219652197521985219952200522015220252203522045220552206522075220852209522105221152212522135221452215522165221752218522195222052221522225222352224522255222652227522285222952230522315223252233522345223552236522375223852239522405224152242522435224452245522465224752248522495225052251522525225352254522555225652257522585225952260522615226252263522645226552266522675226852269522705227152272522735227452275522765227752278522795228052281522825228352284522855228652287522885228952290522915229252293522945229552296522975229852299523005230152302523035230452305523065230752308523095231052311523125231352314523155231652317523185231952320523215232252323523245232552326523275232852329523305233152332523335233452335523365233752338523395234052341523425234352344523455234652347523485234952350523515235252353523545235552356523575235852359523605236152362523635236452365523665236752368523695237052371523725237352374523755237652377523785237952380523815238252383523845238552386523875238852389523905239152392523935239452395523965239752398523995240052401524025240352404524055240652407524085240952410524115241252413524145241552416524175241852419524205242152422524235242452425524265242752428524295243052431524325243352434524355243652437524385243952440524415244252443524445244552446524475244852449524505245152452524535245452455524565245752458524595246052461524625246352464524655246652467524685246952470524715247252473524745247552476524775247852479524805248152482524835248452485524865248752488524895249052491524925249352494524955249652497524985249952500525015250252503525045250552506525075250852509525105251152512525135251452515525165251752518525195252052521525225252352524525255252652527525285252952530525315253252533525345253552536525375253852539525405254152542525435254452545525465254752548525495255052551525525255352554525555255652557525585255952560525615256252563525645256552566525675256852569525705257152572525735257452575525765257752578525795258052581525825258352584525855258652587525885258952590525915259252593525945259552596525975259852599526005260152602526035260452605526065260752608526095261052611526125261352614526155261652617526185261952620526215262252623526245262552626526275262852629526305263152632526335263452635526365263752638526395264052641526425264352644526455264652647526485264952650526515265252653526545265552656526575265852659526605266152662526635266452665526665266752668526695267052671526725267352674526755267652677526785267952680526815268252683526845268552686526875268852689526905269152692526935269452695526965269752698526995270052701527025270352704527055270652707527085270952710527115271252713527145271552716527175271852719527205272152722527235272452725527265272752728527295273052731527325273352734527355273652737527385273952740527415274252743527445274552746527475274852749527505275152752527535275452755527565275752758527595276052761527625276352764527655276652767527685276952770527715277252773527745277552776527775277852779527805278152782527835278452785527865278752788527895279052791527925279352794527955279652797527985279952800528015280252803528045280552806528075280852809528105281152812528135281452815528165281752818528195282052821528225282352824528255282652827528285282952830528315283252833528345283552836528375283852839528405284152842528435284452845528465284752848528495285052851528525285352854528555285652857528585285952860528615286252863528645286552866528675286852869528705287152872528735287452875528765287752878528795288052881528825288352884528855288652887528885288952890528915289252893528945289552896528975289852899529005290152902529035290452905529065290752908529095291052911529125291352914529155291652917529185291952920529215292252923529245292552926529275292852929529305293152932529335293452935529365293752938529395294052941529425294352944529455294652947529485294952950529515295252953529545295552956529575295852959529605296152962529635296452965529665296752968529695297052971529725297352974529755297652977529785297952980529815298252983529845298552986529875298852989529905299152992529935299452995529965299752998529995300053001530025300353004530055300653007530085300953010530115301253013530145301553016530175301853019530205302153022530235302453025530265302753028530295303053031530325303353034530355303653037530385303953040530415304253043530445304553046530475304853049530505305153052530535305453055530565305753058530595306053061530625306353064530655306653067530685306953070530715307253073530745307553076530775307853079530805308153082530835308453085530865308753088530895309053091530925309353094530955309653097530985309953100531015310253103531045310553106531075310853109531105311153112531135311453115531165311753118531195312053121531225312353124531255312653127531285312953130531315313253133531345313553136531375313853139531405314153142531435314453145531465314753148531495315053151531525315353154531555315653157531585315953160531615316253163531645316553166531675316853169531705317153172531735317453175531765317753178531795318053181531825318353184531855318653187531885318953190531915319253193531945319553196531975319853199532005320153202532035320453205532065320753208532095321053211532125321353214532155321653217532185321953220532215322253223532245322553226532275322853229532305323153232532335323453235532365323753238532395324053241532425324353244532455324653247532485324953250532515325253253532545325553256532575325853259532605326153262532635326453265532665326753268532695327053271532725327353274532755327653277532785327953280532815328253283532845328553286532875328853289532905329153292532935329453295532965329753298532995330053301533025330353304533055330653307533085330953310533115331253313533145331553316533175331853319533205332153322533235332453325533265332753328533295333053331533325333353334533355333653337533385333953340533415334253343533445334553346533475334853349533505335153352533535335453355533565335753358533595336053361533625336353364533655336653367533685336953370533715337253373533745337553376533775337853379533805338153382533835338453385533865338753388533895339053391533925339353394533955339653397533985339953400534015340253403534045340553406534075340853409534105341153412534135341453415534165341753418534195342053421534225342353424534255342653427534285342953430534315343253433534345343553436534375343853439534405344153442534435344453445534465344753448534495345053451534525345353454534555345653457534585345953460534615346253463534645346553466534675346853469534705347153472534735347453475534765347753478534795348053481534825348353484534855348653487534885348953490534915349253493534945349553496534975349853499535005350153502535035350453505535065350753508535095351053511535125351353514535155351653517535185351953520535215352253523535245352553526535275352853529535305353153532535335353453535535365353753538535395354053541535425354353544535455354653547535485354953550535515355253553535545355553556535575355853559535605356153562535635356453565535665356753568535695357053571535725357353574535755357653577535785357953580535815358253583535845358553586535875358853589535905359153592535935359453595535965359753598535995360053601536025360353604536055360653607536085360953610536115361253613536145361553616536175361853619536205362153622536235362453625536265362753628536295363053631536325363353634536355363653637536385363953640536415364253643536445364553646536475364853649536505365153652536535365453655536565365753658536595366053661536625366353664536655366653667536685366953670536715367253673536745367553676536775367853679536805368153682536835368453685536865368753688536895369053691536925369353694536955369653697536985369953700537015370253703537045370553706537075370853709537105371153712537135371453715537165371753718537195372053721537225372353724537255372653727537285372953730537315373253733537345373553736537375373853739537405374153742537435374453745537465374753748537495375053751537525375353754537555375653757537585375953760537615376253763537645376553766537675376853769537705377153772537735377453775537765377753778537795378053781537825378353784537855378653787537885378953790537915379253793537945379553796537975379853799538005380153802538035380453805538065380753808538095381053811538125381353814538155381653817538185381953820538215382253823538245382553826538275382853829538305383153832538335383453835538365383753838538395384053841538425384353844538455384653847538485384953850538515385253853538545385553856538575385853859538605386153862538635386453865538665386753868538695387053871538725387353874538755387653877538785387953880538815388253883538845388553886538875388853889538905389153892538935389453895538965389753898538995390053901539025390353904539055390653907539085390953910539115391253913539145391553916539175391853919539205392153922539235392453925539265392753928539295393053931539325393353934539355393653937539385393953940539415394253943539445394553946539475394853949539505395153952539535395453955539565395753958539595396053961539625396353964539655396653967539685396953970539715397253973539745397553976539775397853979539805398153982539835398453985539865398753988539895399053991539925399353994539955399653997539985399954000540015400254003540045400554006540075400854009540105401154012540135401454015540165401754018540195402054021540225402354024540255402654027540285402954030540315403254033540345403554036540375403854039540405404154042540435404454045540465404754048540495405054051540525405354054540555405654057540585405954060540615406254063540645406554066540675406854069540705407154072540735407454075540765407754078540795408054081540825408354084540855408654087540885408954090540915409254093540945409554096540975409854099541005410154102541035410454105541065410754108541095411054111541125411354114541155411654117541185411954120541215412254123541245412554126541275412854129541305413154132541335413454135541365413754138541395414054141541425414354144541455414654147541485414954150541515415254153541545415554156541575415854159541605416154162541635416454165541665416754168541695417054171541725417354174541755417654177541785417954180541815418254183541845418554186541875418854189541905419154192541935419454195541965419754198541995420054201542025420354204542055420654207542085420954210542115421254213542145421554216542175421854219542205422154222542235422454225542265422754228542295423054231542325423354234542355423654237542385423954240542415424254243542445424554246542475424854249542505425154252542535425454255542565425754258542595426054261542625426354264542655426654267542685426954270542715427254273542745427554276542775427854279542805428154282542835428454285542865428754288542895429054291542925429354294542955429654297542985429954300543015430254303543045430554306543075430854309543105431154312543135431454315543165431754318543195432054321543225432354324543255432654327543285432954330543315433254333543345433554336543375433854339543405434154342543435434454345543465434754348543495435054351543525435354354543555435654357543585435954360543615436254363543645436554366543675436854369543705437154372543735437454375543765437754378543795438054381543825438354384543855438654387543885438954390543915439254393543945439554396543975439854399544005440154402544035440454405544065440754408544095441054411544125441354414544155441654417544185441954420544215442254423544245442554426544275442854429544305443154432544335443454435544365443754438544395444054441544425444354444544455444654447544485444954450544515445254453544545445554456544575445854459544605446154462544635446454465544665446754468544695447054471544725447354474544755447654477544785447954480544815448254483544845448554486544875448854489544905449154492544935449454495544965449754498544995450054501545025450354504545055450654507545085450954510545115451254513545145451554516545175451854519545205452154522545235452454525545265452754528545295453054531545325453354534545355453654537545385453954540545415454254543545445454554546545475454854549545505455154552545535455454555545565455754558545595456054561545625456354564545655456654567545685456954570545715457254573545745457554576545775457854579545805458154582545835458454585545865458754588545895459054591545925459354594545955459654597545985459954600546015460254603546045460554606546075460854609546105461154612546135461454615546165461754618546195462054621546225462354624546255462654627546285462954630546315463254633546345463554636546375463854639546405464154642546435464454645546465464754648546495465054651546525465354654546555465654657546585465954660546615466254663546645466554666546675466854669546705467154672546735467454675546765467754678546795468054681546825468354684546855468654687546885468954690546915469254693546945469554696546975469854699547005470154702547035470454705547065470754708547095471054711547125471354714547155471654717547185471954720547215472254723547245472554726547275472854729547305473154732547335473454735547365473754738547395474054741547425474354744547455474654747547485474954750547515475254753547545475554756547575475854759547605476154762547635476454765547665476754768547695477054771547725477354774547755477654777547785477954780547815478254783547845478554786547875478854789547905479154792547935479454795547965479754798547995480054801548025480354804548055480654807548085480954810548115481254813548145481554816548175481854819548205482154822548235482454825548265482754828548295483054831548325483354834548355483654837548385483954840548415484254843548445484554846548475484854849548505485154852548535485454855548565485754858548595486054861548625486354864548655486654867548685486954870548715487254873548745487554876548775487854879548805488154882548835488454885548865488754888548895489054891548925489354894548955489654897548985489954900549015490254903549045490554906549075490854909549105491154912549135491454915549165491754918549195492054921549225492354924549255492654927549285492954930549315493254933549345493554936549375493854939549405494154942549435494454945549465494754948549495495054951549525495354954549555495654957549585495954960549615496254963549645496554966549675496854969549705497154972549735497454975549765497754978549795498054981549825498354984549855498654987549885498954990549915499254993549945499554996549975499854999550005500155002550035500455005550065500755008550095501055011550125501355014550155501655017550185501955020550215502255023550245502555026550275502855029550305503155032550335503455035550365503755038550395504055041550425504355044550455504655047550485504955050550515505255053550545505555056550575505855059550605506155062550635506455065550665506755068550695507055071550725507355074550755507655077550785507955080550815508255083550845508555086550875508855089550905509155092550935509455095550965509755098550995510055101551025510355104551055510655107551085510955110551115511255113551145511555116551175511855119551205512155122551235512455125551265512755128551295513055131551325513355134551355513655137551385513955140551415514255143551445514555146551475514855149551505515155152551535515455155551565515755158551595516055161551625516355164551655516655167551685516955170551715517255173551745517555176551775517855179551805518155182551835518455185551865518755188551895519055191551925519355194551955519655197551985519955200552015520255203552045520555206552075520855209552105521155212552135521455215552165521755218552195522055221552225522355224552255522655227552285522955230552315523255233552345523555236552375523855239552405524155242552435524455245552465524755248552495525055251552525525355254552555525655257552585525955260552615526255263552645526555266552675526855269552705527155272552735527455275552765527755278552795528055281552825528355284552855528655287552885528955290552915529255293552945529555296552975529855299553005530155302553035530455305553065530755308553095531055311553125531355314553155531655317553185531955320553215532255323553245532555326553275532855329553305533155332553335533455335553365533755338553395534055341553425534355344553455534655347553485534955350553515535255353553545535555356553575535855359553605536155362553635536455365553665536755368553695537055371553725537355374553755537655377553785537955380553815538255383553845538555386553875538855389553905539155392553935539455395553965539755398553995540055401554025540355404554055540655407554085540955410554115541255413554145541555416554175541855419554205542155422554235542455425554265542755428554295543055431554325543355434554355543655437554385543955440554415544255443554445544555446554475544855449554505545155452554535545455455554565545755458554595546055461554625546355464554655546655467554685546955470554715547255473554745547555476554775547855479554805548155482554835548455485554865548755488554895549055491554925549355494554955549655497554985549955500555015550255503555045550555506555075550855509555105551155512555135551455515555165551755518555195552055521555225552355524555255552655527555285552955530555315553255533555345553555536555375553855539555405554155542555435554455545555465554755548555495555055551555525555355554555555555655557555585555955560555615556255563555645556555566555675556855569555705557155572555735557455575555765557755578555795558055581555825558355584555855558655587555885558955590555915559255593555945559555596555975559855599556005560155602556035560455605556065560755608556095561055611556125561355614556155561655617556185561955620556215562255623556245562555626556275562855629556305563155632556335563455635556365563755638556395564055641556425564355644556455564655647556485564955650556515565255653556545565555656556575565855659556605566155662556635566455665556665566755668556695567055671556725567355674556755567655677556785567955680556815568255683556845568555686556875568855689556905569155692556935569455695556965569755698556995570055701557025570355704557055570655707557085570955710557115571255713557145571555716557175571855719557205572155722557235572455725557265572755728557295573055731557325573355734557355573655737557385573955740557415574255743557445574555746557475574855749557505575155752557535575455755557565575755758557595576055761557625576355764557655576655767557685576955770557715577255773557745577555776557775577855779557805578155782557835578455785557865578755788557895579055791557925579355794557955579655797557985579955800558015580255803558045580555806558075580855809558105581155812558135581455815558165581755818558195582055821558225582355824558255582655827558285582955830558315583255833558345583555836558375583855839558405584155842558435584455845558465584755848558495585055851558525585355854558555585655857558585585955860558615586255863558645586555866558675586855869558705587155872558735587455875558765587755878558795588055881558825588355884558855588655887558885588955890558915589255893558945589555896558975589855899559005590155902559035590455905559065590755908559095591055911559125591355914559155591655917559185591955920559215592255923559245592555926559275592855929559305593155932559335593455935559365593755938559395594055941559425594355944559455594655947559485594955950559515595255953559545595555956559575595855959559605596155962559635596455965559665596755968559695597055971559725597355974559755597655977559785597955980559815598255983559845598555986559875598855989559905599155992559935599455995559965599755998559995600056001560025600356004560055600656007560085600956010560115601256013560145601556016560175601856019560205602156022560235602456025560265602756028560295603056031560325603356034560355603656037560385603956040560415604256043560445604556046560475604856049560505605156052560535605456055560565605756058560595606056061560625606356064560655606656067560685606956070560715607256073560745607556076560775607856079560805608156082560835608456085560865608756088560895609056091560925609356094560955609656097560985609956100561015610256103561045610556106561075610856109561105611156112561135611456115561165611756118561195612056121561225612356124561255612656127561285612956130561315613256133561345613556136561375613856139561405614156142561435614456145561465614756148561495615056151561525615356154561555615656157561585615956160561615616256163561645616556166561675616856169561705617156172561735617456175561765617756178561795618056181561825618356184561855618656187561885618956190561915619256193561945619556196561975619856199562005620156202562035620456205562065620756208562095621056211562125621356214562155621656217562185621956220562215622256223562245622556226562275622856229562305623156232562335623456235562365623756238562395624056241562425624356244562455624656247562485624956250562515625256253562545625556256562575625856259562605626156262562635626456265562665626756268562695627056271562725627356274562755627656277562785627956280562815628256283562845628556286562875628856289562905629156292562935629456295562965629756298562995630056301563025630356304563055630656307563085630956310563115631256313563145631556316563175631856319563205632156322563235632456325563265632756328563295633056331563325633356334563355633656337563385633956340563415634256343563445634556346563475634856349563505635156352563535635456355563565635756358563595636056361563625636356364563655636656367563685636956370563715637256373563745637556376563775637856379563805638156382563835638456385563865638756388563895639056391563925639356394563955639656397563985639956400564015640256403564045640556406564075640856409564105641156412564135641456415564165641756418564195642056421564225642356424564255642656427564285642956430564315643256433564345643556436564375643856439564405644156442564435644456445564465644756448564495645056451564525645356454564555645656457564585645956460564615646256463564645646556466564675646856469564705647156472564735647456475564765647756478564795648056481564825648356484564855648656487564885648956490564915649256493564945649556496564975649856499565005650156502565035650456505565065650756508565095651056511565125651356514565155651656517565185651956520565215652256523565245652556526565275652856529565305653156532565335653456535565365653756538565395654056541565425654356544565455654656547565485654956550565515655256553565545655556556565575655856559565605656156562565635656456565565665656756568565695657056571565725657356574565755657656577565785657956580565815658256583565845658556586565875658856589565905659156592565935659456595565965659756598565995660056601566025660356604566055660656607566085660956610566115661256613566145661556616566175661856619566205662156622566235662456625566265662756628566295663056631566325663356634566355663656637566385663956640566415664256643566445664556646566475664856649566505665156652566535665456655566565665756658566595666056661566625666356664566655666656667566685666956670566715667256673566745667556676566775667856679566805668156682566835668456685566865668756688566895669056691566925669356694566955669656697566985669956700567015670256703567045670556706567075670856709567105671156712567135671456715567165671756718567195672056721567225672356724567255672656727567285672956730567315673256733567345673556736567375673856739567405674156742567435674456745567465674756748567495675056751567525675356754567555675656757567585675956760567615676256763567645676556766567675676856769567705677156772567735677456775567765677756778567795678056781567825678356784567855678656787567885678956790567915679256793567945679556796567975679856799568005680156802568035680456805568065680756808568095681056811568125681356814568155681656817568185681956820568215682256823568245682556826568275682856829568305683156832568335683456835568365683756838568395684056841568425684356844568455684656847568485684956850568515685256853568545685556856568575685856859568605686156862568635686456865568665686756868568695687056871568725687356874568755687656877568785687956880568815688256883568845688556886568875688856889568905689156892568935689456895568965689756898568995690056901569025690356904569055690656907569085690956910569115691256913569145691556916569175691856919569205692156922569235692456925569265692756928569295693056931569325693356934569355693656937569385693956940569415694256943569445694556946569475694856949569505695156952569535695456955569565695756958569595696056961569625696356964569655696656967569685696956970569715697256973569745697556976569775697856979569805698156982569835698456985569865698756988569895699056991569925699356994569955699656997569985699957000570015700257003570045700557006570075700857009570105701157012570135701457015570165701757018570195702057021570225702357024570255702657027570285702957030570315703257033570345703557036570375703857039570405704157042570435704457045570465704757048570495705057051570525705357054570555705657057570585705957060570615706257063570645706557066570675706857069570705707157072570735707457075570765707757078570795708057081570825708357084570855708657087570885708957090570915709257093570945709557096570975709857099571005710157102571035710457105571065710757108571095711057111571125711357114571155711657117571185711957120571215712257123571245712557126571275712857129571305713157132571335713457135571365713757138571395714057141571425714357144571455714657147571485714957150571515715257153571545715557156571575715857159571605716157162571635716457165571665716757168571695717057171571725717357174571755717657177571785717957180571815718257183571845718557186571875718857189571905719157192571935719457195571965719757198571995720057201572025720357204572055720657207572085720957210572115721257213572145721557216572175721857219572205722157222572235722457225572265722757228572295723057231572325723357234572355723657237572385723957240572415724257243572445724557246572475724857249572505725157252572535725457255572565725757258572595726057261572625726357264572655726657267572685726957270572715727257273572745727557276572775727857279572805728157282572835728457285572865728757288572895729057291572925729357294572955729657297572985729957300573015730257303573045730557306573075730857309573105731157312573135731457315573165731757318573195732057321573225732357324573255732657327573285732957330573315733257333573345733557336573375733857339573405734157342573435734457345573465734757348573495735057351573525735357354573555735657357573585735957360573615736257363573645736557366573675736857369573705737157372573735737457375573765737757378573795738057381573825738357384573855738657387573885738957390573915739257393573945739557396573975739857399574005740157402574035740457405574065740757408574095741057411574125741357414574155741657417574185741957420574215742257423574245742557426574275742857429574305743157432574335743457435574365743757438574395744057441574425744357444574455744657447574485744957450574515745257453574545745557456574575745857459574605746157462574635746457465574665746757468574695747057471574725747357474574755747657477574785747957480574815748257483574845748557486574875748857489574905749157492574935749457495574965749757498574995750057501575025750357504575055750657507575085750957510575115751257513575145751557516575175751857519575205752157522575235752457525575265752757528575295753057531575325753357534575355753657537575385753957540575415754257543575445754557546575475754857549575505755157552575535755457555575565755757558575595756057561575625756357564575655756657567575685756957570575715757257573575745757557576575775757857579575805758157582575835758457585575865758757588575895759057591575925759357594575955759657597575985759957600576015760257603576045760557606576075760857609576105761157612576135761457615576165761757618576195762057621576225762357624576255762657627576285762957630576315763257633576345763557636576375763857639576405764157642576435764457645576465764757648576495765057651576525765357654576555765657657576585765957660576615766257663576645766557666576675766857669576705767157672576735767457675576765767757678576795768057681576825768357684576855768657687576885768957690576915769257693576945769557696576975769857699577005770157702577035770457705577065770757708577095771057711577125771357714577155771657717577185771957720577215772257723577245772557726577275772857729577305773157732577335773457735577365773757738577395774057741577425774357744577455774657747577485774957750577515775257753577545775557756577575775857759577605776157762577635776457765577665776757768577695777057771577725777357774577755777657777577785777957780577815778257783577845778557786577875778857789577905779157792577935779457795577965779757798577995780057801578025780357804578055780657807578085780957810578115781257813578145781557816578175781857819578205782157822578235782457825578265782757828578295783057831578325783357834578355783657837578385783957840578415784257843578445784557846578475784857849578505785157852578535785457855578565785757858578595786057861578625786357864578655786657867578685786957870578715787257873578745787557876578775787857879578805788157882578835788457885578865788757888578895789057891578925789357894578955789657897578985789957900579015790257903579045790557906579075790857909579105791157912579135791457915579165791757918579195792057921579225792357924579255792657927579285792957930579315793257933579345793557936579375793857939579405794157942579435794457945579465794757948579495795057951579525795357954579555795657957579585795957960579615796257963579645796557966579675796857969579705797157972579735797457975579765797757978579795798057981579825798357984579855798657987579885798957990579915799257993579945799557996579975799857999580005800158002580035800458005580065800758008580095801058011580125801358014580155801658017580185801958020580215802258023580245802558026580275802858029580305803158032580335803458035580365803758038580395804058041580425804358044580455804658047580485804958050580515805258053580545805558056580575805858059580605806158062580635806458065580665806758068580695807058071580725807358074580755807658077580785807958080580815808258083580845808558086580875808858089580905809158092580935809458095580965809758098580995810058101581025810358104581055810658107581085810958110581115811258113581145811558116581175811858119581205812158122581235812458125581265812758128581295813058131581325813358134581355813658137581385813958140581415814258143581445814558146581475814858149581505815158152581535815458155581565815758158581595816058161581625816358164581655816658167581685816958170581715817258173581745817558176581775817858179581805818158182581835818458185581865818758188581895819058191581925819358194581955819658197581985819958200582015820258203582045820558206582075820858209582105821158212582135821458215582165821758218582195822058221582225822358224582255822658227582285822958230582315823258233582345823558236582375823858239582405824158242582435824458245582465824758248582495825058251582525825358254582555825658257582585825958260582615826258263582645826558266582675826858269582705827158272582735827458275582765827758278582795828058281582825828358284582855828658287582885828958290582915829258293582945829558296582975829858299583005830158302583035830458305583065830758308583095831058311583125831358314583155831658317583185831958320583215832258323583245832558326583275832858329583305833158332583335833458335583365833758338583395834058341583425834358344583455834658347583485834958350583515835258353583545835558356583575835858359583605836158362583635836458365583665836758368583695837058371583725837358374583755837658377583785837958380583815838258383583845838558386583875838858389583905839158392583935839458395583965839758398583995840058401584025840358404584055840658407584085840958410584115841258413584145841558416584175841858419584205842158422584235842458425584265842758428584295843058431584325843358434584355843658437584385843958440584415844258443584445844558446584475844858449584505845158452584535845458455584565845758458584595846058461584625846358464584655846658467584685846958470584715847258473584745847558476584775847858479584805848158482584835848458485584865848758488584895849058491584925849358494584955849658497584985849958500585015850258503585045850558506585075850858509585105851158512585135851458515585165851758518585195852058521585225852358524585255852658527585285852958530585315853258533585345853558536585375853858539585405854158542585435854458545585465854758548585495855058551585525855358554585555855658557585585855958560585615856258563585645856558566585675856858569585705857158572585735857458575585765857758578585795858058581585825858358584585855858658587585885858958590585915859258593585945859558596585975859858599586005860158602586035860458605586065860758608586095861058611586125861358614586155861658617586185861958620586215862258623586245862558626586275862858629586305863158632586335863458635586365863758638586395864058641586425864358644586455864658647586485864958650586515865258653586545865558656586575865858659586605866158662586635866458665586665866758668586695867058671586725867358674586755867658677586785867958680586815868258683586845868558686586875868858689586905869158692586935869458695586965869758698586995870058701587025870358704587055870658707587085870958710587115871258713587145871558716587175871858719587205872158722587235872458725587265872758728587295873058731587325873358734587355873658737587385873958740587415874258743587445874558746587475874858749587505875158752587535875458755587565875758758587595876058761587625876358764587655876658767587685876958770587715877258773587745877558776587775877858779587805878158782587835878458785587865878758788587895879058791587925879358794587955879658797587985879958800588015880258803588045880558806588075880858809588105881158812588135881458815588165881758818588195882058821588225882358824588255882658827588285882958830588315883258833588345883558836588375883858839588405884158842588435884458845588465884758848588495885058851588525885358854588555885658857588585885958860588615886258863588645886558866588675886858869588705887158872588735887458875588765887758878588795888058881588825888358884588855888658887588885888958890588915889258893588945889558896588975889858899589005890158902589035890458905589065890758908589095891058911589125891358914589155891658917589185891958920589215892258923589245892558926589275892858929589305893158932589335893458935589365893758938589395894058941589425894358944589455894658947589485894958950589515895258953589545895558956589575895858959589605896158962589635896458965589665896758968589695897058971589725897358974589755897658977589785897958980589815898258983589845898558986589875898858989589905899158992589935899458995589965899758998589995900059001590025900359004590055900659007590085900959010590115901259013590145901559016590175901859019590205902159022590235902459025590265902759028590295903059031590325903359034590355903659037590385903959040590415904259043590445904559046590475904859049590505905159052590535905459055590565905759058590595906059061590625906359064590655906659067590685906959070590715907259073590745907559076590775907859079590805908159082590835908459085590865908759088590895909059091590925909359094590955909659097590985909959100591015910259103591045910559106591075910859109591105911159112591135911459115591165911759118591195912059121591225912359124591255912659127591285912959130591315913259133591345913559136591375913859139591405914159142591435914459145591465914759148591495915059151591525915359154591555915659157591585915959160591615916259163591645916559166591675916859169591705917159172591735917459175591765917759178591795918059181591825918359184591855918659187591885918959190591915919259193591945919559196591975919859199592005920159202592035920459205592065920759208592095921059211592125921359214592155921659217592185921959220592215922259223592245922559226592275922859229592305923159232592335923459235592365923759238592395924059241592425924359244592455924659247592485924959250592515925259253592545925559256592575925859259592605926159262592635926459265592665926759268592695927059271592725927359274592755927659277592785927959280592815928259283592845928559286592875928859289592905929159292592935929459295592965929759298592995930059301593025930359304593055930659307593085930959310593115931259313593145931559316593175931859319593205932159322593235932459325593265932759328593295933059331593325933359334593355933659337593385933959340593415934259343593445934559346593475934859349593505935159352593535935459355593565935759358593595936059361593625936359364593655936659367593685936959370593715937259373593745937559376593775937859379593805938159382593835938459385593865938759388593895939059391593925939359394593955939659397593985939959400594015940259403594045940559406594075940859409594105941159412594135941459415594165941759418594195942059421594225942359424594255942659427594285942959430594315943259433594345943559436594375943859439594405944159442594435944459445594465944759448594495945059451594525945359454594555945659457594585945959460594615946259463594645946559466594675946859469594705947159472594735947459475594765947759478594795948059481594825948359484594855948659487594885948959490594915949259493594945949559496594975949859499595005950159502595035950459505595065950759508595095951059511595125951359514595155951659517595185951959520595215952259523595245952559526595275952859529595305953159532595335953459535595365953759538595395954059541595425954359544595455954659547595485954959550595515955259553595545955559556595575955859559595605956159562595635956459565595665956759568595695957059571595725957359574595755957659577595785957959580595815958259583595845958559586595875958859589595905959159592595935959459595595965959759598595995960059601596025960359604596055960659607596085960959610596115961259613596145961559616596175961859619596205962159622596235962459625596265962759628596295963059631596325963359634596355963659637596385963959640596415964259643596445964559646596475964859649596505965159652596535965459655596565965759658596595966059661596625966359664596655966659667596685966959670596715967259673596745967559676596775967859679596805968159682596835968459685596865968759688596895969059691596925969359694596955969659697596985969959700597015970259703597045970559706597075970859709597105971159712597135971459715597165971759718597195972059721597225972359724597255972659727597285972959730597315973259733597345973559736597375973859739597405974159742597435974459745597465974759748597495975059751597525975359754597555975659757597585975959760597615976259763597645976559766597675976859769597705977159772597735977459775597765977759778597795978059781597825978359784597855978659787597885978959790597915979259793597945979559796597975979859799598005980159802598035980459805598065980759808598095981059811598125981359814598155981659817598185981959820598215982259823598245982559826598275982859829598305983159832598335983459835598365983759838598395984059841598425984359844598455984659847598485984959850598515985259853598545985559856598575985859859598605986159862598635986459865598665986759868598695987059871598725987359874598755987659877598785987959880598815988259883598845988559886598875988859889598905989159892598935989459895598965989759898598995990059901599025990359904599055990659907599085990959910599115991259913599145991559916599175991859919599205992159922599235992459925599265992759928599295993059931599325993359934599355993659937599385993959940599415994259943599445994559946599475994859949599505995159952599535995459955599565995759958599595996059961599625996359964599655996659967599685996959970599715997259973599745997559976599775997859979599805998159982599835998459985599865998759988599895999059991599925999359994599955999659997599985999960000600016000260003600046000560006600076000860009600106001160012600136001460015600166001760018600196002060021600226002360024600256002660027600286002960030600316003260033600346003560036600376003860039600406004160042600436004460045600466004760048600496005060051600526005360054600556005660057600586005960060600616006260063600646006560066600676006860069600706007160072600736007460075600766007760078600796008060081600826008360084600856008660087600886008960090600916009260093600946009560096600976009860099601006010160102601036010460105601066010760108601096011060111601126011360114601156011660117601186011960120601216012260123601246012560126601276012860129601306013160132601336013460135601366013760138601396014060141601426014360144601456014660147601486014960150601516015260153601546015560156601576015860159601606016160162601636016460165601666016760168601696017060171601726017360174601756017660177601786017960180601816018260183601846018560186601876018860189601906019160192601936019460195601966019760198601996020060201602026020360204602056020660207602086020960210602116021260213602146021560216602176021860219602206022160222602236022460225602266022760228602296023060231602326023360234602356023660237602386023960240602416024260243602446024560246602476024860249602506025160252602536025460255602566025760258602596026060261602626026360264602656026660267602686026960270602716027260273602746027560276602776027860279602806028160282602836028460285602866028760288602896029060291602926029360294602956029660297602986029960300603016030260303603046030560306603076030860309603106031160312603136031460315603166031760318603196032060321603226032360324603256032660327603286032960330603316033260333603346033560336603376033860339603406034160342603436034460345603466034760348603496035060351603526035360354603556035660357603586035960360603616036260363603646036560366603676036860369603706037160372603736037460375603766037760378603796038060381603826038360384603856038660387603886038960390603916039260393603946039560396603976039860399604006040160402604036040460405604066040760408604096041060411604126041360414604156041660417604186041960420604216042260423604246042560426604276042860429604306043160432604336043460435604366043760438604396044060441604426044360444604456044660447604486044960450604516045260453604546045560456604576045860459604606046160462604636046460465604666046760468604696047060471604726047360474604756047660477604786047960480604816048260483604846048560486604876048860489604906049160492604936049460495604966049760498604996050060501605026050360504605056050660507605086050960510605116051260513605146051560516605176051860519605206052160522605236052460525605266052760528605296053060531605326053360534605356053660537605386053960540605416054260543605446054560546605476054860549605506055160552605536055460555605566055760558605596056060561605626056360564605656056660567605686056960570605716057260573605746057560576605776057860579605806058160582605836058460585605866058760588605896059060591605926059360594605956059660597605986059960600606016060260603606046060560606606076060860609606106061160612606136061460615606166061760618606196062060621606226062360624606256062660627606286062960630606316063260633606346063560636606376063860639606406064160642606436064460645606466064760648606496065060651606526065360654606556065660657606586065960660606616066260663606646066560666606676066860669606706067160672606736067460675606766067760678606796068060681606826068360684606856068660687606886068960690606916069260693606946069560696606976069860699607006070160702607036070460705607066070760708607096071060711607126071360714607156071660717607186071960720607216072260723607246072560726607276072860729607306073160732607336073460735607366073760738607396074060741607426074360744607456074660747607486074960750607516075260753607546075560756607576075860759607606076160762607636076460765607666076760768607696077060771607726077360774607756077660777607786077960780607816078260783607846078560786607876078860789607906079160792607936079460795607966079760798607996080060801608026080360804608056080660807608086080960810608116081260813608146081560816608176081860819608206082160822608236082460825608266082760828608296083060831608326083360834608356083660837608386083960840608416084260843608446084560846608476084860849608506085160852608536085460855608566085760858608596086060861608626086360864608656086660867608686086960870608716087260873608746087560876608776087860879608806088160882608836088460885608866088760888608896089060891608926089360894608956089660897608986089960900609016090260903609046090560906609076090860909609106091160912609136091460915609166091760918609196092060921609226092360924609256092660927609286092960930609316093260933609346093560936609376093860939609406094160942609436094460945609466094760948609496095060951609526095360954609556095660957609586095960960609616096260963609646096560966609676096860969609706097160972609736097460975609766097760978609796098060981609826098360984609856098660987609886098960990609916099260993609946099560996609976099860999610006100161002610036100461005610066100761008610096101061011610126101361014610156101661017610186101961020610216102261023610246102561026610276102861029610306103161032610336103461035610366103761038610396104061041610426104361044610456104661047610486104961050610516105261053610546105561056610576105861059610606106161062610636106461065610666106761068610696107061071610726107361074610756107661077610786107961080610816108261083610846108561086610876108861089610906109161092610936109461095610966109761098610996110061101611026110361104611056110661107611086110961110611116111261113611146111561116611176111861119611206112161122611236112461125611266112761128611296113061131611326113361134611356113661137611386113961140611416114261143611446114561146611476114861149611506115161152611536115461155611566115761158611596116061161611626116361164611656116661167611686116961170611716117261173611746117561176611776117861179611806118161182611836118461185611866118761188611896119061191611926119361194611956119661197611986119961200612016120261203612046120561206612076120861209612106121161212612136121461215612166121761218612196122061221612226122361224612256122661227612286122961230612316123261233612346123561236612376123861239612406124161242612436124461245612466124761248612496125061251612526125361254612556125661257612586125961260612616126261263612646126561266612676126861269612706127161272612736127461275612766127761278612796128061281612826128361284612856128661287612886128961290612916129261293612946129561296612976129861299613006130161302613036130461305613066130761308613096131061311613126131361314613156131661317613186131961320613216132261323613246132561326613276132861329613306133161332613336133461335613366133761338613396134061341613426134361344613456134661347613486134961350613516135261353613546135561356613576135861359613606136161362613636136461365613666136761368613696137061371613726137361374613756137661377613786137961380613816138261383613846138561386613876138861389613906139161392613936139461395613966139761398613996140061401614026140361404614056140661407614086140961410614116141261413614146141561416614176141861419614206142161422614236142461425614266142761428614296143061431614326143361434614356143661437614386143961440614416144261443614446144561446614476144861449614506145161452614536145461455614566145761458614596146061461614626146361464614656146661467614686146961470614716147261473614746147561476614776147861479614806148161482614836148461485614866148761488614896149061491614926149361494614956149661497614986149961500615016150261503615046150561506615076150861509615106151161512615136151461515615166151761518615196152061521615226152361524615256152661527615286152961530615316153261533615346153561536615376153861539615406154161542615436154461545615466154761548615496155061551615526155361554615556155661557615586155961560615616156261563615646156561566615676156861569615706157161572615736157461575615766157761578615796158061581615826158361584615856158661587615886158961590615916159261593615946159561596615976159861599616006160161602616036160461605616066160761608616096161061611616126161361614616156161661617616186161961620616216162261623616246162561626616276162861629616306163161632616336163461635616366163761638616396164061641616426164361644616456164661647616486164961650616516165261653616546165561656616576165861659616606166161662616636166461665616666166761668616696167061671616726167361674616756167661677616786167961680616816168261683616846168561686616876168861689616906169161692616936169461695616966169761698616996170061701617026170361704617056170661707617086170961710617116171261713617146171561716617176171861719617206172161722617236172461725617266172761728617296173061731617326173361734617356173661737617386173961740617416174261743617446174561746617476174861749617506175161752617536175461755617566175761758617596176061761617626176361764617656176661767617686176961770617716177261773617746177561776617776177861779617806178161782617836178461785617866178761788617896179061791617926179361794617956179661797617986179961800618016180261803618046180561806618076180861809618106181161812618136181461815618166181761818618196182061821618226182361824618256182661827618286182961830618316183261833618346183561836618376183861839618406184161842618436184461845618466184761848618496185061851618526185361854618556185661857618586185961860618616186261863618646186561866618676186861869618706187161872618736187461875618766187761878618796188061881618826188361884618856188661887618886188961890618916189261893618946189561896618976189861899619006190161902619036190461905619066190761908619096191061911619126191361914619156191661917619186191961920619216192261923619246192561926619276192861929619306193161932619336193461935619366193761938619396194061941619426194361944619456194661947619486194961950619516195261953619546195561956619576195861959619606196161962619636196461965619666196761968619696197061971619726197361974619756197661977619786197961980619816198261983619846198561986619876198861989619906199161992619936199461995619966199761998619996200062001620026200362004620056200662007620086200962010620116201262013620146201562016620176201862019620206202162022620236202462025620266202762028620296203062031620326203362034620356203662037620386203962040620416204262043620446204562046620476204862049620506205162052620536205462055620566205762058620596206062061620626206362064620656206662067620686206962070620716207262073620746207562076620776207862079620806208162082620836208462085620866208762088620896209062091620926209362094620956209662097620986209962100621016210262103621046210562106621076210862109621106211162112621136211462115621166211762118621196212062121621226212362124621256212662127621286212962130621316213262133621346213562136621376213862139621406214162142621436214462145621466214762148621496215062151621526215362154621556215662157621586215962160621616216262163621646216562166621676216862169621706217162172621736217462175621766217762178621796218062181621826218362184621856218662187621886218962190621916219262193621946219562196621976219862199622006220162202622036220462205622066220762208622096221062211622126221362214622156221662217622186221962220622216222262223622246222562226622276222862229622306223162232622336223462235622366223762238622396224062241622426224362244622456224662247622486224962250622516225262253622546225562256622576225862259622606226162262622636226462265622666226762268622696227062271622726227362274622756227662277622786227962280622816228262283622846228562286622876228862289622906229162292622936229462295622966229762298622996230062301623026230362304623056230662307623086230962310623116231262313623146231562316623176231862319623206232162322623236232462325623266232762328623296233062331623326233362334623356233662337623386233962340623416234262343623446234562346623476234862349623506235162352623536235462355623566235762358623596236062361623626236362364623656236662367623686236962370623716237262373623746237562376623776237862379623806238162382623836238462385623866238762388623896239062391623926239362394623956239662397623986239962400624016240262403624046240562406624076240862409624106241162412624136241462415624166241762418624196242062421624226242362424624256242662427624286242962430624316243262433624346243562436624376243862439624406244162442624436244462445624466244762448624496245062451624526245362454624556245662457624586245962460624616246262463624646246562466624676246862469624706247162472624736247462475624766247762478624796248062481624826248362484624856248662487624886248962490624916249262493624946249562496624976249862499625006250162502625036250462505625066250762508625096251062511625126251362514625156251662517625186251962520625216252262523625246252562526625276252862529625306253162532625336253462535625366253762538625396254062541625426254362544625456254662547625486254962550625516255262553625546255562556625576255862559625606256162562625636256462565625666256762568625696257062571625726257362574625756257662577625786257962580625816258262583625846258562586625876258862589625906259162592625936259462595625966259762598625996260062601626026260362604626056260662607626086260962610626116261262613626146261562616626176261862619626206262162622626236262462625626266262762628626296263062631626326263362634626356263662637626386263962640626416264262643626446264562646626476264862649626506265162652626536265462655626566265762658626596266062661626626266362664626656266662667626686266962670626716267262673626746267562676626776267862679626806268162682626836268462685626866268762688626896269062691626926269362694626956269662697626986269962700627016270262703627046270562706627076270862709627106271162712627136271462715627166271762718627196272062721627226272362724627256272662727627286272962730627316273262733627346273562736627376273862739627406274162742627436274462745627466274762748627496275062751627526275362754627556275662757627586275962760627616276262763627646276562766627676276862769627706277162772627736277462775627766277762778627796278062781627826278362784627856278662787627886278962790627916279262793627946279562796627976279862799628006280162802628036280462805628066280762808628096281062811628126281362814628156281662817628186281962820628216282262823628246282562826628276282862829628306283162832628336283462835628366283762838628396284062841628426284362844628456284662847628486284962850628516285262853628546285562856628576285862859628606286162862628636286462865628666286762868628696287062871628726287362874628756287662877628786287962880628816288262883628846288562886628876288862889628906289162892628936289462895628966289762898628996290062901629026290362904629056290662907629086290962910629116291262913629146291562916629176291862919629206292162922629236292462925629266292762928629296293062931629326293362934629356293662937629386293962940629416294262943629446294562946629476294862949629506295162952629536295462955629566295762958629596296062961629626296362964629656296662967629686296962970629716297262973629746297562976629776297862979629806298162982629836298462985629866298762988629896299062991629926299362994629956299662997629986299963000630016300263003630046300563006630076300863009630106301163012630136301463015630166301763018630196302063021630226302363024630256302663027630286302963030630316303263033630346303563036630376303863039630406304163042630436304463045630466304763048630496305063051630526305363054630556305663057630586305963060630616306263063630646306563066630676306863069630706307163072630736307463075630766307763078630796308063081630826308363084630856308663087630886308963090630916309263093630946309563096630976309863099631006310163102631036310463105631066310763108631096311063111631126311363114631156311663117631186311963120631216312263123631246312563126631276312863129631306313163132631336313463135631366313763138631396314063141631426314363144631456314663147631486314963150631516315263153631546315563156631576315863159631606316163162631636316463165631666316763168631696317063171631726317363174631756317663177631786317963180631816318263183631846318563186631876318863189631906319163192631936319463195631966319763198631996320063201632026320363204632056320663207632086320963210632116321263213632146321563216632176321863219632206322163222632236322463225632266322763228632296323063231632326323363234632356323663237632386323963240632416324263243632446324563246632476324863249632506325163252632536325463255632566325763258632596326063261632626326363264632656326663267632686326963270632716327263273632746327563276632776327863279632806328163282632836328463285632866328763288632896329063291632926329363294632956329663297632986329963300633016330263303633046330563306633076330863309633106331163312633136331463315633166331763318633196332063321633226332363324633256332663327633286332963330633316333263333633346333563336633376333863339633406334163342633436334463345633466334763348633496335063351633526335363354633556335663357633586335963360633616336263363633646336563366633676336863369633706337163372633736337463375633766337763378633796338063381633826338363384633856338663387633886338963390633916339263393633946339563396633976339863399634006340163402634036340463405634066340763408634096341063411634126341363414634156341663417634186341963420634216342263423634246342563426634276342863429634306343163432634336343463435634366343763438634396344063441634426344363444634456344663447634486344963450634516345263453634546345563456634576345863459634606346163462634636346463465634666346763468634696347063471634726347363474634756347663477634786347963480634816348263483634846348563486634876348863489634906349163492634936349463495634966349763498634996350063501635026350363504635056350663507635086350963510635116351263513635146351563516635176351863519635206352163522635236352463525635266352763528635296353063531635326353363534635356353663537635386353963540635416354263543635446354563546635476354863549635506355163552635536355463555635566355763558635596356063561635626356363564635656356663567635686356963570635716357263573635746357563576635776357863579635806358163582635836358463585635866358763588635896359063591635926359363594635956359663597635986359963600636016360263603636046360563606636076360863609636106361163612636136361463615636166361763618636196362063621636226362363624636256362663627636286362963630636316363263633636346363563636636376363863639636406364163642636436364463645636466364763648636496365063651636526365363654636556365663657636586365963660636616366263663636646366563666636676366863669636706367163672636736367463675636766367763678636796368063681636826368363684636856368663687636886368963690636916369263693636946369563696636976369863699637006370163702637036370463705637066370763708637096371063711637126371363714637156371663717637186371963720637216372263723637246372563726637276372863729637306373163732637336373463735637366373763738637396374063741637426374363744637456374663747637486374963750637516375263753637546375563756637576375863759637606376163762637636376463765637666376763768637696377063771637726377363774637756377663777637786377963780637816378263783637846378563786637876378863789637906379163792637936379463795637966379763798637996380063801638026380363804638056380663807638086380963810638116381263813638146381563816638176381863819638206382163822638236382463825638266382763828638296383063831638326383363834638356383663837638386383963840638416384263843638446384563846638476384863849638506385163852638536385463855638566385763858638596386063861638626386363864638656386663867638686386963870638716387263873638746387563876638776387863879638806388163882638836388463885638866388763888638896389063891638926389363894638956389663897638986389963900639016390263903639046390563906639076390863909639106391163912639136391463915639166391763918639196392063921639226392363924639256392663927639286392963930639316393263933639346393563936639376393863939639406394163942639436394463945639466394763948639496395063951639526395363954639556395663957639586395963960639616396263963639646396563966639676396863969639706397163972639736397463975639766397763978639796398063981639826398363984639856398663987639886398963990639916399263993639946399563996639976399863999640006400164002640036400464005640066400764008640096401064011640126401364014640156401664017640186401964020640216402264023640246402564026640276402864029640306403164032640336403464035640366403764038640396404064041640426404364044640456404664047640486404964050640516405264053640546405564056640576405864059640606406164062640636406464065640666406764068640696407064071640726407364074640756407664077640786407964080640816408264083640846408564086640876408864089640906409164092640936409464095640966409764098640996410064101641026410364104641056410664107641086410964110641116411264113641146411564116641176411864119641206412164122641236412464125641266412764128641296413064131641326413364134641356413664137641386413964140641416414264143641446414564146641476414864149641506415164152641536415464155641566415764158641596416064161641626416364164641656416664167641686416964170641716417264173641746417564176641776417864179641806418164182641836418464185641866418764188641896419064191641926419364194641956419664197641986419964200642016420264203642046420564206642076420864209642106421164212642136421464215642166421764218642196422064221642226422364224642256422664227642286422964230642316423264233642346423564236642376423864239642406424164242642436424464245642466424764248642496425064251642526425364254642556425664257642586425964260642616426264263642646426564266642676426864269642706427164272642736427464275642766427764278642796428064281642826428364284642856428664287642886428964290642916429264293642946429564296642976429864299643006430164302643036430464305643066430764308643096431064311643126431364314643156431664317643186431964320643216432264323643246432564326643276432864329643306433164332643336433464335643366433764338643396434064341643426434364344643456434664347643486434964350643516435264353643546435564356643576435864359643606436164362643636436464365643666436764368643696437064371643726437364374643756437664377643786437964380643816438264383643846438564386643876438864389643906439164392643936439464395643966439764398643996440064401644026440364404644056440664407644086440964410644116441264413644146441564416644176441864419644206442164422644236442464425644266442764428644296443064431644326443364434644356443664437644386443964440644416444264443644446444564446644476444864449644506445164452644536445464455644566445764458644596446064461644626446364464644656446664467644686446964470644716447264473644746447564476644776447864479644806448164482644836448464485644866448764488644896449064491644926449364494644956449664497644986449964500645016450264503645046450564506645076450864509645106451164512645136451464515645166451764518645196452064521645226452364524645256452664527645286452964530645316453264533645346453564536645376453864539645406454164542645436454464545645466454764548645496455064551645526455364554645556455664557645586455964560645616456264563645646456564566645676456864569645706457164572645736457464575645766457764578645796458064581645826458364584645856458664587645886458964590645916459264593645946459564596645976459864599646006460164602646036460464605646066460764608646096461064611646126461364614646156461664617646186461964620646216462264623646246462564626646276462864629646306463164632646336463464635646366463764638646396464064641646426464364644646456464664647646486464964650646516465264653646546465564656646576465864659646606466164662646636466464665646666466764668646696467064671646726467364674646756467664677646786467964680646816468264683646846468564686646876468864689646906469164692646936469464695646966469764698646996470064701647026470364704647056470664707647086470964710647116471264713647146471564716647176471864719647206472164722647236472464725647266472764728647296473064731647326473364734647356473664737647386473964740647416474264743647446474564746647476474864749647506475164752647536475464755647566475764758647596476064761647626476364764647656476664767647686476964770647716477264773647746477564776647776477864779647806478164782647836478464785647866478764788647896479064791647926479364794647956479664797647986479964800648016480264803648046480564806648076480864809648106481164812648136481464815648166481764818648196482064821648226482364824648256482664827648286482964830648316483264833648346483564836648376483864839648406484164842648436484464845648466484764848648496485064851648526485364854648556485664857648586485964860648616486264863648646486564866648676486864869648706487164872648736487464875648766487764878648796488064881648826488364884648856488664887648886488964890648916489264893648946489564896648976489864899649006490164902649036490464905649066490764908649096491064911649126491364914649156491664917649186491964920649216492264923649246492564926649276492864929649306493164932649336493464935649366493764938649396494064941649426494364944649456494664947649486494964950649516495264953649546495564956649576495864959649606496164962649636496464965649666496764968649696497064971649726497364974649756497664977649786497964980649816498264983649846498564986649876498864989649906499164992649936499464995649966499764998649996500065001650026500365004650056500665007650086500965010650116501265013650146501565016650176501865019650206502165022650236502465025650266502765028650296503065031650326503365034650356503665037650386503965040650416504265043650446504565046650476504865049650506505165052650536505465055650566505765058650596506065061650626506365064650656506665067650686506965070650716507265073650746507565076650776507865079650806508165082650836508465085650866508765088650896509065091650926509365094650956509665097650986509965100651016510265103651046510565106651076510865109651106511165112651136511465115651166511765118651196512065121651226512365124651256512665127651286512965130651316513265133651346513565136651376513865139651406514165142651436514465145651466514765148651496515065151651526515365154651556515665157651586515965160651616516265163651646516565166651676516865169651706517165172651736517465175651766517765178651796518065181651826518365184651856518665187651886518965190651916519265193651946519565196651976519865199652006520165202652036520465205652066520765208652096521065211652126521365214652156521665217652186521965220652216522265223652246522565226652276522865229652306523165232652336523465235652366523765238652396524065241652426524365244652456524665247652486524965250652516525265253652546525565256652576525865259652606526165262652636526465265652666526765268652696527065271652726527365274652756527665277652786527965280652816528265283652846528565286652876528865289652906529165292652936529465295652966529765298652996530065301653026530365304653056530665307653086530965310653116531265313653146531565316653176531865319653206532165322653236532465325653266532765328653296533065331653326533365334653356533665337653386533965340653416534265343653446534565346653476534865349653506535165352653536535465355653566535765358653596536065361653626536365364653656536665367653686536965370653716537265373653746537565376653776537865379653806538165382653836538465385653866538765388653896539065391653926539365394653956539665397653986539965400654016540265403654046540565406654076540865409654106541165412654136541465415654166541765418654196542065421654226542365424654256542665427654286542965430654316543265433654346543565436654376543865439654406544165442654436544465445654466544765448654496545065451654526545365454654556545665457654586545965460654616546265463654646546565466654676546865469654706547165472654736547465475654766547765478654796548065481654826548365484654856548665487654886548965490654916549265493654946549565496654976549865499655006550165502655036550465505655066550765508655096551065511655126551365514655156551665517655186551965520655216552265523655246552565526655276552865529655306553165532655336553465535655366553765538655396554065541655426554365544655456554665547655486554965550655516555265553655546555565556655576555865559655606556165562655636556465565655666556765568655696557065571655726557365574655756557665577655786557965580655816558265583655846558565586655876558865589655906559165592655936559465595655966559765598655996560065601656026560365604656056560665607656086560965610656116561265613656146561565616656176561865619656206562165622656236562465625656266562765628656296563065631656326563365634656356563665637656386563965640656416564265643656446564565646656476564865649656506565165652656536565465655656566565765658656596566065661656626566365664656656566665667656686566965670656716567265673656746567565676656776567865679656806568165682656836568465685656866568765688656896569065691656926569365694656956569665697656986569965700657016570265703657046570565706657076570865709657106571165712657136571465715657166571765718657196572065721657226572365724657256572665727657286572965730657316573265733657346573565736657376573865739657406574165742657436574465745657466574765748657496575065751657526575365754657556575665757657586575965760657616576265763657646576565766657676576865769657706577165772657736577465775657766577765778657796578065781657826578365784657856578665787657886578965790657916579265793657946579565796657976579865799658006580165802658036580465805658066580765808658096581065811658126581365814658156581665817658186581965820658216582265823658246582565826658276582865829658306583165832658336583465835658366583765838658396584065841658426584365844658456584665847658486584965850658516585265853658546585565856658576585865859658606586165862658636586465865658666586765868658696587065871658726587365874658756587665877658786587965880658816588265883658846588565886658876588865889658906589165892658936589465895658966589765898658996590065901659026590365904659056590665907659086590965910659116591265913659146591565916659176591865919659206592165922659236592465925659266592765928659296593065931659326593365934659356593665937659386593965940659416594265943659446594565946659476594865949659506595165952659536595465955659566595765958659596596065961659626596365964659656596665967659686596965970659716597265973659746597565976659776597865979659806598165982659836598465985659866598765988659896599065991659926599365994659956599665997659986599966000660016600266003660046600566006660076600866009660106601166012660136601466015660166601766018660196602066021660226602366024660256602666027660286602966030660316603266033660346603566036660376603866039660406604166042660436604466045660466604766048660496605066051660526605366054660556605666057660586605966060660616606266063660646606566066660676606866069660706607166072660736607466075660766607766078660796608066081660826608366084660856608666087660886608966090660916609266093660946609566096660976609866099661006610166102661036610466105661066610766108661096611066111661126611366114661156611666117661186611966120661216612266123661246612566126661276612866129661306613166132661336613466135661366613766138661396614066141661426614366144661456614666147661486614966150661516615266153661546615566156661576615866159661606616166162661636616466165661666616766168661696617066171661726617366174661756617666177661786617966180661816618266183661846618566186661876618866189661906619166192661936619466195661966619766198661996620066201662026620366204662056620666207662086620966210662116621266213662146621566216662176621866219662206622166222662236622466225662266622766228662296623066231662326623366234662356623666237662386623966240662416624266243662446624566246662476624866249662506625166252662536625466255662566625766258662596626066261662626626366264662656626666267662686626966270662716627266273662746627566276662776627866279662806628166282662836628466285662866628766288662896629066291662926629366294662956629666297662986629966300663016630266303663046630566306663076630866309663106631166312663136631466315663166631766318663196632066321663226632366324663256632666327663286632966330663316633266333663346633566336663376633866339663406634166342663436634466345663466634766348663496635066351663526635366354663556635666357663586635966360663616636266363663646636566366663676636866369663706637166372663736637466375663766637766378663796638066381663826638366384663856638666387663886638966390663916639266393663946639566396663976639866399664006640166402664036640466405664066640766408664096641066411664126641366414664156641666417664186641966420664216642266423664246642566426664276642866429664306643166432664336643466435664366643766438664396644066441664426644366444664456644666447664486644966450664516645266453664546645566456664576645866459664606646166462664636646466465664666646766468664696647066471664726647366474664756647666477664786647966480664816648266483664846648566486664876648866489664906649166492664936649466495664966649766498664996650066501665026650366504665056650666507665086650966510665116651266513665146651566516665176651866519665206652166522665236652466525665266652766528665296653066531665326653366534665356653666537665386653966540665416654266543665446654566546665476654866549665506655166552665536655466555665566655766558665596656066561665626656366564665656656666567665686656966570665716657266573665746657566576665776657866579665806658166582665836658466585665866658766588665896659066591665926659366594665956659666597665986659966600666016660266603666046660566606666076660866609666106661166612666136661466615666166661766618666196662066621666226662366624666256662666627666286662966630666316663266633666346663566636666376663866639666406664166642666436664466645666466664766648666496665066651666526665366654666556665666657666586665966660666616666266663666646666566666666676666866669666706667166672666736667466675666766667766678666796668066681666826668366684666856668666687666886668966690666916669266693666946669566696666976669866699667006670166702667036670466705667066670766708667096671066711667126671366714667156671666717667186671966720667216672266723667246672566726667276672866729667306673166732667336673466735667366673766738667396674066741667426674366744667456674666747667486674966750667516675266753667546675566756667576675866759667606676166762667636676466765667666676766768667696677066771667726677366774667756677666777667786677966780667816678266783667846678566786667876678866789667906679166792667936679466795667966679766798667996680066801668026680366804668056680666807668086680966810668116681266813668146681566816668176681866819668206682166822668236682466825668266682766828668296683066831668326683366834668356683666837668386683966840668416684266843668446684566846668476684866849668506685166852668536685466855668566685766858668596686066861668626686366864668656686666867668686686966870668716687266873668746687566876668776687866879668806688166882668836688466885668866688766888668896689066891668926689366894668956689666897668986689966900669016690266903669046690566906669076690866909669106691166912669136691466915669166691766918669196692066921669226692366924669256692666927669286692966930669316693266933669346693566936669376693866939669406694166942669436694466945669466694766948669496695066951669526695366954669556695666957669586695966960669616696266963669646696566966669676696866969669706697166972669736697466975669766697766978669796698066981669826698366984669856698666987669886698966990669916699266993669946699566996669976699866999670006700167002670036700467005670066700767008670096701067011670126701367014670156701667017670186701967020670216702267023670246702567026670276702867029670306703167032670336703467035670366703767038670396704067041670426704367044670456704667047670486704967050670516705267053670546705567056670576705867059670606706167062670636706467065670666706767068670696707067071670726707367074670756707667077670786707967080670816708267083670846708567086670876708867089670906709167092670936709467095670966709767098670996710067101671026710367104671056710667107671086710967110671116711267113671146711567116671176711867119671206712167122671236712467125671266712767128671296713067131671326713367134671356713667137671386713967140671416714267143671446714567146671476714867149671506715167152671536715467155671566715767158671596716067161671626716367164671656716667167671686716967170671716717267173671746717567176671776717867179671806718167182671836718467185671866718767188671896719067191671926719367194671956719667197671986719967200672016720267203672046720567206672076720867209672106721167212672136721467215672166721767218672196722067221672226722367224672256722667227672286722967230672316723267233672346723567236672376723867239672406724167242672436724467245672466724767248672496725067251672526725367254672556725667257672586725967260672616726267263672646726567266672676726867269672706727167272672736727467275672766727767278672796728067281672826728367284672856728667287672886728967290672916729267293672946729567296672976729867299673006730167302673036730467305673066730767308673096731067311673126731367314673156731667317673186731967320673216732267323673246732567326673276732867329673306733167332673336733467335673366733767338673396734067341673426734367344673456734667347673486734967350673516735267353673546735567356673576735867359673606736167362673636736467365673666736767368673696737067371673726737367374673756737667377673786737967380673816738267383673846738567386673876738867389673906739167392673936739467395673966739767398673996740067401674026740367404674056740667407674086740967410674116741267413674146741567416674176741867419674206742167422674236742467425674266742767428674296743067431674326743367434674356743667437674386743967440674416744267443674446744567446674476744867449674506745167452674536745467455674566745767458674596746067461674626746367464674656746667467674686746967470674716747267473674746747567476674776747867479674806748167482674836748467485674866748767488674896749067491674926749367494674956749667497674986749967500675016750267503675046750567506675076750867509675106751167512675136751467515675166751767518675196752067521675226752367524675256752667527675286752967530675316753267533675346753567536675376753867539675406754167542675436754467545675466754767548675496755067551675526755367554675556755667557675586755967560675616756267563675646756567566675676756867569675706757167572675736757467575675766757767578675796758067581675826758367584675856758667587675886758967590675916759267593675946759567596675976759867599676006760167602676036760467605676066760767608676096761067611676126761367614676156761667617676186761967620676216762267623676246762567626676276762867629676306763167632676336763467635676366763767638676396764067641676426764367644676456764667647676486764967650676516765267653676546765567656676576765867659676606766167662676636766467665676666766767668676696767067671676726767367674676756767667677676786767967680676816768267683676846768567686676876768867689676906769167692676936769467695676966769767698676996770067701677026770367704677056770667707677086770967710677116771267713677146771567716677176771867719677206772167722677236772467725677266772767728677296773067731677326773367734677356773667737677386773967740677416774267743677446774567746677476774867749677506775167752677536775467755677566775767758677596776067761677626776367764677656776667767677686776967770677716777267773677746777567776677776777867779677806778167782677836778467785677866778767788677896779067791677926779367794677956779667797677986779967800678016780267803678046780567806678076780867809678106781167812678136781467815678166781767818678196782067821678226782367824678256782667827678286782967830678316783267833678346783567836678376783867839678406784167842678436784467845678466784767848678496785067851678526785367854678556785667857678586785967860678616786267863678646786567866678676786867869678706787167872678736787467875678766787767878678796788067881678826788367884678856788667887678886788967890678916789267893678946789567896678976789867899679006790167902679036790467905679066790767908679096791067911679126791367914679156791667917679186791967920679216792267923679246792567926679276792867929679306793167932679336793467935679366793767938679396794067941679426794367944679456794667947679486794967950679516795267953679546795567956679576795867959679606796167962679636796467965679666796767968679696797067971679726797367974679756797667977679786797967980679816798267983679846798567986679876798867989679906799167992679936799467995679966799767998679996800068001680026800368004680056800668007680086800968010680116801268013680146801568016680176801868019680206802168022680236802468025680266802768028680296803068031680326803368034680356803668037680386803968040680416804268043680446804568046680476804868049680506805168052680536805468055680566805768058680596806068061680626806368064680656806668067680686806968070680716807268073680746807568076680776807868079680806808168082680836808468085680866808768088680896809068091680926809368094680956809668097680986809968100681016810268103681046810568106681076810868109681106811168112681136811468115681166811768118681196812068121681226812368124681256812668127681286812968130681316813268133681346813568136681376813868139681406814168142681436814468145681466814768148681496815068151681526815368154
  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. /******/ var __webpack_modules__ = ([
  34. /* 0 */,
  35. /* 1 */
  36. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  37. "use strict";
  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__(134);
  44. var _core_utils = __w_pdfjs_require__(135);
  45. var _pdf_manager = __w_pdfjs_require__(137);
  46. var _cleanup_helper = __w_pdfjs_require__(200);
  47. var _writer = __w_pdfjs_require__(194);
  48. var _is_node = __w_pdfjs_require__(4);
  49. var _message_handler = __w_pdfjs_require__(231);
  50. var _worker_stream = __w_pdfjs_require__(232);
  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(_ref) {
  154. let {
  155. data,
  156. password,
  157. disableAutoFetch,
  158. rangeChunkSize,
  159. length,
  160. docBaseUrl,
  161. enableXfa,
  162. evaluatorOptions
  163. } = _ref;
  164. const pdfManagerCapability = (0, _util.createPromiseCapability)();
  165. let newPdfManager;
  166. if (data) {
  167. try {
  168. newPdfManager = new _pdf_manager.LocalPdfManager(docId, data, password, handler, evaluatorOptions, enableXfa, docBaseUrl);
  169. pdfManagerCapability.resolve(newPdfManager);
  170. } catch (ex) {
  171. pdfManagerCapability.reject(ex);
  172. }
  173. return pdfManagerCapability.promise;
  174. }
  175. let pdfStream,
  176. cachedChunks = [];
  177. try {
  178. pdfStream = new _worker_stream.PDFWorkerStream(handler);
  179. } catch (ex) {
  180. pdfManagerCapability.reject(ex);
  181. return pdfManagerCapability.promise;
  182. }
  183. const fullRequest = pdfStream.getFullReader();
  184. fullRequest.headersReady.then(function () {
  185. if (!fullRequest.isRangeSupported) {
  186. return;
  187. }
  188. disableAutoFetch = disableAutoFetch || fullRequest.isStreamingSupported;
  189. newPdfManager = new _pdf_manager.NetworkPdfManager(docId, pdfStream, {
  190. msgHandler: handler,
  191. password,
  192. length: fullRequest.contentLength,
  193. disableAutoFetch,
  194. rangeChunkSize
  195. }, evaluatorOptions, enableXfa, docBaseUrl);
  196. for (const chunk of cachedChunks) {
  197. newPdfManager.sendProgressiveData(chunk);
  198. }
  199. cachedChunks = [];
  200. pdfManagerCapability.resolve(newPdfManager);
  201. cancelXHRs = null;
  202. }).catch(function (reason) {
  203. pdfManagerCapability.reject(reason);
  204. cancelXHRs = null;
  205. });
  206. let loaded = 0;
  207. const flushChunks = function () {
  208. const pdfFile = (0, _util.arraysToBytes)(cachedChunks);
  209. if (length && pdfFile.length !== length) {
  210. (0, _util.warn)("reported HTTP length is different from actual");
  211. }
  212. try {
  213. newPdfManager = new _pdf_manager.LocalPdfManager(docId, pdfFile, password, handler, evaluatorOptions, enableXfa, docBaseUrl);
  214. pdfManagerCapability.resolve(newPdfManager);
  215. } catch (ex) {
  216. pdfManagerCapability.reject(ex);
  217. }
  218. cachedChunks = [];
  219. };
  220. new Promise(function (resolve, reject) {
  221. const readChunk = function (_ref2) {
  222. let {
  223. value,
  224. done
  225. } = _ref2;
  226. try {
  227. ensureNotTerminated();
  228. if (done) {
  229. if (!newPdfManager) {
  230. flushChunks();
  231. }
  232. cancelXHRs = null;
  233. return;
  234. }
  235. loaded += (0, _util.arrayByteLength)(value);
  236. if (!fullRequest.isStreamingSupported) {
  237. handler.send("DocProgress", {
  238. loaded,
  239. total: Math.max(loaded, fullRequest.contentLength || 0)
  240. });
  241. }
  242. if (newPdfManager) {
  243. newPdfManager.sendProgressiveData(value);
  244. } else {
  245. cachedChunks.push(value);
  246. }
  247. fullRequest.read().then(readChunk, reject);
  248. } catch (e) {
  249. reject(e);
  250. }
  251. };
  252. fullRequest.read().then(readChunk, reject);
  253. }).catch(function (e) {
  254. pdfManagerCapability.reject(e);
  255. cancelXHRs = null;
  256. });
  257. cancelXHRs = function (reason) {
  258. pdfStream.cancelAllRequests(reason);
  259. };
  260. return pdfManagerCapability.promise;
  261. }
  262. function setupDoc(data) {
  263. function onSuccess(doc) {
  264. ensureNotTerminated();
  265. handler.send("GetDoc", {
  266. pdfInfo: doc
  267. });
  268. }
  269. function onFailure(ex) {
  270. ensureNotTerminated();
  271. if (ex instanceof _util.PasswordException) {
  272. const task = new WorkerTask(`PasswordException: response ${ex.code}`);
  273. startWorkerTask(task);
  274. handler.sendWithPromise("PasswordRequest", ex).then(function (_ref3) {
  275. let {
  276. password
  277. } = _ref3;
  278. finishWorkerTask(task);
  279. pdfManager.updatePassword(password);
  280. pdfManagerReady();
  281. }).catch(function () {
  282. finishWorkerTask(task);
  283. handler.send("DocException", ex);
  284. });
  285. } else if (ex instanceof _util.InvalidPDFException || ex instanceof _util.MissingPDFException || ex instanceof _util.UnexpectedResponseException || ex instanceof _util.UnknownErrorException) {
  286. handler.send("DocException", ex);
  287. } else {
  288. handler.send("DocException", new _util.UnknownErrorException(ex.message, ex.toString()));
  289. }
  290. }
  291. function pdfManagerReady() {
  292. ensureNotTerminated();
  293. loadDocument(false).then(onSuccess, function (reason) {
  294. ensureNotTerminated();
  295. if (!(reason instanceof _core_utils.XRefParseException)) {
  296. onFailure(reason);
  297. return;
  298. }
  299. pdfManager.requestLoadedStream().then(function () {
  300. ensureNotTerminated();
  301. loadDocument(true).then(onSuccess, onFailure);
  302. });
  303. });
  304. }
  305. ensureNotTerminated();
  306. getPdfManager(data).then(function (newPdfManager) {
  307. if (terminated) {
  308. newPdfManager.terminate(new _util.AbortException("Worker was terminated."));
  309. throw new Error("Worker was terminated");
  310. }
  311. pdfManager = newPdfManager;
  312. pdfManager.requestLoadedStream(true).then(stream => {
  313. handler.send("DataLoaded", {
  314. length: stream.bytes.byteLength
  315. });
  316. });
  317. }).then(pdfManagerReady, onFailure);
  318. }
  319. handler.on("GetPage", function (data) {
  320. return pdfManager.getPage(data.pageIndex).then(function (page) {
  321. return Promise.all([pdfManager.ensure(page, "rotate"), pdfManager.ensure(page, "ref"), pdfManager.ensure(page, "userUnit"), pdfManager.ensure(page, "view")]).then(function (_ref4) {
  322. let [rotate, ref, userUnit, view] = _ref4;
  323. return {
  324. rotate,
  325. ref,
  326. userUnit,
  327. view
  328. };
  329. });
  330. });
  331. });
  332. handler.on("GetPageIndex", function (data) {
  333. const pageRef = _primitives.Ref.get(data.num, data.gen);
  334. return pdfManager.ensureCatalog("getPageIndex", [pageRef]);
  335. });
  336. handler.on("GetDestinations", function (data) {
  337. return pdfManager.ensureCatalog("destinations");
  338. });
  339. handler.on("GetDestination", function (data) {
  340. return pdfManager.ensureCatalog("getDestination", [data.id]);
  341. });
  342. handler.on("GetPageLabels", function (data) {
  343. return pdfManager.ensureCatalog("pageLabels");
  344. });
  345. handler.on("GetPageLayout", function (data) {
  346. return pdfManager.ensureCatalog("pageLayout");
  347. });
  348. handler.on("GetPageMode", function (data) {
  349. return pdfManager.ensureCatalog("pageMode");
  350. });
  351. handler.on("GetViewerPreferences", function (data) {
  352. return pdfManager.ensureCatalog("viewerPreferences");
  353. });
  354. handler.on("GetOpenAction", function (data) {
  355. return pdfManager.ensureCatalog("openAction");
  356. });
  357. handler.on("GetAttachments", function (data) {
  358. return pdfManager.ensureCatalog("attachments");
  359. });
  360. handler.on("GetJavaScript", function (data) {
  361. return pdfManager.ensureCatalog("javaScript");
  362. });
  363. handler.on("GetDocJSActions", function (data) {
  364. return pdfManager.ensureCatalog("jsActions");
  365. });
  366. handler.on("GetPageJSActions", function (_ref5) {
  367. let {
  368. pageIndex
  369. } = _ref5;
  370. return pdfManager.getPage(pageIndex).then(function (page) {
  371. return pdfManager.ensure(page, "jsActions");
  372. });
  373. });
  374. handler.on("GetOutline", function (data) {
  375. return pdfManager.ensureCatalog("documentOutline");
  376. });
  377. handler.on("GetOptionalContentConfig", function (data) {
  378. return pdfManager.ensureCatalog("optionalContentConfig");
  379. });
  380. handler.on("GetPermissions", function (data) {
  381. return pdfManager.ensureCatalog("permissions");
  382. });
  383. handler.on("GetMetadata", function (data) {
  384. return Promise.all([pdfManager.ensureDoc("documentInfo"), pdfManager.ensureCatalog("metadata")]);
  385. });
  386. handler.on("GetMarkInfo", function (data) {
  387. return pdfManager.ensureCatalog("markInfo");
  388. });
  389. handler.on("GetData", function (data) {
  390. return pdfManager.requestLoadedStream().then(function (stream) {
  391. return stream.bytes;
  392. });
  393. });
  394. handler.on("GetAnnotations", function (_ref6) {
  395. let {
  396. pageIndex,
  397. intent
  398. } = _ref6;
  399. return pdfManager.getPage(pageIndex).then(function (page) {
  400. const task = new WorkerTask(`GetAnnotations: page ${pageIndex}`);
  401. startWorkerTask(task);
  402. return page.getAnnotationsData(handler, task, intent).then(data => {
  403. finishWorkerTask(task);
  404. return data;
  405. }, reason => {
  406. finishWorkerTask(task);
  407. });
  408. });
  409. });
  410. handler.on("GetFieldObjects", function (data) {
  411. return pdfManager.ensureDoc("fieldObjects");
  412. });
  413. handler.on("HasJSActions", function (data) {
  414. return pdfManager.ensureDoc("hasJSActions");
  415. });
  416. handler.on("GetCalculationOrderIds", function (data) {
  417. return pdfManager.ensureDoc("calculationOrderIds");
  418. });
  419. handler.on("SaveDocument", function (_ref7) {
  420. let {
  421. isPureXfa,
  422. numPages,
  423. annotationStorage,
  424. filename
  425. } = _ref7;
  426. const promises = [pdfManager.requestLoadedStream(), pdfManager.ensureCatalog("acroForm"), pdfManager.ensureCatalog("acroFormRef"), pdfManager.ensureDoc("xref"), pdfManager.ensureDoc("startXRef")];
  427. const newAnnotationsByPage = !isPureXfa ? (0, _core_utils.getNewAnnotationsMap)(annotationStorage) : null;
  428. if (newAnnotationsByPage) {
  429. for (const [pageIndex, annotations] of newAnnotationsByPage) {
  430. promises.push(pdfManager.getPage(pageIndex).then(page => {
  431. const task = new WorkerTask(`Save (editor): page ${pageIndex}`);
  432. return page.saveNewAnnotations(handler, task, annotations).finally(function () {
  433. finishWorkerTask(task);
  434. });
  435. }));
  436. }
  437. }
  438. if (isPureXfa) {
  439. promises.push(pdfManager.serializeXfaData(annotationStorage));
  440. } else {
  441. for (let pageIndex = 0; pageIndex < numPages; pageIndex++) {
  442. promises.push(pdfManager.getPage(pageIndex).then(function (page) {
  443. const task = new WorkerTask(`Save: page ${pageIndex}`);
  444. return page.save(handler, task, annotationStorage).finally(function () {
  445. finishWorkerTask(task);
  446. });
  447. }));
  448. }
  449. }
  450. return Promise.all(promises).then(function (_ref8) {
  451. let [stream, acroForm, acroFormRef, xref, startXRef, ...refs] = _ref8;
  452. let newRefs = [];
  453. let xfaData = null;
  454. if (isPureXfa) {
  455. xfaData = refs[0];
  456. if (!xfaData) {
  457. return stream.bytes;
  458. }
  459. } else {
  460. newRefs = refs.flat(2);
  461. if (newRefs.length === 0) {
  462. return stream.bytes;
  463. }
  464. }
  465. const needAppearances = acroFormRef && acroForm instanceof _primitives.Dict && newRefs.some(ref => ref.needAppearances);
  466. const xfa = acroForm instanceof _primitives.Dict && acroForm.get("XFA") || null;
  467. let xfaDatasetsRef = null;
  468. let hasXfaDatasetsEntry = false;
  469. if (Array.isArray(xfa)) {
  470. for (let i = 0, ii = xfa.length; i < ii; i += 2) {
  471. if (xfa[i] === "datasets") {
  472. xfaDatasetsRef = xfa[i + 1];
  473. hasXfaDatasetsEntry = true;
  474. }
  475. }
  476. if (xfaDatasetsRef === null) {
  477. xfaDatasetsRef = xref.getNewTemporaryRef();
  478. }
  479. } else if (xfa) {
  480. (0, _util.warn)("Unsupported XFA type.");
  481. }
  482. let newXrefInfo = Object.create(null);
  483. if (xref.trailer) {
  484. const infoObj = Object.create(null);
  485. const xrefInfo = xref.trailer.get("Info") || null;
  486. if (xrefInfo instanceof _primitives.Dict) {
  487. xrefInfo.forEach((key, value) => {
  488. if (typeof value === "string") {
  489. infoObj[key] = (0, _util.stringToPDFString)(value);
  490. }
  491. });
  492. }
  493. newXrefInfo = {
  494. rootRef: xref.trailer.getRaw("Root") || null,
  495. encryptRef: xref.trailer.getRaw("Encrypt") || null,
  496. newRef: xref.getNewTemporaryRef(),
  497. infoRef: xref.trailer.getRaw("Info") || null,
  498. info: infoObj,
  499. fileIds: xref.trailer.get("ID") || null,
  500. startXRef,
  501. filename
  502. };
  503. }
  504. try {
  505. return (0, _writer.incrementalUpdate)({
  506. originalData: stream.bytes,
  507. xrefInfo: newXrefInfo,
  508. newRefs,
  509. xref,
  510. hasXfa: !!xfa,
  511. xfaDatasetsRef,
  512. hasXfaDatasetsEntry,
  513. needAppearances,
  514. acroFormRef,
  515. acroForm,
  516. xfaData
  517. });
  518. } finally {
  519. xref.resetNewTemporaryRef();
  520. }
  521. });
  522. });
  523. handler.on("GetOperatorList", function (data, sink) {
  524. const pageIndex = data.pageIndex;
  525. pdfManager.getPage(pageIndex).then(function (page) {
  526. const task = new WorkerTask(`GetOperatorList: page ${pageIndex}`);
  527. startWorkerTask(task);
  528. const start = verbosity >= _util.VerbosityLevel.INFOS ? Date.now() : 0;
  529. page.getOperatorList({
  530. handler,
  531. sink,
  532. task,
  533. intent: data.intent,
  534. cacheKey: data.cacheKey,
  535. annotationStorage: data.annotationStorage
  536. }).then(function (operatorListInfo) {
  537. finishWorkerTask(task);
  538. if (start) {
  539. (0, _util.info)(`page=${pageIndex + 1} - getOperatorList: time=` + `${Date.now() - start}ms, len=${operatorListInfo.length}`);
  540. }
  541. sink.close();
  542. }, function (reason) {
  543. finishWorkerTask(task);
  544. if (task.terminated) {
  545. return;
  546. }
  547. sink.error(reason);
  548. });
  549. });
  550. });
  551. handler.on("GetTextContent", function (data, sink) {
  552. const pageIndex = data.pageIndex;
  553. pdfManager.getPage(pageIndex).then(function (page) {
  554. const task = new WorkerTask("GetTextContent: page " + pageIndex);
  555. startWorkerTask(task);
  556. const start = verbosity >= _util.VerbosityLevel.INFOS ? Date.now() : 0;
  557. page.extractTextContent({
  558. handler,
  559. task,
  560. sink,
  561. includeMarkedContent: data.includeMarkedContent,
  562. combineTextItems: data.combineTextItems
  563. }).then(function () {
  564. finishWorkerTask(task);
  565. if (start) {
  566. (0, _util.info)(`page=${pageIndex + 1} - getTextContent: time=` + `${Date.now() - start}ms`);
  567. }
  568. sink.close();
  569. }, function (reason) {
  570. finishWorkerTask(task);
  571. if (task.terminated) {
  572. return;
  573. }
  574. sink.error(reason);
  575. });
  576. });
  577. });
  578. handler.on("GetStructTree", function (data) {
  579. return pdfManager.getPage(data.pageIndex).then(function (page) {
  580. return pdfManager.ensure(page, "getStructTree");
  581. });
  582. });
  583. handler.on("FontFallback", function (data) {
  584. return pdfManager.fontFallback(data.id, handler);
  585. });
  586. handler.on("Cleanup", function (data) {
  587. return pdfManager.cleanup(true);
  588. });
  589. handler.on("Terminate", function (data) {
  590. terminated = true;
  591. const waitOn = [];
  592. if (pdfManager) {
  593. pdfManager.terminate(new _util.AbortException("Worker was terminated."));
  594. const cleanupPromise = pdfManager.cleanup();
  595. waitOn.push(cleanupPromise);
  596. pdfManager = null;
  597. } else {
  598. (0, _cleanup_helper.clearGlobalCaches)();
  599. }
  600. if (cancelXHRs) {
  601. cancelXHRs(new _util.AbortException("Worker was terminated."));
  602. }
  603. for (const task of WorkerTasks) {
  604. waitOn.push(task.finished);
  605. task.terminate();
  606. }
  607. return Promise.all(waitOn).then(function () {
  608. handler.destroy();
  609. handler = null;
  610. });
  611. });
  612. handler.on("Ready", function (data) {
  613. setupDoc(docParams);
  614. docParams = null;
  615. });
  616. return workerHandlerName;
  617. }
  618. static initializeFromPort(port) {
  619. const handler = new _message_handler.MessageHandler("worker", "main", port);
  620. WorkerMessageHandler.setup(handler, port);
  621. handler.send("ready", null);
  622. }
  623. }
  624. exports.WorkerMessageHandler = WorkerMessageHandler;
  625. function isMessagePort(maybePort) {
  626. return typeof maybePort.postMessage === "function" && "onmessage" in maybePort;
  627. }
  628. if (typeof window === "undefined" && !_is_node.isNodeJS && typeof self !== "undefined" && isMessagePort(self)) {
  629. WorkerMessageHandler.initializeFromPort(self);
  630. }
  631. /***/ }),
  632. /* 2 */
  633. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  634. "use strict";
  635. Object.defineProperty(exports, "__esModule", ({
  636. value: true
  637. }));
  638. 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;
  639. exports.arrayByteLength = arrayByteLength;
  640. exports.arraysToBytes = arraysToBytes;
  641. exports.assert = assert;
  642. exports.bytesToString = bytesToString;
  643. exports.createPromiseCapability = createPromiseCapability;
  644. exports.createValidAbsoluteUrl = createValidAbsoluteUrl;
  645. exports.getModificationDate = getModificationDate;
  646. exports.getVerbosityLevel = getVerbosityLevel;
  647. exports.info = info;
  648. exports.isArrayBuffer = isArrayBuffer;
  649. exports.isArrayEqual = isArrayEqual;
  650. exports.objectFromMap = objectFromMap;
  651. exports.objectSize = objectSize;
  652. exports.setVerbosityLevel = setVerbosityLevel;
  653. exports.shadow = shadow;
  654. exports.string32 = string32;
  655. exports.stringToBytes = stringToBytes;
  656. exports.stringToPDFString = stringToPDFString;
  657. exports.stringToUTF8String = stringToUTF8String;
  658. exports.unreachable = unreachable;
  659. exports.utf8StringToString = utf8StringToString;
  660. exports.warn = warn;
  661. if (!globalThis._pdfjsCompatibilityChecked) {
  662. globalThis._pdfjsCompatibilityChecked = true;
  663. __w_pdfjs_require__(3);
  664. }
  665. const IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];
  666. exports.IDENTITY_MATRIX = IDENTITY_MATRIX;
  667. const FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0];
  668. exports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX;
  669. const LINE_FACTOR = 1.35;
  670. exports.LINE_FACTOR = LINE_FACTOR;
  671. const LINE_DESCENT_FACTOR = 0.35;
  672. exports.LINE_DESCENT_FACTOR = LINE_DESCENT_FACTOR;
  673. const BASELINE_FACTOR = LINE_DESCENT_FACTOR / LINE_FACTOR;
  674. exports.BASELINE_FACTOR = BASELINE_FACTOR;
  675. const RenderingIntentFlag = {
  676. ANY: 0x01,
  677. DISPLAY: 0x02,
  678. PRINT: 0x04,
  679. SAVE: 0x08,
  680. ANNOTATIONS_FORMS: 0x10,
  681. ANNOTATIONS_STORAGE: 0x20,
  682. ANNOTATIONS_DISABLE: 0x40,
  683. OPLIST: 0x100
  684. };
  685. exports.RenderingIntentFlag = RenderingIntentFlag;
  686. const AnnotationMode = {
  687. DISABLE: 0,
  688. ENABLE: 1,
  689. ENABLE_FORMS: 2,
  690. ENABLE_STORAGE: 3
  691. };
  692. exports.AnnotationMode = AnnotationMode;
  693. const AnnotationEditorPrefix = "pdfjs_internal_editor_";
  694. exports.AnnotationEditorPrefix = AnnotationEditorPrefix;
  695. const AnnotationEditorType = {
  696. DISABLE: -1,
  697. NONE: 0,
  698. FREETEXT: 3,
  699. INK: 15
  700. };
  701. exports.AnnotationEditorType = AnnotationEditorType;
  702. const AnnotationEditorParamsType = {
  703. FREETEXT_SIZE: 1,
  704. FREETEXT_COLOR: 2,
  705. FREETEXT_OPACITY: 3,
  706. INK_COLOR: 11,
  707. INK_THICKNESS: 12,
  708. INK_OPACITY: 13
  709. };
  710. exports.AnnotationEditorParamsType = AnnotationEditorParamsType;
  711. const PermissionFlag = {
  712. PRINT: 0x04,
  713. MODIFY_CONTENTS: 0x08,
  714. COPY: 0x10,
  715. MODIFY_ANNOTATIONS: 0x20,
  716. FILL_INTERACTIVE_FORMS: 0x100,
  717. COPY_FOR_ACCESSIBILITY: 0x200,
  718. ASSEMBLE: 0x400,
  719. PRINT_HIGH_QUALITY: 0x800
  720. };
  721. exports.PermissionFlag = PermissionFlag;
  722. const TextRenderingMode = {
  723. FILL: 0,
  724. STROKE: 1,
  725. FILL_STROKE: 2,
  726. INVISIBLE: 3,
  727. FILL_ADD_TO_PATH: 4,
  728. STROKE_ADD_TO_PATH: 5,
  729. FILL_STROKE_ADD_TO_PATH: 6,
  730. ADD_TO_PATH: 7,
  731. FILL_STROKE_MASK: 3,
  732. ADD_TO_PATH_FLAG: 4
  733. };
  734. exports.TextRenderingMode = TextRenderingMode;
  735. const ImageKind = {
  736. GRAYSCALE_1BPP: 1,
  737. RGB_24BPP: 2,
  738. RGBA_32BPP: 3
  739. };
  740. exports.ImageKind = ImageKind;
  741. const AnnotationType = {
  742. TEXT: 1,
  743. LINK: 2,
  744. FREETEXT: 3,
  745. LINE: 4,
  746. SQUARE: 5,
  747. CIRCLE: 6,
  748. POLYGON: 7,
  749. POLYLINE: 8,
  750. HIGHLIGHT: 9,
  751. UNDERLINE: 10,
  752. SQUIGGLY: 11,
  753. STRIKEOUT: 12,
  754. STAMP: 13,
  755. CARET: 14,
  756. INK: 15,
  757. POPUP: 16,
  758. FILEATTACHMENT: 17,
  759. SOUND: 18,
  760. MOVIE: 19,
  761. WIDGET: 20,
  762. SCREEN: 21,
  763. PRINTERMARK: 22,
  764. TRAPNET: 23,
  765. WATERMARK: 24,
  766. THREED: 25,
  767. REDACT: 26
  768. };
  769. exports.AnnotationType = AnnotationType;
  770. const AnnotationStateModelType = {
  771. MARKED: "Marked",
  772. REVIEW: "Review"
  773. };
  774. exports.AnnotationStateModelType = AnnotationStateModelType;
  775. const AnnotationMarkedState = {
  776. MARKED: "Marked",
  777. UNMARKED: "Unmarked"
  778. };
  779. exports.AnnotationMarkedState = AnnotationMarkedState;
  780. const AnnotationReviewState = {
  781. ACCEPTED: "Accepted",
  782. REJECTED: "Rejected",
  783. CANCELLED: "Cancelled",
  784. COMPLETED: "Completed",
  785. NONE: "None"
  786. };
  787. exports.AnnotationReviewState = AnnotationReviewState;
  788. const AnnotationReplyType = {
  789. GROUP: "Group",
  790. REPLY: "R"
  791. };
  792. exports.AnnotationReplyType = AnnotationReplyType;
  793. const AnnotationFlag = {
  794. INVISIBLE: 0x01,
  795. HIDDEN: 0x02,
  796. PRINT: 0x04,
  797. NOZOOM: 0x08,
  798. NOROTATE: 0x10,
  799. NOVIEW: 0x20,
  800. READONLY: 0x40,
  801. LOCKED: 0x80,
  802. TOGGLENOVIEW: 0x100,
  803. LOCKEDCONTENTS: 0x200
  804. };
  805. exports.AnnotationFlag = AnnotationFlag;
  806. const AnnotationFieldFlag = {
  807. READONLY: 0x0000001,
  808. REQUIRED: 0x0000002,
  809. NOEXPORT: 0x0000004,
  810. MULTILINE: 0x0001000,
  811. PASSWORD: 0x0002000,
  812. NOTOGGLETOOFF: 0x0004000,
  813. RADIO: 0x0008000,
  814. PUSHBUTTON: 0x0010000,
  815. COMBO: 0x0020000,
  816. EDIT: 0x0040000,
  817. SORT: 0x0080000,
  818. FILESELECT: 0x0100000,
  819. MULTISELECT: 0x0200000,
  820. DONOTSPELLCHECK: 0x0400000,
  821. DONOTSCROLL: 0x0800000,
  822. COMB: 0x1000000,
  823. RICHTEXT: 0x2000000,
  824. RADIOSINUNISON: 0x2000000,
  825. COMMITONSELCHANGE: 0x4000000
  826. };
  827. exports.AnnotationFieldFlag = AnnotationFieldFlag;
  828. const AnnotationBorderStyleType = {
  829. SOLID: 1,
  830. DASHED: 2,
  831. BEVELED: 3,
  832. INSET: 4,
  833. UNDERLINE: 5
  834. };
  835. exports.AnnotationBorderStyleType = AnnotationBorderStyleType;
  836. const AnnotationActionEventType = {
  837. E: "Mouse Enter",
  838. X: "Mouse Exit",
  839. D: "Mouse Down",
  840. U: "Mouse Up",
  841. Fo: "Focus",
  842. Bl: "Blur",
  843. PO: "PageOpen",
  844. PC: "PageClose",
  845. PV: "PageVisible",
  846. PI: "PageInvisible",
  847. K: "Keystroke",
  848. F: "Format",
  849. V: "Validate",
  850. C: "Calculate"
  851. };
  852. exports.AnnotationActionEventType = AnnotationActionEventType;
  853. const DocumentActionEventType = {
  854. WC: "WillClose",
  855. WS: "WillSave",
  856. DS: "DidSave",
  857. WP: "WillPrint",
  858. DP: "DidPrint"
  859. };
  860. exports.DocumentActionEventType = DocumentActionEventType;
  861. const PageActionEventType = {
  862. O: "PageOpen",
  863. C: "PageClose"
  864. };
  865. exports.PageActionEventType = PageActionEventType;
  866. const StreamType = {
  867. UNKNOWN: "UNKNOWN",
  868. FLATE: "FLATE",
  869. LZW: "LZW",
  870. DCT: "DCT",
  871. JPX: "JPX",
  872. JBIG: "JBIG",
  873. A85: "A85",
  874. AHX: "AHX",
  875. CCF: "CCF",
  876. RLX: "RLX"
  877. };
  878. exports.StreamType = StreamType;
  879. const FontType = {
  880. UNKNOWN: "UNKNOWN",
  881. TYPE1: "TYPE1",
  882. TYPE1STANDARD: "TYPE1STANDARD",
  883. TYPE1C: "TYPE1C",
  884. CIDFONTTYPE0: "CIDFONTTYPE0",
  885. CIDFONTTYPE0C: "CIDFONTTYPE0C",
  886. TRUETYPE: "TRUETYPE",
  887. CIDFONTTYPE2: "CIDFONTTYPE2",
  888. TYPE3: "TYPE3",
  889. OPENTYPE: "OPENTYPE",
  890. TYPE0: "TYPE0",
  891. MMTYPE1: "MMTYPE1"
  892. };
  893. exports.FontType = FontType;
  894. const VerbosityLevel = {
  895. ERRORS: 0,
  896. WARNINGS: 1,
  897. INFOS: 5
  898. };
  899. exports.VerbosityLevel = VerbosityLevel;
  900. const CMapCompressionType = {
  901. NONE: 0,
  902. BINARY: 1
  903. };
  904. exports.CMapCompressionType = CMapCompressionType;
  905. const OPS = {
  906. dependency: 1,
  907. setLineWidth: 2,
  908. setLineCap: 3,
  909. setLineJoin: 4,
  910. setMiterLimit: 5,
  911. setDash: 6,
  912. setRenderingIntent: 7,
  913. setFlatness: 8,
  914. setGState: 9,
  915. save: 10,
  916. restore: 11,
  917. transform: 12,
  918. moveTo: 13,
  919. lineTo: 14,
  920. curveTo: 15,
  921. curveTo2: 16,
  922. curveTo3: 17,
  923. closePath: 18,
  924. rectangle: 19,
  925. stroke: 20,
  926. closeStroke: 21,
  927. fill: 22,
  928. eoFill: 23,
  929. fillStroke: 24,
  930. eoFillStroke: 25,
  931. closeFillStroke: 26,
  932. closeEOFillStroke: 27,
  933. endPath: 28,
  934. clip: 29,
  935. eoClip: 30,
  936. beginText: 31,
  937. endText: 32,
  938. setCharSpacing: 33,
  939. setWordSpacing: 34,
  940. setHScale: 35,
  941. setLeading: 36,
  942. setFont: 37,
  943. setTextRenderingMode: 38,
  944. setTextRise: 39,
  945. moveText: 40,
  946. setLeadingMoveText: 41,
  947. setTextMatrix: 42,
  948. nextLine: 43,
  949. showText: 44,
  950. showSpacedText: 45,
  951. nextLineShowText: 46,
  952. nextLineSetSpacingShowText: 47,
  953. setCharWidth: 48,
  954. setCharWidthAndBounds: 49,
  955. setStrokeColorSpace: 50,
  956. setFillColorSpace: 51,
  957. setStrokeColor: 52,
  958. setStrokeColorN: 53,
  959. setFillColor: 54,
  960. setFillColorN: 55,
  961. setStrokeGray: 56,
  962. setFillGray: 57,
  963. setStrokeRGBColor: 58,
  964. setFillRGBColor: 59,
  965. setStrokeCMYKColor: 60,
  966. setFillCMYKColor: 61,
  967. shadingFill: 62,
  968. beginInlineImage: 63,
  969. beginImageData: 64,
  970. endInlineImage: 65,
  971. paintXObject: 66,
  972. markPoint: 67,
  973. markPointProps: 68,
  974. beginMarkedContent: 69,
  975. beginMarkedContentProps: 70,
  976. endMarkedContent: 71,
  977. beginCompat: 72,
  978. endCompat: 73,
  979. paintFormXObjectBegin: 74,
  980. paintFormXObjectEnd: 75,
  981. beginGroup: 76,
  982. endGroup: 77,
  983. beginAnnotation: 80,
  984. endAnnotation: 81,
  985. paintImageMaskXObject: 83,
  986. paintImageMaskXObjectGroup: 84,
  987. paintImageXObject: 85,
  988. paintInlineImageXObject: 86,
  989. paintInlineImageXObjectGroup: 87,
  990. paintImageXObjectRepeat: 88,
  991. paintImageMaskXObjectRepeat: 89,
  992. paintSolidColorImageMask: 90,
  993. constructPath: 91
  994. };
  995. exports.OPS = OPS;
  996. const UNSUPPORTED_FEATURES = {
  997. forms: "forms",
  998. javaScript: "javaScript",
  999. signatures: "signatures",
  1000. smask: "smask",
  1001. shadingPattern: "shadingPattern",
  1002. errorTilingPattern: "errorTilingPattern",
  1003. errorExtGState: "errorExtGState",
  1004. errorXObject: "errorXObject",
  1005. errorFontLoadType3: "errorFontLoadType3",
  1006. errorFontState: "errorFontState",
  1007. errorFontMissing: "errorFontMissing",
  1008. errorFontTranslate: "errorFontTranslate",
  1009. errorColorSpace: "errorColorSpace",
  1010. errorOperatorList: "errorOperatorList",
  1011. errorFontToUnicode: "errorFontToUnicode",
  1012. errorFontLoadNative: "errorFontLoadNative",
  1013. errorFontBuildPath: "errorFontBuildPath",
  1014. errorFontGetPath: "errorFontGetPath",
  1015. errorMarkedContent: "errorMarkedContent",
  1016. errorContentSubStream: "errorContentSubStream"
  1017. };
  1018. exports.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES;
  1019. const PasswordResponses = {
  1020. NEED_PASSWORD: 1,
  1021. INCORRECT_PASSWORD: 2
  1022. };
  1023. exports.PasswordResponses = PasswordResponses;
  1024. let verbosity = VerbosityLevel.WARNINGS;
  1025. function setVerbosityLevel(level) {
  1026. if (Number.isInteger(level)) {
  1027. verbosity = level;
  1028. }
  1029. }
  1030. function getVerbosityLevel() {
  1031. return verbosity;
  1032. }
  1033. function info(msg) {
  1034. if (verbosity >= VerbosityLevel.INFOS) {
  1035. console.log(`Info: ${msg}`);
  1036. }
  1037. }
  1038. function warn(msg) {
  1039. if (verbosity >= VerbosityLevel.WARNINGS) {
  1040. console.log(`Warning: ${msg}`);
  1041. }
  1042. }
  1043. function unreachable(msg) {
  1044. throw new Error(msg);
  1045. }
  1046. function assert(cond, msg) {
  1047. if (!cond) {
  1048. unreachable(msg);
  1049. }
  1050. }
  1051. function _isValidProtocol(url) {
  1052. if (!url) {
  1053. return false;
  1054. }
  1055. switch (url.protocol) {
  1056. case "http:":
  1057. case "https:":
  1058. case "ftp:":
  1059. case "mailto:":
  1060. case "tel:":
  1061. return true;
  1062. default:
  1063. return false;
  1064. }
  1065. }
  1066. function createValidAbsoluteUrl(url) {
  1067. let baseUrl = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  1068. let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  1069. if (!url) {
  1070. return null;
  1071. }
  1072. try {
  1073. if (options && typeof url === "string") {
  1074. if (options.addDefaultProtocol && url.startsWith("www.")) {
  1075. const dots = url.match(/\./g);
  1076. if (dots && dots.length >= 2) {
  1077. url = `http://${url}`;
  1078. }
  1079. }
  1080. if (options.tryConvertEncoding) {
  1081. try {
  1082. url = stringToUTF8String(url);
  1083. } catch (ex) {}
  1084. }
  1085. }
  1086. const absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url);
  1087. if (_isValidProtocol(absoluteUrl)) {
  1088. return absoluteUrl;
  1089. }
  1090. } catch (ex) {}
  1091. return null;
  1092. }
  1093. function shadow(obj, prop, value) {
  1094. let nonSerializable = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  1095. Object.defineProperty(obj, prop, {
  1096. value,
  1097. enumerable: !nonSerializable,
  1098. configurable: true,
  1099. writable: false
  1100. });
  1101. return value;
  1102. }
  1103. const BaseException = function BaseExceptionClosure() {
  1104. function BaseException(message, name) {
  1105. if (this.constructor === BaseException) {
  1106. unreachable("Cannot initialize BaseException.");
  1107. }
  1108. this.message = message;
  1109. this.name = name;
  1110. }
  1111. BaseException.prototype = new Error();
  1112. BaseException.constructor = BaseException;
  1113. return BaseException;
  1114. }();
  1115. exports.BaseException = BaseException;
  1116. class PasswordException extends BaseException {
  1117. constructor(msg, code) {
  1118. super(msg, "PasswordException");
  1119. this.code = code;
  1120. }
  1121. }
  1122. exports.PasswordException = PasswordException;
  1123. class UnknownErrorException extends BaseException {
  1124. constructor(msg, details) {
  1125. super(msg, "UnknownErrorException");
  1126. this.details = details;
  1127. }
  1128. }
  1129. exports.UnknownErrorException = UnknownErrorException;
  1130. class InvalidPDFException extends BaseException {
  1131. constructor(msg) {
  1132. super(msg, "InvalidPDFException");
  1133. }
  1134. }
  1135. exports.InvalidPDFException = InvalidPDFException;
  1136. class MissingPDFException extends BaseException {
  1137. constructor(msg) {
  1138. super(msg, "MissingPDFException");
  1139. }
  1140. }
  1141. exports.MissingPDFException = MissingPDFException;
  1142. class UnexpectedResponseException extends BaseException {
  1143. constructor(msg, status) {
  1144. super(msg, "UnexpectedResponseException");
  1145. this.status = status;
  1146. }
  1147. }
  1148. exports.UnexpectedResponseException = UnexpectedResponseException;
  1149. class FormatError extends BaseException {
  1150. constructor(msg) {
  1151. super(msg, "FormatError");
  1152. }
  1153. }
  1154. exports.FormatError = FormatError;
  1155. class AbortException extends BaseException {
  1156. constructor(msg) {
  1157. super(msg, "AbortException");
  1158. }
  1159. }
  1160. exports.AbortException = AbortException;
  1161. function bytesToString(bytes) {
  1162. if (typeof bytes !== "object" || bytes === null || bytes.length === undefined) {
  1163. unreachable("Invalid argument for bytesToString");
  1164. }
  1165. const length = bytes.length;
  1166. const MAX_ARGUMENT_COUNT = 8192;
  1167. if (length < MAX_ARGUMENT_COUNT) {
  1168. return String.fromCharCode.apply(null, bytes);
  1169. }
  1170. const strBuf = [];
  1171. for (let i = 0; i < length; i += MAX_ARGUMENT_COUNT) {
  1172. const chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length);
  1173. const chunk = bytes.subarray(i, chunkEnd);
  1174. strBuf.push(String.fromCharCode.apply(null, chunk));
  1175. }
  1176. return strBuf.join("");
  1177. }
  1178. function stringToBytes(str) {
  1179. if (typeof str !== "string") {
  1180. unreachable("Invalid argument for stringToBytes");
  1181. }
  1182. const length = str.length;
  1183. const bytes = new Uint8Array(length);
  1184. for (let i = 0; i < length; ++i) {
  1185. bytes[i] = str.charCodeAt(i) & 0xff;
  1186. }
  1187. return bytes;
  1188. }
  1189. function arrayByteLength(arr) {
  1190. if (arr.length !== undefined) {
  1191. return arr.length;
  1192. }
  1193. if (arr.byteLength !== undefined) {
  1194. return arr.byteLength;
  1195. }
  1196. unreachable("Invalid argument for arrayByteLength");
  1197. }
  1198. function arraysToBytes(arr) {
  1199. const length = arr.length;
  1200. if (length === 1 && arr[0] instanceof Uint8Array) {
  1201. return arr[0];
  1202. }
  1203. let resultLength = 0;
  1204. for (let i = 0; i < length; i++) {
  1205. resultLength += arrayByteLength(arr[i]);
  1206. }
  1207. let pos = 0;
  1208. const data = new Uint8Array(resultLength);
  1209. for (let i = 0; i < length; i++) {
  1210. let item = arr[i];
  1211. if (!(item instanceof Uint8Array)) {
  1212. if (typeof item === "string") {
  1213. item = stringToBytes(item);
  1214. } else {
  1215. item = new Uint8Array(item);
  1216. }
  1217. }
  1218. const itemLength = item.byteLength;
  1219. data.set(item, pos);
  1220. pos += itemLength;
  1221. }
  1222. return data;
  1223. }
  1224. function string32(value) {
  1225. return String.fromCharCode(value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
  1226. }
  1227. function objectSize(obj) {
  1228. return Object.keys(obj).length;
  1229. }
  1230. function objectFromMap(map) {
  1231. const obj = Object.create(null);
  1232. for (const [key, value] of map) {
  1233. obj[key] = value;
  1234. }
  1235. return obj;
  1236. }
  1237. function isLittleEndian() {
  1238. const buffer8 = new Uint8Array(4);
  1239. buffer8[0] = 1;
  1240. const view32 = new Uint32Array(buffer8.buffer, 0, 1);
  1241. return view32[0] === 1;
  1242. }
  1243. function isEvalSupported() {
  1244. try {
  1245. new Function("");
  1246. return true;
  1247. } catch (e) {
  1248. return false;
  1249. }
  1250. }
  1251. class FeatureTest {
  1252. static get isLittleEndian() {
  1253. return shadow(this, "isLittleEndian", isLittleEndian());
  1254. }
  1255. static get isEvalSupported() {
  1256. return shadow(this, "isEvalSupported", isEvalSupported());
  1257. }
  1258. static get isOffscreenCanvasSupported() {
  1259. return shadow(this, "isOffscreenCanvasSupported", typeof OffscreenCanvas !== "undefined");
  1260. }
  1261. }
  1262. exports.FeatureTest = FeatureTest;
  1263. const hexNumbers = [...Array(256).keys()].map(n => n.toString(16).padStart(2, "0"));
  1264. class Util {
  1265. static makeHexColor(r, g, b) {
  1266. return `#${hexNumbers[r]}${hexNumbers[g]}${hexNumbers[b]}`;
  1267. }
  1268. static scaleMinMax(transform, minMax) {
  1269. let temp;
  1270. if (transform[0]) {
  1271. if (transform[0] < 0) {
  1272. temp = minMax[0];
  1273. minMax[0] = minMax[1];
  1274. minMax[1] = temp;
  1275. }
  1276. minMax[0] *= transform[0];
  1277. minMax[1] *= transform[0];
  1278. if (transform[3] < 0) {
  1279. temp = minMax[2];
  1280. minMax[2] = minMax[3];
  1281. minMax[3] = temp;
  1282. }
  1283. minMax[2] *= transform[3];
  1284. minMax[3] *= transform[3];
  1285. } else {
  1286. temp = minMax[0];
  1287. minMax[0] = minMax[2];
  1288. minMax[2] = temp;
  1289. temp = minMax[1];
  1290. minMax[1] = minMax[3];
  1291. minMax[3] = temp;
  1292. if (transform[1] < 0) {
  1293. temp = minMax[2];
  1294. minMax[2] = minMax[3];
  1295. minMax[3] = temp;
  1296. }
  1297. minMax[2] *= transform[1];
  1298. minMax[3] *= transform[1];
  1299. if (transform[2] < 0) {
  1300. temp = minMax[0];
  1301. minMax[0] = minMax[1];
  1302. minMax[1] = temp;
  1303. }
  1304. minMax[0] *= transform[2];
  1305. minMax[1] *= transform[2];
  1306. }
  1307. minMax[0] += transform[4];
  1308. minMax[1] += transform[4];
  1309. minMax[2] += transform[5];
  1310. minMax[3] += transform[5];
  1311. }
  1312. static transform(m1, m2) {
  1313. 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]];
  1314. }
  1315. static applyTransform(p, m) {
  1316. const xt = p[0] * m[0] + p[1] * m[2] + m[4];
  1317. const yt = p[0] * m[1] + p[1] * m[3] + m[5];
  1318. return [xt, yt];
  1319. }
  1320. static applyInverseTransform(p, m) {
  1321. const d = m[0] * m[3] - m[1] * m[2];
  1322. const xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d;
  1323. const yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d;
  1324. return [xt, yt];
  1325. }
  1326. static getAxialAlignedBoundingBox(r, m) {
  1327. const p1 = Util.applyTransform(r, m);
  1328. const p2 = Util.applyTransform(r.slice(2, 4), m);
  1329. const p3 = Util.applyTransform([r[0], r[3]], m);
  1330. const p4 = Util.applyTransform([r[2], r[1]], m);
  1331. 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])];
  1332. }
  1333. static inverseTransform(m) {
  1334. const d = m[0] * m[3] - m[1] * m[2];
  1335. 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];
  1336. }
  1337. static singularValueDecompose2dScale(m) {
  1338. const transpose = [m[0], m[2], m[1], m[3]];
  1339. const a = m[0] * transpose[0] + m[1] * transpose[2];
  1340. const b = m[0] * transpose[1] + m[1] * transpose[3];
  1341. const c = m[2] * transpose[0] + m[3] * transpose[2];
  1342. const d = m[2] * transpose[1] + m[3] * transpose[3];
  1343. const first = (a + d) / 2;
  1344. const second = Math.sqrt((a + d) ** 2 - 4 * (a * d - c * b)) / 2;
  1345. const sx = first + second || 1;
  1346. const sy = first - second || 1;
  1347. return [Math.sqrt(sx), Math.sqrt(sy)];
  1348. }
  1349. static normalizeRect(rect) {
  1350. const r = rect.slice(0);
  1351. if (rect[0] > rect[2]) {
  1352. r[0] = rect[2];
  1353. r[2] = rect[0];
  1354. }
  1355. if (rect[1] > rect[3]) {
  1356. r[1] = rect[3];
  1357. r[3] = rect[1];
  1358. }
  1359. return r;
  1360. }
  1361. static intersect(rect1, rect2) {
  1362. const xLow = Math.max(Math.min(rect1[0], rect1[2]), Math.min(rect2[0], rect2[2]));
  1363. const xHigh = Math.min(Math.max(rect1[0], rect1[2]), Math.max(rect2[0], rect2[2]));
  1364. if (xLow > xHigh) {
  1365. return null;
  1366. }
  1367. const yLow = Math.max(Math.min(rect1[1], rect1[3]), Math.min(rect2[1], rect2[3]));
  1368. const yHigh = Math.min(Math.max(rect1[1], rect1[3]), Math.max(rect2[1], rect2[3]));
  1369. if (yLow > yHigh) {
  1370. return null;
  1371. }
  1372. return [xLow, yLow, xHigh, yHigh];
  1373. }
  1374. static bezierBoundingBox(x0, y0, x1, y1, x2, y2, x3, y3) {
  1375. const tvalues = [],
  1376. bounds = [[], []];
  1377. let a, b, c, t, t1, t2, b2ac, sqrtb2ac;
  1378. for (let i = 0; i < 2; ++i) {
  1379. if (i === 0) {
  1380. b = 6 * x0 - 12 * x1 + 6 * x2;
  1381. a = -3 * x0 + 9 * x1 - 9 * x2 + 3 * x3;
  1382. c = 3 * x1 - 3 * x0;
  1383. } else {
  1384. b = 6 * y0 - 12 * y1 + 6 * y2;
  1385. a = -3 * y0 + 9 * y1 - 9 * y2 + 3 * y3;
  1386. c = 3 * y1 - 3 * y0;
  1387. }
  1388. if (Math.abs(a) < 1e-12) {
  1389. if (Math.abs(b) < 1e-12) {
  1390. continue;
  1391. }
  1392. t = -c / b;
  1393. if (0 < t && t < 1) {
  1394. tvalues.push(t);
  1395. }
  1396. continue;
  1397. }
  1398. b2ac = b * b - 4 * c * a;
  1399. sqrtb2ac = Math.sqrt(b2ac);
  1400. if (b2ac < 0) {
  1401. continue;
  1402. }
  1403. t1 = (-b + sqrtb2ac) / (2 * a);
  1404. if (0 < t1 && t1 < 1) {
  1405. tvalues.push(t1);
  1406. }
  1407. t2 = (-b - sqrtb2ac) / (2 * a);
  1408. if (0 < t2 && t2 < 1) {
  1409. tvalues.push(t2);
  1410. }
  1411. }
  1412. let j = tvalues.length,
  1413. mt;
  1414. const jlen = j;
  1415. while (j--) {
  1416. t = tvalues[j];
  1417. mt = 1 - t;
  1418. bounds[0][j] = mt * mt * mt * x0 + 3 * mt * mt * t * x1 + 3 * mt * t * t * x2 + t * t * t * x3;
  1419. bounds[1][j] = mt * mt * mt * y0 + 3 * mt * mt * t * y1 + 3 * mt * t * t * y2 + t * t * t * y3;
  1420. }
  1421. bounds[0][jlen] = x0;
  1422. bounds[1][jlen] = y0;
  1423. bounds[0][jlen + 1] = x3;
  1424. bounds[1][jlen + 1] = y3;
  1425. bounds[0].length = bounds[1].length = jlen + 2;
  1426. return [Math.min(...bounds[0]), Math.min(...bounds[1]), Math.max(...bounds[0]), Math.max(...bounds[1])];
  1427. }
  1428. }
  1429. exports.Util = Util;
  1430. 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];
  1431. function stringToPDFString(str) {
  1432. if (str[0] >= "\xEF") {
  1433. let encoding;
  1434. if (str[0] === "\xFE" && str[1] === "\xFF") {
  1435. encoding = "utf-16be";
  1436. } else if (str[0] === "\xFF" && str[1] === "\xFE") {
  1437. encoding = "utf-16le";
  1438. } else if (str[0] === "\xEF" && str[1] === "\xBB" && str[2] === "\xBF") {
  1439. encoding = "utf-8";
  1440. }
  1441. if (encoding) {
  1442. try {
  1443. const decoder = new TextDecoder(encoding, {
  1444. fatal: true
  1445. });
  1446. const buffer = stringToBytes(str);
  1447. return decoder.decode(buffer);
  1448. } catch (ex) {
  1449. warn(`stringToPDFString: "${ex}".`);
  1450. }
  1451. }
  1452. }
  1453. const strBuf = [];
  1454. for (let i = 0, ii = str.length; i < ii; i++) {
  1455. const code = PDFStringTranslateTable[str.charCodeAt(i)];
  1456. strBuf.push(code ? String.fromCharCode(code) : str.charAt(i));
  1457. }
  1458. return strBuf.join("");
  1459. }
  1460. function stringToUTF8String(str) {
  1461. return decodeURIComponent(escape(str));
  1462. }
  1463. function utf8StringToString(str) {
  1464. return unescape(encodeURIComponent(str));
  1465. }
  1466. function isArrayBuffer(v) {
  1467. return typeof v === "object" && v !== null && v.byteLength !== undefined;
  1468. }
  1469. function isArrayEqual(arr1, arr2) {
  1470. if (arr1.length !== arr2.length) {
  1471. return false;
  1472. }
  1473. for (let i = 0, ii = arr1.length; i < ii; i++) {
  1474. if (arr1[i] !== arr2[i]) {
  1475. return false;
  1476. }
  1477. }
  1478. return true;
  1479. }
  1480. function getModificationDate() {
  1481. let date = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new Date();
  1482. 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")];
  1483. return buffer.join("");
  1484. }
  1485. function createPromiseCapability() {
  1486. const capability = Object.create(null);
  1487. let isSettled = false;
  1488. Object.defineProperty(capability, "settled", {
  1489. get() {
  1490. return isSettled;
  1491. }
  1492. });
  1493. capability.promise = new Promise(function (resolve, reject) {
  1494. capability.resolve = function (data) {
  1495. isSettled = true;
  1496. resolve(data);
  1497. };
  1498. capability.reject = function (reason) {
  1499. isSettled = true;
  1500. reject(reason);
  1501. };
  1502. });
  1503. return capability;
  1504. }
  1505. /***/ }),
  1506. /* 3 */
  1507. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1508. "use strict";
  1509. var _is_node = __w_pdfjs_require__(4);
  1510. (function checkNodeBtoa() {
  1511. if (globalThis.btoa || !_is_node.isNodeJS) {
  1512. return;
  1513. }
  1514. globalThis.btoa = function (chars) {
  1515. return Buffer.from(chars, "binary").toString("base64");
  1516. };
  1517. })();
  1518. (function checkNodeAtob() {
  1519. if (globalThis.atob || !_is_node.isNodeJS) {
  1520. return;
  1521. }
  1522. globalThis.atob = function (input) {
  1523. return Buffer.from(input, "base64").toString("binary");
  1524. };
  1525. })();
  1526. (function checkDOMMatrix() {
  1527. if (globalThis.DOMMatrix || !_is_node.isNodeJS) {
  1528. return;
  1529. }
  1530. globalThis.DOMMatrix = require("canvas").DOMMatrix;
  1531. })();
  1532. (function checkReadableStream() {
  1533. if (globalThis.ReadableStream || !_is_node.isNodeJS) {
  1534. return;
  1535. }
  1536. globalThis.ReadableStream = require("web-streams-polyfill/dist/ponyfill.js").ReadableStream;
  1537. })();
  1538. (function checkArrayAt() {
  1539. if (Array.prototype.at) {
  1540. return;
  1541. }
  1542. __w_pdfjs_require__(5);
  1543. })();
  1544. (function checkTypedArrayAt() {
  1545. if (Uint8Array.prototype.at) {
  1546. return;
  1547. }
  1548. __w_pdfjs_require__(79);
  1549. })();
  1550. (function checkStructuredClone() {
  1551. if (globalThis.structuredClone) {
  1552. return;
  1553. }
  1554. __w_pdfjs_require__(89);
  1555. })();
  1556. /***/ }),
  1557. /* 4 */
  1558. /***/ ((__unused_webpack_module, exports) => {
  1559. "use strict";
  1560. Object.defineProperty(exports, "__esModule", ({
  1561. value: true
  1562. }));
  1563. exports.isNodeJS = void 0;
  1564. const isNodeJS = typeof process === "object" && process + "" === "[object process]" && !process.versions.nw && !(process.versions.electron && process.type && process.type !== "browser");
  1565. exports.isNodeJS = isNodeJS;
  1566. /***/ }),
  1567. /* 5 */
  1568. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1569. __w_pdfjs_require__(6);
  1570. var entryUnbind = __w_pdfjs_require__(78);
  1571. module.exports = entryUnbind('Array', 'at');
  1572. /***/ }),
  1573. /* 6 */
  1574. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1575. "use strict";
  1576. var $ = __w_pdfjs_require__(7);
  1577. var toObject = __w_pdfjs_require__(44);
  1578. var lengthOfArrayLike = __w_pdfjs_require__(68);
  1579. var toIntegerOrInfinity = __w_pdfjs_require__(66);
  1580. var addToUnscopables = __w_pdfjs_require__(73);
  1581. $({
  1582. target: 'Array',
  1583. proto: true
  1584. }, {
  1585. at: function at(index) {
  1586. var O = toObject(this);
  1587. var len = lengthOfArrayLike(O);
  1588. var relativeIndex = toIntegerOrInfinity(index);
  1589. var k = relativeIndex >= 0 ? relativeIndex : len + relativeIndex;
  1590. return k < 0 || k >= len ? undefined : O[k];
  1591. }
  1592. });
  1593. addToUnscopables('at');
  1594. /***/ }),
  1595. /* 7 */
  1596. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1597. var global = __w_pdfjs_require__(8);
  1598. var getOwnPropertyDescriptor = (__w_pdfjs_require__(9).f);
  1599. var createNonEnumerableProperty = __w_pdfjs_require__(48);
  1600. var defineBuiltIn = __w_pdfjs_require__(52);
  1601. var defineGlobalProperty = __w_pdfjs_require__(42);
  1602. var copyConstructorProperties = __w_pdfjs_require__(60);
  1603. var isForced = __w_pdfjs_require__(72);
  1604. module.exports = function (options, source) {
  1605. var TARGET = options.target;
  1606. var GLOBAL = options.global;
  1607. var STATIC = options.stat;
  1608. var FORCED, target, key, targetProperty, sourceProperty, descriptor;
  1609. if (GLOBAL) {
  1610. target = global;
  1611. } else if (STATIC) {
  1612. target = global[TARGET] || defineGlobalProperty(TARGET, {});
  1613. } else {
  1614. target = (global[TARGET] || {}).prototype;
  1615. }
  1616. if (target)
  1617. for (key in source) {
  1618. sourceProperty = source[key];
  1619. if (options.dontCallGetSet) {
  1620. descriptor = getOwnPropertyDescriptor(target, key);
  1621. targetProperty = descriptor && descriptor.value;
  1622. } else
  1623. targetProperty = target[key];
  1624. FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
  1625. if (!FORCED && targetProperty !== undefined) {
  1626. if (typeof sourceProperty == typeof targetProperty)
  1627. continue;
  1628. copyConstructorProperties(sourceProperty, targetProperty);
  1629. }
  1630. if (options.sham || targetProperty && targetProperty.sham) {
  1631. createNonEnumerableProperty(sourceProperty, 'sham', true);
  1632. }
  1633. defineBuiltIn(target, key, sourceProperty, options);
  1634. }
  1635. };
  1636. /***/ }),
  1637. /* 8 */
  1638. /***/ ((module) => {
  1639. var check = function (it) {
  1640. return it && it.Math == Math && it;
  1641. };
  1642. module.exports = check(typeof globalThis == 'object' && globalThis) || check(typeof window == 'object' && window) || check(typeof self == 'object' && self) || check(typeof global == 'object' && global) || (function () {
  1643. return this;
  1644. }()) || Function('return this')();
  1645. /***/ }),
  1646. /* 9 */
  1647. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  1648. var DESCRIPTORS = __w_pdfjs_require__(10);
  1649. var call = __w_pdfjs_require__(12);
  1650. var propertyIsEnumerableModule = __w_pdfjs_require__(14);
  1651. var createPropertyDescriptor = __w_pdfjs_require__(15);
  1652. var toIndexedObject = __w_pdfjs_require__(16);
  1653. var toPropertyKey = __w_pdfjs_require__(22);
  1654. var hasOwn = __w_pdfjs_require__(43);
  1655. var IE8_DOM_DEFINE = __w_pdfjs_require__(46);
  1656. var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  1657. exports.f = DESCRIPTORS ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
  1658. O = toIndexedObject(O);
  1659. P = toPropertyKey(P);
  1660. if (IE8_DOM_DEFINE)
  1661. try {
  1662. return $getOwnPropertyDescriptor(O, P);
  1663. } catch (error) {
  1664. }
  1665. if (hasOwn(O, P))
  1666. return createPropertyDescriptor(!call(propertyIsEnumerableModule.f, O, P), O[P]);
  1667. };
  1668. /***/ }),
  1669. /* 10 */
  1670. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1671. var fails = __w_pdfjs_require__(11);
  1672. module.exports = !fails(function () {
  1673. return Object.defineProperty({}, 1, {
  1674. get: function () {
  1675. return 7;
  1676. }
  1677. })[1] != 7;
  1678. });
  1679. /***/ }),
  1680. /* 11 */
  1681. /***/ ((module) => {
  1682. module.exports = function (exec) {
  1683. try {
  1684. return !!exec();
  1685. } catch (error) {
  1686. return true;
  1687. }
  1688. };
  1689. /***/ }),
  1690. /* 12 */
  1691. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1692. var NATIVE_BIND = __w_pdfjs_require__(13);
  1693. var call = Function.prototype.call;
  1694. module.exports = NATIVE_BIND ? call.bind(call) : function () {
  1695. return call.apply(call, arguments);
  1696. };
  1697. /***/ }),
  1698. /* 13 */
  1699. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1700. var fails = __w_pdfjs_require__(11);
  1701. module.exports = !fails(function () {
  1702. var test = function () {
  1703. }.bind();
  1704. return typeof test != 'function' || test.hasOwnProperty('prototype');
  1705. });
  1706. /***/ }),
  1707. /* 14 */
  1708. /***/ ((__unused_webpack_module, exports) => {
  1709. "use strict";
  1710. var $propertyIsEnumerable = {}.propertyIsEnumerable;
  1711. var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  1712. var NASHORN_BUG = getOwnPropertyDescriptor && !$propertyIsEnumerable.call({ 1: 2 }, 1);
  1713. exports.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
  1714. var descriptor = getOwnPropertyDescriptor(this, V);
  1715. return !!descriptor && descriptor.enumerable;
  1716. } : $propertyIsEnumerable;
  1717. /***/ }),
  1718. /* 15 */
  1719. /***/ ((module) => {
  1720. module.exports = function (bitmap, value) {
  1721. return {
  1722. enumerable: !(bitmap & 1),
  1723. configurable: !(bitmap & 2),
  1724. writable: !(bitmap & 4),
  1725. value: value
  1726. };
  1727. };
  1728. /***/ }),
  1729. /* 16 */
  1730. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1731. var IndexedObject = __w_pdfjs_require__(17);
  1732. var requireObjectCoercible = __w_pdfjs_require__(20);
  1733. module.exports = function (it) {
  1734. return IndexedObject(requireObjectCoercible(it));
  1735. };
  1736. /***/ }),
  1737. /* 17 */
  1738. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1739. var uncurryThis = __w_pdfjs_require__(18);
  1740. var fails = __w_pdfjs_require__(11);
  1741. var classof = __w_pdfjs_require__(19);
  1742. var $Object = Object;
  1743. var split = uncurryThis(''.split);
  1744. module.exports = fails(function () {
  1745. return !$Object('z').propertyIsEnumerable(0);
  1746. }) ? function (it) {
  1747. return classof(it) == 'String' ? split(it, '') : $Object(it);
  1748. } : $Object;
  1749. /***/ }),
  1750. /* 18 */
  1751. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1752. var NATIVE_BIND = __w_pdfjs_require__(13);
  1753. var FunctionPrototype = Function.prototype;
  1754. var call = FunctionPrototype.call;
  1755. var uncurryThisWithBind = NATIVE_BIND && FunctionPrototype.bind.bind(call, call);
  1756. module.exports = NATIVE_BIND ? uncurryThisWithBind : function (fn) {
  1757. return function () {
  1758. return call.apply(fn, arguments);
  1759. };
  1760. };
  1761. /***/ }),
  1762. /* 19 */
  1763. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1764. var uncurryThis = __w_pdfjs_require__(18);
  1765. var toString = uncurryThis({}.toString);
  1766. var stringSlice = uncurryThis(''.slice);
  1767. module.exports = function (it) {
  1768. return stringSlice(toString(it), 8, -1);
  1769. };
  1770. /***/ }),
  1771. /* 20 */
  1772. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1773. var isNullOrUndefined = __w_pdfjs_require__(21);
  1774. var $TypeError = TypeError;
  1775. module.exports = function (it) {
  1776. if (isNullOrUndefined(it))
  1777. throw $TypeError("Can't call method on " + it);
  1778. return it;
  1779. };
  1780. /***/ }),
  1781. /* 21 */
  1782. /***/ ((module) => {
  1783. module.exports = function (it) {
  1784. return it === null || it === undefined;
  1785. };
  1786. /***/ }),
  1787. /* 22 */
  1788. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1789. var toPrimitive = __w_pdfjs_require__(23);
  1790. var isSymbol = __w_pdfjs_require__(27);
  1791. module.exports = function (argument) {
  1792. var key = toPrimitive(argument, 'string');
  1793. return isSymbol(key) ? key : key + '';
  1794. };
  1795. /***/ }),
  1796. /* 23 */
  1797. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1798. var call = __w_pdfjs_require__(12);
  1799. var isObject = __w_pdfjs_require__(24);
  1800. var isSymbol = __w_pdfjs_require__(27);
  1801. var getMethod = __w_pdfjs_require__(34);
  1802. var ordinaryToPrimitive = __w_pdfjs_require__(37);
  1803. var wellKnownSymbol = __w_pdfjs_require__(38);
  1804. var $TypeError = TypeError;
  1805. var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
  1806. module.exports = function (input, pref) {
  1807. if (!isObject(input) || isSymbol(input))
  1808. return input;
  1809. var exoticToPrim = getMethod(input, TO_PRIMITIVE);
  1810. var result;
  1811. if (exoticToPrim) {
  1812. if (pref === undefined)
  1813. pref = 'default';
  1814. result = call(exoticToPrim, input, pref);
  1815. if (!isObject(result) || isSymbol(result))
  1816. return result;
  1817. throw $TypeError("Can't convert object to primitive value");
  1818. }
  1819. if (pref === undefined)
  1820. pref = 'number';
  1821. return ordinaryToPrimitive(input, pref);
  1822. };
  1823. /***/ }),
  1824. /* 24 */
  1825. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1826. var isCallable = __w_pdfjs_require__(25);
  1827. var $documentAll = __w_pdfjs_require__(26);
  1828. var documentAll = $documentAll.all;
  1829. module.exports = $documentAll.IS_HTMLDDA ? function (it) {
  1830. return typeof it == 'object' ? it !== null : isCallable(it) || it === documentAll;
  1831. } : function (it) {
  1832. return typeof it == 'object' ? it !== null : isCallable(it);
  1833. };
  1834. /***/ }),
  1835. /* 25 */
  1836. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1837. var $documentAll = __w_pdfjs_require__(26);
  1838. var documentAll = $documentAll.all;
  1839. module.exports = $documentAll.IS_HTMLDDA ? function (argument) {
  1840. return typeof argument == 'function' || argument === documentAll;
  1841. } : function (argument) {
  1842. return typeof argument == 'function';
  1843. };
  1844. /***/ }),
  1845. /* 26 */
  1846. /***/ ((module) => {
  1847. var documentAll = typeof document == 'object' && document.all;
  1848. var IS_HTMLDDA = typeof documentAll == 'undefined' && documentAll !== undefined;
  1849. module.exports = {
  1850. all: documentAll,
  1851. IS_HTMLDDA: IS_HTMLDDA
  1852. };
  1853. /***/ }),
  1854. /* 27 */
  1855. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1856. var getBuiltIn = __w_pdfjs_require__(28);
  1857. var isCallable = __w_pdfjs_require__(25);
  1858. var isPrototypeOf = __w_pdfjs_require__(29);
  1859. var USE_SYMBOL_AS_UID = __w_pdfjs_require__(30);
  1860. var $Object = Object;
  1861. module.exports = USE_SYMBOL_AS_UID ? function (it) {
  1862. return typeof it == 'symbol';
  1863. } : function (it) {
  1864. var $Symbol = getBuiltIn('Symbol');
  1865. return isCallable($Symbol) && isPrototypeOf($Symbol.prototype, $Object(it));
  1866. };
  1867. /***/ }),
  1868. /* 28 */
  1869. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1870. var global = __w_pdfjs_require__(8);
  1871. var isCallable = __w_pdfjs_require__(25);
  1872. var aFunction = function (argument) {
  1873. return isCallable(argument) ? argument : undefined;
  1874. };
  1875. module.exports = function (namespace, method) {
  1876. return arguments.length < 2 ? aFunction(global[namespace]) : global[namespace] && global[namespace][method];
  1877. };
  1878. /***/ }),
  1879. /* 29 */
  1880. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1881. var uncurryThis = __w_pdfjs_require__(18);
  1882. module.exports = uncurryThis({}.isPrototypeOf);
  1883. /***/ }),
  1884. /* 30 */
  1885. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1886. var NATIVE_SYMBOL = __w_pdfjs_require__(31);
  1887. module.exports = NATIVE_SYMBOL && !Symbol.sham && typeof Symbol.iterator == 'symbol';
  1888. /***/ }),
  1889. /* 31 */
  1890. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1891. var V8_VERSION = __w_pdfjs_require__(32);
  1892. var fails = __w_pdfjs_require__(11);
  1893. module.exports = !!Object.getOwnPropertySymbols && !fails(function () {
  1894. var symbol = Symbol();
  1895. return !String(symbol) || !(Object(symbol) instanceof Symbol) || !Symbol.sham && V8_VERSION && V8_VERSION < 41;
  1896. });
  1897. /***/ }),
  1898. /* 32 */
  1899. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1900. var global = __w_pdfjs_require__(8);
  1901. var userAgent = __w_pdfjs_require__(33);
  1902. var process = global.process;
  1903. var Deno = global.Deno;
  1904. var versions = process && process.versions || Deno && Deno.version;
  1905. var v8 = versions && versions.v8;
  1906. var match, version;
  1907. if (v8) {
  1908. match = v8.split('.');
  1909. version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
  1910. }
  1911. if (!version && userAgent) {
  1912. match = userAgent.match(/Edge\/(\d+)/);
  1913. if (!match || match[1] >= 74) {
  1914. match = userAgent.match(/Chrome\/(\d+)/);
  1915. if (match)
  1916. version = +match[1];
  1917. }
  1918. }
  1919. module.exports = version;
  1920. /***/ }),
  1921. /* 33 */
  1922. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1923. var getBuiltIn = __w_pdfjs_require__(28);
  1924. module.exports = getBuiltIn('navigator', 'userAgent') || '';
  1925. /***/ }),
  1926. /* 34 */
  1927. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1928. var aCallable = __w_pdfjs_require__(35);
  1929. var isNullOrUndefined = __w_pdfjs_require__(21);
  1930. module.exports = function (V, P) {
  1931. var func = V[P];
  1932. return isNullOrUndefined(func) ? undefined : aCallable(func);
  1933. };
  1934. /***/ }),
  1935. /* 35 */
  1936. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1937. var isCallable = __w_pdfjs_require__(25);
  1938. var tryToString = __w_pdfjs_require__(36);
  1939. var $TypeError = TypeError;
  1940. module.exports = function (argument) {
  1941. if (isCallable(argument))
  1942. return argument;
  1943. throw $TypeError(tryToString(argument) + ' is not a function');
  1944. };
  1945. /***/ }),
  1946. /* 36 */
  1947. /***/ ((module) => {
  1948. var $String = String;
  1949. module.exports = function (argument) {
  1950. try {
  1951. return $String(argument);
  1952. } catch (error) {
  1953. return 'Object';
  1954. }
  1955. };
  1956. /***/ }),
  1957. /* 37 */
  1958. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1959. var call = __w_pdfjs_require__(12);
  1960. var isCallable = __w_pdfjs_require__(25);
  1961. var isObject = __w_pdfjs_require__(24);
  1962. var $TypeError = TypeError;
  1963. module.exports = function (input, pref) {
  1964. var fn, val;
  1965. if (pref === 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input)))
  1966. return val;
  1967. if (isCallable(fn = input.valueOf) && !isObject(val = call(fn, input)))
  1968. return val;
  1969. if (pref !== 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input)))
  1970. return val;
  1971. throw $TypeError("Can't convert object to primitive value");
  1972. };
  1973. /***/ }),
  1974. /* 38 */
  1975. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1976. var global = __w_pdfjs_require__(8);
  1977. var shared = __w_pdfjs_require__(39);
  1978. var hasOwn = __w_pdfjs_require__(43);
  1979. var uid = __w_pdfjs_require__(45);
  1980. var NATIVE_SYMBOL = __w_pdfjs_require__(31);
  1981. var USE_SYMBOL_AS_UID = __w_pdfjs_require__(30);
  1982. var WellKnownSymbolsStore = shared('wks');
  1983. var Symbol = global.Symbol;
  1984. var symbolFor = Symbol && Symbol['for'];
  1985. var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol : Symbol && Symbol.withoutSetter || uid;
  1986. module.exports = function (name) {
  1987. if (!hasOwn(WellKnownSymbolsStore, name) || !(NATIVE_SYMBOL || typeof WellKnownSymbolsStore[name] == 'string')) {
  1988. var description = 'Symbol.' + name;
  1989. if (NATIVE_SYMBOL && hasOwn(Symbol, name)) {
  1990. WellKnownSymbolsStore[name] = Symbol[name];
  1991. } else if (USE_SYMBOL_AS_UID && symbolFor) {
  1992. WellKnownSymbolsStore[name] = symbolFor(description);
  1993. } else {
  1994. WellKnownSymbolsStore[name] = createWellKnownSymbol(description);
  1995. }
  1996. }
  1997. return WellKnownSymbolsStore[name];
  1998. };
  1999. /***/ }),
  2000. /* 39 */
  2001. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2002. var IS_PURE = __w_pdfjs_require__(40);
  2003. var store = __w_pdfjs_require__(41);
  2004. (module.exports = function (key, value) {
  2005. return store[key] || (store[key] = value !== undefined ? value : {});
  2006. })('versions', []).push({
  2007. version: '3.26.1',
  2008. mode: IS_PURE ? 'pure' : 'global',
  2009. copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
  2010. license: 'https://github.com/zloirock/core-js/blob/v3.26.1/LICENSE',
  2011. source: 'https://github.com/zloirock/core-js'
  2012. });
  2013. /***/ }),
  2014. /* 40 */
  2015. /***/ ((module) => {
  2016. module.exports = false;
  2017. /***/ }),
  2018. /* 41 */
  2019. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2020. var global = __w_pdfjs_require__(8);
  2021. var defineGlobalProperty = __w_pdfjs_require__(42);
  2022. var SHARED = '__core-js_shared__';
  2023. var store = global[SHARED] || defineGlobalProperty(SHARED, {});
  2024. module.exports = store;
  2025. /***/ }),
  2026. /* 42 */
  2027. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2028. var global = __w_pdfjs_require__(8);
  2029. var defineProperty = Object.defineProperty;
  2030. module.exports = function (key, value) {
  2031. try {
  2032. defineProperty(global, key, {
  2033. value: value,
  2034. configurable: true,
  2035. writable: true
  2036. });
  2037. } catch (error) {
  2038. global[key] = value;
  2039. }
  2040. return value;
  2041. };
  2042. /***/ }),
  2043. /* 43 */
  2044. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2045. var uncurryThis = __w_pdfjs_require__(18);
  2046. var toObject = __w_pdfjs_require__(44);
  2047. var hasOwnProperty = uncurryThis({}.hasOwnProperty);
  2048. module.exports = Object.hasOwn || function hasOwn(it, key) {
  2049. return hasOwnProperty(toObject(it), key);
  2050. };
  2051. /***/ }),
  2052. /* 44 */
  2053. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2054. var requireObjectCoercible = __w_pdfjs_require__(20);
  2055. var $Object = Object;
  2056. module.exports = function (argument) {
  2057. return $Object(requireObjectCoercible(argument));
  2058. };
  2059. /***/ }),
  2060. /* 45 */
  2061. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2062. var uncurryThis = __w_pdfjs_require__(18);
  2063. var id = 0;
  2064. var postfix = Math.random();
  2065. var toString = uncurryThis(1.0.toString);
  2066. module.exports = function (key) {
  2067. return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString(++id + postfix, 36);
  2068. };
  2069. /***/ }),
  2070. /* 46 */
  2071. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2072. var DESCRIPTORS = __w_pdfjs_require__(10);
  2073. var fails = __w_pdfjs_require__(11);
  2074. var createElement = __w_pdfjs_require__(47);
  2075. module.exports = !DESCRIPTORS && !fails(function () {
  2076. return Object.defineProperty(createElement('div'), 'a', {
  2077. get: function () {
  2078. return 7;
  2079. }
  2080. }).a != 7;
  2081. });
  2082. /***/ }),
  2083. /* 47 */
  2084. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2085. var global = __w_pdfjs_require__(8);
  2086. var isObject = __w_pdfjs_require__(24);
  2087. var document = global.document;
  2088. var EXISTS = isObject(document) && isObject(document.createElement);
  2089. module.exports = function (it) {
  2090. return EXISTS ? document.createElement(it) : {};
  2091. };
  2092. /***/ }),
  2093. /* 48 */
  2094. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2095. var DESCRIPTORS = __w_pdfjs_require__(10);
  2096. var definePropertyModule = __w_pdfjs_require__(49);
  2097. var createPropertyDescriptor = __w_pdfjs_require__(15);
  2098. module.exports = DESCRIPTORS ? function (object, key, value) {
  2099. return definePropertyModule.f(object, key, createPropertyDescriptor(1, value));
  2100. } : function (object, key, value) {
  2101. object[key] = value;
  2102. return object;
  2103. };
  2104. /***/ }),
  2105. /* 49 */
  2106. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2107. var DESCRIPTORS = __w_pdfjs_require__(10);
  2108. var IE8_DOM_DEFINE = __w_pdfjs_require__(46);
  2109. var V8_PROTOTYPE_DEFINE_BUG = __w_pdfjs_require__(50);
  2110. var anObject = __w_pdfjs_require__(51);
  2111. var toPropertyKey = __w_pdfjs_require__(22);
  2112. var $TypeError = TypeError;
  2113. var $defineProperty = Object.defineProperty;
  2114. var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  2115. var ENUMERABLE = 'enumerable';
  2116. var CONFIGURABLE = 'configurable';
  2117. var WRITABLE = 'writable';
  2118. exports.f = DESCRIPTORS ? V8_PROTOTYPE_DEFINE_BUG ? function defineProperty(O, P, Attributes) {
  2119. anObject(O);
  2120. P = toPropertyKey(P);
  2121. anObject(Attributes);
  2122. if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {
  2123. var current = $getOwnPropertyDescriptor(O, P);
  2124. if (current && current[WRITABLE]) {
  2125. O[P] = Attributes.value;
  2126. Attributes = {
  2127. configurable: CONFIGURABLE in Attributes ? Attributes[CONFIGURABLE] : current[CONFIGURABLE],
  2128. enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE],
  2129. writable: false
  2130. };
  2131. }
  2132. }
  2133. return $defineProperty(O, P, Attributes);
  2134. } : $defineProperty : function defineProperty(O, P, Attributes) {
  2135. anObject(O);
  2136. P = toPropertyKey(P);
  2137. anObject(Attributes);
  2138. if (IE8_DOM_DEFINE)
  2139. try {
  2140. return $defineProperty(O, P, Attributes);
  2141. } catch (error) {
  2142. }
  2143. if ('get' in Attributes || 'set' in Attributes)
  2144. throw $TypeError('Accessors not supported');
  2145. if ('value' in Attributes)
  2146. O[P] = Attributes.value;
  2147. return O;
  2148. };
  2149. /***/ }),
  2150. /* 50 */
  2151. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2152. var DESCRIPTORS = __w_pdfjs_require__(10);
  2153. var fails = __w_pdfjs_require__(11);
  2154. module.exports = DESCRIPTORS && fails(function () {
  2155. return Object.defineProperty(function () {
  2156. }, 'prototype', {
  2157. value: 42,
  2158. writable: false
  2159. }).prototype != 42;
  2160. });
  2161. /***/ }),
  2162. /* 51 */
  2163. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2164. var isObject = __w_pdfjs_require__(24);
  2165. var $String = String;
  2166. var $TypeError = TypeError;
  2167. module.exports = function (argument) {
  2168. if (isObject(argument))
  2169. return argument;
  2170. throw $TypeError($String(argument) + ' is not an object');
  2171. };
  2172. /***/ }),
  2173. /* 52 */
  2174. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2175. var isCallable = __w_pdfjs_require__(25);
  2176. var definePropertyModule = __w_pdfjs_require__(49);
  2177. var makeBuiltIn = __w_pdfjs_require__(53);
  2178. var defineGlobalProperty = __w_pdfjs_require__(42);
  2179. module.exports = function (O, key, value, options) {
  2180. if (!options)
  2181. options = {};
  2182. var simple = options.enumerable;
  2183. var name = options.name !== undefined ? options.name : key;
  2184. if (isCallable(value))
  2185. makeBuiltIn(value, name, options);
  2186. if (options.global) {
  2187. if (simple)
  2188. O[key] = value;
  2189. else
  2190. defineGlobalProperty(key, value);
  2191. } else {
  2192. try {
  2193. if (!options.unsafe)
  2194. delete O[key];
  2195. else if (O[key])
  2196. simple = true;
  2197. } catch (error) {
  2198. }
  2199. if (simple)
  2200. O[key] = value;
  2201. else
  2202. definePropertyModule.f(O, key, {
  2203. value: value,
  2204. enumerable: false,
  2205. configurable: !options.nonConfigurable,
  2206. writable: !options.nonWritable
  2207. });
  2208. }
  2209. return O;
  2210. };
  2211. /***/ }),
  2212. /* 53 */
  2213. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2214. var fails = __w_pdfjs_require__(11);
  2215. var isCallable = __w_pdfjs_require__(25);
  2216. var hasOwn = __w_pdfjs_require__(43);
  2217. var DESCRIPTORS = __w_pdfjs_require__(10);
  2218. var CONFIGURABLE_FUNCTION_NAME = (__w_pdfjs_require__(54).CONFIGURABLE);
  2219. var inspectSource = __w_pdfjs_require__(55);
  2220. var InternalStateModule = __w_pdfjs_require__(56);
  2221. var enforceInternalState = InternalStateModule.enforce;
  2222. var getInternalState = InternalStateModule.get;
  2223. var defineProperty = Object.defineProperty;
  2224. var CONFIGURABLE_LENGTH = DESCRIPTORS && !fails(function () {
  2225. return defineProperty(function () {
  2226. }, 'length', { value: 8 }).length !== 8;
  2227. });
  2228. var TEMPLATE = String(String).split('String');
  2229. var makeBuiltIn = module.exports = function (value, name, options) {
  2230. if (String(name).slice(0, 7) === 'Symbol(') {
  2231. name = '[' + String(name).replace(/^Symbol\(([^)]*)\)/, '$1') + ']';
  2232. }
  2233. if (options && options.getter)
  2234. name = 'get ' + name;
  2235. if (options && options.setter)
  2236. name = 'set ' + name;
  2237. if (!hasOwn(value, 'name') || CONFIGURABLE_FUNCTION_NAME && value.name !== name) {
  2238. if (DESCRIPTORS)
  2239. defineProperty(value, 'name', {
  2240. value: name,
  2241. configurable: true
  2242. });
  2243. else
  2244. value.name = name;
  2245. }
  2246. if (CONFIGURABLE_LENGTH && options && hasOwn(options, 'arity') && value.length !== options.arity) {
  2247. defineProperty(value, 'length', { value: options.arity });
  2248. }
  2249. try {
  2250. if (options && hasOwn(options, 'constructor') && options.constructor) {
  2251. if (DESCRIPTORS)
  2252. defineProperty(value, 'prototype', { writable: false });
  2253. } else if (value.prototype)
  2254. value.prototype = undefined;
  2255. } catch (error) {
  2256. }
  2257. var state = enforceInternalState(value);
  2258. if (!hasOwn(state, 'source')) {
  2259. state.source = TEMPLATE.join(typeof name == 'string' ? name : '');
  2260. }
  2261. return value;
  2262. };
  2263. Function.prototype.toString = makeBuiltIn(function toString() {
  2264. return isCallable(this) && getInternalState(this).source || inspectSource(this);
  2265. }, 'toString');
  2266. /***/ }),
  2267. /* 54 */
  2268. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2269. var DESCRIPTORS = __w_pdfjs_require__(10);
  2270. var hasOwn = __w_pdfjs_require__(43);
  2271. var FunctionPrototype = Function.prototype;
  2272. var getDescriptor = DESCRIPTORS && Object.getOwnPropertyDescriptor;
  2273. var EXISTS = hasOwn(FunctionPrototype, 'name');
  2274. var PROPER = EXISTS && function something() {
  2275. }.name === 'something';
  2276. var CONFIGURABLE = EXISTS && (!DESCRIPTORS || DESCRIPTORS && getDescriptor(FunctionPrototype, 'name').configurable);
  2277. module.exports = {
  2278. EXISTS: EXISTS,
  2279. PROPER: PROPER,
  2280. CONFIGURABLE: CONFIGURABLE
  2281. };
  2282. /***/ }),
  2283. /* 55 */
  2284. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2285. var uncurryThis = __w_pdfjs_require__(18);
  2286. var isCallable = __w_pdfjs_require__(25);
  2287. var store = __w_pdfjs_require__(41);
  2288. var functionToString = uncurryThis(Function.toString);
  2289. if (!isCallable(store.inspectSource)) {
  2290. store.inspectSource = function (it) {
  2291. return functionToString(it);
  2292. };
  2293. }
  2294. module.exports = store.inspectSource;
  2295. /***/ }),
  2296. /* 56 */
  2297. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2298. var NATIVE_WEAK_MAP = __w_pdfjs_require__(57);
  2299. var global = __w_pdfjs_require__(8);
  2300. var isObject = __w_pdfjs_require__(24);
  2301. var createNonEnumerableProperty = __w_pdfjs_require__(48);
  2302. var hasOwn = __w_pdfjs_require__(43);
  2303. var shared = __w_pdfjs_require__(41);
  2304. var sharedKey = __w_pdfjs_require__(58);
  2305. var hiddenKeys = __w_pdfjs_require__(59);
  2306. var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
  2307. var TypeError = global.TypeError;
  2308. var WeakMap = global.WeakMap;
  2309. var set, get, has;
  2310. var enforce = function (it) {
  2311. return has(it) ? get(it) : set(it, {});
  2312. };
  2313. var getterFor = function (TYPE) {
  2314. return function (it) {
  2315. var state;
  2316. if (!isObject(it) || (state = get(it)).type !== TYPE) {
  2317. throw TypeError('Incompatible receiver, ' + TYPE + ' required');
  2318. }
  2319. return state;
  2320. };
  2321. };
  2322. if (NATIVE_WEAK_MAP || shared.state) {
  2323. var store = shared.state || (shared.state = new WeakMap());
  2324. store.get = store.get;
  2325. store.has = store.has;
  2326. store.set = store.set;
  2327. set = function (it, metadata) {
  2328. if (store.has(it))
  2329. throw TypeError(OBJECT_ALREADY_INITIALIZED);
  2330. metadata.facade = it;
  2331. store.set(it, metadata);
  2332. return metadata;
  2333. };
  2334. get = function (it) {
  2335. return store.get(it) || {};
  2336. };
  2337. has = function (it) {
  2338. return store.has(it);
  2339. };
  2340. } else {
  2341. var STATE = sharedKey('state');
  2342. hiddenKeys[STATE] = true;
  2343. set = function (it, metadata) {
  2344. if (hasOwn(it, STATE))
  2345. throw TypeError(OBJECT_ALREADY_INITIALIZED);
  2346. metadata.facade = it;
  2347. createNonEnumerableProperty(it, STATE, metadata);
  2348. return metadata;
  2349. };
  2350. get = function (it) {
  2351. return hasOwn(it, STATE) ? it[STATE] : {};
  2352. };
  2353. has = function (it) {
  2354. return hasOwn(it, STATE);
  2355. };
  2356. }
  2357. module.exports = {
  2358. set: set,
  2359. get: get,
  2360. has: has,
  2361. enforce: enforce,
  2362. getterFor: getterFor
  2363. };
  2364. /***/ }),
  2365. /* 57 */
  2366. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2367. var global = __w_pdfjs_require__(8);
  2368. var isCallable = __w_pdfjs_require__(25);
  2369. var WeakMap = global.WeakMap;
  2370. module.exports = isCallable(WeakMap) && /native code/.test(String(WeakMap));
  2371. /***/ }),
  2372. /* 58 */
  2373. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2374. var shared = __w_pdfjs_require__(39);
  2375. var uid = __w_pdfjs_require__(45);
  2376. var keys = shared('keys');
  2377. module.exports = function (key) {
  2378. return keys[key] || (keys[key] = uid(key));
  2379. };
  2380. /***/ }),
  2381. /* 59 */
  2382. /***/ ((module) => {
  2383. module.exports = {};
  2384. /***/ }),
  2385. /* 60 */
  2386. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2387. var hasOwn = __w_pdfjs_require__(43);
  2388. var ownKeys = __w_pdfjs_require__(61);
  2389. var getOwnPropertyDescriptorModule = __w_pdfjs_require__(9);
  2390. var definePropertyModule = __w_pdfjs_require__(49);
  2391. module.exports = function (target, source, exceptions) {
  2392. var keys = ownKeys(source);
  2393. var defineProperty = definePropertyModule.f;
  2394. var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
  2395. for (var i = 0; i < keys.length; i++) {
  2396. var key = keys[i];
  2397. if (!hasOwn(target, key) && !(exceptions && hasOwn(exceptions, key))) {
  2398. defineProperty(target, key, getOwnPropertyDescriptor(source, key));
  2399. }
  2400. }
  2401. };
  2402. /***/ }),
  2403. /* 61 */
  2404. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2405. var getBuiltIn = __w_pdfjs_require__(28);
  2406. var uncurryThis = __w_pdfjs_require__(18);
  2407. var getOwnPropertyNamesModule = __w_pdfjs_require__(62);
  2408. var getOwnPropertySymbolsModule = __w_pdfjs_require__(71);
  2409. var anObject = __w_pdfjs_require__(51);
  2410. var concat = uncurryThis([].concat);
  2411. module.exports = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
  2412. var keys = getOwnPropertyNamesModule.f(anObject(it));
  2413. var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
  2414. return getOwnPropertySymbols ? concat(keys, getOwnPropertySymbols(it)) : keys;
  2415. };
  2416. /***/ }),
  2417. /* 62 */
  2418. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2419. var internalObjectKeys = __w_pdfjs_require__(63);
  2420. var enumBugKeys = __w_pdfjs_require__(70);
  2421. var hiddenKeys = enumBugKeys.concat('length', 'prototype');
  2422. exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
  2423. return internalObjectKeys(O, hiddenKeys);
  2424. };
  2425. /***/ }),
  2426. /* 63 */
  2427. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2428. var uncurryThis = __w_pdfjs_require__(18);
  2429. var hasOwn = __w_pdfjs_require__(43);
  2430. var toIndexedObject = __w_pdfjs_require__(16);
  2431. var indexOf = (__w_pdfjs_require__(64).indexOf);
  2432. var hiddenKeys = __w_pdfjs_require__(59);
  2433. var push = uncurryThis([].push);
  2434. module.exports = function (object, names) {
  2435. var O = toIndexedObject(object);
  2436. var i = 0;
  2437. var result = [];
  2438. var key;
  2439. for (key in O)
  2440. !hasOwn(hiddenKeys, key) && hasOwn(O, key) && push(result, key);
  2441. while (names.length > i)
  2442. if (hasOwn(O, key = names[i++])) {
  2443. ~indexOf(result, key) || push(result, key);
  2444. }
  2445. return result;
  2446. };
  2447. /***/ }),
  2448. /* 64 */
  2449. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2450. var toIndexedObject = __w_pdfjs_require__(16);
  2451. var toAbsoluteIndex = __w_pdfjs_require__(65);
  2452. var lengthOfArrayLike = __w_pdfjs_require__(68);
  2453. var createMethod = function (IS_INCLUDES) {
  2454. return function ($this, el, fromIndex) {
  2455. var O = toIndexedObject($this);
  2456. var length = lengthOfArrayLike(O);
  2457. var index = toAbsoluteIndex(fromIndex, length);
  2458. var value;
  2459. if (IS_INCLUDES && el != el)
  2460. while (length > index) {
  2461. value = O[index++];
  2462. if (value != value)
  2463. return true;
  2464. }
  2465. else
  2466. for (; length > index; index++) {
  2467. if ((IS_INCLUDES || index in O) && O[index] === el)
  2468. return IS_INCLUDES || index || 0;
  2469. }
  2470. return !IS_INCLUDES && -1;
  2471. };
  2472. };
  2473. module.exports = {
  2474. includes: createMethod(true),
  2475. indexOf: createMethod(false)
  2476. };
  2477. /***/ }),
  2478. /* 65 */
  2479. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2480. var toIntegerOrInfinity = __w_pdfjs_require__(66);
  2481. var max = Math.max;
  2482. var min = Math.min;
  2483. module.exports = function (index, length) {
  2484. var integer = toIntegerOrInfinity(index);
  2485. return integer < 0 ? max(integer + length, 0) : min(integer, length);
  2486. };
  2487. /***/ }),
  2488. /* 66 */
  2489. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2490. var trunc = __w_pdfjs_require__(67);
  2491. module.exports = function (argument) {
  2492. var number = +argument;
  2493. return number !== number || number === 0 ? 0 : trunc(number);
  2494. };
  2495. /***/ }),
  2496. /* 67 */
  2497. /***/ ((module) => {
  2498. var ceil = Math.ceil;
  2499. var floor = Math.floor;
  2500. module.exports = Math.trunc || function trunc(x) {
  2501. var n = +x;
  2502. return (n > 0 ? floor : ceil)(n);
  2503. };
  2504. /***/ }),
  2505. /* 68 */
  2506. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2507. var toLength = __w_pdfjs_require__(69);
  2508. module.exports = function (obj) {
  2509. return toLength(obj.length);
  2510. };
  2511. /***/ }),
  2512. /* 69 */
  2513. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2514. var toIntegerOrInfinity = __w_pdfjs_require__(66);
  2515. var min = Math.min;
  2516. module.exports = function (argument) {
  2517. return argument > 0 ? min(toIntegerOrInfinity(argument), 0x1FFFFFFFFFFFFF) : 0;
  2518. };
  2519. /***/ }),
  2520. /* 70 */
  2521. /***/ ((module) => {
  2522. module.exports = [
  2523. 'constructor',
  2524. 'hasOwnProperty',
  2525. 'isPrototypeOf',
  2526. 'propertyIsEnumerable',
  2527. 'toLocaleString',
  2528. 'toString',
  2529. 'valueOf'
  2530. ];
  2531. /***/ }),
  2532. /* 71 */
  2533. /***/ ((__unused_webpack_module, exports) => {
  2534. exports.f = Object.getOwnPropertySymbols;
  2535. /***/ }),
  2536. /* 72 */
  2537. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2538. var fails = __w_pdfjs_require__(11);
  2539. var isCallable = __w_pdfjs_require__(25);
  2540. var replacement = /#|\.prototype\./;
  2541. var isForced = function (feature, detection) {
  2542. var value = data[normalize(feature)];
  2543. return value == POLYFILL ? true : value == NATIVE ? false : isCallable(detection) ? fails(detection) : !!detection;
  2544. };
  2545. var normalize = isForced.normalize = function (string) {
  2546. return String(string).replace(replacement, '.').toLowerCase();
  2547. };
  2548. var data = isForced.data = {};
  2549. var NATIVE = isForced.NATIVE = 'N';
  2550. var POLYFILL = isForced.POLYFILL = 'P';
  2551. module.exports = isForced;
  2552. /***/ }),
  2553. /* 73 */
  2554. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2555. var wellKnownSymbol = __w_pdfjs_require__(38);
  2556. var create = __w_pdfjs_require__(74);
  2557. var defineProperty = (__w_pdfjs_require__(49).f);
  2558. var UNSCOPABLES = wellKnownSymbol('unscopables');
  2559. var ArrayPrototype = Array.prototype;
  2560. if (ArrayPrototype[UNSCOPABLES] == undefined) {
  2561. defineProperty(ArrayPrototype, UNSCOPABLES, {
  2562. configurable: true,
  2563. value: create(null)
  2564. });
  2565. }
  2566. module.exports = function (key) {
  2567. ArrayPrototype[UNSCOPABLES][key] = true;
  2568. };
  2569. /***/ }),
  2570. /* 74 */
  2571. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2572. var anObject = __w_pdfjs_require__(51);
  2573. var definePropertiesModule = __w_pdfjs_require__(75);
  2574. var enumBugKeys = __w_pdfjs_require__(70);
  2575. var hiddenKeys = __w_pdfjs_require__(59);
  2576. var html = __w_pdfjs_require__(77);
  2577. var documentCreateElement = __w_pdfjs_require__(47);
  2578. var sharedKey = __w_pdfjs_require__(58);
  2579. var GT = '>';
  2580. var LT = '<';
  2581. var PROTOTYPE = 'prototype';
  2582. var SCRIPT = 'script';
  2583. var IE_PROTO = sharedKey('IE_PROTO');
  2584. var EmptyConstructor = function () {
  2585. };
  2586. var scriptTag = function (content) {
  2587. return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
  2588. };
  2589. var NullProtoObjectViaActiveX = function (activeXDocument) {
  2590. activeXDocument.write(scriptTag(''));
  2591. activeXDocument.close();
  2592. var temp = activeXDocument.parentWindow.Object;
  2593. activeXDocument = null;
  2594. return temp;
  2595. };
  2596. var NullProtoObjectViaIFrame = function () {
  2597. var iframe = documentCreateElement('iframe');
  2598. var JS = 'java' + SCRIPT + ':';
  2599. var iframeDocument;
  2600. iframe.style.display = 'none';
  2601. html.appendChild(iframe);
  2602. iframe.src = String(JS);
  2603. iframeDocument = iframe.contentWindow.document;
  2604. iframeDocument.open();
  2605. iframeDocument.write(scriptTag('document.F=Object'));
  2606. iframeDocument.close();
  2607. return iframeDocument.F;
  2608. };
  2609. var activeXDocument;
  2610. var NullProtoObject = function () {
  2611. try {
  2612. activeXDocument = new ActiveXObject('htmlfile');
  2613. } catch (error) {
  2614. }
  2615. NullProtoObject = typeof document != 'undefined' ? document.domain && activeXDocument ? NullProtoObjectViaActiveX(activeXDocument) : NullProtoObjectViaIFrame() : NullProtoObjectViaActiveX(activeXDocument);
  2616. var length = enumBugKeys.length;
  2617. while (length--)
  2618. delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
  2619. return NullProtoObject();
  2620. };
  2621. hiddenKeys[IE_PROTO] = true;
  2622. module.exports = Object.create || function create(O, Properties) {
  2623. var result;
  2624. if (O !== null) {
  2625. EmptyConstructor[PROTOTYPE] = anObject(O);
  2626. result = new EmptyConstructor();
  2627. EmptyConstructor[PROTOTYPE] = null;
  2628. result[IE_PROTO] = O;
  2629. } else
  2630. result = NullProtoObject();
  2631. return Properties === undefined ? result : definePropertiesModule.f(result, Properties);
  2632. };
  2633. /***/ }),
  2634. /* 75 */
  2635. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2636. var DESCRIPTORS = __w_pdfjs_require__(10);
  2637. var V8_PROTOTYPE_DEFINE_BUG = __w_pdfjs_require__(50);
  2638. var definePropertyModule = __w_pdfjs_require__(49);
  2639. var anObject = __w_pdfjs_require__(51);
  2640. var toIndexedObject = __w_pdfjs_require__(16);
  2641. var objectKeys = __w_pdfjs_require__(76);
  2642. exports.f = DESCRIPTORS && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties(O, Properties) {
  2643. anObject(O);
  2644. var props = toIndexedObject(Properties);
  2645. var keys = objectKeys(Properties);
  2646. var length = keys.length;
  2647. var index = 0;
  2648. var key;
  2649. while (length > index)
  2650. definePropertyModule.f(O, key = keys[index++], props[key]);
  2651. return O;
  2652. };
  2653. /***/ }),
  2654. /* 76 */
  2655. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2656. var internalObjectKeys = __w_pdfjs_require__(63);
  2657. var enumBugKeys = __w_pdfjs_require__(70);
  2658. module.exports = Object.keys || function keys(O) {
  2659. return internalObjectKeys(O, enumBugKeys);
  2660. };
  2661. /***/ }),
  2662. /* 77 */
  2663. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2664. var getBuiltIn = __w_pdfjs_require__(28);
  2665. module.exports = getBuiltIn('document', 'documentElement');
  2666. /***/ }),
  2667. /* 78 */
  2668. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2669. var global = __w_pdfjs_require__(8);
  2670. var uncurryThis = __w_pdfjs_require__(18);
  2671. module.exports = function (CONSTRUCTOR, METHOD) {
  2672. return uncurryThis(global[CONSTRUCTOR].prototype[METHOD]);
  2673. };
  2674. /***/ }),
  2675. /* 79 */
  2676. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2677. __w_pdfjs_require__(80);
  2678. /***/ }),
  2679. /* 80 */
  2680. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2681. "use strict";
  2682. var ArrayBufferViewCore = __w_pdfjs_require__(81);
  2683. var lengthOfArrayLike = __w_pdfjs_require__(68);
  2684. var toIntegerOrInfinity = __w_pdfjs_require__(66);
  2685. var aTypedArray = ArrayBufferViewCore.aTypedArray;
  2686. var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
  2687. exportTypedArrayMethod('at', function at(index) {
  2688. var O = aTypedArray(this);
  2689. var len = lengthOfArrayLike(O);
  2690. var relativeIndex = toIntegerOrInfinity(index);
  2691. var k = relativeIndex >= 0 ? relativeIndex : len + relativeIndex;
  2692. return k < 0 || k >= len ? undefined : O[k];
  2693. });
  2694. /***/ }),
  2695. /* 81 */
  2696. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2697. "use strict";
  2698. var NATIVE_ARRAY_BUFFER = __w_pdfjs_require__(82);
  2699. var DESCRIPTORS = __w_pdfjs_require__(10);
  2700. var global = __w_pdfjs_require__(8);
  2701. var isCallable = __w_pdfjs_require__(25);
  2702. var isObject = __w_pdfjs_require__(24);
  2703. var hasOwn = __w_pdfjs_require__(43);
  2704. var classof = __w_pdfjs_require__(83);
  2705. var tryToString = __w_pdfjs_require__(36);
  2706. var createNonEnumerableProperty = __w_pdfjs_require__(48);
  2707. var defineBuiltIn = __w_pdfjs_require__(52);
  2708. var defineProperty = (__w_pdfjs_require__(49).f);
  2709. var isPrototypeOf = __w_pdfjs_require__(29);
  2710. var getPrototypeOf = __w_pdfjs_require__(85);
  2711. var setPrototypeOf = __w_pdfjs_require__(87);
  2712. var wellKnownSymbol = __w_pdfjs_require__(38);
  2713. var uid = __w_pdfjs_require__(45);
  2714. var InternalStateModule = __w_pdfjs_require__(56);
  2715. var enforceInternalState = InternalStateModule.enforce;
  2716. var getInternalState = InternalStateModule.get;
  2717. var Int8Array = global.Int8Array;
  2718. var Int8ArrayPrototype = Int8Array && Int8Array.prototype;
  2719. var Uint8ClampedArray = global.Uint8ClampedArray;
  2720. var Uint8ClampedArrayPrototype = Uint8ClampedArray && Uint8ClampedArray.prototype;
  2721. var TypedArray = Int8Array && getPrototypeOf(Int8Array);
  2722. var TypedArrayPrototype = Int8ArrayPrototype && getPrototypeOf(Int8ArrayPrototype);
  2723. var ObjectPrototype = Object.prototype;
  2724. var TypeError = global.TypeError;
  2725. var TO_STRING_TAG = wellKnownSymbol('toStringTag');
  2726. var TYPED_ARRAY_TAG = uid('TYPED_ARRAY_TAG');
  2727. var TYPED_ARRAY_CONSTRUCTOR = 'TypedArrayConstructor';
  2728. var NATIVE_ARRAY_BUFFER_VIEWS = NATIVE_ARRAY_BUFFER && !!setPrototypeOf && classof(global.opera) !== 'Opera';
  2729. var TYPED_ARRAY_TAG_REQUIRED = false;
  2730. var NAME, Constructor, Prototype;
  2731. var TypedArrayConstructorsList = {
  2732. Int8Array: 1,
  2733. Uint8Array: 1,
  2734. Uint8ClampedArray: 1,
  2735. Int16Array: 2,
  2736. Uint16Array: 2,
  2737. Int32Array: 4,
  2738. Uint32Array: 4,
  2739. Float32Array: 4,
  2740. Float64Array: 8
  2741. };
  2742. var BigIntArrayConstructorsList = {
  2743. BigInt64Array: 8,
  2744. BigUint64Array: 8
  2745. };
  2746. var isView = function isView(it) {
  2747. if (!isObject(it))
  2748. return false;
  2749. var klass = classof(it);
  2750. return klass === 'DataView' || hasOwn(TypedArrayConstructorsList, klass) || hasOwn(BigIntArrayConstructorsList, klass);
  2751. };
  2752. var getTypedArrayConstructor = function (it) {
  2753. var proto = getPrototypeOf(it);
  2754. if (!isObject(proto))
  2755. return;
  2756. var state = getInternalState(proto);
  2757. return state && hasOwn(state, TYPED_ARRAY_CONSTRUCTOR) ? state[TYPED_ARRAY_CONSTRUCTOR] : getTypedArrayConstructor(proto);
  2758. };
  2759. var isTypedArray = function (it) {
  2760. if (!isObject(it))
  2761. return false;
  2762. var klass = classof(it);
  2763. return hasOwn(TypedArrayConstructorsList, klass) || hasOwn(BigIntArrayConstructorsList, klass);
  2764. };
  2765. var aTypedArray = function (it) {
  2766. if (isTypedArray(it))
  2767. return it;
  2768. throw TypeError('Target is not a typed array');
  2769. };
  2770. var aTypedArrayConstructor = function (C) {
  2771. if (isCallable(C) && (!setPrototypeOf || isPrototypeOf(TypedArray, C)))
  2772. return C;
  2773. throw TypeError(tryToString(C) + ' is not a typed array constructor');
  2774. };
  2775. var exportTypedArrayMethod = function (KEY, property, forced, options) {
  2776. if (!DESCRIPTORS)
  2777. return;
  2778. if (forced)
  2779. for (var ARRAY in TypedArrayConstructorsList) {
  2780. var TypedArrayConstructor = global[ARRAY];
  2781. if (TypedArrayConstructor && hasOwn(TypedArrayConstructor.prototype, KEY))
  2782. try {
  2783. delete TypedArrayConstructor.prototype[KEY];
  2784. } catch (error) {
  2785. try {
  2786. TypedArrayConstructor.prototype[KEY] = property;
  2787. } catch (error2) {
  2788. }
  2789. }
  2790. }
  2791. if (!TypedArrayPrototype[KEY] || forced) {
  2792. defineBuiltIn(TypedArrayPrototype, KEY, forced ? property : NATIVE_ARRAY_BUFFER_VIEWS && Int8ArrayPrototype[KEY] || property, options);
  2793. }
  2794. };
  2795. var exportTypedArrayStaticMethod = function (KEY, property, forced) {
  2796. var ARRAY, TypedArrayConstructor;
  2797. if (!DESCRIPTORS)
  2798. return;
  2799. if (setPrototypeOf) {
  2800. if (forced)
  2801. for (ARRAY in TypedArrayConstructorsList) {
  2802. TypedArrayConstructor = global[ARRAY];
  2803. if (TypedArrayConstructor && hasOwn(TypedArrayConstructor, KEY))
  2804. try {
  2805. delete TypedArrayConstructor[KEY];
  2806. } catch (error) {
  2807. }
  2808. }
  2809. if (!TypedArray[KEY] || forced) {
  2810. try {
  2811. return defineBuiltIn(TypedArray, KEY, forced ? property : NATIVE_ARRAY_BUFFER_VIEWS && TypedArray[KEY] || property);
  2812. } catch (error) {
  2813. }
  2814. } else
  2815. return;
  2816. }
  2817. for (ARRAY in TypedArrayConstructorsList) {
  2818. TypedArrayConstructor = global[ARRAY];
  2819. if (TypedArrayConstructor && (!TypedArrayConstructor[KEY] || forced)) {
  2820. defineBuiltIn(TypedArrayConstructor, KEY, property);
  2821. }
  2822. }
  2823. };
  2824. for (NAME in TypedArrayConstructorsList) {
  2825. Constructor = global[NAME];
  2826. Prototype = Constructor && Constructor.prototype;
  2827. if (Prototype)
  2828. enforceInternalState(Prototype)[TYPED_ARRAY_CONSTRUCTOR] = Constructor;
  2829. else
  2830. NATIVE_ARRAY_BUFFER_VIEWS = false;
  2831. }
  2832. for (NAME in BigIntArrayConstructorsList) {
  2833. Constructor = global[NAME];
  2834. Prototype = Constructor && Constructor.prototype;
  2835. if (Prototype)
  2836. enforceInternalState(Prototype)[TYPED_ARRAY_CONSTRUCTOR] = Constructor;
  2837. }
  2838. if (!NATIVE_ARRAY_BUFFER_VIEWS || !isCallable(TypedArray) || TypedArray === Function.prototype) {
  2839. TypedArray = function TypedArray() {
  2840. throw TypeError('Incorrect invocation');
  2841. };
  2842. if (NATIVE_ARRAY_BUFFER_VIEWS)
  2843. for (NAME in TypedArrayConstructorsList) {
  2844. if (global[NAME])
  2845. setPrototypeOf(global[NAME], TypedArray);
  2846. }
  2847. }
  2848. if (!NATIVE_ARRAY_BUFFER_VIEWS || !TypedArrayPrototype || TypedArrayPrototype === ObjectPrototype) {
  2849. TypedArrayPrototype = TypedArray.prototype;
  2850. if (NATIVE_ARRAY_BUFFER_VIEWS)
  2851. for (NAME in TypedArrayConstructorsList) {
  2852. if (global[NAME])
  2853. setPrototypeOf(global[NAME].prototype, TypedArrayPrototype);
  2854. }
  2855. }
  2856. if (NATIVE_ARRAY_BUFFER_VIEWS && getPrototypeOf(Uint8ClampedArrayPrototype) !== TypedArrayPrototype) {
  2857. setPrototypeOf(Uint8ClampedArrayPrototype, TypedArrayPrototype);
  2858. }
  2859. if (DESCRIPTORS && !hasOwn(TypedArrayPrototype, TO_STRING_TAG)) {
  2860. TYPED_ARRAY_TAG_REQUIRED = true;
  2861. defineProperty(TypedArrayPrototype, TO_STRING_TAG, {
  2862. get: function () {
  2863. return isObject(this) ? this[TYPED_ARRAY_TAG] : undefined;
  2864. }
  2865. });
  2866. for (NAME in TypedArrayConstructorsList)
  2867. if (global[NAME]) {
  2868. createNonEnumerableProperty(global[NAME], TYPED_ARRAY_TAG, NAME);
  2869. }
  2870. }
  2871. module.exports = {
  2872. NATIVE_ARRAY_BUFFER_VIEWS: NATIVE_ARRAY_BUFFER_VIEWS,
  2873. TYPED_ARRAY_TAG: TYPED_ARRAY_TAG_REQUIRED && TYPED_ARRAY_TAG,
  2874. aTypedArray: aTypedArray,
  2875. aTypedArrayConstructor: aTypedArrayConstructor,
  2876. exportTypedArrayMethod: exportTypedArrayMethod,
  2877. exportTypedArrayStaticMethod: exportTypedArrayStaticMethod,
  2878. getTypedArrayConstructor: getTypedArrayConstructor,
  2879. isView: isView,
  2880. isTypedArray: isTypedArray,
  2881. TypedArray: TypedArray,
  2882. TypedArrayPrototype: TypedArrayPrototype
  2883. };
  2884. /***/ }),
  2885. /* 82 */
  2886. /***/ ((module) => {
  2887. module.exports = typeof ArrayBuffer != 'undefined' && typeof DataView != 'undefined';
  2888. /***/ }),
  2889. /* 83 */
  2890. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2891. var TO_STRING_TAG_SUPPORT = __w_pdfjs_require__(84);
  2892. var isCallable = __w_pdfjs_require__(25);
  2893. var classofRaw = __w_pdfjs_require__(19);
  2894. var wellKnownSymbol = __w_pdfjs_require__(38);
  2895. var TO_STRING_TAG = wellKnownSymbol('toStringTag');
  2896. var $Object = Object;
  2897. var CORRECT_ARGUMENTS = classofRaw((function () {
  2898. return arguments;
  2899. }())) == 'Arguments';
  2900. var tryGet = function (it, key) {
  2901. try {
  2902. return it[key];
  2903. } catch (error) {
  2904. }
  2905. };
  2906. module.exports = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) {
  2907. var O, tag, result;
  2908. return it === undefined ? 'Undefined' : it === null ? 'Null' : typeof (tag = tryGet(O = $Object(it), TO_STRING_TAG)) == 'string' ? tag : CORRECT_ARGUMENTS ? classofRaw(O) : (result = classofRaw(O)) == 'Object' && isCallable(O.callee) ? 'Arguments' : result;
  2909. };
  2910. /***/ }),
  2911. /* 84 */
  2912. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2913. var wellKnownSymbol = __w_pdfjs_require__(38);
  2914. var TO_STRING_TAG = wellKnownSymbol('toStringTag');
  2915. var test = {};
  2916. test[TO_STRING_TAG] = 'z';
  2917. module.exports = String(test) === '[object z]';
  2918. /***/ }),
  2919. /* 85 */
  2920. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2921. var hasOwn = __w_pdfjs_require__(43);
  2922. var isCallable = __w_pdfjs_require__(25);
  2923. var toObject = __w_pdfjs_require__(44);
  2924. var sharedKey = __w_pdfjs_require__(58);
  2925. var CORRECT_PROTOTYPE_GETTER = __w_pdfjs_require__(86);
  2926. var IE_PROTO = sharedKey('IE_PROTO');
  2927. var $Object = Object;
  2928. var ObjectPrototype = $Object.prototype;
  2929. module.exports = CORRECT_PROTOTYPE_GETTER ? $Object.getPrototypeOf : function (O) {
  2930. var object = toObject(O);
  2931. if (hasOwn(object, IE_PROTO))
  2932. return object[IE_PROTO];
  2933. var constructor = object.constructor;
  2934. if (isCallable(constructor) && object instanceof constructor) {
  2935. return constructor.prototype;
  2936. }
  2937. return object instanceof $Object ? ObjectPrototype : null;
  2938. };
  2939. /***/ }),
  2940. /* 86 */
  2941. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2942. var fails = __w_pdfjs_require__(11);
  2943. module.exports = !fails(function () {
  2944. function F() {
  2945. }
  2946. F.prototype.constructor = null;
  2947. return Object.getPrototypeOf(new F()) !== F.prototype;
  2948. });
  2949. /***/ }),
  2950. /* 87 */
  2951. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2952. var uncurryThis = __w_pdfjs_require__(18);
  2953. var anObject = __w_pdfjs_require__(51);
  2954. var aPossiblePrototype = __w_pdfjs_require__(88);
  2955. module.exports = Object.setPrototypeOf || ('__proto__' in {} ? (function () {
  2956. var CORRECT_SETTER = false;
  2957. var test = {};
  2958. var setter;
  2959. try {
  2960. setter = uncurryThis(Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set);
  2961. setter(test, []);
  2962. CORRECT_SETTER = test instanceof Array;
  2963. } catch (error) {
  2964. }
  2965. return function setPrototypeOf(O, proto) {
  2966. anObject(O);
  2967. aPossiblePrototype(proto);
  2968. if (CORRECT_SETTER)
  2969. setter(O, proto);
  2970. else
  2971. O.__proto__ = proto;
  2972. return O;
  2973. };
  2974. }()) : undefined);
  2975. /***/ }),
  2976. /* 88 */
  2977. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2978. var isCallable = __w_pdfjs_require__(25);
  2979. var $String = String;
  2980. var $TypeError = TypeError;
  2981. module.exports = function (argument) {
  2982. if (typeof argument == 'object' || isCallable(argument))
  2983. return argument;
  2984. throw $TypeError("Can't set " + $String(argument) + ' as a prototype');
  2985. };
  2986. /***/ }),
  2987. /* 89 */
  2988. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2989. __w_pdfjs_require__(90);
  2990. __w_pdfjs_require__(97);
  2991. __w_pdfjs_require__(99);
  2992. __w_pdfjs_require__(122);
  2993. __w_pdfjs_require__(124);
  2994. var path = __w_pdfjs_require__(133);
  2995. module.exports = path.structuredClone;
  2996. /***/ }),
  2997. /* 90 */
  2998. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2999. "use strict";
  3000. var toIndexedObject = __w_pdfjs_require__(16);
  3001. var addToUnscopables = __w_pdfjs_require__(73);
  3002. var Iterators = __w_pdfjs_require__(91);
  3003. var InternalStateModule = __w_pdfjs_require__(56);
  3004. var defineProperty = (__w_pdfjs_require__(49).f);
  3005. var defineIterator = __w_pdfjs_require__(92);
  3006. var createIterResultObject = __w_pdfjs_require__(96);
  3007. var IS_PURE = __w_pdfjs_require__(40);
  3008. var DESCRIPTORS = __w_pdfjs_require__(10);
  3009. var ARRAY_ITERATOR = 'Array Iterator';
  3010. var setInternalState = InternalStateModule.set;
  3011. var getInternalState = InternalStateModule.getterFor(ARRAY_ITERATOR);
  3012. module.exports = defineIterator(Array, 'Array', function (iterated, kind) {
  3013. setInternalState(this, {
  3014. type: ARRAY_ITERATOR,
  3015. target: toIndexedObject(iterated),
  3016. index: 0,
  3017. kind: kind
  3018. });
  3019. }, function () {
  3020. var state = getInternalState(this);
  3021. var target = state.target;
  3022. var kind = state.kind;
  3023. var index = state.index++;
  3024. if (!target || index >= target.length) {
  3025. state.target = undefined;
  3026. return createIterResultObject(undefined, true);
  3027. }
  3028. if (kind == 'keys')
  3029. return createIterResultObject(index, false);
  3030. if (kind == 'values')
  3031. return createIterResultObject(target[index], false);
  3032. return createIterResultObject([
  3033. index,
  3034. target[index]
  3035. ], false);
  3036. }, 'values');
  3037. var values = Iterators.Arguments = Iterators.Array;
  3038. addToUnscopables('keys');
  3039. addToUnscopables('values');
  3040. addToUnscopables('entries');
  3041. if (!IS_PURE && DESCRIPTORS && values.name !== 'values')
  3042. try {
  3043. defineProperty(values, 'name', { value: 'values' });
  3044. } catch (error) {
  3045. }
  3046. /***/ }),
  3047. /* 91 */
  3048. /***/ ((module) => {
  3049. module.exports = {};
  3050. /***/ }),
  3051. /* 92 */
  3052. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3053. "use strict";
  3054. var $ = __w_pdfjs_require__(7);
  3055. var call = __w_pdfjs_require__(12);
  3056. var IS_PURE = __w_pdfjs_require__(40);
  3057. var FunctionName = __w_pdfjs_require__(54);
  3058. var isCallable = __w_pdfjs_require__(25);
  3059. var createIteratorConstructor = __w_pdfjs_require__(93);
  3060. var getPrototypeOf = __w_pdfjs_require__(85);
  3061. var setPrototypeOf = __w_pdfjs_require__(87);
  3062. var setToStringTag = __w_pdfjs_require__(95);
  3063. var createNonEnumerableProperty = __w_pdfjs_require__(48);
  3064. var defineBuiltIn = __w_pdfjs_require__(52);
  3065. var wellKnownSymbol = __w_pdfjs_require__(38);
  3066. var Iterators = __w_pdfjs_require__(91);
  3067. var IteratorsCore = __w_pdfjs_require__(94);
  3068. var PROPER_FUNCTION_NAME = FunctionName.PROPER;
  3069. var CONFIGURABLE_FUNCTION_NAME = FunctionName.CONFIGURABLE;
  3070. var IteratorPrototype = IteratorsCore.IteratorPrototype;
  3071. var BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS;
  3072. var ITERATOR = wellKnownSymbol('iterator');
  3073. var KEYS = 'keys';
  3074. var VALUES = 'values';
  3075. var ENTRIES = 'entries';
  3076. var returnThis = function () {
  3077. return this;
  3078. };
  3079. module.exports = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
  3080. createIteratorConstructor(IteratorConstructor, NAME, next);
  3081. var getIterationMethod = function (KIND) {
  3082. if (KIND === DEFAULT && defaultIterator)
  3083. return defaultIterator;
  3084. if (!BUGGY_SAFARI_ITERATORS && KIND in IterablePrototype)
  3085. return IterablePrototype[KIND];
  3086. switch (KIND) {
  3087. case KEYS:
  3088. return function keys() {
  3089. return new IteratorConstructor(this, KIND);
  3090. };
  3091. case VALUES:
  3092. return function values() {
  3093. return new IteratorConstructor(this, KIND);
  3094. };
  3095. case ENTRIES:
  3096. return function entries() {
  3097. return new IteratorConstructor(this, KIND);
  3098. };
  3099. }
  3100. return function () {
  3101. return new IteratorConstructor(this);
  3102. };
  3103. };
  3104. var TO_STRING_TAG = NAME + ' Iterator';
  3105. var INCORRECT_VALUES_NAME = false;
  3106. var IterablePrototype = Iterable.prototype;
  3107. var nativeIterator = IterablePrototype[ITERATOR] || IterablePrototype['@@iterator'] || DEFAULT && IterablePrototype[DEFAULT];
  3108. var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT);
  3109. var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;
  3110. var CurrentIteratorPrototype, methods, KEY;
  3111. if (anyNativeIterator) {
  3112. CurrentIteratorPrototype = getPrototypeOf(anyNativeIterator.call(new Iterable()));
  3113. if (CurrentIteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) {
  3114. if (!IS_PURE && getPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) {
  3115. if (setPrototypeOf) {
  3116. setPrototypeOf(CurrentIteratorPrototype, IteratorPrototype);
  3117. } else if (!isCallable(CurrentIteratorPrototype[ITERATOR])) {
  3118. defineBuiltIn(CurrentIteratorPrototype, ITERATOR, returnThis);
  3119. }
  3120. }
  3121. setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true, true);
  3122. if (IS_PURE)
  3123. Iterators[TO_STRING_TAG] = returnThis;
  3124. }
  3125. }
  3126. if (PROPER_FUNCTION_NAME && DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) {
  3127. if (!IS_PURE && CONFIGURABLE_FUNCTION_NAME) {
  3128. createNonEnumerableProperty(IterablePrototype, 'name', VALUES);
  3129. } else {
  3130. INCORRECT_VALUES_NAME = true;
  3131. defaultIterator = function values() {
  3132. return call(nativeIterator, this);
  3133. };
  3134. }
  3135. }
  3136. if (DEFAULT) {
  3137. methods = {
  3138. values: getIterationMethod(VALUES),
  3139. keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),
  3140. entries: getIterationMethod(ENTRIES)
  3141. };
  3142. if (FORCED)
  3143. for (KEY in methods) {
  3144. if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
  3145. defineBuiltIn(IterablePrototype, KEY, methods[KEY]);
  3146. }
  3147. }
  3148. else
  3149. $({
  3150. target: NAME,
  3151. proto: true,
  3152. forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME
  3153. }, methods);
  3154. }
  3155. if ((!IS_PURE || FORCED) && IterablePrototype[ITERATOR] !== defaultIterator) {
  3156. defineBuiltIn(IterablePrototype, ITERATOR, defaultIterator, { name: DEFAULT });
  3157. }
  3158. Iterators[NAME] = defaultIterator;
  3159. return methods;
  3160. };
  3161. /***/ }),
  3162. /* 93 */
  3163. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3164. "use strict";
  3165. var IteratorPrototype = (__w_pdfjs_require__(94).IteratorPrototype);
  3166. var create = __w_pdfjs_require__(74);
  3167. var createPropertyDescriptor = __w_pdfjs_require__(15);
  3168. var setToStringTag = __w_pdfjs_require__(95);
  3169. var Iterators = __w_pdfjs_require__(91);
  3170. var returnThis = function () {
  3171. return this;
  3172. };
  3173. module.exports = function (IteratorConstructor, NAME, next, ENUMERABLE_NEXT) {
  3174. var TO_STRING_TAG = NAME + ' Iterator';
  3175. IteratorConstructor.prototype = create(IteratorPrototype, { next: createPropertyDescriptor(+!ENUMERABLE_NEXT, next) });
  3176. setToStringTag(IteratorConstructor, TO_STRING_TAG, false, true);
  3177. Iterators[TO_STRING_TAG] = returnThis;
  3178. return IteratorConstructor;
  3179. };
  3180. /***/ }),
  3181. /* 94 */
  3182. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3183. "use strict";
  3184. var fails = __w_pdfjs_require__(11);
  3185. var isCallable = __w_pdfjs_require__(25);
  3186. var isObject = __w_pdfjs_require__(24);
  3187. var create = __w_pdfjs_require__(74);
  3188. var getPrototypeOf = __w_pdfjs_require__(85);
  3189. var defineBuiltIn = __w_pdfjs_require__(52);
  3190. var wellKnownSymbol = __w_pdfjs_require__(38);
  3191. var IS_PURE = __w_pdfjs_require__(40);
  3192. var ITERATOR = wellKnownSymbol('iterator');
  3193. var BUGGY_SAFARI_ITERATORS = false;
  3194. var IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator;
  3195. if ([].keys) {
  3196. arrayIterator = [].keys();
  3197. if (!('next' in arrayIterator))
  3198. BUGGY_SAFARI_ITERATORS = true;
  3199. else {
  3200. PrototypeOfArrayIteratorPrototype = getPrototypeOf(getPrototypeOf(arrayIterator));
  3201. if (PrototypeOfArrayIteratorPrototype !== Object.prototype)
  3202. IteratorPrototype = PrototypeOfArrayIteratorPrototype;
  3203. }
  3204. }
  3205. var NEW_ITERATOR_PROTOTYPE = !isObject(IteratorPrototype) || fails(function () {
  3206. var test = {};
  3207. return IteratorPrototype[ITERATOR].call(test) !== test;
  3208. });
  3209. if (NEW_ITERATOR_PROTOTYPE)
  3210. IteratorPrototype = {};
  3211. else if (IS_PURE)
  3212. IteratorPrototype = create(IteratorPrototype);
  3213. if (!isCallable(IteratorPrototype[ITERATOR])) {
  3214. defineBuiltIn(IteratorPrototype, ITERATOR, function () {
  3215. return this;
  3216. });
  3217. }
  3218. module.exports = {
  3219. IteratorPrototype: IteratorPrototype,
  3220. BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS
  3221. };
  3222. /***/ }),
  3223. /* 95 */
  3224. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3225. var defineProperty = (__w_pdfjs_require__(49).f);
  3226. var hasOwn = __w_pdfjs_require__(43);
  3227. var wellKnownSymbol = __w_pdfjs_require__(38);
  3228. var TO_STRING_TAG = wellKnownSymbol('toStringTag');
  3229. module.exports = function (target, TAG, STATIC) {
  3230. if (target && !STATIC)
  3231. target = target.prototype;
  3232. if (target && !hasOwn(target, TO_STRING_TAG)) {
  3233. defineProperty(target, TO_STRING_TAG, {
  3234. configurable: true,
  3235. value: TAG
  3236. });
  3237. }
  3238. };
  3239. /***/ }),
  3240. /* 96 */
  3241. /***/ ((module) => {
  3242. module.exports = function (value, done) {
  3243. return {
  3244. value: value,
  3245. done: done
  3246. };
  3247. };
  3248. /***/ }),
  3249. /* 97 */
  3250. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3251. var TO_STRING_TAG_SUPPORT = __w_pdfjs_require__(84);
  3252. var defineBuiltIn = __w_pdfjs_require__(52);
  3253. var toString = __w_pdfjs_require__(98);
  3254. if (!TO_STRING_TAG_SUPPORT) {
  3255. defineBuiltIn(Object.prototype, 'toString', toString, { unsafe: true });
  3256. }
  3257. /***/ }),
  3258. /* 98 */
  3259. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3260. "use strict";
  3261. var TO_STRING_TAG_SUPPORT = __w_pdfjs_require__(84);
  3262. var classof = __w_pdfjs_require__(83);
  3263. module.exports = TO_STRING_TAG_SUPPORT ? {}.toString : function toString() {
  3264. return '[object ' + classof(this) + ']';
  3265. };
  3266. /***/ }),
  3267. /* 99 */
  3268. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3269. __w_pdfjs_require__(100);
  3270. /***/ }),
  3271. /* 100 */
  3272. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3273. "use strict";
  3274. var collection = __w_pdfjs_require__(101);
  3275. var collectionStrong = __w_pdfjs_require__(119);
  3276. collection('Map', function (init) {
  3277. return function Map() {
  3278. return init(this, arguments.length ? arguments[0] : undefined);
  3279. };
  3280. }, collectionStrong);
  3281. /***/ }),
  3282. /* 101 */
  3283. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3284. "use strict";
  3285. var $ = __w_pdfjs_require__(7);
  3286. var global = __w_pdfjs_require__(8);
  3287. var uncurryThis = __w_pdfjs_require__(18);
  3288. var isForced = __w_pdfjs_require__(72);
  3289. var defineBuiltIn = __w_pdfjs_require__(52);
  3290. var InternalMetadataModule = __w_pdfjs_require__(102);
  3291. var iterate = __w_pdfjs_require__(109);
  3292. var anInstance = __w_pdfjs_require__(116);
  3293. var isCallable = __w_pdfjs_require__(25);
  3294. var isNullOrUndefined = __w_pdfjs_require__(21);
  3295. var isObject = __w_pdfjs_require__(24);
  3296. var fails = __w_pdfjs_require__(11);
  3297. var checkCorrectnessOfIteration = __w_pdfjs_require__(117);
  3298. var setToStringTag = __w_pdfjs_require__(95);
  3299. var inheritIfRequired = __w_pdfjs_require__(118);
  3300. module.exports = function (CONSTRUCTOR_NAME, wrapper, common) {
  3301. var IS_MAP = CONSTRUCTOR_NAME.indexOf('Map') !== -1;
  3302. var IS_WEAK = CONSTRUCTOR_NAME.indexOf('Weak') !== -1;
  3303. var ADDER = IS_MAP ? 'set' : 'add';
  3304. var NativeConstructor = global[CONSTRUCTOR_NAME];
  3305. var NativePrototype = NativeConstructor && NativeConstructor.prototype;
  3306. var Constructor = NativeConstructor;
  3307. var exported = {};
  3308. var fixMethod = function (KEY) {
  3309. var uncurriedNativeMethod = uncurryThis(NativePrototype[KEY]);
  3310. defineBuiltIn(NativePrototype, KEY, KEY == 'add' ? function add(value) {
  3311. uncurriedNativeMethod(this, value === 0 ? 0 : value);
  3312. return this;
  3313. } : KEY == 'delete' ? function (key) {
  3314. return IS_WEAK && !isObject(key) ? false : uncurriedNativeMethod(this, key === 0 ? 0 : key);
  3315. } : KEY == 'get' ? function get(key) {
  3316. return IS_WEAK && !isObject(key) ? undefined : uncurriedNativeMethod(this, key === 0 ? 0 : key);
  3317. } : KEY == 'has' ? function has(key) {
  3318. return IS_WEAK && !isObject(key) ? false : uncurriedNativeMethod(this, key === 0 ? 0 : key);
  3319. } : function set(key, value) {
  3320. uncurriedNativeMethod(this, key === 0 ? 0 : key, value);
  3321. return this;
  3322. });
  3323. };
  3324. var REPLACE = isForced(CONSTRUCTOR_NAME, !isCallable(NativeConstructor) || !(IS_WEAK || NativePrototype.forEach && !fails(function () {
  3325. new NativeConstructor().entries().next();
  3326. })));
  3327. if (REPLACE) {
  3328. Constructor = common.getConstructor(wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER);
  3329. InternalMetadataModule.enable();
  3330. } else if (isForced(CONSTRUCTOR_NAME, true)) {
  3331. var instance = new Constructor();
  3332. var HASNT_CHAINING = instance[ADDER](IS_WEAK ? {} : -0, 1) != instance;
  3333. var THROWS_ON_PRIMITIVES = fails(function () {
  3334. instance.has(1);
  3335. });
  3336. var ACCEPT_ITERABLES = checkCorrectnessOfIteration(function (iterable) {
  3337. new NativeConstructor(iterable);
  3338. });
  3339. var BUGGY_ZERO = !IS_WEAK && fails(function () {
  3340. var $instance = new NativeConstructor();
  3341. var index = 5;
  3342. while (index--)
  3343. $instance[ADDER](index, index);
  3344. return !$instance.has(-0);
  3345. });
  3346. if (!ACCEPT_ITERABLES) {
  3347. Constructor = wrapper(function (dummy, iterable) {
  3348. anInstance(dummy, NativePrototype);
  3349. var that = inheritIfRequired(new NativeConstructor(), dummy, Constructor);
  3350. if (!isNullOrUndefined(iterable))
  3351. iterate(iterable, that[ADDER], {
  3352. that: that,
  3353. AS_ENTRIES: IS_MAP
  3354. });
  3355. return that;
  3356. });
  3357. Constructor.prototype = NativePrototype;
  3358. NativePrototype.constructor = Constructor;
  3359. }
  3360. if (THROWS_ON_PRIMITIVES || BUGGY_ZERO) {
  3361. fixMethod('delete');
  3362. fixMethod('has');
  3363. IS_MAP && fixMethod('get');
  3364. }
  3365. if (BUGGY_ZERO || HASNT_CHAINING)
  3366. fixMethod(ADDER);
  3367. if (IS_WEAK && NativePrototype.clear)
  3368. delete NativePrototype.clear;
  3369. }
  3370. exported[CONSTRUCTOR_NAME] = Constructor;
  3371. $({
  3372. global: true,
  3373. constructor: true,
  3374. forced: Constructor != NativeConstructor
  3375. }, exported);
  3376. setToStringTag(Constructor, CONSTRUCTOR_NAME);
  3377. if (!IS_WEAK)
  3378. common.setStrong(Constructor, CONSTRUCTOR_NAME, IS_MAP);
  3379. return Constructor;
  3380. };
  3381. /***/ }),
  3382. /* 102 */
  3383. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3384. var $ = __w_pdfjs_require__(7);
  3385. var uncurryThis = __w_pdfjs_require__(18);
  3386. var hiddenKeys = __w_pdfjs_require__(59);
  3387. var isObject = __w_pdfjs_require__(24);
  3388. var hasOwn = __w_pdfjs_require__(43);
  3389. var defineProperty = (__w_pdfjs_require__(49).f);
  3390. var getOwnPropertyNamesModule = __w_pdfjs_require__(62);
  3391. var getOwnPropertyNamesExternalModule = __w_pdfjs_require__(103);
  3392. var isExtensible = __w_pdfjs_require__(106);
  3393. var uid = __w_pdfjs_require__(45);
  3394. var FREEZING = __w_pdfjs_require__(108);
  3395. var REQUIRED = false;
  3396. var METADATA = uid('meta');
  3397. var id = 0;
  3398. var setMetadata = function (it) {
  3399. defineProperty(it, METADATA, {
  3400. value: {
  3401. objectID: 'O' + id++,
  3402. weakData: {}
  3403. }
  3404. });
  3405. };
  3406. var fastKey = function (it, create) {
  3407. if (!isObject(it))
  3408. return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
  3409. if (!hasOwn(it, METADATA)) {
  3410. if (!isExtensible(it))
  3411. return 'F';
  3412. if (!create)
  3413. return 'E';
  3414. setMetadata(it);
  3415. }
  3416. return it[METADATA].objectID;
  3417. };
  3418. var getWeakData = function (it, create) {
  3419. if (!hasOwn(it, METADATA)) {
  3420. if (!isExtensible(it))
  3421. return true;
  3422. if (!create)
  3423. return false;
  3424. setMetadata(it);
  3425. }
  3426. return it[METADATA].weakData;
  3427. };
  3428. var onFreeze = function (it) {
  3429. if (FREEZING && REQUIRED && isExtensible(it) && !hasOwn(it, METADATA))
  3430. setMetadata(it);
  3431. return it;
  3432. };
  3433. var enable = function () {
  3434. meta.enable = function () {
  3435. };
  3436. REQUIRED = true;
  3437. var getOwnPropertyNames = getOwnPropertyNamesModule.f;
  3438. var splice = uncurryThis([].splice);
  3439. var test = {};
  3440. test[METADATA] = 1;
  3441. if (getOwnPropertyNames(test).length) {
  3442. getOwnPropertyNamesModule.f = function (it) {
  3443. var result = getOwnPropertyNames(it);
  3444. for (var i = 0, length = result.length; i < length; i++) {
  3445. if (result[i] === METADATA) {
  3446. splice(result, i, 1);
  3447. break;
  3448. }
  3449. }
  3450. return result;
  3451. };
  3452. $({
  3453. target: 'Object',
  3454. stat: true,
  3455. forced: true
  3456. }, { getOwnPropertyNames: getOwnPropertyNamesExternalModule.f });
  3457. }
  3458. };
  3459. var meta = module.exports = {
  3460. enable: enable,
  3461. fastKey: fastKey,
  3462. getWeakData: getWeakData,
  3463. onFreeze: onFreeze
  3464. };
  3465. hiddenKeys[METADATA] = true;
  3466. /***/ }),
  3467. /* 103 */
  3468. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3469. var classof = __w_pdfjs_require__(19);
  3470. var toIndexedObject = __w_pdfjs_require__(16);
  3471. var $getOwnPropertyNames = (__w_pdfjs_require__(62).f);
  3472. var arraySlice = __w_pdfjs_require__(104);
  3473. var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames ? Object.getOwnPropertyNames(window) : [];
  3474. var getWindowNames = function (it) {
  3475. try {
  3476. return $getOwnPropertyNames(it);
  3477. } catch (error) {
  3478. return arraySlice(windowNames);
  3479. }
  3480. };
  3481. module.exports.f = function getOwnPropertyNames(it) {
  3482. return windowNames && classof(it) == 'Window' ? getWindowNames(it) : $getOwnPropertyNames(toIndexedObject(it));
  3483. };
  3484. /***/ }),
  3485. /* 104 */
  3486. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3487. var toAbsoluteIndex = __w_pdfjs_require__(65);
  3488. var lengthOfArrayLike = __w_pdfjs_require__(68);
  3489. var createProperty = __w_pdfjs_require__(105);
  3490. var $Array = Array;
  3491. var max = Math.max;
  3492. module.exports = function (O, start, end) {
  3493. var length = lengthOfArrayLike(O);
  3494. var k = toAbsoluteIndex(start, length);
  3495. var fin = toAbsoluteIndex(end === undefined ? length : end, length);
  3496. var result = $Array(max(fin - k, 0));
  3497. for (var n = 0; k < fin; k++, n++)
  3498. createProperty(result, n, O[k]);
  3499. result.length = n;
  3500. return result;
  3501. };
  3502. /***/ }),
  3503. /* 105 */
  3504. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3505. "use strict";
  3506. var toPropertyKey = __w_pdfjs_require__(22);
  3507. var definePropertyModule = __w_pdfjs_require__(49);
  3508. var createPropertyDescriptor = __w_pdfjs_require__(15);
  3509. module.exports = function (object, key, value) {
  3510. var propertyKey = toPropertyKey(key);
  3511. if (propertyKey in object)
  3512. definePropertyModule.f(object, propertyKey, createPropertyDescriptor(0, value));
  3513. else
  3514. object[propertyKey] = value;
  3515. };
  3516. /***/ }),
  3517. /* 106 */
  3518. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3519. var fails = __w_pdfjs_require__(11);
  3520. var isObject = __w_pdfjs_require__(24);
  3521. var classof = __w_pdfjs_require__(19);
  3522. var ARRAY_BUFFER_NON_EXTENSIBLE = __w_pdfjs_require__(107);
  3523. var $isExtensible = Object.isExtensible;
  3524. var FAILS_ON_PRIMITIVES = fails(function () {
  3525. $isExtensible(1);
  3526. });
  3527. module.exports = FAILS_ON_PRIMITIVES || ARRAY_BUFFER_NON_EXTENSIBLE ? function isExtensible(it) {
  3528. if (!isObject(it))
  3529. return false;
  3530. if (ARRAY_BUFFER_NON_EXTENSIBLE && classof(it) == 'ArrayBuffer')
  3531. return false;
  3532. return $isExtensible ? $isExtensible(it) : true;
  3533. } : $isExtensible;
  3534. /***/ }),
  3535. /* 107 */
  3536. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3537. var fails = __w_pdfjs_require__(11);
  3538. module.exports = fails(function () {
  3539. if (typeof ArrayBuffer == 'function') {
  3540. var buffer = new ArrayBuffer(8);
  3541. if (Object.isExtensible(buffer))
  3542. Object.defineProperty(buffer, 'a', { value: 8 });
  3543. }
  3544. });
  3545. /***/ }),
  3546. /* 108 */
  3547. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3548. var fails = __w_pdfjs_require__(11);
  3549. module.exports = !fails(function () {
  3550. return Object.isExtensible(Object.preventExtensions({}));
  3551. });
  3552. /***/ }),
  3553. /* 109 */
  3554. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3555. var bind = __w_pdfjs_require__(110);
  3556. var call = __w_pdfjs_require__(12);
  3557. var anObject = __w_pdfjs_require__(51);
  3558. var tryToString = __w_pdfjs_require__(36);
  3559. var isArrayIteratorMethod = __w_pdfjs_require__(112);
  3560. var lengthOfArrayLike = __w_pdfjs_require__(68);
  3561. var isPrototypeOf = __w_pdfjs_require__(29);
  3562. var getIterator = __w_pdfjs_require__(113);
  3563. var getIteratorMethod = __w_pdfjs_require__(114);
  3564. var iteratorClose = __w_pdfjs_require__(115);
  3565. var $TypeError = TypeError;
  3566. var Result = function (stopped, result) {
  3567. this.stopped = stopped;
  3568. this.result = result;
  3569. };
  3570. var ResultPrototype = Result.prototype;
  3571. module.exports = function (iterable, unboundFunction, options) {
  3572. var that = options && options.that;
  3573. var AS_ENTRIES = !!(options && options.AS_ENTRIES);
  3574. var IS_RECORD = !!(options && options.IS_RECORD);
  3575. var IS_ITERATOR = !!(options && options.IS_ITERATOR);
  3576. var INTERRUPTED = !!(options && options.INTERRUPTED);
  3577. var fn = bind(unboundFunction, that);
  3578. var iterator, iterFn, index, length, result, next, step;
  3579. var stop = function (condition) {
  3580. if (iterator)
  3581. iteratorClose(iterator, 'normal', condition);
  3582. return new Result(true, condition);
  3583. };
  3584. var callFn = function (value) {
  3585. if (AS_ENTRIES) {
  3586. anObject(value);
  3587. return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
  3588. }
  3589. return INTERRUPTED ? fn(value, stop) : fn(value);
  3590. };
  3591. if (IS_RECORD) {
  3592. iterator = iterable.iterator;
  3593. } else if (IS_ITERATOR) {
  3594. iterator = iterable;
  3595. } else {
  3596. iterFn = getIteratorMethod(iterable);
  3597. if (!iterFn)
  3598. throw $TypeError(tryToString(iterable) + ' is not iterable');
  3599. if (isArrayIteratorMethod(iterFn)) {
  3600. for (index = 0, length = lengthOfArrayLike(iterable); length > index; index++) {
  3601. result = callFn(iterable[index]);
  3602. if (result && isPrototypeOf(ResultPrototype, result))
  3603. return result;
  3604. }
  3605. return new Result(false);
  3606. }
  3607. iterator = getIterator(iterable, iterFn);
  3608. }
  3609. next = IS_RECORD ? iterable.next : iterator.next;
  3610. while (!(step = call(next, iterator)).done) {
  3611. try {
  3612. result = callFn(step.value);
  3613. } catch (error) {
  3614. iteratorClose(iterator, 'throw', error);
  3615. }
  3616. if (typeof result == 'object' && result && isPrototypeOf(ResultPrototype, result))
  3617. return result;
  3618. }
  3619. return new Result(false);
  3620. };
  3621. /***/ }),
  3622. /* 110 */
  3623. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3624. var uncurryThis = __w_pdfjs_require__(111);
  3625. var aCallable = __w_pdfjs_require__(35);
  3626. var NATIVE_BIND = __w_pdfjs_require__(13);
  3627. var bind = uncurryThis(uncurryThis.bind);
  3628. module.exports = function (fn, that) {
  3629. aCallable(fn);
  3630. return that === undefined ? fn : NATIVE_BIND ? bind(fn, that) : function () {
  3631. return fn.apply(that, arguments);
  3632. };
  3633. };
  3634. /***/ }),
  3635. /* 111 */
  3636. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3637. var classofRaw = __w_pdfjs_require__(19);
  3638. var uncurryThis = __w_pdfjs_require__(18);
  3639. module.exports = function (fn) {
  3640. if (classofRaw(fn) === 'Function')
  3641. return uncurryThis(fn);
  3642. };
  3643. /***/ }),
  3644. /* 112 */
  3645. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3646. var wellKnownSymbol = __w_pdfjs_require__(38);
  3647. var Iterators = __w_pdfjs_require__(91);
  3648. var ITERATOR = wellKnownSymbol('iterator');
  3649. var ArrayPrototype = Array.prototype;
  3650. module.exports = function (it) {
  3651. return it !== undefined && (Iterators.Array === it || ArrayPrototype[ITERATOR] === it);
  3652. };
  3653. /***/ }),
  3654. /* 113 */
  3655. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3656. var call = __w_pdfjs_require__(12);
  3657. var aCallable = __w_pdfjs_require__(35);
  3658. var anObject = __w_pdfjs_require__(51);
  3659. var tryToString = __w_pdfjs_require__(36);
  3660. var getIteratorMethod = __w_pdfjs_require__(114);
  3661. var $TypeError = TypeError;
  3662. module.exports = function (argument, usingIterator) {
  3663. var iteratorMethod = arguments.length < 2 ? getIteratorMethod(argument) : usingIterator;
  3664. if (aCallable(iteratorMethod))
  3665. return anObject(call(iteratorMethod, argument));
  3666. throw $TypeError(tryToString(argument) + ' is not iterable');
  3667. };
  3668. /***/ }),
  3669. /* 114 */
  3670. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3671. var classof = __w_pdfjs_require__(83);
  3672. var getMethod = __w_pdfjs_require__(34);
  3673. var isNullOrUndefined = __w_pdfjs_require__(21);
  3674. var Iterators = __w_pdfjs_require__(91);
  3675. var wellKnownSymbol = __w_pdfjs_require__(38);
  3676. var ITERATOR = wellKnownSymbol('iterator');
  3677. module.exports = function (it) {
  3678. if (!isNullOrUndefined(it))
  3679. return getMethod(it, ITERATOR) || getMethod(it, '@@iterator') || Iterators[classof(it)];
  3680. };
  3681. /***/ }),
  3682. /* 115 */
  3683. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3684. var call = __w_pdfjs_require__(12);
  3685. var anObject = __w_pdfjs_require__(51);
  3686. var getMethod = __w_pdfjs_require__(34);
  3687. module.exports = function (iterator, kind, value) {
  3688. var innerResult, innerError;
  3689. anObject(iterator);
  3690. try {
  3691. innerResult = getMethod(iterator, 'return');
  3692. if (!innerResult) {
  3693. if (kind === 'throw')
  3694. throw value;
  3695. return value;
  3696. }
  3697. innerResult = call(innerResult, iterator);
  3698. } catch (error) {
  3699. innerError = true;
  3700. innerResult = error;
  3701. }
  3702. if (kind === 'throw')
  3703. throw value;
  3704. if (innerError)
  3705. throw innerResult;
  3706. anObject(innerResult);
  3707. return value;
  3708. };
  3709. /***/ }),
  3710. /* 116 */
  3711. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3712. var isPrototypeOf = __w_pdfjs_require__(29);
  3713. var $TypeError = TypeError;
  3714. module.exports = function (it, Prototype) {
  3715. if (isPrototypeOf(Prototype, it))
  3716. return it;
  3717. throw $TypeError('Incorrect invocation');
  3718. };
  3719. /***/ }),
  3720. /* 117 */
  3721. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3722. var wellKnownSymbol = __w_pdfjs_require__(38);
  3723. var ITERATOR = wellKnownSymbol('iterator');
  3724. var SAFE_CLOSING = false;
  3725. try {
  3726. var called = 0;
  3727. var iteratorWithReturn = {
  3728. next: function () {
  3729. return { done: !!called++ };
  3730. },
  3731. 'return': function () {
  3732. SAFE_CLOSING = true;
  3733. }
  3734. };
  3735. iteratorWithReturn[ITERATOR] = function () {
  3736. return this;
  3737. };
  3738. Array.from(iteratorWithReturn, function () {
  3739. throw 2;
  3740. });
  3741. } catch (error) {
  3742. }
  3743. module.exports = function (exec, SKIP_CLOSING) {
  3744. if (!SKIP_CLOSING && !SAFE_CLOSING)
  3745. return false;
  3746. var ITERATION_SUPPORT = false;
  3747. try {
  3748. var object = {};
  3749. object[ITERATOR] = function () {
  3750. return {
  3751. next: function () {
  3752. return { done: ITERATION_SUPPORT = true };
  3753. }
  3754. };
  3755. };
  3756. exec(object);
  3757. } catch (error) {
  3758. }
  3759. return ITERATION_SUPPORT;
  3760. };
  3761. /***/ }),
  3762. /* 118 */
  3763. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3764. var isCallable = __w_pdfjs_require__(25);
  3765. var isObject = __w_pdfjs_require__(24);
  3766. var setPrototypeOf = __w_pdfjs_require__(87);
  3767. module.exports = function ($this, dummy, Wrapper) {
  3768. var NewTarget, NewTargetPrototype;
  3769. if (setPrototypeOf && isCallable(NewTarget = dummy.constructor) && NewTarget !== Wrapper && isObject(NewTargetPrototype = NewTarget.prototype) && NewTargetPrototype !== Wrapper.prototype)
  3770. setPrototypeOf($this, NewTargetPrototype);
  3771. return $this;
  3772. };
  3773. /***/ }),
  3774. /* 119 */
  3775. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3776. "use strict";
  3777. var defineProperty = (__w_pdfjs_require__(49).f);
  3778. var create = __w_pdfjs_require__(74);
  3779. var defineBuiltIns = __w_pdfjs_require__(120);
  3780. var bind = __w_pdfjs_require__(110);
  3781. var anInstance = __w_pdfjs_require__(116);
  3782. var isNullOrUndefined = __w_pdfjs_require__(21);
  3783. var iterate = __w_pdfjs_require__(109);
  3784. var defineIterator = __w_pdfjs_require__(92);
  3785. var createIterResultObject = __w_pdfjs_require__(96);
  3786. var setSpecies = __w_pdfjs_require__(121);
  3787. var DESCRIPTORS = __w_pdfjs_require__(10);
  3788. var fastKey = (__w_pdfjs_require__(102).fastKey);
  3789. var InternalStateModule = __w_pdfjs_require__(56);
  3790. var setInternalState = InternalStateModule.set;
  3791. var internalStateGetterFor = InternalStateModule.getterFor;
  3792. module.exports = {
  3793. getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) {
  3794. var Constructor = wrapper(function (that, iterable) {
  3795. anInstance(that, Prototype);
  3796. setInternalState(that, {
  3797. type: CONSTRUCTOR_NAME,
  3798. index: create(null),
  3799. first: undefined,
  3800. last: undefined,
  3801. size: 0
  3802. });
  3803. if (!DESCRIPTORS)
  3804. that.size = 0;
  3805. if (!isNullOrUndefined(iterable))
  3806. iterate(iterable, that[ADDER], {
  3807. that: that,
  3808. AS_ENTRIES: IS_MAP
  3809. });
  3810. });
  3811. var Prototype = Constructor.prototype;
  3812. var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME);
  3813. var define = function (that, key, value) {
  3814. var state = getInternalState(that);
  3815. var entry = getEntry(that, key);
  3816. var previous, index;
  3817. if (entry) {
  3818. entry.value = value;
  3819. } else {
  3820. state.last = entry = {
  3821. index: index = fastKey(key, true),
  3822. key: key,
  3823. value: value,
  3824. previous: previous = state.last,
  3825. next: undefined,
  3826. removed: false
  3827. };
  3828. if (!state.first)
  3829. state.first = entry;
  3830. if (previous)
  3831. previous.next = entry;
  3832. if (DESCRIPTORS)
  3833. state.size++;
  3834. else
  3835. that.size++;
  3836. if (index !== 'F')
  3837. state.index[index] = entry;
  3838. }
  3839. return that;
  3840. };
  3841. var getEntry = function (that, key) {
  3842. var state = getInternalState(that);
  3843. var index = fastKey(key);
  3844. var entry;
  3845. if (index !== 'F')
  3846. return state.index[index];
  3847. for (entry = state.first; entry; entry = entry.next) {
  3848. if (entry.key == key)
  3849. return entry;
  3850. }
  3851. };
  3852. defineBuiltIns(Prototype, {
  3853. clear: function clear() {
  3854. var that = this;
  3855. var state = getInternalState(that);
  3856. var data = state.index;
  3857. var entry = state.first;
  3858. while (entry) {
  3859. entry.removed = true;
  3860. if (entry.previous)
  3861. entry.previous = entry.previous.next = undefined;
  3862. delete data[entry.index];
  3863. entry = entry.next;
  3864. }
  3865. state.first = state.last = undefined;
  3866. if (DESCRIPTORS)
  3867. state.size = 0;
  3868. else
  3869. that.size = 0;
  3870. },
  3871. 'delete': function (key) {
  3872. var that = this;
  3873. var state = getInternalState(that);
  3874. var entry = getEntry(that, key);
  3875. if (entry) {
  3876. var next = entry.next;
  3877. var prev = entry.previous;
  3878. delete state.index[entry.index];
  3879. entry.removed = true;
  3880. if (prev)
  3881. prev.next = next;
  3882. if (next)
  3883. next.previous = prev;
  3884. if (state.first == entry)
  3885. state.first = next;
  3886. if (state.last == entry)
  3887. state.last = prev;
  3888. if (DESCRIPTORS)
  3889. state.size--;
  3890. else
  3891. that.size--;
  3892. }
  3893. return !!entry;
  3894. },
  3895. forEach: function forEach(callbackfn) {
  3896. var state = getInternalState(this);
  3897. var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  3898. var entry;
  3899. while (entry = entry ? entry.next : state.first) {
  3900. boundFunction(entry.value, entry.key, this);
  3901. while (entry && entry.removed)
  3902. entry = entry.previous;
  3903. }
  3904. },
  3905. has: function has(key) {
  3906. return !!getEntry(this, key);
  3907. }
  3908. });
  3909. defineBuiltIns(Prototype, IS_MAP ? {
  3910. get: function get(key) {
  3911. var entry = getEntry(this, key);
  3912. return entry && entry.value;
  3913. },
  3914. set: function set(key, value) {
  3915. return define(this, key === 0 ? 0 : key, value);
  3916. }
  3917. } : {
  3918. add: function add(value) {
  3919. return define(this, value = value === 0 ? 0 : value, value);
  3920. }
  3921. });
  3922. if (DESCRIPTORS)
  3923. defineProperty(Prototype, 'size', {
  3924. get: function () {
  3925. return getInternalState(this).size;
  3926. }
  3927. });
  3928. return Constructor;
  3929. },
  3930. setStrong: function (Constructor, CONSTRUCTOR_NAME, IS_MAP) {
  3931. var ITERATOR_NAME = CONSTRUCTOR_NAME + ' Iterator';
  3932. var getInternalCollectionState = internalStateGetterFor(CONSTRUCTOR_NAME);
  3933. var getInternalIteratorState = internalStateGetterFor(ITERATOR_NAME);
  3934. defineIterator(Constructor, CONSTRUCTOR_NAME, function (iterated, kind) {
  3935. setInternalState(this, {
  3936. type: ITERATOR_NAME,
  3937. target: iterated,
  3938. state: getInternalCollectionState(iterated),
  3939. kind: kind,
  3940. last: undefined
  3941. });
  3942. }, function () {
  3943. var state = getInternalIteratorState(this);
  3944. var kind = state.kind;
  3945. var entry = state.last;
  3946. while (entry && entry.removed)
  3947. entry = entry.previous;
  3948. if (!state.target || !(state.last = entry = entry ? entry.next : state.state.first)) {
  3949. state.target = undefined;
  3950. return createIterResultObject(undefined, true);
  3951. }
  3952. if (kind == 'keys')
  3953. return createIterResultObject(entry.key, false);
  3954. if (kind == 'values')
  3955. return createIterResultObject(entry.value, false);
  3956. return createIterResultObject([
  3957. entry.key,
  3958. entry.value
  3959. ], false);
  3960. }, IS_MAP ? 'entries' : 'values', !IS_MAP, true);
  3961. setSpecies(CONSTRUCTOR_NAME);
  3962. }
  3963. };
  3964. /***/ }),
  3965. /* 120 */
  3966. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3967. var defineBuiltIn = __w_pdfjs_require__(52);
  3968. module.exports = function (target, src, options) {
  3969. for (var key in src)
  3970. defineBuiltIn(target, key, src[key], options);
  3971. return target;
  3972. };
  3973. /***/ }),
  3974. /* 121 */
  3975. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3976. "use strict";
  3977. var getBuiltIn = __w_pdfjs_require__(28);
  3978. var definePropertyModule = __w_pdfjs_require__(49);
  3979. var wellKnownSymbol = __w_pdfjs_require__(38);
  3980. var DESCRIPTORS = __w_pdfjs_require__(10);
  3981. var SPECIES = wellKnownSymbol('species');
  3982. module.exports = function (CONSTRUCTOR_NAME) {
  3983. var Constructor = getBuiltIn(CONSTRUCTOR_NAME);
  3984. var defineProperty = definePropertyModule.f;
  3985. if (DESCRIPTORS && Constructor && !Constructor[SPECIES]) {
  3986. defineProperty(Constructor, SPECIES, {
  3987. configurable: true,
  3988. get: function () {
  3989. return this;
  3990. }
  3991. });
  3992. }
  3993. };
  3994. /***/ }),
  3995. /* 122 */
  3996. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3997. __w_pdfjs_require__(123);
  3998. /***/ }),
  3999. /* 123 */
  4000. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  4001. "use strict";
  4002. var collection = __w_pdfjs_require__(101);
  4003. var collectionStrong = __w_pdfjs_require__(119);
  4004. collection('Set', function (init) {
  4005. return function Set() {
  4006. return init(this, arguments.length ? arguments[0] : undefined);
  4007. };
  4008. }, collectionStrong);
  4009. /***/ }),
  4010. /* 124 */
  4011. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  4012. var IS_PURE = __w_pdfjs_require__(40);
  4013. var $ = __w_pdfjs_require__(7);
  4014. var global = __w_pdfjs_require__(8);
  4015. var getBuiltin = __w_pdfjs_require__(28);
  4016. var uncurryThis = __w_pdfjs_require__(18);
  4017. var fails = __w_pdfjs_require__(11);
  4018. var uid = __w_pdfjs_require__(45);
  4019. var isCallable = __w_pdfjs_require__(25);
  4020. var isConstructor = __w_pdfjs_require__(125);
  4021. var isNullOrUndefined = __w_pdfjs_require__(21);
  4022. var isObject = __w_pdfjs_require__(24);
  4023. var isSymbol = __w_pdfjs_require__(27);
  4024. var iterate = __w_pdfjs_require__(109);
  4025. var anObject = __w_pdfjs_require__(51);
  4026. var classof = __w_pdfjs_require__(83);
  4027. var hasOwn = __w_pdfjs_require__(43);
  4028. var createProperty = __w_pdfjs_require__(105);
  4029. var createNonEnumerableProperty = __w_pdfjs_require__(48);
  4030. var lengthOfArrayLike = __w_pdfjs_require__(68);
  4031. var validateArgumentsLength = __w_pdfjs_require__(126);
  4032. var getRegExpFlags = __w_pdfjs_require__(127);
  4033. var ERROR_STACK_INSTALLABLE = __w_pdfjs_require__(129);
  4034. var V8 = __w_pdfjs_require__(32);
  4035. var IS_BROWSER = __w_pdfjs_require__(130);
  4036. var IS_DENO = __w_pdfjs_require__(131);
  4037. var IS_NODE = __w_pdfjs_require__(132);
  4038. var Object = global.Object;
  4039. var Date = global.Date;
  4040. var Error = global.Error;
  4041. var EvalError = global.EvalError;
  4042. var RangeError = global.RangeError;
  4043. var ReferenceError = global.ReferenceError;
  4044. var SyntaxError = global.SyntaxError;
  4045. var TypeError = global.TypeError;
  4046. var URIError = global.URIError;
  4047. var PerformanceMark = global.PerformanceMark;
  4048. var WebAssembly = global.WebAssembly;
  4049. var CompileError = WebAssembly && WebAssembly.CompileError || Error;
  4050. var LinkError = WebAssembly && WebAssembly.LinkError || Error;
  4051. var RuntimeError = WebAssembly && WebAssembly.RuntimeError || Error;
  4052. var DOMException = getBuiltin('DOMException');
  4053. var Set = getBuiltin('Set');
  4054. var Map = getBuiltin('Map');
  4055. var MapPrototype = Map.prototype;
  4056. var mapHas = uncurryThis(MapPrototype.has);
  4057. var mapGet = uncurryThis(MapPrototype.get);
  4058. var mapSet = uncurryThis(MapPrototype.set);
  4059. var setAdd = uncurryThis(Set.prototype.add);
  4060. var objectKeys = getBuiltin('Object', 'keys');
  4061. var push = uncurryThis([].push);
  4062. var thisBooleanValue = uncurryThis(true.valueOf);
  4063. var thisNumberValue = uncurryThis(1.0.valueOf);
  4064. var thisStringValue = uncurryThis(''.valueOf);
  4065. var thisTimeValue = uncurryThis(Date.prototype.getTime);
  4066. var PERFORMANCE_MARK = uid('structuredClone');
  4067. var DATA_CLONE_ERROR = 'DataCloneError';
  4068. var TRANSFERRING = 'Transferring';
  4069. var checkBasicSemantic = function (structuredCloneImplementation) {
  4070. return !fails(function () {
  4071. var set1 = new global.Set([7]);
  4072. var set2 = structuredCloneImplementation(set1);
  4073. var number = structuredCloneImplementation(Object(7));
  4074. return set2 == set1 || !set2.has(7) || typeof number != 'object' || number != 7;
  4075. }) && structuredCloneImplementation;
  4076. };
  4077. var checkErrorsCloning = function (structuredCloneImplementation, $Error) {
  4078. return !fails(function () {
  4079. var error = new $Error();
  4080. var test = structuredCloneImplementation({
  4081. a: error,
  4082. b: error
  4083. });
  4084. return !(test && test.a === test.b && test.a instanceof $Error && test.a.stack === error.stack);
  4085. });
  4086. };
  4087. var checkNewErrorsCloningSemantic = function (structuredCloneImplementation) {
  4088. return !fails(function () {
  4089. var test = structuredCloneImplementation(new global.AggregateError([1], PERFORMANCE_MARK, { cause: 3 }));
  4090. return test.name != 'AggregateError' || test.errors[0] != 1 || test.message != PERFORMANCE_MARK || test.cause != 3;
  4091. });
  4092. };
  4093. var nativeStructuredClone = global.structuredClone;
  4094. var FORCED_REPLACEMENT = IS_PURE || !checkErrorsCloning(nativeStructuredClone, Error) || !checkErrorsCloning(nativeStructuredClone, DOMException) || !checkNewErrorsCloningSemantic(nativeStructuredClone);
  4095. var structuredCloneFromMark = !nativeStructuredClone && checkBasicSemantic(function (value) {
  4096. return new PerformanceMark(PERFORMANCE_MARK, { detail: value }).detail;
  4097. });
  4098. var nativeRestrictedStructuredClone = checkBasicSemantic(nativeStructuredClone) || structuredCloneFromMark;
  4099. var throwUncloneable = function (type) {
  4100. throw new DOMException('Uncloneable type: ' + type, DATA_CLONE_ERROR);
  4101. };
  4102. var throwUnpolyfillable = function (type, action) {
  4103. throw new DOMException((action || 'Cloning') + ' of ' + type + ' cannot be properly polyfilled in this engine', DATA_CLONE_ERROR);
  4104. };
  4105. var createDataTransfer = function () {
  4106. var dataTransfer;
  4107. try {
  4108. dataTransfer = new global.DataTransfer();
  4109. } catch (error) {
  4110. try {
  4111. dataTransfer = new global.ClipboardEvent('').clipboardData;
  4112. } catch (error2) {
  4113. }
  4114. }
  4115. return dataTransfer && dataTransfer.items && dataTransfer.files ? dataTransfer : null;
  4116. };
  4117. var structuredCloneInternal = function (value, map) {
  4118. if (isSymbol(value))
  4119. throwUncloneable('Symbol');
  4120. if (!isObject(value))
  4121. return value;
  4122. if (map) {
  4123. if (mapHas(map, value))
  4124. return mapGet(map, value);
  4125. } else
  4126. map = new Map();
  4127. var type = classof(value);
  4128. var deep = false;
  4129. var C, name, cloned, dataTransfer, i, length, keys, key, source, target;
  4130. switch (type) {
  4131. case 'Array':
  4132. cloned = [];
  4133. deep = true;
  4134. break;
  4135. case 'Object':
  4136. cloned = {};
  4137. deep = true;
  4138. break;
  4139. case 'Map':
  4140. cloned = new Map();
  4141. deep = true;
  4142. break;
  4143. case 'Set':
  4144. cloned = new Set();
  4145. deep = true;
  4146. break;
  4147. case 'RegExp':
  4148. cloned = new RegExp(value.source, getRegExpFlags(value));
  4149. break;
  4150. case 'Error':
  4151. name = value.name;
  4152. switch (name) {
  4153. case 'AggregateError':
  4154. cloned = getBuiltin('AggregateError')([]);
  4155. break;
  4156. case 'EvalError':
  4157. cloned = EvalError();
  4158. break;
  4159. case 'RangeError':
  4160. cloned = RangeError();
  4161. break;
  4162. case 'ReferenceError':
  4163. cloned = ReferenceError();
  4164. break;
  4165. case 'SyntaxError':
  4166. cloned = SyntaxError();
  4167. break;
  4168. case 'TypeError':
  4169. cloned = TypeError();
  4170. break;
  4171. case 'URIError':
  4172. cloned = URIError();
  4173. break;
  4174. case 'CompileError':
  4175. cloned = CompileError();
  4176. break;
  4177. case 'LinkError':
  4178. cloned = LinkError();
  4179. break;
  4180. case 'RuntimeError':
  4181. cloned = RuntimeError();
  4182. break;
  4183. default:
  4184. cloned = Error();
  4185. }
  4186. deep = true;
  4187. break;
  4188. case 'DOMException':
  4189. cloned = new DOMException(value.message, value.name);
  4190. deep = true;
  4191. break;
  4192. case 'DataView':
  4193. case 'Int8Array':
  4194. case 'Uint8Array':
  4195. case 'Uint8ClampedArray':
  4196. case 'Int16Array':
  4197. case 'Uint16Array':
  4198. case 'Int32Array':
  4199. case 'Uint32Array':
  4200. case 'Float32Array':
  4201. case 'Float64Array':
  4202. case 'BigInt64Array':
  4203. case 'BigUint64Array':
  4204. C = global[type];
  4205. if (!isObject(C))
  4206. throwUnpolyfillable(type);
  4207. cloned = new C(structuredCloneInternal(value.buffer, map), value.byteOffset, type === 'DataView' ? value.byteLength : value.length);
  4208. break;
  4209. case 'DOMQuad':
  4210. try {
  4211. cloned = new DOMQuad(structuredCloneInternal(value.p1, map), structuredCloneInternal(value.p2, map), structuredCloneInternal(value.p3, map), structuredCloneInternal(value.p4, map));
  4212. } catch (error) {
  4213. if (nativeRestrictedStructuredClone) {
  4214. cloned = nativeRestrictedStructuredClone(value);
  4215. } else
  4216. throwUnpolyfillable(type);
  4217. }
  4218. break;
  4219. case 'FileList':
  4220. dataTransfer = createDataTransfer();
  4221. if (dataTransfer) {
  4222. for (i = 0, length = lengthOfArrayLike(value); i < length; i++) {
  4223. dataTransfer.items.add(structuredCloneInternal(value[i], map));
  4224. }
  4225. cloned = dataTransfer.files;
  4226. } else if (nativeRestrictedStructuredClone) {
  4227. cloned = nativeRestrictedStructuredClone(value);
  4228. } else
  4229. throwUnpolyfillable(type);
  4230. break;
  4231. case 'ImageData':
  4232. try {
  4233. cloned = new ImageData(structuredCloneInternal(value.data, map), value.width, value.height, { colorSpace: value.colorSpace });
  4234. } catch (error) {
  4235. if (nativeRestrictedStructuredClone) {
  4236. cloned = nativeRestrictedStructuredClone(value);
  4237. } else
  4238. throwUnpolyfillable(type);
  4239. }
  4240. break;
  4241. default:
  4242. if (nativeRestrictedStructuredClone) {
  4243. cloned = nativeRestrictedStructuredClone(value);
  4244. } else
  4245. switch (type) {
  4246. case 'BigInt':
  4247. cloned = Object(value.valueOf());
  4248. break;
  4249. case 'Boolean':
  4250. cloned = Object(thisBooleanValue(value));
  4251. break;
  4252. case 'Number':
  4253. cloned = Object(thisNumberValue(value));
  4254. break;
  4255. case 'String':
  4256. cloned = Object(thisStringValue(value));
  4257. break;
  4258. case 'Date':
  4259. cloned = new Date(thisTimeValue(value));
  4260. break;
  4261. case 'ArrayBuffer':
  4262. C = global.DataView;
  4263. if (!C && typeof value.slice != 'function')
  4264. throwUnpolyfillable(type);
  4265. try {
  4266. if (typeof value.slice == 'function') {
  4267. cloned = value.slice(0);
  4268. } else {
  4269. length = value.byteLength;
  4270. cloned = new ArrayBuffer(length);
  4271. source = new C(value);
  4272. target = new C(cloned);
  4273. for (i = 0; i < length; i++) {
  4274. target.setUint8(i, source.getUint8(i));
  4275. }
  4276. }
  4277. } catch (error) {
  4278. throw new DOMException('ArrayBuffer is detached', DATA_CLONE_ERROR);
  4279. }
  4280. break;
  4281. case 'SharedArrayBuffer':
  4282. cloned = value;
  4283. break;
  4284. case 'Blob':
  4285. try {
  4286. cloned = value.slice(0, value.size, value.type);
  4287. } catch (error) {
  4288. throwUnpolyfillable(type);
  4289. }
  4290. break;
  4291. case 'DOMPoint':
  4292. case 'DOMPointReadOnly':
  4293. C = global[type];
  4294. try {
  4295. cloned = C.fromPoint ? C.fromPoint(value) : new C(value.x, value.y, value.z, value.w);
  4296. } catch (error) {
  4297. throwUnpolyfillable(type);
  4298. }
  4299. break;
  4300. case 'DOMRect':
  4301. case 'DOMRectReadOnly':
  4302. C = global[type];
  4303. try {
  4304. cloned = C.fromRect ? C.fromRect(value) : new C(value.x, value.y, value.width, value.height);
  4305. } catch (error) {
  4306. throwUnpolyfillable(type);
  4307. }
  4308. break;
  4309. case 'DOMMatrix':
  4310. case 'DOMMatrixReadOnly':
  4311. C = global[type];
  4312. try {
  4313. cloned = C.fromMatrix ? C.fromMatrix(value) : new C(value);
  4314. } catch (error) {
  4315. throwUnpolyfillable(type);
  4316. }
  4317. break;
  4318. case 'AudioData':
  4319. case 'VideoFrame':
  4320. if (!isCallable(value.clone))
  4321. throwUnpolyfillable(type);
  4322. try {
  4323. cloned = value.clone();
  4324. } catch (error) {
  4325. throwUncloneable(type);
  4326. }
  4327. break;
  4328. case 'File':
  4329. try {
  4330. cloned = new File([value], value.name, value);
  4331. } catch (error) {
  4332. throwUnpolyfillable(type);
  4333. }
  4334. break;
  4335. case 'CropTarget':
  4336. case 'CryptoKey':
  4337. case 'FileSystemDirectoryHandle':
  4338. case 'FileSystemFileHandle':
  4339. case 'FileSystemHandle':
  4340. case 'GPUCompilationInfo':
  4341. case 'GPUCompilationMessage':
  4342. case 'ImageBitmap':
  4343. case 'RTCCertificate':
  4344. case 'WebAssembly.Module':
  4345. throwUnpolyfillable(type);
  4346. default:
  4347. throwUncloneable(type);
  4348. }
  4349. }
  4350. mapSet(map, value, cloned);
  4351. if (deep)
  4352. switch (type) {
  4353. case 'Array':
  4354. case 'Object':
  4355. keys = objectKeys(value);
  4356. for (i = 0, length = lengthOfArrayLike(keys); i < length; i++) {
  4357. key = keys[i];
  4358. createProperty(cloned, key, structuredCloneInternal(value[key], map));
  4359. }
  4360. break;
  4361. case 'Map':
  4362. value.forEach(function (v, k) {
  4363. mapSet(cloned, structuredCloneInternal(k, map), structuredCloneInternal(v, map));
  4364. });
  4365. break;
  4366. case 'Set':
  4367. value.forEach(function (v) {
  4368. setAdd(cloned, structuredCloneInternal(v, map));
  4369. });
  4370. break;
  4371. case 'Error':
  4372. createNonEnumerableProperty(cloned, 'message', structuredCloneInternal(value.message, map));
  4373. if (hasOwn(value, 'cause')) {
  4374. createNonEnumerableProperty(cloned, 'cause', structuredCloneInternal(value.cause, map));
  4375. }
  4376. if (name == 'AggregateError') {
  4377. cloned.errors = structuredCloneInternal(value.errors, map);
  4378. }
  4379. case 'DOMException':
  4380. if (ERROR_STACK_INSTALLABLE) {
  4381. createNonEnumerableProperty(cloned, 'stack', structuredCloneInternal(value.stack, map));
  4382. }
  4383. }
  4384. return cloned;
  4385. };
  4386. var PROPER_TRANSFER = nativeStructuredClone && !fails(function () {
  4387. if (IS_DENO && V8 > 92 || IS_NODE && V8 > 94 || IS_BROWSER && V8 > 97)
  4388. return false;
  4389. var buffer = new ArrayBuffer(8);
  4390. var clone = nativeStructuredClone(buffer, { transfer: [buffer] });
  4391. return buffer.byteLength != 0 || clone.byteLength != 8;
  4392. });
  4393. var tryToTransfer = function (rawTransfer, map) {
  4394. if (!isObject(rawTransfer))
  4395. throw TypeError('Transfer option cannot be converted to a sequence');
  4396. var transfer = [];
  4397. iterate(rawTransfer, function (value) {
  4398. push(transfer, anObject(value));
  4399. });
  4400. var i = 0;
  4401. var length = lengthOfArrayLike(transfer);
  4402. var value, type, C, transferredArray, transferred, canvas, context;
  4403. if (PROPER_TRANSFER) {
  4404. transferredArray = nativeStructuredClone(transfer, { transfer: transfer });
  4405. while (i < length)
  4406. mapSet(map, transfer[i], transferredArray[i++]);
  4407. } else
  4408. while (i < length) {
  4409. value = transfer[i++];
  4410. if (mapHas(map, value))
  4411. throw new DOMException('Duplicate transferable', DATA_CLONE_ERROR);
  4412. type = classof(value);
  4413. switch (type) {
  4414. case 'ImageBitmap':
  4415. C = global.OffscreenCanvas;
  4416. if (!isConstructor(C))
  4417. throwUnpolyfillable(type, TRANSFERRING);
  4418. try {
  4419. canvas = new C(value.width, value.height);
  4420. context = canvas.getContext('bitmaprenderer');
  4421. context.transferFromImageBitmap(value);
  4422. transferred = canvas.transferToImageBitmap();
  4423. } catch (error) {
  4424. }
  4425. break;
  4426. case 'AudioData':
  4427. case 'VideoFrame':
  4428. if (!isCallable(value.clone) || !isCallable(value.close))
  4429. throwUnpolyfillable(type, TRANSFERRING);
  4430. try {
  4431. transferred = value.clone();
  4432. value.close();
  4433. } catch (error) {
  4434. }
  4435. break;
  4436. case 'ArrayBuffer':
  4437. case 'MediaSourceHandle':
  4438. case 'MessagePort':
  4439. case 'OffscreenCanvas':
  4440. case 'ReadableStream':
  4441. case 'TransformStream':
  4442. case 'WritableStream':
  4443. throwUnpolyfillable(type, TRANSFERRING);
  4444. }
  4445. if (transferred === undefined)
  4446. throw new DOMException('This object cannot be transferred: ' + type, DATA_CLONE_ERROR);
  4447. mapSet(map, value, transferred);
  4448. }
  4449. };
  4450. $({
  4451. global: true,
  4452. enumerable: true,
  4453. sham: !PROPER_TRANSFER,
  4454. forced: FORCED_REPLACEMENT
  4455. }, {
  4456. structuredClone: function structuredClone(value) {
  4457. var options = validateArgumentsLength(arguments.length, 1) > 1 && !isNullOrUndefined(arguments[1]) ? anObject(arguments[1]) : undefined;
  4458. var transfer = options ? options.transfer : undefined;
  4459. var map;
  4460. if (transfer !== undefined) {
  4461. map = new Map();
  4462. tryToTransfer(transfer, map);
  4463. }
  4464. return structuredCloneInternal(value, map);
  4465. }
  4466. });
  4467. /***/ }),
  4468. /* 125 */
  4469. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  4470. var uncurryThis = __w_pdfjs_require__(18);
  4471. var fails = __w_pdfjs_require__(11);
  4472. var isCallable = __w_pdfjs_require__(25);
  4473. var classof = __w_pdfjs_require__(83);
  4474. var getBuiltIn = __w_pdfjs_require__(28);
  4475. var inspectSource = __w_pdfjs_require__(55);
  4476. var noop = function () {
  4477. };
  4478. var empty = [];
  4479. var construct = getBuiltIn('Reflect', 'construct');
  4480. var constructorRegExp = /^\s*(?:class|function)\b/;
  4481. var exec = uncurryThis(constructorRegExp.exec);
  4482. var INCORRECT_TO_STRING = !constructorRegExp.exec(noop);
  4483. var isConstructorModern = function isConstructor(argument) {
  4484. if (!isCallable(argument))
  4485. return false;
  4486. try {
  4487. construct(noop, empty, argument);
  4488. return true;
  4489. } catch (error) {
  4490. return false;
  4491. }
  4492. };
  4493. var isConstructorLegacy = function isConstructor(argument) {
  4494. if (!isCallable(argument))
  4495. return false;
  4496. switch (classof(argument)) {
  4497. case 'AsyncFunction':
  4498. case 'GeneratorFunction':
  4499. case 'AsyncGeneratorFunction':
  4500. return false;
  4501. }
  4502. try {
  4503. return INCORRECT_TO_STRING || !!exec(constructorRegExp, inspectSource(argument));
  4504. } catch (error) {
  4505. return true;
  4506. }
  4507. };
  4508. isConstructorLegacy.sham = true;
  4509. module.exports = !construct || fails(function () {
  4510. var called;
  4511. return isConstructorModern(isConstructorModern.call) || !isConstructorModern(Object) || !isConstructorModern(function () {
  4512. called = true;
  4513. }) || called;
  4514. }) ? isConstructorLegacy : isConstructorModern;
  4515. /***/ }),
  4516. /* 126 */
  4517. /***/ ((module) => {
  4518. var $TypeError = TypeError;
  4519. module.exports = function (passed, required) {
  4520. if (passed < required)
  4521. throw $TypeError('Not enough arguments');
  4522. return passed;
  4523. };
  4524. /***/ }),
  4525. /* 127 */
  4526. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  4527. var call = __w_pdfjs_require__(12);
  4528. var hasOwn = __w_pdfjs_require__(43);
  4529. var isPrototypeOf = __w_pdfjs_require__(29);
  4530. var regExpFlags = __w_pdfjs_require__(128);
  4531. var RegExpPrototype = RegExp.prototype;
  4532. module.exports = function (R) {
  4533. var flags = R.flags;
  4534. return flags === undefined && !('flags' in RegExpPrototype) && !hasOwn(R, 'flags') && isPrototypeOf(RegExpPrototype, R) ? call(regExpFlags, R) : flags;
  4535. };
  4536. /***/ }),
  4537. /* 128 */
  4538. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  4539. "use strict";
  4540. var anObject = __w_pdfjs_require__(51);
  4541. module.exports = function () {
  4542. var that = anObject(this);
  4543. var result = '';
  4544. if (that.hasIndices)
  4545. result += 'd';
  4546. if (that.global)
  4547. result += 'g';
  4548. if (that.ignoreCase)
  4549. result += 'i';
  4550. if (that.multiline)
  4551. result += 'm';
  4552. if (that.dotAll)
  4553. result += 's';
  4554. if (that.unicode)
  4555. result += 'u';
  4556. if (that.unicodeSets)
  4557. result += 'v';
  4558. if (that.sticky)
  4559. result += 'y';
  4560. return result;
  4561. };
  4562. /***/ }),
  4563. /* 129 */
  4564. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  4565. var fails = __w_pdfjs_require__(11);
  4566. var createPropertyDescriptor = __w_pdfjs_require__(15);
  4567. module.exports = !fails(function () {
  4568. var error = Error('a');
  4569. if (!('stack' in error))
  4570. return true;
  4571. Object.defineProperty(error, 'stack', createPropertyDescriptor(1, 7));
  4572. return error.stack !== 7;
  4573. });
  4574. /***/ }),
  4575. /* 130 */
  4576. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  4577. var IS_DENO = __w_pdfjs_require__(131);
  4578. var IS_NODE = __w_pdfjs_require__(132);
  4579. module.exports = !IS_DENO && !IS_NODE && typeof window == 'object' && typeof document == 'object';
  4580. /***/ }),
  4581. /* 131 */
  4582. /***/ ((module) => {
  4583. module.exports = typeof Deno == 'object' && Deno && typeof Deno.version == 'object';
  4584. /***/ }),
  4585. /* 132 */
  4586. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  4587. var classof = __w_pdfjs_require__(19);
  4588. var global = __w_pdfjs_require__(8);
  4589. module.exports = classof(global.process) == 'process';
  4590. /***/ }),
  4591. /* 133 */
  4592. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  4593. var global = __w_pdfjs_require__(8);
  4594. module.exports = global;
  4595. /***/ }),
  4596. /* 134 */
  4597. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  4598. "use strict";
  4599. Object.defineProperty(exports, "__esModule", ({
  4600. value: true
  4601. }));
  4602. exports.RefSetCache = exports.RefSet = exports.Ref = exports.Name = exports.EOF = exports.Dict = exports.Cmd = exports.CIRCULAR_REF = void 0;
  4603. exports.clearPrimitiveCaches = clearPrimitiveCaches;
  4604. exports.isCmd = isCmd;
  4605. exports.isDict = isDict;
  4606. exports.isName = isName;
  4607. exports.isRefsEqual = isRefsEqual;
  4608. var _util = __w_pdfjs_require__(2);
  4609. const CIRCULAR_REF = Symbol("CIRCULAR_REF");
  4610. exports.CIRCULAR_REF = CIRCULAR_REF;
  4611. const EOF = Symbol("EOF");
  4612. exports.EOF = EOF;
  4613. const Name = function NameClosure() {
  4614. let nameCache = Object.create(null);
  4615. class Name {
  4616. constructor(name) {
  4617. this.name = name;
  4618. }
  4619. static get(name) {
  4620. return nameCache[name] || (nameCache[name] = new Name(name));
  4621. }
  4622. static _clearCache() {
  4623. nameCache = Object.create(null);
  4624. }
  4625. }
  4626. return Name;
  4627. }();
  4628. exports.Name = Name;
  4629. const Cmd = function CmdClosure() {
  4630. let cmdCache = Object.create(null);
  4631. class Cmd {
  4632. constructor(cmd) {
  4633. this.cmd = cmd;
  4634. }
  4635. static get(cmd) {
  4636. return cmdCache[cmd] || (cmdCache[cmd] = new Cmd(cmd));
  4637. }
  4638. static _clearCache() {
  4639. cmdCache = Object.create(null);
  4640. }
  4641. }
  4642. return Cmd;
  4643. }();
  4644. exports.Cmd = Cmd;
  4645. const nonSerializable = function nonSerializableClosure() {
  4646. return nonSerializable;
  4647. };
  4648. class Dict {
  4649. constructor() {
  4650. let xref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  4651. this._map = Object.create(null);
  4652. this.xref = xref;
  4653. this.objId = null;
  4654. this.suppressEncryption = false;
  4655. this.__nonSerializable__ = nonSerializable;
  4656. }
  4657. assignXref(newXref) {
  4658. this.xref = newXref;
  4659. }
  4660. get size() {
  4661. return Object.keys(this._map).length;
  4662. }
  4663. get(key1, key2, key3) {
  4664. let value = this._map[key1];
  4665. if (value === undefined && key2 !== undefined) {
  4666. value = this._map[key2];
  4667. if (value === undefined && key3 !== undefined) {
  4668. value = this._map[key3];
  4669. }
  4670. }
  4671. if (value instanceof Ref && this.xref) {
  4672. return this.xref.fetch(value, this.suppressEncryption);
  4673. }
  4674. return value;
  4675. }
  4676. async getAsync(key1, key2, key3) {
  4677. let value = this._map[key1];
  4678. if (value === undefined && key2 !== undefined) {
  4679. value = this._map[key2];
  4680. if (value === undefined && key3 !== undefined) {
  4681. value = this._map[key3];
  4682. }
  4683. }
  4684. if (value instanceof Ref && this.xref) {
  4685. return this.xref.fetchAsync(value, this.suppressEncryption);
  4686. }
  4687. return value;
  4688. }
  4689. getArray(key1, key2, key3) {
  4690. let value = this._map[key1];
  4691. if (value === undefined && key2 !== undefined) {
  4692. value = this._map[key2];
  4693. if (value === undefined && key3 !== undefined) {
  4694. value = this._map[key3];
  4695. }
  4696. }
  4697. if (value instanceof Ref && this.xref) {
  4698. value = this.xref.fetch(value, this.suppressEncryption);
  4699. }
  4700. if (Array.isArray(value)) {
  4701. value = value.slice();
  4702. for (let i = 0, ii = value.length; i < ii; i++) {
  4703. if (value[i] instanceof Ref && this.xref) {
  4704. value[i] = this.xref.fetch(value[i], this.suppressEncryption);
  4705. }
  4706. }
  4707. }
  4708. return value;
  4709. }
  4710. getRaw(key) {
  4711. return this._map[key];
  4712. }
  4713. getKeys() {
  4714. return Object.keys(this._map);
  4715. }
  4716. getRawValues() {
  4717. return Object.values(this._map);
  4718. }
  4719. set(key, value) {
  4720. this._map[key] = value;
  4721. }
  4722. has(key) {
  4723. return this._map[key] !== undefined;
  4724. }
  4725. forEach(callback) {
  4726. for (const key in this._map) {
  4727. callback(key, this.get(key));
  4728. }
  4729. }
  4730. static get empty() {
  4731. const emptyDict = new Dict(null);
  4732. emptyDict.set = (key, value) => {
  4733. (0, _util.unreachable)("Should not call `set` on the empty dictionary.");
  4734. };
  4735. return (0, _util.shadow)(this, "empty", emptyDict);
  4736. }
  4737. static merge(_ref) {
  4738. let {
  4739. xref,
  4740. dictArray,
  4741. mergeSubDicts = false
  4742. } = _ref;
  4743. const mergedDict = new Dict(xref),
  4744. properties = new Map();
  4745. for (const dict of dictArray) {
  4746. if (!(dict instanceof Dict)) {
  4747. continue;
  4748. }
  4749. for (const [key, value] of Object.entries(dict._map)) {
  4750. let property = properties.get(key);
  4751. if (property === undefined) {
  4752. property = [];
  4753. properties.set(key, property);
  4754. } else if (!mergeSubDicts || !(value instanceof Dict)) {
  4755. continue;
  4756. }
  4757. property.push(value);
  4758. }
  4759. }
  4760. for (const [name, values] of properties) {
  4761. if (values.length === 1 || !(values[0] instanceof Dict)) {
  4762. mergedDict._map[name] = values[0];
  4763. continue;
  4764. }
  4765. const subDict = new Dict(xref);
  4766. for (const dict of values) {
  4767. for (const [key, value] of Object.entries(dict._map)) {
  4768. if (subDict._map[key] === undefined) {
  4769. subDict._map[key] = value;
  4770. }
  4771. }
  4772. }
  4773. if (subDict.size > 0) {
  4774. mergedDict._map[name] = subDict;
  4775. }
  4776. }
  4777. properties.clear();
  4778. return mergedDict.size > 0 ? mergedDict : Dict.empty;
  4779. }
  4780. }
  4781. exports.Dict = Dict;
  4782. const Ref = function RefClosure() {
  4783. let refCache = Object.create(null);
  4784. class Ref {
  4785. constructor(num, gen) {
  4786. this.num = num;
  4787. this.gen = gen;
  4788. }
  4789. toString() {
  4790. if (this.gen === 0) {
  4791. return `${this.num}R`;
  4792. }
  4793. return `${this.num}R${this.gen}`;
  4794. }
  4795. static get(num, gen) {
  4796. const key = gen === 0 ? `${num}R` : `${num}R${gen}`;
  4797. return refCache[key] || (refCache[key] = new Ref(num, gen));
  4798. }
  4799. static _clearCache() {
  4800. refCache = Object.create(null);
  4801. }
  4802. }
  4803. return Ref;
  4804. }();
  4805. exports.Ref = Ref;
  4806. class RefSet {
  4807. constructor() {
  4808. let parent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  4809. this._set = new Set(parent && parent._set);
  4810. }
  4811. has(ref) {
  4812. return this._set.has(ref.toString());
  4813. }
  4814. put(ref) {
  4815. this._set.add(ref.toString());
  4816. }
  4817. remove(ref) {
  4818. this._set.delete(ref.toString());
  4819. }
  4820. [Symbol.iterator]() {
  4821. return this._set.values();
  4822. }
  4823. clear() {
  4824. this._set.clear();
  4825. }
  4826. }
  4827. exports.RefSet = RefSet;
  4828. class RefSetCache {
  4829. constructor() {
  4830. this._map = new Map();
  4831. }
  4832. get size() {
  4833. return this._map.size;
  4834. }
  4835. get(ref) {
  4836. return this._map.get(ref.toString());
  4837. }
  4838. has(ref) {
  4839. return this._map.has(ref.toString());
  4840. }
  4841. put(ref, obj) {
  4842. this._map.set(ref.toString(), obj);
  4843. }
  4844. putAlias(ref, aliasRef) {
  4845. this._map.set(ref.toString(), this.get(aliasRef));
  4846. }
  4847. [Symbol.iterator]() {
  4848. return this._map.values();
  4849. }
  4850. clear() {
  4851. this._map.clear();
  4852. }
  4853. }
  4854. exports.RefSetCache = RefSetCache;
  4855. function isName(v, name) {
  4856. return v instanceof Name && (name === undefined || v.name === name);
  4857. }
  4858. function isCmd(v, cmd) {
  4859. return v instanceof Cmd && (cmd === undefined || v.cmd === cmd);
  4860. }
  4861. function isDict(v, type) {
  4862. return v instanceof Dict && (type === undefined || isName(v.get("Type"), type));
  4863. }
  4864. function isRefsEqual(v1, v2) {
  4865. return v1.num === v2.num && v1.gen === v2.gen;
  4866. }
  4867. function clearPrimitiveCaches() {
  4868. Cmd._clearCache();
  4869. Name._clearCache();
  4870. Ref._clearCache();
  4871. }
  4872. /***/ }),
  4873. /* 135 */
  4874. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  4875. "use strict";
  4876. Object.defineProperty(exports, "__esModule", ({
  4877. value: true
  4878. }));
  4879. exports.XRefParseException = exports.XRefEntryException = exports.ParserEOFException = exports.PDF_VERSION_REGEXP = exports.MissingDataException = exports.DocStats = void 0;
  4880. exports.collectActions = collectActions;
  4881. exports.encodeToXmlString = encodeToXmlString;
  4882. exports.escapePDFName = escapePDFName;
  4883. exports.escapeString = escapeString;
  4884. exports.getArrayLookupTableFactory = getArrayLookupTableFactory;
  4885. exports.getInheritableProperty = getInheritableProperty;
  4886. exports.getLookupTableFactory = getLookupTableFactory;
  4887. exports.getNewAnnotationsMap = getNewAnnotationsMap;
  4888. exports.getRotationMatrix = getRotationMatrix;
  4889. exports.isAscii = isAscii;
  4890. exports.isWhiteSpace = isWhiteSpace;
  4891. exports.log2 = log2;
  4892. exports.numberToString = numberToString;
  4893. exports.parseXFAPath = parseXFAPath;
  4894. exports.readInt8 = readInt8;
  4895. exports.readUint16 = readUint16;
  4896. exports.readUint32 = readUint32;
  4897. exports.recoverJsURL = recoverJsURL;
  4898. exports.stringToUTF16HexString = stringToUTF16HexString;
  4899. exports.stringToUTF16String = stringToUTF16String;
  4900. exports.toRomanNumerals = toRomanNumerals;
  4901. exports.validateCSSFont = validateCSSFont;
  4902. var _util = __w_pdfjs_require__(2);
  4903. var _primitives = __w_pdfjs_require__(134);
  4904. var _base_stream = __w_pdfjs_require__(136);
  4905. const PDF_VERSION_REGEXP = /^[1-9]\.\d$/;
  4906. exports.PDF_VERSION_REGEXP = PDF_VERSION_REGEXP;
  4907. function getLookupTableFactory(initializer) {
  4908. let lookup;
  4909. return function () {
  4910. if (initializer) {
  4911. lookup = Object.create(null);
  4912. initializer(lookup);
  4913. initializer = null;
  4914. }
  4915. return lookup;
  4916. };
  4917. }
  4918. function getArrayLookupTableFactory(initializer) {
  4919. let lookup;
  4920. return function () {
  4921. if (initializer) {
  4922. let arr = initializer();
  4923. initializer = null;
  4924. lookup = Object.create(null);
  4925. for (let i = 0, ii = arr.length; i < ii; i += 2) {
  4926. lookup[arr[i]] = arr[i + 1];
  4927. }
  4928. arr = null;
  4929. }
  4930. return lookup;
  4931. };
  4932. }
  4933. class MissingDataException extends _util.BaseException {
  4934. constructor(begin, end) {
  4935. super(`Missing data [${begin}, ${end})`, "MissingDataException");
  4936. this.begin = begin;
  4937. this.end = end;
  4938. }
  4939. }
  4940. exports.MissingDataException = MissingDataException;
  4941. class ParserEOFException extends _util.BaseException {
  4942. constructor(msg) {
  4943. super(msg, "ParserEOFException");
  4944. }
  4945. }
  4946. exports.ParserEOFException = ParserEOFException;
  4947. class XRefEntryException extends _util.BaseException {
  4948. constructor(msg) {
  4949. super(msg, "XRefEntryException");
  4950. }
  4951. }
  4952. exports.XRefEntryException = XRefEntryException;
  4953. class XRefParseException extends _util.BaseException {
  4954. constructor(msg) {
  4955. super(msg, "XRefParseException");
  4956. }
  4957. }
  4958. exports.XRefParseException = XRefParseException;
  4959. class DocStats {
  4960. constructor(handler) {
  4961. this._handler = handler;
  4962. this._streamTypes = new Set();
  4963. this._fontTypes = new Set();
  4964. }
  4965. _send() {
  4966. const streamTypes = Object.create(null),
  4967. fontTypes = Object.create(null);
  4968. for (const type of this._streamTypes) {
  4969. streamTypes[type] = true;
  4970. }
  4971. for (const type of this._fontTypes) {
  4972. fontTypes[type] = true;
  4973. }
  4974. this._handler.send("DocStats", {
  4975. streamTypes,
  4976. fontTypes
  4977. });
  4978. }
  4979. addStreamType(type) {
  4980. if (this._streamTypes.has(type)) {
  4981. return;
  4982. }
  4983. this._streamTypes.add(type);
  4984. this._send();
  4985. }
  4986. addFontType(type) {
  4987. if (this._fontTypes.has(type)) {
  4988. return;
  4989. }
  4990. this._fontTypes.add(type);
  4991. this._send();
  4992. }
  4993. }
  4994. exports.DocStats = DocStats;
  4995. function getInheritableProperty(_ref) {
  4996. let {
  4997. dict,
  4998. key,
  4999. getArray = false,
  5000. stopWhenFound = true
  5001. } = _ref;
  5002. let values;
  5003. const visited = new _primitives.RefSet();
  5004. while (dict instanceof _primitives.Dict && !(dict.objId && visited.has(dict.objId))) {
  5005. if (dict.objId) {
  5006. visited.put(dict.objId);
  5007. }
  5008. const value = getArray ? dict.getArray(key) : dict.get(key);
  5009. if (value !== undefined) {
  5010. if (stopWhenFound) {
  5011. return value;
  5012. }
  5013. if (!values) {
  5014. values = [];
  5015. }
  5016. values.push(value);
  5017. }
  5018. dict = dict.get("Parent");
  5019. }
  5020. return values;
  5021. }
  5022. 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"];
  5023. function toRomanNumerals(number) {
  5024. let lowerCase = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  5025. (0, _util.assert)(Number.isInteger(number) && number > 0, "The number should be a positive integer.");
  5026. const romanBuf = [];
  5027. let pos;
  5028. while (number >= 1000) {
  5029. number -= 1000;
  5030. romanBuf.push("M");
  5031. }
  5032. pos = number / 100 | 0;
  5033. number %= 100;
  5034. romanBuf.push(ROMAN_NUMBER_MAP[pos]);
  5035. pos = number / 10 | 0;
  5036. number %= 10;
  5037. romanBuf.push(ROMAN_NUMBER_MAP[10 + pos]);
  5038. romanBuf.push(ROMAN_NUMBER_MAP[20 + number]);
  5039. const romanStr = romanBuf.join("");
  5040. return lowerCase ? romanStr.toLowerCase() : romanStr;
  5041. }
  5042. function log2(x) {
  5043. if (x <= 0) {
  5044. return 0;
  5045. }
  5046. return Math.ceil(Math.log2(x));
  5047. }
  5048. function readInt8(data, offset) {
  5049. return data[offset] << 24 >> 24;
  5050. }
  5051. function readUint16(data, offset) {
  5052. return data[offset] << 8 | data[offset + 1];
  5053. }
  5054. function readUint32(data, offset) {
  5055. return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0;
  5056. }
  5057. function isWhiteSpace(ch) {
  5058. return ch === 0x20 || ch === 0x09 || ch === 0x0d || ch === 0x0a;
  5059. }
  5060. function parseXFAPath(path) {
  5061. const positionPattern = /(.+)\[(\d+)\]$/;
  5062. return path.split(".").map(component => {
  5063. const m = component.match(positionPattern);
  5064. if (m) {
  5065. return {
  5066. name: m[1],
  5067. pos: parseInt(m[2], 10)
  5068. };
  5069. }
  5070. return {
  5071. name: component,
  5072. pos: 0
  5073. };
  5074. });
  5075. }
  5076. function escapePDFName(str) {
  5077. const buffer = [];
  5078. let start = 0;
  5079. for (let i = 0, ii = str.length; i < ii; i++) {
  5080. const char = str.charCodeAt(i);
  5081. 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) {
  5082. if (start < i) {
  5083. buffer.push(str.substring(start, i));
  5084. }
  5085. buffer.push(`#${char.toString(16)}`);
  5086. start = i + 1;
  5087. }
  5088. }
  5089. if (buffer.length === 0) {
  5090. return str;
  5091. }
  5092. if (start < str.length) {
  5093. buffer.push(str.substring(start, str.length));
  5094. }
  5095. return buffer.join("");
  5096. }
  5097. function escapeString(str) {
  5098. return str.replace(/([()\\\n\r])/g, match => {
  5099. if (match === "\n") {
  5100. return "\\n";
  5101. } else if (match === "\r") {
  5102. return "\\r";
  5103. }
  5104. return `\\${match}`;
  5105. });
  5106. }
  5107. function _collectJS(entry, xref, list, parents) {
  5108. if (!entry) {
  5109. return;
  5110. }
  5111. let parent = null;
  5112. if (entry instanceof _primitives.Ref) {
  5113. if (parents.has(entry)) {
  5114. return;
  5115. }
  5116. parent = entry;
  5117. parents.put(parent);
  5118. entry = xref.fetch(entry);
  5119. }
  5120. if (Array.isArray(entry)) {
  5121. for (const element of entry) {
  5122. _collectJS(element, xref, list, parents);
  5123. }
  5124. } else if (entry instanceof _primitives.Dict) {
  5125. if ((0, _primitives.isName)(entry.get("S"), "JavaScript")) {
  5126. const js = entry.get("JS");
  5127. let code;
  5128. if (js instanceof _base_stream.BaseStream) {
  5129. code = js.getString();
  5130. } else if (typeof js === "string") {
  5131. code = js;
  5132. }
  5133. code = code && (0, _util.stringToPDFString)(code).replace(/\u0000/g, "");
  5134. if (code) {
  5135. list.push(code);
  5136. }
  5137. }
  5138. _collectJS(entry.getRaw("Next"), xref, list, parents);
  5139. }
  5140. if (parent) {
  5141. parents.remove(parent);
  5142. }
  5143. }
  5144. function collectActions(xref, dict, eventType) {
  5145. const actions = Object.create(null);
  5146. const additionalActionsDicts = getInheritableProperty({
  5147. dict,
  5148. key: "AA",
  5149. stopWhenFound: false
  5150. });
  5151. if (additionalActionsDicts) {
  5152. for (let i = additionalActionsDicts.length - 1; i >= 0; i--) {
  5153. const additionalActions = additionalActionsDicts[i];
  5154. if (!(additionalActions instanceof _primitives.Dict)) {
  5155. continue;
  5156. }
  5157. for (const key of additionalActions.getKeys()) {
  5158. const action = eventType[key];
  5159. if (!action) {
  5160. continue;
  5161. }
  5162. const actionDict = additionalActions.getRaw(key);
  5163. const parents = new _primitives.RefSet();
  5164. const list = [];
  5165. _collectJS(actionDict, xref, list, parents);
  5166. if (list.length > 0) {
  5167. actions[action] = list;
  5168. }
  5169. }
  5170. }
  5171. }
  5172. if (dict.has("A")) {
  5173. const actionDict = dict.get("A");
  5174. const parents = new _primitives.RefSet();
  5175. const list = [];
  5176. _collectJS(actionDict, xref, list, parents);
  5177. if (list.length > 0) {
  5178. actions.Action = list;
  5179. }
  5180. }
  5181. return (0, _util.objectSize)(actions) > 0 ? actions : null;
  5182. }
  5183. const XMLEntities = {
  5184. 0x3c: "&lt;",
  5185. 0x3e: "&gt;",
  5186. 0x26: "&amp;",
  5187. 0x22: "&quot;",
  5188. 0x27: "&apos;"
  5189. };
  5190. function encodeToXmlString(str) {
  5191. const buffer = [];
  5192. let start = 0;
  5193. for (let i = 0, ii = str.length; i < ii; i++) {
  5194. const char = str.codePointAt(i);
  5195. if (0x20 <= char && char <= 0x7e) {
  5196. const entity = XMLEntities[char];
  5197. if (entity) {
  5198. if (start < i) {
  5199. buffer.push(str.substring(start, i));
  5200. }
  5201. buffer.push(entity);
  5202. start = i + 1;
  5203. }
  5204. } else {
  5205. if (start < i) {
  5206. buffer.push(str.substring(start, i));
  5207. }
  5208. buffer.push(`&#x${char.toString(16).toUpperCase()};`);
  5209. if (char > 0xd7ff && (char < 0xe000 || char > 0xfffd)) {
  5210. i++;
  5211. }
  5212. start = i + 1;
  5213. }
  5214. }
  5215. if (buffer.length === 0) {
  5216. return str;
  5217. }
  5218. if (start < str.length) {
  5219. buffer.push(str.substring(start, str.length));
  5220. }
  5221. return buffer.join("");
  5222. }
  5223. function validateCSSFont(cssFontInfo) {
  5224. const DEFAULT_CSS_FONT_OBLIQUE = "14";
  5225. const DEFAULT_CSS_FONT_WEIGHT = "400";
  5226. const CSS_FONT_WEIGHT_VALUES = new Set(["100", "200", "300", "400", "500", "600", "700", "800", "900", "1000", "normal", "bold", "bolder", "lighter"]);
  5227. const {
  5228. fontFamily,
  5229. fontWeight,
  5230. italicAngle
  5231. } = cssFontInfo;
  5232. if (/^".*"$/.test(fontFamily)) {
  5233. if (/[^\\]"/.test(fontFamily.slice(1, fontFamily.length - 1))) {
  5234. (0, _util.warn)(`XFA - FontFamily contains some unescaped ": ${fontFamily}.`);
  5235. return false;
  5236. }
  5237. } else if (/^'.*'$/.test(fontFamily)) {
  5238. if (/[^\\]'/.test(fontFamily.slice(1, fontFamily.length - 1))) {
  5239. (0, _util.warn)(`XFA - FontFamily contains some unescaped ': ${fontFamily}.`);
  5240. return false;
  5241. }
  5242. } else {
  5243. for (const ident of fontFamily.split(/[ \t]+/)) {
  5244. if (/^(\d|(-(\d|-)))/.test(ident) || !/^[\w-\\]+$/.test(ident)) {
  5245. (0, _util.warn)(`XFA - FontFamily contains some invalid <custom-ident>: ${fontFamily}.`);
  5246. return false;
  5247. }
  5248. }
  5249. }
  5250. const weight = fontWeight ? fontWeight.toString() : "";
  5251. cssFontInfo.fontWeight = CSS_FONT_WEIGHT_VALUES.has(weight) ? weight : DEFAULT_CSS_FONT_WEIGHT;
  5252. const angle = parseFloat(italicAngle);
  5253. cssFontInfo.italicAngle = isNaN(angle) || angle < -90 || angle > 90 ? DEFAULT_CSS_FONT_OBLIQUE : italicAngle.toString();
  5254. return true;
  5255. }
  5256. function recoverJsURL(str) {
  5257. const URL_OPEN_METHODS = ["app.launchURL", "window.open", "xfa.host.gotoURL"];
  5258. const regex = new RegExp("^\\s*(" + URL_OPEN_METHODS.join("|").split(".").join("\\.") + ")\\((?:'|\")([^'\"]*)(?:'|\")(?:,\\s*(\\w+)\\)|\\))", "i");
  5259. const jsUrl = regex.exec(str);
  5260. if (jsUrl && jsUrl[2]) {
  5261. const url = jsUrl[2];
  5262. let newWindow = false;
  5263. if (jsUrl[3] === "true" && jsUrl[1] === "app.launchURL") {
  5264. newWindow = true;
  5265. }
  5266. return {
  5267. url,
  5268. newWindow
  5269. };
  5270. }
  5271. return null;
  5272. }
  5273. function numberToString(value) {
  5274. if (Number.isInteger(value)) {
  5275. return value.toString();
  5276. }
  5277. const roundedValue = Math.round(value * 100);
  5278. if (roundedValue % 100 === 0) {
  5279. return (roundedValue / 100).toString();
  5280. }
  5281. if (roundedValue % 10 === 0) {
  5282. return value.toFixed(1);
  5283. }
  5284. return value.toFixed(2);
  5285. }
  5286. function getNewAnnotationsMap(annotationStorage) {
  5287. if (!annotationStorage) {
  5288. return null;
  5289. }
  5290. const newAnnotationsByPage = new Map();
  5291. for (const [key, value] of annotationStorage) {
  5292. if (!key.startsWith(_util.AnnotationEditorPrefix)) {
  5293. continue;
  5294. }
  5295. let annotations = newAnnotationsByPage.get(value.pageIndex);
  5296. if (!annotations) {
  5297. annotations = [];
  5298. newAnnotationsByPage.set(value.pageIndex, annotations);
  5299. }
  5300. annotations.push(value);
  5301. }
  5302. return newAnnotationsByPage.size > 0 ? newAnnotationsByPage : null;
  5303. }
  5304. function isAscii(str) {
  5305. return /^[\x00-\x7F]*$/.test(str);
  5306. }
  5307. function stringToUTF16HexString(str) {
  5308. const buf = [];
  5309. for (let i = 0, ii = str.length; i < ii; i++) {
  5310. const char = str.charCodeAt(i);
  5311. buf.push((char >> 8 & 0xff).toString(16).padStart(2, "0"), (char & 0xff).toString(16).padStart(2, "0"));
  5312. }
  5313. return buf.join("");
  5314. }
  5315. function stringToUTF16String(str) {
  5316. let bigEndian = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  5317. const buf = [];
  5318. if (bigEndian) {
  5319. buf.push("\xFE\xFF");
  5320. }
  5321. for (let i = 0, ii = str.length; i < ii; i++) {
  5322. const char = str.charCodeAt(i);
  5323. buf.push(String.fromCharCode(char >> 8 & 0xff), String.fromCharCode(char & 0xff));
  5324. }
  5325. return buf.join("");
  5326. }
  5327. function getRotationMatrix(rotation, width, height) {
  5328. switch (rotation) {
  5329. case 90:
  5330. return [0, 1, -1, 0, width, 0];
  5331. case 180:
  5332. return [-1, 0, 0, -1, width, height];
  5333. case 270:
  5334. return [0, -1, 1, 0, 0, height];
  5335. default:
  5336. throw new Error("Invalid rotation");
  5337. }
  5338. }
  5339. /***/ }),
  5340. /* 136 */
  5341. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  5342. "use strict";
  5343. Object.defineProperty(exports, "__esModule", ({
  5344. value: true
  5345. }));
  5346. exports.BaseStream = void 0;
  5347. var _util = __w_pdfjs_require__(2);
  5348. class BaseStream {
  5349. constructor() {
  5350. if (this.constructor === BaseStream) {
  5351. (0, _util.unreachable)("Cannot initialize BaseStream.");
  5352. }
  5353. }
  5354. get length() {
  5355. (0, _util.unreachable)("Abstract getter `length` accessed");
  5356. }
  5357. get isEmpty() {
  5358. (0, _util.unreachable)("Abstract getter `isEmpty` accessed");
  5359. }
  5360. get isDataLoaded() {
  5361. return (0, _util.shadow)(this, "isDataLoaded", true);
  5362. }
  5363. getByte() {
  5364. (0, _util.unreachable)("Abstract method `getByte` called");
  5365. }
  5366. getBytes(length) {
  5367. (0, _util.unreachable)("Abstract method `getBytes` called");
  5368. }
  5369. peekByte() {
  5370. const peekedByte = this.getByte();
  5371. if (peekedByte !== -1) {
  5372. this.pos--;
  5373. }
  5374. return peekedByte;
  5375. }
  5376. peekBytes(length) {
  5377. const bytes = this.getBytes(length);
  5378. this.pos -= bytes.length;
  5379. return bytes;
  5380. }
  5381. getUint16() {
  5382. const b0 = this.getByte();
  5383. const b1 = this.getByte();
  5384. if (b0 === -1 || b1 === -1) {
  5385. return -1;
  5386. }
  5387. return (b0 << 8) + b1;
  5388. }
  5389. getInt32() {
  5390. const b0 = this.getByte();
  5391. const b1 = this.getByte();
  5392. const b2 = this.getByte();
  5393. const b3 = this.getByte();
  5394. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  5395. }
  5396. getByteRange(begin, end) {
  5397. (0, _util.unreachable)("Abstract method `getByteRange` called");
  5398. }
  5399. getString(length) {
  5400. return (0, _util.bytesToString)(this.getBytes(length));
  5401. }
  5402. skip(n) {
  5403. this.pos += n || 1;
  5404. }
  5405. reset() {
  5406. (0, _util.unreachable)("Abstract method `reset` called");
  5407. }
  5408. moveStart() {
  5409. (0, _util.unreachable)("Abstract method `moveStart` called");
  5410. }
  5411. makeSubStream(start, length) {
  5412. let dict = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  5413. (0, _util.unreachable)("Abstract method `makeSubStream` called");
  5414. }
  5415. getBaseStreams() {
  5416. return null;
  5417. }
  5418. }
  5419. exports.BaseStream = BaseStream;
  5420. /***/ }),
  5421. /* 137 */
  5422. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  5423. "use strict";
  5424. Object.defineProperty(exports, "__esModule", ({
  5425. value: true
  5426. }));
  5427. exports.NetworkPdfManager = exports.LocalPdfManager = void 0;
  5428. var _util = __w_pdfjs_require__(2);
  5429. var _chunked_stream = __w_pdfjs_require__(138);
  5430. var _core_utils = __w_pdfjs_require__(135);
  5431. var _document = __w_pdfjs_require__(140);
  5432. var _stream = __w_pdfjs_require__(139);
  5433. function parseDocBaseUrl(url) {
  5434. if (url) {
  5435. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(url);
  5436. if (absoluteUrl) {
  5437. return absoluteUrl.href;
  5438. }
  5439. (0, _util.warn)(`Invalid absolute docBaseUrl: "${url}".`);
  5440. }
  5441. return null;
  5442. }
  5443. class BasePdfManager {
  5444. constructor() {
  5445. if (this.constructor === BasePdfManager) {
  5446. (0, _util.unreachable)("Cannot initialize BasePdfManager.");
  5447. }
  5448. }
  5449. get docId() {
  5450. return this._docId;
  5451. }
  5452. get password() {
  5453. return this._password;
  5454. }
  5455. get docBaseUrl() {
  5456. const catalog = this.pdfDocument.catalog;
  5457. return (0, _util.shadow)(this, "docBaseUrl", catalog.baseUrl || this._docBaseUrl);
  5458. }
  5459. ensureDoc(prop, args) {
  5460. return this.ensure(this.pdfDocument, prop, args);
  5461. }
  5462. ensureXRef(prop, args) {
  5463. return this.ensure(this.pdfDocument.xref, prop, args);
  5464. }
  5465. ensureCatalog(prop, args) {
  5466. return this.ensure(this.pdfDocument.catalog, prop, args);
  5467. }
  5468. getPage(pageIndex) {
  5469. return this.pdfDocument.getPage(pageIndex);
  5470. }
  5471. fontFallback(id, handler) {
  5472. return this.pdfDocument.fontFallback(id, handler);
  5473. }
  5474. loadXfaFonts(handler, task) {
  5475. return this.pdfDocument.loadXfaFonts(handler, task);
  5476. }
  5477. loadXfaImages() {
  5478. return this.pdfDocument.loadXfaImages();
  5479. }
  5480. serializeXfaData(annotationStorage) {
  5481. return this.pdfDocument.serializeXfaData(annotationStorage);
  5482. }
  5483. cleanup() {
  5484. let manuallyTriggered = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  5485. return this.pdfDocument.cleanup(manuallyTriggered);
  5486. }
  5487. async ensure(obj, prop, args) {
  5488. (0, _util.unreachable)("Abstract method `ensure` called");
  5489. }
  5490. requestRange(begin, end) {
  5491. (0, _util.unreachable)("Abstract method `requestRange` called");
  5492. }
  5493. requestLoadedStream() {
  5494. let noFetch = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  5495. (0, _util.unreachable)("Abstract method `requestLoadedStream` called");
  5496. }
  5497. sendProgressiveData(chunk) {
  5498. (0, _util.unreachable)("Abstract method `sendProgressiveData` called");
  5499. }
  5500. updatePassword(password) {
  5501. this._password = password;
  5502. }
  5503. terminate(reason) {
  5504. (0, _util.unreachable)("Abstract method `terminate` called");
  5505. }
  5506. }
  5507. class LocalPdfManager extends BasePdfManager {
  5508. constructor(docId, data, password, msgHandler, evaluatorOptions, enableXfa, docBaseUrl) {
  5509. super();
  5510. this._docId = docId;
  5511. this._password = password;
  5512. this._docBaseUrl = parseDocBaseUrl(docBaseUrl);
  5513. this.msgHandler = msgHandler;
  5514. this.evaluatorOptions = evaluatorOptions;
  5515. this.enableXfa = enableXfa;
  5516. const stream = new _stream.Stream(data);
  5517. this.pdfDocument = new _document.PDFDocument(this, stream);
  5518. this._loadedStreamPromise = Promise.resolve(stream);
  5519. }
  5520. async ensure(obj, prop, args) {
  5521. const value = obj[prop];
  5522. if (typeof value === "function") {
  5523. return value.apply(obj, args);
  5524. }
  5525. return value;
  5526. }
  5527. requestRange(begin, end) {
  5528. return Promise.resolve();
  5529. }
  5530. requestLoadedStream() {
  5531. let noFetch = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  5532. return this._loadedStreamPromise;
  5533. }
  5534. terminate(reason) {}
  5535. }
  5536. exports.LocalPdfManager = LocalPdfManager;
  5537. class NetworkPdfManager extends BasePdfManager {
  5538. constructor(docId, pdfNetworkStream, args, evaluatorOptions, enableXfa, docBaseUrl) {
  5539. super();
  5540. this._docId = docId;
  5541. this._password = args.password;
  5542. this._docBaseUrl = parseDocBaseUrl(docBaseUrl);
  5543. this.msgHandler = args.msgHandler;
  5544. this.evaluatorOptions = evaluatorOptions;
  5545. this.enableXfa = enableXfa;
  5546. this.streamManager = new _chunked_stream.ChunkedStreamManager(pdfNetworkStream, {
  5547. msgHandler: args.msgHandler,
  5548. length: args.length,
  5549. disableAutoFetch: args.disableAutoFetch,
  5550. rangeChunkSize: args.rangeChunkSize
  5551. });
  5552. this.pdfDocument = new _document.PDFDocument(this, this.streamManager.getStream());
  5553. }
  5554. async ensure(obj, prop, args) {
  5555. try {
  5556. const value = obj[prop];
  5557. if (typeof value === "function") {
  5558. return value.apply(obj, args);
  5559. }
  5560. return value;
  5561. } catch (ex) {
  5562. if (!(ex instanceof _core_utils.MissingDataException)) {
  5563. throw ex;
  5564. }
  5565. await this.requestRange(ex.begin, ex.end);
  5566. return this.ensure(obj, prop, args);
  5567. }
  5568. }
  5569. requestRange(begin, end) {
  5570. return this.streamManager.requestRange(begin, end);
  5571. }
  5572. requestLoadedStream() {
  5573. let noFetch = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  5574. return this.streamManager.requestAllChunks(noFetch);
  5575. }
  5576. sendProgressiveData(chunk) {
  5577. this.streamManager.onReceiveData({
  5578. chunk
  5579. });
  5580. }
  5581. terminate(reason) {
  5582. this.streamManager.abort(reason);
  5583. }
  5584. }
  5585. exports.NetworkPdfManager = NetworkPdfManager;
  5586. /***/ }),
  5587. /* 138 */
  5588. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  5589. "use strict";
  5590. Object.defineProperty(exports, "__esModule", ({
  5591. value: true
  5592. }));
  5593. exports.ChunkedStreamManager = exports.ChunkedStream = void 0;
  5594. var _util = __w_pdfjs_require__(2);
  5595. var _core_utils = __w_pdfjs_require__(135);
  5596. var _stream = __w_pdfjs_require__(139);
  5597. class ChunkedStream extends _stream.Stream {
  5598. constructor(length, chunkSize, manager) {
  5599. super(new Uint8Array(length), 0, length, null);
  5600. this.chunkSize = chunkSize;
  5601. this._loadedChunks = new Set();
  5602. this.numChunks = Math.ceil(length / chunkSize);
  5603. this.manager = manager;
  5604. this.progressiveDataLength = 0;
  5605. this.lastSuccessfulEnsureByteChunk = -1;
  5606. }
  5607. getMissingChunks() {
  5608. const chunks = [];
  5609. for (let chunk = 0, n = this.numChunks; chunk < n; ++chunk) {
  5610. if (!this._loadedChunks.has(chunk)) {
  5611. chunks.push(chunk);
  5612. }
  5613. }
  5614. return chunks;
  5615. }
  5616. get numChunksLoaded() {
  5617. return this._loadedChunks.size;
  5618. }
  5619. get isDataLoaded() {
  5620. return this.numChunksLoaded === this.numChunks;
  5621. }
  5622. onReceiveData(begin, chunk) {
  5623. const chunkSize = this.chunkSize;
  5624. if (begin % chunkSize !== 0) {
  5625. throw new Error(`Bad begin offset: ${begin}`);
  5626. }
  5627. const end = begin + chunk.byteLength;
  5628. if (end % chunkSize !== 0 && end !== this.bytes.length) {
  5629. throw new Error(`Bad end offset: ${end}`);
  5630. }
  5631. this.bytes.set(new Uint8Array(chunk), begin);
  5632. const beginChunk = Math.floor(begin / chunkSize);
  5633. const endChunk = Math.floor((end - 1) / chunkSize) + 1;
  5634. for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  5635. this._loadedChunks.add(curChunk);
  5636. }
  5637. }
  5638. onReceiveProgressiveData(data) {
  5639. let position = this.progressiveDataLength;
  5640. const beginChunk = Math.floor(position / this.chunkSize);
  5641. this.bytes.set(new Uint8Array(data), position);
  5642. position += data.byteLength;
  5643. this.progressiveDataLength = position;
  5644. const endChunk = position >= this.end ? this.numChunks : Math.floor(position / this.chunkSize);
  5645. for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  5646. this._loadedChunks.add(curChunk);
  5647. }
  5648. }
  5649. ensureByte(pos) {
  5650. if (pos < this.progressiveDataLength) {
  5651. return;
  5652. }
  5653. const chunk = Math.floor(pos / this.chunkSize);
  5654. if (chunk > this.numChunks) {
  5655. return;
  5656. }
  5657. if (chunk === this.lastSuccessfulEnsureByteChunk) {
  5658. return;
  5659. }
  5660. if (!this._loadedChunks.has(chunk)) {
  5661. throw new _core_utils.MissingDataException(pos, pos + 1);
  5662. }
  5663. this.lastSuccessfulEnsureByteChunk = chunk;
  5664. }
  5665. ensureRange(begin, end) {
  5666. if (begin >= end) {
  5667. return;
  5668. }
  5669. if (end <= this.progressiveDataLength) {
  5670. return;
  5671. }
  5672. const beginChunk = Math.floor(begin / this.chunkSize);
  5673. if (beginChunk > this.numChunks) {
  5674. return;
  5675. }
  5676. const endChunk = Math.min(Math.floor((end - 1) / this.chunkSize) + 1, this.numChunks);
  5677. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  5678. if (!this._loadedChunks.has(chunk)) {
  5679. throw new _core_utils.MissingDataException(begin, end);
  5680. }
  5681. }
  5682. }
  5683. nextEmptyChunk(beginChunk) {
  5684. const numChunks = this.numChunks;
  5685. for (let i = 0; i < numChunks; ++i) {
  5686. const chunk = (beginChunk + i) % numChunks;
  5687. if (!this._loadedChunks.has(chunk)) {
  5688. return chunk;
  5689. }
  5690. }
  5691. return null;
  5692. }
  5693. hasChunk(chunk) {
  5694. return this._loadedChunks.has(chunk);
  5695. }
  5696. getByte() {
  5697. const pos = this.pos;
  5698. if (pos >= this.end) {
  5699. return -1;
  5700. }
  5701. if (pos >= this.progressiveDataLength) {
  5702. this.ensureByte(pos);
  5703. }
  5704. return this.bytes[this.pos++];
  5705. }
  5706. getBytes(length) {
  5707. const bytes = this.bytes;
  5708. const pos = this.pos;
  5709. const strEnd = this.end;
  5710. if (!length) {
  5711. if (strEnd > this.progressiveDataLength) {
  5712. this.ensureRange(pos, strEnd);
  5713. }
  5714. return bytes.subarray(pos, strEnd);
  5715. }
  5716. let end = pos + length;
  5717. if (end > strEnd) {
  5718. end = strEnd;
  5719. }
  5720. if (end > this.progressiveDataLength) {
  5721. this.ensureRange(pos, end);
  5722. }
  5723. this.pos = end;
  5724. return bytes.subarray(pos, end);
  5725. }
  5726. getByteRange(begin, end) {
  5727. if (begin < 0) {
  5728. begin = 0;
  5729. }
  5730. if (end > this.end) {
  5731. end = this.end;
  5732. }
  5733. if (end > this.progressiveDataLength) {
  5734. this.ensureRange(begin, end);
  5735. }
  5736. return this.bytes.subarray(begin, end);
  5737. }
  5738. makeSubStream(start, length) {
  5739. let dict = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  5740. if (length) {
  5741. if (start + length > this.progressiveDataLength) {
  5742. this.ensureRange(start, start + length);
  5743. }
  5744. } else {
  5745. if (start >= this.progressiveDataLength) {
  5746. this.ensureByte(start);
  5747. }
  5748. }
  5749. function ChunkedStreamSubstream() {}
  5750. ChunkedStreamSubstream.prototype = Object.create(this);
  5751. ChunkedStreamSubstream.prototype.getMissingChunks = function () {
  5752. const chunkSize = this.chunkSize;
  5753. const beginChunk = Math.floor(this.start / chunkSize);
  5754. const endChunk = Math.floor((this.end - 1) / chunkSize) + 1;
  5755. const missingChunks = [];
  5756. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  5757. if (!this._loadedChunks.has(chunk)) {
  5758. missingChunks.push(chunk);
  5759. }
  5760. }
  5761. return missingChunks;
  5762. };
  5763. Object.defineProperty(ChunkedStreamSubstream.prototype, "isDataLoaded", {
  5764. get() {
  5765. if (this.numChunksLoaded === this.numChunks) {
  5766. return true;
  5767. }
  5768. return this.getMissingChunks().length === 0;
  5769. },
  5770. configurable: true
  5771. });
  5772. const subStream = new ChunkedStreamSubstream();
  5773. subStream.pos = subStream.start = start;
  5774. subStream.end = start + length || this.end;
  5775. subStream.dict = dict;
  5776. return subStream;
  5777. }
  5778. getBaseStreams() {
  5779. return [this];
  5780. }
  5781. }
  5782. exports.ChunkedStream = ChunkedStream;
  5783. class ChunkedStreamManager {
  5784. constructor(pdfNetworkStream, args) {
  5785. this.length = args.length;
  5786. this.chunkSize = args.rangeChunkSize;
  5787. this.stream = new ChunkedStream(this.length, this.chunkSize, this);
  5788. this.pdfNetworkStream = pdfNetworkStream;
  5789. this.disableAutoFetch = args.disableAutoFetch;
  5790. this.msgHandler = args.msgHandler;
  5791. this.currRequestId = 0;
  5792. this._chunksNeededByRequest = new Map();
  5793. this._requestsByChunk = new Map();
  5794. this._promisesByRequest = new Map();
  5795. this.progressiveDataLength = 0;
  5796. this.aborted = false;
  5797. this._loadedStreamCapability = (0, _util.createPromiseCapability)();
  5798. }
  5799. sendRequest(begin, end) {
  5800. const rangeReader = this.pdfNetworkStream.getRangeReader(begin, end);
  5801. if (!rangeReader.isStreamingSupported) {
  5802. rangeReader.onProgress = this.onProgress.bind(this);
  5803. }
  5804. let chunks = [],
  5805. loaded = 0;
  5806. return new Promise((resolve, reject) => {
  5807. const readChunk = chunk => {
  5808. try {
  5809. if (!chunk.done) {
  5810. const data = chunk.value;
  5811. chunks.push(data);
  5812. loaded += (0, _util.arrayByteLength)(data);
  5813. if (rangeReader.isStreamingSupported) {
  5814. this.onProgress({
  5815. loaded
  5816. });
  5817. }
  5818. rangeReader.read().then(readChunk, reject);
  5819. return;
  5820. }
  5821. const chunkData = (0, _util.arraysToBytes)(chunks);
  5822. chunks = null;
  5823. resolve(chunkData);
  5824. } catch (e) {
  5825. reject(e);
  5826. }
  5827. };
  5828. rangeReader.read().then(readChunk, reject);
  5829. }).then(data => {
  5830. if (this.aborted) {
  5831. return;
  5832. }
  5833. this.onReceiveData({
  5834. chunk: data,
  5835. begin
  5836. });
  5837. });
  5838. }
  5839. requestAllChunks() {
  5840. let noFetch = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  5841. if (!noFetch) {
  5842. const missingChunks = this.stream.getMissingChunks();
  5843. this._requestChunks(missingChunks);
  5844. }
  5845. return this._loadedStreamCapability.promise;
  5846. }
  5847. _requestChunks(chunks) {
  5848. const requestId = this.currRequestId++;
  5849. const chunksNeeded = new Set();
  5850. this._chunksNeededByRequest.set(requestId, chunksNeeded);
  5851. for (const chunk of chunks) {
  5852. if (!this.stream.hasChunk(chunk)) {
  5853. chunksNeeded.add(chunk);
  5854. }
  5855. }
  5856. if (chunksNeeded.size === 0) {
  5857. return Promise.resolve();
  5858. }
  5859. const capability = (0, _util.createPromiseCapability)();
  5860. this._promisesByRequest.set(requestId, capability);
  5861. const chunksToRequest = [];
  5862. for (const chunk of chunksNeeded) {
  5863. let requestIds = this._requestsByChunk.get(chunk);
  5864. if (!requestIds) {
  5865. requestIds = [];
  5866. this._requestsByChunk.set(chunk, requestIds);
  5867. chunksToRequest.push(chunk);
  5868. }
  5869. requestIds.push(requestId);
  5870. }
  5871. if (chunksToRequest.length > 0) {
  5872. const groupedChunksToRequest = this.groupChunks(chunksToRequest);
  5873. for (const groupedChunk of groupedChunksToRequest) {
  5874. const begin = groupedChunk.beginChunk * this.chunkSize;
  5875. const end = Math.min(groupedChunk.endChunk * this.chunkSize, this.length);
  5876. this.sendRequest(begin, end).catch(capability.reject);
  5877. }
  5878. }
  5879. return capability.promise.catch(reason => {
  5880. if (this.aborted) {
  5881. return;
  5882. }
  5883. throw reason;
  5884. });
  5885. }
  5886. getStream() {
  5887. return this.stream;
  5888. }
  5889. requestRange(begin, end) {
  5890. end = Math.min(end, this.length);
  5891. const beginChunk = this.getBeginChunk(begin);
  5892. const endChunk = this.getEndChunk(end);
  5893. const chunks = [];
  5894. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  5895. chunks.push(chunk);
  5896. }
  5897. return this._requestChunks(chunks);
  5898. }
  5899. requestRanges() {
  5900. let ranges = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  5901. const chunksToRequest = [];
  5902. for (const range of ranges) {
  5903. const beginChunk = this.getBeginChunk(range.begin);
  5904. const endChunk = this.getEndChunk(range.end);
  5905. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  5906. if (!chunksToRequest.includes(chunk)) {
  5907. chunksToRequest.push(chunk);
  5908. }
  5909. }
  5910. }
  5911. chunksToRequest.sort(function (a, b) {
  5912. return a - b;
  5913. });
  5914. return this._requestChunks(chunksToRequest);
  5915. }
  5916. groupChunks(chunks) {
  5917. const groupedChunks = [];
  5918. let beginChunk = -1;
  5919. let prevChunk = -1;
  5920. for (let i = 0, ii = chunks.length; i < ii; ++i) {
  5921. const chunk = chunks[i];
  5922. if (beginChunk < 0) {
  5923. beginChunk = chunk;
  5924. }
  5925. if (prevChunk >= 0 && prevChunk + 1 !== chunk) {
  5926. groupedChunks.push({
  5927. beginChunk,
  5928. endChunk: prevChunk + 1
  5929. });
  5930. beginChunk = chunk;
  5931. }
  5932. if (i + 1 === chunks.length) {
  5933. groupedChunks.push({
  5934. beginChunk,
  5935. endChunk: chunk + 1
  5936. });
  5937. }
  5938. prevChunk = chunk;
  5939. }
  5940. return groupedChunks;
  5941. }
  5942. onProgress(args) {
  5943. this.msgHandler.send("DocProgress", {
  5944. loaded: this.stream.numChunksLoaded * this.chunkSize + args.loaded,
  5945. total: this.length
  5946. });
  5947. }
  5948. onReceiveData(args) {
  5949. const chunk = args.chunk;
  5950. const isProgressive = args.begin === undefined;
  5951. const begin = isProgressive ? this.progressiveDataLength : args.begin;
  5952. const end = begin + chunk.byteLength;
  5953. const beginChunk = Math.floor(begin / this.chunkSize);
  5954. const endChunk = end < this.length ? Math.floor(end / this.chunkSize) : Math.ceil(end / this.chunkSize);
  5955. if (isProgressive) {
  5956. this.stream.onReceiveProgressiveData(chunk);
  5957. this.progressiveDataLength = end;
  5958. } else {
  5959. this.stream.onReceiveData(begin, chunk);
  5960. }
  5961. if (this.stream.isDataLoaded) {
  5962. this._loadedStreamCapability.resolve(this.stream);
  5963. }
  5964. const loadedRequests = [];
  5965. for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  5966. const requestIds = this._requestsByChunk.get(curChunk);
  5967. if (!requestIds) {
  5968. continue;
  5969. }
  5970. this._requestsByChunk.delete(curChunk);
  5971. for (const requestId of requestIds) {
  5972. const chunksNeeded = this._chunksNeededByRequest.get(requestId);
  5973. if (chunksNeeded.has(curChunk)) {
  5974. chunksNeeded.delete(curChunk);
  5975. }
  5976. if (chunksNeeded.size > 0) {
  5977. continue;
  5978. }
  5979. loadedRequests.push(requestId);
  5980. }
  5981. }
  5982. if (!this.disableAutoFetch && this._requestsByChunk.size === 0) {
  5983. let nextEmptyChunk;
  5984. if (this.stream.numChunksLoaded === 1) {
  5985. const lastChunk = this.stream.numChunks - 1;
  5986. if (!this.stream.hasChunk(lastChunk)) {
  5987. nextEmptyChunk = lastChunk;
  5988. }
  5989. } else {
  5990. nextEmptyChunk = this.stream.nextEmptyChunk(endChunk);
  5991. }
  5992. if (Number.isInteger(nextEmptyChunk)) {
  5993. this._requestChunks([nextEmptyChunk]);
  5994. }
  5995. }
  5996. for (const requestId of loadedRequests) {
  5997. const capability = this._promisesByRequest.get(requestId);
  5998. this._promisesByRequest.delete(requestId);
  5999. capability.resolve();
  6000. }
  6001. this.msgHandler.send("DocProgress", {
  6002. loaded: this.stream.numChunksLoaded * this.chunkSize,
  6003. total: this.length
  6004. });
  6005. }
  6006. onError(err) {
  6007. this._loadedStreamCapability.reject(err);
  6008. }
  6009. getBeginChunk(begin) {
  6010. return Math.floor(begin / this.chunkSize);
  6011. }
  6012. getEndChunk(end) {
  6013. return Math.floor((end - 1) / this.chunkSize) + 1;
  6014. }
  6015. abort(reason) {
  6016. this.aborted = true;
  6017. if (this.pdfNetworkStream) {
  6018. this.pdfNetworkStream.cancelAllRequests(reason);
  6019. }
  6020. for (const capability of this._promisesByRequest.values()) {
  6021. capability.reject(reason);
  6022. }
  6023. }
  6024. }
  6025. exports.ChunkedStreamManager = ChunkedStreamManager;
  6026. /***/ }),
  6027. /* 139 */
  6028. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  6029. "use strict";
  6030. Object.defineProperty(exports, "__esModule", ({
  6031. value: true
  6032. }));
  6033. exports.StringStream = exports.Stream = exports.NullStream = void 0;
  6034. var _base_stream = __w_pdfjs_require__(136);
  6035. var _util = __w_pdfjs_require__(2);
  6036. class Stream extends _base_stream.BaseStream {
  6037. constructor(arrayBuffer, start, length, dict) {
  6038. super();
  6039. this.bytes = arrayBuffer instanceof Uint8Array ? arrayBuffer : new Uint8Array(arrayBuffer);
  6040. this.start = start || 0;
  6041. this.pos = this.start;
  6042. this.end = start + length || this.bytes.length;
  6043. this.dict = dict;
  6044. }
  6045. get length() {
  6046. return this.end - this.start;
  6047. }
  6048. get isEmpty() {
  6049. return this.length === 0;
  6050. }
  6051. getByte() {
  6052. if (this.pos >= this.end) {
  6053. return -1;
  6054. }
  6055. return this.bytes[this.pos++];
  6056. }
  6057. getBytes(length) {
  6058. const bytes = this.bytes;
  6059. const pos = this.pos;
  6060. const strEnd = this.end;
  6061. if (!length) {
  6062. return bytes.subarray(pos, strEnd);
  6063. }
  6064. let end = pos + length;
  6065. if (end > strEnd) {
  6066. end = strEnd;
  6067. }
  6068. this.pos = end;
  6069. return bytes.subarray(pos, end);
  6070. }
  6071. getByteRange(begin, end) {
  6072. if (begin < 0) {
  6073. begin = 0;
  6074. }
  6075. if (end > this.end) {
  6076. end = this.end;
  6077. }
  6078. return this.bytes.subarray(begin, end);
  6079. }
  6080. reset() {
  6081. this.pos = this.start;
  6082. }
  6083. moveStart() {
  6084. this.start = this.pos;
  6085. }
  6086. makeSubStream(start, length) {
  6087. let dict = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  6088. return new Stream(this.bytes.buffer, start, length, dict);
  6089. }
  6090. }
  6091. exports.Stream = Stream;
  6092. class StringStream extends Stream {
  6093. constructor(str) {
  6094. super((0, _util.stringToBytes)(str));
  6095. }
  6096. }
  6097. exports.StringStream = StringStream;
  6098. class NullStream extends Stream {
  6099. constructor() {
  6100. super(new Uint8Array(0));
  6101. }
  6102. }
  6103. exports.NullStream = NullStream;
  6104. /***/ }),
  6105. /* 140 */
  6106. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  6107. "use strict";
  6108. Object.defineProperty(exports, "__esModule", ({
  6109. value: true
  6110. }));
  6111. exports.Page = exports.PDFDocument = void 0;
  6112. var _annotation = __w_pdfjs_require__(141);
  6113. var _util = __w_pdfjs_require__(2);
  6114. var _core_utils = __w_pdfjs_require__(135);
  6115. var _primitives = __w_pdfjs_require__(134);
  6116. var _xfa_fonts = __w_pdfjs_require__(180);
  6117. var _base_stream = __w_pdfjs_require__(136);
  6118. var _crypto = __w_pdfjs_require__(196);
  6119. var _catalog = __w_pdfjs_require__(198);
  6120. var _cleanup_helper = __w_pdfjs_require__(200);
  6121. var _dataset_reader = __w_pdfjs_require__(229);
  6122. var _parser = __w_pdfjs_require__(146);
  6123. var _stream = __w_pdfjs_require__(139);
  6124. var _object_loader = __w_pdfjs_require__(204);
  6125. var _operator_list = __w_pdfjs_require__(191);
  6126. var _evaluator = __w_pdfjs_require__(144);
  6127. var _decode_stream = __w_pdfjs_require__(148);
  6128. var _struct_tree = __w_pdfjs_require__(203);
  6129. var _writer = __w_pdfjs_require__(194);
  6130. var _factory = __w_pdfjs_require__(205);
  6131. var _xref = __w_pdfjs_require__(230);
  6132. const DEFAULT_USER_UNIT = 1.0;
  6133. const LETTER_SIZE_MEDIABOX = [0, 0, 612, 792];
  6134. class Page {
  6135. constructor(_ref) {
  6136. let {
  6137. pdfManager,
  6138. xref,
  6139. pageIndex,
  6140. pageDict,
  6141. ref,
  6142. globalIdFactory,
  6143. fontCache,
  6144. builtInCMapCache,
  6145. standardFontDataCache,
  6146. globalImageCache,
  6147. nonBlendModesSet,
  6148. xfaFactory
  6149. } = _ref;
  6150. this.pdfManager = pdfManager;
  6151. this.pageIndex = pageIndex;
  6152. this.pageDict = pageDict;
  6153. this.xref = xref;
  6154. this.ref = ref;
  6155. this.fontCache = fontCache;
  6156. this.builtInCMapCache = builtInCMapCache;
  6157. this.standardFontDataCache = standardFontDataCache;
  6158. this.globalImageCache = globalImageCache;
  6159. this.nonBlendModesSet = nonBlendModesSet;
  6160. this.evaluatorOptions = pdfManager.evaluatorOptions;
  6161. this.resourcesPromise = null;
  6162. this.xfaFactory = xfaFactory;
  6163. const idCounters = {
  6164. obj: 0
  6165. };
  6166. this._localIdFactory = class extends globalIdFactory {
  6167. static createObjId() {
  6168. return `p${pageIndex}_${++idCounters.obj}`;
  6169. }
  6170. static getPageObjId() {
  6171. return `page${ref.toString()}`;
  6172. }
  6173. };
  6174. }
  6175. _getInheritableProperty(key) {
  6176. let getArray = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  6177. const value = (0, _core_utils.getInheritableProperty)({
  6178. dict: this.pageDict,
  6179. key,
  6180. getArray,
  6181. stopWhenFound: false
  6182. });
  6183. if (!Array.isArray(value)) {
  6184. return value;
  6185. }
  6186. if (value.length === 1 || !(value[0] instanceof _primitives.Dict)) {
  6187. return value[0];
  6188. }
  6189. return _primitives.Dict.merge({
  6190. xref: this.xref,
  6191. dictArray: value
  6192. });
  6193. }
  6194. get content() {
  6195. return this.pageDict.getArray("Contents");
  6196. }
  6197. get resources() {
  6198. const resources = this._getInheritableProperty("Resources");
  6199. return (0, _util.shadow)(this, "resources", resources instanceof _primitives.Dict ? resources : _primitives.Dict.empty);
  6200. }
  6201. _getBoundingBox(name) {
  6202. if (this.xfaData) {
  6203. return this.xfaData.bbox;
  6204. }
  6205. const box = this._getInheritableProperty(name, true);
  6206. if (Array.isArray(box) && box.length === 4) {
  6207. if (box[2] - box[0] !== 0 && box[3] - box[1] !== 0) {
  6208. return box;
  6209. }
  6210. (0, _util.warn)(`Empty /${name} entry.`);
  6211. }
  6212. return null;
  6213. }
  6214. get mediaBox() {
  6215. return (0, _util.shadow)(this, "mediaBox", this._getBoundingBox("MediaBox") || LETTER_SIZE_MEDIABOX);
  6216. }
  6217. get cropBox() {
  6218. return (0, _util.shadow)(this, "cropBox", this._getBoundingBox("CropBox") || this.mediaBox);
  6219. }
  6220. get userUnit() {
  6221. let obj = this.pageDict.get("UserUnit");
  6222. if (typeof obj !== "number" || obj <= 0) {
  6223. obj = DEFAULT_USER_UNIT;
  6224. }
  6225. return (0, _util.shadow)(this, "userUnit", obj);
  6226. }
  6227. get view() {
  6228. const {
  6229. cropBox,
  6230. mediaBox
  6231. } = this;
  6232. let view;
  6233. if (cropBox === mediaBox || (0, _util.isArrayEqual)(cropBox, mediaBox)) {
  6234. view = mediaBox;
  6235. } else {
  6236. const box = _util.Util.intersect(cropBox, mediaBox);
  6237. if (box && box[2] - box[0] !== 0 && box[3] - box[1] !== 0) {
  6238. view = box;
  6239. } else {
  6240. (0, _util.warn)("Empty /CropBox and /MediaBox intersection.");
  6241. }
  6242. }
  6243. return (0, _util.shadow)(this, "view", view || mediaBox);
  6244. }
  6245. get rotate() {
  6246. let rotate = this._getInheritableProperty("Rotate") || 0;
  6247. if (rotate % 90 !== 0) {
  6248. rotate = 0;
  6249. } else if (rotate >= 360) {
  6250. rotate %= 360;
  6251. } else if (rotate < 0) {
  6252. rotate = (rotate % 360 + 360) % 360;
  6253. }
  6254. return (0, _util.shadow)(this, "rotate", rotate);
  6255. }
  6256. _onSubStreamError(handler, reason, objId) {
  6257. if (this.evaluatorOptions.ignoreErrors) {
  6258. handler.send("UnsupportedFeature", {
  6259. featureId: _util.UNSUPPORTED_FEATURES.errorContentSubStream
  6260. });
  6261. (0, _util.warn)(`getContentStream - ignoring sub-stream (${objId}): "${reason}".`);
  6262. return;
  6263. }
  6264. throw reason;
  6265. }
  6266. getContentStream(handler) {
  6267. return this.pdfManager.ensure(this, "content").then(content => {
  6268. if (content instanceof _base_stream.BaseStream) {
  6269. return content;
  6270. }
  6271. if (Array.isArray(content)) {
  6272. return new _decode_stream.StreamsSequenceStream(content, this._onSubStreamError.bind(this, handler));
  6273. }
  6274. return new _stream.NullStream();
  6275. });
  6276. }
  6277. get xfaData() {
  6278. return (0, _util.shadow)(this, "xfaData", this.xfaFactory ? {
  6279. bbox: this.xfaFactory.getBoundingBox(this.pageIndex)
  6280. } : null);
  6281. }
  6282. async saveNewAnnotations(handler, task, annotations) {
  6283. if (this.xfaFactory) {
  6284. throw new Error("XFA: Cannot save new annotations.");
  6285. }
  6286. const partialEvaluator = new _evaluator.PartialEvaluator({
  6287. xref: this.xref,
  6288. handler,
  6289. pageIndex: this.pageIndex,
  6290. idFactory: this._localIdFactory,
  6291. fontCache: this.fontCache,
  6292. builtInCMapCache: this.builtInCMapCache,
  6293. standardFontDataCache: this.standardFontDataCache,
  6294. globalImageCache: this.globalImageCache,
  6295. options: this.evaluatorOptions
  6296. });
  6297. const pageDict = this.pageDict;
  6298. const annotationsArray = this.annotations.slice();
  6299. const newData = await _annotation.AnnotationFactory.saveNewAnnotations(partialEvaluator, task, annotations);
  6300. for (const {
  6301. ref
  6302. } of newData.annotations) {
  6303. annotationsArray.push(ref);
  6304. }
  6305. const savedDict = pageDict.get("Annots");
  6306. pageDict.set("Annots", annotationsArray);
  6307. const buffer = [];
  6308. let transform = null;
  6309. if (this.xref.encrypt) {
  6310. transform = this.xref.encrypt.createCipherTransform(this.ref.num, this.ref.gen);
  6311. }
  6312. (0, _writer.writeObject)(this.ref, pageDict, buffer, transform);
  6313. if (savedDict) {
  6314. pageDict.set("Annots", savedDict);
  6315. }
  6316. const objects = newData.dependencies;
  6317. objects.push({
  6318. ref: this.ref,
  6319. data: buffer.join("")
  6320. }, ...newData.annotations);
  6321. return objects;
  6322. }
  6323. save(handler, task, annotationStorage) {
  6324. const partialEvaluator = new _evaluator.PartialEvaluator({
  6325. xref: this.xref,
  6326. handler,
  6327. pageIndex: this.pageIndex,
  6328. idFactory: this._localIdFactory,
  6329. fontCache: this.fontCache,
  6330. builtInCMapCache: this.builtInCMapCache,
  6331. standardFontDataCache: this.standardFontDataCache,
  6332. globalImageCache: this.globalImageCache,
  6333. options: this.evaluatorOptions
  6334. });
  6335. return this._parsedAnnotations.then(function (annotations) {
  6336. const newRefsPromises = [];
  6337. for (const annotation of annotations) {
  6338. if (!annotation.mustBePrinted(annotationStorage)) {
  6339. continue;
  6340. }
  6341. newRefsPromises.push(annotation.save(partialEvaluator, task, annotationStorage).catch(function (reason) {
  6342. (0, _util.warn)("save - ignoring annotation data during " + `"${task.name}" task: "${reason}".`);
  6343. return null;
  6344. }));
  6345. }
  6346. return Promise.all(newRefsPromises).then(function (newRefs) {
  6347. return newRefs.filter(newRef => !!newRef);
  6348. });
  6349. });
  6350. }
  6351. loadResources(keys) {
  6352. if (!this.resourcesPromise) {
  6353. this.resourcesPromise = this.pdfManager.ensure(this, "resources");
  6354. }
  6355. return this.resourcesPromise.then(() => {
  6356. const objectLoader = new _object_loader.ObjectLoader(this.resources, keys, this.xref);
  6357. return objectLoader.load();
  6358. });
  6359. }
  6360. getOperatorList(_ref2) {
  6361. let {
  6362. handler,
  6363. sink,
  6364. task,
  6365. intent,
  6366. cacheKey,
  6367. annotationStorage = null
  6368. } = _ref2;
  6369. const contentStreamPromise = this.getContentStream(handler);
  6370. const resourcesPromise = this.loadResources(["ColorSpace", "ExtGState", "Font", "Pattern", "Properties", "Shading", "XObject"]);
  6371. const partialEvaluator = new _evaluator.PartialEvaluator({
  6372. xref: this.xref,
  6373. handler,
  6374. pageIndex: this.pageIndex,
  6375. idFactory: this._localIdFactory,
  6376. fontCache: this.fontCache,
  6377. builtInCMapCache: this.builtInCMapCache,
  6378. standardFontDataCache: this.standardFontDataCache,
  6379. globalImageCache: this.globalImageCache,
  6380. options: this.evaluatorOptions
  6381. });
  6382. const newAnnotationsByPage = !this.xfaFactory ? (0, _core_utils.getNewAnnotationsMap)(annotationStorage) : null;
  6383. let newAnnotationsPromise = Promise.resolve(null);
  6384. if (newAnnotationsByPage) {
  6385. const newAnnotations = newAnnotationsByPage.get(this.pageIndex);
  6386. if (newAnnotations) {
  6387. newAnnotationsPromise = _annotation.AnnotationFactory.printNewAnnotations(partialEvaluator, task, newAnnotations);
  6388. }
  6389. }
  6390. const dataPromises = Promise.all([contentStreamPromise, resourcesPromise]);
  6391. const pageListPromise = dataPromises.then(_ref3 => {
  6392. let [contentStream] = _ref3;
  6393. const opList = new _operator_list.OperatorList(intent, sink);
  6394. handler.send("StartRenderPage", {
  6395. transparency: partialEvaluator.hasBlendModes(this.resources, this.nonBlendModesSet),
  6396. pageIndex: this.pageIndex,
  6397. cacheKey
  6398. });
  6399. return partialEvaluator.getOperatorList({
  6400. stream: contentStream,
  6401. task,
  6402. resources: this.resources,
  6403. operatorList: opList
  6404. }).then(function () {
  6405. return opList;
  6406. });
  6407. });
  6408. return Promise.all([pageListPromise, this._parsedAnnotations, newAnnotationsPromise]).then(function (_ref4) {
  6409. let [pageOpList, annotations, newAnnotations] = _ref4;
  6410. if (newAnnotations) {
  6411. annotations = annotations.concat(newAnnotations);
  6412. }
  6413. if (annotations.length === 0 || intent & _util.RenderingIntentFlag.ANNOTATIONS_DISABLE) {
  6414. pageOpList.flush(true);
  6415. return {
  6416. length: pageOpList.totalLength
  6417. };
  6418. }
  6419. const renderForms = !!(intent & _util.RenderingIntentFlag.ANNOTATIONS_FORMS),
  6420. intentAny = !!(intent & _util.RenderingIntentFlag.ANY),
  6421. intentDisplay = !!(intent & _util.RenderingIntentFlag.DISPLAY),
  6422. intentPrint = !!(intent & _util.RenderingIntentFlag.PRINT);
  6423. const opListPromises = [];
  6424. for (const annotation of annotations) {
  6425. if (intentAny || intentDisplay && annotation.mustBeViewed(annotationStorage) || intentPrint && annotation.mustBePrinted(annotationStorage)) {
  6426. opListPromises.push(annotation.getOperatorList(partialEvaluator, task, intent, renderForms, annotationStorage).catch(function (reason) {
  6427. (0, _util.warn)("getOperatorList - ignoring annotation data during " + `"${task.name}" task: "${reason}".`);
  6428. return {
  6429. opList: null,
  6430. separateForm: false,
  6431. separateCanvas: false
  6432. };
  6433. }));
  6434. }
  6435. }
  6436. return Promise.all(opListPromises).then(function (opLists) {
  6437. let form = false,
  6438. canvas = false;
  6439. for (const {
  6440. opList,
  6441. separateForm,
  6442. separateCanvas
  6443. } of opLists) {
  6444. pageOpList.addOpList(opList);
  6445. if (separateForm) {
  6446. form = separateForm;
  6447. }
  6448. if (separateCanvas) {
  6449. canvas = separateCanvas;
  6450. }
  6451. }
  6452. pageOpList.flush(true, {
  6453. form,
  6454. canvas
  6455. });
  6456. return {
  6457. length: pageOpList.totalLength
  6458. };
  6459. });
  6460. });
  6461. }
  6462. extractTextContent(_ref5) {
  6463. let {
  6464. handler,
  6465. task,
  6466. includeMarkedContent,
  6467. sink,
  6468. combineTextItems
  6469. } = _ref5;
  6470. const contentStreamPromise = this.getContentStream(handler);
  6471. const resourcesPromise = this.loadResources(["ExtGState", "Font", "Properties", "XObject"]);
  6472. const dataPromises = Promise.all([contentStreamPromise, resourcesPromise]);
  6473. return dataPromises.then(_ref6 => {
  6474. let [contentStream] = _ref6;
  6475. const partialEvaluator = new _evaluator.PartialEvaluator({
  6476. xref: this.xref,
  6477. handler,
  6478. pageIndex: this.pageIndex,
  6479. idFactory: this._localIdFactory,
  6480. fontCache: this.fontCache,
  6481. builtInCMapCache: this.builtInCMapCache,
  6482. standardFontDataCache: this.standardFontDataCache,
  6483. globalImageCache: this.globalImageCache,
  6484. options: this.evaluatorOptions
  6485. });
  6486. return partialEvaluator.getTextContent({
  6487. stream: contentStream,
  6488. task,
  6489. resources: this.resources,
  6490. includeMarkedContent,
  6491. combineTextItems,
  6492. sink,
  6493. viewBox: this.view
  6494. });
  6495. });
  6496. }
  6497. async getStructTree() {
  6498. const structTreeRoot = await this.pdfManager.ensureCatalog("structTreeRoot");
  6499. if (!structTreeRoot) {
  6500. return null;
  6501. }
  6502. const structTree = await this.pdfManager.ensure(this, "_parseStructTree", [structTreeRoot]);
  6503. return structTree.serializable;
  6504. }
  6505. _parseStructTree(structTreeRoot) {
  6506. const tree = new _struct_tree.StructTreePage(structTreeRoot, this.pageDict);
  6507. tree.parse();
  6508. return tree;
  6509. }
  6510. async getAnnotationsData(handler, task, intent) {
  6511. const annotations = await this._parsedAnnotations;
  6512. if (annotations.length === 0) {
  6513. return [];
  6514. }
  6515. const textContentPromises = [];
  6516. const annotationsData = [];
  6517. let partialEvaluator;
  6518. const intentAny = !!(intent & _util.RenderingIntentFlag.ANY),
  6519. intentDisplay = !!(intent & _util.RenderingIntentFlag.DISPLAY),
  6520. intentPrint = !!(intent & _util.RenderingIntentFlag.PRINT);
  6521. for (const annotation of annotations) {
  6522. const isVisible = intentAny || intentDisplay && annotation.viewable;
  6523. if (isVisible || intentPrint && annotation.printable) {
  6524. annotationsData.push(annotation.data);
  6525. }
  6526. if (annotation.hasTextContent && isVisible) {
  6527. if (!partialEvaluator) {
  6528. partialEvaluator = new _evaluator.PartialEvaluator({
  6529. xref: this.xref,
  6530. handler,
  6531. pageIndex: this.pageIndex,
  6532. idFactory: this._localIdFactory,
  6533. fontCache: this.fontCache,
  6534. builtInCMapCache: this.builtInCMapCache,
  6535. standardFontDataCache: this.standardFontDataCache,
  6536. globalImageCache: this.globalImageCache,
  6537. options: this.evaluatorOptions
  6538. });
  6539. }
  6540. textContentPromises.push(annotation.extractTextContent(partialEvaluator, task, this.view).catch(function (reason) {
  6541. (0, _util.warn)(`getAnnotationsData - ignoring textContent during "${task.name}" task: "${reason}".`);
  6542. }));
  6543. }
  6544. }
  6545. await Promise.all(textContentPromises);
  6546. return annotationsData;
  6547. }
  6548. get annotations() {
  6549. const annots = this._getInheritableProperty("Annots");
  6550. return (0, _util.shadow)(this, "annotations", Array.isArray(annots) ? annots : []);
  6551. }
  6552. get _parsedAnnotations() {
  6553. const parsedAnnotations = this.pdfManager.ensure(this, "annotations").then(() => {
  6554. const annotationPromises = [];
  6555. for (const annotationRef of this.annotations) {
  6556. annotationPromises.push(_annotation.AnnotationFactory.create(this.xref, annotationRef, this.pdfManager, this._localIdFactory, false).catch(function (reason) {
  6557. (0, _util.warn)(`_parsedAnnotations: "${reason}".`);
  6558. return null;
  6559. }));
  6560. }
  6561. return Promise.all(annotationPromises).then(function (annotations) {
  6562. if (annotations.length === 0) {
  6563. return annotations;
  6564. }
  6565. const sortedAnnotations = [];
  6566. let popupAnnotations;
  6567. for (const annotation of annotations) {
  6568. if (!annotation) {
  6569. continue;
  6570. }
  6571. if (annotation instanceof _annotation.PopupAnnotation) {
  6572. if (!popupAnnotations) {
  6573. popupAnnotations = [];
  6574. }
  6575. popupAnnotations.push(annotation);
  6576. continue;
  6577. }
  6578. sortedAnnotations.push(annotation);
  6579. }
  6580. if (popupAnnotations) {
  6581. sortedAnnotations.push(...popupAnnotations);
  6582. }
  6583. return sortedAnnotations;
  6584. });
  6585. });
  6586. return (0, _util.shadow)(this, "_parsedAnnotations", parsedAnnotations);
  6587. }
  6588. get jsActions() {
  6589. const actions = (0, _core_utils.collectActions)(this.xref, this.pageDict, _util.PageActionEventType);
  6590. return (0, _util.shadow)(this, "jsActions", actions);
  6591. }
  6592. }
  6593. exports.Page = Page;
  6594. const PDF_HEADER_SIGNATURE = new Uint8Array([0x25, 0x50, 0x44, 0x46, 0x2d]);
  6595. const STARTXREF_SIGNATURE = new Uint8Array([0x73, 0x74, 0x61, 0x72, 0x74, 0x78, 0x72, 0x65, 0x66]);
  6596. const ENDOBJ_SIGNATURE = new Uint8Array([0x65, 0x6e, 0x64, 0x6f, 0x62, 0x6a]);
  6597. const FINGERPRINT_FIRST_BYTES = 1024;
  6598. const EMPTY_FINGERPRINT = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00";
  6599. function find(stream, signature) {
  6600. let limit = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1024;
  6601. let backwards = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  6602. const signatureLength = signature.length;
  6603. const scanBytes = stream.peekBytes(limit);
  6604. const scanLength = scanBytes.length - signatureLength;
  6605. if (scanLength <= 0) {
  6606. return false;
  6607. }
  6608. if (backwards) {
  6609. const signatureEnd = signatureLength - 1;
  6610. let pos = scanBytes.length - 1;
  6611. while (pos >= signatureEnd) {
  6612. let j = 0;
  6613. while (j < signatureLength && scanBytes[pos - j] === signature[signatureEnd - j]) {
  6614. j++;
  6615. }
  6616. if (j >= signatureLength) {
  6617. stream.pos += pos - signatureEnd;
  6618. return true;
  6619. }
  6620. pos--;
  6621. }
  6622. } else {
  6623. let pos = 0;
  6624. while (pos <= scanLength) {
  6625. let j = 0;
  6626. while (j < signatureLength && scanBytes[pos + j] === signature[j]) {
  6627. j++;
  6628. }
  6629. if (j >= signatureLength) {
  6630. stream.pos += pos;
  6631. return true;
  6632. }
  6633. pos++;
  6634. }
  6635. }
  6636. return false;
  6637. }
  6638. class PDFDocument {
  6639. constructor(pdfManager, stream) {
  6640. if (stream.length <= 0) {
  6641. throw new _util.InvalidPDFException("The PDF file is empty, i.e. its size is zero bytes.");
  6642. }
  6643. this.pdfManager = pdfManager;
  6644. this.stream = stream;
  6645. this.xref = new _xref.XRef(stream, pdfManager);
  6646. this._pagePromises = new Map();
  6647. this._version = null;
  6648. const idCounters = {
  6649. font: 0
  6650. };
  6651. this._globalIdFactory = class {
  6652. static getDocId() {
  6653. return `g_${pdfManager.docId}`;
  6654. }
  6655. static createFontId() {
  6656. return `f${++idCounters.font}`;
  6657. }
  6658. static createObjId() {
  6659. (0, _util.unreachable)("Abstract method `createObjId` called.");
  6660. }
  6661. static getPageObjId() {
  6662. (0, _util.unreachable)("Abstract method `getPageObjId` called.");
  6663. }
  6664. };
  6665. }
  6666. parse(recoveryMode) {
  6667. this.xref.parse(recoveryMode);
  6668. this.catalog = new _catalog.Catalog(this.pdfManager, this.xref);
  6669. }
  6670. get linearization() {
  6671. let linearization = null;
  6672. try {
  6673. linearization = _parser.Linearization.create(this.stream);
  6674. } catch (err) {
  6675. if (err instanceof _core_utils.MissingDataException) {
  6676. throw err;
  6677. }
  6678. (0, _util.info)(err);
  6679. }
  6680. return (0, _util.shadow)(this, "linearization", linearization);
  6681. }
  6682. get startXRef() {
  6683. const stream = this.stream;
  6684. let startXRef = 0;
  6685. if (this.linearization) {
  6686. stream.reset();
  6687. if (find(stream, ENDOBJ_SIGNATURE)) {
  6688. startXRef = stream.pos + 6 - stream.start;
  6689. }
  6690. } else {
  6691. const step = 1024;
  6692. const startXRefLength = STARTXREF_SIGNATURE.length;
  6693. let found = false,
  6694. pos = stream.end;
  6695. while (!found && pos > 0) {
  6696. pos -= step - startXRefLength;
  6697. if (pos < 0) {
  6698. pos = 0;
  6699. }
  6700. stream.pos = pos;
  6701. found = find(stream, STARTXREF_SIGNATURE, step, true);
  6702. }
  6703. if (found) {
  6704. stream.skip(9);
  6705. let ch;
  6706. do {
  6707. ch = stream.getByte();
  6708. } while ((0, _core_utils.isWhiteSpace)(ch));
  6709. let str = "";
  6710. while (ch >= 0x20 && ch <= 0x39) {
  6711. str += String.fromCharCode(ch);
  6712. ch = stream.getByte();
  6713. }
  6714. startXRef = parseInt(str, 10);
  6715. if (isNaN(startXRef)) {
  6716. startXRef = 0;
  6717. }
  6718. }
  6719. }
  6720. return (0, _util.shadow)(this, "startXRef", startXRef);
  6721. }
  6722. checkHeader() {
  6723. const stream = this.stream;
  6724. stream.reset();
  6725. if (!find(stream, PDF_HEADER_SIGNATURE)) {
  6726. return;
  6727. }
  6728. stream.moveStart();
  6729. stream.skip(PDF_HEADER_SIGNATURE.length);
  6730. let version = "",
  6731. ch;
  6732. while ((ch = stream.getByte()) > 0x20 && version.length < 7) {
  6733. version += String.fromCharCode(ch);
  6734. }
  6735. if (_core_utils.PDF_VERSION_REGEXP.test(version)) {
  6736. this._version = version;
  6737. } else {
  6738. (0, _util.warn)(`Invalid PDF header version: ${version}`);
  6739. }
  6740. }
  6741. parseStartXRef() {
  6742. this.xref.setStartXRef(this.startXRef);
  6743. }
  6744. get numPages() {
  6745. let num = 0;
  6746. if (this.catalog.hasActualNumPages) {
  6747. num = this.catalog.numPages;
  6748. } else if (this.xfaFactory) {
  6749. num = this.xfaFactory.getNumPages();
  6750. } else if (this.linearization) {
  6751. num = this.linearization.numPages;
  6752. } else {
  6753. num = this.catalog.numPages;
  6754. }
  6755. return (0, _util.shadow)(this, "numPages", num);
  6756. }
  6757. _hasOnlyDocumentSignatures(fields) {
  6758. let recursionDepth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
  6759. const RECURSION_LIMIT = 10;
  6760. if (!Array.isArray(fields)) {
  6761. return false;
  6762. }
  6763. return fields.every(field => {
  6764. field = this.xref.fetchIfRef(field);
  6765. if (!(field instanceof _primitives.Dict)) {
  6766. return false;
  6767. }
  6768. if (field.has("Kids")) {
  6769. if (++recursionDepth > RECURSION_LIMIT) {
  6770. (0, _util.warn)("_hasOnlyDocumentSignatures: maximum recursion depth reached");
  6771. return false;
  6772. }
  6773. return this._hasOnlyDocumentSignatures(field.get("Kids"), recursionDepth);
  6774. }
  6775. const isSignature = (0, _primitives.isName)(field.get("FT"), "Sig");
  6776. const rectangle = field.get("Rect");
  6777. const isInvisible = Array.isArray(rectangle) && rectangle.every(value => value === 0);
  6778. return isSignature && isInvisible;
  6779. });
  6780. }
  6781. get _xfaStreams() {
  6782. const acroForm = this.catalog.acroForm;
  6783. if (!acroForm) {
  6784. return null;
  6785. }
  6786. const xfa = acroForm.get("XFA");
  6787. const entries = {
  6788. "xdp:xdp": "",
  6789. template: "",
  6790. datasets: "",
  6791. config: "",
  6792. connectionSet: "",
  6793. localeSet: "",
  6794. stylesheet: "",
  6795. "/xdp:xdp": ""
  6796. };
  6797. if (xfa instanceof _base_stream.BaseStream && !xfa.isEmpty) {
  6798. entries["xdp:xdp"] = xfa;
  6799. return entries;
  6800. }
  6801. if (!Array.isArray(xfa) || xfa.length === 0) {
  6802. return null;
  6803. }
  6804. for (let i = 0, ii = xfa.length; i < ii; i += 2) {
  6805. let name;
  6806. if (i === 0) {
  6807. name = "xdp:xdp";
  6808. } else if (i === ii - 2) {
  6809. name = "/xdp:xdp";
  6810. } else {
  6811. name = xfa[i];
  6812. }
  6813. if (!entries.hasOwnProperty(name)) {
  6814. continue;
  6815. }
  6816. const data = this.xref.fetchIfRef(xfa[i + 1]);
  6817. if (!(data instanceof _base_stream.BaseStream) || data.isEmpty) {
  6818. continue;
  6819. }
  6820. entries[name] = data;
  6821. }
  6822. return entries;
  6823. }
  6824. get xfaDatasets() {
  6825. const streams = this._xfaStreams;
  6826. if (!streams) {
  6827. return (0, _util.shadow)(this, "xfaDatasets", null);
  6828. }
  6829. for (const key of ["datasets", "xdp:xdp"]) {
  6830. const stream = streams[key];
  6831. if (!stream) {
  6832. continue;
  6833. }
  6834. try {
  6835. const str = (0, _util.stringToUTF8String)(stream.getString());
  6836. const data = {
  6837. [key]: str
  6838. };
  6839. return (0, _util.shadow)(this, "xfaDatasets", new _dataset_reader.DatasetReader(data));
  6840. } catch (_) {
  6841. (0, _util.warn)("XFA - Invalid utf-8 string.");
  6842. break;
  6843. }
  6844. }
  6845. return (0, _util.shadow)(this, "xfaDatasets", null);
  6846. }
  6847. get xfaData() {
  6848. const streams = this._xfaStreams;
  6849. if (!streams) {
  6850. return null;
  6851. }
  6852. const data = Object.create(null);
  6853. for (const [key, stream] of Object.entries(streams)) {
  6854. if (!stream) {
  6855. continue;
  6856. }
  6857. try {
  6858. data[key] = (0, _util.stringToUTF8String)(stream.getString());
  6859. } catch (_) {
  6860. (0, _util.warn)("XFA - Invalid utf-8 string.");
  6861. return null;
  6862. }
  6863. }
  6864. return data;
  6865. }
  6866. get xfaFactory() {
  6867. let data;
  6868. if (this.pdfManager.enableXfa && this.catalog.needsRendering && this.formInfo.hasXfa && !this.formInfo.hasAcroForm) {
  6869. data = this.xfaData;
  6870. }
  6871. return (0, _util.shadow)(this, "xfaFactory", data ? new _factory.XFAFactory(data) : null);
  6872. }
  6873. get isPureXfa() {
  6874. return this.xfaFactory ? this.xfaFactory.isValid() : false;
  6875. }
  6876. get htmlForXfa() {
  6877. return this.xfaFactory ? this.xfaFactory.getPages() : null;
  6878. }
  6879. async loadXfaImages() {
  6880. const xfaImagesDict = await this.pdfManager.ensureCatalog("xfaImages");
  6881. if (!xfaImagesDict) {
  6882. return;
  6883. }
  6884. const keys = xfaImagesDict.getKeys();
  6885. const objectLoader = new _object_loader.ObjectLoader(xfaImagesDict, keys, this.xref);
  6886. await objectLoader.load();
  6887. const xfaImages = new Map();
  6888. for (const key of keys) {
  6889. const stream = xfaImagesDict.get(key);
  6890. if (stream instanceof _base_stream.BaseStream) {
  6891. xfaImages.set(key, stream.getBytes());
  6892. }
  6893. }
  6894. this.xfaFactory.setImages(xfaImages);
  6895. }
  6896. async loadXfaFonts(handler, task) {
  6897. const acroForm = await this.pdfManager.ensureCatalog("acroForm");
  6898. if (!acroForm) {
  6899. return;
  6900. }
  6901. const resources = await acroForm.getAsync("DR");
  6902. if (!(resources instanceof _primitives.Dict)) {
  6903. return;
  6904. }
  6905. const objectLoader = new _object_loader.ObjectLoader(resources, ["Font"], this.xref);
  6906. await objectLoader.load();
  6907. const fontRes = resources.get("Font");
  6908. if (!(fontRes instanceof _primitives.Dict)) {
  6909. return;
  6910. }
  6911. const options = Object.assign(Object.create(null), this.pdfManager.evaluatorOptions);
  6912. options.useSystemFonts = false;
  6913. const partialEvaluator = new _evaluator.PartialEvaluator({
  6914. xref: this.xref,
  6915. handler,
  6916. pageIndex: -1,
  6917. idFactory: this._globalIdFactory,
  6918. fontCache: this.catalog.fontCache,
  6919. builtInCMapCache: this.catalog.builtInCMapCache,
  6920. standardFontDataCache: this.catalog.standardFontDataCache,
  6921. options
  6922. });
  6923. const operatorList = new _operator_list.OperatorList();
  6924. const pdfFonts = [];
  6925. const initialState = {
  6926. get font() {
  6927. return pdfFonts.at(-1);
  6928. },
  6929. set font(font) {
  6930. pdfFonts.push(font);
  6931. },
  6932. clone() {
  6933. return this;
  6934. }
  6935. };
  6936. const fonts = new Map();
  6937. fontRes.forEach((fontName, font) => {
  6938. fonts.set(fontName, font);
  6939. });
  6940. const promises = [];
  6941. for (const [fontName, font] of fonts) {
  6942. const descriptor = font.get("FontDescriptor");
  6943. if (!(descriptor instanceof _primitives.Dict)) {
  6944. continue;
  6945. }
  6946. let fontFamily = descriptor.get("FontFamily");
  6947. fontFamily = fontFamily.replace(/[ ]+(\d)/g, "$1");
  6948. const fontWeight = descriptor.get("FontWeight");
  6949. const italicAngle = -descriptor.get("ItalicAngle");
  6950. const cssFontInfo = {
  6951. fontFamily,
  6952. fontWeight,
  6953. italicAngle
  6954. };
  6955. if (!(0, _core_utils.validateCSSFont)(cssFontInfo)) {
  6956. continue;
  6957. }
  6958. promises.push(partialEvaluator.handleSetFont(resources, [_primitives.Name.get(fontName), 1], null, operatorList, task, initialState, null, cssFontInfo).catch(function (reason) {
  6959. (0, _util.warn)(`loadXfaFonts: "${reason}".`);
  6960. return null;
  6961. }));
  6962. }
  6963. await Promise.all(promises);
  6964. const missingFonts = this.xfaFactory.setFonts(pdfFonts);
  6965. if (!missingFonts) {
  6966. return;
  6967. }
  6968. options.ignoreErrors = true;
  6969. promises.length = 0;
  6970. pdfFonts.length = 0;
  6971. const reallyMissingFonts = new Set();
  6972. for (const missing of missingFonts) {
  6973. if (!(0, _xfa_fonts.getXfaFontName)(`${missing}-Regular`)) {
  6974. reallyMissingFonts.add(missing);
  6975. }
  6976. }
  6977. if (reallyMissingFonts.size) {
  6978. missingFonts.push("PdfJS-Fallback");
  6979. }
  6980. for (const missing of missingFonts) {
  6981. if (reallyMissingFonts.has(missing)) {
  6982. continue;
  6983. }
  6984. for (const fontInfo of [{
  6985. name: "Regular",
  6986. fontWeight: 400,
  6987. italicAngle: 0
  6988. }, {
  6989. name: "Bold",
  6990. fontWeight: 700,
  6991. italicAngle: 0
  6992. }, {
  6993. name: "Italic",
  6994. fontWeight: 400,
  6995. italicAngle: 12
  6996. }, {
  6997. name: "BoldItalic",
  6998. fontWeight: 700,
  6999. italicAngle: 12
  7000. }]) {
  7001. const name = `${missing}-${fontInfo.name}`;
  7002. const dict = (0, _xfa_fonts.getXfaFontDict)(name);
  7003. promises.push(partialEvaluator.handleSetFont(resources, [_primitives.Name.get(name), 1], null, operatorList, task, initialState, dict, {
  7004. fontFamily: missing,
  7005. fontWeight: fontInfo.fontWeight,
  7006. italicAngle: fontInfo.italicAngle
  7007. }).catch(function (reason) {
  7008. (0, _util.warn)(`loadXfaFonts: "${reason}".`);
  7009. return null;
  7010. }));
  7011. }
  7012. }
  7013. await Promise.all(promises);
  7014. this.xfaFactory.appendFonts(pdfFonts, reallyMissingFonts);
  7015. }
  7016. async serializeXfaData(annotationStorage) {
  7017. return this.xfaFactory ? this.xfaFactory.serializeData(annotationStorage) : null;
  7018. }
  7019. get version() {
  7020. return this.catalog.version || this._version;
  7021. }
  7022. get formInfo() {
  7023. const formInfo = {
  7024. hasFields: false,
  7025. hasAcroForm: false,
  7026. hasXfa: false,
  7027. hasSignatures: false
  7028. };
  7029. const acroForm = this.catalog.acroForm;
  7030. if (!acroForm) {
  7031. return (0, _util.shadow)(this, "formInfo", formInfo);
  7032. }
  7033. try {
  7034. const fields = acroForm.get("Fields");
  7035. const hasFields = Array.isArray(fields) && fields.length > 0;
  7036. formInfo.hasFields = hasFields;
  7037. const xfa = acroForm.get("XFA");
  7038. formInfo.hasXfa = Array.isArray(xfa) && xfa.length > 0 || xfa instanceof _base_stream.BaseStream && !xfa.isEmpty;
  7039. const sigFlags = acroForm.get("SigFlags");
  7040. const hasSignatures = !!(sigFlags & 0x1);
  7041. const hasOnlyDocumentSignatures = hasSignatures && this._hasOnlyDocumentSignatures(fields);
  7042. formInfo.hasAcroForm = hasFields && !hasOnlyDocumentSignatures;
  7043. formInfo.hasSignatures = hasSignatures;
  7044. } catch (ex) {
  7045. if (ex instanceof _core_utils.MissingDataException) {
  7046. throw ex;
  7047. }
  7048. (0, _util.warn)(`Cannot fetch form information: "${ex}".`);
  7049. }
  7050. return (0, _util.shadow)(this, "formInfo", formInfo);
  7051. }
  7052. get documentInfo() {
  7053. const docInfo = {
  7054. PDFFormatVersion: this.version,
  7055. Language: this.catalog.lang,
  7056. EncryptFilterName: this.xref.encrypt ? this.xref.encrypt.filterName : null,
  7057. IsLinearized: !!this.linearization,
  7058. IsAcroFormPresent: this.formInfo.hasAcroForm,
  7059. IsXFAPresent: this.formInfo.hasXfa,
  7060. IsCollectionPresent: !!this.catalog.collection,
  7061. IsSignaturesPresent: this.formInfo.hasSignatures
  7062. };
  7063. let infoDict;
  7064. try {
  7065. infoDict = this.xref.trailer.get("Info");
  7066. } catch (err) {
  7067. if (err instanceof _core_utils.MissingDataException) {
  7068. throw err;
  7069. }
  7070. (0, _util.info)("The document information dictionary is invalid.");
  7071. }
  7072. if (!(infoDict instanceof _primitives.Dict)) {
  7073. return (0, _util.shadow)(this, "documentInfo", docInfo);
  7074. }
  7075. for (const key of infoDict.getKeys()) {
  7076. const value = infoDict.get(key);
  7077. switch (key) {
  7078. case "Title":
  7079. case "Author":
  7080. case "Subject":
  7081. case "Keywords":
  7082. case "Creator":
  7083. case "Producer":
  7084. case "CreationDate":
  7085. case "ModDate":
  7086. if (typeof value === "string") {
  7087. docInfo[key] = (0, _util.stringToPDFString)(value);
  7088. continue;
  7089. }
  7090. break;
  7091. case "Trapped":
  7092. if (value instanceof _primitives.Name) {
  7093. docInfo[key] = value;
  7094. continue;
  7095. }
  7096. break;
  7097. default:
  7098. let customValue;
  7099. switch (typeof value) {
  7100. case "string":
  7101. customValue = (0, _util.stringToPDFString)(value);
  7102. break;
  7103. case "number":
  7104. case "boolean":
  7105. customValue = value;
  7106. break;
  7107. default:
  7108. if (value instanceof _primitives.Name) {
  7109. customValue = value;
  7110. }
  7111. break;
  7112. }
  7113. if (customValue === undefined) {
  7114. (0, _util.warn)(`Bad value, for custom key "${key}", in Info: ${value}.`);
  7115. continue;
  7116. }
  7117. if (!docInfo.Custom) {
  7118. docInfo.Custom = Object.create(null);
  7119. }
  7120. docInfo.Custom[key] = customValue;
  7121. continue;
  7122. }
  7123. (0, _util.warn)(`Bad value, for key "${key}", in Info: ${value}.`);
  7124. }
  7125. return (0, _util.shadow)(this, "documentInfo", docInfo);
  7126. }
  7127. get fingerprints() {
  7128. function validate(data) {
  7129. return typeof data === "string" && data.length > 0 && data !== EMPTY_FINGERPRINT;
  7130. }
  7131. function hexString(hash) {
  7132. const buf = [];
  7133. for (const num of hash) {
  7134. const hex = num.toString(16);
  7135. buf.push(hex.padStart(2, "0"));
  7136. }
  7137. return buf.join("");
  7138. }
  7139. const idArray = this.xref.trailer.get("ID");
  7140. let hashOriginal, hashModified;
  7141. if (Array.isArray(idArray) && validate(idArray[0])) {
  7142. hashOriginal = (0, _util.stringToBytes)(idArray[0]);
  7143. if (idArray[1] !== idArray[0] && validate(idArray[1])) {
  7144. hashModified = (0, _util.stringToBytes)(idArray[1]);
  7145. }
  7146. } else {
  7147. hashOriginal = (0, _crypto.calculateMD5)(this.stream.getByteRange(0, FINGERPRINT_FIRST_BYTES), 0, FINGERPRINT_FIRST_BYTES);
  7148. }
  7149. return (0, _util.shadow)(this, "fingerprints", [hexString(hashOriginal), hashModified ? hexString(hashModified) : null]);
  7150. }
  7151. async _getLinearizationPage(pageIndex) {
  7152. const {
  7153. catalog,
  7154. linearization,
  7155. xref
  7156. } = this;
  7157. const ref = _primitives.Ref.get(linearization.objectNumberFirst, 0);
  7158. try {
  7159. const obj = await xref.fetchAsync(ref);
  7160. if (obj instanceof _primitives.Dict) {
  7161. let type = obj.getRaw("Type");
  7162. if (type instanceof _primitives.Ref) {
  7163. type = await xref.fetchAsync(type);
  7164. }
  7165. if ((0, _primitives.isName)(type, "Page") || !obj.has("Type") && !obj.has("Kids")) {
  7166. if (!catalog.pageKidsCountCache.has(ref)) {
  7167. catalog.pageKidsCountCache.put(ref, 1);
  7168. }
  7169. if (!catalog.pageIndexCache.has(ref)) {
  7170. catalog.pageIndexCache.put(ref, 0);
  7171. }
  7172. return [obj, ref];
  7173. }
  7174. }
  7175. throw new _util.FormatError("The Linearization dictionary doesn't point to a valid Page dictionary.");
  7176. } catch (reason) {
  7177. (0, _util.warn)(`_getLinearizationPage: "${reason.message}".`);
  7178. return catalog.getPageDict(pageIndex);
  7179. }
  7180. }
  7181. getPage(pageIndex) {
  7182. const cachedPromise = this._pagePromises.get(pageIndex);
  7183. if (cachedPromise) {
  7184. return cachedPromise;
  7185. }
  7186. const {
  7187. catalog,
  7188. linearization,
  7189. xfaFactory
  7190. } = this;
  7191. let promise;
  7192. if (xfaFactory) {
  7193. promise = Promise.resolve([_primitives.Dict.empty, null]);
  7194. } else if (linearization && linearization.pageFirst === pageIndex) {
  7195. promise = this._getLinearizationPage(pageIndex);
  7196. } else {
  7197. promise = catalog.getPageDict(pageIndex);
  7198. }
  7199. promise = promise.then(_ref7 => {
  7200. let [pageDict, ref] = _ref7;
  7201. return new Page({
  7202. pdfManager: this.pdfManager,
  7203. xref: this.xref,
  7204. pageIndex,
  7205. pageDict,
  7206. ref,
  7207. globalIdFactory: this._globalIdFactory,
  7208. fontCache: catalog.fontCache,
  7209. builtInCMapCache: catalog.builtInCMapCache,
  7210. standardFontDataCache: catalog.standardFontDataCache,
  7211. globalImageCache: catalog.globalImageCache,
  7212. nonBlendModesSet: catalog.nonBlendModesSet,
  7213. xfaFactory
  7214. });
  7215. });
  7216. this._pagePromises.set(pageIndex, promise);
  7217. return promise;
  7218. }
  7219. async checkFirstPage() {
  7220. let recoveryMode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  7221. if (recoveryMode) {
  7222. return;
  7223. }
  7224. try {
  7225. await this.getPage(0);
  7226. } catch (reason) {
  7227. if (reason instanceof _core_utils.XRefEntryException) {
  7228. this._pagePromises.delete(0);
  7229. await this.cleanup();
  7230. throw new _core_utils.XRefParseException();
  7231. }
  7232. }
  7233. }
  7234. async checkLastPage() {
  7235. let recoveryMode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  7236. const {
  7237. catalog,
  7238. pdfManager
  7239. } = this;
  7240. catalog.setActualNumPages();
  7241. let numPages;
  7242. try {
  7243. await Promise.all([pdfManager.ensureDoc("xfaFactory"), pdfManager.ensureDoc("linearization"), pdfManager.ensureCatalog("numPages")]);
  7244. if (this.xfaFactory) {
  7245. return;
  7246. } else if (this.linearization) {
  7247. numPages = this.linearization.numPages;
  7248. } else {
  7249. numPages = catalog.numPages;
  7250. }
  7251. if (!Number.isInteger(numPages)) {
  7252. throw new _util.FormatError("Page count is not an integer.");
  7253. } else if (numPages <= 1) {
  7254. return;
  7255. }
  7256. await this.getPage(numPages - 1);
  7257. } catch (reason) {
  7258. this._pagePromises.delete(numPages - 1);
  7259. await this.cleanup();
  7260. if (reason instanceof _core_utils.XRefEntryException && !recoveryMode) {
  7261. throw new _core_utils.XRefParseException();
  7262. }
  7263. (0, _util.warn)(`checkLastPage - invalid /Pages tree /Count: ${numPages}.`);
  7264. let pagesTree;
  7265. try {
  7266. pagesTree = await catalog.getAllPageDicts(recoveryMode);
  7267. } catch (reasonAll) {
  7268. if (reasonAll instanceof _core_utils.XRefEntryException && !recoveryMode) {
  7269. throw new _core_utils.XRefParseException();
  7270. }
  7271. catalog.setActualNumPages(1);
  7272. return;
  7273. }
  7274. for (const [pageIndex, [pageDict, ref]] of pagesTree) {
  7275. let promise;
  7276. if (pageDict instanceof Error) {
  7277. promise = Promise.reject(pageDict);
  7278. promise.catch(() => {});
  7279. } else {
  7280. promise = Promise.resolve(new Page({
  7281. pdfManager,
  7282. xref: this.xref,
  7283. pageIndex,
  7284. pageDict,
  7285. ref,
  7286. globalIdFactory: this._globalIdFactory,
  7287. fontCache: catalog.fontCache,
  7288. builtInCMapCache: catalog.builtInCMapCache,
  7289. standardFontDataCache: catalog.standardFontDataCache,
  7290. globalImageCache: catalog.globalImageCache,
  7291. nonBlendModesSet: catalog.nonBlendModesSet,
  7292. xfaFactory: null
  7293. }));
  7294. }
  7295. this._pagePromises.set(pageIndex, promise);
  7296. }
  7297. catalog.setActualNumPages(pagesTree.size);
  7298. }
  7299. }
  7300. fontFallback(id, handler) {
  7301. return this.catalog.fontFallback(id, handler);
  7302. }
  7303. async cleanup() {
  7304. let manuallyTriggered = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  7305. return this.catalog ? this.catalog.cleanup(manuallyTriggered) : (0, _cleanup_helper.clearGlobalCaches)();
  7306. }
  7307. _collectFieldObjects(name, fieldRef, promises) {
  7308. const field = this.xref.fetchIfRef(fieldRef);
  7309. if (field.has("T")) {
  7310. const partName = (0, _util.stringToPDFString)(field.get("T"));
  7311. if (name === "") {
  7312. name = partName;
  7313. } else {
  7314. name = `${name}.${partName}`;
  7315. }
  7316. }
  7317. if (!promises.has(name)) {
  7318. promises.set(name, []);
  7319. }
  7320. promises.get(name).push(_annotation.AnnotationFactory.create(this.xref, fieldRef, this.pdfManager, this._localIdFactory, true).then(annotation => annotation && annotation.getFieldObject()).catch(function (reason) {
  7321. (0, _util.warn)(`_collectFieldObjects: "${reason}".`);
  7322. return null;
  7323. }));
  7324. if (field.has("Kids")) {
  7325. const kids = field.get("Kids");
  7326. for (const kid of kids) {
  7327. this._collectFieldObjects(name, kid, promises);
  7328. }
  7329. }
  7330. }
  7331. get fieldObjects() {
  7332. if (!this.formInfo.hasFields) {
  7333. return (0, _util.shadow)(this, "fieldObjects", Promise.resolve(null));
  7334. }
  7335. const allFields = Object.create(null);
  7336. const fieldPromises = new Map();
  7337. for (const fieldRef of this.catalog.acroForm.get("Fields")) {
  7338. this._collectFieldObjects("", fieldRef, fieldPromises);
  7339. }
  7340. const allPromises = [];
  7341. for (const [name, promises] of fieldPromises) {
  7342. allPromises.push(Promise.all(promises).then(fields => {
  7343. fields = fields.filter(field => !!field);
  7344. if (fields.length > 0) {
  7345. allFields[name] = fields;
  7346. }
  7347. }));
  7348. }
  7349. return (0, _util.shadow)(this, "fieldObjects", Promise.all(allPromises).then(() => allFields));
  7350. }
  7351. get hasJSActions() {
  7352. const promise = this.pdfManager.ensureDoc("_parseHasJSActions");
  7353. return (0, _util.shadow)(this, "hasJSActions", promise);
  7354. }
  7355. async _parseHasJSActions() {
  7356. const [catalogJsActions, fieldObjects] = await Promise.all([this.pdfManager.ensureCatalog("jsActions"), this.pdfManager.ensureDoc("fieldObjects")]);
  7357. if (catalogJsActions) {
  7358. return true;
  7359. }
  7360. if (fieldObjects) {
  7361. return Object.values(fieldObjects).some(fieldObject => fieldObject.some(object => object.actions !== null));
  7362. }
  7363. return false;
  7364. }
  7365. get calculationOrderIds() {
  7366. const acroForm = this.catalog.acroForm;
  7367. if (!acroForm || !acroForm.has("CO")) {
  7368. return (0, _util.shadow)(this, "calculationOrderIds", null);
  7369. }
  7370. const calculationOrder = acroForm.get("CO");
  7371. if (!Array.isArray(calculationOrder) || calculationOrder.length === 0) {
  7372. return (0, _util.shadow)(this, "calculationOrderIds", null);
  7373. }
  7374. const ids = [];
  7375. for (const id of calculationOrder) {
  7376. if (id instanceof _primitives.Ref) {
  7377. ids.push(id.toString());
  7378. }
  7379. }
  7380. if (ids.length === 0) {
  7381. return (0, _util.shadow)(this, "calculationOrderIds", null);
  7382. }
  7383. return (0, _util.shadow)(this, "calculationOrderIds", ids);
  7384. }
  7385. }
  7386. exports.PDFDocument = PDFDocument;
  7387. /***/ }),
  7388. /* 141 */
  7389. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  7390. "use strict";
  7391. Object.defineProperty(exports, "__esModule", ({
  7392. value: true
  7393. }));
  7394. exports.PopupAnnotation = exports.MarkupAnnotation = exports.AnnotationFactory = exports.AnnotationBorderStyle = exports.Annotation = void 0;
  7395. exports.getQuadPoints = getQuadPoints;
  7396. var _util = __w_pdfjs_require__(2);
  7397. var _core_utils = __w_pdfjs_require__(135);
  7398. var _default_appearance = __w_pdfjs_require__(142);
  7399. var _primitives = __w_pdfjs_require__(134);
  7400. var _writer = __w_pdfjs_require__(194);
  7401. var _base_stream = __w_pdfjs_require__(136);
  7402. var _bidi = __w_pdfjs_require__(189);
  7403. var _catalog = __w_pdfjs_require__(198);
  7404. var _colorspace = __w_pdfjs_require__(143);
  7405. var _file_spec = __w_pdfjs_require__(201);
  7406. var _object_loader = __w_pdfjs_require__(204);
  7407. var _operator_list = __w_pdfjs_require__(191);
  7408. var _stream = __w_pdfjs_require__(139);
  7409. var _factory = __w_pdfjs_require__(205);
  7410. class AnnotationFactory {
  7411. static create(xref, ref, pdfManager, idFactory, collectFields) {
  7412. return Promise.all([pdfManager.ensureCatalog("acroForm"), pdfManager.ensureCatalog("baseUrl"), pdfManager.ensureCatalog("attachments"), pdfManager.ensureDoc("xfaDatasets"), collectFields ? this._getPageIndex(xref, ref, pdfManager) : -1]).then(_ref => {
  7413. let [acroForm, baseUrl, attachments, xfaDatasets, pageIndex] = _ref;
  7414. return pdfManager.ensure(this, "_create", [xref, ref, pdfManager, idFactory, acroForm, attachments, xfaDatasets, collectFields, pageIndex]);
  7415. });
  7416. }
  7417. static _create(xref, ref, pdfManager, idFactory, acroForm) {
  7418. let attachments = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : null;
  7419. let xfaDatasets = arguments.length > 6 ? arguments[6] : undefined;
  7420. let collectFields = arguments.length > 7 ? arguments[7] : undefined;
  7421. let pageIndex = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : -1;
  7422. const dict = xref.fetchIfRef(ref);
  7423. if (!(dict instanceof _primitives.Dict)) {
  7424. return undefined;
  7425. }
  7426. const id = ref instanceof _primitives.Ref ? ref.toString() : `annot_${idFactory.createObjId()}`;
  7427. let subtype = dict.get("Subtype");
  7428. subtype = subtype instanceof _primitives.Name ? subtype.name : null;
  7429. const acroFormDict = acroForm instanceof _primitives.Dict ? acroForm : _primitives.Dict.empty;
  7430. const parameters = {
  7431. xref,
  7432. ref,
  7433. dict,
  7434. subtype,
  7435. id,
  7436. pdfManager,
  7437. acroForm: acroFormDict,
  7438. attachments,
  7439. xfaDatasets,
  7440. collectFields,
  7441. needAppearances: !collectFields && acroFormDict.get("NeedAppearances") === true,
  7442. pageIndex,
  7443. isOffscreenCanvasSupported: _util.FeatureTest.isOffscreenCanvasSupported && pdfManager.evaluatorOptions.isOffscreenCanvasSupported
  7444. };
  7445. switch (subtype) {
  7446. case "Link":
  7447. return new LinkAnnotation(parameters);
  7448. case "Text":
  7449. return new TextAnnotation(parameters);
  7450. case "Widget":
  7451. let fieldType = (0, _core_utils.getInheritableProperty)({
  7452. dict,
  7453. key: "FT"
  7454. });
  7455. fieldType = fieldType instanceof _primitives.Name ? fieldType.name : null;
  7456. switch (fieldType) {
  7457. case "Tx":
  7458. return new TextWidgetAnnotation(parameters);
  7459. case "Btn":
  7460. return new ButtonWidgetAnnotation(parameters);
  7461. case "Ch":
  7462. return new ChoiceWidgetAnnotation(parameters);
  7463. case "Sig":
  7464. return new SignatureWidgetAnnotation(parameters);
  7465. }
  7466. (0, _util.warn)(`Unimplemented widget field type "${fieldType}", ` + "falling back to base field type.");
  7467. return new WidgetAnnotation(parameters);
  7468. case "Popup":
  7469. return new PopupAnnotation(parameters);
  7470. case "FreeText":
  7471. return new FreeTextAnnotation(parameters);
  7472. case "Line":
  7473. return new LineAnnotation(parameters);
  7474. case "Square":
  7475. return new SquareAnnotation(parameters);
  7476. case "Circle":
  7477. return new CircleAnnotation(parameters);
  7478. case "PolyLine":
  7479. return new PolylineAnnotation(parameters);
  7480. case "Polygon":
  7481. return new PolygonAnnotation(parameters);
  7482. case "Caret":
  7483. return new CaretAnnotation(parameters);
  7484. case "Ink":
  7485. return new InkAnnotation(parameters);
  7486. case "Highlight":
  7487. return new HighlightAnnotation(parameters);
  7488. case "Underline":
  7489. return new UnderlineAnnotation(parameters);
  7490. case "Squiggly":
  7491. return new SquigglyAnnotation(parameters);
  7492. case "StrikeOut":
  7493. return new StrikeOutAnnotation(parameters);
  7494. case "Stamp":
  7495. return new StampAnnotation(parameters);
  7496. case "FileAttachment":
  7497. return new FileAttachmentAnnotation(parameters);
  7498. default:
  7499. if (!collectFields) {
  7500. if (!subtype) {
  7501. (0, _util.warn)("Annotation is missing the required /Subtype.");
  7502. } else {
  7503. (0, _util.warn)(`Unimplemented annotation type "${subtype}", ` + "falling back to base annotation.");
  7504. }
  7505. }
  7506. return new Annotation(parameters);
  7507. }
  7508. }
  7509. static async _getPageIndex(xref, ref, pdfManager) {
  7510. try {
  7511. const annotDict = await xref.fetchIfRefAsync(ref);
  7512. if (!(annotDict instanceof _primitives.Dict)) {
  7513. return -1;
  7514. }
  7515. const pageRef = annotDict.getRaw("P");
  7516. if (!(pageRef instanceof _primitives.Ref)) {
  7517. return -1;
  7518. }
  7519. const pageIndex = await pdfManager.ensureCatalog("getPageIndex", [pageRef]);
  7520. return pageIndex;
  7521. } catch (ex) {
  7522. (0, _util.warn)(`_getPageIndex: "${ex}".`);
  7523. return -1;
  7524. }
  7525. }
  7526. static async saveNewAnnotations(evaluator, task, annotations) {
  7527. const xref = evaluator.xref;
  7528. let baseFontRef;
  7529. const dependencies = [];
  7530. const promises = [];
  7531. for (const annotation of annotations) {
  7532. switch (annotation.annotationType) {
  7533. case _util.AnnotationEditorType.FREETEXT:
  7534. if (!baseFontRef) {
  7535. const baseFont = new _primitives.Dict(xref);
  7536. baseFont.set("BaseFont", _primitives.Name.get("Helvetica"));
  7537. baseFont.set("Type", _primitives.Name.get("Font"));
  7538. baseFont.set("Subtype", _primitives.Name.get("Type1"));
  7539. baseFont.set("Encoding", _primitives.Name.get("WinAnsiEncoding"));
  7540. const buffer = [];
  7541. baseFontRef = xref.getNewTemporaryRef();
  7542. (0, _writer.writeObject)(baseFontRef, baseFont, buffer, null);
  7543. dependencies.push({
  7544. ref: baseFontRef,
  7545. data: buffer.join("")
  7546. });
  7547. }
  7548. promises.push(FreeTextAnnotation.createNewAnnotation(xref, annotation, dependencies, {
  7549. evaluator,
  7550. task,
  7551. baseFontRef
  7552. }));
  7553. break;
  7554. case _util.AnnotationEditorType.INK:
  7555. promises.push(InkAnnotation.createNewAnnotation(xref, annotation, dependencies));
  7556. }
  7557. }
  7558. return {
  7559. annotations: await Promise.all(promises),
  7560. dependencies
  7561. };
  7562. }
  7563. static async printNewAnnotations(evaluator, task, annotations) {
  7564. if (!annotations) {
  7565. return null;
  7566. }
  7567. const xref = evaluator.xref;
  7568. const promises = [];
  7569. const isOffscreenCanvasSupported = _util.FeatureTest.isOffscreenCanvasSupported && evaluator.options.isOffscreenCanvasSupported;
  7570. for (const annotation of annotations) {
  7571. switch (annotation.annotationType) {
  7572. case _util.AnnotationEditorType.FREETEXT:
  7573. promises.push(FreeTextAnnotation.createNewPrintAnnotation(xref, annotation, {
  7574. evaluator,
  7575. task,
  7576. isOffscreenCanvasSupported
  7577. }));
  7578. break;
  7579. case _util.AnnotationEditorType.INK:
  7580. promises.push(InkAnnotation.createNewPrintAnnotation(xref, annotation, {
  7581. isOffscreenCanvasSupported
  7582. }));
  7583. break;
  7584. }
  7585. }
  7586. return Promise.all(promises);
  7587. }
  7588. }
  7589. exports.AnnotationFactory = AnnotationFactory;
  7590. function getRgbColor(color) {
  7591. let defaultColor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Uint8ClampedArray(3);
  7592. if (!Array.isArray(color)) {
  7593. return defaultColor;
  7594. }
  7595. const rgbColor = defaultColor || new Uint8ClampedArray(3);
  7596. switch (color.length) {
  7597. case 0:
  7598. return null;
  7599. case 1:
  7600. _colorspace.ColorSpace.singletons.gray.getRgbItem(color, 0, rgbColor, 0);
  7601. return rgbColor;
  7602. case 3:
  7603. _colorspace.ColorSpace.singletons.rgb.getRgbItem(color, 0, rgbColor, 0);
  7604. return rgbColor;
  7605. case 4:
  7606. _colorspace.ColorSpace.singletons.cmyk.getRgbItem(color, 0, rgbColor, 0);
  7607. return rgbColor;
  7608. default:
  7609. return defaultColor;
  7610. }
  7611. }
  7612. function getPdfColorArray(color) {
  7613. return Array.from(color, c => c / 255);
  7614. }
  7615. function getQuadPoints(dict, rect) {
  7616. const quadPoints = dict.getArray("QuadPoints");
  7617. if (!Array.isArray(quadPoints) || quadPoints.length === 0 || quadPoints.length % 8 > 0) {
  7618. return null;
  7619. }
  7620. const quadPointsLists = [];
  7621. for (let i = 0, ii = quadPoints.length / 8; i < ii; i++) {
  7622. let minX = Infinity,
  7623. maxX = -Infinity,
  7624. minY = Infinity,
  7625. maxY = -Infinity;
  7626. for (let j = i * 8, jj = i * 8 + 8; j < jj; j += 2) {
  7627. const x = quadPoints[j];
  7628. const y = quadPoints[j + 1];
  7629. minX = Math.min(x, minX);
  7630. maxX = Math.max(x, maxX);
  7631. minY = Math.min(y, minY);
  7632. maxY = Math.max(y, maxY);
  7633. }
  7634. if (rect !== null && (minX < rect[0] || maxX > rect[2] || minY < rect[1] || maxY > rect[3])) {
  7635. return null;
  7636. }
  7637. quadPointsLists.push([{
  7638. x: minX,
  7639. y: maxY
  7640. }, {
  7641. x: maxX,
  7642. y: maxY
  7643. }, {
  7644. x: minX,
  7645. y: minY
  7646. }, {
  7647. x: maxX,
  7648. y: minY
  7649. }]);
  7650. }
  7651. return quadPointsLists;
  7652. }
  7653. function getTransformMatrix(rect, bbox, matrix) {
  7654. const [minX, minY, maxX, maxY] = _util.Util.getAxialAlignedBoundingBox(bbox, matrix);
  7655. if (minX === maxX || minY === maxY) {
  7656. return [1, 0, 0, 1, rect[0], rect[1]];
  7657. }
  7658. const xRatio = (rect[2] - rect[0]) / (maxX - minX);
  7659. const yRatio = (rect[3] - rect[1]) / (maxY - minY);
  7660. return [xRatio, 0, 0, yRatio, rect[0] - minX * xRatio, rect[1] - minY * yRatio];
  7661. }
  7662. class Annotation {
  7663. constructor(params) {
  7664. const {
  7665. dict,
  7666. xref
  7667. } = params;
  7668. this.setTitle(dict.get("T"));
  7669. this.setContents(dict.get("Contents"));
  7670. this.setModificationDate(dict.get("M"));
  7671. this.setFlags(dict.get("F"));
  7672. this.setRectangle(dict.getArray("Rect"));
  7673. this.setColor(dict.getArray("C"));
  7674. this.setBorderStyle(dict);
  7675. this.setAppearance(dict);
  7676. this.setOptionalContent(dict);
  7677. const MK = dict.get("MK");
  7678. this.setBorderAndBackgroundColors(MK);
  7679. this.setRotation(MK);
  7680. this._streams = [];
  7681. if (this.appearance) {
  7682. this._streams.push(this.appearance);
  7683. }
  7684. this.data = {
  7685. annotationFlags: this.flags,
  7686. borderStyle: this.borderStyle,
  7687. color: this.color,
  7688. backgroundColor: this.backgroundColor,
  7689. borderColor: this.borderColor,
  7690. rotation: this.rotation,
  7691. contentsObj: this._contents,
  7692. hasAppearance: !!this.appearance,
  7693. id: params.id,
  7694. modificationDate: this.modificationDate,
  7695. rect: this.rectangle,
  7696. subtype: params.subtype,
  7697. hasOwnCanvas: false
  7698. };
  7699. if (params.collectFields) {
  7700. const kids = dict.get("Kids");
  7701. if (Array.isArray(kids)) {
  7702. const kidIds = [];
  7703. for (const kid of kids) {
  7704. if (kid instanceof _primitives.Ref) {
  7705. kidIds.push(kid.toString());
  7706. }
  7707. }
  7708. if (kidIds.length !== 0) {
  7709. this.data.kidIds = kidIds;
  7710. }
  7711. }
  7712. this.data.actions = (0, _core_utils.collectActions)(xref, dict, _util.AnnotationActionEventType);
  7713. this.data.fieldName = this._constructFieldName(dict);
  7714. this.data.pageIndex = params.pageIndex;
  7715. }
  7716. this._isOffscreenCanvasSupported = params.isOffscreenCanvasSupported;
  7717. this._fallbackFontDict = null;
  7718. this._needAppearances = false;
  7719. }
  7720. _hasFlag(flags, flag) {
  7721. return !!(flags & flag);
  7722. }
  7723. _isViewable(flags) {
  7724. return !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, _util.AnnotationFlag.NOVIEW);
  7725. }
  7726. _isPrintable(flags) {
  7727. return this._hasFlag(flags, _util.AnnotationFlag.PRINT) && !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE);
  7728. }
  7729. mustBeViewed(annotationStorage) {
  7730. const storageEntry = annotationStorage && annotationStorage.get(this.data.id);
  7731. if (storageEntry && storageEntry.hidden !== undefined) {
  7732. return !storageEntry.hidden;
  7733. }
  7734. return this.viewable && !this._hasFlag(this.flags, _util.AnnotationFlag.HIDDEN);
  7735. }
  7736. mustBePrinted(annotationStorage) {
  7737. const storageEntry = annotationStorage && annotationStorage.get(this.data.id);
  7738. if (storageEntry && storageEntry.print !== undefined) {
  7739. return storageEntry.print;
  7740. }
  7741. return this.printable;
  7742. }
  7743. get viewable() {
  7744. if (this.data.quadPoints === null) {
  7745. return false;
  7746. }
  7747. if (this.flags === 0) {
  7748. return true;
  7749. }
  7750. return this._isViewable(this.flags);
  7751. }
  7752. get printable() {
  7753. if (this.data.quadPoints === null) {
  7754. return false;
  7755. }
  7756. if (this.flags === 0) {
  7757. return false;
  7758. }
  7759. return this._isPrintable(this.flags);
  7760. }
  7761. _parseStringHelper(data) {
  7762. const str = typeof data === "string" ? (0, _util.stringToPDFString)(data) : "";
  7763. const dir = str && (0, _bidi.bidi)(str).dir === "rtl" ? "rtl" : "ltr";
  7764. return {
  7765. str,
  7766. dir
  7767. };
  7768. }
  7769. setDefaultAppearance(params) {
  7770. const defaultAppearance = (0, _core_utils.getInheritableProperty)({
  7771. dict: params.dict,
  7772. key: "DA"
  7773. }) || params.acroForm.get("DA");
  7774. this._defaultAppearance = typeof defaultAppearance === "string" ? defaultAppearance : "";
  7775. this.data.defaultAppearanceData = (0, _default_appearance.parseDefaultAppearance)(this._defaultAppearance);
  7776. }
  7777. setTitle(title) {
  7778. this._title = this._parseStringHelper(title);
  7779. }
  7780. setContents(contents) {
  7781. this._contents = this._parseStringHelper(contents);
  7782. }
  7783. setModificationDate(modificationDate) {
  7784. this.modificationDate = typeof modificationDate === "string" ? modificationDate : null;
  7785. }
  7786. setFlags(flags) {
  7787. this.flags = Number.isInteger(flags) && flags > 0 ? flags : 0;
  7788. }
  7789. hasFlag(flag) {
  7790. return this._hasFlag(this.flags, flag);
  7791. }
  7792. setRectangle(rectangle) {
  7793. if (Array.isArray(rectangle) && rectangle.length === 4) {
  7794. this.rectangle = _util.Util.normalizeRect(rectangle);
  7795. } else {
  7796. this.rectangle = [0, 0, 0, 0];
  7797. }
  7798. }
  7799. setColor(color) {
  7800. this.color = getRgbColor(color);
  7801. }
  7802. setLineEndings(lineEndings) {
  7803. this.lineEndings = ["None", "None"];
  7804. if (Array.isArray(lineEndings) && lineEndings.length === 2) {
  7805. for (let i = 0; i < 2; i++) {
  7806. const obj = lineEndings[i];
  7807. if (obj instanceof _primitives.Name) {
  7808. switch (obj.name) {
  7809. case "None":
  7810. continue;
  7811. case "Square":
  7812. case "Circle":
  7813. case "Diamond":
  7814. case "OpenArrow":
  7815. case "ClosedArrow":
  7816. case "Butt":
  7817. case "ROpenArrow":
  7818. case "RClosedArrow":
  7819. case "Slash":
  7820. this.lineEndings[i] = obj.name;
  7821. continue;
  7822. }
  7823. }
  7824. (0, _util.warn)(`Ignoring invalid lineEnding: ${obj}`);
  7825. }
  7826. }
  7827. }
  7828. setRotation(mk) {
  7829. this.rotation = 0;
  7830. if (mk instanceof _primitives.Dict) {
  7831. let angle = mk.get("R") || 0;
  7832. if (Number.isInteger(angle) && angle !== 0) {
  7833. angle %= 360;
  7834. if (angle < 0) {
  7835. angle += 360;
  7836. }
  7837. if (angle % 90 === 0) {
  7838. this.rotation = angle;
  7839. }
  7840. }
  7841. }
  7842. }
  7843. setBorderAndBackgroundColors(mk) {
  7844. if (mk instanceof _primitives.Dict) {
  7845. this.borderColor = getRgbColor(mk.getArray("BC"), null);
  7846. this.backgroundColor = getRgbColor(mk.getArray("BG"), null);
  7847. } else {
  7848. this.borderColor = this.backgroundColor = null;
  7849. }
  7850. }
  7851. setBorderStyle(borderStyle) {
  7852. this.borderStyle = new AnnotationBorderStyle();
  7853. if (!(borderStyle instanceof _primitives.Dict)) {
  7854. return;
  7855. }
  7856. if (borderStyle.has("BS")) {
  7857. const dict = borderStyle.get("BS");
  7858. const dictType = dict.get("Type");
  7859. if (!dictType || (0, _primitives.isName)(dictType, "Border")) {
  7860. this.borderStyle.setWidth(dict.get("W"), this.rectangle);
  7861. this.borderStyle.setStyle(dict.get("S"));
  7862. this.borderStyle.setDashArray(dict.getArray("D"));
  7863. }
  7864. } else if (borderStyle.has("Border")) {
  7865. const array = borderStyle.getArray("Border");
  7866. if (Array.isArray(array) && array.length >= 3) {
  7867. this.borderStyle.setHorizontalCornerRadius(array[0]);
  7868. this.borderStyle.setVerticalCornerRadius(array[1]);
  7869. this.borderStyle.setWidth(array[2], this.rectangle);
  7870. if (array.length === 4) {
  7871. this.borderStyle.setDashArray(array[3], true);
  7872. }
  7873. }
  7874. } else {
  7875. this.borderStyle.setWidth(0);
  7876. }
  7877. }
  7878. setAppearance(dict) {
  7879. this.appearance = null;
  7880. const appearanceStates = dict.get("AP");
  7881. if (!(appearanceStates instanceof _primitives.Dict)) {
  7882. return;
  7883. }
  7884. const normalAppearanceState = appearanceStates.get("N");
  7885. if (normalAppearanceState instanceof _base_stream.BaseStream) {
  7886. this.appearance = normalAppearanceState;
  7887. return;
  7888. }
  7889. if (!(normalAppearanceState instanceof _primitives.Dict)) {
  7890. return;
  7891. }
  7892. const as = dict.get("AS");
  7893. if (!(as instanceof _primitives.Name) || !normalAppearanceState.has(as.name)) {
  7894. return;
  7895. }
  7896. this.appearance = normalAppearanceState.get(as.name);
  7897. }
  7898. setOptionalContent(dict) {
  7899. this.oc = null;
  7900. const oc = dict.get("OC");
  7901. if (oc instanceof _primitives.Name) {
  7902. (0, _util.warn)("setOptionalContent: Support for /Name-entry is not implemented.");
  7903. } else if (oc instanceof _primitives.Dict) {
  7904. this.oc = oc;
  7905. }
  7906. }
  7907. loadResources(keys, appearance) {
  7908. return appearance.dict.getAsync("Resources").then(resources => {
  7909. if (!resources) {
  7910. return undefined;
  7911. }
  7912. const objectLoader = new _object_loader.ObjectLoader(resources, keys, resources.xref);
  7913. return objectLoader.load().then(function () {
  7914. return resources;
  7915. });
  7916. });
  7917. }
  7918. async getOperatorList(evaluator, task, intent, renderForms, annotationStorage) {
  7919. const data = this.data;
  7920. let appearance = this.appearance;
  7921. const isUsingOwnCanvas = !!(this.data.hasOwnCanvas && intent & _util.RenderingIntentFlag.DISPLAY);
  7922. if (!appearance) {
  7923. if (!isUsingOwnCanvas) {
  7924. return {
  7925. opList: new _operator_list.OperatorList(),
  7926. separateForm: false,
  7927. separateCanvas: false
  7928. };
  7929. }
  7930. appearance = new _stream.StringStream("");
  7931. appearance.dict = new _primitives.Dict();
  7932. }
  7933. const appearanceDict = appearance.dict;
  7934. const resources = await this.loadResources(["ExtGState", "ColorSpace", "Pattern", "Shading", "XObject", "Font"], appearance);
  7935. const bbox = appearanceDict.getArray("BBox") || [0, 0, 1, 1];
  7936. const matrix = appearanceDict.getArray("Matrix") || [1, 0, 0, 1, 0, 0];
  7937. const transform = getTransformMatrix(data.rect, bbox, matrix);
  7938. const opList = new _operator_list.OperatorList();
  7939. let optionalContent;
  7940. if (this.oc) {
  7941. optionalContent = await evaluator.parseMarkedContentProps(this.oc, null);
  7942. }
  7943. if (optionalContent !== undefined) {
  7944. opList.addOp(_util.OPS.beginMarkedContentProps, ["OC", optionalContent]);
  7945. }
  7946. opList.addOp(_util.OPS.beginAnnotation, [data.id, data.rect, transform, matrix, isUsingOwnCanvas]);
  7947. await evaluator.getOperatorList({
  7948. stream: appearance,
  7949. task,
  7950. resources,
  7951. operatorList: opList,
  7952. fallbackFontDict: this._fallbackFontDict
  7953. });
  7954. opList.addOp(_util.OPS.endAnnotation, []);
  7955. if (optionalContent !== undefined) {
  7956. opList.addOp(_util.OPS.endMarkedContent, []);
  7957. }
  7958. this.reset();
  7959. return {
  7960. opList,
  7961. separateForm: false,
  7962. separateCanvas: isUsingOwnCanvas
  7963. };
  7964. }
  7965. async save(evaluator, task, annotationStorage) {
  7966. return null;
  7967. }
  7968. get hasTextContent() {
  7969. return false;
  7970. }
  7971. async extractTextContent(evaluator, task, viewBox) {
  7972. if (!this.appearance) {
  7973. return;
  7974. }
  7975. const resources = await this.loadResources(["ExtGState", "Font", "Properties", "XObject"], this.appearance);
  7976. const text = [];
  7977. const buffer = [];
  7978. const sink = {
  7979. desiredSize: Math.Infinity,
  7980. ready: true,
  7981. enqueue(chunk, size) {
  7982. for (const item of chunk.items) {
  7983. buffer.push(item.str);
  7984. if (item.hasEOL) {
  7985. text.push(buffer.join(""));
  7986. buffer.length = 0;
  7987. }
  7988. }
  7989. }
  7990. };
  7991. await evaluator.getTextContent({
  7992. stream: this.appearance,
  7993. task,
  7994. resources,
  7995. includeMarkedContent: true,
  7996. combineTextItems: true,
  7997. sink,
  7998. viewBox
  7999. });
  8000. this.reset();
  8001. if (buffer.length) {
  8002. text.push(buffer.join(""));
  8003. }
  8004. if (text.length > 0) {
  8005. this.data.textContent = text;
  8006. }
  8007. }
  8008. getFieldObject() {
  8009. if (this.data.kidIds) {
  8010. return {
  8011. id: this.data.id,
  8012. actions: this.data.actions,
  8013. name: this.data.fieldName,
  8014. strokeColor: this.data.borderColor,
  8015. fillColor: this.data.backgroundColor,
  8016. type: "",
  8017. kidIds: this.data.kidIds,
  8018. page: this.data.pageIndex,
  8019. rotation: this.rotation
  8020. };
  8021. }
  8022. return null;
  8023. }
  8024. reset() {
  8025. for (const stream of this._streams) {
  8026. stream.reset();
  8027. }
  8028. }
  8029. _constructFieldName(dict) {
  8030. if (!dict.has("T") && !dict.has("Parent")) {
  8031. (0, _util.warn)("Unknown field name, falling back to empty field name.");
  8032. return "";
  8033. }
  8034. if (!dict.has("Parent")) {
  8035. return (0, _util.stringToPDFString)(dict.get("T"));
  8036. }
  8037. const fieldName = [];
  8038. if (dict.has("T")) {
  8039. fieldName.unshift((0, _util.stringToPDFString)(dict.get("T")));
  8040. }
  8041. let loopDict = dict;
  8042. const visited = new _primitives.RefSet();
  8043. if (dict.objId) {
  8044. visited.put(dict.objId);
  8045. }
  8046. while (loopDict.has("Parent")) {
  8047. loopDict = loopDict.get("Parent");
  8048. if (!(loopDict instanceof _primitives.Dict) || loopDict.objId && visited.has(loopDict.objId)) {
  8049. break;
  8050. }
  8051. if (loopDict.objId) {
  8052. visited.put(loopDict.objId);
  8053. }
  8054. if (loopDict.has("T")) {
  8055. fieldName.unshift((0, _util.stringToPDFString)(loopDict.get("T")));
  8056. }
  8057. }
  8058. return fieldName.join(".");
  8059. }
  8060. }
  8061. exports.Annotation = Annotation;
  8062. class AnnotationBorderStyle {
  8063. constructor() {
  8064. this.width = 1;
  8065. this.style = _util.AnnotationBorderStyleType.SOLID;
  8066. this.dashArray = [3];
  8067. this.horizontalCornerRadius = 0;
  8068. this.verticalCornerRadius = 0;
  8069. }
  8070. setWidth(width) {
  8071. let rect = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0, 0, 0];
  8072. if (width instanceof _primitives.Name) {
  8073. this.width = 0;
  8074. return;
  8075. }
  8076. if (typeof width === "number") {
  8077. if (width > 0) {
  8078. const maxWidth = (rect[2] - rect[0]) / 2;
  8079. const maxHeight = (rect[3] - rect[1]) / 2;
  8080. if (maxWidth > 0 && maxHeight > 0 && (width > maxWidth || width > maxHeight)) {
  8081. (0, _util.warn)(`AnnotationBorderStyle.setWidth - ignoring width: ${width}`);
  8082. width = 1;
  8083. }
  8084. }
  8085. this.width = width;
  8086. }
  8087. }
  8088. setStyle(style) {
  8089. if (!(style instanceof _primitives.Name)) {
  8090. return;
  8091. }
  8092. switch (style.name) {
  8093. case "S":
  8094. this.style = _util.AnnotationBorderStyleType.SOLID;
  8095. break;
  8096. case "D":
  8097. this.style = _util.AnnotationBorderStyleType.DASHED;
  8098. break;
  8099. case "B":
  8100. this.style = _util.AnnotationBorderStyleType.BEVELED;
  8101. break;
  8102. case "I":
  8103. this.style = _util.AnnotationBorderStyleType.INSET;
  8104. break;
  8105. case "U":
  8106. this.style = _util.AnnotationBorderStyleType.UNDERLINE;
  8107. break;
  8108. default:
  8109. break;
  8110. }
  8111. }
  8112. setDashArray(dashArray) {
  8113. let forceStyle = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  8114. if (Array.isArray(dashArray) && dashArray.length > 0) {
  8115. let isValid = true;
  8116. let allZeros = true;
  8117. for (const element of dashArray) {
  8118. const validNumber = +element >= 0;
  8119. if (!validNumber) {
  8120. isValid = false;
  8121. break;
  8122. } else if (element > 0) {
  8123. allZeros = false;
  8124. }
  8125. }
  8126. if (isValid && !allZeros) {
  8127. this.dashArray = dashArray;
  8128. if (forceStyle) {
  8129. this.setStyle(_primitives.Name.get("D"));
  8130. }
  8131. } else {
  8132. this.width = 0;
  8133. }
  8134. } else if (dashArray) {
  8135. this.width = 0;
  8136. }
  8137. }
  8138. setHorizontalCornerRadius(radius) {
  8139. if (Number.isInteger(radius)) {
  8140. this.horizontalCornerRadius = radius;
  8141. }
  8142. }
  8143. setVerticalCornerRadius(radius) {
  8144. if (Number.isInteger(radius)) {
  8145. this.verticalCornerRadius = radius;
  8146. }
  8147. }
  8148. }
  8149. exports.AnnotationBorderStyle = AnnotationBorderStyle;
  8150. class MarkupAnnotation extends Annotation {
  8151. constructor(params) {
  8152. super(params);
  8153. const {
  8154. dict
  8155. } = params;
  8156. if (dict.has("IRT")) {
  8157. const rawIRT = dict.getRaw("IRT");
  8158. this.data.inReplyTo = rawIRT instanceof _primitives.Ref ? rawIRT.toString() : null;
  8159. const rt = dict.get("RT");
  8160. this.data.replyType = rt instanceof _primitives.Name ? rt.name : _util.AnnotationReplyType.REPLY;
  8161. }
  8162. if (this.data.replyType === _util.AnnotationReplyType.GROUP) {
  8163. const parent = dict.get("IRT");
  8164. this.setTitle(parent.get("T"));
  8165. this.data.titleObj = this._title;
  8166. this.setContents(parent.get("Contents"));
  8167. this.data.contentsObj = this._contents;
  8168. if (!parent.has("CreationDate")) {
  8169. this.data.creationDate = null;
  8170. } else {
  8171. this.setCreationDate(parent.get("CreationDate"));
  8172. this.data.creationDate = this.creationDate;
  8173. }
  8174. if (!parent.has("M")) {
  8175. this.data.modificationDate = null;
  8176. } else {
  8177. this.setModificationDate(parent.get("M"));
  8178. this.data.modificationDate = this.modificationDate;
  8179. }
  8180. this.data.hasPopup = parent.has("Popup");
  8181. if (!parent.has("C")) {
  8182. this.data.color = null;
  8183. } else {
  8184. this.setColor(parent.getArray("C"));
  8185. this.data.color = this.color;
  8186. }
  8187. } else {
  8188. this.data.titleObj = this._title;
  8189. this.setCreationDate(dict.get("CreationDate"));
  8190. this.data.creationDate = this.creationDate;
  8191. this.data.hasPopup = dict.has("Popup");
  8192. if (!dict.has("C")) {
  8193. this.data.color = null;
  8194. }
  8195. }
  8196. if (dict.has("RC")) {
  8197. this.data.richText = _factory.XFAFactory.getRichTextAsHtml(dict.get("RC"));
  8198. }
  8199. }
  8200. setCreationDate(creationDate) {
  8201. this.creationDate = typeof creationDate === "string" ? creationDate : null;
  8202. }
  8203. _setDefaultAppearance(_ref2) {
  8204. let {
  8205. xref,
  8206. extra,
  8207. strokeColor,
  8208. fillColor,
  8209. blendMode,
  8210. strokeAlpha,
  8211. fillAlpha,
  8212. pointsCallback
  8213. } = _ref2;
  8214. let minX = Number.MAX_VALUE;
  8215. let minY = Number.MAX_VALUE;
  8216. let maxX = Number.MIN_VALUE;
  8217. let maxY = Number.MIN_VALUE;
  8218. const buffer = ["q"];
  8219. if (extra) {
  8220. buffer.push(extra);
  8221. }
  8222. if (strokeColor) {
  8223. buffer.push(`${strokeColor[0]} ${strokeColor[1]} ${strokeColor[2]} RG`);
  8224. }
  8225. if (fillColor) {
  8226. buffer.push(`${fillColor[0]} ${fillColor[1]} ${fillColor[2]} rg`);
  8227. }
  8228. let pointsArray = this.data.quadPoints;
  8229. if (!pointsArray) {
  8230. pointsArray = [[{
  8231. x: this.rectangle[0],
  8232. y: this.rectangle[3]
  8233. }, {
  8234. x: this.rectangle[2],
  8235. y: this.rectangle[3]
  8236. }, {
  8237. x: this.rectangle[0],
  8238. y: this.rectangle[1]
  8239. }, {
  8240. x: this.rectangle[2],
  8241. y: this.rectangle[1]
  8242. }]];
  8243. }
  8244. for (const points of pointsArray) {
  8245. const [mX, MX, mY, MY] = pointsCallback(buffer, points);
  8246. minX = Math.min(minX, mX);
  8247. maxX = Math.max(maxX, MX);
  8248. minY = Math.min(minY, mY);
  8249. maxY = Math.max(maxY, MY);
  8250. }
  8251. buffer.push("Q");
  8252. const formDict = new _primitives.Dict(xref);
  8253. const appearanceStreamDict = new _primitives.Dict(xref);
  8254. appearanceStreamDict.set("Subtype", _primitives.Name.get("Form"));
  8255. const appearanceStream = new _stream.StringStream(buffer.join(" "));
  8256. appearanceStream.dict = appearanceStreamDict;
  8257. formDict.set("Fm0", appearanceStream);
  8258. const gsDict = new _primitives.Dict(xref);
  8259. if (blendMode) {
  8260. gsDict.set("BM", _primitives.Name.get(blendMode));
  8261. }
  8262. if (typeof strokeAlpha === "number") {
  8263. gsDict.set("CA", strokeAlpha);
  8264. }
  8265. if (typeof fillAlpha === "number") {
  8266. gsDict.set("ca", fillAlpha);
  8267. }
  8268. const stateDict = new _primitives.Dict(xref);
  8269. stateDict.set("GS0", gsDict);
  8270. const resources = new _primitives.Dict(xref);
  8271. resources.set("ExtGState", stateDict);
  8272. resources.set("XObject", formDict);
  8273. const appearanceDict = new _primitives.Dict(xref);
  8274. appearanceDict.set("Resources", resources);
  8275. const bbox = this.data.rect = [minX, minY, maxX, maxY];
  8276. appearanceDict.set("BBox", bbox);
  8277. this.appearance = new _stream.StringStream("/GS0 gs /Fm0 Do");
  8278. this.appearance.dict = appearanceDict;
  8279. this._streams.push(this.appearance, appearanceStream);
  8280. }
  8281. static async createNewAnnotation(xref, annotation, dependencies, params) {
  8282. const annotationRef = xref.getNewTemporaryRef();
  8283. const ap = await this.createNewAppearanceStream(annotation, xref, params);
  8284. const buffer = [];
  8285. let annotationDict;
  8286. if (ap) {
  8287. const apRef = xref.getNewTemporaryRef();
  8288. annotationDict = this.createNewDict(annotation, xref, {
  8289. apRef
  8290. });
  8291. const transform = xref.encrypt ? xref.encrypt.createCipherTransform(apRef.num, apRef.gen) : null;
  8292. (0, _writer.writeObject)(apRef, ap, buffer, transform);
  8293. dependencies.push({
  8294. ref: apRef,
  8295. data: buffer.join("")
  8296. });
  8297. } else {
  8298. annotationDict = this.createNewDict(annotation, xref, {});
  8299. }
  8300. buffer.length = 0;
  8301. const transform = xref.encrypt ? xref.encrypt.createCipherTransform(annotationRef.num, annotationRef.gen) : null;
  8302. (0, _writer.writeObject)(annotationRef, annotationDict, buffer, transform);
  8303. return {
  8304. ref: annotationRef,
  8305. data: buffer.join("")
  8306. };
  8307. }
  8308. static async createNewPrintAnnotation(xref, annotation, params) {
  8309. const ap = await this.createNewAppearanceStream(annotation, xref, params);
  8310. const annotationDict = this.createNewDict(annotation, xref, {
  8311. ap
  8312. });
  8313. return new this.prototype.constructor({
  8314. dict: annotationDict,
  8315. xref,
  8316. isOffscreenCanvasSupported: params.isOffscreenCanvasSupported
  8317. });
  8318. }
  8319. }
  8320. exports.MarkupAnnotation = MarkupAnnotation;
  8321. class WidgetAnnotation extends Annotation {
  8322. constructor(params) {
  8323. super(params);
  8324. const {
  8325. dict,
  8326. xref
  8327. } = params;
  8328. const data = this.data;
  8329. this.ref = params.ref;
  8330. this._needAppearances = params.needAppearances;
  8331. data.annotationType = _util.AnnotationType.WIDGET;
  8332. if (data.fieldName === undefined) {
  8333. data.fieldName = this._constructFieldName(dict);
  8334. }
  8335. if (data.actions === undefined) {
  8336. data.actions = (0, _core_utils.collectActions)(xref, dict, _util.AnnotationActionEventType);
  8337. }
  8338. let fieldValue = (0, _core_utils.getInheritableProperty)({
  8339. dict,
  8340. key: "V",
  8341. getArray: true
  8342. });
  8343. data.fieldValue = this._decodeFormValue(fieldValue);
  8344. const defaultFieldValue = (0, _core_utils.getInheritableProperty)({
  8345. dict,
  8346. key: "DV",
  8347. getArray: true
  8348. });
  8349. data.defaultFieldValue = this._decodeFormValue(defaultFieldValue);
  8350. if (fieldValue === undefined && params.xfaDatasets) {
  8351. const path = this._title.str;
  8352. if (path) {
  8353. this._hasValueFromXFA = true;
  8354. data.fieldValue = fieldValue = params.xfaDatasets.getValue(path);
  8355. }
  8356. }
  8357. if (fieldValue === undefined && data.defaultFieldValue !== null) {
  8358. data.fieldValue = data.defaultFieldValue;
  8359. }
  8360. data.alternativeText = (0, _util.stringToPDFString)(dict.get("TU") || "");
  8361. this.setDefaultAppearance(params);
  8362. data.hasAppearance = this._needAppearances && data.fieldValue !== undefined && data.fieldValue !== null || data.hasAppearance;
  8363. const fieldType = (0, _core_utils.getInheritableProperty)({
  8364. dict,
  8365. key: "FT"
  8366. });
  8367. data.fieldType = fieldType instanceof _primitives.Name ? fieldType.name : null;
  8368. const localResources = (0, _core_utils.getInheritableProperty)({
  8369. dict,
  8370. key: "DR"
  8371. });
  8372. const acroFormResources = params.acroForm.get("DR");
  8373. const appearanceResources = this.appearance && this.appearance.dict.get("Resources");
  8374. this._fieldResources = {
  8375. localResources,
  8376. acroFormResources,
  8377. appearanceResources,
  8378. mergedResources: _primitives.Dict.merge({
  8379. xref,
  8380. dictArray: [localResources, appearanceResources, acroFormResources],
  8381. mergeSubDicts: true
  8382. })
  8383. };
  8384. data.fieldFlags = (0, _core_utils.getInheritableProperty)({
  8385. dict,
  8386. key: "Ff"
  8387. });
  8388. if (!Number.isInteger(data.fieldFlags) || data.fieldFlags < 0) {
  8389. data.fieldFlags = 0;
  8390. }
  8391. data.readOnly = this.hasFieldFlag(_util.AnnotationFieldFlag.READONLY);
  8392. data.required = this.hasFieldFlag(_util.AnnotationFieldFlag.REQUIRED);
  8393. data.hidden = this._hasFlag(data.annotationFlags, _util.AnnotationFlag.HIDDEN);
  8394. }
  8395. _decodeFormValue(formValue) {
  8396. if (Array.isArray(formValue)) {
  8397. return formValue.filter(item => typeof item === "string").map(item => (0, _util.stringToPDFString)(item));
  8398. } else if (formValue instanceof _primitives.Name) {
  8399. return (0, _util.stringToPDFString)(formValue.name);
  8400. } else if (typeof formValue === "string") {
  8401. return (0, _util.stringToPDFString)(formValue);
  8402. }
  8403. return null;
  8404. }
  8405. hasFieldFlag(flag) {
  8406. return !!(this.data.fieldFlags & flag);
  8407. }
  8408. getRotationMatrix(annotationStorage) {
  8409. const storageEntry = annotationStorage ? annotationStorage.get(this.data.id) : undefined;
  8410. let rotation = storageEntry && storageEntry.rotation;
  8411. if (rotation === undefined) {
  8412. rotation = this.rotation;
  8413. }
  8414. if (rotation === 0) {
  8415. return _util.IDENTITY_MATRIX;
  8416. }
  8417. const width = this.data.rect[2] - this.data.rect[0];
  8418. const height = this.data.rect[3] - this.data.rect[1];
  8419. return (0, _core_utils.getRotationMatrix)(rotation, width, height);
  8420. }
  8421. getBorderAndBackgroundAppearances(annotationStorage) {
  8422. const storageEntry = annotationStorage ? annotationStorage.get(this.data.id) : undefined;
  8423. let rotation = storageEntry && storageEntry.rotation;
  8424. if (rotation === undefined) {
  8425. rotation = this.rotation;
  8426. }
  8427. if (!this.backgroundColor && !this.borderColor) {
  8428. return "";
  8429. }
  8430. const width = this.data.rect[2] - this.data.rect[0];
  8431. const height = this.data.rect[3] - this.data.rect[1];
  8432. const rect = rotation === 0 || rotation === 180 ? `0 0 ${width} ${height} re` : `0 0 ${height} ${width} re`;
  8433. let str = "";
  8434. if (this.backgroundColor) {
  8435. str = `${(0, _default_appearance.getPdfColor)(this.backgroundColor, true)} ${rect} f `;
  8436. }
  8437. if (this.borderColor) {
  8438. const borderWidth = this.borderStyle.width || 1;
  8439. str += `${borderWidth} w ${(0, _default_appearance.getPdfColor)(this.borderColor, false)} ${rect} S `;
  8440. }
  8441. return str;
  8442. }
  8443. async getOperatorList(evaluator, task, intent, renderForms, annotationStorage) {
  8444. if (renderForms && !(this instanceof SignatureWidgetAnnotation)) {
  8445. return {
  8446. opList: new _operator_list.OperatorList(),
  8447. separateForm: true,
  8448. separateCanvas: false
  8449. };
  8450. }
  8451. if (!this._hasText) {
  8452. return super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage);
  8453. }
  8454. const content = await this._getAppearance(evaluator, task, intent, annotationStorage);
  8455. if (this.appearance && content === null) {
  8456. return super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage);
  8457. }
  8458. const opList = new _operator_list.OperatorList();
  8459. if (!this._defaultAppearance || content === null) {
  8460. return {
  8461. opList,
  8462. separateForm: false,
  8463. separateCanvas: false
  8464. };
  8465. }
  8466. const matrix = [1, 0, 0, 1, 0, 0];
  8467. const bbox = [0, 0, this.data.rect[2] - this.data.rect[0], this.data.rect[3] - this.data.rect[1]];
  8468. const transform = getTransformMatrix(this.data.rect, bbox, matrix);
  8469. let optionalContent;
  8470. if (this.oc) {
  8471. optionalContent = await evaluator.parseMarkedContentProps(this.oc, null);
  8472. }
  8473. if (optionalContent !== undefined) {
  8474. opList.addOp(_util.OPS.beginMarkedContentProps, ["OC", optionalContent]);
  8475. }
  8476. opList.addOp(_util.OPS.beginAnnotation, [this.data.id, this.data.rect, transform, this.getRotationMatrix(annotationStorage), false]);
  8477. const stream = new _stream.StringStream(content);
  8478. await evaluator.getOperatorList({
  8479. stream,
  8480. task,
  8481. resources: this._fieldResources.mergedResources,
  8482. operatorList: opList
  8483. });
  8484. opList.addOp(_util.OPS.endAnnotation, []);
  8485. if (optionalContent !== undefined) {
  8486. opList.addOp(_util.OPS.endMarkedContent, []);
  8487. }
  8488. return {
  8489. opList,
  8490. separateForm: false,
  8491. separateCanvas: false
  8492. };
  8493. }
  8494. _getMKDict(rotation) {
  8495. const mk = new _primitives.Dict(null);
  8496. if (rotation) {
  8497. mk.set("R", rotation);
  8498. }
  8499. if (this.borderColor) {
  8500. mk.set("BC", getPdfColorArray(this.borderColor));
  8501. }
  8502. if (this.backgroundColor) {
  8503. mk.set("BG", getPdfColorArray(this.backgroundColor));
  8504. }
  8505. return mk.size > 0 ? mk : null;
  8506. }
  8507. async save(evaluator, task, annotationStorage) {
  8508. const storageEntry = annotationStorage ? annotationStorage.get(this.data.id) : undefined;
  8509. let value = storageEntry && storageEntry.value;
  8510. let rotation = storageEntry && storageEntry.rotation;
  8511. if (value === this.data.fieldValue || value === undefined) {
  8512. if (!this._hasValueFromXFA && rotation === undefined) {
  8513. return null;
  8514. }
  8515. value = value || this.data.fieldValue;
  8516. }
  8517. 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])) {
  8518. return null;
  8519. }
  8520. if (rotation === undefined) {
  8521. rotation = this.rotation;
  8522. }
  8523. let appearance = null;
  8524. if (!this._needAppearances) {
  8525. appearance = await this._getAppearance(evaluator, task, _util.RenderingIntentFlag.SAVE, annotationStorage);
  8526. if (appearance === null) {
  8527. return null;
  8528. }
  8529. } else {}
  8530. let needAppearances = false;
  8531. if (appearance && appearance.needAppearances) {
  8532. needAppearances = true;
  8533. appearance = null;
  8534. }
  8535. const {
  8536. xref
  8537. } = evaluator;
  8538. const originalDict = xref.fetchIfRef(this.ref);
  8539. if (!(originalDict instanceof _primitives.Dict)) {
  8540. return null;
  8541. }
  8542. const dict = new _primitives.Dict(xref);
  8543. for (const key of originalDict.getKeys()) {
  8544. if (key !== "AP") {
  8545. dict.set(key, originalDict.getRaw(key));
  8546. }
  8547. }
  8548. const xfa = {
  8549. path: (0, _util.stringToPDFString)(dict.get("T") || ""),
  8550. value
  8551. };
  8552. const encoder = val => {
  8553. return (0, _core_utils.isAscii)(val) ? val : (0, _core_utils.stringToUTF16String)(val, true);
  8554. };
  8555. dict.set("V", Array.isArray(value) ? value.map(encoder) : encoder(value));
  8556. const maybeMK = this._getMKDict(rotation);
  8557. if (maybeMK) {
  8558. dict.set("MK", maybeMK);
  8559. }
  8560. const encrypt = xref.encrypt;
  8561. const originalTransform = encrypt ? encrypt.createCipherTransform(this.ref.num, this.ref.gen) : null;
  8562. const buffer = [];
  8563. const changes = [{
  8564. ref: this.ref,
  8565. data: "",
  8566. xfa,
  8567. needAppearances
  8568. }];
  8569. if (appearance !== null) {
  8570. const newRef = xref.getNewTemporaryRef();
  8571. const AP = new _primitives.Dict(xref);
  8572. dict.set("AP", AP);
  8573. AP.set("N", newRef);
  8574. let newTransform = null;
  8575. if (encrypt) {
  8576. newTransform = encrypt.createCipherTransform(newRef.num, newRef.gen);
  8577. appearance = newTransform.encryptString(appearance);
  8578. }
  8579. const resources = this._getSaveFieldResources(xref);
  8580. const appearanceStream = new _stream.StringStream(appearance);
  8581. const appearanceDict = appearanceStream.dict = new _primitives.Dict(xref);
  8582. appearanceDict.set("Length", appearance.length);
  8583. appearanceDict.set("Subtype", _primitives.Name.get("Form"));
  8584. appearanceDict.set("Resources", resources);
  8585. appearanceDict.set("BBox", [0, 0, this.data.rect[2] - this.data.rect[0], this.data.rect[3] - this.data.rect[1]]);
  8586. const rotationMatrix = this.getRotationMatrix(annotationStorage);
  8587. if (rotationMatrix !== _util.IDENTITY_MATRIX) {
  8588. appearanceDict.set("Matrix", rotationMatrix);
  8589. }
  8590. (0, _writer.writeObject)(newRef, appearanceStream, buffer, newTransform);
  8591. changes.push({
  8592. ref: newRef,
  8593. data: buffer.join(""),
  8594. xfa: null,
  8595. needAppearances: false
  8596. });
  8597. buffer.length = 0;
  8598. }
  8599. dict.set("M", `D:${(0, _util.getModificationDate)()}`);
  8600. (0, _writer.writeObject)(this.ref, dict, buffer, originalTransform);
  8601. changes[0].data = buffer.join("");
  8602. return changes;
  8603. }
  8604. async _getAppearance(evaluator, task, intent, annotationStorage) {
  8605. const isPassword = this.hasFieldFlag(_util.AnnotationFieldFlag.PASSWORD);
  8606. if (isPassword) {
  8607. return null;
  8608. }
  8609. const storageEntry = annotationStorage ? annotationStorage.get(this.data.id) : undefined;
  8610. let value, rotation;
  8611. if (storageEntry) {
  8612. value = storageEntry.formattedValue || storageEntry.value;
  8613. rotation = storageEntry.rotation;
  8614. }
  8615. if (rotation === undefined && value === undefined && !this._needAppearances) {
  8616. if (!this._hasValueFromXFA || this.appearance) {
  8617. return null;
  8618. }
  8619. }
  8620. const colors = this.getBorderAndBackgroundAppearances(annotationStorage);
  8621. if (value === undefined) {
  8622. value = this.data.fieldValue;
  8623. if (!value) {
  8624. return `/Tx BMC q ${colors}Q EMC`;
  8625. }
  8626. }
  8627. if (Array.isArray(value) && value.length === 1) {
  8628. value = value[0];
  8629. }
  8630. (0, _util.assert)(typeof value === "string", "Expected `value` to be a string.");
  8631. value = value.trim();
  8632. if (value === "") {
  8633. return `/Tx BMC q ${colors}Q EMC`;
  8634. }
  8635. if (rotation === undefined) {
  8636. rotation = this.rotation;
  8637. }
  8638. let lineCount = -1;
  8639. let lines;
  8640. if (this.data.multiLine) {
  8641. lines = value.split(/\r\n?|\n/).map(line => line.normalize("NFC"));
  8642. lineCount = lines.length;
  8643. } else {
  8644. lines = [value.replace(/\r\n?|\n/, "").normalize("NFC")];
  8645. }
  8646. const defaultPadding = 1;
  8647. const defaultHPadding = 2;
  8648. let totalHeight = this.data.rect[3] - this.data.rect[1];
  8649. let totalWidth = this.data.rect[2] - this.data.rect[0];
  8650. if (rotation === 90 || rotation === 270) {
  8651. [totalWidth, totalHeight] = [totalHeight, totalWidth];
  8652. }
  8653. if (!this._defaultAppearance) {
  8654. this.data.defaultAppearanceData = (0, _default_appearance.parseDefaultAppearance)(this._defaultAppearance = "/Helvetica 0 Tf 0 g");
  8655. }
  8656. let font = await WidgetAnnotation._getFontData(evaluator, task, this.data.defaultAppearanceData, this._fieldResources.mergedResources);
  8657. let defaultAppearance, fontSize, lineHeight;
  8658. const encodedLines = [];
  8659. let encodingError = false;
  8660. for (const line of lines) {
  8661. const encodedString = font.encodeString(line);
  8662. if (encodedString.length > 1) {
  8663. encodingError = true;
  8664. }
  8665. encodedLines.push(encodedString.join(""));
  8666. }
  8667. if (encodingError && intent & _util.RenderingIntentFlag.SAVE) {
  8668. return {
  8669. needAppearances: true
  8670. };
  8671. }
  8672. if (encodingError && this._isOffscreenCanvasSupported) {
  8673. const fontFamily = this.data.comb ? "monospace" : "sans-serif";
  8674. const fakeUnicodeFont = new _default_appearance.FakeUnicodeFont(evaluator.xref, fontFamily);
  8675. const resources = fakeUnicodeFont.createFontResources(lines.join(""));
  8676. const newFont = resources.getRaw("Font");
  8677. if (this._fieldResources.mergedResources.has("Font")) {
  8678. const oldFont = this._fieldResources.mergedResources.get("Font");
  8679. for (const key of newFont.getKeys()) {
  8680. oldFont.set(key, newFont.getRaw(key));
  8681. }
  8682. } else {
  8683. this._fieldResources.mergedResources.set("Font", newFont);
  8684. }
  8685. const fontName = fakeUnicodeFont.fontName.name;
  8686. font = await WidgetAnnotation._getFontData(evaluator, task, {
  8687. fontName,
  8688. fontSize: 0
  8689. }, resources);
  8690. for (let i = 0, ii = encodedLines.length; i < ii; i++) {
  8691. encodedLines[i] = (0, _core_utils.stringToUTF16String)(lines[i]);
  8692. }
  8693. const savedDefaultAppearance = Object.assign(Object.create(null), this.data.defaultAppearanceData);
  8694. this.data.defaultAppearanceData.fontSize = 0;
  8695. this.data.defaultAppearanceData.fontName = fontName;
  8696. [defaultAppearance, fontSize, lineHeight] = this._computeFontSize(totalHeight - 2 * defaultPadding, totalWidth - 2 * defaultHPadding, value, font, lineCount);
  8697. this.data.defaultAppearanceData = savedDefaultAppearance;
  8698. } else {
  8699. if (!this._isOffscreenCanvasSupported) {
  8700. (0, _util.warn)("_getAppearance: OffscreenCanvas is not supported, annotation may not render correctly.");
  8701. }
  8702. [defaultAppearance, fontSize, lineHeight] = this._computeFontSize(totalHeight - 2 * defaultPadding, totalWidth - 2 * defaultHPadding, value, font, lineCount);
  8703. }
  8704. let descent = font.descent;
  8705. if (isNaN(descent)) {
  8706. descent = _util.BASELINE_FACTOR * lineHeight;
  8707. } else {
  8708. descent = Math.max(_util.BASELINE_FACTOR * lineHeight, Math.abs(descent) * fontSize);
  8709. }
  8710. const defaultVPadding = Math.min(Math.floor((totalHeight - fontSize) / 2), defaultPadding);
  8711. const alignment = this.data.textAlignment;
  8712. if (this.data.multiLine) {
  8713. return this._getMultilineAppearance(defaultAppearance, encodedLines, font, fontSize, totalWidth, totalHeight, alignment, defaultHPadding, defaultVPadding, descent, lineHeight, annotationStorage);
  8714. }
  8715. if (this.data.comb) {
  8716. return this._getCombAppearance(defaultAppearance, font, encodedLines[0], fontSize, totalWidth, totalHeight, defaultHPadding, defaultVPadding, descent, lineHeight, annotationStorage);
  8717. }
  8718. const bottomPadding = defaultVPadding + descent;
  8719. if (alignment === 0 || alignment > 2) {
  8720. 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";
  8721. }
  8722. const prevInfo = {
  8723. shift: 0
  8724. };
  8725. const renderedText = this._renderText(encodedLines[0], font, fontSize, totalWidth, alignment, prevInfo, defaultHPadding, bottomPadding);
  8726. return `/Tx BMC q ${colors}BT ` + defaultAppearance + ` 1 0 0 1 0 0 Tm ${renderedText}` + " ET Q EMC";
  8727. }
  8728. static async _getFontData(evaluator, task, appearanceData, resources) {
  8729. const operatorList = new _operator_list.OperatorList();
  8730. const initialState = {
  8731. font: null,
  8732. clone() {
  8733. return this;
  8734. }
  8735. };
  8736. const {
  8737. fontName,
  8738. fontSize
  8739. } = appearanceData;
  8740. await evaluator.handleSetFont(resources, [fontName && _primitives.Name.get(fontName), fontSize], null, operatorList, task, initialState, null);
  8741. return initialState.font;
  8742. }
  8743. _getTextWidth(text, font) {
  8744. return font.charsToGlyphs(text).reduce((width, glyph) => width + glyph.width, 0) / 1000;
  8745. }
  8746. _computeFontSize(height, width, text, font, lineCount) {
  8747. let {
  8748. fontSize
  8749. } = this.data.defaultAppearanceData;
  8750. let lineHeight = (fontSize || 12) * _util.LINE_FACTOR,
  8751. numberOfLines = Math.round(height / lineHeight);
  8752. if (!fontSize) {
  8753. const roundWithTwoDigits = x => Math.floor(x * 100) / 100;
  8754. if (lineCount === -1) {
  8755. const textWidth = this._getTextWidth(text, font);
  8756. fontSize = roundWithTwoDigits(Math.min(height / _util.LINE_FACTOR, textWidth > width ? width / textWidth : Infinity));
  8757. numberOfLines = 1;
  8758. } else {
  8759. const lines = text.split(/\r\n?|\n/);
  8760. const cachedLines = [];
  8761. for (const line of lines) {
  8762. const encoded = font.encodeString(line).join("");
  8763. const glyphs = font.charsToGlyphs(encoded);
  8764. const positions = font.getCharPositions(encoded);
  8765. cachedLines.push({
  8766. line: encoded,
  8767. glyphs,
  8768. positions
  8769. });
  8770. }
  8771. const isTooBig = fsize => {
  8772. let totalHeight = 0;
  8773. for (const cache of cachedLines) {
  8774. const chunks = this._splitLine(null, font, fsize, width, cache);
  8775. totalHeight += chunks.length * fsize;
  8776. if (totalHeight > height) {
  8777. return true;
  8778. }
  8779. }
  8780. return false;
  8781. };
  8782. numberOfLines = Math.max(numberOfLines, lineCount);
  8783. while (true) {
  8784. lineHeight = height / numberOfLines;
  8785. fontSize = roundWithTwoDigits(lineHeight / _util.LINE_FACTOR);
  8786. if (isTooBig(fontSize)) {
  8787. numberOfLines++;
  8788. continue;
  8789. }
  8790. break;
  8791. }
  8792. }
  8793. const {
  8794. fontName,
  8795. fontColor
  8796. } = this.data.defaultAppearanceData;
  8797. this._defaultAppearance = (0, _default_appearance.createDefaultAppearance)({
  8798. fontSize,
  8799. fontName,
  8800. fontColor
  8801. });
  8802. }
  8803. return [this._defaultAppearance, fontSize, height / numberOfLines];
  8804. }
  8805. _renderText(text, font, fontSize, totalWidth, alignment, prevInfo, hPadding, vPadding) {
  8806. let shift;
  8807. if (alignment === 1) {
  8808. const width = this._getTextWidth(text, font) * fontSize;
  8809. shift = (totalWidth - width) / 2;
  8810. } else if (alignment === 2) {
  8811. const width = this._getTextWidth(text, font) * fontSize;
  8812. shift = totalWidth - width - hPadding;
  8813. } else {
  8814. shift = hPadding;
  8815. }
  8816. const shiftStr = (0, _core_utils.numberToString)(shift - prevInfo.shift);
  8817. prevInfo.shift = shift;
  8818. vPadding = (0, _core_utils.numberToString)(vPadding);
  8819. return `${shiftStr} ${vPadding} Td (${(0, _core_utils.escapeString)(text)}) Tj`;
  8820. }
  8821. _getSaveFieldResources(xref) {
  8822. const {
  8823. localResources,
  8824. appearanceResources,
  8825. acroFormResources
  8826. } = this._fieldResources;
  8827. const fontName = this.data.defaultAppearanceData && this.data.defaultAppearanceData.fontName;
  8828. if (!fontName) {
  8829. return localResources || _primitives.Dict.empty;
  8830. }
  8831. for (const resources of [localResources, appearanceResources]) {
  8832. if (resources instanceof _primitives.Dict) {
  8833. const localFont = resources.get("Font");
  8834. if (localFont instanceof _primitives.Dict && localFont.has(fontName)) {
  8835. return resources;
  8836. }
  8837. }
  8838. }
  8839. if (acroFormResources instanceof _primitives.Dict) {
  8840. const acroFormFont = acroFormResources.get("Font");
  8841. if (acroFormFont instanceof _primitives.Dict && acroFormFont.has(fontName)) {
  8842. const subFontDict = new _primitives.Dict(xref);
  8843. subFontDict.set(fontName, acroFormFont.getRaw(fontName));
  8844. const subResourcesDict = new _primitives.Dict(xref);
  8845. subResourcesDict.set("Font", subFontDict);
  8846. return _primitives.Dict.merge({
  8847. xref,
  8848. dictArray: [subResourcesDict, localResources],
  8849. mergeSubDicts: true
  8850. });
  8851. }
  8852. }
  8853. return localResources || _primitives.Dict.empty;
  8854. }
  8855. getFieldObject() {
  8856. return null;
  8857. }
  8858. }
  8859. class TextWidgetAnnotation extends WidgetAnnotation {
  8860. constructor(params) {
  8861. super(params);
  8862. this._hasText = true;
  8863. const dict = params.dict;
  8864. if (typeof this.data.fieldValue !== "string") {
  8865. this.data.fieldValue = "";
  8866. }
  8867. let alignment = (0, _core_utils.getInheritableProperty)({
  8868. dict,
  8869. key: "Q"
  8870. });
  8871. if (!Number.isInteger(alignment) || alignment < 0 || alignment > 2) {
  8872. alignment = null;
  8873. }
  8874. this.data.textAlignment = alignment;
  8875. let maximumLength = (0, _core_utils.getInheritableProperty)({
  8876. dict,
  8877. key: "MaxLen"
  8878. });
  8879. if (!Number.isInteger(maximumLength) || maximumLength < 0) {
  8880. maximumLength = 0;
  8881. }
  8882. this.data.maxLen = maximumLength;
  8883. this.data.multiLine = this.hasFieldFlag(_util.AnnotationFieldFlag.MULTILINE);
  8884. 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;
  8885. this.data.doNotScroll = this.hasFieldFlag(_util.AnnotationFieldFlag.DONOTSCROLL);
  8886. }
  8887. _getCombAppearance(defaultAppearance, font, text, fontSize, width, height, hPadding, vPadding, descent, lineHeight, annotationStorage) {
  8888. const combWidth = width / this.data.maxLen;
  8889. const colors = this.getBorderAndBackgroundAppearances(annotationStorage);
  8890. const buf = [];
  8891. const positions = font.getCharPositions(text);
  8892. for (const [start, end] of positions) {
  8893. buf.push(`(${(0, _core_utils.escapeString)(text.substring(start, end))}) Tj`);
  8894. }
  8895. const renderedComb = buf.join(` ${(0, _core_utils.numberToString)(combWidth)} 0 Td `);
  8896. 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";
  8897. }
  8898. _getMultilineAppearance(defaultAppearance, lines, font, fontSize, width, height, alignment, hPadding, vPadding, descent, lineHeight, annotationStorage) {
  8899. const buf = [];
  8900. const totalWidth = width - 2 * hPadding;
  8901. const prevInfo = {
  8902. shift: 0
  8903. };
  8904. for (let i = 0, ii = lines.length; i < ii; i++) {
  8905. const line = lines[i];
  8906. const chunks = this._splitLine(line, font, fontSize, totalWidth);
  8907. for (let j = 0, jj = chunks.length; j < jj; j++) {
  8908. const chunk = chunks[j];
  8909. const vShift = i === 0 && j === 0 ? -vPadding - (lineHeight - descent) : -lineHeight;
  8910. buf.push(this._renderText(chunk, font, fontSize, width, alignment, prevInfo, hPadding, vShift));
  8911. }
  8912. }
  8913. const colors = this.getBorderAndBackgroundAppearances(annotationStorage);
  8914. const renderedText = buf.join("\n");
  8915. return `/Tx BMC q ${colors}BT ` + defaultAppearance + ` 1 0 0 1 0 ${(0, _core_utils.numberToString)(height)} Tm ${renderedText}` + " ET Q EMC";
  8916. }
  8917. _splitLine(line, font, fontSize, width) {
  8918. let cache = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
  8919. line = cache.line || line;
  8920. const glyphs = cache.glyphs || font.charsToGlyphs(line);
  8921. if (glyphs.length <= 1) {
  8922. return [line];
  8923. }
  8924. const positions = cache.positions || font.getCharPositions(line);
  8925. const scale = fontSize / 1000;
  8926. const chunks = [];
  8927. let lastSpacePosInStringStart = -1,
  8928. lastSpacePosInStringEnd = -1,
  8929. lastSpacePos = -1,
  8930. startChunk = 0,
  8931. currentWidth = 0;
  8932. for (let i = 0, ii = glyphs.length; i < ii; i++) {
  8933. const [start, end] = positions[i];
  8934. const glyph = glyphs[i];
  8935. const glyphWidth = glyph.width * scale;
  8936. if (glyph.unicode === " ") {
  8937. if (currentWidth + glyphWidth > width) {
  8938. chunks.push(line.substring(startChunk, start));
  8939. startChunk = start;
  8940. currentWidth = glyphWidth;
  8941. lastSpacePosInStringStart = -1;
  8942. lastSpacePos = -1;
  8943. } else {
  8944. currentWidth += glyphWidth;
  8945. lastSpacePosInStringStart = start;
  8946. lastSpacePosInStringEnd = end;
  8947. lastSpacePos = i;
  8948. }
  8949. } else {
  8950. if (currentWidth + glyphWidth > width) {
  8951. if (lastSpacePosInStringStart !== -1) {
  8952. chunks.push(line.substring(startChunk, lastSpacePosInStringEnd));
  8953. startChunk = lastSpacePosInStringEnd;
  8954. i = lastSpacePos + 1;
  8955. lastSpacePosInStringStart = -1;
  8956. currentWidth = 0;
  8957. } else {
  8958. chunks.push(line.substring(startChunk, start));
  8959. startChunk = start;
  8960. currentWidth = glyphWidth;
  8961. }
  8962. } else {
  8963. currentWidth += glyphWidth;
  8964. }
  8965. }
  8966. }
  8967. if (startChunk < line.length) {
  8968. chunks.push(line.substring(startChunk, line.length));
  8969. }
  8970. return chunks;
  8971. }
  8972. getFieldObject() {
  8973. return {
  8974. id: this.data.id,
  8975. value: this.data.fieldValue,
  8976. defaultValue: this.data.defaultFieldValue || "",
  8977. multiline: this.data.multiLine,
  8978. password: this.hasFieldFlag(_util.AnnotationFieldFlag.PASSWORD),
  8979. charLimit: this.data.maxLen,
  8980. comb: this.data.comb,
  8981. editable: !this.data.readOnly,
  8982. hidden: this.data.hidden,
  8983. name: this.data.fieldName,
  8984. rect: this.data.rect,
  8985. actions: this.data.actions,
  8986. page: this.data.pageIndex,
  8987. strokeColor: this.data.borderColor,
  8988. fillColor: this.data.backgroundColor,
  8989. rotation: this.rotation,
  8990. type: "text"
  8991. };
  8992. }
  8993. }
  8994. class ButtonWidgetAnnotation extends WidgetAnnotation {
  8995. constructor(params) {
  8996. super(params);
  8997. this.checkedAppearance = null;
  8998. this.uncheckedAppearance = null;
  8999. this.data.checkBox = !this.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
  9000. this.data.radioButton = this.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
  9001. this.data.pushButton = this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
  9002. this.data.isTooltipOnly = false;
  9003. if (this.data.checkBox) {
  9004. this._processCheckBox(params);
  9005. } else if (this.data.radioButton) {
  9006. this._processRadioButton(params);
  9007. } else if (this.data.pushButton) {
  9008. this.data.hasOwnCanvas = true;
  9009. this._processPushButton(params);
  9010. } else {
  9011. (0, _util.warn)("Invalid field flags for button widget annotation");
  9012. }
  9013. }
  9014. async getOperatorList(evaluator, task, intent, renderForms, annotationStorage) {
  9015. if (this.data.pushButton) {
  9016. return super.getOperatorList(evaluator, task, intent, false, annotationStorage);
  9017. }
  9018. let value = null;
  9019. let rotation = null;
  9020. if (annotationStorage) {
  9021. const storageEntry = annotationStorage.get(this.data.id);
  9022. value = storageEntry ? storageEntry.value : null;
  9023. rotation = storageEntry ? storageEntry.rotation : null;
  9024. }
  9025. if (value === null && this.appearance) {
  9026. return super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage);
  9027. }
  9028. if (value === null || value === undefined) {
  9029. if (this.data.checkBox) {
  9030. value = this.data.fieldValue === this.data.exportValue;
  9031. } else {
  9032. value = this.data.fieldValue === this.data.buttonValue;
  9033. }
  9034. }
  9035. const appearance = value ? this.checkedAppearance : this.uncheckedAppearance;
  9036. if (appearance) {
  9037. const savedAppearance = this.appearance;
  9038. const savedMatrix = appearance.dict.getArray("Matrix") || _util.IDENTITY_MATRIX;
  9039. if (rotation) {
  9040. appearance.dict.set("Matrix", this.getRotationMatrix(annotationStorage));
  9041. }
  9042. this.appearance = appearance;
  9043. const operatorList = super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage);
  9044. this.appearance = savedAppearance;
  9045. appearance.dict.set("Matrix", savedMatrix);
  9046. return operatorList;
  9047. }
  9048. return {
  9049. opList: new _operator_list.OperatorList(),
  9050. separateForm: false,
  9051. separateCanvas: false
  9052. };
  9053. }
  9054. async save(evaluator, task, annotationStorage) {
  9055. if (this.data.checkBox) {
  9056. return this._saveCheckbox(evaluator, task, annotationStorage);
  9057. }
  9058. if (this.data.radioButton) {
  9059. return this._saveRadioButton(evaluator, task, annotationStorage);
  9060. }
  9061. return null;
  9062. }
  9063. async _saveCheckbox(evaluator, task, annotationStorage) {
  9064. if (!annotationStorage) {
  9065. return null;
  9066. }
  9067. const storageEntry = annotationStorage.get(this.data.id);
  9068. let rotation = storageEntry && storageEntry.rotation;
  9069. let value = storageEntry && storageEntry.value;
  9070. if (rotation === undefined) {
  9071. if (value === undefined) {
  9072. return null;
  9073. }
  9074. const defaultValue = this.data.fieldValue === this.data.exportValue;
  9075. if (defaultValue === value) {
  9076. return null;
  9077. }
  9078. }
  9079. const dict = evaluator.xref.fetchIfRef(this.ref);
  9080. if (!(dict instanceof _primitives.Dict)) {
  9081. return null;
  9082. }
  9083. if (rotation === undefined) {
  9084. rotation = this.rotation;
  9085. }
  9086. if (value === undefined) {
  9087. value = this.data.fieldValue === this.data.exportValue;
  9088. }
  9089. const xfa = {
  9090. path: (0, _util.stringToPDFString)(dict.get("T") || ""),
  9091. value: value ? this.data.exportValue : ""
  9092. };
  9093. const name = _primitives.Name.get(value ? this.data.exportValue : "Off");
  9094. dict.set("V", name);
  9095. dict.set("AS", name);
  9096. dict.set("M", `D:${(0, _util.getModificationDate)()}`);
  9097. const maybeMK = this._getMKDict(rotation);
  9098. if (maybeMK) {
  9099. dict.set("MK", maybeMK);
  9100. }
  9101. const encrypt = evaluator.xref.encrypt;
  9102. let originalTransform = null;
  9103. if (encrypt) {
  9104. originalTransform = encrypt.createCipherTransform(this.ref.num, this.ref.gen);
  9105. }
  9106. const buffer = [`${this.ref.num} ${this.ref.gen} obj\n`];
  9107. (0, _writer.writeDict)(dict, buffer, originalTransform);
  9108. buffer.push("\nendobj\n");
  9109. return [{
  9110. ref: this.ref,
  9111. data: buffer.join(""),
  9112. xfa
  9113. }];
  9114. }
  9115. async _saveRadioButton(evaluator, task, annotationStorage) {
  9116. if (!annotationStorage) {
  9117. return null;
  9118. }
  9119. const storageEntry = annotationStorage.get(this.data.id);
  9120. let rotation = storageEntry && storageEntry.rotation;
  9121. let value = storageEntry && storageEntry.value;
  9122. if (rotation === undefined) {
  9123. if (value === undefined) {
  9124. return null;
  9125. }
  9126. const defaultValue = this.data.fieldValue === this.data.buttonValue;
  9127. if (defaultValue === value) {
  9128. return null;
  9129. }
  9130. }
  9131. const dict = evaluator.xref.fetchIfRef(this.ref);
  9132. if (!(dict instanceof _primitives.Dict)) {
  9133. return null;
  9134. }
  9135. if (value === undefined) {
  9136. value = this.data.fieldValue === this.data.buttonValue;
  9137. }
  9138. if (rotation === undefined) {
  9139. rotation = this.rotation;
  9140. }
  9141. const xfa = {
  9142. path: (0, _util.stringToPDFString)(dict.get("T") || ""),
  9143. value: value ? this.data.buttonValue : ""
  9144. };
  9145. const name = _primitives.Name.get(value ? this.data.buttonValue : "Off");
  9146. let parentBuffer = null;
  9147. const encrypt = evaluator.xref.encrypt;
  9148. if (value) {
  9149. if (this.parent instanceof _primitives.Ref) {
  9150. const parent = evaluator.xref.fetch(this.parent);
  9151. let parentTransform = null;
  9152. if (encrypt) {
  9153. parentTransform = encrypt.createCipherTransform(this.parent.num, this.parent.gen);
  9154. }
  9155. parent.set("V", name);
  9156. parentBuffer = [`${this.parent.num} ${this.parent.gen} obj\n`];
  9157. (0, _writer.writeDict)(parent, parentBuffer, parentTransform);
  9158. parentBuffer.push("\nendobj\n");
  9159. } else if (this.parent instanceof _primitives.Dict) {
  9160. this.parent.set("V", name);
  9161. }
  9162. }
  9163. dict.set("AS", name);
  9164. dict.set("M", `D:${(0, _util.getModificationDate)()}`);
  9165. const maybeMK = this._getMKDict(rotation);
  9166. if (maybeMK) {
  9167. dict.set("MK", maybeMK);
  9168. }
  9169. let originalTransform = null;
  9170. if (encrypt) {
  9171. originalTransform = encrypt.createCipherTransform(this.ref.num, this.ref.gen);
  9172. }
  9173. const buffer = [`${this.ref.num} ${this.ref.gen} obj\n`];
  9174. (0, _writer.writeDict)(dict, buffer, originalTransform);
  9175. buffer.push("\nendobj\n");
  9176. const newRefs = [{
  9177. ref: this.ref,
  9178. data: buffer.join(""),
  9179. xfa
  9180. }];
  9181. if (parentBuffer !== null) {
  9182. newRefs.push({
  9183. ref: this.parent,
  9184. data: parentBuffer.join(""),
  9185. xfa: null
  9186. });
  9187. }
  9188. return newRefs;
  9189. }
  9190. _getDefaultCheckedAppearance(params, type) {
  9191. const width = this.data.rect[2] - this.data.rect[0];
  9192. const height = this.data.rect[3] - this.data.rect[1];
  9193. const bbox = [0, 0, width, height];
  9194. const FONT_RATIO = 0.8;
  9195. const fontSize = Math.min(width, height) * FONT_RATIO;
  9196. let metrics, char;
  9197. if (type === "check") {
  9198. metrics = {
  9199. width: 0.755 * fontSize,
  9200. height: 0.705 * fontSize
  9201. };
  9202. char = "\x33";
  9203. } else if (type === "disc") {
  9204. metrics = {
  9205. width: 0.791 * fontSize,
  9206. height: 0.705 * fontSize
  9207. };
  9208. char = "\x6C";
  9209. } else {
  9210. (0, _util.unreachable)(`_getDefaultCheckedAppearance - unsupported type: ${type}`);
  9211. }
  9212. const xShift = (0, _core_utils.numberToString)((width - metrics.width) / 2);
  9213. const yShift = (0, _core_utils.numberToString)((height - metrics.height) / 2);
  9214. const appearance = `q BT /PdfJsZaDb ${fontSize} Tf 0 g ${xShift} ${yShift} Td (${char}) Tj ET Q`;
  9215. const appearanceStreamDict = new _primitives.Dict(params.xref);
  9216. appearanceStreamDict.set("FormType", 1);
  9217. appearanceStreamDict.set("Subtype", _primitives.Name.get("Form"));
  9218. appearanceStreamDict.set("Type", _primitives.Name.get("XObject"));
  9219. appearanceStreamDict.set("BBox", bbox);
  9220. appearanceStreamDict.set("Matrix", [1, 0, 0, 1, 0, 0]);
  9221. appearanceStreamDict.set("Length", appearance.length);
  9222. const resources = new _primitives.Dict(params.xref);
  9223. const font = new _primitives.Dict(params.xref);
  9224. font.set("PdfJsZaDb", this.fallbackFontDict);
  9225. resources.set("Font", font);
  9226. appearanceStreamDict.set("Resources", resources);
  9227. this.checkedAppearance = new _stream.StringStream(appearance);
  9228. this.checkedAppearance.dict = appearanceStreamDict;
  9229. this._streams.push(this.checkedAppearance);
  9230. }
  9231. _processCheckBox(params) {
  9232. const customAppearance = params.dict.get("AP");
  9233. if (!(customAppearance instanceof _primitives.Dict)) {
  9234. return;
  9235. }
  9236. const normalAppearance = customAppearance.get("N");
  9237. if (!(normalAppearance instanceof _primitives.Dict)) {
  9238. return;
  9239. }
  9240. const asValue = this._decodeFormValue(params.dict.get("AS"));
  9241. if (typeof asValue === "string") {
  9242. this.data.fieldValue = asValue;
  9243. }
  9244. const yes = this.data.fieldValue !== null && this.data.fieldValue !== "Off" ? this.data.fieldValue : "Yes";
  9245. const exportValues = normalAppearance.getKeys();
  9246. if (exportValues.length === 0) {
  9247. exportValues.push("Off", yes);
  9248. } else if (exportValues.length === 1) {
  9249. if (exportValues[0] === "Off") {
  9250. exportValues.push(yes);
  9251. } else {
  9252. exportValues.unshift("Off");
  9253. }
  9254. } else if (exportValues.includes(yes)) {
  9255. exportValues.length = 0;
  9256. exportValues.push("Off", yes);
  9257. } else {
  9258. const otherYes = exportValues.find(v => v !== "Off");
  9259. exportValues.length = 0;
  9260. exportValues.push("Off", otherYes);
  9261. }
  9262. if (!exportValues.includes(this.data.fieldValue)) {
  9263. this.data.fieldValue = "Off";
  9264. }
  9265. this.data.exportValue = exportValues[1];
  9266. this.checkedAppearance = normalAppearance.get(this.data.exportValue) || null;
  9267. this.uncheckedAppearance = normalAppearance.get("Off") || null;
  9268. if (this.checkedAppearance) {
  9269. this._streams.push(this.checkedAppearance);
  9270. } else {
  9271. this._getDefaultCheckedAppearance(params, "check");
  9272. }
  9273. if (this.uncheckedAppearance) {
  9274. this._streams.push(this.uncheckedAppearance);
  9275. }
  9276. this._fallbackFontDict = this.fallbackFontDict;
  9277. }
  9278. _processRadioButton(params) {
  9279. this.data.fieldValue = this.data.buttonValue = null;
  9280. const fieldParent = params.dict.get("Parent");
  9281. if (fieldParent instanceof _primitives.Dict) {
  9282. this.parent = params.dict.getRaw("Parent");
  9283. const fieldParentValue = fieldParent.get("V");
  9284. if (fieldParentValue instanceof _primitives.Name) {
  9285. this.data.fieldValue = this._decodeFormValue(fieldParentValue);
  9286. }
  9287. }
  9288. const appearanceStates = params.dict.get("AP");
  9289. if (!(appearanceStates instanceof _primitives.Dict)) {
  9290. return;
  9291. }
  9292. const normalAppearance = appearanceStates.get("N");
  9293. if (!(normalAppearance instanceof _primitives.Dict)) {
  9294. return;
  9295. }
  9296. for (const key of normalAppearance.getKeys()) {
  9297. if (key !== "Off") {
  9298. this.data.buttonValue = this._decodeFormValue(key);
  9299. break;
  9300. }
  9301. }
  9302. this.checkedAppearance = normalAppearance.get(this.data.buttonValue) || null;
  9303. this.uncheckedAppearance = normalAppearance.get("Off") || null;
  9304. if (this.checkedAppearance) {
  9305. this._streams.push(this.checkedAppearance);
  9306. } else {
  9307. this._getDefaultCheckedAppearance(params, "disc");
  9308. }
  9309. if (this.uncheckedAppearance) {
  9310. this._streams.push(this.uncheckedAppearance);
  9311. }
  9312. this._fallbackFontDict = this.fallbackFontDict;
  9313. }
  9314. _processPushButton(params) {
  9315. if (!params.dict.has("A") && !params.dict.has("AA") && !this.data.alternativeText) {
  9316. (0, _util.warn)("Push buttons without action dictionaries are not supported");
  9317. return;
  9318. }
  9319. this.data.isTooltipOnly = !params.dict.has("A") && !params.dict.has("AA");
  9320. _catalog.Catalog.parseDestDictionary({
  9321. destDict: params.dict,
  9322. resultObj: this.data,
  9323. docBaseUrl: params.pdfManager.docBaseUrl,
  9324. docAttachments: params.attachments
  9325. });
  9326. }
  9327. getFieldObject() {
  9328. let type = "button";
  9329. let exportValues;
  9330. if (this.data.checkBox) {
  9331. type = "checkbox";
  9332. exportValues = this.data.exportValue;
  9333. } else if (this.data.radioButton) {
  9334. type = "radiobutton";
  9335. exportValues = this.data.buttonValue;
  9336. }
  9337. return {
  9338. id: this.data.id,
  9339. value: this.data.fieldValue || "Off",
  9340. defaultValue: this.data.defaultFieldValue,
  9341. exportValues,
  9342. editable: !this.data.readOnly,
  9343. name: this.data.fieldName,
  9344. rect: this.data.rect,
  9345. hidden: this.data.hidden,
  9346. actions: this.data.actions,
  9347. page: this.data.pageIndex,
  9348. strokeColor: this.data.borderColor,
  9349. fillColor: this.data.backgroundColor,
  9350. rotation: this.rotation,
  9351. type
  9352. };
  9353. }
  9354. get fallbackFontDict() {
  9355. const dict = new _primitives.Dict();
  9356. dict.set("BaseFont", _primitives.Name.get("ZapfDingbats"));
  9357. dict.set("Type", _primitives.Name.get("FallbackType"));
  9358. dict.set("Subtype", _primitives.Name.get("FallbackType"));
  9359. dict.set("Encoding", _primitives.Name.get("ZapfDingbatsEncoding"));
  9360. return (0, _util.shadow)(this, "fallbackFontDict", dict);
  9361. }
  9362. }
  9363. class ChoiceWidgetAnnotation extends WidgetAnnotation {
  9364. constructor(params) {
  9365. super(params);
  9366. const {
  9367. dict,
  9368. xref
  9369. } = params;
  9370. this.data.options = [];
  9371. const options = (0, _core_utils.getInheritableProperty)({
  9372. dict,
  9373. key: "Opt"
  9374. });
  9375. if (Array.isArray(options)) {
  9376. for (let i = 0, ii = options.length; i < ii; i++) {
  9377. const option = xref.fetchIfRef(options[i]);
  9378. const isOptionArray = Array.isArray(option);
  9379. this.data.options[i] = {
  9380. exportValue: this._decodeFormValue(isOptionArray ? xref.fetchIfRef(option[0]) : option),
  9381. displayValue: this._decodeFormValue(isOptionArray ? xref.fetchIfRef(option[1]) : option)
  9382. };
  9383. }
  9384. }
  9385. if (typeof this.data.fieldValue === "string") {
  9386. this.data.fieldValue = [this.data.fieldValue];
  9387. } else if (!this.data.fieldValue) {
  9388. this.data.fieldValue = [];
  9389. }
  9390. this.data.combo = this.hasFieldFlag(_util.AnnotationFieldFlag.COMBO);
  9391. this.data.multiSelect = this.hasFieldFlag(_util.AnnotationFieldFlag.MULTISELECT);
  9392. this._hasText = true;
  9393. }
  9394. getFieldObject() {
  9395. const type = this.data.combo ? "combobox" : "listbox";
  9396. const value = this.data.fieldValue.length > 0 ? this.data.fieldValue[0] : null;
  9397. return {
  9398. id: this.data.id,
  9399. value,
  9400. defaultValue: this.data.defaultFieldValue,
  9401. editable: !this.data.readOnly,
  9402. name: this.data.fieldName,
  9403. rect: this.data.rect,
  9404. numItems: this.data.fieldValue.length,
  9405. multipleSelection: this.data.multiSelect,
  9406. hidden: this.data.hidden,
  9407. actions: this.data.actions,
  9408. items: this.data.options,
  9409. page: this.data.pageIndex,
  9410. strokeColor: this.data.borderColor,
  9411. fillColor: this.data.backgroundColor,
  9412. rotation: this.rotation,
  9413. type
  9414. };
  9415. }
  9416. async _getAppearance(evaluator, task, intent, annotationStorage) {
  9417. if (this.data.combo) {
  9418. return super._getAppearance(evaluator, task, intent, annotationStorage);
  9419. }
  9420. let exportedValue, rotation;
  9421. const storageEntry = annotationStorage ? annotationStorage.get(this.data.id) : undefined;
  9422. if (storageEntry) {
  9423. rotation = storageEntry.rotation;
  9424. exportedValue = storageEntry.value;
  9425. }
  9426. if (rotation === undefined && exportedValue === undefined && !this._needAppearances) {
  9427. return null;
  9428. }
  9429. if (exportedValue === undefined) {
  9430. exportedValue = this.data.fieldValue;
  9431. } else if (!Array.isArray(exportedValue)) {
  9432. exportedValue = [exportedValue];
  9433. }
  9434. const defaultPadding = 1;
  9435. const defaultHPadding = 2;
  9436. let totalHeight = this.data.rect[3] - this.data.rect[1];
  9437. let totalWidth = this.data.rect[2] - this.data.rect[0];
  9438. if (rotation === 90 || rotation === 270) {
  9439. [totalWidth, totalHeight] = [totalHeight, totalWidth];
  9440. }
  9441. const lineCount = this.data.options.length;
  9442. const valueIndices = [];
  9443. for (let i = 0; i < lineCount; i++) {
  9444. const {
  9445. exportValue
  9446. } = this.data.options[i];
  9447. if (exportedValue.includes(exportValue)) {
  9448. valueIndices.push(i);
  9449. }
  9450. }
  9451. if (!this._defaultAppearance) {
  9452. this.data.defaultAppearanceData = (0, _default_appearance.parseDefaultAppearance)(this._defaultAppearance = "/Helvetica 0 Tf 0 g");
  9453. }
  9454. const font = await WidgetAnnotation._getFontData(evaluator, task, this.data.defaultAppearanceData, this._fieldResources.mergedResources);
  9455. let defaultAppearance;
  9456. let {
  9457. fontSize
  9458. } = this.data.defaultAppearanceData;
  9459. if (!fontSize) {
  9460. const lineHeight = (totalHeight - defaultPadding) / lineCount;
  9461. let lineWidth = -1;
  9462. let value;
  9463. for (const {
  9464. displayValue
  9465. } of this.data.options) {
  9466. const width = this._getTextWidth(displayValue, font);
  9467. if (width > lineWidth) {
  9468. lineWidth = width;
  9469. value = displayValue;
  9470. }
  9471. }
  9472. [defaultAppearance, fontSize] = this._computeFontSize(lineHeight, totalWidth - 2 * defaultHPadding, value, font, -1);
  9473. } else {
  9474. defaultAppearance = this._defaultAppearance;
  9475. }
  9476. const lineHeight = fontSize * _util.LINE_FACTOR;
  9477. const vPadding = (lineHeight - fontSize) / 2;
  9478. const numberOfVisibleLines = Math.floor(totalHeight / lineHeight);
  9479. let firstIndex;
  9480. if (valueIndices.length === 1) {
  9481. const valuePosition = valueIndices[0];
  9482. const indexInPage = valuePosition % numberOfVisibleLines;
  9483. firstIndex = valuePosition - indexInPage;
  9484. } else {
  9485. firstIndex = valueIndices.length ? valueIndices[0] : 0;
  9486. }
  9487. const end = Math.min(firstIndex + numberOfVisibleLines + 1, lineCount);
  9488. const buf = ["/Tx BMC q", `1 1 ${totalWidth} ${totalHeight} re W n`];
  9489. if (valueIndices.length) {
  9490. buf.push("0.600006 0.756866 0.854904 rg");
  9491. for (const index of valueIndices) {
  9492. if (firstIndex <= index && index < end) {
  9493. buf.push(`1 ${totalHeight - (index - firstIndex + 1) * lineHeight} ${totalWidth} ${lineHeight} re f`);
  9494. }
  9495. }
  9496. }
  9497. buf.push("BT", defaultAppearance, `1 0 0 1 0 ${totalHeight} Tm`);
  9498. const prevInfo = {
  9499. shift: 0
  9500. };
  9501. for (let i = firstIndex; i < end; i++) {
  9502. const {
  9503. displayValue
  9504. } = this.data.options[i];
  9505. const vpadding = i === firstIndex ? vPadding : 0;
  9506. buf.push(this._renderText(displayValue, font, fontSize, totalWidth, 0, prevInfo, defaultHPadding, -lineHeight + vpadding));
  9507. }
  9508. buf.push("ET Q EMC");
  9509. return buf.join("\n");
  9510. }
  9511. }
  9512. class SignatureWidgetAnnotation extends WidgetAnnotation {
  9513. constructor(params) {
  9514. super(params);
  9515. this.data.fieldValue = null;
  9516. }
  9517. getFieldObject() {
  9518. return {
  9519. id: this.data.id,
  9520. value: null,
  9521. page: this.data.pageIndex,
  9522. type: "signature"
  9523. };
  9524. }
  9525. }
  9526. class TextAnnotation extends MarkupAnnotation {
  9527. constructor(params) {
  9528. const DEFAULT_ICON_SIZE = 22;
  9529. super(params);
  9530. const {
  9531. dict
  9532. } = params;
  9533. this.data.annotationType = _util.AnnotationType.TEXT;
  9534. if (this.data.hasAppearance) {
  9535. this.data.name = "NoIcon";
  9536. } else {
  9537. this.data.rect[1] = this.data.rect[3] - DEFAULT_ICON_SIZE;
  9538. this.data.rect[2] = this.data.rect[0] + DEFAULT_ICON_SIZE;
  9539. this.data.name = dict.has("Name") ? dict.get("Name").name : "Note";
  9540. }
  9541. if (dict.has("State")) {
  9542. this.data.state = dict.get("State") || null;
  9543. this.data.stateModel = dict.get("StateModel") || null;
  9544. } else {
  9545. this.data.state = null;
  9546. this.data.stateModel = null;
  9547. }
  9548. }
  9549. }
  9550. class LinkAnnotation extends Annotation {
  9551. constructor(params) {
  9552. super(params);
  9553. this.data.annotationType = _util.AnnotationType.LINK;
  9554. const quadPoints = getQuadPoints(params.dict, this.rectangle);
  9555. if (quadPoints) {
  9556. this.data.quadPoints = quadPoints;
  9557. }
  9558. this.data.borderColor = this.data.borderColor || this.data.color;
  9559. _catalog.Catalog.parseDestDictionary({
  9560. destDict: params.dict,
  9561. resultObj: this.data,
  9562. docBaseUrl: params.pdfManager.docBaseUrl,
  9563. docAttachments: params.attachments
  9564. });
  9565. }
  9566. }
  9567. class PopupAnnotation extends Annotation {
  9568. constructor(params) {
  9569. super(params);
  9570. const {
  9571. dict
  9572. } = params;
  9573. this.data.annotationType = _util.AnnotationType.POPUP;
  9574. let parentItem = dict.get("Parent");
  9575. if (!parentItem) {
  9576. (0, _util.warn)("Popup annotation has a missing or invalid parent annotation.");
  9577. return;
  9578. }
  9579. const parentSubtype = parentItem.get("Subtype");
  9580. this.data.parentType = parentSubtype instanceof _primitives.Name ? parentSubtype.name : null;
  9581. const rawParent = dict.getRaw("Parent");
  9582. this.data.parentId = rawParent instanceof _primitives.Ref ? rawParent.toString() : null;
  9583. const parentRect = parentItem.getArray("Rect");
  9584. if (Array.isArray(parentRect) && parentRect.length === 4) {
  9585. this.data.parentRect = _util.Util.normalizeRect(parentRect);
  9586. } else {
  9587. this.data.parentRect = [0, 0, 0, 0];
  9588. }
  9589. const rt = parentItem.get("RT");
  9590. if ((0, _primitives.isName)(rt, _util.AnnotationReplyType.GROUP)) {
  9591. parentItem = parentItem.get("IRT");
  9592. }
  9593. if (!parentItem.has("M")) {
  9594. this.data.modificationDate = null;
  9595. } else {
  9596. this.setModificationDate(parentItem.get("M"));
  9597. this.data.modificationDate = this.modificationDate;
  9598. }
  9599. if (!parentItem.has("C")) {
  9600. this.data.color = null;
  9601. } else {
  9602. this.setColor(parentItem.getArray("C"));
  9603. this.data.color = this.color;
  9604. }
  9605. if (!this.viewable) {
  9606. const parentFlags = parentItem.get("F");
  9607. if (this._isViewable(parentFlags)) {
  9608. this.setFlags(parentFlags);
  9609. }
  9610. }
  9611. this.setTitle(parentItem.get("T"));
  9612. this.data.titleObj = this._title;
  9613. this.setContents(parentItem.get("Contents"));
  9614. this.data.contentsObj = this._contents;
  9615. if (parentItem.has("RC")) {
  9616. this.data.richText = _factory.XFAFactory.getRichTextAsHtml(parentItem.get("RC"));
  9617. }
  9618. }
  9619. }
  9620. exports.PopupAnnotation = PopupAnnotation;
  9621. class FreeTextAnnotation extends MarkupAnnotation {
  9622. constructor(params) {
  9623. super(params);
  9624. const {
  9625. xref
  9626. } = params;
  9627. this.data.annotationType = _util.AnnotationType.FREETEXT;
  9628. this.setDefaultAppearance(params);
  9629. if (!this.appearance && this._isOffscreenCanvasSupported) {
  9630. const fakeUnicodeFont = new _default_appearance.FakeUnicodeFont(xref, "sans-serif");
  9631. const fontData = this.data.defaultAppearanceData;
  9632. this.appearance = fakeUnicodeFont.createAppearance(this._contents.str, this.rectangle, this.rotation, fontData.fontSize || 10, fontData.fontColor);
  9633. this._streams.push(this.appearance, _default_appearance.FakeUnicodeFont.toUnicodeStream);
  9634. } else if (!this._isOffscreenCanvasSupported) {
  9635. (0, _util.warn)("FreeTextAnnotation: OffscreenCanvas is not supported, annotation may not render correctly.");
  9636. }
  9637. }
  9638. get hasTextContent() {
  9639. return !!this.appearance;
  9640. }
  9641. static createNewDict(annotation, xref, _ref3) {
  9642. let {
  9643. apRef,
  9644. ap
  9645. } = _ref3;
  9646. const {
  9647. color,
  9648. fontSize,
  9649. rect,
  9650. rotation,
  9651. user,
  9652. value
  9653. } = annotation;
  9654. const freetext = new _primitives.Dict(xref);
  9655. freetext.set("Type", _primitives.Name.get("Annot"));
  9656. freetext.set("Subtype", _primitives.Name.get("FreeText"));
  9657. freetext.set("CreationDate", `D:${(0, _util.getModificationDate)()}`);
  9658. freetext.set("Rect", rect);
  9659. const da = `/Helv ${fontSize} Tf ${(0, _default_appearance.getPdfColor)(color, true)}`;
  9660. freetext.set("DA", da);
  9661. freetext.set("Contents", (0, _core_utils.isAscii)(value) ? value : (0, _core_utils.stringToUTF16String)(value, true));
  9662. freetext.set("F", 4);
  9663. freetext.set("Border", [0, 0, 0]);
  9664. freetext.set("Rotate", rotation);
  9665. if (user) {
  9666. freetext.set("T", (0, _core_utils.isAscii)(user) ? user : (0, _core_utils.stringToUTF16String)(user, true));
  9667. }
  9668. if (apRef || ap) {
  9669. const n = new _primitives.Dict(xref);
  9670. freetext.set("AP", n);
  9671. if (apRef) {
  9672. n.set("N", apRef);
  9673. } else {
  9674. n.set("N", ap);
  9675. }
  9676. }
  9677. return freetext;
  9678. }
  9679. static async createNewAppearanceStream(annotation, xref, params) {
  9680. const {
  9681. baseFontRef,
  9682. evaluator,
  9683. task
  9684. } = params;
  9685. const {
  9686. color,
  9687. fontSize,
  9688. rect,
  9689. rotation,
  9690. value
  9691. } = annotation;
  9692. const resources = new _primitives.Dict(xref);
  9693. const font = new _primitives.Dict(xref);
  9694. if (baseFontRef) {
  9695. font.set("Helv", baseFontRef);
  9696. } else {
  9697. const baseFont = new _primitives.Dict(xref);
  9698. baseFont.set("BaseFont", _primitives.Name.get("Helvetica"));
  9699. baseFont.set("Type", _primitives.Name.get("Font"));
  9700. baseFont.set("Subtype", _primitives.Name.get("Type1"));
  9701. baseFont.set("Encoding", _primitives.Name.get("WinAnsiEncoding"));
  9702. font.set("Helv", baseFont);
  9703. }
  9704. resources.set("Font", font);
  9705. const helv = await WidgetAnnotation._getFontData(evaluator, task, {
  9706. fontName: "Helvetica",
  9707. fontSize
  9708. }, resources);
  9709. const [x1, y1, x2, y2] = rect;
  9710. let w = x2 - x1;
  9711. let h = y2 - y1;
  9712. if (rotation % 180 !== 0) {
  9713. [w, h] = [h, w];
  9714. }
  9715. const lines = value.split("\n");
  9716. const scale = fontSize / 1000;
  9717. let totalWidth = -Infinity;
  9718. const encodedLines = [];
  9719. for (let line of lines) {
  9720. const encoded = helv.encodeString(line);
  9721. if (encoded.length > 1) {
  9722. return null;
  9723. }
  9724. line = encoded.join("");
  9725. encodedLines.push(line);
  9726. let lineWidth = 0;
  9727. const glyphs = helv.charsToGlyphs(line);
  9728. for (const glyph of glyphs) {
  9729. lineWidth += glyph.width * scale;
  9730. }
  9731. totalWidth = Math.max(totalWidth, lineWidth);
  9732. }
  9733. let hscale = 1;
  9734. if (totalWidth > w) {
  9735. hscale = w / totalWidth;
  9736. }
  9737. let vscale = 1;
  9738. const lineHeight = _util.LINE_FACTOR * fontSize;
  9739. const lineDescent = _util.LINE_DESCENT_FACTOR * fontSize;
  9740. const totalHeight = lineHeight * lines.length;
  9741. if (totalHeight > h) {
  9742. vscale = h / totalHeight;
  9743. }
  9744. const fscale = Math.min(hscale, vscale);
  9745. const newFontSize = fontSize * fscale;
  9746. 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`];
  9747. const vShift = (0, _core_utils.numberToString)(lineHeight);
  9748. for (const line of encodedLines) {
  9749. buffer.push(`0 -${vShift} Td (${(0, _core_utils.escapeString)(line)}) Tj`);
  9750. }
  9751. buffer.push("ET", "Q");
  9752. const appearance = buffer.join("\n");
  9753. const appearanceStreamDict = new _primitives.Dict(xref);
  9754. appearanceStreamDict.set("FormType", 1);
  9755. appearanceStreamDict.set("Subtype", _primitives.Name.get("Form"));
  9756. appearanceStreamDict.set("Type", _primitives.Name.get("XObject"));
  9757. appearanceStreamDict.set("BBox", [0, 0, w, h]);
  9758. appearanceStreamDict.set("Length", appearance.length);
  9759. appearanceStreamDict.set("Resources", resources);
  9760. if (rotation) {
  9761. const matrix = (0, _core_utils.getRotationMatrix)(rotation, w, h);
  9762. appearanceStreamDict.set("Matrix", matrix);
  9763. }
  9764. const ap = new _stream.StringStream(appearance);
  9765. ap.dict = appearanceStreamDict;
  9766. return ap;
  9767. }
  9768. }
  9769. class LineAnnotation extends MarkupAnnotation {
  9770. constructor(params) {
  9771. super(params);
  9772. const {
  9773. dict,
  9774. xref
  9775. } = params;
  9776. this.data.annotationType = _util.AnnotationType.LINE;
  9777. const lineCoordinates = dict.getArray("L");
  9778. this.data.lineCoordinates = _util.Util.normalizeRect(lineCoordinates);
  9779. this.setLineEndings(dict.getArray("LE"));
  9780. this.data.lineEndings = this.lineEndings;
  9781. if (!this.appearance) {
  9782. const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
  9783. const strokeAlpha = dict.get("CA");
  9784. const interiorColor = getRgbColor(dict.getArray("IC"), null);
  9785. const fillColor = interiorColor ? getPdfColorArray(interiorColor) : null;
  9786. const fillAlpha = fillColor ? strokeAlpha : null;
  9787. const borderWidth = this.borderStyle.width || 1,
  9788. borderAdjust = 2 * borderWidth;
  9789. const bbox = [this.data.lineCoordinates[0] - borderAdjust, this.data.lineCoordinates[1] - borderAdjust, this.data.lineCoordinates[2] + borderAdjust, this.data.lineCoordinates[3] + borderAdjust];
  9790. if (!_util.Util.intersect(this.rectangle, bbox)) {
  9791. this.rectangle = bbox;
  9792. }
  9793. this._setDefaultAppearance({
  9794. xref,
  9795. extra: `${borderWidth} w`,
  9796. strokeColor,
  9797. fillColor,
  9798. strokeAlpha,
  9799. fillAlpha,
  9800. pointsCallback: (buffer, points) => {
  9801. buffer.push(`${lineCoordinates[0]} ${lineCoordinates[1]} m`, `${lineCoordinates[2]} ${lineCoordinates[3]} l`, "S");
  9802. return [points[0].x - borderWidth, points[1].x + borderWidth, points[3].y - borderWidth, points[1].y + borderWidth];
  9803. }
  9804. });
  9805. }
  9806. }
  9807. }
  9808. class SquareAnnotation extends MarkupAnnotation {
  9809. constructor(params) {
  9810. super(params);
  9811. const {
  9812. dict,
  9813. xref
  9814. } = params;
  9815. this.data.annotationType = _util.AnnotationType.SQUARE;
  9816. if (!this.appearance) {
  9817. const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
  9818. const strokeAlpha = dict.get("CA");
  9819. const interiorColor = getRgbColor(dict.getArray("IC"), null);
  9820. const fillColor = interiorColor ? getPdfColorArray(interiorColor) : null;
  9821. const fillAlpha = fillColor ? strokeAlpha : null;
  9822. if (this.borderStyle.width === 0 && !fillColor) {
  9823. return;
  9824. }
  9825. this._setDefaultAppearance({
  9826. xref,
  9827. extra: `${this.borderStyle.width} w`,
  9828. strokeColor,
  9829. fillColor,
  9830. strokeAlpha,
  9831. fillAlpha,
  9832. pointsCallback: (buffer, points) => {
  9833. const x = points[2].x + this.borderStyle.width / 2;
  9834. const y = points[2].y + this.borderStyle.width / 2;
  9835. const width = points[3].x - points[2].x - this.borderStyle.width;
  9836. const height = points[1].y - points[3].y - this.borderStyle.width;
  9837. buffer.push(`${x} ${y} ${width} ${height} re`);
  9838. if (fillColor) {
  9839. buffer.push("B");
  9840. } else {
  9841. buffer.push("S");
  9842. }
  9843. return [points[0].x, points[1].x, points[3].y, points[1].y];
  9844. }
  9845. });
  9846. }
  9847. }
  9848. }
  9849. class CircleAnnotation extends MarkupAnnotation {
  9850. constructor(params) {
  9851. super(params);
  9852. const {
  9853. dict,
  9854. xref
  9855. } = params;
  9856. this.data.annotationType = _util.AnnotationType.CIRCLE;
  9857. if (!this.appearance) {
  9858. const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
  9859. const strokeAlpha = dict.get("CA");
  9860. const interiorColor = getRgbColor(dict.getArray("IC"), null);
  9861. const fillColor = interiorColor ? getPdfColorArray(interiorColor) : null;
  9862. const fillAlpha = fillColor ? strokeAlpha : null;
  9863. if (this.borderStyle.width === 0 && !fillColor) {
  9864. return;
  9865. }
  9866. const controlPointsDistance = 4 / 3 * Math.tan(Math.PI / (2 * 4));
  9867. this._setDefaultAppearance({
  9868. xref,
  9869. extra: `${this.borderStyle.width} w`,
  9870. strokeColor,
  9871. fillColor,
  9872. strokeAlpha,
  9873. fillAlpha,
  9874. pointsCallback: (buffer, points) => {
  9875. const x0 = points[0].x + this.borderStyle.width / 2;
  9876. const y0 = points[0].y - this.borderStyle.width / 2;
  9877. const x1 = points[3].x - this.borderStyle.width / 2;
  9878. const y1 = points[3].y + this.borderStyle.width / 2;
  9879. const xMid = x0 + (x1 - x0) / 2;
  9880. const yMid = y0 + (y1 - y0) / 2;
  9881. const xOffset = (x1 - x0) / 2 * controlPointsDistance;
  9882. const yOffset = (y1 - y0) / 2 * controlPointsDistance;
  9883. 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");
  9884. if (fillColor) {
  9885. buffer.push("B");
  9886. } else {
  9887. buffer.push("S");
  9888. }
  9889. return [points[0].x, points[1].x, points[3].y, points[1].y];
  9890. }
  9891. });
  9892. }
  9893. }
  9894. }
  9895. class PolylineAnnotation extends MarkupAnnotation {
  9896. constructor(params) {
  9897. super(params);
  9898. const {
  9899. dict,
  9900. xref
  9901. } = params;
  9902. this.data.annotationType = _util.AnnotationType.POLYLINE;
  9903. this.data.vertices = [];
  9904. if (!(this instanceof PolygonAnnotation)) {
  9905. this.setLineEndings(dict.getArray("LE"));
  9906. this.data.lineEndings = this.lineEndings;
  9907. }
  9908. const rawVertices = dict.getArray("Vertices");
  9909. if (!Array.isArray(rawVertices)) {
  9910. return;
  9911. }
  9912. for (let i = 0, ii = rawVertices.length; i < ii; i += 2) {
  9913. this.data.vertices.push({
  9914. x: rawVertices[i],
  9915. y: rawVertices[i + 1]
  9916. });
  9917. }
  9918. if (!this.appearance) {
  9919. const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
  9920. const strokeAlpha = dict.get("CA");
  9921. const borderWidth = this.borderStyle.width || 1,
  9922. borderAdjust = 2 * borderWidth;
  9923. const bbox = [Infinity, Infinity, -Infinity, -Infinity];
  9924. for (const vertex of this.data.vertices) {
  9925. bbox[0] = Math.min(bbox[0], vertex.x - borderAdjust);
  9926. bbox[1] = Math.min(bbox[1], vertex.y - borderAdjust);
  9927. bbox[2] = Math.max(bbox[2], vertex.x + borderAdjust);
  9928. bbox[3] = Math.max(bbox[3], vertex.y + borderAdjust);
  9929. }
  9930. if (!_util.Util.intersect(this.rectangle, bbox)) {
  9931. this.rectangle = bbox;
  9932. }
  9933. this._setDefaultAppearance({
  9934. xref,
  9935. extra: `${borderWidth} w`,
  9936. strokeColor,
  9937. strokeAlpha,
  9938. pointsCallback: (buffer, points) => {
  9939. const vertices = this.data.vertices;
  9940. for (let i = 0, ii = vertices.length; i < ii; i++) {
  9941. buffer.push(`${vertices[i].x} ${vertices[i].y} ${i === 0 ? "m" : "l"}`);
  9942. }
  9943. buffer.push("S");
  9944. return [points[0].x, points[1].x, points[3].y, points[1].y];
  9945. }
  9946. });
  9947. }
  9948. }
  9949. }
  9950. class PolygonAnnotation extends PolylineAnnotation {
  9951. constructor(params) {
  9952. super(params);
  9953. this.data.annotationType = _util.AnnotationType.POLYGON;
  9954. }
  9955. }
  9956. class CaretAnnotation extends MarkupAnnotation {
  9957. constructor(params) {
  9958. super(params);
  9959. this.data.annotationType = _util.AnnotationType.CARET;
  9960. }
  9961. }
  9962. class InkAnnotation extends MarkupAnnotation {
  9963. constructor(params) {
  9964. super(params);
  9965. const {
  9966. dict,
  9967. xref
  9968. } = params;
  9969. this.data.annotationType = _util.AnnotationType.INK;
  9970. this.data.inkLists = [];
  9971. const rawInkLists = dict.getArray("InkList");
  9972. if (!Array.isArray(rawInkLists)) {
  9973. return;
  9974. }
  9975. for (let i = 0, ii = rawInkLists.length; i < ii; ++i) {
  9976. this.data.inkLists.push([]);
  9977. for (let j = 0, jj = rawInkLists[i].length; j < jj; j += 2) {
  9978. this.data.inkLists[i].push({
  9979. x: xref.fetchIfRef(rawInkLists[i][j]),
  9980. y: xref.fetchIfRef(rawInkLists[i][j + 1])
  9981. });
  9982. }
  9983. }
  9984. if (!this.appearance) {
  9985. const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
  9986. const strokeAlpha = dict.get("CA");
  9987. const borderWidth = this.borderStyle.width || 1,
  9988. borderAdjust = 2 * borderWidth;
  9989. const bbox = [Infinity, Infinity, -Infinity, -Infinity];
  9990. for (const inkLists of this.data.inkLists) {
  9991. for (const vertex of inkLists) {
  9992. bbox[0] = Math.min(bbox[0], vertex.x - borderAdjust);
  9993. bbox[1] = Math.min(bbox[1], vertex.y - borderAdjust);
  9994. bbox[2] = Math.max(bbox[2], vertex.x + borderAdjust);
  9995. bbox[3] = Math.max(bbox[3], vertex.y + borderAdjust);
  9996. }
  9997. }
  9998. if (!_util.Util.intersect(this.rectangle, bbox)) {
  9999. this.rectangle = bbox;
  10000. }
  10001. this._setDefaultAppearance({
  10002. xref,
  10003. extra: `${borderWidth} w`,
  10004. strokeColor,
  10005. strokeAlpha,
  10006. pointsCallback: (buffer, points) => {
  10007. for (const inkList of this.data.inkLists) {
  10008. for (let i = 0, ii = inkList.length; i < ii; i++) {
  10009. buffer.push(`${inkList[i].x} ${inkList[i].y} ${i === 0 ? "m" : "l"}`);
  10010. }
  10011. buffer.push("S");
  10012. }
  10013. return [points[0].x, points[1].x, points[3].y, points[1].y];
  10014. }
  10015. });
  10016. }
  10017. }
  10018. static createNewDict(annotation, xref, _ref4) {
  10019. let {
  10020. apRef,
  10021. ap
  10022. } = _ref4;
  10023. const {
  10024. paths,
  10025. rect,
  10026. rotation
  10027. } = annotation;
  10028. const ink = new _primitives.Dict(xref);
  10029. ink.set("Type", _primitives.Name.get("Annot"));
  10030. ink.set("Subtype", _primitives.Name.get("Ink"));
  10031. ink.set("CreationDate", `D:${(0, _util.getModificationDate)()}`);
  10032. ink.set("Rect", rect);
  10033. ink.set("InkList", paths.map(p => p.points));
  10034. ink.set("F", 4);
  10035. ink.set("Border", [0, 0, 0]);
  10036. ink.set("Rotate", rotation);
  10037. const n = new _primitives.Dict(xref);
  10038. ink.set("AP", n);
  10039. if (apRef) {
  10040. n.set("N", apRef);
  10041. } else {
  10042. n.set("N", ap);
  10043. }
  10044. return ink;
  10045. }
  10046. static async createNewAppearanceStream(annotation, xref, params) {
  10047. const {
  10048. color,
  10049. rect,
  10050. rotation,
  10051. paths,
  10052. thickness,
  10053. opacity
  10054. } = annotation;
  10055. const [x1, y1, x2, y2] = rect;
  10056. let w = x2 - x1;
  10057. let h = y2 - y1;
  10058. if (rotation % 180 !== 0) {
  10059. [w, h] = [h, w];
  10060. }
  10061. const appearanceBuffer = [`${thickness} w 1 J 1 j`, `${(0, _default_appearance.getPdfColor)(color, false)}`];
  10062. if (opacity !== 1) {
  10063. appearanceBuffer.push("/R0 gs");
  10064. }
  10065. const buffer = [];
  10066. for (const {
  10067. bezier
  10068. } of paths) {
  10069. buffer.length = 0;
  10070. buffer.push(`${(0, _core_utils.numberToString)(bezier[0])} ${(0, _core_utils.numberToString)(bezier[1])} m`);
  10071. for (let i = 2, ii = bezier.length; i < ii; i += 6) {
  10072. const curve = bezier.slice(i, i + 6).map(_core_utils.numberToString).join(" ");
  10073. buffer.push(`${curve} c`);
  10074. }
  10075. buffer.push("S");
  10076. appearanceBuffer.push(buffer.join("\n"));
  10077. }
  10078. const appearance = appearanceBuffer.join("\n");
  10079. const appearanceStreamDict = new _primitives.Dict(xref);
  10080. appearanceStreamDict.set("FormType", 1);
  10081. appearanceStreamDict.set("Subtype", _primitives.Name.get("Form"));
  10082. appearanceStreamDict.set("Type", _primitives.Name.get("XObject"));
  10083. appearanceStreamDict.set("BBox", [0, 0, w, h]);
  10084. appearanceStreamDict.set("Length", appearance.length);
  10085. if (rotation) {
  10086. const matrix = (0, _core_utils.getRotationMatrix)(rotation, w, h);
  10087. appearanceStreamDict.set("Matrix", matrix);
  10088. }
  10089. if (opacity !== 1) {
  10090. const resources = new _primitives.Dict(xref);
  10091. const extGState = new _primitives.Dict(xref);
  10092. const r0 = new _primitives.Dict(xref);
  10093. r0.set("CA", opacity);
  10094. r0.set("Type", _primitives.Name.get("ExtGState"));
  10095. extGState.set("R0", r0);
  10096. resources.set("ExtGState", extGState);
  10097. appearanceStreamDict.set("Resources", resources);
  10098. }
  10099. const ap = new _stream.StringStream(appearance);
  10100. ap.dict = appearanceStreamDict;
  10101. return ap;
  10102. }
  10103. }
  10104. class HighlightAnnotation extends MarkupAnnotation {
  10105. constructor(params) {
  10106. super(params);
  10107. const {
  10108. dict,
  10109. xref
  10110. } = params;
  10111. this.data.annotationType = _util.AnnotationType.HIGHLIGHT;
  10112. const quadPoints = this.data.quadPoints = getQuadPoints(dict, null);
  10113. if (quadPoints) {
  10114. const resources = this.appearance && this.appearance.dict.get("Resources");
  10115. if (!this.appearance || !(resources && resources.has("ExtGState"))) {
  10116. if (this.appearance) {
  10117. (0, _util.warn)("HighlightAnnotation - ignoring built-in appearance stream.");
  10118. }
  10119. const fillColor = this.color ? getPdfColorArray(this.color) : [1, 1, 0];
  10120. const fillAlpha = dict.get("CA");
  10121. this._setDefaultAppearance({
  10122. xref,
  10123. fillColor,
  10124. blendMode: "Multiply",
  10125. fillAlpha,
  10126. pointsCallback: (buffer, points) => {
  10127. 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");
  10128. return [points[0].x, points[1].x, points[3].y, points[1].y];
  10129. }
  10130. });
  10131. }
  10132. } else {
  10133. this.data.hasPopup = false;
  10134. }
  10135. }
  10136. }
  10137. class UnderlineAnnotation extends MarkupAnnotation {
  10138. constructor(params) {
  10139. super(params);
  10140. const {
  10141. dict,
  10142. xref
  10143. } = params;
  10144. this.data.annotationType = _util.AnnotationType.UNDERLINE;
  10145. const quadPoints = this.data.quadPoints = getQuadPoints(dict, null);
  10146. if (quadPoints) {
  10147. if (!this.appearance) {
  10148. const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
  10149. const strokeAlpha = dict.get("CA");
  10150. this._setDefaultAppearance({
  10151. xref,
  10152. extra: "[] 0 d 1 w",
  10153. strokeColor,
  10154. strokeAlpha,
  10155. pointsCallback: (buffer, points) => {
  10156. buffer.push(`${points[2].x} ${points[2].y} m`, `${points[3].x} ${points[3].y} l`, "S");
  10157. return [points[0].x, points[1].x, points[3].y, points[1].y];
  10158. }
  10159. });
  10160. }
  10161. } else {
  10162. this.data.hasPopup = false;
  10163. }
  10164. }
  10165. }
  10166. class SquigglyAnnotation extends MarkupAnnotation {
  10167. constructor(params) {
  10168. super(params);
  10169. const {
  10170. dict,
  10171. xref
  10172. } = params;
  10173. this.data.annotationType = _util.AnnotationType.SQUIGGLY;
  10174. const quadPoints = this.data.quadPoints = getQuadPoints(dict, null);
  10175. if (quadPoints) {
  10176. if (!this.appearance) {
  10177. const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
  10178. const strokeAlpha = dict.get("CA");
  10179. this._setDefaultAppearance({
  10180. xref,
  10181. extra: "[] 0 d 1 w",
  10182. strokeColor,
  10183. strokeAlpha,
  10184. pointsCallback: (buffer, points) => {
  10185. const dy = (points[0].y - points[2].y) / 6;
  10186. let shift = dy;
  10187. let x = points[2].x;
  10188. const y = points[2].y;
  10189. const xEnd = points[3].x;
  10190. buffer.push(`${x} ${y + shift} m`);
  10191. do {
  10192. x += 2;
  10193. shift = shift === 0 ? dy : 0;
  10194. buffer.push(`${x} ${y + shift} l`);
  10195. } while (x < xEnd);
  10196. buffer.push("S");
  10197. return [points[2].x, xEnd, y - 2 * dy, y + 2 * dy];
  10198. }
  10199. });
  10200. }
  10201. } else {
  10202. this.data.hasPopup = false;
  10203. }
  10204. }
  10205. }
  10206. class StrikeOutAnnotation extends MarkupAnnotation {
  10207. constructor(params) {
  10208. super(params);
  10209. const {
  10210. dict,
  10211. xref
  10212. } = params;
  10213. this.data.annotationType = _util.AnnotationType.STRIKEOUT;
  10214. const quadPoints = this.data.quadPoints = getQuadPoints(dict, null);
  10215. if (quadPoints) {
  10216. if (!this.appearance) {
  10217. const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
  10218. const strokeAlpha = dict.get("CA");
  10219. this._setDefaultAppearance({
  10220. xref,
  10221. extra: "[] 0 d 1 w",
  10222. strokeColor,
  10223. strokeAlpha,
  10224. pointsCallback: (buffer, points) => {
  10225. 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");
  10226. return [points[0].x, points[1].x, points[3].y, points[1].y];
  10227. }
  10228. });
  10229. }
  10230. } else {
  10231. this.data.hasPopup = false;
  10232. }
  10233. }
  10234. }
  10235. class StampAnnotation extends MarkupAnnotation {
  10236. constructor(params) {
  10237. super(params);
  10238. this.data.annotationType = _util.AnnotationType.STAMP;
  10239. }
  10240. }
  10241. class FileAttachmentAnnotation extends MarkupAnnotation {
  10242. constructor(params) {
  10243. super(params);
  10244. const file = new _file_spec.FileSpec(params.dict.get("FS"), params.xref);
  10245. this.data.annotationType = _util.AnnotationType.FILEATTACHMENT;
  10246. this.data.file = file.serializable;
  10247. }
  10248. }
  10249. /***/ }),
  10250. /* 142 */
  10251. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  10252. "use strict";
  10253. Object.defineProperty(exports, "__esModule", ({
  10254. value: true
  10255. }));
  10256. exports.FakeUnicodeFont = void 0;
  10257. exports.createDefaultAppearance = createDefaultAppearance;
  10258. exports.getPdfColor = getPdfColor;
  10259. exports.parseDefaultAppearance = parseDefaultAppearance;
  10260. var _primitives = __w_pdfjs_require__(134);
  10261. var _core_utils = __w_pdfjs_require__(135);
  10262. var _util = __w_pdfjs_require__(2);
  10263. var _colorspace = __w_pdfjs_require__(143);
  10264. var _evaluator = __w_pdfjs_require__(144);
  10265. var _stream = __w_pdfjs_require__(139);
  10266. class DefaultAppearanceEvaluator extends _evaluator.EvaluatorPreprocessor {
  10267. constructor(str) {
  10268. super(new _stream.StringStream(str));
  10269. }
  10270. parse() {
  10271. const operation = {
  10272. fn: 0,
  10273. args: []
  10274. };
  10275. const result = {
  10276. fontSize: 0,
  10277. fontName: "",
  10278. fontColor: new Uint8ClampedArray(3)
  10279. };
  10280. try {
  10281. while (true) {
  10282. operation.args.length = 0;
  10283. if (!this.read(operation)) {
  10284. break;
  10285. }
  10286. if (this.savedStatesDepth !== 0) {
  10287. continue;
  10288. }
  10289. const {
  10290. fn,
  10291. args
  10292. } = operation;
  10293. switch (fn | 0) {
  10294. case _util.OPS.setFont:
  10295. const [fontName, fontSize] = args;
  10296. if (fontName instanceof _primitives.Name) {
  10297. result.fontName = fontName.name;
  10298. }
  10299. if (typeof fontSize === "number" && fontSize > 0) {
  10300. result.fontSize = fontSize;
  10301. }
  10302. break;
  10303. case _util.OPS.setFillRGBColor:
  10304. _colorspace.ColorSpace.singletons.rgb.getRgbItem(args, 0, result.fontColor, 0);
  10305. break;
  10306. case _util.OPS.setFillGray:
  10307. _colorspace.ColorSpace.singletons.gray.getRgbItem(args, 0, result.fontColor, 0);
  10308. break;
  10309. case _util.OPS.setFillColorSpace:
  10310. _colorspace.ColorSpace.singletons.cmyk.getRgbItem(args, 0, result.fontColor, 0);
  10311. break;
  10312. }
  10313. }
  10314. } catch (reason) {
  10315. (0, _util.warn)(`parseDefaultAppearance - ignoring errors: "${reason}".`);
  10316. }
  10317. return result;
  10318. }
  10319. }
  10320. function parseDefaultAppearance(str) {
  10321. return new DefaultAppearanceEvaluator(str).parse();
  10322. }
  10323. function getPdfColor(color, isFill) {
  10324. if (color[0] === color[1] && color[1] === color[2]) {
  10325. const gray = color[0] / 255;
  10326. return `${(0, _core_utils.numberToString)(gray)} ${isFill ? "g" : "G"}`;
  10327. }
  10328. return Array.from(color, c => (0, _core_utils.numberToString)(c / 255)).join(" ") + ` ${isFill ? "rg" : "RG"}`;
  10329. }
  10330. function createDefaultAppearance(_ref) {
  10331. let {
  10332. fontSize,
  10333. fontName,
  10334. fontColor
  10335. } = _ref;
  10336. return `/${(0, _core_utils.escapePDFName)(fontName)} ${fontSize} Tf ${getPdfColor(fontColor, true)}`;
  10337. }
  10338. class FakeUnicodeFont {
  10339. constructor(xref, fontFamily) {
  10340. this.xref = xref;
  10341. this.widths = null;
  10342. this.firstChar = Infinity;
  10343. this.lastChar = -Infinity;
  10344. this.fontFamily = fontFamily;
  10345. const canvas = new OffscreenCanvas(1, 1);
  10346. this.ctxMeasure = canvas.getContext("2d");
  10347. if (!FakeUnicodeFont._fontNameId) {
  10348. FakeUnicodeFont._fontNameId = 1;
  10349. }
  10350. this.fontName = _primitives.Name.get(`InvalidPDFjsFont_${fontFamily}_${FakeUnicodeFont._fontNameId++}`);
  10351. }
  10352. get toUnicodeRef() {
  10353. if (!FakeUnicodeFont._toUnicodeRef) {
  10354. const toUnicode = `/CIDInit /ProcSet findresource begin
  10355. 12 dict begin
  10356. begincmap
  10357. /CIDSystemInfo
  10358. << /Registry (Adobe)
  10359. /Ordering (UCS) /Supplement 0 >> def
  10360. /CMapName /Adobe-Identity-UCS def
  10361. /CMapType 2 def
  10362. 1 begincodespacerange
  10363. <0000> <FFFF>
  10364. endcodespacerange
  10365. 1 beginbfrange
  10366. <0000> <FFFF> <0000>
  10367. endbfrange
  10368. endcmap CMapName currentdict /CMap defineresource pop end end`;
  10369. const toUnicodeStream = FakeUnicodeFont.toUnicodeStream = new _stream.StringStream(toUnicode);
  10370. const toUnicodeDict = new _primitives.Dict(this.xref);
  10371. toUnicodeStream.dict = toUnicodeDict;
  10372. toUnicodeDict.set("Length", toUnicode.length);
  10373. FakeUnicodeFont._toUnicodeRef = this.xref.getNewPersistentRef(toUnicodeStream);
  10374. }
  10375. return FakeUnicodeFont._toUnicodeRef;
  10376. }
  10377. get fontDescriptorRef() {
  10378. if (!FakeUnicodeFont._fontDescriptorRef) {
  10379. const fontDescriptor = new _primitives.Dict(this.xref);
  10380. fontDescriptor.set("Type", _primitives.Name.get("FontDescriptor"));
  10381. fontDescriptor.set("FontName", this.fontName);
  10382. fontDescriptor.set("FontFamily", "MyriadPro Regular");
  10383. fontDescriptor.set("FontBBox", [0, 0, 0, 0]);
  10384. fontDescriptor.set("FontStretch", _primitives.Name.get("Normal"));
  10385. fontDescriptor.set("FontWeight", 400);
  10386. fontDescriptor.set("ItalicAngle", 0);
  10387. FakeUnicodeFont._fontDescriptorRef = this.xref.getNewPersistentRef(fontDescriptor);
  10388. }
  10389. return FakeUnicodeFont._fontDescriptorRef;
  10390. }
  10391. get descendantFontRef() {
  10392. const descendantFont = new _primitives.Dict(this.xref);
  10393. descendantFont.set("BaseFont", this.fontName);
  10394. descendantFont.set("Type", _primitives.Name.get("Font"));
  10395. descendantFont.set("Subtype", _primitives.Name.get("CIDFontType0"));
  10396. descendantFont.set("CIDToGIDMap", _primitives.Name.get("Identity"));
  10397. descendantFont.set("FirstChar", this.firstChar);
  10398. descendantFont.set("LastChar", this.lastChar);
  10399. descendantFont.set("FontDescriptor", this.fontDescriptorRef);
  10400. descendantFont.set("DW", 1000);
  10401. const widths = [];
  10402. const chars = [...this.widths.entries()].sort();
  10403. let currentChar = null;
  10404. let currentWidths = null;
  10405. for (const [char, width] of chars) {
  10406. if (!currentChar) {
  10407. currentChar = char;
  10408. currentWidths = [width];
  10409. continue;
  10410. }
  10411. if (char === currentChar + currentWidths.length) {
  10412. currentWidths.push(width);
  10413. } else {
  10414. widths.push(currentChar, currentWidths);
  10415. currentChar = char;
  10416. currentWidths = [width];
  10417. }
  10418. }
  10419. if (currentChar) {
  10420. widths.push(currentChar, currentWidths);
  10421. }
  10422. descendantFont.set("W", widths);
  10423. const cidSystemInfo = new _primitives.Dict(this.xref);
  10424. cidSystemInfo.set("Ordering", "Identity");
  10425. cidSystemInfo.set("Registry", "Adobe");
  10426. cidSystemInfo.set("Supplement", 0);
  10427. descendantFont.set("CIDSystemInfo", cidSystemInfo);
  10428. return this.xref.getNewPersistentRef(descendantFont);
  10429. }
  10430. get baseFontRef() {
  10431. const baseFont = new _primitives.Dict(this.xref);
  10432. baseFont.set("BaseFont", this.fontName);
  10433. baseFont.set("Type", _primitives.Name.get("Font"));
  10434. baseFont.set("Subtype", _primitives.Name.get("Type0"));
  10435. baseFont.set("Encoding", _primitives.Name.get("Identity-H"));
  10436. baseFont.set("DescendantFonts", [this.descendantFontRef]);
  10437. baseFont.set("ToUnicode", this.toUnicodeRef);
  10438. return this.xref.getNewPersistentRef(baseFont);
  10439. }
  10440. get resources() {
  10441. const resources = new _primitives.Dict(this.xref);
  10442. const font = new _primitives.Dict(this.xref);
  10443. font.set(this.fontName.name, this.baseFontRef);
  10444. resources.set("Font", font);
  10445. return resources;
  10446. }
  10447. _createContext() {
  10448. this.widths = new Map();
  10449. this.ctxMeasure.font = `1000px ${this.fontFamily}`;
  10450. return this.ctxMeasure;
  10451. }
  10452. createFontResources(text) {
  10453. const ctx = this._createContext();
  10454. for (const line of text.split(/\r\n?|\n/)) {
  10455. for (const char of line.split("")) {
  10456. const code = char.charCodeAt(0);
  10457. if (this.widths.has(code)) {
  10458. continue;
  10459. }
  10460. const metrics = ctx.measureText(char);
  10461. const width = Math.ceil(metrics.width);
  10462. this.widths.set(code, width);
  10463. this.firstChar = Math.min(code, this.firstChar);
  10464. this.lastChar = Math.max(code, this.lastChar);
  10465. }
  10466. }
  10467. return this.resources;
  10468. }
  10469. createAppearance(text, rect, rotation, fontSize, bgColor) {
  10470. const ctx = this._createContext();
  10471. const lines = [];
  10472. let maxWidth = -Infinity;
  10473. for (const line of text.split(/\r\n?|\n/)) {
  10474. lines.push(line);
  10475. const lineWidth = ctx.measureText(line).width;
  10476. maxWidth = Math.max(maxWidth, lineWidth);
  10477. for (const char of line.split("")) {
  10478. const code = char.charCodeAt(0);
  10479. let width = this.widths.get(code);
  10480. if (width === undefined) {
  10481. const metrics = ctx.measureText(char);
  10482. width = Math.ceil(metrics.width);
  10483. this.widths.set(code, width);
  10484. this.firstChar = Math.min(code, this.firstChar);
  10485. this.lastChar = Math.max(code, this.lastChar);
  10486. }
  10487. }
  10488. }
  10489. maxWidth *= fontSize / 1000;
  10490. const [x1, y1, x2, y2] = rect;
  10491. let w = x2 - x1;
  10492. let h = y2 - y1;
  10493. if (rotation % 180 !== 0) {
  10494. [w, h] = [h, w];
  10495. }
  10496. let hscale = 1;
  10497. if (maxWidth > w) {
  10498. hscale = w / maxWidth;
  10499. }
  10500. let vscale = 1;
  10501. const lineHeight = _util.LINE_FACTOR * fontSize;
  10502. const lineDescent = _util.LINE_DESCENT_FACTOR * fontSize;
  10503. const maxHeight = lineHeight * lines.length;
  10504. if (maxHeight > h) {
  10505. vscale = h / maxHeight;
  10506. }
  10507. const fscale = Math.min(hscale, vscale);
  10508. const newFontSize = fontSize * fscale;
  10509. 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`];
  10510. const vShift = (0, _core_utils.numberToString)(lineHeight);
  10511. for (const line of lines) {
  10512. buffer.push(`0 -${vShift} Td <${(0, _core_utils.stringToUTF16HexString)(line)}> Tj`);
  10513. }
  10514. buffer.push("ET", "Q");
  10515. const appearance = buffer.join("\n");
  10516. const appearanceStreamDict = new _primitives.Dict(this.xref);
  10517. appearanceStreamDict.set("Subtype", _primitives.Name.get("Form"));
  10518. appearanceStreamDict.set("Type", _primitives.Name.get("XObject"));
  10519. appearanceStreamDict.set("BBox", [0, 0, w, h]);
  10520. appearanceStreamDict.set("Length", appearance.length);
  10521. appearanceStreamDict.set("Resources", this.resources);
  10522. if (rotation) {
  10523. const matrix = (0, _core_utils.getRotationMatrix)(rotation, w, h);
  10524. appearanceStreamDict.set("Matrix", matrix);
  10525. }
  10526. const ap = new _stream.StringStream(appearance);
  10527. ap.dict = appearanceStreamDict;
  10528. return ap;
  10529. }
  10530. }
  10531. exports.FakeUnicodeFont = FakeUnicodeFont;
  10532. /***/ }),
  10533. /* 143 */
  10534. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  10535. "use strict";
  10536. Object.defineProperty(exports, "__esModule", ({
  10537. value: true
  10538. }));
  10539. exports.ColorSpace = void 0;
  10540. var _util = __w_pdfjs_require__(2);
  10541. var _primitives = __w_pdfjs_require__(134);
  10542. var _base_stream = __w_pdfjs_require__(136);
  10543. var _core_utils = __w_pdfjs_require__(135);
  10544. function resizeRgbImage(src, dest, w1, h1, w2, h2, alpha01) {
  10545. const COMPONENTS = 3;
  10546. alpha01 = alpha01 !== 1 ? 0 : alpha01;
  10547. const xRatio = w1 / w2;
  10548. const yRatio = h1 / h2;
  10549. let newIndex = 0,
  10550. oldIndex;
  10551. const xScaled = new Uint16Array(w2);
  10552. const w1Scanline = w1 * COMPONENTS;
  10553. for (let i = 0; i < w2; i++) {
  10554. xScaled[i] = Math.floor(i * xRatio) * COMPONENTS;
  10555. }
  10556. for (let i = 0; i < h2; i++) {
  10557. const py = Math.floor(i * yRatio) * w1Scanline;
  10558. for (let j = 0; j < w2; j++) {
  10559. oldIndex = py + xScaled[j];
  10560. dest[newIndex++] = src[oldIndex++];
  10561. dest[newIndex++] = src[oldIndex++];
  10562. dest[newIndex++] = src[oldIndex++];
  10563. newIndex += alpha01;
  10564. }
  10565. }
  10566. }
  10567. class ColorSpace {
  10568. constructor(name, numComps) {
  10569. if (this.constructor === ColorSpace) {
  10570. (0, _util.unreachable)("Cannot initialize ColorSpace.");
  10571. }
  10572. this.name = name;
  10573. this.numComps = numComps;
  10574. }
  10575. getRgb(src, srcOffset) {
  10576. const rgb = new Uint8ClampedArray(3);
  10577. this.getRgbItem(src, srcOffset, rgb, 0);
  10578. return rgb;
  10579. }
  10580. getRgbItem(src, srcOffset, dest, destOffset) {
  10581. (0, _util.unreachable)("Should not call ColorSpace.getRgbItem");
  10582. }
  10583. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  10584. (0, _util.unreachable)("Should not call ColorSpace.getRgbBuffer");
  10585. }
  10586. getOutputLength(inputLength, alpha01) {
  10587. (0, _util.unreachable)("Should not call ColorSpace.getOutputLength");
  10588. }
  10589. isPassthrough(bits) {
  10590. return false;
  10591. }
  10592. isDefaultDecode(decodeMap, bpc) {
  10593. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  10594. }
  10595. fillRgb(dest, originalWidth, originalHeight, width, height, actualHeight, bpc, comps, alpha01) {
  10596. const count = originalWidth * originalHeight;
  10597. let rgbBuf = null;
  10598. const numComponentColors = 1 << bpc;
  10599. const needsResizing = originalHeight !== height || originalWidth !== width;
  10600. if (this.isPassthrough(bpc)) {
  10601. rgbBuf = comps;
  10602. } else if (this.numComps === 1 && count > numComponentColors && this.name !== "DeviceGray" && this.name !== "DeviceRGB") {
  10603. const allColors = bpc <= 8 ? new Uint8Array(numComponentColors) : new Uint16Array(numComponentColors);
  10604. for (let i = 0; i < numComponentColors; i++) {
  10605. allColors[i] = i;
  10606. }
  10607. const colorMap = new Uint8ClampedArray(numComponentColors * 3);
  10608. this.getRgbBuffer(allColors, 0, numComponentColors, colorMap, 0, bpc, 0);
  10609. if (!needsResizing) {
  10610. let destPos = 0;
  10611. for (let i = 0; i < count; ++i) {
  10612. const key = comps[i] * 3;
  10613. dest[destPos++] = colorMap[key];
  10614. dest[destPos++] = colorMap[key + 1];
  10615. dest[destPos++] = colorMap[key + 2];
  10616. destPos += alpha01;
  10617. }
  10618. } else {
  10619. rgbBuf = new Uint8Array(count * 3);
  10620. let rgbPos = 0;
  10621. for (let i = 0; i < count; ++i) {
  10622. const key = comps[i] * 3;
  10623. rgbBuf[rgbPos++] = colorMap[key];
  10624. rgbBuf[rgbPos++] = colorMap[key + 1];
  10625. rgbBuf[rgbPos++] = colorMap[key + 2];
  10626. }
  10627. }
  10628. } else {
  10629. if (!needsResizing) {
  10630. this.getRgbBuffer(comps, 0, width * actualHeight, dest, 0, bpc, alpha01);
  10631. } else {
  10632. rgbBuf = new Uint8ClampedArray(count * 3);
  10633. this.getRgbBuffer(comps, 0, count, rgbBuf, 0, bpc, 0);
  10634. }
  10635. }
  10636. if (rgbBuf) {
  10637. if (needsResizing) {
  10638. resizeRgbImage(rgbBuf, dest, originalWidth, originalHeight, width, height, alpha01);
  10639. } else {
  10640. let destPos = 0,
  10641. rgbPos = 0;
  10642. for (let i = 0, ii = width * actualHeight; i < ii; i++) {
  10643. dest[destPos++] = rgbBuf[rgbPos++];
  10644. dest[destPos++] = rgbBuf[rgbPos++];
  10645. dest[destPos++] = rgbBuf[rgbPos++];
  10646. destPos += alpha01;
  10647. }
  10648. }
  10649. }
  10650. }
  10651. get usesZeroToOneRange() {
  10652. return (0, _util.shadow)(this, "usesZeroToOneRange", true);
  10653. }
  10654. static _cache(cacheKey, xref, localColorSpaceCache, parsedColorSpace) {
  10655. if (!localColorSpaceCache) {
  10656. throw new Error('ColorSpace._cache - expected "localColorSpaceCache" argument.');
  10657. }
  10658. if (!parsedColorSpace) {
  10659. throw new Error('ColorSpace._cache - expected "parsedColorSpace" argument.');
  10660. }
  10661. let csName, csRef;
  10662. if (cacheKey instanceof _primitives.Ref) {
  10663. csRef = cacheKey;
  10664. cacheKey = xref.fetch(cacheKey);
  10665. }
  10666. if (cacheKey instanceof _primitives.Name) {
  10667. csName = cacheKey.name;
  10668. }
  10669. if (csName || csRef) {
  10670. localColorSpaceCache.set(csName, csRef, parsedColorSpace);
  10671. }
  10672. }
  10673. static getCached(cacheKey, xref, localColorSpaceCache) {
  10674. if (!localColorSpaceCache) {
  10675. throw new Error('ColorSpace.getCached - expected "localColorSpaceCache" argument.');
  10676. }
  10677. if (cacheKey instanceof _primitives.Ref) {
  10678. const localColorSpace = localColorSpaceCache.getByRef(cacheKey);
  10679. if (localColorSpace) {
  10680. return localColorSpace;
  10681. }
  10682. try {
  10683. cacheKey = xref.fetch(cacheKey);
  10684. } catch (ex) {
  10685. if (ex instanceof _core_utils.MissingDataException) {
  10686. throw ex;
  10687. }
  10688. }
  10689. }
  10690. if (cacheKey instanceof _primitives.Name) {
  10691. const localColorSpace = localColorSpaceCache.getByName(cacheKey.name);
  10692. if (localColorSpace) {
  10693. return localColorSpace;
  10694. }
  10695. }
  10696. return null;
  10697. }
  10698. static async parseAsync(_ref) {
  10699. let {
  10700. cs,
  10701. xref,
  10702. resources = null,
  10703. pdfFunctionFactory,
  10704. localColorSpaceCache
  10705. } = _ref;
  10706. const parsedColorSpace = this._parse(cs, xref, resources, pdfFunctionFactory);
  10707. this._cache(cs, xref, localColorSpaceCache, parsedColorSpace);
  10708. return parsedColorSpace;
  10709. }
  10710. static parse(_ref2) {
  10711. let {
  10712. cs,
  10713. xref,
  10714. resources = null,
  10715. pdfFunctionFactory,
  10716. localColorSpaceCache
  10717. } = _ref2;
  10718. const cachedColorSpace = this.getCached(cs, xref, localColorSpaceCache);
  10719. if (cachedColorSpace) {
  10720. return cachedColorSpace;
  10721. }
  10722. const parsedColorSpace = this._parse(cs, xref, resources, pdfFunctionFactory);
  10723. this._cache(cs, xref, localColorSpaceCache, parsedColorSpace);
  10724. return parsedColorSpace;
  10725. }
  10726. static _parse(cs, xref) {
  10727. let resources = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  10728. let pdfFunctionFactory = arguments.length > 3 ? arguments[3] : undefined;
  10729. cs = xref.fetchIfRef(cs);
  10730. if (cs instanceof _primitives.Name) {
  10731. switch (cs.name) {
  10732. case "G":
  10733. case "DeviceGray":
  10734. return this.singletons.gray;
  10735. case "RGB":
  10736. case "DeviceRGB":
  10737. return this.singletons.rgb;
  10738. case "CMYK":
  10739. case "DeviceCMYK":
  10740. return this.singletons.cmyk;
  10741. case "Pattern":
  10742. return new PatternCS(null);
  10743. default:
  10744. if (resources instanceof _primitives.Dict) {
  10745. const colorSpaces = resources.get("ColorSpace");
  10746. if (colorSpaces instanceof _primitives.Dict) {
  10747. const resourcesCS = colorSpaces.get(cs.name);
  10748. if (resourcesCS) {
  10749. if (resourcesCS instanceof _primitives.Name) {
  10750. return this._parse(resourcesCS, xref, resources, pdfFunctionFactory);
  10751. }
  10752. cs = resourcesCS;
  10753. break;
  10754. }
  10755. }
  10756. }
  10757. throw new _util.FormatError(`Unrecognized ColorSpace: ${cs.name}`);
  10758. }
  10759. }
  10760. if (Array.isArray(cs)) {
  10761. const mode = xref.fetchIfRef(cs[0]).name;
  10762. let params, numComps, baseCS, whitePoint, blackPoint, gamma;
  10763. switch (mode) {
  10764. case "G":
  10765. case "DeviceGray":
  10766. return this.singletons.gray;
  10767. case "RGB":
  10768. case "DeviceRGB":
  10769. return this.singletons.rgb;
  10770. case "CMYK":
  10771. case "DeviceCMYK":
  10772. return this.singletons.cmyk;
  10773. case "CalGray":
  10774. params = xref.fetchIfRef(cs[1]);
  10775. whitePoint = params.getArray("WhitePoint");
  10776. blackPoint = params.getArray("BlackPoint");
  10777. gamma = params.get("Gamma");
  10778. return new CalGrayCS(whitePoint, blackPoint, gamma);
  10779. case "CalRGB":
  10780. params = xref.fetchIfRef(cs[1]);
  10781. whitePoint = params.getArray("WhitePoint");
  10782. blackPoint = params.getArray("BlackPoint");
  10783. gamma = params.getArray("Gamma");
  10784. const matrix = params.getArray("Matrix");
  10785. return new CalRGBCS(whitePoint, blackPoint, gamma, matrix);
  10786. case "ICCBased":
  10787. const stream = xref.fetchIfRef(cs[1]);
  10788. const dict = stream.dict;
  10789. numComps = dict.get("N");
  10790. const alt = dict.get("Alternate");
  10791. if (alt) {
  10792. const altCS = this._parse(alt, xref, resources, pdfFunctionFactory);
  10793. if (altCS.numComps === numComps) {
  10794. return altCS;
  10795. }
  10796. (0, _util.warn)("ICCBased color space: Ignoring incorrect /Alternate entry.");
  10797. }
  10798. if (numComps === 1) {
  10799. return this.singletons.gray;
  10800. } else if (numComps === 3) {
  10801. return this.singletons.rgb;
  10802. } else if (numComps === 4) {
  10803. return this.singletons.cmyk;
  10804. }
  10805. break;
  10806. case "Pattern":
  10807. baseCS = cs[1] || null;
  10808. if (baseCS) {
  10809. baseCS = this._parse(baseCS, xref, resources, pdfFunctionFactory);
  10810. }
  10811. return new PatternCS(baseCS);
  10812. case "I":
  10813. case "Indexed":
  10814. baseCS = this._parse(cs[1], xref, resources, pdfFunctionFactory);
  10815. const hiVal = xref.fetchIfRef(cs[2]) + 1;
  10816. const lookup = xref.fetchIfRef(cs[3]);
  10817. return new IndexedCS(baseCS, hiVal, lookup);
  10818. case "Separation":
  10819. case "DeviceN":
  10820. const name = xref.fetchIfRef(cs[1]);
  10821. numComps = Array.isArray(name) ? name.length : 1;
  10822. baseCS = this._parse(cs[2], xref, resources, pdfFunctionFactory);
  10823. const tintFn = pdfFunctionFactory.create(cs[3]);
  10824. return new AlternateCS(numComps, baseCS, tintFn);
  10825. case "Lab":
  10826. params = xref.fetchIfRef(cs[1]);
  10827. whitePoint = params.getArray("WhitePoint");
  10828. blackPoint = params.getArray("BlackPoint");
  10829. const range = params.getArray("Range");
  10830. return new LabCS(whitePoint, blackPoint, range);
  10831. default:
  10832. throw new _util.FormatError(`Unimplemented ColorSpace object: ${mode}`);
  10833. }
  10834. }
  10835. throw new _util.FormatError(`Unrecognized ColorSpace object: ${cs}`);
  10836. }
  10837. static isDefaultDecode(decode, numComps) {
  10838. if (!Array.isArray(decode)) {
  10839. return true;
  10840. }
  10841. if (numComps * 2 !== decode.length) {
  10842. (0, _util.warn)("The decode map is not the correct length");
  10843. return true;
  10844. }
  10845. for (let i = 0, ii = decode.length; i < ii; i += 2) {
  10846. if (decode[i] !== 0 || decode[i + 1] !== 1) {
  10847. return false;
  10848. }
  10849. }
  10850. return true;
  10851. }
  10852. static get singletons() {
  10853. return (0, _util.shadow)(this, "singletons", {
  10854. get gray() {
  10855. return (0, _util.shadow)(this, "gray", new DeviceGrayCS());
  10856. },
  10857. get rgb() {
  10858. return (0, _util.shadow)(this, "rgb", new DeviceRgbCS());
  10859. },
  10860. get cmyk() {
  10861. return (0, _util.shadow)(this, "cmyk", new DeviceCmykCS());
  10862. }
  10863. });
  10864. }
  10865. }
  10866. exports.ColorSpace = ColorSpace;
  10867. class AlternateCS extends ColorSpace {
  10868. constructor(numComps, base, tintFn) {
  10869. super("Alternate", numComps);
  10870. this.base = base;
  10871. this.tintFn = tintFn;
  10872. this.tmpBuf = new Float32Array(base.numComps);
  10873. }
  10874. getRgbItem(src, srcOffset, dest, destOffset) {
  10875. const tmpBuf = this.tmpBuf;
  10876. this.tintFn(src, srcOffset, tmpBuf, 0);
  10877. this.base.getRgbItem(tmpBuf, 0, dest, destOffset);
  10878. }
  10879. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  10880. const tintFn = this.tintFn;
  10881. const base = this.base;
  10882. const scale = 1 / ((1 << bits) - 1);
  10883. const baseNumComps = base.numComps;
  10884. const usesZeroToOneRange = base.usesZeroToOneRange;
  10885. const isPassthrough = (base.isPassthrough(8) || !usesZeroToOneRange) && alpha01 === 0;
  10886. let pos = isPassthrough ? destOffset : 0;
  10887. const baseBuf = isPassthrough ? dest : new Uint8ClampedArray(baseNumComps * count);
  10888. const numComps = this.numComps;
  10889. const scaled = new Float32Array(numComps);
  10890. const tinted = new Float32Array(baseNumComps);
  10891. let i, j;
  10892. for (i = 0; i < count; i++) {
  10893. for (j = 0; j < numComps; j++) {
  10894. scaled[j] = src[srcOffset++] * scale;
  10895. }
  10896. tintFn(scaled, 0, tinted, 0);
  10897. if (usesZeroToOneRange) {
  10898. for (j = 0; j < baseNumComps; j++) {
  10899. baseBuf[pos++] = tinted[j] * 255;
  10900. }
  10901. } else {
  10902. base.getRgbItem(tinted, 0, baseBuf, pos);
  10903. pos += baseNumComps;
  10904. }
  10905. }
  10906. if (!isPassthrough) {
  10907. base.getRgbBuffer(baseBuf, 0, count, dest, destOffset, 8, alpha01);
  10908. }
  10909. }
  10910. getOutputLength(inputLength, alpha01) {
  10911. return this.base.getOutputLength(inputLength * this.base.numComps / this.numComps, alpha01);
  10912. }
  10913. }
  10914. class PatternCS extends ColorSpace {
  10915. constructor(baseCS) {
  10916. super("Pattern", null);
  10917. this.base = baseCS;
  10918. }
  10919. isDefaultDecode(decodeMap, bpc) {
  10920. (0, _util.unreachable)("Should not call PatternCS.isDefaultDecode");
  10921. }
  10922. }
  10923. class IndexedCS extends ColorSpace {
  10924. constructor(base, highVal, lookup) {
  10925. super("Indexed", 1);
  10926. this.base = base;
  10927. this.highVal = highVal;
  10928. const length = base.numComps * highVal;
  10929. this.lookup = new Uint8Array(length);
  10930. if (lookup instanceof _base_stream.BaseStream) {
  10931. const bytes = lookup.getBytes(length);
  10932. this.lookup.set(bytes);
  10933. } else if (typeof lookup === "string") {
  10934. for (let i = 0; i < length; ++i) {
  10935. this.lookup[i] = lookup.charCodeAt(i) & 0xff;
  10936. }
  10937. } else {
  10938. throw new _util.FormatError(`IndexedCS - unrecognized lookup table: ${lookup}`);
  10939. }
  10940. }
  10941. getRgbItem(src, srcOffset, dest, destOffset) {
  10942. const numComps = this.base.numComps;
  10943. const start = src[srcOffset] * numComps;
  10944. this.base.getRgbBuffer(this.lookup, start, 1, dest, destOffset, 8, 0);
  10945. }
  10946. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  10947. const base = this.base;
  10948. const numComps = base.numComps;
  10949. const outputDelta = base.getOutputLength(numComps, alpha01);
  10950. const lookup = this.lookup;
  10951. for (let i = 0; i < count; ++i) {
  10952. const lookupPos = src[srcOffset++] * numComps;
  10953. base.getRgbBuffer(lookup, lookupPos, 1, dest, destOffset, 8, alpha01);
  10954. destOffset += outputDelta;
  10955. }
  10956. }
  10957. getOutputLength(inputLength, alpha01) {
  10958. return this.base.getOutputLength(inputLength * this.base.numComps, alpha01);
  10959. }
  10960. isDefaultDecode(decodeMap, bpc) {
  10961. if (!Array.isArray(decodeMap)) {
  10962. return true;
  10963. }
  10964. if (decodeMap.length !== 2) {
  10965. (0, _util.warn)("Decode map length is not correct");
  10966. return true;
  10967. }
  10968. if (!Number.isInteger(bpc) || bpc < 1) {
  10969. (0, _util.warn)("Bits per component is not correct");
  10970. return true;
  10971. }
  10972. return decodeMap[0] === 0 && decodeMap[1] === (1 << bpc) - 1;
  10973. }
  10974. }
  10975. class DeviceGrayCS extends ColorSpace {
  10976. constructor() {
  10977. super("DeviceGray", 1);
  10978. }
  10979. getRgbItem(src, srcOffset, dest, destOffset) {
  10980. const c = src[srcOffset] * 255;
  10981. dest[destOffset] = dest[destOffset + 1] = dest[destOffset + 2] = c;
  10982. }
  10983. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  10984. const scale = 255 / ((1 << bits) - 1);
  10985. let j = srcOffset,
  10986. q = destOffset;
  10987. for (let i = 0; i < count; ++i) {
  10988. const c = scale * src[j++];
  10989. dest[q++] = c;
  10990. dest[q++] = c;
  10991. dest[q++] = c;
  10992. q += alpha01;
  10993. }
  10994. }
  10995. getOutputLength(inputLength, alpha01) {
  10996. return inputLength * (3 + alpha01);
  10997. }
  10998. }
  10999. class DeviceRgbCS extends ColorSpace {
  11000. constructor() {
  11001. super("DeviceRGB", 3);
  11002. }
  11003. getRgbItem(src, srcOffset, dest, destOffset) {
  11004. dest[destOffset] = src[srcOffset] * 255;
  11005. dest[destOffset + 1] = src[srcOffset + 1] * 255;
  11006. dest[destOffset + 2] = src[srcOffset + 2] * 255;
  11007. }
  11008. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  11009. if (bits === 8 && alpha01 === 0) {
  11010. dest.set(src.subarray(srcOffset, srcOffset + count * 3), destOffset);
  11011. return;
  11012. }
  11013. const scale = 255 / ((1 << bits) - 1);
  11014. let j = srcOffset,
  11015. q = destOffset;
  11016. for (let i = 0; i < count; ++i) {
  11017. dest[q++] = scale * src[j++];
  11018. dest[q++] = scale * src[j++];
  11019. dest[q++] = scale * src[j++];
  11020. q += alpha01;
  11021. }
  11022. }
  11023. getOutputLength(inputLength, alpha01) {
  11024. return inputLength * (3 + alpha01) / 3 | 0;
  11025. }
  11026. isPassthrough(bits) {
  11027. return bits === 8;
  11028. }
  11029. }
  11030. const DeviceCmykCS = function DeviceCmykCSClosure() {
  11031. function convertToRgb(src, srcOffset, srcScale, dest, destOffset) {
  11032. const c = src[srcOffset] * srcScale;
  11033. const m = src[srcOffset + 1] * srcScale;
  11034. const y = src[srcOffset + 2] * srcScale;
  11035. const k = src[srcOffset + 3] * srcScale;
  11036. 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);
  11037. 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);
  11038. 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);
  11039. }
  11040. class DeviceCmykCS extends ColorSpace {
  11041. constructor() {
  11042. super("DeviceCMYK", 4);
  11043. }
  11044. getRgbItem(src, srcOffset, dest, destOffset) {
  11045. convertToRgb(src, srcOffset, 1, dest, destOffset);
  11046. }
  11047. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  11048. const scale = 1 / ((1 << bits) - 1);
  11049. for (let i = 0; i < count; i++) {
  11050. convertToRgb(src, srcOffset, scale, dest, destOffset);
  11051. srcOffset += 4;
  11052. destOffset += 3 + alpha01;
  11053. }
  11054. }
  11055. getOutputLength(inputLength, alpha01) {
  11056. return inputLength / 4 * (3 + alpha01) | 0;
  11057. }
  11058. }
  11059. return DeviceCmykCS;
  11060. }();
  11061. const CalGrayCS = function CalGrayCSClosure() {
  11062. function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
  11063. const A = src[srcOffset] * scale;
  11064. const AG = A ** cs.G;
  11065. const L = cs.YW * AG;
  11066. const val = Math.max(295.8 * L ** 0.3333333333333333 - 40.8, 0);
  11067. dest[destOffset] = val;
  11068. dest[destOffset + 1] = val;
  11069. dest[destOffset + 2] = val;
  11070. }
  11071. class CalGrayCS extends ColorSpace {
  11072. constructor(whitePoint, blackPoint, gamma) {
  11073. super("CalGray", 1);
  11074. if (!whitePoint) {
  11075. throw new _util.FormatError("WhitePoint missing - required for color space CalGray");
  11076. }
  11077. blackPoint = blackPoint || [0, 0, 0];
  11078. gamma = gamma || 1;
  11079. this.XW = whitePoint[0];
  11080. this.YW = whitePoint[1];
  11081. this.ZW = whitePoint[2];
  11082. this.XB = blackPoint[0];
  11083. this.YB = blackPoint[1];
  11084. this.ZB = blackPoint[2];
  11085. this.G = gamma;
  11086. if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
  11087. throw new _util.FormatError(`Invalid WhitePoint components for ${this.name}` + ", no fallback available");
  11088. }
  11089. if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
  11090. (0, _util.info)(`Invalid BlackPoint for ${this.name}, falling back to default.`);
  11091. this.XB = this.YB = this.ZB = 0;
  11092. }
  11093. if (this.XB !== 0 || this.YB !== 0 || this.ZB !== 0) {
  11094. (0, _util.warn)(`${this.name}, BlackPoint: XB: ${this.XB}, YB: ${this.YB}, ` + `ZB: ${this.ZB}, only default values are supported.`);
  11095. }
  11096. if (this.G < 1) {
  11097. (0, _util.info)(`Invalid Gamma: ${this.G} for ${this.name}, ` + "falling back to default.");
  11098. this.G = 1;
  11099. }
  11100. }
  11101. getRgbItem(src, srcOffset, dest, destOffset) {
  11102. convertToRgb(this, src, srcOffset, dest, destOffset, 1);
  11103. }
  11104. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  11105. const scale = 1 / ((1 << bits) - 1);
  11106. for (let i = 0; i < count; ++i) {
  11107. convertToRgb(this, src, srcOffset, dest, destOffset, scale);
  11108. srcOffset += 1;
  11109. destOffset += 3 + alpha01;
  11110. }
  11111. }
  11112. getOutputLength(inputLength, alpha01) {
  11113. return inputLength * (3 + alpha01);
  11114. }
  11115. }
  11116. return CalGrayCS;
  11117. }();
  11118. const CalRGBCS = function CalRGBCSClosure() {
  11119. const BRADFORD_SCALE_MATRIX = new Float32Array([0.8951, 0.2664, -0.1614, -0.7502, 1.7135, 0.0367, 0.0389, -0.0685, 1.0296]);
  11120. 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]);
  11121. 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]);
  11122. const FLAT_WHITEPOINT_MATRIX = new Float32Array([1, 1, 1]);
  11123. const tempNormalizeMatrix = new Float32Array(3);
  11124. const tempConvertMatrix1 = new Float32Array(3);
  11125. const tempConvertMatrix2 = new Float32Array(3);
  11126. const DECODE_L_CONSTANT = ((8 + 16) / 116) ** 3 / 8.0;
  11127. function matrixProduct(a, b, result) {
  11128. result[0] = a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
  11129. result[1] = a[3] * b[0] + a[4] * b[1] + a[5] * b[2];
  11130. result[2] = a[6] * b[0] + a[7] * b[1] + a[8] * b[2];
  11131. }
  11132. function convertToFlat(sourceWhitePoint, LMS, result) {
  11133. result[0] = LMS[0] * 1 / sourceWhitePoint[0];
  11134. result[1] = LMS[1] * 1 / sourceWhitePoint[1];
  11135. result[2] = LMS[2] * 1 / sourceWhitePoint[2];
  11136. }
  11137. function convertToD65(sourceWhitePoint, LMS, result) {
  11138. const D65X = 0.95047;
  11139. const D65Y = 1;
  11140. const D65Z = 1.08883;
  11141. result[0] = LMS[0] * D65X / sourceWhitePoint[0];
  11142. result[1] = LMS[1] * D65Y / sourceWhitePoint[1];
  11143. result[2] = LMS[2] * D65Z / sourceWhitePoint[2];
  11144. }
  11145. function sRGBTransferFunction(color) {
  11146. if (color <= 0.0031308) {
  11147. return adjustToRange(0, 1, 12.92 * color);
  11148. }
  11149. if (color >= 0.99554525) {
  11150. return 1;
  11151. }
  11152. return adjustToRange(0, 1, (1 + 0.055) * color ** (1 / 2.4) - 0.055);
  11153. }
  11154. function adjustToRange(min, max, value) {
  11155. return Math.max(min, Math.min(max, value));
  11156. }
  11157. function decodeL(L) {
  11158. if (L < 0) {
  11159. return -decodeL(-L);
  11160. }
  11161. if (L > 8.0) {
  11162. return ((L + 16) / 116) ** 3;
  11163. }
  11164. return L * DECODE_L_CONSTANT;
  11165. }
  11166. function compensateBlackPoint(sourceBlackPoint, XYZ_Flat, result) {
  11167. if (sourceBlackPoint[0] === 0 && sourceBlackPoint[1] === 0 && sourceBlackPoint[2] === 0) {
  11168. result[0] = XYZ_Flat[0];
  11169. result[1] = XYZ_Flat[1];
  11170. result[2] = XYZ_Flat[2];
  11171. return;
  11172. }
  11173. const zeroDecodeL = decodeL(0);
  11174. const X_DST = zeroDecodeL;
  11175. const X_SRC = decodeL(sourceBlackPoint[0]);
  11176. const Y_DST = zeroDecodeL;
  11177. const Y_SRC = decodeL(sourceBlackPoint[1]);
  11178. const Z_DST = zeroDecodeL;
  11179. const Z_SRC = decodeL(sourceBlackPoint[2]);
  11180. const X_Scale = (1 - X_DST) / (1 - X_SRC);
  11181. const X_Offset = 1 - X_Scale;
  11182. const Y_Scale = (1 - Y_DST) / (1 - Y_SRC);
  11183. const Y_Offset = 1 - Y_Scale;
  11184. const Z_Scale = (1 - Z_DST) / (1 - Z_SRC);
  11185. const Z_Offset = 1 - Z_Scale;
  11186. result[0] = XYZ_Flat[0] * X_Scale + X_Offset;
  11187. result[1] = XYZ_Flat[1] * Y_Scale + Y_Offset;
  11188. result[2] = XYZ_Flat[2] * Z_Scale + Z_Offset;
  11189. }
  11190. function normalizeWhitePointToFlat(sourceWhitePoint, XYZ_In, result) {
  11191. if (sourceWhitePoint[0] === 1 && sourceWhitePoint[2] === 1) {
  11192. result[0] = XYZ_In[0];
  11193. result[1] = XYZ_In[1];
  11194. result[2] = XYZ_In[2];
  11195. return;
  11196. }
  11197. const LMS = result;
  11198. matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
  11199. const LMS_Flat = tempNormalizeMatrix;
  11200. convertToFlat(sourceWhitePoint, LMS, LMS_Flat);
  11201. matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_Flat, result);
  11202. }
  11203. function normalizeWhitePointToD65(sourceWhitePoint, XYZ_In, result) {
  11204. const LMS = result;
  11205. matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
  11206. const LMS_D65 = tempNormalizeMatrix;
  11207. convertToD65(sourceWhitePoint, LMS, LMS_D65);
  11208. matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_D65, result);
  11209. }
  11210. function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
  11211. const A = adjustToRange(0, 1, src[srcOffset] * scale);
  11212. const B = adjustToRange(0, 1, src[srcOffset + 1] * scale);
  11213. const C = adjustToRange(0, 1, src[srcOffset + 2] * scale);
  11214. const AGR = A === 1 ? 1 : A ** cs.GR;
  11215. const BGG = B === 1 ? 1 : B ** cs.GG;
  11216. const CGB = C === 1 ? 1 : C ** cs.GB;
  11217. const X = cs.MXA * AGR + cs.MXB * BGG + cs.MXC * CGB;
  11218. const Y = cs.MYA * AGR + cs.MYB * BGG + cs.MYC * CGB;
  11219. const Z = cs.MZA * AGR + cs.MZB * BGG + cs.MZC * CGB;
  11220. const XYZ = tempConvertMatrix1;
  11221. XYZ[0] = X;
  11222. XYZ[1] = Y;
  11223. XYZ[2] = Z;
  11224. const XYZ_Flat = tempConvertMatrix2;
  11225. normalizeWhitePointToFlat(cs.whitePoint, XYZ, XYZ_Flat);
  11226. const XYZ_Black = tempConvertMatrix1;
  11227. compensateBlackPoint(cs.blackPoint, XYZ_Flat, XYZ_Black);
  11228. const XYZ_D65 = tempConvertMatrix2;
  11229. normalizeWhitePointToD65(FLAT_WHITEPOINT_MATRIX, XYZ_Black, XYZ_D65);
  11230. const SRGB = tempConvertMatrix1;
  11231. matrixProduct(SRGB_D65_XYZ_TO_RGB_MATRIX, XYZ_D65, SRGB);
  11232. dest[destOffset] = sRGBTransferFunction(SRGB[0]) * 255;
  11233. dest[destOffset + 1] = sRGBTransferFunction(SRGB[1]) * 255;
  11234. dest[destOffset + 2] = sRGBTransferFunction(SRGB[2]) * 255;
  11235. }
  11236. class CalRGBCS extends ColorSpace {
  11237. constructor(whitePoint, blackPoint, gamma, matrix) {
  11238. super("CalRGB", 3);
  11239. if (!whitePoint) {
  11240. throw new _util.FormatError("WhitePoint missing - required for color space CalRGB");
  11241. }
  11242. blackPoint = blackPoint || new Float32Array(3);
  11243. gamma = gamma || new Float32Array([1, 1, 1]);
  11244. matrix = matrix || new Float32Array([1, 0, 0, 0, 1, 0, 0, 0, 1]);
  11245. const XW = whitePoint[0];
  11246. const YW = whitePoint[1];
  11247. const ZW = whitePoint[2];
  11248. this.whitePoint = whitePoint;
  11249. const XB = blackPoint[0];
  11250. const YB = blackPoint[1];
  11251. const ZB = blackPoint[2];
  11252. this.blackPoint = blackPoint;
  11253. this.GR = gamma[0];
  11254. this.GG = gamma[1];
  11255. this.GB = gamma[2];
  11256. this.MXA = matrix[0];
  11257. this.MYA = matrix[1];
  11258. this.MZA = matrix[2];
  11259. this.MXB = matrix[3];
  11260. this.MYB = matrix[4];
  11261. this.MZB = matrix[5];
  11262. this.MXC = matrix[6];
  11263. this.MYC = matrix[7];
  11264. this.MZC = matrix[8];
  11265. if (XW < 0 || ZW < 0 || YW !== 1) {
  11266. throw new _util.FormatError(`Invalid WhitePoint components for ${this.name}` + ", no fallback available");
  11267. }
  11268. if (XB < 0 || YB < 0 || ZB < 0) {
  11269. (0, _util.info)(`Invalid BlackPoint for ${this.name} [${XB}, ${YB}, ${ZB}], ` + "falling back to default.");
  11270. this.blackPoint = new Float32Array(3);
  11271. }
  11272. if (this.GR < 0 || this.GG < 0 || this.GB < 0) {
  11273. (0, _util.info)(`Invalid Gamma [${this.GR}, ${this.GG}, ${this.GB}] for ` + `${this.name}, falling back to default.`);
  11274. this.GR = this.GG = this.GB = 1;
  11275. }
  11276. }
  11277. getRgbItem(src, srcOffset, dest, destOffset) {
  11278. convertToRgb(this, src, srcOffset, dest, destOffset, 1);
  11279. }
  11280. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  11281. const scale = 1 / ((1 << bits) - 1);
  11282. for (let i = 0; i < count; ++i) {
  11283. convertToRgb(this, src, srcOffset, dest, destOffset, scale);
  11284. srcOffset += 3;
  11285. destOffset += 3 + alpha01;
  11286. }
  11287. }
  11288. getOutputLength(inputLength, alpha01) {
  11289. return inputLength * (3 + alpha01) / 3 | 0;
  11290. }
  11291. }
  11292. return CalRGBCS;
  11293. }();
  11294. const LabCS = function LabCSClosure() {
  11295. function fn_g(x) {
  11296. let result;
  11297. if (x >= 6 / 29) {
  11298. result = x ** 3;
  11299. } else {
  11300. result = 108 / 841 * (x - 4 / 29);
  11301. }
  11302. return result;
  11303. }
  11304. function decode(value, high1, low2, high2) {
  11305. return low2 + value * (high2 - low2) / high1;
  11306. }
  11307. function convertToRgb(cs, src, srcOffset, maxVal, dest, destOffset) {
  11308. let Ls = src[srcOffset];
  11309. let as = src[srcOffset + 1];
  11310. let bs = src[srcOffset + 2];
  11311. if (maxVal !== false) {
  11312. Ls = decode(Ls, maxVal, 0, 100);
  11313. as = decode(as, maxVal, cs.amin, cs.amax);
  11314. bs = decode(bs, maxVal, cs.bmin, cs.bmax);
  11315. }
  11316. if (as > cs.amax) {
  11317. as = cs.amax;
  11318. } else if (as < cs.amin) {
  11319. as = cs.amin;
  11320. }
  11321. if (bs > cs.bmax) {
  11322. bs = cs.bmax;
  11323. } else if (bs < cs.bmin) {
  11324. bs = cs.bmin;
  11325. }
  11326. const M = (Ls + 16) / 116;
  11327. const L = M + as / 500;
  11328. const N = M - bs / 200;
  11329. const X = cs.XW * fn_g(L);
  11330. const Y = cs.YW * fn_g(M);
  11331. const Z = cs.ZW * fn_g(N);
  11332. let r, g, b;
  11333. if (cs.ZW < 1) {
  11334. r = X * 3.1339 + Y * -1.617 + Z * -0.4906;
  11335. g = X * -0.9785 + Y * 1.916 + Z * 0.0333;
  11336. b = X * 0.072 + Y * -0.229 + Z * 1.4057;
  11337. } else {
  11338. r = X * 3.2406 + Y * -1.5372 + Z * -0.4986;
  11339. g = X * -0.9689 + Y * 1.8758 + Z * 0.0415;
  11340. b = X * 0.0557 + Y * -0.204 + Z * 1.057;
  11341. }
  11342. dest[destOffset] = Math.sqrt(r) * 255;
  11343. dest[destOffset + 1] = Math.sqrt(g) * 255;
  11344. dest[destOffset + 2] = Math.sqrt(b) * 255;
  11345. }
  11346. class LabCS extends ColorSpace {
  11347. constructor(whitePoint, blackPoint, range) {
  11348. super("Lab", 3);
  11349. if (!whitePoint) {
  11350. throw new _util.FormatError("WhitePoint missing - required for color space Lab");
  11351. }
  11352. blackPoint = blackPoint || [0, 0, 0];
  11353. range = range || [-100, 100, -100, 100];
  11354. this.XW = whitePoint[0];
  11355. this.YW = whitePoint[1];
  11356. this.ZW = whitePoint[2];
  11357. this.amin = range[0];
  11358. this.amax = range[1];
  11359. this.bmin = range[2];
  11360. this.bmax = range[3];
  11361. this.XB = blackPoint[0];
  11362. this.YB = blackPoint[1];
  11363. this.ZB = blackPoint[2];
  11364. if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
  11365. throw new _util.FormatError("Invalid WhitePoint components, no fallback available");
  11366. }
  11367. if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
  11368. (0, _util.info)("Invalid BlackPoint, falling back to default");
  11369. this.XB = this.YB = this.ZB = 0;
  11370. }
  11371. if (this.amin > this.amax || this.bmin > this.bmax) {
  11372. (0, _util.info)("Invalid Range, falling back to defaults");
  11373. this.amin = -100;
  11374. this.amax = 100;
  11375. this.bmin = -100;
  11376. this.bmax = 100;
  11377. }
  11378. }
  11379. getRgbItem(src, srcOffset, dest, destOffset) {
  11380. convertToRgb(this, src, srcOffset, false, dest, destOffset);
  11381. }
  11382. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  11383. const maxVal = (1 << bits) - 1;
  11384. for (let i = 0; i < count; i++) {
  11385. convertToRgb(this, src, srcOffset, maxVal, dest, destOffset);
  11386. srcOffset += 3;
  11387. destOffset += 3 + alpha01;
  11388. }
  11389. }
  11390. getOutputLength(inputLength, alpha01) {
  11391. return inputLength * (3 + alpha01) / 3 | 0;
  11392. }
  11393. isDefaultDecode(decodeMap, bpc) {
  11394. return true;
  11395. }
  11396. get usesZeroToOneRange() {
  11397. return (0, _util.shadow)(this, "usesZeroToOneRange", false);
  11398. }
  11399. }
  11400. return LabCS;
  11401. }();
  11402. /***/ }),
  11403. /* 144 */
  11404. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  11405. "use strict";
  11406. Object.defineProperty(exports, "__esModule", ({
  11407. value: true
  11408. }));
  11409. exports.PartialEvaluator = exports.EvaluatorPreprocessor = void 0;
  11410. var _util = __w_pdfjs_require__(2);
  11411. var _cmap = __w_pdfjs_require__(145);
  11412. var _primitives = __w_pdfjs_require__(134);
  11413. var _fonts = __w_pdfjs_require__(163);
  11414. var _fonts_utils = __w_pdfjs_require__(167);
  11415. var _encodings = __w_pdfjs_require__(166);
  11416. var _standard_fonts = __w_pdfjs_require__(170);
  11417. var _pattern = __w_pdfjs_require__(179);
  11418. var _xfa_fonts = __w_pdfjs_require__(180);
  11419. var _to_unicode_map = __w_pdfjs_require__(171);
  11420. var _function = __w_pdfjs_require__(186);
  11421. var _parser = __w_pdfjs_require__(146);
  11422. var _image_utils = __w_pdfjs_require__(188);
  11423. var _stream = __w_pdfjs_require__(139);
  11424. var _base_stream = __w_pdfjs_require__(136);
  11425. var _bidi = __w_pdfjs_require__(189);
  11426. var _colorspace = __w_pdfjs_require__(143);
  11427. var _decode_stream = __w_pdfjs_require__(148);
  11428. var _glyphlist = __w_pdfjs_require__(168);
  11429. var _core_utils = __w_pdfjs_require__(135);
  11430. var _metrics = __w_pdfjs_require__(174);
  11431. var _unicode = __w_pdfjs_require__(169);
  11432. var _murmurhash = __w_pdfjs_require__(190);
  11433. var _operator_list = __w_pdfjs_require__(191);
  11434. var _image = __w_pdfjs_require__(192);
  11435. const DefaultPartialEvaluatorOptions = Object.freeze({
  11436. maxImageSize: -1,
  11437. disableFontFace: false,
  11438. ignoreErrors: false,
  11439. isEvalSupported: true,
  11440. isOffscreenCanvasSupported: true,
  11441. fontExtraProperties: false,
  11442. useSystemFonts: true,
  11443. cMapUrl: null,
  11444. standardFontDataUrl: null
  11445. });
  11446. const PatternType = {
  11447. TILING: 1,
  11448. SHADING: 2
  11449. };
  11450. const TEXT_CHUNK_BATCH_SIZE = 10;
  11451. const deferred = Promise.resolve();
  11452. function normalizeBlendMode(value) {
  11453. let parsingArray = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  11454. if (Array.isArray(value)) {
  11455. for (const val of value) {
  11456. const maybeBM = normalizeBlendMode(val, true);
  11457. if (maybeBM) {
  11458. return maybeBM;
  11459. }
  11460. }
  11461. (0, _util.warn)(`Unsupported blend mode Array: ${value}`);
  11462. return "source-over";
  11463. }
  11464. if (!(value instanceof _primitives.Name)) {
  11465. if (parsingArray) {
  11466. return null;
  11467. }
  11468. return "source-over";
  11469. }
  11470. switch (value.name) {
  11471. case "Normal":
  11472. case "Compatible":
  11473. return "source-over";
  11474. case "Multiply":
  11475. return "multiply";
  11476. case "Screen":
  11477. return "screen";
  11478. case "Overlay":
  11479. return "overlay";
  11480. case "Darken":
  11481. return "darken";
  11482. case "Lighten":
  11483. return "lighten";
  11484. case "ColorDodge":
  11485. return "color-dodge";
  11486. case "ColorBurn":
  11487. return "color-burn";
  11488. case "HardLight":
  11489. return "hard-light";
  11490. case "SoftLight":
  11491. return "soft-light";
  11492. case "Difference":
  11493. return "difference";
  11494. case "Exclusion":
  11495. return "exclusion";
  11496. case "Hue":
  11497. return "hue";
  11498. case "Saturation":
  11499. return "saturation";
  11500. case "Color":
  11501. return "color";
  11502. case "Luminosity":
  11503. return "luminosity";
  11504. }
  11505. if (parsingArray) {
  11506. return null;
  11507. }
  11508. (0, _util.warn)(`Unsupported blend mode: ${value.name}`);
  11509. return "source-over";
  11510. }
  11511. function incrementCachedImageMaskCount(data) {
  11512. if (data.fn === _util.OPS.paintImageMaskXObject && data.args[0] && data.args[0].count > 0) {
  11513. data.args[0].count++;
  11514. }
  11515. }
  11516. class TimeSlotManager {
  11517. static get TIME_SLOT_DURATION_MS() {
  11518. return (0, _util.shadow)(this, "TIME_SLOT_DURATION_MS", 20);
  11519. }
  11520. static get CHECK_TIME_EVERY() {
  11521. return (0, _util.shadow)(this, "CHECK_TIME_EVERY", 100);
  11522. }
  11523. constructor() {
  11524. this.reset();
  11525. }
  11526. check() {
  11527. if (++this.checked < TimeSlotManager.CHECK_TIME_EVERY) {
  11528. return false;
  11529. }
  11530. this.checked = 0;
  11531. return this.endTime <= Date.now();
  11532. }
  11533. reset() {
  11534. this.endTime = Date.now() + TimeSlotManager.TIME_SLOT_DURATION_MS;
  11535. this.checked = 0;
  11536. }
  11537. }
  11538. class PartialEvaluator {
  11539. constructor(_ref) {
  11540. let {
  11541. xref,
  11542. handler,
  11543. pageIndex,
  11544. idFactory,
  11545. fontCache,
  11546. builtInCMapCache,
  11547. standardFontDataCache,
  11548. globalImageCache,
  11549. options = null
  11550. } = _ref;
  11551. this.xref = xref;
  11552. this.handler = handler;
  11553. this.pageIndex = pageIndex;
  11554. this.idFactory = idFactory;
  11555. this.fontCache = fontCache;
  11556. this.builtInCMapCache = builtInCMapCache;
  11557. this.standardFontDataCache = standardFontDataCache;
  11558. this.globalImageCache = globalImageCache;
  11559. this.options = options || DefaultPartialEvaluatorOptions;
  11560. this.parsingType3Font = false;
  11561. this._fetchBuiltInCMapBound = this.fetchBuiltInCMap.bind(this);
  11562. }
  11563. get _pdfFunctionFactory() {
  11564. const pdfFunctionFactory = new _function.PDFFunctionFactory({
  11565. xref: this.xref,
  11566. isEvalSupported: this.options.isEvalSupported
  11567. });
  11568. return (0, _util.shadow)(this, "_pdfFunctionFactory", pdfFunctionFactory);
  11569. }
  11570. clone() {
  11571. let newOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  11572. const newEvaluator = Object.create(this);
  11573. newEvaluator.options = Object.assign(Object.create(null), this.options, newOptions);
  11574. return newEvaluator;
  11575. }
  11576. hasBlendModes(resources, nonBlendModesSet) {
  11577. if (!(resources instanceof _primitives.Dict)) {
  11578. return false;
  11579. }
  11580. if (resources.objId && nonBlendModesSet.has(resources.objId)) {
  11581. return false;
  11582. }
  11583. const processed = new _primitives.RefSet(nonBlendModesSet);
  11584. if (resources.objId) {
  11585. processed.put(resources.objId);
  11586. }
  11587. const nodes = [resources],
  11588. xref = this.xref;
  11589. while (nodes.length) {
  11590. const node = nodes.shift();
  11591. const graphicStates = node.get("ExtGState");
  11592. if (graphicStates instanceof _primitives.Dict) {
  11593. for (let graphicState of graphicStates.getRawValues()) {
  11594. if (graphicState instanceof _primitives.Ref) {
  11595. if (processed.has(graphicState)) {
  11596. continue;
  11597. }
  11598. try {
  11599. graphicState = xref.fetch(graphicState);
  11600. } catch (ex) {
  11601. processed.put(graphicState);
  11602. (0, _util.info)(`hasBlendModes - ignoring ExtGState: "${ex}".`);
  11603. continue;
  11604. }
  11605. }
  11606. if (!(graphicState instanceof _primitives.Dict)) {
  11607. continue;
  11608. }
  11609. if (graphicState.objId) {
  11610. processed.put(graphicState.objId);
  11611. }
  11612. const bm = graphicState.get("BM");
  11613. if (bm instanceof _primitives.Name) {
  11614. if (bm.name !== "Normal") {
  11615. return true;
  11616. }
  11617. continue;
  11618. }
  11619. if (bm !== undefined && Array.isArray(bm)) {
  11620. for (const element of bm) {
  11621. if (element instanceof _primitives.Name && element.name !== "Normal") {
  11622. return true;
  11623. }
  11624. }
  11625. }
  11626. }
  11627. }
  11628. const xObjects = node.get("XObject");
  11629. if (!(xObjects instanceof _primitives.Dict)) {
  11630. continue;
  11631. }
  11632. for (let xObject of xObjects.getRawValues()) {
  11633. if (xObject instanceof _primitives.Ref) {
  11634. if (processed.has(xObject)) {
  11635. continue;
  11636. }
  11637. try {
  11638. xObject = xref.fetch(xObject);
  11639. } catch (ex) {
  11640. processed.put(xObject);
  11641. (0, _util.info)(`hasBlendModes - ignoring XObject: "${ex}".`);
  11642. continue;
  11643. }
  11644. }
  11645. if (!(xObject instanceof _base_stream.BaseStream)) {
  11646. continue;
  11647. }
  11648. if (xObject.dict.objId) {
  11649. processed.put(xObject.dict.objId);
  11650. }
  11651. const xResources = xObject.dict.get("Resources");
  11652. if (!(xResources instanceof _primitives.Dict)) {
  11653. continue;
  11654. }
  11655. if (xResources.objId && processed.has(xResources.objId)) {
  11656. continue;
  11657. }
  11658. nodes.push(xResources);
  11659. if (xResources.objId) {
  11660. processed.put(xResources.objId);
  11661. }
  11662. }
  11663. }
  11664. for (const ref of processed) {
  11665. nonBlendModesSet.put(ref);
  11666. }
  11667. return false;
  11668. }
  11669. async fetchBuiltInCMap(name) {
  11670. const cachedData = this.builtInCMapCache.get(name);
  11671. if (cachedData) {
  11672. return cachedData;
  11673. }
  11674. let data;
  11675. if (this.options.cMapUrl !== null) {
  11676. const url = `${this.options.cMapUrl}${name}.bcmap`;
  11677. const response = await fetch(url);
  11678. if (!response.ok) {
  11679. throw new Error(`fetchBuiltInCMap: failed to fetch file "${url}" with "${response.statusText}".`);
  11680. }
  11681. data = {
  11682. cMapData: new Uint8Array(await response.arrayBuffer()),
  11683. compressionType: _util.CMapCompressionType.BINARY
  11684. };
  11685. } else {
  11686. data = await this.handler.sendWithPromise("FetchBuiltInCMap", {
  11687. name
  11688. });
  11689. }
  11690. if (data.compressionType !== _util.CMapCompressionType.NONE) {
  11691. this.builtInCMapCache.set(name, data);
  11692. }
  11693. return data;
  11694. }
  11695. async fetchStandardFontData(name) {
  11696. const cachedData = this.standardFontDataCache.get(name);
  11697. if (cachedData) {
  11698. return new _stream.Stream(cachedData);
  11699. }
  11700. if (this.options.useSystemFonts && name !== "Symbol" && name !== "ZapfDingbats") {
  11701. return null;
  11702. }
  11703. const standardFontNameToFileName = (0, _standard_fonts.getFontNameToFileMap)(),
  11704. filename = standardFontNameToFileName[name];
  11705. let data;
  11706. if (this.options.standardFontDataUrl !== null) {
  11707. const url = `${this.options.standardFontDataUrl}${filename}`;
  11708. const response = await fetch(url);
  11709. if (!response.ok) {
  11710. (0, _util.warn)(`fetchStandardFontData: failed to fetch file "${url}" with "${response.statusText}".`);
  11711. } else {
  11712. data = await response.arrayBuffer();
  11713. }
  11714. } else {
  11715. try {
  11716. data = await this.handler.sendWithPromise("FetchStandardFontData", {
  11717. filename
  11718. });
  11719. } catch (e) {
  11720. (0, _util.warn)(`fetchStandardFontData: failed to fetch file "${filename}" with "${e}".`);
  11721. }
  11722. }
  11723. if (!data) {
  11724. return null;
  11725. }
  11726. this.standardFontDataCache.set(name, data);
  11727. return new _stream.Stream(data);
  11728. }
  11729. async buildFormXObject(resources, xobj, smask, operatorList, task, initialState, localColorSpaceCache) {
  11730. const dict = xobj.dict;
  11731. const matrix = dict.getArray("Matrix");
  11732. let bbox = dict.getArray("BBox");
  11733. if (Array.isArray(bbox) && bbox.length === 4) {
  11734. bbox = _util.Util.normalizeRect(bbox);
  11735. } else {
  11736. bbox = null;
  11737. }
  11738. let optionalContent, groupOptions;
  11739. if (dict.has("OC")) {
  11740. optionalContent = await this.parseMarkedContentProps(dict.get("OC"), resources);
  11741. }
  11742. if (optionalContent !== undefined) {
  11743. operatorList.addOp(_util.OPS.beginMarkedContentProps, ["OC", optionalContent]);
  11744. }
  11745. const group = dict.get("Group");
  11746. if (group) {
  11747. groupOptions = {
  11748. matrix,
  11749. bbox,
  11750. smask,
  11751. isolated: false,
  11752. knockout: false
  11753. };
  11754. const groupSubtype = group.get("S");
  11755. let colorSpace = null;
  11756. if ((0, _primitives.isName)(groupSubtype, "Transparency")) {
  11757. groupOptions.isolated = group.get("I") || false;
  11758. groupOptions.knockout = group.get("K") || false;
  11759. if (group.has("CS")) {
  11760. const cs = group.getRaw("CS");
  11761. const cachedColorSpace = _colorspace.ColorSpace.getCached(cs, this.xref, localColorSpaceCache);
  11762. if (cachedColorSpace) {
  11763. colorSpace = cachedColorSpace;
  11764. } else {
  11765. colorSpace = await this.parseColorSpace({
  11766. cs,
  11767. resources,
  11768. localColorSpaceCache
  11769. });
  11770. }
  11771. }
  11772. }
  11773. if (smask && smask.backdrop) {
  11774. colorSpace = colorSpace || _colorspace.ColorSpace.singletons.rgb;
  11775. smask.backdrop = colorSpace.getRgb(smask.backdrop, 0);
  11776. }
  11777. operatorList.addOp(_util.OPS.beginGroup, [groupOptions]);
  11778. }
  11779. const args = group ? [matrix, null] : [matrix, bbox];
  11780. operatorList.addOp(_util.OPS.paintFormXObjectBegin, args);
  11781. return this.getOperatorList({
  11782. stream: xobj,
  11783. task,
  11784. resources: dict.get("Resources") || resources,
  11785. operatorList,
  11786. initialState
  11787. }).then(function () {
  11788. operatorList.addOp(_util.OPS.paintFormXObjectEnd, []);
  11789. if (group) {
  11790. operatorList.addOp(_util.OPS.endGroup, [groupOptions]);
  11791. }
  11792. if (optionalContent !== undefined) {
  11793. operatorList.addOp(_util.OPS.endMarkedContent, []);
  11794. }
  11795. });
  11796. }
  11797. _sendImgData(objId, imgData) {
  11798. let cacheGlobally = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  11799. const transfers = imgData ? [imgData.bitmap || imgData.data.buffer] : null;
  11800. if (this.parsingType3Font || cacheGlobally) {
  11801. return this.handler.send("commonobj", [objId, "Image", imgData], transfers);
  11802. }
  11803. return this.handler.send("obj", [objId, this.pageIndex, "Image", imgData], transfers);
  11804. }
  11805. async buildPaintImageXObject(_ref2) {
  11806. let {
  11807. resources,
  11808. image,
  11809. isInline = false,
  11810. operatorList,
  11811. cacheKey,
  11812. localImageCache,
  11813. localColorSpaceCache
  11814. } = _ref2;
  11815. const dict = image.dict;
  11816. const imageRef = dict.objId;
  11817. const w = dict.get("W", "Width");
  11818. const h = dict.get("H", "Height");
  11819. if (!(w && typeof w === "number") || !(h && typeof h === "number")) {
  11820. (0, _util.warn)("Image dimensions are missing, or not numbers.");
  11821. return;
  11822. }
  11823. const maxImageSize = this.options.maxImageSize;
  11824. if (maxImageSize !== -1 && w * h > maxImageSize) {
  11825. const msg = "Image exceeded maximum allowed size and was removed.";
  11826. if (this.options.ignoreErrors) {
  11827. (0, _util.warn)(msg);
  11828. return;
  11829. }
  11830. throw new Error(msg);
  11831. }
  11832. let optionalContent;
  11833. if (dict.has("OC")) {
  11834. optionalContent = await this.parseMarkedContentProps(dict.get("OC"), resources);
  11835. }
  11836. const imageMask = dict.get("IM", "ImageMask") || false;
  11837. let imgData, args;
  11838. if (imageMask) {
  11839. const interpolate = dict.get("I", "Interpolate");
  11840. const bitStrideLength = w + 7 >> 3;
  11841. const imgArray = image.getBytes(bitStrideLength * h);
  11842. const decode = dict.getArray("D", "Decode");
  11843. if (this.parsingType3Font) {
  11844. imgData = _image.PDFImage.createRawMask({
  11845. imgArray,
  11846. width: w,
  11847. height: h,
  11848. imageIsFromDecodeStream: image instanceof _decode_stream.DecodeStream,
  11849. inverseDecode: !!decode && decode[0] > 0,
  11850. interpolate
  11851. });
  11852. imgData.cached = !!cacheKey;
  11853. args = [imgData];
  11854. operatorList.addImageOps(_util.OPS.paintImageMaskXObject, args, optionalContent);
  11855. if (cacheKey) {
  11856. localImageCache.set(cacheKey, imageRef, {
  11857. fn: _util.OPS.paintImageMaskXObject,
  11858. args,
  11859. optionalContent
  11860. });
  11861. }
  11862. return;
  11863. }
  11864. imgData = _image.PDFImage.createMask({
  11865. imgArray,
  11866. width: w,
  11867. height: h,
  11868. imageIsFromDecodeStream: image instanceof _decode_stream.DecodeStream,
  11869. inverseDecode: !!decode && decode[0] > 0,
  11870. interpolate,
  11871. isOffscreenCanvasSupported: this.options.isOffscreenCanvasSupported
  11872. });
  11873. if (imgData.isSingleOpaquePixel) {
  11874. operatorList.addImageOps(_util.OPS.paintSolidColorImageMask, [], optionalContent);
  11875. if (cacheKey) {
  11876. localImageCache.set(cacheKey, imageRef, {
  11877. fn: _util.OPS.paintSolidColorImageMask,
  11878. args: [],
  11879. optionalContent
  11880. });
  11881. }
  11882. return;
  11883. }
  11884. const objId = `mask_${this.idFactory.createObjId()}`;
  11885. operatorList.addDependency(objId);
  11886. this._sendImgData(objId, imgData);
  11887. args = [{
  11888. data: objId,
  11889. width: imgData.width,
  11890. height: imgData.height,
  11891. interpolate: imgData.interpolate,
  11892. count: 1
  11893. }];
  11894. operatorList.addImageOps(_util.OPS.paintImageMaskXObject, args, optionalContent);
  11895. if (cacheKey) {
  11896. localImageCache.set(cacheKey, imageRef, {
  11897. fn: _util.OPS.paintImageMaskXObject,
  11898. args,
  11899. optionalContent
  11900. });
  11901. }
  11902. return;
  11903. }
  11904. const softMask = dict.get("SM", "SMask") || false;
  11905. const mask = dict.get("Mask") || false;
  11906. const SMALL_IMAGE_DIMENSIONS = 200;
  11907. if (isInline && !softMask && !mask && w + h < SMALL_IMAGE_DIMENSIONS) {
  11908. const imageObj = new _image.PDFImage({
  11909. xref: this.xref,
  11910. res: resources,
  11911. image,
  11912. isInline,
  11913. pdfFunctionFactory: this._pdfFunctionFactory,
  11914. localColorSpaceCache
  11915. });
  11916. imgData = imageObj.createImageData(true);
  11917. operatorList.addImageOps(_util.OPS.paintInlineImageXObject, [imgData], optionalContent);
  11918. return;
  11919. }
  11920. let objId = `img_${this.idFactory.createObjId()}`,
  11921. cacheGlobally = false;
  11922. if (this.parsingType3Font) {
  11923. objId = `${this.idFactory.getDocId()}_type3_${objId}`;
  11924. } else if (imageRef) {
  11925. cacheGlobally = this.globalImageCache.shouldCache(imageRef, this.pageIndex);
  11926. if (cacheGlobally) {
  11927. objId = `${this.idFactory.getDocId()}_${objId}`;
  11928. }
  11929. }
  11930. operatorList.addDependency(objId);
  11931. args = [objId, w, h];
  11932. _image.PDFImage.buildImage({
  11933. xref: this.xref,
  11934. res: resources,
  11935. image,
  11936. isInline,
  11937. pdfFunctionFactory: this._pdfFunctionFactory,
  11938. localColorSpaceCache
  11939. }).then(imageObj => {
  11940. imgData = imageObj.createImageData(false);
  11941. if (cacheKey && imageRef && cacheGlobally) {
  11942. this.globalImageCache.addByteSize(imageRef, imgData.data.length);
  11943. }
  11944. return this._sendImgData(objId, imgData, cacheGlobally);
  11945. }).catch(reason => {
  11946. (0, _util.warn)(`Unable to decode image "${objId}": "${reason}".`);
  11947. return this._sendImgData(objId, null, cacheGlobally);
  11948. });
  11949. operatorList.addImageOps(_util.OPS.paintImageXObject, args, optionalContent);
  11950. if (cacheKey) {
  11951. localImageCache.set(cacheKey, imageRef, {
  11952. fn: _util.OPS.paintImageXObject,
  11953. args,
  11954. optionalContent
  11955. });
  11956. if (imageRef) {
  11957. (0, _util.assert)(!isInline, "Cannot cache an inline image globally.");
  11958. this.globalImageCache.addPageIndex(imageRef, this.pageIndex);
  11959. if (cacheGlobally) {
  11960. this.globalImageCache.setData(imageRef, {
  11961. objId,
  11962. fn: _util.OPS.paintImageXObject,
  11963. args,
  11964. optionalContent,
  11965. byteSize: 0
  11966. });
  11967. }
  11968. }
  11969. }
  11970. }
  11971. handleSMask(smask, resources, operatorList, task, stateManager, localColorSpaceCache) {
  11972. const smaskContent = smask.get("G");
  11973. const smaskOptions = {
  11974. subtype: smask.get("S").name,
  11975. backdrop: smask.get("BC")
  11976. };
  11977. const transferObj = smask.get("TR");
  11978. if ((0, _function.isPDFFunction)(transferObj)) {
  11979. const transferFn = this._pdfFunctionFactory.create(transferObj);
  11980. const transferMap = new Uint8Array(256);
  11981. const tmp = new Float32Array(1);
  11982. for (let i = 0; i < 256; i++) {
  11983. tmp[0] = i / 255;
  11984. transferFn(tmp, 0, tmp, 0);
  11985. transferMap[i] = tmp[0] * 255 | 0;
  11986. }
  11987. smaskOptions.transferMap = transferMap;
  11988. }
  11989. return this.buildFormXObject(resources, smaskContent, smaskOptions, operatorList, task, stateManager.state.clone(), localColorSpaceCache);
  11990. }
  11991. handleTransferFunction(tr) {
  11992. let transferArray;
  11993. if (Array.isArray(tr)) {
  11994. transferArray = tr;
  11995. } else if ((0, _function.isPDFFunction)(tr)) {
  11996. transferArray = [tr];
  11997. } else {
  11998. return null;
  11999. }
  12000. const transferMaps = [];
  12001. let numFns = 0,
  12002. numEffectfulFns = 0;
  12003. for (const entry of transferArray) {
  12004. const transferObj = this.xref.fetchIfRef(entry);
  12005. numFns++;
  12006. if ((0, _primitives.isName)(transferObj, "Identity")) {
  12007. transferMaps.push(null);
  12008. continue;
  12009. } else if (!(0, _function.isPDFFunction)(transferObj)) {
  12010. return null;
  12011. }
  12012. const transferFn = this._pdfFunctionFactory.create(transferObj);
  12013. const transferMap = new Uint8Array(256),
  12014. tmp = new Float32Array(1);
  12015. for (let j = 0; j < 256; j++) {
  12016. tmp[0] = j / 255;
  12017. transferFn(tmp, 0, tmp, 0);
  12018. transferMap[j] = tmp[0] * 255 | 0;
  12019. }
  12020. transferMaps.push(transferMap);
  12021. numEffectfulFns++;
  12022. }
  12023. if (!(numFns === 1 || numFns === 4)) {
  12024. return null;
  12025. }
  12026. if (numEffectfulFns === 0) {
  12027. return null;
  12028. }
  12029. return transferMaps;
  12030. }
  12031. handleTilingType(fn, color, resources, pattern, patternDict, operatorList, task, localTilingPatternCache) {
  12032. const tilingOpList = new _operator_list.OperatorList();
  12033. const patternResources = _primitives.Dict.merge({
  12034. xref: this.xref,
  12035. dictArray: [patternDict.get("Resources"), resources]
  12036. });
  12037. return this.getOperatorList({
  12038. stream: pattern,
  12039. task,
  12040. resources: patternResources,
  12041. operatorList: tilingOpList
  12042. }).then(function () {
  12043. const operatorListIR = tilingOpList.getIR();
  12044. const tilingPatternIR = (0, _pattern.getTilingPatternIR)(operatorListIR, patternDict, color);
  12045. operatorList.addDependencies(tilingOpList.dependencies);
  12046. operatorList.addOp(fn, tilingPatternIR);
  12047. if (patternDict.objId) {
  12048. localTilingPatternCache.set(null, patternDict.objId, {
  12049. operatorListIR,
  12050. dict: patternDict
  12051. });
  12052. }
  12053. }).catch(reason => {
  12054. if (reason instanceof _util.AbortException) {
  12055. return;
  12056. }
  12057. if (this.options.ignoreErrors) {
  12058. this.handler.send("UnsupportedFeature", {
  12059. featureId: _util.UNSUPPORTED_FEATURES.errorTilingPattern
  12060. });
  12061. (0, _util.warn)(`handleTilingType - ignoring pattern: "${reason}".`);
  12062. return;
  12063. }
  12064. throw reason;
  12065. });
  12066. }
  12067. handleSetFont(resources, fontArgs, fontRef, operatorList, task, state) {
  12068. let fallbackFontDict = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null;
  12069. let cssFontInfo = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
  12070. const fontName = fontArgs && fontArgs[0] instanceof _primitives.Name ? fontArgs[0].name : null;
  12071. return this.loadFont(fontName, fontRef, resources, fallbackFontDict, cssFontInfo).then(translated => {
  12072. if (!translated.font.isType3Font) {
  12073. return translated;
  12074. }
  12075. return translated.loadType3Data(this, resources, task).then(function () {
  12076. operatorList.addDependencies(translated.type3Dependencies);
  12077. return translated;
  12078. }).catch(reason => {
  12079. this.handler.send("UnsupportedFeature", {
  12080. featureId: _util.UNSUPPORTED_FEATURES.errorFontLoadType3
  12081. });
  12082. return new TranslatedFont({
  12083. loadedName: "g_font_error",
  12084. font: new _fonts.ErrorFont(`Type3 font load error: ${reason}`),
  12085. dict: translated.font,
  12086. evaluatorOptions: this.options
  12087. });
  12088. });
  12089. }).then(translated => {
  12090. state.font = translated.font;
  12091. translated.send(this.handler);
  12092. return translated.loadedName;
  12093. });
  12094. }
  12095. handleText(chars, state) {
  12096. const font = state.font;
  12097. const glyphs = font.charsToGlyphs(chars);
  12098. if (font.data) {
  12099. const isAddToPathSet = !!(state.textRenderingMode & _util.TextRenderingMode.ADD_TO_PATH_FLAG);
  12100. if (isAddToPathSet || state.fillColorSpace.name === "Pattern" || font.disableFontFace || this.options.disableFontFace) {
  12101. PartialEvaluator.buildFontPaths(font, glyphs, this.handler, this.options);
  12102. }
  12103. }
  12104. return glyphs;
  12105. }
  12106. ensureStateFont(state) {
  12107. if (state.font) {
  12108. return;
  12109. }
  12110. const reason = new _util.FormatError("Missing setFont (Tf) operator before text rendering operator.");
  12111. if (this.options.ignoreErrors) {
  12112. this.handler.send("UnsupportedFeature", {
  12113. featureId: _util.UNSUPPORTED_FEATURES.errorFontState
  12114. });
  12115. (0, _util.warn)(`ensureStateFont: "${reason}".`);
  12116. return;
  12117. }
  12118. throw reason;
  12119. }
  12120. async setGState(_ref3) {
  12121. let {
  12122. resources,
  12123. gState,
  12124. operatorList,
  12125. cacheKey,
  12126. task,
  12127. stateManager,
  12128. localGStateCache,
  12129. localColorSpaceCache
  12130. } = _ref3;
  12131. const gStateRef = gState.objId;
  12132. let isSimpleGState = true;
  12133. const gStateObj = [];
  12134. let promise = Promise.resolve();
  12135. for (const key of gState.getKeys()) {
  12136. const value = gState.get(key);
  12137. switch (key) {
  12138. case "Type":
  12139. break;
  12140. case "LW":
  12141. case "LC":
  12142. case "LJ":
  12143. case "ML":
  12144. case "D":
  12145. case "RI":
  12146. case "FL":
  12147. case "CA":
  12148. case "ca":
  12149. gStateObj.push([key, value]);
  12150. break;
  12151. case "Font":
  12152. isSimpleGState = false;
  12153. promise = promise.then(() => {
  12154. return this.handleSetFont(resources, null, value[0], operatorList, task, stateManager.state).then(function (loadedName) {
  12155. operatorList.addDependency(loadedName);
  12156. gStateObj.push([key, [loadedName, value[1]]]);
  12157. });
  12158. });
  12159. break;
  12160. case "BM":
  12161. gStateObj.push([key, normalizeBlendMode(value)]);
  12162. break;
  12163. case "SMask":
  12164. if ((0, _primitives.isName)(value, "None")) {
  12165. gStateObj.push([key, false]);
  12166. break;
  12167. }
  12168. if (value instanceof _primitives.Dict) {
  12169. isSimpleGState = false;
  12170. promise = promise.then(() => {
  12171. return this.handleSMask(value, resources, operatorList, task, stateManager, localColorSpaceCache);
  12172. });
  12173. gStateObj.push([key, true]);
  12174. } else {
  12175. (0, _util.warn)("Unsupported SMask type");
  12176. }
  12177. break;
  12178. case "TR":
  12179. const transferMaps = this.handleTransferFunction(value);
  12180. gStateObj.push([key, transferMaps]);
  12181. break;
  12182. case "OP":
  12183. case "op":
  12184. case "OPM":
  12185. case "BG":
  12186. case "BG2":
  12187. case "UCR":
  12188. case "UCR2":
  12189. case "TR2":
  12190. case "HT":
  12191. case "SM":
  12192. case "SA":
  12193. case "AIS":
  12194. case "TK":
  12195. (0, _util.info)("graphic state operator " + key);
  12196. break;
  12197. default:
  12198. (0, _util.info)("Unknown graphic state operator " + key);
  12199. break;
  12200. }
  12201. }
  12202. return promise.then(function () {
  12203. if (gStateObj.length > 0) {
  12204. operatorList.addOp(_util.OPS.setGState, [gStateObj]);
  12205. }
  12206. if (isSimpleGState) {
  12207. localGStateCache.set(cacheKey, gStateRef, gStateObj);
  12208. }
  12209. });
  12210. }
  12211. loadFont(fontName, font, resources) {
  12212. let fallbackFontDict = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  12213. let cssFontInfo = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
  12214. const errorFont = async () => {
  12215. return new TranslatedFont({
  12216. loadedName: "g_font_error",
  12217. font: new _fonts.ErrorFont(`Font "${fontName}" is not available.`),
  12218. dict: font,
  12219. evaluatorOptions: this.options
  12220. });
  12221. };
  12222. const xref = this.xref;
  12223. let fontRef;
  12224. if (font) {
  12225. if (font instanceof _primitives.Ref) {
  12226. fontRef = font;
  12227. }
  12228. } else {
  12229. const fontRes = resources.get("Font");
  12230. if (fontRes) {
  12231. fontRef = fontRes.getRaw(fontName);
  12232. }
  12233. }
  12234. if (!fontRef) {
  12235. const partialMsg = `Font "${fontName || font && font.toString()}" is not available`;
  12236. if (!this.options.ignoreErrors && !this.parsingType3Font) {
  12237. (0, _util.warn)(`${partialMsg}.`);
  12238. return errorFont();
  12239. }
  12240. this.handler.send("UnsupportedFeature", {
  12241. featureId: _util.UNSUPPORTED_FEATURES.errorFontMissing
  12242. });
  12243. (0, _util.warn)(`${partialMsg} -- attempting to fallback to a default font.`);
  12244. if (fallbackFontDict) {
  12245. fontRef = fallbackFontDict;
  12246. } else {
  12247. fontRef = PartialEvaluator.fallbackFontDict;
  12248. }
  12249. }
  12250. if (this.parsingType3Font && this.type3FontRefs.has(fontRef)) {
  12251. return errorFont();
  12252. }
  12253. if (this.fontCache.has(fontRef)) {
  12254. return this.fontCache.get(fontRef);
  12255. }
  12256. font = xref.fetchIfRef(fontRef);
  12257. if (!(font instanceof _primitives.Dict)) {
  12258. return errorFont();
  12259. }
  12260. if (font.cacheKey && this.fontCache.has(font.cacheKey)) {
  12261. return this.fontCache.get(font.cacheKey);
  12262. }
  12263. const fontCapability = (0, _util.createPromiseCapability)();
  12264. let preEvaluatedFont;
  12265. try {
  12266. preEvaluatedFont = this.preEvaluateFont(font);
  12267. preEvaluatedFont.cssFontInfo = cssFontInfo;
  12268. } catch (reason) {
  12269. (0, _util.warn)(`loadFont - preEvaluateFont failed: "${reason}".`);
  12270. return errorFont();
  12271. }
  12272. const {
  12273. descriptor,
  12274. hash
  12275. } = preEvaluatedFont;
  12276. const fontRefIsRef = fontRef instanceof _primitives.Ref;
  12277. let fontID;
  12278. if (fontRefIsRef) {
  12279. fontID = `f${fontRef.toString()}`;
  12280. }
  12281. if (hash && descriptor instanceof _primitives.Dict) {
  12282. if (!descriptor.fontAliases) {
  12283. descriptor.fontAliases = Object.create(null);
  12284. }
  12285. const fontAliases = descriptor.fontAliases;
  12286. if (fontAliases[hash]) {
  12287. const aliasFontRef = fontAliases[hash].aliasRef;
  12288. if (fontRefIsRef && aliasFontRef && this.fontCache.has(aliasFontRef)) {
  12289. this.fontCache.putAlias(fontRef, aliasFontRef);
  12290. return this.fontCache.get(fontRef);
  12291. }
  12292. } else {
  12293. fontAliases[hash] = {
  12294. fontID: this.idFactory.createFontId()
  12295. };
  12296. }
  12297. if (fontRefIsRef) {
  12298. fontAliases[hash].aliasRef = fontRef;
  12299. }
  12300. fontID = fontAliases[hash].fontID;
  12301. }
  12302. if (fontRefIsRef) {
  12303. this.fontCache.put(fontRef, fontCapability.promise);
  12304. } else {
  12305. if (!fontID) {
  12306. fontID = this.idFactory.createFontId();
  12307. }
  12308. font.cacheKey = `cacheKey_${fontID}`;
  12309. this.fontCache.put(font.cacheKey, fontCapability.promise);
  12310. }
  12311. (0, _util.assert)(fontID && fontID.startsWith("f"), 'The "fontID" must be (correctly) defined.');
  12312. font.loadedName = `${this.idFactory.getDocId()}_${fontID}`;
  12313. this.translateFont(preEvaluatedFont).then(translatedFont => {
  12314. if (translatedFont.fontType !== undefined) {
  12315. xref.stats.addFontType(translatedFont.fontType);
  12316. }
  12317. fontCapability.resolve(new TranslatedFont({
  12318. loadedName: font.loadedName,
  12319. font: translatedFont,
  12320. dict: font,
  12321. evaluatorOptions: this.options
  12322. }));
  12323. }).catch(reason => {
  12324. this.handler.send("UnsupportedFeature", {
  12325. featureId: _util.UNSUPPORTED_FEATURES.errorFontTranslate
  12326. });
  12327. (0, _util.warn)(`loadFont - translateFont failed: "${reason}".`);
  12328. try {
  12329. const fontFile3 = descriptor && descriptor.get("FontFile3");
  12330. const subtype = fontFile3 && fontFile3.get("Subtype");
  12331. const fontType = (0, _fonts_utils.getFontType)(preEvaluatedFont.type, subtype && subtype.name);
  12332. if (fontType !== undefined) {
  12333. xref.stats.addFontType(fontType);
  12334. }
  12335. } catch (ex) {}
  12336. fontCapability.resolve(new TranslatedFont({
  12337. loadedName: font.loadedName,
  12338. font: new _fonts.ErrorFont(reason instanceof Error ? reason.message : reason),
  12339. dict: font,
  12340. evaluatorOptions: this.options
  12341. }));
  12342. });
  12343. return fontCapability.promise;
  12344. }
  12345. buildPath(operatorList, fn, args) {
  12346. let parsingText = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  12347. const lastIndex = operatorList.length - 1;
  12348. if (!args) {
  12349. args = [];
  12350. }
  12351. if (lastIndex < 0 || operatorList.fnArray[lastIndex] !== _util.OPS.constructPath) {
  12352. if (parsingText) {
  12353. (0, _util.warn)(`Encountered path operator "${fn}" inside of a text object.`);
  12354. operatorList.addOp(_util.OPS.save, null);
  12355. }
  12356. let minMax;
  12357. switch (fn) {
  12358. case _util.OPS.rectangle:
  12359. const x = args[0] + args[2];
  12360. const y = args[1] + args[3];
  12361. minMax = [Math.min(args[0], x), Math.max(args[0], x), Math.min(args[1], y), Math.max(args[1], y)];
  12362. break;
  12363. case _util.OPS.moveTo:
  12364. case _util.OPS.lineTo:
  12365. minMax = [args[0], args[0], args[1], args[1]];
  12366. break;
  12367. default:
  12368. minMax = [Infinity, -Infinity, Infinity, -Infinity];
  12369. break;
  12370. }
  12371. operatorList.addOp(_util.OPS.constructPath, [[fn], args, minMax]);
  12372. if (parsingText) {
  12373. operatorList.addOp(_util.OPS.restore, null);
  12374. }
  12375. } else {
  12376. const opArgs = operatorList.argsArray[lastIndex];
  12377. opArgs[0].push(fn);
  12378. opArgs[1].push(...args);
  12379. const minMax = opArgs[2];
  12380. switch (fn) {
  12381. case _util.OPS.rectangle:
  12382. const x = args[0] + args[2];
  12383. const y = args[1] + args[3];
  12384. minMax[0] = Math.min(minMax[0], args[0], x);
  12385. minMax[1] = Math.max(minMax[1], args[0], x);
  12386. minMax[2] = Math.min(minMax[2], args[1], y);
  12387. minMax[3] = Math.max(minMax[3], args[1], y);
  12388. break;
  12389. case _util.OPS.moveTo:
  12390. case _util.OPS.lineTo:
  12391. minMax[0] = Math.min(minMax[0], args[0]);
  12392. minMax[1] = Math.max(minMax[1], args[0]);
  12393. minMax[2] = Math.min(minMax[2], args[1]);
  12394. minMax[3] = Math.max(minMax[3], args[1]);
  12395. break;
  12396. }
  12397. }
  12398. }
  12399. parseColorSpace(_ref4) {
  12400. let {
  12401. cs,
  12402. resources,
  12403. localColorSpaceCache
  12404. } = _ref4;
  12405. return _colorspace.ColorSpace.parseAsync({
  12406. cs,
  12407. xref: this.xref,
  12408. resources,
  12409. pdfFunctionFactory: this._pdfFunctionFactory,
  12410. localColorSpaceCache
  12411. }).catch(reason => {
  12412. if (reason instanceof _util.AbortException) {
  12413. return null;
  12414. }
  12415. if (this.options.ignoreErrors) {
  12416. this.handler.send("UnsupportedFeature", {
  12417. featureId: _util.UNSUPPORTED_FEATURES.errorColorSpace
  12418. });
  12419. (0, _util.warn)(`parseColorSpace - ignoring ColorSpace: "${reason}".`);
  12420. return null;
  12421. }
  12422. throw reason;
  12423. });
  12424. }
  12425. parseShading(_ref5) {
  12426. let {
  12427. shading,
  12428. resources,
  12429. localColorSpaceCache,
  12430. localShadingPatternCache
  12431. } = _ref5;
  12432. let id = localShadingPatternCache.get(shading);
  12433. if (!id) {
  12434. var shadingFill = _pattern.Pattern.parseShading(shading, this.xref, resources, this.handler, this._pdfFunctionFactory, localColorSpaceCache);
  12435. const patternIR = shadingFill.getIR();
  12436. id = `pattern_${this.idFactory.createObjId()}`;
  12437. localShadingPatternCache.set(shading, id);
  12438. this.handler.send("obj", [id, this.pageIndex, "Pattern", patternIR]);
  12439. }
  12440. return id;
  12441. }
  12442. handleColorN(operatorList, fn, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache) {
  12443. const patternName = args.pop();
  12444. if (patternName instanceof _primitives.Name) {
  12445. const rawPattern = patterns.getRaw(patternName.name);
  12446. const localTilingPattern = rawPattern instanceof _primitives.Ref && localTilingPatternCache.getByRef(rawPattern);
  12447. if (localTilingPattern) {
  12448. try {
  12449. const color = cs.base ? cs.base.getRgb(args, 0) : null;
  12450. const tilingPatternIR = (0, _pattern.getTilingPatternIR)(localTilingPattern.operatorListIR, localTilingPattern.dict, color);
  12451. operatorList.addOp(fn, tilingPatternIR);
  12452. return undefined;
  12453. } catch (ex) {}
  12454. }
  12455. const pattern = this.xref.fetchIfRef(rawPattern);
  12456. if (pattern) {
  12457. const dict = pattern instanceof _base_stream.BaseStream ? pattern.dict : pattern;
  12458. const typeNum = dict.get("PatternType");
  12459. if (typeNum === PatternType.TILING) {
  12460. const color = cs.base ? cs.base.getRgb(args, 0) : null;
  12461. return this.handleTilingType(fn, color, resources, pattern, dict, operatorList, task, localTilingPatternCache);
  12462. } else if (typeNum === PatternType.SHADING) {
  12463. const shading = dict.get("Shading");
  12464. const matrix = dict.getArray("Matrix");
  12465. const objId = this.parseShading({
  12466. shading,
  12467. resources,
  12468. localColorSpaceCache,
  12469. localShadingPatternCache
  12470. });
  12471. operatorList.addOp(fn, ["Shading", objId, matrix]);
  12472. return undefined;
  12473. }
  12474. throw new _util.FormatError(`Unknown PatternType: ${typeNum}`);
  12475. }
  12476. }
  12477. throw new _util.FormatError(`Unknown PatternName: ${patternName}`);
  12478. }
  12479. _parseVisibilityExpression(array, nestingCounter, currentResult) {
  12480. const MAX_NESTING = 10;
  12481. if (++nestingCounter > MAX_NESTING) {
  12482. (0, _util.warn)("Visibility expression is too deeply nested");
  12483. return;
  12484. }
  12485. const length = array.length;
  12486. const operator = this.xref.fetchIfRef(array[0]);
  12487. if (length < 2 || !(operator instanceof _primitives.Name)) {
  12488. (0, _util.warn)("Invalid visibility expression");
  12489. return;
  12490. }
  12491. switch (operator.name) {
  12492. case "And":
  12493. case "Or":
  12494. case "Not":
  12495. currentResult.push(operator.name);
  12496. break;
  12497. default:
  12498. (0, _util.warn)(`Invalid operator ${operator.name} in visibility expression`);
  12499. return;
  12500. }
  12501. for (let i = 1; i < length; i++) {
  12502. const raw = array[i];
  12503. const object = this.xref.fetchIfRef(raw);
  12504. if (Array.isArray(object)) {
  12505. const nestedResult = [];
  12506. currentResult.push(nestedResult);
  12507. this._parseVisibilityExpression(object, nestingCounter, nestedResult);
  12508. } else if (raw instanceof _primitives.Ref) {
  12509. currentResult.push(raw.toString());
  12510. }
  12511. }
  12512. }
  12513. async parseMarkedContentProps(contentProperties, resources) {
  12514. let optionalContent;
  12515. if (contentProperties instanceof _primitives.Name) {
  12516. const properties = resources.get("Properties");
  12517. optionalContent = properties.get(contentProperties.name);
  12518. } else if (contentProperties instanceof _primitives.Dict) {
  12519. optionalContent = contentProperties;
  12520. } else {
  12521. throw new _util.FormatError("Optional content properties malformed.");
  12522. }
  12523. const optionalContentType = optionalContent.get("Type").name;
  12524. if (optionalContentType === "OCG") {
  12525. return {
  12526. type: optionalContentType,
  12527. id: optionalContent.objId
  12528. };
  12529. } else if (optionalContentType === "OCMD") {
  12530. const expression = optionalContent.get("VE");
  12531. if (Array.isArray(expression)) {
  12532. const result = [];
  12533. this._parseVisibilityExpression(expression, 0, result);
  12534. if (result.length > 0) {
  12535. return {
  12536. type: "OCMD",
  12537. expression: result
  12538. };
  12539. }
  12540. }
  12541. const optionalContentGroups = optionalContent.get("OCGs");
  12542. if (Array.isArray(optionalContentGroups) || optionalContentGroups instanceof _primitives.Dict) {
  12543. const groupIds = [];
  12544. if (Array.isArray(optionalContentGroups)) {
  12545. for (const ocg of optionalContentGroups) {
  12546. groupIds.push(ocg.toString());
  12547. }
  12548. } else {
  12549. groupIds.push(optionalContentGroups.objId);
  12550. }
  12551. return {
  12552. type: optionalContentType,
  12553. ids: groupIds,
  12554. policy: optionalContent.get("P") instanceof _primitives.Name ? optionalContent.get("P").name : null,
  12555. expression: null
  12556. };
  12557. } else if (optionalContentGroups instanceof _primitives.Ref) {
  12558. return {
  12559. type: optionalContentType,
  12560. id: optionalContentGroups.toString()
  12561. };
  12562. }
  12563. }
  12564. return null;
  12565. }
  12566. getOperatorList(_ref6) {
  12567. let {
  12568. stream,
  12569. task,
  12570. resources,
  12571. operatorList,
  12572. initialState = null,
  12573. fallbackFontDict = null
  12574. } = _ref6;
  12575. resources = resources || _primitives.Dict.empty;
  12576. initialState = initialState || new EvalState();
  12577. if (!operatorList) {
  12578. throw new Error('getOperatorList: missing "operatorList" parameter');
  12579. }
  12580. const self = this;
  12581. const xref = this.xref;
  12582. let parsingText = false;
  12583. const localImageCache = new _image_utils.LocalImageCache();
  12584. const localColorSpaceCache = new _image_utils.LocalColorSpaceCache();
  12585. const localGStateCache = new _image_utils.LocalGStateCache();
  12586. const localTilingPatternCache = new _image_utils.LocalTilingPatternCache();
  12587. const localShadingPatternCache = new Map();
  12588. const xobjs = resources.get("XObject") || _primitives.Dict.empty;
  12589. const patterns = resources.get("Pattern") || _primitives.Dict.empty;
  12590. const stateManager = new StateManager(initialState);
  12591. const preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
  12592. const timeSlotManager = new TimeSlotManager();
  12593. function closePendingRestoreOPS(argument) {
  12594. for (let i = 0, ii = preprocessor.savedStatesDepth; i < ii; i++) {
  12595. operatorList.addOp(_util.OPS.restore, []);
  12596. }
  12597. }
  12598. return new Promise(function promiseBody(resolve, reject) {
  12599. const next = function (promise) {
  12600. Promise.all([promise, operatorList.ready]).then(function () {
  12601. try {
  12602. promiseBody(resolve, reject);
  12603. } catch (ex) {
  12604. reject(ex);
  12605. }
  12606. }, reject);
  12607. };
  12608. task.ensureNotTerminated();
  12609. timeSlotManager.reset();
  12610. const operation = {};
  12611. let stop, i, ii, cs, name, isValidName;
  12612. while (!(stop = timeSlotManager.check())) {
  12613. operation.args = null;
  12614. if (!preprocessor.read(operation)) {
  12615. break;
  12616. }
  12617. let args = operation.args;
  12618. let fn = operation.fn;
  12619. switch (fn | 0) {
  12620. case _util.OPS.paintXObject:
  12621. isValidName = args[0] instanceof _primitives.Name;
  12622. name = args[0].name;
  12623. if (isValidName) {
  12624. const localImage = localImageCache.getByName(name);
  12625. if (localImage) {
  12626. operatorList.addImageOps(localImage.fn, localImage.args, localImage.optionalContent);
  12627. incrementCachedImageMaskCount(localImage);
  12628. args = null;
  12629. continue;
  12630. }
  12631. }
  12632. next(new Promise(function (resolveXObject, rejectXObject) {
  12633. if (!isValidName) {
  12634. throw new _util.FormatError("XObject must be referred to by name.");
  12635. }
  12636. let xobj = xobjs.getRaw(name);
  12637. if (xobj instanceof _primitives.Ref) {
  12638. const localImage = localImageCache.getByRef(xobj);
  12639. if (localImage) {
  12640. operatorList.addImageOps(localImage.fn, localImage.args, localImage.optionalContent);
  12641. incrementCachedImageMaskCount(localImage);
  12642. resolveXObject();
  12643. return;
  12644. }
  12645. const globalImage = self.globalImageCache.getData(xobj, self.pageIndex);
  12646. if (globalImage) {
  12647. operatorList.addDependency(globalImage.objId);
  12648. operatorList.addImageOps(globalImage.fn, globalImage.args, globalImage.optionalContent);
  12649. resolveXObject();
  12650. return;
  12651. }
  12652. xobj = xref.fetch(xobj);
  12653. }
  12654. if (!(xobj instanceof _base_stream.BaseStream)) {
  12655. throw new _util.FormatError("XObject should be a stream");
  12656. }
  12657. const type = xobj.dict.get("Subtype");
  12658. if (!(type instanceof _primitives.Name)) {
  12659. throw new _util.FormatError("XObject should have a Name subtype");
  12660. }
  12661. if (type.name === "Form") {
  12662. stateManager.save();
  12663. self.buildFormXObject(resources, xobj, null, operatorList, task, stateManager.state.clone(), localColorSpaceCache).then(function () {
  12664. stateManager.restore();
  12665. resolveXObject();
  12666. }, rejectXObject);
  12667. return;
  12668. } else if (type.name === "Image") {
  12669. self.buildPaintImageXObject({
  12670. resources,
  12671. image: xobj,
  12672. operatorList,
  12673. cacheKey: name,
  12674. localImageCache,
  12675. localColorSpaceCache
  12676. }).then(resolveXObject, rejectXObject);
  12677. return;
  12678. } else if (type.name === "PS") {
  12679. (0, _util.info)("Ignored XObject subtype PS");
  12680. } else {
  12681. throw new _util.FormatError(`Unhandled XObject subtype ${type.name}`);
  12682. }
  12683. resolveXObject();
  12684. }).catch(function (reason) {
  12685. if (reason instanceof _util.AbortException) {
  12686. return;
  12687. }
  12688. if (self.options.ignoreErrors) {
  12689. self.handler.send("UnsupportedFeature", {
  12690. featureId: _util.UNSUPPORTED_FEATURES.errorXObject
  12691. });
  12692. (0, _util.warn)(`getOperatorList - ignoring XObject: "${reason}".`);
  12693. return;
  12694. }
  12695. throw reason;
  12696. }));
  12697. return;
  12698. case _util.OPS.setFont:
  12699. var fontSize = args[1];
  12700. next(self.handleSetFont(resources, args, null, operatorList, task, stateManager.state, fallbackFontDict).then(function (loadedName) {
  12701. operatorList.addDependency(loadedName);
  12702. operatorList.addOp(_util.OPS.setFont, [loadedName, fontSize]);
  12703. }));
  12704. return;
  12705. case _util.OPS.beginText:
  12706. parsingText = true;
  12707. break;
  12708. case _util.OPS.endText:
  12709. parsingText = false;
  12710. break;
  12711. case _util.OPS.endInlineImage:
  12712. var cacheKey = args[0].cacheKey;
  12713. if (cacheKey) {
  12714. const localImage = localImageCache.getByName(cacheKey);
  12715. if (localImage) {
  12716. operatorList.addImageOps(localImage.fn, localImage.args, localImage.optionalContent);
  12717. incrementCachedImageMaskCount(localImage);
  12718. args = null;
  12719. continue;
  12720. }
  12721. }
  12722. next(self.buildPaintImageXObject({
  12723. resources,
  12724. image: args[0],
  12725. isInline: true,
  12726. operatorList,
  12727. cacheKey,
  12728. localImageCache,
  12729. localColorSpaceCache
  12730. }));
  12731. return;
  12732. case _util.OPS.showText:
  12733. if (!stateManager.state.font) {
  12734. self.ensureStateFont(stateManager.state);
  12735. continue;
  12736. }
  12737. args[0] = self.handleText(args[0], stateManager.state);
  12738. break;
  12739. case _util.OPS.showSpacedText:
  12740. if (!stateManager.state.font) {
  12741. self.ensureStateFont(stateManager.state);
  12742. continue;
  12743. }
  12744. var combinedGlyphs = [];
  12745. var state = stateManager.state;
  12746. for (const arrItem of args[0]) {
  12747. if (typeof arrItem === "string") {
  12748. combinedGlyphs.push(...self.handleText(arrItem, state));
  12749. } else if (typeof arrItem === "number") {
  12750. combinedGlyphs.push(arrItem);
  12751. }
  12752. }
  12753. args[0] = combinedGlyphs;
  12754. fn = _util.OPS.showText;
  12755. break;
  12756. case _util.OPS.nextLineShowText:
  12757. if (!stateManager.state.font) {
  12758. self.ensureStateFont(stateManager.state);
  12759. continue;
  12760. }
  12761. operatorList.addOp(_util.OPS.nextLine);
  12762. args[0] = self.handleText(args[0], stateManager.state);
  12763. fn = _util.OPS.showText;
  12764. break;
  12765. case _util.OPS.nextLineSetSpacingShowText:
  12766. if (!stateManager.state.font) {
  12767. self.ensureStateFont(stateManager.state);
  12768. continue;
  12769. }
  12770. operatorList.addOp(_util.OPS.nextLine);
  12771. operatorList.addOp(_util.OPS.setWordSpacing, [args.shift()]);
  12772. operatorList.addOp(_util.OPS.setCharSpacing, [args.shift()]);
  12773. args[0] = self.handleText(args[0], stateManager.state);
  12774. fn = _util.OPS.showText;
  12775. break;
  12776. case _util.OPS.setTextRenderingMode:
  12777. stateManager.state.textRenderingMode = args[0];
  12778. break;
  12779. case _util.OPS.setFillColorSpace:
  12780. {
  12781. const cachedColorSpace = _colorspace.ColorSpace.getCached(args[0], xref, localColorSpaceCache);
  12782. if (cachedColorSpace) {
  12783. stateManager.state.fillColorSpace = cachedColorSpace;
  12784. continue;
  12785. }
  12786. next(self.parseColorSpace({
  12787. cs: args[0],
  12788. resources,
  12789. localColorSpaceCache
  12790. }).then(function (colorSpace) {
  12791. if (colorSpace) {
  12792. stateManager.state.fillColorSpace = colorSpace;
  12793. }
  12794. }));
  12795. return;
  12796. }
  12797. case _util.OPS.setStrokeColorSpace:
  12798. {
  12799. const cachedColorSpace = _colorspace.ColorSpace.getCached(args[0], xref, localColorSpaceCache);
  12800. if (cachedColorSpace) {
  12801. stateManager.state.strokeColorSpace = cachedColorSpace;
  12802. continue;
  12803. }
  12804. next(self.parseColorSpace({
  12805. cs: args[0],
  12806. resources,
  12807. localColorSpaceCache
  12808. }).then(function (colorSpace) {
  12809. if (colorSpace) {
  12810. stateManager.state.strokeColorSpace = colorSpace;
  12811. }
  12812. }));
  12813. return;
  12814. }
  12815. case _util.OPS.setFillColor:
  12816. cs = stateManager.state.fillColorSpace;
  12817. args = cs.getRgb(args, 0);
  12818. fn = _util.OPS.setFillRGBColor;
  12819. break;
  12820. case _util.OPS.setStrokeColor:
  12821. cs = stateManager.state.strokeColorSpace;
  12822. args = cs.getRgb(args, 0);
  12823. fn = _util.OPS.setStrokeRGBColor;
  12824. break;
  12825. case _util.OPS.setFillGray:
  12826. stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.gray;
  12827. args = _colorspace.ColorSpace.singletons.gray.getRgb(args, 0);
  12828. fn = _util.OPS.setFillRGBColor;
  12829. break;
  12830. case _util.OPS.setStrokeGray:
  12831. stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.gray;
  12832. args = _colorspace.ColorSpace.singletons.gray.getRgb(args, 0);
  12833. fn = _util.OPS.setStrokeRGBColor;
  12834. break;
  12835. case _util.OPS.setFillCMYKColor:
  12836. stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.cmyk;
  12837. args = _colorspace.ColorSpace.singletons.cmyk.getRgb(args, 0);
  12838. fn = _util.OPS.setFillRGBColor;
  12839. break;
  12840. case _util.OPS.setStrokeCMYKColor:
  12841. stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.cmyk;
  12842. args = _colorspace.ColorSpace.singletons.cmyk.getRgb(args, 0);
  12843. fn = _util.OPS.setStrokeRGBColor;
  12844. break;
  12845. case _util.OPS.setFillRGBColor:
  12846. stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.rgb;
  12847. args = _colorspace.ColorSpace.singletons.rgb.getRgb(args, 0);
  12848. break;
  12849. case _util.OPS.setStrokeRGBColor:
  12850. stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.rgb;
  12851. args = _colorspace.ColorSpace.singletons.rgb.getRgb(args, 0);
  12852. break;
  12853. case _util.OPS.setFillColorN:
  12854. cs = stateManager.state.fillColorSpace;
  12855. if (cs.name === "Pattern") {
  12856. next(self.handleColorN(operatorList, _util.OPS.setFillColorN, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache));
  12857. return;
  12858. }
  12859. args = cs.getRgb(args, 0);
  12860. fn = _util.OPS.setFillRGBColor;
  12861. break;
  12862. case _util.OPS.setStrokeColorN:
  12863. cs = stateManager.state.strokeColorSpace;
  12864. if (cs.name === "Pattern") {
  12865. next(self.handleColorN(operatorList, _util.OPS.setStrokeColorN, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache));
  12866. return;
  12867. }
  12868. args = cs.getRgb(args, 0);
  12869. fn = _util.OPS.setStrokeRGBColor;
  12870. break;
  12871. case _util.OPS.shadingFill:
  12872. var shadingRes = resources.get("Shading");
  12873. if (!shadingRes) {
  12874. throw new _util.FormatError("No shading resource found");
  12875. }
  12876. var shading = shadingRes.get(args[0].name);
  12877. if (!shading) {
  12878. throw new _util.FormatError("No shading object found");
  12879. }
  12880. const patternId = self.parseShading({
  12881. shading,
  12882. resources,
  12883. localColorSpaceCache,
  12884. localShadingPatternCache
  12885. });
  12886. args = [patternId];
  12887. fn = _util.OPS.shadingFill;
  12888. break;
  12889. case _util.OPS.setGState:
  12890. isValidName = args[0] instanceof _primitives.Name;
  12891. name = args[0].name;
  12892. if (isValidName) {
  12893. const localGStateObj = localGStateCache.getByName(name);
  12894. if (localGStateObj) {
  12895. if (localGStateObj.length > 0) {
  12896. operatorList.addOp(_util.OPS.setGState, [localGStateObj]);
  12897. }
  12898. args = null;
  12899. continue;
  12900. }
  12901. }
  12902. next(new Promise(function (resolveGState, rejectGState) {
  12903. if (!isValidName) {
  12904. throw new _util.FormatError("GState must be referred to by name.");
  12905. }
  12906. const extGState = resources.get("ExtGState");
  12907. if (!(extGState instanceof _primitives.Dict)) {
  12908. throw new _util.FormatError("ExtGState should be a dictionary.");
  12909. }
  12910. const gState = extGState.get(name);
  12911. if (!(gState instanceof _primitives.Dict)) {
  12912. throw new _util.FormatError("GState should be a dictionary.");
  12913. }
  12914. self.setGState({
  12915. resources,
  12916. gState,
  12917. operatorList,
  12918. cacheKey: name,
  12919. task,
  12920. stateManager,
  12921. localGStateCache,
  12922. localColorSpaceCache
  12923. }).then(resolveGState, rejectGState);
  12924. }).catch(function (reason) {
  12925. if (reason instanceof _util.AbortException) {
  12926. return;
  12927. }
  12928. if (self.options.ignoreErrors) {
  12929. self.handler.send("UnsupportedFeature", {
  12930. featureId: _util.UNSUPPORTED_FEATURES.errorExtGState
  12931. });
  12932. (0, _util.warn)(`getOperatorList - ignoring ExtGState: "${reason}".`);
  12933. return;
  12934. }
  12935. throw reason;
  12936. }));
  12937. return;
  12938. case _util.OPS.moveTo:
  12939. case _util.OPS.lineTo:
  12940. case _util.OPS.curveTo:
  12941. case _util.OPS.curveTo2:
  12942. case _util.OPS.curveTo3:
  12943. case _util.OPS.closePath:
  12944. case _util.OPS.rectangle:
  12945. self.buildPath(operatorList, fn, args, parsingText);
  12946. continue;
  12947. case _util.OPS.markPoint:
  12948. case _util.OPS.markPointProps:
  12949. case _util.OPS.beginCompat:
  12950. case _util.OPS.endCompat:
  12951. continue;
  12952. case _util.OPS.beginMarkedContentProps:
  12953. if (!(args[0] instanceof _primitives.Name)) {
  12954. (0, _util.warn)(`Expected name for beginMarkedContentProps arg0=${args[0]}`);
  12955. continue;
  12956. }
  12957. if (args[0].name === "OC") {
  12958. next(self.parseMarkedContentProps(args[1], resources).then(data => {
  12959. operatorList.addOp(_util.OPS.beginMarkedContentProps, ["OC", data]);
  12960. }).catch(reason => {
  12961. if (reason instanceof _util.AbortException) {
  12962. return;
  12963. }
  12964. if (self.options.ignoreErrors) {
  12965. self.handler.send("UnsupportedFeature", {
  12966. featureId: _util.UNSUPPORTED_FEATURES.errorMarkedContent
  12967. });
  12968. (0, _util.warn)(`getOperatorList - ignoring beginMarkedContentProps: "${reason}".`);
  12969. return;
  12970. }
  12971. throw reason;
  12972. }));
  12973. return;
  12974. }
  12975. args = [args[0].name, args[1] instanceof _primitives.Dict ? args[1].get("MCID") : null];
  12976. break;
  12977. case _util.OPS.beginMarkedContent:
  12978. case _util.OPS.endMarkedContent:
  12979. default:
  12980. if (args !== null) {
  12981. for (i = 0, ii = args.length; i < ii; i++) {
  12982. if (args[i] instanceof _primitives.Dict) {
  12983. break;
  12984. }
  12985. }
  12986. if (i < ii) {
  12987. (0, _util.warn)("getOperatorList - ignoring operator: " + fn);
  12988. continue;
  12989. }
  12990. }
  12991. }
  12992. operatorList.addOp(fn, args);
  12993. }
  12994. if (stop) {
  12995. next(deferred);
  12996. return;
  12997. }
  12998. closePendingRestoreOPS();
  12999. resolve();
  13000. }).catch(reason => {
  13001. if (reason instanceof _util.AbortException) {
  13002. return;
  13003. }
  13004. if (this.options.ignoreErrors) {
  13005. this.handler.send("UnsupportedFeature", {
  13006. featureId: _util.UNSUPPORTED_FEATURES.errorOperatorList
  13007. });
  13008. (0, _util.warn)(`getOperatorList - ignoring errors during "${task.name}" ` + `task: "${reason}".`);
  13009. closePendingRestoreOPS();
  13010. return;
  13011. }
  13012. throw reason;
  13013. });
  13014. }
  13015. getTextContent(_ref7) {
  13016. let {
  13017. stream,
  13018. task,
  13019. resources,
  13020. stateManager = null,
  13021. combineTextItems = false,
  13022. includeMarkedContent = false,
  13023. sink,
  13024. seenStyles = new Set(),
  13025. viewBox,
  13026. markedContentData = null
  13027. } = _ref7;
  13028. resources = resources || _primitives.Dict.empty;
  13029. stateManager = stateManager || new StateManager(new TextState());
  13030. if (includeMarkedContent) {
  13031. markedContentData = markedContentData || {
  13032. level: 0
  13033. };
  13034. }
  13035. const textContent = {
  13036. items: [],
  13037. styles: Object.create(null)
  13038. };
  13039. const textContentItem = {
  13040. initialized: false,
  13041. str: [],
  13042. totalWidth: 0,
  13043. totalHeight: 0,
  13044. width: 0,
  13045. height: 0,
  13046. vertical: false,
  13047. prevTransform: null,
  13048. textAdvanceScale: 0,
  13049. spaceInFlowMin: 0,
  13050. spaceInFlowMax: 0,
  13051. trackingSpaceMin: Infinity,
  13052. negativeSpaceMax: -Infinity,
  13053. notASpace: -Infinity,
  13054. transform: null,
  13055. fontName: null,
  13056. hasEOL: false
  13057. };
  13058. const twoLastChars = [" ", " "];
  13059. let twoLastCharsPos = 0;
  13060. function saveLastChar(char) {
  13061. const nextPos = (twoLastCharsPos + 1) % 2;
  13062. const ret = twoLastChars[twoLastCharsPos] !== " " && twoLastChars[nextPos] === " ";
  13063. twoLastChars[twoLastCharsPos] = char;
  13064. twoLastCharsPos = nextPos;
  13065. return ret;
  13066. }
  13067. function resetLastChars() {
  13068. twoLastChars[0] = twoLastChars[1] = " ";
  13069. twoLastCharsPos = 0;
  13070. }
  13071. const TRACKING_SPACE_FACTOR = 0.1;
  13072. const NOT_A_SPACE_FACTOR = 0.03;
  13073. const NEGATIVE_SPACE_FACTOR = -0.2;
  13074. const SPACE_IN_FLOW_MIN_FACTOR = 0.1;
  13075. const SPACE_IN_FLOW_MAX_FACTOR = 0.6;
  13076. const self = this;
  13077. const xref = this.xref;
  13078. const showSpacedTextBuffer = [];
  13079. let xobjs = null;
  13080. const emptyXObjectCache = new _image_utils.LocalImageCache();
  13081. const emptyGStateCache = new _image_utils.LocalGStateCache();
  13082. const preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
  13083. let textState;
  13084. function getCurrentTextTransform() {
  13085. const font = textState.font;
  13086. const tsm = [textState.fontSize * textState.textHScale, 0, 0, textState.fontSize, 0, textState.textRise];
  13087. if (font.isType3Font && (textState.fontSize <= 1 || font.isCharBBox) && !(0, _util.isArrayEqual)(textState.fontMatrix, _util.FONT_IDENTITY_MATRIX)) {
  13088. const glyphHeight = font.bbox[3] - font.bbox[1];
  13089. if (glyphHeight > 0) {
  13090. tsm[3] *= glyphHeight * textState.fontMatrix[3];
  13091. }
  13092. }
  13093. return _util.Util.transform(textState.ctm, _util.Util.transform(textState.textMatrix, tsm));
  13094. }
  13095. function ensureTextContentItem() {
  13096. if (textContentItem.initialized) {
  13097. return textContentItem;
  13098. }
  13099. const {
  13100. font,
  13101. loadedName
  13102. } = textState;
  13103. if (!seenStyles.has(loadedName)) {
  13104. seenStyles.add(loadedName);
  13105. textContent.styles[loadedName] = {
  13106. fontFamily: font.fallbackName,
  13107. ascent: font.ascent,
  13108. descent: font.descent,
  13109. vertical: font.vertical
  13110. };
  13111. }
  13112. textContentItem.fontName = loadedName;
  13113. const trm = textContentItem.transform = getCurrentTextTransform();
  13114. if (!font.vertical) {
  13115. textContentItem.width = textContentItem.totalWidth = 0;
  13116. textContentItem.height = textContentItem.totalHeight = Math.hypot(trm[2], trm[3]);
  13117. textContentItem.vertical = false;
  13118. } else {
  13119. textContentItem.width = textContentItem.totalWidth = Math.hypot(trm[0], trm[1]);
  13120. textContentItem.height = textContentItem.totalHeight = 0;
  13121. textContentItem.vertical = true;
  13122. }
  13123. const scaleLineX = Math.hypot(textState.textLineMatrix[0], textState.textLineMatrix[1]);
  13124. const scaleCtmX = Math.hypot(textState.ctm[0], textState.ctm[1]);
  13125. textContentItem.textAdvanceScale = scaleCtmX * scaleLineX;
  13126. textContentItem.trackingSpaceMin = textState.fontSize * TRACKING_SPACE_FACTOR;
  13127. textContentItem.notASpace = textState.fontSize * NOT_A_SPACE_FACTOR;
  13128. textContentItem.negativeSpaceMax = textState.fontSize * NEGATIVE_SPACE_FACTOR;
  13129. textContentItem.spaceInFlowMin = textState.fontSize * SPACE_IN_FLOW_MIN_FACTOR;
  13130. textContentItem.spaceInFlowMax = textState.fontSize * SPACE_IN_FLOW_MAX_FACTOR;
  13131. textContentItem.hasEOL = false;
  13132. textContentItem.initialized = true;
  13133. return textContentItem;
  13134. }
  13135. function updateAdvanceScale() {
  13136. if (!textContentItem.initialized) {
  13137. return;
  13138. }
  13139. const scaleLineX = Math.hypot(textState.textLineMatrix[0], textState.textLineMatrix[1]);
  13140. const scaleCtmX = Math.hypot(textState.ctm[0], textState.ctm[1]);
  13141. const scaleFactor = scaleCtmX * scaleLineX;
  13142. if (scaleFactor === textContentItem.textAdvanceScale) {
  13143. return;
  13144. }
  13145. if (!textContentItem.vertical) {
  13146. textContentItem.totalWidth += textContentItem.width * textContentItem.textAdvanceScale;
  13147. textContentItem.width = 0;
  13148. } else {
  13149. textContentItem.totalHeight += textContentItem.height * textContentItem.textAdvanceScale;
  13150. textContentItem.height = 0;
  13151. }
  13152. textContentItem.textAdvanceScale = scaleFactor;
  13153. }
  13154. function runBidiTransform(textChunk) {
  13155. const text = textChunk.str.join("");
  13156. const bidiResult = (0, _bidi.bidi)(text, -1, textChunk.vertical);
  13157. return {
  13158. str: bidiResult.str,
  13159. dir: bidiResult.dir,
  13160. width: Math.abs(textChunk.totalWidth),
  13161. height: Math.abs(textChunk.totalHeight),
  13162. transform: textChunk.transform,
  13163. fontName: textChunk.fontName,
  13164. hasEOL: textChunk.hasEOL
  13165. };
  13166. }
  13167. function handleSetFont(fontName, fontRef) {
  13168. return self.loadFont(fontName, fontRef, resources).then(function (translated) {
  13169. if (!translated.font.isType3Font) {
  13170. return translated;
  13171. }
  13172. return translated.loadType3Data(self, resources, task).catch(function () {}).then(function () {
  13173. return translated;
  13174. });
  13175. }).then(function (translated) {
  13176. textState.loadedName = translated.loadedName;
  13177. textState.font = translated.font;
  13178. textState.fontMatrix = translated.font.fontMatrix || _util.FONT_IDENTITY_MATRIX;
  13179. });
  13180. }
  13181. function applyInverseRotation(x, y, matrix) {
  13182. const scale = Math.hypot(matrix[0], matrix[1]);
  13183. return [(matrix[0] * x + matrix[1] * y) / scale, (matrix[2] * x + matrix[3] * y) / scale];
  13184. }
  13185. function compareWithLastPosition() {
  13186. const currentTransform = getCurrentTextTransform();
  13187. let posX = currentTransform[4];
  13188. let posY = currentTransform[5];
  13189. const shiftedX = posX - viewBox[0];
  13190. const shiftedY = posY - viewBox[1];
  13191. if (shiftedX < 0 || shiftedX > viewBox[2] || shiftedY < 0 || shiftedY > viewBox[3]) {
  13192. return false;
  13193. }
  13194. if (!combineTextItems || !textState.font || !textContentItem.prevTransform) {
  13195. return true;
  13196. }
  13197. let lastPosX = textContentItem.prevTransform[4];
  13198. let lastPosY = textContentItem.prevTransform[5];
  13199. if (lastPosX === posX && lastPosY === posY) {
  13200. return true;
  13201. }
  13202. let rotate = -1;
  13203. if (currentTransform[0] && currentTransform[1] === 0 && currentTransform[2] === 0) {
  13204. rotate = currentTransform[0] > 0 ? 0 : 180;
  13205. } else if (currentTransform[1] && currentTransform[0] === 0 && currentTransform[3] === 0) {
  13206. rotate = currentTransform[1] > 0 ? 90 : 270;
  13207. }
  13208. switch (rotate) {
  13209. case 0:
  13210. break;
  13211. case 90:
  13212. [posX, posY] = [posY, posX];
  13213. [lastPosX, lastPosY] = [lastPosY, lastPosX];
  13214. break;
  13215. case 180:
  13216. [posX, posY, lastPosX, lastPosY] = [-posX, -posY, -lastPosX, -lastPosY];
  13217. break;
  13218. case 270:
  13219. [posX, posY] = [-posY, -posX];
  13220. [lastPosX, lastPosY] = [-lastPosY, -lastPosX];
  13221. break;
  13222. default:
  13223. [posX, posY] = applyInverseRotation(posX, posY, currentTransform);
  13224. [lastPosX, lastPosY] = applyInverseRotation(lastPosX, lastPosY, textContentItem.prevTransform);
  13225. }
  13226. if (textState.font.vertical) {
  13227. const advanceY = (lastPosY - posY) / textContentItem.textAdvanceScale;
  13228. const advanceX = posX - lastPosX;
  13229. const textOrientation = Math.sign(textContentItem.height);
  13230. if (advanceY < textOrientation * textContentItem.negativeSpaceMax) {
  13231. if (Math.abs(advanceX) > 0.5 * textContentItem.width) {
  13232. appendEOL();
  13233. return true;
  13234. }
  13235. resetLastChars();
  13236. flushTextContentItem();
  13237. return true;
  13238. }
  13239. if (Math.abs(advanceX) > textContentItem.width) {
  13240. appendEOL();
  13241. return true;
  13242. }
  13243. if (advanceY <= textOrientation * textContentItem.notASpace) {
  13244. resetLastChars();
  13245. }
  13246. if (advanceY <= textOrientation * textContentItem.trackingSpaceMin) {
  13247. textContentItem.height += advanceY;
  13248. } else if (!addFakeSpaces(advanceY, textContentItem.prevTransform, textOrientation)) {
  13249. if (textContentItem.str.length === 0) {
  13250. resetLastChars();
  13251. textContent.items.push({
  13252. str: " ",
  13253. dir: "ltr",
  13254. width: 0,
  13255. height: Math.abs(advanceY),
  13256. transform: textContentItem.prevTransform,
  13257. fontName: textContentItem.fontName,
  13258. hasEOL: false
  13259. });
  13260. } else {
  13261. textContentItem.height += advanceY;
  13262. }
  13263. }
  13264. return true;
  13265. }
  13266. const advanceX = (posX - lastPosX) / textContentItem.textAdvanceScale;
  13267. const advanceY = posY - lastPosY;
  13268. const textOrientation = Math.sign(textContentItem.width);
  13269. if (advanceX < textOrientation * textContentItem.negativeSpaceMax) {
  13270. if (Math.abs(advanceY) > 0.5 * textContentItem.height) {
  13271. appendEOL();
  13272. return true;
  13273. }
  13274. resetLastChars();
  13275. flushTextContentItem();
  13276. return true;
  13277. }
  13278. if (Math.abs(advanceY) > textContentItem.height) {
  13279. appendEOL();
  13280. return true;
  13281. }
  13282. if (advanceX <= textOrientation * textContentItem.notASpace) {
  13283. resetLastChars();
  13284. }
  13285. if (advanceX <= textOrientation * textContentItem.trackingSpaceMin) {
  13286. textContentItem.width += advanceX;
  13287. } else if (!addFakeSpaces(advanceX, textContentItem.prevTransform, textOrientation)) {
  13288. if (textContentItem.str.length === 0) {
  13289. resetLastChars();
  13290. textContent.items.push({
  13291. str: " ",
  13292. dir: "ltr",
  13293. width: Math.abs(advanceX),
  13294. height: 0,
  13295. transform: textContentItem.prevTransform,
  13296. fontName: textContentItem.fontName,
  13297. hasEOL: false
  13298. });
  13299. } else {
  13300. textContentItem.width += advanceX;
  13301. }
  13302. }
  13303. return true;
  13304. }
  13305. function buildTextContentItem(_ref8) {
  13306. let {
  13307. chars,
  13308. extraSpacing
  13309. } = _ref8;
  13310. const font = textState.font;
  13311. if (!chars) {
  13312. const charSpacing = textState.charSpacing + extraSpacing;
  13313. if (charSpacing) {
  13314. if (!font.vertical) {
  13315. textState.translateTextMatrix(charSpacing * textState.textHScale, 0);
  13316. } else {
  13317. textState.translateTextMatrix(0, -charSpacing);
  13318. }
  13319. }
  13320. return;
  13321. }
  13322. const glyphs = font.charsToGlyphs(chars);
  13323. const scale = textState.fontMatrix[0] * textState.fontSize;
  13324. for (let i = 0, ii = glyphs.length; i < ii; i++) {
  13325. const glyph = glyphs[i];
  13326. const {
  13327. category
  13328. } = glyph;
  13329. if (category.isInvisibleFormatMark) {
  13330. continue;
  13331. }
  13332. let charSpacing = textState.charSpacing + (i + 1 === ii ? extraSpacing : 0);
  13333. let glyphWidth = glyph.width;
  13334. if (font.vertical) {
  13335. glyphWidth = glyph.vmetric ? glyph.vmetric[0] : -glyphWidth;
  13336. }
  13337. let scaledDim = glyphWidth * scale;
  13338. if (category.isWhitespace) {
  13339. if (!font.vertical) {
  13340. charSpacing += scaledDim + textState.wordSpacing;
  13341. textState.translateTextMatrix(charSpacing * textState.textHScale, 0);
  13342. } else {
  13343. charSpacing += -scaledDim + textState.wordSpacing;
  13344. textState.translateTextMatrix(0, -charSpacing);
  13345. }
  13346. saveLastChar(" ");
  13347. continue;
  13348. }
  13349. if (!compareWithLastPosition()) {
  13350. continue;
  13351. }
  13352. const textChunk = ensureTextContentItem();
  13353. if (category.isZeroWidthDiacritic) {
  13354. scaledDim = 0;
  13355. }
  13356. if (!font.vertical) {
  13357. scaledDim *= textState.textHScale;
  13358. textState.translateTextMatrix(scaledDim, 0);
  13359. textChunk.width += scaledDim;
  13360. } else {
  13361. textState.translateTextMatrix(0, scaledDim);
  13362. scaledDim = Math.abs(scaledDim);
  13363. textChunk.height += scaledDim;
  13364. }
  13365. if (scaledDim) {
  13366. textChunk.prevTransform = getCurrentTextTransform();
  13367. }
  13368. const glyphUnicode = glyph.normalizedUnicode;
  13369. if (saveLastChar(glyphUnicode)) {
  13370. textChunk.str.push(" ");
  13371. }
  13372. textChunk.str.push(glyphUnicode);
  13373. if (charSpacing) {
  13374. if (!font.vertical) {
  13375. textState.translateTextMatrix(charSpacing * textState.textHScale, 0);
  13376. } else {
  13377. textState.translateTextMatrix(0, -charSpacing);
  13378. }
  13379. }
  13380. }
  13381. }
  13382. function appendEOL() {
  13383. resetLastChars();
  13384. if (textContentItem.initialized) {
  13385. textContentItem.hasEOL = true;
  13386. flushTextContentItem();
  13387. } else {
  13388. textContent.items.push({
  13389. str: "",
  13390. dir: "ltr",
  13391. width: 0,
  13392. height: 0,
  13393. transform: getCurrentTextTransform(),
  13394. fontName: textState.loadedName,
  13395. hasEOL: true
  13396. });
  13397. }
  13398. }
  13399. function addFakeSpaces(width, transf, textOrientation) {
  13400. if (textOrientation * textContentItem.spaceInFlowMin <= width && width <= textOrientation * textContentItem.spaceInFlowMax) {
  13401. if (textContentItem.initialized) {
  13402. resetLastChars();
  13403. textContentItem.str.push(" ");
  13404. }
  13405. return false;
  13406. }
  13407. const fontName = textContentItem.fontName;
  13408. let height = 0;
  13409. if (textContentItem.vertical) {
  13410. height = width;
  13411. width = 0;
  13412. }
  13413. flushTextContentItem();
  13414. resetLastChars();
  13415. textContent.items.push({
  13416. str: " ",
  13417. dir: "ltr",
  13418. width: Math.abs(width),
  13419. height: Math.abs(height),
  13420. transform: transf || getCurrentTextTransform(),
  13421. fontName,
  13422. hasEOL: false
  13423. });
  13424. return true;
  13425. }
  13426. function flushTextContentItem() {
  13427. if (!textContentItem.initialized || !textContentItem.str) {
  13428. return;
  13429. }
  13430. if (!textContentItem.vertical) {
  13431. textContentItem.totalWidth += textContentItem.width * textContentItem.textAdvanceScale;
  13432. } else {
  13433. textContentItem.totalHeight += textContentItem.height * textContentItem.textAdvanceScale;
  13434. }
  13435. textContent.items.push(runBidiTransform(textContentItem));
  13436. textContentItem.initialized = false;
  13437. textContentItem.str.length = 0;
  13438. }
  13439. function enqueueChunk() {
  13440. let batch = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  13441. const length = textContent.items.length;
  13442. if (length === 0) {
  13443. return;
  13444. }
  13445. if (batch && length < TEXT_CHUNK_BATCH_SIZE) {
  13446. return;
  13447. }
  13448. sink.enqueue(textContent, length);
  13449. textContent.items = [];
  13450. textContent.styles = Object.create(null);
  13451. }
  13452. const timeSlotManager = new TimeSlotManager();
  13453. return new Promise(function promiseBody(resolve, reject) {
  13454. const next = function (promise) {
  13455. enqueueChunk(true);
  13456. Promise.all([promise, sink.ready]).then(function () {
  13457. try {
  13458. promiseBody(resolve, reject);
  13459. } catch (ex) {
  13460. reject(ex);
  13461. }
  13462. }, reject);
  13463. };
  13464. task.ensureNotTerminated();
  13465. timeSlotManager.reset();
  13466. const operation = {};
  13467. let stop,
  13468. args = [];
  13469. while (!(stop = timeSlotManager.check())) {
  13470. args.length = 0;
  13471. operation.args = args;
  13472. if (!preprocessor.read(operation)) {
  13473. break;
  13474. }
  13475. textState = stateManager.state;
  13476. const fn = operation.fn;
  13477. args = operation.args;
  13478. switch (fn | 0) {
  13479. case _util.OPS.setFont:
  13480. var fontNameArg = args[0].name,
  13481. fontSizeArg = args[1];
  13482. if (textState.font && fontNameArg === textState.fontName && fontSizeArg === textState.fontSize) {
  13483. break;
  13484. }
  13485. flushTextContentItem();
  13486. textState.fontName = fontNameArg;
  13487. textState.fontSize = fontSizeArg;
  13488. next(handleSetFont(fontNameArg, null));
  13489. return;
  13490. case _util.OPS.setTextRise:
  13491. textState.textRise = args[0];
  13492. break;
  13493. case _util.OPS.setHScale:
  13494. textState.textHScale = args[0] / 100;
  13495. break;
  13496. case _util.OPS.setLeading:
  13497. textState.leading = args[0];
  13498. break;
  13499. case _util.OPS.moveText:
  13500. textState.translateTextLineMatrix(args[0], args[1]);
  13501. textState.textMatrix = textState.textLineMatrix.slice();
  13502. break;
  13503. case _util.OPS.setLeadingMoveText:
  13504. textState.leading = -args[1];
  13505. textState.translateTextLineMatrix(args[0], args[1]);
  13506. textState.textMatrix = textState.textLineMatrix.slice();
  13507. break;
  13508. case _util.OPS.nextLine:
  13509. textState.carriageReturn();
  13510. break;
  13511. case _util.OPS.setTextMatrix:
  13512. textState.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
  13513. textState.setTextLineMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
  13514. updateAdvanceScale();
  13515. break;
  13516. case _util.OPS.setCharSpacing:
  13517. textState.charSpacing = args[0];
  13518. break;
  13519. case _util.OPS.setWordSpacing:
  13520. textState.wordSpacing = args[0];
  13521. break;
  13522. case _util.OPS.beginText:
  13523. textState.textMatrix = _util.IDENTITY_MATRIX.slice();
  13524. textState.textLineMatrix = _util.IDENTITY_MATRIX.slice();
  13525. break;
  13526. case _util.OPS.showSpacedText:
  13527. if (!stateManager.state.font) {
  13528. self.ensureStateFont(stateManager.state);
  13529. continue;
  13530. }
  13531. const spaceFactor = (textState.font.vertical ? 1 : -1) * textState.fontSize / 1000;
  13532. const elements = args[0];
  13533. for (let i = 0, ii = elements.length; i < ii - 1; i++) {
  13534. const item = elements[i];
  13535. if (typeof item === "string") {
  13536. showSpacedTextBuffer.push(item);
  13537. } else if (typeof item === "number" && item !== 0) {
  13538. const str = showSpacedTextBuffer.join("");
  13539. showSpacedTextBuffer.length = 0;
  13540. buildTextContentItem({
  13541. chars: str,
  13542. extraSpacing: item * spaceFactor
  13543. });
  13544. }
  13545. }
  13546. const item = elements.at(-1);
  13547. if (typeof item === "string") {
  13548. showSpacedTextBuffer.push(item);
  13549. }
  13550. if (showSpacedTextBuffer.length > 0) {
  13551. const str = showSpacedTextBuffer.join("");
  13552. showSpacedTextBuffer.length = 0;
  13553. buildTextContentItem({
  13554. chars: str,
  13555. extraSpacing: 0
  13556. });
  13557. }
  13558. break;
  13559. case _util.OPS.showText:
  13560. if (!stateManager.state.font) {
  13561. self.ensureStateFont(stateManager.state);
  13562. continue;
  13563. }
  13564. buildTextContentItem({
  13565. chars: args[0],
  13566. extraSpacing: 0
  13567. });
  13568. break;
  13569. case _util.OPS.nextLineShowText:
  13570. if (!stateManager.state.font) {
  13571. self.ensureStateFont(stateManager.state);
  13572. continue;
  13573. }
  13574. textState.carriageReturn();
  13575. buildTextContentItem({
  13576. chars: args[0],
  13577. extraSpacing: 0
  13578. });
  13579. break;
  13580. case _util.OPS.nextLineSetSpacingShowText:
  13581. if (!stateManager.state.font) {
  13582. self.ensureStateFont(stateManager.state);
  13583. continue;
  13584. }
  13585. textState.wordSpacing = args[0];
  13586. textState.charSpacing = args[1];
  13587. textState.carriageReturn();
  13588. buildTextContentItem({
  13589. chars: args[2],
  13590. extraSpacing: 0
  13591. });
  13592. break;
  13593. case _util.OPS.paintXObject:
  13594. flushTextContentItem();
  13595. if (!xobjs) {
  13596. xobjs = resources.get("XObject") || _primitives.Dict.empty;
  13597. }
  13598. var isValidName = args[0] instanceof _primitives.Name;
  13599. var name = args[0].name;
  13600. if (isValidName && emptyXObjectCache.getByName(name)) {
  13601. break;
  13602. }
  13603. next(new Promise(function (resolveXObject, rejectXObject) {
  13604. if (!isValidName) {
  13605. throw new _util.FormatError("XObject must be referred to by name.");
  13606. }
  13607. let xobj = xobjs.getRaw(name);
  13608. if (xobj instanceof _primitives.Ref) {
  13609. if (emptyXObjectCache.getByRef(xobj)) {
  13610. resolveXObject();
  13611. return;
  13612. }
  13613. const globalImage = self.globalImageCache.getData(xobj, self.pageIndex);
  13614. if (globalImage) {
  13615. resolveXObject();
  13616. return;
  13617. }
  13618. xobj = xref.fetch(xobj);
  13619. }
  13620. if (!(xobj instanceof _base_stream.BaseStream)) {
  13621. throw new _util.FormatError("XObject should be a stream");
  13622. }
  13623. const type = xobj.dict.get("Subtype");
  13624. if (!(type instanceof _primitives.Name)) {
  13625. throw new _util.FormatError("XObject should have a Name subtype");
  13626. }
  13627. if (type.name !== "Form") {
  13628. emptyXObjectCache.set(name, xobj.dict.objId, true);
  13629. resolveXObject();
  13630. return;
  13631. }
  13632. const currentState = stateManager.state.clone();
  13633. const xObjStateManager = new StateManager(currentState);
  13634. const matrix = xobj.dict.getArray("Matrix");
  13635. if (Array.isArray(matrix) && matrix.length === 6) {
  13636. xObjStateManager.transform(matrix);
  13637. }
  13638. enqueueChunk();
  13639. const sinkWrapper = {
  13640. enqueueInvoked: false,
  13641. enqueue(chunk, size) {
  13642. this.enqueueInvoked = true;
  13643. sink.enqueue(chunk, size);
  13644. },
  13645. get desiredSize() {
  13646. return sink.desiredSize;
  13647. },
  13648. get ready() {
  13649. return sink.ready;
  13650. }
  13651. };
  13652. self.getTextContent({
  13653. stream: xobj,
  13654. task,
  13655. resources: xobj.dict.get("Resources") || resources,
  13656. stateManager: xObjStateManager,
  13657. combineTextItems,
  13658. includeMarkedContent,
  13659. sink: sinkWrapper,
  13660. seenStyles,
  13661. viewBox,
  13662. markedContentData
  13663. }).then(function () {
  13664. if (!sinkWrapper.enqueueInvoked) {
  13665. emptyXObjectCache.set(name, xobj.dict.objId, true);
  13666. }
  13667. resolveXObject();
  13668. }, rejectXObject);
  13669. }).catch(function (reason) {
  13670. if (reason instanceof _util.AbortException) {
  13671. return;
  13672. }
  13673. if (self.options.ignoreErrors) {
  13674. (0, _util.warn)(`getTextContent - ignoring XObject: "${reason}".`);
  13675. return;
  13676. }
  13677. throw reason;
  13678. }));
  13679. return;
  13680. case _util.OPS.setGState:
  13681. isValidName = args[0] instanceof _primitives.Name;
  13682. name = args[0].name;
  13683. if (isValidName && emptyGStateCache.getByName(name)) {
  13684. break;
  13685. }
  13686. next(new Promise(function (resolveGState, rejectGState) {
  13687. if (!isValidName) {
  13688. throw new _util.FormatError("GState must be referred to by name.");
  13689. }
  13690. const extGState = resources.get("ExtGState");
  13691. if (!(extGState instanceof _primitives.Dict)) {
  13692. throw new _util.FormatError("ExtGState should be a dictionary.");
  13693. }
  13694. const gState = extGState.get(name);
  13695. if (!(gState instanceof _primitives.Dict)) {
  13696. throw new _util.FormatError("GState should be a dictionary.");
  13697. }
  13698. const gStateFont = gState.get("Font");
  13699. if (!gStateFont) {
  13700. emptyGStateCache.set(name, gState.objId, true);
  13701. resolveGState();
  13702. return;
  13703. }
  13704. flushTextContentItem();
  13705. textState.fontName = null;
  13706. textState.fontSize = gStateFont[1];
  13707. handleSetFont(null, gStateFont[0]).then(resolveGState, rejectGState);
  13708. }).catch(function (reason) {
  13709. if (reason instanceof _util.AbortException) {
  13710. return;
  13711. }
  13712. if (self.options.ignoreErrors) {
  13713. (0, _util.warn)(`getTextContent - ignoring ExtGState: "${reason}".`);
  13714. return;
  13715. }
  13716. throw reason;
  13717. }));
  13718. return;
  13719. case _util.OPS.beginMarkedContent:
  13720. flushTextContentItem();
  13721. if (includeMarkedContent) {
  13722. markedContentData.level++;
  13723. textContent.items.push({
  13724. type: "beginMarkedContent",
  13725. tag: args[0] instanceof _primitives.Name ? args[0].name : null
  13726. });
  13727. }
  13728. break;
  13729. case _util.OPS.beginMarkedContentProps:
  13730. flushTextContentItem();
  13731. if (includeMarkedContent) {
  13732. markedContentData.level++;
  13733. let mcid = null;
  13734. if (args[1] instanceof _primitives.Dict) {
  13735. mcid = args[1].get("MCID");
  13736. }
  13737. textContent.items.push({
  13738. type: "beginMarkedContentProps",
  13739. id: Number.isInteger(mcid) ? `${self.idFactory.getPageObjId()}_mcid${mcid}` : null,
  13740. tag: args[0] instanceof _primitives.Name ? args[0].name : null
  13741. });
  13742. }
  13743. break;
  13744. case _util.OPS.endMarkedContent:
  13745. flushTextContentItem();
  13746. if (includeMarkedContent) {
  13747. if (markedContentData.level === 0) {
  13748. break;
  13749. }
  13750. markedContentData.level--;
  13751. textContent.items.push({
  13752. type: "endMarkedContent"
  13753. });
  13754. }
  13755. break;
  13756. }
  13757. if (textContent.items.length >= sink.desiredSize) {
  13758. stop = true;
  13759. break;
  13760. }
  13761. }
  13762. if (stop) {
  13763. next(deferred);
  13764. return;
  13765. }
  13766. flushTextContentItem();
  13767. enqueueChunk();
  13768. resolve();
  13769. }).catch(reason => {
  13770. if (reason instanceof _util.AbortException) {
  13771. return;
  13772. }
  13773. if (this.options.ignoreErrors) {
  13774. (0, _util.warn)(`getTextContent - ignoring errors during "${task.name}" ` + `task: "${reason}".`);
  13775. flushTextContentItem();
  13776. enqueueChunk();
  13777. return;
  13778. }
  13779. throw reason;
  13780. });
  13781. }
  13782. extractDataStructures(dict, baseDict, properties) {
  13783. const xref = this.xref;
  13784. let cidToGidBytes;
  13785. const toUnicodePromise = this.readToUnicode(properties.toUnicode || dict.get("ToUnicode") || baseDict.get("ToUnicode"));
  13786. if (properties.composite) {
  13787. const cidSystemInfo = dict.get("CIDSystemInfo");
  13788. if (cidSystemInfo instanceof _primitives.Dict) {
  13789. properties.cidSystemInfo = {
  13790. registry: (0, _util.stringToPDFString)(cidSystemInfo.get("Registry")),
  13791. ordering: (0, _util.stringToPDFString)(cidSystemInfo.get("Ordering")),
  13792. supplement: cidSystemInfo.get("Supplement")
  13793. };
  13794. }
  13795. try {
  13796. const cidToGidMap = dict.get("CIDToGIDMap");
  13797. if (cidToGidMap instanceof _base_stream.BaseStream) {
  13798. cidToGidBytes = cidToGidMap.getBytes();
  13799. }
  13800. } catch (ex) {
  13801. if (!this.options.ignoreErrors) {
  13802. throw ex;
  13803. }
  13804. (0, _util.warn)(`extractDataStructures - ignoring CIDToGIDMap data: "${ex}".`);
  13805. }
  13806. }
  13807. const differences = [];
  13808. let baseEncodingName = null;
  13809. let encoding;
  13810. if (dict.has("Encoding")) {
  13811. encoding = dict.get("Encoding");
  13812. if (encoding instanceof _primitives.Dict) {
  13813. baseEncodingName = encoding.get("BaseEncoding");
  13814. baseEncodingName = baseEncodingName instanceof _primitives.Name ? baseEncodingName.name : null;
  13815. if (encoding.has("Differences")) {
  13816. const diffEncoding = encoding.get("Differences");
  13817. let index = 0;
  13818. for (const entry of diffEncoding) {
  13819. const data = xref.fetchIfRef(entry);
  13820. if (typeof data === "number") {
  13821. index = data;
  13822. } else if (data instanceof _primitives.Name) {
  13823. differences[index++] = data.name;
  13824. } else {
  13825. throw new _util.FormatError(`Invalid entry in 'Differences' array: ${data}`);
  13826. }
  13827. }
  13828. }
  13829. } else if (encoding instanceof _primitives.Name) {
  13830. baseEncodingName = encoding.name;
  13831. } else {
  13832. const msg = "Encoding is not a Name nor a Dict";
  13833. if (!this.options.ignoreErrors) {
  13834. throw new _util.FormatError(msg);
  13835. }
  13836. (0, _util.warn)(msg);
  13837. }
  13838. if (baseEncodingName !== "MacRomanEncoding" && baseEncodingName !== "MacExpertEncoding" && baseEncodingName !== "WinAnsiEncoding") {
  13839. baseEncodingName = null;
  13840. }
  13841. }
  13842. if (baseEncodingName) {
  13843. properties.defaultEncoding = (0, _encodings.getEncoding)(baseEncodingName);
  13844. } else {
  13845. const isSymbolicFont = !!(properties.flags & _fonts_utils.FontFlags.Symbolic);
  13846. const isNonsymbolicFont = !!(properties.flags & _fonts_utils.FontFlags.Nonsymbolic);
  13847. encoding = _encodings.StandardEncoding;
  13848. if (properties.type === "TrueType" && !isNonsymbolicFont) {
  13849. encoding = _encodings.WinAnsiEncoding;
  13850. }
  13851. if (isSymbolicFont) {
  13852. encoding = _encodings.MacRomanEncoding;
  13853. if (!properties.file || properties.isInternalFont) {
  13854. if (/Symbol/i.test(properties.name)) {
  13855. encoding = _encodings.SymbolSetEncoding;
  13856. } else if (/Dingbats|Wingdings/i.test(properties.name)) {
  13857. encoding = _encodings.ZapfDingbatsEncoding;
  13858. }
  13859. }
  13860. }
  13861. properties.defaultEncoding = encoding;
  13862. }
  13863. properties.differences = differences;
  13864. properties.baseEncodingName = baseEncodingName;
  13865. properties.hasEncoding = !!baseEncodingName || differences.length > 0;
  13866. properties.dict = dict;
  13867. return toUnicodePromise.then(readToUnicode => {
  13868. properties.toUnicode = readToUnicode;
  13869. return this.buildToUnicode(properties);
  13870. }).then(builtToUnicode => {
  13871. properties.toUnicode = builtToUnicode;
  13872. if (cidToGidBytes) {
  13873. properties.cidToGidMap = this.readCidToGidMap(cidToGidBytes, builtToUnicode);
  13874. }
  13875. return properties;
  13876. });
  13877. }
  13878. _simpleFontToUnicode(properties) {
  13879. let forceGlyphs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  13880. (0, _util.assert)(!properties.composite, "Must be a simple font.");
  13881. const toUnicode = [];
  13882. const encoding = properties.defaultEncoding.slice();
  13883. const baseEncodingName = properties.baseEncodingName;
  13884. const differences = properties.differences;
  13885. for (const charcode in differences) {
  13886. const glyphName = differences[charcode];
  13887. if (glyphName === ".notdef") {
  13888. continue;
  13889. }
  13890. encoding[charcode] = glyphName;
  13891. }
  13892. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  13893. for (const charcode in encoding) {
  13894. let glyphName = encoding[charcode];
  13895. if (glyphName === "") {
  13896. continue;
  13897. }
  13898. let unicode = glyphsUnicodeMap[glyphName];
  13899. if (unicode !== undefined) {
  13900. toUnicode[charcode] = String.fromCharCode(unicode);
  13901. continue;
  13902. }
  13903. let code = 0;
  13904. switch (glyphName[0]) {
  13905. case "G":
  13906. if (glyphName.length === 3) {
  13907. code = parseInt(glyphName.substring(1), 16);
  13908. }
  13909. break;
  13910. case "g":
  13911. if (glyphName.length === 5) {
  13912. code = parseInt(glyphName.substring(1), 16);
  13913. }
  13914. break;
  13915. case "C":
  13916. case "c":
  13917. if (glyphName.length >= 3 && glyphName.length <= 4) {
  13918. const codeStr = glyphName.substring(1);
  13919. if (forceGlyphs) {
  13920. code = parseInt(codeStr, 16);
  13921. break;
  13922. }
  13923. code = +codeStr;
  13924. if (Number.isNaN(code) && Number.isInteger(parseInt(codeStr, 16))) {
  13925. return this._simpleFontToUnicode(properties, true);
  13926. }
  13927. }
  13928. break;
  13929. case "u":
  13930. unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
  13931. if (unicode !== -1) {
  13932. code = unicode;
  13933. }
  13934. break;
  13935. }
  13936. if (code > 0 && code <= 0x10ffff && Number.isInteger(code)) {
  13937. if (baseEncodingName && code === +charcode) {
  13938. const baseEncoding = (0, _encodings.getEncoding)(baseEncodingName);
  13939. if (baseEncoding && (glyphName = baseEncoding[charcode])) {
  13940. toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]);
  13941. continue;
  13942. }
  13943. }
  13944. toUnicode[charcode] = String.fromCodePoint(code);
  13945. }
  13946. }
  13947. return toUnicode;
  13948. }
  13949. async buildToUnicode(properties) {
  13950. properties.hasIncludedToUnicodeMap = !!properties.toUnicode && properties.toUnicode.length > 0;
  13951. if (properties.hasIncludedToUnicodeMap) {
  13952. if (!properties.composite && properties.hasEncoding) {
  13953. properties.fallbackToUnicode = this._simpleFontToUnicode(properties);
  13954. }
  13955. return properties.toUnicode;
  13956. }
  13957. if (!properties.composite) {
  13958. return new _to_unicode_map.ToUnicodeMap(this._simpleFontToUnicode(properties));
  13959. }
  13960. 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"))) {
  13961. const {
  13962. registry,
  13963. ordering
  13964. } = properties.cidSystemInfo;
  13965. const ucs2CMapName = _primitives.Name.get(`${registry}-${ordering}-UCS2`);
  13966. const ucs2CMap = await _cmap.CMapFactory.create({
  13967. encoding: ucs2CMapName,
  13968. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  13969. useCMap: null
  13970. });
  13971. const toUnicode = [];
  13972. properties.cMap.forEach(function (charcode, cid) {
  13973. if (cid > 0xffff) {
  13974. throw new _util.FormatError("Max size of CID is 65,535");
  13975. }
  13976. const ucs2 = ucs2CMap.lookup(cid);
  13977. if (ucs2) {
  13978. toUnicode[charcode] = String.fromCharCode((ucs2.charCodeAt(0) << 8) + ucs2.charCodeAt(1));
  13979. }
  13980. });
  13981. return new _to_unicode_map.ToUnicodeMap(toUnicode);
  13982. }
  13983. return new _to_unicode_map.IdentityToUnicodeMap(properties.firstChar, properties.lastChar);
  13984. }
  13985. readToUnicode(cmapObj) {
  13986. if (!cmapObj) {
  13987. return Promise.resolve(null);
  13988. }
  13989. if (cmapObj instanceof _primitives.Name) {
  13990. return _cmap.CMapFactory.create({
  13991. encoding: cmapObj,
  13992. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  13993. useCMap: null
  13994. }).then(function (cmap) {
  13995. if (cmap instanceof _cmap.IdentityCMap) {
  13996. return new _to_unicode_map.IdentityToUnicodeMap(0, 0xffff);
  13997. }
  13998. return new _to_unicode_map.ToUnicodeMap(cmap.getMap());
  13999. });
  14000. } else if (cmapObj instanceof _base_stream.BaseStream) {
  14001. return _cmap.CMapFactory.create({
  14002. encoding: cmapObj,
  14003. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  14004. useCMap: null
  14005. }).then(function (cmap) {
  14006. if (cmap instanceof _cmap.IdentityCMap) {
  14007. return new _to_unicode_map.IdentityToUnicodeMap(0, 0xffff);
  14008. }
  14009. const map = new Array(cmap.length);
  14010. cmap.forEach(function (charCode, token) {
  14011. if (typeof token === "number") {
  14012. map[charCode] = String.fromCodePoint(token);
  14013. return;
  14014. }
  14015. const str = [];
  14016. for (let k = 0; k < token.length; k += 2) {
  14017. const w1 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
  14018. if ((w1 & 0xf800) !== 0xd800) {
  14019. str.push(w1);
  14020. continue;
  14021. }
  14022. k += 2;
  14023. const w2 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
  14024. str.push(((w1 & 0x3ff) << 10) + (w2 & 0x3ff) + 0x10000);
  14025. }
  14026. map[charCode] = String.fromCodePoint(...str);
  14027. });
  14028. return new _to_unicode_map.ToUnicodeMap(map);
  14029. }, reason => {
  14030. if (reason instanceof _util.AbortException) {
  14031. return null;
  14032. }
  14033. if (this.options.ignoreErrors) {
  14034. this.handler.send("UnsupportedFeature", {
  14035. featureId: _util.UNSUPPORTED_FEATURES.errorFontToUnicode
  14036. });
  14037. (0, _util.warn)(`readToUnicode - ignoring ToUnicode data: "${reason}".`);
  14038. return null;
  14039. }
  14040. throw reason;
  14041. });
  14042. }
  14043. return Promise.resolve(null);
  14044. }
  14045. readCidToGidMap(glyphsData, toUnicode) {
  14046. const result = [];
  14047. for (let j = 0, jj = glyphsData.length; j < jj; j++) {
  14048. const glyphID = glyphsData[j++] << 8 | glyphsData[j];
  14049. const code = j >> 1;
  14050. if (glyphID === 0 && !toUnicode.has(code)) {
  14051. continue;
  14052. }
  14053. result[code] = glyphID;
  14054. }
  14055. return result;
  14056. }
  14057. extractWidths(dict, descriptor, properties) {
  14058. const xref = this.xref;
  14059. let glyphsWidths = [];
  14060. let defaultWidth = 0;
  14061. const glyphsVMetrics = [];
  14062. let defaultVMetrics;
  14063. let i, ii, j, jj, start, code, widths;
  14064. if (properties.composite) {
  14065. defaultWidth = dict.has("DW") ? dict.get("DW") : 1000;
  14066. widths = dict.get("W");
  14067. if (widths) {
  14068. for (i = 0, ii = widths.length; i < ii; i++) {
  14069. start = xref.fetchIfRef(widths[i++]);
  14070. code = xref.fetchIfRef(widths[i]);
  14071. if (Array.isArray(code)) {
  14072. for (j = 0, jj = code.length; j < jj; j++) {
  14073. glyphsWidths[start++] = xref.fetchIfRef(code[j]);
  14074. }
  14075. } else {
  14076. const width = xref.fetchIfRef(widths[++i]);
  14077. for (j = start; j <= code; j++) {
  14078. glyphsWidths[j] = width;
  14079. }
  14080. }
  14081. }
  14082. }
  14083. if (properties.vertical) {
  14084. let vmetrics = dict.getArray("DW2") || [880, -1000];
  14085. defaultVMetrics = [vmetrics[1], defaultWidth * 0.5, vmetrics[0]];
  14086. vmetrics = dict.get("W2");
  14087. if (vmetrics) {
  14088. for (i = 0, ii = vmetrics.length; i < ii; i++) {
  14089. start = xref.fetchIfRef(vmetrics[i++]);
  14090. code = xref.fetchIfRef(vmetrics[i]);
  14091. if (Array.isArray(code)) {
  14092. for (j = 0, jj = code.length; j < jj; j++) {
  14093. glyphsVMetrics[start++] = [xref.fetchIfRef(code[j++]), xref.fetchIfRef(code[j++]), xref.fetchIfRef(code[j])];
  14094. }
  14095. } else {
  14096. const vmetric = [xref.fetchIfRef(vmetrics[++i]), xref.fetchIfRef(vmetrics[++i]), xref.fetchIfRef(vmetrics[++i])];
  14097. for (j = start; j <= code; j++) {
  14098. glyphsVMetrics[j] = vmetric;
  14099. }
  14100. }
  14101. }
  14102. }
  14103. }
  14104. } else {
  14105. const firstChar = properties.firstChar;
  14106. widths = dict.get("Widths");
  14107. if (widths) {
  14108. j = firstChar;
  14109. for (i = 0, ii = widths.length; i < ii; i++) {
  14110. glyphsWidths[j++] = xref.fetchIfRef(widths[i]);
  14111. }
  14112. defaultWidth = parseFloat(descriptor.get("MissingWidth")) || 0;
  14113. } else {
  14114. const baseFontName = dict.get("BaseFont");
  14115. if (baseFontName instanceof _primitives.Name) {
  14116. const metrics = this.getBaseFontMetrics(baseFontName.name);
  14117. glyphsWidths = this.buildCharCodeToWidth(metrics.widths, properties);
  14118. defaultWidth = metrics.defaultWidth;
  14119. }
  14120. }
  14121. }
  14122. let isMonospace = true;
  14123. let firstWidth = defaultWidth;
  14124. for (const glyph in glyphsWidths) {
  14125. const glyphWidth = glyphsWidths[glyph];
  14126. if (!glyphWidth) {
  14127. continue;
  14128. }
  14129. if (!firstWidth) {
  14130. firstWidth = glyphWidth;
  14131. continue;
  14132. }
  14133. if (firstWidth !== glyphWidth) {
  14134. isMonospace = false;
  14135. break;
  14136. }
  14137. }
  14138. if (isMonospace) {
  14139. properties.flags |= _fonts_utils.FontFlags.FixedPitch;
  14140. }
  14141. properties.defaultWidth = defaultWidth;
  14142. properties.widths = glyphsWidths;
  14143. properties.defaultVMetrics = defaultVMetrics;
  14144. properties.vmetrics = glyphsVMetrics;
  14145. }
  14146. isSerifFont(baseFontName) {
  14147. const fontNameWoStyle = baseFontName.split("-")[0];
  14148. return fontNameWoStyle in (0, _standard_fonts.getSerifFonts)() || /serif/gi.test(fontNameWoStyle);
  14149. }
  14150. getBaseFontMetrics(name) {
  14151. let defaultWidth = 0;
  14152. let widths = Object.create(null);
  14153. let monospace = false;
  14154. const stdFontMap = (0, _standard_fonts.getStdFontMap)();
  14155. let lookupName = stdFontMap[name] || name;
  14156. const Metrics = (0, _metrics.getMetrics)();
  14157. if (!(lookupName in Metrics)) {
  14158. if (this.isSerifFont(name)) {
  14159. lookupName = "Times-Roman";
  14160. } else {
  14161. lookupName = "Helvetica";
  14162. }
  14163. }
  14164. const glyphWidths = Metrics[lookupName];
  14165. if (typeof glyphWidths === "number") {
  14166. defaultWidth = glyphWidths;
  14167. monospace = true;
  14168. } else {
  14169. widths = glyphWidths();
  14170. }
  14171. return {
  14172. defaultWidth,
  14173. monospace,
  14174. widths
  14175. };
  14176. }
  14177. buildCharCodeToWidth(widthsByGlyphName, properties) {
  14178. const widths = Object.create(null);
  14179. const differences = properties.differences;
  14180. const encoding = properties.defaultEncoding;
  14181. for (let charCode = 0; charCode < 256; charCode++) {
  14182. if (charCode in differences && widthsByGlyphName[differences[charCode]]) {
  14183. widths[charCode] = widthsByGlyphName[differences[charCode]];
  14184. continue;
  14185. }
  14186. if (charCode in encoding && widthsByGlyphName[encoding[charCode]]) {
  14187. widths[charCode] = widthsByGlyphName[encoding[charCode]];
  14188. continue;
  14189. }
  14190. }
  14191. return widths;
  14192. }
  14193. preEvaluateFont(dict) {
  14194. const baseDict = dict;
  14195. let type = dict.get("Subtype");
  14196. if (!(type instanceof _primitives.Name)) {
  14197. throw new _util.FormatError("invalid font Subtype");
  14198. }
  14199. let composite = false;
  14200. let hash, toUnicode;
  14201. if (type.name === "Type0") {
  14202. const df = dict.get("DescendantFonts");
  14203. if (!df) {
  14204. throw new _util.FormatError("Descendant fonts are not specified");
  14205. }
  14206. dict = Array.isArray(df) ? this.xref.fetchIfRef(df[0]) : df;
  14207. if (!(dict instanceof _primitives.Dict)) {
  14208. throw new _util.FormatError("Descendant font is not a dictionary.");
  14209. }
  14210. type = dict.get("Subtype");
  14211. if (!(type instanceof _primitives.Name)) {
  14212. throw new _util.FormatError("invalid font Subtype");
  14213. }
  14214. composite = true;
  14215. }
  14216. const firstChar = dict.get("FirstChar") || 0,
  14217. lastChar = dict.get("LastChar") || (composite ? 0xffff : 0xff);
  14218. const descriptor = dict.get("FontDescriptor");
  14219. if (descriptor) {
  14220. hash = new _murmurhash.MurmurHash3_64();
  14221. const encoding = baseDict.getRaw("Encoding");
  14222. if (encoding instanceof _primitives.Name) {
  14223. hash.update(encoding.name);
  14224. } else if (encoding instanceof _primitives.Ref) {
  14225. hash.update(encoding.toString());
  14226. } else if (encoding instanceof _primitives.Dict) {
  14227. for (const entry of encoding.getRawValues()) {
  14228. if (entry instanceof _primitives.Name) {
  14229. hash.update(entry.name);
  14230. } else if (entry instanceof _primitives.Ref) {
  14231. hash.update(entry.toString());
  14232. } else if (Array.isArray(entry)) {
  14233. const diffLength = entry.length,
  14234. diffBuf = new Array(diffLength);
  14235. for (let j = 0; j < diffLength; j++) {
  14236. const diffEntry = entry[j];
  14237. if (diffEntry instanceof _primitives.Name) {
  14238. diffBuf[j] = diffEntry.name;
  14239. } else if (typeof diffEntry === "number" || diffEntry instanceof _primitives.Ref) {
  14240. diffBuf[j] = diffEntry.toString();
  14241. }
  14242. }
  14243. hash.update(diffBuf.join());
  14244. }
  14245. }
  14246. }
  14247. hash.update(`${firstChar}-${lastChar}`);
  14248. toUnicode = dict.get("ToUnicode") || baseDict.get("ToUnicode");
  14249. if (toUnicode instanceof _base_stream.BaseStream) {
  14250. const stream = toUnicode.str || toUnicode;
  14251. const uint8array = stream.buffer ? new Uint8Array(stream.buffer.buffer, 0, stream.bufferLength) : new Uint8Array(stream.bytes.buffer, stream.start, stream.end - stream.start);
  14252. hash.update(uint8array);
  14253. } else if (toUnicode instanceof _primitives.Name) {
  14254. hash.update(toUnicode.name);
  14255. }
  14256. const widths = dict.get("Widths") || baseDict.get("Widths");
  14257. if (Array.isArray(widths)) {
  14258. const widthsBuf = [];
  14259. for (const entry of widths) {
  14260. if (typeof entry === "number" || entry instanceof _primitives.Ref) {
  14261. widthsBuf.push(entry.toString());
  14262. }
  14263. }
  14264. hash.update(widthsBuf.join());
  14265. }
  14266. if (composite) {
  14267. hash.update("compositeFont");
  14268. const compositeWidths = dict.get("W") || baseDict.get("W");
  14269. if (Array.isArray(compositeWidths)) {
  14270. const widthsBuf = [];
  14271. for (const entry of compositeWidths) {
  14272. if (typeof entry === "number" || entry instanceof _primitives.Ref) {
  14273. widthsBuf.push(entry.toString());
  14274. } else if (Array.isArray(entry)) {
  14275. const subWidthsBuf = [];
  14276. for (const element of entry) {
  14277. if (typeof element === "number" || element instanceof _primitives.Ref) {
  14278. subWidthsBuf.push(element.toString());
  14279. }
  14280. }
  14281. widthsBuf.push(`[${subWidthsBuf.join()}]`);
  14282. }
  14283. }
  14284. hash.update(widthsBuf.join());
  14285. }
  14286. const cidToGidMap = dict.getRaw("CIDToGIDMap") || baseDict.getRaw("CIDToGIDMap");
  14287. if (cidToGidMap instanceof _primitives.Name) {
  14288. hash.update(cidToGidMap.name);
  14289. } else if (cidToGidMap instanceof _primitives.Ref) {
  14290. hash.update(cidToGidMap.toString());
  14291. } else if (cidToGidMap instanceof _base_stream.BaseStream) {
  14292. hash.update(cidToGidMap.peekBytes());
  14293. }
  14294. }
  14295. }
  14296. return {
  14297. descriptor,
  14298. dict,
  14299. baseDict,
  14300. composite,
  14301. type: type.name,
  14302. firstChar,
  14303. lastChar,
  14304. toUnicode,
  14305. hash: hash ? hash.hexdigest() : ""
  14306. };
  14307. }
  14308. async translateFont(_ref9) {
  14309. let {
  14310. descriptor,
  14311. dict,
  14312. baseDict,
  14313. composite,
  14314. type,
  14315. firstChar,
  14316. lastChar,
  14317. toUnicode,
  14318. cssFontInfo
  14319. } = _ref9;
  14320. const isType3Font = type === "Type3";
  14321. let properties;
  14322. if (!descriptor) {
  14323. if (isType3Font) {
  14324. descriptor = new _primitives.Dict(null);
  14325. descriptor.set("FontName", _primitives.Name.get(type));
  14326. descriptor.set("FontBBox", dict.getArray("FontBBox") || [0, 0, 0, 0]);
  14327. } else {
  14328. let baseFontName = dict.get("BaseFont");
  14329. if (!(baseFontName instanceof _primitives.Name)) {
  14330. throw new _util.FormatError("Base font is not specified");
  14331. }
  14332. baseFontName = baseFontName.name.replace(/[,_]/g, "-");
  14333. const metrics = this.getBaseFontMetrics(baseFontName);
  14334. const fontNameWoStyle = baseFontName.split("-")[0];
  14335. 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);
  14336. properties = {
  14337. type,
  14338. name: baseFontName,
  14339. loadedName: baseDict.loadedName,
  14340. widths: metrics.widths,
  14341. defaultWidth: metrics.defaultWidth,
  14342. isSimulatedFlags: true,
  14343. flags,
  14344. firstChar,
  14345. lastChar,
  14346. toUnicode,
  14347. xHeight: 0,
  14348. capHeight: 0,
  14349. italicAngle: 0,
  14350. isType3Font
  14351. };
  14352. const widths = dict.get("Widths");
  14353. const standardFontName = (0, _standard_fonts.getStandardFontName)(baseFontName);
  14354. let file = null;
  14355. if (standardFontName) {
  14356. properties.isStandardFont = true;
  14357. file = await this.fetchStandardFontData(standardFontName);
  14358. properties.isInternalFont = !!file;
  14359. }
  14360. return this.extractDataStructures(dict, dict, properties).then(newProperties => {
  14361. if (widths) {
  14362. const glyphWidths = [];
  14363. let j = firstChar;
  14364. for (const width of widths) {
  14365. glyphWidths[j++] = this.xref.fetchIfRef(width);
  14366. }
  14367. newProperties.widths = glyphWidths;
  14368. } else {
  14369. newProperties.widths = this.buildCharCodeToWidth(metrics.widths, newProperties);
  14370. }
  14371. return new _fonts.Font(baseFontName, file, newProperties);
  14372. });
  14373. }
  14374. }
  14375. let fontName = descriptor.get("FontName");
  14376. let baseFont = dict.get("BaseFont");
  14377. if (typeof fontName === "string") {
  14378. fontName = _primitives.Name.get(fontName);
  14379. }
  14380. if (typeof baseFont === "string") {
  14381. baseFont = _primitives.Name.get(baseFont);
  14382. }
  14383. if (!isType3Font) {
  14384. const fontNameStr = fontName && fontName.name;
  14385. const baseFontStr = baseFont && baseFont.name;
  14386. if (fontNameStr !== baseFontStr) {
  14387. (0, _util.info)(`The FontDescriptor's FontName is "${fontNameStr}" but ` + `should be the same as the Font's BaseFont "${baseFontStr}".`);
  14388. if (fontNameStr && baseFontStr && baseFontStr.startsWith(fontNameStr)) {
  14389. fontName = baseFont;
  14390. }
  14391. }
  14392. }
  14393. fontName = fontName || baseFont;
  14394. if (!(fontName instanceof _primitives.Name)) {
  14395. throw new _util.FormatError("invalid font name");
  14396. }
  14397. let fontFile, subtype, length1, length2, length3;
  14398. try {
  14399. fontFile = descriptor.get("FontFile", "FontFile2", "FontFile3");
  14400. } catch (ex) {
  14401. if (!this.options.ignoreErrors) {
  14402. throw ex;
  14403. }
  14404. (0, _util.warn)(`translateFont - fetching "${fontName.name}" font file: "${ex}".`);
  14405. fontFile = new _stream.NullStream();
  14406. }
  14407. let isStandardFont = false;
  14408. let isInternalFont = false;
  14409. let glyphScaleFactors = null;
  14410. if (fontFile) {
  14411. if (fontFile.dict) {
  14412. const subtypeEntry = fontFile.dict.get("Subtype");
  14413. if (subtypeEntry instanceof _primitives.Name) {
  14414. subtype = subtypeEntry.name;
  14415. }
  14416. length1 = fontFile.dict.get("Length1");
  14417. length2 = fontFile.dict.get("Length2");
  14418. length3 = fontFile.dict.get("Length3");
  14419. }
  14420. } else if (cssFontInfo) {
  14421. const standardFontName = (0, _xfa_fonts.getXfaFontName)(fontName.name);
  14422. if (standardFontName) {
  14423. cssFontInfo.fontFamily = `${cssFontInfo.fontFamily}-PdfJS-XFA`;
  14424. cssFontInfo.metrics = standardFontName.metrics || null;
  14425. glyphScaleFactors = standardFontName.factors || null;
  14426. fontFile = await this.fetchStandardFontData(standardFontName.name);
  14427. isInternalFont = !!fontFile;
  14428. baseDict = dict = (0, _xfa_fonts.getXfaFontDict)(fontName.name);
  14429. composite = true;
  14430. }
  14431. } else if (!isType3Font) {
  14432. const standardFontName = (0, _standard_fonts.getStandardFontName)(fontName.name);
  14433. if (standardFontName) {
  14434. isStandardFont = true;
  14435. fontFile = await this.fetchStandardFontData(standardFontName);
  14436. isInternalFont = !!fontFile;
  14437. }
  14438. }
  14439. properties = {
  14440. type,
  14441. name: fontName.name,
  14442. subtype,
  14443. file: fontFile,
  14444. length1,
  14445. length2,
  14446. length3,
  14447. isStandardFont,
  14448. isInternalFont,
  14449. loadedName: baseDict.loadedName,
  14450. composite,
  14451. fixedPitch: false,
  14452. fontMatrix: dict.getArray("FontMatrix") || _util.FONT_IDENTITY_MATRIX,
  14453. firstChar,
  14454. lastChar,
  14455. toUnicode,
  14456. bbox: descriptor.getArray("FontBBox") || dict.getArray("FontBBox"),
  14457. ascent: descriptor.get("Ascent"),
  14458. descent: descriptor.get("Descent"),
  14459. xHeight: descriptor.get("XHeight") || 0,
  14460. capHeight: descriptor.get("CapHeight") || 0,
  14461. flags: descriptor.get("Flags"),
  14462. italicAngle: descriptor.get("ItalicAngle") || 0,
  14463. isType3Font,
  14464. cssFontInfo,
  14465. scaleFactors: glyphScaleFactors
  14466. };
  14467. if (composite) {
  14468. const cidEncoding = baseDict.get("Encoding");
  14469. if (cidEncoding instanceof _primitives.Name) {
  14470. properties.cidEncoding = cidEncoding.name;
  14471. }
  14472. const cMap = await _cmap.CMapFactory.create({
  14473. encoding: cidEncoding,
  14474. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  14475. useCMap: null
  14476. });
  14477. properties.cMap = cMap;
  14478. properties.vertical = properties.cMap.vertical;
  14479. }
  14480. return this.extractDataStructures(dict, baseDict, properties).then(newProperties => {
  14481. this.extractWidths(dict, descriptor, newProperties);
  14482. return new _fonts.Font(fontName.name, fontFile, newProperties);
  14483. });
  14484. }
  14485. static buildFontPaths(font, glyphs, handler, evaluatorOptions) {
  14486. function buildPath(fontChar) {
  14487. const glyphName = `${font.loadedName}_path_${fontChar}`;
  14488. try {
  14489. if (font.renderer.hasBuiltPath(fontChar)) {
  14490. return;
  14491. }
  14492. handler.send("commonobj", [glyphName, "FontPath", font.renderer.getPathJs(fontChar)]);
  14493. } catch (reason) {
  14494. if (evaluatorOptions.ignoreErrors) {
  14495. handler.send("UnsupportedFeature", {
  14496. featureId: _util.UNSUPPORTED_FEATURES.errorFontBuildPath
  14497. });
  14498. (0, _util.warn)(`buildFontPaths - ignoring ${glyphName} glyph: "${reason}".`);
  14499. return;
  14500. }
  14501. throw reason;
  14502. }
  14503. }
  14504. for (const glyph of glyphs) {
  14505. buildPath(glyph.fontChar);
  14506. const accent = glyph.accent;
  14507. if (accent && accent.fontChar) {
  14508. buildPath(accent.fontChar);
  14509. }
  14510. }
  14511. }
  14512. static get fallbackFontDict() {
  14513. const dict = new _primitives.Dict();
  14514. dict.set("BaseFont", _primitives.Name.get("PDFJS-FallbackFont"));
  14515. dict.set("Type", _primitives.Name.get("FallbackType"));
  14516. dict.set("Subtype", _primitives.Name.get("FallbackType"));
  14517. dict.set("Encoding", _primitives.Name.get("WinAnsiEncoding"));
  14518. return (0, _util.shadow)(this, "fallbackFontDict", dict);
  14519. }
  14520. }
  14521. exports.PartialEvaluator = PartialEvaluator;
  14522. class TranslatedFont {
  14523. constructor(_ref10) {
  14524. let {
  14525. loadedName,
  14526. font,
  14527. dict,
  14528. evaluatorOptions
  14529. } = _ref10;
  14530. this.loadedName = loadedName;
  14531. this.font = font;
  14532. this.dict = dict;
  14533. this._evaluatorOptions = evaluatorOptions || DefaultPartialEvaluatorOptions;
  14534. this.type3Loaded = null;
  14535. this.type3Dependencies = font.isType3Font ? new Set() : null;
  14536. this.sent = false;
  14537. }
  14538. send(handler) {
  14539. if (this.sent) {
  14540. return;
  14541. }
  14542. this.sent = true;
  14543. handler.send("commonobj", [this.loadedName, "Font", this.font.exportData(this._evaluatorOptions.fontExtraProperties)]);
  14544. }
  14545. fallback(handler) {
  14546. if (!this.font.data) {
  14547. return;
  14548. }
  14549. this.font.disableFontFace = true;
  14550. PartialEvaluator.buildFontPaths(this.font, this.font.glyphCacheValues, handler, this._evaluatorOptions);
  14551. }
  14552. loadType3Data(evaluator, resources, task) {
  14553. if (this.type3Loaded) {
  14554. return this.type3Loaded;
  14555. }
  14556. if (!this.font.isType3Font) {
  14557. throw new Error("Must be a Type3 font.");
  14558. }
  14559. const type3Evaluator = evaluator.clone({
  14560. ignoreErrors: false
  14561. });
  14562. type3Evaluator.parsingType3Font = true;
  14563. const type3FontRefs = new _primitives.RefSet(evaluator.type3FontRefs);
  14564. if (this.dict.objId && !type3FontRefs.has(this.dict.objId)) {
  14565. type3FontRefs.put(this.dict.objId);
  14566. }
  14567. type3Evaluator.type3FontRefs = type3FontRefs;
  14568. const translatedFont = this.font,
  14569. type3Dependencies = this.type3Dependencies;
  14570. let loadCharProcsPromise = Promise.resolve();
  14571. const charProcs = this.dict.get("CharProcs");
  14572. const fontResources = this.dict.get("Resources") || resources;
  14573. const charProcOperatorList = Object.create(null);
  14574. const fontBBox = _util.Util.normalizeRect(translatedFont.bbox || [0, 0, 0, 0]),
  14575. width = fontBBox[2] - fontBBox[0],
  14576. height = fontBBox[3] - fontBBox[1];
  14577. const fontBBoxSize = Math.hypot(width, height);
  14578. for (const key of charProcs.getKeys()) {
  14579. loadCharProcsPromise = loadCharProcsPromise.then(() => {
  14580. const glyphStream = charProcs.get(key);
  14581. const operatorList = new _operator_list.OperatorList();
  14582. return type3Evaluator.getOperatorList({
  14583. stream: glyphStream,
  14584. task,
  14585. resources: fontResources,
  14586. operatorList
  14587. }).then(() => {
  14588. if (operatorList.fnArray[0] === _util.OPS.setCharWidthAndBounds) {
  14589. this._removeType3ColorOperators(operatorList, fontBBoxSize);
  14590. }
  14591. charProcOperatorList[key] = operatorList.getIR();
  14592. for (const dependency of operatorList.dependencies) {
  14593. type3Dependencies.add(dependency);
  14594. }
  14595. }).catch(function (reason) {
  14596. (0, _util.warn)(`Type3 font resource "${key}" is not available.`);
  14597. const dummyOperatorList = new _operator_list.OperatorList();
  14598. charProcOperatorList[key] = dummyOperatorList.getIR();
  14599. });
  14600. });
  14601. }
  14602. this.type3Loaded = loadCharProcsPromise.then(() => {
  14603. translatedFont.charProcOperatorList = charProcOperatorList;
  14604. if (this._bbox) {
  14605. translatedFont.isCharBBox = true;
  14606. translatedFont.bbox = this._bbox;
  14607. }
  14608. });
  14609. return this.type3Loaded;
  14610. }
  14611. _removeType3ColorOperators(operatorList) {
  14612. let fontBBoxSize = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : NaN;
  14613. const charBBox = _util.Util.normalizeRect(operatorList.argsArray[0].slice(2)),
  14614. width = charBBox[2] - charBBox[0],
  14615. height = charBBox[3] - charBBox[1];
  14616. const charBBoxSize = Math.hypot(width, height);
  14617. if (width === 0 || height === 0) {
  14618. operatorList.fnArray.splice(0, 1);
  14619. operatorList.argsArray.splice(0, 1);
  14620. } else if (fontBBoxSize === 0 || Math.round(charBBoxSize / fontBBoxSize) >= 10) {
  14621. if (!this._bbox) {
  14622. this._bbox = [Infinity, Infinity, -Infinity, -Infinity];
  14623. }
  14624. this._bbox[0] = Math.min(this._bbox[0], charBBox[0]);
  14625. this._bbox[1] = Math.min(this._bbox[1], charBBox[1]);
  14626. this._bbox[2] = Math.max(this._bbox[2], charBBox[2]);
  14627. this._bbox[3] = Math.max(this._bbox[3], charBBox[3]);
  14628. }
  14629. let i = 0,
  14630. ii = operatorList.length;
  14631. while (i < ii) {
  14632. switch (operatorList.fnArray[i]) {
  14633. case _util.OPS.setCharWidthAndBounds:
  14634. break;
  14635. case _util.OPS.setStrokeColorSpace:
  14636. case _util.OPS.setFillColorSpace:
  14637. case _util.OPS.setStrokeColor:
  14638. case _util.OPS.setStrokeColorN:
  14639. case _util.OPS.setFillColor:
  14640. case _util.OPS.setFillColorN:
  14641. case _util.OPS.setStrokeGray:
  14642. case _util.OPS.setFillGray:
  14643. case _util.OPS.setStrokeRGBColor:
  14644. case _util.OPS.setFillRGBColor:
  14645. case _util.OPS.setStrokeCMYKColor:
  14646. case _util.OPS.setFillCMYKColor:
  14647. case _util.OPS.shadingFill:
  14648. case _util.OPS.setRenderingIntent:
  14649. operatorList.fnArray.splice(i, 1);
  14650. operatorList.argsArray.splice(i, 1);
  14651. ii--;
  14652. continue;
  14653. case _util.OPS.setGState:
  14654. const [gStateObj] = operatorList.argsArray[i];
  14655. let j = 0,
  14656. jj = gStateObj.length;
  14657. while (j < jj) {
  14658. const [gStateKey] = gStateObj[j];
  14659. switch (gStateKey) {
  14660. case "TR":
  14661. case "TR2":
  14662. case "HT":
  14663. case "BG":
  14664. case "BG2":
  14665. case "UCR":
  14666. case "UCR2":
  14667. gStateObj.splice(j, 1);
  14668. jj--;
  14669. continue;
  14670. }
  14671. j++;
  14672. }
  14673. break;
  14674. }
  14675. i++;
  14676. }
  14677. }
  14678. }
  14679. class StateManager {
  14680. constructor() {
  14681. let initialState = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new EvalState();
  14682. this.state = initialState;
  14683. this.stateStack = [];
  14684. }
  14685. save() {
  14686. const old = this.state;
  14687. this.stateStack.push(this.state);
  14688. this.state = old.clone();
  14689. }
  14690. restore() {
  14691. const prev = this.stateStack.pop();
  14692. if (prev) {
  14693. this.state = prev;
  14694. }
  14695. }
  14696. transform(args) {
  14697. this.state.ctm = _util.Util.transform(this.state.ctm, args);
  14698. }
  14699. }
  14700. class TextState {
  14701. constructor() {
  14702. this.ctm = new Float32Array(_util.IDENTITY_MATRIX);
  14703. this.fontName = null;
  14704. this.fontSize = 0;
  14705. this.loadedName = null;
  14706. this.font = null;
  14707. this.fontMatrix = _util.FONT_IDENTITY_MATRIX;
  14708. this.textMatrix = _util.IDENTITY_MATRIX.slice();
  14709. this.textLineMatrix = _util.IDENTITY_MATRIX.slice();
  14710. this.charSpacing = 0;
  14711. this.wordSpacing = 0;
  14712. this.leading = 0;
  14713. this.textHScale = 1;
  14714. this.textRise = 0;
  14715. }
  14716. setTextMatrix(a, b, c, d, e, f) {
  14717. const m = this.textMatrix;
  14718. m[0] = a;
  14719. m[1] = b;
  14720. m[2] = c;
  14721. m[3] = d;
  14722. m[4] = e;
  14723. m[5] = f;
  14724. }
  14725. setTextLineMatrix(a, b, c, d, e, f) {
  14726. const m = this.textLineMatrix;
  14727. m[0] = a;
  14728. m[1] = b;
  14729. m[2] = c;
  14730. m[3] = d;
  14731. m[4] = e;
  14732. m[5] = f;
  14733. }
  14734. translateTextMatrix(x, y) {
  14735. const m = this.textMatrix;
  14736. m[4] = m[0] * x + m[2] * y + m[4];
  14737. m[5] = m[1] * x + m[3] * y + m[5];
  14738. }
  14739. translateTextLineMatrix(x, y) {
  14740. const m = this.textLineMatrix;
  14741. m[4] = m[0] * x + m[2] * y + m[4];
  14742. m[5] = m[1] * x + m[3] * y + m[5];
  14743. }
  14744. carriageReturn() {
  14745. this.translateTextLineMatrix(0, -this.leading);
  14746. this.textMatrix = this.textLineMatrix.slice();
  14747. }
  14748. clone() {
  14749. const clone = Object.create(this);
  14750. clone.textMatrix = this.textMatrix.slice();
  14751. clone.textLineMatrix = this.textLineMatrix.slice();
  14752. clone.fontMatrix = this.fontMatrix.slice();
  14753. return clone;
  14754. }
  14755. }
  14756. class EvalState {
  14757. constructor() {
  14758. this.ctm = new Float32Array(_util.IDENTITY_MATRIX);
  14759. this.font = null;
  14760. this.textRenderingMode = _util.TextRenderingMode.FILL;
  14761. this.fillColorSpace = _colorspace.ColorSpace.singletons.gray;
  14762. this.strokeColorSpace = _colorspace.ColorSpace.singletons.gray;
  14763. }
  14764. clone() {
  14765. return Object.create(this);
  14766. }
  14767. }
  14768. class EvaluatorPreprocessor {
  14769. static get opMap() {
  14770. const getOPMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  14771. t.w = {
  14772. id: _util.OPS.setLineWidth,
  14773. numArgs: 1,
  14774. variableArgs: false
  14775. };
  14776. t.J = {
  14777. id: _util.OPS.setLineCap,
  14778. numArgs: 1,
  14779. variableArgs: false
  14780. };
  14781. t.j = {
  14782. id: _util.OPS.setLineJoin,
  14783. numArgs: 1,
  14784. variableArgs: false
  14785. };
  14786. t.M = {
  14787. id: _util.OPS.setMiterLimit,
  14788. numArgs: 1,
  14789. variableArgs: false
  14790. };
  14791. t.d = {
  14792. id: _util.OPS.setDash,
  14793. numArgs: 2,
  14794. variableArgs: false
  14795. };
  14796. t.ri = {
  14797. id: _util.OPS.setRenderingIntent,
  14798. numArgs: 1,
  14799. variableArgs: false
  14800. };
  14801. t.i = {
  14802. id: _util.OPS.setFlatness,
  14803. numArgs: 1,
  14804. variableArgs: false
  14805. };
  14806. t.gs = {
  14807. id: _util.OPS.setGState,
  14808. numArgs: 1,
  14809. variableArgs: false
  14810. };
  14811. t.q = {
  14812. id: _util.OPS.save,
  14813. numArgs: 0,
  14814. variableArgs: false
  14815. };
  14816. t.Q = {
  14817. id: _util.OPS.restore,
  14818. numArgs: 0,
  14819. variableArgs: false
  14820. };
  14821. t.cm = {
  14822. id: _util.OPS.transform,
  14823. numArgs: 6,
  14824. variableArgs: false
  14825. };
  14826. t.m = {
  14827. id: _util.OPS.moveTo,
  14828. numArgs: 2,
  14829. variableArgs: false
  14830. };
  14831. t.l = {
  14832. id: _util.OPS.lineTo,
  14833. numArgs: 2,
  14834. variableArgs: false
  14835. };
  14836. t.c = {
  14837. id: _util.OPS.curveTo,
  14838. numArgs: 6,
  14839. variableArgs: false
  14840. };
  14841. t.v = {
  14842. id: _util.OPS.curveTo2,
  14843. numArgs: 4,
  14844. variableArgs: false
  14845. };
  14846. t.y = {
  14847. id: _util.OPS.curveTo3,
  14848. numArgs: 4,
  14849. variableArgs: false
  14850. };
  14851. t.h = {
  14852. id: _util.OPS.closePath,
  14853. numArgs: 0,
  14854. variableArgs: false
  14855. };
  14856. t.re = {
  14857. id: _util.OPS.rectangle,
  14858. numArgs: 4,
  14859. variableArgs: false
  14860. };
  14861. t.S = {
  14862. id: _util.OPS.stroke,
  14863. numArgs: 0,
  14864. variableArgs: false
  14865. };
  14866. t.s = {
  14867. id: _util.OPS.closeStroke,
  14868. numArgs: 0,
  14869. variableArgs: false
  14870. };
  14871. t.f = {
  14872. id: _util.OPS.fill,
  14873. numArgs: 0,
  14874. variableArgs: false
  14875. };
  14876. t.F = {
  14877. id: _util.OPS.fill,
  14878. numArgs: 0,
  14879. variableArgs: false
  14880. };
  14881. t["f*"] = {
  14882. id: _util.OPS.eoFill,
  14883. numArgs: 0,
  14884. variableArgs: false
  14885. };
  14886. t.B = {
  14887. id: _util.OPS.fillStroke,
  14888. numArgs: 0,
  14889. variableArgs: false
  14890. };
  14891. t["B*"] = {
  14892. id: _util.OPS.eoFillStroke,
  14893. numArgs: 0,
  14894. variableArgs: false
  14895. };
  14896. t.b = {
  14897. id: _util.OPS.closeFillStroke,
  14898. numArgs: 0,
  14899. variableArgs: false
  14900. };
  14901. t["b*"] = {
  14902. id: _util.OPS.closeEOFillStroke,
  14903. numArgs: 0,
  14904. variableArgs: false
  14905. };
  14906. t.n = {
  14907. id: _util.OPS.endPath,
  14908. numArgs: 0,
  14909. variableArgs: false
  14910. };
  14911. t.W = {
  14912. id: _util.OPS.clip,
  14913. numArgs: 0,
  14914. variableArgs: false
  14915. };
  14916. t["W*"] = {
  14917. id: _util.OPS.eoClip,
  14918. numArgs: 0,
  14919. variableArgs: false
  14920. };
  14921. t.BT = {
  14922. id: _util.OPS.beginText,
  14923. numArgs: 0,
  14924. variableArgs: false
  14925. };
  14926. t.ET = {
  14927. id: _util.OPS.endText,
  14928. numArgs: 0,
  14929. variableArgs: false
  14930. };
  14931. t.Tc = {
  14932. id: _util.OPS.setCharSpacing,
  14933. numArgs: 1,
  14934. variableArgs: false
  14935. };
  14936. t.Tw = {
  14937. id: _util.OPS.setWordSpacing,
  14938. numArgs: 1,
  14939. variableArgs: false
  14940. };
  14941. t.Tz = {
  14942. id: _util.OPS.setHScale,
  14943. numArgs: 1,
  14944. variableArgs: false
  14945. };
  14946. t.TL = {
  14947. id: _util.OPS.setLeading,
  14948. numArgs: 1,
  14949. variableArgs: false
  14950. };
  14951. t.Tf = {
  14952. id: _util.OPS.setFont,
  14953. numArgs: 2,
  14954. variableArgs: false
  14955. };
  14956. t.Tr = {
  14957. id: _util.OPS.setTextRenderingMode,
  14958. numArgs: 1,
  14959. variableArgs: false
  14960. };
  14961. t.Ts = {
  14962. id: _util.OPS.setTextRise,
  14963. numArgs: 1,
  14964. variableArgs: false
  14965. };
  14966. t.Td = {
  14967. id: _util.OPS.moveText,
  14968. numArgs: 2,
  14969. variableArgs: false
  14970. };
  14971. t.TD = {
  14972. id: _util.OPS.setLeadingMoveText,
  14973. numArgs: 2,
  14974. variableArgs: false
  14975. };
  14976. t.Tm = {
  14977. id: _util.OPS.setTextMatrix,
  14978. numArgs: 6,
  14979. variableArgs: false
  14980. };
  14981. t["T*"] = {
  14982. id: _util.OPS.nextLine,
  14983. numArgs: 0,
  14984. variableArgs: false
  14985. };
  14986. t.Tj = {
  14987. id: _util.OPS.showText,
  14988. numArgs: 1,
  14989. variableArgs: false
  14990. };
  14991. t.TJ = {
  14992. id: _util.OPS.showSpacedText,
  14993. numArgs: 1,
  14994. variableArgs: false
  14995. };
  14996. t["'"] = {
  14997. id: _util.OPS.nextLineShowText,
  14998. numArgs: 1,
  14999. variableArgs: false
  15000. };
  15001. t['"'] = {
  15002. id: _util.OPS.nextLineSetSpacingShowText,
  15003. numArgs: 3,
  15004. variableArgs: false
  15005. };
  15006. t.d0 = {
  15007. id: _util.OPS.setCharWidth,
  15008. numArgs: 2,
  15009. variableArgs: false
  15010. };
  15011. t.d1 = {
  15012. id: _util.OPS.setCharWidthAndBounds,
  15013. numArgs: 6,
  15014. variableArgs: false
  15015. };
  15016. t.CS = {
  15017. id: _util.OPS.setStrokeColorSpace,
  15018. numArgs: 1,
  15019. variableArgs: false
  15020. };
  15021. t.cs = {
  15022. id: _util.OPS.setFillColorSpace,
  15023. numArgs: 1,
  15024. variableArgs: false
  15025. };
  15026. t.SC = {
  15027. id: _util.OPS.setStrokeColor,
  15028. numArgs: 4,
  15029. variableArgs: true
  15030. };
  15031. t.SCN = {
  15032. id: _util.OPS.setStrokeColorN,
  15033. numArgs: 33,
  15034. variableArgs: true
  15035. };
  15036. t.sc = {
  15037. id: _util.OPS.setFillColor,
  15038. numArgs: 4,
  15039. variableArgs: true
  15040. };
  15041. t.scn = {
  15042. id: _util.OPS.setFillColorN,
  15043. numArgs: 33,
  15044. variableArgs: true
  15045. };
  15046. t.G = {
  15047. id: _util.OPS.setStrokeGray,
  15048. numArgs: 1,
  15049. variableArgs: false
  15050. };
  15051. t.g = {
  15052. id: _util.OPS.setFillGray,
  15053. numArgs: 1,
  15054. variableArgs: false
  15055. };
  15056. t.RG = {
  15057. id: _util.OPS.setStrokeRGBColor,
  15058. numArgs: 3,
  15059. variableArgs: false
  15060. };
  15061. t.rg = {
  15062. id: _util.OPS.setFillRGBColor,
  15063. numArgs: 3,
  15064. variableArgs: false
  15065. };
  15066. t.K = {
  15067. id: _util.OPS.setStrokeCMYKColor,
  15068. numArgs: 4,
  15069. variableArgs: false
  15070. };
  15071. t.k = {
  15072. id: _util.OPS.setFillCMYKColor,
  15073. numArgs: 4,
  15074. variableArgs: false
  15075. };
  15076. t.sh = {
  15077. id: _util.OPS.shadingFill,
  15078. numArgs: 1,
  15079. variableArgs: false
  15080. };
  15081. t.BI = {
  15082. id: _util.OPS.beginInlineImage,
  15083. numArgs: 0,
  15084. variableArgs: false
  15085. };
  15086. t.ID = {
  15087. id: _util.OPS.beginImageData,
  15088. numArgs: 0,
  15089. variableArgs: false
  15090. };
  15091. t.EI = {
  15092. id: _util.OPS.endInlineImage,
  15093. numArgs: 1,
  15094. variableArgs: false
  15095. };
  15096. t.Do = {
  15097. id: _util.OPS.paintXObject,
  15098. numArgs: 1,
  15099. variableArgs: false
  15100. };
  15101. t.MP = {
  15102. id: _util.OPS.markPoint,
  15103. numArgs: 1,
  15104. variableArgs: false
  15105. };
  15106. t.DP = {
  15107. id: _util.OPS.markPointProps,
  15108. numArgs: 2,
  15109. variableArgs: false
  15110. };
  15111. t.BMC = {
  15112. id: _util.OPS.beginMarkedContent,
  15113. numArgs: 1,
  15114. variableArgs: false
  15115. };
  15116. t.BDC = {
  15117. id: _util.OPS.beginMarkedContentProps,
  15118. numArgs: 2,
  15119. variableArgs: false
  15120. };
  15121. t.EMC = {
  15122. id: _util.OPS.endMarkedContent,
  15123. numArgs: 0,
  15124. variableArgs: false
  15125. };
  15126. t.BX = {
  15127. id: _util.OPS.beginCompat,
  15128. numArgs: 0,
  15129. variableArgs: false
  15130. };
  15131. t.EX = {
  15132. id: _util.OPS.endCompat,
  15133. numArgs: 0,
  15134. variableArgs: false
  15135. };
  15136. t.BM = null;
  15137. t.BD = null;
  15138. t.true = null;
  15139. t.fa = null;
  15140. t.fal = null;
  15141. t.fals = null;
  15142. t.false = null;
  15143. t.nu = null;
  15144. t.nul = null;
  15145. t.null = null;
  15146. });
  15147. return (0, _util.shadow)(this, "opMap", getOPMap());
  15148. }
  15149. static get MAX_INVALID_PATH_OPS() {
  15150. return (0, _util.shadow)(this, "MAX_INVALID_PATH_OPS", 10);
  15151. }
  15152. constructor(stream, xref) {
  15153. let stateManager = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : new StateManager();
  15154. this.parser = new _parser.Parser({
  15155. lexer: new _parser.Lexer(stream, EvaluatorPreprocessor.opMap),
  15156. xref
  15157. });
  15158. this.stateManager = stateManager;
  15159. this.nonProcessedArgs = [];
  15160. this._isPathOp = false;
  15161. this._numInvalidPathOPS = 0;
  15162. }
  15163. get savedStatesDepth() {
  15164. return this.stateManager.stateStack.length;
  15165. }
  15166. read(operation) {
  15167. let args = operation.args;
  15168. while (true) {
  15169. const obj = this.parser.getObj();
  15170. if (obj instanceof _primitives.Cmd) {
  15171. const cmd = obj.cmd;
  15172. const opSpec = EvaluatorPreprocessor.opMap[cmd];
  15173. if (!opSpec) {
  15174. (0, _util.warn)(`Unknown command "${cmd}".`);
  15175. continue;
  15176. }
  15177. const fn = opSpec.id;
  15178. const numArgs = opSpec.numArgs;
  15179. let argsLength = args !== null ? args.length : 0;
  15180. if (!this._isPathOp) {
  15181. this._numInvalidPathOPS = 0;
  15182. }
  15183. this._isPathOp = fn >= _util.OPS.moveTo && fn <= _util.OPS.endPath;
  15184. if (!opSpec.variableArgs) {
  15185. if (argsLength !== numArgs) {
  15186. const nonProcessedArgs = this.nonProcessedArgs;
  15187. while (argsLength > numArgs) {
  15188. nonProcessedArgs.push(args.shift());
  15189. argsLength--;
  15190. }
  15191. while (argsLength < numArgs && nonProcessedArgs.length !== 0) {
  15192. if (args === null) {
  15193. args = [];
  15194. }
  15195. args.unshift(nonProcessedArgs.pop());
  15196. argsLength++;
  15197. }
  15198. }
  15199. if (argsLength < numArgs) {
  15200. const partialMsg = `command ${cmd}: expected ${numArgs} args, ` + `but received ${argsLength} args.`;
  15201. if (this._isPathOp && ++this._numInvalidPathOPS > EvaluatorPreprocessor.MAX_INVALID_PATH_OPS) {
  15202. throw new _util.FormatError(`Invalid ${partialMsg}`);
  15203. }
  15204. (0, _util.warn)(`Skipping ${partialMsg}`);
  15205. if (args !== null) {
  15206. args.length = 0;
  15207. }
  15208. continue;
  15209. }
  15210. } else if (argsLength > numArgs) {
  15211. (0, _util.info)(`Command ${cmd}: expected [0, ${numArgs}] args, ` + `but received ${argsLength} args.`);
  15212. }
  15213. this.preprocessCommand(fn, args);
  15214. operation.fn = fn;
  15215. operation.args = args;
  15216. return true;
  15217. }
  15218. if (obj === _primitives.EOF) {
  15219. return false;
  15220. }
  15221. if (obj !== null) {
  15222. if (args === null) {
  15223. args = [];
  15224. }
  15225. args.push(obj);
  15226. if (args.length > 33) {
  15227. throw new _util.FormatError("Too many arguments");
  15228. }
  15229. }
  15230. }
  15231. }
  15232. preprocessCommand(fn, args) {
  15233. switch (fn | 0) {
  15234. case _util.OPS.save:
  15235. this.stateManager.save();
  15236. break;
  15237. case _util.OPS.restore:
  15238. this.stateManager.restore();
  15239. break;
  15240. case _util.OPS.transform:
  15241. this.stateManager.transform(args);
  15242. break;
  15243. }
  15244. }
  15245. }
  15246. exports.EvaluatorPreprocessor = EvaluatorPreprocessor;
  15247. /***/ }),
  15248. /* 145 */
  15249. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  15250. "use strict";
  15251. Object.defineProperty(exports, "__esModule", ({
  15252. value: true
  15253. }));
  15254. exports.IdentityCMap = exports.CMapFactory = exports.CMap = void 0;
  15255. var _util = __w_pdfjs_require__(2);
  15256. var _primitives = __w_pdfjs_require__(134);
  15257. var _base_stream = __w_pdfjs_require__(136);
  15258. var _parser = __w_pdfjs_require__(146);
  15259. var _core_utils = __w_pdfjs_require__(135);
  15260. var _stream = __w_pdfjs_require__(139);
  15261. 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"];
  15262. const MAX_MAP_RANGE = 2 ** 24 - 1;
  15263. class CMap {
  15264. constructor() {
  15265. let builtInCMap = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  15266. this.codespaceRanges = [[], [], [], []];
  15267. this.numCodespaceRanges = 0;
  15268. this._map = [];
  15269. this.name = "";
  15270. this.vertical = false;
  15271. this.useCMap = null;
  15272. this.builtInCMap = builtInCMap;
  15273. }
  15274. addCodespaceRange(n, low, high) {
  15275. this.codespaceRanges[n - 1].push(low, high);
  15276. this.numCodespaceRanges++;
  15277. }
  15278. mapCidRange(low, high, dstLow) {
  15279. if (high - low > MAX_MAP_RANGE) {
  15280. throw new Error("mapCidRange - ignoring data above MAX_MAP_RANGE.");
  15281. }
  15282. while (low <= high) {
  15283. this._map[low++] = dstLow++;
  15284. }
  15285. }
  15286. mapBfRange(low, high, dstLow) {
  15287. if (high - low > MAX_MAP_RANGE) {
  15288. throw new Error("mapBfRange - ignoring data above MAX_MAP_RANGE.");
  15289. }
  15290. const lastByte = dstLow.length - 1;
  15291. while (low <= high) {
  15292. this._map[low++] = dstLow;
  15293. const nextCharCode = dstLow.charCodeAt(lastByte) + 1;
  15294. if (nextCharCode > 0xff) {
  15295. dstLow = dstLow.substring(0, lastByte - 1) + String.fromCharCode(dstLow.charCodeAt(lastByte - 1) + 1) + "\x00";
  15296. continue;
  15297. }
  15298. dstLow = dstLow.substring(0, lastByte) + String.fromCharCode(nextCharCode);
  15299. }
  15300. }
  15301. mapBfRangeToArray(low, high, array) {
  15302. if (high - low > MAX_MAP_RANGE) {
  15303. throw new Error("mapBfRangeToArray - ignoring data above MAX_MAP_RANGE.");
  15304. }
  15305. const ii = array.length;
  15306. let i = 0;
  15307. while (low <= high && i < ii) {
  15308. this._map[low] = array[i++];
  15309. ++low;
  15310. }
  15311. }
  15312. mapOne(src, dst) {
  15313. this._map[src] = dst;
  15314. }
  15315. lookup(code) {
  15316. return this._map[code];
  15317. }
  15318. contains(code) {
  15319. return this._map[code] !== undefined;
  15320. }
  15321. forEach(callback) {
  15322. const map = this._map;
  15323. const length = map.length;
  15324. if (length <= 0x10000) {
  15325. for (let i = 0; i < length; i++) {
  15326. if (map[i] !== undefined) {
  15327. callback(i, map[i]);
  15328. }
  15329. }
  15330. } else {
  15331. for (const i in map) {
  15332. callback(i, map[i]);
  15333. }
  15334. }
  15335. }
  15336. charCodeOf(value) {
  15337. const map = this._map;
  15338. if (map.length <= 0x10000) {
  15339. return map.indexOf(value);
  15340. }
  15341. for (const charCode in map) {
  15342. if (map[charCode] === value) {
  15343. return charCode | 0;
  15344. }
  15345. }
  15346. return -1;
  15347. }
  15348. getMap() {
  15349. return this._map;
  15350. }
  15351. readCharCode(str, offset, out) {
  15352. let c = 0;
  15353. const codespaceRanges = this.codespaceRanges;
  15354. for (let n = 0, nn = codespaceRanges.length; n < nn; n++) {
  15355. c = (c << 8 | str.charCodeAt(offset + n)) >>> 0;
  15356. const codespaceRange = codespaceRanges[n];
  15357. for (let k = 0, kk = codespaceRange.length; k < kk;) {
  15358. const low = codespaceRange[k++];
  15359. const high = codespaceRange[k++];
  15360. if (c >= low && c <= high) {
  15361. out.charcode = c;
  15362. out.length = n + 1;
  15363. return;
  15364. }
  15365. }
  15366. }
  15367. out.charcode = 0;
  15368. out.length = 1;
  15369. }
  15370. getCharCodeLength(charCode) {
  15371. const codespaceRanges = this.codespaceRanges;
  15372. for (let n = 0, nn = codespaceRanges.length; n < nn; n++) {
  15373. const codespaceRange = codespaceRanges[n];
  15374. for (let k = 0, kk = codespaceRange.length; k < kk;) {
  15375. const low = codespaceRange[k++];
  15376. const high = codespaceRange[k++];
  15377. if (charCode >= low && charCode <= high) {
  15378. return n + 1;
  15379. }
  15380. }
  15381. }
  15382. return 1;
  15383. }
  15384. get length() {
  15385. return this._map.length;
  15386. }
  15387. get isIdentityCMap() {
  15388. if (!(this.name === "Identity-H" || this.name === "Identity-V")) {
  15389. return false;
  15390. }
  15391. if (this._map.length !== 0x10000) {
  15392. return false;
  15393. }
  15394. for (let i = 0; i < 0x10000; i++) {
  15395. if (this._map[i] !== i) {
  15396. return false;
  15397. }
  15398. }
  15399. return true;
  15400. }
  15401. }
  15402. exports.CMap = CMap;
  15403. class IdentityCMap extends CMap {
  15404. constructor(vertical, n) {
  15405. super();
  15406. this.vertical = vertical;
  15407. this.addCodespaceRange(n, 0, 0xffff);
  15408. }
  15409. mapCidRange(low, high, dstLow) {
  15410. (0, _util.unreachable)("should not call mapCidRange");
  15411. }
  15412. mapBfRange(low, high, dstLow) {
  15413. (0, _util.unreachable)("should not call mapBfRange");
  15414. }
  15415. mapBfRangeToArray(low, high, array) {
  15416. (0, _util.unreachable)("should not call mapBfRangeToArray");
  15417. }
  15418. mapOne(src, dst) {
  15419. (0, _util.unreachable)("should not call mapCidOne");
  15420. }
  15421. lookup(code) {
  15422. return Number.isInteger(code) && code <= 0xffff ? code : undefined;
  15423. }
  15424. contains(code) {
  15425. return Number.isInteger(code) && code <= 0xffff;
  15426. }
  15427. forEach(callback) {
  15428. for (let i = 0; i <= 0xffff; i++) {
  15429. callback(i, i);
  15430. }
  15431. }
  15432. charCodeOf(value) {
  15433. return Number.isInteger(value) && value <= 0xffff ? value : -1;
  15434. }
  15435. getMap() {
  15436. const map = new Array(0x10000);
  15437. for (let i = 0; i <= 0xffff; i++) {
  15438. map[i] = i;
  15439. }
  15440. return map;
  15441. }
  15442. get length() {
  15443. return 0x10000;
  15444. }
  15445. get isIdentityCMap() {
  15446. (0, _util.unreachable)("should not access .isIdentityCMap");
  15447. }
  15448. }
  15449. exports.IdentityCMap = IdentityCMap;
  15450. const BinaryCMapReader = function BinaryCMapReaderClosure() {
  15451. function hexToInt(a, size) {
  15452. let n = 0;
  15453. for (let i = 0; i <= size; i++) {
  15454. n = n << 8 | a[i];
  15455. }
  15456. return n >>> 0;
  15457. }
  15458. function hexToStr(a, size) {
  15459. if (size === 1) {
  15460. return String.fromCharCode(a[0], a[1]);
  15461. }
  15462. if (size === 3) {
  15463. return String.fromCharCode(a[0], a[1], a[2], a[3]);
  15464. }
  15465. return String.fromCharCode.apply(null, a.subarray(0, size + 1));
  15466. }
  15467. function addHex(a, b, size) {
  15468. let c = 0;
  15469. for (let i = size; i >= 0; i--) {
  15470. c += a[i] + b[i];
  15471. a[i] = c & 255;
  15472. c >>= 8;
  15473. }
  15474. }
  15475. function incHex(a, size) {
  15476. let c = 1;
  15477. for (let i = size; i >= 0 && c > 0; i--) {
  15478. c += a[i];
  15479. a[i] = c & 255;
  15480. c >>= 8;
  15481. }
  15482. }
  15483. const MAX_NUM_SIZE = 16;
  15484. const MAX_ENCODED_NUM_SIZE = 19;
  15485. class BinaryCMapStream {
  15486. constructor(data) {
  15487. this.buffer = data;
  15488. this.pos = 0;
  15489. this.end = data.length;
  15490. this.tmpBuf = new Uint8Array(MAX_ENCODED_NUM_SIZE);
  15491. }
  15492. readByte() {
  15493. if (this.pos >= this.end) {
  15494. return -1;
  15495. }
  15496. return this.buffer[this.pos++];
  15497. }
  15498. readNumber() {
  15499. let n = 0;
  15500. let last;
  15501. do {
  15502. const b = this.readByte();
  15503. if (b < 0) {
  15504. throw new _util.FormatError("unexpected EOF in bcmap");
  15505. }
  15506. last = !(b & 0x80);
  15507. n = n << 7 | b & 0x7f;
  15508. } while (!last);
  15509. return n;
  15510. }
  15511. readSigned() {
  15512. const n = this.readNumber();
  15513. return n & 1 ? ~(n >>> 1) : n >>> 1;
  15514. }
  15515. readHex(num, size) {
  15516. num.set(this.buffer.subarray(this.pos, this.pos + size + 1));
  15517. this.pos += size + 1;
  15518. }
  15519. readHexNumber(num, size) {
  15520. let last;
  15521. const stack = this.tmpBuf;
  15522. let sp = 0;
  15523. do {
  15524. const b = this.readByte();
  15525. if (b < 0) {
  15526. throw new _util.FormatError("unexpected EOF in bcmap");
  15527. }
  15528. last = !(b & 0x80);
  15529. stack[sp++] = b & 0x7f;
  15530. } while (!last);
  15531. let i = size,
  15532. buffer = 0,
  15533. bufferSize = 0;
  15534. while (i >= 0) {
  15535. while (bufferSize < 8 && stack.length > 0) {
  15536. buffer |= stack[--sp] << bufferSize;
  15537. bufferSize += 7;
  15538. }
  15539. num[i] = buffer & 255;
  15540. i--;
  15541. buffer >>= 8;
  15542. bufferSize -= 8;
  15543. }
  15544. }
  15545. readHexSigned(num, size) {
  15546. this.readHexNumber(num, size);
  15547. const sign = num[size] & 1 ? 255 : 0;
  15548. let c = 0;
  15549. for (let i = 0; i <= size; i++) {
  15550. c = (c & 1) << 8 | num[i];
  15551. num[i] = c >> 1 ^ sign;
  15552. }
  15553. }
  15554. readString() {
  15555. const len = this.readNumber();
  15556. let s = "";
  15557. for (let i = 0; i < len; i++) {
  15558. s += String.fromCharCode(this.readNumber());
  15559. }
  15560. return s;
  15561. }
  15562. }
  15563. class BinaryCMapReader {
  15564. async process(data, cMap, extend) {
  15565. const stream = new BinaryCMapStream(data);
  15566. const header = stream.readByte();
  15567. cMap.vertical = !!(header & 1);
  15568. let useCMap = null;
  15569. const start = new Uint8Array(MAX_NUM_SIZE);
  15570. const end = new Uint8Array(MAX_NUM_SIZE);
  15571. const char = new Uint8Array(MAX_NUM_SIZE);
  15572. const charCode = new Uint8Array(MAX_NUM_SIZE);
  15573. const tmp = new Uint8Array(MAX_NUM_SIZE);
  15574. let code;
  15575. let b;
  15576. while ((b = stream.readByte()) >= 0) {
  15577. const type = b >> 5;
  15578. if (type === 7) {
  15579. switch (b & 0x1f) {
  15580. case 0:
  15581. stream.readString();
  15582. break;
  15583. case 1:
  15584. useCMap = stream.readString();
  15585. break;
  15586. }
  15587. continue;
  15588. }
  15589. const sequence = !!(b & 0x10);
  15590. const dataSize = b & 15;
  15591. if (dataSize + 1 > MAX_NUM_SIZE) {
  15592. throw new Error("BinaryCMapReader.process: Invalid dataSize.");
  15593. }
  15594. const ucs2DataSize = 1;
  15595. const subitemsCount = stream.readNumber();
  15596. switch (type) {
  15597. case 0:
  15598. stream.readHex(start, dataSize);
  15599. stream.readHexNumber(end, dataSize);
  15600. addHex(end, start, dataSize);
  15601. cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
  15602. for (let i = 1; i < subitemsCount; i++) {
  15603. incHex(end, dataSize);
  15604. stream.readHexNumber(start, dataSize);
  15605. addHex(start, end, dataSize);
  15606. stream.readHexNumber(end, dataSize);
  15607. addHex(end, start, dataSize);
  15608. cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
  15609. }
  15610. break;
  15611. case 1:
  15612. stream.readHex(start, dataSize);
  15613. stream.readHexNumber(end, dataSize);
  15614. addHex(end, start, dataSize);
  15615. stream.readNumber();
  15616. for (let i = 1; i < subitemsCount; i++) {
  15617. incHex(end, dataSize);
  15618. stream.readHexNumber(start, dataSize);
  15619. addHex(start, end, dataSize);
  15620. stream.readHexNumber(end, dataSize);
  15621. addHex(end, start, dataSize);
  15622. stream.readNumber();
  15623. }
  15624. break;
  15625. case 2:
  15626. stream.readHex(char, dataSize);
  15627. code = stream.readNumber();
  15628. cMap.mapOne(hexToInt(char, dataSize), code);
  15629. for (let i = 1; i < subitemsCount; i++) {
  15630. incHex(char, dataSize);
  15631. if (!sequence) {
  15632. stream.readHexNumber(tmp, dataSize);
  15633. addHex(char, tmp, dataSize);
  15634. }
  15635. code = stream.readSigned() + (code + 1);
  15636. cMap.mapOne(hexToInt(char, dataSize), code);
  15637. }
  15638. break;
  15639. case 3:
  15640. stream.readHex(start, dataSize);
  15641. stream.readHexNumber(end, dataSize);
  15642. addHex(end, start, dataSize);
  15643. code = stream.readNumber();
  15644. cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
  15645. for (let i = 1; i < subitemsCount; i++) {
  15646. incHex(end, dataSize);
  15647. if (!sequence) {
  15648. stream.readHexNumber(start, dataSize);
  15649. addHex(start, end, dataSize);
  15650. } else {
  15651. start.set(end);
  15652. }
  15653. stream.readHexNumber(end, dataSize);
  15654. addHex(end, start, dataSize);
  15655. code = stream.readNumber();
  15656. cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
  15657. }
  15658. break;
  15659. case 4:
  15660. stream.readHex(char, ucs2DataSize);
  15661. stream.readHex(charCode, dataSize);
  15662. cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
  15663. for (let i = 1; i < subitemsCount; i++) {
  15664. incHex(char, ucs2DataSize);
  15665. if (!sequence) {
  15666. stream.readHexNumber(tmp, ucs2DataSize);
  15667. addHex(char, tmp, ucs2DataSize);
  15668. }
  15669. incHex(charCode, dataSize);
  15670. stream.readHexSigned(tmp, dataSize);
  15671. addHex(charCode, tmp, dataSize);
  15672. cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
  15673. }
  15674. break;
  15675. case 5:
  15676. stream.readHex(start, ucs2DataSize);
  15677. stream.readHexNumber(end, ucs2DataSize);
  15678. addHex(end, start, ucs2DataSize);
  15679. stream.readHex(charCode, dataSize);
  15680. cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
  15681. for (let i = 1; i < subitemsCount; i++) {
  15682. incHex(end, ucs2DataSize);
  15683. if (!sequence) {
  15684. stream.readHexNumber(start, ucs2DataSize);
  15685. addHex(start, end, ucs2DataSize);
  15686. } else {
  15687. start.set(end);
  15688. }
  15689. stream.readHexNumber(end, ucs2DataSize);
  15690. addHex(end, start, ucs2DataSize);
  15691. stream.readHex(charCode, dataSize);
  15692. cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
  15693. }
  15694. break;
  15695. default:
  15696. throw new Error(`BinaryCMapReader.process - unknown type: ${type}`);
  15697. }
  15698. }
  15699. if (useCMap) {
  15700. return extend(useCMap);
  15701. }
  15702. return cMap;
  15703. }
  15704. }
  15705. return BinaryCMapReader;
  15706. }();
  15707. const CMapFactory = function CMapFactoryClosure() {
  15708. function strToInt(str) {
  15709. let a = 0;
  15710. for (let i = 0; i < str.length; i++) {
  15711. a = a << 8 | str.charCodeAt(i);
  15712. }
  15713. return a >>> 0;
  15714. }
  15715. function expectString(obj) {
  15716. if (typeof obj !== "string") {
  15717. throw new _util.FormatError("Malformed CMap: expected string.");
  15718. }
  15719. }
  15720. function expectInt(obj) {
  15721. if (!Number.isInteger(obj)) {
  15722. throw new _util.FormatError("Malformed CMap: expected int.");
  15723. }
  15724. }
  15725. function parseBfChar(cMap, lexer) {
  15726. while (true) {
  15727. let obj = lexer.getObj();
  15728. if (obj === _primitives.EOF) {
  15729. break;
  15730. }
  15731. if ((0, _primitives.isCmd)(obj, "endbfchar")) {
  15732. return;
  15733. }
  15734. expectString(obj);
  15735. const src = strToInt(obj);
  15736. obj = lexer.getObj();
  15737. expectString(obj);
  15738. const dst = obj;
  15739. cMap.mapOne(src, dst);
  15740. }
  15741. }
  15742. function parseBfRange(cMap, lexer) {
  15743. while (true) {
  15744. let obj = lexer.getObj();
  15745. if (obj === _primitives.EOF) {
  15746. break;
  15747. }
  15748. if ((0, _primitives.isCmd)(obj, "endbfrange")) {
  15749. return;
  15750. }
  15751. expectString(obj);
  15752. const low = strToInt(obj);
  15753. obj = lexer.getObj();
  15754. expectString(obj);
  15755. const high = strToInt(obj);
  15756. obj = lexer.getObj();
  15757. if (Number.isInteger(obj) || typeof obj === "string") {
  15758. const dstLow = Number.isInteger(obj) ? String.fromCharCode(obj) : obj;
  15759. cMap.mapBfRange(low, high, dstLow);
  15760. } else if ((0, _primitives.isCmd)(obj, "[")) {
  15761. obj = lexer.getObj();
  15762. const array = [];
  15763. while (!(0, _primitives.isCmd)(obj, "]") && obj !== _primitives.EOF) {
  15764. array.push(obj);
  15765. obj = lexer.getObj();
  15766. }
  15767. cMap.mapBfRangeToArray(low, high, array);
  15768. } else {
  15769. break;
  15770. }
  15771. }
  15772. throw new _util.FormatError("Invalid bf range.");
  15773. }
  15774. function parseCidChar(cMap, lexer) {
  15775. while (true) {
  15776. let obj = lexer.getObj();
  15777. if (obj === _primitives.EOF) {
  15778. break;
  15779. }
  15780. if ((0, _primitives.isCmd)(obj, "endcidchar")) {
  15781. return;
  15782. }
  15783. expectString(obj);
  15784. const src = strToInt(obj);
  15785. obj = lexer.getObj();
  15786. expectInt(obj);
  15787. const dst = obj;
  15788. cMap.mapOne(src, dst);
  15789. }
  15790. }
  15791. function parseCidRange(cMap, lexer) {
  15792. while (true) {
  15793. let obj = lexer.getObj();
  15794. if (obj === _primitives.EOF) {
  15795. break;
  15796. }
  15797. if ((0, _primitives.isCmd)(obj, "endcidrange")) {
  15798. return;
  15799. }
  15800. expectString(obj);
  15801. const low = strToInt(obj);
  15802. obj = lexer.getObj();
  15803. expectString(obj);
  15804. const high = strToInt(obj);
  15805. obj = lexer.getObj();
  15806. expectInt(obj);
  15807. const dstLow = obj;
  15808. cMap.mapCidRange(low, high, dstLow);
  15809. }
  15810. }
  15811. function parseCodespaceRange(cMap, lexer) {
  15812. while (true) {
  15813. let obj = lexer.getObj();
  15814. if (obj === _primitives.EOF) {
  15815. break;
  15816. }
  15817. if ((0, _primitives.isCmd)(obj, "endcodespacerange")) {
  15818. return;
  15819. }
  15820. if (typeof obj !== "string") {
  15821. break;
  15822. }
  15823. const low = strToInt(obj);
  15824. obj = lexer.getObj();
  15825. if (typeof obj !== "string") {
  15826. break;
  15827. }
  15828. const high = strToInt(obj);
  15829. cMap.addCodespaceRange(obj.length, low, high);
  15830. }
  15831. throw new _util.FormatError("Invalid codespace range.");
  15832. }
  15833. function parseWMode(cMap, lexer) {
  15834. const obj = lexer.getObj();
  15835. if (Number.isInteger(obj)) {
  15836. cMap.vertical = !!obj;
  15837. }
  15838. }
  15839. function parseCMapName(cMap, lexer) {
  15840. const obj = lexer.getObj();
  15841. if (obj instanceof _primitives.Name) {
  15842. cMap.name = obj.name;
  15843. }
  15844. }
  15845. async function parseCMap(cMap, lexer, fetchBuiltInCMap, useCMap) {
  15846. let previous, embeddedUseCMap;
  15847. objLoop: while (true) {
  15848. try {
  15849. const obj = lexer.getObj();
  15850. if (obj === _primitives.EOF) {
  15851. break;
  15852. } else if (obj instanceof _primitives.Name) {
  15853. if (obj.name === "WMode") {
  15854. parseWMode(cMap, lexer);
  15855. } else if (obj.name === "CMapName") {
  15856. parseCMapName(cMap, lexer);
  15857. }
  15858. previous = obj;
  15859. } else if (obj instanceof _primitives.Cmd) {
  15860. switch (obj.cmd) {
  15861. case "endcmap":
  15862. break objLoop;
  15863. case "usecmap":
  15864. if (previous instanceof _primitives.Name) {
  15865. embeddedUseCMap = previous.name;
  15866. }
  15867. break;
  15868. case "begincodespacerange":
  15869. parseCodespaceRange(cMap, lexer);
  15870. break;
  15871. case "beginbfchar":
  15872. parseBfChar(cMap, lexer);
  15873. break;
  15874. case "begincidchar":
  15875. parseCidChar(cMap, lexer);
  15876. break;
  15877. case "beginbfrange":
  15878. parseBfRange(cMap, lexer);
  15879. break;
  15880. case "begincidrange":
  15881. parseCidRange(cMap, lexer);
  15882. break;
  15883. }
  15884. }
  15885. } catch (ex) {
  15886. if (ex instanceof _core_utils.MissingDataException) {
  15887. throw ex;
  15888. }
  15889. (0, _util.warn)("Invalid cMap data: " + ex);
  15890. continue;
  15891. }
  15892. }
  15893. if (!useCMap && embeddedUseCMap) {
  15894. useCMap = embeddedUseCMap;
  15895. }
  15896. if (useCMap) {
  15897. return extendCMap(cMap, fetchBuiltInCMap, useCMap);
  15898. }
  15899. return cMap;
  15900. }
  15901. async function extendCMap(cMap, fetchBuiltInCMap, useCMap) {
  15902. cMap.useCMap = await createBuiltInCMap(useCMap, fetchBuiltInCMap);
  15903. if (cMap.numCodespaceRanges === 0) {
  15904. const useCodespaceRanges = cMap.useCMap.codespaceRanges;
  15905. for (let i = 0; i < useCodespaceRanges.length; i++) {
  15906. cMap.codespaceRanges[i] = useCodespaceRanges[i].slice();
  15907. }
  15908. cMap.numCodespaceRanges = cMap.useCMap.numCodespaceRanges;
  15909. }
  15910. cMap.useCMap.forEach(function (key, value) {
  15911. if (!cMap.contains(key)) {
  15912. cMap.mapOne(key, cMap.useCMap.lookup(key));
  15913. }
  15914. });
  15915. return cMap;
  15916. }
  15917. async function createBuiltInCMap(name, fetchBuiltInCMap) {
  15918. if (name === "Identity-H") {
  15919. return new IdentityCMap(false, 2);
  15920. } else if (name === "Identity-V") {
  15921. return new IdentityCMap(true, 2);
  15922. }
  15923. if (!BUILT_IN_CMAPS.includes(name)) {
  15924. throw new Error("Unknown CMap name: " + name);
  15925. }
  15926. if (!fetchBuiltInCMap) {
  15927. throw new Error("Built-in CMap parameters are not provided.");
  15928. }
  15929. const {
  15930. cMapData,
  15931. compressionType
  15932. } = await fetchBuiltInCMap(name);
  15933. const cMap = new CMap(true);
  15934. if (compressionType === _util.CMapCompressionType.BINARY) {
  15935. return new BinaryCMapReader().process(cMapData, cMap, useCMap => {
  15936. return extendCMap(cMap, fetchBuiltInCMap, useCMap);
  15937. });
  15938. }
  15939. if (compressionType === _util.CMapCompressionType.NONE) {
  15940. const lexer = new _parser.Lexer(new _stream.Stream(cMapData));
  15941. return parseCMap(cMap, lexer, fetchBuiltInCMap, null);
  15942. }
  15943. throw new Error(`Invalid CMap "compressionType" value: ${compressionType}`);
  15944. }
  15945. return {
  15946. async create(params) {
  15947. const encoding = params.encoding;
  15948. const fetchBuiltInCMap = params.fetchBuiltInCMap;
  15949. const useCMap = params.useCMap;
  15950. if (encoding instanceof _primitives.Name) {
  15951. return createBuiltInCMap(encoding.name, fetchBuiltInCMap);
  15952. } else if (encoding instanceof _base_stream.BaseStream) {
  15953. const parsedCMap = await parseCMap(new CMap(), new _parser.Lexer(encoding), fetchBuiltInCMap, useCMap);
  15954. if (parsedCMap.isIdentityCMap) {
  15955. return createBuiltInCMap(parsedCMap.name, fetchBuiltInCMap);
  15956. }
  15957. return parsedCMap;
  15958. }
  15959. throw new Error("Encoding required.");
  15960. }
  15961. };
  15962. }();
  15963. exports.CMapFactory = CMapFactory;
  15964. /***/ }),
  15965. /* 146 */
  15966. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  15967. "use strict";
  15968. Object.defineProperty(exports, "__esModule", ({
  15969. value: true
  15970. }));
  15971. exports.Parser = exports.Linearization = exports.Lexer = void 0;
  15972. var _util = __w_pdfjs_require__(2);
  15973. var _primitives = __w_pdfjs_require__(134);
  15974. var _core_utils = __w_pdfjs_require__(135);
  15975. var _ascii_85_stream = __w_pdfjs_require__(147);
  15976. var _ascii_hex_stream = __w_pdfjs_require__(149);
  15977. var _ccitt_stream = __w_pdfjs_require__(150);
  15978. var _flate_stream = __w_pdfjs_require__(152);
  15979. var _jbig2_stream = __w_pdfjs_require__(153);
  15980. var _jpeg_stream = __w_pdfjs_require__(156);
  15981. var _jpx_stream = __w_pdfjs_require__(158);
  15982. var _lzw_stream = __w_pdfjs_require__(160);
  15983. var _stream = __w_pdfjs_require__(139);
  15984. var _predictor_stream = __w_pdfjs_require__(161);
  15985. var _run_length_stream = __w_pdfjs_require__(162);
  15986. const MAX_LENGTH_TO_CACHE = 1000;
  15987. function getInlineImageCacheKey(bytes) {
  15988. const strBuf = [],
  15989. ii = bytes.length;
  15990. let i = 0;
  15991. while (i < ii - 1) {
  15992. strBuf.push(bytes[i++] << 8 | bytes[i++]);
  15993. }
  15994. if (i < ii) {
  15995. strBuf.push(bytes[i]);
  15996. }
  15997. return ii + "_" + String.fromCharCode.apply(null, strBuf);
  15998. }
  15999. class Parser {
  16000. constructor(_ref) {
  16001. let {
  16002. lexer,
  16003. xref,
  16004. allowStreams = false,
  16005. recoveryMode = false
  16006. } = _ref;
  16007. this.lexer = lexer;
  16008. this.xref = xref;
  16009. this.allowStreams = allowStreams;
  16010. this.recoveryMode = recoveryMode;
  16011. this.imageCache = Object.create(null);
  16012. this._imageId = 0;
  16013. this.refill();
  16014. }
  16015. refill() {
  16016. this.buf1 = this.lexer.getObj();
  16017. this.buf2 = this.lexer.getObj();
  16018. }
  16019. shift() {
  16020. if (this.buf2 instanceof _primitives.Cmd && this.buf2.cmd === "ID") {
  16021. this.buf1 = this.buf2;
  16022. this.buf2 = null;
  16023. } else {
  16024. this.buf1 = this.buf2;
  16025. this.buf2 = this.lexer.getObj();
  16026. }
  16027. }
  16028. tryShift() {
  16029. try {
  16030. this.shift();
  16031. return true;
  16032. } catch (e) {
  16033. if (e instanceof _core_utils.MissingDataException) {
  16034. throw e;
  16035. }
  16036. return false;
  16037. }
  16038. }
  16039. getObj() {
  16040. let cipherTransform = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  16041. const buf1 = this.buf1;
  16042. this.shift();
  16043. if (buf1 instanceof _primitives.Cmd) {
  16044. switch (buf1.cmd) {
  16045. case "BI":
  16046. return this.makeInlineImage(cipherTransform);
  16047. case "[":
  16048. const array = [];
  16049. while (!(0, _primitives.isCmd)(this.buf1, "]") && this.buf1 !== _primitives.EOF) {
  16050. array.push(this.getObj(cipherTransform));
  16051. }
  16052. if (this.buf1 === _primitives.EOF) {
  16053. if (this.recoveryMode) {
  16054. return array;
  16055. }
  16056. throw new _core_utils.ParserEOFException("End of file inside array.");
  16057. }
  16058. this.shift();
  16059. return array;
  16060. case "<<":
  16061. const dict = new _primitives.Dict(this.xref);
  16062. while (!(0, _primitives.isCmd)(this.buf1, ">>") && this.buf1 !== _primitives.EOF) {
  16063. if (!(this.buf1 instanceof _primitives.Name)) {
  16064. (0, _util.info)("Malformed dictionary: key must be a name object");
  16065. this.shift();
  16066. continue;
  16067. }
  16068. const key = this.buf1.name;
  16069. this.shift();
  16070. if (this.buf1 === _primitives.EOF) {
  16071. break;
  16072. }
  16073. dict.set(key, this.getObj(cipherTransform));
  16074. }
  16075. if (this.buf1 === _primitives.EOF) {
  16076. if (this.recoveryMode) {
  16077. return dict;
  16078. }
  16079. throw new _core_utils.ParserEOFException("End of file inside dictionary.");
  16080. }
  16081. if ((0, _primitives.isCmd)(this.buf2, "stream")) {
  16082. return this.allowStreams ? this.makeStream(dict, cipherTransform) : dict;
  16083. }
  16084. this.shift();
  16085. return dict;
  16086. default:
  16087. return buf1;
  16088. }
  16089. }
  16090. if (Number.isInteger(buf1)) {
  16091. if (Number.isInteger(this.buf1) && (0, _primitives.isCmd)(this.buf2, "R")) {
  16092. const ref = _primitives.Ref.get(buf1, this.buf1);
  16093. this.shift();
  16094. this.shift();
  16095. return ref;
  16096. }
  16097. return buf1;
  16098. }
  16099. if (typeof buf1 === "string") {
  16100. if (cipherTransform) {
  16101. return cipherTransform.decryptString(buf1);
  16102. }
  16103. return buf1;
  16104. }
  16105. return buf1;
  16106. }
  16107. findDefaultInlineStreamEnd(stream) {
  16108. const E = 0x45,
  16109. I = 0x49,
  16110. SPACE = 0x20,
  16111. LF = 0xa,
  16112. CR = 0xd,
  16113. NUL = 0x0;
  16114. const lexer = this.lexer,
  16115. startPos = stream.pos,
  16116. n = 10;
  16117. let state = 0,
  16118. ch,
  16119. maybeEIPos;
  16120. while ((ch = stream.getByte()) !== -1) {
  16121. if (state === 0) {
  16122. state = ch === E ? 1 : 0;
  16123. } else if (state === 1) {
  16124. state = ch === I ? 2 : 0;
  16125. } else {
  16126. if (ch === SPACE || ch === LF || ch === CR) {
  16127. maybeEIPos = stream.pos;
  16128. const followingBytes = stream.peekBytes(n);
  16129. for (let i = 0, ii = followingBytes.length; i < ii; i++) {
  16130. ch = followingBytes[i];
  16131. if (ch === NUL && followingBytes[i + 1] !== NUL) {
  16132. continue;
  16133. }
  16134. if (ch !== LF && ch !== CR && (ch < SPACE || ch > 0x7f)) {
  16135. state = 0;
  16136. break;
  16137. }
  16138. }
  16139. if (state !== 2) {
  16140. continue;
  16141. }
  16142. if (lexer.knownCommands) {
  16143. const nextObj = lexer.peekObj();
  16144. if (nextObj instanceof _primitives.Cmd && !lexer.knownCommands[nextObj.cmd]) {
  16145. state = 0;
  16146. }
  16147. } else {
  16148. (0, _util.warn)("findDefaultInlineStreamEnd - `lexer.knownCommands` is undefined.");
  16149. }
  16150. if (state === 2) {
  16151. break;
  16152. }
  16153. } else {
  16154. state = 0;
  16155. }
  16156. }
  16157. }
  16158. if (ch === -1) {
  16159. (0, _util.warn)("findDefaultInlineStreamEnd: " + "Reached the end of the stream without finding a valid EI marker");
  16160. if (maybeEIPos) {
  16161. (0, _util.warn)('... trying to recover by using the last "EI" occurrence.');
  16162. stream.skip(-(stream.pos - maybeEIPos));
  16163. }
  16164. }
  16165. let endOffset = 4;
  16166. stream.skip(-endOffset);
  16167. ch = stream.peekByte();
  16168. stream.skip(endOffset);
  16169. if (!(0, _core_utils.isWhiteSpace)(ch)) {
  16170. endOffset--;
  16171. }
  16172. return stream.pos - endOffset - startPos;
  16173. }
  16174. findDCTDecodeInlineStreamEnd(stream) {
  16175. const startPos = stream.pos;
  16176. let foundEOI = false,
  16177. b,
  16178. markerLength;
  16179. while ((b = stream.getByte()) !== -1) {
  16180. if (b !== 0xff) {
  16181. continue;
  16182. }
  16183. switch (stream.getByte()) {
  16184. case 0x00:
  16185. break;
  16186. case 0xff:
  16187. stream.skip(-1);
  16188. break;
  16189. case 0xd9:
  16190. foundEOI = true;
  16191. break;
  16192. case 0xc0:
  16193. case 0xc1:
  16194. case 0xc2:
  16195. case 0xc3:
  16196. case 0xc5:
  16197. case 0xc6:
  16198. case 0xc7:
  16199. case 0xc9:
  16200. case 0xca:
  16201. case 0xcb:
  16202. case 0xcd:
  16203. case 0xce:
  16204. case 0xcf:
  16205. case 0xc4:
  16206. case 0xcc:
  16207. case 0xda:
  16208. case 0xdb:
  16209. case 0xdc:
  16210. case 0xdd:
  16211. case 0xde:
  16212. case 0xdf:
  16213. case 0xe0:
  16214. case 0xe1:
  16215. case 0xe2:
  16216. case 0xe3:
  16217. case 0xe4:
  16218. case 0xe5:
  16219. case 0xe6:
  16220. case 0xe7:
  16221. case 0xe8:
  16222. case 0xe9:
  16223. case 0xea:
  16224. case 0xeb:
  16225. case 0xec:
  16226. case 0xed:
  16227. case 0xee:
  16228. case 0xef:
  16229. case 0xfe:
  16230. markerLength = stream.getUint16();
  16231. if (markerLength > 2) {
  16232. stream.skip(markerLength - 2);
  16233. } else {
  16234. stream.skip(-2);
  16235. }
  16236. break;
  16237. }
  16238. if (foundEOI) {
  16239. break;
  16240. }
  16241. }
  16242. const length = stream.pos - startPos;
  16243. if (b === -1) {
  16244. (0, _util.warn)("Inline DCTDecode image stream: " + "EOI marker not found, searching for /EI/ instead.");
  16245. stream.skip(-length);
  16246. return this.findDefaultInlineStreamEnd(stream);
  16247. }
  16248. this.inlineStreamSkipEI(stream);
  16249. return length;
  16250. }
  16251. findASCII85DecodeInlineStreamEnd(stream) {
  16252. const TILDE = 0x7e,
  16253. GT = 0x3e;
  16254. const startPos = stream.pos;
  16255. let ch;
  16256. while ((ch = stream.getByte()) !== -1) {
  16257. if (ch === TILDE) {
  16258. const tildePos = stream.pos;
  16259. ch = stream.peekByte();
  16260. while ((0, _core_utils.isWhiteSpace)(ch)) {
  16261. stream.skip();
  16262. ch = stream.peekByte();
  16263. }
  16264. if (ch === GT) {
  16265. stream.skip();
  16266. break;
  16267. }
  16268. if (stream.pos > tildePos) {
  16269. const maybeEI = stream.peekBytes(2);
  16270. if (maybeEI[0] === 0x45 && maybeEI[1] === 0x49) {
  16271. break;
  16272. }
  16273. }
  16274. }
  16275. }
  16276. const length = stream.pos - startPos;
  16277. if (ch === -1) {
  16278. (0, _util.warn)("Inline ASCII85Decode image stream: " + "EOD marker not found, searching for /EI/ instead.");
  16279. stream.skip(-length);
  16280. return this.findDefaultInlineStreamEnd(stream);
  16281. }
  16282. this.inlineStreamSkipEI(stream);
  16283. return length;
  16284. }
  16285. findASCIIHexDecodeInlineStreamEnd(stream) {
  16286. const GT = 0x3e;
  16287. const startPos = stream.pos;
  16288. let ch;
  16289. while ((ch = stream.getByte()) !== -1) {
  16290. if (ch === GT) {
  16291. break;
  16292. }
  16293. }
  16294. const length = stream.pos - startPos;
  16295. if (ch === -1) {
  16296. (0, _util.warn)("Inline ASCIIHexDecode image stream: " + "EOD marker not found, searching for /EI/ instead.");
  16297. stream.skip(-length);
  16298. return this.findDefaultInlineStreamEnd(stream);
  16299. }
  16300. this.inlineStreamSkipEI(stream);
  16301. return length;
  16302. }
  16303. inlineStreamSkipEI(stream) {
  16304. const E = 0x45,
  16305. I = 0x49;
  16306. let state = 0,
  16307. ch;
  16308. while ((ch = stream.getByte()) !== -1) {
  16309. if (state === 0) {
  16310. state = ch === E ? 1 : 0;
  16311. } else if (state === 1) {
  16312. state = ch === I ? 2 : 0;
  16313. } else if (state === 2) {
  16314. break;
  16315. }
  16316. }
  16317. }
  16318. makeInlineImage(cipherTransform) {
  16319. const lexer = this.lexer;
  16320. const stream = lexer.stream;
  16321. const dictMap = Object.create(null);
  16322. let dictLength;
  16323. while (!(0, _primitives.isCmd)(this.buf1, "ID") && this.buf1 !== _primitives.EOF) {
  16324. if (!(this.buf1 instanceof _primitives.Name)) {
  16325. throw new _util.FormatError("Dictionary key must be a name object");
  16326. }
  16327. const key = this.buf1.name;
  16328. this.shift();
  16329. if (this.buf1 === _primitives.EOF) {
  16330. break;
  16331. }
  16332. dictMap[key] = this.getObj(cipherTransform);
  16333. }
  16334. if (lexer.beginInlineImagePos !== -1) {
  16335. dictLength = stream.pos - lexer.beginInlineImagePos;
  16336. }
  16337. const filter = this.xref.fetchIfRef(dictMap.F || dictMap.Filter);
  16338. let filterName;
  16339. if (filter instanceof _primitives.Name) {
  16340. filterName = filter.name;
  16341. } else if (Array.isArray(filter)) {
  16342. const filterZero = this.xref.fetchIfRef(filter[0]);
  16343. if (filterZero instanceof _primitives.Name) {
  16344. filterName = filterZero.name;
  16345. }
  16346. }
  16347. const startPos = stream.pos;
  16348. let length;
  16349. switch (filterName) {
  16350. case "DCT":
  16351. case "DCTDecode":
  16352. length = this.findDCTDecodeInlineStreamEnd(stream);
  16353. break;
  16354. case "A85":
  16355. case "ASCII85Decode":
  16356. length = this.findASCII85DecodeInlineStreamEnd(stream);
  16357. break;
  16358. case "AHx":
  16359. case "ASCIIHexDecode":
  16360. length = this.findASCIIHexDecodeInlineStreamEnd(stream);
  16361. break;
  16362. default:
  16363. length = this.findDefaultInlineStreamEnd(stream);
  16364. }
  16365. let cacheKey;
  16366. if (length < MAX_LENGTH_TO_CACHE && dictLength > 0) {
  16367. const initialStreamPos = stream.pos;
  16368. stream.pos = lexer.beginInlineImagePos;
  16369. cacheKey = getInlineImageCacheKey(stream.getBytes(dictLength + length));
  16370. stream.pos = initialStreamPos;
  16371. const cacheEntry = this.imageCache[cacheKey];
  16372. if (cacheEntry !== undefined) {
  16373. this.buf2 = _primitives.Cmd.get("EI");
  16374. this.shift();
  16375. cacheEntry.reset();
  16376. return cacheEntry;
  16377. }
  16378. }
  16379. const dict = new _primitives.Dict(this.xref);
  16380. for (const key in dictMap) {
  16381. dict.set(key, dictMap[key]);
  16382. }
  16383. let imageStream = stream.makeSubStream(startPos, length, dict);
  16384. if (cipherTransform) {
  16385. imageStream = cipherTransform.createStream(imageStream, length);
  16386. }
  16387. imageStream = this.filter(imageStream, dict, length);
  16388. imageStream.dict = dict;
  16389. if (cacheKey !== undefined) {
  16390. imageStream.cacheKey = `inline_img_${++this._imageId}`;
  16391. this.imageCache[cacheKey] = imageStream;
  16392. }
  16393. this.buf2 = _primitives.Cmd.get("EI");
  16394. this.shift();
  16395. return imageStream;
  16396. }
  16397. _findStreamLength(startPos, signature) {
  16398. const {
  16399. stream
  16400. } = this.lexer;
  16401. stream.pos = startPos;
  16402. const SCAN_BLOCK_LENGTH = 2048;
  16403. const signatureLength = signature.length;
  16404. while (stream.pos < stream.end) {
  16405. const scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH);
  16406. const scanLength = scanBytes.length - signatureLength;
  16407. if (scanLength <= 0) {
  16408. break;
  16409. }
  16410. let pos = 0;
  16411. while (pos < scanLength) {
  16412. let j = 0;
  16413. while (j < signatureLength && scanBytes[pos + j] === signature[j]) {
  16414. j++;
  16415. }
  16416. if (j >= signatureLength) {
  16417. stream.pos += pos;
  16418. return stream.pos - startPos;
  16419. }
  16420. pos++;
  16421. }
  16422. stream.pos += scanLength;
  16423. }
  16424. return -1;
  16425. }
  16426. makeStream(dict, cipherTransform) {
  16427. const lexer = this.lexer;
  16428. let stream = lexer.stream;
  16429. lexer.skipToNextLine();
  16430. const startPos = stream.pos - 1;
  16431. let length = dict.get("Length");
  16432. if (!Number.isInteger(length)) {
  16433. (0, _util.info)(`Bad length "${length && length.toString()}" in stream.`);
  16434. length = 0;
  16435. }
  16436. stream.pos = startPos + length;
  16437. lexer.nextChar();
  16438. if (this.tryShift() && (0, _primitives.isCmd)(this.buf2, "endstream")) {
  16439. this.shift();
  16440. } else {
  16441. const ENDSTREAM_SIGNATURE = new Uint8Array([0x65, 0x6e, 0x64, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d]);
  16442. let actualLength = this._findStreamLength(startPos, ENDSTREAM_SIGNATURE);
  16443. if (actualLength < 0) {
  16444. const MAX_TRUNCATION = 1;
  16445. for (let i = 1; i <= MAX_TRUNCATION; i++) {
  16446. const end = ENDSTREAM_SIGNATURE.length - i;
  16447. const TRUNCATED_SIGNATURE = ENDSTREAM_SIGNATURE.slice(0, end);
  16448. const maybeLength = this._findStreamLength(startPos, TRUNCATED_SIGNATURE);
  16449. if (maybeLength >= 0) {
  16450. const lastByte = stream.peekBytes(end + 1)[end];
  16451. if (!(0, _core_utils.isWhiteSpace)(lastByte)) {
  16452. break;
  16453. }
  16454. (0, _util.info)(`Found "${(0, _util.bytesToString)(TRUNCATED_SIGNATURE)}" when ` + "searching for endstream command.");
  16455. actualLength = maybeLength;
  16456. break;
  16457. }
  16458. }
  16459. if (actualLength < 0) {
  16460. throw new _util.FormatError("Missing endstream command.");
  16461. }
  16462. }
  16463. length = actualLength;
  16464. lexer.nextChar();
  16465. this.shift();
  16466. this.shift();
  16467. }
  16468. this.shift();
  16469. stream = stream.makeSubStream(startPos, length, dict);
  16470. if (cipherTransform) {
  16471. stream = cipherTransform.createStream(stream, length);
  16472. }
  16473. stream = this.filter(stream, dict, length);
  16474. stream.dict = dict;
  16475. return stream;
  16476. }
  16477. filter(stream, dict, length) {
  16478. let filter = dict.get("F", "Filter");
  16479. let params = dict.get("DP", "DecodeParms");
  16480. if (filter instanceof _primitives.Name) {
  16481. if (Array.isArray(params)) {
  16482. (0, _util.warn)("/DecodeParms should not be an Array, when /Filter is a Name.");
  16483. }
  16484. return this.makeFilter(stream, filter.name, length, params);
  16485. }
  16486. let maybeLength = length;
  16487. if (Array.isArray(filter)) {
  16488. const filterArray = filter;
  16489. const paramsArray = params;
  16490. for (let i = 0, ii = filterArray.length; i < ii; ++i) {
  16491. filter = this.xref.fetchIfRef(filterArray[i]);
  16492. if (!(filter instanceof _primitives.Name)) {
  16493. throw new _util.FormatError(`Bad filter name "${filter}"`);
  16494. }
  16495. params = null;
  16496. if (Array.isArray(paramsArray) && i in paramsArray) {
  16497. params = this.xref.fetchIfRef(paramsArray[i]);
  16498. }
  16499. stream = this.makeFilter(stream, filter.name, maybeLength, params);
  16500. maybeLength = null;
  16501. }
  16502. }
  16503. return stream;
  16504. }
  16505. makeFilter(stream, name, maybeLength, params) {
  16506. if (maybeLength === 0) {
  16507. (0, _util.warn)(`Empty "${name}" stream.`);
  16508. return new _stream.NullStream();
  16509. }
  16510. const xrefStats = this.xref.stats;
  16511. try {
  16512. switch (name) {
  16513. case "Fl":
  16514. case "FlateDecode":
  16515. xrefStats.addStreamType(_util.StreamType.FLATE);
  16516. if (params) {
  16517. return new _predictor_stream.PredictorStream(new _flate_stream.FlateStream(stream, maybeLength), maybeLength, params);
  16518. }
  16519. return new _flate_stream.FlateStream(stream, maybeLength);
  16520. case "LZW":
  16521. case "LZWDecode":
  16522. xrefStats.addStreamType(_util.StreamType.LZW);
  16523. let earlyChange = 1;
  16524. if (params) {
  16525. if (params.has("EarlyChange")) {
  16526. earlyChange = params.get("EarlyChange");
  16527. }
  16528. return new _predictor_stream.PredictorStream(new _lzw_stream.LZWStream(stream, maybeLength, earlyChange), maybeLength, params);
  16529. }
  16530. return new _lzw_stream.LZWStream(stream, maybeLength, earlyChange);
  16531. case "DCT":
  16532. case "DCTDecode":
  16533. xrefStats.addStreamType(_util.StreamType.DCT);
  16534. return new _jpeg_stream.JpegStream(stream, maybeLength, params);
  16535. case "JPX":
  16536. case "JPXDecode":
  16537. xrefStats.addStreamType(_util.StreamType.JPX);
  16538. return new _jpx_stream.JpxStream(stream, maybeLength, params);
  16539. case "A85":
  16540. case "ASCII85Decode":
  16541. xrefStats.addStreamType(_util.StreamType.A85);
  16542. return new _ascii_85_stream.Ascii85Stream(stream, maybeLength);
  16543. case "AHx":
  16544. case "ASCIIHexDecode":
  16545. xrefStats.addStreamType(_util.StreamType.AHX);
  16546. return new _ascii_hex_stream.AsciiHexStream(stream, maybeLength);
  16547. case "CCF":
  16548. case "CCITTFaxDecode":
  16549. xrefStats.addStreamType(_util.StreamType.CCF);
  16550. return new _ccitt_stream.CCITTFaxStream(stream, maybeLength, params);
  16551. case "RL":
  16552. case "RunLengthDecode":
  16553. xrefStats.addStreamType(_util.StreamType.RLX);
  16554. return new _run_length_stream.RunLengthStream(stream, maybeLength);
  16555. case "JBIG2Decode":
  16556. xrefStats.addStreamType(_util.StreamType.JBIG);
  16557. return new _jbig2_stream.Jbig2Stream(stream, maybeLength, params);
  16558. }
  16559. (0, _util.warn)(`Filter "${name}" is not supported.`);
  16560. return stream;
  16561. } catch (ex) {
  16562. if (ex instanceof _core_utils.MissingDataException) {
  16563. throw ex;
  16564. }
  16565. (0, _util.warn)(`Invalid stream: "${ex}"`);
  16566. return new _stream.NullStream();
  16567. }
  16568. }
  16569. }
  16570. exports.Parser = Parser;
  16571. 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];
  16572. function toHexDigit(ch) {
  16573. if (ch >= 0x30 && ch <= 0x39) {
  16574. return ch & 0x0f;
  16575. }
  16576. if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {
  16577. return (ch & 0x0f) + 9;
  16578. }
  16579. return -1;
  16580. }
  16581. class Lexer {
  16582. constructor(stream) {
  16583. let knownCommands = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  16584. this.stream = stream;
  16585. this.nextChar();
  16586. this.strBuf = [];
  16587. this.knownCommands = knownCommands;
  16588. this._hexStringNumWarn = 0;
  16589. this.beginInlineImagePos = -1;
  16590. }
  16591. nextChar() {
  16592. return this.currentChar = this.stream.getByte();
  16593. }
  16594. peekChar() {
  16595. return this.stream.peekByte();
  16596. }
  16597. getNumber() {
  16598. let ch = this.currentChar;
  16599. let eNotation = false;
  16600. let divideBy = 0;
  16601. let sign = 0;
  16602. if (ch === 0x2d) {
  16603. sign = -1;
  16604. ch = this.nextChar();
  16605. if (ch === 0x2d) {
  16606. ch = this.nextChar();
  16607. }
  16608. } else if (ch === 0x2b) {
  16609. sign = 1;
  16610. ch = this.nextChar();
  16611. }
  16612. if (ch === 0x0a || ch === 0x0d) {
  16613. do {
  16614. ch = this.nextChar();
  16615. } while (ch === 0x0a || ch === 0x0d);
  16616. }
  16617. if (ch === 0x2e) {
  16618. divideBy = 10;
  16619. ch = this.nextChar();
  16620. }
  16621. if (ch < 0x30 || ch > 0x39) {
  16622. const msg = `Invalid number: ${String.fromCharCode(ch)} (charCode ${ch})`;
  16623. if ((0, _core_utils.isWhiteSpace)(ch) || ch === -1) {
  16624. (0, _util.info)(`Lexer.getNumber - "${msg}".`);
  16625. return 0;
  16626. }
  16627. throw new _util.FormatError(msg);
  16628. }
  16629. sign = sign || 1;
  16630. let baseValue = ch - 0x30;
  16631. let powerValue = 0;
  16632. let powerValueSign = 1;
  16633. while ((ch = this.nextChar()) >= 0) {
  16634. if (ch >= 0x30 && ch <= 0x39) {
  16635. const currentDigit = ch - 0x30;
  16636. if (eNotation) {
  16637. powerValue = powerValue * 10 + currentDigit;
  16638. } else {
  16639. if (divideBy !== 0) {
  16640. divideBy *= 10;
  16641. }
  16642. baseValue = baseValue * 10 + currentDigit;
  16643. }
  16644. } else if (ch === 0x2e) {
  16645. if (divideBy === 0) {
  16646. divideBy = 1;
  16647. } else {
  16648. break;
  16649. }
  16650. } else if (ch === 0x2d) {
  16651. (0, _util.warn)("Badly formatted number: minus sign in the middle");
  16652. } else if (ch === 0x45 || ch === 0x65) {
  16653. ch = this.peekChar();
  16654. if (ch === 0x2b || ch === 0x2d) {
  16655. powerValueSign = ch === 0x2d ? -1 : 1;
  16656. this.nextChar();
  16657. } else if (ch < 0x30 || ch > 0x39) {
  16658. break;
  16659. }
  16660. eNotation = true;
  16661. } else {
  16662. break;
  16663. }
  16664. }
  16665. if (divideBy !== 0) {
  16666. baseValue /= divideBy;
  16667. }
  16668. if (eNotation) {
  16669. baseValue *= 10 ** (powerValueSign * powerValue);
  16670. }
  16671. return sign * baseValue;
  16672. }
  16673. getString() {
  16674. let numParen = 1;
  16675. let done = false;
  16676. const strBuf = this.strBuf;
  16677. strBuf.length = 0;
  16678. let ch = this.nextChar();
  16679. while (true) {
  16680. let charBuffered = false;
  16681. switch (ch | 0) {
  16682. case -1:
  16683. (0, _util.warn)("Unterminated string");
  16684. done = true;
  16685. break;
  16686. case 0x28:
  16687. ++numParen;
  16688. strBuf.push("(");
  16689. break;
  16690. case 0x29:
  16691. if (--numParen === 0) {
  16692. this.nextChar();
  16693. done = true;
  16694. } else {
  16695. strBuf.push(")");
  16696. }
  16697. break;
  16698. case 0x5c:
  16699. ch = this.nextChar();
  16700. switch (ch) {
  16701. case -1:
  16702. (0, _util.warn)("Unterminated string");
  16703. done = true;
  16704. break;
  16705. case 0x6e:
  16706. strBuf.push("\n");
  16707. break;
  16708. case 0x72:
  16709. strBuf.push("\r");
  16710. break;
  16711. case 0x74:
  16712. strBuf.push("\t");
  16713. break;
  16714. case 0x62:
  16715. strBuf.push("\b");
  16716. break;
  16717. case 0x66:
  16718. strBuf.push("\f");
  16719. break;
  16720. case 0x5c:
  16721. case 0x28:
  16722. case 0x29:
  16723. strBuf.push(String.fromCharCode(ch));
  16724. break;
  16725. case 0x30:
  16726. case 0x31:
  16727. case 0x32:
  16728. case 0x33:
  16729. case 0x34:
  16730. case 0x35:
  16731. case 0x36:
  16732. case 0x37:
  16733. let x = ch & 0x0f;
  16734. ch = this.nextChar();
  16735. charBuffered = true;
  16736. if (ch >= 0x30 && ch <= 0x37) {
  16737. x = (x << 3) + (ch & 0x0f);
  16738. ch = this.nextChar();
  16739. if (ch >= 0x30 && ch <= 0x37) {
  16740. charBuffered = false;
  16741. x = (x << 3) + (ch & 0x0f);
  16742. }
  16743. }
  16744. strBuf.push(String.fromCharCode(x));
  16745. break;
  16746. case 0x0d:
  16747. if (this.peekChar() === 0x0a) {
  16748. this.nextChar();
  16749. }
  16750. break;
  16751. case 0x0a:
  16752. break;
  16753. default:
  16754. strBuf.push(String.fromCharCode(ch));
  16755. break;
  16756. }
  16757. break;
  16758. default:
  16759. strBuf.push(String.fromCharCode(ch));
  16760. break;
  16761. }
  16762. if (done) {
  16763. break;
  16764. }
  16765. if (!charBuffered) {
  16766. ch = this.nextChar();
  16767. }
  16768. }
  16769. return strBuf.join("");
  16770. }
  16771. getName() {
  16772. let ch, previousCh;
  16773. const strBuf = this.strBuf;
  16774. strBuf.length = 0;
  16775. while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
  16776. if (ch === 0x23) {
  16777. ch = this.nextChar();
  16778. if (specialChars[ch]) {
  16779. (0, _util.warn)("Lexer_getName: " + "NUMBER SIGN (#) should be followed by a hexadecimal number.");
  16780. strBuf.push("#");
  16781. break;
  16782. }
  16783. const x = toHexDigit(ch);
  16784. if (x !== -1) {
  16785. previousCh = ch;
  16786. ch = this.nextChar();
  16787. const x2 = toHexDigit(ch);
  16788. if (x2 === -1) {
  16789. (0, _util.warn)(`Lexer_getName: Illegal digit (${String.fromCharCode(ch)}) ` + "in hexadecimal number.");
  16790. strBuf.push("#", String.fromCharCode(previousCh));
  16791. if (specialChars[ch]) {
  16792. break;
  16793. }
  16794. strBuf.push(String.fromCharCode(ch));
  16795. continue;
  16796. }
  16797. strBuf.push(String.fromCharCode(x << 4 | x2));
  16798. } else {
  16799. strBuf.push("#", String.fromCharCode(ch));
  16800. }
  16801. } else {
  16802. strBuf.push(String.fromCharCode(ch));
  16803. }
  16804. }
  16805. if (strBuf.length > 127) {
  16806. (0, _util.warn)(`Name token is longer than allowed by the spec: ${strBuf.length}`);
  16807. }
  16808. return _primitives.Name.get(strBuf.join(""));
  16809. }
  16810. _hexStringWarn(ch) {
  16811. const MAX_HEX_STRING_NUM_WARN = 5;
  16812. if (this._hexStringNumWarn++ === MAX_HEX_STRING_NUM_WARN) {
  16813. (0, _util.warn)("getHexString - ignoring additional invalid characters.");
  16814. return;
  16815. }
  16816. if (this._hexStringNumWarn > MAX_HEX_STRING_NUM_WARN) {
  16817. return;
  16818. }
  16819. (0, _util.warn)(`getHexString - ignoring invalid character: ${ch}`);
  16820. }
  16821. getHexString() {
  16822. const strBuf = this.strBuf;
  16823. strBuf.length = 0;
  16824. let ch = this.currentChar;
  16825. let isFirstHex = true;
  16826. let firstDigit, secondDigit;
  16827. this._hexStringNumWarn = 0;
  16828. while (true) {
  16829. if (ch < 0) {
  16830. (0, _util.warn)("Unterminated hex string");
  16831. break;
  16832. } else if (ch === 0x3e) {
  16833. this.nextChar();
  16834. break;
  16835. } else if (specialChars[ch] === 1) {
  16836. ch = this.nextChar();
  16837. continue;
  16838. } else {
  16839. if (isFirstHex) {
  16840. firstDigit = toHexDigit(ch);
  16841. if (firstDigit === -1) {
  16842. this._hexStringWarn(ch);
  16843. ch = this.nextChar();
  16844. continue;
  16845. }
  16846. } else {
  16847. secondDigit = toHexDigit(ch);
  16848. if (secondDigit === -1) {
  16849. this._hexStringWarn(ch);
  16850. ch = this.nextChar();
  16851. continue;
  16852. }
  16853. strBuf.push(String.fromCharCode(firstDigit << 4 | secondDigit));
  16854. }
  16855. isFirstHex = !isFirstHex;
  16856. ch = this.nextChar();
  16857. }
  16858. }
  16859. return strBuf.join("");
  16860. }
  16861. getObj() {
  16862. let comment = false;
  16863. let ch = this.currentChar;
  16864. while (true) {
  16865. if (ch < 0) {
  16866. return _primitives.EOF;
  16867. }
  16868. if (comment) {
  16869. if (ch === 0x0a || ch === 0x0d) {
  16870. comment = false;
  16871. }
  16872. } else if (ch === 0x25) {
  16873. comment = true;
  16874. } else if (specialChars[ch] !== 1) {
  16875. break;
  16876. }
  16877. ch = this.nextChar();
  16878. }
  16879. switch (ch | 0) {
  16880. case 0x30:
  16881. case 0x31:
  16882. case 0x32:
  16883. case 0x33:
  16884. case 0x34:
  16885. case 0x35:
  16886. case 0x36:
  16887. case 0x37:
  16888. case 0x38:
  16889. case 0x39:
  16890. case 0x2b:
  16891. case 0x2d:
  16892. case 0x2e:
  16893. return this.getNumber();
  16894. case 0x28:
  16895. return this.getString();
  16896. case 0x2f:
  16897. return this.getName();
  16898. case 0x5b:
  16899. this.nextChar();
  16900. return _primitives.Cmd.get("[");
  16901. case 0x5d:
  16902. this.nextChar();
  16903. return _primitives.Cmd.get("]");
  16904. case 0x3c:
  16905. ch = this.nextChar();
  16906. if (ch === 0x3c) {
  16907. this.nextChar();
  16908. return _primitives.Cmd.get("<<");
  16909. }
  16910. return this.getHexString();
  16911. case 0x3e:
  16912. ch = this.nextChar();
  16913. if (ch === 0x3e) {
  16914. this.nextChar();
  16915. return _primitives.Cmd.get(">>");
  16916. }
  16917. return _primitives.Cmd.get(">");
  16918. case 0x7b:
  16919. this.nextChar();
  16920. return _primitives.Cmd.get("{");
  16921. case 0x7d:
  16922. this.nextChar();
  16923. return _primitives.Cmd.get("}");
  16924. case 0x29:
  16925. this.nextChar();
  16926. throw new _util.FormatError(`Illegal character: ${ch}`);
  16927. }
  16928. let str = String.fromCharCode(ch);
  16929. if (ch < 0x20 || ch > 0x7f) {
  16930. const nextCh = this.peekChar();
  16931. if (nextCh >= 0x20 && nextCh <= 0x7f) {
  16932. this.nextChar();
  16933. return _primitives.Cmd.get(str);
  16934. }
  16935. }
  16936. const knownCommands = this.knownCommands;
  16937. let knownCommandFound = knownCommands && knownCommands[str] !== undefined;
  16938. while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
  16939. const possibleCommand = str + String.fromCharCode(ch);
  16940. if (knownCommandFound && knownCommands[possibleCommand] === undefined) {
  16941. break;
  16942. }
  16943. if (str.length === 128) {
  16944. throw new _util.FormatError(`Command token too long: ${str.length}`);
  16945. }
  16946. str = possibleCommand;
  16947. knownCommandFound = knownCommands && knownCommands[str] !== undefined;
  16948. }
  16949. if (str === "true") {
  16950. return true;
  16951. }
  16952. if (str === "false") {
  16953. return false;
  16954. }
  16955. if (str === "null") {
  16956. return null;
  16957. }
  16958. if (str === "BI") {
  16959. this.beginInlineImagePos = this.stream.pos;
  16960. }
  16961. return _primitives.Cmd.get(str);
  16962. }
  16963. peekObj() {
  16964. const streamPos = this.stream.pos,
  16965. currentChar = this.currentChar,
  16966. beginInlineImagePos = this.beginInlineImagePos;
  16967. let nextObj;
  16968. try {
  16969. nextObj = this.getObj();
  16970. } catch (ex) {
  16971. if (ex instanceof _core_utils.MissingDataException) {
  16972. throw ex;
  16973. }
  16974. (0, _util.warn)(`peekObj: ${ex}`);
  16975. }
  16976. this.stream.pos = streamPos;
  16977. this.currentChar = currentChar;
  16978. this.beginInlineImagePos = beginInlineImagePos;
  16979. return nextObj;
  16980. }
  16981. skipToNextLine() {
  16982. let ch = this.currentChar;
  16983. while (ch >= 0) {
  16984. if (ch === 0x0d) {
  16985. ch = this.nextChar();
  16986. if (ch === 0x0a) {
  16987. this.nextChar();
  16988. }
  16989. break;
  16990. } else if (ch === 0x0a) {
  16991. this.nextChar();
  16992. break;
  16993. }
  16994. ch = this.nextChar();
  16995. }
  16996. }
  16997. }
  16998. exports.Lexer = Lexer;
  16999. class Linearization {
  17000. static create(stream) {
  17001. function getInt(linDict, name) {
  17002. let allowZeroValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  17003. const obj = linDict.get(name);
  17004. if (Number.isInteger(obj) && (allowZeroValue ? obj >= 0 : obj > 0)) {
  17005. return obj;
  17006. }
  17007. throw new Error(`The "${name}" parameter in the linearization ` + "dictionary is invalid.");
  17008. }
  17009. function getHints(linDict) {
  17010. const hints = linDict.get("H");
  17011. let hintsLength;
  17012. if (Array.isArray(hints) && ((hintsLength = hints.length) === 2 || hintsLength === 4)) {
  17013. for (let index = 0; index < hintsLength; index++) {
  17014. const hint = hints[index];
  17015. if (!(Number.isInteger(hint) && hint > 0)) {
  17016. throw new Error(`Hint (${index}) in the linearization dictionary is invalid.`);
  17017. }
  17018. }
  17019. return hints;
  17020. }
  17021. throw new Error("Hint array in the linearization dictionary is invalid.");
  17022. }
  17023. const parser = new Parser({
  17024. lexer: new Lexer(stream),
  17025. xref: null
  17026. });
  17027. const obj1 = parser.getObj();
  17028. const obj2 = parser.getObj();
  17029. const obj3 = parser.getObj();
  17030. const linDict = parser.getObj();
  17031. let obj, length;
  17032. if (!(Number.isInteger(obj1) && Number.isInteger(obj2) && (0, _primitives.isCmd)(obj3, "obj") && linDict instanceof _primitives.Dict && typeof (obj = linDict.get("Linearized")) === "number" && obj > 0)) {
  17033. return null;
  17034. } else if ((length = getInt(linDict, "L")) !== stream.length) {
  17035. throw new Error('The "L" parameter in the linearization dictionary ' + "does not equal the stream length.");
  17036. }
  17037. return {
  17038. length,
  17039. hints: getHints(linDict),
  17040. objectNumberFirst: getInt(linDict, "O"),
  17041. endFirst: getInt(linDict, "E"),
  17042. numPages: getInt(linDict, "N"),
  17043. mainXRefEntriesOffset: getInt(linDict, "T"),
  17044. pageFirst: linDict.has("P") ? getInt(linDict, "P", true) : 0
  17045. };
  17046. }
  17047. }
  17048. exports.Linearization = Linearization;
  17049. /***/ }),
  17050. /* 147 */
  17051. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  17052. "use strict";
  17053. Object.defineProperty(exports, "__esModule", ({
  17054. value: true
  17055. }));
  17056. exports.Ascii85Stream = void 0;
  17057. var _decode_stream = __w_pdfjs_require__(148);
  17058. var _core_utils = __w_pdfjs_require__(135);
  17059. class Ascii85Stream extends _decode_stream.DecodeStream {
  17060. constructor(str, maybeLength) {
  17061. if (maybeLength) {
  17062. maybeLength *= 0.8;
  17063. }
  17064. super(maybeLength);
  17065. this.str = str;
  17066. this.dict = str.dict;
  17067. this.input = new Uint8Array(5);
  17068. }
  17069. readBlock() {
  17070. const TILDA_CHAR = 0x7e;
  17071. const Z_LOWER_CHAR = 0x7a;
  17072. const EOF = -1;
  17073. const str = this.str;
  17074. let c = str.getByte();
  17075. while ((0, _core_utils.isWhiteSpace)(c)) {
  17076. c = str.getByte();
  17077. }
  17078. if (c === EOF || c === TILDA_CHAR) {
  17079. this.eof = true;
  17080. return;
  17081. }
  17082. const bufferLength = this.bufferLength;
  17083. let buffer, i;
  17084. if (c === Z_LOWER_CHAR) {
  17085. buffer = this.ensureBuffer(bufferLength + 4);
  17086. for (i = 0; i < 4; ++i) {
  17087. buffer[bufferLength + i] = 0;
  17088. }
  17089. this.bufferLength += 4;
  17090. } else {
  17091. const input = this.input;
  17092. input[0] = c;
  17093. for (i = 1; i < 5; ++i) {
  17094. c = str.getByte();
  17095. while ((0, _core_utils.isWhiteSpace)(c)) {
  17096. c = str.getByte();
  17097. }
  17098. input[i] = c;
  17099. if (c === EOF || c === TILDA_CHAR) {
  17100. break;
  17101. }
  17102. }
  17103. buffer = this.ensureBuffer(bufferLength + i - 1);
  17104. this.bufferLength += i - 1;
  17105. if (i < 5) {
  17106. for (; i < 5; ++i) {
  17107. input[i] = 0x21 + 84;
  17108. }
  17109. this.eof = true;
  17110. }
  17111. let t = 0;
  17112. for (i = 0; i < 5; ++i) {
  17113. t = t * 85 + (input[i] - 0x21);
  17114. }
  17115. for (i = 3; i >= 0; --i) {
  17116. buffer[bufferLength + i] = t & 0xff;
  17117. t >>= 8;
  17118. }
  17119. }
  17120. }
  17121. }
  17122. exports.Ascii85Stream = Ascii85Stream;
  17123. /***/ }),
  17124. /* 148 */
  17125. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  17126. "use strict";
  17127. Object.defineProperty(exports, "__esModule", ({
  17128. value: true
  17129. }));
  17130. exports.StreamsSequenceStream = exports.DecodeStream = void 0;
  17131. var _base_stream = __w_pdfjs_require__(136);
  17132. var _stream = __w_pdfjs_require__(139);
  17133. const emptyBuffer = new Uint8Array(0);
  17134. class DecodeStream extends _base_stream.BaseStream {
  17135. constructor(maybeMinBufferLength) {
  17136. super();
  17137. this._rawMinBufferLength = maybeMinBufferLength || 0;
  17138. this.pos = 0;
  17139. this.bufferLength = 0;
  17140. this.eof = false;
  17141. this.buffer = emptyBuffer;
  17142. this.minBufferLength = 512;
  17143. if (maybeMinBufferLength) {
  17144. while (this.minBufferLength < maybeMinBufferLength) {
  17145. this.minBufferLength *= 2;
  17146. }
  17147. }
  17148. }
  17149. get isEmpty() {
  17150. while (!this.eof && this.bufferLength === 0) {
  17151. this.readBlock();
  17152. }
  17153. return this.bufferLength === 0;
  17154. }
  17155. ensureBuffer(requested) {
  17156. const buffer = this.buffer;
  17157. if (requested <= buffer.byteLength) {
  17158. return buffer;
  17159. }
  17160. let size = this.minBufferLength;
  17161. while (size < requested) {
  17162. size *= 2;
  17163. }
  17164. const buffer2 = new Uint8Array(size);
  17165. buffer2.set(buffer);
  17166. return this.buffer = buffer2;
  17167. }
  17168. getByte() {
  17169. const pos = this.pos;
  17170. while (this.bufferLength <= pos) {
  17171. if (this.eof) {
  17172. return -1;
  17173. }
  17174. this.readBlock();
  17175. }
  17176. return this.buffer[this.pos++];
  17177. }
  17178. getBytes(length) {
  17179. const pos = this.pos;
  17180. let end;
  17181. if (length) {
  17182. this.ensureBuffer(pos + length);
  17183. end = pos + length;
  17184. while (!this.eof && this.bufferLength < end) {
  17185. this.readBlock();
  17186. }
  17187. const bufEnd = this.bufferLength;
  17188. if (end > bufEnd) {
  17189. end = bufEnd;
  17190. }
  17191. } else {
  17192. while (!this.eof) {
  17193. this.readBlock();
  17194. }
  17195. end = this.bufferLength;
  17196. }
  17197. this.pos = end;
  17198. return this.buffer.subarray(pos, end);
  17199. }
  17200. reset() {
  17201. this.pos = 0;
  17202. }
  17203. makeSubStream(start, length) {
  17204. let dict = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  17205. if (length === undefined) {
  17206. while (!this.eof) {
  17207. this.readBlock();
  17208. }
  17209. } else {
  17210. const end = start + length;
  17211. while (this.bufferLength <= end && !this.eof) {
  17212. this.readBlock();
  17213. }
  17214. }
  17215. return new _stream.Stream(this.buffer, start, length, dict);
  17216. }
  17217. getBaseStreams() {
  17218. return this.str ? this.str.getBaseStreams() : null;
  17219. }
  17220. }
  17221. exports.DecodeStream = DecodeStream;
  17222. class StreamsSequenceStream extends DecodeStream {
  17223. constructor(streams) {
  17224. let onError = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  17225. let maybeLength = 0;
  17226. for (const stream of streams) {
  17227. maybeLength += stream instanceof DecodeStream ? stream._rawMinBufferLength : stream.length;
  17228. }
  17229. super(maybeLength);
  17230. this.streams = streams;
  17231. this._onError = onError;
  17232. }
  17233. readBlock() {
  17234. const streams = this.streams;
  17235. if (streams.length === 0) {
  17236. this.eof = true;
  17237. return;
  17238. }
  17239. const stream = streams.shift();
  17240. let chunk;
  17241. try {
  17242. chunk = stream.getBytes();
  17243. } catch (reason) {
  17244. if (this._onError) {
  17245. this._onError(reason, stream.dict && stream.dict.objId);
  17246. return;
  17247. }
  17248. throw reason;
  17249. }
  17250. const bufferLength = this.bufferLength;
  17251. const newLength = bufferLength + chunk.length;
  17252. const buffer = this.ensureBuffer(newLength);
  17253. buffer.set(chunk, bufferLength);
  17254. this.bufferLength = newLength;
  17255. }
  17256. getBaseStreams() {
  17257. const baseStreamsBuf = [];
  17258. for (const stream of this.streams) {
  17259. const baseStreams = stream.getBaseStreams();
  17260. if (baseStreams) {
  17261. baseStreamsBuf.push(...baseStreams);
  17262. }
  17263. }
  17264. return baseStreamsBuf.length > 0 ? baseStreamsBuf : null;
  17265. }
  17266. }
  17267. exports.StreamsSequenceStream = StreamsSequenceStream;
  17268. /***/ }),
  17269. /* 149 */
  17270. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  17271. "use strict";
  17272. Object.defineProperty(exports, "__esModule", ({
  17273. value: true
  17274. }));
  17275. exports.AsciiHexStream = void 0;
  17276. var _decode_stream = __w_pdfjs_require__(148);
  17277. class AsciiHexStream extends _decode_stream.DecodeStream {
  17278. constructor(str, maybeLength) {
  17279. if (maybeLength) {
  17280. maybeLength *= 0.5;
  17281. }
  17282. super(maybeLength);
  17283. this.str = str;
  17284. this.dict = str.dict;
  17285. this.firstDigit = -1;
  17286. }
  17287. readBlock() {
  17288. const UPSTREAM_BLOCK_SIZE = 8000;
  17289. const bytes = this.str.getBytes(UPSTREAM_BLOCK_SIZE);
  17290. if (!bytes.length) {
  17291. this.eof = true;
  17292. return;
  17293. }
  17294. const maxDecodeLength = bytes.length + 1 >> 1;
  17295. const buffer = this.ensureBuffer(this.bufferLength + maxDecodeLength);
  17296. let bufferLength = this.bufferLength;
  17297. let firstDigit = this.firstDigit;
  17298. for (const ch of bytes) {
  17299. let digit;
  17300. if (ch >= 0x30 && ch <= 0x39) {
  17301. digit = ch & 0x0f;
  17302. } else if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {
  17303. digit = (ch & 0x0f) + 9;
  17304. } else if (ch === 0x3e) {
  17305. this.eof = true;
  17306. break;
  17307. } else {
  17308. continue;
  17309. }
  17310. if (firstDigit < 0) {
  17311. firstDigit = digit;
  17312. } else {
  17313. buffer[bufferLength++] = firstDigit << 4 | digit;
  17314. firstDigit = -1;
  17315. }
  17316. }
  17317. if (firstDigit >= 0 && this.eof) {
  17318. buffer[bufferLength++] = firstDigit << 4;
  17319. firstDigit = -1;
  17320. }
  17321. this.firstDigit = firstDigit;
  17322. this.bufferLength = bufferLength;
  17323. }
  17324. }
  17325. exports.AsciiHexStream = AsciiHexStream;
  17326. /***/ }),
  17327. /* 150 */
  17328. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  17329. "use strict";
  17330. Object.defineProperty(exports, "__esModule", ({
  17331. value: true
  17332. }));
  17333. exports.CCITTFaxStream = void 0;
  17334. var _ccitt = __w_pdfjs_require__(151);
  17335. var _decode_stream = __w_pdfjs_require__(148);
  17336. var _primitives = __w_pdfjs_require__(134);
  17337. class CCITTFaxStream extends _decode_stream.DecodeStream {
  17338. constructor(str, maybeLength, params) {
  17339. super(maybeLength);
  17340. this.str = str;
  17341. this.dict = str.dict;
  17342. if (!(params instanceof _primitives.Dict)) {
  17343. params = _primitives.Dict.empty;
  17344. }
  17345. const source = {
  17346. next() {
  17347. return str.getByte();
  17348. }
  17349. };
  17350. this.ccittFaxDecoder = new _ccitt.CCITTFaxDecoder(source, {
  17351. K: params.get("K"),
  17352. EndOfLine: params.get("EndOfLine"),
  17353. EncodedByteAlign: params.get("EncodedByteAlign"),
  17354. Columns: params.get("Columns"),
  17355. Rows: params.get("Rows"),
  17356. EndOfBlock: params.get("EndOfBlock"),
  17357. BlackIs1: params.get("BlackIs1")
  17358. });
  17359. }
  17360. readBlock() {
  17361. while (!this.eof) {
  17362. const c = this.ccittFaxDecoder.readNextChar();
  17363. if (c === -1) {
  17364. this.eof = true;
  17365. return;
  17366. }
  17367. this.ensureBuffer(this.bufferLength + 1);
  17368. this.buffer[this.bufferLength++] = c;
  17369. }
  17370. }
  17371. }
  17372. exports.CCITTFaxStream = CCITTFaxStream;
  17373. /***/ }),
  17374. /* 151 */
  17375. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  17376. "use strict";
  17377. Object.defineProperty(exports, "__esModule", ({
  17378. value: true
  17379. }));
  17380. exports.CCITTFaxDecoder = void 0;
  17381. var _util = __w_pdfjs_require__(2);
  17382. const ccittEOL = -2;
  17383. const ccittEOF = -1;
  17384. const twoDimPass = 0;
  17385. const twoDimHoriz = 1;
  17386. const twoDimVert0 = 2;
  17387. const twoDimVertR1 = 3;
  17388. const twoDimVertL1 = 4;
  17389. const twoDimVertR2 = 5;
  17390. const twoDimVertL2 = 6;
  17391. const twoDimVertR3 = 7;
  17392. const twoDimVertL3 = 8;
  17393. 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]];
  17394. 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]];
  17395. 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]];
  17396. 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]];
  17397. 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]];
  17398. 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]];
  17399. class CCITTFaxDecoder {
  17400. constructor(source) {
  17401. let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  17402. if (!source || typeof source.next !== "function") {
  17403. throw new Error('CCITTFaxDecoder - invalid "source" parameter.');
  17404. }
  17405. this.source = source;
  17406. this.eof = false;
  17407. this.encoding = options.K || 0;
  17408. this.eoline = options.EndOfLine || false;
  17409. this.byteAlign = options.EncodedByteAlign || false;
  17410. this.columns = options.Columns || 1728;
  17411. this.rows = options.Rows || 0;
  17412. let eoblock = options.EndOfBlock;
  17413. if (eoblock === null || eoblock === undefined) {
  17414. eoblock = true;
  17415. }
  17416. this.eoblock = eoblock;
  17417. this.black = options.BlackIs1 || false;
  17418. this.codingLine = new Uint32Array(this.columns + 1);
  17419. this.refLine = new Uint32Array(this.columns + 2);
  17420. this.codingLine[0] = this.columns;
  17421. this.codingPos = 0;
  17422. this.row = 0;
  17423. this.nextLine2D = this.encoding < 0;
  17424. this.inputBits = 0;
  17425. this.inputBuf = 0;
  17426. this.outputBits = 0;
  17427. this.rowsDone = false;
  17428. let code1;
  17429. while ((code1 = this._lookBits(12)) === 0) {
  17430. this._eatBits(1);
  17431. }
  17432. if (code1 === 1) {
  17433. this._eatBits(12);
  17434. }
  17435. if (this.encoding > 0) {
  17436. this.nextLine2D = !this._lookBits(1);
  17437. this._eatBits(1);
  17438. }
  17439. }
  17440. readNextChar() {
  17441. if (this.eof) {
  17442. return -1;
  17443. }
  17444. const refLine = this.refLine;
  17445. const codingLine = this.codingLine;
  17446. const columns = this.columns;
  17447. let refPos, blackPixels, bits, i;
  17448. if (this.outputBits === 0) {
  17449. if (this.rowsDone) {
  17450. this.eof = true;
  17451. }
  17452. if (this.eof) {
  17453. return -1;
  17454. }
  17455. this.err = false;
  17456. let code1, code2, code3;
  17457. if (this.nextLine2D) {
  17458. for (i = 0; codingLine[i] < columns; ++i) {
  17459. refLine[i] = codingLine[i];
  17460. }
  17461. refLine[i++] = columns;
  17462. refLine[i] = columns;
  17463. codingLine[0] = 0;
  17464. this.codingPos = 0;
  17465. refPos = 0;
  17466. blackPixels = 0;
  17467. while (codingLine[this.codingPos] < columns) {
  17468. code1 = this._getTwoDimCode();
  17469. switch (code1) {
  17470. case twoDimPass:
  17471. this._addPixels(refLine[refPos + 1], blackPixels);
  17472. if (refLine[refPos + 1] < columns) {
  17473. refPos += 2;
  17474. }
  17475. break;
  17476. case twoDimHoriz:
  17477. code1 = code2 = 0;
  17478. if (blackPixels) {
  17479. do {
  17480. code1 += code3 = this._getBlackCode();
  17481. } while (code3 >= 64);
  17482. do {
  17483. code2 += code3 = this._getWhiteCode();
  17484. } while (code3 >= 64);
  17485. } else {
  17486. do {
  17487. code1 += code3 = this._getWhiteCode();
  17488. } while (code3 >= 64);
  17489. do {
  17490. code2 += code3 = this._getBlackCode();
  17491. } while (code3 >= 64);
  17492. }
  17493. this._addPixels(codingLine[this.codingPos] + code1, blackPixels);
  17494. if (codingLine[this.codingPos] < columns) {
  17495. this._addPixels(codingLine[this.codingPos] + code2, blackPixels ^ 1);
  17496. }
  17497. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  17498. refPos += 2;
  17499. }
  17500. break;
  17501. case twoDimVertR3:
  17502. this._addPixels(refLine[refPos] + 3, blackPixels);
  17503. blackPixels ^= 1;
  17504. if (codingLine[this.codingPos] < columns) {
  17505. ++refPos;
  17506. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  17507. refPos += 2;
  17508. }
  17509. }
  17510. break;
  17511. case twoDimVertR2:
  17512. this._addPixels(refLine[refPos] + 2, blackPixels);
  17513. blackPixels ^= 1;
  17514. if (codingLine[this.codingPos] < columns) {
  17515. ++refPos;
  17516. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  17517. refPos += 2;
  17518. }
  17519. }
  17520. break;
  17521. case twoDimVertR1:
  17522. this._addPixels(refLine[refPos] + 1, blackPixels);
  17523. blackPixels ^= 1;
  17524. if (codingLine[this.codingPos] < columns) {
  17525. ++refPos;
  17526. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  17527. refPos += 2;
  17528. }
  17529. }
  17530. break;
  17531. case twoDimVert0:
  17532. this._addPixels(refLine[refPos], blackPixels);
  17533. blackPixels ^= 1;
  17534. if (codingLine[this.codingPos] < columns) {
  17535. ++refPos;
  17536. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  17537. refPos += 2;
  17538. }
  17539. }
  17540. break;
  17541. case twoDimVertL3:
  17542. this._addPixelsNeg(refLine[refPos] - 3, blackPixels);
  17543. blackPixels ^= 1;
  17544. if (codingLine[this.codingPos] < columns) {
  17545. if (refPos > 0) {
  17546. --refPos;
  17547. } else {
  17548. ++refPos;
  17549. }
  17550. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  17551. refPos += 2;
  17552. }
  17553. }
  17554. break;
  17555. case twoDimVertL2:
  17556. this._addPixelsNeg(refLine[refPos] - 2, blackPixels);
  17557. blackPixels ^= 1;
  17558. if (codingLine[this.codingPos] < columns) {
  17559. if (refPos > 0) {
  17560. --refPos;
  17561. } else {
  17562. ++refPos;
  17563. }
  17564. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  17565. refPos += 2;
  17566. }
  17567. }
  17568. break;
  17569. case twoDimVertL1:
  17570. this._addPixelsNeg(refLine[refPos] - 1, blackPixels);
  17571. blackPixels ^= 1;
  17572. if (codingLine[this.codingPos] < columns) {
  17573. if (refPos > 0) {
  17574. --refPos;
  17575. } else {
  17576. ++refPos;
  17577. }
  17578. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  17579. refPos += 2;
  17580. }
  17581. }
  17582. break;
  17583. case ccittEOF:
  17584. this._addPixels(columns, 0);
  17585. this.eof = true;
  17586. break;
  17587. default:
  17588. (0, _util.info)("bad 2d code");
  17589. this._addPixels(columns, 0);
  17590. this.err = true;
  17591. }
  17592. }
  17593. } else {
  17594. codingLine[0] = 0;
  17595. this.codingPos = 0;
  17596. blackPixels = 0;
  17597. while (codingLine[this.codingPos] < columns) {
  17598. code1 = 0;
  17599. if (blackPixels) {
  17600. do {
  17601. code1 += code3 = this._getBlackCode();
  17602. } while (code3 >= 64);
  17603. } else {
  17604. do {
  17605. code1 += code3 = this._getWhiteCode();
  17606. } while (code3 >= 64);
  17607. }
  17608. this._addPixels(codingLine[this.codingPos] + code1, blackPixels);
  17609. blackPixels ^= 1;
  17610. }
  17611. }
  17612. let gotEOL = false;
  17613. if (this.byteAlign) {
  17614. this.inputBits &= ~7;
  17615. }
  17616. if (!this.eoblock && this.row === this.rows - 1) {
  17617. this.rowsDone = true;
  17618. } else {
  17619. code1 = this._lookBits(12);
  17620. if (this.eoline) {
  17621. while (code1 !== ccittEOF && code1 !== 1) {
  17622. this._eatBits(1);
  17623. code1 = this._lookBits(12);
  17624. }
  17625. } else {
  17626. while (code1 === 0) {
  17627. this._eatBits(1);
  17628. code1 = this._lookBits(12);
  17629. }
  17630. }
  17631. if (code1 === 1) {
  17632. this._eatBits(12);
  17633. gotEOL = true;
  17634. } else if (code1 === ccittEOF) {
  17635. this.eof = true;
  17636. }
  17637. }
  17638. if (!this.eof && this.encoding > 0 && !this.rowsDone) {
  17639. this.nextLine2D = !this._lookBits(1);
  17640. this._eatBits(1);
  17641. }
  17642. if (this.eoblock && gotEOL && this.byteAlign) {
  17643. code1 = this._lookBits(12);
  17644. if (code1 === 1) {
  17645. this._eatBits(12);
  17646. if (this.encoding > 0) {
  17647. this._lookBits(1);
  17648. this._eatBits(1);
  17649. }
  17650. if (this.encoding >= 0) {
  17651. for (i = 0; i < 4; ++i) {
  17652. code1 = this._lookBits(12);
  17653. if (code1 !== 1) {
  17654. (0, _util.info)("bad rtc code: " + code1);
  17655. }
  17656. this._eatBits(12);
  17657. if (this.encoding > 0) {
  17658. this._lookBits(1);
  17659. this._eatBits(1);
  17660. }
  17661. }
  17662. }
  17663. this.eof = true;
  17664. }
  17665. } else if (this.err && this.eoline) {
  17666. while (true) {
  17667. code1 = this._lookBits(13);
  17668. if (code1 === ccittEOF) {
  17669. this.eof = true;
  17670. return -1;
  17671. }
  17672. if (code1 >> 1 === 1) {
  17673. break;
  17674. }
  17675. this._eatBits(1);
  17676. }
  17677. this._eatBits(12);
  17678. if (this.encoding > 0) {
  17679. this._eatBits(1);
  17680. this.nextLine2D = !(code1 & 1);
  17681. }
  17682. }
  17683. if (codingLine[0] > 0) {
  17684. this.outputBits = codingLine[this.codingPos = 0];
  17685. } else {
  17686. this.outputBits = codingLine[this.codingPos = 1];
  17687. }
  17688. this.row++;
  17689. }
  17690. let c;
  17691. if (this.outputBits >= 8) {
  17692. c = this.codingPos & 1 ? 0 : 0xff;
  17693. this.outputBits -= 8;
  17694. if (this.outputBits === 0 && codingLine[this.codingPos] < columns) {
  17695. this.codingPos++;
  17696. this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];
  17697. }
  17698. } else {
  17699. bits = 8;
  17700. c = 0;
  17701. do {
  17702. if (typeof this.outputBits !== "number") {
  17703. throw new _util.FormatError('Invalid /CCITTFaxDecode data, "outputBits" must be a number.');
  17704. }
  17705. if (this.outputBits > bits) {
  17706. c <<= bits;
  17707. if (!(this.codingPos & 1)) {
  17708. c |= 0xff >> 8 - bits;
  17709. }
  17710. this.outputBits -= bits;
  17711. bits = 0;
  17712. } else {
  17713. c <<= this.outputBits;
  17714. if (!(this.codingPos & 1)) {
  17715. c |= 0xff >> 8 - this.outputBits;
  17716. }
  17717. bits -= this.outputBits;
  17718. this.outputBits = 0;
  17719. if (codingLine[this.codingPos] < columns) {
  17720. this.codingPos++;
  17721. this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];
  17722. } else if (bits > 0) {
  17723. c <<= bits;
  17724. bits = 0;
  17725. }
  17726. }
  17727. } while (bits);
  17728. }
  17729. if (this.black) {
  17730. c ^= 0xff;
  17731. }
  17732. return c;
  17733. }
  17734. _addPixels(a1, blackPixels) {
  17735. const codingLine = this.codingLine;
  17736. let codingPos = this.codingPos;
  17737. if (a1 > codingLine[codingPos]) {
  17738. if (a1 > this.columns) {
  17739. (0, _util.info)("row is wrong length");
  17740. this.err = true;
  17741. a1 = this.columns;
  17742. }
  17743. if (codingPos & 1 ^ blackPixels) {
  17744. ++codingPos;
  17745. }
  17746. codingLine[codingPos] = a1;
  17747. }
  17748. this.codingPos = codingPos;
  17749. }
  17750. _addPixelsNeg(a1, blackPixels) {
  17751. const codingLine = this.codingLine;
  17752. let codingPos = this.codingPos;
  17753. if (a1 > codingLine[codingPos]) {
  17754. if (a1 > this.columns) {
  17755. (0, _util.info)("row is wrong length");
  17756. this.err = true;
  17757. a1 = this.columns;
  17758. }
  17759. if (codingPos & 1 ^ blackPixels) {
  17760. ++codingPos;
  17761. }
  17762. codingLine[codingPos] = a1;
  17763. } else if (a1 < codingLine[codingPos]) {
  17764. if (a1 < 0) {
  17765. (0, _util.info)("invalid code");
  17766. this.err = true;
  17767. a1 = 0;
  17768. }
  17769. while (codingPos > 0 && a1 < codingLine[codingPos - 1]) {
  17770. --codingPos;
  17771. }
  17772. codingLine[codingPos] = a1;
  17773. }
  17774. this.codingPos = codingPos;
  17775. }
  17776. _findTableCode(start, end, table, limit) {
  17777. const limitValue = limit || 0;
  17778. for (let i = start; i <= end; ++i) {
  17779. let code = this._lookBits(i);
  17780. if (code === ccittEOF) {
  17781. return [true, 1, false];
  17782. }
  17783. if (i < end) {
  17784. code <<= end - i;
  17785. }
  17786. if (!limitValue || code >= limitValue) {
  17787. const p = table[code - limitValue];
  17788. if (p[0] === i) {
  17789. this._eatBits(i);
  17790. return [true, p[1], true];
  17791. }
  17792. }
  17793. }
  17794. return [false, 0, false];
  17795. }
  17796. _getTwoDimCode() {
  17797. let code = 0;
  17798. let p;
  17799. if (this.eoblock) {
  17800. code = this._lookBits(7);
  17801. p = twoDimTable[code];
  17802. if (p && p[0] > 0) {
  17803. this._eatBits(p[0]);
  17804. return p[1];
  17805. }
  17806. } else {
  17807. const result = this._findTableCode(1, 7, twoDimTable);
  17808. if (result[0] && result[2]) {
  17809. return result[1];
  17810. }
  17811. }
  17812. (0, _util.info)("Bad two dim code");
  17813. return ccittEOF;
  17814. }
  17815. _getWhiteCode() {
  17816. let code = 0;
  17817. let p;
  17818. if (this.eoblock) {
  17819. code = this._lookBits(12);
  17820. if (code === ccittEOF) {
  17821. return 1;
  17822. }
  17823. if (code >> 5 === 0) {
  17824. p = whiteTable1[code];
  17825. } else {
  17826. p = whiteTable2[code >> 3];
  17827. }
  17828. if (p[0] > 0) {
  17829. this._eatBits(p[0]);
  17830. return p[1];
  17831. }
  17832. } else {
  17833. let result = this._findTableCode(1, 9, whiteTable2);
  17834. if (result[0]) {
  17835. return result[1];
  17836. }
  17837. result = this._findTableCode(11, 12, whiteTable1);
  17838. if (result[0]) {
  17839. return result[1];
  17840. }
  17841. }
  17842. (0, _util.info)("bad white code");
  17843. this._eatBits(1);
  17844. return 1;
  17845. }
  17846. _getBlackCode() {
  17847. let code, p;
  17848. if (this.eoblock) {
  17849. code = this._lookBits(13);
  17850. if (code === ccittEOF) {
  17851. return 1;
  17852. }
  17853. if (code >> 7 === 0) {
  17854. p = blackTable1[code];
  17855. } else if (code >> 9 === 0 && code >> 7 !== 0) {
  17856. p = blackTable2[(code >> 1) - 64];
  17857. } else {
  17858. p = blackTable3[code >> 7];
  17859. }
  17860. if (p[0] > 0) {
  17861. this._eatBits(p[0]);
  17862. return p[1];
  17863. }
  17864. } else {
  17865. let result = this._findTableCode(2, 6, blackTable3);
  17866. if (result[0]) {
  17867. return result[1];
  17868. }
  17869. result = this._findTableCode(7, 12, blackTable2, 64);
  17870. if (result[0]) {
  17871. return result[1];
  17872. }
  17873. result = this._findTableCode(10, 13, blackTable1);
  17874. if (result[0]) {
  17875. return result[1];
  17876. }
  17877. }
  17878. (0, _util.info)("bad black code");
  17879. this._eatBits(1);
  17880. return 1;
  17881. }
  17882. _lookBits(n) {
  17883. let c;
  17884. while (this.inputBits < n) {
  17885. if ((c = this.source.next()) === -1) {
  17886. if (this.inputBits === 0) {
  17887. return ccittEOF;
  17888. }
  17889. return this.inputBuf << n - this.inputBits & 0xffff >> 16 - n;
  17890. }
  17891. this.inputBuf = this.inputBuf << 8 | c;
  17892. this.inputBits += 8;
  17893. }
  17894. return this.inputBuf >> this.inputBits - n & 0xffff >> 16 - n;
  17895. }
  17896. _eatBits(n) {
  17897. if ((this.inputBits -= n) < 0) {
  17898. this.inputBits = 0;
  17899. }
  17900. }
  17901. }
  17902. exports.CCITTFaxDecoder = CCITTFaxDecoder;
  17903. /***/ }),
  17904. /* 152 */
  17905. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  17906. "use strict";
  17907. Object.defineProperty(exports, "__esModule", ({
  17908. value: true
  17909. }));
  17910. exports.FlateStream = void 0;
  17911. var _decode_stream = __w_pdfjs_require__(148);
  17912. var _util = __w_pdfjs_require__(2);
  17913. const codeLenCodeMap = new Int32Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]);
  17914. 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]);
  17915. 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]);
  17916. 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];
  17917. 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];
  17918. class FlateStream extends _decode_stream.DecodeStream {
  17919. constructor(str, maybeLength) {
  17920. super(maybeLength);
  17921. this.str = str;
  17922. this.dict = str.dict;
  17923. const cmf = str.getByte();
  17924. const flg = str.getByte();
  17925. if (cmf === -1 || flg === -1) {
  17926. throw new _util.FormatError(`Invalid header in flate stream: ${cmf}, ${flg}`);
  17927. }
  17928. if ((cmf & 0x0f) !== 0x08) {
  17929. throw new _util.FormatError(`Unknown compression method in flate stream: ${cmf}, ${flg}`);
  17930. }
  17931. if (((cmf << 8) + flg) % 31 !== 0) {
  17932. throw new _util.FormatError(`Bad FCHECK in flate stream: ${cmf}, ${flg}`);
  17933. }
  17934. if (flg & 0x20) {
  17935. throw new _util.FormatError(`FDICT bit set in flate stream: ${cmf}, ${flg}`);
  17936. }
  17937. this.codeSize = 0;
  17938. this.codeBuf = 0;
  17939. }
  17940. getBits(bits) {
  17941. const str = this.str;
  17942. let codeSize = this.codeSize;
  17943. let codeBuf = this.codeBuf;
  17944. let b;
  17945. while (codeSize < bits) {
  17946. if ((b = str.getByte()) === -1) {
  17947. throw new _util.FormatError("Bad encoding in flate stream");
  17948. }
  17949. codeBuf |= b << codeSize;
  17950. codeSize += 8;
  17951. }
  17952. b = codeBuf & (1 << bits) - 1;
  17953. this.codeBuf = codeBuf >> bits;
  17954. this.codeSize = codeSize -= bits;
  17955. return b;
  17956. }
  17957. getCode(table) {
  17958. const str = this.str;
  17959. const codes = table[0];
  17960. const maxLen = table[1];
  17961. let codeSize = this.codeSize;
  17962. let codeBuf = this.codeBuf;
  17963. let b;
  17964. while (codeSize < maxLen) {
  17965. if ((b = str.getByte()) === -1) {
  17966. break;
  17967. }
  17968. codeBuf |= b << codeSize;
  17969. codeSize += 8;
  17970. }
  17971. const code = codes[codeBuf & (1 << maxLen) - 1];
  17972. const codeLen = code >> 16;
  17973. const codeVal = code & 0xffff;
  17974. if (codeLen < 1 || codeSize < codeLen) {
  17975. throw new _util.FormatError("Bad encoding in flate stream");
  17976. }
  17977. this.codeBuf = codeBuf >> codeLen;
  17978. this.codeSize = codeSize - codeLen;
  17979. return codeVal;
  17980. }
  17981. generateHuffmanTable(lengths) {
  17982. const n = lengths.length;
  17983. let maxLen = 0;
  17984. let i;
  17985. for (i = 0; i < n; ++i) {
  17986. if (lengths[i] > maxLen) {
  17987. maxLen = lengths[i];
  17988. }
  17989. }
  17990. const size = 1 << maxLen;
  17991. const codes = new Int32Array(size);
  17992. for (let len = 1, code = 0, skip = 2; len <= maxLen; ++len, code <<= 1, skip <<= 1) {
  17993. for (let val = 0; val < n; ++val) {
  17994. if (lengths[val] === len) {
  17995. let code2 = 0;
  17996. let t = code;
  17997. for (i = 0; i < len; ++i) {
  17998. code2 = code2 << 1 | t & 1;
  17999. t >>= 1;
  18000. }
  18001. for (i = code2; i < size; i += skip) {
  18002. codes[i] = len << 16 | val;
  18003. }
  18004. ++code;
  18005. }
  18006. }
  18007. }
  18008. return [codes, maxLen];
  18009. }
  18010. readBlock() {
  18011. let buffer, len;
  18012. const str = this.str;
  18013. let hdr = this.getBits(3);
  18014. if (hdr & 1) {
  18015. this.eof = true;
  18016. }
  18017. hdr >>= 1;
  18018. if (hdr === 0) {
  18019. let b;
  18020. if ((b = str.getByte()) === -1) {
  18021. throw new _util.FormatError("Bad block header in flate stream");
  18022. }
  18023. let blockLen = b;
  18024. if ((b = str.getByte()) === -1) {
  18025. throw new _util.FormatError("Bad block header in flate stream");
  18026. }
  18027. blockLen |= b << 8;
  18028. if ((b = str.getByte()) === -1) {
  18029. throw new _util.FormatError("Bad block header in flate stream");
  18030. }
  18031. let check = b;
  18032. if ((b = str.getByte()) === -1) {
  18033. throw new _util.FormatError("Bad block header in flate stream");
  18034. }
  18035. check |= b << 8;
  18036. if (check !== (~blockLen & 0xffff) && (blockLen !== 0 || check !== 0)) {
  18037. throw new _util.FormatError("Bad uncompressed block length in flate stream");
  18038. }
  18039. this.codeBuf = 0;
  18040. this.codeSize = 0;
  18041. const bufferLength = this.bufferLength,
  18042. end = bufferLength + blockLen;
  18043. buffer = this.ensureBuffer(end);
  18044. this.bufferLength = end;
  18045. if (blockLen === 0) {
  18046. if (str.peekByte() === -1) {
  18047. this.eof = true;
  18048. }
  18049. } else {
  18050. const block = str.getBytes(blockLen);
  18051. buffer.set(block, bufferLength);
  18052. if (block.length < blockLen) {
  18053. this.eof = true;
  18054. }
  18055. }
  18056. return;
  18057. }
  18058. let litCodeTable;
  18059. let distCodeTable;
  18060. if (hdr === 1) {
  18061. litCodeTable = fixedLitCodeTab;
  18062. distCodeTable = fixedDistCodeTab;
  18063. } else if (hdr === 2) {
  18064. const numLitCodes = this.getBits(5) + 257;
  18065. const numDistCodes = this.getBits(5) + 1;
  18066. const numCodeLenCodes = this.getBits(4) + 4;
  18067. const codeLenCodeLengths = new Uint8Array(codeLenCodeMap.length);
  18068. let i;
  18069. for (i = 0; i < numCodeLenCodes; ++i) {
  18070. codeLenCodeLengths[codeLenCodeMap[i]] = this.getBits(3);
  18071. }
  18072. const codeLenCodeTab = this.generateHuffmanTable(codeLenCodeLengths);
  18073. len = 0;
  18074. i = 0;
  18075. const codes = numLitCodes + numDistCodes;
  18076. const codeLengths = new Uint8Array(codes);
  18077. let bitsLength, bitsOffset, what;
  18078. while (i < codes) {
  18079. const code = this.getCode(codeLenCodeTab);
  18080. if (code === 16) {
  18081. bitsLength = 2;
  18082. bitsOffset = 3;
  18083. what = len;
  18084. } else if (code === 17) {
  18085. bitsLength = 3;
  18086. bitsOffset = 3;
  18087. what = len = 0;
  18088. } else if (code === 18) {
  18089. bitsLength = 7;
  18090. bitsOffset = 11;
  18091. what = len = 0;
  18092. } else {
  18093. codeLengths[i++] = len = code;
  18094. continue;
  18095. }
  18096. let repeatLength = this.getBits(bitsLength) + bitsOffset;
  18097. while (repeatLength-- > 0) {
  18098. codeLengths[i++] = what;
  18099. }
  18100. }
  18101. litCodeTable = this.generateHuffmanTable(codeLengths.subarray(0, numLitCodes));
  18102. distCodeTable = this.generateHuffmanTable(codeLengths.subarray(numLitCodes, codes));
  18103. } else {
  18104. throw new _util.FormatError("Unknown block type in flate stream");
  18105. }
  18106. buffer = this.buffer;
  18107. let limit = buffer ? buffer.length : 0;
  18108. let pos = this.bufferLength;
  18109. while (true) {
  18110. let code1 = this.getCode(litCodeTable);
  18111. if (code1 < 256) {
  18112. if (pos + 1 >= limit) {
  18113. buffer = this.ensureBuffer(pos + 1);
  18114. limit = buffer.length;
  18115. }
  18116. buffer[pos++] = code1;
  18117. continue;
  18118. }
  18119. if (code1 === 256) {
  18120. this.bufferLength = pos;
  18121. return;
  18122. }
  18123. code1 -= 257;
  18124. code1 = lengthDecode[code1];
  18125. let code2 = code1 >> 16;
  18126. if (code2 > 0) {
  18127. code2 = this.getBits(code2);
  18128. }
  18129. len = (code1 & 0xffff) + code2;
  18130. code1 = this.getCode(distCodeTable);
  18131. code1 = distDecode[code1];
  18132. code2 = code1 >> 16;
  18133. if (code2 > 0) {
  18134. code2 = this.getBits(code2);
  18135. }
  18136. const dist = (code1 & 0xffff) + code2;
  18137. if (pos + len >= limit) {
  18138. buffer = this.ensureBuffer(pos + len);
  18139. limit = buffer.length;
  18140. }
  18141. for (let k = 0; k < len; ++k, ++pos) {
  18142. buffer[pos] = buffer[pos - dist];
  18143. }
  18144. }
  18145. }
  18146. }
  18147. exports.FlateStream = FlateStream;
  18148. /***/ }),
  18149. /* 153 */
  18150. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  18151. "use strict";
  18152. Object.defineProperty(exports, "__esModule", ({
  18153. value: true
  18154. }));
  18155. exports.Jbig2Stream = void 0;
  18156. var _base_stream = __w_pdfjs_require__(136);
  18157. var _decode_stream = __w_pdfjs_require__(148);
  18158. var _primitives = __w_pdfjs_require__(134);
  18159. var _jbig = __w_pdfjs_require__(154);
  18160. var _util = __w_pdfjs_require__(2);
  18161. class Jbig2Stream extends _decode_stream.DecodeStream {
  18162. constructor(stream, maybeLength, params) {
  18163. super(maybeLength);
  18164. this.stream = stream;
  18165. this.dict = stream.dict;
  18166. this.maybeLength = maybeLength;
  18167. this.params = params;
  18168. }
  18169. get bytes() {
  18170. return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength));
  18171. }
  18172. ensureBuffer(requested) {}
  18173. readBlock() {
  18174. if (this.eof) {
  18175. return;
  18176. }
  18177. const jbig2Image = new _jbig.Jbig2Image();
  18178. const chunks = [];
  18179. if (this.params instanceof _primitives.Dict) {
  18180. const globalsStream = this.params.get("JBIG2Globals");
  18181. if (globalsStream instanceof _base_stream.BaseStream) {
  18182. const globals = globalsStream.getBytes();
  18183. chunks.push({
  18184. data: globals,
  18185. start: 0,
  18186. end: globals.length
  18187. });
  18188. }
  18189. }
  18190. chunks.push({
  18191. data: this.bytes,
  18192. start: 0,
  18193. end: this.bytes.length
  18194. });
  18195. const data = jbig2Image.parseChunks(chunks);
  18196. const dataLength = data.length;
  18197. for (let i = 0; i < dataLength; i++) {
  18198. data[i] ^= 0xff;
  18199. }
  18200. this.buffer = data;
  18201. this.bufferLength = dataLength;
  18202. this.eof = true;
  18203. }
  18204. }
  18205. exports.Jbig2Stream = Jbig2Stream;
  18206. /***/ }),
  18207. /* 154 */
  18208. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  18209. "use strict";
  18210. Object.defineProperty(exports, "__esModule", ({
  18211. value: true
  18212. }));
  18213. exports.Jbig2Image = void 0;
  18214. var _util = __w_pdfjs_require__(2);
  18215. var _core_utils = __w_pdfjs_require__(135);
  18216. var _arithmetic_decoder = __w_pdfjs_require__(155);
  18217. var _ccitt = __w_pdfjs_require__(151);
  18218. class Jbig2Error extends _util.BaseException {
  18219. constructor(msg) {
  18220. super(`JBIG2 error: ${msg}`, "Jbig2Error");
  18221. }
  18222. }
  18223. class ContextCache {
  18224. getContexts(id) {
  18225. if (id in this) {
  18226. return this[id];
  18227. }
  18228. return this[id] = new Int8Array(1 << 16);
  18229. }
  18230. }
  18231. class DecodingContext {
  18232. constructor(data, start, end) {
  18233. this.data = data;
  18234. this.start = start;
  18235. this.end = end;
  18236. }
  18237. get decoder() {
  18238. const decoder = new _arithmetic_decoder.ArithmeticDecoder(this.data, this.start, this.end);
  18239. return (0, _util.shadow)(this, "decoder", decoder);
  18240. }
  18241. get contextCache() {
  18242. const cache = new ContextCache();
  18243. return (0, _util.shadow)(this, "contextCache", cache);
  18244. }
  18245. }
  18246. function decodeInteger(contextCache, procedure, decoder) {
  18247. const contexts = contextCache.getContexts(procedure);
  18248. let prev = 1;
  18249. function readBits(length) {
  18250. let v = 0;
  18251. for (let i = 0; i < length; i++) {
  18252. const bit = decoder.readBit(contexts, prev);
  18253. prev = prev < 256 ? prev << 1 | bit : (prev << 1 | bit) & 511 | 256;
  18254. v = v << 1 | bit;
  18255. }
  18256. return v >>> 0;
  18257. }
  18258. const sign = readBits(1);
  18259. 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);
  18260. if (sign === 0) {
  18261. return value;
  18262. } else if (value > 0) {
  18263. return -value;
  18264. }
  18265. return null;
  18266. }
  18267. function decodeIAID(contextCache, decoder, codeLength) {
  18268. const contexts = contextCache.getContexts("IAID");
  18269. let prev = 1;
  18270. for (let i = 0; i < codeLength; i++) {
  18271. const bit = decoder.readBit(contexts, prev);
  18272. prev = prev << 1 | bit;
  18273. }
  18274. if (codeLength < 31) {
  18275. return prev & (1 << codeLength) - 1;
  18276. }
  18277. return prev & 0x7fffffff;
  18278. }
  18279. 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"];
  18280. const CodingTemplates = [[{
  18281. x: -1,
  18282. y: -2
  18283. }, {
  18284. x: 0,
  18285. y: -2
  18286. }, {
  18287. x: 1,
  18288. y: -2
  18289. }, {
  18290. x: -2,
  18291. y: -1
  18292. }, {
  18293. x: -1,
  18294. y: -1
  18295. }, {
  18296. x: 0,
  18297. y: -1
  18298. }, {
  18299. x: 1,
  18300. y: -1
  18301. }, {
  18302. x: 2,
  18303. y: -1
  18304. }, {
  18305. x: -4,
  18306. y: 0
  18307. }, {
  18308. x: -3,
  18309. y: 0
  18310. }, {
  18311. x: -2,
  18312. y: 0
  18313. }, {
  18314. x: -1,
  18315. y: 0
  18316. }], [{
  18317. x: -1,
  18318. y: -2
  18319. }, {
  18320. x: 0,
  18321. y: -2
  18322. }, {
  18323. x: 1,
  18324. y: -2
  18325. }, {
  18326. x: 2,
  18327. y: -2
  18328. }, {
  18329. x: -2,
  18330. y: -1
  18331. }, {
  18332. x: -1,
  18333. y: -1
  18334. }, {
  18335. x: 0,
  18336. y: -1
  18337. }, {
  18338. x: 1,
  18339. y: -1
  18340. }, {
  18341. x: 2,
  18342. y: -1
  18343. }, {
  18344. x: -3,
  18345. y: 0
  18346. }, {
  18347. x: -2,
  18348. y: 0
  18349. }, {
  18350. x: -1,
  18351. y: 0
  18352. }], [{
  18353. x: -1,
  18354. y: -2
  18355. }, {
  18356. x: 0,
  18357. y: -2
  18358. }, {
  18359. x: 1,
  18360. y: -2
  18361. }, {
  18362. x: -2,
  18363. y: -1
  18364. }, {
  18365. x: -1,
  18366. y: -1
  18367. }, {
  18368. x: 0,
  18369. y: -1
  18370. }, {
  18371. x: 1,
  18372. y: -1
  18373. }, {
  18374. x: -2,
  18375. y: 0
  18376. }, {
  18377. x: -1,
  18378. y: 0
  18379. }], [{
  18380. x: -3,
  18381. y: -1
  18382. }, {
  18383. x: -2,
  18384. y: -1
  18385. }, {
  18386. x: -1,
  18387. y: -1
  18388. }, {
  18389. x: 0,
  18390. y: -1
  18391. }, {
  18392. x: 1,
  18393. y: -1
  18394. }, {
  18395. x: -4,
  18396. y: 0
  18397. }, {
  18398. x: -3,
  18399. y: 0
  18400. }, {
  18401. x: -2,
  18402. y: 0
  18403. }, {
  18404. x: -1,
  18405. y: 0
  18406. }]];
  18407. const RefinementTemplates = [{
  18408. coding: [{
  18409. x: 0,
  18410. y: -1
  18411. }, {
  18412. x: 1,
  18413. y: -1
  18414. }, {
  18415. x: -1,
  18416. y: 0
  18417. }],
  18418. reference: [{
  18419. x: 0,
  18420. y: -1
  18421. }, {
  18422. x: 1,
  18423. y: -1
  18424. }, {
  18425. x: -1,
  18426. y: 0
  18427. }, {
  18428. x: 0,
  18429. y: 0
  18430. }, {
  18431. x: 1,
  18432. y: 0
  18433. }, {
  18434. x: -1,
  18435. y: 1
  18436. }, {
  18437. x: 0,
  18438. y: 1
  18439. }, {
  18440. x: 1,
  18441. y: 1
  18442. }]
  18443. }, {
  18444. coding: [{
  18445. x: -1,
  18446. y: -1
  18447. }, {
  18448. x: 0,
  18449. y: -1
  18450. }, {
  18451. x: 1,
  18452. y: -1
  18453. }, {
  18454. x: -1,
  18455. y: 0
  18456. }],
  18457. reference: [{
  18458. x: 0,
  18459. y: -1
  18460. }, {
  18461. x: -1,
  18462. y: 0
  18463. }, {
  18464. x: 0,
  18465. y: 0
  18466. }, {
  18467. x: 1,
  18468. y: 0
  18469. }, {
  18470. x: 0,
  18471. y: 1
  18472. }, {
  18473. x: 1,
  18474. y: 1
  18475. }]
  18476. }];
  18477. const ReusedContexts = [0x9b25, 0x0795, 0x00e5, 0x0195];
  18478. const RefinementReusedContexts = [0x0020, 0x0008];
  18479. function decodeBitmapTemplate0(width, height, decodingContext) {
  18480. const decoder = decodingContext.decoder;
  18481. const contexts = decodingContext.contextCache.getContexts("GB");
  18482. const bitmap = [];
  18483. let contextLabel, i, j, pixel, row, row1, row2;
  18484. const OLD_PIXEL_MASK = 0x7bf7;
  18485. for (i = 0; i < height; i++) {
  18486. row = bitmap[i] = new Uint8Array(width);
  18487. row1 = i < 1 ? row : bitmap[i - 1];
  18488. row2 = i < 2 ? row : bitmap[i - 2];
  18489. contextLabel = row2[0] << 13 | row2[1] << 12 | row2[2] << 11 | row1[0] << 7 | row1[1] << 6 | row1[2] << 5 | row1[3] << 4;
  18490. for (j = 0; j < width; j++) {
  18491. row[j] = pixel = decoder.readBit(contexts, contextLabel);
  18492. contextLabel = (contextLabel & OLD_PIXEL_MASK) << 1 | (j + 3 < width ? row2[j + 3] << 11 : 0) | (j + 4 < width ? row1[j + 4] << 4 : 0) | pixel;
  18493. }
  18494. }
  18495. return bitmap;
  18496. }
  18497. function decodeBitmap(mmr, width, height, templateIndex, prediction, skip, at, decodingContext) {
  18498. if (mmr) {
  18499. const input = new Reader(decodingContext.data, decodingContext.start, decodingContext.end);
  18500. return decodeMMRBitmap(input, width, height, false);
  18501. }
  18502. 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) {
  18503. return decodeBitmapTemplate0(width, height, decodingContext);
  18504. }
  18505. const useskip = !!skip;
  18506. const template = CodingTemplates[templateIndex].concat(at);
  18507. template.sort(function (a, b) {
  18508. return a.y - b.y || a.x - b.x;
  18509. });
  18510. const templateLength = template.length;
  18511. const templateX = new Int8Array(templateLength);
  18512. const templateY = new Int8Array(templateLength);
  18513. const changingTemplateEntries = [];
  18514. let reuseMask = 0,
  18515. minX = 0,
  18516. maxX = 0,
  18517. minY = 0;
  18518. let c, k;
  18519. for (k = 0; k < templateLength; k++) {
  18520. templateX[k] = template[k].x;
  18521. templateY[k] = template[k].y;
  18522. minX = Math.min(minX, template[k].x);
  18523. maxX = Math.max(maxX, template[k].x);
  18524. minY = Math.min(minY, template[k].y);
  18525. if (k < templateLength - 1 && template[k].y === template[k + 1].y && template[k].x === template[k + 1].x - 1) {
  18526. reuseMask |= 1 << templateLength - 1 - k;
  18527. } else {
  18528. changingTemplateEntries.push(k);
  18529. }
  18530. }
  18531. const changingEntriesLength = changingTemplateEntries.length;
  18532. const changingTemplateX = new Int8Array(changingEntriesLength);
  18533. const changingTemplateY = new Int8Array(changingEntriesLength);
  18534. const changingTemplateBit = new Uint16Array(changingEntriesLength);
  18535. for (c = 0; c < changingEntriesLength; c++) {
  18536. k = changingTemplateEntries[c];
  18537. changingTemplateX[c] = template[k].x;
  18538. changingTemplateY[c] = template[k].y;
  18539. changingTemplateBit[c] = 1 << templateLength - 1 - k;
  18540. }
  18541. const sbb_left = -minX;
  18542. const sbb_top = -minY;
  18543. const sbb_right = width - maxX;
  18544. const pseudoPixelContext = ReusedContexts[templateIndex];
  18545. let row = new Uint8Array(width);
  18546. const bitmap = [];
  18547. const decoder = decodingContext.decoder;
  18548. const contexts = decodingContext.contextCache.getContexts("GB");
  18549. let ltp = 0,
  18550. j,
  18551. i0,
  18552. j0,
  18553. contextLabel = 0,
  18554. bit,
  18555. shift;
  18556. for (let i = 0; i < height; i++) {
  18557. if (prediction) {
  18558. const sltp = decoder.readBit(contexts, pseudoPixelContext);
  18559. ltp ^= sltp;
  18560. if (ltp) {
  18561. bitmap.push(row);
  18562. continue;
  18563. }
  18564. }
  18565. row = new Uint8Array(row);
  18566. bitmap.push(row);
  18567. for (j = 0; j < width; j++) {
  18568. if (useskip && skip[i][j]) {
  18569. row[j] = 0;
  18570. continue;
  18571. }
  18572. if (j >= sbb_left && j < sbb_right && i >= sbb_top) {
  18573. contextLabel = contextLabel << 1 & reuseMask;
  18574. for (k = 0; k < changingEntriesLength; k++) {
  18575. i0 = i + changingTemplateY[k];
  18576. j0 = j + changingTemplateX[k];
  18577. bit = bitmap[i0][j0];
  18578. if (bit) {
  18579. bit = changingTemplateBit[k];
  18580. contextLabel |= bit;
  18581. }
  18582. }
  18583. } else {
  18584. contextLabel = 0;
  18585. shift = templateLength - 1;
  18586. for (k = 0; k < templateLength; k++, shift--) {
  18587. j0 = j + templateX[k];
  18588. if (j0 >= 0 && j0 < width) {
  18589. i0 = i + templateY[k];
  18590. if (i0 >= 0) {
  18591. bit = bitmap[i0][j0];
  18592. if (bit) {
  18593. contextLabel |= bit << shift;
  18594. }
  18595. }
  18596. }
  18597. }
  18598. }
  18599. const pixel = decoder.readBit(contexts, contextLabel);
  18600. row[j] = pixel;
  18601. }
  18602. }
  18603. return bitmap;
  18604. }
  18605. function decodeRefinement(width, height, templateIndex, referenceBitmap, offsetX, offsetY, prediction, at, decodingContext) {
  18606. let codingTemplate = RefinementTemplates[templateIndex].coding;
  18607. if (templateIndex === 0) {
  18608. codingTemplate = codingTemplate.concat([at[0]]);
  18609. }
  18610. const codingTemplateLength = codingTemplate.length;
  18611. const codingTemplateX = new Int32Array(codingTemplateLength);
  18612. const codingTemplateY = new Int32Array(codingTemplateLength);
  18613. let k;
  18614. for (k = 0; k < codingTemplateLength; k++) {
  18615. codingTemplateX[k] = codingTemplate[k].x;
  18616. codingTemplateY[k] = codingTemplate[k].y;
  18617. }
  18618. let referenceTemplate = RefinementTemplates[templateIndex].reference;
  18619. if (templateIndex === 0) {
  18620. referenceTemplate = referenceTemplate.concat([at[1]]);
  18621. }
  18622. const referenceTemplateLength = referenceTemplate.length;
  18623. const referenceTemplateX = new Int32Array(referenceTemplateLength);
  18624. const referenceTemplateY = new Int32Array(referenceTemplateLength);
  18625. for (k = 0; k < referenceTemplateLength; k++) {
  18626. referenceTemplateX[k] = referenceTemplate[k].x;
  18627. referenceTemplateY[k] = referenceTemplate[k].y;
  18628. }
  18629. const referenceWidth = referenceBitmap[0].length;
  18630. const referenceHeight = referenceBitmap.length;
  18631. const pseudoPixelContext = RefinementReusedContexts[templateIndex];
  18632. const bitmap = [];
  18633. const decoder = decodingContext.decoder;
  18634. const contexts = decodingContext.contextCache.getContexts("GR");
  18635. let ltp = 0;
  18636. for (let i = 0; i < height; i++) {
  18637. if (prediction) {
  18638. const sltp = decoder.readBit(contexts, pseudoPixelContext);
  18639. ltp ^= sltp;
  18640. if (ltp) {
  18641. throw new Jbig2Error("prediction is not supported");
  18642. }
  18643. }
  18644. const row = new Uint8Array(width);
  18645. bitmap.push(row);
  18646. for (let j = 0; j < width; j++) {
  18647. let i0, j0;
  18648. let contextLabel = 0;
  18649. for (k = 0; k < codingTemplateLength; k++) {
  18650. i0 = i + codingTemplateY[k];
  18651. j0 = j + codingTemplateX[k];
  18652. if (i0 < 0 || j0 < 0 || j0 >= width) {
  18653. contextLabel <<= 1;
  18654. } else {
  18655. contextLabel = contextLabel << 1 | bitmap[i0][j0];
  18656. }
  18657. }
  18658. for (k = 0; k < referenceTemplateLength; k++) {
  18659. i0 = i + referenceTemplateY[k] - offsetY;
  18660. j0 = j + referenceTemplateX[k] - offsetX;
  18661. if (i0 < 0 || i0 >= referenceHeight || j0 < 0 || j0 >= referenceWidth) {
  18662. contextLabel <<= 1;
  18663. } else {
  18664. contextLabel = contextLabel << 1 | referenceBitmap[i0][j0];
  18665. }
  18666. }
  18667. const pixel = decoder.readBit(contexts, contextLabel);
  18668. row[j] = pixel;
  18669. }
  18670. }
  18671. return bitmap;
  18672. }
  18673. function decodeSymbolDictionary(huffman, refinement, symbols, numberOfNewSymbols, numberOfExportedSymbols, huffmanTables, templateIndex, at, refinementTemplateIndex, refinementAt, decodingContext, huffmanInput) {
  18674. if (huffman && refinement) {
  18675. throw new Jbig2Error("symbol refinement with Huffman is not supported");
  18676. }
  18677. const newSymbols = [];
  18678. let currentHeight = 0;
  18679. let symbolCodeLength = (0, _core_utils.log2)(symbols.length + numberOfNewSymbols);
  18680. const decoder = decodingContext.decoder;
  18681. const contextCache = decodingContext.contextCache;
  18682. let tableB1, symbolWidths;
  18683. if (huffman) {
  18684. tableB1 = getStandardTable(1);
  18685. symbolWidths = [];
  18686. symbolCodeLength = Math.max(symbolCodeLength, 1);
  18687. }
  18688. while (newSymbols.length < numberOfNewSymbols) {
  18689. const deltaHeight = huffman ? huffmanTables.tableDeltaHeight.decode(huffmanInput) : decodeInteger(contextCache, "IADH", decoder);
  18690. currentHeight += deltaHeight;
  18691. let currentWidth = 0,
  18692. totalWidth = 0;
  18693. const firstSymbol = huffman ? symbolWidths.length : 0;
  18694. while (true) {
  18695. const deltaWidth = huffman ? huffmanTables.tableDeltaWidth.decode(huffmanInput) : decodeInteger(contextCache, "IADW", decoder);
  18696. if (deltaWidth === null) {
  18697. break;
  18698. }
  18699. currentWidth += deltaWidth;
  18700. totalWidth += currentWidth;
  18701. let bitmap;
  18702. if (refinement) {
  18703. const numberOfInstances = decodeInteger(contextCache, "IAAI", decoder);
  18704. if (numberOfInstances > 1) {
  18705. bitmap = decodeTextRegion(huffman, refinement, currentWidth, currentHeight, 0, numberOfInstances, 1, symbols.concat(newSymbols), symbolCodeLength, 0, 0, 1, 0, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext, 0, huffmanInput);
  18706. } else {
  18707. const symbolId = decodeIAID(contextCache, decoder, symbolCodeLength);
  18708. const rdx = decodeInteger(contextCache, "IARDX", decoder);
  18709. const rdy = decodeInteger(contextCache, "IARDY", decoder);
  18710. const symbol = symbolId < symbols.length ? symbols[symbolId] : newSymbols[symbolId - symbols.length];
  18711. bitmap = decodeRefinement(currentWidth, currentHeight, refinementTemplateIndex, symbol, rdx, rdy, false, refinementAt, decodingContext);
  18712. }
  18713. newSymbols.push(bitmap);
  18714. } else if (huffman) {
  18715. symbolWidths.push(currentWidth);
  18716. } else {
  18717. bitmap = decodeBitmap(false, currentWidth, currentHeight, templateIndex, false, null, at, decodingContext);
  18718. newSymbols.push(bitmap);
  18719. }
  18720. }
  18721. if (huffman && !refinement) {
  18722. const bitmapSize = huffmanTables.tableBitmapSize.decode(huffmanInput);
  18723. huffmanInput.byteAlign();
  18724. let collectiveBitmap;
  18725. if (bitmapSize === 0) {
  18726. collectiveBitmap = readUncompressedBitmap(huffmanInput, totalWidth, currentHeight);
  18727. } else {
  18728. const originalEnd = huffmanInput.end;
  18729. const bitmapEnd = huffmanInput.position + bitmapSize;
  18730. huffmanInput.end = bitmapEnd;
  18731. collectiveBitmap = decodeMMRBitmap(huffmanInput, totalWidth, currentHeight, false);
  18732. huffmanInput.end = originalEnd;
  18733. huffmanInput.position = bitmapEnd;
  18734. }
  18735. const numberOfSymbolsDecoded = symbolWidths.length;
  18736. if (firstSymbol === numberOfSymbolsDecoded - 1) {
  18737. newSymbols.push(collectiveBitmap);
  18738. } else {
  18739. let i,
  18740. y,
  18741. xMin = 0,
  18742. xMax,
  18743. bitmapWidth,
  18744. symbolBitmap;
  18745. for (i = firstSymbol; i < numberOfSymbolsDecoded; i++) {
  18746. bitmapWidth = symbolWidths[i];
  18747. xMax = xMin + bitmapWidth;
  18748. symbolBitmap = [];
  18749. for (y = 0; y < currentHeight; y++) {
  18750. symbolBitmap.push(collectiveBitmap[y].subarray(xMin, xMax));
  18751. }
  18752. newSymbols.push(symbolBitmap);
  18753. xMin = xMax;
  18754. }
  18755. }
  18756. }
  18757. }
  18758. const exportedSymbols = [],
  18759. flags = [];
  18760. let currentFlag = false,
  18761. i,
  18762. ii;
  18763. const totalSymbolsLength = symbols.length + numberOfNewSymbols;
  18764. while (flags.length < totalSymbolsLength) {
  18765. let runLength = huffman ? tableB1.decode(huffmanInput) : decodeInteger(contextCache, "IAEX", decoder);
  18766. while (runLength--) {
  18767. flags.push(currentFlag);
  18768. }
  18769. currentFlag = !currentFlag;
  18770. }
  18771. for (i = 0, ii = symbols.length; i < ii; i++) {
  18772. if (flags[i]) {
  18773. exportedSymbols.push(symbols[i]);
  18774. }
  18775. }
  18776. for (let j = 0; j < numberOfNewSymbols; i++, j++) {
  18777. if (flags[i]) {
  18778. exportedSymbols.push(newSymbols[j]);
  18779. }
  18780. }
  18781. return exportedSymbols;
  18782. }
  18783. function decodeTextRegion(huffman, refinement, width, height, defaultPixelValue, numberOfSymbolInstances, stripSize, inputSymbols, symbolCodeLength, transposed, dsOffset, referenceCorner, combinationOperator, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext, logStripSize, huffmanInput) {
  18784. if (huffman && refinement) {
  18785. throw new Jbig2Error("refinement with Huffman is not supported");
  18786. }
  18787. const bitmap = [];
  18788. let i, row;
  18789. for (i = 0; i < height; i++) {
  18790. row = new Uint8Array(width);
  18791. if (defaultPixelValue) {
  18792. for (let j = 0; j < width; j++) {
  18793. row[j] = defaultPixelValue;
  18794. }
  18795. }
  18796. bitmap.push(row);
  18797. }
  18798. const decoder = decodingContext.decoder;
  18799. const contextCache = decodingContext.contextCache;
  18800. let stripT = huffman ? -huffmanTables.tableDeltaT.decode(huffmanInput) : -decodeInteger(contextCache, "IADT", decoder);
  18801. let firstS = 0;
  18802. i = 0;
  18803. while (i < numberOfSymbolInstances) {
  18804. const deltaT = huffman ? huffmanTables.tableDeltaT.decode(huffmanInput) : decodeInteger(contextCache, "IADT", decoder);
  18805. stripT += deltaT;
  18806. const deltaFirstS = huffman ? huffmanTables.tableFirstS.decode(huffmanInput) : decodeInteger(contextCache, "IAFS", decoder);
  18807. firstS += deltaFirstS;
  18808. let currentS = firstS;
  18809. do {
  18810. let currentT = 0;
  18811. if (stripSize > 1) {
  18812. currentT = huffman ? huffmanInput.readBits(logStripSize) : decodeInteger(contextCache, "IAIT", decoder);
  18813. }
  18814. const t = stripSize * stripT + currentT;
  18815. const symbolId = huffman ? huffmanTables.symbolIDTable.decode(huffmanInput) : decodeIAID(contextCache, decoder, symbolCodeLength);
  18816. const applyRefinement = refinement && (huffman ? huffmanInput.readBit() : decodeInteger(contextCache, "IARI", decoder));
  18817. let symbolBitmap = inputSymbols[symbolId];
  18818. let symbolWidth = symbolBitmap[0].length;
  18819. let symbolHeight = symbolBitmap.length;
  18820. if (applyRefinement) {
  18821. const rdw = decodeInteger(contextCache, "IARDW", decoder);
  18822. const rdh = decodeInteger(contextCache, "IARDH", decoder);
  18823. const rdx = decodeInteger(contextCache, "IARDX", decoder);
  18824. const rdy = decodeInteger(contextCache, "IARDY", decoder);
  18825. symbolWidth += rdw;
  18826. symbolHeight += rdh;
  18827. symbolBitmap = decodeRefinement(symbolWidth, symbolHeight, refinementTemplateIndex, symbolBitmap, (rdw >> 1) + rdx, (rdh >> 1) + rdy, false, refinementAt, decodingContext);
  18828. }
  18829. const offsetT = t - (referenceCorner & 1 ? 0 : symbolHeight - 1);
  18830. const offsetS = currentS - (referenceCorner & 2 ? symbolWidth - 1 : 0);
  18831. let s2, t2, symbolRow;
  18832. if (transposed) {
  18833. for (s2 = 0; s2 < symbolHeight; s2++) {
  18834. row = bitmap[offsetS + s2];
  18835. if (!row) {
  18836. continue;
  18837. }
  18838. symbolRow = symbolBitmap[s2];
  18839. const maxWidth = Math.min(width - offsetT, symbolWidth);
  18840. switch (combinationOperator) {
  18841. case 0:
  18842. for (t2 = 0; t2 < maxWidth; t2++) {
  18843. row[offsetT + t2] |= symbolRow[t2];
  18844. }
  18845. break;
  18846. case 2:
  18847. for (t2 = 0; t2 < maxWidth; t2++) {
  18848. row[offsetT + t2] ^= symbolRow[t2];
  18849. }
  18850. break;
  18851. default:
  18852. throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
  18853. }
  18854. }
  18855. currentS += symbolHeight - 1;
  18856. } else {
  18857. for (t2 = 0; t2 < symbolHeight; t2++) {
  18858. row = bitmap[offsetT + t2];
  18859. if (!row) {
  18860. continue;
  18861. }
  18862. symbolRow = symbolBitmap[t2];
  18863. switch (combinationOperator) {
  18864. case 0:
  18865. for (s2 = 0; s2 < symbolWidth; s2++) {
  18866. row[offsetS + s2] |= symbolRow[s2];
  18867. }
  18868. break;
  18869. case 2:
  18870. for (s2 = 0; s2 < symbolWidth; s2++) {
  18871. row[offsetS + s2] ^= symbolRow[s2];
  18872. }
  18873. break;
  18874. default:
  18875. throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
  18876. }
  18877. }
  18878. currentS += symbolWidth - 1;
  18879. }
  18880. i++;
  18881. const deltaS = huffman ? huffmanTables.tableDeltaS.decode(huffmanInput) : decodeInteger(contextCache, "IADS", decoder);
  18882. if (deltaS === null) {
  18883. break;
  18884. }
  18885. currentS += deltaS + dsOffset;
  18886. } while (true);
  18887. }
  18888. return bitmap;
  18889. }
  18890. function decodePatternDictionary(mmr, patternWidth, patternHeight, maxPatternIndex, template, decodingContext) {
  18891. const at = [];
  18892. if (!mmr) {
  18893. at.push({
  18894. x: -patternWidth,
  18895. y: 0
  18896. });
  18897. if (template === 0) {
  18898. at.push({
  18899. x: -3,
  18900. y: -1
  18901. }, {
  18902. x: 2,
  18903. y: -2
  18904. }, {
  18905. x: -2,
  18906. y: -2
  18907. });
  18908. }
  18909. }
  18910. const collectiveWidth = (maxPatternIndex + 1) * patternWidth;
  18911. const collectiveBitmap = decodeBitmap(mmr, collectiveWidth, patternHeight, template, false, null, at, decodingContext);
  18912. const patterns = [];
  18913. for (let i = 0; i <= maxPatternIndex; i++) {
  18914. const patternBitmap = [];
  18915. const xMin = patternWidth * i;
  18916. const xMax = xMin + patternWidth;
  18917. for (let y = 0; y < patternHeight; y++) {
  18918. patternBitmap.push(collectiveBitmap[y].subarray(xMin, xMax));
  18919. }
  18920. patterns.push(patternBitmap);
  18921. }
  18922. return patterns;
  18923. }
  18924. function decodeHalftoneRegion(mmr, patterns, template, regionWidth, regionHeight, defaultPixelValue, enableSkip, combinationOperator, gridWidth, gridHeight, gridOffsetX, gridOffsetY, gridVectorX, gridVectorY, decodingContext) {
  18925. const skip = null;
  18926. if (enableSkip) {
  18927. throw new Jbig2Error("skip is not supported");
  18928. }
  18929. if (combinationOperator !== 0) {
  18930. throw new Jbig2Error(`operator "${combinationOperator}" is not supported in halftone region`);
  18931. }
  18932. const regionBitmap = [];
  18933. let i, j, row;
  18934. for (i = 0; i < regionHeight; i++) {
  18935. row = new Uint8Array(regionWidth);
  18936. if (defaultPixelValue) {
  18937. for (j = 0; j < regionWidth; j++) {
  18938. row[j] = defaultPixelValue;
  18939. }
  18940. }
  18941. regionBitmap.push(row);
  18942. }
  18943. const numberOfPatterns = patterns.length;
  18944. const pattern0 = patterns[0];
  18945. const patternWidth = pattern0[0].length,
  18946. patternHeight = pattern0.length;
  18947. const bitsPerValue = (0, _core_utils.log2)(numberOfPatterns);
  18948. const at = [];
  18949. if (!mmr) {
  18950. at.push({
  18951. x: template <= 1 ? 3 : 2,
  18952. y: -1
  18953. });
  18954. if (template === 0) {
  18955. at.push({
  18956. x: -3,
  18957. y: -1
  18958. }, {
  18959. x: 2,
  18960. y: -2
  18961. }, {
  18962. x: -2,
  18963. y: -2
  18964. });
  18965. }
  18966. }
  18967. const grayScaleBitPlanes = [];
  18968. let mmrInput, bitmap;
  18969. if (mmr) {
  18970. mmrInput = new Reader(decodingContext.data, decodingContext.start, decodingContext.end);
  18971. }
  18972. for (i = bitsPerValue - 1; i >= 0; i--) {
  18973. if (mmr) {
  18974. bitmap = decodeMMRBitmap(mmrInput, gridWidth, gridHeight, true);
  18975. } else {
  18976. bitmap = decodeBitmap(false, gridWidth, gridHeight, template, false, skip, at, decodingContext);
  18977. }
  18978. grayScaleBitPlanes[i] = bitmap;
  18979. }
  18980. let mg, ng, bit, patternIndex, patternBitmap, x, y, patternRow, regionRow;
  18981. for (mg = 0; mg < gridHeight; mg++) {
  18982. for (ng = 0; ng < gridWidth; ng++) {
  18983. bit = 0;
  18984. patternIndex = 0;
  18985. for (j = bitsPerValue - 1; j >= 0; j--) {
  18986. bit ^= grayScaleBitPlanes[j][mg][ng];
  18987. patternIndex |= bit << j;
  18988. }
  18989. patternBitmap = patterns[patternIndex];
  18990. x = gridOffsetX + mg * gridVectorY + ng * gridVectorX >> 8;
  18991. y = gridOffsetY + mg * gridVectorX - ng * gridVectorY >> 8;
  18992. if (x >= 0 && x + patternWidth <= regionWidth && y >= 0 && y + patternHeight <= regionHeight) {
  18993. for (i = 0; i < patternHeight; i++) {
  18994. regionRow = regionBitmap[y + i];
  18995. patternRow = patternBitmap[i];
  18996. for (j = 0; j < patternWidth; j++) {
  18997. regionRow[x + j] |= patternRow[j];
  18998. }
  18999. }
  19000. } else {
  19001. let regionX, regionY;
  19002. for (i = 0; i < patternHeight; i++) {
  19003. regionY = y + i;
  19004. if (regionY < 0 || regionY >= regionHeight) {
  19005. continue;
  19006. }
  19007. regionRow = regionBitmap[regionY];
  19008. patternRow = patternBitmap[i];
  19009. for (j = 0; j < patternWidth; j++) {
  19010. regionX = x + j;
  19011. if (regionX >= 0 && regionX < regionWidth) {
  19012. regionRow[regionX] |= patternRow[j];
  19013. }
  19014. }
  19015. }
  19016. }
  19017. }
  19018. }
  19019. return regionBitmap;
  19020. }
  19021. function readSegmentHeader(data, start) {
  19022. const segmentHeader = {};
  19023. segmentHeader.number = (0, _core_utils.readUint32)(data, start);
  19024. const flags = data[start + 4];
  19025. const segmentType = flags & 0x3f;
  19026. if (!SegmentTypes[segmentType]) {
  19027. throw new Jbig2Error("invalid segment type: " + segmentType);
  19028. }
  19029. segmentHeader.type = segmentType;
  19030. segmentHeader.typeName = SegmentTypes[segmentType];
  19031. segmentHeader.deferredNonRetain = !!(flags & 0x80);
  19032. const pageAssociationFieldSize = !!(flags & 0x40);
  19033. const referredFlags = data[start + 5];
  19034. let referredToCount = referredFlags >> 5 & 7;
  19035. const retainBits = [referredFlags & 31];
  19036. let position = start + 6;
  19037. if (referredFlags === 7) {
  19038. referredToCount = (0, _core_utils.readUint32)(data, position - 1) & 0x1fffffff;
  19039. position += 3;
  19040. let bytes = referredToCount + 7 >> 3;
  19041. retainBits[0] = data[position++];
  19042. while (--bytes > 0) {
  19043. retainBits.push(data[position++]);
  19044. }
  19045. } else if (referredFlags === 5 || referredFlags === 6) {
  19046. throw new Jbig2Error("invalid referred-to flags");
  19047. }
  19048. segmentHeader.retainBits = retainBits;
  19049. let referredToSegmentNumberSize = 4;
  19050. if (segmentHeader.number <= 256) {
  19051. referredToSegmentNumberSize = 1;
  19052. } else if (segmentHeader.number <= 65536) {
  19053. referredToSegmentNumberSize = 2;
  19054. }
  19055. const referredTo = [];
  19056. let i, ii;
  19057. for (i = 0; i < referredToCount; i++) {
  19058. let number;
  19059. if (referredToSegmentNumberSize === 1) {
  19060. number = data[position];
  19061. } else if (referredToSegmentNumberSize === 2) {
  19062. number = (0, _core_utils.readUint16)(data, position);
  19063. } else {
  19064. number = (0, _core_utils.readUint32)(data, position);
  19065. }
  19066. referredTo.push(number);
  19067. position += referredToSegmentNumberSize;
  19068. }
  19069. segmentHeader.referredTo = referredTo;
  19070. if (!pageAssociationFieldSize) {
  19071. segmentHeader.pageAssociation = data[position++];
  19072. } else {
  19073. segmentHeader.pageAssociation = (0, _core_utils.readUint32)(data, position);
  19074. position += 4;
  19075. }
  19076. segmentHeader.length = (0, _core_utils.readUint32)(data, position);
  19077. position += 4;
  19078. if (segmentHeader.length === 0xffffffff) {
  19079. if (segmentType === 38) {
  19080. const genericRegionInfo = readRegionSegmentInformation(data, position);
  19081. const genericRegionSegmentFlags = data[position + RegionSegmentInformationFieldLength];
  19082. const genericRegionMmr = !!(genericRegionSegmentFlags & 1);
  19083. const searchPatternLength = 6;
  19084. const searchPattern = new Uint8Array(searchPatternLength);
  19085. if (!genericRegionMmr) {
  19086. searchPattern[0] = 0xff;
  19087. searchPattern[1] = 0xac;
  19088. }
  19089. searchPattern[2] = genericRegionInfo.height >>> 24 & 0xff;
  19090. searchPattern[3] = genericRegionInfo.height >> 16 & 0xff;
  19091. searchPattern[4] = genericRegionInfo.height >> 8 & 0xff;
  19092. searchPattern[5] = genericRegionInfo.height & 0xff;
  19093. for (i = position, ii = data.length; i < ii; i++) {
  19094. let j = 0;
  19095. while (j < searchPatternLength && searchPattern[j] === data[i + j]) {
  19096. j++;
  19097. }
  19098. if (j === searchPatternLength) {
  19099. segmentHeader.length = i + searchPatternLength;
  19100. break;
  19101. }
  19102. }
  19103. if (segmentHeader.length === 0xffffffff) {
  19104. throw new Jbig2Error("segment end was not found");
  19105. }
  19106. } else {
  19107. throw new Jbig2Error("invalid unknown segment length");
  19108. }
  19109. }
  19110. segmentHeader.headerEnd = position;
  19111. return segmentHeader;
  19112. }
  19113. function readSegments(header, data, start, end) {
  19114. const segments = [];
  19115. let position = start;
  19116. while (position < end) {
  19117. const segmentHeader = readSegmentHeader(data, position);
  19118. position = segmentHeader.headerEnd;
  19119. const segment = {
  19120. header: segmentHeader,
  19121. data
  19122. };
  19123. if (!header.randomAccess) {
  19124. segment.start = position;
  19125. position += segmentHeader.length;
  19126. segment.end = position;
  19127. }
  19128. segments.push(segment);
  19129. if (segmentHeader.type === 51) {
  19130. break;
  19131. }
  19132. }
  19133. if (header.randomAccess) {
  19134. for (let i = 0, ii = segments.length; i < ii; i++) {
  19135. segments[i].start = position;
  19136. position += segments[i].header.length;
  19137. segments[i].end = position;
  19138. }
  19139. }
  19140. return segments;
  19141. }
  19142. function readRegionSegmentInformation(data, start) {
  19143. return {
  19144. width: (0, _core_utils.readUint32)(data, start),
  19145. height: (0, _core_utils.readUint32)(data, start + 4),
  19146. x: (0, _core_utils.readUint32)(data, start + 8),
  19147. y: (0, _core_utils.readUint32)(data, start + 12),
  19148. combinationOperator: data[start + 16] & 7
  19149. };
  19150. }
  19151. const RegionSegmentInformationFieldLength = 17;
  19152. function processSegment(segment, visitor) {
  19153. const header = segment.header;
  19154. const data = segment.data,
  19155. end = segment.end;
  19156. let position = segment.start;
  19157. let args, at, i, atLength;
  19158. switch (header.type) {
  19159. case 0:
  19160. const dictionary = {};
  19161. const dictionaryFlags = (0, _core_utils.readUint16)(data, position);
  19162. dictionary.huffman = !!(dictionaryFlags & 1);
  19163. dictionary.refinement = !!(dictionaryFlags & 2);
  19164. dictionary.huffmanDHSelector = dictionaryFlags >> 2 & 3;
  19165. dictionary.huffmanDWSelector = dictionaryFlags >> 4 & 3;
  19166. dictionary.bitmapSizeSelector = dictionaryFlags >> 6 & 1;
  19167. dictionary.aggregationInstancesSelector = dictionaryFlags >> 7 & 1;
  19168. dictionary.bitmapCodingContextUsed = !!(dictionaryFlags & 256);
  19169. dictionary.bitmapCodingContextRetained = !!(dictionaryFlags & 512);
  19170. dictionary.template = dictionaryFlags >> 10 & 3;
  19171. dictionary.refinementTemplate = dictionaryFlags >> 12 & 1;
  19172. position += 2;
  19173. if (!dictionary.huffman) {
  19174. atLength = dictionary.template === 0 ? 4 : 1;
  19175. at = [];
  19176. for (i = 0; i < atLength; i++) {
  19177. at.push({
  19178. x: (0, _core_utils.readInt8)(data, position),
  19179. y: (0, _core_utils.readInt8)(data, position + 1)
  19180. });
  19181. position += 2;
  19182. }
  19183. dictionary.at = at;
  19184. }
  19185. if (dictionary.refinement && !dictionary.refinementTemplate) {
  19186. at = [];
  19187. for (i = 0; i < 2; i++) {
  19188. at.push({
  19189. x: (0, _core_utils.readInt8)(data, position),
  19190. y: (0, _core_utils.readInt8)(data, position + 1)
  19191. });
  19192. position += 2;
  19193. }
  19194. dictionary.refinementAt = at;
  19195. }
  19196. dictionary.numberOfExportedSymbols = (0, _core_utils.readUint32)(data, position);
  19197. position += 4;
  19198. dictionary.numberOfNewSymbols = (0, _core_utils.readUint32)(data, position);
  19199. position += 4;
  19200. args = [dictionary, header.number, header.referredTo, data, position, end];
  19201. break;
  19202. case 6:
  19203. case 7:
  19204. const textRegion = {};
  19205. textRegion.info = readRegionSegmentInformation(data, position);
  19206. position += RegionSegmentInformationFieldLength;
  19207. const textRegionSegmentFlags = (0, _core_utils.readUint16)(data, position);
  19208. position += 2;
  19209. textRegion.huffman = !!(textRegionSegmentFlags & 1);
  19210. textRegion.refinement = !!(textRegionSegmentFlags & 2);
  19211. textRegion.logStripSize = textRegionSegmentFlags >> 2 & 3;
  19212. textRegion.stripSize = 1 << textRegion.logStripSize;
  19213. textRegion.referenceCorner = textRegionSegmentFlags >> 4 & 3;
  19214. textRegion.transposed = !!(textRegionSegmentFlags & 64);
  19215. textRegion.combinationOperator = textRegionSegmentFlags >> 7 & 3;
  19216. textRegion.defaultPixelValue = textRegionSegmentFlags >> 9 & 1;
  19217. textRegion.dsOffset = textRegionSegmentFlags << 17 >> 27;
  19218. textRegion.refinementTemplate = textRegionSegmentFlags >> 15 & 1;
  19219. if (textRegion.huffman) {
  19220. const textRegionHuffmanFlags = (0, _core_utils.readUint16)(data, position);
  19221. position += 2;
  19222. textRegion.huffmanFS = textRegionHuffmanFlags & 3;
  19223. textRegion.huffmanDS = textRegionHuffmanFlags >> 2 & 3;
  19224. textRegion.huffmanDT = textRegionHuffmanFlags >> 4 & 3;
  19225. textRegion.huffmanRefinementDW = textRegionHuffmanFlags >> 6 & 3;
  19226. textRegion.huffmanRefinementDH = textRegionHuffmanFlags >> 8 & 3;
  19227. textRegion.huffmanRefinementDX = textRegionHuffmanFlags >> 10 & 3;
  19228. textRegion.huffmanRefinementDY = textRegionHuffmanFlags >> 12 & 3;
  19229. textRegion.huffmanRefinementSizeSelector = !!(textRegionHuffmanFlags & 0x4000);
  19230. }
  19231. if (textRegion.refinement && !textRegion.refinementTemplate) {
  19232. at = [];
  19233. for (i = 0; i < 2; i++) {
  19234. at.push({
  19235. x: (0, _core_utils.readInt8)(data, position),
  19236. y: (0, _core_utils.readInt8)(data, position + 1)
  19237. });
  19238. position += 2;
  19239. }
  19240. textRegion.refinementAt = at;
  19241. }
  19242. textRegion.numberOfSymbolInstances = (0, _core_utils.readUint32)(data, position);
  19243. position += 4;
  19244. args = [textRegion, header.referredTo, data, position, end];
  19245. break;
  19246. case 16:
  19247. const patternDictionary = {};
  19248. const patternDictionaryFlags = data[position++];
  19249. patternDictionary.mmr = !!(patternDictionaryFlags & 1);
  19250. patternDictionary.template = patternDictionaryFlags >> 1 & 3;
  19251. patternDictionary.patternWidth = data[position++];
  19252. patternDictionary.patternHeight = data[position++];
  19253. patternDictionary.maxPatternIndex = (0, _core_utils.readUint32)(data, position);
  19254. position += 4;
  19255. args = [patternDictionary, header.number, data, position, end];
  19256. break;
  19257. case 22:
  19258. case 23:
  19259. const halftoneRegion = {};
  19260. halftoneRegion.info = readRegionSegmentInformation(data, position);
  19261. position += RegionSegmentInformationFieldLength;
  19262. const halftoneRegionFlags = data[position++];
  19263. halftoneRegion.mmr = !!(halftoneRegionFlags & 1);
  19264. halftoneRegion.template = halftoneRegionFlags >> 1 & 3;
  19265. halftoneRegion.enableSkip = !!(halftoneRegionFlags & 8);
  19266. halftoneRegion.combinationOperator = halftoneRegionFlags >> 4 & 7;
  19267. halftoneRegion.defaultPixelValue = halftoneRegionFlags >> 7 & 1;
  19268. halftoneRegion.gridWidth = (0, _core_utils.readUint32)(data, position);
  19269. position += 4;
  19270. halftoneRegion.gridHeight = (0, _core_utils.readUint32)(data, position);
  19271. position += 4;
  19272. halftoneRegion.gridOffsetX = (0, _core_utils.readUint32)(data, position) & 0xffffffff;
  19273. position += 4;
  19274. halftoneRegion.gridOffsetY = (0, _core_utils.readUint32)(data, position) & 0xffffffff;
  19275. position += 4;
  19276. halftoneRegion.gridVectorX = (0, _core_utils.readUint16)(data, position);
  19277. position += 2;
  19278. halftoneRegion.gridVectorY = (0, _core_utils.readUint16)(data, position);
  19279. position += 2;
  19280. args = [halftoneRegion, header.referredTo, data, position, end];
  19281. break;
  19282. case 38:
  19283. case 39:
  19284. const genericRegion = {};
  19285. genericRegion.info = readRegionSegmentInformation(data, position);
  19286. position += RegionSegmentInformationFieldLength;
  19287. const genericRegionSegmentFlags = data[position++];
  19288. genericRegion.mmr = !!(genericRegionSegmentFlags & 1);
  19289. genericRegion.template = genericRegionSegmentFlags >> 1 & 3;
  19290. genericRegion.prediction = !!(genericRegionSegmentFlags & 8);
  19291. if (!genericRegion.mmr) {
  19292. atLength = genericRegion.template === 0 ? 4 : 1;
  19293. at = [];
  19294. for (i = 0; i < atLength; i++) {
  19295. at.push({
  19296. x: (0, _core_utils.readInt8)(data, position),
  19297. y: (0, _core_utils.readInt8)(data, position + 1)
  19298. });
  19299. position += 2;
  19300. }
  19301. genericRegion.at = at;
  19302. }
  19303. args = [genericRegion, data, position, end];
  19304. break;
  19305. case 48:
  19306. const pageInfo = {
  19307. width: (0, _core_utils.readUint32)(data, position),
  19308. height: (0, _core_utils.readUint32)(data, position + 4),
  19309. resolutionX: (0, _core_utils.readUint32)(data, position + 8),
  19310. resolutionY: (0, _core_utils.readUint32)(data, position + 12)
  19311. };
  19312. if (pageInfo.height === 0xffffffff) {
  19313. delete pageInfo.height;
  19314. }
  19315. const pageSegmentFlags = data[position + 16];
  19316. (0, _core_utils.readUint16)(data, position + 17);
  19317. pageInfo.lossless = !!(pageSegmentFlags & 1);
  19318. pageInfo.refinement = !!(pageSegmentFlags & 2);
  19319. pageInfo.defaultPixelValue = pageSegmentFlags >> 2 & 1;
  19320. pageInfo.combinationOperator = pageSegmentFlags >> 3 & 3;
  19321. pageInfo.requiresBuffer = !!(pageSegmentFlags & 32);
  19322. pageInfo.combinationOperatorOverride = !!(pageSegmentFlags & 64);
  19323. args = [pageInfo];
  19324. break;
  19325. case 49:
  19326. break;
  19327. case 50:
  19328. break;
  19329. case 51:
  19330. break;
  19331. case 53:
  19332. args = [header.number, data, position, end];
  19333. break;
  19334. case 62:
  19335. break;
  19336. default:
  19337. throw new Jbig2Error(`segment type ${header.typeName}(${header.type}) is not implemented`);
  19338. }
  19339. const callbackName = "on" + header.typeName;
  19340. if (callbackName in visitor) {
  19341. visitor[callbackName].apply(visitor, args);
  19342. }
  19343. }
  19344. function processSegments(segments, visitor) {
  19345. for (let i = 0, ii = segments.length; i < ii; i++) {
  19346. processSegment(segments[i], visitor);
  19347. }
  19348. }
  19349. function parseJbig2Chunks(chunks) {
  19350. const visitor = new SimpleSegmentVisitor();
  19351. for (let i = 0, ii = chunks.length; i < ii; i++) {
  19352. const chunk = chunks[i];
  19353. const segments = readSegments({}, chunk.data, chunk.start, chunk.end);
  19354. processSegments(segments, visitor);
  19355. }
  19356. return visitor.buffer;
  19357. }
  19358. function parseJbig2(data) {
  19359. throw new Error("Not implemented: parseJbig2");
  19360. }
  19361. class SimpleSegmentVisitor {
  19362. onPageInformation(info) {
  19363. this.currentPageInfo = info;
  19364. const rowSize = info.width + 7 >> 3;
  19365. const buffer = new Uint8ClampedArray(rowSize * info.height);
  19366. if (info.defaultPixelValue) {
  19367. buffer.fill(0xff);
  19368. }
  19369. this.buffer = buffer;
  19370. }
  19371. drawBitmap(regionInfo, bitmap) {
  19372. const pageInfo = this.currentPageInfo;
  19373. const width = regionInfo.width,
  19374. height = regionInfo.height;
  19375. const rowSize = pageInfo.width + 7 >> 3;
  19376. const combinationOperator = pageInfo.combinationOperatorOverride ? regionInfo.combinationOperator : pageInfo.combinationOperator;
  19377. const buffer = this.buffer;
  19378. const mask0 = 128 >> (regionInfo.x & 7);
  19379. let offset0 = regionInfo.y * rowSize + (regionInfo.x >> 3);
  19380. let i, j, mask, offset;
  19381. switch (combinationOperator) {
  19382. case 0:
  19383. for (i = 0; i < height; i++) {
  19384. mask = mask0;
  19385. offset = offset0;
  19386. for (j = 0; j < width; j++) {
  19387. if (bitmap[i][j]) {
  19388. buffer[offset] |= mask;
  19389. }
  19390. mask >>= 1;
  19391. if (!mask) {
  19392. mask = 128;
  19393. offset++;
  19394. }
  19395. }
  19396. offset0 += rowSize;
  19397. }
  19398. break;
  19399. case 2:
  19400. for (i = 0; i < height; i++) {
  19401. mask = mask0;
  19402. offset = offset0;
  19403. for (j = 0; j < width; j++) {
  19404. if (bitmap[i][j]) {
  19405. buffer[offset] ^= mask;
  19406. }
  19407. mask >>= 1;
  19408. if (!mask) {
  19409. mask = 128;
  19410. offset++;
  19411. }
  19412. }
  19413. offset0 += rowSize;
  19414. }
  19415. break;
  19416. default:
  19417. throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
  19418. }
  19419. }
  19420. onImmediateGenericRegion(region, data, start, end) {
  19421. const regionInfo = region.info;
  19422. const decodingContext = new DecodingContext(data, start, end);
  19423. const bitmap = decodeBitmap(region.mmr, regionInfo.width, regionInfo.height, region.template, region.prediction, null, region.at, decodingContext);
  19424. this.drawBitmap(regionInfo, bitmap);
  19425. }
  19426. onImmediateLosslessGenericRegion() {
  19427. this.onImmediateGenericRegion(...arguments);
  19428. }
  19429. onSymbolDictionary(dictionary, currentSegment, referredSegments, data, start, end) {
  19430. let huffmanTables, huffmanInput;
  19431. if (dictionary.huffman) {
  19432. huffmanTables = getSymbolDictionaryHuffmanTables(dictionary, referredSegments, this.customTables);
  19433. huffmanInput = new Reader(data, start, end);
  19434. }
  19435. let symbols = this.symbols;
  19436. if (!symbols) {
  19437. this.symbols = symbols = {};
  19438. }
  19439. const inputSymbols = [];
  19440. for (const referredSegment of referredSegments) {
  19441. const referredSymbols = symbols[referredSegment];
  19442. if (referredSymbols) {
  19443. inputSymbols.push(...referredSymbols);
  19444. }
  19445. }
  19446. const decodingContext = new DecodingContext(data, start, end);
  19447. symbols[currentSegment] = decodeSymbolDictionary(dictionary.huffman, dictionary.refinement, inputSymbols, dictionary.numberOfNewSymbols, dictionary.numberOfExportedSymbols, huffmanTables, dictionary.template, dictionary.at, dictionary.refinementTemplate, dictionary.refinementAt, decodingContext, huffmanInput);
  19448. }
  19449. onImmediateTextRegion(region, referredSegments, data, start, end) {
  19450. const regionInfo = region.info;
  19451. let huffmanTables, huffmanInput;
  19452. const symbols = this.symbols;
  19453. const inputSymbols = [];
  19454. for (const referredSegment of referredSegments) {
  19455. const referredSymbols = symbols[referredSegment];
  19456. if (referredSymbols) {
  19457. inputSymbols.push(...referredSymbols);
  19458. }
  19459. }
  19460. const symbolCodeLength = (0, _core_utils.log2)(inputSymbols.length);
  19461. if (region.huffman) {
  19462. huffmanInput = new Reader(data, start, end);
  19463. huffmanTables = getTextRegionHuffmanTables(region, referredSegments, this.customTables, inputSymbols.length, huffmanInput);
  19464. }
  19465. const decodingContext = new DecodingContext(data, start, end);
  19466. 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);
  19467. this.drawBitmap(regionInfo, bitmap);
  19468. }
  19469. onImmediateLosslessTextRegion() {
  19470. this.onImmediateTextRegion(...arguments);
  19471. }
  19472. onPatternDictionary(dictionary, currentSegment, data, start, end) {
  19473. let patterns = this.patterns;
  19474. if (!patterns) {
  19475. this.patterns = patterns = {};
  19476. }
  19477. const decodingContext = new DecodingContext(data, start, end);
  19478. patterns[currentSegment] = decodePatternDictionary(dictionary.mmr, dictionary.patternWidth, dictionary.patternHeight, dictionary.maxPatternIndex, dictionary.template, decodingContext);
  19479. }
  19480. onImmediateHalftoneRegion(region, referredSegments, data, start, end) {
  19481. const patterns = this.patterns[referredSegments[0]];
  19482. const regionInfo = region.info;
  19483. const decodingContext = new DecodingContext(data, start, end);
  19484. 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);
  19485. this.drawBitmap(regionInfo, bitmap);
  19486. }
  19487. onImmediateLosslessHalftoneRegion() {
  19488. this.onImmediateHalftoneRegion(...arguments);
  19489. }
  19490. onTables(currentSegment, data, start, end) {
  19491. let customTables = this.customTables;
  19492. if (!customTables) {
  19493. this.customTables = customTables = {};
  19494. }
  19495. customTables[currentSegment] = decodeTablesSegment(data, start, end);
  19496. }
  19497. }
  19498. class HuffmanLine {
  19499. constructor(lineData) {
  19500. if (lineData.length === 2) {
  19501. this.isOOB = true;
  19502. this.rangeLow = 0;
  19503. this.prefixLength = lineData[0];
  19504. this.rangeLength = 0;
  19505. this.prefixCode = lineData[1];
  19506. this.isLowerRange = false;
  19507. } else {
  19508. this.isOOB = false;
  19509. this.rangeLow = lineData[0];
  19510. this.prefixLength = lineData[1];
  19511. this.rangeLength = lineData[2];
  19512. this.prefixCode = lineData[3];
  19513. this.isLowerRange = lineData[4] === "lower";
  19514. }
  19515. }
  19516. }
  19517. class HuffmanTreeNode {
  19518. constructor(line) {
  19519. this.children = [];
  19520. if (line) {
  19521. this.isLeaf = true;
  19522. this.rangeLength = line.rangeLength;
  19523. this.rangeLow = line.rangeLow;
  19524. this.isLowerRange = line.isLowerRange;
  19525. this.isOOB = line.isOOB;
  19526. } else {
  19527. this.isLeaf = false;
  19528. }
  19529. }
  19530. buildTree(line, shift) {
  19531. const bit = line.prefixCode >> shift & 1;
  19532. if (shift <= 0) {
  19533. this.children[bit] = new HuffmanTreeNode(line);
  19534. } else {
  19535. let node = this.children[bit];
  19536. if (!node) {
  19537. this.children[bit] = node = new HuffmanTreeNode(null);
  19538. }
  19539. node.buildTree(line, shift - 1);
  19540. }
  19541. }
  19542. decodeNode(reader) {
  19543. if (this.isLeaf) {
  19544. if (this.isOOB) {
  19545. return null;
  19546. }
  19547. const htOffset = reader.readBits(this.rangeLength);
  19548. return this.rangeLow + (this.isLowerRange ? -htOffset : htOffset);
  19549. }
  19550. const node = this.children[reader.readBit()];
  19551. if (!node) {
  19552. throw new Jbig2Error("invalid Huffman data");
  19553. }
  19554. return node.decodeNode(reader);
  19555. }
  19556. }
  19557. class HuffmanTable {
  19558. constructor(lines, prefixCodesDone) {
  19559. if (!prefixCodesDone) {
  19560. this.assignPrefixCodes(lines);
  19561. }
  19562. this.rootNode = new HuffmanTreeNode(null);
  19563. for (let i = 0, ii = lines.length; i < ii; i++) {
  19564. const line = lines[i];
  19565. if (line.prefixLength > 0) {
  19566. this.rootNode.buildTree(line, line.prefixLength - 1);
  19567. }
  19568. }
  19569. }
  19570. decode(reader) {
  19571. return this.rootNode.decodeNode(reader);
  19572. }
  19573. assignPrefixCodes(lines) {
  19574. const linesLength = lines.length;
  19575. let prefixLengthMax = 0;
  19576. for (let i = 0; i < linesLength; i++) {
  19577. prefixLengthMax = Math.max(prefixLengthMax, lines[i].prefixLength);
  19578. }
  19579. const histogram = new Uint32Array(prefixLengthMax + 1);
  19580. for (let i = 0; i < linesLength; i++) {
  19581. histogram[lines[i].prefixLength]++;
  19582. }
  19583. let currentLength = 1,
  19584. firstCode = 0,
  19585. currentCode,
  19586. currentTemp,
  19587. line;
  19588. histogram[0] = 0;
  19589. while (currentLength <= prefixLengthMax) {
  19590. firstCode = firstCode + histogram[currentLength - 1] << 1;
  19591. currentCode = firstCode;
  19592. currentTemp = 0;
  19593. while (currentTemp < linesLength) {
  19594. line = lines[currentTemp];
  19595. if (line.prefixLength === currentLength) {
  19596. line.prefixCode = currentCode;
  19597. currentCode++;
  19598. }
  19599. currentTemp++;
  19600. }
  19601. currentLength++;
  19602. }
  19603. }
  19604. }
  19605. function decodeTablesSegment(data, start, end) {
  19606. const flags = data[start];
  19607. const lowestValue = (0, _core_utils.readUint32)(data, start + 1) & 0xffffffff;
  19608. const highestValue = (0, _core_utils.readUint32)(data, start + 5) & 0xffffffff;
  19609. const reader = new Reader(data, start + 9, end);
  19610. const prefixSizeBits = (flags >> 1 & 7) + 1;
  19611. const rangeSizeBits = (flags >> 4 & 7) + 1;
  19612. const lines = [];
  19613. let prefixLength,
  19614. rangeLength,
  19615. currentRangeLow = lowestValue;
  19616. do {
  19617. prefixLength = reader.readBits(prefixSizeBits);
  19618. rangeLength = reader.readBits(rangeSizeBits);
  19619. lines.push(new HuffmanLine([currentRangeLow, prefixLength, rangeLength, 0]));
  19620. currentRangeLow += 1 << rangeLength;
  19621. } while (currentRangeLow < highestValue);
  19622. prefixLength = reader.readBits(prefixSizeBits);
  19623. lines.push(new HuffmanLine([lowestValue - 1, prefixLength, 32, 0, "lower"]));
  19624. prefixLength = reader.readBits(prefixSizeBits);
  19625. lines.push(new HuffmanLine([highestValue, prefixLength, 32, 0]));
  19626. if (flags & 1) {
  19627. prefixLength = reader.readBits(prefixSizeBits);
  19628. lines.push(new HuffmanLine([prefixLength, 0]));
  19629. }
  19630. return new HuffmanTable(lines, false);
  19631. }
  19632. const standardTablesCache = {};
  19633. function getStandardTable(number) {
  19634. let table = standardTablesCache[number];
  19635. if (table) {
  19636. return table;
  19637. }
  19638. let lines;
  19639. switch (number) {
  19640. case 1:
  19641. lines = [[0, 1, 4, 0x0], [16, 2, 8, 0x2], [272, 3, 16, 0x6], [65808, 3, 32, 0x7]];
  19642. break;
  19643. case 2:
  19644. 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]];
  19645. break;
  19646. case 3:
  19647. 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]];
  19648. break;
  19649. case 4:
  19650. 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]];
  19651. break;
  19652. case 5:
  19653. 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]];
  19654. break;
  19655. case 6:
  19656. 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]];
  19657. break;
  19658. case 7:
  19659. 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]];
  19660. break;
  19661. case 8:
  19662. 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]];
  19663. break;
  19664. case 9:
  19665. 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]];
  19666. break;
  19667. case 10:
  19668. 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]];
  19669. break;
  19670. case 11:
  19671. 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]];
  19672. break;
  19673. case 12:
  19674. 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]];
  19675. break;
  19676. case 13:
  19677. 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]];
  19678. break;
  19679. case 14:
  19680. lines = [[-2, 3, 0, 0x4], [-1, 3, 0, 0x5], [0, 1, 0, 0x0], [1, 3, 0, 0x6], [2, 3, 0, 0x7]];
  19681. break;
  19682. case 15:
  19683. 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]];
  19684. break;
  19685. default:
  19686. throw new Jbig2Error(`standard table B.${number} does not exist`);
  19687. }
  19688. for (let i = 0, ii = lines.length; i < ii; i++) {
  19689. lines[i] = new HuffmanLine(lines[i]);
  19690. }
  19691. table = new HuffmanTable(lines, true);
  19692. standardTablesCache[number] = table;
  19693. return table;
  19694. }
  19695. class Reader {
  19696. constructor(data, start, end) {
  19697. this.data = data;
  19698. this.start = start;
  19699. this.end = end;
  19700. this.position = start;
  19701. this.shift = -1;
  19702. this.currentByte = 0;
  19703. }
  19704. readBit() {
  19705. if (this.shift < 0) {
  19706. if (this.position >= this.end) {
  19707. throw new Jbig2Error("end of data while reading bit");
  19708. }
  19709. this.currentByte = this.data[this.position++];
  19710. this.shift = 7;
  19711. }
  19712. const bit = this.currentByte >> this.shift & 1;
  19713. this.shift--;
  19714. return bit;
  19715. }
  19716. readBits(numBits) {
  19717. let result = 0,
  19718. i;
  19719. for (i = numBits - 1; i >= 0; i--) {
  19720. result |= this.readBit() << i;
  19721. }
  19722. return result;
  19723. }
  19724. byteAlign() {
  19725. this.shift = -1;
  19726. }
  19727. next() {
  19728. if (this.position >= this.end) {
  19729. return -1;
  19730. }
  19731. return this.data[this.position++];
  19732. }
  19733. }
  19734. function getCustomHuffmanTable(index, referredTo, customTables) {
  19735. let currentIndex = 0;
  19736. for (let i = 0, ii = referredTo.length; i < ii; i++) {
  19737. const table = customTables[referredTo[i]];
  19738. if (table) {
  19739. if (index === currentIndex) {
  19740. return table;
  19741. }
  19742. currentIndex++;
  19743. }
  19744. }
  19745. throw new Jbig2Error("can't find custom Huffman table");
  19746. }
  19747. function getTextRegionHuffmanTables(textRegion, referredTo, customTables, numberOfSymbols, reader) {
  19748. const codes = [];
  19749. for (let i = 0; i <= 34; i++) {
  19750. const codeLength = reader.readBits(4);
  19751. codes.push(new HuffmanLine([i, codeLength, 0, 0]));
  19752. }
  19753. const runCodesTable = new HuffmanTable(codes, false);
  19754. codes.length = 0;
  19755. for (let i = 0; i < numberOfSymbols;) {
  19756. const codeLength = runCodesTable.decode(reader);
  19757. if (codeLength >= 32) {
  19758. let repeatedLength, numberOfRepeats, j;
  19759. switch (codeLength) {
  19760. case 32:
  19761. if (i === 0) {
  19762. throw new Jbig2Error("no previous value in symbol ID table");
  19763. }
  19764. numberOfRepeats = reader.readBits(2) + 3;
  19765. repeatedLength = codes[i - 1].prefixLength;
  19766. break;
  19767. case 33:
  19768. numberOfRepeats = reader.readBits(3) + 3;
  19769. repeatedLength = 0;
  19770. break;
  19771. case 34:
  19772. numberOfRepeats = reader.readBits(7) + 11;
  19773. repeatedLength = 0;
  19774. break;
  19775. default:
  19776. throw new Jbig2Error("invalid code length in symbol ID table");
  19777. }
  19778. for (j = 0; j < numberOfRepeats; j++) {
  19779. codes.push(new HuffmanLine([i, repeatedLength, 0, 0]));
  19780. i++;
  19781. }
  19782. } else {
  19783. codes.push(new HuffmanLine([i, codeLength, 0, 0]));
  19784. i++;
  19785. }
  19786. }
  19787. reader.byteAlign();
  19788. const symbolIDTable = new HuffmanTable(codes, false);
  19789. let customIndex = 0,
  19790. tableFirstS,
  19791. tableDeltaS,
  19792. tableDeltaT;
  19793. switch (textRegion.huffmanFS) {
  19794. case 0:
  19795. case 1:
  19796. tableFirstS = getStandardTable(textRegion.huffmanFS + 6);
  19797. break;
  19798. case 3:
  19799. tableFirstS = getCustomHuffmanTable(customIndex, referredTo, customTables);
  19800. customIndex++;
  19801. break;
  19802. default:
  19803. throw new Jbig2Error("invalid Huffman FS selector");
  19804. }
  19805. switch (textRegion.huffmanDS) {
  19806. case 0:
  19807. case 1:
  19808. case 2:
  19809. tableDeltaS = getStandardTable(textRegion.huffmanDS + 8);
  19810. break;
  19811. case 3:
  19812. tableDeltaS = getCustomHuffmanTable(customIndex, referredTo, customTables);
  19813. customIndex++;
  19814. break;
  19815. default:
  19816. throw new Jbig2Error("invalid Huffman DS selector");
  19817. }
  19818. switch (textRegion.huffmanDT) {
  19819. case 0:
  19820. case 1:
  19821. case 2:
  19822. tableDeltaT = getStandardTable(textRegion.huffmanDT + 11);
  19823. break;
  19824. case 3:
  19825. tableDeltaT = getCustomHuffmanTable(customIndex, referredTo, customTables);
  19826. customIndex++;
  19827. break;
  19828. default:
  19829. throw new Jbig2Error("invalid Huffman DT selector");
  19830. }
  19831. if (textRegion.refinement) {
  19832. throw new Jbig2Error("refinement with Huffman is not supported");
  19833. }
  19834. return {
  19835. symbolIDTable,
  19836. tableFirstS,
  19837. tableDeltaS,
  19838. tableDeltaT
  19839. };
  19840. }
  19841. function getSymbolDictionaryHuffmanTables(dictionary, referredTo, customTables) {
  19842. let customIndex = 0,
  19843. tableDeltaHeight,
  19844. tableDeltaWidth;
  19845. switch (dictionary.huffmanDHSelector) {
  19846. case 0:
  19847. case 1:
  19848. tableDeltaHeight = getStandardTable(dictionary.huffmanDHSelector + 4);
  19849. break;
  19850. case 3:
  19851. tableDeltaHeight = getCustomHuffmanTable(customIndex, referredTo, customTables);
  19852. customIndex++;
  19853. break;
  19854. default:
  19855. throw new Jbig2Error("invalid Huffman DH selector");
  19856. }
  19857. switch (dictionary.huffmanDWSelector) {
  19858. case 0:
  19859. case 1:
  19860. tableDeltaWidth = getStandardTable(dictionary.huffmanDWSelector + 2);
  19861. break;
  19862. case 3:
  19863. tableDeltaWidth = getCustomHuffmanTable(customIndex, referredTo, customTables);
  19864. customIndex++;
  19865. break;
  19866. default:
  19867. throw new Jbig2Error("invalid Huffman DW selector");
  19868. }
  19869. let tableBitmapSize, tableAggregateInstances;
  19870. if (dictionary.bitmapSizeSelector) {
  19871. tableBitmapSize = getCustomHuffmanTable(customIndex, referredTo, customTables);
  19872. customIndex++;
  19873. } else {
  19874. tableBitmapSize = getStandardTable(1);
  19875. }
  19876. if (dictionary.aggregationInstancesSelector) {
  19877. tableAggregateInstances = getCustomHuffmanTable(customIndex, referredTo, customTables);
  19878. } else {
  19879. tableAggregateInstances = getStandardTable(1);
  19880. }
  19881. return {
  19882. tableDeltaHeight,
  19883. tableDeltaWidth,
  19884. tableBitmapSize,
  19885. tableAggregateInstances
  19886. };
  19887. }
  19888. function readUncompressedBitmap(reader, width, height) {
  19889. const bitmap = [];
  19890. for (let y = 0; y < height; y++) {
  19891. const row = new Uint8Array(width);
  19892. bitmap.push(row);
  19893. for (let x = 0; x < width; x++) {
  19894. row[x] = reader.readBit();
  19895. }
  19896. reader.byteAlign();
  19897. }
  19898. return bitmap;
  19899. }
  19900. function decodeMMRBitmap(input, width, height, endOfBlock) {
  19901. const params = {
  19902. K: -1,
  19903. Columns: width,
  19904. Rows: height,
  19905. BlackIs1: true,
  19906. EndOfBlock: endOfBlock
  19907. };
  19908. const decoder = new _ccitt.CCITTFaxDecoder(input, params);
  19909. const bitmap = [];
  19910. let currentByte,
  19911. eof = false;
  19912. for (let y = 0; y < height; y++) {
  19913. const row = new Uint8Array(width);
  19914. bitmap.push(row);
  19915. let shift = -1;
  19916. for (let x = 0; x < width; x++) {
  19917. if (shift < 0) {
  19918. currentByte = decoder.readNextChar();
  19919. if (currentByte === -1) {
  19920. currentByte = 0;
  19921. eof = true;
  19922. }
  19923. shift = 7;
  19924. }
  19925. row[x] = currentByte >> shift & 1;
  19926. shift--;
  19927. }
  19928. }
  19929. if (endOfBlock && !eof) {
  19930. const lookForEOFLimit = 5;
  19931. for (let i = 0; i < lookForEOFLimit; i++) {
  19932. if (decoder.readNextChar() === -1) {
  19933. break;
  19934. }
  19935. }
  19936. }
  19937. return bitmap;
  19938. }
  19939. class Jbig2Image {
  19940. parseChunks(chunks) {
  19941. return parseJbig2Chunks(chunks);
  19942. }
  19943. parse(data) {
  19944. throw new Error("Not implemented: Jbig2Image.parse");
  19945. }
  19946. }
  19947. exports.Jbig2Image = Jbig2Image;
  19948. /***/ }),
  19949. /* 155 */
  19950. /***/ ((__unused_webpack_module, exports) => {
  19951. "use strict";
  19952. Object.defineProperty(exports, "__esModule", ({
  19953. value: true
  19954. }));
  19955. exports.ArithmeticDecoder = void 0;
  19956. const QeTable = [{
  19957. qe: 0x5601,
  19958. nmps: 1,
  19959. nlps: 1,
  19960. switchFlag: 1
  19961. }, {
  19962. qe: 0x3401,
  19963. nmps: 2,
  19964. nlps: 6,
  19965. switchFlag: 0
  19966. }, {
  19967. qe: 0x1801,
  19968. nmps: 3,
  19969. nlps: 9,
  19970. switchFlag: 0
  19971. }, {
  19972. qe: 0x0ac1,
  19973. nmps: 4,
  19974. nlps: 12,
  19975. switchFlag: 0
  19976. }, {
  19977. qe: 0x0521,
  19978. nmps: 5,
  19979. nlps: 29,
  19980. switchFlag: 0
  19981. }, {
  19982. qe: 0x0221,
  19983. nmps: 38,
  19984. nlps: 33,
  19985. switchFlag: 0
  19986. }, {
  19987. qe: 0x5601,
  19988. nmps: 7,
  19989. nlps: 6,
  19990. switchFlag: 1
  19991. }, {
  19992. qe: 0x5401,
  19993. nmps: 8,
  19994. nlps: 14,
  19995. switchFlag: 0
  19996. }, {
  19997. qe: 0x4801,
  19998. nmps: 9,
  19999. nlps: 14,
  20000. switchFlag: 0
  20001. }, {
  20002. qe: 0x3801,
  20003. nmps: 10,
  20004. nlps: 14,
  20005. switchFlag: 0
  20006. }, {
  20007. qe: 0x3001,
  20008. nmps: 11,
  20009. nlps: 17,
  20010. switchFlag: 0
  20011. }, {
  20012. qe: 0x2401,
  20013. nmps: 12,
  20014. nlps: 18,
  20015. switchFlag: 0
  20016. }, {
  20017. qe: 0x1c01,
  20018. nmps: 13,
  20019. nlps: 20,
  20020. switchFlag: 0
  20021. }, {
  20022. qe: 0x1601,
  20023. nmps: 29,
  20024. nlps: 21,
  20025. switchFlag: 0
  20026. }, {
  20027. qe: 0x5601,
  20028. nmps: 15,
  20029. nlps: 14,
  20030. switchFlag: 1
  20031. }, {
  20032. qe: 0x5401,
  20033. nmps: 16,
  20034. nlps: 14,
  20035. switchFlag: 0
  20036. }, {
  20037. qe: 0x5101,
  20038. nmps: 17,
  20039. nlps: 15,
  20040. switchFlag: 0
  20041. }, {
  20042. qe: 0x4801,
  20043. nmps: 18,
  20044. nlps: 16,
  20045. switchFlag: 0
  20046. }, {
  20047. qe: 0x3801,
  20048. nmps: 19,
  20049. nlps: 17,
  20050. switchFlag: 0
  20051. }, {
  20052. qe: 0x3401,
  20053. nmps: 20,
  20054. nlps: 18,
  20055. switchFlag: 0
  20056. }, {
  20057. qe: 0x3001,
  20058. nmps: 21,
  20059. nlps: 19,
  20060. switchFlag: 0
  20061. }, {
  20062. qe: 0x2801,
  20063. nmps: 22,
  20064. nlps: 19,
  20065. switchFlag: 0
  20066. }, {
  20067. qe: 0x2401,
  20068. nmps: 23,
  20069. nlps: 20,
  20070. switchFlag: 0
  20071. }, {
  20072. qe: 0x2201,
  20073. nmps: 24,
  20074. nlps: 21,
  20075. switchFlag: 0
  20076. }, {
  20077. qe: 0x1c01,
  20078. nmps: 25,
  20079. nlps: 22,
  20080. switchFlag: 0
  20081. }, {
  20082. qe: 0x1801,
  20083. nmps: 26,
  20084. nlps: 23,
  20085. switchFlag: 0
  20086. }, {
  20087. qe: 0x1601,
  20088. nmps: 27,
  20089. nlps: 24,
  20090. switchFlag: 0
  20091. }, {
  20092. qe: 0x1401,
  20093. nmps: 28,
  20094. nlps: 25,
  20095. switchFlag: 0
  20096. }, {
  20097. qe: 0x1201,
  20098. nmps: 29,
  20099. nlps: 26,
  20100. switchFlag: 0
  20101. }, {
  20102. qe: 0x1101,
  20103. nmps: 30,
  20104. nlps: 27,
  20105. switchFlag: 0
  20106. }, {
  20107. qe: 0x0ac1,
  20108. nmps: 31,
  20109. nlps: 28,
  20110. switchFlag: 0
  20111. }, {
  20112. qe: 0x09c1,
  20113. nmps: 32,
  20114. nlps: 29,
  20115. switchFlag: 0
  20116. }, {
  20117. qe: 0x08a1,
  20118. nmps: 33,
  20119. nlps: 30,
  20120. switchFlag: 0
  20121. }, {
  20122. qe: 0x0521,
  20123. nmps: 34,
  20124. nlps: 31,
  20125. switchFlag: 0
  20126. }, {
  20127. qe: 0x0441,
  20128. nmps: 35,
  20129. nlps: 32,
  20130. switchFlag: 0
  20131. }, {
  20132. qe: 0x02a1,
  20133. nmps: 36,
  20134. nlps: 33,
  20135. switchFlag: 0
  20136. }, {
  20137. qe: 0x0221,
  20138. nmps: 37,
  20139. nlps: 34,
  20140. switchFlag: 0
  20141. }, {
  20142. qe: 0x0141,
  20143. nmps: 38,
  20144. nlps: 35,
  20145. switchFlag: 0
  20146. }, {
  20147. qe: 0x0111,
  20148. nmps: 39,
  20149. nlps: 36,
  20150. switchFlag: 0
  20151. }, {
  20152. qe: 0x0085,
  20153. nmps: 40,
  20154. nlps: 37,
  20155. switchFlag: 0
  20156. }, {
  20157. qe: 0x0049,
  20158. nmps: 41,
  20159. nlps: 38,
  20160. switchFlag: 0
  20161. }, {
  20162. qe: 0x0025,
  20163. nmps: 42,
  20164. nlps: 39,
  20165. switchFlag: 0
  20166. }, {
  20167. qe: 0x0015,
  20168. nmps: 43,
  20169. nlps: 40,
  20170. switchFlag: 0
  20171. }, {
  20172. qe: 0x0009,
  20173. nmps: 44,
  20174. nlps: 41,
  20175. switchFlag: 0
  20176. }, {
  20177. qe: 0x0005,
  20178. nmps: 45,
  20179. nlps: 42,
  20180. switchFlag: 0
  20181. }, {
  20182. qe: 0x0001,
  20183. nmps: 45,
  20184. nlps: 43,
  20185. switchFlag: 0
  20186. }, {
  20187. qe: 0x5601,
  20188. nmps: 46,
  20189. nlps: 46,
  20190. switchFlag: 0
  20191. }];
  20192. class ArithmeticDecoder {
  20193. constructor(data, start, end) {
  20194. this.data = data;
  20195. this.bp = start;
  20196. this.dataEnd = end;
  20197. this.chigh = data[start];
  20198. this.clow = 0;
  20199. this.byteIn();
  20200. this.chigh = this.chigh << 7 & 0xffff | this.clow >> 9 & 0x7f;
  20201. this.clow = this.clow << 7 & 0xffff;
  20202. this.ct -= 7;
  20203. this.a = 0x8000;
  20204. }
  20205. byteIn() {
  20206. const data = this.data;
  20207. let bp = this.bp;
  20208. if (data[bp] === 0xff) {
  20209. if (data[bp + 1] > 0x8f) {
  20210. this.clow += 0xff00;
  20211. this.ct = 8;
  20212. } else {
  20213. bp++;
  20214. this.clow += data[bp] << 9;
  20215. this.ct = 7;
  20216. this.bp = bp;
  20217. }
  20218. } else {
  20219. bp++;
  20220. this.clow += bp < this.dataEnd ? data[bp] << 8 : 0xff00;
  20221. this.ct = 8;
  20222. this.bp = bp;
  20223. }
  20224. if (this.clow > 0xffff) {
  20225. this.chigh += this.clow >> 16;
  20226. this.clow &= 0xffff;
  20227. }
  20228. }
  20229. readBit(contexts, pos) {
  20230. let cx_index = contexts[pos] >> 1,
  20231. cx_mps = contexts[pos] & 1;
  20232. const qeTableIcx = QeTable[cx_index];
  20233. const qeIcx = qeTableIcx.qe;
  20234. let d;
  20235. let a = this.a - qeIcx;
  20236. if (this.chigh < qeIcx) {
  20237. if (a < qeIcx) {
  20238. a = qeIcx;
  20239. d = cx_mps;
  20240. cx_index = qeTableIcx.nmps;
  20241. } else {
  20242. a = qeIcx;
  20243. d = 1 ^ cx_mps;
  20244. if (qeTableIcx.switchFlag === 1) {
  20245. cx_mps = d;
  20246. }
  20247. cx_index = qeTableIcx.nlps;
  20248. }
  20249. } else {
  20250. this.chigh -= qeIcx;
  20251. if ((a & 0x8000) !== 0) {
  20252. this.a = a;
  20253. return cx_mps;
  20254. }
  20255. if (a < qeIcx) {
  20256. d = 1 ^ cx_mps;
  20257. if (qeTableIcx.switchFlag === 1) {
  20258. cx_mps = d;
  20259. }
  20260. cx_index = qeTableIcx.nlps;
  20261. } else {
  20262. d = cx_mps;
  20263. cx_index = qeTableIcx.nmps;
  20264. }
  20265. }
  20266. do {
  20267. if (this.ct === 0) {
  20268. this.byteIn();
  20269. }
  20270. a <<= 1;
  20271. this.chigh = this.chigh << 1 & 0xffff | this.clow >> 15 & 1;
  20272. this.clow = this.clow << 1 & 0xffff;
  20273. this.ct--;
  20274. } while ((a & 0x8000) === 0);
  20275. this.a = a;
  20276. contexts[pos] = cx_index << 1 | cx_mps;
  20277. return d;
  20278. }
  20279. }
  20280. exports.ArithmeticDecoder = ArithmeticDecoder;
  20281. /***/ }),
  20282. /* 156 */
  20283. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  20284. "use strict";
  20285. Object.defineProperty(exports, "__esModule", ({
  20286. value: true
  20287. }));
  20288. exports.JpegStream = void 0;
  20289. var _decode_stream = __w_pdfjs_require__(148);
  20290. var _primitives = __w_pdfjs_require__(134);
  20291. var _jpg = __w_pdfjs_require__(157);
  20292. var _util = __w_pdfjs_require__(2);
  20293. class JpegStream extends _decode_stream.DecodeStream {
  20294. constructor(stream, maybeLength, params) {
  20295. let ch;
  20296. while ((ch = stream.getByte()) !== -1) {
  20297. if (ch === 0xff) {
  20298. stream.skip(-1);
  20299. break;
  20300. }
  20301. }
  20302. super(maybeLength);
  20303. this.stream = stream;
  20304. this.dict = stream.dict;
  20305. this.maybeLength = maybeLength;
  20306. this.params = params;
  20307. }
  20308. get bytes() {
  20309. return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength));
  20310. }
  20311. ensureBuffer(requested) {}
  20312. readBlock() {
  20313. if (this.eof) {
  20314. return;
  20315. }
  20316. const jpegOptions = {
  20317. decodeTransform: undefined,
  20318. colorTransform: undefined
  20319. };
  20320. const decodeArr = this.dict.getArray("D", "Decode");
  20321. if (this.forceRGB && Array.isArray(decodeArr)) {
  20322. const bitsPerComponent = this.dict.get("BPC", "BitsPerComponent") || 8;
  20323. const decodeArrLength = decodeArr.length;
  20324. const transform = new Int32Array(decodeArrLength);
  20325. let transformNeeded = false;
  20326. const maxValue = (1 << bitsPerComponent) - 1;
  20327. for (let i = 0; i < decodeArrLength; i += 2) {
  20328. transform[i] = (decodeArr[i + 1] - decodeArr[i]) * 256 | 0;
  20329. transform[i + 1] = decodeArr[i] * maxValue | 0;
  20330. if (transform[i] !== 256 || transform[i + 1] !== 0) {
  20331. transformNeeded = true;
  20332. }
  20333. }
  20334. if (transformNeeded) {
  20335. jpegOptions.decodeTransform = transform;
  20336. }
  20337. }
  20338. if (this.params instanceof _primitives.Dict) {
  20339. const colorTransform = this.params.get("ColorTransform");
  20340. if (Number.isInteger(colorTransform)) {
  20341. jpegOptions.colorTransform = colorTransform;
  20342. }
  20343. }
  20344. const jpegImage = new _jpg.JpegImage(jpegOptions);
  20345. jpegImage.parse(this.bytes);
  20346. const data = jpegImage.getData({
  20347. width: this.drawWidth,
  20348. height: this.drawHeight,
  20349. forceRGB: this.forceRGB,
  20350. isSourcePDF: true
  20351. });
  20352. this.buffer = data;
  20353. this.bufferLength = data.length;
  20354. this.eof = true;
  20355. }
  20356. }
  20357. exports.JpegStream = JpegStream;
  20358. /***/ }),
  20359. /* 157 */
  20360. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  20361. "use strict";
  20362. Object.defineProperty(exports, "__esModule", ({
  20363. value: true
  20364. }));
  20365. exports.JpegImage = void 0;
  20366. var _util = __w_pdfjs_require__(2);
  20367. var _core_utils = __w_pdfjs_require__(135);
  20368. class JpegError extends _util.BaseException {
  20369. constructor(msg) {
  20370. super(`JPEG error: ${msg}`, "JpegError");
  20371. }
  20372. }
  20373. class DNLMarkerError extends _util.BaseException {
  20374. constructor(message, scanLines) {
  20375. super(message, "DNLMarkerError");
  20376. this.scanLines = scanLines;
  20377. }
  20378. }
  20379. class EOIMarkerError extends _util.BaseException {
  20380. constructor(msg) {
  20381. super(msg, "EOIMarkerError");
  20382. }
  20383. }
  20384. 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]);
  20385. const dctCos1 = 4017;
  20386. const dctSin1 = 799;
  20387. const dctCos3 = 3406;
  20388. const dctSin3 = 2276;
  20389. const dctCos6 = 1567;
  20390. const dctSin6 = 3784;
  20391. const dctSqrt2 = 5793;
  20392. const dctSqrt1d2 = 2896;
  20393. function buildHuffmanTable(codeLengths, values) {
  20394. let k = 0,
  20395. i,
  20396. j,
  20397. length = 16;
  20398. while (length > 0 && !codeLengths[length - 1]) {
  20399. length--;
  20400. }
  20401. const code = [{
  20402. children: [],
  20403. index: 0
  20404. }];
  20405. let p = code[0],
  20406. q;
  20407. for (i = 0; i < length; i++) {
  20408. for (j = 0; j < codeLengths[i]; j++) {
  20409. p = code.pop();
  20410. p.children[p.index] = values[k];
  20411. while (p.index > 0) {
  20412. p = code.pop();
  20413. }
  20414. p.index++;
  20415. code.push(p);
  20416. while (code.length <= i) {
  20417. code.push(q = {
  20418. children: [],
  20419. index: 0
  20420. });
  20421. p.children[p.index] = q.children;
  20422. p = q;
  20423. }
  20424. k++;
  20425. }
  20426. if (i + 1 < length) {
  20427. code.push(q = {
  20428. children: [],
  20429. index: 0
  20430. });
  20431. p.children[p.index] = q.children;
  20432. p = q;
  20433. }
  20434. }
  20435. return code[0].children;
  20436. }
  20437. function getBlockBufferOffset(component, row, col) {
  20438. return 64 * ((component.blocksPerLine + 1) * row + col);
  20439. }
  20440. function decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successivePrev, successive) {
  20441. let parseDNLMarker = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : false;
  20442. const mcusPerLine = frame.mcusPerLine;
  20443. const progressive = frame.progressive;
  20444. const startOffset = offset;
  20445. let bitsData = 0,
  20446. bitsCount = 0;
  20447. function readBit() {
  20448. if (bitsCount > 0) {
  20449. bitsCount--;
  20450. return bitsData >> bitsCount & 1;
  20451. }
  20452. bitsData = data[offset++];
  20453. if (bitsData === 0xff) {
  20454. const nextByte = data[offset++];
  20455. if (nextByte) {
  20456. if (nextByte === 0xdc && parseDNLMarker) {
  20457. offset += 2;
  20458. const scanLines = (0, _core_utils.readUint16)(data, offset);
  20459. offset += 2;
  20460. if (scanLines > 0 && scanLines !== frame.scanLines) {
  20461. throw new DNLMarkerError("Found DNL marker (0xFFDC) while parsing scan data", scanLines);
  20462. }
  20463. } else if (nextByte === 0xd9) {
  20464. if (parseDNLMarker) {
  20465. const maybeScanLines = blockRow * (frame.precision === 8 ? 8 : 0);
  20466. if (maybeScanLines > 0 && Math.round(frame.scanLines / maybeScanLines) >= 5) {
  20467. throw new DNLMarkerError("Found EOI marker (0xFFD9) while parsing scan data, " + "possibly caused by incorrect `scanLines` parameter", maybeScanLines);
  20468. }
  20469. }
  20470. throw new EOIMarkerError("Found EOI marker (0xFFD9) while parsing scan data");
  20471. }
  20472. throw new JpegError(`unexpected marker ${(bitsData << 8 | nextByte).toString(16)}`);
  20473. }
  20474. }
  20475. bitsCount = 7;
  20476. return bitsData >>> 7;
  20477. }
  20478. function decodeHuffman(tree) {
  20479. let node = tree;
  20480. while (true) {
  20481. node = node[readBit()];
  20482. switch (typeof node) {
  20483. case "number":
  20484. return node;
  20485. case "object":
  20486. continue;
  20487. }
  20488. throw new JpegError("invalid huffman sequence");
  20489. }
  20490. }
  20491. function receive(length) {
  20492. let n = 0;
  20493. while (length > 0) {
  20494. n = n << 1 | readBit();
  20495. length--;
  20496. }
  20497. return n;
  20498. }
  20499. function receiveAndExtend(length) {
  20500. if (length === 1) {
  20501. return readBit() === 1 ? 1 : -1;
  20502. }
  20503. const n = receive(length);
  20504. if (n >= 1 << length - 1) {
  20505. return n;
  20506. }
  20507. return n + (-1 << length) + 1;
  20508. }
  20509. function decodeBaseline(component, blockOffset) {
  20510. const t = decodeHuffman(component.huffmanTableDC);
  20511. const diff = t === 0 ? 0 : receiveAndExtend(t);
  20512. component.blockData[blockOffset] = component.pred += diff;
  20513. let k = 1;
  20514. while (k < 64) {
  20515. const rs = decodeHuffman(component.huffmanTableAC);
  20516. const s = rs & 15,
  20517. r = rs >> 4;
  20518. if (s === 0) {
  20519. if (r < 15) {
  20520. break;
  20521. }
  20522. k += 16;
  20523. continue;
  20524. }
  20525. k += r;
  20526. const z = dctZigZag[k];
  20527. component.blockData[blockOffset + z] = receiveAndExtend(s);
  20528. k++;
  20529. }
  20530. }
  20531. function decodeDCFirst(component, blockOffset) {
  20532. const t = decodeHuffman(component.huffmanTableDC);
  20533. const diff = t === 0 ? 0 : receiveAndExtend(t) << successive;
  20534. component.blockData[blockOffset] = component.pred += diff;
  20535. }
  20536. function decodeDCSuccessive(component, blockOffset) {
  20537. component.blockData[blockOffset] |= readBit() << successive;
  20538. }
  20539. let eobrun = 0;
  20540. function decodeACFirst(component, blockOffset) {
  20541. if (eobrun > 0) {
  20542. eobrun--;
  20543. return;
  20544. }
  20545. let k = spectralStart;
  20546. const e = spectralEnd;
  20547. while (k <= e) {
  20548. const rs = decodeHuffman(component.huffmanTableAC);
  20549. const s = rs & 15,
  20550. r = rs >> 4;
  20551. if (s === 0) {
  20552. if (r < 15) {
  20553. eobrun = receive(r) + (1 << r) - 1;
  20554. break;
  20555. }
  20556. k += 16;
  20557. continue;
  20558. }
  20559. k += r;
  20560. const z = dctZigZag[k];
  20561. component.blockData[blockOffset + z] = receiveAndExtend(s) * (1 << successive);
  20562. k++;
  20563. }
  20564. }
  20565. let successiveACState = 0,
  20566. successiveACNextValue;
  20567. function decodeACSuccessive(component, blockOffset) {
  20568. let k = spectralStart;
  20569. const e = spectralEnd;
  20570. let r = 0;
  20571. let s;
  20572. let rs;
  20573. while (k <= e) {
  20574. const offsetZ = blockOffset + dctZigZag[k];
  20575. const sign = component.blockData[offsetZ] < 0 ? -1 : 1;
  20576. switch (successiveACState) {
  20577. case 0:
  20578. rs = decodeHuffman(component.huffmanTableAC);
  20579. s = rs & 15;
  20580. r = rs >> 4;
  20581. if (s === 0) {
  20582. if (r < 15) {
  20583. eobrun = receive(r) + (1 << r);
  20584. successiveACState = 4;
  20585. } else {
  20586. r = 16;
  20587. successiveACState = 1;
  20588. }
  20589. } else {
  20590. if (s !== 1) {
  20591. throw new JpegError("invalid ACn encoding");
  20592. }
  20593. successiveACNextValue = receiveAndExtend(s);
  20594. successiveACState = r ? 2 : 3;
  20595. }
  20596. continue;
  20597. case 1:
  20598. case 2:
  20599. if (component.blockData[offsetZ]) {
  20600. component.blockData[offsetZ] += sign * (readBit() << successive);
  20601. } else {
  20602. r--;
  20603. if (r === 0) {
  20604. successiveACState = successiveACState === 2 ? 3 : 0;
  20605. }
  20606. }
  20607. break;
  20608. case 3:
  20609. if (component.blockData[offsetZ]) {
  20610. component.blockData[offsetZ] += sign * (readBit() << successive);
  20611. } else {
  20612. component.blockData[offsetZ] = successiveACNextValue << successive;
  20613. successiveACState = 0;
  20614. }
  20615. break;
  20616. case 4:
  20617. if (component.blockData[offsetZ]) {
  20618. component.blockData[offsetZ] += sign * (readBit() << successive);
  20619. }
  20620. break;
  20621. }
  20622. k++;
  20623. }
  20624. if (successiveACState === 4) {
  20625. eobrun--;
  20626. if (eobrun === 0) {
  20627. successiveACState = 0;
  20628. }
  20629. }
  20630. }
  20631. let blockRow = 0;
  20632. function decodeMcu(component, decode, mcu, row, col) {
  20633. const mcuRow = mcu / mcusPerLine | 0;
  20634. const mcuCol = mcu % mcusPerLine;
  20635. blockRow = mcuRow * component.v + row;
  20636. const blockCol = mcuCol * component.h + col;
  20637. const blockOffset = getBlockBufferOffset(component, blockRow, blockCol);
  20638. decode(component, blockOffset);
  20639. }
  20640. function decodeBlock(component, decode, mcu) {
  20641. blockRow = mcu / component.blocksPerLine | 0;
  20642. const blockCol = mcu % component.blocksPerLine;
  20643. const blockOffset = getBlockBufferOffset(component, blockRow, blockCol);
  20644. decode(component, blockOffset);
  20645. }
  20646. const componentsLength = components.length;
  20647. let component, i, j, k, n;
  20648. let decodeFn;
  20649. if (progressive) {
  20650. if (spectralStart === 0) {
  20651. decodeFn = successivePrev === 0 ? decodeDCFirst : decodeDCSuccessive;
  20652. } else {
  20653. decodeFn = successivePrev === 0 ? decodeACFirst : decodeACSuccessive;
  20654. }
  20655. } else {
  20656. decodeFn = decodeBaseline;
  20657. }
  20658. let mcu = 0,
  20659. fileMarker;
  20660. let mcuExpected;
  20661. if (componentsLength === 1) {
  20662. mcuExpected = components[0].blocksPerLine * components[0].blocksPerColumn;
  20663. } else {
  20664. mcuExpected = mcusPerLine * frame.mcusPerColumn;
  20665. }
  20666. let h, v;
  20667. while (mcu <= mcuExpected) {
  20668. const mcuToRead = resetInterval ? Math.min(mcuExpected - mcu, resetInterval) : mcuExpected;
  20669. if (mcuToRead > 0) {
  20670. for (i = 0; i < componentsLength; i++) {
  20671. components[i].pred = 0;
  20672. }
  20673. eobrun = 0;
  20674. if (componentsLength === 1) {
  20675. component = components[0];
  20676. for (n = 0; n < mcuToRead; n++) {
  20677. decodeBlock(component, decodeFn, mcu);
  20678. mcu++;
  20679. }
  20680. } else {
  20681. for (n = 0; n < mcuToRead; n++) {
  20682. for (i = 0; i < componentsLength; i++) {
  20683. component = components[i];
  20684. h = component.h;
  20685. v = component.v;
  20686. for (j = 0; j < v; j++) {
  20687. for (k = 0; k < h; k++) {
  20688. decodeMcu(component, decodeFn, mcu, j, k);
  20689. }
  20690. }
  20691. }
  20692. mcu++;
  20693. }
  20694. }
  20695. }
  20696. bitsCount = 0;
  20697. fileMarker = findNextFileMarker(data, offset);
  20698. if (!fileMarker) {
  20699. break;
  20700. }
  20701. if (fileMarker.invalid) {
  20702. const partialMsg = mcuToRead > 0 ? "unexpected" : "excessive";
  20703. (0, _util.warn)(`decodeScan - ${partialMsg} MCU data, current marker is: ${fileMarker.invalid}`);
  20704. offset = fileMarker.offset;
  20705. }
  20706. if (fileMarker.marker >= 0xffd0 && fileMarker.marker <= 0xffd7) {
  20707. offset += 2;
  20708. } else {
  20709. break;
  20710. }
  20711. }
  20712. return offset - startOffset;
  20713. }
  20714. function quantizeAndInverse(component, blockBufferOffset, p) {
  20715. const qt = component.quantizationTable,
  20716. blockData = component.blockData;
  20717. let v0, v1, v2, v3, v4, v5, v6, v7;
  20718. let p0, p1, p2, p3, p4, p5, p6, p7;
  20719. let t;
  20720. if (!qt) {
  20721. throw new JpegError("missing required Quantization Table.");
  20722. }
  20723. for (let row = 0; row < 64; row += 8) {
  20724. p0 = blockData[blockBufferOffset + row];
  20725. p1 = blockData[blockBufferOffset + row + 1];
  20726. p2 = blockData[blockBufferOffset + row + 2];
  20727. p3 = blockData[blockBufferOffset + row + 3];
  20728. p4 = blockData[blockBufferOffset + row + 4];
  20729. p5 = blockData[blockBufferOffset + row + 5];
  20730. p6 = blockData[blockBufferOffset + row + 6];
  20731. p7 = blockData[blockBufferOffset + row + 7];
  20732. p0 *= qt[row];
  20733. if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
  20734. t = dctSqrt2 * p0 + 512 >> 10;
  20735. p[row] = t;
  20736. p[row + 1] = t;
  20737. p[row + 2] = t;
  20738. p[row + 3] = t;
  20739. p[row + 4] = t;
  20740. p[row + 5] = t;
  20741. p[row + 6] = t;
  20742. p[row + 7] = t;
  20743. continue;
  20744. }
  20745. p1 *= qt[row + 1];
  20746. p2 *= qt[row + 2];
  20747. p3 *= qt[row + 3];
  20748. p4 *= qt[row + 4];
  20749. p5 *= qt[row + 5];
  20750. p6 *= qt[row + 6];
  20751. p7 *= qt[row + 7];
  20752. v0 = dctSqrt2 * p0 + 128 >> 8;
  20753. v1 = dctSqrt2 * p4 + 128 >> 8;
  20754. v2 = p2;
  20755. v3 = p6;
  20756. v4 = dctSqrt1d2 * (p1 - p7) + 128 >> 8;
  20757. v7 = dctSqrt1d2 * (p1 + p7) + 128 >> 8;
  20758. v5 = p3 << 4;
  20759. v6 = p5 << 4;
  20760. v0 = v0 + v1 + 1 >> 1;
  20761. v1 = v0 - v1;
  20762. t = v2 * dctSin6 + v3 * dctCos6 + 128 >> 8;
  20763. v2 = v2 * dctCos6 - v3 * dctSin6 + 128 >> 8;
  20764. v3 = t;
  20765. v4 = v4 + v6 + 1 >> 1;
  20766. v6 = v4 - v6;
  20767. v7 = v7 + v5 + 1 >> 1;
  20768. v5 = v7 - v5;
  20769. v0 = v0 + v3 + 1 >> 1;
  20770. v3 = v0 - v3;
  20771. v1 = v1 + v2 + 1 >> 1;
  20772. v2 = v1 - v2;
  20773. t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
  20774. v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
  20775. v7 = t;
  20776. t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
  20777. v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
  20778. v6 = t;
  20779. p[row] = v0 + v7;
  20780. p[row + 7] = v0 - v7;
  20781. p[row + 1] = v1 + v6;
  20782. p[row + 6] = v1 - v6;
  20783. p[row + 2] = v2 + v5;
  20784. p[row + 5] = v2 - v5;
  20785. p[row + 3] = v3 + v4;
  20786. p[row + 4] = v3 - v4;
  20787. }
  20788. for (let col = 0; col < 8; ++col) {
  20789. p0 = p[col];
  20790. p1 = p[col + 8];
  20791. p2 = p[col + 16];
  20792. p3 = p[col + 24];
  20793. p4 = p[col + 32];
  20794. p5 = p[col + 40];
  20795. p6 = p[col + 48];
  20796. p7 = p[col + 56];
  20797. if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
  20798. t = dctSqrt2 * p0 + 8192 >> 14;
  20799. if (t < -2040) {
  20800. t = 0;
  20801. } else if (t >= 2024) {
  20802. t = 255;
  20803. } else {
  20804. t = t + 2056 >> 4;
  20805. }
  20806. blockData[blockBufferOffset + col] = t;
  20807. blockData[blockBufferOffset + col + 8] = t;
  20808. blockData[blockBufferOffset + col + 16] = t;
  20809. blockData[blockBufferOffset + col + 24] = t;
  20810. blockData[blockBufferOffset + col + 32] = t;
  20811. blockData[blockBufferOffset + col + 40] = t;
  20812. blockData[blockBufferOffset + col + 48] = t;
  20813. blockData[blockBufferOffset + col + 56] = t;
  20814. continue;
  20815. }
  20816. v0 = dctSqrt2 * p0 + 2048 >> 12;
  20817. v1 = dctSqrt2 * p4 + 2048 >> 12;
  20818. v2 = p2;
  20819. v3 = p6;
  20820. v4 = dctSqrt1d2 * (p1 - p7) + 2048 >> 12;
  20821. v7 = dctSqrt1d2 * (p1 + p7) + 2048 >> 12;
  20822. v5 = p3;
  20823. v6 = p5;
  20824. v0 = (v0 + v1 + 1 >> 1) + 4112;
  20825. v1 = v0 - v1;
  20826. t = v2 * dctSin6 + v3 * dctCos6 + 2048 >> 12;
  20827. v2 = v2 * dctCos6 - v3 * dctSin6 + 2048 >> 12;
  20828. v3 = t;
  20829. v4 = v4 + v6 + 1 >> 1;
  20830. v6 = v4 - v6;
  20831. v7 = v7 + v5 + 1 >> 1;
  20832. v5 = v7 - v5;
  20833. v0 = v0 + v3 + 1 >> 1;
  20834. v3 = v0 - v3;
  20835. v1 = v1 + v2 + 1 >> 1;
  20836. v2 = v1 - v2;
  20837. t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
  20838. v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
  20839. v7 = t;
  20840. t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
  20841. v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
  20842. v6 = t;
  20843. p0 = v0 + v7;
  20844. p7 = v0 - v7;
  20845. p1 = v1 + v6;
  20846. p6 = v1 - v6;
  20847. p2 = v2 + v5;
  20848. p5 = v2 - v5;
  20849. p3 = v3 + v4;
  20850. p4 = v3 - v4;
  20851. if (p0 < 16) {
  20852. p0 = 0;
  20853. } else if (p0 >= 4080) {
  20854. p0 = 255;
  20855. } else {
  20856. p0 >>= 4;
  20857. }
  20858. if (p1 < 16) {
  20859. p1 = 0;
  20860. } else if (p1 >= 4080) {
  20861. p1 = 255;
  20862. } else {
  20863. p1 >>= 4;
  20864. }
  20865. if (p2 < 16) {
  20866. p2 = 0;
  20867. } else if (p2 >= 4080) {
  20868. p2 = 255;
  20869. } else {
  20870. p2 >>= 4;
  20871. }
  20872. if (p3 < 16) {
  20873. p3 = 0;
  20874. } else if (p3 >= 4080) {
  20875. p3 = 255;
  20876. } else {
  20877. p3 >>= 4;
  20878. }
  20879. if (p4 < 16) {
  20880. p4 = 0;
  20881. } else if (p4 >= 4080) {
  20882. p4 = 255;
  20883. } else {
  20884. p4 >>= 4;
  20885. }
  20886. if (p5 < 16) {
  20887. p5 = 0;
  20888. } else if (p5 >= 4080) {
  20889. p5 = 255;
  20890. } else {
  20891. p5 >>= 4;
  20892. }
  20893. if (p6 < 16) {
  20894. p6 = 0;
  20895. } else if (p6 >= 4080) {
  20896. p6 = 255;
  20897. } else {
  20898. p6 >>= 4;
  20899. }
  20900. if (p7 < 16) {
  20901. p7 = 0;
  20902. } else if (p7 >= 4080) {
  20903. p7 = 255;
  20904. } else {
  20905. p7 >>= 4;
  20906. }
  20907. blockData[blockBufferOffset + col] = p0;
  20908. blockData[blockBufferOffset + col + 8] = p1;
  20909. blockData[blockBufferOffset + col + 16] = p2;
  20910. blockData[blockBufferOffset + col + 24] = p3;
  20911. blockData[blockBufferOffset + col + 32] = p4;
  20912. blockData[blockBufferOffset + col + 40] = p5;
  20913. blockData[blockBufferOffset + col + 48] = p6;
  20914. blockData[blockBufferOffset + col + 56] = p7;
  20915. }
  20916. }
  20917. function buildComponentData(frame, component) {
  20918. const blocksPerLine = component.blocksPerLine;
  20919. const blocksPerColumn = component.blocksPerColumn;
  20920. const computationBuffer = new Int16Array(64);
  20921. for (let blockRow = 0; blockRow < blocksPerColumn; blockRow++) {
  20922. for (let blockCol = 0; blockCol < blocksPerLine; blockCol++) {
  20923. const offset = getBlockBufferOffset(component, blockRow, blockCol);
  20924. quantizeAndInverse(component, offset, computationBuffer);
  20925. }
  20926. }
  20927. return component.blockData;
  20928. }
  20929. function findNextFileMarker(data, currentPos) {
  20930. let startPos = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : currentPos;
  20931. const maxPos = data.length - 1;
  20932. let newPos = startPos < currentPos ? startPos : currentPos;
  20933. if (currentPos >= maxPos) {
  20934. return null;
  20935. }
  20936. const currentMarker = (0, _core_utils.readUint16)(data, currentPos);
  20937. if (currentMarker >= 0xffc0 && currentMarker <= 0xfffe) {
  20938. return {
  20939. invalid: null,
  20940. marker: currentMarker,
  20941. offset: currentPos
  20942. };
  20943. }
  20944. let newMarker = (0, _core_utils.readUint16)(data, newPos);
  20945. while (!(newMarker >= 0xffc0 && newMarker <= 0xfffe)) {
  20946. if (++newPos >= maxPos) {
  20947. return null;
  20948. }
  20949. newMarker = (0, _core_utils.readUint16)(data, newPos);
  20950. }
  20951. return {
  20952. invalid: currentMarker.toString(16),
  20953. marker: newMarker,
  20954. offset: newPos
  20955. };
  20956. }
  20957. class JpegImage {
  20958. constructor() {
  20959. let {
  20960. decodeTransform = null,
  20961. colorTransform = -1
  20962. } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  20963. this._decodeTransform = decodeTransform;
  20964. this._colorTransform = colorTransform;
  20965. }
  20966. parse(data) {
  20967. let {
  20968. dnlScanLines = null
  20969. } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  20970. function readDataBlock() {
  20971. const length = (0, _core_utils.readUint16)(data, offset);
  20972. offset += 2;
  20973. let endOffset = offset + length - 2;
  20974. const fileMarker = findNextFileMarker(data, endOffset, offset);
  20975. if (fileMarker && fileMarker.invalid) {
  20976. (0, _util.warn)("readDataBlock - incorrect length, current marker is: " + fileMarker.invalid);
  20977. endOffset = fileMarker.offset;
  20978. }
  20979. const array = data.subarray(offset, endOffset);
  20980. offset += array.length;
  20981. return array;
  20982. }
  20983. function prepareComponents(frame) {
  20984. const mcusPerLine = Math.ceil(frame.samplesPerLine / 8 / frame.maxH);
  20985. const mcusPerColumn = Math.ceil(frame.scanLines / 8 / frame.maxV);
  20986. for (const component of frame.components) {
  20987. const blocksPerLine = Math.ceil(Math.ceil(frame.samplesPerLine / 8) * component.h / frame.maxH);
  20988. const blocksPerColumn = Math.ceil(Math.ceil(frame.scanLines / 8) * component.v / frame.maxV);
  20989. const blocksPerLineForMcu = mcusPerLine * component.h;
  20990. const blocksPerColumnForMcu = mcusPerColumn * component.v;
  20991. const blocksBufferSize = 64 * blocksPerColumnForMcu * (blocksPerLineForMcu + 1);
  20992. component.blockData = new Int16Array(blocksBufferSize);
  20993. component.blocksPerLine = blocksPerLine;
  20994. component.blocksPerColumn = blocksPerColumn;
  20995. }
  20996. frame.mcusPerLine = mcusPerLine;
  20997. frame.mcusPerColumn = mcusPerColumn;
  20998. }
  20999. let offset = 0;
  21000. let jfif = null;
  21001. let adobe = null;
  21002. let frame, resetInterval;
  21003. let numSOSMarkers = 0;
  21004. const quantizationTables = [];
  21005. const huffmanTablesAC = [],
  21006. huffmanTablesDC = [];
  21007. let fileMarker = (0, _core_utils.readUint16)(data, offset);
  21008. offset += 2;
  21009. if (fileMarker !== 0xffd8) {
  21010. throw new JpegError("SOI not found");
  21011. }
  21012. fileMarker = (0, _core_utils.readUint16)(data, offset);
  21013. offset += 2;
  21014. markerLoop: while (fileMarker !== 0xffd9) {
  21015. let i, j, l;
  21016. switch (fileMarker) {
  21017. case 0xffe0:
  21018. case 0xffe1:
  21019. case 0xffe2:
  21020. case 0xffe3:
  21021. case 0xffe4:
  21022. case 0xffe5:
  21023. case 0xffe6:
  21024. case 0xffe7:
  21025. case 0xffe8:
  21026. case 0xffe9:
  21027. case 0xffea:
  21028. case 0xffeb:
  21029. case 0xffec:
  21030. case 0xffed:
  21031. case 0xffee:
  21032. case 0xffef:
  21033. case 0xfffe:
  21034. const appData = readDataBlock();
  21035. if (fileMarker === 0xffe0) {
  21036. if (appData[0] === 0x4a && appData[1] === 0x46 && appData[2] === 0x49 && appData[3] === 0x46 && appData[4] === 0) {
  21037. jfif = {
  21038. version: {
  21039. major: appData[5],
  21040. minor: appData[6]
  21041. },
  21042. densityUnits: appData[7],
  21043. xDensity: appData[8] << 8 | appData[9],
  21044. yDensity: appData[10] << 8 | appData[11],
  21045. thumbWidth: appData[12],
  21046. thumbHeight: appData[13],
  21047. thumbData: appData.subarray(14, 14 + 3 * appData[12] * appData[13])
  21048. };
  21049. }
  21050. }
  21051. if (fileMarker === 0xffee) {
  21052. if (appData[0] === 0x41 && appData[1] === 0x64 && appData[2] === 0x6f && appData[3] === 0x62 && appData[4] === 0x65) {
  21053. adobe = {
  21054. version: appData[5] << 8 | appData[6],
  21055. flags0: appData[7] << 8 | appData[8],
  21056. flags1: appData[9] << 8 | appData[10],
  21057. transformCode: appData[11]
  21058. };
  21059. }
  21060. }
  21061. break;
  21062. case 0xffdb:
  21063. const quantizationTablesLength = (0, _core_utils.readUint16)(data, offset);
  21064. offset += 2;
  21065. const quantizationTablesEnd = quantizationTablesLength + offset - 2;
  21066. let z;
  21067. while (offset < quantizationTablesEnd) {
  21068. const quantizationTableSpec = data[offset++];
  21069. const tableData = new Uint16Array(64);
  21070. if (quantizationTableSpec >> 4 === 0) {
  21071. for (j = 0; j < 64; j++) {
  21072. z = dctZigZag[j];
  21073. tableData[z] = data[offset++];
  21074. }
  21075. } else if (quantizationTableSpec >> 4 === 1) {
  21076. for (j = 0; j < 64; j++) {
  21077. z = dctZigZag[j];
  21078. tableData[z] = (0, _core_utils.readUint16)(data, offset);
  21079. offset += 2;
  21080. }
  21081. } else {
  21082. throw new JpegError("DQT - invalid table spec");
  21083. }
  21084. quantizationTables[quantizationTableSpec & 15] = tableData;
  21085. }
  21086. break;
  21087. case 0xffc0:
  21088. case 0xffc1:
  21089. case 0xffc2:
  21090. if (frame) {
  21091. throw new JpegError("Only single frame JPEGs supported");
  21092. }
  21093. offset += 2;
  21094. frame = {};
  21095. frame.extended = fileMarker === 0xffc1;
  21096. frame.progressive = fileMarker === 0xffc2;
  21097. frame.precision = data[offset++];
  21098. const sofScanLines = (0, _core_utils.readUint16)(data, offset);
  21099. offset += 2;
  21100. frame.scanLines = dnlScanLines || sofScanLines;
  21101. frame.samplesPerLine = (0, _core_utils.readUint16)(data, offset);
  21102. offset += 2;
  21103. frame.components = [];
  21104. frame.componentIds = {};
  21105. const componentsCount = data[offset++];
  21106. let maxH = 0,
  21107. maxV = 0;
  21108. for (i = 0; i < componentsCount; i++) {
  21109. const componentId = data[offset];
  21110. const h = data[offset + 1] >> 4;
  21111. const v = data[offset + 1] & 15;
  21112. if (maxH < h) {
  21113. maxH = h;
  21114. }
  21115. if (maxV < v) {
  21116. maxV = v;
  21117. }
  21118. const qId = data[offset + 2];
  21119. l = frame.components.push({
  21120. h,
  21121. v,
  21122. quantizationId: qId,
  21123. quantizationTable: null
  21124. });
  21125. frame.componentIds[componentId] = l - 1;
  21126. offset += 3;
  21127. }
  21128. frame.maxH = maxH;
  21129. frame.maxV = maxV;
  21130. prepareComponents(frame);
  21131. break;
  21132. case 0xffc4:
  21133. const huffmanLength = (0, _core_utils.readUint16)(data, offset);
  21134. offset += 2;
  21135. for (i = 2; i < huffmanLength;) {
  21136. const huffmanTableSpec = data[offset++];
  21137. const codeLengths = new Uint8Array(16);
  21138. let codeLengthSum = 0;
  21139. for (j = 0; j < 16; j++, offset++) {
  21140. codeLengthSum += codeLengths[j] = data[offset];
  21141. }
  21142. const huffmanValues = new Uint8Array(codeLengthSum);
  21143. for (j = 0; j < codeLengthSum; j++, offset++) {
  21144. huffmanValues[j] = data[offset];
  21145. }
  21146. i += 17 + codeLengthSum;
  21147. (huffmanTableSpec >> 4 === 0 ? huffmanTablesDC : huffmanTablesAC)[huffmanTableSpec & 15] = buildHuffmanTable(codeLengths, huffmanValues);
  21148. }
  21149. break;
  21150. case 0xffdd:
  21151. offset += 2;
  21152. resetInterval = (0, _core_utils.readUint16)(data, offset);
  21153. offset += 2;
  21154. break;
  21155. case 0xffda:
  21156. const parseDNLMarker = ++numSOSMarkers === 1 && !dnlScanLines;
  21157. offset += 2;
  21158. const selectorsCount = data[offset++],
  21159. components = [];
  21160. for (i = 0; i < selectorsCount; i++) {
  21161. const index = data[offset++];
  21162. const componentIndex = frame.componentIds[index];
  21163. const component = frame.components[componentIndex];
  21164. component.index = index;
  21165. const tableSpec = data[offset++];
  21166. component.huffmanTableDC = huffmanTablesDC[tableSpec >> 4];
  21167. component.huffmanTableAC = huffmanTablesAC[tableSpec & 15];
  21168. components.push(component);
  21169. }
  21170. const spectralStart = data[offset++],
  21171. spectralEnd = data[offset++],
  21172. successiveApproximation = data[offset++];
  21173. try {
  21174. const processed = decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successiveApproximation >> 4, successiveApproximation & 15, parseDNLMarker);
  21175. offset += processed;
  21176. } catch (ex) {
  21177. if (ex instanceof DNLMarkerError) {
  21178. (0, _util.warn)(`${ex.message} -- attempting to re-parse the JPEG image.`);
  21179. return this.parse(data, {
  21180. dnlScanLines: ex.scanLines
  21181. });
  21182. } else if (ex instanceof EOIMarkerError) {
  21183. (0, _util.warn)(`${ex.message} -- ignoring the rest of the image data.`);
  21184. break markerLoop;
  21185. }
  21186. throw ex;
  21187. }
  21188. break;
  21189. case 0xffdc:
  21190. offset += 4;
  21191. break;
  21192. case 0xffff:
  21193. if (data[offset] !== 0xff) {
  21194. offset--;
  21195. }
  21196. break;
  21197. default:
  21198. const nextFileMarker = findNextFileMarker(data, offset - 2, offset - 3);
  21199. if (nextFileMarker && nextFileMarker.invalid) {
  21200. (0, _util.warn)("JpegImage.parse - unexpected data, current marker is: " + nextFileMarker.invalid);
  21201. offset = nextFileMarker.offset;
  21202. break;
  21203. }
  21204. if (!nextFileMarker || offset >= data.length - 1) {
  21205. (0, _util.warn)("JpegImage.parse - reached the end of the image data " + "without finding an EOI marker (0xFFD9).");
  21206. break markerLoop;
  21207. }
  21208. throw new JpegError("JpegImage.parse - unknown marker: " + fileMarker.toString(16));
  21209. }
  21210. fileMarker = (0, _core_utils.readUint16)(data, offset);
  21211. offset += 2;
  21212. }
  21213. this.width = frame.samplesPerLine;
  21214. this.height = frame.scanLines;
  21215. this.jfif = jfif;
  21216. this.adobe = adobe;
  21217. this.components = [];
  21218. for (const component of frame.components) {
  21219. const quantizationTable = quantizationTables[component.quantizationId];
  21220. if (quantizationTable) {
  21221. component.quantizationTable = quantizationTable;
  21222. }
  21223. this.components.push({
  21224. index: component.index,
  21225. output: buildComponentData(frame, component),
  21226. scaleX: component.h / frame.maxH,
  21227. scaleY: component.v / frame.maxV,
  21228. blocksPerLine: component.blocksPerLine,
  21229. blocksPerColumn: component.blocksPerColumn
  21230. });
  21231. }
  21232. this.numComponents = this.components.length;
  21233. return undefined;
  21234. }
  21235. _getLinearizedBlockData(width, height) {
  21236. let isSourcePDF = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  21237. const scaleX = this.width / width,
  21238. scaleY = this.height / height;
  21239. let component, componentScaleX, componentScaleY, blocksPerScanline;
  21240. let x, y, i, j, k;
  21241. let index;
  21242. let offset = 0;
  21243. let output;
  21244. const numComponents = this.components.length;
  21245. const dataLength = width * height * numComponents;
  21246. const data = new Uint8ClampedArray(dataLength);
  21247. const xScaleBlockOffset = new Uint32Array(width);
  21248. const mask3LSB = 0xfffffff8;
  21249. let lastComponentScaleX;
  21250. for (i = 0; i < numComponents; i++) {
  21251. component = this.components[i];
  21252. componentScaleX = component.scaleX * scaleX;
  21253. componentScaleY = component.scaleY * scaleY;
  21254. offset = i;
  21255. output = component.output;
  21256. blocksPerScanline = component.blocksPerLine + 1 << 3;
  21257. if (componentScaleX !== lastComponentScaleX) {
  21258. for (x = 0; x < width; x++) {
  21259. j = 0 | x * componentScaleX;
  21260. xScaleBlockOffset[x] = (j & mask3LSB) << 3 | j & 7;
  21261. }
  21262. lastComponentScaleX = componentScaleX;
  21263. }
  21264. for (y = 0; y < height; y++) {
  21265. j = 0 | y * componentScaleY;
  21266. index = blocksPerScanline * (j & mask3LSB) | (j & 7) << 3;
  21267. for (x = 0; x < width; x++) {
  21268. data[offset] = output[index + xScaleBlockOffset[x]];
  21269. offset += numComponents;
  21270. }
  21271. }
  21272. }
  21273. let transform = this._decodeTransform;
  21274. if (!isSourcePDF && numComponents === 4 && !transform) {
  21275. transform = new Int32Array([-256, 255, -256, 255, -256, 255, -256, 255]);
  21276. }
  21277. if (transform) {
  21278. for (i = 0; i < dataLength;) {
  21279. for (j = 0, k = 0; j < numComponents; j++, i++, k += 2) {
  21280. data[i] = (data[i] * transform[k] >> 8) + transform[k + 1];
  21281. }
  21282. }
  21283. }
  21284. return data;
  21285. }
  21286. get _isColorConversionNeeded() {
  21287. if (this.adobe) {
  21288. return !!this.adobe.transformCode;
  21289. }
  21290. if (this.numComponents === 3) {
  21291. if (this._colorTransform === 0) {
  21292. return false;
  21293. } else if (this.components[0].index === 0x52 && this.components[1].index === 0x47 && this.components[2].index === 0x42) {
  21294. return false;
  21295. }
  21296. return true;
  21297. }
  21298. if (this._colorTransform === 1) {
  21299. return true;
  21300. }
  21301. return false;
  21302. }
  21303. _convertYccToRgb(data) {
  21304. let Y, Cb, Cr;
  21305. for (let i = 0, length = data.length; i < length; i += 3) {
  21306. Y = data[i];
  21307. Cb = data[i + 1];
  21308. Cr = data[i + 2];
  21309. data[i] = Y - 179.456 + 1.402 * Cr;
  21310. data[i + 1] = Y + 135.459 - 0.344 * Cb - 0.714 * Cr;
  21311. data[i + 2] = Y - 226.816 + 1.772 * Cb;
  21312. }
  21313. return data;
  21314. }
  21315. _convertYcckToRgb(data) {
  21316. let Y, Cb, Cr, k;
  21317. let offset = 0;
  21318. for (let i = 0, length = data.length; i < length; i += 4) {
  21319. Y = data[i];
  21320. Cb = data[i + 1];
  21321. Cr = data[i + 2];
  21322. k = data[i + 3];
  21323. 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);
  21324. 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);
  21325. 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);
  21326. }
  21327. return data.subarray(0, offset);
  21328. }
  21329. _convertYcckToCmyk(data) {
  21330. let Y, Cb, Cr;
  21331. for (let i = 0, length = data.length; i < length; i += 4) {
  21332. Y = data[i];
  21333. Cb = data[i + 1];
  21334. Cr = data[i + 2];
  21335. data[i] = 434.456 - Y - 1.402 * Cr;
  21336. data[i + 1] = 119.541 - Y + 0.344 * Cb + 0.714 * Cr;
  21337. data[i + 2] = 481.816 - Y - 1.772 * Cb;
  21338. }
  21339. return data;
  21340. }
  21341. _convertCmykToRgb(data) {
  21342. let c, m, y, k;
  21343. let offset = 0;
  21344. for (let i = 0, length = data.length; i < length; i += 4) {
  21345. c = data[i];
  21346. m = data[i + 1];
  21347. y = data[i + 2];
  21348. k = data[i + 3];
  21349. 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);
  21350. 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);
  21351. 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);
  21352. }
  21353. return data.subarray(0, offset);
  21354. }
  21355. getData(_ref) {
  21356. let {
  21357. width,
  21358. height,
  21359. forceRGB = false,
  21360. isSourcePDF = false
  21361. } = _ref;
  21362. if (this.numComponents > 4) {
  21363. throw new JpegError("Unsupported color mode");
  21364. }
  21365. const data = this._getLinearizedBlockData(width, height, isSourcePDF);
  21366. if (this.numComponents === 1 && forceRGB) {
  21367. const rgbData = new Uint8ClampedArray(data.length * 3);
  21368. let offset = 0;
  21369. for (const grayColor of data) {
  21370. rgbData[offset++] = grayColor;
  21371. rgbData[offset++] = grayColor;
  21372. rgbData[offset++] = grayColor;
  21373. }
  21374. return rgbData;
  21375. } else if (this.numComponents === 3 && this._isColorConversionNeeded) {
  21376. return this._convertYccToRgb(data);
  21377. } else if (this.numComponents === 4) {
  21378. if (this._isColorConversionNeeded) {
  21379. if (forceRGB) {
  21380. return this._convertYcckToRgb(data);
  21381. }
  21382. return this._convertYcckToCmyk(data);
  21383. } else if (forceRGB) {
  21384. return this._convertCmykToRgb(data);
  21385. }
  21386. }
  21387. return data;
  21388. }
  21389. }
  21390. exports.JpegImage = JpegImage;
  21391. /***/ }),
  21392. /* 158 */
  21393. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  21394. "use strict";
  21395. Object.defineProperty(exports, "__esModule", ({
  21396. value: true
  21397. }));
  21398. exports.JpxStream = void 0;
  21399. var _decode_stream = __w_pdfjs_require__(148);
  21400. var _jpx = __w_pdfjs_require__(159);
  21401. var _util = __w_pdfjs_require__(2);
  21402. class JpxStream extends _decode_stream.DecodeStream {
  21403. constructor(stream, maybeLength, params) {
  21404. super(maybeLength);
  21405. this.stream = stream;
  21406. this.dict = stream.dict;
  21407. this.maybeLength = maybeLength;
  21408. this.params = params;
  21409. }
  21410. get bytes() {
  21411. return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength));
  21412. }
  21413. ensureBuffer(requested) {}
  21414. readBlock() {
  21415. if (this.eof) {
  21416. return;
  21417. }
  21418. const jpxImage = new _jpx.JpxImage();
  21419. jpxImage.parse(this.bytes);
  21420. const width = jpxImage.width;
  21421. const height = jpxImage.height;
  21422. const componentsCount = jpxImage.componentsCount;
  21423. const tileCount = jpxImage.tiles.length;
  21424. if (tileCount === 1) {
  21425. this.buffer = jpxImage.tiles[0].items;
  21426. } else {
  21427. const data = new Uint8ClampedArray(width * height * componentsCount);
  21428. for (let k = 0; k < tileCount; k++) {
  21429. const tileComponents = jpxImage.tiles[k];
  21430. const tileWidth = tileComponents.width;
  21431. const tileHeight = tileComponents.height;
  21432. const tileLeft = tileComponents.left;
  21433. const tileTop = tileComponents.top;
  21434. const src = tileComponents.items;
  21435. let srcPosition = 0;
  21436. let dataPosition = (width * tileTop + tileLeft) * componentsCount;
  21437. const imgRowSize = width * componentsCount;
  21438. const tileRowSize = tileWidth * componentsCount;
  21439. for (let j = 0; j < tileHeight; j++) {
  21440. const rowBytes = src.subarray(srcPosition, srcPosition + tileRowSize);
  21441. data.set(rowBytes, dataPosition);
  21442. srcPosition += tileRowSize;
  21443. dataPosition += imgRowSize;
  21444. }
  21445. }
  21446. this.buffer = data;
  21447. }
  21448. this.bufferLength = this.buffer.length;
  21449. this.eof = true;
  21450. }
  21451. }
  21452. exports.JpxStream = JpxStream;
  21453. /***/ }),
  21454. /* 159 */
  21455. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  21456. "use strict";
  21457. Object.defineProperty(exports, "__esModule", ({
  21458. value: true
  21459. }));
  21460. exports.JpxImage = void 0;
  21461. var _util = __w_pdfjs_require__(2);
  21462. var _core_utils = __w_pdfjs_require__(135);
  21463. var _arithmetic_decoder = __w_pdfjs_require__(155);
  21464. class JpxError extends _util.BaseException {
  21465. constructor(msg) {
  21466. super(`JPX error: ${msg}`, "JpxError");
  21467. }
  21468. }
  21469. const SubbandsGainLog2 = {
  21470. LL: 0,
  21471. LH: 1,
  21472. HL: 1,
  21473. HH: 2
  21474. };
  21475. class JpxImage {
  21476. constructor() {
  21477. this.failOnCorruptedImage = false;
  21478. }
  21479. parse(data) {
  21480. const head = (0, _core_utils.readUint16)(data, 0);
  21481. if (head === 0xff4f) {
  21482. this.parseCodestream(data, 0, data.length);
  21483. return;
  21484. }
  21485. const length = data.length;
  21486. let position = 0;
  21487. while (position < length) {
  21488. let headerSize = 8;
  21489. let lbox = (0, _core_utils.readUint32)(data, position);
  21490. const tbox = (0, _core_utils.readUint32)(data, position + 4);
  21491. position += headerSize;
  21492. if (lbox === 1) {
  21493. lbox = (0, _core_utils.readUint32)(data, position) * 4294967296 + (0, _core_utils.readUint32)(data, position + 4);
  21494. position += 8;
  21495. headerSize += 8;
  21496. }
  21497. if (lbox === 0) {
  21498. lbox = length - position + headerSize;
  21499. }
  21500. if (lbox < headerSize) {
  21501. throw new JpxError("Invalid box field size");
  21502. }
  21503. const dataLength = lbox - headerSize;
  21504. let jumpDataLength = true;
  21505. switch (tbox) {
  21506. case 0x6a703268:
  21507. jumpDataLength = false;
  21508. break;
  21509. case 0x636f6c72:
  21510. const method = data[position];
  21511. if (method === 1) {
  21512. const colorspace = (0, _core_utils.readUint32)(data, position + 3);
  21513. switch (colorspace) {
  21514. case 16:
  21515. case 17:
  21516. case 18:
  21517. break;
  21518. default:
  21519. (0, _util.warn)("Unknown colorspace " + colorspace);
  21520. break;
  21521. }
  21522. } else if (method === 2) {
  21523. (0, _util.info)("ICC profile not supported");
  21524. }
  21525. break;
  21526. case 0x6a703263:
  21527. this.parseCodestream(data, position, position + dataLength);
  21528. break;
  21529. case 0x6a502020:
  21530. if ((0, _core_utils.readUint32)(data, position) !== 0x0d0a870a) {
  21531. (0, _util.warn)("Invalid JP2 signature");
  21532. }
  21533. break;
  21534. case 0x6a501a1a:
  21535. case 0x66747970:
  21536. case 0x72726571:
  21537. case 0x72657320:
  21538. case 0x69686472:
  21539. break;
  21540. default:
  21541. const headerType = String.fromCharCode(tbox >> 24 & 0xff, tbox >> 16 & 0xff, tbox >> 8 & 0xff, tbox & 0xff);
  21542. (0, _util.warn)(`Unsupported header type ${tbox} (${headerType}).`);
  21543. break;
  21544. }
  21545. if (jumpDataLength) {
  21546. position += dataLength;
  21547. }
  21548. }
  21549. }
  21550. parseImageProperties(stream) {
  21551. let newByte = stream.getByte();
  21552. while (newByte >= 0) {
  21553. const oldByte = newByte;
  21554. newByte = stream.getByte();
  21555. const code = oldByte << 8 | newByte;
  21556. if (code === 0xff51) {
  21557. stream.skip(4);
  21558. const Xsiz = stream.getInt32() >>> 0;
  21559. const Ysiz = stream.getInt32() >>> 0;
  21560. const XOsiz = stream.getInt32() >>> 0;
  21561. const YOsiz = stream.getInt32() >>> 0;
  21562. stream.skip(16);
  21563. const Csiz = stream.getUint16();
  21564. this.width = Xsiz - XOsiz;
  21565. this.height = Ysiz - YOsiz;
  21566. this.componentsCount = Csiz;
  21567. this.bitsPerComponent = 8;
  21568. return;
  21569. }
  21570. }
  21571. throw new JpxError("No size marker found in JPX stream");
  21572. }
  21573. parseCodestream(data, start, end) {
  21574. const context = {};
  21575. let doNotRecover = false;
  21576. try {
  21577. let position = start;
  21578. while (position + 1 < end) {
  21579. const code = (0, _core_utils.readUint16)(data, position);
  21580. position += 2;
  21581. let length = 0,
  21582. j,
  21583. sqcd,
  21584. spqcds,
  21585. spqcdSize,
  21586. scalarExpounded,
  21587. tile;
  21588. switch (code) {
  21589. case 0xff4f:
  21590. context.mainHeader = true;
  21591. break;
  21592. case 0xffd9:
  21593. break;
  21594. case 0xff51:
  21595. length = (0, _core_utils.readUint16)(data, position);
  21596. const siz = {};
  21597. siz.Xsiz = (0, _core_utils.readUint32)(data, position + 4);
  21598. siz.Ysiz = (0, _core_utils.readUint32)(data, position + 8);
  21599. siz.XOsiz = (0, _core_utils.readUint32)(data, position + 12);
  21600. siz.YOsiz = (0, _core_utils.readUint32)(data, position + 16);
  21601. siz.XTsiz = (0, _core_utils.readUint32)(data, position + 20);
  21602. siz.YTsiz = (0, _core_utils.readUint32)(data, position + 24);
  21603. siz.XTOsiz = (0, _core_utils.readUint32)(data, position + 28);
  21604. siz.YTOsiz = (0, _core_utils.readUint32)(data, position + 32);
  21605. const componentsCount = (0, _core_utils.readUint16)(data, position + 36);
  21606. siz.Csiz = componentsCount;
  21607. const components = [];
  21608. j = position + 38;
  21609. for (let i = 0; i < componentsCount; i++) {
  21610. const component = {
  21611. precision: (data[j] & 0x7f) + 1,
  21612. isSigned: !!(data[j] & 0x80),
  21613. XRsiz: data[j + 1],
  21614. YRsiz: data[j + 2]
  21615. };
  21616. j += 3;
  21617. calculateComponentDimensions(component, siz);
  21618. components.push(component);
  21619. }
  21620. context.SIZ = siz;
  21621. context.components = components;
  21622. calculateTileGrids(context, components);
  21623. context.QCC = [];
  21624. context.COC = [];
  21625. break;
  21626. case 0xff5c:
  21627. length = (0, _core_utils.readUint16)(data, position);
  21628. const qcd = {};
  21629. j = position + 2;
  21630. sqcd = data[j++];
  21631. switch (sqcd & 0x1f) {
  21632. case 0:
  21633. spqcdSize = 8;
  21634. scalarExpounded = true;
  21635. break;
  21636. case 1:
  21637. spqcdSize = 16;
  21638. scalarExpounded = false;
  21639. break;
  21640. case 2:
  21641. spqcdSize = 16;
  21642. scalarExpounded = true;
  21643. break;
  21644. default:
  21645. throw new Error("Invalid SQcd value " + sqcd);
  21646. }
  21647. qcd.noQuantization = spqcdSize === 8;
  21648. qcd.scalarExpounded = scalarExpounded;
  21649. qcd.guardBits = sqcd >> 5;
  21650. spqcds = [];
  21651. while (j < length + position) {
  21652. const spqcd = {};
  21653. if (spqcdSize === 8) {
  21654. spqcd.epsilon = data[j++] >> 3;
  21655. spqcd.mu = 0;
  21656. } else {
  21657. spqcd.epsilon = data[j] >> 3;
  21658. spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1];
  21659. j += 2;
  21660. }
  21661. spqcds.push(spqcd);
  21662. }
  21663. qcd.SPqcds = spqcds;
  21664. if (context.mainHeader) {
  21665. context.QCD = qcd;
  21666. } else {
  21667. context.currentTile.QCD = qcd;
  21668. context.currentTile.QCC = [];
  21669. }
  21670. break;
  21671. case 0xff5d:
  21672. length = (0, _core_utils.readUint16)(data, position);
  21673. const qcc = {};
  21674. j = position + 2;
  21675. let cqcc;
  21676. if (context.SIZ.Csiz < 257) {
  21677. cqcc = data[j++];
  21678. } else {
  21679. cqcc = (0, _core_utils.readUint16)(data, j);
  21680. j += 2;
  21681. }
  21682. sqcd = data[j++];
  21683. switch (sqcd & 0x1f) {
  21684. case 0:
  21685. spqcdSize = 8;
  21686. scalarExpounded = true;
  21687. break;
  21688. case 1:
  21689. spqcdSize = 16;
  21690. scalarExpounded = false;
  21691. break;
  21692. case 2:
  21693. spqcdSize = 16;
  21694. scalarExpounded = true;
  21695. break;
  21696. default:
  21697. throw new Error("Invalid SQcd value " + sqcd);
  21698. }
  21699. qcc.noQuantization = spqcdSize === 8;
  21700. qcc.scalarExpounded = scalarExpounded;
  21701. qcc.guardBits = sqcd >> 5;
  21702. spqcds = [];
  21703. while (j < length + position) {
  21704. const spqcd = {};
  21705. if (spqcdSize === 8) {
  21706. spqcd.epsilon = data[j++] >> 3;
  21707. spqcd.mu = 0;
  21708. } else {
  21709. spqcd.epsilon = data[j] >> 3;
  21710. spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1];
  21711. j += 2;
  21712. }
  21713. spqcds.push(spqcd);
  21714. }
  21715. qcc.SPqcds = spqcds;
  21716. if (context.mainHeader) {
  21717. context.QCC[cqcc] = qcc;
  21718. } else {
  21719. context.currentTile.QCC[cqcc] = qcc;
  21720. }
  21721. break;
  21722. case 0xff52:
  21723. length = (0, _core_utils.readUint16)(data, position);
  21724. const cod = {};
  21725. j = position + 2;
  21726. const scod = data[j++];
  21727. cod.entropyCoderWithCustomPrecincts = !!(scod & 1);
  21728. cod.sopMarkerUsed = !!(scod & 2);
  21729. cod.ephMarkerUsed = !!(scod & 4);
  21730. cod.progressionOrder = data[j++];
  21731. cod.layersCount = (0, _core_utils.readUint16)(data, j);
  21732. j += 2;
  21733. cod.multipleComponentTransform = data[j++];
  21734. cod.decompositionLevelsCount = data[j++];
  21735. cod.xcb = (data[j++] & 0xf) + 2;
  21736. cod.ycb = (data[j++] & 0xf) + 2;
  21737. const blockStyle = data[j++];
  21738. cod.selectiveArithmeticCodingBypass = !!(blockStyle & 1);
  21739. cod.resetContextProbabilities = !!(blockStyle & 2);
  21740. cod.terminationOnEachCodingPass = !!(blockStyle & 4);
  21741. cod.verticallyStripe = !!(blockStyle & 8);
  21742. cod.predictableTermination = !!(blockStyle & 16);
  21743. cod.segmentationSymbolUsed = !!(blockStyle & 32);
  21744. cod.reversibleTransformation = data[j++];
  21745. if (cod.entropyCoderWithCustomPrecincts) {
  21746. const precinctsSizes = [];
  21747. while (j < length + position) {
  21748. const precinctsSize = data[j++];
  21749. precinctsSizes.push({
  21750. PPx: precinctsSize & 0xf,
  21751. PPy: precinctsSize >> 4
  21752. });
  21753. }
  21754. cod.precinctsSizes = precinctsSizes;
  21755. }
  21756. const unsupported = [];
  21757. if (cod.selectiveArithmeticCodingBypass) {
  21758. unsupported.push("selectiveArithmeticCodingBypass");
  21759. }
  21760. if (cod.terminationOnEachCodingPass) {
  21761. unsupported.push("terminationOnEachCodingPass");
  21762. }
  21763. if (cod.verticallyStripe) {
  21764. unsupported.push("verticallyStripe");
  21765. }
  21766. if (cod.predictableTermination) {
  21767. unsupported.push("predictableTermination");
  21768. }
  21769. if (unsupported.length > 0) {
  21770. doNotRecover = true;
  21771. (0, _util.warn)(`JPX: Unsupported COD options (${unsupported.join(", ")}).`);
  21772. }
  21773. if (context.mainHeader) {
  21774. context.COD = cod;
  21775. } else {
  21776. context.currentTile.COD = cod;
  21777. context.currentTile.COC = [];
  21778. }
  21779. break;
  21780. case 0xff90:
  21781. length = (0, _core_utils.readUint16)(data, position);
  21782. tile = {};
  21783. tile.index = (0, _core_utils.readUint16)(data, position + 2);
  21784. tile.length = (0, _core_utils.readUint32)(data, position + 4);
  21785. tile.dataEnd = tile.length + position - 2;
  21786. tile.partIndex = data[position + 8];
  21787. tile.partsCount = data[position + 9];
  21788. context.mainHeader = false;
  21789. if (tile.partIndex === 0) {
  21790. tile.COD = context.COD;
  21791. tile.COC = context.COC.slice(0);
  21792. tile.QCD = context.QCD;
  21793. tile.QCC = context.QCC.slice(0);
  21794. }
  21795. context.currentTile = tile;
  21796. break;
  21797. case 0xff93:
  21798. tile = context.currentTile;
  21799. if (tile.partIndex === 0) {
  21800. initializeTile(context, tile.index);
  21801. buildPackets(context);
  21802. }
  21803. length = tile.dataEnd - position;
  21804. parseTilePackets(context, data, position, length);
  21805. break;
  21806. case 0xff53:
  21807. (0, _util.warn)("JPX: Codestream code 0xFF53 (COC) is not implemented.");
  21808. case 0xff55:
  21809. case 0xff57:
  21810. case 0xff58:
  21811. case 0xff64:
  21812. length = (0, _core_utils.readUint16)(data, position);
  21813. break;
  21814. default:
  21815. throw new Error("Unknown codestream code: " + code.toString(16));
  21816. }
  21817. position += length;
  21818. }
  21819. } catch (e) {
  21820. if (doNotRecover || this.failOnCorruptedImage) {
  21821. throw new JpxError(e.message);
  21822. } else {
  21823. (0, _util.warn)(`JPX: Trying to recover from: "${e.message}".`);
  21824. }
  21825. }
  21826. this.tiles = transformComponents(context);
  21827. this.width = context.SIZ.Xsiz - context.SIZ.XOsiz;
  21828. this.height = context.SIZ.Ysiz - context.SIZ.YOsiz;
  21829. this.componentsCount = context.SIZ.Csiz;
  21830. }
  21831. }
  21832. exports.JpxImage = JpxImage;
  21833. function calculateComponentDimensions(component, siz) {
  21834. component.x0 = Math.ceil(siz.XOsiz / component.XRsiz);
  21835. component.x1 = Math.ceil(siz.Xsiz / component.XRsiz);
  21836. component.y0 = Math.ceil(siz.YOsiz / component.YRsiz);
  21837. component.y1 = Math.ceil(siz.Ysiz / component.YRsiz);
  21838. component.width = component.x1 - component.x0;
  21839. component.height = component.y1 - component.y0;
  21840. }
  21841. function calculateTileGrids(context, components) {
  21842. const siz = context.SIZ;
  21843. const tiles = [];
  21844. let tile;
  21845. const numXtiles = Math.ceil((siz.Xsiz - siz.XTOsiz) / siz.XTsiz);
  21846. const numYtiles = Math.ceil((siz.Ysiz - siz.YTOsiz) / siz.YTsiz);
  21847. for (let q = 0; q < numYtiles; q++) {
  21848. for (let p = 0; p < numXtiles; p++) {
  21849. tile = {};
  21850. tile.tx0 = Math.max(siz.XTOsiz + p * siz.XTsiz, siz.XOsiz);
  21851. tile.ty0 = Math.max(siz.YTOsiz + q * siz.YTsiz, siz.YOsiz);
  21852. tile.tx1 = Math.min(siz.XTOsiz + (p + 1) * siz.XTsiz, siz.Xsiz);
  21853. tile.ty1 = Math.min(siz.YTOsiz + (q + 1) * siz.YTsiz, siz.Ysiz);
  21854. tile.width = tile.tx1 - tile.tx0;
  21855. tile.height = tile.ty1 - tile.ty0;
  21856. tile.components = [];
  21857. tiles.push(tile);
  21858. }
  21859. }
  21860. context.tiles = tiles;
  21861. const componentsCount = siz.Csiz;
  21862. for (let i = 0, ii = componentsCount; i < ii; i++) {
  21863. const component = components[i];
  21864. for (let j = 0, jj = tiles.length; j < jj; j++) {
  21865. const tileComponent = {};
  21866. tile = tiles[j];
  21867. tileComponent.tcx0 = Math.ceil(tile.tx0 / component.XRsiz);
  21868. tileComponent.tcy0 = Math.ceil(tile.ty0 / component.YRsiz);
  21869. tileComponent.tcx1 = Math.ceil(tile.tx1 / component.XRsiz);
  21870. tileComponent.tcy1 = Math.ceil(tile.ty1 / component.YRsiz);
  21871. tileComponent.width = tileComponent.tcx1 - tileComponent.tcx0;
  21872. tileComponent.height = tileComponent.tcy1 - tileComponent.tcy0;
  21873. tile.components[i] = tileComponent;
  21874. }
  21875. }
  21876. }
  21877. function getBlocksDimensions(context, component, r) {
  21878. const codOrCoc = component.codingStyleParameters;
  21879. const result = {};
  21880. if (!codOrCoc.entropyCoderWithCustomPrecincts) {
  21881. result.PPx = 15;
  21882. result.PPy = 15;
  21883. } else {
  21884. result.PPx = codOrCoc.precinctsSizes[r].PPx;
  21885. result.PPy = codOrCoc.precinctsSizes[r].PPy;
  21886. }
  21887. result.xcb_ = r > 0 ? Math.min(codOrCoc.xcb, result.PPx - 1) : Math.min(codOrCoc.xcb, result.PPx);
  21888. result.ycb_ = r > 0 ? Math.min(codOrCoc.ycb, result.PPy - 1) : Math.min(codOrCoc.ycb, result.PPy);
  21889. return result;
  21890. }
  21891. function buildPrecincts(context, resolution, dimensions) {
  21892. const precinctWidth = 1 << dimensions.PPx;
  21893. const precinctHeight = 1 << dimensions.PPy;
  21894. const isZeroRes = resolution.resLevel === 0;
  21895. const precinctWidthInSubband = 1 << dimensions.PPx + (isZeroRes ? 0 : -1);
  21896. const precinctHeightInSubband = 1 << dimensions.PPy + (isZeroRes ? 0 : -1);
  21897. const numprecinctswide = resolution.trx1 > resolution.trx0 ? Math.ceil(resolution.trx1 / precinctWidth) - Math.floor(resolution.trx0 / precinctWidth) : 0;
  21898. const numprecinctshigh = resolution.try1 > resolution.try0 ? Math.ceil(resolution.try1 / precinctHeight) - Math.floor(resolution.try0 / precinctHeight) : 0;
  21899. const numprecincts = numprecinctswide * numprecinctshigh;
  21900. resolution.precinctParameters = {
  21901. precinctWidth,
  21902. precinctHeight,
  21903. numprecinctswide,
  21904. numprecinctshigh,
  21905. numprecincts,
  21906. precinctWidthInSubband,
  21907. precinctHeightInSubband
  21908. };
  21909. }
  21910. function buildCodeblocks(context, subband, dimensions) {
  21911. const xcb_ = dimensions.xcb_;
  21912. const ycb_ = dimensions.ycb_;
  21913. const codeblockWidth = 1 << xcb_;
  21914. const codeblockHeight = 1 << ycb_;
  21915. const cbx0 = subband.tbx0 >> xcb_;
  21916. const cby0 = subband.tby0 >> ycb_;
  21917. const cbx1 = subband.tbx1 + codeblockWidth - 1 >> xcb_;
  21918. const cby1 = subband.tby1 + codeblockHeight - 1 >> ycb_;
  21919. const precinctParameters = subband.resolution.precinctParameters;
  21920. const codeblocks = [];
  21921. const precincts = [];
  21922. let i, j, codeblock, precinctNumber;
  21923. for (j = cby0; j < cby1; j++) {
  21924. for (i = cbx0; i < cbx1; i++) {
  21925. codeblock = {
  21926. cbx: i,
  21927. cby: j,
  21928. tbx0: codeblockWidth * i,
  21929. tby0: codeblockHeight * j,
  21930. tbx1: codeblockWidth * (i + 1),
  21931. tby1: codeblockHeight * (j + 1)
  21932. };
  21933. codeblock.tbx0_ = Math.max(subband.tbx0, codeblock.tbx0);
  21934. codeblock.tby0_ = Math.max(subband.tby0, codeblock.tby0);
  21935. codeblock.tbx1_ = Math.min(subband.tbx1, codeblock.tbx1);
  21936. codeblock.tby1_ = Math.min(subband.tby1, codeblock.tby1);
  21937. const pi = Math.floor((codeblock.tbx0_ - subband.tbx0) / precinctParameters.precinctWidthInSubband);
  21938. const pj = Math.floor((codeblock.tby0_ - subband.tby0) / precinctParameters.precinctHeightInSubband);
  21939. precinctNumber = pi + pj * precinctParameters.numprecinctswide;
  21940. codeblock.precinctNumber = precinctNumber;
  21941. codeblock.subbandType = subband.type;
  21942. codeblock.Lblock = 3;
  21943. if (codeblock.tbx1_ <= codeblock.tbx0_ || codeblock.tby1_ <= codeblock.tby0_) {
  21944. continue;
  21945. }
  21946. codeblocks.push(codeblock);
  21947. let precinct = precincts[precinctNumber];
  21948. if (precinct !== undefined) {
  21949. if (i < precinct.cbxMin) {
  21950. precinct.cbxMin = i;
  21951. } else if (i > precinct.cbxMax) {
  21952. precinct.cbxMax = i;
  21953. }
  21954. if (j < precinct.cbyMin) {
  21955. precinct.cbxMin = j;
  21956. } else if (j > precinct.cbyMax) {
  21957. precinct.cbyMax = j;
  21958. }
  21959. } else {
  21960. precincts[precinctNumber] = precinct = {
  21961. cbxMin: i,
  21962. cbyMin: j,
  21963. cbxMax: i,
  21964. cbyMax: j
  21965. };
  21966. }
  21967. codeblock.precinct = precinct;
  21968. }
  21969. }
  21970. subband.codeblockParameters = {
  21971. codeblockWidth: xcb_,
  21972. codeblockHeight: ycb_,
  21973. numcodeblockwide: cbx1 - cbx0 + 1,
  21974. numcodeblockhigh: cby1 - cby0 + 1
  21975. };
  21976. subband.codeblocks = codeblocks;
  21977. subband.precincts = precincts;
  21978. }
  21979. function createPacket(resolution, precinctNumber, layerNumber) {
  21980. const precinctCodeblocks = [];
  21981. const subbands = resolution.subbands;
  21982. for (let i = 0, ii = subbands.length; i < ii; i++) {
  21983. const subband = subbands[i];
  21984. const codeblocks = subband.codeblocks;
  21985. for (let j = 0, jj = codeblocks.length; j < jj; j++) {
  21986. const codeblock = codeblocks[j];
  21987. if (codeblock.precinctNumber !== precinctNumber) {
  21988. continue;
  21989. }
  21990. precinctCodeblocks.push(codeblock);
  21991. }
  21992. }
  21993. return {
  21994. layerNumber,
  21995. codeblocks: precinctCodeblocks
  21996. };
  21997. }
  21998. function LayerResolutionComponentPositionIterator(context) {
  21999. const siz = context.SIZ;
  22000. const tileIndex = context.currentTile.index;
  22001. const tile = context.tiles[tileIndex];
  22002. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  22003. const componentsCount = siz.Csiz;
  22004. let maxDecompositionLevelsCount = 0;
  22005. for (let q = 0; q < componentsCount; q++) {
  22006. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount);
  22007. }
  22008. let l = 0,
  22009. r = 0,
  22010. i = 0,
  22011. k = 0;
  22012. this.nextPacket = function JpxImage_nextPacket() {
  22013. for (; l < layersCount; l++) {
  22014. for (; r <= maxDecompositionLevelsCount; r++) {
  22015. for (; i < componentsCount; i++) {
  22016. const component = tile.components[i];
  22017. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  22018. continue;
  22019. }
  22020. const resolution = component.resolutions[r];
  22021. const numprecincts = resolution.precinctParameters.numprecincts;
  22022. for (; k < numprecincts;) {
  22023. const packet = createPacket(resolution, k, l);
  22024. k++;
  22025. return packet;
  22026. }
  22027. k = 0;
  22028. }
  22029. i = 0;
  22030. }
  22031. r = 0;
  22032. }
  22033. throw new JpxError("Out of packets");
  22034. };
  22035. }
  22036. function ResolutionLayerComponentPositionIterator(context) {
  22037. const siz = context.SIZ;
  22038. const tileIndex = context.currentTile.index;
  22039. const tile = context.tiles[tileIndex];
  22040. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  22041. const componentsCount = siz.Csiz;
  22042. let maxDecompositionLevelsCount = 0;
  22043. for (let q = 0; q < componentsCount; q++) {
  22044. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount);
  22045. }
  22046. let r = 0,
  22047. l = 0,
  22048. i = 0,
  22049. k = 0;
  22050. this.nextPacket = function JpxImage_nextPacket() {
  22051. for (; r <= maxDecompositionLevelsCount; r++) {
  22052. for (; l < layersCount; l++) {
  22053. for (; i < componentsCount; i++) {
  22054. const component = tile.components[i];
  22055. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  22056. continue;
  22057. }
  22058. const resolution = component.resolutions[r];
  22059. const numprecincts = resolution.precinctParameters.numprecincts;
  22060. for (; k < numprecincts;) {
  22061. const packet = createPacket(resolution, k, l);
  22062. k++;
  22063. return packet;
  22064. }
  22065. k = 0;
  22066. }
  22067. i = 0;
  22068. }
  22069. l = 0;
  22070. }
  22071. throw new JpxError("Out of packets");
  22072. };
  22073. }
  22074. function ResolutionPositionComponentLayerIterator(context) {
  22075. const siz = context.SIZ;
  22076. const tileIndex = context.currentTile.index;
  22077. const tile = context.tiles[tileIndex];
  22078. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  22079. const componentsCount = siz.Csiz;
  22080. let l, r, c, p;
  22081. let maxDecompositionLevelsCount = 0;
  22082. for (c = 0; c < componentsCount; c++) {
  22083. const component = tile.components[c];
  22084. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, component.codingStyleParameters.decompositionLevelsCount);
  22085. }
  22086. const maxNumPrecinctsInLevel = new Int32Array(maxDecompositionLevelsCount + 1);
  22087. for (r = 0; r <= maxDecompositionLevelsCount; ++r) {
  22088. let maxNumPrecincts = 0;
  22089. for (c = 0; c < componentsCount; ++c) {
  22090. const resolutions = tile.components[c].resolutions;
  22091. if (r < resolutions.length) {
  22092. maxNumPrecincts = Math.max(maxNumPrecincts, resolutions[r].precinctParameters.numprecincts);
  22093. }
  22094. }
  22095. maxNumPrecinctsInLevel[r] = maxNumPrecincts;
  22096. }
  22097. l = 0;
  22098. r = 0;
  22099. c = 0;
  22100. p = 0;
  22101. this.nextPacket = function JpxImage_nextPacket() {
  22102. for (; r <= maxDecompositionLevelsCount; r++) {
  22103. for (; p < maxNumPrecinctsInLevel[r]; p++) {
  22104. for (; c < componentsCount; c++) {
  22105. const component = tile.components[c];
  22106. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  22107. continue;
  22108. }
  22109. const resolution = component.resolutions[r];
  22110. const numprecincts = resolution.precinctParameters.numprecincts;
  22111. if (p >= numprecincts) {
  22112. continue;
  22113. }
  22114. for (; l < layersCount;) {
  22115. const packet = createPacket(resolution, p, l);
  22116. l++;
  22117. return packet;
  22118. }
  22119. l = 0;
  22120. }
  22121. c = 0;
  22122. }
  22123. p = 0;
  22124. }
  22125. throw new JpxError("Out of packets");
  22126. };
  22127. }
  22128. function PositionComponentResolutionLayerIterator(context) {
  22129. const siz = context.SIZ;
  22130. const tileIndex = context.currentTile.index;
  22131. const tile = context.tiles[tileIndex];
  22132. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  22133. const componentsCount = siz.Csiz;
  22134. const precinctsSizes = getPrecinctSizesInImageScale(tile);
  22135. const precinctsIterationSizes = precinctsSizes;
  22136. let l = 0,
  22137. r = 0,
  22138. c = 0,
  22139. px = 0,
  22140. py = 0;
  22141. this.nextPacket = function JpxImage_nextPacket() {
  22142. for (; py < precinctsIterationSizes.maxNumHigh; py++) {
  22143. for (; px < precinctsIterationSizes.maxNumWide; px++) {
  22144. for (; c < componentsCount; c++) {
  22145. const component = tile.components[c];
  22146. const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  22147. for (; r <= decompositionLevelsCount; r++) {
  22148. const resolution = component.resolutions[r];
  22149. const sizeInImageScale = precinctsSizes.components[c].resolutions[r];
  22150. const k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution);
  22151. if (k === null) {
  22152. continue;
  22153. }
  22154. for (; l < layersCount;) {
  22155. const packet = createPacket(resolution, k, l);
  22156. l++;
  22157. return packet;
  22158. }
  22159. l = 0;
  22160. }
  22161. r = 0;
  22162. }
  22163. c = 0;
  22164. }
  22165. px = 0;
  22166. }
  22167. throw new JpxError("Out of packets");
  22168. };
  22169. }
  22170. function ComponentPositionResolutionLayerIterator(context) {
  22171. const siz = context.SIZ;
  22172. const tileIndex = context.currentTile.index;
  22173. const tile = context.tiles[tileIndex];
  22174. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  22175. const componentsCount = siz.Csiz;
  22176. const precinctsSizes = getPrecinctSizesInImageScale(tile);
  22177. let l = 0,
  22178. r = 0,
  22179. c = 0,
  22180. px = 0,
  22181. py = 0;
  22182. this.nextPacket = function JpxImage_nextPacket() {
  22183. for (; c < componentsCount; ++c) {
  22184. const component = tile.components[c];
  22185. const precinctsIterationSizes = precinctsSizes.components[c];
  22186. const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  22187. for (; py < precinctsIterationSizes.maxNumHigh; py++) {
  22188. for (; px < precinctsIterationSizes.maxNumWide; px++) {
  22189. for (; r <= decompositionLevelsCount; r++) {
  22190. const resolution = component.resolutions[r];
  22191. const sizeInImageScale = precinctsIterationSizes.resolutions[r];
  22192. const k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution);
  22193. if (k === null) {
  22194. continue;
  22195. }
  22196. for (; l < layersCount;) {
  22197. const packet = createPacket(resolution, k, l);
  22198. l++;
  22199. return packet;
  22200. }
  22201. l = 0;
  22202. }
  22203. r = 0;
  22204. }
  22205. px = 0;
  22206. }
  22207. py = 0;
  22208. }
  22209. throw new JpxError("Out of packets");
  22210. };
  22211. }
  22212. function getPrecinctIndexIfExist(pxIndex, pyIndex, sizeInImageScale, precinctIterationSizes, resolution) {
  22213. const posX = pxIndex * precinctIterationSizes.minWidth;
  22214. const posY = pyIndex * precinctIterationSizes.minHeight;
  22215. if (posX % sizeInImageScale.width !== 0 || posY % sizeInImageScale.height !== 0) {
  22216. return null;
  22217. }
  22218. const startPrecinctRowIndex = posY / sizeInImageScale.width * resolution.precinctParameters.numprecinctswide;
  22219. return posX / sizeInImageScale.height + startPrecinctRowIndex;
  22220. }
  22221. function getPrecinctSizesInImageScale(tile) {
  22222. const componentsCount = tile.components.length;
  22223. let minWidth = Number.MAX_VALUE;
  22224. let minHeight = Number.MAX_VALUE;
  22225. let maxNumWide = 0;
  22226. let maxNumHigh = 0;
  22227. const sizePerComponent = new Array(componentsCount);
  22228. for (let c = 0; c < componentsCount; c++) {
  22229. const component = tile.components[c];
  22230. const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  22231. const sizePerResolution = new Array(decompositionLevelsCount + 1);
  22232. let minWidthCurrentComponent = Number.MAX_VALUE;
  22233. let minHeightCurrentComponent = Number.MAX_VALUE;
  22234. let maxNumWideCurrentComponent = 0;
  22235. let maxNumHighCurrentComponent = 0;
  22236. let scale = 1;
  22237. for (let r = decompositionLevelsCount; r >= 0; --r) {
  22238. const resolution = component.resolutions[r];
  22239. const widthCurrentResolution = scale * resolution.precinctParameters.precinctWidth;
  22240. const heightCurrentResolution = scale * resolution.precinctParameters.precinctHeight;
  22241. minWidthCurrentComponent = Math.min(minWidthCurrentComponent, widthCurrentResolution);
  22242. minHeightCurrentComponent = Math.min(minHeightCurrentComponent, heightCurrentResolution);
  22243. maxNumWideCurrentComponent = Math.max(maxNumWideCurrentComponent, resolution.precinctParameters.numprecinctswide);
  22244. maxNumHighCurrentComponent = Math.max(maxNumHighCurrentComponent, resolution.precinctParameters.numprecinctshigh);
  22245. sizePerResolution[r] = {
  22246. width: widthCurrentResolution,
  22247. height: heightCurrentResolution
  22248. };
  22249. scale <<= 1;
  22250. }
  22251. minWidth = Math.min(minWidth, minWidthCurrentComponent);
  22252. minHeight = Math.min(minHeight, minHeightCurrentComponent);
  22253. maxNumWide = Math.max(maxNumWide, maxNumWideCurrentComponent);
  22254. maxNumHigh = Math.max(maxNumHigh, maxNumHighCurrentComponent);
  22255. sizePerComponent[c] = {
  22256. resolutions: sizePerResolution,
  22257. minWidth: minWidthCurrentComponent,
  22258. minHeight: minHeightCurrentComponent,
  22259. maxNumWide: maxNumWideCurrentComponent,
  22260. maxNumHigh: maxNumHighCurrentComponent
  22261. };
  22262. }
  22263. return {
  22264. components: sizePerComponent,
  22265. minWidth,
  22266. minHeight,
  22267. maxNumWide,
  22268. maxNumHigh
  22269. };
  22270. }
  22271. function buildPackets(context) {
  22272. const siz = context.SIZ;
  22273. const tileIndex = context.currentTile.index;
  22274. const tile = context.tiles[tileIndex];
  22275. const componentsCount = siz.Csiz;
  22276. for (let c = 0; c < componentsCount; c++) {
  22277. const component = tile.components[c];
  22278. const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  22279. const resolutions = [];
  22280. const subbands = [];
  22281. for (let r = 0; r <= decompositionLevelsCount; r++) {
  22282. const blocksDimensions = getBlocksDimensions(context, component, r);
  22283. const resolution = {};
  22284. const scale = 1 << decompositionLevelsCount - r;
  22285. resolution.trx0 = Math.ceil(component.tcx0 / scale);
  22286. resolution.try0 = Math.ceil(component.tcy0 / scale);
  22287. resolution.trx1 = Math.ceil(component.tcx1 / scale);
  22288. resolution.try1 = Math.ceil(component.tcy1 / scale);
  22289. resolution.resLevel = r;
  22290. buildPrecincts(context, resolution, blocksDimensions);
  22291. resolutions.push(resolution);
  22292. let subband;
  22293. if (r === 0) {
  22294. subband = {};
  22295. subband.type = "LL";
  22296. subband.tbx0 = Math.ceil(component.tcx0 / scale);
  22297. subband.tby0 = Math.ceil(component.tcy0 / scale);
  22298. subband.tbx1 = Math.ceil(component.tcx1 / scale);
  22299. subband.tby1 = Math.ceil(component.tcy1 / scale);
  22300. subband.resolution = resolution;
  22301. buildCodeblocks(context, subband, blocksDimensions);
  22302. subbands.push(subband);
  22303. resolution.subbands = [subband];
  22304. } else {
  22305. const bscale = 1 << decompositionLevelsCount - r + 1;
  22306. const resolutionSubbands = [];
  22307. subband = {};
  22308. subband.type = "HL";
  22309. subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5);
  22310. subband.tby0 = Math.ceil(component.tcy0 / bscale);
  22311. subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5);
  22312. subband.tby1 = Math.ceil(component.tcy1 / bscale);
  22313. subband.resolution = resolution;
  22314. buildCodeblocks(context, subband, blocksDimensions);
  22315. subbands.push(subband);
  22316. resolutionSubbands.push(subband);
  22317. subband = {};
  22318. subband.type = "LH";
  22319. subband.tbx0 = Math.ceil(component.tcx0 / bscale);
  22320. subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5);
  22321. subband.tbx1 = Math.ceil(component.tcx1 / bscale);
  22322. subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5);
  22323. subband.resolution = resolution;
  22324. buildCodeblocks(context, subband, blocksDimensions);
  22325. subbands.push(subband);
  22326. resolutionSubbands.push(subband);
  22327. subband = {};
  22328. subband.type = "HH";
  22329. subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5);
  22330. subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5);
  22331. subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5);
  22332. subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5);
  22333. subband.resolution = resolution;
  22334. buildCodeblocks(context, subband, blocksDimensions);
  22335. subbands.push(subband);
  22336. resolutionSubbands.push(subband);
  22337. resolution.subbands = resolutionSubbands;
  22338. }
  22339. }
  22340. component.resolutions = resolutions;
  22341. component.subbands = subbands;
  22342. }
  22343. const progressionOrder = tile.codingStyleDefaultParameters.progressionOrder;
  22344. switch (progressionOrder) {
  22345. case 0:
  22346. tile.packetsIterator = new LayerResolutionComponentPositionIterator(context);
  22347. break;
  22348. case 1:
  22349. tile.packetsIterator = new ResolutionLayerComponentPositionIterator(context);
  22350. break;
  22351. case 2:
  22352. tile.packetsIterator = new ResolutionPositionComponentLayerIterator(context);
  22353. break;
  22354. case 3:
  22355. tile.packetsIterator = new PositionComponentResolutionLayerIterator(context);
  22356. break;
  22357. case 4:
  22358. tile.packetsIterator = new ComponentPositionResolutionLayerIterator(context);
  22359. break;
  22360. default:
  22361. throw new JpxError(`Unsupported progression order ${progressionOrder}`);
  22362. }
  22363. }
  22364. function parseTilePackets(context, data, offset, dataLength) {
  22365. let position = 0;
  22366. let buffer,
  22367. bufferSize = 0,
  22368. skipNextBit = false;
  22369. function readBits(count) {
  22370. while (bufferSize < count) {
  22371. const b = data[offset + position];
  22372. position++;
  22373. if (skipNextBit) {
  22374. buffer = buffer << 7 | b;
  22375. bufferSize += 7;
  22376. skipNextBit = false;
  22377. } else {
  22378. buffer = buffer << 8 | b;
  22379. bufferSize += 8;
  22380. }
  22381. if (b === 0xff) {
  22382. skipNextBit = true;
  22383. }
  22384. }
  22385. bufferSize -= count;
  22386. return buffer >>> bufferSize & (1 << count) - 1;
  22387. }
  22388. function skipMarkerIfEqual(value) {
  22389. if (data[offset + position - 1] === 0xff && data[offset + position] === value) {
  22390. skipBytes(1);
  22391. return true;
  22392. } else if (data[offset + position] === 0xff && data[offset + position + 1] === value) {
  22393. skipBytes(2);
  22394. return true;
  22395. }
  22396. return false;
  22397. }
  22398. function skipBytes(count) {
  22399. position += count;
  22400. }
  22401. function alignToByte() {
  22402. bufferSize = 0;
  22403. if (skipNextBit) {
  22404. position++;
  22405. skipNextBit = false;
  22406. }
  22407. }
  22408. function readCodingpasses() {
  22409. if (readBits(1) === 0) {
  22410. return 1;
  22411. }
  22412. if (readBits(1) === 0) {
  22413. return 2;
  22414. }
  22415. let value = readBits(2);
  22416. if (value < 3) {
  22417. return value + 3;
  22418. }
  22419. value = readBits(5);
  22420. if (value < 31) {
  22421. return value + 6;
  22422. }
  22423. value = readBits(7);
  22424. return value + 37;
  22425. }
  22426. const tileIndex = context.currentTile.index;
  22427. const tile = context.tiles[tileIndex];
  22428. const sopMarkerUsed = context.COD.sopMarkerUsed;
  22429. const ephMarkerUsed = context.COD.ephMarkerUsed;
  22430. const packetsIterator = tile.packetsIterator;
  22431. while (position < dataLength) {
  22432. alignToByte();
  22433. if (sopMarkerUsed && skipMarkerIfEqual(0x91)) {
  22434. skipBytes(4);
  22435. }
  22436. const packet = packetsIterator.nextPacket();
  22437. if (!readBits(1)) {
  22438. continue;
  22439. }
  22440. const layerNumber = packet.layerNumber,
  22441. queue = [];
  22442. let codeblock;
  22443. for (let i = 0, ii = packet.codeblocks.length; i < ii; i++) {
  22444. codeblock = packet.codeblocks[i];
  22445. let precinct = codeblock.precinct;
  22446. const codeblockColumn = codeblock.cbx - precinct.cbxMin;
  22447. const codeblockRow = codeblock.cby - precinct.cbyMin;
  22448. let codeblockIncluded = false;
  22449. let firstTimeInclusion = false;
  22450. let valueReady, zeroBitPlanesTree;
  22451. if (codeblock.included !== undefined) {
  22452. codeblockIncluded = !!readBits(1);
  22453. } else {
  22454. precinct = codeblock.precinct;
  22455. let inclusionTree;
  22456. if (precinct.inclusionTree !== undefined) {
  22457. inclusionTree = precinct.inclusionTree;
  22458. } else {
  22459. const width = precinct.cbxMax - precinct.cbxMin + 1;
  22460. const height = precinct.cbyMax - precinct.cbyMin + 1;
  22461. inclusionTree = new InclusionTree(width, height, layerNumber);
  22462. zeroBitPlanesTree = new TagTree(width, height);
  22463. precinct.inclusionTree = inclusionTree;
  22464. precinct.zeroBitPlanesTree = zeroBitPlanesTree;
  22465. for (let l = 0; l < layerNumber; l++) {
  22466. if (readBits(1) !== 0) {
  22467. throw new JpxError("Invalid tag tree");
  22468. }
  22469. }
  22470. }
  22471. if (inclusionTree.reset(codeblockColumn, codeblockRow, layerNumber)) {
  22472. while (true) {
  22473. if (readBits(1)) {
  22474. valueReady = !inclusionTree.nextLevel();
  22475. if (valueReady) {
  22476. codeblock.included = true;
  22477. codeblockIncluded = firstTimeInclusion = true;
  22478. break;
  22479. }
  22480. } else {
  22481. inclusionTree.incrementValue(layerNumber);
  22482. break;
  22483. }
  22484. }
  22485. }
  22486. }
  22487. if (!codeblockIncluded) {
  22488. continue;
  22489. }
  22490. if (firstTimeInclusion) {
  22491. zeroBitPlanesTree = precinct.zeroBitPlanesTree;
  22492. zeroBitPlanesTree.reset(codeblockColumn, codeblockRow);
  22493. while (true) {
  22494. if (readBits(1)) {
  22495. valueReady = !zeroBitPlanesTree.nextLevel();
  22496. if (valueReady) {
  22497. break;
  22498. }
  22499. } else {
  22500. zeroBitPlanesTree.incrementValue();
  22501. }
  22502. }
  22503. codeblock.zeroBitPlanes = zeroBitPlanesTree.value;
  22504. }
  22505. const codingpasses = readCodingpasses();
  22506. while (readBits(1)) {
  22507. codeblock.Lblock++;
  22508. }
  22509. const codingpassesLog2 = (0, _core_utils.log2)(codingpasses);
  22510. const bits = (codingpasses < 1 << codingpassesLog2 ? codingpassesLog2 - 1 : codingpassesLog2) + codeblock.Lblock;
  22511. const codedDataLength = readBits(bits);
  22512. queue.push({
  22513. codeblock,
  22514. codingpasses,
  22515. dataLength: codedDataLength
  22516. });
  22517. }
  22518. alignToByte();
  22519. if (ephMarkerUsed) {
  22520. skipMarkerIfEqual(0x92);
  22521. }
  22522. while (queue.length > 0) {
  22523. const packetItem = queue.shift();
  22524. codeblock = packetItem.codeblock;
  22525. if (codeblock.data === undefined) {
  22526. codeblock.data = [];
  22527. }
  22528. codeblock.data.push({
  22529. data,
  22530. start: offset + position,
  22531. end: offset + position + packetItem.dataLength,
  22532. codingpasses: packetItem.codingpasses
  22533. });
  22534. position += packetItem.dataLength;
  22535. }
  22536. }
  22537. return position;
  22538. }
  22539. function copyCoefficients(coefficients, levelWidth, levelHeight, subband, delta, mb, reversible, segmentationSymbolUsed, resetContextProbabilities) {
  22540. const x0 = subband.tbx0;
  22541. const y0 = subband.tby0;
  22542. const width = subband.tbx1 - subband.tbx0;
  22543. const codeblocks = subband.codeblocks;
  22544. const right = subband.type.charAt(0) === "H" ? 1 : 0;
  22545. const bottom = subband.type.charAt(1) === "H" ? levelWidth : 0;
  22546. for (let i = 0, ii = codeblocks.length; i < ii; ++i) {
  22547. const codeblock = codeblocks[i];
  22548. const blockWidth = codeblock.tbx1_ - codeblock.tbx0_;
  22549. const blockHeight = codeblock.tby1_ - codeblock.tby0_;
  22550. if (blockWidth === 0 || blockHeight === 0) {
  22551. continue;
  22552. }
  22553. if (codeblock.data === undefined) {
  22554. continue;
  22555. }
  22556. const bitModel = new BitModel(blockWidth, blockHeight, codeblock.subbandType, codeblock.zeroBitPlanes, mb);
  22557. let currentCodingpassType = 2;
  22558. const data = codeblock.data;
  22559. let totalLength = 0,
  22560. codingpasses = 0;
  22561. let j, jj, dataItem;
  22562. for (j = 0, jj = data.length; j < jj; j++) {
  22563. dataItem = data[j];
  22564. totalLength += dataItem.end - dataItem.start;
  22565. codingpasses += dataItem.codingpasses;
  22566. }
  22567. const encodedData = new Uint8Array(totalLength);
  22568. let position = 0;
  22569. for (j = 0, jj = data.length; j < jj; j++) {
  22570. dataItem = data[j];
  22571. const chunk = dataItem.data.subarray(dataItem.start, dataItem.end);
  22572. encodedData.set(chunk, position);
  22573. position += chunk.length;
  22574. }
  22575. const decoder = new _arithmetic_decoder.ArithmeticDecoder(encodedData, 0, totalLength);
  22576. bitModel.setDecoder(decoder);
  22577. for (j = 0; j < codingpasses; j++) {
  22578. switch (currentCodingpassType) {
  22579. case 0:
  22580. bitModel.runSignificancePropagationPass();
  22581. break;
  22582. case 1:
  22583. bitModel.runMagnitudeRefinementPass();
  22584. break;
  22585. case 2:
  22586. bitModel.runCleanupPass();
  22587. if (segmentationSymbolUsed) {
  22588. bitModel.checkSegmentationSymbol();
  22589. }
  22590. break;
  22591. }
  22592. if (resetContextProbabilities) {
  22593. bitModel.reset();
  22594. }
  22595. currentCodingpassType = (currentCodingpassType + 1) % 3;
  22596. }
  22597. let offset = codeblock.tbx0_ - x0 + (codeblock.tby0_ - y0) * width;
  22598. const sign = bitModel.coefficentsSign;
  22599. const magnitude = bitModel.coefficentsMagnitude;
  22600. const bitsDecoded = bitModel.bitsDecoded;
  22601. const magnitudeCorrection = reversible ? 0 : 0.5;
  22602. let k, n, nb;
  22603. position = 0;
  22604. const interleave = subband.type !== "LL";
  22605. for (j = 0; j < blockHeight; j++) {
  22606. const row = offset / width | 0;
  22607. const levelOffset = 2 * row * (levelWidth - width) + right + bottom;
  22608. for (k = 0; k < blockWidth; k++) {
  22609. n = magnitude[position];
  22610. if (n !== 0) {
  22611. n = (n + magnitudeCorrection) * delta;
  22612. if (sign[position] !== 0) {
  22613. n = -n;
  22614. }
  22615. nb = bitsDecoded[position];
  22616. const pos = interleave ? levelOffset + (offset << 1) : offset;
  22617. if (reversible && nb >= mb) {
  22618. coefficients[pos] = n;
  22619. } else {
  22620. coefficients[pos] = n * (1 << mb - nb);
  22621. }
  22622. }
  22623. offset++;
  22624. position++;
  22625. }
  22626. offset += width - blockWidth;
  22627. }
  22628. }
  22629. }
  22630. function transformTile(context, tile, c) {
  22631. const component = tile.components[c];
  22632. const codingStyleParameters = component.codingStyleParameters;
  22633. const quantizationParameters = component.quantizationParameters;
  22634. const decompositionLevelsCount = codingStyleParameters.decompositionLevelsCount;
  22635. const spqcds = quantizationParameters.SPqcds;
  22636. const scalarExpounded = quantizationParameters.scalarExpounded;
  22637. const guardBits = quantizationParameters.guardBits;
  22638. const segmentationSymbolUsed = codingStyleParameters.segmentationSymbolUsed;
  22639. const resetContextProbabilities = codingStyleParameters.resetContextProbabilities;
  22640. const precision = context.components[c].precision;
  22641. const reversible = codingStyleParameters.reversibleTransformation;
  22642. const transform = reversible ? new ReversibleTransform() : new IrreversibleTransform();
  22643. const subbandCoefficients = [];
  22644. let b = 0;
  22645. for (let i = 0; i <= decompositionLevelsCount; i++) {
  22646. const resolution = component.resolutions[i];
  22647. const width = resolution.trx1 - resolution.trx0;
  22648. const height = resolution.try1 - resolution.try0;
  22649. const coefficients = new Float32Array(width * height);
  22650. for (let j = 0, jj = resolution.subbands.length; j < jj; j++) {
  22651. let mu, epsilon;
  22652. if (!scalarExpounded) {
  22653. mu = spqcds[0].mu;
  22654. epsilon = spqcds[0].epsilon + (i > 0 ? 1 - i : 0);
  22655. } else {
  22656. mu = spqcds[b].mu;
  22657. epsilon = spqcds[b].epsilon;
  22658. b++;
  22659. }
  22660. const subband = resolution.subbands[j];
  22661. const gainLog2 = SubbandsGainLog2[subband.type];
  22662. const delta = reversible ? 1 : 2 ** (precision + gainLog2 - epsilon) * (1 + mu / 2048);
  22663. const mb = guardBits + epsilon - 1;
  22664. copyCoefficients(coefficients, width, height, subband, delta, mb, reversible, segmentationSymbolUsed, resetContextProbabilities);
  22665. }
  22666. subbandCoefficients.push({
  22667. width,
  22668. height,
  22669. items: coefficients
  22670. });
  22671. }
  22672. const result = transform.calculate(subbandCoefficients, component.tcx0, component.tcy0);
  22673. return {
  22674. left: component.tcx0,
  22675. top: component.tcy0,
  22676. width: result.width,
  22677. height: result.height,
  22678. items: result.items
  22679. };
  22680. }
  22681. function transformComponents(context) {
  22682. const siz = context.SIZ;
  22683. const components = context.components;
  22684. const componentsCount = siz.Csiz;
  22685. const resultImages = [];
  22686. for (let i = 0, ii = context.tiles.length; i < ii; i++) {
  22687. const tile = context.tiles[i];
  22688. const transformedTiles = [];
  22689. for (let c = 0; c < componentsCount; c++) {
  22690. transformedTiles[c] = transformTile(context, tile, c);
  22691. }
  22692. const tile0 = transformedTiles[0];
  22693. const out = new Uint8ClampedArray(tile0.items.length * componentsCount);
  22694. const result = {
  22695. left: tile0.left,
  22696. top: tile0.top,
  22697. width: tile0.width,
  22698. height: tile0.height,
  22699. items: out
  22700. };
  22701. let shift, offset;
  22702. let pos = 0,
  22703. j,
  22704. jj,
  22705. y0,
  22706. y1,
  22707. y2;
  22708. if (tile.codingStyleDefaultParameters.multipleComponentTransform) {
  22709. const fourComponents = componentsCount === 4;
  22710. const y0items = transformedTiles[0].items;
  22711. const y1items = transformedTiles[1].items;
  22712. const y2items = transformedTiles[2].items;
  22713. const y3items = fourComponents ? transformedTiles[3].items : null;
  22714. shift = components[0].precision - 8;
  22715. offset = (128 << shift) + 0.5;
  22716. const component0 = tile.components[0];
  22717. const alpha01 = componentsCount - 3;
  22718. jj = y0items.length;
  22719. if (!component0.codingStyleParameters.reversibleTransformation) {
  22720. for (j = 0; j < jj; j++, pos += alpha01) {
  22721. y0 = y0items[j] + offset;
  22722. y1 = y1items[j];
  22723. y2 = y2items[j];
  22724. out[pos++] = y0 + 1.402 * y2 >> shift;
  22725. out[pos++] = y0 - 0.34413 * y1 - 0.71414 * y2 >> shift;
  22726. out[pos++] = y0 + 1.772 * y1 >> shift;
  22727. }
  22728. } else {
  22729. for (j = 0; j < jj; j++, pos += alpha01) {
  22730. y0 = y0items[j] + offset;
  22731. y1 = y1items[j];
  22732. y2 = y2items[j];
  22733. const g = y0 - (y2 + y1 >> 2);
  22734. out[pos++] = g + y2 >> shift;
  22735. out[pos++] = g >> shift;
  22736. out[pos++] = g + y1 >> shift;
  22737. }
  22738. }
  22739. if (fourComponents) {
  22740. for (j = 0, pos = 3; j < jj; j++, pos += 4) {
  22741. out[pos] = y3items[j] + offset >> shift;
  22742. }
  22743. }
  22744. } else {
  22745. for (let c = 0; c < componentsCount; c++) {
  22746. const items = transformedTiles[c].items;
  22747. shift = components[c].precision - 8;
  22748. offset = (128 << shift) + 0.5;
  22749. for (pos = c, j = 0, jj = items.length; j < jj; j++) {
  22750. out[pos] = items[j] + offset >> shift;
  22751. pos += componentsCount;
  22752. }
  22753. }
  22754. }
  22755. resultImages.push(result);
  22756. }
  22757. return resultImages;
  22758. }
  22759. function initializeTile(context, tileIndex) {
  22760. const siz = context.SIZ;
  22761. const componentsCount = siz.Csiz;
  22762. const tile = context.tiles[tileIndex];
  22763. for (let c = 0; c < componentsCount; c++) {
  22764. const component = tile.components[c];
  22765. const qcdOrQcc = context.currentTile.QCC[c] !== undefined ? context.currentTile.QCC[c] : context.currentTile.QCD;
  22766. component.quantizationParameters = qcdOrQcc;
  22767. const codOrCoc = context.currentTile.COC[c] !== undefined ? context.currentTile.COC[c] : context.currentTile.COD;
  22768. component.codingStyleParameters = codOrCoc;
  22769. }
  22770. tile.codingStyleDefaultParameters = context.currentTile.COD;
  22771. }
  22772. class TagTree {
  22773. constructor(width, height) {
  22774. const levelsLength = (0, _core_utils.log2)(Math.max(width, height)) + 1;
  22775. this.levels = [];
  22776. for (let i = 0; i < levelsLength; i++) {
  22777. const level = {
  22778. width,
  22779. height,
  22780. items: []
  22781. };
  22782. this.levels.push(level);
  22783. width = Math.ceil(width / 2);
  22784. height = Math.ceil(height / 2);
  22785. }
  22786. }
  22787. reset(i, j) {
  22788. let currentLevel = 0,
  22789. value = 0,
  22790. level;
  22791. while (currentLevel < this.levels.length) {
  22792. level = this.levels[currentLevel];
  22793. const index = i + j * level.width;
  22794. if (level.items[index] !== undefined) {
  22795. value = level.items[index];
  22796. break;
  22797. }
  22798. level.index = index;
  22799. i >>= 1;
  22800. j >>= 1;
  22801. currentLevel++;
  22802. }
  22803. currentLevel--;
  22804. level = this.levels[currentLevel];
  22805. level.items[level.index] = value;
  22806. this.currentLevel = currentLevel;
  22807. delete this.value;
  22808. }
  22809. incrementValue() {
  22810. const level = this.levels[this.currentLevel];
  22811. level.items[level.index]++;
  22812. }
  22813. nextLevel() {
  22814. let currentLevel = this.currentLevel;
  22815. let level = this.levels[currentLevel];
  22816. const value = level.items[level.index];
  22817. currentLevel--;
  22818. if (currentLevel < 0) {
  22819. this.value = value;
  22820. return false;
  22821. }
  22822. this.currentLevel = currentLevel;
  22823. level = this.levels[currentLevel];
  22824. level.items[level.index] = value;
  22825. return true;
  22826. }
  22827. }
  22828. class InclusionTree {
  22829. constructor(width, height, defaultValue) {
  22830. const levelsLength = (0, _core_utils.log2)(Math.max(width, height)) + 1;
  22831. this.levels = [];
  22832. for (let i = 0; i < levelsLength; i++) {
  22833. const items = new Uint8Array(width * height);
  22834. for (let j = 0, jj = items.length; j < jj; j++) {
  22835. items[j] = defaultValue;
  22836. }
  22837. const level = {
  22838. width,
  22839. height,
  22840. items
  22841. };
  22842. this.levels.push(level);
  22843. width = Math.ceil(width / 2);
  22844. height = Math.ceil(height / 2);
  22845. }
  22846. }
  22847. reset(i, j, stopValue) {
  22848. let currentLevel = 0;
  22849. while (currentLevel < this.levels.length) {
  22850. const level = this.levels[currentLevel];
  22851. const index = i + j * level.width;
  22852. level.index = index;
  22853. const value = level.items[index];
  22854. if (value === 0xff) {
  22855. break;
  22856. }
  22857. if (value > stopValue) {
  22858. this.currentLevel = currentLevel;
  22859. this.propagateValues();
  22860. return false;
  22861. }
  22862. i >>= 1;
  22863. j >>= 1;
  22864. currentLevel++;
  22865. }
  22866. this.currentLevel = currentLevel - 1;
  22867. return true;
  22868. }
  22869. incrementValue(stopValue) {
  22870. const level = this.levels[this.currentLevel];
  22871. level.items[level.index] = stopValue + 1;
  22872. this.propagateValues();
  22873. }
  22874. propagateValues() {
  22875. let levelIndex = this.currentLevel;
  22876. let level = this.levels[levelIndex];
  22877. const currentValue = level.items[level.index];
  22878. while (--levelIndex >= 0) {
  22879. level = this.levels[levelIndex];
  22880. level.items[level.index] = currentValue;
  22881. }
  22882. }
  22883. nextLevel() {
  22884. let currentLevel = this.currentLevel;
  22885. let level = this.levels[currentLevel];
  22886. const value = level.items[level.index];
  22887. level.items[level.index] = 0xff;
  22888. currentLevel--;
  22889. if (currentLevel < 0) {
  22890. return false;
  22891. }
  22892. this.currentLevel = currentLevel;
  22893. level = this.levels[currentLevel];
  22894. level.items[level.index] = value;
  22895. return true;
  22896. }
  22897. }
  22898. const BitModel = function BitModelClosure() {
  22899. const UNIFORM_CONTEXT = 17;
  22900. const RUNLENGTH_CONTEXT = 18;
  22901. 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]);
  22902. 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]);
  22903. 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]);
  22904. class BitModel {
  22905. constructor(width, height, subband, zeroBitPlanes, mb) {
  22906. this.width = width;
  22907. this.height = height;
  22908. let contextLabelTable;
  22909. if (subband === "HH") {
  22910. contextLabelTable = HHContextLabel;
  22911. } else if (subband === "HL") {
  22912. contextLabelTable = HLContextLabel;
  22913. } else {
  22914. contextLabelTable = LLAndLHContextsLabel;
  22915. }
  22916. this.contextLabelTable = contextLabelTable;
  22917. const coefficientCount = width * height;
  22918. this.neighborsSignificance = new Uint8Array(coefficientCount);
  22919. this.coefficentsSign = new Uint8Array(coefficientCount);
  22920. let coefficentsMagnitude;
  22921. if (mb > 14) {
  22922. coefficentsMagnitude = new Uint32Array(coefficientCount);
  22923. } else if (mb > 6) {
  22924. coefficentsMagnitude = new Uint16Array(coefficientCount);
  22925. } else {
  22926. coefficentsMagnitude = new Uint8Array(coefficientCount);
  22927. }
  22928. this.coefficentsMagnitude = coefficentsMagnitude;
  22929. this.processingFlags = new Uint8Array(coefficientCount);
  22930. const bitsDecoded = new Uint8Array(coefficientCount);
  22931. if (zeroBitPlanes !== 0) {
  22932. for (let i = 0; i < coefficientCount; i++) {
  22933. bitsDecoded[i] = zeroBitPlanes;
  22934. }
  22935. }
  22936. this.bitsDecoded = bitsDecoded;
  22937. this.reset();
  22938. }
  22939. setDecoder(decoder) {
  22940. this.decoder = decoder;
  22941. }
  22942. reset() {
  22943. this.contexts = new Int8Array(19);
  22944. this.contexts[0] = 4 << 1 | 0;
  22945. this.contexts[UNIFORM_CONTEXT] = 46 << 1 | 0;
  22946. this.contexts[RUNLENGTH_CONTEXT] = 3 << 1 | 0;
  22947. }
  22948. setNeighborsSignificance(row, column, index) {
  22949. const neighborsSignificance = this.neighborsSignificance;
  22950. const width = this.width,
  22951. height = this.height;
  22952. const left = column > 0;
  22953. const right = column + 1 < width;
  22954. let i;
  22955. if (row > 0) {
  22956. i = index - width;
  22957. if (left) {
  22958. neighborsSignificance[i - 1] += 0x10;
  22959. }
  22960. if (right) {
  22961. neighborsSignificance[i + 1] += 0x10;
  22962. }
  22963. neighborsSignificance[i] += 0x04;
  22964. }
  22965. if (row + 1 < height) {
  22966. i = index + width;
  22967. if (left) {
  22968. neighborsSignificance[i - 1] += 0x10;
  22969. }
  22970. if (right) {
  22971. neighborsSignificance[i + 1] += 0x10;
  22972. }
  22973. neighborsSignificance[i] += 0x04;
  22974. }
  22975. if (left) {
  22976. neighborsSignificance[index - 1] += 0x01;
  22977. }
  22978. if (right) {
  22979. neighborsSignificance[index + 1] += 0x01;
  22980. }
  22981. neighborsSignificance[index] |= 0x80;
  22982. }
  22983. runSignificancePropagationPass() {
  22984. const decoder = this.decoder;
  22985. const width = this.width,
  22986. height = this.height;
  22987. const coefficentsMagnitude = this.coefficentsMagnitude;
  22988. const coefficentsSign = this.coefficentsSign;
  22989. const neighborsSignificance = this.neighborsSignificance;
  22990. const processingFlags = this.processingFlags;
  22991. const contexts = this.contexts;
  22992. const labels = this.contextLabelTable;
  22993. const bitsDecoded = this.bitsDecoded;
  22994. const processedInverseMask = ~1;
  22995. const processedMask = 1;
  22996. const firstMagnitudeBitMask = 2;
  22997. for (let i0 = 0; i0 < height; i0 += 4) {
  22998. for (let j = 0; j < width; j++) {
  22999. let index = i0 * width + j;
  23000. for (let i1 = 0; i1 < 4; i1++, index += width) {
  23001. const i = i0 + i1;
  23002. if (i >= height) {
  23003. break;
  23004. }
  23005. processingFlags[index] &= processedInverseMask;
  23006. if (coefficentsMagnitude[index] || !neighborsSignificance[index]) {
  23007. continue;
  23008. }
  23009. const contextLabel = labels[neighborsSignificance[index]];
  23010. const decision = decoder.readBit(contexts, contextLabel);
  23011. if (decision) {
  23012. const sign = this.decodeSignBit(i, j, index);
  23013. coefficentsSign[index] = sign;
  23014. coefficentsMagnitude[index] = 1;
  23015. this.setNeighborsSignificance(i, j, index);
  23016. processingFlags[index] |= firstMagnitudeBitMask;
  23017. }
  23018. bitsDecoded[index]++;
  23019. processingFlags[index] |= processedMask;
  23020. }
  23021. }
  23022. }
  23023. }
  23024. decodeSignBit(row, column, index) {
  23025. const width = this.width,
  23026. height = this.height;
  23027. const coefficentsMagnitude = this.coefficentsMagnitude;
  23028. const coefficentsSign = this.coefficentsSign;
  23029. let contribution, sign0, sign1, significance1;
  23030. let contextLabel, decoded;
  23031. significance1 = column > 0 && coefficentsMagnitude[index - 1] !== 0;
  23032. if (column + 1 < width && coefficentsMagnitude[index + 1] !== 0) {
  23033. sign1 = coefficentsSign[index + 1];
  23034. if (significance1) {
  23035. sign0 = coefficentsSign[index - 1];
  23036. contribution = 1 - sign1 - sign0;
  23037. } else {
  23038. contribution = 1 - sign1 - sign1;
  23039. }
  23040. } else if (significance1) {
  23041. sign0 = coefficentsSign[index - 1];
  23042. contribution = 1 - sign0 - sign0;
  23043. } else {
  23044. contribution = 0;
  23045. }
  23046. const horizontalContribution = 3 * contribution;
  23047. significance1 = row > 0 && coefficentsMagnitude[index - width] !== 0;
  23048. if (row + 1 < height && coefficentsMagnitude[index + width] !== 0) {
  23049. sign1 = coefficentsSign[index + width];
  23050. if (significance1) {
  23051. sign0 = coefficentsSign[index - width];
  23052. contribution = 1 - sign1 - sign0 + horizontalContribution;
  23053. } else {
  23054. contribution = 1 - sign1 - sign1 + horizontalContribution;
  23055. }
  23056. } else if (significance1) {
  23057. sign0 = coefficentsSign[index - width];
  23058. contribution = 1 - sign0 - sign0 + horizontalContribution;
  23059. } else {
  23060. contribution = horizontalContribution;
  23061. }
  23062. if (contribution >= 0) {
  23063. contextLabel = 9 + contribution;
  23064. decoded = this.decoder.readBit(this.contexts, contextLabel);
  23065. } else {
  23066. contextLabel = 9 - contribution;
  23067. decoded = this.decoder.readBit(this.contexts, contextLabel) ^ 1;
  23068. }
  23069. return decoded;
  23070. }
  23071. runMagnitudeRefinementPass() {
  23072. const decoder = this.decoder;
  23073. const width = this.width,
  23074. height = this.height;
  23075. const coefficentsMagnitude = this.coefficentsMagnitude;
  23076. const neighborsSignificance = this.neighborsSignificance;
  23077. const contexts = this.contexts;
  23078. const bitsDecoded = this.bitsDecoded;
  23079. const processingFlags = this.processingFlags;
  23080. const processedMask = 1;
  23081. const firstMagnitudeBitMask = 2;
  23082. const length = width * height;
  23083. const width4 = width * 4;
  23084. for (let index0 = 0, indexNext; index0 < length; index0 = indexNext) {
  23085. indexNext = Math.min(length, index0 + width4);
  23086. for (let j = 0; j < width; j++) {
  23087. for (let index = index0 + j; index < indexNext; index += width) {
  23088. if (!coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) {
  23089. continue;
  23090. }
  23091. let contextLabel = 16;
  23092. if ((processingFlags[index] & firstMagnitudeBitMask) !== 0) {
  23093. processingFlags[index] ^= firstMagnitudeBitMask;
  23094. const significance = neighborsSignificance[index] & 127;
  23095. contextLabel = significance === 0 ? 15 : 14;
  23096. }
  23097. const bit = decoder.readBit(contexts, contextLabel);
  23098. coefficentsMagnitude[index] = coefficentsMagnitude[index] << 1 | bit;
  23099. bitsDecoded[index]++;
  23100. processingFlags[index] |= processedMask;
  23101. }
  23102. }
  23103. }
  23104. }
  23105. runCleanupPass() {
  23106. const decoder = this.decoder;
  23107. const width = this.width,
  23108. height = this.height;
  23109. const neighborsSignificance = this.neighborsSignificance;
  23110. const coefficentsMagnitude = this.coefficentsMagnitude;
  23111. const coefficentsSign = this.coefficentsSign;
  23112. const contexts = this.contexts;
  23113. const labels = this.contextLabelTable;
  23114. const bitsDecoded = this.bitsDecoded;
  23115. const processingFlags = this.processingFlags;
  23116. const processedMask = 1;
  23117. const firstMagnitudeBitMask = 2;
  23118. const oneRowDown = width;
  23119. const twoRowsDown = width * 2;
  23120. const threeRowsDown = width * 3;
  23121. let iNext;
  23122. for (let i0 = 0; i0 < height; i0 = iNext) {
  23123. iNext = Math.min(i0 + 4, height);
  23124. const indexBase = i0 * width;
  23125. const checkAllEmpty = i0 + 3 < height;
  23126. for (let j = 0; j < width; j++) {
  23127. const index0 = indexBase + j;
  23128. 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;
  23129. let i1 = 0,
  23130. index = index0;
  23131. let i = i0,
  23132. sign;
  23133. if (allEmpty) {
  23134. const hasSignificantCoefficent = decoder.readBit(contexts, RUNLENGTH_CONTEXT);
  23135. if (!hasSignificantCoefficent) {
  23136. bitsDecoded[index0]++;
  23137. bitsDecoded[index0 + oneRowDown]++;
  23138. bitsDecoded[index0 + twoRowsDown]++;
  23139. bitsDecoded[index0 + threeRowsDown]++;
  23140. continue;
  23141. }
  23142. i1 = decoder.readBit(contexts, UNIFORM_CONTEXT) << 1 | decoder.readBit(contexts, UNIFORM_CONTEXT);
  23143. if (i1 !== 0) {
  23144. i = i0 + i1;
  23145. index += i1 * width;
  23146. }
  23147. sign = this.decodeSignBit(i, j, index);
  23148. coefficentsSign[index] = sign;
  23149. coefficentsMagnitude[index] = 1;
  23150. this.setNeighborsSignificance(i, j, index);
  23151. processingFlags[index] |= firstMagnitudeBitMask;
  23152. index = index0;
  23153. for (let i2 = i0; i2 <= i; i2++, index += width) {
  23154. bitsDecoded[index]++;
  23155. }
  23156. i1++;
  23157. }
  23158. for (i = i0 + i1; i < iNext; i++, index += width) {
  23159. if (coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) {
  23160. continue;
  23161. }
  23162. const contextLabel = labels[neighborsSignificance[index]];
  23163. const decision = decoder.readBit(contexts, contextLabel);
  23164. if (decision === 1) {
  23165. sign = this.decodeSignBit(i, j, index);
  23166. coefficentsSign[index] = sign;
  23167. coefficentsMagnitude[index] = 1;
  23168. this.setNeighborsSignificance(i, j, index);
  23169. processingFlags[index] |= firstMagnitudeBitMask;
  23170. }
  23171. bitsDecoded[index]++;
  23172. }
  23173. }
  23174. }
  23175. }
  23176. checkSegmentationSymbol() {
  23177. const decoder = this.decoder;
  23178. const contexts = this.contexts;
  23179. 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);
  23180. if (symbol !== 0xa) {
  23181. throw new JpxError("Invalid segmentation symbol");
  23182. }
  23183. }
  23184. }
  23185. return BitModel;
  23186. }();
  23187. class Transform {
  23188. constructor() {
  23189. if (this.constructor === Transform) {
  23190. (0, _util.unreachable)("Cannot initialize Transform.");
  23191. }
  23192. }
  23193. calculate(subbands, u0, v0) {
  23194. let ll = subbands[0];
  23195. for (let i = 1, ii = subbands.length; i < ii; i++) {
  23196. ll = this.iterate(ll, subbands[i], u0, v0);
  23197. }
  23198. return ll;
  23199. }
  23200. extend(buffer, offset, size) {
  23201. let i1 = offset - 1,
  23202. j1 = offset + 1;
  23203. let i2 = offset + size - 2,
  23204. j2 = offset + size;
  23205. buffer[i1--] = buffer[j1++];
  23206. buffer[j2++] = buffer[i2--];
  23207. buffer[i1--] = buffer[j1++];
  23208. buffer[j2++] = buffer[i2--];
  23209. buffer[i1--] = buffer[j1++];
  23210. buffer[j2++] = buffer[i2--];
  23211. buffer[i1] = buffer[j1];
  23212. buffer[j2] = buffer[i2];
  23213. }
  23214. filter(x, offset, length) {
  23215. (0, _util.unreachable)("Abstract method `filter` called");
  23216. }
  23217. iterate(ll, hl_lh_hh, u0, v0) {
  23218. const llWidth = ll.width,
  23219. llHeight = ll.height;
  23220. let llItems = ll.items;
  23221. const width = hl_lh_hh.width;
  23222. const height = hl_lh_hh.height;
  23223. const items = hl_lh_hh.items;
  23224. let i, j, k, l, u, v;
  23225. for (k = 0, i = 0; i < llHeight; i++) {
  23226. l = i * 2 * width;
  23227. for (j = 0; j < llWidth; j++, k++, l += 2) {
  23228. items[l] = llItems[k];
  23229. }
  23230. }
  23231. llItems = ll.items = null;
  23232. const bufferPadding = 4;
  23233. const rowBuffer = new Float32Array(width + 2 * bufferPadding);
  23234. if (width === 1) {
  23235. if ((u0 & 1) !== 0) {
  23236. for (v = 0, k = 0; v < height; v++, k += width) {
  23237. items[k] *= 0.5;
  23238. }
  23239. }
  23240. } else {
  23241. for (v = 0, k = 0; v < height; v++, k += width) {
  23242. rowBuffer.set(items.subarray(k, k + width), bufferPadding);
  23243. this.extend(rowBuffer, bufferPadding, width);
  23244. this.filter(rowBuffer, bufferPadding, width);
  23245. items.set(rowBuffer.subarray(bufferPadding, bufferPadding + width), k);
  23246. }
  23247. }
  23248. let numBuffers = 16;
  23249. const colBuffers = [];
  23250. for (i = 0; i < numBuffers; i++) {
  23251. colBuffers.push(new Float32Array(height + 2 * bufferPadding));
  23252. }
  23253. let b,
  23254. currentBuffer = 0;
  23255. ll = bufferPadding + height;
  23256. if (height === 1) {
  23257. if ((v0 & 1) !== 0) {
  23258. for (u = 0; u < width; u++) {
  23259. items[u] *= 0.5;
  23260. }
  23261. }
  23262. } else {
  23263. for (u = 0; u < width; u++) {
  23264. if (currentBuffer === 0) {
  23265. numBuffers = Math.min(width - u, numBuffers);
  23266. for (k = u, l = bufferPadding; l < ll; k += width, l++) {
  23267. for (b = 0; b < numBuffers; b++) {
  23268. colBuffers[b][l] = items[k + b];
  23269. }
  23270. }
  23271. currentBuffer = numBuffers;
  23272. }
  23273. currentBuffer--;
  23274. const buffer = colBuffers[currentBuffer];
  23275. this.extend(buffer, bufferPadding, height);
  23276. this.filter(buffer, bufferPadding, height);
  23277. if (currentBuffer === 0) {
  23278. k = u - numBuffers + 1;
  23279. for (l = bufferPadding; l < ll; k += width, l++) {
  23280. for (b = 0; b < numBuffers; b++) {
  23281. items[k + b] = colBuffers[b][l];
  23282. }
  23283. }
  23284. }
  23285. }
  23286. }
  23287. return {
  23288. width,
  23289. height,
  23290. items
  23291. };
  23292. }
  23293. }
  23294. class IrreversibleTransform extends Transform {
  23295. filter(x, offset, length) {
  23296. const len = length >> 1;
  23297. offset |= 0;
  23298. let j, n, current, next;
  23299. const alpha = -1.586134342059924;
  23300. const beta = -0.052980118572961;
  23301. const gamma = 0.882911075530934;
  23302. const delta = 0.443506852043971;
  23303. const K = 1.230174104914001;
  23304. const K_ = 1 / K;
  23305. j = offset - 3;
  23306. for (n = len + 4; n--; j += 2) {
  23307. x[j] *= K_;
  23308. }
  23309. j = offset - 2;
  23310. current = delta * x[j - 1];
  23311. for (n = len + 3; n--; j += 2) {
  23312. next = delta * x[j + 1];
  23313. x[j] = K * x[j] - current - next;
  23314. if (n--) {
  23315. j += 2;
  23316. current = delta * x[j + 1];
  23317. x[j] = K * x[j] - current - next;
  23318. } else {
  23319. break;
  23320. }
  23321. }
  23322. j = offset - 1;
  23323. current = gamma * x[j - 1];
  23324. for (n = len + 2; n--; j += 2) {
  23325. next = gamma * x[j + 1];
  23326. x[j] -= current + next;
  23327. if (n--) {
  23328. j += 2;
  23329. current = gamma * x[j + 1];
  23330. x[j] -= current + next;
  23331. } else {
  23332. break;
  23333. }
  23334. }
  23335. j = offset;
  23336. current = beta * x[j - 1];
  23337. for (n = len + 1; n--; j += 2) {
  23338. next = beta * x[j + 1];
  23339. x[j] -= current + next;
  23340. if (n--) {
  23341. j += 2;
  23342. current = beta * x[j + 1];
  23343. x[j] -= current + next;
  23344. } else {
  23345. break;
  23346. }
  23347. }
  23348. if (len !== 0) {
  23349. j = offset + 1;
  23350. current = alpha * x[j - 1];
  23351. for (n = len; n--; j += 2) {
  23352. next = alpha * x[j + 1];
  23353. x[j] -= current + next;
  23354. if (n--) {
  23355. j += 2;
  23356. current = alpha * x[j + 1];
  23357. x[j] -= current + next;
  23358. } else {
  23359. break;
  23360. }
  23361. }
  23362. }
  23363. }
  23364. }
  23365. class ReversibleTransform extends Transform {
  23366. filter(x, offset, length) {
  23367. const len = length >> 1;
  23368. offset |= 0;
  23369. let j, n;
  23370. for (j = offset, n = len + 1; n--; j += 2) {
  23371. x[j] -= x[j - 1] + x[j + 1] + 2 >> 2;
  23372. }
  23373. for (j = offset + 1, n = len; n--; j += 2) {
  23374. x[j] += x[j - 1] + x[j + 1] >> 1;
  23375. }
  23376. }
  23377. }
  23378. /***/ }),
  23379. /* 160 */
  23380. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  23381. "use strict";
  23382. Object.defineProperty(exports, "__esModule", ({
  23383. value: true
  23384. }));
  23385. exports.LZWStream = void 0;
  23386. var _decode_stream = __w_pdfjs_require__(148);
  23387. class LZWStream extends _decode_stream.DecodeStream {
  23388. constructor(str, maybeLength, earlyChange) {
  23389. super(maybeLength);
  23390. this.str = str;
  23391. this.dict = str.dict;
  23392. this.cachedData = 0;
  23393. this.bitsCached = 0;
  23394. const maxLzwDictionarySize = 4096;
  23395. const lzwState = {
  23396. earlyChange,
  23397. codeLength: 9,
  23398. nextCode: 258,
  23399. dictionaryValues: new Uint8Array(maxLzwDictionarySize),
  23400. dictionaryLengths: new Uint16Array(maxLzwDictionarySize),
  23401. dictionaryPrevCodes: new Uint16Array(maxLzwDictionarySize),
  23402. currentSequence: new Uint8Array(maxLzwDictionarySize),
  23403. currentSequenceLength: 0
  23404. };
  23405. for (let i = 0; i < 256; ++i) {
  23406. lzwState.dictionaryValues[i] = i;
  23407. lzwState.dictionaryLengths[i] = 1;
  23408. }
  23409. this.lzwState = lzwState;
  23410. }
  23411. readBits(n) {
  23412. let bitsCached = this.bitsCached;
  23413. let cachedData = this.cachedData;
  23414. while (bitsCached < n) {
  23415. const c = this.str.getByte();
  23416. if (c === -1) {
  23417. this.eof = true;
  23418. return null;
  23419. }
  23420. cachedData = cachedData << 8 | c;
  23421. bitsCached += 8;
  23422. }
  23423. this.bitsCached = bitsCached -= n;
  23424. this.cachedData = cachedData;
  23425. this.lastCode = null;
  23426. return cachedData >>> bitsCached & (1 << n) - 1;
  23427. }
  23428. readBlock() {
  23429. const blockSize = 512,
  23430. decodedSizeDelta = blockSize;
  23431. let estimatedDecodedSize = blockSize * 2;
  23432. let i, j, q;
  23433. const lzwState = this.lzwState;
  23434. if (!lzwState) {
  23435. return;
  23436. }
  23437. const earlyChange = lzwState.earlyChange;
  23438. let nextCode = lzwState.nextCode;
  23439. const dictionaryValues = lzwState.dictionaryValues;
  23440. const dictionaryLengths = lzwState.dictionaryLengths;
  23441. const dictionaryPrevCodes = lzwState.dictionaryPrevCodes;
  23442. let codeLength = lzwState.codeLength;
  23443. let prevCode = lzwState.prevCode;
  23444. const currentSequence = lzwState.currentSequence;
  23445. let currentSequenceLength = lzwState.currentSequenceLength;
  23446. let decodedLength = 0;
  23447. let currentBufferLength = this.bufferLength;
  23448. let buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
  23449. for (i = 0; i < blockSize; i++) {
  23450. const code = this.readBits(codeLength);
  23451. const hasPrev = currentSequenceLength > 0;
  23452. if (code < 256) {
  23453. currentSequence[0] = code;
  23454. currentSequenceLength = 1;
  23455. } else if (code >= 258) {
  23456. if (code < nextCode) {
  23457. currentSequenceLength = dictionaryLengths[code];
  23458. for (j = currentSequenceLength - 1, q = code; j >= 0; j--) {
  23459. currentSequence[j] = dictionaryValues[q];
  23460. q = dictionaryPrevCodes[q];
  23461. }
  23462. } else {
  23463. currentSequence[currentSequenceLength++] = currentSequence[0];
  23464. }
  23465. } else if (code === 256) {
  23466. codeLength = 9;
  23467. nextCode = 258;
  23468. currentSequenceLength = 0;
  23469. continue;
  23470. } else {
  23471. this.eof = true;
  23472. delete this.lzwState;
  23473. break;
  23474. }
  23475. if (hasPrev) {
  23476. dictionaryPrevCodes[nextCode] = prevCode;
  23477. dictionaryLengths[nextCode] = dictionaryLengths[prevCode] + 1;
  23478. dictionaryValues[nextCode] = currentSequence[0];
  23479. nextCode++;
  23480. codeLength = nextCode + earlyChange & nextCode + earlyChange - 1 ? codeLength : Math.min(Math.log(nextCode + earlyChange) / 0.6931471805599453 + 1, 12) | 0;
  23481. }
  23482. prevCode = code;
  23483. decodedLength += currentSequenceLength;
  23484. if (estimatedDecodedSize < decodedLength) {
  23485. do {
  23486. estimatedDecodedSize += decodedSizeDelta;
  23487. } while (estimatedDecodedSize < decodedLength);
  23488. buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
  23489. }
  23490. for (j = 0; j < currentSequenceLength; j++) {
  23491. buffer[currentBufferLength++] = currentSequence[j];
  23492. }
  23493. }
  23494. lzwState.nextCode = nextCode;
  23495. lzwState.codeLength = codeLength;
  23496. lzwState.prevCode = prevCode;
  23497. lzwState.currentSequenceLength = currentSequenceLength;
  23498. this.bufferLength = currentBufferLength;
  23499. }
  23500. }
  23501. exports.LZWStream = LZWStream;
  23502. /***/ }),
  23503. /* 161 */
  23504. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  23505. "use strict";
  23506. Object.defineProperty(exports, "__esModule", ({
  23507. value: true
  23508. }));
  23509. exports.PredictorStream = void 0;
  23510. var _decode_stream = __w_pdfjs_require__(148);
  23511. var _primitives = __w_pdfjs_require__(134);
  23512. var _util = __w_pdfjs_require__(2);
  23513. class PredictorStream extends _decode_stream.DecodeStream {
  23514. constructor(str, maybeLength, params) {
  23515. super(maybeLength);
  23516. if (!(params instanceof _primitives.Dict)) {
  23517. return str;
  23518. }
  23519. const predictor = this.predictor = params.get("Predictor") || 1;
  23520. if (predictor <= 1) {
  23521. return str;
  23522. }
  23523. if (predictor !== 2 && (predictor < 10 || predictor > 15)) {
  23524. throw new _util.FormatError(`Unsupported predictor: ${predictor}`);
  23525. }
  23526. if (predictor === 2) {
  23527. this.readBlock = this.readBlockTiff;
  23528. } else {
  23529. this.readBlock = this.readBlockPng;
  23530. }
  23531. this.str = str;
  23532. this.dict = str.dict;
  23533. const colors = this.colors = params.get("Colors") || 1;
  23534. const bits = this.bits = params.get("BPC", "BitsPerComponent") || 8;
  23535. const columns = this.columns = params.get("Columns") || 1;
  23536. this.pixBytes = colors * bits + 7 >> 3;
  23537. this.rowBytes = columns * colors * bits + 7 >> 3;
  23538. return this;
  23539. }
  23540. readBlockTiff() {
  23541. const rowBytes = this.rowBytes;
  23542. const bufferLength = this.bufferLength;
  23543. const buffer = this.ensureBuffer(bufferLength + rowBytes);
  23544. const bits = this.bits;
  23545. const colors = this.colors;
  23546. const rawBytes = this.str.getBytes(rowBytes);
  23547. this.eof = !rawBytes.length;
  23548. if (this.eof) {
  23549. return;
  23550. }
  23551. let inbuf = 0,
  23552. outbuf = 0;
  23553. let inbits = 0,
  23554. outbits = 0;
  23555. let pos = bufferLength;
  23556. let i;
  23557. if (bits === 1 && colors === 1) {
  23558. for (i = 0; i < rowBytes; ++i) {
  23559. let c = rawBytes[i] ^ inbuf;
  23560. c ^= c >> 1;
  23561. c ^= c >> 2;
  23562. c ^= c >> 4;
  23563. inbuf = (c & 1) << 7;
  23564. buffer[pos++] = c;
  23565. }
  23566. } else if (bits === 8) {
  23567. for (i = 0; i < colors; ++i) {
  23568. buffer[pos++] = rawBytes[i];
  23569. }
  23570. for (; i < rowBytes; ++i) {
  23571. buffer[pos] = buffer[pos - colors] + rawBytes[i];
  23572. pos++;
  23573. }
  23574. } else if (bits === 16) {
  23575. const bytesPerPixel = colors * 2;
  23576. for (i = 0; i < bytesPerPixel; ++i) {
  23577. buffer[pos++] = rawBytes[i];
  23578. }
  23579. for (; i < rowBytes; i += 2) {
  23580. const sum = ((rawBytes[i] & 0xff) << 8) + (rawBytes[i + 1] & 0xff) + ((buffer[pos - bytesPerPixel] & 0xff) << 8) + (buffer[pos - bytesPerPixel + 1] & 0xff);
  23581. buffer[pos++] = sum >> 8 & 0xff;
  23582. buffer[pos++] = sum & 0xff;
  23583. }
  23584. } else {
  23585. const compArray = new Uint8Array(colors + 1);
  23586. const bitMask = (1 << bits) - 1;
  23587. let j = 0,
  23588. k = bufferLength;
  23589. const columns = this.columns;
  23590. for (i = 0; i < columns; ++i) {
  23591. for (let kk = 0; kk < colors; ++kk) {
  23592. if (inbits < bits) {
  23593. inbuf = inbuf << 8 | rawBytes[j++] & 0xff;
  23594. inbits += 8;
  23595. }
  23596. compArray[kk] = compArray[kk] + (inbuf >> inbits - bits) & bitMask;
  23597. inbits -= bits;
  23598. outbuf = outbuf << bits | compArray[kk];
  23599. outbits += bits;
  23600. if (outbits >= 8) {
  23601. buffer[k++] = outbuf >> outbits - 8 & 0xff;
  23602. outbits -= 8;
  23603. }
  23604. }
  23605. }
  23606. if (outbits > 0) {
  23607. buffer[k++] = (outbuf << 8 - outbits) + (inbuf & (1 << 8 - outbits) - 1);
  23608. }
  23609. }
  23610. this.bufferLength += rowBytes;
  23611. }
  23612. readBlockPng() {
  23613. const rowBytes = this.rowBytes;
  23614. const pixBytes = this.pixBytes;
  23615. const predictor = this.str.getByte();
  23616. const rawBytes = this.str.getBytes(rowBytes);
  23617. this.eof = !rawBytes.length;
  23618. if (this.eof) {
  23619. return;
  23620. }
  23621. const bufferLength = this.bufferLength;
  23622. const buffer = this.ensureBuffer(bufferLength + rowBytes);
  23623. let prevRow = buffer.subarray(bufferLength - rowBytes, bufferLength);
  23624. if (prevRow.length === 0) {
  23625. prevRow = new Uint8Array(rowBytes);
  23626. }
  23627. let i,
  23628. j = bufferLength,
  23629. up,
  23630. c;
  23631. switch (predictor) {
  23632. case 0:
  23633. for (i = 0; i < rowBytes; ++i) {
  23634. buffer[j++] = rawBytes[i];
  23635. }
  23636. break;
  23637. case 1:
  23638. for (i = 0; i < pixBytes; ++i) {
  23639. buffer[j++] = rawBytes[i];
  23640. }
  23641. for (; i < rowBytes; ++i) {
  23642. buffer[j] = buffer[j - pixBytes] + rawBytes[i] & 0xff;
  23643. j++;
  23644. }
  23645. break;
  23646. case 2:
  23647. for (i = 0; i < rowBytes; ++i) {
  23648. buffer[j++] = prevRow[i] + rawBytes[i] & 0xff;
  23649. }
  23650. break;
  23651. case 3:
  23652. for (i = 0; i < pixBytes; ++i) {
  23653. buffer[j++] = (prevRow[i] >> 1) + rawBytes[i];
  23654. }
  23655. for (; i < rowBytes; ++i) {
  23656. buffer[j] = (prevRow[i] + buffer[j - pixBytes] >> 1) + rawBytes[i] & 0xff;
  23657. j++;
  23658. }
  23659. break;
  23660. case 4:
  23661. for (i = 0; i < pixBytes; ++i) {
  23662. up = prevRow[i];
  23663. c = rawBytes[i];
  23664. buffer[j++] = up + c;
  23665. }
  23666. for (; i < rowBytes; ++i) {
  23667. up = prevRow[i];
  23668. const upLeft = prevRow[i - pixBytes];
  23669. const left = buffer[j - pixBytes];
  23670. const p = left + up - upLeft;
  23671. let pa = p - left;
  23672. if (pa < 0) {
  23673. pa = -pa;
  23674. }
  23675. let pb = p - up;
  23676. if (pb < 0) {
  23677. pb = -pb;
  23678. }
  23679. let pc = p - upLeft;
  23680. if (pc < 0) {
  23681. pc = -pc;
  23682. }
  23683. c = rawBytes[i];
  23684. if (pa <= pb && pa <= pc) {
  23685. buffer[j++] = left + c;
  23686. } else if (pb <= pc) {
  23687. buffer[j++] = up + c;
  23688. } else {
  23689. buffer[j++] = upLeft + c;
  23690. }
  23691. }
  23692. break;
  23693. default:
  23694. throw new _util.FormatError(`Unsupported predictor: ${predictor}`);
  23695. }
  23696. this.bufferLength += rowBytes;
  23697. }
  23698. }
  23699. exports.PredictorStream = PredictorStream;
  23700. /***/ }),
  23701. /* 162 */
  23702. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  23703. "use strict";
  23704. Object.defineProperty(exports, "__esModule", ({
  23705. value: true
  23706. }));
  23707. exports.RunLengthStream = void 0;
  23708. var _decode_stream = __w_pdfjs_require__(148);
  23709. class RunLengthStream extends _decode_stream.DecodeStream {
  23710. constructor(str, maybeLength) {
  23711. super(maybeLength);
  23712. this.str = str;
  23713. this.dict = str.dict;
  23714. }
  23715. readBlock() {
  23716. const repeatHeader = this.str.getBytes(2);
  23717. if (!repeatHeader || repeatHeader.length < 2 || repeatHeader[0] === 128) {
  23718. this.eof = true;
  23719. return;
  23720. }
  23721. let buffer;
  23722. let bufferLength = this.bufferLength;
  23723. let n = repeatHeader[0];
  23724. if (n < 128) {
  23725. buffer = this.ensureBuffer(bufferLength + n + 1);
  23726. buffer[bufferLength++] = repeatHeader[1];
  23727. if (n > 0) {
  23728. const source = this.str.getBytes(n);
  23729. buffer.set(source, bufferLength);
  23730. bufferLength += n;
  23731. }
  23732. } else {
  23733. n = 257 - n;
  23734. const b = repeatHeader[1];
  23735. buffer = this.ensureBuffer(bufferLength + n + 1);
  23736. for (let i = 0; i < n; i++) {
  23737. buffer[bufferLength++] = b;
  23738. }
  23739. }
  23740. this.bufferLength = bufferLength;
  23741. }
  23742. }
  23743. exports.RunLengthStream = RunLengthStream;
  23744. /***/ }),
  23745. /* 163 */
  23746. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  23747. "use strict";
  23748. Object.defineProperty(exports, "__esModule", ({
  23749. value: true
  23750. }));
  23751. exports.Font = exports.ErrorFont = void 0;
  23752. var _util = __w_pdfjs_require__(2);
  23753. var _cff_parser = __w_pdfjs_require__(164);
  23754. var _fonts_utils = __w_pdfjs_require__(167);
  23755. var _unicode = __w_pdfjs_require__(169);
  23756. var _glyphlist = __w_pdfjs_require__(168);
  23757. var _encodings = __w_pdfjs_require__(166);
  23758. var _standard_fonts = __w_pdfjs_require__(170);
  23759. var _to_unicode_map = __w_pdfjs_require__(171);
  23760. var _cff_font = __w_pdfjs_require__(172);
  23761. var _font_renderer = __w_pdfjs_require__(173);
  23762. var _metrics = __w_pdfjs_require__(174);
  23763. var _glyf = __w_pdfjs_require__(175);
  23764. var _cmap = __w_pdfjs_require__(145);
  23765. var _opentype_file_builder = __w_pdfjs_require__(176);
  23766. var _core_utils = __w_pdfjs_require__(135);
  23767. var _stream = __w_pdfjs_require__(139);
  23768. var _type1_font = __w_pdfjs_require__(177);
  23769. const PRIVATE_USE_AREAS = [[0xe000, 0xf8ff], [0x100000, 0x10fffd]];
  23770. const PDF_GLYPH_SPACE_UNITS = 1000;
  23771. 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"];
  23772. const EXPORT_DATA_EXTRA_PROPERTIES = ["cMap", "defaultEncoding", "differences", "isMonospace", "isSerifFont", "isSymbolicFont", "seacMap", "toFontChar", "toUnicode", "vmetrics", "widths"];
  23773. function adjustWidths(properties) {
  23774. if (!properties.fontMatrix) {
  23775. return;
  23776. }
  23777. if (properties.fontMatrix[0] === _util.FONT_IDENTITY_MATRIX[0]) {
  23778. return;
  23779. }
  23780. const scale = 0.001 / properties.fontMatrix[0];
  23781. const glyphsWidths = properties.widths;
  23782. for (const glyph in glyphsWidths) {
  23783. glyphsWidths[glyph] *= scale;
  23784. }
  23785. properties.defaultWidth *= scale;
  23786. }
  23787. function adjustToUnicode(properties, builtInEncoding) {
  23788. if (properties.isInternalFont) {
  23789. return;
  23790. }
  23791. if (properties.hasIncludedToUnicodeMap) {
  23792. return;
  23793. }
  23794. if (builtInEncoding === properties.defaultEncoding) {
  23795. return;
  23796. }
  23797. if (properties.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
  23798. return;
  23799. }
  23800. const toUnicode = [],
  23801. glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  23802. for (const charCode in builtInEncoding) {
  23803. if (properties.hasEncoding) {
  23804. if (properties.differences.length === 0 || properties.differences[charCode] !== undefined) {
  23805. continue;
  23806. }
  23807. }
  23808. const glyphName = builtInEncoding[charCode];
  23809. const unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
  23810. if (unicode !== -1) {
  23811. toUnicode[charCode] = String.fromCharCode(unicode);
  23812. }
  23813. }
  23814. if (toUnicode.length > 0) {
  23815. properties.toUnicode.amend(toUnicode);
  23816. }
  23817. }
  23818. function amendFallbackToUnicode(properties) {
  23819. if (!properties.fallbackToUnicode) {
  23820. return;
  23821. }
  23822. if (properties.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
  23823. return;
  23824. }
  23825. const toUnicode = [];
  23826. for (const charCode in properties.fallbackToUnicode) {
  23827. if (properties.toUnicode.has(charCode)) {
  23828. continue;
  23829. }
  23830. toUnicode[charCode] = properties.fallbackToUnicode[charCode];
  23831. }
  23832. if (toUnicode.length > 0) {
  23833. properties.toUnicode.amend(toUnicode);
  23834. }
  23835. }
  23836. class Glyph {
  23837. constructor(originalCharCode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) {
  23838. this.originalCharCode = originalCharCode;
  23839. this.fontChar = fontChar;
  23840. this.unicode = unicode;
  23841. this.accent = accent;
  23842. this.width = width;
  23843. this.vmetric = vmetric;
  23844. this.operatorListId = operatorListId;
  23845. this.isSpace = isSpace;
  23846. this.isInFont = isInFont;
  23847. }
  23848. get category() {
  23849. return (0, _util.shadow)(this, "category", (0, _unicode.getCharUnicodeCategory)(this.unicode), true);
  23850. }
  23851. get normalizedUnicode() {
  23852. return (0, _util.shadow)(this, "normalizedUnicode", (0, _unicode.reverseIfRtl)(Glyph._NormalizedUnicodes[this.unicode] || this.unicode), true);
  23853. }
  23854. static get _NormalizedUnicodes() {
  23855. return (0, _util.shadow)(this, "_NormalizedUnicodes", (0, _unicode.getNormalizedUnicodes)());
  23856. }
  23857. }
  23858. function int16(b0, b1) {
  23859. return (b0 << 8) + b1;
  23860. }
  23861. function writeSignedInt16(bytes, index, value) {
  23862. bytes[index + 1] = value;
  23863. bytes[index] = value >>> 8;
  23864. }
  23865. function signedInt16(b0, b1) {
  23866. const value = (b0 << 8) + b1;
  23867. return value & 1 << 15 ? value - 0x10000 : value;
  23868. }
  23869. function int32(b0, b1, b2, b3) {
  23870. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  23871. }
  23872. function string16(value) {
  23873. return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
  23874. }
  23875. function safeString16(value) {
  23876. if (value > 0x7fff) {
  23877. value = 0x7fff;
  23878. } else if (value < -0x8000) {
  23879. value = -0x8000;
  23880. }
  23881. return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
  23882. }
  23883. function isTrueTypeFile(file) {
  23884. const header = file.peekBytes(4);
  23885. return (0, _core_utils.readUint32)(header, 0) === 0x00010000 || (0, _util.bytesToString)(header) === "true";
  23886. }
  23887. function isTrueTypeCollectionFile(file) {
  23888. const header = file.peekBytes(4);
  23889. return (0, _util.bytesToString)(header) === "ttcf";
  23890. }
  23891. function isOpenTypeFile(file) {
  23892. const header = file.peekBytes(4);
  23893. return (0, _util.bytesToString)(header) === "OTTO";
  23894. }
  23895. function isType1File(file) {
  23896. const header = file.peekBytes(2);
  23897. if (header[0] === 0x25 && header[1] === 0x21) {
  23898. return true;
  23899. }
  23900. if (header[0] === 0x80 && header[1] === 0x01) {
  23901. return true;
  23902. }
  23903. return false;
  23904. }
  23905. function isCFFFile(file) {
  23906. const header = file.peekBytes(4);
  23907. if (header[0] >= 1 && header[3] >= 1 && header[3] <= 4) {
  23908. return true;
  23909. }
  23910. return false;
  23911. }
  23912. function getFontFileType(file, _ref) {
  23913. let {
  23914. type,
  23915. subtype,
  23916. composite
  23917. } = _ref;
  23918. let fileType, fileSubtype;
  23919. if (isTrueTypeFile(file) || isTrueTypeCollectionFile(file)) {
  23920. if (composite) {
  23921. fileType = "CIDFontType2";
  23922. } else {
  23923. fileType = "TrueType";
  23924. }
  23925. } else if (isOpenTypeFile(file)) {
  23926. if (composite) {
  23927. fileType = "CIDFontType2";
  23928. } else {
  23929. fileType = "OpenType";
  23930. }
  23931. } else if (isType1File(file)) {
  23932. if (composite) {
  23933. fileType = "CIDFontType0";
  23934. } else {
  23935. fileType = type === "MMType1" ? "MMType1" : "Type1";
  23936. }
  23937. } else if (isCFFFile(file)) {
  23938. if (composite) {
  23939. fileType = "CIDFontType0";
  23940. fileSubtype = "CIDFontType0C";
  23941. } else {
  23942. fileType = type === "MMType1" ? "MMType1" : "Type1";
  23943. fileSubtype = "Type1C";
  23944. }
  23945. } else {
  23946. (0, _util.warn)("getFontFileType: Unable to detect correct font file Type/Subtype.");
  23947. fileType = type;
  23948. fileSubtype = subtype;
  23949. }
  23950. return [fileType, fileSubtype];
  23951. }
  23952. function applyStandardFontGlyphMap(map, glyphMap) {
  23953. for (const charCode in glyphMap) {
  23954. map[+charCode] = glyphMap[charCode];
  23955. }
  23956. }
  23957. function buildToFontChar(encoding, glyphsUnicodeMap, differences) {
  23958. const toFontChar = [];
  23959. let unicode;
  23960. for (let i = 0, ii = encoding.length; i < ii; i++) {
  23961. unicode = (0, _unicode.getUnicodeForGlyph)(encoding[i], glyphsUnicodeMap);
  23962. if (unicode !== -1) {
  23963. toFontChar[i] = unicode;
  23964. }
  23965. }
  23966. for (const charCode in differences) {
  23967. unicode = (0, _unicode.getUnicodeForGlyph)(differences[charCode], glyphsUnicodeMap);
  23968. if (unicode !== -1) {
  23969. toFontChar[+charCode] = unicode;
  23970. }
  23971. }
  23972. return toFontChar;
  23973. }
  23974. function convertCidString(charCode, cid) {
  23975. let shouldThrow = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  23976. switch (cid.length) {
  23977. case 1:
  23978. return cid.charCodeAt(0);
  23979. case 2:
  23980. return cid.charCodeAt(0) << 8 | cid.charCodeAt(1);
  23981. }
  23982. const msg = `Unsupported CID string (charCode ${charCode}): "${cid}".`;
  23983. if (shouldThrow) {
  23984. throw new _util.FormatError(msg);
  23985. }
  23986. (0, _util.warn)(msg);
  23987. return cid;
  23988. }
  23989. function adjustMapping(charCodeToGlyphId, hasGlyph, newGlyphZeroId, toUnicode) {
  23990. const newMap = Object.create(null);
  23991. const toUnicodeExtraMap = new Map();
  23992. const toFontChar = [];
  23993. const usedGlyphIds = new Set();
  23994. let privateUseAreaIndex = 0;
  23995. const privateUseOffetStart = PRIVATE_USE_AREAS[privateUseAreaIndex][0];
  23996. let nextAvailableFontCharCode = privateUseOffetStart;
  23997. let privateUseOffetEnd = PRIVATE_USE_AREAS[privateUseAreaIndex][1];
  23998. for (let originalCharCode in charCodeToGlyphId) {
  23999. originalCharCode |= 0;
  24000. let glyphId = charCodeToGlyphId[originalCharCode];
  24001. if (!hasGlyph(glyphId)) {
  24002. continue;
  24003. }
  24004. if (nextAvailableFontCharCode > privateUseOffetEnd) {
  24005. privateUseAreaIndex++;
  24006. if (privateUseAreaIndex >= PRIVATE_USE_AREAS.length) {
  24007. (0, _util.warn)("Ran out of space in font private use area.");
  24008. break;
  24009. }
  24010. nextAvailableFontCharCode = PRIVATE_USE_AREAS[privateUseAreaIndex][0];
  24011. privateUseOffetEnd = PRIVATE_USE_AREAS[privateUseAreaIndex][1];
  24012. }
  24013. const fontCharCode = nextAvailableFontCharCode++;
  24014. if (glyphId === 0) {
  24015. glyphId = newGlyphZeroId;
  24016. }
  24017. let unicode = toUnicode.get(originalCharCode);
  24018. if (typeof unicode === "string") {
  24019. unicode = unicode.codePointAt(0);
  24020. }
  24021. if (unicode && unicode < privateUseOffetStart && !usedGlyphIds.has(glyphId)) {
  24022. toUnicodeExtraMap.set(unicode, glyphId);
  24023. usedGlyphIds.add(glyphId);
  24024. }
  24025. newMap[fontCharCode] = glyphId;
  24026. toFontChar[originalCharCode] = fontCharCode;
  24027. }
  24028. return {
  24029. toFontChar,
  24030. charCodeToGlyphId: newMap,
  24031. toUnicodeExtraMap,
  24032. nextAvailableFontCharCode
  24033. };
  24034. }
  24035. function getRanges(glyphs, toUnicodeExtraMap, numGlyphs) {
  24036. const codes = [];
  24037. for (const charCode in glyphs) {
  24038. if (glyphs[charCode] >= numGlyphs) {
  24039. continue;
  24040. }
  24041. codes.push({
  24042. fontCharCode: charCode | 0,
  24043. glyphId: glyphs[charCode]
  24044. });
  24045. }
  24046. if (toUnicodeExtraMap) {
  24047. for (const [unicode, glyphId] of toUnicodeExtraMap) {
  24048. if (glyphId >= numGlyphs) {
  24049. continue;
  24050. }
  24051. codes.push({
  24052. fontCharCode: unicode,
  24053. glyphId
  24054. });
  24055. }
  24056. }
  24057. if (codes.length === 0) {
  24058. codes.push({
  24059. fontCharCode: 0,
  24060. glyphId: 0
  24061. });
  24062. }
  24063. codes.sort(function fontGetRangesSort(a, b) {
  24064. return a.fontCharCode - b.fontCharCode;
  24065. });
  24066. const ranges = [];
  24067. const length = codes.length;
  24068. for (let n = 0; n < length;) {
  24069. const start = codes[n].fontCharCode;
  24070. const codeIndices = [codes[n].glyphId];
  24071. ++n;
  24072. let end = start;
  24073. while (n < length && end + 1 === codes[n].fontCharCode) {
  24074. codeIndices.push(codes[n].glyphId);
  24075. ++end;
  24076. ++n;
  24077. if (end === 0xffff) {
  24078. break;
  24079. }
  24080. }
  24081. ranges.push([start, end, codeIndices]);
  24082. }
  24083. return ranges;
  24084. }
  24085. function createCmapTable(glyphs, toUnicodeExtraMap, numGlyphs) {
  24086. const ranges = getRanges(glyphs, toUnicodeExtraMap, numGlyphs);
  24087. const numTables = ranges.at(-1)[1] > 0xffff ? 2 : 1;
  24088. let cmap = "\x00\x00" + string16(numTables) + "\x00\x03" + "\x00\x01" + (0, _util.string32)(4 + numTables * 8);
  24089. let i, ii, j, jj;
  24090. for (i = ranges.length - 1; i >= 0; --i) {
  24091. if (ranges[i][0] <= 0xffff) {
  24092. break;
  24093. }
  24094. }
  24095. const bmpLength = i + 1;
  24096. if (ranges[i][0] < 0xffff && ranges[i][1] === 0xffff) {
  24097. ranges[i][1] = 0xfffe;
  24098. }
  24099. const trailingRangesCount = ranges[i][1] < 0xffff ? 1 : 0;
  24100. const segCount = bmpLength + trailingRangesCount;
  24101. const searchParams = _opentype_file_builder.OpenTypeFileBuilder.getSearchParams(segCount, 2);
  24102. let startCount = "";
  24103. let endCount = "";
  24104. let idDeltas = "";
  24105. let idRangeOffsets = "";
  24106. let glyphsIds = "";
  24107. let bias = 0;
  24108. let range, start, end, codes;
  24109. for (i = 0, ii = bmpLength; i < ii; i++) {
  24110. range = ranges[i];
  24111. start = range[0];
  24112. end = range[1];
  24113. startCount += string16(start);
  24114. endCount += string16(end);
  24115. codes = range[2];
  24116. let contiguous = true;
  24117. for (j = 1, jj = codes.length; j < jj; ++j) {
  24118. if (codes[j] !== codes[j - 1] + 1) {
  24119. contiguous = false;
  24120. break;
  24121. }
  24122. }
  24123. if (!contiguous) {
  24124. const offset = (segCount - i) * 2 + bias * 2;
  24125. bias += end - start + 1;
  24126. idDeltas += string16(0);
  24127. idRangeOffsets += string16(offset);
  24128. for (j = 0, jj = codes.length; j < jj; ++j) {
  24129. glyphsIds += string16(codes[j]);
  24130. }
  24131. } else {
  24132. const startCode = codes[0];
  24133. idDeltas += string16(startCode - start & 0xffff);
  24134. idRangeOffsets += string16(0);
  24135. }
  24136. }
  24137. if (trailingRangesCount > 0) {
  24138. endCount += "\xFF\xFF";
  24139. startCount += "\xFF\xFF";
  24140. idDeltas += "\x00\x01";
  24141. idRangeOffsets += "\x00\x00";
  24142. }
  24143. const format314 = "\x00\x00" + string16(2 * segCount) + string16(searchParams.range) + string16(searchParams.entry) + string16(searchParams.rangeShift) + endCount + "\x00\x00" + startCount + idDeltas + idRangeOffsets + glyphsIds;
  24144. let format31012 = "";
  24145. let header31012 = "";
  24146. if (numTables > 1) {
  24147. cmap += "\x00\x03" + "\x00\x0A" + (0, _util.string32)(4 + numTables * 8 + 4 + format314.length);
  24148. format31012 = "";
  24149. for (i = 0, ii = ranges.length; i < ii; i++) {
  24150. range = ranges[i];
  24151. start = range[0];
  24152. codes = range[2];
  24153. let code = codes[0];
  24154. for (j = 1, jj = codes.length; j < jj; ++j) {
  24155. if (codes[j] !== codes[j - 1] + 1) {
  24156. end = range[0] + j - 1;
  24157. format31012 += (0, _util.string32)(start) + (0, _util.string32)(end) + (0, _util.string32)(code);
  24158. start = end + 1;
  24159. code = codes[j];
  24160. }
  24161. }
  24162. format31012 += (0, _util.string32)(start) + (0, _util.string32)(range[1]) + (0, _util.string32)(code);
  24163. }
  24164. header31012 = "\x00\x0C" + "\x00\x00" + (0, _util.string32)(format31012.length + 16) + "\x00\x00\x00\x00" + (0, _util.string32)(format31012.length / 12);
  24165. }
  24166. return cmap + "\x00\x04" + string16(format314.length + 4) + format314 + header31012 + format31012;
  24167. }
  24168. function validateOS2Table(os2, file) {
  24169. file.pos = (file.start || 0) + os2.offset;
  24170. const version = file.getUint16();
  24171. file.skip(60);
  24172. const selection = file.getUint16();
  24173. if (version < 4 && selection & 0x0300) {
  24174. return false;
  24175. }
  24176. const firstChar = file.getUint16();
  24177. const lastChar = file.getUint16();
  24178. if (firstChar > lastChar) {
  24179. return false;
  24180. }
  24181. file.skip(6);
  24182. const usWinAscent = file.getUint16();
  24183. if (usWinAscent === 0) {
  24184. return false;
  24185. }
  24186. os2.data[8] = os2.data[9] = 0;
  24187. return true;
  24188. }
  24189. function createOS2Table(properties, charstrings, override) {
  24190. override = override || {
  24191. unitsPerEm: 0,
  24192. yMax: 0,
  24193. yMin: 0,
  24194. ascent: 0,
  24195. descent: 0
  24196. };
  24197. let ulUnicodeRange1 = 0;
  24198. let ulUnicodeRange2 = 0;
  24199. let ulUnicodeRange3 = 0;
  24200. let ulUnicodeRange4 = 0;
  24201. let firstCharIndex = null;
  24202. let lastCharIndex = 0;
  24203. if (charstrings) {
  24204. for (let code in charstrings) {
  24205. code |= 0;
  24206. if (firstCharIndex > code || !firstCharIndex) {
  24207. firstCharIndex = code;
  24208. }
  24209. if (lastCharIndex < code) {
  24210. lastCharIndex = code;
  24211. }
  24212. const position = (0, _unicode.getUnicodeRangeFor)(code);
  24213. if (position < 32) {
  24214. ulUnicodeRange1 |= 1 << position;
  24215. } else if (position < 64) {
  24216. ulUnicodeRange2 |= 1 << position - 32;
  24217. } else if (position < 96) {
  24218. ulUnicodeRange3 |= 1 << position - 64;
  24219. } else if (position < 123) {
  24220. ulUnicodeRange4 |= 1 << position - 96;
  24221. } else {
  24222. throw new _util.FormatError("Unicode ranges Bits > 123 are reserved for internal usage");
  24223. }
  24224. }
  24225. if (lastCharIndex > 0xffff) {
  24226. lastCharIndex = 0xffff;
  24227. }
  24228. } else {
  24229. firstCharIndex = 0;
  24230. lastCharIndex = 255;
  24231. }
  24232. const bbox = properties.bbox || [0, 0, 0, 0];
  24233. const unitsPerEm = override.unitsPerEm || 1 / (properties.fontMatrix || _util.FONT_IDENTITY_MATRIX)[0];
  24234. const scale = properties.ascentScaled ? 1.0 : unitsPerEm / PDF_GLYPH_SPACE_UNITS;
  24235. const typoAscent = override.ascent || Math.round(scale * (properties.ascent || bbox[3]));
  24236. let typoDescent = override.descent || Math.round(scale * (properties.descent || bbox[1]));
  24237. if (typoDescent > 0 && properties.descent > 0 && bbox[1] < 0) {
  24238. typoDescent = -typoDescent;
  24239. }
  24240. const winAscent = override.yMax || typoAscent;
  24241. const winDescent = -override.yMin || -typoDescent;
  24242. 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";
  24243. }
  24244. function createPostTable(properties) {
  24245. const angle = Math.floor(properties.italicAngle * 2 ** 16);
  24246. 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";
  24247. }
  24248. function createPostscriptName(name) {
  24249. return name.replace(/[^\x21-\x7E]|[[\](){}<>/%]/g, "").slice(0, 63);
  24250. }
  24251. function createNameTable(name, proto) {
  24252. if (!proto) {
  24253. proto = [[], []];
  24254. }
  24255. 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"];
  24256. const stringsUnicode = [];
  24257. let i, ii, j, jj, str;
  24258. for (i = 0, ii = strings.length; i < ii; i++) {
  24259. str = proto[1][i] || strings[i];
  24260. const strBufUnicode = [];
  24261. for (j = 0, jj = str.length; j < jj; j++) {
  24262. strBufUnicode.push(string16(str.charCodeAt(j)));
  24263. }
  24264. stringsUnicode.push(strBufUnicode.join(""));
  24265. }
  24266. const names = [strings, stringsUnicode];
  24267. const platforms = ["\x00\x01", "\x00\x03"];
  24268. const encodings = ["\x00\x00", "\x00\x01"];
  24269. const languages = ["\x00\x00", "\x04\x09"];
  24270. const namesRecordCount = strings.length * platforms.length;
  24271. let nameTable = "\x00\x00" + string16(namesRecordCount) + string16(namesRecordCount * 12 + 6);
  24272. let strOffset = 0;
  24273. for (i = 0, ii = platforms.length; i < ii; i++) {
  24274. const strs = names[i];
  24275. for (j = 0, jj = strs.length; j < jj; j++) {
  24276. str = strs[j];
  24277. const nameRecord = platforms[i] + encodings[i] + languages[i] + string16(j) + string16(str.length) + string16(strOffset);
  24278. nameTable += nameRecord;
  24279. strOffset += str.length;
  24280. }
  24281. }
  24282. nameTable += strings.join("") + stringsUnicode.join("");
  24283. return nameTable;
  24284. }
  24285. class Font {
  24286. constructor(name, file, properties) {
  24287. this.name = name;
  24288. this.psName = null;
  24289. this.mimetype = null;
  24290. this.disableFontFace = false;
  24291. this.loadedName = properties.loadedName;
  24292. this.isType3Font = properties.isType3Font;
  24293. this.missingFile = false;
  24294. this.cssFontInfo = properties.cssFontInfo;
  24295. this._charsCache = Object.create(null);
  24296. this._glyphCache = Object.create(null);
  24297. let isSerifFont = !!(properties.flags & _fonts_utils.FontFlags.Serif);
  24298. if (!isSerifFont && !properties.isSimulatedFlags) {
  24299. const baseName = name.replace(/[,_]/g, "-").split("-")[0],
  24300. serifFonts = (0, _standard_fonts.getSerifFonts)();
  24301. for (const namePart of baseName.split("+")) {
  24302. if (serifFonts[namePart]) {
  24303. isSerifFont = true;
  24304. break;
  24305. }
  24306. }
  24307. }
  24308. this.isSerifFont = isSerifFont;
  24309. this.isSymbolicFont = !!(properties.flags & _fonts_utils.FontFlags.Symbolic);
  24310. this.isMonospace = !!(properties.flags & _fonts_utils.FontFlags.FixedPitch);
  24311. let type = properties.type;
  24312. let subtype = properties.subtype;
  24313. this.type = type;
  24314. this.subtype = subtype;
  24315. const matches = name.match(/^InvalidPDFjsFont_(.*)_\d+$/);
  24316. this.isInvalidPDFjsFont = !!matches;
  24317. if (this.isInvalidPDFjsFont) {
  24318. this.fallbackName = matches[1];
  24319. } else if (this.isMonospace) {
  24320. this.fallbackName = "monospace";
  24321. } else if (this.isSerifFont) {
  24322. this.fallbackName = "serif";
  24323. } else {
  24324. this.fallbackName = "sans-serif";
  24325. }
  24326. this.differences = properties.differences;
  24327. this.widths = properties.widths;
  24328. this.defaultWidth = properties.defaultWidth;
  24329. this.composite = properties.composite;
  24330. this.cMap = properties.cMap;
  24331. this.capHeight = properties.capHeight / PDF_GLYPH_SPACE_UNITS;
  24332. this.ascent = properties.ascent / PDF_GLYPH_SPACE_UNITS;
  24333. this.descent = properties.descent / PDF_GLYPH_SPACE_UNITS;
  24334. this.lineHeight = this.ascent - this.descent;
  24335. this.fontMatrix = properties.fontMatrix;
  24336. this.bbox = properties.bbox;
  24337. this.defaultEncoding = properties.defaultEncoding;
  24338. this.toUnicode = properties.toUnicode;
  24339. this.toFontChar = [];
  24340. if (properties.type === "Type3") {
  24341. for (let charCode = 0; charCode < 256; charCode++) {
  24342. this.toFontChar[charCode] = this.differences[charCode] || properties.defaultEncoding[charCode];
  24343. }
  24344. this.fontType = _util.FontType.TYPE3;
  24345. return;
  24346. }
  24347. this.cidEncoding = properties.cidEncoding || "";
  24348. this.vertical = !!properties.vertical;
  24349. if (this.vertical) {
  24350. this.vmetrics = properties.vmetrics;
  24351. this.defaultVMetrics = properties.defaultVMetrics;
  24352. }
  24353. if (!file || file.isEmpty) {
  24354. if (file) {
  24355. (0, _util.warn)('Font file is empty in "' + name + '" (' + this.loadedName + ")");
  24356. }
  24357. this.fallbackToSystemFont(properties);
  24358. return;
  24359. }
  24360. [type, subtype] = getFontFileType(file, properties);
  24361. if (type !== this.type || subtype !== this.subtype) {
  24362. (0, _util.info)("Inconsistent font file Type/SubType, expected: " + `${this.type}/${this.subtype} but found: ${type}/${subtype}.`);
  24363. }
  24364. let data;
  24365. try {
  24366. switch (type) {
  24367. case "MMType1":
  24368. (0, _util.info)("MMType1 font (" + name + "), falling back to Type1.");
  24369. case "Type1":
  24370. case "CIDFontType0":
  24371. this.mimetype = "font/opentype";
  24372. const cff = subtype === "Type1C" || subtype === "CIDFontType0C" ? new _cff_font.CFFFont(file, properties) : new _type1_font.Type1Font(name, file, properties);
  24373. adjustWidths(properties);
  24374. data = this.convert(name, cff, properties);
  24375. break;
  24376. case "OpenType":
  24377. case "TrueType":
  24378. case "CIDFontType2":
  24379. this.mimetype = "font/opentype";
  24380. data = this.checkAndRepair(name, file, properties);
  24381. if (this.isOpenType) {
  24382. adjustWidths(properties);
  24383. type = "OpenType";
  24384. }
  24385. break;
  24386. default:
  24387. throw new _util.FormatError(`Font ${type} is not supported`);
  24388. }
  24389. } catch (e) {
  24390. (0, _util.warn)(e);
  24391. this.fallbackToSystemFont(properties);
  24392. return;
  24393. }
  24394. amendFallbackToUnicode(properties);
  24395. this.data = data;
  24396. this.fontType = (0, _fonts_utils.getFontType)(type, subtype, properties.isStandardFont);
  24397. this.fontMatrix = properties.fontMatrix;
  24398. this.widths = properties.widths;
  24399. this.defaultWidth = properties.defaultWidth;
  24400. this.toUnicode = properties.toUnicode;
  24401. this.seacMap = properties.seacMap;
  24402. }
  24403. get renderer() {
  24404. const renderer = _font_renderer.FontRendererFactory.create(this, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  24405. return (0, _util.shadow)(this, "renderer", renderer);
  24406. }
  24407. exportData() {
  24408. let extraProperties = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  24409. const exportDataProperties = extraProperties ? [...EXPORT_DATA_PROPERTIES, ...EXPORT_DATA_EXTRA_PROPERTIES] : EXPORT_DATA_PROPERTIES;
  24410. const data = Object.create(null);
  24411. let property, value;
  24412. for (property of exportDataProperties) {
  24413. value = this[property];
  24414. if (value !== undefined) {
  24415. data[property] = value;
  24416. }
  24417. }
  24418. return data;
  24419. }
  24420. fallbackToSystemFont(properties) {
  24421. this.missingFile = true;
  24422. const name = this.name;
  24423. const type = this.type;
  24424. const subtype = this.subtype;
  24425. let fontName = (0, _fonts_utils.normalizeFontName)(name);
  24426. const stdFontMap = (0, _standard_fonts.getStdFontMap)(),
  24427. nonStdFontMap = (0, _standard_fonts.getNonStdFontMap)();
  24428. const isStandardFont = !!stdFontMap[fontName];
  24429. const isMappedToStandardFont = !!(nonStdFontMap[fontName] && stdFontMap[nonStdFontMap[fontName]]);
  24430. fontName = stdFontMap[fontName] || nonStdFontMap[fontName] || fontName;
  24431. const fontBasicMetricsMap = (0, _metrics.getFontBasicMetrics)();
  24432. const metrics = fontBasicMetricsMap[fontName];
  24433. if (metrics) {
  24434. if (isNaN(this.ascent)) {
  24435. this.ascent = metrics.ascent / PDF_GLYPH_SPACE_UNITS;
  24436. }
  24437. if (isNaN(this.descent)) {
  24438. this.descent = metrics.descent / PDF_GLYPH_SPACE_UNITS;
  24439. }
  24440. if (isNaN(this.capHeight)) {
  24441. this.capHeight = metrics.capHeight / PDF_GLYPH_SPACE_UNITS;
  24442. }
  24443. }
  24444. this.bold = /bold/gi.test(fontName);
  24445. this.italic = /oblique|italic/gi.test(fontName);
  24446. this.black = /Black/g.test(name);
  24447. const isNarrow = /Narrow/g.test(name);
  24448. this.remeasure = (!isStandardFont || isNarrow) && Object.keys(this.widths).length > 0;
  24449. if ((isStandardFont || isMappedToStandardFont) && type === "CIDFontType2" && this.cidEncoding.startsWith("Identity-")) {
  24450. const cidToGidMap = properties.cidToGidMap;
  24451. const map = [];
  24452. applyStandardFontGlyphMap(map, (0, _standard_fonts.getGlyphMapForStandardFonts)());
  24453. if (/Arial-?Black/i.test(name)) {
  24454. applyStandardFontGlyphMap(map, (0, _standard_fonts.getSupplementalGlyphMapForArialBlack)());
  24455. } else if (/Calibri/i.test(name)) {
  24456. applyStandardFontGlyphMap(map, (0, _standard_fonts.getSupplementalGlyphMapForCalibri)());
  24457. }
  24458. if (cidToGidMap) {
  24459. for (const charCode in map) {
  24460. const cid = map[charCode];
  24461. if (cidToGidMap[cid] !== undefined) {
  24462. map[+charCode] = cidToGidMap[cid];
  24463. }
  24464. }
  24465. if (cidToGidMap.length !== this.toUnicode.length && properties.hasIncludedToUnicodeMap && this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
  24466. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  24467. const cid = map[charCode];
  24468. if (cidToGidMap[cid] === undefined) {
  24469. map[+charCode] = unicodeCharCode;
  24470. }
  24471. });
  24472. }
  24473. }
  24474. if (!(this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap)) {
  24475. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  24476. map[+charCode] = unicodeCharCode;
  24477. });
  24478. }
  24479. this.toFontChar = map;
  24480. this.toUnicode = new _to_unicode_map.ToUnicodeMap(map);
  24481. } else if (/Symbol/i.test(fontName)) {
  24482. this.toFontChar = buildToFontChar(_encodings.SymbolSetEncoding, (0, _glyphlist.getGlyphsUnicode)(), this.differences);
  24483. } else if (/Dingbats/i.test(fontName)) {
  24484. if (/Wingdings/i.test(name)) {
  24485. (0, _util.warn)("Non-embedded Wingdings font, falling back to ZapfDingbats.");
  24486. }
  24487. this.toFontChar = buildToFontChar(_encodings.ZapfDingbatsEncoding, (0, _glyphlist.getDingbatsGlyphsUnicode)(), this.differences);
  24488. } else if (isStandardFont) {
  24489. const map = buildToFontChar(this.defaultEncoding, (0, _glyphlist.getGlyphsUnicode)(), this.differences);
  24490. if (type === "CIDFontType2" && !this.cidEncoding.startsWith("Identity-") && !(this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap)) {
  24491. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  24492. map[+charCode] = unicodeCharCode;
  24493. });
  24494. }
  24495. this.toFontChar = map;
  24496. } else {
  24497. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  24498. const map = [];
  24499. this.toUnicode.forEach((charCode, unicodeCharCode) => {
  24500. if (!this.composite) {
  24501. const glyphName = this.differences[charCode] || this.defaultEncoding[charCode];
  24502. const unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
  24503. if (unicode !== -1) {
  24504. unicodeCharCode = unicode;
  24505. }
  24506. }
  24507. map[+charCode] = unicodeCharCode;
  24508. });
  24509. if (this.composite && this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
  24510. if (/Tahoma|Verdana/i.test(name)) {
  24511. applyStandardFontGlyphMap(map, (0, _standard_fonts.getGlyphMapForStandardFonts)());
  24512. }
  24513. }
  24514. this.toFontChar = map;
  24515. }
  24516. amendFallbackToUnicode(properties);
  24517. this.loadedName = fontName.split("-")[0];
  24518. this.fontType = (0, _fonts_utils.getFontType)(type, subtype, properties.isStandardFont);
  24519. }
  24520. checkAndRepair(name, font, properties) {
  24521. const VALID_TABLES = ["OS/2", "cmap", "head", "hhea", "hmtx", "maxp", "name", "post", "loca", "glyf", "fpgm", "prep", "cvt ", "CFF "];
  24522. function readTables(file, numTables) {
  24523. const tables = Object.create(null);
  24524. tables["OS/2"] = null;
  24525. tables.cmap = null;
  24526. tables.head = null;
  24527. tables.hhea = null;
  24528. tables.hmtx = null;
  24529. tables.maxp = null;
  24530. tables.name = null;
  24531. tables.post = null;
  24532. for (let i = 0; i < numTables; i++) {
  24533. const table = readTableEntry(file);
  24534. if (!VALID_TABLES.includes(table.tag)) {
  24535. continue;
  24536. }
  24537. if (table.length === 0) {
  24538. continue;
  24539. }
  24540. tables[table.tag] = table;
  24541. }
  24542. return tables;
  24543. }
  24544. function readTableEntry(file) {
  24545. const tag = file.getString(4);
  24546. const checksum = file.getInt32() >>> 0;
  24547. const offset = file.getInt32() >>> 0;
  24548. const length = file.getInt32() >>> 0;
  24549. const previousPosition = file.pos;
  24550. file.pos = file.start || 0;
  24551. file.skip(offset);
  24552. const data = file.getBytes(length);
  24553. file.pos = previousPosition;
  24554. if (tag === "head") {
  24555. data[8] = data[9] = data[10] = data[11] = 0;
  24556. data[17] |= 0x20;
  24557. }
  24558. return {
  24559. tag,
  24560. checksum,
  24561. length,
  24562. offset,
  24563. data
  24564. };
  24565. }
  24566. function readOpenTypeHeader(ttf) {
  24567. return {
  24568. version: ttf.getString(4),
  24569. numTables: ttf.getUint16(),
  24570. searchRange: ttf.getUint16(),
  24571. entrySelector: ttf.getUint16(),
  24572. rangeShift: ttf.getUint16()
  24573. };
  24574. }
  24575. function readTrueTypeCollectionHeader(ttc) {
  24576. const ttcTag = ttc.getString(4);
  24577. (0, _util.assert)(ttcTag === "ttcf", "Must be a TrueType Collection font.");
  24578. const majorVersion = ttc.getUint16();
  24579. const minorVersion = ttc.getUint16();
  24580. const numFonts = ttc.getInt32() >>> 0;
  24581. const offsetTable = [];
  24582. for (let i = 0; i < numFonts; i++) {
  24583. offsetTable.push(ttc.getInt32() >>> 0);
  24584. }
  24585. const header = {
  24586. ttcTag,
  24587. majorVersion,
  24588. minorVersion,
  24589. numFonts,
  24590. offsetTable
  24591. };
  24592. switch (majorVersion) {
  24593. case 1:
  24594. return header;
  24595. case 2:
  24596. header.dsigTag = ttc.getInt32() >>> 0;
  24597. header.dsigLength = ttc.getInt32() >>> 0;
  24598. header.dsigOffset = ttc.getInt32() >>> 0;
  24599. return header;
  24600. }
  24601. throw new _util.FormatError(`Invalid TrueType Collection majorVersion: ${majorVersion}.`);
  24602. }
  24603. function readTrueTypeCollectionData(ttc, fontName) {
  24604. const {
  24605. numFonts,
  24606. offsetTable
  24607. } = readTrueTypeCollectionHeader(ttc);
  24608. const fontNameParts = fontName.split("+");
  24609. let fallbackData;
  24610. for (let i = 0; i < numFonts; i++) {
  24611. ttc.pos = (ttc.start || 0) + offsetTable[i];
  24612. const potentialHeader = readOpenTypeHeader(ttc);
  24613. const potentialTables = readTables(ttc, potentialHeader.numTables);
  24614. if (!potentialTables.name) {
  24615. throw new _util.FormatError('TrueType Collection font must contain a "name" table.');
  24616. }
  24617. const nameTable = readNameTable(potentialTables.name);
  24618. for (let j = 0, jj = nameTable.length; j < jj; j++) {
  24619. for (let k = 0, kk = nameTable[j].length; k < kk; k++) {
  24620. const nameEntry = nameTable[j][k] && nameTable[j][k].replace(/\s/g, "");
  24621. if (!nameEntry) {
  24622. continue;
  24623. }
  24624. if (nameEntry === fontName) {
  24625. return {
  24626. header: potentialHeader,
  24627. tables: potentialTables
  24628. };
  24629. }
  24630. if (fontNameParts.length < 2) {
  24631. continue;
  24632. }
  24633. for (const part of fontNameParts) {
  24634. if (nameEntry === part) {
  24635. fallbackData = {
  24636. name: part,
  24637. header: potentialHeader,
  24638. tables: potentialTables
  24639. };
  24640. }
  24641. }
  24642. }
  24643. }
  24644. }
  24645. if (fallbackData) {
  24646. (0, _util.warn)(`TrueType Collection does not contain "${fontName}" font, ` + `falling back to "${fallbackData.name}" font instead.`);
  24647. return {
  24648. header: fallbackData.header,
  24649. tables: fallbackData.tables
  24650. };
  24651. }
  24652. throw new _util.FormatError(`TrueType Collection does not contain "${fontName}" font.`);
  24653. }
  24654. function readCmapTable(cmap, file, isSymbolicFont, hasEncoding) {
  24655. if (!cmap) {
  24656. (0, _util.warn)("No cmap table available.");
  24657. return {
  24658. platformId: -1,
  24659. encodingId: -1,
  24660. mappings: [],
  24661. hasShortCmap: false
  24662. };
  24663. }
  24664. let segment;
  24665. let start = (file.start || 0) + cmap.offset;
  24666. file.pos = start;
  24667. file.skip(2);
  24668. const numTables = file.getUint16();
  24669. let potentialTable;
  24670. let canBreak = false;
  24671. for (let i = 0; i < numTables; i++) {
  24672. const platformId = file.getUint16();
  24673. const encodingId = file.getUint16();
  24674. const offset = file.getInt32() >>> 0;
  24675. let useTable = false;
  24676. if (potentialTable && potentialTable.platformId === platformId && potentialTable.encodingId === encodingId) {
  24677. continue;
  24678. }
  24679. if (platformId === 0 && (encodingId === 0 || encodingId === 1 || encodingId === 3)) {
  24680. useTable = true;
  24681. } else if (platformId === 1 && encodingId === 0) {
  24682. useTable = true;
  24683. } else if (platformId === 3 && encodingId === 1 && (hasEncoding || !potentialTable)) {
  24684. useTable = true;
  24685. if (!isSymbolicFont) {
  24686. canBreak = true;
  24687. }
  24688. } else if (isSymbolicFont && platformId === 3 && encodingId === 0) {
  24689. useTable = true;
  24690. let correctlySorted = true;
  24691. if (i < numTables - 1) {
  24692. const nextBytes = file.peekBytes(2),
  24693. nextPlatformId = int16(nextBytes[0], nextBytes[1]);
  24694. if (nextPlatformId < platformId) {
  24695. correctlySorted = false;
  24696. }
  24697. }
  24698. if (correctlySorted) {
  24699. canBreak = true;
  24700. }
  24701. }
  24702. if (useTable) {
  24703. potentialTable = {
  24704. platformId,
  24705. encodingId,
  24706. offset
  24707. };
  24708. }
  24709. if (canBreak) {
  24710. break;
  24711. }
  24712. }
  24713. if (potentialTable) {
  24714. file.pos = start + potentialTable.offset;
  24715. }
  24716. if (!potentialTable || file.peekByte() === -1) {
  24717. (0, _util.warn)("Could not find a preferred cmap table.");
  24718. return {
  24719. platformId: -1,
  24720. encodingId: -1,
  24721. mappings: [],
  24722. hasShortCmap: false
  24723. };
  24724. }
  24725. const format = file.getUint16();
  24726. let hasShortCmap = false;
  24727. const mappings = [];
  24728. let j, glyphId;
  24729. if (format === 0) {
  24730. file.skip(2 + 2);
  24731. for (j = 0; j < 256; j++) {
  24732. const index = file.getByte();
  24733. if (!index) {
  24734. continue;
  24735. }
  24736. mappings.push({
  24737. charCode: j,
  24738. glyphId: index
  24739. });
  24740. }
  24741. hasShortCmap = true;
  24742. } else if (format === 2) {
  24743. file.skip(2 + 2);
  24744. const subHeaderKeys = [];
  24745. let maxSubHeaderKey = 0;
  24746. for (let i = 0; i < 256; i++) {
  24747. const subHeaderKey = file.getUint16() >> 3;
  24748. subHeaderKeys.push(subHeaderKey);
  24749. maxSubHeaderKey = Math.max(subHeaderKey, maxSubHeaderKey);
  24750. }
  24751. const subHeaders = [];
  24752. for (let i = 0; i <= maxSubHeaderKey; i++) {
  24753. subHeaders.push({
  24754. firstCode: file.getUint16(),
  24755. entryCount: file.getUint16(),
  24756. idDelta: signedInt16(file.getByte(), file.getByte()),
  24757. idRangePos: file.pos + file.getUint16()
  24758. });
  24759. }
  24760. for (let i = 0; i < 256; i++) {
  24761. if (subHeaderKeys[i] === 0) {
  24762. file.pos = subHeaders[0].idRangePos + 2 * i;
  24763. glyphId = file.getUint16();
  24764. mappings.push({
  24765. charCode: i,
  24766. glyphId
  24767. });
  24768. } else {
  24769. const s = subHeaders[subHeaderKeys[i]];
  24770. for (j = 0; j < s.entryCount; j++) {
  24771. const charCode = (i << 8) + j + s.firstCode;
  24772. file.pos = s.idRangePos + 2 * j;
  24773. glyphId = file.getUint16();
  24774. if (glyphId !== 0) {
  24775. glyphId = (glyphId + s.idDelta) % 65536;
  24776. }
  24777. mappings.push({
  24778. charCode,
  24779. glyphId
  24780. });
  24781. }
  24782. }
  24783. }
  24784. } else if (format === 4) {
  24785. file.skip(2 + 2);
  24786. const segCount = file.getUint16() >> 1;
  24787. file.skip(6);
  24788. const segments = [];
  24789. let segIndex;
  24790. for (segIndex = 0; segIndex < segCount; segIndex++) {
  24791. segments.push({
  24792. end: file.getUint16()
  24793. });
  24794. }
  24795. file.skip(2);
  24796. for (segIndex = 0; segIndex < segCount; segIndex++) {
  24797. segments[segIndex].start = file.getUint16();
  24798. }
  24799. for (segIndex = 0; segIndex < segCount; segIndex++) {
  24800. segments[segIndex].delta = file.getUint16();
  24801. }
  24802. let offsetsCount = 0,
  24803. offsetIndex;
  24804. for (segIndex = 0; segIndex < segCount; segIndex++) {
  24805. segment = segments[segIndex];
  24806. const rangeOffset = file.getUint16();
  24807. if (!rangeOffset) {
  24808. segment.offsetIndex = -1;
  24809. continue;
  24810. }
  24811. offsetIndex = (rangeOffset >> 1) - (segCount - segIndex);
  24812. segment.offsetIndex = offsetIndex;
  24813. offsetsCount = Math.max(offsetsCount, offsetIndex + segment.end - segment.start + 1);
  24814. }
  24815. const offsets = [];
  24816. for (j = 0; j < offsetsCount; j++) {
  24817. offsets.push(file.getUint16());
  24818. }
  24819. for (segIndex = 0; segIndex < segCount; segIndex++) {
  24820. segment = segments[segIndex];
  24821. start = segment.start;
  24822. const end = segment.end;
  24823. const delta = segment.delta;
  24824. offsetIndex = segment.offsetIndex;
  24825. for (j = start; j <= end; j++) {
  24826. if (j === 0xffff) {
  24827. continue;
  24828. }
  24829. glyphId = offsetIndex < 0 ? j : offsets[offsetIndex + j - start];
  24830. glyphId = glyphId + delta & 0xffff;
  24831. mappings.push({
  24832. charCode: j,
  24833. glyphId
  24834. });
  24835. }
  24836. }
  24837. } else if (format === 6) {
  24838. file.skip(2 + 2);
  24839. const firstCode = file.getUint16();
  24840. const entryCount = file.getUint16();
  24841. for (j = 0; j < entryCount; j++) {
  24842. glyphId = file.getUint16();
  24843. const charCode = firstCode + j;
  24844. mappings.push({
  24845. charCode,
  24846. glyphId
  24847. });
  24848. }
  24849. } else if (format === 12) {
  24850. file.skip(2 + 4 + 4);
  24851. const nGroups = file.getInt32() >>> 0;
  24852. for (j = 0; j < nGroups; j++) {
  24853. const startCharCode = file.getInt32() >>> 0;
  24854. const endCharCode = file.getInt32() >>> 0;
  24855. let glyphCode = file.getInt32() >>> 0;
  24856. for (let charCode = startCharCode; charCode <= endCharCode; charCode++) {
  24857. mappings.push({
  24858. charCode,
  24859. glyphId: glyphCode++
  24860. });
  24861. }
  24862. }
  24863. } else {
  24864. (0, _util.warn)("cmap table has unsupported format: " + format);
  24865. return {
  24866. platformId: -1,
  24867. encodingId: -1,
  24868. mappings: [],
  24869. hasShortCmap: false
  24870. };
  24871. }
  24872. mappings.sort(function (a, b) {
  24873. return a.charCode - b.charCode;
  24874. });
  24875. for (let i = 1; i < mappings.length; i++) {
  24876. if (mappings[i - 1].charCode === mappings[i].charCode) {
  24877. mappings.splice(i, 1);
  24878. i--;
  24879. }
  24880. }
  24881. return {
  24882. platformId: potentialTable.platformId,
  24883. encodingId: potentialTable.encodingId,
  24884. mappings,
  24885. hasShortCmap
  24886. };
  24887. }
  24888. function sanitizeMetrics(file, header, metrics, headTable, numGlyphs, dupFirstEntry) {
  24889. if (!header) {
  24890. if (metrics) {
  24891. metrics.data = null;
  24892. }
  24893. return;
  24894. }
  24895. file.pos = (file.start || 0) + header.offset;
  24896. file.pos += 4;
  24897. file.pos += 2;
  24898. file.pos += 2;
  24899. file.pos += 2;
  24900. file.pos += 2;
  24901. file.pos += 2;
  24902. file.pos += 2;
  24903. file.pos += 2;
  24904. file.pos += 2;
  24905. file.pos += 2;
  24906. const caretOffset = file.getUint16();
  24907. file.pos += 8;
  24908. file.pos += 2;
  24909. let numOfMetrics = file.getUint16();
  24910. if (caretOffset !== 0) {
  24911. const macStyle = int16(headTable.data[44], headTable.data[45]);
  24912. if (!(macStyle & 2)) {
  24913. header.data[22] = 0;
  24914. header.data[23] = 0;
  24915. }
  24916. }
  24917. if (numOfMetrics > numGlyphs) {
  24918. (0, _util.info)(`The numOfMetrics (${numOfMetrics}) should not be ` + `greater than the numGlyphs (${numGlyphs}).`);
  24919. numOfMetrics = numGlyphs;
  24920. header.data[34] = (numOfMetrics & 0xff00) >> 8;
  24921. header.data[35] = numOfMetrics & 0x00ff;
  24922. }
  24923. const numOfSidebearings = numGlyphs - numOfMetrics;
  24924. const numMissing = numOfSidebearings - (metrics.length - numOfMetrics * 4 >> 1);
  24925. if (numMissing > 0) {
  24926. const entries = new Uint8Array(metrics.length + numMissing * 2);
  24927. entries.set(metrics.data);
  24928. if (dupFirstEntry) {
  24929. entries[metrics.length] = metrics.data[2];
  24930. entries[metrics.length + 1] = metrics.data[3];
  24931. }
  24932. metrics.data = entries;
  24933. }
  24934. }
  24935. function sanitizeGlyph(source, sourceStart, sourceEnd, dest, destStart, hintsValid) {
  24936. const glyphProfile = {
  24937. length: 0,
  24938. sizeOfInstructions: 0
  24939. };
  24940. if (sourceEnd - sourceStart <= 12) {
  24941. return glyphProfile;
  24942. }
  24943. const glyf = source.subarray(sourceStart, sourceEnd);
  24944. let contoursCount = signedInt16(glyf[0], glyf[1]);
  24945. if (contoursCount < 0) {
  24946. contoursCount = -1;
  24947. writeSignedInt16(glyf, 0, contoursCount);
  24948. dest.set(glyf, destStart);
  24949. glyphProfile.length = glyf.length;
  24950. return glyphProfile;
  24951. }
  24952. let i,
  24953. j = 10,
  24954. flagsCount = 0;
  24955. for (i = 0; i < contoursCount; i++) {
  24956. const endPoint = glyf[j] << 8 | glyf[j + 1];
  24957. flagsCount = endPoint + 1;
  24958. j += 2;
  24959. }
  24960. const instructionsStart = j;
  24961. const instructionsLength = glyf[j] << 8 | glyf[j + 1];
  24962. glyphProfile.sizeOfInstructions = instructionsLength;
  24963. j += 2 + instructionsLength;
  24964. const instructionsEnd = j;
  24965. let coordinatesLength = 0;
  24966. for (i = 0; i < flagsCount; i++) {
  24967. const flag = glyf[j++];
  24968. if (flag & 0xc0) {
  24969. glyf[j - 1] = flag & 0x3f;
  24970. }
  24971. let xLength = 2;
  24972. if (flag & 2) {
  24973. xLength = 1;
  24974. } else if (flag & 16) {
  24975. xLength = 0;
  24976. }
  24977. let yLength = 2;
  24978. if (flag & 4) {
  24979. yLength = 1;
  24980. } else if (flag & 32) {
  24981. yLength = 0;
  24982. }
  24983. const xyLength = xLength + yLength;
  24984. coordinatesLength += xyLength;
  24985. if (flag & 8) {
  24986. const repeat = glyf[j++];
  24987. i += repeat;
  24988. coordinatesLength += repeat * xyLength;
  24989. }
  24990. }
  24991. if (coordinatesLength === 0) {
  24992. return glyphProfile;
  24993. }
  24994. let glyphDataLength = j + coordinatesLength;
  24995. if (glyphDataLength > glyf.length) {
  24996. return glyphProfile;
  24997. }
  24998. if (!hintsValid && instructionsLength > 0) {
  24999. dest.set(glyf.subarray(0, instructionsStart), destStart);
  25000. dest.set([0, 0], destStart + instructionsStart);
  25001. dest.set(glyf.subarray(instructionsEnd, glyphDataLength), destStart + instructionsStart + 2);
  25002. glyphDataLength -= instructionsLength;
  25003. if (glyf.length - glyphDataLength > 3) {
  25004. glyphDataLength = glyphDataLength + 3 & ~3;
  25005. }
  25006. glyphProfile.length = glyphDataLength;
  25007. return glyphProfile;
  25008. }
  25009. if (glyf.length - glyphDataLength > 3) {
  25010. glyphDataLength = glyphDataLength + 3 & ~3;
  25011. dest.set(glyf.subarray(0, glyphDataLength), destStart);
  25012. glyphProfile.length = glyphDataLength;
  25013. return glyphProfile;
  25014. }
  25015. dest.set(glyf, destStart);
  25016. glyphProfile.length = glyf.length;
  25017. return glyphProfile;
  25018. }
  25019. function sanitizeHead(head, numGlyphs, locaLength) {
  25020. const data = head.data;
  25021. const version = int32(data[0], data[1], data[2], data[3]);
  25022. if (version >> 16 !== 1) {
  25023. (0, _util.info)("Attempting to fix invalid version in head table: " + version);
  25024. data[0] = 0;
  25025. data[1] = 1;
  25026. data[2] = 0;
  25027. data[3] = 0;
  25028. }
  25029. const indexToLocFormat = int16(data[50], data[51]);
  25030. if (indexToLocFormat < 0 || indexToLocFormat > 1) {
  25031. (0, _util.info)("Attempting to fix invalid indexToLocFormat in head table: " + indexToLocFormat);
  25032. const numGlyphsPlusOne = numGlyphs + 1;
  25033. if (locaLength === numGlyphsPlusOne << 1) {
  25034. data[50] = 0;
  25035. data[51] = 0;
  25036. } else if (locaLength === numGlyphsPlusOne << 2) {
  25037. data[50] = 0;
  25038. data[51] = 1;
  25039. } else {
  25040. throw new _util.FormatError("Could not fix indexToLocFormat: " + indexToLocFormat);
  25041. }
  25042. }
  25043. }
  25044. function sanitizeGlyphLocations(loca, glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry, maxSizeOfInstructions) {
  25045. let itemSize, itemDecode, itemEncode;
  25046. if (isGlyphLocationsLong) {
  25047. itemSize = 4;
  25048. itemDecode = function fontItemDecodeLong(data, offset) {
  25049. return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
  25050. };
  25051. itemEncode = function fontItemEncodeLong(data, offset, value) {
  25052. data[offset] = value >>> 24 & 0xff;
  25053. data[offset + 1] = value >> 16 & 0xff;
  25054. data[offset + 2] = value >> 8 & 0xff;
  25055. data[offset + 3] = value & 0xff;
  25056. };
  25057. } else {
  25058. itemSize = 2;
  25059. itemDecode = function fontItemDecode(data, offset) {
  25060. return data[offset] << 9 | data[offset + 1] << 1;
  25061. };
  25062. itemEncode = function fontItemEncode(data, offset, value) {
  25063. data[offset] = value >> 9 & 0xff;
  25064. data[offset + 1] = value >> 1 & 0xff;
  25065. };
  25066. }
  25067. const numGlyphsOut = dupFirstEntry ? numGlyphs + 1 : numGlyphs;
  25068. const locaDataSize = itemSize * (1 + numGlyphsOut);
  25069. const locaData = new Uint8Array(locaDataSize);
  25070. locaData.set(loca.data.subarray(0, locaDataSize));
  25071. loca.data = locaData;
  25072. const oldGlyfData = glyf.data;
  25073. const oldGlyfDataLength = oldGlyfData.length;
  25074. const newGlyfData = new Uint8Array(oldGlyfDataLength);
  25075. let i, j;
  25076. const locaEntries = [];
  25077. for (i = 0, j = 0; i < numGlyphs + 1; i++, j += itemSize) {
  25078. let offset = itemDecode(locaData, j);
  25079. if (offset > oldGlyfDataLength) {
  25080. offset = oldGlyfDataLength;
  25081. }
  25082. locaEntries.push({
  25083. index: i,
  25084. offset,
  25085. endOffset: 0
  25086. });
  25087. }
  25088. locaEntries.sort((a, b) => {
  25089. return a.offset - b.offset;
  25090. });
  25091. for (i = 0; i < numGlyphs; i++) {
  25092. locaEntries[i].endOffset = locaEntries[i + 1].offset;
  25093. }
  25094. locaEntries.sort((a, b) => {
  25095. return a.index - b.index;
  25096. });
  25097. for (i = 0; i < numGlyphs; i++) {
  25098. const {
  25099. offset,
  25100. endOffset
  25101. } = locaEntries[i];
  25102. if (offset !== 0 || endOffset !== 0) {
  25103. break;
  25104. }
  25105. const nextOffset = locaEntries[i + 1].offset;
  25106. if (nextOffset === 0) {
  25107. continue;
  25108. }
  25109. locaEntries[i].endOffset = nextOffset;
  25110. break;
  25111. }
  25112. const missingGlyphs = Object.create(null);
  25113. let writeOffset = 0;
  25114. itemEncode(locaData, 0, writeOffset);
  25115. for (i = 0, j = itemSize; i < numGlyphs; i++, j += itemSize) {
  25116. const glyphProfile = sanitizeGlyph(oldGlyfData, locaEntries[i].offset, locaEntries[i].endOffset, newGlyfData, writeOffset, hintsValid);
  25117. const newLength = glyphProfile.length;
  25118. if (newLength === 0) {
  25119. missingGlyphs[i] = true;
  25120. }
  25121. if (glyphProfile.sizeOfInstructions > maxSizeOfInstructions) {
  25122. maxSizeOfInstructions = glyphProfile.sizeOfInstructions;
  25123. }
  25124. writeOffset += newLength;
  25125. itemEncode(locaData, j, writeOffset);
  25126. }
  25127. if (writeOffset === 0) {
  25128. const simpleGlyph = new Uint8Array([0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 49, 0]);
  25129. for (i = 0, j = itemSize; i < numGlyphsOut; i++, j += itemSize) {
  25130. itemEncode(locaData, j, simpleGlyph.length);
  25131. }
  25132. glyf.data = simpleGlyph;
  25133. } else if (dupFirstEntry) {
  25134. const firstEntryLength = itemDecode(locaData, itemSize);
  25135. if (newGlyfData.length > firstEntryLength + writeOffset) {
  25136. glyf.data = newGlyfData.subarray(0, firstEntryLength + writeOffset);
  25137. } else {
  25138. glyf.data = new Uint8Array(firstEntryLength + writeOffset);
  25139. glyf.data.set(newGlyfData.subarray(0, writeOffset));
  25140. }
  25141. glyf.data.set(newGlyfData.subarray(0, firstEntryLength), writeOffset);
  25142. itemEncode(loca.data, locaData.length - itemSize, writeOffset + firstEntryLength);
  25143. } else {
  25144. glyf.data = newGlyfData.subarray(0, writeOffset);
  25145. }
  25146. return {
  25147. missingGlyphs,
  25148. maxSizeOfInstructions
  25149. };
  25150. }
  25151. function readPostScriptTable(post, propertiesObj, maxpNumGlyphs) {
  25152. const start = (font.start || 0) + post.offset;
  25153. font.pos = start;
  25154. const length = post.length,
  25155. end = start + length;
  25156. const version = font.getInt32();
  25157. font.skip(28);
  25158. let glyphNames;
  25159. let valid = true;
  25160. let i;
  25161. switch (version) {
  25162. case 0x00010000:
  25163. glyphNames = _fonts_utils.MacStandardGlyphOrdering;
  25164. break;
  25165. case 0x00020000:
  25166. const numGlyphs = font.getUint16();
  25167. if (numGlyphs !== maxpNumGlyphs) {
  25168. valid = false;
  25169. break;
  25170. }
  25171. const glyphNameIndexes = [];
  25172. for (i = 0; i < numGlyphs; ++i) {
  25173. const index = font.getUint16();
  25174. if (index >= 32768) {
  25175. valid = false;
  25176. break;
  25177. }
  25178. glyphNameIndexes.push(index);
  25179. }
  25180. if (!valid) {
  25181. break;
  25182. }
  25183. const customNames = [],
  25184. strBuf = [];
  25185. while (font.pos < end) {
  25186. const stringLength = font.getByte();
  25187. strBuf.length = stringLength;
  25188. for (i = 0; i < stringLength; ++i) {
  25189. strBuf[i] = String.fromCharCode(font.getByte());
  25190. }
  25191. customNames.push(strBuf.join(""));
  25192. }
  25193. glyphNames = [];
  25194. for (i = 0; i < numGlyphs; ++i) {
  25195. const j = glyphNameIndexes[i];
  25196. if (j < 258) {
  25197. glyphNames.push(_fonts_utils.MacStandardGlyphOrdering[j]);
  25198. continue;
  25199. }
  25200. glyphNames.push(customNames[j - 258]);
  25201. }
  25202. break;
  25203. case 0x00030000:
  25204. break;
  25205. default:
  25206. (0, _util.warn)("Unknown/unsupported post table version " + version);
  25207. valid = false;
  25208. if (propertiesObj.defaultEncoding) {
  25209. glyphNames = propertiesObj.defaultEncoding;
  25210. }
  25211. break;
  25212. }
  25213. propertiesObj.glyphNames = glyphNames;
  25214. return valid;
  25215. }
  25216. function readNameTable(nameTable) {
  25217. const start = (font.start || 0) + nameTable.offset;
  25218. font.pos = start;
  25219. const names = [[], []];
  25220. const length = nameTable.length,
  25221. end = start + length;
  25222. const format = font.getUint16();
  25223. const FORMAT_0_HEADER_LENGTH = 6;
  25224. if (format !== 0 || length < FORMAT_0_HEADER_LENGTH) {
  25225. return names;
  25226. }
  25227. const numRecords = font.getUint16();
  25228. const stringsStart = font.getUint16();
  25229. const records = [];
  25230. const NAME_RECORD_LENGTH = 12;
  25231. let i, ii;
  25232. for (i = 0; i < numRecords && font.pos + NAME_RECORD_LENGTH <= end; i++) {
  25233. const r = {
  25234. platform: font.getUint16(),
  25235. encoding: font.getUint16(),
  25236. language: font.getUint16(),
  25237. name: font.getUint16(),
  25238. length: font.getUint16(),
  25239. offset: font.getUint16()
  25240. };
  25241. if (r.platform === 1 && r.encoding === 0 && r.language === 0 || r.platform === 3 && r.encoding === 1 && r.language === 0x409) {
  25242. records.push(r);
  25243. }
  25244. }
  25245. for (i = 0, ii = records.length; i < ii; i++) {
  25246. const record = records[i];
  25247. if (record.length <= 0) {
  25248. continue;
  25249. }
  25250. const pos = start + stringsStart + record.offset;
  25251. if (pos + record.length > end) {
  25252. continue;
  25253. }
  25254. font.pos = pos;
  25255. const nameIndex = record.name;
  25256. if (record.encoding) {
  25257. let str = "";
  25258. for (let j = 0, jj = record.length; j < jj; j += 2) {
  25259. str += String.fromCharCode(font.getUint16());
  25260. }
  25261. names[1][nameIndex] = str;
  25262. } else {
  25263. names[0][nameIndex] = font.getString(record.length);
  25264. }
  25265. }
  25266. return names;
  25267. }
  25268. 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];
  25269. function sanitizeTTProgram(table, ttContext) {
  25270. let data = table.data;
  25271. let i = 0,
  25272. j,
  25273. n,
  25274. b,
  25275. funcId,
  25276. pc,
  25277. lastEndf = 0,
  25278. lastDeff = 0;
  25279. const stack = [];
  25280. const callstack = [];
  25281. const functionsCalled = [];
  25282. let tooComplexToFollowFunctions = ttContext.tooComplexToFollowFunctions;
  25283. let inFDEF = false,
  25284. ifLevel = 0,
  25285. inELSE = 0;
  25286. for (let ii = data.length; i < ii;) {
  25287. const op = data[i++];
  25288. if (op === 0x40) {
  25289. n = data[i++];
  25290. if (inFDEF || inELSE) {
  25291. i += n;
  25292. } else {
  25293. for (j = 0; j < n; j++) {
  25294. stack.push(data[i++]);
  25295. }
  25296. }
  25297. } else if (op === 0x41) {
  25298. n = data[i++];
  25299. if (inFDEF || inELSE) {
  25300. i += n * 2;
  25301. } else {
  25302. for (j = 0; j < n; j++) {
  25303. b = data[i++];
  25304. stack.push(b << 8 | data[i++]);
  25305. }
  25306. }
  25307. } else if ((op & 0xf8) === 0xb0) {
  25308. n = op - 0xb0 + 1;
  25309. if (inFDEF || inELSE) {
  25310. i += n;
  25311. } else {
  25312. for (j = 0; j < n; j++) {
  25313. stack.push(data[i++]);
  25314. }
  25315. }
  25316. } else if ((op & 0xf8) === 0xb8) {
  25317. n = op - 0xb8 + 1;
  25318. if (inFDEF || inELSE) {
  25319. i += n * 2;
  25320. } else {
  25321. for (j = 0; j < n; j++) {
  25322. b = data[i++];
  25323. stack.push(b << 8 | data[i++]);
  25324. }
  25325. }
  25326. } else if (op === 0x2b && !tooComplexToFollowFunctions) {
  25327. if (!inFDEF && !inELSE) {
  25328. funcId = stack.at(-1);
  25329. if (isNaN(funcId)) {
  25330. (0, _util.info)("TT: CALL empty stack (or invalid entry).");
  25331. } else {
  25332. ttContext.functionsUsed[funcId] = true;
  25333. if (funcId in ttContext.functionsStackDeltas) {
  25334. const newStackLength = stack.length + ttContext.functionsStackDeltas[funcId];
  25335. if (newStackLength < 0) {
  25336. (0, _util.warn)("TT: CALL invalid functions stack delta.");
  25337. ttContext.hintsValid = false;
  25338. return;
  25339. }
  25340. stack.length = newStackLength;
  25341. } else if (funcId in ttContext.functionsDefined && !functionsCalled.includes(funcId)) {
  25342. callstack.push({
  25343. data,
  25344. i,
  25345. stackTop: stack.length - 1
  25346. });
  25347. functionsCalled.push(funcId);
  25348. pc = ttContext.functionsDefined[funcId];
  25349. if (!pc) {
  25350. (0, _util.warn)("TT: CALL non-existent function");
  25351. ttContext.hintsValid = false;
  25352. return;
  25353. }
  25354. data = pc.data;
  25355. i = pc.i;
  25356. }
  25357. }
  25358. }
  25359. } else if (op === 0x2c && !tooComplexToFollowFunctions) {
  25360. if (inFDEF || inELSE) {
  25361. (0, _util.warn)("TT: nested FDEFs not allowed");
  25362. tooComplexToFollowFunctions = true;
  25363. }
  25364. inFDEF = true;
  25365. lastDeff = i;
  25366. funcId = stack.pop();
  25367. ttContext.functionsDefined[funcId] = {
  25368. data,
  25369. i
  25370. };
  25371. } else if (op === 0x2d) {
  25372. if (inFDEF) {
  25373. inFDEF = false;
  25374. lastEndf = i;
  25375. } else {
  25376. pc = callstack.pop();
  25377. if (!pc) {
  25378. (0, _util.warn)("TT: ENDF bad stack");
  25379. ttContext.hintsValid = false;
  25380. return;
  25381. }
  25382. funcId = functionsCalled.pop();
  25383. data = pc.data;
  25384. i = pc.i;
  25385. ttContext.functionsStackDeltas[funcId] = stack.length - pc.stackTop;
  25386. }
  25387. } else if (op === 0x89) {
  25388. if (inFDEF || inELSE) {
  25389. (0, _util.warn)("TT: nested IDEFs not allowed");
  25390. tooComplexToFollowFunctions = true;
  25391. }
  25392. inFDEF = true;
  25393. lastDeff = i;
  25394. } else if (op === 0x58) {
  25395. ++ifLevel;
  25396. } else if (op === 0x1b) {
  25397. inELSE = ifLevel;
  25398. } else if (op === 0x59) {
  25399. if (inELSE === ifLevel) {
  25400. inELSE = 0;
  25401. }
  25402. --ifLevel;
  25403. } else if (op === 0x1c) {
  25404. if (!inFDEF && !inELSE) {
  25405. const offset = stack.at(-1);
  25406. if (offset > 0) {
  25407. i += offset - 1;
  25408. }
  25409. }
  25410. }
  25411. if (!inFDEF && !inELSE) {
  25412. let stackDelta = 0;
  25413. if (op <= 0x8e) {
  25414. stackDelta = TTOpsStackDeltas[op];
  25415. } else if (op >= 0xc0 && op <= 0xdf) {
  25416. stackDelta = -1;
  25417. } else if (op >= 0xe0) {
  25418. stackDelta = -2;
  25419. }
  25420. if (op >= 0x71 && op <= 0x75) {
  25421. n = stack.pop();
  25422. if (!isNaN(n)) {
  25423. stackDelta = -n * 2;
  25424. }
  25425. }
  25426. while (stackDelta < 0 && stack.length > 0) {
  25427. stack.pop();
  25428. stackDelta++;
  25429. }
  25430. while (stackDelta > 0) {
  25431. stack.push(NaN);
  25432. stackDelta--;
  25433. }
  25434. }
  25435. }
  25436. ttContext.tooComplexToFollowFunctions = tooComplexToFollowFunctions;
  25437. const content = [data];
  25438. if (i > data.length) {
  25439. content.push(new Uint8Array(i - data.length));
  25440. }
  25441. if (lastDeff > lastEndf) {
  25442. (0, _util.warn)("TT: complementing a missing function tail");
  25443. content.push(new Uint8Array([0x22, 0x2d]));
  25444. }
  25445. foldTTTable(table, content);
  25446. }
  25447. function checkInvalidFunctions(ttContext, maxFunctionDefs) {
  25448. if (ttContext.tooComplexToFollowFunctions) {
  25449. return;
  25450. }
  25451. if (ttContext.functionsDefined.length > maxFunctionDefs) {
  25452. (0, _util.warn)("TT: more functions defined than expected");
  25453. ttContext.hintsValid = false;
  25454. return;
  25455. }
  25456. for (let j = 0, jj = ttContext.functionsUsed.length; j < jj; j++) {
  25457. if (j > maxFunctionDefs) {
  25458. (0, _util.warn)("TT: invalid function id: " + j);
  25459. ttContext.hintsValid = false;
  25460. return;
  25461. }
  25462. if (ttContext.functionsUsed[j] && !ttContext.functionsDefined[j]) {
  25463. (0, _util.warn)("TT: undefined function: " + j);
  25464. ttContext.hintsValid = false;
  25465. return;
  25466. }
  25467. }
  25468. }
  25469. function foldTTTable(table, content) {
  25470. if (content.length > 1) {
  25471. let newLength = 0;
  25472. let j, jj;
  25473. for (j = 0, jj = content.length; j < jj; j++) {
  25474. newLength += content[j].length;
  25475. }
  25476. newLength = newLength + 3 & ~3;
  25477. const result = new Uint8Array(newLength);
  25478. let pos = 0;
  25479. for (j = 0, jj = content.length; j < jj; j++) {
  25480. result.set(content[j], pos);
  25481. pos += content[j].length;
  25482. }
  25483. table.data = result;
  25484. table.length = newLength;
  25485. }
  25486. }
  25487. function sanitizeTTPrograms(fpgm, prep, cvt, maxFunctionDefs) {
  25488. const ttContext = {
  25489. functionsDefined: [],
  25490. functionsUsed: [],
  25491. functionsStackDeltas: [],
  25492. tooComplexToFollowFunctions: false,
  25493. hintsValid: true
  25494. };
  25495. if (fpgm) {
  25496. sanitizeTTProgram(fpgm, ttContext);
  25497. }
  25498. if (prep) {
  25499. sanitizeTTProgram(prep, ttContext);
  25500. }
  25501. if (fpgm) {
  25502. checkInvalidFunctions(ttContext, maxFunctionDefs);
  25503. }
  25504. if (cvt && cvt.length & 1) {
  25505. const cvtData = new Uint8Array(cvt.length + 1);
  25506. cvtData.set(cvt.data);
  25507. cvt.data = cvtData;
  25508. }
  25509. return ttContext.hintsValid;
  25510. }
  25511. font = new _stream.Stream(new Uint8Array(font.getBytes()));
  25512. let header, tables;
  25513. if (isTrueTypeCollectionFile(font)) {
  25514. const ttcData = readTrueTypeCollectionData(font, this.name);
  25515. header = ttcData.header;
  25516. tables = ttcData.tables;
  25517. } else {
  25518. header = readOpenTypeHeader(font);
  25519. tables = readTables(font, header.numTables);
  25520. }
  25521. let cff, cffFile;
  25522. const isTrueType = !tables["CFF "];
  25523. if (!isTrueType) {
  25524. const isComposite = properties.composite && ((properties.cidToGidMap || []).length > 0 || !(properties.cMap instanceof _cmap.IdentityCMap));
  25525. if (header.version === "OTTO" && !isComposite || !tables.head || !tables.hhea || !tables.maxp || !tables.post) {
  25526. cffFile = new _stream.Stream(tables["CFF "].data);
  25527. cff = new _cff_font.CFFFont(cffFile, properties);
  25528. adjustWidths(properties);
  25529. return this.convert(name, cff, properties);
  25530. }
  25531. delete tables.glyf;
  25532. delete tables.loca;
  25533. delete tables.fpgm;
  25534. delete tables.prep;
  25535. delete tables["cvt "];
  25536. this.isOpenType = true;
  25537. } else {
  25538. if (!tables.loca) {
  25539. throw new _util.FormatError('Required "loca" table is not found');
  25540. }
  25541. if (!tables.glyf) {
  25542. (0, _util.warn)('Required "glyf" table is not found -- trying to recover.');
  25543. tables.glyf = {
  25544. tag: "glyf",
  25545. data: new Uint8Array(0)
  25546. };
  25547. }
  25548. this.isOpenType = false;
  25549. }
  25550. if (!tables.maxp) {
  25551. throw new _util.FormatError('Required "maxp" table is not found');
  25552. }
  25553. font.pos = (font.start || 0) + tables.maxp.offset;
  25554. const version = font.getInt32();
  25555. const numGlyphs = font.getUint16();
  25556. if (properties.scaleFactors && properties.scaleFactors.length === numGlyphs && isTrueType) {
  25557. const {
  25558. scaleFactors
  25559. } = properties;
  25560. const isGlyphLocationsLong = int16(tables.head.data[50], tables.head.data[51]);
  25561. const glyphs = new _glyf.GlyfTable({
  25562. glyfTable: tables.glyf.data,
  25563. isGlyphLocationsLong,
  25564. locaTable: tables.loca.data,
  25565. numGlyphs
  25566. });
  25567. glyphs.scale(scaleFactors);
  25568. const {
  25569. glyf,
  25570. loca,
  25571. isLocationLong
  25572. } = glyphs.write();
  25573. tables.glyf.data = glyf;
  25574. tables.loca.data = loca;
  25575. if (isLocationLong !== !!isGlyphLocationsLong) {
  25576. tables.head.data[50] = 0;
  25577. tables.head.data[51] = isLocationLong ? 1 : 0;
  25578. }
  25579. const metrics = tables.hmtx.data;
  25580. for (let i = 0; i < numGlyphs; i++) {
  25581. const j = 4 * i;
  25582. const advanceWidth = Math.round(scaleFactors[i] * int16(metrics[j], metrics[j + 1]));
  25583. metrics[j] = advanceWidth >> 8 & 0xff;
  25584. metrics[j + 1] = advanceWidth & 0xff;
  25585. const lsb = Math.round(scaleFactors[i] * signedInt16(metrics[j + 2], metrics[j + 3]));
  25586. writeSignedInt16(metrics, j + 2, lsb);
  25587. }
  25588. }
  25589. let numGlyphsOut = numGlyphs + 1;
  25590. let dupFirstEntry = true;
  25591. if (numGlyphsOut > 0xffff) {
  25592. dupFirstEntry = false;
  25593. numGlyphsOut = numGlyphs;
  25594. (0, _util.warn)("Not enough space in glyfs to duplicate first glyph.");
  25595. }
  25596. let maxFunctionDefs = 0;
  25597. let maxSizeOfInstructions = 0;
  25598. if (version >= 0x00010000 && tables.maxp.length >= 22) {
  25599. font.pos += 8;
  25600. const maxZones = font.getUint16();
  25601. if (maxZones > 2) {
  25602. tables.maxp.data[14] = 0;
  25603. tables.maxp.data[15] = 2;
  25604. }
  25605. font.pos += 4;
  25606. maxFunctionDefs = font.getUint16();
  25607. font.pos += 4;
  25608. maxSizeOfInstructions = font.getUint16();
  25609. }
  25610. tables.maxp.data[4] = numGlyphsOut >> 8;
  25611. tables.maxp.data[5] = numGlyphsOut & 255;
  25612. const hintsValid = sanitizeTTPrograms(tables.fpgm, tables.prep, tables["cvt "], maxFunctionDefs);
  25613. if (!hintsValid) {
  25614. delete tables.fpgm;
  25615. delete tables.prep;
  25616. delete tables["cvt "];
  25617. }
  25618. sanitizeMetrics(font, tables.hhea, tables.hmtx, tables.head, numGlyphsOut, dupFirstEntry);
  25619. if (!tables.head) {
  25620. throw new _util.FormatError('Required "head" table is not found');
  25621. }
  25622. sanitizeHead(tables.head, numGlyphs, isTrueType ? tables.loca.length : 0);
  25623. let missingGlyphs = Object.create(null);
  25624. if (isTrueType) {
  25625. const isGlyphLocationsLong = int16(tables.head.data[50], tables.head.data[51]);
  25626. const glyphsInfo = sanitizeGlyphLocations(tables.loca, tables.glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry, maxSizeOfInstructions);
  25627. missingGlyphs = glyphsInfo.missingGlyphs;
  25628. if (version >= 0x00010000 && tables.maxp.length >= 22) {
  25629. tables.maxp.data[26] = glyphsInfo.maxSizeOfInstructions >> 8;
  25630. tables.maxp.data[27] = glyphsInfo.maxSizeOfInstructions & 255;
  25631. }
  25632. }
  25633. if (!tables.hhea) {
  25634. throw new _util.FormatError('Required "hhea" table is not found');
  25635. }
  25636. if (tables.hhea.data[10] === 0 && tables.hhea.data[11] === 0) {
  25637. tables.hhea.data[10] = 0xff;
  25638. tables.hhea.data[11] = 0xff;
  25639. }
  25640. const metricsOverride = {
  25641. unitsPerEm: int16(tables.head.data[18], tables.head.data[19]),
  25642. yMax: int16(tables.head.data[42], tables.head.data[43]),
  25643. yMin: signedInt16(tables.head.data[38], tables.head.data[39]),
  25644. ascent: signedInt16(tables.hhea.data[4], tables.hhea.data[5]),
  25645. descent: signedInt16(tables.hhea.data[6], tables.hhea.data[7]),
  25646. lineGap: signedInt16(tables.hhea.data[8], tables.hhea.data[9])
  25647. };
  25648. this.ascent = metricsOverride.ascent / metricsOverride.unitsPerEm;
  25649. this.descent = metricsOverride.descent / metricsOverride.unitsPerEm;
  25650. this.lineGap = metricsOverride.lineGap / metricsOverride.unitsPerEm;
  25651. if (this.cssFontInfo && this.cssFontInfo.lineHeight) {
  25652. this.lineHeight = this.cssFontInfo.metrics.lineHeight;
  25653. this.lineGap = this.cssFontInfo.metrics.lineGap;
  25654. } else {
  25655. this.lineHeight = this.ascent - this.descent + this.lineGap;
  25656. }
  25657. if (tables.post) {
  25658. readPostScriptTable(tables.post, properties, numGlyphs);
  25659. }
  25660. tables.post = {
  25661. tag: "post",
  25662. data: createPostTable(properties)
  25663. };
  25664. const charCodeToGlyphId = [];
  25665. function hasGlyph(glyphId) {
  25666. return !missingGlyphs[glyphId];
  25667. }
  25668. if (properties.composite) {
  25669. const cidToGidMap = properties.cidToGidMap || [];
  25670. const isCidToGidMapEmpty = cidToGidMap.length === 0;
  25671. properties.cMap.forEach(function (charCode, cid) {
  25672. if (typeof cid === "string") {
  25673. cid = convertCidString(charCode, cid, true);
  25674. }
  25675. if (cid > 0xffff) {
  25676. throw new _util.FormatError("Max size of CID is 65,535");
  25677. }
  25678. let glyphId = -1;
  25679. if (isCidToGidMapEmpty) {
  25680. glyphId = cid;
  25681. } else if (cidToGidMap[cid] !== undefined) {
  25682. glyphId = cidToGidMap[cid];
  25683. }
  25684. if (glyphId >= 0 && glyphId < numGlyphs && hasGlyph(glyphId)) {
  25685. charCodeToGlyphId[charCode] = glyphId;
  25686. }
  25687. });
  25688. } else {
  25689. const cmapTable = readCmapTable(tables.cmap, font, this.isSymbolicFont, properties.hasEncoding);
  25690. const cmapPlatformId = cmapTable.platformId;
  25691. const cmapEncodingId = cmapTable.encodingId;
  25692. const cmapMappings = cmapTable.mappings;
  25693. let baseEncoding = [],
  25694. forcePostTable = false;
  25695. if (properties.hasEncoding && (properties.baseEncodingName === "MacRomanEncoding" || properties.baseEncodingName === "WinAnsiEncoding")) {
  25696. baseEncoding = (0, _encodings.getEncoding)(properties.baseEncodingName);
  25697. }
  25698. if (properties.hasEncoding && !this.isSymbolicFont && (cmapPlatformId === 3 && cmapEncodingId === 1 || cmapPlatformId === 1 && cmapEncodingId === 0)) {
  25699. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  25700. for (let charCode = 0; charCode < 256; charCode++) {
  25701. let glyphName;
  25702. if (this.differences[charCode] !== undefined) {
  25703. glyphName = this.differences[charCode];
  25704. } else if (baseEncoding.length && baseEncoding[charCode] !== "") {
  25705. glyphName = baseEncoding[charCode];
  25706. } else {
  25707. glyphName = _encodings.StandardEncoding[charCode];
  25708. }
  25709. if (!glyphName) {
  25710. continue;
  25711. }
  25712. const standardGlyphName = (0, _fonts_utils.recoverGlyphName)(glyphName, glyphsUnicodeMap);
  25713. let unicodeOrCharCode;
  25714. if (cmapPlatformId === 3 && cmapEncodingId === 1) {
  25715. unicodeOrCharCode = glyphsUnicodeMap[standardGlyphName];
  25716. } else if (cmapPlatformId === 1 && cmapEncodingId === 0) {
  25717. unicodeOrCharCode = _encodings.MacRomanEncoding.indexOf(standardGlyphName);
  25718. }
  25719. if (unicodeOrCharCode === undefined) {
  25720. if (!properties.glyphNames && properties.hasIncludedToUnicodeMap && !(this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap)) {
  25721. const unicode = this.toUnicode.get(charCode);
  25722. if (unicode) {
  25723. unicodeOrCharCode = unicode.codePointAt(0);
  25724. }
  25725. }
  25726. if (unicodeOrCharCode === undefined) {
  25727. continue;
  25728. }
  25729. }
  25730. for (const mapping of cmapMappings) {
  25731. if (mapping.charCode !== unicodeOrCharCode) {
  25732. continue;
  25733. }
  25734. charCodeToGlyphId[charCode] = mapping.glyphId;
  25735. break;
  25736. }
  25737. }
  25738. } else if (cmapPlatformId === 0) {
  25739. for (const mapping of cmapMappings) {
  25740. charCodeToGlyphId[mapping.charCode] = mapping.glyphId;
  25741. }
  25742. forcePostTable = true;
  25743. } else {
  25744. for (const mapping of cmapMappings) {
  25745. let charCode = mapping.charCode;
  25746. if (cmapPlatformId === 3 && charCode >= 0xf000 && charCode <= 0xf0ff) {
  25747. charCode &= 0xff;
  25748. }
  25749. charCodeToGlyphId[charCode] = mapping.glyphId;
  25750. }
  25751. }
  25752. if (properties.glyphNames && (baseEncoding.length || this.differences.length)) {
  25753. for (let i = 0; i < 256; ++i) {
  25754. if (!forcePostTable && charCodeToGlyphId[i] !== undefined) {
  25755. continue;
  25756. }
  25757. const glyphName = this.differences[i] || baseEncoding[i];
  25758. if (!glyphName) {
  25759. continue;
  25760. }
  25761. const glyphId = properties.glyphNames.indexOf(glyphName);
  25762. if (glyphId > 0 && hasGlyph(glyphId)) {
  25763. charCodeToGlyphId[i] = glyphId;
  25764. }
  25765. }
  25766. }
  25767. }
  25768. if (charCodeToGlyphId.length === 0) {
  25769. charCodeToGlyphId[0] = 0;
  25770. }
  25771. let glyphZeroId = numGlyphsOut - 1;
  25772. if (!dupFirstEntry) {
  25773. glyphZeroId = 0;
  25774. }
  25775. if (!properties.cssFontInfo) {
  25776. const newMapping = adjustMapping(charCodeToGlyphId, hasGlyph, glyphZeroId, this.toUnicode);
  25777. this.toFontChar = newMapping.toFontChar;
  25778. tables.cmap = {
  25779. tag: "cmap",
  25780. data: createCmapTable(newMapping.charCodeToGlyphId, newMapping.toUnicodeExtraMap, numGlyphsOut)
  25781. };
  25782. if (!tables["OS/2"] || !validateOS2Table(tables["OS/2"], font)) {
  25783. tables["OS/2"] = {
  25784. tag: "OS/2",
  25785. data: createOS2Table(properties, newMapping.charCodeToGlyphId, metricsOverride)
  25786. };
  25787. }
  25788. }
  25789. if (!isTrueType) {
  25790. try {
  25791. cffFile = new _stream.Stream(tables["CFF "].data);
  25792. const parser = new _cff_parser.CFFParser(cffFile, properties, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  25793. cff = parser.parse();
  25794. cff.duplicateFirstGlyph();
  25795. const compiler = new _cff_parser.CFFCompiler(cff);
  25796. tables["CFF "].data = compiler.compile();
  25797. } catch (e) {
  25798. (0, _util.warn)("Failed to compile font " + properties.loadedName);
  25799. }
  25800. }
  25801. if (!tables.name) {
  25802. tables.name = {
  25803. tag: "name",
  25804. data: createNameTable(this.name)
  25805. };
  25806. } else {
  25807. const namePrototype = readNameTable(tables.name);
  25808. tables.name.data = createNameTable(name, namePrototype);
  25809. this.psName = namePrototype[0][6] || null;
  25810. }
  25811. const builder = new _opentype_file_builder.OpenTypeFileBuilder(header.version);
  25812. for (const tableTag in tables) {
  25813. builder.addTable(tableTag, tables[tableTag].data);
  25814. }
  25815. return builder.toArray();
  25816. }
  25817. convert(fontName, font, properties) {
  25818. properties.fixedPitch = false;
  25819. if (properties.builtInEncoding) {
  25820. adjustToUnicode(properties, properties.builtInEncoding);
  25821. }
  25822. let glyphZeroId = 1;
  25823. if (font instanceof _cff_font.CFFFont) {
  25824. glyphZeroId = font.numGlyphs - 1;
  25825. }
  25826. const mapping = font.getGlyphMapping(properties);
  25827. let newMapping = null;
  25828. let newCharCodeToGlyphId = mapping;
  25829. let toUnicodeExtraMap = null;
  25830. if (!properties.cssFontInfo) {
  25831. newMapping = adjustMapping(mapping, font.hasGlyphId.bind(font), glyphZeroId, this.toUnicode);
  25832. this.toFontChar = newMapping.toFontChar;
  25833. newCharCodeToGlyphId = newMapping.charCodeToGlyphId;
  25834. toUnicodeExtraMap = newMapping.toUnicodeExtraMap;
  25835. }
  25836. const numGlyphs = font.numGlyphs;
  25837. function getCharCodes(charCodeToGlyphId, glyphId) {
  25838. let charCodes = null;
  25839. for (const charCode in charCodeToGlyphId) {
  25840. if (glyphId === charCodeToGlyphId[charCode]) {
  25841. if (!charCodes) {
  25842. charCodes = [];
  25843. }
  25844. charCodes.push(charCode | 0);
  25845. }
  25846. }
  25847. return charCodes;
  25848. }
  25849. function createCharCode(charCodeToGlyphId, glyphId) {
  25850. for (const charCode in charCodeToGlyphId) {
  25851. if (glyphId === charCodeToGlyphId[charCode]) {
  25852. return charCode | 0;
  25853. }
  25854. }
  25855. newMapping.charCodeToGlyphId[newMapping.nextAvailableFontCharCode] = glyphId;
  25856. return newMapping.nextAvailableFontCharCode++;
  25857. }
  25858. const seacs = font.seacs;
  25859. if (newMapping && _fonts_utils.SEAC_ANALYSIS_ENABLED && seacs && seacs.length) {
  25860. const matrix = properties.fontMatrix || _util.FONT_IDENTITY_MATRIX;
  25861. const charset = font.getCharset();
  25862. const seacMap = Object.create(null);
  25863. for (let glyphId in seacs) {
  25864. glyphId |= 0;
  25865. const seac = seacs[glyphId];
  25866. const baseGlyphName = _encodings.StandardEncoding[seac[2]];
  25867. const accentGlyphName = _encodings.StandardEncoding[seac[3]];
  25868. const baseGlyphId = charset.indexOf(baseGlyphName);
  25869. const accentGlyphId = charset.indexOf(accentGlyphName);
  25870. if (baseGlyphId < 0 || accentGlyphId < 0) {
  25871. continue;
  25872. }
  25873. const accentOffset = {
  25874. x: seac[0] * matrix[0] + seac[1] * matrix[2] + matrix[4],
  25875. y: seac[0] * matrix[1] + seac[1] * matrix[3] + matrix[5]
  25876. };
  25877. const charCodes = getCharCodes(mapping, glyphId);
  25878. if (!charCodes) {
  25879. continue;
  25880. }
  25881. for (const charCode of charCodes) {
  25882. const charCodeToGlyphId = newMapping.charCodeToGlyphId;
  25883. const baseFontCharCode = createCharCode(charCodeToGlyphId, baseGlyphId);
  25884. const accentFontCharCode = createCharCode(charCodeToGlyphId, accentGlyphId);
  25885. seacMap[charCode] = {
  25886. baseFontCharCode,
  25887. accentFontCharCode,
  25888. accentOffset
  25889. };
  25890. }
  25891. }
  25892. properties.seacMap = seacMap;
  25893. }
  25894. const unitsPerEm = 1 / (properties.fontMatrix || _util.FONT_IDENTITY_MATRIX)[0];
  25895. const builder = new _opentype_file_builder.OpenTypeFileBuilder("\x4F\x54\x54\x4F");
  25896. builder.addTable("CFF ", font.data);
  25897. builder.addTable("OS/2", createOS2Table(properties, newCharCodeToGlyphId));
  25898. builder.addTable("cmap", createCmapTable(newCharCodeToGlyphId, toUnicodeExtraMap, numGlyphs));
  25899. 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");
  25900. 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));
  25901. builder.addTable("hmtx", function fontFieldsHmtx() {
  25902. const charstrings = font.charstrings;
  25903. const cffWidths = font.cff ? font.cff.widths : null;
  25904. let hmtx = "\x00\x00\x00\x00";
  25905. for (let i = 1, ii = numGlyphs; i < ii; i++) {
  25906. let width = 0;
  25907. if (charstrings) {
  25908. const charstring = charstrings[i - 1];
  25909. width = "width" in charstring ? charstring.width : 0;
  25910. } else if (cffWidths) {
  25911. width = Math.ceil(cffWidths[i] || 0);
  25912. }
  25913. hmtx += string16(width) + string16(0);
  25914. }
  25915. return hmtx;
  25916. }());
  25917. builder.addTable("maxp", "\x00\x00\x50\x00" + string16(numGlyphs));
  25918. builder.addTable("name", createNameTable(fontName));
  25919. builder.addTable("post", createPostTable(properties));
  25920. return builder.toArray();
  25921. }
  25922. get spaceWidth() {
  25923. const possibleSpaceReplacements = ["space", "minus", "one", "i", "I"];
  25924. let width;
  25925. for (const glyphName of possibleSpaceReplacements) {
  25926. if (glyphName in this.widths) {
  25927. width = this.widths[glyphName];
  25928. break;
  25929. }
  25930. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  25931. const glyphUnicode = glyphsUnicodeMap[glyphName];
  25932. let charcode = 0;
  25933. if (this.composite && this.cMap.contains(glyphUnicode)) {
  25934. charcode = this.cMap.lookup(glyphUnicode);
  25935. if (typeof charcode === "string") {
  25936. charcode = convertCidString(glyphUnicode, charcode);
  25937. }
  25938. }
  25939. if (!charcode && this.toUnicode) {
  25940. charcode = this.toUnicode.charCodeOf(glyphUnicode);
  25941. }
  25942. if (charcode <= 0) {
  25943. charcode = glyphUnicode;
  25944. }
  25945. width = this.widths[charcode];
  25946. if (width) {
  25947. break;
  25948. }
  25949. }
  25950. width = width || this.defaultWidth;
  25951. return (0, _util.shadow)(this, "spaceWidth", width);
  25952. }
  25953. _charToGlyph(charcode) {
  25954. let isSpace = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  25955. let glyph = this._glyphCache[charcode];
  25956. if (glyph && glyph.isSpace === isSpace) {
  25957. return glyph;
  25958. }
  25959. let fontCharCode, width, operatorListId;
  25960. let widthCode = charcode;
  25961. if (this.cMap && this.cMap.contains(charcode)) {
  25962. widthCode = this.cMap.lookup(charcode);
  25963. if (typeof widthCode === "string") {
  25964. widthCode = convertCidString(charcode, widthCode);
  25965. }
  25966. }
  25967. width = this.widths[widthCode];
  25968. if (typeof width !== "number") {
  25969. width = this.defaultWidth;
  25970. }
  25971. const vmetric = this.vmetrics && this.vmetrics[widthCode];
  25972. let unicode = this.toUnicode.get(charcode) || charcode;
  25973. if (typeof unicode === "number") {
  25974. unicode = String.fromCharCode(unicode);
  25975. }
  25976. let isInFont = this.toFontChar[charcode] !== undefined;
  25977. fontCharCode = this.toFontChar[charcode] || charcode;
  25978. if (this.missingFile) {
  25979. const glyphName = this.differences[charcode] || this.defaultEncoding[charcode];
  25980. if ((glyphName === ".notdef" || glyphName === "") && this.type === "Type1") {
  25981. fontCharCode = 0x20;
  25982. }
  25983. fontCharCode = (0, _unicode.mapSpecialUnicodeValues)(fontCharCode);
  25984. }
  25985. if (this.isType3Font) {
  25986. operatorListId = fontCharCode;
  25987. }
  25988. let accent = null;
  25989. if (this.seacMap && this.seacMap[charcode]) {
  25990. isInFont = true;
  25991. const seac = this.seacMap[charcode];
  25992. fontCharCode = seac.baseFontCharCode;
  25993. accent = {
  25994. fontChar: String.fromCodePoint(seac.accentFontCharCode),
  25995. offset: seac.accentOffset
  25996. };
  25997. }
  25998. let fontChar = "";
  25999. if (typeof fontCharCode === "number") {
  26000. if (fontCharCode <= 0x10ffff) {
  26001. fontChar = String.fromCodePoint(fontCharCode);
  26002. } else {
  26003. (0, _util.warn)(`charToGlyph - invalid fontCharCode: ${fontCharCode}`);
  26004. }
  26005. }
  26006. glyph = new Glyph(charcode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont);
  26007. return this._glyphCache[charcode] = glyph;
  26008. }
  26009. charsToGlyphs(chars) {
  26010. let glyphs = this._charsCache[chars];
  26011. if (glyphs) {
  26012. return glyphs;
  26013. }
  26014. glyphs = [];
  26015. if (this.cMap) {
  26016. const c = Object.create(null),
  26017. ii = chars.length;
  26018. let i = 0;
  26019. while (i < ii) {
  26020. this.cMap.readCharCode(chars, i, c);
  26021. const {
  26022. charcode,
  26023. length
  26024. } = c;
  26025. i += length;
  26026. const glyph = this._charToGlyph(charcode, length === 1 && chars.charCodeAt(i - 1) === 0x20);
  26027. glyphs.push(glyph);
  26028. }
  26029. } else {
  26030. for (let i = 0, ii = chars.length; i < ii; ++i) {
  26031. const charcode = chars.charCodeAt(i);
  26032. const glyph = this._charToGlyph(charcode, charcode === 0x20);
  26033. glyphs.push(glyph);
  26034. }
  26035. }
  26036. return this._charsCache[chars] = glyphs;
  26037. }
  26038. getCharPositions(chars) {
  26039. const positions = [];
  26040. if (this.cMap) {
  26041. const c = Object.create(null);
  26042. let i = 0;
  26043. while (i < chars.length) {
  26044. this.cMap.readCharCode(chars, i, c);
  26045. const length = c.length;
  26046. positions.push([i, i + length]);
  26047. i += length;
  26048. }
  26049. } else {
  26050. for (let i = 0, ii = chars.length; i < ii; ++i) {
  26051. positions.push([i, i + 1]);
  26052. }
  26053. }
  26054. return positions;
  26055. }
  26056. get glyphCacheValues() {
  26057. return Object.values(this._glyphCache);
  26058. }
  26059. encodeString(str) {
  26060. const buffers = [];
  26061. const currentBuf = [];
  26062. const hasCurrentBufErrors = () => buffers.length % 2 === 1;
  26063. const getCharCode = this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap ? unicode => this.toUnicode.charCodeOf(unicode) : unicode => this.toUnicode.charCodeOf(String.fromCodePoint(unicode));
  26064. for (let i = 0, ii = str.length; i < ii; i++) {
  26065. const unicode = str.codePointAt(i);
  26066. if (unicode > 0xd7ff && (unicode < 0xe000 || unicode > 0xfffd)) {
  26067. i++;
  26068. }
  26069. if (this.toUnicode) {
  26070. const charCode = getCharCode(unicode);
  26071. if (charCode !== -1) {
  26072. if (hasCurrentBufErrors()) {
  26073. buffers.push(currentBuf.join(""));
  26074. currentBuf.length = 0;
  26075. }
  26076. const charCodeLength = this.cMap ? this.cMap.getCharCodeLength(charCode) : 1;
  26077. for (let j = charCodeLength - 1; j >= 0; j--) {
  26078. currentBuf.push(String.fromCharCode(charCode >> 8 * j & 0xff));
  26079. }
  26080. continue;
  26081. }
  26082. }
  26083. if (!hasCurrentBufErrors()) {
  26084. buffers.push(currentBuf.join(""));
  26085. currentBuf.length = 0;
  26086. }
  26087. currentBuf.push(String.fromCodePoint(unicode));
  26088. }
  26089. buffers.push(currentBuf.join(""));
  26090. return buffers;
  26091. }
  26092. }
  26093. exports.Font = Font;
  26094. class ErrorFont {
  26095. constructor(error) {
  26096. this.error = error;
  26097. this.loadedName = "g_font_error";
  26098. this.missingFile = true;
  26099. }
  26100. charsToGlyphs() {
  26101. return [];
  26102. }
  26103. encodeString(chars) {
  26104. return [chars];
  26105. }
  26106. exportData() {
  26107. let extraProperties = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  26108. return {
  26109. error: this.error
  26110. };
  26111. }
  26112. }
  26113. exports.ErrorFont = ErrorFont;
  26114. /***/ }),
  26115. /* 164 */
  26116. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  26117. "use strict";
  26118. Object.defineProperty(exports, "__esModule", ({
  26119. value: true
  26120. }));
  26121. exports.CFFTopDict = exports.CFFStrings = exports.CFFStandardStrings = exports.CFFPrivateDict = exports.CFFParser = exports.CFFIndex = exports.CFFHeader = exports.CFFFDSelect = exports.CFFCompiler = exports.CFFCharset = exports.CFF = void 0;
  26122. var _util = __w_pdfjs_require__(2);
  26123. var _charsets = __w_pdfjs_require__(165);
  26124. var _encodings = __w_pdfjs_require__(166);
  26125. const MAX_SUBR_NESTING = 10;
  26126. 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"];
  26127. exports.CFFStandardStrings = CFFStandardStrings;
  26128. const NUM_STANDARD_CFF_STRINGS = 391;
  26129. const CharstringValidationData = [null, {
  26130. id: "hstem",
  26131. min: 2,
  26132. stackClearing: true,
  26133. stem: true
  26134. }, null, {
  26135. id: "vstem",
  26136. min: 2,
  26137. stackClearing: true,
  26138. stem: true
  26139. }, {
  26140. id: "vmoveto",
  26141. min: 1,
  26142. stackClearing: true
  26143. }, {
  26144. id: "rlineto",
  26145. min: 2,
  26146. resetStack: true
  26147. }, {
  26148. id: "hlineto",
  26149. min: 1,
  26150. resetStack: true
  26151. }, {
  26152. id: "vlineto",
  26153. min: 1,
  26154. resetStack: true
  26155. }, {
  26156. id: "rrcurveto",
  26157. min: 6,
  26158. resetStack: true
  26159. }, null, {
  26160. id: "callsubr",
  26161. min: 1,
  26162. undefStack: true
  26163. }, {
  26164. id: "return",
  26165. min: 0,
  26166. undefStack: true
  26167. }, null, null, {
  26168. id: "endchar",
  26169. min: 0,
  26170. stackClearing: true
  26171. }, null, null, null, {
  26172. id: "hstemhm",
  26173. min: 2,
  26174. stackClearing: true,
  26175. stem: true
  26176. }, {
  26177. id: "hintmask",
  26178. min: 0,
  26179. stackClearing: true
  26180. }, {
  26181. id: "cntrmask",
  26182. min: 0,
  26183. stackClearing: true
  26184. }, {
  26185. id: "rmoveto",
  26186. min: 2,
  26187. stackClearing: true
  26188. }, {
  26189. id: "hmoveto",
  26190. min: 1,
  26191. stackClearing: true
  26192. }, {
  26193. id: "vstemhm",
  26194. min: 2,
  26195. stackClearing: true,
  26196. stem: true
  26197. }, {
  26198. id: "rcurveline",
  26199. min: 8,
  26200. resetStack: true
  26201. }, {
  26202. id: "rlinecurve",
  26203. min: 8,
  26204. resetStack: true
  26205. }, {
  26206. id: "vvcurveto",
  26207. min: 4,
  26208. resetStack: true
  26209. }, {
  26210. id: "hhcurveto",
  26211. min: 4,
  26212. resetStack: true
  26213. }, null, {
  26214. id: "callgsubr",
  26215. min: 1,
  26216. undefStack: true
  26217. }, {
  26218. id: "vhcurveto",
  26219. min: 4,
  26220. resetStack: true
  26221. }, {
  26222. id: "hvcurveto",
  26223. min: 4,
  26224. resetStack: true
  26225. }];
  26226. const CharstringValidationData12 = [null, null, null, {
  26227. id: "and",
  26228. min: 2,
  26229. stackDelta: -1
  26230. }, {
  26231. id: "or",
  26232. min: 2,
  26233. stackDelta: -1
  26234. }, {
  26235. id: "not",
  26236. min: 1,
  26237. stackDelta: 0
  26238. }, null, null, null, {
  26239. id: "abs",
  26240. min: 1,
  26241. stackDelta: 0
  26242. }, {
  26243. id: "add",
  26244. min: 2,
  26245. stackDelta: -1,
  26246. stackFn(stack, index) {
  26247. stack[index - 2] = stack[index - 2] + stack[index - 1];
  26248. }
  26249. }, {
  26250. id: "sub",
  26251. min: 2,
  26252. stackDelta: -1,
  26253. stackFn(stack, index) {
  26254. stack[index - 2] = stack[index - 2] - stack[index - 1];
  26255. }
  26256. }, {
  26257. id: "div",
  26258. min: 2,
  26259. stackDelta: -1,
  26260. stackFn(stack, index) {
  26261. stack[index - 2] = stack[index - 2] / stack[index - 1];
  26262. }
  26263. }, null, {
  26264. id: "neg",
  26265. min: 1,
  26266. stackDelta: 0,
  26267. stackFn(stack, index) {
  26268. stack[index - 1] = -stack[index - 1];
  26269. }
  26270. }, {
  26271. id: "eq",
  26272. min: 2,
  26273. stackDelta: -1
  26274. }, null, null, {
  26275. id: "drop",
  26276. min: 1,
  26277. stackDelta: -1
  26278. }, null, {
  26279. id: "put",
  26280. min: 2,
  26281. stackDelta: -2
  26282. }, {
  26283. id: "get",
  26284. min: 1,
  26285. stackDelta: 0
  26286. }, {
  26287. id: "ifelse",
  26288. min: 4,
  26289. stackDelta: -3
  26290. }, {
  26291. id: "random",
  26292. min: 0,
  26293. stackDelta: 1
  26294. }, {
  26295. id: "mul",
  26296. min: 2,
  26297. stackDelta: -1,
  26298. stackFn(stack, index) {
  26299. stack[index - 2] = stack[index - 2] * stack[index - 1];
  26300. }
  26301. }, null, {
  26302. id: "sqrt",
  26303. min: 1,
  26304. stackDelta: 0
  26305. }, {
  26306. id: "dup",
  26307. min: 1,
  26308. stackDelta: 1
  26309. }, {
  26310. id: "exch",
  26311. min: 2,
  26312. stackDelta: 0
  26313. }, {
  26314. id: "index",
  26315. min: 2,
  26316. stackDelta: 0
  26317. }, {
  26318. id: "roll",
  26319. min: 3,
  26320. stackDelta: -2
  26321. }, null, null, null, {
  26322. id: "hflex",
  26323. min: 7,
  26324. resetStack: true
  26325. }, {
  26326. id: "flex",
  26327. min: 13,
  26328. resetStack: true
  26329. }, {
  26330. id: "hflex1",
  26331. min: 9,
  26332. resetStack: true
  26333. }, {
  26334. id: "flex1",
  26335. min: 11,
  26336. resetStack: true
  26337. }];
  26338. class CFFParser {
  26339. constructor(file, properties, seacAnalysisEnabled) {
  26340. this.bytes = file.getBytes();
  26341. this.properties = properties;
  26342. this.seacAnalysisEnabled = !!seacAnalysisEnabled;
  26343. }
  26344. parse() {
  26345. const properties = this.properties;
  26346. const cff = new CFF();
  26347. this.cff = cff;
  26348. const header = this.parseHeader();
  26349. const nameIndex = this.parseIndex(header.endPos);
  26350. const topDictIndex = this.parseIndex(nameIndex.endPos);
  26351. const stringIndex = this.parseIndex(topDictIndex.endPos);
  26352. const globalSubrIndex = this.parseIndex(stringIndex.endPos);
  26353. const topDictParsed = this.parseDict(topDictIndex.obj.get(0));
  26354. const topDict = this.createDict(CFFTopDict, topDictParsed, cff.strings);
  26355. cff.header = header.obj;
  26356. cff.names = this.parseNameIndex(nameIndex.obj);
  26357. cff.strings = this.parseStringIndex(stringIndex.obj);
  26358. cff.topDict = topDict;
  26359. cff.globalSubrIndex = globalSubrIndex.obj;
  26360. this.parsePrivateDict(cff.topDict);
  26361. cff.isCIDFont = topDict.hasName("ROS");
  26362. const charStringOffset = topDict.getByName("CharStrings");
  26363. const charStringIndex = this.parseIndex(charStringOffset).obj;
  26364. const fontMatrix = topDict.getByName("FontMatrix");
  26365. if (fontMatrix) {
  26366. properties.fontMatrix = fontMatrix;
  26367. }
  26368. const fontBBox = topDict.getByName("FontBBox");
  26369. if (fontBBox) {
  26370. properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
  26371. properties.descent = Math.min(fontBBox[1], fontBBox[3]);
  26372. properties.ascentScaled = true;
  26373. }
  26374. let charset, encoding;
  26375. if (cff.isCIDFont) {
  26376. const fdArrayIndex = this.parseIndex(topDict.getByName("FDArray")).obj;
  26377. for (let i = 0, ii = fdArrayIndex.count; i < ii; ++i) {
  26378. const dictRaw = fdArrayIndex.get(i);
  26379. const fontDict = this.createDict(CFFTopDict, this.parseDict(dictRaw), cff.strings);
  26380. this.parsePrivateDict(fontDict);
  26381. cff.fdArray.push(fontDict);
  26382. }
  26383. encoding = null;
  26384. charset = this.parseCharsets(topDict.getByName("charset"), charStringIndex.count, cff.strings, true);
  26385. cff.fdSelect = this.parseFDSelect(topDict.getByName("FDSelect"), charStringIndex.count);
  26386. } else {
  26387. charset = this.parseCharsets(topDict.getByName("charset"), charStringIndex.count, cff.strings, false);
  26388. encoding = this.parseEncoding(topDict.getByName("Encoding"), properties, cff.strings, charset.charset);
  26389. }
  26390. cff.charset = charset;
  26391. cff.encoding = encoding;
  26392. const charStringsAndSeacs = this.parseCharStrings({
  26393. charStrings: charStringIndex,
  26394. localSubrIndex: topDict.privateDict.subrsIndex,
  26395. globalSubrIndex: globalSubrIndex.obj,
  26396. fdSelect: cff.fdSelect,
  26397. fdArray: cff.fdArray,
  26398. privateDict: topDict.privateDict
  26399. });
  26400. cff.charStrings = charStringsAndSeacs.charStrings;
  26401. cff.seacs = charStringsAndSeacs.seacs;
  26402. cff.widths = charStringsAndSeacs.widths;
  26403. return cff;
  26404. }
  26405. parseHeader() {
  26406. let bytes = this.bytes;
  26407. const bytesLength = bytes.length;
  26408. let offset = 0;
  26409. while (offset < bytesLength && bytes[offset] !== 1) {
  26410. ++offset;
  26411. }
  26412. if (offset >= bytesLength) {
  26413. throw new _util.FormatError("Invalid CFF header");
  26414. }
  26415. if (offset !== 0) {
  26416. (0, _util.info)("cff data is shifted");
  26417. bytes = bytes.subarray(offset);
  26418. this.bytes = bytes;
  26419. }
  26420. const major = bytes[0];
  26421. const minor = bytes[1];
  26422. const hdrSize = bytes[2];
  26423. const offSize = bytes[3];
  26424. const header = new CFFHeader(major, minor, hdrSize, offSize);
  26425. return {
  26426. obj: header,
  26427. endPos: hdrSize
  26428. };
  26429. }
  26430. parseDict(dict) {
  26431. let pos = 0;
  26432. function parseOperand() {
  26433. let value = dict[pos++];
  26434. if (value === 30) {
  26435. return parseFloatOperand();
  26436. } else if (value === 28) {
  26437. value = dict[pos++];
  26438. value = (value << 24 | dict[pos++] << 16) >> 16;
  26439. return value;
  26440. } else if (value === 29) {
  26441. value = dict[pos++];
  26442. value = value << 8 | dict[pos++];
  26443. value = value << 8 | dict[pos++];
  26444. value = value << 8 | dict[pos++];
  26445. return value;
  26446. } else if (value >= 32 && value <= 246) {
  26447. return value - 139;
  26448. } else if (value >= 247 && value <= 250) {
  26449. return (value - 247) * 256 + dict[pos++] + 108;
  26450. } else if (value >= 251 && value <= 254) {
  26451. return -((value - 251) * 256) - dict[pos++] - 108;
  26452. }
  26453. (0, _util.warn)('CFFParser_parseDict: "' + value + '" is a reserved command.');
  26454. return NaN;
  26455. }
  26456. function parseFloatOperand() {
  26457. let str = "";
  26458. const eof = 15;
  26459. const lookup = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ".", "E", "E-", null, "-"];
  26460. const length = dict.length;
  26461. while (pos < length) {
  26462. const b = dict[pos++];
  26463. const b1 = b >> 4;
  26464. const b2 = b & 15;
  26465. if (b1 === eof) {
  26466. break;
  26467. }
  26468. str += lookup[b1];
  26469. if (b2 === eof) {
  26470. break;
  26471. }
  26472. str += lookup[b2];
  26473. }
  26474. return parseFloat(str);
  26475. }
  26476. let operands = [];
  26477. const entries = [];
  26478. pos = 0;
  26479. const end = dict.length;
  26480. while (pos < end) {
  26481. let b = dict[pos];
  26482. if (b <= 21) {
  26483. if (b === 12) {
  26484. b = b << 8 | dict[++pos];
  26485. }
  26486. entries.push([b, operands]);
  26487. operands = [];
  26488. ++pos;
  26489. } else {
  26490. operands.push(parseOperand());
  26491. }
  26492. }
  26493. return entries;
  26494. }
  26495. parseIndex(pos) {
  26496. const cffIndex = new CFFIndex();
  26497. const bytes = this.bytes;
  26498. const count = bytes[pos++] << 8 | bytes[pos++];
  26499. const offsets = [];
  26500. let end = pos;
  26501. let i, ii;
  26502. if (count !== 0) {
  26503. const offsetSize = bytes[pos++];
  26504. const startPos = pos + (count + 1) * offsetSize - 1;
  26505. for (i = 0, ii = count + 1; i < ii; ++i) {
  26506. let offset = 0;
  26507. for (let j = 0; j < offsetSize; ++j) {
  26508. offset <<= 8;
  26509. offset += bytes[pos++];
  26510. }
  26511. offsets.push(startPos + offset);
  26512. }
  26513. end = offsets[count];
  26514. }
  26515. for (i = 0, ii = offsets.length - 1; i < ii; ++i) {
  26516. const offsetStart = offsets[i];
  26517. const offsetEnd = offsets[i + 1];
  26518. cffIndex.add(bytes.subarray(offsetStart, offsetEnd));
  26519. }
  26520. return {
  26521. obj: cffIndex,
  26522. endPos: end
  26523. };
  26524. }
  26525. parseNameIndex(index) {
  26526. const names = [];
  26527. for (let i = 0, ii = index.count; i < ii; ++i) {
  26528. const name = index.get(i);
  26529. names.push((0, _util.bytesToString)(name));
  26530. }
  26531. return names;
  26532. }
  26533. parseStringIndex(index) {
  26534. const strings = new CFFStrings();
  26535. for (let i = 0, ii = index.count; i < ii; ++i) {
  26536. const data = index.get(i);
  26537. strings.add((0, _util.bytesToString)(data));
  26538. }
  26539. return strings;
  26540. }
  26541. createDict(Type, dict, strings) {
  26542. const cffDict = new Type(strings);
  26543. for (const [key, value] of dict) {
  26544. cffDict.setByKey(key, value);
  26545. }
  26546. return cffDict;
  26547. }
  26548. parseCharString(state, data, localSubrIndex, globalSubrIndex) {
  26549. if (!data || state.callDepth > MAX_SUBR_NESTING) {
  26550. return false;
  26551. }
  26552. let stackSize = state.stackSize;
  26553. const stack = state.stack;
  26554. const length = data.length;
  26555. for (let j = 0; j < length;) {
  26556. const value = data[j++];
  26557. let validationCommand = null;
  26558. if (value === 12) {
  26559. const q = data[j++];
  26560. if (q === 0) {
  26561. data[j - 2] = 139;
  26562. data[j - 1] = 22;
  26563. stackSize = 0;
  26564. } else {
  26565. validationCommand = CharstringValidationData12[q];
  26566. }
  26567. } else if (value === 28) {
  26568. stack[stackSize] = (data[j] << 24 | data[j + 1] << 16) >> 16;
  26569. j += 2;
  26570. stackSize++;
  26571. } else if (value === 14) {
  26572. if (stackSize >= 4) {
  26573. stackSize -= 4;
  26574. if (this.seacAnalysisEnabled) {
  26575. state.seac = stack.slice(stackSize, stackSize + 4);
  26576. return false;
  26577. }
  26578. }
  26579. validationCommand = CharstringValidationData[value];
  26580. } else if (value >= 32 && value <= 246) {
  26581. stack[stackSize] = value - 139;
  26582. stackSize++;
  26583. } else if (value >= 247 && value <= 254) {
  26584. stack[stackSize] = value < 251 ? (value - 247 << 8) + data[j] + 108 : -(value - 251 << 8) - data[j] - 108;
  26585. j++;
  26586. stackSize++;
  26587. } else if (value === 255) {
  26588. stack[stackSize] = (data[j] << 24 | data[j + 1] << 16 | data[j + 2] << 8 | data[j + 3]) / 65536;
  26589. j += 4;
  26590. stackSize++;
  26591. } else if (value === 19 || value === 20) {
  26592. state.hints += stackSize >> 1;
  26593. j += state.hints + 7 >> 3;
  26594. stackSize %= 2;
  26595. validationCommand = CharstringValidationData[value];
  26596. } else if (value === 10 || value === 29) {
  26597. let subrsIndex;
  26598. if (value === 10) {
  26599. subrsIndex = localSubrIndex;
  26600. } else {
  26601. subrsIndex = globalSubrIndex;
  26602. }
  26603. if (!subrsIndex) {
  26604. validationCommand = CharstringValidationData[value];
  26605. (0, _util.warn)("Missing subrsIndex for " + validationCommand.id);
  26606. return false;
  26607. }
  26608. let bias = 32768;
  26609. if (subrsIndex.count < 1240) {
  26610. bias = 107;
  26611. } else if (subrsIndex.count < 33900) {
  26612. bias = 1131;
  26613. }
  26614. const subrNumber = stack[--stackSize] + bias;
  26615. if (subrNumber < 0 || subrNumber >= subrsIndex.count || isNaN(subrNumber)) {
  26616. validationCommand = CharstringValidationData[value];
  26617. (0, _util.warn)("Out of bounds subrIndex for " + validationCommand.id);
  26618. return false;
  26619. }
  26620. state.stackSize = stackSize;
  26621. state.callDepth++;
  26622. const valid = this.parseCharString(state, subrsIndex.get(subrNumber), localSubrIndex, globalSubrIndex);
  26623. if (!valid) {
  26624. return false;
  26625. }
  26626. state.callDepth--;
  26627. stackSize = state.stackSize;
  26628. continue;
  26629. } else if (value === 11) {
  26630. state.stackSize = stackSize;
  26631. return true;
  26632. } else if (value === 0 && j === data.length) {
  26633. data[j - 1] = 14;
  26634. validationCommand = CharstringValidationData[14];
  26635. } else {
  26636. validationCommand = CharstringValidationData[value];
  26637. }
  26638. if (validationCommand) {
  26639. if (validationCommand.stem) {
  26640. state.hints += stackSize >> 1;
  26641. if (value === 3 || value === 23) {
  26642. state.hasVStems = true;
  26643. } else if (state.hasVStems && (value === 1 || value === 18)) {
  26644. (0, _util.warn)("CFF stem hints are in wrong order");
  26645. data[j - 1] = value === 1 ? 3 : 23;
  26646. }
  26647. }
  26648. if ("min" in validationCommand) {
  26649. if (!state.undefStack && stackSize < validationCommand.min) {
  26650. (0, _util.warn)("Not enough parameters for " + validationCommand.id + "; actual: " + stackSize + ", expected: " + validationCommand.min);
  26651. if (stackSize === 0) {
  26652. data[j - 1] = 14;
  26653. return true;
  26654. }
  26655. return false;
  26656. }
  26657. }
  26658. if (state.firstStackClearing && validationCommand.stackClearing) {
  26659. state.firstStackClearing = false;
  26660. stackSize -= validationCommand.min;
  26661. if (stackSize >= 2 && validationCommand.stem) {
  26662. stackSize %= 2;
  26663. } else if (stackSize > 1) {
  26664. (0, _util.warn)("Found too many parameters for stack-clearing command");
  26665. }
  26666. if (stackSize > 0) {
  26667. state.width = stack[stackSize - 1];
  26668. }
  26669. }
  26670. if ("stackDelta" in validationCommand) {
  26671. if ("stackFn" in validationCommand) {
  26672. validationCommand.stackFn(stack, stackSize);
  26673. }
  26674. stackSize += validationCommand.stackDelta;
  26675. } else if (validationCommand.stackClearing) {
  26676. stackSize = 0;
  26677. } else if (validationCommand.resetStack) {
  26678. stackSize = 0;
  26679. state.undefStack = false;
  26680. } else if (validationCommand.undefStack) {
  26681. stackSize = 0;
  26682. state.undefStack = true;
  26683. state.firstStackClearing = false;
  26684. }
  26685. }
  26686. }
  26687. state.stackSize = stackSize;
  26688. return true;
  26689. }
  26690. parseCharStrings(_ref) {
  26691. let {
  26692. charStrings,
  26693. localSubrIndex,
  26694. globalSubrIndex,
  26695. fdSelect,
  26696. fdArray,
  26697. privateDict
  26698. } = _ref;
  26699. const seacs = [];
  26700. const widths = [];
  26701. const count = charStrings.count;
  26702. for (let i = 0; i < count; i++) {
  26703. const charstring = charStrings.get(i);
  26704. const state = {
  26705. callDepth: 0,
  26706. stackSize: 0,
  26707. stack: [],
  26708. undefStack: true,
  26709. hints: 0,
  26710. firstStackClearing: true,
  26711. seac: null,
  26712. width: null,
  26713. hasVStems: false
  26714. };
  26715. let valid = true;
  26716. let localSubrToUse = null;
  26717. let privateDictToUse = privateDict;
  26718. if (fdSelect && fdArray.length) {
  26719. const fdIndex = fdSelect.getFDIndex(i);
  26720. if (fdIndex === -1) {
  26721. (0, _util.warn)("Glyph index is not in fd select.");
  26722. valid = false;
  26723. }
  26724. if (fdIndex >= fdArray.length) {
  26725. (0, _util.warn)("Invalid fd index for glyph index.");
  26726. valid = false;
  26727. }
  26728. if (valid) {
  26729. privateDictToUse = fdArray[fdIndex].privateDict;
  26730. localSubrToUse = privateDictToUse.subrsIndex;
  26731. }
  26732. } else if (localSubrIndex) {
  26733. localSubrToUse = localSubrIndex;
  26734. }
  26735. if (valid) {
  26736. valid = this.parseCharString(state, charstring, localSubrToUse, globalSubrIndex);
  26737. }
  26738. if (state.width !== null) {
  26739. const nominalWidth = privateDictToUse.getByName("nominalWidthX");
  26740. widths[i] = nominalWidth + state.width;
  26741. } else {
  26742. const defaultWidth = privateDictToUse.getByName("defaultWidthX");
  26743. widths[i] = defaultWidth;
  26744. }
  26745. if (state.seac !== null) {
  26746. seacs[i] = state.seac;
  26747. }
  26748. if (!valid) {
  26749. charStrings.set(i, new Uint8Array([14]));
  26750. }
  26751. }
  26752. return {
  26753. charStrings,
  26754. seacs,
  26755. widths
  26756. };
  26757. }
  26758. emptyPrivateDictionary(parentDict) {
  26759. const privateDict = this.createDict(CFFPrivateDict, [], parentDict.strings);
  26760. parentDict.setByKey(18, [0, 0]);
  26761. parentDict.privateDict = privateDict;
  26762. }
  26763. parsePrivateDict(parentDict) {
  26764. if (!parentDict.hasName("Private")) {
  26765. this.emptyPrivateDictionary(parentDict);
  26766. return;
  26767. }
  26768. const privateOffset = parentDict.getByName("Private");
  26769. if (!Array.isArray(privateOffset) || privateOffset.length !== 2) {
  26770. parentDict.removeByName("Private");
  26771. return;
  26772. }
  26773. const size = privateOffset[0];
  26774. const offset = privateOffset[1];
  26775. if (size === 0 || offset >= this.bytes.length) {
  26776. this.emptyPrivateDictionary(parentDict);
  26777. return;
  26778. }
  26779. const privateDictEnd = offset + size;
  26780. const dictData = this.bytes.subarray(offset, privateDictEnd);
  26781. const dict = this.parseDict(dictData);
  26782. const privateDict = this.createDict(CFFPrivateDict, dict, parentDict.strings);
  26783. parentDict.privateDict = privateDict;
  26784. if (!privateDict.getByName("Subrs")) {
  26785. return;
  26786. }
  26787. const subrsOffset = privateDict.getByName("Subrs");
  26788. const relativeOffset = offset + subrsOffset;
  26789. if (subrsOffset === 0 || relativeOffset >= this.bytes.length) {
  26790. this.emptyPrivateDictionary(parentDict);
  26791. return;
  26792. }
  26793. const subrsIndex = this.parseIndex(relativeOffset);
  26794. privateDict.subrsIndex = subrsIndex.obj;
  26795. }
  26796. parseCharsets(pos, length, strings, cid) {
  26797. if (pos === 0) {
  26798. return new CFFCharset(true, CFFCharsetPredefinedTypes.ISO_ADOBE, _charsets.ISOAdobeCharset);
  26799. } else if (pos === 1) {
  26800. return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT, _charsets.ExpertCharset);
  26801. } else if (pos === 2) {
  26802. return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT_SUBSET, _charsets.ExpertSubsetCharset);
  26803. }
  26804. const bytes = this.bytes;
  26805. const start = pos;
  26806. const format = bytes[pos++];
  26807. const charset = [cid ? 0 : ".notdef"];
  26808. let id, count, i;
  26809. length -= 1;
  26810. switch (format) {
  26811. case 0:
  26812. for (i = 0; i < length; i++) {
  26813. id = bytes[pos++] << 8 | bytes[pos++];
  26814. charset.push(cid ? id : strings.get(id));
  26815. }
  26816. break;
  26817. case 1:
  26818. while (charset.length <= length) {
  26819. id = bytes[pos++] << 8 | bytes[pos++];
  26820. count = bytes[pos++];
  26821. for (i = 0; i <= count; i++) {
  26822. charset.push(cid ? id++ : strings.get(id++));
  26823. }
  26824. }
  26825. break;
  26826. case 2:
  26827. while (charset.length <= length) {
  26828. id = bytes[pos++] << 8 | bytes[pos++];
  26829. count = bytes[pos++] << 8 | bytes[pos++];
  26830. for (i = 0; i <= count; i++) {
  26831. charset.push(cid ? id++ : strings.get(id++));
  26832. }
  26833. }
  26834. break;
  26835. default:
  26836. throw new _util.FormatError("Unknown charset format");
  26837. }
  26838. const end = pos;
  26839. const raw = bytes.subarray(start, end);
  26840. return new CFFCharset(false, format, charset, raw);
  26841. }
  26842. parseEncoding(pos, properties, strings, charset) {
  26843. const encoding = Object.create(null);
  26844. const bytes = this.bytes;
  26845. let predefined = false;
  26846. let format, i, ii;
  26847. let raw = null;
  26848. function readSupplement() {
  26849. const supplementsCount = bytes[pos++];
  26850. for (i = 0; i < supplementsCount; i++) {
  26851. const code = bytes[pos++];
  26852. const sid = (bytes[pos++] << 8) + (bytes[pos++] & 0xff);
  26853. encoding[code] = charset.indexOf(strings.get(sid));
  26854. }
  26855. }
  26856. if (pos === 0 || pos === 1) {
  26857. predefined = true;
  26858. format = pos;
  26859. const baseEncoding = pos ? _encodings.ExpertEncoding : _encodings.StandardEncoding;
  26860. for (i = 0, ii = charset.length; i < ii; i++) {
  26861. const index = baseEncoding.indexOf(charset[i]);
  26862. if (index !== -1) {
  26863. encoding[index] = i;
  26864. }
  26865. }
  26866. } else {
  26867. const dataStart = pos;
  26868. format = bytes[pos++];
  26869. switch (format & 0x7f) {
  26870. case 0:
  26871. const glyphsCount = bytes[pos++];
  26872. for (i = 1; i <= glyphsCount; i++) {
  26873. encoding[bytes[pos++]] = i;
  26874. }
  26875. break;
  26876. case 1:
  26877. const rangesCount = bytes[pos++];
  26878. let gid = 1;
  26879. for (i = 0; i < rangesCount; i++) {
  26880. const start = bytes[pos++];
  26881. const left = bytes[pos++];
  26882. for (let j = start; j <= start + left; j++) {
  26883. encoding[j] = gid++;
  26884. }
  26885. }
  26886. break;
  26887. default:
  26888. throw new _util.FormatError(`Unknown encoding format: ${format} in CFF`);
  26889. }
  26890. const dataEnd = pos;
  26891. if (format & 0x80) {
  26892. bytes[dataStart] &= 0x7f;
  26893. readSupplement();
  26894. }
  26895. raw = bytes.subarray(dataStart, dataEnd);
  26896. }
  26897. format &= 0x7f;
  26898. return new CFFEncoding(predefined, format, encoding, raw);
  26899. }
  26900. parseFDSelect(pos, length) {
  26901. const bytes = this.bytes;
  26902. const format = bytes[pos++];
  26903. const fdSelect = [];
  26904. let i;
  26905. switch (format) {
  26906. case 0:
  26907. for (i = 0; i < length; ++i) {
  26908. const id = bytes[pos++];
  26909. fdSelect.push(id);
  26910. }
  26911. break;
  26912. case 3:
  26913. const rangesCount = bytes[pos++] << 8 | bytes[pos++];
  26914. for (i = 0; i < rangesCount; ++i) {
  26915. let first = bytes[pos++] << 8 | bytes[pos++];
  26916. if (i === 0 && first !== 0) {
  26917. (0, _util.warn)("parseFDSelect: The first range must have a first GID of 0" + " -- trying to recover.");
  26918. first = 0;
  26919. }
  26920. const fdIndex = bytes[pos++];
  26921. const next = bytes[pos] << 8 | bytes[pos + 1];
  26922. for (let j = first; j < next; ++j) {
  26923. fdSelect.push(fdIndex);
  26924. }
  26925. }
  26926. pos += 2;
  26927. break;
  26928. default:
  26929. throw new _util.FormatError(`parseFDSelect: Unknown format "${format}".`);
  26930. }
  26931. if (fdSelect.length !== length) {
  26932. throw new _util.FormatError("parseFDSelect: Invalid font data.");
  26933. }
  26934. return new CFFFDSelect(format, fdSelect);
  26935. }
  26936. }
  26937. exports.CFFParser = CFFParser;
  26938. class CFF {
  26939. constructor() {
  26940. this.header = null;
  26941. this.names = [];
  26942. this.topDict = null;
  26943. this.strings = new CFFStrings();
  26944. this.globalSubrIndex = null;
  26945. this.encoding = null;
  26946. this.charset = null;
  26947. this.charStrings = null;
  26948. this.fdArray = [];
  26949. this.fdSelect = null;
  26950. this.isCIDFont = false;
  26951. }
  26952. duplicateFirstGlyph() {
  26953. if (this.charStrings.count >= 65535) {
  26954. (0, _util.warn)("Not enough space in charstrings to duplicate first glyph.");
  26955. return;
  26956. }
  26957. const glyphZero = this.charStrings.get(0);
  26958. this.charStrings.add(glyphZero);
  26959. if (this.isCIDFont) {
  26960. this.fdSelect.fdSelect.push(this.fdSelect.fdSelect[0]);
  26961. }
  26962. }
  26963. hasGlyphId(id) {
  26964. if (id < 0 || id >= this.charStrings.count) {
  26965. return false;
  26966. }
  26967. const glyph = this.charStrings.get(id);
  26968. return glyph.length > 0;
  26969. }
  26970. }
  26971. exports.CFF = CFF;
  26972. class CFFHeader {
  26973. constructor(major, minor, hdrSize, offSize) {
  26974. this.major = major;
  26975. this.minor = minor;
  26976. this.hdrSize = hdrSize;
  26977. this.offSize = offSize;
  26978. }
  26979. }
  26980. exports.CFFHeader = CFFHeader;
  26981. class CFFStrings {
  26982. constructor() {
  26983. this.strings = [];
  26984. }
  26985. get(index) {
  26986. if (index >= 0 && index <= NUM_STANDARD_CFF_STRINGS - 1) {
  26987. return CFFStandardStrings[index];
  26988. }
  26989. if (index - NUM_STANDARD_CFF_STRINGS <= this.strings.length) {
  26990. return this.strings[index - NUM_STANDARD_CFF_STRINGS];
  26991. }
  26992. return CFFStandardStrings[0];
  26993. }
  26994. getSID(str) {
  26995. let index = CFFStandardStrings.indexOf(str);
  26996. if (index !== -1) {
  26997. return index;
  26998. }
  26999. index = this.strings.indexOf(str);
  27000. if (index !== -1) {
  27001. return index + NUM_STANDARD_CFF_STRINGS;
  27002. }
  27003. return -1;
  27004. }
  27005. add(value) {
  27006. this.strings.push(value);
  27007. }
  27008. get count() {
  27009. return this.strings.length;
  27010. }
  27011. }
  27012. exports.CFFStrings = CFFStrings;
  27013. class CFFIndex {
  27014. constructor() {
  27015. this.objects = [];
  27016. this.length = 0;
  27017. }
  27018. add(data) {
  27019. this.length += data.length;
  27020. this.objects.push(data);
  27021. }
  27022. set(index, data) {
  27023. this.length += data.length - this.objects[index].length;
  27024. this.objects[index] = data;
  27025. }
  27026. get(index) {
  27027. return this.objects[index];
  27028. }
  27029. get count() {
  27030. return this.objects.length;
  27031. }
  27032. }
  27033. exports.CFFIndex = CFFIndex;
  27034. class CFFDict {
  27035. constructor(tables, strings) {
  27036. this.keyToNameMap = tables.keyToNameMap;
  27037. this.nameToKeyMap = tables.nameToKeyMap;
  27038. this.defaults = tables.defaults;
  27039. this.types = tables.types;
  27040. this.opcodes = tables.opcodes;
  27041. this.order = tables.order;
  27042. this.strings = strings;
  27043. this.values = Object.create(null);
  27044. }
  27045. setByKey(key, value) {
  27046. if (!(key in this.keyToNameMap)) {
  27047. return false;
  27048. }
  27049. if (value.length === 0) {
  27050. return true;
  27051. }
  27052. for (const val of value) {
  27053. if (isNaN(val)) {
  27054. (0, _util.warn)(`Invalid CFFDict value: "${value}" for key "${key}".`);
  27055. return true;
  27056. }
  27057. }
  27058. const type = this.types[key];
  27059. if (type === "num" || type === "sid" || type === "offset") {
  27060. value = value[0];
  27061. }
  27062. this.values[key] = value;
  27063. return true;
  27064. }
  27065. setByName(name, value) {
  27066. if (!(name in this.nameToKeyMap)) {
  27067. throw new _util.FormatError(`Invalid dictionary name "${name}"`);
  27068. }
  27069. this.values[this.nameToKeyMap[name]] = value;
  27070. }
  27071. hasName(name) {
  27072. return this.nameToKeyMap[name] in this.values;
  27073. }
  27074. getByName(name) {
  27075. if (!(name in this.nameToKeyMap)) {
  27076. throw new _util.FormatError(`Invalid dictionary name ${name}"`);
  27077. }
  27078. const key = this.nameToKeyMap[name];
  27079. if (!(key in this.values)) {
  27080. return this.defaults[key];
  27081. }
  27082. return this.values[key];
  27083. }
  27084. removeByName(name) {
  27085. delete this.values[this.nameToKeyMap[name]];
  27086. }
  27087. static createTables(layout) {
  27088. const tables = {
  27089. keyToNameMap: {},
  27090. nameToKeyMap: {},
  27091. defaults: {},
  27092. types: {},
  27093. opcodes: {},
  27094. order: []
  27095. };
  27096. for (const entry of layout) {
  27097. const key = Array.isArray(entry[0]) ? (entry[0][0] << 8) + entry[0][1] : entry[0];
  27098. tables.keyToNameMap[key] = entry[1];
  27099. tables.nameToKeyMap[entry[1]] = key;
  27100. tables.types[key] = entry[2];
  27101. tables.defaults[key] = entry[3];
  27102. tables.opcodes[key] = Array.isArray(entry[0]) ? entry[0] : [entry[0]];
  27103. tables.order.push(key);
  27104. }
  27105. return tables;
  27106. }
  27107. }
  27108. 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]];
  27109. class CFFTopDict extends CFFDict {
  27110. static get tables() {
  27111. return (0, _util.shadow)(this, "tables", this.createTables(CFFTopDictLayout));
  27112. }
  27113. constructor(strings) {
  27114. super(CFFTopDict.tables, strings);
  27115. this.privateDict = null;
  27116. }
  27117. }
  27118. exports.CFFTopDict = CFFTopDict;
  27119. 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]];
  27120. class CFFPrivateDict extends CFFDict {
  27121. static get tables() {
  27122. return (0, _util.shadow)(this, "tables", this.createTables(CFFPrivateDictLayout));
  27123. }
  27124. constructor(strings) {
  27125. super(CFFPrivateDict.tables, strings);
  27126. this.subrsIndex = null;
  27127. }
  27128. }
  27129. exports.CFFPrivateDict = CFFPrivateDict;
  27130. const CFFCharsetPredefinedTypes = {
  27131. ISO_ADOBE: 0,
  27132. EXPERT: 1,
  27133. EXPERT_SUBSET: 2
  27134. };
  27135. class CFFCharset {
  27136. constructor(predefined, format, charset, raw) {
  27137. this.predefined = predefined;
  27138. this.format = format;
  27139. this.charset = charset;
  27140. this.raw = raw;
  27141. }
  27142. }
  27143. exports.CFFCharset = CFFCharset;
  27144. class CFFEncoding {
  27145. constructor(predefined, format, encoding, raw) {
  27146. this.predefined = predefined;
  27147. this.format = format;
  27148. this.encoding = encoding;
  27149. this.raw = raw;
  27150. }
  27151. }
  27152. class CFFFDSelect {
  27153. constructor(format, fdSelect) {
  27154. this.format = format;
  27155. this.fdSelect = fdSelect;
  27156. }
  27157. getFDIndex(glyphIndex) {
  27158. if (glyphIndex < 0 || glyphIndex >= this.fdSelect.length) {
  27159. return -1;
  27160. }
  27161. return this.fdSelect[glyphIndex];
  27162. }
  27163. }
  27164. exports.CFFFDSelect = CFFFDSelect;
  27165. class CFFOffsetTracker {
  27166. constructor() {
  27167. this.offsets = Object.create(null);
  27168. }
  27169. isTracking(key) {
  27170. return key in this.offsets;
  27171. }
  27172. track(key, location) {
  27173. if (key in this.offsets) {
  27174. throw new _util.FormatError(`Already tracking location of ${key}`);
  27175. }
  27176. this.offsets[key] = location;
  27177. }
  27178. offset(value) {
  27179. for (const key in this.offsets) {
  27180. this.offsets[key] += value;
  27181. }
  27182. }
  27183. setEntryLocation(key, values, output) {
  27184. if (!(key in this.offsets)) {
  27185. throw new _util.FormatError(`Not tracking location of ${key}`);
  27186. }
  27187. const data = output.data;
  27188. const dataOffset = this.offsets[key];
  27189. const size = 5;
  27190. for (let i = 0, ii = values.length; i < ii; ++i) {
  27191. const offset0 = i * size + dataOffset;
  27192. const offset1 = offset0 + 1;
  27193. const offset2 = offset0 + 2;
  27194. const offset3 = offset0 + 3;
  27195. const offset4 = offset0 + 4;
  27196. if (data[offset0] !== 0x1d || data[offset1] !== 0 || data[offset2] !== 0 || data[offset3] !== 0 || data[offset4] !== 0) {
  27197. throw new _util.FormatError("writing to an offset that is not empty");
  27198. }
  27199. const value = values[i];
  27200. data[offset0] = 0x1d;
  27201. data[offset1] = value >> 24 & 0xff;
  27202. data[offset2] = value >> 16 & 0xff;
  27203. data[offset3] = value >> 8 & 0xff;
  27204. data[offset4] = value & 0xff;
  27205. }
  27206. }
  27207. }
  27208. class CFFCompiler {
  27209. constructor(cff) {
  27210. this.cff = cff;
  27211. }
  27212. compile() {
  27213. const cff = this.cff;
  27214. const output = {
  27215. data: [],
  27216. length: 0,
  27217. add(data) {
  27218. this.data = this.data.concat(data);
  27219. this.length = this.data.length;
  27220. }
  27221. };
  27222. const header = this.compileHeader(cff.header);
  27223. output.add(header);
  27224. const nameIndex = this.compileNameIndex(cff.names);
  27225. output.add(nameIndex);
  27226. if (cff.isCIDFont) {
  27227. if (cff.topDict.hasName("FontMatrix")) {
  27228. const base = cff.topDict.getByName("FontMatrix");
  27229. cff.topDict.removeByName("FontMatrix");
  27230. for (const subDict of cff.fdArray) {
  27231. let matrix = base.slice(0);
  27232. if (subDict.hasName("FontMatrix")) {
  27233. matrix = _util.Util.transform(matrix, subDict.getByName("FontMatrix"));
  27234. }
  27235. subDict.setByName("FontMatrix", matrix);
  27236. }
  27237. }
  27238. }
  27239. const xuid = cff.topDict.getByName("XUID");
  27240. if (xuid && xuid.length > 16) {
  27241. cff.topDict.removeByName("XUID");
  27242. }
  27243. cff.topDict.setByName("charset", 0);
  27244. let compiled = this.compileTopDicts([cff.topDict], output.length, cff.isCIDFont);
  27245. output.add(compiled.output);
  27246. const topDictTracker = compiled.trackers[0];
  27247. const stringIndex = this.compileStringIndex(cff.strings.strings);
  27248. output.add(stringIndex);
  27249. const globalSubrIndex = this.compileIndex(cff.globalSubrIndex);
  27250. output.add(globalSubrIndex);
  27251. if (cff.encoding && cff.topDict.hasName("Encoding")) {
  27252. if (cff.encoding.predefined) {
  27253. topDictTracker.setEntryLocation("Encoding", [cff.encoding.format], output);
  27254. } else {
  27255. const encoding = this.compileEncoding(cff.encoding);
  27256. topDictTracker.setEntryLocation("Encoding", [output.length], output);
  27257. output.add(encoding);
  27258. }
  27259. }
  27260. const charset = this.compileCharset(cff.charset, cff.charStrings.count, cff.strings, cff.isCIDFont);
  27261. topDictTracker.setEntryLocation("charset", [output.length], output);
  27262. output.add(charset);
  27263. const charStrings = this.compileCharStrings(cff.charStrings);
  27264. topDictTracker.setEntryLocation("CharStrings", [output.length], output);
  27265. output.add(charStrings);
  27266. if (cff.isCIDFont) {
  27267. topDictTracker.setEntryLocation("FDSelect", [output.length], output);
  27268. const fdSelect = this.compileFDSelect(cff.fdSelect);
  27269. output.add(fdSelect);
  27270. compiled = this.compileTopDicts(cff.fdArray, output.length, true);
  27271. topDictTracker.setEntryLocation("FDArray", [output.length], output);
  27272. output.add(compiled.output);
  27273. const fontDictTrackers = compiled.trackers;
  27274. this.compilePrivateDicts(cff.fdArray, fontDictTrackers, output);
  27275. }
  27276. this.compilePrivateDicts([cff.topDict], [topDictTracker], output);
  27277. output.add([0]);
  27278. return output.data;
  27279. }
  27280. encodeNumber(value) {
  27281. if (Number.isInteger(value)) {
  27282. return this.encodeInteger(value);
  27283. }
  27284. return this.encodeFloat(value);
  27285. }
  27286. static get EncodeFloatRegExp() {
  27287. return (0, _util.shadow)(this, "EncodeFloatRegExp", /\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/);
  27288. }
  27289. encodeFloat(num) {
  27290. let value = num.toString();
  27291. const m = CFFCompiler.EncodeFloatRegExp.exec(value);
  27292. if (m) {
  27293. const epsilon = parseFloat("1e" + ((m[2] ? +m[2] : 0) + m[1].length));
  27294. value = (Math.round(num * epsilon) / epsilon).toString();
  27295. }
  27296. let nibbles = "";
  27297. let i, ii;
  27298. for (i = 0, ii = value.length; i < ii; ++i) {
  27299. const a = value[i];
  27300. if (a === "e") {
  27301. nibbles += value[++i] === "-" ? "c" : "b";
  27302. } else if (a === ".") {
  27303. nibbles += "a";
  27304. } else if (a === "-") {
  27305. nibbles += "e";
  27306. } else {
  27307. nibbles += a;
  27308. }
  27309. }
  27310. nibbles += nibbles.length & 1 ? "f" : "ff";
  27311. const out = [30];
  27312. for (i = 0, ii = nibbles.length; i < ii; i += 2) {
  27313. out.push(parseInt(nibbles.substring(i, i + 2), 16));
  27314. }
  27315. return out;
  27316. }
  27317. encodeInteger(value) {
  27318. let code;
  27319. if (value >= -107 && value <= 107) {
  27320. code = [value + 139];
  27321. } else if (value >= 108 && value <= 1131) {
  27322. value -= 108;
  27323. code = [(value >> 8) + 247, value & 0xff];
  27324. } else if (value >= -1131 && value <= -108) {
  27325. value = -value - 108;
  27326. code = [(value >> 8) + 251, value & 0xff];
  27327. } else if (value >= -32768 && value <= 32767) {
  27328. code = [0x1c, value >> 8 & 0xff, value & 0xff];
  27329. } else {
  27330. code = [0x1d, value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff];
  27331. }
  27332. return code;
  27333. }
  27334. compileHeader(header) {
  27335. return [header.major, header.minor, 4, header.offSize];
  27336. }
  27337. compileNameIndex(names) {
  27338. const nameIndex = new CFFIndex();
  27339. for (const name of names) {
  27340. const length = Math.min(name.length, 127);
  27341. let sanitizedName = new Array(length);
  27342. for (let j = 0; j < length; j++) {
  27343. let char = name[j];
  27344. if (char < "!" || char > "~" || char === "[" || char === "]" || char === "(" || char === ")" || char === "{" || char === "}" || char === "<" || char === ">" || char === "/" || char === "%") {
  27345. char = "_";
  27346. }
  27347. sanitizedName[j] = char;
  27348. }
  27349. sanitizedName = sanitizedName.join("");
  27350. if (sanitizedName === "") {
  27351. sanitizedName = "Bad_Font_Name";
  27352. }
  27353. nameIndex.add((0, _util.stringToBytes)(sanitizedName));
  27354. }
  27355. return this.compileIndex(nameIndex);
  27356. }
  27357. compileTopDicts(dicts, length, removeCidKeys) {
  27358. const fontDictTrackers = [];
  27359. let fdArrayIndex = new CFFIndex();
  27360. for (const fontDict of dicts) {
  27361. if (removeCidKeys) {
  27362. fontDict.removeByName("CIDFontVersion");
  27363. fontDict.removeByName("CIDFontRevision");
  27364. fontDict.removeByName("CIDFontType");
  27365. fontDict.removeByName("CIDCount");
  27366. fontDict.removeByName("UIDBase");
  27367. }
  27368. const fontDictTracker = new CFFOffsetTracker();
  27369. const fontDictData = this.compileDict(fontDict, fontDictTracker);
  27370. fontDictTrackers.push(fontDictTracker);
  27371. fdArrayIndex.add(fontDictData);
  27372. fontDictTracker.offset(length);
  27373. }
  27374. fdArrayIndex = this.compileIndex(fdArrayIndex, fontDictTrackers);
  27375. return {
  27376. trackers: fontDictTrackers,
  27377. output: fdArrayIndex
  27378. };
  27379. }
  27380. compilePrivateDicts(dicts, trackers, output) {
  27381. for (let i = 0, ii = dicts.length; i < ii; ++i) {
  27382. const fontDict = dicts[i];
  27383. const privateDict = fontDict.privateDict;
  27384. if (!privateDict || !fontDict.hasName("Private")) {
  27385. throw new _util.FormatError("There must be a private dictionary.");
  27386. }
  27387. const privateDictTracker = new CFFOffsetTracker();
  27388. const privateDictData = this.compileDict(privateDict, privateDictTracker);
  27389. let outputLength = output.length;
  27390. privateDictTracker.offset(outputLength);
  27391. if (!privateDictData.length) {
  27392. outputLength = 0;
  27393. }
  27394. trackers[i].setEntryLocation("Private", [privateDictData.length, outputLength], output);
  27395. output.add(privateDictData);
  27396. if (privateDict.subrsIndex && privateDict.hasName("Subrs")) {
  27397. const subrs = this.compileIndex(privateDict.subrsIndex);
  27398. privateDictTracker.setEntryLocation("Subrs", [privateDictData.length], output);
  27399. output.add(subrs);
  27400. }
  27401. }
  27402. }
  27403. compileDict(dict, offsetTracker) {
  27404. const out = [];
  27405. for (const key of dict.order) {
  27406. if (!(key in dict.values)) {
  27407. continue;
  27408. }
  27409. let values = dict.values[key];
  27410. let types = dict.types[key];
  27411. if (!Array.isArray(types)) {
  27412. types = [types];
  27413. }
  27414. if (!Array.isArray(values)) {
  27415. values = [values];
  27416. }
  27417. if (values.length === 0) {
  27418. continue;
  27419. }
  27420. for (let j = 0, jj = types.length; j < jj; ++j) {
  27421. const type = types[j];
  27422. const value = values[j];
  27423. switch (type) {
  27424. case "num":
  27425. case "sid":
  27426. out.push(...this.encodeNumber(value));
  27427. break;
  27428. case "offset":
  27429. const name = dict.keyToNameMap[key];
  27430. if (!offsetTracker.isTracking(name)) {
  27431. offsetTracker.track(name, out.length);
  27432. }
  27433. out.push(0x1d, 0, 0, 0, 0);
  27434. break;
  27435. case "array":
  27436. case "delta":
  27437. out.push(...this.encodeNumber(value));
  27438. for (let k = 1, kk = values.length; k < kk; ++k) {
  27439. out.push(...this.encodeNumber(values[k]));
  27440. }
  27441. break;
  27442. default:
  27443. throw new _util.FormatError(`Unknown data type of ${type}`);
  27444. }
  27445. }
  27446. out.push(...dict.opcodes[key]);
  27447. }
  27448. return out;
  27449. }
  27450. compileStringIndex(strings) {
  27451. const stringIndex = new CFFIndex();
  27452. for (const string of strings) {
  27453. stringIndex.add((0, _util.stringToBytes)(string));
  27454. }
  27455. return this.compileIndex(stringIndex);
  27456. }
  27457. compileGlobalSubrIndex() {
  27458. const globalSubrIndex = this.cff.globalSubrIndex;
  27459. this.out.writeByteArray(this.compileIndex(globalSubrIndex));
  27460. }
  27461. compileCharStrings(charStrings) {
  27462. const charStringsIndex = new CFFIndex();
  27463. for (let i = 0; i < charStrings.count; i++) {
  27464. const glyph = charStrings.get(i);
  27465. if (glyph.length === 0) {
  27466. charStringsIndex.add(new Uint8Array([0x8b, 0x0e]));
  27467. continue;
  27468. }
  27469. charStringsIndex.add(glyph);
  27470. }
  27471. return this.compileIndex(charStringsIndex);
  27472. }
  27473. compileCharset(charset, numGlyphs, strings, isCIDFont) {
  27474. let out;
  27475. const numGlyphsLessNotDef = numGlyphs - 1;
  27476. if (isCIDFont) {
  27477. out = new Uint8Array([2, 0, 0, numGlyphsLessNotDef >> 8 & 0xff, numGlyphsLessNotDef & 0xff]);
  27478. } else {
  27479. const length = 1 + numGlyphsLessNotDef * 2;
  27480. out = new Uint8Array(length);
  27481. out[0] = 0;
  27482. let charsetIndex = 0;
  27483. const numCharsets = charset.charset.length;
  27484. let warned = false;
  27485. for (let i = 1; i < out.length; i += 2) {
  27486. let sid = 0;
  27487. if (charsetIndex < numCharsets) {
  27488. const name = charset.charset[charsetIndex++];
  27489. sid = strings.getSID(name);
  27490. if (sid === -1) {
  27491. sid = 0;
  27492. if (!warned) {
  27493. warned = true;
  27494. (0, _util.warn)(`Couldn't find ${name} in CFF strings`);
  27495. }
  27496. }
  27497. }
  27498. out[i] = sid >> 8 & 0xff;
  27499. out[i + 1] = sid & 0xff;
  27500. }
  27501. }
  27502. return this.compileTypedArray(out);
  27503. }
  27504. compileEncoding(encoding) {
  27505. return this.compileTypedArray(encoding.raw);
  27506. }
  27507. compileFDSelect(fdSelect) {
  27508. const format = fdSelect.format;
  27509. let out, i;
  27510. switch (format) {
  27511. case 0:
  27512. out = new Uint8Array(1 + fdSelect.fdSelect.length);
  27513. out[0] = format;
  27514. for (i = 0; i < fdSelect.fdSelect.length; i++) {
  27515. out[i + 1] = fdSelect.fdSelect[i];
  27516. }
  27517. break;
  27518. case 3:
  27519. const start = 0;
  27520. let lastFD = fdSelect.fdSelect[0];
  27521. const ranges = [format, 0, 0, start >> 8 & 0xff, start & 0xff, lastFD];
  27522. for (i = 1; i < fdSelect.fdSelect.length; i++) {
  27523. const currentFD = fdSelect.fdSelect[i];
  27524. if (currentFD !== lastFD) {
  27525. ranges.push(i >> 8 & 0xff, i & 0xff, currentFD);
  27526. lastFD = currentFD;
  27527. }
  27528. }
  27529. const numRanges = (ranges.length - 3) / 3;
  27530. ranges[1] = numRanges >> 8 & 0xff;
  27531. ranges[2] = numRanges & 0xff;
  27532. ranges.push(i >> 8 & 0xff, i & 0xff);
  27533. out = new Uint8Array(ranges);
  27534. break;
  27535. }
  27536. return this.compileTypedArray(out);
  27537. }
  27538. compileTypedArray(data) {
  27539. const out = [];
  27540. for (let i = 0, ii = data.length; i < ii; ++i) {
  27541. out[i] = data[i];
  27542. }
  27543. return out;
  27544. }
  27545. compileIndex(index) {
  27546. let trackers = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  27547. const objects = index.objects;
  27548. const count = objects.length;
  27549. if (count === 0) {
  27550. return [0, 0];
  27551. }
  27552. const data = [count >> 8 & 0xff, count & 0xff];
  27553. let lastOffset = 1,
  27554. i;
  27555. for (i = 0; i < count; ++i) {
  27556. lastOffset += objects[i].length;
  27557. }
  27558. let offsetSize;
  27559. if (lastOffset < 0x100) {
  27560. offsetSize = 1;
  27561. } else if (lastOffset < 0x10000) {
  27562. offsetSize = 2;
  27563. } else if (lastOffset < 0x1000000) {
  27564. offsetSize = 3;
  27565. } else {
  27566. offsetSize = 4;
  27567. }
  27568. data.push(offsetSize);
  27569. let relativeOffset = 1;
  27570. for (i = 0; i < count + 1; i++) {
  27571. if (offsetSize === 1) {
  27572. data.push(relativeOffset & 0xff);
  27573. } else if (offsetSize === 2) {
  27574. data.push(relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
  27575. } else if (offsetSize === 3) {
  27576. data.push(relativeOffset >> 16 & 0xff, relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
  27577. } else {
  27578. data.push(relativeOffset >>> 24 & 0xff, relativeOffset >> 16 & 0xff, relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
  27579. }
  27580. if (objects[i]) {
  27581. relativeOffset += objects[i].length;
  27582. }
  27583. }
  27584. for (i = 0; i < count; i++) {
  27585. if (trackers[i]) {
  27586. trackers[i].offset(data.length);
  27587. }
  27588. data.push(...objects[i]);
  27589. }
  27590. return data;
  27591. }
  27592. }
  27593. exports.CFFCompiler = CFFCompiler;
  27594. /***/ }),
  27595. /* 165 */
  27596. /***/ ((__unused_webpack_module, exports) => {
  27597. "use strict";
  27598. Object.defineProperty(exports, "__esModule", ({
  27599. value: true
  27600. }));
  27601. exports.ISOAdobeCharset = exports.ExpertSubsetCharset = exports.ExpertCharset = void 0;
  27602. 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"];
  27603. exports.ISOAdobeCharset = ISOAdobeCharset;
  27604. 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"];
  27605. exports.ExpertCharset = ExpertCharset;
  27606. 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"];
  27607. exports.ExpertSubsetCharset = ExpertSubsetCharset;
  27608. /***/ }),
  27609. /* 166 */
  27610. /***/ ((__unused_webpack_module, exports) => {
  27611. "use strict";
  27612. Object.defineProperty(exports, "__esModule", ({
  27613. value: true
  27614. }));
  27615. exports.ZapfDingbatsEncoding = exports.WinAnsiEncoding = exports.SymbolSetEncoding = exports.StandardEncoding = exports.MacRomanEncoding = exports.ExpertEncoding = void 0;
  27616. exports.getEncoding = getEncoding;
  27617. 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"];
  27618. exports.ExpertEncoding = ExpertEncoding;
  27619. 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", "", "", "", ""];
  27620. 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"];
  27621. exports.MacRomanEncoding = MacRomanEncoding;
  27622. 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", "", "", "", ""];
  27623. exports.StandardEncoding = StandardEncoding;
  27624. 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"];
  27625. exports.WinAnsiEncoding = WinAnsiEncoding;
  27626. 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", ""];
  27627. exports.SymbolSetEncoding = SymbolSetEncoding;
  27628. 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", ""];
  27629. exports.ZapfDingbatsEncoding = ZapfDingbatsEncoding;
  27630. function getEncoding(encodingName) {
  27631. switch (encodingName) {
  27632. case "WinAnsiEncoding":
  27633. return WinAnsiEncoding;
  27634. case "StandardEncoding":
  27635. return StandardEncoding;
  27636. case "MacRomanEncoding":
  27637. return MacRomanEncoding;
  27638. case "SymbolSetEncoding":
  27639. return SymbolSetEncoding;
  27640. case "ZapfDingbatsEncoding":
  27641. return ZapfDingbatsEncoding;
  27642. case "ExpertEncoding":
  27643. return ExpertEncoding;
  27644. case "MacExpertEncoding":
  27645. return MacExpertEncoding;
  27646. default:
  27647. return null;
  27648. }
  27649. }
  27650. /***/ }),
  27651. /* 167 */
  27652. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  27653. "use strict";
  27654. Object.defineProperty(exports, "__esModule", ({
  27655. value: true
  27656. }));
  27657. exports.SEAC_ANALYSIS_ENABLED = exports.MacStandardGlyphOrdering = exports.FontFlags = void 0;
  27658. exports.getFontType = getFontType;
  27659. exports.normalizeFontName = normalizeFontName;
  27660. exports.recoverGlyphName = recoverGlyphName;
  27661. exports.type1FontGlyphMapping = type1FontGlyphMapping;
  27662. var _util = __w_pdfjs_require__(2);
  27663. var _encodings = __w_pdfjs_require__(166);
  27664. var _glyphlist = __w_pdfjs_require__(168);
  27665. var _unicode = __w_pdfjs_require__(169);
  27666. const SEAC_ANALYSIS_ENABLED = true;
  27667. exports.SEAC_ANALYSIS_ENABLED = SEAC_ANALYSIS_ENABLED;
  27668. const FontFlags = {
  27669. FixedPitch: 1,
  27670. Serif: 2,
  27671. Symbolic: 4,
  27672. Script: 8,
  27673. Nonsymbolic: 32,
  27674. Italic: 64,
  27675. AllCap: 65536,
  27676. SmallCap: 131072,
  27677. ForceBold: 262144
  27678. };
  27679. exports.FontFlags = FontFlags;
  27680. 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"];
  27681. exports.MacStandardGlyphOrdering = MacStandardGlyphOrdering;
  27682. function getFontType(type, subtype) {
  27683. let isStandardFont = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  27684. switch (type) {
  27685. case "Type1":
  27686. if (isStandardFont) {
  27687. return _util.FontType.TYPE1STANDARD;
  27688. }
  27689. return subtype === "Type1C" ? _util.FontType.TYPE1C : _util.FontType.TYPE1;
  27690. case "CIDFontType0":
  27691. return subtype === "CIDFontType0C" ? _util.FontType.CIDFONTTYPE0C : _util.FontType.CIDFONTTYPE0;
  27692. case "OpenType":
  27693. return _util.FontType.OPENTYPE;
  27694. case "TrueType":
  27695. return _util.FontType.TRUETYPE;
  27696. case "CIDFontType2":
  27697. return _util.FontType.CIDFONTTYPE2;
  27698. case "MMType1":
  27699. return _util.FontType.MMTYPE1;
  27700. case "Type0":
  27701. return _util.FontType.TYPE0;
  27702. default:
  27703. return _util.FontType.UNKNOWN;
  27704. }
  27705. }
  27706. function recoverGlyphName(name, glyphsUnicodeMap) {
  27707. if (glyphsUnicodeMap[name] !== undefined) {
  27708. return name;
  27709. }
  27710. const unicode = (0, _unicode.getUnicodeForGlyph)(name, glyphsUnicodeMap);
  27711. if (unicode !== -1) {
  27712. for (const key in glyphsUnicodeMap) {
  27713. if (glyphsUnicodeMap[key] === unicode) {
  27714. return key;
  27715. }
  27716. }
  27717. }
  27718. (0, _util.info)("Unable to recover a standard glyph name for: " + name);
  27719. return name;
  27720. }
  27721. function type1FontGlyphMapping(properties, builtInEncoding, glyphNames) {
  27722. const charCodeToGlyphId = Object.create(null);
  27723. let glyphId, charCode, baseEncoding;
  27724. const isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
  27725. if (properties.isInternalFont) {
  27726. baseEncoding = builtInEncoding;
  27727. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  27728. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  27729. if (glyphId >= 0) {
  27730. charCodeToGlyphId[charCode] = glyphId;
  27731. } else {
  27732. charCodeToGlyphId[charCode] = 0;
  27733. }
  27734. }
  27735. } else if (properties.baseEncodingName) {
  27736. baseEncoding = (0, _encodings.getEncoding)(properties.baseEncodingName);
  27737. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  27738. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  27739. if (glyphId >= 0) {
  27740. charCodeToGlyphId[charCode] = glyphId;
  27741. } else {
  27742. charCodeToGlyphId[charCode] = 0;
  27743. }
  27744. }
  27745. } else if (isSymbolicFont) {
  27746. for (charCode in builtInEncoding) {
  27747. charCodeToGlyphId[charCode] = builtInEncoding[charCode];
  27748. }
  27749. } else {
  27750. baseEncoding = _encodings.StandardEncoding;
  27751. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  27752. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  27753. if (glyphId >= 0) {
  27754. charCodeToGlyphId[charCode] = glyphId;
  27755. } else {
  27756. charCodeToGlyphId[charCode] = 0;
  27757. }
  27758. }
  27759. }
  27760. const differences = properties.differences;
  27761. let glyphsUnicodeMap;
  27762. if (differences) {
  27763. for (charCode in differences) {
  27764. const glyphName = differences[charCode];
  27765. glyphId = glyphNames.indexOf(glyphName);
  27766. if (glyphId === -1) {
  27767. if (!glyphsUnicodeMap) {
  27768. glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  27769. }
  27770. const standardGlyphName = recoverGlyphName(glyphName, glyphsUnicodeMap);
  27771. if (standardGlyphName !== glyphName) {
  27772. glyphId = glyphNames.indexOf(standardGlyphName);
  27773. }
  27774. }
  27775. if (glyphId >= 0) {
  27776. charCodeToGlyphId[charCode] = glyphId;
  27777. } else {
  27778. charCodeToGlyphId[charCode] = 0;
  27779. }
  27780. }
  27781. }
  27782. return charCodeToGlyphId;
  27783. }
  27784. function normalizeFontName(name) {
  27785. return name.replace(/[,_]/g, "-").replace(/\s/g, "");
  27786. }
  27787. /***/ }),
  27788. /* 168 */
  27789. /***/ ((__unused_webpack_module, __webpack_exports__, __w_pdfjs_require__) => {
  27790. "use strict";
  27791. __w_pdfjs_require__.r(__webpack_exports__);
  27792. /* harmony export */ __w_pdfjs_require__.d(__webpack_exports__, {
  27793. /* harmony export */ "getDingbatsGlyphsUnicode": () => (/* binding */ getDingbatsGlyphsUnicode),
  27794. /* harmony export */ "getGlyphsUnicode": () => (/* binding */ getGlyphsUnicode)
  27795. /* harmony export */ });
  27796. /* harmony import */ var _core_utils_js__WEBPACK_IMPORTED_MODULE_0__ = __w_pdfjs_require__(135);
  27797. const getGlyphsUnicode = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getArrayLookupTableFactory)(function () {
  27798. return [
  27799. "A",
  27800. 0x0041,
  27801. "AE",
  27802. 0x00c6,
  27803. "AEacute",
  27804. 0x01fc,
  27805. "AEmacron",
  27806. 0x01e2,
  27807. "AEsmall",
  27808. 0xf7e6,
  27809. "Aacute",
  27810. 0x00c1,
  27811. "Aacutesmall",
  27812. 0xf7e1,
  27813. "Abreve",
  27814. 0x0102,
  27815. "Abreveacute",
  27816. 0x1eae,
  27817. "Abrevecyrillic",
  27818. 0x04d0,
  27819. "Abrevedotbelow",
  27820. 0x1eb6,
  27821. "Abrevegrave",
  27822. 0x1eb0,
  27823. "Abrevehookabove",
  27824. 0x1eb2,
  27825. "Abrevetilde",
  27826. 0x1eb4,
  27827. "Acaron",
  27828. 0x01cd,
  27829. "Acircle",
  27830. 0x24b6,
  27831. "Acircumflex",
  27832. 0x00c2,
  27833. "Acircumflexacute",
  27834. 0x1ea4,
  27835. "Acircumflexdotbelow",
  27836. 0x1eac,
  27837. "Acircumflexgrave",
  27838. 0x1ea6,
  27839. "Acircumflexhookabove",
  27840. 0x1ea8,
  27841. "Acircumflexsmall",
  27842. 0xf7e2,
  27843. "Acircumflextilde",
  27844. 0x1eaa,
  27845. "Acute",
  27846. 0xf6c9,
  27847. "Acutesmall",
  27848. 0xf7b4,
  27849. "Acyrillic",
  27850. 0x0410,
  27851. "Adblgrave",
  27852. 0x0200,
  27853. "Adieresis",
  27854. 0x00c4,
  27855. "Adieresiscyrillic",
  27856. 0x04d2,
  27857. "Adieresismacron",
  27858. 0x01de,
  27859. "Adieresissmall",
  27860. 0xf7e4,
  27861. "Adotbelow",
  27862. 0x1ea0,
  27863. "Adotmacron",
  27864. 0x01e0,
  27865. "Agrave",
  27866. 0x00c0,
  27867. "Agravesmall",
  27868. 0xf7e0,
  27869. "Ahookabove",
  27870. 0x1ea2,
  27871. "Aiecyrillic",
  27872. 0x04d4,
  27873. "Ainvertedbreve",
  27874. 0x0202,
  27875. "Alpha",
  27876. 0x0391,
  27877. "Alphatonos",
  27878. 0x0386,
  27879. "Amacron",
  27880. 0x0100,
  27881. "Amonospace",
  27882. 0xff21,
  27883. "Aogonek",
  27884. 0x0104,
  27885. "Aring",
  27886. 0x00c5,
  27887. "Aringacute",
  27888. 0x01fa,
  27889. "Aringbelow",
  27890. 0x1e00,
  27891. "Aringsmall",
  27892. 0xf7e5,
  27893. "Asmall",
  27894. 0xf761,
  27895. "Atilde",
  27896. 0x00c3,
  27897. "Atildesmall",
  27898. 0xf7e3,
  27899. "Aybarmenian",
  27900. 0x0531,
  27901. "B",
  27902. 0x0042,
  27903. "Bcircle",
  27904. 0x24b7,
  27905. "Bdotaccent",
  27906. 0x1e02,
  27907. "Bdotbelow",
  27908. 0x1e04,
  27909. "Becyrillic",
  27910. 0x0411,
  27911. "Benarmenian",
  27912. 0x0532,
  27913. "Beta",
  27914. 0x0392,
  27915. "Bhook",
  27916. 0x0181,
  27917. "Blinebelow",
  27918. 0x1e06,
  27919. "Bmonospace",
  27920. 0xff22,
  27921. "Brevesmall",
  27922. 0xf6f4,
  27923. "Bsmall",
  27924. 0xf762,
  27925. "Btopbar",
  27926. 0x0182,
  27927. "C",
  27928. 0x0043,
  27929. "Caarmenian",
  27930. 0x053e,
  27931. "Cacute",
  27932. 0x0106,
  27933. "Caron",
  27934. 0xf6ca,
  27935. "Caronsmall",
  27936. 0xf6f5,
  27937. "Ccaron",
  27938. 0x010c,
  27939. "Ccedilla",
  27940. 0x00c7,
  27941. "Ccedillaacute",
  27942. 0x1e08,
  27943. "Ccedillasmall",
  27944. 0xf7e7,
  27945. "Ccircle",
  27946. 0x24b8,
  27947. "Ccircumflex",
  27948. 0x0108,
  27949. "Cdot",
  27950. 0x010a,
  27951. "Cdotaccent",
  27952. 0x010a,
  27953. "Cedillasmall",
  27954. 0xf7b8,
  27955. "Chaarmenian",
  27956. 0x0549,
  27957. "Cheabkhasiancyrillic",
  27958. 0x04bc,
  27959. "Checyrillic",
  27960. 0x0427,
  27961. "Chedescenderabkhasiancyrillic",
  27962. 0x04be,
  27963. "Chedescendercyrillic",
  27964. 0x04b6,
  27965. "Chedieresiscyrillic",
  27966. 0x04f4,
  27967. "Cheharmenian",
  27968. 0x0543,
  27969. "Chekhakassiancyrillic",
  27970. 0x04cb,
  27971. "Cheverticalstrokecyrillic",
  27972. 0x04b8,
  27973. "Chi",
  27974. 0x03a7,
  27975. "Chook",
  27976. 0x0187,
  27977. "Circumflexsmall",
  27978. 0xf6f6,
  27979. "Cmonospace",
  27980. 0xff23,
  27981. "Coarmenian",
  27982. 0x0551,
  27983. "Csmall",
  27984. 0xf763,
  27985. "D",
  27986. 0x0044,
  27987. "DZ",
  27988. 0x01f1,
  27989. "DZcaron",
  27990. 0x01c4,
  27991. "Daarmenian",
  27992. 0x0534,
  27993. "Dafrican",
  27994. 0x0189,
  27995. "Dcaron",
  27996. 0x010e,
  27997. "Dcedilla",
  27998. 0x1e10,
  27999. "Dcircle",
  28000. 0x24b9,
  28001. "Dcircumflexbelow",
  28002. 0x1e12,
  28003. "Dcroat",
  28004. 0x0110,
  28005. "Ddotaccent",
  28006. 0x1e0a,
  28007. "Ddotbelow",
  28008. 0x1e0c,
  28009. "Decyrillic",
  28010. 0x0414,
  28011. "Deicoptic",
  28012. 0x03ee,
  28013. "Delta",
  28014. 0x2206,
  28015. "Deltagreek",
  28016. 0x0394,
  28017. "Dhook",
  28018. 0x018a,
  28019. "Dieresis",
  28020. 0xf6cb,
  28021. "DieresisAcute",
  28022. 0xf6cc,
  28023. "DieresisGrave",
  28024. 0xf6cd,
  28025. "Dieresissmall",
  28026. 0xf7a8,
  28027. "Digammagreek",
  28028. 0x03dc,
  28029. "Djecyrillic",
  28030. 0x0402,
  28031. "Dlinebelow",
  28032. 0x1e0e,
  28033. "Dmonospace",
  28034. 0xff24,
  28035. "Dotaccentsmall",
  28036. 0xf6f7,
  28037. "Dslash",
  28038. 0x0110,
  28039. "Dsmall",
  28040. 0xf764,
  28041. "Dtopbar",
  28042. 0x018b,
  28043. "Dz",
  28044. 0x01f2,
  28045. "Dzcaron",
  28046. 0x01c5,
  28047. "Dzeabkhasiancyrillic",
  28048. 0x04e0,
  28049. "Dzecyrillic",
  28050. 0x0405,
  28051. "Dzhecyrillic",
  28052. 0x040f,
  28053. "E",
  28054. 0x0045,
  28055. "Eacute",
  28056. 0x00c9,
  28057. "Eacutesmall",
  28058. 0xf7e9,
  28059. "Ebreve",
  28060. 0x0114,
  28061. "Ecaron",
  28062. 0x011a,
  28063. "Ecedillabreve",
  28064. 0x1e1c,
  28065. "Echarmenian",
  28066. 0x0535,
  28067. "Ecircle",
  28068. 0x24ba,
  28069. "Ecircumflex",
  28070. 0x00ca,
  28071. "Ecircumflexacute",
  28072. 0x1ebe,
  28073. "Ecircumflexbelow",
  28074. 0x1e18,
  28075. "Ecircumflexdotbelow",
  28076. 0x1ec6,
  28077. "Ecircumflexgrave",
  28078. 0x1ec0,
  28079. "Ecircumflexhookabove",
  28080. 0x1ec2,
  28081. "Ecircumflexsmall",
  28082. 0xf7ea,
  28083. "Ecircumflextilde",
  28084. 0x1ec4,
  28085. "Ecyrillic",
  28086. 0x0404,
  28087. "Edblgrave",
  28088. 0x0204,
  28089. "Edieresis",
  28090. 0x00cb,
  28091. "Edieresissmall",
  28092. 0xf7eb,
  28093. "Edot",
  28094. 0x0116,
  28095. "Edotaccent",
  28096. 0x0116,
  28097. "Edotbelow",
  28098. 0x1eb8,
  28099. "Efcyrillic",
  28100. 0x0424,
  28101. "Egrave",
  28102. 0x00c8,
  28103. "Egravesmall",
  28104. 0xf7e8,
  28105. "Eharmenian",
  28106. 0x0537,
  28107. "Ehookabove",
  28108. 0x1eba,
  28109. "Eightroman",
  28110. 0x2167,
  28111. "Einvertedbreve",
  28112. 0x0206,
  28113. "Eiotifiedcyrillic",
  28114. 0x0464,
  28115. "Elcyrillic",
  28116. 0x041b,
  28117. "Elevenroman",
  28118. 0x216a,
  28119. "Emacron",
  28120. 0x0112,
  28121. "Emacronacute",
  28122. 0x1e16,
  28123. "Emacrongrave",
  28124. 0x1e14,
  28125. "Emcyrillic",
  28126. 0x041c,
  28127. "Emonospace",
  28128. 0xff25,
  28129. "Encyrillic",
  28130. 0x041d,
  28131. "Endescendercyrillic",
  28132. 0x04a2,
  28133. "Eng",
  28134. 0x014a,
  28135. "Enghecyrillic",
  28136. 0x04a4,
  28137. "Enhookcyrillic",
  28138. 0x04c7,
  28139. "Eogonek",
  28140. 0x0118,
  28141. "Eopen",
  28142. 0x0190,
  28143. "Epsilon",
  28144. 0x0395,
  28145. "Epsilontonos",
  28146. 0x0388,
  28147. "Ercyrillic",
  28148. 0x0420,
  28149. "Ereversed",
  28150. 0x018e,
  28151. "Ereversedcyrillic",
  28152. 0x042d,
  28153. "Escyrillic",
  28154. 0x0421,
  28155. "Esdescendercyrillic",
  28156. 0x04aa,
  28157. "Esh",
  28158. 0x01a9,
  28159. "Esmall",
  28160. 0xf765,
  28161. "Eta",
  28162. 0x0397,
  28163. "Etarmenian",
  28164. 0x0538,
  28165. "Etatonos",
  28166. 0x0389,
  28167. "Eth",
  28168. 0x00d0,
  28169. "Ethsmall",
  28170. 0xf7f0,
  28171. "Etilde",
  28172. 0x1ebc,
  28173. "Etildebelow",
  28174. 0x1e1a,
  28175. "Euro",
  28176. 0x20ac,
  28177. "Ezh",
  28178. 0x01b7,
  28179. "Ezhcaron",
  28180. 0x01ee,
  28181. "Ezhreversed",
  28182. 0x01b8,
  28183. "F",
  28184. 0x0046,
  28185. "Fcircle",
  28186. 0x24bb,
  28187. "Fdotaccent",
  28188. 0x1e1e,
  28189. "Feharmenian",
  28190. 0x0556,
  28191. "Feicoptic",
  28192. 0x03e4,
  28193. "Fhook",
  28194. 0x0191,
  28195. "Fitacyrillic",
  28196. 0x0472,
  28197. "Fiveroman",
  28198. 0x2164,
  28199. "Fmonospace",
  28200. 0xff26,
  28201. "Fourroman",
  28202. 0x2163,
  28203. "Fsmall",
  28204. 0xf766,
  28205. "G",
  28206. 0x0047,
  28207. "GBsquare",
  28208. 0x3387,
  28209. "Gacute",
  28210. 0x01f4,
  28211. "Gamma",
  28212. 0x0393,
  28213. "Gammaafrican",
  28214. 0x0194,
  28215. "Gangiacoptic",
  28216. 0x03ea,
  28217. "Gbreve",
  28218. 0x011e,
  28219. "Gcaron",
  28220. 0x01e6,
  28221. "Gcedilla",
  28222. 0x0122,
  28223. "Gcircle",
  28224. 0x24bc,
  28225. "Gcircumflex",
  28226. 0x011c,
  28227. "Gcommaaccent",
  28228. 0x0122,
  28229. "Gdot",
  28230. 0x0120,
  28231. "Gdotaccent",
  28232. 0x0120,
  28233. "Gecyrillic",
  28234. 0x0413,
  28235. "Ghadarmenian",
  28236. 0x0542,
  28237. "Ghemiddlehookcyrillic",
  28238. 0x0494,
  28239. "Ghestrokecyrillic",
  28240. 0x0492,
  28241. "Gheupturncyrillic",
  28242. 0x0490,
  28243. "Ghook",
  28244. 0x0193,
  28245. "Gimarmenian",
  28246. 0x0533,
  28247. "Gjecyrillic",
  28248. 0x0403,
  28249. "Gmacron",
  28250. 0x1e20,
  28251. "Gmonospace",
  28252. 0xff27,
  28253. "Grave",
  28254. 0xf6ce,
  28255. "Gravesmall",
  28256. 0xf760,
  28257. "Gsmall",
  28258. 0xf767,
  28259. "Gsmallhook",
  28260. 0x029b,
  28261. "Gstroke",
  28262. 0x01e4,
  28263. "H",
  28264. 0x0048,
  28265. "H18533",
  28266. 0x25cf,
  28267. "H18543",
  28268. 0x25aa,
  28269. "H18551",
  28270. 0x25ab,
  28271. "H22073",
  28272. 0x25a1,
  28273. "HPsquare",
  28274. 0x33cb,
  28275. "Haabkhasiancyrillic",
  28276. 0x04a8,
  28277. "Hadescendercyrillic",
  28278. 0x04b2,
  28279. "Hardsigncyrillic",
  28280. 0x042a,
  28281. "Hbar",
  28282. 0x0126,
  28283. "Hbrevebelow",
  28284. 0x1e2a,
  28285. "Hcedilla",
  28286. 0x1e28,
  28287. "Hcircle",
  28288. 0x24bd,
  28289. "Hcircumflex",
  28290. 0x0124,
  28291. "Hdieresis",
  28292. 0x1e26,
  28293. "Hdotaccent",
  28294. 0x1e22,
  28295. "Hdotbelow",
  28296. 0x1e24,
  28297. "Hmonospace",
  28298. 0xff28,
  28299. "Hoarmenian",
  28300. 0x0540,
  28301. "Horicoptic",
  28302. 0x03e8,
  28303. "Hsmall",
  28304. 0xf768,
  28305. "Hungarumlaut",
  28306. 0xf6cf,
  28307. "Hungarumlautsmall",
  28308. 0xf6f8,
  28309. "Hzsquare",
  28310. 0x3390,
  28311. "I",
  28312. 0x0049,
  28313. "IAcyrillic",
  28314. 0x042f,
  28315. "IJ",
  28316. 0x0132,
  28317. "IUcyrillic",
  28318. 0x042e,
  28319. "Iacute",
  28320. 0x00cd,
  28321. "Iacutesmall",
  28322. 0xf7ed,
  28323. "Ibreve",
  28324. 0x012c,
  28325. "Icaron",
  28326. 0x01cf,
  28327. "Icircle",
  28328. 0x24be,
  28329. "Icircumflex",
  28330. 0x00ce,
  28331. "Icircumflexsmall",
  28332. 0xf7ee,
  28333. "Icyrillic",
  28334. 0x0406,
  28335. "Idblgrave",
  28336. 0x0208,
  28337. "Idieresis",
  28338. 0x00cf,
  28339. "Idieresisacute",
  28340. 0x1e2e,
  28341. "Idieresiscyrillic",
  28342. 0x04e4,
  28343. "Idieresissmall",
  28344. 0xf7ef,
  28345. "Idot",
  28346. 0x0130,
  28347. "Idotaccent",
  28348. 0x0130,
  28349. "Idotbelow",
  28350. 0x1eca,
  28351. "Iebrevecyrillic",
  28352. 0x04d6,
  28353. "Iecyrillic",
  28354. 0x0415,
  28355. "Ifraktur",
  28356. 0x2111,
  28357. "Igrave",
  28358. 0x00cc,
  28359. "Igravesmall",
  28360. 0xf7ec,
  28361. "Ihookabove",
  28362. 0x1ec8,
  28363. "Iicyrillic",
  28364. 0x0418,
  28365. "Iinvertedbreve",
  28366. 0x020a,
  28367. "Iishortcyrillic",
  28368. 0x0419,
  28369. "Imacron",
  28370. 0x012a,
  28371. "Imacroncyrillic",
  28372. 0x04e2,
  28373. "Imonospace",
  28374. 0xff29,
  28375. "Iniarmenian",
  28376. 0x053b,
  28377. "Iocyrillic",
  28378. 0x0401,
  28379. "Iogonek",
  28380. 0x012e,
  28381. "Iota",
  28382. 0x0399,
  28383. "Iotaafrican",
  28384. 0x0196,
  28385. "Iotadieresis",
  28386. 0x03aa,
  28387. "Iotatonos",
  28388. 0x038a,
  28389. "Ismall",
  28390. 0xf769,
  28391. "Istroke",
  28392. 0x0197,
  28393. "Itilde",
  28394. 0x0128,
  28395. "Itildebelow",
  28396. 0x1e2c,
  28397. "Izhitsacyrillic",
  28398. 0x0474,
  28399. "Izhitsadblgravecyrillic",
  28400. 0x0476,
  28401. "J",
  28402. 0x004a,
  28403. "Jaarmenian",
  28404. 0x0541,
  28405. "Jcircle",
  28406. 0x24bf,
  28407. "Jcircumflex",
  28408. 0x0134,
  28409. "Jecyrillic",
  28410. 0x0408,
  28411. "Jheharmenian",
  28412. 0x054b,
  28413. "Jmonospace",
  28414. 0xff2a,
  28415. "Jsmall",
  28416. 0xf76a,
  28417. "K",
  28418. 0x004b,
  28419. "KBsquare",
  28420. 0x3385,
  28421. "KKsquare",
  28422. 0x33cd,
  28423. "Kabashkircyrillic",
  28424. 0x04a0,
  28425. "Kacute",
  28426. 0x1e30,
  28427. "Kacyrillic",
  28428. 0x041a,
  28429. "Kadescendercyrillic",
  28430. 0x049a,
  28431. "Kahookcyrillic",
  28432. 0x04c3,
  28433. "Kappa",
  28434. 0x039a,
  28435. "Kastrokecyrillic",
  28436. 0x049e,
  28437. "Kaverticalstrokecyrillic",
  28438. 0x049c,
  28439. "Kcaron",
  28440. 0x01e8,
  28441. "Kcedilla",
  28442. 0x0136,
  28443. "Kcircle",
  28444. 0x24c0,
  28445. "Kcommaaccent",
  28446. 0x0136,
  28447. "Kdotbelow",
  28448. 0x1e32,
  28449. "Keharmenian",
  28450. 0x0554,
  28451. "Kenarmenian",
  28452. 0x053f,
  28453. "Khacyrillic",
  28454. 0x0425,
  28455. "Kheicoptic",
  28456. 0x03e6,
  28457. "Khook",
  28458. 0x0198,
  28459. "Kjecyrillic",
  28460. 0x040c,
  28461. "Klinebelow",
  28462. 0x1e34,
  28463. "Kmonospace",
  28464. 0xff2b,
  28465. "Koppacyrillic",
  28466. 0x0480,
  28467. "Koppagreek",
  28468. 0x03de,
  28469. "Ksicyrillic",
  28470. 0x046e,
  28471. "Ksmall",
  28472. 0xf76b,
  28473. "L",
  28474. 0x004c,
  28475. "LJ",
  28476. 0x01c7,
  28477. "LL",
  28478. 0xf6bf,
  28479. "Lacute",
  28480. 0x0139,
  28481. "Lambda",
  28482. 0x039b,
  28483. "Lcaron",
  28484. 0x013d,
  28485. "Lcedilla",
  28486. 0x013b,
  28487. "Lcircle",
  28488. 0x24c1,
  28489. "Lcircumflexbelow",
  28490. 0x1e3c,
  28491. "Lcommaaccent",
  28492. 0x013b,
  28493. "Ldot",
  28494. 0x013f,
  28495. "Ldotaccent",
  28496. 0x013f,
  28497. "Ldotbelow",
  28498. 0x1e36,
  28499. "Ldotbelowmacron",
  28500. 0x1e38,
  28501. "Liwnarmenian",
  28502. 0x053c,
  28503. "Lj",
  28504. 0x01c8,
  28505. "Ljecyrillic",
  28506. 0x0409,
  28507. "Llinebelow",
  28508. 0x1e3a,
  28509. "Lmonospace",
  28510. 0xff2c,
  28511. "Lslash",
  28512. 0x0141,
  28513. "Lslashsmall",
  28514. 0xf6f9,
  28515. "Lsmall",
  28516. 0xf76c,
  28517. "M",
  28518. 0x004d,
  28519. "MBsquare",
  28520. 0x3386,
  28521. "Macron",
  28522. 0xf6d0,
  28523. "Macronsmall",
  28524. 0xf7af,
  28525. "Macute",
  28526. 0x1e3e,
  28527. "Mcircle",
  28528. 0x24c2,
  28529. "Mdotaccent",
  28530. 0x1e40,
  28531. "Mdotbelow",
  28532. 0x1e42,
  28533. "Menarmenian",
  28534. 0x0544,
  28535. "Mmonospace",
  28536. 0xff2d,
  28537. "Msmall",
  28538. 0xf76d,
  28539. "Mturned",
  28540. 0x019c,
  28541. "Mu",
  28542. 0x039c,
  28543. "N",
  28544. 0x004e,
  28545. "NJ",
  28546. 0x01ca,
  28547. "Nacute",
  28548. 0x0143,
  28549. "Ncaron",
  28550. 0x0147,
  28551. "Ncedilla",
  28552. 0x0145,
  28553. "Ncircle",
  28554. 0x24c3,
  28555. "Ncircumflexbelow",
  28556. 0x1e4a,
  28557. "Ncommaaccent",
  28558. 0x0145,
  28559. "Ndotaccent",
  28560. 0x1e44,
  28561. "Ndotbelow",
  28562. 0x1e46,
  28563. "Nhookleft",
  28564. 0x019d,
  28565. "Nineroman",
  28566. 0x2168,
  28567. "Nj",
  28568. 0x01cb,
  28569. "Njecyrillic",
  28570. 0x040a,
  28571. "Nlinebelow",
  28572. 0x1e48,
  28573. "Nmonospace",
  28574. 0xff2e,
  28575. "Nowarmenian",
  28576. 0x0546,
  28577. "Nsmall",
  28578. 0xf76e,
  28579. "Ntilde",
  28580. 0x00d1,
  28581. "Ntildesmall",
  28582. 0xf7f1,
  28583. "Nu",
  28584. 0x039d,
  28585. "O",
  28586. 0x004f,
  28587. "OE",
  28588. 0x0152,
  28589. "OEsmall",
  28590. 0xf6fa,
  28591. "Oacute",
  28592. 0x00d3,
  28593. "Oacutesmall",
  28594. 0xf7f3,
  28595. "Obarredcyrillic",
  28596. 0x04e8,
  28597. "Obarreddieresiscyrillic",
  28598. 0x04ea,
  28599. "Obreve",
  28600. 0x014e,
  28601. "Ocaron",
  28602. 0x01d1,
  28603. "Ocenteredtilde",
  28604. 0x019f,
  28605. "Ocircle",
  28606. 0x24c4,
  28607. "Ocircumflex",
  28608. 0x00d4,
  28609. "Ocircumflexacute",
  28610. 0x1ed0,
  28611. "Ocircumflexdotbelow",
  28612. 0x1ed8,
  28613. "Ocircumflexgrave",
  28614. 0x1ed2,
  28615. "Ocircumflexhookabove",
  28616. 0x1ed4,
  28617. "Ocircumflexsmall",
  28618. 0xf7f4,
  28619. "Ocircumflextilde",
  28620. 0x1ed6,
  28621. "Ocyrillic",
  28622. 0x041e,
  28623. "Odblacute",
  28624. 0x0150,
  28625. "Odblgrave",
  28626. 0x020c,
  28627. "Odieresis",
  28628. 0x00d6,
  28629. "Odieresiscyrillic",
  28630. 0x04e6,
  28631. "Odieresissmall",
  28632. 0xf7f6,
  28633. "Odotbelow",
  28634. 0x1ecc,
  28635. "Ogoneksmall",
  28636. 0xf6fb,
  28637. "Ograve",
  28638. 0x00d2,
  28639. "Ogravesmall",
  28640. 0xf7f2,
  28641. "Oharmenian",
  28642. 0x0555,
  28643. "Ohm",
  28644. 0x2126,
  28645. "Ohookabove",
  28646. 0x1ece,
  28647. "Ohorn",
  28648. 0x01a0,
  28649. "Ohornacute",
  28650. 0x1eda,
  28651. "Ohorndotbelow",
  28652. 0x1ee2,
  28653. "Ohorngrave",
  28654. 0x1edc,
  28655. "Ohornhookabove",
  28656. 0x1ede,
  28657. "Ohorntilde",
  28658. 0x1ee0,
  28659. "Ohungarumlaut",
  28660. 0x0150,
  28661. "Oi",
  28662. 0x01a2,
  28663. "Oinvertedbreve",
  28664. 0x020e,
  28665. "Omacron",
  28666. 0x014c,
  28667. "Omacronacute",
  28668. 0x1e52,
  28669. "Omacrongrave",
  28670. 0x1e50,
  28671. "Omega",
  28672. 0x2126,
  28673. "Omegacyrillic",
  28674. 0x0460,
  28675. "Omegagreek",
  28676. 0x03a9,
  28677. "Omegaroundcyrillic",
  28678. 0x047a,
  28679. "Omegatitlocyrillic",
  28680. 0x047c,
  28681. "Omegatonos",
  28682. 0x038f,
  28683. "Omicron",
  28684. 0x039f,
  28685. "Omicrontonos",
  28686. 0x038c,
  28687. "Omonospace",
  28688. 0xff2f,
  28689. "Oneroman",
  28690. 0x2160,
  28691. "Oogonek",
  28692. 0x01ea,
  28693. "Oogonekmacron",
  28694. 0x01ec,
  28695. "Oopen",
  28696. 0x0186,
  28697. "Oslash",
  28698. 0x00d8,
  28699. "Oslashacute",
  28700. 0x01fe,
  28701. "Oslashsmall",
  28702. 0xf7f8,
  28703. "Osmall",
  28704. 0xf76f,
  28705. "Ostrokeacute",
  28706. 0x01fe,
  28707. "Otcyrillic",
  28708. 0x047e,
  28709. "Otilde",
  28710. 0x00d5,
  28711. "Otildeacute",
  28712. 0x1e4c,
  28713. "Otildedieresis",
  28714. 0x1e4e,
  28715. "Otildesmall",
  28716. 0xf7f5,
  28717. "P",
  28718. 0x0050,
  28719. "Pacute",
  28720. 0x1e54,
  28721. "Pcircle",
  28722. 0x24c5,
  28723. "Pdotaccent",
  28724. 0x1e56,
  28725. "Pecyrillic",
  28726. 0x041f,
  28727. "Peharmenian",
  28728. 0x054a,
  28729. "Pemiddlehookcyrillic",
  28730. 0x04a6,
  28731. "Phi",
  28732. 0x03a6,
  28733. "Phook",
  28734. 0x01a4,
  28735. "Pi",
  28736. 0x03a0,
  28737. "Piwrarmenian",
  28738. 0x0553,
  28739. "Pmonospace",
  28740. 0xff30,
  28741. "Psi",
  28742. 0x03a8,
  28743. "Psicyrillic",
  28744. 0x0470,
  28745. "Psmall",
  28746. 0xf770,
  28747. "Q",
  28748. 0x0051,
  28749. "Qcircle",
  28750. 0x24c6,
  28751. "Qmonospace",
  28752. 0xff31,
  28753. "Qsmall",
  28754. 0xf771,
  28755. "R",
  28756. 0x0052,
  28757. "Raarmenian",
  28758. 0x054c,
  28759. "Racute",
  28760. 0x0154,
  28761. "Rcaron",
  28762. 0x0158,
  28763. "Rcedilla",
  28764. 0x0156,
  28765. "Rcircle",
  28766. 0x24c7,
  28767. "Rcommaaccent",
  28768. 0x0156,
  28769. "Rdblgrave",
  28770. 0x0210,
  28771. "Rdotaccent",
  28772. 0x1e58,
  28773. "Rdotbelow",
  28774. 0x1e5a,
  28775. "Rdotbelowmacron",
  28776. 0x1e5c,
  28777. "Reharmenian",
  28778. 0x0550,
  28779. "Rfraktur",
  28780. 0x211c,
  28781. "Rho",
  28782. 0x03a1,
  28783. "Ringsmall",
  28784. 0xf6fc,
  28785. "Rinvertedbreve",
  28786. 0x0212,
  28787. "Rlinebelow",
  28788. 0x1e5e,
  28789. "Rmonospace",
  28790. 0xff32,
  28791. "Rsmall",
  28792. 0xf772,
  28793. "Rsmallinverted",
  28794. 0x0281,
  28795. "Rsmallinvertedsuperior",
  28796. 0x02b6,
  28797. "S",
  28798. 0x0053,
  28799. "SF010000",
  28800. 0x250c,
  28801. "SF020000",
  28802. 0x2514,
  28803. "SF030000",
  28804. 0x2510,
  28805. "SF040000",
  28806. 0x2518,
  28807. "SF050000",
  28808. 0x253c,
  28809. "SF060000",
  28810. 0x252c,
  28811. "SF070000",
  28812. 0x2534,
  28813. "SF080000",
  28814. 0x251c,
  28815. "SF090000",
  28816. 0x2524,
  28817. "SF100000",
  28818. 0x2500,
  28819. "SF110000",
  28820. 0x2502,
  28821. "SF190000",
  28822. 0x2561,
  28823. "SF200000",
  28824. 0x2562,
  28825. "SF210000",
  28826. 0x2556,
  28827. "SF220000",
  28828. 0x2555,
  28829. "SF230000",
  28830. 0x2563,
  28831. "SF240000",
  28832. 0x2551,
  28833. "SF250000",
  28834. 0x2557,
  28835. "SF260000",
  28836. 0x255d,
  28837. "SF270000",
  28838. 0x255c,
  28839. "SF280000",
  28840. 0x255b,
  28841. "SF360000",
  28842. 0x255e,
  28843. "SF370000",
  28844. 0x255f,
  28845. "SF380000",
  28846. 0x255a,
  28847. "SF390000",
  28848. 0x2554,
  28849. "SF400000",
  28850. 0x2569,
  28851. "SF410000",
  28852. 0x2566,
  28853. "SF420000",
  28854. 0x2560,
  28855. "SF430000",
  28856. 0x2550,
  28857. "SF440000",
  28858. 0x256c,
  28859. "SF450000",
  28860. 0x2567,
  28861. "SF460000",
  28862. 0x2568,
  28863. "SF470000",
  28864. 0x2564,
  28865. "SF480000",
  28866. 0x2565,
  28867. "SF490000",
  28868. 0x2559,
  28869. "SF500000",
  28870. 0x2558,
  28871. "SF510000",
  28872. 0x2552,
  28873. "SF520000",
  28874. 0x2553,
  28875. "SF530000",
  28876. 0x256b,
  28877. "SF540000",
  28878. 0x256a,
  28879. "Sacute",
  28880. 0x015a,
  28881. "Sacutedotaccent",
  28882. 0x1e64,
  28883. "Sampigreek",
  28884. 0x03e0,
  28885. "Scaron",
  28886. 0x0160,
  28887. "Scarondotaccent",
  28888. 0x1e66,
  28889. "Scaronsmall",
  28890. 0xf6fd,
  28891. "Scedilla",
  28892. 0x015e,
  28893. "Schwa",
  28894. 0x018f,
  28895. "Schwacyrillic",
  28896. 0x04d8,
  28897. "Schwadieresiscyrillic",
  28898. 0x04da,
  28899. "Scircle",
  28900. 0x24c8,
  28901. "Scircumflex",
  28902. 0x015c,
  28903. "Scommaaccent",
  28904. 0x0218,
  28905. "Sdotaccent",
  28906. 0x1e60,
  28907. "Sdotbelow",
  28908. 0x1e62,
  28909. "Sdotbelowdotaccent",
  28910. 0x1e68,
  28911. "Seharmenian",
  28912. 0x054d,
  28913. "Sevenroman",
  28914. 0x2166,
  28915. "Shaarmenian",
  28916. 0x0547,
  28917. "Shacyrillic",
  28918. 0x0428,
  28919. "Shchacyrillic",
  28920. 0x0429,
  28921. "Sheicoptic",
  28922. 0x03e2,
  28923. "Shhacyrillic",
  28924. 0x04ba,
  28925. "Shimacoptic",
  28926. 0x03ec,
  28927. "Sigma",
  28928. 0x03a3,
  28929. "Sixroman",
  28930. 0x2165,
  28931. "Smonospace",
  28932. 0xff33,
  28933. "Softsigncyrillic",
  28934. 0x042c,
  28935. "Ssmall",
  28936. 0xf773,
  28937. "Stigmagreek",
  28938. 0x03da,
  28939. "T",
  28940. 0x0054,
  28941. "Tau",
  28942. 0x03a4,
  28943. "Tbar",
  28944. 0x0166,
  28945. "Tcaron",
  28946. 0x0164,
  28947. "Tcedilla",
  28948. 0x0162,
  28949. "Tcircle",
  28950. 0x24c9,
  28951. "Tcircumflexbelow",
  28952. 0x1e70,
  28953. "Tcommaaccent",
  28954. 0x0162,
  28955. "Tdotaccent",
  28956. 0x1e6a,
  28957. "Tdotbelow",
  28958. 0x1e6c,
  28959. "Tecyrillic",
  28960. 0x0422,
  28961. "Tedescendercyrillic",
  28962. 0x04ac,
  28963. "Tenroman",
  28964. 0x2169,
  28965. "Tetsecyrillic",
  28966. 0x04b4,
  28967. "Theta",
  28968. 0x0398,
  28969. "Thook",
  28970. 0x01ac,
  28971. "Thorn",
  28972. 0x00de,
  28973. "Thornsmall",
  28974. 0xf7fe,
  28975. "Threeroman",
  28976. 0x2162,
  28977. "Tildesmall",
  28978. 0xf6fe,
  28979. "Tiwnarmenian",
  28980. 0x054f,
  28981. "Tlinebelow",
  28982. 0x1e6e,
  28983. "Tmonospace",
  28984. 0xff34,
  28985. "Toarmenian",
  28986. 0x0539,
  28987. "Tonefive",
  28988. 0x01bc,
  28989. "Tonesix",
  28990. 0x0184,
  28991. "Tonetwo",
  28992. 0x01a7,
  28993. "Tretroflexhook",
  28994. 0x01ae,
  28995. "Tsecyrillic",
  28996. 0x0426,
  28997. "Tshecyrillic",
  28998. 0x040b,
  28999. "Tsmall",
  29000. 0xf774,
  29001. "Twelveroman",
  29002. 0x216b,
  29003. "Tworoman",
  29004. 0x2161,
  29005. "U",
  29006. 0x0055,
  29007. "Uacute",
  29008. 0x00da,
  29009. "Uacutesmall",
  29010. 0xf7fa,
  29011. "Ubreve",
  29012. 0x016c,
  29013. "Ucaron",
  29014. 0x01d3,
  29015. "Ucircle",
  29016. 0x24ca,
  29017. "Ucircumflex",
  29018. 0x00db,
  29019. "Ucircumflexbelow",
  29020. 0x1e76,
  29021. "Ucircumflexsmall",
  29022. 0xf7fb,
  29023. "Ucyrillic",
  29024. 0x0423,
  29025. "Udblacute",
  29026. 0x0170,
  29027. "Udblgrave",
  29028. 0x0214,
  29029. "Udieresis",
  29030. 0x00dc,
  29031. "Udieresisacute",
  29032. 0x01d7,
  29033. "Udieresisbelow",
  29034. 0x1e72,
  29035. "Udieresiscaron",
  29036. 0x01d9,
  29037. "Udieresiscyrillic",
  29038. 0x04f0,
  29039. "Udieresisgrave",
  29040. 0x01db,
  29041. "Udieresismacron",
  29042. 0x01d5,
  29043. "Udieresissmall",
  29044. 0xf7fc,
  29045. "Udotbelow",
  29046. 0x1ee4,
  29047. "Ugrave",
  29048. 0x00d9,
  29049. "Ugravesmall",
  29050. 0xf7f9,
  29051. "Uhookabove",
  29052. 0x1ee6,
  29053. "Uhorn",
  29054. 0x01af,
  29055. "Uhornacute",
  29056. 0x1ee8,
  29057. "Uhorndotbelow",
  29058. 0x1ef0,
  29059. "Uhorngrave",
  29060. 0x1eea,
  29061. "Uhornhookabove",
  29062. 0x1eec,
  29063. "Uhorntilde",
  29064. 0x1eee,
  29065. "Uhungarumlaut",
  29066. 0x0170,
  29067. "Uhungarumlautcyrillic",
  29068. 0x04f2,
  29069. "Uinvertedbreve",
  29070. 0x0216,
  29071. "Ukcyrillic",
  29072. 0x0478,
  29073. "Umacron",
  29074. 0x016a,
  29075. "Umacroncyrillic",
  29076. 0x04ee,
  29077. "Umacrondieresis",
  29078. 0x1e7a,
  29079. "Umonospace",
  29080. 0xff35,
  29081. "Uogonek",
  29082. 0x0172,
  29083. "Upsilon",
  29084. 0x03a5,
  29085. "Upsilon1",
  29086. 0x03d2,
  29087. "Upsilonacutehooksymbolgreek",
  29088. 0x03d3,
  29089. "Upsilonafrican",
  29090. 0x01b1,
  29091. "Upsilondieresis",
  29092. 0x03ab,
  29093. "Upsilondieresishooksymbolgreek",
  29094. 0x03d4,
  29095. "Upsilonhooksymbol",
  29096. 0x03d2,
  29097. "Upsilontonos",
  29098. 0x038e,
  29099. "Uring",
  29100. 0x016e,
  29101. "Ushortcyrillic",
  29102. 0x040e,
  29103. "Usmall",
  29104. 0xf775,
  29105. "Ustraightcyrillic",
  29106. 0x04ae,
  29107. "Ustraightstrokecyrillic",
  29108. 0x04b0,
  29109. "Utilde",
  29110. 0x0168,
  29111. "Utildeacute",
  29112. 0x1e78,
  29113. "Utildebelow",
  29114. 0x1e74,
  29115. "V",
  29116. 0x0056,
  29117. "Vcircle",
  29118. 0x24cb,
  29119. "Vdotbelow",
  29120. 0x1e7e,
  29121. "Vecyrillic",
  29122. 0x0412,
  29123. "Vewarmenian",
  29124. 0x054e,
  29125. "Vhook",
  29126. 0x01b2,
  29127. "Vmonospace",
  29128. 0xff36,
  29129. "Voarmenian",
  29130. 0x0548,
  29131. "Vsmall",
  29132. 0xf776,
  29133. "Vtilde",
  29134. 0x1e7c,
  29135. "W",
  29136. 0x0057,
  29137. "Wacute",
  29138. 0x1e82,
  29139. "Wcircle",
  29140. 0x24cc,
  29141. "Wcircumflex",
  29142. 0x0174,
  29143. "Wdieresis",
  29144. 0x1e84,
  29145. "Wdotaccent",
  29146. 0x1e86,
  29147. "Wdotbelow",
  29148. 0x1e88,
  29149. "Wgrave",
  29150. 0x1e80,
  29151. "Wmonospace",
  29152. 0xff37,
  29153. "Wsmall",
  29154. 0xf777,
  29155. "X",
  29156. 0x0058,
  29157. "Xcircle",
  29158. 0x24cd,
  29159. "Xdieresis",
  29160. 0x1e8c,
  29161. "Xdotaccent",
  29162. 0x1e8a,
  29163. "Xeharmenian",
  29164. 0x053d,
  29165. "Xi",
  29166. 0x039e,
  29167. "Xmonospace",
  29168. 0xff38,
  29169. "Xsmall",
  29170. 0xf778,
  29171. "Y",
  29172. 0x0059,
  29173. "Yacute",
  29174. 0x00dd,
  29175. "Yacutesmall",
  29176. 0xf7fd,
  29177. "Yatcyrillic",
  29178. 0x0462,
  29179. "Ycircle",
  29180. 0x24ce,
  29181. "Ycircumflex",
  29182. 0x0176,
  29183. "Ydieresis",
  29184. 0x0178,
  29185. "Ydieresissmall",
  29186. 0xf7ff,
  29187. "Ydotaccent",
  29188. 0x1e8e,
  29189. "Ydotbelow",
  29190. 0x1ef4,
  29191. "Yericyrillic",
  29192. 0x042b,
  29193. "Yerudieresiscyrillic",
  29194. 0x04f8,
  29195. "Ygrave",
  29196. 0x1ef2,
  29197. "Yhook",
  29198. 0x01b3,
  29199. "Yhookabove",
  29200. 0x1ef6,
  29201. "Yiarmenian",
  29202. 0x0545,
  29203. "Yicyrillic",
  29204. 0x0407,
  29205. "Yiwnarmenian",
  29206. 0x0552,
  29207. "Ymonospace",
  29208. 0xff39,
  29209. "Ysmall",
  29210. 0xf779,
  29211. "Ytilde",
  29212. 0x1ef8,
  29213. "Yusbigcyrillic",
  29214. 0x046a,
  29215. "Yusbigiotifiedcyrillic",
  29216. 0x046c,
  29217. "Yuslittlecyrillic",
  29218. 0x0466,
  29219. "Yuslittleiotifiedcyrillic",
  29220. 0x0468,
  29221. "Z",
  29222. 0x005a,
  29223. "Zaarmenian",
  29224. 0x0536,
  29225. "Zacute",
  29226. 0x0179,
  29227. "Zcaron",
  29228. 0x017d,
  29229. "Zcaronsmall",
  29230. 0xf6ff,
  29231. "Zcircle",
  29232. 0x24cf,
  29233. "Zcircumflex",
  29234. 0x1e90,
  29235. "Zdot",
  29236. 0x017b,
  29237. "Zdotaccent",
  29238. 0x017b,
  29239. "Zdotbelow",
  29240. 0x1e92,
  29241. "Zecyrillic",
  29242. 0x0417,
  29243. "Zedescendercyrillic",
  29244. 0x0498,
  29245. "Zedieresiscyrillic",
  29246. 0x04de,
  29247. "Zeta",
  29248. 0x0396,
  29249. "Zhearmenian",
  29250. 0x053a,
  29251. "Zhebrevecyrillic",
  29252. 0x04c1,
  29253. "Zhecyrillic",
  29254. 0x0416,
  29255. "Zhedescendercyrillic",
  29256. 0x0496,
  29257. "Zhedieresiscyrillic",
  29258. 0x04dc,
  29259. "Zlinebelow",
  29260. 0x1e94,
  29261. "Zmonospace",
  29262. 0xff3a,
  29263. "Zsmall",
  29264. 0xf77a,
  29265. "Zstroke",
  29266. 0x01b5,
  29267. "a",
  29268. 0x0061,
  29269. "aabengali",
  29270. 0x0986,
  29271. "aacute",
  29272. 0x00e1,
  29273. "aadeva",
  29274. 0x0906,
  29275. "aagujarati",
  29276. 0x0a86,
  29277. "aagurmukhi",
  29278. 0x0a06,
  29279. "aamatragurmukhi",
  29280. 0x0a3e,
  29281. "aarusquare",
  29282. 0x3303,
  29283. "aavowelsignbengali",
  29284. 0x09be,
  29285. "aavowelsigndeva",
  29286. 0x093e,
  29287. "aavowelsigngujarati",
  29288. 0x0abe,
  29289. "abbreviationmarkarmenian",
  29290. 0x055f,
  29291. "abbreviationsigndeva",
  29292. 0x0970,
  29293. "abengali",
  29294. 0x0985,
  29295. "abopomofo",
  29296. 0x311a,
  29297. "abreve",
  29298. 0x0103,
  29299. "abreveacute",
  29300. 0x1eaf,
  29301. "abrevecyrillic",
  29302. 0x04d1,
  29303. "abrevedotbelow",
  29304. 0x1eb7,
  29305. "abrevegrave",
  29306. 0x1eb1,
  29307. "abrevehookabove",
  29308. 0x1eb3,
  29309. "abrevetilde",
  29310. 0x1eb5,
  29311. "acaron",
  29312. 0x01ce,
  29313. "acircle",
  29314. 0x24d0,
  29315. "acircumflex",
  29316. 0x00e2,
  29317. "acircumflexacute",
  29318. 0x1ea5,
  29319. "acircumflexdotbelow",
  29320. 0x1ead,
  29321. "acircumflexgrave",
  29322. 0x1ea7,
  29323. "acircumflexhookabove",
  29324. 0x1ea9,
  29325. "acircumflextilde",
  29326. 0x1eab,
  29327. "acute",
  29328. 0x00b4,
  29329. "acutebelowcmb",
  29330. 0x0317,
  29331. "acutecmb",
  29332. 0x0301,
  29333. "acutecomb",
  29334. 0x0301,
  29335. "acutedeva",
  29336. 0x0954,
  29337. "acutelowmod",
  29338. 0x02cf,
  29339. "acutetonecmb",
  29340. 0x0341,
  29341. "acyrillic",
  29342. 0x0430,
  29343. "adblgrave",
  29344. 0x0201,
  29345. "addakgurmukhi",
  29346. 0x0a71,
  29347. "adeva",
  29348. 0x0905,
  29349. "adieresis",
  29350. 0x00e4,
  29351. "adieresiscyrillic",
  29352. 0x04d3,
  29353. "adieresismacron",
  29354. 0x01df,
  29355. "adotbelow",
  29356. 0x1ea1,
  29357. "adotmacron",
  29358. 0x01e1,
  29359. "ae",
  29360. 0x00e6,
  29361. "aeacute",
  29362. 0x01fd,
  29363. "aekorean",
  29364. 0x3150,
  29365. "aemacron",
  29366. 0x01e3,
  29367. "afii00208",
  29368. 0x2015,
  29369. "afii08941",
  29370. 0x20a4,
  29371. "afii10017",
  29372. 0x0410,
  29373. "afii10018",
  29374. 0x0411,
  29375. "afii10019",
  29376. 0x0412,
  29377. "afii10020",
  29378. 0x0413,
  29379. "afii10021",
  29380. 0x0414,
  29381. "afii10022",
  29382. 0x0415,
  29383. "afii10023",
  29384. 0x0401,
  29385. "afii10024",
  29386. 0x0416,
  29387. "afii10025",
  29388. 0x0417,
  29389. "afii10026",
  29390. 0x0418,
  29391. "afii10027",
  29392. 0x0419,
  29393. "afii10028",
  29394. 0x041a,
  29395. "afii10029",
  29396. 0x041b,
  29397. "afii10030",
  29398. 0x041c,
  29399. "afii10031",
  29400. 0x041d,
  29401. "afii10032",
  29402. 0x041e,
  29403. "afii10033",
  29404. 0x041f,
  29405. "afii10034",
  29406. 0x0420,
  29407. "afii10035",
  29408. 0x0421,
  29409. "afii10036",
  29410. 0x0422,
  29411. "afii10037",
  29412. 0x0423,
  29413. "afii10038",
  29414. 0x0424,
  29415. "afii10039",
  29416. 0x0425,
  29417. "afii10040",
  29418. 0x0426,
  29419. "afii10041",
  29420. 0x0427,
  29421. "afii10042",
  29422. 0x0428,
  29423. "afii10043",
  29424. 0x0429,
  29425. "afii10044",
  29426. 0x042a,
  29427. "afii10045",
  29428. 0x042b,
  29429. "afii10046",
  29430. 0x042c,
  29431. "afii10047",
  29432. 0x042d,
  29433. "afii10048",
  29434. 0x042e,
  29435. "afii10049",
  29436. 0x042f,
  29437. "afii10050",
  29438. 0x0490,
  29439. "afii10051",
  29440. 0x0402,
  29441. "afii10052",
  29442. 0x0403,
  29443. "afii10053",
  29444. 0x0404,
  29445. "afii10054",
  29446. 0x0405,
  29447. "afii10055",
  29448. 0x0406,
  29449. "afii10056",
  29450. 0x0407,
  29451. "afii10057",
  29452. 0x0408,
  29453. "afii10058",
  29454. 0x0409,
  29455. "afii10059",
  29456. 0x040a,
  29457. "afii10060",
  29458. 0x040b,
  29459. "afii10061",
  29460. 0x040c,
  29461. "afii10062",
  29462. 0x040e,
  29463. "afii10063",
  29464. 0xf6c4,
  29465. "afii10064",
  29466. 0xf6c5,
  29467. "afii10065",
  29468. 0x0430,
  29469. "afii10066",
  29470. 0x0431,
  29471. "afii10067",
  29472. 0x0432,
  29473. "afii10068",
  29474. 0x0433,
  29475. "afii10069",
  29476. 0x0434,
  29477. "afii10070",
  29478. 0x0435,
  29479. "afii10071",
  29480. 0x0451,
  29481. "afii10072",
  29482. 0x0436,
  29483. "afii10073",
  29484. 0x0437,
  29485. "afii10074",
  29486. 0x0438,
  29487. "afii10075",
  29488. 0x0439,
  29489. "afii10076",
  29490. 0x043a,
  29491. "afii10077",
  29492. 0x043b,
  29493. "afii10078",
  29494. 0x043c,
  29495. "afii10079",
  29496. 0x043d,
  29497. "afii10080",
  29498. 0x043e,
  29499. "afii10081",
  29500. 0x043f,
  29501. "afii10082",
  29502. 0x0440,
  29503. "afii10083",
  29504. 0x0441,
  29505. "afii10084",
  29506. 0x0442,
  29507. "afii10085",
  29508. 0x0443,
  29509. "afii10086",
  29510. 0x0444,
  29511. "afii10087",
  29512. 0x0445,
  29513. "afii10088",
  29514. 0x0446,
  29515. "afii10089",
  29516. 0x0447,
  29517. "afii10090",
  29518. 0x0448,
  29519. "afii10091",
  29520. 0x0449,
  29521. "afii10092",
  29522. 0x044a,
  29523. "afii10093",
  29524. 0x044b,
  29525. "afii10094",
  29526. 0x044c,
  29527. "afii10095",
  29528. 0x044d,
  29529. "afii10096",
  29530. 0x044e,
  29531. "afii10097",
  29532. 0x044f,
  29533. "afii10098",
  29534. 0x0491,
  29535. "afii10099",
  29536. 0x0452,
  29537. "afii10100",
  29538. 0x0453,
  29539. "afii10101",
  29540. 0x0454,
  29541. "afii10102",
  29542. 0x0455,
  29543. "afii10103",
  29544. 0x0456,
  29545. "afii10104",
  29546. 0x0457,
  29547. "afii10105",
  29548. 0x0458,
  29549. "afii10106",
  29550. 0x0459,
  29551. "afii10107",
  29552. 0x045a,
  29553. "afii10108",
  29554. 0x045b,
  29555. "afii10109",
  29556. 0x045c,
  29557. "afii10110",
  29558. 0x045e,
  29559. "afii10145",
  29560. 0x040f,
  29561. "afii10146",
  29562. 0x0462,
  29563. "afii10147",
  29564. 0x0472,
  29565. "afii10148",
  29566. 0x0474,
  29567. "afii10192",
  29568. 0xf6c6,
  29569. "afii10193",
  29570. 0x045f,
  29571. "afii10194",
  29572. 0x0463,
  29573. "afii10195",
  29574. 0x0473,
  29575. "afii10196",
  29576. 0x0475,
  29577. "afii10831",
  29578. 0xf6c7,
  29579. "afii10832",
  29580. 0xf6c8,
  29581. "afii10846",
  29582. 0x04d9,
  29583. "afii299",
  29584. 0x200e,
  29585. "afii300",
  29586. 0x200f,
  29587. "afii301",
  29588. 0x200d,
  29589. "afii57381",
  29590. 0x066a,
  29591. "afii57388",
  29592. 0x060c,
  29593. "afii57392",
  29594. 0x0660,
  29595. "afii57393",
  29596. 0x0661,
  29597. "afii57394",
  29598. 0x0662,
  29599. "afii57395",
  29600. 0x0663,
  29601. "afii57396",
  29602. 0x0664,
  29603. "afii57397",
  29604. 0x0665,
  29605. "afii57398",
  29606. 0x0666,
  29607. "afii57399",
  29608. 0x0667,
  29609. "afii57400",
  29610. 0x0668,
  29611. "afii57401",
  29612. 0x0669,
  29613. "afii57403",
  29614. 0x061b,
  29615. "afii57407",
  29616. 0x061f,
  29617. "afii57409",
  29618. 0x0621,
  29619. "afii57410",
  29620. 0x0622,
  29621. "afii57411",
  29622. 0x0623,
  29623. "afii57412",
  29624. 0x0624,
  29625. "afii57413",
  29626. 0x0625,
  29627. "afii57414",
  29628. 0x0626,
  29629. "afii57415",
  29630. 0x0627,
  29631. "afii57416",
  29632. 0x0628,
  29633. "afii57417",
  29634. 0x0629,
  29635. "afii57418",
  29636. 0x062a,
  29637. "afii57419",
  29638. 0x062b,
  29639. "afii57420",
  29640. 0x062c,
  29641. "afii57421",
  29642. 0x062d,
  29643. "afii57422",
  29644. 0x062e,
  29645. "afii57423",
  29646. 0x062f,
  29647. "afii57424",
  29648. 0x0630,
  29649. "afii57425",
  29650. 0x0631,
  29651. "afii57426",
  29652. 0x0632,
  29653. "afii57427",
  29654. 0x0633,
  29655. "afii57428",
  29656. 0x0634,
  29657. "afii57429",
  29658. 0x0635,
  29659. "afii57430",
  29660. 0x0636,
  29661. "afii57431",
  29662. 0x0637,
  29663. "afii57432",
  29664. 0x0638,
  29665. "afii57433",
  29666. 0x0639,
  29667. "afii57434",
  29668. 0x063a,
  29669. "afii57440",
  29670. 0x0640,
  29671. "afii57441",
  29672. 0x0641,
  29673. "afii57442",
  29674. 0x0642,
  29675. "afii57443",
  29676. 0x0643,
  29677. "afii57444",
  29678. 0x0644,
  29679. "afii57445",
  29680. 0x0645,
  29681. "afii57446",
  29682. 0x0646,
  29683. "afii57448",
  29684. 0x0648,
  29685. "afii57449",
  29686. 0x0649,
  29687. "afii57450",
  29688. 0x064a,
  29689. "afii57451",
  29690. 0x064b,
  29691. "afii57452",
  29692. 0x064c,
  29693. "afii57453",
  29694. 0x064d,
  29695. "afii57454",
  29696. 0x064e,
  29697. "afii57455",
  29698. 0x064f,
  29699. "afii57456",
  29700. 0x0650,
  29701. "afii57457",
  29702. 0x0651,
  29703. "afii57458",
  29704. 0x0652,
  29705. "afii57470",
  29706. 0x0647,
  29707. "afii57505",
  29708. 0x06a4,
  29709. "afii57506",
  29710. 0x067e,
  29711. "afii57507",
  29712. 0x0686,
  29713. "afii57508",
  29714. 0x0698,
  29715. "afii57509",
  29716. 0x06af,
  29717. "afii57511",
  29718. 0x0679,
  29719. "afii57512",
  29720. 0x0688,
  29721. "afii57513",
  29722. 0x0691,
  29723. "afii57514",
  29724. 0x06ba,
  29725. "afii57519",
  29726. 0x06d2,
  29727. "afii57534",
  29728. 0x06d5,
  29729. "afii57636",
  29730. 0x20aa,
  29731. "afii57645",
  29732. 0x05be,
  29733. "afii57658",
  29734. 0x05c3,
  29735. "afii57664",
  29736. 0x05d0,
  29737. "afii57665",
  29738. 0x05d1,
  29739. "afii57666",
  29740. 0x05d2,
  29741. "afii57667",
  29742. 0x05d3,
  29743. "afii57668",
  29744. 0x05d4,
  29745. "afii57669",
  29746. 0x05d5,
  29747. "afii57670",
  29748. 0x05d6,
  29749. "afii57671",
  29750. 0x05d7,
  29751. "afii57672",
  29752. 0x05d8,
  29753. "afii57673",
  29754. 0x05d9,
  29755. "afii57674",
  29756. 0x05da,
  29757. "afii57675",
  29758. 0x05db,
  29759. "afii57676",
  29760. 0x05dc,
  29761. "afii57677",
  29762. 0x05dd,
  29763. "afii57678",
  29764. 0x05de,
  29765. "afii57679",
  29766. 0x05df,
  29767. "afii57680",
  29768. 0x05e0,
  29769. "afii57681",
  29770. 0x05e1,
  29771. "afii57682",
  29772. 0x05e2,
  29773. "afii57683",
  29774. 0x05e3,
  29775. "afii57684",
  29776. 0x05e4,
  29777. "afii57685",
  29778. 0x05e5,
  29779. "afii57686",
  29780. 0x05e6,
  29781. "afii57687",
  29782. 0x05e7,
  29783. "afii57688",
  29784. 0x05e8,
  29785. "afii57689",
  29786. 0x05e9,
  29787. "afii57690",
  29788. 0x05ea,
  29789. "afii57694",
  29790. 0xfb2a,
  29791. "afii57695",
  29792. 0xfb2b,
  29793. "afii57700",
  29794. 0xfb4b,
  29795. "afii57705",
  29796. 0xfb1f,
  29797. "afii57716",
  29798. 0x05f0,
  29799. "afii57717",
  29800. 0x05f1,
  29801. "afii57718",
  29802. 0x05f2,
  29803. "afii57723",
  29804. 0xfb35,
  29805. "afii57793",
  29806. 0x05b4,
  29807. "afii57794",
  29808. 0x05b5,
  29809. "afii57795",
  29810. 0x05b6,
  29811. "afii57796",
  29812. 0x05bb,
  29813. "afii57797",
  29814. 0x05b8,
  29815. "afii57798",
  29816. 0x05b7,
  29817. "afii57799",
  29818. 0x05b0,
  29819. "afii57800",
  29820. 0x05b2,
  29821. "afii57801",
  29822. 0x05b1,
  29823. "afii57802",
  29824. 0x05b3,
  29825. "afii57803",
  29826. 0x05c2,
  29827. "afii57804",
  29828. 0x05c1,
  29829. "afii57806",
  29830. 0x05b9,
  29831. "afii57807",
  29832. 0x05bc,
  29833. "afii57839",
  29834. 0x05bd,
  29835. "afii57841",
  29836. 0x05bf,
  29837. "afii57842",
  29838. 0x05c0,
  29839. "afii57929",
  29840. 0x02bc,
  29841. "afii61248",
  29842. 0x2105,
  29843. "afii61289",
  29844. 0x2113,
  29845. "afii61352",
  29846. 0x2116,
  29847. "afii61573",
  29848. 0x202c,
  29849. "afii61574",
  29850. 0x202d,
  29851. "afii61575",
  29852. 0x202e,
  29853. "afii61664",
  29854. 0x200c,
  29855. "afii63167",
  29856. 0x066d,
  29857. "afii64937",
  29858. 0x02bd,
  29859. "agrave",
  29860. 0x00e0,
  29861. "agujarati",
  29862. 0x0a85,
  29863. "agurmukhi",
  29864. 0x0a05,
  29865. "ahiragana",
  29866. 0x3042,
  29867. "ahookabove",
  29868. 0x1ea3,
  29869. "aibengali",
  29870. 0x0990,
  29871. "aibopomofo",
  29872. 0x311e,
  29873. "aideva",
  29874. 0x0910,
  29875. "aiecyrillic",
  29876. 0x04d5,
  29877. "aigujarati",
  29878. 0x0a90,
  29879. "aigurmukhi",
  29880. 0x0a10,
  29881. "aimatragurmukhi",
  29882. 0x0a48,
  29883. "ainarabic",
  29884. 0x0639,
  29885. "ainfinalarabic",
  29886. 0xfeca,
  29887. "aininitialarabic",
  29888. 0xfecb,
  29889. "ainmedialarabic",
  29890. 0xfecc,
  29891. "ainvertedbreve",
  29892. 0x0203,
  29893. "aivowelsignbengali",
  29894. 0x09c8,
  29895. "aivowelsigndeva",
  29896. 0x0948,
  29897. "aivowelsigngujarati",
  29898. 0x0ac8,
  29899. "akatakana",
  29900. 0x30a2,
  29901. "akatakanahalfwidth",
  29902. 0xff71,
  29903. "akorean",
  29904. 0x314f,
  29905. "alef",
  29906. 0x05d0,
  29907. "alefarabic",
  29908. 0x0627,
  29909. "alefdageshhebrew",
  29910. 0xfb30,
  29911. "aleffinalarabic",
  29912. 0xfe8e,
  29913. "alefhamzaabovearabic",
  29914. 0x0623,
  29915. "alefhamzaabovefinalarabic",
  29916. 0xfe84,
  29917. "alefhamzabelowarabic",
  29918. 0x0625,
  29919. "alefhamzabelowfinalarabic",
  29920. 0xfe88,
  29921. "alefhebrew",
  29922. 0x05d0,
  29923. "aleflamedhebrew",
  29924. 0xfb4f,
  29925. "alefmaddaabovearabic",
  29926. 0x0622,
  29927. "alefmaddaabovefinalarabic",
  29928. 0xfe82,
  29929. "alefmaksuraarabic",
  29930. 0x0649,
  29931. "alefmaksurafinalarabic",
  29932. 0xfef0,
  29933. "alefmaksurainitialarabic",
  29934. 0xfef3,
  29935. "alefmaksuramedialarabic",
  29936. 0xfef4,
  29937. "alefpatahhebrew",
  29938. 0xfb2e,
  29939. "alefqamatshebrew",
  29940. 0xfb2f,
  29941. "aleph",
  29942. 0x2135,
  29943. "allequal",
  29944. 0x224c,
  29945. "alpha",
  29946. 0x03b1,
  29947. "alphatonos",
  29948. 0x03ac,
  29949. "amacron",
  29950. 0x0101,
  29951. "amonospace",
  29952. 0xff41,
  29953. "ampersand",
  29954. 0x0026,
  29955. "ampersandmonospace",
  29956. 0xff06,
  29957. "ampersandsmall",
  29958. 0xf726,
  29959. "amsquare",
  29960. 0x33c2,
  29961. "anbopomofo",
  29962. 0x3122,
  29963. "angbopomofo",
  29964. 0x3124,
  29965. "angbracketleft",
  29966. 0x3008,
  29967. "angbracketright",
  29968. 0x3009,
  29969. "angkhankhuthai",
  29970. 0x0e5a,
  29971. "angle",
  29972. 0x2220,
  29973. "anglebracketleft",
  29974. 0x3008,
  29975. "anglebracketleftvertical",
  29976. 0xfe3f,
  29977. "anglebracketright",
  29978. 0x3009,
  29979. "anglebracketrightvertical",
  29980. 0xfe40,
  29981. "angleleft",
  29982. 0x2329,
  29983. "angleright",
  29984. 0x232a,
  29985. "angstrom",
  29986. 0x212b,
  29987. "anoteleia",
  29988. 0x0387,
  29989. "anudattadeva",
  29990. 0x0952,
  29991. "anusvarabengali",
  29992. 0x0982,
  29993. "anusvaradeva",
  29994. 0x0902,
  29995. "anusvaragujarati",
  29996. 0x0a82,
  29997. "aogonek",
  29998. 0x0105,
  29999. "apaatosquare",
  30000. 0x3300,
  30001. "aparen",
  30002. 0x249c,
  30003. "apostrophearmenian",
  30004. 0x055a,
  30005. "apostrophemod",
  30006. 0x02bc,
  30007. "apple",
  30008. 0xf8ff,
  30009. "approaches",
  30010. 0x2250,
  30011. "approxequal",
  30012. 0x2248,
  30013. "approxequalorimage",
  30014. 0x2252,
  30015. "approximatelyequal",
  30016. 0x2245,
  30017. "araeaekorean",
  30018. 0x318e,
  30019. "araeakorean",
  30020. 0x318d,
  30021. "arc",
  30022. 0x2312,
  30023. "arighthalfring",
  30024. 0x1e9a,
  30025. "aring",
  30026. 0x00e5,
  30027. "aringacute",
  30028. 0x01fb,
  30029. "aringbelow",
  30030. 0x1e01,
  30031. "arrowboth",
  30032. 0x2194,
  30033. "arrowdashdown",
  30034. 0x21e3,
  30035. "arrowdashleft",
  30036. 0x21e0,
  30037. "arrowdashright",
  30038. 0x21e2,
  30039. "arrowdashup",
  30040. 0x21e1,
  30041. "arrowdblboth",
  30042. 0x21d4,
  30043. "arrowdbldown",
  30044. 0x21d3,
  30045. "arrowdblleft",
  30046. 0x21d0,
  30047. "arrowdblright",
  30048. 0x21d2,
  30049. "arrowdblup",
  30050. 0x21d1,
  30051. "arrowdown",
  30052. 0x2193,
  30053. "arrowdownleft",
  30054. 0x2199,
  30055. "arrowdownright",
  30056. 0x2198,
  30057. "arrowdownwhite",
  30058. 0x21e9,
  30059. "arrowheaddownmod",
  30060. 0x02c5,
  30061. "arrowheadleftmod",
  30062. 0x02c2,
  30063. "arrowheadrightmod",
  30064. 0x02c3,
  30065. "arrowheadupmod",
  30066. 0x02c4,
  30067. "arrowhorizex",
  30068. 0xf8e7,
  30069. "arrowleft",
  30070. 0x2190,
  30071. "arrowleftdbl",
  30072. 0x21d0,
  30073. "arrowleftdblstroke",
  30074. 0x21cd,
  30075. "arrowleftoverright",
  30076. 0x21c6,
  30077. "arrowleftwhite",
  30078. 0x21e6,
  30079. "arrowright",
  30080. 0x2192,
  30081. "arrowrightdblstroke",
  30082. 0x21cf,
  30083. "arrowrightheavy",
  30084. 0x279e,
  30085. "arrowrightoverleft",
  30086. 0x21c4,
  30087. "arrowrightwhite",
  30088. 0x21e8,
  30089. "arrowtableft",
  30090. 0x21e4,
  30091. "arrowtabright",
  30092. 0x21e5,
  30093. "arrowup",
  30094. 0x2191,
  30095. "arrowupdn",
  30096. 0x2195,
  30097. "arrowupdnbse",
  30098. 0x21a8,
  30099. "arrowupdownbase",
  30100. 0x21a8,
  30101. "arrowupleft",
  30102. 0x2196,
  30103. "arrowupleftofdown",
  30104. 0x21c5,
  30105. "arrowupright",
  30106. 0x2197,
  30107. "arrowupwhite",
  30108. 0x21e7,
  30109. "arrowvertex",
  30110. 0xf8e6,
  30111. "asciicircum",
  30112. 0x005e,
  30113. "asciicircummonospace",
  30114. 0xff3e,
  30115. "asciitilde",
  30116. 0x007e,
  30117. "asciitildemonospace",
  30118. 0xff5e,
  30119. "ascript",
  30120. 0x0251,
  30121. "ascriptturned",
  30122. 0x0252,
  30123. "asmallhiragana",
  30124. 0x3041,
  30125. "asmallkatakana",
  30126. 0x30a1,
  30127. "asmallkatakanahalfwidth",
  30128. 0xff67,
  30129. "asterisk",
  30130. 0x002a,
  30131. "asteriskaltonearabic",
  30132. 0x066d,
  30133. "asteriskarabic",
  30134. 0x066d,
  30135. "asteriskmath",
  30136. 0x2217,
  30137. "asteriskmonospace",
  30138. 0xff0a,
  30139. "asterisksmall",
  30140. 0xfe61,
  30141. "asterism",
  30142. 0x2042,
  30143. "asuperior",
  30144. 0xf6e9,
  30145. "asymptoticallyequal",
  30146. 0x2243,
  30147. "at",
  30148. 0x0040,
  30149. "atilde",
  30150. 0x00e3,
  30151. "atmonospace",
  30152. 0xff20,
  30153. "atsmall",
  30154. 0xfe6b,
  30155. "aturned",
  30156. 0x0250,
  30157. "aubengali",
  30158. 0x0994,
  30159. "aubopomofo",
  30160. 0x3120,
  30161. "audeva",
  30162. 0x0914,
  30163. "augujarati",
  30164. 0x0a94,
  30165. "augurmukhi",
  30166. 0x0a14,
  30167. "aulengthmarkbengali",
  30168. 0x09d7,
  30169. "aumatragurmukhi",
  30170. 0x0a4c,
  30171. "auvowelsignbengali",
  30172. 0x09cc,
  30173. "auvowelsigndeva",
  30174. 0x094c,
  30175. "auvowelsigngujarati",
  30176. 0x0acc,
  30177. "avagrahadeva",
  30178. 0x093d,
  30179. "aybarmenian",
  30180. 0x0561,
  30181. "ayin",
  30182. 0x05e2,
  30183. "ayinaltonehebrew",
  30184. 0xfb20,
  30185. "ayinhebrew",
  30186. 0x05e2,
  30187. "b",
  30188. 0x0062,
  30189. "babengali",
  30190. 0x09ac,
  30191. "backslash",
  30192. 0x005c,
  30193. "backslashmonospace",
  30194. 0xff3c,
  30195. "badeva",
  30196. 0x092c,
  30197. "bagujarati",
  30198. 0x0aac,
  30199. "bagurmukhi",
  30200. 0x0a2c,
  30201. "bahiragana",
  30202. 0x3070,
  30203. "bahtthai",
  30204. 0x0e3f,
  30205. "bakatakana",
  30206. 0x30d0,
  30207. "bar",
  30208. 0x007c,
  30209. "barmonospace",
  30210. 0xff5c,
  30211. "bbopomofo",
  30212. 0x3105,
  30213. "bcircle",
  30214. 0x24d1,
  30215. "bdotaccent",
  30216. 0x1e03,
  30217. "bdotbelow",
  30218. 0x1e05,
  30219. "beamedsixteenthnotes",
  30220. 0x266c,
  30221. "because",
  30222. 0x2235,
  30223. "becyrillic",
  30224. 0x0431,
  30225. "beharabic",
  30226. 0x0628,
  30227. "behfinalarabic",
  30228. 0xfe90,
  30229. "behinitialarabic",
  30230. 0xfe91,
  30231. "behiragana",
  30232. 0x3079,
  30233. "behmedialarabic",
  30234. 0xfe92,
  30235. "behmeeminitialarabic",
  30236. 0xfc9f,
  30237. "behmeemisolatedarabic",
  30238. 0xfc08,
  30239. "behnoonfinalarabic",
  30240. 0xfc6d,
  30241. "bekatakana",
  30242. 0x30d9,
  30243. "benarmenian",
  30244. 0x0562,
  30245. "bet",
  30246. 0x05d1,
  30247. "beta",
  30248. 0x03b2,
  30249. "betasymbolgreek",
  30250. 0x03d0,
  30251. "betdagesh",
  30252. 0xfb31,
  30253. "betdageshhebrew",
  30254. 0xfb31,
  30255. "bethebrew",
  30256. 0x05d1,
  30257. "betrafehebrew",
  30258. 0xfb4c,
  30259. "bhabengali",
  30260. 0x09ad,
  30261. "bhadeva",
  30262. 0x092d,
  30263. "bhagujarati",
  30264. 0x0aad,
  30265. "bhagurmukhi",
  30266. 0x0a2d,
  30267. "bhook",
  30268. 0x0253,
  30269. "bihiragana",
  30270. 0x3073,
  30271. "bikatakana",
  30272. 0x30d3,
  30273. "bilabialclick",
  30274. 0x0298,
  30275. "bindigurmukhi",
  30276. 0x0a02,
  30277. "birusquare",
  30278. 0x3331,
  30279. "blackcircle",
  30280. 0x25cf,
  30281. "blackdiamond",
  30282. 0x25c6,
  30283. "blackdownpointingtriangle",
  30284. 0x25bc,
  30285. "blackleftpointingpointer",
  30286. 0x25c4,
  30287. "blackleftpointingtriangle",
  30288. 0x25c0,
  30289. "blacklenticularbracketleft",
  30290. 0x3010,
  30291. "blacklenticularbracketleftvertical",
  30292. 0xfe3b,
  30293. "blacklenticularbracketright",
  30294. 0x3011,
  30295. "blacklenticularbracketrightvertical",
  30296. 0xfe3c,
  30297. "blacklowerlefttriangle",
  30298. 0x25e3,
  30299. "blacklowerrighttriangle",
  30300. 0x25e2,
  30301. "blackrectangle",
  30302. 0x25ac,
  30303. "blackrightpointingpointer",
  30304. 0x25ba,
  30305. "blackrightpointingtriangle",
  30306. 0x25b6,
  30307. "blacksmallsquare",
  30308. 0x25aa,
  30309. "blacksmilingface",
  30310. 0x263b,
  30311. "blacksquare",
  30312. 0x25a0,
  30313. "blackstar",
  30314. 0x2605,
  30315. "blackupperlefttriangle",
  30316. 0x25e4,
  30317. "blackupperrighttriangle",
  30318. 0x25e5,
  30319. "blackuppointingsmalltriangle",
  30320. 0x25b4,
  30321. "blackuppointingtriangle",
  30322. 0x25b2,
  30323. "blank",
  30324. 0x2423,
  30325. "blinebelow",
  30326. 0x1e07,
  30327. "block",
  30328. 0x2588,
  30329. "bmonospace",
  30330. 0xff42,
  30331. "bobaimaithai",
  30332. 0x0e1a,
  30333. "bohiragana",
  30334. 0x307c,
  30335. "bokatakana",
  30336. 0x30dc,
  30337. "bparen",
  30338. 0x249d,
  30339. "bqsquare",
  30340. 0x33c3,
  30341. "braceex",
  30342. 0xf8f4,
  30343. "braceleft",
  30344. 0x007b,
  30345. "braceleftbt",
  30346. 0xf8f3,
  30347. "braceleftmid",
  30348. 0xf8f2,
  30349. "braceleftmonospace",
  30350. 0xff5b,
  30351. "braceleftsmall",
  30352. 0xfe5b,
  30353. "bracelefttp",
  30354. 0xf8f1,
  30355. "braceleftvertical",
  30356. 0xfe37,
  30357. "braceright",
  30358. 0x007d,
  30359. "bracerightbt",
  30360. 0xf8fe,
  30361. "bracerightmid",
  30362. 0xf8fd,
  30363. "bracerightmonospace",
  30364. 0xff5d,
  30365. "bracerightsmall",
  30366. 0xfe5c,
  30367. "bracerighttp",
  30368. 0xf8fc,
  30369. "bracerightvertical",
  30370. 0xfe38,
  30371. "bracketleft",
  30372. 0x005b,
  30373. "bracketleftbt",
  30374. 0xf8f0,
  30375. "bracketleftex",
  30376. 0xf8ef,
  30377. "bracketleftmonospace",
  30378. 0xff3b,
  30379. "bracketlefttp",
  30380. 0xf8ee,
  30381. "bracketright",
  30382. 0x005d,
  30383. "bracketrightbt",
  30384. 0xf8fb,
  30385. "bracketrightex",
  30386. 0xf8fa,
  30387. "bracketrightmonospace",
  30388. 0xff3d,
  30389. "bracketrighttp",
  30390. 0xf8f9,
  30391. "breve",
  30392. 0x02d8,
  30393. "brevebelowcmb",
  30394. 0x032e,
  30395. "brevecmb",
  30396. 0x0306,
  30397. "breveinvertedbelowcmb",
  30398. 0x032f,
  30399. "breveinvertedcmb",
  30400. 0x0311,
  30401. "breveinverteddoublecmb",
  30402. 0x0361,
  30403. "bridgebelowcmb",
  30404. 0x032a,
  30405. "bridgeinvertedbelowcmb",
  30406. 0x033a,
  30407. "brokenbar",
  30408. 0x00a6,
  30409. "bstroke",
  30410. 0x0180,
  30411. "bsuperior",
  30412. 0xf6ea,
  30413. "btopbar",
  30414. 0x0183,
  30415. "buhiragana",
  30416. 0x3076,
  30417. "bukatakana",
  30418. 0x30d6,
  30419. "bullet",
  30420. 0x2022,
  30421. "bulletinverse",
  30422. 0x25d8,
  30423. "bulletoperator",
  30424. 0x2219,
  30425. "bullseye",
  30426. 0x25ce,
  30427. "c",
  30428. 0x0063,
  30429. "caarmenian",
  30430. 0x056e,
  30431. "cabengali",
  30432. 0x099a,
  30433. "cacute",
  30434. 0x0107,
  30435. "cadeva",
  30436. 0x091a,
  30437. "cagujarati",
  30438. 0x0a9a,
  30439. "cagurmukhi",
  30440. 0x0a1a,
  30441. "calsquare",
  30442. 0x3388,
  30443. "candrabindubengali",
  30444. 0x0981,
  30445. "candrabinducmb",
  30446. 0x0310,
  30447. "candrabindudeva",
  30448. 0x0901,
  30449. "candrabindugujarati",
  30450. 0x0a81,
  30451. "capslock",
  30452. 0x21ea,
  30453. "careof",
  30454. 0x2105,
  30455. "caron",
  30456. 0x02c7,
  30457. "caronbelowcmb",
  30458. 0x032c,
  30459. "caroncmb",
  30460. 0x030c,
  30461. "carriagereturn",
  30462. 0x21b5,
  30463. "cbopomofo",
  30464. 0x3118,
  30465. "ccaron",
  30466. 0x010d,
  30467. "ccedilla",
  30468. 0x00e7,
  30469. "ccedillaacute",
  30470. 0x1e09,
  30471. "ccircle",
  30472. 0x24d2,
  30473. "ccircumflex",
  30474. 0x0109,
  30475. "ccurl",
  30476. 0x0255,
  30477. "cdot",
  30478. 0x010b,
  30479. "cdotaccent",
  30480. 0x010b,
  30481. "cdsquare",
  30482. 0x33c5,
  30483. "cedilla",
  30484. 0x00b8,
  30485. "cedillacmb",
  30486. 0x0327,
  30487. "cent",
  30488. 0x00a2,
  30489. "centigrade",
  30490. 0x2103,
  30491. "centinferior",
  30492. 0xf6df,
  30493. "centmonospace",
  30494. 0xffe0,
  30495. "centoldstyle",
  30496. 0xf7a2,
  30497. "centsuperior",
  30498. 0xf6e0,
  30499. "chaarmenian",
  30500. 0x0579,
  30501. "chabengali",
  30502. 0x099b,
  30503. "chadeva",
  30504. 0x091b,
  30505. "chagujarati",
  30506. 0x0a9b,
  30507. "chagurmukhi",
  30508. 0x0a1b,
  30509. "chbopomofo",
  30510. 0x3114,
  30511. "cheabkhasiancyrillic",
  30512. 0x04bd,
  30513. "checkmark",
  30514. 0x2713,
  30515. "checyrillic",
  30516. 0x0447,
  30517. "chedescenderabkhasiancyrillic",
  30518. 0x04bf,
  30519. "chedescendercyrillic",
  30520. 0x04b7,
  30521. "chedieresiscyrillic",
  30522. 0x04f5,
  30523. "cheharmenian",
  30524. 0x0573,
  30525. "chekhakassiancyrillic",
  30526. 0x04cc,
  30527. "cheverticalstrokecyrillic",
  30528. 0x04b9,
  30529. "chi",
  30530. 0x03c7,
  30531. "chieuchacirclekorean",
  30532. 0x3277,
  30533. "chieuchaparenkorean",
  30534. 0x3217,
  30535. "chieuchcirclekorean",
  30536. 0x3269,
  30537. "chieuchkorean",
  30538. 0x314a,
  30539. "chieuchparenkorean",
  30540. 0x3209,
  30541. "chochangthai",
  30542. 0x0e0a,
  30543. "chochanthai",
  30544. 0x0e08,
  30545. "chochingthai",
  30546. 0x0e09,
  30547. "chochoethai",
  30548. 0x0e0c,
  30549. "chook",
  30550. 0x0188,
  30551. "cieucacirclekorean",
  30552. 0x3276,
  30553. "cieucaparenkorean",
  30554. 0x3216,
  30555. "cieuccirclekorean",
  30556. 0x3268,
  30557. "cieuckorean",
  30558. 0x3148,
  30559. "cieucparenkorean",
  30560. 0x3208,
  30561. "cieucuparenkorean",
  30562. 0x321c,
  30563. "circle",
  30564. 0x25cb,
  30565. "circlecopyrt",
  30566. 0x00a9,
  30567. "circlemultiply",
  30568. 0x2297,
  30569. "circleot",
  30570. 0x2299,
  30571. "circleplus",
  30572. 0x2295,
  30573. "circlepostalmark",
  30574. 0x3036,
  30575. "circlewithlefthalfblack",
  30576. 0x25d0,
  30577. "circlewithrighthalfblack",
  30578. 0x25d1,
  30579. "circumflex",
  30580. 0x02c6,
  30581. "circumflexbelowcmb",
  30582. 0x032d,
  30583. "circumflexcmb",
  30584. 0x0302,
  30585. "clear",
  30586. 0x2327,
  30587. "clickalveolar",
  30588. 0x01c2,
  30589. "clickdental",
  30590. 0x01c0,
  30591. "clicklateral",
  30592. 0x01c1,
  30593. "clickretroflex",
  30594. 0x01c3,
  30595. "club",
  30596. 0x2663,
  30597. "clubsuitblack",
  30598. 0x2663,
  30599. "clubsuitwhite",
  30600. 0x2667,
  30601. "cmcubedsquare",
  30602. 0x33a4,
  30603. "cmonospace",
  30604. 0xff43,
  30605. "cmsquaredsquare",
  30606. 0x33a0,
  30607. "coarmenian",
  30608. 0x0581,
  30609. "colon",
  30610. 0x003a,
  30611. "colonmonetary",
  30612. 0x20a1,
  30613. "colonmonospace",
  30614. 0xff1a,
  30615. "colonsign",
  30616. 0x20a1,
  30617. "colonsmall",
  30618. 0xfe55,
  30619. "colontriangularhalfmod",
  30620. 0x02d1,
  30621. "colontriangularmod",
  30622. 0x02d0,
  30623. "comma",
  30624. 0x002c,
  30625. "commaabovecmb",
  30626. 0x0313,
  30627. "commaaboverightcmb",
  30628. 0x0315,
  30629. "commaaccent",
  30630. 0xf6c3,
  30631. "commaarabic",
  30632. 0x060c,
  30633. "commaarmenian",
  30634. 0x055d,
  30635. "commainferior",
  30636. 0xf6e1,
  30637. "commamonospace",
  30638. 0xff0c,
  30639. "commareversedabovecmb",
  30640. 0x0314,
  30641. "commareversedmod",
  30642. 0x02bd,
  30643. "commasmall",
  30644. 0xfe50,
  30645. "commasuperior",
  30646. 0xf6e2,
  30647. "commaturnedabovecmb",
  30648. 0x0312,
  30649. "commaturnedmod",
  30650. 0x02bb,
  30651. "compass",
  30652. 0x263c,
  30653. "congruent",
  30654. 0x2245,
  30655. "contourintegral",
  30656. 0x222e,
  30657. "control",
  30658. 0x2303,
  30659. "controlACK",
  30660. 0x0006,
  30661. "controlBEL",
  30662. 0x0007,
  30663. "controlBS",
  30664. 0x0008,
  30665. "controlCAN",
  30666. 0x0018,
  30667. "controlCR",
  30668. 0x000d,
  30669. "controlDC1",
  30670. 0x0011,
  30671. "controlDC2",
  30672. 0x0012,
  30673. "controlDC3",
  30674. 0x0013,
  30675. "controlDC4",
  30676. 0x0014,
  30677. "controlDEL",
  30678. 0x007f,
  30679. "controlDLE",
  30680. 0x0010,
  30681. "controlEM",
  30682. 0x0019,
  30683. "controlENQ",
  30684. 0x0005,
  30685. "controlEOT",
  30686. 0x0004,
  30687. "controlESC",
  30688. 0x001b,
  30689. "controlETB",
  30690. 0x0017,
  30691. "controlETX",
  30692. 0x0003,
  30693. "controlFF",
  30694. 0x000c,
  30695. "controlFS",
  30696. 0x001c,
  30697. "controlGS",
  30698. 0x001d,
  30699. "controlHT",
  30700. 0x0009,
  30701. "controlLF",
  30702. 0x000a,
  30703. "controlNAK",
  30704. 0x0015,
  30705. "controlNULL",
  30706. 0x0000,
  30707. "controlRS",
  30708. 0x001e,
  30709. "controlSI",
  30710. 0x000f,
  30711. "controlSO",
  30712. 0x000e,
  30713. "controlSOT",
  30714. 0x0002,
  30715. "controlSTX",
  30716. 0x0001,
  30717. "controlSUB",
  30718. 0x001a,
  30719. "controlSYN",
  30720. 0x0016,
  30721. "controlUS",
  30722. 0x001f,
  30723. "controlVT",
  30724. 0x000b,
  30725. "copyright",
  30726. 0x00a9,
  30727. "copyrightsans",
  30728. 0xf8e9,
  30729. "copyrightserif",
  30730. 0xf6d9,
  30731. "cornerbracketleft",
  30732. 0x300c,
  30733. "cornerbracketlefthalfwidth",
  30734. 0xff62,
  30735. "cornerbracketleftvertical",
  30736. 0xfe41,
  30737. "cornerbracketright",
  30738. 0x300d,
  30739. "cornerbracketrighthalfwidth",
  30740. 0xff63,
  30741. "cornerbracketrightvertical",
  30742. 0xfe42,
  30743. "corporationsquare",
  30744. 0x337f,
  30745. "cosquare",
  30746. 0x33c7,
  30747. "coverkgsquare",
  30748. 0x33c6,
  30749. "cparen",
  30750. 0x249e,
  30751. "cruzeiro",
  30752. 0x20a2,
  30753. "cstretched",
  30754. 0x0297,
  30755. "curlyand",
  30756. 0x22cf,
  30757. "curlyor",
  30758. 0x22ce,
  30759. "currency",
  30760. 0x00a4,
  30761. "cyrBreve",
  30762. 0xf6d1,
  30763. "cyrFlex",
  30764. 0xf6d2,
  30765. "cyrbreve",
  30766. 0xf6d4,
  30767. "cyrflex",
  30768. 0xf6d5,
  30769. "d",
  30770. 0x0064,
  30771. "daarmenian",
  30772. 0x0564,
  30773. "dabengali",
  30774. 0x09a6,
  30775. "dadarabic",
  30776. 0x0636,
  30777. "dadeva",
  30778. 0x0926,
  30779. "dadfinalarabic",
  30780. 0xfebe,
  30781. "dadinitialarabic",
  30782. 0xfebf,
  30783. "dadmedialarabic",
  30784. 0xfec0,
  30785. "dagesh",
  30786. 0x05bc,
  30787. "dageshhebrew",
  30788. 0x05bc,
  30789. "dagger",
  30790. 0x2020,
  30791. "daggerdbl",
  30792. 0x2021,
  30793. "dagujarati",
  30794. 0x0aa6,
  30795. "dagurmukhi",
  30796. 0x0a26,
  30797. "dahiragana",
  30798. 0x3060,
  30799. "dakatakana",
  30800. 0x30c0,
  30801. "dalarabic",
  30802. 0x062f,
  30803. "dalet",
  30804. 0x05d3,
  30805. "daletdagesh",
  30806. 0xfb33,
  30807. "daletdageshhebrew",
  30808. 0xfb33,
  30809. "dalethebrew",
  30810. 0x05d3,
  30811. "dalfinalarabic",
  30812. 0xfeaa,
  30813. "dammaarabic",
  30814. 0x064f,
  30815. "dammalowarabic",
  30816. 0x064f,
  30817. "dammatanaltonearabic",
  30818. 0x064c,
  30819. "dammatanarabic",
  30820. 0x064c,
  30821. "danda",
  30822. 0x0964,
  30823. "dargahebrew",
  30824. 0x05a7,
  30825. "dargalefthebrew",
  30826. 0x05a7,
  30827. "dasiapneumatacyrilliccmb",
  30828. 0x0485,
  30829. "dblGrave",
  30830. 0xf6d3,
  30831. "dblanglebracketleft",
  30832. 0x300a,
  30833. "dblanglebracketleftvertical",
  30834. 0xfe3d,
  30835. "dblanglebracketright",
  30836. 0x300b,
  30837. "dblanglebracketrightvertical",
  30838. 0xfe3e,
  30839. "dblarchinvertedbelowcmb",
  30840. 0x032b,
  30841. "dblarrowleft",
  30842. 0x21d4,
  30843. "dblarrowright",
  30844. 0x21d2,
  30845. "dbldanda",
  30846. 0x0965,
  30847. "dblgrave",
  30848. 0xf6d6,
  30849. "dblgravecmb",
  30850. 0x030f,
  30851. "dblintegral",
  30852. 0x222c,
  30853. "dbllowline",
  30854. 0x2017,
  30855. "dbllowlinecmb",
  30856. 0x0333,
  30857. "dbloverlinecmb",
  30858. 0x033f,
  30859. "dblprimemod",
  30860. 0x02ba,
  30861. "dblverticalbar",
  30862. 0x2016,
  30863. "dblverticallineabovecmb",
  30864. 0x030e,
  30865. "dbopomofo",
  30866. 0x3109,
  30867. "dbsquare",
  30868. 0x33c8,
  30869. "dcaron",
  30870. 0x010f,
  30871. "dcedilla",
  30872. 0x1e11,
  30873. "dcircle",
  30874. 0x24d3,
  30875. "dcircumflexbelow",
  30876. 0x1e13,
  30877. "dcroat",
  30878. 0x0111,
  30879. "ddabengali",
  30880. 0x09a1,
  30881. "ddadeva",
  30882. 0x0921,
  30883. "ddagujarati",
  30884. 0x0aa1,
  30885. "ddagurmukhi",
  30886. 0x0a21,
  30887. "ddalarabic",
  30888. 0x0688,
  30889. "ddalfinalarabic",
  30890. 0xfb89,
  30891. "dddhadeva",
  30892. 0x095c,
  30893. "ddhabengali",
  30894. 0x09a2,
  30895. "ddhadeva",
  30896. 0x0922,
  30897. "ddhagujarati",
  30898. 0x0aa2,
  30899. "ddhagurmukhi",
  30900. 0x0a22,
  30901. "ddotaccent",
  30902. 0x1e0b,
  30903. "ddotbelow",
  30904. 0x1e0d,
  30905. "decimalseparatorarabic",
  30906. 0x066b,
  30907. "decimalseparatorpersian",
  30908. 0x066b,
  30909. "decyrillic",
  30910. 0x0434,
  30911. "degree",
  30912. 0x00b0,
  30913. "dehihebrew",
  30914. 0x05ad,
  30915. "dehiragana",
  30916. 0x3067,
  30917. "deicoptic",
  30918. 0x03ef,
  30919. "dekatakana",
  30920. 0x30c7,
  30921. "deleteleft",
  30922. 0x232b,
  30923. "deleteright",
  30924. 0x2326,
  30925. "delta",
  30926. 0x03b4,
  30927. "deltaturned",
  30928. 0x018d,
  30929. "denominatorminusonenumeratorbengali",
  30930. 0x09f8,
  30931. "dezh",
  30932. 0x02a4,
  30933. "dhabengali",
  30934. 0x09a7,
  30935. "dhadeva",
  30936. 0x0927,
  30937. "dhagujarati",
  30938. 0x0aa7,
  30939. "dhagurmukhi",
  30940. 0x0a27,
  30941. "dhook",
  30942. 0x0257,
  30943. "dialytikatonos",
  30944. 0x0385,
  30945. "dialytikatonoscmb",
  30946. 0x0344,
  30947. "diamond",
  30948. 0x2666,
  30949. "diamondsuitwhite",
  30950. 0x2662,
  30951. "dieresis",
  30952. 0x00a8,
  30953. "dieresisacute",
  30954. 0xf6d7,
  30955. "dieresisbelowcmb",
  30956. 0x0324,
  30957. "dieresiscmb",
  30958. 0x0308,
  30959. "dieresisgrave",
  30960. 0xf6d8,
  30961. "dieresistonos",
  30962. 0x0385,
  30963. "dihiragana",
  30964. 0x3062,
  30965. "dikatakana",
  30966. 0x30c2,
  30967. "dittomark",
  30968. 0x3003,
  30969. "divide",
  30970. 0x00f7,
  30971. "divides",
  30972. 0x2223,
  30973. "divisionslash",
  30974. 0x2215,
  30975. "djecyrillic",
  30976. 0x0452,
  30977. "dkshade",
  30978. 0x2593,
  30979. "dlinebelow",
  30980. 0x1e0f,
  30981. "dlsquare",
  30982. 0x3397,
  30983. "dmacron",
  30984. 0x0111,
  30985. "dmonospace",
  30986. 0xff44,
  30987. "dnblock",
  30988. 0x2584,
  30989. "dochadathai",
  30990. 0x0e0e,
  30991. "dodekthai",
  30992. 0x0e14,
  30993. "dohiragana",
  30994. 0x3069,
  30995. "dokatakana",
  30996. 0x30c9,
  30997. "dollar",
  30998. 0x0024,
  30999. "dollarinferior",
  31000. 0xf6e3,
  31001. "dollarmonospace",
  31002. 0xff04,
  31003. "dollaroldstyle",
  31004. 0xf724,
  31005. "dollarsmall",
  31006. 0xfe69,
  31007. "dollarsuperior",
  31008. 0xf6e4,
  31009. "dong",
  31010. 0x20ab,
  31011. "dorusquare",
  31012. 0x3326,
  31013. "dotaccent",
  31014. 0x02d9,
  31015. "dotaccentcmb",
  31016. 0x0307,
  31017. "dotbelowcmb",
  31018. 0x0323,
  31019. "dotbelowcomb",
  31020. 0x0323,
  31021. "dotkatakana",
  31022. 0x30fb,
  31023. "dotlessi",
  31024. 0x0131,
  31025. "dotlessj",
  31026. 0xf6be,
  31027. "dotlessjstrokehook",
  31028. 0x0284,
  31029. "dotmath",
  31030. 0x22c5,
  31031. "dottedcircle",
  31032. 0x25cc,
  31033. "doubleyodpatah",
  31034. 0xfb1f,
  31035. "doubleyodpatahhebrew",
  31036. 0xfb1f,
  31037. "downtackbelowcmb",
  31038. 0x031e,
  31039. "downtackmod",
  31040. 0x02d5,
  31041. "dparen",
  31042. 0x249f,
  31043. "dsuperior",
  31044. 0xf6eb,
  31045. "dtail",
  31046. 0x0256,
  31047. "dtopbar",
  31048. 0x018c,
  31049. "duhiragana",
  31050. 0x3065,
  31051. "dukatakana",
  31052. 0x30c5,
  31053. "dz",
  31054. 0x01f3,
  31055. "dzaltone",
  31056. 0x02a3,
  31057. "dzcaron",
  31058. 0x01c6,
  31059. "dzcurl",
  31060. 0x02a5,
  31061. "dzeabkhasiancyrillic",
  31062. 0x04e1,
  31063. "dzecyrillic",
  31064. 0x0455,
  31065. "dzhecyrillic",
  31066. 0x045f,
  31067. "e",
  31068. 0x0065,
  31069. "eacute",
  31070. 0x00e9,
  31071. "earth",
  31072. 0x2641,
  31073. "ebengali",
  31074. 0x098f,
  31075. "ebopomofo",
  31076. 0x311c,
  31077. "ebreve",
  31078. 0x0115,
  31079. "ecandradeva",
  31080. 0x090d,
  31081. "ecandragujarati",
  31082. 0x0a8d,
  31083. "ecandravowelsigndeva",
  31084. 0x0945,
  31085. "ecandravowelsigngujarati",
  31086. 0x0ac5,
  31087. "ecaron",
  31088. 0x011b,
  31089. "ecedillabreve",
  31090. 0x1e1d,
  31091. "echarmenian",
  31092. 0x0565,
  31093. "echyiwnarmenian",
  31094. 0x0587,
  31095. "ecircle",
  31096. 0x24d4,
  31097. "ecircumflex",
  31098. 0x00ea,
  31099. "ecircumflexacute",
  31100. 0x1ebf,
  31101. "ecircumflexbelow",
  31102. 0x1e19,
  31103. "ecircumflexdotbelow",
  31104. 0x1ec7,
  31105. "ecircumflexgrave",
  31106. 0x1ec1,
  31107. "ecircumflexhookabove",
  31108. 0x1ec3,
  31109. "ecircumflextilde",
  31110. 0x1ec5,
  31111. "ecyrillic",
  31112. 0x0454,
  31113. "edblgrave",
  31114. 0x0205,
  31115. "edeva",
  31116. 0x090f,
  31117. "edieresis",
  31118. 0x00eb,
  31119. "edot",
  31120. 0x0117,
  31121. "edotaccent",
  31122. 0x0117,
  31123. "edotbelow",
  31124. 0x1eb9,
  31125. "eegurmukhi",
  31126. 0x0a0f,
  31127. "eematragurmukhi",
  31128. 0x0a47,
  31129. "efcyrillic",
  31130. 0x0444,
  31131. "egrave",
  31132. 0x00e8,
  31133. "egujarati",
  31134. 0x0a8f,
  31135. "eharmenian",
  31136. 0x0567,
  31137. "ehbopomofo",
  31138. 0x311d,
  31139. "ehiragana",
  31140. 0x3048,
  31141. "ehookabove",
  31142. 0x1ebb,
  31143. "eibopomofo",
  31144. 0x311f,
  31145. "eight",
  31146. 0x0038,
  31147. "eightarabic",
  31148. 0x0668,
  31149. "eightbengali",
  31150. 0x09ee,
  31151. "eightcircle",
  31152. 0x2467,
  31153. "eightcircleinversesansserif",
  31154. 0x2791,
  31155. "eightdeva",
  31156. 0x096e,
  31157. "eighteencircle",
  31158. 0x2471,
  31159. "eighteenparen",
  31160. 0x2485,
  31161. "eighteenperiod",
  31162. 0x2499,
  31163. "eightgujarati",
  31164. 0x0aee,
  31165. "eightgurmukhi",
  31166. 0x0a6e,
  31167. "eighthackarabic",
  31168. 0x0668,
  31169. "eighthangzhou",
  31170. 0x3028,
  31171. "eighthnotebeamed",
  31172. 0x266b,
  31173. "eightideographicparen",
  31174. 0x3227,
  31175. "eightinferior",
  31176. 0x2088,
  31177. "eightmonospace",
  31178. 0xff18,
  31179. "eightoldstyle",
  31180. 0xf738,
  31181. "eightparen",
  31182. 0x247b,
  31183. "eightperiod",
  31184. 0x248f,
  31185. "eightpersian",
  31186. 0x06f8,
  31187. "eightroman",
  31188. 0x2177,
  31189. "eightsuperior",
  31190. 0x2078,
  31191. "eightthai",
  31192. 0x0e58,
  31193. "einvertedbreve",
  31194. 0x0207,
  31195. "eiotifiedcyrillic",
  31196. 0x0465,
  31197. "ekatakana",
  31198. 0x30a8,
  31199. "ekatakanahalfwidth",
  31200. 0xff74,
  31201. "ekonkargurmukhi",
  31202. 0x0a74,
  31203. "ekorean",
  31204. 0x3154,
  31205. "elcyrillic",
  31206. 0x043b,
  31207. "element",
  31208. 0x2208,
  31209. "elevencircle",
  31210. 0x246a,
  31211. "elevenparen",
  31212. 0x247e,
  31213. "elevenperiod",
  31214. 0x2492,
  31215. "elevenroman",
  31216. 0x217a,
  31217. "ellipsis",
  31218. 0x2026,
  31219. "ellipsisvertical",
  31220. 0x22ee,
  31221. "emacron",
  31222. 0x0113,
  31223. "emacronacute",
  31224. 0x1e17,
  31225. "emacrongrave",
  31226. 0x1e15,
  31227. "emcyrillic",
  31228. 0x043c,
  31229. "emdash",
  31230. 0x2014,
  31231. "emdashvertical",
  31232. 0xfe31,
  31233. "emonospace",
  31234. 0xff45,
  31235. "emphasismarkarmenian",
  31236. 0x055b,
  31237. "emptyset",
  31238. 0x2205,
  31239. "enbopomofo",
  31240. 0x3123,
  31241. "encyrillic",
  31242. 0x043d,
  31243. "endash",
  31244. 0x2013,
  31245. "endashvertical",
  31246. 0xfe32,
  31247. "endescendercyrillic",
  31248. 0x04a3,
  31249. "eng",
  31250. 0x014b,
  31251. "engbopomofo",
  31252. 0x3125,
  31253. "enghecyrillic",
  31254. 0x04a5,
  31255. "enhookcyrillic",
  31256. 0x04c8,
  31257. "enspace",
  31258. 0x2002,
  31259. "eogonek",
  31260. 0x0119,
  31261. "eokorean",
  31262. 0x3153,
  31263. "eopen",
  31264. 0x025b,
  31265. "eopenclosed",
  31266. 0x029a,
  31267. "eopenreversed",
  31268. 0x025c,
  31269. "eopenreversedclosed",
  31270. 0x025e,
  31271. "eopenreversedhook",
  31272. 0x025d,
  31273. "eparen",
  31274. 0x24a0,
  31275. "epsilon",
  31276. 0x03b5,
  31277. "epsilontonos",
  31278. 0x03ad,
  31279. "equal",
  31280. 0x003d,
  31281. "equalmonospace",
  31282. 0xff1d,
  31283. "equalsmall",
  31284. 0xfe66,
  31285. "equalsuperior",
  31286. 0x207c,
  31287. "equivalence",
  31288. 0x2261,
  31289. "erbopomofo",
  31290. 0x3126,
  31291. "ercyrillic",
  31292. 0x0440,
  31293. "ereversed",
  31294. 0x0258,
  31295. "ereversedcyrillic",
  31296. 0x044d,
  31297. "escyrillic",
  31298. 0x0441,
  31299. "esdescendercyrillic",
  31300. 0x04ab,
  31301. "esh",
  31302. 0x0283,
  31303. "eshcurl",
  31304. 0x0286,
  31305. "eshortdeva",
  31306. 0x090e,
  31307. "eshortvowelsigndeva",
  31308. 0x0946,
  31309. "eshreversedloop",
  31310. 0x01aa,
  31311. "eshsquatreversed",
  31312. 0x0285,
  31313. "esmallhiragana",
  31314. 0x3047,
  31315. "esmallkatakana",
  31316. 0x30a7,
  31317. "esmallkatakanahalfwidth",
  31318. 0xff6a,
  31319. "estimated",
  31320. 0x212e,
  31321. "esuperior",
  31322. 0xf6ec,
  31323. "eta",
  31324. 0x03b7,
  31325. "etarmenian",
  31326. 0x0568,
  31327. "etatonos",
  31328. 0x03ae,
  31329. "eth",
  31330. 0x00f0,
  31331. "etilde",
  31332. 0x1ebd,
  31333. "etildebelow",
  31334. 0x1e1b,
  31335. "etnahtafoukhhebrew",
  31336. 0x0591,
  31337. "etnahtafoukhlefthebrew",
  31338. 0x0591,
  31339. "etnahtahebrew",
  31340. 0x0591,
  31341. "etnahtalefthebrew",
  31342. 0x0591,
  31343. "eturned",
  31344. 0x01dd,
  31345. "eukorean",
  31346. 0x3161,
  31347. "euro",
  31348. 0x20ac,
  31349. "evowelsignbengali",
  31350. 0x09c7,
  31351. "evowelsigndeva",
  31352. 0x0947,
  31353. "evowelsigngujarati",
  31354. 0x0ac7,
  31355. "exclam",
  31356. 0x0021,
  31357. "exclamarmenian",
  31358. 0x055c,
  31359. "exclamdbl",
  31360. 0x203c,
  31361. "exclamdown",
  31362. 0x00a1,
  31363. "exclamdownsmall",
  31364. 0xf7a1,
  31365. "exclammonospace",
  31366. 0xff01,
  31367. "exclamsmall",
  31368. 0xf721,
  31369. "existential",
  31370. 0x2203,
  31371. "ezh",
  31372. 0x0292,
  31373. "ezhcaron",
  31374. 0x01ef,
  31375. "ezhcurl",
  31376. 0x0293,
  31377. "ezhreversed",
  31378. 0x01b9,
  31379. "ezhtail",
  31380. 0x01ba,
  31381. "f",
  31382. 0x0066,
  31383. "fadeva",
  31384. 0x095e,
  31385. "fagurmukhi",
  31386. 0x0a5e,
  31387. "fahrenheit",
  31388. 0x2109,
  31389. "fathaarabic",
  31390. 0x064e,
  31391. "fathalowarabic",
  31392. 0x064e,
  31393. "fathatanarabic",
  31394. 0x064b,
  31395. "fbopomofo",
  31396. 0x3108,
  31397. "fcircle",
  31398. 0x24d5,
  31399. "fdotaccent",
  31400. 0x1e1f,
  31401. "feharabic",
  31402. 0x0641,
  31403. "feharmenian",
  31404. 0x0586,
  31405. "fehfinalarabic",
  31406. 0xfed2,
  31407. "fehinitialarabic",
  31408. 0xfed3,
  31409. "fehmedialarabic",
  31410. 0xfed4,
  31411. "feicoptic",
  31412. 0x03e5,
  31413. "female",
  31414. 0x2640,
  31415. "ff",
  31416. 0xfb00,
  31417. "f_f",
  31418. 0xfb00,
  31419. "ffi",
  31420. 0xfb03,
  31421. "f_f_i",
  31422. 0xfb03,
  31423. "ffl",
  31424. 0xfb04,
  31425. "f_f_l",
  31426. 0xfb04,
  31427. "fi",
  31428. 0xfb01,
  31429. "f_i",
  31430. 0xfb01,
  31431. "fifteencircle",
  31432. 0x246e,
  31433. "fifteenparen",
  31434. 0x2482,
  31435. "fifteenperiod",
  31436. 0x2496,
  31437. "figuredash",
  31438. 0x2012,
  31439. "filledbox",
  31440. 0x25a0,
  31441. "filledrect",
  31442. 0x25ac,
  31443. "finalkaf",
  31444. 0x05da,
  31445. "finalkafdagesh",
  31446. 0xfb3a,
  31447. "finalkafdageshhebrew",
  31448. 0xfb3a,
  31449. "finalkafhebrew",
  31450. 0x05da,
  31451. "finalmem",
  31452. 0x05dd,
  31453. "finalmemhebrew",
  31454. 0x05dd,
  31455. "finalnun",
  31456. 0x05df,
  31457. "finalnunhebrew",
  31458. 0x05df,
  31459. "finalpe",
  31460. 0x05e3,
  31461. "finalpehebrew",
  31462. 0x05e3,
  31463. "finaltsadi",
  31464. 0x05e5,
  31465. "finaltsadihebrew",
  31466. 0x05e5,
  31467. "firsttonechinese",
  31468. 0x02c9,
  31469. "fisheye",
  31470. 0x25c9,
  31471. "fitacyrillic",
  31472. 0x0473,
  31473. "five",
  31474. 0x0035,
  31475. "fivearabic",
  31476. 0x0665,
  31477. "fivebengali",
  31478. 0x09eb,
  31479. "fivecircle",
  31480. 0x2464,
  31481. "fivecircleinversesansserif",
  31482. 0x278e,
  31483. "fivedeva",
  31484. 0x096b,
  31485. "fiveeighths",
  31486. 0x215d,
  31487. "fivegujarati",
  31488. 0x0aeb,
  31489. "fivegurmukhi",
  31490. 0x0a6b,
  31491. "fivehackarabic",
  31492. 0x0665,
  31493. "fivehangzhou",
  31494. 0x3025,
  31495. "fiveideographicparen",
  31496. 0x3224,
  31497. "fiveinferior",
  31498. 0x2085,
  31499. "fivemonospace",
  31500. 0xff15,
  31501. "fiveoldstyle",
  31502. 0xf735,
  31503. "fiveparen",
  31504. 0x2478,
  31505. "fiveperiod",
  31506. 0x248c,
  31507. "fivepersian",
  31508. 0x06f5,
  31509. "fiveroman",
  31510. 0x2174,
  31511. "fivesuperior",
  31512. 0x2075,
  31513. "fivethai",
  31514. 0x0e55,
  31515. "fl",
  31516. 0xfb02,
  31517. "f_l",
  31518. 0xfb02,
  31519. "florin",
  31520. 0x0192,
  31521. "fmonospace",
  31522. 0xff46,
  31523. "fmsquare",
  31524. 0x3399,
  31525. "fofanthai",
  31526. 0x0e1f,
  31527. "fofathai",
  31528. 0x0e1d,
  31529. "fongmanthai",
  31530. 0x0e4f,
  31531. "forall",
  31532. 0x2200,
  31533. "four",
  31534. 0x0034,
  31535. "fourarabic",
  31536. 0x0664,
  31537. "fourbengali",
  31538. 0x09ea,
  31539. "fourcircle",
  31540. 0x2463,
  31541. "fourcircleinversesansserif",
  31542. 0x278d,
  31543. "fourdeva",
  31544. 0x096a,
  31545. "fourgujarati",
  31546. 0x0aea,
  31547. "fourgurmukhi",
  31548. 0x0a6a,
  31549. "fourhackarabic",
  31550. 0x0664,
  31551. "fourhangzhou",
  31552. 0x3024,
  31553. "fourideographicparen",
  31554. 0x3223,
  31555. "fourinferior",
  31556. 0x2084,
  31557. "fourmonospace",
  31558. 0xff14,
  31559. "fournumeratorbengali",
  31560. 0x09f7,
  31561. "fouroldstyle",
  31562. 0xf734,
  31563. "fourparen",
  31564. 0x2477,
  31565. "fourperiod",
  31566. 0x248b,
  31567. "fourpersian",
  31568. 0x06f4,
  31569. "fourroman",
  31570. 0x2173,
  31571. "foursuperior",
  31572. 0x2074,
  31573. "fourteencircle",
  31574. 0x246d,
  31575. "fourteenparen",
  31576. 0x2481,
  31577. "fourteenperiod",
  31578. 0x2495,
  31579. "fourthai",
  31580. 0x0e54,
  31581. "fourthtonechinese",
  31582. 0x02cb,
  31583. "fparen",
  31584. 0x24a1,
  31585. "fraction",
  31586. 0x2044,
  31587. "franc",
  31588. 0x20a3,
  31589. "g",
  31590. 0x0067,
  31591. "gabengali",
  31592. 0x0997,
  31593. "gacute",
  31594. 0x01f5,
  31595. "gadeva",
  31596. 0x0917,
  31597. "gafarabic",
  31598. 0x06af,
  31599. "gaffinalarabic",
  31600. 0xfb93,
  31601. "gafinitialarabic",
  31602. 0xfb94,
  31603. "gafmedialarabic",
  31604. 0xfb95,
  31605. "gagujarati",
  31606. 0x0a97,
  31607. "gagurmukhi",
  31608. 0x0a17,
  31609. "gahiragana",
  31610. 0x304c,
  31611. "gakatakana",
  31612. 0x30ac,
  31613. "gamma",
  31614. 0x03b3,
  31615. "gammalatinsmall",
  31616. 0x0263,
  31617. "gammasuperior",
  31618. 0x02e0,
  31619. "gangiacoptic",
  31620. 0x03eb,
  31621. "gbopomofo",
  31622. 0x310d,
  31623. "gbreve",
  31624. 0x011f,
  31625. "gcaron",
  31626. 0x01e7,
  31627. "gcedilla",
  31628. 0x0123,
  31629. "gcircle",
  31630. 0x24d6,
  31631. "gcircumflex",
  31632. 0x011d,
  31633. "gcommaaccent",
  31634. 0x0123,
  31635. "gdot",
  31636. 0x0121,
  31637. "gdotaccent",
  31638. 0x0121,
  31639. "gecyrillic",
  31640. 0x0433,
  31641. "gehiragana",
  31642. 0x3052,
  31643. "gekatakana",
  31644. 0x30b2,
  31645. "geometricallyequal",
  31646. 0x2251,
  31647. "gereshaccenthebrew",
  31648. 0x059c,
  31649. "gereshhebrew",
  31650. 0x05f3,
  31651. "gereshmuqdamhebrew",
  31652. 0x059d,
  31653. "germandbls",
  31654. 0x00df,
  31655. "gershayimaccenthebrew",
  31656. 0x059e,
  31657. "gershayimhebrew",
  31658. 0x05f4,
  31659. "getamark",
  31660. 0x3013,
  31661. "ghabengali",
  31662. 0x0998,
  31663. "ghadarmenian",
  31664. 0x0572,
  31665. "ghadeva",
  31666. 0x0918,
  31667. "ghagujarati",
  31668. 0x0a98,
  31669. "ghagurmukhi",
  31670. 0x0a18,
  31671. "ghainarabic",
  31672. 0x063a,
  31673. "ghainfinalarabic",
  31674. 0xfece,
  31675. "ghaininitialarabic",
  31676. 0xfecf,
  31677. "ghainmedialarabic",
  31678. 0xfed0,
  31679. "ghemiddlehookcyrillic",
  31680. 0x0495,
  31681. "ghestrokecyrillic",
  31682. 0x0493,
  31683. "gheupturncyrillic",
  31684. 0x0491,
  31685. "ghhadeva",
  31686. 0x095a,
  31687. "ghhagurmukhi",
  31688. 0x0a5a,
  31689. "ghook",
  31690. 0x0260,
  31691. "ghzsquare",
  31692. 0x3393,
  31693. "gihiragana",
  31694. 0x304e,
  31695. "gikatakana",
  31696. 0x30ae,
  31697. "gimarmenian",
  31698. 0x0563,
  31699. "gimel",
  31700. 0x05d2,
  31701. "gimeldagesh",
  31702. 0xfb32,
  31703. "gimeldageshhebrew",
  31704. 0xfb32,
  31705. "gimelhebrew",
  31706. 0x05d2,
  31707. "gjecyrillic",
  31708. 0x0453,
  31709. "glottalinvertedstroke",
  31710. 0x01be,
  31711. "glottalstop",
  31712. 0x0294,
  31713. "glottalstopinverted",
  31714. 0x0296,
  31715. "glottalstopmod",
  31716. 0x02c0,
  31717. "glottalstopreversed",
  31718. 0x0295,
  31719. "glottalstopreversedmod",
  31720. 0x02c1,
  31721. "glottalstopreversedsuperior",
  31722. 0x02e4,
  31723. "glottalstopstroke",
  31724. 0x02a1,
  31725. "glottalstopstrokereversed",
  31726. 0x02a2,
  31727. "gmacron",
  31728. 0x1e21,
  31729. "gmonospace",
  31730. 0xff47,
  31731. "gohiragana",
  31732. 0x3054,
  31733. "gokatakana",
  31734. 0x30b4,
  31735. "gparen",
  31736. 0x24a2,
  31737. "gpasquare",
  31738. 0x33ac,
  31739. "gradient",
  31740. 0x2207,
  31741. "grave",
  31742. 0x0060,
  31743. "gravebelowcmb",
  31744. 0x0316,
  31745. "gravecmb",
  31746. 0x0300,
  31747. "gravecomb",
  31748. 0x0300,
  31749. "gravedeva",
  31750. 0x0953,
  31751. "gravelowmod",
  31752. 0x02ce,
  31753. "gravemonospace",
  31754. 0xff40,
  31755. "gravetonecmb",
  31756. 0x0340,
  31757. "greater",
  31758. 0x003e,
  31759. "greaterequal",
  31760. 0x2265,
  31761. "greaterequalorless",
  31762. 0x22db,
  31763. "greatermonospace",
  31764. 0xff1e,
  31765. "greaterorequivalent",
  31766. 0x2273,
  31767. "greaterorless",
  31768. 0x2277,
  31769. "greateroverequal",
  31770. 0x2267,
  31771. "greatersmall",
  31772. 0xfe65,
  31773. "gscript",
  31774. 0x0261,
  31775. "gstroke",
  31776. 0x01e5,
  31777. "guhiragana",
  31778. 0x3050,
  31779. "guillemotleft",
  31780. 0x00ab,
  31781. "guillemotright",
  31782. 0x00bb,
  31783. "guilsinglleft",
  31784. 0x2039,
  31785. "guilsinglright",
  31786. 0x203a,
  31787. "gukatakana",
  31788. 0x30b0,
  31789. "guramusquare",
  31790. 0x3318,
  31791. "gysquare",
  31792. 0x33c9,
  31793. "h",
  31794. 0x0068,
  31795. "haabkhasiancyrillic",
  31796. 0x04a9,
  31797. "haaltonearabic",
  31798. 0x06c1,
  31799. "habengali",
  31800. 0x09b9,
  31801. "hadescendercyrillic",
  31802. 0x04b3,
  31803. "hadeva",
  31804. 0x0939,
  31805. "hagujarati",
  31806. 0x0ab9,
  31807. "hagurmukhi",
  31808. 0x0a39,
  31809. "haharabic",
  31810. 0x062d,
  31811. "hahfinalarabic",
  31812. 0xfea2,
  31813. "hahinitialarabic",
  31814. 0xfea3,
  31815. "hahiragana",
  31816. 0x306f,
  31817. "hahmedialarabic",
  31818. 0xfea4,
  31819. "haitusquare",
  31820. 0x332a,
  31821. "hakatakana",
  31822. 0x30cf,
  31823. "hakatakanahalfwidth",
  31824. 0xff8a,
  31825. "halantgurmukhi",
  31826. 0x0a4d,
  31827. "hamzaarabic",
  31828. 0x0621,
  31829. "hamzalowarabic",
  31830. 0x0621,
  31831. "hangulfiller",
  31832. 0x3164,
  31833. "hardsigncyrillic",
  31834. 0x044a,
  31835. "harpoonleftbarbup",
  31836. 0x21bc,
  31837. "harpoonrightbarbup",
  31838. 0x21c0,
  31839. "hasquare",
  31840. 0x33ca,
  31841. "hatafpatah",
  31842. 0x05b2,
  31843. "hatafpatah16",
  31844. 0x05b2,
  31845. "hatafpatah23",
  31846. 0x05b2,
  31847. "hatafpatah2f",
  31848. 0x05b2,
  31849. "hatafpatahhebrew",
  31850. 0x05b2,
  31851. "hatafpatahnarrowhebrew",
  31852. 0x05b2,
  31853. "hatafpatahquarterhebrew",
  31854. 0x05b2,
  31855. "hatafpatahwidehebrew",
  31856. 0x05b2,
  31857. "hatafqamats",
  31858. 0x05b3,
  31859. "hatafqamats1b",
  31860. 0x05b3,
  31861. "hatafqamats28",
  31862. 0x05b3,
  31863. "hatafqamats34",
  31864. 0x05b3,
  31865. "hatafqamatshebrew",
  31866. 0x05b3,
  31867. "hatafqamatsnarrowhebrew",
  31868. 0x05b3,
  31869. "hatafqamatsquarterhebrew",
  31870. 0x05b3,
  31871. "hatafqamatswidehebrew",
  31872. 0x05b3,
  31873. "hatafsegol",
  31874. 0x05b1,
  31875. "hatafsegol17",
  31876. 0x05b1,
  31877. "hatafsegol24",
  31878. 0x05b1,
  31879. "hatafsegol30",
  31880. 0x05b1,
  31881. "hatafsegolhebrew",
  31882. 0x05b1,
  31883. "hatafsegolnarrowhebrew",
  31884. 0x05b1,
  31885. "hatafsegolquarterhebrew",
  31886. 0x05b1,
  31887. "hatafsegolwidehebrew",
  31888. 0x05b1,
  31889. "hbar",
  31890. 0x0127,
  31891. "hbopomofo",
  31892. 0x310f,
  31893. "hbrevebelow",
  31894. 0x1e2b,
  31895. "hcedilla",
  31896. 0x1e29,
  31897. "hcircle",
  31898. 0x24d7,
  31899. "hcircumflex",
  31900. 0x0125,
  31901. "hdieresis",
  31902. 0x1e27,
  31903. "hdotaccent",
  31904. 0x1e23,
  31905. "hdotbelow",
  31906. 0x1e25,
  31907. "he",
  31908. 0x05d4,
  31909. "heart",
  31910. 0x2665,
  31911. "heartsuitblack",
  31912. 0x2665,
  31913. "heartsuitwhite",
  31914. 0x2661,
  31915. "hedagesh",
  31916. 0xfb34,
  31917. "hedageshhebrew",
  31918. 0xfb34,
  31919. "hehaltonearabic",
  31920. 0x06c1,
  31921. "heharabic",
  31922. 0x0647,
  31923. "hehebrew",
  31924. 0x05d4,
  31925. "hehfinalaltonearabic",
  31926. 0xfba7,
  31927. "hehfinalalttwoarabic",
  31928. 0xfeea,
  31929. "hehfinalarabic",
  31930. 0xfeea,
  31931. "hehhamzaabovefinalarabic",
  31932. 0xfba5,
  31933. "hehhamzaaboveisolatedarabic",
  31934. 0xfba4,
  31935. "hehinitialaltonearabic",
  31936. 0xfba8,
  31937. "hehinitialarabic",
  31938. 0xfeeb,
  31939. "hehiragana",
  31940. 0x3078,
  31941. "hehmedialaltonearabic",
  31942. 0xfba9,
  31943. "hehmedialarabic",
  31944. 0xfeec,
  31945. "heiseierasquare",
  31946. 0x337b,
  31947. "hekatakana",
  31948. 0x30d8,
  31949. "hekatakanahalfwidth",
  31950. 0xff8d,
  31951. "hekutaarusquare",
  31952. 0x3336,
  31953. "henghook",
  31954. 0x0267,
  31955. "herutusquare",
  31956. 0x3339,
  31957. "het",
  31958. 0x05d7,
  31959. "hethebrew",
  31960. 0x05d7,
  31961. "hhook",
  31962. 0x0266,
  31963. "hhooksuperior",
  31964. 0x02b1,
  31965. "hieuhacirclekorean",
  31966. 0x327b,
  31967. "hieuhaparenkorean",
  31968. 0x321b,
  31969. "hieuhcirclekorean",
  31970. 0x326d,
  31971. "hieuhkorean",
  31972. 0x314e,
  31973. "hieuhparenkorean",
  31974. 0x320d,
  31975. "hihiragana",
  31976. 0x3072,
  31977. "hikatakana",
  31978. 0x30d2,
  31979. "hikatakanahalfwidth",
  31980. 0xff8b,
  31981. "hiriq",
  31982. 0x05b4,
  31983. "hiriq14",
  31984. 0x05b4,
  31985. "hiriq21",
  31986. 0x05b4,
  31987. "hiriq2d",
  31988. 0x05b4,
  31989. "hiriqhebrew",
  31990. 0x05b4,
  31991. "hiriqnarrowhebrew",
  31992. 0x05b4,
  31993. "hiriqquarterhebrew",
  31994. 0x05b4,
  31995. "hiriqwidehebrew",
  31996. 0x05b4,
  31997. "hlinebelow",
  31998. 0x1e96,
  31999. "hmonospace",
  32000. 0xff48,
  32001. "hoarmenian",
  32002. 0x0570,
  32003. "hohipthai",
  32004. 0x0e2b,
  32005. "hohiragana",
  32006. 0x307b,
  32007. "hokatakana",
  32008. 0x30db,
  32009. "hokatakanahalfwidth",
  32010. 0xff8e,
  32011. "holam",
  32012. 0x05b9,
  32013. "holam19",
  32014. 0x05b9,
  32015. "holam26",
  32016. 0x05b9,
  32017. "holam32",
  32018. 0x05b9,
  32019. "holamhebrew",
  32020. 0x05b9,
  32021. "holamnarrowhebrew",
  32022. 0x05b9,
  32023. "holamquarterhebrew",
  32024. 0x05b9,
  32025. "holamwidehebrew",
  32026. 0x05b9,
  32027. "honokhukthai",
  32028. 0x0e2e,
  32029. "hookabovecomb",
  32030. 0x0309,
  32031. "hookcmb",
  32032. 0x0309,
  32033. "hookpalatalizedbelowcmb",
  32034. 0x0321,
  32035. "hookretroflexbelowcmb",
  32036. 0x0322,
  32037. "hoonsquare",
  32038. 0x3342,
  32039. "horicoptic",
  32040. 0x03e9,
  32041. "horizontalbar",
  32042. 0x2015,
  32043. "horncmb",
  32044. 0x031b,
  32045. "hotsprings",
  32046. 0x2668,
  32047. "house",
  32048. 0x2302,
  32049. "hparen",
  32050. 0x24a3,
  32051. "hsuperior",
  32052. 0x02b0,
  32053. "hturned",
  32054. 0x0265,
  32055. "huhiragana",
  32056. 0x3075,
  32057. "huiitosquare",
  32058. 0x3333,
  32059. "hukatakana",
  32060. 0x30d5,
  32061. "hukatakanahalfwidth",
  32062. 0xff8c,
  32063. "hungarumlaut",
  32064. 0x02dd,
  32065. "hungarumlautcmb",
  32066. 0x030b,
  32067. "hv",
  32068. 0x0195,
  32069. "hyphen",
  32070. 0x002d,
  32071. "hypheninferior",
  32072. 0xf6e5,
  32073. "hyphenmonospace",
  32074. 0xff0d,
  32075. "hyphensmall",
  32076. 0xfe63,
  32077. "hyphensuperior",
  32078. 0xf6e6,
  32079. "hyphentwo",
  32080. 0x2010,
  32081. "i",
  32082. 0x0069,
  32083. "iacute",
  32084. 0x00ed,
  32085. "iacyrillic",
  32086. 0x044f,
  32087. "ibengali",
  32088. 0x0987,
  32089. "ibopomofo",
  32090. 0x3127,
  32091. "ibreve",
  32092. 0x012d,
  32093. "icaron",
  32094. 0x01d0,
  32095. "icircle",
  32096. 0x24d8,
  32097. "icircumflex",
  32098. 0x00ee,
  32099. "icyrillic",
  32100. 0x0456,
  32101. "idblgrave",
  32102. 0x0209,
  32103. "ideographearthcircle",
  32104. 0x328f,
  32105. "ideographfirecircle",
  32106. 0x328b,
  32107. "ideographicallianceparen",
  32108. 0x323f,
  32109. "ideographiccallparen",
  32110. 0x323a,
  32111. "ideographiccentrecircle",
  32112. 0x32a5,
  32113. "ideographicclose",
  32114. 0x3006,
  32115. "ideographiccomma",
  32116. 0x3001,
  32117. "ideographiccommaleft",
  32118. 0xff64,
  32119. "ideographiccongratulationparen",
  32120. 0x3237,
  32121. "ideographiccorrectcircle",
  32122. 0x32a3,
  32123. "ideographicearthparen",
  32124. 0x322f,
  32125. "ideographicenterpriseparen",
  32126. 0x323d,
  32127. "ideographicexcellentcircle",
  32128. 0x329d,
  32129. "ideographicfestivalparen",
  32130. 0x3240,
  32131. "ideographicfinancialcircle",
  32132. 0x3296,
  32133. "ideographicfinancialparen",
  32134. 0x3236,
  32135. "ideographicfireparen",
  32136. 0x322b,
  32137. "ideographichaveparen",
  32138. 0x3232,
  32139. "ideographichighcircle",
  32140. 0x32a4,
  32141. "ideographiciterationmark",
  32142. 0x3005,
  32143. "ideographiclaborcircle",
  32144. 0x3298,
  32145. "ideographiclaborparen",
  32146. 0x3238,
  32147. "ideographicleftcircle",
  32148. 0x32a7,
  32149. "ideographiclowcircle",
  32150. 0x32a6,
  32151. "ideographicmedicinecircle",
  32152. 0x32a9,
  32153. "ideographicmetalparen",
  32154. 0x322e,
  32155. "ideographicmoonparen",
  32156. 0x322a,
  32157. "ideographicnameparen",
  32158. 0x3234,
  32159. "ideographicperiod",
  32160. 0x3002,
  32161. "ideographicprintcircle",
  32162. 0x329e,
  32163. "ideographicreachparen",
  32164. 0x3243,
  32165. "ideographicrepresentparen",
  32166. 0x3239,
  32167. "ideographicresourceparen",
  32168. 0x323e,
  32169. "ideographicrightcircle",
  32170. 0x32a8,
  32171. "ideographicsecretcircle",
  32172. 0x3299,
  32173. "ideographicselfparen",
  32174. 0x3242,
  32175. "ideographicsocietyparen",
  32176. 0x3233,
  32177. "ideographicspace",
  32178. 0x3000,
  32179. "ideographicspecialparen",
  32180. 0x3235,
  32181. "ideographicstockparen",
  32182. 0x3231,
  32183. "ideographicstudyparen",
  32184. 0x323b,
  32185. "ideographicsunparen",
  32186. 0x3230,
  32187. "ideographicsuperviseparen",
  32188. 0x323c,
  32189. "ideographicwaterparen",
  32190. 0x322c,
  32191. "ideographicwoodparen",
  32192. 0x322d,
  32193. "ideographiczero",
  32194. 0x3007,
  32195. "ideographmetalcircle",
  32196. 0x328e,
  32197. "ideographmooncircle",
  32198. 0x328a,
  32199. "ideographnamecircle",
  32200. 0x3294,
  32201. "ideographsuncircle",
  32202. 0x3290,
  32203. "ideographwatercircle",
  32204. 0x328c,
  32205. "ideographwoodcircle",
  32206. 0x328d,
  32207. "ideva",
  32208. 0x0907,
  32209. "idieresis",
  32210. 0x00ef,
  32211. "idieresisacute",
  32212. 0x1e2f,
  32213. "idieresiscyrillic",
  32214. 0x04e5,
  32215. "idotbelow",
  32216. 0x1ecb,
  32217. "iebrevecyrillic",
  32218. 0x04d7,
  32219. "iecyrillic",
  32220. 0x0435,
  32221. "ieungacirclekorean",
  32222. 0x3275,
  32223. "ieungaparenkorean",
  32224. 0x3215,
  32225. "ieungcirclekorean",
  32226. 0x3267,
  32227. "ieungkorean",
  32228. 0x3147,
  32229. "ieungparenkorean",
  32230. 0x3207,
  32231. "igrave",
  32232. 0x00ec,
  32233. "igujarati",
  32234. 0x0a87,
  32235. "igurmukhi",
  32236. 0x0a07,
  32237. "ihiragana",
  32238. 0x3044,
  32239. "ihookabove",
  32240. 0x1ec9,
  32241. "iibengali",
  32242. 0x0988,
  32243. "iicyrillic",
  32244. 0x0438,
  32245. "iideva",
  32246. 0x0908,
  32247. "iigujarati",
  32248. 0x0a88,
  32249. "iigurmukhi",
  32250. 0x0a08,
  32251. "iimatragurmukhi",
  32252. 0x0a40,
  32253. "iinvertedbreve",
  32254. 0x020b,
  32255. "iishortcyrillic",
  32256. 0x0439,
  32257. "iivowelsignbengali",
  32258. 0x09c0,
  32259. "iivowelsigndeva",
  32260. 0x0940,
  32261. "iivowelsigngujarati",
  32262. 0x0ac0,
  32263. "ij",
  32264. 0x0133,
  32265. "ikatakana",
  32266. 0x30a4,
  32267. "ikatakanahalfwidth",
  32268. 0xff72,
  32269. "ikorean",
  32270. 0x3163,
  32271. "ilde",
  32272. 0x02dc,
  32273. "iluyhebrew",
  32274. 0x05ac,
  32275. "imacron",
  32276. 0x012b,
  32277. "imacroncyrillic",
  32278. 0x04e3,
  32279. "imageorapproximatelyequal",
  32280. 0x2253,
  32281. "imatragurmukhi",
  32282. 0x0a3f,
  32283. "imonospace",
  32284. 0xff49,
  32285. "increment",
  32286. 0x2206,
  32287. "infinity",
  32288. 0x221e,
  32289. "iniarmenian",
  32290. 0x056b,
  32291. "integral",
  32292. 0x222b,
  32293. "integralbottom",
  32294. 0x2321,
  32295. "integralbt",
  32296. 0x2321,
  32297. "integralex",
  32298. 0xf8f5,
  32299. "integraltop",
  32300. 0x2320,
  32301. "integraltp",
  32302. 0x2320,
  32303. "intersection",
  32304. 0x2229,
  32305. "intisquare",
  32306. 0x3305,
  32307. "invbullet",
  32308. 0x25d8,
  32309. "invcircle",
  32310. 0x25d9,
  32311. "invsmileface",
  32312. 0x263b,
  32313. "iocyrillic",
  32314. 0x0451,
  32315. "iogonek",
  32316. 0x012f,
  32317. "iota",
  32318. 0x03b9,
  32319. "iotadieresis",
  32320. 0x03ca,
  32321. "iotadieresistonos",
  32322. 0x0390,
  32323. "iotalatin",
  32324. 0x0269,
  32325. "iotatonos",
  32326. 0x03af,
  32327. "iparen",
  32328. 0x24a4,
  32329. "irigurmukhi",
  32330. 0x0a72,
  32331. "ismallhiragana",
  32332. 0x3043,
  32333. "ismallkatakana",
  32334. 0x30a3,
  32335. "ismallkatakanahalfwidth",
  32336. 0xff68,
  32337. "issharbengali",
  32338. 0x09fa,
  32339. "istroke",
  32340. 0x0268,
  32341. "isuperior",
  32342. 0xf6ed,
  32343. "iterationhiragana",
  32344. 0x309d,
  32345. "iterationkatakana",
  32346. 0x30fd,
  32347. "itilde",
  32348. 0x0129,
  32349. "itildebelow",
  32350. 0x1e2d,
  32351. "iubopomofo",
  32352. 0x3129,
  32353. "iucyrillic",
  32354. 0x044e,
  32355. "ivowelsignbengali",
  32356. 0x09bf,
  32357. "ivowelsigndeva",
  32358. 0x093f,
  32359. "ivowelsigngujarati",
  32360. 0x0abf,
  32361. "izhitsacyrillic",
  32362. 0x0475,
  32363. "izhitsadblgravecyrillic",
  32364. 0x0477,
  32365. "j",
  32366. 0x006a,
  32367. "jaarmenian",
  32368. 0x0571,
  32369. "jabengali",
  32370. 0x099c,
  32371. "jadeva",
  32372. 0x091c,
  32373. "jagujarati",
  32374. 0x0a9c,
  32375. "jagurmukhi",
  32376. 0x0a1c,
  32377. "jbopomofo",
  32378. 0x3110,
  32379. "jcaron",
  32380. 0x01f0,
  32381. "jcircle",
  32382. 0x24d9,
  32383. "jcircumflex",
  32384. 0x0135,
  32385. "jcrossedtail",
  32386. 0x029d,
  32387. "jdotlessstroke",
  32388. 0x025f,
  32389. "jecyrillic",
  32390. 0x0458,
  32391. "jeemarabic",
  32392. 0x062c,
  32393. "jeemfinalarabic",
  32394. 0xfe9e,
  32395. "jeeminitialarabic",
  32396. 0xfe9f,
  32397. "jeemmedialarabic",
  32398. 0xfea0,
  32399. "jeharabic",
  32400. 0x0698,
  32401. "jehfinalarabic",
  32402. 0xfb8b,
  32403. "jhabengali",
  32404. 0x099d,
  32405. "jhadeva",
  32406. 0x091d,
  32407. "jhagujarati",
  32408. 0x0a9d,
  32409. "jhagurmukhi",
  32410. 0x0a1d,
  32411. "jheharmenian",
  32412. 0x057b,
  32413. "jis",
  32414. 0x3004,
  32415. "jmonospace",
  32416. 0xff4a,
  32417. "jparen",
  32418. 0x24a5,
  32419. "jsuperior",
  32420. 0x02b2,
  32421. "k",
  32422. 0x006b,
  32423. "kabashkircyrillic",
  32424. 0x04a1,
  32425. "kabengali",
  32426. 0x0995,
  32427. "kacute",
  32428. 0x1e31,
  32429. "kacyrillic",
  32430. 0x043a,
  32431. "kadescendercyrillic",
  32432. 0x049b,
  32433. "kadeva",
  32434. 0x0915,
  32435. "kaf",
  32436. 0x05db,
  32437. "kafarabic",
  32438. 0x0643,
  32439. "kafdagesh",
  32440. 0xfb3b,
  32441. "kafdageshhebrew",
  32442. 0xfb3b,
  32443. "kaffinalarabic",
  32444. 0xfeda,
  32445. "kafhebrew",
  32446. 0x05db,
  32447. "kafinitialarabic",
  32448. 0xfedb,
  32449. "kafmedialarabic",
  32450. 0xfedc,
  32451. "kafrafehebrew",
  32452. 0xfb4d,
  32453. "kagujarati",
  32454. 0x0a95,
  32455. "kagurmukhi",
  32456. 0x0a15,
  32457. "kahiragana",
  32458. 0x304b,
  32459. "kahookcyrillic",
  32460. 0x04c4,
  32461. "kakatakana",
  32462. 0x30ab,
  32463. "kakatakanahalfwidth",
  32464. 0xff76,
  32465. "kappa",
  32466. 0x03ba,
  32467. "kappasymbolgreek",
  32468. 0x03f0,
  32469. "kapyeounmieumkorean",
  32470. 0x3171,
  32471. "kapyeounphieuphkorean",
  32472. 0x3184,
  32473. "kapyeounpieupkorean",
  32474. 0x3178,
  32475. "kapyeounssangpieupkorean",
  32476. 0x3179,
  32477. "karoriisquare",
  32478. 0x330d,
  32479. "kashidaautoarabic",
  32480. 0x0640,
  32481. "kashidaautonosidebearingarabic",
  32482. 0x0640,
  32483. "kasmallkatakana",
  32484. 0x30f5,
  32485. "kasquare",
  32486. 0x3384,
  32487. "kasraarabic",
  32488. 0x0650,
  32489. "kasratanarabic",
  32490. 0x064d,
  32491. "kastrokecyrillic",
  32492. 0x049f,
  32493. "katahiraprolongmarkhalfwidth",
  32494. 0xff70,
  32495. "kaverticalstrokecyrillic",
  32496. 0x049d,
  32497. "kbopomofo",
  32498. 0x310e,
  32499. "kcalsquare",
  32500. 0x3389,
  32501. "kcaron",
  32502. 0x01e9,
  32503. "kcedilla",
  32504. 0x0137,
  32505. "kcircle",
  32506. 0x24da,
  32507. "kcommaaccent",
  32508. 0x0137,
  32509. "kdotbelow",
  32510. 0x1e33,
  32511. "keharmenian",
  32512. 0x0584,
  32513. "kehiragana",
  32514. 0x3051,
  32515. "kekatakana",
  32516. 0x30b1,
  32517. "kekatakanahalfwidth",
  32518. 0xff79,
  32519. "kenarmenian",
  32520. 0x056f,
  32521. "kesmallkatakana",
  32522. 0x30f6,
  32523. "kgreenlandic",
  32524. 0x0138,
  32525. "khabengali",
  32526. 0x0996,
  32527. "khacyrillic",
  32528. 0x0445,
  32529. "khadeva",
  32530. 0x0916,
  32531. "khagujarati",
  32532. 0x0a96,
  32533. "khagurmukhi",
  32534. 0x0a16,
  32535. "khaharabic",
  32536. 0x062e,
  32537. "khahfinalarabic",
  32538. 0xfea6,
  32539. "khahinitialarabic",
  32540. 0xfea7,
  32541. "khahmedialarabic",
  32542. 0xfea8,
  32543. "kheicoptic",
  32544. 0x03e7,
  32545. "khhadeva",
  32546. 0x0959,
  32547. "khhagurmukhi",
  32548. 0x0a59,
  32549. "khieukhacirclekorean",
  32550. 0x3278,
  32551. "khieukhaparenkorean",
  32552. 0x3218,
  32553. "khieukhcirclekorean",
  32554. 0x326a,
  32555. "khieukhkorean",
  32556. 0x314b,
  32557. "khieukhparenkorean",
  32558. 0x320a,
  32559. "khokhaithai",
  32560. 0x0e02,
  32561. "khokhonthai",
  32562. 0x0e05,
  32563. "khokhuatthai",
  32564. 0x0e03,
  32565. "khokhwaithai",
  32566. 0x0e04,
  32567. "khomutthai",
  32568. 0x0e5b,
  32569. "khook",
  32570. 0x0199,
  32571. "khorakhangthai",
  32572. 0x0e06,
  32573. "khzsquare",
  32574. 0x3391,
  32575. "kihiragana",
  32576. 0x304d,
  32577. "kikatakana",
  32578. 0x30ad,
  32579. "kikatakanahalfwidth",
  32580. 0xff77,
  32581. "kiroguramusquare",
  32582. 0x3315,
  32583. "kiromeetorusquare",
  32584. 0x3316,
  32585. "kirosquare",
  32586. 0x3314,
  32587. "kiyeokacirclekorean",
  32588. 0x326e,
  32589. "kiyeokaparenkorean",
  32590. 0x320e,
  32591. "kiyeokcirclekorean",
  32592. 0x3260,
  32593. "kiyeokkorean",
  32594. 0x3131,
  32595. "kiyeokparenkorean",
  32596. 0x3200,
  32597. "kiyeoksioskorean",
  32598. 0x3133,
  32599. "kjecyrillic",
  32600. 0x045c,
  32601. "klinebelow",
  32602. 0x1e35,
  32603. "klsquare",
  32604. 0x3398,
  32605. "kmcubedsquare",
  32606. 0x33a6,
  32607. "kmonospace",
  32608. 0xff4b,
  32609. "kmsquaredsquare",
  32610. 0x33a2,
  32611. "kohiragana",
  32612. 0x3053,
  32613. "kohmsquare",
  32614. 0x33c0,
  32615. "kokaithai",
  32616. 0x0e01,
  32617. "kokatakana",
  32618. 0x30b3,
  32619. "kokatakanahalfwidth",
  32620. 0xff7a,
  32621. "kooposquare",
  32622. 0x331e,
  32623. "koppacyrillic",
  32624. 0x0481,
  32625. "koreanstandardsymbol",
  32626. 0x327f,
  32627. "koroniscmb",
  32628. 0x0343,
  32629. "kparen",
  32630. 0x24a6,
  32631. "kpasquare",
  32632. 0x33aa,
  32633. "ksicyrillic",
  32634. 0x046f,
  32635. "ktsquare",
  32636. 0x33cf,
  32637. "kturned",
  32638. 0x029e,
  32639. "kuhiragana",
  32640. 0x304f,
  32641. "kukatakana",
  32642. 0x30af,
  32643. "kukatakanahalfwidth",
  32644. 0xff78,
  32645. "kvsquare",
  32646. 0x33b8,
  32647. "kwsquare",
  32648. 0x33be,
  32649. "l",
  32650. 0x006c,
  32651. "labengali",
  32652. 0x09b2,
  32653. "lacute",
  32654. 0x013a,
  32655. "ladeva",
  32656. 0x0932,
  32657. "lagujarati",
  32658. 0x0ab2,
  32659. "lagurmukhi",
  32660. 0x0a32,
  32661. "lakkhangyaothai",
  32662. 0x0e45,
  32663. "lamaleffinalarabic",
  32664. 0xfefc,
  32665. "lamalefhamzaabovefinalarabic",
  32666. 0xfef8,
  32667. "lamalefhamzaaboveisolatedarabic",
  32668. 0xfef7,
  32669. "lamalefhamzabelowfinalarabic",
  32670. 0xfefa,
  32671. "lamalefhamzabelowisolatedarabic",
  32672. 0xfef9,
  32673. "lamalefisolatedarabic",
  32674. 0xfefb,
  32675. "lamalefmaddaabovefinalarabic",
  32676. 0xfef6,
  32677. "lamalefmaddaaboveisolatedarabic",
  32678. 0xfef5,
  32679. "lamarabic",
  32680. 0x0644,
  32681. "lambda",
  32682. 0x03bb,
  32683. "lambdastroke",
  32684. 0x019b,
  32685. "lamed",
  32686. 0x05dc,
  32687. "lameddagesh",
  32688. 0xfb3c,
  32689. "lameddageshhebrew",
  32690. 0xfb3c,
  32691. "lamedhebrew",
  32692. 0x05dc,
  32693. "lamfinalarabic",
  32694. 0xfede,
  32695. "lamhahinitialarabic",
  32696. 0xfcca,
  32697. "laminitialarabic",
  32698. 0xfedf,
  32699. "lamjeeminitialarabic",
  32700. 0xfcc9,
  32701. "lamkhahinitialarabic",
  32702. 0xfccb,
  32703. "lamlamhehisolatedarabic",
  32704. 0xfdf2,
  32705. "lammedialarabic",
  32706. 0xfee0,
  32707. "lammeemhahinitialarabic",
  32708. 0xfd88,
  32709. "lammeeminitialarabic",
  32710. 0xfccc,
  32711. "largecircle",
  32712. 0x25ef,
  32713. "lbar",
  32714. 0x019a,
  32715. "lbelt",
  32716. 0x026c,
  32717. "lbopomofo",
  32718. 0x310c,
  32719. "lcaron",
  32720. 0x013e,
  32721. "lcedilla",
  32722. 0x013c,
  32723. "lcircle",
  32724. 0x24db,
  32725. "lcircumflexbelow",
  32726. 0x1e3d,
  32727. "lcommaaccent",
  32728. 0x013c,
  32729. "ldot",
  32730. 0x0140,
  32731. "ldotaccent",
  32732. 0x0140,
  32733. "ldotbelow",
  32734. 0x1e37,
  32735. "ldotbelowmacron",
  32736. 0x1e39,
  32737. "leftangleabovecmb",
  32738. 0x031a,
  32739. "lefttackbelowcmb",
  32740. 0x0318,
  32741. "less",
  32742. 0x003c,
  32743. "lessequal",
  32744. 0x2264,
  32745. "lessequalorgreater",
  32746. 0x22da,
  32747. "lessmonospace",
  32748. 0xff1c,
  32749. "lessorequivalent",
  32750. 0x2272,
  32751. "lessorgreater",
  32752. 0x2276,
  32753. "lessoverequal",
  32754. 0x2266,
  32755. "lesssmall",
  32756. 0xfe64,
  32757. "lezh",
  32758. 0x026e,
  32759. "lfblock",
  32760. 0x258c,
  32761. "lhookretroflex",
  32762. 0x026d,
  32763. "lira",
  32764. 0x20a4,
  32765. "liwnarmenian",
  32766. 0x056c,
  32767. "lj",
  32768. 0x01c9,
  32769. "ljecyrillic",
  32770. 0x0459,
  32771. "ll",
  32772. 0xf6c0,
  32773. "lladeva",
  32774. 0x0933,
  32775. "llagujarati",
  32776. 0x0ab3,
  32777. "llinebelow",
  32778. 0x1e3b,
  32779. "llladeva",
  32780. 0x0934,
  32781. "llvocalicbengali",
  32782. 0x09e1,
  32783. "llvocalicdeva",
  32784. 0x0961,
  32785. "llvocalicvowelsignbengali",
  32786. 0x09e3,
  32787. "llvocalicvowelsigndeva",
  32788. 0x0963,
  32789. "lmiddletilde",
  32790. 0x026b,
  32791. "lmonospace",
  32792. 0xff4c,
  32793. "lmsquare",
  32794. 0x33d0,
  32795. "lochulathai",
  32796. 0x0e2c,
  32797. "logicaland",
  32798. 0x2227,
  32799. "logicalnot",
  32800. 0x00ac,
  32801. "logicalnotreversed",
  32802. 0x2310,
  32803. "logicalor",
  32804. 0x2228,
  32805. "lolingthai",
  32806. 0x0e25,
  32807. "longs",
  32808. 0x017f,
  32809. "lowlinecenterline",
  32810. 0xfe4e,
  32811. "lowlinecmb",
  32812. 0x0332,
  32813. "lowlinedashed",
  32814. 0xfe4d,
  32815. "lozenge",
  32816. 0x25ca,
  32817. "lparen",
  32818. 0x24a7,
  32819. "lslash",
  32820. 0x0142,
  32821. "lsquare",
  32822. 0x2113,
  32823. "lsuperior",
  32824. 0xf6ee,
  32825. "ltshade",
  32826. 0x2591,
  32827. "luthai",
  32828. 0x0e26,
  32829. "lvocalicbengali",
  32830. 0x098c,
  32831. "lvocalicdeva",
  32832. 0x090c,
  32833. "lvocalicvowelsignbengali",
  32834. 0x09e2,
  32835. "lvocalicvowelsigndeva",
  32836. 0x0962,
  32837. "lxsquare",
  32838. 0x33d3,
  32839. "m",
  32840. 0x006d,
  32841. "mabengali",
  32842. 0x09ae,
  32843. "macron",
  32844. 0x00af,
  32845. "macronbelowcmb",
  32846. 0x0331,
  32847. "macroncmb",
  32848. 0x0304,
  32849. "macronlowmod",
  32850. 0x02cd,
  32851. "macronmonospace",
  32852. 0xffe3,
  32853. "macute",
  32854. 0x1e3f,
  32855. "madeva",
  32856. 0x092e,
  32857. "magujarati",
  32858. 0x0aae,
  32859. "magurmukhi",
  32860. 0x0a2e,
  32861. "mahapakhhebrew",
  32862. 0x05a4,
  32863. "mahapakhlefthebrew",
  32864. 0x05a4,
  32865. "mahiragana",
  32866. 0x307e,
  32867. "maichattawalowleftthai",
  32868. 0xf895,
  32869. "maichattawalowrightthai",
  32870. 0xf894,
  32871. "maichattawathai",
  32872. 0x0e4b,
  32873. "maichattawaupperleftthai",
  32874. 0xf893,
  32875. "maieklowleftthai",
  32876. 0xf88c,
  32877. "maieklowrightthai",
  32878. 0xf88b,
  32879. "maiekthai",
  32880. 0x0e48,
  32881. "maiekupperleftthai",
  32882. 0xf88a,
  32883. "maihanakatleftthai",
  32884. 0xf884,
  32885. "maihanakatthai",
  32886. 0x0e31,
  32887. "maitaikhuleftthai",
  32888. 0xf889,
  32889. "maitaikhuthai",
  32890. 0x0e47,
  32891. "maitholowleftthai",
  32892. 0xf88f,
  32893. "maitholowrightthai",
  32894. 0xf88e,
  32895. "maithothai",
  32896. 0x0e49,
  32897. "maithoupperleftthai",
  32898. 0xf88d,
  32899. "maitrilowleftthai",
  32900. 0xf892,
  32901. "maitrilowrightthai",
  32902. 0xf891,
  32903. "maitrithai",
  32904. 0x0e4a,
  32905. "maitriupperleftthai",
  32906. 0xf890,
  32907. "maiyamokthai",
  32908. 0x0e46,
  32909. "makatakana",
  32910. 0x30de,
  32911. "makatakanahalfwidth",
  32912. 0xff8f,
  32913. "male",
  32914. 0x2642,
  32915. "mansyonsquare",
  32916. 0x3347,
  32917. "maqafhebrew",
  32918. 0x05be,
  32919. "mars",
  32920. 0x2642,
  32921. "masoracirclehebrew",
  32922. 0x05af,
  32923. "masquare",
  32924. 0x3383,
  32925. "mbopomofo",
  32926. 0x3107,
  32927. "mbsquare",
  32928. 0x33d4,
  32929. "mcircle",
  32930. 0x24dc,
  32931. "mcubedsquare",
  32932. 0x33a5,
  32933. "mdotaccent",
  32934. 0x1e41,
  32935. "mdotbelow",
  32936. 0x1e43,
  32937. "meemarabic",
  32938. 0x0645,
  32939. "meemfinalarabic",
  32940. 0xfee2,
  32941. "meeminitialarabic",
  32942. 0xfee3,
  32943. "meemmedialarabic",
  32944. 0xfee4,
  32945. "meemmeeminitialarabic",
  32946. 0xfcd1,
  32947. "meemmeemisolatedarabic",
  32948. 0xfc48,
  32949. "meetorusquare",
  32950. 0x334d,
  32951. "mehiragana",
  32952. 0x3081,
  32953. "meizierasquare",
  32954. 0x337e,
  32955. "mekatakana",
  32956. 0x30e1,
  32957. "mekatakanahalfwidth",
  32958. 0xff92,
  32959. "mem",
  32960. 0x05de,
  32961. "memdagesh",
  32962. 0xfb3e,
  32963. "memdageshhebrew",
  32964. 0xfb3e,
  32965. "memhebrew",
  32966. 0x05de,
  32967. "menarmenian",
  32968. 0x0574,
  32969. "merkhahebrew",
  32970. 0x05a5,
  32971. "merkhakefulahebrew",
  32972. 0x05a6,
  32973. "merkhakefulalefthebrew",
  32974. 0x05a6,
  32975. "merkhalefthebrew",
  32976. 0x05a5,
  32977. "mhook",
  32978. 0x0271,
  32979. "mhzsquare",
  32980. 0x3392,
  32981. "middledotkatakanahalfwidth",
  32982. 0xff65,
  32983. "middot",
  32984. 0x00b7,
  32985. "mieumacirclekorean",
  32986. 0x3272,
  32987. "mieumaparenkorean",
  32988. 0x3212,
  32989. "mieumcirclekorean",
  32990. 0x3264,
  32991. "mieumkorean",
  32992. 0x3141,
  32993. "mieumpansioskorean",
  32994. 0x3170,
  32995. "mieumparenkorean",
  32996. 0x3204,
  32997. "mieumpieupkorean",
  32998. 0x316e,
  32999. "mieumsioskorean",
  33000. 0x316f,
  33001. "mihiragana",
  33002. 0x307f,
  33003. "mikatakana",
  33004. 0x30df,
  33005. "mikatakanahalfwidth",
  33006. 0xff90,
  33007. "minus",
  33008. 0x2212,
  33009. "minusbelowcmb",
  33010. 0x0320,
  33011. "minuscircle",
  33012. 0x2296,
  33013. "minusmod",
  33014. 0x02d7,
  33015. "minusplus",
  33016. 0x2213,
  33017. "minute",
  33018. 0x2032,
  33019. "miribaarusquare",
  33020. 0x334a,
  33021. "mirisquare",
  33022. 0x3349,
  33023. "mlonglegturned",
  33024. 0x0270,
  33025. "mlsquare",
  33026. 0x3396,
  33027. "mmcubedsquare",
  33028. 0x33a3,
  33029. "mmonospace",
  33030. 0xff4d,
  33031. "mmsquaredsquare",
  33032. 0x339f,
  33033. "mohiragana",
  33034. 0x3082,
  33035. "mohmsquare",
  33036. 0x33c1,
  33037. "mokatakana",
  33038. 0x30e2,
  33039. "mokatakanahalfwidth",
  33040. 0xff93,
  33041. "molsquare",
  33042. 0x33d6,
  33043. "momathai",
  33044. 0x0e21,
  33045. "moverssquare",
  33046. 0x33a7,
  33047. "moverssquaredsquare",
  33048. 0x33a8,
  33049. "mparen",
  33050. 0x24a8,
  33051. "mpasquare",
  33052. 0x33ab,
  33053. "mssquare",
  33054. 0x33b3,
  33055. "msuperior",
  33056. 0xf6ef,
  33057. "mturned",
  33058. 0x026f,
  33059. "mu",
  33060. 0x00b5,
  33061. "mu1",
  33062. 0x00b5,
  33063. "muasquare",
  33064. 0x3382,
  33065. "muchgreater",
  33066. 0x226b,
  33067. "muchless",
  33068. 0x226a,
  33069. "mufsquare",
  33070. 0x338c,
  33071. "mugreek",
  33072. 0x03bc,
  33073. "mugsquare",
  33074. 0x338d,
  33075. "muhiragana",
  33076. 0x3080,
  33077. "mukatakana",
  33078. 0x30e0,
  33079. "mukatakanahalfwidth",
  33080. 0xff91,
  33081. "mulsquare",
  33082. 0x3395,
  33083. "multiply",
  33084. 0x00d7,
  33085. "mumsquare",
  33086. 0x339b,
  33087. "munahhebrew",
  33088. 0x05a3,
  33089. "munahlefthebrew",
  33090. 0x05a3,
  33091. "musicalnote",
  33092. 0x266a,
  33093. "musicalnotedbl",
  33094. 0x266b,
  33095. "musicflatsign",
  33096. 0x266d,
  33097. "musicsharpsign",
  33098. 0x266f,
  33099. "mussquare",
  33100. 0x33b2,
  33101. "muvsquare",
  33102. 0x33b6,
  33103. "muwsquare",
  33104. 0x33bc,
  33105. "mvmegasquare",
  33106. 0x33b9,
  33107. "mvsquare",
  33108. 0x33b7,
  33109. "mwmegasquare",
  33110. 0x33bf,
  33111. "mwsquare",
  33112. 0x33bd,
  33113. "n",
  33114. 0x006e,
  33115. "nabengali",
  33116. 0x09a8,
  33117. "nabla",
  33118. 0x2207,
  33119. "nacute",
  33120. 0x0144,
  33121. "nadeva",
  33122. 0x0928,
  33123. "nagujarati",
  33124. 0x0aa8,
  33125. "nagurmukhi",
  33126. 0x0a28,
  33127. "nahiragana",
  33128. 0x306a,
  33129. "nakatakana",
  33130. 0x30ca,
  33131. "nakatakanahalfwidth",
  33132. 0xff85,
  33133. "napostrophe",
  33134. 0x0149,
  33135. "nasquare",
  33136. 0x3381,
  33137. "nbopomofo",
  33138. 0x310b,
  33139. "nbspace",
  33140. 0x00a0,
  33141. "ncaron",
  33142. 0x0148,
  33143. "ncedilla",
  33144. 0x0146,
  33145. "ncircle",
  33146. 0x24dd,
  33147. "ncircumflexbelow",
  33148. 0x1e4b,
  33149. "ncommaaccent",
  33150. 0x0146,
  33151. "ndotaccent",
  33152. 0x1e45,
  33153. "ndotbelow",
  33154. 0x1e47,
  33155. "nehiragana",
  33156. 0x306d,
  33157. "nekatakana",
  33158. 0x30cd,
  33159. "nekatakanahalfwidth",
  33160. 0xff88,
  33161. "newsheqelsign",
  33162. 0x20aa,
  33163. "nfsquare",
  33164. 0x338b,
  33165. "ngabengali",
  33166. 0x0999,
  33167. "ngadeva",
  33168. 0x0919,
  33169. "ngagujarati",
  33170. 0x0a99,
  33171. "ngagurmukhi",
  33172. 0x0a19,
  33173. "ngonguthai",
  33174. 0x0e07,
  33175. "nhiragana",
  33176. 0x3093,
  33177. "nhookleft",
  33178. 0x0272,
  33179. "nhookretroflex",
  33180. 0x0273,
  33181. "nieunacirclekorean",
  33182. 0x326f,
  33183. "nieunaparenkorean",
  33184. 0x320f,
  33185. "nieuncieuckorean",
  33186. 0x3135,
  33187. "nieuncirclekorean",
  33188. 0x3261,
  33189. "nieunhieuhkorean",
  33190. 0x3136,
  33191. "nieunkorean",
  33192. 0x3134,
  33193. "nieunpansioskorean",
  33194. 0x3168,
  33195. "nieunparenkorean",
  33196. 0x3201,
  33197. "nieunsioskorean",
  33198. 0x3167,
  33199. "nieuntikeutkorean",
  33200. 0x3166,
  33201. "nihiragana",
  33202. 0x306b,
  33203. "nikatakana",
  33204. 0x30cb,
  33205. "nikatakanahalfwidth",
  33206. 0xff86,
  33207. "nikhahitleftthai",
  33208. 0xf899,
  33209. "nikhahitthai",
  33210. 0x0e4d,
  33211. "nine",
  33212. 0x0039,
  33213. "ninearabic",
  33214. 0x0669,
  33215. "ninebengali",
  33216. 0x09ef,
  33217. "ninecircle",
  33218. 0x2468,
  33219. "ninecircleinversesansserif",
  33220. 0x2792,
  33221. "ninedeva",
  33222. 0x096f,
  33223. "ninegujarati",
  33224. 0x0aef,
  33225. "ninegurmukhi",
  33226. 0x0a6f,
  33227. "ninehackarabic",
  33228. 0x0669,
  33229. "ninehangzhou",
  33230. 0x3029,
  33231. "nineideographicparen",
  33232. 0x3228,
  33233. "nineinferior",
  33234. 0x2089,
  33235. "ninemonospace",
  33236. 0xff19,
  33237. "nineoldstyle",
  33238. 0xf739,
  33239. "nineparen",
  33240. 0x247c,
  33241. "nineperiod",
  33242. 0x2490,
  33243. "ninepersian",
  33244. 0x06f9,
  33245. "nineroman",
  33246. 0x2178,
  33247. "ninesuperior",
  33248. 0x2079,
  33249. "nineteencircle",
  33250. 0x2472,
  33251. "nineteenparen",
  33252. 0x2486,
  33253. "nineteenperiod",
  33254. 0x249a,
  33255. "ninethai",
  33256. 0x0e59,
  33257. "nj",
  33258. 0x01cc,
  33259. "njecyrillic",
  33260. 0x045a,
  33261. "nkatakana",
  33262. 0x30f3,
  33263. "nkatakanahalfwidth",
  33264. 0xff9d,
  33265. "nlegrightlong",
  33266. 0x019e,
  33267. "nlinebelow",
  33268. 0x1e49,
  33269. "nmonospace",
  33270. 0xff4e,
  33271. "nmsquare",
  33272. 0x339a,
  33273. "nnabengali",
  33274. 0x09a3,
  33275. "nnadeva",
  33276. 0x0923,
  33277. "nnagujarati",
  33278. 0x0aa3,
  33279. "nnagurmukhi",
  33280. 0x0a23,
  33281. "nnnadeva",
  33282. 0x0929,
  33283. "nohiragana",
  33284. 0x306e,
  33285. "nokatakana",
  33286. 0x30ce,
  33287. "nokatakanahalfwidth",
  33288. 0xff89,
  33289. "nonbreakingspace",
  33290. 0x00a0,
  33291. "nonenthai",
  33292. 0x0e13,
  33293. "nonuthai",
  33294. 0x0e19,
  33295. "noonarabic",
  33296. 0x0646,
  33297. "noonfinalarabic",
  33298. 0xfee6,
  33299. "noonghunnaarabic",
  33300. 0x06ba,
  33301. "noonghunnafinalarabic",
  33302. 0xfb9f,
  33303. "nooninitialarabic",
  33304. 0xfee7,
  33305. "noonjeeminitialarabic",
  33306. 0xfcd2,
  33307. "noonjeemisolatedarabic",
  33308. 0xfc4b,
  33309. "noonmedialarabic",
  33310. 0xfee8,
  33311. "noonmeeminitialarabic",
  33312. 0xfcd5,
  33313. "noonmeemisolatedarabic",
  33314. 0xfc4e,
  33315. "noonnoonfinalarabic",
  33316. 0xfc8d,
  33317. "notcontains",
  33318. 0x220c,
  33319. "notelement",
  33320. 0x2209,
  33321. "notelementof",
  33322. 0x2209,
  33323. "notequal",
  33324. 0x2260,
  33325. "notgreater",
  33326. 0x226f,
  33327. "notgreaternorequal",
  33328. 0x2271,
  33329. "notgreaternorless",
  33330. 0x2279,
  33331. "notidentical",
  33332. 0x2262,
  33333. "notless",
  33334. 0x226e,
  33335. "notlessnorequal",
  33336. 0x2270,
  33337. "notparallel",
  33338. 0x2226,
  33339. "notprecedes",
  33340. 0x2280,
  33341. "notsubset",
  33342. 0x2284,
  33343. "notsucceeds",
  33344. 0x2281,
  33345. "notsuperset",
  33346. 0x2285,
  33347. "nowarmenian",
  33348. 0x0576,
  33349. "nparen",
  33350. 0x24a9,
  33351. "nssquare",
  33352. 0x33b1,
  33353. "nsuperior",
  33354. 0x207f,
  33355. "ntilde",
  33356. 0x00f1,
  33357. "nu",
  33358. 0x03bd,
  33359. "nuhiragana",
  33360. 0x306c,
  33361. "nukatakana",
  33362. 0x30cc,
  33363. "nukatakanahalfwidth",
  33364. 0xff87,
  33365. "nuktabengali",
  33366. 0x09bc,
  33367. "nuktadeva",
  33368. 0x093c,
  33369. "nuktagujarati",
  33370. 0x0abc,
  33371. "nuktagurmukhi",
  33372. 0x0a3c,
  33373. "numbersign",
  33374. 0x0023,
  33375. "numbersignmonospace",
  33376. 0xff03,
  33377. "numbersignsmall",
  33378. 0xfe5f,
  33379. "numeralsigngreek",
  33380. 0x0374,
  33381. "numeralsignlowergreek",
  33382. 0x0375,
  33383. "numero",
  33384. 0x2116,
  33385. "nun",
  33386. 0x05e0,
  33387. "nundagesh",
  33388. 0xfb40,
  33389. "nundageshhebrew",
  33390. 0xfb40,
  33391. "nunhebrew",
  33392. 0x05e0,
  33393. "nvsquare",
  33394. 0x33b5,
  33395. "nwsquare",
  33396. 0x33bb,
  33397. "nyabengali",
  33398. 0x099e,
  33399. "nyadeva",
  33400. 0x091e,
  33401. "nyagujarati",
  33402. 0x0a9e,
  33403. "nyagurmukhi",
  33404. 0x0a1e,
  33405. "o",
  33406. 0x006f,
  33407. "oacute",
  33408. 0x00f3,
  33409. "oangthai",
  33410. 0x0e2d,
  33411. "obarred",
  33412. 0x0275,
  33413. "obarredcyrillic",
  33414. 0x04e9,
  33415. "obarreddieresiscyrillic",
  33416. 0x04eb,
  33417. "obengali",
  33418. 0x0993,
  33419. "obopomofo",
  33420. 0x311b,
  33421. "obreve",
  33422. 0x014f,
  33423. "ocandradeva",
  33424. 0x0911,
  33425. "ocandragujarati",
  33426. 0x0a91,
  33427. "ocandravowelsigndeva",
  33428. 0x0949,
  33429. "ocandravowelsigngujarati",
  33430. 0x0ac9,
  33431. "ocaron",
  33432. 0x01d2,
  33433. "ocircle",
  33434. 0x24de,
  33435. "ocircumflex",
  33436. 0x00f4,
  33437. "ocircumflexacute",
  33438. 0x1ed1,
  33439. "ocircumflexdotbelow",
  33440. 0x1ed9,
  33441. "ocircumflexgrave",
  33442. 0x1ed3,
  33443. "ocircumflexhookabove",
  33444. 0x1ed5,
  33445. "ocircumflextilde",
  33446. 0x1ed7,
  33447. "ocyrillic",
  33448. 0x043e,
  33449. "odblacute",
  33450. 0x0151,
  33451. "odblgrave",
  33452. 0x020d,
  33453. "odeva",
  33454. 0x0913,
  33455. "odieresis",
  33456. 0x00f6,
  33457. "odieresiscyrillic",
  33458. 0x04e7,
  33459. "odotbelow",
  33460. 0x1ecd,
  33461. "oe",
  33462. 0x0153,
  33463. "oekorean",
  33464. 0x315a,
  33465. "ogonek",
  33466. 0x02db,
  33467. "ogonekcmb",
  33468. 0x0328,
  33469. "ograve",
  33470. 0x00f2,
  33471. "ogujarati",
  33472. 0x0a93,
  33473. "oharmenian",
  33474. 0x0585,
  33475. "ohiragana",
  33476. 0x304a,
  33477. "ohookabove",
  33478. 0x1ecf,
  33479. "ohorn",
  33480. 0x01a1,
  33481. "ohornacute",
  33482. 0x1edb,
  33483. "ohorndotbelow",
  33484. 0x1ee3,
  33485. "ohorngrave",
  33486. 0x1edd,
  33487. "ohornhookabove",
  33488. 0x1edf,
  33489. "ohorntilde",
  33490. 0x1ee1,
  33491. "ohungarumlaut",
  33492. 0x0151,
  33493. "oi",
  33494. 0x01a3,
  33495. "oinvertedbreve",
  33496. 0x020f,
  33497. "okatakana",
  33498. 0x30aa,
  33499. "okatakanahalfwidth",
  33500. 0xff75,
  33501. "okorean",
  33502. 0x3157,
  33503. "olehebrew",
  33504. 0x05ab,
  33505. "omacron",
  33506. 0x014d,
  33507. "omacronacute",
  33508. 0x1e53,
  33509. "omacrongrave",
  33510. 0x1e51,
  33511. "omdeva",
  33512. 0x0950,
  33513. "omega",
  33514. 0x03c9,
  33515. "omega1",
  33516. 0x03d6,
  33517. "omegacyrillic",
  33518. 0x0461,
  33519. "omegalatinclosed",
  33520. 0x0277,
  33521. "omegaroundcyrillic",
  33522. 0x047b,
  33523. "omegatitlocyrillic",
  33524. 0x047d,
  33525. "omegatonos",
  33526. 0x03ce,
  33527. "omgujarati",
  33528. 0x0ad0,
  33529. "omicron",
  33530. 0x03bf,
  33531. "omicrontonos",
  33532. 0x03cc,
  33533. "omonospace",
  33534. 0xff4f,
  33535. "one",
  33536. 0x0031,
  33537. "onearabic",
  33538. 0x0661,
  33539. "onebengali",
  33540. 0x09e7,
  33541. "onecircle",
  33542. 0x2460,
  33543. "onecircleinversesansserif",
  33544. 0x278a,
  33545. "onedeva",
  33546. 0x0967,
  33547. "onedotenleader",
  33548. 0x2024,
  33549. "oneeighth",
  33550. 0x215b,
  33551. "onefitted",
  33552. 0xf6dc,
  33553. "onegujarati",
  33554. 0x0ae7,
  33555. "onegurmukhi",
  33556. 0x0a67,
  33557. "onehackarabic",
  33558. 0x0661,
  33559. "onehalf",
  33560. 0x00bd,
  33561. "onehangzhou",
  33562. 0x3021,
  33563. "oneideographicparen",
  33564. 0x3220,
  33565. "oneinferior",
  33566. 0x2081,
  33567. "onemonospace",
  33568. 0xff11,
  33569. "onenumeratorbengali",
  33570. 0x09f4,
  33571. "oneoldstyle",
  33572. 0xf731,
  33573. "oneparen",
  33574. 0x2474,
  33575. "oneperiod",
  33576. 0x2488,
  33577. "onepersian",
  33578. 0x06f1,
  33579. "onequarter",
  33580. 0x00bc,
  33581. "oneroman",
  33582. 0x2170,
  33583. "onesuperior",
  33584. 0x00b9,
  33585. "onethai",
  33586. 0x0e51,
  33587. "onethird",
  33588. 0x2153,
  33589. "oogonek",
  33590. 0x01eb,
  33591. "oogonekmacron",
  33592. 0x01ed,
  33593. "oogurmukhi",
  33594. 0x0a13,
  33595. "oomatragurmukhi",
  33596. 0x0a4b,
  33597. "oopen",
  33598. 0x0254,
  33599. "oparen",
  33600. 0x24aa,
  33601. "openbullet",
  33602. 0x25e6,
  33603. "option",
  33604. 0x2325,
  33605. "ordfeminine",
  33606. 0x00aa,
  33607. "ordmasculine",
  33608. 0x00ba,
  33609. "orthogonal",
  33610. 0x221f,
  33611. "oshortdeva",
  33612. 0x0912,
  33613. "oshortvowelsigndeva",
  33614. 0x094a,
  33615. "oslash",
  33616. 0x00f8,
  33617. "oslashacute",
  33618. 0x01ff,
  33619. "osmallhiragana",
  33620. 0x3049,
  33621. "osmallkatakana",
  33622. 0x30a9,
  33623. "osmallkatakanahalfwidth",
  33624. 0xff6b,
  33625. "ostrokeacute",
  33626. 0x01ff,
  33627. "osuperior",
  33628. 0xf6f0,
  33629. "otcyrillic",
  33630. 0x047f,
  33631. "otilde",
  33632. 0x00f5,
  33633. "otildeacute",
  33634. 0x1e4d,
  33635. "otildedieresis",
  33636. 0x1e4f,
  33637. "oubopomofo",
  33638. 0x3121,
  33639. "overline",
  33640. 0x203e,
  33641. "overlinecenterline",
  33642. 0xfe4a,
  33643. "overlinecmb",
  33644. 0x0305,
  33645. "overlinedashed",
  33646. 0xfe49,
  33647. "overlinedblwavy",
  33648. 0xfe4c,
  33649. "overlinewavy",
  33650. 0xfe4b,
  33651. "overscore",
  33652. 0x00af,
  33653. "ovowelsignbengali",
  33654. 0x09cb,
  33655. "ovowelsigndeva",
  33656. 0x094b,
  33657. "ovowelsigngujarati",
  33658. 0x0acb,
  33659. "p",
  33660. 0x0070,
  33661. "paampssquare",
  33662. 0x3380,
  33663. "paasentosquare",
  33664. 0x332b,
  33665. "pabengali",
  33666. 0x09aa,
  33667. "pacute",
  33668. 0x1e55,
  33669. "padeva",
  33670. 0x092a,
  33671. "pagedown",
  33672. 0x21df,
  33673. "pageup",
  33674. 0x21de,
  33675. "pagujarati",
  33676. 0x0aaa,
  33677. "pagurmukhi",
  33678. 0x0a2a,
  33679. "pahiragana",
  33680. 0x3071,
  33681. "paiyannoithai",
  33682. 0x0e2f,
  33683. "pakatakana",
  33684. 0x30d1,
  33685. "palatalizationcyrilliccmb",
  33686. 0x0484,
  33687. "palochkacyrillic",
  33688. 0x04c0,
  33689. "pansioskorean",
  33690. 0x317f,
  33691. "paragraph",
  33692. 0x00b6,
  33693. "parallel",
  33694. 0x2225,
  33695. "parenleft",
  33696. 0x0028,
  33697. "parenleftaltonearabic",
  33698. 0xfd3e,
  33699. "parenleftbt",
  33700. 0xf8ed,
  33701. "parenleftex",
  33702. 0xf8ec,
  33703. "parenleftinferior",
  33704. 0x208d,
  33705. "parenleftmonospace",
  33706. 0xff08,
  33707. "parenleftsmall",
  33708. 0xfe59,
  33709. "parenleftsuperior",
  33710. 0x207d,
  33711. "parenlefttp",
  33712. 0xf8eb,
  33713. "parenleftvertical",
  33714. 0xfe35,
  33715. "parenright",
  33716. 0x0029,
  33717. "parenrightaltonearabic",
  33718. 0xfd3f,
  33719. "parenrightbt",
  33720. 0xf8f8,
  33721. "parenrightex",
  33722. 0xf8f7,
  33723. "parenrightinferior",
  33724. 0x208e,
  33725. "parenrightmonospace",
  33726. 0xff09,
  33727. "parenrightsmall",
  33728. 0xfe5a,
  33729. "parenrightsuperior",
  33730. 0x207e,
  33731. "parenrighttp",
  33732. 0xf8f6,
  33733. "parenrightvertical",
  33734. 0xfe36,
  33735. "partialdiff",
  33736. 0x2202,
  33737. "paseqhebrew",
  33738. 0x05c0,
  33739. "pashtahebrew",
  33740. 0x0599,
  33741. "pasquare",
  33742. 0x33a9,
  33743. "patah",
  33744. 0x05b7,
  33745. "patah11",
  33746. 0x05b7,
  33747. "patah1d",
  33748. 0x05b7,
  33749. "patah2a",
  33750. 0x05b7,
  33751. "patahhebrew",
  33752. 0x05b7,
  33753. "patahnarrowhebrew",
  33754. 0x05b7,
  33755. "patahquarterhebrew",
  33756. 0x05b7,
  33757. "patahwidehebrew",
  33758. 0x05b7,
  33759. "pazerhebrew",
  33760. 0x05a1,
  33761. "pbopomofo",
  33762. 0x3106,
  33763. "pcircle",
  33764. 0x24df,
  33765. "pdotaccent",
  33766. 0x1e57,
  33767. "pe",
  33768. 0x05e4,
  33769. "pecyrillic",
  33770. 0x043f,
  33771. "pedagesh",
  33772. 0xfb44,
  33773. "pedageshhebrew",
  33774. 0xfb44,
  33775. "peezisquare",
  33776. 0x333b,
  33777. "pefinaldageshhebrew",
  33778. 0xfb43,
  33779. "peharabic",
  33780. 0x067e,
  33781. "peharmenian",
  33782. 0x057a,
  33783. "pehebrew",
  33784. 0x05e4,
  33785. "pehfinalarabic",
  33786. 0xfb57,
  33787. "pehinitialarabic",
  33788. 0xfb58,
  33789. "pehiragana",
  33790. 0x307a,
  33791. "pehmedialarabic",
  33792. 0xfb59,
  33793. "pekatakana",
  33794. 0x30da,
  33795. "pemiddlehookcyrillic",
  33796. 0x04a7,
  33797. "perafehebrew",
  33798. 0xfb4e,
  33799. "percent",
  33800. 0x0025,
  33801. "percentarabic",
  33802. 0x066a,
  33803. "percentmonospace",
  33804. 0xff05,
  33805. "percentsmall",
  33806. 0xfe6a,
  33807. "period",
  33808. 0x002e,
  33809. "periodarmenian",
  33810. 0x0589,
  33811. "periodcentered",
  33812. 0x00b7,
  33813. "periodhalfwidth",
  33814. 0xff61,
  33815. "periodinferior",
  33816. 0xf6e7,
  33817. "periodmonospace",
  33818. 0xff0e,
  33819. "periodsmall",
  33820. 0xfe52,
  33821. "periodsuperior",
  33822. 0xf6e8,
  33823. "perispomenigreekcmb",
  33824. 0x0342,
  33825. "perpendicular",
  33826. 0x22a5,
  33827. "perthousand",
  33828. 0x2030,
  33829. "peseta",
  33830. 0x20a7,
  33831. "pfsquare",
  33832. 0x338a,
  33833. "phabengali",
  33834. 0x09ab,
  33835. "phadeva",
  33836. 0x092b,
  33837. "phagujarati",
  33838. 0x0aab,
  33839. "phagurmukhi",
  33840. 0x0a2b,
  33841. "phi",
  33842. 0x03c6,
  33843. "phi1",
  33844. 0x03d5,
  33845. "phieuphacirclekorean",
  33846. 0x327a,
  33847. "phieuphaparenkorean",
  33848. 0x321a,
  33849. "phieuphcirclekorean",
  33850. 0x326c,
  33851. "phieuphkorean",
  33852. 0x314d,
  33853. "phieuphparenkorean",
  33854. 0x320c,
  33855. "philatin",
  33856. 0x0278,
  33857. "phinthuthai",
  33858. 0x0e3a,
  33859. "phisymbolgreek",
  33860. 0x03d5,
  33861. "phook",
  33862. 0x01a5,
  33863. "phophanthai",
  33864. 0x0e1e,
  33865. "phophungthai",
  33866. 0x0e1c,
  33867. "phosamphaothai",
  33868. 0x0e20,
  33869. "pi",
  33870. 0x03c0,
  33871. "pieupacirclekorean",
  33872. 0x3273,
  33873. "pieupaparenkorean",
  33874. 0x3213,
  33875. "pieupcieuckorean",
  33876. 0x3176,
  33877. "pieupcirclekorean",
  33878. 0x3265,
  33879. "pieupkiyeokkorean",
  33880. 0x3172,
  33881. "pieupkorean",
  33882. 0x3142,
  33883. "pieupparenkorean",
  33884. 0x3205,
  33885. "pieupsioskiyeokkorean",
  33886. 0x3174,
  33887. "pieupsioskorean",
  33888. 0x3144,
  33889. "pieupsiostikeutkorean",
  33890. 0x3175,
  33891. "pieupthieuthkorean",
  33892. 0x3177,
  33893. "pieuptikeutkorean",
  33894. 0x3173,
  33895. "pihiragana",
  33896. 0x3074,
  33897. "pikatakana",
  33898. 0x30d4,
  33899. "pisymbolgreek",
  33900. 0x03d6,
  33901. "piwrarmenian",
  33902. 0x0583,
  33903. "plus",
  33904. 0x002b,
  33905. "plusbelowcmb",
  33906. 0x031f,
  33907. "pluscircle",
  33908. 0x2295,
  33909. "plusminus",
  33910. 0x00b1,
  33911. "plusmod",
  33912. 0x02d6,
  33913. "plusmonospace",
  33914. 0xff0b,
  33915. "plussmall",
  33916. 0xfe62,
  33917. "plussuperior",
  33918. 0x207a,
  33919. "pmonospace",
  33920. 0xff50,
  33921. "pmsquare",
  33922. 0x33d8,
  33923. "pohiragana",
  33924. 0x307d,
  33925. "pointingindexdownwhite",
  33926. 0x261f,
  33927. "pointingindexleftwhite",
  33928. 0x261c,
  33929. "pointingindexrightwhite",
  33930. 0x261e,
  33931. "pointingindexupwhite",
  33932. 0x261d,
  33933. "pokatakana",
  33934. 0x30dd,
  33935. "poplathai",
  33936. 0x0e1b,
  33937. "postalmark",
  33938. 0x3012,
  33939. "postalmarkface",
  33940. 0x3020,
  33941. "pparen",
  33942. 0x24ab,
  33943. "precedes",
  33944. 0x227a,
  33945. "prescription",
  33946. 0x211e,
  33947. "primemod",
  33948. 0x02b9,
  33949. "primereversed",
  33950. 0x2035,
  33951. "product",
  33952. 0x220f,
  33953. "projective",
  33954. 0x2305,
  33955. "prolongedkana",
  33956. 0x30fc,
  33957. "propellor",
  33958. 0x2318,
  33959. "propersubset",
  33960. 0x2282,
  33961. "propersuperset",
  33962. 0x2283,
  33963. "proportion",
  33964. 0x2237,
  33965. "proportional",
  33966. 0x221d,
  33967. "psi",
  33968. 0x03c8,
  33969. "psicyrillic",
  33970. 0x0471,
  33971. "psilipneumatacyrilliccmb",
  33972. 0x0486,
  33973. "pssquare",
  33974. 0x33b0,
  33975. "puhiragana",
  33976. 0x3077,
  33977. "pukatakana",
  33978. 0x30d7,
  33979. "pvsquare",
  33980. 0x33b4,
  33981. "pwsquare",
  33982. 0x33ba,
  33983. "q",
  33984. 0x0071,
  33985. "qadeva",
  33986. 0x0958,
  33987. "qadmahebrew",
  33988. 0x05a8,
  33989. "qafarabic",
  33990. 0x0642,
  33991. "qaffinalarabic",
  33992. 0xfed6,
  33993. "qafinitialarabic",
  33994. 0xfed7,
  33995. "qafmedialarabic",
  33996. 0xfed8,
  33997. "qamats",
  33998. 0x05b8,
  33999. "qamats10",
  34000. 0x05b8,
  34001. "qamats1a",
  34002. 0x05b8,
  34003. "qamats1c",
  34004. 0x05b8,
  34005. "qamats27",
  34006. 0x05b8,
  34007. "qamats29",
  34008. 0x05b8,
  34009. "qamats33",
  34010. 0x05b8,
  34011. "qamatsde",
  34012. 0x05b8,
  34013. "qamatshebrew",
  34014. 0x05b8,
  34015. "qamatsnarrowhebrew",
  34016. 0x05b8,
  34017. "qamatsqatanhebrew",
  34018. 0x05b8,
  34019. "qamatsqatannarrowhebrew",
  34020. 0x05b8,
  34021. "qamatsqatanquarterhebrew",
  34022. 0x05b8,
  34023. "qamatsqatanwidehebrew",
  34024. 0x05b8,
  34025. "qamatsquarterhebrew",
  34026. 0x05b8,
  34027. "qamatswidehebrew",
  34028. 0x05b8,
  34029. "qarneyparahebrew",
  34030. 0x059f,
  34031. "qbopomofo",
  34032. 0x3111,
  34033. "qcircle",
  34034. 0x24e0,
  34035. "qhook",
  34036. 0x02a0,
  34037. "qmonospace",
  34038. 0xff51,
  34039. "qof",
  34040. 0x05e7,
  34041. "qofdagesh",
  34042. 0xfb47,
  34043. "qofdageshhebrew",
  34044. 0xfb47,
  34045. "qofhebrew",
  34046. 0x05e7,
  34047. "qparen",
  34048. 0x24ac,
  34049. "quarternote",
  34050. 0x2669,
  34051. "qubuts",
  34052. 0x05bb,
  34053. "qubuts18",
  34054. 0x05bb,
  34055. "qubuts25",
  34056. 0x05bb,
  34057. "qubuts31",
  34058. 0x05bb,
  34059. "qubutshebrew",
  34060. 0x05bb,
  34061. "qubutsnarrowhebrew",
  34062. 0x05bb,
  34063. "qubutsquarterhebrew",
  34064. 0x05bb,
  34065. "qubutswidehebrew",
  34066. 0x05bb,
  34067. "question",
  34068. 0x003f,
  34069. "questionarabic",
  34070. 0x061f,
  34071. "questionarmenian",
  34072. 0x055e,
  34073. "questiondown",
  34074. 0x00bf,
  34075. "questiondownsmall",
  34076. 0xf7bf,
  34077. "questiongreek",
  34078. 0x037e,
  34079. "questionmonospace",
  34080. 0xff1f,
  34081. "questionsmall",
  34082. 0xf73f,
  34083. "quotedbl",
  34084. 0x0022,
  34085. "quotedblbase",
  34086. 0x201e,
  34087. "quotedblleft",
  34088. 0x201c,
  34089. "quotedblmonospace",
  34090. 0xff02,
  34091. "quotedblprime",
  34092. 0x301e,
  34093. "quotedblprimereversed",
  34094. 0x301d,
  34095. "quotedblright",
  34096. 0x201d,
  34097. "quoteleft",
  34098. 0x2018,
  34099. "quoteleftreversed",
  34100. 0x201b,
  34101. "quotereversed",
  34102. 0x201b,
  34103. "quoteright",
  34104. 0x2019,
  34105. "quoterightn",
  34106. 0x0149,
  34107. "quotesinglbase",
  34108. 0x201a,
  34109. "quotesingle",
  34110. 0x0027,
  34111. "quotesinglemonospace",
  34112. 0xff07,
  34113. "r",
  34114. 0x0072,
  34115. "raarmenian",
  34116. 0x057c,
  34117. "rabengali",
  34118. 0x09b0,
  34119. "racute",
  34120. 0x0155,
  34121. "radeva",
  34122. 0x0930,
  34123. "radical",
  34124. 0x221a,
  34125. "radicalex",
  34126. 0xf8e5,
  34127. "radoverssquare",
  34128. 0x33ae,
  34129. "radoverssquaredsquare",
  34130. 0x33af,
  34131. "radsquare",
  34132. 0x33ad,
  34133. "rafe",
  34134. 0x05bf,
  34135. "rafehebrew",
  34136. 0x05bf,
  34137. "ragujarati",
  34138. 0x0ab0,
  34139. "ragurmukhi",
  34140. 0x0a30,
  34141. "rahiragana",
  34142. 0x3089,
  34143. "rakatakana",
  34144. 0x30e9,
  34145. "rakatakanahalfwidth",
  34146. 0xff97,
  34147. "ralowerdiagonalbengali",
  34148. 0x09f1,
  34149. "ramiddlediagonalbengali",
  34150. 0x09f0,
  34151. "ramshorn",
  34152. 0x0264,
  34153. "ratio",
  34154. 0x2236,
  34155. "rbopomofo",
  34156. 0x3116,
  34157. "rcaron",
  34158. 0x0159,
  34159. "rcedilla",
  34160. 0x0157,
  34161. "rcircle",
  34162. 0x24e1,
  34163. "rcommaaccent",
  34164. 0x0157,
  34165. "rdblgrave",
  34166. 0x0211,
  34167. "rdotaccent",
  34168. 0x1e59,
  34169. "rdotbelow",
  34170. 0x1e5b,
  34171. "rdotbelowmacron",
  34172. 0x1e5d,
  34173. "referencemark",
  34174. 0x203b,
  34175. "reflexsubset",
  34176. 0x2286,
  34177. "reflexsuperset",
  34178. 0x2287,
  34179. "registered",
  34180. 0x00ae,
  34181. "registersans",
  34182. 0xf8e8,
  34183. "registerserif",
  34184. 0xf6da,
  34185. "reharabic",
  34186. 0x0631,
  34187. "reharmenian",
  34188. 0x0580,
  34189. "rehfinalarabic",
  34190. 0xfeae,
  34191. "rehiragana",
  34192. 0x308c,
  34193. "rekatakana",
  34194. 0x30ec,
  34195. "rekatakanahalfwidth",
  34196. 0xff9a,
  34197. "resh",
  34198. 0x05e8,
  34199. "reshdageshhebrew",
  34200. 0xfb48,
  34201. "reshhebrew",
  34202. 0x05e8,
  34203. "reversedtilde",
  34204. 0x223d,
  34205. "reviahebrew",
  34206. 0x0597,
  34207. "reviamugrashhebrew",
  34208. 0x0597,
  34209. "revlogicalnot",
  34210. 0x2310,
  34211. "rfishhook",
  34212. 0x027e,
  34213. "rfishhookreversed",
  34214. 0x027f,
  34215. "rhabengali",
  34216. 0x09dd,
  34217. "rhadeva",
  34218. 0x095d,
  34219. "rho",
  34220. 0x03c1,
  34221. "rhook",
  34222. 0x027d,
  34223. "rhookturned",
  34224. 0x027b,
  34225. "rhookturnedsuperior",
  34226. 0x02b5,
  34227. "rhosymbolgreek",
  34228. 0x03f1,
  34229. "rhotichookmod",
  34230. 0x02de,
  34231. "rieulacirclekorean",
  34232. 0x3271,
  34233. "rieulaparenkorean",
  34234. 0x3211,
  34235. "rieulcirclekorean",
  34236. 0x3263,
  34237. "rieulhieuhkorean",
  34238. 0x3140,
  34239. "rieulkiyeokkorean",
  34240. 0x313a,
  34241. "rieulkiyeoksioskorean",
  34242. 0x3169,
  34243. "rieulkorean",
  34244. 0x3139,
  34245. "rieulmieumkorean",
  34246. 0x313b,
  34247. "rieulpansioskorean",
  34248. 0x316c,
  34249. "rieulparenkorean",
  34250. 0x3203,
  34251. "rieulphieuphkorean",
  34252. 0x313f,
  34253. "rieulpieupkorean",
  34254. 0x313c,
  34255. "rieulpieupsioskorean",
  34256. 0x316b,
  34257. "rieulsioskorean",
  34258. 0x313d,
  34259. "rieulthieuthkorean",
  34260. 0x313e,
  34261. "rieultikeutkorean",
  34262. 0x316a,
  34263. "rieulyeorinhieuhkorean",
  34264. 0x316d,
  34265. "rightangle",
  34266. 0x221f,
  34267. "righttackbelowcmb",
  34268. 0x0319,
  34269. "righttriangle",
  34270. 0x22bf,
  34271. "rihiragana",
  34272. 0x308a,
  34273. "rikatakana",
  34274. 0x30ea,
  34275. "rikatakanahalfwidth",
  34276. 0xff98,
  34277. "ring",
  34278. 0x02da,
  34279. "ringbelowcmb",
  34280. 0x0325,
  34281. "ringcmb",
  34282. 0x030a,
  34283. "ringhalfleft",
  34284. 0x02bf,
  34285. "ringhalfleftarmenian",
  34286. 0x0559,
  34287. "ringhalfleftbelowcmb",
  34288. 0x031c,
  34289. "ringhalfleftcentered",
  34290. 0x02d3,
  34291. "ringhalfright",
  34292. 0x02be,
  34293. "ringhalfrightbelowcmb",
  34294. 0x0339,
  34295. "ringhalfrightcentered",
  34296. 0x02d2,
  34297. "rinvertedbreve",
  34298. 0x0213,
  34299. "rittorusquare",
  34300. 0x3351,
  34301. "rlinebelow",
  34302. 0x1e5f,
  34303. "rlongleg",
  34304. 0x027c,
  34305. "rlonglegturned",
  34306. 0x027a,
  34307. "rmonospace",
  34308. 0xff52,
  34309. "rohiragana",
  34310. 0x308d,
  34311. "rokatakana",
  34312. 0x30ed,
  34313. "rokatakanahalfwidth",
  34314. 0xff9b,
  34315. "roruathai",
  34316. 0x0e23,
  34317. "rparen",
  34318. 0x24ad,
  34319. "rrabengali",
  34320. 0x09dc,
  34321. "rradeva",
  34322. 0x0931,
  34323. "rragurmukhi",
  34324. 0x0a5c,
  34325. "rreharabic",
  34326. 0x0691,
  34327. "rrehfinalarabic",
  34328. 0xfb8d,
  34329. "rrvocalicbengali",
  34330. 0x09e0,
  34331. "rrvocalicdeva",
  34332. 0x0960,
  34333. "rrvocalicgujarati",
  34334. 0x0ae0,
  34335. "rrvocalicvowelsignbengali",
  34336. 0x09c4,
  34337. "rrvocalicvowelsigndeva",
  34338. 0x0944,
  34339. "rrvocalicvowelsigngujarati",
  34340. 0x0ac4,
  34341. "rsuperior",
  34342. 0xf6f1,
  34343. "rtblock",
  34344. 0x2590,
  34345. "rturned",
  34346. 0x0279,
  34347. "rturnedsuperior",
  34348. 0x02b4,
  34349. "ruhiragana",
  34350. 0x308b,
  34351. "rukatakana",
  34352. 0x30eb,
  34353. "rukatakanahalfwidth",
  34354. 0xff99,
  34355. "rupeemarkbengali",
  34356. 0x09f2,
  34357. "rupeesignbengali",
  34358. 0x09f3,
  34359. "rupiah",
  34360. 0xf6dd,
  34361. "ruthai",
  34362. 0x0e24,
  34363. "rvocalicbengali",
  34364. 0x098b,
  34365. "rvocalicdeva",
  34366. 0x090b,
  34367. "rvocalicgujarati",
  34368. 0x0a8b,
  34369. "rvocalicvowelsignbengali",
  34370. 0x09c3,
  34371. "rvocalicvowelsigndeva",
  34372. 0x0943,
  34373. "rvocalicvowelsigngujarati",
  34374. 0x0ac3,
  34375. "s",
  34376. 0x0073,
  34377. "sabengali",
  34378. 0x09b8,
  34379. "sacute",
  34380. 0x015b,
  34381. "sacutedotaccent",
  34382. 0x1e65,
  34383. "sadarabic",
  34384. 0x0635,
  34385. "sadeva",
  34386. 0x0938,
  34387. "sadfinalarabic",
  34388. 0xfeba,
  34389. "sadinitialarabic",
  34390. 0xfebb,
  34391. "sadmedialarabic",
  34392. 0xfebc,
  34393. "sagujarati",
  34394. 0x0ab8,
  34395. "sagurmukhi",
  34396. 0x0a38,
  34397. "sahiragana",
  34398. 0x3055,
  34399. "sakatakana",
  34400. 0x30b5,
  34401. "sakatakanahalfwidth",
  34402. 0xff7b,
  34403. "sallallahoualayhewasallamarabic",
  34404. 0xfdfa,
  34405. "samekh",
  34406. 0x05e1,
  34407. "samekhdagesh",
  34408. 0xfb41,
  34409. "samekhdageshhebrew",
  34410. 0xfb41,
  34411. "samekhhebrew",
  34412. 0x05e1,
  34413. "saraaathai",
  34414. 0x0e32,
  34415. "saraaethai",
  34416. 0x0e41,
  34417. "saraaimaimalaithai",
  34418. 0x0e44,
  34419. "saraaimaimuanthai",
  34420. 0x0e43,
  34421. "saraamthai",
  34422. 0x0e33,
  34423. "saraathai",
  34424. 0x0e30,
  34425. "saraethai",
  34426. 0x0e40,
  34427. "saraiileftthai",
  34428. 0xf886,
  34429. "saraiithai",
  34430. 0x0e35,
  34431. "saraileftthai",
  34432. 0xf885,
  34433. "saraithai",
  34434. 0x0e34,
  34435. "saraothai",
  34436. 0x0e42,
  34437. "saraueeleftthai",
  34438. 0xf888,
  34439. "saraueethai",
  34440. 0x0e37,
  34441. "saraueleftthai",
  34442. 0xf887,
  34443. "sarauethai",
  34444. 0x0e36,
  34445. "sarauthai",
  34446. 0x0e38,
  34447. "sarauuthai",
  34448. 0x0e39,
  34449. "sbopomofo",
  34450. 0x3119,
  34451. "scaron",
  34452. 0x0161,
  34453. "scarondotaccent",
  34454. 0x1e67,
  34455. "scedilla",
  34456. 0x015f,
  34457. "schwa",
  34458. 0x0259,
  34459. "schwacyrillic",
  34460. 0x04d9,
  34461. "schwadieresiscyrillic",
  34462. 0x04db,
  34463. "schwahook",
  34464. 0x025a,
  34465. "scircle",
  34466. 0x24e2,
  34467. "scircumflex",
  34468. 0x015d,
  34469. "scommaaccent",
  34470. 0x0219,
  34471. "sdotaccent",
  34472. 0x1e61,
  34473. "sdotbelow",
  34474. 0x1e63,
  34475. "sdotbelowdotaccent",
  34476. 0x1e69,
  34477. "seagullbelowcmb",
  34478. 0x033c,
  34479. "second",
  34480. 0x2033,
  34481. "secondtonechinese",
  34482. 0x02ca,
  34483. "section",
  34484. 0x00a7,
  34485. "seenarabic",
  34486. 0x0633,
  34487. "seenfinalarabic",
  34488. 0xfeb2,
  34489. "seeninitialarabic",
  34490. 0xfeb3,
  34491. "seenmedialarabic",
  34492. 0xfeb4,
  34493. "segol",
  34494. 0x05b6,
  34495. "segol13",
  34496. 0x05b6,
  34497. "segol1f",
  34498. 0x05b6,
  34499. "segol2c",
  34500. 0x05b6,
  34501. "segolhebrew",
  34502. 0x05b6,
  34503. "segolnarrowhebrew",
  34504. 0x05b6,
  34505. "segolquarterhebrew",
  34506. 0x05b6,
  34507. "segoltahebrew",
  34508. 0x0592,
  34509. "segolwidehebrew",
  34510. 0x05b6,
  34511. "seharmenian",
  34512. 0x057d,
  34513. "sehiragana",
  34514. 0x305b,
  34515. "sekatakana",
  34516. 0x30bb,
  34517. "sekatakanahalfwidth",
  34518. 0xff7e,
  34519. "semicolon",
  34520. 0x003b,
  34521. "semicolonarabic",
  34522. 0x061b,
  34523. "semicolonmonospace",
  34524. 0xff1b,
  34525. "semicolonsmall",
  34526. 0xfe54,
  34527. "semivoicedmarkkana",
  34528. 0x309c,
  34529. "semivoicedmarkkanahalfwidth",
  34530. 0xff9f,
  34531. "sentisquare",
  34532. 0x3322,
  34533. "sentosquare",
  34534. 0x3323,
  34535. "seven",
  34536. 0x0037,
  34537. "sevenarabic",
  34538. 0x0667,
  34539. "sevenbengali",
  34540. 0x09ed,
  34541. "sevencircle",
  34542. 0x2466,
  34543. "sevencircleinversesansserif",
  34544. 0x2790,
  34545. "sevendeva",
  34546. 0x096d,
  34547. "seveneighths",
  34548. 0x215e,
  34549. "sevengujarati",
  34550. 0x0aed,
  34551. "sevengurmukhi",
  34552. 0x0a6d,
  34553. "sevenhackarabic",
  34554. 0x0667,
  34555. "sevenhangzhou",
  34556. 0x3027,
  34557. "sevenideographicparen",
  34558. 0x3226,
  34559. "seveninferior",
  34560. 0x2087,
  34561. "sevenmonospace",
  34562. 0xff17,
  34563. "sevenoldstyle",
  34564. 0xf737,
  34565. "sevenparen",
  34566. 0x247a,
  34567. "sevenperiod",
  34568. 0x248e,
  34569. "sevenpersian",
  34570. 0x06f7,
  34571. "sevenroman",
  34572. 0x2176,
  34573. "sevensuperior",
  34574. 0x2077,
  34575. "seventeencircle",
  34576. 0x2470,
  34577. "seventeenparen",
  34578. 0x2484,
  34579. "seventeenperiod",
  34580. 0x2498,
  34581. "seventhai",
  34582. 0x0e57,
  34583. "sfthyphen",
  34584. 0x00ad,
  34585. "shaarmenian",
  34586. 0x0577,
  34587. "shabengali",
  34588. 0x09b6,
  34589. "shacyrillic",
  34590. 0x0448,
  34591. "shaddaarabic",
  34592. 0x0651,
  34593. "shaddadammaarabic",
  34594. 0xfc61,
  34595. "shaddadammatanarabic",
  34596. 0xfc5e,
  34597. "shaddafathaarabic",
  34598. 0xfc60,
  34599. "shaddakasraarabic",
  34600. 0xfc62,
  34601. "shaddakasratanarabic",
  34602. 0xfc5f,
  34603. "shade",
  34604. 0x2592,
  34605. "shadedark",
  34606. 0x2593,
  34607. "shadelight",
  34608. 0x2591,
  34609. "shademedium",
  34610. 0x2592,
  34611. "shadeva",
  34612. 0x0936,
  34613. "shagujarati",
  34614. 0x0ab6,
  34615. "shagurmukhi",
  34616. 0x0a36,
  34617. "shalshelethebrew",
  34618. 0x0593,
  34619. "shbopomofo",
  34620. 0x3115,
  34621. "shchacyrillic",
  34622. 0x0449,
  34623. "sheenarabic",
  34624. 0x0634,
  34625. "sheenfinalarabic",
  34626. 0xfeb6,
  34627. "sheeninitialarabic",
  34628. 0xfeb7,
  34629. "sheenmedialarabic",
  34630. 0xfeb8,
  34631. "sheicoptic",
  34632. 0x03e3,
  34633. "sheqel",
  34634. 0x20aa,
  34635. "sheqelhebrew",
  34636. 0x20aa,
  34637. "sheva",
  34638. 0x05b0,
  34639. "sheva115",
  34640. 0x05b0,
  34641. "sheva15",
  34642. 0x05b0,
  34643. "sheva22",
  34644. 0x05b0,
  34645. "sheva2e",
  34646. 0x05b0,
  34647. "shevahebrew",
  34648. 0x05b0,
  34649. "shevanarrowhebrew",
  34650. 0x05b0,
  34651. "shevaquarterhebrew",
  34652. 0x05b0,
  34653. "shevawidehebrew",
  34654. 0x05b0,
  34655. "shhacyrillic",
  34656. 0x04bb,
  34657. "shimacoptic",
  34658. 0x03ed,
  34659. "shin",
  34660. 0x05e9,
  34661. "shindagesh",
  34662. 0xfb49,
  34663. "shindageshhebrew",
  34664. 0xfb49,
  34665. "shindageshshindot",
  34666. 0xfb2c,
  34667. "shindageshshindothebrew",
  34668. 0xfb2c,
  34669. "shindageshsindot",
  34670. 0xfb2d,
  34671. "shindageshsindothebrew",
  34672. 0xfb2d,
  34673. "shindothebrew",
  34674. 0x05c1,
  34675. "shinhebrew",
  34676. 0x05e9,
  34677. "shinshindot",
  34678. 0xfb2a,
  34679. "shinshindothebrew",
  34680. 0xfb2a,
  34681. "shinsindot",
  34682. 0xfb2b,
  34683. "shinsindothebrew",
  34684. 0xfb2b,
  34685. "shook",
  34686. 0x0282,
  34687. "sigma",
  34688. 0x03c3,
  34689. "sigma1",
  34690. 0x03c2,
  34691. "sigmafinal",
  34692. 0x03c2,
  34693. "sigmalunatesymbolgreek",
  34694. 0x03f2,
  34695. "sihiragana",
  34696. 0x3057,
  34697. "sikatakana",
  34698. 0x30b7,
  34699. "sikatakanahalfwidth",
  34700. 0xff7c,
  34701. "siluqhebrew",
  34702. 0x05bd,
  34703. "siluqlefthebrew",
  34704. 0x05bd,
  34705. "similar",
  34706. 0x223c,
  34707. "sindothebrew",
  34708. 0x05c2,
  34709. "siosacirclekorean",
  34710. 0x3274,
  34711. "siosaparenkorean",
  34712. 0x3214,
  34713. "sioscieuckorean",
  34714. 0x317e,
  34715. "sioscirclekorean",
  34716. 0x3266,
  34717. "sioskiyeokkorean",
  34718. 0x317a,
  34719. "sioskorean",
  34720. 0x3145,
  34721. "siosnieunkorean",
  34722. 0x317b,
  34723. "siosparenkorean",
  34724. 0x3206,
  34725. "siospieupkorean",
  34726. 0x317d,
  34727. "siostikeutkorean",
  34728. 0x317c,
  34729. "six",
  34730. 0x0036,
  34731. "sixarabic",
  34732. 0x0666,
  34733. "sixbengali",
  34734. 0x09ec,
  34735. "sixcircle",
  34736. 0x2465,
  34737. "sixcircleinversesansserif",
  34738. 0x278f,
  34739. "sixdeva",
  34740. 0x096c,
  34741. "sixgujarati",
  34742. 0x0aec,
  34743. "sixgurmukhi",
  34744. 0x0a6c,
  34745. "sixhackarabic",
  34746. 0x0666,
  34747. "sixhangzhou",
  34748. 0x3026,
  34749. "sixideographicparen",
  34750. 0x3225,
  34751. "sixinferior",
  34752. 0x2086,
  34753. "sixmonospace",
  34754. 0xff16,
  34755. "sixoldstyle",
  34756. 0xf736,
  34757. "sixparen",
  34758. 0x2479,
  34759. "sixperiod",
  34760. 0x248d,
  34761. "sixpersian",
  34762. 0x06f6,
  34763. "sixroman",
  34764. 0x2175,
  34765. "sixsuperior",
  34766. 0x2076,
  34767. "sixteencircle",
  34768. 0x246f,
  34769. "sixteencurrencydenominatorbengali",
  34770. 0x09f9,
  34771. "sixteenparen",
  34772. 0x2483,
  34773. "sixteenperiod",
  34774. 0x2497,
  34775. "sixthai",
  34776. 0x0e56,
  34777. "slash",
  34778. 0x002f,
  34779. "slashmonospace",
  34780. 0xff0f,
  34781. "slong",
  34782. 0x017f,
  34783. "slongdotaccent",
  34784. 0x1e9b,
  34785. "smileface",
  34786. 0x263a,
  34787. "smonospace",
  34788. 0xff53,
  34789. "sofpasuqhebrew",
  34790. 0x05c3,
  34791. "softhyphen",
  34792. 0x00ad,
  34793. "softsigncyrillic",
  34794. 0x044c,
  34795. "sohiragana",
  34796. 0x305d,
  34797. "sokatakana",
  34798. 0x30bd,
  34799. "sokatakanahalfwidth",
  34800. 0xff7f,
  34801. "soliduslongoverlaycmb",
  34802. 0x0338,
  34803. "solidusshortoverlaycmb",
  34804. 0x0337,
  34805. "sorusithai",
  34806. 0x0e29,
  34807. "sosalathai",
  34808. 0x0e28,
  34809. "sosothai",
  34810. 0x0e0b,
  34811. "sosuathai",
  34812. 0x0e2a,
  34813. "space",
  34814. 0x0020,
  34815. "spacehackarabic",
  34816. 0x0020,
  34817. "spade",
  34818. 0x2660,
  34819. "spadesuitblack",
  34820. 0x2660,
  34821. "spadesuitwhite",
  34822. 0x2664,
  34823. "sparen",
  34824. 0x24ae,
  34825. "squarebelowcmb",
  34826. 0x033b,
  34827. "squarecc",
  34828. 0x33c4,
  34829. "squarecm",
  34830. 0x339d,
  34831. "squarediagonalcrosshatchfill",
  34832. 0x25a9,
  34833. "squarehorizontalfill",
  34834. 0x25a4,
  34835. "squarekg",
  34836. 0x338f,
  34837. "squarekm",
  34838. 0x339e,
  34839. "squarekmcapital",
  34840. 0x33ce,
  34841. "squareln",
  34842. 0x33d1,
  34843. "squarelog",
  34844. 0x33d2,
  34845. "squaremg",
  34846. 0x338e,
  34847. "squaremil",
  34848. 0x33d5,
  34849. "squaremm",
  34850. 0x339c,
  34851. "squaremsquared",
  34852. 0x33a1,
  34853. "squareorthogonalcrosshatchfill",
  34854. 0x25a6,
  34855. "squareupperlefttolowerrightfill",
  34856. 0x25a7,
  34857. "squareupperrighttolowerleftfill",
  34858. 0x25a8,
  34859. "squareverticalfill",
  34860. 0x25a5,
  34861. "squarewhitewithsmallblack",
  34862. 0x25a3,
  34863. "srsquare",
  34864. 0x33db,
  34865. "ssabengali",
  34866. 0x09b7,
  34867. "ssadeva",
  34868. 0x0937,
  34869. "ssagujarati",
  34870. 0x0ab7,
  34871. "ssangcieuckorean",
  34872. 0x3149,
  34873. "ssanghieuhkorean",
  34874. 0x3185,
  34875. "ssangieungkorean",
  34876. 0x3180,
  34877. "ssangkiyeokkorean",
  34878. 0x3132,
  34879. "ssangnieunkorean",
  34880. 0x3165,
  34881. "ssangpieupkorean",
  34882. 0x3143,
  34883. "ssangsioskorean",
  34884. 0x3146,
  34885. "ssangtikeutkorean",
  34886. 0x3138,
  34887. "ssuperior",
  34888. 0xf6f2,
  34889. "sterling",
  34890. 0x00a3,
  34891. "sterlingmonospace",
  34892. 0xffe1,
  34893. "strokelongoverlaycmb",
  34894. 0x0336,
  34895. "strokeshortoverlaycmb",
  34896. 0x0335,
  34897. "subset",
  34898. 0x2282,
  34899. "subsetnotequal",
  34900. 0x228a,
  34901. "subsetorequal",
  34902. 0x2286,
  34903. "succeeds",
  34904. 0x227b,
  34905. "suchthat",
  34906. 0x220b,
  34907. "suhiragana",
  34908. 0x3059,
  34909. "sukatakana",
  34910. 0x30b9,
  34911. "sukatakanahalfwidth",
  34912. 0xff7d,
  34913. "sukunarabic",
  34914. 0x0652,
  34915. "summation",
  34916. 0x2211,
  34917. "sun",
  34918. 0x263c,
  34919. "superset",
  34920. 0x2283,
  34921. "supersetnotequal",
  34922. 0x228b,
  34923. "supersetorequal",
  34924. 0x2287,
  34925. "svsquare",
  34926. 0x33dc,
  34927. "syouwaerasquare",
  34928. 0x337c,
  34929. "t",
  34930. 0x0074,
  34931. "tabengali",
  34932. 0x09a4,
  34933. "tackdown",
  34934. 0x22a4,
  34935. "tackleft",
  34936. 0x22a3,
  34937. "tadeva",
  34938. 0x0924,
  34939. "tagujarati",
  34940. 0x0aa4,
  34941. "tagurmukhi",
  34942. 0x0a24,
  34943. "taharabic",
  34944. 0x0637,
  34945. "tahfinalarabic",
  34946. 0xfec2,
  34947. "tahinitialarabic",
  34948. 0xfec3,
  34949. "tahiragana",
  34950. 0x305f,
  34951. "tahmedialarabic",
  34952. 0xfec4,
  34953. "taisyouerasquare",
  34954. 0x337d,
  34955. "takatakana",
  34956. 0x30bf,
  34957. "takatakanahalfwidth",
  34958. 0xff80,
  34959. "tatweelarabic",
  34960. 0x0640,
  34961. "tau",
  34962. 0x03c4,
  34963. "tav",
  34964. 0x05ea,
  34965. "tavdages",
  34966. 0xfb4a,
  34967. "tavdagesh",
  34968. 0xfb4a,
  34969. "tavdageshhebrew",
  34970. 0xfb4a,
  34971. "tavhebrew",
  34972. 0x05ea,
  34973. "tbar",
  34974. 0x0167,
  34975. "tbopomofo",
  34976. 0x310a,
  34977. "tcaron",
  34978. 0x0165,
  34979. "tccurl",
  34980. 0x02a8,
  34981. "tcedilla",
  34982. 0x0163,
  34983. "tcheharabic",
  34984. 0x0686,
  34985. "tchehfinalarabic",
  34986. 0xfb7b,
  34987. "tchehinitialarabic",
  34988. 0xfb7c,
  34989. "tchehmedialarabic",
  34990. 0xfb7d,
  34991. "tcircle",
  34992. 0x24e3,
  34993. "tcircumflexbelow",
  34994. 0x1e71,
  34995. "tcommaaccent",
  34996. 0x0163,
  34997. "tdieresis",
  34998. 0x1e97,
  34999. "tdotaccent",
  35000. 0x1e6b,
  35001. "tdotbelow",
  35002. 0x1e6d,
  35003. "tecyrillic",
  35004. 0x0442,
  35005. "tedescendercyrillic",
  35006. 0x04ad,
  35007. "teharabic",
  35008. 0x062a,
  35009. "tehfinalarabic",
  35010. 0xfe96,
  35011. "tehhahinitialarabic",
  35012. 0xfca2,
  35013. "tehhahisolatedarabic",
  35014. 0xfc0c,
  35015. "tehinitialarabic",
  35016. 0xfe97,
  35017. "tehiragana",
  35018. 0x3066,
  35019. "tehjeeminitialarabic",
  35020. 0xfca1,
  35021. "tehjeemisolatedarabic",
  35022. 0xfc0b,
  35023. "tehmarbutaarabic",
  35024. 0x0629,
  35025. "tehmarbutafinalarabic",
  35026. 0xfe94,
  35027. "tehmedialarabic",
  35028. 0xfe98,
  35029. "tehmeeminitialarabic",
  35030. 0xfca4,
  35031. "tehmeemisolatedarabic",
  35032. 0xfc0e,
  35033. "tehnoonfinalarabic",
  35034. 0xfc73,
  35035. "tekatakana",
  35036. 0x30c6,
  35037. "tekatakanahalfwidth",
  35038. 0xff83,
  35039. "telephone",
  35040. 0x2121,
  35041. "telephoneblack",
  35042. 0x260e,
  35043. "telishagedolahebrew",
  35044. 0x05a0,
  35045. "telishaqetanahebrew",
  35046. 0x05a9,
  35047. "tencircle",
  35048. 0x2469,
  35049. "tenideographicparen",
  35050. 0x3229,
  35051. "tenparen",
  35052. 0x247d,
  35053. "tenperiod",
  35054. 0x2491,
  35055. "tenroman",
  35056. 0x2179,
  35057. "tesh",
  35058. 0x02a7,
  35059. "tet",
  35060. 0x05d8,
  35061. "tetdagesh",
  35062. 0xfb38,
  35063. "tetdageshhebrew",
  35064. 0xfb38,
  35065. "tethebrew",
  35066. 0x05d8,
  35067. "tetsecyrillic",
  35068. 0x04b5,
  35069. "tevirhebrew",
  35070. 0x059b,
  35071. "tevirlefthebrew",
  35072. 0x059b,
  35073. "thabengali",
  35074. 0x09a5,
  35075. "thadeva",
  35076. 0x0925,
  35077. "thagujarati",
  35078. 0x0aa5,
  35079. "thagurmukhi",
  35080. 0x0a25,
  35081. "thalarabic",
  35082. 0x0630,
  35083. "thalfinalarabic",
  35084. 0xfeac,
  35085. "thanthakhatlowleftthai",
  35086. 0xf898,
  35087. "thanthakhatlowrightthai",
  35088. 0xf897,
  35089. "thanthakhatthai",
  35090. 0x0e4c,
  35091. "thanthakhatupperleftthai",
  35092. 0xf896,
  35093. "theharabic",
  35094. 0x062b,
  35095. "thehfinalarabic",
  35096. 0xfe9a,
  35097. "thehinitialarabic",
  35098. 0xfe9b,
  35099. "thehmedialarabic",
  35100. 0xfe9c,
  35101. "thereexists",
  35102. 0x2203,
  35103. "therefore",
  35104. 0x2234,
  35105. "theta",
  35106. 0x03b8,
  35107. "theta1",
  35108. 0x03d1,
  35109. "thetasymbolgreek",
  35110. 0x03d1,
  35111. "thieuthacirclekorean",
  35112. 0x3279,
  35113. "thieuthaparenkorean",
  35114. 0x3219,
  35115. "thieuthcirclekorean",
  35116. 0x326b,
  35117. "thieuthkorean",
  35118. 0x314c,
  35119. "thieuthparenkorean",
  35120. 0x320b,
  35121. "thirteencircle",
  35122. 0x246c,
  35123. "thirteenparen",
  35124. 0x2480,
  35125. "thirteenperiod",
  35126. 0x2494,
  35127. "thonangmonthothai",
  35128. 0x0e11,
  35129. "thook",
  35130. 0x01ad,
  35131. "thophuthaothai",
  35132. 0x0e12,
  35133. "thorn",
  35134. 0x00fe,
  35135. "thothahanthai",
  35136. 0x0e17,
  35137. "thothanthai",
  35138. 0x0e10,
  35139. "thothongthai",
  35140. 0x0e18,
  35141. "thothungthai",
  35142. 0x0e16,
  35143. "thousandcyrillic",
  35144. 0x0482,
  35145. "thousandsseparatorarabic",
  35146. 0x066c,
  35147. "thousandsseparatorpersian",
  35148. 0x066c,
  35149. "three",
  35150. 0x0033,
  35151. "threearabic",
  35152. 0x0663,
  35153. "threebengali",
  35154. 0x09e9,
  35155. "threecircle",
  35156. 0x2462,
  35157. "threecircleinversesansserif",
  35158. 0x278c,
  35159. "threedeva",
  35160. 0x0969,
  35161. "threeeighths",
  35162. 0x215c,
  35163. "threegujarati",
  35164. 0x0ae9,
  35165. "threegurmukhi",
  35166. 0x0a69,
  35167. "threehackarabic",
  35168. 0x0663,
  35169. "threehangzhou",
  35170. 0x3023,
  35171. "threeideographicparen",
  35172. 0x3222,
  35173. "threeinferior",
  35174. 0x2083,
  35175. "threemonospace",
  35176. 0xff13,
  35177. "threenumeratorbengali",
  35178. 0x09f6,
  35179. "threeoldstyle",
  35180. 0xf733,
  35181. "threeparen",
  35182. 0x2476,
  35183. "threeperiod",
  35184. 0x248a,
  35185. "threepersian",
  35186. 0x06f3,
  35187. "threequarters",
  35188. 0x00be,
  35189. "threequartersemdash",
  35190. 0xf6de,
  35191. "threeroman",
  35192. 0x2172,
  35193. "threesuperior",
  35194. 0x00b3,
  35195. "threethai",
  35196. 0x0e53,
  35197. "thzsquare",
  35198. 0x3394,
  35199. "tihiragana",
  35200. 0x3061,
  35201. "tikatakana",
  35202. 0x30c1,
  35203. "tikatakanahalfwidth",
  35204. 0xff81,
  35205. "tikeutacirclekorean",
  35206. 0x3270,
  35207. "tikeutaparenkorean",
  35208. 0x3210,
  35209. "tikeutcirclekorean",
  35210. 0x3262,
  35211. "tikeutkorean",
  35212. 0x3137,
  35213. "tikeutparenkorean",
  35214. 0x3202,
  35215. "tilde",
  35216. 0x02dc,
  35217. "tildebelowcmb",
  35218. 0x0330,
  35219. "tildecmb",
  35220. 0x0303,
  35221. "tildecomb",
  35222. 0x0303,
  35223. "tildedoublecmb",
  35224. 0x0360,
  35225. "tildeoperator",
  35226. 0x223c,
  35227. "tildeoverlaycmb",
  35228. 0x0334,
  35229. "tildeverticalcmb",
  35230. 0x033e,
  35231. "timescircle",
  35232. 0x2297,
  35233. "tipehahebrew",
  35234. 0x0596,
  35235. "tipehalefthebrew",
  35236. 0x0596,
  35237. "tippigurmukhi",
  35238. 0x0a70,
  35239. "titlocyrilliccmb",
  35240. 0x0483,
  35241. "tiwnarmenian",
  35242. 0x057f,
  35243. "tlinebelow",
  35244. 0x1e6f,
  35245. "tmonospace",
  35246. 0xff54,
  35247. "toarmenian",
  35248. 0x0569,
  35249. "tohiragana",
  35250. 0x3068,
  35251. "tokatakana",
  35252. 0x30c8,
  35253. "tokatakanahalfwidth",
  35254. 0xff84,
  35255. "tonebarextrahighmod",
  35256. 0x02e5,
  35257. "tonebarextralowmod",
  35258. 0x02e9,
  35259. "tonebarhighmod",
  35260. 0x02e6,
  35261. "tonebarlowmod",
  35262. 0x02e8,
  35263. "tonebarmidmod",
  35264. 0x02e7,
  35265. "tonefive",
  35266. 0x01bd,
  35267. "tonesix",
  35268. 0x0185,
  35269. "tonetwo",
  35270. 0x01a8,
  35271. "tonos",
  35272. 0x0384,
  35273. "tonsquare",
  35274. 0x3327,
  35275. "topatakthai",
  35276. 0x0e0f,
  35277. "tortoiseshellbracketleft",
  35278. 0x3014,
  35279. "tortoiseshellbracketleftsmall",
  35280. 0xfe5d,
  35281. "tortoiseshellbracketleftvertical",
  35282. 0xfe39,
  35283. "tortoiseshellbracketright",
  35284. 0x3015,
  35285. "tortoiseshellbracketrightsmall",
  35286. 0xfe5e,
  35287. "tortoiseshellbracketrightvertical",
  35288. 0xfe3a,
  35289. "totaothai",
  35290. 0x0e15,
  35291. "tpalatalhook",
  35292. 0x01ab,
  35293. "tparen",
  35294. 0x24af,
  35295. "trademark",
  35296. 0x2122,
  35297. "trademarksans",
  35298. 0xf8ea,
  35299. "trademarkserif",
  35300. 0xf6db,
  35301. "tretroflexhook",
  35302. 0x0288,
  35303. "triagdn",
  35304. 0x25bc,
  35305. "triaglf",
  35306. 0x25c4,
  35307. "triagrt",
  35308. 0x25ba,
  35309. "triagup",
  35310. 0x25b2,
  35311. "ts",
  35312. 0x02a6,
  35313. "tsadi",
  35314. 0x05e6,
  35315. "tsadidagesh",
  35316. 0xfb46,
  35317. "tsadidageshhebrew",
  35318. 0xfb46,
  35319. "tsadihebrew",
  35320. 0x05e6,
  35321. "tsecyrillic",
  35322. 0x0446,
  35323. "tsere",
  35324. 0x05b5,
  35325. "tsere12",
  35326. 0x05b5,
  35327. "tsere1e",
  35328. 0x05b5,
  35329. "tsere2b",
  35330. 0x05b5,
  35331. "tserehebrew",
  35332. 0x05b5,
  35333. "tserenarrowhebrew",
  35334. 0x05b5,
  35335. "tserequarterhebrew",
  35336. 0x05b5,
  35337. "tserewidehebrew",
  35338. 0x05b5,
  35339. "tshecyrillic",
  35340. 0x045b,
  35341. "tsuperior",
  35342. 0xf6f3,
  35343. "ttabengali",
  35344. 0x099f,
  35345. "ttadeva",
  35346. 0x091f,
  35347. "ttagujarati",
  35348. 0x0a9f,
  35349. "ttagurmukhi",
  35350. 0x0a1f,
  35351. "tteharabic",
  35352. 0x0679,
  35353. "ttehfinalarabic",
  35354. 0xfb67,
  35355. "ttehinitialarabic",
  35356. 0xfb68,
  35357. "ttehmedialarabic",
  35358. 0xfb69,
  35359. "tthabengali",
  35360. 0x09a0,
  35361. "tthadeva",
  35362. 0x0920,
  35363. "tthagujarati",
  35364. 0x0aa0,
  35365. "tthagurmukhi",
  35366. 0x0a20,
  35367. "tturned",
  35368. 0x0287,
  35369. "tuhiragana",
  35370. 0x3064,
  35371. "tukatakana",
  35372. 0x30c4,
  35373. "tukatakanahalfwidth",
  35374. 0xff82,
  35375. "tusmallhiragana",
  35376. 0x3063,
  35377. "tusmallkatakana",
  35378. 0x30c3,
  35379. "tusmallkatakanahalfwidth",
  35380. 0xff6f,
  35381. "twelvecircle",
  35382. 0x246b,
  35383. "twelveparen",
  35384. 0x247f,
  35385. "twelveperiod",
  35386. 0x2493,
  35387. "twelveroman",
  35388. 0x217b,
  35389. "twentycircle",
  35390. 0x2473,
  35391. "twentyhangzhou",
  35392. 0x5344,
  35393. "twentyparen",
  35394. 0x2487,
  35395. "twentyperiod",
  35396. 0x249b,
  35397. "two",
  35398. 0x0032,
  35399. "twoarabic",
  35400. 0x0662,
  35401. "twobengali",
  35402. 0x09e8,
  35403. "twocircle",
  35404. 0x2461,
  35405. "twocircleinversesansserif",
  35406. 0x278b,
  35407. "twodeva",
  35408. 0x0968,
  35409. "twodotenleader",
  35410. 0x2025,
  35411. "twodotleader",
  35412. 0x2025,
  35413. "twodotleadervertical",
  35414. 0xfe30,
  35415. "twogujarati",
  35416. 0x0ae8,
  35417. "twogurmukhi",
  35418. 0x0a68,
  35419. "twohackarabic",
  35420. 0x0662,
  35421. "twohangzhou",
  35422. 0x3022,
  35423. "twoideographicparen",
  35424. 0x3221,
  35425. "twoinferior",
  35426. 0x2082,
  35427. "twomonospace",
  35428. 0xff12,
  35429. "twonumeratorbengali",
  35430. 0x09f5,
  35431. "twooldstyle",
  35432. 0xf732,
  35433. "twoparen",
  35434. 0x2475,
  35435. "twoperiod",
  35436. 0x2489,
  35437. "twopersian",
  35438. 0x06f2,
  35439. "tworoman",
  35440. 0x2171,
  35441. "twostroke",
  35442. 0x01bb,
  35443. "twosuperior",
  35444. 0x00b2,
  35445. "twothai",
  35446. 0x0e52,
  35447. "twothirds",
  35448. 0x2154,
  35449. "u",
  35450. 0x0075,
  35451. "uacute",
  35452. 0x00fa,
  35453. "ubar",
  35454. 0x0289,
  35455. "ubengali",
  35456. 0x0989,
  35457. "ubopomofo",
  35458. 0x3128,
  35459. "ubreve",
  35460. 0x016d,
  35461. "ucaron",
  35462. 0x01d4,
  35463. "ucircle",
  35464. 0x24e4,
  35465. "ucircumflex",
  35466. 0x00fb,
  35467. "ucircumflexbelow",
  35468. 0x1e77,
  35469. "ucyrillic",
  35470. 0x0443,
  35471. "udattadeva",
  35472. 0x0951,
  35473. "udblacute",
  35474. 0x0171,
  35475. "udblgrave",
  35476. 0x0215,
  35477. "udeva",
  35478. 0x0909,
  35479. "udieresis",
  35480. 0x00fc,
  35481. "udieresisacute",
  35482. 0x01d8,
  35483. "udieresisbelow",
  35484. 0x1e73,
  35485. "udieresiscaron",
  35486. 0x01da,
  35487. "udieresiscyrillic",
  35488. 0x04f1,
  35489. "udieresisgrave",
  35490. 0x01dc,
  35491. "udieresismacron",
  35492. 0x01d6,
  35493. "udotbelow",
  35494. 0x1ee5,
  35495. "ugrave",
  35496. 0x00f9,
  35497. "ugujarati",
  35498. 0x0a89,
  35499. "ugurmukhi",
  35500. 0x0a09,
  35501. "uhiragana",
  35502. 0x3046,
  35503. "uhookabove",
  35504. 0x1ee7,
  35505. "uhorn",
  35506. 0x01b0,
  35507. "uhornacute",
  35508. 0x1ee9,
  35509. "uhorndotbelow",
  35510. 0x1ef1,
  35511. "uhorngrave",
  35512. 0x1eeb,
  35513. "uhornhookabove",
  35514. 0x1eed,
  35515. "uhorntilde",
  35516. 0x1eef,
  35517. "uhungarumlaut",
  35518. 0x0171,
  35519. "uhungarumlautcyrillic",
  35520. 0x04f3,
  35521. "uinvertedbreve",
  35522. 0x0217,
  35523. "ukatakana",
  35524. 0x30a6,
  35525. "ukatakanahalfwidth",
  35526. 0xff73,
  35527. "ukcyrillic",
  35528. 0x0479,
  35529. "ukorean",
  35530. 0x315c,
  35531. "umacron",
  35532. 0x016b,
  35533. "umacroncyrillic",
  35534. 0x04ef,
  35535. "umacrondieresis",
  35536. 0x1e7b,
  35537. "umatragurmukhi",
  35538. 0x0a41,
  35539. "umonospace",
  35540. 0xff55,
  35541. "underscore",
  35542. 0x005f,
  35543. "underscoredbl",
  35544. 0x2017,
  35545. "underscoremonospace",
  35546. 0xff3f,
  35547. "underscorevertical",
  35548. 0xfe33,
  35549. "underscorewavy",
  35550. 0xfe4f,
  35551. "union",
  35552. 0x222a,
  35553. "universal",
  35554. 0x2200,
  35555. "uogonek",
  35556. 0x0173,
  35557. "uparen",
  35558. 0x24b0,
  35559. "upblock",
  35560. 0x2580,
  35561. "upperdothebrew",
  35562. 0x05c4,
  35563. "upsilon",
  35564. 0x03c5,
  35565. "upsilondieresis",
  35566. 0x03cb,
  35567. "upsilondieresistonos",
  35568. 0x03b0,
  35569. "upsilonlatin",
  35570. 0x028a,
  35571. "upsilontonos",
  35572. 0x03cd,
  35573. "uptackbelowcmb",
  35574. 0x031d,
  35575. "uptackmod",
  35576. 0x02d4,
  35577. "uragurmukhi",
  35578. 0x0a73,
  35579. "uring",
  35580. 0x016f,
  35581. "ushortcyrillic",
  35582. 0x045e,
  35583. "usmallhiragana",
  35584. 0x3045,
  35585. "usmallkatakana",
  35586. 0x30a5,
  35587. "usmallkatakanahalfwidth",
  35588. 0xff69,
  35589. "ustraightcyrillic",
  35590. 0x04af,
  35591. "ustraightstrokecyrillic",
  35592. 0x04b1,
  35593. "utilde",
  35594. 0x0169,
  35595. "utildeacute",
  35596. 0x1e79,
  35597. "utildebelow",
  35598. 0x1e75,
  35599. "uubengali",
  35600. 0x098a,
  35601. "uudeva",
  35602. 0x090a,
  35603. "uugujarati",
  35604. 0x0a8a,
  35605. "uugurmukhi",
  35606. 0x0a0a,
  35607. "uumatragurmukhi",
  35608. 0x0a42,
  35609. "uuvowelsignbengali",
  35610. 0x09c2,
  35611. "uuvowelsigndeva",
  35612. 0x0942,
  35613. "uuvowelsigngujarati",
  35614. 0x0ac2,
  35615. "uvowelsignbengali",
  35616. 0x09c1,
  35617. "uvowelsigndeva",
  35618. 0x0941,
  35619. "uvowelsigngujarati",
  35620. 0x0ac1,
  35621. "v",
  35622. 0x0076,
  35623. "vadeva",
  35624. 0x0935,
  35625. "vagujarati",
  35626. 0x0ab5,
  35627. "vagurmukhi",
  35628. 0x0a35,
  35629. "vakatakana",
  35630. 0x30f7,
  35631. "vav",
  35632. 0x05d5,
  35633. "vavdagesh",
  35634. 0xfb35,
  35635. "vavdagesh65",
  35636. 0xfb35,
  35637. "vavdageshhebrew",
  35638. 0xfb35,
  35639. "vavhebrew",
  35640. 0x05d5,
  35641. "vavholam",
  35642. 0xfb4b,
  35643. "vavholamhebrew",
  35644. 0xfb4b,
  35645. "vavvavhebrew",
  35646. 0x05f0,
  35647. "vavyodhebrew",
  35648. 0x05f1,
  35649. "vcircle",
  35650. 0x24e5,
  35651. "vdotbelow",
  35652. 0x1e7f,
  35653. "vecyrillic",
  35654. 0x0432,
  35655. "veharabic",
  35656. 0x06a4,
  35657. "vehfinalarabic",
  35658. 0xfb6b,
  35659. "vehinitialarabic",
  35660. 0xfb6c,
  35661. "vehmedialarabic",
  35662. 0xfb6d,
  35663. "vekatakana",
  35664. 0x30f9,
  35665. "venus",
  35666. 0x2640,
  35667. "verticalbar",
  35668. 0x007c,
  35669. "verticallineabovecmb",
  35670. 0x030d,
  35671. "verticallinebelowcmb",
  35672. 0x0329,
  35673. "verticallinelowmod",
  35674. 0x02cc,
  35675. "verticallinemod",
  35676. 0x02c8,
  35677. "vewarmenian",
  35678. 0x057e,
  35679. "vhook",
  35680. 0x028b,
  35681. "vikatakana",
  35682. 0x30f8,
  35683. "viramabengali",
  35684. 0x09cd,
  35685. "viramadeva",
  35686. 0x094d,
  35687. "viramagujarati",
  35688. 0x0acd,
  35689. "visargabengali",
  35690. 0x0983,
  35691. "visargadeva",
  35692. 0x0903,
  35693. "visargagujarati",
  35694. 0x0a83,
  35695. "vmonospace",
  35696. 0xff56,
  35697. "voarmenian",
  35698. 0x0578,
  35699. "voicediterationhiragana",
  35700. 0x309e,
  35701. "voicediterationkatakana",
  35702. 0x30fe,
  35703. "voicedmarkkana",
  35704. 0x309b,
  35705. "voicedmarkkanahalfwidth",
  35706. 0xff9e,
  35707. "vokatakana",
  35708. 0x30fa,
  35709. "vparen",
  35710. 0x24b1,
  35711. "vtilde",
  35712. 0x1e7d,
  35713. "vturned",
  35714. 0x028c,
  35715. "vuhiragana",
  35716. 0x3094,
  35717. "vukatakana",
  35718. 0x30f4,
  35719. "w",
  35720. 0x0077,
  35721. "wacute",
  35722. 0x1e83,
  35723. "waekorean",
  35724. 0x3159,
  35725. "wahiragana",
  35726. 0x308f,
  35727. "wakatakana",
  35728. 0x30ef,
  35729. "wakatakanahalfwidth",
  35730. 0xff9c,
  35731. "wakorean",
  35732. 0x3158,
  35733. "wasmallhiragana",
  35734. 0x308e,
  35735. "wasmallkatakana",
  35736. 0x30ee,
  35737. "wattosquare",
  35738. 0x3357,
  35739. "wavedash",
  35740. 0x301c,
  35741. "wavyunderscorevertical",
  35742. 0xfe34,
  35743. "wawarabic",
  35744. 0x0648,
  35745. "wawfinalarabic",
  35746. 0xfeee,
  35747. "wawhamzaabovearabic",
  35748. 0x0624,
  35749. "wawhamzaabovefinalarabic",
  35750. 0xfe86,
  35751. "wbsquare",
  35752. 0x33dd,
  35753. "wcircle",
  35754. 0x24e6,
  35755. "wcircumflex",
  35756. 0x0175,
  35757. "wdieresis",
  35758. 0x1e85,
  35759. "wdotaccent",
  35760. 0x1e87,
  35761. "wdotbelow",
  35762. 0x1e89,
  35763. "wehiragana",
  35764. 0x3091,
  35765. "weierstrass",
  35766. 0x2118,
  35767. "wekatakana",
  35768. 0x30f1,
  35769. "wekorean",
  35770. 0x315e,
  35771. "weokorean",
  35772. 0x315d,
  35773. "wgrave",
  35774. 0x1e81,
  35775. "whitebullet",
  35776. 0x25e6,
  35777. "whitecircle",
  35778. 0x25cb,
  35779. "whitecircleinverse",
  35780. 0x25d9,
  35781. "whitecornerbracketleft",
  35782. 0x300e,
  35783. "whitecornerbracketleftvertical",
  35784. 0xfe43,
  35785. "whitecornerbracketright",
  35786. 0x300f,
  35787. "whitecornerbracketrightvertical",
  35788. 0xfe44,
  35789. "whitediamond",
  35790. 0x25c7,
  35791. "whitediamondcontainingblacksmalldiamond",
  35792. 0x25c8,
  35793. "whitedownpointingsmalltriangle",
  35794. 0x25bf,
  35795. "whitedownpointingtriangle",
  35796. 0x25bd,
  35797. "whiteleftpointingsmalltriangle",
  35798. 0x25c3,
  35799. "whiteleftpointingtriangle",
  35800. 0x25c1,
  35801. "whitelenticularbracketleft",
  35802. 0x3016,
  35803. "whitelenticularbracketright",
  35804. 0x3017,
  35805. "whiterightpointingsmalltriangle",
  35806. 0x25b9,
  35807. "whiterightpointingtriangle",
  35808. 0x25b7,
  35809. "whitesmallsquare",
  35810. 0x25ab,
  35811. "whitesmilingface",
  35812. 0x263a,
  35813. "whitesquare",
  35814. 0x25a1,
  35815. "whitestar",
  35816. 0x2606,
  35817. "whitetelephone",
  35818. 0x260f,
  35819. "whitetortoiseshellbracketleft",
  35820. 0x3018,
  35821. "whitetortoiseshellbracketright",
  35822. 0x3019,
  35823. "whiteuppointingsmalltriangle",
  35824. 0x25b5,
  35825. "whiteuppointingtriangle",
  35826. 0x25b3,
  35827. "wihiragana",
  35828. 0x3090,
  35829. "wikatakana",
  35830. 0x30f0,
  35831. "wikorean",
  35832. 0x315f,
  35833. "wmonospace",
  35834. 0xff57,
  35835. "wohiragana",
  35836. 0x3092,
  35837. "wokatakana",
  35838. 0x30f2,
  35839. "wokatakanahalfwidth",
  35840. 0xff66,
  35841. "won",
  35842. 0x20a9,
  35843. "wonmonospace",
  35844. 0xffe6,
  35845. "wowaenthai",
  35846. 0x0e27,
  35847. "wparen",
  35848. 0x24b2,
  35849. "wring",
  35850. 0x1e98,
  35851. "wsuperior",
  35852. 0x02b7,
  35853. "wturned",
  35854. 0x028d,
  35855. "wynn",
  35856. 0x01bf,
  35857. "x",
  35858. 0x0078,
  35859. "xabovecmb",
  35860. 0x033d,
  35861. "xbopomofo",
  35862. 0x3112,
  35863. "xcircle",
  35864. 0x24e7,
  35865. "xdieresis",
  35866. 0x1e8d,
  35867. "xdotaccent",
  35868. 0x1e8b,
  35869. "xeharmenian",
  35870. 0x056d,
  35871. "xi",
  35872. 0x03be,
  35873. "xmonospace",
  35874. 0xff58,
  35875. "xparen",
  35876. 0x24b3,
  35877. "xsuperior",
  35878. 0x02e3,
  35879. "y",
  35880. 0x0079,
  35881. "yaadosquare",
  35882. 0x334e,
  35883. "yabengali",
  35884. 0x09af,
  35885. "yacute",
  35886. 0x00fd,
  35887. "yadeva",
  35888. 0x092f,
  35889. "yaekorean",
  35890. 0x3152,
  35891. "yagujarati",
  35892. 0x0aaf,
  35893. "yagurmukhi",
  35894. 0x0a2f,
  35895. "yahiragana",
  35896. 0x3084,
  35897. "yakatakana",
  35898. 0x30e4,
  35899. "yakatakanahalfwidth",
  35900. 0xff94,
  35901. "yakorean",
  35902. 0x3151,
  35903. "yamakkanthai",
  35904. 0x0e4e,
  35905. "yasmallhiragana",
  35906. 0x3083,
  35907. "yasmallkatakana",
  35908. 0x30e3,
  35909. "yasmallkatakanahalfwidth",
  35910. 0xff6c,
  35911. "yatcyrillic",
  35912. 0x0463,
  35913. "ycircle",
  35914. 0x24e8,
  35915. "ycircumflex",
  35916. 0x0177,
  35917. "ydieresis",
  35918. 0x00ff,
  35919. "ydotaccent",
  35920. 0x1e8f,
  35921. "ydotbelow",
  35922. 0x1ef5,
  35923. "yeharabic",
  35924. 0x064a,
  35925. "yehbarreearabic",
  35926. 0x06d2,
  35927. "yehbarreefinalarabic",
  35928. 0xfbaf,
  35929. "yehfinalarabic",
  35930. 0xfef2,
  35931. "yehhamzaabovearabic",
  35932. 0x0626,
  35933. "yehhamzaabovefinalarabic",
  35934. 0xfe8a,
  35935. "yehhamzaaboveinitialarabic",
  35936. 0xfe8b,
  35937. "yehhamzaabovemedialarabic",
  35938. 0xfe8c,
  35939. "yehinitialarabic",
  35940. 0xfef3,
  35941. "yehmedialarabic",
  35942. 0xfef4,
  35943. "yehmeeminitialarabic",
  35944. 0xfcdd,
  35945. "yehmeemisolatedarabic",
  35946. 0xfc58,
  35947. "yehnoonfinalarabic",
  35948. 0xfc94,
  35949. "yehthreedotsbelowarabic",
  35950. 0x06d1,
  35951. "yekorean",
  35952. 0x3156,
  35953. "yen",
  35954. 0x00a5,
  35955. "yenmonospace",
  35956. 0xffe5,
  35957. "yeokorean",
  35958. 0x3155,
  35959. "yeorinhieuhkorean",
  35960. 0x3186,
  35961. "yerahbenyomohebrew",
  35962. 0x05aa,
  35963. "yerahbenyomolefthebrew",
  35964. 0x05aa,
  35965. "yericyrillic",
  35966. 0x044b,
  35967. "yerudieresiscyrillic",
  35968. 0x04f9,
  35969. "yesieungkorean",
  35970. 0x3181,
  35971. "yesieungpansioskorean",
  35972. 0x3183,
  35973. "yesieungsioskorean",
  35974. 0x3182,
  35975. "yetivhebrew",
  35976. 0x059a,
  35977. "ygrave",
  35978. 0x1ef3,
  35979. "yhook",
  35980. 0x01b4,
  35981. "yhookabove",
  35982. 0x1ef7,
  35983. "yiarmenian",
  35984. 0x0575,
  35985. "yicyrillic",
  35986. 0x0457,
  35987. "yikorean",
  35988. 0x3162,
  35989. "yinyang",
  35990. 0x262f,
  35991. "yiwnarmenian",
  35992. 0x0582,
  35993. "ymonospace",
  35994. 0xff59,
  35995. "yod",
  35996. 0x05d9,
  35997. "yoddagesh",
  35998. 0xfb39,
  35999. "yoddageshhebrew",
  36000. 0xfb39,
  36001. "yodhebrew",
  36002. 0x05d9,
  36003. "yodyodhebrew",
  36004. 0x05f2,
  36005. "yodyodpatahhebrew",
  36006. 0xfb1f,
  36007. "yohiragana",
  36008. 0x3088,
  36009. "yoikorean",
  36010. 0x3189,
  36011. "yokatakana",
  36012. 0x30e8,
  36013. "yokatakanahalfwidth",
  36014. 0xff96,
  36015. "yokorean",
  36016. 0x315b,
  36017. "yosmallhiragana",
  36018. 0x3087,
  36019. "yosmallkatakana",
  36020. 0x30e7,
  36021. "yosmallkatakanahalfwidth",
  36022. 0xff6e,
  36023. "yotgreek",
  36024. 0x03f3,
  36025. "yoyaekorean",
  36026. 0x3188,
  36027. "yoyakorean",
  36028. 0x3187,
  36029. "yoyakthai",
  36030. 0x0e22,
  36031. "yoyingthai",
  36032. 0x0e0d,
  36033. "yparen",
  36034. 0x24b4,
  36035. "ypogegrammeni",
  36036. 0x037a,
  36037. "ypogegrammenigreekcmb",
  36038. 0x0345,
  36039. "yr",
  36040. 0x01a6,
  36041. "yring",
  36042. 0x1e99,
  36043. "ysuperior",
  36044. 0x02b8,
  36045. "ytilde",
  36046. 0x1ef9,
  36047. "yturned",
  36048. 0x028e,
  36049. "yuhiragana",
  36050. 0x3086,
  36051. "yuikorean",
  36052. 0x318c,
  36053. "yukatakana",
  36054. 0x30e6,
  36055. "yukatakanahalfwidth",
  36056. 0xff95,
  36057. "yukorean",
  36058. 0x3160,
  36059. "yusbigcyrillic",
  36060. 0x046b,
  36061. "yusbigiotifiedcyrillic",
  36062. 0x046d,
  36063. "yuslittlecyrillic",
  36064. 0x0467,
  36065. "yuslittleiotifiedcyrillic",
  36066. 0x0469,
  36067. "yusmallhiragana",
  36068. 0x3085,
  36069. "yusmallkatakana",
  36070. 0x30e5,
  36071. "yusmallkatakanahalfwidth",
  36072. 0xff6d,
  36073. "yuyekorean",
  36074. 0x318b,
  36075. "yuyeokorean",
  36076. 0x318a,
  36077. "yyabengali",
  36078. 0x09df,
  36079. "yyadeva",
  36080. 0x095f,
  36081. "z",
  36082. 0x007a,
  36083. "zaarmenian",
  36084. 0x0566,
  36085. "zacute",
  36086. 0x017a,
  36087. "zadeva",
  36088. 0x095b,
  36089. "zagurmukhi",
  36090. 0x0a5b,
  36091. "zaharabic",
  36092. 0x0638,
  36093. "zahfinalarabic",
  36094. 0xfec6,
  36095. "zahinitialarabic",
  36096. 0xfec7,
  36097. "zahiragana",
  36098. 0x3056,
  36099. "zahmedialarabic",
  36100. 0xfec8,
  36101. "zainarabic",
  36102. 0x0632,
  36103. "zainfinalarabic",
  36104. 0xfeb0,
  36105. "zakatakana",
  36106. 0x30b6,
  36107. "zaqefgadolhebrew",
  36108. 0x0595,
  36109. "zaqefqatanhebrew",
  36110. 0x0594,
  36111. "zarqahebrew",
  36112. 0x0598,
  36113. "zayin",
  36114. 0x05d6,
  36115. "zayindagesh",
  36116. 0xfb36,
  36117. "zayindageshhebrew",
  36118. 0xfb36,
  36119. "zayinhebrew",
  36120. 0x05d6,
  36121. "zbopomofo",
  36122. 0x3117,
  36123. "zcaron",
  36124. 0x017e,
  36125. "zcircle",
  36126. 0x24e9,
  36127. "zcircumflex",
  36128. 0x1e91,
  36129. "zcurl",
  36130. 0x0291,
  36131. "zdot",
  36132. 0x017c,
  36133. "zdotaccent",
  36134. 0x017c,
  36135. "zdotbelow",
  36136. 0x1e93,
  36137. "zecyrillic",
  36138. 0x0437,
  36139. "zedescendercyrillic",
  36140. 0x0499,
  36141. "zedieresiscyrillic",
  36142. 0x04df,
  36143. "zehiragana",
  36144. 0x305c,
  36145. "zekatakana",
  36146. 0x30bc,
  36147. "zero",
  36148. 0x0030,
  36149. "zeroarabic",
  36150. 0x0660,
  36151. "zerobengali",
  36152. 0x09e6,
  36153. "zerodeva",
  36154. 0x0966,
  36155. "zerogujarati",
  36156. 0x0ae6,
  36157. "zerogurmukhi",
  36158. 0x0a66,
  36159. "zerohackarabic",
  36160. 0x0660,
  36161. "zeroinferior",
  36162. 0x2080,
  36163. "zeromonospace",
  36164. 0xff10,
  36165. "zerooldstyle",
  36166. 0xf730,
  36167. "zeropersian",
  36168. 0x06f0,
  36169. "zerosuperior",
  36170. 0x2070,
  36171. "zerothai",
  36172. 0x0e50,
  36173. "zerowidthjoiner",
  36174. 0xfeff,
  36175. "zerowidthnonjoiner",
  36176. 0x200c,
  36177. "zerowidthspace",
  36178. 0x200b,
  36179. "zeta",
  36180. 0x03b6,
  36181. "zhbopomofo",
  36182. 0x3113,
  36183. "zhearmenian",
  36184. 0x056a,
  36185. "zhebrevecyrillic",
  36186. 0x04c2,
  36187. "zhecyrillic",
  36188. 0x0436,
  36189. "zhedescendercyrillic",
  36190. 0x0497,
  36191. "zhedieresiscyrillic",
  36192. 0x04dd,
  36193. "zihiragana",
  36194. 0x3058,
  36195. "zikatakana",
  36196. 0x30b8,
  36197. "zinorhebrew",
  36198. 0x05ae,
  36199. "zlinebelow",
  36200. 0x1e95,
  36201. "zmonospace",
  36202. 0xff5a,
  36203. "zohiragana",
  36204. 0x305e,
  36205. "zokatakana",
  36206. 0x30be,
  36207. "zparen",
  36208. 0x24b5,
  36209. "zretroflexhook",
  36210. 0x0290,
  36211. "zstroke",
  36212. 0x01b6,
  36213. "zuhiragana",
  36214. 0x305a,
  36215. "zukatakana",
  36216. 0x30ba,
  36217. ".notdef",
  36218. 0x0000,
  36219. "angbracketleftbig",
  36220. 0x2329,
  36221. "angbracketleftBig",
  36222. 0x2329,
  36223. "angbracketleftbigg",
  36224. 0x2329,
  36225. "angbracketleftBigg",
  36226. 0x2329,
  36227. "angbracketrightBig",
  36228. 0x232a,
  36229. "angbracketrightbig",
  36230. 0x232a,
  36231. "angbracketrightBigg",
  36232. 0x232a,
  36233. "angbracketrightbigg",
  36234. 0x232a,
  36235. "arrowhookleft",
  36236. 0x21aa,
  36237. "arrowhookright",
  36238. 0x21a9,
  36239. "arrowlefttophalf",
  36240. 0x21bc,
  36241. "arrowleftbothalf",
  36242. 0x21bd,
  36243. "arrownortheast",
  36244. 0x2197,
  36245. "arrownorthwest",
  36246. 0x2196,
  36247. "arrowrighttophalf",
  36248. 0x21c0,
  36249. "arrowrightbothalf",
  36250. 0x21c1,
  36251. "arrowsoutheast",
  36252. 0x2198,
  36253. "arrowsouthwest",
  36254. 0x2199,
  36255. "backslashbig",
  36256. 0x2216,
  36257. "backslashBig",
  36258. 0x2216,
  36259. "backslashBigg",
  36260. 0x2216,
  36261. "backslashbigg",
  36262. 0x2216,
  36263. "bardbl",
  36264. 0x2016,
  36265. "bracehtipdownleft",
  36266. 0xfe37,
  36267. "bracehtipdownright",
  36268. 0xfe37,
  36269. "bracehtipupleft",
  36270. 0xfe38,
  36271. "bracehtipupright",
  36272. 0xfe38,
  36273. "braceleftBig",
  36274. 0x007b,
  36275. "braceleftbig",
  36276. 0x007b,
  36277. "braceleftbigg",
  36278. 0x007b,
  36279. "braceleftBigg",
  36280. 0x007b,
  36281. "bracerightBig",
  36282. 0x007d,
  36283. "bracerightbig",
  36284. 0x007d,
  36285. "bracerightbigg",
  36286. 0x007d,
  36287. "bracerightBigg",
  36288. 0x007d,
  36289. "bracketleftbig",
  36290. 0x005b,
  36291. "bracketleftBig",
  36292. 0x005b,
  36293. "bracketleftbigg",
  36294. 0x005b,
  36295. "bracketleftBigg",
  36296. 0x005b,
  36297. "bracketrightBig",
  36298. 0x005d,
  36299. "bracketrightbig",
  36300. 0x005d,
  36301. "bracketrightbigg",
  36302. 0x005d,
  36303. "bracketrightBigg",
  36304. 0x005d,
  36305. "ceilingleftbig",
  36306. 0x2308,
  36307. "ceilingleftBig",
  36308. 0x2308,
  36309. "ceilingleftBigg",
  36310. 0x2308,
  36311. "ceilingleftbigg",
  36312. 0x2308,
  36313. "ceilingrightbig",
  36314. 0x2309,
  36315. "ceilingrightBig",
  36316. 0x2309,
  36317. "ceilingrightbigg",
  36318. 0x2309,
  36319. "ceilingrightBigg",
  36320. 0x2309,
  36321. "circledotdisplay",
  36322. 0x2299,
  36323. "circledottext",
  36324. 0x2299,
  36325. "circlemultiplydisplay",
  36326. 0x2297,
  36327. "circlemultiplytext",
  36328. 0x2297,
  36329. "circleplusdisplay",
  36330. 0x2295,
  36331. "circleplustext",
  36332. 0x2295,
  36333. "contintegraldisplay",
  36334. 0x222e,
  36335. "contintegraltext",
  36336. 0x222e,
  36337. "coproductdisplay",
  36338. 0x2210,
  36339. "coproducttext",
  36340. 0x2210,
  36341. "floorleftBig",
  36342. 0x230a,
  36343. "floorleftbig",
  36344. 0x230a,
  36345. "floorleftbigg",
  36346. 0x230a,
  36347. "floorleftBigg",
  36348. 0x230a,
  36349. "floorrightbig",
  36350. 0x230b,
  36351. "floorrightBig",
  36352. 0x230b,
  36353. "floorrightBigg",
  36354. 0x230b,
  36355. "floorrightbigg",
  36356. 0x230b,
  36357. "hatwide",
  36358. 0x0302,
  36359. "hatwider",
  36360. 0x0302,
  36361. "hatwidest",
  36362. 0x0302,
  36363. "intercal",
  36364. 0x1d40,
  36365. "integraldisplay",
  36366. 0x222b,
  36367. "integraltext",
  36368. 0x222b,
  36369. "intersectiondisplay",
  36370. 0x22c2,
  36371. "intersectiontext",
  36372. 0x22c2,
  36373. "logicalanddisplay",
  36374. 0x2227,
  36375. "logicalandtext",
  36376. 0x2227,
  36377. "logicalordisplay",
  36378. 0x2228,
  36379. "logicalortext",
  36380. 0x2228,
  36381. "parenleftBig",
  36382. 0x0028,
  36383. "parenleftbig",
  36384. 0x0028,
  36385. "parenleftBigg",
  36386. 0x0028,
  36387. "parenleftbigg",
  36388. 0x0028,
  36389. "parenrightBig",
  36390. 0x0029,
  36391. "parenrightbig",
  36392. 0x0029,
  36393. "parenrightBigg",
  36394. 0x0029,
  36395. "parenrightbigg",
  36396. 0x0029,
  36397. "prime",
  36398. 0x2032,
  36399. "productdisplay",
  36400. 0x220f,
  36401. "producttext",
  36402. 0x220f,
  36403. "radicalbig",
  36404. 0x221a,
  36405. "radicalBig",
  36406. 0x221a,
  36407. "radicalBigg",
  36408. 0x221a,
  36409. "radicalbigg",
  36410. 0x221a,
  36411. "radicalbt",
  36412. 0x221a,
  36413. "radicaltp",
  36414. 0x221a,
  36415. "radicalvertex",
  36416. 0x221a,
  36417. "slashbig",
  36418. 0x002f,
  36419. "slashBig",
  36420. 0x002f,
  36421. "slashBigg",
  36422. 0x002f,
  36423. "slashbigg",
  36424. 0x002f,
  36425. "summationdisplay",
  36426. 0x2211,
  36427. "summationtext",
  36428. 0x2211,
  36429. "tildewide",
  36430. 0x02dc,
  36431. "tildewider",
  36432. 0x02dc,
  36433. "tildewidest",
  36434. 0x02dc,
  36435. "uniondisplay",
  36436. 0x22c3,
  36437. "unionmultidisplay",
  36438. 0x228e,
  36439. "unionmultitext",
  36440. 0x228e,
  36441. "unionsqdisplay",
  36442. 0x2294,
  36443. "unionsqtext",
  36444. 0x2294,
  36445. "uniontext",
  36446. 0x22c3,
  36447. "vextenddouble",
  36448. 0x2225,
  36449. "vextendsingle",
  36450. 0x2223
  36451. ];
  36452. });
  36453. const getDingbatsGlyphsUnicode = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getArrayLookupTableFactory)(function () {
  36454. return [
  36455. "space",
  36456. 0x0020,
  36457. "a1",
  36458. 0x2701,
  36459. "a2",
  36460. 0x2702,
  36461. "a202",
  36462. 0x2703,
  36463. "a3",
  36464. 0x2704,
  36465. "a4",
  36466. 0x260e,
  36467. "a5",
  36468. 0x2706,
  36469. "a119",
  36470. 0x2707,
  36471. "a118",
  36472. 0x2708,
  36473. "a117",
  36474. 0x2709,
  36475. "a11",
  36476. 0x261b,
  36477. "a12",
  36478. 0x261e,
  36479. "a13",
  36480. 0x270c,
  36481. "a14",
  36482. 0x270d,
  36483. "a15",
  36484. 0x270e,
  36485. "a16",
  36486. 0x270f,
  36487. "a105",
  36488. 0x2710,
  36489. "a17",
  36490. 0x2711,
  36491. "a18",
  36492. 0x2712,
  36493. "a19",
  36494. 0x2713,
  36495. "a20",
  36496. 0x2714,
  36497. "a21",
  36498. 0x2715,
  36499. "a22",
  36500. 0x2716,
  36501. "a23",
  36502. 0x2717,
  36503. "a24",
  36504. 0x2718,
  36505. "a25",
  36506. 0x2719,
  36507. "a26",
  36508. 0x271a,
  36509. "a27",
  36510. 0x271b,
  36511. "a28",
  36512. 0x271c,
  36513. "a6",
  36514. 0x271d,
  36515. "a7",
  36516. 0x271e,
  36517. "a8",
  36518. 0x271f,
  36519. "a9",
  36520. 0x2720,
  36521. "a10",
  36522. 0x2721,
  36523. "a29",
  36524. 0x2722,
  36525. "a30",
  36526. 0x2723,
  36527. "a31",
  36528. 0x2724,
  36529. "a32",
  36530. 0x2725,
  36531. "a33",
  36532. 0x2726,
  36533. "a34",
  36534. 0x2727,
  36535. "a35",
  36536. 0x2605,
  36537. "a36",
  36538. 0x2729,
  36539. "a37",
  36540. 0x272a,
  36541. "a38",
  36542. 0x272b,
  36543. "a39",
  36544. 0x272c,
  36545. "a40",
  36546. 0x272d,
  36547. "a41",
  36548. 0x272e,
  36549. "a42",
  36550. 0x272f,
  36551. "a43",
  36552. 0x2730,
  36553. "a44",
  36554. 0x2731,
  36555. "a45",
  36556. 0x2732,
  36557. "a46",
  36558. 0x2733,
  36559. "a47",
  36560. 0x2734,
  36561. "a48",
  36562. 0x2735,
  36563. "a49",
  36564. 0x2736,
  36565. "a50",
  36566. 0x2737,
  36567. "a51",
  36568. 0x2738,
  36569. "a52",
  36570. 0x2739,
  36571. "a53",
  36572. 0x273a,
  36573. "a54",
  36574. 0x273b,
  36575. "a55",
  36576. 0x273c,
  36577. "a56",
  36578. 0x273d,
  36579. "a57",
  36580. 0x273e,
  36581. "a58",
  36582. 0x273f,
  36583. "a59",
  36584. 0x2740,
  36585. "a60",
  36586. 0x2741,
  36587. "a61",
  36588. 0x2742,
  36589. "a62",
  36590. 0x2743,
  36591. "a63",
  36592. 0x2744,
  36593. "a64",
  36594. 0x2745,
  36595. "a65",
  36596. 0x2746,
  36597. "a66",
  36598. 0x2747,
  36599. "a67",
  36600. 0x2748,
  36601. "a68",
  36602. 0x2749,
  36603. "a69",
  36604. 0x274a,
  36605. "a70",
  36606. 0x274b,
  36607. "a71",
  36608. 0x25cf,
  36609. "a72",
  36610. 0x274d,
  36611. "a73",
  36612. 0x25a0,
  36613. "a74",
  36614. 0x274f,
  36615. "a203",
  36616. 0x2750,
  36617. "a75",
  36618. 0x2751,
  36619. "a204",
  36620. 0x2752,
  36621. "a76",
  36622. 0x25b2,
  36623. "a77",
  36624. 0x25bc,
  36625. "a78",
  36626. 0x25c6,
  36627. "a79",
  36628. 0x2756,
  36629. "a81",
  36630. 0x25d7,
  36631. "a82",
  36632. 0x2758,
  36633. "a83",
  36634. 0x2759,
  36635. "a84",
  36636. 0x275a,
  36637. "a97",
  36638. 0x275b,
  36639. "a98",
  36640. 0x275c,
  36641. "a99",
  36642. 0x275d,
  36643. "a100",
  36644. 0x275e,
  36645. "a101",
  36646. 0x2761,
  36647. "a102",
  36648. 0x2762,
  36649. "a103",
  36650. 0x2763,
  36651. "a104",
  36652. 0x2764,
  36653. "a106",
  36654. 0x2765,
  36655. "a107",
  36656. 0x2766,
  36657. "a108",
  36658. 0x2767,
  36659. "a112",
  36660. 0x2663,
  36661. "a111",
  36662. 0x2666,
  36663. "a110",
  36664. 0x2665,
  36665. "a109",
  36666. 0x2660,
  36667. "a120",
  36668. 0x2460,
  36669. "a121",
  36670. 0x2461,
  36671. "a122",
  36672. 0x2462,
  36673. "a123",
  36674. 0x2463,
  36675. "a124",
  36676. 0x2464,
  36677. "a125",
  36678. 0x2465,
  36679. "a126",
  36680. 0x2466,
  36681. "a127",
  36682. 0x2467,
  36683. "a128",
  36684. 0x2468,
  36685. "a129",
  36686. 0x2469,
  36687. "a130",
  36688. 0x2776,
  36689. "a131",
  36690. 0x2777,
  36691. "a132",
  36692. 0x2778,
  36693. "a133",
  36694. 0x2779,
  36695. "a134",
  36696. 0x277a,
  36697. "a135",
  36698. 0x277b,
  36699. "a136",
  36700. 0x277c,
  36701. "a137",
  36702. 0x277d,
  36703. "a138",
  36704. 0x277e,
  36705. "a139",
  36706. 0x277f,
  36707. "a140",
  36708. 0x2780,
  36709. "a141",
  36710. 0x2781,
  36711. "a142",
  36712. 0x2782,
  36713. "a143",
  36714. 0x2783,
  36715. "a144",
  36716. 0x2784,
  36717. "a145",
  36718. 0x2785,
  36719. "a146",
  36720. 0x2786,
  36721. "a147",
  36722. 0x2787,
  36723. "a148",
  36724. 0x2788,
  36725. "a149",
  36726. 0x2789,
  36727. "a150",
  36728. 0x278a,
  36729. "a151",
  36730. 0x278b,
  36731. "a152",
  36732. 0x278c,
  36733. "a153",
  36734. 0x278d,
  36735. "a154",
  36736. 0x278e,
  36737. "a155",
  36738. 0x278f,
  36739. "a156",
  36740. 0x2790,
  36741. "a157",
  36742. 0x2791,
  36743. "a158",
  36744. 0x2792,
  36745. "a159",
  36746. 0x2793,
  36747. "a160",
  36748. 0x2794,
  36749. "a161",
  36750. 0x2192,
  36751. "a163",
  36752. 0x2194,
  36753. "a164",
  36754. 0x2195,
  36755. "a196",
  36756. 0x2798,
  36757. "a165",
  36758. 0x2799,
  36759. "a192",
  36760. 0x279a,
  36761. "a166",
  36762. 0x279b,
  36763. "a167",
  36764. 0x279c,
  36765. "a168",
  36766. 0x279d,
  36767. "a169",
  36768. 0x279e,
  36769. "a170",
  36770. 0x279f,
  36771. "a171",
  36772. 0x27a0,
  36773. "a172",
  36774. 0x27a1,
  36775. "a173",
  36776. 0x27a2,
  36777. "a162",
  36778. 0x27a3,
  36779. "a174",
  36780. 0x27a4,
  36781. "a175",
  36782. 0x27a5,
  36783. "a176",
  36784. 0x27a6,
  36785. "a177",
  36786. 0x27a7,
  36787. "a178",
  36788. 0x27a8,
  36789. "a179",
  36790. 0x27a9,
  36791. "a193",
  36792. 0x27aa,
  36793. "a180",
  36794. 0x27ab,
  36795. "a199",
  36796. 0x27ac,
  36797. "a181",
  36798. 0x27ad,
  36799. "a200",
  36800. 0x27ae,
  36801. "a182",
  36802. 0x27af,
  36803. "a201",
  36804. 0x27b1,
  36805. "a183",
  36806. 0x27b2,
  36807. "a184",
  36808. 0x27b3,
  36809. "a197",
  36810. 0x27b4,
  36811. "a185",
  36812. 0x27b5,
  36813. "a194",
  36814. 0x27b6,
  36815. "a198",
  36816. 0x27b7,
  36817. "a186",
  36818. 0x27b8,
  36819. "a195",
  36820. 0x27b9,
  36821. "a187",
  36822. 0x27ba,
  36823. "a188",
  36824. 0x27bb,
  36825. "a189",
  36826. 0x27bc,
  36827. "a190",
  36828. 0x27bd,
  36829. "a191",
  36830. 0x27be,
  36831. "a89",
  36832. 0x2768,
  36833. "a90",
  36834. 0x2769,
  36835. "a93",
  36836. 0x276a,
  36837. "a94",
  36838. 0x276b,
  36839. "a91",
  36840. 0x276c,
  36841. "a92",
  36842. 0x276d,
  36843. "a205",
  36844. 0x276e,
  36845. "a85",
  36846. 0x276f,
  36847. "a206",
  36848. 0x2770,
  36849. "a86",
  36850. 0x2771,
  36851. "a87",
  36852. 0x2772,
  36853. "a88",
  36854. 0x2773,
  36855. "a95",
  36856. 0x2774,
  36857. "a96",
  36858. 0x2775,
  36859. ".notdef",
  36860. 0x0000
  36861. ];
  36862. });
  36863. /***/ }),
  36864. /* 169 */
  36865. /***/ ((__unused_webpack_module, __webpack_exports__, __w_pdfjs_require__) => {
  36866. "use strict";
  36867. __w_pdfjs_require__.r(__webpack_exports__);
  36868. /* harmony export */ __w_pdfjs_require__.d(__webpack_exports__, {
  36869. /* harmony export */ "clearUnicodeCaches": () => (/* binding */ clearUnicodeCaches),
  36870. /* harmony export */ "getCharUnicodeCategory": () => (/* binding */ getCharUnicodeCategory),
  36871. /* harmony export */ "getNormalizedUnicodes": () => (/* binding */ getNormalizedUnicodes),
  36872. /* harmony export */ "getUnicodeForGlyph": () => (/* binding */ getUnicodeForGlyph),
  36873. /* harmony export */ "getUnicodeRangeFor": () => (/* binding */ getUnicodeRangeFor),
  36874. /* harmony export */ "mapSpecialUnicodeValues": () => (/* binding */ mapSpecialUnicodeValues),
  36875. /* harmony export */ "reverseIfRtl": () => (/* binding */ reverseIfRtl)
  36876. /* harmony export */ });
  36877. /* harmony import */ var _core_utils_js__WEBPACK_IMPORTED_MODULE_0__ = __w_pdfjs_require__(135);
  36878. const getSpecialPUASymbols = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getLookupTableFactory)(function (t) {
  36879. t[63721] = 0x00a9;
  36880. t[63193] = 0x00a9;
  36881. t[63720] = 0x00ae;
  36882. t[63194] = 0x00ae;
  36883. t[63722] = 0x2122;
  36884. t[63195] = 0x2122;
  36885. t[63729] = 0x23a7;
  36886. t[63730] = 0x23a8;
  36887. t[63731] = 0x23a9;
  36888. t[63740] = 0x23ab;
  36889. t[63741] = 0x23ac;
  36890. t[63742] = 0x23ad;
  36891. t[63726] = 0x23a1;
  36892. t[63727] = 0x23a2;
  36893. t[63728] = 0x23a3;
  36894. t[63737] = 0x23a4;
  36895. t[63738] = 0x23a5;
  36896. t[63739] = 0x23a6;
  36897. t[63723] = 0x239b;
  36898. t[63724] = 0x239c;
  36899. t[63725] = 0x239d;
  36900. t[63734] = 0x239e;
  36901. t[63735] = 0x239f;
  36902. t[63736] = 0x23a0;
  36903. });
  36904. function mapSpecialUnicodeValues(code) {
  36905. if (code >= 0xfff0 && code <= 0xffff) {
  36906. return 0;
  36907. } else if (code >= 0xf600 && code <= 0xf8ff) {
  36908. return getSpecialPUASymbols()[code] || code;
  36909. } else if (code === 0x00ad) {
  36910. return 0x002d;
  36911. }
  36912. return code;
  36913. }
  36914. function getUnicodeForGlyph(name, glyphsUnicodeMap) {
  36915. let unicode = glyphsUnicodeMap[name];
  36916. if (unicode !== undefined) {
  36917. return unicode;
  36918. }
  36919. if (!name) {
  36920. return -1;
  36921. }
  36922. if (name[0] === "u") {
  36923. const nameLen = name.length;
  36924. let hexStr;
  36925. if (nameLen === 7 && name[1] === "n" && name[2] === "i") {
  36926. hexStr = name.substring(3);
  36927. } else if (nameLen >= 5 && nameLen <= 7) {
  36928. hexStr = name.substring(1);
  36929. } else {
  36930. return -1;
  36931. }
  36932. if (hexStr === hexStr.toUpperCase()) {
  36933. unicode = parseInt(hexStr, 16);
  36934. if (unicode >= 0) {
  36935. return unicode;
  36936. }
  36937. }
  36938. }
  36939. return -1;
  36940. }
  36941. const UnicodeRanges = [
  36942. {
  36943. begin: 0x0000,
  36944. end: 0x007f
  36945. },
  36946. {
  36947. begin: 0x0080,
  36948. end: 0x00ff
  36949. },
  36950. {
  36951. begin: 0x0100,
  36952. end: 0x017f
  36953. },
  36954. {
  36955. begin: 0x0180,
  36956. end: 0x024f
  36957. },
  36958. {
  36959. begin: 0x0250,
  36960. end: 0x02af
  36961. },
  36962. {
  36963. begin: 0x02b0,
  36964. end: 0x02ff
  36965. },
  36966. {
  36967. begin: 0x0300,
  36968. end: 0x036f
  36969. },
  36970. {
  36971. begin: 0x0370,
  36972. end: 0x03ff
  36973. },
  36974. {
  36975. begin: 0x2c80,
  36976. end: 0x2cff
  36977. },
  36978. {
  36979. begin: 0x0400,
  36980. end: 0x04ff
  36981. },
  36982. {
  36983. begin: 0x0530,
  36984. end: 0x058f
  36985. },
  36986. {
  36987. begin: 0x0590,
  36988. end: 0x05ff
  36989. },
  36990. {
  36991. begin: 0xa500,
  36992. end: 0xa63f
  36993. },
  36994. {
  36995. begin: 0x0600,
  36996. end: 0x06ff
  36997. },
  36998. {
  36999. begin: 0x07c0,
  37000. end: 0x07ff
  37001. },
  37002. {
  37003. begin: 0x0900,
  37004. end: 0x097f
  37005. },
  37006. {
  37007. begin: 0x0980,
  37008. end: 0x09ff
  37009. },
  37010. {
  37011. begin: 0x0a00,
  37012. end: 0x0a7f
  37013. },
  37014. {
  37015. begin: 0x0a80,
  37016. end: 0x0aff
  37017. },
  37018. {
  37019. begin: 0x0b00,
  37020. end: 0x0b7f
  37021. },
  37022. {
  37023. begin: 0x0b80,
  37024. end: 0x0bff
  37025. },
  37026. {
  37027. begin: 0x0c00,
  37028. end: 0x0c7f
  37029. },
  37030. {
  37031. begin: 0x0c80,
  37032. end: 0x0cff
  37033. },
  37034. {
  37035. begin: 0x0d00,
  37036. end: 0x0d7f
  37037. },
  37038. {
  37039. begin: 0x0e00,
  37040. end: 0x0e7f
  37041. },
  37042. {
  37043. begin: 0x0e80,
  37044. end: 0x0eff
  37045. },
  37046. {
  37047. begin: 0x10a0,
  37048. end: 0x10ff
  37049. },
  37050. {
  37051. begin: 0x1b00,
  37052. end: 0x1b7f
  37053. },
  37054. {
  37055. begin: 0x1100,
  37056. end: 0x11ff
  37057. },
  37058. {
  37059. begin: 0x1e00,
  37060. end: 0x1eff
  37061. },
  37062. {
  37063. begin: 0x1f00,
  37064. end: 0x1fff
  37065. },
  37066. {
  37067. begin: 0x2000,
  37068. end: 0x206f
  37069. },
  37070. {
  37071. begin: 0x2070,
  37072. end: 0x209f
  37073. },
  37074. {
  37075. begin: 0x20a0,
  37076. end: 0x20cf
  37077. },
  37078. {
  37079. begin: 0x20d0,
  37080. end: 0x20ff
  37081. },
  37082. {
  37083. begin: 0x2100,
  37084. end: 0x214f
  37085. },
  37086. {
  37087. begin: 0x2150,
  37088. end: 0x218f
  37089. },
  37090. {
  37091. begin: 0x2190,
  37092. end: 0x21ff
  37093. },
  37094. {
  37095. begin: 0x2200,
  37096. end: 0x22ff
  37097. },
  37098. {
  37099. begin: 0x2300,
  37100. end: 0x23ff
  37101. },
  37102. {
  37103. begin: 0x2400,
  37104. end: 0x243f
  37105. },
  37106. {
  37107. begin: 0x2440,
  37108. end: 0x245f
  37109. },
  37110. {
  37111. begin: 0x2460,
  37112. end: 0x24ff
  37113. },
  37114. {
  37115. begin: 0x2500,
  37116. end: 0x257f
  37117. },
  37118. {
  37119. begin: 0x2580,
  37120. end: 0x259f
  37121. },
  37122. {
  37123. begin: 0x25a0,
  37124. end: 0x25ff
  37125. },
  37126. {
  37127. begin: 0x2600,
  37128. end: 0x26ff
  37129. },
  37130. {
  37131. begin: 0x2700,
  37132. end: 0x27bf
  37133. },
  37134. {
  37135. begin: 0x3000,
  37136. end: 0x303f
  37137. },
  37138. {
  37139. begin: 0x3040,
  37140. end: 0x309f
  37141. },
  37142. {
  37143. begin: 0x30a0,
  37144. end: 0x30ff
  37145. },
  37146. {
  37147. begin: 0x3100,
  37148. end: 0x312f
  37149. },
  37150. {
  37151. begin: 0x3130,
  37152. end: 0x318f
  37153. },
  37154. {
  37155. begin: 0xa840,
  37156. end: 0xa87f
  37157. },
  37158. {
  37159. begin: 0x3200,
  37160. end: 0x32ff
  37161. },
  37162. {
  37163. begin: 0x3300,
  37164. end: 0x33ff
  37165. },
  37166. {
  37167. begin: 0xac00,
  37168. end: 0xd7af
  37169. },
  37170. {
  37171. begin: 0xd800,
  37172. end: 0xdfff
  37173. },
  37174. {
  37175. begin: 0x10900,
  37176. end: 0x1091f
  37177. },
  37178. {
  37179. begin: 0x4e00,
  37180. end: 0x9fff
  37181. },
  37182. {
  37183. begin: 0xe000,
  37184. end: 0xf8ff
  37185. },
  37186. {
  37187. begin: 0x31c0,
  37188. end: 0x31ef
  37189. },
  37190. {
  37191. begin: 0xfb00,
  37192. end: 0xfb4f
  37193. },
  37194. {
  37195. begin: 0xfb50,
  37196. end: 0xfdff
  37197. },
  37198. {
  37199. begin: 0xfe20,
  37200. end: 0xfe2f
  37201. },
  37202. {
  37203. begin: 0xfe10,
  37204. end: 0xfe1f
  37205. },
  37206. {
  37207. begin: 0xfe50,
  37208. end: 0xfe6f
  37209. },
  37210. {
  37211. begin: 0xfe70,
  37212. end: 0xfeff
  37213. },
  37214. {
  37215. begin: 0xff00,
  37216. end: 0xffef
  37217. },
  37218. {
  37219. begin: 0xfff0,
  37220. end: 0xffff
  37221. },
  37222. {
  37223. begin: 0x0f00,
  37224. end: 0x0fff
  37225. },
  37226. {
  37227. begin: 0x0700,
  37228. end: 0x074f
  37229. },
  37230. {
  37231. begin: 0x0780,
  37232. end: 0x07bf
  37233. },
  37234. {
  37235. begin: 0x0d80,
  37236. end: 0x0dff
  37237. },
  37238. {
  37239. begin: 0x1000,
  37240. end: 0x109f
  37241. },
  37242. {
  37243. begin: 0x1200,
  37244. end: 0x137f
  37245. },
  37246. {
  37247. begin: 0x13a0,
  37248. end: 0x13ff
  37249. },
  37250. {
  37251. begin: 0x1400,
  37252. end: 0x167f
  37253. },
  37254. {
  37255. begin: 0x1680,
  37256. end: 0x169f
  37257. },
  37258. {
  37259. begin: 0x16a0,
  37260. end: 0x16ff
  37261. },
  37262. {
  37263. begin: 0x1780,
  37264. end: 0x17ff
  37265. },
  37266. {
  37267. begin: 0x1800,
  37268. end: 0x18af
  37269. },
  37270. {
  37271. begin: 0x2800,
  37272. end: 0x28ff
  37273. },
  37274. {
  37275. begin: 0xa000,
  37276. end: 0xa48f
  37277. },
  37278. {
  37279. begin: 0x1700,
  37280. end: 0x171f
  37281. },
  37282. {
  37283. begin: 0x10300,
  37284. end: 0x1032f
  37285. },
  37286. {
  37287. begin: 0x10330,
  37288. end: 0x1034f
  37289. },
  37290. {
  37291. begin: 0x10400,
  37292. end: 0x1044f
  37293. },
  37294. {
  37295. begin: 0x1d000,
  37296. end: 0x1d0ff
  37297. },
  37298. {
  37299. begin: 0x1d400,
  37300. end: 0x1d7ff
  37301. },
  37302. {
  37303. begin: 0xff000,
  37304. end: 0xffffd
  37305. },
  37306. {
  37307. begin: 0xfe00,
  37308. end: 0xfe0f
  37309. },
  37310. {
  37311. begin: 0xe0000,
  37312. end: 0xe007f
  37313. },
  37314. {
  37315. begin: 0x1900,
  37316. end: 0x194f
  37317. },
  37318. {
  37319. begin: 0x1950,
  37320. end: 0x197f
  37321. },
  37322. {
  37323. begin: 0x1980,
  37324. end: 0x19df
  37325. },
  37326. {
  37327. begin: 0x1a00,
  37328. end: 0x1a1f
  37329. },
  37330. {
  37331. begin: 0x2c00,
  37332. end: 0x2c5f
  37333. },
  37334. {
  37335. begin: 0x2d30,
  37336. end: 0x2d7f
  37337. },
  37338. {
  37339. begin: 0x4dc0,
  37340. end: 0x4dff
  37341. },
  37342. {
  37343. begin: 0xa800,
  37344. end: 0xa82f
  37345. },
  37346. {
  37347. begin: 0x10000,
  37348. end: 0x1007f
  37349. },
  37350. {
  37351. begin: 0x10140,
  37352. end: 0x1018f
  37353. },
  37354. {
  37355. begin: 0x10380,
  37356. end: 0x1039f
  37357. },
  37358. {
  37359. begin: 0x103a0,
  37360. end: 0x103df
  37361. },
  37362. {
  37363. begin: 0x10450,
  37364. end: 0x1047f
  37365. },
  37366. {
  37367. begin: 0x10480,
  37368. end: 0x104af
  37369. },
  37370. {
  37371. begin: 0x10800,
  37372. end: 0x1083f
  37373. },
  37374. {
  37375. begin: 0x10a00,
  37376. end: 0x10a5f
  37377. },
  37378. {
  37379. begin: 0x1d300,
  37380. end: 0x1d35f
  37381. },
  37382. {
  37383. begin: 0x12000,
  37384. end: 0x123ff
  37385. },
  37386. {
  37387. begin: 0x1d360,
  37388. end: 0x1d37f
  37389. },
  37390. {
  37391. begin: 0x1b80,
  37392. end: 0x1bbf
  37393. },
  37394. {
  37395. begin: 0x1c00,
  37396. end: 0x1c4f
  37397. },
  37398. {
  37399. begin: 0x1c50,
  37400. end: 0x1c7f
  37401. },
  37402. {
  37403. begin: 0xa880,
  37404. end: 0xa8df
  37405. },
  37406. {
  37407. begin: 0xa900,
  37408. end: 0xa92f
  37409. },
  37410. {
  37411. begin: 0xa930,
  37412. end: 0xa95f
  37413. },
  37414. {
  37415. begin: 0xaa00,
  37416. end: 0xaa5f
  37417. },
  37418. {
  37419. begin: 0x10190,
  37420. end: 0x101cf
  37421. },
  37422. {
  37423. begin: 0x101d0,
  37424. end: 0x101ff
  37425. },
  37426. {
  37427. begin: 0x102a0,
  37428. end: 0x102df
  37429. },
  37430. {
  37431. begin: 0x1f030,
  37432. end: 0x1f09f
  37433. }
  37434. ];
  37435. function getUnicodeRangeFor(value) {
  37436. for (let i = 0, ii = UnicodeRanges.length; i < ii; i++) {
  37437. const range = UnicodeRanges[i];
  37438. if (value >= range.begin && value < range.end) {
  37439. return i;
  37440. }
  37441. }
  37442. return -1;
  37443. }
  37444. function isRTLRangeFor(value) {
  37445. let range = UnicodeRanges[13];
  37446. if (value >= range.begin && value < range.end) {
  37447. return true;
  37448. }
  37449. range = UnicodeRanges[11];
  37450. if (value >= range.begin && value < range.end) {
  37451. return true;
  37452. }
  37453. return false;
  37454. }
  37455. const getNormalizedUnicodes = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getArrayLookupTableFactory)(function () {
  37456. return [
  37457. "\u00A8",
  37458. "\u0020\u0308",
  37459. "\u00AF",
  37460. "\u0020\u0304",
  37461. "\u00B4",
  37462. "\u0020\u0301",
  37463. "\u00B5",
  37464. "\u03BC",
  37465. "\u00B8",
  37466. "\u0020\u0327",
  37467. "\u0132",
  37468. "\u0049\u004A",
  37469. "\u0133",
  37470. "\u0069\u006A",
  37471. "\u013F",
  37472. "\u004C\u00B7",
  37473. "\u0140",
  37474. "\u006C\u00B7",
  37475. "\u0149",
  37476. "\u02BC\u006E",
  37477. "\u017F",
  37478. "\u0073",
  37479. "\u01C4",
  37480. "\u0044\u017D",
  37481. "\u01C5",
  37482. "\u0044\u017E",
  37483. "\u01C6",
  37484. "\u0064\u017E",
  37485. "\u01C7",
  37486. "\u004C\u004A",
  37487. "\u01C8",
  37488. "\u004C\u006A",
  37489. "\u01C9",
  37490. "\u006C\u006A",
  37491. "\u01CA",
  37492. "\u004E\u004A",
  37493. "\u01CB",
  37494. "\u004E\u006A",
  37495. "\u01CC",
  37496. "\u006E\u006A",
  37497. "\u01F1",
  37498. "\u0044\u005A",
  37499. "\u01F2",
  37500. "\u0044\u007A",
  37501. "\u01F3",
  37502. "\u0064\u007A",
  37503. "\u02D8",
  37504. "\u0020\u0306",
  37505. "\u02D9",
  37506. "\u0020\u0307",
  37507. "\u02DA",
  37508. "\u0020\u030A",
  37509. "\u02DB",
  37510. "\u0020\u0328",
  37511. "\u02DC",
  37512. "\u0020\u0303",
  37513. "\u02DD",
  37514. "\u0020\u030B",
  37515. "\u037A",
  37516. "\u0020\u0345",
  37517. "\u0384",
  37518. "\u0020\u0301",
  37519. "\u03D0",
  37520. "\u03B2",
  37521. "\u03D1",
  37522. "\u03B8",
  37523. "\u03D2",
  37524. "\u03A5",
  37525. "\u03D5",
  37526. "\u03C6",
  37527. "\u03D6",
  37528. "\u03C0",
  37529. "\u03F0",
  37530. "\u03BA",
  37531. "\u03F1",
  37532. "\u03C1",
  37533. "\u03F2",
  37534. "\u03C2",
  37535. "\u03F4",
  37536. "\u0398",
  37537. "\u03F5",
  37538. "\u03B5",
  37539. "\u03F9",
  37540. "\u03A3",
  37541. "\u0587",
  37542. "\u0565\u0582",
  37543. "\u0675",
  37544. "\u0627\u0674",
  37545. "\u0676",
  37546. "\u0648\u0674",
  37547. "\u0677",
  37548. "\u06C7\u0674",
  37549. "\u0678",
  37550. "\u064A\u0674",
  37551. "\u0E33",
  37552. "\u0E4D\u0E32",
  37553. "\u0EB3",
  37554. "\u0ECD\u0EB2",
  37555. "\u0EDC",
  37556. "\u0EAB\u0E99",
  37557. "\u0EDD",
  37558. "\u0EAB\u0EA1",
  37559. "\u0F77",
  37560. "\u0FB2\u0F81",
  37561. "\u0F79",
  37562. "\u0FB3\u0F81",
  37563. "\u1E9A",
  37564. "\u0061\u02BE",
  37565. "\u1FBD",
  37566. "\u0020\u0313",
  37567. "\u1FBF",
  37568. "\u0020\u0313",
  37569. "\u1FC0",
  37570. "\u0020\u0342",
  37571. "\u1FFE",
  37572. "\u0020\u0314",
  37573. "\u2002",
  37574. "\u0020",
  37575. "\u2003",
  37576. "\u0020",
  37577. "\u2004",
  37578. "\u0020",
  37579. "\u2005",
  37580. "\u0020",
  37581. "\u2006",
  37582. "\u0020",
  37583. "\u2008",
  37584. "\u0020",
  37585. "\u2009",
  37586. "\u0020",
  37587. "\u200A",
  37588. "\u0020",
  37589. "\u2017",
  37590. "\u0020\u0333",
  37591. "\u2024",
  37592. "\u002E",
  37593. "\u2025",
  37594. "\u002E\u002E",
  37595. "\u2026",
  37596. "\u002E\u002E\u002E",
  37597. "\u2033",
  37598. "\u2032\u2032",
  37599. "\u2034",
  37600. "\u2032\u2032\u2032",
  37601. "\u2036",
  37602. "\u2035\u2035",
  37603. "\u2037",
  37604. "\u2035\u2035\u2035",
  37605. "\u203C",
  37606. "\u0021\u0021",
  37607. "\u203E",
  37608. "\u0020\u0305",
  37609. "\u2047",
  37610. "\u003F\u003F",
  37611. "\u2048",
  37612. "\u003F\u0021",
  37613. "\u2049",
  37614. "\u0021\u003F",
  37615. "\u2057",
  37616. "\u2032\u2032\u2032\u2032",
  37617. "\u205F",
  37618. "\u0020",
  37619. "\u20A8",
  37620. "\u0052\u0073",
  37621. "\u2100",
  37622. "\u0061\u002F\u0063",
  37623. "\u2101",
  37624. "\u0061\u002F\u0073",
  37625. "\u2103",
  37626. "\u00B0\u0043",
  37627. "\u2105",
  37628. "\u0063\u002F\u006F",
  37629. "\u2106",
  37630. "\u0063\u002F\u0075",
  37631. "\u2107",
  37632. "\u0190",
  37633. "\u2109",
  37634. "\u00B0\u0046",
  37635. "\u2116",
  37636. "\u004E\u006F",
  37637. "\u2121",
  37638. "\u0054\u0045\u004C",
  37639. "\u2135",
  37640. "\u05D0",
  37641. "\u2136",
  37642. "\u05D1",
  37643. "\u2137",
  37644. "\u05D2",
  37645. "\u2138",
  37646. "\u05D3",
  37647. "\u213B",
  37648. "\u0046\u0041\u0058",
  37649. "\u2160",
  37650. "\u0049",
  37651. "\u2161",
  37652. "\u0049\u0049",
  37653. "\u2162",
  37654. "\u0049\u0049\u0049",
  37655. "\u2163",
  37656. "\u0049\u0056",
  37657. "\u2164",
  37658. "\u0056",
  37659. "\u2165",
  37660. "\u0056\u0049",
  37661. "\u2166",
  37662. "\u0056\u0049\u0049",
  37663. "\u2167",
  37664. "\u0056\u0049\u0049\u0049",
  37665. "\u2168",
  37666. "\u0049\u0058",
  37667. "\u2169",
  37668. "\u0058",
  37669. "\u216A",
  37670. "\u0058\u0049",
  37671. "\u216B",
  37672. "\u0058\u0049\u0049",
  37673. "\u216C",
  37674. "\u004C",
  37675. "\u216D",
  37676. "\u0043",
  37677. "\u216E",
  37678. "\u0044",
  37679. "\u216F",
  37680. "\u004D",
  37681. "\u2170",
  37682. "\u0069",
  37683. "\u2171",
  37684. "\u0069\u0069",
  37685. "\u2172",
  37686. "\u0069\u0069\u0069",
  37687. "\u2173",
  37688. "\u0069\u0076",
  37689. "\u2174",
  37690. "\u0076",
  37691. "\u2175",
  37692. "\u0076\u0069",
  37693. "\u2176",
  37694. "\u0076\u0069\u0069",
  37695. "\u2177",
  37696. "\u0076\u0069\u0069\u0069",
  37697. "\u2178",
  37698. "\u0069\u0078",
  37699. "\u2179",
  37700. "\u0078",
  37701. "\u217A",
  37702. "\u0078\u0069",
  37703. "\u217B",
  37704. "\u0078\u0069\u0069",
  37705. "\u217C",
  37706. "\u006C",
  37707. "\u217D",
  37708. "\u0063",
  37709. "\u217E",
  37710. "\u0064",
  37711. "\u217F",
  37712. "\u006D",
  37713. "\u222C",
  37714. "\u222B\u222B",
  37715. "\u222D",
  37716. "\u222B\u222B\u222B",
  37717. "\u222F",
  37718. "\u222E\u222E",
  37719. "\u2230",
  37720. "\u222E\u222E\u222E",
  37721. "\u2474",
  37722. "\u0028\u0031\u0029",
  37723. "\u2475",
  37724. "\u0028\u0032\u0029",
  37725. "\u2476",
  37726. "\u0028\u0033\u0029",
  37727. "\u2477",
  37728. "\u0028\u0034\u0029",
  37729. "\u2478",
  37730. "\u0028\u0035\u0029",
  37731. "\u2479",
  37732. "\u0028\u0036\u0029",
  37733. "\u247A",
  37734. "\u0028\u0037\u0029",
  37735. "\u247B",
  37736. "\u0028\u0038\u0029",
  37737. "\u247C",
  37738. "\u0028\u0039\u0029",
  37739. "\u247D",
  37740. "\u0028\u0031\u0030\u0029",
  37741. "\u247E",
  37742. "\u0028\u0031\u0031\u0029",
  37743. "\u247F",
  37744. "\u0028\u0031\u0032\u0029",
  37745. "\u2480",
  37746. "\u0028\u0031\u0033\u0029",
  37747. "\u2481",
  37748. "\u0028\u0031\u0034\u0029",
  37749. "\u2482",
  37750. "\u0028\u0031\u0035\u0029",
  37751. "\u2483",
  37752. "\u0028\u0031\u0036\u0029",
  37753. "\u2484",
  37754. "\u0028\u0031\u0037\u0029",
  37755. "\u2485",
  37756. "\u0028\u0031\u0038\u0029",
  37757. "\u2486",
  37758. "\u0028\u0031\u0039\u0029",
  37759. "\u2487",
  37760. "\u0028\u0032\u0030\u0029",
  37761. "\u2488",
  37762. "\u0031\u002E",
  37763. "\u2489",
  37764. "\u0032\u002E",
  37765. "\u248A",
  37766. "\u0033\u002E",
  37767. "\u248B",
  37768. "\u0034\u002E",
  37769. "\u248C",
  37770. "\u0035\u002E",
  37771. "\u248D",
  37772. "\u0036\u002E",
  37773. "\u248E",
  37774. "\u0037\u002E",
  37775. "\u248F",
  37776. "\u0038\u002E",
  37777. "\u2490",
  37778. "\u0039\u002E",
  37779. "\u2491",
  37780. "\u0031\u0030\u002E",
  37781. "\u2492",
  37782. "\u0031\u0031\u002E",
  37783. "\u2493",
  37784. "\u0031\u0032\u002E",
  37785. "\u2494",
  37786. "\u0031\u0033\u002E",
  37787. "\u2495",
  37788. "\u0031\u0034\u002E",
  37789. "\u2496",
  37790. "\u0031\u0035\u002E",
  37791. "\u2497",
  37792. "\u0031\u0036\u002E",
  37793. "\u2498",
  37794. "\u0031\u0037\u002E",
  37795. "\u2499",
  37796. "\u0031\u0038\u002E",
  37797. "\u249A",
  37798. "\u0031\u0039\u002E",
  37799. "\u249B",
  37800. "\u0032\u0030\u002E",
  37801. "\u249C",
  37802. "\u0028\u0061\u0029",
  37803. "\u249D",
  37804. "\u0028\u0062\u0029",
  37805. "\u249E",
  37806. "\u0028\u0063\u0029",
  37807. "\u249F",
  37808. "\u0028\u0064\u0029",
  37809. "\u24A0",
  37810. "\u0028\u0065\u0029",
  37811. "\u24A1",
  37812. "\u0028\u0066\u0029",
  37813. "\u24A2",
  37814. "\u0028\u0067\u0029",
  37815. "\u24A3",
  37816. "\u0028\u0068\u0029",
  37817. "\u24A4",
  37818. "\u0028\u0069\u0029",
  37819. "\u24A5",
  37820. "\u0028\u006A\u0029",
  37821. "\u24A6",
  37822. "\u0028\u006B\u0029",
  37823. "\u24A7",
  37824. "\u0028\u006C\u0029",
  37825. "\u24A8",
  37826. "\u0028\u006D\u0029",
  37827. "\u24A9",
  37828. "\u0028\u006E\u0029",
  37829. "\u24AA",
  37830. "\u0028\u006F\u0029",
  37831. "\u24AB",
  37832. "\u0028\u0070\u0029",
  37833. "\u24AC",
  37834. "\u0028\u0071\u0029",
  37835. "\u24AD",
  37836. "\u0028\u0072\u0029",
  37837. "\u24AE",
  37838. "\u0028\u0073\u0029",
  37839. "\u24AF",
  37840. "\u0028\u0074\u0029",
  37841. "\u24B0",
  37842. "\u0028\u0075\u0029",
  37843. "\u24B1",
  37844. "\u0028\u0076\u0029",
  37845. "\u24B2",
  37846. "\u0028\u0077\u0029",
  37847. "\u24B3",
  37848. "\u0028\u0078\u0029",
  37849. "\u24B4",
  37850. "\u0028\u0079\u0029",
  37851. "\u24B5",
  37852. "\u0028\u007A\u0029",
  37853. "\u2A0C",
  37854. "\u222B\u222B\u222B\u222B",
  37855. "\u2A74",
  37856. "\u003A\u003A\u003D",
  37857. "\u2A75",
  37858. "\u003D\u003D",
  37859. "\u2A76",
  37860. "\u003D\u003D\u003D",
  37861. "\u2E9F",
  37862. "\u6BCD",
  37863. "\u2EF3",
  37864. "\u9F9F",
  37865. "\u2F00",
  37866. "\u4E00",
  37867. "\u2F01",
  37868. "\u4E28",
  37869. "\u2F02",
  37870. "\u4E36",
  37871. "\u2F03",
  37872. "\u4E3F",
  37873. "\u2F04",
  37874. "\u4E59",
  37875. "\u2F05",
  37876. "\u4E85",
  37877. "\u2F06",
  37878. "\u4E8C",
  37879. "\u2F07",
  37880. "\u4EA0",
  37881. "\u2F08",
  37882. "\u4EBA",
  37883. "\u2F09",
  37884. "\u513F",
  37885. "\u2F0A",
  37886. "\u5165",
  37887. "\u2F0B",
  37888. "\u516B",
  37889. "\u2F0C",
  37890. "\u5182",
  37891. "\u2F0D",
  37892. "\u5196",
  37893. "\u2F0E",
  37894. "\u51AB",
  37895. "\u2F0F",
  37896. "\u51E0",
  37897. "\u2F10",
  37898. "\u51F5",
  37899. "\u2F11",
  37900. "\u5200",
  37901. "\u2F12",
  37902. "\u529B",
  37903. "\u2F13",
  37904. "\u52F9",
  37905. "\u2F14",
  37906. "\u5315",
  37907. "\u2F15",
  37908. "\u531A",
  37909. "\u2F16",
  37910. "\u5338",
  37911. "\u2F17",
  37912. "\u5341",
  37913. "\u2F18",
  37914. "\u535C",
  37915. "\u2F19",
  37916. "\u5369",
  37917. "\u2F1A",
  37918. "\u5382",
  37919. "\u2F1B",
  37920. "\u53B6",
  37921. "\u2F1C",
  37922. "\u53C8",
  37923. "\u2F1D",
  37924. "\u53E3",
  37925. "\u2F1E",
  37926. "\u56D7",
  37927. "\u2F1F",
  37928. "\u571F",
  37929. "\u2F20",
  37930. "\u58EB",
  37931. "\u2F21",
  37932. "\u5902",
  37933. "\u2F22",
  37934. "\u590A",
  37935. "\u2F23",
  37936. "\u5915",
  37937. "\u2F24",
  37938. "\u5927",
  37939. "\u2F25",
  37940. "\u5973",
  37941. "\u2F26",
  37942. "\u5B50",
  37943. "\u2F27",
  37944. "\u5B80",
  37945. "\u2F28",
  37946. "\u5BF8",
  37947. "\u2F29",
  37948. "\u5C0F",
  37949. "\u2F2A",
  37950. "\u5C22",
  37951. "\u2F2B",
  37952. "\u5C38",
  37953. "\u2F2C",
  37954. "\u5C6E",
  37955. "\u2F2D",
  37956. "\u5C71",
  37957. "\u2F2E",
  37958. "\u5DDB",
  37959. "\u2F2F",
  37960. "\u5DE5",
  37961. "\u2F30",
  37962. "\u5DF1",
  37963. "\u2F31",
  37964. "\u5DFE",
  37965. "\u2F32",
  37966. "\u5E72",
  37967. "\u2F33",
  37968. "\u5E7A",
  37969. "\u2F34",
  37970. "\u5E7F",
  37971. "\u2F35",
  37972. "\u5EF4",
  37973. "\u2F36",
  37974. "\u5EFE",
  37975. "\u2F37",
  37976. "\u5F0B",
  37977. "\u2F38",
  37978. "\u5F13",
  37979. "\u2F39",
  37980. "\u5F50",
  37981. "\u2F3A",
  37982. "\u5F61",
  37983. "\u2F3B",
  37984. "\u5F73",
  37985. "\u2F3C",
  37986. "\u5FC3",
  37987. "\u2F3D",
  37988. "\u6208",
  37989. "\u2F3E",
  37990. "\u6236",
  37991. "\u2F3F",
  37992. "\u624B",
  37993. "\u2F40",
  37994. "\u652F",
  37995. "\u2F41",
  37996. "\u6534",
  37997. "\u2F42",
  37998. "\u6587",
  37999. "\u2F43",
  38000. "\u6597",
  38001. "\u2F44",
  38002. "\u65A4",
  38003. "\u2F45",
  38004. "\u65B9",
  38005. "\u2F46",
  38006. "\u65E0",
  38007. "\u2F47",
  38008. "\u65E5",
  38009. "\u2F48",
  38010. "\u66F0",
  38011. "\u2F49",
  38012. "\u6708",
  38013. "\u2F4A",
  38014. "\u6728",
  38015. "\u2F4B",
  38016. "\u6B20",
  38017. "\u2F4C",
  38018. "\u6B62",
  38019. "\u2F4D",
  38020. "\u6B79",
  38021. "\u2F4E",
  38022. "\u6BB3",
  38023. "\u2F4F",
  38024. "\u6BCB",
  38025. "\u2F50",
  38026. "\u6BD4",
  38027. "\u2F51",
  38028. "\u6BDB",
  38029. "\u2F52",
  38030. "\u6C0F",
  38031. "\u2F53",
  38032. "\u6C14",
  38033. "\u2F54",
  38034. "\u6C34",
  38035. "\u2F55",
  38036. "\u706B",
  38037. "\u2F56",
  38038. "\u722A",
  38039. "\u2F57",
  38040. "\u7236",
  38041. "\u2F58",
  38042. "\u723B",
  38043. "\u2F59",
  38044. "\u723F",
  38045. "\u2F5A",
  38046. "\u7247",
  38047. "\u2F5B",
  38048. "\u7259",
  38049. "\u2F5C",
  38050. "\u725B",
  38051. "\u2F5D",
  38052. "\u72AC",
  38053. "\u2F5E",
  38054. "\u7384",
  38055. "\u2F5F",
  38056. "\u7389",
  38057. "\u2F60",
  38058. "\u74DC",
  38059. "\u2F61",
  38060. "\u74E6",
  38061. "\u2F62",
  38062. "\u7518",
  38063. "\u2F63",
  38064. "\u751F",
  38065. "\u2F64",
  38066. "\u7528",
  38067. "\u2F65",
  38068. "\u7530",
  38069. "\u2F66",
  38070. "\u758B",
  38071. "\u2F67",
  38072. "\u7592",
  38073. "\u2F68",
  38074. "\u7676",
  38075. "\u2F69",
  38076. "\u767D",
  38077. "\u2F6A",
  38078. "\u76AE",
  38079. "\u2F6B",
  38080. "\u76BF",
  38081. "\u2F6C",
  38082. "\u76EE",
  38083. "\u2F6D",
  38084. "\u77DB",
  38085. "\u2F6E",
  38086. "\u77E2",
  38087. "\u2F6F",
  38088. "\u77F3",
  38089. "\u2F70",
  38090. "\u793A",
  38091. "\u2F71",
  38092. "\u79B8",
  38093. "\u2F72",
  38094. "\u79BE",
  38095. "\u2F73",
  38096. "\u7A74",
  38097. "\u2F74",
  38098. "\u7ACB",
  38099. "\u2F75",
  38100. "\u7AF9",
  38101. "\u2F76",
  38102. "\u7C73",
  38103. "\u2F77",
  38104. "\u7CF8",
  38105. "\u2F78",
  38106. "\u7F36",
  38107. "\u2F79",
  38108. "\u7F51",
  38109. "\u2F7A",
  38110. "\u7F8A",
  38111. "\u2F7B",
  38112. "\u7FBD",
  38113. "\u2F7C",
  38114. "\u8001",
  38115. "\u2F7D",
  38116. "\u800C",
  38117. "\u2F7E",
  38118. "\u8012",
  38119. "\u2F7F",
  38120. "\u8033",
  38121. "\u2F80",
  38122. "\u807F",
  38123. "\u2F81",
  38124. "\u8089",
  38125. "\u2F82",
  38126. "\u81E3",
  38127. "\u2F83",
  38128. "\u81EA",
  38129. "\u2F84",
  38130. "\u81F3",
  38131. "\u2F85",
  38132. "\u81FC",
  38133. "\u2F86",
  38134. "\u820C",
  38135. "\u2F87",
  38136. "\u821B",
  38137. "\u2F88",
  38138. "\u821F",
  38139. "\u2F89",
  38140. "\u826E",
  38141. "\u2F8A",
  38142. "\u8272",
  38143. "\u2F8B",
  38144. "\u8278",
  38145. "\u2F8C",
  38146. "\u864D",
  38147. "\u2F8D",
  38148. "\u866B",
  38149. "\u2F8E",
  38150. "\u8840",
  38151. "\u2F8F",
  38152. "\u884C",
  38153. "\u2F90",
  38154. "\u8863",
  38155. "\u2F91",
  38156. "\u897E",
  38157. "\u2F92",
  38158. "\u898B",
  38159. "\u2F93",
  38160. "\u89D2",
  38161. "\u2F94",
  38162. "\u8A00",
  38163. "\u2F95",
  38164. "\u8C37",
  38165. "\u2F96",
  38166. "\u8C46",
  38167. "\u2F97",
  38168. "\u8C55",
  38169. "\u2F98",
  38170. "\u8C78",
  38171. "\u2F99",
  38172. "\u8C9D",
  38173. "\u2F9A",
  38174. "\u8D64",
  38175. "\u2F9B",
  38176. "\u8D70",
  38177. "\u2F9C",
  38178. "\u8DB3",
  38179. "\u2F9D",
  38180. "\u8EAB",
  38181. "\u2F9E",
  38182. "\u8ECA",
  38183. "\u2F9F",
  38184. "\u8F9B",
  38185. "\u2FA0",
  38186. "\u8FB0",
  38187. "\u2FA1",
  38188. "\u8FB5",
  38189. "\u2FA2",
  38190. "\u9091",
  38191. "\u2FA3",
  38192. "\u9149",
  38193. "\u2FA4",
  38194. "\u91C6",
  38195. "\u2FA5",
  38196. "\u91CC",
  38197. "\u2FA6",
  38198. "\u91D1",
  38199. "\u2FA7",
  38200. "\u9577",
  38201. "\u2FA8",
  38202. "\u9580",
  38203. "\u2FA9",
  38204. "\u961C",
  38205. "\u2FAA",
  38206. "\u96B6",
  38207. "\u2FAB",
  38208. "\u96B9",
  38209. "\u2FAC",
  38210. "\u96E8",
  38211. "\u2FAD",
  38212. "\u9751",
  38213. "\u2FAE",
  38214. "\u975E",
  38215. "\u2FAF",
  38216. "\u9762",
  38217. "\u2FB0",
  38218. "\u9769",
  38219. "\u2FB1",
  38220. "\u97CB",
  38221. "\u2FB2",
  38222. "\u97ED",
  38223. "\u2FB3",
  38224. "\u97F3",
  38225. "\u2FB4",
  38226. "\u9801",
  38227. "\u2FB5",
  38228. "\u98A8",
  38229. "\u2FB6",
  38230. "\u98DB",
  38231. "\u2FB7",
  38232. "\u98DF",
  38233. "\u2FB8",
  38234. "\u9996",
  38235. "\u2FB9",
  38236. "\u9999",
  38237. "\u2FBA",
  38238. "\u99AC",
  38239. "\u2FBB",
  38240. "\u9AA8",
  38241. "\u2FBC",
  38242. "\u9AD8",
  38243. "\u2FBD",
  38244. "\u9ADF",
  38245. "\u2FBE",
  38246. "\u9B25",
  38247. "\u2FBF",
  38248. "\u9B2F",
  38249. "\u2FC0",
  38250. "\u9B32",
  38251. "\u2FC1",
  38252. "\u9B3C",
  38253. "\u2FC2",
  38254. "\u9B5A",
  38255. "\u2FC3",
  38256. "\u9CE5",
  38257. "\u2FC4",
  38258. "\u9E75",
  38259. "\u2FC5",
  38260. "\u9E7F",
  38261. "\u2FC6",
  38262. "\u9EA5",
  38263. "\u2FC7",
  38264. "\u9EBB",
  38265. "\u2FC8",
  38266. "\u9EC3",
  38267. "\u2FC9",
  38268. "\u9ECD",
  38269. "\u2FCA",
  38270. "\u9ED1",
  38271. "\u2FCB",
  38272. "\u9EF9",
  38273. "\u2FCC",
  38274. "\u9EFD",
  38275. "\u2FCD",
  38276. "\u9F0E",
  38277. "\u2FCE",
  38278. "\u9F13",
  38279. "\u2FCF",
  38280. "\u9F20",
  38281. "\u2FD0",
  38282. "\u9F3B",
  38283. "\u2FD1",
  38284. "\u9F4A",
  38285. "\u2FD2",
  38286. "\u9F52",
  38287. "\u2FD3",
  38288. "\u9F8D",
  38289. "\u2FD4",
  38290. "\u9F9C",
  38291. "\u2FD5",
  38292. "\u9FA0",
  38293. "\u3036",
  38294. "\u3012",
  38295. "\u3038",
  38296. "\u5341",
  38297. "\u3039",
  38298. "\u5344",
  38299. "\u303A",
  38300. "\u5345",
  38301. "\u309B",
  38302. "\u0020\u3099",
  38303. "\u309C",
  38304. "\u0020\u309A",
  38305. "\u3131",
  38306. "\u1100",
  38307. "\u3132",
  38308. "\u1101",
  38309. "\u3133",
  38310. "\u11AA",
  38311. "\u3134",
  38312. "\u1102",
  38313. "\u3135",
  38314. "\u11AC",
  38315. "\u3136",
  38316. "\u11AD",
  38317. "\u3137",
  38318. "\u1103",
  38319. "\u3138",
  38320. "\u1104",
  38321. "\u3139",
  38322. "\u1105",
  38323. "\u313A",
  38324. "\u11B0",
  38325. "\u313B",
  38326. "\u11B1",
  38327. "\u313C",
  38328. "\u11B2",
  38329. "\u313D",
  38330. "\u11B3",
  38331. "\u313E",
  38332. "\u11B4",
  38333. "\u313F",
  38334. "\u11B5",
  38335. "\u3140",
  38336. "\u111A",
  38337. "\u3141",
  38338. "\u1106",
  38339. "\u3142",
  38340. "\u1107",
  38341. "\u3143",
  38342. "\u1108",
  38343. "\u3144",
  38344. "\u1121",
  38345. "\u3145",
  38346. "\u1109",
  38347. "\u3146",
  38348. "\u110A",
  38349. "\u3147",
  38350. "\u110B",
  38351. "\u3148",
  38352. "\u110C",
  38353. "\u3149",
  38354. "\u110D",
  38355. "\u314A",
  38356. "\u110E",
  38357. "\u314B",
  38358. "\u110F",
  38359. "\u314C",
  38360. "\u1110",
  38361. "\u314D",
  38362. "\u1111",
  38363. "\u314E",
  38364. "\u1112",
  38365. "\u314F",
  38366. "\u1161",
  38367. "\u3150",
  38368. "\u1162",
  38369. "\u3151",
  38370. "\u1163",
  38371. "\u3152",
  38372. "\u1164",
  38373. "\u3153",
  38374. "\u1165",
  38375. "\u3154",
  38376. "\u1166",
  38377. "\u3155",
  38378. "\u1167",
  38379. "\u3156",
  38380. "\u1168",
  38381. "\u3157",
  38382. "\u1169",
  38383. "\u3158",
  38384. "\u116A",
  38385. "\u3159",
  38386. "\u116B",
  38387. "\u315A",
  38388. "\u116C",
  38389. "\u315B",
  38390. "\u116D",
  38391. "\u315C",
  38392. "\u116E",
  38393. "\u315D",
  38394. "\u116F",
  38395. "\u315E",
  38396. "\u1170",
  38397. "\u315F",
  38398. "\u1171",
  38399. "\u3160",
  38400. "\u1172",
  38401. "\u3161",
  38402. "\u1173",
  38403. "\u3162",
  38404. "\u1174",
  38405. "\u3163",
  38406. "\u1175",
  38407. "\u3164",
  38408. "\u1160",
  38409. "\u3165",
  38410. "\u1114",
  38411. "\u3166",
  38412. "\u1115",
  38413. "\u3167",
  38414. "\u11C7",
  38415. "\u3168",
  38416. "\u11C8",
  38417. "\u3169",
  38418. "\u11CC",
  38419. "\u316A",
  38420. "\u11CE",
  38421. "\u316B",
  38422. "\u11D3",
  38423. "\u316C",
  38424. "\u11D7",
  38425. "\u316D",
  38426. "\u11D9",
  38427. "\u316E",
  38428. "\u111C",
  38429. "\u316F",
  38430. "\u11DD",
  38431. "\u3170",
  38432. "\u11DF",
  38433. "\u3171",
  38434. "\u111D",
  38435. "\u3172",
  38436. "\u111E",
  38437. "\u3173",
  38438. "\u1120",
  38439. "\u3174",
  38440. "\u1122",
  38441. "\u3175",
  38442. "\u1123",
  38443. "\u3176",
  38444. "\u1127",
  38445. "\u3177",
  38446. "\u1129",
  38447. "\u3178",
  38448. "\u112B",
  38449. "\u3179",
  38450. "\u112C",
  38451. "\u317A",
  38452. "\u112D",
  38453. "\u317B",
  38454. "\u112E",
  38455. "\u317C",
  38456. "\u112F",
  38457. "\u317D",
  38458. "\u1132",
  38459. "\u317E",
  38460. "\u1136",
  38461. "\u317F",
  38462. "\u1140",
  38463. "\u3180",
  38464. "\u1147",
  38465. "\u3181",
  38466. "\u114C",
  38467. "\u3182",
  38468. "\u11F1",
  38469. "\u3183",
  38470. "\u11F2",
  38471. "\u3184",
  38472. "\u1157",
  38473. "\u3185",
  38474. "\u1158",
  38475. "\u3186",
  38476. "\u1159",
  38477. "\u3187",
  38478. "\u1184",
  38479. "\u3188",
  38480. "\u1185",
  38481. "\u3189",
  38482. "\u1188",
  38483. "\u318A",
  38484. "\u1191",
  38485. "\u318B",
  38486. "\u1192",
  38487. "\u318C",
  38488. "\u1194",
  38489. "\u318D",
  38490. "\u119E",
  38491. "\u318E",
  38492. "\u11A1",
  38493. "\u3200",
  38494. "\u0028\u1100\u0029",
  38495. "\u3201",
  38496. "\u0028\u1102\u0029",
  38497. "\u3202",
  38498. "\u0028\u1103\u0029",
  38499. "\u3203",
  38500. "\u0028\u1105\u0029",
  38501. "\u3204",
  38502. "\u0028\u1106\u0029",
  38503. "\u3205",
  38504. "\u0028\u1107\u0029",
  38505. "\u3206",
  38506. "\u0028\u1109\u0029",
  38507. "\u3207",
  38508. "\u0028\u110B\u0029",
  38509. "\u3208",
  38510. "\u0028\u110C\u0029",
  38511. "\u3209",
  38512. "\u0028\u110E\u0029",
  38513. "\u320A",
  38514. "\u0028\u110F\u0029",
  38515. "\u320B",
  38516. "\u0028\u1110\u0029",
  38517. "\u320C",
  38518. "\u0028\u1111\u0029",
  38519. "\u320D",
  38520. "\u0028\u1112\u0029",
  38521. "\u320E",
  38522. "\u0028\u1100\u1161\u0029",
  38523. "\u320F",
  38524. "\u0028\u1102\u1161\u0029",
  38525. "\u3210",
  38526. "\u0028\u1103\u1161\u0029",
  38527. "\u3211",
  38528. "\u0028\u1105\u1161\u0029",
  38529. "\u3212",
  38530. "\u0028\u1106\u1161\u0029",
  38531. "\u3213",
  38532. "\u0028\u1107\u1161\u0029",
  38533. "\u3214",
  38534. "\u0028\u1109\u1161\u0029",
  38535. "\u3215",
  38536. "\u0028\u110B\u1161\u0029",
  38537. "\u3216",
  38538. "\u0028\u110C\u1161\u0029",
  38539. "\u3217",
  38540. "\u0028\u110E\u1161\u0029",
  38541. "\u3218",
  38542. "\u0028\u110F\u1161\u0029",
  38543. "\u3219",
  38544. "\u0028\u1110\u1161\u0029",
  38545. "\u321A",
  38546. "\u0028\u1111\u1161\u0029",
  38547. "\u321B",
  38548. "\u0028\u1112\u1161\u0029",
  38549. "\u321C",
  38550. "\u0028\u110C\u116E\u0029",
  38551. "\u321D",
  38552. "\u0028\u110B\u1169\u110C\u1165\u11AB\u0029",
  38553. "\u321E",
  38554. "\u0028\u110B\u1169\u1112\u116E\u0029",
  38555. "\u3220",
  38556. "\u0028\u4E00\u0029",
  38557. "\u3221",
  38558. "\u0028\u4E8C\u0029",
  38559. "\u3222",
  38560. "\u0028\u4E09\u0029",
  38561. "\u3223",
  38562. "\u0028\u56DB\u0029",
  38563. "\u3224",
  38564. "\u0028\u4E94\u0029",
  38565. "\u3225",
  38566. "\u0028\u516D\u0029",
  38567. "\u3226",
  38568. "\u0028\u4E03\u0029",
  38569. "\u3227",
  38570. "\u0028\u516B\u0029",
  38571. "\u3228",
  38572. "\u0028\u4E5D\u0029",
  38573. "\u3229",
  38574. "\u0028\u5341\u0029",
  38575. "\u322A",
  38576. "\u0028\u6708\u0029",
  38577. "\u322B",
  38578. "\u0028\u706B\u0029",
  38579. "\u322C",
  38580. "\u0028\u6C34\u0029",
  38581. "\u322D",
  38582. "\u0028\u6728\u0029",
  38583. "\u322E",
  38584. "\u0028\u91D1\u0029",
  38585. "\u322F",
  38586. "\u0028\u571F\u0029",
  38587. "\u3230",
  38588. "\u0028\u65E5\u0029",
  38589. "\u3231",
  38590. "\u0028\u682A\u0029",
  38591. "\u3232",
  38592. "\u0028\u6709\u0029",
  38593. "\u3233",
  38594. "\u0028\u793E\u0029",
  38595. "\u3234",
  38596. "\u0028\u540D\u0029",
  38597. "\u3235",
  38598. "\u0028\u7279\u0029",
  38599. "\u3236",
  38600. "\u0028\u8CA1\u0029",
  38601. "\u3237",
  38602. "\u0028\u795D\u0029",
  38603. "\u3238",
  38604. "\u0028\u52B4\u0029",
  38605. "\u3239",
  38606. "\u0028\u4EE3\u0029",
  38607. "\u323A",
  38608. "\u0028\u547C\u0029",
  38609. "\u323B",
  38610. "\u0028\u5B66\u0029",
  38611. "\u323C",
  38612. "\u0028\u76E3\u0029",
  38613. "\u323D",
  38614. "\u0028\u4F01\u0029",
  38615. "\u323E",
  38616. "\u0028\u8CC7\u0029",
  38617. "\u323F",
  38618. "\u0028\u5354\u0029",
  38619. "\u3240",
  38620. "\u0028\u796D\u0029",
  38621. "\u3241",
  38622. "\u0028\u4F11\u0029",
  38623. "\u3242",
  38624. "\u0028\u81EA\u0029",
  38625. "\u3243",
  38626. "\u0028\u81F3\u0029",
  38627. "\u32C0",
  38628. "\u0031\u6708",
  38629. "\u32C1",
  38630. "\u0032\u6708",
  38631. "\u32C2",
  38632. "\u0033\u6708",
  38633. "\u32C3",
  38634. "\u0034\u6708",
  38635. "\u32C4",
  38636. "\u0035\u6708",
  38637. "\u32C5",
  38638. "\u0036\u6708",
  38639. "\u32C6",
  38640. "\u0037\u6708",
  38641. "\u32C7",
  38642. "\u0038\u6708",
  38643. "\u32C8",
  38644. "\u0039\u6708",
  38645. "\u32C9",
  38646. "\u0031\u0030\u6708",
  38647. "\u32CA",
  38648. "\u0031\u0031\u6708",
  38649. "\u32CB",
  38650. "\u0031\u0032\u6708",
  38651. "\u3358",
  38652. "\u0030\u70B9",
  38653. "\u3359",
  38654. "\u0031\u70B9",
  38655. "\u335A",
  38656. "\u0032\u70B9",
  38657. "\u335B",
  38658. "\u0033\u70B9",
  38659. "\u335C",
  38660. "\u0034\u70B9",
  38661. "\u335D",
  38662. "\u0035\u70B9",
  38663. "\u335E",
  38664. "\u0036\u70B9",
  38665. "\u335F",
  38666. "\u0037\u70B9",
  38667. "\u3360",
  38668. "\u0038\u70B9",
  38669. "\u3361",
  38670. "\u0039\u70B9",
  38671. "\u3362",
  38672. "\u0031\u0030\u70B9",
  38673. "\u3363",
  38674. "\u0031\u0031\u70B9",
  38675. "\u3364",
  38676. "\u0031\u0032\u70B9",
  38677. "\u3365",
  38678. "\u0031\u0033\u70B9",
  38679. "\u3366",
  38680. "\u0031\u0034\u70B9",
  38681. "\u3367",
  38682. "\u0031\u0035\u70B9",
  38683. "\u3368",
  38684. "\u0031\u0036\u70B9",
  38685. "\u3369",
  38686. "\u0031\u0037\u70B9",
  38687. "\u336A",
  38688. "\u0031\u0038\u70B9",
  38689. "\u336B",
  38690. "\u0031\u0039\u70B9",
  38691. "\u336C",
  38692. "\u0032\u0030\u70B9",
  38693. "\u336D",
  38694. "\u0032\u0031\u70B9",
  38695. "\u336E",
  38696. "\u0032\u0032\u70B9",
  38697. "\u336F",
  38698. "\u0032\u0033\u70B9",
  38699. "\u3370",
  38700. "\u0032\u0034\u70B9",
  38701. "\u33E0",
  38702. "\u0031\u65E5",
  38703. "\u33E1",
  38704. "\u0032\u65E5",
  38705. "\u33E2",
  38706. "\u0033\u65E5",
  38707. "\u33E3",
  38708. "\u0034\u65E5",
  38709. "\u33E4",
  38710. "\u0035\u65E5",
  38711. "\u33E5",
  38712. "\u0036\u65E5",
  38713. "\u33E6",
  38714. "\u0037\u65E5",
  38715. "\u33E7",
  38716. "\u0038\u65E5",
  38717. "\u33E8",
  38718. "\u0039\u65E5",
  38719. "\u33E9",
  38720. "\u0031\u0030\u65E5",
  38721. "\u33EA",
  38722. "\u0031\u0031\u65E5",
  38723. "\u33EB",
  38724. "\u0031\u0032\u65E5",
  38725. "\u33EC",
  38726. "\u0031\u0033\u65E5",
  38727. "\u33ED",
  38728. "\u0031\u0034\u65E5",
  38729. "\u33EE",
  38730. "\u0031\u0035\u65E5",
  38731. "\u33EF",
  38732. "\u0031\u0036\u65E5",
  38733. "\u33F0",
  38734. "\u0031\u0037\u65E5",
  38735. "\u33F1",
  38736. "\u0031\u0038\u65E5",
  38737. "\u33F2",
  38738. "\u0031\u0039\u65E5",
  38739. "\u33F3",
  38740. "\u0032\u0030\u65E5",
  38741. "\u33F4",
  38742. "\u0032\u0031\u65E5",
  38743. "\u33F5",
  38744. "\u0032\u0032\u65E5",
  38745. "\u33F6",
  38746. "\u0032\u0033\u65E5",
  38747. "\u33F7",
  38748. "\u0032\u0034\u65E5",
  38749. "\u33F8",
  38750. "\u0032\u0035\u65E5",
  38751. "\u33F9",
  38752. "\u0032\u0036\u65E5",
  38753. "\u33FA",
  38754. "\u0032\u0037\u65E5",
  38755. "\u33FB",
  38756. "\u0032\u0038\u65E5",
  38757. "\u33FC",
  38758. "\u0032\u0039\u65E5",
  38759. "\u33FD",
  38760. "\u0033\u0030\u65E5",
  38761. "\u33FE",
  38762. "\u0033\u0031\u65E5",
  38763. "\uFB00",
  38764. "\u0066\u0066",
  38765. "\uFB01",
  38766. "\u0066\u0069",
  38767. "\uFB02",
  38768. "\u0066\u006C",
  38769. "\uFB03",
  38770. "\u0066\u0066\u0069",
  38771. "\uFB04",
  38772. "\u0066\u0066\u006C",
  38773. "\uFB05",
  38774. "\u017F\u0074",
  38775. "\uFB06",
  38776. "\u0073\u0074",
  38777. "\uFB13",
  38778. "\u0574\u0576",
  38779. "\uFB14",
  38780. "\u0574\u0565",
  38781. "\uFB15",
  38782. "\u0574\u056B",
  38783. "\uFB16",
  38784. "\u057E\u0576",
  38785. "\uFB17",
  38786. "\u0574\u056D",
  38787. "\uFB4F",
  38788. "\u05D0\u05DC",
  38789. "\uFB50",
  38790. "\u0671",
  38791. "\uFB51",
  38792. "\u0671",
  38793. "\uFB52",
  38794. "\u067B",
  38795. "\uFB53",
  38796. "\u067B",
  38797. "\uFB54",
  38798. "\u067B",
  38799. "\uFB55",
  38800. "\u067B",
  38801. "\uFB56",
  38802. "\u067E",
  38803. "\uFB57",
  38804. "\u067E",
  38805. "\uFB58",
  38806. "\u067E",
  38807. "\uFB59",
  38808. "\u067E",
  38809. "\uFB5A",
  38810. "\u0680",
  38811. "\uFB5B",
  38812. "\u0680",
  38813. "\uFB5C",
  38814. "\u0680",
  38815. "\uFB5D",
  38816. "\u0680",
  38817. "\uFB5E",
  38818. "\u067A",
  38819. "\uFB5F",
  38820. "\u067A",
  38821. "\uFB60",
  38822. "\u067A",
  38823. "\uFB61",
  38824. "\u067A",
  38825. "\uFB62",
  38826. "\u067F",
  38827. "\uFB63",
  38828. "\u067F",
  38829. "\uFB64",
  38830. "\u067F",
  38831. "\uFB65",
  38832. "\u067F",
  38833. "\uFB66",
  38834. "\u0679",
  38835. "\uFB67",
  38836. "\u0679",
  38837. "\uFB68",
  38838. "\u0679",
  38839. "\uFB69",
  38840. "\u0679",
  38841. "\uFB6A",
  38842. "\u06A4",
  38843. "\uFB6B",
  38844. "\u06A4",
  38845. "\uFB6C",
  38846. "\u06A4",
  38847. "\uFB6D",
  38848. "\u06A4",
  38849. "\uFB6E",
  38850. "\u06A6",
  38851. "\uFB6F",
  38852. "\u06A6",
  38853. "\uFB70",
  38854. "\u06A6",
  38855. "\uFB71",
  38856. "\u06A6",
  38857. "\uFB72",
  38858. "\u0684",
  38859. "\uFB73",
  38860. "\u0684",
  38861. "\uFB74",
  38862. "\u0684",
  38863. "\uFB75",
  38864. "\u0684",
  38865. "\uFB76",
  38866. "\u0683",
  38867. "\uFB77",
  38868. "\u0683",
  38869. "\uFB78",
  38870. "\u0683",
  38871. "\uFB79",
  38872. "\u0683",
  38873. "\uFB7A",
  38874. "\u0686",
  38875. "\uFB7B",
  38876. "\u0686",
  38877. "\uFB7C",
  38878. "\u0686",
  38879. "\uFB7D",
  38880. "\u0686",
  38881. "\uFB7E",
  38882. "\u0687",
  38883. "\uFB7F",
  38884. "\u0687",
  38885. "\uFB80",
  38886. "\u0687",
  38887. "\uFB81",
  38888. "\u0687",
  38889. "\uFB82",
  38890. "\u068D",
  38891. "\uFB83",
  38892. "\u068D",
  38893. "\uFB84",
  38894. "\u068C",
  38895. "\uFB85",
  38896. "\u068C",
  38897. "\uFB86",
  38898. "\u068E",
  38899. "\uFB87",
  38900. "\u068E",
  38901. "\uFB88",
  38902. "\u0688",
  38903. "\uFB89",
  38904. "\u0688",
  38905. "\uFB8A",
  38906. "\u0698",
  38907. "\uFB8B",
  38908. "\u0698",
  38909. "\uFB8C",
  38910. "\u0691",
  38911. "\uFB8D",
  38912. "\u0691",
  38913. "\uFB8E",
  38914. "\u06A9",
  38915. "\uFB8F",
  38916. "\u06A9",
  38917. "\uFB90",
  38918. "\u06A9",
  38919. "\uFB91",
  38920. "\u06A9",
  38921. "\uFB92",
  38922. "\u06AF",
  38923. "\uFB93",
  38924. "\u06AF",
  38925. "\uFB94",
  38926. "\u06AF",
  38927. "\uFB95",
  38928. "\u06AF",
  38929. "\uFB96",
  38930. "\u06B3",
  38931. "\uFB97",
  38932. "\u06B3",
  38933. "\uFB98",
  38934. "\u06B3",
  38935. "\uFB99",
  38936. "\u06B3",
  38937. "\uFB9A",
  38938. "\u06B1",
  38939. "\uFB9B",
  38940. "\u06B1",
  38941. "\uFB9C",
  38942. "\u06B1",
  38943. "\uFB9D",
  38944. "\u06B1",
  38945. "\uFB9E",
  38946. "\u06BA",
  38947. "\uFB9F",
  38948. "\u06BA",
  38949. "\uFBA0",
  38950. "\u06BB",
  38951. "\uFBA1",
  38952. "\u06BB",
  38953. "\uFBA2",
  38954. "\u06BB",
  38955. "\uFBA3",
  38956. "\u06BB",
  38957. "\uFBA4",
  38958. "\u06C0",
  38959. "\uFBA5",
  38960. "\u06C0",
  38961. "\uFBA6",
  38962. "\u06C1",
  38963. "\uFBA7",
  38964. "\u06C1",
  38965. "\uFBA8",
  38966. "\u06C1",
  38967. "\uFBA9",
  38968. "\u06C1",
  38969. "\uFBAA",
  38970. "\u06BE",
  38971. "\uFBAB",
  38972. "\u06BE",
  38973. "\uFBAC",
  38974. "\u06BE",
  38975. "\uFBAD",
  38976. "\u06BE",
  38977. "\uFBAE",
  38978. "\u06D2",
  38979. "\uFBAF",
  38980. "\u06D2",
  38981. "\uFBB0",
  38982. "\u06D3",
  38983. "\uFBB1",
  38984. "\u06D3",
  38985. "\uFBD3",
  38986. "\u06AD",
  38987. "\uFBD4",
  38988. "\u06AD",
  38989. "\uFBD5",
  38990. "\u06AD",
  38991. "\uFBD6",
  38992. "\u06AD",
  38993. "\uFBD7",
  38994. "\u06C7",
  38995. "\uFBD8",
  38996. "\u06C7",
  38997. "\uFBD9",
  38998. "\u06C6",
  38999. "\uFBDA",
  39000. "\u06C6",
  39001. "\uFBDB",
  39002. "\u06C8",
  39003. "\uFBDC",
  39004. "\u06C8",
  39005. "\uFBDD",
  39006. "\u0677",
  39007. "\uFBDE",
  39008. "\u06CB",
  39009. "\uFBDF",
  39010. "\u06CB",
  39011. "\uFBE0",
  39012. "\u06C5",
  39013. "\uFBE1",
  39014. "\u06C5",
  39015. "\uFBE2",
  39016. "\u06C9",
  39017. "\uFBE3",
  39018. "\u06C9",
  39019. "\uFBE4",
  39020. "\u06D0",
  39021. "\uFBE5",
  39022. "\u06D0",
  39023. "\uFBE6",
  39024. "\u06D0",
  39025. "\uFBE7",
  39026. "\u06D0",
  39027. "\uFBE8",
  39028. "\u0649",
  39029. "\uFBE9",
  39030. "\u0649",
  39031. "\uFBEA",
  39032. "\u0626\u0627",
  39033. "\uFBEB",
  39034. "\u0626\u0627",
  39035. "\uFBEC",
  39036. "\u0626\u06D5",
  39037. "\uFBED",
  39038. "\u0626\u06D5",
  39039. "\uFBEE",
  39040. "\u0626\u0648",
  39041. "\uFBEF",
  39042. "\u0626\u0648",
  39043. "\uFBF0",
  39044. "\u0626\u06C7",
  39045. "\uFBF1",
  39046. "\u0626\u06C7",
  39047. "\uFBF2",
  39048. "\u0626\u06C6",
  39049. "\uFBF3",
  39050. "\u0626\u06C6",
  39051. "\uFBF4",
  39052. "\u0626\u06C8",
  39053. "\uFBF5",
  39054. "\u0626\u06C8",
  39055. "\uFBF6",
  39056. "\u0626\u06D0",
  39057. "\uFBF7",
  39058. "\u0626\u06D0",
  39059. "\uFBF8",
  39060. "\u0626\u06D0",
  39061. "\uFBF9",
  39062. "\u0626\u0649",
  39063. "\uFBFA",
  39064. "\u0626\u0649",
  39065. "\uFBFB",
  39066. "\u0626\u0649",
  39067. "\uFBFC",
  39068. "\u06CC",
  39069. "\uFBFD",
  39070. "\u06CC",
  39071. "\uFBFE",
  39072. "\u06CC",
  39073. "\uFBFF",
  39074. "\u06CC",
  39075. "\uFC00",
  39076. "\u0626\u062C",
  39077. "\uFC01",
  39078. "\u0626\u062D",
  39079. "\uFC02",
  39080. "\u0626\u0645",
  39081. "\uFC03",
  39082. "\u0626\u0649",
  39083. "\uFC04",
  39084. "\u0626\u064A",
  39085. "\uFC05",
  39086. "\u0628\u062C",
  39087. "\uFC06",
  39088. "\u0628\u062D",
  39089. "\uFC07",
  39090. "\u0628\u062E",
  39091. "\uFC08",
  39092. "\u0628\u0645",
  39093. "\uFC09",
  39094. "\u0628\u0649",
  39095. "\uFC0A",
  39096. "\u0628\u064A",
  39097. "\uFC0B",
  39098. "\u062A\u062C",
  39099. "\uFC0C",
  39100. "\u062A\u062D",
  39101. "\uFC0D",
  39102. "\u062A\u062E",
  39103. "\uFC0E",
  39104. "\u062A\u0645",
  39105. "\uFC0F",
  39106. "\u062A\u0649",
  39107. "\uFC10",
  39108. "\u062A\u064A",
  39109. "\uFC11",
  39110. "\u062B\u062C",
  39111. "\uFC12",
  39112. "\u062B\u0645",
  39113. "\uFC13",
  39114. "\u062B\u0649",
  39115. "\uFC14",
  39116. "\u062B\u064A",
  39117. "\uFC15",
  39118. "\u062C\u062D",
  39119. "\uFC16",
  39120. "\u062C\u0645",
  39121. "\uFC17",
  39122. "\u062D\u062C",
  39123. "\uFC18",
  39124. "\u062D\u0645",
  39125. "\uFC19",
  39126. "\u062E\u062C",
  39127. "\uFC1A",
  39128. "\u062E\u062D",
  39129. "\uFC1B",
  39130. "\u062E\u0645",
  39131. "\uFC1C",
  39132. "\u0633\u062C",
  39133. "\uFC1D",
  39134. "\u0633\u062D",
  39135. "\uFC1E",
  39136. "\u0633\u062E",
  39137. "\uFC1F",
  39138. "\u0633\u0645",
  39139. "\uFC20",
  39140. "\u0635\u062D",
  39141. "\uFC21",
  39142. "\u0635\u0645",
  39143. "\uFC22",
  39144. "\u0636\u062C",
  39145. "\uFC23",
  39146. "\u0636\u062D",
  39147. "\uFC24",
  39148. "\u0636\u062E",
  39149. "\uFC25",
  39150. "\u0636\u0645",
  39151. "\uFC26",
  39152. "\u0637\u062D",
  39153. "\uFC27",
  39154. "\u0637\u0645",
  39155. "\uFC28",
  39156. "\u0638\u0645",
  39157. "\uFC29",
  39158. "\u0639\u062C",
  39159. "\uFC2A",
  39160. "\u0639\u0645",
  39161. "\uFC2B",
  39162. "\u063A\u062C",
  39163. "\uFC2C",
  39164. "\u063A\u0645",
  39165. "\uFC2D",
  39166. "\u0641\u062C",
  39167. "\uFC2E",
  39168. "\u0641\u062D",
  39169. "\uFC2F",
  39170. "\u0641\u062E",
  39171. "\uFC30",
  39172. "\u0641\u0645",
  39173. "\uFC31",
  39174. "\u0641\u0649",
  39175. "\uFC32",
  39176. "\u0641\u064A",
  39177. "\uFC33",
  39178. "\u0642\u062D",
  39179. "\uFC34",
  39180. "\u0642\u0645",
  39181. "\uFC35",
  39182. "\u0642\u0649",
  39183. "\uFC36",
  39184. "\u0642\u064A",
  39185. "\uFC37",
  39186. "\u0643\u0627",
  39187. "\uFC38",
  39188. "\u0643\u062C",
  39189. "\uFC39",
  39190. "\u0643\u062D",
  39191. "\uFC3A",
  39192. "\u0643\u062E",
  39193. "\uFC3B",
  39194. "\u0643\u0644",
  39195. "\uFC3C",
  39196. "\u0643\u0645",
  39197. "\uFC3D",
  39198. "\u0643\u0649",
  39199. "\uFC3E",
  39200. "\u0643\u064A",
  39201. "\uFC3F",
  39202. "\u0644\u062C",
  39203. "\uFC40",
  39204. "\u0644\u062D",
  39205. "\uFC41",
  39206. "\u0644\u062E",
  39207. "\uFC42",
  39208. "\u0644\u0645",
  39209. "\uFC43",
  39210. "\u0644\u0649",
  39211. "\uFC44",
  39212. "\u0644\u064A",
  39213. "\uFC45",
  39214. "\u0645\u062C",
  39215. "\uFC46",
  39216. "\u0645\u062D",
  39217. "\uFC47",
  39218. "\u0645\u062E",
  39219. "\uFC48",
  39220. "\u0645\u0645",
  39221. "\uFC49",
  39222. "\u0645\u0649",
  39223. "\uFC4A",
  39224. "\u0645\u064A",
  39225. "\uFC4B",
  39226. "\u0646\u062C",
  39227. "\uFC4C",
  39228. "\u0646\u062D",
  39229. "\uFC4D",
  39230. "\u0646\u062E",
  39231. "\uFC4E",
  39232. "\u0646\u0645",
  39233. "\uFC4F",
  39234. "\u0646\u0649",
  39235. "\uFC50",
  39236. "\u0646\u064A",
  39237. "\uFC51",
  39238. "\u0647\u062C",
  39239. "\uFC52",
  39240. "\u0647\u0645",
  39241. "\uFC53",
  39242. "\u0647\u0649",
  39243. "\uFC54",
  39244. "\u0647\u064A",
  39245. "\uFC55",
  39246. "\u064A\u062C",
  39247. "\uFC56",
  39248. "\u064A\u062D",
  39249. "\uFC57",
  39250. "\u064A\u062E",
  39251. "\uFC58",
  39252. "\u064A\u0645",
  39253. "\uFC59",
  39254. "\u064A\u0649",
  39255. "\uFC5A",
  39256. "\u064A\u064A",
  39257. "\uFC5B",
  39258. "\u0630\u0670",
  39259. "\uFC5C",
  39260. "\u0631\u0670",
  39261. "\uFC5D",
  39262. "\u0649\u0670",
  39263. "\uFC5E",
  39264. "\u0020\u064C\u0651",
  39265. "\uFC5F",
  39266. "\u0020\u064D\u0651",
  39267. "\uFC60",
  39268. "\u0020\u064E\u0651",
  39269. "\uFC61",
  39270. "\u0020\u064F\u0651",
  39271. "\uFC62",
  39272. "\u0020\u0650\u0651",
  39273. "\uFC63",
  39274. "\u0020\u0651\u0670",
  39275. "\uFC64",
  39276. "\u0626\u0631",
  39277. "\uFC65",
  39278. "\u0626\u0632",
  39279. "\uFC66",
  39280. "\u0626\u0645",
  39281. "\uFC67",
  39282. "\u0626\u0646",
  39283. "\uFC68",
  39284. "\u0626\u0649",
  39285. "\uFC69",
  39286. "\u0626\u064A",
  39287. "\uFC6A",
  39288. "\u0628\u0631",
  39289. "\uFC6B",
  39290. "\u0628\u0632",
  39291. "\uFC6C",
  39292. "\u0628\u0645",
  39293. "\uFC6D",
  39294. "\u0628\u0646",
  39295. "\uFC6E",
  39296. "\u0628\u0649",
  39297. "\uFC6F",
  39298. "\u0628\u064A",
  39299. "\uFC70",
  39300. "\u062A\u0631",
  39301. "\uFC71",
  39302. "\u062A\u0632",
  39303. "\uFC72",
  39304. "\u062A\u0645",
  39305. "\uFC73",
  39306. "\u062A\u0646",
  39307. "\uFC74",
  39308. "\u062A\u0649",
  39309. "\uFC75",
  39310. "\u062A\u064A",
  39311. "\uFC76",
  39312. "\u062B\u0631",
  39313. "\uFC77",
  39314. "\u062B\u0632",
  39315. "\uFC78",
  39316. "\u062B\u0645",
  39317. "\uFC79",
  39318. "\u062B\u0646",
  39319. "\uFC7A",
  39320. "\u062B\u0649",
  39321. "\uFC7B",
  39322. "\u062B\u064A",
  39323. "\uFC7C",
  39324. "\u0641\u0649",
  39325. "\uFC7D",
  39326. "\u0641\u064A",
  39327. "\uFC7E",
  39328. "\u0642\u0649",
  39329. "\uFC7F",
  39330. "\u0642\u064A",
  39331. "\uFC80",
  39332. "\u0643\u0627",
  39333. "\uFC81",
  39334. "\u0643\u0644",
  39335. "\uFC82",
  39336. "\u0643\u0645",
  39337. "\uFC83",
  39338. "\u0643\u0649",
  39339. "\uFC84",
  39340. "\u0643\u064A",
  39341. "\uFC85",
  39342. "\u0644\u0645",
  39343. "\uFC86",
  39344. "\u0644\u0649",
  39345. "\uFC87",
  39346. "\u0644\u064A",
  39347. "\uFC88",
  39348. "\u0645\u0627",
  39349. "\uFC89",
  39350. "\u0645\u0645",
  39351. "\uFC8A",
  39352. "\u0646\u0631",
  39353. "\uFC8B",
  39354. "\u0646\u0632",
  39355. "\uFC8C",
  39356. "\u0646\u0645",
  39357. "\uFC8D",
  39358. "\u0646\u0646",
  39359. "\uFC8E",
  39360. "\u0646\u0649",
  39361. "\uFC8F",
  39362. "\u0646\u064A",
  39363. "\uFC90",
  39364. "\u0649\u0670",
  39365. "\uFC91",
  39366. "\u064A\u0631",
  39367. "\uFC92",
  39368. "\u064A\u0632",
  39369. "\uFC93",
  39370. "\u064A\u0645",
  39371. "\uFC94",
  39372. "\u064A\u0646",
  39373. "\uFC95",
  39374. "\u064A\u0649",
  39375. "\uFC96",
  39376. "\u064A\u064A",
  39377. "\uFC97",
  39378. "\u0626\u062C",
  39379. "\uFC98",
  39380. "\u0626\u062D",
  39381. "\uFC99",
  39382. "\u0626\u062E",
  39383. "\uFC9A",
  39384. "\u0626\u0645",
  39385. "\uFC9B",
  39386. "\u0626\u0647",
  39387. "\uFC9C",
  39388. "\u0628\u062C",
  39389. "\uFC9D",
  39390. "\u0628\u062D",
  39391. "\uFC9E",
  39392. "\u0628\u062E",
  39393. "\uFC9F",
  39394. "\u0628\u0645",
  39395. "\uFCA0",
  39396. "\u0628\u0647",
  39397. "\uFCA1",
  39398. "\u062A\u062C",
  39399. "\uFCA2",
  39400. "\u062A\u062D",
  39401. "\uFCA3",
  39402. "\u062A\u062E",
  39403. "\uFCA4",
  39404. "\u062A\u0645",
  39405. "\uFCA5",
  39406. "\u062A\u0647",
  39407. "\uFCA6",
  39408. "\u062B\u0645",
  39409. "\uFCA7",
  39410. "\u062C\u062D",
  39411. "\uFCA8",
  39412. "\u062C\u0645",
  39413. "\uFCA9",
  39414. "\u062D\u062C",
  39415. "\uFCAA",
  39416. "\u062D\u0645",
  39417. "\uFCAB",
  39418. "\u062E\u062C",
  39419. "\uFCAC",
  39420. "\u062E\u0645",
  39421. "\uFCAD",
  39422. "\u0633\u062C",
  39423. "\uFCAE",
  39424. "\u0633\u062D",
  39425. "\uFCAF",
  39426. "\u0633\u062E",
  39427. "\uFCB0",
  39428. "\u0633\u0645",
  39429. "\uFCB1",
  39430. "\u0635\u062D",
  39431. "\uFCB2",
  39432. "\u0635\u062E",
  39433. "\uFCB3",
  39434. "\u0635\u0645",
  39435. "\uFCB4",
  39436. "\u0636\u062C",
  39437. "\uFCB5",
  39438. "\u0636\u062D",
  39439. "\uFCB6",
  39440. "\u0636\u062E",
  39441. "\uFCB7",
  39442. "\u0636\u0645",
  39443. "\uFCB8",
  39444. "\u0637\u062D",
  39445. "\uFCB9",
  39446. "\u0638\u0645",
  39447. "\uFCBA",
  39448. "\u0639\u062C",
  39449. "\uFCBB",
  39450. "\u0639\u0645",
  39451. "\uFCBC",
  39452. "\u063A\u062C",
  39453. "\uFCBD",
  39454. "\u063A\u0645",
  39455. "\uFCBE",
  39456. "\u0641\u062C",
  39457. "\uFCBF",
  39458. "\u0641\u062D",
  39459. "\uFCC0",
  39460. "\u0641\u062E",
  39461. "\uFCC1",
  39462. "\u0641\u0645",
  39463. "\uFCC2",
  39464. "\u0642\u062D",
  39465. "\uFCC3",
  39466. "\u0642\u0645",
  39467. "\uFCC4",
  39468. "\u0643\u062C",
  39469. "\uFCC5",
  39470. "\u0643\u062D",
  39471. "\uFCC6",
  39472. "\u0643\u062E",
  39473. "\uFCC7",
  39474. "\u0643\u0644",
  39475. "\uFCC8",
  39476. "\u0643\u0645",
  39477. "\uFCC9",
  39478. "\u0644\u062C",
  39479. "\uFCCA",
  39480. "\u0644\u062D",
  39481. "\uFCCB",
  39482. "\u0644\u062E",
  39483. "\uFCCC",
  39484. "\u0644\u0645",
  39485. "\uFCCD",
  39486. "\u0644\u0647",
  39487. "\uFCCE",
  39488. "\u0645\u062C",
  39489. "\uFCCF",
  39490. "\u0645\u062D",
  39491. "\uFCD0",
  39492. "\u0645\u062E",
  39493. "\uFCD1",
  39494. "\u0645\u0645",
  39495. "\uFCD2",
  39496. "\u0646\u062C",
  39497. "\uFCD3",
  39498. "\u0646\u062D",
  39499. "\uFCD4",
  39500. "\u0646\u062E",
  39501. "\uFCD5",
  39502. "\u0646\u0645",
  39503. "\uFCD6",
  39504. "\u0646\u0647",
  39505. "\uFCD7",
  39506. "\u0647\u062C",
  39507. "\uFCD8",
  39508. "\u0647\u0645",
  39509. "\uFCD9",
  39510. "\u0647\u0670",
  39511. "\uFCDA",
  39512. "\u064A\u062C",
  39513. "\uFCDB",
  39514. "\u064A\u062D",
  39515. "\uFCDC",
  39516. "\u064A\u062E",
  39517. "\uFCDD",
  39518. "\u064A\u0645",
  39519. "\uFCDE",
  39520. "\u064A\u0647",
  39521. "\uFCDF",
  39522. "\u0626\u0645",
  39523. "\uFCE0",
  39524. "\u0626\u0647",
  39525. "\uFCE1",
  39526. "\u0628\u0645",
  39527. "\uFCE2",
  39528. "\u0628\u0647",
  39529. "\uFCE3",
  39530. "\u062A\u0645",
  39531. "\uFCE4",
  39532. "\u062A\u0647",
  39533. "\uFCE5",
  39534. "\u062B\u0645",
  39535. "\uFCE6",
  39536. "\u062B\u0647",
  39537. "\uFCE7",
  39538. "\u0633\u0645",
  39539. "\uFCE8",
  39540. "\u0633\u0647",
  39541. "\uFCE9",
  39542. "\u0634\u0645",
  39543. "\uFCEA",
  39544. "\u0634\u0647",
  39545. "\uFCEB",
  39546. "\u0643\u0644",
  39547. "\uFCEC",
  39548. "\u0643\u0645",
  39549. "\uFCED",
  39550. "\u0644\u0645",
  39551. "\uFCEE",
  39552. "\u0646\u0645",
  39553. "\uFCEF",
  39554. "\u0646\u0647",
  39555. "\uFCF0",
  39556. "\u064A\u0645",
  39557. "\uFCF1",
  39558. "\u064A\u0647",
  39559. "\uFCF2",
  39560. "\u0640\u064E\u0651",
  39561. "\uFCF3",
  39562. "\u0640\u064F\u0651",
  39563. "\uFCF4",
  39564. "\u0640\u0650\u0651",
  39565. "\uFCF5",
  39566. "\u0637\u0649",
  39567. "\uFCF6",
  39568. "\u0637\u064A",
  39569. "\uFCF7",
  39570. "\u0639\u0649",
  39571. "\uFCF8",
  39572. "\u0639\u064A",
  39573. "\uFCF9",
  39574. "\u063A\u0649",
  39575. "\uFCFA",
  39576. "\u063A\u064A",
  39577. "\uFCFB",
  39578. "\u0633\u0649",
  39579. "\uFCFC",
  39580. "\u0633\u064A",
  39581. "\uFCFD",
  39582. "\u0634\u0649",
  39583. "\uFCFE",
  39584. "\u0634\u064A",
  39585. "\uFCFF",
  39586. "\u062D\u0649",
  39587. "\uFD00",
  39588. "\u062D\u064A",
  39589. "\uFD01",
  39590. "\u062C\u0649",
  39591. "\uFD02",
  39592. "\u062C\u064A",
  39593. "\uFD03",
  39594. "\u062E\u0649",
  39595. "\uFD04",
  39596. "\u062E\u064A",
  39597. "\uFD05",
  39598. "\u0635\u0649",
  39599. "\uFD06",
  39600. "\u0635\u064A",
  39601. "\uFD07",
  39602. "\u0636\u0649",
  39603. "\uFD08",
  39604. "\u0636\u064A",
  39605. "\uFD09",
  39606. "\u0634\u062C",
  39607. "\uFD0A",
  39608. "\u0634\u062D",
  39609. "\uFD0B",
  39610. "\u0634\u062E",
  39611. "\uFD0C",
  39612. "\u0634\u0645",
  39613. "\uFD0D",
  39614. "\u0634\u0631",
  39615. "\uFD0E",
  39616. "\u0633\u0631",
  39617. "\uFD0F",
  39618. "\u0635\u0631",
  39619. "\uFD10",
  39620. "\u0636\u0631",
  39621. "\uFD11",
  39622. "\u0637\u0649",
  39623. "\uFD12",
  39624. "\u0637\u064A",
  39625. "\uFD13",
  39626. "\u0639\u0649",
  39627. "\uFD14",
  39628. "\u0639\u064A",
  39629. "\uFD15",
  39630. "\u063A\u0649",
  39631. "\uFD16",
  39632. "\u063A\u064A",
  39633. "\uFD17",
  39634. "\u0633\u0649",
  39635. "\uFD18",
  39636. "\u0633\u064A",
  39637. "\uFD19",
  39638. "\u0634\u0649",
  39639. "\uFD1A",
  39640. "\u0634\u064A",
  39641. "\uFD1B",
  39642. "\u062D\u0649",
  39643. "\uFD1C",
  39644. "\u062D\u064A",
  39645. "\uFD1D",
  39646. "\u062C\u0649",
  39647. "\uFD1E",
  39648. "\u062C\u064A",
  39649. "\uFD1F",
  39650. "\u062E\u0649",
  39651. "\uFD20",
  39652. "\u062E\u064A",
  39653. "\uFD21",
  39654. "\u0635\u0649",
  39655. "\uFD22",
  39656. "\u0635\u064A",
  39657. "\uFD23",
  39658. "\u0636\u0649",
  39659. "\uFD24",
  39660. "\u0636\u064A",
  39661. "\uFD25",
  39662. "\u0634\u062C",
  39663. "\uFD26",
  39664. "\u0634\u062D",
  39665. "\uFD27",
  39666. "\u0634\u062E",
  39667. "\uFD28",
  39668. "\u0634\u0645",
  39669. "\uFD29",
  39670. "\u0634\u0631",
  39671. "\uFD2A",
  39672. "\u0633\u0631",
  39673. "\uFD2B",
  39674. "\u0635\u0631",
  39675. "\uFD2C",
  39676. "\u0636\u0631",
  39677. "\uFD2D",
  39678. "\u0634\u062C",
  39679. "\uFD2E",
  39680. "\u0634\u062D",
  39681. "\uFD2F",
  39682. "\u0634\u062E",
  39683. "\uFD30",
  39684. "\u0634\u0645",
  39685. "\uFD31",
  39686. "\u0633\u0647",
  39687. "\uFD32",
  39688. "\u0634\u0647",
  39689. "\uFD33",
  39690. "\u0637\u0645",
  39691. "\uFD34",
  39692. "\u0633\u062C",
  39693. "\uFD35",
  39694. "\u0633\u062D",
  39695. "\uFD36",
  39696. "\u0633\u062E",
  39697. "\uFD37",
  39698. "\u0634\u062C",
  39699. "\uFD38",
  39700. "\u0634\u062D",
  39701. "\uFD39",
  39702. "\u0634\u062E",
  39703. "\uFD3A",
  39704. "\u0637\u0645",
  39705. "\uFD3B",
  39706. "\u0638\u0645",
  39707. "\uFD3C",
  39708. "\u0627\u064B",
  39709. "\uFD3D",
  39710. "\u0627\u064B",
  39711. "\uFD50",
  39712. "\u062A\u062C\u0645",
  39713. "\uFD51",
  39714. "\u062A\u062D\u062C",
  39715. "\uFD52",
  39716. "\u062A\u062D\u062C",
  39717. "\uFD53",
  39718. "\u062A\u062D\u0645",
  39719. "\uFD54",
  39720. "\u062A\u062E\u0645",
  39721. "\uFD55",
  39722. "\u062A\u0645\u062C",
  39723. "\uFD56",
  39724. "\u062A\u0645\u062D",
  39725. "\uFD57",
  39726. "\u062A\u0645\u062E",
  39727. "\uFD58",
  39728. "\u062C\u0645\u062D",
  39729. "\uFD59",
  39730. "\u062C\u0645\u062D",
  39731. "\uFD5A",
  39732. "\u062D\u0645\u064A",
  39733. "\uFD5B",
  39734. "\u062D\u0645\u0649",
  39735. "\uFD5C",
  39736. "\u0633\u062D\u062C",
  39737. "\uFD5D",
  39738. "\u0633\u062C\u062D",
  39739. "\uFD5E",
  39740. "\u0633\u062C\u0649",
  39741. "\uFD5F",
  39742. "\u0633\u0645\u062D",
  39743. "\uFD60",
  39744. "\u0633\u0645\u062D",
  39745. "\uFD61",
  39746. "\u0633\u0645\u062C",
  39747. "\uFD62",
  39748. "\u0633\u0645\u0645",
  39749. "\uFD63",
  39750. "\u0633\u0645\u0645",
  39751. "\uFD64",
  39752. "\u0635\u062D\u062D",
  39753. "\uFD65",
  39754. "\u0635\u062D\u062D",
  39755. "\uFD66",
  39756. "\u0635\u0645\u0645",
  39757. "\uFD67",
  39758. "\u0634\u062D\u0645",
  39759. "\uFD68",
  39760. "\u0634\u062D\u0645",
  39761. "\uFD69",
  39762. "\u0634\u062C\u064A",
  39763. "\uFD6A",
  39764. "\u0634\u0645\u062E",
  39765. "\uFD6B",
  39766. "\u0634\u0645\u062E",
  39767. "\uFD6C",
  39768. "\u0634\u0645\u0645",
  39769. "\uFD6D",
  39770. "\u0634\u0645\u0645",
  39771. "\uFD6E",
  39772. "\u0636\u062D\u0649",
  39773. "\uFD6F",
  39774. "\u0636\u062E\u0645",
  39775. "\uFD70",
  39776. "\u0636\u062E\u0645",
  39777. "\uFD71",
  39778. "\u0637\u0645\u062D",
  39779. "\uFD72",
  39780. "\u0637\u0645\u062D",
  39781. "\uFD73",
  39782. "\u0637\u0645\u0645",
  39783. "\uFD74",
  39784. "\u0637\u0645\u064A",
  39785. "\uFD75",
  39786. "\u0639\u062C\u0645",
  39787. "\uFD76",
  39788. "\u0639\u0645\u0645",
  39789. "\uFD77",
  39790. "\u0639\u0645\u0645",
  39791. "\uFD78",
  39792. "\u0639\u0645\u0649",
  39793. "\uFD79",
  39794. "\u063A\u0645\u0645",
  39795. "\uFD7A",
  39796. "\u063A\u0645\u064A",
  39797. "\uFD7B",
  39798. "\u063A\u0645\u0649",
  39799. "\uFD7C",
  39800. "\u0641\u062E\u0645",
  39801. "\uFD7D",
  39802. "\u0641\u062E\u0645",
  39803. "\uFD7E",
  39804. "\u0642\u0645\u062D",
  39805. "\uFD7F",
  39806. "\u0642\u0645\u0645",
  39807. "\uFD80",
  39808. "\u0644\u062D\u0645",
  39809. "\uFD81",
  39810. "\u0644\u062D\u064A",
  39811. "\uFD82",
  39812. "\u0644\u062D\u0649",
  39813. "\uFD83",
  39814. "\u0644\u062C\u062C",
  39815. "\uFD84",
  39816. "\u0644\u062C\u062C",
  39817. "\uFD85",
  39818. "\u0644\u062E\u0645",
  39819. "\uFD86",
  39820. "\u0644\u062E\u0645",
  39821. "\uFD87",
  39822. "\u0644\u0645\u062D",
  39823. "\uFD88",
  39824. "\u0644\u0645\u062D",
  39825. "\uFD89",
  39826. "\u0645\u062D\u062C",
  39827. "\uFD8A",
  39828. "\u0645\u062D\u0645",
  39829. "\uFD8B",
  39830. "\u0645\u062D\u064A",
  39831. "\uFD8C",
  39832. "\u0645\u062C\u062D",
  39833. "\uFD8D",
  39834. "\u0645\u062C\u0645",
  39835. "\uFD8E",
  39836. "\u0645\u062E\u062C",
  39837. "\uFD8F",
  39838. "\u0645\u062E\u0645",
  39839. "\uFD92",
  39840. "\u0645\u062C\u062E",
  39841. "\uFD93",
  39842. "\u0647\u0645\u062C",
  39843. "\uFD94",
  39844. "\u0647\u0645\u0645",
  39845. "\uFD95",
  39846. "\u0646\u062D\u0645",
  39847. "\uFD96",
  39848. "\u0646\u062D\u0649",
  39849. "\uFD97",
  39850. "\u0646\u062C\u0645",
  39851. "\uFD98",
  39852. "\u0646\u062C\u0645",
  39853. "\uFD99",
  39854. "\u0646\u062C\u0649",
  39855. "\uFD9A",
  39856. "\u0646\u0645\u064A",
  39857. "\uFD9B",
  39858. "\u0646\u0645\u0649",
  39859. "\uFD9C",
  39860. "\u064A\u0645\u0645",
  39861. "\uFD9D",
  39862. "\u064A\u0645\u0645",
  39863. "\uFD9E",
  39864. "\u0628\u062E\u064A",
  39865. "\uFD9F",
  39866. "\u062A\u062C\u064A",
  39867. "\uFDA0",
  39868. "\u062A\u062C\u0649",
  39869. "\uFDA1",
  39870. "\u062A\u062E\u064A",
  39871. "\uFDA2",
  39872. "\u062A\u062E\u0649",
  39873. "\uFDA3",
  39874. "\u062A\u0645\u064A",
  39875. "\uFDA4",
  39876. "\u062A\u0645\u0649",
  39877. "\uFDA5",
  39878. "\u062C\u0645\u064A",
  39879. "\uFDA6",
  39880. "\u062C\u062D\u0649",
  39881. "\uFDA7",
  39882. "\u062C\u0645\u0649",
  39883. "\uFDA8",
  39884. "\u0633\u062E\u0649",
  39885. "\uFDA9",
  39886. "\u0635\u062D\u064A",
  39887. "\uFDAA",
  39888. "\u0634\u062D\u064A",
  39889. "\uFDAB",
  39890. "\u0636\u062D\u064A",
  39891. "\uFDAC",
  39892. "\u0644\u062C\u064A",
  39893. "\uFDAD",
  39894. "\u0644\u0645\u064A",
  39895. "\uFDAE",
  39896. "\u064A\u062D\u064A",
  39897. "\uFDAF",
  39898. "\u064A\u062C\u064A",
  39899. "\uFDB0",
  39900. "\u064A\u0645\u064A",
  39901. "\uFDB1",
  39902. "\u0645\u0645\u064A",
  39903. "\uFDB2",
  39904. "\u0642\u0645\u064A",
  39905. "\uFDB3",
  39906. "\u0646\u062D\u064A",
  39907. "\uFDB4",
  39908. "\u0642\u0645\u062D",
  39909. "\uFDB5",
  39910. "\u0644\u062D\u0645",
  39911. "\uFDB6",
  39912. "\u0639\u0645\u064A",
  39913. "\uFDB7",
  39914. "\u0643\u0645\u064A",
  39915. "\uFDB8",
  39916. "\u0646\u062C\u062D",
  39917. "\uFDB9",
  39918. "\u0645\u062E\u064A",
  39919. "\uFDBA",
  39920. "\u0644\u062C\u0645",
  39921. "\uFDBB",
  39922. "\u0643\u0645\u0645",
  39923. "\uFDBC",
  39924. "\u0644\u062C\u0645",
  39925. "\uFDBD",
  39926. "\u0646\u062C\u062D",
  39927. "\uFDBE",
  39928. "\u062C\u062D\u064A",
  39929. "\uFDBF",
  39930. "\u062D\u062C\u064A",
  39931. "\uFDC0",
  39932. "\u0645\u062C\u064A",
  39933. "\uFDC1",
  39934. "\u0641\u0645\u064A",
  39935. "\uFDC2",
  39936. "\u0628\u062D\u064A",
  39937. "\uFDC3",
  39938. "\u0643\u0645\u0645",
  39939. "\uFDC4",
  39940. "\u0639\u062C\u0645",
  39941. "\uFDC5",
  39942. "\u0635\u0645\u0645",
  39943. "\uFDC6",
  39944. "\u0633\u062E\u064A",
  39945. "\uFDC7",
  39946. "\u0646\u062C\u064A",
  39947. "\uFE49",
  39948. "\u203E",
  39949. "\uFE4A",
  39950. "\u203E",
  39951. "\uFE4B",
  39952. "\u203E",
  39953. "\uFE4C",
  39954. "\u203E",
  39955. "\uFE4D",
  39956. "\u005F",
  39957. "\uFE4E",
  39958. "\u005F",
  39959. "\uFE4F",
  39960. "\u005F",
  39961. "\uFE80",
  39962. "\u0621",
  39963. "\uFE81",
  39964. "\u0622",
  39965. "\uFE82",
  39966. "\u0622",
  39967. "\uFE83",
  39968. "\u0623",
  39969. "\uFE84",
  39970. "\u0623",
  39971. "\uFE85",
  39972. "\u0624",
  39973. "\uFE86",
  39974. "\u0624",
  39975. "\uFE87",
  39976. "\u0625",
  39977. "\uFE88",
  39978. "\u0625",
  39979. "\uFE89",
  39980. "\u0626",
  39981. "\uFE8A",
  39982. "\u0626",
  39983. "\uFE8B",
  39984. "\u0626",
  39985. "\uFE8C",
  39986. "\u0626",
  39987. "\uFE8D",
  39988. "\u0627",
  39989. "\uFE8E",
  39990. "\u0627",
  39991. "\uFE8F",
  39992. "\u0628",
  39993. "\uFE90",
  39994. "\u0628",
  39995. "\uFE91",
  39996. "\u0628",
  39997. "\uFE92",
  39998. "\u0628",
  39999. "\uFE93",
  40000. "\u0629",
  40001. "\uFE94",
  40002. "\u0629",
  40003. "\uFE95",
  40004. "\u062A",
  40005. "\uFE96",
  40006. "\u062A",
  40007. "\uFE97",
  40008. "\u062A",
  40009. "\uFE98",
  40010. "\u062A",
  40011. "\uFE99",
  40012. "\u062B",
  40013. "\uFE9A",
  40014. "\u062B",
  40015. "\uFE9B",
  40016. "\u062B",
  40017. "\uFE9C",
  40018. "\u062B",
  40019. "\uFE9D",
  40020. "\u062C",
  40021. "\uFE9E",
  40022. "\u062C",
  40023. "\uFE9F",
  40024. "\u062C",
  40025. "\uFEA0",
  40026. "\u062C",
  40027. "\uFEA1",
  40028. "\u062D",
  40029. "\uFEA2",
  40030. "\u062D",
  40031. "\uFEA3",
  40032. "\u062D",
  40033. "\uFEA4",
  40034. "\u062D",
  40035. "\uFEA5",
  40036. "\u062E",
  40037. "\uFEA6",
  40038. "\u062E",
  40039. "\uFEA7",
  40040. "\u062E",
  40041. "\uFEA8",
  40042. "\u062E",
  40043. "\uFEA9",
  40044. "\u062F",
  40045. "\uFEAA",
  40046. "\u062F",
  40047. "\uFEAB",
  40048. "\u0630",
  40049. "\uFEAC",
  40050. "\u0630",
  40051. "\uFEAD",
  40052. "\u0631",
  40053. "\uFEAE",
  40054. "\u0631",
  40055. "\uFEAF",
  40056. "\u0632",
  40057. "\uFEB0",
  40058. "\u0632",
  40059. "\uFEB1",
  40060. "\u0633",
  40061. "\uFEB2",
  40062. "\u0633",
  40063. "\uFEB3",
  40064. "\u0633",
  40065. "\uFEB4",
  40066. "\u0633",
  40067. "\uFEB5",
  40068. "\u0634",
  40069. "\uFEB6",
  40070. "\u0634",
  40071. "\uFEB7",
  40072. "\u0634",
  40073. "\uFEB8",
  40074. "\u0634",
  40075. "\uFEB9",
  40076. "\u0635",
  40077. "\uFEBA",
  40078. "\u0635",
  40079. "\uFEBB",
  40080. "\u0635",
  40081. "\uFEBC",
  40082. "\u0635",
  40083. "\uFEBD",
  40084. "\u0636",
  40085. "\uFEBE",
  40086. "\u0636",
  40087. "\uFEBF",
  40088. "\u0636",
  40089. "\uFEC0",
  40090. "\u0636",
  40091. "\uFEC1",
  40092. "\u0637",
  40093. "\uFEC2",
  40094. "\u0637",
  40095. "\uFEC3",
  40096. "\u0637",
  40097. "\uFEC4",
  40098. "\u0637",
  40099. "\uFEC5",
  40100. "\u0638",
  40101. "\uFEC6",
  40102. "\u0638",
  40103. "\uFEC7",
  40104. "\u0638",
  40105. "\uFEC8",
  40106. "\u0638",
  40107. "\uFEC9",
  40108. "\u0639",
  40109. "\uFECA",
  40110. "\u0639",
  40111. "\uFECB",
  40112. "\u0639",
  40113. "\uFECC",
  40114. "\u0639",
  40115. "\uFECD",
  40116. "\u063A",
  40117. "\uFECE",
  40118. "\u063A",
  40119. "\uFECF",
  40120. "\u063A",
  40121. "\uFED0",
  40122. "\u063A",
  40123. "\uFED1",
  40124. "\u0641",
  40125. "\uFED2",
  40126. "\u0641",
  40127. "\uFED3",
  40128. "\u0641",
  40129. "\uFED4",
  40130. "\u0641",
  40131. "\uFED5",
  40132. "\u0642",
  40133. "\uFED6",
  40134. "\u0642",
  40135. "\uFED7",
  40136. "\u0642",
  40137. "\uFED8",
  40138. "\u0642",
  40139. "\uFED9",
  40140. "\u0643",
  40141. "\uFEDA",
  40142. "\u0643",
  40143. "\uFEDB",
  40144. "\u0643",
  40145. "\uFEDC",
  40146. "\u0643",
  40147. "\uFEDD",
  40148. "\u0644",
  40149. "\uFEDE",
  40150. "\u0644",
  40151. "\uFEDF",
  40152. "\u0644",
  40153. "\uFEE0",
  40154. "\u0644",
  40155. "\uFEE1",
  40156. "\u0645",
  40157. "\uFEE2",
  40158. "\u0645",
  40159. "\uFEE3",
  40160. "\u0645",
  40161. "\uFEE4",
  40162. "\u0645",
  40163. "\uFEE5",
  40164. "\u0646",
  40165. "\uFEE6",
  40166. "\u0646",
  40167. "\uFEE7",
  40168. "\u0646",
  40169. "\uFEE8",
  40170. "\u0646",
  40171. "\uFEE9",
  40172. "\u0647",
  40173. "\uFEEA",
  40174. "\u0647",
  40175. "\uFEEB",
  40176. "\u0647",
  40177. "\uFEEC",
  40178. "\u0647",
  40179. "\uFEED",
  40180. "\u0648",
  40181. "\uFEEE",
  40182. "\u0648",
  40183. "\uFEEF",
  40184. "\u0649",
  40185. "\uFEF0",
  40186. "\u0649",
  40187. "\uFEF1",
  40188. "\u064A",
  40189. "\uFEF2",
  40190. "\u064A",
  40191. "\uFEF3",
  40192. "\u064A",
  40193. "\uFEF4",
  40194. "\u064A",
  40195. "\uFEF5",
  40196. "\u0644\u0622",
  40197. "\uFEF6",
  40198. "\u0644\u0622",
  40199. "\uFEF7",
  40200. "\u0644\u0623",
  40201. "\uFEF8",
  40202. "\u0644\u0623",
  40203. "\uFEF9",
  40204. "\u0644\u0625",
  40205. "\uFEFA",
  40206. "\u0644\u0625",
  40207. "\uFEFB",
  40208. "\u0644\u0627",
  40209. "\uFEFC",
  40210. "\u0644\u0627"
  40211. ];
  40212. });
  40213. function reverseIfRtl(chars) {
  40214. const charsLength = chars.length;
  40215. if (charsLength <= 1 || !isRTLRangeFor(chars.charCodeAt(0))) {
  40216. return chars;
  40217. }
  40218. const buf = [];
  40219. for (let ii = charsLength - 1; ii >= 0; ii--) {
  40220. buf.push(chars[ii]);
  40221. }
  40222. return buf.join("");
  40223. }
  40224. const SpecialCharRegExp = new RegExp("^(\\s)|(\\p{Mn})|(\\p{Cf})$", "u");
  40225. const CategoryCache = new Map();
  40226. function getCharUnicodeCategory(char) {
  40227. const cachedCategory = CategoryCache.get(char);
  40228. if (cachedCategory) {
  40229. return cachedCategory;
  40230. }
  40231. const groups = char.match(SpecialCharRegExp);
  40232. const category = {
  40233. isWhitespace: !!(groups && groups[1]),
  40234. isZeroWidthDiacritic: !!(groups && groups[2]),
  40235. isInvisibleFormatMark: !!(groups && groups[3])
  40236. };
  40237. CategoryCache.set(char, category);
  40238. return category;
  40239. }
  40240. function clearUnicodeCaches() {
  40241. CategoryCache.clear();
  40242. }
  40243. /***/ }),
  40244. /* 170 */
  40245. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  40246. "use strict";
  40247. Object.defineProperty(exports, "__esModule", ({
  40248. value: true
  40249. }));
  40250. exports.getSerifFonts = exports.getNonStdFontMap = exports.getGlyphMapForStandardFonts = exports.getFontNameToFileMap = void 0;
  40251. exports.getStandardFontName = getStandardFontName;
  40252. exports.getSymbolsFonts = exports.getSupplementalGlyphMapForCalibri = exports.getSupplementalGlyphMapForArialBlack = exports.getStdFontMap = void 0;
  40253. var _core_utils = __w_pdfjs_require__(135);
  40254. var _fonts_utils = __w_pdfjs_require__(167);
  40255. const getStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  40256. t["Times-Roman"] = "Times-Roman";
  40257. t.Helvetica = "Helvetica";
  40258. t.Courier = "Courier";
  40259. t.Symbol = "Symbol";
  40260. t["Times-Bold"] = "Times-Bold";
  40261. t["Helvetica-Bold"] = "Helvetica-Bold";
  40262. t["Courier-Bold"] = "Courier-Bold";
  40263. t.ZapfDingbats = "ZapfDingbats";
  40264. t["Times-Italic"] = "Times-Italic";
  40265. t["Helvetica-Oblique"] = "Helvetica-Oblique";
  40266. t["Courier-Oblique"] = "Courier-Oblique";
  40267. t["Times-BoldItalic"] = "Times-BoldItalic";
  40268. t["Helvetica-BoldOblique"] = "Helvetica-BoldOblique";
  40269. t["Courier-BoldOblique"] = "Courier-BoldOblique";
  40270. t.ArialNarrow = "Helvetica";
  40271. t["ArialNarrow-Bold"] = "Helvetica-Bold";
  40272. t["ArialNarrow-BoldItalic"] = "Helvetica-BoldOblique";
  40273. t["ArialNarrow-Italic"] = "Helvetica-Oblique";
  40274. t.ArialBlack = "Helvetica";
  40275. t["ArialBlack-Bold"] = "Helvetica-Bold";
  40276. t["ArialBlack-BoldItalic"] = "Helvetica-BoldOblique";
  40277. t["ArialBlack-Italic"] = "Helvetica-Oblique";
  40278. t["Arial-Black"] = "Helvetica";
  40279. t["Arial-Black-Bold"] = "Helvetica-Bold";
  40280. t["Arial-Black-BoldItalic"] = "Helvetica-BoldOblique";
  40281. t["Arial-Black-Italic"] = "Helvetica-Oblique";
  40282. t.Arial = "Helvetica";
  40283. t["Arial-Bold"] = "Helvetica-Bold";
  40284. t["Arial-BoldItalic"] = "Helvetica-BoldOblique";
  40285. t["Arial-Italic"] = "Helvetica-Oblique";
  40286. t.ArialMT = "Helvetica";
  40287. t["Arial-BoldItalicMT"] = "Helvetica-BoldOblique";
  40288. t["Arial-BoldMT"] = "Helvetica-Bold";
  40289. t["Arial-ItalicMT"] = "Helvetica-Oblique";
  40290. t.ArialUnicodeMS = "Helvetica";
  40291. t["ArialUnicodeMS-Bold"] = "Helvetica-Bold";
  40292. t["ArialUnicodeMS-BoldItalic"] = "Helvetica-BoldOblique";
  40293. t["ArialUnicodeMS-Italic"] = "Helvetica-Oblique";
  40294. t["Courier-BoldItalic"] = "Courier-BoldOblique";
  40295. t["Courier-Italic"] = "Courier-Oblique";
  40296. t.CourierNew = "Courier";
  40297. t["CourierNew-Bold"] = "Courier-Bold";
  40298. t["CourierNew-BoldItalic"] = "Courier-BoldOblique";
  40299. t["CourierNew-Italic"] = "Courier-Oblique";
  40300. t["CourierNewPS-BoldItalicMT"] = "Courier-BoldOblique";
  40301. t["CourierNewPS-BoldMT"] = "Courier-Bold";
  40302. t["CourierNewPS-ItalicMT"] = "Courier-Oblique";
  40303. t.CourierNewPSMT = "Courier";
  40304. t["Helvetica-BoldItalic"] = "Helvetica-BoldOblique";
  40305. t["Helvetica-Italic"] = "Helvetica-Oblique";
  40306. t["Symbol-Bold"] = "Symbol";
  40307. t["Symbol-BoldItalic"] = "Symbol";
  40308. t["Symbol-Italic"] = "Symbol";
  40309. t.TimesNewRoman = "Times-Roman";
  40310. t["TimesNewRoman-Bold"] = "Times-Bold";
  40311. t["TimesNewRoman-BoldItalic"] = "Times-BoldItalic";
  40312. t["TimesNewRoman-Italic"] = "Times-Italic";
  40313. t.TimesNewRomanPS = "Times-Roman";
  40314. t["TimesNewRomanPS-Bold"] = "Times-Bold";
  40315. t["TimesNewRomanPS-BoldItalic"] = "Times-BoldItalic";
  40316. t["TimesNewRomanPS-BoldItalicMT"] = "Times-BoldItalic";
  40317. t["TimesNewRomanPS-BoldMT"] = "Times-Bold";
  40318. t["TimesNewRomanPS-Italic"] = "Times-Italic";
  40319. t["TimesNewRomanPS-ItalicMT"] = "Times-Italic";
  40320. t.TimesNewRomanPSMT = "Times-Roman";
  40321. t["TimesNewRomanPSMT-Bold"] = "Times-Bold";
  40322. t["TimesNewRomanPSMT-BoldItalic"] = "Times-BoldItalic";
  40323. t["TimesNewRomanPSMT-Italic"] = "Times-Italic";
  40324. });
  40325. exports.getStdFontMap = getStdFontMap;
  40326. const getFontNameToFileMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  40327. t.Courier = "FoxitFixed.pfb";
  40328. t["Courier-Bold"] = "FoxitFixedBold.pfb";
  40329. t["Courier-BoldOblique"] = "FoxitFixedBoldItalic.pfb";
  40330. t["Courier-Oblique"] = "FoxitFixedItalic.pfb";
  40331. t.Helvetica = "FoxitSans.pfb";
  40332. t["Helvetica-Bold"] = "FoxitSansBold.pfb";
  40333. t["Helvetica-BoldOblique"] = "FoxitSansBoldItalic.pfb";
  40334. t["Helvetica-Oblique"] = "FoxitSansItalic.pfb";
  40335. t["Times-Roman"] = "FoxitSerif.pfb";
  40336. t["Times-Bold"] = "FoxitSerifBold.pfb";
  40337. t["Times-BoldItalic"] = "FoxitSerifBoldItalic.pfb";
  40338. t["Times-Italic"] = "FoxitSerifItalic.pfb";
  40339. t.Symbol = "FoxitSymbol.pfb";
  40340. t.ZapfDingbats = "FoxitDingbats.pfb";
  40341. t["LiberationSans-Regular"] = "LiberationSans-Regular.ttf";
  40342. t["LiberationSans-Bold"] = "LiberationSans-Bold.ttf";
  40343. t["LiberationSans-Italic"] = "LiberationSans-Italic.ttf";
  40344. t["LiberationSans-BoldItalic"] = "LiberationSans-BoldItalic.ttf";
  40345. });
  40346. exports.getFontNameToFileMap = getFontNameToFileMap;
  40347. const getNonStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  40348. t.Calibri = "Helvetica";
  40349. t["Calibri-Bold"] = "Helvetica-Bold";
  40350. t["Calibri-BoldItalic"] = "Helvetica-BoldOblique";
  40351. t["Calibri-Italic"] = "Helvetica-Oblique";
  40352. t.CenturyGothic = "Helvetica";
  40353. t["CenturyGothic-Bold"] = "Helvetica-Bold";
  40354. t["CenturyGothic-BoldItalic"] = "Helvetica-BoldOblique";
  40355. t["CenturyGothic-Italic"] = "Helvetica-Oblique";
  40356. t.ComicSansMS = "Comic Sans MS";
  40357. t["ComicSansMS-Bold"] = "Comic Sans MS-Bold";
  40358. t["ComicSansMS-BoldItalic"] = "Comic Sans MS-BoldItalic";
  40359. t["ComicSansMS-Italic"] = "Comic Sans MS-Italic";
  40360. t["ItcSymbol-Bold"] = "Helvetica-Bold";
  40361. t["ItcSymbol-BoldItalic"] = "Helvetica-BoldOblique";
  40362. t["ItcSymbol-Book"] = "Helvetica";
  40363. t["ItcSymbol-BookItalic"] = "Helvetica-Oblique";
  40364. t["ItcSymbol-Medium"] = "Helvetica";
  40365. t["ItcSymbol-MediumItalic"] = "Helvetica-Oblique";
  40366. t.LucidaConsole = "Courier";
  40367. t["LucidaConsole-Bold"] = "Courier-Bold";
  40368. t["LucidaConsole-BoldItalic"] = "Courier-BoldOblique";
  40369. t["LucidaConsole-Italic"] = "Courier-Oblique";
  40370. t["LucidaSans-Demi"] = "Helvetica-Bold";
  40371. t["MS-Gothic"] = "MS Gothic";
  40372. t["MS-Gothic-Bold"] = "MS Gothic-Bold";
  40373. t["MS-Gothic-BoldItalic"] = "MS Gothic-BoldItalic";
  40374. t["MS-Gothic-Italic"] = "MS Gothic-Italic";
  40375. t["MS-Mincho"] = "MS Mincho";
  40376. t["MS-Mincho-Bold"] = "MS Mincho-Bold";
  40377. t["MS-Mincho-BoldItalic"] = "MS Mincho-BoldItalic";
  40378. t["MS-Mincho-Italic"] = "MS Mincho-Italic";
  40379. t["MS-PGothic"] = "MS PGothic";
  40380. t["MS-PGothic-Bold"] = "MS PGothic-Bold";
  40381. t["MS-PGothic-BoldItalic"] = "MS PGothic-BoldItalic";
  40382. t["MS-PGothic-Italic"] = "MS PGothic-Italic";
  40383. t["MS-PMincho"] = "MS PMincho";
  40384. t["MS-PMincho-Bold"] = "MS PMincho-Bold";
  40385. t["MS-PMincho-BoldItalic"] = "MS PMincho-BoldItalic";
  40386. t["MS-PMincho-Italic"] = "MS PMincho-Italic";
  40387. t.NuptialScript = "Times-Italic";
  40388. t.SegoeUISymbol = "Helvetica";
  40389. t.Wingdings = "ZapfDingbats";
  40390. t["Wingdings-Regular"] = "ZapfDingbats";
  40391. });
  40392. exports.getNonStdFontMap = getNonStdFontMap;
  40393. const getSerifFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
  40394. t["Adobe Jenson"] = true;
  40395. t["Adobe Text"] = true;
  40396. t.Albertus = true;
  40397. t.Aldus = true;
  40398. t.Alexandria = true;
  40399. t.Algerian = true;
  40400. t["American Typewriter"] = true;
  40401. t.Antiqua = true;
  40402. t.Apex = true;
  40403. t.Arno = true;
  40404. t.Aster = true;
  40405. t.Aurora = true;
  40406. t.Baskerville = true;
  40407. t.Bell = true;
  40408. t.Bembo = true;
  40409. t["Bembo Schoolbook"] = true;
  40410. t.Benguiat = true;
  40411. t["Berkeley Old Style"] = true;
  40412. t["Bernhard Modern"] = true;
  40413. t["Berthold City"] = true;
  40414. t.Bodoni = true;
  40415. t["Bauer Bodoni"] = true;
  40416. t["Book Antiqua"] = true;
  40417. t.Bookman = true;
  40418. t["Bordeaux Roman"] = true;
  40419. t["Californian FB"] = true;
  40420. t.Calisto = true;
  40421. t.Calvert = true;
  40422. t.Capitals = true;
  40423. t.Cambria = true;
  40424. t.Cartier = true;
  40425. t.Caslon = true;
  40426. t.Catull = true;
  40427. t.Centaur = true;
  40428. t["Century Old Style"] = true;
  40429. t["Century Schoolbook"] = true;
  40430. t.Chaparral = true;
  40431. t["Charis SIL"] = true;
  40432. t.Cheltenham = true;
  40433. t["Cholla Slab"] = true;
  40434. t.Clarendon = true;
  40435. t.Clearface = true;
  40436. t.Cochin = true;
  40437. t.Colonna = true;
  40438. t["Computer Modern"] = true;
  40439. t["Concrete Roman"] = true;
  40440. t.Constantia = true;
  40441. t["Cooper Black"] = true;
  40442. t.Corona = true;
  40443. t.Ecotype = true;
  40444. t.Egyptienne = true;
  40445. t.Elephant = true;
  40446. t.Excelsior = true;
  40447. t.Fairfield = true;
  40448. t["FF Scala"] = true;
  40449. t.Folkard = true;
  40450. t.Footlight = true;
  40451. t.FreeSerif = true;
  40452. t["Friz Quadrata"] = true;
  40453. t.Garamond = true;
  40454. t.Gentium = true;
  40455. t.Georgia = true;
  40456. t.Gloucester = true;
  40457. t["Goudy Old Style"] = true;
  40458. t["Goudy Schoolbook"] = true;
  40459. t["Goudy Pro Font"] = true;
  40460. t.Granjon = true;
  40461. t["Guardian Egyptian"] = true;
  40462. t.Heather = true;
  40463. t.Hercules = true;
  40464. t["High Tower Text"] = true;
  40465. t.Hiroshige = true;
  40466. t["Hoefler Text"] = true;
  40467. t["Humana Serif"] = true;
  40468. t.Imprint = true;
  40469. t["Ionic No. 5"] = true;
  40470. t.Janson = true;
  40471. t.Joanna = true;
  40472. t.Korinna = true;
  40473. t.Lexicon = true;
  40474. t.LiberationSerif = true;
  40475. t["Liberation Serif"] = true;
  40476. t["Linux Libertine"] = true;
  40477. t.Literaturnaya = true;
  40478. t.Lucida = true;
  40479. t["Lucida Bright"] = true;
  40480. t.Melior = true;
  40481. t.Memphis = true;
  40482. t.Miller = true;
  40483. t.Minion = true;
  40484. t.Modern = true;
  40485. t["Mona Lisa"] = true;
  40486. t["Mrs Eaves"] = true;
  40487. t["MS Serif"] = true;
  40488. t["Museo Slab"] = true;
  40489. t["New York"] = true;
  40490. t["Nimbus Roman"] = true;
  40491. t["NPS Rawlinson Roadway"] = true;
  40492. t.NuptialScript = true;
  40493. t.Palatino = true;
  40494. t.Perpetua = true;
  40495. t.Plantin = true;
  40496. t["Plantin Schoolbook"] = true;
  40497. t.Playbill = true;
  40498. t["Poor Richard"] = true;
  40499. t["Rawlinson Roadway"] = true;
  40500. t.Renault = true;
  40501. t.Requiem = true;
  40502. t.Rockwell = true;
  40503. t.Roman = true;
  40504. t["Rotis Serif"] = true;
  40505. t.Sabon = true;
  40506. t.Scala = true;
  40507. t.Seagull = true;
  40508. t.Sistina = true;
  40509. t.Souvenir = true;
  40510. t.STIX = true;
  40511. t["Stone Informal"] = true;
  40512. t["Stone Serif"] = true;
  40513. t.Sylfaen = true;
  40514. t.Times = true;
  40515. t.Trajan = true;
  40516. t["Trinité"] = true;
  40517. t["Trump Mediaeval"] = true;
  40518. t.Utopia = true;
  40519. t["Vale Type"] = true;
  40520. t["Bitstream Vera"] = true;
  40521. t["Vera Serif"] = true;
  40522. t.Versailles = true;
  40523. t.Wanted = true;
  40524. t.Weiss = true;
  40525. t["Wide Latin"] = true;
  40526. t.Windsor = true;
  40527. t.XITS = true;
  40528. });
  40529. exports.getSerifFonts = getSerifFonts;
  40530. const getSymbolsFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
  40531. t.Dingbats = true;
  40532. t.Symbol = true;
  40533. t.ZapfDingbats = true;
  40534. });
  40535. exports.getSymbolsFonts = getSymbolsFonts;
  40536. const getGlyphMapForStandardFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
  40537. t[2] = 10;
  40538. t[3] = 32;
  40539. t[4] = 33;
  40540. t[5] = 34;
  40541. t[6] = 35;
  40542. t[7] = 36;
  40543. t[8] = 37;
  40544. t[9] = 38;
  40545. t[10] = 39;
  40546. t[11] = 40;
  40547. t[12] = 41;
  40548. t[13] = 42;
  40549. t[14] = 43;
  40550. t[15] = 44;
  40551. t[16] = 45;
  40552. t[17] = 46;
  40553. t[18] = 47;
  40554. t[19] = 48;
  40555. t[20] = 49;
  40556. t[21] = 50;
  40557. t[22] = 51;
  40558. t[23] = 52;
  40559. t[24] = 53;
  40560. t[25] = 54;
  40561. t[26] = 55;
  40562. t[27] = 56;
  40563. t[28] = 57;
  40564. t[29] = 58;
  40565. t[30] = 894;
  40566. t[31] = 60;
  40567. t[32] = 61;
  40568. t[33] = 62;
  40569. t[34] = 63;
  40570. t[35] = 64;
  40571. t[36] = 65;
  40572. t[37] = 66;
  40573. t[38] = 67;
  40574. t[39] = 68;
  40575. t[40] = 69;
  40576. t[41] = 70;
  40577. t[42] = 71;
  40578. t[43] = 72;
  40579. t[44] = 73;
  40580. t[45] = 74;
  40581. t[46] = 75;
  40582. t[47] = 76;
  40583. t[48] = 77;
  40584. t[49] = 78;
  40585. t[50] = 79;
  40586. t[51] = 80;
  40587. t[52] = 81;
  40588. t[53] = 82;
  40589. t[54] = 83;
  40590. t[55] = 84;
  40591. t[56] = 85;
  40592. t[57] = 86;
  40593. t[58] = 87;
  40594. t[59] = 88;
  40595. t[60] = 89;
  40596. t[61] = 90;
  40597. t[62] = 91;
  40598. t[63] = 92;
  40599. t[64] = 93;
  40600. t[65] = 94;
  40601. t[66] = 95;
  40602. t[67] = 96;
  40603. t[68] = 97;
  40604. t[69] = 98;
  40605. t[70] = 99;
  40606. t[71] = 100;
  40607. t[72] = 101;
  40608. t[73] = 102;
  40609. t[74] = 103;
  40610. t[75] = 104;
  40611. t[76] = 105;
  40612. t[77] = 106;
  40613. t[78] = 107;
  40614. t[79] = 108;
  40615. t[80] = 109;
  40616. t[81] = 110;
  40617. t[82] = 111;
  40618. t[83] = 112;
  40619. t[84] = 113;
  40620. t[85] = 114;
  40621. t[86] = 115;
  40622. t[87] = 116;
  40623. t[88] = 117;
  40624. t[89] = 118;
  40625. t[90] = 119;
  40626. t[91] = 120;
  40627. t[92] = 121;
  40628. t[93] = 122;
  40629. t[94] = 123;
  40630. t[95] = 124;
  40631. t[96] = 125;
  40632. t[97] = 126;
  40633. t[98] = 196;
  40634. t[99] = 197;
  40635. t[100] = 199;
  40636. t[101] = 201;
  40637. t[102] = 209;
  40638. t[103] = 214;
  40639. t[104] = 220;
  40640. t[105] = 225;
  40641. t[106] = 224;
  40642. t[107] = 226;
  40643. t[108] = 228;
  40644. t[109] = 227;
  40645. t[110] = 229;
  40646. t[111] = 231;
  40647. t[112] = 233;
  40648. t[113] = 232;
  40649. t[114] = 234;
  40650. t[115] = 235;
  40651. t[116] = 237;
  40652. t[117] = 236;
  40653. t[118] = 238;
  40654. t[119] = 239;
  40655. t[120] = 241;
  40656. t[121] = 243;
  40657. t[122] = 242;
  40658. t[123] = 244;
  40659. t[124] = 246;
  40660. t[125] = 245;
  40661. t[126] = 250;
  40662. t[127] = 249;
  40663. t[128] = 251;
  40664. t[129] = 252;
  40665. t[130] = 8224;
  40666. t[131] = 176;
  40667. t[132] = 162;
  40668. t[133] = 163;
  40669. t[134] = 167;
  40670. t[135] = 8226;
  40671. t[136] = 182;
  40672. t[137] = 223;
  40673. t[138] = 174;
  40674. t[139] = 169;
  40675. t[140] = 8482;
  40676. t[141] = 180;
  40677. t[142] = 168;
  40678. t[143] = 8800;
  40679. t[144] = 198;
  40680. t[145] = 216;
  40681. t[146] = 8734;
  40682. t[147] = 177;
  40683. t[148] = 8804;
  40684. t[149] = 8805;
  40685. t[150] = 165;
  40686. t[151] = 181;
  40687. t[152] = 8706;
  40688. t[153] = 8721;
  40689. t[154] = 8719;
  40690. t[156] = 8747;
  40691. t[157] = 170;
  40692. t[158] = 186;
  40693. t[159] = 8486;
  40694. t[160] = 230;
  40695. t[161] = 248;
  40696. t[162] = 191;
  40697. t[163] = 161;
  40698. t[164] = 172;
  40699. t[165] = 8730;
  40700. t[166] = 402;
  40701. t[167] = 8776;
  40702. t[168] = 8710;
  40703. t[169] = 171;
  40704. t[170] = 187;
  40705. t[171] = 8230;
  40706. t[179] = 8220;
  40707. t[180] = 8221;
  40708. t[181] = 8216;
  40709. t[182] = 8217;
  40710. t[200] = 193;
  40711. t[203] = 205;
  40712. t[210] = 218;
  40713. t[223] = 711;
  40714. t[224] = 321;
  40715. t[225] = 322;
  40716. t[226] = 352;
  40717. t[227] = 353;
  40718. t[228] = 381;
  40719. t[229] = 382;
  40720. t[233] = 221;
  40721. t[234] = 253;
  40722. t[252] = 263;
  40723. t[253] = 268;
  40724. t[254] = 269;
  40725. t[258] = 258;
  40726. t[260] = 260;
  40727. t[261] = 261;
  40728. t[265] = 280;
  40729. t[266] = 281;
  40730. t[267] = 282;
  40731. t[268] = 283;
  40732. t[269] = 313;
  40733. t[275] = 323;
  40734. t[276] = 324;
  40735. t[278] = 328;
  40736. t[283] = 344;
  40737. t[284] = 345;
  40738. t[285] = 346;
  40739. t[286] = 347;
  40740. t[292] = 367;
  40741. t[295] = 377;
  40742. t[296] = 378;
  40743. t[298] = 380;
  40744. t[305] = 963;
  40745. t[306] = 964;
  40746. t[307] = 966;
  40747. t[308] = 8215;
  40748. t[309] = 8252;
  40749. t[310] = 8319;
  40750. t[311] = 8359;
  40751. t[312] = 8592;
  40752. t[313] = 8593;
  40753. t[337] = 9552;
  40754. t[493] = 1039;
  40755. t[494] = 1040;
  40756. t[672] = 1488;
  40757. t[673] = 1489;
  40758. t[674] = 1490;
  40759. t[675] = 1491;
  40760. t[676] = 1492;
  40761. t[677] = 1493;
  40762. t[678] = 1494;
  40763. t[679] = 1495;
  40764. t[680] = 1496;
  40765. t[681] = 1497;
  40766. t[682] = 1498;
  40767. t[683] = 1499;
  40768. t[684] = 1500;
  40769. t[685] = 1501;
  40770. t[686] = 1502;
  40771. t[687] = 1503;
  40772. t[688] = 1504;
  40773. t[689] = 1505;
  40774. t[690] = 1506;
  40775. t[691] = 1507;
  40776. t[692] = 1508;
  40777. t[693] = 1509;
  40778. t[694] = 1510;
  40779. t[695] = 1511;
  40780. t[696] = 1512;
  40781. t[697] = 1513;
  40782. t[698] = 1514;
  40783. t[705] = 1524;
  40784. t[706] = 8362;
  40785. t[710] = 64288;
  40786. t[711] = 64298;
  40787. t[759] = 1617;
  40788. t[761] = 1776;
  40789. t[763] = 1778;
  40790. t[775] = 1652;
  40791. t[777] = 1764;
  40792. t[778] = 1780;
  40793. t[779] = 1781;
  40794. t[780] = 1782;
  40795. t[782] = 771;
  40796. t[783] = 64726;
  40797. t[786] = 8363;
  40798. t[788] = 8532;
  40799. t[790] = 768;
  40800. t[791] = 769;
  40801. t[792] = 768;
  40802. t[795] = 803;
  40803. t[797] = 64336;
  40804. t[798] = 64337;
  40805. t[799] = 64342;
  40806. t[800] = 64343;
  40807. t[801] = 64344;
  40808. t[802] = 64345;
  40809. t[803] = 64362;
  40810. t[804] = 64363;
  40811. t[805] = 64364;
  40812. t[2424] = 7821;
  40813. t[2425] = 7822;
  40814. t[2426] = 7823;
  40815. t[2427] = 7824;
  40816. t[2428] = 7825;
  40817. t[2429] = 7826;
  40818. t[2430] = 7827;
  40819. t[2433] = 7682;
  40820. t[2678] = 8045;
  40821. t[2679] = 8046;
  40822. t[2830] = 1552;
  40823. t[2838] = 686;
  40824. t[2840] = 751;
  40825. t[2842] = 753;
  40826. t[2843] = 754;
  40827. t[2844] = 755;
  40828. t[2846] = 757;
  40829. t[2856] = 767;
  40830. t[2857] = 848;
  40831. t[2858] = 849;
  40832. t[2862] = 853;
  40833. t[2863] = 854;
  40834. t[2864] = 855;
  40835. t[2865] = 861;
  40836. t[2866] = 862;
  40837. t[2906] = 7460;
  40838. t[2908] = 7462;
  40839. t[2909] = 7463;
  40840. t[2910] = 7464;
  40841. t[2912] = 7466;
  40842. t[2913] = 7467;
  40843. t[2914] = 7468;
  40844. t[2916] = 7470;
  40845. t[2917] = 7471;
  40846. t[2918] = 7472;
  40847. t[2920] = 7474;
  40848. t[2921] = 7475;
  40849. t[2922] = 7476;
  40850. t[2924] = 7478;
  40851. t[2925] = 7479;
  40852. t[2926] = 7480;
  40853. t[2928] = 7482;
  40854. t[2929] = 7483;
  40855. t[2930] = 7484;
  40856. t[2932] = 7486;
  40857. t[2933] = 7487;
  40858. t[2934] = 7488;
  40859. t[2936] = 7490;
  40860. t[2937] = 7491;
  40861. t[2938] = 7492;
  40862. t[2940] = 7494;
  40863. t[2941] = 7495;
  40864. t[2942] = 7496;
  40865. t[2944] = 7498;
  40866. t[2946] = 7500;
  40867. t[2948] = 7502;
  40868. t[2950] = 7504;
  40869. t[2951] = 7505;
  40870. t[2952] = 7506;
  40871. t[2954] = 7508;
  40872. t[2955] = 7509;
  40873. t[2956] = 7510;
  40874. t[2958] = 7512;
  40875. t[2959] = 7513;
  40876. t[2960] = 7514;
  40877. t[2962] = 7516;
  40878. t[2963] = 7517;
  40879. t[2964] = 7518;
  40880. t[2966] = 7520;
  40881. t[2967] = 7521;
  40882. t[2968] = 7522;
  40883. t[2970] = 7524;
  40884. t[2971] = 7525;
  40885. t[2972] = 7526;
  40886. t[2974] = 7528;
  40887. t[2975] = 7529;
  40888. t[2976] = 7530;
  40889. t[2978] = 1537;
  40890. t[2979] = 1538;
  40891. t[2980] = 1539;
  40892. t[2982] = 1549;
  40893. t[2983] = 1551;
  40894. t[2984] = 1552;
  40895. t[2986] = 1554;
  40896. t[2987] = 1555;
  40897. t[2988] = 1556;
  40898. t[2990] = 1623;
  40899. t[2991] = 1624;
  40900. t[2995] = 1775;
  40901. t[2999] = 1791;
  40902. t[3002] = 64290;
  40903. t[3003] = 64291;
  40904. t[3004] = 64292;
  40905. t[3006] = 64294;
  40906. t[3007] = 64295;
  40907. t[3008] = 64296;
  40908. t[3011] = 1900;
  40909. t[3014] = 8223;
  40910. t[3015] = 8244;
  40911. t[3017] = 7532;
  40912. t[3018] = 7533;
  40913. t[3019] = 7534;
  40914. t[3075] = 7590;
  40915. t[3076] = 7591;
  40916. t[3079] = 7594;
  40917. t[3080] = 7595;
  40918. t[3083] = 7598;
  40919. t[3084] = 7599;
  40920. t[3087] = 7602;
  40921. t[3088] = 7603;
  40922. t[3091] = 7606;
  40923. t[3092] = 7607;
  40924. t[3095] = 7610;
  40925. t[3096] = 7611;
  40926. t[3099] = 7614;
  40927. t[3100] = 7615;
  40928. t[3103] = 7618;
  40929. t[3104] = 7619;
  40930. t[3107] = 8337;
  40931. t[3108] = 8338;
  40932. t[3116] = 1884;
  40933. t[3119] = 1885;
  40934. t[3120] = 1885;
  40935. t[3123] = 1886;
  40936. t[3124] = 1886;
  40937. t[3127] = 1887;
  40938. t[3128] = 1887;
  40939. t[3131] = 1888;
  40940. t[3132] = 1888;
  40941. t[3135] = 1889;
  40942. t[3136] = 1889;
  40943. t[3139] = 1890;
  40944. t[3140] = 1890;
  40945. t[3143] = 1891;
  40946. t[3144] = 1891;
  40947. t[3147] = 1892;
  40948. t[3148] = 1892;
  40949. t[3153] = 580;
  40950. t[3154] = 581;
  40951. t[3157] = 584;
  40952. t[3158] = 585;
  40953. t[3161] = 588;
  40954. t[3162] = 589;
  40955. t[3165] = 891;
  40956. t[3166] = 892;
  40957. t[3169] = 1274;
  40958. t[3170] = 1275;
  40959. t[3173] = 1278;
  40960. t[3174] = 1279;
  40961. t[3181] = 7622;
  40962. t[3182] = 7623;
  40963. t[3282] = 11799;
  40964. t[3316] = 578;
  40965. t[3379] = 42785;
  40966. t[3393] = 1159;
  40967. t[3416] = 8377;
  40968. });
  40969. exports.getGlyphMapForStandardFonts = getGlyphMapForStandardFonts;
  40970. const getSupplementalGlyphMapForArialBlack = (0, _core_utils.getLookupTableFactory)(function (t) {
  40971. t[227] = 322;
  40972. t[264] = 261;
  40973. t[291] = 346;
  40974. });
  40975. exports.getSupplementalGlyphMapForArialBlack = getSupplementalGlyphMapForArialBlack;
  40976. const getSupplementalGlyphMapForCalibri = (0, _core_utils.getLookupTableFactory)(function (t) {
  40977. t[1] = 32;
  40978. t[4] = 65;
  40979. t[5] = 192;
  40980. t[6] = 193;
  40981. t[9] = 196;
  40982. t[17] = 66;
  40983. t[18] = 67;
  40984. t[21] = 268;
  40985. t[24] = 68;
  40986. t[28] = 69;
  40987. t[29] = 200;
  40988. t[30] = 201;
  40989. t[32] = 282;
  40990. t[38] = 70;
  40991. t[39] = 71;
  40992. t[44] = 72;
  40993. t[47] = 73;
  40994. t[48] = 204;
  40995. t[49] = 205;
  40996. t[58] = 74;
  40997. t[60] = 75;
  40998. t[62] = 76;
  40999. t[68] = 77;
  41000. t[69] = 78;
  41001. t[75] = 79;
  41002. t[76] = 210;
  41003. t[80] = 214;
  41004. t[87] = 80;
  41005. t[89] = 81;
  41006. t[90] = 82;
  41007. t[92] = 344;
  41008. t[94] = 83;
  41009. t[97] = 352;
  41010. t[100] = 84;
  41011. t[104] = 85;
  41012. t[109] = 220;
  41013. t[115] = 86;
  41014. t[116] = 87;
  41015. t[121] = 88;
  41016. t[122] = 89;
  41017. t[124] = 221;
  41018. t[127] = 90;
  41019. t[129] = 381;
  41020. t[258] = 97;
  41021. t[259] = 224;
  41022. t[260] = 225;
  41023. t[263] = 228;
  41024. t[268] = 261;
  41025. t[271] = 98;
  41026. t[272] = 99;
  41027. t[273] = 263;
  41028. t[275] = 269;
  41029. t[282] = 100;
  41030. t[286] = 101;
  41031. t[287] = 232;
  41032. t[288] = 233;
  41033. t[290] = 283;
  41034. t[295] = 281;
  41035. t[296] = 102;
  41036. t[336] = 103;
  41037. t[346] = 104;
  41038. t[349] = 105;
  41039. t[350] = 236;
  41040. t[351] = 237;
  41041. t[361] = 106;
  41042. t[364] = 107;
  41043. t[367] = 108;
  41044. t[371] = 322;
  41045. t[373] = 109;
  41046. t[374] = 110;
  41047. t[381] = 111;
  41048. t[382] = 242;
  41049. t[383] = 243;
  41050. t[386] = 246;
  41051. t[393] = 112;
  41052. t[395] = 113;
  41053. t[396] = 114;
  41054. t[398] = 345;
  41055. t[400] = 115;
  41056. t[401] = 347;
  41057. t[403] = 353;
  41058. t[410] = 116;
  41059. t[437] = 117;
  41060. t[442] = 252;
  41061. t[448] = 118;
  41062. t[449] = 119;
  41063. t[454] = 120;
  41064. t[455] = 121;
  41065. t[457] = 253;
  41066. t[460] = 122;
  41067. t[462] = 382;
  41068. t[463] = 380;
  41069. t[853] = 44;
  41070. t[855] = 58;
  41071. t[856] = 46;
  41072. t[876] = 47;
  41073. t[878] = 45;
  41074. t[882] = 45;
  41075. t[894] = 40;
  41076. t[895] = 41;
  41077. t[896] = 91;
  41078. t[897] = 93;
  41079. t[923] = 64;
  41080. t[1004] = 48;
  41081. t[1005] = 49;
  41082. t[1006] = 50;
  41083. t[1007] = 51;
  41084. t[1008] = 52;
  41085. t[1009] = 53;
  41086. t[1010] = 54;
  41087. t[1011] = 55;
  41088. t[1012] = 56;
  41089. t[1013] = 57;
  41090. t[1081] = 37;
  41091. t[1085] = 43;
  41092. t[1086] = 45;
  41093. });
  41094. exports.getSupplementalGlyphMapForCalibri = getSupplementalGlyphMapForCalibri;
  41095. function getStandardFontName(name) {
  41096. const fontName = (0, _fonts_utils.normalizeFontName)(name);
  41097. const stdFontMap = getStdFontMap();
  41098. return stdFontMap[fontName];
  41099. }
  41100. /***/ }),
  41101. /* 171 */
  41102. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  41103. "use strict";
  41104. Object.defineProperty(exports, "__esModule", ({
  41105. value: true
  41106. }));
  41107. exports.ToUnicodeMap = exports.IdentityToUnicodeMap = void 0;
  41108. var _util = __w_pdfjs_require__(2);
  41109. class ToUnicodeMap {
  41110. constructor() {
  41111. let cmap = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  41112. this._map = cmap;
  41113. }
  41114. get length() {
  41115. return this._map.length;
  41116. }
  41117. forEach(callback) {
  41118. for (const charCode in this._map) {
  41119. callback(charCode, this._map[charCode].charCodeAt(0));
  41120. }
  41121. }
  41122. has(i) {
  41123. return this._map[i] !== undefined;
  41124. }
  41125. get(i) {
  41126. return this._map[i];
  41127. }
  41128. charCodeOf(value) {
  41129. const map = this._map;
  41130. if (map.length <= 0x10000) {
  41131. return map.indexOf(value);
  41132. }
  41133. for (const charCode in map) {
  41134. if (map[charCode] === value) {
  41135. return charCode | 0;
  41136. }
  41137. }
  41138. return -1;
  41139. }
  41140. amend(map) {
  41141. for (const charCode in map) {
  41142. this._map[charCode] = map[charCode];
  41143. }
  41144. }
  41145. }
  41146. exports.ToUnicodeMap = ToUnicodeMap;
  41147. class IdentityToUnicodeMap {
  41148. constructor(firstChar, lastChar) {
  41149. this.firstChar = firstChar;
  41150. this.lastChar = lastChar;
  41151. }
  41152. get length() {
  41153. return this.lastChar + 1 - this.firstChar;
  41154. }
  41155. forEach(callback) {
  41156. for (let i = this.firstChar, ii = this.lastChar; i <= ii; i++) {
  41157. callback(i, i);
  41158. }
  41159. }
  41160. has(i) {
  41161. return this.firstChar <= i && i <= this.lastChar;
  41162. }
  41163. get(i) {
  41164. if (this.firstChar <= i && i <= this.lastChar) {
  41165. return String.fromCharCode(i);
  41166. }
  41167. return undefined;
  41168. }
  41169. charCodeOf(v) {
  41170. return Number.isInteger(v) && v >= this.firstChar && v <= this.lastChar ? v : -1;
  41171. }
  41172. amend(map) {
  41173. (0, _util.unreachable)("Should not call amend()");
  41174. }
  41175. }
  41176. exports.IdentityToUnicodeMap = IdentityToUnicodeMap;
  41177. /***/ }),
  41178. /* 172 */
  41179. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  41180. "use strict";
  41181. Object.defineProperty(exports, "__esModule", ({
  41182. value: true
  41183. }));
  41184. exports.CFFFont = void 0;
  41185. var _cff_parser = __w_pdfjs_require__(164);
  41186. var _fonts_utils = __w_pdfjs_require__(167);
  41187. var _util = __w_pdfjs_require__(2);
  41188. class CFFFont {
  41189. constructor(file, properties) {
  41190. this.properties = properties;
  41191. const parser = new _cff_parser.CFFParser(file, properties, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  41192. this.cff = parser.parse();
  41193. this.cff.duplicateFirstGlyph();
  41194. const compiler = new _cff_parser.CFFCompiler(this.cff);
  41195. this.seacs = this.cff.seacs;
  41196. try {
  41197. this.data = compiler.compile();
  41198. } catch (e) {
  41199. (0, _util.warn)("Failed to compile font " + properties.loadedName);
  41200. this.data = file;
  41201. }
  41202. this._createBuiltInEncoding();
  41203. }
  41204. get numGlyphs() {
  41205. return this.cff.charStrings.count;
  41206. }
  41207. getCharset() {
  41208. return this.cff.charset.charset;
  41209. }
  41210. getGlyphMapping() {
  41211. const cff = this.cff;
  41212. const properties = this.properties;
  41213. const {
  41214. cidToGidMap,
  41215. cMap
  41216. } = properties;
  41217. const charsets = cff.charset.charset;
  41218. let charCodeToGlyphId;
  41219. let glyphId;
  41220. if (properties.composite) {
  41221. let invCidToGidMap;
  41222. if (cidToGidMap && cidToGidMap.length > 0) {
  41223. invCidToGidMap = Object.create(null);
  41224. for (let i = 0, ii = cidToGidMap.length; i < ii; i++) {
  41225. const gid = cidToGidMap[i];
  41226. if (gid !== undefined) {
  41227. invCidToGidMap[gid] = i;
  41228. }
  41229. }
  41230. }
  41231. charCodeToGlyphId = Object.create(null);
  41232. let charCode;
  41233. if (cff.isCIDFont) {
  41234. for (glyphId = 0; glyphId < charsets.length; glyphId++) {
  41235. const cid = charsets[glyphId];
  41236. charCode = cMap.charCodeOf(cid);
  41237. if (invCidToGidMap && invCidToGidMap[charCode] !== undefined) {
  41238. charCode = invCidToGidMap[charCode];
  41239. }
  41240. charCodeToGlyphId[charCode] = glyphId;
  41241. }
  41242. } else {
  41243. for (glyphId = 0; glyphId < cff.charStrings.count; glyphId++) {
  41244. charCode = cMap.charCodeOf(glyphId);
  41245. charCodeToGlyphId[charCode] = glyphId;
  41246. }
  41247. }
  41248. return charCodeToGlyphId;
  41249. }
  41250. let encoding = cff.encoding ? cff.encoding.encoding : null;
  41251. if (properties.isInternalFont) {
  41252. encoding = properties.defaultEncoding;
  41253. }
  41254. charCodeToGlyphId = (0, _fonts_utils.type1FontGlyphMapping)(properties, encoding, charsets);
  41255. return charCodeToGlyphId;
  41256. }
  41257. hasGlyphId(id) {
  41258. return this.cff.hasGlyphId(id);
  41259. }
  41260. _createBuiltInEncoding() {
  41261. const {
  41262. charset,
  41263. encoding
  41264. } = this.cff;
  41265. if (!charset || !encoding) {
  41266. return;
  41267. }
  41268. const charsets = charset.charset,
  41269. encodings = encoding.encoding;
  41270. const map = [];
  41271. for (const charCode in encodings) {
  41272. const glyphId = encodings[charCode];
  41273. if (glyphId >= 0) {
  41274. const glyphName = charsets[glyphId];
  41275. if (glyphName) {
  41276. map[charCode] = glyphName;
  41277. }
  41278. }
  41279. }
  41280. if (map.length > 0) {
  41281. this.properties.builtInEncoding = map;
  41282. }
  41283. }
  41284. }
  41285. exports.CFFFont = CFFFont;
  41286. /***/ }),
  41287. /* 173 */
  41288. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  41289. "use strict";
  41290. Object.defineProperty(exports, "__esModule", ({
  41291. value: true
  41292. }));
  41293. exports.FontRendererFactory = void 0;
  41294. var _util = __w_pdfjs_require__(2);
  41295. var _cff_parser = __w_pdfjs_require__(164);
  41296. var _glyphlist = __w_pdfjs_require__(168);
  41297. var _encodings = __w_pdfjs_require__(166);
  41298. var _stream = __w_pdfjs_require__(139);
  41299. function getUint32(data, offset) {
  41300. return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0;
  41301. }
  41302. function getUint16(data, offset) {
  41303. return data[offset] << 8 | data[offset + 1];
  41304. }
  41305. function getInt16(data, offset) {
  41306. return (data[offset] << 24 | data[offset + 1] << 16) >> 16;
  41307. }
  41308. function getInt8(data, offset) {
  41309. return data[offset] << 24 >> 24;
  41310. }
  41311. function getFloat214(data, offset) {
  41312. return getInt16(data, offset) / 16384;
  41313. }
  41314. function getSubroutineBias(subrs) {
  41315. const numSubrs = subrs.length;
  41316. let bias = 32768;
  41317. if (numSubrs < 1240) {
  41318. bias = 107;
  41319. } else if (numSubrs < 33900) {
  41320. bias = 1131;
  41321. }
  41322. return bias;
  41323. }
  41324. function parseCmap(data, start, end) {
  41325. const offset = getUint16(data, start + 2) === 1 ? getUint32(data, start + 8) : getUint32(data, start + 16);
  41326. const format = getUint16(data, start + offset);
  41327. let ranges, p, i;
  41328. if (format === 4) {
  41329. getUint16(data, start + offset + 2);
  41330. const segCount = getUint16(data, start + offset + 6) >> 1;
  41331. p = start + offset + 14;
  41332. ranges = [];
  41333. for (i = 0; i < segCount; i++, p += 2) {
  41334. ranges[i] = {
  41335. end: getUint16(data, p)
  41336. };
  41337. }
  41338. p += 2;
  41339. for (i = 0; i < segCount; i++, p += 2) {
  41340. ranges[i].start = getUint16(data, p);
  41341. }
  41342. for (i = 0; i < segCount; i++, p += 2) {
  41343. ranges[i].idDelta = getUint16(data, p);
  41344. }
  41345. for (i = 0; i < segCount; i++, p += 2) {
  41346. let idOffset = getUint16(data, p);
  41347. if (idOffset === 0) {
  41348. continue;
  41349. }
  41350. ranges[i].ids = [];
  41351. for (let j = 0, jj = ranges[i].end - ranges[i].start + 1; j < jj; j++) {
  41352. ranges[i].ids[j] = getUint16(data, p + idOffset);
  41353. idOffset += 2;
  41354. }
  41355. }
  41356. return ranges;
  41357. } else if (format === 12) {
  41358. const groups = getUint32(data, start + offset + 12);
  41359. p = start + offset + 16;
  41360. ranges = [];
  41361. for (i = 0; i < groups; i++) {
  41362. start = getUint32(data, p);
  41363. ranges.push({
  41364. start,
  41365. end: getUint32(data, p + 4),
  41366. idDelta: getUint32(data, p + 8) - start
  41367. });
  41368. p += 12;
  41369. }
  41370. return ranges;
  41371. }
  41372. throw new _util.FormatError(`unsupported cmap: ${format}`);
  41373. }
  41374. function parseCff(data, start, end, seacAnalysisEnabled) {
  41375. const properties = {};
  41376. const parser = new _cff_parser.CFFParser(new _stream.Stream(data, start, end - start), properties, seacAnalysisEnabled);
  41377. const cff = parser.parse();
  41378. return {
  41379. glyphs: cff.charStrings.objects,
  41380. subrs: cff.topDict.privateDict && cff.topDict.privateDict.subrsIndex && cff.topDict.privateDict.subrsIndex.objects,
  41381. gsubrs: cff.globalSubrIndex && cff.globalSubrIndex.objects,
  41382. isCFFCIDFont: cff.isCIDFont,
  41383. fdSelect: cff.fdSelect,
  41384. fdArray: cff.fdArray
  41385. };
  41386. }
  41387. function parseGlyfTable(glyf, loca, isGlyphLocationsLong) {
  41388. let itemSize, itemDecode;
  41389. if (isGlyphLocationsLong) {
  41390. itemSize = 4;
  41391. itemDecode = getUint32;
  41392. } else {
  41393. itemSize = 2;
  41394. itemDecode = (data, offset) => 2 * getUint16(data, offset);
  41395. }
  41396. const glyphs = [];
  41397. let startOffset = itemDecode(loca, 0);
  41398. for (let j = itemSize; j < loca.length; j += itemSize) {
  41399. const endOffset = itemDecode(loca, j);
  41400. glyphs.push(glyf.subarray(startOffset, endOffset));
  41401. startOffset = endOffset;
  41402. }
  41403. return glyphs;
  41404. }
  41405. function lookupCmap(ranges, unicode) {
  41406. const code = unicode.codePointAt(0);
  41407. let gid = 0,
  41408. l = 0,
  41409. r = ranges.length - 1;
  41410. while (l < r) {
  41411. const c = l + r + 1 >> 1;
  41412. if (code < ranges[c].start) {
  41413. r = c - 1;
  41414. } else {
  41415. l = c;
  41416. }
  41417. }
  41418. if (ranges[l].start <= code && code <= ranges[l].end) {
  41419. gid = ranges[l].idDelta + (ranges[l].ids ? ranges[l].ids[code - ranges[l].start] : code) & 0xffff;
  41420. }
  41421. return {
  41422. charCode: code,
  41423. glyphId: gid
  41424. };
  41425. }
  41426. function compileGlyf(code, cmds, font) {
  41427. function moveTo(x, y) {
  41428. cmds.push({
  41429. cmd: "moveTo",
  41430. args: [x, y]
  41431. });
  41432. }
  41433. function lineTo(x, y) {
  41434. cmds.push({
  41435. cmd: "lineTo",
  41436. args: [x, y]
  41437. });
  41438. }
  41439. function quadraticCurveTo(xa, ya, x, y) {
  41440. cmds.push({
  41441. cmd: "quadraticCurveTo",
  41442. args: [xa, ya, x, y]
  41443. });
  41444. }
  41445. let i = 0;
  41446. const numberOfContours = getInt16(code, i);
  41447. let flags;
  41448. let x = 0,
  41449. y = 0;
  41450. i += 10;
  41451. if (numberOfContours < 0) {
  41452. do {
  41453. flags = getUint16(code, i);
  41454. const glyphIndex = getUint16(code, i + 2);
  41455. i += 4;
  41456. let arg1, arg2;
  41457. if (flags & 0x01) {
  41458. if (flags & 0x02) {
  41459. arg1 = getInt16(code, i);
  41460. arg2 = getInt16(code, i + 2);
  41461. } else {
  41462. arg1 = getUint16(code, i);
  41463. arg2 = getUint16(code, i + 2);
  41464. }
  41465. i += 4;
  41466. } else {
  41467. if (flags & 0x02) {
  41468. arg1 = getInt8(code, i++);
  41469. arg2 = getInt8(code, i++);
  41470. } else {
  41471. arg1 = code[i++];
  41472. arg2 = code[i++];
  41473. }
  41474. }
  41475. if (flags & 0x02) {
  41476. x = arg1;
  41477. y = arg2;
  41478. } else {
  41479. x = 0;
  41480. y = 0;
  41481. }
  41482. let scaleX = 1,
  41483. scaleY = 1,
  41484. scale01 = 0,
  41485. scale10 = 0;
  41486. if (flags & 0x08) {
  41487. scaleX = scaleY = getFloat214(code, i);
  41488. i += 2;
  41489. } else if (flags & 0x40) {
  41490. scaleX = getFloat214(code, i);
  41491. scaleY = getFloat214(code, i + 2);
  41492. i += 4;
  41493. } else if (flags & 0x80) {
  41494. scaleX = getFloat214(code, i);
  41495. scale01 = getFloat214(code, i + 2);
  41496. scale10 = getFloat214(code, i + 4);
  41497. scaleY = getFloat214(code, i + 6);
  41498. i += 8;
  41499. }
  41500. const subglyph = font.glyphs[glyphIndex];
  41501. if (subglyph) {
  41502. cmds.push({
  41503. cmd: "save"
  41504. }, {
  41505. cmd: "transform",
  41506. args: [scaleX, scale01, scale10, scaleY, x, y]
  41507. });
  41508. if (!(flags & 0x02)) {}
  41509. compileGlyf(subglyph, cmds, font);
  41510. cmds.push({
  41511. cmd: "restore"
  41512. });
  41513. }
  41514. } while (flags & 0x20);
  41515. } else {
  41516. const endPtsOfContours = [];
  41517. let j, jj;
  41518. for (j = 0; j < numberOfContours; j++) {
  41519. endPtsOfContours.push(getUint16(code, i));
  41520. i += 2;
  41521. }
  41522. const instructionLength = getUint16(code, i);
  41523. i += 2 + instructionLength;
  41524. const numberOfPoints = endPtsOfContours.at(-1) + 1;
  41525. const points = [];
  41526. while (points.length < numberOfPoints) {
  41527. flags = code[i++];
  41528. let repeat = 1;
  41529. if (flags & 0x08) {
  41530. repeat += code[i++];
  41531. }
  41532. while (repeat-- > 0) {
  41533. points.push({
  41534. flags
  41535. });
  41536. }
  41537. }
  41538. for (j = 0; j < numberOfPoints; j++) {
  41539. switch (points[j].flags & 0x12) {
  41540. case 0x00:
  41541. x += getInt16(code, i);
  41542. i += 2;
  41543. break;
  41544. case 0x02:
  41545. x -= code[i++];
  41546. break;
  41547. case 0x12:
  41548. x += code[i++];
  41549. break;
  41550. }
  41551. points[j].x = x;
  41552. }
  41553. for (j = 0; j < numberOfPoints; j++) {
  41554. switch (points[j].flags & 0x24) {
  41555. case 0x00:
  41556. y += getInt16(code, i);
  41557. i += 2;
  41558. break;
  41559. case 0x04:
  41560. y -= code[i++];
  41561. break;
  41562. case 0x24:
  41563. y += code[i++];
  41564. break;
  41565. }
  41566. points[j].y = y;
  41567. }
  41568. let startPoint = 0;
  41569. for (i = 0; i < numberOfContours; i++) {
  41570. const endPoint = endPtsOfContours[i];
  41571. const contour = points.slice(startPoint, endPoint + 1);
  41572. if (contour[0].flags & 1) {
  41573. contour.push(contour[0]);
  41574. } else if (contour.at(-1).flags & 1) {
  41575. contour.unshift(contour.at(-1));
  41576. } else {
  41577. const p = {
  41578. flags: 1,
  41579. x: (contour[0].x + contour.at(-1).x) / 2,
  41580. y: (contour[0].y + contour.at(-1).y) / 2
  41581. };
  41582. contour.unshift(p);
  41583. contour.push(p);
  41584. }
  41585. moveTo(contour[0].x, contour[0].y);
  41586. for (j = 1, jj = contour.length; j < jj; j++) {
  41587. if (contour[j].flags & 1) {
  41588. lineTo(contour[j].x, contour[j].y);
  41589. } else if (contour[j + 1].flags & 1) {
  41590. quadraticCurveTo(contour[j].x, contour[j].y, contour[j + 1].x, contour[j + 1].y);
  41591. j++;
  41592. } else {
  41593. quadraticCurveTo(contour[j].x, contour[j].y, (contour[j].x + contour[j + 1].x) / 2, (contour[j].y + contour[j + 1].y) / 2);
  41594. }
  41595. }
  41596. startPoint = endPoint + 1;
  41597. }
  41598. }
  41599. }
  41600. function compileCharString(charStringCode, cmds, font, glyphId) {
  41601. function moveTo(x, y) {
  41602. cmds.push({
  41603. cmd: "moveTo",
  41604. args: [x, y]
  41605. });
  41606. }
  41607. function lineTo(x, y) {
  41608. cmds.push({
  41609. cmd: "lineTo",
  41610. args: [x, y]
  41611. });
  41612. }
  41613. function bezierCurveTo(x1, y1, x2, y2, x, y) {
  41614. cmds.push({
  41615. cmd: "bezierCurveTo",
  41616. args: [x1, y1, x2, y2, x, y]
  41617. });
  41618. }
  41619. const stack = [];
  41620. let x = 0,
  41621. y = 0;
  41622. let stems = 0;
  41623. function parse(code) {
  41624. let i = 0;
  41625. while (i < code.length) {
  41626. let stackClean = false;
  41627. let v = code[i++];
  41628. let xa, xb, ya, yb, y1, y2, y3, n, subrCode;
  41629. switch (v) {
  41630. case 1:
  41631. stems += stack.length >> 1;
  41632. stackClean = true;
  41633. break;
  41634. case 3:
  41635. stems += stack.length >> 1;
  41636. stackClean = true;
  41637. break;
  41638. case 4:
  41639. y += stack.pop();
  41640. moveTo(x, y);
  41641. stackClean = true;
  41642. break;
  41643. case 5:
  41644. while (stack.length > 0) {
  41645. x += stack.shift();
  41646. y += stack.shift();
  41647. lineTo(x, y);
  41648. }
  41649. break;
  41650. case 6:
  41651. while (stack.length > 0) {
  41652. x += stack.shift();
  41653. lineTo(x, y);
  41654. if (stack.length === 0) {
  41655. break;
  41656. }
  41657. y += stack.shift();
  41658. lineTo(x, y);
  41659. }
  41660. break;
  41661. case 7:
  41662. while (stack.length > 0) {
  41663. y += stack.shift();
  41664. lineTo(x, y);
  41665. if (stack.length === 0) {
  41666. break;
  41667. }
  41668. x += stack.shift();
  41669. lineTo(x, y);
  41670. }
  41671. break;
  41672. case 8:
  41673. while (stack.length > 0) {
  41674. xa = x + stack.shift();
  41675. ya = y + stack.shift();
  41676. xb = xa + stack.shift();
  41677. yb = ya + stack.shift();
  41678. x = xb + stack.shift();
  41679. y = yb + stack.shift();
  41680. bezierCurveTo(xa, ya, xb, yb, x, y);
  41681. }
  41682. break;
  41683. case 10:
  41684. n = stack.pop();
  41685. subrCode = null;
  41686. if (font.isCFFCIDFont) {
  41687. const fdIndex = font.fdSelect.getFDIndex(glyphId);
  41688. if (fdIndex >= 0 && fdIndex < font.fdArray.length) {
  41689. const fontDict = font.fdArray[fdIndex];
  41690. let subrs;
  41691. if (fontDict.privateDict && fontDict.privateDict.subrsIndex) {
  41692. subrs = fontDict.privateDict.subrsIndex.objects;
  41693. }
  41694. if (subrs) {
  41695. n += getSubroutineBias(subrs);
  41696. subrCode = subrs[n];
  41697. }
  41698. } else {
  41699. (0, _util.warn)("Invalid fd index for glyph index.");
  41700. }
  41701. } else {
  41702. subrCode = font.subrs[n + font.subrsBias];
  41703. }
  41704. if (subrCode) {
  41705. parse(subrCode);
  41706. }
  41707. break;
  41708. case 11:
  41709. return;
  41710. case 12:
  41711. v = code[i++];
  41712. switch (v) {
  41713. case 34:
  41714. xa = x + stack.shift();
  41715. xb = xa + stack.shift();
  41716. y1 = y + stack.shift();
  41717. x = xb + stack.shift();
  41718. bezierCurveTo(xa, y, xb, y1, x, y1);
  41719. xa = x + stack.shift();
  41720. xb = xa + stack.shift();
  41721. x = xb + stack.shift();
  41722. bezierCurveTo(xa, y1, xb, y, x, y);
  41723. break;
  41724. case 35:
  41725. xa = x + stack.shift();
  41726. ya = y + stack.shift();
  41727. xb = xa + stack.shift();
  41728. yb = ya + stack.shift();
  41729. x = xb + stack.shift();
  41730. y = yb + stack.shift();
  41731. bezierCurveTo(xa, ya, xb, yb, x, y);
  41732. xa = x + stack.shift();
  41733. ya = y + stack.shift();
  41734. xb = xa + stack.shift();
  41735. yb = ya + stack.shift();
  41736. x = xb + stack.shift();
  41737. y = yb + stack.shift();
  41738. bezierCurveTo(xa, ya, xb, yb, x, y);
  41739. stack.pop();
  41740. break;
  41741. case 36:
  41742. xa = x + stack.shift();
  41743. y1 = y + stack.shift();
  41744. xb = xa + stack.shift();
  41745. y2 = y1 + stack.shift();
  41746. x = xb + stack.shift();
  41747. bezierCurveTo(xa, y1, xb, y2, x, y2);
  41748. xa = x + stack.shift();
  41749. xb = xa + stack.shift();
  41750. y3 = y2 + stack.shift();
  41751. x = xb + stack.shift();
  41752. bezierCurveTo(xa, y2, xb, y3, x, y);
  41753. break;
  41754. case 37:
  41755. const x0 = x,
  41756. y0 = y;
  41757. xa = x + stack.shift();
  41758. ya = y + stack.shift();
  41759. xb = xa + stack.shift();
  41760. yb = ya + stack.shift();
  41761. x = xb + stack.shift();
  41762. y = yb + stack.shift();
  41763. bezierCurveTo(xa, ya, xb, yb, x, y);
  41764. xa = x + stack.shift();
  41765. ya = y + stack.shift();
  41766. xb = xa + stack.shift();
  41767. yb = ya + stack.shift();
  41768. x = xb;
  41769. y = yb;
  41770. if (Math.abs(x - x0) > Math.abs(y - y0)) {
  41771. x += stack.shift();
  41772. } else {
  41773. y += stack.shift();
  41774. }
  41775. bezierCurveTo(xa, ya, xb, yb, x, y);
  41776. break;
  41777. default:
  41778. throw new _util.FormatError(`unknown operator: 12 ${v}`);
  41779. }
  41780. break;
  41781. case 14:
  41782. if (stack.length >= 4) {
  41783. const achar = stack.pop();
  41784. const bchar = stack.pop();
  41785. y = stack.pop();
  41786. x = stack.pop();
  41787. cmds.push({
  41788. cmd: "save"
  41789. }, {
  41790. cmd: "translate",
  41791. args: [x, y]
  41792. });
  41793. let cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[_encodings.StandardEncoding[achar]]));
  41794. compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId);
  41795. cmds.push({
  41796. cmd: "restore"
  41797. });
  41798. cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[_encodings.StandardEncoding[bchar]]));
  41799. compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId);
  41800. }
  41801. return;
  41802. case 18:
  41803. stems += stack.length >> 1;
  41804. stackClean = true;
  41805. break;
  41806. case 19:
  41807. stems += stack.length >> 1;
  41808. i += stems + 7 >> 3;
  41809. stackClean = true;
  41810. break;
  41811. case 20:
  41812. stems += stack.length >> 1;
  41813. i += stems + 7 >> 3;
  41814. stackClean = true;
  41815. break;
  41816. case 21:
  41817. y += stack.pop();
  41818. x += stack.pop();
  41819. moveTo(x, y);
  41820. stackClean = true;
  41821. break;
  41822. case 22:
  41823. x += stack.pop();
  41824. moveTo(x, y);
  41825. stackClean = true;
  41826. break;
  41827. case 23:
  41828. stems += stack.length >> 1;
  41829. stackClean = true;
  41830. break;
  41831. case 24:
  41832. while (stack.length > 2) {
  41833. xa = x + stack.shift();
  41834. ya = y + stack.shift();
  41835. xb = xa + stack.shift();
  41836. yb = ya + stack.shift();
  41837. x = xb + stack.shift();
  41838. y = yb + stack.shift();
  41839. bezierCurveTo(xa, ya, xb, yb, x, y);
  41840. }
  41841. x += stack.shift();
  41842. y += stack.shift();
  41843. lineTo(x, y);
  41844. break;
  41845. case 25:
  41846. while (stack.length > 6) {
  41847. x += stack.shift();
  41848. y += stack.shift();
  41849. lineTo(x, y);
  41850. }
  41851. xa = x + stack.shift();
  41852. ya = y + stack.shift();
  41853. xb = xa + stack.shift();
  41854. yb = ya + stack.shift();
  41855. x = xb + stack.shift();
  41856. y = yb + stack.shift();
  41857. bezierCurveTo(xa, ya, xb, yb, x, y);
  41858. break;
  41859. case 26:
  41860. if (stack.length % 2) {
  41861. x += stack.shift();
  41862. }
  41863. while (stack.length > 0) {
  41864. xa = x;
  41865. ya = y + stack.shift();
  41866. xb = xa + stack.shift();
  41867. yb = ya + stack.shift();
  41868. x = xb;
  41869. y = yb + stack.shift();
  41870. bezierCurveTo(xa, ya, xb, yb, x, y);
  41871. }
  41872. break;
  41873. case 27:
  41874. if (stack.length % 2) {
  41875. y += stack.shift();
  41876. }
  41877. while (stack.length > 0) {
  41878. xa = x + stack.shift();
  41879. ya = y;
  41880. xb = xa + stack.shift();
  41881. yb = ya + stack.shift();
  41882. x = xb + stack.shift();
  41883. y = yb;
  41884. bezierCurveTo(xa, ya, xb, yb, x, y);
  41885. }
  41886. break;
  41887. case 28:
  41888. stack.push((code[i] << 24 | code[i + 1] << 16) >> 16);
  41889. i += 2;
  41890. break;
  41891. case 29:
  41892. n = stack.pop() + font.gsubrsBias;
  41893. subrCode = font.gsubrs[n];
  41894. if (subrCode) {
  41895. parse(subrCode);
  41896. }
  41897. break;
  41898. case 30:
  41899. while (stack.length > 0) {
  41900. xa = x;
  41901. ya = y + stack.shift();
  41902. xb = xa + stack.shift();
  41903. yb = ya + stack.shift();
  41904. x = xb + stack.shift();
  41905. y = yb + (stack.length === 1 ? stack.shift() : 0);
  41906. bezierCurveTo(xa, ya, xb, yb, x, y);
  41907. if (stack.length === 0) {
  41908. break;
  41909. }
  41910. xa = x + stack.shift();
  41911. ya = y;
  41912. xb = xa + stack.shift();
  41913. yb = ya + stack.shift();
  41914. y = yb + stack.shift();
  41915. x = xb + (stack.length === 1 ? stack.shift() : 0);
  41916. bezierCurveTo(xa, ya, xb, yb, x, y);
  41917. }
  41918. break;
  41919. case 31:
  41920. while (stack.length > 0) {
  41921. xa = x + stack.shift();
  41922. ya = y;
  41923. xb = xa + stack.shift();
  41924. yb = ya + stack.shift();
  41925. y = yb + stack.shift();
  41926. x = xb + (stack.length === 1 ? stack.shift() : 0);
  41927. bezierCurveTo(xa, ya, xb, yb, x, y);
  41928. if (stack.length === 0) {
  41929. break;
  41930. }
  41931. xa = x;
  41932. ya = y + stack.shift();
  41933. xb = xa + stack.shift();
  41934. yb = ya + stack.shift();
  41935. x = xb + stack.shift();
  41936. y = yb + (stack.length === 1 ? stack.shift() : 0);
  41937. bezierCurveTo(xa, ya, xb, yb, x, y);
  41938. }
  41939. break;
  41940. default:
  41941. if (v < 32) {
  41942. throw new _util.FormatError(`unknown operator: ${v}`);
  41943. }
  41944. if (v < 247) {
  41945. stack.push(v - 139);
  41946. } else if (v < 251) {
  41947. stack.push((v - 247) * 256 + code[i++] + 108);
  41948. } else if (v < 255) {
  41949. stack.push(-(v - 251) * 256 - code[i++] - 108);
  41950. } else {
  41951. stack.push((code[i] << 24 | code[i + 1] << 16 | code[i + 2] << 8 | code[i + 3]) / 65536);
  41952. i += 4;
  41953. }
  41954. break;
  41955. }
  41956. if (stackClean) {
  41957. stack.length = 0;
  41958. }
  41959. }
  41960. }
  41961. parse(charStringCode);
  41962. }
  41963. const NOOP = [];
  41964. class CompiledFont {
  41965. constructor(fontMatrix) {
  41966. if (this.constructor === CompiledFont) {
  41967. (0, _util.unreachable)("Cannot initialize CompiledFont.");
  41968. }
  41969. this.fontMatrix = fontMatrix;
  41970. this.compiledGlyphs = Object.create(null);
  41971. this.compiledCharCodeToGlyphId = Object.create(null);
  41972. }
  41973. getPathJs(unicode) {
  41974. const {
  41975. charCode,
  41976. glyphId
  41977. } = lookupCmap(this.cmap, unicode);
  41978. let fn = this.compiledGlyphs[glyphId];
  41979. if (!fn) {
  41980. try {
  41981. fn = this.compileGlyph(this.glyphs[glyphId], glyphId);
  41982. this.compiledGlyphs[glyphId] = fn;
  41983. } catch (ex) {
  41984. this.compiledGlyphs[glyphId] = NOOP;
  41985. if (this.compiledCharCodeToGlyphId[charCode] === undefined) {
  41986. this.compiledCharCodeToGlyphId[charCode] = glyphId;
  41987. }
  41988. throw ex;
  41989. }
  41990. }
  41991. if (this.compiledCharCodeToGlyphId[charCode] === undefined) {
  41992. this.compiledCharCodeToGlyphId[charCode] = glyphId;
  41993. }
  41994. return fn;
  41995. }
  41996. compileGlyph(code, glyphId) {
  41997. if (!code || code.length === 0 || code[0] === 14) {
  41998. return NOOP;
  41999. }
  42000. let fontMatrix = this.fontMatrix;
  42001. if (this.isCFFCIDFont) {
  42002. const fdIndex = this.fdSelect.getFDIndex(glyphId);
  42003. if (fdIndex >= 0 && fdIndex < this.fdArray.length) {
  42004. const fontDict = this.fdArray[fdIndex];
  42005. fontMatrix = fontDict.getByName("FontMatrix") || _util.FONT_IDENTITY_MATRIX;
  42006. } else {
  42007. (0, _util.warn)("Invalid fd index for glyph index.");
  42008. }
  42009. }
  42010. const cmds = [{
  42011. cmd: "save"
  42012. }, {
  42013. cmd: "transform",
  42014. args: fontMatrix.slice()
  42015. }, {
  42016. cmd: "scale",
  42017. args: ["size", "-size"]
  42018. }];
  42019. this.compileGlyphImpl(code, cmds, glyphId);
  42020. cmds.push({
  42021. cmd: "restore"
  42022. });
  42023. return cmds;
  42024. }
  42025. compileGlyphImpl() {
  42026. (0, _util.unreachable)("Children classes should implement this.");
  42027. }
  42028. hasBuiltPath(unicode) {
  42029. const {
  42030. charCode,
  42031. glyphId
  42032. } = lookupCmap(this.cmap, unicode);
  42033. return this.compiledGlyphs[glyphId] !== undefined && this.compiledCharCodeToGlyphId[charCode] !== undefined;
  42034. }
  42035. }
  42036. class TrueTypeCompiled extends CompiledFont {
  42037. constructor(glyphs, cmap, fontMatrix) {
  42038. super(fontMatrix || [0.000488, 0, 0, 0.000488, 0, 0]);
  42039. this.glyphs = glyphs;
  42040. this.cmap = cmap;
  42041. }
  42042. compileGlyphImpl(code, cmds) {
  42043. compileGlyf(code, cmds, this);
  42044. }
  42045. }
  42046. class Type2Compiled extends CompiledFont {
  42047. constructor(cffInfo, cmap, fontMatrix, glyphNameMap) {
  42048. super(fontMatrix || [0.001, 0, 0, 0.001, 0, 0]);
  42049. this.glyphs = cffInfo.glyphs;
  42050. this.gsubrs = cffInfo.gsubrs || [];
  42051. this.subrs = cffInfo.subrs || [];
  42052. this.cmap = cmap;
  42053. this.glyphNameMap = glyphNameMap || (0, _glyphlist.getGlyphsUnicode)();
  42054. this.gsubrsBias = getSubroutineBias(this.gsubrs);
  42055. this.subrsBias = getSubroutineBias(this.subrs);
  42056. this.isCFFCIDFont = cffInfo.isCFFCIDFont;
  42057. this.fdSelect = cffInfo.fdSelect;
  42058. this.fdArray = cffInfo.fdArray;
  42059. }
  42060. compileGlyphImpl(code, cmds, glyphId) {
  42061. compileCharString(code, cmds, this, glyphId);
  42062. }
  42063. }
  42064. class FontRendererFactory {
  42065. static create(font, seacAnalysisEnabled) {
  42066. const data = new Uint8Array(font.data);
  42067. let cmap, glyf, loca, cff, indexToLocFormat, unitsPerEm;
  42068. const numTables = getUint16(data, 4);
  42069. for (let i = 0, p = 12; i < numTables; i++, p += 16) {
  42070. const tag = (0, _util.bytesToString)(data.subarray(p, p + 4));
  42071. const offset = getUint32(data, p + 8);
  42072. const length = getUint32(data, p + 12);
  42073. switch (tag) {
  42074. case "cmap":
  42075. cmap = parseCmap(data, offset, offset + length);
  42076. break;
  42077. case "glyf":
  42078. glyf = data.subarray(offset, offset + length);
  42079. break;
  42080. case "loca":
  42081. loca = data.subarray(offset, offset + length);
  42082. break;
  42083. case "head":
  42084. unitsPerEm = getUint16(data, offset + 18);
  42085. indexToLocFormat = getUint16(data, offset + 50);
  42086. break;
  42087. case "CFF ":
  42088. cff = parseCff(data, offset, offset + length, seacAnalysisEnabled);
  42089. break;
  42090. }
  42091. }
  42092. if (glyf) {
  42093. const fontMatrix = !unitsPerEm ? font.fontMatrix : [1 / unitsPerEm, 0, 0, 1 / unitsPerEm, 0, 0];
  42094. return new TrueTypeCompiled(parseGlyfTable(glyf, loca, indexToLocFormat), cmap, fontMatrix);
  42095. }
  42096. return new Type2Compiled(cff, cmap, font.fontMatrix, font.glyphNameMap);
  42097. }
  42098. }
  42099. exports.FontRendererFactory = FontRendererFactory;
  42100. /***/ }),
  42101. /* 174 */
  42102. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  42103. "use strict";
  42104. Object.defineProperty(exports, "__esModule", ({
  42105. value: true
  42106. }));
  42107. exports.getMetrics = exports.getFontBasicMetrics = void 0;
  42108. var _core_utils = __w_pdfjs_require__(135);
  42109. const getMetrics = (0, _core_utils.getLookupTableFactory)(function (t) {
  42110. t.Courier = 600;
  42111. t["Courier-Bold"] = 600;
  42112. t["Courier-BoldOblique"] = 600;
  42113. t["Courier-Oblique"] = 600;
  42114. t.Helvetica = (0, _core_utils.getLookupTableFactory)(function (t) {
  42115. t.space = 278;
  42116. t.exclam = 278;
  42117. t.quotedbl = 355;
  42118. t.numbersign = 556;
  42119. t.dollar = 556;
  42120. t.percent = 889;
  42121. t.ampersand = 667;
  42122. t.quoteright = 222;
  42123. t.parenleft = 333;
  42124. t.parenright = 333;
  42125. t.asterisk = 389;
  42126. t.plus = 584;
  42127. t.comma = 278;
  42128. t.hyphen = 333;
  42129. t.period = 278;
  42130. t.slash = 278;
  42131. t.zero = 556;
  42132. t.one = 556;
  42133. t.two = 556;
  42134. t.three = 556;
  42135. t.four = 556;
  42136. t.five = 556;
  42137. t.six = 556;
  42138. t.seven = 556;
  42139. t.eight = 556;
  42140. t.nine = 556;
  42141. t.colon = 278;
  42142. t.semicolon = 278;
  42143. t.less = 584;
  42144. t.equal = 584;
  42145. t.greater = 584;
  42146. t.question = 556;
  42147. t.at = 1015;
  42148. t.A = 667;
  42149. t.B = 667;
  42150. t.C = 722;
  42151. t.D = 722;
  42152. t.E = 667;
  42153. t.F = 611;
  42154. t.G = 778;
  42155. t.H = 722;
  42156. t.I = 278;
  42157. t.J = 500;
  42158. t.K = 667;
  42159. t.L = 556;
  42160. t.M = 833;
  42161. t.N = 722;
  42162. t.O = 778;
  42163. t.P = 667;
  42164. t.Q = 778;
  42165. t.R = 722;
  42166. t.S = 667;
  42167. t.T = 611;
  42168. t.U = 722;
  42169. t.V = 667;
  42170. t.W = 944;
  42171. t.X = 667;
  42172. t.Y = 667;
  42173. t.Z = 611;
  42174. t.bracketleft = 278;
  42175. t.backslash = 278;
  42176. t.bracketright = 278;
  42177. t.asciicircum = 469;
  42178. t.underscore = 556;
  42179. t.quoteleft = 222;
  42180. t.a = 556;
  42181. t.b = 556;
  42182. t.c = 500;
  42183. t.d = 556;
  42184. t.e = 556;
  42185. t.f = 278;
  42186. t.g = 556;
  42187. t.h = 556;
  42188. t.i = 222;
  42189. t.j = 222;
  42190. t.k = 500;
  42191. t.l = 222;
  42192. t.m = 833;
  42193. t.n = 556;
  42194. t.o = 556;
  42195. t.p = 556;
  42196. t.q = 556;
  42197. t.r = 333;
  42198. t.s = 500;
  42199. t.t = 278;
  42200. t.u = 556;
  42201. t.v = 500;
  42202. t.w = 722;
  42203. t.x = 500;
  42204. t.y = 500;
  42205. t.z = 500;
  42206. t.braceleft = 334;
  42207. t.bar = 260;
  42208. t.braceright = 334;
  42209. t.asciitilde = 584;
  42210. t.exclamdown = 333;
  42211. t.cent = 556;
  42212. t.sterling = 556;
  42213. t.fraction = 167;
  42214. t.yen = 556;
  42215. t.florin = 556;
  42216. t.section = 556;
  42217. t.currency = 556;
  42218. t.quotesingle = 191;
  42219. t.quotedblleft = 333;
  42220. t.guillemotleft = 556;
  42221. t.guilsinglleft = 333;
  42222. t.guilsinglright = 333;
  42223. t.fi = 500;
  42224. t.fl = 500;
  42225. t.endash = 556;
  42226. t.dagger = 556;
  42227. t.daggerdbl = 556;
  42228. t.periodcentered = 278;
  42229. t.paragraph = 537;
  42230. t.bullet = 350;
  42231. t.quotesinglbase = 222;
  42232. t.quotedblbase = 333;
  42233. t.quotedblright = 333;
  42234. t.guillemotright = 556;
  42235. t.ellipsis = 1000;
  42236. t.perthousand = 1000;
  42237. t.questiondown = 611;
  42238. t.grave = 333;
  42239. t.acute = 333;
  42240. t.circumflex = 333;
  42241. t.tilde = 333;
  42242. t.macron = 333;
  42243. t.breve = 333;
  42244. t.dotaccent = 333;
  42245. t.dieresis = 333;
  42246. t.ring = 333;
  42247. t.cedilla = 333;
  42248. t.hungarumlaut = 333;
  42249. t.ogonek = 333;
  42250. t.caron = 333;
  42251. t.emdash = 1000;
  42252. t.AE = 1000;
  42253. t.ordfeminine = 370;
  42254. t.Lslash = 556;
  42255. t.Oslash = 778;
  42256. t.OE = 1000;
  42257. t.ordmasculine = 365;
  42258. t.ae = 889;
  42259. t.dotlessi = 278;
  42260. t.lslash = 222;
  42261. t.oslash = 611;
  42262. t.oe = 944;
  42263. t.germandbls = 611;
  42264. t.Idieresis = 278;
  42265. t.eacute = 556;
  42266. t.abreve = 556;
  42267. t.uhungarumlaut = 556;
  42268. t.ecaron = 556;
  42269. t.Ydieresis = 667;
  42270. t.divide = 584;
  42271. t.Yacute = 667;
  42272. t.Acircumflex = 667;
  42273. t.aacute = 556;
  42274. t.Ucircumflex = 722;
  42275. t.yacute = 500;
  42276. t.scommaaccent = 500;
  42277. t.ecircumflex = 556;
  42278. t.Uring = 722;
  42279. t.Udieresis = 722;
  42280. t.aogonek = 556;
  42281. t.Uacute = 722;
  42282. t.uogonek = 556;
  42283. t.Edieresis = 667;
  42284. t.Dcroat = 722;
  42285. t.commaaccent = 250;
  42286. t.copyright = 737;
  42287. t.Emacron = 667;
  42288. t.ccaron = 500;
  42289. t.aring = 556;
  42290. t.Ncommaaccent = 722;
  42291. t.lacute = 222;
  42292. t.agrave = 556;
  42293. t.Tcommaaccent = 611;
  42294. t.Cacute = 722;
  42295. t.atilde = 556;
  42296. t.Edotaccent = 667;
  42297. t.scaron = 500;
  42298. t.scedilla = 500;
  42299. t.iacute = 278;
  42300. t.lozenge = 471;
  42301. t.Rcaron = 722;
  42302. t.Gcommaaccent = 778;
  42303. t.ucircumflex = 556;
  42304. t.acircumflex = 556;
  42305. t.Amacron = 667;
  42306. t.rcaron = 333;
  42307. t.ccedilla = 500;
  42308. t.Zdotaccent = 611;
  42309. t.Thorn = 667;
  42310. t.Omacron = 778;
  42311. t.Racute = 722;
  42312. t.Sacute = 667;
  42313. t.dcaron = 643;
  42314. t.Umacron = 722;
  42315. t.uring = 556;
  42316. t.threesuperior = 333;
  42317. t.Ograve = 778;
  42318. t.Agrave = 667;
  42319. t.Abreve = 667;
  42320. t.multiply = 584;
  42321. t.uacute = 556;
  42322. t.Tcaron = 611;
  42323. t.partialdiff = 476;
  42324. t.ydieresis = 500;
  42325. t.Nacute = 722;
  42326. t.icircumflex = 278;
  42327. t.Ecircumflex = 667;
  42328. t.adieresis = 556;
  42329. t.edieresis = 556;
  42330. t.cacute = 500;
  42331. t.nacute = 556;
  42332. t.umacron = 556;
  42333. t.Ncaron = 722;
  42334. t.Iacute = 278;
  42335. t.plusminus = 584;
  42336. t.brokenbar = 260;
  42337. t.registered = 737;
  42338. t.Gbreve = 778;
  42339. t.Idotaccent = 278;
  42340. t.summation = 600;
  42341. t.Egrave = 667;
  42342. t.racute = 333;
  42343. t.omacron = 556;
  42344. t.Zacute = 611;
  42345. t.Zcaron = 611;
  42346. t.greaterequal = 549;
  42347. t.Eth = 722;
  42348. t.Ccedilla = 722;
  42349. t.lcommaaccent = 222;
  42350. t.tcaron = 317;
  42351. t.eogonek = 556;
  42352. t.Uogonek = 722;
  42353. t.Aacute = 667;
  42354. t.Adieresis = 667;
  42355. t.egrave = 556;
  42356. t.zacute = 500;
  42357. t.iogonek = 222;
  42358. t.Oacute = 778;
  42359. t.oacute = 556;
  42360. t.amacron = 556;
  42361. t.sacute = 500;
  42362. t.idieresis = 278;
  42363. t.Ocircumflex = 778;
  42364. t.Ugrave = 722;
  42365. t.Delta = 612;
  42366. t.thorn = 556;
  42367. t.twosuperior = 333;
  42368. t.Odieresis = 778;
  42369. t.mu = 556;
  42370. t.igrave = 278;
  42371. t.ohungarumlaut = 556;
  42372. t.Eogonek = 667;
  42373. t.dcroat = 556;
  42374. t.threequarters = 834;
  42375. t.Scedilla = 667;
  42376. t.lcaron = 299;
  42377. t.Kcommaaccent = 667;
  42378. t.Lacute = 556;
  42379. t.trademark = 1000;
  42380. t.edotaccent = 556;
  42381. t.Igrave = 278;
  42382. t.Imacron = 278;
  42383. t.Lcaron = 556;
  42384. t.onehalf = 834;
  42385. t.lessequal = 549;
  42386. t.ocircumflex = 556;
  42387. t.ntilde = 556;
  42388. t.Uhungarumlaut = 722;
  42389. t.Eacute = 667;
  42390. t.emacron = 556;
  42391. t.gbreve = 556;
  42392. t.onequarter = 834;
  42393. t.Scaron = 667;
  42394. t.Scommaaccent = 667;
  42395. t.Ohungarumlaut = 778;
  42396. t.degree = 400;
  42397. t.ograve = 556;
  42398. t.Ccaron = 722;
  42399. t.ugrave = 556;
  42400. t.radical = 453;
  42401. t.Dcaron = 722;
  42402. t.rcommaaccent = 333;
  42403. t.Ntilde = 722;
  42404. t.otilde = 556;
  42405. t.Rcommaaccent = 722;
  42406. t.Lcommaaccent = 556;
  42407. t.Atilde = 667;
  42408. t.Aogonek = 667;
  42409. t.Aring = 667;
  42410. t.Otilde = 778;
  42411. t.zdotaccent = 500;
  42412. t.Ecaron = 667;
  42413. t.Iogonek = 278;
  42414. t.kcommaaccent = 500;
  42415. t.minus = 584;
  42416. t.Icircumflex = 278;
  42417. t.ncaron = 556;
  42418. t.tcommaaccent = 278;
  42419. t.logicalnot = 584;
  42420. t.odieresis = 556;
  42421. t.udieresis = 556;
  42422. t.notequal = 549;
  42423. t.gcommaaccent = 556;
  42424. t.eth = 556;
  42425. t.zcaron = 500;
  42426. t.ncommaaccent = 556;
  42427. t.onesuperior = 333;
  42428. t.imacron = 278;
  42429. t.Euro = 556;
  42430. });
  42431. t["Helvetica-Bold"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  42432. t.space = 278;
  42433. t.exclam = 333;
  42434. t.quotedbl = 474;
  42435. t.numbersign = 556;
  42436. t.dollar = 556;
  42437. t.percent = 889;
  42438. t.ampersand = 722;
  42439. t.quoteright = 278;
  42440. t.parenleft = 333;
  42441. t.parenright = 333;
  42442. t.asterisk = 389;
  42443. t.plus = 584;
  42444. t.comma = 278;
  42445. t.hyphen = 333;
  42446. t.period = 278;
  42447. t.slash = 278;
  42448. t.zero = 556;
  42449. t.one = 556;
  42450. t.two = 556;
  42451. t.three = 556;
  42452. t.four = 556;
  42453. t.five = 556;
  42454. t.six = 556;
  42455. t.seven = 556;
  42456. t.eight = 556;
  42457. t.nine = 556;
  42458. t.colon = 333;
  42459. t.semicolon = 333;
  42460. t.less = 584;
  42461. t.equal = 584;
  42462. t.greater = 584;
  42463. t.question = 611;
  42464. t.at = 975;
  42465. t.A = 722;
  42466. t.B = 722;
  42467. t.C = 722;
  42468. t.D = 722;
  42469. t.E = 667;
  42470. t.F = 611;
  42471. t.G = 778;
  42472. t.H = 722;
  42473. t.I = 278;
  42474. t.J = 556;
  42475. t.K = 722;
  42476. t.L = 611;
  42477. t.M = 833;
  42478. t.N = 722;
  42479. t.O = 778;
  42480. t.P = 667;
  42481. t.Q = 778;
  42482. t.R = 722;
  42483. t.S = 667;
  42484. t.T = 611;
  42485. t.U = 722;
  42486. t.V = 667;
  42487. t.W = 944;
  42488. t.X = 667;
  42489. t.Y = 667;
  42490. t.Z = 611;
  42491. t.bracketleft = 333;
  42492. t.backslash = 278;
  42493. t.bracketright = 333;
  42494. t.asciicircum = 584;
  42495. t.underscore = 556;
  42496. t.quoteleft = 278;
  42497. t.a = 556;
  42498. t.b = 611;
  42499. t.c = 556;
  42500. t.d = 611;
  42501. t.e = 556;
  42502. t.f = 333;
  42503. t.g = 611;
  42504. t.h = 611;
  42505. t.i = 278;
  42506. t.j = 278;
  42507. t.k = 556;
  42508. t.l = 278;
  42509. t.m = 889;
  42510. t.n = 611;
  42511. t.o = 611;
  42512. t.p = 611;
  42513. t.q = 611;
  42514. t.r = 389;
  42515. t.s = 556;
  42516. t.t = 333;
  42517. t.u = 611;
  42518. t.v = 556;
  42519. t.w = 778;
  42520. t.x = 556;
  42521. t.y = 556;
  42522. t.z = 500;
  42523. t.braceleft = 389;
  42524. t.bar = 280;
  42525. t.braceright = 389;
  42526. t.asciitilde = 584;
  42527. t.exclamdown = 333;
  42528. t.cent = 556;
  42529. t.sterling = 556;
  42530. t.fraction = 167;
  42531. t.yen = 556;
  42532. t.florin = 556;
  42533. t.section = 556;
  42534. t.currency = 556;
  42535. t.quotesingle = 238;
  42536. t.quotedblleft = 500;
  42537. t.guillemotleft = 556;
  42538. t.guilsinglleft = 333;
  42539. t.guilsinglright = 333;
  42540. t.fi = 611;
  42541. t.fl = 611;
  42542. t.endash = 556;
  42543. t.dagger = 556;
  42544. t.daggerdbl = 556;
  42545. t.periodcentered = 278;
  42546. t.paragraph = 556;
  42547. t.bullet = 350;
  42548. t.quotesinglbase = 278;
  42549. t.quotedblbase = 500;
  42550. t.quotedblright = 500;
  42551. t.guillemotright = 556;
  42552. t.ellipsis = 1000;
  42553. t.perthousand = 1000;
  42554. t.questiondown = 611;
  42555. t.grave = 333;
  42556. t.acute = 333;
  42557. t.circumflex = 333;
  42558. t.tilde = 333;
  42559. t.macron = 333;
  42560. t.breve = 333;
  42561. t.dotaccent = 333;
  42562. t.dieresis = 333;
  42563. t.ring = 333;
  42564. t.cedilla = 333;
  42565. t.hungarumlaut = 333;
  42566. t.ogonek = 333;
  42567. t.caron = 333;
  42568. t.emdash = 1000;
  42569. t.AE = 1000;
  42570. t.ordfeminine = 370;
  42571. t.Lslash = 611;
  42572. t.Oslash = 778;
  42573. t.OE = 1000;
  42574. t.ordmasculine = 365;
  42575. t.ae = 889;
  42576. t.dotlessi = 278;
  42577. t.lslash = 278;
  42578. t.oslash = 611;
  42579. t.oe = 944;
  42580. t.germandbls = 611;
  42581. t.Idieresis = 278;
  42582. t.eacute = 556;
  42583. t.abreve = 556;
  42584. t.uhungarumlaut = 611;
  42585. t.ecaron = 556;
  42586. t.Ydieresis = 667;
  42587. t.divide = 584;
  42588. t.Yacute = 667;
  42589. t.Acircumflex = 722;
  42590. t.aacute = 556;
  42591. t.Ucircumflex = 722;
  42592. t.yacute = 556;
  42593. t.scommaaccent = 556;
  42594. t.ecircumflex = 556;
  42595. t.Uring = 722;
  42596. t.Udieresis = 722;
  42597. t.aogonek = 556;
  42598. t.Uacute = 722;
  42599. t.uogonek = 611;
  42600. t.Edieresis = 667;
  42601. t.Dcroat = 722;
  42602. t.commaaccent = 250;
  42603. t.copyright = 737;
  42604. t.Emacron = 667;
  42605. t.ccaron = 556;
  42606. t.aring = 556;
  42607. t.Ncommaaccent = 722;
  42608. t.lacute = 278;
  42609. t.agrave = 556;
  42610. t.Tcommaaccent = 611;
  42611. t.Cacute = 722;
  42612. t.atilde = 556;
  42613. t.Edotaccent = 667;
  42614. t.scaron = 556;
  42615. t.scedilla = 556;
  42616. t.iacute = 278;
  42617. t.lozenge = 494;
  42618. t.Rcaron = 722;
  42619. t.Gcommaaccent = 778;
  42620. t.ucircumflex = 611;
  42621. t.acircumflex = 556;
  42622. t.Amacron = 722;
  42623. t.rcaron = 389;
  42624. t.ccedilla = 556;
  42625. t.Zdotaccent = 611;
  42626. t.Thorn = 667;
  42627. t.Omacron = 778;
  42628. t.Racute = 722;
  42629. t.Sacute = 667;
  42630. t.dcaron = 743;
  42631. t.Umacron = 722;
  42632. t.uring = 611;
  42633. t.threesuperior = 333;
  42634. t.Ograve = 778;
  42635. t.Agrave = 722;
  42636. t.Abreve = 722;
  42637. t.multiply = 584;
  42638. t.uacute = 611;
  42639. t.Tcaron = 611;
  42640. t.partialdiff = 494;
  42641. t.ydieresis = 556;
  42642. t.Nacute = 722;
  42643. t.icircumflex = 278;
  42644. t.Ecircumflex = 667;
  42645. t.adieresis = 556;
  42646. t.edieresis = 556;
  42647. t.cacute = 556;
  42648. t.nacute = 611;
  42649. t.umacron = 611;
  42650. t.Ncaron = 722;
  42651. t.Iacute = 278;
  42652. t.plusminus = 584;
  42653. t.brokenbar = 280;
  42654. t.registered = 737;
  42655. t.Gbreve = 778;
  42656. t.Idotaccent = 278;
  42657. t.summation = 600;
  42658. t.Egrave = 667;
  42659. t.racute = 389;
  42660. t.omacron = 611;
  42661. t.Zacute = 611;
  42662. t.Zcaron = 611;
  42663. t.greaterequal = 549;
  42664. t.Eth = 722;
  42665. t.Ccedilla = 722;
  42666. t.lcommaaccent = 278;
  42667. t.tcaron = 389;
  42668. t.eogonek = 556;
  42669. t.Uogonek = 722;
  42670. t.Aacute = 722;
  42671. t.Adieresis = 722;
  42672. t.egrave = 556;
  42673. t.zacute = 500;
  42674. t.iogonek = 278;
  42675. t.Oacute = 778;
  42676. t.oacute = 611;
  42677. t.amacron = 556;
  42678. t.sacute = 556;
  42679. t.idieresis = 278;
  42680. t.Ocircumflex = 778;
  42681. t.Ugrave = 722;
  42682. t.Delta = 612;
  42683. t.thorn = 611;
  42684. t.twosuperior = 333;
  42685. t.Odieresis = 778;
  42686. t.mu = 611;
  42687. t.igrave = 278;
  42688. t.ohungarumlaut = 611;
  42689. t.Eogonek = 667;
  42690. t.dcroat = 611;
  42691. t.threequarters = 834;
  42692. t.Scedilla = 667;
  42693. t.lcaron = 400;
  42694. t.Kcommaaccent = 722;
  42695. t.Lacute = 611;
  42696. t.trademark = 1000;
  42697. t.edotaccent = 556;
  42698. t.Igrave = 278;
  42699. t.Imacron = 278;
  42700. t.Lcaron = 611;
  42701. t.onehalf = 834;
  42702. t.lessequal = 549;
  42703. t.ocircumflex = 611;
  42704. t.ntilde = 611;
  42705. t.Uhungarumlaut = 722;
  42706. t.Eacute = 667;
  42707. t.emacron = 556;
  42708. t.gbreve = 611;
  42709. t.onequarter = 834;
  42710. t.Scaron = 667;
  42711. t.Scommaaccent = 667;
  42712. t.Ohungarumlaut = 778;
  42713. t.degree = 400;
  42714. t.ograve = 611;
  42715. t.Ccaron = 722;
  42716. t.ugrave = 611;
  42717. t.radical = 549;
  42718. t.Dcaron = 722;
  42719. t.rcommaaccent = 389;
  42720. t.Ntilde = 722;
  42721. t.otilde = 611;
  42722. t.Rcommaaccent = 722;
  42723. t.Lcommaaccent = 611;
  42724. t.Atilde = 722;
  42725. t.Aogonek = 722;
  42726. t.Aring = 722;
  42727. t.Otilde = 778;
  42728. t.zdotaccent = 500;
  42729. t.Ecaron = 667;
  42730. t.Iogonek = 278;
  42731. t.kcommaaccent = 556;
  42732. t.minus = 584;
  42733. t.Icircumflex = 278;
  42734. t.ncaron = 611;
  42735. t.tcommaaccent = 333;
  42736. t.logicalnot = 584;
  42737. t.odieresis = 611;
  42738. t.udieresis = 611;
  42739. t.notequal = 549;
  42740. t.gcommaaccent = 611;
  42741. t.eth = 611;
  42742. t.zcaron = 500;
  42743. t.ncommaaccent = 611;
  42744. t.onesuperior = 333;
  42745. t.imacron = 278;
  42746. t.Euro = 556;
  42747. });
  42748. t["Helvetica-BoldOblique"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  42749. t.space = 278;
  42750. t.exclam = 333;
  42751. t.quotedbl = 474;
  42752. t.numbersign = 556;
  42753. t.dollar = 556;
  42754. t.percent = 889;
  42755. t.ampersand = 722;
  42756. t.quoteright = 278;
  42757. t.parenleft = 333;
  42758. t.parenright = 333;
  42759. t.asterisk = 389;
  42760. t.plus = 584;
  42761. t.comma = 278;
  42762. t.hyphen = 333;
  42763. t.period = 278;
  42764. t.slash = 278;
  42765. t.zero = 556;
  42766. t.one = 556;
  42767. t.two = 556;
  42768. t.three = 556;
  42769. t.four = 556;
  42770. t.five = 556;
  42771. t.six = 556;
  42772. t.seven = 556;
  42773. t.eight = 556;
  42774. t.nine = 556;
  42775. t.colon = 333;
  42776. t.semicolon = 333;
  42777. t.less = 584;
  42778. t.equal = 584;
  42779. t.greater = 584;
  42780. t.question = 611;
  42781. t.at = 975;
  42782. t.A = 722;
  42783. t.B = 722;
  42784. t.C = 722;
  42785. t.D = 722;
  42786. t.E = 667;
  42787. t.F = 611;
  42788. t.G = 778;
  42789. t.H = 722;
  42790. t.I = 278;
  42791. t.J = 556;
  42792. t.K = 722;
  42793. t.L = 611;
  42794. t.M = 833;
  42795. t.N = 722;
  42796. t.O = 778;
  42797. t.P = 667;
  42798. t.Q = 778;
  42799. t.R = 722;
  42800. t.S = 667;
  42801. t.T = 611;
  42802. t.U = 722;
  42803. t.V = 667;
  42804. t.W = 944;
  42805. t.X = 667;
  42806. t.Y = 667;
  42807. t.Z = 611;
  42808. t.bracketleft = 333;
  42809. t.backslash = 278;
  42810. t.bracketright = 333;
  42811. t.asciicircum = 584;
  42812. t.underscore = 556;
  42813. t.quoteleft = 278;
  42814. t.a = 556;
  42815. t.b = 611;
  42816. t.c = 556;
  42817. t.d = 611;
  42818. t.e = 556;
  42819. t.f = 333;
  42820. t.g = 611;
  42821. t.h = 611;
  42822. t.i = 278;
  42823. t.j = 278;
  42824. t.k = 556;
  42825. t.l = 278;
  42826. t.m = 889;
  42827. t.n = 611;
  42828. t.o = 611;
  42829. t.p = 611;
  42830. t.q = 611;
  42831. t.r = 389;
  42832. t.s = 556;
  42833. t.t = 333;
  42834. t.u = 611;
  42835. t.v = 556;
  42836. t.w = 778;
  42837. t.x = 556;
  42838. t.y = 556;
  42839. t.z = 500;
  42840. t.braceleft = 389;
  42841. t.bar = 280;
  42842. t.braceright = 389;
  42843. t.asciitilde = 584;
  42844. t.exclamdown = 333;
  42845. t.cent = 556;
  42846. t.sterling = 556;
  42847. t.fraction = 167;
  42848. t.yen = 556;
  42849. t.florin = 556;
  42850. t.section = 556;
  42851. t.currency = 556;
  42852. t.quotesingle = 238;
  42853. t.quotedblleft = 500;
  42854. t.guillemotleft = 556;
  42855. t.guilsinglleft = 333;
  42856. t.guilsinglright = 333;
  42857. t.fi = 611;
  42858. t.fl = 611;
  42859. t.endash = 556;
  42860. t.dagger = 556;
  42861. t.daggerdbl = 556;
  42862. t.periodcentered = 278;
  42863. t.paragraph = 556;
  42864. t.bullet = 350;
  42865. t.quotesinglbase = 278;
  42866. t.quotedblbase = 500;
  42867. t.quotedblright = 500;
  42868. t.guillemotright = 556;
  42869. t.ellipsis = 1000;
  42870. t.perthousand = 1000;
  42871. t.questiondown = 611;
  42872. t.grave = 333;
  42873. t.acute = 333;
  42874. t.circumflex = 333;
  42875. t.tilde = 333;
  42876. t.macron = 333;
  42877. t.breve = 333;
  42878. t.dotaccent = 333;
  42879. t.dieresis = 333;
  42880. t.ring = 333;
  42881. t.cedilla = 333;
  42882. t.hungarumlaut = 333;
  42883. t.ogonek = 333;
  42884. t.caron = 333;
  42885. t.emdash = 1000;
  42886. t.AE = 1000;
  42887. t.ordfeminine = 370;
  42888. t.Lslash = 611;
  42889. t.Oslash = 778;
  42890. t.OE = 1000;
  42891. t.ordmasculine = 365;
  42892. t.ae = 889;
  42893. t.dotlessi = 278;
  42894. t.lslash = 278;
  42895. t.oslash = 611;
  42896. t.oe = 944;
  42897. t.germandbls = 611;
  42898. t.Idieresis = 278;
  42899. t.eacute = 556;
  42900. t.abreve = 556;
  42901. t.uhungarumlaut = 611;
  42902. t.ecaron = 556;
  42903. t.Ydieresis = 667;
  42904. t.divide = 584;
  42905. t.Yacute = 667;
  42906. t.Acircumflex = 722;
  42907. t.aacute = 556;
  42908. t.Ucircumflex = 722;
  42909. t.yacute = 556;
  42910. t.scommaaccent = 556;
  42911. t.ecircumflex = 556;
  42912. t.Uring = 722;
  42913. t.Udieresis = 722;
  42914. t.aogonek = 556;
  42915. t.Uacute = 722;
  42916. t.uogonek = 611;
  42917. t.Edieresis = 667;
  42918. t.Dcroat = 722;
  42919. t.commaaccent = 250;
  42920. t.copyright = 737;
  42921. t.Emacron = 667;
  42922. t.ccaron = 556;
  42923. t.aring = 556;
  42924. t.Ncommaaccent = 722;
  42925. t.lacute = 278;
  42926. t.agrave = 556;
  42927. t.Tcommaaccent = 611;
  42928. t.Cacute = 722;
  42929. t.atilde = 556;
  42930. t.Edotaccent = 667;
  42931. t.scaron = 556;
  42932. t.scedilla = 556;
  42933. t.iacute = 278;
  42934. t.lozenge = 494;
  42935. t.Rcaron = 722;
  42936. t.Gcommaaccent = 778;
  42937. t.ucircumflex = 611;
  42938. t.acircumflex = 556;
  42939. t.Amacron = 722;
  42940. t.rcaron = 389;
  42941. t.ccedilla = 556;
  42942. t.Zdotaccent = 611;
  42943. t.Thorn = 667;
  42944. t.Omacron = 778;
  42945. t.Racute = 722;
  42946. t.Sacute = 667;
  42947. t.dcaron = 743;
  42948. t.Umacron = 722;
  42949. t.uring = 611;
  42950. t.threesuperior = 333;
  42951. t.Ograve = 778;
  42952. t.Agrave = 722;
  42953. t.Abreve = 722;
  42954. t.multiply = 584;
  42955. t.uacute = 611;
  42956. t.Tcaron = 611;
  42957. t.partialdiff = 494;
  42958. t.ydieresis = 556;
  42959. t.Nacute = 722;
  42960. t.icircumflex = 278;
  42961. t.Ecircumflex = 667;
  42962. t.adieresis = 556;
  42963. t.edieresis = 556;
  42964. t.cacute = 556;
  42965. t.nacute = 611;
  42966. t.umacron = 611;
  42967. t.Ncaron = 722;
  42968. t.Iacute = 278;
  42969. t.plusminus = 584;
  42970. t.brokenbar = 280;
  42971. t.registered = 737;
  42972. t.Gbreve = 778;
  42973. t.Idotaccent = 278;
  42974. t.summation = 600;
  42975. t.Egrave = 667;
  42976. t.racute = 389;
  42977. t.omacron = 611;
  42978. t.Zacute = 611;
  42979. t.Zcaron = 611;
  42980. t.greaterequal = 549;
  42981. t.Eth = 722;
  42982. t.Ccedilla = 722;
  42983. t.lcommaaccent = 278;
  42984. t.tcaron = 389;
  42985. t.eogonek = 556;
  42986. t.Uogonek = 722;
  42987. t.Aacute = 722;
  42988. t.Adieresis = 722;
  42989. t.egrave = 556;
  42990. t.zacute = 500;
  42991. t.iogonek = 278;
  42992. t.Oacute = 778;
  42993. t.oacute = 611;
  42994. t.amacron = 556;
  42995. t.sacute = 556;
  42996. t.idieresis = 278;
  42997. t.Ocircumflex = 778;
  42998. t.Ugrave = 722;
  42999. t.Delta = 612;
  43000. t.thorn = 611;
  43001. t.twosuperior = 333;
  43002. t.Odieresis = 778;
  43003. t.mu = 611;
  43004. t.igrave = 278;
  43005. t.ohungarumlaut = 611;
  43006. t.Eogonek = 667;
  43007. t.dcroat = 611;
  43008. t.threequarters = 834;
  43009. t.Scedilla = 667;
  43010. t.lcaron = 400;
  43011. t.Kcommaaccent = 722;
  43012. t.Lacute = 611;
  43013. t.trademark = 1000;
  43014. t.edotaccent = 556;
  43015. t.Igrave = 278;
  43016. t.Imacron = 278;
  43017. t.Lcaron = 611;
  43018. t.onehalf = 834;
  43019. t.lessequal = 549;
  43020. t.ocircumflex = 611;
  43021. t.ntilde = 611;
  43022. t.Uhungarumlaut = 722;
  43023. t.Eacute = 667;
  43024. t.emacron = 556;
  43025. t.gbreve = 611;
  43026. t.onequarter = 834;
  43027. t.Scaron = 667;
  43028. t.Scommaaccent = 667;
  43029. t.Ohungarumlaut = 778;
  43030. t.degree = 400;
  43031. t.ograve = 611;
  43032. t.Ccaron = 722;
  43033. t.ugrave = 611;
  43034. t.radical = 549;
  43035. t.Dcaron = 722;
  43036. t.rcommaaccent = 389;
  43037. t.Ntilde = 722;
  43038. t.otilde = 611;
  43039. t.Rcommaaccent = 722;
  43040. t.Lcommaaccent = 611;
  43041. t.Atilde = 722;
  43042. t.Aogonek = 722;
  43043. t.Aring = 722;
  43044. t.Otilde = 778;
  43045. t.zdotaccent = 500;
  43046. t.Ecaron = 667;
  43047. t.Iogonek = 278;
  43048. t.kcommaaccent = 556;
  43049. t.minus = 584;
  43050. t.Icircumflex = 278;
  43051. t.ncaron = 611;
  43052. t.tcommaaccent = 333;
  43053. t.logicalnot = 584;
  43054. t.odieresis = 611;
  43055. t.udieresis = 611;
  43056. t.notequal = 549;
  43057. t.gcommaaccent = 611;
  43058. t.eth = 611;
  43059. t.zcaron = 500;
  43060. t.ncommaaccent = 611;
  43061. t.onesuperior = 333;
  43062. t.imacron = 278;
  43063. t.Euro = 556;
  43064. });
  43065. t["Helvetica-Oblique"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  43066. t.space = 278;
  43067. t.exclam = 278;
  43068. t.quotedbl = 355;
  43069. t.numbersign = 556;
  43070. t.dollar = 556;
  43071. t.percent = 889;
  43072. t.ampersand = 667;
  43073. t.quoteright = 222;
  43074. t.parenleft = 333;
  43075. t.parenright = 333;
  43076. t.asterisk = 389;
  43077. t.plus = 584;
  43078. t.comma = 278;
  43079. t.hyphen = 333;
  43080. t.period = 278;
  43081. t.slash = 278;
  43082. t.zero = 556;
  43083. t.one = 556;
  43084. t.two = 556;
  43085. t.three = 556;
  43086. t.four = 556;
  43087. t.five = 556;
  43088. t.six = 556;
  43089. t.seven = 556;
  43090. t.eight = 556;
  43091. t.nine = 556;
  43092. t.colon = 278;
  43093. t.semicolon = 278;
  43094. t.less = 584;
  43095. t.equal = 584;
  43096. t.greater = 584;
  43097. t.question = 556;
  43098. t.at = 1015;
  43099. t.A = 667;
  43100. t.B = 667;
  43101. t.C = 722;
  43102. t.D = 722;
  43103. t.E = 667;
  43104. t.F = 611;
  43105. t.G = 778;
  43106. t.H = 722;
  43107. t.I = 278;
  43108. t.J = 500;
  43109. t.K = 667;
  43110. t.L = 556;
  43111. t.M = 833;
  43112. t.N = 722;
  43113. t.O = 778;
  43114. t.P = 667;
  43115. t.Q = 778;
  43116. t.R = 722;
  43117. t.S = 667;
  43118. t.T = 611;
  43119. t.U = 722;
  43120. t.V = 667;
  43121. t.W = 944;
  43122. t.X = 667;
  43123. t.Y = 667;
  43124. t.Z = 611;
  43125. t.bracketleft = 278;
  43126. t.backslash = 278;
  43127. t.bracketright = 278;
  43128. t.asciicircum = 469;
  43129. t.underscore = 556;
  43130. t.quoteleft = 222;
  43131. t.a = 556;
  43132. t.b = 556;
  43133. t.c = 500;
  43134. t.d = 556;
  43135. t.e = 556;
  43136. t.f = 278;
  43137. t.g = 556;
  43138. t.h = 556;
  43139. t.i = 222;
  43140. t.j = 222;
  43141. t.k = 500;
  43142. t.l = 222;
  43143. t.m = 833;
  43144. t.n = 556;
  43145. t.o = 556;
  43146. t.p = 556;
  43147. t.q = 556;
  43148. t.r = 333;
  43149. t.s = 500;
  43150. t.t = 278;
  43151. t.u = 556;
  43152. t.v = 500;
  43153. t.w = 722;
  43154. t.x = 500;
  43155. t.y = 500;
  43156. t.z = 500;
  43157. t.braceleft = 334;
  43158. t.bar = 260;
  43159. t.braceright = 334;
  43160. t.asciitilde = 584;
  43161. t.exclamdown = 333;
  43162. t.cent = 556;
  43163. t.sterling = 556;
  43164. t.fraction = 167;
  43165. t.yen = 556;
  43166. t.florin = 556;
  43167. t.section = 556;
  43168. t.currency = 556;
  43169. t.quotesingle = 191;
  43170. t.quotedblleft = 333;
  43171. t.guillemotleft = 556;
  43172. t.guilsinglleft = 333;
  43173. t.guilsinglright = 333;
  43174. t.fi = 500;
  43175. t.fl = 500;
  43176. t.endash = 556;
  43177. t.dagger = 556;
  43178. t.daggerdbl = 556;
  43179. t.periodcentered = 278;
  43180. t.paragraph = 537;
  43181. t.bullet = 350;
  43182. t.quotesinglbase = 222;
  43183. t.quotedblbase = 333;
  43184. t.quotedblright = 333;
  43185. t.guillemotright = 556;
  43186. t.ellipsis = 1000;
  43187. t.perthousand = 1000;
  43188. t.questiondown = 611;
  43189. t.grave = 333;
  43190. t.acute = 333;
  43191. t.circumflex = 333;
  43192. t.tilde = 333;
  43193. t.macron = 333;
  43194. t.breve = 333;
  43195. t.dotaccent = 333;
  43196. t.dieresis = 333;
  43197. t.ring = 333;
  43198. t.cedilla = 333;
  43199. t.hungarumlaut = 333;
  43200. t.ogonek = 333;
  43201. t.caron = 333;
  43202. t.emdash = 1000;
  43203. t.AE = 1000;
  43204. t.ordfeminine = 370;
  43205. t.Lslash = 556;
  43206. t.Oslash = 778;
  43207. t.OE = 1000;
  43208. t.ordmasculine = 365;
  43209. t.ae = 889;
  43210. t.dotlessi = 278;
  43211. t.lslash = 222;
  43212. t.oslash = 611;
  43213. t.oe = 944;
  43214. t.germandbls = 611;
  43215. t.Idieresis = 278;
  43216. t.eacute = 556;
  43217. t.abreve = 556;
  43218. t.uhungarumlaut = 556;
  43219. t.ecaron = 556;
  43220. t.Ydieresis = 667;
  43221. t.divide = 584;
  43222. t.Yacute = 667;
  43223. t.Acircumflex = 667;
  43224. t.aacute = 556;
  43225. t.Ucircumflex = 722;
  43226. t.yacute = 500;
  43227. t.scommaaccent = 500;
  43228. t.ecircumflex = 556;
  43229. t.Uring = 722;
  43230. t.Udieresis = 722;
  43231. t.aogonek = 556;
  43232. t.Uacute = 722;
  43233. t.uogonek = 556;
  43234. t.Edieresis = 667;
  43235. t.Dcroat = 722;
  43236. t.commaaccent = 250;
  43237. t.copyright = 737;
  43238. t.Emacron = 667;
  43239. t.ccaron = 500;
  43240. t.aring = 556;
  43241. t.Ncommaaccent = 722;
  43242. t.lacute = 222;
  43243. t.agrave = 556;
  43244. t.Tcommaaccent = 611;
  43245. t.Cacute = 722;
  43246. t.atilde = 556;
  43247. t.Edotaccent = 667;
  43248. t.scaron = 500;
  43249. t.scedilla = 500;
  43250. t.iacute = 278;
  43251. t.lozenge = 471;
  43252. t.Rcaron = 722;
  43253. t.Gcommaaccent = 778;
  43254. t.ucircumflex = 556;
  43255. t.acircumflex = 556;
  43256. t.Amacron = 667;
  43257. t.rcaron = 333;
  43258. t.ccedilla = 500;
  43259. t.Zdotaccent = 611;
  43260. t.Thorn = 667;
  43261. t.Omacron = 778;
  43262. t.Racute = 722;
  43263. t.Sacute = 667;
  43264. t.dcaron = 643;
  43265. t.Umacron = 722;
  43266. t.uring = 556;
  43267. t.threesuperior = 333;
  43268. t.Ograve = 778;
  43269. t.Agrave = 667;
  43270. t.Abreve = 667;
  43271. t.multiply = 584;
  43272. t.uacute = 556;
  43273. t.Tcaron = 611;
  43274. t.partialdiff = 476;
  43275. t.ydieresis = 500;
  43276. t.Nacute = 722;
  43277. t.icircumflex = 278;
  43278. t.Ecircumflex = 667;
  43279. t.adieresis = 556;
  43280. t.edieresis = 556;
  43281. t.cacute = 500;
  43282. t.nacute = 556;
  43283. t.umacron = 556;
  43284. t.Ncaron = 722;
  43285. t.Iacute = 278;
  43286. t.plusminus = 584;
  43287. t.brokenbar = 260;
  43288. t.registered = 737;
  43289. t.Gbreve = 778;
  43290. t.Idotaccent = 278;
  43291. t.summation = 600;
  43292. t.Egrave = 667;
  43293. t.racute = 333;
  43294. t.omacron = 556;
  43295. t.Zacute = 611;
  43296. t.Zcaron = 611;
  43297. t.greaterequal = 549;
  43298. t.Eth = 722;
  43299. t.Ccedilla = 722;
  43300. t.lcommaaccent = 222;
  43301. t.tcaron = 317;
  43302. t.eogonek = 556;
  43303. t.Uogonek = 722;
  43304. t.Aacute = 667;
  43305. t.Adieresis = 667;
  43306. t.egrave = 556;
  43307. t.zacute = 500;
  43308. t.iogonek = 222;
  43309. t.Oacute = 778;
  43310. t.oacute = 556;
  43311. t.amacron = 556;
  43312. t.sacute = 500;
  43313. t.idieresis = 278;
  43314. t.Ocircumflex = 778;
  43315. t.Ugrave = 722;
  43316. t.Delta = 612;
  43317. t.thorn = 556;
  43318. t.twosuperior = 333;
  43319. t.Odieresis = 778;
  43320. t.mu = 556;
  43321. t.igrave = 278;
  43322. t.ohungarumlaut = 556;
  43323. t.Eogonek = 667;
  43324. t.dcroat = 556;
  43325. t.threequarters = 834;
  43326. t.Scedilla = 667;
  43327. t.lcaron = 299;
  43328. t.Kcommaaccent = 667;
  43329. t.Lacute = 556;
  43330. t.trademark = 1000;
  43331. t.edotaccent = 556;
  43332. t.Igrave = 278;
  43333. t.Imacron = 278;
  43334. t.Lcaron = 556;
  43335. t.onehalf = 834;
  43336. t.lessequal = 549;
  43337. t.ocircumflex = 556;
  43338. t.ntilde = 556;
  43339. t.Uhungarumlaut = 722;
  43340. t.Eacute = 667;
  43341. t.emacron = 556;
  43342. t.gbreve = 556;
  43343. t.onequarter = 834;
  43344. t.Scaron = 667;
  43345. t.Scommaaccent = 667;
  43346. t.Ohungarumlaut = 778;
  43347. t.degree = 400;
  43348. t.ograve = 556;
  43349. t.Ccaron = 722;
  43350. t.ugrave = 556;
  43351. t.radical = 453;
  43352. t.Dcaron = 722;
  43353. t.rcommaaccent = 333;
  43354. t.Ntilde = 722;
  43355. t.otilde = 556;
  43356. t.Rcommaaccent = 722;
  43357. t.Lcommaaccent = 556;
  43358. t.Atilde = 667;
  43359. t.Aogonek = 667;
  43360. t.Aring = 667;
  43361. t.Otilde = 778;
  43362. t.zdotaccent = 500;
  43363. t.Ecaron = 667;
  43364. t.Iogonek = 278;
  43365. t.kcommaaccent = 500;
  43366. t.minus = 584;
  43367. t.Icircumflex = 278;
  43368. t.ncaron = 556;
  43369. t.tcommaaccent = 278;
  43370. t.logicalnot = 584;
  43371. t.odieresis = 556;
  43372. t.udieresis = 556;
  43373. t.notequal = 549;
  43374. t.gcommaaccent = 556;
  43375. t.eth = 556;
  43376. t.zcaron = 500;
  43377. t.ncommaaccent = 556;
  43378. t.onesuperior = 333;
  43379. t.imacron = 278;
  43380. t.Euro = 556;
  43381. });
  43382. t.Symbol = (0, _core_utils.getLookupTableFactory)(function (t) {
  43383. t.space = 250;
  43384. t.exclam = 333;
  43385. t.universal = 713;
  43386. t.numbersign = 500;
  43387. t.existential = 549;
  43388. t.percent = 833;
  43389. t.ampersand = 778;
  43390. t.suchthat = 439;
  43391. t.parenleft = 333;
  43392. t.parenright = 333;
  43393. t.asteriskmath = 500;
  43394. t.plus = 549;
  43395. t.comma = 250;
  43396. t.minus = 549;
  43397. t.period = 250;
  43398. t.slash = 278;
  43399. t.zero = 500;
  43400. t.one = 500;
  43401. t.two = 500;
  43402. t.three = 500;
  43403. t.four = 500;
  43404. t.five = 500;
  43405. t.six = 500;
  43406. t.seven = 500;
  43407. t.eight = 500;
  43408. t.nine = 500;
  43409. t.colon = 278;
  43410. t.semicolon = 278;
  43411. t.less = 549;
  43412. t.equal = 549;
  43413. t.greater = 549;
  43414. t.question = 444;
  43415. t.congruent = 549;
  43416. t.Alpha = 722;
  43417. t.Beta = 667;
  43418. t.Chi = 722;
  43419. t.Delta = 612;
  43420. t.Epsilon = 611;
  43421. t.Phi = 763;
  43422. t.Gamma = 603;
  43423. t.Eta = 722;
  43424. t.Iota = 333;
  43425. t.theta1 = 631;
  43426. t.Kappa = 722;
  43427. t.Lambda = 686;
  43428. t.Mu = 889;
  43429. t.Nu = 722;
  43430. t.Omicron = 722;
  43431. t.Pi = 768;
  43432. t.Theta = 741;
  43433. t.Rho = 556;
  43434. t.Sigma = 592;
  43435. t.Tau = 611;
  43436. t.Upsilon = 690;
  43437. t.sigma1 = 439;
  43438. t.Omega = 768;
  43439. t.Xi = 645;
  43440. t.Psi = 795;
  43441. t.Zeta = 611;
  43442. t.bracketleft = 333;
  43443. t.therefore = 863;
  43444. t.bracketright = 333;
  43445. t.perpendicular = 658;
  43446. t.underscore = 500;
  43447. t.radicalex = 500;
  43448. t.alpha = 631;
  43449. t.beta = 549;
  43450. t.chi = 549;
  43451. t.delta = 494;
  43452. t.epsilon = 439;
  43453. t.phi = 521;
  43454. t.gamma = 411;
  43455. t.eta = 603;
  43456. t.iota = 329;
  43457. t.phi1 = 603;
  43458. t.kappa = 549;
  43459. t.lambda = 549;
  43460. t.mu = 576;
  43461. t.nu = 521;
  43462. t.omicron = 549;
  43463. t.pi = 549;
  43464. t.theta = 521;
  43465. t.rho = 549;
  43466. t.sigma = 603;
  43467. t.tau = 439;
  43468. t.upsilon = 576;
  43469. t.omega1 = 713;
  43470. t.omega = 686;
  43471. t.xi = 493;
  43472. t.psi = 686;
  43473. t.zeta = 494;
  43474. t.braceleft = 480;
  43475. t.bar = 200;
  43476. t.braceright = 480;
  43477. t.similar = 549;
  43478. t.Euro = 750;
  43479. t.Upsilon1 = 620;
  43480. t.minute = 247;
  43481. t.lessequal = 549;
  43482. t.fraction = 167;
  43483. t.infinity = 713;
  43484. t.florin = 500;
  43485. t.club = 753;
  43486. t.diamond = 753;
  43487. t.heart = 753;
  43488. t.spade = 753;
  43489. t.arrowboth = 1042;
  43490. t.arrowleft = 987;
  43491. t.arrowup = 603;
  43492. t.arrowright = 987;
  43493. t.arrowdown = 603;
  43494. t.degree = 400;
  43495. t.plusminus = 549;
  43496. t.second = 411;
  43497. t.greaterequal = 549;
  43498. t.multiply = 549;
  43499. t.proportional = 713;
  43500. t.partialdiff = 494;
  43501. t.bullet = 460;
  43502. t.divide = 549;
  43503. t.notequal = 549;
  43504. t.equivalence = 549;
  43505. t.approxequal = 549;
  43506. t.ellipsis = 1000;
  43507. t.arrowvertex = 603;
  43508. t.arrowhorizex = 1000;
  43509. t.carriagereturn = 658;
  43510. t.aleph = 823;
  43511. t.Ifraktur = 686;
  43512. t.Rfraktur = 795;
  43513. t.weierstrass = 987;
  43514. t.circlemultiply = 768;
  43515. t.circleplus = 768;
  43516. t.emptyset = 823;
  43517. t.intersection = 768;
  43518. t.union = 768;
  43519. t.propersuperset = 713;
  43520. t.reflexsuperset = 713;
  43521. t.notsubset = 713;
  43522. t.propersubset = 713;
  43523. t.reflexsubset = 713;
  43524. t.element = 713;
  43525. t.notelement = 713;
  43526. t.angle = 768;
  43527. t.gradient = 713;
  43528. t.registerserif = 790;
  43529. t.copyrightserif = 790;
  43530. t.trademarkserif = 890;
  43531. t.product = 823;
  43532. t.radical = 549;
  43533. t.dotmath = 250;
  43534. t.logicalnot = 713;
  43535. t.logicaland = 603;
  43536. t.logicalor = 603;
  43537. t.arrowdblboth = 1042;
  43538. t.arrowdblleft = 987;
  43539. t.arrowdblup = 603;
  43540. t.arrowdblright = 987;
  43541. t.arrowdbldown = 603;
  43542. t.lozenge = 494;
  43543. t.angleleft = 329;
  43544. t.registersans = 790;
  43545. t.copyrightsans = 790;
  43546. t.trademarksans = 786;
  43547. t.summation = 713;
  43548. t.parenlefttp = 384;
  43549. t.parenleftex = 384;
  43550. t.parenleftbt = 384;
  43551. t.bracketlefttp = 384;
  43552. t.bracketleftex = 384;
  43553. t.bracketleftbt = 384;
  43554. t.bracelefttp = 494;
  43555. t.braceleftmid = 494;
  43556. t.braceleftbt = 494;
  43557. t.braceex = 494;
  43558. t.angleright = 329;
  43559. t.integral = 274;
  43560. t.integraltp = 686;
  43561. t.integralex = 686;
  43562. t.integralbt = 686;
  43563. t.parenrighttp = 384;
  43564. t.parenrightex = 384;
  43565. t.parenrightbt = 384;
  43566. t.bracketrighttp = 384;
  43567. t.bracketrightex = 384;
  43568. t.bracketrightbt = 384;
  43569. t.bracerighttp = 494;
  43570. t.bracerightmid = 494;
  43571. t.bracerightbt = 494;
  43572. t.apple = 790;
  43573. });
  43574. t["Times-Roman"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  43575. t.space = 250;
  43576. t.exclam = 333;
  43577. t.quotedbl = 408;
  43578. t.numbersign = 500;
  43579. t.dollar = 500;
  43580. t.percent = 833;
  43581. t.ampersand = 778;
  43582. t.quoteright = 333;
  43583. t.parenleft = 333;
  43584. t.parenright = 333;
  43585. t.asterisk = 500;
  43586. t.plus = 564;
  43587. t.comma = 250;
  43588. t.hyphen = 333;
  43589. t.period = 250;
  43590. t.slash = 278;
  43591. t.zero = 500;
  43592. t.one = 500;
  43593. t.two = 500;
  43594. t.three = 500;
  43595. t.four = 500;
  43596. t.five = 500;
  43597. t.six = 500;
  43598. t.seven = 500;
  43599. t.eight = 500;
  43600. t.nine = 500;
  43601. t.colon = 278;
  43602. t.semicolon = 278;
  43603. t.less = 564;
  43604. t.equal = 564;
  43605. t.greater = 564;
  43606. t.question = 444;
  43607. t.at = 921;
  43608. t.A = 722;
  43609. t.B = 667;
  43610. t.C = 667;
  43611. t.D = 722;
  43612. t.E = 611;
  43613. t.F = 556;
  43614. t.G = 722;
  43615. t.H = 722;
  43616. t.I = 333;
  43617. t.J = 389;
  43618. t.K = 722;
  43619. t.L = 611;
  43620. t.M = 889;
  43621. t.N = 722;
  43622. t.O = 722;
  43623. t.P = 556;
  43624. t.Q = 722;
  43625. t.R = 667;
  43626. t.S = 556;
  43627. t.T = 611;
  43628. t.U = 722;
  43629. t.V = 722;
  43630. t.W = 944;
  43631. t.X = 722;
  43632. t.Y = 722;
  43633. t.Z = 611;
  43634. t.bracketleft = 333;
  43635. t.backslash = 278;
  43636. t.bracketright = 333;
  43637. t.asciicircum = 469;
  43638. t.underscore = 500;
  43639. t.quoteleft = 333;
  43640. t.a = 444;
  43641. t.b = 500;
  43642. t.c = 444;
  43643. t.d = 500;
  43644. t.e = 444;
  43645. t.f = 333;
  43646. t.g = 500;
  43647. t.h = 500;
  43648. t.i = 278;
  43649. t.j = 278;
  43650. t.k = 500;
  43651. t.l = 278;
  43652. t.m = 778;
  43653. t.n = 500;
  43654. t.o = 500;
  43655. t.p = 500;
  43656. t.q = 500;
  43657. t.r = 333;
  43658. t.s = 389;
  43659. t.t = 278;
  43660. t.u = 500;
  43661. t.v = 500;
  43662. t.w = 722;
  43663. t.x = 500;
  43664. t.y = 500;
  43665. t.z = 444;
  43666. t.braceleft = 480;
  43667. t.bar = 200;
  43668. t.braceright = 480;
  43669. t.asciitilde = 541;
  43670. t.exclamdown = 333;
  43671. t.cent = 500;
  43672. t.sterling = 500;
  43673. t.fraction = 167;
  43674. t.yen = 500;
  43675. t.florin = 500;
  43676. t.section = 500;
  43677. t.currency = 500;
  43678. t.quotesingle = 180;
  43679. t.quotedblleft = 444;
  43680. t.guillemotleft = 500;
  43681. t.guilsinglleft = 333;
  43682. t.guilsinglright = 333;
  43683. t.fi = 556;
  43684. t.fl = 556;
  43685. t.endash = 500;
  43686. t.dagger = 500;
  43687. t.daggerdbl = 500;
  43688. t.periodcentered = 250;
  43689. t.paragraph = 453;
  43690. t.bullet = 350;
  43691. t.quotesinglbase = 333;
  43692. t.quotedblbase = 444;
  43693. t.quotedblright = 444;
  43694. t.guillemotright = 500;
  43695. t.ellipsis = 1000;
  43696. t.perthousand = 1000;
  43697. t.questiondown = 444;
  43698. t.grave = 333;
  43699. t.acute = 333;
  43700. t.circumflex = 333;
  43701. t.tilde = 333;
  43702. t.macron = 333;
  43703. t.breve = 333;
  43704. t.dotaccent = 333;
  43705. t.dieresis = 333;
  43706. t.ring = 333;
  43707. t.cedilla = 333;
  43708. t.hungarumlaut = 333;
  43709. t.ogonek = 333;
  43710. t.caron = 333;
  43711. t.emdash = 1000;
  43712. t.AE = 889;
  43713. t.ordfeminine = 276;
  43714. t.Lslash = 611;
  43715. t.Oslash = 722;
  43716. t.OE = 889;
  43717. t.ordmasculine = 310;
  43718. t.ae = 667;
  43719. t.dotlessi = 278;
  43720. t.lslash = 278;
  43721. t.oslash = 500;
  43722. t.oe = 722;
  43723. t.germandbls = 500;
  43724. t.Idieresis = 333;
  43725. t.eacute = 444;
  43726. t.abreve = 444;
  43727. t.uhungarumlaut = 500;
  43728. t.ecaron = 444;
  43729. t.Ydieresis = 722;
  43730. t.divide = 564;
  43731. t.Yacute = 722;
  43732. t.Acircumflex = 722;
  43733. t.aacute = 444;
  43734. t.Ucircumflex = 722;
  43735. t.yacute = 500;
  43736. t.scommaaccent = 389;
  43737. t.ecircumflex = 444;
  43738. t.Uring = 722;
  43739. t.Udieresis = 722;
  43740. t.aogonek = 444;
  43741. t.Uacute = 722;
  43742. t.uogonek = 500;
  43743. t.Edieresis = 611;
  43744. t.Dcroat = 722;
  43745. t.commaaccent = 250;
  43746. t.copyright = 760;
  43747. t.Emacron = 611;
  43748. t.ccaron = 444;
  43749. t.aring = 444;
  43750. t.Ncommaaccent = 722;
  43751. t.lacute = 278;
  43752. t.agrave = 444;
  43753. t.Tcommaaccent = 611;
  43754. t.Cacute = 667;
  43755. t.atilde = 444;
  43756. t.Edotaccent = 611;
  43757. t.scaron = 389;
  43758. t.scedilla = 389;
  43759. t.iacute = 278;
  43760. t.lozenge = 471;
  43761. t.Rcaron = 667;
  43762. t.Gcommaaccent = 722;
  43763. t.ucircumflex = 500;
  43764. t.acircumflex = 444;
  43765. t.Amacron = 722;
  43766. t.rcaron = 333;
  43767. t.ccedilla = 444;
  43768. t.Zdotaccent = 611;
  43769. t.Thorn = 556;
  43770. t.Omacron = 722;
  43771. t.Racute = 667;
  43772. t.Sacute = 556;
  43773. t.dcaron = 588;
  43774. t.Umacron = 722;
  43775. t.uring = 500;
  43776. t.threesuperior = 300;
  43777. t.Ograve = 722;
  43778. t.Agrave = 722;
  43779. t.Abreve = 722;
  43780. t.multiply = 564;
  43781. t.uacute = 500;
  43782. t.Tcaron = 611;
  43783. t.partialdiff = 476;
  43784. t.ydieresis = 500;
  43785. t.Nacute = 722;
  43786. t.icircumflex = 278;
  43787. t.Ecircumflex = 611;
  43788. t.adieresis = 444;
  43789. t.edieresis = 444;
  43790. t.cacute = 444;
  43791. t.nacute = 500;
  43792. t.umacron = 500;
  43793. t.Ncaron = 722;
  43794. t.Iacute = 333;
  43795. t.plusminus = 564;
  43796. t.brokenbar = 200;
  43797. t.registered = 760;
  43798. t.Gbreve = 722;
  43799. t.Idotaccent = 333;
  43800. t.summation = 600;
  43801. t.Egrave = 611;
  43802. t.racute = 333;
  43803. t.omacron = 500;
  43804. t.Zacute = 611;
  43805. t.Zcaron = 611;
  43806. t.greaterequal = 549;
  43807. t.Eth = 722;
  43808. t.Ccedilla = 667;
  43809. t.lcommaaccent = 278;
  43810. t.tcaron = 326;
  43811. t.eogonek = 444;
  43812. t.Uogonek = 722;
  43813. t.Aacute = 722;
  43814. t.Adieresis = 722;
  43815. t.egrave = 444;
  43816. t.zacute = 444;
  43817. t.iogonek = 278;
  43818. t.Oacute = 722;
  43819. t.oacute = 500;
  43820. t.amacron = 444;
  43821. t.sacute = 389;
  43822. t.idieresis = 278;
  43823. t.Ocircumflex = 722;
  43824. t.Ugrave = 722;
  43825. t.Delta = 612;
  43826. t.thorn = 500;
  43827. t.twosuperior = 300;
  43828. t.Odieresis = 722;
  43829. t.mu = 500;
  43830. t.igrave = 278;
  43831. t.ohungarumlaut = 500;
  43832. t.Eogonek = 611;
  43833. t.dcroat = 500;
  43834. t.threequarters = 750;
  43835. t.Scedilla = 556;
  43836. t.lcaron = 344;
  43837. t.Kcommaaccent = 722;
  43838. t.Lacute = 611;
  43839. t.trademark = 980;
  43840. t.edotaccent = 444;
  43841. t.Igrave = 333;
  43842. t.Imacron = 333;
  43843. t.Lcaron = 611;
  43844. t.onehalf = 750;
  43845. t.lessequal = 549;
  43846. t.ocircumflex = 500;
  43847. t.ntilde = 500;
  43848. t.Uhungarumlaut = 722;
  43849. t.Eacute = 611;
  43850. t.emacron = 444;
  43851. t.gbreve = 500;
  43852. t.onequarter = 750;
  43853. t.Scaron = 556;
  43854. t.Scommaaccent = 556;
  43855. t.Ohungarumlaut = 722;
  43856. t.degree = 400;
  43857. t.ograve = 500;
  43858. t.Ccaron = 667;
  43859. t.ugrave = 500;
  43860. t.radical = 453;
  43861. t.Dcaron = 722;
  43862. t.rcommaaccent = 333;
  43863. t.Ntilde = 722;
  43864. t.otilde = 500;
  43865. t.Rcommaaccent = 667;
  43866. t.Lcommaaccent = 611;
  43867. t.Atilde = 722;
  43868. t.Aogonek = 722;
  43869. t.Aring = 722;
  43870. t.Otilde = 722;
  43871. t.zdotaccent = 444;
  43872. t.Ecaron = 611;
  43873. t.Iogonek = 333;
  43874. t.kcommaaccent = 500;
  43875. t.minus = 564;
  43876. t.Icircumflex = 333;
  43877. t.ncaron = 500;
  43878. t.tcommaaccent = 278;
  43879. t.logicalnot = 564;
  43880. t.odieresis = 500;
  43881. t.udieresis = 500;
  43882. t.notequal = 549;
  43883. t.gcommaaccent = 500;
  43884. t.eth = 500;
  43885. t.zcaron = 444;
  43886. t.ncommaaccent = 500;
  43887. t.onesuperior = 300;
  43888. t.imacron = 278;
  43889. t.Euro = 500;
  43890. });
  43891. t["Times-Bold"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  43892. t.space = 250;
  43893. t.exclam = 333;
  43894. t.quotedbl = 555;
  43895. t.numbersign = 500;
  43896. t.dollar = 500;
  43897. t.percent = 1000;
  43898. t.ampersand = 833;
  43899. t.quoteright = 333;
  43900. t.parenleft = 333;
  43901. t.parenright = 333;
  43902. t.asterisk = 500;
  43903. t.plus = 570;
  43904. t.comma = 250;
  43905. t.hyphen = 333;
  43906. t.period = 250;
  43907. t.slash = 278;
  43908. t.zero = 500;
  43909. t.one = 500;
  43910. t.two = 500;
  43911. t.three = 500;
  43912. t.four = 500;
  43913. t.five = 500;
  43914. t.six = 500;
  43915. t.seven = 500;
  43916. t.eight = 500;
  43917. t.nine = 500;
  43918. t.colon = 333;
  43919. t.semicolon = 333;
  43920. t.less = 570;
  43921. t.equal = 570;
  43922. t.greater = 570;
  43923. t.question = 500;
  43924. t.at = 930;
  43925. t.A = 722;
  43926. t.B = 667;
  43927. t.C = 722;
  43928. t.D = 722;
  43929. t.E = 667;
  43930. t.F = 611;
  43931. t.G = 778;
  43932. t.H = 778;
  43933. t.I = 389;
  43934. t.J = 500;
  43935. t.K = 778;
  43936. t.L = 667;
  43937. t.M = 944;
  43938. t.N = 722;
  43939. t.O = 778;
  43940. t.P = 611;
  43941. t.Q = 778;
  43942. t.R = 722;
  43943. t.S = 556;
  43944. t.T = 667;
  43945. t.U = 722;
  43946. t.V = 722;
  43947. t.W = 1000;
  43948. t.X = 722;
  43949. t.Y = 722;
  43950. t.Z = 667;
  43951. t.bracketleft = 333;
  43952. t.backslash = 278;
  43953. t.bracketright = 333;
  43954. t.asciicircum = 581;
  43955. t.underscore = 500;
  43956. t.quoteleft = 333;
  43957. t.a = 500;
  43958. t.b = 556;
  43959. t.c = 444;
  43960. t.d = 556;
  43961. t.e = 444;
  43962. t.f = 333;
  43963. t.g = 500;
  43964. t.h = 556;
  43965. t.i = 278;
  43966. t.j = 333;
  43967. t.k = 556;
  43968. t.l = 278;
  43969. t.m = 833;
  43970. t.n = 556;
  43971. t.o = 500;
  43972. t.p = 556;
  43973. t.q = 556;
  43974. t.r = 444;
  43975. t.s = 389;
  43976. t.t = 333;
  43977. t.u = 556;
  43978. t.v = 500;
  43979. t.w = 722;
  43980. t.x = 500;
  43981. t.y = 500;
  43982. t.z = 444;
  43983. t.braceleft = 394;
  43984. t.bar = 220;
  43985. t.braceright = 394;
  43986. t.asciitilde = 520;
  43987. t.exclamdown = 333;
  43988. t.cent = 500;
  43989. t.sterling = 500;
  43990. t.fraction = 167;
  43991. t.yen = 500;
  43992. t.florin = 500;
  43993. t.section = 500;
  43994. t.currency = 500;
  43995. t.quotesingle = 278;
  43996. t.quotedblleft = 500;
  43997. t.guillemotleft = 500;
  43998. t.guilsinglleft = 333;
  43999. t.guilsinglright = 333;
  44000. t.fi = 556;
  44001. t.fl = 556;
  44002. t.endash = 500;
  44003. t.dagger = 500;
  44004. t.daggerdbl = 500;
  44005. t.periodcentered = 250;
  44006. t.paragraph = 540;
  44007. t.bullet = 350;
  44008. t.quotesinglbase = 333;
  44009. t.quotedblbase = 500;
  44010. t.quotedblright = 500;
  44011. t.guillemotright = 500;
  44012. t.ellipsis = 1000;
  44013. t.perthousand = 1000;
  44014. t.questiondown = 500;
  44015. t.grave = 333;
  44016. t.acute = 333;
  44017. t.circumflex = 333;
  44018. t.tilde = 333;
  44019. t.macron = 333;
  44020. t.breve = 333;
  44021. t.dotaccent = 333;
  44022. t.dieresis = 333;
  44023. t.ring = 333;
  44024. t.cedilla = 333;
  44025. t.hungarumlaut = 333;
  44026. t.ogonek = 333;
  44027. t.caron = 333;
  44028. t.emdash = 1000;
  44029. t.AE = 1000;
  44030. t.ordfeminine = 300;
  44031. t.Lslash = 667;
  44032. t.Oslash = 778;
  44033. t.OE = 1000;
  44034. t.ordmasculine = 330;
  44035. t.ae = 722;
  44036. t.dotlessi = 278;
  44037. t.lslash = 278;
  44038. t.oslash = 500;
  44039. t.oe = 722;
  44040. t.germandbls = 556;
  44041. t.Idieresis = 389;
  44042. t.eacute = 444;
  44043. t.abreve = 500;
  44044. t.uhungarumlaut = 556;
  44045. t.ecaron = 444;
  44046. t.Ydieresis = 722;
  44047. t.divide = 570;
  44048. t.Yacute = 722;
  44049. t.Acircumflex = 722;
  44050. t.aacute = 500;
  44051. t.Ucircumflex = 722;
  44052. t.yacute = 500;
  44053. t.scommaaccent = 389;
  44054. t.ecircumflex = 444;
  44055. t.Uring = 722;
  44056. t.Udieresis = 722;
  44057. t.aogonek = 500;
  44058. t.Uacute = 722;
  44059. t.uogonek = 556;
  44060. t.Edieresis = 667;
  44061. t.Dcroat = 722;
  44062. t.commaaccent = 250;
  44063. t.copyright = 747;
  44064. t.Emacron = 667;
  44065. t.ccaron = 444;
  44066. t.aring = 500;
  44067. t.Ncommaaccent = 722;
  44068. t.lacute = 278;
  44069. t.agrave = 500;
  44070. t.Tcommaaccent = 667;
  44071. t.Cacute = 722;
  44072. t.atilde = 500;
  44073. t.Edotaccent = 667;
  44074. t.scaron = 389;
  44075. t.scedilla = 389;
  44076. t.iacute = 278;
  44077. t.lozenge = 494;
  44078. t.Rcaron = 722;
  44079. t.Gcommaaccent = 778;
  44080. t.ucircumflex = 556;
  44081. t.acircumflex = 500;
  44082. t.Amacron = 722;
  44083. t.rcaron = 444;
  44084. t.ccedilla = 444;
  44085. t.Zdotaccent = 667;
  44086. t.Thorn = 611;
  44087. t.Omacron = 778;
  44088. t.Racute = 722;
  44089. t.Sacute = 556;
  44090. t.dcaron = 672;
  44091. t.Umacron = 722;
  44092. t.uring = 556;
  44093. t.threesuperior = 300;
  44094. t.Ograve = 778;
  44095. t.Agrave = 722;
  44096. t.Abreve = 722;
  44097. t.multiply = 570;
  44098. t.uacute = 556;
  44099. t.Tcaron = 667;
  44100. t.partialdiff = 494;
  44101. t.ydieresis = 500;
  44102. t.Nacute = 722;
  44103. t.icircumflex = 278;
  44104. t.Ecircumflex = 667;
  44105. t.adieresis = 500;
  44106. t.edieresis = 444;
  44107. t.cacute = 444;
  44108. t.nacute = 556;
  44109. t.umacron = 556;
  44110. t.Ncaron = 722;
  44111. t.Iacute = 389;
  44112. t.plusminus = 570;
  44113. t.brokenbar = 220;
  44114. t.registered = 747;
  44115. t.Gbreve = 778;
  44116. t.Idotaccent = 389;
  44117. t.summation = 600;
  44118. t.Egrave = 667;
  44119. t.racute = 444;
  44120. t.omacron = 500;
  44121. t.Zacute = 667;
  44122. t.Zcaron = 667;
  44123. t.greaterequal = 549;
  44124. t.Eth = 722;
  44125. t.Ccedilla = 722;
  44126. t.lcommaaccent = 278;
  44127. t.tcaron = 416;
  44128. t.eogonek = 444;
  44129. t.Uogonek = 722;
  44130. t.Aacute = 722;
  44131. t.Adieresis = 722;
  44132. t.egrave = 444;
  44133. t.zacute = 444;
  44134. t.iogonek = 278;
  44135. t.Oacute = 778;
  44136. t.oacute = 500;
  44137. t.amacron = 500;
  44138. t.sacute = 389;
  44139. t.idieresis = 278;
  44140. t.Ocircumflex = 778;
  44141. t.Ugrave = 722;
  44142. t.Delta = 612;
  44143. t.thorn = 556;
  44144. t.twosuperior = 300;
  44145. t.Odieresis = 778;
  44146. t.mu = 556;
  44147. t.igrave = 278;
  44148. t.ohungarumlaut = 500;
  44149. t.Eogonek = 667;
  44150. t.dcroat = 556;
  44151. t.threequarters = 750;
  44152. t.Scedilla = 556;
  44153. t.lcaron = 394;
  44154. t.Kcommaaccent = 778;
  44155. t.Lacute = 667;
  44156. t.trademark = 1000;
  44157. t.edotaccent = 444;
  44158. t.Igrave = 389;
  44159. t.Imacron = 389;
  44160. t.Lcaron = 667;
  44161. t.onehalf = 750;
  44162. t.lessequal = 549;
  44163. t.ocircumflex = 500;
  44164. t.ntilde = 556;
  44165. t.Uhungarumlaut = 722;
  44166. t.Eacute = 667;
  44167. t.emacron = 444;
  44168. t.gbreve = 500;
  44169. t.onequarter = 750;
  44170. t.Scaron = 556;
  44171. t.Scommaaccent = 556;
  44172. t.Ohungarumlaut = 778;
  44173. t.degree = 400;
  44174. t.ograve = 500;
  44175. t.Ccaron = 722;
  44176. t.ugrave = 556;
  44177. t.radical = 549;
  44178. t.Dcaron = 722;
  44179. t.rcommaaccent = 444;
  44180. t.Ntilde = 722;
  44181. t.otilde = 500;
  44182. t.Rcommaaccent = 722;
  44183. t.Lcommaaccent = 667;
  44184. t.Atilde = 722;
  44185. t.Aogonek = 722;
  44186. t.Aring = 722;
  44187. t.Otilde = 778;
  44188. t.zdotaccent = 444;
  44189. t.Ecaron = 667;
  44190. t.Iogonek = 389;
  44191. t.kcommaaccent = 556;
  44192. t.minus = 570;
  44193. t.Icircumflex = 389;
  44194. t.ncaron = 556;
  44195. t.tcommaaccent = 333;
  44196. t.logicalnot = 570;
  44197. t.odieresis = 500;
  44198. t.udieresis = 556;
  44199. t.notequal = 549;
  44200. t.gcommaaccent = 500;
  44201. t.eth = 500;
  44202. t.zcaron = 444;
  44203. t.ncommaaccent = 556;
  44204. t.onesuperior = 300;
  44205. t.imacron = 278;
  44206. t.Euro = 500;
  44207. });
  44208. t["Times-BoldItalic"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  44209. t.space = 250;
  44210. t.exclam = 389;
  44211. t.quotedbl = 555;
  44212. t.numbersign = 500;
  44213. t.dollar = 500;
  44214. t.percent = 833;
  44215. t.ampersand = 778;
  44216. t.quoteright = 333;
  44217. t.parenleft = 333;
  44218. t.parenright = 333;
  44219. t.asterisk = 500;
  44220. t.plus = 570;
  44221. t.comma = 250;
  44222. t.hyphen = 333;
  44223. t.period = 250;
  44224. t.slash = 278;
  44225. t.zero = 500;
  44226. t.one = 500;
  44227. t.two = 500;
  44228. t.three = 500;
  44229. t.four = 500;
  44230. t.five = 500;
  44231. t.six = 500;
  44232. t.seven = 500;
  44233. t.eight = 500;
  44234. t.nine = 500;
  44235. t.colon = 333;
  44236. t.semicolon = 333;
  44237. t.less = 570;
  44238. t.equal = 570;
  44239. t.greater = 570;
  44240. t.question = 500;
  44241. t.at = 832;
  44242. t.A = 667;
  44243. t.B = 667;
  44244. t.C = 667;
  44245. t.D = 722;
  44246. t.E = 667;
  44247. t.F = 667;
  44248. t.G = 722;
  44249. t.H = 778;
  44250. t.I = 389;
  44251. t.J = 500;
  44252. t.K = 667;
  44253. t.L = 611;
  44254. t.M = 889;
  44255. t.N = 722;
  44256. t.O = 722;
  44257. t.P = 611;
  44258. t.Q = 722;
  44259. t.R = 667;
  44260. t.S = 556;
  44261. t.T = 611;
  44262. t.U = 722;
  44263. t.V = 667;
  44264. t.W = 889;
  44265. t.X = 667;
  44266. t.Y = 611;
  44267. t.Z = 611;
  44268. t.bracketleft = 333;
  44269. t.backslash = 278;
  44270. t.bracketright = 333;
  44271. t.asciicircum = 570;
  44272. t.underscore = 500;
  44273. t.quoteleft = 333;
  44274. t.a = 500;
  44275. t.b = 500;
  44276. t.c = 444;
  44277. t.d = 500;
  44278. t.e = 444;
  44279. t.f = 333;
  44280. t.g = 500;
  44281. t.h = 556;
  44282. t.i = 278;
  44283. t.j = 278;
  44284. t.k = 500;
  44285. t.l = 278;
  44286. t.m = 778;
  44287. t.n = 556;
  44288. t.o = 500;
  44289. t.p = 500;
  44290. t.q = 500;
  44291. t.r = 389;
  44292. t.s = 389;
  44293. t.t = 278;
  44294. t.u = 556;
  44295. t.v = 444;
  44296. t.w = 667;
  44297. t.x = 500;
  44298. t.y = 444;
  44299. t.z = 389;
  44300. t.braceleft = 348;
  44301. t.bar = 220;
  44302. t.braceright = 348;
  44303. t.asciitilde = 570;
  44304. t.exclamdown = 389;
  44305. t.cent = 500;
  44306. t.sterling = 500;
  44307. t.fraction = 167;
  44308. t.yen = 500;
  44309. t.florin = 500;
  44310. t.section = 500;
  44311. t.currency = 500;
  44312. t.quotesingle = 278;
  44313. t.quotedblleft = 500;
  44314. t.guillemotleft = 500;
  44315. t.guilsinglleft = 333;
  44316. t.guilsinglright = 333;
  44317. t.fi = 556;
  44318. t.fl = 556;
  44319. t.endash = 500;
  44320. t.dagger = 500;
  44321. t.daggerdbl = 500;
  44322. t.periodcentered = 250;
  44323. t.paragraph = 500;
  44324. t.bullet = 350;
  44325. t.quotesinglbase = 333;
  44326. t.quotedblbase = 500;
  44327. t.quotedblright = 500;
  44328. t.guillemotright = 500;
  44329. t.ellipsis = 1000;
  44330. t.perthousand = 1000;
  44331. t.questiondown = 500;
  44332. t.grave = 333;
  44333. t.acute = 333;
  44334. t.circumflex = 333;
  44335. t.tilde = 333;
  44336. t.macron = 333;
  44337. t.breve = 333;
  44338. t.dotaccent = 333;
  44339. t.dieresis = 333;
  44340. t.ring = 333;
  44341. t.cedilla = 333;
  44342. t.hungarumlaut = 333;
  44343. t.ogonek = 333;
  44344. t.caron = 333;
  44345. t.emdash = 1000;
  44346. t.AE = 944;
  44347. t.ordfeminine = 266;
  44348. t.Lslash = 611;
  44349. t.Oslash = 722;
  44350. t.OE = 944;
  44351. t.ordmasculine = 300;
  44352. t.ae = 722;
  44353. t.dotlessi = 278;
  44354. t.lslash = 278;
  44355. t.oslash = 500;
  44356. t.oe = 722;
  44357. t.germandbls = 500;
  44358. t.Idieresis = 389;
  44359. t.eacute = 444;
  44360. t.abreve = 500;
  44361. t.uhungarumlaut = 556;
  44362. t.ecaron = 444;
  44363. t.Ydieresis = 611;
  44364. t.divide = 570;
  44365. t.Yacute = 611;
  44366. t.Acircumflex = 667;
  44367. t.aacute = 500;
  44368. t.Ucircumflex = 722;
  44369. t.yacute = 444;
  44370. t.scommaaccent = 389;
  44371. t.ecircumflex = 444;
  44372. t.Uring = 722;
  44373. t.Udieresis = 722;
  44374. t.aogonek = 500;
  44375. t.Uacute = 722;
  44376. t.uogonek = 556;
  44377. t.Edieresis = 667;
  44378. t.Dcroat = 722;
  44379. t.commaaccent = 250;
  44380. t.copyright = 747;
  44381. t.Emacron = 667;
  44382. t.ccaron = 444;
  44383. t.aring = 500;
  44384. t.Ncommaaccent = 722;
  44385. t.lacute = 278;
  44386. t.agrave = 500;
  44387. t.Tcommaaccent = 611;
  44388. t.Cacute = 667;
  44389. t.atilde = 500;
  44390. t.Edotaccent = 667;
  44391. t.scaron = 389;
  44392. t.scedilla = 389;
  44393. t.iacute = 278;
  44394. t.lozenge = 494;
  44395. t.Rcaron = 667;
  44396. t.Gcommaaccent = 722;
  44397. t.ucircumflex = 556;
  44398. t.acircumflex = 500;
  44399. t.Amacron = 667;
  44400. t.rcaron = 389;
  44401. t.ccedilla = 444;
  44402. t.Zdotaccent = 611;
  44403. t.Thorn = 611;
  44404. t.Omacron = 722;
  44405. t.Racute = 667;
  44406. t.Sacute = 556;
  44407. t.dcaron = 608;
  44408. t.Umacron = 722;
  44409. t.uring = 556;
  44410. t.threesuperior = 300;
  44411. t.Ograve = 722;
  44412. t.Agrave = 667;
  44413. t.Abreve = 667;
  44414. t.multiply = 570;
  44415. t.uacute = 556;
  44416. t.Tcaron = 611;
  44417. t.partialdiff = 494;
  44418. t.ydieresis = 444;
  44419. t.Nacute = 722;
  44420. t.icircumflex = 278;
  44421. t.Ecircumflex = 667;
  44422. t.adieresis = 500;
  44423. t.edieresis = 444;
  44424. t.cacute = 444;
  44425. t.nacute = 556;
  44426. t.umacron = 556;
  44427. t.Ncaron = 722;
  44428. t.Iacute = 389;
  44429. t.plusminus = 570;
  44430. t.brokenbar = 220;
  44431. t.registered = 747;
  44432. t.Gbreve = 722;
  44433. t.Idotaccent = 389;
  44434. t.summation = 600;
  44435. t.Egrave = 667;
  44436. t.racute = 389;
  44437. t.omacron = 500;
  44438. t.Zacute = 611;
  44439. t.Zcaron = 611;
  44440. t.greaterequal = 549;
  44441. t.Eth = 722;
  44442. t.Ccedilla = 667;
  44443. t.lcommaaccent = 278;
  44444. t.tcaron = 366;
  44445. t.eogonek = 444;
  44446. t.Uogonek = 722;
  44447. t.Aacute = 667;
  44448. t.Adieresis = 667;
  44449. t.egrave = 444;
  44450. t.zacute = 389;
  44451. t.iogonek = 278;
  44452. t.Oacute = 722;
  44453. t.oacute = 500;
  44454. t.amacron = 500;
  44455. t.sacute = 389;
  44456. t.idieresis = 278;
  44457. t.Ocircumflex = 722;
  44458. t.Ugrave = 722;
  44459. t.Delta = 612;
  44460. t.thorn = 500;
  44461. t.twosuperior = 300;
  44462. t.Odieresis = 722;
  44463. t.mu = 576;
  44464. t.igrave = 278;
  44465. t.ohungarumlaut = 500;
  44466. t.Eogonek = 667;
  44467. t.dcroat = 500;
  44468. t.threequarters = 750;
  44469. t.Scedilla = 556;
  44470. t.lcaron = 382;
  44471. t.Kcommaaccent = 667;
  44472. t.Lacute = 611;
  44473. t.trademark = 1000;
  44474. t.edotaccent = 444;
  44475. t.Igrave = 389;
  44476. t.Imacron = 389;
  44477. t.Lcaron = 611;
  44478. t.onehalf = 750;
  44479. t.lessequal = 549;
  44480. t.ocircumflex = 500;
  44481. t.ntilde = 556;
  44482. t.Uhungarumlaut = 722;
  44483. t.Eacute = 667;
  44484. t.emacron = 444;
  44485. t.gbreve = 500;
  44486. t.onequarter = 750;
  44487. t.Scaron = 556;
  44488. t.Scommaaccent = 556;
  44489. t.Ohungarumlaut = 722;
  44490. t.degree = 400;
  44491. t.ograve = 500;
  44492. t.Ccaron = 667;
  44493. t.ugrave = 556;
  44494. t.radical = 549;
  44495. t.Dcaron = 722;
  44496. t.rcommaaccent = 389;
  44497. t.Ntilde = 722;
  44498. t.otilde = 500;
  44499. t.Rcommaaccent = 667;
  44500. t.Lcommaaccent = 611;
  44501. t.Atilde = 667;
  44502. t.Aogonek = 667;
  44503. t.Aring = 667;
  44504. t.Otilde = 722;
  44505. t.zdotaccent = 389;
  44506. t.Ecaron = 667;
  44507. t.Iogonek = 389;
  44508. t.kcommaaccent = 500;
  44509. t.minus = 606;
  44510. t.Icircumflex = 389;
  44511. t.ncaron = 556;
  44512. t.tcommaaccent = 278;
  44513. t.logicalnot = 606;
  44514. t.odieresis = 500;
  44515. t.udieresis = 556;
  44516. t.notequal = 549;
  44517. t.gcommaaccent = 500;
  44518. t.eth = 500;
  44519. t.zcaron = 389;
  44520. t.ncommaaccent = 556;
  44521. t.onesuperior = 300;
  44522. t.imacron = 278;
  44523. t.Euro = 500;
  44524. });
  44525. t["Times-Italic"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  44526. t.space = 250;
  44527. t.exclam = 333;
  44528. t.quotedbl = 420;
  44529. t.numbersign = 500;
  44530. t.dollar = 500;
  44531. t.percent = 833;
  44532. t.ampersand = 778;
  44533. t.quoteright = 333;
  44534. t.parenleft = 333;
  44535. t.parenright = 333;
  44536. t.asterisk = 500;
  44537. t.plus = 675;
  44538. t.comma = 250;
  44539. t.hyphen = 333;
  44540. t.period = 250;
  44541. t.slash = 278;
  44542. t.zero = 500;
  44543. t.one = 500;
  44544. t.two = 500;
  44545. t.three = 500;
  44546. t.four = 500;
  44547. t.five = 500;
  44548. t.six = 500;
  44549. t.seven = 500;
  44550. t.eight = 500;
  44551. t.nine = 500;
  44552. t.colon = 333;
  44553. t.semicolon = 333;
  44554. t.less = 675;
  44555. t.equal = 675;
  44556. t.greater = 675;
  44557. t.question = 500;
  44558. t.at = 920;
  44559. t.A = 611;
  44560. t.B = 611;
  44561. t.C = 667;
  44562. t.D = 722;
  44563. t.E = 611;
  44564. t.F = 611;
  44565. t.G = 722;
  44566. t.H = 722;
  44567. t.I = 333;
  44568. t.J = 444;
  44569. t.K = 667;
  44570. t.L = 556;
  44571. t.M = 833;
  44572. t.N = 667;
  44573. t.O = 722;
  44574. t.P = 611;
  44575. t.Q = 722;
  44576. t.R = 611;
  44577. t.S = 500;
  44578. t.T = 556;
  44579. t.U = 722;
  44580. t.V = 611;
  44581. t.W = 833;
  44582. t.X = 611;
  44583. t.Y = 556;
  44584. t.Z = 556;
  44585. t.bracketleft = 389;
  44586. t.backslash = 278;
  44587. t.bracketright = 389;
  44588. t.asciicircum = 422;
  44589. t.underscore = 500;
  44590. t.quoteleft = 333;
  44591. t.a = 500;
  44592. t.b = 500;
  44593. t.c = 444;
  44594. t.d = 500;
  44595. t.e = 444;
  44596. t.f = 278;
  44597. t.g = 500;
  44598. t.h = 500;
  44599. t.i = 278;
  44600. t.j = 278;
  44601. t.k = 444;
  44602. t.l = 278;
  44603. t.m = 722;
  44604. t.n = 500;
  44605. t.o = 500;
  44606. t.p = 500;
  44607. t.q = 500;
  44608. t.r = 389;
  44609. t.s = 389;
  44610. t.t = 278;
  44611. t.u = 500;
  44612. t.v = 444;
  44613. t.w = 667;
  44614. t.x = 444;
  44615. t.y = 444;
  44616. t.z = 389;
  44617. t.braceleft = 400;
  44618. t.bar = 275;
  44619. t.braceright = 400;
  44620. t.asciitilde = 541;
  44621. t.exclamdown = 389;
  44622. t.cent = 500;
  44623. t.sterling = 500;
  44624. t.fraction = 167;
  44625. t.yen = 500;
  44626. t.florin = 500;
  44627. t.section = 500;
  44628. t.currency = 500;
  44629. t.quotesingle = 214;
  44630. t.quotedblleft = 556;
  44631. t.guillemotleft = 500;
  44632. t.guilsinglleft = 333;
  44633. t.guilsinglright = 333;
  44634. t.fi = 500;
  44635. t.fl = 500;
  44636. t.endash = 500;
  44637. t.dagger = 500;
  44638. t.daggerdbl = 500;
  44639. t.periodcentered = 250;
  44640. t.paragraph = 523;
  44641. t.bullet = 350;
  44642. t.quotesinglbase = 333;
  44643. t.quotedblbase = 556;
  44644. t.quotedblright = 556;
  44645. t.guillemotright = 500;
  44646. t.ellipsis = 889;
  44647. t.perthousand = 1000;
  44648. t.questiondown = 500;
  44649. t.grave = 333;
  44650. t.acute = 333;
  44651. t.circumflex = 333;
  44652. t.tilde = 333;
  44653. t.macron = 333;
  44654. t.breve = 333;
  44655. t.dotaccent = 333;
  44656. t.dieresis = 333;
  44657. t.ring = 333;
  44658. t.cedilla = 333;
  44659. t.hungarumlaut = 333;
  44660. t.ogonek = 333;
  44661. t.caron = 333;
  44662. t.emdash = 889;
  44663. t.AE = 889;
  44664. t.ordfeminine = 276;
  44665. t.Lslash = 556;
  44666. t.Oslash = 722;
  44667. t.OE = 944;
  44668. t.ordmasculine = 310;
  44669. t.ae = 667;
  44670. t.dotlessi = 278;
  44671. t.lslash = 278;
  44672. t.oslash = 500;
  44673. t.oe = 667;
  44674. t.germandbls = 500;
  44675. t.Idieresis = 333;
  44676. t.eacute = 444;
  44677. t.abreve = 500;
  44678. t.uhungarumlaut = 500;
  44679. t.ecaron = 444;
  44680. t.Ydieresis = 556;
  44681. t.divide = 675;
  44682. t.Yacute = 556;
  44683. t.Acircumflex = 611;
  44684. t.aacute = 500;
  44685. t.Ucircumflex = 722;
  44686. t.yacute = 444;
  44687. t.scommaaccent = 389;
  44688. t.ecircumflex = 444;
  44689. t.Uring = 722;
  44690. t.Udieresis = 722;
  44691. t.aogonek = 500;
  44692. t.Uacute = 722;
  44693. t.uogonek = 500;
  44694. t.Edieresis = 611;
  44695. t.Dcroat = 722;
  44696. t.commaaccent = 250;
  44697. t.copyright = 760;
  44698. t.Emacron = 611;
  44699. t.ccaron = 444;
  44700. t.aring = 500;
  44701. t.Ncommaaccent = 667;
  44702. t.lacute = 278;
  44703. t.agrave = 500;
  44704. t.Tcommaaccent = 556;
  44705. t.Cacute = 667;
  44706. t.atilde = 500;
  44707. t.Edotaccent = 611;
  44708. t.scaron = 389;
  44709. t.scedilla = 389;
  44710. t.iacute = 278;
  44711. t.lozenge = 471;
  44712. t.Rcaron = 611;
  44713. t.Gcommaaccent = 722;
  44714. t.ucircumflex = 500;
  44715. t.acircumflex = 500;
  44716. t.Amacron = 611;
  44717. t.rcaron = 389;
  44718. t.ccedilla = 444;
  44719. t.Zdotaccent = 556;
  44720. t.Thorn = 611;
  44721. t.Omacron = 722;
  44722. t.Racute = 611;
  44723. t.Sacute = 500;
  44724. t.dcaron = 544;
  44725. t.Umacron = 722;
  44726. t.uring = 500;
  44727. t.threesuperior = 300;
  44728. t.Ograve = 722;
  44729. t.Agrave = 611;
  44730. t.Abreve = 611;
  44731. t.multiply = 675;
  44732. t.uacute = 500;
  44733. t.Tcaron = 556;
  44734. t.partialdiff = 476;
  44735. t.ydieresis = 444;
  44736. t.Nacute = 667;
  44737. t.icircumflex = 278;
  44738. t.Ecircumflex = 611;
  44739. t.adieresis = 500;
  44740. t.edieresis = 444;
  44741. t.cacute = 444;
  44742. t.nacute = 500;
  44743. t.umacron = 500;
  44744. t.Ncaron = 667;
  44745. t.Iacute = 333;
  44746. t.plusminus = 675;
  44747. t.brokenbar = 275;
  44748. t.registered = 760;
  44749. t.Gbreve = 722;
  44750. t.Idotaccent = 333;
  44751. t.summation = 600;
  44752. t.Egrave = 611;
  44753. t.racute = 389;
  44754. t.omacron = 500;
  44755. t.Zacute = 556;
  44756. t.Zcaron = 556;
  44757. t.greaterequal = 549;
  44758. t.Eth = 722;
  44759. t.Ccedilla = 667;
  44760. t.lcommaaccent = 278;
  44761. t.tcaron = 300;
  44762. t.eogonek = 444;
  44763. t.Uogonek = 722;
  44764. t.Aacute = 611;
  44765. t.Adieresis = 611;
  44766. t.egrave = 444;
  44767. t.zacute = 389;
  44768. t.iogonek = 278;
  44769. t.Oacute = 722;
  44770. t.oacute = 500;
  44771. t.amacron = 500;
  44772. t.sacute = 389;
  44773. t.idieresis = 278;
  44774. t.Ocircumflex = 722;
  44775. t.Ugrave = 722;
  44776. t.Delta = 612;
  44777. t.thorn = 500;
  44778. t.twosuperior = 300;
  44779. t.Odieresis = 722;
  44780. t.mu = 500;
  44781. t.igrave = 278;
  44782. t.ohungarumlaut = 500;
  44783. t.Eogonek = 611;
  44784. t.dcroat = 500;
  44785. t.threequarters = 750;
  44786. t.Scedilla = 500;
  44787. t.lcaron = 300;
  44788. t.Kcommaaccent = 667;
  44789. t.Lacute = 556;
  44790. t.trademark = 980;
  44791. t.edotaccent = 444;
  44792. t.Igrave = 333;
  44793. t.Imacron = 333;
  44794. t.Lcaron = 611;
  44795. t.onehalf = 750;
  44796. t.lessequal = 549;
  44797. t.ocircumflex = 500;
  44798. t.ntilde = 500;
  44799. t.Uhungarumlaut = 722;
  44800. t.Eacute = 611;
  44801. t.emacron = 444;
  44802. t.gbreve = 500;
  44803. t.onequarter = 750;
  44804. t.Scaron = 500;
  44805. t.Scommaaccent = 500;
  44806. t.Ohungarumlaut = 722;
  44807. t.degree = 400;
  44808. t.ograve = 500;
  44809. t.Ccaron = 667;
  44810. t.ugrave = 500;
  44811. t.radical = 453;
  44812. t.Dcaron = 722;
  44813. t.rcommaaccent = 389;
  44814. t.Ntilde = 667;
  44815. t.otilde = 500;
  44816. t.Rcommaaccent = 611;
  44817. t.Lcommaaccent = 556;
  44818. t.Atilde = 611;
  44819. t.Aogonek = 611;
  44820. t.Aring = 611;
  44821. t.Otilde = 722;
  44822. t.zdotaccent = 389;
  44823. t.Ecaron = 611;
  44824. t.Iogonek = 333;
  44825. t.kcommaaccent = 444;
  44826. t.minus = 675;
  44827. t.Icircumflex = 333;
  44828. t.ncaron = 500;
  44829. t.tcommaaccent = 278;
  44830. t.logicalnot = 675;
  44831. t.odieresis = 500;
  44832. t.udieresis = 500;
  44833. t.notequal = 549;
  44834. t.gcommaaccent = 500;
  44835. t.eth = 500;
  44836. t.zcaron = 389;
  44837. t.ncommaaccent = 500;
  44838. t.onesuperior = 300;
  44839. t.imacron = 278;
  44840. t.Euro = 500;
  44841. });
  44842. t.ZapfDingbats = (0, _core_utils.getLookupTableFactory)(function (t) {
  44843. t.space = 278;
  44844. t.a1 = 974;
  44845. t.a2 = 961;
  44846. t.a202 = 974;
  44847. t.a3 = 980;
  44848. t.a4 = 719;
  44849. t.a5 = 789;
  44850. t.a119 = 790;
  44851. t.a118 = 791;
  44852. t.a117 = 690;
  44853. t.a11 = 960;
  44854. t.a12 = 939;
  44855. t.a13 = 549;
  44856. t.a14 = 855;
  44857. t.a15 = 911;
  44858. t.a16 = 933;
  44859. t.a105 = 911;
  44860. t.a17 = 945;
  44861. t.a18 = 974;
  44862. t.a19 = 755;
  44863. t.a20 = 846;
  44864. t.a21 = 762;
  44865. t.a22 = 761;
  44866. t.a23 = 571;
  44867. t.a24 = 677;
  44868. t.a25 = 763;
  44869. t.a26 = 760;
  44870. t.a27 = 759;
  44871. t.a28 = 754;
  44872. t.a6 = 494;
  44873. t.a7 = 552;
  44874. t.a8 = 537;
  44875. t.a9 = 577;
  44876. t.a10 = 692;
  44877. t.a29 = 786;
  44878. t.a30 = 788;
  44879. t.a31 = 788;
  44880. t.a32 = 790;
  44881. t.a33 = 793;
  44882. t.a34 = 794;
  44883. t.a35 = 816;
  44884. t.a36 = 823;
  44885. t.a37 = 789;
  44886. t.a38 = 841;
  44887. t.a39 = 823;
  44888. t.a40 = 833;
  44889. t.a41 = 816;
  44890. t.a42 = 831;
  44891. t.a43 = 923;
  44892. t.a44 = 744;
  44893. t.a45 = 723;
  44894. t.a46 = 749;
  44895. t.a47 = 790;
  44896. t.a48 = 792;
  44897. t.a49 = 695;
  44898. t.a50 = 776;
  44899. t.a51 = 768;
  44900. t.a52 = 792;
  44901. t.a53 = 759;
  44902. t.a54 = 707;
  44903. t.a55 = 708;
  44904. t.a56 = 682;
  44905. t.a57 = 701;
  44906. t.a58 = 826;
  44907. t.a59 = 815;
  44908. t.a60 = 789;
  44909. t.a61 = 789;
  44910. t.a62 = 707;
  44911. t.a63 = 687;
  44912. t.a64 = 696;
  44913. t.a65 = 689;
  44914. t.a66 = 786;
  44915. t.a67 = 787;
  44916. t.a68 = 713;
  44917. t.a69 = 791;
  44918. t.a70 = 785;
  44919. t.a71 = 791;
  44920. t.a72 = 873;
  44921. t.a73 = 761;
  44922. t.a74 = 762;
  44923. t.a203 = 762;
  44924. t.a75 = 759;
  44925. t.a204 = 759;
  44926. t.a76 = 892;
  44927. t.a77 = 892;
  44928. t.a78 = 788;
  44929. t.a79 = 784;
  44930. t.a81 = 438;
  44931. t.a82 = 138;
  44932. t.a83 = 277;
  44933. t.a84 = 415;
  44934. t.a97 = 392;
  44935. t.a98 = 392;
  44936. t.a99 = 668;
  44937. t.a100 = 668;
  44938. t.a89 = 390;
  44939. t.a90 = 390;
  44940. t.a93 = 317;
  44941. t.a94 = 317;
  44942. t.a91 = 276;
  44943. t.a92 = 276;
  44944. t.a205 = 509;
  44945. t.a85 = 509;
  44946. t.a206 = 410;
  44947. t.a86 = 410;
  44948. t.a87 = 234;
  44949. t.a88 = 234;
  44950. t.a95 = 334;
  44951. t.a96 = 334;
  44952. t.a101 = 732;
  44953. t.a102 = 544;
  44954. t.a103 = 544;
  44955. t.a104 = 910;
  44956. t.a106 = 667;
  44957. t.a107 = 760;
  44958. t.a108 = 760;
  44959. t.a112 = 776;
  44960. t.a111 = 595;
  44961. t.a110 = 694;
  44962. t.a109 = 626;
  44963. t.a120 = 788;
  44964. t.a121 = 788;
  44965. t.a122 = 788;
  44966. t.a123 = 788;
  44967. t.a124 = 788;
  44968. t.a125 = 788;
  44969. t.a126 = 788;
  44970. t.a127 = 788;
  44971. t.a128 = 788;
  44972. t.a129 = 788;
  44973. t.a130 = 788;
  44974. t.a131 = 788;
  44975. t.a132 = 788;
  44976. t.a133 = 788;
  44977. t.a134 = 788;
  44978. t.a135 = 788;
  44979. t.a136 = 788;
  44980. t.a137 = 788;
  44981. t.a138 = 788;
  44982. t.a139 = 788;
  44983. t.a140 = 788;
  44984. t.a141 = 788;
  44985. t.a142 = 788;
  44986. t.a143 = 788;
  44987. t.a144 = 788;
  44988. t.a145 = 788;
  44989. t.a146 = 788;
  44990. t.a147 = 788;
  44991. t.a148 = 788;
  44992. t.a149 = 788;
  44993. t.a150 = 788;
  44994. t.a151 = 788;
  44995. t.a152 = 788;
  44996. t.a153 = 788;
  44997. t.a154 = 788;
  44998. t.a155 = 788;
  44999. t.a156 = 788;
  45000. t.a157 = 788;
  45001. t.a158 = 788;
  45002. t.a159 = 788;
  45003. t.a160 = 894;
  45004. t.a161 = 838;
  45005. t.a163 = 1016;
  45006. t.a164 = 458;
  45007. t.a196 = 748;
  45008. t.a165 = 924;
  45009. t.a192 = 748;
  45010. t.a166 = 918;
  45011. t.a167 = 927;
  45012. t.a168 = 928;
  45013. t.a169 = 928;
  45014. t.a170 = 834;
  45015. t.a171 = 873;
  45016. t.a172 = 828;
  45017. t.a173 = 924;
  45018. t.a162 = 924;
  45019. t.a174 = 917;
  45020. t.a175 = 930;
  45021. t.a176 = 931;
  45022. t.a177 = 463;
  45023. t.a178 = 883;
  45024. t.a179 = 836;
  45025. t.a193 = 836;
  45026. t.a180 = 867;
  45027. t.a199 = 867;
  45028. t.a181 = 696;
  45029. t.a200 = 696;
  45030. t.a182 = 874;
  45031. t.a201 = 874;
  45032. t.a183 = 760;
  45033. t.a184 = 946;
  45034. t.a197 = 771;
  45035. t.a185 = 865;
  45036. t.a194 = 771;
  45037. t.a198 = 888;
  45038. t.a186 = 967;
  45039. t.a195 = 888;
  45040. t.a187 = 831;
  45041. t.a188 = 873;
  45042. t.a189 = 927;
  45043. t.a190 = 970;
  45044. t.a191 = 918;
  45045. });
  45046. });
  45047. exports.getMetrics = getMetrics;
  45048. const getFontBasicMetrics = (0, _core_utils.getLookupTableFactory)(function (t) {
  45049. t.Courier = {
  45050. ascent: 629,
  45051. descent: -157,
  45052. capHeight: 562,
  45053. xHeight: -426
  45054. };
  45055. t["Courier-Bold"] = {
  45056. ascent: 629,
  45057. descent: -157,
  45058. capHeight: 562,
  45059. xHeight: 439
  45060. };
  45061. t["Courier-Oblique"] = {
  45062. ascent: 629,
  45063. descent: -157,
  45064. capHeight: 562,
  45065. xHeight: 426
  45066. };
  45067. t["Courier-BoldOblique"] = {
  45068. ascent: 629,
  45069. descent: -157,
  45070. capHeight: 562,
  45071. xHeight: 426
  45072. };
  45073. t.Helvetica = {
  45074. ascent: 718,
  45075. descent: -207,
  45076. capHeight: 718,
  45077. xHeight: 523
  45078. };
  45079. t["Helvetica-Bold"] = {
  45080. ascent: 718,
  45081. descent: -207,
  45082. capHeight: 718,
  45083. xHeight: 532
  45084. };
  45085. t["Helvetica-Oblique"] = {
  45086. ascent: 718,
  45087. descent: -207,
  45088. capHeight: 718,
  45089. xHeight: 523
  45090. };
  45091. t["Helvetica-BoldOblique"] = {
  45092. ascent: 718,
  45093. descent: -207,
  45094. capHeight: 718,
  45095. xHeight: 532
  45096. };
  45097. t["Times-Roman"] = {
  45098. ascent: 683,
  45099. descent: -217,
  45100. capHeight: 662,
  45101. xHeight: 450
  45102. };
  45103. t["Times-Bold"] = {
  45104. ascent: 683,
  45105. descent: -217,
  45106. capHeight: 676,
  45107. xHeight: 461
  45108. };
  45109. t["Times-Italic"] = {
  45110. ascent: 683,
  45111. descent: -217,
  45112. capHeight: 653,
  45113. xHeight: 441
  45114. };
  45115. t["Times-BoldItalic"] = {
  45116. ascent: 683,
  45117. descent: -217,
  45118. capHeight: 669,
  45119. xHeight: 462
  45120. };
  45121. t.Symbol = {
  45122. ascent: Math.NaN,
  45123. descent: Math.NaN,
  45124. capHeight: Math.NaN,
  45125. xHeight: Math.NaN
  45126. };
  45127. t.ZapfDingbats = {
  45128. ascent: Math.NaN,
  45129. descent: Math.NaN,
  45130. capHeight: Math.NaN,
  45131. xHeight: Math.NaN
  45132. };
  45133. });
  45134. exports.getFontBasicMetrics = getFontBasicMetrics;
  45135. /***/ }),
  45136. /* 175 */
  45137. /***/ ((__unused_webpack_module, exports) => {
  45138. "use strict";
  45139. Object.defineProperty(exports, "__esModule", ({
  45140. value: true
  45141. }));
  45142. exports.GlyfTable = void 0;
  45143. const ON_CURVE_POINT = 1 << 0;
  45144. const X_SHORT_VECTOR = 1 << 1;
  45145. const Y_SHORT_VECTOR = 1 << 2;
  45146. const REPEAT_FLAG = 1 << 3;
  45147. const X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR = 1 << 4;
  45148. const Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR = 1 << 5;
  45149. const OVERLAP_SIMPLE = 1 << 6;
  45150. const ARG_1_AND_2_ARE_WORDS = 1 << 0;
  45151. const ARGS_ARE_XY_VALUES = 1 << 1;
  45152. const WE_HAVE_A_SCALE = 1 << 3;
  45153. const MORE_COMPONENTS = 1 << 5;
  45154. const WE_HAVE_AN_X_AND_Y_SCALE = 1 << 6;
  45155. const WE_HAVE_A_TWO_BY_TWO = 1 << 7;
  45156. const WE_HAVE_INSTRUCTIONS = 1 << 8;
  45157. class GlyfTable {
  45158. constructor(_ref) {
  45159. let {
  45160. glyfTable,
  45161. isGlyphLocationsLong,
  45162. locaTable,
  45163. numGlyphs
  45164. } = _ref;
  45165. this.glyphs = [];
  45166. const loca = new DataView(locaTable.buffer, locaTable.byteOffset, locaTable.byteLength);
  45167. const glyf = new DataView(glyfTable.buffer, glyfTable.byteOffset, glyfTable.byteLength);
  45168. const offsetSize = isGlyphLocationsLong ? 4 : 2;
  45169. let prev = isGlyphLocationsLong ? loca.getUint32(0) : 2 * loca.getUint16(0);
  45170. let pos = 0;
  45171. for (let i = 0; i < numGlyphs; i++) {
  45172. pos += offsetSize;
  45173. const next = isGlyphLocationsLong ? loca.getUint32(pos) : 2 * loca.getUint16(pos);
  45174. if (next === prev) {
  45175. this.glyphs.push(new Glyph({}));
  45176. continue;
  45177. }
  45178. const glyph = Glyph.parse(prev, glyf);
  45179. this.glyphs.push(glyph);
  45180. prev = next;
  45181. }
  45182. }
  45183. getSize() {
  45184. return this.glyphs.reduce((a, g) => {
  45185. const size = g.getSize();
  45186. return a + (size + 3 & ~3);
  45187. }, 0);
  45188. }
  45189. write() {
  45190. const totalSize = this.getSize();
  45191. const glyfTable = new DataView(new ArrayBuffer(totalSize));
  45192. const isLocationLong = totalSize > 0x1fffe;
  45193. const offsetSize = isLocationLong ? 4 : 2;
  45194. const locaTable = new DataView(new ArrayBuffer((this.glyphs.length + 1) * offsetSize));
  45195. if (isLocationLong) {
  45196. locaTable.setUint32(0, 0);
  45197. } else {
  45198. locaTable.setUint16(0, 0);
  45199. }
  45200. let pos = 0;
  45201. let locaIndex = 0;
  45202. for (const glyph of this.glyphs) {
  45203. pos += glyph.write(pos, glyfTable);
  45204. pos = pos + 3 & ~3;
  45205. locaIndex += offsetSize;
  45206. if (isLocationLong) {
  45207. locaTable.setUint32(locaIndex, pos);
  45208. } else {
  45209. locaTable.setUint16(locaIndex, pos >> 1);
  45210. }
  45211. }
  45212. return {
  45213. isLocationLong,
  45214. loca: new Uint8Array(locaTable.buffer),
  45215. glyf: new Uint8Array(glyfTable.buffer)
  45216. };
  45217. }
  45218. scale(factors) {
  45219. for (let i = 0, ii = this.glyphs.length; i < ii; i++) {
  45220. this.glyphs[i].scale(factors[i]);
  45221. }
  45222. }
  45223. }
  45224. exports.GlyfTable = GlyfTable;
  45225. class Glyph {
  45226. constructor(_ref2) {
  45227. let {
  45228. header = null,
  45229. simple = null,
  45230. composites = null
  45231. } = _ref2;
  45232. this.header = header;
  45233. this.simple = simple;
  45234. this.composites = composites;
  45235. }
  45236. static parse(pos, glyf) {
  45237. const [read, header] = GlyphHeader.parse(pos, glyf);
  45238. pos += read;
  45239. if (header.numberOfContours < 0) {
  45240. const composites = [];
  45241. while (true) {
  45242. const [n, composite] = CompositeGlyph.parse(pos, glyf);
  45243. pos += n;
  45244. composites.push(composite);
  45245. if (!(composite.flags & MORE_COMPONENTS)) {
  45246. break;
  45247. }
  45248. }
  45249. return new Glyph({
  45250. header,
  45251. composites
  45252. });
  45253. }
  45254. const simple = SimpleGlyph.parse(pos, glyf, header.numberOfContours);
  45255. return new Glyph({
  45256. header,
  45257. simple
  45258. });
  45259. }
  45260. getSize() {
  45261. if (!this.header) {
  45262. return 0;
  45263. }
  45264. const size = this.simple ? this.simple.getSize() : this.composites.reduce((a, c) => a + c.getSize(), 0);
  45265. return this.header.getSize() + size;
  45266. }
  45267. write(pos, buf) {
  45268. if (!this.header) {
  45269. return 0;
  45270. }
  45271. const spos = pos;
  45272. pos += this.header.write(pos, buf);
  45273. if (this.simple) {
  45274. pos += this.simple.write(pos, buf);
  45275. } else {
  45276. for (const composite of this.composites) {
  45277. pos += composite.write(pos, buf);
  45278. }
  45279. }
  45280. return pos - spos;
  45281. }
  45282. scale(factor) {
  45283. if (!this.header) {
  45284. return;
  45285. }
  45286. const xMiddle = (this.header.xMin + this.header.xMax) / 2;
  45287. this.header.scale(xMiddle, factor);
  45288. if (this.simple) {
  45289. this.simple.scale(xMiddle, factor);
  45290. } else {
  45291. for (const composite of this.composites) {
  45292. composite.scale(xMiddle, factor);
  45293. }
  45294. }
  45295. }
  45296. }
  45297. class GlyphHeader {
  45298. constructor(_ref3) {
  45299. let {
  45300. numberOfContours,
  45301. xMin,
  45302. yMin,
  45303. xMax,
  45304. yMax
  45305. } = _ref3;
  45306. this.numberOfContours = numberOfContours;
  45307. this.xMin = xMin;
  45308. this.yMin = yMin;
  45309. this.xMax = xMax;
  45310. this.yMax = yMax;
  45311. }
  45312. static parse(pos, glyf) {
  45313. return [10, new GlyphHeader({
  45314. numberOfContours: glyf.getInt16(pos),
  45315. xMin: glyf.getInt16(pos + 2),
  45316. yMin: glyf.getInt16(pos + 4),
  45317. xMax: glyf.getInt16(pos + 6),
  45318. yMax: glyf.getInt16(pos + 8)
  45319. })];
  45320. }
  45321. getSize() {
  45322. return 10;
  45323. }
  45324. write(pos, buf) {
  45325. buf.setInt16(pos, this.numberOfContours);
  45326. buf.setInt16(pos + 2, this.xMin);
  45327. buf.setInt16(pos + 4, this.yMin);
  45328. buf.setInt16(pos + 6, this.xMax);
  45329. buf.setInt16(pos + 8, this.yMax);
  45330. return 10;
  45331. }
  45332. scale(x, factor) {
  45333. this.xMin = Math.round(x + (this.xMin - x) * factor);
  45334. this.xMax = Math.round(x + (this.xMax - x) * factor);
  45335. }
  45336. }
  45337. class Contour {
  45338. constructor(_ref4) {
  45339. let {
  45340. flags,
  45341. xCoordinates,
  45342. yCoordinates
  45343. } = _ref4;
  45344. this.xCoordinates = xCoordinates;
  45345. this.yCoordinates = yCoordinates;
  45346. this.flags = flags;
  45347. }
  45348. }
  45349. class SimpleGlyph {
  45350. constructor(_ref5) {
  45351. let {
  45352. contours,
  45353. instructions
  45354. } = _ref5;
  45355. this.contours = contours;
  45356. this.instructions = instructions;
  45357. }
  45358. static parse(pos, glyf, numberOfContours) {
  45359. const endPtsOfContours = [];
  45360. for (let i = 0; i < numberOfContours; i++) {
  45361. const endPt = glyf.getUint16(pos);
  45362. pos += 2;
  45363. endPtsOfContours.push(endPt);
  45364. }
  45365. const numberOfPt = endPtsOfContours[numberOfContours - 1] + 1;
  45366. const instructionLength = glyf.getUint16(pos);
  45367. pos += 2;
  45368. const instructions = new Uint8Array(glyf).slice(pos, pos + instructionLength);
  45369. pos += instructionLength;
  45370. const flags = [];
  45371. for (let i = 0; i < numberOfPt; pos++, i++) {
  45372. let flag = glyf.getUint8(pos);
  45373. flags.push(flag);
  45374. if (flag & REPEAT_FLAG) {
  45375. const count = glyf.getUint8(++pos);
  45376. flag ^= REPEAT_FLAG;
  45377. for (let m = 0; m < count; m++) {
  45378. flags.push(flag);
  45379. }
  45380. i += count;
  45381. }
  45382. }
  45383. const allXCoordinates = [];
  45384. let xCoordinates = [];
  45385. let yCoordinates = [];
  45386. let pointFlags = [];
  45387. const contours = [];
  45388. let endPtsOfContoursIndex = 0;
  45389. let lastCoordinate = 0;
  45390. for (let i = 0; i < numberOfPt; i++) {
  45391. const flag = flags[i];
  45392. if (flag & X_SHORT_VECTOR) {
  45393. const x = glyf.getUint8(pos++);
  45394. lastCoordinate += flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR ? x : -x;
  45395. xCoordinates.push(lastCoordinate);
  45396. } else if (flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR) {
  45397. xCoordinates.push(lastCoordinate);
  45398. } else {
  45399. lastCoordinate += glyf.getInt16(pos);
  45400. pos += 2;
  45401. xCoordinates.push(lastCoordinate);
  45402. }
  45403. if (endPtsOfContours[endPtsOfContoursIndex] === i) {
  45404. endPtsOfContoursIndex++;
  45405. allXCoordinates.push(xCoordinates);
  45406. xCoordinates = [];
  45407. }
  45408. }
  45409. lastCoordinate = 0;
  45410. endPtsOfContoursIndex = 0;
  45411. for (let i = 0; i < numberOfPt; i++) {
  45412. const flag = flags[i];
  45413. if (flag & Y_SHORT_VECTOR) {
  45414. const y = glyf.getUint8(pos++);
  45415. lastCoordinate += flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR ? y : -y;
  45416. yCoordinates.push(lastCoordinate);
  45417. } else if (flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR) {
  45418. yCoordinates.push(lastCoordinate);
  45419. } else {
  45420. lastCoordinate += glyf.getInt16(pos);
  45421. pos += 2;
  45422. yCoordinates.push(lastCoordinate);
  45423. }
  45424. pointFlags.push(flag & ON_CURVE_POINT | flag & OVERLAP_SIMPLE);
  45425. if (endPtsOfContours[endPtsOfContoursIndex] === i) {
  45426. xCoordinates = allXCoordinates[endPtsOfContoursIndex];
  45427. endPtsOfContoursIndex++;
  45428. contours.push(new Contour({
  45429. flags: pointFlags,
  45430. xCoordinates,
  45431. yCoordinates
  45432. }));
  45433. yCoordinates = [];
  45434. pointFlags = [];
  45435. }
  45436. }
  45437. return new SimpleGlyph({
  45438. contours,
  45439. instructions
  45440. });
  45441. }
  45442. getSize() {
  45443. let size = this.contours.length * 2 + 2 + this.instructions.length;
  45444. let lastX = 0;
  45445. let lastY = 0;
  45446. for (const contour of this.contours) {
  45447. size += contour.flags.length;
  45448. for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) {
  45449. const x = contour.xCoordinates[i];
  45450. const y = contour.yCoordinates[i];
  45451. let abs = Math.abs(x - lastX);
  45452. if (abs > 255) {
  45453. size += 2;
  45454. } else if (abs > 0) {
  45455. size += 1;
  45456. }
  45457. lastX = x;
  45458. abs = Math.abs(y - lastY);
  45459. if (abs > 255) {
  45460. size += 2;
  45461. } else if (abs > 0) {
  45462. size += 1;
  45463. }
  45464. lastY = y;
  45465. }
  45466. }
  45467. return size;
  45468. }
  45469. write(pos, buf) {
  45470. const spos = pos;
  45471. const xCoordinates = [];
  45472. const yCoordinates = [];
  45473. const flags = [];
  45474. let lastX = 0;
  45475. let lastY = 0;
  45476. for (const contour of this.contours) {
  45477. for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) {
  45478. let flag = contour.flags[i];
  45479. const x = contour.xCoordinates[i];
  45480. let delta = x - lastX;
  45481. if (delta === 0) {
  45482. flag |= X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR;
  45483. xCoordinates.push(0);
  45484. } else {
  45485. const abs = Math.abs(delta);
  45486. if (abs <= 255) {
  45487. flag |= delta >= 0 ? X_SHORT_VECTOR | X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR : X_SHORT_VECTOR;
  45488. xCoordinates.push(abs);
  45489. } else {
  45490. xCoordinates.push(delta);
  45491. }
  45492. }
  45493. lastX = x;
  45494. const y = contour.yCoordinates[i];
  45495. delta = y - lastY;
  45496. if (delta === 0) {
  45497. flag |= Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR;
  45498. yCoordinates.push(0);
  45499. } else {
  45500. const abs = Math.abs(delta);
  45501. if (abs <= 255) {
  45502. flag |= delta >= 0 ? Y_SHORT_VECTOR | Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR : Y_SHORT_VECTOR;
  45503. yCoordinates.push(abs);
  45504. } else {
  45505. yCoordinates.push(delta);
  45506. }
  45507. }
  45508. lastY = y;
  45509. flags.push(flag);
  45510. }
  45511. buf.setUint16(pos, xCoordinates.length - 1);
  45512. pos += 2;
  45513. }
  45514. buf.setUint16(pos, this.instructions.length);
  45515. pos += 2;
  45516. if (this.instructions.length) {
  45517. new Uint8Array(buf.buffer, 0, buf.buffer.byteLength).set(this.instructions, pos);
  45518. pos += this.instructions.length;
  45519. }
  45520. for (const flag of flags) {
  45521. buf.setUint8(pos++, flag);
  45522. }
  45523. for (let i = 0, ii = xCoordinates.length; i < ii; i++) {
  45524. const x = xCoordinates[i];
  45525. const flag = flags[i];
  45526. if (flag & X_SHORT_VECTOR) {
  45527. buf.setUint8(pos++, x);
  45528. } else if (!(flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR)) {
  45529. buf.setInt16(pos, x);
  45530. pos += 2;
  45531. }
  45532. }
  45533. for (let i = 0, ii = yCoordinates.length; i < ii; i++) {
  45534. const y = yCoordinates[i];
  45535. const flag = flags[i];
  45536. if (flag & Y_SHORT_VECTOR) {
  45537. buf.setUint8(pos++, y);
  45538. } else if (!(flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR)) {
  45539. buf.setInt16(pos, y);
  45540. pos += 2;
  45541. }
  45542. }
  45543. return pos - spos;
  45544. }
  45545. scale(x, factor) {
  45546. for (const contour of this.contours) {
  45547. if (contour.xCoordinates.length === 0) {
  45548. continue;
  45549. }
  45550. for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) {
  45551. contour.xCoordinates[i] = Math.round(x + (contour.xCoordinates[i] - x) * factor);
  45552. }
  45553. }
  45554. }
  45555. }
  45556. class CompositeGlyph {
  45557. constructor(_ref6) {
  45558. let {
  45559. flags,
  45560. glyphIndex,
  45561. argument1,
  45562. argument2,
  45563. transf,
  45564. instructions
  45565. } = _ref6;
  45566. this.flags = flags;
  45567. this.glyphIndex = glyphIndex;
  45568. this.argument1 = argument1;
  45569. this.argument2 = argument2;
  45570. this.transf = transf;
  45571. this.instructions = instructions;
  45572. }
  45573. static parse(pos, glyf) {
  45574. const spos = pos;
  45575. const transf = [];
  45576. let flags = glyf.getUint16(pos);
  45577. const glyphIndex = glyf.getUint16(pos + 2);
  45578. pos += 4;
  45579. let argument1, argument2;
  45580. if (flags & ARG_1_AND_2_ARE_WORDS) {
  45581. if (flags & ARGS_ARE_XY_VALUES) {
  45582. argument1 = glyf.getInt16(pos);
  45583. argument2 = glyf.getInt16(pos + 2);
  45584. } else {
  45585. argument1 = glyf.getUint16(pos);
  45586. argument2 = glyf.getUint16(pos + 2);
  45587. }
  45588. pos += 4;
  45589. flags ^= ARG_1_AND_2_ARE_WORDS;
  45590. } else {
  45591. if (flags & ARGS_ARE_XY_VALUES) {
  45592. argument1 = glyf.getInt8(pos);
  45593. argument2 = glyf.getInt8(pos + 1);
  45594. } else {
  45595. argument1 = glyf.getUint8(pos);
  45596. argument2 = glyf.getUint8(pos + 1);
  45597. }
  45598. pos += 2;
  45599. }
  45600. if (flags & WE_HAVE_A_SCALE) {
  45601. transf.push(glyf.getUint16(pos));
  45602. pos += 2;
  45603. } else if (flags & WE_HAVE_AN_X_AND_Y_SCALE) {
  45604. transf.push(glyf.getUint16(pos), glyf.getUint16(pos + 2));
  45605. pos += 4;
  45606. } else if (flags & WE_HAVE_A_TWO_BY_TWO) {
  45607. transf.push(glyf.getUint16(pos), glyf.getUint16(pos + 2), glyf.getUint16(pos + 4), glyf.getUint16(pos + 6));
  45608. pos += 8;
  45609. }
  45610. let instructions = null;
  45611. if (flags & WE_HAVE_INSTRUCTIONS) {
  45612. const instructionLength = glyf.getUint16(pos);
  45613. pos += 2;
  45614. instructions = new Uint8Array(glyf).slice(pos, pos + instructionLength);
  45615. pos += instructionLength;
  45616. }
  45617. return [pos - spos, new CompositeGlyph({
  45618. flags,
  45619. glyphIndex,
  45620. argument1,
  45621. argument2,
  45622. transf,
  45623. instructions
  45624. })];
  45625. }
  45626. getSize() {
  45627. let size = 2 + 2 + this.transf.length * 2;
  45628. if (this.flags & WE_HAVE_INSTRUCTIONS) {
  45629. size += 2 + this.instructions.length;
  45630. }
  45631. size += 2;
  45632. if (this.flags & 2) {
  45633. if (!(this.argument1 >= -128 && this.argument1 <= 127 && this.argument2 >= -128 && this.argument2 <= 127)) {
  45634. size += 2;
  45635. }
  45636. } else {
  45637. if (!(this.argument1 >= 0 && this.argument1 <= 255 && this.argument2 >= 0 && this.argument2 <= 255)) {
  45638. size += 2;
  45639. }
  45640. }
  45641. return size;
  45642. }
  45643. write(pos, buf) {
  45644. const spos = pos;
  45645. if (this.flags & ARGS_ARE_XY_VALUES) {
  45646. if (!(this.argument1 >= -128 && this.argument1 <= 127 && this.argument2 >= -128 && this.argument2 <= 127)) {
  45647. this.flags |= ARG_1_AND_2_ARE_WORDS;
  45648. }
  45649. } else {
  45650. if (!(this.argument1 >= 0 && this.argument1 <= 255 && this.argument2 >= 0 && this.argument2 <= 255)) {
  45651. this.flags |= ARG_1_AND_2_ARE_WORDS;
  45652. }
  45653. }
  45654. buf.setUint16(pos, this.flags);
  45655. buf.setUint16(pos + 2, this.glyphIndex);
  45656. pos += 4;
  45657. if (this.flags & ARG_1_AND_2_ARE_WORDS) {
  45658. if (this.flags & ARGS_ARE_XY_VALUES) {
  45659. buf.setInt16(pos, this.argument1);
  45660. buf.setInt16(pos + 2, this.argument2);
  45661. } else {
  45662. buf.setUint16(pos, this.argument1);
  45663. buf.setUint16(pos + 2, this.argument2);
  45664. }
  45665. pos += 4;
  45666. } else {
  45667. buf.setUint8(pos, this.argument1);
  45668. buf.setUint8(pos + 1, this.argument2);
  45669. pos += 2;
  45670. }
  45671. if (this.flags & WE_HAVE_INSTRUCTIONS) {
  45672. buf.setUint16(pos, this.instructions.length);
  45673. pos += 2;
  45674. if (this.instructions.length) {
  45675. new Uint8Array(buf.buffer, 0, buf.buffer.byteLength).set(this.instructions, pos);
  45676. pos += this.instructions.length;
  45677. }
  45678. }
  45679. return pos - spos;
  45680. }
  45681. scale(x, factor) {}
  45682. }
  45683. /***/ }),
  45684. /* 176 */
  45685. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  45686. "use strict";
  45687. Object.defineProperty(exports, "__esModule", ({
  45688. value: true
  45689. }));
  45690. exports.OpenTypeFileBuilder = void 0;
  45691. var _core_utils = __w_pdfjs_require__(135);
  45692. var _util = __w_pdfjs_require__(2);
  45693. function writeInt16(dest, offset, num) {
  45694. dest[offset] = num >> 8 & 0xff;
  45695. dest[offset + 1] = num & 0xff;
  45696. }
  45697. function writeInt32(dest, offset, num) {
  45698. dest[offset] = num >> 24 & 0xff;
  45699. dest[offset + 1] = num >> 16 & 0xff;
  45700. dest[offset + 2] = num >> 8 & 0xff;
  45701. dest[offset + 3] = num & 0xff;
  45702. }
  45703. function writeData(dest, offset, data) {
  45704. if (data instanceof Uint8Array) {
  45705. dest.set(data, offset);
  45706. } else if (typeof data === "string") {
  45707. for (let i = 0, ii = data.length; i < ii; i++) {
  45708. dest[offset++] = data.charCodeAt(i) & 0xff;
  45709. }
  45710. } else {
  45711. for (const num of data) {
  45712. dest[offset++] = num & 0xff;
  45713. }
  45714. }
  45715. }
  45716. const OTF_HEADER_SIZE = 12;
  45717. const OTF_TABLE_ENTRY_SIZE = 16;
  45718. class OpenTypeFileBuilder {
  45719. constructor(sfnt) {
  45720. this.sfnt = sfnt;
  45721. this.tables = Object.create(null);
  45722. }
  45723. static getSearchParams(entriesCount, entrySize) {
  45724. let maxPower2 = 1,
  45725. log2 = 0;
  45726. while ((maxPower2 ^ entriesCount) > maxPower2) {
  45727. maxPower2 <<= 1;
  45728. log2++;
  45729. }
  45730. const searchRange = maxPower2 * entrySize;
  45731. return {
  45732. range: searchRange,
  45733. entry: log2,
  45734. rangeShift: entrySize * entriesCount - searchRange
  45735. };
  45736. }
  45737. toArray() {
  45738. let sfnt = this.sfnt;
  45739. const tables = this.tables;
  45740. const tablesNames = Object.keys(tables);
  45741. tablesNames.sort();
  45742. const numTables = tablesNames.length;
  45743. let i, j, jj, table, tableName;
  45744. let offset = OTF_HEADER_SIZE + numTables * OTF_TABLE_ENTRY_SIZE;
  45745. const tableOffsets = [offset];
  45746. for (i = 0; i < numTables; i++) {
  45747. table = tables[tablesNames[i]];
  45748. const paddedLength = (table.length + 3 & ~3) >>> 0;
  45749. offset += paddedLength;
  45750. tableOffsets.push(offset);
  45751. }
  45752. const file = new Uint8Array(offset);
  45753. for (i = 0; i < numTables; i++) {
  45754. table = tables[tablesNames[i]];
  45755. writeData(file, tableOffsets[i], table);
  45756. }
  45757. if (sfnt === "true") {
  45758. sfnt = (0, _util.string32)(0x00010000);
  45759. }
  45760. file[0] = sfnt.charCodeAt(0) & 0xff;
  45761. file[1] = sfnt.charCodeAt(1) & 0xff;
  45762. file[2] = sfnt.charCodeAt(2) & 0xff;
  45763. file[3] = sfnt.charCodeAt(3) & 0xff;
  45764. writeInt16(file, 4, numTables);
  45765. const searchParams = OpenTypeFileBuilder.getSearchParams(numTables, 16);
  45766. writeInt16(file, 6, searchParams.range);
  45767. writeInt16(file, 8, searchParams.entry);
  45768. writeInt16(file, 10, searchParams.rangeShift);
  45769. offset = OTF_HEADER_SIZE;
  45770. for (i = 0; i < numTables; i++) {
  45771. tableName = tablesNames[i];
  45772. file[offset] = tableName.charCodeAt(0) & 0xff;
  45773. file[offset + 1] = tableName.charCodeAt(1) & 0xff;
  45774. file[offset + 2] = tableName.charCodeAt(2) & 0xff;
  45775. file[offset + 3] = tableName.charCodeAt(3) & 0xff;
  45776. let checksum = 0;
  45777. for (j = tableOffsets[i], jj = tableOffsets[i + 1]; j < jj; j += 4) {
  45778. const quad = (0, _core_utils.readUint32)(file, j);
  45779. checksum = checksum + quad >>> 0;
  45780. }
  45781. writeInt32(file, offset + 4, checksum);
  45782. writeInt32(file, offset + 8, tableOffsets[i]);
  45783. writeInt32(file, offset + 12, tables[tableName].length);
  45784. offset += OTF_TABLE_ENTRY_SIZE;
  45785. }
  45786. return file;
  45787. }
  45788. addTable(tag, data) {
  45789. if (tag in this.tables) {
  45790. throw new Error("Table " + tag + " already exists");
  45791. }
  45792. this.tables[tag] = data;
  45793. }
  45794. }
  45795. exports.OpenTypeFileBuilder = OpenTypeFileBuilder;
  45796. /***/ }),
  45797. /* 177 */
  45798. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  45799. "use strict";
  45800. Object.defineProperty(exports, "__esModule", ({
  45801. value: true
  45802. }));
  45803. exports.Type1Font = void 0;
  45804. var _cff_parser = __w_pdfjs_require__(164);
  45805. var _util = __w_pdfjs_require__(2);
  45806. var _fonts_utils = __w_pdfjs_require__(167);
  45807. var _core_utils = __w_pdfjs_require__(135);
  45808. var _stream = __w_pdfjs_require__(139);
  45809. var _type1_parser = __w_pdfjs_require__(178);
  45810. function findBlock(streamBytes, signature, startIndex) {
  45811. const streamBytesLength = streamBytes.length;
  45812. const signatureLength = signature.length;
  45813. const scanLength = streamBytesLength - signatureLength;
  45814. let i = startIndex,
  45815. found = false;
  45816. while (i < scanLength) {
  45817. let j = 0;
  45818. while (j < signatureLength && streamBytes[i + j] === signature[j]) {
  45819. j++;
  45820. }
  45821. if (j >= signatureLength) {
  45822. i += j;
  45823. while (i < streamBytesLength && (0, _core_utils.isWhiteSpace)(streamBytes[i])) {
  45824. i++;
  45825. }
  45826. found = true;
  45827. break;
  45828. }
  45829. i++;
  45830. }
  45831. return {
  45832. found,
  45833. length: i
  45834. };
  45835. }
  45836. function getHeaderBlock(stream, suggestedLength) {
  45837. const EEXEC_SIGNATURE = [0x65, 0x65, 0x78, 0x65, 0x63];
  45838. const streamStartPos = stream.pos;
  45839. let headerBytes, headerBytesLength, block;
  45840. try {
  45841. headerBytes = stream.getBytes(suggestedLength);
  45842. headerBytesLength = headerBytes.length;
  45843. } catch (ex) {}
  45844. if (headerBytesLength === suggestedLength) {
  45845. block = findBlock(headerBytes, EEXEC_SIGNATURE, suggestedLength - 2 * EEXEC_SIGNATURE.length);
  45846. if (block.found && block.length === suggestedLength) {
  45847. return {
  45848. stream: new _stream.Stream(headerBytes),
  45849. length: suggestedLength
  45850. };
  45851. }
  45852. }
  45853. (0, _util.warn)('Invalid "Length1" property in Type1 font -- trying to recover.');
  45854. stream.pos = streamStartPos;
  45855. const SCAN_BLOCK_LENGTH = 2048;
  45856. let actualLength;
  45857. while (true) {
  45858. const scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH);
  45859. block = findBlock(scanBytes, EEXEC_SIGNATURE, 0);
  45860. if (block.length === 0) {
  45861. break;
  45862. }
  45863. stream.pos += block.length;
  45864. if (block.found) {
  45865. actualLength = stream.pos - streamStartPos;
  45866. break;
  45867. }
  45868. }
  45869. stream.pos = streamStartPos;
  45870. if (actualLength) {
  45871. return {
  45872. stream: new _stream.Stream(stream.getBytes(actualLength)),
  45873. length: actualLength
  45874. };
  45875. }
  45876. (0, _util.warn)('Unable to recover "Length1" property in Type1 font -- using as is.');
  45877. return {
  45878. stream: new _stream.Stream(stream.getBytes(suggestedLength)),
  45879. length: suggestedLength
  45880. };
  45881. }
  45882. function getEexecBlock(stream, suggestedLength) {
  45883. const eexecBytes = stream.getBytes();
  45884. if (eexecBytes.length === 0) {
  45885. throw new _util.FormatError("getEexecBlock - no font program found.");
  45886. }
  45887. return {
  45888. stream: new _stream.Stream(eexecBytes),
  45889. length: eexecBytes.length
  45890. };
  45891. }
  45892. class Type1Font {
  45893. constructor(name, file, properties) {
  45894. const PFB_HEADER_SIZE = 6;
  45895. let headerBlockLength = properties.length1;
  45896. let eexecBlockLength = properties.length2;
  45897. let pfbHeader = file.peekBytes(PFB_HEADER_SIZE);
  45898. const pfbHeaderPresent = pfbHeader[0] === 0x80 && pfbHeader[1] === 0x01;
  45899. if (pfbHeaderPresent) {
  45900. file.skip(PFB_HEADER_SIZE);
  45901. headerBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
  45902. }
  45903. const headerBlock = getHeaderBlock(file, headerBlockLength);
  45904. const headerBlockParser = new _type1_parser.Type1Parser(headerBlock.stream, false, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  45905. headerBlockParser.extractFontHeader(properties);
  45906. if (pfbHeaderPresent) {
  45907. pfbHeader = file.getBytes(PFB_HEADER_SIZE);
  45908. eexecBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
  45909. }
  45910. const eexecBlock = getEexecBlock(file, eexecBlockLength);
  45911. const eexecBlockParser = new _type1_parser.Type1Parser(eexecBlock.stream, true, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  45912. const data = eexecBlockParser.extractFontProgram(properties);
  45913. for (const key in data.properties) {
  45914. properties[key] = data.properties[key];
  45915. }
  45916. const charstrings = data.charstrings;
  45917. const type2Charstrings = this.getType2Charstrings(charstrings);
  45918. const subrs = this.getType2Subrs(data.subrs);
  45919. this.charstrings = charstrings;
  45920. this.data = this.wrap(name, type2Charstrings, this.charstrings, subrs, properties);
  45921. this.seacs = this.getSeacs(data.charstrings);
  45922. }
  45923. get numGlyphs() {
  45924. return this.charstrings.length + 1;
  45925. }
  45926. getCharset() {
  45927. const charset = [".notdef"];
  45928. for (const {
  45929. glyphName
  45930. } of this.charstrings) {
  45931. charset.push(glyphName);
  45932. }
  45933. return charset;
  45934. }
  45935. getGlyphMapping(properties) {
  45936. const charstrings = this.charstrings;
  45937. if (properties.composite) {
  45938. const charCodeToGlyphId = Object.create(null);
  45939. for (let glyphId = 0, charstringsLen = charstrings.length; glyphId < charstringsLen; glyphId++) {
  45940. const charCode = properties.cMap.charCodeOf(glyphId);
  45941. charCodeToGlyphId[charCode] = glyphId + 1;
  45942. }
  45943. return charCodeToGlyphId;
  45944. }
  45945. const glyphNames = [".notdef"];
  45946. let builtInEncoding, glyphId;
  45947. for (glyphId = 0; glyphId < charstrings.length; glyphId++) {
  45948. glyphNames.push(charstrings[glyphId].glyphName);
  45949. }
  45950. const encoding = properties.builtInEncoding;
  45951. if (encoding) {
  45952. builtInEncoding = Object.create(null);
  45953. for (const charCode in encoding) {
  45954. glyphId = glyphNames.indexOf(encoding[charCode]);
  45955. if (glyphId >= 0) {
  45956. builtInEncoding[charCode] = glyphId;
  45957. }
  45958. }
  45959. }
  45960. return (0, _fonts_utils.type1FontGlyphMapping)(properties, builtInEncoding, glyphNames);
  45961. }
  45962. hasGlyphId(id) {
  45963. if (id < 0 || id >= this.numGlyphs) {
  45964. return false;
  45965. }
  45966. if (id === 0) {
  45967. return true;
  45968. }
  45969. const glyph = this.charstrings[id - 1];
  45970. return glyph.charstring.length > 0;
  45971. }
  45972. getSeacs(charstrings) {
  45973. const seacMap = [];
  45974. for (let i = 0, ii = charstrings.length; i < ii; i++) {
  45975. const charstring = charstrings[i];
  45976. if (charstring.seac) {
  45977. seacMap[i + 1] = charstring.seac;
  45978. }
  45979. }
  45980. return seacMap;
  45981. }
  45982. getType2Charstrings(type1Charstrings) {
  45983. const type2Charstrings = [];
  45984. for (const type1Charstring of type1Charstrings) {
  45985. type2Charstrings.push(type1Charstring.charstring);
  45986. }
  45987. return type2Charstrings;
  45988. }
  45989. getType2Subrs(type1Subrs) {
  45990. let bias = 0;
  45991. const count = type1Subrs.length;
  45992. if (count < 1133) {
  45993. bias = 107;
  45994. } else if (count < 33769) {
  45995. bias = 1131;
  45996. } else {
  45997. bias = 32768;
  45998. }
  45999. const type2Subrs = [];
  46000. let i;
  46001. for (i = 0; i < bias; i++) {
  46002. type2Subrs.push([0x0b]);
  46003. }
  46004. for (i = 0; i < count; i++) {
  46005. type2Subrs.push(type1Subrs[i]);
  46006. }
  46007. return type2Subrs;
  46008. }
  46009. wrap(name, glyphs, charstrings, subrs, properties) {
  46010. const cff = new _cff_parser.CFF();
  46011. cff.header = new _cff_parser.CFFHeader(1, 0, 4, 4);
  46012. cff.names = [name];
  46013. const topDict = new _cff_parser.CFFTopDict();
  46014. topDict.setByName("version", 391);
  46015. topDict.setByName("Notice", 392);
  46016. topDict.setByName("FullName", 393);
  46017. topDict.setByName("FamilyName", 394);
  46018. topDict.setByName("Weight", 395);
  46019. topDict.setByName("Encoding", null);
  46020. topDict.setByName("FontMatrix", properties.fontMatrix);
  46021. topDict.setByName("FontBBox", properties.bbox);
  46022. topDict.setByName("charset", null);
  46023. topDict.setByName("CharStrings", null);
  46024. topDict.setByName("Private", null);
  46025. cff.topDict = topDict;
  46026. const strings = new _cff_parser.CFFStrings();
  46027. strings.add("Version 0.11");
  46028. strings.add("See original notice");
  46029. strings.add(name);
  46030. strings.add(name);
  46031. strings.add("Medium");
  46032. cff.strings = strings;
  46033. cff.globalSubrIndex = new _cff_parser.CFFIndex();
  46034. const count = glyphs.length;
  46035. const charsetArray = [".notdef"];
  46036. let i, ii;
  46037. for (i = 0; i < count; i++) {
  46038. const glyphName = charstrings[i].glyphName;
  46039. const index = _cff_parser.CFFStandardStrings.indexOf(glyphName);
  46040. if (index === -1) {
  46041. strings.add(glyphName);
  46042. }
  46043. charsetArray.push(glyphName);
  46044. }
  46045. cff.charset = new _cff_parser.CFFCharset(false, 0, charsetArray);
  46046. const charStringsIndex = new _cff_parser.CFFIndex();
  46047. charStringsIndex.add([0x8b, 0x0e]);
  46048. for (i = 0; i < count; i++) {
  46049. charStringsIndex.add(glyphs[i]);
  46050. }
  46051. cff.charStrings = charStringsIndex;
  46052. const privateDict = new _cff_parser.CFFPrivateDict();
  46053. privateDict.setByName("Subrs", null);
  46054. const fields = ["BlueValues", "OtherBlues", "FamilyBlues", "FamilyOtherBlues", "StemSnapH", "StemSnapV", "BlueShift", "BlueFuzz", "BlueScale", "LanguageGroup", "ExpansionFactor", "ForceBold", "StdHW", "StdVW"];
  46055. for (i = 0, ii = fields.length; i < ii; i++) {
  46056. const field = fields[i];
  46057. if (!(field in properties.privateData)) {
  46058. continue;
  46059. }
  46060. const value = properties.privateData[field];
  46061. if (Array.isArray(value)) {
  46062. for (let j = value.length - 1; j > 0; j--) {
  46063. value[j] -= value[j - 1];
  46064. }
  46065. }
  46066. privateDict.setByName(field, value);
  46067. }
  46068. cff.topDict.privateDict = privateDict;
  46069. const subrIndex = new _cff_parser.CFFIndex();
  46070. for (i = 0, ii = subrs.length; i < ii; i++) {
  46071. subrIndex.add(subrs[i]);
  46072. }
  46073. privateDict.subrsIndex = subrIndex;
  46074. const compiler = new _cff_parser.CFFCompiler(cff);
  46075. return compiler.compile();
  46076. }
  46077. }
  46078. exports.Type1Font = Type1Font;
  46079. /***/ }),
  46080. /* 178 */
  46081. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  46082. "use strict";
  46083. Object.defineProperty(exports, "__esModule", ({
  46084. value: true
  46085. }));
  46086. exports.Type1Parser = void 0;
  46087. var _encodings = __w_pdfjs_require__(166);
  46088. var _core_utils = __w_pdfjs_require__(135);
  46089. var _stream = __w_pdfjs_require__(139);
  46090. var _util = __w_pdfjs_require__(2);
  46091. const HINTING_ENABLED = false;
  46092. const COMMAND_MAP = {
  46093. hstem: [1],
  46094. vstem: [3],
  46095. vmoveto: [4],
  46096. rlineto: [5],
  46097. hlineto: [6],
  46098. vlineto: [7],
  46099. rrcurveto: [8],
  46100. callsubr: [10],
  46101. flex: [12, 35],
  46102. drop: [12, 18],
  46103. endchar: [14],
  46104. rmoveto: [21],
  46105. hmoveto: [22],
  46106. vhcurveto: [30],
  46107. hvcurveto: [31]
  46108. };
  46109. class Type1CharString {
  46110. constructor() {
  46111. this.width = 0;
  46112. this.lsb = 0;
  46113. this.flexing = false;
  46114. this.output = [];
  46115. this.stack = [];
  46116. }
  46117. convert(encoded, subrs, seacAnalysisEnabled) {
  46118. const count = encoded.length;
  46119. let error = false;
  46120. let wx, sbx, subrNumber;
  46121. for (let i = 0; i < count; i++) {
  46122. let value = encoded[i];
  46123. if (value < 32) {
  46124. if (value === 12) {
  46125. value = (value << 8) + encoded[++i];
  46126. }
  46127. switch (value) {
  46128. case 1:
  46129. if (!HINTING_ENABLED) {
  46130. this.stack = [];
  46131. break;
  46132. }
  46133. error = this.executeCommand(2, COMMAND_MAP.hstem);
  46134. break;
  46135. case 3:
  46136. if (!HINTING_ENABLED) {
  46137. this.stack = [];
  46138. break;
  46139. }
  46140. error = this.executeCommand(2, COMMAND_MAP.vstem);
  46141. break;
  46142. case 4:
  46143. if (this.flexing) {
  46144. if (this.stack.length < 1) {
  46145. error = true;
  46146. break;
  46147. }
  46148. const dy = this.stack.pop();
  46149. this.stack.push(0, dy);
  46150. break;
  46151. }
  46152. error = this.executeCommand(1, COMMAND_MAP.vmoveto);
  46153. break;
  46154. case 5:
  46155. error = this.executeCommand(2, COMMAND_MAP.rlineto);
  46156. break;
  46157. case 6:
  46158. error = this.executeCommand(1, COMMAND_MAP.hlineto);
  46159. break;
  46160. case 7:
  46161. error = this.executeCommand(1, COMMAND_MAP.vlineto);
  46162. break;
  46163. case 8:
  46164. error = this.executeCommand(6, COMMAND_MAP.rrcurveto);
  46165. break;
  46166. case 9:
  46167. this.stack = [];
  46168. break;
  46169. case 10:
  46170. if (this.stack.length < 1) {
  46171. error = true;
  46172. break;
  46173. }
  46174. subrNumber = this.stack.pop();
  46175. if (!subrs[subrNumber]) {
  46176. error = true;
  46177. break;
  46178. }
  46179. error = this.convert(subrs[subrNumber], subrs, seacAnalysisEnabled);
  46180. break;
  46181. case 11:
  46182. return error;
  46183. case 13:
  46184. if (this.stack.length < 2) {
  46185. error = true;
  46186. break;
  46187. }
  46188. wx = this.stack.pop();
  46189. sbx = this.stack.pop();
  46190. this.lsb = sbx;
  46191. this.width = wx;
  46192. this.stack.push(wx, sbx);
  46193. error = this.executeCommand(2, COMMAND_MAP.hmoveto);
  46194. break;
  46195. case 14:
  46196. this.output.push(COMMAND_MAP.endchar[0]);
  46197. break;
  46198. case 21:
  46199. if (this.flexing) {
  46200. break;
  46201. }
  46202. error = this.executeCommand(2, COMMAND_MAP.rmoveto);
  46203. break;
  46204. case 22:
  46205. if (this.flexing) {
  46206. this.stack.push(0);
  46207. break;
  46208. }
  46209. error = this.executeCommand(1, COMMAND_MAP.hmoveto);
  46210. break;
  46211. case 30:
  46212. error = this.executeCommand(4, COMMAND_MAP.vhcurveto);
  46213. break;
  46214. case 31:
  46215. error = this.executeCommand(4, COMMAND_MAP.hvcurveto);
  46216. break;
  46217. case (12 << 8) + 0:
  46218. this.stack = [];
  46219. break;
  46220. case (12 << 8) + 1:
  46221. if (!HINTING_ENABLED) {
  46222. this.stack = [];
  46223. break;
  46224. }
  46225. error = this.executeCommand(2, COMMAND_MAP.vstem);
  46226. break;
  46227. case (12 << 8) + 2:
  46228. if (!HINTING_ENABLED) {
  46229. this.stack = [];
  46230. break;
  46231. }
  46232. error = this.executeCommand(2, COMMAND_MAP.hstem);
  46233. break;
  46234. case (12 << 8) + 6:
  46235. if (seacAnalysisEnabled) {
  46236. const asb = this.stack.at(-5);
  46237. this.seac = this.stack.splice(-4, 4);
  46238. this.seac[0] += this.lsb - asb;
  46239. error = this.executeCommand(0, COMMAND_MAP.endchar);
  46240. } else {
  46241. error = this.executeCommand(4, COMMAND_MAP.endchar);
  46242. }
  46243. break;
  46244. case (12 << 8) + 7:
  46245. if (this.stack.length < 4) {
  46246. error = true;
  46247. break;
  46248. }
  46249. this.stack.pop();
  46250. wx = this.stack.pop();
  46251. const sby = this.stack.pop();
  46252. sbx = this.stack.pop();
  46253. this.lsb = sbx;
  46254. this.width = wx;
  46255. this.stack.push(wx, sbx, sby);
  46256. error = this.executeCommand(3, COMMAND_MAP.rmoveto);
  46257. break;
  46258. case (12 << 8) + 12:
  46259. if (this.stack.length < 2) {
  46260. error = true;
  46261. break;
  46262. }
  46263. const num2 = this.stack.pop();
  46264. const num1 = this.stack.pop();
  46265. this.stack.push(num1 / num2);
  46266. break;
  46267. case (12 << 8) + 16:
  46268. if (this.stack.length < 2) {
  46269. error = true;
  46270. break;
  46271. }
  46272. subrNumber = this.stack.pop();
  46273. const numArgs = this.stack.pop();
  46274. if (subrNumber === 0 && numArgs === 3) {
  46275. const flexArgs = this.stack.splice(this.stack.length - 17, 17);
  46276. 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]);
  46277. error = this.executeCommand(13, COMMAND_MAP.flex, true);
  46278. this.flexing = false;
  46279. this.stack.push(flexArgs[15], flexArgs[16]);
  46280. } else if (subrNumber === 1 && numArgs === 0) {
  46281. this.flexing = true;
  46282. }
  46283. break;
  46284. case (12 << 8) + 17:
  46285. break;
  46286. case (12 << 8) + 33:
  46287. this.stack = [];
  46288. break;
  46289. default:
  46290. (0, _util.warn)('Unknown type 1 charstring command of "' + value + '"');
  46291. break;
  46292. }
  46293. if (error) {
  46294. break;
  46295. }
  46296. continue;
  46297. } else if (value <= 246) {
  46298. value -= 139;
  46299. } else if (value <= 250) {
  46300. value = (value - 247) * 256 + encoded[++i] + 108;
  46301. } else if (value <= 254) {
  46302. value = -((value - 251) * 256) - encoded[++i] - 108;
  46303. } else {
  46304. value = (encoded[++i] & 0xff) << 24 | (encoded[++i] & 0xff) << 16 | (encoded[++i] & 0xff) << 8 | (encoded[++i] & 0xff) << 0;
  46305. }
  46306. this.stack.push(value);
  46307. }
  46308. return error;
  46309. }
  46310. executeCommand(howManyArgs, command, keepStack) {
  46311. const stackLength = this.stack.length;
  46312. if (howManyArgs > stackLength) {
  46313. return true;
  46314. }
  46315. const start = stackLength - howManyArgs;
  46316. for (let i = start; i < stackLength; i++) {
  46317. let value = this.stack[i];
  46318. if (Number.isInteger(value)) {
  46319. this.output.push(28, value >> 8 & 0xff, value & 0xff);
  46320. } else {
  46321. value = 65536 * value | 0;
  46322. this.output.push(255, value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
  46323. }
  46324. }
  46325. this.output.push(...command);
  46326. if (keepStack) {
  46327. this.stack.splice(start, howManyArgs);
  46328. } else {
  46329. this.stack.length = 0;
  46330. }
  46331. return false;
  46332. }
  46333. }
  46334. const EEXEC_ENCRYPT_KEY = 55665;
  46335. const CHAR_STRS_ENCRYPT_KEY = 4330;
  46336. function isHexDigit(code) {
  46337. return code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102;
  46338. }
  46339. function decrypt(data, key, discardNumber) {
  46340. if (discardNumber >= data.length) {
  46341. return new Uint8Array(0);
  46342. }
  46343. const c1 = 52845,
  46344. c2 = 22719;
  46345. let r = key | 0,
  46346. i,
  46347. j;
  46348. for (i = 0; i < discardNumber; i++) {
  46349. r = (data[i] + r) * c1 + c2 & (1 << 16) - 1;
  46350. }
  46351. const count = data.length - discardNumber;
  46352. const decrypted = new Uint8Array(count);
  46353. for (i = discardNumber, j = 0; j < count; i++, j++) {
  46354. const value = data[i];
  46355. decrypted[j] = value ^ r >> 8;
  46356. r = (value + r) * c1 + c2 & (1 << 16) - 1;
  46357. }
  46358. return decrypted;
  46359. }
  46360. function decryptAscii(data, key, discardNumber) {
  46361. const c1 = 52845,
  46362. c2 = 22719;
  46363. let r = key | 0;
  46364. const count = data.length,
  46365. maybeLength = count >>> 1;
  46366. const decrypted = new Uint8Array(maybeLength);
  46367. let i, j;
  46368. for (i = 0, j = 0; i < count; i++) {
  46369. const digit1 = data[i];
  46370. if (!isHexDigit(digit1)) {
  46371. continue;
  46372. }
  46373. i++;
  46374. let digit2;
  46375. while (i < count && !isHexDigit(digit2 = data[i])) {
  46376. i++;
  46377. }
  46378. if (i < count) {
  46379. const value = parseInt(String.fromCharCode(digit1, digit2), 16);
  46380. decrypted[j++] = value ^ r >> 8;
  46381. r = (value + r) * c1 + c2 & (1 << 16) - 1;
  46382. }
  46383. }
  46384. return decrypted.slice(discardNumber, j);
  46385. }
  46386. function isSpecial(c) {
  46387. return c === 0x2f || c === 0x5b || c === 0x5d || c === 0x7b || c === 0x7d || c === 0x28 || c === 0x29;
  46388. }
  46389. class Type1Parser {
  46390. constructor(stream, encrypted, seacAnalysisEnabled) {
  46391. if (encrypted) {
  46392. const data = stream.getBytes();
  46393. 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]));
  46394. stream = new _stream.Stream(isBinary ? decrypt(data, EEXEC_ENCRYPT_KEY, 4) : decryptAscii(data, EEXEC_ENCRYPT_KEY, 4));
  46395. }
  46396. this.seacAnalysisEnabled = !!seacAnalysisEnabled;
  46397. this.stream = stream;
  46398. this.nextChar();
  46399. }
  46400. readNumberArray() {
  46401. this.getToken();
  46402. const array = [];
  46403. while (true) {
  46404. const token = this.getToken();
  46405. if (token === null || token === "]" || token === "}") {
  46406. break;
  46407. }
  46408. array.push(parseFloat(token || 0));
  46409. }
  46410. return array;
  46411. }
  46412. readNumber() {
  46413. const token = this.getToken();
  46414. return parseFloat(token || 0);
  46415. }
  46416. readInt() {
  46417. const token = this.getToken();
  46418. return parseInt(token || 0, 10) | 0;
  46419. }
  46420. readBoolean() {
  46421. const token = this.getToken();
  46422. return token === "true" ? 1 : 0;
  46423. }
  46424. nextChar() {
  46425. return this.currentChar = this.stream.getByte();
  46426. }
  46427. prevChar() {
  46428. this.stream.skip(-2);
  46429. return this.currentChar = this.stream.getByte();
  46430. }
  46431. getToken() {
  46432. let comment = false;
  46433. let ch = this.currentChar;
  46434. while (true) {
  46435. if (ch === -1) {
  46436. return null;
  46437. }
  46438. if (comment) {
  46439. if (ch === 0x0a || ch === 0x0d) {
  46440. comment = false;
  46441. }
  46442. } else if (ch === 0x25) {
  46443. comment = true;
  46444. } else if (!(0, _core_utils.isWhiteSpace)(ch)) {
  46445. break;
  46446. }
  46447. ch = this.nextChar();
  46448. }
  46449. if (isSpecial(ch)) {
  46450. this.nextChar();
  46451. return String.fromCharCode(ch);
  46452. }
  46453. let token = "";
  46454. do {
  46455. token += String.fromCharCode(ch);
  46456. ch = this.nextChar();
  46457. } while (ch >= 0 && !(0, _core_utils.isWhiteSpace)(ch) && !isSpecial(ch));
  46458. return token;
  46459. }
  46460. readCharStrings(bytes, lenIV) {
  46461. if (lenIV === -1) {
  46462. return bytes;
  46463. }
  46464. return decrypt(bytes, CHAR_STRS_ENCRYPT_KEY, lenIV);
  46465. }
  46466. extractFontProgram(properties) {
  46467. const stream = this.stream;
  46468. const subrs = [],
  46469. charstrings = [];
  46470. const privateData = Object.create(null);
  46471. privateData.lenIV = 4;
  46472. const program = {
  46473. subrs: [],
  46474. charstrings: [],
  46475. properties: {
  46476. privateData
  46477. }
  46478. };
  46479. let token, length, data, lenIV;
  46480. while ((token = this.getToken()) !== null) {
  46481. if (token !== "/") {
  46482. continue;
  46483. }
  46484. token = this.getToken();
  46485. switch (token) {
  46486. case "CharStrings":
  46487. this.getToken();
  46488. this.getToken();
  46489. this.getToken();
  46490. this.getToken();
  46491. while (true) {
  46492. token = this.getToken();
  46493. if (token === null || token === "end") {
  46494. break;
  46495. }
  46496. if (token !== "/") {
  46497. continue;
  46498. }
  46499. const glyph = this.getToken();
  46500. length = this.readInt();
  46501. this.getToken();
  46502. data = length > 0 ? stream.getBytes(length) : new Uint8Array(0);
  46503. lenIV = program.properties.privateData.lenIV;
  46504. const encoded = this.readCharStrings(data, lenIV);
  46505. this.nextChar();
  46506. token = this.getToken();
  46507. if (token === "noaccess") {
  46508. this.getToken();
  46509. } else if (token === "/") {
  46510. this.prevChar();
  46511. }
  46512. charstrings.push({
  46513. glyph,
  46514. encoded
  46515. });
  46516. }
  46517. break;
  46518. case "Subrs":
  46519. this.readInt();
  46520. this.getToken();
  46521. while (this.getToken() === "dup") {
  46522. const index = this.readInt();
  46523. length = this.readInt();
  46524. this.getToken();
  46525. data = length > 0 ? stream.getBytes(length) : new Uint8Array(0);
  46526. lenIV = program.properties.privateData.lenIV;
  46527. const encoded = this.readCharStrings(data, lenIV);
  46528. this.nextChar();
  46529. token = this.getToken();
  46530. if (token === "noaccess") {
  46531. this.getToken();
  46532. }
  46533. subrs[index] = encoded;
  46534. }
  46535. break;
  46536. case "BlueValues":
  46537. case "OtherBlues":
  46538. case "FamilyBlues":
  46539. case "FamilyOtherBlues":
  46540. const blueArray = this.readNumberArray();
  46541. if (blueArray.length > 0 && blueArray.length % 2 === 0 && HINTING_ENABLED) {
  46542. program.properties.privateData[token] = blueArray;
  46543. }
  46544. break;
  46545. case "StemSnapH":
  46546. case "StemSnapV":
  46547. program.properties.privateData[token] = this.readNumberArray();
  46548. break;
  46549. case "StdHW":
  46550. case "StdVW":
  46551. program.properties.privateData[token] = this.readNumberArray()[0];
  46552. break;
  46553. case "BlueShift":
  46554. case "lenIV":
  46555. case "BlueFuzz":
  46556. case "BlueScale":
  46557. case "LanguageGroup":
  46558. case "ExpansionFactor":
  46559. program.properties.privateData[token] = this.readNumber();
  46560. break;
  46561. case "ForceBold":
  46562. program.properties.privateData[token] = this.readBoolean();
  46563. break;
  46564. }
  46565. }
  46566. for (const {
  46567. encoded,
  46568. glyph
  46569. } of charstrings) {
  46570. const charString = new Type1CharString();
  46571. const error = charString.convert(encoded, subrs, this.seacAnalysisEnabled);
  46572. let output = charString.output;
  46573. if (error) {
  46574. output = [14];
  46575. }
  46576. const charStringObject = {
  46577. glyphName: glyph,
  46578. charstring: output,
  46579. width: charString.width,
  46580. lsb: charString.lsb,
  46581. seac: charString.seac
  46582. };
  46583. if (glyph === ".notdef") {
  46584. program.charstrings.unshift(charStringObject);
  46585. } else {
  46586. program.charstrings.push(charStringObject);
  46587. }
  46588. if (properties.builtInEncoding) {
  46589. const index = properties.builtInEncoding.indexOf(glyph);
  46590. if (index > -1 && properties.widths[index] === undefined && index >= properties.firstChar && index <= properties.lastChar) {
  46591. properties.widths[index] = charString.width;
  46592. }
  46593. }
  46594. }
  46595. return program;
  46596. }
  46597. extractFontHeader(properties) {
  46598. let token;
  46599. while ((token = this.getToken()) !== null) {
  46600. if (token !== "/") {
  46601. continue;
  46602. }
  46603. token = this.getToken();
  46604. switch (token) {
  46605. case "FontMatrix":
  46606. const matrix = this.readNumberArray();
  46607. properties.fontMatrix = matrix;
  46608. break;
  46609. case "Encoding":
  46610. const encodingArg = this.getToken();
  46611. let encoding;
  46612. if (!/^\d+$/.test(encodingArg)) {
  46613. encoding = (0, _encodings.getEncoding)(encodingArg);
  46614. } else {
  46615. encoding = [];
  46616. const size = parseInt(encodingArg, 10) | 0;
  46617. this.getToken();
  46618. for (let j = 0; j < size; j++) {
  46619. token = this.getToken();
  46620. while (token !== "dup" && token !== "def") {
  46621. token = this.getToken();
  46622. if (token === null) {
  46623. return;
  46624. }
  46625. }
  46626. if (token === "def") {
  46627. break;
  46628. }
  46629. const index = this.readInt();
  46630. this.getToken();
  46631. const glyph = this.getToken();
  46632. encoding[index] = glyph;
  46633. this.getToken();
  46634. }
  46635. }
  46636. properties.builtInEncoding = encoding;
  46637. break;
  46638. case "FontBBox":
  46639. const fontBBox = this.readNumberArray();
  46640. properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
  46641. properties.descent = Math.min(fontBBox[1], fontBBox[3]);
  46642. properties.ascentScaled = true;
  46643. break;
  46644. }
  46645. }
  46646. }
  46647. }
  46648. exports.Type1Parser = Type1Parser;
  46649. /***/ }),
  46650. /* 179 */
  46651. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  46652. "use strict";
  46653. Object.defineProperty(exports, "__esModule", ({
  46654. value: true
  46655. }));
  46656. exports.Pattern = void 0;
  46657. exports.getTilingPatternIR = getTilingPatternIR;
  46658. var _util = __w_pdfjs_require__(2);
  46659. var _base_stream = __w_pdfjs_require__(136);
  46660. var _colorspace = __w_pdfjs_require__(143);
  46661. var _core_utils = __w_pdfjs_require__(135);
  46662. const ShadingType = {
  46663. FUNCTION_BASED: 1,
  46664. AXIAL: 2,
  46665. RADIAL: 3,
  46666. FREE_FORM_MESH: 4,
  46667. LATTICE_FORM_MESH: 5,
  46668. COONS_PATCH_MESH: 6,
  46669. TENSOR_PATCH_MESH: 7
  46670. };
  46671. class Pattern {
  46672. constructor() {
  46673. (0, _util.unreachable)("Cannot initialize Pattern.");
  46674. }
  46675. static parseShading(shading, xref, res, handler, pdfFunctionFactory, localColorSpaceCache) {
  46676. const dict = shading instanceof _base_stream.BaseStream ? shading.dict : shading;
  46677. const type = dict.get("ShadingType");
  46678. try {
  46679. switch (type) {
  46680. case ShadingType.AXIAL:
  46681. case ShadingType.RADIAL:
  46682. return new RadialAxialShading(dict, xref, res, pdfFunctionFactory, localColorSpaceCache);
  46683. case ShadingType.FREE_FORM_MESH:
  46684. case ShadingType.LATTICE_FORM_MESH:
  46685. case ShadingType.COONS_PATCH_MESH:
  46686. case ShadingType.TENSOR_PATCH_MESH:
  46687. return new MeshShading(shading, xref, res, pdfFunctionFactory, localColorSpaceCache);
  46688. default:
  46689. throw new _util.FormatError("Unsupported ShadingType: " + type);
  46690. }
  46691. } catch (ex) {
  46692. if (ex instanceof _core_utils.MissingDataException) {
  46693. throw ex;
  46694. }
  46695. handler.send("UnsupportedFeature", {
  46696. featureId: _util.UNSUPPORTED_FEATURES.shadingPattern
  46697. });
  46698. (0, _util.warn)(ex);
  46699. return new DummyShading();
  46700. }
  46701. }
  46702. }
  46703. exports.Pattern = Pattern;
  46704. class BaseShading {
  46705. static get SMALL_NUMBER() {
  46706. return (0, _util.shadow)(this, "SMALL_NUMBER", 1e-6);
  46707. }
  46708. constructor() {
  46709. if (this.constructor === BaseShading) {
  46710. (0, _util.unreachable)("Cannot initialize BaseShading.");
  46711. }
  46712. }
  46713. getIR() {
  46714. (0, _util.unreachable)("Abstract method `getIR` called.");
  46715. }
  46716. }
  46717. class RadialAxialShading extends BaseShading {
  46718. constructor(dict, xref, resources, pdfFunctionFactory, localColorSpaceCache) {
  46719. super();
  46720. this.coordsArr = dict.getArray("Coords");
  46721. this.shadingType = dict.get("ShadingType");
  46722. const cs = _colorspace.ColorSpace.parse({
  46723. cs: dict.getRaw("CS") || dict.getRaw("ColorSpace"),
  46724. xref,
  46725. resources,
  46726. pdfFunctionFactory,
  46727. localColorSpaceCache
  46728. });
  46729. const bbox = dict.getArray("BBox");
  46730. if (Array.isArray(bbox) && bbox.length === 4) {
  46731. this.bbox = _util.Util.normalizeRect(bbox);
  46732. } else {
  46733. this.bbox = null;
  46734. }
  46735. let t0 = 0.0,
  46736. t1 = 1.0;
  46737. if (dict.has("Domain")) {
  46738. const domainArr = dict.getArray("Domain");
  46739. t0 = domainArr[0];
  46740. t1 = domainArr[1];
  46741. }
  46742. let extendStart = false,
  46743. extendEnd = false;
  46744. if (dict.has("Extend")) {
  46745. const extendArr = dict.getArray("Extend");
  46746. extendStart = extendArr[0];
  46747. extendEnd = extendArr[1];
  46748. }
  46749. if (this.shadingType === ShadingType.RADIAL && (!extendStart || !extendEnd)) {
  46750. const [x1, y1, r1, x2, y2, r2] = this.coordsArr;
  46751. const distance = Math.hypot(x1 - x2, y1 - y2);
  46752. if (r1 <= r2 + distance && r2 <= r1 + distance) {
  46753. (0, _util.warn)("Unsupported radial gradient.");
  46754. }
  46755. }
  46756. this.extendStart = extendStart;
  46757. this.extendEnd = extendEnd;
  46758. const fnObj = dict.getRaw("Function");
  46759. const fn = pdfFunctionFactory.createFromArray(fnObj);
  46760. const NUMBER_OF_SAMPLES = 10;
  46761. const step = (t1 - t0) / NUMBER_OF_SAMPLES;
  46762. const colorStops = this.colorStops = [];
  46763. if (t0 >= t1 || step <= 0) {
  46764. (0, _util.info)("Bad shading domain.");
  46765. return;
  46766. }
  46767. const color = new Float32Array(cs.numComps),
  46768. ratio = new Float32Array(1);
  46769. let rgbColor;
  46770. for (let i = 0; i <= NUMBER_OF_SAMPLES; i++) {
  46771. ratio[0] = t0 + i * step;
  46772. fn(ratio, 0, color, 0);
  46773. rgbColor = cs.getRgb(color, 0);
  46774. const cssColor = _util.Util.makeHexColor(rgbColor[0], rgbColor[1], rgbColor[2]);
  46775. colorStops.push([i / NUMBER_OF_SAMPLES, cssColor]);
  46776. }
  46777. let background = "transparent";
  46778. if (dict.has("Background")) {
  46779. rgbColor = cs.getRgb(dict.get("Background"), 0);
  46780. background = _util.Util.makeHexColor(rgbColor[0], rgbColor[1], rgbColor[2]);
  46781. }
  46782. if (!extendStart) {
  46783. colorStops.unshift([0, background]);
  46784. colorStops[1][0] += BaseShading.SMALL_NUMBER;
  46785. }
  46786. if (!extendEnd) {
  46787. colorStops.at(-1)[0] -= BaseShading.SMALL_NUMBER;
  46788. colorStops.push([1, background]);
  46789. }
  46790. this.colorStops = colorStops;
  46791. }
  46792. getIR() {
  46793. const coordsArr = this.coordsArr;
  46794. const shadingType = this.shadingType;
  46795. let type, p0, p1, r0, r1;
  46796. if (shadingType === ShadingType.AXIAL) {
  46797. p0 = [coordsArr[0], coordsArr[1]];
  46798. p1 = [coordsArr[2], coordsArr[3]];
  46799. r0 = null;
  46800. r1 = null;
  46801. type = "axial";
  46802. } else if (shadingType === ShadingType.RADIAL) {
  46803. p0 = [coordsArr[0], coordsArr[1]];
  46804. p1 = [coordsArr[3], coordsArr[4]];
  46805. r0 = coordsArr[2];
  46806. r1 = coordsArr[5];
  46807. type = "radial";
  46808. } else {
  46809. (0, _util.unreachable)(`getPattern type unknown: ${shadingType}`);
  46810. }
  46811. return ["RadialAxial", type, this.bbox, this.colorStops, p0, p1, r0, r1];
  46812. }
  46813. }
  46814. class MeshStreamReader {
  46815. constructor(stream, context) {
  46816. this.stream = stream;
  46817. this.context = context;
  46818. this.buffer = 0;
  46819. this.bufferLength = 0;
  46820. const numComps = context.numComps;
  46821. this.tmpCompsBuf = new Float32Array(numComps);
  46822. const csNumComps = context.colorSpace.numComps;
  46823. this.tmpCsCompsBuf = context.colorFn ? new Float32Array(csNumComps) : this.tmpCompsBuf;
  46824. }
  46825. get hasData() {
  46826. if (this.stream.end) {
  46827. return this.stream.pos < this.stream.end;
  46828. }
  46829. if (this.bufferLength > 0) {
  46830. return true;
  46831. }
  46832. const nextByte = this.stream.getByte();
  46833. if (nextByte < 0) {
  46834. return false;
  46835. }
  46836. this.buffer = nextByte;
  46837. this.bufferLength = 8;
  46838. return true;
  46839. }
  46840. readBits(n) {
  46841. let buffer = this.buffer;
  46842. let bufferLength = this.bufferLength;
  46843. if (n === 32) {
  46844. if (bufferLength === 0) {
  46845. return (this.stream.getByte() << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte()) >>> 0;
  46846. }
  46847. buffer = buffer << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte();
  46848. const nextByte = this.stream.getByte();
  46849. this.buffer = nextByte & (1 << bufferLength) - 1;
  46850. return (buffer << 8 - bufferLength | (nextByte & 0xff) >> bufferLength) >>> 0;
  46851. }
  46852. if (n === 8 && bufferLength === 0) {
  46853. return this.stream.getByte();
  46854. }
  46855. while (bufferLength < n) {
  46856. buffer = buffer << 8 | this.stream.getByte();
  46857. bufferLength += 8;
  46858. }
  46859. bufferLength -= n;
  46860. this.bufferLength = bufferLength;
  46861. this.buffer = buffer & (1 << bufferLength) - 1;
  46862. return buffer >> bufferLength;
  46863. }
  46864. align() {
  46865. this.buffer = 0;
  46866. this.bufferLength = 0;
  46867. }
  46868. readFlag() {
  46869. return this.readBits(this.context.bitsPerFlag);
  46870. }
  46871. readCoordinate() {
  46872. const bitsPerCoordinate = this.context.bitsPerCoordinate;
  46873. const xi = this.readBits(bitsPerCoordinate);
  46874. const yi = this.readBits(bitsPerCoordinate);
  46875. const decode = this.context.decode;
  46876. const scale = bitsPerCoordinate < 32 ? 1 / ((1 << bitsPerCoordinate) - 1) : 2.3283064365386963e-10;
  46877. return [xi * scale * (decode[1] - decode[0]) + decode[0], yi * scale * (decode[3] - decode[2]) + decode[2]];
  46878. }
  46879. readComponents() {
  46880. const numComps = this.context.numComps;
  46881. const bitsPerComponent = this.context.bitsPerComponent;
  46882. const scale = bitsPerComponent < 32 ? 1 / ((1 << bitsPerComponent) - 1) : 2.3283064365386963e-10;
  46883. const decode = this.context.decode;
  46884. const components = this.tmpCompsBuf;
  46885. for (let i = 0, j = 4; i < numComps; i++, j += 2) {
  46886. const ci = this.readBits(bitsPerComponent);
  46887. components[i] = ci * scale * (decode[j + 1] - decode[j]) + decode[j];
  46888. }
  46889. const color = this.tmpCsCompsBuf;
  46890. if (this.context.colorFn) {
  46891. this.context.colorFn(components, 0, color, 0);
  46892. }
  46893. return this.context.colorSpace.getRgb(color, 0);
  46894. }
  46895. }
  46896. const getB = function getBClosure() {
  46897. function buildB(count) {
  46898. const lut = [];
  46899. for (let i = 0; i <= count; i++) {
  46900. const t = i / count,
  46901. t_ = 1 - t;
  46902. lut.push(new Float32Array([t_ * t_ * t_, 3 * t * t_ * t_, 3 * t * t * t_, t * t * t]));
  46903. }
  46904. return lut;
  46905. }
  46906. const cache = [];
  46907. return function (count) {
  46908. if (!cache[count]) {
  46909. cache[count] = buildB(count);
  46910. }
  46911. return cache[count];
  46912. };
  46913. }();
  46914. class MeshShading extends BaseShading {
  46915. static get MIN_SPLIT_PATCH_CHUNKS_AMOUNT() {
  46916. return (0, _util.shadow)(this, "MIN_SPLIT_PATCH_CHUNKS_AMOUNT", 3);
  46917. }
  46918. static get MAX_SPLIT_PATCH_CHUNKS_AMOUNT() {
  46919. return (0, _util.shadow)(this, "MAX_SPLIT_PATCH_CHUNKS_AMOUNT", 20);
  46920. }
  46921. static get TRIANGLE_DENSITY() {
  46922. return (0, _util.shadow)(this, "TRIANGLE_DENSITY", 20);
  46923. }
  46924. constructor(stream, xref, resources, pdfFunctionFactory, localColorSpaceCache) {
  46925. super();
  46926. if (!(stream instanceof _base_stream.BaseStream)) {
  46927. throw new _util.FormatError("Mesh data is not a stream");
  46928. }
  46929. const dict = stream.dict;
  46930. this.shadingType = dict.get("ShadingType");
  46931. const bbox = dict.getArray("BBox");
  46932. if (Array.isArray(bbox) && bbox.length === 4) {
  46933. this.bbox = _util.Util.normalizeRect(bbox);
  46934. } else {
  46935. this.bbox = null;
  46936. }
  46937. const cs = _colorspace.ColorSpace.parse({
  46938. cs: dict.getRaw("CS") || dict.getRaw("ColorSpace"),
  46939. xref,
  46940. resources,
  46941. pdfFunctionFactory,
  46942. localColorSpaceCache
  46943. });
  46944. this.background = dict.has("Background") ? cs.getRgb(dict.get("Background"), 0) : null;
  46945. const fnObj = dict.getRaw("Function");
  46946. const fn = fnObj ? pdfFunctionFactory.createFromArray(fnObj) : null;
  46947. this.coords = [];
  46948. this.colors = [];
  46949. this.figures = [];
  46950. const decodeContext = {
  46951. bitsPerCoordinate: dict.get("BitsPerCoordinate"),
  46952. bitsPerComponent: dict.get("BitsPerComponent"),
  46953. bitsPerFlag: dict.get("BitsPerFlag"),
  46954. decode: dict.getArray("Decode"),
  46955. colorFn: fn,
  46956. colorSpace: cs,
  46957. numComps: fn ? 1 : cs.numComps
  46958. };
  46959. const reader = new MeshStreamReader(stream, decodeContext);
  46960. let patchMesh = false;
  46961. switch (this.shadingType) {
  46962. case ShadingType.FREE_FORM_MESH:
  46963. this._decodeType4Shading(reader);
  46964. break;
  46965. case ShadingType.LATTICE_FORM_MESH:
  46966. const verticesPerRow = dict.get("VerticesPerRow") | 0;
  46967. if (verticesPerRow < 2) {
  46968. throw new _util.FormatError("Invalid VerticesPerRow");
  46969. }
  46970. this._decodeType5Shading(reader, verticesPerRow);
  46971. break;
  46972. case ShadingType.COONS_PATCH_MESH:
  46973. this._decodeType6Shading(reader);
  46974. patchMesh = true;
  46975. break;
  46976. case ShadingType.TENSOR_PATCH_MESH:
  46977. this._decodeType7Shading(reader);
  46978. patchMesh = true;
  46979. break;
  46980. default:
  46981. (0, _util.unreachable)("Unsupported mesh type.");
  46982. break;
  46983. }
  46984. if (patchMesh) {
  46985. this._updateBounds();
  46986. for (let i = 0, ii = this.figures.length; i < ii; i++) {
  46987. this._buildFigureFromPatch(i);
  46988. }
  46989. }
  46990. this._updateBounds();
  46991. this._packData();
  46992. }
  46993. _decodeType4Shading(reader) {
  46994. const coords = this.coords;
  46995. const colors = this.colors;
  46996. const operators = [];
  46997. const ps = [];
  46998. let verticesLeft = 0;
  46999. while (reader.hasData) {
  47000. const f = reader.readFlag();
  47001. const coord = reader.readCoordinate();
  47002. const color = reader.readComponents();
  47003. if (verticesLeft === 0) {
  47004. if (!(0 <= f && f <= 2)) {
  47005. throw new _util.FormatError("Unknown type4 flag");
  47006. }
  47007. switch (f) {
  47008. case 0:
  47009. verticesLeft = 3;
  47010. break;
  47011. case 1:
  47012. ps.push(ps.at(-2), ps.at(-1));
  47013. verticesLeft = 1;
  47014. break;
  47015. case 2:
  47016. ps.push(ps.at(-3), ps.at(-1));
  47017. verticesLeft = 1;
  47018. break;
  47019. }
  47020. operators.push(f);
  47021. }
  47022. ps.push(coords.length);
  47023. coords.push(coord);
  47024. colors.push(color);
  47025. verticesLeft--;
  47026. reader.align();
  47027. }
  47028. this.figures.push({
  47029. type: "triangles",
  47030. coords: new Int32Array(ps),
  47031. colors: new Int32Array(ps)
  47032. });
  47033. }
  47034. _decodeType5Shading(reader, verticesPerRow) {
  47035. const coords = this.coords;
  47036. const colors = this.colors;
  47037. const ps = [];
  47038. while (reader.hasData) {
  47039. const coord = reader.readCoordinate();
  47040. const color = reader.readComponents();
  47041. ps.push(coords.length);
  47042. coords.push(coord);
  47043. colors.push(color);
  47044. }
  47045. this.figures.push({
  47046. type: "lattice",
  47047. coords: new Int32Array(ps),
  47048. colors: new Int32Array(ps),
  47049. verticesPerRow
  47050. });
  47051. }
  47052. _decodeType6Shading(reader) {
  47053. const coords = this.coords;
  47054. const colors = this.colors;
  47055. const ps = new Int32Array(16);
  47056. const cs = new Int32Array(4);
  47057. while (reader.hasData) {
  47058. const f = reader.readFlag();
  47059. if (!(0 <= f && f <= 3)) {
  47060. throw new _util.FormatError("Unknown type6 flag");
  47061. }
  47062. const pi = coords.length;
  47063. for (let i = 0, ii = f !== 0 ? 8 : 12; i < ii; i++) {
  47064. coords.push(reader.readCoordinate());
  47065. }
  47066. const ci = colors.length;
  47067. for (let i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
  47068. colors.push(reader.readComponents());
  47069. }
  47070. let tmp1, tmp2, tmp3, tmp4;
  47071. switch (f) {
  47072. case 0:
  47073. ps[12] = pi + 3;
  47074. ps[13] = pi + 4;
  47075. ps[14] = pi + 5;
  47076. ps[15] = pi + 6;
  47077. ps[8] = pi + 2;
  47078. ps[11] = pi + 7;
  47079. ps[4] = pi + 1;
  47080. ps[7] = pi + 8;
  47081. ps[0] = pi;
  47082. ps[1] = pi + 11;
  47083. ps[2] = pi + 10;
  47084. ps[3] = pi + 9;
  47085. cs[2] = ci + 1;
  47086. cs[3] = ci + 2;
  47087. cs[0] = ci;
  47088. cs[1] = ci + 3;
  47089. break;
  47090. case 1:
  47091. tmp1 = ps[12];
  47092. tmp2 = ps[13];
  47093. tmp3 = ps[14];
  47094. tmp4 = ps[15];
  47095. ps[12] = tmp4;
  47096. ps[13] = pi + 0;
  47097. ps[14] = pi + 1;
  47098. ps[15] = pi + 2;
  47099. ps[8] = tmp3;
  47100. ps[11] = pi + 3;
  47101. ps[4] = tmp2;
  47102. ps[7] = pi + 4;
  47103. ps[0] = tmp1;
  47104. ps[1] = pi + 7;
  47105. ps[2] = pi + 6;
  47106. ps[3] = pi + 5;
  47107. tmp1 = cs[2];
  47108. tmp2 = cs[3];
  47109. cs[2] = tmp2;
  47110. cs[3] = ci;
  47111. cs[0] = tmp1;
  47112. cs[1] = ci + 1;
  47113. break;
  47114. case 2:
  47115. tmp1 = ps[15];
  47116. tmp2 = ps[11];
  47117. ps[12] = ps[3];
  47118. ps[13] = pi + 0;
  47119. ps[14] = pi + 1;
  47120. ps[15] = pi + 2;
  47121. ps[8] = ps[7];
  47122. ps[11] = pi + 3;
  47123. ps[4] = tmp2;
  47124. ps[7] = pi + 4;
  47125. ps[0] = tmp1;
  47126. ps[1] = pi + 7;
  47127. ps[2] = pi + 6;
  47128. ps[3] = pi + 5;
  47129. tmp1 = cs[3];
  47130. cs[2] = cs[1];
  47131. cs[3] = ci;
  47132. cs[0] = tmp1;
  47133. cs[1] = ci + 1;
  47134. break;
  47135. case 3:
  47136. ps[12] = ps[0];
  47137. ps[13] = pi + 0;
  47138. ps[14] = pi + 1;
  47139. ps[15] = pi + 2;
  47140. ps[8] = ps[1];
  47141. ps[11] = pi + 3;
  47142. ps[4] = ps[2];
  47143. ps[7] = pi + 4;
  47144. ps[0] = ps[3];
  47145. ps[1] = pi + 7;
  47146. ps[2] = pi + 6;
  47147. ps[3] = pi + 5;
  47148. cs[2] = cs[0];
  47149. cs[3] = ci;
  47150. cs[0] = cs[1];
  47151. cs[1] = ci + 1;
  47152. break;
  47153. }
  47154. ps[5] = coords.length;
  47155. 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]);
  47156. ps[6] = coords.length;
  47157. 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]);
  47158. ps[9] = coords.length;
  47159. 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]);
  47160. ps[10] = coords.length;
  47161. 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]);
  47162. this.figures.push({
  47163. type: "patch",
  47164. coords: new Int32Array(ps),
  47165. colors: new Int32Array(cs)
  47166. });
  47167. }
  47168. }
  47169. _decodeType7Shading(reader) {
  47170. const coords = this.coords;
  47171. const colors = this.colors;
  47172. const ps = new Int32Array(16);
  47173. const cs = new Int32Array(4);
  47174. while (reader.hasData) {
  47175. const f = reader.readFlag();
  47176. if (!(0 <= f && f <= 3)) {
  47177. throw new _util.FormatError("Unknown type7 flag");
  47178. }
  47179. const pi = coords.length;
  47180. for (let i = 0, ii = f !== 0 ? 12 : 16; i < ii; i++) {
  47181. coords.push(reader.readCoordinate());
  47182. }
  47183. const ci = colors.length;
  47184. for (let i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
  47185. colors.push(reader.readComponents());
  47186. }
  47187. let tmp1, tmp2, tmp3, tmp4;
  47188. switch (f) {
  47189. case 0:
  47190. ps[12] = pi + 3;
  47191. ps[13] = pi + 4;
  47192. ps[14] = pi + 5;
  47193. ps[15] = pi + 6;
  47194. ps[8] = pi + 2;
  47195. ps[9] = pi + 13;
  47196. ps[10] = pi + 14;
  47197. ps[11] = pi + 7;
  47198. ps[4] = pi + 1;
  47199. ps[5] = pi + 12;
  47200. ps[6] = pi + 15;
  47201. ps[7] = pi + 8;
  47202. ps[0] = pi;
  47203. ps[1] = pi + 11;
  47204. ps[2] = pi + 10;
  47205. ps[3] = pi + 9;
  47206. cs[2] = ci + 1;
  47207. cs[3] = ci + 2;
  47208. cs[0] = ci;
  47209. cs[1] = ci + 3;
  47210. break;
  47211. case 1:
  47212. tmp1 = ps[12];
  47213. tmp2 = ps[13];
  47214. tmp3 = ps[14];
  47215. tmp4 = ps[15];
  47216. ps[12] = tmp4;
  47217. ps[13] = pi + 0;
  47218. ps[14] = pi + 1;
  47219. ps[15] = pi + 2;
  47220. ps[8] = tmp3;
  47221. ps[9] = pi + 9;
  47222. ps[10] = pi + 10;
  47223. ps[11] = pi + 3;
  47224. ps[4] = tmp2;
  47225. ps[5] = pi + 8;
  47226. ps[6] = pi + 11;
  47227. ps[7] = pi + 4;
  47228. ps[0] = tmp1;
  47229. ps[1] = pi + 7;
  47230. ps[2] = pi + 6;
  47231. ps[3] = pi + 5;
  47232. tmp1 = cs[2];
  47233. tmp2 = cs[3];
  47234. cs[2] = tmp2;
  47235. cs[3] = ci;
  47236. cs[0] = tmp1;
  47237. cs[1] = ci + 1;
  47238. break;
  47239. case 2:
  47240. tmp1 = ps[15];
  47241. tmp2 = ps[11];
  47242. ps[12] = ps[3];
  47243. ps[13] = pi + 0;
  47244. ps[14] = pi + 1;
  47245. ps[15] = pi + 2;
  47246. ps[8] = ps[7];
  47247. ps[9] = pi + 9;
  47248. ps[10] = pi + 10;
  47249. ps[11] = pi + 3;
  47250. ps[4] = tmp2;
  47251. ps[5] = pi + 8;
  47252. ps[6] = pi + 11;
  47253. ps[7] = pi + 4;
  47254. ps[0] = tmp1;
  47255. ps[1] = pi + 7;
  47256. ps[2] = pi + 6;
  47257. ps[3] = pi + 5;
  47258. tmp1 = cs[3];
  47259. cs[2] = cs[1];
  47260. cs[3] = ci;
  47261. cs[0] = tmp1;
  47262. cs[1] = ci + 1;
  47263. break;
  47264. case 3:
  47265. ps[12] = ps[0];
  47266. ps[13] = pi + 0;
  47267. ps[14] = pi + 1;
  47268. ps[15] = pi + 2;
  47269. ps[8] = ps[1];
  47270. ps[9] = pi + 9;
  47271. ps[10] = pi + 10;
  47272. ps[11] = pi + 3;
  47273. ps[4] = ps[2];
  47274. ps[5] = pi + 8;
  47275. ps[6] = pi + 11;
  47276. ps[7] = pi + 4;
  47277. ps[0] = ps[3];
  47278. ps[1] = pi + 7;
  47279. ps[2] = pi + 6;
  47280. ps[3] = pi + 5;
  47281. cs[2] = cs[0];
  47282. cs[3] = ci;
  47283. cs[0] = cs[1];
  47284. cs[1] = ci + 1;
  47285. break;
  47286. }
  47287. this.figures.push({
  47288. type: "patch",
  47289. coords: new Int32Array(ps),
  47290. colors: new Int32Array(cs)
  47291. });
  47292. }
  47293. }
  47294. _buildFigureFromPatch(index) {
  47295. const figure = this.figures[index];
  47296. (0, _util.assert)(figure.type === "patch", "Unexpected patch mesh figure");
  47297. const coords = this.coords,
  47298. colors = this.colors;
  47299. const pi = figure.coords;
  47300. const ci = figure.colors;
  47301. const figureMinX = Math.min(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
  47302. const figureMinY = Math.min(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
  47303. const figureMaxX = Math.max(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
  47304. const figureMaxY = Math.max(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
  47305. let splitXBy = Math.ceil((figureMaxX - figureMinX) * MeshShading.TRIANGLE_DENSITY / (this.bounds[2] - this.bounds[0]));
  47306. splitXBy = Math.max(MeshShading.MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MeshShading.MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitXBy));
  47307. let splitYBy = Math.ceil((figureMaxY - figureMinY) * MeshShading.TRIANGLE_DENSITY / (this.bounds[3] - this.bounds[1]));
  47308. splitYBy = Math.max(MeshShading.MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MeshShading.MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitYBy));
  47309. const verticesPerRow = splitXBy + 1;
  47310. const figureCoords = new Int32Array((splitYBy + 1) * verticesPerRow);
  47311. const figureColors = new Int32Array((splitYBy + 1) * verticesPerRow);
  47312. let k = 0;
  47313. const cl = new Uint8Array(3),
  47314. cr = new Uint8Array(3);
  47315. const c0 = colors[ci[0]],
  47316. c1 = colors[ci[1]],
  47317. c2 = colors[ci[2]],
  47318. c3 = colors[ci[3]];
  47319. const bRow = getB(splitYBy),
  47320. bCol = getB(splitXBy);
  47321. for (let row = 0; row <= splitYBy; row++) {
  47322. cl[0] = (c0[0] * (splitYBy - row) + c2[0] * row) / splitYBy | 0;
  47323. cl[1] = (c0[1] * (splitYBy - row) + c2[1] * row) / splitYBy | 0;
  47324. cl[2] = (c0[2] * (splitYBy - row) + c2[2] * row) / splitYBy | 0;
  47325. cr[0] = (c1[0] * (splitYBy - row) + c3[0] * row) / splitYBy | 0;
  47326. cr[1] = (c1[1] * (splitYBy - row) + c3[1] * row) / splitYBy | 0;
  47327. cr[2] = (c1[2] * (splitYBy - row) + c3[2] * row) / splitYBy | 0;
  47328. for (let col = 0; col <= splitXBy; col++, k++) {
  47329. if ((row === 0 || row === splitYBy) && (col === 0 || col === splitXBy)) {
  47330. continue;
  47331. }
  47332. let x = 0,
  47333. y = 0;
  47334. let q = 0;
  47335. for (let i = 0; i <= 3; i++) {
  47336. for (let j = 0; j <= 3; j++, q++) {
  47337. const m = bRow[row][i] * bCol[col][j];
  47338. x += coords[pi[q]][0] * m;
  47339. y += coords[pi[q]][1] * m;
  47340. }
  47341. }
  47342. figureCoords[k] = coords.length;
  47343. coords.push([x, y]);
  47344. figureColors[k] = colors.length;
  47345. const newColor = new Uint8Array(3);
  47346. newColor[0] = (cl[0] * (splitXBy - col) + cr[0] * col) / splitXBy | 0;
  47347. newColor[1] = (cl[1] * (splitXBy - col) + cr[1] * col) / splitXBy | 0;
  47348. newColor[2] = (cl[2] * (splitXBy - col) + cr[2] * col) / splitXBy | 0;
  47349. colors.push(newColor);
  47350. }
  47351. }
  47352. figureCoords[0] = pi[0];
  47353. figureColors[0] = ci[0];
  47354. figureCoords[splitXBy] = pi[3];
  47355. figureColors[splitXBy] = ci[1];
  47356. figureCoords[verticesPerRow * splitYBy] = pi[12];
  47357. figureColors[verticesPerRow * splitYBy] = ci[2];
  47358. figureCoords[verticesPerRow * splitYBy + splitXBy] = pi[15];
  47359. figureColors[verticesPerRow * splitYBy + splitXBy] = ci[3];
  47360. this.figures[index] = {
  47361. type: "lattice",
  47362. coords: figureCoords,
  47363. colors: figureColors,
  47364. verticesPerRow
  47365. };
  47366. }
  47367. _updateBounds() {
  47368. let minX = this.coords[0][0],
  47369. minY = this.coords[0][1],
  47370. maxX = minX,
  47371. maxY = minY;
  47372. for (let i = 1, ii = this.coords.length; i < ii; i++) {
  47373. const x = this.coords[i][0],
  47374. y = this.coords[i][1];
  47375. minX = minX > x ? x : minX;
  47376. minY = minY > y ? y : minY;
  47377. maxX = maxX < x ? x : maxX;
  47378. maxY = maxY < y ? y : maxY;
  47379. }
  47380. this.bounds = [minX, minY, maxX, maxY];
  47381. }
  47382. _packData() {
  47383. let i, ii, j, jj;
  47384. const coords = this.coords;
  47385. const coordsPacked = new Float32Array(coords.length * 2);
  47386. for (i = 0, j = 0, ii = coords.length; i < ii; i++) {
  47387. const xy = coords[i];
  47388. coordsPacked[j++] = xy[0];
  47389. coordsPacked[j++] = xy[1];
  47390. }
  47391. this.coords = coordsPacked;
  47392. const colors = this.colors;
  47393. const colorsPacked = new Uint8Array(colors.length * 3);
  47394. for (i = 0, j = 0, ii = colors.length; i < ii; i++) {
  47395. const c = colors[i];
  47396. colorsPacked[j++] = c[0];
  47397. colorsPacked[j++] = c[1];
  47398. colorsPacked[j++] = c[2];
  47399. }
  47400. this.colors = colorsPacked;
  47401. const figures = this.figures;
  47402. for (i = 0, ii = figures.length; i < ii; i++) {
  47403. const figure = figures[i],
  47404. ps = figure.coords,
  47405. cs = figure.colors;
  47406. for (j = 0, jj = ps.length; j < jj; j++) {
  47407. ps[j] *= 2;
  47408. cs[j] *= 3;
  47409. }
  47410. }
  47411. }
  47412. getIR() {
  47413. return ["Mesh", this.shadingType, this.coords, this.colors, this.figures, this.bounds, this.bbox, this.background];
  47414. }
  47415. }
  47416. class DummyShading extends BaseShading {
  47417. getIR() {
  47418. return ["Dummy"];
  47419. }
  47420. }
  47421. function getTilingPatternIR(operatorList, dict, color) {
  47422. const matrix = dict.getArray("Matrix");
  47423. const bbox = _util.Util.normalizeRect(dict.getArray("BBox"));
  47424. const xstep = dict.get("XStep");
  47425. const ystep = dict.get("YStep");
  47426. const paintType = dict.get("PaintType");
  47427. const tilingType = dict.get("TilingType");
  47428. if (bbox[2] - bbox[0] === 0 || bbox[3] - bbox[1] === 0) {
  47429. throw new _util.FormatError(`Invalid getTilingPatternIR /BBox array: [${bbox}].`);
  47430. }
  47431. return ["TilingPattern", color, operatorList, matrix, bbox, xstep, ystep, paintType, tilingType];
  47432. }
  47433. /***/ }),
  47434. /* 180 */
  47435. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  47436. "use strict";
  47437. Object.defineProperty(exports, "__esModule", ({
  47438. value: true
  47439. }));
  47440. exports.getXfaFontDict = getXfaFontDict;
  47441. exports.getXfaFontName = getXfaFontName;
  47442. var _calibri_factors = __w_pdfjs_require__(181);
  47443. var _primitives = __w_pdfjs_require__(134);
  47444. var _helvetica_factors = __w_pdfjs_require__(182);
  47445. var _liberationsans_widths = __w_pdfjs_require__(183);
  47446. var _myriadpro_factors = __w_pdfjs_require__(184);
  47447. var _segoeui_factors = __w_pdfjs_require__(185);
  47448. var _core_utils = __w_pdfjs_require__(135);
  47449. var _fonts_utils = __w_pdfjs_require__(167);
  47450. const getXFAFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  47451. t["MyriadPro-Regular"] = t["PdfJS-Fallback-Regular"] = {
  47452. name: "LiberationSans-Regular",
  47453. factors: _myriadpro_factors.MyriadProRegularFactors,
  47454. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  47455. baseMapping: _liberationsans_widths.LiberationSansRegularMapping,
  47456. metrics: _myriadpro_factors.MyriadProRegularMetrics
  47457. };
  47458. t["MyriadPro-Bold"] = t["PdfJS-Fallback-Bold"] = {
  47459. name: "LiberationSans-Bold",
  47460. factors: _myriadpro_factors.MyriadProBoldFactors,
  47461. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  47462. baseMapping: _liberationsans_widths.LiberationSansBoldMapping,
  47463. metrics: _myriadpro_factors.MyriadProBoldMetrics
  47464. };
  47465. t["MyriadPro-It"] = t["MyriadPro-Italic"] = t["PdfJS-Fallback-Italic"] = {
  47466. name: "LiberationSans-Italic",
  47467. factors: _myriadpro_factors.MyriadProItalicFactors,
  47468. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  47469. baseMapping: _liberationsans_widths.LiberationSansItalicMapping,
  47470. metrics: _myriadpro_factors.MyriadProItalicMetrics
  47471. };
  47472. t["MyriadPro-BoldIt"] = t["MyriadPro-BoldItalic"] = t["PdfJS-Fallback-BoldItalic"] = {
  47473. name: "LiberationSans-BoldItalic",
  47474. factors: _myriadpro_factors.MyriadProBoldItalicFactors,
  47475. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  47476. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping,
  47477. metrics: _myriadpro_factors.MyriadProBoldItalicMetrics
  47478. };
  47479. t.ArialMT = t.Arial = t["Arial-Regular"] = {
  47480. name: "LiberationSans-Regular",
  47481. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  47482. baseMapping: _liberationsans_widths.LiberationSansRegularMapping
  47483. };
  47484. t["Arial-BoldMT"] = t["Arial-Bold"] = {
  47485. name: "LiberationSans-Bold",
  47486. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  47487. baseMapping: _liberationsans_widths.LiberationSansBoldMapping
  47488. };
  47489. t["Arial-ItalicMT"] = t["Arial-Italic"] = {
  47490. name: "LiberationSans-Italic",
  47491. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  47492. baseMapping: _liberationsans_widths.LiberationSansItalicMapping
  47493. };
  47494. t["Arial-BoldItalicMT"] = t["Arial-BoldItalic"] = {
  47495. name: "LiberationSans-BoldItalic",
  47496. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  47497. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping
  47498. };
  47499. t["Calibri-Regular"] = {
  47500. name: "LiberationSans-Regular",
  47501. factors: _calibri_factors.CalibriRegularFactors,
  47502. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  47503. baseMapping: _liberationsans_widths.LiberationSansRegularMapping,
  47504. metrics: _calibri_factors.CalibriRegularMetrics
  47505. };
  47506. t["Calibri-Bold"] = {
  47507. name: "LiberationSans-Bold",
  47508. factors: _calibri_factors.CalibriBoldFactors,
  47509. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  47510. baseMapping: _liberationsans_widths.LiberationSansBoldMapping,
  47511. metrics: _calibri_factors.CalibriBoldMetrics
  47512. };
  47513. t["Calibri-Italic"] = {
  47514. name: "LiberationSans-Italic",
  47515. factors: _calibri_factors.CalibriItalicFactors,
  47516. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  47517. baseMapping: _liberationsans_widths.LiberationSansItalicMapping,
  47518. metrics: _calibri_factors.CalibriItalicMetrics
  47519. };
  47520. t["Calibri-BoldItalic"] = {
  47521. name: "LiberationSans-BoldItalic",
  47522. factors: _calibri_factors.CalibriBoldItalicFactors,
  47523. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  47524. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping,
  47525. metrics: _calibri_factors.CalibriBoldItalicMetrics
  47526. };
  47527. t["Segoeui-Regular"] = {
  47528. name: "LiberationSans-Regular",
  47529. factors: _segoeui_factors.SegoeuiRegularFactors,
  47530. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  47531. baseMapping: _liberationsans_widths.LiberationSansRegularMapping,
  47532. metrics: _segoeui_factors.SegoeuiRegularMetrics
  47533. };
  47534. t["Segoeui-Bold"] = {
  47535. name: "LiberationSans-Bold",
  47536. factors: _segoeui_factors.SegoeuiBoldFactors,
  47537. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  47538. baseMapping: _liberationsans_widths.LiberationSansBoldMapping,
  47539. metrics: _segoeui_factors.SegoeuiBoldMetrics
  47540. };
  47541. t["Segoeui-Italic"] = {
  47542. name: "LiberationSans-Italic",
  47543. factors: _segoeui_factors.SegoeuiItalicFactors,
  47544. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  47545. baseMapping: _liberationsans_widths.LiberationSansItalicMapping,
  47546. metrics: _segoeui_factors.SegoeuiItalicMetrics
  47547. };
  47548. t["Segoeui-BoldItalic"] = {
  47549. name: "LiberationSans-BoldItalic",
  47550. factors: _segoeui_factors.SegoeuiBoldItalicFactors,
  47551. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  47552. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping,
  47553. metrics: _segoeui_factors.SegoeuiBoldItalicMetrics
  47554. };
  47555. t["Helvetica-Regular"] = t.Helvetica = {
  47556. name: "LiberationSans-Regular",
  47557. factors: _helvetica_factors.HelveticaRegularFactors,
  47558. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  47559. baseMapping: _liberationsans_widths.LiberationSansRegularMapping,
  47560. metrics: _helvetica_factors.HelveticaRegularMetrics
  47561. };
  47562. t["Helvetica-Bold"] = {
  47563. name: "LiberationSans-Bold",
  47564. factors: _helvetica_factors.HelveticaBoldFactors,
  47565. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  47566. baseMapping: _liberationsans_widths.LiberationSansBoldMapping,
  47567. metrics: _helvetica_factors.HelveticaBoldMetrics
  47568. };
  47569. t["Helvetica-Italic"] = {
  47570. name: "LiberationSans-Italic",
  47571. factors: _helvetica_factors.HelveticaItalicFactors,
  47572. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  47573. baseMapping: _liberationsans_widths.LiberationSansItalicMapping,
  47574. metrics: _helvetica_factors.HelveticaItalicMetrics
  47575. };
  47576. t["Helvetica-BoldItalic"] = {
  47577. name: "LiberationSans-BoldItalic",
  47578. factors: _helvetica_factors.HelveticaBoldItalicFactors,
  47579. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  47580. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping,
  47581. metrics: _helvetica_factors.HelveticaBoldItalicMetrics
  47582. };
  47583. });
  47584. function getXfaFontName(name) {
  47585. const fontName = (0, _fonts_utils.normalizeFontName)(name);
  47586. const fontMap = getXFAFontMap();
  47587. return fontMap[fontName];
  47588. }
  47589. function getXfaFontWidths(name) {
  47590. const info = getXfaFontName(name);
  47591. if (!info) {
  47592. return null;
  47593. }
  47594. const {
  47595. baseWidths,
  47596. baseMapping,
  47597. factors
  47598. } = info;
  47599. let rescaledBaseWidths;
  47600. if (!factors) {
  47601. rescaledBaseWidths = baseWidths;
  47602. } else {
  47603. rescaledBaseWidths = baseWidths.map((w, i) => w * factors[i]);
  47604. }
  47605. let currentCode = -2;
  47606. let currentArray;
  47607. const newWidths = [];
  47608. for (const [unicode, glyphIndex] of baseMapping.map((charUnicode, index) => [charUnicode, index]).sort((_ref, _ref2) => {
  47609. let [unicode1] = _ref;
  47610. let [unicode2] = _ref2;
  47611. return unicode1 - unicode2;
  47612. })) {
  47613. if (unicode === -1) {
  47614. continue;
  47615. }
  47616. if (unicode === currentCode + 1) {
  47617. currentArray.push(rescaledBaseWidths[glyphIndex]);
  47618. currentCode += 1;
  47619. } else {
  47620. currentCode = unicode;
  47621. currentArray = [rescaledBaseWidths[glyphIndex]];
  47622. newWidths.push(unicode, currentArray);
  47623. }
  47624. }
  47625. return newWidths;
  47626. }
  47627. function getXfaFontDict(name) {
  47628. const widths = getXfaFontWidths(name);
  47629. const dict = new _primitives.Dict(null);
  47630. dict.set("BaseFont", _primitives.Name.get(name));
  47631. dict.set("Type", _primitives.Name.get("Font"));
  47632. dict.set("Subtype", _primitives.Name.get("CIDFontType2"));
  47633. dict.set("Encoding", _primitives.Name.get("Identity-H"));
  47634. dict.set("CIDToGIDMap", _primitives.Name.get("Identity"));
  47635. dict.set("W", widths);
  47636. dict.set("FirstChar", widths[0]);
  47637. dict.set("LastChar", widths.at(-2) + widths.at(-1).length - 1);
  47638. const descriptor = new _primitives.Dict(null);
  47639. dict.set("FontDescriptor", descriptor);
  47640. const systemInfo = new _primitives.Dict(null);
  47641. systemInfo.set("Ordering", "Identity");
  47642. systemInfo.set("Registry", "Adobe");
  47643. systemInfo.set("Supplement", 0);
  47644. dict.set("CIDSystemInfo", systemInfo);
  47645. return dict;
  47646. }
  47647. /***/ }),
  47648. /* 181 */
  47649. /***/ ((__unused_webpack_module, exports) => {
  47650. "use strict";
  47651. Object.defineProperty(exports, "__esModule", ({
  47652. value: true
  47653. }));
  47654. exports.CalibriRegularMetrics = exports.CalibriRegularFactors = exports.CalibriItalicMetrics = exports.CalibriItalicFactors = exports.CalibriBoldMetrics = exports.CalibriBoldItalicMetrics = exports.CalibriBoldItalicFactors = exports.CalibriBoldFactors = void 0;
  47655. 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];
  47656. exports.CalibriBoldFactors = CalibriBoldFactors;
  47657. const CalibriBoldMetrics = {
  47658. lineHeight: 1.2207,
  47659. lineGap: 0.2207
  47660. };
  47661. exports.CalibriBoldMetrics = CalibriBoldMetrics;
  47662. 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];
  47663. exports.CalibriBoldItalicFactors = CalibriBoldItalicFactors;
  47664. const CalibriBoldItalicMetrics = {
  47665. lineHeight: 1.2207,
  47666. lineGap: 0.2207
  47667. };
  47668. exports.CalibriBoldItalicMetrics = CalibriBoldItalicMetrics;
  47669. 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];
  47670. exports.CalibriItalicFactors = CalibriItalicFactors;
  47671. const CalibriItalicMetrics = {
  47672. lineHeight: 1.2207,
  47673. lineGap: 0.2207
  47674. };
  47675. exports.CalibriItalicMetrics = CalibriItalicMetrics;
  47676. 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];
  47677. exports.CalibriRegularFactors = CalibriRegularFactors;
  47678. const CalibriRegularMetrics = {
  47679. lineHeight: 1.2207,
  47680. lineGap: 0.2207
  47681. };
  47682. exports.CalibriRegularMetrics = CalibriRegularMetrics;
  47683. /***/ }),
  47684. /* 182 */
  47685. /***/ ((__unused_webpack_module, exports) => {
  47686. "use strict";
  47687. Object.defineProperty(exports, "__esModule", ({
  47688. value: true
  47689. }));
  47690. exports.HelveticaRegularMetrics = exports.HelveticaRegularFactors = exports.HelveticaItalicMetrics = exports.HelveticaItalicFactors = exports.HelveticaBoldMetrics = exports.HelveticaBoldItalicMetrics = exports.HelveticaBoldItalicFactors = exports.HelveticaBoldFactors = void 0;
  47691. 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];
  47692. exports.HelveticaBoldFactors = HelveticaBoldFactors;
  47693. const HelveticaBoldMetrics = {
  47694. lineHeight: 1.2,
  47695. lineGap: 0.2
  47696. };
  47697. exports.HelveticaBoldMetrics = HelveticaBoldMetrics;
  47698. 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];
  47699. exports.HelveticaBoldItalicFactors = HelveticaBoldItalicFactors;
  47700. const HelveticaBoldItalicMetrics = {
  47701. lineHeight: 1.35,
  47702. lineGap: 0.2
  47703. };
  47704. exports.HelveticaBoldItalicMetrics = HelveticaBoldItalicMetrics;
  47705. 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];
  47706. exports.HelveticaItalicFactors = HelveticaItalicFactors;
  47707. const HelveticaItalicMetrics = {
  47708. lineHeight: 1.35,
  47709. lineGap: 0.2
  47710. };
  47711. exports.HelveticaItalicMetrics = HelveticaItalicMetrics;
  47712. 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];
  47713. exports.HelveticaRegularFactors = HelveticaRegularFactors;
  47714. const HelveticaRegularMetrics = {
  47715. lineHeight: 1.2,
  47716. lineGap: 0.2
  47717. };
  47718. exports.HelveticaRegularMetrics = HelveticaRegularMetrics;
  47719. /***/ }),
  47720. /* 183 */
  47721. /***/ ((__unused_webpack_module, exports) => {
  47722. "use strict";
  47723. Object.defineProperty(exports, "__esModule", ({
  47724. value: true
  47725. }));
  47726. exports.LiberationSansRegularWidths = exports.LiberationSansRegularMapping = exports.LiberationSansItalicWidths = exports.LiberationSansItalicMapping = exports.LiberationSansBoldWidths = exports.LiberationSansBoldMapping = exports.LiberationSansBoldItalicWidths = exports.LiberationSansBoldItalicMapping = void 0;
  47727. 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];
  47728. exports.LiberationSansBoldWidths = LiberationSansBoldWidths;
  47729. 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];
  47730. exports.LiberationSansBoldMapping = LiberationSansBoldMapping;
  47731. 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];
  47732. exports.LiberationSansBoldItalicWidths = LiberationSansBoldItalicWidths;
  47733. 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];
  47734. exports.LiberationSansBoldItalicMapping = LiberationSansBoldItalicMapping;
  47735. 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];
  47736. exports.LiberationSansItalicWidths = LiberationSansItalicWidths;
  47737. 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];
  47738. exports.LiberationSansItalicMapping = LiberationSansItalicMapping;
  47739. 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];
  47740. exports.LiberationSansRegularWidths = LiberationSansRegularWidths;
  47741. 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];
  47742. exports.LiberationSansRegularMapping = LiberationSansRegularMapping;
  47743. /***/ }),
  47744. /* 184 */
  47745. /***/ ((__unused_webpack_module, exports) => {
  47746. "use strict";
  47747. Object.defineProperty(exports, "__esModule", ({
  47748. value: true
  47749. }));
  47750. exports.MyriadProRegularMetrics = exports.MyriadProRegularFactors = exports.MyriadProItalicMetrics = exports.MyriadProItalicFactors = exports.MyriadProBoldMetrics = exports.MyriadProBoldItalicMetrics = exports.MyriadProBoldItalicFactors = exports.MyriadProBoldFactors = void 0;
  47751. 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];
  47752. exports.MyriadProBoldFactors = MyriadProBoldFactors;
  47753. const MyriadProBoldMetrics = {
  47754. lineHeight: 1.2,
  47755. lineGap: 0.2
  47756. };
  47757. exports.MyriadProBoldMetrics = MyriadProBoldMetrics;
  47758. 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];
  47759. exports.MyriadProBoldItalicFactors = MyriadProBoldItalicFactors;
  47760. const MyriadProBoldItalicMetrics = {
  47761. lineHeight: 1.2,
  47762. lineGap: 0.2
  47763. };
  47764. exports.MyriadProBoldItalicMetrics = MyriadProBoldItalicMetrics;
  47765. 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];
  47766. exports.MyriadProItalicFactors = MyriadProItalicFactors;
  47767. const MyriadProItalicMetrics = {
  47768. lineHeight: 1.2,
  47769. lineGap: 0.2
  47770. };
  47771. exports.MyriadProItalicMetrics = MyriadProItalicMetrics;
  47772. 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];
  47773. exports.MyriadProRegularFactors = MyriadProRegularFactors;
  47774. const MyriadProRegularMetrics = {
  47775. lineHeight: 1.2,
  47776. lineGap: 0.2
  47777. };
  47778. exports.MyriadProRegularMetrics = MyriadProRegularMetrics;
  47779. /***/ }),
  47780. /* 185 */
  47781. /***/ ((__unused_webpack_module, exports) => {
  47782. "use strict";
  47783. Object.defineProperty(exports, "__esModule", ({
  47784. value: true
  47785. }));
  47786. exports.SegoeuiRegularMetrics = exports.SegoeuiRegularFactors = exports.SegoeuiItalicMetrics = exports.SegoeuiItalicFactors = exports.SegoeuiBoldMetrics = exports.SegoeuiBoldItalicMetrics = exports.SegoeuiBoldItalicFactors = exports.SegoeuiBoldFactors = void 0;
  47787. 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];
  47788. exports.SegoeuiBoldFactors = SegoeuiBoldFactors;
  47789. const SegoeuiBoldMetrics = {
  47790. lineHeight: 1.33008,
  47791. lineGap: 0
  47792. };
  47793. exports.SegoeuiBoldMetrics = SegoeuiBoldMetrics;
  47794. 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];
  47795. exports.SegoeuiBoldItalicFactors = SegoeuiBoldItalicFactors;
  47796. const SegoeuiBoldItalicMetrics = {
  47797. lineHeight: 1.33008,
  47798. lineGap: 0
  47799. };
  47800. exports.SegoeuiBoldItalicMetrics = SegoeuiBoldItalicMetrics;
  47801. 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];
  47802. exports.SegoeuiItalicFactors = SegoeuiItalicFactors;
  47803. const SegoeuiItalicMetrics = {
  47804. lineHeight: 1.33008,
  47805. lineGap: 0
  47806. };
  47807. exports.SegoeuiItalicMetrics = SegoeuiItalicMetrics;
  47808. 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];
  47809. exports.SegoeuiRegularFactors = SegoeuiRegularFactors;
  47810. const SegoeuiRegularMetrics = {
  47811. lineHeight: 1.33008,
  47812. lineGap: 0
  47813. };
  47814. exports.SegoeuiRegularMetrics = SegoeuiRegularMetrics;
  47815. /***/ }),
  47816. /* 186 */
  47817. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  47818. "use strict";
  47819. Object.defineProperty(exports, "__esModule", ({
  47820. value: true
  47821. }));
  47822. exports.PostScriptEvaluator = exports.PostScriptCompiler = exports.PDFFunctionFactory = void 0;
  47823. exports.isPDFFunction = isPDFFunction;
  47824. var _primitives = __w_pdfjs_require__(134);
  47825. var _util = __w_pdfjs_require__(2);
  47826. var _ps_parser = __w_pdfjs_require__(187);
  47827. var _base_stream = __w_pdfjs_require__(136);
  47828. var _image_utils = __w_pdfjs_require__(188);
  47829. class PDFFunctionFactory {
  47830. constructor(_ref) {
  47831. let {
  47832. xref,
  47833. isEvalSupported = true
  47834. } = _ref;
  47835. this.xref = xref;
  47836. this.isEvalSupported = isEvalSupported !== false;
  47837. }
  47838. create(fn) {
  47839. const cachedFunction = this.getCached(fn);
  47840. if (cachedFunction) {
  47841. return cachedFunction;
  47842. }
  47843. const parsedFunction = PDFFunction.parse({
  47844. xref: this.xref,
  47845. isEvalSupported: this.isEvalSupported,
  47846. fn: fn instanceof _primitives.Ref ? this.xref.fetch(fn) : fn
  47847. });
  47848. this._cache(fn, parsedFunction);
  47849. return parsedFunction;
  47850. }
  47851. createFromArray(fnObj) {
  47852. const cachedFunction = this.getCached(fnObj);
  47853. if (cachedFunction) {
  47854. return cachedFunction;
  47855. }
  47856. const parsedFunction = PDFFunction.parseArray({
  47857. xref: this.xref,
  47858. isEvalSupported: this.isEvalSupported,
  47859. fnObj: fnObj instanceof _primitives.Ref ? this.xref.fetch(fnObj) : fnObj
  47860. });
  47861. this._cache(fnObj, parsedFunction);
  47862. return parsedFunction;
  47863. }
  47864. getCached(cacheKey) {
  47865. let fnRef;
  47866. if (cacheKey instanceof _primitives.Ref) {
  47867. fnRef = cacheKey;
  47868. } else if (cacheKey instanceof _primitives.Dict) {
  47869. fnRef = cacheKey.objId;
  47870. } else if (cacheKey instanceof _base_stream.BaseStream) {
  47871. fnRef = cacheKey.dict && cacheKey.dict.objId;
  47872. }
  47873. if (fnRef) {
  47874. const localFunction = this._localFunctionCache.getByRef(fnRef);
  47875. if (localFunction) {
  47876. return localFunction;
  47877. }
  47878. }
  47879. return null;
  47880. }
  47881. _cache(cacheKey, parsedFunction) {
  47882. if (!parsedFunction) {
  47883. throw new Error('PDFFunctionFactory._cache - expected "parsedFunction" argument.');
  47884. }
  47885. let fnRef;
  47886. if (cacheKey instanceof _primitives.Ref) {
  47887. fnRef = cacheKey;
  47888. } else if (cacheKey instanceof _primitives.Dict) {
  47889. fnRef = cacheKey.objId;
  47890. } else if (cacheKey instanceof _base_stream.BaseStream) {
  47891. fnRef = cacheKey.dict && cacheKey.dict.objId;
  47892. }
  47893. if (fnRef) {
  47894. this._localFunctionCache.set(null, fnRef, parsedFunction);
  47895. }
  47896. }
  47897. get _localFunctionCache() {
  47898. return (0, _util.shadow)(this, "_localFunctionCache", new _image_utils.LocalFunctionCache());
  47899. }
  47900. }
  47901. exports.PDFFunctionFactory = PDFFunctionFactory;
  47902. function toNumberArray(arr) {
  47903. if (!Array.isArray(arr)) {
  47904. return null;
  47905. }
  47906. const length = arr.length;
  47907. for (let i = 0; i < length; i++) {
  47908. if (typeof arr[i] !== "number") {
  47909. const result = new Array(length);
  47910. for (let j = 0; j < length; j++) {
  47911. result[j] = +arr[j];
  47912. }
  47913. return result;
  47914. }
  47915. }
  47916. return arr;
  47917. }
  47918. class PDFFunction {
  47919. static getSampleArray(size, outputSize, bps, stream) {
  47920. let i, ii;
  47921. let length = 1;
  47922. for (i = 0, ii = size.length; i < ii; i++) {
  47923. length *= size[i];
  47924. }
  47925. length *= outputSize;
  47926. const array = new Array(length);
  47927. let codeSize = 0;
  47928. let codeBuf = 0;
  47929. const sampleMul = 1.0 / (2.0 ** bps - 1);
  47930. const strBytes = stream.getBytes((length * bps + 7) / 8);
  47931. let strIdx = 0;
  47932. for (i = 0; i < length; i++) {
  47933. while (codeSize < bps) {
  47934. codeBuf <<= 8;
  47935. codeBuf |= strBytes[strIdx++];
  47936. codeSize += 8;
  47937. }
  47938. codeSize -= bps;
  47939. array[i] = (codeBuf >> codeSize) * sampleMul;
  47940. codeBuf &= (1 << codeSize) - 1;
  47941. }
  47942. return array;
  47943. }
  47944. static parse(_ref2) {
  47945. let {
  47946. xref,
  47947. isEvalSupported,
  47948. fn
  47949. } = _ref2;
  47950. const dict = fn.dict || fn;
  47951. const typeNum = dict.get("FunctionType");
  47952. switch (typeNum) {
  47953. case 0:
  47954. return this.constructSampled({
  47955. xref,
  47956. isEvalSupported,
  47957. fn,
  47958. dict
  47959. });
  47960. case 1:
  47961. break;
  47962. case 2:
  47963. return this.constructInterpolated({
  47964. xref,
  47965. isEvalSupported,
  47966. dict
  47967. });
  47968. case 3:
  47969. return this.constructStiched({
  47970. xref,
  47971. isEvalSupported,
  47972. dict
  47973. });
  47974. case 4:
  47975. return this.constructPostScript({
  47976. xref,
  47977. isEvalSupported,
  47978. fn,
  47979. dict
  47980. });
  47981. }
  47982. throw new _util.FormatError("Unknown type of function");
  47983. }
  47984. static parseArray(_ref3) {
  47985. let {
  47986. xref,
  47987. isEvalSupported,
  47988. fnObj
  47989. } = _ref3;
  47990. if (!Array.isArray(fnObj)) {
  47991. return this.parse({
  47992. xref,
  47993. isEvalSupported,
  47994. fn: fnObj
  47995. });
  47996. }
  47997. const fnArray = [];
  47998. for (const fn of fnObj) {
  47999. fnArray.push(this.parse({
  48000. xref,
  48001. isEvalSupported,
  48002. fn: xref.fetchIfRef(fn)
  48003. }));
  48004. }
  48005. return function (src, srcOffset, dest, destOffset) {
  48006. for (let i = 0, ii = fnArray.length; i < ii; i++) {
  48007. fnArray[i](src, srcOffset, dest, destOffset + i);
  48008. }
  48009. };
  48010. }
  48011. static constructSampled(_ref4) {
  48012. let {
  48013. xref,
  48014. isEvalSupported,
  48015. fn,
  48016. dict
  48017. } = _ref4;
  48018. function toMultiArray(arr) {
  48019. const inputLength = arr.length;
  48020. const out = [];
  48021. let index = 0;
  48022. for (let i = 0; i < inputLength; i += 2) {
  48023. out[index++] = [arr[i], arr[i + 1]];
  48024. }
  48025. return out;
  48026. }
  48027. function interpolate(x, xmin, xmax, ymin, ymax) {
  48028. return ymin + (x - xmin) * ((ymax - ymin) / (xmax - xmin));
  48029. }
  48030. let domain = toNumberArray(dict.getArray("Domain"));
  48031. let range = toNumberArray(dict.getArray("Range"));
  48032. if (!domain || !range) {
  48033. throw new _util.FormatError("No domain or range");
  48034. }
  48035. const inputSize = domain.length / 2;
  48036. const outputSize = range.length / 2;
  48037. domain = toMultiArray(domain);
  48038. range = toMultiArray(range);
  48039. const size = toNumberArray(dict.getArray("Size"));
  48040. const bps = dict.get("BitsPerSample");
  48041. const order = dict.get("Order") || 1;
  48042. if (order !== 1) {
  48043. (0, _util.info)("No support for cubic spline interpolation: " + order);
  48044. }
  48045. let encode = toNumberArray(dict.getArray("Encode"));
  48046. if (!encode) {
  48047. encode = [];
  48048. for (let i = 0; i < inputSize; ++i) {
  48049. encode.push([0, size[i] - 1]);
  48050. }
  48051. } else {
  48052. encode = toMultiArray(encode);
  48053. }
  48054. let decode = toNumberArray(dict.getArray("Decode"));
  48055. if (!decode) {
  48056. decode = range;
  48057. } else {
  48058. decode = toMultiArray(decode);
  48059. }
  48060. const samples = this.getSampleArray(size, outputSize, bps, fn);
  48061. return function constructSampledFn(src, srcOffset, dest, destOffset) {
  48062. const cubeVertices = 1 << inputSize;
  48063. const cubeN = new Float64Array(cubeVertices);
  48064. const cubeVertex = new Uint32Array(cubeVertices);
  48065. let i, j;
  48066. for (j = 0; j < cubeVertices; j++) {
  48067. cubeN[j] = 1;
  48068. }
  48069. let k = outputSize,
  48070. pos = 1;
  48071. for (i = 0; i < inputSize; ++i) {
  48072. const domain_2i = domain[i][0];
  48073. const domain_2i_1 = domain[i][1];
  48074. const xi = Math.min(Math.max(src[srcOffset + i], domain_2i), domain_2i_1);
  48075. let e = interpolate(xi, domain_2i, domain_2i_1, encode[i][0], encode[i][1]);
  48076. const size_i = size[i];
  48077. e = Math.min(Math.max(e, 0), size_i - 1);
  48078. const e0 = e < size_i - 1 ? Math.floor(e) : e - 1;
  48079. const n0 = e0 + 1 - e;
  48080. const n1 = e - e0;
  48081. const offset0 = e0 * k;
  48082. const offset1 = offset0 + k;
  48083. for (j = 0; j < cubeVertices; j++) {
  48084. if (j & pos) {
  48085. cubeN[j] *= n1;
  48086. cubeVertex[j] += offset1;
  48087. } else {
  48088. cubeN[j] *= n0;
  48089. cubeVertex[j] += offset0;
  48090. }
  48091. }
  48092. k *= size_i;
  48093. pos <<= 1;
  48094. }
  48095. for (j = 0; j < outputSize; ++j) {
  48096. let rj = 0;
  48097. for (i = 0; i < cubeVertices; i++) {
  48098. rj += samples[cubeVertex[i] + j] * cubeN[i];
  48099. }
  48100. rj = interpolate(rj, 0, 1, decode[j][0], decode[j][1]);
  48101. dest[destOffset + j] = Math.min(Math.max(rj, range[j][0]), range[j][1]);
  48102. }
  48103. };
  48104. }
  48105. static constructInterpolated(_ref5) {
  48106. let {
  48107. xref,
  48108. isEvalSupported,
  48109. dict
  48110. } = _ref5;
  48111. const c0 = toNumberArray(dict.getArray("C0")) || [0];
  48112. const c1 = toNumberArray(dict.getArray("C1")) || [1];
  48113. const n = dict.get("N");
  48114. const diff = [];
  48115. for (let i = 0, ii = c0.length; i < ii; ++i) {
  48116. diff.push(c1[i] - c0[i]);
  48117. }
  48118. const length = diff.length;
  48119. return function constructInterpolatedFn(src, srcOffset, dest, destOffset) {
  48120. const x = n === 1 ? src[srcOffset] : src[srcOffset] ** n;
  48121. for (let j = 0; j < length; ++j) {
  48122. dest[destOffset + j] = c0[j] + x * diff[j];
  48123. }
  48124. };
  48125. }
  48126. static constructStiched(_ref6) {
  48127. let {
  48128. xref,
  48129. isEvalSupported,
  48130. dict
  48131. } = _ref6;
  48132. const domain = toNumberArray(dict.getArray("Domain"));
  48133. if (!domain) {
  48134. throw new _util.FormatError("No domain");
  48135. }
  48136. const inputSize = domain.length / 2;
  48137. if (inputSize !== 1) {
  48138. throw new _util.FormatError("Bad domain for stiched function");
  48139. }
  48140. const fns = [];
  48141. for (const fn of dict.get("Functions")) {
  48142. fns.push(this.parse({
  48143. xref,
  48144. isEvalSupported,
  48145. fn: xref.fetchIfRef(fn)
  48146. }));
  48147. }
  48148. const bounds = toNumberArray(dict.getArray("Bounds"));
  48149. const encode = toNumberArray(dict.getArray("Encode"));
  48150. const tmpBuf = new Float32Array(1);
  48151. return function constructStichedFn(src, srcOffset, dest, destOffset) {
  48152. const clip = function constructStichedFromIRClip(v, min, max) {
  48153. if (v > max) {
  48154. v = max;
  48155. } else if (v < min) {
  48156. v = min;
  48157. }
  48158. return v;
  48159. };
  48160. const v = clip(src[srcOffset], domain[0], domain[1]);
  48161. const length = bounds.length;
  48162. let i;
  48163. for (i = 0; i < length; ++i) {
  48164. if (v < bounds[i]) {
  48165. break;
  48166. }
  48167. }
  48168. let dmin = domain[0];
  48169. if (i > 0) {
  48170. dmin = bounds[i - 1];
  48171. }
  48172. let dmax = domain[1];
  48173. if (i < bounds.length) {
  48174. dmax = bounds[i];
  48175. }
  48176. const rmin = encode[2 * i];
  48177. const rmax = encode[2 * i + 1];
  48178. tmpBuf[0] = dmin === dmax ? rmin : rmin + (v - dmin) * (rmax - rmin) / (dmax - dmin);
  48179. fns[i](tmpBuf, 0, dest, destOffset);
  48180. };
  48181. }
  48182. static constructPostScript(_ref7) {
  48183. let {
  48184. xref,
  48185. isEvalSupported,
  48186. fn,
  48187. dict
  48188. } = _ref7;
  48189. const domain = toNumberArray(dict.getArray("Domain"));
  48190. const range = toNumberArray(dict.getArray("Range"));
  48191. if (!domain) {
  48192. throw new _util.FormatError("No domain.");
  48193. }
  48194. if (!range) {
  48195. throw new _util.FormatError("No range.");
  48196. }
  48197. const lexer = new _ps_parser.PostScriptLexer(fn);
  48198. const parser = new _ps_parser.PostScriptParser(lexer);
  48199. const code = parser.parse();
  48200. if (isEvalSupported && _util.FeatureTest.isEvalSupported) {
  48201. const compiled = new PostScriptCompiler().compile(code, domain, range);
  48202. if (compiled) {
  48203. return new Function("src", "srcOffset", "dest", "destOffset", compiled);
  48204. }
  48205. }
  48206. (0, _util.info)("Unable to compile PS function");
  48207. const numOutputs = range.length >> 1;
  48208. const numInputs = domain.length >> 1;
  48209. const evaluator = new PostScriptEvaluator(code);
  48210. const cache = Object.create(null);
  48211. const MAX_CACHE_SIZE = 2048 * 4;
  48212. let cache_available = MAX_CACHE_SIZE;
  48213. const tmpBuf = new Float32Array(numInputs);
  48214. return function constructPostScriptFn(src, srcOffset, dest, destOffset) {
  48215. let i, value;
  48216. let key = "";
  48217. const input = tmpBuf;
  48218. for (i = 0; i < numInputs; i++) {
  48219. value = src[srcOffset + i];
  48220. input[i] = value;
  48221. key += value + "_";
  48222. }
  48223. const cachedValue = cache[key];
  48224. if (cachedValue !== undefined) {
  48225. dest.set(cachedValue, destOffset);
  48226. return;
  48227. }
  48228. const output = new Float32Array(numOutputs);
  48229. const stack = evaluator.execute(input);
  48230. const stackIndex = stack.length - numOutputs;
  48231. for (i = 0; i < numOutputs; i++) {
  48232. value = stack[stackIndex + i];
  48233. let bound = range[i * 2];
  48234. if (value < bound) {
  48235. value = bound;
  48236. } else {
  48237. bound = range[i * 2 + 1];
  48238. if (value > bound) {
  48239. value = bound;
  48240. }
  48241. }
  48242. output[i] = value;
  48243. }
  48244. if (cache_available > 0) {
  48245. cache_available--;
  48246. cache[key] = output;
  48247. }
  48248. dest.set(output, destOffset);
  48249. };
  48250. }
  48251. }
  48252. function isPDFFunction(v) {
  48253. let fnDict;
  48254. if (typeof v !== "object") {
  48255. return false;
  48256. } else if (v instanceof _primitives.Dict) {
  48257. fnDict = v;
  48258. } else if (v instanceof _base_stream.BaseStream) {
  48259. fnDict = v.dict;
  48260. } else {
  48261. return false;
  48262. }
  48263. return fnDict.has("FunctionType");
  48264. }
  48265. class PostScriptStack {
  48266. static get MAX_STACK_SIZE() {
  48267. return (0, _util.shadow)(this, "MAX_STACK_SIZE", 100);
  48268. }
  48269. constructor(initialStack) {
  48270. this.stack = initialStack ? Array.from(initialStack) : [];
  48271. }
  48272. push(value) {
  48273. if (this.stack.length >= PostScriptStack.MAX_STACK_SIZE) {
  48274. throw new Error("PostScript function stack overflow.");
  48275. }
  48276. this.stack.push(value);
  48277. }
  48278. pop() {
  48279. if (this.stack.length <= 0) {
  48280. throw new Error("PostScript function stack underflow.");
  48281. }
  48282. return this.stack.pop();
  48283. }
  48284. copy(n) {
  48285. if (this.stack.length + n >= PostScriptStack.MAX_STACK_SIZE) {
  48286. throw new Error("PostScript function stack overflow.");
  48287. }
  48288. const stack = this.stack;
  48289. for (let i = stack.length - n, j = n - 1; j >= 0; j--, i++) {
  48290. stack.push(stack[i]);
  48291. }
  48292. }
  48293. index(n) {
  48294. this.push(this.stack[this.stack.length - n - 1]);
  48295. }
  48296. roll(n, p) {
  48297. const stack = this.stack;
  48298. const l = stack.length - n;
  48299. const r = stack.length - 1;
  48300. const c = l + (p - Math.floor(p / n) * n);
  48301. for (let i = l, j = r; i < j; i++, j--) {
  48302. const t = stack[i];
  48303. stack[i] = stack[j];
  48304. stack[j] = t;
  48305. }
  48306. for (let i = l, j = c - 1; i < j; i++, j--) {
  48307. const t = stack[i];
  48308. stack[i] = stack[j];
  48309. stack[j] = t;
  48310. }
  48311. for (let i = c, j = r; i < j; i++, j--) {
  48312. const t = stack[i];
  48313. stack[i] = stack[j];
  48314. stack[j] = t;
  48315. }
  48316. }
  48317. }
  48318. class PostScriptEvaluator {
  48319. constructor(operators) {
  48320. this.operators = operators;
  48321. }
  48322. execute(initialStack) {
  48323. const stack = new PostScriptStack(initialStack);
  48324. let counter = 0;
  48325. const operators = this.operators;
  48326. const length = operators.length;
  48327. let operator, a, b;
  48328. while (counter < length) {
  48329. operator = operators[counter++];
  48330. if (typeof operator === "number") {
  48331. stack.push(operator);
  48332. continue;
  48333. }
  48334. switch (operator) {
  48335. case "jz":
  48336. b = stack.pop();
  48337. a = stack.pop();
  48338. if (!a) {
  48339. counter = b;
  48340. }
  48341. break;
  48342. case "j":
  48343. a = stack.pop();
  48344. counter = a;
  48345. break;
  48346. case "abs":
  48347. a = stack.pop();
  48348. stack.push(Math.abs(a));
  48349. break;
  48350. case "add":
  48351. b = stack.pop();
  48352. a = stack.pop();
  48353. stack.push(a + b);
  48354. break;
  48355. case "and":
  48356. b = stack.pop();
  48357. a = stack.pop();
  48358. if (typeof a === "boolean" && typeof b === "boolean") {
  48359. stack.push(a && b);
  48360. } else {
  48361. stack.push(a & b);
  48362. }
  48363. break;
  48364. case "atan":
  48365. a = stack.pop();
  48366. stack.push(Math.atan(a));
  48367. break;
  48368. case "bitshift":
  48369. b = stack.pop();
  48370. a = stack.pop();
  48371. if (a > 0) {
  48372. stack.push(a << b);
  48373. } else {
  48374. stack.push(a >> b);
  48375. }
  48376. break;
  48377. case "ceiling":
  48378. a = stack.pop();
  48379. stack.push(Math.ceil(a));
  48380. break;
  48381. case "copy":
  48382. a = stack.pop();
  48383. stack.copy(a);
  48384. break;
  48385. case "cos":
  48386. a = stack.pop();
  48387. stack.push(Math.cos(a));
  48388. break;
  48389. case "cvi":
  48390. a = stack.pop() | 0;
  48391. stack.push(a);
  48392. break;
  48393. case "cvr":
  48394. break;
  48395. case "div":
  48396. b = stack.pop();
  48397. a = stack.pop();
  48398. stack.push(a / b);
  48399. break;
  48400. case "dup":
  48401. stack.copy(1);
  48402. break;
  48403. case "eq":
  48404. b = stack.pop();
  48405. a = stack.pop();
  48406. stack.push(a === b);
  48407. break;
  48408. case "exch":
  48409. stack.roll(2, 1);
  48410. break;
  48411. case "exp":
  48412. b = stack.pop();
  48413. a = stack.pop();
  48414. stack.push(a ** b);
  48415. break;
  48416. case "false":
  48417. stack.push(false);
  48418. break;
  48419. case "floor":
  48420. a = stack.pop();
  48421. stack.push(Math.floor(a));
  48422. break;
  48423. case "ge":
  48424. b = stack.pop();
  48425. a = stack.pop();
  48426. stack.push(a >= b);
  48427. break;
  48428. case "gt":
  48429. b = stack.pop();
  48430. a = stack.pop();
  48431. stack.push(a > b);
  48432. break;
  48433. case "idiv":
  48434. b = stack.pop();
  48435. a = stack.pop();
  48436. stack.push(a / b | 0);
  48437. break;
  48438. case "index":
  48439. a = stack.pop();
  48440. stack.index(a);
  48441. break;
  48442. case "le":
  48443. b = stack.pop();
  48444. a = stack.pop();
  48445. stack.push(a <= b);
  48446. break;
  48447. case "ln":
  48448. a = stack.pop();
  48449. stack.push(Math.log(a));
  48450. break;
  48451. case "log":
  48452. a = stack.pop();
  48453. stack.push(Math.log(a) / Math.LN10);
  48454. break;
  48455. case "lt":
  48456. b = stack.pop();
  48457. a = stack.pop();
  48458. stack.push(a < b);
  48459. break;
  48460. case "mod":
  48461. b = stack.pop();
  48462. a = stack.pop();
  48463. stack.push(a % b);
  48464. break;
  48465. case "mul":
  48466. b = stack.pop();
  48467. a = stack.pop();
  48468. stack.push(a * b);
  48469. break;
  48470. case "ne":
  48471. b = stack.pop();
  48472. a = stack.pop();
  48473. stack.push(a !== b);
  48474. break;
  48475. case "neg":
  48476. a = stack.pop();
  48477. stack.push(-a);
  48478. break;
  48479. case "not":
  48480. a = stack.pop();
  48481. if (typeof a === "boolean") {
  48482. stack.push(!a);
  48483. } else {
  48484. stack.push(~a);
  48485. }
  48486. break;
  48487. case "or":
  48488. b = stack.pop();
  48489. a = stack.pop();
  48490. if (typeof a === "boolean" && typeof b === "boolean") {
  48491. stack.push(a || b);
  48492. } else {
  48493. stack.push(a | b);
  48494. }
  48495. break;
  48496. case "pop":
  48497. stack.pop();
  48498. break;
  48499. case "roll":
  48500. b = stack.pop();
  48501. a = stack.pop();
  48502. stack.roll(a, b);
  48503. break;
  48504. case "round":
  48505. a = stack.pop();
  48506. stack.push(Math.round(a));
  48507. break;
  48508. case "sin":
  48509. a = stack.pop();
  48510. stack.push(Math.sin(a));
  48511. break;
  48512. case "sqrt":
  48513. a = stack.pop();
  48514. stack.push(Math.sqrt(a));
  48515. break;
  48516. case "sub":
  48517. b = stack.pop();
  48518. a = stack.pop();
  48519. stack.push(a - b);
  48520. break;
  48521. case "true":
  48522. stack.push(true);
  48523. break;
  48524. case "truncate":
  48525. a = stack.pop();
  48526. a = a < 0 ? Math.ceil(a) : Math.floor(a);
  48527. stack.push(a);
  48528. break;
  48529. case "xor":
  48530. b = stack.pop();
  48531. a = stack.pop();
  48532. if (typeof a === "boolean" && typeof b === "boolean") {
  48533. stack.push(a !== b);
  48534. } else {
  48535. stack.push(a ^ b);
  48536. }
  48537. break;
  48538. default:
  48539. throw new _util.FormatError(`Unknown operator ${operator}`);
  48540. }
  48541. }
  48542. return stack.stack;
  48543. }
  48544. }
  48545. exports.PostScriptEvaluator = PostScriptEvaluator;
  48546. class AstNode {
  48547. constructor(type) {
  48548. this.type = type;
  48549. }
  48550. visit(visitor) {
  48551. (0, _util.unreachable)("abstract method");
  48552. }
  48553. }
  48554. class AstArgument extends AstNode {
  48555. constructor(index, min, max) {
  48556. super("args");
  48557. this.index = index;
  48558. this.min = min;
  48559. this.max = max;
  48560. }
  48561. visit(visitor) {
  48562. visitor.visitArgument(this);
  48563. }
  48564. }
  48565. class AstLiteral extends AstNode {
  48566. constructor(number) {
  48567. super("literal");
  48568. this.number = number;
  48569. this.min = number;
  48570. this.max = number;
  48571. }
  48572. visit(visitor) {
  48573. visitor.visitLiteral(this);
  48574. }
  48575. }
  48576. class AstBinaryOperation extends AstNode {
  48577. constructor(op, arg1, arg2, min, max) {
  48578. super("binary");
  48579. this.op = op;
  48580. this.arg1 = arg1;
  48581. this.arg2 = arg2;
  48582. this.min = min;
  48583. this.max = max;
  48584. }
  48585. visit(visitor) {
  48586. visitor.visitBinaryOperation(this);
  48587. }
  48588. }
  48589. class AstMin extends AstNode {
  48590. constructor(arg, max) {
  48591. super("max");
  48592. this.arg = arg;
  48593. this.min = arg.min;
  48594. this.max = max;
  48595. }
  48596. visit(visitor) {
  48597. visitor.visitMin(this);
  48598. }
  48599. }
  48600. class AstVariable extends AstNode {
  48601. constructor(index, min, max) {
  48602. super("var");
  48603. this.index = index;
  48604. this.min = min;
  48605. this.max = max;
  48606. }
  48607. visit(visitor) {
  48608. visitor.visitVariable(this);
  48609. }
  48610. }
  48611. class AstVariableDefinition extends AstNode {
  48612. constructor(variable, arg) {
  48613. super("definition");
  48614. this.variable = variable;
  48615. this.arg = arg;
  48616. }
  48617. visit(visitor) {
  48618. visitor.visitVariableDefinition(this);
  48619. }
  48620. }
  48621. class ExpressionBuilderVisitor {
  48622. constructor() {
  48623. this.parts = [];
  48624. }
  48625. visitArgument(arg) {
  48626. this.parts.push("Math.max(", arg.min, ", Math.min(", arg.max, ", src[srcOffset + ", arg.index, "]))");
  48627. }
  48628. visitVariable(variable) {
  48629. this.parts.push("v", variable.index);
  48630. }
  48631. visitLiteral(literal) {
  48632. this.parts.push(literal.number);
  48633. }
  48634. visitBinaryOperation(operation) {
  48635. this.parts.push("(");
  48636. operation.arg1.visit(this);
  48637. this.parts.push(" ", operation.op, " ");
  48638. operation.arg2.visit(this);
  48639. this.parts.push(")");
  48640. }
  48641. visitVariableDefinition(definition) {
  48642. this.parts.push("var ");
  48643. definition.variable.visit(this);
  48644. this.parts.push(" = ");
  48645. definition.arg.visit(this);
  48646. this.parts.push(";");
  48647. }
  48648. visitMin(max) {
  48649. this.parts.push("Math.min(");
  48650. max.arg.visit(this);
  48651. this.parts.push(", ", max.max, ")");
  48652. }
  48653. toString() {
  48654. return this.parts.join("");
  48655. }
  48656. }
  48657. function buildAddOperation(num1, num2) {
  48658. if (num2.type === "literal" && num2.number === 0) {
  48659. return num1;
  48660. }
  48661. if (num1.type === "literal" && num1.number === 0) {
  48662. return num2;
  48663. }
  48664. if (num2.type === "literal" && num1.type === "literal") {
  48665. return new AstLiteral(num1.number + num2.number);
  48666. }
  48667. return new AstBinaryOperation("+", num1, num2, num1.min + num2.min, num1.max + num2.max);
  48668. }
  48669. function buildMulOperation(num1, num2) {
  48670. if (num2.type === "literal") {
  48671. if (num2.number === 0) {
  48672. return new AstLiteral(0);
  48673. } else if (num2.number === 1) {
  48674. return num1;
  48675. } else if (num1.type === "literal") {
  48676. return new AstLiteral(num1.number * num2.number);
  48677. }
  48678. }
  48679. if (num1.type === "literal") {
  48680. if (num1.number === 0) {
  48681. return new AstLiteral(0);
  48682. } else if (num1.number === 1) {
  48683. return num2;
  48684. }
  48685. }
  48686. const min = Math.min(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
  48687. const max = Math.max(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
  48688. return new AstBinaryOperation("*", num1, num2, min, max);
  48689. }
  48690. function buildSubOperation(num1, num2) {
  48691. if (num2.type === "literal") {
  48692. if (num2.number === 0) {
  48693. return num1;
  48694. } else if (num1.type === "literal") {
  48695. return new AstLiteral(num1.number - num2.number);
  48696. }
  48697. }
  48698. if (num2.type === "binary" && num2.op === "-" && num1.type === "literal" && num1.number === 1 && num2.arg1.type === "literal" && num2.arg1.number === 1) {
  48699. return num2.arg2;
  48700. }
  48701. return new AstBinaryOperation("-", num1, num2, num1.min - num2.max, num1.max - num2.min);
  48702. }
  48703. function buildMinOperation(num1, max) {
  48704. if (num1.min >= max) {
  48705. return new AstLiteral(max);
  48706. } else if (num1.max <= max) {
  48707. return num1;
  48708. }
  48709. return new AstMin(num1, max);
  48710. }
  48711. class PostScriptCompiler {
  48712. compile(code, domain, range) {
  48713. const stack = [];
  48714. const instructions = [];
  48715. const inputSize = domain.length >> 1,
  48716. outputSize = range.length >> 1;
  48717. let lastRegister = 0;
  48718. let n, j;
  48719. let num1, num2, ast1, ast2, tmpVar, item;
  48720. for (let i = 0; i < inputSize; i++) {
  48721. stack.push(new AstArgument(i, domain[i * 2], domain[i * 2 + 1]));
  48722. }
  48723. for (let i = 0, ii = code.length; i < ii; i++) {
  48724. item = code[i];
  48725. if (typeof item === "number") {
  48726. stack.push(new AstLiteral(item));
  48727. continue;
  48728. }
  48729. switch (item) {
  48730. case "add":
  48731. if (stack.length < 2) {
  48732. return null;
  48733. }
  48734. num2 = stack.pop();
  48735. num1 = stack.pop();
  48736. stack.push(buildAddOperation(num1, num2));
  48737. break;
  48738. case "cvr":
  48739. if (stack.length < 1) {
  48740. return null;
  48741. }
  48742. break;
  48743. case "mul":
  48744. if (stack.length < 2) {
  48745. return null;
  48746. }
  48747. num2 = stack.pop();
  48748. num1 = stack.pop();
  48749. stack.push(buildMulOperation(num1, num2));
  48750. break;
  48751. case "sub":
  48752. if (stack.length < 2) {
  48753. return null;
  48754. }
  48755. num2 = stack.pop();
  48756. num1 = stack.pop();
  48757. stack.push(buildSubOperation(num1, num2));
  48758. break;
  48759. case "exch":
  48760. if (stack.length < 2) {
  48761. return null;
  48762. }
  48763. ast1 = stack.pop();
  48764. ast2 = stack.pop();
  48765. stack.push(ast1, ast2);
  48766. break;
  48767. case "pop":
  48768. if (stack.length < 1) {
  48769. return null;
  48770. }
  48771. stack.pop();
  48772. break;
  48773. case "index":
  48774. if (stack.length < 1) {
  48775. return null;
  48776. }
  48777. num1 = stack.pop();
  48778. if (num1.type !== "literal") {
  48779. return null;
  48780. }
  48781. n = num1.number;
  48782. if (n < 0 || !Number.isInteger(n) || stack.length < n) {
  48783. return null;
  48784. }
  48785. ast1 = stack[stack.length - n - 1];
  48786. if (ast1.type === "literal" || ast1.type === "var") {
  48787. stack.push(ast1);
  48788. break;
  48789. }
  48790. tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
  48791. stack[stack.length - n - 1] = tmpVar;
  48792. stack.push(tmpVar);
  48793. instructions.push(new AstVariableDefinition(tmpVar, ast1));
  48794. break;
  48795. case "dup":
  48796. if (stack.length < 1) {
  48797. return null;
  48798. }
  48799. 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]) {
  48800. num1 = stack.pop();
  48801. stack.push(buildMinOperation(num1, code[i + 1]));
  48802. i += 6;
  48803. break;
  48804. }
  48805. ast1 = stack.at(-1);
  48806. if (ast1.type === "literal" || ast1.type === "var") {
  48807. stack.push(ast1);
  48808. break;
  48809. }
  48810. tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
  48811. stack[stack.length - 1] = tmpVar;
  48812. stack.push(tmpVar);
  48813. instructions.push(new AstVariableDefinition(tmpVar, ast1));
  48814. break;
  48815. case "roll":
  48816. if (stack.length < 2) {
  48817. return null;
  48818. }
  48819. num2 = stack.pop();
  48820. num1 = stack.pop();
  48821. if (num2.type !== "literal" || num1.type !== "literal") {
  48822. return null;
  48823. }
  48824. j = num2.number;
  48825. n = num1.number;
  48826. if (n <= 0 || !Number.isInteger(n) || !Number.isInteger(j) || stack.length < n) {
  48827. return null;
  48828. }
  48829. j = (j % n + n) % n;
  48830. if (j === 0) {
  48831. break;
  48832. }
  48833. stack.push(...stack.splice(stack.length - n, n - j));
  48834. break;
  48835. default:
  48836. return null;
  48837. }
  48838. }
  48839. if (stack.length !== outputSize) {
  48840. return null;
  48841. }
  48842. const result = [];
  48843. for (const instruction of instructions) {
  48844. const statementBuilder = new ExpressionBuilderVisitor();
  48845. instruction.visit(statementBuilder);
  48846. result.push(statementBuilder.toString());
  48847. }
  48848. for (let i = 0, ii = stack.length; i < ii; i++) {
  48849. const expr = stack[i],
  48850. statementBuilder = new ExpressionBuilderVisitor();
  48851. expr.visit(statementBuilder);
  48852. const min = range[i * 2],
  48853. max = range[i * 2 + 1];
  48854. const out = [statementBuilder.toString()];
  48855. if (min > expr.min) {
  48856. out.unshift("Math.max(", min, ", ");
  48857. out.push(")");
  48858. }
  48859. if (max < expr.max) {
  48860. out.unshift("Math.min(", max, ", ");
  48861. out.push(")");
  48862. }
  48863. out.unshift("dest[destOffset + ", i, "] = ");
  48864. out.push(";");
  48865. result.push(out.join(""));
  48866. }
  48867. return result.join("\n");
  48868. }
  48869. }
  48870. exports.PostScriptCompiler = PostScriptCompiler;
  48871. /***/ }),
  48872. /* 187 */
  48873. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  48874. "use strict";
  48875. Object.defineProperty(exports, "__esModule", ({
  48876. value: true
  48877. }));
  48878. exports.PostScriptParser = exports.PostScriptLexer = void 0;
  48879. var _util = __w_pdfjs_require__(2);
  48880. var _primitives = __w_pdfjs_require__(134);
  48881. var _core_utils = __w_pdfjs_require__(135);
  48882. class PostScriptParser {
  48883. constructor(lexer) {
  48884. this.lexer = lexer;
  48885. this.operators = [];
  48886. this.token = null;
  48887. this.prev = null;
  48888. }
  48889. nextToken() {
  48890. this.prev = this.token;
  48891. this.token = this.lexer.getToken();
  48892. }
  48893. accept(type) {
  48894. if (this.token.type === type) {
  48895. this.nextToken();
  48896. return true;
  48897. }
  48898. return false;
  48899. }
  48900. expect(type) {
  48901. if (this.accept(type)) {
  48902. return true;
  48903. }
  48904. throw new _util.FormatError(`Unexpected symbol: found ${this.token.type} expected ${type}.`);
  48905. }
  48906. parse() {
  48907. this.nextToken();
  48908. this.expect(PostScriptTokenTypes.LBRACE);
  48909. this.parseBlock();
  48910. this.expect(PostScriptTokenTypes.RBRACE);
  48911. return this.operators;
  48912. }
  48913. parseBlock() {
  48914. while (true) {
  48915. if (this.accept(PostScriptTokenTypes.NUMBER)) {
  48916. this.operators.push(this.prev.value);
  48917. } else if (this.accept(PostScriptTokenTypes.OPERATOR)) {
  48918. this.operators.push(this.prev.value);
  48919. } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
  48920. this.parseCondition();
  48921. } else {
  48922. return;
  48923. }
  48924. }
  48925. }
  48926. parseCondition() {
  48927. const conditionLocation = this.operators.length;
  48928. this.operators.push(null, null);
  48929. this.parseBlock();
  48930. this.expect(PostScriptTokenTypes.RBRACE);
  48931. if (this.accept(PostScriptTokenTypes.IF)) {
  48932. this.operators[conditionLocation] = this.operators.length;
  48933. this.operators[conditionLocation + 1] = "jz";
  48934. } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
  48935. const jumpLocation = this.operators.length;
  48936. this.operators.push(null, null);
  48937. const endOfTrue = this.operators.length;
  48938. this.parseBlock();
  48939. this.expect(PostScriptTokenTypes.RBRACE);
  48940. this.expect(PostScriptTokenTypes.IFELSE);
  48941. this.operators[jumpLocation] = this.operators.length;
  48942. this.operators[jumpLocation + 1] = "j";
  48943. this.operators[conditionLocation] = endOfTrue;
  48944. this.operators[conditionLocation + 1] = "jz";
  48945. } else {
  48946. throw new _util.FormatError("PS Function: error parsing conditional.");
  48947. }
  48948. }
  48949. }
  48950. exports.PostScriptParser = PostScriptParser;
  48951. const PostScriptTokenTypes = {
  48952. LBRACE: 0,
  48953. RBRACE: 1,
  48954. NUMBER: 2,
  48955. OPERATOR: 3,
  48956. IF: 4,
  48957. IFELSE: 5
  48958. };
  48959. class PostScriptToken {
  48960. static get opCache() {
  48961. return (0, _util.shadow)(this, "opCache", Object.create(null));
  48962. }
  48963. constructor(type, value) {
  48964. this.type = type;
  48965. this.value = value;
  48966. }
  48967. static getOperator(op) {
  48968. const opValue = PostScriptToken.opCache[op];
  48969. if (opValue) {
  48970. return opValue;
  48971. }
  48972. return PostScriptToken.opCache[op] = new PostScriptToken(PostScriptTokenTypes.OPERATOR, op);
  48973. }
  48974. static get LBRACE() {
  48975. return (0, _util.shadow)(this, "LBRACE", new PostScriptToken(PostScriptTokenTypes.LBRACE, "{"));
  48976. }
  48977. static get RBRACE() {
  48978. return (0, _util.shadow)(this, "RBRACE", new PostScriptToken(PostScriptTokenTypes.RBRACE, "}"));
  48979. }
  48980. static get IF() {
  48981. return (0, _util.shadow)(this, "IF", new PostScriptToken(PostScriptTokenTypes.IF, "IF"));
  48982. }
  48983. static get IFELSE() {
  48984. return (0, _util.shadow)(this, "IFELSE", new PostScriptToken(PostScriptTokenTypes.IFELSE, "IFELSE"));
  48985. }
  48986. }
  48987. class PostScriptLexer {
  48988. constructor(stream) {
  48989. this.stream = stream;
  48990. this.nextChar();
  48991. this.strBuf = [];
  48992. }
  48993. nextChar() {
  48994. return this.currentChar = this.stream.getByte();
  48995. }
  48996. getToken() {
  48997. let comment = false;
  48998. let ch = this.currentChar;
  48999. while (true) {
  49000. if (ch < 0) {
  49001. return _primitives.EOF;
  49002. }
  49003. if (comment) {
  49004. if (ch === 0x0a || ch === 0x0d) {
  49005. comment = false;
  49006. }
  49007. } else if (ch === 0x25) {
  49008. comment = true;
  49009. } else if (!(0, _core_utils.isWhiteSpace)(ch)) {
  49010. break;
  49011. }
  49012. ch = this.nextChar();
  49013. }
  49014. switch (ch | 0) {
  49015. case 0x30:
  49016. case 0x31:
  49017. case 0x32:
  49018. case 0x33:
  49019. case 0x34:
  49020. case 0x35:
  49021. case 0x36:
  49022. case 0x37:
  49023. case 0x38:
  49024. case 0x39:
  49025. case 0x2b:
  49026. case 0x2d:
  49027. case 0x2e:
  49028. return new PostScriptToken(PostScriptTokenTypes.NUMBER, this.getNumber());
  49029. case 0x7b:
  49030. this.nextChar();
  49031. return PostScriptToken.LBRACE;
  49032. case 0x7d:
  49033. this.nextChar();
  49034. return PostScriptToken.RBRACE;
  49035. }
  49036. const strBuf = this.strBuf;
  49037. strBuf.length = 0;
  49038. strBuf[0] = String.fromCharCode(ch);
  49039. while ((ch = this.nextChar()) >= 0 && (ch >= 0x41 && ch <= 0x5a || ch >= 0x61 && ch <= 0x7a)) {
  49040. strBuf.push(String.fromCharCode(ch));
  49041. }
  49042. const str = strBuf.join("");
  49043. switch (str.toLowerCase()) {
  49044. case "if":
  49045. return PostScriptToken.IF;
  49046. case "ifelse":
  49047. return PostScriptToken.IFELSE;
  49048. default:
  49049. return PostScriptToken.getOperator(str);
  49050. }
  49051. }
  49052. getNumber() {
  49053. let ch = this.currentChar;
  49054. const strBuf = this.strBuf;
  49055. strBuf.length = 0;
  49056. strBuf[0] = String.fromCharCode(ch);
  49057. while ((ch = this.nextChar()) >= 0) {
  49058. if (ch >= 0x30 && ch <= 0x39 || ch === 0x2d || ch === 0x2e) {
  49059. strBuf.push(String.fromCharCode(ch));
  49060. } else {
  49061. break;
  49062. }
  49063. }
  49064. const value = parseFloat(strBuf.join(""));
  49065. if (isNaN(value)) {
  49066. throw new _util.FormatError(`Invalid floating point number: ${value}`);
  49067. }
  49068. return value;
  49069. }
  49070. }
  49071. exports.PostScriptLexer = PostScriptLexer;
  49072. /***/ }),
  49073. /* 188 */
  49074. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  49075. "use strict";
  49076. Object.defineProperty(exports, "__esModule", ({
  49077. value: true
  49078. }));
  49079. exports.LocalTilingPatternCache = exports.LocalImageCache = exports.LocalGStateCache = exports.LocalFunctionCache = exports.LocalColorSpaceCache = exports.GlobalImageCache = void 0;
  49080. var _util = __w_pdfjs_require__(2);
  49081. var _primitives = __w_pdfjs_require__(134);
  49082. class BaseLocalCache {
  49083. constructor(options) {
  49084. if (this.constructor === BaseLocalCache) {
  49085. (0, _util.unreachable)("Cannot initialize BaseLocalCache.");
  49086. }
  49087. this._onlyRefs = (options && options.onlyRefs) === true;
  49088. if (!this._onlyRefs) {
  49089. this._nameRefMap = new Map();
  49090. this._imageMap = new Map();
  49091. }
  49092. this._imageCache = new _primitives.RefSetCache();
  49093. }
  49094. getByName(name) {
  49095. if (this._onlyRefs) {
  49096. (0, _util.unreachable)("Should not call `getByName` method.");
  49097. }
  49098. const ref = this._nameRefMap.get(name);
  49099. if (ref) {
  49100. return this.getByRef(ref);
  49101. }
  49102. return this._imageMap.get(name) || null;
  49103. }
  49104. getByRef(ref) {
  49105. return this._imageCache.get(ref) || null;
  49106. }
  49107. set(name, ref, data) {
  49108. (0, _util.unreachable)("Abstract method `set` called.");
  49109. }
  49110. }
  49111. class LocalImageCache extends BaseLocalCache {
  49112. set(name) {
  49113. let ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  49114. let data = arguments.length > 2 ? arguments[2] : undefined;
  49115. if (typeof name !== "string") {
  49116. throw new Error('LocalImageCache.set - expected "name" argument.');
  49117. }
  49118. if (ref) {
  49119. if (this._imageCache.has(ref)) {
  49120. return;
  49121. }
  49122. this._nameRefMap.set(name, ref);
  49123. this._imageCache.put(ref, data);
  49124. return;
  49125. }
  49126. if (this._imageMap.has(name)) {
  49127. return;
  49128. }
  49129. this._imageMap.set(name, data);
  49130. }
  49131. }
  49132. exports.LocalImageCache = LocalImageCache;
  49133. class LocalColorSpaceCache extends BaseLocalCache {
  49134. set() {
  49135. let name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  49136. let ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  49137. let data = arguments.length > 2 ? arguments[2] : undefined;
  49138. if (typeof name !== "string" && !ref) {
  49139. throw new Error('LocalColorSpaceCache.set - expected "name" and/or "ref" argument.');
  49140. }
  49141. if (ref) {
  49142. if (this._imageCache.has(ref)) {
  49143. return;
  49144. }
  49145. if (name !== null) {
  49146. this._nameRefMap.set(name, ref);
  49147. }
  49148. this._imageCache.put(ref, data);
  49149. return;
  49150. }
  49151. if (this._imageMap.has(name)) {
  49152. return;
  49153. }
  49154. this._imageMap.set(name, data);
  49155. }
  49156. }
  49157. exports.LocalColorSpaceCache = LocalColorSpaceCache;
  49158. class LocalFunctionCache extends BaseLocalCache {
  49159. constructor(options) {
  49160. super({
  49161. onlyRefs: true
  49162. });
  49163. }
  49164. set() {
  49165. let name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  49166. let ref = arguments.length > 1 ? arguments[1] : undefined;
  49167. let data = arguments.length > 2 ? arguments[2] : undefined;
  49168. if (!ref) {
  49169. throw new Error('LocalFunctionCache.set - expected "ref" argument.');
  49170. }
  49171. if (this._imageCache.has(ref)) {
  49172. return;
  49173. }
  49174. this._imageCache.put(ref, data);
  49175. }
  49176. }
  49177. exports.LocalFunctionCache = LocalFunctionCache;
  49178. class LocalGStateCache extends BaseLocalCache {
  49179. set(name) {
  49180. let ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  49181. let data = arguments.length > 2 ? arguments[2] : undefined;
  49182. if (typeof name !== "string") {
  49183. throw new Error('LocalGStateCache.set - expected "name" argument.');
  49184. }
  49185. if (ref) {
  49186. if (this._imageCache.has(ref)) {
  49187. return;
  49188. }
  49189. this._nameRefMap.set(name, ref);
  49190. this._imageCache.put(ref, data);
  49191. return;
  49192. }
  49193. if (this._imageMap.has(name)) {
  49194. return;
  49195. }
  49196. this._imageMap.set(name, data);
  49197. }
  49198. }
  49199. exports.LocalGStateCache = LocalGStateCache;
  49200. class LocalTilingPatternCache extends BaseLocalCache {
  49201. constructor(options) {
  49202. super({
  49203. onlyRefs: true
  49204. });
  49205. }
  49206. set() {
  49207. let name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  49208. let ref = arguments.length > 1 ? arguments[1] : undefined;
  49209. let data = arguments.length > 2 ? arguments[2] : undefined;
  49210. if (!ref) {
  49211. throw new Error('LocalTilingPatternCache.set - expected "ref" argument.');
  49212. }
  49213. if (this._imageCache.has(ref)) {
  49214. return;
  49215. }
  49216. this._imageCache.put(ref, data);
  49217. }
  49218. }
  49219. exports.LocalTilingPatternCache = LocalTilingPatternCache;
  49220. class GlobalImageCache {
  49221. static get NUM_PAGES_THRESHOLD() {
  49222. return (0, _util.shadow)(this, "NUM_PAGES_THRESHOLD", 2);
  49223. }
  49224. static get MIN_IMAGES_TO_CACHE() {
  49225. return (0, _util.shadow)(this, "MIN_IMAGES_TO_CACHE", 10);
  49226. }
  49227. static get MAX_BYTE_SIZE() {
  49228. return (0, _util.shadow)(this, "MAX_BYTE_SIZE", 40e6);
  49229. }
  49230. constructor() {
  49231. this._refCache = new _primitives.RefSetCache();
  49232. this._imageCache = new _primitives.RefSetCache();
  49233. }
  49234. get _byteSize() {
  49235. let byteSize = 0;
  49236. for (const imageData of this._imageCache) {
  49237. byteSize += imageData.byteSize;
  49238. }
  49239. return byteSize;
  49240. }
  49241. get _cacheLimitReached() {
  49242. if (this._imageCache.size < GlobalImageCache.MIN_IMAGES_TO_CACHE) {
  49243. return false;
  49244. }
  49245. if (this._byteSize < GlobalImageCache.MAX_BYTE_SIZE) {
  49246. return false;
  49247. }
  49248. return true;
  49249. }
  49250. shouldCache(ref, pageIndex) {
  49251. const pageIndexSet = this._refCache.get(ref);
  49252. const numPages = pageIndexSet ? pageIndexSet.size + (pageIndexSet.has(pageIndex) ? 0 : 1) : 1;
  49253. if (numPages < GlobalImageCache.NUM_PAGES_THRESHOLD) {
  49254. return false;
  49255. }
  49256. if (!this._imageCache.has(ref) && this._cacheLimitReached) {
  49257. return false;
  49258. }
  49259. return true;
  49260. }
  49261. addPageIndex(ref, pageIndex) {
  49262. let pageIndexSet = this._refCache.get(ref);
  49263. if (!pageIndexSet) {
  49264. pageIndexSet = new Set();
  49265. this._refCache.put(ref, pageIndexSet);
  49266. }
  49267. pageIndexSet.add(pageIndex);
  49268. }
  49269. addByteSize(ref, byteSize) {
  49270. const imageData = this._imageCache.get(ref);
  49271. if (!imageData) {
  49272. return;
  49273. }
  49274. if (imageData.byteSize) {
  49275. return;
  49276. }
  49277. imageData.byteSize = byteSize;
  49278. }
  49279. getData(ref, pageIndex) {
  49280. const pageIndexSet = this._refCache.get(ref);
  49281. if (!pageIndexSet) {
  49282. return null;
  49283. }
  49284. if (pageIndexSet.size < GlobalImageCache.NUM_PAGES_THRESHOLD) {
  49285. return null;
  49286. }
  49287. const imageData = this._imageCache.get(ref);
  49288. if (!imageData) {
  49289. return null;
  49290. }
  49291. pageIndexSet.add(pageIndex);
  49292. return imageData;
  49293. }
  49294. setData(ref, data) {
  49295. if (!this._refCache.has(ref)) {
  49296. throw new Error('GlobalImageCache.setData - expected "addPageIndex" to have been called.');
  49297. }
  49298. if (this._imageCache.has(ref)) {
  49299. return;
  49300. }
  49301. if (this._cacheLimitReached) {
  49302. (0, _util.warn)("GlobalImageCache.setData - cache limit reached.");
  49303. return;
  49304. }
  49305. this._imageCache.put(ref, data);
  49306. }
  49307. clear() {
  49308. let onlyData = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  49309. if (!onlyData) {
  49310. this._refCache.clear();
  49311. }
  49312. this._imageCache.clear();
  49313. }
  49314. }
  49315. exports.GlobalImageCache = GlobalImageCache;
  49316. /***/ }),
  49317. /* 189 */
  49318. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  49319. "use strict";
  49320. Object.defineProperty(exports, "__esModule", ({
  49321. value: true
  49322. }));
  49323. exports.bidi = bidi;
  49324. var _util = __w_pdfjs_require__(2);
  49325. 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"];
  49326. 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"];
  49327. function isOdd(i) {
  49328. return (i & 1) !== 0;
  49329. }
  49330. function isEven(i) {
  49331. return (i & 1) === 0;
  49332. }
  49333. function findUnequal(arr, start, value) {
  49334. let j, jj;
  49335. for (j = start, jj = arr.length; j < jj; ++j) {
  49336. if (arr[j] !== value) {
  49337. return j;
  49338. }
  49339. }
  49340. return j;
  49341. }
  49342. function setValues(arr, start, end, value) {
  49343. for (let j = start; j < end; ++j) {
  49344. arr[j] = value;
  49345. }
  49346. }
  49347. function reverseValues(arr, start, end) {
  49348. for (let i = start, j = end - 1; i < j; ++i, --j) {
  49349. const temp = arr[i];
  49350. arr[i] = arr[j];
  49351. arr[j] = temp;
  49352. }
  49353. }
  49354. function createBidiText(str, isLTR) {
  49355. let vertical = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  49356. let dir = "ltr";
  49357. if (vertical) {
  49358. dir = "ttb";
  49359. } else if (!isLTR) {
  49360. dir = "rtl";
  49361. }
  49362. return {
  49363. str,
  49364. dir
  49365. };
  49366. }
  49367. const chars = [];
  49368. const types = [];
  49369. function bidi(str) {
  49370. let startLevel = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : -1;
  49371. let vertical = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  49372. let isLTR = true;
  49373. const strLength = str.length;
  49374. if (strLength === 0 || vertical) {
  49375. return createBidiText(str, isLTR, vertical);
  49376. }
  49377. chars.length = strLength;
  49378. types.length = strLength;
  49379. let numBidi = 0;
  49380. let i, ii;
  49381. for (i = 0; i < strLength; ++i) {
  49382. chars[i] = str.charAt(i);
  49383. const charCode = str.charCodeAt(i);
  49384. let charType = "L";
  49385. if (charCode <= 0x00ff) {
  49386. charType = baseTypes[charCode];
  49387. } else if (0x0590 <= charCode && charCode <= 0x05f4) {
  49388. charType = "R";
  49389. } else if (0x0600 <= charCode && charCode <= 0x06ff) {
  49390. charType = arabicTypes[charCode & 0xff];
  49391. if (!charType) {
  49392. (0, _util.warn)("Bidi: invalid Unicode character " + charCode.toString(16));
  49393. }
  49394. } else if (0x0700 <= charCode && charCode <= 0x08ac) {
  49395. charType = "AL";
  49396. }
  49397. if (charType === "R" || charType === "AL" || charType === "AN") {
  49398. numBidi++;
  49399. }
  49400. types[i] = charType;
  49401. }
  49402. if (numBidi === 0) {
  49403. isLTR = true;
  49404. return createBidiText(str, isLTR);
  49405. }
  49406. if (startLevel === -1) {
  49407. if (numBidi / strLength < 0.3 && strLength > 4) {
  49408. isLTR = true;
  49409. startLevel = 0;
  49410. } else {
  49411. isLTR = false;
  49412. startLevel = 1;
  49413. }
  49414. }
  49415. const levels = [];
  49416. for (i = 0; i < strLength; ++i) {
  49417. levels[i] = startLevel;
  49418. }
  49419. const e = isOdd(startLevel) ? "R" : "L";
  49420. const sor = e;
  49421. const eor = sor;
  49422. let lastType = sor;
  49423. for (i = 0; i < strLength; ++i) {
  49424. if (types[i] === "NSM") {
  49425. types[i] = lastType;
  49426. } else {
  49427. lastType = types[i];
  49428. }
  49429. }
  49430. lastType = sor;
  49431. let t;
  49432. for (i = 0; i < strLength; ++i) {
  49433. t = types[i];
  49434. if (t === "EN") {
  49435. types[i] = lastType === "AL" ? "AN" : "EN";
  49436. } else if (t === "R" || t === "L" || t === "AL") {
  49437. lastType = t;
  49438. }
  49439. }
  49440. for (i = 0; i < strLength; ++i) {
  49441. t = types[i];
  49442. if (t === "AL") {
  49443. types[i] = "R";
  49444. }
  49445. }
  49446. for (i = 1; i < strLength - 1; ++i) {
  49447. if (types[i] === "ES" && types[i - 1] === "EN" && types[i + 1] === "EN") {
  49448. types[i] = "EN";
  49449. }
  49450. if (types[i] === "CS" && (types[i - 1] === "EN" || types[i - 1] === "AN") && types[i + 1] === types[i - 1]) {
  49451. types[i] = types[i - 1];
  49452. }
  49453. }
  49454. for (i = 0; i < strLength; ++i) {
  49455. if (types[i] === "EN") {
  49456. for (let j = i - 1; j >= 0; --j) {
  49457. if (types[j] !== "ET") {
  49458. break;
  49459. }
  49460. types[j] = "EN";
  49461. }
  49462. for (let j = i + 1; j < strLength; ++j) {
  49463. if (types[j] !== "ET") {
  49464. break;
  49465. }
  49466. types[j] = "EN";
  49467. }
  49468. }
  49469. }
  49470. for (i = 0; i < strLength; ++i) {
  49471. t = types[i];
  49472. if (t === "WS" || t === "ES" || t === "ET" || t === "CS") {
  49473. types[i] = "ON";
  49474. }
  49475. }
  49476. lastType = sor;
  49477. for (i = 0; i < strLength; ++i) {
  49478. t = types[i];
  49479. if (t === "EN") {
  49480. types[i] = lastType === "L" ? "L" : "EN";
  49481. } else if (t === "R" || t === "L") {
  49482. lastType = t;
  49483. }
  49484. }
  49485. for (i = 0; i < strLength; ++i) {
  49486. if (types[i] === "ON") {
  49487. const end = findUnequal(types, i + 1, "ON");
  49488. let before = sor;
  49489. if (i > 0) {
  49490. before = types[i - 1];
  49491. }
  49492. let after = eor;
  49493. if (end + 1 < strLength) {
  49494. after = types[end + 1];
  49495. }
  49496. if (before !== "L") {
  49497. before = "R";
  49498. }
  49499. if (after !== "L") {
  49500. after = "R";
  49501. }
  49502. if (before === after) {
  49503. setValues(types, i, end, before);
  49504. }
  49505. i = end - 1;
  49506. }
  49507. }
  49508. for (i = 0; i < strLength; ++i) {
  49509. if (types[i] === "ON") {
  49510. types[i] = e;
  49511. }
  49512. }
  49513. for (i = 0; i < strLength; ++i) {
  49514. t = types[i];
  49515. if (isEven(levels[i])) {
  49516. if (t === "R") {
  49517. levels[i] += 1;
  49518. } else if (t === "AN" || t === "EN") {
  49519. levels[i] += 2;
  49520. }
  49521. } else {
  49522. if (t === "L" || t === "AN" || t === "EN") {
  49523. levels[i] += 1;
  49524. }
  49525. }
  49526. }
  49527. let highestLevel = -1;
  49528. let lowestOddLevel = 99;
  49529. let level;
  49530. for (i = 0, ii = levels.length; i < ii; ++i) {
  49531. level = levels[i];
  49532. if (highestLevel < level) {
  49533. highestLevel = level;
  49534. }
  49535. if (lowestOddLevel > level && isOdd(level)) {
  49536. lowestOddLevel = level;
  49537. }
  49538. }
  49539. for (level = highestLevel; level >= lowestOddLevel; --level) {
  49540. let start = -1;
  49541. for (i = 0, ii = levels.length; i < ii; ++i) {
  49542. if (levels[i] < level) {
  49543. if (start >= 0) {
  49544. reverseValues(chars, start, i);
  49545. start = -1;
  49546. }
  49547. } else if (start < 0) {
  49548. start = i;
  49549. }
  49550. }
  49551. if (start >= 0) {
  49552. reverseValues(chars, start, levels.length);
  49553. }
  49554. }
  49555. for (i = 0, ii = chars.length; i < ii; ++i) {
  49556. const ch = chars[i];
  49557. if (ch === "<" || ch === ">") {
  49558. chars[i] = "";
  49559. }
  49560. }
  49561. return createBidiText(chars.join(""), isLTR);
  49562. }
  49563. /***/ }),
  49564. /* 190 */
  49565. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  49566. "use strict";
  49567. Object.defineProperty(exports, "__esModule", ({
  49568. value: true
  49569. }));
  49570. exports.MurmurHash3_64 = void 0;
  49571. var _util = __w_pdfjs_require__(2);
  49572. const SEED = 0xc3d2e1f0;
  49573. const MASK_HIGH = 0xffff0000;
  49574. const MASK_LOW = 0xffff;
  49575. class MurmurHash3_64 {
  49576. constructor(seed) {
  49577. this.h1 = seed ? seed & 0xffffffff : SEED;
  49578. this.h2 = seed ? seed & 0xffffffff : SEED;
  49579. }
  49580. update(input) {
  49581. let data, length;
  49582. if (typeof input === "string") {
  49583. data = new Uint8Array(input.length * 2);
  49584. length = 0;
  49585. for (let i = 0, ii = input.length; i < ii; i++) {
  49586. const code = input.charCodeAt(i);
  49587. if (code <= 0xff) {
  49588. data[length++] = code;
  49589. } else {
  49590. data[length++] = code >>> 8;
  49591. data[length++] = code & 0xff;
  49592. }
  49593. }
  49594. } else if ((0, _util.isArrayBuffer)(input)) {
  49595. data = input.slice();
  49596. length = data.byteLength;
  49597. } else {
  49598. throw new Error("Wrong data format in MurmurHash3_64_update. " + "Input must be a string or array.");
  49599. }
  49600. const blockCounts = length >> 2;
  49601. const tailLength = length - blockCounts * 4;
  49602. const dataUint32 = new Uint32Array(data.buffer, 0, blockCounts);
  49603. let k1 = 0,
  49604. k2 = 0;
  49605. let h1 = this.h1,
  49606. h2 = this.h2;
  49607. const C1 = 0xcc9e2d51,
  49608. C2 = 0x1b873593;
  49609. const C1_LOW = C1 & MASK_LOW,
  49610. C2_LOW = C2 & MASK_LOW;
  49611. for (let i = 0; i < blockCounts; i++) {
  49612. if (i & 1) {
  49613. k1 = dataUint32[i];
  49614. k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
  49615. k1 = k1 << 15 | k1 >>> 17;
  49616. k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
  49617. h1 ^= k1;
  49618. h1 = h1 << 13 | h1 >>> 19;
  49619. h1 = h1 * 5 + 0xe6546b64;
  49620. } else {
  49621. k2 = dataUint32[i];
  49622. k2 = k2 * C1 & MASK_HIGH | k2 * C1_LOW & MASK_LOW;
  49623. k2 = k2 << 15 | k2 >>> 17;
  49624. k2 = k2 * C2 & MASK_HIGH | k2 * C2_LOW & MASK_LOW;
  49625. h2 ^= k2;
  49626. h2 = h2 << 13 | h2 >>> 19;
  49627. h2 = h2 * 5 + 0xe6546b64;
  49628. }
  49629. }
  49630. k1 = 0;
  49631. switch (tailLength) {
  49632. case 3:
  49633. k1 ^= data[blockCounts * 4 + 2] << 16;
  49634. case 2:
  49635. k1 ^= data[blockCounts * 4 + 1] << 8;
  49636. case 1:
  49637. k1 ^= data[blockCounts * 4];
  49638. k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
  49639. k1 = k1 << 15 | k1 >>> 17;
  49640. k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
  49641. if (blockCounts & 1) {
  49642. h1 ^= k1;
  49643. } else {
  49644. h2 ^= k1;
  49645. }
  49646. }
  49647. this.h1 = h1;
  49648. this.h2 = h2;
  49649. }
  49650. hexdigest() {
  49651. let h1 = this.h1,
  49652. h2 = this.h2;
  49653. h1 ^= h2 >>> 1;
  49654. h1 = h1 * 0xed558ccd & MASK_HIGH | h1 * 0x8ccd & MASK_LOW;
  49655. h2 = h2 * 0xff51afd7 & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xafd7ed55 & MASK_HIGH) >>> 16;
  49656. h1 ^= h2 >>> 1;
  49657. h1 = h1 * 0x1a85ec53 & MASK_HIGH | h1 * 0xec53 & MASK_LOW;
  49658. h2 = h2 * 0xc4ceb9fe & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xb9fe1a85 & MASK_HIGH) >>> 16;
  49659. h1 ^= h2 >>> 1;
  49660. return (h1 >>> 0).toString(16).padStart(8, "0") + (h2 >>> 0).toString(16).padStart(8, "0");
  49661. }
  49662. }
  49663. exports.MurmurHash3_64 = MurmurHash3_64;
  49664. /***/ }),
  49665. /* 191 */
  49666. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  49667. "use strict";
  49668. Object.defineProperty(exports, "__esModule", ({
  49669. value: true
  49670. }));
  49671. exports.OperatorList = void 0;
  49672. var _util = __w_pdfjs_require__(2);
  49673. function addState(parentState, pattern, checkFn, iterateFn, processFn) {
  49674. let state = parentState;
  49675. for (let i = 0, ii = pattern.length - 1; i < ii; i++) {
  49676. const item = pattern[i];
  49677. state = state[item] || (state[item] = []);
  49678. }
  49679. state[pattern.at(-1)] = {
  49680. checkFn,
  49681. iterateFn,
  49682. processFn
  49683. };
  49684. }
  49685. const InitialState = [];
  49686. addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintInlineImageXObject, _util.OPS.restore], null, function iterateInlineImageGroup(context, i) {
  49687. const fnArray = context.fnArray;
  49688. const iFirstSave = context.iCurr - 3;
  49689. const pos = (i - iFirstSave) % 4;
  49690. switch (pos) {
  49691. case 0:
  49692. return fnArray[i] === _util.OPS.save;
  49693. case 1:
  49694. return fnArray[i] === _util.OPS.transform;
  49695. case 2:
  49696. return fnArray[i] === _util.OPS.paintInlineImageXObject;
  49697. case 3:
  49698. return fnArray[i] === _util.OPS.restore;
  49699. }
  49700. throw new Error(`iterateInlineImageGroup - invalid pos: ${pos}`);
  49701. }, function foundInlineImageGroup(context, i) {
  49702. const MIN_IMAGES_IN_INLINE_IMAGES_BLOCK = 10;
  49703. const MAX_IMAGES_IN_INLINE_IMAGES_BLOCK = 200;
  49704. const MAX_WIDTH = 1000;
  49705. const IMAGE_PADDING = 1;
  49706. const fnArray = context.fnArray,
  49707. argsArray = context.argsArray;
  49708. const curr = context.iCurr;
  49709. const iFirstSave = curr - 3;
  49710. const iFirstTransform = curr - 2;
  49711. const iFirstPIIXO = curr - 1;
  49712. const count = Math.min(Math.floor((i - iFirstSave) / 4), MAX_IMAGES_IN_INLINE_IMAGES_BLOCK);
  49713. if (count < MIN_IMAGES_IN_INLINE_IMAGES_BLOCK) {
  49714. return i - (i - iFirstSave) % 4;
  49715. }
  49716. let maxX = 0;
  49717. const map = [];
  49718. let maxLineHeight = 0;
  49719. let currentX = IMAGE_PADDING,
  49720. currentY = IMAGE_PADDING;
  49721. for (let q = 0; q < count; q++) {
  49722. const transform = argsArray[iFirstTransform + (q << 2)];
  49723. const img = argsArray[iFirstPIIXO + (q << 2)][0];
  49724. if (currentX + img.width > MAX_WIDTH) {
  49725. maxX = Math.max(maxX, currentX);
  49726. currentY += maxLineHeight + 2 * IMAGE_PADDING;
  49727. currentX = 0;
  49728. maxLineHeight = 0;
  49729. }
  49730. map.push({
  49731. transform,
  49732. x: currentX,
  49733. y: currentY,
  49734. w: img.width,
  49735. h: img.height
  49736. });
  49737. currentX += img.width + 2 * IMAGE_PADDING;
  49738. maxLineHeight = Math.max(maxLineHeight, img.height);
  49739. }
  49740. const imgWidth = Math.max(maxX, currentX) + IMAGE_PADDING;
  49741. const imgHeight = currentY + maxLineHeight + IMAGE_PADDING;
  49742. const imgData = new Uint8Array(imgWidth * imgHeight * 4);
  49743. const imgRowSize = imgWidth << 2;
  49744. for (let q = 0; q < count; q++) {
  49745. const data = argsArray[iFirstPIIXO + (q << 2)][0].data;
  49746. const rowSize = map[q].w << 2;
  49747. let dataOffset = 0;
  49748. let offset = map[q].x + map[q].y * imgWidth << 2;
  49749. imgData.set(data.subarray(0, rowSize), offset - imgRowSize);
  49750. for (let k = 0, kk = map[q].h; k < kk; k++) {
  49751. imgData.set(data.subarray(dataOffset, dataOffset + rowSize), offset);
  49752. dataOffset += rowSize;
  49753. offset += imgRowSize;
  49754. }
  49755. imgData.set(data.subarray(dataOffset - rowSize, dataOffset), offset);
  49756. while (offset >= 0) {
  49757. data[offset - 4] = data[offset];
  49758. data[offset - 3] = data[offset + 1];
  49759. data[offset - 2] = data[offset + 2];
  49760. data[offset - 1] = data[offset + 3];
  49761. data[offset + rowSize] = data[offset + rowSize - 4];
  49762. data[offset + rowSize + 1] = data[offset + rowSize - 3];
  49763. data[offset + rowSize + 2] = data[offset + rowSize - 2];
  49764. data[offset + rowSize + 3] = data[offset + rowSize - 1];
  49765. offset -= imgRowSize;
  49766. }
  49767. }
  49768. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintInlineImageXObjectGroup);
  49769. argsArray.splice(iFirstSave, count * 4, [{
  49770. width: imgWidth,
  49771. height: imgHeight,
  49772. kind: _util.ImageKind.RGBA_32BPP,
  49773. data: imgData
  49774. }, map]);
  49775. return iFirstSave + 1;
  49776. });
  49777. addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintImageMaskXObject, _util.OPS.restore], null, function iterateImageMaskGroup(context, i) {
  49778. const fnArray = context.fnArray;
  49779. const iFirstSave = context.iCurr - 3;
  49780. const pos = (i - iFirstSave) % 4;
  49781. switch (pos) {
  49782. case 0:
  49783. return fnArray[i] === _util.OPS.save;
  49784. case 1:
  49785. return fnArray[i] === _util.OPS.transform;
  49786. case 2:
  49787. return fnArray[i] === _util.OPS.paintImageMaskXObject;
  49788. case 3:
  49789. return fnArray[i] === _util.OPS.restore;
  49790. }
  49791. throw new Error(`iterateImageMaskGroup - invalid pos: ${pos}`);
  49792. }, function foundImageMaskGroup(context, i) {
  49793. const MIN_IMAGES_IN_MASKS_BLOCK = 10;
  49794. const MAX_IMAGES_IN_MASKS_BLOCK = 100;
  49795. const MAX_SAME_IMAGES_IN_MASKS_BLOCK = 1000;
  49796. const fnArray = context.fnArray,
  49797. argsArray = context.argsArray;
  49798. const curr = context.iCurr;
  49799. const iFirstSave = curr - 3;
  49800. const iFirstTransform = curr - 2;
  49801. const iFirstPIMXO = curr - 1;
  49802. let count = Math.floor((i - iFirstSave) / 4);
  49803. if (count < MIN_IMAGES_IN_MASKS_BLOCK) {
  49804. return i - (i - iFirstSave) % 4;
  49805. }
  49806. let isSameImage = false;
  49807. let iTransform, transformArgs;
  49808. const firstPIMXOArg0 = argsArray[iFirstPIMXO][0];
  49809. const firstTransformArg0 = argsArray[iFirstTransform][0],
  49810. firstTransformArg1 = argsArray[iFirstTransform][1],
  49811. firstTransformArg2 = argsArray[iFirstTransform][2],
  49812. firstTransformArg3 = argsArray[iFirstTransform][3];
  49813. if (firstTransformArg1 === firstTransformArg2) {
  49814. isSameImage = true;
  49815. iTransform = iFirstTransform + 4;
  49816. let iPIMXO = iFirstPIMXO + 4;
  49817. for (let q = 1; q < count; q++, iTransform += 4, iPIMXO += 4) {
  49818. transformArgs = argsArray[iTransform];
  49819. if (argsArray[iPIMXO][0] !== firstPIMXOArg0 || transformArgs[0] !== firstTransformArg0 || transformArgs[1] !== firstTransformArg1 || transformArgs[2] !== firstTransformArg2 || transformArgs[3] !== firstTransformArg3) {
  49820. if (q < MIN_IMAGES_IN_MASKS_BLOCK) {
  49821. isSameImage = false;
  49822. } else {
  49823. count = q;
  49824. }
  49825. break;
  49826. }
  49827. }
  49828. }
  49829. if (isSameImage) {
  49830. count = Math.min(count, MAX_SAME_IMAGES_IN_MASKS_BLOCK);
  49831. const positions = new Float32Array(count * 2);
  49832. iTransform = iFirstTransform;
  49833. for (let q = 0; q < count; q++, iTransform += 4) {
  49834. transformArgs = argsArray[iTransform];
  49835. positions[q << 1] = transformArgs[4];
  49836. positions[(q << 1) + 1] = transformArgs[5];
  49837. }
  49838. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageMaskXObjectRepeat);
  49839. argsArray.splice(iFirstSave, count * 4, [firstPIMXOArg0, firstTransformArg0, firstTransformArg1, firstTransformArg2, firstTransformArg3, positions]);
  49840. } else {
  49841. count = Math.min(count, MAX_IMAGES_IN_MASKS_BLOCK);
  49842. const images = [];
  49843. for (let q = 0; q < count; q++) {
  49844. transformArgs = argsArray[iFirstTransform + (q << 2)];
  49845. const maskParams = argsArray[iFirstPIMXO + (q << 2)][0];
  49846. images.push({
  49847. data: maskParams.data,
  49848. width: maskParams.width,
  49849. height: maskParams.height,
  49850. interpolate: maskParams.interpolate,
  49851. count: maskParams.count,
  49852. transform: transformArgs
  49853. });
  49854. }
  49855. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageMaskXObjectGroup);
  49856. argsArray.splice(iFirstSave, count * 4, [images]);
  49857. }
  49858. return iFirstSave + 1;
  49859. });
  49860. addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintImageXObject, _util.OPS.restore], function (context) {
  49861. const argsArray = context.argsArray;
  49862. const iFirstTransform = context.iCurr - 2;
  49863. return argsArray[iFirstTransform][1] === 0 && argsArray[iFirstTransform][2] === 0;
  49864. }, function iterateImageGroup(context, i) {
  49865. const fnArray = context.fnArray,
  49866. argsArray = context.argsArray;
  49867. const iFirstSave = context.iCurr - 3;
  49868. const pos = (i - iFirstSave) % 4;
  49869. switch (pos) {
  49870. case 0:
  49871. return fnArray[i] === _util.OPS.save;
  49872. case 1:
  49873. if (fnArray[i] !== _util.OPS.transform) {
  49874. return false;
  49875. }
  49876. const iFirstTransform = context.iCurr - 2;
  49877. const firstTransformArg0 = argsArray[iFirstTransform][0];
  49878. const firstTransformArg3 = argsArray[iFirstTransform][3];
  49879. if (argsArray[i][0] !== firstTransformArg0 || argsArray[i][1] !== 0 || argsArray[i][2] !== 0 || argsArray[i][3] !== firstTransformArg3) {
  49880. return false;
  49881. }
  49882. return true;
  49883. case 2:
  49884. if (fnArray[i] !== _util.OPS.paintImageXObject) {
  49885. return false;
  49886. }
  49887. const iFirstPIXO = context.iCurr - 1;
  49888. const firstPIXOArg0 = argsArray[iFirstPIXO][0];
  49889. if (argsArray[i][0] !== firstPIXOArg0) {
  49890. return false;
  49891. }
  49892. return true;
  49893. case 3:
  49894. return fnArray[i] === _util.OPS.restore;
  49895. }
  49896. throw new Error(`iterateImageGroup - invalid pos: ${pos}`);
  49897. }, function (context, i) {
  49898. const MIN_IMAGES_IN_BLOCK = 3;
  49899. const MAX_IMAGES_IN_BLOCK = 1000;
  49900. const fnArray = context.fnArray,
  49901. argsArray = context.argsArray;
  49902. const curr = context.iCurr;
  49903. const iFirstSave = curr - 3;
  49904. const iFirstTransform = curr - 2;
  49905. const iFirstPIXO = curr - 1;
  49906. const firstPIXOArg0 = argsArray[iFirstPIXO][0];
  49907. const firstTransformArg0 = argsArray[iFirstTransform][0];
  49908. const firstTransformArg3 = argsArray[iFirstTransform][3];
  49909. const count = Math.min(Math.floor((i - iFirstSave) / 4), MAX_IMAGES_IN_BLOCK);
  49910. if (count < MIN_IMAGES_IN_BLOCK) {
  49911. return i - (i - iFirstSave) % 4;
  49912. }
  49913. const positions = new Float32Array(count * 2);
  49914. let iTransform = iFirstTransform;
  49915. for (let q = 0; q < count; q++, iTransform += 4) {
  49916. const transformArgs = argsArray[iTransform];
  49917. positions[q << 1] = transformArgs[4];
  49918. positions[(q << 1) + 1] = transformArgs[5];
  49919. }
  49920. const args = [firstPIXOArg0, firstTransformArg0, firstTransformArg3, positions];
  49921. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageXObjectRepeat);
  49922. argsArray.splice(iFirstSave, count * 4, args);
  49923. return iFirstSave + 1;
  49924. });
  49925. addState(InitialState, [_util.OPS.beginText, _util.OPS.setFont, _util.OPS.setTextMatrix, _util.OPS.showText, _util.OPS.endText], null, function iterateShowTextGroup(context, i) {
  49926. const fnArray = context.fnArray,
  49927. argsArray = context.argsArray;
  49928. const iFirstSave = context.iCurr - 4;
  49929. const pos = (i - iFirstSave) % 5;
  49930. switch (pos) {
  49931. case 0:
  49932. return fnArray[i] === _util.OPS.beginText;
  49933. case 1:
  49934. return fnArray[i] === _util.OPS.setFont;
  49935. case 2:
  49936. return fnArray[i] === _util.OPS.setTextMatrix;
  49937. case 3:
  49938. if (fnArray[i] !== _util.OPS.showText) {
  49939. return false;
  49940. }
  49941. const iFirstSetFont = context.iCurr - 3;
  49942. const firstSetFontArg0 = argsArray[iFirstSetFont][0];
  49943. const firstSetFontArg1 = argsArray[iFirstSetFont][1];
  49944. if (argsArray[i][0] !== firstSetFontArg0 || argsArray[i][1] !== firstSetFontArg1) {
  49945. return false;
  49946. }
  49947. return true;
  49948. case 4:
  49949. return fnArray[i] === _util.OPS.endText;
  49950. }
  49951. throw new Error(`iterateShowTextGroup - invalid pos: ${pos}`);
  49952. }, function (context, i) {
  49953. const MIN_CHARS_IN_BLOCK = 3;
  49954. const MAX_CHARS_IN_BLOCK = 1000;
  49955. const fnArray = context.fnArray,
  49956. argsArray = context.argsArray;
  49957. const curr = context.iCurr;
  49958. const iFirstBeginText = curr - 4;
  49959. const iFirstSetFont = curr - 3;
  49960. const iFirstSetTextMatrix = curr - 2;
  49961. const iFirstShowText = curr - 1;
  49962. const iFirstEndText = curr;
  49963. const firstSetFontArg0 = argsArray[iFirstSetFont][0];
  49964. const firstSetFontArg1 = argsArray[iFirstSetFont][1];
  49965. let count = Math.min(Math.floor((i - iFirstBeginText) / 5), MAX_CHARS_IN_BLOCK);
  49966. if (count < MIN_CHARS_IN_BLOCK) {
  49967. return i - (i - iFirstBeginText) % 5;
  49968. }
  49969. let iFirst = iFirstBeginText;
  49970. 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) {
  49971. count++;
  49972. iFirst -= 5;
  49973. }
  49974. let iEndText = iFirst + 4;
  49975. for (let q = 1; q < count; q++) {
  49976. fnArray.splice(iEndText, 3);
  49977. argsArray.splice(iEndText, 3);
  49978. iEndText += 2;
  49979. }
  49980. return iEndText + 1;
  49981. });
  49982. class NullOptimizer {
  49983. constructor(queue) {
  49984. this.queue = queue;
  49985. }
  49986. _optimize() {}
  49987. push(fn, args) {
  49988. this.queue.fnArray.push(fn);
  49989. this.queue.argsArray.push(args);
  49990. this._optimize();
  49991. }
  49992. flush() {}
  49993. reset() {}
  49994. }
  49995. class QueueOptimizer extends NullOptimizer {
  49996. constructor(queue) {
  49997. super(queue);
  49998. this.state = null;
  49999. this.context = {
  50000. iCurr: 0,
  50001. fnArray: queue.fnArray,
  50002. argsArray: queue.argsArray
  50003. };
  50004. this.match = null;
  50005. this.lastProcessed = 0;
  50006. }
  50007. _optimize() {
  50008. const fnArray = this.queue.fnArray;
  50009. let i = this.lastProcessed,
  50010. ii = fnArray.length;
  50011. let state = this.state;
  50012. let match = this.match;
  50013. if (!state && !match && i + 1 === ii && !InitialState[fnArray[i]]) {
  50014. this.lastProcessed = ii;
  50015. return;
  50016. }
  50017. const context = this.context;
  50018. while (i < ii) {
  50019. if (match) {
  50020. const iterate = (0, match.iterateFn)(context, i);
  50021. if (iterate) {
  50022. i++;
  50023. continue;
  50024. }
  50025. i = (0, match.processFn)(context, i + 1);
  50026. ii = fnArray.length;
  50027. match = null;
  50028. state = null;
  50029. if (i >= ii) {
  50030. break;
  50031. }
  50032. }
  50033. state = (state || InitialState)[fnArray[i]];
  50034. if (!state || Array.isArray(state)) {
  50035. i++;
  50036. continue;
  50037. }
  50038. context.iCurr = i;
  50039. i++;
  50040. if (state.checkFn && !(0, state.checkFn)(context)) {
  50041. state = null;
  50042. continue;
  50043. }
  50044. match = state;
  50045. state = null;
  50046. }
  50047. this.state = state;
  50048. this.match = match;
  50049. this.lastProcessed = i;
  50050. }
  50051. flush() {
  50052. while (this.match) {
  50053. const length = this.queue.fnArray.length;
  50054. this.lastProcessed = (0, this.match.processFn)(this.context, length);
  50055. this.match = null;
  50056. this.state = null;
  50057. this._optimize();
  50058. }
  50059. }
  50060. reset() {
  50061. this.state = null;
  50062. this.match = null;
  50063. this.lastProcessed = 0;
  50064. }
  50065. }
  50066. class OperatorList {
  50067. static get CHUNK_SIZE() {
  50068. return (0, _util.shadow)(this, "CHUNK_SIZE", 1000);
  50069. }
  50070. static get CHUNK_SIZE_ABOUT() {
  50071. return (0, _util.shadow)(this, "CHUNK_SIZE_ABOUT", this.CHUNK_SIZE - 5);
  50072. }
  50073. constructor() {
  50074. let intent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
  50075. let streamSink = arguments.length > 1 ? arguments[1] : undefined;
  50076. this._streamSink = streamSink;
  50077. this.fnArray = [];
  50078. this.argsArray = [];
  50079. if (streamSink && !(intent & _util.RenderingIntentFlag.OPLIST)) {
  50080. this.optimizer = new QueueOptimizer(this);
  50081. } else {
  50082. this.optimizer = new NullOptimizer(this);
  50083. }
  50084. this.dependencies = new Set();
  50085. this._totalLength = 0;
  50086. this.weight = 0;
  50087. this._resolved = streamSink ? null : Promise.resolve();
  50088. }
  50089. get length() {
  50090. return this.argsArray.length;
  50091. }
  50092. get ready() {
  50093. return this._resolved || this._streamSink.ready;
  50094. }
  50095. get totalLength() {
  50096. return this._totalLength + this.length;
  50097. }
  50098. addOp(fn, args) {
  50099. this.optimizer.push(fn, args);
  50100. this.weight++;
  50101. if (this._streamSink) {
  50102. if (this.weight >= OperatorList.CHUNK_SIZE) {
  50103. this.flush();
  50104. } else if (this.weight >= OperatorList.CHUNK_SIZE_ABOUT && (fn === _util.OPS.restore || fn === _util.OPS.endText)) {
  50105. this.flush();
  50106. }
  50107. }
  50108. }
  50109. addImageOps(fn, args, optionalContent) {
  50110. if (optionalContent !== undefined) {
  50111. this.addOp(_util.OPS.beginMarkedContentProps, ["OC", optionalContent]);
  50112. }
  50113. this.addOp(fn, args);
  50114. if (optionalContent !== undefined) {
  50115. this.addOp(_util.OPS.endMarkedContent, []);
  50116. }
  50117. }
  50118. addDependency(dependency) {
  50119. if (this.dependencies.has(dependency)) {
  50120. return;
  50121. }
  50122. this.dependencies.add(dependency);
  50123. this.addOp(_util.OPS.dependency, [dependency]);
  50124. }
  50125. addDependencies(dependencies) {
  50126. for (const dependency of dependencies) {
  50127. this.addDependency(dependency);
  50128. }
  50129. }
  50130. addOpList(opList) {
  50131. if (!(opList instanceof OperatorList)) {
  50132. (0, _util.warn)('addOpList - ignoring invalid "opList" parameter.');
  50133. return;
  50134. }
  50135. for (const dependency of opList.dependencies) {
  50136. this.dependencies.add(dependency);
  50137. }
  50138. for (let i = 0, ii = opList.length; i < ii; i++) {
  50139. this.addOp(opList.fnArray[i], opList.argsArray[i]);
  50140. }
  50141. }
  50142. getIR() {
  50143. return {
  50144. fnArray: this.fnArray,
  50145. argsArray: this.argsArray,
  50146. length: this.length
  50147. };
  50148. }
  50149. get _transfers() {
  50150. const transfers = [];
  50151. const {
  50152. fnArray,
  50153. argsArray,
  50154. length
  50155. } = this;
  50156. for (let i = 0; i < length; i++) {
  50157. switch (fnArray[i]) {
  50158. case _util.OPS.paintInlineImageXObject:
  50159. case _util.OPS.paintInlineImageXObjectGroup:
  50160. case _util.OPS.paintImageMaskXObject:
  50161. const arg = argsArray[i][0];
  50162. if (!arg.cached && arg.data && arg.data.buffer instanceof ArrayBuffer) {
  50163. transfers.push(arg.data.buffer);
  50164. }
  50165. break;
  50166. }
  50167. }
  50168. return transfers;
  50169. }
  50170. flush() {
  50171. let lastChunk = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  50172. let separateAnnots = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  50173. this.optimizer.flush();
  50174. const length = this.length;
  50175. this._totalLength += length;
  50176. this._streamSink.enqueue({
  50177. fnArray: this.fnArray,
  50178. argsArray: this.argsArray,
  50179. lastChunk,
  50180. separateAnnots,
  50181. length
  50182. }, 1, this._transfers);
  50183. this.dependencies.clear();
  50184. this.fnArray.length = 0;
  50185. this.argsArray.length = 0;
  50186. this.weight = 0;
  50187. this.optimizer.reset();
  50188. }
  50189. }
  50190. exports.OperatorList = OperatorList;
  50191. /***/ }),
  50192. /* 192 */
  50193. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  50194. "use strict";
  50195. Object.defineProperty(exports, "__esModule", ({
  50196. value: true
  50197. }));
  50198. exports.PDFImage = void 0;
  50199. var _util = __w_pdfjs_require__(2);
  50200. var _image_utils = __w_pdfjs_require__(193);
  50201. var _base_stream = __w_pdfjs_require__(136);
  50202. var _colorspace = __w_pdfjs_require__(143);
  50203. var _decode_stream = __w_pdfjs_require__(148);
  50204. var _jpeg_stream = __w_pdfjs_require__(156);
  50205. var _jpx = __w_pdfjs_require__(159);
  50206. var _primitives = __w_pdfjs_require__(134);
  50207. function decodeAndClamp(value, addend, coefficient, max) {
  50208. value = addend + value * coefficient;
  50209. if (value < 0) {
  50210. value = 0;
  50211. } else if (value > max) {
  50212. value = max;
  50213. }
  50214. return value;
  50215. }
  50216. function resizeImageMask(src, bpc, w1, h1, w2, h2) {
  50217. const length = w2 * h2;
  50218. let dest;
  50219. if (bpc <= 8) {
  50220. dest = new Uint8Array(length);
  50221. } else if (bpc <= 16) {
  50222. dest = new Uint16Array(length);
  50223. } else {
  50224. dest = new Uint32Array(length);
  50225. }
  50226. const xRatio = w1 / w2;
  50227. const yRatio = h1 / h2;
  50228. let i,
  50229. j,
  50230. py,
  50231. newIndex = 0,
  50232. oldIndex;
  50233. const xScaled = new Uint16Array(w2);
  50234. const w1Scanline = w1;
  50235. for (i = 0; i < w2; i++) {
  50236. xScaled[i] = Math.floor(i * xRatio);
  50237. }
  50238. for (i = 0; i < h2; i++) {
  50239. py = Math.floor(i * yRatio) * w1Scanline;
  50240. for (j = 0; j < w2; j++) {
  50241. oldIndex = py + xScaled[j];
  50242. dest[newIndex++] = src[oldIndex];
  50243. }
  50244. }
  50245. return dest;
  50246. }
  50247. class PDFImage {
  50248. constructor(_ref) {
  50249. let {
  50250. xref,
  50251. res,
  50252. image,
  50253. isInline = false,
  50254. smask = null,
  50255. mask = null,
  50256. isMask = false,
  50257. pdfFunctionFactory,
  50258. localColorSpaceCache
  50259. } = _ref;
  50260. this.image = image;
  50261. const dict = image.dict;
  50262. const filter = dict.get("F", "Filter");
  50263. let filterName;
  50264. if (filter instanceof _primitives.Name) {
  50265. filterName = filter.name;
  50266. } else if (Array.isArray(filter)) {
  50267. const filterZero = xref.fetchIfRef(filter[0]);
  50268. if (filterZero instanceof _primitives.Name) {
  50269. filterName = filterZero.name;
  50270. }
  50271. }
  50272. switch (filterName) {
  50273. case "JPXDecode":
  50274. const jpxImage = new _jpx.JpxImage();
  50275. jpxImage.parseImageProperties(image.stream);
  50276. image.stream.reset();
  50277. image.width = jpxImage.width;
  50278. image.height = jpxImage.height;
  50279. image.bitsPerComponent = jpxImage.bitsPerComponent;
  50280. image.numComps = jpxImage.componentsCount;
  50281. break;
  50282. case "JBIG2Decode":
  50283. image.bitsPerComponent = 1;
  50284. image.numComps = 1;
  50285. break;
  50286. }
  50287. let width = dict.get("W", "Width");
  50288. let height = dict.get("H", "Height");
  50289. if (Number.isInteger(image.width) && image.width > 0 && Number.isInteger(image.height) && image.height > 0 && (image.width !== width || image.height !== height)) {
  50290. (0, _util.warn)("PDFImage - using the Width/Height of the image data, " + "rather than the image dictionary.");
  50291. width = image.width;
  50292. height = image.height;
  50293. }
  50294. if (width < 1 || height < 1) {
  50295. throw new _util.FormatError(`Invalid image width: ${width} or height: ${height}`);
  50296. }
  50297. this.width = width;
  50298. this.height = height;
  50299. this.interpolate = dict.get("I", "Interpolate");
  50300. this.imageMask = dict.get("IM", "ImageMask") || false;
  50301. this.matte = dict.get("Matte") || false;
  50302. let bitsPerComponent = image.bitsPerComponent;
  50303. if (!bitsPerComponent) {
  50304. bitsPerComponent = dict.get("BPC", "BitsPerComponent");
  50305. if (!bitsPerComponent) {
  50306. if (this.imageMask) {
  50307. bitsPerComponent = 1;
  50308. } else {
  50309. throw new _util.FormatError(`Bits per component missing in image: ${this.imageMask}`);
  50310. }
  50311. }
  50312. }
  50313. this.bpc = bitsPerComponent;
  50314. if (!this.imageMask) {
  50315. let colorSpace = dict.getRaw("CS") || dict.getRaw("ColorSpace");
  50316. if (!colorSpace) {
  50317. (0, _util.info)("JPX images (which do not require color spaces)");
  50318. switch (image.numComps) {
  50319. case 1:
  50320. colorSpace = _primitives.Name.get("DeviceGray");
  50321. break;
  50322. case 3:
  50323. colorSpace = _primitives.Name.get("DeviceRGB");
  50324. break;
  50325. case 4:
  50326. colorSpace = _primitives.Name.get("DeviceCMYK");
  50327. break;
  50328. default:
  50329. throw new Error(`JPX images with ${image.numComps} color components not supported.`);
  50330. }
  50331. }
  50332. this.colorSpace = _colorspace.ColorSpace.parse({
  50333. cs: colorSpace,
  50334. xref,
  50335. resources: isInline ? res : null,
  50336. pdfFunctionFactory,
  50337. localColorSpaceCache
  50338. });
  50339. this.numComps = this.colorSpace.numComps;
  50340. }
  50341. this.decode = dict.getArray("D", "Decode");
  50342. this.needsDecode = false;
  50343. if (this.decode && (this.colorSpace && !this.colorSpace.isDefaultDecode(this.decode, bitsPerComponent) || isMask && !_colorspace.ColorSpace.isDefaultDecode(this.decode, 1))) {
  50344. this.needsDecode = true;
  50345. const max = (1 << bitsPerComponent) - 1;
  50346. this.decodeCoefficients = [];
  50347. this.decodeAddends = [];
  50348. const isIndexed = this.colorSpace && this.colorSpace.name === "Indexed";
  50349. for (let i = 0, j = 0; i < this.decode.length; i += 2, ++j) {
  50350. const dmin = this.decode[i];
  50351. const dmax = this.decode[i + 1];
  50352. this.decodeCoefficients[j] = isIndexed ? (dmax - dmin) / max : dmax - dmin;
  50353. this.decodeAddends[j] = isIndexed ? dmin : max * dmin;
  50354. }
  50355. }
  50356. if (smask) {
  50357. this.smask = new PDFImage({
  50358. xref,
  50359. res,
  50360. image: smask,
  50361. isInline,
  50362. pdfFunctionFactory,
  50363. localColorSpaceCache
  50364. });
  50365. } else if (mask) {
  50366. if (mask instanceof _base_stream.BaseStream) {
  50367. const maskDict = mask.dict,
  50368. imageMask = maskDict.get("IM", "ImageMask");
  50369. if (!imageMask) {
  50370. (0, _util.warn)("Ignoring /Mask in image without /ImageMask.");
  50371. } else {
  50372. this.mask = new PDFImage({
  50373. xref,
  50374. res,
  50375. image: mask,
  50376. isInline,
  50377. isMask: true,
  50378. pdfFunctionFactory,
  50379. localColorSpaceCache
  50380. });
  50381. }
  50382. } else {
  50383. this.mask = mask;
  50384. }
  50385. }
  50386. }
  50387. static async buildImage(_ref2) {
  50388. let {
  50389. xref,
  50390. res,
  50391. image,
  50392. isInline = false,
  50393. pdfFunctionFactory,
  50394. localColorSpaceCache
  50395. } = _ref2;
  50396. const imageData = image;
  50397. let smaskData = null;
  50398. let maskData = null;
  50399. const smask = image.dict.get("SMask");
  50400. const mask = image.dict.get("Mask");
  50401. if (smask) {
  50402. if (smask instanceof _base_stream.BaseStream) {
  50403. smaskData = smask;
  50404. } else {
  50405. (0, _util.warn)("Unsupported /SMask format.");
  50406. }
  50407. } else if (mask) {
  50408. if (mask instanceof _base_stream.BaseStream || Array.isArray(mask)) {
  50409. maskData = mask;
  50410. } else {
  50411. (0, _util.warn)("Unsupported /Mask format.");
  50412. }
  50413. }
  50414. return new PDFImage({
  50415. xref,
  50416. res,
  50417. image: imageData,
  50418. isInline,
  50419. smask: smaskData,
  50420. mask: maskData,
  50421. pdfFunctionFactory,
  50422. localColorSpaceCache
  50423. });
  50424. }
  50425. static createRawMask(_ref3) {
  50426. let {
  50427. imgArray,
  50428. width,
  50429. height,
  50430. imageIsFromDecodeStream,
  50431. inverseDecode,
  50432. interpolate
  50433. } = _ref3;
  50434. const computedLength = (width + 7 >> 3) * height;
  50435. const actualLength = imgArray.byteLength;
  50436. const haveFullData = computedLength === actualLength;
  50437. let data, i;
  50438. if (imageIsFromDecodeStream && (!inverseDecode || haveFullData)) {
  50439. data = imgArray;
  50440. } else if (!inverseDecode) {
  50441. data = new Uint8Array(imgArray);
  50442. } else {
  50443. data = new Uint8Array(computedLength);
  50444. data.set(imgArray);
  50445. data.fill(0xff, actualLength);
  50446. }
  50447. if (inverseDecode) {
  50448. for (i = 0; i < actualLength; i++) {
  50449. data[i] ^= 0xff;
  50450. }
  50451. }
  50452. return {
  50453. data,
  50454. width,
  50455. height,
  50456. interpolate
  50457. };
  50458. }
  50459. static createMask(_ref4) {
  50460. let {
  50461. imgArray,
  50462. width,
  50463. height,
  50464. imageIsFromDecodeStream,
  50465. inverseDecode,
  50466. interpolate,
  50467. isOffscreenCanvasSupported = true
  50468. } = _ref4;
  50469. const isSingleOpaquePixel = width === 1 && height === 1 && inverseDecode === (imgArray.length === 0 || !!(imgArray[0] & 128));
  50470. if (isSingleOpaquePixel) {
  50471. return {
  50472. isSingleOpaquePixel
  50473. };
  50474. }
  50475. if (isOffscreenCanvasSupported && _util.FeatureTest.isOffscreenCanvasSupported) {
  50476. const canvas = new OffscreenCanvas(width, height);
  50477. const ctx = canvas.getContext("2d");
  50478. const imgData = ctx.createImageData(width, height);
  50479. (0, _image_utils.applyMaskImageData)({
  50480. src: imgArray,
  50481. dest: imgData.data,
  50482. width,
  50483. height,
  50484. inverseDecode
  50485. });
  50486. ctx.putImageData(imgData, 0, 0);
  50487. const bitmap = canvas.transferToImageBitmap();
  50488. return {
  50489. data: null,
  50490. width,
  50491. height,
  50492. interpolate,
  50493. bitmap
  50494. };
  50495. }
  50496. return this.createRawMask({
  50497. imgArray,
  50498. width,
  50499. height,
  50500. inverseDecode,
  50501. imageIsFromDecodeStream,
  50502. interpolate
  50503. });
  50504. }
  50505. get drawWidth() {
  50506. return Math.max(this.width, this.smask && this.smask.width || 0, this.mask && this.mask.width || 0);
  50507. }
  50508. get drawHeight() {
  50509. return Math.max(this.height, this.smask && this.smask.height || 0, this.mask && this.mask.height || 0);
  50510. }
  50511. decodeBuffer(buffer) {
  50512. const bpc = this.bpc;
  50513. const numComps = this.numComps;
  50514. const decodeAddends = this.decodeAddends;
  50515. const decodeCoefficients = this.decodeCoefficients;
  50516. const max = (1 << bpc) - 1;
  50517. let i, ii;
  50518. if (bpc === 1) {
  50519. for (i = 0, ii = buffer.length; i < ii; i++) {
  50520. buffer[i] = +!buffer[i];
  50521. }
  50522. return;
  50523. }
  50524. let index = 0;
  50525. for (i = 0, ii = this.width * this.height; i < ii; i++) {
  50526. for (let j = 0; j < numComps; j++) {
  50527. buffer[index] = decodeAndClamp(buffer[index], decodeAddends[j], decodeCoefficients[j], max);
  50528. index++;
  50529. }
  50530. }
  50531. }
  50532. getComponents(buffer) {
  50533. const bpc = this.bpc;
  50534. if (bpc === 8) {
  50535. return buffer;
  50536. }
  50537. const width = this.width;
  50538. const height = this.height;
  50539. const numComps = this.numComps;
  50540. const length = width * height * numComps;
  50541. let bufferPos = 0;
  50542. let output;
  50543. if (bpc <= 8) {
  50544. output = new Uint8Array(length);
  50545. } else if (bpc <= 16) {
  50546. output = new Uint16Array(length);
  50547. } else {
  50548. output = new Uint32Array(length);
  50549. }
  50550. const rowComps = width * numComps;
  50551. const max = (1 << bpc) - 1;
  50552. let i = 0,
  50553. ii,
  50554. buf;
  50555. if (bpc === 1) {
  50556. let mask, loop1End, loop2End;
  50557. for (let j = 0; j < height; j++) {
  50558. loop1End = i + (rowComps & ~7);
  50559. loop2End = i + rowComps;
  50560. while (i < loop1End) {
  50561. buf = buffer[bufferPos++];
  50562. output[i] = buf >> 7 & 1;
  50563. output[i + 1] = buf >> 6 & 1;
  50564. output[i + 2] = buf >> 5 & 1;
  50565. output[i + 3] = buf >> 4 & 1;
  50566. output[i + 4] = buf >> 3 & 1;
  50567. output[i + 5] = buf >> 2 & 1;
  50568. output[i + 6] = buf >> 1 & 1;
  50569. output[i + 7] = buf & 1;
  50570. i += 8;
  50571. }
  50572. if (i < loop2End) {
  50573. buf = buffer[bufferPos++];
  50574. mask = 128;
  50575. while (i < loop2End) {
  50576. output[i++] = +!!(buf & mask);
  50577. mask >>= 1;
  50578. }
  50579. }
  50580. }
  50581. } else {
  50582. let bits = 0;
  50583. buf = 0;
  50584. for (i = 0, ii = length; i < ii; ++i) {
  50585. if (i % rowComps === 0) {
  50586. buf = 0;
  50587. bits = 0;
  50588. }
  50589. while (bits < bpc) {
  50590. buf = buf << 8 | buffer[bufferPos++];
  50591. bits += 8;
  50592. }
  50593. const remainingBits = bits - bpc;
  50594. let value = buf >> remainingBits;
  50595. if (value < 0) {
  50596. value = 0;
  50597. } else if (value > max) {
  50598. value = max;
  50599. }
  50600. output[i] = value;
  50601. buf &= (1 << remainingBits) - 1;
  50602. bits = remainingBits;
  50603. }
  50604. }
  50605. return output;
  50606. }
  50607. fillOpacity(rgbaBuf, width, height, actualHeight, image) {
  50608. const smask = this.smask;
  50609. const mask = this.mask;
  50610. let alphaBuf, sw, sh, i, ii, j;
  50611. if (smask) {
  50612. sw = smask.width;
  50613. sh = smask.height;
  50614. alphaBuf = new Uint8ClampedArray(sw * sh);
  50615. smask.fillGrayBuffer(alphaBuf);
  50616. if (sw !== width || sh !== height) {
  50617. alphaBuf = resizeImageMask(alphaBuf, smask.bpc, sw, sh, width, height);
  50618. }
  50619. } else if (mask) {
  50620. if (mask instanceof PDFImage) {
  50621. sw = mask.width;
  50622. sh = mask.height;
  50623. alphaBuf = new Uint8ClampedArray(sw * sh);
  50624. mask.numComps = 1;
  50625. mask.fillGrayBuffer(alphaBuf);
  50626. for (i = 0, ii = sw * sh; i < ii; ++i) {
  50627. alphaBuf[i] = 255 - alphaBuf[i];
  50628. }
  50629. if (sw !== width || sh !== height) {
  50630. alphaBuf = resizeImageMask(alphaBuf, mask.bpc, sw, sh, width, height);
  50631. }
  50632. } else if (Array.isArray(mask)) {
  50633. alphaBuf = new Uint8ClampedArray(width * height);
  50634. const numComps = this.numComps;
  50635. for (i = 0, ii = width * height; i < ii; ++i) {
  50636. let opacity = 0;
  50637. const imageOffset = i * numComps;
  50638. for (j = 0; j < numComps; ++j) {
  50639. const color = image[imageOffset + j];
  50640. const maskOffset = j * 2;
  50641. if (color < mask[maskOffset] || color > mask[maskOffset + 1]) {
  50642. opacity = 255;
  50643. break;
  50644. }
  50645. }
  50646. alphaBuf[i] = opacity;
  50647. }
  50648. } else {
  50649. throw new _util.FormatError("Unknown mask format.");
  50650. }
  50651. }
  50652. if (alphaBuf) {
  50653. for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
  50654. rgbaBuf[j] = alphaBuf[i];
  50655. }
  50656. } else {
  50657. for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
  50658. rgbaBuf[j] = 255;
  50659. }
  50660. }
  50661. }
  50662. undoPreblend(buffer, width, height) {
  50663. const matte = this.smask && this.smask.matte;
  50664. if (!matte) {
  50665. return;
  50666. }
  50667. const matteRgb = this.colorSpace.getRgb(matte, 0);
  50668. const matteR = matteRgb[0];
  50669. const matteG = matteRgb[1];
  50670. const matteB = matteRgb[2];
  50671. const length = width * height * 4;
  50672. for (let i = 0; i < length; i += 4) {
  50673. const alpha = buffer[i + 3];
  50674. if (alpha === 0) {
  50675. buffer[i] = 255;
  50676. buffer[i + 1] = 255;
  50677. buffer[i + 2] = 255;
  50678. continue;
  50679. }
  50680. const k = 255 / alpha;
  50681. buffer[i] = (buffer[i] - matteR) * k + matteR;
  50682. buffer[i + 1] = (buffer[i + 1] - matteG) * k + matteG;
  50683. buffer[i + 2] = (buffer[i + 2] - matteB) * k + matteB;
  50684. }
  50685. }
  50686. createImageData() {
  50687. let forceRGBA = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  50688. const drawWidth = this.drawWidth;
  50689. const drawHeight = this.drawHeight;
  50690. const imgData = {
  50691. width: drawWidth,
  50692. height: drawHeight,
  50693. interpolate: this.interpolate,
  50694. kind: 0,
  50695. data: null
  50696. };
  50697. const numComps = this.numComps;
  50698. const originalWidth = this.width;
  50699. const originalHeight = this.height;
  50700. const bpc = this.bpc;
  50701. const rowBytes = originalWidth * numComps * bpc + 7 >> 3;
  50702. if (!forceRGBA) {
  50703. let kind;
  50704. if (this.colorSpace.name === "DeviceGray" && bpc === 1) {
  50705. kind = _util.ImageKind.GRAYSCALE_1BPP;
  50706. } else if (this.colorSpace.name === "DeviceRGB" && bpc === 8 && !this.needsDecode) {
  50707. kind = _util.ImageKind.RGB_24BPP;
  50708. }
  50709. if (kind && !this.smask && !this.mask && drawWidth === originalWidth && drawHeight === originalHeight) {
  50710. imgData.kind = kind;
  50711. imgData.data = this.getImageBytes(originalHeight * rowBytes, {});
  50712. if (this.needsDecode) {
  50713. (0, _util.assert)(kind === _util.ImageKind.GRAYSCALE_1BPP, "PDFImage.createImageData: The image must be grayscale.");
  50714. const buffer = imgData.data;
  50715. for (let i = 0, ii = buffer.length; i < ii; i++) {
  50716. buffer[i] ^= 0xff;
  50717. }
  50718. }
  50719. return imgData;
  50720. }
  50721. if (this.image instanceof _jpeg_stream.JpegStream && !this.smask && !this.mask) {
  50722. let imageLength = originalHeight * rowBytes;
  50723. switch (this.colorSpace.name) {
  50724. case "DeviceGray":
  50725. imageLength *= 3;
  50726. case "DeviceRGB":
  50727. case "DeviceCMYK":
  50728. imgData.kind = _util.ImageKind.RGB_24BPP;
  50729. imgData.data = this.getImageBytes(imageLength, {
  50730. drawWidth,
  50731. drawHeight,
  50732. forceRGB: true
  50733. });
  50734. return imgData;
  50735. }
  50736. }
  50737. }
  50738. const imgArray = this.getImageBytes(originalHeight * rowBytes, {
  50739. internal: true
  50740. });
  50741. const actualHeight = 0 | imgArray.length / rowBytes * drawHeight / originalHeight;
  50742. const comps = this.getComponents(imgArray);
  50743. let alpha01, maybeUndoPreblend;
  50744. if (!forceRGBA && !this.smask && !this.mask) {
  50745. imgData.kind = _util.ImageKind.RGB_24BPP;
  50746. imgData.data = new Uint8ClampedArray(drawWidth * drawHeight * 3);
  50747. alpha01 = 0;
  50748. maybeUndoPreblend = false;
  50749. } else {
  50750. imgData.kind = _util.ImageKind.RGBA_32BPP;
  50751. imgData.data = new Uint8ClampedArray(drawWidth * drawHeight * 4);
  50752. alpha01 = 1;
  50753. maybeUndoPreblend = true;
  50754. this.fillOpacity(imgData.data, drawWidth, drawHeight, actualHeight, comps);
  50755. }
  50756. if (this.needsDecode) {
  50757. this.decodeBuffer(comps);
  50758. }
  50759. this.colorSpace.fillRgb(imgData.data, originalWidth, originalHeight, drawWidth, drawHeight, actualHeight, bpc, comps, alpha01);
  50760. if (maybeUndoPreblend) {
  50761. this.undoPreblend(imgData.data, drawWidth, actualHeight);
  50762. }
  50763. return imgData;
  50764. }
  50765. fillGrayBuffer(buffer) {
  50766. const numComps = this.numComps;
  50767. if (numComps !== 1) {
  50768. throw new _util.FormatError(`Reading gray scale from a color image: ${numComps}`);
  50769. }
  50770. const width = this.width;
  50771. const height = this.height;
  50772. const bpc = this.bpc;
  50773. const rowBytes = width * numComps * bpc + 7 >> 3;
  50774. const imgArray = this.getImageBytes(height * rowBytes, {
  50775. internal: true
  50776. });
  50777. const comps = this.getComponents(imgArray);
  50778. let i, length;
  50779. if (bpc === 1) {
  50780. length = width * height;
  50781. if (this.needsDecode) {
  50782. for (i = 0; i < length; ++i) {
  50783. buffer[i] = comps[i] - 1 & 255;
  50784. }
  50785. } else {
  50786. for (i = 0; i < length; ++i) {
  50787. buffer[i] = -comps[i] & 255;
  50788. }
  50789. }
  50790. return;
  50791. }
  50792. if (this.needsDecode) {
  50793. this.decodeBuffer(comps);
  50794. }
  50795. length = width * height;
  50796. const scale = 255 / ((1 << bpc) - 1);
  50797. for (i = 0; i < length; ++i) {
  50798. buffer[i] = scale * comps[i];
  50799. }
  50800. }
  50801. getImageBytes(length, _ref5) {
  50802. let {
  50803. drawWidth,
  50804. drawHeight,
  50805. forceRGB = false,
  50806. internal = false
  50807. } = _ref5;
  50808. this.image.reset();
  50809. this.image.drawWidth = drawWidth || this.width;
  50810. this.image.drawHeight = drawHeight || this.height;
  50811. this.image.forceRGB = !!forceRGB;
  50812. const imageBytes = this.image.getBytes(length);
  50813. if (internal || this.image instanceof _decode_stream.DecodeStream) {
  50814. return imageBytes;
  50815. }
  50816. (0, _util.assert)(imageBytes instanceof Uint8Array, 'PDFImage.getImageBytes: Unsupported "imageBytes" type.');
  50817. return new Uint8Array(imageBytes);
  50818. }
  50819. }
  50820. exports.PDFImage = PDFImage;
  50821. /***/ }),
  50822. /* 193 */
  50823. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  50824. "use strict";
  50825. Object.defineProperty(exports, "__esModule", ({
  50826. value: true
  50827. }));
  50828. exports.applyMaskImageData = applyMaskImageData;
  50829. var _util = __w_pdfjs_require__(2);
  50830. function applyMaskImageData(_ref) {
  50831. let {
  50832. src,
  50833. srcPos = 0,
  50834. dest,
  50835. destPos = 0,
  50836. width,
  50837. height,
  50838. inverseDecode = false
  50839. } = _ref;
  50840. const opaque = _util.FeatureTest.isLittleEndian ? 0xff000000 : 0x000000ff;
  50841. const [zeroMapping, oneMapping] = !inverseDecode ? [opaque, 0] : [0, opaque];
  50842. const widthInSource = width >> 3;
  50843. const widthRemainder = width & 7;
  50844. const srcLength = src.length;
  50845. dest = new Uint32Array(dest.buffer);
  50846. for (let i = 0; i < height; i++) {
  50847. for (const max = srcPos + widthInSource; srcPos < max; srcPos++) {
  50848. const elem = srcPos < srcLength ? src[srcPos] : 255;
  50849. dest[destPos++] = elem & 0b10000000 ? oneMapping : zeroMapping;
  50850. dest[destPos++] = elem & 0b1000000 ? oneMapping : zeroMapping;
  50851. dest[destPos++] = elem & 0b100000 ? oneMapping : zeroMapping;
  50852. dest[destPos++] = elem & 0b10000 ? oneMapping : zeroMapping;
  50853. dest[destPos++] = elem & 0b1000 ? oneMapping : zeroMapping;
  50854. dest[destPos++] = elem & 0b100 ? oneMapping : zeroMapping;
  50855. dest[destPos++] = elem & 0b10 ? oneMapping : zeroMapping;
  50856. dest[destPos++] = elem & 0b1 ? oneMapping : zeroMapping;
  50857. }
  50858. if (widthRemainder === 0) {
  50859. continue;
  50860. }
  50861. const elem = srcPos < srcLength ? src[srcPos++] : 255;
  50862. for (let j = 0; j < widthRemainder; j++) {
  50863. dest[destPos++] = elem & 1 << 7 - j ? oneMapping : zeroMapping;
  50864. }
  50865. }
  50866. return {
  50867. srcPos,
  50868. destPos
  50869. };
  50870. }
  50871. /***/ }),
  50872. /* 194 */
  50873. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  50874. "use strict";
  50875. Object.defineProperty(exports, "__esModule", ({
  50876. value: true
  50877. }));
  50878. exports.incrementalUpdate = incrementalUpdate;
  50879. exports.writeDict = writeDict;
  50880. exports.writeObject = writeObject;
  50881. var _util = __w_pdfjs_require__(2);
  50882. var _primitives = __w_pdfjs_require__(134);
  50883. var _core_utils = __w_pdfjs_require__(135);
  50884. var _xml_parser = __w_pdfjs_require__(195);
  50885. var _base_stream = __w_pdfjs_require__(136);
  50886. var _crypto = __w_pdfjs_require__(196);
  50887. function writeObject(ref, obj, buffer, transform) {
  50888. buffer.push(`${ref.num} ${ref.gen} obj\n`);
  50889. if (obj instanceof _primitives.Dict) {
  50890. writeDict(obj, buffer, transform);
  50891. } else if (obj instanceof _base_stream.BaseStream) {
  50892. writeStream(obj, buffer, transform);
  50893. }
  50894. buffer.push("\nendobj\n");
  50895. }
  50896. function writeDict(dict, buffer, transform) {
  50897. buffer.push("<<");
  50898. for (const key of dict.getKeys()) {
  50899. buffer.push(` /${(0, _core_utils.escapePDFName)(key)} `);
  50900. writeValue(dict.getRaw(key), buffer, transform);
  50901. }
  50902. buffer.push(">>");
  50903. }
  50904. function writeStream(stream, buffer, transform) {
  50905. writeDict(stream.dict, buffer, transform);
  50906. buffer.push(" stream\n");
  50907. let string = stream.getString();
  50908. if (transform !== null) {
  50909. string = transform.encryptString(string);
  50910. }
  50911. buffer.push(string, "\nendstream");
  50912. }
  50913. function writeArray(array, buffer, transform) {
  50914. buffer.push("[");
  50915. let first = true;
  50916. for (const val of array) {
  50917. if (!first) {
  50918. buffer.push(" ");
  50919. } else {
  50920. first = false;
  50921. }
  50922. writeValue(val, buffer, transform);
  50923. }
  50924. buffer.push("]");
  50925. }
  50926. function writeValue(value, buffer, transform) {
  50927. if (value instanceof _primitives.Name) {
  50928. buffer.push(`/${(0, _core_utils.escapePDFName)(value.name)}`);
  50929. } else if (value instanceof _primitives.Ref) {
  50930. buffer.push(`${value.num} ${value.gen} R`);
  50931. } else if (Array.isArray(value)) {
  50932. writeArray(value, buffer, transform);
  50933. } else if (typeof value === "string") {
  50934. if (transform !== null) {
  50935. value = transform.encryptString(value);
  50936. }
  50937. buffer.push(`(${(0, _core_utils.escapeString)(value)})`);
  50938. } else if (typeof value === "number") {
  50939. buffer.push((0, _core_utils.numberToString)(value));
  50940. } else if (typeof value === "boolean") {
  50941. buffer.push(value.toString());
  50942. } else if (value instanceof _primitives.Dict) {
  50943. writeDict(value, buffer, transform);
  50944. } else if (value instanceof _base_stream.BaseStream) {
  50945. writeStream(value, buffer, transform);
  50946. } else if (value === null) {
  50947. buffer.push("null");
  50948. } else {
  50949. (0, _util.warn)(`Unhandled value in writer: ${typeof value}, please file a bug.`);
  50950. }
  50951. }
  50952. function writeInt(number, size, offset, buffer) {
  50953. for (let i = size + offset - 1; i > offset - 1; i--) {
  50954. buffer[i] = number & 0xff;
  50955. number >>= 8;
  50956. }
  50957. return offset + size;
  50958. }
  50959. function writeString(string, offset, buffer) {
  50960. for (let i = 0, len = string.length; i < len; i++) {
  50961. buffer[offset + i] = string.charCodeAt(i) & 0xff;
  50962. }
  50963. }
  50964. function computeMD5(filesize, xrefInfo) {
  50965. const time = Math.floor(Date.now() / 1000);
  50966. const filename = xrefInfo.filename || "";
  50967. const md5Buffer = [time.toString(), filename, filesize.toString()];
  50968. let md5BufferLen = md5Buffer.reduce((a, str) => a + str.length, 0);
  50969. for (const value of Object.values(xrefInfo.info)) {
  50970. md5Buffer.push(value);
  50971. md5BufferLen += value.length;
  50972. }
  50973. const array = new Uint8Array(md5BufferLen);
  50974. let offset = 0;
  50975. for (const str of md5Buffer) {
  50976. writeString(str, offset, array);
  50977. offset += str.length;
  50978. }
  50979. return (0, _util.bytesToString)((0, _crypto.calculateMD5)(array));
  50980. }
  50981. function writeXFADataForAcroform(str, newRefs) {
  50982. const xml = new _xml_parser.SimpleXMLParser({
  50983. hasAttributes: true
  50984. }).parseFromString(str);
  50985. for (const {
  50986. xfa
  50987. } of newRefs) {
  50988. if (!xfa) {
  50989. continue;
  50990. }
  50991. const {
  50992. path,
  50993. value
  50994. } = xfa;
  50995. if (!path) {
  50996. continue;
  50997. }
  50998. const node = xml.documentElement.searchNode((0, _core_utils.parseXFAPath)(path), 0);
  50999. if (node) {
  51000. if (Array.isArray(value)) {
  51001. node.childNodes = value.map(val => new _xml_parser.SimpleDOMNode("value", val));
  51002. } else {
  51003. node.childNodes = [new _xml_parser.SimpleDOMNode("#text", value)];
  51004. }
  51005. } else {
  51006. (0, _util.warn)(`Node not found for path: ${path}`);
  51007. }
  51008. }
  51009. const buffer = [];
  51010. xml.documentElement.dump(buffer);
  51011. return buffer.join("");
  51012. }
  51013. function updateAcroform(_ref) {
  51014. let {
  51015. xref,
  51016. acroForm,
  51017. acroFormRef,
  51018. hasXfa,
  51019. hasXfaDatasetsEntry,
  51020. xfaDatasetsRef,
  51021. needAppearances,
  51022. newRefs
  51023. } = _ref;
  51024. if (hasXfa && !hasXfaDatasetsEntry && !xfaDatasetsRef) {
  51025. (0, _util.warn)("XFA - Cannot save it");
  51026. }
  51027. if (!needAppearances && (!hasXfa || !xfaDatasetsRef)) {
  51028. return;
  51029. }
  51030. const dict = new _primitives.Dict(xref);
  51031. for (const key of acroForm.getKeys()) {
  51032. dict.set(key, acroForm.getRaw(key));
  51033. }
  51034. if (hasXfa && !hasXfaDatasetsEntry) {
  51035. const newXfa = acroForm.get("XFA").slice();
  51036. newXfa.splice(2, 0, "datasets");
  51037. newXfa.splice(3, 0, xfaDatasetsRef);
  51038. dict.set("XFA", newXfa);
  51039. }
  51040. if (needAppearances) {
  51041. dict.set("NeedAppearances", true);
  51042. }
  51043. const encrypt = xref.encrypt;
  51044. let transform = null;
  51045. if (encrypt) {
  51046. transform = encrypt.createCipherTransform(acroFormRef.num, acroFormRef.gen);
  51047. }
  51048. const buffer = [];
  51049. writeObject(acroFormRef, dict, buffer, transform);
  51050. newRefs.push({
  51051. ref: acroFormRef,
  51052. data: buffer.join("")
  51053. });
  51054. }
  51055. function updateXFA(_ref2) {
  51056. let {
  51057. xfaData,
  51058. xfaDatasetsRef,
  51059. newRefs,
  51060. xref
  51061. } = _ref2;
  51062. if (xfaData === null) {
  51063. const datasets = xref.fetchIfRef(xfaDatasetsRef);
  51064. xfaData = writeXFADataForAcroform(datasets.getString(), newRefs);
  51065. }
  51066. const encrypt = xref.encrypt;
  51067. if (encrypt) {
  51068. const transform = encrypt.createCipherTransform(xfaDatasetsRef.num, xfaDatasetsRef.gen);
  51069. xfaData = transform.encryptString(xfaData);
  51070. }
  51071. const data = `${xfaDatasetsRef.num} ${xfaDatasetsRef.gen} obj\n` + `<< /Type /EmbeddedFile /Length ${xfaData.length}>>\nstream\n` + xfaData + "\nendstream\nendobj\n";
  51072. newRefs.push({
  51073. ref: xfaDatasetsRef,
  51074. data
  51075. });
  51076. }
  51077. function incrementalUpdate(_ref3) {
  51078. let {
  51079. originalData,
  51080. xrefInfo,
  51081. newRefs,
  51082. xref = null,
  51083. hasXfa = false,
  51084. xfaDatasetsRef = null,
  51085. hasXfaDatasetsEntry = false,
  51086. needAppearances,
  51087. acroFormRef = null,
  51088. acroForm = null,
  51089. xfaData = null
  51090. } = _ref3;
  51091. updateAcroform({
  51092. xref,
  51093. acroForm,
  51094. acroFormRef,
  51095. hasXfa,
  51096. hasXfaDatasetsEntry,
  51097. xfaDatasetsRef,
  51098. needAppearances,
  51099. newRefs
  51100. });
  51101. if (hasXfa) {
  51102. updateXFA({
  51103. xfaData,
  51104. xfaDatasetsRef,
  51105. newRefs,
  51106. xref
  51107. });
  51108. }
  51109. const newXref = new _primitives.Dict(null);
  51110. const refForXrefTable = xrefInfo.newRef;
  51111. let buffer, baseOffset;
  51112. const lastByte = originalData.at(-1);
  51113. if (lastByte === 0x0a || lastByte === 0x0d) {
  51114. buffer = [];
  51115. baseOffset = originalData.length;
  51116. } else {
  51117. buffer = ["\n"];
  51118. baseOffset = originalData.length + 1;
  51119. }
  51120. newXref.set("Size", refForXrefTable.num + 1);
  51121. newXref.set("Prev", xrefInfo.startXRef);
  51122. newXref.set("Type", _primitives.Name.get("XRef"));
  51123. if (xrefInfo.rootRef !== null) {
  51124. newXref.set("Root", xrefInfo.rootRef);
  51125. }
  51126. if (xrefInfo.infoRef !== null) {
  51127. newXref.set("Info", xrefInfo.infoRef);
  51128. }
  51129. if (xrefInfo.encryptRef !== null) {
  51130. newXref.set("Encrypt", xrefInfo.encryptRef);
  51131. }
  51132. newRefs.push({
  51133. ref: refForXrefTable,
  51134. data: ""
  51135. });
  51136. newRefs = newRefs.sort((a, b) => {
  51137. return a.ref.num - b.ref.num;
  51138. });
  51139. const xrefTableData = [[0, 1, 0xffff]];
  51140. const indexes = [0, 1];
  51141. let maxOffset = 0;
  51142. for (const {
  51143. ref,
  51144. data
  51145. } of newRefs) {
  51146. maxOffset = Math.max(maxOffset, baseOffset);
  51147. xrefTableData.push([1, baseOffset, Math.min(ref.gen, 0xffff)]);
  51148. baseOffset += data.length;
  51149. indexes.push(ref.num, 1);
  51150. buffer.push(data);
  51151. }
  51152. newXref.set("Index", indexes);
  51153. if (Array.isArray(xrefInfo.fileIds) && xrefInfo.fileIds.length > 0) {
  51154. const md5 = computeMD5(baseOffset, xrefInfo);
  51155. newXref.set("ID", [xrefInfo.fileIds[0], md5]);
  51156. }
  51157. const offsetSize = Math.ceil(Math.log2(maxOffset) / 8);
  51158. const sizes = [1, offsetSize, 2];
  51159. const structSize = sizes[0] + sizes[1] + sizes[2];
  51160. const tableLength = structSize * xrefTableData.length;
  51161. newXref.set("W", sizes);
  51162. newXref.set("Length", tableLength);
  51163. buffer.push(`${refForXrefTable.num} ${refForXrefTable.gen} obj\n`);
  51164. writeDict(newXref, buffer, null);
  51165. buffer.push(" stream\n");
  51166. const bufferLen = buffer.reduce((a, str) => a + str.length, 0);
  51167. const footer = `\nendstream\nendobj\nstartxref\n${baseOffset}\n%%EOF\n`;
  51168. const array = new Uint8Array(originalData.length + bufferLen + tableLength + footer.length);
  51169. array.set(originalData);
  51170. let offset = originalData.length;
  51171. for (const str of buffer) {
  51172. writeString(str, offset, array);
  51173. offset += str.length;
  51174. }
  51175. for (const [type, objOffset, gen] of xrefTableData) {
  51176. offset = writeInt(type, sizes[0], offset, array);
  51177. offset = writeInt(objOffset, sizes[1], offset, array);
  51178. offset = writeInt(gen, sizes[2], offset, array);
  51179. }
  51180. writeString(footer, offset, array);
  51181. return array;
  51182. }
  51183. /***/ }),
  51184. /* 195 */
  51185. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  51186. "use strict";
  51187. Object.defineProperty(exports, "__esModule", ({
  51188. value: true
  51189. }));
  51190. exports.XMLParserErrorCode = exports.XMLParserBase = exports.SimpleXMLParser = exports.SimpleDOMNode = void 0;
  51191. var _core_utils = __w_pdfjs_require__(135);
  51192. const XMLParserErrorCode = {
  51193. NoError: 0,
  51194. EndOfDocument: -1,
  51195. UnterminatedCdat: -2,
  51196. UnterminatedXmlDeclaration: -3,
  51197. UnterminatedDoctypeDeclaration: -4,
  51198. UnterminatedComment: -5,
  51199. MalformedElement: -6,
  51200. OutOfMemory: -7,
  51201. UnterminatedAttributeValue: -8,
  51202. UnterminatedElement: -9,
  51203. ElementNeverBegun: -10
  51204. };
  51205. exports.XMLParserErrorCode = XMLParserErrorCode;
  51206. function isWhitespace(s, index) {
  51207. const ch = s[index];
  51208. return ch === " " || ch === "\n" || ch === "\r" || ch === "\t";
  51209. }
  51210. function isWhitespaceString(s) {
  51211. for (let i = 0, ii = s.length; i < ii; i++) {
  51212. if (!isWhitespace(s, i)) {
  51213. return false;
  51214. }
  51215. }
  51216. return true;
  51217. }
  51218. class XMLParserBase {
  51219. _resolveEntities(s) {
  51220. return s.replace(/&([^;]+);/g, (all, entity) => {
  51221. if (entity.substring(0, 2) === "#x") {
  51222. return String.fromCodePoint(parseInt(entity.substring(2), 16));
  51223. } else if (entity.substring(0, 1) === "#") {
  51224. return String.fromCodePoint(parseInt(entity.substring(1), 10));
  51225. }
  51226. switch (entity) {
  51227. case "lt":
  51228. return "<";
  51229. case "gt":
  51230. return ">";
  51231. case "amp":
  51232. return "&";
  51233. case "quot":
  51234. return '"';
  51235. case "apos":
  51236. return "'";
  51237. }
  51238. return this.onResolveEntity(entity);
  51239. });
  51240. }
  51241. _parseContent(s, start) {
  51242. const attributes = [];
  51243. let pos = start;
  51244. function skipWs() {
  51245. while (pos < s.length && isWhitespace(s, pos)) {
  51246. ++pos;
  51247. }
  51248. }
  51249. while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== ">" && s[pos] !== "/") {
  51250. ++pos;
  51251. }
  51252. const name = s.substring(start, pos);
  51253. skipWs();
  51254. while (pos < s.length && s[pos] !== ">" && s[pos] !== "/" && s[pos] !== "?") {
  51255. skipWs();
  51256. let attrName = "",
  51257. attrValue = "";
  51258. while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== "=") {
  51259. attrName += s[pos];
  51260. ++pos;
  51261. }
  51262. skipWs();
  51263. if (s[pos] !== "=") {
  51264. return null;
  51265. }
  51266. ++pos;
  51267. skipWs();
  51268. const attrEndChar = s[pos];
  51269. if (attrEndChar !== '"' && attrEndChar !== "'") {
  51270. return null;
  51271. }
  51272. const attrEndIndex = s.indexOf(attrEndChar, ++pos);
  51273. if (attrEndIndex < 0) {
  51274. return null;
  51275. }
  51276. attrValue = s.substring(pos, attrEndIndex);
  51277. attributes.push({
  51278. name: attrName,
  51279. value: this._resolveEntities(attrValue)
  51280. });
  51281. pos = attrEndIndex + 1;
  51282. skipWs();
  51283. }
  51284. return {
  51285. name,
  51286. attributes,
  51287. parsed: pos - start
  51288. };
  51289. }
  51290. _parseProcessingInstruction(s, start) {
  51291. let pos = start;
  51292. function skipWs() {
  51293. while (pos < s.length && isWhitespace(s, pos)) {
  51294. ++pos;
  51295. }
  51296. }
  51297. while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== ">" && s[pos] !== "?" && s[pos] !== "/") {
  51298. ++pos;
  51299. }
  51300. const name = s.substring(start, pos);
  51301. skipWs();
  51302. const attrStart = pos;
  51303. while (pos < s.length && (s[pos] !== "?" || s[pos + 1] !== ">")) {
  51304. ++pos;
  51305. }
  51306. const value = s.substring(attrStart, pos);
  51307. return {
  51308. name,
  51309. value,
  51310. parsed: pos - start
  51311. };
  51312. }
  51313. parseXml(s) {
  51314. let i = 0;
  51315. while (i < s.length) {
  51316. const ch = s[i];
  51317. let j = i;
  51318. if (ch === "<") {
  51319. ++j;
  51320. const ch2 = s[j];
  51321. let q;
  51322. switch (ch2) {
  51323. case "/":
  51324. ++j;
  51325. q = s.indexOf(">", j);
  51326. if (q < 0) {
  51327. this.onError(XMLParserErrorCode.UnterminatedElement);
  51328. return;
  51329. }
  51330. this.onEndElement(s.substring(j, q));
  51331. j = q + 1;
  51332. break;
  51333. case "?":
  51334. ++j;
  51335. const pi = this._parseProcessingInstruction(s, j);
  51336. if (s.substring(j + pi.parsed, j + pi.parsed + 2) !== "?>") {
  51337. this.onError(XMLParserErrorCode.UnterminatedXmlDeclaration);
  51338. return;
  51339. }
  51340. this.onPi(pi.name, pi.value);
  51341. j += pi.parsed + 2;
  51342. break;
  51343. case "!":
  51344. if (s.substring(j + 1, j + 3) === "--") {
  51345. q = s.indexOf("-->", j + 3);
  51346. if (q < 0) {
  51347. this.onError(XMLParserErrorCode.UnterminatedComment);
  51348. return;
  51349. }
  51350. this.onComment(s.substring(j + 3, q));
  51351. j = q + 3;
  51352. } else if (s.substring(j + 1, j + 8) === "[CDATA[") {
  51353. q = s.indexOf("]]>", j + 8);
  51354. if (q < 0) {
  51355. this.onError(XMLParserErrorCode.UnterminatedCdat);
  51356. return;
  51357. }
  51358. this.onCdata(s.substring(j + 8, q));
  51359. j = q + 3;
  51360. } else if (s.substring(j + 1, j + 8) === "DOCTYPE") {
  51361. const q2 = s.indexOf("[", j + 8);
  51362. let complexDoctype = false;
  51363. q = s.indexOf(">", j + 8);
  51364. if (q < 0) {
  51365. this.onError(XMLParserErrorCode.UnterminatedDoctypeDeclaration);
  51366. return;
  51367. }
  51368. if (q2 > 0 && q > q2) {
  51369. q = s.indexOf("]>", j + 8);
  51370. if (q < 0) {
  51371. this.onError(XMLParserErrorCode.UnterminatedDoctypeDeclaration);
  51372. return;
  51373. }
  51374. complexDoctype = true;
  51375. }
  51376. const doctypeContent = s.substring(j + 8, q + (complexDoctype ? 1 : 0));
  51377. this.onDoctype(doctypeContent);
  51378. j = q + (complexDoctype ? 2 : 1);
  51379. } else {
  51380. this.onError(XMLParserErrorCode.MalformedElement);
  51381. return;
  51382. }
  51383. break;
  51384. default:
  51385. const content = this._parseContent(s, j);
  51386. if (content === null) {
  51387. this.onError(XMLParserErrorCode.MalformedElement);
  51388. return;
  51389. }
  51390. let isClosed = false;
  51391. if (s.substring(j + content.parsed, j + content.parsed + 2) === "/>") {
  51392. isClosed = true;
  51393. } else if (s.substring(j + content.parsed, j + content.parsed + 1) !== ">") {
  51394. this.onError(XMLParserErrorCode.UnterminatedElement);
  51395. return;
  51396. }
  51397. this.onBeginElement(content.name, content.attributes, isClosed);
  51398. j += content.parsed + (isClosed ? 2 : 1);
  51399. break;
  51400. }
  51401. } else {
  51402. while (j < s.length && s[j] !== "<") {
  51403. j++;
  51404. }
  51405. const text = s.substring(i, j);
  51406. this.onText(this._resolveEntities(text));
  51407. }
  51408. i = j;
  51409. }
  51410. }
  51411. onResolveEntity(name) {
  51412. return `&${name};`;
  51413. }
  51414. onPi(name, value) {}
  51415. onComment(text) {}
  51416. onCdata(text) {}
  51417. onDoctype(doctypeContent) {}
  51418. onText(text) {}
  51419. onBeginElement(name, attributes, isEmpty) {}
  51420. onEndElement(name) {}
  51421. onError(code) {}
  51422. }
  51423. exports.XMLParserBase = XMLParserBase;
  51424. class SimpleDOMNode {
  51425. constructor(nodeName, nodeValue) {
  51426. this.nodeName = nodeName;
  51427. this.nodeValue = nodeValue;
  51428. Object.defineProperty(this, "parentNode", {
  51429. value: null,
  51430. writable: true
  51431. });
  51432. }
  51433. get firstChild() {
  51434. return this.childNodes && this.childNodes[0];
  51435. }
  51436. get nextSibling() {
  51437. const childNodes = this.parentNode.childNodes;
  51438. if (!childNodes) {
  51439. return undefined;
  51440. }
  51441. const index = childNodes.indexOf(this);
  51442. if (index === -1) {
  51443. return undefined;
  51444. }
  51445. return childNodes[index + 1];
  51446. }
  51447. get textContent() {
  51448. if (!this.childNodes) {
  51449. return this.nodeValue || "";
  51450. }
  51451. return this.childNodes.map(function (child) {
  51452. return child.textContent;
  51453. }).join("");
  51454. }
  51455. get children() {
  51456. return this.childNodes || [];
  51457. }
  51458. hasChildNodes() {
  51459. return this.childNodes && this.childNodes.length > 0;
  51460. }
  51461. searchNode(paths, pos) {
  51462. if (pos >= paths.length) {
  51463. return this;
  51464. }
  51465. const component = paths[pos];
  51466. const stack = [];
  51467. let node = this;
  51468. while (true) {
  51469. if (component.name === node.nodeName) {
  51470. if (component.pos === 0) {
  51471. const res = node.searchNode(paths, pos + 1);
  51472. if (res !== null) {
  51473. return res;
  51474. }
  51475. } else if (stack.length === 0) {
  51476. return null;
  51477. } else {
  51478. const [parent] = stack.pop();
  51479. let siblingPos = 0;
  51480. for (const child of parent.childNodes) {
  51481. if (component.name === child.nodeName) {
  51482. if (siblingPos === component.pos) {
  51483. return child.searchNode(paths, pos + 1);
  51484. }
  51485. siblingPos++;
  51486. }
  51487. }
  51488. return node.searchNode(paths, pos + 1);
  51489. }
  51490. }
  51491. if (node.childNodes && node.childNodes.length !== 0) {
  51492. stack.push([node, 0]);
  51493. node = node.childNodes[0];
  51494. } else if (stack.length === 0) {
  51495. return null;
  51496. } else {
  51497. while (stack.length !== 0) {
  51498. const [parent, currentPos] = stack.pop();
  51499. const newPos = currentPos + 1;
  51500. if (newPos < parent.childNodes.length) {
  51501. stack.push([parent, newPos]);
  51502. node = parent.childNodes[newPos];
  51503. break;
  51504. }
  51505. }
  51506. if (stack.length === 0) {
  51507. return null;
  51508. }
  51509. }
  51510. }
  51511. }
  51512. dump(buffer) {
  51513. if (this.nodeName === "#text") {
  51514. buffer.push((0, _core_utils.encodeToXmlString)(this.nodeValue));
  51515. return;
  51516. }
  51517. buffer.push(`<${this.nodeName}`);
  51518. if (this.attributes) {
  51519. for (const attribute of this.attributes) {
  51520. buffer.push(` ${attribute.name}="${(0, _core_utils.encodeToXmlString)(attribute.value)}"`);
  51521. }
  51522. }
  51523. if (this.hasChildNodes()) {
  51524. buffer.push(">");
  51525. for (const child of this.childNodes) {
  51526. child.dump(buffer);
  51527. }
  51528. buffer.push(`</${this.nodeName}>`);
  51529. } else if (this.nodeValue) {
  51530. buffer.push(`>${(0, _core_utils.encodeToXmlString)(this.nodeValue)}</${this.nodeName}>`);
  51531. } else {
  51532. buffer.push("/>");
  51533. }
  51534. }
  51535. }
  51536. exports.SimpleDOMNode = SimpleDOMNode;
  51537. class SimpleXMLParser extends XMLParserBase {
  51538. constructor(_ref) {
  51539. let {
  51540. hasAttributes = false,
  51541. lowerCaseName = false
  51542. } = _ref;
  51543. super();
  51544. this._currentFragment = null;
  51545. this._stack = null;
  51546. this._errorCode = XMLParserErrorCode.NoError;
  51547. this._hasAttributes = hasAttributes;
  51548. this._lowerCaseName = lowerCaseName;
  51549. }
  51550. parseFromString(data) {
  51551. this._currentFragment = [];
  51552. this._stack = [];
  51553. this._errorCode = XMLParserErrorCode.NoError;
  51554. this.parseXml(data);
  51555. if (this._errorCode !== XMLParserErrorCode.NoError) {
  51556. return undefined;
  51557. }
  51558. const [documentElement] = this._currentFragment;
  51559. if (!documentElement) {
  51560. return undefined;
  51561. }
  51562. return {
  51563. documentElement
  51564. };
  51565. }
  51566. onText(text) {
  51567. if (isWhitespaceString(text)) {
  51568. return;
  51569. }
  51570. const node = new SimpleDOMNode("#text", text);
  51571. this._currentFragment.push(node);
  51572. }
  51573. onCdata(text) {
  51574. const node = new SimpleDOMNode("#text", text);
  51575. this._currentFragment.push(node);
  51576. }
  51577. onBeginElement(name, attributes, isEmpty) {
  51578. if (this._lowerCaseName) {
  51579. name = name.toLowerCase();
  51580. }
  51581. const node = new SimpleDOMNode(name);
  51582. node.childNodes = [];
  51583. if (this._hasAttributes) {
  51584. node.attributes = attributes;
  51585. }
  51586. this._currentFragment.push(node);
  51587. if (isEmpty) {
  51588. return;
  51589. }
  51590. this._stack.push(this._currentFragment);
  51591. this._currentFragment = node.childNodes;
  51592. }
  51593. onEndElement(name) {
  51594. this._currentFragment = this._stack.pop() || [];
  51595. const lastElement = this._currentFragment.at(-1);
  51596. if (!lastElement) {
  51597. return null;
  51598. }
  51599. for (const childNode of lastElement.childNodes) {
  51600. childNode.parentNode = lastElement;
  51601. }
  51602. return lastElement;
  51603. }
  51604. onError(code) {
  51605. this._errorCode = code;
  51606. }
  51607. }
  51608. exports.SimpleXMLParser = SimpleXMLParser;
  51609. /***/ }),
  51610. /* 196 */
  51611. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  51612. "use strict";
  51613. Object.defineProperty(exports, "__esModule", ({
  51614. value: true
  51615. }));
  51616. exports.calculateSHA256 = exports.calculateMD5 = exports.PDF20 = exports.PDF17 = exports.CipherTransformFactory = exports.ARCFourCipher = exports.AES256Cipher = exports.AES128Cipher = void 0;
  51617. exports.calculateSHA384 = calculateSHA384;
  51618. exports.calculateSHA512 = void 0;
  51619. var _util = __w_pdfjs_require__(2);
  51620. var _primitives = __w_pdfjs_require__(134);
  51621. var _decrypt_stream = __w_pdfjs_require__(197);
  51622. class ARCFourCipher {
  51623. constructor(key) {
  51624. this.a = 0;
  51625. this.b = 0;
  51626. const s = new Uint8Array(256);
  51627. const keyLength = key.length;
  51628. for (let i = 0; i < 256; ++i) {
  51629. s[i] = i;
  51630. }
  51631. for (let i = 0, j = 0; i < 256; ++i) {
  51632. const tmp = s[i];
  51633. j = j + tmp + key[i % keyLength] & 0xff;
  51634. s[i] = s[j];
  51635. s[j] = tmp;
  51636. }
  51637. this.s = s;
  51638. }
  51639. encryptBlock(data) {
  51640. let a = this.a,
  51641. b = this.b;
  51642. const s = this.s;
  51643. const n = data.length;
  51644. const output = new Uint8Array(n);
  51645. for (let i = 0; i < n; ++i) {
  51646. a = a + 1 & 0xff;
  51647. const tmp = s[a];
  51648. b = b + tmp & 0xff;
  51649. const tmp2 = s[b];
  51650. s[a] = tmp2;
  51651. s[b] = tmp;
  51652. output[i] = data[i] ^ s[tmp + tmp2 & 0xff];
  51653. }
  51654. this.a = a;
  51655. this.b = b;
  51656. return output;
  51657. }
  51658. decryptBlock(data) {
  51659. return this.encryptBlock(data);
  51660. }
  51661. encrypt(data) {
  51662. return this.encryptBlock(data);
  51663. }
  51664. }
  51665. exports.ARCFourCipher = ARCFourCipher;
  51666. const calculateMD5 = function calculateMD5Closure() {
  51667. 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]);
  51668. 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]);
  51669. function hash(data, offset, length) {
  51670. let h0 = 1732584193,
  51671. h1 = -271733879,
  51672. h2 = -1732584194,
  51673. h3 = 271733878;
  51674. const paddedLength = length + 72 & ~63;
  51675. const padded = new Uint8Array(paddedLength);
  51676. let i, j;
  51677. for (i = 0; i < length; ++i) {
  51678. padded[i] = data[offset++];
  51679. }
  51680. padded[i++] = 0x80;
  51681. const n = paddedLength - 8;
  51682. while (i < n) {
  51683. padded[i++] = 0;
  51684. }
  51685. padded[i++] = length << 3 & 0xff;
  51686. padded[i++] = length >> 5 & 0xff;
  51687. padded[i++] = length >> 13 & 0xff;
  51688. padded[i++] = length >> 21 & 0xff;
  51689. padded[i++] = length >>> 29 & 0xff;
  51690. padded[i++] = 0;
  51691. padded[i++] = 0;
  51692. padded[i++] = 0;
  51693. const w = new Int32Array(16);
  51694. for (i = 0; i < paddedLength;) {
  51695. for (j = 0; j < 16; ++j, i += 4) {
  51696. w[j] = padded[i] | padded[i + 1] << 8 | padded[i + 2] << 16 | padded[i + 3] << 24;
  51697. }
  51698. let a = h0,
  51699. b = h1,
  51700. c = h2,
  51701. d = h3,
  51702. f,
  51703. g;
  51704. for (j = 0; j < 64; ++j) {
  51705. if (j < 16) {
  51706. f = b & c | ~b & d;
  51707. g = j;
  51708. } else if (j < 32) {
  51709. f = d & b | ~d & c;
  51710. g = 5 * j + 1 & 15;
  51711. } else if (j < 48) {
  51712. f = b ^ c ^ d;
  51713. g = 3 * j + 5 & 15;
  51714. } else {
  51715. f = c ^ (b | ~d);
  51716. g = 7 * j & 15;
  51717. }
  51718. const tmp = d,
  51719. rotateArg = a + f + k[j] + w[g] | 0,
  51720. rotate = r[j];
  51721. d = c;
  51722. c = b;
  51723. b = b + (rotateArg << rotate | rotateArg >>> 32 - rotate) | 0;
  51724. a = tmp;
  51725. }
  51726. h0 = h0 + a | 0;
  51727. h1 = h1 + b | 0;
  51728. h2 = h2 + c | 0;
  51729. h3 = h3 + d | 0;
  51730. }
  51731. 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]);
  51732. }
  51733. return hash;
  51734. }();
  51735. exports.calculateMD5 = calculateMD5;
  51736. class Word64 {
  51737. constructor(highInteger, lowInteger) {
  51738. this.high = highInteger | 0;
  51739. this.low = lowInteger | 0;
  51740. }
  51741. and(word) {
  51742. this.high &= word.high;
  51743. this.low &= word.low;
  51744. }
  51745. xor(word) {
  51746. this.high ^= word.high;
  51747. this.low ^= word.low;
  51748. }
  51749. or(word) {
  51750. this.high |= word.high;
  51751. this.low |= word.low;
  51752. }
  51753. shiftRight(places) {
  51754. if (places >= 32) {
  51755. this.low = this.high >>> places - 32 | 0;
  51756. this.high = 0;
  51757. } else {
  51758. this.low = this.low >>> places | this.high << 32 - places;
  51759. this.high = this.high >>> places | 0;
  51760. }
  51761. }
  51762. shiftLeft(places) {
  51763. if (places >= 32) {
  51764. this.high = this.low << places - 32;
  51765. this.low = 0;
  51766. } else {
  51767. this.high = this.high << places | this.low >>> 32 - places;
  51768. this.low <<= places;
  51769. }
  51770. }
  51771. rotateRight(places) {
  51772. let low, high;
  51773. if (places & 32) {
  51774. high = this.low;
  51775. low = this.high;
  51776. } else {
  51777. low = this.low;
  51778. high = this.high;
  51779. }
  51780. places &= 31;
  51781. this.low = low >>> places | high << 32 - places;
  51782. this.high = high >>> places | low << 32 - places;
  51783. }
  51784. not() {
  51785. this.high = ~this.high;
  51786. this.low = ~this.low;
  51787. }
  51788. add(word) {
  51789. const lowAdd = (this.low >>> 0) + (word.low >>> 0);
  51790. let highAdd = (this.high >>> 0) + (word.high >>> 0);
  51791. if (lowAdd > 0xffffffff) {
  51792. highAdd += 1;
  51793. }
  51794. this.low = lowAdd | 0;
  51795. this.high = highAdd | 0;
  51796. }
  51797. copyTo(bytes, offset) {
  51798. bytes[offset] = this.high >>> 24 & 0xff;
  51799. bytes[offset + 1] = this.high >> 16 & 0xff;
  51800. bytes[offset + 2] = this.high >> 8 & 0xff;
  51801. bytes[offset + 3] = this.high & 0xff;
  51802. bytes[offset + 4] = this.low >>> 24 & 0xff;
  51803. bytes[offset + 5] = this.low >> 16 & 0xff;
  51804. bytes[offset + 6] = this.low >> 8 & 0xff;
  51805. bytes[offset + 7] = this.low & 0xff;
  51806. }
  51807. assign(word) {
  51808. this.high = word.high;
  51809. this.low = word.low;
  51810. }
  51811. }
  51812. const calculateSHA256 = function calculateSHA256Closure() {
  51813. function rotr(x, n) {
  51814. return x >>> n | x << 32 - n;
  51815. }
  51816. function ch(x, y, z) {
  51817. return x & y ^ ~x & z;
  51818. }
  51819. function maj(x, y, z) {
  51820. return x & y ^ x & z ^ y & z;
  51821. }
  51822. function sigma(x) {
  51823. return rotr(x, 2) ^ rotr(x, 13) ^ rotr(x, 22);
  51824. }
  51825. function sigmaPrime(x) {
  51826. return rotr(x, 6) ^ rotr(x, 11) ^ rotr(x, 25);
  51827. }
  51828. function littleSigma(x) {
  51829. return rotr(x, 7) ^ rotr(x, 18) ^ x >>> 3;
  51830. }
  51831. function littleSigmaPrime(x) {
  51832. return rotr(x, 17) ^ rotr(x, 19) ^ x >>> 10;
  51833. }
  51834. 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];
  51835. function hash(data, offset, length) {
  51836. let h0 = 0x6a09e667,
  51837. h1 = 0xbb67ae85,
  51838. h2 = 0x3c6ef372,
  51839. h3 = 0xa54ff53a,
  51840. h4 = 0x510e527f,
  51841. h5 = 0x9b05688c,
  51842. h6 = 0x1f83d9ab,
  51843. h7 = 0x5be0cd19;
  51844. const paddedLength = Math.ceil((length + 9) / 64) * 64;
  51845. const padded = new Uint8Array(paddedLength);
  51846. let i, j;
  51847. for (i = 0; i < length; ++i) {
  51848. padded[i] = data[offset++];
  51849. }
  51850. padded[i++] = 0x80;
  51851. const n = paddedLength - 8;
  51852. while (i < n) {
  51853. padded[i++] = 0;
  51854. }
  51855. padded[i++] = 0;
  51856. padded[i++] = 0;
  51857. padded[i++] = 0;
  51858. padded[i++] = length >>> 29 & 0xff;
  51859. padded[i++] = length >> 21 & 0xff;
  51860. padded[i++] = length >> 13 & 0xff;
  51861. padded[i++] = length >> 5 & 0xff;
  51862. padded[i++] = length << 3 & 0xff;
  51863. const w = new Uint32Array(64);
  51864. for (i = 0; i < paddedLength;) {
  51865. for (j = 0; j < 16; ++j) {
  51866. w[j] = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
  51867. i += 4;
  51868. }
  51869. for (j = 16; j < 64; ++j) {
  51870. w[j] = littleSigmaPrime(w[j - 2]) + w[j - 7] + littleSigma(w[j - 15]) + w[j - 16] | 0;
  51871. }
  51872. let a = h0,
  51873. b = h1,
  51874. c = h2,
  51875. d = h3,
  51876. e = h4,
  51877. f = h5,
  51878. g = h6,
  51879. h = h7,
  51880. t1,
  51881. t2;
  51882. for (j = 0; j < 64; ++j) {
  51883. t1 = h + sigmaPrime(e) + ch(e, f, g) + k[j] + w[j];
  51884. t2 = sigma(a) + maj(a, b, c);
  51885. h = g;
  51886. g = f;
  51887. f = e;
  51888. e = d + t1 | 0;
  51889. d = c;
  51890. c = b;
  51891. b = a;
  51892. a = t1 + t2 | 0;
  51893. }
  51894. h0 = h0 + a | 0;
  51895. h1 = h1 + b | 0;
  51896. h2 = h2 + c | 0;
  51897. h3 = h3 + d | 0;
  51898. h4 = h4 + e | 0;
  51899. h5 = h5 + f | 0;
  51900. h6 = h6 + g | 0;
  51901. h7 = h7 + h | 0;
  51902. }
  51903. 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]);
  51904. }
  51905. return hash;
  51906. }();
  51907. exports.calculateSHA256 = calculateSHA256;
  51908. const calculateSHA512 = function calculateSHA512Closure() {
  51909. function ch(result, x, y, z, tmp) {
  51910. result.assign(x);
  51911. result.and(y);
  51912. tmp.assign(x);
  51913. tmp.not();
  51914. tmp.and(z);
  51915. result.xor(tmp);
  51916. }
  51917. function maj(result, x, y, z, tmp) {
  51918. result.assign(x);
  51919. result.and(y);
  51920. tmp.assign(x);
  51921. tmp.and(z);
  51922. result.xor(tmp);
  51923. tmp.assign(y);
  51924. tmp.and(z);
  51925. result.xor(tmp);
  51926. }
  51927. function sigma(result, x, tmp) {
  51928. result.assign(x);
  51929. result.rotateRight(28);
  51930. tmp.assign(x);
  51931. tmp.rotateRight(34);
  51932. result.xor(tmp);
  51933. tmp.assign(x);
  51934. tmp.rotateRight(39);
  51935. result.xor(tmp);
  51936. }
  51937. function sigmaPrime(result, x, tmp) {
  51938. result.assign(x);
  51939. result.rotateRight(14);
  51940. tmp.assign(x);
  51941. tmp.rotateRight(18);
  51942. result.xor(tmp);
  51943. tmp.assign(x);
  51944. tmp.rotateRight(41);
  51945. result.xor(tmp);
  51946. }
  51947. function littleSigma(result, x, tmp) {
  51948. result.assign(x);
  51949. result.rotateRight(1);
  51950. tmp.assign(x);
  51951. tmp.rotateRight(8);
  51952. result.xor(tmp);
  51953. tmp.assign(x);
  51954. tmp.shiftRight(7);
  51955. result.xor(tmp);
  51956. }
  51957. function littleSigmaPrime(result, x, tmp) {
  51958. result.assign(x);
  51959. result.rotateRight(19);
  51960. tmp.assign(x);
  51961. tmp.rotateRight(61);
  51962. result.xor(tmp);
  51963. tmp.assign(x);
  51964. tmp.shiftRight(6);
  51965. result.xor(tmp);
  51966. }
  51967. 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)];
  51968. function hash(data, offset, length) {
  51969. let mode384 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  51970. let h0, h1, h2, h3, h4, h5, h6, h7;
  51971. if (!mode384) {
  51972. h0 = new Word64(0x6a09e667, 0xf3bcc908);
  51973. h1 = new Word64(0xbb67ae85, 0x84caa73b);
  51974. h2 = new Word64(0x3c6ef372, 0xfe94f82b);
  51975. h3 = new Word64(0xa54ff53a, 0x5f1d36f1);
  51976. h4 = new Word64(0x510e527f, 0xade682d1);
  51977. h5 = new Word64(0x9b05688c, 0x2b3e6c1f);
  51978. h6 = new Word64(0x1f83d9ab, 0xfb41bd6b);
  51979. h7 = new Word64(0x5be0cd19, 0x137e2179);
  51980. } else {
  51981. h0 = new Word64(0xcbbb9d5d, 0xc1059ed8);
  51982. h1 = new Word64(0x629a292a, 0x367cd507);
  51983. h2 = new Word64(0x9159015a, 0x3070dd17);
  51984. h3 = new Word64(0x152fecd8, 0xf70e5939);
  51985. h4 = new Word64(0x67332667, 0xffc00b31);
  51986. h5 = new Word64(0x8eb44a87, 0x68581511);
  51987. h6 = new Word64(0xdb0c2e0d, 0x64f98fa7);
  51988. h7 = new Word64(0x47b5481d, 0xbefa4fa4);
  51989. }
  51990. const paddedLength = Math.ceil((length + 17) / 128) * 128;
  51991. const padded = new Uint8Array(paddedLength);
  51992. let i, j;
  51993. for (i = 0; i < length; ++i) {
  51994. padded[i] = data[offset++];
  51995. }
  51996. padded[i++] = 0x80;
  51997. const n = paddedLength - 16;
  51998. while (i < n) {
  51999. padded[i++] = 0;
  52000. }
  52001. padded[i++] = 0;
  52002. padded[i++] = 0;
  52003. padded[i++] = 0;
  52004. padded[i++] = 0;
  52005. padded[i++] = 0;
  52006. padded[i++] = 0;
  52007. padded[i++] = 0;
  52008. padded[i++] = 0;
  52009. padded[i++] = 0;
  52010. padded[i++] = 0;
  52011. padded[i++] = 0;
  52012. padded[i++] = length >>> 29 & 0xff;
  52013. padded[i++] = length >> 21 & 0xff;
  52014. padded[i++] = length >> 13 & 0xff;
  52015. padded[i++] = length >> 5 & 0xff;
  52016. padded[i++] = length << 3 & 0xff;
  52017. const w = new Array(80);
  52018. for (i = 0; i < 80; i++) {
  52019. w[i] = new Word64(0, 0);
  52020. }
  52021. let a = new Word64(0, 0),
  52022. b = new Word64(0, 0),
  52023. c = new Word64(0, 0);
  52024. let d = new Word64(0, 0),
  52025. e = new Word64(0, 0),
  52026. f = new Word64(0, 0);
  52027. let g = new Word64(0, 0),
  52028. h = new Word64(0, 0);
  52029. const t1 = new Word64(0, 0),
  52030. t2 = new Word64(0, 0);
  52031. const tmp1 = new Word64(0, 0),
  52032. tmp2 = new Word64(0, 0);
  52033. let tmp3;
  52034. for (i = 0; i < paddedLength;) {
  52035. for (j = 0; j < 16; ++j) {
  52036. w[j].high = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
  52037. w[j].low = padded[i + 4] << 24 | padded[i + 5] << 16 | padded[i + 6] << 8 | padded[i + 7];
  52038. i += 8;
  52039. }
  52040. for (j = 16; j < 80; ++j) {
  52041. tmp3 = w[j];
  52042. littleSigmaPrime(tmp3, w[j - 2], tmp2);
  52043. tmp3.add(w[j - 7]);
  52044. littleSigma(tmp1, w[j - 15], tmp2);
  52045. tmp3.add(tmp1);
  52046. tmp3.add(w[j - 16]);
  52047. }
  52048. a.assign(h0);
  52049. b.assign(h1);
  52050. c.assign(h2);
  52051. d.assign(h3);
  52052. e.assign(h4);
  52053. f.assign(h5);
  52054. g.assign(h6);
  52055. h.assign(h7);
  52056. for (j = 0; j < 80; ++j) {
  52057. t1.assign(h);
  52058. sigmaPrime(tmp1, e, tmp2);
  52059. t1.add(tmp1);
  52060. ch(tmp1, e, f, g, tmp2);
  52061. t1.add(tmp1);
  52062. t1.add(k[j]);
  52063. t1.add(w[j]);
  52064. sigma(t2, a, tmp2);
  52065. maj(tmp1, a, b, c, tmp2);
  52066. t2.add(tmp1);
  52067. tmp3 = h;
  52068. h = g;
  52069. g = f;
  52070. f = e;
  52071. d.add(t1);
  52072. e = d;
  52073. d = c;
  52074. c = b;
  52075. b = a;
  52076. tmp3.assign(t1);
  52077. tmp3.add(t2);
  52078. a = tmp3;
  52079. }
  52080. h0.add(a);
  52081. h1.add(b);
  52082. h2.add(c);
  52083. h3.add(d);
  52084. h4.add(e);
  52085. h5.add(f);
  52086. h6.add(g);
  52087. h7.add(h);
  52088. }
  52089. let result;
  52090. if (!mode384) {
  52091. result = new Uint8Array(64);
  52092. h0.copyTo(result, 0);
  52093. h1.copyTo(result, 8);
  52094. h2.copyTo(result, 16);
  52095. h3.copyTo(result, 24);
  52096. h4.copyTo(result, 32);
  52097. h5.copyTo(result, 40);
  52098. h6.copyTo(result, 48);
  52099. h7.copyTo(result, 56);
  52100. } else {
  52101. result = new Uint8Array(48);
  52102. h0.copyTo(result, 0);
  52103. h1.copyTo(result, 8);
  52104. h2.copyTo(result, 16);
  52105. h3.copyTo(result, 24);
  52106. h4.copyTo(result, 32);
  52107. h5.copyTo(result, 40);
  52108. }
  52109. return result;
  52110. }
  52111. return hash;
  52112. }();
  52113. exports.calculateSHA512 = calculateSHA512;
  52114. function calculateSHA384(data, offset, length) {
  52115. return calculateSHA512(data, offset, length, true);
  52116. }
  52117. class NullCipher {
  52118. decryptBlock(data) {
  52119. return data;
  52120. }
  52121. encrypt(data) {
  52122. return data;
  52123. }
  52124. }
  52125. class AESBaseCipher {
  52126. constructor() {
  52127. if (this.constructor === AESBaseCipher) {
  52128. (0, _util.unreachable)("Cannot initialize AESBaseCipher.");
  52129. }
  52130. 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]);
  52131. 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]);
  52132. 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]);
  52133. this._mixCol = new Uint8Array(256);
  52134. for (let i = 0; i < 256; i++) {
  52135. if (i < 128) {
  52136. this._mixCol[i] = i << 1;
  52137. } else {
  52138. this._mixCol[i] = i << 1 ^ 0x1b;
  52139. }
  52140. }
  52141. this.buffer = new Uint8Array(16);
  52142. this.bufferPosition = 0;
  52143. }
  52144. _expandKey(cipherKey) {
  52145. (0, _util.unreachable)("Cannot call `_expandKey` on the base class");
  52146. }
  52147. _decrypt(input, key) {
  52148. let t, u, v;
  52149. const state = new Uint8Array(16);
  52150. state.set(input);
  52151. for (let j = 0, k = this._keySize; j < 16; ++j, ++k) {
  52152. state[j] ^= key[k];
  52153. }
  52154. for (let i = this._cyclesOfRepetition - 1; i >= 1; --i) {
  52155. t = state[13];
  52156. state[13] = state[9];
  52157. state[9] = state[5];
  52158. state[5] = state[1];
  52159. state[1] = t;
  52160. t = state[14];
  52161. u = state[10];
  52162. state[14] = state[6];
  52163. state[10] = state[2];
  52164. state[6] = t;
  52165. state[2] = u;
  52166. t = state[15];
  52167. u = state[11];
  52168. v = state[7];
  52169. state[15] = state[3];
  52170. state[11] = t;
  52171. state[7] = u;
  52172. state[3] = v;
  52173. for (let j = 0; j < 16; ++j) {
  52174. state[j] = this._inv_s[state[j]];
  52175. }
  52176. for (let j = 0, k = i * 16; j < 16; ++j, ++k) {
  52177. state[j] ^= key[k];
  52178. }
  52179. for (let j = 0; j < 16; j += 4) {
  52180. const s0 = this._mix[state[j]];
  52181. const s1 = this._mix[state[j + 1]];
  52182. const s2 = this._mix[state[j + 2]];
  52183. const s3 = this._mix[state[j + 3]];
  52184. t = s0 ^ s1 >>> 8 ^ s1 << 24 ^ s2 >>> 16 ^ s2 << 16 ^ s3 >>> 24 ^ s3 << 8;
  52185. state[j] = t >>> 24 & 0xff;
  52186. state[j + 1] = t >> 16 & 0xff;
  52187. state[j + 2] = t >> 8 & 0xff;
  52188. state[j + 3] = t & 0xff;
  52189. }
  52190. }
  52191. t = state[13];
  52192. state[13] = state[9];
  52193. state[9] = state[5];
  52194. state[5] = state[1];
  52195. state[1] = t;
  52196. t = state[14];
  52197. u = state[10];
  52198. state[14] = state[6];
  52199. state[10] = state[2];
  52200. state[6] = t;
  52201. state[2] = u;
  52202. t = state[15];
  52203. u = state[11];
  52204. v = state[7];
  52205. state[15] = state[3];
  52206. state[11] = t;
  52207. state[7] = u;
  52208. state[3] = v;
  52209. for (let j = 0; j < 16; ++j) {
  52210. state[j] = this._inv_s[state[j]];
  52211. state[j] ^= key[j];
  52212. }
  52213. return state;
  52214. }
  52215. _encrypt(input, key) {
  52216. const s = this._s;
  52217. let t, u, v;
  52218. const state = new Uint8Array(16);
  52219. state.set(input);
  52220. for (let j = 0; j < 16; ++j) {
  52221. state[j] ^= key[j];
  52222. }
  52223. for (let i = 1; i < this._cyclesOfRepetition; i++) {
  52224. for (let j = 0; j < 16; ++j) {
  52225. state[j] = s[state[j]];
  52226. }
  52227. v = state[1];
  52228. state[1] = state[5];
  52229. state[5] = state[9];
  52230. state[9] = state[13];
  52231. state[13] = v;
  52232. v = state[2];
  52233. u = state[6];
  52234. state[2] = state[10];
  52235. state[6] = state[14];
  52236. state[10] = v;
  52237. state[14] = u;
  52238. v = state[3];
  52239. u = state[7];
  52240. t = state[11];
  52241. state[3] = state[15];
  52242. state[7] = v;
  52243. state[11] = u;
  52244. state[15] = t;
  52245. for (let j = 0; j < 16; j += 4) {
  52246. const s0 = state[j + 0];
  52247. const s1 = state[j + 1];
  52248. const s2 = state[j + 2];
  52249. const s3 = state[j + 3];
  52250. t = s0 ^ s1 ^ s2 ^ s3;
  52251. state[j + 0] ^= t ^ this._mixCol[s0 ^ s1];
  52252. state[j + 1] ^= t ^ this._mixCol[s1 ^ s2];
  52253. state[j + 2] ^= t ^ this._mixCol[s2 ^ s3];
  52254. state[j + 3] ^= t ^ this._mixCol[s3 ^ s0];
  52255. }
  52256. for (let j = 0, k = i * 16; j < 16; ++j, ++k) {
  52257. state[j] ^= key[k];
  52258. }
  52259. }
  52260. for (let j = 0; j < 16; ++j) {
  52261. state[j] = s[state[j]];
  52262. }
  52263. v = state[1];
  52264. state[1] = state[5];
  52265. state[5] = state[9];
  52266. state[9] = state[13];
  52267. state[13] = v;
  52268. v = state[2];
  52269. u = state[6];
  52270. state[2] = state[10];
  52271. state[6] = state[14];
  52272. state[10] = v;
  52273. state[14] = u;
  52274. v = state[3];
  52275. u = state[7];
  52276. t = state[11];
  52277. state[3] = state[15];
  52278. state[7] = v;
  52279. state[11] = u;
  52280. state[15] = t;
  52281. for (let j = 0, k = this._keySize; j < 16; ++j, ++k) {
  52282. state[j] ^= key[k];
  52283. }
  52284. return state;
  52285. }
  52286. _decryptBlock2(data, finalize) {
  52287. const sourceLength = data.length;
  52288. let buffer = this.buffer,
  52289. bufferLength = this.bufferPosition;
  52290. const result = [];
  52291. let iv = this.iv;
  52292. for (let i = 0; i < sourceLength; ++i) {
  52293. buffer[bufferLength] = data[i];
  52294. ++bufferLength;
  52295. if (bufferLength < 16) {
  52296. continue;
  52297. }
  52298. const plain = this._decrypt(buffer, this._key);
  52299. for (let j = 0; j < 16; ++j) {
  52300. plain[j] ^= iv[j];
  52301. }
  52302. iv = buffer;
  52303. result.push(plain);
  52304. buffer = new Uint8Array(16);
  52305. bufferLength = 0;
  52306. }
  52307. this.buffer = buffer;
  52308. this.bufferLength = bufferLength;
  52309. this.iv = iv;
  52310. if (result.length === 0) {
  52311. return new Uint8Array(0);
  52312. }
  52313. let outputLength = 16 * result.length;
  52314. if (finalize) {
  52315. const lastBlock = result.at(-1);
  52316. let psLen = lastBlock[15];
  52317. if (psLen <= 16) {
  52318. for (let i = 15, ii = 16 - psLen; i >= ii; --i) {
  52319. if (lastBlock[i] !== psLen) {
  52320. psLen = 0;
  52321. break;
  52322. }
  52323. }
  52324. outputLength -= psLen;
  52325. result[result.length - 1] = lastBlock.subarray(0, 16 - psLen);
  52326. }
  52327. }
  52328. const output = new Uint8Array(outputLength);
  52329. for (let i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  52330. output.set(result[i], j);
  52331. }
  52332. return output;
  52333. }
  52334. decryptBlock(data, finalize) {
  52335. let iv = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  52336. const sourceLength = data.length;
  52337. const buffer = this.buffer;
  52338. let bufferLength = this.bufferPosition;
  52339. if (iv) {
  52340. this.iv = iv;
  52341. } else {
  52342. for (let i = 0; bufferLength < 16 && i < sourceLength; ++i, ++bufferLength) {
  52343. buffer[bufferLength] = data[i];
  52344. }
  52345. if (bufferLength < 16) {
  52346. this.bufferLength = bufferLength;
  52347. return new Uint8Array(0);
  52348. }
  52349. this.iv = buffer;
  52350. data = data.subarray(16);
  52351. }
  52352. this.buffer = new Uint8Array(16);
  52353. this.bufferLength = 0;
  52354. this.decryptBlock = this._decryptBlock2;
  52355. return this.decryptBlock(data, finalize);
  52356. }
  52357. encrypt(data, iv) {
  52358. const sourceLength = data.length;
  52359. let buffer = this.buffer,
  52360. bufferLength = this.bufferPosition;
  52361. const result = [];
  52362. if (!iv) {
  52363. iv = new Uint8Array(16);
  52364. }
  52365. for (let i = 0; i < sourceLength; ++i) {
  52366. buffer[bufferLength] = data[i];
  52367. ++bufferLength;
  52368. if (bufferLength < 16) {
  52369. continue;
  52370. }
  52371. for (let j = 0; j < 16; ++j) {
  52372. buffer[j] ^= iv[j];
  52373. }
  52374. const cipher = this._encrypt(buffer, this._key);
  52375. iv = cipher;
  52376. result.push(cipher);
  52377. buffer = new Uint8Array(16);
  52378. bufferLength = 0;
  52379. }
  52380. this.buffer = buffer;
  52381. this.bufferLength = bufferLength;
  52382. this.iv = iv;
  52383. if (result.length === 0) {
  52384. return new Uint8Array(0);
  52385. }
  52386. const outputLength = 16 * result.length;
  52387. const output = new Uint8Array(outputLength);
  52388. for (let i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  52389. output.set(result[i], j);
  52390. }
  52391. return output;
  52392. }
  52393. }
  52394. class AES128Cipher extends AESBaseCipher {
  52395. constructor(key) {
  52396. super();
  52397. this._cyclesOfRepetition = 10;
  52398. this._keySize = 160;
  52399. 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]);
  52400. this._key = this._expandKey(key);
  52401. }
  52402. _expandKey(cipherKey) {
  52403. const b = 176;
  52404. const s = this._s;
  52405. const rcon = this._rcon;
  52406. const result = new Uint8Array(b);
  52407. result.set(cipherKey);
  52408. for (let j = 16, i = 1; j < b; ++i) {
  52409. let t1 = result[j - 3];
  52410. let t2 = result[j - 2];
  52411. let t3 = result[j - 1];
  52412. let t4 = result[j - 4];
  52413. t1 = s[t1];
  52414. t2 = s[t2];
  52415. t3 = s[t3];
  52416. t4 = s[t4];
  52417. t1 ^= rcon[i];
  52418. for (let n = 0; n < 4; ++n) {
  52419. result[j] = t1 ^= result[j - 16];
  52420. j++;
  52421. result[j] = t2 ^= result[j - 16];
  52422. j++;
  52423. result[j] = t3 ^= result[j - 16];
  52424. j++;
  52425. result[j] = t4 ^= result[j - 16];
  52426. j++;
  52427. }
  52428. }
  52429. return result;
  52430. }
  52431. }
  52432. exports.AES128Cipher = AES128Cipher;
  52433. class AES256Cipher extends AESBaseCipher {
  52434. constructor(key) {
  52435. super();
  52436. this._cyclesOfRepetition = 14;
  52437. this._keySize = 224;
  52438. this._key = this._expandKey(key);
  52439. }
  52440. _expandKey(cipherKey) {
  52441. const b = 240;
  52442. const s = this._s;
  52443. const result = new Uint8Array(b);
  52444. result.set(cipherKey);
  52445. let r = 1;
  52446. let t1, t2, t3, t4;
  52447. for (let j = 32, i = 1; j < b; ++i) {
  52448. if (j % 32 === 16) {
  52449. t1 = s[t1];
  52450. t2 = s[t2];
  52451. t3 = s[t3];
  52452. t4 = s[t4];
  52453. } else if (j % 32 === 0) {
  52454. t1 = result[j - 3];
  52455. t2 = result[j - 2];
  52456. t3 = result[j - 1];
  52457. t4 = result[j - 4];
  52458. t1 = s[t1];
  52459. t2 = s[t2];
  52460. t3 = s[t3];
  52461. t4 = s[t4];
  52462. t1 ^= r;
  52463. if ((r <<= 1) >= 256) {
  52464. r = (r ^ 0x1b) & 0xff;
  52465. }
  52466. }
  52467. for (let n = 0; n < 4; ++n) {
  52468. result[j] = t1 ^= result[j - 32];
  52469. j++;
  52470. result[j] = t2 ^= result[j - 32];
  52471. j++;
  52472. result[j] = t3 ^= result[j - 32];
  52473. j++;
  52474. result[j] = t4 ^= result[j - 32];
  52475. j++;
  52476. }
  52477. }
  52478. return result;
  52479. }
  52480. }
  52481. exports.AES256Cipher = AES256Cipher;
  52482. class PDF17 {
  52483. checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {
  52484. const hashData = new Uint8Array(password.length + 56);
  52485. hashData.set(password, 0);
  52486. hashData.set(ownerValidationSalt, password.length);
  52487. hashData.set(userBytes, password.length + ownerValidationSalt.length);
  52488. const result = calculateSHA256(hashData, 0, hashData.length);
  52489. return (0, _util.isArrayEqual)(result, ownerPassword);
  52490. }
  52491. checkUserPassword(password, userValidationSalt, userPassword) {
  52492. const hashData = new Uint8Array(password.length + 8);
  52493. hashData.set(password, 0);
  52494. hashData.set(userValidationSalt, password.length);
  52495. const result = calculateSHA256(hashData, 0, hashData.length);
  52496. return (0, _util.isArrayEqual)(result, userPassword);
  52497. }
  52498. getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
  52499. const hashData = new Uint8Array(password.length + 56);
  52500. hashData.set(password, 0);
  52501. hashData.set(ownerKeySalt, password.length);
  52502. hashData.set(userBytes, password.length + ownerKeySalt.length);
  52503. const key = calculateSHA256(hashData, 0, hashData.length);
  52504. const cipher = new AES256Cipher(key);
  52505. return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));
  52506. }
  52507. getUserKey(password, userKeySalt, userEncryption) {
  52508. const hashData = new Uint8Array(password.length + 8);
  52509. hashData.set(password, 0);
  52510. hashData.set(userKeySalt, password.length);
  52511. const key = calculateSHA256(hashData, 0, hashData.length);
  52512. const cipher = new AES256Cipher(key);
  52513. return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));
  52514. }
  52515. }
  52516. exports.PDF17 = PDF17;
  52517. const PDF20 = function PDF20Closure() {
  52518. function calculatePDF20Hash(password, input, userBytes) {
  52519. let k = calculateSHA256(input, 0, input.length).subarray(0, 32);
  52520. let e = [0];
  52521. let i = 0;
  52522. while (i < 64 || e.at(-1) > i - 32) {
  52523. const combinedLength = password.length + k.length + userBytes.length,
  52524. combinedArray = new Uint8Array(combinedLength);
  52525. let writeOffset = 0;
  52526. combinedArray.set(password, writeOffset);
  52527. writeOffset += password.length;
  52528. combinedArray.set(k, writeOffset);
  52529. writeOffset += k.length;
  52530. combinedArray.set(userBytes, writeOffset);
  52531. const k1 = new Uint8Array(combinedLength * 64);
  52532. for (let j = 0, pos = 0; j < 64; j++, pos += combinedLength) {
  52533. k1.set(combinedArray, pos);
  52534. }
  52535. const cipher = new AES128Cipher(k.subarray(0, 16));
  52536. e = cipher.encrypt(k1, k.subarray(16, 32));
  52537. const remainder = e.slice(0, 16).reduce((a, b) => a + b, 0) % 3;
  52538. if (remainder === 0) {
  52539. k = calculateSHA256(e, 0, e.length);
  52540. } else if (remainder === 1) {
  52541. k = calculateSHA384(e, 0, e.length);
  52542. } else if (remainder === 2) {
  52543. k = calculateSHA512(e, 0, e.length);
  52544. }
  52545. i++;
  52546. }
  52547. return k.subarray(0, 32);
  52548. }
  52549. class PDF20 {
  52550. hash(password, concatBytes, userBytes) {
  52551. return calculatePDF20Hash(password, concatBytes, userBytes);
  52552. }
  52553. checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {
  52554. const hashData = new Uint8Array(password.length + 56);
  52555. hashData.set(password, 0);
  52556. hashData.set(ownerValidationSalt, password.length);
  52557. hashData.set(userBytes, password.length + ownerValidationSalt.length);
  52558. const result = calculatePDF20Hash(password, hashData, userBytes);
  52559. return (0, _util.isArrayEqual)(result, ownerPassword);
  52560. }
  52561. checkUserPassword(password, userValidationSalt, userPassword) {
  52562. const hashData = new Uint8Array(password.length + 8);
  52563. hashData.set(password, 0);
  52564. hashData.set(userValidationSalt, password.length);
  52565. const result = calculatePDF20Hash(password, hashData, []);
  52566. return (0, _util.isArrayEqual)(result, userPassword);
  52567. }
  52568. getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
  52569. const hashData = new Uint8Array(password.length + 56);
  52570. hashData.set(password, 0);
  52571. hashData.set(ownerKeySalt, password.length);
  52572. hashData.set(userBytes, password.length + ownerKeySalt.length);
  52573. const key = calculatePDF20Hash(password, hashData, userBytes);
  52574. const cipher = new AES256Cipher(key);
  52575. return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));
  52576. }
  52577. getUserKey(password, userKeySalt, userEncryption) {
  52578. const hashData = new Uint8Array(password.length + 8);
  52579. hashData.set(password, 0);
  52580. hashData.set(userKeySalt, password.length);
  52581. const key = calculatePDF20Hash(password, hashData, []);
  52582. const cipher = new AES256Cipher(key);
  52583. return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));
  52584. }
  52585. }
  52586. return PDF20;
  52587. }();
  52588. exports.PDF20 = PDF20;
  52589. class CipherTransform {
  52590. constructor(stringCipherConstructor, streamCipherConstructor) {
  52591. this.StringCipherConstructor = stringCipherConstructor;
  52592. this.StreamCipherConstructor = streamCipherConstructor;
  52593. }
  52594. createStream(stream, length) {
  52595. const cipher = new this.StreamCipherConstructor();
  52596. return new _decrypt_stream.DecryptStream(stream, length, function cipherTransformDecryptStream(data, finalize) {
  52597. return cipher.decryptBlock(data, finalize);
  52598. });
  52599. }
  52600. decryptString(s) {
  52601. const cipher = new this.StringCipherConstructor();
  52602. let data = (0, _util.stringToBytes)(s);
  52603. data = cipher.decryptBlock(data, true);
  52604. return (0, _util.bytesToString)(data);
  52605. }
  52606. encryptString(s) {
  52607. const cipher = new this.StringCipherConstructor();
  52608. if (cipher instanceof AESBaseCipher) {
  52609. const strLen = s.length;
  52610. const pad = 16 - strLen % 16;
  52611. s += String.fromCharCode(pad).repeat(pad);
  52612. const iv = new Uint8Array(16);
  52613. if (typeof crypto !== "undefined") {
  52614. crypto.getRandomValues(iv);
  52615. } else {
  52616. for (let i = 0; i < 16; i++) {
  52617. iv[i] = Math.floor(256 * Math.random());
  52618. }
  52619. }
  52620. let data = (0, _util.stringToBytes)(s);
  52621. data = cipher.encrypt(data, iv);
  52622. const buf = new Uint8Array(16 + data.length);
  52623. buf.set(iv);
  52624. buf.set(data, 16);
  52625. return (0, _util.bytesToString)(buf);
  52626. }
  52627. let data = (0, _util.stringToBytes)(s);
  52628. data = cipher.encrypt(data);
  52629. return (0, _util.bytesToString)(data);
  52630. }
  52631. }
  52632. const CipherTransformFactory = function CipherTransformFactoryClosure() {
  52633. 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]);
  52634. function createEncryptionKey20(revision, password, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms) {
  52635. if (password) {
  52636. const passwordLength = Math.min(127, password.length);
  52637. password = password.subarray(0, passwordLength);
  52638. } else {
  52639. password = [];
  52640. }
  52641. let pdfAlgorithm;
  52642. if (revision === 6) {
  52643. pdfAlgorithm = new PDF20();
  52644. } else {
  52645. pdfAlgorithm = new PDF17();
  52646. }
  52647. if (pdfAlgorithm.checkUserPassword(password, userValidationSalt, userPassword)) {
  52648. return pdfAlgorithm.getUserKey(password, userKeySalt, userEncryption);
  52649. } else if (password.length && pdfAlgorithm.checkOwnerPassword(password, ownerValidationSalt, uBytes, ownerPassword)) {
  52650. return pdfAlgorithm.getOwnerKey(password, ownerKeySalt, uBytes, ownerEncryption);
  52651. }
  52652. return null;
  52653. }
  52654. function prepareKeyData(fileId, password, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata) {
  52655. const hashDataSize = 40 + ownerPassword.length + fileId.length;
  52656. const hashData = new Uint8Array(hashDataSize);
  52657. let i = 0,
  52658. j,
  52659. n;
  52660. if (password) {
  52661. n = Math.min(32, password.length);
  52662. for (; i < n; ++i) {
  52663. hashData[i] = password[i];
  52664. }
  52665. }
  52666. j = 0;
  52667. while (i < 32) {
  52668. hashData[i++] = defaultPasswordBytes[j++];
  52669. }
  52670. for (j = 0, n = ownerPassword.length; j < n; ++j) {
  52671. hashData[i++] = ownerPassword[j];
  52672. }
  52673. hashData[i++] = flags & 0xff;
  52674. hashData[i++] = flags >> 8 & 0xff;
  52675. hashData[i++] = flags >> 16 & 0xff;
  52676. hashData[i++] = flags >>> 24 & 0xff;
  52677. for (j = 0, n = fileId.length; j < n; ++j) {
  52678. hashData[i++] = fileId[j];
  52679. }
  52680. if (revision >= 4 && !encryptMetadata) {
  52681. hashData[i++] = 0xff;
  52682. hashData[i++] = 0xff;
  52683. hashData[i++] = 0xff;
  52684. hashData[i++] = 0xff;
  52685. }
  52686. let hash = calculateMD5(hashData, 0, i);
  52687. const keyLengthInBytes = keyLength >> 3;
  52688. if (revision >= 3) {
  52689. for (j = 0; j < 50; ++j) {
  52690. hash = calculateMD5(hash, 0, keyLengthInBytes);
  52691. }
  52692. }
  52693. const encryptionKey = hash.subarray(0, keyLengthInBytes);
  52694. let cipher, checkData;
  52695. if (revision >= 3) {
  52696. for (i = 0; i < 32; ++i) {
  52697. hashData[i] = defaultPasswordBytes[i];
  52698. }
  52699. for (j = 0, n = fileId.length; j < n; ++j) {
  52700. hashData[i++] = fileId[j];
  52701. }
  52702. cipher = new ARCFourCipher(encryptionKey);
  52703. checkData = cipher.encryptBlock(calculateMD5(hashData, 0, i));
  52704. n = encryptionKey.length;
  52705. const derivedKey = new Uint8Array(n);
  52706. for (j = 1; j <= 19; ++j) {
  52707. for (let k = 0; k < n; ++k) {
  52708. derivedKey[k] = encryptionKey[k] ^ j;
  52709. }
  52710. cipher = new ARCFourCipher(derivedKey);
  52711. checkData = cipher.encryptBlock(checkData);
  52712. }
  52713. for (j = 0, n = checkData.length; j < n; ++j) {
  52714. if (userPassword[j] !== checkData[j]) {
  52715. return null;
  52716. }
  52717. }
  52718. } else {
  52719. cipher = new ARCFourCipher(encryptionKey);
  52720. checkData = cipher.encryptBlock(defaultPasswordBytes);
  52721. for (j = 0, n = checkData.length; j < n; ++j) {
  52722. if (userPassword[j] !== checkData[j]) {
  52723. return null;
  52724. }
  52725. }
  52726. }
  52727. return encryptionKey;
  52728. }
  52729. function decodeUserPassword(password, ownerPassword, revision, keyLength) {
  52730. const hashData = new Uint8Array(32);
  52731. let i = 0;
  52732. const n = Math.min(32, password.length);
  52733. for (; i < n; ++i) {
  52734. hashData[i] = password[i];
  52735. }
  52736. let j = 0;
  52737. while (i < 32) {
  52738. hashData[i++] = defaultPasswordBytes[j++];
  52739. }
  52740. let hash = calculateMD5(hashData, 0, i);
  52741. const keyLengthInBytes = keyLength >> 3;
  52742. if (revision >= 3) {
  52743. for (j = 0; j < 50; ++j) {
  52744. hash = calculateMD5(hash, 0, hash.length);
  52745. }
  52746. }
  52747. let cipher, userPassword;
  52748. if (revision >= 3) {
  52749. userPassword = ownerPassword;
  52750. const derivedKey = new Uint8Array(keyLengthInBytes);
  52751. for (j = 19; j >= 0; j--) {
  52752. for (let k = 0; k < keyLengthInBytes; ++k) {
  52753. derivedKey[k] = hash[k] ^ j;
  52754. }
  52755. cipher = new ARCFourCipher(derivedKey);
  52756. userPassword = cipher.encryptBlock(userPassword);
  52757. }
  52758. } else {
  52759. cipher = new ARCFourCipher(hash.subarray(0, keyLengthInBytes));
  52760. userPassword = cipher.encryptBlock(ownerPassword);
  52761. }
  52762. return userPassword;
  52763. }
  52764. const identityName = _primitives.Name.get("Identity");
  52765. function buildObjectKey(num, gen, encryptionKey) {
  52766. let isAes = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  52767. const key = new Uint8Array(encryptionKey.length + 9);
  52768. const n = encryptionKey.length;
  52769. let i;
  52770. for (i = 0; i < n; ++i) {
  52771. key[i] = encryptionKey[i];
  52772. }
  52773. key[i++] = num & 0xff;
  52774. key[i++] = num >> 8 & 0xff;
  52775. key[i++] = num >> 16 & 0xff;
  52776. key[i++] = gen & 0xff;
  52777. key[i++] = gen >> 8 & 0xff;
  52778. if (isAes) {
  52779. key[i++] = 0x73;
  52780. key[i++] = 0x41;
  52781. key[i++] = 0x6c;
  52782. key[i++] = 0x54;
  52783. }
  52784. const hash = calculateMD5(key, 0, i);
  52785. return hash.subarray(0, Math.min(encryptionKey.length + 5, 16));
  52786. }
  52787. function buildCipherConstructor(cf, name, num, gen, key) {
  52788. if (!(name instanceof _primitives.Name)) {
  52789. throw new _util.FormatError("Invalid crypt filter name.");
  52790. }
  52791. const cryptFilter = cf.get(name.name);
  52792. let cfm;
  52793. if (cryptFilter !== null && cryptFilter !== undefined) {
  52794. cfm = cryptFilter.get("CFM");
  52795. }
  52796. if (!cfm || cfm.name === "None") {
  52797. return function cipherTransformFactoryBuildCipherConstructorNone() {
  52798. return new NullCipher();
  52799. };
  52800. }
  52801. if (cfm.name === "V2") {
  52802. return function cipherTransformFactoryBuildCipherConstructorV2() {
  52803. return new ARCFourCipher(buildObjectKey(num, gen, key, false));
  52804. };
  52805. }
  52806. if (cfm.name === "AESV2") {
  52807. return function cipherTransformFactoryBuildCipherConstructorAESV2() {
  52808. return new AES128Cipher(buildObjectKey(num, gen, key, true));
  52809. };
  52810. }
  52811. if (cfm.name === "AESV3") {
  52812. return function cipherTransformFactoryBuildCipherConstructorAESV3() {
  52813. return new AES256Cipher(key);
  52814. };
  52815. }
  52816. throw new _util.FormatError("Unknown crypto method");
  52817. }
  52818. class CipherTransformFactory {
  52819. constructor(dict, fileId, password) {
  52820. const filter = dict.get("Filter");
  52821. if (!(0, _primitives.isName)(filter, "Standard")) {
  52822. throw new _util.FormatError("unknown encryption method");
  52823. }
  52824. this.filterName = filter.name;
  52825. this.dict = dict;
  52826. const algorithm = dict.get("V");
  52827. if (!Number.isInteger(algorithm) || algorithm !== 1 && algorithm !== 2 && algorithm !== 4 && algorithm !== 5) {
  52828. throw new _util.FormatError("unsupported encryption algorithm");
  52829. }
  52830. this.algorithm = algorithm;
  52831. let keyLength = dict.get("Length");
  52832. if (!keyLength) {
  52833. if (algorithm <= 3) {
  52834. keyLength = 40;
  52835. } else {
  52836. const cfDict = dict.get("CF");
  52837. const streamCryptoName = dict.get("StmF");
  52838. if (cfDict instanceof _primitives.Dict && streamCryptoName instanceof _primitives.Name) {
  52839. cfDict.suppressEncryption = true;
  52840. const handlerDict = cfDict.get(streamCryptoName.name);
  52841. keyLength = handlerDict && handlerDict.get("Length") || 128;
  52842. if (keyLength < 40) {
  52843. keyLength <<= 3;
  52844. }
  52845. }
  52846. }
  52847. }
  52848. if (!Number.isInteger(keyLength) || keyLength < 40 || keyLength % 8 !== 0) {
  52849. throw new _util.FormatError("invalid key length");
  52850. }
  52851. const ownerPassword = (0, _util.stringToBytes)(dict.get("O")).subarray(0, 32);
  52852. const userPassword = (0, _util.stringToBytes)(dict.get("U")).subarray(0, 32);
  52853. const flags = dict.get("P");
  52854. const revision = dict.get("R");
  52855. const encryptMetadata = (algorithm === 4 || algorithm === 5) && dict.get("EncryptMetadata") !== false;
  52856. this.encryptMetadata = encryptMetadata;
  52857. const fileIdBytes = (0, _util.stringToBytes)(fileId);
  52858. let passwordBytes;
  52859. if (password) {
  52860. if (revision === 6) {
  52861. try {
  52862. password = (0, _util.utf8StringToString)(password);
  52863. } catch (ex) {
  52864. (0, _util.warn)("CipherTransformFactory: " + "Unable to convert UTF8 encoded password.");
  52865. }
  52866. }
  52867. passwordBytes = (0, _util.stringToBytes)(password);
  52868. }
  52869. let encryptionKey;
  52870. if (algorithm !== 5) {
  52871. encryptionKey = prepareKeyData(fileIdBytes, passwordBytes, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
  52872. } else {
  52873. const ownerValidationSalt = (0, _util.stringToBytes)(dict.get("O")).subarray(32, 40);
  52874. const ownerKeySalt = (0, _util.stringToBytes)(dict.get("O")).subarray(40, 48);
  52875. const uBytes = (0, _util.stringToBytes)(dict.get("U")).subarray(0, 48);
  52876. const userValidationSalt = (0, _util.stringToBytes)(dict.get("U")).subarray(32, 40);
  52877. const userKeySalt = (0, _util.stringToBytes)(dict.get("U")).subarray(40, 48);
  52878. const ownerEncryption = (0, _util.stringToBytes)(dict.get("OE"));
  52879. const userEncryption = (0, _util.stringToBytes)(dict.get("UE"));
  52880. const perms = (0, _util.stringToBytes)(dict.get("Perms"));
  52881. encryptionKey = createEncryptionKey20(revision, passwordBytes, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms);
  52882. }
  52883. if (!encryptionKey && !password) {
  52884. throw new _util.PasswordException("No password given", _util.PasswordResponses.NEED_PASSWORD);
  52885. } else if (!encryptionKey && password) {
  52886. const decodedPassword = decodeUserPassword(passwordBytes, ownerPassword, revision, keyLength);
  52887. encryptionKey = prepareKeyData(fileIdBytes, decodedPassword, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
  52888. }
  52889. if (!encryptionKey) {
  52890. throw new _util.PasswordException("Incorrect Password", _util.PasswordResponses.INCORRECT_PASSWORD);
  52891. }
  52892. this.encryptionKey = encryptionKey;
  52893. if (algorithm >= 4) {
  52894. const cf = dict.get("CF");
  52895. if (cf instanceof _primitives.Dict) {
  52896. cf.suppressEncryption = true;
  52897. }
  52898. this.cf = cf;
  52899. this.stmf = dict.get("StmF") || identityName;
  52900. this.strf = dict.get("StrF") || identityName;
  52901. this.eff = dict.get("EFF") || this.stmf;
  52902. }
  52903. }
  52904. createCipherTransform(num, gen) {
  52905. if (this.algorithm === 4 || this.algorithm === 5) {
  52906. return new CipherTransform(buildCipherConstructor(this.cf, this.strf, num, gen, this.encryptionKey), buildCipherConstructor(this.cf, this.stmf, num, gen, this.encryptionKey));
  52907. }
  52908. const key = buildObjectKey(num, gen, this.encryptionKey, false);
  52909. const cipherConstructor = function buildCipherCipherConstructor() {
  52910. return new ARCFourCipher(key);
  52911. };
  52912. return new CipherTransform(cipherConstructor, cipherConstructor);
  52913. }
  52914. }
  52915. return CipherTransformFactory;
  52916. }();
  52917. exports.CipherTransformFactory = CipherTransformFactory;
  52918. /***/ }),
  52919. /* 197 */
  52920. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  52921. "use strict";
  52922. Object.defineProperty(exports, "__esModule", ({
  52923. value: true
  52924. }));
  52925. exports.DecryptStream = void 0;
  52926. var _decode_stream = __w_pdfjs_require__(148);
  52927. const chunkSize = 512;
  52928. class DecryptStream extends _decode_stream.DecodeStream {
  52929. constructor(str, maybeLength, decrypt) {
  52930. super(maybeLength);
  52931. this.str = str;
  52932. this.dict = str.dict;
  52933. this.decrypt = decrypt;
  52934. this.nextChunk = null;
  52935. this.initialized = false;
  52936. }
  52937. readBlock() {
  52938. let chunk;
  52939. if (this.initialized) {
  52940. chunk = this.nextChunk;
  52941. } else {
  52942. chunk = this.str.getBytes(chunkSize);
  52943. this.initialized = true;
  52944. }
  52945. if (!chunk || chunk.length === 0) {
  52946. this.eof = true;
  52947. return;
  52948. }
  52949. this.nextChunk = this.str.getBytes(chunkSize);
  52950. const hasMoreData = this.nextChunk && this.nextChunk.length > 0;
  52951. const decrypt = this.decrypt;
  52952. chunk = decrypt(chunk, !hasMoreData);
  52953. const bufferLength = this.bufferLength,
  52954. newLength = bufferLength + chunk.length,
  52955. buffer = this.ensureBuffer(newLength);
  52956. buffer.set(chunk, bufferLength);
  52957. this.bufferLength = newLength;
  52958. }
  52959. }
  52960. exports.DecryptStream = DecryptStream;
  52961. /***/ }),
  52962. /* 198 */
  52963. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  52964. "use strict";
  52965. Object.defineProperty(exports, "__esModule", ({
  52966. value: true
  52967. }));
  52968. exports.Catalog = void 0;
  52969. var _core_utils = __w_pdfjs_require__(135);
  52970. var _util = __w_pdfjs_require__(2);
  52971. var _primitives = __w_pdfjs_require__(134);
  52972. var _name_number_tree = __w_pdfjs_require__(199);
  52973. var _base_stream = __w_pdfjs_require__(136);
  52974. var _cleanup_helper = __w_pdfjs_require__(200);
  52975. var _colorspace = __w_pdfjs_require__(143);
  52976. var _file_spec = __w_pdfjs_require__(201);
  52977. var _image_utils = __w_pdfjs_require__(188);
  52978. var _metadata_parser = __w_pdfjs_require__(202);
  52979. var _struct_tree = __w_pdfjs_require__(203);
  52980. function fetchDestination(dest) {
  52981. if (dest instanceof _primitives.Dict) {
  52982. dest = dest.get("D");
  52983. }
  52984. return Array.isArray(dest) ? dest : null;
  52985. }
  52986. class Catalog {
  52987. constructor(pdfManager, xref) {
  52988. this.pdfManager = pdfManager;
  52989. this.xref = xref;
  52990. this._catDict = xref.getCatalogObj();
  52991. if (!(this._catDict instanceof _primitives.Dict)) {
  52992. throw new _util.FormatError("Catalog object is not a dictionary.");
  52993. }
  52994. this.toplevelPagesDict;
  52995. this._actualNumPages = null;
  52996. this.fontCache = new _primitives.RefSetCache();
  52997. this.builtInCMapCache = new Map();
  52998. this.standardFontDataCache = new Map();
  52999. this.globalImageCache = new _image_utils.GlobalImageCache();
  53000. this.pageKidsCountCache = new _primitives.RefSetCache();
  53001. this.pageIndexCache = new _primitives.RefSetCache();
  53002. this.nonBlendModesSet = new _primitives.RefSet();
  53003. }
  53004. get version() {
  53005. const version = this._catDict.get("Version");
  53006. if (version instanceof _primitives.Name) {
  53007. if (_core_utils.PDF_VERSION_REGEXP.test(version.name)) {
  53008. return (0, _util.shadow)(this, "version", version.name);
  53009. }
  53010. (0, _util.warn)(`Invalid PDF catalog version: ${version.name}`);
  53011. }
  53012. return (0, _util.shadow)(this, "version", null);
  53013. }
  53014. get lang() {
  53015. const lang = this._catDict.get("Lang");
  53016. return (0, _util.shadow)(this, "lang", typeof lang === "string" ? (0, _util.stringToPDFString)(lang) : null);
  53017. }
  53018. get needsRendering() {
  53019. const needsRendering = this._catDict.get("NeedsRendering");
  53020. return (0, _util.shadow)(this, "needsRendering", typeof needsRendering === "boolean" ? needsRendering : false);
  53021. }
  53022. get collection() {
  53023. let collection = null;
  53024. try {
  53025. const obj = this._catDict.get("Collection");
  53026. if (obj instanceof _primitives.Dict && obj.size > 0) {
  53027. collection = obj;
  53028. }
  53029. } catch (ex) {
  53030. if (ex instanceof _core_utils.MissingDataException) {
  53031. throw ex;
  53032. }
  53033. (0, _util.info)("Cannot fetch Collection entry; assuming no collection is present.");
  53034. }
  53035. return (0, _util.shadow)(this, "collection", collection);
  53036. }
  53037. get acroForm() {
  53038. let acroForm = null;
  53039. try {
  53040. const obj = this._catDict.get("AcroForm");
  53041. if (obj instanceof _primitives.Dict && obj.size > 0) {
  53042. acroForm = obj;
  53043. }
  53044. } catch (ex) {
  53045. if (ex instanceof _core_utils.MissingDataException) {
  53046. throw ex;
  53047. }
  53048. (0, _util.info)("Cannot fetch AcroForm entry; assuming no forms are present.");
  53049. }
  53050. return (0, _util.shadow)(this, "acroForm", acroForm);
  53051. }
  53052. get acroFormRef() {
  53053. const value = this._catDict.getRaw("AcroForm");
  53054. return (0, _util.shadow)(this, "acroFormRef", value instanceof _primitives.Ref ? value : null);
  53055. }
  53056. get metadata() {
  53057. const streamRef = this._catDict.getRaw("Metadata");
  53058. if (!(streamRef instanceof _primitives.Ref)) {
  53059. return (0, _util.shadow)(this, "metadata", null);
  53060. }
  53061. let metadata = null;
  53062. try {
  53063. const suppressEncryption = !(this.xref.encrypt && this.xref.encrypt.encryptMetadata);
  53064. const stream = this.xref.fetch(streamRef, suppressEncryption);
  53065. if (stream instanceof _base_stream.BaseStream && stream.dict instanceof _primitives.Dict) {
  53066. const type = stream.dict.get("Type");
  53067. const subtype = stream.dict.get("Subtype");
  53068. if ((0, _primitives.isName)(type, "Metadata") && (0, _primitives.isName)(subtype, "XML")) {
  53069. const data = (0, _util.stringToUTF8String)(stream.getString());
  53070. if (data) {
  53071. metadata = new _metadata_parser.MetadataParser(data).serializable;
  53072. }
  53073. }
  53074. }
  53075. } catch (ex) {
  53076. if (ex instanceof _core_utils.MissingDataException) {
  53077. throw ex;
  53078. }
  53079. (0, _util.info)(`Skipping invalid Metadata: "${ex}".`);
  53080. }
  53081. return (0, _util.shadow)(this, "metadata", metadata);
  53082. }
  53083. get markInfo() {
  53084. let markInfo = null;
  53085. try {
  53086. markInfo = this._readMarkInfo();
  53087. } catch (ex) {
  53088. if (ex instanceof _core_utils.MissingDataException) {
  53089. throw ex;
  53090. }
  53091. (0, _util.warn)("Unable to read mark info.");
  53092. }
  53093. return (0, _util.shadow)(this, "markInfo", markInfo);
  53094. }
  53095. _readMarkInfo() {
  53096. const obj = this._catDict.get("MarkInfo");
  53097. if (!(obj instanceof _primitives.Dict)) {
  53098. return null;
  53099. }
  53100. const markInfo = {
  53101. Marked: false,
  53102. UserProperties: false,
  53103. Suspects: false
  53104. };
  53105. for (const key in markInfo) {
  53106. const value = obj.get(key);
  53107. if (typeof value === "boolean") {
  53108. markInfo[key] = value;
  53109. }
  53110. }
  53111. return markInfo;
  53112. }
  53113. get structTreeRoot() {
  53114. let structTree = null;
  53115. try {
  53116. structTree = this._readStructTreeRoot();
  53117. } catch (ex) {
  53118. if (ex instanceof _core_utils.MissingDataException) {
  53119. throw ex;
  53120. }
  53121. (0, _util.warn)("Unable read to structTreeRoot info.");
  53122. }
  53123. return (0, _util.shadow)(this, "structTreeRoot", structTree);
  53124. }
  53125. _readStructTreeRoot() {
  53126. const obj = this._catDict.get("StructTreeRoot");
  53127. if (!(obj instanceof _primitives.Dict)) {
  53128. return null;
  53129. }
  53130. const root = new _struct_tree.StructTreeRoot(obj);
  53131. root.init();
  53132. return root;
  53133. }
  53134. get toplevelPagesDict() {
  53135. const pagesObj = this._catDict.get("Pages");
  53136. if (!(pagesObj instanceof _primitives.Dict)) {
  53137. throw new _util.FormatError("Invalid top-level pages dictionary.");
  53138. }
  53139. return (0, _util.shadow)(this, "toplevelPagesDict", pagesObj);
  53140. }
  53141. get documentOutline() {
  53142. let obj = null;
  53143. try {
  53144. obj = this._readDocumentOutline();
  53145. } catch (ex) {
  53146. if (ex instanceof _core_utils.MissingDataException) {
  53147. throw ex;
  53148. }
  53149. (0, _util.warn)("Unable to read document outline.");
  53150. }
  53151. return (0, _util.shadow)(this, "documentOutline", obj);
  53152. }
  53153. _readDocumentOutline() {
  53154. let obj = this._catDict.get("Outlines");
  53155. if (!(obj instanceof _primitives.Dict)) {
  53156. return null;
  53157. }
  53158. obj = obj.getRaw("First");
  53159. if (!(obj instanceof _primitives.Ref)) {
  53160. return null;
  53161. }
  53162. const root = {
  53163. items: []
  53164. };
  53165. const queue = [{
  53166. obj,
  53167. parent: root
  53168. }];
  53169. const processed = new _primitives.RefSet();
  53170. processed.put(obj);
  53171. const xref = this.xref,
  53172. blackColor = new Uint8ClampedArray(3);
  53173. while (queue.length > 0) {
  53174. const i = queue.shift();
  53175. const outlineDict = xref.fetchIfRef(i.obj);
  53176. if (outlineDict === null) {
  53177. continue;
  53178. }
  53179. if (!outlineDict.has("Title")) {
  53180. throw new _util.FormatError("Invalid outline item encountered.");
  53181. }
  53182. const data = {
  53183. url: null,
  53184. dest: null,
  53185. action: null
  53186. };
  53187. Catalog.parseDestDictionary({
  53188. destDict: outlineDict,
  53189. resultObj: data,
  53190. docBaseUrl: this.pdfManager.docBaseUrl,
  53191. docAttachments: this.attachments
  53192. });
  53193. const title = outlineDict.get("Title");
  53194. const flags = outlineDict.get("F") || 0;
  53195. const color = outlineDict.getArray("C");
  53196. const count = outlineDict.get("Count");
  53197. let rgbColor = blackColor;
  53198. if (Array.isArray(color) && color.length === 3 && (color[0] !== 0 || color[1] !== 0 || color[2] !== 0)) {
  53199. rgbColor = _colorspace.ColorSpace.singletons.rgb.getRgb(color, 0);
  53200. }
  53201. const outlineItem = {
  53202. action: data.action,
  53203. attachment: data.attachment,
  53204. dest: data.dest,
  53205. url: data.url,
  53206. unsafeUrl: data.unsafeUrl,
  53207. newWindow: data.newWindow,
  53208. setOCGState: data.setOCGState,
  53209. title: (0, _util.stringToPDFString)(title),
  53210. color: rgbColor,
  53211. count: Number.isInteger(count) ? count : undefined,
  53212. bold: !!(flags & 2),
  53213. italic: !!(flags & 1),
  53214. items: []
  53215. };
  53216. i.parent.items.push(outlineItem);
  53217. obj = outlineDict.getRaw("First");
  53218. if (obj instanceof _primitives.Ref && !processed.has(obj)) {
  53219. queue.push({
  53220. obj,
  53221. parent: outlineItem
  53222. });
  53223. processed.put(obj);
  53224. }
  53225. obj = outlineDict.getRaw("Next");
  53226. if (obj instanceof _primitives.Ref && !processed.has(obj)) {
  53227. queue.push({
  53228. obj,
  53229. parent: i.parent
  53230. });
  53231. processed.put(obj);
  53232. }
  53233. }
  53234. return root.items.length > 0 ? root.items : null;
  53235. }
  53236. get permissions() {
  53237. let permissions = null;
  53238. try {
  53239. permissions = this._readPermissions();
  53240. } catch (ex) {
  53241. if (ex instanceof _core_utils.MissingDataException) {
  53242. throw ex;
  53243. }
  53244. (0, _util.warn)("Unable to read permissions.");
  53245. }
  53246. return (0, _util.shadow)(this, "permissions", permissions);
  53247. }
  53248. _readPermissions() {
  53249. const encrypt = this.xref.trailer.get("Encrypt");
  53250. if (!(encrypt instanceof _primitives.Dict)) {
  53251. return null;
  53252. }
  53253. let flags = encrypt.get("P");
  53254. if (typeof flags !== "number") {
  53255. return null;
  53256. }
  53257. flags += 2 ** 32;
  53258. const permissions = [];
  53259. for (const key in _util.PermissionFlag) {
  53260. const value = _util.PermissionFlag[key];
  53261. if (flags & value) {
  53262. permissions.push(value);
  53263. }
  53264. }
  53265. return permissions;
  53266. }
  53267. get optionalContentConfig() {
  53268. let config = null;
  53269. try {
  53270. const properties = this._catDict.get("OCProperties");
  53271. if (!properties) {
  53272. return (0, _util.shadow)(this, "optionalContentConfig", null);
  53273. }
  53274. const defaultConfig = properties.get("D");
  53275. if (!defaultConfig) {
  53276. return (0, _util.shadow)(this, "optionalContentConfig", null);
  53277. }
  53278. const groupsData = properties.get("OCGs");
  53279. if (!Array.isArray(groupsData)) {
  53280. return (0, _util.shadow)(this, "optionalContentConfig", null);
  53281. }
  53282. const groups = [];
  53283. const groupRefs = [];
  53284. for (const groupRef of groupsData) {
  53285. if (!(groupRef instanceof _primitives.Ref)) {
  53286. continue;
  53287. }
  53288. groupRefs.push(groupRef);
  53289. const group = this.xref.fetchIfRef(groupRef);
  53290. groups.push({
  53291. id: groupRef.toString(),
  53292. name: typeof group.get("Name") === "string" ? (0, _util.stringToPDFString)(group.get("Name")) : null,
  53293. intent: typeof group.get("Intent") === "string" ? (0, _util.stringToPDFString)(group.get("Intent")) : null
  53294. });
  53295. }
  53296. config = this._readOptionalContentConfig(defaultConfig, groupRefs);
  53297. config.groups = groups;
  53298. } catch (ex) {
  53299. if (ex instanceof _core_utils.MissingDataException) {
  53300. throw ex;
  53301. }
  53302. (0, _util.warn)(`Unable to read optional content config: ${ex}`);
  53303. }
  53304. return (0, _util.shadow)(this, "optionalContentConfig", config);
  53305. }
  53306. _readOptionalContentConfig(config, contentGroupRefs) {
  53307. function parseOnOff(refs) {
  53308. const onParsed = [];
  53309. if (Array.isArray(refs)) {
  53310. for (const value of refs) {
  53311. if (!(value instanceof _primitives.Ref)) {
  53312. continue;
  53313. }
  53314. if (contentGroupRefs.includes(value)) {
  53315. onParsed.push(value.toString());
  53316. }
  53317. }
  53318. }
  53319. return onParsed;
  53320. }
  53321. function parseOrder(refs) {
  53322. let nestedLevels = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
  53323. if (!Array.isArray(refs)) {
  53324. return null;
  53325. }
  53326. const order = [];
  53327. for (const value of refs) {
  53328. if (value instanceof _primitives.Ref && contentGroupRefs.includes(value)) {
  53329. parsedOrderRefs.put(value);
  53330. order.push(value.toString());
  53331. continue;
  53332. }
  53333. const nestedOrder = parseNestedOrder(value, nestedLevels);
  53334. if (nestedOrder) {
  53335. order.push(nestedOrder);
  53336. }
  53337. }
  53338. if (nestedLevels > 0) {
  53339. return order;
  53340. }
  53341. const hiddenGroups = [];
  53342. for (const groupRef of contentGroupRefs) {
  53343. if (parsedOrderRefs.has(groupRef)) {
  53344. continue;
  53345. }
  53346. hiddenGroups.push(groupRef.toString());
  53347. }
  53348. if (hiddenGroups.length) {
  53349. order.push({
  53350. name: null,
  53351. order: hiddenGroups
  53352. });
  53353. }
  53354. return order;
  53355. }
  53356. function parseNestedOrder(ref, nestedLevels) {
  53357. if (++nestedLevels > MAX_NESTED_LEVELS) {
  53358. (0, _util.warn)("parseNestedOrder - reached MAX_NESTED_LEVELS.");
  53359. return null;
  53360. }
  53361. const value = xref.fetchIfRef(ref);
  53362. if (!Array.isArray(value)) {
  53363. return null;
  53364. }
  53365. const nestedName = xref.fetchIfRef(value[0]);
  53366. if (typeof nestedName !== "string") {
  53367. return null;
  53368. }
  53369. const nestedOrder = parseOrder(value.slice(1), nestedLevels);
  53370. if (!nestedOrder || !nestedOrder.length) {
  53371. return null;
  53372. }
  53373. return {
  53374. name: (0, _util.stringToPDFString)(nestedName),
  53375. order: nestedOrder
  53376. };
  53377. }
  53378. const xref = this.xref,
  53379. parsedOrderRefs = new _primitives.RefSet(),
  53380. MAX_NESTED_LEVELS = 10;
  53381. return {
  53382. name: typeof config.get("Name") === "string" ? (0, _util.stringToPDFString)(config.get("Name")) : null,
  53383. creator: typeof config.get("Creator") === "string" ? (0, _util.stringToPDFString)(config.get("Creator")) : null,
  53384. baseState: config.get("BaseState") instanceof _primitives.Name ? config.get("BaseState").name : null,
  53385. on: parseOnOff(config.get("ON")),
  53386. off: parseOnOff(config.get("OFF")),
  53387. order: parseOrder(config.get("Order")),
  53388. groups: null
  53389. };
  53390. }
  53391. setActualNumPages() {
  53392. let num = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  53393. this._actualNumPages = num;
  53394. }
  53395. get hasActualNumPages() {
  53396. return this._actualNumPages !== null;
  53397. }
  53398. get _pagesCount() {
  53399. const obj = this.toplevelPagesDict.get("Count");
  53400. if (!Number.isInteger(obj)) {
  53401. throw new _util.FormatError("Page count in top-level pages dictionary is not an integer.");
  53402. }
  53403. return (0, _util.shadow)(this, "_pagesCount", obj);
  53404. }
  53405. get numPages() {
  53406. return this.hasActualNumPages ? this._actualNumPages : this._pagesCount;
  53407. }
  53408. get destinations() {
  53409. const obj = this._readDests(),
  53410. dests = Object.create(null);
  53411. if (obj instanceof _name_number_tree.NameTree) {
  53412. for (const [key, value] of obj.getAll()) {
  53413. const dest = fetchDestination(value);
  53414. if (dest) {
  53415. dests[(0, _util.stringToPDFString)(key)] = dest;
  53416. }
  53417. }
  53418. } else if (obj instanceof _primitives.Dict) {
  53419. obj.forEach(function (key, value) {
  53420. const dest = fetchDestination(value);
  53421. if (dest) {
  53422. dests[key] = dest;
  53423. }
  53424. });
  53425. }
  53426. return (0, _util.shadow)(this, "destinations", dests);
  53427. }
  53428. getDestination(id) {
  53429. const obj = this._readDests();
  53430. if (obj instanceof _name_number_tree.NameTree) {
  53431. const dest = fetchDestination(obj.get(id));
  53432. if (dest) {
  53433. return dest;
  53434. }
  53435. const allDest = this.destinations[id];
  53436. if (allDest) {
  53437. (0, _util.warn)(`Found "${id}" at an incorrect position in the NameTree.`);
  53438. return allDest;
  53439. }
  53440. } else if (obj instanceof _primitives.Dict) {
  53441. const dest = fetchDestination(obj.get(id));
  53442. if (dest) {
  53443. return dest;
  53444. }
  53445. }
  53446. return null;
  53447. }
  53448. _readDests() {
  53449. const obj = this._catDict.get("Names");
  53450. if (obj && obj.has("Dests")) {
  53451. return new _name_number_tree.NameTree(obj.getRaw("Dests"), this.xref);
  53452. } else if (this._catDict.has("Dests")) {
  53453. return this._catDict.get("Dests");
  53454. }
  53455. return undefined;
  53456. }
  53457. get pageLabels() {
  53458. let obj = null;
  53459. try {
  53460. obj = this._readPageLabels();
  53461. } catch (ex) {
  53462. if (ex instanceof _core_utils.MissingDataException) {
  53463. throw ex;
  53464. }
  53465. (0, _util.warn)("Unable to read page labels.");
  53466. }
  53467. return (0, _util.shadow)(this, "pageLabels", obj);
  53468. }
  53469. _readPageLabels() {
  53470. const obj = this._catDict.getRaw("PageLabels");
  53471. if (!obj) {
  53472. return null;
  53473. }
  53474. const pageLabels = new Array(this.numPages);
  53475. let style = null,
  53476. prefix = "";
  53477. const numberTree = new _name_number_tree.NumberTree(obj, this.xref);
  53478. const nums = numberTree.getAll();
  53479. let currentLabel = "",
  53480. currentIndex = 1;
  53481. for (let i = 0, ii = this.numPages; i < ii; i++) {
  53482. const labelDict = nums.get(i);
  53483. if (labelDict !== undefined) {
  53484. if (!(labelDict instanceof _primitives.Dict)) {
  53485. throw new _util.FormatError("PageLabel is not a dictionary.");
  53486. }
  53487. if (labelDict.has("Type") && !(0, _primitives.isName)(labelDict.get("Type"), "PageLabel")) {
  53488. throw new _util.FormatError("Invalid type in PageLabel dictionary.");
  53489. }
  53490. if (labelDict.has("S")) {
  53491. const s = labelDict.get("S");
  53492. if (!(s instanceof _primitives.Name)) {
  53493. throw new _util.FormatError("Invalid style in PageLabel dictionary.");
  53494. }
  53495. style = s.name;
  53496. } else {
  53497. style = null;
  53498. }
  53499. if (labelDict.has("P")) {
  53500. const p = labelDict.get("P");
  53501. if (typeof p !== "string") {
  53502. throw new _util.FormatError("Invalid prefix in PageLabel dictionary.");
  53503. }
  53504. prefix = (0, _util.stringToPDFString)(p);
  53505. } else {
  53506. prefix = "";
  53507. }
  53508. if (labelDict.has("St")) {
  53509. const st = labelDict.get("St");
  53510. if (!(Number.isInteger(st) && st >= 1)) {
  53511. throw new _util.FormatError("Invalid start in PageLabel dictionary.");
  53512. }
  53513. currentIndex = st;
  53514. } else {
  53515. currentIndex = 1;
  53516. }
  53517. }
  53518. switch (style) {
  53519. case "D":
  53520. currentLabel = currentIndex;
  53521. break;
  53522. case "R":
  53523. case "r":
  53524. currentLabel = (0, _core_utils.toRomanNumerals)(currentIndex, style === "r");
  53525. break;
  53526. case "A":
  53527. case "a":
  53528. const LIMIT = 26;
  53529. const A_UPPER_CASE = 0x41,
  53530. A_LOWER_CASE = 0x61;
  53531. const baseCharCode = style === "a" ? A_LOWER_CASE : A_UPPER_CASE;
  53532. const letterIndex = currentIndex - 1;
  53533. const character = String.fromCharCode(baseCharCode + letterIndex % LIMIT);
  53534. currentLabel = character.repeat(Math.floor(letterIndex / LIMIT) + 1);
  53535. break;
  53536. default:
  53537. if (style) {
  53538. throw new _util.FormatError(`Invalid style "${style}" in PageLabel dictionary.`);
  53539. }
  53540. currentLabel = "";
  53541. }
  53542. pageLabels[i] = prefix + currentLabel;
  53543. currentIndex++;
  53544. }
  53545. return pageLabels;
  53546. }
  53547. get pageLayout() {
  53548. const obj = this._catDict.get("PageLayout");
  53549. let pageLayout = "";
  53550. if (obj instanceof _primitives.Name) {
  53551. switch (obj.name) {
  53552. case "SinglePage":
  53553. case "OneColumn":
  53554. case "TwoColumnLeft":
  53555. case "TwoColumnRight":
  53556. case "TwoPageLeft":
  53557. case "TwoPageRight":
  53558. pageLayout = obj.name;
  53559. }
  53560. }
  53561. return (0, _util.shadow)(this, "pageLayout", pageLayout);
  53562. }
  53563. get pageMode() {
  53564. const obj = this._catDict.get("PageMode");
  53565. let pageMode = "UseNone";
  53566. if (obj instanceof _primitives.Name) {
  53567. switch (obj.name) {
  53568. case "UseNone":
  53569. case "UseOutlines":
  53570. case "UseThumbs":
  53571. case "FullScreen":
  53572. case "UseOC":
  53573. case "UseAttachments":
  53574. pageMode = obj.name;
  53575. }
  53576. }
  53577. return (0, _util.shadow)(this, "pageMode", pageMode);
  53578. }
  53579. get viewerPreferences() {
  53580. const obj = this._catDict.get("ViewerPreferences");
  53581. if (!(obj instanceof _primitives.Dict)) {
  53582. return (0, _util.shadow)(this, "viewerPreferences", null);
  53583. }
  53584. let prefs = null;
  53585. for (const key of obj.getKeys()) {
  53586. const value = obj.get(key);
  53587. let prefValue;
  53588. switch (key) {
  53589. case "HideToolbar":
  53590. case "HideMenubar":
  53591. case "HideWindowUI":
  53592. case "FitWindow":
  53593. case "CenterWindow":
  53594. case "DisplayDocTitle":
  53595. case "PickTrayByPDFSize":
  53596. if (typeof value === "boolean") {
  53597. prefValue = value;
  53598. }
  53599. break;
  53600. case "NonFullScreenPageMode":
  53601. if (value instanceof _primitives.Name) {
  53602. switch (value.name) {
  53603. case "UseNone":
  53604. case "UseOutlines":
  53605. case "UseThumbs":
  53606. case "UseOC":
  53607. prefValue = value.name;
  53608. break;
  53609. default:
  53610. prefValue = "UseNone";
  53611. }
  53612. }
  53613. break;
  53614. case "Direction":
  53615. if (value instanceof _primitives.Name) {
  53616. switch (value.name) {
  53617. case "L2R":
  53618. case "R2L":
  53619. prefValue = value.name;
  53620. break;
  53621. default:
  53622. prefValue = "L2R";
  53623. }
  53624. }
  53625. break;
  53626. case "ViewArea":
  53627. case "ViewClip":
  53628. case "PrintArea":
  53629. case "PrintClip":
  53630. if (value instanceof _primitives.Name) {
  53631. switch (value.name) {
  53632. case "MediaBox":
  53633. case "CropBox":
  53634. case "BleedBox":
  53635. case "TrimBox":
  53636. case "ArtBox":
  53637. prefValue = value.name;
  53638. break;
  53639. default:
  53640. prefValue = "CropBox";
  53641. }
  53642. }
  53643. break;
  53644. case "PrintScaling":
  53645. if (value instanceof _primitives.Name) {
  53646. switch (value.name) {
  53647. case "None":
  53648. case "AppDefault":
  53649. prefValue = value.name;
  53650. break;
  53651. default:
  53652. prefValue = "AppDefault";
  53653. }
  53654. }
  53655. break;
  53656. case "Duplex":
  53657. if (value instanceof _primitives.Name) {
  53658. switch (value.name) {
  53659. case "Simplex":
  53660. case "DuplexFlipShortEdge":
  53661. case "DuplexFlipLongEdge":
  53662. prefValue = value.name;
  53663. break;
  53664. default:
  53665. prefValue = "None";
  53666. }
  53667. }
  53668. break;
  53669. case "PrintPageRange":
  53670. if (Array.isArray(value) && value.length % 2 === 0) {
  53671. const isValid = value.every((page, i, arr) => {
  53672. return Number.isInteger(page) && page > 0 && (i === 0 || page >= arr[i - 1]) && page <= this.numPages;
  53673. });
  53674. if (isValid) {
  53675. prefValue = value;
  53676. }
  53677. }
  53678. break;
  53679. case "NumCopies":
  53680. if (Number.isInteger(value) && value > 0) {
  53681. prefValue = value;
  53682. }
  53683. break;
  53684. default:
  53685. (0, _util.warn)(`Ignoring non-standard key in ViewerPreferences: ${key}.`);
  53686. continue;
  53687. }
  53688. if (prefValue === undefined) {
  53689. (0, _util.warn)(`Bad value, for key "${key}", in ViewerPreferences: ${value}.`);
  53690. continue;
  53691. }
  53692. if (!prefs) {
  53693. prefs = Object.create(null);
  53694. }
  53695. prefs[key] = prefValue;
  53696. }
  53697. return (0, _util.shadow)(this, "viewerPreferences", prefs);
  53698. }
  53699. get openAction() {
  53700. const obj = this._catDict.get("OpenAction");
  53701. const openAction = Object.create(null);
  53702. if (obj instanceof _primitives.Dict) {
  53703. const destDict = new _primitives.Dict(this.xref);
  53704. destDict.set("A", obj);
  53705. const resultObj = {
  53706. url: null,
  53707. dest: null,
  53708. action: null
  53709. };
  53710. Catalog.parseDestDictionary({
  53711. destDict,
  53712. resultObj
  53713. });
  53714. if (Array.isArray(resultObj.dest)) {
  53715. openAction.dest = resultObj.dest;
  53716. } else if (resultObj.action) {
  53717. openAction.action = resultObj.action;
  53718. }
  53719. } else if (Array.isArray(obj)) {
  53720. openAction.dest = obj;
  53721. }
  53722. return (0, _util.shadow)(this, "openAction", (0, _util.objectSize)(openAction) > 0 ? openAction : null);
  53723. }
  53724. get attachments() {
  53725. const obj = this._catDict.get("Names");
  53726. let attachments = null;
  53727. if (obj instanceof _primitives.Dict && obj.has("EmbeddedFiles")) {
  53728. const nameTree = new _name_number_tree.NameTree(obj.getRaw("EmbeddedFiles"), this.xref);
  53729. for (const [key, value] of nameTree.getAll()) {
  53730. const fs = new _file_spec.FileSpec(value, this.xref);
  53731. if (!attachments) {
  53732. attachments = Object.create(null);
  53733. }
  53734. attachments[(0, _util.stringToPDFString)(key)] = fs.serializable;
  53735. }
  53736. }
  53737. return (0, _util.shadow)(this, "attachments", attachments);
  53738. }
  53739. get xfaImages() {
  53740. const obj = this._catDict.get("Names");
  53741. let xfaImages = null;
  53742. if (obj instanceof _primitives.Dict && obj.has("XFAImages")) {
  53743. const nameTree = new _name_number_tree.NameTree(obj.getRaw("XFAImages"), this.xref);
  53744. for (const [key, value] of nameTree.getAll()) {
  53745. if (!xfaImages) {
  53746. xfaImages = new _primitives.Dict(this.xref);
  53747. }
  53748. xfaImages.set((0, _util.stringToPDFString)(key), value);
  53749. }
  53750. }
  53751. return (0, _util.shadow)(this, "xfaImages", xfaImages);
  53752. }
  53753. _collectJavaScript() {
  53754. const obj = this._catDict.get("Names");
  53755. let javaScript = null;
  53756. function appendIfJavaScriptDict(name, jsDict) {
  53757. if (!(jsDict instanceof _primitives.Dict)) {
  53758. return;
  53759. }
  53760. if (!(0, _primitives.isName)(jsDict.get("S"), "JavaScript")) {
  53761. return;
  53762. }
  53763. let js = jsDict.get("JS");
  53764. if (js instanceof _base_stream.BaseStream) {
  53765. js = js.getString();
  53766. } else if (typeof js !== "string") {
  53767. return;
  53768. }
  53769. if (javaScript === null) {
  53770. javaScript = new Map();
  53771. }
  53772. js = (0, _util.stringToPDFString)(js).replace(/\u0000/g, "");
  53773. javaScript.set(name, js);
  53774. }
  53775. if (obj instanceof _primitives.Dict && obj.has("JavaScript")) {
  53776. const nameTree = new _name_number_tree.NameTree(obj.getRaw("JavaScript"), this.xref);
  53777. for (const [key, value] of nameTree.getAll()) {
  53778. appendIfJavaScriptDict((0, _util.stringToPDFString)(key), value);
  53779. }
  53780. }
  53781. const openAction = this._catDict.get("OpenAction");
  53782. if (openAction) {
  53783. appendIfJavaScriptDict("OpenAction", openAction);
  53784. }
  53785. return javaScript;
  53786. }
  53787. get javaScript() {
  53788. const javaScript = this._collectJavaScript();
  53789. return (0, _util.shadow)(this, "javaScript", javaScript ? [...javaScript.values()] : null);
  53790. }
  53791. get jsActions() {
  53792. const javaScript = this._collectJavaScript();
  53793. let actions = (0, _core_utils.collectActions)(this.xref, this._catDict, _util.DocumentActionEventType);
  53794. if (javaScript) {
  53795. if (!actions) {
  53796. actions = Object.create(null);
  53797. }
  53798. for (const [key, val] of javaScript) {
  53799. if (key in actions) {
  53800. actions[key].push(val);
  53801. } else {
  53802. actions[key] = [val];
  53803. }
  53804. }
  53805. }
  53806. return (0, _util.shadow)(this, "jsActions", actions);
  53807. }
  53808. async fontFallback(id, handler) {
  53809. const translatedFonts = await Promise.all(this.fontCache);
  53810. for (const translatedFont of translatedFonts) {
  53811. if (translatedFont.loadedName === id) {
  53812. translatedFont.fallback(handler);
  53813. return;
  53814. }
  53815. }
  53816. }
  53817. async cleanup() {
  53818. let manuallyTriggered = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  53819. (0, _cleanup_helper.clearGlobalCaches)();
  53820. this.globalImageCache.clear(manuallyTriggered);
  53821. this.pageKidsCountCache.clear();
  53822. this.pageIndexCache.clear();
  53823. this.nonBlendModesSet.clear();
  53824. const translatedFonts = await Promise.all(this.fontCache);
  53825. for (const {
  53826. dict
  53827. } of translatedFonts) {
  53828. delete dict.cacheKey;
  53829. }
  53830. this.fontCache.clear();
  53831. this.builtInCMapCache.clear();
  53832. this.standardFontDataCache.clear();
  53833. }
  53834. async getPageDict(pageIndex) {
  53835. const nodesToVisit = [this.toplevelPagesDict];
  53836. const visitedNodes = new _primitives.RefSet();
  53837. const pagesRef = this._catDict.getRaw("Pages");
  53838. if (pagesRef instanceof _primitives.Ref) {
  53839. visitedNodes.put(pagesRef);
  53840. }
  53841. const xref = this.xref,
  53842. pageKidsCountCache = this.pageKidsCountCache,
  53843. pageIndexCache = this.pageIndexCache;
  53844. let currentPageIndex = 0;
  53845. while (nodesToVisit.length) {
  53846. const currentNode = nodesToVisit.pop();
  53847. if (currentNode instanceof _primitives.Ref) {
  53848. const count = pageKidsCountCache.get(currentNode);
  53849. if (count >= 0 && currentPageIndex + count <= pageIndex) {
  53850. currentPageIndex += count;
  53851. continue;
  53852. }
  53853. if (visitedNodes.has(currentNode)) {
  53854. throw new _util.FormatError("Pages tree contains circular reference.");
  53855. }
  53856. visitedNodes.put(currentNode);
  53857. const obj = await xref.fetchAsync(currentNode);
  53858. if (obj instanceof _primitives.Dict) {
  53859. let type = obj.getRaw("Type");
  53860. if (type instanceof _primitives.Ref) {
  53861. type = await xref.fetchAsync(type);
  53862. }
  53863. if ((0, _primitives.isName)(type, "Page") || !obj.has("Kids")) {
  53864. if (!pageKidsCountCache.has(currentNode)) {
  53865. pageKidsCountCache.put(currentNode, 1);
  53866. }
  53867. if (!pageIndexCache.has(currentNode)) {
  53868. pageIndexCache.put(currentNode, currentPageIndex);
  53869. }
  53870. if (currentPageIndex === pageIndex) {
  53871. return [obj, currentNode];
  53872. }
  53873. currentPageIndex++;
  53874. continue;
  53875. }
  53876. }
  53877. nodesToVisit.push(obj);
  53878. continue;
  53879. }
  53880. if (!(currentNode instanceof _primitives.Dict)) {
  53881. throw new _util.FormatError("Page dictionary kid reference points to wrong type of object.");
  53882. }
  53883. const {
  53884. objId
  53885. } = currentNode;
  53886. let count = currentNode.getRaw("Count");
  53887. if (count instanceof _primitives.Ref) {
  53888. count = await xref.fetchAsync(count);
  53889. }
  53890. if (Number.isInteger(count) && count >= 0) {
  53891. if (objId && !pageKidsCountCache.has(objId)) {
  53892. pageKidsCountCache.put(objId, count);
  53893. }
  53894. if (currentPageIndex + count <= pageIndex) {
  53895. currentPageIndex += count;
  53896. continue;
  53897. }
  53898. }
  53899. let kids = currentNode.getRaw("Kids");
  53900. if (kids instanceof _primitives.Ref) {
  53901. kids = await xref.fetchAsync(kids);
  53902. }
  53903. if (!Array.isArray(kids)) {
  53904. let type = currentNode.getRaw("Type");
  53905. if (type instanceof _primitives.Ref) {
  53906. type = await xref.fetchAsync(type);
  53907. }
  53908. if ((0, _primitives.isName)(type, "Page") || !currentNode.has("Kids")) {
  53909. if (currentPageIndex === pageIndex) {
  53910. return [currentNode, null];
  53911. }
  53912. currentPageIndex++;
  53913. continue;
  53914. }
  53915. throw new _util.FormatError("Page dictionary kids object is not an array.");
  53916. }
  53917. for (let last = kids.length - 1; last >= 0; last--) {
  53918. nodesToVisit.push(kids[last]);
  53919. }
  53920. }
  53921. throw new Error(`Page index ${pageIndex} not found.`);
  53922. }
  53923. async getAllPageDicts() {
  53924. let recoveryMode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  53925. const {
  53926. ignoreErrors
  53927. } = this.pdfManager.evaluatorOptions;
  53928. const queue = [{
  53929. currentNode: this.toplevelPagesDict,
  53930. posInKids: 0
  53931. }];
  53932. const visitedNodes = new _primitives.RefSet();
  53933. const pagesRef = this._catDict.getRaw("Pages");
  53934. if (pagesRef instanceof _primitives.Ref) {
  53935. visitedNodes.put(pagesRef);
  53936. }
  53937. const map = new Map(),
  53938. xref = this.xref,
  53939. pageIndexCache = this.pageIndexCache;
  53940. let pageIndex = 0;
  53941. function addPageDict(pageDict, pageRef) {
  53942. if (pageRef && !pageIndexCache.has(pageRef)) {
  53943. pageIndexCache.put(pageRef, pageIndex);
  53944. }
  53945. map.set(pageIndex++, [pageDict, pageRef]);
  53946. }
  53947. function addPageError(error) {
  53948. if (error instanceof _core_utils.XRefEntryException && !recoveryMode) {
  53949. throw error;
  53950. }
  53951. if (recoveryMode && ignoreErrors && pageIndex === 0) {
  53952. (0, _util.warn)(`getAllPageDicts - Skipping invalid first page: "${error}".`);
  53953. error = _primitives.Dict.empty;
  53954. }
  53955. map.set(pageIndex++, [error, null]);
  53956. }
  53957. while (queue.length > 0) {
  53958. const queueItem = queue.at(-1);
  53959. const {
  53960. currentNode,
  53961. posInKids
  53962. } = queueItem;
  53963. let kids = currentNode.getRaw("Kids");
  53964. if (kids instanceof _primitives.Ref) {
  53965. try {
  53966. kids = await xref.fetchAsync(kids);
  53967. } catch (ex) {
  53968. addPageError(ex);
  53969. break;
  53970. }
  53971. }
  53972. if (!Array.isArray(kids)) {
  53973. addPageError(new _util.FormatError("Page dictionary kids object is not an array."));
  53974. break;
  53975. }
  53976. if (posInKids >= kids.length) {
  53977. queue.pop();
  53978. continue;
  53979. }
  53980. const kidObj = kids[posInKids];
  53981. let obj;
  53982. if (kidObj instanceof _primitives.Ref) {
  53983. if (visitedNodes.has(kidObj)) {
  53984. addPageError(new _util.FormatError("Pages tree contains circular reference."));
  53985. break;
  53986. }
  53987. visitedNodes.put(kidObj);
  53988. try {
  53989. obj = await xref.fetchAsync(kidObj);
  53990. } catch (ex) {
  53991. addPageError(ex);
  53992. break;
  53993. }
  53994. } else {
  53995. obj = kidObj;
  53996. }
  53997. if (!(obj instanceof _primitives.Dict)) {
  53998. addPageError(new _util.FormatError("Page dictionary kid reference points to wrong type of object."));
  53999. break;
  54000. }
  54001. let type = obj.getRaw("Type");
  54002. if (type instanceof _primitives.Ref) {
  54003. try {
  54004. type = await xref.fetchAsync(type);
  54005. } catch (ex) {
  54006. addPageError(ex);
  54007. break;
  54008. }
  54009. }
  54010. if ((0, _primitives.isName)(type, "Page") || !obj.has("Kids")) {
  54011. addPageDict(obj, kidObj instanceof _primitives.Ref ? kidObj : null);
  54012. } else {
  54013. queue.push({
  54014. currentNode: obj,
  54015. posInKids: 0
  54016. });
  54017. }
  54018. queueItem.posInKids++;
  54019. }
  54020. return map;
  54021. }
  54022. getPageIndex(pageRef) {
  54023. const cachedPageIndex = this.pageIndexCache.get(pageRef);
  54024. if (cachedPageIndex !== undefined) {
  54025. return Promise.resolve(cachedPageIndex);
  54026. }
  54027. const xref = this.xref;
  54028. function pagesBeforeRef(kidRef) {
  54029. let total = 0,
  54030. parentRef;
  54031. return xref.fetchAsync(kidRef).then(function (node) {
  54032. if ((0, _primitives.isRefsEqual)(kidRef, pageRef) && !(0, _primitives.isDict)(node, "Page") && !(node instanceof _primitives.Dict && !node.has("Type") && node.has("Contents"))) {
  54033. throw new _util.FormatError("The reference does not point to a /Page dictionary.");
  54034. }
  54035. if (!node) {
  54036. return null;
  54037. }
  54038. if (!(node instanceof _primitives.Dict)) {
  54039. throw new _util.FormatError("Node must be a dictionary.");
  54040. }
  54041. parentRef = node.getRaw("Parent");
  54042. return node.getAsync("Parent");
  54043. }).then(function (parent) {
  54044. if (!parent) {
  54045. return null;
  54046. }
  54047. if (!(parent instanceof _primitives.Dict)) {
  54048. throw new _util.FormatError("Parent must be a dictionary.");
  54049. }
  54050. return parent.getAsync("Kids");
  54051. }).then(function (kids) {
  54052. if (!kids) {
  54053. return null;
  54054. }
  54055. const kidPromises = [];
  54056. let found = false;
  54057. for (const kid of kids) {
  54058. if (!(kid instanceof _primitives.Ref)) {
  54059. throw new _util.FormatError("Kid must be a reference.");
  54060. }
  54061. if ((0, _primitives.isRefsEqual)(kid, kidRef)) {
  54062. found = true;
  54063. break;
  54064. }
  54065. kidPromises.push(xref.fetchAsync(kid).then(function (obj) {
  54066. if (!(obj instanceof _primitives.Dict)) {
  54067. throw new _util.FormatError("Kid node must be a dictionary.");
  54068. }
  54069. if (obj.has("Count")) {
  54070. total += obj.get("Count");
  54071. } else {
  54072. total++;
  54073. }
  54074. }));
  54075. }
  54076. if (!found) {
  54077. throw new _util.FormatError("Kid reference not found in parent's kids.");
  54078. }
  54079. return Promise.all(kidPromises).then(function () {
  54080. return [total, parentRef];
  54081. });
  54082. });
  54083. }
  54084. let total = 0;
  54085. const next = ref => pagesBeforeRef(ref).then(args => {
  54086. if (!args) {
  54087. this.pageIndexCache.put(pageRef, total);
  54088. return total;
  54089. }
  54090. const [count, parentRef] = args;
  54091. total += count;
  54092. return next(parentRef);
  54093. });
  54094. return next(pageRef);
  54095. }
  54096. get baseUrl() {
  54097. const uri = this._catDict.get("URI");
  54098. if (uri instanceof _primitives.Dict) {
  54099. const base = uri.get("Base");
  54100. if (typeof base === "string") {
  54101. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(base, null, {
  54102. tryConvertEncoding: true
  54103. });
  54104. if (absoluteUrl) {
  54105. return (0, _util.shadow)(this, "baseUrl", absoluteUrl.href);
  54106. }
  54107. }
  54108. }
  54109. return (0, _util.shadow)(this, "baseUrl", null);
  54110. }
  54111. static parseDestDictionary(params) {
  54112. const destDict = params.destDict;
  54113. if (!(destDict instanceof _primitives.Dict)) {
  54114. (0, _util.warn)("parseDestDictionary: `destDict` must be a dictionary.");
  54115. return;
  54116. }
  54117. const resultObj = params.resultObj;
  54118. if (typeof resultObj !== "object") {
  54119. (0, _util.warn)("parseDestDictionary: `resultObj` must be an object.");
  54120. return;
  54121. }
  54122. const docBaseUrl = params.docBaseUrl || null;
  54123. const docAttachments = params.docAttachments || null;
  54124. let action = destDict.get("A"),
  54125. url,
  54126. dest;
  54127. if (!(action instanceof _primitives.Dict)) {
  54128. if (destDict.has("Dest")) {
  54129. action = destDict.get("Dest");
  54130. } else {
  54131. action = destDict.get("AA");
  54132. if (action instanceof _primitives.Dict) {
  54133. if (action.has("D")) {
  54134. action = action.get("D");
  54135. } else if (action.has("U")) {
  54136. action = action.get("U");
  54137. }
  54138. }
  54139. }
  54140. }
  54141. if (action instanceof _primitives.Dict) {
  54142. const actionType = action.get("S");
  54143. if (!(actionType instanceof _primitives.Name)) {
  54144. (0, _util.warn)("parseDestDictionary: Invalid type in Action dictionary.");
  54145. return;
  54146. }
  54147. const actionName = actionType.name;
  54148. switch (actionName) {
  54149. case "ResetForm":
  54150. const flags = action.get("Flags");
  54151. const include = ((typeof flags === "number" ? flags : 0) & 1) === 0;
  54152. const fields = [];
  54153. const refs = [];
  54154. for (const obj of action.get("Fields") || []) {
  54155. if (obj instanceof _primitives.Ref) {
  54156. refs.push(obj.toString());
  54157. } else if (typeof obj === "string") {
  54158. fields.push((0, _util.stringToPDFString)(obj));
  54159. }
  54160. }
  54161. resultObj.resetForm = {
  54162. fields,
  54163. refs,
  54164. include
  54165. };
  54166. break;
  54167. case "URI":
  54168. url = action.get("URI");
  54169. if (url instanceof _primitives.Name) {
  54170. url = "/" + url.name;
  54171. }
  54172. break;
  54173. case "GoTo":
  54174. dest = action.get("D");
  54175. break;
  54176. case "Launch":
  54177. case "GoToR":
  54178. const urlDict = action.get("F");
  54179. if (urlDict instanceof _primitives.Dict) {
  54180. url = urlDict.get("F") || null;
  54181. } else if (typeof urlDict === "string") {
  54182. url = urlDict;
  54183. }
  54184. let remoteDest = action.get("D");
  54185. if (remoteDest) {
  54186. if (remoteDest instanceof _primitives.Name) {
  54187. remoteDest = remoteDest.name;
  54188. }
  54189. if (typeof url === "string") {
  54190. const baseUrl = url.split("#")[0];
  54191. if (typeof remoteDest === "string") {
  54192. url = baseUrl + "#" + remoteDest;
  54193. } else if (Array.isArray(remoteDest)) {
  54194. url = baseUrl + "#" + JSON.stringify(remoteDest);
  54195. }
  54196. }
  54197. }
  54198. const newWindow = action.get("NewWindow");
  54199. if (typeof newWindow === "boolean") {
  54200. resultObj.newWindow = newWindow;
  54201. }
  54202. break;
  54203. case "GoToE":
  54204. const target = action.get("T");
  54205. let attachment;
  54206. if (docAttachments && target instanceof _primitives.Dict) {
  54207. const relationship = target.get("R");
  54208. const name = target.get("N");
  54209. if ((0, _primitives.isName)(relationship, "C") && typeof name === "string") {
  54210. attachment = docAttachments[(0, _util.stringToPDFString)(name)];
  54211. }
  54212. }
  54213. if (attachment) {
  54214. resultObj.attachment = attachment;
  54215. } else {
  54216. (0, _util.warn)(`parseDestDictionary - unimplemented "GoToE" action.`);
  54217. }
  54218. break;
  54219. case "Named":
  54220. const namedAction = action.get("N");
  54221. if (namedAction instanceof _primitives.Name) {
  54222. resultObj.action = namedAction.name;
  54223. }
  54224. break;
  54225. case "SetOCGState":
  54226. const state = action.get("State");
  54227. const preserveRB = action.get("PreserveRB");
  54228. if (!Array.isArray(state) || state.length === 0) {
  54229. break;
  54230. }
  54231. const stateArr = [];
  54232. for (const elem of state) {
  54233. if (elem instanceof _primitives.Name) {
  54234. switch (elem.name) {
  54235. case "ON":
  54236. case "OFF":
  54237. case "Toggle":
  54238. stateArr.push(elem.name);
  54239. break;
  54240. }
  54241. } else if (elem instanceof _primitives.Ref) {
  54242. stateArr.push(elem.toString());
  54243. }
  54244. }
  54245. if (stateArr.length !== state.length) {
  54246. break;
  54247. }
  54248. resultObj.setOCGState = {
  54249. state: stateArr,
  54250. preserveRB: typeof preserveRB === "boolean" ? preserveRB : true
  54251. };
  54252. break;
  54253. case "JavaScript":
  54254. const jsAction = action.get("JS");
  54255. let js;
  54256. if (jsAction instanceof _base_stream.BaseStream) {
  54257. js = jsAction.getString();
  54258. } else if (typeof jsAction === "string") {
  54259. js = jsAction;
  54260. }
  54261. const jsURL = js && (0, _core_utils.recoverJsURL)((0, _util.stringToPDFString)(js));
  54262. if (jsURL) {
  54263. url = jsURL.url;
  54264. resultObj.newWindow = jsURL.newWindow;
  54265. break;
  54266. }
  54267. default:
  54268. if (actionName === "JavaScript" || actionName === "SubmitForm") {
  54269. break;
  54270. }
  54271. (0, _util.warn)(`parseDestDictionary - unsupported action: "${actionName}".`);
  54272. break;
  54273. }
  54274. } else if (destDict.has("Dest")) {
  54275. dest = destDict.get("Dest");
  54276. }
  54277. if (typeof url === "string") {
  54278. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(url, docBaseUrl, {
  54279. addDefaultProtocol: true,
  54280. tryConvertEncoding: true
  54281. });
  54282. if (absoluteUrl) {
  54283. resultObj.url = absoluteUrl.href;
  54284. }
  54285. resultObj.unsafeUrl = url;
  54286. }
  54287. if (dest) {
  54288. if (dest instanceof _primitives.Name) {
  54289. dest = dest.name;
  54290. }
  54291. if (typeof dest === "string") {
  54292. resultObj.dest = (0, _util.stringToPDFString)(dest);
  54293. } else if (Array.isArray(dest)) {
  54294. resultObj.dest = dest;
  54295. }
  54296. }
  54297. }
  54298. }
  54299. exports.Catalog = Catalog;
  54300. /***/ }),
  54301. /* 199 */
  54302. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  54303. "use strict";
  54304. Object.defineProperty(exports, "__esModule", ({
  54305. value: true
  54306. }));
  54307. exports.NumberTree = exports.NameTree = void 0;
  54308. var _primitives = __w_pdfjs_require__(134);
  54309. var _util = __w_pdfjs_require__(2);
  54310. class NameOrNumberTree {
  54311. constructor(root, xref, type) {
  54312. if (this.constructor === NameOrNumberTree) {
  54313. (0, _util.unreachable)("Cannot initialize NameOrNumberTree.");
  54314. }
  54315. this.root = root;
  54316. this.xref = xref;
  54317. this._type = type;
  54318. }
  54319. getAll() {
  54320. const map = new Map();
  54321. if (!this.root) {
  54322. return map;
  54323. }
  54324. const xref = this.xref;
  54325. const processed = new _primitives.RefSet();
  54326. processed.put(this.root);
  54327. const queue = [this.root];
  54328. while (queue.length > 0) {
  54329. const obj = xref.fetchIfRef(queue.shift());
  54330. if (!(obj instanceof _primitives.Dict)) {
  54331. continue;
  54332. }
  54333. if (obj.has("Kids")) {
  54334. const kids = obj.get("Kids");
  54335. if (!Array.isArray(kids)) {
  54336. continue;
  54337. }
  54338. for (const kid of kids) {
  54339. if (processed.has(kid)) {
  54340. throw new _util.FormatError(`Duplicate entry in "${this._type}" tree.`);
  54341. }
  54342. queue.push(kid);
  54343. processed.put(kid);
  54344. }
  54345. continue;
  54346. }
  54347. const entries = obj.get(this._type);
  54348. if (!Array.isArray(entries)) {
  54349. continue;
  54350. }
  54351. for (let i = 0, ii = entries.length; i < ii; i += 2) {
  54352. map.set(xref.fetchIfRef(entries[i]), xref.fetchIfRef(entries[i + 1]));
  54353. }
  54354. }
  54355. return map;
  54356. }
  54357. get(key) {
  54358. if (!this.root) {
  54359. return null;
  54360. }
  54361. const xref = this.xref;
  54362. let kidsOrEntries = xref.fetchIfRef(this.root);
  54363. let loopCount = 0;
  54364. const MAX_LEVELS = 10;
  54365. while (kidsOrEntries.has("Kids")) {
  54366. if (++loopCount > MAX_LEVELS) {
  54367. (0, _util.warn)(`Search depth limit reached for "${this._type}" tree.`);
  54368. return null;
  54369. }
  54370. const kids = kidsOrEntries.get("Kids");
  54371. if (!Array.isArray(kids)) {
  54372. return null;
  54373. }
  54374. let l = 0,
  54375. r = kids.length - 1;
  54376. while (l <= r) {
  54377. const m = l + r >> 1;
  54378. const kid = xref.fetchIfRef(kids[m]);
  54379. const limits = kid.get("Limits");
  54380. if (key < xref.fetchIfRef(limits[0])) {
  54381. r = m - 1;
  54382. } else if (key > xref.fetchIfRef(limits[1])) {
  54383. l = m + 1;
  54384. } else {
  54385. kidsOrEntries = kid;
  54386. break;
  54387. }
  54388. }
  54389. if (l > r) {
  54390. return null;
  54391. }
  54392. }
  54393. const entries = kidsOrEntries.get(this._type);
  54394. if (Array.isArray(entries)) {
  54395. let l = 0,
  54396. r = entries.length - 2;
  54397. while (l <= r) {
  54398. const tmp = l + r >> 1,
  54399. m = tmp + (tmp & 1);
  54400. const currentKey = xref.fetchIfRef(entries[m]);
  54401. if (key < currentKey) {
  54402. r = m - 2;
  54403. } else if (key > currentKey) {
  54404. l = m + 2;
  54405. } else {
  54406. return xref.fetchIfRef(entries[m + 1]);
  54407. }
  54408. }
  54409. }
  54410. return null;
  54411. }
  54412. }
  54413. class NameTree extends NameOrNumberTree {
  54414. constructor(root, xref) {
  54415. super(root, xref, "Names");
  54416. }
  54417. }
  54418. exports.NameTree = NameTree;
  54419. class NumberTree extends NameOrNumberTree {
  54420. constructor(root, xref) {
  54421. super(root, xref, "Nums");
  54422. }
  54423. }
  54424. exports.NumberTree = NumberTree;
  54425. /***/ }),
  54426. /* 200 */
  54427. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  54428. "use strict";
  54429. Object.defineProperty(exports, "__esModule", ({
  54430. value: true
  54431. }));
  54432. exports.clearGlobalCaches = clearGlobalCaches;
  54433. var _primitives = __w_pdfjs_require__(134);
  54434. var _unicode = __w_pdfjs_require__(169);
  54435. function clearGlobalCaches() {
  54436. (0, _primitives.clearPrimitiveCaches)();
  54437. (0, _unicode.clearUnicodeCaches)();
  54438. }
  54439. /***/ }),
  54440. /* 201 */
  54441. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  54442. "use strict";
  54443. Object.defineProperty(exports, "__esModule", ({
  54444. value: true
  54445. }));
  54446. exports.FileSpec = void 0;
  54447. var _util = __w_pdfjs_require__(2);
  54448. var _base_stream = __w_pdfjs_require__(136);
  54449. var _primitives = __w_pdfjs_require__(134);
  54450. function pickPlatformItem(dict) {
  54451. if (dict.has("UF")) {
  54452. return dict.get("UF");
  54453. } else if (dict.has("F")) {
  54454. return dict.get("F");
  54455. } else if (dict.has("Unix")) {
  54456. return dict.get("Unix");
  54457. } else if (dict.has("Mac")) {
  54458. return dict.get("Mac");
  54459. } else if (dict.has("DOS")) {
  54460. return dict.get("DOS");
  54461. }
  54462. return null;
  54463. }
  54464. class FileSpec {
  54465. constructor(root, xref) {
  54466. if (!(root instanceof _primitives.Dict)) {
  54467. return;
  54468. }
  54469. this.xref = xref;
  54470. this.root = root;
  54471. if (root.has("FS")) {
  54472. this.fs = root.get("FS");
  54473. }
  54474. this.description = root.has("Desc") ? (0, _util.stringToPDFString)(root.get("Desc")) : "";
  54475. if (root.has("RF")) {
  54476. (0, _util.warn)("Related file specifications are not supported");
  54477. }
  54478. this.contentAvailable = true;
  54479. if (!root.has("EF")) {
  54480. this.contentAvailable = false;
  54481. (0, _util.warn)("Non-embedded file specifications are not supported");
  54482. }
  54483. }
  54484. get filename() {
  54485. if (!this._filename && this.root) {
  54486. const filename = pickPlatformItem(this.root) || "unnamed";
  54487. this._filename = (0, _util.stringToPDFString)(filename).replace(/\\\\/g, "\\").replace(/\\\//g, "/").replace(/\\/g, "/");
  54488. }
  54489. return this._filename;
  54490. }
  54491. get content() {
  54492. if (!this.contentAvailable) {
  54493. return null;
  54494. }
  54495. if (!this.contentRef && this.root) {
  54496. this.contentRef = pickPlatformItem(this.root.get("EF"));
  54497. }
  54498. let content = null;
  54499. if (this.contentRef) {
  54500. const fileObj = this.xref.fetchIfRef(this.contentRef);
  54501. if (fileObj instanceof _base_stream.BaseStream) {
  54502. content = fileObj.getBytes();
  54503. } else {
  54504. (0, _util.warn)("Embedded file specification points to non-existing/invalid content");
  54505. }
  54506. } else {
  54507. (0, _util.warn)("Embedded file specification does not have a content");
  54508. }
  54509. return content;
  54510. }
  54511. get serializable() {
  54512. return {
  54513. filename: this.filename,
  54514. content: this.content
  54515. };
  54516. }
  54517. }
  54518. exports.FileSpec = FileSpec;
  54519. /***/ }),
  54520. /* 202 */
  54521. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  54522. "use strict";
  54523. Object.defineProperty(exports, "__esModule", ({
  54524. value: true
  54525. }));
  54526. exports.MetadataParser = void 0;
  54527. var _xml_parser = __w_pdfjs_require__(195);
  54528. class MetadataParser {
  54529. constructor(data) {
  54530. data = this._repair(data);
  54531. const parser = new _xml_parser.SimpleXMLParser({
  54532. lowerCaseName: true
  54533. });
  54534. const xmlDocument = parser.parseFromString(data);
  54535. this._metadataMap = new Map();
  54536. this._data = data;
  54537. if (xmlDocument) {
  54538. this._parse(xmlDocument);
  54539. }
  54540. }
  54541. _repair(data) {
  54542. return data.replace(/^[^<]+/, "").replace(/>\\376\\377([^<]+)/g, function (all, codes) {
  54543. const bytes = codes.replace(/\\([0-3])([0-7])([0-7])/g, function (code, d1, d2, d3) {
  54544. return String.fromCharCode(d1 * 64 + d2 * 8 + d3 * 1);
  54545. }).replace(/&(amp|apos|gt|lt|quot);/g, function (str, name) {
  54546. switch (name) {
  54547. case "amp":
  54548. return "&";
  54549. case "apos":
  54550. return "'";
  54551. case "gt":
  54552. return ">";
  54553. case "lt":
  54554. return "<";
  54555. case "quot":
  54556. return '"';
  54557. }
  54558. throw new Error(`_repair: ${name} isn't defined.`);
  54559. });
  54560. const charBuf = [];
  54561. for (let i = 0, ii = bytes.length; i < ii; i += 2) {
  54562. const code = bytes.charCodeAt(i) * 256 + bytes.charCodeAt(i + 1);
  54563. if (code >= 32 && code < 127 && code !== 60 && code !== 62 && code !== 38) {
  54564. charBuf.push(String.fromCharCode(code));
  54565. } else {
  54566. charBuf.push("&#x" + (0x10000 + code).toString(16).substring(1) + ";");
  54567. }
  54568. }
  54569. return ">" + charBuf.join("");
  54570. });
  54571. }
  54572. _getSequence(entry) {
  54573. const name = entry.nodeName;
  54574. if (name !== "rdf:bag" && name !== "rdf:seq" && name !== "rdf:alt") {
  54575. return null;
  54576. }
  54577. return entry.childNodes.filter(node => node.nodeName === "rdf:li");
  54578. }
  54579. _parseArray(entry) {
  54580. if (!entry.hasChildNodes()) {
  54581. return;
  54582. }
  54583. const [seqNode] = entry.childNodes;
  54584. const sequence = this._getSequence(seqNode) || [];
  54585. this._metadataMap.set(entry.nodeName, sequence.map(node => node.textContent.trim()));
  54586. }
  54587. _parse(xmlDocument) {
  54588. let rdf = xmlDocument.documentElement;
  54589. if (rdf.nodeName !== "rdf:rdf") {
  54590. rdf = rdf.firstChild;
  54591. while (rdf && rdf.nodeName !== "rdf:rdf") {
  54592. rdf = rdf.nextSibling;
  54593. }
  54594. }
  54595. if (!rdf || rdf.nodeName !== "rdf:rdf" || !rdf.hasChildNodes()) {
  54596. return;
  54597. }
  54598. for (const desc of rdf.childNodes) {
  54599. if (desc.nodeName !== "rdf:description") {
  54600. continue;
  54601. }
  54602. for (const entry of desc.childNodes) {
  54603. const name = entry.nodeName;
  54604. switch (name) {
  54605. case "#text":
  54606. continue;
  54607. case "dc:creator":
  54608. case "dc:subject":
  54609. this._parseArray(entry);
  54610. continue;
  54611. }
  54612. this._metadataMap.set(name, entry.textContent.trim());
  54613. }
  54614. }
  54615. }
  54616. get serializable() {
  54617. return {
  54618. parsedData: this._metadataMap,
  54619. rawData: this._data
  54620. };
  54621. }
  54622. }
  54623. exports.MetadataParser = MetadataParser;
  54624. /***/ }),
  54625. /* 203 */
  54626. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  54627. "use strict";
  54628. Object.defineProperty(exports, "__esModule", ({
  54629. value: true
  54630. }));
  54631. exports.StructTreeRoot = exports.StructTreePage = void 0;
  54632. var _primitives = __w_pdfjs_require__(134);
  54633. var _util = __w_pdfjs_require__(2);
  54634. var _name_number_tree = __w_pdfjs_require__(199);
  54635. const MAX_DEPTH = 40;
  54636. const StructElementType = {
  54637. PAGE_CONTENT: "PAGE_CONTENT",
  54638. STREAM_CONTENT: "STREAM_CONTENT",
  54639. OBJECT: "OBJECT",
  54640. ELEMENT: "ELEMENT"
  54641. };
  54642. class StructTreeRoot {
  54643. constructor(rootDict) {
  54644. this.dict = rootDict;
  54645. this.roleMap = new Map();
  54646. }
  54647. init() {
  54648. this.readRoleMap();
  54649. }
  54650. readRoleMap() {
  54651. const roleMapDict = this.dict.get("RoleMap");
  54652. if (!(roleMapDict instanceof _primitives.Dict)) {
  54653. return;
  54654. }
  54655. roleMapDict.forEach((key, value) => {
  54656. if (!(value instanceof _primitives.Name)) {
  54657. return;
  54658. }
  54659. this.roleMap.set(key, value.name);
  54660. });
  54661. }
  54662. }
  54663. exports.StructTreeRoot = StructTreeRoot;
  54664. class StructElementNode {
  54665. constructor(tree, dict) {
  54666. this.tree = tree;
  54667. this.dict = dict;
  54668. this.kids = [];
  54669. this.parseKids();
  54670. }
  54671. get role() {
  54672. const nameObj = this.dict.get("S");
  54673. const name = nameObj instanceof _primitives.Name ? nameObj.name : "";
  54674. const {
  54675. root
  54676. } = this.tree;
  54677. if (root.roleMap.has(name)) {
  54678. return root.roleMap.get(name);
  54679. }
  54680. return name;
  54681. }
  54682. parseKids() {
  54683. let pageObjId = null;
  54684. const objRef = this.dict.getRaw("Pg");
  54685. if (objRef instanceof _primitives.Ref) {
  54686. pageObjId = objRef.toString();
  54687. }
  54688. const kids = this.dict.get("K");
  54689. if (Array.isArray(kids)) {
  54690. for (const kid of kids) {
  54691. const element = this.parseKid(pageObjId, kid);
  54692. if (element) {
  54693. this.kids.push(element);
  54694. }
  54695. }
  54696. } else {
  54697. const element = this.parseKid(pageObjId, kids);
  54698. if (element) {
  54699. this.kids.push(element);
  54700. }
  54701. }
  54702. }
  54703. parseKid(pageObjId, kid) {
  54704. if (Number.isInteger(kid)) {
  54705. if (this.tree.pageDict.objId !== pageObjId) {
  54706. return null;
  54707. }
  54708. return new StructElement({
  54709. type: StructElementType.PAGE_CONTENT,
  54710. mcid: kid,
  54711. pageObjId
  54712. });
  54713. }
  54714. let kidDict = null;
  54715. if (kid instanceof _primitives.Ref) {
  54716. kidDict = this.dict.xref.fetch(kid);
  54717. } else if (kid instanceof _primitives.Dict) {
  54718. kidDict = kid;
  54719. }
  54720. if (!kidDict) {
  54721. return null;
  54722. }
  54723. const pageRef = kidDict.getRaw("Pg");
  54724. if (pageRef instanceof _primitives.Ref) {
  54725. pageObjId = pageRef.toString();
  54726. }
  54727. const type = kidDict.get("Type") instanceof _primitives.Name ? kidDict.get("Type").name : null;
  54728. if (type === "MCR") {
  54729. if (this.tree.pageDict.objId !== pageObjId) {
  54730. return null;
  54731. }
  54732. return new StructElement({
  54733. type: StructElementType.STREAM_CONTENT,
  54734. refObjId: kidDict.getRaw("Stm") instanceof _primitives.Ref ? kidDict.getRaw("Stm").toString() : null,
  54735. pageObjId,
  54736. mcid: kidDict.get("MCID")
  54737. });
  54738. }
  54739. if (type === "OBJR") {
  54740. if (this.tree.pageDict.objId !== pageObjId) {
  54741. return null;
  54742. }
  54743. return new StructElement({
  54744. type: StructElementType.OBJECT,
  54745. refObjId: kidDict.getRaw("Obj") instanceof _primitives.Ref ? kidDict.getRaw("Obj").toString() : null,
  54746. pageObjId
  54747. });
  54748. }
  54749. return new StructElement({
  54750. type: StructElementType.ELEMENT,
  54751. dict: kidDict
  54752. });
  54753. }
  54754. }
  54755. class StructElement {
  54756. constructor(_ref) {
  54757. let {
  54758. type,
  54759. dict = null,
  54760. mcid = null,
  54761. pageObjId = null,
  54762. refObjId = null
  54763. } = _ref;
  54764. this.type = type;
  54765. this.dict = dict;
  54766. this.mcid = mcid;
  54767. this.pageObjId = pageObjId;
  54768. this.refObjId = refObjId;
  54769. this.parentNode = null;
  54770. }
  54771. }
  54772. class StructTreePage {
  54773. constructor(structTreeRoot, pageDict) {
  54774. this.root = structTreeRoot;
  54775. this.rootDict = structTreeRoot ? structTreeRoot.dict : null;
  54776. this.pageDict = pageDict;
  54777. this.nodes = [];
  54778. }
  54779. parse() {
  54780. if (!this.root || !this.rootDict) {
  54781. return;
  54782. }
  54783. const parentTree = this.rootDict.get("ParentTree");
  54784. if (!parentTree) {
  54785. return;
  54786. }
  54787. const id = this.pageDict.get("StructParents");
  54788. if (!Number.isInteger(id)) {
  54789. return;
  54790. }
  54791. const numberTree = new _name_number_tree.NumberTree(parentTree, this.rootDict.xref);
  54792. const parentArray = numberTree.get(id);
  54793. if (!Array.isArray(parentArray)) {
  54794. return;
  54795. }
  54796. const map = new Map();
  54797. for (const ref of parentArray) {
  54798. if (ref instanceof _primitives.Ref) {
  54799. this.addNode(this.rootDict.xref.fetch(ref), map);
  54800. }
  54801. }
  54802. }
  54803. addNode(dict, map) {
  54804. let level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  54805. if (level > MAX_DEPTH) {
  54806. (0, _util.warn)("StructTree MAX_DEPTH reached.");
  54807. return null;
  54808. }
  54809. if (map.has(dict)) {
  54810. return map.get(dict);
  54811. }
  54812. const element = new StructElementNode(this, dict);
  54813. map.set(dict, element);
  54814. const parent = dict.get("P");
  54815. if (!parent || (0, _primitives.isName)(parent.get("Type"), "StructTreeRoot")) {
  54816. if (!this.addTopLevelNode(dict, element)) {
  54817. map.delete(dict);
  54818. }
  54819. return element;
  54820. }
  54821. const parentNode = this.addNode(parent, map, level + 1);
  54822. if (!parentNode) {
  54823. return element;
  54824. }
  54825. let save = false;
  54826. for (const kid of parentNode.kids) {
  54827. if (kid.type === StructElementType.ELEMENT && kid.dict === dict) {
  54828. kid.parentNode = element;
  54829. save = true;
  54830. }
  54831. }
  54832. if (!save) {
  54833. map.delete(dict);
  54834. }
  54835. return element;
  54836. }
  54837. addTopLevelNode(dict, element) {
  54838. const obj = this.rootDict.get("K");
  54839. if (!obj) {
  54840. return false;
  54841. }
  54842. if (obj instanceof _primitives.Dict) {
  54843. if (obj.objId !== dict.objId) {
  54844. return false;
  54845. }
  54846. this.nodes[0] = element;
  54847. return true;
  54848. }
  54849. if (!Array.isArray(obj)) {
  54850. return true;
  54851. }
  54852. let save = false;
  54853. for (let i = 0; i < obj.length; i++) {
  54854. const kidRef = obj[i];
  54855. if (kidRef && kidRef.toString() === dict.objId) {
  54856. this.nodes[i] = element;
  54857. save = true;
  54858. }
  54859. }
  54860. return save;
  54861. }
  54862. get serializable() {
  54863. function nodeToSerializable(node, parent) {
  54864. let level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  54865. if (level > MAX_DEPTH) {
  54866. (0, _util.warn)("StructTree too deep to be fully serialized.");
  54867. return;
  54868. }
  54869. const obj = Object.create(null);
  54870. obj.role = node.role;
  54871. obj.children = [];
  54872. parent.children.push(obj);
  54873. const alt = node.dict.get("Alt");
  54874. if (typeof alt === "string") {
  54875. obj.alt = (0, _util.stringToPDFString)(alt);
  54876. }
  54877. const lang = node.dict.get("Lang");
  54878. if (typeof lang === "string") {
  54879. obj.lang = (0, _util.stringToPDFString)(lang);
  54880. }
  54881. for (const kid of node.kids) {
  54882. const kidElement = kid.type === StructElementType.ELEMENT ? kid.parentNode : null;
  54883. if (kidElement) {
  54884. nodeToSerializable(kidElement, obj, level + 1);
  54885. continue;
  54886. } else if (kid.type === StructElementType.PAGE_CONTENT || kid.type === StructElementType.STREAM_CONTENT) {
  54887. obj.children.push({
  54888. type: "content",
  54889. id: `page${kid.pageObjId}_mcid${kid.mcid}`
  54890. });
  54891. } else if (kid.type === StructElementType.OBJECT) {
  54892. obj.children.push({
  54893. type: "object",
  54894. id: kid.refObjId
  54895. });
  54896. }
  54897. }
  54898. }
  54899. const root = Object.create(null);
  54900. root.children = [];
  54901. root.role = "Root";
  54902. for (const child of this.nodes) {
  54903. if (!child) {
  54904. continue;
  54905. }
  54906. nodeToSerializable(child, root);
  54907. }
  54908. return root;
  54909. }
  54910. }
  54911. exports.StructTreePage = StructTreePage;
  54912. /***/ }),
  54913. /* 204 */
  54914. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  54915. "use strict";
  54916. Object.defineProperty(exports, "__esModule", ({
  54917. value: true
  54918. }));
  54919. exports.ObjectLoader = void 0;
  54920. var _primitives = __w_pdfjs_require__(134);
  54921. var _base_stream = __w_pdfjs_require__(136);
  54922. var _core_utils = __w_pdfjs_require__(135);
  54923. var _util = __w_pdfjs_require__(2);
  54924. function mayHaveChildren(value) {
  54925. return value instanceof _primitives.Ref || value instanceof _primitives.Dict || value instanceof _base_stream.BaseStream || Array.isArray(value);
  54926. }
  54927. function addChildren(node, nodesToVisit) {
  54928. if (node instanceof _primitives.Dict) {
  54929. node = node.getRawValues();
  54930. } else if (node instanceof _base_stream.BaseStream) {
  54931. node = node.dict.getRawValues();
  54932. } else if (!Array.isArray(node)) {
  54933. return;
  54934. }
  54935. for (const rawValue of node) {
  54936. if (mayHaveChildren(rawValue)) {
  54937. nodesToVisit.push(rawValue);
  54938. }
  54939. }
  54940. }
  54941. class ObjectLoader {
  54942. constructor(dict, keys, xref) {
  54943. this.dict = dict;
  54944. this.keys = keys;
  54945. this.xref = xref;
  54946. this.refSet = null;
  54947. }
  54948. async load() {
  54949. if (this.xref.stream.isDataLoaded) {
  54950. return undefined;
  54951. }
  54952. const {
  54953. keys,
  54954. dict
  54955. } = this;
  54956. this.refSet = new _primitives.RefSet();
  54957. const nodesToVisit = [];
  54958. for (const key of keys) {
  54959. const rawValue = dict.getRaw(key);
  54960. if (rawValue !== undefined) {
  54961. nodesToVisit.push(rawValue);
  54962. }
  54963. }
  54964. return this._walk(nodesToVisit);
  54965. }
  54966. async _walk(nodesToVisit) {
  54967. const nodesToRevisit = [];
  54968. const pendingRequests = [];
  54969. while (nodesToVisit.length) {
  54970. let currentNode = nodesToVisit.pop();
  54971. if (currentNode instanceof _primitives.Ref) {
  54972. if (this.refSet.has(currentNode)) {
  54973. continue;
  54974. }
  54975. try {
  54976. this.refSet.put(currentNode);
  54977. currentNode = this.xref.fetch(currentNode);
  54978. } catch (ex) {
  54979. if (!(ex instanceof _core_utils.MissingDataException)) {
  54980. (0, _util.warn)(`ObjectLoader._walk - requesting all data: "${ex}".`);
  54981. this.refSet = null;
  54982. const {
  54983. manager
  54984. } = this.xref.stream;
  54985. return manager.requestAllChunks();
  54986. }
  54987. nodesToRevisit.push(currentNode);
  54988. pendingRequests.push({
  54989. begin: ex.begin,
  54990. end: ex.end
  54991. });
  54992. }
  54993. }
  54994. if (currentNode instanceof _base_stream.BaseStream) {
  54995. const baseStreams = currentNode.getBaseStreams();
  54996. if (baseStreams) {
  54997. let foundMissingData = false;
  54998. for (const stream of baseStreams) {
  54999. if (stream.isDataLoaded) {
  55000. continue;
  55001. }
  55002. foundMissingData = true;
  55003. pendingRequests.push({
  55004. begin: stream.start,
  55005. end: stream.end
  55006. });
  55007. }
  55008. if (foundMissingData) {
  55009. nodesToRevisit.push(currentNode);
  55010. }
  55011. }
  55012. }
  55013. addChildren(currentNode, nodesToVisit);
  55014. }
  55015. if (pendingRequests.length) {
  55016. await this.xref.stream.manager.requestRanges(pendingRequests);
  55017. for (const node of nodesToRevisit) {
  55018. if (node instanceof _primitives.Ref) {
  55019. this.refSet.remove(node);
  55020. }
  55021. }
  55022. return this._walk(nodesToRevisit);
  55023. }
  55024. this.refSet = null;
  55025. return undefined;
  55026. }
  55027. }
  55028. exports.ObjectLoader = ObjectLoader;
  55029. /***/ }),
  55030. /* 205 */
  55031. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  55032. "use strict";
  55033. Object.defineProperty(exports, "__esModule", ({
  55034. value: true
  55035. }));
  55036. exports.XFAFactory = void 0;
  55037. var _xfa_object = __w_pdfjs_require__(206);
  55038. var _bind = __w_pdfjs_require__(210);
  55039. var _data = __w_pdfjs_require__(216);
  55040. var _fonts = __w_pdfjs_require__(214);
  55041. var _utils = __w_pdfjs_require__(207);
  55042. var _util = __w_pdfjs_require__(2);
  55043. var _parser = __w_pdfjs_require__(217);
  55044. var _xhtml = __w_pdfjs_require__(227);
  55045. class XFAFactory {
  55046. constructor(data) {
  55047. try {
  55048. this.root = new _parser.XFAParser().parse(XFAFactory._createDocument(data));
  55049. const binder = new _bind.Binder(this.root);
  55050. this.form = binder.bind();
  55051. this.dataHandler = new _data.DataHandler(this.root, binder.getData());
  55052. this.form[_xfa_object.$globalData].template = this.form;
  55053. } catch (e) {
  55054. (0, _util.warn)(`XFA - an error occurred during parsing and binding: ${e}`);
  55055. }
  55056. }
  55057. isValid() {
  55058. return this.root && this.form;
  55059. }
  55060. _createPagesHelper() {
  55061. const iterator = this.form[_xfa_object.$toPages]();
  55062. return new Promise((resolve, reject) => {
  55063. const nextIteration = () => {
  55064. try {
  55065. const value = iterator.next();
  55066. if (value.done) {
  55067. resolve(value.value);
  55068. } else {
  55069. setTimeout(nextIteration, 0);
  55070. }
  55071. } catch (e) {
  55072. reject(e);
  55073. }
  55074. };
  55075. setTimeout(nextIteration, 0);
  55076. });
  55077. }
  55078. async _createPages() {
  55079. try {
  55080. this.pages = await this._createPagesHelper();
  55081. this.dims = this.pages.children.map(c => {
  55082. const {
  55083. width,
  55084. height
  55085. } = c.attributes.style;
  55086. return [0, 0, parseInt(width), parseInt(height)];
  55087. });
  55088. } catch (e) {
  55089. (0, _util.warn)(`XFA - an error occurred during layout: ${e}`);
  55090. }
  55091. }
  55092. getBoundingBox(pageIndex) {
  55093. return this.dims[pageIndex];
  55094. }
  55095. async getNumPages() {
  55096. if (!this.pages) {
  55097. await this._createPages();
  55098. }
  55099. return this.dims.length;
  55100. }
  55101. setImages(images) {
  55102. this.form[_xfa_object.$globalData].images = images;
  55103. }
  55104. setFonts(fonts) {
  55105. this.form[_xfa_object.$globalData].fontFinder = new _fonts.FontFinder(fonts);
  55106. const missingFonts = [];
  55107. for (let typeface of this.form[_xfa_object.$globalData].usedTypefaces) {
  55108. typeface = (0, _utils.stripQuotes)(typeface);
  55109. const font = this.form[_xfa_object.$globalData].fontFinder.find(typeface);
  55110. if (!font) {
  55111. missingFonts.push(typeface);
  55112. }
  55113. }
  55114. if (missingFonts.length > 0) {
  55115. return missingFonts;
  55116. }
  55117. return null;
  55118. }
  55119. appendFonts(fonts, reallyMissingFonts) {
  55120. this.form[_xfa_object.$globalData].fontFinder.add(fonts, reallyMissingFonts);
  55121. }
  55122. async getPages() {
  55123. if (!this.pages) {
  55124. await this._createPages();
  55125. }
  55126. const pages = this.pages;
  55127. this.pages = null;
  55128. return pages;
  55129. }
  55130. serializeData(storage) {
  55131. return this.dataHandler.serialize(storage);
  55132. }
  55133. static _createDocument(data) {
  55134. if (!data["/xdp:xdp"]) {
  55135. return data["xdp:xdp"];
  55136. }
  55137. return Object.values(data).join("");
  55138. }
  55139. static getRichTextAsHtml(rc) {
  55140. if (!rc || typeof rc !== "string") {
  55141. return null;
  55142. }
  55143. try {
  55144. let root = new _parser.XFAParser(_xhtml.XhtmlNamespace, true).parse(rc);
  55145. if (!["body", "xhtml"].includes(root[_xfa_object.$nodeName])) {
  55146. const newRoot = _xhtml.XhtmlNamespace.body({});
  55147. newRoot[_xfa_object.$appendChild](root);
  55148. root = newRoot;
  55149. }
  55150. const result = root[_xfa_object.$toHTML]();
  55151. if (!result.success) {
  55152. return null;
  55153. }
  55154. const {
  55155. html
  55156. } = result;
  55157. const {
  55158. attributes
  55159. } = html;
  55160. if (attributes) {
  55161. if (attributes.class) {
  55162. attributes.class = attributes.class.filter(attr => !attr.startsWith("xfa"));
  55163. }
  55164. attributes.dir = "auto";
  55165. }
  55166. return {
  55167. html,
  55168. str: root[_xfa_object.$text]()
  55169. };
  55170. } catch (e) {
  55171. (0, _util.warn)(`XFA - an error occurred during parsing of rich text: ${e}`);
  55172. }
  55173. return null;
  55174. }
  55175. }
  55176. exports.XFAFactory = XFAFactory;
  55177. /***/ }),
  55178. /* 206 */
  55179. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  55180. "use strict";
  55181. Object.defineProperty(exports, "__esModule", ({
  55182. value: true
  55183. }));
  55184. 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;
  55185. var _utils = __w_pdfjs_require__(207);
  55186. var _util = __w_pdfjs_require__(2);
  55187. var _core_utils = __w_pdfjs_require__(135);
  55188. var _namespaces = __w_pdfjs_require__(208);
  55189. var _som = __w_pdfjs_require__(209);
  55190. const $acceptWhitespace = Symbol();
  55191. exports.$acceptWhitespace = $acceptWhitespace;
  55192. const $addHTML = Symbol();
  55193. exports.$addHTML = $addHTML;
  55194. const $appendChild = Symbol();
  55195. exports.$appendChild = $appendChild;
  55196. const $childrenToHTML = Symbol();
  55197. exports.$childrenToHTML = $childrenToHTML;
  55198. const $clean = Symbol();
  55199. exports.$clean = $clean;
  55200. const $cleanPage = Symbol();
  55201. exports.$cleanPage = $cleanPage;
  55202. const $cleanup = Symbol();
  55203. exports.$cleanup = $cleanup;
  55204. const $clone = Symbol();
  55205. exports.$clone = $clone;
  55206. const $consumed = Symbol();
  55207. exports.$consumed = $consumed;
  55208. const $content = Symbol("content");
  55209. exports.$content = $content;
  55210. const $data = Symbol("data");
  55211. exports.$data = $data;
  55212. const $dump = Symbol();
  55213. exports.$dump = $dump;
  55214. const $extra = Symbol("extra");
  55215. exports.$extra = $extra;
  55216. const $finalize = Symbol();
  55217. exports.$finalize = $finalize;
  55218. const $flushHTML = Symbol();
  55219. exports.$flushHTML = $flushHTML;
  55220. const $getAttributeIt = Symbol();
  55221. exports.$getAttributeIt = $getAttributeIt;
  55222. const $getAttributes = Symbol();
  55223. exports.$getAttributes = $getAttributes;
  55224. const $getAvailableSpace = Symbol();
  55225. exports.$getAvailableSpace = $getAvailableSpace;
  55226. const $getChildrenByClass = Symbol();
  55227. exports.$getChildrenByClass = $getChildrenByClass;
  55228. const $getChildrenByName = Symbol();
  55229. exports.$getChildrenByName = $getChildrenByName;
  55230. const $getChildrenByNameIt = Symbol();
  55231. exports.$getChildrenByNameIt = $getChildrenByNameIt;
  55232. const $getDataValue = Symbol();
  55233. exports.$getDataValue = $getDataValue;
  55234. const $getExtra = Symbol();
  55235. exports.$getExtra = $getExtra;
  55236. const $getRealChildrenByNameIt = Symbol();
  55237. exports.$getRealChildrenByNameIt = $getRealChildrenByNameIt;
  55238. const $getChildren = Symbol();
  55239. exports.$getChildren = $getChildren;
  55240. const $getContainedChildren = Symbol();
  55241. exports.$getContainedChildren = $getContainedChildren;
  55242. const $getNextPage = Symbol();
  55243. exports.$getNextPage = $getNextPage;
  55244. const $getSubformParent = Symbol();
  55245. exports.$getSubformParent = $getSubformParent;
  55246. const $getParent = Symbol();
  55247. exports.$getParent = $getParent;
  55248. const $getTemplateRoot = Symbol();
  55249. exports.$getTemplateRoot = $getTemplateRoot;
  55250. const $globalData = Symbol();
  55251. exports.$globalData = $globalData;
  55252. const $hasSettableValue = Symbol();
  55253. exports.$hasSettableValue = $hasSettableValue;
  55254. const $ids = Symbol();
  55255. exports.$ids = $ids;
  55256. const $indexOf = Symbol();
  55257. exports.$indexOf = $indexOf;
  55258. const $insertAt = Symbol();
  55259. exports.$insertAt = $insertAt;
  55260. const $isCDATAXml = Symbol();
  55261. exports.$isCDATAXml = $isCDATAXml;
  55262. const $isBindable = Symbol();
  55263. exports.$isBindable = $isBindable;
  55264. const $isDataValue = Symbol();
  55265. exports.$isDataValue = $isDataValue;
  55266. const $isDescendent = Symbol();
  55267. exports.$isDescendent = $isDescendent;
  55268. const $isNsAgnostic = Symbol();
  55269. exports.$isNsAgnostic = $isNsAgnostic;
  55270. const $isSplittable = Symbol();
  55271. exports.$isSplittable = $isSplittable;
  55272. const $isThereMoreWidth = Symbol();
  55273. exports.$isThereMoreWidth = $isThereMoreWidth;
  55274. const $isTransparent = Symbol();
  55275. exports.$isTransparent = $isTransparent;
  55276. const $isUsable = Symbol();
  55277. exports.$isUsable = $isUsable;
  55278. const $lastAttribute = Symbol();
  55279. const $namespaceId = Symbol("namespaceId");
  55280. exports.$namespaceId = $namespaceId;
  55281. const $nodeName = Symbol("nodeName");
  55282. exports.$nodeName = $nodeName;
  55283. const $nsAttributes = Symbol();
  55284. exports.$nsAttributes = $nsAttributes;
  55285. const $onChild = Symbol();
  55286. exports.$onChild = $onChild;
  55287. const $onChildCheck = Symbol();
  55288. exports.$onChildCheck = $onChildCheck;
  55289. const $onText = Symbol();
  55290. exports.$onText = $onText;
  55291. const $pushGlyphs = Symbol();
  55292. exports.$pushGlyphs = $pushGlyphs;
  55293. const $popPara = Symbol();
  55294. exports.$popPara = $popPara;
  55295. const $pushPara = Symbol();
  55296. exports.$pushPara = $pushPara;
  55297. const $removeChild = Symbol();
  55298. exports.$removeChild = $removeChild;
  55299. const $root = Symbol("root");
  55300. exports.$root = $root;
  55301. const $resolvePrototypes = Symbol();
  55302. exports.$resolvePrototypes = $resolvePrototypes;
  55303. const $searchNode = Symbol();
  55304. exports.$searchNode = $searchNode;
  55305. const $setId = Symbol();
  55306. exports.$setId = $setId;
  55307. const $setSetAttributes = Symbol();
  55308. exports.$setSetAttributes = $setSetAttributes;
  55309. const $setValue = Symbol();
  55310. exports.$setValue = $setValue;
  55311. const $tabIndex = Symbol();
  55312. exports.$tabIndex = $tabIndex;
  55313. const $text = Symbol();
  55314. exports.$text = $text;
  55315. const $toPages = Symbol();
  55316. exports.$toPages = $toPages;
  55317. const $toHTML = Symbol();
  55318. exports.$toHTML = $toHTML;
  55319. const $toString = Symbol();
  55320. exports.$toString = $toString;
  55321. const $toStyle = Symbol();
  55322. exports.$toStyle = $toStyle;
  55323. const $uid = Symbol("uid");
  55324. exports.$uid = $uid;
  55325. const _applyPrototype = Symbol();
  55326. const _attributes = Symbol();
  55327. const _attributeNames = Symbol();
  55328. const _children = Symbol("_children");
  55329. const _cloneAttribute = Symbol();
  55330. const _dataValue = Symbol();
  55331. const _defaultValue = Symbol();
  55332. const _filteredChildrenGenerator = Symbol();
  55333. const _getPrototype = Symbol();
  55334. const _getUnsetAttributes = Symbol();
  55335. const _hasChildren = Symbol();
  55336. const _max = Symbol();
  55337. const _options = Symbol();
  55338. const _parent = Symbol("parent");
  55339. const _resolvePrototypesHelper = Symbol();
  55340. const _setAttributes = Symbol();
  55341. const _validator = Symbol();
  55342. let uid = 0;
  55343. const NS_DATASETS = _namespaces.NamespaceIds.datasets.id;
  55344. class XFAObject {
  55345. constructor(nsId, name) {
  55346. let hasChildren = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  55347. this[$namespaceId] = nsId;
  55348. this[$nodeName] = name;
  55349. this[_hasChildren] = hasChildren;
  55350. this[_parent] = null;
  55351. this[_children] = [];
  55352. this[$uid] = `${name}${uid++}`;
  55353. this[$globalData] = null;
  55354. }
  55355. [$onChild](child) {
  55356. if (!this[_hasChildren] || !this[$onChildCheck](child)) {
  55357. return false;
  55358. }
  55359. const name = child[$nodeName];
  55360. const node = this[name];
  55361. if (node instanceof XFAObjectArray) {
  55362. if (node.push(child)) {
  55363. this[$appendChild](child);
  55364. return true;
  55365. }
  55366. } else {
  55367. if (node !== null) {
  55368. this[$removeChild](node);
  55369. }
  55370. this[name] = child;
  55371. this[$appendChild](child);
  55372. return true;
  55373. }
  55374. let id = "";
  55375. if (this.id) {
  55376. id = ` (id: ${this.id})`;
  55377. } else if (this.name) {
  55378. id = ` (name: ${this.name} ${this.h.value})`;
  55379. }
  55380. (0, _util.warn)(`XFA - node "${this[$nodeName]}"${id} has already enough "${name}"!`);
  55381. return false;
  55382. }
  55383. [$onChildCheck](child) {
  55384. return this.hasOwnProperty(child[$nodeName]) && child[$namespaceId] === this[$namespaceId];
  55385. }
  55386. [$isNsAgnostic]() {
  55387. return false;
  55388. }
  55389. [$acceptWhitespace]() {
  55390. return false;
  55391. }
  55392. [$isCDATAXml]() {
  55393. return false;
  55394. }
  55395. [$isBindable]() {
  55396. return false;
  55397. }
  55398. [$popPara]() {
  55399. if (this.para) {
  55400. this[$getTemplateRoot]()[$extra].paraStack.pop();
  55401. }
  55402. }
  55403. [$pushPara]() {
  55404. this[$getTemplateRoot]()[$extra].paraStack.push(this.para);
  55405. }
  55406. [$setId](ids) {
  55407. if (this.id && this[$namespaceId] === _namespaces.NamespaceIds.template.id) {
  55408. ids.set(this.id, this);
  55409. }
  55410. }
  55411. [$getTemplateRoot]() {
  55412. return this[$globalData].template;
  55413. }
  55414. [$isSplittable]() {
  55415. return false;
  55416. }
  55417. [$isThereMoreWidth]() {
  55418. return false;
  55419. }
  55420. [$appendChild](child) {
  55421. child[_parent] = this;
  55422. this[_children].push(child);
  55423. if (!child[$globalData] && this[$globalData]) {
  55424. child[$globalData] = this[$globalData];
  55425. }
  55426. }
  55427. [$removeChild](child) {
  55428. const i = this[_children].indexOf(child);
  55429. this[_children].splice(i, 1);
  55430. }
  55431. [$hasSettableValue]() {
  55432. return this.hasOwnProperty("value");
  55433. }
  55434. [$setValue](_) {}
  55435. [$onText](_) {}
  55436. [$finalize]() {}
  55437. [$clean](builder) {
  55438. delete this[_hasChildren];
  55439. if (this[$cleanup]) {
  55440. builder.clean(this[$cleanup]);
  55441. delete this[$cleanup];
  55442. }
  55443. }
  55444. [$indexOf](child) {
  55445. return this[_children].indexOf(child);
  55446. }
  55447. [$insertAt](i, child) {
  55448. child[_parent] = this;
  55449. this[_children].splice(i, 0, child);
  55450. if (!child[$globalData] && this[$globalData]) {
  55451. child[$globalData] = this[$globalData];
  55452. }
  55453. }
  55454. [$isTransparent]() {
  55455. return !this.name;
  55456. }
  55457. [$lastAttribute]() {
  55458. return "";
  55459. }
  55460. [$text]() {
  55461. if (this[_children].length === 0) {
  55462. return this[$content];
  55463. }
  55464. return this[_children].map(c => c[$text]()).join("");
  55465. }
  55466. get [_attributeNames]() {
  55467. const proto = Object.getPrototypeOf(this);
  55468. if (!proto._attributes) {
  55469. const attributes = proto._attributes = new Set();
  55470. for (const name of Object.getOwnPropertyNames(this)) {
  55471. if (this[name] === null || this[name] instanceof XFAObject || this[name] instanceof XFAObjectArray) {
  55472. break;
  55473. }
  55474. attributes.add(name);
  55475. }
  55476. }
  55477. return (0, _util.shadow)(this, _attributeNames, proto._attributes);
  55478. }
  55479. [$isDescendent](parent) {
  55480. let node = this;
  55481. while (node) {
  55482. if (node === parent) {
  55483. return true;
  55484. }
  55485. node = node[$getParent]();
  55486. }
  55487. return false;
  55488. }
  55489. [$getParent]() {
  55490. return this[_parent];
  55491. }
  55492. [$getSubformParent]() {
  55493. return this[$getParent]();
  55494. }
  55495. [$getChildren]() {
  55496. let name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  55497. if (!name) {
  55498. return this[_children];
  55499. }
  55500. return this[name];
  55501. }
  55502. [$dump]() {
  55503. const dumped = Object.create(null);
  55504. if (this[$content]) {
  55505. dumped.$content = this[$content];
  55506. }
  55507. for (const name of Object.getOwnPropertyNames(this)) {
  55508. const value = this[name];
  55509. if (value === null) {
  55510. continue;
  55511. }
  55512. if (value instanceof XFAObject) {
  55513. dumped[name] = value[$dump]();
  55514. } else if (value instanceof XFAObjectArray) {
  55515. if (!value.isEmpty()) {
  55516. dumped[name] = value.dump();
  55517. }
  55518. } else {
  55519. dumped[name] = value;
  55520. }
  55521. }
  55522. return dumped;
  55523. }
  55524. [$toStyle]() {
  55525. return null;
  55526. }
  55527. [$toHTML]() {
  55528. return _utils.HTMLResult.EMPTY;
  55529. }
  55530. *[$getContainedChildren]() {
  55531. for (const node of this[$getChildren]()) {
  55532. yield node;
  55533. }
  55534. }
  55535. *[_filteredChildrenGenerator](filter, include) {
  55536. for (const node of this[$getContainedChildren]()) {
  55537. if (!filter || include === filter.has(node[$nodeName])) {
  55538. const availableSpace = this[$getAvailableSpace]();
  55539. const res = node[$toHTML](availableSpace);
  55540. if (!res.success) {
  55541. this[$extra].failingNode = node;
  55542. }
  55543. yield res;
  55544. }
  55545. }
  55546. }
  55547. [$flushHTML]() {
  55548. return null;
  55549. }
  55550. [$addHTML](html, bbox) {
  55551. this[$extra].children.push(html);
  55552. }
  55553. [$getAvailableSpace]() {}
  55554. [$childrenToHTML](_ref) {
  55555. let {
  55556. filter = null,
  55557. include = true
  55558. } = _ref;
  55559. if (!this[$extra].generator) {
  55560. this[$extra].generator = this[_filteredChildrenGenerator](filter, include);
  55561. } else {
  55562. const availableSpace = this[$getAvailableSpace]();
  55563. const res = this[$extra].failingNode[$toHTML](availableSpace);
  55564. if (!res.success) {
  55565. return res;
  55566. }
  55567. if (res.html) {
  55568. this[$addHTML](res.html, res.bbox);
  55569. }
  55570. delete this[$extra].failingNode;
  55571. }
  55572. while (true) {
  55573. const gen = this[$extra].generator.next();
  55574. if (gen.done) {
  55575. break;
  55576. }
  55577. const res = gen.value;
  55578. if (!res.success) {
  55579. return res;
  55580. }
  55581. if (res.html) {
  55582. this[$addHTML](res.html, res.bbox);
  55583. }
  55584. }
  55585. this[$extra].generator = null;
  55586. return _utils.HTMLResult.EMPTY;
  55587. }
  55588. [$setSetAttributes](attributes) {
  55589. this[_setAttributes] = new Set(Object.keys(attributes));
  55590. }
  55591. [_getUnsetAttributes](protoAttributes) {
  55592. const allAttr = this[_attributeNames];
  55593. const setAttr = this[_setAttributes];
  55594. return [...protoAttributes].filter(x => allAttr.has(x) && !setAttr.has(x));
  55595. }
  55596. [$resolvePrototypes](ids) {
  55597. let ancestors = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Set();
  55598. for (const child of this[_children]) {
  55599. child[_resolvePrototypesHelper](ids, ancestors);
  55600. }
  55601. }
  55602. [_resolvePrototypesHelper](ids, ancestors) {
  55603. const proto = this[_getPrototype](ids, ancestors);
  55604. if (proto) {
  55605. this[_applyPrototype](proto, ids, ancestors);
  55606. } else {
  55607. this[$resolvePrototypes](ids, ancestors);
  55608. }
  55609. }
  55610. [_getPrototype](ids, ancestors) {
  55611. const {
  55612. use,
  55613. usehref
  55614. } = this;
  55615. if (!use && !usehref) {
  55616. return null;
  55617. }
  55618. let proto = null;
  55619. let somExpression = null;
  55620. let id = null;
  55621. let ref = use;
  55622. if (usehref) {
  55623. ref = usehref;
  55624. if (usehref.startsWith("#som(") && usehref.endsWith(")")) {
  55625. somExpression = usehref.slice("#som(".length, usehref.length - 1);
  55626. } else if (usehref.startsWith(".#som(") && usehref.endsWith(")")) {
  55627. somExpression = usehref.slice(".#som(".length, usehref.length - 1);
  55628. } else if (usehref.startsWith("#")) {
  55629. id = usehref.slice(1);
  55630. } else if (usehref.startsWith(".#")) {
  55631. id = usehref.slice(2);
  55632. }
  55633. } else if (use.startsWith("#")) {
  55634. id = use.slice(1);
  55635. } else {
  55636. somExpression = use;
  55637. }
  55638. this.use = this.usehref = "";
  55639. if (id) {
  55640. proto = ids.get(id);
  55641. } else {
  55642. proto = (0, _som.searchNode)(ids.get($root), this, somExpression, true, false);
  55643. if (proto) {
  55644. proto = proto[0];
  55645. }
  55646. }
  55647. if (!proto) {
  55648. (0, _util.warn)(`XFA - Invalid prototype reference: ${ref}.`);
  55649. return null;
  55650. }
  55651. if (proto[$nodeName] !== this[$nodeName]) {
  55652. (0, _util.warn)(`XFA - Incompatible prototype: ${proto[$nodeName]} !== ${this[$nodeName]}.`);
  55653. return null;
  55654. }
  55655. if (ancestors.has(proto)) {
  55656. (0, _util.warn)(`XFA - Cycle detected in prototypes use.`);
  55657. return null;
  55658. }
  55659. ancestors.add(proto);
  55660. const protoProto = proto[_getPrototype](ids, ancestors);
  55661. if (protoProto) {
  55662. proto[_applyPrototype](protoProto, ids, ancestors);
  55663. }
  55664. proto[$resolvePrototypes](ids, ancestors);
  55665. ancestors.delete(proto);
  55666. return proto;
  55667. }
  55668. [_applyPrototype](proto, ids, ancestors) {
  55669. if (ancestors.has(proto)) {
  55670. (0, _util.warn)(`XFA - Cycle detected in prototypes use.`);
  55671. return;
  55672. }
  55673. if (!this[$content] && proto[$content]) {
  55674. this[$content] = proto[$content];
  55675. }
  55676. const newAncestors = new Set(ancestors);
  55677. newAncestors.add(proto);
  55678. for (const unsetAttrName of this[_getUnsetAttributes](proto[_setAttributes])) {
  55679. this[unsetAttrName] = proto[unsetAttrName];
  55680. if (this[_setAttributes]) {
  55681. this[_setAttributes].add(unsetAttrName);
  55682. }
  55683. }
  55684. for (const name of Object.getOwnPropertyNames(this)) {
  55685. if (this[_attributeNames].has(name)) {
  55686. continue;
  55687. }
  55688. const value = this[name];
  55689. const protoValue = proto[name];
  55690. if (value instanceof XFAObjectArray) {
  55691. for (const child of value[_children]) {
  55692. child[_resolvePrototypesHelper](ids, ancestors);
  55693. }
  55694. for (let i = value[_children].length, ii = protoValue[_children].length; i < ii; i++) {
  55695. const child = proto[_children][i][$clone]();
  55696. if (value.push(child)) {
  55697. child[_parent] = this;
  55698. this[_children].push(child);
  55699. child[_resolvePrototypesHelper](ids, ancestors);
  55700. } else {
  55701. break;
  55702. }
  55703. }
  55704. continue;
  55705. }
  55706. if (value !== null) {
  55707. value[$resolvePrototypes](ids, ancestors);
  55708. if (protoValue) {
  55709. value[_applyPrototype](protoValue, ids, ancestors);
  55710. }
  55711. continue;
  55712. }
  55713. if (protoValue !== null) {
  55714. const child = protoValue[$clone]();
  55715. child[_parent] = this;
  55716. this[name] = child;
  55717. this[_children].push(child);
  55718. child[_resolvePrototypesHelper](ids, ancestors);
  55719. }
  55720. }
  55721. }
  55722. static [_cloneAttribute](obj) {
  55723. if (Array.isArray(obj)) {
  55724. return obj.map(x => XFAObject[_cloneAttribute](x));
  55725. }
  55726. if (typeof obj === "object" && obj !== null) {
  55727. return Object.assign({}, obj);
  55728. }
  55729. return obj;
  55730. }
  55731. [$clone]() {
  55732. const clone = Object.create(Object.getPrototypeOf(this));
  55733. for (const $symbol of Object.getOwnPropertySymbols(this)) {
  55734. try {
  55735. clone[$symbol] = this[$symbol];
  55736. } catch (_) {
  55737. (0, _util.shadow)(clone, $symbol, this[$symbol]);
  55738. }
  55739. }
  55740. clone[$uid] = `${clone[$nodeName]}${uid++}`;
  55741. clone[_children] = [];
  55742. for (const name of Object.getOwnPropertyNames(this)) {
  55743. if (this[_attributeNames].has(name)) {
  55744. clone[name] = XFAObject[_cloneAttribute](this[name]);
  55745. continue;
  55746. }
  55747. const value = this[name];
  55748. if (value instanceof XFAObjectArray) {
  55749. clone[name] = new XFAObjectArray(value[_max]);
  55750. } else {
  55751. clone[name] = null;
  55752. }
  55753. }
  55754. for (const child of this[_children]) {
  55755. const name = child[$nodeName];
  55756. const clonedChild = child[$clone]();
  55757. clone[_children].push(clonedChild);
  55758. clonedChild[_parent] = clone;
  55759. if (clone[name] === null) {
  55760. clone[name] = clonedChild;
  55761. } else {
  55762. clone[name][_children].push(clonedChild);
  55763. }
  55764. }
  55765. return clone;
  55766. }
  55767. [$getChildren]() {
  55768. let name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  55769. if (!name) {
  55770. return this[_children];
  55771. }
  55772. return this[_children].filter(c => c[$nodeName] === name);
  55773. }
  55774. [$getChildrenByClass](name) {
  55775. return this[name];
  55776. }
  55777. [$getChildrenByName](name, allTransparent) {
  55778. let first = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
  55779. return Array.from(this[$getChildrenByNameIt](name, allTransparent, first));
  55780. }
  55781. [$getChildrenByNameIt](name, allTransparent) {
  55782. var _this = this;
  55783. let first = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
  55784. return function* () {
  55785. if (name === "parent") {
  55786. yield _this[_parent];
  55787. return;
  55788. }
  55789. for (const child of _this[_children]) {
  55790. if (child[$nodeName] === name) {
  55791. yield child;
  55792. }
  55793. if (child.name === name) {
  55794. yield child;
  55795. }
  55796. if (allTransparent || child[$isTransparent]()) {
  55797. yield* child[$getChildrenByNameIt](name, allTransparent, false);
  55798. }
  55799. }
  55800. if (first && _this[_attributeNames].has(name)) {
  55801. yield new XFAAttribute(_this, name, _this[name]);
  55802. }
  55803. }();
  55804. }
  55805. }
  55806. exports.XFAObject = XFAObject;
  55807. class XFAObjectArray {
  55808. constructor() {
  55809. let max = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : Infinity;
  55810. this[_max] = max;
  55811. this[_children] = [];
  55812. }
  55813. push(child) {
  55814. const len = this[_children].length;
  55815. if (len <= this[_max]) {
  55816. this[_children].push(child);
  55817. return true;
  55818. }
  55819. (0, _util.warn)(`XFA - node "${child[$nodeName]}" accepts no more than ${this[_max]} children`);
  55820. return false;
  55821. }
  55822. isEmpty() {
  55823. return this[_children].length === 0;
  55824. }
  55825. dump() {
  55826. return this[_children].length === 1 ? this[_children][0][$dump]() : this[_children].map(x => x[$dump]());
  55827. }
  55828. [$clone]() {
  55829. const clone = new XFAObjectArray(this[_max]);
  55830. clone[_children] = this[_children].map(c => c[$clone]());
  55831. return clone;
  55832. }
  55833. get children() {
  55834. return this[_children];
  55835. }
  55836. clear() {
  55837. this[_children].length = 0;
  55838. }
  55839. }
  55840. exports.XFAObjectArray = XFAObjectArray;
  55841. class XFAAttribute {
  55842. constructor(node, name, value) {
  55843. this[_parent] = node;
  55844. this[$nodeName] = name;
  55845. this[$content] = value;
  55846. this[$consumed] = false;
  55847. this[$uid] = `attribute${uid++}`;
  55848. }
  55849. [$getParent]() {
  55850. return this[_parent];
  55851. }
  55852. [$isDataValue]() {
  55853. return true;
  55854. }
  55855. [$getDataValue]() {
  55856. return this[$content].trim();
  55857. }
  55858. [$setValue](value) {
  55859. value = value.value || "";
  55860. this[$content] = value.toString();
  55861. }
  55862. [$text]() {
  55863. return this[$content];
  55864. }
  55865. [$isDescendent](parent) {
  55866. return this[_parent] === parent || this[_parent][$isDescendent](parent);
  55867. }
  55868. }
  55869. exports.XFAAttribute = XFAAttribute;
  55870. class XmlObject extends XFAObject {
  55871. constructor(nsId, name) {
  55872. let attributes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  55873. super(nsId, name);
  55874. this[$content] = "";
  55875. this[_dataValue] = null;
  55876. if (name !== "#text") {
  55877. const map = new Map();
  55878. this[_attributes] = map;
  55879. for (const [attrName, value] of Object.entries(attributes)) {
  55880. map.set(attrName, new XFAAttribute(this, attrName, value));
  55881. }
  55882. if (attributes.hasOwnProperty($nsAttributes)) {
  55883. const dataNode = attributes[$nsAttributes].xfa.dataNode;
  55884. if (dataNode !== undefined) {
  55885. if (dataNode === "dataGroup") {
  55886. this[_dataValue] = false;
  55887. } else if (dataNode === "dataValue") {
  55888. this[_dataValue] = true;
  55889. }
  55890. }
  55891. }
  55892. }
  55893. this[$consumed] = false;
  55894. }
  55895. [$toString](buf) {
  55896. const tagName = this[$nodeName];
  55897. if (tagName === "#text") {
  55898. buf.push((0, _core_utils.encodeToXmlString)(this[$content]));
  55899. return;
  55900. }
  55901. const utf8TagName = (0, _util.utf8StringToString)(tagName);
  55902. const prefix = this[$namespaceId] === NS_DATASETS ? "xfa:" : "";
  55903. buf.push(`<${prefix}${utf8TagName}`);
  55904. for (const [name, value] of this[_attributes].entries()) {
  55905. const utf8Name = (0, _util.utf8StringToString)(name);
  55906. buf.push(` ${utf8Name}="${(0, _core_utils.encodeToXmlString)(value[$content])}"`);
  55907. }
  55908. if (this[_dataValue] !== null) {
  55909. if (this[_dataValue]) {
  55910. buf.push(` xfa:dataNode="dataValue"`);
  55911. } else {
  55912. buf.push(` xfa:dataNode="dataGroup"`);
  55913. }
  55914. }
  55915. if (!this[$content] && this[_children].length === 0) {
  55916. buf.push("/>");
  55917. return;
  55918. }
  55919. buf.push(">");
  55920. if (this[$content]) {
  55921. if (typeof this[$content] === "string") {
  55922. buf.push((0, _core_utils.encodeToXmlString)(this[$content]));
  55923. } else {
  55924. this[$content][$toString](buf);
  55925. }
  55926. } else {
  55927. for (const child of this[_children]) {
  55928. child[$toString](buf);
  55929. }
  55930. }
  55931. buf.push(`</${prefix}${utf8TagName}>`);
  55932. }
  55933. [$onChild](child) {
  55934. if (this[$content]) {
  55935. const node = new XmlObject(this[$namespaceId], "#text");
  55936. this[$appendChild](node);
  55937. node[$content] = this[$content];
  55938. this[$content] = "";
  55939. }
  55940. this[$appendChild](child);
  55941. return true;
  55942. }
  55943. [$onText](str) {
  55944. this[$content] += str;
  55945. }
  55946. [$finalize]() {
  55947. if (this[$content] && this[_children].length > 0) {
  55948. const node = new XmlObject(this[$namespaceId], "#text");
  55949. this[$appendChild](node);
  55950. node[$content] = this[$content];
  55951. delete this[$content];
  55952. }
  55953. }
  55954. [$toHTML]() {
  55955. if (this[$nodeName] === "#text") {
  55956. return _utils.HTMLResult.success({
  55957. name: "#text",
  55958. value: this[$content]
  55959. });
  55960. }
  55961. return _utils.HTMLResult.EMPTY;
  55962. }
  55963. [$getChildren]() {
  55964. let name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  55965. if (!name) {
  55966. return this[_children];
  55967. }
  55968. return this[_children].filter(c => c[$nodeName] === name);
  55969. }
  55970. [$getAttributes]() {
  55971. return this[_attributes];
  55972. }
  55973. [$getChildrenByClass](name) {
  55974. const value = this[_attributes].get(name);
  55975. if (value !== undefined) {
  55976. return value;
  55977. }
  55978. return this[$getChildren](name);
  55979. }
  55980. *[$getChildrenByNameIt](name, allTransparent) {
  55981. const value = this[_attributes].get(name);
  55982. if (value) {
  55983. yield value;
  55984. }
  55985. for (const child of this[_children]) {
  55986. if (child[$nodeName] === name) {
  55987. yield child;
  55988. }
  55989. if (allTransparent) {
  55990. yield* child[$getChildrenByNameIt](name, allTransparent);
  55991. }
  55992. }
  55993. }
  55994. *[$getAttributeIt](name, skipConsumed) {
  55995. const value = this[_attributes].get(name);
  55996. if (value && (!skipConsumed || !value[$consumed])) {
  55997. yield value;
  55998. }
  55999. for (const child of this[_children]) {
  56000. yield* child[$getAttributeIt](name, skipConsumed);
  56001. }
  56002. }
  56003. *[$getRealChildrenByNameIt](name, allTransparent, skipConsumed) {
  56004. for (const child of this[_children]) {
  56005. if (child[$nodeName] === name && (!skipConsumed || !child[$consumed])) {
  56006. yield child;
  56007. }
  56008. if (allTransparent) {
  56009. yield* child[$getRealChildrenByNameIt](name, allTransparent, skipConsumed);
  56010. }
  56011. }
  56012. }
  56013. [$isDataValue]() {
  56014. if (this[_dataValue] === null) {
  56015. return this[_children].length === 0 || this[_children][0][$namespaceId] === _namespaces.NamespaceIds.xhtml.id;
  56016. }
  56017. return this[_dataValue];
  56018. }
  56019. [$getDataValue]() {
  56020. if (this[_dataValue] === null) {
  56021. if (this[_children].length === 0) {
  56022. return this[$content].trim();
  56023. }
  56024. if (this[_children][0][$namespaceId] === _namespaces.NamespaceIds.xhtml.id) {
  56025. return this[_children][0][$text]().trim();
  56026. }
  56027. return null;
  56028. }
  56029. return this[$content].trim();
  56030. }
  56031. [$setValue](value) {
  56032. value = value.value || "";
  56033. this[$content] = value.toString();
  56034. }
  56035. [$dump]() {
  56036. let hasNS = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  56037. const dumped = Object.create(null);
  56038. if (hasNS) {
  56039. dumped.$ns = this[$namespaceId];
  56040. }
  56041. if (this[$content]) {
  56042. dumped.$content = this[$content];
  56043. }
  56044. dumped.$name = this[$nodeName];
  56045. dumped.children = [];
  56046. for (const child of this[_children]) {
  56047. dumped.children.push(child[$dump](hasNS));
  56048. }
  56049. dumped.attributes = Object.create(null);
  56050. for (const [name, value] of this[_attributes]) {
  56051. dumped.attributes[name] = value[$content];
  56052. }
  56053. return dumped;
  56054. }
  56055. }
  56056. exports.XmlObject = XmlObject;
  56057. class ContentObject extends XFAObject {
  56058. constructor(nsId, name) {
  56059. super(nsId, name);
  56060. this[$content] = "";
  56061. }
  56062. [$onText](text) {
  56063. this[$content] += text;
  56064. }
  56065. [$finalize]() {}
  56066. }
  56067. exports.ContentObject = ContentObject;
  56068. class OptionObject extends ContentObject {
  56069. constructor(nsId, name, options) {
  56070. super(nsId, name);
  56071. this[_options] = options;
  56072. }
  56073. [$finalize]() {
  56074. this[$content] = (0, _utils.getKeyword)({
  56075. data: this[$content],
  56076. defaultValue: this[_options][0],
  56077. validate: k => this[_options].includes(k)
  56078. });
  56079. }
  56080. [$clean](builder) {
  56081. super[$clean](builder);
  56082. delete this[_options];
  56083. }
  56084. }
  56085. exports.OptionObject = OptionObject;
  56086. class StringObject extends ContentObject {
  56087. [$finalize]() {
  56088. this[$content] = this[$content].trim();
  56089. }
  56090. }
  56091. exports.StringObject = StringObject;
  56092. class IntegerObject extends ContentObject {
  56093. constructor(nsId, name, defaultValue, validator) {
  56094. super(nsId, name);
  56095. this[_defaultValue] = defaultValue;
  56096. this[_validator] = validator;
  56097. }
  56098. [$finalize]() {
  56099. this[$content] = (0, _utils.getInteger)({
  56100. data: this[$content],
  56101. defaultValue: this[_defaultValue],
  56102. validate: this[_validator]
  56103. });
  56104. }
  56105. [$clean](builder) {
  56106. super[$clean](builder);
  56107. delete this[_defaultValue];
  56108. delete this[_validator];
  56109. }
  56110. }
  56111. exports.IntegerObject = IntegerObject;
  56112. class Option01 extends IntegerObject {
  56113. constructor(nsId, name) {
  56114. super(nsId, name, 0, n => n === 1);
  56115. }
  56116. }
  56117. exports.Option01 = Option01;
  56118. class Option10 extends IntegerObject {
  56119. constructor(nsId, name) {
  56120. super(nsId, name, 1, n => n === 0);
  56121. }
  56122. }
  56123. exports.Option10 = Option10;
  56124. /***/ }),
  56125. /* 207 */
  56126. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  56127. "use strict";
  56128. Object.defineProperty(exports, "__esModule", ({
  56129. value: true
  56130. }));
  56131. exports.HTMLResult = void 0;
  56132. exports.getBBox = getBBox;
  56133. exports.getColor = getColor;
  56134. exports.getFloat = getFloat;
  56135. exports.getInteger = getInteger;
  56136. exports.getKeyword = getKeyword;
  56137. exports.getMeasurement = getMeasurement;
  56138. exports.getRatio = getRatio;
  56139. exports.getRelevant = getRelevant;
  56140. exports.getStringOption = getStringOption;
  56141. exports.stripQuotes = stripQuotes;
  56142. var _util = __w_pdfjs_require__(2);
  56143. const dimConverters = {
  56144. pt: x => x,
  56145. cm: x => x / 2.54 * 72,
  56146. mm: x => x / (10 * 2.54) * 72,
  56147. in: x => x * 72,
  56148. px: x => x
  56149. };
  56150. const measurementPattern = /([+-]?\d+\.?\d*)(.*)/;
  56151. function stripQuotes(str) {
  56152. if (str.startsWith("'") || str.startsWith('"')) {
  56153. return str.slice(1, str.length - 1);
  56154. }
  56155. return str;
  56156. }
  56157. function getInteger(_ref) {
  56158. let {
  56159. data,
  56160. defaultValue,
  56161. validate
  56162. } = _ref;
  56163. if (!data) {
  56164. return defaultValue;
  56165. }
  56166. data = data.trim();
  56167. const n = parseInt(data, 10);
  56168. if (!isNaN(n) && validate(n)) {
  56169. return n;
  56170. }
  56171. return defaultValue;
  56172. }
  56173. function getFloat(_ref2) {
  56174. let {
  56175. data,
  56176. defaultValue,
  56177. validate
  56178. } = _ref2;
  56179. if (!data) {
  56180. return defaultValue;
  56181. }
  56182. data = data.trim();
  56183. const n = parseFloat(data);
  56184. if (!isNaN(n) && validate(n)) {
  56185. return n;
  56186. }
  56187. return defaultValue;
  56188. }
  56189. function getKeyword(_ref3) {
  56190. let {
  56191. data,
  56192. defaultValue,
  56193. validate
  56194. } = _ref3;
  56195. if (!data) {
  56196. return defaultValue;
  56197. }
  56198. data = data.trim();
  56199. if (validate(data)) {
  56200. return data;
  56201. }
  56202. return defaultValue;
  56203. }
  56204. function getStringOption(data, options) {
  56205. return getKeyword({
  56206. data,
  56207. defaultValue: options[0],
  56208. validate: k => options.includes(k)
  56209. });
  56210. }
  56211. function getMeasurement(str) {
  56212. let def = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "0";
  56213. def = def || "0";
  56214. if (!str) {
  56215. return getMeasurement(def);
  56216. }
  56217. const match = str.trim().match(measurementPattern);
  56218. if (!match) {
  56219. return getMeasurement(def);
  56220. }
  56221. const [, valueStr, unit] = match;
  56222. const value = parseFloat(valueStr);
  56223. if (isNaN(value)) {
  56224. return getMeasurement(def);
  56225. }
  56226. if (value === 0) {
  56227. return 0;
  56228. }
  56229. const conv = dimConverters[unit];
  56230. if (conv) {
  56231. return conv(value);
  56232. }
  56233. return value;
  56234. }
  56235. function getRatio(data) {
  56236. if (!data) {
  56237. return {
  56238. num: 1,
  56239. den: 1
  56240. };
  56241. }
  56242. const ratio = data.trim().split(/\s*:\s*/).map(x => parseFloat(x)).filter(x => !isNaN(x));
  56243. if (ratio.length === 1) {
  56244. ratio.push(1);
  56245. }
  56246. if (ratio.length === 0) {
  56247. return {
  56248. num: 1,
  56249. den: 1
  56250. };
  56251. }
  56252. const [num, den] = ratio;
  56253. return {
  56254. num,
  56255. den
  56256. };
  56257. }
  56258. function getRelevant(data) {
  56259. if (!data) {
  56260. return [];
  56261. }
  56262. return data.trim().split(/\s+/).map(e => {
  56263. return {
  56264. excluded: e[0] === "-",
  56265. viewname: e.substring(1)
  56266. };
  56267. });
  56268. }
  56269. function getColor(data) {
  56270. let def = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0, 0];
  56271. let [r, g, b] = def;
  56272. if (!data) {
  56273. return {
  56274. r,
  56275. g,
  56276. b
  56277. };
  56278. }
  56279. 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);
  56280. if (color.length < 3) {
  56281. return {
  56282. r,
  56283. g,
  56284. b
  56285. };
  56286. }
  56287. [r, g, b] = color;
  56288. return {
  56289. r,
  56290. g,
  56291. b
  56292. };
  56293. }
  56294. function getBBox(data) {
  56295. const def = -1;
  56296. if (!data) {
  56297. return {
  56298. x: def,
  56299. y: def,
  56300. width: def,
  56301. height: def
  56302. };
  56303. }
  56304. const bbox = data.trim().split(/\s*,\s*/).map(m => getMeasurement(m, "-1"));
  56305. if (bbox.length < 4 || bbox[2] < 0 || bbox[3] < 0) {
  56306. return {
  56307. x: def,
  56308. y: def,
  56309. width: def,
  56310. height: def
  56311. };
  56312. }
  56313. const [x, y, width, height] = bbox;
  56314. return {
  56315. x,
  56316. y,
  56317. width,
  56318. height
  56319. };
  56320. }
  56321. class HTMLResult {
  56322. static get FAILURE() {
  56323. return (0, _util.shadow)(this, "FAILURE", new HTMLResult(false, null, null, null));
  56324. }
  56325. static get EMPTY() {
  56326. return (0, _util.shadow)(this, "EMPTY", new HTMLResult(true, null, null, null));
  56327. }
  56328. constructor(success, html, bbox, breakNode) {
  56329. this.success = success;
  56330. this.html = html;
  56331. this.bbox = bbox;
  56332. this.breakNode = breakNode;
  56333. }
  56334. isBreak() {
  56335. return !!this.breakNode;
  56336. }
  56337. static breakNode(node) {
  56338. return new HTMLResult(false, null, null, node);
  56339. }
  56340. static success(html) {
  56341. let bbox = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  56342. return new HTMLResult(true, html, bbox, null);
  56343. }
  56344. }
  56345. exports.HTMLResult = HTMLResult;
  56346. /***/ }),
  56347. /* 208 */
  56348. /***/ ((__unused_webpack_module, exports) => {
  56349. "use strict";
  56350. Object.defineProperty(exports, "__esModule", ({
  56351. value: true
  56352. }));
  56353. exports.NamespaceIds = exports.$buildXFAObject = void 0;
  56354. const $buildXFAObject = Symbol();
  56355. exports.$buildXFAObject = $buildXFAObject;
  56356. const NamespaceIds = {
  56357. config: {
  56358. id: 0,
  56359. check: ns => ns.startsWith("http://www.xfa.org/schema/xci/")
  56360. },
  56361. connectionSet: {
  56362. id: 1,
  56363. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-connection-set/")
  56364. },
  56365. datasets: {
  56366. id: 2,
  56367. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-data/")
  56368. },
  56369. form: {
  56370. id: 3,
  56371. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-form/")
  56372. },
  56373. localeSet: {
  56374. id: 4,
  56375. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-locale-set/")
  56376. },
  56377. pdf: {
  56378. id: 5,
  56379. check: ns => ns === "http://ns.adobe.com/xdp/pdf/"
  56380. },
  56381. signature: {
  56382. id: 6,
  56383. check: ns => ns === "http://www.w3.org/2000/09/xmldsig#"
  56384. },
  56385. sourceSet: {
  56386. id: 7,
  56387. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-source-set/")
  56388. },
  56389. stylesheet: {
  56390. id: 8,
  56391. check: ns => ns === "http://www.w3.org/1999/XSL/Transform"
  56392. },
  56393. template: {
  56394. id: 9,
  56395. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-template/")
  56396. },
  56397. xdc: {
  56398. id: 10,
  56399. check: ns => ns.startsWith("http://www.xfa.org/schema/xdc/")
  56400. },
  56401. xdp: {
  56402. id: 11,
  56403. check: ns => ns === "http://ns.adobe.com/xdp/"
  56404. },
  56405. xfdf: {
  56406. id: 12,
  56407. check: ns => ns === "http://ns.adobe.com/xfdf/"
  56408. },
  56409. xhtml: {
  56410. id: 13,
  56411. check: ns => ns === "http://www.w3.org/1999/xhtml"
  56412. },
  56413. xmpmeta: {
  56414. id: 14,
  56415. check: ns => ns === "http://ns.adobe.com/xmpmeta/"
  56416. }
  56417. };
  56418. exports.NamespaceIds = NamespaceIds;
  56419. /***/ }),
  56420. /* 209 */
  56421. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  56422. "use strict";
  56423. Object.defineProperty(exports, "__esModule", ({
  56424. value: true
  56425. }));
  56426. exports.createDataNode = createDataNode;
  56427. exports.searchNode = searchNode;
  56428. var _xfa_object = __w_pdfjs_require__(206);
  56429. var _namespaces = __w_pdfjs_require__(208);
  56430. var _util = __w_pdfjs_require__(2);
  56431. const namePattern = /^[^.[]+/;
  56432. const indexPattern = /^[^\]]+/;
  56433. const operators = {
  56434. dot: 0,
  56435. dotDot: 1,
  56436. dotHash: 2,
  56437. dotBracket: 3,
  56438. dotParen: 4
  56439. };
  56440. 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]]);
  56441. const somCache = new WeakMap();
  56442. const NS_DATASETS = _namespaces.NamespaceIds.datasets.id;
  56443. function parseIndex(index) {
  56444. index = index.trim();
  56445. if (index === "*") {
  56446. return Infinity;
  56447. }
  56448. return parseInt(index, 10) || 0;
  56449. }
  56450. function parseExpression(expr, dotDotAllowed) {
  56451. let noExpr = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
  56452. let match = expr.match(namePattern);
  56453. if (!match) {
  56454. return null;
  56455. }
  56456. let [name] = match;
  56457. const parsed = [{
  56458. name,
  56459. cacheName: "." + name,
  56460. index: 0,
  56461. js: null,
  56462. formCalc: null,
  56463. operator: operators.dot
  56464. }];
  56465. let pos = name.length;
  56466. while (pos < expr.length) {
  56467. const spos = pos;
  56468. const char = expr.charAt(pos++);
  56469. if (char === "[") {
  56470. match = expr.slice(pos).match(indexPattern);
  56471. if (!match) {
  56472. (0, _util.warn)("XFA - Invalid index in SOM expression");
  56473. return null;
  56474. }
  56475. parsed.at(-1).index = parseIndex(match[0]);
  56476. pos += match[0].length + 1;
  56477. continue;
  56478. }
  56479. let operator;
  56480. switch (expr.charAt(pos)) {
  56481. case ".":
  56482. if (!dotDotAllowed) {
  56483. return null;
  56484. }
  56485. pos++;
  56486. operator = operators.dotDot;
  56487. break;
  56488. case "#":
  56489. pos++;
  56490. operator = operators.dotHash;
  56491. break;
  56492. case "[":
  56493. if (noExpr) {
  56494. (0, _util.warn)("XFA - SOM expression contains a FormCalc subexpression which is not supported for now.");
  56495. return null;
  56496. }
  56497. operator = operators.dotBracket;
  56498. break;
  56499. case "(":
  56500. if (noExpr) {
  56501. (0, _util.warn)("XFA - SOM expression contains a JavaScript subexpression which is not supported for now.");
  56502. return null;
  56503. }
  56504. operator = operators.dotParen;
  56505. break;
  56506. default:
  56507. operator = operators.dot;
  56508. break;
  56509. }
  56510. match = expr.slice(pos).match(namePattern);
  56511. if (!match) {
  56512. break;
  56513. }
  56514. [name] = match;
  56515. pos += name.length;
  56516. parsed.push({
  56517. name,
  56518. cacheName: expr.slice(spos, pos),
  56519. operator,
  56520. index: 0,
  56521. js: null,
  56522. formCalc: null
  56523. });
  56524. }
  56525. return parsed;
  56526. }
  56527. function searchNode(root, container, expr) {
  56528. let dotDotAllowed = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
  56529. let useCache = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
  56530. const parsed = parseExpression(expr, dotDotAllowed);
  56531. if (!parsed) {
  56532. return null;
  56533. }
  56534. const fn = shortcuts.get(parsed[0].name);
  56535. let i = 0;
  56536. let isQualified;
  56537. if (fn) {
  56538. isQualified = true;
  56539. root = [fn(root, container)];
  56540. i = 1;
  56541. } else {
  56542. isQualified = container === null;
  56543. root = [container || root];
  56544. }
  56545. for (let ii = parsed.length; i < ii; i++) {
  56546. const {
  56547. name,
  56548. cacheName,
  56549. operator,
  56550. index
  56551. } = parsed[i];
  56552. const nodes = [];
  56553. for (const node of root) {
  56554. if (!(node instanceof _xfa_object.XFAObject)) {
  56555. continue;
  56556. }
  56557. let children, cached;
  56558. if (useCache) {
  56559. cached = somCache.get(node);
  56560. if (!cached) {
  56561. cached = new Map();
  56562. somCache.set(node, cached);
  56563. }
  56564. children = cached.get(cacheName);
  56565. }
  56566. if (!children) {
  56567. switch (operator) {
  56568. case operators.dot:
  56569. children = node[_xfa_object.$getChildrenByName](name, false);
  56570. break;
  56571. case operators.dotDot:
  56572. children = node[_xfa_object.$getChildrenByName](name, true);
  56573. break;
  56574. case operators.dotHash:
  56575. children = node[_xfa_object.$getChildrenByClass](name);
  56576. if (children instanceof _xfa_object.XFAObjectArray) {
  56577. children = children.children;
  56578. } else {
  56579. children = [children];
  56580. }
  56581. break;
  56582. default:
  56583. break;
  56584. }
  56585. if (useCache) {
  56586. cached.set(cacheName, children);
  56587. }
  56588. }
  56589. if (children.length > 0) {
  56590. nodes.push(children);
  56591. }
  56592. }
  56593. if (nodes.length === 0 && !isQualified && i === 0) {
  56594. const parent = container[_xfa_object.$getParent]();
  56595. container = parent;
  56596. if (!container) {
  56597. return null;
  56598. }
  56599. i = -1;
  56600. root = [container];
  56601. continue;
  56602. }
  56603. if (isFinite(index)) {
  56604. root = nodes.filter(node => index < node.length).map(node => node[index]);
  56605. } else {
  56606. root = nodes.flat();
  56607. }
  56608. }
  56609. if (root.length === 0) {
  56610. return null;
  56611. }
  56612. return root;
  56613. }
  56614. function createNodes(root, path) {
  56615. let node = null;
  56616. for (const {
  56617. name,
  56618. index
  56619. } of path) {
  56620. for (let i = 0, ii = !isFinite(index) ? 0 : index; i <= ii; i++) {
  56621. const nsId = root[_xfa_object.$namespaceId] === NS_DATASETS ? -1 : root[_xfa_object.$namespaceId];
  56622. node = new _xfa_object.XmlObject(nsId, name);
  56623. root[_xfa_object.$appendChild](node);
  56624. }
  56625. root = node;
  56626. }
  56627. return node;
  56628. }
  56629. function createDataNode(root, container, expr) {
  56630. const parsed = parseExpression(expr);
  56631. if (!parsed) {
  56632. return null;
  56633. }
  56634. if (parsed.some(x => x.operator === operators.dotDot)) {
  56635. return null;
  56636. }
  56637. const fn = shortcuts.get(parsed[0].name);
  56638. let i = 0;
  56639. if (fn) {
  56640. root = fn(root, container);
  56641. i = 1;
  56642. } else {
  56643. root = container || root;
  56644. }
  56645. for (let ii = parsed.length; i < ii; i++) {
  56646. const {
  56647. name,
  56648. operator,
  56649. index
  56650. } = parsed[i];
  56651. if (!isFinite(index)) {
  56652. parsed[i].index = 0;
  56653. return createNodes(root, parsed.slice(i));
  56654. }
  56655. let children;
  56656. switch (operator) {
  56657. case operators.dot:
  56658. children = root[_xfa_object.$getChildrenByName](name, false);
  56659. break;
  56660. case operators.dotDot:
  56661. children = root[_xfa_object.$getChildrenByName](name, true);
  56662. break;
  56663. case operators.dotHash:
  56664. children = root[_xfa_object.$getChildrenByClass](name);
  56665. if (children instanceof _xfa_object.XFAObjectArray) {
  56666. children = children.children;
  56667. } else {
  56668. children = [children];
  56669. }
  56670. break;
  56671. default:
  56672. break;
  56673. }
  56674. if (children.length === 0) {
  56675. return createNodes(root, parsed.slice(i));
  56676. }
  56677. if (index < children.length) {
  56678. const child = children[index];
  56679. if (!(child instanceof _xfa_object.XFAObject)) {
  56680. (0, _util.warn)(`XFA - Cannot create a node.`);
  56681. return null;
  56682. }
  56683. root = child;
  56684. } else {
  56685. parsed[i].index = index - children.length;
  56686. return createNodes(root, parsed.slice(i));
  56687. }
  56688. }
  56689. return null;
  56690. }
  56691. /***/ }),
  56692. /* 210 */
  56693. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  56694. "use strict";
  56695. Object.defineProperty(exports, "__esModule", ({
  56696. value: true
  56697. }));
  56698. exports.Binder = void 0;
  56699. var _xfa_object = __w_pdfjs_require__(206);
  56700. var _template = __w_pdfjs_require__(211);
  56701. var _som = __w_pdfjs_require__(209);
  56702. var _namespaces = __w_pdfjs_require__(208);
  56703. var _util = __w_pdfjs_require__(2);
  56704. const NS_DATASETS = _namespaces.NamespaceIds.datasets.id;
  56705. function createText(content) {
  56706. const node = new _template.Text({});
  56707. node[_xfa_object.$content] = content;
  56708. return node;
  56709. }
  56710. class Binder {
  56711. constructor(root) {
  56712. this.root = root;
  56713. this.datasets = root.datasets;
  56714. if (root.datasets && root.datasets.data) {
  56715. this.data = root.datasets.data;
  56716. } else {
  56717. this.data = new _xfa_object.XmlObject(_namespaces.NamespaceIds.datasets.id, "data");
  56718. }
  56719. this.emptyMerge = this.data[_xfa_object.$getChildren]().length === 0;
  56720. this.root.form = this.form = root.template[_xfa_object.$clone]();
  56721. }
  56722. _isConsumeData() {
  56723. return !this.emptyMerge && this._mergeMode;
  56724. }
  56725. _isMatchTemplate() {
  56726. return !this._isConsumeData();
  56727. }
  56728. bind() {
  56729. this._bindElement(this.form, this.data);
  56730. return this.form;
  56731. }
  56732. getData() {
  56733. return this.data;
  56734. }
  56735. _bindValue(formNode, data, picture) {
  56736. formNode[_xfa_object.$data] = data;
  56737. if (formNode[_xfa_object.$hasSettableValue]()) {
  56738. if (data[_xfa_object.$isDataValue]()) {
  56739. const value = data[_xfa_object.$getDataValue]();
  56740. formNode[_xfa_object.$setValue](createText(value));
  56741. } else if (formNode instanceof _template.Field && formNode.ui && formNode.ui.choiceList && formNode.ui.choiceList.open === "multiSelect") {
  56742. const value = data[_xfa_object.$getChildren]().map(child => child[_xfa_object.$content].trim()).join("\n");
  56743. formNode[_xfa_object.$setValue](createText(value));
  56744. } else if (this._isConsumeData()) {
  56745. (0, _util.warn)(`XFA - Nodes haven't the same type.`);
  56746. }
  56747. } else if (!data[_xfa_object.$isDataValue]() || this._isMatchTemplate()) {
  56748. this._bindElement(formNode, data);
  56749. } else {
  56750. (0, _util.warn)(`XFA - Nodes haven't the same type.`);
  56751. }
  56752. }
  56753. _findDataByNameToConsume(name, isValue, dataNode, global) {
  56754. if (!name) {
  56755. return null;
  56756. }
  56757. let generator, match;
  56758. for (let i = 0; i < 3; i++) {
  56759. generator = dataNode[_xfa_object.$getRealChildrenByNameIt](name, false, true);
  56760. while (true) {
  56761. match = generator.next().value;
  56762. if (!match) {
  56763. break;
  56764. }
  56765. if (isValue === match[_xfa_object.$isDataValue]()) {
  56766. return match;
  56767. }
  56768. }
  56769. if (dataNode[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.datasets.id && dataNode[_xfa_object.$nodeName] === "data") {
  56770. break;
  56771. }
  56772. dataNode = dataNode[_xfa_object.$getParent]();
  56773. }
  56774. if (!global) {
  56775. return null;
  56776. }
  56777. generator = this.data[_xfa_object.$getRealChildrenByNameIt](name, true, false);
  56778. match = generator.next().value;
  56779. if (match) {
  56780. return match;
  56781. }
  56782. generator = this.data[_xfa_object.$getAttributeIt](name, true);
  56783. match = generator.next().value;
  56784. if (match && match[_xfa_object.$isDataValue]()) {
  56785. return match;
  56786. }
  56787. return null;
  56788. }
  56789. _setProperties(formNode, dataNode) {
  56790. if (!formNode.hasOwnProperty("setProperty")) {
  56791. return;
  56792. }
  56793. for (const {
  56794. ref,
  56795. target,
  56796. connection
  56797. } of formNode.setProperty.children) {
  56798. if (connection) {
  56799. continue;
  56800. }
  56801. if (!ref) {
  56802. continue;
  56803. }
  56804. const nodes = (0, _som.searchNode)(this.root, dataNode, ref, false, false);
  56805. if (!nodes) {
  56806. (0, _util.warn)(`XFA - Invalid reference: ${ref}.`);
  56807. continue;
  56808. }
  56809. const [node] = nodes;
  56810. if (!node[_xfa_object.$isDescendent](this.data)) {
  56811. (0, _util.warn)(`XFA - Invalid node: must be a data node.`);
  56812. continue;
  56813. }
  56814. const targetNodes = (0, _som.searchNode)(this.root, formNode, target, false, false);
  56815. if (!targetNodes) {
  56816. (0, _util.warn)(`XFA - Invalid target: ${target}.`);
  56817. continue;
  56818. }
  56819. const [targetNode] = targetNodes;
  56820. if (!targetNode[_xfa_object.$isDescendent](formNode)) {
  56821. (0, _util.warn)(`XFA - Invalid target: must be a property or subproperty.`);
  56822. continue;
  56823. }
  56824. const targetParent = targetNode[_xfa_object.$getParent]();
  56825. if (targetNode instanceof _template.SetProperty || targetParent instanceof _template.SetProperty) {
  56826. (0, _util.warn)(`XFA - Invalid target: cannot be a setProperty or one of its properties.`);
  56827. continue;
  56828. }
  56829. if (targetNode instanceof _template.BindItems || targetParent instanceof _template.BindItems) {
  56830. (0, _util.warn)(`XFA - Invalid target: cannot be a bindItems or one of its properties.`);
  56831. continue;
  56832. }
  56833. const content = node[_xfa_object.$text]();
  56834. const name = targetNode[_xfa_object.$nodeName];
  56835. if (targetNode instanceof _xfa_object.XFAAttribute) {
  56836. const attrs = Object.create(null);
  56837. attrs[name] = content;
  56838. const obj = Reflect.construct(Object.getPrototypeOf(targetParent).constructor, [attrs]);
  56839. targetParent[name] = obj[name];
  56840. continue;
  56841. }
  56842. if (!targetNode.hasOwnProperty(_xfa_object.$content)) {
  56843. (0, _util.warn)(`XFA - Invalid node to use in setProperty`);
  56844. continue;
  56845. }
  56846. targetNode[_xfa_object.$data] = node;
  56847. targetNode[_xfa_object.$content] = content;
  56848. targetNode[_xfa_object.$finalize]();
  56849. }
  56850. }
  56851. _bindItems(formNode, dataNode) {
  56852. if (!formNode.hasOwnProperty("items") || !formNode.hasOwnProperty("bindItems") || formNode.bindItems.isEmpty()) {
  56853. return;
  56854. }
  56855. for (const item of formNode.items.children) {
  56856. formNode[_xfa_object.$removeChild](item);
  56857. }
  56858. formNode.items.clear();
  56859. const labels = new _template.Items({});
  56860. const values = new _template.Items({});
  56861. formNode[_xfa_object.$appendChild](labels);
  56862. formNode.items.push(labels);
  56863. formNode[_xfa_object.$appendChild](values);
  56864. formNode.items.push(values);
  56865. for (const {
  56866. ref,
  56867. labelRef,
  56868. valueRef,
  56869. connection
  56870. } of formNode.bindItems.children) {
  56871. if (connection) {
  56872. continue;
  56873. }
  56874. if (!ref) {
  56875. continue;
  56876. }
  56877. const nodes = (0, _som.searchNode)(this.root, dataNode, ref, false, false);
  56878. if (!nodes) {
  56879. (0, _util.warn)(`XFA - Invalid reference: ${ref}.`);
  56880. continue;
  56881. }
  56882. for (const node of nodes) {
  56883. if (!node[_xfa_object.$isDescendent](this.datasets)) {
  56884. (0, _util.warn)(`XFA - Invalid ref (${ref}): must be a datasets child.`);
  56885. continue;
  56886. }
  56887. const labelNodes = (0, _som.searchNode)(this.root, node, labelRef, true, false);
  56888. if (!labelNodes) {
  56889. (0, _util.warn)(`XFA - Invalid label: ${labelRef}.`);
  56890. continue;
  56891. }
  56892. const [labelNode] = labelNodes;
  56893. if (!labelNode[_xfa_object.$isDescendent](this.datasets)) {
  56894. (0, _util.warn)(`XFA - Invalid label: must be a datasets child.`);
  56895. continue;
  56896. }
  56897. const valueNodes = (0, _som.searchNode)(this.root, node, valueRef, true, false);
  56898. if (!valueNodes) {
  56899. (0, _util.warn)(`XFA - Invalid value: ${valueRef}.`);
  56900. continue;
  56901. }
  56902. const [valueNode] = valueNodes;
  56903. if (!valueNode[_xfa_object.$isDescendent](this.datasets)) {
  56904. (0, _util.warn)(`XFA - Invalid value: must be a datasets child.`);
  56905. continue;
  56906. }
  56907. const label = createText(labelNode[_xfa_object.$text]());
  56908. const value = createText(valueNode[_xfa_object.$text]());
  56909. labels[_xfa_object.$appendChild](label);
  56910. labels.text.push(label);
  56911. values[_xfa_object.$appendChild](value);
  56912. values.text.push(value);
  56913. }
  56914. }
  56915. }
  56916. _bindOccurrences(formNode, matches, picture) {
  56917. let baseClone;
  56918. if (matches.length > 1) {
  56919. baseClone = formNode[_xfa_object.$clone]();
  56920. baseClone[_xfa_object.$removeChild](baseClone.occur);
  56921. baseClone.occur = null;
  56922. }
  56923. this._bindValue(formNode, matches[0], picture);
  56924. this._setProperties(formNode, matches[0]);
  56925. this._bindItems(formNode, matches[0]);
  56926. if (matches.length === 1) {
  56927. return;
  56928. }
  56929. const parent = formNode[_xfa_object.$getParent]();
  56930. const name = formNode[_xfa_object.$nodeName];
  56931. const pos = parent[_xfa_object.$indexOf](formNode);
  56932. for (let i = 1, ii = matches.length; i < ii; i++) {
  56933. const match = matches[i];
  56934. const clone = baseClone[_xfa_object.$clone]();
  56935. parent[name].push(clone);
  56936. parent[_xfa_object.$insertAt](pos + i, clone);
  56937. this._bindValue(clone, match, picture);
  56938. this._setProperties(clone, match);
  56939. this._bindItems(clone, match);
  56940. }
  56941. }
  56942. _createOccurrences(formNode) {
  56943. if (!this.emptyMerge) {
  56944. return;
  56945. }
  56946. const {
  56947. occur
  56948. } = formNode;
  56949. if (!occur || occur.initial <= 1) {
  56950. return;
  56951. }
  56952. const parent = formNode[_xfa_object.$getParent]();
  56953. const name = formNode[_xfa_object.$nodeName];
  56954. if (!(parent[name] instanceof _xfa_object.XFAObjectArray)) {
  56955. return;
  56956. }
  56957. let currentNumber;
  56958. if (formNode.name) {
  56959. currentNumber = parent[name].children.filter(e => e.name === formNode.name).length;
  56960. } else {
  56961. currentNumber = parent[name].children.length;
  56962. }
  56963. const pos = parent[_xfa_object.$indexOf](formNode) + 1;
  56964. const ii = occur.initial - currentNumber;
  56965. if (ii) {
  56966. const nodeClone = formNode[_xfa_object.$clone]();
  56967. nodeClone[_xfa_object.$removeChild](nodeClone.occur);
  56968. nodeClone.occur = null;
  56969. parent[name].push(nodeClone);
  56970. parent[_xfa_object.$insertAt](pos, nodeClone);
  56971. for (let i = 1; i < ii; i++) {
  56972. const clone = nodeClone[_xfa_object.$clone]();
  56973. parent[name].push(clone);
  56974. parent[_xfa_object.$insertAt](pos + i, clone);
  56975. }
  56976. }
  56977. }
  56978. _getOccurInfo(formNode) {
  56979. const {
  56980. name,
  56981. occur
  56982. } = formNode;
  56983. if (!occur || !name) {
  56984. return [1, 1];
  56985. }
  56986. const max = occur.max === -1 ? Infinity : occur.max;
  56987. return [occur.min, max];
  56988. }
  56989. _setAndBind(formNode, dataNode) {
  56990. this._setProperties(formNode, dataNode);
  56991. this._bindItems(formNode, dataNode);
  56992. this._bindElement(formNode, dataNode);
  56993. }
  56994. _bindElement(formNode, dataNode) {
  56995. const uselessNodes = [];
  56996. this._createOccurrences(formNode);
  56997. for (const child of formNode[_xfa_object.$getChildren]()) {
  56998. if (child[_xfa_object.$data]) {
  56999. continue;
  57000. }
  57001. if (this._mergeMode === undefined && child[_xfa_object.$nodeName] === "subform") {
  57002. this._mergeMode = child.mergeMode === "consumeData";
  57003. const dataChildren = dataNode[_xfa_object.$getChildren]();
  57004. if (dataChildren.length > 0) {
  57005. this._bindOccurrences(child, [dataChildren[0]], null);
  57006. } else if (this.emptyMerge) {
  57007. const nsId = dataNode[_xfa_object.$namespaceId] === NS_DATASETS ? -1 : dataNode[_xfa_object.$namespaceId];
  57008. const dataChild = child[_xfa_object.$data] = new _xfa_object.XmlObject(nsId, child.name || "root");
  57009. dataNode[_xfa_object.$appendChild](dataChild);
  57010. this._bindElement(child, dataChild);
  57011. }
  57012. continue;
  57013. }
  57014. if (!child[_xfa_object.$isBindable]()) {
  57015. continue;
  57016. }
  57017. let global = false;
  57018. let picture = null;
  57019. let ref = null;
  57020. let match = null;
  57021. if (child.bind) {
  57022. switch (child.bind.match) {
  57023. case "none":
  57024. this._setAndBind(child, dataNode);
  57025. continue;
  57026. case "global":
  57027. global = true;
  57028. break;
  57029. case "dataRef":
  57030. if (!child.bind.ref) {
  57031. (0, _util.warn)(`XFA - ref is empty in node ${child[_xfa_object.$nodeName]}.`);
  57032. this._setAndBind(child, dataNode);
  57033. continue;
  57034. }
  57035. ref = child.bind.ref;
  57036. break;
  57037. default:
  57038. break;
  57039. }
  57040. if (child.bind.picture) {
  57041. picture = child.bind.picture[_xfa_object.$content];
  57042. }
  57043. }
  57044. const [min, max] = this._getOccurInfo(child);
  57045. if (ref) {
  57046. match = (0, _som.searchNode)(this.root, dataNode, ref, true, false);
  57047. if (match === null) {
  57048. match = (0, _som.createDataNode)(this.data, dataNode, ref);
  57049. if (!match) {
  57050. continue;
  57051. }
  57052. if (this._isConsumeData()) {
  57053. match[_xfa_object.$consumed] = true;
  57054. }
  57055. this._setAndBind(child, match);
  57056. continue;
  57057. } else {
  57058. if (this._isConsumeData()) {
  57059. match = match.filter(node => !node[_xfa_object.$consumed]);
  57060. }
  57061. if (match.length > max) {
  57062. match = match.slice(0, max);
  57063. } else if (match.length === 0) {
  57064. match = null;
  57065. }
  57066. if (match && this._isConsumeData()) {
  57067. match.forEach(node => {
  57068. node[_xfa_object.$consumed] = true;
  57069. });
  57070. }
  57071. }
  57072. } else {
  57073. if (!child.name) {
  57074. this._setAndBind(child, dataNode);
  57075. continue;
  57076. }
  57077. if (this._isConsumeData()) {
  57078. const matches = [];
  57079. while (matches.length < max) {
  57080. const found = this._findDataByNameToConsume(child.name, child[_xfa_object.$hasSettableValue](), dataNode, global);
  57081. if (!found) {
  57082. break;
  57083. }
  57084. found[_xfa_object.$consumed] = true;
  57085. matches.push(found);
  57086. }
  57087. match = matches.length > 0 ? matches : null;
  57088. } else {
  57089. match = dataNode[_xfa_object.$getRealChildrenByNameIt](child.name, false, this.emptyMerge).next().value;
  57090. if (!match) {
  57091. if (min === 0) {
  57092. uselessNodes.push(child);
  57093. continue;
  57094. }
  57095. const nsId = dataNode[_xfa_object.$namespaceId] === NS_DATASETS ? -1 : dataNode[_xfa_object.$namespaceId];
  57096. match = child[_xfa_object.$data] = new _xfa_object.XmlObject(nsId, child.name);
  57097. if (this.emptyMerge) {
  57098. match[_xfa_object.$consumed] = true;
  57099. }
  57100. dataNode[_xfa_object.$appendChild](match);
  57101. this._setAndBind(child, match);
  57102. continue;
  57103. }
  57104. if (this.emptyMerge) {
  57105. match[_xfa_object.$consumed] = true;
  57106. }
  57107. match = [match];
  57108. }
  57109. }
  57110. if (match) {
  57111. this._bindOccurrences(child, match, picture);
  57112. } else if (min > 0) {
  57113. this._setAndBind(child, dataNode);
  57114. } else {
  57115. uselessNodes.push(child);
  57116. }
  57117. }
  57118. uselessNodes.forEach(node => node[_xfa_object.$getParent]()[_xfa_object.$removeChild](node));
  57119. }
  57120. }
  57121. exports.Binder = Binder;
  57122. /***/ }),
  57123. /* 211 */
  57124. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  57125. "use strict";
  57126. Object.defineProperty(exports, "__esModule", ({
  57127. value: true
  57128. }));
  57129. exports.Value = exports.Text = exports.TemplateNamespace = exports.Template = exports.SetProperty = exports.Items = exports.Field = exports.BindItems = void 0;
  57130. var _xfa_object = __w_pdfjs_require__(206);
  57131. var _namespaces = __w_pdfjs_require__(208);
  57132. var _layout = __w_pdfjs_require__(212);
  57133. var _html_utils = __w_pdfjs_require__(213);
  57134. var _utils = __w_pdfjs_require__(207);
  57135. var _util = __w_pdfjs_require__(2);
  57136. var _fonts = __w_pdfjs_require__(214);
  57137. var _core_utils = __w_pdfjs_require__(135);
  57138. var _som = __w_pdfjs_require__(209);
  57139. const TEMPLATE_NS_ID = _namespaces.NamespaceIds.template.id;
  57140. const SVG_NS = "http://www.w3.org/2000/svg";
  57141. const MAX_ATTEMPTS_FOR_LRTB_LAYOUT = 2;
  57142. const MAX_EMPTY_PAGES = 3;
  57143. const DEFAULT_TAB_INDEX = 5000;
  57144. const HEADING_PATTERN = /^H(\d+)$/;
  57145. 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"]);
  57146. 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"]];
  57147. function getBorderDims(node) {
  57148. if (!node || !node.border) {
  57149. return {
  57150. w: 0,
  57151. h: 0
  57152. };
  57153. }
  57154. const borderExtra = node.border[_xfa_object.$getExtra]();
  57155. if (!borderExtra) {
  57156. return {
  57157. w: 0,
  57158. h: 0
  57159. };
  57160. }
  57161. return {
  57162. w: borderExtra.widths[0] + borderExtra.widths[2] + borderExtra.insets[0] + borderExtra.insets[2],
  57163. h: borderExtra.widths[1] + borderExtra.widths[3] + borderExtra.insets[1] + borderExtra.insets[3]
  57164. };
  57165. }
  57166. function hasMargin(node) {
  57167. return node.margin && (node.margin.topInset || node.margin.rightInset || node.margin.bottomInset || node.margin.leftInset);
  57168. }
  57169. function _setValue(templateNode, value) {
  57170. if (!templateNode.value) {
  57171. const nodeValue = new Value({});
  57172. templateNode[_xfa_object.$appendChild](nodeValue);
  57173. templateNode.value = nodeValue;
  57174. }
  57175. templateNode.value[_xfa_object.$setValue](value);
  57176. }
  57177. function* getContainedChildren(node) {
  57178. for (const child of node[_xfa_object.$getChildren]()) {
  57179. if (child instanceof SubformSet) {
  57180. yield* child[_xfa_object.$getContainedChildren]();
  57181. continue;
  57182. }
  57183. yield child;
  57184. }
  57185. }
  57186. function isRequired(node) {
  57187. return node.validate && node.validate.nullTest === "error";
  57188. }
  57189. function setTabIndex(node) {
  57190. while (node) {
  57191. if (!node.traversal) {
  57192. node[_xfa_object.$tabIndex] = node[_xfa_object.$getParent]()[_xfa_object.$tabIndex];
  57193. return;
  57194. }
  57195. if (node[_xfa_object.$tabIndex]) {
  57196. return;
  57197. }
  57198. let next = null;
  57199. for (const child of node.traversal[_xfa_object.$getChildren]()) {
  57200. if (child.operation === "next") {
  57201. next = child;
  57202. break;
  57203. }
  57204. }
  57205. if (!next || !next.ref) {
  57206. node[_xfa_object.$tabIndex] = node[_xfa_object.$getParent]()[_xfa_object.$tabIndex];
  57207. return;
  57208. }
  57209. const root = node[_xfa_object.$getTemplateRoot]();
  57210. node[_xfa_object.$tabIndex] = ++root[_xfa_object.$tabIndex];
  57211. const ref = root[_xfa_object.$searchNode](next.ref, node);
  57212. if (!ref) {
  57213. return;
  57214. }
  57215. node = ref[0];
  57216. }
  57217. }
  57218. function applyAssist(obj, attributes) {
  57219. const assist = obj.assist;
  57220. if (assist) {
  57221. const assistTitle = assist[_xfa_object.$toHTML]();
  57222. if (assistTitle) {
  57223. attributes.title = assistTitle;
  57224. }
  57225. const role = assist.role;
  57226. const match = role.match(HEADING_PATTERN);
  57227. if (match) {
  57228. const ariaRole = "heading";
  57229. const ariaLevel = match[1];
  57230. attributes.role = ariaRole;
  57231. attributes["aria-level"] = ariaLevel;
  57232. }
  57233. }
  57234. if (obj.layout === "table") {
  57235. attributes.role = "table";
  57236. } else if (obj.layout === "row") {
  57237. attributes.role = "row";
  57238. } else {
  57239. const parent = obj[_xfa_object.$getParent]();
  57240. if (parent.layout === "row") {
  57241. if (parent.assist && parent.assist.role === "TH") {
  57242. attributes.role = "columnheader";
  57243. } else {
  57244. attributes.role = "cell";
  57245. }
  57246. }
  57247. }
  57248. }
  57249. function ariaLabel(obj) {
  57250. if (!obj.assist) {
  57251. return null;
  57252. }
  57253. const assist = obj.assist;
  57254. if (assist.speak && assist.speak[_xfa_object.$content] !== "") {
  57255. return assist.speak[_xfa_object.$content];
  57256. }
  57257. if (assist.toolTip) {
  57258. return assist.toolTip[_xfa_object.$content];
  57259. }
  57260. return null;
  57261. }
  57262. function valueToHtml(value) {
  57263. return _utils.HTMLResult.success({
  57264. name: "div",
  57265. attributes: {
  57266. class: ["xfaRich"],
  57267. style: Object.create(null)
  57268. },
  57269. children: [{
  57270. name: "span",
  57271. attributes: {
  57272. style: Object.create(null)
  57273. },
  57274. value
  57275. }]
  57276. });
  57277. }
  57278. function setFirstUnsplittable(node) {
  57279. const root = node[_xfa_object.$getTemplateRoot]();
  57280. if (root[_xfa_object.$extra].firstUnsplittable === null) {
  57281. root[_xfa_object.$extra].firstUnsplittable = node;
  57282. root[_xfa_object.$extra].noLayoutFailure = true;
  57283. }
  57284. }
  57285. function unsetFirstUnsplittable(node) {
  57286. const root = node[_xfa_object.$getTemplateRoot]();
  57287. if (root[_xfa_object.$extra].firstUnsplittable === node) {
  57288. root[_xfa_object.$extra].noLayoutFailure = false;
  57289. }
  57290. }
  57291. function handleBreak(node) {
  57292. if (node[_xfa_object.$extra]) {
  57293. return false;
  57294. }
  57295. node[_xfa_object.$extra] = Object.create(null);
  57296. if (node.targetType === "auto") {
  57297. return false;
  57298. }
  57299. const root = node[_xfa_object.$getTemplateRoot]();
  57300. let target = null;
  57301. if (node.target) {
  57302. target = root[_xfa_object.$searchNode](node.target, node[_xfa_object.$getParent]());
  57303. if (!target) {
  57304. return false;
  57305. }
  57306. target = target[0];
  57307. }
  57308. const {
  57309. currentPageArea,
  57310. currentContentArea
  57311. } = root[_xfa_object.$extra];
  57312. if (node.targetType === "pageArea") {
  57313. if (!(target instanceof PageArea)) {
  57314. target = null;
  57315. }
  57316. if (node.startNew) {
  57317. node[_xfa_object.$extra].target = target || currentPageArea;
  57318. return true;
  57319. } else if (target && target !== currentPageArea) {
  57320. node[_xfa_object.$extra].target = target;
  57321. return true;
  57322. }
  57323. return false;
  57324. }
  57325. if (!(target instanceof ContentArea)) {
  57326. target = null;
  57327. }
  57328. const pageArea = target && target[_xfa_object.$getParent]();
  57329. let index;
  57330. let nextPageArea = pageArea;
  57331. if (node.startNew) {
  57332. if (target) {
  57333. const contentAreas = pageArea.contentArea.children;
  57334. const indexForCurrent = contentAreas.indexOf(currentContentArea);
  57335. const indexForTarget = contentAreas.indexOf(target);
  57336. if (indexForCurrent !== -1 && indexForCurrent < indexForTarget) {
  57337. nextPageArea = null;
  57338. }
  57339. index = indexForTarget - 1;
  57340. } else {
  57341. index = currentPageArea.contentArea.children.indexOf(currentContentArea);
  57342. }
  57343. } else if (target && target !== currentContentArea) {
  57344. const contentAreas = pageArea.contentArea.children;
  57345. index = contentAreas.indexOf(target) - 1;
  57346. nextPageArea = pageArea === currentPageArea ? null : pageArea;
  57347. } else {
  57348. return false;
  57349. }
  57350. node[_xfa_object.$extra].target = nextPageArea;
  57351. node[_xfa_object.$extra].index = index;
  57352. return true;
  57353. }
  57354. function handleOverflow(node, extraNode, space) {
  57355. const root = node[_xfa_object.$getTemplateRoot]();
  57356. const saved = root[_xfa_object.$extra].noLayoutFailure;
  57357. const savedMethod = extraNode[_xfa_object.$getSubformParent];
  57358. extraNode[_xfa_object.$getSubformParent] = () => node;
  57359. root[_xfa_object.$extra].noLayoutFailure = true;
  57360. const res = extraNode[_xfa_object.$toHTML](space);
  57361. node[_xfa_object.$addHTML](res.html, res.bbox);
  57362. root[_xfa_object.$extra].noLayoutFailure = saved;
  57363. extraNode[_xfa_object.$getSubformParent] = savedMethod;
  57364. }
  57365. class AppearanceFilter extends _xfa_object.StringObject {
  57366. constructor(attributes) {
  57367. super(TEMPLATE_NS_ID, "appearanceFilter");
  57368. this.id = attributes.id || "";
  57369. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  57370. this.use = attributes.use || "";
  57371. this.usehref = attributes.usehref || "";
  57372. }
  57373. }
  57374. class Arc extends _xfa_object.XFAObject {
  57375. constructor(attributes) {
  57376. super(TEMPLATE_NS_ID, "arc", true);
  57377. this.circular = (0, _utils.getInteger)({
  57378. data: attributes.circular,
  57379. defaultValue: 0,
  57380. validate: x => x === 1
  57381. });
  57382. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  57383. this.id = attributes.id || "";
  57384. this.startAngle = (0, _utils.getFloat)({
  57385. data: attributes.startAngle,
  57386. defaultValue: 0,
  57387. validate: x => true
  57388. });
  57389. this.sweepAngle = (0, _utils.getFloat)({
  57390. data: attributes.sweepAngle,
  57391. defaultValue: 360,
  57392. validate: x => true
  57393. });
  57394. this.use = attributes.use || "";
  57395. this.usehref = attributes.usehref || "";
  57396. this.edge = null;
  57397. this.fill = null;
  57398. }
  57399. [_xfa_object.$toHTML]() {
  57400. const edge = this.edge || new Edge({});
  57401. const edgeStyle = edge[_xfa_object.$toStyle]();
  57402. const style = Object.create(null);
  57403. if (this.fill && this.fill.presence === "visible") {
  57404. Object.assign(style, this.fill[_xfa_object.$toStyle]());
  57405. } else {
  57406. style.fill = "transparent";
  57407. }
  57408. style.strokeWidth = (0, _html_utils.measureToString)(edge.presence === "visible" ? edge.thickness : 0);
  57409. style.stroke = edgeStyle.color;
  57410. let arc;
  57411. const attributes = {
  57412. xmlns: SVG_NS,
  57413. style: {
  57414. width: "100%",
  57415. height: "100%",
  57416. overflow: "visible"
  57417. }
  57418. };
  57419. if (this.sweepAngle === 360) {
  57420. arc = {
  57421. name: "ellipse",
  57422. attributes: {
  57423. xmlns: SVG_NS,
  57424. cx: "50%",
  57425. cy: "50%",
  57426. rx: "50%",
  57427. ry: "50%",
  57428. style
  57429. }
  57430. };
  57431. } else {
  57432. const startAngle = this.startAngle * Math.PI / 180;
  57433. const sweepAngle = this.sweepAngle * Math.PI / 180;
  57434. const largeArc = this.sweepAngle > 180 ? 1 : 0;
  57435. 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))];
  57436. arc = {
  57437. name: "path",
  57438. attributes: {
  57439. xmlns: SVG_NS,
  57440. d: `M ${x1} ${y1} A 50 50 0 ${largeArc} 0 ${x2} ${y2}`,
  57441. vectorEffect: "non-scaling-stroke",
  57442. style
  57443. }
  57444. };
  57445. Object.assign(attributes, {
  57446. viewBox: "0 0 100 100",
  57447. preserveAspectRatio: "none"
  57448. });
  57449. }
  57450. const svg = {
  57451. name: "svg",
  57452. children: [arc],
  57453. attributes
  57454. };
  57455. const parent = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  57456. if (hasMargin(parent)) {
  57457. return _utils.HTMLResult.success({
  57458. name: "div",
  57459. attributes: {
  57460. style: {
  57461. display: "inline",
  57462. width: "100%",
  57463. height: "100%"
  57464. }
  57465. },
  57466. children: [svg]
  57467. });
  57468. }
  57469. svg.attributes.style.position = "absolute";
  57470. return _utils.HTMLResult.success(svg);
  57471. }
  57472. }
  57473. class Area extends _xfa_object.XFAObject {
  57474. constructor(attributes) {
  57475. super(TEMPLATE_NS_ID, "area", true);
  57476. this.colSpan = (0, _utils.getInteger)({
  57477. data: attributes.colSpan,
  57478. defaultValue: 1,
  57479. validate: n => n >= 1 || n === -1
  57480. });
  57481. this.id = attributes.id || "";
  57482. this.name = attributes.name || "";
  57483. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  57484. this.use = attributes.use || "";
  57485. this.usehref = attributes.usehref || "";
  57486. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  57487. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  57488. this.desc = null;
  57489. this.extras = null;
  57490. this.area = new _xfa_object.XFAObjectArray();
  57491. this.draw = new _xfa_object.XFAObjectArray();
  57492. this.exObject = new _xfa_object.XFAObjectArray();
  57493. this.exclGroup = new _xfa_object.XFAObjectArray();
  57494. this.field = new _xfa_object.XFAObjectArray();
  57495. this.subform = new _xfa_object.XFAObjectArray();
  57496. this.subformSet = new _xfa_object.XFAObjectArray();
  57497. }
  57498. *[_xfa_object.$getContainedChildren]() {
  57499. yield* getContainedChildren(this);
  57500. }
  57501. [_xfa_object.$isTransparent]() {
  57502. return true;
  57503. }
  57504. [_xfa_object.$isBindable]() {
  57505. return true;
  57506. }
  57507. [_xfa_object.$addHTML](html, bbox) {
  57508. const [x, y, w, h] = bbox;
  57509. this[_xfa_object.$extra].width = Math.max(this[_xfa_object.$extra].width, x + w);
  57510. this[_xfa_object.$extra].height = Math.max(this[_xfa_object.$extra].height, y + h);
  57511. this[_xfa_object.$extra].children.push(html);
  57512. }
  57513. [_xfa_object.$getAvailableSpace]() {
  57514. return this[_xfa_object.$extra].availableSpace;
  57515. }
  57516. [_xfa_object.$toHTML](availableSpace) {
  57517. const style = (0, _html_utils.toStyle)(this, "position");
  57518. const attributes = {
  57519. style,
  57520. id: this[_xfa_object.$uid],
  57521. class: ["xfaArea"]
  57522. };
  57523. if ((0, _html_utils.isPrintOnly)(this)) {
  57524. attributes.class.push("xfaPrintOnly");
  57525. }
  57526. if (this.name) {
  57527. attributes.xfaName = this.name;
  57528. }
  57529. const children = [];
  57530. this[_xfa_object.$extra] = {
  57531. children,
  57532. width: 0,
  57533. height: 0,
  57534. availableSpace
  57535. };
  57536. const result = this[_xfa_object.$childrenToHTML]({
  57537. filter: new Set(["area", "draw", "field", "exclGroup", "subform", "subformSet"]),
  57538. include: true
  57539. });
  57540. if (!result.success) {
  57541. if (result.isBreak()) {
  57542. return result;
  57543. }
  57544. delete this[_xfa_object.$extra];
  57545. return _utils.HTMLResult.FAILURE;
  57546. }
  57547. style.width = (0, _html_utils.measureToString)(this[_xfa_object.$extra].width);
  57548. style.height = (0, _html_utils.measureToString)(this[_xfa_object.$extra].height);
  57549. const html = {
  57550. name: "div",
  57551. attributes,
  57552. children
  57553. };
  57554. const bbox = [this.x, this.y, this[_xfa_object.$extra].width, this[_xfa_object.$extra].height];
  57555. delete this[_xfa_object.$extra];
  57556. return _utils.HTMLResult.success(html, bbox);
  57557. }
  57558. }
  57559. class Assist extends _xfa_object.XFAObject {
  57560. constructor(attributes) {
  57561. super(TEMPLATE_NS_ID, "assist", true);
  57562. this.id = attributes.id || "";
  57563. this.role = attributes.role || "";
  57564. this.use = attributes.use || "";
  57565. this.usehref = attributes.usehref || "";
  57566. this.speak = null;
  57567. this.toolTip = null;
  57568. }
  57569. [_xfa_object.$toHTML]() {
  57570. return this.toolTip && this.toolTip[_xfa_object.$content] ? this.toolTip[_xfa_object.$content] : null;
  57571. }
  57572. }
  57573. class Barcode extends _xfa_object.XFAObject {
  57574. constructor(attributes) {
  57575. super(TEMPLATE_NS_ID, "barcode", true);
  57576. this.charEncoding = (0, _utils.getKeyword)({
  57577. data: attributes.charEncoding ? attributes.charEncoding.toLowerCase() : "",
  57578. defaultValue: "",
  57579. 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}/)
  57580. });
  57581. this.checksum = (0, _utils.getStringOption)(attributes.checksum, ["none", "1mod10", "1mod10_1mod11", "2mod10", "auto"]);
  57582. this.dataColumnCount = (0, _utils.getInteger)({
  57583. data: attributes.dataColumnCount,
  57584. defaultValue: -1,
  57585. validate: x => x >= 0
  57586. });
  57587. this.dataLength = (0, _utils.getInteger)({
  57588. data: attributes.dataLength,
  57589. defaultValue: -1,
  57590. validate: x => x >= 0
  57591. });
  57592. this.dataPrep = (0, _utils.getStringOption)(attributes.dataPrep, ["none", "flateCompress"]);
  57593. this.dataRowCount = (0, _utils.getInteger)({
  57594. data: attributes.dataRowCount,
  57595. defaultValue: -1,
  57596. validate: x => x >= 0
  57597. });
  57598. this.endChar = attributes.endChar || "";
  57599. this.errorCorrectionLevel = (0, _utils.getInteger)({
  57600. data: attributes.errorCorrectionLevel,
  57601. defaultValue: -1,
  57602. validate: x => x >= 0 && x <= 8
  57603. });
  57604. this.id = attributes.id || "";
  57605. this.moduleHeight = (0, _utils.getMeasurement)(attributes.moduleHeight, "5mm");
  57606. this.moduleWidth = (0, _utils.getMeasurement)(attributes.moduleWidth, "0.25mm");
  57607. this.printCheckDigit = (0, _utils.getInteger)({
  57608. data: attributes.printCheckDigit,
  57609. defaultValue: 0,
  57610. validate: x => x === 1
  57611. });
  57612. this.rowColumnRatio = (0, _utils.getRatio)(attributes.rowColumnRatio);
  57613. this.startChar = attributes.startChar || "";
  57614. this.textLocation = (0, _utils.getStringOption)(attributes.textLocation, ["below", "above", "aboveEmbedded", "belowEmbedded", "none"]);
  57615. this.truncate = (0, _utils.getInteger)({
  57616. data: attributes.truncate,
  57617. defaultValue: 0,
  57618. validate: x => x === 1
  57619. });
  57620. 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"]);
  57621. this.upsMode = (0, _utils.getStringOption)(attributes.upsMode, ["usCarrier", "internationalCarrier", "secureSymbol", "standardSymbol"]);
  57622. this.use = attributes.use || "";
  57623. this.usehref = attributes.usehref || "";
  57624. this.wideNarrowRatio = (0, _utils.getRatio)(attributes.wideNarrowRatio);
  57625. this.encrypt = null;
  57626. this.extras = null;
  57627. }
  57628. }
  57629. class Bind extends _xfa_object.XFAObject {
  57630. constructor(attributes) {
  57631. super(TEMPLATE_NS_ID, "bind", true);
  57632. this.match = (0, _utils.getStringOption)(attributes.match, ["once", "dataRef", "global", "none"]);
  57633. this.ref = attributes.ref || "";
  57634. this.picture = null;
  57635. }
  57636. }
  57637. class BindItems extends _xfa_object.XFAObject {
  57638. constructor(attributes) {
  57639. super(TEMPLATE_NS_ID, "bindItems");
  57640. this.connection = attributes.connection || "";
  57641. this.labelRef = attributes.labelRef || "";
  57642. this.ref = attributes.ref || "";
  57643. this.valueRef = attributes.valueRef || "";
  57644. }
  57645. }
  57646. exports.BindItems = BindItems;
  57647. class Bookend extends _xfa_object.XFAObject {
  57648. constructor(attributes) {
  57649. super(TEMPLATE_NS_ID, "bookend");
  57650. this.id = attributes.id || "";
  57651. this.leader = attributes.leader || "";
  57652. this.trailer = attributes.trailer || "";
  57653. this.use = attributes.use || "";
  57654. this.usehref = attributes.usehref || "";
  57655. }
  57656. }
  57657. class BooleanElement extends _xfa_object.Option01 {
  57658. constructor(attributes) {
  57659. super(TEMPLATE_NS_ID, "boolean");
  57660. this.id = attributes.id || "";
  57661. this.name = attributes.name || "";
  57662. this.use = attributes.use || "";
  57663. this.usehref = attributes.usehref || "";
  57664. }
  57665. [_xfa_object.$toHTML](availableSpace) {
  57666. return valueToHtml(this[_xfa_object.$content] === 1 ? "1" : "0");
  57667. }
  57668. }
  57669. class Border extends _xfa_object.XFAObject {
  57670. constructor(attributes) {
  57671. super(TEMPLATE_NS_ID, "border", true);
  57672. this.break = (0, _utils.getStringOption)(attributes.break, ["close", "open"]);
  57673. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  57674. this.id = attributes.id || "";
  57675. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  57676. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  57677. this.use = attributes.use || "";
  57678. this.usehref = attributes.usehref || "";
  57679. this.corner = new _xfa_object.XFAObjectArray(4);
  57680. this.edge = new _xfa_object.XFAObjectArray(4);
  57681. this.extras = null;
  57682. this.fill = null;
  57683. this.margin = null;
  57684. }
  57685. [_xfa_object.$getExtra]() {
  57686. if (!this[_xfa_object.$extra]) {
  57687. const edges = this.edge.children.slice();
  57688. if (edges.length < 4) {
  57689. const defaultEdge = edges.at(-1) || new Edge({});
  57690. for (let i = edges.length; i < 4; i++) {
  57691. edges.push(defaultEdge);
  57692. }
  57693. }
  57694. const widths = edges.map(edge => edge.thickness);
  57695. const insets = [0, 0, 0, 0];
  57696. if (this.margin) {
  57697. insets[0] = this.margin.topInset;
  57698. insets[1] = this.margin.rightInset;
  57699. insets[2] = this.margin.bottomInset;
  57700. insets[3] = this.margin.leftInset;
  57701. }
  57702. this[_xfa_object.$extra] = {
  57703. widths,
  57704. insets,
  57705. edges
  57706. };
  57707. }
  57708. return this[_xfa_object.$extra];
  57709. }
  57710. [_xfa_object.$toStyle]() {
  57711. const {
  57712. edges
  57713. } = this[_xfa_object.$getExtra]();
  57714. const edgeStyles = edges.map(node => {
  57715. const style = node[_xfa_object.$toStyle]();
  57716. style.color = style.color || "#000000";
  57717. return style;
  57718. });
  57719. const style = Object.create(null);
  57720. if (this.margin) {
  57721. Object.assign(style, this.margin[_xfa_object.$toStyle]());
  57722. }
  57723. if (this.fill && this.fill.presence === "visible") {
  57724. Object.assign(style, this.fill[_xfa_object.$toStyle]());
  57725. }
  57726. if (this.corner.children.some(node => node.radius !== 0)) {
  57727. const cornerStyles = this.corner.children.map(node => node[_xfa_object.$toStyle]());
  57728. if (cornerStyles.length === 2 || cornerStyles.length === 3) {
  57729. const last = cornerStyles.at(-1);
  57730. for (let i = cornerStyles.length; i < 4; i++) {
  57731. cornerStyles.push(last);
  57732. }
  57733. }
  57734. style.borderRadius = cornerStyles.map(s => s.radius).join(" ");
  57735. }
  57736. switch (this.presence) {
  57737. case "invisible":
  57738. case "hidden":
  57739. style.borderStyle = "";
  57740. break;
  57741. case "inactive":
  57742. style.borderStyle = "none";
  57743. break;
  57744. default:
  57745. style.borderStyle = edgeStyles.map(s => s.style).join(" ");
  57746. break;
  57747. }
  57748. style.borderWidth = edgeStyles.map(s => s.width).join(" ");
  57749. style.borderColor = edgeStyles.map(s => s.color).join(" ");
  57750. return style;
  57751. }
  57752. }
  57753. class Break extends _xfa_object.XFAObject {
  57754. constructor(attributes) {
  57755. super(TEMPLATE_NS_ID, "break", true);
  57756. this.after = (0, _utils.getStringOption)(attributes.after, ["auto", "contentArea", "pageArea", "pageEven", "pageOdd"]);
  57757. this.afterTarget = attributes.afterTarget || "";
  57758. this.before = (0, _utils.getStringOption)(attributes.before, ["auto", "contentArea", "pageArea", "pageEven", "pageOdd"]);
  57759. this.beforeTarget = attributes.beforeTarget || "";
  57760. this.bookendLeader = attributes.bookendLeader || "";
  57761. this.bookendTrailer = attributes.bookendTrailer || "";
  57762. this.id = attributes.id || "";
  57763. this.overflowLeader = attributes.overflowLeader || "";
  57764. this.overflowTarget = attributes.overflowTarget || "";
  57765. this.overflowTrailer = attributes.overflowTrailer || "";
  57766. this.startNew = (0, _utils.getInteger)({
  57767. data: attributes.startNew,
  57768. defaultValue: 0,
  57769. validate: x => x === 1
  57770. });
  57771. this.use = attributes.use || "";
  57772. this.usehref = attributes.usehref || "";
  57773. this.extras = null;
  57774. }
  57775. }
  57776. class BreakAfter extends _xfa_object.XFAObject {
  57777. constructor(attributes) {
  57778. super(TEMPLATE_NS_ID, "breakAfter", true);
  57779. this.id = attributes.id || "";
  57780. this.leader = attributes.leader || "";
  57781. this.startNew = (0, _utils.getInteger)({
  57782. data: attributes.startNew,
  57783. defaultValue: 0,
  57784. validate: x => x === 1
  57785. });
  57786. this.target = attributes.target || "";
  57787. this.targetType = (0, _utils.getStringOption)(attributes.targetType, ["auto", "contentArea", "pageArea"]);
  57788. this.trailer = attributes.trailer || "";
  57789. this.use = attributes.use || "";
  57790. this.usehref = attributes.usehref || "";
  57791. this.script = null;
  57792. }
  57793. }
  57794. class BreakBefore extends _xfa_object.XFAObject {
  57795. constructor(attributes) {
  57796. super(TEMPLATE_NS_ID, "breakBefore", true);
  57797. this.id = attributes.id || "";
  57798. this.leader = attributes.leader || "";
  57799. this.startNew = (0, _utils.getInteger)({
  57800. data: attributes.startNew,
  57801. defaultValue: 0,
  57802. validate: x => x === 1
  57803. });
  57804. this.target = attributes.target || "";
  57805. this.targetType = (0, _utils.getStringOption)(attributes.targetType, ["auto", "contentArea", "pageArea"]);
  57806. this.trailer = attributes.trailer || "";
  57807. this.use = attributes.use || "";
  57808. this.usehref = attributes.usehref || "";
  57809. this.script = null;
  57810. }
  57811. [_xfa_object.$toHTML](availableSpace) {
  57812. this[_xfa_object.$extra] = {};
  57813. return _utils.HTMLResult.FAILURE;
  57814. }
  57815. }
  57816. class Button extends _xfa_object.XFAObject {
  57817. constructor(attributes) {
  57818. super(TEMPLATE_NS_ID, "button", true);
  57819. this.highlight = (0, _utils.getStringOption)(attributes.highlight, ["inverted", "none", "outline", "push"]);
  57820. this.id = attributes.id || "";
  57821. this.use = attributes.use || "";
  57822. this.usehref = attributes.usehref || "";
  57823. this.extras = null;
  57824. }
  57825. [_xfa_object.$toHTML](availableSpace) {
  57826. const parent = this[_xfa_object.$getParent]();
  57827. const grandpa = parent[_xfa_object.$getParent]();
  57828. const htmlButton = {
  57829. name: "button",
  57830. attributes: {
  57831. id: this[_xfa_object.$uid],
  57832. class: ["xfaButton"],
  57833. style: {}
  57834. },
  57835. children: []
  57836. };
  57837. for (const event of grandpa.event.children) {
  57838. if (event.activity !== "click" || !event.script) {
  57839. continue;
  57840. }
  57841. const jsURL = (0, _core_utils.recoverJsURL)(event.script[_xfa_object.$content]);
  57842. if (!jsURL) {
  57843. continue;
  57844. }
  57845. const href = (0, _html_utils.fixURL)(jsURL.url);
  57846. if (!href) {
  57847. continue;
  57848. }
  57849. htmlButton.children.push({
  57850. name: "a",
  57851. attributes: {
  57852. id: "link" + this[_xfa_object.$uid],
  57853. href,
  57854. newWindow: jsURL.newWindow,
  57855. class: ["xfaLink"],
  57856. style: {}
  57857. },
  57858. children: []
  57859. });
  57860. }
  57861. return _utils.HTMLResult.success(htmlButton);
  57862. }
  57863. }
  57864. class Calculate extends _xfa_object.XFAObject {
  57865. constructor(attributes) {
  57866. super(TEMPLATE_NS_ID, "calculate", true);
  57867. this.id = attributes.id || "";
  57868. this.override = (0, _utils.getStringOption)(attributes.override, ["disabled", "error", "ignore", "warning"]);
  57869. this.use = attributes.use || "";
  57870. this.usehref = attributes.usehref || "";
  57871. this.extras = null;
  57872. this.message = null;
  57873. this.script = null;
  57874. }
  57875. }
  57876. class Caption extends _xfa_object.XFAObject {
  57877. constructor(attributes) {
  57878. super(TEMPLATE_NS_ID, "caption", true);
  57879. this.id = attributes.id || "";
  57880. this.placement = (0, _utils.getStringOption)(attributes.placement, ["left", "bottom", "inline", "right", "top"]);
  57881. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  57882. this.reserve = Math.ceil((0, _utils.getMeasurement)(attributes.reserve));
  57883. this.use = attributes.use || "";
  57884. this.usehref = attributes.usehref || "";
  57885. this.extras = null;
  57886. this.font = null;
  57887. this.margin = null;
  57888. this.para = null;
  57889. this.value = null;
  57890. }
  57891. [_xfa_object.$setValue](value) {
  57892. _setValue(this, value);
  57893. }
  57894. [_xfa_object.$getExtra](availableSpace) {
  57895. if (!this[_xfa_object.$extra]) {
  57896. let {
  57897. width,
  57898. height
  57899. } = availableSpace;
  57900. switch (this.placement) {
  57901. case "left":
  57902. case "right":
  57903. case "inline":
  57904. width = this.reserve <= 0 ? width : this.reserve;
  57905. break;
  57906. case "top":
  57907. case "bottom":
  57908. height = this.reserve <= 0 ? height : this.reserve;
  57909. break;
  57910. }
  57911. this[_xfa_object.$extra] = (0, _html_utils.layoutNode)(this, {
  57912. width,
  57913. height
  57914. });
  57915. }
  57916. return this[_xfa_object.$extra];
  57917. }
  57918. [_xfa_object.$toHTML](availableSpace) {
  57919. if (!this.value) {
  57920. return _utils.HTMLResult.EMPTY;
  57921. }
  57922. this[_xfa_object.$pushPara]();
  57923. const value = this.value[_xfa_object.$toHTML](availableSpace).html;
  57924. if (!value) {
  57925. this[_xfa_object.$popPara]();
  57926. return _utils.HTMLResult.EMPTY;
  57927. }
  57928. const savedReserve = this.reserve;
  57929. if (this.reserve <= 0) {
  57930. const {
  57931. w,
  57932. h
  57933. } = this[_xfa_object.$getExtra](availableSpace);
  57934. switch (this.placement) {
  57935. case "left":
  57936. case "right":
  57937. case "inline":
  57938. this.reserve = w;
  57939. break;
  57940. case "top":
  57941. case "bottom":
  57942. this.reserve = h;
  57943. break;
  57944. }
  57945. }
  57946. const children = [];
  57947. if (typeof value === "string") {
  57948. children.push({
  57949. name: "#text",
  57950. value
  57951. });
  57952. } else {
  57953. children.push(value);
  57954. }
  57955. const style = (0, _html_utils.toStyle)(this, "font", "margin", "visibility");
  57956. switch (this.placement) {
  57957. case "left":
  57958. case "right":
  57959. if (this.reserve > 0) {
  57960. style.width = (0, _html_utils.measureToString)(this.reserve);
  57961. }
  57962. break;
  57963. case "top":
  57964. case "bottom":
  57965. if (this.reserve > 0) {
  57966. style.height = (0, _html_utils.measureToString)(this.reserve);
  57967. }
  57968. break;
  57969. }
  57970. (0, _html_utils.setPara)(this, null, value);
  57971. this[_xfa_object.$popPara]();
  57972. this.reserve = savedReserve;
  57973. return _utils.HTMLResult.success({
  57974. name: "div",
  57975. attributes: {
  57976. style,
  57977. class: ["xfaCaption"]
  57978. },
  57979. children
  57980. });
  57981. }
  57982. }
  57983. class Certificate extends _xfa_object.StringObject {
  57984. constructor(attributes) {
  57985. super(TEMPLATE_NS_ID, "certificate");
  57986. this.id = attributes.id || "";
  57987. this.name = attributes.name || "";
  57988. this.use = attributes.use || "";
  57989. this.usehref = attributes.usehref || "";
  57990. }
  57991. }
  57992. class Certificates extends _xfa_object.XFAObject {
  57993. constructor(attributes) {
  57994. super(TEMPLATE_NS_ID, "certificates", true);
  57995. this.credentialServerPolicy = (0, _utils.getStringOption)(attributes.credentialServerPolicy, ["optional", "required"]);
  57996. this.id = attributes.id || "";
  57997. this.url = attributes.url || "";
  57998. this.urlPolicy = attributes.urlPolicy || "";
  57999. this.use = attributes.use || "";
  58000. this.usehref = attributes.usehref || "";
  58001. this.encryption = null;
  58002. this.issuers = null;
  58003. this.keyUsage = null;
  58004. this.oids = null;
  58005. this.signing = null;
  58006. this.subjectDNs = null;
  58007. }
  58008. }
  58009. class CheckButton extends _xfa_object.XFAObject {
  58010. constructor(attributes) {
  58011. super(TEMPLATE_NS_ID, "checkButton", true);
  58012. this.id = attributes.id || "";
  58013. this.mark = (0, _utils.getStringOption)(attributes.mark, ["default", "check", "circle", "cross", "diamond", "square", "star"]);
  58014. this.shape = (0, _utils.getStringOption)(attributes.shape, ["square", "round"]);
  58015. this.size = (0, _utils.getMeasurement)(attributes.size, "10pt");
  58016. this.use = attributes.use || "";
  58017. this.usehref = attributes.usehref || "";
  58018. this.border = null;
  58019. this.extras = null;
  58020. this.margin = null;
  58021. }
  58022. [_xfa_object.$toHTML](availableSpace) {
  58023. const style = (0, _html_utils.toStyle)("margin");
  58024. const size = (0, _html_utils.measureToString)(this.size);
  58025. style.width = style.height = size;
  58026. let type;
  58027. let className;
  58028. let groupId;
  58029. const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  58030. const items = field.items.children.length && field.items.children[0][_xfa_object.$toHTML]().html || [];
  58031. const exportedValue = {
  58032. on: (items[0] !== undefined ? items[0] : "on").toString(),
  58033. off: (items[1] !== undefined ? items[1] : "off").toString()
  58034. };
  58035. const value = field.value && field.value[_xfa_object.$text]() || "off";
  58036. const checked = value === exportedValue.on || undefined;
  58037. const container = field[_xfa_object.$getSubformParent]();
  58038. const fieldId = field[_xfa_object.$uid];
  58039. let dataId;
  58040. if (container instanceof ExclGroup) {
  58041. groupId = container[_xfa_object.$uid];
  58042. type = "radio";
  58043. className = "xfaRadio";
  58044. dataId = container[_xfa_object.$data] && container[_xfa_object.$data][_xfa_object.$uid] || container[_xfa_object.$uid];
  58045. } else {
  58046. type = "checkbox";
  58047. className = "xfaCheckbox";
  58048. dataId = field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid];
  58049. }
  58050. const input = {
  58051. name: "input",
  58052. attributes: {
  58053. class: [className],
  58054. style,
  58055. fieldId,
  58056. dataId,
  58057. type,
  58058. checked,
  58059. xfaOn: exportedValue.on,
  58060. xfaOff: exportedValue.off,
  58061. "aria-label": ariaLabel(field),
  58062. "aria-required": false
  58063. }
  58064. };
  58065. if (groupId) {
  58066. input.attributes.name = groupId;
  58067. }
  58068. if (isRequired(field)) {
  58069. input.attributes["aria-required"] = true;
  58070. input.attributes.required = true;
  58071. }
  58072. return _utils.HTMLResult.success({
  58073. name: "label",
  58074. attributes: {
  58075. class: ["xfaLabel"]
  58076. },
  58077. children: [input]
  58078. });
  58079. }
  58080. }
  58081. class ChoiceList extends _xfa_object.XFAObject {
  58082. constructor(attributes) {
  58083. super(TEMPLATE_NS_ID, "choiceList", true);
  58084. this.commitOn = (0, _utils.getStringOption)(attributes.commitOn, ["select", "exit"]);
  58085. this.id = attributes.id || "";
  58086. this.open = (0, _utils.getStringOption)(attributes.open, ["userControl", "always", "multiSelect", "onEntry"]);
  58087. this.textEntry = (0, _utils.getInteger)({
  58088. data: attributes.textEntry,
  58089. defaultValue: 0,
  58090. validate: x => x === 1
  58091. });
  58092. this.use = attributes.use || "";
  58093. this.usehref = attributes.usehref || "";
  58094. this.border = null;
  58095. this.extras = null;
  58096. this.margin = null;
  58097. }
  58098. [_xfa_object.$toHTML](availableSpace) {
  58099. const style = (0, _html_utils.toStyle)(this, "border", "margin");
  58100. const ui = this[_xfa_object.$getParent]();
  58101. const field = ui[_xfa_object.$getParent]();
  58102. const fontSize = field.font && field.font.size || 10;
  58103. const optionStyle = {
  58104. fontSize: `calc(${fontSize}px * var(--scale-factor))`
  58105. };
  58106. const children = [];
  58107. if (field.items.children.length > 0) {
  58108. const items = field.items;
  58109. let displayedIndex = 0;
  58110. let saveIndex = 0;
  58111. if (items.children.length === 2) {
  58112. displayedIndex = items.children[0].save;
  58113. saveIndex = 1 - displayedIndex;
  58114. }
  58115. const displayed = items.children[displayedIndex][_xfa_object.$toHTML]().html;
  58116. const values = items.children[saveIndex][_xfa_object.$toHTML]().html;
  58117. let selected = false;
  58118. const value = field.value && field.value[_xfa_object.$text]() || "";
  58119. for (let i = 0, ii = displayed.length; i < ii; i++) {
  58120. const option = {
  58121. name: "option",
  58122. attributes: {
  58123. value: values[i] || displayed[i],
  58124. style: optionStyle
  58125. },
  58126. value: displayed[i]
  58127. };
  58128. if (values[i] === value) {
  58129. option.attributes.selected = selected = true;
  58130. }
  58131. children.push(option);
  58132. }
  58133. if (!selected) {
  58134. children.splice(0, 0, {
  58135. name: "option",
  58136. attributes: {
  58137. hidden: true,
  58138. selected: true
  58139. },
  58140. value: " "
  58141. });
  58142. }
  58143. }
  58144. const selectAttributes = {
  58145. class: ["xfaSelect"],
  58146. fieldId: field[_xfa_object.$uid],
  58147. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  58148. style,
  58149. "aria-label": ariaLabel(field),
  58150. "aria-required": false
  58151. };
  58152. if (isRequired(field)) {
  58153. selectAttributes["aria-required"] = true;
  58154. selectAttributes.required = true;
  58155. }
  58156. if (this.open === "multiSelect") {
  58157. selectAttributes.multiple = true;
  58158. }
  58159. return _utils.HTMLResult.success({
  58160. name: "label",
  58161. attributes: {
  58162. class: ["xfaLabel"]
  58163. },
  58164. children: [{
  58165. name: "select",
  58166. children,
  58167. attributes: selectAttributes
  58168. }]
  58169. });
  58170. }
  58171. }
  58172. class Color extends _xfa_object.XFAObject {
  58173. constructor(attributes) {
  58174. super(TEMPLATE_NS_ID, "color", true);
  58175. this.cSpace = (0, _utils.getStringOption)(attributes.cSpace, ["SRGB"]);
  58176. this.id = attributes.id || "";
  58177. this.use = attributes.use || "";
  58178. this.usehref = attributes.usehref || "";
  58179. this.value = attributes.value ? (0, _utils.getColor)(attributes.value) : "";
  58180. this.extras = null;
  58181. }
  58182. [_xfa_object.$hasSettableValue]() {
  58183. return false;
  58184. }
  58185. [_xfa_object.$toStyle]() {
  58186. return this.value ? _util.Util.makeHexColor(this.value.r, this.value.g, this.value.b) : null;
  58187. }
  58188. }
  58189. class Comb extends _xfa_object.XFAObject {
  58190. constructor(attributes) {
  58191. super(TEMPLATE_NS_ID, "comb");
  58192. this.id = attributes.id || "";
  58193. this.numberOfCells = (0, _utils.getInteger)({
  58194. data: attributes.numberOfCells,
  58195. defaultValue: 0,
  58196. validate: x => x >= 0
  58197. });
  58198. this.use = attributes.use || "";
  58199. this.usehref = attributes.usehref || "";
  58200. }
  58201. }
  58202. class Connect extends _xfa_object.XFAObject {
  58203. constructor(attributes) {
  58204. super(TEMPLATE_NS_ID, "connect", true);
  58205. this.connection = attributes.connection || "";
  58206. this.id = attributes.id || "";
  58207. this.ref = attributes.ref || "";
  58208. this.usage = (0, _utils.getStringOption)(attributes.usage, ["exportAndImport", "exportOnly", "importOnly"]);
  58209. this.use = attributes.use || "";
  58210. this.usehref = attributes.usehref || "";
  58211. this.picture = null;
  58212. }
  58213. }
  58214. class ContentArea extends _xfa_object.XFAObject {
  58215. constructor(attributes) {
  58216. super(TEMPLATE_NS_ID, "contentArea", true);
  58217. this.h = (0, _utils.getMeasurement)(attributes.h);
  58218. this.id = attributes.id || "";
  58219. this.name = attributes.name || "";
  58220. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  58221. this.use = attributes.use || "";
  58222. this.usehref = attributes.usehref || "";
  58223. this.w = (0, _utils.getMeasurement)(attributes.w);
  58224. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  58225. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  58226. this.desc = null;
  58227. this.extras = null;
  58228. }
  58229. [_xfa_object.$toHTML](availableSpace) {
  58230. const left = (0, _html_utils.measureToString)(this.x);
  58231. const top = (0, _html_utils.measureToString)(this.y);
  58232. const style = {
  58233. left,
  58234. top,
  58235. width: (0, _html_utils.measureToString)(this.w),
  58236. height: (0, _html_utils.measureToString)(this.h)
  58237. };
  58238. const classNames = ["xfaContentarea"];
  58239. if ((0, _html_utils.isPrintOnly)(this)) {
  58240. classNames.push("xfaPrintOnly");
  58241. }
  58242. return _utils.HTMLResult.success({
  58243. name: "div",
  58244. children: [],
  58245. attributes: {
  58246. style,
  58247. class: classNames,
  58248. id: this[_xfa_object.$uid]
  58249. }
  58250. });
  58251. }
  58252. }
  58253. class Corner extends _xfa_object.XFAObject {
  58254. constructor(attributes) {
  58255. super(TEMPLATE_NS_ID, "corner", true);
  58256. this.id = attributes.id || "";
  58257. this.inverted = (0, _utils.getInteger)({
  58258. data: attributes.inverted,
  58259. defaultValue: 0,
  58260. validate: x => x === 1
  58261. });
  58262. this.join = (0, _utils.getStringOption)(attributes.join, ["square", "round"]);
  58263. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  58264. this.radius = (0, _utils.getMeasurement)(attributes.radius);
  58265. this.stroke = (0, _utils.getStringOption)(attributes.stroke, ["solid", "dashDot", "dashDotDot", "dashed", "dotted", "embossed", "etched", "lowered", "raised"]);
  58266. this.thickness = (0, _utils.getMeasurement)(attributes.thickness, "0.5pt");
  58267. this.use = attributes.use || "";
  58268. this.usehref = attributes.usehref || "";
  58269. this.color = null;
  58270. this.extras = null;
  58271. }
  58272. [_xfa_object.$toStyle]() {
  58273. const style = (0, _html_utils.toStyle)(this, "visibility");
  58274. style.radius = (0, _html_utils.measureToString)(this.join === "square" ? 0 : this.radius);
  58275. return style;
  58276. }
  58277. }
  58278. class DateElement extends _xfa_object.ContentObject {
  58279. constructor(attributes) {
  58280. super(TEMPLATE_NS_ID, "date");
  58281. this.id = attributes.id || "";
  58282. this.name = attributes.name || "";
  58283. this.use = attributes.use || "";
  58284. this.usehref = attributes.usehref || "";
  58285. }
  58286. [_xfa_object.$finalize]() {
  58287. const date = this[_xfa_object.$content].trim();
  58288. this[_xfa_object.$content] = date ? new Date(date) : null;
  58289. }
  58290. [_xfa_object.$toHTML](availableSpace) {
  58291. return valueToHtml(this[_xfa_object.$content] ? this[_xfa_object.$content].toString() : "");
  58292. }
  58293. }
  58294. class DateTime extends _xfa_object.ContentObject {
  58295. constructor(attributes) {
  58296. super(TEMPLATE_NS_ID, "dateTime");
  58297. this.id = attributes.id || "";
  58298. this.name = attributes.name || "";
  58299. this.use = attributes.use || "";
  58300. this.usehref = attributes.usehref || "";
  58301. }
  58302. [_xfa_object.$finalize]() {
  58303. const date = this[_xfa_object.$content].trim();
  58304. this[_xfa_object.$content] = date ? new Date(date) : null;
  58305. }
  58306. [_xfa_object.$toHTML](availableSpace) {
  58307. return valueToHtml(this[_xfa_object.$content] ? this[_xfa_object.$content].toString() : "");
  58308. }
  58309. }
  58310. class DateTimeEdit extends _xfa_object.XFAObject {
  58311. constructor(attributes) {
  58312. super(TEMPLATE_NS_ID, "dateTimeEdit", true);
  58313. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  58314. this.id = attributes.id || "";
  58315. this.picker = (0, _utils.getStringOption)(attributes.picker, ["host", "none"]);
  58316. this.use = attributes.use || "";
  58317. this.usehref = attributes.usehref || "";
  58318. this.border = null;
  58319. this.comb = null;
  58320. this.extras = null;
  58321. this.margin = null;
  58322. }
  58323. [_xfa_object.$toHTML](availableSpace) {
  58324. const style = (0, _html_utils.toStyle)(this, "border", "font", "margin");
  58325. const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  58326. const html = {
  58327. name: "input",
  58328. attributes: {
  58329. type: "text",
  58330. fieldId: field[_xfa_object.$uid],
  58331. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  58332. class: ["xfaTextfield"],
  58333. style,
  58334. "aria-label": ariaLabel(field),
  58335. "aria-required": false
  58336. }
  58337. };
  58338. if (isRequired(field)) {
  58339. html.attributes["aria-required"] = true;
  58340. html.attributes.required = true;
  58341. }
  58342. return _utils.HTMLResult.success({
  58343. name: "label",
  58344. attributes: {
  58345. class: ["xfaLabel"]
  58346. },
  58347. children: [html]
  58348. });
  58349. }
  58350. }
  58351. class Decimal extends _xfa_object.ContentObject {
  58352. constructor(attributes) {
  58353. super(TEMPLATE_NS_ID, "decimal");
  58354. this.fracDigits = (0, _utils.getInteger)({
  58355. data: attributes.fracDigits,
  58356. defaultValue: 2,
  58357. validate: x => true
  58358. });
  58359. this.id = attributes.id || "";
  58360. this.leadDigits = (0, _utils.getInteger)({
  58361. data: attributes.leadDigits,
  58362. defaultValue: -1,
  58363. validate: x => true
  58364. });
  58365. this.name = attributes.name || "";
  58366. this.use = attributes.use || "";
  58367. this.usehref = attributes.usehref || "";
  58368. }
  58369. [_xfa_object.$finalize]() {
  58370. const number = parseFloat(this[_xfa_object.$content].trim());
  58371. this[_xfa_object.$content] = isNaN(number) ? null : number;
  58372. }
  58373. [_xfa_object.$toHTML](availableSpace) {
  58374. return valueToHtml(this[_xfa_object.$content] !== null ? this[_xfa_object.$content].toString() : "");
  58375. }
  58376. }
  58377. class DefaultUi extends _xfa_object.XFAObject {
  58378. constructor(attributes) {
  58379. super(TEMPLATE_NS_ID, "defaultUi", true);
  58380. this.id = attributes.id || "";
  58381. this.use = attributes.use || "";
  58382. this.usehref = attributes.usehref || "";
  58383. this.extras = null;
  58384. }
  58385. }
  58386. class Desc extends _xfa_object.XFAObject {
  58387. constructor(attributes) {
  58388. super(TEMPLATE_NS_ID, "desc", true);
  58389. this.id = attributes.id || "";
  58390. this.use = attributes.use || "";
  58391. this.usehref = attributes.usehref || "";
  58392. this.boolean = new _xfa_object.XFAObjectArray();
  58393. this.date = new _xfa_object.XFAObjectArray();
  58394. this.dateTime = new _xfa_object.XFAObjectArray();
  58395. this.decimal = new _xfa_object.XFAObjectArray();
  58396. this.exData = new _xfa_object.XFAObjectArray();
  58397. this.float = new _xfa_object.XFAObjectArray();
  58398. this.image = new _xfa_object.XFAObjectArray();
  58399. this.integer = new _xfa_object.XFAObjectArray();
  58400. this.text = new _xfa_object.XFAObjectArray();
  58401. this.time = new _xfa_object.XFAObjectArray();
  58402. }
  58403. }
  58404. class DigestMethod extends _xfa_object.OptionObject {
  58405. constructor(attributes) {
  58406. super(TEMPLATE_NS_ID, "digestMethod", ["", "SHA1", "SHA256", "SHA512", "RIPEMD160"]);
  58407. this.id = attributes.id || "";
  58408. this.use = attributes.use || "";
  58409. this.usehref = attributes.usehref || "";
  58410. }
  58411. }
  58412. class DigestMethods extends _xfa_object.XFAObject {
  58413. constructor(attributes) {
  58414. super(TEMPLATE_NS_ID, "digestMethods", true);
  58415. this.id = attributes.id || "";
  58416. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  58417. this.use = attributes.use || "";
  58418. this.usehref = attributes.usehref || "";
  58419. this.digestMethod = new _xfa_object.XFAObjectArray();
  58420. }
  58421. }
  58422. class Draw extends _xfa_object.XFAObject {
  58423. constructor(attributes) {
  58424. super(TEMPLATE_NS_ID, "draw", true);
  58425. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  58426. this.colSpan = (0, _utils.getInteger)({
  58427. data: attributes.colSpan,
  58428. defaultValue: 1,
  58429. validate: n => n >= 1 || n === -1
  58430. });
  58431. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  58432. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  58433. this.id = attributes.id || "";
  58434. this.locale = attributes.locale || "";
  58435. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  58436. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  58437. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  58438. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  58439. this.name = attributes.name || "";
  58440. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  58441. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  58442. this.rotate = (0, _utils.getInteger)({
  58443. data: attributes.rotate,
  58444. defaultValue: 0,
  58445. validate: x => x % 90 === 0
  58446. });
  58447. this.use = attributes.use || "";
  58448. this.usehref = attributes.usehref || "";
  58449. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  58450. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  58451. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  58452. this.assist = null;
  58453. this.border = null;
  58454. this.caption = null;
  58455. this.desc = null;
  58456. this.extras = null;
  58457. this.font = null;
  58458. this.keep = null;
  58459. this.margin = null;
  58460. this.para = null;
  58461. this.traversal = null;
  58462. this.ui = null;
  58463. this.value = null;
  58464. this.setProperty = new _xfa_object.XFAObjectArray();
  58465. }
  58466. [_xfa_object.$setValue](value) {
  58467. _setValue(this, value);
  58468. }
  58469. [_xfa_object.$toHTML](availableSpace) {
  58470. setTabIndex(this);
  58471. if (this.presence === "hidden" || this.presence === "inactive") {
  58472. return _utils.HTMLResult.EMPTY;
  58473. }
  58474. (0, _html_utils.fixDimensions)(this);
  58475. this[_xfa_object.$pushPara]();
  58476. const savedW = this.w;
  58477. const savedH = this.h;
  58478. const {
  58479. w,
  58480. h,
  58481. isBroken
  58482. } = (0, _html_utils.layoutNode)(this, availableSpace);
  58483. if (w && this.w === "") {
  58484. if (isBroken && this[_xfa_object.$getSubformParent]()[_xfa_object.$isThereMoreWidth]()) {
  58485. this[_xfa_object.$popPara]();
  58486. return _utils.HTMLResult.FAILURE;
  58487. }
  58488. this.w = w;
  58489. }
  58490. if (h && this.h === "") {
  58491. this.h = h;
  58492. }
  58493. setFirstUnsplittable(this);
  58494. if (!(0, _layout.checkDimensions)(this, availableSpace)) {
  58495. this.w = savedW;
  58496. this.h = savedH;
  58497. this[_xfa_object.$popPara]();
  58498. return _utils.HTMLResult.FAILURE;
  58499. }
  58500. unsetFirstUnsplittable(this);
  58501. const style = (0, _html_utils.toStyle)(this, "font", "hAlign", "dimensions", "position", "presence", "rotate", "anchorType", "border", "margin");
  58502. (0, _html_utils.setMinMaxDimensions)(this, style);
  58503. if (style.margin) {
  58504. style.padding = style.margin;
  58505. delete style.margin;
  58506. }
  58507. const classNames = ["xfaDraw"];
  58508. if (this.font) {
  58509. classNames.push("xfaFont");
  58510. }
  58511. if ((0, _html_utils.isPrintOnly)(this)) {
  58512. classNames.push("xfaPrintOnly");
  58513. }
  58514. const attributes = {
  58515. style,
  58516. id: this[_xfa_object.$uid],
  58517. class: classNames
  58518. };
  58519. if (this.name) {
  58520. attributes.xfaName = this.name;
  58521. }
  58522. const html = {
  58523. name: "div",
  58524. attributes,
  58525. children: []
  58526. };
  58527. applyAssist(this, attributes);
  58528. const bbox = (0, _html_utils.computeBbox)(this, html, availableSpace);
  58529. const value = this.value ? this.value[_xfa_object.$toHTML](availableSpace).html : null;
  58530. if (value === null) {
  58531. this.w = savedW;
  58532. this.h = savedH;
  58533. this[_xfa_object.$popPara]();
  58534. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  58535. }
  58536. html.children.push(value);
  58537. (0, _html_utils.setPara)(this, style, value);
  58538. this.w = savedW;
  58539. this.h = savedH;
  58540. this[_xfa_object.$popPara]();
  58541. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  58542. }
  58543. }
  58544. class Edge extends _xfa_object.XFAObject {
  58545. constructor(attributes) {
  58546. super(TEMPLATE_NS_ID, "edge", true);
  58547. this.cap = (0, _utils.getStringOption)(attributes.cap, ["square", "butt", "round"]);
  58548. this.id = attributes.id || "";
  58549. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  58550. this.stroke = (0, _utils.getStringOption)(attributes.stroke, ["solid", "dashDot", "dashDotDot", "dashed", "dotted", "embossed", "etched", "lowered", "raised"]);
  58551. this.thickness = (0, _utils.getMeasurement)(attributes.thickness, "0.5pt");
  58552. this.use = attributes.use || "";
  58553. this.usehref = attributes.usehref || "";
  58554. this.color = null;
  58555. this.extras = null;
  58556. }
  58557. [_xfa_object.$toStyle]() {
  58558. const style = (0, _html_utils.toStyle)(this, "visibility");
  58559. Object.assign(style, {
  58560. linecap: this.cap,
  58561. width: (0, _html_utils.measureToString)(this.thickness),
  58562. color: this.color ? this.color[_xfa_object.$toStyle]() : "#000000",
  58563. style: ""
  58564. });
  58565. if (this.presence !== "visible") {
  58566. style.style = "none";
  58567. } else {
  58568. switch (this.stroke) {
  58569. case "solid":
  58570. style.style = "solid";
  58571. break;
  58572. case "dashDot":
  58573. style.style = "dashed";
  58574. break;
  58575. case "dashDotDot":
  58576. style.style = "dashed";
  58577. break;
  58578. case "dashed":
  58579. style.style = "dashed";
  58580. break;
  58581. case "dotted":
  58582. style.style = "dotted";
  58583. break;
  58584. case "embossed":
  58585. style.style = "ridge";
  58586. break;
  58587. case "etched":
  58588. style.style = "groove";
  58589. break;
  58590. case "lowered":
  58591. style.style = "inset";
  58592. break;
  58593. case "raised":
  58594. style.style = "outset";
  58595. break;
  58596. }
  58597. }
  58598. return style;
  58599. }
  58600. }
  58601. class Encoding extends _xfa_object.OptionObject {
  58602. constructor(attributes) {
  58603. super(TEMPLATE_NS_ID, "encoding", ["adbe.x509.rsa_sha1", "adbe.pkcs7.detached", "adbe.pkcs7.sha1"]);
  58604. this.id = attributes.id || "";
  58605. this.use = attributes.use || "";
  58606. this.usehref = attributes.usehref || "";
  58607. }
  58608. }
  58609. class Encodings extends _xfa_object.XFAObject {
  58610. constructor(attributes) {
  58611. super(TEMPLATE_NS_ID, "encodings", true);
  58612. this.id = attributes.id || "";
  58613. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  58614. this.use = attributes.use || "";
  58615. this.usehref = attributes.usehref || "";
  58616. this.encoding = new _xfa_object.XFAObjectArray();
  58617. }
  58618. }
  58619. class Encrypt extends _xfa_object.XFAObject {
  58620. constructor(attributes) {
  58621. super(TEMPLATE_NS_ID, "encrypt", true);
  58622. this.id = attributes.id || "";
  58623. this.use = attributes.use || "";
  58624. this.usehref = attributes.usehref || "";
  58625. this.certificate = null;
  58626. }
  58627. }
  58628. class EncryptData extends _xfa_object.XFAObject {
  58629. constructor(attributes) {
  58630. super(TEMPLATE_NS_ID, "encryptData", true);
  58631. this.id = attributes.id || "";
  58632. this.operation = (0, _utils.getStringOption)(attributes.operation, ["encrypt", "decrypt"]);
  58633. this.target = attributes.target || "";
  58634. this.use = attributes.use || "";
  58635. this.usehref = attributes.usehref || "";
  58636. this.filter = null;
  58637. this.manifest = null;
  58638. }
  58639. }
  58640. class Encryption extends _xfa_object.XFAObject {
  58641. constructor(attributes) {
  58642. super(TEMPLATE_NS_ID, "encryption", true);
  58643. this.id = attributes.id || "";
  58644. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  58645. this.use = attributes.use || "";
  58646. this.usehref = attributes.usehref || "";
  58647. this.certificate = new _xfa_object.XFAObjectArray();
  58648. }
  58649. }
  58650. class EncryptionMethod extends _xfa_object.OptionObject {
  58651. constructor(attributes) {
  58652. super(TEMPLATE_NS_ID, "encryptionMethod", ["", "AES256-CBC", "TRIPLEDES-CBC", "AES128-CBC", "AES192-CBC"]);
  58653. this.id = attributes.id || "";
  58654. this.use = attributes.use || "";
  58655. this.usehref = attributes.usehref || "";
  58656. }
  58657. }
  58658. class EncryptionMethods extends _xfa_object.XFAObject {
  58659. constructor(attributes) {
  58660. super(TEMPLATE_NS_ID, "encryptionMethods", true);
  58661. this.id = attributes.id || "";
  58662. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  58663. this.use = attributes.use || "";
  58664. this.usehref = attributes.usehref || "";
  58665. this.encryptionMethod = new _xfa_object.XFAObjectArray();
  58666. }
  58667. }
  58668. class Event extends _xfa_object.XFAObject {
  58669. constructor(attributes) {
  58670. super(TEMPLATE_NS_ID, "event", true);
  58671. 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"]);
  58672. this.id = attributes.id || "";
  58673. this.listen = (0, _utils.getStringOption)(attributes.listen, ["refOnly", "refAndDescendents"]);
  58674. this.name = attributes.name || "";
  58675. this.ref = attributes.ref || "";
  58676. this.use = attributes.use || "";
  58677. this.usehref = attributes.usehref || "";
  58678. this.extras = null;
  58679. this.encryptData = null;
  58680. this.execute = null;
  58681. this.script = null;
  58682. this.signData = null;
  58683. this.submit = null;
  58684. }
  58685. }
  58686. class ExData extends _xfa_object.ContentObject {
  58687. constructor(attributes) {
  58688. super(TEMPLATE_NS_ID, "exData");
  58689. this.contentType = attributes.contentType || "";
  58690. this.href = attributes.href || "";
  58691. this.id = attributes.id || "";
  58692. this.maxLength = (0, _utils.getInteger)({
  58693. data: attributes.maxLength,
  58694. defaultValue: -1,
  58695. validate: x => x >= -1
  58696. });
  58697. this.name = attributes.name || "";
  58698. this.rid = attributes.rid || "";
  58699. this.transferEncoding = (0, _utils.getStringOption)(attributes.transferEncoding, ["none", "base64", "package"]);
  58700. this.use = attributes.use || "";
  58701. this.usehref = attributes.usehref || "";
  58702. }
  58703. [_xfa_object.$isCDATAXml]() {
  58704. return this.contentType === "text/html";
  58705. }
  58706. [_xfa_object.$onChild](child) {
  58707. if (this.contentType === "text/html" && child[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.xhtml.id) {
  58708. this[_xfa_object.$content] = child;
  58709. return true;
  58710. }
  58711. if (this.contentType === "text/xml") {
  58712. this[_xfa_object.$content] = child;
  58713. return true;
  58714. }
  58715. return false;
  58716. }
  58717. [_xfa_object.$toHTML](availableSpace) {
  58718. if (this.contentType !== "text/html" || !this[_xfa_object.$content]) {
  58719. return _utils.HTMLResult.EMPTY;
  58720. }
  58721. return this[_xfa_object.$content][_xfa_object.$toHTML](availableSpace);
  58722. }
  58723. }
  58724. class ExObject extends _xfa_object.XFAObject {
  58725. constructor(attributes) {
  58726. super(TEMPLATE_NS_ID, "exObject", true);
  58727. this.archive = attributes.archive || "";
  58728. this.classId = attributes.classId || "";
  58729. this.codeBase = attributes.codeBase || "";
  58730. this.codeType = attributes.codeType || "";
  58731. this.id = attributes.id || "";
  58732. this.name = attributes.name || "";
  58733. this.use = attributes.use || "";
  58734. this.usehref = attributes.usehref || "";
  58735. this.extras = null;
  58736. this.boolean = new _xfa_object.XFAObjectArray();
  58737. this.date = new _xfa_object.XFAObjectArray();
  58738. this.dateTime = new _xfa_object.XFAObjectArray();
  58739. this.decimal = new _xfa_object.XFAObjectArray();
  58740. this.exData = new _xfa_object.XFAObjectArray();
  58741. this.exObject = new _xfa_object.XFAObjectArray();
  58742. this.float = new _xfa_object.XFAObjectArray();
  58743. this.image = new _xfa_object.XFAObjectArray();
  58744. this.integer = new _xfa_object.XFAObjectArray();
  58745. this.text = new _xfa_object.XFAObjectArray();
  58746. this.time = new _xfa_object.XFAObjectArray();
  58747. }
  58748. }
  58749. class ExclGroup extends _xfa_object.XFAObject {
  58750. constructor(attributes) {
  58751. super(TEMPLATE_NS_ID, "exclGroup", true);
  58752. this.access = (0, _utils.getStringOption)(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]);
  58753. this.accessKey = attributes.accessKey || "";
  58754. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  58755. this.colSpan = (0, _utils.getInteger)({
  58756. data: attributes.colSpan,
  58757. defaultValue: 1,
  58758. validate: n => n >= 1 || n === -1
  58759. });
  58760. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  58761. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  58762. this.id = attributes.id || "";
  58763. this.layout = (0, _utils.getStringOption)(attributes.layout, ["position", "lr-tb", "rl-row", "rl-tb", "row", "table", "tb"]);
  58764. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  58765. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  58766. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  58767. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  58768. this.name = attributes.name || "";
  58769. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  58770. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  58771. this.use = attributes.use || "";
  58772. this.usehref = attributes.usehref || "";
  58773. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  58774. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  58775. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  58776. this.assist = null;
  58777. this.bind = null;
  58778. this.border = null;
  58779. this.calculate = null;
  58780. this.caption = null;
  58781. this.desc = null;
  58782. this.extras = null;
  58783. this.margin = null;
  58784. this.para = null;
  58785. this.traversal = null;
  58786. this.validate = null;
  58787. this.connect = new _xfa_object.XFAObjectArray();
  58788. this.event = new _xfa_object.XFAObjectArray();
  58789. this.field = new _xfa_object.XFAObjectArray();
  58790. this.setProperty = new _xfa_object.XFAObjectArray();
  58791. }
  58792. [_xfa_object.$isBindable]() {
  58793. return true;
  58794. }
  58795. [_xfa_object.$hasSettableValue]() {
  58796. return true;
  58797. }
  58798. [_xfa_object.$setValue](value) {
  58799. for (const field of this.field.children) {
  58800. if (!field.value) {
  58801. const nodeValue = new Value({});
  58802. field[_xfa_object.$appendChild](nodeValue);
  58803. field.value = nodeValue;
  58804. }
  58805. field.value[_xfa_object.$setValue](value);
  58806. }
  58807. }
  58808. [_xfa_object.$isThereMoreWidth]() {
  58809. return this.layout.endsWith("-tb") && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine > 0 || this[_xfa_object.$getParent]()[_xfa_object.$isThereMoreWidth]();
  58810. }
  58811. [_xfa_object.$isSplittable]() {
  58812. const parent = this[_xfa_object.$getSubformParent]();
  58813. if (!parent[_xfa_object.$isSplittable]()) {
  58814. return false;
  58815. }
  58816. if (this[_xfa_object.$extra]._isSplittable !== undefined) {
  58817. return this[_xfa_object.$extra]._isSplittable;
  58818. }
  58819. if (this.layout === "position" || this.layout.includes("row")) {
  58820. this[_xfa_object.$extra]._isSplittable = false;
  58821. return false;
  58822. }
  58823. if (parent.layout && parent.layout.endsWith("-tb") && parent[_xfa_object.$extra].numberInLine !== 0) {
  58824. return false;
  58825. }
  58826. this[_xfa_object.$extra]._isSplittable = true;
  58827. return true;
  58828. }
  58829. [_xfa_object.$flushHTML]() {
  58830. return (0, _layout.flushHTML)(this);
  58831. }
  58832. [_xfa_object.$addHTML](html, bbox) {
  58833. (0, _layout.addHTML)(this, html, bbox);
  58834. }
  58835. [_xfa_object.$getAvailableSpace]() {
  58836. return (0, _layout.getAvailableSpace)(this);
  58837. }
  58838. [_xfa_object.$toHTML](availableSpace) {
  58839. setTabIndex(this);
  58840. if (this.presence === "hidden" || this.presence === "inactive" || this.h === 0 || this.w === 0) {
  58841. return _utils.HTMLResult.EMPTY;
  58842. }
  58843. (0, _html_utils.fixDimensions)(this);
  58844. const children = [];
  58845. const attributes = {
  58846. id: this[_xfa_object.$uid],
  58847. class: []
  58848. };
  58849. (0, _html_utils.setAccess)(this, attributes.class);
  58850. if (!this[_xfa_object.$extra]) {
  58851. this[_xfa_object.$extra] = Object.create(null);
  58852. }
  58853. Object.assign(this[_xfa_object.$extra], {
  58854. children,
  58855. attributes,
  58856. attempt: 0,
  58857. line: null,
  58858. numberInLine: 0,
  58859. availableSpace: {
  58860. width: Math.min(this.w || Infinity, availableSpace.width),
  58861. height: Math.min(this.h || Infinity, availableSpace.height)
  58862. },
  58863. width: 0,
  58864. height: 0,
  58865. prevHeight: 0,
  58866. currentWidth: 0
  58867. });
  58868. const isSplittable = this[_xfa_object.$isSplittable]();
  58869. if (!isSplittable) {
  58870. setFirstUnsplittable(this);
  58871. }
  58872. if (!(0, _layout.checkDimensions)(this, availableSpace)) {
  58873. return _utils.HTMLResult.FAILURE;
  58874. }
  58875. const filter = new Set(["field"]);
  58876. if (this.layout.includes("row")) {
  58877. const columnWidths = this[_xfa_object.$getSubformParent]().columnWidths;
  58878. if (Array.isArray(columnWidths) && columnWidths.length > 0) {
  58879. this[_xfa_object.$extra].columnWidths = columnWidths;
  58880. this[_xfa_object.$extra].currentColumn = 0;
  58881. }
  58882. }
  58883. const style = (0, _html_utils.toStyle)(this, "anchorType", "dimensions", "position", "presence", "border", "margin", "hAlign");
  58884. const classNames = ["xfaExclgroup"];
  58885. const cl = (0, _html_utils.layoutClass)(this);
  58886. if (cl) {
  58887. classNames.push(cl);
  58888. }
  58889. if ((0, _html_utils.isPrintOnly)(this)) {
  58890. classNames.push("xfaPrintOnly");
  58891. }
  58892. attributes.style = style;
  58893. attributes.class = classNames;
  58894. if (this.name) {
  58895. attributes.xfaName = this.name;
  58896. }
  58897. this[_xfa_object.$pushPara]();
  58898. const isLrTb = this.layout === "lr-tb" || this.layout === "rl-tb";
  58899. const maxRun = isLrTb ? MAX_ATTEMPTS_FOR_LRTB_LAYOUT : 1;
  58900. for (; this[_xfa_object.$extra].attempt < maxRun; this[_xfa_object.$extra].attempt++) {
  58901. if (isLrTb && this[_xfa_object.$extra].attempt === MAX_ATTEMPTS_FOR_LRTB_LAYOUT - 1) {
  58902. this[_xfa_object.$extra].numberInLine = 0;
  58903. }
  58904. const result = this[_xfa_object.$childrenToHTML]({
  58905. filter,
  58906. include: true
  58907. });
  58908. if (result.success) {
  58909. break;
  58910. }
  58911. if (result.isBreak()) {
  58912. this[_xfa_object.$popPara]();
  58913. return result;
  58914. }
  58915. if (isLrTb && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine === 0 && !this[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  58916. this[_xfa_object.$extra].attempt = maxRun;
  58917. break;
  58918. }
  58919. }
  58920. this[_xfa_object.$popPara]();
  58921. if (!isSplittable) {
  58922. unsetFirstUnsplittable(this);
  58923. }
  58924. if (this[_xfa_object.$extra].attempt === maxRun) {
  58925. if (!isSplittable) {
  58926. delete this[_xfa_object.$extra];
  58927. }
  58928. return _utils.HTMLResult.FAILURE;
  58929. }
  58930. let marginH = 0;
  58931. let marginV = 0;
  58932. if (this.margin) {
  58933. marginH = this.margin.leftInset + this.margin.rightInset;
  58934. marginV = this.margin.topInset + this.margin.bottomInset;
  58935. }
  58936. const width = Math.max(this[_xfa_object.$extra].width + marginH, this.w || 0);
  58937. const height = Math.max(this[_xfa_object.$extra].height + marginV, this.h || 0);
  58938. const bbox = [this.x, this.y, width, height];
  58939. if (this.w === "") {
  58940. style.width = (0, _html_utils.measureToString)(width);
  58941. }
  58942. if (this.h === "") {
  58943. style.height = (0, _html_utils.measureToString)(height);
  58944. }
  58945. const html = {
  58946. name: "div",
  58947. attributes,
  58948. children
  58949. };
  58950. applyAssist(this, attributes);
  58951. delete this[_xfa_object.$extra];
  58952. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  58953. }
  58954. }
  58955. class Execute extends _xfa_object.XFAObject {
  58956. constructor(attributes) {
  58957. super(TEMPLATE_NS_ID, "execute");
  58958. this.connection = attributes.connection || "";
  58959. this.executeType = (0, _utils.getStringOption)(attributes.executeType, ["import", "remerge"]);
  58960. this.id = attributes.id || "";
  58961. this.runAt = (0, _utils.getStringOption)(attributes.runAt, ["client", "both", "server"]);
  58962. this.use = attributes.use || "";
  58963. this.usehref = attributes.usehref || "";
  58964. }
  58965. }
  58966. class Extras extends _xfa_object.XFAObject {
  58967. constructor(attributes) {
  58968. super(TEMPLATE_NS_ID, "extras", true);
  58969. this.id = attributes.id || "";
  58970. this.name = attributes.name || "";
  58971. this.use = attributes.use || "";
  58972. this.usehref = attributes.usehref || "";
  58973. this.boolean = new _xfa_object.XFAObjectArray();
  58974. this.date = new _xfa_object.XFAObjectArray();
  58975. this.dateTime = new _xfa_object.XFAObjectArray();
  58976. this.decimal = new _xfa_object.XFAObjectArray();
  58977. this.exData = new _xfa_object.XFAObjectArray();
  58978. this.extras = new _xfa_object.XFAObjectArray();
  58979. this.float = new _xfa_object.XFAObjectArray();
  58980. this.image = new _xfa_object.XFAObjectArray();
  58981. this.integer = new _xfa_object.XFAObjectArray();
  58982. this.text = new _xfa_object.XFAObjectArray();
  58983. this.time = new _xfa_object.XFAObjectArray();
  58984. }
  58985. }
  58986. class Field extends _xfa_object.XFAObject {
  58987. constructor(attributes) {
  58988. super(TEMPLATE_NS_ID, "field", true);
  58989. this.access = (0, _utils.getStringOption)(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]);
  58990. this.accessKey = attributes.accessKey || "";
  58991. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  58992. this.colSpan = (0, _utils.getInteger)({
  58993. data: attributes.colSpan,
  58994. defaultValue: 1,
  58995. validate: n => n >= 1 || n === -1
  58996. });
  58997. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  58998. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  58999. this.id = attributes.id || "";
  59000. this.locale = attributes.locale || "";
  59001. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  59002. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  59003. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  59004. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  59005. this.name = attributes.name || "";
  59006. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  59007. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  59008. this.rotate = (0, _utils.getInteger)({
  59009. data: attributes.rotate,
  59010. defaultValue: 0,
  59011. validate: x => x % 90 === 0
  59012. });
  59013. this.use = attributes.use || "";
  59014. this.usehref = attributes.usehref || "";
  59015. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  59016. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  59017. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  59018. this.assist = null;
  59019. this.bind = null;
  59020. this.border = null;
  59021. this.calculate = null;
  59022. this.caption = null;
  59023. this.desc = null;
  59024. this.extras = null;
  59025. this.font = null;
  59026. this.format = null;
  59027. this.items = new _xfa_object.XFAObjectArray(2);
  59028. this.keep = null;
  59029. this.margin = null;
  59030. this.para = null;
  59031. this.traversal = null;
  59032. this.ui = null;
  59033. this.validate = null;
  59034. this.value = null;
  59035. this.bindItems = new _xfa_object.XFAObjectArray();
  59036. this.connect = new _xfa_object.XFAObjectArray();
  59037. this.event = new _xfa_object.XFAObjectArray();
  59038. this.setProperty = new _xfa_object.XFAObjectArray();
  59039. }
  59040. [_xfa_object.$isBindable]() {
  59041. return true;
  59042. }
  59043. [_xfa_object.$setValue](value) {
  59044. _setValue(this, value);
  59045. }
  59046. [_xfa_object.$toHTML](availableSpace) {
  59047. setTabIndex(this);
  59048. if (!this.ui) {
  59049. this.ui = new Ui({});
  59050. this.ui[_xfa_object.$globalData] = this[_xfa_object.$globalData];
  59051. this[_xfa_object.$appendChild](this.ui);
  59052. let node;
  59053. switch (this.items.children.length) {
  59054. case 0:
  59055. node = new TextEdit({});
  59056. this.ui.textEdit = node;
  59057. break;
  59058. case 1:
  59059. node = new CheckButton({});
  59060. this.ui.checkButton = node;
  59061. break;
  59062. case 2:
  59063. node = new ChoiceList({});
  59064. this.ui.choiceList = node;
  59065. break;
  59066. }
  59067. this.ui[_xfa_object.$appendChild](node);
  59068. }
  59069. if (!this.ui || this.presence === "hidden" || this.presence === "inactive" || this.h === 0 || this.w === 0) {
  59070. return _utils.HTMLResult.EMPTY;
  59071. }
  59072. if (this.caption) {
  59073. delete this.caption[_xfa_object.$extra];
  59074. }
  59075. this[_xfa_object.$pushPara]();
  59076. const caption = this.caption ? this.caption[_xfa_object.$toHTML](availableSpace).html : null;
  59077. const savedW = this.w;
  59078. const savedH = this.h;
  59079. let marginH = 0;
  59080. let marginV = 0;
  59081. if (this.margin) {
  59082. marginH = this.margin.leftInset + this.margin.rightInset;
  59083. marginV = this.margin.topInset + this.margin.bottomInset;
  59084. }
  59085. let borderDims = null;
  59086. if (this.w === "" || this.h === "") {
  59087. let width = null;
  59088. let height = null;
  59089. let uiW = 0;
  59090. let uiH = 0;
  59091. if (this.ui.checkButton) {
  59092. uiW = uiH = this.ui.checkButton.size;
  59093. } else {
  59094. const {
  59095. w,
  59096. h
  59097. } = (0, _html_utils.layoutNode)(this, availableSpace);
  59098. if (w !== null) {
  59099. uiW = w;
  59100. uiH = h;
  59101. } else {
  59102. uiH = (0, _fonts.getMetrics)(this.font, true).lineNoGap;
  59103. }
  59104. }
  59105. borderDims = getBorderDims(this.ui[_xfa_object.$getExtra]());
  59106. uiW += borderDims.w;
  59107. uiH += borderDims.h;
  59108. if (this.caption) {
  59109. const {
  59110. w,
  59111. h,
  59112. isBroken
  59113. } = this.caption[_xfa_object.$getExtra](availableSpace);
  59114. if (isBroken && this[_xfa_object.$getSubformParent]()[_xfa_object.$isThereMoreWidth]()) {
  59115. this[_xfa_object.$popPara]();
  59116. return _utils.HTMLResult.FAILURE;
  59117. }
  59118. width = w;
  59119. height = h;
  59120. switch (this.caption.placement) {
  59121. case "left":
  59122. case "right":
  59123. case "inline":
  59124. width += uiW;
  59125. break;
  59126. case "top":
  59127. case "bottom":
  59128. height += uiH;
  59129. break;
  59130. }
  59131. } else {
  59132. width = uiW;
  59133. height = uiH;
  59134. }
  59135. if (width && this.w === "") {
  59136. width += marginH;
  59137. this.w = Math.min(this.maxW <= 0 ? Infinity : this.maxW, this.minW + 1 < width ? width : this.minW);
  59138. }
  59139. if (height && this.h === "") {
  59140. height += marginV;
  59141. this.h = Math.min(this.maxH <= 0 ? Infinity : this.maxH, this.minH + 1 < height ? height : this.minH);
  59142. }
  59143. }
  59144. this[_xfa_object.$popPara]();
  59145. (0, _html_utils.fixDimensions)(this);
  59146. setFirstUnsplittable(this);
  59147. if (!(0, _layout.checkDimensions)(this, availableSpace)) {
  59148. this.w = savedW;
  59149. this.h = savedH;
  59150. this[_xfa_object.$popPara]();
  59151. return _utils.HTMLResult.FAILURE;
  59152. }
  59153. unsetFirstUnsplittable(this);
  59154. const style = (0, _html_utils.toStyle)(this, "font", "dimensions", "position", "rotate", "anchorType", "presence", "margin", "hAlign");
  59155. (0, _html_utils.setMinMaxDimensions)(this, style);
  59156. const classNames = ["xfaField"];
  59157. if (this.font) {
  59158. classNames.push("xfaFont");
  59159. }
  59160. if ((0, _html_utils.isPrintOnly)(this)) {
  59161. classNames.push("xfaPrintOnly");
  59162. }
  59163. const attributes = {
  59164. style,
  59165. id: this[_xfa_object.$uid],
  59166. class: classNames
  59167. };
  59168. if (style.margin) {
  59169. style.padding = style.margin;
  59170. delete style.margin;
  59171. }
  59172. (0, _html_utils.setAccess)(this, classNames);
  59173. if (this.name) {
  59174. attributes.xfaName = this.name;
  59175. }
  59176. const children = [];
  59177. const html = {
  59178. name: "div",
  59179. attributes,
  59180. children
  59181. };
  59182. applyAssist(this, attributes);
  59183. const borderStyle = this.border ? this.border[_xfa_object.$toStyle]() : null;
  59184. const bbox = (0, _html_utils.computeBbox)(this, html, availableSpace);
  59185. const ui = this.ui[_xfa_object.$toHTML]().html;
  59186. if (!ui) {
  59187. Object.assign(style, borderStyle);
  59188. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  59189. }
  59190. if (this[_xfa_object.$tabIndex]) {
  59191. if (ui.children && ui.children[0]) {
  59192. ui.children[0].attributes.tabindex = this[_xfa_object.$tabIndex];
  59193. } else {
  59194. ui.attributes.tabindex = this[_xfa_object.$tabIndex];
  59195. }
  59196. }
  59197. if (!ui.attributes.style) {
  59198. ui.attributes.style = Object.create(null);
  59199. }
  59200. let aElement = null;
  59201. if (this.ui.button) {
  59202. if (ui.children.length === 1) {
  59203. [aElement] = ui.children.splice(0, 1);
  59204. }
  59205. Object.assign(ui.attributes.style, borderStyle);
  59206. } else {
  59207. Object.assign(style, borderStyle);
  59208. }
  59209. children.push(ui);
  59210. if (this.value) {
  59211. if (this.ui.imageEdit) {
  59212. ui.children.push(this.value[_xfa_object.$toHTML]().html);
  59213. } else if (!this.ui.button) {
  59214. let value = "";
  59215. if (this.value.exData) {
  59216. value = this.value.exData[_xfa_object.$text]();
  59217. } else if (this.value.text) {
  59218. value = this.value.text[_xfa_object.$getExtra]();
  59219. } else {
  59220. const htmlValue = this.value[_xfa_object.$toHTML]().html;
  59221. if (htmlValue !== null) {
  59222. value = htmlValue.children[0].value;
  59223. }
  59224. }
  59225. if (this.ui.textEdit && this.value.text && this.value.text.maxChars) {
  59226. ui.children[0].attributes.maxLength = this.value.text.maxChars;
  59227. }
  59228. if (value) {
  59229. if (this.ui.numericEdit) {
  59230. value = parseFloat(value);
  59231. value = isNaN(value) ? "" : value.toString();
  59232. }
  59233. if (ui.children[0].name === "textarea") {
  59234. ui.children[0].attributes.textContent = value;
  59235. } else {
  59236. ui.children[0].attributes.value = value;
  59237. }
  59238. }
  59239. }
  59240. }
  59241. if (!this.ui.imageEdit && ui.children && ui.children[0] && this.h) {
  59242. borderDims = borderDims || getBorderDims(this.ui[_xfa_object.$getExtra]());
  59243. let captionHeight = 0;
  59244. if (this.caption && ["top", "bottom"].includes(this.caption.placement)) {
  59245. captionHeight = this.caption.reserve;
  59246. if (captionHeight <= 0) {
  59247. captionHeight = this.caption[_xfa_object.$getExtra](availableSpace).h;
  59248. }
  59249. const inputHeight = this.h - captionHeight - marginV - borderDims.h;
  59250. ui.children[0].attributes.style.height = (0, _html_utils.measureToString)(inputHeight);
  59251. } else {
  59252. ui.children[0].attributes.style.height = "100%";
  59253. }
  59254. }
  59255. if (aElement) {
  59256. ui.children.push(aElement);
  59257. }
  59258. if (!caption) {
  59259. if (ui.attributes.class) {
  59260. ui.attributes.class.push("xfaLeft");
  59261. }
  59262. this.w = savedW;
  59263. this.h = savedH;
  59264. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  59265. }
  59266. if (this.ui.button) {
  59267. if (style.padding) {
  59268. delete style.padding;
  59269. }
  59270. if (caption.name === "div") {
  59271. caption.name = "span";
  59272. }
  59273. ui.children.push(caption);
  59274. return _utils.HTMLResult.success(html, bbox);
  59275. } else if (this.ui.checkButton) {
  59276. caption.attributes.class[0] = "xfaCaptionForCheckButton";
  59277. }
  59278. if (!ui.attributes.class) {
  59279. ui.attributes.class = [];
  59280. }
  59281. ui.children.splice(0, 0, caption);
  59282. switch (this.caption.placement) {
  59283. case "left":
  59284. ui.attributes.class.push("xfaLeft");
  59285. break;
  59286. case "right":
  59287. ui.attributes.class.push("xfaRight");
  59288. break;
  59289. case "top":
  59290. ui.attributes.class.push("xfaTop");
  59291. break;
  59292. case "bottom":
  59293. ui.attributes.class.push("xfaBottom");
  59294. break;
  59295. case "inline":
  59296. ui.attributes.class.push("xfaLeft");
  59297. break;
  59298. }
  59299. this.w = savedW;
  59300. this.h = savedH;
  59301. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  59302. }
  59303. }
  59304. exports.Field = Field;
  59305. class Fill extends _xfa_object.XFAObject {
  59306. constructor(attributes) {
  59307. super(TEMPLATE_NS_ID, "fill", true);
  59308. this.id = attributes.id || "";
  59309. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  59310. this.use = attributes.use || "";
  59311. this.usehref = attributes.usehref || "";
  59312. this.color = null;
  59313. this.extras = null;
  59314. this.linear = null;
  59315. this.pattern = null;
  59316. this.radial = null;
  59317. this.solid = null;
  59318. this.stipple = null;
  59319. }
  59320. [_xfa_object.$toStyle]() {
  59321. const parent = this[_xfa_object.$getParent]();
  59322. const grandpa = parent[_xfa_object.$getParent]();
  59323. const ggrandpa = grandpa[_xfa_object.$getParent]();
  59324. const style = Object.create(null);
  59325. let propName = "color";
  59326. let altPropName = propName;
  59327. if (parent instanceof Border) {
  59328. propName = "background-color";
  59329. altPropName = "background";
  59330. if (ggrandpa instanceof Ui) {
  59331. style.backgroundColor = "white";
  59332. }
  59333. }
  59334. if (parent instanceof Rectangle || parent instanceof Arc) {
  59335. propName = altPropName = "fill";
  59336. style.fill = "white";
  59337. }
  59338. for (const name of Object.getOwnPropertyNames(this)) {
  59339. if (name === "extras" || name === "color") {
  59340. continue;
  59341. }
  59342. const obj = this[name];
  59343. if (!(obj instanceof _xfa_object.XFAObject)) {
  59344. continue;
  59345. }
  59346. const color = obj[_xfa_object.$toStyle](this.color);
  59347. if (color) {
  59348. style[color.startsWith("#") ? propName : altPropName] = color;
  59349. }
  59350. return style;
  59351. }
  59352. if (this.color && this.color.value) {
  59353. const color = this.color[_xfa_object.$toStyle]();
  59354. style[color.startsWith("#") ? propName : altPropName] = color;
  59355. }
  59356. return style;
  59357. }
  59358. }
  59359. class Filter extends _xfa_object.XFAObject {
  59360. constructor(attributes) {
  59361. super(TEMPLATE_NS_ID, "filter", true);
  59362. this.addRevocationInfo = (0, _utils.getStringOption)(attributes.addRevocationInfo, ["", "required", "optional", "none"]);
  59363. this.id = attributes.id || "";
  59364. this.name = attributes.name || "";
  59365. this.use = attributes.use || "";
  59366. this.usehref = attributes.usehref || "";
  59367. this.version = (0, _utils.getInteger)({
  59368. data: this.version,
  59369. defaultValue: 5,
  59370. validate: x => x >= 1 && x <= 5
  59371. });
  59372. this.appearanceFilter = null;
  59373. this.certificates = null;
  59374. this.digestMethods = null;
  59375. this.encodings = null;
  59376. this.encryptionMethods = null;
  59377. this.handler = null;
  59378. this.lockDocument = null;
  59379. this.mdp = null;
  59380. this.reasons = null;
  59381. this.timeStamp = null;
  59382. }
  59383. }
  59384. class Float extends _xfa_object.ContentObject {
  59385. constructor(attributes) {
  59386. super(TEMPLATE_NS_ID, "float");
  59387. this.id = attributes.id || "";
  59388. this.name = attributes.name || "";
  59389. this.use = attributes.use || "";
  59390. this.usehref = attributes.usehref || "";
  59391. }
  59392. [_xfa_object.$finalize]() {
  59393. const number = parseFloat(this[_xfa_object.$content].trim());
  59394. this[_xfa_object.$content] = isNaN(number) ? null : number;
  59395. }
  59396. [_xfa_object.$toHTML](availableSpace) {
  59397. return valueToHtml(this[_xfa_object.$content] !== null ? this[_xfa_object.$content].toString() : "");
  59398. }
  59399. }
  59400. class Font extends _xfa_object.XFAObject {
  59401. constructor(attributes) {
  59402. super(TEMPLATE_NS_ID, "font", true);
  59403. this.baselineShift = (0, _utils.getMeasurement)(attributes.baselineShift);
  59404. this.fontHorizontalScale = (0, _utils.getFloat)({
  59405. data: attributes.fontHorizontalScale,
  59406. defaultValue: 100,
  59407. validate: x => x >= 0
  59408. });
  59409. this.fontVerticalScale = (0, _utils.getFloat)({
  59410. data: attributes.fontVerticalScale,
  59411. defaultValue: 100,
  59412. validate: x => x >= 0
  59413. });
  59414. this.id = attributes.id || "";
  59415. this.kerningMode = (0, _utils.getStringOption)(attributes.kerningMode, ["none", "pair"]);
  59416. this.letterSpacing = (0, _utils.getMeasurement)(attributes.letterSpacing, "0");
  59417. this.lineThrough = (0, _utils.getInteger)({
  59418. data: attributes.lineThrough,
  59419. defaultValue: 0,
  59420. validate: x => x === 1 || x === 2
  59421. });
  59422. this.lineThroughPeriod = (0, _utils.getStringOption)(attributes.lineThroughPeriod, ["all", "word"]);
  59423. this.overline = (0, _utils.getInteger)({
  59424. data: attributes.overline,
  59425. defaultValue: 0,
  59426. validate: x => x === 1 || x === 2
  59427. });
  59428. this.overlinePeriod = (0, _utils.getStringOption)(attributes.overlinePeriod, ["all", "word"]);
  59429. this.posture = (0, _utils.getStringOption)(attributes.posture, ["normal", "italic"]);
  59430. this.size = (0, _utils.getMeasurement)(attributes.size, "10pt");
  59431. this.typeface = attributes.typeface || "Courier";
  59432. this.underline = (0, _utils.getInteger)({
  59433. data: attributes.underline,
  59434. defaultValue: 0,
  59435. validate: x => x === 1 || x === 2
  59436. });
  59437. this.underlinePeriod = (0, _utils.getStringOption)(attributes.underlinePeriod, ["all", "word"]);
  59438. this.use = attributes.use || "";
  59439. this.usehref = attributes.usehref || "";
  59440. this.weight = (0, _utils.getStringOption)(attributes.weight, ["normal", "bold"]);
  59441. this.extras = null;
  59442. this.fill = null;
  59443. }
  59444. [_xfa_object.$clean](builder) {
  59445. super[_xfa_object.$clean](builder);
  59446. this[_xfa_object.$globalData].usedTypefaces.add(this.typeface);
  59447. }
  59448. [_xfa_object.$toStyle]() {
  59449. const style = (0, _html_utils.toStyle)(this, "fill");
  59450. const color = style.color;
  59451. if (color) {
  59452. if (color === "#000000") {
  59453. delete style.color;
  59454. } else if (!color.startsWith("#")) {
  59455. style.background = color;
  59456. style.backgroundClip = "text";
  59457. style.color = "transparent";
  59458. }
  59459. }
  59460. if (this.baselineShift) {
  59461. style.verticalAlign = (0, _html_utils.measureToString)(this.baselineShift);
  59462. }
  59463. style.fontKerning = this.kerningMode === "none" ? "none" : "normal";
  59464. style.letterSpacing = (0, _html_utils.measureToString)(this.letterSpacing);
  59465. if (this.lineThrough !== 0) {
  59466. style.textDecoration = "line-through";
  59467. if (this.lineThrough === 2) {
  59468. style.textDecorationStyle = "double";
  59469. }
  59470. }
  59471. if (this.overline !== 0) {
  59472. style.textDecoration = "overline";
  59473. if (this.overline === 2) {
  59474. style.textDecorationStyle = "double";
  59475. }
  59476. }
  59477. style.fontStyle = this.posture;
  59478. style.fontSize = (0, _html_utils.measureToString)(0.99 * this.size);
  59479. (0, _html_utils.setFontFamily)(this, this, this[_xfa_object.$globalData].fontFinder, style);
  59480. if (this.underline !== 0) {
  59481. style.textDecoration = "underline";
  59482. if (this.underline === 2) {
  59483. style.textDecorationStyle = "double";
  59484. }
  59485. }
  59486. style.fontWeight = this.weight;
  59487. return style;
  59488. }
  59489. }
  59490. class Format extends _xfa_object.XFAObject {
  59491. constructor(attributes) {
  59492. super(TEMPLATE_NS_ID, "format", true);
  59493. this.id = attributes.id || "";
  59494. this.use = attributes.use || "";
  59495. this.usehref = attributes.usehref || "";
  59496. this.extras = null;
  59497. this.picture = null;
  59498. }
  59499. }
  59500. class Handler extends _xfa_object.StringObject {
  59501. constructor(attributes) {
  59502. super(TEMPLATE_NS_ID, "handler");
  59503. this.id = attributes.id || "";
  59504. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  59505. this.use = attributes.use || "";
  59506. this.usehref = attributes.usehref || "";
  59507. }
  59508. }
  59509. class Hyphenation extends _xfa_object.XFAObject {
  59510. constructor(attributes) {
  59511. super(TEMPLATE_NS_ID, "hyphenation");
  59512. this.excludeAllCaps = (0, _utils.getInteger)({
  59513. data: attributes.excludeAllCaps,
  59514. defaultValue: 0,
  59515. validate: x => x === 1
  59516. });
  59517. this.excludeInitialCap = (0, _utils.getInteger)({
  59518. data: attributes.excludeInitialCap,
  59519. defaultValue: 0,
  59520. validate: x => x === 1
  59521. });
  59522. this.hyphenate = (0, _utils.getInteger)({
  59523. data: attributes.hyphenate,
  59524. defaultValue: 0,
  59525. validate: x => x === 1
  59526. });
  59527. this.id = attributes.id || "";
  59528. this.pushCharacterCount = (0, _utils.getInteger)({
  59529. data: attributes.pushCharacterCount,
  59530. defaultValue: 3,
  59531. validate: x => x >= 0
  59532. });
  59533. this.remainCharacterCount = (0, _utils.getInteger)({
  59534. data: attributes.remainCharacterCount,
  59535. defaultValue: 3,
  59536. validate: x => x >= 0
  59537. });
  59538. this.use = attributes.use || "";
  59539. this.usehref = attributes.usehref || "";
  59540. this.wordCharacterCount = (0, _utils.getInteger)({
  59541. data: attributes.wordCharacterCount,
  59542. defaultValue: 7,
  59543. validate: x => x >= 0
  59544. });
  59545. }
  59546. }
  59547. class Image extends _xfa_object.StringObject {
  59548. constructor(attributes) {
  59549. super(TEMPLATE_NS_ID, "image");
  59550. this.aspect = (0, _utils.getStringOption)(attributes.aspect, ["fit", "actual", "height", "none", "width"]);
  59551. this.contentType = attributes.contentType || "";
  59552. this.href = attributes.href || "";
  59553. this.id = attributes.id || "";
  59554. this.name = attributes.name || "";
  59555. this.transferEncoding = (0, _utils.getStringOption)(attributes.transferEncoding, ["base64", "none", "package"]);
  59556. this.use = attributes.use || "";
  59557. this.usehref = attributes.usehref || "";
  59558. }
  59559. [_xfa_object.$toHTML]() {
  59560. if (this.contentType && !MIMES.has(this.contentType.toLowerCase())) {
  59561. return _utils.HTMLResult.EMPTY;
  59562. }
  59563. let buffer = this[_xfa_object.$globalData].images && this[_xfa_object.$globalData].images.get(this.href);
  59564. if (!buffer && (this.href || !this[_xfa_object.$content])) {
  59565. return _utils.HTMLResult.EMPTY;
  59566. }
  59567. if (!buffer && this.transferEncoding === "base64") {
  59568. buffer = (0, _util.stringToBytes)(atob(this[_xfa_object.$content]));
  59569. }
  59570. if (!buffer) {
  59571. return _utils.HTMLResult.EMPTY;
  59572. }
  59573. if (!this.contentType) {
  59574. for (const [header, type] of IMAGES_HEADERS) {
  59575. if (buffer.length > header.length && header.every((x, i) => x === buffer[i])) {
  59576. this.contentType = type;
  59577. break;
  59578. }
  59579. }
  59580. if (!this.contentType) {
  59581. return _utils.HTMLResult.EMPTY;
  59582. }
  59583. }
  59584. const blob = new Blob([buffer], {
  59585. type: this.contentType
  59586. });
  59587. let style;
  59588. switch (this.aspect) {
  59589. case "fit":
  59590. case "actual":
  59591. break;
  59592. case "height":
  59593. style = {
  59594. height: "100%",
  59595. objectFit: "fill"
  59596. };
  59597. break;
  59598. case "none":
  59599. style = {
  59600. width: "100%",
  59601. height: "100%",
  59602. objectFit: "fill"
  59603. };
  59604. break;
  59605. case "width":
  59606. style = {
  59607. width: "100%",
  59608. objectFit: "fill"
  59609. };
  59610. break;
  59611. }
  59612. const parent = this[_xfa_object.$getParent]();
  59613. return _utils.HTMLResult.success({
  59614. name: "img",
  59615. attributes: {
  59616. class: ["xfaImage"],
  59617. style,
  59618. src: URL.createObjectURL(blob),
  59619. alt: parent ? ariaLabel(parent[_xfa_object.$getParent]()) : null
  59620. }
  59621. });
  59622. }
  59623. }
  59624. class ImageEdit extends _xfa_object.XFAObject {
  59625. constructor(attributes) {
  59626. super(TEMPLATE_NS_ID, "imageEdit", true);
  59627. this.data = (0, _utils.getStringOption)(attributes.data, ["link", "embed"]);
  59628. this.id = attributes.id || "";
  59629. this.use = attributes.use || "";
  59630. this.usehref = attributes.usehref || "";
  59631. this.border = null;
  59632. this.extras = null;
  59633. this.margin = null;
  59634. }
  59635. [_xfa_object.$toHTML](availableSpace) {
  59636. if (this.data === "embed") {
  59637. return _utils.HTMLResult.success({
  59638. name: "div",
  59639. children: [],
  59640. attributes: {}
  59641. });
  59642. }
  59643. return _utils.HTMLResult.EMPTY;
  59644. }
  59645. }
  59646. class Integer extends _xfa_object.ContentObject {
  59647. constructor(attributes) {
  59648. super(TEMPLATE_NS_ID, "integer");
  59649. this.id = attributes.id || "";
  59650. this.name = attributes.name || "";
  59651. this.use = attributes.use || "";
  59652. this.usehref = attributes.usehref || "";
  59653. }
  59654. [_xfa_object.$finalize]() {
  59655. const number = parseInt(this[_xfa_object.$content].trim(), 10);
  59656. this[_xfa_object.$content] = isNaN(number) ? null : number;
  59657. }
  59658. [_xfa_object.$toHTML](availableSpace) {
  59659. return valueToHtml(this[_xfa_object.$content] !== null ? this[_xfa_object.$content].toString() : "");
  59660. }
  59661. }
  59662. class Issuers extends _xfa_object.XFAObject {
  59663. constructor(attributes) {
  59664. super(TEMPLATE_NS_ID, "issuers", true);
  59665. this.id = attributes.id || "";
  59666. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  59667. this.use = attributes.use || "";
  59668. this.usehref = attributes.usehref || "";
  59669. this.certificate = new _xfa_object.XFAObjectArray();
  59670. }
  59671. }
  59672. class Items extends _xfa_object.XFAObject {
  59673. constructor(attributes) {
  59674. super(TEMPLATE_NS_ID, "items", true);
  59675. this.id = attributes.id || "";
  59676. this.name = attributes.name || "";
  59677. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  59678. this.ref = attributes.ref || "";
  59679. this.save = (0, _utils.getInteger)({
  59680. data: attributes.save,
  59681. defaultValue: 0,
  59682. validate: x => x === 1
  59683. });
  59684. this.use = attributes.use || "";
  59685. this.usehref = attributes.usehref || "";
  59686. this.boolean = new _xfa_object.XFAObjectArray();
  59687. this.date = new _xfa_object.XFAObjectArray();
  59688. this.dateTime = new _xfa_object.XFAObjectArray();
  59689. this.decimal = new _xfa_object.XFAObjectArray();
  59690. this.exData = new _xfa_object.XFAObjectArray();
  59691. this.float = new _xfa_object.XFAObjectArray();
  59692. this.image = new _xfa_object.XFAObjectArray();
  59693. this.integer = new _xfa_object.XFAObjectArray();
  59694. this.text = new _xfa_object.XFAObjectArray();
  59695. this.time = new _xfa_object.XFAObjectArray();
  59696. }
  59697. [_xfa_object.$toHTML]() {
  59698. const output = [];
  59699. for (const child of this[_xfa_object.$getChildren]()) {
  59700. output.push(child[_xfa_object.$text]());
  59701. }
  59702. return _utils.HTMLResult.success(output);
  59703. }
  59704. }
  59705. exports.Items = Items;
  59706. class Keep extends _xfa_object.XFAObject {
  59707. constructor(attributes) {
  59708. super(TEMPLATE_NS_ID, "keep", true);
  59709. this.id = attributes.id || "";
  59710. const options = ["none", "contentArea", "pageArea"];
  59711. this.intact = (0, _utils.getStringOption)(attributes.intact, options);
  59712. this.next = (0, _utils.getStringOption)(attributes.next, options);
  59713. this.previous = (0, _utils.getStringOption)(attributes.previous, options);
  59714. this.use = attributes.use || "";
  59715. this.usehref = attributes.usehref || "";
  59716. this.extras = null;
  59717. }
  59718. }
  59719. class KeyUsage extends _xfa_object.XFAObject {
  59720. constructor(attributes) {
  59721. super(TEMPLATE_NS_ID, "keyUsage");
  59722. const options = ["", "yes", "no"];
  59723. this.crlSign = (0, _utils.getStringOption)(attributes.crlSign, options);
  59724. this.dataEncipherment = (0, _utils.getStringOption)(attributes.dataEncipherment, options);
  59725. this.decipherOnly = (0, _utils.getStringOption)(attributes.decipherOnly, options);
  59726. this.digitalSignature = (0, _utils.getStringOption)(attributes.digitalSignature, options);
  59727. this.encipherOnly = (0, _utils.getStringOption)(attributes.encipherOnly, options);
  59728. this.id = attributes.id || "";
  59729. this.keyAgreement = (0, _utils.getStringOption)(attributes.keyAgreement, options);
  59730. this.keyCertSign = (0, _utils.getStringOption)(attributes.keyCertSign, options);
  59731. this.keyEncipherment = (0, _utils.getStringOption)(attributes.keyEncipherment, options);
  59732. this.nonRepudiation = (0, _utils.getStringOption)(attributes.nonRepudiation, options);
  59733. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  59734. this.use = attributes.use || "";
  59735. this.usehref = attributes.usehref || "";
  59736. }
  59737. }
  59738. class Line extends _xfa_object.XFAObject {
  59739. constructor(attributes) {
  59740. super(TEMPLATE_NS_ID, "line", true);
  59741. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  59742. this.id = attributes.id || "";
  59743. this.slope = (0, _utils.getStringOption)(attributes.slope, ["\\", "/"]);
  59744. this.use = attributes.use || "";
  59745. this.usehref = attributes.usehref || "";
  59746. this.edge = null;
  59747. }
  59748. [_xfa_object.$toHTML]() {
  59749. const parent = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  59750. const edge = this.edge || new Edge({});
  59751. const edgeStyle = edge[_xfa_object.$toStyle]();
  59752. const style = Object.create(null);
  59753. const thickness = edge.presence === "visible" ? edge.thickness : 0;
  59754. style.strokeWidth = (0, _html_utils.measureToString)(thickness);
  59755. style.stroke = edgeStyle.color;
  59756. let x1, y1, x2, y2;
  59757. let width = "100%";
  59758. let height = "100%";
  59759. if (parent.w <= thickness) {
  59760. [x1, y1, x2, y2] = ["50%", 0, "50%", "100%"];
  59761. width = style.strokeWidth;
  59762. } else if (parent.h <= thickness) {
  59763. [x1, y1, x2, y2] = [0, "50%", "100%", "50%"];
  59764. height = style.strokeWidth;
  59765. } else {
  59766. if (this.slope === "\\") {
  59767. [x1, y1, x2, y2] = [0, 0, "100%", "100%"];
  59768. } else {
  59769. [x1, y1, x2, y2] = [0, "100%", "100%", 0];
  59770. }
  59771. }
  59772. const line = {
  59773. name: "line",
  59774. attributes: {
  59775. xmlns: SVG_NS,
  59776. x1,
  59777. y1,
  59778. x2,
  59779. y2,
  59780. style
  59781. }
  59782. };
  59783. const svg = {
  59784. name: "svg",
  59785. children: [line],
  59786. attributes: {
  59787. xmlns: SVG_NS,
  59788. width,
  59789. height,
  59790. style: {
  59791. overflow: "visible"
  59792. }
  59793. }
  59794. };
  59795. if (hasMargin(parent)) {
  59796. return _utils.HTMLResult.success({
  59797. name: "div",
  59798. attributes: {
  59799. style: {
  59800. display: "inline",
  59801. width: "100%",
  59802. height: "100%"
  59803. }
  59804. },
  59805. children: [svg]
  59806. });
  59807. }
  59808. svg.attributes.style.position = "absolute";
  59809. return _utils.HTMLResult.success(svg);
  59810. }
  59811. }
  59812. class Linear extends _xfa_object.XFAObject {
  59813. constructor(attributes) {
  59814. super(TEMPLATE_NS_ID, "linear", true);
  59815. this.id = attributes.id || "";
  59816. this.type = (0, _utils.getStringOption)(attributes.type, ["toRight", "toBottom", "toLeft", "toTop"]);
  59817. this.use = attributes.use || "";
  59818. this.usehref = attributes.usehref || "";
  59819. this.color = null;
  59820. this.extras = null;
  59821. }
  59822. [_xfa_object.$toStyle](startColor) {
  59823. startColor = startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  59824. const transf = this.type.replace(/([RBLT])/, " $1").toLowerCase();
  59825. const endColor = this.color ? this.color[_xfa_object.$toStyle]() : "#000000";
  59826. return `linear-gradient(${transf}, ${startColor}, ${endColor})`;
  59827. }
  59828. }
  59829. class LockDocument extends _xfa_object.ContentObject {
  59830. constructor(attributes) {
  59831. super(TEMPLATE_NS_ID, "lockDocument");
  59832. this.id = attributes.id || "";
  59833. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  59834. this.use = attributes.use || "";
  59835. this.usehref = attributes.usehref || "";
  59836. }
  59837. [_xfa_object.$finalize]() {
  59838. this[_xfa_object.$content] = (0, _utils.getStringOption)(this[_xfa_object.$content], ["auto", "0", "1"]);
  59839. }
  59840. }
  59841. class Manifest extends _xfa_object.XFAObject {
  59842. constructor(attributes) {
  59843. super(TEMPLATE_NS_ID, "manifest", true);
  59844. this.action = (0, _utils.getStringOption)(attributes.action, ["include", "all", "exclude"]);
  59845. this.id = attributes.id || "";
  59846. this.name = attributes.name || "";
  59847. this.use = attributes.use || "";
  59848. this.usehref = attributes.usehref || "";
  59849. this.extras = null;
  59850. this.ref = new _xfa_object.XFAObjectArray();
  59851. }
  59852. }
  59853. class Margin extends _xfa_object.XFAObject {
  59854. constructor(attributes) {
  59855. super(TEMPLATE_NS_ID, "margin", true);
  59856. this.bottomInset = (0, _utils.getMeasurement)(attributes.bottomInset, "0");
  59857. this.id = attributes.id || "";
  59858. this.leftInset = (0, _utils.getMeasurement)(attributes.leftInset, "0");
  59859. this.rightInset = (0, _utils.getMeasurement)(attributes.rightInset, "0");
  59860. this.topInset = (0, _utils.getMeasurement)(attributes.topInset, "0");
  59861. this.use = attributes.use || "";
  59862. this.usehref = attributes.usehref || "";
  59863. this.extras = null;
  59864. }
  59865. [_xfa_object.$toStyle]() {
  59866. return {
  59867. 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)
  59868. };
  59869. }
  59870. }
  59871. class Mdp extends _xfa_object.XFAObject {
  59872. constructor(attributes) {
  59873. super(TEMPLATE_NS_ID, "mdp");
  59874. this.id = attributes.id || "";
  59875. this.permissions = (0, _utils.getInteger)({
  59876. data: attributes.permissions,
  59877. defaultValue: 2,
  59878. validate: x => x === 1 || x === 3
  59879. });
  59880. this.signatureType = (0, _utils.getStringOption)(attributes.signatureType, ["filler", "author"]);
  59881. this.use = attributes.use || "";
  59882. this.usehref = attributes.usehref || "";
  59883. }
  59884. }
  59885. class Medium extends _xfa_object.XFAObject {
  59886. constructor(attributes) {
  59887. super(TEMPLATE_NS_ID, "medium");
  59888. this.id = attributes.id || "";
  59889. this.imagingBBox = (0, _utils.getBBox)(attributes.imagingBBox);
  59890. this.long = (0, _utils.getMeasurement)(attributes.long);
  59891. this.orientation = (0, _utils.getStringOption)(attributes.orientation, ["portrait", "landscape"]);
  59892. this.short = (0, _utils.getMeasurement)(attributes.short);
  59893. this.stock = attributes.stock || "";
  59894. this.trayIn = (0, _utils.getStringOption)(attributes.trayIn, ["auto", "delegate", "pageFront"]);
  59895. this.trayOut = (0, _utils.getStringOption)(attributes.trayOut, ["auto", "delegate"]);
  59896. this.use = attributes.use || "";
  59897. this.usehref = attributes.usehref || "";
  59898. }
  59899. }
  59900. class Message extends _xfa_object.XFAObject {
  59901. constructor(attributes) {
  59902. super(TEMPLATE_NS_ID, "message", true);
  59903. this.id = attributes.id || "";
  59904. this.use = attributes.use || "";
  59905. this.usehref = attributes.usehref || "";
  59906. this.text = new _xfa_object.XFAObjectArray();
  59907. }
  59908. }
  59909. class NumericEdit extends _xfa_object.XFAObject {
  59910. constructor(attributes) {
  59911. super(TEMPLATE_NS_ID, "numericEdit", true);
  59912. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  59913. this.id = attributes.id || "";
  59914. this.use = attributes.use || "";
  59915. this.usehref = attributes.usehref || "";
  59916. this.border = null;
  59917. this.comb = null;
  59918. this.extras = null;
  59919. this.margin = null;
  59920. }
  59921. [_xfa_object.$toHTML](availableSpace) {
  59922. const style = (0, _html_utils.toStyle)(this, "border", "font", "margin");
  59923. const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  59924. const html = {
  59925. name: "input",
  59926. attributes: {
  59927. type: "text",
  59928. fieldId: field[_xfa_object.$uid],
  59929. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  59930. class: ["xfaTextfield"],
  59931. style,
  59932. "aria-label": ariaLabel(field),
  59933. "aria-required": false
  59934. }
  59935. };
  59936. if (isRequired(field)) {
  59937. html.attributes["aria-required"] = true;
  59938. html.attributes.required = true;
  59939. }
  59940. return _utils.HTMLResult.success({
  59941. name: "label",
  59942. attributes: {
  59943. class: ["xfaLabel"]
  59944. },
  59945. children: [html]
  59946. });
  59947. }
  59948. }
  59949. class Occur extends _xfa_object.XFAObject {
  59950. constructor(attributes) {
  59951. super(TEMPLATE_NS_ID, "occur", true);
  59952. this.id = attributes.id || "";
  59953. this.initial = attributes.initial !== "" ? (0, _utils.getInteger)({
  59954. data: attributes.initial,
  59955. defaultValue: "",
  59956. validate: x => true
  59957. }) : "";
  59958. this.max = attributes.max !== "" ? (0, _utils.getInteger)({
  59959. data: attributes.max,
  59960. defaultValue: 1,
  59961. validate: x => true
  59962. }) : "";
  59963. this.min = attributes.min !== "" ? (0, _utils.getInteger)({
  59964. data: attributes.min,
  59965. defaultValue: 1,
  59966. validate: x => true
  59967. }) : "";
  59968. this.use = attributes.use || "";
  59969. this.usehref = attributes.usehref || "";
  59970. this.extras = null;
  59971. }
  59972. [_xfa_object.$clean]() {
  59973. const parent = this[_xfa_object.$getParent]();
  59974. const originalMin = this.min;
  59975. if (this.min === "") {
  59976. this.min = parent instanceof PageArea || parent instanceof PageSet ? 0 : 1;
  59977. }
  59978. if (this.max === "") {
  59979. if (originalMin === "") {
  59980. this.max = parent instanceof PageArea || parent instanceof PageSet ? -1 : 1;
  59981. } else {
  59982. this.max = this.min;
  59983. }
  59984. }
  59985. if (this.max !== -1 && this.max < this.min) {
  59986. this.max = this.min;
  59987. }
  59988. if (this.initial === "") {
  59989. this.initial = parent instanceof Template ? 1 : this.min;
  59990. }
  59991. }
  59992. }
  59993. class Oid extends _xfa_object.StringObject {
  59994. constructor(attributes) {
  59995. super(TEMPLATE_NS_ID, "oid");
  59996. this.id = attributes.id || "";
  59997. this.name = attributes.name || "";
  59998. this.use = attributes.use || "";
  59999. this.usehref = attributes.usehref || "";
  60000. }
  60001. }
  60002. class Oids extends _xfa_object.XFAObject {
  60003. constructor(attributes) {
  60004. super(TEMPLATE_NS_ID, "oids", true);
  60005. this.id = attributes.id || "";
  60006. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  60007. this.use = attributes.use || "";
  60008. this.usehref = attributes.usehref || "";
  60009. this.oid = new _xfa_object.XFAObjectArray();
  60010. }
  60011. }
  60012. class Overflow extends _xfa_object.XFAObject {
  60013. constructor(attributes) {
  60014. super(TEMPLATE_NS_ID, "overflow");
  60015. this.id = attributes.id || "";
  60016. this.leader = attributes.leader || "";
  60017. this.target = attributes.target || "";
  60018. this.trailer = attributes.trailer || "";
  60019. this.use = attributes.use || "";
  60020. this.usehref = attributes.usehref || "";
  60021. }
  60022. [_xfa_object.$getExtra]() {
  60023. if (!this[_xfa_object.$extra]) {
  60024. const parent = this[_xfa_object.$getParent]();
  60025. const root = this[_xfa_object.$getTemplateRoot]();
  60026. const target = root[_xfa_object.$searchNode](this.target, parent);
  60027. const leader = root[_xfa_object.$searchNode](this.leader, parent);
  60028. const trailer = root[_xfa_object.$searchNode](this.trailer, parent);
  60029. this[_xfa_object.$extra] = {
  60030. target: target && target[0] || null,
  60031. leader: leader && leader[0] || null,
  60032. trailer: trailer && trailer[0] || null,
  60033. addLeader: false,
  60034. addTrailer: false
  60035. };
  60036. }
  60037. return this[_xfa_object.$extra];
  60038. }
  60039. }
  60040. class PageArea extends _xfa_object.XFAObject {
  60041. constructor(attributes) {
  60042. super(TEMPLATE_NS_ID, "pageArea", true);
  60043. this.blankOrNotBlank = (0, _utils.getStringOption)(attributes.blankOrNotBlank, ["any", "blank", "notBlank"]);
  60044. this.id = attributes.id || "";
  60045. this.initialNumber = (0, _utils.getInteger)({
  60046. data: attributes.initialNumber,
  60047. defaultValue: 1,
  60048. validate: x => true
  60049. });
  60050. this.name = attributes.name || "";
  60051. this.numbered = (0, _utils.getInteger)({
  60052. data: attributes.numbered,
  60053. defaultValue: 1,
  60054. validate: x => true
  60055. });
  60056. this.oddOrEven = (0, _utils.getStringOption)(attributes.oddOrEven, ["any", "even", "odd"]);
  60057. this.pagePosition = (0, _utils.getStringOption)(attributes.pagePosition, ["any", "first", "last", "only", "rest"]);
  60058. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  60059. this.use = attributes.use || "";
  60060. this.usehref = attributes.usehref || "";
  60061. this.desc = null;
  60062. this.extras = null;
  60063. this.medium = null;
  60064. this.occur = null;
  60065. this.area = new _xfa_object.XFAObjectArray();
  60066. this.contentArea = new _xfa_object.XFAObjectArray();
  60067. this.draw = new _xfa_object.XFAObjectArray();
  60068. this.exclGroup = new _xfa_object.XFAObjectArray();
  60069. this.field = new _xfa_object.XFAObjectArray();
  60070. this.subform = new _xfa_object.XFAObjectArray();
  60071. }
  60072. [_xfa_object.$isUsable]() {
  60073. if (!this[_xfa_object.$extra]) {
  60074. this[_xfa_object.$extra] = {
  60075. numberOfUse: 0
  60076. };
  60077. return true;
  60078. }
  60079. return !this.occur || this.occur.max === -1 || this[_xfa_object.$extra].numberOfUse < this.occur.max;
  60080. }
  60081. [_xfa_object.$cleanPage]() {
  60082. delete this[_xfa_object.$extra];
  60083. }
  60084. [_xfa_object.$getNextPage]() {
  60085. if (!this[_xfa_object.$extra]) {
  60086. this[_xfa_object.$extra] = {
  60087. numberOfUse: 0
  60088. };
  60089. }
  60090. const parent = this[_xfa_object.$getParent]();
  60091. if (parent.relation === "orderedOccurrence") {
  60092. if (this[_xfa_object.$isUsable]()) {
  60093. this[_xfa_object.$extra].numberOfUse += 1;
  60094. return this;
  60095. }
  60096. }
  60097. return parent[_xfa_object.$getNextPage]();
  60098. }
  60099. [_xfa_object.$getAvailableSpace]() {
  60100. return this[_xfa_object.$extra].space || {
  60101. width: 0,
  60102. height: 0
  60103. };
  60104. }
  60105. [_xfa_object.$toHTML]() {
  60106. if (!this[_xfa_object.$extra]) {
  60107. this[_xfa_object.$extra] = {
  60108. numberOfUse: 1
  60109. };
  60110. }
  60111. const children = [];
  60112. this[_xfa_object.$extra].children = children;
  60113. const style = Object.create(null);
  60114. if (this.medium && this.medium.short && this.medium.long) {
  60115. style.width = (0, _html_utils.measureToString)(this.medium.short);
  60116. style.height = (0, _html_utils.measureToString)(this.medium.long);
  60117. this[_xfa_object.$extra].space = {
  60118. width: this.medium.short,
  60119. height: this.medium.long
  60120. };
  60121. if (this.medium.orientation === "landscape") {
  60122. const x = style.width;
  60123. style.width = style.height;
  60124. style.height = x;
  60125. this[_xfa_object.$extra].space = {
  60126. width: this.medium.long,
  60127. height: this.medium.short
  60128. };
  60129. }
  60130. } else {
  60131. (0, _util.warn)("XFA - No medium specified in pageArea: please file a bug.");
  60132. }
  60133. this[_xfa_object.$childrenToHTML]({
  60134. filter: new Set(["area", "draw", "field", "subform"]),
  60135. include: true
  60136. });
  60137. this[_xfa_object.$childrenToHTML]({
  60138. filter: new Set(["contentArea"]),
  60139. include: true
  60140. });
  60141. return _utils.HTMLResult.success({
  60142. name: "div",
  60143. children,
  60144. attributes: {
  60145. class: ["xfaPage"],
  60146. id: this[_xfa_object.$uid],
  60147. style,
  60148. xfaName: this.name
  60149. }
  60150. });
  60151. }
  60152. }
  60153. class PageSet extends _xfa_object.XFAObject {
  60154. constructor(attributes) {
  60155. super(TEMPLATE_NS_ID, "pageSet", true);
  60156. this.duplexImposition = (0, _utils.getStringOption)(attributes.duplexImposition, ["longEdge", "shortEdge"]);
  60157. this.id = attributes.id || "";
  60158. this.name = attributes.name || "";
  60159. this.relation = (0, _utils.getStringOption)(attributes.relation, ["orderedOccurrence", "duplexPaginated", "simplexPaginated"]);
  60160. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  60161. this.use = attributes.use || "";
  60162. this.usehref = attributes.usehref || "";
  60163. this.extras = null;
  60164. this.occur = null;
  60165. this.pageArea = new _xfa_object.XFAObjectArray();
  60166. this.pageSet = new _xfa_object.XFAObjectArray();
  60167. }
  60168. [_xfa_object.$cleanPage]() {
  60169. for (const page of this.pageArea.children) {
  60170. page[_xfa_object.$cleanPage]();
  60171. }
  60172. for (const page of this.pageSet.children) {
  60173. page[_xfa_object.$cleanPage]();
  60174. }
  60175. }
  60176. [_xfa_object.$isUsable]() {
  60177. return !this.occur || this.occur.max === -1 || this[_xfa_object.$extra].numberOfUse < this.occur.max;
  60178. }
  60179. [_xfa_object.$getNextPage]() {
  60180. if (!this[_xfa_object.$extra]) {
  60181. this[_xfa_object.$extra] = {
  60182. numberOfUse: 1,
  60183. pageIndex: -1,
  60184. pageSetIndex: -1
  60185. };
  60186. }
  60187. if (this.relation === "orderedOccurrence") {
  60188. if (this[_xfa_object.$extra].pageIndex + 1 < this.pageArea.children.length) {
  60189. this[_xfa_object.$extra].pageIndex += 1;
  60190. const pageArea = this.pageArea.children[this[_xfa_object.$extra].pageIndex];
  60191. return pageArea[_xfa_object.$getNextPage]();
  60192. }
  60193. if (this[_xfa_object.$extra].pageSetIndex + 1 < this.pageSet.children.length) {
  60194. this[_xfa_object.$extra].pageSetIndex += 1;
  60195. return this.pageSet.children[this[_xfa_object.$extra].pageSetIndex][_xfa_object.$getNextPage]();
  60196. }
  60197. if (this[_xfa_object.$isUsable]()) {
  60198. this[_xfa_object.$extra].numberOfUse += 1;
  60199. this[_xfa_object.$extra].pageIndex = -1;
  60200. this[_xfa_object.$extra].pageSetIndex = -1;
  60201. return this[_xfa_object.$getNextPage]();
  60202. }
  60203. const parent = this[_xfa_object.$getParent]();
  60204. if (parent instanceof PageSet) {
  60205. return parent[_xfa_object.$getNextPage]();
  60206. }
  60207. this[_xfa_object.$cleanPage]();
  60208. return this[_xfa_object.$getNextPage]();
  60209. }
  60210. const pageNumber = this[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].pageNumber;
  60211. const parity = pageNumber % 2 === 0 ? "even" : "odd";
  60212. const position = pageNumber === 0 ? "first" : "rest";
  60213. let page = this.pageArea.children.find(p => p.oddOrEven === parity && p.pagePosition === position);
  60214. if (page) {
  60215. return page;
  60216. }
  60217. page = this.pageArea.children.find(p => p.oddOrEven === "any" && p.pagePosition === position);
  60218. if (page) {
  60219. return page;
  60220. }
  60221. page = this.pageArea.children.find(p => p.oddOrEven === "any" && p.pagePosition === "any");
  60222. if (page) {
  60223. return page;
  60224. }
  60225. return this.pageArea.children[0];
  60226. }
  60227. }
  60228. class Para extends _xfa_object.XFAObject {
  60229. constructor(attributes) {
  60230. super(TEMPLATE_NS_ID, "para", true);
  60231. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  60232. this.id = attributes.id || "";
  60233. this.lineHeight = attributes.lineHeight ? (0, _utils.getMeasurement)(attributes.lineHeight, "0pt") : "";
  60234. this.marginLeft = attributes.marginLeft ? (0, _utils.getMeasurement)(attributes.marginLeft, "0pt") : "";
  60235. this.marginRight = attributes.marginRight ? (0, _utils.getMeasurement)(attributes.marginRight, "0pt") : "";
  60236. this.orphans = (0, _utils.getInteger)({
  60237. data: attributes.orphans,
  60238. defaultValue: 0,
  60239. validate: x => x >= 0
  60240. });
  60241. this.preserve = attributes.preserve || "";
  60242. this.radixOffset = attributes.radixOffset ? (0, _utils.getMeasurement)(attributes.radixOffset, "0pt") : "";
  60243. this.spaceAbove = attributes.spaceAbove ? (0, _utils.getMeasurement)(attributes.spaceAbove, "0pt") : "";
  60244. this.spaceBelow = attributes.spaceBelow ? (0, _utils.getMeasurement)(attributes.spaceBelow, "0pt") : "";
  60245. this.tabDefault = attributes.tabDefault ? (0, _utils.getMeasurement)(this.tabDefault) : "";
  60246. this.tabStops = (attributes.tabStops || "").trim().split(/\s+/).map((x, i) => i % 2 === 1 ? (0, _utils.getMeasurement)(x) : x);
  60247. this.textIndent = attributes.textIndent ? (0, _utils.getMeasurement)(attributes.textIndent, "0pt") : "";
  60248. this.use = attributes.use || "";
  60249. this.usehref = attributes.usehref || "";
  60250. this.vAlign = (0, _utils.getStringOption)(attributes.vAlign, ["top", "bottom", "middle"]);
  60251. this.widows = (0, _utils.getInteger)({
  60252. data: attributes.widows,
  60253. defaultValue: 0,
  60254. validate: x => x >= 0
  60255. });
  60256. this.hyphenation = null;
  60257. }
  60258. [_xfa_object.$toStyle]() {
  60259. const style = (0, _html_utils.toStyle)(this, "hAlign");
  60260. if (this.marginLeft !== "") {
  60261. style.paddingLeft = (0, _html_utils.measureToString)(this.marginLeft);
  60262. }
  60263. if (this.marginRight !== "") {
  60264. style.paddingight = (0, _html_utils.measureToString)(this.marginRight);
  60265. }
  60266. if (this.spaceAbove !== "") {
  60267. style.paddingTop = (0, _html_utils.measureToString)(this.spaceAbove);
  60268. }
  60269. if (this.spaceBelow !== "") {
  60270. style.paddingBottom = (0, _html_utils.measureToString)(this.spaceBelow);
  60271. }
  60272. if (this.textIndent !== "") {
  60273. style.textIndent = (0, _html_utils.measureToString)(this.textIndent);
  60274. (0, _html_utils.fixTextIndent)(style);
  60275. }
  60276. if (this.lineHeight > 0) {
  60277. style.lineHeight = (0, _html_utils.measureToString)(this.lineHeight);
  60278. }
  60279. if (this.tabDefault !== "") {
  60280. style.tabSize = (0, _html_utils.measureToString)(this.tabDefault);
  60281. }
  60282. if (this.tabStops.length > 0) {}
  60283. if (this.hyphenatation) {
  60284. Object.assign(style, this.hyphenatation[_xfa_object.$toStyle]());
  60285. }
  60286. return style;
  60287. }
  60288. }
  60289. class PasswordEdit extends _xfa_object.XFAObject {
  60290. constructor(attributes) {
  60291. super(TEMPLATE_NS_ID, "passwordEdit", true);
  60292. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  60293. this.id = attributes.id || "";
  60294. this.passwordChar = attributes.passwordChar || "*";
  60295. this.use = attributes.use || "";
  60296. this.usehref = attributes.usehref || "";
  60297. this.border = null;
  60298. this.extras = null;
  60299. this.margin = null;
  60300. }
  60301. }
  60302. class Pattern extends _xfa_object.XFAObject {
  60303. constructor(attributes) {
  60304. super(TEMPLATE_NS_ID, "pattern", true);
  60305. this.id = attributes.id || "";
  60306. this.type = (0, _utils.getStringOption)(attributes.type, ["crossHatch", "crossDiagonal", "diagonalLeft", "diagonalRight", "horizontal", "vertical"]);
  60307. this.use = attributes.use || "";
  60308. this.usehref = attributes.usehref || "";
  60309. this.color = null;
  60310. this.extras = null;
  60311. }
  60312. [_xfa_object.$toStyle](startColor) {
  60313. startColor = startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  60314. const endColor = this.color ? this.color[_xfa_object.$toStyle]() : "#000000";
  60315. const width = 5;
  60316. const cmd = "repeating-linear-gradient";
  60317. const colors = `${startColor},${startColor} ${width}px,${endColor} ${width}px,${endColor} ${2 * width}px`;
  60318. switch (this.type) {
  60319. case "crossHatch":
  60320. return `${cmd}(to top,${colors}) ${cmd}(to right,${colors})`;
  60321. case "crossDiagonal":
  60322. return `${cmd}(45deg,${colors}) ${cmd}(-45deg,${colors})`;
  60323. case "diagonalLeft":
  60324. return `${cmd}(45deg,${colors})`;
  60325. case "diagonalRight":
  60326. return `${cmd}(-45deg,${colors})`;
  60327. case "horizontal":
  60328. return `${cmd}(to top,${colors})`;
  60329. case "vertical":
  60330. return `${cmd}(to right,${colors})`;
  60331. }
  60332. return "";
  60333. }
  60334. }
  60335. class Picture extends _xfa_object.StringObject {
  60336. constructor(attributes) {
  60337. super(TEMPLATE_NS_ID, "picture");
  60338. this.id = attributes.id || "";
  60339. this.use = attributes.use || "";
  60340. this.usehref = attributes.usehref || "";
  60341. }
  60342. }
  60343. class Proto extends _xfa_object.XFAObject {
  60344. constructor(attributes) {
  60345. super(TEMPLATE_NS_ID, "proto", true);
  60346. this.appearanceFilter = new _xfa_object.XFAObjectArray();
  60347. this.arc = new _xfa_object.XFAObjectArray();
  60348. this.area = new _xfa_object.XFAObjectArray();
  60349. this.assist = new _xfa_object.XFAObjectArray();
  60350. this.barcode = new _xfa_object.XFAObjectArray();
  60351. this.bindItems = new _xfa_object.XFAObjectArray();
  60352. this.bookend = new _xfa_object.XFAObjectArray();
  60353. this.boolean = new _xfa_object.XFAObjectArray();
  60354. this.border = new _xfa_object.XFAObjectArray();
  60355. this.break = new _xfa_object.XFAObjectArray();
  60356. this.breakAfter = new _xfa_object.XFAObjectArray();
  60357. this.breakBefore = new _xfa_object.XFAObjectArray();
  60358. this.button = new _xfa_object.XFAObjectArray();
  60359. this.calculate = new _xfa_object.XFAObjectArray();
  60360. this.caption = new _xfa_object.XFAObjectArray();
  60361. this.certificate = new _xfa_object.XFAObjectArray();
  60362. this.certificates = new _xfa_object.XFAObjectArray();
  60363. this.checkButton = new _xfa_object.XFAObjectArray();
  60364. this.choiceList = new _xfa_object.XFAObjectArray();
  60365. this.color = new _xfa_object.XFAObjectArray();
  60366. this.comb = new _xfa_object.XFAObjectArray();
  60367. this.connect = new _xfa_object.XFAObjectArray();
  60368. this.contentArea = new _xfa_object.XFAObjectArray();
  60369. this.corner = new _xfa_object.XFAObjectArray();
  60370. this.date = new _xfa_object.XFAObjectArray();
  60371. this.dateTime = new _xfa_object.XFAObjectArray();
  60372. this.dateTimeEdit = new _xfa_object.XFAObjectArray();
  60373. this.decimal = new _xfa_object.XFAObjectArray();
  60374. this.defaultUi = new _xfa_object.XFAObjectArray();
  60375. this.desc = new _xfa_object.XFAObjectArray();
  60376. this.digestMethod = new _xfa_object.XFAObjectArray();
  60377. this.digestMethods = new _xfa_object.XFAObjectArray();
  60378. this.draw = new _xfa_object.XFAObjectArray();
  60379. this.edge = new _xfa_object.XFAObjectArray();
  60380. this.encoding = new _xfa_object.XFAObjectArray();
  60381. this.encodings = new _xfa_object.XFAObjectArray();
  60382. this.encrypt = new _xfa_object.XFAObjectArray();
  60383. this.encryptData = new _xfa_object.XFAObjectArray();
  60384. this.encryption = new _xfa_object.XFAObjectArray();
  60385. this.encryptionMethod = new _xfa_object.XFAObjectArray();
  60386. this.encryptionMethods = new _xfa_object.XFAObjectArray();
  60387. this.event = new _xfa_object.XFAObjectArray();
  60388. this.exData = new _xfa_object.XFAObjectArray();
  60389. this.exObject = new _xfa_object.XFAObjectArray();
  60390. this.exclGroup = new _xfa_object.XFAObjectArray();
  60391. this.execute = new _xfa_object.XFAObjectArray();
  60392. this.extras = new _xfa_object.XFAObjectArray();
  60393. this.field = new _xfa_object.XFAObjectArray();
  60394. this.fill = new _xfa_object.XFAObjectArray();
  60395. this.filter = new _xfa_object.XFAObjectArray();
  60396. this.float = new _xfa_object.XFAObjectArray();
  60397. this.font = new _xfa_object.XFAObjectArray();
  60398. this.format = new _xfa_object.XFAObjectArray();
  60399. this.handler = new _xfa_object.XFAObjectArray();
  60400. this.hyphenation = new _xfa_object.XFAObjectArray();
  60401. this.image = new _xfa_object.XFAObjectArray();
  60402. this.imageEdit = new _xfa_object.XFAObjectArray();
  60403. this.integer = new _xfa_object.XFAObjectArray();
  60404. this.issuers = new _xfa_object.XFAObjectArray();
  60405. this.items = new _xfa_object.XFAObjectArray();
  60406. this.keep = new _xfa_object.XFAObjectArray();
  60407. this.keyUsage = new _xfa_object.XFAObjectArray();
  60408. this.line = new _xfa_object.XFAObjectArray();
  60409. this.linear = new _xfa_object.XFAObjectArray();
  60410. this.lockDocument = new _xfa_object.XFAObjectArray();
  60411. this.manifest = new _xfa_object.XFAObjectArray();
  60412. this.margin = new _xfa_object.XFAObjectArray();
  60413. this.mdp = new _xfa_object.XFAObjectArray();
  60414. this.medium = new _xfa_object.XFAObjectArray();
  60415. this.message = new _xfa_object.XFAObjectArray();
  60416. this.numericEdit = new _xfa_object.XFAObjectArray();
  60417. this.occur = new _xfa_object.XFAObjectArray();
  60418. this.oid = new _xfa_object.XFAObjectArray();
  60419. this.oids = new _xfa_object.XFAObjectArray();
  60420. this.overflow = new _xfa_object.XFAObjectArray();
  60421. this.pageArea = new _xfa_object.XFAObjectArray();
  60422. this.pageSet = new _xfa_object.XFAObjectArray();
  60423. this.para = new _xfa_object.XFAObjectArray();
  60424. this.passwordEdit = new _xfa_object.XFAObjectArray();
  60425. this.pattern = new _xfa_object.XFAObjectArray();
  60426. this.picture = new _xfa_object.XFAObjectArray();
  60427. this.radial = new _xfa_object.XFAObjectArray();
  60428. this.reason = new _xfa_object.XFAObjectArray();
  60429. this.reasons = new _xfa_object.XFAObjectArray();
  60430. this.rectangle = new _xfa_object.XFAObjectArray();
  60431. this.ref = new _xfa_object.XFAObjectArray();
  60432. this.script = new _xfa_object.XFAObjectArray();
  60433. this.setProperty = new _xfa_object.XFAObjectArray();
  60434. this.signData = new _xfa_object.XFAObjectArray();
  60435. this.signature = new _xfa_object.XFAObjectArray();
  60436. this.signing = new _xfa_object.XFAObjectArray();
  60437. this.solid = new _xfa_object.XFAObjectArray();
  60438. this.speak = new _xfa_object.XFAObjectArray();
  60439. this.stipple = new _xfa_object.XFAObjectArray();
  60440. this.subform = new _xfa_object.XFAObjectArray();
  60441. this.subformSet = new _xfa_object.XFAObjectArray();
  60442. this.subjectDN = new _xfa_object.XFAObjectArray();
  60443. this.subjectDNs = new _xfa_object.XFAObjectArray();
  60444. this.submit = new _xfa_object.XFAObjectArray();
  60445. this.text = new _xfa_object.XFAObjectArray();
  60446. this.textEdit = new _xfa_object.XFAObjectArray();
  60447. this.time = new _xfa_object.XFAObjectArray();
  60448. this.timeStamp = new _xfa_object.XFAObjectArray();
  60449. this.toolTip = new _xfa_object.XFAObjectArray();
  60450. this.traversal = new _xfa_object.XFAObjectArray();
  60451. this.traverse = new _xfa_object.XFAObjectArray();
  60452. this.ui = new _xfa_object.XFAObjectArray();
  60453. this.validate = new _xfa_object.XFAObjectArray();
  60454. this.value = new _xfa_object.XFAObjectArray();
  60455. this.variables = new _xfa_object.XFAObjectArray();
  60456. }
  60457. }
  60458. class Radial extends _xfa_object.XFAObject {
  60459. constructor(attributes) {
  60460. super(TEMPLATE_NS_ID, "radial", true);
  60461. this.id = attributes.id || "";
  60462. this.type = (0, _utils.getStringOption)(attributes.type, ["toEdge", "toCenter"]);
  60463. this.use = attributes.use || "";
  60464. this.usehref = attributes.usehref || "";
  60465. this.color = null;
  60466. this.extras = null;
  60467. }
  60468. [_xfa_object.$toStyle](startColor) {
  60469. startColor = startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  60470. const endColor = this.color ? this.color[_xfa_object.$toStyle]() : "#000000";
  60471. const colors = this.type === "toEdge" ? `${startColor},${endColor}` : `${endColor},${startColor}`;
  60472. return `radial-gradient(circle at center, ${colors})`;
  60473. }
  60474. }
  60475. class Reason extends _xfa_object.StringObject {
  60476. constructor(attributes) {
  60477. super(TEMPLATE_NS_ID, "reason");
  60478. this.id = attributes.id || "";
  60479. this.name = attributes.name || "";
  60480. this.use = attributes.use || "";
  60481. this.usehref = attributes.usehref || "";
  60482. }
  60483. }
  60484. class Reasons extends _xfa_object.XFAObject {
  60485. constructor(attributes) {
  60486. super(TEMPLATE_NS_ID, "reasons", true);
  60487. this.id = attributes.id || "";
  60488. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  60489. this.use = attributes.use || "";
  60490. this.usehref = attributes.usehref || "";
  60491. this.reason = new _xfa_object.XFAObjectArray();
  60492. }
  60493. }
  60494. class Rectangle extends _xfa_object.XFAObject {
  60495. constructor(attributes) {
  60496. super(TEMPLATE_NS_ID, "rectangle", true);
  60497. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  60498. this.id = attributes.id || "";
  60499. this.use = attributes.use || "";
  60500. this.usehref = attributes.usehref || "";
  60501. this.corner = new _xfa_object.XFAObjectArray(4);
  60502. this.edge = new _xfa_object.XFAObjectArray(4);
  60503. this.fill = null;
  60504. }
  60505. [_xfa_object.$toHTML]() {
  60506. const edge = this.edge.children.length ? this.edge.children[0] : new Edge({});
  60507. const edgeStyle = edge[_xfa_object.$toStyle]();
  60508. const style = Object.create(null);
  60509. if (this.fill && this.fill.presence === "visible") {
  60510. Object.assign(style, this.fill[_xfa_object.$toStyle]());
  60511. } else {
  60512. style.fill = "transparent";
  60513. }
  60514. style.strokeWidth = (0, _html_utils.measureToString)(edge.presence === "visible" ? edge.thickness : 0);
  60515. style.stroke = edgeStyle.color;
  60516. const corner = this.corner.children.length ? this.corner.children[0] : new Corner({});
  60517. const cornerStyle = corner[_xfa_object.$toStyle]();
  60518. const rect = {
  60519. name: "rect",
  60520. attributes: {
  60521. xmlns: SVG_NS,
  60522. width: "100%",
  60523. height: "100%",
  60524. x: 0,
  60525. y: 0,
  60526. rx: cornerStyle.radius,
  60527. ry: cornerStyle.radius,
  60528. style
  60529. }
  60530. };
  60531. const svg = {
  60532. name: "svg",
  60533. children: [rect],
  60534. attributes: {
  60535. xmlns: SVG_NS,
  60536. style: {
  60537. overflow: "visible"
  60538. },
  60539. width: "100%",
  60540. height: "100%"
  60541. }
  60542. };
  60543. const parent = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  60544. if (hasMargin(parent)) {
  60545. return _utils.HTMLResult.success({
  60546. name: "div",
  60547. attributes: {
  60548. style: {
  60549. display: "inline",
  60550. width: "100%",
  60551. height: "100%"
  60552. }
  60553. },
  60554. children: [svg]
  60555. });
  60556. }
  60557. svg.attributes.style.position = "absolute";
  60558. return _utils.HTMLResult.success(svg);
  60559. }
  60560. }
  60561. class RefElement extends _xfa_object.StringObject {
  60562. constructor(attributes) {
  60563. super(TEMPLATE_NS_ID, "ref");
  60564. this.id = attributes.id || "";
  60565. this.use = attributes.use || "";
  60566. this.usehref = attributes.usehref || "";
  60567. }
  60568. }
  60569. class Script extends _xfa_object.StringObject {
  60570. constructor(attributes) {
  60571. super(TEMPLATE_NS_ID, "script");
  60572. this.binding = attributes.binding || "";
  60573. this.contentType = attributes.contentType || "";
  60574. this.id = attributes.id || "";
  60575. this.name = attributes.name || "";
  60576. this.runAt = (0, _utils.getStringOption)(attributes.runAt, ["client", "both", "server"]);
  60577. this.use = attributes.use || "";
  60578. this.usehref = attributes.usehref || "";
  60579. }
  60580. }
  60581. class SetProperty extends _xfa_object.XFAObject {
  60582. constructor(attributes) {
  60583. super(TEMPLATE_NS_ID, "setProperty");
  60584. this.connection = attributes.connection || "";
  60585. this.ref = attributes.ref || "";
  60586. this.target = attributes.target || "";
  60587. }
  60588. }
  60589. exports.SetProperty = SetProperty;
  60590. class SignData extends _xfa_object.XFAObject {
  60591. constructor(attributes) {
  60592. super(TEMPLATE_NS_ID, "signData", true);
  60593. this.id = attributes.id || "";
  60594. this.operation = (0, _utils.getStringOption)(attributes.operation, ["sign", "clear", "verify"]);
  60595. this.ref = attributes.ref || "";
  60596. this.target = attributes.target || "";
  60597. this.use = attributes.use || "";
  60598. this.usehref = attributes.usehref || "";
  60599. this.filter = null;
  60600. this.manifest = null;
  60601. }
  60602. }
  60603. class Signature extends _xfa_object.XFAObject {
  60604. constructor(attributes) {
  60605. super(TEMPLATE_NS_ID, "signature", true);
  60606. this.id = attributes.id || "";
  60607. this.type = (0, _utils.getStringOption)(attributes.type, ["PDF1.3", "PDF1.6"]);
  60608. this.use = attributes.use || "";
  60609. this.usehref = attributes.usehref || "";
  60610. this.border = null;
  60611. this.extras = null;
  60612. this.filter = null;
  60613. this.manifest = null;
  60614. this.margin = null;
  60615. }
  60616. }
  60617. class Signing extends _xfa_object.XFAObject {
  60618. constructor(attributes) {
  60619. super(TEMPLATE_NS_ID, "signing", true);
  60620. this.id = attributes.id || "";
  60621. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  60622. this.use = attributes.use || "";
  60623. this.usehref = attributes.usehref || "";
  60624. this.certificate = new _xfa_object.XFAObjectArray();
  60625. }
  60626. }
  60627. class Solid extends _xfa_object.XFAObject {
  60628. constructor(attributes) {
  60629. super(TEMPLATE_NS_ID, "solid", true);
  60630. this.id = attributes.id || "";
  60631. this.use = attributes.use || "";
  60632. this.usehref = attributes.usehref || "";
  60633. this.extras = null;
  60634. }
  60635. [_xfa_object.$toStyle](startColor) {
  60636. return startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  60637. }
  60638. }
  60639. class Speak extends _xfa_object.StringObject {
  60640. constructor(attributes) {
  60641. super(TEMPLATE_NS_ID, "speak");
  60642. this.disable = (0, _utils.getInteger)({
  60643. data: attributes.disable,
  60644. defaultValue: 0,
  60645. validate: x => x === 1
  60646. });
  60647. this.id = attributes.id || "";
  60648. this.priority = (0, _utils.getStringOption)(attributes.priority, ["custom", "caption", "name", "toolTip"]);
  60649. this.rid = attributes.rid || "";
  60650. this.use = attributes.use || "";
  60651. this.usehref = attributes.usehref || "";
  60652. }
  60653. }
  60654. class Stipple extends _xfa_object.XFAObject {
  60655. constructor(attributes) {
  60656. super(TEMPLATE_NS_ID, "stipple", true);
  60657. this.id = attributes.id || "";
  60658. this.rate = (0, _utils.getInteger)({
  60659. data: attributes.rate,
  60660. defaultValue: 50,
  60661. validate: x => x >= 0 && x <= 100
  60662. });
  60663. this.use = attributes.use || "";
  60664. this.usehref = attributes.usehref || "";
  60665. this.color = null;
  60666. this.extras = null;
  60667. }
  60668. [_xfa_object.$toStyle](bgColor) {
  60669. const alpha = this.rate / 100;
  60670. 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));
  60671. }
  60672. }
  60673. class Subform extends _xfa_object.XFAObject {
  60674. constructor(attributes) {
  60675. super(TEMPLATE_NS_ID, "subform", true);
  60676. this.access = (0, _utils.getStringOption)(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]);
  60677. this.allowMacro = (0, _utils.getInteger)({
  60678. data: attributes.allowMacro,
  60679. defaultValue: 0,
  60680. validate: x => x === 1
  60681. });
  60682. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  60683. this.colSpan = (0, _utils.getInteger)({
  60684. data: attributes.colSpan,
  60685. defaultValue: 1,
  60686. validate: n => n >= 1 || n === -1
  60687. });
  60688. this.columnWidths = (attributes.columnWidths || "").trim().split(/\s+/).map(x => x === "-1" ? -1 : (0, _utils.getMeasurement)(x));
  60689. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  60690. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  60691. this.id = attributes.id || "";
  60692. this.layout = (0, _utils.getStringOption)(attributes.layout, ["position", "lr-tb", "rl-row", "rl-tb", "row", "table", "tb"]);
  60693. this.locale = attributes.locale || "";
  60694. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  60695. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  60696. this.mergeMode = (0, _utils.getStringOption)(attributes.mergeMode, ["consumeData", "matchTemplate"]);
  60697. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  60698. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  60699. this.name = attributes.name || "";
  60700. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  60701. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  60702. this.restoreState = (0, _utils.getStringOption)(attributes.restoreState, ["manual", "auto"]);
  60703. this.scope = (0, _utils.getStringOption)(attributes.scope, ["name", "none"]);
  60704. this.use = attributes.use || "";
  60705. this.usehref = attributes.usehref || "";
  60706. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  60707. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  60708. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  60709. this.assist = null;
  60710. this.bind = null;
  60711. this.bookend = null;
  60712. this.border = null;
  60713. this.break = null;
  60714. this.calculate = null;
  60715. this.desc = null;
  60716. this.extras = null;
  60717. this.keep = null;
  60718. this.margin = null;
  60719. this.occur = null;
  60720. this.overflow = null;
  60721. this.pageSet = null;
  60722. this.para = null;
  60723. this.traversal = null;
  60724. this.validate = null;
  60725. this.variables = null;
  60726. this.area = new _xfa_object.XFAObjectArray();
  60727. this.breakAfter = new _xfa_object.XFAObjectArray();
  60728. this.breakBefore = new _xfa_object.XFAObjectArray();
  60729. this.connect = new _xfa_object.XFAObjectArray();
  60730. this.draw = new _xfa_object.XFAObjectArray();
  60731. this.event = new _xfa_object.XFAObjectArray();
  60732. this.exObject = new _xfa_object.XFAObjectArray();
  60733. this.exclGroup = new _xfa_object.XFAObjectArray();
  60734. this.field = new _xfa_object.XFAObjectArray();
  60735. this.proto = new _xfa_object.XFAObjectArray();
  60736. this.setProperty = new _xfa_object.XFAObjectArray();
  60737. this.subform = new _xfa_object.XFAObjectArray();
  60738. this.subformSet = new _xfa_object.XFAObjectArray();
  60739. }
  60740. [_xfa_object.$getSubformParent]() {
  60741. const parent = this[_xfa_object.$getParent]();
  60742. if (parent instanceof SubformSet) {
  60743. return parent[_xfa_object.$getSubformParent]();
  60744. }
  60745. return parent;
  60746. }
  60747. [_xfa_object.$isBindable]() {
  60748. return true;
  60749. }
  60750. [_xfa_object.$isThereMoreWidth]() {
  60751. return this.layout.endsWith("-tb") && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine > 0 || this[_xfa_object.$getParent]()[_xfa_object.$isThereMoreWidth]();
  60752. }
  60753. *[_xfa_object.$getContainedChildren]() {
  60754. yield* getContainedChildren(this);
  60755. }
  60756. [_xfa_object.$flushHTML]() {
  60757. return (0, _layout.flushHTML)(this);
  60758. }
  60759. [_xfa_object.$addHTML](html, bbox) {
  60760. (0, _layout.addHTML)(this, html, bbox);
  60761. }
  60762. [_xfa_object.$getAvailableSpace]() {
  60763. return (0, _layout.getAvailableSpace)(this);
  60764. }
  60765. [_xfa_object.$isSplittable]() {
  60766. const parent = this[_xfa_object.$getSubformParent]();
  60767. if (!parent[_xfa_object.$isSplittable]()) {
  60768. return false;
  60769. }
  60770. if (this[_xfa_object.$extra]._isSplittable !== undefined) {
  60771. return this[_xfa_object.$extra]._isSplittable;
  60772. }
  60773. if (this.layout === "position" || this.layout.includes("row")) {
  60774. this[_xfa_object.$extra]._isSplittable = false;
  60775. return false;
  60776. }
  60777. if (this.keep && this.keep.intact !== "none") {
  60778. this[_xfa_object.$extra]._isSplittable = false;
  60779. return false;
  60780. }
  60781. if (parent.layout && parent.layout.endsWith("-tb") && parent[_xfa_object.$extra].numberInLine !== 0) {
  60782. return false;
  60783. }
  60784. this[_xfa_object.$extra]._isSplittable = true;
  60785. return true;
  60786. }
  60787. [_xfa_object.$toHTML](availableSpace) {
  60788. setTabIndex(this);
  60789. if (this.break) {
  60790. if (this.break.after !== "auto" || this.break.afterTarget !== "") {
  60791. const node = new BreakAfter({
  60792. targetType: this.break.after,
  60793. target: this.break.afterTarget,
  60794. startNew: this.break.startNew.toString()
  60795. });
  60796. node[_xfa_object.$globalData] = this[_xfa_object.$globalData];
  60797. this[_xfa_object.$appendChild](node);
  60798. this.breakAfter.push(node);
  60799. }
  60800. if (this.break.before !== "auto" || this.break.beforeTarget !== "") {
  60801. const node = new BreakBefore({
  60802. targetType: this.break.before,
  60803. target: this.break.beforeTarget,
  60804. startNew: this.break.startNew.toString()
  60805. });
  60806. node[_xfa_object.$globalData] = this[_xfa_object.$globalData];
  60807. this[_xfa_object.$appendChild](node);
  60808. this.breakBefore.push(node);
  60809. }
  60810. if (this.break.overflowTarget !== "") {
  60811. const node = new Overflow({
  60812. target: this.break.overflowTarget,
  60813. leader: this.break.overflowLeader,
  60814. trailer: this.break.overflowTrailer
  60815. });
  60816. node[_xfa_object.$globalData] = this[_xfa_object.$globalData];
  60817. this[_xfa_object.$appendChild](node);
  60818. this.overflow.push(node);
  60819. }
  60820. this[_xfa_object.$removeChild](this.break);
  60821. this.break = null;
  60822. }
  60823. if (this.presence === "hidden" || this.presence === "inactive") {
  60824. return _utils.HTMLResult.EMPTY;
  60825. }
  60826. if (this.breakBefore.children.length > 1 || this.breakAfter.children.length > 1) {
  60827. (0, _util.warn)("XFA - Several breakBefore or breakAfter in subforms: please file a bug.");
  60828. }
  60829. if (this.breakBefore.children.length >= 1) {
  60830. const breakBefore = this.breakBefore.children[0];
  60831. if (handleBreak(breakBefore)) {
  60832. return _utils.HTMLResult.breakNode(breakBefore);
  60833. }
  60834. }
  60835. if (this[_xfa_object.$extra] && this[_xfa_object.$extra].afterBreakAfter) {
  60836. return _utils.HTMLResult.EMPTY;
  60837. }
  60838. (0, _html_utils.fixDimensions)(this);
  60839. const children = [];
  60840. const attributes = {
  60841. id: this[_xfa_object.$uid],
  60842. class: []
  60843. };
  60844. (0, _html_utils.setAccess)(this, attributes.class);
  60845. if (!this[_xfa_object.$extra]) {
  60846. this[_xfa_object.$extra] = Object.create(null);
  60847. }
  60848. Object.assign(this[_xfa_object.$extra], {
  60849. children,
  60850. line: null,
  60851. attributes,
  60852. attempt: 0,
  60853. numberInLine: 0,
  60854. availableSpace: {
  60855. width: Math.min(this.w || Infinity, availableSpace.width),
  60856. height: Math.min(this.h || Infinity, availableSpace.height)
  60857. },
  60858. width: 0,
  60859. height: 0,
  60860. prevHeight: 0,
  60861. currentWidth: 0
  60862. });
  60863. const root = this[_xfa_object.$getTemplateRoot]();
  60864. const savedNoLayoutFailure = root[_xfa_object.$extra].noLayoutFailure;
  60865. const isSplittable = this[_xfa_object.$isSplittable]();
  60866. if (!isSplittable) {
  60867. setFirstUnsplittable(this);
  60868. }
  60869. if (!(0, _layout.checkDimensions)(this, availableSpace)) {
  60870. return _utils.HTMLResult.FAILURE;
  60871. }
  60872. const filter = new Set(["area", "draw", "exclGroup", "field", "subform", "subformSet"]);
  60873. if (this.layout.includes("row")) {
  60874. const columnWidths = this[_xfa_object.$getSubformParent]().columnWidths;
  60875. if (Array.isArray(columnWidths) && columnWidths.length > 0) {
  60876. this[_xfa_object.$extra].columnWidths = columnWidths;
  60877. this[_xfa_object.$extra].currentColumn = 0;
  60878. }
  60879. }
  60880. const style = (0, _html_utils.toStyle)(this, "anchorType", "dimensions", "position", "presence", "border", "margin", "hAlign");
  60881. const classNames = ["xfaSubform"];
  60882. const cl = (0, _html_utils.layoutClass)(this);
  60883. if (cl) {
  60884. classNames.push(cl);
  60885. }
  60886. attributes.style = style;
  60887. attributes.class = classNames;
  60888. if (this.name) {
  60889. attributes.xfaName = this.name;
  60890. }
  60891. if (this.overflow) {
  60892. const overflowExtra = this.overflow[_xfa_object.$getExtra]();
  60893. if (overflowExtra.addLeader) {
  60894. overflowExtra.addLeader = false;
  60895. handleOverflow(this, overflowExtra.leader, availableSpace);
  60896. }
  60897. }
  60898. this[_xfa_object.$pushPara]();
  60899. const isLrTb = this.layout === "lr-tb" || this.layout === "rl-tb";
  60900. const maxRun = isLrTb ? MAX_ATTEMPTS_FOR_LRTB_LAYOUT : 1;
  60901. for (; this[_xfa_object.$extra].attempt < maxRun; this[_xfa_object.$extra].attempt++) {
  60902. if (isLrTb && this[_xfa_object.$extra].attempt === MAX_ATTEMPTS_FOR_LRTB_LAYOUT - 1) {
  60903. this[_xfa_object.$extra].numberInLine = 0;
  60904. }
  60905. const result = this[_xfa_object.$childrenToHTML]({
  60906. filter,
  60907. include: true
  60908. });
  60909. if (result.success) {
  60910. break;
  60911. }
  60912. if (result.isBreak()) {
  60913. this[_xfa_object.$popPara]();
  60914. return result;
  60915. }
  60916. if (isLrTb && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine === 0 && !root[_xfa_object.$extra].noLayoutFailure) {
  60917. this[_xfa_object.$extra].attempt = maxRun;
  60918. break;
  60919. }
  60920. }
  60921. this[_xfa_object.$popPara]();
  60922. if (!isSplittable) {
  60923. unsetFirstUnsplittable(this);
  60924. }
  60925. root[_xfa_object.$extra].noLayoutFailure = savedNoLayoutFailure;
  60926. if (this[_xfa_object.$extra].attempt === maxRun) {
  60927. if (this.overflow) {
  60928. this[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].overflowNode = this.overflow;
  60929. }
  60930. if (!isSplittable) {
  60931. delete this[_xfa_object.$extra];
  60932. }
  60933. return _utils.HTMLResult.FAILURE;
  60934. }
  60935. if (this.overflow) {
  60936. const overflowExtra = this.overflow[_xfa_object.$getExtra]();
  60937. if (overflowExtra.addTrailer) {
  60938. overflowExtra.addTrailer = false;
  60939. handleOverflow(this, overflowExtra.trailer, availableSpace);
  60940. }
  60941. }
  60942. let marginH = 0;
  60943. let marginV = 0;
  60944. if (this.margin) {
  60945. marginH = this.margin.leftInset + this.margin.rightInset;
  60946. marginV = this.margin.topInset + this.margin.bottomInset;
  60947. }
  60948. const width = Math.max(this[_xfa_object.$extra].width + marginH, this.w || 0);
  60949. const height = Math.max(this[_xfa_object.$extra].height + marginV, this.h || 0);
  60950. const bbox = [this.x, this.y, width, height];
  60951. if (this.w === "") {
  60952. style.width = (0, _html_utils.measureToString)(width);
  60953. }
  60954. if (this.h === "") {
  60955. style.height = (0, _html_utils.measureToString)(height);
  60956. }
  60957. if ((style.width === "0px" || style.height === "0px") && children.length === 0) {
  60958. return _utils.HTMLResult.EMPTY;
  60959. }
  60960. const html = {
  60961. name: "div",
  60962. attributes,
  60963. children
  60964. };
  60965. applyAssist(this, attributes);
  60966. const result = _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  60967. if (this.breakAfter.children.length >= 1) {
  60968. const breakAfter = this.breakAfter.children[0];
  60969. if (handleBreak(breakAfter)) {
  60970. this[_xfa_object.$extra].afterBreakAfter = result;
  60971. return _utils.HTMLResult.breakNode(breakAfter);
  60972. }
  60973. }
  60974. delete this[_xfa_object.$extra];
  60975. return result;
  60976. }
  60977. }
  60978. class SubformSet extends _xfa_object.XFAObject {
  60979. constructor(attributes) {
  60980. super(TEMPLATE_NS_ID, "subformSet", true);
  60981. this.id = attributes.id || "";
  60982. this.name = attributes.name || "";
  60983. this.relation = (0, _utils.getStringOption)(attributes.relation, ["ordered", "choice", "unordered"]);
  60984. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  60985. this.use = attributes.use || "";
  60986. this.usehref = attributes.usehref || "";
  60987. this.bookend = null;
  60988. this.break = null;
  60989. this.desc = null;
  60990. this.extras = null;
  60991. this.occur = null;
  60992. this.overflow = null;
  60993. this.breakAfter = new _xfa_object.XFAObjectArray();
  60994. this.breakBefore = new _xfa_object.XFAObjectArray();
  60995. this.subform = new _xfa_object.XFAObjectArray();
  60996. this.subformSet = new _xfa_object.XFAObjectArray();
  60997. }
  60998. *[_xfa_object.$getContainedChildren]() {
  60999. yield* getContainedChildren(this);
  61000. }
  61001. [_xfa_object.$getSubformParent]() {
  61002. let parent = this[_xfa_object.$getParent]();
  61003. while (!(parent instanceof Subform)) {
  61004. parent = parent[_xfa_object.$getParent]();
  61005. }
  61006. return parent;
  61007. }
  61008. [_xfa_object.$isBindable]() {
  61009. return true;
  61010. }
  61011. }
  61012. class SubjectDN extends _xfa_object.ContentObject {
  61013. constructor(attributes) {
  61014. super(TEMPLATE_NS_ID, "subjectDN");
  61015. this.delimiter = attributes.delimiter || ",";
  61016. this.id = attributes.id || "";
  61017. this.name = attributes.name || "";
  61018. this.use = attributes.use || "";
  61019. this.usehref = attributes.usehref || "";
  61020. }
  61021. [_xfa_object.$finalize]() {
  61022. this[_xfa_object.$content] = new Map(this[_xfa_object.$content].split(this.delimiter).map(kv => {
  61023. kv = kv.split("=", 2);
  61024. kv[0] = kv[0].trim();
  61025. return kv;
  61026. }));
  61027. }
  61028. }
  61029. class SubjectDNs extends _xfa_object.XFAObject {
  61030. constructor(attributes) {
  61031. super(TEMPLATE_NS_ID, "subjectDNs", true);
  61032. this.id = attributes.id || "";
  61033. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  61034. this.use = attributes.use || "";
  61035. this.usehref = attributes.usehref || "";
  61036. this.subjectDN = new _xfa_object.XFAObjectArray();
  61037. }
  61038. }
  61039. class Submit extends _xfa_object.XFAObject {
  61040. constructor(attributes) {
  61041. super(TEMPLATE_NS_ID, "submit", true);
  61042. this.embedPDF = (0, _utils.getInteger)({
  61043. data: attributes.embedPDF,
  61044. defaultValue: 0,
  61045. validate: x => x === 1
  61046. });
  61047. this.format = (0, _utils.getStringOption)(attributes.format, ["xdp", "formdata", "pdf", "urlencoded", "xfd", "xml"]);
  61048. this.id = attributes.id || "";
  61049. this.target = attributes.target || "";
  61050. this.textEncoding = (0, _utils.getKeyword)({
  61051. data: attributes.textEncoding ? attributes.textEncoding.toLowerCase() : "",
  61052. defaultValue: "",
  61053. 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}/)
  61054. });
  61055. this.use = attributes.use || "";
  61056. this.usehref = attributes.usehref || "";
  61057. this.xdpContent = attributes.xdpContent || "";
  61058. this.encrypt = null;
  61059. this.encryptData = new _xfa_object.XFAObjectArray();
  61060. this.signData = new _xfa_object.XFAObjectArray();
  61061. }
  61062. }
  61063. class Template extends _xfa_object.XFAObject {
  61064. constructor(attributes) {
  61065. super(TEMPLATE_NS_ID, "template", true);
  61066. this.baseProfile = (0, _utils.getStringOption)(attributes.baseProfile, ["full", "interactiveForms"]);
  61067. this.extras = null;
  61068. this.subform = new _xfa_object.XFAObjectArray();
  61069. }
  61070. [_xfa_object.$finalize]() {
  61071. if (this.subform.children.length === 0) {
  61072. (0, _util.warn)("XFA - No subforms in template node.");
  61073. }
  61074. if (this.subform.children.length >= 2) {
  61075. (0, _util.warn)("XFA - Several subforms in template node: please file a bug.");
  61076. }
  61077. this[_xfa_object.$tabIndex] = DEFAULT_TAB_INDEX;
  61078. }
  61079. [_xfa_object.$isSplittable]() {
  61080. return true;
  61081. }
  61082. [_xfa_object.$searchNode](expr, container) {
  61083. if (expr.startsWith("#")) {
  61084. return [this[_xfa_object.$ids].get(expr.slice(1))];
  61085. }
  61086. return (0, _som.searchNode)(this, container, expr, true, true);
  61087. }
  61088. *[_xfa_object.$toPages]() {
  61089. if (!this.subform.children.length) {
  61090. return _utils.HTMLResult.success({
  61091. name: "div",
  61092. children: []
  61093. });
  61094. }
  61095. this[_xfa_object.$extra] = {
  61096. overflowNode: null,
  61097. firstUnsplittable: null,
  61098. currentContentArea: null,
  61099. currentPageArea: null,
  61100. noLayoutFailure: false,
  61101. pageNumber: 1,
  61102. pagePosition: "first",
  61103. oddOrEven: "odd",
  61104. blankOrNotBlank: "nonBlank",
  61105. paraStack: []
  61106. };
  61107. const root = this.subform.children[0];
  61108. root.pageSet[_xfa_object.$cleanPage]();
  61109. const pageAreas = root.pageSet.pageArea.children;
  61110. const mainHtml = {
  61111. name: "div",
  61112. children: []
  61113. };
  61114. let pageArea = null;
  61115. let breakBefore = null;
  61116. let breakBeforeTarget = null;
  61117. if (root.breakBefore.children.length >= 1) {
  61118. breakBefore = root.breakBefore.children[0];
  61119. breakBeforeTarget = breakBefore.target;
  61120. } else if (root.subform.children.length >= 1 && root.subform.children[0].breakBefore.children.length >= 1) {
  61121. breakBefore = root.subform.children[0].breakBefore.children[0];
  61122. breakBeforeTarget = breakBefore.target;
  61123. } else if (root.break && root.break.beforeTarget) {
  61124. breakBefore = root.break;
  61125. breakBeforeTarget = breakBefore.beforeTarget;
  61126. } else if (root.subform.children.length >= 1 && root.subform.children[0].break && root.subform.children[0].break.beforeTarget) {
  61127. breakBefore = root.subform.children[0].break;
  61128. breakBeforeTarget = breakBefore.beforeTarget;
  61129. }
  61130. if (breakBefore) {
  61131. const target = this[_xfa_object.$searchNode](breakBeforeTarget, breakBefore[_xfa_object.$getParent]());
  61132. if (target instanceof PageArea) {
  61133. pageArea = target;
  61134. breakBefore[_xfa_object.$extra] = {};
  61135. }
  61136. }
  61137. if (!pageArea) {
  61138. pageArea = pageAreas[0];
  61139. }
  61140. pageArea[_xfa_object.$extra] = {
  61141. numberOfUse: 1
  61142. };
  61143. const pageAreaParent = pageArea[_xfa_object.$getParent]();
  61144. pageAreaParent[_xfa_object.$extra] = {
  61145. numberOfUse: 1,
  61146. pageIndex: pageAreaParent.pageArea.children.indexOf(pageArea),
  61147. pageSetIndex: 0
  61148. };
  61149. let targetPageArea;
  61150. let leader = null;
  61151. let trailer = null;
  61152. let hasSomething = true;
  61153. let hasSomethingCounter = 0;
  61154. let startIndex = 0;
  61155. while (true) {
  61156. if (!hasSomething) {
  61157. mainHtml.children.pop();
  61158. if (++hasSomethingCounter === MAX_EMPTY_PAGES) {
  61159. (0, _util.warn)("XFA - Something goes wrong: please file a bug.");
  61160. return mainHtml;
  61161. }
  61162. } else {
  61163. hasSomethingCounter = 0;
  61164. }
  61165. targetPageArea = null;
  61166. this[_xfa_object.$extra].currentPageArea = pageArea;
  61167. const page = pageArea[_xfa_object.$toHTML]().html;
  61168. mainHtml.children.push(page);
  61169. if (leader) {
  61170. this[_xfa_object.$extra].noLayoutFailure = true;
  61171. page.children.push(leader[_xfa_object.$toHTML](pageArea[_xfa_object.$extra].space).html);
  61172. leader = null;
  61173. }
  61174. if (trailer) {
  61175. this[_xfa_object.$extra].noLayoutFailure = true;
  61176. page.children.push(trailer[_xfa_object.$toHTML](pageArea[_xfa_object.$extra].space).html);
  61177. trailer = null;
  61178. }
  61179. const contentAreas = pageArea.contentArea.children;
  61180. const htmlContentAreas = page.children.filter(node => node.attributes.class.includes("xfaContentarea"));
  61181. hasSomething = false;
  61182. this[_xfa_object.$extra].firstUnsplittable = null;
  61183. this[_xfa_object.$extra].noLayoutFailure = false;
  61184. const flush = index => {
  61185. const html = root[_xfa_object.$flushHTML]();
  61186. if (html) {
  61187. hasSomething = hasSomething || html.children && html.children.length !== 0;
  61188. htmlContentAreas[index].children.push(html);
  61189. }
  61190. };
  61191. for (let i = startIndex, ii = contentAreas.length; i < ii; i++) {
  61192. const contentArea = this[_xfa_object.$extra].currentContentArea = contentAreas[i];
  61193. const space = {
  61194. width: contentArea.w,
  61195. height: contentArea.h
  61196. };
  61197. startIndex = 0;
  61198. if (leader) {
  61199. htmlContentAreas[i].children.push(leader[_xfa_object.$toHTML](space).html);
  61200. leader = null;
  61201. }
  61202. if (trailer) {
  61203. htmlContentAreas[i].children.push(trailer[_xfa_object.$toHTML](space).html);
  61204. trailer = null;
  61205. }
  61206. const html = root[_xfa_object.$toHTML](space);
  61207. if (html.success) {
  61208. if (html.html) {
  61209. hasSomething = hasSomething || html.html.children && html.html.children.length !== 0;
  61210. htmlContentAreas[i].children.push(html.html);
  61211. } else if (!hasSomething && mainHtml.children.length > 1) {
  61212. mainHtml.children.pop();
  61213. }
  61214. return mainHtml;
  61215. }
  61216. if (html.isBreak()) {
  61217. const node = html.breakNode;
  61218. flush(i);
  61219. if (node.targetType === "auto") {
  61220. continue;
  61221. }
  61222. if (node.leader) {
  61223. leader = this[_xfa_object.$searchNode](node.leader, node[_xfa_object.$getParent]());
  61224. leader = leader ? leader[0] : null;
  61225. }
  61226. if (node.trailer) {
  61227. trailer = this[_xfa_object.$searchNode](node.trailer, node[_xfa_object.$getParent]());
  61228. trailer = trailer ? trailer[0] : null;
  61229. }
  61230. if (node.targetType === "pageArea") {
  61231. targetPageArea = node[_xfa_object.$extra].target;
  61232. i = Infinity;
  61233. } else if (!node[_xfa_object.$extra].target) {
  61234. i = node[_xfa_object.$extra].index;
  61235. } else {
  61236. targetPageArea = node[_xfa_object.$extra].target;
  61237. startIndex = node[_xfa_object.$extra].index + 1;
  61238. i = Infinity;
  61239. }
  61240. continue;
  61241. }
  61242. if (this[_xfa_object.$extra].overflowNode) {
  61243. const node = this[_xfa_object.$extra].overflowNode;
  61244. this[_xfa_object.$extra].overflowNode = null;
  61245. const overflowExtra = node[_xfa_object.$getExtra]();
  61246. const target = overflowExtra.target;
  61247. overflowExtra.addLeader = overflowExtra.leader !== null;
  61248. overflowExtra.addTrailer = overflowExtra.trailer !== null;
  61249. flush(i);
  61250. const currentIndex = i;
  61251. i = Infinity;
  61252. if (target instanceof PageArea) {
  61253. targetPageArea = target;
  61254. } else if (target instanceof ContentArea) {
  61255. const index = contentAreas.indexOf(target);
  61256. if (index !== -1) {
  61257. if (index > currentIndex) {
  61258. i = index - 1;
  61259. } else {
  61260. startIndex = index;
  61261. }
  61262. } else {
  61263. targetPageArea = target[_xfa_object.$getParent]();
  61264. startIndex = targetPageArea.contentArea.children.indexOf(target);
  61265. }
  61266. }
  61267. continue;
  61268. }
  61269. flush(i);
  61270. }
  61271. this[_xfa_object.$extra].pageNumber += 1;
  61272. if (targetPageArea) {
  61273. if (targetPageArea[_xfa_object.$isUsable]()) {
  61274. targetPageArea[_xfa_object.$extra].numberOfUse += 1;
  61275. } else {
  61276. targetPageArea = null;
  61277. }
  61278. }
  61279. pageArea = targetPageArea || pageArea[_xfa_object.$getNextPage]();
  61280. yield null;
  61281. }
  61282. }
  61283. }
  61284. exports.Template = Template;
  61285. class Text extends _xfa_object.ContentObject {
  61286. constructor(attributes) {
  61287. super(TEMPLATE_NS_ID, "text");
  61288. this.id = attributes.id || "";
  61289. this.maxChars = (0, _utils.getInteger)({
  61290. data: attributes.maxChars,
  61291. defaultValue: 0,
  61292. validate: x => x >= 0
  61293. });
  61294. this.name = attributes.name || "";
  61295. this.rid = attributes.rid || "";
  61296. this.use = attributes.use || "";
  61297. this.usehref = attributes.usehref || "";
  61298. }
  61299. [_xfa_object.$acceptWhitespace]() {
  61300. return true;
  61301. }
  61302. [_xfa_object.$onChild](child) {
  61303. if (child[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.xhtml.id) {
  61304. this[_xfa_object.$content] = child;
  61305. return true;
  61306. }
  61307. (0, _util.warn)(`XFA - Invalid content in Text: ${child[_xfa_object.$nodeName]}.`);
  61308. return false;
  61309. }
  61310. [_xfa_object.$onText](str) {
  61311. if (this[_xfa_object.$content] instanceof _xfa_object.XFAObject) {
  61312. return;
  61313. }
  61314. super[_xfa_object.$onText](str);
  61315. }
  61316. [_xfa_object.$finalize]() {
  61317. if (typeof this[_xfa_object.$content] === "string") {
  61318. this[_xfa_object.$content] = this[_xfa_object.$content].replace(/\r\n/g, "\n");
  61319. }
  61320. }
  61321. [_xfa_object.$getExtra]() {
  61322. if (typeof this[_xfa_object.$content] === "string") {
  61323. return this[_xfa_object.$content].split(/[\u2029\u2028\n]/).reduce((acc, line) => {
  61324. if (line) {
  61325. acc.push(line);
  61326. }
  61327. return acc;
  61328. }, []).join("\n");
  61329. }
  61330. return this[_xfa_object.$content][_xfa_object.$text]();
  61331. }
  61332. [_xfa_object.$toHTML](availableSpace) {
  61333. if (typeof this[_xfa_object.$content] === "string") {
  61334. const html = valueToHtml(this[_xfa_object.$content]).html;
  61335. if (this[_xfa_object.$content].includes("\u2029")) {
  61336. html.name = "div";
  61337. html.children = [];
  61338. this[_xfa_object.$content].split("\u2029").map(para => para.split(/[\u2028\n]/).reduce((acc, line) => {
  61339. acc.push({
  61340. name: "span",
  61341. value: line
  61342. }, {
  61343. name: "br"
  61344. });
  61345. return acc;
  61346. }, [])).forEach(lines => {
  61347. html.children.push({
  61348. name: "p",
  61349. children: lines
  61350. });
  61351. });
  61352. } else if (/[\u2028\n]/.test(this[_xfa_object.$content])) {
  61353. html.name = "div";
  61354. html.children = [];
  61355. this[_xfa_object.$content].split(/[\u2028\n]/).forEach(line => {
  61356. html.children.push({
  61357. name: "span",
  61358. value: line
  61359. }, {
  61360. name: "br"
  61361. });
  61362. });
  61363. }
  61364. return _utils.HTMLResult.success(html);
  61365. }
  61366. return this[_xfa_object.$content][_xfa_object.$toHTML](availableSpace);
  61367. }
  61368. }
  61369. exports.Text = Text;
  61370. class TextEdit extends _xfa_object.XFAObject {
  61371. constructor(attributes) {
  61372. super(TEMPLATE_NS_ID, "textEdit", true);
  61373. this.allowRichText = (0, _utils.getInteger)({
  61374. data: attributes.allowRichText,
  61375. defaultValue: 0,
  61376. validate: x => x === 1
  61377. });
  61378. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  61379. this.id = attributes.id || "";
  61380. this.multiLine = (0, _utils.getInteger)({
  61381. data: attributes.multiLine,
  61382. defaultValue: "",
  61383. validate: x => x === 0 || x === 1
  61384. });
  61385. this.use = attributes.use || "";
  61386. this.usehref = attributes.usehref || "";
  61387. this.vScrollPolicy = (0, _utils.getStringOption)(attributes.vScrollPolicy, ["auto", "off", "on"]);
  61388. this.border = null;
  61389. this.comb = null;
  61390. this.extras = null;
  61391. this.margin = null;
  61392. }
  61393. [_xfa_object.$toHTML](availableSpace) {
  61394. const style = (0, _html_utils.toStyle)(this, "border", "font", "margin");
  61395. let html;
  61396. const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  61397. if (this.multiLine === "") {
  61398. this.multiLine = field instanceof Draw ? 1 : 0;
  61399. }
  61400. if (this.multiLine === 1) {
  61401. html = {
  61402. name: "textarea",
  61403. attributes: {
  61404. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  61405. fieldId: field[_xfa_object.$uid],
  61406. class: ["xfaTextfield"],
  61407. style,
  61408. "aria-label": ariaLabel(field),
  61409. "aria-required": false
  61410. }
  61411. };
  61412. } else {
  61413. html = {
  61414. name: "input",
  61415. attributes: {
  61416. type: "text",
  61417. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  61418. fieldId: field[_xfa_object.$uid],
  61419. class: ["xfaTextfield"],
  61420. style,
  61421. "aria-label": ariaLabel(field),
  61422. "aria-required": false
  61423. }
  61424. };
  61425. }
  61426. if (isRequired(field)) {
  61427. html.attributes["aria-required"] = true;
  61428. html.attributes.required = true;
  61429. }
  61430. return _utils.HTMLResult.success({
  61431. name: "label",
  61432. attributes: {
  61433. class: ["xfaLabel"]
  61434. },
  61435. children: [html]
  61436. });
  61437. }
  61438. }
  61439. class Time extends _xfa_object.StringObject {
  61440. constructor(attributes) {
  61441. super(TEMPLATE_NS_ID, "time");
  61442. this.id = attributes.id || "";
  61443. this.name = attributes.name || "";
  61444. this.use = attributes.use || "";
  61445. this.usehref = attributes.usehref || "";
  61446. }
  61447. [_xfa_object.$finalize]() {
  61448. const date = this[_xfa_object.$content].trim();
  61449. this[_xfa_object.$content] = date ? new Date(date) : null;
  61450. }
  61451. [_xfa_object.$toHTML](availableSpace) {
  61452. return valueToHtml(this[_xfa_object.$content] ? this[_xfa_object.$content].toString() : "");
  61453. }
  61454. }
  61455. class TimeStamp extends _xfa_object.XFAObject {
  61456. constructor(attributes) {
  61457. super(TEMPLATE_NS_ID, "timeStamp");
  61458. this.id = attributes.id || "";
  61459. this.server = attributes.server || "";
  61460. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  61461. this.use = attributes.use || "";
  61462. this.usehref = attributes.usehref || "";
  61463. }
  61464. }
  61465. class ToolTip extends _xfa_object.StringObject {
  61466. constructor(attributes) {
  61467. super(TEMPLATE_NS_ID, "toolTip");
  61468. this.id = attributes.id || "";
  61469. this.rid = attributes.rid || "";
  61470. this.use = attributes.use || "";
  61471. this.usehref = attributes.usehref || "";
  61472. }
  61473. }
  61474. class Traversal extends _xfa_object.XFAObject {
  61475. constructor(attributes) {
  61476. super(TEMPLATE_NS_ID, "traversal", true);
  61477. this.id = attributes.id || "";
  61478. this.use = attributes.use || "";
  61479. this.usehref = attributes.usehref || "";
  61480. this.extras = null;
  61481. this.traverse = new _xfa_object.XFAObjectArray();
  61482. }
  61483. }
  61484. class Traverse extends _xfa_object.XFAObject {
  61485. constructor(attributes) {
  61486. super(TEMPLATE_NS_ID, "traverse", true);
  61487. this.id = attributes.id || "";
  61488. this.operation = (0, _utils.getStringOption)(attributes.operation, ["next", "back", "down", "first", "left", "right", "up"]);
  61489. this.ref = attributes.ref || "";
  61490. this.use = attributes.use || "";
  61491. this.usehref = attributes.usehref || "";
  61492. this.extras = null;
  61493. this.script = null;
  61494. }
  61495. get name() {
  61496. return this.operation;
  61497. }
  61498. [_xfa_object.$isTransparent]() {
  61499. return false;
  61500. }
  61501. }
  61502. class Ui extends _xfa_object.XFAObject {
  61503. constructor(attributes) {
  61504. super(TEMPLATE_NS_ID, "ui", true);
  61505. this.id = attributes.id || "";
  61506. this.use = attributes.use || "";
  61507. this.usehref = attributes.usehref || "";
  61508. this.extras = null;
  61509. this.picture = null;
  61510. this.barcode = null;
  61511. this.button = null;
  61512. this.checkButton = null;
  61513. this.choiceList = null;
  61514. this.dateTimeEdit = null;
  61515. this.defaultUi = null;
  61516. this.imageEdit = null;
  61517. this.numericEdit = null;
  61518. this.passwordEdit = null;
  61519. this.signature = null;
  61520. this.textEdit = null;
  61521. }
  61522. [_xfa_object.$getExtra]() {
  61523. if (this[_xfa_object.$extra] === undefined) {
  61524. for (const name of Object.getOwnPropertyNames(this)) {
  61525. if (name === "extras" || name === "picture") {
  61526. continue;
  61527. }
  61528. const obj = this[name];
  61529. if (!(obj instanceof _xfa_object.XFAObject)) {
  61530. continue;
  61531. }
  61532. this[_xfa_object.$extra] = obj;
  61533. return obj;
  61534. }
  61535. this[_xfa_object.$extra] = null;
  61536. }
  61537. return this[_xfa_object.$extra];
  61538. }
  61539. [_xfa_object.$toHTML](availableSpace) {
  61540. const obj = this[_xfa_object.$getExtra]();
  61541. if (obj) {
  61542. return obj[_xfa_object.$toHTML](availableSpace);
  61543. }
  61544. return _utils.HTMLResult.EMPTY;
  61545. }
  61546. }
  61547. class Validate extends _xfa_object.XFAObject {
  61548. constructor(attributes) {
  61549. super(TEMPLATE_NS_ID, "validate", true);
  61550. this.formatTest = (0, _utils.getStringOption)(attributes.formatTest, ["warning", "disabled", "error"]);
  61551. this.id = attributes.id || "";
  61552. this.nullTest = (0, _utils.getStringOption)(attributes.nullTest, ["disabled", "error", "warning"]);
  61553. this.scriptTest = (0, _utils.getStringOption)(attributes.scriptTest, ["error", "disabled", "warning"]);
  61554. this.use = attributes.use || "";
  61555. this.usehref = attributes.usehref || "";
  61556. this.extras = null;
  61557. this.message = null;
  61558. this.picture = null;
  61559. this.script = null;
  61560. }
  61561. }
  61562. class Value extends _xfa_object.XFAObject {
  61563. constructor(attributes) {
  61564. super(TEMPLATE_NS_ID, "value", true);
  61565. this.id = attributes.id || "";
  61566. this.override = (0, _utils.getInteger)({
  61567. data: attributes.override,
  61568. defaultValue: 0,
  61569. validate: x => x === 1
  61570. });
  61571. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  61572. this.use = attributes.use || "";
  61573. this.usehref = attributes.usehref || "";
  61574. this.arc = null;
  61575. this.boolean = null;
  61576. this.date = null;
  61577. this.dateTime = null;
  61578. this.decimal = null;
  61579. this.exData = null;
  61580. this.float = null;
  61581. this.image = null;
  61582. this.integer = null;
  61583. this.line = null;
  61584. this.rectangle = null;
  61585. this.text = null;
  61586. this.time = null;
  61587. }
  61588. [_xfa_object.$setValue](value) {
  61589. const parent = this[_xfa_object.$getParent]();
  61590. if (parent instanceof Field) {
  61591. if (parent.ui && parent.ui.imageEdit) {
  61592. if (!this.image) {
  61593. this.image = new Image({});
  61594. this[_xfa_object.$appendChild](this.image);
  61595. }
  61596. this.image[_xfa_object.$content] = value[_xfa_object.$content];
  61597. return;
  61598. }
  61599. }
  61600. const valueName = value[_xfa_object.$nodeName];
  61601. if (this[valueName] !== null) {
  61602. this[valueName][_xfa_object.$content] = value[_xfa_object.$content];
  61603. return;
  61604. }
  61605. for (const name of Object.getOwnPropertyNames(this)) {
  61606. const obj = this[name];
  61607. if (obj instanceof _xfa_object.XFAObject) {
  61608. this[name] = null;
  61609. this[_xfa_object.$removeChild](obj);
  61610. }
  61611. }
  61612. this[value[_xfa_object.$nodeName]] = value;
  61613. this[_xfa_object.$appendChild](value);
  61614. }
  61615. [_xfa_object.$text]() {
  61616. if (this.exData) {
  61617. if (typeof this.exData[_xfa_object.$content] === "string") {
  61618. return this.exData[_xfa_object.$content].trim();
  61619. }
  61620. return this.exData[_xfa_object.$content][_xfa_object.$text]().trim();
  61621. }
  61622. for (const name of Object.getOwnPropertyNames(this)) {
  61623. if (name === "image") {
  61624. continue;
  61625. }
  61626. const obj = this[name];
  61627. if (obj instanceof _xfa_object.XFAObject) {
  61628. return (obj[_xfa_object.$content] || "").toString().trim();
  61629. }
  61630. }
  61631. return null;
  61632. }
  61633. [_xfa_object.$toHTML](availableSpace) {
  61634. for (const name of Object.getOwnPropertyNames(this)) {
  61635. const obj = this[name];
  61636. if (!(obj instanceof _xfa_object.XFAObject)) {
  61637. continue;
  61638. }
  61639. return obj[_xfa_object.$toHTML](availableSpace);
  61640. }
  61641. return _utils.HTMLResult.EMPTY;
  61642. }
  61643. }
  61644. exports.Value = Value;
  61645. class Variables extends _xfa_object.XFAObject {
  61646. constructor(attributes) {
  61647. super(TEMPLATE_NS_ID, "variables", true);
  61648. this.id = attributes.id || "";
  61649. this.use = attributes.use || "";
  61650. this.usehref = attributes.usehref || "";
  61651. this.boolean = new _xfa_object.XFAObjectArray();
  61652. this.date = new _xfa_object.XFAObjectArray();
  61653. this.dateTime = new _xfa_object.XFAObjectArray();
  61654. this.decimal = new _xfa_object.XFAObjectArray();
  61655. this.exData = new _xfa_object.XFAObjectArray();
  61656. this.float = new _xfa_object.XFAObjectArray();
  61657. this.image = new _xfa_object.XFAObjectArray();
  61658. this.integer = new _xfa_object.XFAObjectArray();
  61659. this.manifest = new _xfa_object.XFAObjectArray();
  61660. this.script = new _xfa_object.XFAObjectArray();
  61661. this.text = new _xfa_object.XFAObjectArray();
  61662. this.time = new _xfa_object.XFAObjectArray();
  61663. }
  61664. [_xfa_object.$isTransparent]() {
  61665. return true;
  61666. }
  61667. }
  61668. class TemplateNamespace {
  61669. static [_namespaces.$buildXFAObject](name, attributes) {
  61670. if (TemplateNamespace.hasOwnProperty(name)) {
  61671. const node = TemplateNamespace[name](attributes);
  61672. node[_xfa_object.$setSetAttributes](attributes);
  61673. return node;
  61674. }
  61675. return undefined;
  61676. }
  61677. static appearanceFilter(attrs) {
  61678. return new AppearanceFilter(attrs);
  61679. }
  61680. static arc(attrs) {
  61681. return new Arc(attrs);
  61682. }
  61683. static area(attrs) {
  61684. return new Area(attrs);
  61685. }
  61686. static assist(attrs) {
  61687. return new Assist(attrs);
  61688. }
  61689. static barcode(attrs) {
  61690. return new Barcode(attrs);
  61691. }
  61692. static bind(attrs) {
  61693. return new Bind(attrs);
  61694. }
  61695. static bindItems(attrs) {
  61696. return new BindItems(attrs);
  61697. }
  61698. static bookend(attrs) {
  61699. return new Bookend(attrs);
  61700. }
  61701. static boolean(attrs) {
  61702. return new BooleanElement(attrs);
  61703. }
  61704. static border(attrs) {
  61705. return new Border(attrs);
  61706. }
  61707. static break(attrs) {
  61708. return new Break(attrs);
  61709. }
  61710. static breakAfter(attrs) {
  61711. return new BreakAfter(attrs);
  61712. }
  61713. static breakBefore(attrs) {
  61714. return new BreakBefore(attrs);
  61715. }
  61716. static button(attrs) {
  61717. return new Button(attrs);
  61718. }
  61719. static calculate(attrs) {
  61720. return new Calculate(attrs);
  61721. }
  61722. static caption(attrs) {
  61723. return new Caption(attrs);
  61724. }
  61725. static certificate(attrs) {
  61726. return new Certificate(attrs);
  61727. }
  61728. static certificates(attrs) {
  61729. return new Certificates(attrs);
  61730. }
  61731. static checkButton(attrs) {
  61732. return new CheckButton(attrs);
  61733. }
  61734. static choiceList(attrs) {
  61735. return new ChoiceList(attrs);
  61736. }
  61737. static color(attrs) {
  61738. return new Color(attrs);
  61739. }
  61740. static comb(attrs) {
  61741. return new Comb(attrs);
  61742. }
  61743. static connect(attrs) {
  61744. return new Connect(attrs);
  61745. }
  61746. static contentArea(attrs) {
  61747. return new ContentArea(attrs);
  61748. }
  61749. static corner(attrs) {
  61750. return new Corner(attrs);
  61751. }
  61752. static date(attrs) {
  61753. return new DateElement(attrs);
  61754. }
  61755. static dateTime(attrs) {
  61756. return new DateTime(attrs);
  61757. }
  61758. static dateTimeEdit(attrs) {
  61759. return new DateTimeEdit(attrs);
  61760. }
  61761. static decimal(attrs) {
  61762. return new Decimal(attrs);
  61763. }
  61764. static defaultUi(attrs) {
  61765. return new DefaultUi(attrs);
  61766. }
  61767. static desc(attrs) {
  61768. return new Desc(attrs);
  61769. }
  61770. static digestMethod(attrs) {
  61771. return new DigestMethod(attrs);
  61772. }
  61773. static digestMethods(attrs) {
  61774. return new DigestMethods(attrs);
  61775. }
  61776. static draw(attrs) {
  61777. return new Draw(attrs);
  61778. }
  61779. static edge(attrs) {
  61780. return new Edge(attrs);
  61781. }
  61782. static encoding(attrs) {
  61783. return new Encoding(attrs);
  61784. }
  61785. static encodings(attrs) {
  61786. return new Encodings(attrs);
  61787. }
  61788. static encrypt(attrs) {
  61789. return new Encrypt(attrs);
  61790. }
  61791. static encryptData(attrs) {
  61792. return new EncryptData(attrs);
  61793. }
  61794. static encryption(attrs) {
  61795. return new Encryption(attrs);
  61796. }
  61797. static encryptionMethod(attrs) {
  61798. return new EncryptionMethod(attrs);
  61799. }
  61800. static encryptionMethods(attrs) {
  61801. return new EncryptionMethods(attrs);
  61802. }
  61803. static event(attrs) {
  61804. return new Event(attrs);
  61805. }
  61806. static exData(attrs) {
  61807. return new ExData(attrs);
  61808. }
  61809. static exObject(attrs) {
  61810. return new ExObject(attrs);
  61811. }
  61812. static exclGroup(attrs) {
  61813. return new ExclGroup(attrs);
  61814. }
  61815. static execute(attrs) {
  61816. return new Execute(attrs);
  61817. }
  61818. static extras(attrs) {
  61819. return new Extras(attrs);
  61820. }
  61821. static field(attrs) {
  61822. return new Field(attrs);
  61823. }
  61824. static fill(attrs) {
  61825. return new Fill(attrs);
  61826. }
  61827. static filter(attrs) {
  61828. return new Filter(attrs);
  61829. }
  61830. static float(attrs) {
  61831. return new Float(attrs);
  61832. }
  61833. static font(attrs) {
  61834. return new Font(attrs);
  61835. }
  61836. static format(attrs) {
  61837. return new Format(attrs);
  61838. }
  61839. static handler(attrs) {
  61840. return new Handler(attrs);
  61841. }
  61842. static hyphenation(attrs) {
  61843. return new Hyphenation(attrs);
  61844. }
  61845. static image(attrs) {
  61846. return new Image(attrs);
  61847. }
  61848. static imageEdit(attrs) {
  61849. return new ImageEdit(attrs);
  61850. }
  61851. static integer(attrs) {
  61852. return new Integer(attrs);
  61853. }
  61854. static issuers(attrs) {
  61855. return new Issuers(attrs);
  61856. }
  61857. static items(attrs) {
  61858. return new Items(attrs);
  61859. }
  61860. static keep(attrs) {
  61861. return new Keep(attrs);
  61862. }
  61863. static keyUsage(attrs) {
  61864. return new KeyUsage(attrs);
  61865. }
  61866. static line(attrs) {
  61867. return new Line(attrs);
  61868. }
  61869. static linear(attrs) {
  61870. return new Linear(attrs);
  61871. }
  61872. static lockDocument(attrs) {
  61873. return new LockDocument(attrs);
  61874. }
  61875. static manifest(attrs) {
  61876. return new Manifest(attrs);
  61877. }
  61878. static margin(attrs) {
  61879. return new Margin(attrs);
  61880. }
  61881. static mdp(attrs) {
  61882. return new Mdp(attrs);
  61883. }
  61884. static medium(attrs) {
  61885. return new Medium(attrs);
  61886. }
  61887. static message(attrs) {
  61888. return new Message(attrs);
  61889. }
  61890. static numericEdit(attrs) {
  61891. return new NumericEdit(attrs);
  61892. }
  61893. static occur(attrs) {
  61894. return new Occur(attrs);
  61895. }
  61896. static oid(attrs) {
  61897. return new Oid(attrs);
  61898. }
  61899. static oids(attrs) {
  61900. return new Oids(attrs);
  61901. }
  61902. static overflow(attrs) {
  61903. return new Overflow(attrs);
  61904. }
  61905. static pageArea(attrs) {
  61906. return new PageArea(attrs);
  61907. }
  61908. static pageSet(attrs) {
  61909. return new PageSet(attrs);
  61910. }
  61911. static para(attrs) {
  61912. return new Para(attrs);
  61913. }
  61914. static passwordEdit(attrs) {
  61915. return new PasswordEdit(attrs);
  61916. }
  61917. static pattern(attrs) {
  61918. return new Pattern(attrs);
  61919. }
  61920. static picture(attrs) {
  61921. return new Picture(attrs);
  61922. }
  61923. static proto(attrs) {
  61924. return new Proto(attrs);
  61925. }
  61926. static radial(attrs) {
  61927. return new Radial(attrs);
  61928. }
  61929. static reason(attrs) {
  61930. return new Reason(attrs);
  61931. }
  61932. static reasons(attrs) {
  61933. return new Reasons(attrs);
  61934. }
  61935. static rectangle(attrs) {
  61936. return new Rectangle(attrs);
  61937. }
  61938. static ref(attrs) {
  61939. return new RefElement(attrs);
  61940. }
  61941. static script(attrs) {
  61942. return new Script(attrs);
  61943. }
  61944. static setProperty(attrs) {
  61945. return new SetProperty(attrs);
  61946. }
  61947. static signData(attrs) {
  61948. return new SignData(attrs);
  61949. }
  61950. static signature(attrs) {
  61951. return new Signature(attrs);
  61952. }
  61953. static signing(attrs) {
  61954. return new Signing(attrs);
  61955. }
  61956. static solid(attrs) {
  61957. return new Solid(attrs);
  61958. }
  61959. static speak(attrs) {
  61960. return new Speak(attrs);
  61961. }
  61962. static stipple(attrs) {
  61963. return new Stipple(attrs);
  61964. }
  61965. static subform(attrs) {
  61966. return new Subform(attrs);
  61967. }
  61968. static subformSet(attrs) {
  61969. return new SubformSet(attrs);
  61970. }
  61971. static subjectDN(attrs) {
  61972. return new SubjectDN(attrs);
  61973. }
  61974. static subjectDNs(attrs) {
  61975. return new SubjectDNs(attrs);
  61976. }
  61977. static submit(attrs) {
  61978. return new Submit(attrs);
  61979. }
  61980. static template(attrs) {
  61981. return new Template(attrs);
  61982. }
  61983. static text(attrs) {
  61984. return new Text(attrs);
  61985. }
  61986. static textEdit(attrs) {
  61987. return new TextEdit(attrs);
  61988. }
  61989. static time(attrs) {
  61990. return new Time(attrs);
  61991. }
  61992. static timeStamp(attrs) {
  61993. return new TimeStamp(attrs);
  61994. }
  61995. static toolTip(attrs) {
  61996. return new ToolTip(attrs);
  61997. }
  61998. static traversal(attrs) {
  61999. return new Traversal(attrs);
  62000. }
  62001. static traverse(attrs) {
  62002. return new Traverse(attrs);
  62003. }
  62004. static ui(attrs) {
  62005. return new Ui(attrs);
  62006. }
  62007. static validate(attrs) {
  62008. return new Validate(attrs);
  62009. }
  62010. static value(attrs) {
  62011. return new Value(attrs);
  62012. }
  62013. static variables(attrs) {
  62014. return new Variables(attrs);
  62015. }
  62016. }
  62017. exports.TemplateNamespace = TemplateNamespace;
  62018. /***/ }),
  62019. /* 212 */
  62020. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  62021. "use strict";
  62022. Object.defineProperty(exports, "__esModule", ({
  62023. value: true
  62024. }));
  62025. exports.addHTML = addHTML;
  62026. exports.checkDimensions = checkDimensions;
  62027. exports.flushHTML = flushHTML;
  62028. exports.getAvailableSpace = getAvailableSpace;
  62029. var _xfa_object = __w_pdfjs_require__(206);
  62030. var _html_utils = __w_pdfjs_require__(213);
  62031. function createLine(node, children) {
  62032. return {
  62033. name: "div",
  62034. attributes: {
  62035. class: [node.layout === "lr-tb" ? "xfaLr" : "xfaRl"]
  62036. },
  62037. children
  62038. };
  62039. }
  62040. function flushHTML(node) {
  62041. if (!node[_xfa_object.$extra]) {
  62042. return null;
  62043. }
  62044. const attributes = node[_xfa_object.$extra].attributes;
  62045. const html = {
  62046. name: "div",
  62047. attributes,
  62048. children: node[_xfa_object.$extra].children
  62049. };
  62050. if (node[_xfa_object.$extra].failingNode) {
  62051. const htmlFromFailing = node[_xfa_object.$extra].failingNode[_xfa_object.$flushHTML]();
  62052. if (htmlFromFailing) {
  62053. if (node.layout.endsWith("-tb")) {
  62054. html.children.push(createLine(node, [htmlFromFailing]));
  62055. } else {
  62056. html.children.push(htmlFromFailing);
  62057. }
  62058. }
  62059. }
  62060. if (html.children.length === 0) {
  62061. return null;
  62062. }
  62063. return html;
  62064. }
  62065. function addHTML(node, html, bbox) {
  62066. const extra = node[_xfa_object.$extra];
  62067. const availableSpace = extra.availableSpace;
  62068. const [x, y, w, h] = bbox;
  62069. switch (node.layout) {
  62070. case "position":
  62071. {
  62072. extra.width = Math.max(extra.width, x + w);
  62073. extra.height = Math.max(extra.height, y + h);
  62074. extra.children.push(html);
  62075. break;
  62076. }
  62077. case "lr-tb":
  62078. case "rl-tb":
  62079. if (!extra.line || extra.attempt === 1) {
  62080. extra.line = createLine(node, []);
  62081. extra.children.push(extra.line);
  62082. extra.numberInLine = 0;
  62083. }
  62084. extra.numberInLine += 1;
  62085. extra.line.children.push(html);
  62086. if (extra.attempt === 0) {
  62087. extra.currentWidth += w;
  62088. extra.height = Math.max(extra.height, extra.prevHeight + h);
  62089. } else {
  62090. extra.currentWidth = w;
  62091. extra.prevHeight = extra.height;
  62092. extra.height += h;
  62093. extra.attempt = 0;
  62094. }
  62095. extra.width = Math.max(extra.width, extra.currentWidth);
  62096. break;
  62097. case "rl-row":
  62098. case "row":
  62099. {
  62100. extra.children.push(html);
  62101. extra.width += w;
  62102. extra.height = Math.max(extra.height, h);
  62103. const height = (0, _html_utils.measureToString)(extra.height);
  62104. for (const child of extra.children) {
  62105. child.attributes.style.height = height;
  62106. }
  62107. break;
  62108. }
  62109. case "table":
  62110. {
  62111. extra.width = Math.min(availableSpace.width, Math.max(extra.width, w));
  62112. extra.height += h;
  62113. extra.children.push(html);
  62114. break;
  62115. }
  62116. case "tb":
  62117. {
  62118. extra.width = Math.min(availableSpace.width, Math.max(extra.width, w));
  62119. extra.height += h;
  62120. extra.children.push(html);
  62121. break;
  62122. }
  62123. }
  62124. }
  62125. function getAvailableSpace(node) {
  62126. const availableSpace = node[_xfa_object.$extra].availableSpace;
  62127. const marginV = node.margin ? node.margin.topInset + node.margin.bottomInset : 0;
  62128. const marginH = node.margin ? node.margin.leftInset + node.margin.rightInset : 0;
  62129. switch (node.layout) {
  62130. case "lr-tb":
  62131. case "rl-tb":
  62132. if (node[_xfa_object.$extra].attempt === 0) {
  62133. return {
  62134. width: availableSpace.width - marginH - node[_xfa_object.$extra].currentWidth,
  62135. height: availableSpace.height - marginV - node[_xfa_object.$extra].prevHeight
  62136. };
  62137. }
  62138. return {
  62139. width: availableSpace.width - marginH,
  62140. height: availableSpace.height - marginV - node[_xfa_object.$extra].height
  62141. };
  62142. case "rl-row":
  62143. case "row":
  62144. const width = node[_xfa_object.$extra].columnWidths.slice(node[_xfa_object.$extra].currentColumn).reduce((a, x) => a + x);
  62145. return {
  62146. width,
  62147. height: availableSpace.height - marginH
  62148. };
  62149. case "table":
  62150. case "tb":
  62151. return {
  62152. width: availableSpace.width - marginH,
  62153. height: availableSpace.height - marginV - node[_xfa_object.$extra].height
  62154. };
  62155. case "position":
  62156. default:
  62157. return availableSpace;
  62158. }
  62159. }
  62160. function getTransformedBBox(node) {
  62161. let w = node.w === "" ? NaN : node.w;
  62162. let h = node.h === "" ? NaN : node.h;
  62163. let [centerX, centerY] = [0, 0];
  62164. switch (node.anchorType || "") {
  62165. case "bottomCenter":
  62166. [centerX, centerY] = [w / 2, h];
  62167. break;
  62168. case "bottomLeft":
  62169. [centerX, centerY] = [0, h];
  62170. break;
  62171. case "bottomRight":
  62172. [centerX, centerY] = [w, h];
  62173. break;
  62174. case "middleCenter":
  62175. [centerX, centerY] = [w / 2, h / 2];
  62176. break;
  62177. case "middleLeft":
  62178. [centerX, centerY] = [0, h / 2];
  62179. break;
  62180. case "middleRight":
  62181. [centerX, centerY] = [w, h / 2];
  62182. break;
  62183. case "topCenter":
  62184. [centerX, centerY] = [w / 2, 0];
  62185. break;
  62186. case "topRight":
  62187. [centerX, centerY] = [w, 0];
  62188. break;
  62189. }
  62190. let x, y;
  62191. switch (node.rotate || 0) {
  62192. case 0:
  62193. [x, y] = [-centerX, -centerY];
  62194. break;
  62195. case 90:
  62196. [x, y] = [-centerY, centerX];
  62197. [w, h] = [h, -w];
  62198. break;
  62199. case 180:
  62200. [x, y] = [centerX, centerY];
  62201. [w, h] = [-w, -h];
  62202. break;
  62203. case 270:
  62204. [x, y] = [centerY, -centerX];
  62205. [w, h] = [-h, w];
  62206. break;
  62207. }
  62208. return [node.x + x + Math.min(0, w), node.y + y + Math.min(0, h), Math.abs(w), Math.abs(h)];
  62209. }
  62210. function checkDimensions(node, space) {
  62211. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].firstUnsplittable === null) {
  62212. return true;
  62213. }
  62214. if (node.w === 0 || node.h === 0) {
  62215. return true;
  62216. }
  62217. const ERROR = 2;
  62218. const parent = node[_xfa_object.$getSubformParent]();
  62219. const attempt = parent[_xfa_object.$extra] && parent[_xfa_object.$extra].attempt || 0;
  62220. const [, y, w, h] = getTransformedBBox(node);
  62221. switch (parent.layout) {
  62222. case "lr-tb":
  62223. case "rl-tb":
  62224. if (attempt === 0) {
  62225. if (!node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  62226. if (node.h !== "" && Math.round(h - space.height) > ERROR) {
  62227. return false;
  62228. }
  62229. if (node.w !== "") {
  62230. if (Math.round(w - space.width) <= ERROR) {
  62231. return true;
  62232. }
  62233. if (parent[_xfa_object.$extra].numberInLine === 0) {
  62234. return space.height > ERROR;
  62235. }
  62236. return false;
  62237. }
  62238. return space.width > ERROR;
  62239. }
  62240. if (node.w !== "") {
  62241. return Math.round(w - space.width) <= ERROR;
  62242. }
  62243. return space.width > ERROR;
  62244. }
  62245. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  62246. return true;
  62247. }
  62248. if (node.h !== "" && Math.round(h - space.height) > ERROR) {
  62249. return false;
  62250. }
  62251. if (node.w === "" || Math.round(w - space.width) <= ERROR) {
  62252. return space.height > ERROR;
  62253. }
  62254. if (parent[_xfa_object.$isThereMoreWidth]()) {
  62255. return false;
  62256. }
  62257. return space.height > ERROR;
  62258. case "table":
  62259. case "tb":
  62260. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  62261. return true;
  62262. }
  62263. if (node.h !== "" && !node[_xfa_object.$isSplittable]()) {
  62264. return Math.round(h - space.height) <= ERROR;
  62265. }
  62266. if (node.w === "" || Math.round(w - space.width) <= ERROR) {
  62267. return space.height > ERROR;
  62268. }
  62269. if (parent[_xfa_object.$isThereMoreWidth]()) {
  62270. return false;
  62271. }
  62272. return space.height > ERROR;
  62273. case "position":
  62274. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  62275. return true;
  62276. }
  62277. if (node.h === "" || Math.round(h + y - space.height) <= ERROR) {
  62278. return true;
  62279. }
  62280. const area = node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].currentContentArea;
  62281. return h + y > area.h;
  62282. case "rl-row":
  62283. case "row":
  62284. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  62285. return true;
  62286. }
  62287. if (node.h !== "") {
  62288. return Math.round(h - space.height) <= ERROR;
  62289. }
  62290. return true;
  62291. default:
  62292. return true;
  62293. }
  62294. }
  62295. /***/ }),
  62296. /* 213 */
  62297. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  62298. "use strict";
  62299. Object.defineProperty(exports, "__esModule", ({
  62300. value: true
  62301. }));
  62302. exports.computeBbox = computeBbox;
  62303. exports.createWrapper = createWrapper;
  62304. exports.fixDimensions = fixDimensions;
  62305. exports.fixTextIndent = fixTextIndent;
  62306. exports.fixURL = fixURL;
  62307. exports.isPrintOnly = isPrintOnly;
  62308. exports.layoutClass = layoutClass;
  62309. exports.layoutNode = layoutNode;
  62310. exports.measureToString = measureToString;
  62311. exports.setAccess = setAccess;
  62312. exports.setFontFamily = setFontFamily;
  62313. exports.setMinMaxDimensions = setMinMaxDimensions;
  62314. exports.setPara = setPara;
  62315. exports.toStyle = toStyle;
  62316. var _xfa_object = __w_pdfjs_require__(206);
  62317. var _util = __w_pdfjs_require__(2);
  62318. var _utils = __w_pdfjs_require__(207);
  62319. var _fonts = __w_pdfjs_require__(214);
  62320. var _text = __w_pdfjs_require__(215);
  62321. function measureToString(m) {
  62322. if (typeof m === "string") {
  62323. return "0px";
  62324. }
  62325. return Number.isInteger(m) ? `${m}px` : `${m.toFixed(2)}px`;
  62326. }
  62327. const converters = {
  62328. anchorType(node, style) {
  62329. const parent = node[_xfa_object.$getSubformParent]();
  62330. if (!parent || parent.layout && parent.layout !== "position") {
  62331. return;
  62332. }
  62333. if (!("transform" in style)) {
  62334. style.transform = "";
  62335. }
  62336. switch (node.anchorType) {
  62337. case "bottomCenter":
  62338. style.transform += "translate(-50%, -100%)";
  62339. break;
  62340. case "bottomLeft":
  62341. style.transform += "translate(0,-100%)";
  62342. break;
  62343. case "bottomRight":
  62344. style.transform += "translate(-100%,-100%)";
  62345. break;
  62346. case "middleCenter":
  62347. style.transform += "translate(-50%,-50%)";
  62348. break;
  62349. case "middleLeft":
  62350. style.transform += "translate(0,-50%)";
  62351. break;
  62352. case "middleRight":
  62353. style.transform += "translate(-100%,-50%)";
  62354. break;
  62355. case "topCenter":
  62356. style.transform += "translate(-50%,0)";
  62357. break;
  62358. case "topRight":
  62359. style.transform += "translate(-100%,0)";
  62360. break;
  62361. }
  62362. },
  62363. dimensions(node, style) {
  62364. const parent = node[_xfa_object.$getSubformParent]();
  62365. let width = node.w;
  62366. const height = node.h;
  62367. if (parent.layout && parent.layout.includes("row")) {
  62368. const extra = parent[_xfa_object.$extra];
  62369. const colSpan = node.colSpan;
  62370. let w;
  62371. if (colSpan === -1) {
  62372. w = extra.columnWidths.slice(extra.currentColumn).reduce((a, x) => a + x, 0);
  62373. extra.currentColumn = 0;
  62374. } else {
  62375. w = extra.columnWidths.slice(extra.currentColumn, extra.currentColumn + colSpan).reduce((a, x) => a + x, 0);
  62376. extra.currentColumn = (extra.currentColumn + node.colSpan) % extra.columnWidths.length;
  62377. }
  62378. if (!isNaN(w)) {
  62379. width = node.w = w;
  62380. }
  62381. }
  62382. if (width !== "") {
  62383. style.width = measureToString(width);
  62384. } else {
  62385. style.width = "auto";
  62386. }
  62387. if (height !== "") {
  62388. style.height = measureToString(height);
  62389. } else {
  62390. style.height = "auto";
  62391. }
  62392. },
  62393. position(node, style) {
  62394. const parent = node[_xfa_object.$getSubformParent]();
  62395. if (parent && parent.layout && parent.layout !== "position") {
  62396. return;
  62397. }
  62398. style.position = "absolute";
  62399. style.left = measureToString(node.x);
  62400. style.top = measureToString(node.y);
  62401. },
  62402. rotate(node, style) {
  62403. if (node.rotate) {
  62404. if (!("transform" in style)) {
  62405. style.transform = "";
  62406. }
  62407. style.transform += `rotate(-${node.rotate}deg)`;
  62408. style.transformOrigin = "top left";
  62409. }
  62410. },
  62411. presence(node, style) {
  62412. switch (node.presence) {
  62413. case "invisible":
  62414. style.visibility = "hidden";
  62415. break;
  62416. case "hidden":
  62417. case "inactive":
  62418. style.display = "none";
  62419. break;
  62420. }
  62421. },
  62422. hAlign(node, style) {
  62423. if (node[_xfa_object.$nodeName] === "para") {
  62424. switch (node.hAlign) {
  62425. case "justifyAll":
  62426. style.textAlign = "justify-all";
  62427. break;
  62428. case "radix":
  62429. style.textAlign = "left";
  62430. break;
  62431. default:
  62432. style.textAlign = node.hAlign;
  62433. }
  62434. } else {
  62435. switch (node.hAlign) {
  62436. case "left":
  62437. style.alignSelf = "start";
  62438. break;
  62439. case "center":
  62440. style.alignSelf = "center";
  62441. break;
  62442. case "right":
  62443. style.alignSelf = "end";
  62444. break;
  62445. }
  62446. }
  62447. },
  62448. margin(node, style) {
  62449. if (node.margin) {
  62450. style.margin = node.margin[_xfa_object.$toStyle]().margin;
  62451. }
  62452. }
  62453. };
  62454. function setMinMaxDimensions(node, style) {
  62455. const parent = node[_xfa_object.$getSubformParent]();
  62456. if (parent.layout === "position") {
  62457. if (node.minW > 0) {
  62458. style.minWidth = measureToString(node.minW);
  62459. }
  62460. if (node.maxW > 0) {
  62461. style.maxWidth = measureToString(node.maxW);
  62462. }
  62463. if (node.minH > 0) {
  62464. style.minHeight = measureToString(node.minH);
  62465. }
  62466. if (node.maxH > 0) {
  62467. style.maxHeight = measureToString(node.maxH);
  62468. }
  62469. }
  62470. }
  62471. function layoutText(text, xfaFont, margin, lineHeight, fontFinder, width) {
  62472. const measure = new _text.TextMeasure(xfaFont, margin, lineHeight, fontFinder);
  62473. if (typeof text === "string") {
  62474. measure.addString(text);
  62475. } else {
  62476. text[_xfa_object.$pushGlyphs](measure);
  62477. }
  62478. return measure.compute(width);
  62479. }
  62480. function layoutNode(node, availableSpace) {
  62481. let height = null;
  62482. let width = null;
  62483. let isBroken = false;
  62484. if ((!node.w || !node.h) && node.value) {
  62485. let marginH = 0;
  62486. let marginV = 0;
  62487. if (node.margin) {
  62488. marginH = node.margin.leftInset + node.margin.rightInset;
  62489. marginV = node.margin.topInset + node.margin.bottomInset;
  62490. }
  62491. let lineHeight = null;
  62492. let margin = null;
  62493. if (node.para) {
  62494. margin = Object.create(null);
  62495. lineHeight = node.para.lineHeight === "" ? null : node.para.lineHeight;
  62496. margin.top = node.para.spaceAbove === "" ? 0 : node.para.spaceAbove;
  62497. margin.bottom = node.para.spaceBelow === "" ? 0 : node.para.spaceBelow;
  62498. margin.left = node.para.marginLeft === "" ? 0 : node.para.marginLeft;
  62499. margin.right = node.para.marginRight === "" ? 0 : node.para.marginRight;
  62500. }
  62501. let font = node.font;
  62502. if (!font) {
  62503. const root = node[_xfa_object.$getTemplateRoot]();
  62504. let parent = node[_xfa_object.$getParent]();
  62505. while (parent && parent !== root) {
  62506. if (parent.font) {
  62507. font = parent.font;
  62508. break;
  62509. }
  62510. parent = parent[_xfa_object.$getParent]();
  62511. }
  62512. }
  62513. const maxWidth = (node.w || availableSpace.width) - marginH;
  62514. const fontFinder = node[_xfa_object.$globalData].fontFinder;
  62515. if (node.value.exData && node.value.exData[_xfa_object.$content] && node.value.exData.contentType === "text/html") {
  62516. const res = layoutText(node.value.exData[_xfa_object.$content], font, margin, lineHeight, fontFinder, maxWidth);
  62517. width = res.width;
  62518. height = res.height;
  62519. isBroken = res.isBroken;
  62520. } else {
  62521. const text = node.value[_xfa_object.$text]();
  62522. if (text) {
  62523. const res = layoutText(text, font, margin, lineHeight, fontFinder, maxWidth);
  62524. width = res.width;
  62525. height = res.height;
  62526. isBroken = res.isBroken;
  62527. }
  62528. }
  62529. if (width !== null && !node.w) {
  62530. width += marginH;
  62531. }
  62532. if (height !== null && !node.h) {
  62533. height += marginV;
  62534. }
  62535. }
  62536. return {
  62537. w: width,
  62538. h: height,
  62539. isBroken
  62540. };
  62541. }
  62542. function computeBbox(node, html, availableSpace) {
  62543. let bbox;
  62544. if (node.w !== "" && node.h !== "") {
  62545. bbox = [node.x, node.y, node.w, node.h];
  62546. } else {
  62547. if (!availableSpace) {
  62548. return null;
  62549. }
  62550. let width = node.w;
  62551. if (width === "") {
  62552. if (node.maxW === 0) {
  62553. const parent = node[_xfa_object.$getSubformParent]();
  62554. if (parent.layout === "position" && parent.w !== "") {
  62555. width = 0;
  62556. } else {
  62557. width = node.minW;
  62558. }
  62559. } else {
  62560. width = Math.min(node.maxW, availableSpace.width);
  62561. }
  62562. html.attributes.style.width = measureToString(width);
  62563. }
  62564. let height = node.h;
  62565. if (height === "") {
  62566. if (node.maxH === 0) {
  62567. const parent = node[_xfa_object.$getSubformParent]();
  62568. if (parent.layout === "position" && parent.h !== "") {
  62569. height = 0;
  62570. } else {
  62571. height = node.minH;
  62572. }
  62573. } else {
  62574. height = Math.min(node.maxH, availableSpace.height);
  62575. }
  62576. html.attributes.style.height = measureToString(height);
  62577. }
  62578. bbox = [node.x, node.y, width, height];
  62579. }
  62580. return bbox;
  62581. }
  62582. function fixDimensions(node) {
  62583. const parent = node[_xfa_object.$getSubformParent]();
  62584. if (parent.layout && parent.layout.includes("row")) {
  62585. const extra = parent[_xfa_object.$extra];
  62586. const colSpan = node.colSpan;
  62587. let width;
  62588. if (colSpan === -1) {
  62589. width = extra.columnWidths.slice(extra.currentColumn).reduce((a, w) => a + w, 0);
  62590. } else {
  62591. width = extra.columnWidths.slice(extra.currentColumn, extra.currentColumn + colSpan).reduce((a, w) => a + w, 0);
  62592. }
  62593. if (!isNaN(width)) {
  62594. node.w = width;
  62595. }
  62596. }
  62597. if (parent.layout && parent.layout !== "position") {
  62598. node.x = node.y = 0;
  62599. }
  62600. if (node.layout === "table") {
  62601. if (node.w === "" && Array.isArray(node.columnWidths)) {
  62602. node.w = node.columnWidths.reduce((a, x) => a + x, 0);
  62603. }
  62604. }
  62605. }
  62606. function layoutClass(node) {
  62607. switch (node.layout) {
  62608. case "position":
  62609. return "xfaPosition";
  62610. case "lr-tb":
  62611. return "xfaLrTb";
  62612. case "rl-row":
  62613. return "xfaRlRow";
  62614. case "rl-tb":
  62615. return "xfaRlTb";
  62616. case "row":
  62617. return "xfaRow";
  62618. case "table":
  62619. return "xfaTable";
  62620. case "tb":
  62621. return "xfaTb";
  62622. default:
  62623. return "xfaPosition";
  62624. }
  62625. }
  62626. function toStyle(node) {
  62627. const style = Object.create(null);
  62628. for (var _len = arguments.length, names = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  62629. names[_key - 1] = arguments[_key];
  62630. }
  62631. for (const name of names) {
  62632. const value = node[name];
  62633. if (value === null) {
  62634. continue;
  62635. }
  62636. if (converters.hasOwnProperty(name)) {
  62637. converters[name](node, style);
  62638. continue;
  62639. }
  62640. if (value instanceof _xfa_object.XFAObject) {
  62641. const newStyle = value[_xfa_object.$toStyle]();
  62642. if (newStyle) {
  62643. Object.assign(style, newStyle);
  62644. } else {
  62645. (0, _util.warn)(`(DEBUG) - XFA - style for ${name} not implemented yet`);
  62646. }
  62647. }
  62648. }
  62649. return style;
  62650. }
  62651. function createWrapper(node, html) {
  62652. const {
  62653. attributes
  62654. } = html;
  62655. const {
  62656. style
  62657. } = attributes;
  62658. const wrapper = {
  62659. name: "div",
  62660. attributes: {
  62661. class: ["xfaWrapper"],
  62662. style: Object.create(null)
  62663. },
  62664. children: []
  62665. };
  62666. attributes.class.push("xfaWrapped");
  62667. if (node.border) {
  62668. const {
  62669. widths,
  62670. insets
  62671. } = node.border[_xfa_object.$extra];
  62672. let width, height;
  62673. let top = insets[0];
  62674. let left = insets[3];
  62675. const insetsH = insets[0] + insets[2];
  62676. const insetsW = insets[1] + insets[3];
  62677. switch (node.border.hand) {
  62678. case "even":
  62679. top -= widths[0] / 2;
  62680. left -= widths[3] / 2;
  62681. width = `calc(100% + ${(widths[1] + widths[3]) / 2 - insetsW}px)`;
  62682. height = `calc(100% + ${(widths[0] + widths[2]) / 2 - insetsH}px)`;
  62683. break;
  62684. case "left":
  62685. top -= widths[0];
  62686. left -= widths[3];
  62687. width = `calc(100% + ${widths[1] + widths[3] - insetsW}px)`;
  62688. height = `calc(100% + ${widths[0] + widths[2] - insetsH}px)`;
  62689. break;
  62690. case "right":
  62691. width = insetsW ? `calc(100% - ${insetsW}px)` : "100%";
  62692. height = insetsH ? `calc(100% - ${insetsH}px)` : "100%";
  62693. break;
  62694. }
  62695. const classNames = ["xfaBorder"];
  62696. if (isPrintOnly(node.border)) {
  62697. classNames.push("xfaPrintOnly");
  62698. }
  62699. const border = {
  62700. name: "div",
  62701. attributes: {
  62702. class: classNames,
  62703. style: {
  62704. top: `${top}px`,
  62705. left: `${left}px`,
  62706. width,
  62707. height
  62708. }
  62709. },
  62710. children: []
  62711. };
  62712. for (const key of ["border", "borderWidth", "borderColor", "borderRadius", "borderStyle"]) {
  62713. if (style[key] !== undefined) {
  62714. border.attributes.style[key] = style[key];
  62715. delete style[key];
  62716. }
  62717. }
  62718. wrapper.children.push(border, html);
  62719. } else {
  62720. wrapper.children.push(html);
  62721. }
  62722. for (const key of ["background", "backgroundClip", "top", "left", "width", "height", "minWidth", "minHeight", "maxWidth", "maxHeight", "transform", "transformOrigin", "visibility"]) {
  62723. if (style[key] !== undefined) {
  62724. wrapper.attributes.style[key] = style[key];
  62725. delete style[key];
  62726. }
  62727. }
  62728. if (style.position === "absolute") {
  62729. wrapper.attributes.style.position = "absolute";
  62730. } else {
  62731. wrapper.attributes.style.position = "relative";
  62732. }
  62733. delete style.position;
  62734. if (style.alignSelf) {
  62735. wrapper.attributes.style.alignSelf = style.alignSelf;
  62736. delete style.alignSelf;
  62737. }
  62738. return wrapper;
  62739. }
  62740. function fixTextIndent(styles) {
  62741. const indent = (0, _utils.getMeasurement)(styles.textIndent, "0px");
  62742. if (indent >= 0) {
  62743. return;
  62744. }
  62745. const align = styles.textAlign === "right" ? "right" : "left";
  62746. const name = "padding" + (align === "left" ? "Left" : "Right");
  62747. const padding = (0, _utils.getMeasurement)(styles[name], "0px");
  62748. styles[name] = `${padding - indent}px`;
  62749. }
  62750. function setAccess(node, classNames) {
  62751. switch (node.access) {
  62752. case "nonInteractive":
  62753. classNames.push("xfaNonInteractive");
  62754. break;
  62755. case "readOnly":
  62756. classNames.push("xfaReadOnly");
  62757. break;
  62758. case "protected":
  62759. classNames.push("xfaDisabled");
  62760. break;
  62761. }
  62762. }
  62763. function isPrintOnly(node) {
  62764. return node.relevant.length > 0 && !node.relevant[0].excluded && node.relevant[0].viewname === "print";
  62765. }
  62766. function getCurrentPara(node) {
  62767. const stack = node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].paraStack;
  62768. return stack.length ? stack.at(-1) : null;
  62769. }
  62770. function setPara(node, nodeStyle, value) {
  62771. if (value.attributes.class && value.attributes.class.includes("xfaRich")) {
  62772. if (nodeStyle) {
  62773. if (node.h === "") {
  62774. nodeStyle.height = "auto";
  62775. }
  62776. if (node.w === "") {
  62777. nodeStyle.width = "auto";
  62778. }
  62779. }
  62780. const para = getCurrentPara(node);
  62781. if (para) {
  62782. const valueStyle = value.attributes.style;
  62783. valueStyle.display = "flex";
  62784. valueStyle.flexDirection = "column";
  62785. switch (para.vAlign) {
  62786. case "top":
  62787. valueStyle.justifyContent = "start";
  62788. break;
  62789. case "bottom":
  62790. valueStyle.justifyContent = "end";
  62791. break;
  62792. case "middle":
  62793. valueStyle.justifyContent = "center";
  62794. break;
  62795. }
  62796. const paraStyle = para[_xfa_object.$toStyle]();
  62797. for (const [key, val] of Object.entries(paraStyle)) {
  62798. if (!(key in valueStyle)) {
  62799. valueStyle[key] = val;
  62800. }
  62801. }
  62802. }
  62803. }
  62804. }
  62805. function setFontFamily(xfaFont, node, fontFinder, style) {
  62806. if (!fontFinder) {
  62807. delete style.fontFamily;
  62808. return;
  62809. }
  62810. const name = (0, _utils.stripQuotes)(xfaFont.typeface);
  62811. style.fontFamily = `"${name}"`;
  62812. const typeface = fontFinder.find(name);
  62813. if (typeface) {
  62814. const {
  62815. fontFamily
  62816. } = typeface.regular.cssFontInfo;
  62817. if (fontFamily !== name) {
  62818. style.fontFamily = `"${fontFamily}"`;
  62819. }
  62820. const para = getCurrentPara(node);
  62821. if (para && para.lineHeight !== "") {
  62822. return;
  62823. }
  62824. if (style.lineHeight) {
  62825. return;
  62826. }
  62827. const pdfFont = (0, _fonts.selectFont)(xfaFont, typeface);
  62828. if (pdfFont) {
  62829. style.lineHeight = Math.max(1.2, pdfFont.lineHeight);
  62830. }
  62831. }
  62832. }
  62833. function fixURL(str) {
  62834. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(str, null, {
  62835. addDefaultProtocol: true,
  62836. tryConvertEncoding: true
  62837. });
  62838. return absoluteUrl ? absoluteUrl.href : null;
  62839. }
  62840. /***/ }),
  62841. /* 214 */
  62842. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  62843. "use strict";
  62844. Object.defineProperty(exports, "__esModule", ({
  62845. value: true
  62846. }));
  62847. exports.FontFinder = void 0;
  62848. exports.getMetrics = getMetrics;
  62849. exports.selectFont = selectFont;
  62850. var _xfa_object = __w_pdfjs_require__(206);
  62851. var _utils = __w_pdfjs_require__(207);
  62852. var _util = __w_pdfjs_require__(2);
  62853. class FontFinder {
  62854. constructor(pdfFonts) {
  62855. this.fonts = new Map();
  62856. this.cache = new Map();
  62857. this.warned = new Set();
  62858. this.defaultFont = null;
  62859. this.add(pdfFonts);
  62860. }
  62861. add(pdfFonts) {
  62862. let reallyMissingFonts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  62863. for (const pdfFont of pdfFonts) {
  62864. this.addPdfFont(pdfFont);
  62865. }
  62866. for (const pdfFont of this.fonts.values()) {
  62867. if (!pdfFont.regular) {
  62868. pdfFont.regular = pdfFont.italic || pdfFont.bold || pdfFont.bolditalic;
  62869. }
  62870. }
  62871. if (!reallyMissingFonts || reallyMissingFonts.size === 0) {
  62872. return;
  62873. }
  62874. const myriad = this.fonts.get("PdfJS-Fallback-PdfJS-XFA");
  62875. for (const missing of reallyMissingFonts) {
  62876. this.fonts.set(missing, myriad);
  62877. }
  62878. }
  62879. addPdfFont(pdfFont) {
  62880. const cssFontInfo = pdfFont.cssFontInfo;
  62881. const name = cssFontInfo.fontFamily;
  62882. let font = this.fonts.get(name);
  62883. if (!font) {
  62884. font = Object.create(null);
  62885. this.fonts.set(name, font);
  62886. if (!this.defaultFont) {
  62887. this.defaultFont = font;
  62888. }
  62889. }
  62890. let property = "";
  62891. const fontWeight = parseFloat(cssFontInfo.fontWeight);
  62892. if (parseFloat(cssFontInfo.italicAngle) !== 0) {
  62893. property = fontWeight >= 700 ? "bolditalic" : "italic";
  62894. } else if (fontWeight >= 700) {
  62895. property = "bold";
  62896. }
  62897. if (!property) {
  62898. if (pdfFont.name.includes("Bold") || pdfFont.psName && pdfFont.psName.includes("Bold")) {
  62899. property = "bold";
  62900. }
  62901. if (pdfFont.name.includes("Italic") || pdfFont.name.endsWith("It") || pdfFont.psName && (pdfFont.psName.includes("Italic") || pdfFont.psName.endsWith("It"))) {
  62902. property += "italic";
  62903. }
  62904. }
  62905. if (!property) {
  62906. property = "regular";
  62907. }
  62908. font[property] = pdfFont;
  62909. }
  62910. getDefault() {
  62911. return this.defaultFont;
  62912. }
  62913. find(fontName) {
  62914. let mustWarn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
  62915. let font = this.fonts.get(fontName) || this.cache.get(fontName);
  62916. if (font) {
  62917. return font;
  62918. }
  62919. const pattern = /,|-|_| |bolditalic|bold|italic|regular|it/gi;
  62920. let name = fontName.replace(pattern, "");
  62921. font = this.fonts.get(name);
  62922. if (font) {
  62923. this.cache.set(fontName, font);
  62924. return font;
  62925. }
  62926. name = name.toLowerCase();
  62927. const maybe = [];
  62928. for (const [family, pdfFont] of this.fonts.entries()) {
  62929. if (family.replace(pattern, "").toLowerCase().startsWith(name)) {
  62930. maybe.push(pdfFont);
  62931. }
  62932. }
  62933. if (maybe.length === 0) {
  62934. for (const [, pdfFont] of this.fonts.entries()) {
  62935. if (pdfFont.regular.name && pdfFont.regular.name.replace(pattern, "").toLowerCase().startsWith(name)) {
  62936. maybe.push(pdfFont);
  62937. }
  62938. }
  62939. }
  62940. if (maybe.length === 0) {
  62941. name = name.replace(/psmt|mt/gi, "");
  62942. for (const [family, pdfFont] of this.fonts.entries()) {
  62943. if (family.replace(pattern, "").toLowerCase().startsWith(name)) {
  62944. maybe.push(pdfFont);
  62945. }
  62946. }
  62947. }
  62948. if (maybe.length === 0) {
  62949. for (const pdfFont of this.fonts.values()) {
  62950. if (pdfFont.regular.name && pdfFont.regular.name.replace(pattern, "").toLowerCase().startsWith(name)) {
  62951. maybe.push(pdfFont);
  62952. }
  62953. }
  62954. }
  62955. if (maybe.length >= 1) {
  62956. if (maybe.length !== 1 && mustWarn) {
  62957. (0, _util.warn)(`XFA - Too many choices to guess the correct font: ${fontName}`);
  62958. }
  62959. this.cache.set(fontName, maybe[0]);
  62960. return maybe[0];
  62961. }
  62962. if (mustWarn && !this.warned.has(fontName)) {
  62963. this.warned.add(fontName);
  62964. (0, _util.warn)(`XFA - Cannot find the font: ${fontName}`);
  62965. }
  62966. return null;
  62967. }
  62968. }
  62969. exports.FontFinder = FontFinder;
  62970. function selectFont(xfaFont, typeface) {
  62971. if (xfaFont.posture === "italic") {
  62972. if (xfaFont.weight === "bold") {
  62973. return typeface.bolditalic;
  62974. }
  62975. return typeface.italic;
  62976. } else if (xfaFont.weight === "bold") {
  62977. return typeface.bold;
  62978. }
  62979. return typeface.regular;
  62980. }
  62981. function getMetrics(xfaFont) {
  62982. let real = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  62983. let pdfFont = null;
  62984. if (xfaFont) {
  62985. const name = (0, _utils.stripQuotes)(xfaFont.typeface);
  62986. const typeface = xfaFont[_xfa_object.$globalData].fontFinder.find(name);
  62987. pdfFont = selectFont(xfaFont, typeface);
  62988. }
  62989. if (!pdfFont) {
  62990. return {
  62991. lineHeight: 12,
  62992. lineGap: 2,
  62993. lineNoGap: 10
  62994. };
  62995. }
  62996. const size = xfaFont.size || 10;
  62997. const lineHeight = pdfFont.lineHeight ? Math.max(real ? 0 : 1.2, pdfFont.lineHeight) : 1.2;
  62998. const lineGap = pdfFont.lineGap === undefined ? 0.2 : pdfFont.lineGap;
  62999. return {
  63000. lineHeight: lineHeight * size,
  63001. lineGap: lineGap * size,
  63002. lineNoGap: Math.max(1, lineHeight - lineGap) * size
  63003. };
  63004. }
  63005. /***/ }),
  63006. /* 215 */
  63007. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  63008. "use strict";
  63009. Object.defineProperty(exports, "__esModule", ({
  63010. value: true
  63011. }));
  63012. exports.TextMeasure = void 0;
  63013. var _fonts = __w_pdfjs_require__(214);
  63014. const WIDTH_FACTOR = 1.02;
  63015. class FontInfo {
  63016. constructor(xfaFont, margin, lineHeight, fontFinder) {
  63017. this.lineHeight = lineHeight;
  63018. this.paraMargin = margin || {
  63019. top: 0,
  63020. bottom: 0,
  63021. left: 0,
  63022. right: 0
  63023. };
  63024. if (!xfaFont) {
  63025. [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder);
  63026. return;
  63027. }
  63028. this.xfaFont = {
  63029. typeface: xfaFont.typeface,
  63030. posture: xfaFont.posture,
  63031. weight: xfaFont.weight,
  63032. size: xfaFont.size,
  63033. letterSpacing: xfaFont.letterSpacing
  63034. };
  63035. const typeface = fontFinder.find(xfaFont.typeface);
  63036. if (!typeface) {
  63037. [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder);
  63038. return;
  63039. }
  63040. this.pdfFont = (0, _fonts.selectFont)(xfaFont, typeface);
  63041. if (!this.pdfFont) {
  63042. [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder);
  63043. }
  63044. }
  63045. defaultFont(fontFinder) {
  63046. const font = fontFinder.find("Helvetica", false) || fontFinder.find("Myriad Pro", false) || fontFinder.find("Arial", false) || fontFinder.getDefault();
  63047. if (font && font.regular) {
  63048. const pdfFont = font.regular;
  63049. const info = pdfFont.cssFontInfo;
  63050. const xfaFont = {
  63051. typeface: info.fontFamily,
  63052. posture: "normal",
  63053. weight: "normal",
  63054. size: 10,
  63055. letterSpacing: 0
  63056. };
  63057. return [pdfFont, xfaFont];
  63058. }
  63059. const xfaFont = {
  63060. typeface: "Courier",
  63061. posture: "normal",
  63062. weight: "normal",
  63063. size: 10,
  63064. letterSpacing: 0
  63065. };
  63066. return [null, xfaFont];
  63067. }
  63068. }
  63069. class FontSelector {
  63070. constructor(defaultXfaFont, defaultParaMargin, defaultLineHeight, fontFinder) {
  63071. this.fontFinder = fontFinder;
  63072. this.stack = [new FontInfo(defaultXfaFont, defaultParaMargin, defaultLineHeight, fontFinder)];
  63073. }
  63074. pushData(xfaFont, margin, lineHeight) {
  63075. const lastFont = this.stack.at(-1);
  63076. for (const name of ["typeface", "posture", "weight", "size", "letterSpacing"]) {
  63077. if (!xfaFont[name]) {
  63078. xfaFont[name] = lastFont.xfaFont[name];
  63079. }
  63080. }
  63081. for (const name of ["top", "bottom", "left", "right"]) {
  63082. if (isNaN(margin[name])) {
  63083. margin[name] = lastFont.paraMargin[name];
  63084. }
  63085. }
  63086. const fontInfo = new FontInfo(xfaFont, margin, lineHeight || lastFont.lineHeight, this.fontFinder);
  63087. if (!fontInfo.pdfFont) {
  63088. fontInfo.pdfFont = lastFont.pdfFont;
  63089. }
  63090. this.stack.push(fontInfo);
  63091. }
  63092. popFont() {
  63093. this.stack.pop();
  63094. }
  63095. topFont() {
  63096. return this.stack.at(-1);
  63097. }
  63098. }
  63099. class TextMeasure {
  63100. constructor(defaultXfaFont, defaultParaMargin, defaultLineHeight, fonts) {
  63101. this.glyphs = [];
  63102. this.fontSelector = new FontSelector(defaultXfaFont, defaultParaMargin, defaultLineHeight, fonts);
  63103. this.extraHeight = 0;
  63104. }
  63105. pushData(xfaFont, margin, lineHeight) {
  63106. this.fontSelector.pushData(xfaFont, margin, lineHeight);
  63107. }
  63108. popFont(xfaFont) {
  63109. return this.fontSelector.popFont();
  63110. }
  63111. addPara() {
  63112. const lastFont = this.fontSelector.topFont();
  63113. this.extraHeight += lastFont.paraMargin.top + lastFont.paraMargin.bottom;
  63114. }
  63115. addString(str) {
  63116. if (!str) {
  63117. return;
  63118. }
  63119. const lastFont = this.fontSelector.topFont();
  63120. const fontSize = lastFont.xfaFont.size;
  63121. if (lastFont.pdfFont) {
  63122. const letterSpacing = lastFont.xfaFont.letterSpacing;
  63123. const pdfFont = lastFont.pdfFont;
  63124. const fontLineHeight = pdfFont.lineHeight || 1.2;
  63125. const lineHeight = lastFont.lineHeight || Math.max(1.2, fontLineHeight) * fontSize;
  63126. const lineGap = pdfFont.lineGap === undefined ? 0.2 : pdfFont.lineGap;
  63127. const noGap = fontLineHeight - lineGap;
  63128. const firstLineHeight = Math.max(1, noGap) * fontSize;
  63129. const scale = fontSize / 1000;
  63130. const fallbackWidth = pdfFont.defaultWidth || pdfFont.charsToGlyphs(" ")[0].width;
  63131. for (const line of str.split(/[\u2029\n]/)) {
  63132. const encodedLine = pdfFont.encodeString(line).join("");
  63133. const glyphs = pdfFont.charsToGlyphs(encodedLine);
  63134. for (const glyph of glyphs) {
  63135. const width = glyph.width || fallbackWidth;
  63136. this.glyphs.push([width * scale + letterSpacing, lineHeight, firstLineHeight, glyph.unicode, false]);
  63137. }
  63138. this.glyphs.push([0, 0, 0, "\n", true]);
  63139. }
  63140. this.glyphs.pop();
  63141. return;
  63142. }
  63143. for (const line of str.split(/[\u2029\n]/)) {
  63144. for (const char of line.split("")) {
  63145. this.glyphs.push([fontSize, 1.2 * fontSize, fontSize, char, false]);
  63146. }
  63147. this.glyphs.push([0, 0, 0, "\n", true]);
  63148. }
  63149. this.glyphs.pop();
  63150. }
  63151. compute(maxWidth) {
  63152. let lastSpacePos = -1,
  63153. lastSpaceWidth = 0,
  63154. width = 0,
  63155. height = 0,
  63156. currentLineWidth = 0,
  63157. currentLineHeight = 0;
  63158. let isBroken = false;
  63159. let isFirstLine = true;
  63160. for (let i = 0, ii = this.glyphs.length; i < ii; i++) {
  63161. const [glyphWidth, lineHeight, firstLineHeight, char, isEOL] = this.glyphs[i];
  63162. const isSpace = char === " ";
  63163. const glyphHeight = isFirstLine ? firstLineHeight : lineHeight;
  63164. if (isEOL) {
  63165. width = Math.max(width, currentLineWidth);
  63166. currentLineWidth = 0;
  63167. height += currentLineHeight;
  63168. currentLineHeight = glyphHeight;
  63169. lastSpacePos = -1;
  63170. lastSpaceWidth = 0;
  63171. isFirstLine = false;
  63172. continue;
  63173. }
  63174. if (isSpace) {
  63175. if (currentLineWidth + glyphWidth > maxWidth) {
  63176. width = Math.max(width, currentLineWidth);
  63177. currentLineWidth = 0;
  63178. height += currentLineHeight;
  63179. currentLineHeight = glyphHeight;
  63180. lastSpacePos = -1;
  63181. lastSpaceWidth = 0;
  63182. isBroken = true;
  63183. isFirstLine = false;
  63184. } else {
  63185. currentLineHeight = Math.max(glyphHeight, currentLineHeight);
  63186. lastSpaceWidth = currentLineWidth;
  63187. currentLineWidth += glyphWidth;
  63188. lastSpacePos = i;
  63189. }
  63190. continue;
  63191. }
  63192. if (currentLineWidth + glyphWidth > maxWidth) {
  63193. height += currentLineHeight;
  63194. currentLineHeight = glyphHeight;
  63195. if (lastSpacePos !== -1) {
  63196. i = lastSpacePos;
  63197. width = Math.max(width, lastSpaceWidth);
  63198. currentLineWidth = 0;
  63199. lastSpacePos = -1;
  63200. lastSpaceWidth = 0;
  63201. } else {
  63202. width = Math.max(width, currentLineWidth);
  63203. currentLineWidth = glyphWidth;
  63204. }
  63205. isBroken = true;
  63206. isFirstLine = false;
  63207. continue;
  63208. }
  63209. currentLineWidth += glyphWidth;
  63210. currentLineHeight = Math.max(glyphHeight, currentLineHeight);
  63211. }
  63212. width = Math.max(width, currentLineWidth);
  63213. height += currentLineHeight + this.extraHeight;
  63214. return {
  63215. width: WIDTH_FACTOR * width,
  63216. height,
  63217. isBroken
  63218. };
  63219. }
  63220. }
  63221. exports.TextMeasure = TextMeasure;
  63222. /***/ }),
  63223. /* 216 */
  63224. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  63225. "use strict";
  63226. Object.defineProperty(exports, "__esModule", ({
  63227. value: true
  63228. }));
  63229. exports.DataHandler = void 0;
  63230. var _xfa_object = __w_pdfjs_require__(206);
  63231. class DataHandler {
  63232. constructor(root, data) {
  63233. this.data = data;
  63234. this.dataset = root.datasets || null;
  63235. }
  63236. serialize(storage) {
  63237. const stack = [[-1, this.data[_xfa_object.$getChildren]()]];
  63238. while (stack.length > 0) {
  63239. const last = stack.at(-1);
  63240. const [i, children] = last;
  63241. if (i + 1 === children.length) {
  63242. stack.pop();
  63243. continue;
  63244. }
  63245. const child = children[++last[0]];
  63246. const storageEntry = storage.get(child[_xfa_object.$uid]);
  63247. if (storageEntry) {
  63248. child[_xfa_object.$setValue](storageEntry);
  63249. } else {
  63250. const attributes = child[_xfa_object.$getAttributes]();
  63251. for (const value of attributes.values()) {
  63252. const entry = storage.get(value[_xfa_object.$uid]);
  63253. if (entry) {
  63254. value[_xfa_object.$setValue](entry);
  63255. break;
  63256. }
  63257. }
  63258. }
  63259. const nodes = child[_xfa_object.$getChildren]();
  63260. if (nodes.length > 0) {
  63261. stack.push([-1, nodes]);
  63262. }
  63263. }
  63264. const buf = [`<xfa:datasets xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/">`];
  63265. if (this.dataset) {
  63266. for (const child of this.dataset[_xfa_object.$getChildren]()) {
  63267. if (child[_xfa_object.$nodeName] !== "data") {
  63268. child[_xfa_object.$toString](buf);
  63269. }
  63270. }
  63271. }
  63272. this.data[_xfa_object.$toString](buf);
  63273. buf.push("</xfa:datasets>");
  63274. return buf.join("");
  63275. }
  63276. }
  63277. exports.DataHandler = DataHandler;
  63278. /***/ }),
  63279. /* 217 */
  63280. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  63281. "use strict";
  63282. Object.defineProperty(exports, "__esModule", ({
  63283. value: true
  63284. }));
  63285. exports.XFAParser = void 0;
  63286. var _xfa_object = __w_pdfjs_require__(206);
  63287. var _xml_parser = __w_pdfjs_require__(195);
  63288. var _builder = __w_pdfjs_require__(218);
  63289. var _util = __w_pdfjs_require__(2);
  63290. class XFAParser extends _xml_parser.XMLParserBase {
  63291. constructor() {
  63292. let rootNameSpace = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  63293. let richText = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  63294. super();
  63295. this._builder = new _builder.Builder(rootNameSpace);
  63296. this._stack = [];
  63297. this._globalData = {
  63298. usedTypefaces: new Set()
  63299. };
  63300. this._ids = new Map();
  63301. this._current = this._builder.buildRoot(this._ids);
  63302. this._errorCode = _xml_parser.XMLParserErrorCode.NoError;
  63303. this._whiteRegex = /^\s+$/;
  63304. this._nbsps = /\xa0+/g;
  63305. this._richText = richText;
  63306. }
  63307. parse(data) {
  63308. this.parseXml(data);
  63309. if (this._errorCode !== _xml_parser.XMLParserErrorCode.NoError) {
  63310. return undefined;
  63311. }
  63312. this._current[_xfa_object.$finalize]();
  63313. return this._current.element;
  63314. }
  63315. onText(text) {
  63316. text = text.replace(this._nbsps, match => match.slice(1) + " ");
  63317. if (this._richText || this._current[_xfa_object.$acceptWhitespace]()) {
  63318. this._current[_xfa_object.$onText](text, this._richText);
  63319. return;
  63320. }
  63321. if (this._whiteRegex.test(text)) {
  63322. return;
  63323. }
  63324. this._current[_xfa_object.$onText](text.trim());
  63325. }
  63326. onCdata(text) {
  63327. this._current[_xfa_object.$onText](text);
  63328. }
  63329. _mkAttributes(attributes, tagName) {
  63330. let namespace = null;
  63331. let prefixes = null;
  63332. const attributeObj = Object.create({});
  63333. for (const {
  63334. name,
  63335. value
  63336. } of attributes) {
  63337. if (name === "xmlns") {
  63338. if (!namespace) {
  63339. namespace = value;
  63340. } else {
  63341. (0, _util.warn)(`XFA - multiple namespace definition in <${tagName}>`);
  63342. }
  63343. } else if (name.startsWith("xmlns:")) {
  63344. const prefix = name.substring("xmlns:".length);
  63345. if (!prefixes) {
  63346. prefixes = [];
  63347. }
  63348. prefixes.push({
  63349. prefix,
  63350. value
  63351. });
  63352. } else {
  63353. const i = name.indexOf(":");
  63354. if (i === -1) {
  63355. attributeObj[name] = value;
  63356. } else {
  63357. let nsAttrs = attributeObj[_xfa_object.$nsAttributes];
  63358. if (!nsAttrs) {
  63359. nsAttrs = attributeObj[_xfa_object.$nsAttributes] = Object.create(null);
  63360. }
  63361. const [ns, attrName] = [name.slice(0, i), name.slice(i + 1)];
  63362. let attrs = nsAttrs[ns];
  63363. if (!attrs) {
  63364. attrs = nsAttrs[ns] = Object.create(null);
  63365. }
  63366. attrs[attrName] = value;
  63367. }
  63368. }
  63369. }
  63370. return [namespace, prefixes, attributeObj];
  63371. }
  63372. _getNameAndPrefix(name, nsAgnostic) {
  63373. const i = name.indexOf(":");
  63374. if (i === -1) {
  63375. return [name, null];
  63376. }
  63377. return [name.substring(i + 1), nsAgnostic ? "" : name.substring(0, i)];
  63378. }
  63379. onBeginElement(tagName, attributes, isEmpty) {
  63380. const [namespace, prefixes, attributesObj] = this._mkAttributes(attributes, tagName);
  63381. const [name, nsPrefix] = this._getNameAndPrefix(tagName, this._builder.isNsAgnostic());
  63382. const node = this._builder.build({
  63383. nsPrefix,
  63384. name,
  63385. attributes: attributesObj,
  63386. namespace,
  63387. prefixes
  63388. });
  63389. node[_xfa_object.$globalData] = this._globalData;
  63390. if (isEmpty) {
  63391. node[_xfa_object.$finalize]();
  63392. if (this._current[_xfa_object.$onChild](node)) {
  63393. node[_xfa_object.$setId](this._ids);
  63394. }
  63395. node[_xfa_object.$clean](this._builder);
  63396. return;
  63397. }
  63398. this._stack.push(this._current);
  63399. this._current = node;
  63400. }
  63401. onEndElement(name) {
  63402. const node = this._current;
  63403. if (node[_xfa_object.$isCDATAXml]() && typeof node[_xfa_object.$content] === "string") {
  63404. const parser = new XFAParser();
  63405. parser._globalData = this._globalData;
  63406. const root = parser.parse(node[_xfa_object.$content]);
  63407. node[_xfa_object.$content] = null;
  63408. node[_xfa_object.$onChild](root);
  63409. }
  63410. node[_xfa_object.$finalize]();
  63411. this._current = this._stack.pop();
  63412. if (this._current[_xfa_object.$onChild](node)) {
  63413. node[_xfa_object.$setId](this._ids);
  63414. }
  63415. node[_xfa_object.$clean](this._builder);
  63416. }
  63417. onError(code) {
  63418. this._errorCode = code;
  63419. }
  63420. }
  63421. exports.XFAParser = XFAParser;
  63422. /***/ }),
  63423. /* 218 */
  63424. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  63425. "use strict";
  63426. Object.defineProperty(exports, "__esModule", ({
  63427. value: true
  63428. }));
  63429. exports.Builder = void 0;
  63430. var _namespaces = __w_pdfjs_require__(208);
  63431. var _xfa_object = __w_pdfjs_require__(206);
  63432. var _setup = __w_pdfjs_require__(219);
  63433. var _template = __w_pdfjs_require__(211);
  63434. var _unknown = __w_pdfjs_require__(228);
  63435. var _util = __w_pdfjs_require__(2);
  63436. class Root extends _xfa_object.XFAObject {
  63437. constructor(ids) {
  63438. super(-1, "root", Object.create(null));
  63439. this.element = null;
  63440. this[_xfa_object.$ids] = ids;
  63441. }
  63442. [_xfa_object.$onChild](child) {
  63443. this.element = child;
  63444. return true;
  63445. }
  63446. [_xfa_object.$finalize]() {
  63447. super[_xfa_object.$finalize]();
  63448. if (this.element.template instanceof _template.Template) {
  63449. this[_xfa_object.$ids].set(_xfa_object.$root, this.element);
  63450. this.element.template[_xfa_object.$resolvePrototypes](this[_xfa_object.$ids]);
  63451. this.element.template[_xfa_object.$ids] = this[_xfa_object.$ids];
  63452. }
  63453. }
  63454. }
  63455. class Empty extends _xfa_object.XFAObject {
  63456. constructor() {
  63457. super(-1, "", Object.create(null));
  63458. }
  63459. [_xfa_object.$onChild](_) {
  63460. return false;
  63461. }
  63462. }
  63463. class Builder {
  63464. constructor() {
  63465. let rootNameSpace = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  63466. this._namespaceStack = [];
  63467. this._nsAgnosticLevel = 0;
  63468. this._namespacePrefixes = new Map();
  63469. this._namespaces = new Map();
  63470. this._nextNsId = Math.max(...Object.values(_namespaces.NamespaceIds).map(_ref => {
  63471. let {
  63472. id
  63473. } = _ref;
  63474. return id;
  63475. }));
  63476. this._currentNamespace = rootNameSpace || new _unknown.UnknownNamespace(++this._nextNsId);
  63477. }
  63478. buildRoot(ids) {
  63479. return new Root(ids);
  63480. }
  63481. build(_ref2) {
  63482. let {
  63483. nsPrefix,
  63484. name,
  63485. attributes,
  63486. namespace,
  63487. prefixes
  63488. } = _ref2;
  63489. const hasNamespaceDef = namespace !== null;
  63490. if (hasNamespaceDef) {
  63491. this._namespaceStack.push(this._currentNamespace);
  63492. this._currentNamespace = this._searchNamespace(namespace);
  63493. }
  63494. if (prefixes) {
  63495. this._addNamespacePrefix(prefixes);
  63496. }
  63497. if (attributes.hasOwnProperty(_xfa_object.$nsAttributes)) {
  63498. const dataTemplate = _setup.NamespaceSetUp.datasets;
  63499. const nsAttrs = attributes[_xfa_object.$nsAttributes];
  63500. let xfaAttrs = null;
  63501. for (const [ns, attrs] of Object.entries(nsAttrs)) {
  63502. const nsToUse = this._getNamespaceToUse(ns);
  63503. if (nsToUse === dataTemplate) {
  63504. xfaAttrs = {
  63505. xfa: attrs
  63506. };
  63507. break;
  63508. }
  63509. }
  63510. if (xfaAttrs) {
  63511. attributes[_xfa_object.$nsAttributes] = xfaAttrs;
  63512. } else {
  63513. delete attributes[_xfa_object.$nsAttributes];
  63514. }
  63515. }
  63516. const namespaceToUse = this._getNamespaceToUse(nsPrefix);
  63517. const node = namespaceToUse && namespaceToUse[_namespaces.$buildXFAObject](name, attributes) || new Empty();
  63518. if (node[_xfa_object.$isNsAgnostic]()) {
  63519. this._nsAgnosticLevel++;
  63520. }
  63521. if (hasNamespaceDef || prefixes || node[_xfa_object.$isNsAgnostic]()) {
  63522. node[_xfa_object.$cleanup] = {
  63523. hasNamespace: hasNamespaceDef,
  63524. prefixes,
  63525. nsAgnostic: node[_xfa_object.$isNsAgnostic]()
  63526. };
  63527. }
  63528. return node;
  63529. }
  63530. isNsAgnostic() {
  63531. return this._nsAgnosticLevel > 0;
  63532. }
  63533. _searchNamespace(nsName) {
  63534. let ns = this._namespaces.get(nsName);
  63535. if (ns) {
  63536. return ns;
  63537. }
  63538. for (const [name, {
  63539. check
  63540. }] of Object.entries(_namespaces.NamespaceIds)) {
  63541. if (check(nsName)) {
  63542. ns = _setup.NamespaceSetUp[name];
  63543. if (ns) {
  63544. this._namespaces.set(nsName, ns);
  63545. return ns;
  63546. }
  63547. break;
  63548. }
  63549. }
  63550. ns = new _unknown.UnknownNamespace(++this._nextNsId);
  63551. this._namespaces.set(nsName, ns);
  63552. return ns;
  63553. }
  63554. _addNamespacePrefix(prefixes) {
  63555. for (const {
  63556. prefix,
  63557. value
  63558. } of prefixes) {
  63559. const namespace = this._searchNamespace(value);
  63560. let prefixStack = this._namespacePrefixes.get(prefix);
  63561. if (!prefixStack) {
  63562. prefixStack = [];
  63563. this._namespacePrefixes.set(prefix, prefixStack);
  63564. }
  63565. prefixStack.push(namespace);
  63566. }
  63567. }
  63568. _getNamespaceToUse(prefix) {
  63569. if (!prefix) {
  63570. return this._currentNamespace;
  63571. }
  63572. const prefixStack = this._namespacePrefixes.get(prefix);
  63573. if (prefixStack && prefixStack.length > 0) {
  63574. return prefixStack.at(-1);
  63575. }
  63576. (0, _util.warn)(`Unknown namespace prefix: ${prefix}.`);
  63577. return null;
  63578. }
  63579. clean(data) {
  63580. const {
  63581. hasNamespace,
  63582. prefixes,
  63583. nsAgnostic
  63584. } = data;
  63585. if (hasNamespace) {
  63586. this._currentNamespace = this._namespaceStack.pop();
  63587. }
  63588. if (prefixes) {
  63589. prefixes.forEach(_ref3 => {
  63590. let {
  63591. prefix
  63592. } = _ref3;
  63593. this._namespacePrefixes.get(prefix).pop();
  63594. });
  63595. }
  63596. if (nsAgnostic) {
  63597. this._nsAgnosticLevel--;
  63598. }
  63599. }
  63600. }
  63601. exports.Builder = Builder;
  63602. /***/ }),
  63603. /* 219 */
  63604. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  63605. "use strict";
  63606. Object.defineProperty(exports, "__esModule", ({
  63607. value: true
  63608. }));
  63609. exports.NamespaceSetUp = void 0;
  63610. var _config = __w_pdfjs_require__(220);
  63611. var _connection_set = __w_pdfjs_require__(221);
  63612. var _datasets = __w_pdfjs_require__(222);
  63613. var _locale_set = __w_pdfjs_require__(223);
  63614. var _signature = __w_pdfjs_require__(224);
  63615. var _stylesheet = __w_pdfjs_require__(225);
  63616. var _template = __w_pdfjs_require__(211);
  63617. var _xdp = __w_pdfjs_require__(226);
  63618. var _xhtml = __w_pdfjs_require__(227);
  63619. const NamespaceSetUp = {
  63620. config: _config.ConfigNamespace,
  63621. connection: _connection_set.ConnectionSetNamespace,
  63622. datasets: _datasets.DatasetsNamespace,
  63623. localeSet: _locale_set.LocaleSetNamespace,
  63624. signature: _signature.SignatureNamespace,
  63625. stylesheet: _stylesheet.StylesheetNamespace,
  63626. template: _template.TemplateNamespace,
  63627. xdp: _xdp.XdpNamespace,
  63628. xhtml: _xhtml.XhtmlNamespace
  63629. };
  63630. exports.NamespaceSetUp = NamespaceSetUp;
  63631. /***/ }),
  63632. /* 220 */
  63633. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  63634. "use strict";
  63635. Object.defineProperty(exports, "__esModule", ({
  63636. value: true
  63637. }));
  63638. exports.ConfigNamespace = void 0;
  63639. var _namespaces = __w_pdfjs_require__(208);
  63640. var _xfa_object = __w_pdfjs_require__(206);
  63641. var _utils = __w_pdfjs_require__(207);
  63642. var _util = __w_pdfjs_require__(2);
  63643. const CONFIG_NS_ID = _namespaces.NamespaceIds.config.id;
  63644. class Acrobat extends _xfa_object.XFAObject {
  63645. constructor(attributes) {
  63646. super(CONFIG_NS_ID, "acrobat", true);
  63647. this.acrobat7 = null;
  63648. this.autoSave = null;
  63649. this.common = null;
  63650. this.validate = null;
  63651. this.validateApprovalSignatures = null;
  63652. this.submitUrl = new _xfa_object.XFAObjectArray();
  63653. }
  63654. }
  63655. class Acrobat7 extends _xfa_object.XFAObject {
  63656. constructor(attributes) {
  63657. super(CONFIG_NS_ID, "acrobat7", true);
  63658. this.dynamicRender = null;
  63659. }
  63660. }
  63661. class ADBE_JSConsole extends _xfa_object.OptionObject {
  63662. constructor(attributes) {
  63663. super(CONFIG_NS_ID, "ADBE_JSConsole", ["delegate", "Enable", "Disable"]);
  63664. }
  63665. }
  63666. class ADBE_JSDebugger extends _xfa_object.OptionObject {
  63667. constructor(attributes) {
  63668. super(CONFIG_NS_ID, "ADBE_JSDebugger", ["delegate", "Enable", "Disable"]);
  63669. }
  63670. }
  63671. class AddSilentPrint extends _xfa_object.Option01 {
  63672. constructor(attributes) {
  63673. super(CONFIG_NS_ID, "addSilentPrint");
  63674. }
  63675. }
  63676. class AddViewerPreferences extends _xfa_object.Option01 {
  63677. constructor(attributes) {
  63678. super(CONFIG_NS_ID, "addViewerPreferences");
  63679. }
  63680. }
  63681. class AdjustData extends _xfa_object.Option10 {
  63682. constructor(attributes) {
  63683. super(CONFIG_NS_ID, "adjustData");
  63684. }
  63685. }
  63686. class AdobeExtensionLevel extends _xfa_object.IntegerObject {
  63687. constructor(attributes) {
  63688. super(CONFIG_NS_ID, "adobeExtensionLevel", 0, n => n >= 1 && n <= 8);
  63689. }
  63690. }
  63691. class Agent extends _xfa_object.XFAObject {
  63692. constructor(attributes) {
  63693. super(CONFIG_NS_ID, "agent", true);
  63694. this.name = attributes.name ? attributes.name.trim() : "";
  63695. this.common = new _xfa_object.XFAObjectArray();
  63696. }
  63697. }
  63698. class AlwaysEmbed extends _xfa_object.ContentObject {
  63699. constructor(attributes) {
  63700. super(CONFIG_NS_ID, "alwaysEmbed");
  63701. }
  63702. }
  63703. class Amd extends _xfa_object.StringObject {
  63704. constructor(attributes) {
  63705. super(CONFIG_NS_ID, "amd");
  63706. }
  63707. }
  63708. class Area extends _xfa_object.XFAObject {
  63709. constructor(attributes) {
  63710. super(CONFIG_NS_ID, "area");
  63711. this.level = (0, _utils.getInteger)({
  63712. data: attributes.level,
  63713. defaultValue: 0,
  63714. validate: n => n >= 1 && n <= 3
  63715. });
  63716. this.name = (0, _utils.getStringOption)(attributes.name, ["", "barcode", "coreinit", "deviceDriver", "font", "general", "layout", "merge", "script", "signature", "sourceSet", "templateCache"]);
  63717. }
  63718. }
  63719. class Attributes extends _xfa_object.OptionObject {
  63720. constructor(attributes) {
  63721. super(CONFIG_NS_ID, "attributes", ["preserve", "delegate", "ignore"]);
  63722. }
  63723. }
  63724. class AutoSave extends _xfa_object.OptionObject {
  63725. constructor(attributes) {
  63726. super(CONFIG_NS_ID, "autoSave", ["disabled", "enabled"]);
  63727. }
  63728. }
  63729. class Base extends _xfa_object.StringObject {
  63730. constructor(attributes) {
  63731. super(CONFIG_NS_ID, "base");
  63732. }
  63733. }
  63734. class BatchOutput extends _xfa_object.XFAObject {
  63735. constructor(attributes) {
  63736. super(CONFIG_NS_ID, "batchOutput");
  63737. this.format = (0, _utils.getStringOption)(attributes.format, ["none", "concat", "zip", "zipCompress"]);
  63738. }
  63739. }
  63740. class BehaviorOverride extends _xfa_object.ContentObject {
  63741. constructor(attributes) {
  63742. super(CONFIG_NS_ID, "behaviorOverride");
  63743. }
  63744. [_xfa_object.$finalize]() {
  63745. this[_xfa_object.$content] = new Map(this[_xfa_object.$content].trim().split(/\s+/).filter(x => x.includes(":")).map(x => x.split(":", 2)));
  63746. }
  63747. }
  63748. class Cache extends _xfa_object.XFAObject {
  63749. constructor(attributes) {
  63750. super(CONFIG_NS_ID, "cache", true);
  63751. this.templateCache = null;
  63752. }
  63753. }
  63754. class Change extends _xfa_object.Option01 {
  63755. constructor(attributes) {
  63756. super(CONFIG_NS_ID, "change");
  63757. }
  63758. }
  63759. class Common extends _xfa_object.XFAObject {
  63760. constructor(attributes) {
  63761. super(CONFIG_NS_ID, "common", true);
  63762. this.data = null;
  63763. this.locale = null;
  63764. this.localeSet = null;
  63765. this.messaging = null;
  63766. this.suppressBanner = null;
  63767. this.template = null;
  63768. this.validationMessaging = null;
  63769. this.versionControl = null;
  63770. this.log = new _xfa_object.XFAObjectArray();
  63771. }
  63772. }
  63773. class Compress extends _xfa_object.XFAObject {
  63774. constructor(attributes) {
  63775. super(CONFIG_NS_ID, "compress");
  63776. this.scope = (0, _utils.getStringOption)(attributes.scope, ["imageOnly", "document"]);
  63777. }
  63778. }
  63779. class CompressLogicalStructure extends _xfa_object.Option01 {
  63780. constructor(attributes) {
  63781. super(CONFIG_NS_ID, "compressLogicalStructure");
  63782. }
  63783. }
  63784. class CompressObjectStream extends _xfa_object.Option10 {
  63785. constructor(attributes) {
  63786. super(CONFIG_NS_ID, "compressObjectStream");
  63787. }
  63788. }
  63789. class Compression extends _xfa_object.XFAObject {
  63790. constructor(attributes) {
  63791. super(CONFIG_NS_ID, "compression", true);
  63792. this.compressLogicalStructure = null;
  63793. this.compressObjectStream = null;
  63794. this.level = null;
  63795. this.type = null;
  63796. }
  63797. }
  63798. class Config extends _xfa_object.XFAObject {
  63799. constructor(attributes) {
  63800. super(CONFIG_NS_ID, "config", true);
  63801. this.acrobat = null;
  63802. this.present = null;
  63803. this.trace = null;
  63804. this.agent = new _xfa_object.XFAObjectArray();
  63805. }
  63806. }
  63807. class Conformance extends _xfa_object.OptionObject {
  63808. constructor(attributes) {
  63809. super(CONFIG_NS_ID, "conformance", ["A", "B"]);
  63810. }
  63811. }
  63812. class ContentCopy extends _xfa_object.Option01 {
  63813. constructor(attributes) {
  63814. super(CONFIG_NS_ID, "contentCopy");
  63815. }
  63816. }
  63817. class Copies extends _xfa_object.IntegerObject {
  63818. constructor(attributes) {
  63819. super(CONFIG_NS_ID, "copies", 1, n => n >= 1);
  63820. }
  63821. }
  63822. class Creator extends _xfa_object.StringObject {
  63823. constructor(attributes) {
  63824. super(CONFIG_NS_ID, "creator");
  63825. }
  63826. }
  63827. class CurrentPage extends _xfa_object.IntegerObject {
  63828. constructor(attributes) {
  63829. super(CONFIG_NS_ID, "currentPage", 0, n => n >= 0);
  63830. }
  63831. }
  63832. class Data extends _xfa_object.XFAObject {
  63833. constructor(attributes) {
  63834. super(CONFIG_NS_ID, "data", true);
  63835. this.adjustData = null;
  63836. this.attributes = null;
  63837. this.incrementalLoad = null;
  63838. this.outputXSL = null;
  63839. this.range = null;
  63840. this.record = null;
  63841. this.startNode = null;
  63842. this.uri = null;
  63843. this.window = null;
  63844. this.xsl = null;
  63845. this.excludeNS = new _xfa_object.XFAObjectArray();
  63846. this.transform = new _xfa_object.XFAObjectArray();
  63847. }
  63848. }
  63849. class Debug extends _xfa_object.XFAObject {
  63850. constructor(attributes) {
  63851. super(CONFIG_NS_ID, "debug", true);
  63852. this.uri = null;
  63853. }
  63854. }
  63855. class DefaultTypeface extends _xfa_object.ContentObject {
  63856. constructor(attributes) {
  63857. super(CONFIG_NS_ID, "defaultTypeface");
  63858. this.writingScript = (0, _utils.getStringOption)(attributes.writingScript, ["*", "Arabic", "Cyrillic", "EastEuropeanRoman", "Greek", "Hebrew", "Japanese", "Korean", "Roman", "SimplifiedChinese", "Thai", "TraditionalChinese", "Vietnamese"]);
  63859. }
  63860. }
  63861. class Destination extends _xfa_object.OptionObject {
  63862. constructor(attributes) {
  63863. super(CONFIG_NS_ID, "destination", ["pdf", "pcl", "ps", "webClient", "zpl"]);
  63864. }
  63865. }
  63866. class DocumentAssembly extends _xfa_object.Option01 {
  63867. constructor(attributes) {
  63868. super(CONFIG_NS_ID, "documentAssembly");
  63869. }
  63870. }
  63871. class Driver extends _xfa_object.XFAObject {
  63872. constructor(attributes) {
  63873. super(CONFIG_NS_ID, "driver", true);
  63874. this.name = attributes.name ? attributes.name.trim() : "";
  63875. this.fontInfo = null;
  63876. this.xdc = null;
  63877. }
  63878. }
  63879. class DuplexOption extends _xfa_object.OptionObject {
  63880. constructor(attributes) {
  63881. super(CONFIG_NS_ID, "duplexOption", ["simplex", "duplexFlipLongEdge", "duplexFlipShortEdge"]);
  63882. }
  63883. }
  63884. class DynamicRender extends _xfa_object.OptionObject {
  63885. constructor(attributes) {
  63886. super(CONFIG_NS_ID, "dynamicRender", ["forbidden", "required"]);
  63887. }
  63888. }
  63889. class Embed extends _xfa_object.Option01 {
  63890. constructor(attributes) {
  63891. super(CONFIG_NS_ID, "embed");
  63892. }
  63893. }
  63894. class Encrypt extends _xfa_object.Option01 {
  63895. constructor(attributes) {
  63896. super(CONFIG_NS_ID, "encrypt");
  63897. }
  63898. }
  63899. class Encryption extends _xfa_object.XFAObject {
  63900. constructor(attributes) {
  63901. super(CONFIG_NS_ID, "encryption", true);
  63902. this.encrypt = null;
  63903. this.encryptionLevel = null;
  63904. this.permissions = null;
  63905. }
  63906. }
  63907. class EncryptionLevel extends _xfa_object.OptionObject {
  63908. constructor(attributes) {
  63909. super(CONFIG_NS_ID, "encryptionLevel", ["40bit", "128bit"]);
  63910. }
  63911. }
  63912. class Enforce extends _xfa_object.StringObject {
  63913. constructor(attributes) {
  63914. super(CONFIG_NS_ID, "enforce");
  63915. }
  63916. }
  63917. class Equate extends _xfa_object.XFAObject {
  63918. constructor(attributes) {
  63919. super(CONFIG_NS_ID, "equate");
  63920. this.force = (0, _utils.getInteger)({
  63921. data: attributes.force,
  63922. defaultValue: 1,
  63923. validate: n => n === 0
  63924. });
  63925. this.from = attributes.from || "";
  63926. this.to = attributes.to || "";
  63927. }
  63928. }
  63929. class EquateRange extends _xfa_object.XFAObject {
  63930. constructor(attributes) {
  63931. super(CONFIG_NS_ID, "equateRange");
  63932. this.from = attributes.from || "";
  63933. this.to = attributes.to || "";
  63934. this._unicodeRange = attributes.unicodeRange || "";
  63935. }
  63936. get unicodeRange() {
  63937. const ranges = [];
  63938. const unicodeRegex = /U\+([0-9a-fA-F]+)/;
  63939. const unicodeRange = this._unicodeRange;
  63940. for (let range of unicodeRange.split(",").map(x => x.trim()).filter(x => !!x)) {
  63941. range = range.split("-", 2).map(x => {
  63942. const found = x.match(unicodeRegex);
  63943. if (!found) {
  63944. return 0;
  63945. }
  63946. return parseInt(found[1], 16);
  63947. });
  63948. if (range.length === 1) {
  63949. range.push(range[0]);
  63950. }
  63951. ranges.push(range);
  63952. }
  63953. return (0, _util.shadow)(this, "unicodeRange", ranges);
  63954. }
  63955. }
  63956. class Exclude extends _xfa_object.ContentObject {
  63957. constructor(attributes) {
  63958. super(CONFIG_NS_ID, "exclude");
  63959. }
  63960. [_xfa_object.$finalize]() {
  63961. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/).filter(x => x && ["calculate", "close", "enter", "exit", "initialize", "ready", "validate"].includes(x));
  63962. }
  63963. }
  63964. class ExcludeNS extends _xfa_object.StringObject {
  63965. constructor(attributes) {
  63966. super(CONFIG_NS_ID, "excludeNS");
  63967. }
  63968. }
  63969. class FlipLabel extends _xfa_object.OptionObject {
  63970. constructor(attributes) {
  63971. super(CONFIG_NS_ID, "flipLabel", ["usePrinterSetting", "on", "off"]);
  63972. }
  63973. }
  63974. class FontInfo extends _xfa_object.XFAObject {
  63975. constructor(attributes) {
  63976. super(CONFIG_NS_ID, "fontInfo", true);
  63977. this.embed = null;
  63978. this.map = null;
  63979. this.subsetBelow = null;
  63980. this.alwaysEmbed = new _xfa_object.XFAObjectArray();
  63981. this.defaultTypeface = new _xfa_object.XFAObjectArray();
  63982. this.neverEmbed = new _xfa_object.XFAObjectArray();
  63983. }
  63984. }
  63985. class FormFieldFilling extends _xfa_object.Option01 {
  63986. constructor(attributes) {
  63987. super(CONFIG_NS_ID, "formFieldFilling");
  63988. }
  63989. }
  63990. class GroupParent extends _xfa_object.StringObject {
  63991. constructor(attributes) {
  63992. super(CONFIG_NS_ID, "groupParent");
  63993. }
  63994. }
  63995. class IfEmpty extends _xfa_object.OptionObject {
  63996. constructor(attributes) {
  63997. super(CONFIG_NS_ID, "ifEmpty", ["dataValue", "dataGroup", "ignore", "remove"]);
  63998. }
  63999. }
  64000. class IncludeXDPContent extends _xfa_object.StringObject {
  64001. constructor(attributes) {
  64002. super(CONFIG_NS_ID, "includeXDPContent");
  64003. }
  64004. }
  64005. class IncrementalLoad extends _xfa_object.OptionObject {
  64006. constructor(attributes) {
  64007. super(CONFIG_NS_ID, "incrementalLoad", ["none", "forwardOnly"]);
  64008. }
  64009. }
  64010. class IncrementalMerge extends _xfa_object.Option01 {
  64011. constructor(attributes) {
  64012. super(CONFIG_NS_ID, "incrementalMerge");
  64013. }
  64014. }
  64015. class Interactive extends _xfa_object.Option01 {
  64016. constructor(attributes) {
  64017. super(CONFIG_NS_ID, "interactive");
  64018. }
  64019. }
  64020. class Jog extends _xfa_object.OptionObject {
  64021. constructor(attributes) {
  64022. super(CONFIG_NS_ID, "jog", ["usePrinterSetting", "none", "pageSet"]);
  64023. }
  64024. }
  64025. class LabelPrinter extends _xfa_object.XFAObject {
  64026. constructor(attributes) {
  64027. super(CONFIG_NS_ID, "labelPrinter", true);
  64028. this.name = (0, _utils.getStringOption)(attributes.name, ["zpl", "dpl", "ipl", "tcpl"]);
  64029. this.batchOutput = null;
  64030. this.flipLabel = null;
  64031. this.fontInfo = null;
  64032. this.xdc = null;
  64033. }
  64034. }
  64035. class Layout extends _xfa_object.OptionObject {
  64036. constructor(attributes) {
  64037. super(CONFIG_NS_ID, "layout", ["paginate", "panel"]);
  64038. }
  64039. }
  64040. class Level extends _xfa_object.IntegerObject {
  64041. constructor(attributes) {
  64042. super(CONFIG_NS_ID, "level", 0, n => n > 0);
  64043. }
  64044. }
  64045. class Linearized extends _xfa_object.Option01 {
  64046. constructor(attributes) {
  64047. super(CONFIG_NS_ID, "linearized");
  64048. }
  64049. }
  64050. class Locale extends _xfa_object.StringObject {
  64051. constructor(attributes) {
  64052. super(CONFIG_NS_ID, "locale");
  64053. }
  64054. }
  64055. class LocaleSet extends _xfa_object.StringObject {
  64056. constructor(attributes) {
  64057. super(CONFIG_NS_ID, "localeSet");
  64058. }
  64059. }
  64060. class Log extends _xfa_object.XFAObject {
  64061. constructor(attributes) {
  64062. super(CONFIG_NS_ID, "log", true);
  64063. this.mode = null;
  64064. this.threshold = null;
  64065. this.to = null;
  64066. this.uri = null;
  64067. }
  64068. }
  64069. class MapElement extends _xfa_object.XFAObject {
  64070. constructor(attributes) {
  64071. super(CONFIG_NS_ID, "map", true);
  64072. this.equate = new _xfa_object.XFAObjectArray();
  64073. this.equateRange = new _xfa_object.XFAObjectArray();
  64074. }
  64075. }
  64076. class MediumInfo extends _xfa_object.XFAObject {
  64077. constructor(attributes) {
  64078. super(CONFIG_NS_ID, "mediumInfo", true);
  64079. this.map = null;
  64080. }
  64081. }
  64082. class Message extends _xfa_object.XFAObject {
  64083. constructor(attributes) {
  64084. super(CONFIG_NS_ID, "message", true);
  64085. this.msgId = null;
  64086. this.severity = null;
  64087. }
  64088. }
  64089. class Messaging extends _xfa_object.XFAObject {
  64090. constructor(attributes) {
  64091. super(CONFIG_NS_ID, "messaging", true);
  64092. this.message = new _xfa_object.XFAObjectArray();
  64093. }
  64094. }
  64095. class Mode extends _xfa_object.OptionObject {
  64096. constructor(attributes) {
  64097. super(CONFIG_NS_ID, "mode", ["append", "overwrite"]);
  64098. }
  64099. }
  64100. class ModifyAnnots extends _xfa_object.Option01 {
  64101. constructor(attributes) {
  64102. super(CONFIG_NS_ID, "modifyAnnots");
  64103. }
  64104. }
  64105. class MsgId extends _xfa_object.IntegerObject {
  64106. constructor(attributes) {
  64107. super(CONFIG_NS_ID, "msgId", 1, n => n >= 1);
  64108. }
  64109. }
  64110. class NameAttr extends _xfa_object.StringObject {
  64111. constructor(attributes) {
  64112. super(CONFIG_NS_ID, "nameAttr");
  64113. }
  64114. }
  64115. class NeverEmbed extends _xfa_object.ContentObject {
  64116. constructor(attributes) {
  64117. super(CONFIG_NS_ID, "neverEmbed");
  64118. }
  64119. }
  64120. class NumberOfCopies extends _xfa_object.IntegerObject {
  64121. constructor(attributes) {
  64122. super(CONFIG_NS_ID, "numberOfCopies", null, n => n >= 2 && n <= 5);
  64123. }
  64124. }
  64125. class OpenAction extends _xfa_object.XFAObject {
  64126. constructor(attributes) {
  64127. super(CONFIG_NS_ID, "openAction", true);
  64128. this.destination = null;
  64129. }
  64130. }
  64131. class Output extends _xfa_object.XFAObject {
  64132. constructor(attributes) {
  64133. super(CONFIG_NS_ID, "output", true);
  64134. this.to = null;
  64135. this.type = null;
  64136. this.uri = null;
  64137. }
  64138. }
  64139. class OutputBin extends _xfa_object.StringObject {
  64140. constructor(attributes) {
  64141. super(CONFIG_NS_ID, "outputBin");
  64142. }
  64143. }
  64144. class OutputXSL extends _xfa_object.XFAObject {
  64145. constructor(attributes) {
  64146. super(CONFIG_NS_ID, "outputXSL", true);
  64147. this.uri = null;
  64148. }
  64149. }
  64150. class Overprint extends _xfa_object.OptionObject {
  64151. constructor(attributes) {
  64152. super(CONFIG_NS_ID, "overprint", ["none", "both", "draw", "field"]);
  64153. }
  64154. }
  64155. class Packets extends _xfa_object.StringObject {
  64156. constructor(attributes) {
  64157. super(CONFIG_NS_ID, "packets");
  64158. }
  64159. [_xfa_object.$finalize]() {
  64160. if (this[_xfa_object.$content] === "*") {
  64161. return;
  64162. }
  64163. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/).filter(x => ["config", "datasets", "template", "xfdf", "xslt"].includes(x));
  64164. }
  64165. }
  64166. class PageOffset extends _xfa_object.XFAObject {
  64167. constructor(attributes) {
  64168. super(CONFIG_NS_ID, "pageOffset");
  64169. this.x = (0, _utils.getInteger)({
  64170. data: attributes.x,
  64171. defaultValue: "useXDCSetting",
  64172. validate: n => true
  64173. });
  64174. this.y = (0, _utils.getInteger)({
  64175. data: attributes.y,
  64176. defaultValue: "useXDCSetting",
  64177. validate: n => true
  64178. });
  64179. }
  64180. }
  64181. class PageRange extends _xfa_object.StringObject {
  64182. constructor(attributes) {
  64183. super(CONFIG_NS_ID, "pageRange");
  64184. }
  64185. [_xfa_object.$finalize]() {
  64186. const numbers = this[_xfa_object.$content].trim().split(/\s+/).map(x => parseInt(x, 10));
  64187. const ranges = [];
  64188. for (let i = 0, ii = numbers.length; i < ii; i += 2) {
  64189. ranges.push(numbers.slice(i, i + 2));
  64190. }
  64191. this[_xfa_object.$content] = ranges;
  64192. }
  64193. }
  64194. class Pagination extends _xfa_object.OptionObject {
  64195. constructor(attributes) {
  64196. super(CONFIG_NS_ID, "pagination", ["simplex", "duplexShortEdge", "duplexLongEdge"]);
  64197. }
  64198. }
  64199. class PaginationOverride extends _xfa_object.OptionObject {
  64200. constructor(attributes) {
  64201. super(CONFIG_NS_ID, "paginationOverride", ["none", "forceDuplex", "forceDuplexLongEdge", "forceDuplexShortEdge", "forceSimplex"]);
  64202. }
  64203. }
  64204. class Part extends _xfa_object.IntegerObject {
  64205. constructor(attributes) {
  64206. super(CONFIG_NS_ID, "part", 1, n => false);
  64207. }
  64208. }
  64209. class Pcl extends _xfa_object.XFAObject {
  64210. constructor(attributes) {
  64211. super(CONFIG_NS_ID, "pcl", true);
  64212. this.name = attributes.name || "";
  64213. this.batchOutput = null;
  64214. this.fontInfo = null;
  64215. this.jog = null;
  64216. this.mediumInfo = null;
  64217. this.outputBin = null;
  64218. this.pageOffset = null;
  64219. this.staple = null;
  64220. this.xdc = null;
  64221. }
  64222. }
  64223. class Pdf extends _xfa_object.XFAObject {
  64224. constructor(attributes) {
  64225. super(CONFIG_NS_ID, "pdf", true);
  64226. this.name = attributes.name || "";
  64227. this.adobeExtensionLevel = null;
  64228. this.batchOutput = null;
  64229. this.compression = null;
  64230. this.creator = null;
  64231. this.encryption = null;
  64232. this.fontInfo = null;
  64233. this.interactive = null;
  64234. this.linearized = null;
  64235. this.openAction = null;
  64236. this.pdfa = null;
  64237. this.producer = null;
  64238. this.renderPolicy = null;
  64239. this.scriptModel = null;
  64240. this.silentPrint = null;
  64241. this.submitFormat = null;
  64242. this.tagged = null;
  64243. this.version = null;
  64244. this.viewerPreferences = null;
  64245. this.xdc = null;
  64246. }
  64247. }
  64248. class Pdfa extends _xfa_object.XFAObject {
  64249. constructor(attributes) {
  64250. super(CONFIG_NS_ID, "pdfa", true);
  64251. this.amd = null;
  64252. this.conformance = null;
  64253. this.includeXDPContent = null;
  64254. this.part = null;
  64255. }
  64256. }
  64257. class Permissions extends _xfa_object.XFAObject {
  64258. constructor(attributes) {
  64259. super(CONFIG_NS_ID, "permissions", true);
  64260. this.accessibleContent = null;
  64261. this.change = null;
  64262. this.contentCopy = null;
  64263. this.documentAssembly = null;
  64264. this.formFieldFilling = null;
  64265. this.modifyAnnots = null;
  64266. this.plaintextMetadata = null;
  64267. this.print = null;
  64268. this.printHighQuality = null;
  64269. }
  64270. }
  64271. class PickTrayByPDFSize extends _xfa_object.Option01 {
  64272. constructor(attributes) {
  64273. super(CONFIG_NS_ID, "pickTrayByPDFSize");
  64274. }
  64275. }
  64276. class Picture extends _xfa_object.StringObject {
  64277. constructor(attributes) {
  64278. super(CONFIG_NS_ID, "picture");
  64279. }
  64280. }
  64281. class PlaintextMetadata extends _xfa_object.Option01 {
  64282. constructor(attributes) {
  64283. super(CONFIG_NS_ID, "plaintextMetadata");
  64284. }
  64285. }
  64286. class Presence extends _xfa_object.OptionObject {
  64287. constructor(attributes) {
  64288. super(CONFIG_NS_ID, "presence", ["preserve", "dissolve", "dissolveStructure", "ignore", "remove"]);
  64289. }
  64290. }
  64291. class Present extends _xfa_object.XFAObject {
  64292. constructor(attributes) {
  64293. super(CONFIG_NS_ID, "present", true);
  64294. this.behaviorOverride = null;
  64295. this.cache = null;
  64296. this.common = null;
  64297. this.copies = null;
  64298. this.destination = null;
  64299. this.incrementalMerge = null;
  64300. this.layout = null;
  64301. this.output = null;
  64302. this.overprint = null;
  64303. this.pagination = null;
  64304. this.paginationOverride = null;
  64305. this.script = null;
  64306. this.validate = null;
  64307. this.xdp = null;
  64308. this.driver = new _xfa_object.XFAObjectArray();
  64309. this.labelPrinter = new _xfa_object.XFAObjectArray();
  64310. this.pcl = new _xfa_object.XFAObjectArray();
  64311. this.pdf = new _xfa_object.XFAObjectArray();
  64312. this.ps = new _xfa_object.XFAObjectArray();
  64313. this.submitUrl = new _xfa_object.XFAObjectArray();
  64314. this.webClient = new _xfa_object.XFAObjectArray();
  64315. this.zpl = new _xfa_object.XFAObjectArray();
  64316. }
  64317. }
  64318. class Print extends _xfa_object.Option01 {
  64319. constructor(attributes) {
  64320. super(CONFIG_NS_ID, "print");
  64321. }
  64322. }
  64323. class PrintHighQuality extends _xfa_object.Option01 {
  64324. constructor(attributes) {
  64325. super(CONFIG_NS_ID, "printHighQuality");
  64326. }
  64327. }
  64328. class PrintScaling extends _xfa_object.OptionObject {
  64329. constructor(attributes) {
  64330. super(CONFIG_NS_ID, "printScaling", ["appdefault", "noScaling"]);
  64331. }
  64332. }
  64333. class PrinterName extends _xfa_object.StringObject {
  64334. constructor(attributes) {
  64335. super(CONFIG_NS_ID, "printerName");
  64336. }
  64337. }
  64338. class Producer extends _xfa_object.StringObject {
  64339. constructor(attributes) {
  64340. super(CONFIG_NS_ID, "producer");
  64341. }
  64342. }
  64343. class Ps extends _xfa_object.XFAObject {
  64344. constructor(attributes) {
  64345. super(CONFIG_NS_ID, "ps", true);
  64346. this.name = attributes.name || "";
  64347. this.batchOutput = null;
  64348. this.fontInfo = null;
  64349. this.jog = null;
  64350. this.mediumInfo = null;
  64351. this.outputBin = null;
  64352. this.staple = null;
  64353. this.xdc = null;
  64354. }
  64355. }
  64356. class Range extends _xfa_object.ContentObject {
  64357. constructor(attributes) {
  64358. super(CONFIG_NS_ID, "range");
  64359. }
  64360. [_xfa_object.$finalize]() {
  64361. 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 => {
  64362. if (range.length === 1) {
  64363. range.push(range[0]);
  64364. }
  64365. return range;
  64366. });
  64367. }
  64368. }
  64369. class Record extends _xfa_object.ContentObject {
  64370. constructor(attributes) {
  64371. super(CONFIG_NS_ID, "record");
  64372. }
  64373. [_xfa_object.$finalize]() {
  64374. this[_xfa_object.$content] = this[_xfa_object.$content].trim();
  64375. const n = parseInt(this[_xfa_object.$content], 10);
  64376. if (!isNaN(n) && n >= 0) {
  64377. this[_xfa_object.$content] = n;
  64378. }
  64379. }
  64380. }
  64381. class Relevant extends _xfa_object.ContentObject {
  64382. constructor(attributes) {
  64383. super(CONFIG_NS_ID, "relevant");
  64384. }
  64385. [_xfa_object.$finalize]() {
  64386. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/);
  64387. }
  64388. }
  64389. class Rename extends _xfa_object.ContentObject {
  64390. constructor(attributes) {
  64391. super(CONFIG_NS_ID, "rename");
  64392. }
  64393. [_xfa_object.$finalize]() {
  64394. this[_xfa_object.$content] = this[_xfa_object.$content].trim();
  64395. if (this[_xfa_object.$content].toLowerCase().startsWith("xml") || new RegExp("[\\p{L}_][\\p{L}\\d._\\p{M}-]*", "u").test(this[_xfa_object.$content])) {
  64396. (0, _util.warn)("XFA - Rename: invalid XFA name");
  64397. }
  64398. }
  64399. }
  64400. class RenderPolicy extends _xfa_object.OptionObject {
  64401. constructor(attributes) {
  64402. super(CONFIG_NS_ID, "renderPolicy", ["server", "client"]);
  64403. }
  64404. }
  64405. class RunScripts extends _xfa_object.OptionObject {
  64406. constructor(attributes) {
  64407. super(CONFIG_NS_ID, "runScripts", ["both", "client", "none", "server"]);
  64408. }
  64409. }
  64410. class Script extends _xfa_object.XFAObject {
  64411. constructor(attributes) {
  64412. super(CONFIG_NS_ID, "script", true);
  64413. this.currentPage = null;
  64414. this.exclude = null;
  64415. this.runScripts = null;
  64416. }
  64417. }
  64418. class ScriptModel extends _xfa_object.OptionObject {
  64419. constructor(attributes) {
  64420. super(CONFIG_NS_ID, "scriptModel", ["XFA", "none"]);
  64421. }
  64422. }
  64423. class Severity extends _xfa_object.OptionObject {
  64424. constructor(attributes) {
  64425. super(CONFIG_NS_ID, "severity", ["ignore", "error", "information", "trace", "warning"]);
  64426. }
  64427. }
  64428. class SilentPrint extends _xfa_object.XFAObject {
  64429. constructor(attributes) {
  64430. super(CONFIG_NS_ID, "silentPrint", true);
  64431. this.addSilentPrint = null;
  64432. this.printerName = null;
  64433. }
  64434. }
  64435. class Staple extends _xfa_object.XFAObject {
  64436. constructor(attributes) {
  64437. super(CONFIG_NS_ID, "staple");
  64438. this.mode = (0, _utils.getStringOption)(attributes.mode, ["usePrinterSetting", "on", "off"]);
  64439. }
  64440. }
  64441. class StartNode extends _xfa_object.StringObject {
  64442. constructor(attributes) {
  64443. super(CONFIG_NS_ID, "startNode");
  64444. }
  64445. }
  64446. class StartPage extends _xfa_object.IntegerObject {
  64447. constructor(attributes) {
  64448. super(CONFIG_NS_ID, "startPage", 0, n => true);
  64449. }
  64450. }
  64451. class SubmitFormat extends _xfa_object.OptionObject {
  64452. constructor(attributes) {
  64453. super(CONFIG_NS_ID, "submitFormat", ["html", "delegate", "fdf", "xml", "pdf"]);
  64454. }
  64455. }
  64456. class SubmitUrl extends _xfa_object.StringObject {
  64457. constructor(attributes) {
  64458. super(CONFIG_NS_ID, "submitUrl");
  64459. }
  64460. }
  64461. class SubsetBelow extends _xfa_object.IntegerObject {
  64462. constructor(attributes) {
  64463. super(CONFIG_NS_ID, "subsetBelow", 100, n => n >= 0 && n <= 100);
  64464. }
  64465. }
  64466. class SuppressBanner extends _xfa_object.Option01 {
  64467. constructor(attributes) {
  64468. super(CONFIG_NS_ID, "suppressBanner");
  64469. }
  64470. }
  64471. class Tagged extends _xfa_object.Option01 {
  64472. constructor(attributes) {
  64473. super(CONFIG_NS_ID, "tagged");
  64474. }
  64475. }
  64476. class Template extends _xfa_object.XFAObject {
  64477. constructor(attributes) {
  64478. super(CONFIG_NS_ID, "template", true);
  64479. this.base = null;
  64480. this.relevant = null;
  64481. this.startPage = null;
  64482. this.uri = null;
  64483. this.xsl = null;
  64484. }
  64485. }
  64486. class Threshold extends _xfa_object.OptionObject {
  64487. constructor(attributes) {
  64488. super(CONFIG_NS_ID, "threshold", ["trace", "error", "information", "warning"]);
  64489. }
  64490. }
  64491. class To extends _xfa_object.OptionObject {
  64492. constructor(attributes) {
  64493. super(CONFIG_NS_ID, "to", ["null", "memory", "stderr", "stdout", "system", "uri"]);
  64494. }
  64495. }
  64496. class TemplateCache extends _xfa_object.XFAObject {
  64497. constructor(attributes) {
  64498. super(CONFIG_NS_ID, "templateCache");
  64499. this.maxEntries = (0, _utils.getInteger)({
  64500. data: attributes.maxEntries,
  64501. defaultValue: 5,
  64502. validate: n => n >= 0
  64503. });
  64504. }
  64505. }
  64506. class Trace extends _xfa_object.XFAObject {
  64507. constructor(attributes) {
  64508. super(CONFIG_NS_ID, "trace", true);
  64509. this.area = new _xfa_object.XFAObjectArray();
  64510. }
  64511. }
  64512. class Transform extends _xfa_object.XFAObject {
  64513. constructor(attributes) {
  64514. super(CONFIG_NS_ID, "transform", true);
  64515. this.groupParent = null;
  64516. this.ifEmpty = null;
  64517. this.nameAttr = null;
  64518. this.picture = null;
  64519. this.presence = null;
  64520. this.rename = null;
  64521. this.whitespace = null;
  64522. }
  64523. }
  64524. class Type extends _xfa_object.OptionObject {
  64525. constructor(attributes) {
  64526. super(CONFIG_NS_ID, "type", ["none", "ascii85", "asciiHex", "ccittfax", "flate", "lzw", "runLength", "native", "xdp", "mergedXDP"]);
  64527. }
  64528. }
  64529. class Uri extends _xfa_object.StringObject {
  64530. constructor(attributes) {
  64531. super(CONFIG_NS_ID, "uri");
  64532. }
  64533. }
  64534. class Validate extends _xfa_object.OptionObject {
  64535. constructor(attributes) {
  64536. super(CONFIG_NS_ID, "validate", ["preSubmit", "prePrint", "preExecute", "preSave"]);
  64537. }
  64538. }
  64539. class ValidateApprovalSignatures extends _xfa_object.ContentObject {
  64540. constructor(attributes) {
  64541. super(CONFIG_NS_ID, "validateApprovalSignatures");
  64542. }
  64543. [_xfa_object.$finalize]() {
  64544. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/).filter(x => ["docReady", "postSign"].includes(x));
  64545. }
  64546. }
  64547. class ValidationMessaging extends _xfa_object.OptionObject {
  64548. constructor(attributes) {
  64549. super(CONFIG_NS_ID, "validationMessaging", ["allMessagesIndividually", "allMessagesTogether", "firstMessageOnly", "noMessages"]);
  64550. }
  64551. }
  64552. class Version extends _xfa_object.OptionObject {
  64553. constructor(attributes) {
  64554. super(CONFIG_NS_ID, "version", ["1.7", "1.6", "1.5", "1.4", "1.3", "1.2"]);
  64555. }
  64556. }
  64557. class VersionControl extends _xfa_object.XFAObject {
  64558. constructor(attributes) {
  64559. super(CONFIG_NS_ID, "VersionControl");
  64560. this.outputBelow = (0, _utils.getStringOption)(attributes.outputBelow, ["warn", "error", "update"]);
  64561. this.sourceAbove = (0, _utils.getStringOption)(attributes.sourceAbove, ["warn", "error"]);
  64562. this.sourceBelow = (0, _utils.getStringOption)(attributes.sourceBelow, ["update", "maintain"]);
  64563. }
  64564. }
  64565. class ViewerPreferences extends _xfa_object.XFAObject {
  64566. constructor(attributes) {
  64567. super(CONFIG_NS_ID, "viewerPreferences", true);
  64568. this.ADBE_JSConsole = null;
  64569. this.ADBE_JSDebugger = null;
  64570. this.addViewerPreferences = null;
  64571. this.duplexOption = null;
  64572. this.enforce = null;
  64573. this.numberOfCopies = null;
  64574. this.pageRange = null;
  64575. this.pickTrayByPDFSize = null;
  64576. this.printScaling = null;
  64577. }
  64578. }
  64579. class WebClient extends _xfa_object.XFAObject {
  64580. constructor(attributes) {
  64581. super(CONFIG_NS_ID, "webClient", true);
  64582. this.name = attributes.name ? attributes.name.trim() : "";
  64583. this.fontInfo = null;
  64584. this.xdc = null;
  64585. }
  64586. }
  64587. class Whitespace extends _xfa_object.OptionObject {
  64588. constructor(attributes) {
  64589. super(CONFIG_NS_ID, "whitespace", ["preserve", "ltrim", "normalize", "rtrim", "trim"]);
  64590. }
  64591. }
  64592. class Window extends _xfa_object.ContentObject {
  64593. constructor(attributes) {
  64594. super(CONFIG_NS_ID, "window");
  64595. }
  64596. [_xfa_object.$finalize]() {
  64597. const pair = this[_xfa_object.$content].trim().split(/\s*,\s*/, 2).map(x => parseInt(x, 10));
  64598. if (pair.some(x => isNaN(x))) {
  64599. this[_xfa_object.$content] = [0, 0];
  64600. return;
  64601. }
  64602. if (pair.length === 1) {
  64603. pair.push(pair[0]);
  64604. }
  64605. this[_xfa_object.$content] = pair;
  64606. }
  64607. }
  64608. class Xdc extends _xfa_object.XFAObject {
  64609. constructor(attributes) {
  64610. super(CONFIG_NS_ID, "xdc", true);
  64611. this.uri = new _xfa_object.XFAObjectArray();
  64612. this.xsl = new _xfa_object.XFAObjectArray();
  64613. }
  64614. }
  64615. class Xdp extends _xfa_object.XFAObject {
  64616. constructor(attributes) {
  64617. super(CONFIG_NS_ID, "xdp", true);
  64618. this.packets = null;
  64619. }
  64620. }
  64621. class Xsl extends _xfa_object.XFAObject {
  64622. constructor(attributes) {
  64623. super(CONFIG_NS_ID, "xsl", true);
  64624. this.debug = null;
  64625. this.uri = null;
  64626. }
  64627. }
  64628. class Zpl extends _xfa_object.XFAObject {
  64629. constructor(attributes) {
  64630. super(CONFIG_NS_ID, "zpl", true);
  64631. this.name = attributes.name ? attributes.name.trim() : "";
  64632. this.batchOutput = null;
  64633. this.flipLabel = null;
  64634. this.fontInfo = null;
  64635. this.xdc = null;
  64636. }
  64637. }
  64638. class ConfigNamespace {
  64639. static [_namespaces.$buildXFAObject](name, attributes) {
  64640. if (ConfigNamespace.hasOwnProperty(name)) {
  64641. return ConfigNamespace[name](attributes);
  64642. }
  64643. return undefined;
  64644. }
  64645. static acrobat(attrs) {
  64646. return new Acrobat(attrs);
  64647. }
  64648. static acrobat7(attrs) {
  64649. return new Acrobat7(attrs);
  64650. }
  64651. static ADBE_JSConsole(attrs) {
  64652. return new ADBE_JSConsole(attrs);
  64653. }
  64654. static ADBE_JSDebugger(attrs) {
  64655. return new ADBE_JSDebugger(attrs);
  64656. }
  64657. static addSilentPrint(attrs) {
  64658. return new AddSilentPrint(attrs);
  64659. }
  64660. static addViewerPreferences(attrs) {
  64661. return new AddViewerPreferences(attrs);
  64662. }
  64663. static adjustData(attrs) {
  64664. return new AdjustData(attrs);
  64665. }
  64666. static adobeExtensionLevel(attrs) {
  64667. return new AdobeExtensionLevel(attrs);
  64668. }
  64669. static agent(attrs) {
  64670. return new Agent(attrs);
  64671. }
  64672. static alwaysEmbed(attrs) {
  64673. return new AlwaysEmbed(attrs);
  64674. }
  64675. static amd(attrs) {
  64676. return new Amd(attrs);
  64677. }
  64678. static area(attrs) {
  64679. return new Area(attrs);
  64680. }
  64681. static attributes(attrs) {
  64682. return new Attributes(attrs);
  64683. }
  64684. static autoSave(attrs) {
  64685. return new AutoSave(attrs);
  64686. }
  64687. static base(attrs) {
  64688. return new Base(attrs);
  64689. }
  64690. static batchOutput(attrs) {
  64691. return new BatchOutput(attrs);
  64692. }
  64693. static behaviorOverride(attrs) {
  64694. return new BehaviorOverride(attrs);
  64695. }
  64696. static cache(attrs) {
  64697. return new Cache(attrs);
  64698. }
  64699. static change(attrs) {
  64700. return new Change(attrs);
  64701. }
  64702. static common(attrs) {
  64703. return new Common(attrs);
  64704. }
  64705. static compress(attrs) {
  64706. return new Compress(attrs);
  64707. }
  64708. static compressLogicalStructure(attrs) {
  64709. return new CompressLogicalStructure(attrs);
  64710. }
  64711. static compressObjectStream(attrs) {
  64712. return new CompressObjectStream(attrs);
  64713. }
  64714. static compression(attrs) {
  64715. return new Compression(attrs);
  64716. }
  64717. static config(attrs) {
  64718. return new Config(attrs);
  64719. }
  64720. static conformance(attrs) {
  64721. return new Conformance(attrs);
  64722. }
  64723. static contentCopy(attrs) {
  64724. return new ContentCopy(attrs);
  64725. }
  64726. static copies(attrs) {
  64727. return new Copies(attrs);
  64728. }
  64729. static creator(attrs) {
  64730. return new Creator(attrs);
  64731. }
  64732. static currentPage(attrs) {
  64733. return new CurrentPage(attrs);
  64734. }
  64735. static data(attrs) {
  64736. return new Data(attrs);
  64737. }
  64738. static debug(attrs) {
  64739. return new Debug(attrs);
  64740. }
  64741. static defaultTypeface(attrs) {
  64742. return new DefaultTypeface(attrs);
  64743. }
  64744. static destination(attrs) {
  64745. return new Destination(attrs);
  64746. }
  64747. static documentAssembly(attrs) {
  64748. return new DocumentAssembly(attrs);
  64749. }
  64750. static driver(attrs) {
  64751. return new Driver(attrs);
  64752. }
  64753. static duplexOption(attrs) {
  64754. return new DuplexOption(attrs);
  64755. }
  64756. static dynamicRender(attrs) {
  64757. return new DynamicRender(attrs);
  64758. }
  64759. static embed(attrs) {
  64760. return new Embed(attrs);
  64761. }
  64762. static encrypt(attrs) {
  64763. return new Encrypt(attrs);
  64764. }
  64765. static encryption(attrs) {
  64766. return new Encryption(attrs);
  64767. }
  64768. static encryptionLevel(attrs) {
  64769. return new EncryptionLevel(attrs);
  64770. }
  64771. static enforce(attrs) {
  64772. return new Enforce(attrs);
  64773. }
  64774. static equate(attrs) {
  64775. return new Equate(attrs);
  64776. }
  64777. static equateRange(attrs) {
  64778. return new EquateRange(attrs);
  64779. }
  64780. static exclude(attrs) {
  64781. return new Exclude(attrs);
  64782. }
  64783. static excludeNS(attrs) {
  64784. return new ExcludeNS(attrs);
  64785. }
  64786. static flipLabel(attrs) {
  64787. return new FlipLabel(attrs);
  64788. }
  64789. static fontInfo(attrs) {
  64790. return new FontInfo(attrs);
  64791. }
  64792. static formFieldFilling(attrs) {
  64793. return new FormFieldFilling(attrs);
  64794. }
  64795. static groupParent(attrs) {
  64796. return new GroupParent(attrs);
  64797. }
  64798. static ifEmpty(attrs) {
  64799. return new IfEmpty(attrs);
  64800. }
  64801. static includeXDPContent(attrs) {
  64802. return new IncludeXDPContent(attrs);
  64803. }
  64804. static incrementalLoad(attrs) {
  64805. return new IncrementalLoad(attrs);
  64806. }
  64807. static incrementalMerge(attrs) {
  64808. return new IncrementalMerge(attrs);
  64809. }
  64810. static interactive(attrs) {
  64811. return new Interactive(attrs);
  64812. }
  64813. static jog(attrs) {
  64814. return new Jog(attrs);
  64815. }
  64816. static labelPrinter(attrs) {
  64817. return new LabelPrinter(attrs);
  64818. }
  64819. static layout(attrs) {
  64820. return new Layout(attrs);
  64821. }
  64822. static level(attrs) {
  64823. return new Level(attrs);
  64824. }
  64825. static linearized(attrs) {
  64826. return new Linearized(attrs);
  64827. }
  64828. static locale(attrs) {
  64829. return new Locale(attrs);
  64830. }
  64831. static localeSet(attrs) {
  64832. return new LocaleSet(attrs);
  64833. }
  64834. static log(attrs) {
  64835. return new Log(attrs);
  64836. }
  64837. static map(attrs) {
  64838. return new MapElement(attrs);
  64839. }
  64840. static mediumInfo(attrs) {
  64841. return new MediumInfo(attrs);
  64842. }
  64843. static message(attrs) {
  64844. return new Message(attrs);
  64845. }
  64846. static messaging(attrs) {
  64847. return new Messaging(attrs);
  64848. }
  64849. static mode(attrs) {
  64850. return new Mode(attrs);
  64851. }
  64852. static modifyAnnots(attrs) {
  64853. return new ModifyAnnots(attrs);
  64854. }
  64855. static msgId(attrs) {
  64856. return new MsgId(attrs);
  64857. }
  64858. static nameAttr(attrs) {
  64859. return new NameAttr(attrs);
  64860. }
  64861. static neverEmbed(attrs) {
  64862. return new NeverEmbed(attrs);
  64863. }
  64864. static numberOfCopies(attrs) {
  64865. return new NumberOfCopies(attrs);
  64866. }
  64867. static openAction(attrs) {
  64868. return new OpenAction(attrs);
  64869. }
  64870. static output(attrs) {
  64871. return new Output(attrs);
  64872. }
  64873. static outputBin(attrs) {
  64874. return new OutputBin(attrs);
  64875. }
  64876. static outputXSL(attrs) {
  64877. return new OutputXSL(attrs);
  64878. }
  64879. static overprint(attrs) {
  64880. return new Overprint(attrs);
  64881. }
  64882. static packets(attrs) {
  64883. return new Packets(attrs);
  64884. }
  64885. static pageOffset(attrs) {
  64886. return new PageOffset(attrs);
  64887. }
  64888. static pageRange(attrs) {
  64889. return new PageRange(attrs);
  64890. }
  64891. static pagination(attrs) {
  64892. return new Pagination(attrs);
  64893. }
  64894. static paginationOverride(attrs) {
  64895. return new PaginationOverride(attrs);
  64896. }
  64897. static part(attrs) {
  64898. return new Part(attrs);
  64899. }
  64900. static pcl(attrs) {
  64901. return new Pcl(attrs);
  64902. }
  64903. static pdf(attrs) {
  64904. return new Pdf(attrs);
  64905. }
  64906. static pdfa(attrs) {
  64907. return new Pdfa(attrs);
  64908. }
  64909. static permissions(attrs) {
  64910. return new Permissions(attrs);
  64911. }
  64912. static pickTrayByPDFSize(attrs) {
  64913. return new PickTrayByPDFSize(attrs);
  64914. }
  64915. static picture(attrs) {
  64916. return new Picture(attrs);
  64917. }
  64918. static plaintextMetadata(attrs) {
  64919. return new PlaintextMetadata(attrs);
  64920. }
  64921. static presence(attrs) {
  64922. return new Presence(attrs);
  64923. }
  64924. static present(attrs) {
  64925. return new Present(attrs);
  64926. }
  64927. static print(attrs) {
  64928. return new Print(attrs);
  64929. }
  64930. static printHighQuality(attrs) {
  64931. return new PrintHighQuality(attrs);
  64932. }
  64933. static printScaling(attrs) {
  64934. return new PrintScaling(attrs);
  64935. }
  64936. static printerName(attrs) {
  64937. return new PrinterName(attrs);
  64938. }
  64939. static producer(attrs) {
  64940. return new Producer(attrs);
  64941. }
  64942. static ps(attrs) {
  64943. return new Ps(attrs);
  64944. }
  64945. static range(attrs) {
  64946. return new Range(attrs);
  64947. }
  64948. static record(attrs) {
  64949. return new Record(attrs);
  64950. }
  64951. static relevant(attrs) {
  64952. return new Relevant(attrs);
  64953. }
  64954. static rename(attrs) {
  64955. return new Rename(attrs);
  64956. }
  64957. static renderPolicy(attrs) {
  64958. return new RenderPolicy(attrs);
  64959. }
  64960. static runScripts(attrs) {
  64961. return new RunScripts(attrs);
  64962. }
  64963. static script(attrs) {
  64964. return new Script(attrs);
  64965. }
  64966. static scriptModel(attrs) {
  64967. return new ScriptModel(attrs);
  64968. }
  64969. static severity(attrs) {
  64970. return new Severity(attrs);
  64971. }
  64972. static silentPrint(attrs) {
  64973. return new SilentPrint(attrs);
  64974. }
  64975. static staple(attrs) {
  64976. return new Staple(attrs);
  64977. }
  64978. static startNode(attrs) {
  64979. return new StartNode(attrs);
  64980. }
  64981. static startPage(attrs) {
  64982. return new StartPage(attrs);
  64983. }
  64984. static submitFormat(attrs) {
  64985. return new SubmitFormat(attrs);
  64986. }
  64987. static submitUrl(attrs) {
  64988. return new SubmitUrl(attrs);
  64989. }
  64990. static subsetBelow(attrs) {
  64991. return new SubsetBelow(attrs);
  64992. }
  64993. static suppressBanner(attrs) {
  64994. return new SuppressBanner(attrs);
  64995. }
  64996. static tagged(attrs) {
  64997. return new Tagged(attrs);
  64998. }
  64999. static template(attrs) {
  65000. return new Template(attrs);
  65001. }
  65002. static templateCache(attrs) {
  65003. return new TemplateCache(attrs);
  65004. }
  65005. static threshold(attrs) {
  65006. return new Threshold(attrs);
  65007. }
  65008. static to(attrs) {
  65009. return new To(attrs);
  65010. }
  65011. static trace(attrs) {
  65012. return new Trace(attrs);
  65013. }
  65014. static transform(attrs) {
  65015. return new Transform(attrs);
  65016. }
  65017. static type(attrs) {
  65018. return new Type(attrs);
  65019. }
  65020. static uri(attrs) {
  65021. return new Uri(attrs);
  65022. }
  65023. static validate(attrs) {
  65024. return new Validate(attrs);
  65025. }
  65026. static validateApprovalSignatures(attrs) {
  65027. return new ValidateApprovalSignatures(attrs);
  65028. }
  65029. static validationMessaging(attrs) {
  65030. return new ValidationMessaging(attrs);
  65031. }
  65032. static version(attrs) {
  65033. return new Version(attrs);
  65034. }
  65035. static versionControl(attrs) {
  65036. return new VersionControl(attrs);
  65037. }
  65038. static viewerPreferences(attrs) {
  65039. return new ViewerPreferences(attrs);
  65040. }
  65041. static webClient(attrs) {
  65042. return new WebClient(attrs);
  65043. }
  65044. static whitespace(attrs) {
  65045. return new Whitespace(attrs);
  65046. }
  65047. static window(attrs) {
  65048. return new Window(attrs);
  65049. }
  65050. static xdc(attrs) {
  65051. return new Xdc(attrs);
  65052. }
  65053. static xdp(attrs) {
  65054. return new Xdp(attrs);
  65055. }
  65056. static xsl(attrs) {
  65057. return new Xsl(attrs);
  65058. }
  65059. static zpl(attrs) {
  65060. return new Zpl(attrs);
  65061. }
  65062. }
  65063. exports.ConfigNamespace = ConfigNamespace;
  65064. /***/ }),
  65065. /* 221 */
  65066. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  65067. "use strict";
  65068. Object.defineProperty(exports, "__esModule", ({
  65069. value: true
  65070. }));
  65071. exports.ConnectionSetNamespace = void 0;
  65072. var _namespaces = __w_pdfjs_require__(208);
  65073. var _xfa_object = __w_pdfjs_require__(206);
  65074. const CONNECTION_SET_NS_ID = _namespaces.NamespaceIds.connectionSet.id;
  65075. class ConnectionSet extends _xfa_object.XFAObject {
  65076. constructor(attributes) {
  65077. super(CONNECTION_SET_NS_ID, "connectionSet", true);
  65078. this.wsdlConnection = new _xfa_object.XFAObjectArray();
  65079. this.xmlConnection = new _xfa_object.XFAObjectArray();
  65080. this.xsdConnection = new _xfa_object.XFAObjectArray();
  65081. }
  65082. }
  65083. class EffectiveInputPolicy extends _xfa_object.XFAObject {
  65084. constructor(attributes) {
  65085. super(CONNECTION_SET_NS_ID, "effectiveInputPolicy");
  65086. this.id = attributes.id || "";
  65087. this.name = attributes.name || "";
  65088. this.use = attributes.use || "";
  65089. this.usehref = attributes.usehref || "";
  65090. }
  65091. }
  65092. class EffectiveOutputPolicy extends _xfa_object.XFAObject {
  65093. constructor(attributes) {
  65094. super(CONNECTION_SET_NS_ID, "effectiveOutputPolicy");
  65095. this.id = attributes.id || "";
  65096. this.name = attributes.name || "";
  65097. this.use = attributes.use || "";
  65098. this.usehref = attributes.usehref || "";
  65099. }
  65100. }
  65101. class Operation extends _xfa_object.StringObject {
  65102. constructor(attributes) {
  65103. super(CONNECTION_SET_NS_ID, "operation");
  65104. this.id = attributes.id || "";
  65105. this.input = attributes.input || "";
  65106. this.name = attributes.name || "";
  65107. this.output = attributes.output || "";
  65108. this.use = attributes.use || "";
  65109. this.usehref = attributes.usehref || "";
  65110. }
  65111. }
  65112. class RootElement extends _xfa_object.StringObject {
  65113. constructor(attributes) {
  65114. super(CONNECTION_SET_NS_ID, "rootElement");
  65115. this.id = attributes.id || "";
  65116. this.name = attributes.name || "";
  65117. this.use = attributes.use || "";
  65118. this.usehref = attributes.usehref || "";
  65119. }
  65120. }
  65121. class SoapAction extends _xfa_object.StringObject {
  65122. constructor(attributes) {
  65123. super(CONNECTION_SET_NS_ID, "soapAction");
  65124. this.id = attributes.id || "";
  65125. this.name = attributes.name || "";
  65126. this.use = attributes.use || "";
  65127. this.usehref = attributes.usehref || "";
  65128. }
  65129. }
  65130. class SoapAddress extends _xfa_object.StringObject {
  65131. constructor(attributes) {
  65132. super(CONNECTION_SET_NS_ID, "soapAddress");
  65133. this.id = attributes.id || "";
  65134. this.name = attributes.name || "";
  65135. this.use = attributes.use || "";
  65136. this.usehref = attributes.usehref || "";
  65137. }
  65138. }
  65139. class Uri extends _xfa_object.StringObject {
  65140. constructor(attributes) {
  65141. super(CONNECTION_SET_NS_ID, "uri");
  65142. this.id = attributes.id || "";
  65143. this.name = attributes.name || "";
  65144. this.use = attributes.use || "";
  65145. this.usehref = attributes.usehref || "";
  65146. }
  65147. }
  65148. class WsdlAddress extends _xfa_object.StringObject {
  65149. constructor(attributes) {
  65150. super(CONNECTION_SET_NS_ID, "wsdlAddress");
  65151. this.id = attributes.id || "";
  65152. this.name = attributes.name || "";
  65153. this.use = attributes.use || "";
  65154. this.usehref = attributes.usehref || "";
  65155. }
  65156. }
  65157. class WsdlConnection extends _xfa_object.XFAObject {
  65158. constructor(attributes) {
  65159. super(CONNECTION_SET_NS_ID, "wsdlConnection", true);
  65160. this.dataDescription = attributes.dataDescription || "";
  65161. this.name = attributes.name || "";
  65162. this.effectiveInputPolicy = null;
  65163. this.effectiveOutputPolicy = null;
  65164. this.operation = null;
  65165. this.soapAction = null;
  65166. this.soapAddress = null;
  65167. this.wsdlAddress = null;
  65168. }
  65169. }
  65170. class XmlConnection extends _xfa_object.XFAObject {
  65171. constructor(attributes) {
  65172. super(CONNECTION_SET_NS_ID, "xmlConnection", true);
  65173. this.dataDescription = attributes.dataDescription || "";
  65174. this.name = attributes.name || "";
  65175. this.uri = null;
  65176. }
  65177. }
  65178. class XsdConnection extends _xfa_object.XFAObject {
  65179. constructor(attributes) {
  65180. super(CONNECTION_SET_NS_ID, "xsdConnection", true);
  65181. this.dataDescription = attributes.dataDescription || "";
  65182. this.name = attributes.name || "";
  65183. this.rootElement = null;
  65184. this.uri = null;
  65185. }
  65186. }
  65187. class ConnectionSetNamespace {
  65188. static [_namespaces.$buildXFAObject](name, attributes) {
  65189. if (ConnectionSetNamespace.hasOwnProperty(name)) {
  65190. return ConnectionSetNamespace[name](attributes);
  65191. }
  65192. return undefined;
  65193. }
  65194. static connectionSet(attrs) {
  65195. return new ConnectionSet(attrs);
  65196. }
  65197. static effectiveInputPolicy(attrs) {
  65198. return new EffectiveInputPolicy(attrs);
  65199. }
  65200. static effectiveOutputPolicy(attrs) {
  65201. return new EffectiveOutputPolicy(attrs);
  65202. }
  65203. static operation(attrs) {
  65204. return new Operation(attrs);
  65205. }
  65206. static rootElement(attrs) {
  65207. return new RootElement(attrs);
  65208. }
  65209. static soapAction(attrs) {
  65210. return new SoapAction(attrs);
  65211. }
  65212. static soapAddress(attrs) {
  65213. return new SoapAddress(attrs);
  65214. }
  65215. static uri(attrs) {
  65216. return new Uri(attrs);
  65217. }
  65218. static wsdlAddress(attrs) {
  65219. return new WsdlAddress(attrs);
  65220. }
  65221. static wsdlConnection(attrs) {
  65222. return new WsdlConnection(attrs);
  65223. }
  65224. static xmlConnection(attrs) {
  65225. return new XmlConnection(attrs);
  65226. }
  65227. static xsdConnection(attrs) {
  65228. return new XsdConnection(attrs);
  65229. }
  65230. }
  65231. exports.ConnectionSetNamespace = ConnectionSetNamespace;
  65232. /***/ }),
  65233. /* 222 */
  65234. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  65235. "use strict";
  65236. Object.defineProperty(exports, "__esModule", ({
  65237. value: true
  65238. }));
  65239. exports.DatasetsNamespace = void 0;
  65240. var _xfa_object = __w_pdfjs_require__(206);
  65241. var _namespaces = __w_pdfjs_require__(208);
  65242. const DATASETS_NS_ID = _namespaces.NamespaceIds.datasets.id;
  65243. class Data extends _xfa_object.XmlObject {
  65244. constructor(attributes) {
  65245. super(DATASETS_NS_ID, "data", attributes);
  65246. }
  65247. [_xfa_object.$isNsAgnostic]() {
  65248. return true;
  65249. }
  65250. }
  65251. class Datasets extends _xfa_object.XFAObject {
  65252. constructor(attributes) {
  65253. super(DATASETS_NS_ID, "datasets", true);
  65254. this.data = null;
  65255. this.Signature = null;
  65256. }
  65257. [_xfa_object.$onChild](child) {
  65258. const name = child[_xfa_object.$nodeName];
  65259. if (name === "data" && child[_xfa_object.$namespaceId] === DATASETS_NS_ID || name === "Signature" && child[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.signature.id) {
  65260. this[name] = child;
  65261. }
  65262. this[_xfa_object.$appendChild](child);
  65263. }
  65264. }
  65265. class DatasetsNamespace {
  65266. static [_namespaces.$buildXFAObject](name, attributes) {
  65267. if (DatasetsNamespace.hasOwnProperty(name)) {
  65268. return DatasetsNamespace[name](attributes);
  65269. }
  65270. return undefined;
  65271. }
  65272. static datasets(attributes) {
  65273. return new Datasets(attributes);
  65274. }
  65275. static data(attributes) {
  65276. return new Data(attributes);
  65277. }
  65278. }
  65279. exports.DatasetsNamespace = DatasetsNamespace;
  65280. /***/ }),
  65281. /* 223 */
  65282. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  65283. "use strict";
  65284. Object.defineProperty(exports, "__esModule", ({
  65285. value: true
  65286. }));
  65287. exports.LocaleSetNamespace = void 0;
  65288. var _namespaces = __w_pdfjs_require__(208);
  65289. var _xfa_object = __w_pdfjs_require__(206);
  65290. var _utils = __w_pdfjs_require__(207);
  65291. const LOCALE_SET_NS_ID = _namespaces.NamespaceIds.localeSet.id;
  65292. class CalendarSymbols extends _xfa_object.XFAObject {
  65293. constructor(attributes) {
  65294. super(LOCALE_SET_NS_ID, "calendarSymbols", true);
  65295. this.name = "gregorian";
  65296. this.dayNames = new _xfa_object.XFAObjectArray(2);
  65297. this.eraNames = null;
  65298. this.meridiemNames = null;
  65299. this.monthNames = new _xfa_object.XFAObjectArray(2);
  65300. }
  65301. }
  65302. class CurrencySymbol extends _xfa_object.StringObject {
  65303. constructor(attributes) {
  65304. super(LOCALE_SET_NS_ID, "currencySymbol");
  65305. this.name = (0, _utils.getStringOption)(attributes.name, ["symbol", "isoname", "decimal"]);
  65306. }
  65307. }
  65308. class CurrencySymbols extends _xfa_object.XFAObject {
  65309. constructor(attributes) {
  65310. super(LOCALE_SET_NS_ID, "currencySymbols", true);
  65311. this.currencySymbol = new _xfa_object.XFAObjectArray(3);
  65312. }
  65313. }
  65314. class DatePattern extends _xfa_object.StringObject {
  65315. constructor(attributes) {
  65316. super(LOCALE_SET_NS_ID, "datePattern");
  65317. this.name = (0, _utils.getStringOption)(attributes.name, ["full", "long", "med", "short"]);
  65318. }
  65319. }
  65320. class DatePatterns extends _xfa_object.XFAObject {
  65321. constructor(attributes) {
  65322. super(LOCALE_SET_NS_ID, "datePatterns", true);
  65323. this.datePattern = new _xfa_object.XFAObjectArray(4);
  65324. }
  65325. }
  65326. class DateTimeSymbols extends _xfa_object.ContentObject {
  65327. constructor(attributes) {
  65328. super(LOCALE_SET_NS_ID, "dateTimeSymbols");
  65329. }
  65330. }
  65331. class Day extends _xfa_object.StringObject {
  65332. constructor(attributes) {
  65333. super(LOCALE_SET_NS_ID, "day");
  65334. }
  65335. }
  65336. class DayNames extends _xfa_object.XFAObject {
  65337. constructor(attributes) {
  65338. super(LOCALE_SET_NS_ID, "dayNames", true);
  65339. this.abbr = (0, _utils.getInteger)({
  65340. data: attributes.abbr,
  65341. defaultValue: 0,
  65342. validate: x => x === 1
  65343. });
  65344. this.day = new _xfa_object.XFAObjectArray(7);
  65345. }
  65346. }
  65347. class Era extends _xfa_object.StringObject {
  65348. constructor(attributes) {
  65349. super(LOCALE_SET_NS_ID, "era");
  65350. }
  65351. }
  65352. class EraNames extends _xfa_object.XFAObject {
  65353. constructor(attributes) {
  65354. super(LOCALE_SET_NS_ID, "eraNames", true);
  65355. this.era = new _xfa_object.XFAObjectArray(2);
  65356. }
  65357. }
  65358. class Locale extends _xfa_object.XFAObject {
  65359. constructor(attributes) {
  65360. super(LOCALE_SET_NS_ID, "locale", true);
  65361. this.desc = attributes.desc || "";
  65362. this.name = "isoname";
  65363. this.calendarSymbols = null;
  65364. this.currencySymbols = null;
  65365. this.datePatterns = null;
  65366. this.dateTimeSymbols = null;
  65367. this.numberPatterns = null;
  65368. this.numberSymbols = null;
  65369. this.timePatterns = null;
  65370. this.typeFaces = null;
  65371. }
  65372. }
  65373. class LocaleSet extends _xfa_object.XFAObject {
  65374. constructor(attributes) {
  65375. super(LOCALE_SET_NS_ID, "localeSet", true);
  65376. this.locale = new _xfa_object.XFAObjectArray();
  65377. }
  65378. }
  65379. class Meridiem extends _xfa_object.StringObject {
  65380. constructor(attributes) {
  65381. super(LOCALE_SET_NS_ID, "meridiem");
  65382. }
  65383. }
  65384. class MeridiemNames extends _xfa_object.XFAObject {
  65385. constructor(attributes) {
  65386. super(LOCALE_SET_NS_ID, "meridiemNames", true);
  65387. this.meridiem = new _xfa_object.XFAObjectArray(2);
  65388. }
  65389. }
  65390. class Month extends _xfa_object.StringObject {
  65391. constructor(attributes) {
  65392. super(LOCALE_SET_NS_ID, "month");
  65393. }
  65394. }
  65395. class MonthNames extends _xfa_object.XFAObject {
  65396. constructor(attributes) {
  65397. super(LOCALE_SET_NS_ID, "monthNames", true);
  65398. this.abbr = (0, _utils.getInteger)({
  65399. data: attributes.abbr,
  65400. defaultValue: 0,
  65401. validate: x => x === 1
  65402. });
  65403. this.month = new _xfa_object.XFAObjectArray(12);
  65404. }
  65405. }
  65406. class NumberPattern extends _xfa_object.StringObject {
  65407. constructor(attributes) {
  65408. super(LOCALE_SET_NS_ID, "numberPattern");
  65409. this.name = (0, _utils.getStringOption)(attributes.name, ["full", "long", "med", "short"]);
  65410. }
  65411. }
  65412. class NumberPatterns extends _xfa_object.XFAObject {
  65413. constructor(attributes) {
  65414. super(LOCALE_SET_NS_ID, "numberPatterns", true);
  65415. this.numberPattern = new _xfa_object.XFAObjectArray(4);
  65416. }
  65417. }
  65418. class NumberSymbol extends _xfa_object.StringObject {
  65419. constructor(attributes) {
  65420. super(LOCALE_SET_NS_ID, "numberSymbol");
  65421. this.name = (0, _utils.getStringOption)(attributes.name, ["decimal", "grouping", "percent", "minus", "zero"]);
  65422. }
  65423. }
  65424. class NumberSymbols extends _xfa_object.XFAObject {
  65425. constructor(attributes) {
  65426. super(LOCALE_SET_NS_ID, "numberSymbols", true);
  65427. this.numberSymbol = new _xfa_object.XFAObjectArray(5);
  65428. }
  65429. }
  65430. class TimePattern extends _xfa_object.StringObject {
  65431. constructor(attributes) {
  65432. super(LOCALE_SET_NS_ID, "timePattern");
  65433. this.name = (0, _utils.getStringOption)(attributes.name, ["full", "long", "med", "short"]);
  65434. }
  65435. }
  65436. class TimePatterns extends _xfa_object.XFAObject {
  65437. constructor(attributes) {
  65438. super(LOCALE_SET_NS_ID, "timePatterns", true);
  65439. this.timePattern = new _xfa_object.XFAObjectArray(4);
  65440. }
  65441. }
  65442. class TypeFace extends _xfa_object.XFAObject {
  65443. constructor(attributes) {
  65444. super(LOCALE_SET_NS_ID, "typeFace", true);
  65445. this.name = attributes.name | "";
  65446. }
  65447. }
  65448. class TypeFaces extends _xfa_object.XFAObject {
  65449. constructor(attributes) {
  65450. super(LOCALE_SET_NS_ID, "typeFaces", true);
  65451. this.typeFace = new _xfa_object.XFAObjectArray();
  65452. }
  65453. }
  65454. class LocaleSetNamespace {
  65455. static [_namespaces.$buildXFAObject](name, attributes) {
  65456. if (LocaleSetNamespace.hasOwnProperty(name)) {
  65457. return LocaleSetNamespace[name](attributes);
  65458. }
  65459. return undefined;
  65460. }
  65461. static calendarSymbols(attrs) {
  65462. return new CalendarSymbols(attrs);
  65463. }
  65464. static currencySymbol(attrs) {
  65465. return new CurrencySymbol(attrs);
  65466. }
  65467. static currencySymbols(attrs) {
  65468. return new CurrencySymbols(attrs);
  65469. }
  65470. static datePattern(attrs) {
  65471. return new DatePattern(attrs);
  65472. }
  65473. static datePatterns(attrs) {
  65474. return new DatePatterns(attrs);
  65475. }
  65476. static dateTimeSymbols(attrs) {
  65477. return new DateTimeSymbols(attrs);
  65478. }
  65479. static day(attrs) {
  65480. return new Day(attrs);
  65481. }
  65482. static dayNames(attrs) {
  65483. return new DayNames(attrs);
  65484. }
  65485. static era(attrs) {
  65486. return new Era(attrs);
  65487. }
  65488. static eraNames(attrs) {
  65489. return new EraNames(attrs);
  65490. }
  65491. static locale(attrs) {
  65492. return new Locale(attrs);
  65493. }
  65494. static localeSet(attrs) {
  65495. return new LocaleSet(attrs);
  65496. }
  65497. static meridiem(attrs) {
  65498. return new Meridiem(attrs);
  65499. }
  65500. static meridiemNames(attrs) {
  65501. return new MeridiemNames(attrs);
  65502. }
  65503. static month(attrs) {
  65504. return new Month(attrs);
  65505. }
  65506. static monthNames(attrs) {
  65507. return new MonthNames(attrs);
  65508. }
  65509. static numberPattern(attrs) {
  65510. return new NumberPattern(attrs);
  65511. }
  65512. static numberPatterns(attrs) {
  65513. return new NumberPatterns(attrs);
  65514. }
  65515. static numberSymbol(attrs) {
  65516. return new NumberSymbol(attrs);
  65517. }
  65518. static numberSymbols(attrs) {
  65519. return new NumberSymbols(attrs);
  65520. }
  65521. static timePattern(attrs) {
  65522. return new TimePattern(attrs);
  65523. }
  65524. static timePatterns(attrs) {
  65525. return new TimePatterns(attrs);
  65526. }
  65527. static typeFace(attrs) {
  65528. return new TypeFace(attrs);
  65529. }
  65530. static typeFaces(attrs) {
  65531. return new TypeFaces(attrs);
  65532. }
  65533. }
  65534. exports.LocaleSetNamespace = LocaleSetNamespace;
  65535. /***/ }),
  65536. /* 224 */
  65537. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  65538. "use strict";
  65539. Object.defineProperty(exports, "__esModule", ({
  65540. value: true
  65541. }));
  65542. exports.SignatureNamespace = void 0;
  65543. var _namespaces = __w_pdfjs_require__(208);
  65544. var _xfa_object = __w_pdfjs_require__(206);
  65545. const SIGNATURE_NS_ID = _namespaces.NamespaceIds.signature.id;
  65546. class Signature extends _xfa_object.XFAObject {
  65547. constructor(attributes) {
  65548. super(SIGNATURE_NS_ID, "signature", true);
  65549. }
  65550. }
  65551. class SignatureNamespace {
  65552. static [_namespaces.$buildXFAObject](name, attributes) {
  65553. if (SignatureNamespace.hasOwnProperty(name)) {
  65554. return SignatureNamespace[name](attributes);
  65555. }
  65556. return undefined;
  65557. }
  65558. static signature(attributes) {
  65559. return new Signature(attributes);
  65560. }
  65561. }
  65562. exports.SignatureNamespace = SignatureNamespace;
  65563. /***/ }),
  65564. /* 225 */
  65565. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  65566. "use strict";
  65567. Object.defineProperty(exports, "__esModule", ({
  65568. value: true
  65569. }));
  65570. exports.StylesheetNamespace = void 0;
  65571. var _namespaces = __w_pdfjs_require__(208);
  65572. var _xfa_object = __w_pdfjs_require__(206);
  65573. const STYLESHEET_NS_ID = _namespaces.NamespaceIds.stylesheet.id;
  65574. class Stylesheet extends _xfa_object.XFAObject {
  65575. constructor(attributes) {
  65576. super(STYLESHEET_NS_ID, "stylesheet", true);
  65577. }
  65578. }
  65579. class StylesheetNamespace {
  65580. static [_namespaces.$buildXFAObject](name, attributes) {
  65581. if (StylesheetNamespace.hasOwnProperty(name)) {
  65582. return StylesheetNamespace[name](attributes);
  65583. }
  65584. return undefined;
  65585. }
  65586. static stylesheet(attributes) {
  65587. return new Stylesheet(attributes);
  65588. }
  65589. }
  65590. exports.StylesheetNamespace = StylesheetNamespace;
  65591. /***/ }),
  65592. /* 226 */
  65593. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  65594. "use strict";
  65595. Object.defineProperty(exports, "__esModule", ({
  65596. value: true
  65597. }));
  65598. exports.XdpNamespace = void 0;
  65599. var _namespaces = __w_pdfjs_require__(208);
  65600. var _xfa_object = __w_pdfjs_require__(206);
  65601. const XDP_NS_ID = _namespaces.NamespaceIds.xdp.id;
  65602. class Xdp extends _xfa_object.XFAObject {
  65603. constructor(attributes) {
  65604. super(XDP_NS_ID, "xdp", true);
  65605. this.uuid = attributes.uuid || "";
  65606. this.timeStamp = attributes.timeStamp || "";
  65607. this.config = null;
  65608. this.connectionSet = null;
  65609. this.datasets = null;
  65610. this.localeSet = null;
  65611. this.stylesheet = new _xfa_object.XFAObjectArray();
  65612. this.template = null;
  65613. }
  65614. [_xfa_object.$onChildCheck](child) {
  65615. const ns = _namespaces.NamespaceIds[child[_xfa_object.$nodeName]];
  65616. return ns && child[_xfa_object.$namespaceId] === ns.id;
  65617. }
  65618. }
  65619. class XdpNamespace {
  65620. static [_namespaces.$buildXFAObject](name, attributes) {
  65621. if (XdpNamespace.hasOwnProperty(name)) {
  65622. return XdpNamespace[name](attributes);
  65623. }
  65624. return undefined;
  65625. }
  65626. static xdp(attributes) {
  65627. return new Xdp(attributes);
  65628. }
  65629. }
  65630. exports.XdpNamespace = XdpNamespace;
  65631. /***/ }),
  65632. /* 227 */
  65633. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  65634. "use strict";
  65635. Object.defineProperty(exports, "__esModule", ({
  65636. value: true
  65637. }));
  65638. exports.XhtmlNamespace = void 0;
  65639. var _xfa_object = __w_pdfjs_require__(206);
  65640. var _namespaces = __w_pdfjs_require__(208);
  65641. var _html_utils = __w_pdfjs_require__(213);
  65642. var _utils = __w_pdfjs_require__(207);
  65643. const XHTML_NS_ID = _namespaces.NamespaceIds.xhtml.id;
  65644. const $richText = Symbol();
  65645. 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"]);
  65646. 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) => {
  65647. value = original.fontSize = (0, _utils.getMeasurement)(value);
  65648. return (0, _html_utils.measureToString)(0.99 * value);
  65649. }], ["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))]]);
  65650. const spacesRegExp = /\s+/g;
  65651. const crlfRegExp = /[\r\n]+/g;
  65652. const crlfForRichTextRegExp = /\r\n?/g;
  65653. function mapStyle(styleStr, node, richText) {
  65654. const style = Object.create(null);
  65655. if (!styleStr) {
  65656. return style;
  65657. }
  65658. const original = Object.create(null);
  65659. for (const [key, value] of styleStr.split(";").map(s => s.split(":", 2))) {
  65660. const mapping = StyleMapping.get(key);
  65661. if (mapping === "") {
  65662. continue;
  65663. }
  65664. let newValue = value;
  65665. if (mapping) {
  65666. if (typeof mapping === "string") {
  65667. newValue = mapping;
  65668. } else {
  65669. newValue = mapping(value, original);
  65670. }
  65671. }
  65672. if (key.endsWith("scale")) {
  65673. if (style.transform) {
  65674. style.transform = `${style[key]} ${newValue}`;
  65675. } else {
  65676. style.transform = newValue;
  65677. }
  65678. } else {
  65679. style[key.replaceAll(/-([a-zA-Z])/g, (_, x) => x.toUpperCase())] = newValue;
  65680. }
  65681. }
  65682. if (style.fontFamily) {
  65683. (0, _html_utils.setFontFamily)({
  65684. typeface: style.fontFamily,
  65685. weight: style.fontWeight || "normal",
  65686. posture: style.fontStyle || "normal",
  65687. size: original.fontSize || 0
  65688. }, node, node[_xfa_object.$globalData].fontFinder, style);
  65689. }
  65690. if (richText && style.verticalAlign && style.verticalAlign !== "0px" && style.fontSize) {
  65691. const SUB_SUPER_SCRIPT_FACTOR = 0.583;
  65692. const VERTICAL_FACTOR = 0.333;
  65693. const fontSize = (0, _utils.getMeasurement)(style.fontSize);
  65694. style.fontSize = (0, _html_utils.measureToString)(fontSize * SUB_SUPER_SCRIPT_FACTOR);
  65695. style.verticalAlign = (0, _html_utils.measureToString)(Math.sign((0, _utils.getMeasurement)(style.verticalAlign)) * fontSize * VERTICAL_FACTOR);
  65696. }
  65697. if (richText && style.fontSize) {
  65698. style.fontSize = `calc(${style.fontSize} * var(--scale-factor))`;
  65699. }
  65700. (0, _html_utils.fixTextIndent)(style);
  65701. return style;
  65702. }
  65703. function checkStyle(node) {
  65704. if (!node.style) {
  65705. return "";
  65706. }
  65707. return node.style.trim().split(/\s*;\s*/).filter(s => !!s).map(s => s.split(/\s*:\s*/, 2)).filter(_ref => {
  65708. let [key, value] = _ref;
  65709. if (key === "font-family") {
  65710. node[_xfa_object.$globalData].usedTypefaces.add(value);
  65711. }
  65712. return VALID_STYLES.has(key);
  65713. }).map(kv => kv.join(":")).join(";");
  65714. }
  65715. const NoWhites = new Set(["body", "html"]);
  65716. class XhtmlObject extends _xfa_object.XmlObject {
  65717. constructor(attributes, name) {
  65718. super(XHTML_NS_ID, name);
  65719. this[$richText] = false;
  65720. this.style = attributes.style || "";
  65721. }
  65722. [_xfa_object.$clean](builder) {
  65723. super[_xfa_object.$clean](builder);
  65724. this.style = checkStyle(this);
  65725. }
  65726. [_xfa_object.$acceptWhitespace]() {
  65727. return !NoWhites.has(this[_xfa_object.$nodeName]);
  65728. }
  65729. [_xfa_object.$onText](str) {
  65730. let richText = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  65731. if (!richText) {
  65732. str = str.replace(crlfRegExp, "");
  65733. if (!this.style.includes("xfa-spacerun:yes")) {
  65734. str = str.replace(spacesRegExp, " ");
  65735. }
  65736. } else {
  65737. this[$richText] = true;
  65738. }
  65739. if (str) {
  65740. this[_xfa_object.$content] += str;
  65741. }
  65742. }
  65743. [_xfa_object.$pushGlyphs](measure) {
  65744. let mustPop = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
  65745. const xfaFont = Object.create(null);
  65746. const margin = {
  65747. top: NaN,
  65748. bottom: NaN,
  65749. left: NaN,
  65750. right: NaN
  65751. };
  65752. let lineHeight = null;
  65753. for (const [key, value] of this.style.split(";").map(s => s.split(":", 2))) {
  65754. switch (key) {
  65755. case "font-family":
  65756. xfaFont.typeface = (0, _utils.stripQuotes)(value);
  65757. break;
  65758. case "font-size":
  65759. xfaFont.size = (0, _utils.getMeasurement)(value);
  65760. break;
  65761. case "font-weight":
  65762. xfaFont.weight = value;
  65763. break;
  65764. case "font-style":
  65765. xfaFont.posture = value;
  65766. break;
  65767. case "letter-spacing":
  65768. xfaFont.letterSpacing = (0, _utils.getMeasurement)(value);
  65769. break;
  65770. case "margin":
  65771. const values = value.split(/ \t/).map(x => (0, _utils.getMeasurement)(x));
  65772. switch (values.length) {
  65773. case 1:
  65774. margin.top = margin.bottom = margin.left = margin.right = values[0];
  65775. break;
  65776. case 2:
  65777. margin.top = margin.bottom = values[0];
  65778. margin.left = margin.right = values[1];
  65779. break;
  65780. case 3:
  65781. margin.top = values[0];
  65782. margin.bottom = values[2];
  65783. margin.left = margin.right = values[1];
  65784. break;
  65785. case 4:
  65786. margin.top = values[0];
  65787. margin.left = values[1];
  65788. margin.bottom = values[2];
  65789. margin.right = values[3];
  65790. break;
  65791. }
  65792. break;
  65793. case "margin-top":
  65794. margin.top = (0, _utils.getMeasurement)(value);
  65795. break;
  65796. case "margin-bottom":
  65797. margin.bottom = (0, _utils.getMeasurement)(value);
  65798. break;
  65799. case "margin-left":
  65800. margin.left = (0, _utils.getMeasurement)(value);
  65801. break;
  65802. case "margin-right":
  65803. margin.right = (0, _utils.getMeasurement)(value);
  65804. break;
  65805. case "line-height":
  65806. lineHeight = (0, _utils.getMeasurement)(value);
  65807. break;
  65808. }
  65809. }
  65810. measure.pushData(xfaFont, margin, lineHeight);
  65811. if (this[_xfa_object.$content]) {
  65812. measure.addString(this[_xfa_object.$content]);
  65813. } else {
  65814. for (const child of this[_xfa_object.$getChildren]()) {
  65815. if (child[_xfa_object.$nodeName] === "#text") {
  65816. measure.addString(child[_xfa_object.$content]);
  65817. continue;
  65818. }
  65819. child[_xfa_object.$pushGlyphs](measure);
  65820. }
  65821. }
  65822. if (mustPop) {
  65823. measure.popFont();
  65824. }
  65825. }
  65826. [_xfa_object.$toHTML](availableSpace) {
  65827. const children = [];
  65828. this[_xfa_object.$extra] = {
  65829. children
  65830. };
  65831. this[_xfa_object.$childrenToHTML]({});
  65832. if (children.length === 0 && !this[_xfa_object.$content]) {
  65833. return _utils.HTMLResult.EMPTY;
  65834. }
  65835. let value;
  65836. if (this[$richText]) {
  65837. value = this[_xfa_object.$content] ? this[_xfa_object.$content].replace(crlfForRichTextRegExp, "\n") : undefined;
  65838. } else {
  65839. value = this[_xfa_object.$content] || undefined;
  65840. }
  65841. return _utils.HTMLResult.success({
  65842. name: this[_xfa_object.$nodeName],
  65843. attributes: {
  65844. href: this.href,
  65845. style: mapStyle(this.style, this, this[$richText])
  65846. },
  65847. children,
  65848. value
  65849. });
  65850. }
  65851. }
  65852. class A extends XhtmlObject {
  65853. constructor(attributes) {
  65854. super(attributes, "a");
  65855. this.href = (0, _html_utils.fixURL)(attributes.href) || "";
  65856. }
  65857. }
  65858. class B extends XhtmlObject {
  65859. constructor(attributes) {
  65860. super(attributes, "b");
  65861. }
  65862. [_xfa_object.$pushGlyphs](measure) {
  65863. measure.pushFont({
  65864. weight: "bold"
  65865. });
  65866. super[_xfa_object.$pushGlyphs](measure);
  65867. measure.popFont();
  65868. }
  65869. }
  65870. class Body extends XhtmlObject {
  65871. constructor(attributes) {
  65872. super(attributes, "body");
  65873. }
  65874. [_xfa_object.$toHTML](availableSpace) {
  65875. const res = super[_xfa_object.$toHTML](availableSpace);
  65876. const {
  65877. html
  65878. } = res;
  65879. if (!html) {
  65880. return _utils.HTMLResult.EMPTY;
  65881. }
  65882. html.name = "div";
  65883. html.attributes.class = ["xfaRich"];
  65884. return res;
  65885. }
  65886. }
  65887. class Br extends XhtmlObject {
  65888. constructor(attributes) {
  65889. super(attributes, "br");
  65890. }
  65891. [_xfa_object.$text]() {
  65892. return "\n";
  65893. }
  65894. [_xfa_object.$pushGlyphs](measure) {
  65895. measure.addString("\n");
  65896. }
  65897. [_xfa_object.$toHTML](availableSpace) {
  65898. return _utils.HTMLResult.success({
  65899. name: "br"
  65900. });
  65901. }
  65902. }
  65903. class Html extends XhtmlObject {
  65904. constructor(attributes) {
  65905. super(attributes, "html");
  65906. }
  65907. [_xfa_object.$toHTML](availableSpace) {
  65908. const children = [];
  65909. this[_xfa_object.$extra] = {
  65910. children
  65911. };
  65912. this[_xfa_object.$childrenToHTML]({});
  65913. if (children.length === 0) {
  65914. return _utils.HTMLResult.success({
  65915. name: "div",
  65916. attributes: {
  65917. class: ["xfaRich"],
  65918. style: {}
  65919. },
  65920. value: this[_xfa_object.$content] || ""
  65921. });
  65922. }
  65923. if (children.length === 1) {
  65924. const child = children[0];
  65925. if (child.attributes && child.attributes.class.includes("xfaRich")) {
  65926. return _utils.HTMLResult.success(child);
  65927. }
  65928. }
  65929. return _utils.HTMLResult.success({
  65930. name: "div",
  65931. attributes: {
  65932. class: ["xfaRich"],
  65933. style: {}
  65934. },
  65935. children
  65936. });
  65937. }
  65938. }
  65939. class I extends XhtmlObject {
  65940. constructor(attributes) {
  65941. super(attributes, "i");
  65942. }
  65943. [_xfa_object.$pushGlyphs](measure) {
  65944. measure.pushFont({
  65945. posture: "italic"
  65946. });
  65947. super[_xfa_object.$pushGlyphs](measure);
  65948. measure.popFont();
  65949. }
  65950. }
  65951. class Li extends XhtmlObject {
  65952. constructor(attributes) {
  65953. super(attributes, "li");
  65954. }
  65955. }
  65956. class Ol extends XhtmlObject {
  65957. constructor(attributes) {
  65958. super(attributes, "ol");
  65959. }
  65960. }
  65961. class P extends XhtmlObject {
  65962. constructor(attributes) {
  65963. super(attributes, "p");
  65964. }
  65965. [_xfa_object.$pushGlyphs](measure) {
  65966. super[_xfa_object.$pushGlyphs](measure, false);
  65967. measure.addString("\n");
  65968. measure.addPara();
  65969. measure.popFont();
  65970. }
  65971. [_xfa_object.$text]() {
  65972. const siblings = this[_xfa_object.$getParent]()[_xfa_object.$getChildren]();
  65973. if (siblings.at(-1) === this) {
  65974. return super[_xfa_object.$text]();
  65975. }
  65976. return super[_xfa_object.$text]() + "\n";
  65977. }
  65978. }
  65979. class Span extends XhtmlObject {
  65980. constructor(attributes) {
  65981. super(attributes, "span");
  65982. }
  65983. }
  65984. class Sub extends XhtmlObject {
  65985. constructor(attributes) {
  65986. super(attributes, "sub");
  65987. }
  65988. }
  65989. class Sup extends XhtmlObject {
  65990. constructor(attributes) {
  65991. super(attributes, "sup");
  65992. }
  65993. }
  65994. class Ul extends XhtmlObject {
  65995. constructor(attributes) {
  65996. super(attributes, "ul");
  65997. }
  65998. }
  65999. class XhtmlNamespace {
  66000. static [_namespaces.$buildXFAObject](name, attributes) {
  66001. if (XhtmlNamespace.hasOwnProperty(name)) {
  66002. return XhtmlNamespace[name](attributes);
  66003. }
  66004. return undefined;
  66005. }
  66006. static a(attributes) {
  66007. return new A(attributes);
  66008. }
  66009. static b(attributes) {
  66010. return new B(attributes);
  66011. }
  66012. static body(attributes) {
  66013. return new Body(attributes);
  66014. }
  66015. static br(attributes) {
  66016. return new Br(attributes);
  66017. }
  66018. static html(attributes) {
  66019. return new Html(attributes);
  66020. }
  66021. static i(attributes) {
  66022. return new I(attributes);
  66023. }
  66024. static li(attributes) {
  66025. return new Li(attributes);
  66026. }
  66027. static ol(attributes) {
  66028. return new Ol(attributes);
  66029. }
  66030. static p(attributes) {
  66031. return new P(attributes);
  66032. }
  66033. static span(attributes) {
  66034. return new Span(attributes);
  66035. }
  66036. static sub(attributes) {
  66037. return new Sub(attributes);
  66038. }
  66039. static sup(attributes) {
  66040. return new Sup(attributes);
  66041. }
  66042. static ul(attributes) {
  66043. return new Ul(attributes);
  66044. }
  66045. }
  66046. exports.XhtmlNamespace = XhtmlNamespace;
  66047. /***/ }),
  66048. /* 228 */
  66049. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  66050. "use strict";
  66051. Object.defineProperty(exports, "__esModule", ({
  66052. value: true
  66053. }));
  66054. exports.UnknownNamespace = void 0;
  66055. var _namespaces = __w_pdfjs_require__(208);
  66056. var _xfa_object = __w_pdfjs_require__(206);
  66057. class UnknownNamespace {
  66058. constructor(nsId) {
  66059. this.namespaceId = nsId;
  66060. }
  66061. [_namespaces.$buildXFAObject](name, attributes) {
  66062. return new _xfa_object.XmlObject(this.namespaceId, name, attributes);
  66063. }
  66064. }
  66065. exports.UnknownNamespace = UnknownNamespace;
  66066. /***/ }),
  66067. /* 229 */
  66068. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  66069. "use strict";
  66070. Object.defineProperty(exports, "__esModule", ({
  66071. value: true
  66072. }));
  66073. exports.DatasetReader = void 0;
  66074. var _util = __w_pdfjs_require__(2);
  66075. var _core_utils = __w_pdfjs_require__(135);
  66076. var _xml_parser = __w_pdfjs_require__(195);
  66077. function decodeString(str) {
  66078. try {
  66079. return (0, _util.stringToUTF8String)(str);
  66080. } catch (ex) {
  66081. (0, _util.warn)(`UTF-8 decoding failed: "${ex}".`);
  66082. return str;
  66083. }
  66084. }
  66085. class DatasetXMLParser extends _xml_parser.SimpleXMLParser {
  66086. constructor(options) {
  66087. super(options);
  66088. this.node = null;
  66089. }
  66090. onEndElement(name) {
  66091. const node = super.onEndElement(name);
  66092. if (node && name === "xfa:datasets") {
  66093. this.node = node;
  66094. throw new Error("Aborting DatasetXMLParser.");
  66095. }
  66096. }
  66097. }
  66098. class DatasetReader {
  66099. constructor(data) {
  66100. if (data.datasets) {
  66101. this.node = new _xml_parser.SimpleXMLParser({
  66102. hasAttributes: true
  66103. }).parseFromString(data.datasets).documentElement;
  66104. } else {
  66105. const parser = new DatasetXMLParser({
  66106. hasAttributes: true
  66107. });
  66108. try {
  66109. parser.parseFromString(data["xdp:xdp"]);
  66110. } catch (_) {}
  66111. this.node = parser.node;
  66112. }
  66113. }
  66114. getValue(path) {
  66115. if (!this.node || !path) {
  66116. return "";
  66117. }
  66118. const node = this.node.searchNode((0, _core_utils.parseXFAPath)(path), 0);
  66119. if (!node) {
  66120. return "";
  66121. }
  66122. const first = node.firstChild;
  66123. if (first && first.nodeName === "value") {
  66124. return node.children.map(child => decodeString(child.textContent));
  66125. }
  66126. return decodeString(node.textContent);
  66127. }
  66128. }
  66129. exports.DatasetReader = DatasetReader;
  66130. /***/ }),
  66131. /* 230 */
  66132. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  66133. "use strict";
  66134. Object.defineProperty(exports, "__esModule", ({
  66135. value: true
  66136. }));
  66137. exports.XRef = void 0;
  66138. var _util = __w_pdfjs_require__(2);
  66139. var _primitives = __w_pdfjs_require__(134);
  66140. var _core_utils = __w_pdfjs_require__(135);
  66141. var _parser = __w_pdfjs_require__(146);
  66142. var _base_stream = __w_pdfjs_require__(136);
  66143. var _crypto = __w_pdfjs_require__(196);
  66144. class XRef {
  66145. constructor(stream, pdfManager) {
  66146. this.stream = stream;
  66147. this.pdfManager = pdfManager;
  66148. this.entries = [];
  66149. this.xrefstms = Object.create(null);
  66150. this._cacheMap = new Map();
  66151. this._pendingRefs = new _primitives.RefSet();
  66152. this.stats = new _core_utils.DocStats(pdfManager.msgHandler);
  66153. this._newPersistentRefNum = null;
  66154. this._newTemporaryRefNum = null;
  66155. }
  66156. getNewPersistentRef(obj) {
  66157. if (this._newPersistentRefNum === null) {
  66158. this._newPersistentRefNum = this.entries.length || 1;
  66159. }
  66160. const num = this._newPersistentRefNum++;
  66161. this._cacheMap.set(num, obj);
  66162. return _primitives.Ref.get(num, 0);
  66163. }
  66164. getNewTemporaryRef() {
  66165. if (this._newTemporaryRefNum === null) {
  66166. this._newTemporaryRefNum = this.entries.length || 1;
  66167. }
  66168. return _primitives.Ref.get(this._newTemporaryRefNum++, 0);
  66169. }
  66170. resetNewTemporaryRef() {
  66171. this._newTemporaryRefNum = null;
  66172. }
  66173. setStartXRef(startXRef) {
  66174. this.startXRefQueue = [startXRef];
  66175. }
  66176. parse() {
  66177. let recoveryMode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  66178. let trailerDict;
  66179. if (!recoveryMode) {
  66180. trailerDict = this.readXRef();
  66181. } else {
  66182. (0, _util.warn)("Indexing all PDF objects");
  66183. trailerDict = this.indexObjects();
  66184. }
  66185. trailerDict.assignXref(this);
  66186. this.trailer = trailerDict;
  66187. let encrypt;
  66188. try {
  66189. encrypt = trailerDict.get("Encrypt");
  66190. } catch (ex) {
  66191. if (ex instanceof _core_utils.MissingDataException) {
  66192. throw ex;
  66193. }
  66194. (0, _util.warn)(`XRef.parse - Invalid "Encrypt" reference: "${ex}".`);
  66195. }
  66196. if (encrypt instanceof _primitives.Dict) {
  66197. const ids = trailerDict.get("ID");
  66198. const fileId = ids && ids.length ? ids[0] : "";
  66199. encrypt.suppressEncryption = true;
  66200. this.encrypt = new _crypto.CipherTransformFactory(encrypt, fileId, this.pdfManager.password);
  66201. }
  66202. let root;
  66203. try {
  66204. root = trailerDict.get("Root");
  66205. } catch (ex) {
  66206. if (ex instanceof _core_utils.MissingDataException) {
  66207. throw ex;
  66208. }
  66209. (0, _util.warn)(`XRef.parse - Invalid "Root" reference: "${ex}".`);
  66210. }
  66211. if (root instanceof _primitives.Dict) {
  66212. try {
  66213. const pages = root.get("Pages");
  66214. if (pages instanceof _primitives.Dict) {
  66215. this.root = root;
  66216. return;
  66217. }
  66218. } catch (ex) {
  66219. if (ex instanceof _core_utils.MissingDataException) {
  66220. throw ex;
  66221. }
  66222. (0, _util.warn)(`XRef.parse - Invalid "Pages" reference: "${ex}".`);
  66223. }
  66224. }
  66225. if (!recoveryMode) {
  66226. throw new _core_utils.XRefParseException();
  66227. }
  66228. throw new _util.InvalidPDFException("Invalid Root reference.");
  66229. }
  66230. processXRefTable(parser) {
  66231. if (!("tableState" in this)) {
  66232. this.tableState = {
  66233. entryNum: 0,
  66234. streamPos: parser.lexer.stream.pos,
  66235. parserBuf1: parser.buf1,
  66236. parserBuf2: parser.buf2
  66237. };
  66238. }
  66239. const obj = this.readXRefTable(parser);
  66240. if (!(0, _primitives.isCmd)(obj, "trailer")) {
  66241. throw new _util.FormatError("Invalid XRef table: could not find trailer dictionary");
  66242. }
  66243. let dict = parser.getObj();
  66244. if (!(dict instanceof _primitives.Dict) && dict.dict) {
  66245. dict = dict.dict;
  66246. }
  66247. if (!(dict instanceof _primitives.Dict)) {
  66248. throw new _util.FormatError("Invalid XRef table: could not parse trailer dictionary");
  66249. }
  66250. delete this.tableState;
  66251. return dict;
  66252. }
  66253. readXRefTable(parser) {
  66254. const stream = parser.lexer.stream;
  66255. const tableState = this.tableState;
  66256. stream.pos = tableState.streamPos;
  66257. parser.buf1 = tableState.parserBuf1;
  66258. parser.buf2 = tableState.parserBuf2;
  66259. let obj;
  66260. while (true) {
  66261. if (!("firstEntryNum" in tableState) || !("entryCount" in tableState)) {
  66262. if ((0, _primitives.isCmd)(obj = parser.getObj(), "trailer")) {
  66263. break;
  66264. }
  66265. tableState.firstEntryNum = obj;
  66266. tableState.entryCount = parser.getObj();
  66267. }
  66268. let first = tableState.firstEntryNum;
  66269. const count = tableState.entryCount;
  66270. if (!Number.isInteger(first) || !Number.isInteger(count)) {
  66271. throw new _util.FormatError("Invalid XRef table: wrong types in subsection header");
  66272. }
  66273. for (let i = tableState.entryNum; i < count; i++) {
  66274. tableState.streamPos = stream.pos;
  66275. tableState.entryNum = i;
  66276. tableState.parserBuf1 = parser.buf1;
  66277. tableState.parserBuf2 = parser.buf2;
  66278. const entry = {};
  66279. entry.offset = parser.getObj();
  66280. entry.gen = parser.getObj();
  66281. const type = parser.getObj();
  66282. if (type instanceof _primitives.Cmd) {
  66283. switch (type.cmd) {
  66284. case "f":
  66285. entry.free = true;
  66286. break;
  66287. case "n":
  66288. entry.uncompressed = true;
  66289. break;
  66290. }
  66291. }
  66292. if (!Number.isInteger(entry.offset) || !Number.isInteger(entry.gen) || !(entry.free || entry.uncompressed)) {
  66293. throw new _util.FormatError(`Invalid entry in XRef subsection: ${first}, ${count}`);
  66294. }
  66295. if (i === 0 && entry.free && first === 1) {
  66296. first = 0;
  66297. }
  66298. if (!this.entries[i + first]) {
  66299. this.entries[i + first] = entry;
  66300. }
  66301. }
  66302. tableState.entryNum = 0;
  66303. tableState.streamPos = stream.pos;
  66304. tableState.parserBuf1 = parser.buf1;
  66305. tableState.parserBuf2 = parser.buf2;
  66306. delete tableState.firstEntryNum;
  66307. delete tableState.entryCount;
  66308. }
  66309. if (this.entries[0] && !this.entries[0].free) {
  66310. throw new _util.FormatError("Invalid XRef table: unexpected first object");
  66311. }
  66312. return obj;
  66313. }
  66314. processXRefStream(stream) {
  66315. if (!("streamState" in this)) {
  66316. const streamParameters = stream.dict;
  66317. const byteWidths = streamParameters.get("W");
  66318. let range = streamParameters.get("Index");
  66319. if (!range) {
  66320. range = [0, streamParameters.get("Size")];
  66321. }
  66322. this.streamState = {
  66323. entryRanges: range,
  66324. byteWidths,
  66325. entryNum: 0,
  66326. streamPos: stream.pos
  66327. };
  66328. }
  66329. this.readXRefStream(stream);
  66330. delete this.streamState;
  66331. return stream.dict;
  66332. }
  66333. readXRefStream(stream) {
  66334. const streamState = this.streamState;
  66335. stream.pos = streamState.streamPos;
  66336. const [typeFieldWidth, offsetFieldWidth, generationFieldWidth] = streamState.byteWidths;
  66337. const entryRanges = streamState.entryRanges;
  66338. while (entryRanges.length > 0) {
  66339. const [first, n] = entryRanges;
  66340. if (!Number.isInteger(first) || !Number.isInteger(n)) {
  66341. throw new _util.FormatError(`Invalid XRef range fields: ${first}, ${n}`);
  66342. }
  66343. if (!Number.isInteger(typeFieldWidth) || !Number.isInteger(offsetFieldWidth) || !Number.isInteger(generationFieldWidth)) {
  66344. throw new _util.FormatError(`Invalid XRef entry fields length: ${first}, ${n}`);
  66345. }
  66346. for (let i = streamState.entryNum; i < n; ++i) {
  66347. streamState.entryNum = i;
  66348. streamState.streamPos = stream.pos;
  66349. let type = 0,
  66350. offset = 0,
  66351. generation = 0;
  66352. for (let j = 0; j < typeFieldWidth; ++j) {
  66353. const typeByte = stream.getByte();
  66354. if (typeByte === -1) {
  66355. throw new _util.FormatError("Invalid XRef byteWidths 'type'.");
  66356. }
  66357. type = type << 8 | typeByte;
  66358. }
  66359. if (typeFieldWidth === 0) {
  66360. type = 1;
  66361. }
  66362. for (let j = 0; j < offsetFieldWidth; ++j) {
  66363. const offsetByte = stream.getByte();
  66364. if (offsetByte === -1) {
  66365. throw new _util.FormatError("Invalid XRef byteWidths 'offset'.");
  66366. }
  66367. offset = offset << 8 | offsetByte;
  66368. }
  66369. for (let j = 0; j < generationFieldWidth; ++j) {
  66370. const generationByte = stream.getByte();
  66371. if (generationByte === -1) {
  66372. throw new _util.FormatError("Invalid XRef byteWidths 'generation'.");
  66373. }
  66374. generation = generation << 8 | generationByte;
  66375. }
  66376. const entry = {};
  66377. entry.offset = offset;
  66378. entry.gen = generation;
  66379. switch (type) {
  66380. case 0:
  66381. entry.free = true;
  66382. break;
  66383. case 1:
  66384. entry.uncompressed = true;
  66385. break;
  66386. case 2:
  66387. break;
  66388. default:
  66389. throw new _util.FormatError(`Invalid XRef entry type: ${type}`);
  66390. }
  66391. if (!this.entries[first + i]) {
  66392. this.entries[first + i] = entry;
  66393. }
  66394. }
  66395. streamState.entryNum = 0;
  66396. streamState.streamPos = stream.pos;
  66397. entryRanges.splice(0, 2);
  66398. }
  66399. }
  66400. indexObjects() {
  66401. const TAB = 0x9,
  66402. LF = 0xa,
  66403. CR = 0xd,
  66404. SPACE = 0x20;
  66405. const PERCENT = 0x25,
  66406. LT = 0x3c;
  66407. function readToken(data, offset) {
  66408. let token = "",
  66409. ch = data[offset];
  66410. while (ch !== LF && ch !== CR && ch !== LT) {
  66411. if (++offset >= data.length) {
  66412. break;
  66413. }
  66414. token += String.fromCharCode(ch);
  66415. ch = data[offset];
  66416. }
  66417. return token;
  66418. }
  66419. function skipUntil(data, offset, what) {
  66420. const length = what.length,
  66421. dataLength = data.length;
  66422. let skipped = 0;
  66423. while (offset < dataLength) {
  66424. let i = 0;
  66425. while (i < length && data[offset + i] === what[i]) {
  66426. ++i;
  66427. }
  66428. if (i >= length) {
  66429. break;
  66430. }
  66431. offset++;
  66432. skipped++;
  66433. }
  66434. return skipped;
  66435. }
  66436. const objRegExp = /^(\d+)\s+(\d+)\s+obj\b/;
  66437. const endobjRegExp = /\bendobj[\b\s]$/;
  66438. const nestedObjRegExp = /\s+(\d+\s+\d+\s+obj[\b\s<])$/;
  66439. const CHECK_CONTENT_LENGTH = 25;
  66440. const trailerBytes = new Uint8Array([116, 114, 97, 105, 108, 101, 114]);
  66441. const startxrefBytes = new Uint8Array([115, 116, 97, 114, 116, 120, 114, 101, 102]);
  66442. const objBytes = new Uint8Array([111, 98, 106]);
  66443. const xrefBytes = new Uint8Array([47, 88, 82, 101, 102]);
  66444. this.entries.length = 0;
  66445. this._cacheMap.clear();
  66446. const stream = this.stream;
  66447. stream.pos = 0;
  66448. const buffer = stream.getBytes(),
  66449. length = buffer.length;
  66450. let position = stream.start;
  66451. const trailers = [],
  66452. xrefStms = [];
  66453. while (position < length) {
  66454. let ch = buffer[position];
  66455. if (ch === TAB || ch === LF || ch === CR || ch === SPACE) {
  66456. ++position;
  66457. continue;
  66458. }
  66459. if (ch === PERCENT) {
  66460. do {
  66461. ++position;
  66462. if (position >= length) {
  66463. break;
  66464. }
  66465. ch = buffer[position];
  66466. } while (ch !== LF && ch !== CR);
  66467. continue;
  66468. }
  66469. const token = readToken(buffer, position);
  66470. let m;
  66471. if (token.startsWith("xref") && (token.length === 4 || /\s/.test(token[4]))) {
  66472. position += skipUntil(buffer, position, trailerBytes);
  66473. trailers.push(position);
  66474. position += skipUntil(buffer, position, startxrefBytes);
  66475. } else if (m = objRegExp.exec(token)) {
  66476. const num = m[1] | 0,
  66477. gen = m[2] | 0;
  66478. let contentLength,
  66479. startPos = position + token.length,
  66480. updateEntries = false;
  66481. if (!this.entries[num]) {
  66482. updateEntries = true;
  66483. } else if (this.entries[num].gen === gen) {
  66484. try {
  66485. const parser = new _parser.Parser({
  66486. lexer: new _parser.Lexer(stream.makeSubStream(startPos))
  66487. });
  66488. parser.getObj();
  66489. updateEntries = true;
  66490. } catch (ex) {
  66491. if (ex instanceof _core_utils.ParserEOFException) {
  66492. (0, _util.warn)(`indexObjects -- checking object (${token}): "${ex}".`);
  66493. } else {
  66494. updateEntries = true;
  66495. }
  66496. }
  66497. }
  66498. if (updateEntries) {
  66499. this.entries[num] = {
  66500. offset: position - stream.start,
  66501. gen,
  66502. uncompressed: true
  66503. };
  66504. }
  66505. while (startPos < length) {
  66506. const endPos = startPos + skipUntil(buffer, startPos, objBytes) + 4;
  66507. contentLength = endPos - position;
  66508. const checkPos = Math.max(endPos - CHECK_CONTENT_LENGTH, startPos);
  66509. const tokenStr = (0, _util.bytesToString)(buffer.subarray(checkPos, endPos));
  66510. if (endobjRegExp.test(tokenStr)) {
  66511. break;
  66512. } else {
  66513. const objToken = nestedObjRegExp.exec(tokenStr);
  66514. if (objToken && objToken[1]) {
  66515. (0, _util.warn)('indexObjects: Found new "obj" inside of another "obj", ' + 'caused by missing "endobj" -- trying to recover.');
  66516. contentLength -= objToken[1].length;
  66517. break;
  66518. }
  66519. }
  66520. startPos = endPos;
  66521. }
  66522. const content = buffer.subarray(position, position + contentLength);
  66523. const xrefTagOffset = skipUntil(content, 0, xrefBytes);
  66524. if (xrefTagOffset < contentLength && content[xrefTagOffset + 5] < 64) {
  66525. xrefStms.push(position - stream.start);
  66526. this.xrefstms[position - stream.start] = 1;
  66527. }
  66528. position += contentLength;
  66529. } else if (token.startsWith("trailer") && (token.length === 7 || /\s/.test(token[7]))) {
  66530. trailers.push(position);
  66531. const contentLength = skipUntil(buffer, position, startxrefBytes);
  66532. if (position + contentLength >= length) {
  66533. const endPos = position + skipUntil(buffer, position, objBytes) + 4;
  66534. const checkPos = Math.max(endPos - CHECK_CONTENT_LENGTH, position);
  66535. const tokenStr = (0, _util.bytesToString)(buffer.subarray(checkPos, endPos));
  66536. const objToken = nestedObjRegExp.exec(tokenStr);
  66537. if (objToken && objToken[1]) {
  66538. (0, _util.warn)('indexObjects: Found first "obj" after "trailer", ' + 'caused by missing "startxref" -- trying to recover.');
  66539. position = endPos - objToken[1].length;
  66540. continue;
  66541. }
  66542. }
  66543. position += contentLength;
  66544. } else {
  66545. position += token.length + 1;
  66546. }
  66547. }
  66548. for (const xrefStm of xrefStms) {
  66549. this.startXRefQueue.push(xrefStm);
  66550. this.readXRef(true);
  66551. }
  66552. let trailerDict, trailerError;
  66553. for (const trailer of [...trailers, "generationFallback", ...trailers]) {
  66554. if (trailer === "generationFallback") {
  66555. if (!trailerError) {
  66556. break;
  66557. }
  66558. this._generationFallback = true;
  66559. continue;
  66560. }
  66561. stream.pos = trailer;
  66562. const parser = new _parser.Parser({
  66563. lexer: new _parser.Lexer(stream),
  66564. xref: this,
  66565. allowStreams: true,
  66566. recoveryMode: true
  66567. });
  66568. const obj = parser.getObj();
  66569. if (!(0, _primitives.isCmd)(obj, "trailer")) {
  66570. continue;
  66571. }
  66572. const dict = parser.getObj();
  66573. if (!(dict instanceof _primitives.Dict)) {
  66574. continue;
  66575. }
  66576. let validPagesDict = false;
  66577. try {
  66578. const rootDict = dict.get("Root");
  66579. if (!(rootDict instanceof _primitives.Dict)) {
  66580. continue;
  66581. }
  66582. const pagesDict = rootDict.get("Pages");
  66583. if (!(pagesDict instanceof _primitives.Dict)) {
  66584. continue;
  66585. }
  66586. const pagesCount = pagesDict.get("Count");
  66587. if (Number.isInteger(pagesCount)) {
  66588. validPagesDict = true;
  66589. }
  66590. } catch (ex) {
  66591. trailerError = ex;
  66592. continue;
  66593. }
  66594. if (validPagesDict && dict.has("ID")) {
  66595. return dict;
  66596. }
  66597. trailerDict = dict;
  66598. }
  66599. if (trailerDict) {
  66600. return trailerDict;
  66601. }
  66602. if (this.topDict) {
  66603. return this.topDict;
  66604. }
  66605. throw new _util.InvalidPDFException("Invalid PDF structure.");
  66606. }
  66607. readXRef() {
  66608. let recoveryMode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  66609. const stream = this.stream;
  66610. const startXRefParsedCache = new Set();
  66611. try {
  66612. while (this.startXRefQueue.length) {
  66613. const startXRef = this.startXRefQueue[0];
  66614. if (startXRefParsedCache.has(startXRef)) {
  66615. (0, _util.warn)("readXRef - skipping XRef table since it was already parsed.");
  66616. this.startXRefQueue.shift();
  66617. continue;
  66618. }
  66619. startXRefParsedCache.add(startXRef);
  66620. stream.pos = startXRef + stream.start;
  66621. const parser = new _parser.Parser({
  66622. lexer: new _parser.Lexer(stream),
  66623. xref: this,
  66624. allowStreams: true
  66625. });
  66626. let obj = parser.getObj();
  66627. let dict;
  66628. if ((0, _primitives.isCmd)(obj, "xref")) {
  66629. dict = this.processXRefTable(parser);
  66630. if (!this.topDict) {
  66631. this.topDict = dict;
  66632. }
  66633. obj = dict.get("XRefStm");
  66634. if (Number.isInteger(obj)) {
  66635. const pos = obj;
  66636. if (!(pos in this.xrefstms)) {
  66637. this.xrefstms[pos] = 1;
  66638. this.startXRefQueue.push(pos);
  66639. }
  66640. }
  66641. } else if (Number.isInteger(obj)) {
  66642. if (!Number.isInteger(parser.getObj()) || !(0, _primitives.isCmd)(parser.getObj(), "obj") || !((obj = parser.getObj()) instanceof _base_stream.BaseStream)) {
  66643. throw new _util.FormatError("Invalid XRef stream");
  66644. }
  66645. dict = this.processXRefStream(obj);
  66646. if (!this.topDict) {
  66647. this.topDict = dict;
  66648. }
  66649. if (!dict) {
  66650. throw new _util.FormatError("Failed to read XRef stream");
  66651. }
  66652. } else {
  66653. throw new _util.FormatError("Invalid XRef stream header");
  66654. }
  66655. obj = dict.get("Prev");
  66656. if (Number.isInteger(obj)) {
  66657. this.startXRefQueue.push(obj);
  66658. } else if (obj instanceof _primitives.Ref) {
  66659. this.startXRefQueue.push(obj.num);
  66660. }
  66661. this.startXRefQueue.shift();
  66662. }
  66663. return this.topDict;
  66664. } catch (e) {
  66665. if (e instanceof _core_utils.MissingDataException) {
  66666. throw e;
  66667. }
  66668. (0, _util.info)("(while reading XRef): " + e);
  66669. this.startXRefQueue.shift();
  66670. }
  66671. if (recoveryMode) {
  66672. return undefined;
  66673. }
  66674. throw new _core_utils.XRefParseException();
  66675. }
  66676. getEntry(i) {
  66677. const xrefEntry = this.entries[i];
  66678. if (xrefEntry && !xrefEntry.free && xrefEntry.offset) {
  66679. return xrefEntry;
  66680. }
  66681. return null;
  66682. }
  66683. fetchIfRef(obj) {
  66684. let suppressEncryption = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  66685. if (obj instanceof _primitives.Ref) {
  66686. return this.fetch(obj, suppressEncryption);
  66687. }
  66688. return obj;
  66689. }
  66690. fetch(ref) {
  66691. let suppressEncryption = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  66692. if (!(ref instanceof _primitives.Ref)) {
  66693. throw new Error("ref object is not a reference");
  66694. }
  66695. const num = ref.num;
  66696. const cacheEntry = this._cacheMap.get(num);
  66697. if (cacheEntry !== undefined) {
  66698. if (cacheEntry instanceof _primitives.Dict && !cacheEntry.objId) {
  66699. cacheEntry.objId = ref.toString();
  66700. }
  66701. return cacheEntry;
  66702. }
  66703. let xrefEntry = this.getEntry(num);
  66704. if (xrefEntry === null) {
  66705. this._cacheMap.set(num, xrefEntry);
  66706. return xrefEntry;
  66707. }
  66708. if (this._pendingRefs.has(ref)) {
  66709. this._pendingRefs.remove(ref);
  66710. (0, _util.warn)(`Ignoring circular reference: ${ref}.`);
  66711. return _primitives.CIRCULAR_REF;
  66712. }
  66713. this._pendingRefs.put(ref);
  66714. try {
  66715. if (xrefEntry.uncompressed) {
  66716. xrefEntry = this.fetchUncompressed(ref, xrefEntry, suppressEncryption);
  66717. } else {
  66718. xrefEntry = this.fetchCompressed(ref, xrefEntry, suppressEncryption);
  66719. }
  66720. this._pendingRefs.remove(ref);
  66721. } catch (ex) {
  66722. this._pendingRefs.remove(ref);
  66723. throw ex;
  66724. }
  66725. if (xrefEntry instanceof _primitives.Dict) {
  66726. xrefEntry.objId = ref.toString();
  66727. } else if (xrefEntry instanceof _base_stream.BaseStream) {
  66728. xrefEntry.dict.objId = ref.toString();
  66729. }
  66730. return xrefEntry;
  66731. }
  66732. fetchUncompressed(ref, xrefEntry) {
  66733. let suppressEncryption = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  66734. const gen = ref.gen;
  66735. let num = ref.num;
  66736. if (xrefEntry.gen !== gen) {
  66737. const msg = `Inconsistent generation in XRef: ${ref}`;
  66738. if (this._generationFallback && xrefEntry.gen < gen) {
  66739. (0, _util.warn)(msg);
  66740. return this.fetchUncompressed(_primitives.Ref.get(num, xrefEntry.gen), xrefEntry, suppressEncryption);
  66741. }
  66742. throw new _core_utils.XRefEntryException(msg);
  66743. }
  66744. const stream = this.stream.makeSubStream(xrefEntry.offset + this.stream.start);
  66745. const parser = new _parser.Parser({
  66746. lexer: new _parser.Lexer(stream),
  66747. xref: this,
  66748. allowStreams: true
  66749. });
  66750. const obj1 = parser.getObj();
  66751. const obj2 = parser.getObj();
  66752. const obj3 = parser.getObj();
  66753. if (obj1 !== num || obj2 !== gen || !(obj3 instanceof _primitives.Cmd)) {
  66754. throw new _core_utils.XRefEntryException(`Bad (uncompressed) XRef entry: ${ref}`);
  66755. }
  66756. if (obj3.cmd !== "obj") {
  66757. if (obj3.cmd.startsWith("obj")) {
  66758. num = parseInt(obj3.cmd.substring(3), 10);
  66759. if (!Number.isNaN(num)) {
  66760. return num;
  66761. }
  66762. }
  66763. throw new _core_utils.XRefEntryException(`Bad (uncompressed) XRef entry: ${ref}`);
  66764. }
  66765. if (this.encrypt && !suppressEncryption) {
  66766. xrefEntry = parser.getObj(this.encrypt.createCipherTransform(num, gen));
  66767. } else {
  66768. xrefEntry = parser.getObj();
  66769. }
  66770. if (!(xrefEntry instanceof _base_stream.BaseStream)) {
  66771. this._cacheMap.set(num, xrefEntry);
  66772. }
  66773. return xrefEntry;
  66774. }
  66775. fetchCompressed(ref, xrefEntry) {
  66776. let suppressEncryption = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  66777. const tableOffset = xrefEntry.offset;
  66778. const stream = this.fetch(_primitives.Ref.get(tableOffset, 0));
  66779. if (!(stream instanceof _base_stream.BaseStream)) {
  66780. throw new _util.FormatError("bad ObjStm stream");
  66781. }
  66782. const first = stream.dict.get("First");
  66783. const n = stream.dict.get("N");
  66784. if (!Number.isInteger(first) || !Number.isInteger(n)) {
  66785. throw new _util.FormatError("invalid first and n parameters for ObjStm stream");
  66786. }
  66787. let parser = new _parser.Parser({
  66788. lexer: new _parser.Lexer(stream),
  66789. xref: this,
  66790. allowStreams: true
  66791. });
  66792. const nums = new Array(n);
  66793. const offsets = new Array(n);
  66794. for (let i = 0; i < n; ++i) {
  66795. const num = parser.getObj();
  66796. if (!Number.isInteger(num)) {
  66797. throw new _util.FormatError(`invalid object number in the ObjStm stream: ${num}`);
  66798. }
  66799. const offset = parser.getObj();
  66800. if (!Number.isInteger(offset)) {
  66801. throw new _util.FormatError(`invalid object offset in the ObjStm stream: ${offset}`);
  66802. }
  66803. nums[i] = num;
  66804. offsets[i] = offset;
  66805. }
  66806. const start = (stream.start || 0) + first;
  66807. const entries = new Array(n);
  66808. for (let i = 0; i < n; ++i) {
  66809. const length = i < n - 1 ? offsets[i + 1] - offsets[i] : undefined;
  66810. if (length < 0) {
  66811. throw new _util.FormatError("Invalid offset in the ObjStm stream.");
  66812. }
  66813. parser = new _parser.Parser({
  66814. lexer: new _parser.Lexer(stream.makeSubStream(start + offsets[i], length, stream.dict)),
  66815. xref: this,
  66816. allowStreams: true
  66817. });
  66818. const obj = parser.getObj();
  66819. entries[i] = obj;
  66820. if (obj instanceof _base_stream.BaseStream) {
  66821. continue;
  66822. }
  66823. const num = nums[i],
  66824. entry = this.entries[num];
  66825. if (entry && entry.offset === tableOffset && entry.gen === i) {
  66826. this._cacheMap.set(num, obj);
  66827. }
  66828. }
  66829. xrefEntry = entries[xrefEntry.gen];
  66830. if (xrefEntry === undefined) {
  66831. throw new _core_utils.XRefEntryException(`Bad (compressed) XRef entry: ${ref}`);
  66832. }
  66833. return xrefEntry;
  66834. }
  66835. async fetchIfRefAsync(obj, suppressEncryption) {
  66836. if (obj instanceof _primitives.Ref) {
  66837. return this.fetchAsync(obj, suppressEncryption);
  66838. }
  66839. return obj;
  66840. }
  66841. async fetchAsync(ref, suppressEncryption) {
  66842. try {
  66843. return this.fetch(ref, suppressEncryption);
  66844. } catch (ex) {
  66845. if (!(ex instanceof _core_utils.MissingDataException)) {
  66846. throw ex;
  66847. }
  66848. await this.pdfManager.requestRange(ex.begin, ex.end);
  66849. return this.fetchAsync(ref, suppressEncryption);
  66850. }
  66851. }
  66852. getCatalogObj() {
  66853. return this.root;
  66854. }
  66855. }
  66856. exports.XRef = XRef;
  66857. /***/ }),
  66858. /* 231 */
  66859. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  66860. "use strict";
  66861. Object.defineProperty(exports, "__esModule", ({
  66862. value: true
  66863. }));
  66864. exports.MessageHandler = void 0;
  66865. var _util = __w_pdfjs_require__(2);
  66866. const CallbackKind = {
  66867. UNKNOWN: 0,
  66868. DATA: 1,
  66869. ERROR: 2
  66870. };
  66871. const StreamKind = {
  66872. UNKNOWN: 0,
  66873. CANCEL: 1,
  66874. CANCEL_COMPLETE: 2,
  66875. CLOSE: 3,
  66876. ENQUEUE: 4,
  66877. ERROR: 5,
  66878. PULL: 6,
  66879. PULL_COMPLETE: 7,
  66880. START_COMPLETE: 8
  66881. };
  66882. function wrapReason(reason) {
  66883. if (!(reason instanceof Error || typeof reason === "object" && reason !== null)) {
  66884. (0, _util.unreachable)('wrapReason: Expected "reason" to be a (possibly cloned) Error.');
  66885. }
  66886. switch (reason.name) {
  66887. case "AbortException":
  66888. return new _util.AbortException(reason.message);
  66889. case "MissingPDFException":
  66890. return new _util.MissingPDFException(reason.message);
  66891. case "PasswordException":
  66892. return new _util.PasswordException(reason.message, reason.code);
  66893. case "UnexpectedResponseException":
  66894. return new _util.UnexpectedResponseException(reason.message, reason.status);
  66895. case "UnknownErrorException":
  66896. return new _util.UnknownErrorException(reason.message, reason.details);
  66897. default:
  66898. return new _util.UnknownErrorException(reason.message, reason.toString());
  66899. }
  66900. }
  66901. class MessageHandler {
  66902. constructor(sourceName, targetName, comObj) {
  66903. this.sourceName = sourceName;
  66904. this.targetName = targetName;
  66905. this.comObj = comObj;
  66906. this.callbackId = 1;
  66907. this.streamId = 1;
  66908. this.streamSinks = Object.create(null);
  66909. this.streamControllers = Object.create(null);
  66910. this.callbackCapabilities = Object.create(null);
  66911. this.actionHandler = Object.create(null);
  66912. this._onComObjOnMessage = event => {
  66913. const data = event.data;
  66914. if (data.targetName !== this.sourceName) {
  66915. return;
  66916. }
  66917. if (data.stream) {
  66918. this._processStreamMessage(data);
  66919. return;
  66920. }
  66921. if (data.callback) {
  66922. const callbackId = data.callbackId;
  66923. const capability = this.callbackCapabilities[callbackId];
  66924. if (!capability) {
  66925. throw new Error(`Cannot resolve callback ${callbackId}`);
  66926. }
  66927. delete this.callbackCapabilities[callbackId];
  66928. if (data.callback === CallbackKind.DATA) {
  66929. capability.resolve(data.data);
  66930. } else if (data.callback === CallbackKind.ERROR) {
  66931. capability.reject(wrapReason(data.reason));
  66932. } else {
  66933. throw new Error("Unexpected callback case");
  66934. }
  66935. return;
  66936. }
  66937. const action = this.actionHandler[data.action];
  66938. if (!action) {
  66939. throw new Error(`Unknown action from worker: ${data.action}`);
  66940. }
  66941. if (data.callbackId) {
  66942. const cbSourceName = this.sourceName;
  66943. const cbTargetName = data.sourceName;
  66944. new Promise(function (resolve) {
  66945. resolve(action(data.data));
  66946. }).then(function (result) {
  66947. comObj.postMessage({
  66948. sourceName: cbSourceName,
  66949. targetName: cbTargetName,
  66950. callback: CallbackKind.DATA,
  66951. callbackId: data.callbackId,
  66952. data: result
  66953. });
  66954. }, function (reason) {
  66955. comObj.postMessage({
  66956. sourceName: cbSourceName,
  66957. targetName: cbTargetName,
  66958. callback: CallbackKind.ERROR,
  66959. callbackId: data.callbackId,
  66960. reason: wrapReason(reason)
  66961. });
  66962. });
  66963. return;
  66964. }
  66965. if (data.streamId) {
  66966. this._createStreamSink(data);
  66967. return;
  66968. }
  66969. action(data.data);
  66970. };
  66971. comObj.addEventListener("message", this._onComObjOnMessage);
  66972. }
  66973. on(actionName, handler) {
  66974. const ah = this.actionHandler;
  66975. if (ah[actionName]) {
  66976. throw new Error(`There is already an actionName called "${actionName}"`);
  66977. }
  66978. ah[actionName] = handler;
  66979. }
  66980. send(actionName, data, transfers) {
  66981. this.comObj.postMessage({
  66982. sourceName: this.sourceName,
  66983. targetName: this.targetName,
  66984. action: actionName,
  66985. data
  66986. }, transfers);
  66987. }
  66988. sendWithPromise(actionName, data, transfers) {
  66989. const callbackId = this.callbackId++;
  66990. const capability = (0, _util.createPromiseCapability)();
  66991. this.callbackCapabilities[callbackId] = capability;
  66992. try {
  66993. this.comObj.postMessage({
  66994. sourceName: this.sourceName,
  66995. targetName: this.targetName,
  66996. action: actionName,
  66997. callbackId,
  66998. data
  66999. }, transfers);
  67000. } catch (ex) {
  67001. capability.reject(ex);
  67002. }
  67003. return capability.promise;
  67004. }
  67005. sendWithStream(actionName, data, queueingStrategy, transfers) {
  67006. const streamId = this.streamId++,
  67007. sourceName = this.sourceName,
  67008. targetName = this.targetName,
  67009. comObj = this.comObj;
  67010. return new ReadableStream({
  67011. start: controller => {
  67012. const startCapability = (0, _util.createPromiseCapability)();
  67013. this.streamControllers[streamId] = {
  67014. controller,
  67015. startCall: startCapability,
  67016. pullCall: null,
  67017. cancelCall: null,
  67018. isClosed: false
  67019. };
  67020. comObj.postMessage({
  67021. sourceName,
  67022. targetName,
  67023. action: actionName,
  67024. streamId,
  67025. data,
  67026. desiredSize: controller.desiredSize
  67027. }, transfers);
  67028. return startCapability.promise;
  67029. },
  67030. pull: controller => {
  67031. const pullCapability = (0, _util.createPromiseCapability)();
  67032. this.streamControllers[streamId].pullCall = pullCapability;
  67033. comObj.postMessage({
  67034. sourceName,
  67035. targetName,
  67036. stream: StreamKind.PULL,
  67037. streamId,
  67038. desiredSize: controller.desiredSize
  67039. });
  67040. return pullCapability.promise;
  67041. },
  67042. cancel: reason => {
  67043. (0, _util.assert)(reason instanceof Error, "cancel must have a valid reason");
  67044. const cancelCapability = (0, _util.createPromiseCapability)();
  67045. this.streamControllers[streamId].cancelCall = cancelCapability;
  67046. this.streamControllers[streamId].isClosed = true;
  67047. comObj.postMessage({
  67048. sourceName,
  67049. targetName,
  67050. stream: StreamKind.CANCEL,
  67051. streamId,
  67052. reason: wrapReason(reason)
  67053. });
  67054. return cancelCapability.promise;
  67055. }
  67056. }, queueingStrategy);
  67057. }
  67058. _createStreamSink(data) {
  67059. const streamId = data.streamId,
  67060. sourceName = this.sourceName,
  67061. targetName = data.sourceName,
  67062. comObj = this.comObj;
  67063. const self = this,
  67064. action = this.actionHandler[data.action];
  67065. const streamSink = {
  67066. enqueue(chunk) {
  67067. let size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
  67068. let transfers = arguments.length > 2 ? arguments[2] : undefined;
  67069. if (this.isCancelled) {
  67070. return;
  67071. }
  67072. const lastDesiredSize = this.desiredSize;
  67073. this.desiredSize -= size;
  67074. if (lastDesiredSize > 0 && this.desiredSize <= 0) {
  67075. this.sinkCapability = (0, _util.createPromiseCapability)();
  67076. this.ready = this.sinkCapability.promise;
  67077. }
  67078. comObj.postMessage({
  67079. sourceName,
  67080. targetName,
  67081. stream: StreamKind.ENQUEUE,
  67082. streamId,
  67083. chunk
  67084. }, transfers);
  67085. },
  67086. close() {
  67087. if (this.isCancelled) {
  67088. return;
  67089. }
  67090. this.isCancelled = true;
  67091. comObj.postMessage({
  67092. sourceName,
  67093. targetName,
  67094. stream: StreamKind.CLOSE,
  67095. streamId
  67096. });
  67097. delete self.streamSinks[streamId];
  67098. },
  67099. error(reason) {
  67100. (0, _util.assert)(reason instanceof Error, "error must have a valid reason");
  67101. if (this.isCancelled) {
  67102. return;
  67103. }
  67104. this.isCancelled = true;
  67105. comObj.postMessage({
  67106. sourceName,
  67107. targetName,
  67108. stream: StreamKind.ERROR,
  67109. streamId,
  67110. reason: wrapReason(reason)
  67111. });
  67112. },
  67113. sinkCapability: (0, _util.createPromiseCapability)(),
  67114. onPull: null,
  67115. onCancel: null,
  67116. isCancelled: false,
  67117. desiredSize: data.desiredSize,
  67118. ready: null
  67119. };
  67120. streamSink.sinkCapability.resolve();
  67121. streamSink.ready = streamSink.sinkCapability.promise;
  67122. this.streamSinks[streamId] = streamSink;
  67123. new Promise(function (resolve) {
  67124. resolve(action(data.data, streamSink));
  67125. }).then(function () {
  67126. comObj.postMessage({
  67127. sourceName,
  67128. targetName,
  67129. stream: StreamKind.START_COMPLETE,
  67130. streamId,
  67131. success: true
  67132. });
  67133. }, function (reason) {
  67134. comObj.postMessage({
  67135. sourceName,
  67136. targetName,
  67137. stream: StreamKind.START_COMPLETE,
  67138. streamId,
  67139. reason: wrapReason(reason)
  67140. });
  67141. });
  67142. }
  67143. _processStreamMessage(data) {
  67144. const streamId = data.streamId,
  67145. sourceName = this.sourceName,
  67146. targetName = data.sourceName,
  67147. comObj = this.comObj;
  67148. const streamController = this.streamControllers[streamId],
  67149. streamSink = this.streamSinks[streamId];
  67150. switch (data.stream) {
  67151. case StreamKind.START_COMPLETE:
  67152. if (data.success) {
  67153. streamController.startCall.resolve();
  67154. } else {
  67155. streamController.startCall.reject(wrapReason(data.reason));
  67156. }
  67157. break;
  67158. case StreamKind.PULL_COMPLETE:
  67159. if (data.success) {
  67160. streamController.pullCall.resolve();
  67161. } else {
  67162. streamController.pullCall.reject(wrapReason(data.reason));
  67163. }
  67164. break;
  67165. case StreamKind.PULL:
  67166. if (!streamSink) {
  67167. comObj.postMessage({
  67168. sourceName,
  67169. targetName,
  67170. stream: StreamKind.PULL_COMPLETE,
  67171. streamId,
  67172. success: true
  67173. });
  67174. break;
  67175. }
  67176. if (streamSink.desiredSize <= 0 && data.desiredSize > 0) {
  67177. streamSink.sinkCapability.resolve();
  67178. }
  67179. streamSink.desiredSize = data.desiredSize;
  67180. new Promise(function (resolve) {
  67181. resolve(streamSink.onPull && streamSink.onPull());
  67182. }).then(function () {
  67183. comObj.postMessage({
  67184. sourceName,
  67185. targetName,
  67186. stream: StreamKind.PULL_COMPLETE,
  67187. streamId,
  67188. success: true
  67189. });
  67190. }, function (reason) {
  67191. comObj.postMessage({
  67192. sourceName,
  67193. targetName,
  67194. stream: StreamKind.PULL_COMPLETE,
  67195. streamId,
  67196. reason: wrapReason(reason)
  67197. });
  67198. });
  67199. break;
  67200. case StreamKind.ENQUEUE:
  67201. (0, _util.assert)(streamController, "enqueue should have stream controller");
  67202. if (streamController.isClosed) {
  67203. break;
  67204. }
  67205. streamController.controller.enqueue(data.chunk);
  67206. break;
  67207. case StreamKind.CLOSE:
  67208. (0, _util.assert)(streamController, "close should have stream controller");
  67209. if (streamController.isClosed) {
  67210. break;
  67211. }
  67212. streamController.isClosed = true;
  67213. streamController.controller.close();
  67214. this._deleteStreamController(streamController, streamId);
  67215. break;
  67216. case StreamKind.ERROR:
  67217. (0, _util.assert)(streamController, "error should have stream controller");
  67218. streamController.controller.error(wrapReason(data.reason));
  67219. this._deleteStreamController(streamController, streamId);
  67220. break;
  67221. case StreamKind.CANCEL_COMPLETE:
  67222. if (data.success) {
  67223. streamController.cancelCall.resolve();
  67224. } else {
  67225. streamController.cancelCall.reject(wrapReason(data.reason));
  67226. }
  67227. this._deleteStreamController(streamController, streamId);
  67228. break;
  67229. case StreamKind.CANCEL:
  67230. if (!streamSink) {
  67231. break;
  67232. }
  67233. new Promise(function (resolve) {
  67234. resolve(streamSink.onCancel && streamSink.onCancel(wrapReason(data.reason)));
  67235. }).then(function () {
  67236. comObj.postMessage({
  67237. sourceName,
  67238. targetName,
  67239. stream: StreamKind.CANCEL_COMPLETE,
  67240. streamId,
  67241. success: true
  67242. });
  67243. }, function (reason) {
  67244. comObj.postMessage({
  67245. sourceName,
  67246. targetName,
  67247. stream: StreamKind.CANCEL_COMPLETE,
  67248. streamId,
  67249. reason: wrapReason(reason)
  67250. });
  67251. });
  67252. streamSink.sinkCapability.reject(wrapReason(data.reason));
  67253. streamSink.isCancelled = true;
  67254. delete this.streamSinks[streamId];
  67255. break;
  67256. default:
  67257. throw new Error("Unexpected stream case");
  67258. }
  67259. }
  67260. async _deleteStreamController(streamController, streamId) {
  67261. await Promise.allSettled([streamController.startCall && streamController.startCall.promise, streamController.pullCall && streamController.pullCall.promise, streamController.cancelCall && streamController.cancelCall.promise]);
  67262. delete this.streamControllers[streamId];
  67263. }
  67264. destroy() {
  67265. this.comObj.removeEventListener("message", this._onComObjOnMessage);
  67266. }
  67267. }
  67268. exports.MessageHandler = MessageHandler;
  67269. /***/ }),
  67270. /* 232 */
  67271. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  67272. "use strict";
  67273. Object.defineProperty(exports, "__esModule", ({
  67274. value: true
  67275. }));
  67276. exports.PDFWorkerStream = void 0;
  67277. var _util = __w_pdfjs_require__(2);
  67278. class PDFWorkerStream {
  67279. constructor(msgHandler) {
  67280. this._msgHandler = msgHandler;
  67281. this._contentLength = null;
  67282. this._fullRequestReader = null;
  67283. this._rangeRequestReaders = [];
  67284. }
  67285. getFullReader() {
  67286. (0, _util.assert)(!this._fullRequestReader, "PDFWorkerStream.getFullReader can only be called once.");
  67287. this._fullRequestReader = new PDFWorkerStreamReader(this._msgHandler);
  67288. return this._fullRequestReader;
  67289. }
  67290. getRangeReader(begin, end) {
  67291. const reader = new PDFWorkerStreamRangeReader(begin, end, this._msgHandler);
  67292. this._rangeRequestReaders.push(reader);
  67293. return reader;
  67294. }
  67295. cancelAllRequests(reason) {
  67296. if (this._fullRequestReader) {
  67297. this._fullRequestReader.cancel(reason);
  67298. }
  67299. for (const reader of this._rangeRequestReaders.slice(0)) {
  67300. reader.cancel(reason);
  67301. }
  67302. }
  67303. }
  67304. exports.PDFWorkerStream = PDFWorkerStream;
  67305. class PDFWorkerStreamReader {
  67306. constructor(msgHandler) {
  67307. this._msgHandler = msgHandler;
  67308. this.onProgress = null;
  67309. this._contentLength = null;
  67310. this._isRangeSupported = false;
  67311. this._isStreamingSupported = false;
  67312. const readableStream = this._msgHandler.sendWithStream("GetReader");
  67313. this._reader = readableStream.getReader();
  67314. this._headersReady = this._msgHandler.sendWithPromise("ReaderHeadersReady").then(data => {
  67315. this._isStreamingSupported = data.isStreamingSupported;
  67316. this._isRangeSupported = data.isRangeSupported;
  67317. this._contentLength = data.contentLength;
  67318. });
  67319. }
  67320. get headersReady() {
  67321. return this._headersReady;
  67322. }
  67323. get contentLength() {
  67324. return this._contentLength;
  67325. }
  67326. get isStreamingSupported() {
  67327. return this._isStreamingSupported;
  67328. }
  67329. get isRangeSupported() {
  67330. return this._isRangeSupported;
  67331. }
  67332. async read() {
  67333. const {
  67334. value,
  67335. done
  67336. } = await this._reader.read();
  67337. if (done) {
  67338. return {
  67339. value: undefined,
  67340. done: true
  67341. };
  67342. }
  67343. return {
  67344. value: value.buffer,
  67345. done: false
  67346. };
  67347. }
  67348. cancel(reason) {
  67349. this._reader.cancel(reason);
  67350. }
  67351. }
  67352. class PDFWorkerStreamRangeReader {
  67353. constructor(begin, end, msgHandler) {
  67354. this._msgHandler = msgHandler;
  67355. this.onProgress = null;
  67356. const readableStream = this._msgHandler.sendWithStream("GetRangeReader", {
  67357. begin,
  67358. end
  67359. });
  67360. this._reader = readableStream.getReader();
  67361. }
  67362. get isStreamingSupported() {
  67363. return false;
  67364. }
  67365. async read() {
  67366. const {
  67367. value,
  67368. done
  67369. } = await this._reader.read();
  67370. if (done) {
  67371. return {
  67372. value: undefined,
  67373. done: true
  67374. };
  67375. }
  67376. return {
  67377. value: value.buffer,
  67378. done: false
  67379. };
  67380. }
  67381. cancel(reason) {
  67382. this._reader.cancel(reason);
  67383. }
  67384. }
  67385. /***/ })
  67386. /******/ ]);
  67387. /************************************************************************/
  67388. /******/ // The module cache
  67389. /******/ var __webpack_module_cache__ = {};
  67390. /******/
  67391. /******/ // The require function
  67392. /******/ function __w_pdfjs_require__(moduleId) {
  67393. /******/ // Check if module is in cache
  67394. /******/ var cachedModule = __webpack_module_cache__[moduleId];
  67395. /******/ if (cachedModule !== undefined) {
  67396. /******/ return cachedModule.exports;
  67397. /******/ }
  67398. /******/ // Create a new module (and put it into the cache)
  67399. /******/ var module = __webpack_module_cache__[moduleId] = {
  67400. /******/ // no module.id needed
  67401. /******/ // no module.loaded needed
  67402. /******/ exports: {}
  67403. /******/ };
  67404. /******/
  67405. /******/ // Execute the module function
  67406. /******/ __webpack_modules__[moduleId](module, module.exports, __w_pdfjs_require__);
  67407. /******/
  67408. /******/ // Return the exports of the module
  67409. /******/ return module.exports;
  67410. /******/ }
  67411. /******/
  67412. /************************************************************************/
  67413. /******/ /* webpack/runtime/define property getters */
  67414. /******/ (() => {
  67415. /******/ // define getter functions for harmony exports
  67416. /******/ __w_pdfjs_require__.d = (exports, definition) => {
  67417. /******/ for(var key in definition) {
  67418. /******/ if(__w_pdfjs_require__.o(definition, key) && !__w_pdfjs_require__.o(exports, key)) {
  67419. /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
  67420. /******/ }
  67421. /******/ }
  67422. /******/ };
  67423. /******/ })();
  67424. /******/
  67425. /******/ /* webpack/runtime/hasOwnProperty shorthand */
  67426. /******/ (() => {
  67427. /******/ __w_pdfjs_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
  67428. /******/ })();
  67429. /******/
  67430. /******/ /* webpack/runtime/make namespace object */
  67431. /******/ (() => {
  67432. /******/ // define __esModule on exports
  67433. /******/ __w_pdfjs_require__.r = (exports) => {
  67434. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  67435. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  67436. /******/ }
  67437. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  67438. /******/ };
  67439. /******/ })();
  67440. /******/
  67441. /************************************************************************/
  67442. var __webpack_exports__ = {};
  67443. // This entry need to be wrapped in an IIFE because it need to be in strict mode.
  67444. (() => {
  67445. "use strict";
  67446. var exports = __webpack_exports__;
  67447. Object.defineProperty(exports, "__esModule", ({
  67448. value: true
  67449. }));
  67450. Object.defineProperty(exports, "WorkerMessageHandler", ({
  67451. enumerable: true,
  67452. get: function () {
  67453. return _worker.WorkerMessageHandler;
  67454. }
  67455. }));
  67456. var _worker = __w_pdfjs_require__(1);
  67457. const pdfjsVersion = '3.1.81';
  67458. const pdfjsBuild = '0766898d5';
  67459. })();
  67460. /******/ return __webpack_exports__;
  67461. /******/ })()
  67462. ;
  67463. });
  67464. //# sourceMappingURL=pdf.worker.js.map