2
0

pdf.worker.js 1.9 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889378903789137892378933789437895378963789737898378993790037901379023790337904379053790637907379083790937910379113791237913379143791537916379173791837919379203792137922379233792437925379263792737928379293793037931379323793337934379353793637937379383793937940379413794237943379443794537946379473794837949379503795137952379533795437955379563795737958379593796037961379623796337964379653796637967379683796937970379713797237973379743797537976379773797837979379803798137982379833798437985379863798737988379893799037991379923799337994379953799637997379983799938000380013800238003380043800538006380073800838009380103801138012380133801438015380163801738018380193802038021380223802338024380253802638027380283802938030380313803238033380343803538036380373803838039380403804138042380433804438045380463804738048380493805038051380523805338054380553805638057380583805938060380613806238063380643806538066380673806838069380703807138072380733807438075380763807738078380793808038081380823808338084380853808638087380883808938090380913809238093380943809538096380973809838099381003810138102381033810438105381063810738108381093811038111381123811338114381153811638117381183811938120381213812238123381243812538126381273812838129381303813138132381333813438135381363813738138381393814038141381423814338144381453814638147381483814938150381513815238153381543815538156381573815838159381603816138162381633816438165381663816738168381693817038171381723817338174381753817638177381783817938180381813818238183381843818538186381873818838189381903819138192381933819438195381963819738198381993820038201382023820338204382053820638207382083820938210382113821238213382143821538216382173821838219382203822138222382233822438225382263822738228382293823038231382323823338234382353823638237382383823938240382413824238243382443824538246382473824838249382503825138252382533825438255382563825738258382593826038261382623826338264382653826638267382683826938270382713827238273382743827538276382773827838279382803828138282382833828438285382863828738288382893829038291382923829338294382953829638297382983829938300383013830238303383043830538306383073830838309383103831138312383133831438315383163831738318383193832038321383223832338324383253832638327383283832938330383313833238333383343833538336383373833838339383403834138342383433834438345383463834738348383493835038351383523835338354383553835638357383583835938360383613836238363383643836538366383673836838369383703837138372383733837438375383763837738378383793838038381383823838338384383853838638387383883838938390383913839238393383943839538396383973839838399384003840138402384033840438405384063840738408384093841038411384123841338414384153841638417384183841938420384213842238423384243842538426384273842838429384303843138432384333843438435384363843738438384393844038441384423844338444384453844638447384483844938450384513845238453384543845538456384573845838459384603846138462384633846438465384663846738468384693847038471384723847338474384753847638477384783847938480384813848238483384843848538486384873848838489384903849138492384933849438495384963849738498384993850038501385023850338504385053850638507385083850938510385113851238513385143851538516385173851838519385203852138522385233852438525385263852738528385293853038531385323853338534385353853638537385383853938540385413854238543385443854538546385473854838549385503855138552385533855438555385563855738558385593856038561385623856338564385653856638567385683856938570385713857238573385743857538576385773857838579385803858138582385833858438585385863858738588385893859038591385923859338594385953859638597385983859938600386013860238603386043860538606386073860838609386103861138612386133861438615386163861738618386193862038621386223862338624386253862638627386283862938630386313863238633386343863538636386373863838639386403864138642386433864438645386463864738648386493865038651386523865338654386553865638657386583865938660386613866238663386643866538666386673866838669386703867138672386733867438675386763867738678386793868038681386823868338684386853868638687386883868938690386913869238693386943869538696386973869838699387003870138702387033870438705387063870738708387093871038711387123871338714387153871638717387183871938720387213872238723387243872538726387273872838729387303873138732387333873438735387363873738738387393874038741387423874338744387453874638747387483874938750387513875238753387543875538756387573875838759387603876138762387633876438765387663876738768387693877038771387723877338774387753877638777387783877938780387813878238783387843878538786387873878838789387903879138792387933879438795387963879738798387993880038801388023880338804388053880638807388083880938810388113881238813388143881538816388173881838819388203882138822388233882438825388263882738828388293883038831388323883338834388353883638837388383883938840388413884238843388443884538846388473884838849388503885138852388533885438855388563885738858388593886038861388623886338864388653886638867388683886938870388713887238873388743887538876388773887838879388803888138882388833888438885388863888738888388893889038891388923889338894388953889638897388983889938900389013890238903389043890538906389073890838909389103891138912389133891438915389163891738918389193892038921389223892338924389253892638927389283892938930389313893238933389343893538936389373893838939389403894138942389433894438945389463894738948389493895038951389523895338954389553895638957389583895938960389613896238963389643896538966389673896838969389703897138972389733897438975389763897738978389793898038981389823898338984389853898638987389883898938990389913899238993389943899538996389973899838999390003900139002390033900439005390063900739008390093901039011390123901339014390153901639017390183901939020390213902239023390243902539026390273902839029390303903139032390333903439035390363903739038390393904039041390423904339044390453904639047390483904939050390513905239053390543905539056390573905839059390603906139062390633906439065390663906739068390693907039071390723907339074390753907639077390783907939080390813908239083390843908539086390873908839089390903909139092390933909439095390963909739098390993910039101391023910339104391053910639107391083910939110391113911239113391143911539116391173911839119391203912139122391233912439125391263912739128391293913039131391323913339134391353913639137391383913939140391413914239143391443914539146391473914839149391503915139152391533915439155391563915739158391593916039161391623916339164391653916639167391683916939170391713917239173391743917539176391773917839179391803918139182391833918439185391863918739188391893919039191391923919339194391953919639197391983919939200392013920239203392043920539206392073920839209392103921139212392133921439215392163921739218392193922039221392223922339224392253922639227392283922939230392313923239233392343923539236392373923839239392403924139242392433924439245392463924739248392493925039251392523925339254392553925639257392583925939260392613926239263392643926539266392673926839269392703927139272392733927439275392763927739278392793928039281392823928339284392853928639287392883928939290392913929239293392943929539296392973929839299393003930139302393033930439305393063930739308393093931039311393123931339314393153931639317393183931939320393213932239323393243932539326393273932839329393303933139332393333933439335393363933739338393393934039341393423934339344393453934639347393483934939350393513935239353393543935539356393573935839359393603936139362393633936439365393663936739368393693937039371393723937339374393753937639377393783937939380393813938239383393843938539386393873938839389393903939139392393933939439395393963939739398393993940039401394023940339404394053940639407394083940939410394113941239413394143941539416394173941839419394203942139422394233942439425394263942739428394293943039431394323943339434394353943639437394383943939440394413944239443394443944539446394473944839449394503945139452394533945439455394563945739458394593946039461394623946339464394653946639467394683946939470394713947239473394743947539476394773947839479394803948139482394833948439485394863948739488394893949039491394923949339494394953949639497394983949939500395013950239503395043950539506395073950839509395103951139512395133951439515395163951739518395193952039521395223952339524395253952639527395283952939530395313953239533395343953539536395373953839539395403954139542395433954439545395463954739548395493955039551395523955339554395553955639557395583955939560395613956239563395643956539566395673956839569395703957139572395733957439575395763957739578395793958039581395823958339584395853958639587395883958939590395913959239593395943959539596395973959839599396003960139602396033960439605396063960739608396093961039611396123961339614396153961639617396183961939620396213962239623396243962539626396273962839629396303963139632396333963439635396363963739638396393964039641396423964339644396453964639647396483964939650396513965239653396543965539656396573965839659396603966139662396633966439665396663966739668396693967039671396723967339674396753967639677396783967939680396813968239683396843968539686396873968839689396903969139692396933969439695396963969739698396993970039701397023970339704397053970639707397083970939710397113971239713397143971539716397173971839719397203972139722397233972439725397263972739728397293973039731397323973339734397353973639737397383973939740397413974239743397443974539746397473974839749397503975139752397533975439755397563975739758397593976039761397623976339764397653976639767397683976939770397713977239773397743977539776397773977839779397803978139782397833978439785397863978739788397893979039791397923979339794397953979639797397983979939800398013980239803398043980539806398073980839809398103981139812398133981439815398163981739818398193982039821398223982339824398253982639827398283982939830398313983239833398343983539836398373983839839398403984139842398433984439845398463984739848398493985039851398523985339854398553985639857398583985939860398613986239863398643986539866398673986839869398703987139872398733987439875398763987739878398793988039881398823988339884398853988639887398883988939890398913989239893398943989539896398973989839899399003990139902399033990439905399063990739908399093991039911399123991339914399153991639917399183991939920399213992239923399243992539926399273992839929399303993139932399333993439935399363993739938399393994039941399423994339944399453994639947399483994939950399513995239953399543995539956399573995839959399603996139962399633996439965399663996739968399693997039971399723997339974399753997639977399783997939980399813998239983399843998539986399873998839989399903999139992399933999439995399963999739998399994000040001400024000340004400054000640007400084000940010400114001240013400144001540016400174001840019400204002140022400234002440025400264002740028400294003040031400324003340034400354003640037400384003940040400414004240043400444004540046400474004840049400504005140052400534005440055400564005740058400594006040061400624006340064400654006640067400684006940070400714007240073400744007540076400774007840079400804008140082400834008440085400864008740088400894009040091400924009340094400954009640097400984009940100401014010240103401044010540106401074010840109401104011140112401134011440115401164011740118401194012040121401224012340124401254012640127401284012940130401314013240133401344013540136401374013840139401404014140142401434014440145401464014740148401494015040151401524015340154401554015640157401584015940160401614016240163401644016540166401674016840169401704017140172401734017440175401764017740178401794018040181401824018340184401854018640187401884018940190401914019240193401944019540196401974019840199402004020140202402034020440205402064020740208402094021040211402124021340214402154021640217402184021940220402214022240223402244022540226402274022840229402304023140232402334023440235402364023740238402394024040241402424024340244402454024640247402484024940250402514025240253402544025540256402574025840259402604026140262402634026440265402664026740268402694027040271402724027340274402754027640277402784027940280402814028240283402844028540286402874028840289402904029140292402934029440295402964029740298402994030040301403024030340304403054030640307403084030940310403114031240313403144031540316403174031840319403204032140322403234032440325403264032740328403294033040331403324033340334403354033640337403384033940340403414034240343403444034540346403474034840349403504035140352403534035440355403564035740358403594036040361403624036340364403654036640367403684036940370403714037240373403744037540376403774037840379403804038140382403834038440385403864038740388403894039040391403924039340394403954039640397403984039940400404014040240403404044040540406404074040840409404104041140412404134041440415404164041740418404194042040421404224042340424404254042640427404284042940430404314043240433404344043540436404374043840439404404044140442404434044440445404464044740448404494045040451404524045340454404554045640457404584045940460404614046240463404644046540466404674046840469404704047140472404734047440475404764047740478404794048040481404824048340484404854048640487404884048940490404914049240493404944049540496404974049840499405004050140502405034050440505405064050740508405094051040511405124051340514405154051640517405184051940520405214052240523405244052540526405274052840529405304053140532405334053440535405364053740538405394054040541405424054340544405454054640547405484054940550405514055240553405544055540556405574055840559405604056140562405634056440565405664056740568405694057040571405724057340574405754057640577405784057940580405814058240583405844058540586405874058840589405904059140592405934059440595405964059740598405994060040601406024060340604406054060640607406084060940610406114061240613406144061540616406174061840619406204062140622406234062440625406264062740628406294063040631406324063340634406354063640637406384063940640406414064240643406444064540646406474064840649406504065140652406534065440655406564065740658406594066040661406624066340664406654066640667406684066940670406714067240673406744067540676406774067840679406804068140682406834068440685406864068740688406894069040691406924069340694406954069640697406984069940700407014070240703407044070540706407074070840709407104071140712407134071440715407164071740718407194072040721407224072340724407254072640727407284072940730407314073240733407344073540736407374073840739407404074140742407434074440745407464074740748407494075040751407524075340754407554075640757407584075940760407614076240763407644076540766407674076840769407704077140772407734077440775407764077740778407794078040781407824078340784407854078640787407884078940790407914079240793407944079540796407974079840799408004080140802408034080440805408064080740808408094081040811408124081340814408154081640817408184081940820408214082240823408244082540826408274082840829408304083140832408334083440835408364083740838408394084040841408424084340844408454084640847408484084940850408514085240853408544085540856408574085840859408604086140862408634086440865408664086740868408694087040871408724087340874408754087640877408784087940880408814088240883408844088540886408874088840889408904089140892408934089440895408964089740898408994090040901409024090340904409054090640907409084090940910409114091240913409144091540916409174091840919409204092140922409234092440925409264092740928409294093040931409324093340934409354093640937409384093940940409414094240943409444094540946409474094840949409504095140952409534095440955409564095740958409594096040961409624096340964409654096640967409684096940970409714097240973409744097540976409774097840979409804098140982409834098440985409864098740988409894099040991409924099340994409954099640997409984099941000410014100241003410044100541006410074100841009410104101141012410134101441015410164101741018410194102041021410224102341024410254102641027410284102941030410314103241033410344103541036410374103841039410404104141042410434104441045410464104741048410494105041051410524105341054410554105641057410584105941060410614106241063410644106541066410674106841069410704107141072410734107441075410764107741078410794108041081410824108341084410854108641087410884108941090410914109241093410944109541096410974109841099411004110141102411034110441105411064110741108411094111041111411124111341114411154111641117411184111941120411214112241123411244112541126411274112841129411304113141132411334113441135411364113741138411394114041141411424114341144411454114641147411484114941150411514115241153411544115541156411574115841159411604116141162411634116441165411664116741168411694117041171411724117341174411754117641177411784117941180411814118241183411844118541186411874118841189411904119141192411934119441195411964119741198411994120041201412024120341204412054120641207412084120941210412114121241213412144121541216412174121841219412204122141222412234122441225412264122741228412294123041231412324123341234412354123641237412384123941240412414124241243412444124541246412474124841249412504125141252412534125441255412564125741258412594126041261412624126341264412654126641267412684126941270412714127241273412744127541276412774127841279412804128141282412834128441285412864128741288412894129041291412924129341294412954129641297412984129941300413014130241303413044130541306413074130841309413104131141312413134131441315413164131741318413194132041321413224132341324413254132641327413284132941330413314133241333413344133541336413374133841339413404134141342413434134441345413464134741348413494135041351413524135341354413554135641357413584135941360413614136241363413644136541366413674136841369413704137141372413734137441375413764137741378413794138041381413824138341384413854138641387413884138941390413914139241393413944139541396413974139841399414004140141402414034140441405414064140741408414094141041411414124141341414414154141641417414184141941420414214142241423414244142541426414274142841429414304143141432414334143441435414364143741438414394144041441414424144341444414454144641447414484144941450414514145241453414544145541456414574145841459414604146141462414634146441465414664146741468414694147041471414724147341474414754147641477414784147941480414814148241483414844148541486414874148841489414904149141492414934149441495414964149741498414994150041501415024150341504415054150641507415084150941510415114151241513415144151541516415174151841519415204152141522415234152441525415264152741528415294153041531415324153341534415354153641537415384153941540415414154241543415444154541546415474154841549415504155141552415534155441555415564155741558415594156041561415624156341564415654156641567415684156941570415714157241573415744157541576415774157841579415804158141582415834158441585415864158741588415894159041591415924159341594415954159641597415984159941600416014160241603416044160541606416074160841609416104161141612416134161441615416164161741618416194162041621416224162341624416254162641627416284162941630416314163241633416344163541636416374163841639416404164141642416434164441645416464164741648416494165041651416524165341654416554165641657416584165941660416614166241663416644166541666416674166841669416704167141672416734167441675416764167741678416794168041681416824168341684416854168641687416884168941690416914169241693416944169541696416974169841699417004170141702417034170441705417064170741708417094171041711417124171341714417154171641717417184171941720417214172241723417244172541726417274172841729417304173141732417334173441735417364173741738417394174041741417424174341744417454174641747417484174941750417514175241753417544175541756417574175841759417604176141762417634176441765417664176741768417694177041771417724177341774417754177641777417784177941780417814178241783417844178541786417874178841789417904179141792417934179441795417964179741798417994180041801418024180341804418054180641807418084180941810418114181241813418144181541816418174181841819418204182141822418234182441825418264182741828418294183041831418324183341834418354183641837418384183941840418414184241843418444184541846418474184841849418504185141852418534185441855418564185741858418594186041861418624186341864418654186641867418684186941870418714187241873418744187541876418774187841879418804188141882418834188441885418864188741888418894189041891418924189341894418954189641897418984189941900419014190241903419044190541906419074190841909419104191141912419134191441915419164191741918419194192041921419224192341924419254192641927419284192941930419314193241933419344193541936419374193841939419404194141942419434194441945419464194741948419494195041951419524195341954419554195641957419584195941960419614196241963419644196541966419674196841969419704197141972419734197441975419764197741978419794198041981419824198341984419854198641987419884198941990419914199241993419944199541996419974199841999420004200142002420034200442005420064200742008420094201042011420124201342014420154201642017420184201942020420214202242023420244202542026420274202842029420304203142032420334203442035420364203742038420394204042041420424204342044420454204642047420484204942050420514205242053420544205542056420574205842059420604206142062420634206442065420664206742068420694207042071420724207342074420754207642077420784207942080420814208242083420844208542086420874208842089420904209142092420934209442095420964209742098420994210042101421024210342104421054210642107421084210942110421114211242113421144211542116421174211842119421204212142122421234212442125421264212742128421294213042131421324213342134421354213642137421384213942140421414214242143421444214542146421474214842149421504215142152421534215442155421564215742158421594216042161421624216342164421654216642167421684216942170421714217242173421744217542176421774217842179421804218142182421834218442185421864218742188421894219042191421924219342194421954219642197421984219942200422014220242203422044220542206422074220842209422104221142212422134221442215422164221742218422194222042221422224222342224422254222642227422284222942230422314223242233422344223542236422374223842239422404224142242422434224442245422464224742248422494225042251422524225342254422554225642257422584225942260422614226242263422644226542266422674226842269422704227142272422734227442275422764227742278422794228042281422824228342284422854228642287422884228942290422914229242293422944229542296422974229842299423004230142302423034230442305423064230742308423094231042311423124231342314423154231642317423184231942320423214232242323423244232542326423274232842329423304233142332423334233442335423364233742338423394234042341423424234342344423454234642347423484234942350423514235242353423544235542356423574235842359423604236142362423634236442365423664236742368423694237042371423724237342374423754237642377423784237942380423814238242383423844238542386423874238842389423904239142392423934239442395423964239742398423994240042401424024240342404424054240642407424084240942410424114241242413424144241542416424174241842419424204242142422424234242442425424264242742428424294243042431424324243342434424354243642437424384243942440424414244242443424444244542446424474244842449424504245142452424534245442455424564245742458424594246042461424624246342464424654246642467424684246942470424714247242473424744247542476424774247842479424804248142482424834248442485424864248742488424894249042491424924249342494424954249642497424984249942500425014250242503425044250542506425074250842509425104251142512425134251442515425164251742518425194252042521425224252342524425254252642527425284252942530425314253242533425344253542536425374253842539425404254142542425434254442545425464254742548425494255042551425524255342554425554255642557425584255942560425614256242563425644256542566425674256842569425704257142572425734257442575425764257742578425794258042581425824258342584425854258642587425884258942590425914259242593425944259542596425974259842599426004260142602426034260442605426064260742608426094261042611426124261342614426154261642617426184261942620426214262242623426244262542626426274262842629426304263142632426334263442635426364263742638426394264042641426424264342644426454264642647426484264942650426514265242653426544265542656426574265842659426604266142662426634266442665426664266742668426694267042671426724267342674426754267642677426784267942680426814268242683426844268542686426874268842689426904269142692426934269442695426964269742698426994270042701427024270342704427054270642707427084270942710427114271242713427144271542716427174271842719427204272142722427234272442725427264272742728427294273042731427324273342734427354273642737427384273942740427414274242743427444274542746427474274842749427504275142752427534275442755427564275742758427594276042761427624276342764427654276642767427684276942770427714277242773427744277542776427774277842779427804278142782427834278442785427864278742788427894279042791427924279342794427954279642797427984279942800428014280242803428044280542806428074280842809428104281142812428134281442815428164281742818428194282042821428224282342824428254282642827428284282942830428314283242833428344283542836428374283842839428404284142842428434284442845428464284742848428494285042851428524285342854428554285642857428584285942860428614286242863428644286542866428674286842869428704287142872428734287442875428764287742878428794288042881428824288342884428854288642887428884288942890428914289242893428944289542896428974289842899429004290142902429034290442905429064290742908429094291042911429124291342914429154291642917429184291942920429214292242923429244292542926429274292842929429304293142932429334293442935429364293742938429394294042941429424294342944429454294642947429484294942950429514295242953429544295542956429574295842959429604296142962429634296442965429664296742968429694297042971429724297342974429754297642977429784297942980429814298242983429844298542986429874298842989429904299142992429934299442995429964299742998429994300043001430024300343004430054300643007430084300943010430114301243013430144301543016430174301843019430204302143022430234302443025430264302743028430294303043031430324303343034430354303643037430384303943040430414304243043430444304543046430474304843049430504305143052430534305443055430564305743058430594306043061430624306343064430654306643067430684306943070430714307243073430744307543076430774307843079430804308143082430834308443085430864308743088430894309043091430924309343094430954309643097430984309943100431014310243103431044310543106431074310843109431104311143112431134311443115431164311743118431194312043121431224312343124431254312643127431284312943130431314313243133431344313543136431374313843139431404314143142431434314443145431464314743148431494315043151431524315343154431554315643157431584315943160431614316243163431644316543166431674316843169431704317143172431734317443175431764317743178431794318043181431824318343184431854318643187431884318943190431914319243193431944319543196431974319843199432004320143202432034320443205432064320743208432094321043211432124321343214432154321643217432184321943220432214322243223432244322543226432274322843229432304323143232432334323443235432364323743238432394324043241432424324343244432454324643247432484324943250432514325243253432544325543256432574325843259432604326143262432634326443265432664326743268432694327043271432724327343274432754327643277432784327943280432814328243283432844328543286432874328843289432904329143292432934329443295432964329743298432994330043301433024330343304433054330643307433084330943310433114331243313433144331543316433174331843319433204332143322433234332443325433264332743328433294333043331433324333343334433354333643337433384333943340433414334243343433444334543346433474334843349433504335143352433534335443355433564335743358433594336043361433624336343364433654336643367433684336943370433714337243373433744337543376433774337843379433804338143382433834338443385433864338743388433894339043391433924339343394433954339643397433984339943400434014340243403434044340543406434074340843409434104341143412434134341443415434164341743418434194342043421434224342343424434254342643427434284342943430434314343243433434344343543436434374343843439434404344143442434434344443445434464344743448434494345043451434524345343454434554345643457434584345943460434614346243463434644346543466434674346843469434704347143472434734347443475434764347743478434794348043481434824348343484434854348643487434884348943490434914349243493434944349543496434974349843499435004350143502435034350443505435064350743508435094351043511435124351343514435154351643517435184351943520435214352243523435244352543526435274352843529435304353143532435334353443535435364353743538435394354043541435424354343544435454354643547435484354943550435514355243553435544355543556435574355843559435604356143562435634356443565435664356743568435694357043571435724357343574435754357643577435784357943580435814358243583435844358543586435874358843589435904359143592435934359443595435964359743598435994360043601436024360343604436054360643607436084360943610436114361243613436144361543616436174361843619436204362143622436234362443625436264362743628436294363043631436324363343634436354363643637436384363943640436414364243643436444364543646436474364843649436504365143652436534365443655436564365743658436594366043661436624366343664436654366643667436684366943670436714367243673436744367543676436774367843679436804368143682436834368443685436864368743688436894369043691436924369343694436954369643697436984369943700437014370243703437044370543706437074370843709437104371143712437134371443715437164371743718437194372043721437224372343724437254372643727437284372943730437314373243733437344373543736437374373843739437404374143742437434374443745437464374743748437494375043751437524375343754437554375643757437584375943760437614376243763437644376543766437674376843769437704377143772437734377443775437764377743778437794378043781437824378343784437854378643787437884378943790437914379243793437944379543796437974379843799438004380143802438034380443805438064380743808438094381043811438124381343814438154381643817438184381943820438214382243823438244382543826438274382843829438304383143832438334383443835438364383743838438394384043841438424384343844438454384643847438484384943850438514385243853438544385543856438574385843859438604386143862438634386443865438664386743868438694387043871438724387343874438754387643877438784387943880438814388243883438844388543886438874388843889438904389143892438934389443895438964389743898438994390043901439024390343904439054390643907439084390943910439114391243913439144391543916439174391843919439204392143922439234392443925439264392743928439294393043931439324393343934439354393643937439384393943940439414394243943439444394543946439474394843949439504395143952439534395443955439564395743958439594396043961439624396343964439654396643967439684396943970439714397243973439744397543976439774397843979439804398143982439834398443985439864398743988439894399043991439924399343994439954399643997439984399944000440014400244003440044400544006440074400844009440104401144012440134401444015440164401744018440194402044021440224402344024440254402644027440284402944030440314403244033440344403544036440374403844039440404404144042440434404444045440464404744048440494405044051440524405344054440554405644057440584405944060440614406244063440644406544066440674406844069440704407144072440734407444075440764407744078440794408044081440824408344084440854408644087440884408944090440914409244093440944409544096440974409844099441004410144102441034410444105441064410744108441094411044111441124411344114441154411644117441184411944120441214412244123441244412544126441274412844129441304413144132441334413444135441364413744138441394414044141441424414344144441454414644147441484414944150441514415244153441544415544156441574415844159441604416144162441634416444165441664416744168441694417044171441724417344174441754417644177441784417944180441814418244183441844418544186441874418844189441904419144192441934419444195441964419744198441994420044201442024420344204442054420644207442084420944210442114421244213442144421544216442174421844219442204422144222442234422444225442264422744228442294423044231442324423344234442354423644237442384423944240442414424244243442444424544246442474424844249442504425144252442534425444255442564425744258442594426044261442624426344264442654426644267442684426944270442714427244273442744427544276442774427844279442804428144282442834428444285442864428744288442894429044291442924429344294442954429644297442984429944300443014430244303443044430544306443074430844309443104431144312443134431444315443164431744318443194432044321443224432344324443254432644327443284432944330443314433244333443344433544336443374433844339443404434144342443434434444345443464434744348443494435044351443524435344354443554435644357443584435944360443614436244363443644436544366443674436844369443704437144372443734437444375443764437744378443794438044381443824438344384443854438644387443884438944390443914439244393443944439544396443974439844399444004440144402444034440444405444064440744408444094441044411444124441344414444154441644417444184441944420444214442244423444244442544426444274442844429444304443144432444334443444435444364443744438444394444044441444424444344444444454444644447444484444944450444514445244453444544445544456444574445844459444604446144462444634446444465444664446744468444694447044471444724447344474444754447644477444784447944480444814448244483444844448544486444874448844489444904449144492444934449444495444964449744498444994450044501445024450344504445054450644507445084450944510445114451244513445144451544516445174451844519445204452144522445234452444525445264452744528445294453044531445324453344534445354453644537445384453944540445414454244543445444454544546445474454844549445504455144552445534455444555445564455744558445594456044561445624456344564445654456644567445684456944570445714457244573445744457544576445774457844579445804458144582445834458444585445864458744588445894459044591445924459344594445954459644597445984459944600446014460244603446044460544606446074460844609446104461144612446134461444615446164461744618446194462044621446224462344624446254462644627446284462944630446314463244633446344463544636446374463844639446404464144642446434464444645446464464744648446494465044651446524465344654446554465644657446584465944660446614466244663446644466544666446674466844669446704467144672446734467444675446764467744678446794468044681446824468344684446854468644687446884468944690446914469244693446944469544696446974469844699447004470144702447034470444705447064470744708447094471044711447124471344714447154471644717447184471944720447214472244723447244472544726447274472844729447304473144732447334473444735447364473744738447394474044741447424474344744447454474644747447484474944750447514475244753447544475544756447574475844759447604476144762447634476444765447664476744768447694477044771447724477344774447754477644777447784477944780447814478244783447844478544786447874478844789447904479144792447934479444795447964479744798447994480044801448024480344804448054480644807448084480944810448114481244813448144481544816448174481844819448204482144822448234482444825448264482744828448294483044831448324483344834448354483644837448384483944840448414484244843448444484544846448474484844849448504485144852448534485444855448564485744858448594486044861448624486344864448654486644867448684486944870448714487244873448744487544876448774487844879448804488144882448834488444885448864488744888448894489044891448924489344894448954489644897448984489944900449014490244903449044490544906449074490844909449104491144912449134491444915449164491744918449194492044921449224492344924449254492644927449284492944930449314493244933449344493544936449374493844939449404494144942449434494444945449464494744948449494495044951449524495344954449554495644957449584495944960449614496244963449644496544966449674496844969449704497144972449734497444975449764497744978449794498044981449824498344984449854498644987449884498944990449914499244993449944499544996449974499844999450004500145002450034500445005450064500745008450094501045011450124501345014450154501645017450184501945020450214502245023450244502545026450274502845029450304503145032450334503445035450364503745038450394504045041450424504345044450454504645047450484504945050450514505245053450544505545056450574505845059450604506145062450634506445065450664506745068450694507045071450724507345074450754507645077450784507945080450814508245083450844508545086450874508845089450904509145092450934509445095450964509745098450994510045101451024510345104451054510645107451084510945110451114511245113451144511545116451174511845119451204512145122451234512445125451264512745128451294513045131451324513345134451354513645137451384513945140451414514245143451444514545146451474514845149451504515145152451534515445155451564515745158451594516045161451624516345164451654516645167451684516945170451714517245173451744517545176451774517845179451804518145182451834518445185451864518745188451894519045191451924519345194451954519645197451984519945200452014520245203452044520545206452074520845209452104521145212452134521445215452164521745218452194522045221452224522345224452254522645227452284522945230452314523245233452344523545236452374523845239452404524145242452434524445245452464524745248452494525045251452524525345254452554525645257452584525945260452614526245263452644526545266452674526845269452704527145272452734527445275452764527745278452794528045281452824528345284452854528645287452884528945290452914529245293452944529545296452974529845299453004530145302453034530445305453064530745308453094531045311453124531345314453154531645317453184531945320453214532245323453244532545326453274532845329453304533145332453334533445335453364533745338453394534045341453424534345344453454534645347453484534945350453514535245353453544535545356453574535845359453604536145362453634536445365453664536745368453694537045371453724537345374453754537645377453784537945380453814538245383453844538545386453874538845389453904539145392453934539445395453964539745398453994540045401454024540345404454054540645407454084540945410454114541245413454144541545416454174541845419454204542145422454234542445425454264542745428454294543045431454324543345434454354543645437454384543945440454414544245443454444544545446454474544845449454504545145452454534545445455454564545745458454594546045461454624546345464454654546645467454684546945470454714547245473454744547545476454774547845479454804548145482454834548445485454864548745488454894549045491454924549345494454954549645497454984549945500455014550245503455044550545506455074550845509455104551145512455134551445515455164551745518455194552045521455224552345524455254552645527455284552945530455314553245533455344553545536455374553845539455404554145542455434554445545455464554745548455494555045551455524555345554455554555645557455584555945560455614556245563455644556545566455674556845569455704557145572455734557445575455764557745578455794558045581455824558345584455854558645587455884558945590455914559245593455944559545596455974559845599456004560145602456034560445605456064560745608456094561045611456124561345614456154561645617456184561945620456214562245623456244562545626456274562845629456304563145632456334563445635456364563745638456394564045641456424564345644456454564645647456484564945650456514565245653456544565545656456574565845659456604566145662456634566445665456664566745668456694567045671456724567345674456754567645677456784567945680456814568245683456844568545686456874568845689456904569145692456934569445695456964569745698456994570045701457024570345704457054570645707457084570945710457114571245713457144571545716457174571845719457204572145722457234572445725457264572745728457294573045731457324573345734457354573645737457384573945740457414574245743457444574545746457474574845749457504575145752457534575445755457564575745758457594576045761457624576345764457654576645767457684576945770457714577245773457744577545776457774577845779457804578145782457834578445785457864578745788457894579045791457924579345794457954579645797457984579945800458014580245803458044580545806458074580845809458104581145812458134581445815458164581745818458194582045821458224582345824458254582645827458284582945830458314583245833458344583545836458374583845839458404584145842458434584445845458464584745848458494585045851458524585345854458554585645857458584585945860458614586245863458644586545866458674586845869458704587145872458734587445875458764587745878458794588045881458824588345884458854588645887458884588945890458914589245893458944589545896458974589845899459004590145902459034590445905459064590745908459094591045911459124591345914459154591645917459184591945920459214592245923459244592545926459274592845929459304593145932459334593445935459364593745938459394594045941459424594345944459454594645947459484594945950459514595245953459544595545956459574595845959459604596145962459634596445965459664596745968459694597045971459724597345974459754597645977459784597945980459814598245983459844598545986459874598845989459904599145992459934599445995459964599745998459994600046001460024600346004460054600646007460084600946010460114601246013460144601546016460174601846019460204602146022460234602446025460264602746028460294603046031460324603346034460354603646037460384603946040460414604246043460444604546046460474604846049460504605146052460534605446055460564605746058460594606046061460624606346064460654606646067460684606946070460714607246073460744607546076460774607846079460804608146082460834608446085460864608746088460894609046091460924609346094460954609646097460984609946100461014610246103461044610546106461074610846109461104611146112461134611446115461164611746118461194612046121461224612346124461254612646127461284612946130461314613246133461344613546136461374613846139461404614146142461434614446145461464614746148461494615046151461524615346154461554615646157461584615946160461614616246163461644616546166461674616846169461704617146172461734617446175461764617746178461794618046181461824618346184461854618646187461884618946190461914619246193461944619546196461974619846199462004620146202462034620446205462064620746208462094621046211462124621346214462154621646217462184621946220462214622246223462244622546226462274622846229462304623146232462334623446235462364623746238462394624046241462424624346244462454624646247462484624946250462514625246253462544625546256462574625846259462604626146262462634626446265462664626746268462694627046271462724627346274462754627646277462784627946280462814628246283462844628546286462874628846289462904629146292462934629446295462964629746298462994630046301463024630346304463054630646307463084630946310463114631246313463144631546316463174631846319463204632146322463234632446325463264632746328463294633046331463324633346334463354633646337463384633946340463414634246343463444634546346463474634846349463504635146352463534635446355463564635746358463594636046361463624636346364463654636646367463684636946370463714637246373463744637546376463774637846379463804638146382463834638446385463864638746388463894639046391463924639346394463954639646397463984639946400464014640246403464044640546406464074640846409464104641146412464134641446415464164641746418464194642046421464224642346424464254642646427464284642946430464314643246433464344643546436464374643846439464404644146442464434644446445464464644746448464494645046451464524645346454464554645646457464584645946460464614646246463464644646546466464674646846469464704647146472464734647446475464764647746478464794648046481464824648346484464854648646487464884648946490464914649246493464944649546496464974649846499465004650146502465034650446505465064650746508465094651046511465124651346514465154651646517465184651946520465214652246523465244652546526465274652846529465304653146532465334653446535465364653746538465394654046541465424654346544465454654646547465484654946550465514655246553465544655546556465574655846559465604656146562465634656446565465664656746568465694657046571465724657346574465754657646577465784657946580465814658246583465844658546586465874658846589465904659146592465934659446595465964659746598465994660046601466024660346604466054660646607466084660946610466114661246613466144661546616466174661846619466204662146622466234662446625466264662746628466294663046631466324663346634466354663646637466384663946640466414664246643466444664546646466474664846649466504665146652466534665446655466564665746658466594666046661466624666346664466654666646667466684666946670466714667246673466744667546676466774667846679466804668146682466834668446685466864668746688466894669046691466924669346694466954669646697466984669946700467014670246703467044670546706467074670846709467104671146712467134671446715467164671746718467194672046721467224672346724467254672646727467284672946730467314673246733467344673546736467374673846739467404674146742467434674446745467464674746748467494675046751467524675346754467554675646757467584675946760467614676246763467644676546766467674676846769467704677146772467734677446775467764677746778467794678046781467824678346784467854678646787467884678946790467914679246793467944679546796467974679846799468004680146802468034680446805468064680746808468094681046811468124681346814468154681646817468184681946820468214682246823468244682546826468274682846829468304683146832468334683446835468364683746838468394684046841468424684346844468454684646847468484684946850468514685246853468544685546856468574685846859468604686146862468634686446865468664686746868468694687046871468724687346874468754687646877468784687946880468814688246883468844688546886468874688846889468904689146892468934689446895468964689746898468994690046901469024690346904469054690646907469084690946910469114691246913469144691546916469174691846919469204692146922469234692446925469264692746928469294693046931469324693346934469354693646937469384693946940469414694246943469444694546946469474694846949469504695146952469534695446955469564695746958469594696046961469624696346964469654696646967469684696946970469714697246973469744697546976469774697846979469804698146982469834698446985469864698746988469894699046991469924699346994469954699646997469984699947000470014700247003470044700547006470074700847009470104701147012470134701447015470164701747018470194702047021470224702347024470254702647027470284702947030470314703247033470344703547036470374703847039470404704147042470434704447045470464704747048470494705047051470524705347054470554705647057470584705947060470614706247063470644706547066470674706847069470704707147072470734707447075470764707747078470794708047081470824708347084470854708647087470884708947090470914709247093470944709547096470974709847099471004710147102471034710447105471064710747108471094711047111471124711347114471154711647117471184711947120471214712247123471244712547126471274712847129471304713147132471334713447135471364713747138471394714047141471424714347144471454714647147471484714947150471514715247153471544715547156471574715847159471604716147162471634716447165471664716747168471694717047171471724717347174471754717647177471784717947180471814718247183471844718547186471874718847189471904719147192471934719447195471964719747198471994720047201472024720347204472054720647207472084720947210472114721247213472144721547216472174721847219472204722147222472234722447225472264722747228472294723047231472324723347234472354723647237472384723947240472414724247243472444724547246472474724847249472504725147252472534725447255472564725747258472594726047261472624726347264472654726647267472684726947270472714727247273472744727547276472774727847279472804728147282472834728447285472864728747288472894729047291472924729347294472954729647297472984729947300473014730247303473044730547306473074730847309473104731147312473134731447315473164731747318473194732047321473224732347324473254732647327473284732947330473314733247333473344733547336473374733847339473404734147342473434734447345473464734747348473494735047351473524735347354473554735647357473584735947360473614736247363473644736547366473674736847369473704737147372473734737447375473764737747378473794738047381473824738347384473854738647387473884738947390473914739247393473944739547396473974739847399474004740147402474034740447405474064740747408474094741047411474124741347414474154741647417474184741947420474214742247423474244742547426474274742847429474304743147432474334743447435474364743747438474394744047441474424744347444474454744647447474484744947450474514745247453474544745547456474574745847459474604746147462474634746447465474664746747468474694747047471474724747347474474754747647477474784747947480474814748247483474844748547486474874748847489474904749147492474934749447495474964749747498474994750047501475024750347504475054750647507475084750947510475114751247513475144751547516475174751847519475204752147522475234752447525475264752747528475294753047531475324753347534475354753647537475384753947540475414754247543475444754547546475474754847549475504755147552475534755447555475564755747558475594756047561475624756347564475654756647567475684756947570475714757247573475744757547576475774757847579475804758147582475834758447585475864758747588475894759047591475924759347594475954759647597475984759947600476014760247603476044760547606476074760847609476104761147612476134761447615476164761747618476194762047621476224762347624476254762647627476284762947630476314763247633476344763547636476374763847639476404764147642476434764447645476464764747648476494765047651476524765347654476554765647657476584765947660476614766247663476644766547666476674766847669476704767147672476734767447675476764767747678476794768047681476824768347684476854768647687476884768947690476914769247693476944769547696476974769847699477004770147702477034770447705477064770747708477094771047711477124771347714477154771647717477184771947720477214772247723477244772547726477274772847729477304773147732477334773447735477364773747738477394774047741477424774347744477454774647747477484774947750477514775247753477544775547756477574775847759477604776147762477634776447765477664776747768477694777047771477724777347774477754777647777477784777947780477814778247783477844778547786477874778847789477904779147792477934779447795477964779747798477994780047801478024780347804478054780647807478084780947810478114781247813478144781547816478174781847819478204782147822478234782447825478264782747828478294783047831478324783347834478354783647837478384783947840478414784247843478444784547846478474784847849478504785147852478534785447855478564785747858478594786047861478624786347864478654786647867478684786947870478714787247873478744787547876478774787847879478804788147882478834788447885478864788747888478894789047891478924789347894478954789647897478984789947900479014790247903479044790547906479074790847909479104791147912479134791447915479164791747918479194792047921479224792347924479254792647927479284792947930479314793247933479344793547936479374793847939479404794147942479434794447945479464794747948479494795047951479524795347954479554795647957479584795947960479614796247963479644796547966479674796847969479704797147972479734797447975479764797747978479794798047981479824798347984479854798647987479884798947990479914799247993479944799547996479974799847999480004800148002480034800448005480064800748008480094801048011480124801348014480154801648017480184801948020480214802248023480244802548026480274802848029480304803148032480334803448035480364803748038480394804048041480424804348044480454804648047480484804948050480514805248053480544805548056480574805848059480604806148062480634806448065480664806748068480694807048071480724807348074480754807648077480784807948080480814808248083480844808548086480874808848089480904809148092480934809448095480964809748098480994810048101481024810348104481054810648107481084810948110481114811248113481144811548116481174811848119481204812148122481234812448125481264812748128481294813048131481324813348134481354813648137481384813948140481414814248143481444814548146481474814848149481504815148152481534815448155481564815748158481594816048161481624816348164481654816648167481684816948170481714817248173481744817548176481774817848179481804818148182481834818448185481864818748188481894819048191481924819348194481954819648197481984819948200482014820248203482044820548206482074820848209482104821148212482134821448215482164821748218482194822048221482224822348224482254822648227482284822948230482314823248233482344823548236482374823848239482404824148242482434824448245482464824748248482494825048251482524825348254482554825648257482584825948260482614826248263482644826548266482674826848269482704827148272482734827448275482764827748278482794828048281482824828348284482854828648287482884828948290482914829248293482944829548296482974829848299483004830148302483034830448305483064830748308483094831048311483124831348314483154831648317483184831948320483214832248323483244832548326483274832848329483304833148332483334833448335483364833748338483394834048341483424834348344483454834648347483484834948350483514835248353483544835548356483574835848359483604836148362483634836448365483664836748368483694837048371483724837348374483754837648377483784837948380483814838248383483844838548386483874838848389483904839148392483934839448395483964839748398483994840048401484024840348404484054840648407484084840948410484114841248413484144841548416484174841848419484204842148422484234842448425484264842748428484294843048431484324843348434484354843648437484384843948440484414844248443484444844548446484474844848449484504845148452484534845448455484564845748458484594846048461484624846348464484654846648467484684846948470484714847248473484744847548476484774847848479484804848148482484834848448485484864848748488484894849048491484924849348494484954849648497484984849948500485014850248503485044850548506485074850848509485104851148512485134851448515485164851748518485194852048521485224852348524485254852648527485284852948530485314853248533485344853548536485374853848539485404854148542485434854448545485464854748548485494855048551485524855348554485554855648557485584855948560485614856248563485644856548566485674856848569485704857148572485734857448575485764857748578485794858048581485824858348584485854858648587485884858948590485914859248593485944859548596485974859848599486004860148602486034860448605486064860748608486094861048611486124861348614486154861648617486184861948620486214862248623486244862548626486274862848629486304863148632486334863448635486364863748638486394864048641486424864348644486454864648647486484864948650486514865248653486544865548656486574865848659486604866148662486634866448665486664866748668486694867048671486724867348674486754867648677486784867948680486814868248683486844868548686486874868848689486904869148692486934869448695486964869748698486994870048701487024870348704487054870648707487084870948710487114871248713487144871548716487174871848719487204872148722487234872448725487264872748728487294873048731487324873348734487354873648737487384873948740487414874248743487444874548746487474874848749487504875148752487534875448755487564875748758487594876048761487624876348764487654876648767487684876948770487714877248773487744877548776487774877848779487804878148782487834878448785487864878748788487894879048791487924879348794487954879648797487984879948800488014880248803488044880548806488074880848809488104881148812488134881448815488164881748818488194882048821488224882348824488254882648827488284882948830488314883248833488344883548836488374883848839488404884148842488434884448845488464884748848488494885048851488524885348854488554885648857488584885948860488614886248863488644886548866488674886848869488704887148872488734887448875488764887748878488794888048881488824888348884488854888648887488884888948890488914889248893488944889548896488974889848899489004890148902489034890448905489064890748908489094891048911489124891348914489154891648917489184891948920489214892248923489244892548926489274892848929489304893148932489334893448935489364893748938489394894048941489424894348944489454894648947489484894948950489514895248953489544895548956489574895848959489604896148962489634896448965489664896748968489694897048971489724897348974489754897648977489784897948980489814898248983489844898548986489874898848989489904899148992489934899448995489964899748998489994900049001490024900349004490054900649007490084900949010490114901249013490144901549016490174901849019490204902149022490234902449025490264902749028490294903049031490324903349034490354903649037490384903949040490414904249043490444904549046490474904849049490504905149052490534905449055490564905749058490594906049061490624906349064490654906649067490684906949070490714907249073490744907549076490774907849079490804908149082490834908449085490864908749088490894909049091490924909349094490954909649097490984909949100491014910249103491044910549106491074910849109491104911149112491134911449115491164911749118491194912049121491224912349124491254912649127491284912949130491314913249133491344913549136491374913849139491404914149142491434914449145491464914749148491494915049151491524915349154491554915649157491584915949160491614916249163491644916549166491674916849169491704917149172491734917449175491764917749178491794918049181491824918349184491854918649187491884918949190491914919249193491944919549196491974919849199492004920149202492034920449205492064920749208492094921049211492124921349214492154921649217492184921949220492214922249223492244922549226492274922849229492304923149232492334923449235492364923749238492394924049241492424924349244492454924649247492484924949250492514925249253492544925549256492574925849259492604926149262492634926449265492664926749268492694927049271492724927349274492754927649277492784927949280492814928249283492844928549286492874928849289492904929149292492934929449295492964929749298492994930049301493024930349304493054930649307493084930949310493114931249313493144931549316493174931849319493204932149322493234932449325493264932749328493294933049331493324933349334493354933649337493384933949340493414934249343493444934549346493474934849349493504935149352493534935449355493564935749358493594936049361493624936349364493654936649367493684936949370493714937249373493744937549376493774937849379493804938149382493834938449385493864938749388493894939049391493924939349394493954939649397493984939949400494014940249403494044940549406494074940849409494104941149412494134941449415494164941749418494194942049421494224942349424494254942649427494284942949430494314943249433494344943549436494374943849439494404944149442494434944449445494464944749448494494945049451494524945349454494554945649457494584945949460494614946249463494644946549466494674946849469494704947149472494734947449475494764947749478494794948049481494824948349484494854948649487494884948949490494914949249493494944949549496494974949849499495004950149502495034950449505495064950749508495094951049511495124951349514495154951649517495184951949520495214952249523495244952549526495274952849529495304953149532495334953449535495364953749538495394954049541495424954349544495454954649547495484954949550495514955249553495544955549556495574955849559495604956149562495634956449565495664956749568495694957049571495724957349574495754957649577495784957949580495814958249583495844958549586495874958849589495904959149592495934959449595495964959749598495994960049601496024960349604496054960649607496084960949610496114961249613496144961549616496174961849619496204962149622496234962449625496264962749628496294963049631496324963349634496354963649637496384963949640496414964249643496444964549646496474964849649496504965149652496534965449655496564965749658496594966049661496624966349664496654966649667496684966949670496714967249673496744967549676496774967849679496804968149682496834968449685496864968749688496894969049691496924969349694496954969649697496984969949700497014970249703497044970549706497074970849709497104971149712497134971449715497164971749718497194972049721497224972349724497254972649727497284972949730497314973249733497344973549736497374973849739497404974149742497434974449745497464974749748497494975049751497524975349754497554975649757497584975949760497614976249763497644976549766497674976849769497704977149772497734977449775497764977749778497794978049781497824978349784497854978649787497884978949790497914979249793497944979549796497974979849799498004980149802498034980449805498064980749808498094981049811498124981349814498154981649817498184981949820498214982249823498244982549826498274982849829498304983149832498334983449835498364983749838498394984049841498424984349844498454984649847498484984949850498514985249853498544985549856498574985849859498604986149862498634986449865498664986749868498694987049871498724987349874498754987649877498784987949880498814988249883498844988549886498874988849889498904989149892498934989449895498964989749898498994990049901499024990349904499054990649907499084990949910499114991249913499144991549916499174991849919499204992149922499234992449925499264992749928499294993049931499324993349934499354993649937499384993949940499414994249943499444994549946499474994849949499504995149952499534995449955499564995749958499594996049961499624996349964499654996649967499684996949970499714997249973499744997549976499774997849979499804998149982499834998449985499864998749988499894999049991499924999349994499954999649997499984999950000500015000250003500045000550006500075000850009500105001150012500135001450015500165001750018500195002050021500225002350024500255002650027500285002950030500315003250033500345003550036500375003850039500405004150042500435004450045500465004750048500495005050051500525005350054500555005650057500585005950060500615006250063500645006550066500675006850069500705007150072500735007450075500765007750078500795008050081500825008350084500855008650087500885008950090500915009250093500945009550096500975009850099501005010150102501035010450105501065010750108501095011050111501125011350114501155011650117501185011950120501215012250123501245012550126501275012850129501305013150132501335013450135501365013750138501395014050141501425014350144501455014650147501485014950150501515015250153501545015550156501575015850159501605016150162501635016450165501665016750168501695017050171501725017350174501755017650177501785017950180501815018250183501845018550186501875018850189501905019150192501935019450195501965019750198501995020050201502025020350204502055020650207502085020950210502115021250213502145021550216502175021850219502205022150222502235022450225502265022750228502295023050231502325023350234502355023650237502385023950240502415024250243502445024550246502475024850249502505025150252502535025450255502565025750258502595026050261502625026350264502655026650267502685026950270502715027250273502745027550276502775027850279502805028150282502835028450285502865028750288502895029050291502925029350294502955029650297502985029950300503015030250303503045030550306503075030850309503105031150312503135031450315503165031750318503195032050321503225032350324503255032650327503285032950330503315033250333503345033550336503375033850339503405034150342503435034450345503465034750348503495035050351503525035350354503555035650357503585035950360503615036250363503645036550366503675036850369503705037150372503735037450375503765037750378503795038050381503825038350384503855038650387503885038950390503915039250393503945039550396503975039850399504005040150402504035040450405504065040750408504095041050411504125041350414504155041650417504185041950420504215042250423504245042550426504275042850429504305043150432504335043450435504365043750438504395044050441504425044350444504455044650447504485044950450504515045250453504545045550456504575045850459504605046150462504635046450465504665046750468504695047050471504725047350474504755047650477504785047950480504815048250483504845048550486504875048850489504905049150492504935049450495504965049750498504995050050501505025050350504505055050650507505085050950510505115051250513505145051550516505175051850519505205052150522505235052450525505265052750528505295053050531505325053350534505355053650537505385053950540505415054250543505445054550546505475054850549505505055150552505535055450555505565055750558505595056050561505625056350564505655056650567505685056950570505715057250573505745057550576505775057850579505805058150582505835058450585505865058750588505895059050591505925059350594505955059650597505985059950600506015060250603506045060550606506075060850609506105061150612506135061450615506165061750618506195062050621506225062350624506255062650627506285062950630506315063250633506345063550636506375063850639506405064150642506435064450645506465064750648506495065050651506525065350654506555065650657506585065950660506615066250663506645066550666506675066850669506705067150672506735067450675506765067750678506795068050681506825068350684506855068650687506885068950690506915069250693506945069550696506975069850699507005070150702507035070450705507065070750708507095071050711507125071350714507155071650717507185071950720507215072250723507245072550726507275072850729507305073150732507335073450735507365073750738507395074050741507425074350744507455074650747507485074950750507515075250753507545075550756507575075850759507605076150762507635076450765507665076750768507695077050771507725077350774507755077650777507785077950780507815078250783507845078550786507875078850789507905079150792507935079450795507965079750798507995080050801508025080350804508055080650807508085080950810508115081250813508145081550816508175081850819508205082150822508235082450825508265082750828508295083050831508325083350834508355083650837508385083950840508415084250843508445084550846508475084850849508505085150852508535085450855508565085750858508595086050861508625086350864508655086650867508685086950870508715087250873508745087550876508775087850879508805088150882508835088450885508865088750888508895089050891508925089350894508955089650897508985089950900509015090250903509045090550906509075090850909509105091150912509135091450915509165091750918509195092050921509225092350924509255092650927509285092950930509315093250933509345093550936509375093850939509405094150942509435094450945509465094750948509495095050951509525095350954509555095650957509585095950960509615096250963509645096550966509675096850969509705097150972509735097450975509765097750978509795098050981509825098350984509855098650987509885098950990509915099250993509945099550996509975099850999510005100151002510035100451005510065100751008510095101051011510125101351014510155101651017510185101951020510215102251023510245102551026510275102851029510305103151032510335103451035510365103751038510395104051041510425104351044510455104651047510485104951050510515105251053510545105551056510575105851059510605106151062510635106451065510665106751068510695107051071510725107351074510755107651077510785107951080510815108251083510845108551086510875108851089510905109151092510935109451095510965109751098510995110051101511025110351104511055110651107511085110951110511115111251113511145111551116511175111851119511205112151122511235112451125511265112751128511295113051131511325113351134511355113651137511385113951140511415114251143511445114551146511475114851149511505115151152511535115451155511565115751158511595116051161511625116351164511655116651167511685116951170511715117251173511745117551176511775117851179511805118151182511835118451185511865118751188511895119051191511925119351194511955119651197511985119951200512015120251203512045120551206512075120851209512105121151212512135121451215512165121751218512195122051221512225122351224512255122651227512285122951230512315123251233512345123551236512375123851239512405124151242512435124451245512465124751248512495125051251512525125351254512555125651257512585125951260512615126251263512645126551266512675126851269512705127151272512735127451275512765127751278512795128051281512825128351284512855128651287512885128951290512915129251293512945129551296512975129851299513005130151302513035130451305513065130751308513095131051311513125131351314513155131651317513185131951320513215132251323513245132551326513275132851329513305133151332513335133451335513365133751338513395134051341513425134351344513455134651347513485134951350513515135251353513545135551356513575135851359513605136151362513635136451365513665136751368513695137051371513725137351374513755137651377513785137951380513815138251383513845138551386513875138851389513905139151392513935139451395513965139751398513995140051401514025140351404514055140651407514085140951410514115141251413514145141551416514175141851419514205142151422514235142451425514265142751428514295143051431514325143351434514355143651437514385143951440514415144251443514445144551446514475144851449514505145151452514535145451455514565145751458514595146051461514625146351464514655146651467514685146951470514715147251473514745147551476514775147851479514805148151482514835148451485514865148751488514895149051491514925149351494514955149651497514985149951500515015150251503515045150551506515075150851509515105151151512515135151451515515165151751518515195152051521515225152351524515255152651527515285152951530515315153251533515345153551536515375153851539515405154151542515435154451545515465154751548515495155051551515525155351554515555155651557515585155951560515615156251563515645156551566515675156851569515705157151572515735157451575515765157751578515795158051581515825158351584515855158651587515885158951590515915159251593515945159551596515975159851599516005160151602516035160451605516065160751608516095161051611516125161351614516155161651617516185161951620516215162251623516245162551626516275162851629516305163151632516335163451635516365163751638516395164051641516425164351644516455164651647516485164951650516515165251653516545165551656516575165851659516605166151662516635166451665516665166751668516695167051671516725167351674516755167651677516785167951680516815168251683516845168551686516875168851689516905169151692516935169451695516965169751698516995170051701517025170351704517055170651707517085170951710517115171251713517145171551716517175171851719517205172151722517235172451725517265172751728517295173051731517325173351734517355173651737517385173951740517415174251743517445174551746517475174851749517505175151752517535175451755517565175751758517595176051761517625176351764517655176651767517685176951770517715177251773517745177551776517775177851779517805178151782517835178451785517865178751788517895179051791517925179351794517955179651797517985179951800518015180251803518045180551806518075180851809518105181151812518135181451815518165181751818518195182051821518225182351824518255182651827518285182951830518315183251833518345183551836518375183851839518405184151842518435184451845518465184751848518495185051851518525185351854518555185651857518585185951860518615186251863518645186551866518675186851869518705187151872518735187451875518765187751878518795188051881518825188351884518855188651887518885188951890518915189251893518945189551896518975189851899519005190151902519035190451905519065190751908519095191051911519125191351914519155191651917519185191951920519215192251923519245192551926519275192851929519305193151932519335193451935519365193751938519395194051941519425194351944519455194651947519485194951950519515195251953519545195551956519575195851959519605196151962519635196451965519665196751968519695197051971519725197351974519755197651977519785197951980519815198251983519845198551986519875198851989519905199151992519935199451995519965199751998519995200052001520025200352004520055200652007520085200952010520115201252013520145201552016520175201852019520205202152022520235202452025520265202752028520295203052031520325203352034520355203652037520385203952040520415204252043520445204552046520475204852049520505205152052520535205452055520565205752058520595206052061520625206352064520655206652067520685206952070520715207252073520745207552076520775207852079520805208152082520835208452085520865208752088520895209052091520925209352094520955209652097520985209952100521015210252103521045210552106521075210852109521105211152112521135211452115521165211752118521195212052121521225212352124521255212652127521285212952130521315213252133521345213552136521375213852139521405214152142521435214452145521465214752148521495215052151521525215352154521555215652157521585215952160521615216252163521645216552166521675216852169521705217152172521735217452175521765217752178521795218052181521825218352184521855218652187521885218952190521915219252193521945219552196521975219852199522005220152202522035220452205522065220752208522095221052211522125221352214522155221652217522185221952220522215222252223522245222552226522275222852229522305223152232522335223452235522365223752238522395224052241522425224352244522455224652247522485224952250522515225252253522545225552256522575225852259522605226152262522635226452265522665226752268522695227052271522725227352274522755227652277522785227952280522815228252283522845228552286522875228852289522905229152292522935229452295522965229752298522995230052301523025230352304523055230652307523085230952310523115231252313523145231552316523175231852319523205232152322523235232452325523265232752328523295233052331523325233352334523355233652337523385233952340523415234252343523445234552346523475234852349523505235152352523535235452355523565235752358523595236052361523625236352364523655236652367523685236952370523715237252373523745237552376523775237852379523805238152382523835238452385523865238752388523895239052391523925239352394523955239652397523985239952400524015240252403524045240552406524075240852409524105241152412524135241452415524165241752418524195242052421524225242352424524255242652427524285242952430524315243252433524345243552436524375243852439524405244152442524435244452445524465244752448524495245052451524525245352454524555245652457524585245952460524615246252463524645246552466524675246852469524705247152472524735247452475524765247752478524795248052481524825248352484524855248652487524885248952490524915249252493524945249552496524975249852499525005250152502525035250452505525065250752508525095251052511525125251352514525155251652517525185251952520525215252252523525245252552526525275252852529525305253152532525335253452535525365253752538525395254052541525425254352544525455254652547525485254952550525515255252553525545255552556525575255852559525605256152562525635256452565525665256752568525695257052571525725257352574525755257652577525785257952580525815258252583525845258552586525875258852589525905259152592525935259452595525965259752598525995260052601526025260352604526055260652607526085260952610526115261252613526145261552616526175261852619526205262152622526235262452625526265262752628526295263052631526325263352634526355263652637526385263952640526415264252643526445264552646526475264852649526505265152652526535265452655526565265752658526595266052661526625266352664526655266652667526685266952670526715267252673526745267552676526775267852679526805268152682526835268452685526865268752688526895269052691526925269352694526955269652697526985269952700527015270252703527045270552706527075270852709527105271152712527135271452715527165271752718527195272052721527225272352724527255272652727527285272952730527315273252733527345273552736527375273852739527405274152742527435274452745527465274752748527495275052751527525275352754527555275652757527585275952760527615276252763527645276552766527675276852769527705277152772527735277452775527765277752778527795278052781527825278352784527855278652787527885278952790527915279252793527945279552796527975279852799528005280152802528035280452805528065280752808528095281052811528125281352814528155281652817528185281952820528215282252823528245282552826528275282852829528305283152832528335283452835528365283752838528395284052841528425284352844528455284652847528485284952850528515285252853528545285552856528575285852859528605286152862528635286452865528665286752868528695287052871528725287352874528755287652877528785287952880528815288252883528845288552886528875288852889528905289152892528935289452895528965289752898528995290052901529025290352904529055290652907529085290952910529115291252913529145291552916529175291852919529205292152922529235292452925529265292752928529295293052931529325293352934529355293652937529385293952940529415294252943529445294552946529475294852949529505295152952529535295452955529565295752958529595296052961529625296352964529655296652967529685296952970529715297252973529745297552976529775297852979529805298152982529835298452985529865298752988529895299052991529925299352994529955299652997529985299953000530015300253003530045300553006530075300853009530105301153012530135301453015530165301753018530195302053021530225302353024530255302653027530285302953030530315303253033530345303553036530375303853039530405304153042530435304453045530465304753048530495305053051530525305353054530555305653057530585305953060530615306253063530645306553066530675306853069530705307153072530735307453075530765307753078530795308053081530825308353084530855308653087530885308953090530915309253093530945309553096530975309853099531005310153102531035310453105531065310753108531095311053111531125311353114531155311653117531185311953120531215312253123531245312553126531275312853129531305313153132531335313453135531365313753138531395314053141531425314353144531455314653147531485314953150531515315253153531545315553156531575315853159531605316153162531635316453165531665316753168531695317053171531725317353174531755317653177531785317953180531815318253183531845318553186531875318853189531905319153192531935319453195531965319753198531995320053201532025320353204532055320653207532085320953210532115321253213532145321553216532175321853219532205322153222532235322453225532265322753228532295323053231532325323353234532355323653237532385323953240532415324253243532445324553246532475324853249532505325153252532535325453255532565325753258532595326053261532625326353264532655326653267532685326953270532715327253273532745327553276532775327853279532805328153282532835328453285532865328753288532895329053291532925329353294532955329653297532985329953300533015330253303533045330553306533075330853309533105331153312533135331453315533165331753318533195332053321533225332353324533255332653327533285332953330533315333253333533345333553336533375333853339533405334153342533435334453345533465334753348533495335053351533525335353354533555335653357533585335953360533615336253363533645336553366533675336853369533705337153372533735337453375533765337753378533795338053381533825338353384533855338653387533885338953390533915339253393533945339553396533975339853399534005340153402534035340453405534065340753408534095341053411534125341353414534155341653417534185341953420534215342253423534245342553426534275342853429534305343153432534335343453435534365343753438534395344053441534425344353444534455344653447534485344953450534515345253453534545345553456534575345853459534605346153462534635346453465534665346753468534695347053471534725347353474534755347653477534785347953480534815348253483534845348553486534875348853489534905349153492534935349453495534965349753498534995350053501535025350353504535055350653507535085350953510535115351253513535145351553516535175351853519535205352153522535235352453525535265352753528535295353053531535325353353534535355353653537535385353953540535415354253543535445354553546535475354853549535505355153552535535355453555535565355753558535595356053561535625356353564535655356653567535685356953570535715357253573535745357553576535775357853579535805358153582535835358453585535865358753588535895359053591535925359353594535955359653597535985359953600536015360253603536045360553606536075360853609536105361153612536135361453615536165361753618536195362053621536225362353624536255362653627536285362953630536315363253633536345363553636536375363853639536405364153642536435364453645536465364753648536495365053651536525365353654536555365653657536585365953660536615366253663536645366553666536675366853669536705367153672536735367453675536765367753678536795368053681536825368353684536855368653687536885368953690536915369253693536945369553696536975369853699537005370153702537035370453705537065370753708537095371053711537125371353714537155371653717537185371953720537215372253723537245372553726537275372853729537305373153732537335373453735537365373753738537395374053741537425374353744537455374653747537485374953750537515375253753537545375553756537575375853759537605376153762537635376453765537665376753768537695377053771537725377353774537755377653777537785377953780537815378253783537845378553786537875378853789537905379153792537935379453795537965379753798537995380053801538025380353804538055380653807538085380953810538115381253813538145381553816538175381853819538205382153822538235382453825538265382753828538295383053831538325383353834538355383653837538385383953840538415384253843538445384553846538475384853849538505385153852538535385453855538565385753858538595386053861538625386353864538655386653867538685386953870538715387253873538745387553876538775387853879538805388153882538835388453885538865388753888538895389053891538925389353894538955389653897538985389953900539015390253903539045390553906539075390853909539105391153912539135391453915539165391753918539195392053921539225392353924539255392653927539285392953930539315393253933539345393553936539375393853939539405394153942539435394453945539465394753948539495395053951539525395353954539555395653957539585395953960539615396253963539645396553966539675396853969539705397153972539735397453975539765397753978539795398053981539825398353984539855398653987539885398953990539915399253993539945399553996539975399853999540005400154002540035400454005540065400754008540095401054011540125401354014540155401654017540185401954020540215402254023540245402554026540275402854029540305403154032540335403454035540365403754038540395404054041540425404354044540455404654047540485404954050540515405254053540545405554056540575405854059540605406154062540635406454065540665406754068540695407054071540725407354074540755407654077540785407954080540815408254083540845408554086540875408854089540905409154092540935409454095540965409754098540995410054101541025410354104541055410654107541085410954110541115411254113541145411554116541175411854119541205412154122541235412454125541265412754128541295413054131541325413354134541355413654137541385413954140541415414254143541445414554146541475414854149541505415154152541535415454155541565415754158541595416054161541625416354164541655416654167541685416954170541715417254173541745417554176541775417854179541805418154182541835418454185541865418754188541895419054191541925419354194541955419654197541985419954200542015420254203542045420554206542075420854209542105421154212542135421454215542165421754218542195422054221542225422354224542255422654227542285422954230542315423254233542345423554236542375423854239542405424154242542435424454245542465424754248542495425054251542525425354254542555425654257542585425954260542615426254263542645426554266542675426854269542705427154272542735427454275542765427754278542795428054281542825428354284542855428654287542885428954290542915429254293542945429554296542975429854299543005430154302543035430454305543065430754308543095431054311543125431354314543155431654317543185431954320543215432254323543245432554326543275432854329543305433154332543335433454335543365433754338543395434054341543425434354344543455434654347543485434954350543515435254353543545435554356543575435854359543605436154362543635436454365543665436754368543695437054371543725437354374543755437654377543785437954380543815438254383543845438554386543875438854389543905439154392543935439454395543965439754398543995440054401544025440354404544055440654407544085440954410544115441254413544145441554416544175441854419544205442154422544235442454425544265442754428544295443054431544325443354434544355443654437544385443954440544415444254443544445444554446544475444854449544505445154452544535445454455544565445754458544595446054461544625446354464544655446654467544685446954470544715447254473544745447554476544775447854479544805448154482544835448454485544865448754488544895449054491544925449354494544955449654497544985449954500545015450254503545045450554506545075450854509545105451154512545135451454515545165451754518545195452054521545225452354524545255452654527545285452954530545315453254533545345453554536545375453854539545405454154542545435454454545545465454754548545495455054551545525455354554545555455654557545585455954560545615456254563545645456554566545675456854569545705457154572545735457454575545765457754578545795458054581545825458354584545855458654587545885458954590545915459254593545945459554596545975459854599546005460154602546035460454605546065460754608546095461054611546125461354614546155461654617546185461954620546215462254623546245462554626546275462854629546305463154632546335463454635546365463754638546395464054641546425464354644546455464654647546485464954650546515465254653546545465554656546575465854659546605466154662546635466454665546665466754668546695467054671546725467354674546755467654677546785467954680546815468254683546845468554686546875468854689546905469154692546935469454695546965469754698546995470054701547025470354704547055470654707547085470954710547115471254713547145471554716547175471854719547205472154722547235472454725547265472754728547295473054731547325473354734547355473654737547385473954740547415474254743547445474554746547475474854749547505475154752547535475454755547565475754758547595476054761547625476354764547655476654767547685476954770547715477254773547745477554776547775477854779547805478154782547835478454785547865478754788547895479054791547925479354794547955479654797547985479954800548015480254803548045480554806548075480854809548105481154812548135481454815548165481754818548195482054821548225482354824548255482654827548285482954830548315483254833548345483554836548375483854839548405484154842548435484454845548465484754848548495485054851548525485354854548555485654857548585485954860548615486254863548645486554866548675486854869548705487154872548735487454875548765487754878548795488054881548825488354884548855488654887548885488954890548915489254893548945489554896548975489854899549005490154902549035490454905549065490754908549095491054911549125491354914549155491654917549185491954920549215492254923549245492554926549275492854929549305493154932549335493454935549365493754938549395494054941549425494354944549455494654947549485494954950549515495254953549545495554956549575495854959549605496154962549635496454965549665496754968549695497054971549725497354974549755497654977549785497954980549815498254983549845498554986549875498854989549905499154992549935499454995549965499754998549995500055001550025500355004550055500655007550085500955010550115501255013550145501555016550175501855019550205502155022550235502455025550265502755028550295503055031550325503355034550355503655037550385503955040550415504255043550445504555046550475504855049550505505155052550535505455055550565505755058550595506055061550625506355064550655506655067550685506955070550715507255073550745507555076550775507855079550805508155082550835508455085550865508755088550895509055091550925509355094550955509655097550985509955100551015510255103551045510555106551075510855109551105511155112551135511455115551165511755118551195512055121551225512355124551255512655127551285512955130551315513255133551345513555136551375513855139551405514155142551435514455145551465514755148551495515055151551525515355154551555515655157551585515955160551615516255163551645516555166551675516855169551705517155172551735517455175551765517755178551795518055181551825518355184551855518655187551885518955190551915519255193551945519555196551975519855199552005520155202552035520455205552065520755208552095521055211552125521355214552155521655217552185521955220552215522255223552245522555226552275522855229552305523155232552335523455235552365523755238552395524055241552425524355244552455524655247552485524955250552515525255253552545525555256552575525855259552605526155262552635526455265552665526755268552695527055271552725527355274552755527655277552785527955280552815528255283552845528555286552875528855289552905529155292552935529455295552965529755298552995530055301553025530355304553055530655307553085530955310553115531255313553145531555316553175531855319553205532155322553235532455325553265532755328553295533055331553325533355334553355533655337553385533955340553415534255343553445534555346553475534855349553505535155352553535535455355553565535755358553595536055361553625536355364553655536655367553685536955370553715537255373553745537555376553775537855379553805538155382553835538455385553865538755388553895539055391553925539355394553955539655397553985539955400554015540255403554045540555406554075540855409554105541155412554135541455415554165541755418554195542055421554225542355424554255542655427554285542955430554315543255433554345543555436554375543855439554405544155442554435544455445554465544755448554495545055451554525545355454554555545655457554585545955460554615546255463554645546555466554675546855469554705547155472554735547455475554765547755478554795548055481554825548355484554855548655487554885548955490554915549255493554945549555496554975549855499555005550155502555035550455505555065550755508555095551055511555125551355514555155551655517555185551955520555215552255523555245552555526555275552855529555305553155532555335553455535555365553755538555395554055541555425554355544555455554655547555485554955550555515555255553555545555555556555575555855559555605556155562555635556455565555665556755568555695557055571555725557355574555755557655577555785557955580555815558255583555845558555586555875558855589555905559155592555935559455595555965559755598555995560055601556025560355604556055560655607556085560955610556115561255613556145561555616556175561855619556205562155622556235562455625556265562755628556295563055631556325563355634556355563655637556385563955640556415564255643556445564555646556475564855649556505565155652556535565455655556565565755658556595566055661556625566355664556655566655667556685566955670556715567255673556745567555676556775567855679556805568155682556835568455685556865568755688556895569055691556925569355694556955569655697556985569955700557015570255703557045570555706557075570855709557105571155712557135571455715557165571755718557195572055721557225572355724557255572655727557285572955730557315573255733557345573555736557375573855739557405574155742557435574455745557465574755748557495575055751557525575355754557555575655757557585575955760557615576255763557645576555766557675576855769557705577155772557735577455775557765577755778557795578055781557825578355784557855578655787557885578955790557915579255793557945579555796557975579855799558005580155802558035580455805558065580755808558095581055811558125581355814558155581655817558185581955820558215582255823558245582555826558275582855829558305583155832558335583455835558365583755838558395584055841558425584355844558455584655847558485584955850558515585255853558545585555856558575585855859558605586155862558635586455865558665586755868558695587055871558725587355874558755587655877558785587955880558815588255883558845588555886558875588855889558905589155892558935589455895558965589755898558995590055901559025590355904559055590655907559085590955910559115591255913559145591555916559175591855919559205592155922559235592455925559265592755928559295593055931559325593355934559355593655937559385593955940559415594255943559445594555946559475594855949559505595155952559535595455955559565595755958559595596055961559625596355964559655596655967559685596955970559715597255973559745597555976559775597855979559805598155982559835598455985559865598755988559895599055991559925599355994559955599655997559985599956000560015600256003560045600556006560075600856009560105601156012560135601456015560165601756018560195602056021560225602356024560255602656027560285602956030560315603256033560345603556036560375603856039560405604156042560435604456045560465604756048560495605056051560525605356054560555605656057560585605956060560615606256063560645606556066560675606856069560705607156072560735607456075560765607756078560795608056081560825608356084560855608656087560885608956090560915609256093560945609556096560975609856099561005610156102561035610456105561065610756108561095611056111561125611356114561155611656117561185611956120561215612256123561245612556126561275612856129561305613156132561335613456135561365613756138561395614056141561425614356144561455614656147561485614956150561515615256153561545615556156561575615856159561605616156162561635616456165561665616756168561695617056171561725617356174561755617656177561785617956180561815618256183561845618556186561875618856189561905619156192561935619456195561965619756198561995620056201562025620356204562055620656207562085620956210562115621256213562145621556216562175621856219562205622156222562235622456225562265622756228562295623056231562325623356234562355623656237562385623956240562415624256243562445624556246562475624856249562505625156252562535625456255562565625756258562595626056261562625626356264562655626656267562685626956270562715627256273562745627556276562775627856279562805628156282562835628456285562865628756288562895629056291562925629356294562955629656297562985629956300563015630256303563045630556306563075630856309563105631156312563135631456315563165631756318563195632056321563225632356324563255632656327563285632956330563315633256333563345633556336563375633856339563405634156342563435634456345563465634756348563495635056351563525635356354563555635656357563585635956360563615636256363563645636556366563675636856369563705637156372563735637456375563765637756378563795638056381563825638356384563855638656387563885638956390563915639256393563945639556396563975639856399564005640156402564035640456405564065640756408564095641056411564125641356414564155641656417564185641956420564215642256423564245642556426564275642856429564305643156432564335643456435564365643756438564395644056441564425644356444564455644656447564485644956450564515645256453564545645556456564575645856459564605646156462564635646456465564665646756468564695647056471564725647356474564755647656477564785647956480564815648256483564845648556486564875648856489564905649156492564935649456495564965649756498564995650056501565025650356504565055650656507565085650956510565115651256513565145651556516565175651856519565205652156522565235652456525565265652756528565295653056531565325653356534565355653656537565385653956540565415654256543565445654556546565475654856549565505655156552565535655456555565565655756558565595656056561565625656356564565655656656567565685656956570565715657256573565745657556576565775657856579565805658156582565835658456585565865658756588565895659056591565925659356594565955659656597565985659956600566015660256603566045660556606566075660856609566105661156612566135661456615566165661756618566195662056621566225662356624566255662656627566285662956630566315663256633566345663556636566375663856639566405664156642566435664456645566465664756648566495665056651566525665356654566555665656657566585665956660566615666256663566645666556666566675666856669566705667156672566735667456675566765667756678566795668056681566825668356684566855668656687566885668956690566915669256693566945669556696566975669856699567005670156702567035670456705567065670756708567095671056711567125671356714567155671656717567185671956720567215672256723567245672556726567275672856729567305673156732567335673456735567365673756738567395674056741567425674356744567455674656747567485674956750567515675256753567545675556756567575675856759567605676156762567635676456765567665676756768567695677056771567725677356774567755677656777567785677956780567815678256783567845678556786567875678856789567905679156792567935679456795567965679756798567995680056801568025680356804568055680656807568085680956810568115681256813568145681556816568175681856819568205682156822568235682456825568265682756828568295683056831568325683356834568355683656837568385683956840568415684256843568445684556846568475684856849568505685156852568535685456855568565685756858568595686056861568625686356864568655686656867568685686956870568715687256873568745687556876568775687856879568805688156882568835688456885568865688756888568895689056891568925689356894568955689656897568985689956900569015690256903569045690556906569075690856909569105691156912569135691456915569165691756918569195692056921569225692356924569255692656927569285692956930569315693256933569345693556936569375693856939569405694156942569435694456945569465694756948569495695056951569525695356954569555695656957569585695956960569615696256963569645696556966569675696856969569705697156972569735697456975569765697756978569795698056981569825698356984569855698656987569885698956990569915699256993569945699556996569975699856999570005700157002570035700457005570065700757008570095701057011570125701357014570155701657017570185701957020570215702257023570245702557026570275702857029570305703157032570335703457035570365703757038570395704057041570425704357044570455704657047570485704957050570515705257053570545705557056570575705857059570605706157062570635706457065570665706757068570695707057071570725707357074570755707657077570785707957080570815708257083570845708557086570875708857089570905709157092570935709457095570965709757098570995710057101571025710357104571055710657107571085710957110571115711257113571145711557116571175711857119571205712157122571235712457125571265712757128571295713057131571325713357134571355713657137571385713957140571415714257143571445714557146571475714857149571505715157152571535715457155571565715757158571595716057161571625716357164571655716657167571685716957170571715717257173571745717557176571775717857179571805718157182571835718457185571865718757188571895719057191571925719357194571955719657197571985719957200572015720257203572045720557206572075720857209572105721157212572135721457215572165721757218572195722057221572225722357224572255722657227572285722957230572315723257233572345723557236572375723857239572405724157242572435724457245572465724757248572495725057251572525725357254572555725657257572585725957260572615726257263572645726557266572675726857269572705727157272572735727457275572765727757278572795728057281572825728357284572855728657287572885728957290572915729257293572945729557296572975729857299573005730157302573035730457305573065730757308573095731057311573125731357314573155731657317573185731957320573215732257323573245732557326573275732857329573305733157332573335733457335573365733757338573395734057341573425734357344573455734657347573485734957350573515735257353573545735557356573575735857359573605736157362573635736457365573665736757368573695737057371573725737357374573755737657377573785737957380573815738257383573845738557386573875738857389573905739157392573935739457395573965739757398573995740057401574025740357404574055740657407574085740957410574115741257413574145741557416574175741857419574205742157422574235742457425574265742757428574295743057431574325743357434574355743657437574385743957440574415744257443574445744557446574475744857449574505745157452574535745457455574565745757458574595746057461574625746357464574655746657467574685746957470574715747257473574745747557476574775747857479574805748157482574835748457485574865748757488574895749057491574925749357494574955749657497574985749957500575015750257503575045750557506575075750857509575105751157512575135751457515575165751757518575195752057521575225752357524575255752657527575285752957530575315753257533575345753557536575375753857539575405754157542575435754457545575465754757548575495755057551575525755357554575555755657557575585755957560575615756257563575645756557566575675756857569575705757157572575735757457575575765757757578575795758057581575825758357584575855758657587575885758957590575915759257593575945759557596575975759857599576005760157602576035760457605576065760757608576095761057611576125761357614576155761657617576185761957620576215762257623576245762557626576275762857629576305763157632576335763457635576365763757638576395764057641576425764357644576455764657647576485764957650576515765257653576545765557656576575765857659576605766157662576635766457665576665766757668576695767057671576725767357674576755767657677576785767957680576815768257683576845768557686576875768857689576905769157692576935769457695576965769757698576995770057701577025770357704577055770657707577085770957710577115771257713577145771557716577175771857719577205772157722577235772457725577265772757728577295773057731577325773357734577355773657737577385773957740577415774257743577445774557746577475774857749577505775157752577535775457755577565775757758577595776057761577625776357764577655776657767577685776957770577715777257773577745777557776577775777857779577805778157782577835778457785577865778757788577895779057791577925779357794577955779657797577985779957800578015780257803578045780557806578075780857809578105781157812578135781457815578165781757818578195782057821578225782357824578255782657827578285782957830578315783257833578345783557836578375783857839578405784157842578435784457845578465784757848578495785057851578525785357854578555785657857578585785957860578615786257863578645786557866578675786857869578705787157872578735787457875578765787757878578795788057881578825788357884578855788657887578885788957890578915789257893578945789557896578975789857899579005790157902579035790457905579065790757908579095791057911579125791357914579155791657917579185791957920579215792257923579245792557926579275792857929579305793157932579335793457935579365793757938579395794057941579425794357944579455794657947579485794957950579515795257953579545795557956579575795857959579605796157962579635796457965579665796757968579695797057971579725797357974579755797657977579785797957980579815798257983579845798557986579875798857989579905799157992579935799457995579965799757998579995800058001580025800358004580055800658007580085800958010580115801258013580145801558016580175801858019580205802158022580235802458025580265802758028580295803058031580325803358034580355803658037580385803958040580415804258043580445804558046580475804858049580505805158052580535805458055580565805758058580595806058061580625806358064580655806658067580685806958070580715807258073580745807558076580775807858079580805808158082580835808458085580865808758088580895809058091580925809358094580955809658097580985809958100581015810258103581045810558106581075810858109581105811158112581135811458115581165811758118581195812058121581225812358124581255812658127581285812958130581315813258133581345813558136581375813858139581405814158142581435814458145581465814758148581495815058151581525815358154581555815658157581585815958160581615816258163581645816558166581675816858169581705817158172581735817458175581765817758178581795818058181581825818358184581855818658187581885818958190581915819258193581945819558196581975819858199582005820158202582035820458205582065820758208582095821058211582125821358214582155821658217582185821958220582215822258223582245822558226582275822858229582305823158232582335823458235582365823758238582395824058241582425824358244582455824658247582485824958250582515825258253582545825558256582575825858259582605826158262582635826458265582665826758268582695827058271582725827358274582755827658277582785827958280582815828258283582845828558286582875828858289582905829158292582935829458295582965829758298582995830058301583025830358304583055830658307583085830958310583115831258313583145831558316583175831858319583205832158322583235832458325583265832758328583295833058331583325833358334583355833658337583385833958340583415834258343583445834558346583475834858349583505835158352583535835458355583565835758358583595836058361583625836358364583655836658367583685836958370583715837258373583745837558376583775837858379583805838158382583835838458385583865838758388583895839058391583925839358394583955839658397583985839958400584015840258403584045840558406584075840858409584105841158412584135841458415584165841758418584195842058421584225842358424584255842658427584285842958430584315843258433584345843558436584375843858439584405844158442584435844458445584465844758448584495845058451584525845358454584555845658457584585845958460584615846258463584645846558466584675846858469584705847158472584735847458475584765847758478584795848058481584825848358484584855848658487584885848958490584915849258493584945849558496584975849858499585005850158502585035850458505585065850758508585095851058511585125851358514585155851658517585185851958520585215852258523585245852558526585275852858529585305853158532585335853458535585365853758538585395854058541585425854358544585455854658547585485854958550585515855258553585545855558556585575855858559585605856158562585635856458565585665856758568585695857058571585725857358574585755857658577585785857958580585815858258583585845858558586585875858858589585905859158592585935859458595585965859758598585995860058601586025860358604586055860658607586085860958610586115861258613586145861558616586175861858619586205862158622586235862458625586265862758628586295863058631586325863358634586355863658637586385863958640586415864258643586445864558646586475864858649586505865158652586535865458655586565865758658586595866058661586625866358664586655866658667586685866958670586715867258673586745867558676586775867858679586805868158682586835868458685586865868758688586895869058691586925869358694586955869658697586985869958700587015870258703587045870558706587075870858709587105871158712587135871458715587165871758718587195872058721587225872358724587255872658727587285872958730587315873258733587345873558736587375873858739587405874158742587435874458745587465874758748587495875058751587525875358754587555875658757587585875958760587615876258763587645876558766587675876858769587705877158772587735877458775587765877758778587795878058781587825878358784587855878658787587885878958790587915879258793587945879558796587975879858799588005880158802588035880458805588065880758808588095881058811588125881358814588155881658817588185881958820588215882258823588245882558826588275882858829588305883158832588335883458835588365883758838588395884058841588425884358844588455884658847588485884958850588515885258853588545885558856588575885858859588605886158862588635886458865588665886758868588695887058871588725887358874588755887658877588785887958880588815888258883588845888558886588875888858889588905889158892588935889458895588965889758898588995890058901589025890358904589055890658907589085890958910589115891258913589145891558916589175891858919589205892158922589235892458925589265892758928589295893058931589325893358934589355893658937589385893958940589415894258943589445894558946589475894858949589505895158952589535895458955589565895758958589595896058961589625896358964589655896658967589685896958970589715897258973589745897558976589775897858979589805898158982589835898458985589865898758988589895899058991589925899358994589955899658997589985899959000590015900259003590045900559006590075900859009590105901159012590135901459015590165901759018590195902059021590225902359024590255902659027590285902959030590315903259033590345903559036590375903859039590405904159042590435904459045590465904759048590495905059051590525905359054590555905659057590585905959060590615906259063590645906559066590675906859069590705907159072590735907459075590765907759078590795908059081590825908359084590855908659087590885908959090590915909259093590945909559096590975909859099591005910159102591035910459105591065910759108591095911059111591125911359114591155911659117591185911959120591215912259123591245912559126591275912859129591305913159132591335913459135591365913759138591395914059141591425914359144591455914659147591485914959150591515915259153591545915559156591575915859159591605916159162591635916459165591665916759168591695917059171591725917359174591755917659177591785917959180591815918259183591845918559186591875918859189591905919159192591935919459195591965919759198591995920059201592025920359204592055920659207592085920959210592115921259213592145921559216592175921859219592205922159222592235922459225592265922759228592295923059231592325923359234592355923659237592385923959240592415924259243592445924559246592475924859249592505925159252592535925459255592565925759258592595926059261592625926359264592655926659267592685926959270592715927259273592745927559276592775927859279592805928159282592835928459285592865928759288592895929059291592925929359294592955929659297592985929959300593015930259303593045930559306593075930859309593105931159312593135931459315593165931759318593195932059321593225932359324593255932659327593285932959330593315933259333593345933559336593375933859339593405934159342593435934459345593465934759348593495935059351593525935359354593555935659357593585935959360593615936259363593645936559366593675936859369593705937159372593735937459375593765937759378593795938059381593825938359384593855938659387593885938959390593915939259393593945939559396593975939859399594005940159402594035940459405594065940759408594095941059411594125941359414594155941659417594185941959420594215942259423594245942559426594275942859429594305943159432594335943459435594365943759438594395944059441594425944359444594455944659447594485944959450594515945259453594545945559456594575945859459594605946159462594635946459465594665946759468594695947059471594725947359474594755947659477594785947959480594815948259483594845948559486594875948859489594905949159492594935949459495594965949759498594995950059501595025950359504595055950659507595085950959510595115951259513595145951559516595175951859519595205952159522595235952459525595265952759528595295953059531595325953359534595355953659537595385953959540595415954259543595445954559546595475954859549595505955159552595535955459555595565955759558595595956059561595625956359564595655956659567595685956959570595715957259573595745957559576595775957859579595805958159582595835958459585595865958759588595895959059591595925959359594595955959659597595985959959600596015960259603596045960559606596075960859609596105961159612596135961459615596165961759618596195962059621596225962359624596255962659627596285962959630596315963259633596345963559636596375963859639596405964159642596435964459645596465964759648596495965059651596525965359654596555965659657596585965959660596615966259663596645966559666596675966859669596705967159672596735967459675596765967759678596795968059681596825968359684596855968659687596885968959690596915969259693596945969559696596975969859699597005970159702597035970459705597065970759708597095971059711597125971359714597155971659717597185971959720597215972259723597245972559726597275972859729597305973159732597335973459735597365973759738597395974059741597425974359744597455974659747597485974959750597515975259753597545975559756597575975859759597605976159762597635976459765597665976759768597695977059771597725977359774597755977659777597785977959780597815978259783597845978559786597875978859789597905979159792597935979459795597965979759798597995980059801598025980359804598055980659807598085980959810598115981259813598145981559816598175981859819598205982159822598235982459825598265982759828598295983059831598325983359834598355983659837598385983959840598415984259843598445984559846598475984859849598505985159852598535985459855598565985759858598595986059861598625986359864598655986659867598685986959870598715987259873598745987559876598775987859879598805988159882598835988459885598865988759888598895989059891598925989359894598955989659897598985989959900599015990259903599045990559906599075990859909599105991159912599135991459915599165991759918599195992059921599225992359924599255992659927599285992959930599315993259933599345993559936599375993859939599405994159942599435994459945599465994759948599495995059951599525995359954599555995659957599585995959960599615996259963599645996559966599675996859969599705997159972599735997459975599765997759978599795998059981599825998359984599855998659987599885998959990599915999259993599945999559996599975999859999600006000160002600036000460005600066000760008600096001060011600126001360014600156001660017600186001960020600216002260023600246002560026600276002860029600306003160032600336003460035600366003760038600396004060041600426004360044600456004660047600486004960050600516005260053600546005560056600576005860059600606006160062600636006460065600666006760068600696007060071600726007360074600756007660077600786007960080600816008260083600846008560086600876008860089600906009160092600936009460095600966009760098600996010060101601026010360104601056010660107601086010960110601116011260113601146011560116601176011860119601206012160122601236012460125601266012760128601296013060131601326013360134601356013660137601386013960140601416014260143601446014560146601476014860149601506015160152601536015460155601566015760158601596016060161601626016360164601656016660167601686016960170601716017260173601746017560176601776017860179601806018160182601836018460185601866018760188601896019060191601926019360194601956019660197601986019960200602016020260203602046020560206602076020860209602106021160212602136021460215602166021760218602196022060221602226022360224602256022660227602286022960230602316023260233602346023560236602376023860239602406024160242602436024460245602466024760248602496025060251602526025360254602556025660257602586025960260602616026260263602646026560266602676026860269602706027160272602736027460275602766027760278602796028060281602826028360284602856028660287602886028960290602916029260293602946029560296602976029860299603006030160302603036030460305603066030760308603096031060311603126031360314603156031660317603186031960320603216032260323603246032560326603276032860329603306033160332603336033460335603366033760338603396034060341603426034360344603456034660347603486034960350603516035260353603546035560356603576035860359603606036160362603636036460365603666036760368603696037060371603726037360374603756037660377603786037960380603816038260383603846038560386603876038860389603906039160392603936039460395603966039760398603996040060401604026040360404604056040660407604086040960410604116041260413604146041560416604176041860419604206042160422604236042460425604266042760428604296043060431604326043360434604356043660437604386043960440604416044260443604446044560446604476044860449604506045160452604536045460455604566045760458604596046060461604626046360464604656046660467604686046960470604716047260473604746047560476604776047860479604806048160482604836048460485604866048760488604896049060491604926049360494604956049660497604986049960500605016050260503605046050560506605076050860509605106051160512605136051460515605166051760518605196052060521605226052360524605256052660527605286052960530605316053260533605346053560536605376053860539605406054160542605436054460545605466054760548605496055060551605526055360554605556055660557605586055960560605616056260563605646056560566605676056860569605706057160572605736057460575605766057760578605796058060581605826058360584605856058660587605886058960590605916059260593605946059560596605976059860599606006060160602606036060460605606066060760608606096061060611606126061360614606156061660617606186061960620606216062260623606246062560626606276062860629606306063160632606336063460635606366063760638606396064060641606426064360644606456064660647606486064960650606516065260653606546065560656606576065860659606606066160662606636066460665606666066760668606696067060671606726067360674606756067660677606786067960680606816068260683606846068560686606876068860689606906069160692606936069460695606966069760698606996070060701607026070360704607056070660707607086070960710607116071260713607146071560716607176071860719607206072160722607236072460725607266072760728607296073060731607326073360734607356073660737607386073960740607416074260743607446074560746607476074860749607506075160752607536075460755607566075760758607596076060761607626076360764607656076660767607686076960770607716077260773607746077560776607776077860779607806078160782607836078460785607866078760788607896079060791607926079360794607956079660797607986079960800608016080260803608046080560806608076080860809608106081160812608136081460815608166081760818608196082060821608226082360824608256082660827608286082960830608316083260833608346083560836608376083860839608406084160842608436084460845608466084760848608496085060851608526085360854608556085660857608586085960860608616086260863608646086560866608676086860869608706087160872608736087460875608766087760878608796088060881608826088360884608856088660887608886088960890608916089260893608946089560896608976089860899609006090160902609036090460905609066090760908609096091060911609126091360914609156091660917609186091960920609216092260923609246092560926609276092860929609306093160932609336093460935609366093760938609396094060941609426094360944609456094660947609486094960950609516095260953609546095560956609576095860959609606096160962609636096460965609666096760968609696097060971609726097360974609756097660977609786097960980609816098260983609846098560986609876098860989609906099160992609936099460995609966099760998609996100061001610026100361004610056100661007610086100961010610116101261013610146101561016610176101861019610206102161022610236102461025610266102761028610296103061031610326103361034610356103661037610386103961040610416104261043610446104561046610476104861049610506105161052610536105461055610566105761058610596106061061610626106361064610656106661067610686106961070610716107261073610746107561076610776107861079610806108161082610836108461085610866108761088610896109061091610926109361094610956109661097610986109961100611016110261103611046110561106611076110861109611106111161112611136111461115611166111761118611196112061121611226112361124611256112661127611286112961130611316113261133611346113561136611376113861139611406114161142611436114461145611466114761148611496115061151611526115361154611556115661157611586115961160611616116261163611646116561166611676116861169611706117161172611736117461175611766117761178611796118061181611826118361184611856118661187611886118961190611916119261193611946119561196611976119861199612006120161202612036120461205612066120761208612096121061211612126121361214612156121661217612186121961220612216122261223612246122561226612276122861229612306123161232612336123461235612366123761238612396124061241612426124361244612456124661247612486124961250612516125261253612546125561256612576125861259612606126161262612636126461265612666126761268612696127061271612726127361274612756127661277612786127961280612816128261283612846128561286612876128861289612906129161292612936129461295612966129761298612996130061301613026130361304613056130661307613086130961310613116131261313613146131561316613176131861319613206132161322613236132461325613266132761328613296133061331613326133361334613356133661337613386133961340613416134261343613446134561346613476134861349613506135161352613536135461355613566135761358613596136061361613626136361364613656136661367613686136961370613716137261373613746137561376613776137861379613806138161382613836138461385613866138761388613896139061391613926139361394613956139661397613986139961400614016140261403614046140561406614076140861409614106141161412614136141461415614166141761418614196142061421614226142361424614256142661427614286142961430614316143261433614346143561436614376143861439614406144161442614436144461445614466144761448614496145061451614526145361454614556145661457614586145961460614616146261463614646146561466614676146861469614706147161472614736147461475614766147761478614796148061481614826148361484614856148661487614886148961490614916149261493614946149561496614976149861499615006150161502615036150461505615066150761508615096151061511615126151361514615156151661517615186151961520615216152261523615246152561526615276152861529615306153161532615336153461535615366153761538615396154061541615426154361544615456154661547615486154961550615516155261553615546155561556615576155861559615606156161562615636156461565615666156761568615696157061571615726157361574615756157661577615786157961580615816158261583615846158561586615876158861589615906159161592615936159461595615966159761598615996160061601616026160361604616056160661607616086160961610616116161261613616146161561616616176161861619616206162161622616236162461625616266162761628616296163061631616326163361634616356163661637616386163961640616416164261643616446164561646616476164861649616506165161652616536165461655616566165761658616596166061661616626166361664616656166661667616686166961670616716167261673616746167561676616776167861679616806168161682616836168461685616866168761688616896169061691616926169361694616956169661697616986169961700617016170261703617046170561706617076170861709617106171161712617136171461715617166171761718617196172061721617226172361724617256172661727617286172961730617316173261733617346173561736617376173861739617406174161742617436174461745617466174761748617496175061751617526175361754617556175661757617586175961760617616176261763617646176561766617676176861769617706177161772617736177461775617766177761778617796178061781617826178361784617856178661787617886178961790617916179261793617946179561796617976179861799618006180161802618036180461805618066180761808618096181061811618126181361814618156181661817618186181961820618216182261823618246182561826618276182861829618306183161832618336183461835618366183761838618396184061841618426184361844618456184661847618486184961850618516185261853618546185561856618576185861859618606186161862618636186461865618666186761868618696187061871618726187361874618756187661877618786187961880618816188261883618846188561886618876188861889618906189161892618936189461895618966189761898618996190061901619026190361904619056190661907619086190961910619116191261913619146191561916619176191861919619206192161922619236192461925619266192761928619296193061931619326193361934619356193661937619386193961940619416194261943619446194561946619476194861949619506195161952619536195461955619566195761958619596196061961619626196361964619656196661967619686196961970619716197261973619746197561976619776197861979619806198161982619836198461985619866198761988619896199061991619926199361994619956199661997619986199962000620016200262003620046200562006620076200862009620106201162012620136201462015620166201762018620196202062021620226202362024620256202662027620286202962030620316203262033620346203562036620376203862039620406204162042620436204462045620466204762048620496205062051620526205362054620556205662057620586205962060620616206262063620646206562066620676206862069620706207162072620736207462075620766207762078620796208062081620826208362084620856208662087620886208962090620916209262093620946209562096620976209862099621006210162102621036210462105621066210762108621096211062111621126211362114621156211662117621186211962120621216212262123621246212562126621276212862129621306213162132621336213462135621366213762138621396214062141621426214362144621456214662147621486214962150621516215262153621546215562156621576215862159621606216162162621636216462165621666216762168621696217062171621726217362174621756217662177621786217962180621816218262183621846218562186621876218862189621906219162192621936219462195621966219762198621996220062201622026220362204622056220662207622086220962210622116221262213622146221562216622176221862219622206222162222622236222462225622266222762228622296223062231622326223362234622356223662237622386223962240622416224262243622446224562246622476224862249622506225162252622536225462255622566225762258622596226062261622626226362264622656226662267622686226962270622716227262273622746227562276622776227862279622806228162282622836228462285622866228762288622896229062291622926229362294622956229662297622986229962300623016230262303623046230562306623076230862309623106231162312623136231462315623166231762318623196232062321623226232362324623256232662327623286232962330623316233262333623346233562336623376233862339623406234162342623436234462345623466234762348623496235062351623526235362354623556235662357623586235962360623616236262363623646236562366623676236862369623706237162372623736237462375623766237762378623796238062381623826238362384623856238662387623886238962390623916239262393623946239562396623976239862399624006240162402624036240462405624066240762408624096241062411624126241362414624156241662417624186241962420624216242262423624246242562426624276242862429624306243162432624336243462435624366243762438624396244062441624426244362444624456244662447624486244962450624516245262453624546245562456624576245862459624606246162462624636246462465624666246762468624696247062471624726247362474624756247662477624786247962480624816248262483624846248562486624876248862489624906249162492624936249462495624966249762498624996250062501625026250362504625056250662507625086250962510625116251262513625146251562516625176251862519625206252162522625236252462525625266252762528625296253062531625326253362534625356253662537625386253962540625416254262543625446254562546625476254862549625506255162552625536255462555625566255762558625596256062561625626256362564625656256662567625686256962570625716257262573625746257562576625776257862579625806258162582625836258462585625866258762588625896259062591625926259362594625956259662597625986259962600626016260262603626046260562606626076260862609626106261162612626136261462615626166261762618626196262062621626226262362624626256262662627626286262962630626316263262633626346263562636626376263862639626406264162642626436264462645626466264762648626496265062651626526265362654626556265662657626586265962660626616266262663626646266562666626676266862669626706267162672626736267462675626766267762678626796268062681626826268362684626856268662687626886268962690626916269262693626946269562696626976269862699627006270162702627036270462705627066270762708627096271062711627126271362714627156271662717627186271962720627216272262723627246272562726627276272862729627306273162732627336273462735627366273762738627396274062741627426274362744627456274662747627486274962750627516275262753627546275562756627576275862759627606276162762627636276462765627666276762768627696277062771627726277362774627756277662777627786277962780627816278262783627846278562786627876278862789627906279162792627936279462795627966279762798627996280062801628026280362804628056280662807628086280962810628116281262813628146281562816628176281862819628206282162822628236282462825628266282762828628296283062831628326283362834628356283662837628386283962840628416284262843628446284562846628476284862849628506285162852628536285462855628566285762858628596286062861628626286362864628656286662867628686286962870628716287262873628746287562876628776287862879628806288162882628836288462885628866288762888628896289062891628926289362894628956289662897628986289962900629016290262903629046290562906629076290862909629106291162912629136291462915629166291762918629196292062921629226292362924629256292662927629286292962930629316293262933629346293562936629376293862939629406294162942629436294462945629466294762948629496295062951629526295362954629556295662957629586295962960629616296262963629646296562966629676296862969629706297162972629736297462975629766297762978629796298062981629826298362984629856298662987629886298962990629916299262993629946299562996629976299862999630006300163002630036300463005630066300763008630096301063011630126301363014630156301663017630186301963020630216302263023630246302563026630276302863029630306303163032630336303463035630366303763038630396304063041630426304363044630456304663047630486304963050630516305263053630546305563056630576305863059630606306163062630636306463065630666306763068630696307063071630726307363074630756307663077630786307963080630816308263083630846308563086630876308863089630906309163092630936309463095630966309763098630996310063101631026310363104631056310663107631086310963110631116311263113631146311563116631176311863119631206312163122631236312463125631266312763128631296313063131631326313363134631356313663137631386313963140631416314263143631446314563146631476314863149631506315163152631536315463155631566315763158631596316063161631626316363164631656316663167631686316963170631716317263173631746317563176631776317863179631806318163182631836318463185631866318763188631896319063191631926319363194631956319663197631986319963200632016320263203632046320563206632076320863209632106321163212632136321463215632166321763218632196322063221632226322363224632256322663227632286322963230632316323263233632346323563236632376323863239632406324163242632436324463245632466324763248632496325063251632526325363254632556325663257632586325963260632616326263263632646326563266632676326863269632706327163272632736327463275632766327763278632796328063281632826328363284632856328663287632886328963290632916329263293632946329563296632976329863299633006330163302633036330463305633066330763308633096331063311633126331363314633156331663317633186331963320633216332263323633246332563326633276332863329633306333163332633336333463335633366333763338633396334063341633426334363344633456334663347633486334963350633516335263353633546335563356633576335863359633606336163362633636336463365633666336763368633696337063371633726337363374633756337663377633786337963380633816338263383633846338563386633876338863389633906339163392633936339463395633966339763398633996340063401634026340363404634056340663407634086340963410634116341263413634146341563416634176341863419634206342163422634236342463425634266342763428634296343063431634326343363434634356343663437634386343963440634416344263443634446344563446634476344863449634506345163452634536345463455634566345763458634596346063461634626346363464634656346663467634686346963470634716347263473634746347563476634776347863479634806348163482634836348463485634866348763488634896349063491634926349363494634956349663497634986349963500635016350263503635046350563506635076350863509635106351163512635136351463515635166351763518635196352063521635226352363524635256352663527635286352963530635316353263533635346353563536635376353863539635406354163542635436354463545635466354763548635496355063551635526355363554635556355663557635586355963560635616356263563635646356563566635676356863569635706357163572635736357463575635766357763578635796358063581635826358363584635856358663587635886358963590635916359263593635946359563596635976359863599636006360163602636036360463605636066360763608636096361063611636126361363614636156361663617636186361963620636216362263623636246362563626636276362863629636306363163632636336363463635636366363763638636396364063641636426364363644636456364663647636486364963650636516365263653636546365563656636576365863659636606366163662636636366463665636666366763668636696367063671636726367363674636756367663677636786367963680636816368263683636846368563686636876368863689636906369163692636936369463695636966369763698636996370063701637026370363704637056370663707637086370963710637116371263713637146371563716637176371863719637206372163722637236372463725637266372763728637296373063731637326373363734637356373663737637386373963740637416374263743637446374563746637476374863749637506375163752637536375463755637566375763758637596376063761637626376363764637656376663767637686376963770637716377263773637746377563776637776377863779637806378163782637836378463785637866378763788637896379063791637926379363794637956379663797637986379963800638016380263803638046380563806638076380863809638106381163812638136381463815638166381763818638196382063821638226382363824638256382663827638286382963830638316383263833638346383563836638376383863839638406384163842638436384463845638466384763848638496385063851638526385363854638556385663857638586385963860638616386263863638646386563866638676386863869638706387163872638736387463875638766387763878638796388063881638826388363884638856388663887638886388963890638916389263893638946389563896638976389863899639006390163902639036390463905639066390763908639096391063911639126391363914639156391663917639186391963920639216392263923639246392563926639276392863929639306393163932639336393463935639366393763938639396394063941639426394363944639456394663947639486394963950639516395263953639546395563956639576395863959639606396163962639636396463965639666396763968639696397063971639726397363974639756397663977639786397963980639816398263983639846398563986639876398863989639906399163992639936399463995639966399763998639996400064001640026400364004640056400664007640086400964010640116401264013640146401564016640176401864019640206402164022640236402464025640266402764028640296403064031640326403364034640356403664037640386403964040640416404264043640446404564046640476404864049640506405164052640536405464055640566405764058640596406064061640626406364064640656406664067640686406964070640716407264073640746407564076640776407864079640806408164082640836408464085640866408764088640896409064091640926409364094640956409664097640986409964100641016410264103641046410564106641076410864109641106411164112641136411464115641166411764118641196412064121641226412364124641256412664127641286412964130641316413264133641346413564136641376413864139641406414164142641436414464145641466414764148641496415064151641526415364154641556415664157641586415964160641616416264163641646416564166641676416864169641706417164172641736417464175641766417764178641796418064181641826418364184641856418664187641886418964190641916419264193641946419564196641976419864199642006420164202642036420464205642066420764208642096421064211642126421364214642156421664217642186421964220642216422264223642246422564226642276422864229642306423164232642336423464235642366423764238642396424064241642426424364244642456424664247642486424964250642516425264253642546425564256642576425864259642606426164262642636426464265642666426764268642696427064271642726427364274642756427664277642786427964280642816428264283642846428564286642876428864289642906429164292642936429464295642966429764298642996430064301643026430364304643056430664307643086430964310643116431264313643146431564316643176431864319643206432164322643236432464325643266432764328643296433064331643326433364334643356433664337643386433964340643416434264343643446434564346643476434864349643506435164352643536435464355643566435764358643596436064361643626436364364643656436664367643686436964370643716437264373643746437564376643776437864379643806438164382643836438464385643866438764388643896439064391643926439364394643956439664397643986439964400644016440264403644046440564406644076440864409644106441164412644136441464415644166441764418644196442064421644226442364424644256442664427644286442964430644316443264433644346443564436644376443864439644406444164442644436444464445644466444764448644496445064451644526445364454644556445664457644586445964460644616446264463644646446564466644676446864469644706447164472644736447464475644766447764478644796448064481644826448364484644856448664487644886448964490644916449264493644946449564496644976449864499645006450164502645036450464505645066450764508645096451064511645126451364514645156451664517645186451964520645216452264523645246452564526645276452864529645306453164532645336453464535645366453764538645396454064541645426454364544645456454664547645486454964550645516455264553645546455564556645576455864559645606456164562645636456464565645666456764568645696457064571645726457364574645756457664577645786457964580645816458264583645846458564586645876458864589645906459164592645936459464595645966459764598645996460064601646026460364604646056460664607646086460964610646116461264613646146461564616646176461864619646206462164622646236462464625646266462764628646296463064631646326463364634646356463664637646386463964640646416464264643646446464564646646476464864649646506465164652646536465464655646566465764658646596466064661646626466364664646656466664667646686466964670646716467264673646746467564676646776467864679646806468164682646836468464685646866468764688646896469064691646926469364694646956469664697646986469964700647016470264703647046470564706647076470864709647106471164712647136471464715647166471764718647196472064721647226472364724647256472664727647286472964730647316473264733647346473564736647376473864739647406474164742647436474464745647466474764748647496475064751647526475364754647556475664757647586475964760647616476264763647646476564766647676476864769647706477164772647736477464775647766477764778647796478064781647826478364784647856478664787647886478964790647916479264793647946479564796647976479864799648006480164802648036480464805648066480764808648096481064811648126481364814648156481664817648186481964820648216482264823648246482564826648276482864829648306483164832648336483464835648366483764838648396484064841648426484364844648456484664847648486484964850648516485264853648546485564856648576485864859648606486164862648636486464865648666486764868648696487064871648726487364874648756487664877648786487964880648816488264883648846488564886648876488864889648906489164892648936489464895648966489764898648996490064901649026490364904649056490664907649086490964910649116491264913649146491564916649176491864919649206492164922649236492464925649266492764928649296493064931649326493364934649356493664937649386493964940649416494264943649446494564946649476494864949649506495164952649536495464955649566495764958649596496064961649626496364964649656496664967649686496964970649716497264973649746497564976649776497864979649806498164982649836498464985649866498764988649896499064991649926499364994649956499664997649986499965000650016500265003650046500565006650076500865009650106501165012650136501465015650166501765018650196502065021650226502365024650256502665027650286502965030650316503265033650346503565036650376503865039650406504165042650436504465045650466504765048650496505065051650526505365054650556505665057650586505965060650616506265063650646506565066650676506865069650706507165072650736507465075650766507765078650796508065081650826508365084650856508665087650886508965090650916509265093650946509565096650976509865099651006510165102651036510465105651066510765108651096511065111651126511365114651156511665117651186511965120651216512265123651246512565126651276512865129651306513165132651336513465135651366513765138651396514065141651426514365144651456514665147651486514965150651516515265153651546515565156651576515865159651606516165162651636516465165651666516765168651696517065171651726517365174651756517665177651786517965180651816518265183651846518565186651876518865189651906519165192651936519465195651966519765198651996520065201652026520365204652056520665207652086520965210652116521265213652146521565216652176521865219652206522165222652236522465225652266522765228652296523065231652326523365234652356523665237652386523965240652416524265243652446524565246652476524865249652506525165252652536525465255652566525765258652596526065261652626526365264652656526665267652686526965270652716527265273652746527565276652776527865279652806528165282652836528465285652866528765288652896529065291652926529365294652956529665297652986529965300653016530265303653046530565306653076530865309653106531165312653136531465315653166531765318653196532065321653226532365324653256532665327653286532965330653316533265333653346533565336653376533865339653406534165342653436534465345653466534765348653496535065351653526535365354653556535665357653586535965360653616536265363653646536565366653676536865369653706537165372653736537465375653766537765378653796538065381653826538365384653856538665387653886538965390653916539265393653946539565396653976539865399654006540165402654036540465405654066540765408654096541065411654126541365414654156541665417654186541965420654216542265423654246542565426654276542865429654306543165432654336543465435654366543765438654396544065441654426544365444654456544665447654486544965450654516545265453654546545565456654576545865459654606546165462654636546465465654666546765468654696547065471654726547365474654756547665477654786547965480654816548265483654846548565486654876548865489654906549165492654936549465495654966549765498654996550065501655026550365504655056550665507655086550965510655116551265513655146551565516655176551865519655206552165522655236552465525655266552765528655296553065531655326553365534655356553665537655386553965540655416554265543655446554565546655476554865549655506555165552655536555465555655566555765558655596556065561655626556365564655656556665567655686556965570655716557265573655746557565576655776557865579655806558165582655836558465585655866558765588655896559065591655926559365594655956559665597655986559965600656016560265603656046560565606656076560865609656106561165612656136561465615656166561765618656196562065621656226562365624656256562665627656286562965630656316563265633656346563565636656376563865639656406564165642656436564465645656466564765648656496565065651656526565365654656556565665657656586565965660656616566265663656646566565666656676566865669656706567165672656736567465675656766567765678656796568065681656826568365684656856568665687656886568965690656916569265693656946569565696656976569865699657006570165702657036570465705657066570765708657096571065711657126571365714657156571665717657186571965720657216572265723657246572565726657276572865729657306573165732657336573465735657366573765738657396574065741657426574365744657456574665747657486574965750657516575265753657546575565756657576575865759657606576165762657636576465765657666576765768657696577065771657726577365774657756577665777657786577965780657816578265783657846578565786657876578865789657906579165792657936579465795657966579765798657996580065801658026580365804658056580665807658086580965810658116581265813658146581565816658176581865819658206582165822658236582465825658266582765828658296583065831658326583365834658356583665837658386583965840658416584265843658446584565846658476584865849658506585165852658536585465855658566585765858658596586065861658626586365864658656586665867658686586965870658716587265873658746587565876658776587865879658806588165882658836588465885658866588765888658896589065891658926589365894658956589665897658986589965900659016590265903659046590565906659076590865909659106591165912659136591465915659166591765918659196592065921659226592365924659256592665927659286592965930659316593265933659346593565936659376593865939659406594165942659436594465945659466594765948659496595065951659526595365954659556595665957659586595965960659616596265963659646596565966659676596865969659706597165972659736597465975659766597765978659796598065981659826598365984659856598665987659886598965990659916599265993659946599565996659976599865999660006600166002660036600466005660066600766008660096601066011660126601366014660156601666017660186601966020660216602266023660246602566026660276602866029660306603166032660336603466035660366603766038660396604066041660426604366044660456604666047660486604966050660516605266053660546605566056660576605866059660606606166062660636606466065660666606766068660696607066071660726607366074660756607666077660786607966080660816608266083660846608566086660876608866089660906609166092660936609466095660966609766098660996610066101661026610366104661056610666107661086610966110661116611266113661146611566116661176611866119661206612166122661236612466125661266612766128661296613066131661326613366134661356613666137661386613966140661416614266143661446614566146661476614866149661506615166152661536615466155661566615766158661596616066161661626616366164661656616666167661686616966170661716617266173661746617566176661776617866179661806618166182661836618466185661866618766188661896619066191661926619366194661956619666197661986619966200662016620266203662046620566206662076620866209662106621166212662136621466215662166621766218662196622066221662226622366224662256622666227662286622966230662316623266233662346623566236662376623866239662406624166242662436624466245662466624766248662496625066251662526625366254662556625666257662586625966260662616626266263662646626566266662676626866269662706627166272662736627466275662766627766278662796628066281662826628366284662856628666287662886628966290662916629266293662946629566296662976629866299663006630166302663036630466305663066630766308663096631066311663126631366314663156631666317663186631966320663216632266323663246632566326663276632866329663306633166332663336633466335663366633766338663396634066341663426634366344663456634666347663486634966350663516635266353663546635566356663576635866359663606636166362663636636466365663666636766368663696637066371663726637366374663756637666377663786637966380663816638266383663846638566386663876638866389663906639166392663936639466395663966639766398663996640066401664026640366404664056640666407664086640966410664116641266413664146641566416664176641866419664206642166422664236642466425664266642766428664296643066431664326643366434664356643666437664386643966440664416644266443664446644566446664476644866449664506645166452664536645466455664566645766458664596646066461664626646366464664656646666467664686646966470664716647266473664746647566476664776647866479664806648166482664836648466485664866648766488664896649066491664926649366494664956649666497664986649966500665016650266503665046650566506665076650866509665106651166512665136651466515665166651766518665196652066521665226652366524665256652666527665286652966530665316653266533665346653566536665376653866539665406654166542665436654466545665466654766548665496655066551665526655366554665556655666557665586655966560665616656266563665646656566566665676656866569665706657166572665736657466575665766657766578665796658066581665826658366584665856658666587665886658966590665916659266593665946659566596665976659866599666006660166602666036660466605666066660766608666096661066611666126661366614666156661666617666186661966620666216662266623666246662566626666276662866629666306663166632666336663466635666366663766638666396664066641666426664366644666456664666647666486664966650666516665266653666546665566656666576665866659666606666166662666636666466665666666666766668666696667066671666726667366674666756667666677666786667966680666816668266683666846668566686666876668866689666906669166692666936669466695666966669766698666996670066701667026670366704667056670666707667086670966710667116671266713667146671566716667176671866719667206672166722667236672466725667266672766728667296673066731667326673366734667356673666737667386673966740667416674266743667446674566746667476674866749667506675166752667536675466755667566675766758667596676066761667626676366764667656676666767667686676966770667716677266773667746677566776667776677866779667806678166782667836678466785667866678766788667896679066791667926679366794667956679666797667986679966800668016680266803668046680566806668076680866809668106681166812668136681466815668166681766818668196682066821668226682366824668256682666827668286682966830668316683266833668346683566836668376683866839668406684166842668436684466845668466684766848668496685066851668526685366854668556685666857668586685966860668616686266863668646686566866668676686866869668706687166872668736687466875668766687766878668796688066881668826688366884668856688666887668886688966890668916689266893668946689566896668976689866899669006690166902669036690466905669066690766908669096691066911669126691366914669156691666917669186691966920669216692266923669246692566926669276692866929669306693166932669336693466935669366693766938669396694066941669426694366944669456694666947669486694966950669516695266953669546695566956669576695866959669606696166962669636696466965669666696766968669696697066971669726697366974669756697666977669786697966980669816698266983669846698566986669876698866989669906699166992669936699466995669966699766998669996700067001670026700367004670056700667007670086700967010670116701267013670146701567016670176701867019670206702167022670236702467025670266702767028670296703067031670326703367034670356703667037670386703967040670416704267043670446704567046670476704867049670506705167052670536705467055670566705767058670596706067061670626706367064670656706667067670686706967070670716707267073670746707567076670776707867079670806708167082670836708467085670866708767088670896709067091670926709367094670956709667097670986709967100671016710267103671046710567106671076710867109671106711167112671136711467115671166711767118671196712067121671226712367124671256712667127671286712967130671316713267133671346713567136671376713867139671406714167142671436714467145671466714767148671496715067151671526715367154671556715667157671586715967160671616716267163671646716567166671676716867169671706717167172671736717467175671766717767178671796718067181671826718367184671856718667187671886718967190671916719267193671946719567196671976719867199672006720167202672036720467205672066720767208672096721067211672126721367214672156721667217672186721967220672216722267223672246722567226672276722867229672306723167232672336723467235672366723767238672396724067241672426724367244672456724667247672486724967250672516725267253672546725567256672576725867259672606726167262672636726467265672666726767268672696727067271672726727367274672756727667277672786727967280672816728267283672846728567286672876728867289672906729167292672936729467295672966729767298672996730067301673026730367304673056730667307673086730967310673116731267313673146731567316673176731867319673206732167322673236732467325673266732767328673296733067331673326733367334673356733667337673386733967340673416734267343673446734567346673476734867349673506735167352673536735467355673566735767358673596736067361673626736367364673656736667367673686736967370673716737267373673746737567376673776737867379673806738167382673836738467385673866738767388673896739067391673926739367394673956739667397673986739967400674016740267403674046740567406674076740867409674106741167412674136741467415674166741767418674196742067421674226742367424674256742667427674286742967430674316743267433674346743567436674376743867439674406744167442674436744467445674466744767448674496745067451674526745367454674556745667457674586745967460674616746267463674646746567466674676746867469674706747167472674736747467475674766747767478674796748067481674826748367484674856748667487674886748967490674916749267493674946749567496674976749867499675006750167502675036750467505675066750767508675096751067511675126751367514675156751667517675186751967520675216752267523675246752567526675276752867529675306753167532675336753467535675366753767538675396754067541675426754367544675456754667547675486754967550675516755267553675546755567556675576755867559675606756167562675636756467565675666756767568675696757067571675726757367574675756757667577675786757967580675816758267583675846758567586675876758867589675906759167592675936759467595675966759767598675996760067601676026760367604676056760667607676086760967610676116761267613676146761567616676176761867619676206762167622676236762467625676266762767628676296763067631676326763367634676356763667637676386763967640676416764267643676446764567646676476764867649676506765167652676536765467655676566765767658676596766067661676626766367664676656766667667676686766967670676716767267673676746767567676676776767867679676806768167682676836768467685676866768767688676896769067691676926769367694676956769667697676986769967700677016770267703677046770567706677076770867709677106771167712677136771467715677166771767718677196772067721677226772367724677256772667727677286772967730677316773267733677346773567736677376773867739677406774167742677436774467745677466774767748677496775067751677526775367754677556775667757677586775967760677616776267763677646776567766677676776867769677706777167772677736777467775677766777767778677796778067781677826778367784677856778667787677886778967790677916779267793677946779567796677976779867799678006780167802678036780467805678066780767808678096781067811678126781367814678156781667817678186781967820678216782267823678246782567826678276782867829678306783167832678336783467835678366783767838678396784067841678426784367844678456784667847678486784967850678516785267853678546785567856678576785867859678606786167862678636786467865678666786767868678696787067871678726787367874678756787667877678786787967880678816788267883678846788567886678876788867889678906789167892678936789467895678966789767898678996790067901679026790367904679056790667907679086790967910679116791267913679146791567916679176791867919679206792167922679236792467925679266792767928679296793067931679326793367934679356793667937679386793967940679416794267943679446794567946679476794867949679506795167952679536795467955679566795767958679596796067961679626796367964679656796667967679686796967970679716797267973679746797567976679776797867979679806798167982679836798467985679866798767988679896799067991679926799367994679956799667997679986799968000680016800268003680046800568006680076800868009680106801168012680136801468015680166801768018680196802068021680226802368024680256802668027680286802968030680316803268033680346803568036680376803868039680406804168042680436804468045680466804768048680496805068051680526805368054680556805668057680586805968060680616806268063680646806568066680676806868069680706807168072680736807468075680766807768078680796808068081680826808368084680856808668087680886808968090680916809268093680946809568096680976809868099681006810168102681036810468105681066810768108681096811068111681126811368114681156811668117681186811968120681216812268123681246812568126681276812868129681306813168132681336813468135681366813768138681396814068141681426814368144681456814668147681486814968150681516815268153681546815568156681576815868159681606816168162681636816468165681666816768168681696817068171681726817368174681756817668177681786817968180681816818268183681846818568186681876818868189681906819168192681936819468195681966819768198681996820068201682026820368204682056820668207682086820968210682116821268213682146821568216682176821868219682206822168222682236822468225682266822768228682296823068231682326823368234682356823668237682386823968240682416824268243682446824568246682476824868249682506825168252682536825468255682566825768258682596826068261682626826368264682656826668267682686826968270682716827268273682746827568276682776827868279682806828168282682836828468285682866828768288682896829068291682926829368294682956829668297682986829968300683016830268303683046830568306683076830868309683106831168312683136831468315683166831768318683196832068321683226832368324683256832668327683286832968330683316833268333683346833568336683376833868339683406834168342683436834468345683466834768348683496835068351683526835368354683556835668357683586835968360683616836268363683646836568366683676836868369683706837168372683736837468375683766837768378683796838068381683826838368384683856838668387683886838968390683916839268393683946839568396683976839868399684006840168402684036840468405684066840768408684096841068411684126841368414684156841668417684186841968420684216842268423684246842568426684276842868429684306843168432684336843468435684366843768438684396844068441684426844368444684456844668447684486844968450684516845268453684546845568456684576845868459684606846168462684636846468465684666846768468684696847068471684726847368474684756847668477684786847968480684816848268483684846848568486684876848868489684906849168492684936849468495684966849768498684996850068501685026850368504685056850668507685086850968510685116851268513685146851568516685176851868519685206852168522685236852468525685266852768528685296853068531685326853368534685356853668537685386853968540685416854268543685446854568546685476854868549685506855168552685536855468555685566855768558685596856068561685626856368564685656856668567685686856968570685716857268573685746857568576685776857868579685806858168582685836858468585685866858768588685896859068591685926859368594685956859668597685986859968600686016860268603686046860568606686076860868609686106861168612686136861468615686166861768618686196862068621686226862368624686256862668627686286862968630686316863268633686346863568636686376863868639686406864168642686436864468645686466864768648686496865068651686526865368654686556865668657686586865968660686616866268663686646866568666686676866868669686706867168672686736867468675686766867768678686796868068681686826868368684686856868668687686886868968690686916869268693686946869568696686976869868699687006870168702687036870468705687066870768708687096871068711687126871368714687156871668717687186871968720687216872268723687246872568726687276872868729687306873168732687336873468735687366873768738687396874068741687426874368744687456874668747687486874968750687516875268753687546875568756687576875868759687606876168762687636876468765687666876768768687696877068771687726877368774687756877668777687786877968780687816878268783687846878568786687876878868789687906879168792687936879468795687966879768798687996880068801688026880368804688056880668807688086880968810688116881268813688146881568816688176881868819688206882168822688236882468825688266882768828688296883068831688326883368834688356883668837688386883968840688416884268843688446884568846688476884868849688506885168852688536885468855688566885768858688596886068861688626886368864688656886668867688686886968870688716887268873688746887568876688776887868879688806888168882688836888468885688866888768888688896889068891688926889368894688956889668897688986889968900689016890268903689046890568906689076890868909689106891168912689136891468915689166891768918689196892068921689226892368924689256892668927689286892968930689316893268933689346893568936689376893868939689406894168942689436894468945689466894768948689496895068951689526895368954689556895668957689586895968960689616896268963689646896568966689676896868969689706897168972689736897468975689766897768978689796898068981689826898368984689856898668987689886898968990689916899268993689946899568996689976899868999690006900169002690036900469005690066900769008690096901069011690126901369014690156901669017690186901969020690216902269023690246902569026690276902869029690306903169032690336903469035690366903769038690396904069041690426904369044690456904669047690486904969050690516905269053690546905569056690576905869059690606906169062690636906469065690666906769068690696907069071690726907369074690756907669077690786907969080690816908269083690846908569086690876908869089690906909169092690936909469095690966909769098690996910069101691026910369104691056910669107691086910969110691116911269113691146911569116691176911869119691206912169122691236912469125691266912769128691296913069131691326913369134691356913669137691386913969140691416914269143691446914569146691476914869149691506915169152691536915469155691566915769158691596916069161691626916369164691656916669167691686916969170691716917269173691746917569176691776917869179691806918169182691836918469185691866918769188691896919069191691926919369194691956919669197691986919969200692016920269203692046920569206692076920869209692106921169212692136921469215692166921769218692196922069221692226922369224692256922669227692286922969230692316923269233692346923569236692376923869239692406924169242692436924469245692466924769248692496925069251692526925369254692556925669257692586925969260692616926269263692646926569266692676926869269692706927169272692736927469275692766927769278692796928069281692826928369284692856928669287692886928969290692916929269293692946929569296692976929869299693006930169302693036930469305693066930769308693096931069311693126931369314693156931669317693186931969320693216932269323693246932569326693276932869329693306933169332693336933469335693366933769338693396934069341693426934369344693456934669347693486934969350693516935269353693546935569356693576935869359693606936169362693636936469365693666936769368693696937069371693726937369374693756937669377693786937969380693816938269383693846938569386693876938869389693906939169392693936939469395693966939769398693996940069401694026940369404694056940669407694086940969410694116941269413694146941569416694176941869419694206942169422694236942469425694266942769428694296943069431694326943369434694356943669437694386943969440694416944269443694446944569446694476944869449694506945169452694536945469455694566945769458694596946069461694626946369464694656946669467694686946969470694716947269473694746947569476694776947869479694806948169482694836948469485694866948769488694896949069491694926949369494694956949669497694986949969500695016950269503695046950569506695076950869509695106951169512695136951469515695166951769518695196952069521695226952369524695256952669527695286952969530695316953269533695346953569536695376953869539695406954169542695436954469545695466954769548695496955069551695526955369554695556955669557695586955969560695616956269563695646956569566695676956869569695706957169572695736957469575695766957769578695796958069581695826958369584695856958669587695886958969590695916959269593695946959569596695976959869599696006960169602696036960469605696066960769608696096961069611696126961369614696156961669617696186961969620696216962269623696246962569626696276962869629696306963169632696336963469635696366963769638696396964069641696426964369644696456964669647696486964969650696516965269653696546965569656696576965869659696606966169662696636966469665696666966769668696696967069671696726967369674696756967669677696786967969680696816968269683696846968569686696876968869689696906969169692696936969469695696966969769698696996970069701697026970369704697056970669707697086970969710697116971269713697146971569716697176971869719697206972169722697236972469725697266972769728697296973069731697326973369734697356973669737697386973969740697416974269743697446974569746697476974869749697506975169752697536975469755697566975769758697596976069761697626976369764697656976669767697686976969770697716977269773697746977569776697776977869779697806978169782697836978469785697866978769788697896979069791697926979369794697956979669797697986979969800698016980269803698046980569806698076980869809698106981169812698136981469815698166981769818698196982069821698226982369824698256982669827698286982969830698316983269833698346983569836698376983869839698406984169842698436984469845698466984769848698496985069851698526985369854698556985669857698586985969860698616986269863698646986569866698676986869869698706987169872698736987469875698766987769878698796988069881698826988369884698856988669887698886988969890698916989269893698946989569896698976989869899699006990169902699036990469905699066990769908699096991069911699126991369914699156991669917699186991969920699216992269923699246992569926699276992869929699306993169932699336993469935699366993769938699396994069941699426994369944699456994669947699486994969950699516995269953699546995569956699576995869959699606996169962699636996469965699666996769968699696997069971699726997369974699756997669977699786997969980699816998269983699846998569986699876998869989699906999169992699936999469995699966999769998699997000070001700027000370004700057000670007700087000970010700117001270013700147001570016700177001870019700207002170022700237002470025700267002770028700297003070031700327003370034700357003670037700387003970040700417004270043700447004570046700477004870049700507005170052700537005470055700567005770058700597006070061700627006370064700657006670067700687006970070700717007270073700747007570076700777007870079700807008170082700837008470085700867008770088700897009070091700927009370094700957009670097700987009970100701017010270103701047010570106701077010870109701107011170112701137011470115701167011770118701197012070121701227012370124701257012670127701287012970130701317013270133701347013570136701377013870139701407014170142701437014470145701467014770148701497015070151701527015370154701557015670157701587015970160701617016270163701647016570166701677016870169701707017170172701737017470175701767017770178701797018070181701827018370184701857018670187701887018970190701917019270193701947019570196701977019870199702007020170202702037020470205702067020770208702097021070211702127021370214702157021670217702187021970220702217022270223702247022570226702277022870229702307023170232702337023470235702367023770238702397024070241702427024370244702457024670247702487024970250702517025270253702547025570256702577025870259702607026170262702637026470265702667026770268702697027070271702727027370274702757027670277702787027970280702817028270283702847028570286702877028870289702907029170292702937029470295702967029770298702997030070301703027030370304703057030670307703087030970310703117031270313703147031570316703177031870319703207032170322703237032470325703267032770328703297033070331703327033370334703357033670337703387033970340703417034270343703447034570346703477034870349703507035170352703537035470355703567035770358703597036070361703627036370364703657036670367703687036970370703717037270373703747037570376703777037870379703807038170382703837038470385703867038770388703897039070391703927039370394703957039670397703987039970400704017040270403704047040570406704077040870409704107041170412704137041470415704167041770418704197042070421704227042370424704257042670427704287042970430704317043270433704347043570436704377043870439704407044170442704437044470445704467044770448704497045070451704527045370454704557045670457704587045970460704617046270463704647046570466704677046870469704707047170472704737047470475704767047770478704797048070481704827048370484704857048670487704887048970490704917049270493704947049570496704977049870499705007050170502705037050470505705067050770508705097051070511705127051370514705157051670517705187051970520705217052270523705247052570526705277052870529705307053170532705337053470535705367053770538705397054070541705427054370544705457054670547705487054970550705517055270553705547055570556705577055870559705607056170562705637056470565705667056770568705697057070571705727057370574705757057670577705787057970580705817058270583705847058570586705877058870589705907059170592705937059470595705967059770598705997060070601706027060370604706057060670607706087060970610706117061270613706147061570616706177061870619706207062170622706237062470625706267062770628706297063070631706327063370634706357063670637706387063970640706417064270643706447064570646706477064870649706507065170652706537065470655706567065770658706597066070661706627066370664706657066670667706687066970670706717067270673706747067570676706777067870679706807068170682706837068470685706867068770688706897069070691706927069370694706957069670697706987069970700707017070270703707047070570706707077070870709707107071170712707137071470715707167071770718707197072070721707227072370724707257072670727707287072970730707317073270733707347073570736707377073870739707407074170742707437074470745707467074770748707497075070751707527075370754707557075670757707587075970760707617076270763707647076570766707677076870769707707077170772707737077470775707767077770778707797078070781707827078370784707857078670787707887078970790707917079270793707947079570796707977079870799708007080170802708037080470805708067080770808708097081070811708127081370814708157081670817708187081970820708217082270823708247082570826708277082870829708307083170832708337083470835708367083770838708397084070841708427084370844708457084670847708487084970850708517085270853708547085570856708577085870859708607086170862708637086470865708667086770868708697087070871708727087370874708757087670877708787087970880708817088270883708847088570886708877088870889708907089170892708937089470895708967089770898708997090070901709027090370904709057090670907709087090970910709117091270913709147091570916709177091870919709207092170922709237092470925709267092770928709297093070931709327093370934709357093670937709387093970940709417094270943709447094570946709477094870949709507095170952709537095470955709567095770958709597096070961709627096370964709657096670967709687096970970709717097270973709747097570976709777097870979709807098170982709837098470985709867098770988709897099070991709927099370994709957099670997709987099971000710017100271003710047100571006710077100871009710107101171012710137101471015710167101771018710197102071021710227102371024710257102671027710287102971030710317103271033710347103571036710377103871039710407104171042710437104471045710467104771048710497105071051710527105371054710557105671057710587105971060710617106271063710647106571066710677106871069710707107171072710737107471075710767107771078710797108071081710827108371084710857108671087710887108971090710917109271093710947109571096710977109871099711007110171102711037110471105711067110771108711097111071111711127111371114711157111671117711187111971120711217112271123711247112571126711277112871129711307113171132711337113471135711367113771138711397114071141711427114371144711457114671147711487114971150711517115271153711547115571156711577115871159711607116171162711637116471165711667116771168711697117071171711727117371174711757117671177711787117971180711817118271183711847118571186711877118871189711907119171192711937119471195711967119771198711997120071201712027120371204712057120671207712087120971210712117121271213712147121571216712177121871219712207122171222712237122471225712267122771228712297123071231712327123371234712357123671237712387123971240712417124271243712447124571246712477124871249712507125171252712537125471255712567125771258712597126071261712627126371264712657126671267712687126971270712717127271273712747127571276712777127871279712807128171282712837128471285712867128771288712897129071291712927129371294712957129671297712987129971300713017130271303713047130571306713077130871309713107131171312713137131471315713167131771318713197132071321713227132371324713257132671327713287132971330713317133271333713347133571336713377133871339713407134171342713437134471345713467134771348713497135071351713527135371354713557135671357713587135971360713617136271363713647136571366713677136871369713707137171372713737137471375713767137771378713797138071381713827138371384713857138671387713887138971390713917139271393713947139571396713977139871399714007140171402714037140471405714067140771408714097141071411714127141371414714157141671417714187141971420714217142271423714247142571426714277142871429714307143171432714337143471435714367143771438714397144071441714427144371444714457144671447714487144971450714517145271453714547145571456714577145871459714607146171462714637146471465714667146771468714697147071471714727147371474714757147671477714787147971480714817148271483714847148571486714877148871489714907149171492714937149471495714967149771498714997150071501715027150371504715057150671507715087150971510715117151271513715147151571516715177151871519715207152171522715237152471525715267152771528715297153071531715327153371534715357153671537715387153971540715417154271543715447154571546715477154871549715507155171552715537155471555715567155771558715597156071561715627156371564715657156671567715687156971570715717157271573715747157571576715777157871579715807158171582715837158471585715867158771588715897159071591715927159371594715957159671597715987159971600716017160271603716047160571606716077160871609716107161171612716137161471615716167161771618716197162071621716227162371624716257162671627716287162971630716317163271633716347163571636716377163871639716407164171642716437164471645716467164771648716497165071651716527165371654716557165671657716587165971660716617166271663716647166571666716677166871669716707167171672716737167471675716767167771678716797168071681716827168371684716857168671687716887168971690716917169271693716947169571696716977169871699717007170171702717037170471705717067170771708717097171071711717127171371714717157171671717717187171971720717217172271723717247172571726717277172871729717307173171732717337173471735717367173771738717397174071741717427174371744717457174671747717487174971750717517175271753717547175571756717577175871759717607176171762717637176471765717667176771768717697177071771717727177371774717757177671777717787177971780717817178271783717847178571786717877178871789717907179171792717937179471795717967179771798717997180071801718027180371804718057180671807718087180971810718117181271813718147181571816718177181871819718207182171822718237182471825718267182771828718297183071831718327183371834718357183671837718387183971840718417184271843718447184571846718477184871849718507185171852718537185471855718567185771858718597186071861718627186371864718657186671867718687186971870718717187271873718747187571876718777187871879718807188171882718837188471885718867188771888718897189071891718927189371894718957189671897718987189971900719017190271903719047190571906719077190871909719107191171912719137191471915719167191771918719197192071921719227192371924719257192671927719287192971930719317193271933719347193571936719377193871939719407194171942719437194471945719467194771948719497195071951719527195371954719557195671957719587195971960719617196271963719647196571966719677196871969719707197171972719737197471975719767197771978719797198071981719827198371984719857198671987719887198971990719917199271993719947199571996719977199871999720007200172002720037200472005720067200772008720097201072011720127201372014720157201672017720187201972020720217202272023720247202572026720277202872029720307203172032720337203472035720367203772038720397204072041720427204372044720457204672047720487204972050720517205272053720547205572056720577205872059720607206172062720637206472065720667206772068720697207072071720727207372074720757207672077720787207972080720817208272083720847208572086720877208872089720907209172092720937209472095720967209772098720997210072101721027210372104721057210672107721087210972110721117211272113721147211572116721177211872119721207212172122721237212472125721267212772128721297213072131721327213372134721357213672137721387213972140721417214272143721447214572146721477214872149721507215172152721537215472155721567215772158721597216072161721627216372164721657216672167721687216972170721717217272173721747217572176721777217872179721807218172182721837218472185721867218772188721897219072191721927219372194721957219672197721987219972200722017220272203722047220572206722077220872209722107221172212722137221472215722167221772218722197222072221722227222372224722257222672227722287222972230722317223272233722347223572236722377223872239722407224172242722437224472245722467224772248722497225072251722527225372254722557225672257722587225972260722617226272263722647226572266722677226872269722707227172272722737227472275722767227772278722797228072281722827228372284722857228672287722887228972290722917229272293722947229572296722977229872299723007230172302723037230472305723067230772308723097231072311723127231372314723157231672317723187231972320723217232272323723247232572326723277232872329723307233172332723337233472335723367233772338723397234072341723427234372344723457234672347723487234972350723517235272353723547235572356723577235872359723607236172362723637236472365723667236772368723697237072371723727237372374723757237672377723787237972380723817238272383723847238572386723877238872389723907239172392723937239472395723967239772398723997240072401724027240372404724057240672407724087240972410724117241272413724147241572416724177241872419724207242172422724237242472425724267242772428724297243072431724327243372434724357243672437724387243972440724417244272443724447244572446724477244872449724507245172452724537245472455724567245772458724597246072461724627246372464724657246672467724687246972470724717247272473724747247572476724777247872479724807248172482724837248472485724867248772488724897249072491724927249372494724957249672497724987249972500725017250272503725047250572506725077250872509725107251172512725137251472515725167251772518725197252072521725227252372524725257252672527725287252972530725317253272533725347253572536725377253872539725407254172542725437254472545725467254772548725497255072551725527255372554725557255672557725587255972560725617256272563725647256572566725677256872569725707257172572725737257472575725767257772578725797258072581725827258372584725857258672587725887258972590725917259272593725947259572596725977259872599726007260172602726037260472605726067260772608726097261072611726127261372614726157261672617726187261972620726217262272623726247262572626726277262872629726307263172632726337263472635726367263772638726397264072641726427264372644726457264672647726487264972650726517265272653726547265572656726577265872659726607266172662726637266472665726667266772668726697267072671726727267372674726757267672677726787267972680726817268272683726847268572686726877268872689726907269172692726937269472695726967269772698726997270072701727027270372704727057270672707727087270972710727117271272713727147271572716727177271872719727207272172722727237272472725727267272772728727297273072731727327273372734727357273672737727387273972740727417274272743727447274572746727477274872749727507275172752727537275472755727567275772758727597276072761727627276372764727657276672767727687276972770727717277272773727747277572776727777277872779727807278172782727837278472785727867278772788727897279072791727927279372794727957279672797727987279972800728017280272803728047280572806728077280872809728107281172812728137281472815728167281772818728197282072821728227282372824728257282672827728287282972830728317283272833728347283572836728377283872839728407284172842728437284472845728467284772848728497285072851728527285372854728557285672857728587285972860728617286272863728647286572866728677286872869728707287172872728737287472875728767287772878728797288072881728827288372884728857288672887728887288972890728917289272893728947289572896728977289872899729007290172902729037290472905729067290772908729097291072911729127291372914729157291672917729187291972920729217292272923729247292572926729277292872929729307293172932729337293472935729367293772938729397294072941729427294372944729457294672947729487294972950729517295272953729547295572956729577295872959729607296172962729637296472965729667296772968729697297072971729727297372974729757297672977729787297972980729817298272983729847298572986729877298872989729907299172992729937299472995729967299772998729997300073001730027300373004730057300673007730087300973010730117301273013730147301573016730177301873019730207302173022730237302473025730267302773028730297303073031730327303373034730357303673037730387303973040730417304273043730447304573046730477304873049730507305173052730537305473055730567305773058730597306073061730627306373064730657306673067730687306973070730717307273073730747307573076730777307873079730807308173082730837308473085730867308773088730897309073091730927309373094730957309673097730987309973100731017310273103731047310573106731077310873109731107311173112731137311473115731167311773118731197312073121731227312373124731257312673127731287312973130731317313273133731347313573136731377313873139731407314173142731437314473145731467314773148731497315073151731527315373154731557315673157731587315973160731617316273163731647316573166731677316873169731707317173172731737317473175731767317773178731797318073181731827318373184731857318673187731887318973190731917319273193731947319573196731977319873199732007320173202732037320473205732067320773208732097321073211732127321373214732157321673217732187321973220732217322273223732247322573226732277322873229732307323173232732337323473235732367323773238732397324073241732427324373244732457324673247732487324973250732517325273253732547325573256732577325873259732607326173262732637326473265732667326773268732697327073271732727327373274732757327673277732787327973280732817328273283732847328573286732877328873289732907329173292732937329473295732967329773298732997330073301733027330373304733057330673307733087330973310733117331273313733147331573316733177331873319733207332173322733237332473325733267332773328733297333073331733327333373334733357333673337733387333973340733417334273343733447334573346733477334873349733507335173352733537335473355733567335773358733597336073361733627336373364733657336673367733687336973370733717337273373733747337573376733777337873379733807338173382733837338473385733867338773388733897339073391733927339373394733957339673397733987339973400734017340273403734047340573406734077340873409734107341173412734137341473415734167341773418734197342073421734227342373424734257342673427734287342973430734317343273433734347343573436734377343873439734407344173442734437344473445734467344773448734497345073451734527345373454734557345673457734587345973460734617346273463734647346573466734677346873469734707347173472734737347473475734767347773478734797348073481734827348373484734857348673487734887348973490734917349273493734947349573496734977349873499735007350173502735037350473505735067350773508735097351073511735127351373514735157351673517735187351973520735217352273523735247352573526735277352873529735307353173532735337353473535735367353773538735397354073541735427354373544735457354673547735487354973550735517355273553735547355573556735577355873559735607356173562735637356473565735667356773568735697357073571735727357373574735757357673577735787357973580735817358273583735847358573586735877358873589735907359173592735937359473595735967359773598735997360073601736027360373604736057360673607736087360973610736117361273613736147361573616736177361873619736207362173622736237362473625736267362773628736297363073631736327363373634736357363673637736387363973640736417364273643736447364573646736477364873649736507365173652736537365473655736567365773658736597366073661736627366373664736657366673667736687366973670736717367273673736747367573676736777367873679736807368173682736837368473685736867368773688736897369073691736927369373694736957369673697736987369973700737017370273703737047370573706737077370873709737107371173712737137371473715737167371773718737197372073721737227372373724737257372673727737287372973730737317373273733737347373573736737377373873739737407374173742737437374473745737467374773748737497375073751737527375373754737557375673757737587375973760737617376273763737647376573766737677376873769737707377173772737737377473775737767377773778737797378073781737827378373784737857378673787737887378973790737917379273793737947379573796737977379873799738007380173802738037380473805738067380773808738097381073811738127381373814738157381673817738187381973820738217382273823738247382573826738277382873829738307383173832738337383473835738367383773838738397384073841738427384373844738457384673847738487384973850738517385273853738547385573856738577385873859738607386173862738637386473865738667386773868738697387073871738727387373874738757387673877738787387973880738817388273883738847388573886738877388873889738907389173892738937389473895738967389773898738997390073901739027390373904739057390673907739087390973910739117391273913739147391573916739177391873919739207392173922739237392473925739267392773928739297393073931739327393373934739357393673937739387393973940739417394273943739447394573946739477394873949739507395173952739537395473955739567395773958739597396073961739627396373964739657396673967739687396973970739717397273973739747397573976739777397873979739807398173982739837398473985739867398773988739897399073991739927399373994739957399673997739987399974000740017400274003740047400574006740077400874009740107401174012740137401474015740167401774018740197402074021740227402374024740257402674027740287402974030740317403274033740347403574036740377403874039740407404174042740437404474045740467404774048740497405074051740527405374054740557405674057740587405974060740617406274063740647406574066740677406874069740707407174072740737407474075740767407774078740797408074081740827408374084740857408674087740887408974090740917409274093740947409574096740977409874099741007410174102741037410474105741067410774108741097411074111741127411374114741157411674117741187411974120741217412274123741247412574126741277412874129741307413174132741337413474135741367413774138741397414074141741427414374144741457414674147741487414974150741517415274153741547415574156741577415874159741607416174162741637416474165741667416774168741697417074171741727417374174741757417674177741787417974180741817418274183741847418574186741877418874189741907419174192741937419474195741967419774198741997420074201742027420374204742057420674207742087420974210742117421274213742147421574216742177421874219742207422174222742237422474225742267422774228742297423074231742327423374234742357423674237742387423974240742417424274243742447424574246742477424874249742507425174252742537425474255742567425774258742597426074261742627426374264742657426674267742687426974270742717427274273742747427574276742777427874279742807428174282742837428474285742867428774288742897429074291742927429374294742957429674297742987429974300743017430274303743047430574306743077430874309743107431174312743137431474315743167431774318743197432074321743227432374324743257432674327743287432974330743317433274333743347433574336743377433874339743407434174342743437434474345743467434774348743497435074351743527435374354743557435674357743587435974360743617436274363743647436574366743677436874369743707437174372743737437474375743767437774378743797438074381743827438374384743857438674387743887438974390743917439274393743947439574396743977439874399744007440174402744037440474405744067440774408744097441074411744127441374414744157441674417744187441974420744217442274423744247442574426744277442874429744307443174432744337443474435744367443774438744397444074441744427444374444744457444674447744487444974450744517445274453744547445574456744577445874459744607446174462744637446474465744667446774468744697447074471744727447374474744757447674477744787447974480744817448274483744847448574486744877448874489744907449174492744937449474495744967449774498744997450074501745027450374504745057450674507745087450974510745117451274513745147451574516745177451874519745207452174522745237452474525745267452774528745297453074531745327453374534745357453674537745387453974540745417454274543745447454574546745477454874549745507455174552745537455474555745567455774558745597456074561745627456374564745657456674567745687456974570745717457274573745747457574576745777457874579745807458174582745837458474585745867458774588745897459074591745927459374594745957459674597745987459974600746017460274603746047460574606746077460874609746107461174612746137461474615746167461774618746197462074621746227462374624746257462674627746287462974630746317463274633746347463574636746377463874639746407464174642746437464474645746467464774648746497465074651746527465374654746557465674657746587465974660746617466274663746647466574666746677466874669746707467174672746737467474675746767467774678746797468074681746827468374684746857468674687746887468974690746917469274693746947469574696746977469874699747007470174702747037470474705747067470774708747097471074711747127471374714747157471674717747187471974720747217472274723747247472574726747277472874729747307473174732747337473474735747367473774738747397474074741747427474374744747457474674747747487474974750747517475274753747547475574756747577475874759747607476174762747637476474765747667476774768747697477074771747727477374774747757477674777747787477974780747817478274783747847478574786747877478874789747907479174792747937479474795747967479774798747997480074801748027480374804748057480674807748087480974810748117481274813748147481574816748177481874819748207482174822748237482474825748267482774828748297483074831748327483374834748357483674837748387483974840748417484274843748447484574846748477484874849748507485174852748537485474855748567485774858748597486074861748627486374864748657486674867748687486974870748717487274873748747487574876748777487874879748807488174882748837488474885748867488774888748897489074891748927489374894748957489674897748987489974900749017490274903749047490574906749077490874909749107491174912749137491474915749167491774918749197492074921749227492374924749257492674927749287492974930749317493274933749347493574936749377493874939749407494174942749437494474945749467494774948749497495074951749527495374954749557495674957749587495974960749617496274963749647496574966749677496874969749707497174972749737497474975749767497774978749797498074981749827498374984749857498674987749887498974990749917499274993749947499574996749977499874999750007500175002750037500475005750067500775008750097501075011750127501375014750157501675017750187501975020750217502275023750247502575026750277502875029750307503175032750337503475035750367503775038750397504075041750427504375044750457504675047750487504975050750517505275053750547505575056750577505875059750607506175062750637506475065750667506775068750697507075071750727507375074750757507675077750787507975080750817508275083750847508575086750877508875089750907509175092750937509475095750967509775098750997510075101751027510375104751057510675107751087510975110751117511275113751147511575116751177511875119751207512175122751237512475125751267512775128751297513075131751327513375134751357513675137751387513975140751417514275143751447514575146751477514875149751507515175152751537515475155751567515775158751597516075161751627516375164751657516675167751687516975170751717517275173751747517575176751777517875179751807518175182751837518475185751867518775188751897519075191751927519375194751957519675197751987519975200752017520275203752047520575206752077520875209752107521175212752137521475215752167521775218752197522075221752227522375224752257522675227752287522975230752317523275233752347523575236752377523875239752407524175242752437524475245752467524775248752497525075251752527525375254752557525675257752587525975260752617526275263752647526575266752677526875269752707527175272752737527475275752767527775278752797528075281752827528375284752857528675287752887528975290752917529275293752947529575296
  1. /**
  2. * @licstart The following is the entire license notice for the
  3. * JavaScript code in this page
  4. *
  5. * Copyright 2022 Mozilla Foundation
  6. *
  7. * Licensed under the Apache License, Version 2.0 (the "License");
  8. * you may not use this file except in compliance with the License.
  9. * You may obtain a copy of the License at
  10. *
  11. * http://www.apache.org/licenses/LICENSE-2.0
  12. *
  13. * Unless required by applicable law or agreed to in writing, software
  14. * distributed under the License is distributed on an "AS IS" BASIS,
  15. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16. * See the License for the specific language governing permissions and
  17. * limitations under the License.
  18. *
  19. * @licend The above is the entire license notice for the
  20. * JavaScript code in this page
  21. */
  22. (function webpackUniversalModuleDefinition(root, factory) {
  23. if(typeof exports === 'object' && typeof module === 'object')
  24. module.exports = factory();
  25. else if(typeof define === 'function' && define.amd)
  26. define("pdfjs-dist/build/pdf.worker", [], factory);
  27. else if(typeof exports === 'object')
  28. exports["pdfjs-dist/build/pdf.worker"] = factory();
  29. else
  30. root["pdfjs-dist/build/pdf.worker"] = root.pdfjsWorker = factory();
  31. })(globalThis, () => {
  32. return /******/ (() => { // webpackBootstrap
  33. /******/ "use strict";
  34. /******/ var __webpack_modules__ = ([
  35. /* 0 */,
  36. /* 1 */
  37. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  38. Object.defineProperty(exports, "__esModule", ({
  39. value: true
  40. }));
  41. exports.WorkerTask = exports.WorkerMessageHandler = void 0;
  42. var _util = __w_pdfjs_require__(2);
  43. var _primitives = __w_pdfjs_require__(5);
  44. var _core_utils = __w_pdfjs_require__(6);
  45. var _pdf_manager = __w_pdfjs_require__(8);
  46. var _cleanup_helper = __w_pdfjs_require__(71);
  47. var _writer = __w_pdfjs_require__(65);
  48. var _is_node = __w_pdfjs_require__(4);
  49. var _message_handler = __w_pdfjs_require__(102);
  50. var _worker_stream = __w_pdfjs_require__(103);
  51. class WorkerTask {
  52. constructor(name) {
  53. this.name = name;
  54. this.terminated = false;
  55. this._capability = (0, _util.createPromiseCapability)();
  56. }
  57. get finished() {
  58. return this._capability.promise;
  59. }
  60. finish() {
  61. this._capability.resolve();
  62. }
  63. terminate() {
  64. this.terminated = true;
  65. }
  66. ensureNotTerminated() {
  67. if (this.terminated) {
  68. throw new Error("Worker task was terminated");
  69. }
  70. }
  71. }
  72. exports.WorkerTask = WorkerTask;
  73. class WorkerMessageHandler {
  74. static setup(handler, port) {
  75. let testMessageProcessed = false;
  76. handler.on("test", function wphSetupTest(data) {
  77. if (testMessageProcessed) {
  78. return;
  79. }
  80. testMessageProcessed = true;
  81. handler.send("test", data instanceof Uint8Array);
  82. });
  83. handler.on("configure", function wphConfigure(data) {
  84. (0, _util.setVerbosityLevel)(data.verbosity);
  85. });
  86. handler.on("GetDocRequest", function wphSetupDoc(data) {
  87. return WorkerMessageHandler.createDocumentHandler(data, port);
  88. });
  89. }
  90. static createDocumentHandler(docParams, port) {
  91. let pdfManager;
  92. let terminated = false;
  93. let cancelXHRs = null;
  94. const WorkerTasks = [];
  95. const verbosity = (0, _util.getVerbosityLevel)();
  96. const apiVersion = docParams.apiVersion;
  97. const workerVersion = '2.15.349';
  98. if (apiVersion !== workerVersion) {
  99. throw new Error(`The API version "${apiVersion}" does not match ` + `the Worker version "${workerVersion}".`);
  100. }
  101. const enumerableProperties = [];
  102. for (const property in []) {
  103. enumerableProperties.push(property);
  104. }
  105. if (enumerableProperties.length) {
  106. throw new Error("The `Array.prototype` contains unexpected enumerable properties: " + enumerableProperties.join(", ") + "; thus breaking e.g. `for...in` iteration of `Array`s.");
  107. }
  108. if (typeof ReadableStream === "undefined") {
  109. const partialMsg = "The browser/environment lacks native support for critical " + "functionality used by the PDF.js library (e.g. `ReadableStream`); ";
  110. if (_is_node.isNodeJS) {
  111. throw new Error(partialMsg + "please use a `legacy`-build instead.");
  112. }
  113. throw new Error(partialMsg + "please update to a supported browser.");
  114. }
  115. const docId = docParams.docId;
  116. const docBaseUrl = docParams.docBaseUrl;
  117. const workerHandlerName = docParams.docId + "_worker";
  118. let handler = new _message_handler.MessageHandler(workerHandlerName, docId, port);
  119. function ensureNotTerminated() {
  120. if (terminated) {
  121. throw new Error("Worker was terminated");
  122. }
  123. }
  124. function startWorkerTask(task) {
  125. WorkerTasks.push(task);
  126. }
  127. function finishWorkerTask(task) {
  128. task.finish();
  129. const i = WorkerTasks.indexOf(task);
  130. WorkerTasks.splice(i, 1);
  131. }
  132. async function loadDocument(recoveryMode) {
  133. await pdfManager.ensureDoc("checkHeader");
  134. await pdfManager.ensureDoc("parseStartXRef");
  135. await pdfManager.ensureDoc("parse", [recoveryMode]);
  136. await pdfManager.ensureDoc("checkFirstPage", [recoveryMode]);
  137. await pdfManager.ensureDoc("checkLastPage", [recoveryMode]);
  138. const isPureXfa = await pdfManager.ensureDoc("isPureXfa");
  139. if (isPureXfa) {
  140. const task = new WorkerTask("loadXfaFonts");
  141. startWorkerTask(task);
  142. await Promise.all([pdfManager.loadXfaFonts(handler, task).catch(reason => {}).then(() => finishWorkerTask(task)), pdfManager.loadXfaImages()]);
  143. }
  144. const [numPages, fingerprints] = await Promise.all([pdfManager.ensureDoc("numPages"), pdfManager.ensureDoc("fingerprints")]);
  145. const htmlForXfa = isPureXfa ? await pdfManager.ensureDoc("htmlForXfa") : null;
  146. return {
  147. numPages,
  148. fingerprints,
  149. htmlForXfa
  150. };
  151. }
  152. function getPdfManager(data, evaluatorOptions, enableXfa) {
  153. const pdfManagerCapability = (0, _util.createPromiseCapability)();
  154. let newPdfManager;
  155. const source = data.source;
  156. if (source.data) {
  157. try {
  158. newPdfManager = new _pdf_manager.LocalPdfManager(docId, source.data, source.password, handler, evaluatorOptions, enableXfa, docBaseUrl);
  159. pdfManagerCapability.resolve(newPdfManager);
  160. } catch (ex) {
  161. pdfManagerCapability.reject(ex);
  162. }
  163. return pdfManagerCapability.promise;
  164. }
  165. let pdfStream,
  166. cachedChunks = [];
  167. try {
  168. pdfStream = new _worker_stream.PDFWorkerStream(handler);
  169. } catch (ex) {
  170. pdfManagerCapability.reject(ex);
  171. return pdfManagerCapability.promise;
  172. }
  173. const fullRequest = pdfStream.getFullReader();
  174. fullRequest.headersReady.then(function () {
  175. if (!fullRequest.isRangeSupported) {
  176. return;
  177. }
  178. const disableAutoFetch = source.disableAutoFetch || fullRequest.isStreamingSupported;
  179. newPdfManager = new _pdf_manager.NetworkPdfManager(docId, pdfStream, {
  180. msgHandler: handler,
  181. password: source.password,
  182. length: fullRequest.contentLength,
  183. disableAutoFetch,
  184. rangeChunkSize: source.rangeChunkSize
  185. }, evaluatorOptions, enableXfa, docBaseUrl);
  186. for (const chunk of cachedChunks) {
  187. newPdfManager.sendProgressiveData(chunk);
  188. }
  189. cachedChunks = [];
  190. pdfManagerCapability.resolve(newPdfManager);
  191. cancelXHRs = null;
  192. }).catch(function (reason) {
  193. pdfManagerCapability.reject(reason);
  194. cancelXHRs = null;
  195. });
  196. let loaded = 0;
  197. const flushChunks = function () {
  198. const pdfFile = (0, _util.arraysToBytes)(cachedChunks);
  199. if (source.length && pdfFile.length !== source.length) {
  200. (0, _util.warn)("reported HTTP length is different from actual");
  201. }
  202. try {
  203. newPdfManager = new _pdf_manager.LocalPdfManager(docId, pdfFile, source.password, handler, evaluatorOptions, enableXfa, docBaseUrl);
  204. pdfManagerCapability.resolve(newPdfManager);
  205. } catch (ex) {
  206. pdfManagerCapability.reject(ex);
  207. }
  208. cachedChunks = [];
  209. };
  210. const readPromise = new Promise(function (resolve, reject) {
  211. const readChunk = function ({
  212. value,
  213. done
  214. }) {
  215. try {
  216. ensureNotTerminated();
  217. if (done) {
  218. if (!newPdfManager) {
  219. flushChunks();
  220. }
  221. cancelXHRs = null;
  222. return;
  223. }
  224. loaded += (0, _util.arrayByteLength)(value);
  225. if (!fullRequest.isStreamingSupported) {
  226. handler.send("DocProgress", {
  227. loaded,
  228. total: Math.max(loaded, fullRequest.contentLength || 0)
  229. });
  230. }
  231. if (newPdfManager) {
  232. newPdfManager.sendProgressiveData(value);
  233. } else {
  234. cachedChunks.push(value);
  235. }
  236. fullRequest.read().then(readChunk, reject);
  237. } catch (e) {
  238. reject(e);
  239. }
  240. };
  241. fullRequest.read().then(readChunk, reject);
  242. });
  243. readPromise.catch(function (e) {
  244. pdfManagerCapability.reject(e);
  245. cancelXHRs = null;
  246. });
  247. cancelXHRs = function (reason) {
  248. pdfStream.cancelAllRequests(reason);
  249. };
  250. return pdfManagerCapability.promise;
  251. }
  252. function setupDoc(data) {
  253. function onSuccess(doc) {
  254. ensureNotTerminated();
  255. handler.send("GetDoc", {
  256. pdfInfo: doc
  257. });
  258. }
  259. function onFailure(ex) {
  260. ensureNotTerminated();
  261. if (ex instanceof _util.PasswordException) {
  262. const task = new WorkerTask(`PasswordException: response ${ex.code}`);
  263. startWorkerTask(task);
  264. handler.sendWithPromise("PasswordRequest", ex).then(function ({
  265. password
  266. }) {
  267. finishWorkerTask(task);
  268. pdfManager.updatePassword(password);
  269. pdfManagerReady();
  270. }).catch(function () {
  271. finishWorkerTask(task);
  272. handler.send("DocException", ex);
  273. });
  274. } else if (ex instanceof _util.InvalidPDFException || ex instanceof _util.MissingPDFException || ex instanceof _util.UnexpectedResponseException || ex instanceof _util.UnknownErrorException) {
  275. handler.send("DocException", ex);
  276. } else {
  277. handler.send("DocException", new _util.UnknownErrorException(ex.message, ex.toString()));
  278. }
  279. }
  280. function pdfManagerReady() {
  281. ensureNotTerminated();
  282. loadDocument(false).then(onSuccess, function (reason) {
  283. ensureNotTerminated();
  284. if (!(reason instanceof _core_utils.XRefParseException)) {
  285. onFailure(reason);
  286. return;
  287. }
  288. pdfManager.requestLoadedStream();
  289. pdfManager.onLoadedStream().then(function () {
  290. ensureNotTerminated();
  291. loadDocument(true).then(onSuccess, onFailure);
  292. });
  293. });
  294. }
  295. ensureNotTerminated();
  296. const evaluatorOptions = {
  297. maxImageSize: data.maxImageSize,
  298. disableFontFace: data.disableFontFace,
  299. ignoreErrors: data.ignoreErrors,
  300. isEvalSupported: data.isEvalSupported,
  301. fontExtraProperties: data.fontExtraProperties,
  302. useSystemFonts: data.useSystemFonts,
  303. cMapUrl: data.cMapUrl,
  304. standardFontDataUrl: data.standardFontDataUrl
  305. };
  306. getPdfManager(data, evaluatorOptions, data.enableXfa).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.onLoadedStream().then(function (stream) {
  313. handler.send("DataLoaded", {
  314. length: stream.bytes.byteLength
  315. });
  316. });
  317. }).then(pdfManagerReady, onFailure);
  318. }
  319. handler.on("GetPage", function wphSetupGetPage(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 ([rotate, ref, userUnit, view]) {
  322. return {
  323. rotate,
  324. ref,
  325. userUnit,
  326. view
  327. };
  328. });
  329. });
  330. });
  331. handler.on("GetPageIndex", function wphSetupGetPageIndex(data) {
  332. const pageRef = _primitives.Ref.get(data.num, data.gen);
  333. return pdfManager.ensureCatalog("getPageIndex", [pageRef]);
  334. });
  335. handler.on("GetDestinations", function wphSetupGetDestinations(data) {
  336. return pdfManager.ensureCatalog("destinations");
  337. });
  338. handler.on("GetDestination", function wphSetupGetDestination(data) {
  339. return pdfManager.ensureCatalog("getDestination", [data.id]);
  340. });
  341. handler.on("GetPageLabels", function wphSetupGetPageLabels(data) {
  342. return pdfManager.ensureCatalog("pageLabels");
  343. });
  344. handler.on("GetPageLayout", function wphSetupGetPageLayout(data) {
  345. return pdfManager.ensureCatalog("pageLayout");
  346. });
  347. handler.on("GetPageMode", function wphSetupGetPageMode(data) {
  348. return pdfManager.ensureCatalog("pageMode");
  349. });
  350. handler.on("GetViewerPreferences", function (data) {
  351. return pdfManager.ensureCatalog("viewerPreferences");
  352. });
  353. handler.on("GetOpenAction", function (data) {
  354. return pdfManager.ensureCatalog("openAction");
  355. });
  356. handler.on("GetAttachments", function wphSetupGetAttachments(data) {
  357. return pdfManager.ensureCatalog("attachments");
  358. });
  359. handler.on("GetJavaScript", function wphSetupGetJavaScript(data) {
  360. return pdfManager.ensureCatalog("javaScript");
  361. });
  362. handler.on("GetDocJSActions", function wphSetupGetDocJSActions(data) {
  363. return pdfManager.ensureCatalog("jsActions");
  364. });
  365. handler.on("GetPageJSActions", function ({
  366. pageIndex
  367. }) {
  368. return pdfManager.getPage(pageIndex).then(function (page) {
  369. return pdfManager.ensure(page, "jsActions");
  370. });
  371. });
  372. handler.on("GetOutline", function wphSetupGetOutline(data) {
  373. return pdfManager.ensureCatalog("documentOutline");
  374. });
  375. handler.on("GetOptionalContentConfig", function (data) {
  376. return pdfManager.ensureCatalog("optionalContentConfig");
  377. });
  378. handler.on("GetPermissions", function (data) {
  379. return pdfManager.ensureCatalog("permissions");
  380. });
  381. handler.on("GetMetadata", function wphSetupGetMetadata(data) {
  382. return Promise.all([pdfManager.ensureDoc("documentInfo"), pdfManager.ensureCatalog("metadata")]);
  383. });
  384. handler.on("GetMarkInfo", function wphSetupGetMarkInfo(data) {
  385. return pdfManager.ensureCatalog("markInfo");
  386. });
  387. handler.on("GetData", function wphSetupGetData(data) {
  388. pdfManager.requestLoadedStream();
  389. return pdfManager.onLoadedStream().then(function (stream) {
  390. return stream.bytes;
  391. });
  392. });
  393. handler.on("GetAnnotations", function ({
  394. pageIndex,
  395. intent
  396. }) {
  397. return pdfManager.getPage(pageIndex).then(function (page) {
  398. return page.getAnnotationsData(intent);
  399. });
  400. });
  401. handler.on("GetFieldObjects", function (data) {
  402. return pdfManager.ensureDoc("fieldObjects");
  403. });
  404. handler.on("HasJSActions", function (data) {
  405. return pdfManager.ensureDoc("hasJSActions");
  406. });
  407. handler.on("GetCalculationOrderIds", function (data) {
  408. return pdfManager.ensureDoc("calculationOrderIds");
  409. });
  410. handler.on("SaveDocument", function ({
  411. isPureXfa,
  412. numPages,
  413. annotationStorage,
  414. filename
  415. }) {
  416. pdfManager.requestLoadedStream();
  417. const newAnnotationsByPage = !isPureXfa ? (0, _core_utils.getNewAnnotationsMap)(annotationStorage) : null;
  418. const promises = [pdfManager.onLoadedStream(), pdfManager.ensureCatalog("acroForm"), pdfManager.ensureCatalog("acroFormRef"), pdfManager.ensureDoc("xref"), pdfManager.ensureDoc("startXRef")];
  419. if (newAnnotationsByPage) {
  420. for (const [pageIndex, annotations] of newAnnotationsByPage) {
  421. promises.push(pdfManager.getPage(pageIndex).then(page => {
  422. const task = new WorkerTask(`Save (editor): page ${pageIndex}`);
  423. return page.saveNewAnnotations(handler, task, annotations).finally(function () {
  424. finishWorkerTask(task);
  425. });
  426. }));
  427. }
  428. }
  429. if (isPureXfa) {
  430. promises.push(pdfManager.serializeXfaData(annotationStorage));
  431. } else {
  432. for (let pageIndex = 0; pageIndex < numPages; pageIndex++) {
  433. promises.push(pdfManager.getPage(pageIndex).then(function (page) {
  434. const task = new WorkerTask(`Save: page ${pageIndex}`);
  435. return page.save(handler, task, annotationStorage).finally(function () {
  436. finishWorkerTask(task);
  437. });
  438. }));
  439. }
  440. }
  441. return Promise.all(promises).then(function ([stream, acroForm, acroFormRef, xref, startXRef, ...refs]) {
  442. let newRefs = [];
  443. let xfaData = null;
  444. if (isPureXfa) {
  445. xfaData = refs[0];
  446. if (!xfaData) {
  447. return stream.bytes;
  448. }
  449. } else {
  450. newRefs = refs.flat(2);
  451. if (newRefs.length === 0) {
  452. return stream.bytes;
  453. }
  454. }
  455. const xfa = acroForm instanceof _primitives.Dict && acroForm.get("XFA") || null;
  456. let xfaDatasetsRef = null;
  457. let hasXfaDatasetsEntry = false;
  458. if (Array.isArray(xfa)) {
  459. for (let i = 0, ii = xfa.length; i < ii; i += 2) {
  460. if (xfa[i] === "datasets") {
  461. xfaDatasetsRef = xfa[i + 1];
  462. acroFormRef = null;
  463. hasXfaDatasetsEntry = true;
  464. }
  465. }
  466. if (xfaDatasetsRef === null) {
  467. xfaDatasetsRef = xref.getNewRef();
  468. }
  469. } else if (xfa) {
  470. acroFormRef = null;
  471. (0, _util.warn)("Unsupported XFA type.");
  472. }
  473. let newXrefInfo = Object.create(null);
  474. if (xref.trailer) {
  475. const infoObj = Object.create(null);
  476. const xrefInfo = xref.trailer.get("Info") || null;
  477. if (xrefInfo instanceof _primitives.Dict) {
  478. xrefInfo.forEach((key, value) => {
  479. if (typeof value === "string") {
  480. infoObj[key] = (0, _util.stringToPDFString)(value);
  481. }
  482. });
  483. }
  484. newXrefInfo = {
  485. rootRef: xref.trailer.getRaw("Root") || null,
  486. encryptRef: xref.trailer.getRaw("Encrypt") || null,
  487. newRef: xref.getNewRef(),
  488. infoRef: xref.trailer.getRaw("Info") || null,
  489. info: infoObj,
  490. fileIds: xref.trailer.get("ID") || null,
  491. startXRef,
  492. filename
  493. };
  494. }
  495. xref.resetNewRef();
  496. return (0, _writer.incrementalUpdate)({
  497. originalData: stream.bytes,
  498. xrefInfo: newXrefInfo,
  499. newRefs,
  500. xref,
  501. hasXfa: !!xfa,
  502. xfaDatasetsRef,
  503. hasXfaDatasetsEntry,
  504. acroFormRef,
  505. acroForm,
  506. xfaData
  507. });
  508. });
  509. });
  510. handler.on("GetOperatorList", function wphSetupRenderPage(data, sink) {
  511. const pageIndex = data.pageIndex;
  512. pdfManager.getPage(pageIndex).then(function (page) {
  513. const task = new WorkerTask(`GetOperatorList: page ${pageIndex}`);
  514. startWorkerTask(task);
  515. const start = verbosity >= _util.VerbosityLevel.INFOS ? Date.now() : 0;
  516. page.getOperatorList({
  517. handler,
  518. sink,
  519. task,
  520. intent: data.intent,
  521. cacheKey: data.cacheKey,
  522. annotationStorage: data.annotationStorage
  523. }).then(function (operatorListInfo) {
  524. finishWorkerTask(task);
  525. if (start) {
  526. (0, _util.info)(`page=${pageIndex + 1} - getOperatorList: time=` + `${Date.now() - start}ms, len=${operatorListInfo.length}`);
  527. }
  528. sink.close();
  529. }, function (reason) {
  530. finishWorkerTask(task);
  531. if (task.terminated) {
  532. return;
  533. }
  534. handler.send("UnsupportedFeature", {
  535. featureId: _util.UNSUPPORTED_FEATURES.errorOperatorList
  536. });
  537. sink.error(reason);
  538. });
  539. });
  540. });
  541. handler.on("GetTextContent", function wphExtractText(data, sink) {
  542. const pageIndex = data.pageIndex;
  543. pdfManager.getPage(pageIndex).then(function (page) {
  544. const task = new WorkerTask("GetTextContent: page " + pageIndex);
  545. startWorkerTask(task);
  546. const start = verbosity >= _util.VerbosityLevel.INFOS ? Date.now() : 0;
  547. page.extractTextContent({
  548. handler,
  549. task,
  550. sink,
  551. includeMarkedContent: data.includeMarkedContent,
  552. combineTextItems: data.combineTextItems
  553. }).then(function () {
  554. finishWorkerTask(task);
  555. if (start) {
  556. (0, _util.info)(`page=${pageIndex + 1} - getTextContent: time=` + `${Date.now() - start}ms`);
  557. }
  558. sink.close();
  559. }, function (reason) {
  560. finishWorkerTask(task);
  561. if (task.terminated) {
  562. return;
  563. }
  564. sink.error(reason);
  565. });
  566. });
  567. });
  568. handler.on("GetStructTree", function wphGetStructTree(data) {
  569. return pdfManager.getPage(data.pageIndex).then(function (page) {
  570. return pdfManager.ensure(page, "getStructTree");
  571. });
  572. });
  573. handler.on("FontFallback", function (data) {
  574. return pdfManager.fontFallback(data.id, handler);
  575. });
  576. handler.on("Cleanup", function wphCleanup(data) {
  577. return pdfManager.cleanup(true);
  578. });
  579. handler.on("Terminate", function wphTerminate(data) {
  580. terminated = true;
  581. const waitOn = [];
  582. if (pdfManager) {
  583. pdfManager.terminate(new _util.AbortException("Worker was terminated."));
  584. const cleanupPromise = pdfManager.cleanup();
  585. waitOn.push(cleanupPromise);
  586. pdfManager = null;
  587. } else {
  588. (0, _cleanup_helper.clearGlobalCaches)();
  589. }
  590. if (cancelXHRs) {
  591. cancelXHRs(new _util.AbortException("Worker was terminated."));
  592. }
  593. for (const task of WorkerTasks) {
  594. waitOn.push(task.finished);
  595. task.terminate();
  596. }
  597. return Promise.all(waitOn).then(function () {
  598. handler.destroy();
  599. handler = null;
  600. });
  601. });
  602. handler.on("Ready", function wphReady(data) {
  603. setupDoc(docParams);
  604. docParams = null;
  605. });
  606. return workerHandlerName;
  607. }
  608. static initializeFromPort(port) {
  609. const handler = new _message_handler.MessageHandler("worker", "main", port);
  610. WorkerMessageHandler.setup(handler, port);
  611. handler.send("ready", null);
  612. }
  613. }
  614. exports.WorkerMessageHandler = WorkerMessageHandler;
  615. function isMessagePort(maybePort) {
  616. return typeof maybePort.postMessage === "function" && "onmessage" in maybePort;
  617. }
  618. if (typeof window === "undefined" && !_is_node.isNodeJS && typeof self !== "undefined" && isMessagePort(self)) {
  619. WorkerMessageHandler.initializeFromPort(self);
  620. }
  621. /***/ }),
  622. /* 2 */
  623. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  624. Object.defineProperty(exports, "__esModule", ({
  625. value: true
  626. }));
  627. exports.VerbosityLevel = exports.Util = exports.UnknownErrorException = exports.UnexpectedResponseException = exports.UNSUPPORTED_FEATURES = exports.TextRenderingMode = exports.StreamType = exports.RenderingIntentFlag = exports.PermissionFlag = exports.PasswordResponses = exports.PasswordException = exports.PageActionEventType = exports.OPS = exports.MissingPDFException = exports.LINE_FACTOR = exports.LINE_DESCENT_FACTOR = exports.InvalidPDFException = exports.ImageKind = exports.IDENTITY_MATRIX = exports.FormatError = exports.FontType = exports.FeatureTest = exports.FONT_IDENTITY_MATRIX = exports.DocumentActionEventType = exports.CMapCompressionType = exports.BaseException = exports.AnnotationType = exports.AnnotationStateModelType = exports.AnnotationReviewState = exports.AnnotationReplyType = exports.AnnotationMode = exports.AnnotationMarkedState = exports.AnnotationFlag = exports.AnnotationFieldFlag = exports.AnnotationEditorType = exports.AnnotationEditorPrefix = exports.AnnotationEditorParamsType = exports.AnnotationBorderStyleType = exports.AnnotationActionEventType = exports.AbortException = void 0;
  628. exports.arrayByteLength = arrayByteLength;
  629. exports.arraysToBytes = arraysToBytes;
  630. exports.assert = assert;
  631. exports.bytesToString = bytesToString;
  632. exports.createPromiseCapability = createPromiseCapability;
  633. exports.createValidAbsoluteUrl = createValidAbsoluteUrl;
  634. exports.escapeString = escapeString;
  635. exports.getModificationDate = getModificationDate;
  636. exports.getVerbosityLevel = getVerbosityLevel;
  637. exports.info = info;
  638. exports.isArrayBuffer = isArrayBuffer;
  639. exports.isArrayEqual = isArrayEqual;
  640. exports.isAscii = isAscii;
  641. exports.objectFromMap = objectFromMap;
  642. exports.objectSize = objectSize;
  643. exports.setVerbosityLevel = setVerbosityLevel;
  644. exports.shadow = shadow;
  645. exports.string32 = string32;
  646. exports.stringToBytes = stringToBytes;
  647. exports.stringToPDFString = stringToPDFString;
  648. exports.stringToUTF16BEString = stringToUTF16BEString;
  649. exports.stringToUTF8String = stringToUTF8String;
  650. exports.unreachable = unreachable;
  651. exports.utf8StringToString = utf8StringToString;
  652. exports.warn = warn;
  653. __w_pdfjs_require__(3);
  654. const IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];
  655. exports.IDENTITY_MATRIX = IDENTITY_MATRIX;
  656. const FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0];
  657. exports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX;
  658. const LINE_FACTOR = 1.35;
  659. exports.LINE_FACTOR = LINE_FACTOR;
  660. const LINE_DESCENT_FACTOR = 0.35;
  661. exports.LINE_DESCENT_FACTOR = LINE_DESCENT_FACTOR;
  662. const RenderingIntentFlag = {
  663. ANY: 0x01,
  664. DISPLAY: 0x02,
  665. PRINT: 0x04,
  666. ANNOTATIONS_FORMS: 0x10,
  667. ANNOTATIONS_STORAGE: 0x20,
  668. ANNOTATIONS_DISABLE: 0x40,
  669. OPLIST: 0x100
  670. };
  671. exports.RenderingIntentFlag = RenderingIntentFlag;
  672. const AnnotationMode = {
  673. DISABLE: 0,
  674. ENABLE: 1,
  675. ENABLE_FORMS: 2,
  676. ENABLE_STORAGE: 3
  677. };
  678. exports.AnnotationMode = AnnotationMode;
  679. const AnnotationEditorPrefix = "pdfjs_internal_editor_";
  680. exports.AnnotationEditorPrefix = AnnotationEditorPrefix;
  681. const AnnotationEditorType = {
  682. DISABLE: -1,
  683. NONE: 0,
  684. FREETEXT: 3,
  685. INK: 15
  686. };
  687. exports.AnnotationEditorType = AnnotationEditorType;
  688. const AnnotationEditorParamsType = {
  689. FREETEXT_SIZE: 1,
  690. FREETEXT_COLOR: 2,
  691. FREETEXT_OPACITY: 3,
  692. INK_COLOR: 11,
  693. INK_THICKNESS: 12,
  694. INK_OPACITY: 13
  695. };
  696. exports.AnnotationEditorParamsType = AnnotationEditorParamsType;
  697. const PermissionFlag = {
  698. PRINT: 0x04,
  699. MODIFY_CONTENTS: 0x08,
  700. COPY: 0x10,
  701. MODIFY_ANNOTATIONS: 0x20,
  702. FILL_INTERACTIVE_FORMS: 0x100,
  703. COPY_FOR_ACCESSIBILITY: 0x200,
  704. ASSEMBLE: 0x400,
  705. PRINT_HIGH_QUALITY: 0x800
  706. };
  707. exports.PermissionFlag = PermissionFlag;
  708. const TextRenderingMode = {
  709. FILL: 0,
  710. STROKE: 1,
  711. FILL_STROKE: 2,
  712. INVISIBLE: 3,
  713. FILL_ADD_TO_PATH: 4,
  714. STROKE_ADD_TO_PATH: 5,
  715. FILL_STROKE_ADD_TO_PATH: 6,
  716. ADD_TO_PATH: 7,
  717. FILL_STROKE_MASK: 3,
  718. ADD_TO_PATH_FLAG: 4
  719. };
  720. exports.TextRenderingMode = TextRenderingMode;
  721. const ImageKind = {
  722. GRAYSCALE_1BPP: 1,
  723. RGB_24BPP: 2,
  724. RGBA_32BPP: 3
  725. };
  726. exports.ImageKind = ImageKind;
  727. const AnnotationType = {
  728. TEXT: 1,
  729. LINK: 2,
  730. FREETEXT: 3,
  731. LINE: 4,
  732. SQUARE: 5,
  733. CIRCLE: 6,
  734. POLYGON: 7,
  735. POLYLINE: 8,
  736. HIGHLIGHT: 9,
  737. UNDERLINE: 10,
  738. SQUIGGLY: 11,
  739. STRIKEOUT: 12,
  740. STAMP: 13,
  741. CARET: 14,
  742. INK: 15,
  743. POPUP: 16,
  744. FILEATTACHMENT: 17,
  745. SOUND: 18,
  746. MOVIE: 19,
  747. WIDGET: 20,
  748. SCREEN: 21,
  749. PRINTERMARK: 22,
  750. TRAPNET: 23,
  751. WATERMARK: 24,
  752. THREED: 25,
  753. REDACT: 26
  754. };
  755. exports.AnnotationType = AnnotationType;
  756. const AnnotationStateModelType = {
  757. MARKED: "Marked",
  758. REVIEW: "Review"
  759. };
  760. exports.AnnotationStateModelType = AnnotationStateModelType;
  761. const AnnotationMarkedState = {
  762. MARKED: "Marked",
  763. UNMARKED: "Unmarked"
  764. };
  765. exports.AnnotationMarkedState = AnnotationMarkedState;
  766. const AnnotationReviewState = {
  767. ACCEPTED: "Accepted",
  768. REJECTED: "Rejected",
  769. CANCELLED: "Cancelled",
  770. COMPLETED: "Completed",
  771. NONE: "None"
  772. };
  773. exports.AnnotationReviewState = AnnotationReviewState;
  774. const AnnotationReplyType = {
  775. GROUP: "Group",
  776. REPLY: "R"
  777. };
  778. exports.AnnotationReplyType = AnnotationReplyType;
  779. const AnnotationFlag = {
  780. INVISIBLE: 0x01,
  781. HIDDEN: 0x02,
  782. PRINT: 0x04,
  783. NOZOOM: 0x08,
  784. NOROTATE: 0x10,
  785. NOVIEW: 0x20,
  786. READONLY: 0x40,
  787. LOCKED: 0x80,
  788. TOGGLENOVIEW: 0x100,
  789. LOCKEDCONTENTS: 0x200
  790. };
  791. exports.AnnotationFlag = AnnotationFlag;
  792. const AnnotationFieldFlag = {
  793. READONLY: 0x0000001,
  794. REQUIRED: 0x0000002,
  795. NOEXPORT: 0x0000004,
  796. MULTILINE: 0x0001000,
  797. PASSWORD: 0x0002000,
  798. NOTOGGLETOOFF: 0x0004000,
  799. RADIO: 0x0008000,
  800. PUSHBUTTON: 0x0010000,
  801. COMBO: 0x0020000,
  802. EDIT: 0x0040000,
  803. SORT: 0x0080000,
  804. FILESELECT: 0x0100000,
  805. MULTISELECT: 0x0200000,
  806. DONOTSPELLCHECK: 0x0400000,
  807. DONOTSCROLL: 0x0800000,
  808. COMB: 0x1000000,
  809. RICHTEXT: 0x2000000,
  810. RADIOSINUNISON: 0x2000000,
  811. COMMITONSELCHANGE: 0x4000000
  812. };
  813. exports.AnnotationFieldFlag = AnnotationFieldFlag;
  814. const AnnotationBorderStyleType = {
  815. SOLID: 1,
  816. DASHED: 2,
  817. BEVELED: 3,
  818. INSET: 4,
  819. UNDERLINE: 5
  820. };
  821. exports.AnnotationBorderStyleType = AnnotationBorderStyleType;
  822. const AnnotationActionEventType = {
  823. E: "Mouse Enter",
  824. X: "Mouse Exit",
  825. D: "Mouse Down",
  826. U: "Mouse Up",
  827. Fo: "Focus",
  828. Bl: "Blur",
  829. PO: "PageOpen",
  830. PC: "PageClose",
  831. PV: "PageVisible",
  832. PI: "PageInvisible",
  833. K: "Keystroke",
  834. F: "Format",
  835. V: "Validate",
  836. C: "Calculate"
  837. };
  838. exports.AnnotationActionEventType = AnnotationActionEventType;
  839. const DocumentActionEventType = {
  840. WC: "WillClose",
  841. WS: "WillSave",
  842. DS: "DidSave",
  843. WP: "WillPrint",
  844. DP: "DidPrint"
  845. };
  846. exports.DocumentActionEventType = DocumentActionEventType;
  847. const PageActionEventType = {
  848. O: "PageOpen",
  849. C: "PageClose"
  850. };
  851. exports.PageActionEventType = PageActionEventType;
  852. const StreamType = {
  853. UNKNOWN: "UNKNOWN",
  854. FLATE: "FLATE",
  855. LZW: "LZW",
  856. DCT: "DCT",
  857. JPX: "JPX",
  858. JBIG: "JBIG",
  859. A85: "A85",
  860. AHX: "AHX",
  861. CCF: "CCF",
  862. RLX: "RLX"
  863. };
  864. exports.StreamType = StreamType;
  865. const FontType = {
  866. UNKNOWN: "UNKNOWN",
  867. TYPE1: "TYPE1",
  868. TYPE1STANDARD: "TYPE1STANDARD",
  869. TYPE1C: "TYPE1C",
  870. CIDFONTTYPE0: "CIDFONTTYPE0",
  871. CIDFONTTYPE0C: "CIDFONTTYPE0C",
  872. TRUETYPE: "TRUETYPE",
  873. CIDFONTTYPE2: "CIDFONTTYPE2",
  874. TYPE3: "TYPE3",
  875. OPENTYPE: "OPENTYPE",
  876. TYPE0: "TYPE0",
  877. MMTYPE1: "MMTYPE1"
  878. };
  879. exports.FontType = FontType;
  880. const VerbosityLevel = {
  881. ERRORS: 0,
  882. WARNINGS: 1,
  883. INFOS: 5
  884. };
  885. exports.VerbosityLevel = VerbosityLevel;
  886. const CMapCompressionType = {
  887. NONE: 0,
  888. BINARY: 1,
  889. STREAM: 2
  890. };
  891. exports.CMapCompressionType = CMapCompressionType;
  892. const OPS = {
  893. dependency: 1,
  894. setLineWidth: 2,
  895. setLineCap: 3,
  896. setLineJoin: 4,
  897. setMiterLimit: 5,
  898. setDash: 6,
  899. setRenderingIntent: 7,
  900. setFlatness: 8,
  901. setGState: 9,
  902. save: 10,
  903. restore: 11,
  904. transform: 12,
  905. moveTo: 13,
  906. lineTo: 14,
  907. curveTo: 15,
  908. curveTo2: 16,
  909. curveTo3: 17,
  910. closePath: 18,
  911. rectangle: 19,
  912. stroke: 20,
  913. closeStroke: 21,
  914. fill: 22,
  915. eoFill: 23,
  916. fillStroke: 24,
  917. eoFillStroke: 25,
  918. closeFillStroke: 26,
  919. closeEOFillStroke: 27,
  920. endPath: 28,
  921. clip: 29,
  922. eoClip: 30,
  923. beginText: 31,
  924. endText: 32,
  925. setCharSpacing: 33,
  926. setWordSpacing: 34,
  927. setHScale: 35,
  928. setLeading: 36,
  929. setFont: 37,
  930. setTextRenderingMode: 38,
  931. setTextRise: 39,
  932. moveText: 40,
  933. setLeadingMoveText: 41,
  934. setTextMatrix: 42,
  935. nextLine: 43,
  936. showText: 44,
  937. showSpacedText: 45,
  938. nextLineShowText: 46,
  939. nextLineSetSpacingShowText: 47,
  940. setCharWidth: 48,
  941. setCharWidthAndBounds: 49,
  942. setStrokeColorSpace: 50,
  943. setFillColorSpace: 51,
  944. setStrokeColor: 52,
  945. setStrokeColorN: 53,
  946. setFillColor: 54,
  947. setFillColorN: 55,
  948. setStrokeGray: 56,
  949. setFillGray: 57,
  950. setStrokeRGBColor: 58,
  951. setFillRGBColor: 59,
  952. setStrokeCMYKColor: 60,
  953. setFillCMYKColor: 61,
  954. shadingFill: 62,
  955. beginInlineImage: 63,
  956. beginImageData: 64,
  957. endInlineImage: 65,
  958. paintXObject: 66,
  959. markPoint: 67,
  960. markPointProps: 68,
  961. beginMarkedContent: 69,
  962. beginMarkedContentProps: 70,
  963. endMarkedContent: 71,
  964. beginCompat: 72,
  965. endCompat: 73,
  966. paintFormXObjectBegin: 74,
  967. paintFormXObjectEnd: 75,
  968. beginGroup: 76,
  969. endGroup: 77,
  970. beginAnnotations: 78,
  971. endAnnotations: 79,
  972. beginAnnotation: 80,
  973. endAnnotation: 81,
  974. paintJpegXObject: 82,
  975. paintImageMaskXObject: 83,
  976. paintImageMaskXObjectGroup: 84,
  977. paintImageXObject: 85,
  978. paintInlineImageXObject: 86,
  979. paintInlineImageXObjectGroup: 87,
  980. paintImageXObjectRepeat: 88,
  981. paintImageMaskXObjectRepeat: 89,
  982. paintSolidColorImageMask: 90,
  983. constructPath: 91
  984. };
  985. exports.OPS = OPS;
  986. const UNSUPPORTED_FEATURES = {
  987. unknown: "unknown",
  988. forms: "forms",
  989. javaScript: "javaScript",
  990. signatures: "signatures",
  991. smask: "smask",
  992. shadingPattern: "shadingPattern",
  993. font: "font",
  994. errorTilingPattern: "errorTilingPattern",
  995. errorExtGState: "errorExtGState",
  996. errorXObject: "errorXObject",
  997. errorFontLoadType3: "errorFontLoadType3",
  998. errorFontState: "errorFontState",
  999. errorFontMissing: "errorFontMissing",
  1000. errorFontTranslate: "errorFontTranslate",
  1001. errorColorSpace: "errorColorSpace",
  1002. errorOperatorList: "errorOperatorList",
  1003. errorFontToUnicode: "errorFontToUnicode",
  1004. errorFontLoadNative: "errorFontLoadNative",
  1005. errorFontBuildPath: "errorFontBuildPath",
  1006. errorFontGetPath: "errorFontGetPath",
  1007. errorMarkedContent: "errorMarkedContent",
  1008. errorContentSubStream: "errorContentSubStream"
  1009. };
  1010. exports.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES;
  1011. const PasswordResponses = {
  1012. NEED_PASSWORD: 1,
  1013. INCORRECT_PASSWORD: 2
  1014. };
  1015. exports.PasswordResponses = PasswordResponses;
  1016. let verbosity = VerbosityLevel.WARNINGS;
  1017. function setVerbosityLevel(level) {
  1018. if (Number.isInteger(level)) {
  1019. verbosity = level;
  1020. }
  1021. }
  1022. function getVerbosityLevel() {
  1023. return verbosity;
  1024. }
  1025. function info(msg) {
  1026. if (verbosity >= VerbosityLevel.INFOS) {
  1027. console.log(`Info: ${msg}`);
  1028. }
  1029. }
  1030. function warn(msg) {
  1031. if (verbosity >= VerbosityLevel.WARNINGS) {
  1032. console.log(`Warning: ${msg}`);
  1033. }
  1034. }
  1035. function unreachable(msg) {
  1036. throw new Error(msg);
  1037. }
  1038. function assert(cond, msg) {
  1039. if (!cond) {
  1040. unreachable(msg);
  1041. }
  1042. }
  1043. function _isValidProtocol(url) {
  1044. if (!url) {
  1045. return false;
  1046. }
  1047. switch (url.protocol) {
  1048. case "http:":
  1049. case "https:":
  1050. case "ftp:":
  1051. case "mailto:":
  1052. case "tel:":
  1053. return true;
  1054. default:
  1055. return false;
  1056. }
  1057. }
  1058. function createValidAbsoluteUrl(url, baseUrl = null, options = null) {
  1059. if (!url) {
  1060. return null;
  1061. }
  1062. try {
  1063. if (options && typeof url === "string") {
  1064. if (options.addDefaultProtocol && url.startsWith("www.")) {
  1065. const dots = url.match(/\./g);
  1066. if (dots && dots.length >= 2) {
  1067. url = `http://${url}`;
  1068. }
  1069. }
  1070. if (options.tryConvertEncoding) {
  1071. try {
  1072. url = stringToUTF8String(url);
  1073. } catch (ex) {}
  1074. }
  1075. }
  1076. const absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url);
  1077. if (_isValidProtocol(absoluteUrl)) {
  1078. return absoluteUrl;
  1079. }
  1080. } catch (ex) {}
  1081. return null;
  1082. }
  1083. function shadow(obj, prop, value) {
  1084. Object.defineProperty(obj, prop, {
  1085. value,
  1086. enumerable: true,
  1087. configurable: true,
  1088. writable: false
  1089. });
  1090. return value;
  1091. }
  1092. const BaseException = function BaseExceptionClosure() {
  1093. function BaseException(message, name) {
  1094. if (this.constructor === BaseException) {
  1095. unreachable("Cannot initialize BaseException.");
  1096. }
  1097. this.message = message;
  1098. this.name = name;
  1099. }
  1100. BaseException.prototype = new Error();
  1101. BaseException.constructor = BaseException;
  1102. return BaseException;
  1103. }();
  1104. exports.BaseException = BaseException;
  1105. class PasswordException extends BaseException {
  1106. constructor(msg, code) {
  1107. super(msg, "PasswordException");
  1108. this.code = code;
  1109. }
  1110. }
  1111. exports.PasswordException = PasswordException;
  1112. class UnknownErrorException extends BaseException {
  1113. constructor(msg, details) {
  1114. super(msg, "UnknownErrorException");
  1115. this.details = details;
  1116. }
  1117. }
  1118. exports.UnknownErrorException = UnknownErrorException;
  1119. class InvalidPDFException extends BaseException {
  1120. constructor(msg) {
  1121. super(msg, "InvalidPDFException");
  1122. }
  1123. }
  1124. exports.InvalidPDFException = InvalidPDFException;
  1125. class MissingPDFException extends BaseException {
  1126. constructor(msg) {
  1127. super(msg, "MissingPDFException");
  1128. }
  1129. }
  1130. exports.MissingPDFException = MissingPDFException;
  1131. class UnexpectedResponseException extends BaseException {
  1132. constructor(msg, status) {
  1133. super(msg, "UnexpectedResponseException");
  1134. this.status = status;
  1135. }
  1136. }
  1137. exports.UnexpectedResponseException = UnexpectedResponseException;
  1138. class FormatError extends BaseException {
  1139. constructor(msg) {
  1140. super(msg, "FormatError");
  1141. }
  1142. }
  1143. exports.FormatError = FormatError;
  1144. class AbortException extends BaseException {
  1145. constructor(msg) {
  1146. super(msg, "AbortException");
  1147. }
  1148. }
  1149. exports.AbortException = AbortException;
  1150. function bytesToString(bytes) {
  1151. if (typeof bytes !== "object" || bytes === null || bytes.length === undefined) {
  1152. unreachable("Invalid argument for bytesToString");
  1153. }
  1154. const length = bytes.length;
  1155. const MAX_ARGUMENT_COUNT = 8192;
  1156. if (length < MAX_ARGUMENT_COUNT) {
  1157. return String.fromCharCode.apply(null, bytes);
  1158. }
  1159. const strBuf = [];
  1160. for (let i = 0; i < length; i += MAX_ARGUMENT_COUNT) {
  1161. const chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length);
  1162. const chunk = bytes.subarray(i, chunkEnd);
  1163. strBuf.push(String.fromCharCode.apply(null, chunk));
  1164. }
  1165. return strBuf.join("");
  1166. }
  1167. function stringToBytes(str) {
  1168. if (typeof str !== "string") {
  1169. unreachable("Invalid argument for stringToBytes");
  1170. }
  1171. const length = str.length;
  1172. const bytes = new Uint8Array(length);
  1173. for (let i = 0; i < length; ++i) {
  1174. bytes[i] = str.charCodeAt(i) & 0xff;
  1175. }
  1176. return bytes;
  1177. }
  1178. function arrayByteLength(arr) {
  1179. if (arr.length !== undefined) {
  1180. return arr.length;
  1181. }
  1182. if (arr.byteLength !== undefined) {
  1183. return arr.byteLength;
  1184. }
  1185. unreachable("Invalid argument for arrayByteLength");
  1186. }
  1187. function arraysToBytes(arr) {
  1188. const length = arr.length;
  1189. if (length === 1 && arr[0] instanceof Uint8Array) {
  1190. return arr[0];
  1191. }
  1192. let resultLength = 0;
  1193. for (let i = 0; i < length; i++) {
  1194. resultLength += arrayByteLength(arr[i]);
  1195. }
  1196. let pos = 0;
  1197. const data = new Uint8Array(resultLength);
  1198. for (let i = 0; i < length; i++) {
  1199. let item = arr[i];
  1200. if (!(item instanceof Uint8Array)) {
  1201. if (typeof item === "string") {
  1202. item = stringToBytes(item);
  1203. } else {
  1204. item = new Uint8Array(item);
  1205. }
  1206. }
  1207. const itemLength = item.byteLength;
  1208. data.set(item, pos);
  1209. pos += itemLength;
  1210. }
  1211. return data;
  1212. }
  1213. function string32(value) {
  1214. return String.fromCharCode(value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
  1215. }
  1216. function objectSize(obj) {
  1217. return Object.keys(obj).length;
  1218. }
  1219. function objectFromMap(map) {
  1220. const obj = Object.create(null);
  1221. for (const [key, value] of map) {
  1222. obj[key] = value;
  1223. }
  1224. return obj;
  1225. }
  1226. function isLittleEndian() {
  1227. const buffer8 = new Uint8Array(4);
  1228. buffer8[0] = 1;
  1229. const view32 = new Uint32Array(buffer8.buffer, 0, 1);
  1230. return view32[0] === 1;
  1231. }
  1232. function isEvalSupported() {
  1233. try {
  1234. new Function("");
  1235. return true;
  1236. } catch (e) {
  1237. return false;
  1238. }
  1239. }
  1240. class FeatureTest {
  1241. static get isLittleEndian() {
  1242. return shadow(this, "isLittleEndian", isLittleEndian());
  1243. }
  1244. static get isEvalSupported() {
  1245. return shadow(this, "isEvalSupported", isEvalSupported());
  1246. }
  1247. static get isOffscreenCanvasSupported() {
  1248. return shadow(this, "isOffscreenCanvasSupported", typeof OffscreenCanvas !== "undefined");
  1249. }
  1250. }
  1251. exports.FeatureTest = FeatureTest;
  1252. const hexNumbers = [...Array(256).keys()].map(n => n.toString(16).padStart(2, "0"));
  1253. class Util {
  1254. static makeHexColor(r, g, b) {
  1255. return `#${hexNumbers[r]}${hexNumbers[g]}${hexNumbers[b]}`;
  1256. }
  1257. static scaleMinMax(transform, minMax) {
  1258. let temp;
  1259. if (transform[0]) {
  1260. if (transform[0] < 0) {
  1261. temp = minMax[0];
  1262. minMax[0] = minMax[1];
  1263. minMax[1] = temp;
  1264. }
  1265. minMax[0] *= transform[0];
  1266. minMax[1] *= transform[0];
  1267. if (transform[3] < 0) {
  1268. temp = minMax[2];
  1269. minMax[2] = minMax[3];
  1270. minMax[3] = temp;
  1271. }
  1272. minMax[2] *= transform[3];
  1273. minMax[3] *= transform[3];
  1274. } else {
  1275. temp = minMax[0];
  1276. minMax[0] = minMax[2];
  1277. minMax[2] = temp;
  1278. temp = minMax[1];
  1279. minMax[1] = minMax[3];
  1280. minMax[3] = temp;
  1281. if (transform[1] < 0) {
  1282. temp = minMax[2];
  1283. minMax[2] = minMax[3];
  1284. minMax[3] = temp;
  1285. }
  1286. minMax[2] *= transform[1];
  1287. minMax[3] *= transform[1];
  1288. if (transform[2] < 0) {
  1289. temp = minMax[0];
  1290. minMax[0] = minMax[1];
  1291. minMax[1] = temp;
  1292. }
  1293. minMax[0] *= transform[2];
  1294. minMax[1] *= transform[2];
  1295. }
  1296. minMax[0] += transform[4];
  1297. minMax[1] += transform[4];
  1298. minMax[2] += transform[5];
  1299. minMax[3] += transform[5];
  1300. }
  1301. static transform(m1, m2) {
  1302. 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]];
  1303. }
  1304. static applyTransform(p, m) {
  1305. const xt = p[0] * m[0] + p[1] * m[2] + m[4];
  1306. const yt = p[0] * m[1] + p[1] * m[3] + m[5];
  1307. return [xt, yt];
  1308. }
  1309. static applyInverseTransform(p, m) {
  1310. const d = m[0] * m[3] - m[1] * m[2];
  1311. const xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d;
  1312. const yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d;
  1313. return [xt, yt];
  1314. }
  1315. static getAxialAlignedBoundingBox(r, m) {
  1316. const p1 = Util.applyTransform(r, m);
  1317. const p2 = Util.applyTransform(r.slice(2, 4), m);
  1318. const p3 = Util.applyTransform([r[0], r[3]], m);
  1319. const p4 = Util.applyTransform([r[2], r[1]], m);
  1320. 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])];
  1321. }
  1322. static inverseTransform(m) {
  1323. const d = m[0] * m[3] - m[1] * m[2];
  1324. 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];
  1325. }
  1326. static apply3dTransform(m, v) {
  1327. return [m[0] * v[0] + m[1] * v[1] + m[2] * v[2], m[3] * v[0] + m[4] * v[1] + m[5] * v[2], m[6] * v[0] + m[7] * v[1] + m[8] * v[2]];
  1328. }
  1329. static singularValueDecompose2dScale(m) {
  1330. const transpose = [m[0], m[2], m[1], m[3]];
  1331. const a = m[0] * transpose[0] + m[1] * transpose[2];
  1332. const b = m[0] * transpose[1] + m[1] * transpose[3];
  1333. const c = m[2] * transpose[0] + m[3] * transpose[2];
  1334. const d = m[2] * transpose[1] + m[3] * transpose[3];
  1335. const first = (a + d) / 2;
  1336. const second = Math.sqrt((a + d) ** 2 - 4 * (a * d - c * b)) / 2;
  1337. const sx = first + second || 1;
  1338. const sy = first - second || 1;
  1339. return [Math.sqrt(sx), Math.sqrt(sy)];
  1340. }
  1341. static normalizeRect(rect) {
  1342. const r = rect.slice(0);
  1343. if (rect[0] > rect[2]) {
  1344. r[0] = rect[2];
  1345. r[2] = rect[0];
  1346. }
  1347. if (rect[1] > rect[3]) {
  1348. r[1] = rect[3];
  1349. r[3] = rect[1];
  1350. }
  1351. return r;
  1352. }
  1353. static intersect(rect1, rect2) {
  1354. const xLow = Math.max(Math.min(rect1[0], rect1[2]), Math.min(rect2[0], rect2[2]));
  1355. const xHigh = Math.min(Math.max(rect1[0], rect1[2]), Math.max(rect2[0], rect2[2]));
  1356. if (xLow > xHigh) {
  1357. return null;
  1358. }
  1359. const yLow = Math.max(Math.min(rect1[1], rect1[3]), Math.min(rect2[1], rect2[3]));
  1360. const yHigh = Math.min(Math.max(rect1[1], rect1[3]), Math.max(rect2[1], rect2[3]));
  1361. if (yLow > yHigh) {
  1362. return null;
  1363. }
  1364. return [xLow, yLow, xHigh, yHigh];
  1365. }
  1366. static bezierBoundingBox(x0, y0, x1, y1, x2, y2, x3, y3) {
  1367. const tvalues = [],
  1368. bounds = [[], []];
  1369. let a, b, c, t, t1, t2, b2ac, sqrtb2ac;
  1370. for (let i = 0; i < 2; ++i) {
  1371. if (i === 0) {
  1372. b = 6 * x0 - 12 * x1 + 6 * x2;
  1373. a = -3 * x0 + 9 * x1 - 9 * x2 + 3 * x3;
  1374. c = 3 * x1 - 3 * x0;
  1375. } else {
  1376. b = 6 * y0 - 12 * y1 + 6 * y2;
  1377. a = -3 * y0 + 9 * y1 - 9 * y2 + 3 * y3;
  1378. c = 3 * y1 - 3 * y0;
  1379. }
  1380. if (Math.abs(a) < 1e-12) {
  1381. if (Math.abs(b) < 1e-12) {
  1382. continue;
  1383. }
  1384. t = -c / b;
  1385. if (0 < t && t < 1) {
  1386. tvalues.push(t);
  1387. }
  1388. continue;
  1389. }
  1390. b2ac = b * b - 4 * c * a;
  1391. sqrtb2ac = Math.sqrt(b2ac);
  1392. if (b2ac < 0) {
  1393. continue;
  1394. }
  1395. t1 = (-b + sqrtb2ac) / (2 * a);
  1396. if (0 < t1 && t1 < 1) {
  1397. tvalues.push(t1);
  1398. }
  1399. t2 = (-b - sqrtb2ac) / (2 * a);
  1400. if (0 < t2 && t2 < 1) {
  1401. tvalues.push(t2);
  1402. }
  1403. }
  1404. let j = tvalues.length,
  1405. mt;
  1406. const jlen = j;
  1407. while (j--) {
  1408. t = tvalues[j];
  1409. mt = 1 - t;
  1410. bounds[0][j] = mt * mt * mt * x0 + 3 * mt * mt * t * x1 + 3 * mt * t * t * x2 + t * t * t * x3;
  1411. bounds[1][j] = mt * mt * mt * y0 + 3 * mt * mt * t * y1 + 3 * mt * t * t * y2 + t * t * t * y3;
  1412. }
  1413. bounds[0][jlen] = x0;
  1414. bounds[1][jlen] = y0;
  1415. bounds[0][jlen + 1] = x3;
  1416. bounds[1][jlen + 1] = y3;
  1417. bounds[0].length = bounds[1].length = jlen + 2;
  1418. return [Math.min(...bounds[0]), Math.min(...bounds[1]), Math.max(...bounds[0]), Math.max(...bounds[1])];
  1419. }
  1420. }
  1421. exports.Util = Util;
  1422. 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];
  1423. function stringToPDFString(str) {
  1424. if (str[0] >= "\xEF") {
  1425. let encoding;
  1426. if (str[0] === "\xFE" && str[1] === "\xFF") {
  1427. encoding = "utf-16be";
  1428. } else if (str[0] === "\xFF" && str[1] === "\xFE") {
  1429. encoding = "utf-16le";
  1430. } else if (str[0] === "\xEF" && str[1] === "\xBB" && str[2] === "\xBF") {
  1431. encoding = "utf-8";
  1432. }
  1433. if (encoding) {
  1434. try {
  1435. const decoder = new TextDecoder(encoding, {
  1436. fatal: true
  1437. });
  1438. const buffer = stringToBytes(str);
  1439. return decoder.decode(buffer);
  1440. } catch (ex) {
  1441. warn(`stringToPDFString: "${ex}".`);
  1442. }
  1443. }
  1444. }
  1445. const strBuf = [];
  1446. for (let i = 0, ii = str.length; i < ii; i++) {
  1447. const code = PDFStringTranslateTable[str.charCodeAt(i)];
  1448. strBuf.push(code ? String.fromCharCode(code) : str.charAt(i));
  1449. }
  1450. return strBuf.join("");
  1451. }
  1452. function escapeString(str) {
  1453. return str.replace(/([()\\\n\r])/g, match => {
  1454. if (match === "\n") {
  1455. return "\\n";
  1456. } else if (match === "\r") {
  1457. return "\\r";
  1458. }
  1459. return `\\${match}`;
  1460. });
  1461. }
  1462. function isAscii(str) {
  1463. return /^[\x00-\x7F]*$/.test(str);
  1464. }
  1465. function stringToUTF16BEString(str) {
  1466. const buf = ["\xFE\xFF"];
  1467. for (let i = 0, ii = str.length; i < ii; i++) {
  1468. const char = str.charCodeAt(i);
  1469. buf.push(String.fromCharCode(char >> 8 & 0xff), String.fromCharCode(char & 0xff));
  1470. }
  1471. return buf.join("");
  1472. }
  1473. function stringToUTF8String(str) {
  1474. return decodeURIComponent(escape(str));
  1475. }
  1476. function utf8StringToString(str) {
  1477. return unescape(encodeURIComponent(str));
  1478. }
  1479. function isArrayBuffer(v) {
  1480. return typeof v === "object" && v !== null && v.byteLength !== undefined;
  1481. }
  1482. function isArrayEqual(arr1, arr2) {
  1483. if (arr1.length !== arr2.length) {
  1484. return false;
  1485. }
  1486. for (let i = 0, ii = arr1.length; i < ii; i++) {
  1487. if (arr1[i] !== arr2[i]) {
  1488. return false;
  1489. }
  1490. }
  1491. return true;
  1492. }
  1493. function getModificationDate(date = new Date()) {
  1494. 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")];
  1495. return buffer.join("");
  1496. }
  1497. function createPromiseCapability() {
  1498. const capability = Object.create(null);
  1499. let isSettled = false;
  1500. Object.defineProperty(capability, "settled", {
  1501. get() {
  1502. return isSettled;
  1503. }
  1504. });
  1505. capability.promise = new Promise(function (resolve, reject) {
  1506. capability.resolve = function (data) {
  1507. isSettled = true;
  1508. resolve(data);
  1509. };
  1510. capability.reject = function (reason) {
  1511. isSettled = true;
  1512. reject(reason);
  1513. };
  1514. });
  1515. return capability;
  1516. }
  1517. /***/ }),
  1518. /* 3 */
  1519. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1520. var _is_node = __w_pdfjs_require__(4);
  1521. ;
  1522. /***/ }),
  1523. /* 4 */
  1524. /***/ ((__unused_webpack_module, exports) => {
  1525. Object.defineProperty(exports, "__esModule", ({
  1526. value: true
  1527. }));
  1528. exports.isNodeJS = void 0;
  1529. const isNodeJS = typeof process === "object" && process + "" === "[object process]" && !process.versions.nw && !(process.versions.electron && process.type && process.type !== "browser");
  1530. exports.isNodeJS = isNodeJS;
  1531. /***/ }),
  1532. /* 5 */
  1533. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  1534. Object.defineProperty(exports, "__esModule", ({
  1535. value: true
  1536. }));
  1537. exports.RefSetCache = exports.RefSet = exports.Ref = exports.Name = exports.EOF = exports.Dict = exports.Cmd = exports.CIRCULAR_REF = void 0;
  1538. exports.clearPrimitiveCaches = clearPrimitiveCaches;
  1539. exports.isCmd = isCmd;
  1540. exports.isDict = isDict;
  1541. exports.isName = isName;
  1542. exports.isRefsEqual = isRefsEqual;
  1543. var _util = __w_pdfjs_require__(2);
  1544. const CIRCULAR_REF = Symbol("CIRCULAR_REF");
  1545. exports.CIRCULAR_REF = CIRCULAR_REF;
  1546. const EOF = Symbol("EOF");
  1547. exports.EOF = EOF;
  1548. const Name = function NameClosure() {
  1549. let nameCache = Object.create(null);
  1550. class Name {
  1551. constructor(name) {
  1552. this.name = name;
  1553. }
  1554. static get(name) {
  1555. return nameCache[name] || (nameCache[name] = new Name(name));
  1556. }
  1557. static _clearCache() {
  1558. nameCache = Object.create(null);
  1559. }
  1560. }
  1561. return Name;
  1562. }();
  1563. exports.Name = Name;
  1564. const Cmd = function CmdClosure() {
  1565. let cmdCache = Object.create(null);
  1566. class Cmd {
  1567. constructor(cmd) {
  1568. this.cmd = cmd;
  1569. }
  1570. static get(cmd) {
  1571. return cmdCache[cmd] || (cmdCache[cmd] = new Cmd(cmd));
  1572. }
  1573. static _clearCache() {
  1574. cmdCache = Object.create(null);
  1575. }
  1576. }
  1577. return Cmd;
  1578. }();
  1579. exports.Cmd = Cmd;
  1580. const nonSerializable = function nonSerializableClosure() {
  1581. return nonSerializable;
  1582. };
  1583. class Dict {
  1584. constructor(xref = null) {
  1585. this._map = Object.create(null);
  1586. this.xref = xref;
  1587. this.objId = null;
  1588. this.suppressEncryption = false;
  1589. this.__nonSerializable__ = nonSerializable;
  1590. }
  1591. assignXref(newXref) {
  1592. this.xref = newXref;
  1593. }
  1594. get size() {
  1595. return Object.keys(this._map).length;
  1596. }
  1597. get(key1, key2, key3) {
  1598. let value = this._map[key1];
  1599. if (value === undefined && key2 !== undefined) {
  1600. value = this._map[key2];
  1601. if (value === undefined && key3 !== undefined) {
  1602. value = this._map[key3];
  1603. }
  1604. }
  1605. if (value instanceof Ref && this.xref) {
  1606. return this.xref.fetch(value, this.suppressEncryption);
  1607. }
  1608. return value;
  1609. }
  1610. async getAsync(key1, key2, key3) {
  1611. let value = this._map[key1];
  1612. if (value === undefined && key2 !== undefined) {
  1613. value = this._map[key2];
  1614. if (value === undefined && key3 !== undefined) {
  1615. value = this._map[key3];
  1616. }
  1617. }
  1618. if (value instanceof Ref && this.xref) {
  1619. return this.xref.fetchAsync(value, this.suppressEncryption);
  1620. }
  1621. return value;
  1622. }
  1623. getArray(key1, key2, key3) {
  1624. let value = this._map[key1];
  1625. if (value === undefined && key2 !== undefined) {
  1626. value = this._map[key2];
  1627. if (value === undefined && key3 !== undefined) {
  1628. value = this._map[key3];
  1629. }
  1630. }
  1631. if (value instanceof Ref && this.xref) {
  1632. value = this.xref.fetch(value, this.suppressEncryption);
  1633. }
  1634. if (Array.isArray(value)) {
  1635. value = value.slice();
  1636. for (let i = 0, ii = value.length; i < ii; i++) {
  1637. if (value[i] instanceof Ref && this.xref) {
  1638. value[i] = this.xref.fetch(value[i], this.suppressEncryption);
  1639. }
  1640. }
  1641. }
  1642. return value;
  1643. }
  1644. getRaw(key) {
  1645. return this._map[key];
  1646. }
  1647. getKeys() {
  1648. return Object.keys(this._map);
  1649. }
  1650. getRawValues() {
  1651. return Object.values(this._map);
  1652. }
  1653. set(key, value) {
  1654. this._map[key] = value;
  1655. }
  1656. has(key) {
  1657. return this._map[key] !== undefined;
  1658. }
  1659. forEach(callback) {
  1660. for (const key in this._map) {
  1661. callback(key, this.get(key));
  1662. }
  1663. }
  1664. static get empty() {
  1665. const emptyDict = new Dict(null);
  1666. emptyDict.set = (key, value) => {
  1667. (0, _util.unreachable)("Should not call `set` on the empty dictionary.");
  1668. };
  1669. return (0, _util.shadow)(this, "empty", emptyDict);
  1670. }
  1671. static merge({
  1672. xref,
  1673. dictArray,
  1674. mergeSubDicts = false
  1675. }) {
  1676. const mergedDict = new Dict(xref),
  1677. properties = new Map();
  1678. for (const dict of dictArray) {
  1679. if (!(dict instanceof Dict)) {
  1680. continue;
  1681. }
  1682. for (const [key, value] of Object.entries(dict._map)) {
  1683. let property = properties.get(key);
  1684. if (property === undefined) {
  1685. property = [];
  1686. properties.set(key, property);
  1687. } else if (!mergeSubDicts || !(value instanceof Dict)) {
  1688. continue;
  1689. }
  1690. property.push(value);
  1691. }
  1692. }
  1693. for (const [name, values] of properties) {
  1694. if (values.length === 1 || !(values[0] instanceof Dict)) {
  1695. mergedDict._map[name] = values[0];
  1696. continue;
  1697. }
  1698. const subDict = new Dict(xref);
  1699. for (const dict of values) {
  1700. for (const [key, value] of Object.entries(dict._map)) {
  1701. if (subDict._map[key] === undefined) {
  1702. subDict._map[key] = value;
  1703. }
  1704. }
  1705. }
  1706. if (subDict.size > 0) {
  1707. mergedDict._map[name] = subDict;
  1708. }
  1709. }
  1710. properties.clear();
  1711. return mergedDict.size > 0 ? mergedDict : Dict.empty;
  1712. }
  1713. }
  1714. exports.Dict = Dict;
  1715. const Ref = function RefClosure() {
  1716. let refCache = Object.create(null);
  1717. class Ref {
  1718. constructor(num, gen) {
  1719. this.num = num;
  1720. this.gen = gen;
  1721. }
  1722. toString() {
  1723. if (this.gen === 0) {
  1724. return `${this.num}R`;
  1725. }
  1726. return `${this.num}R${this.gen}`;
  1727. }
  1728. static get(num, gen) {
  1729. const key = gen === 0 ? `${num}R` : `${num}R${gen}`;
  1730. return refCache[key] || (refCache[key] = new Ref(num, gen));
  1731. }
  1732. static _clearCache() {
  1733. refCache = Object.create(null);
  1734. }
  1735. }
  1736. return Ref;
  1737. }();
  1738. exports.Ref = Ref;
  1739. class RefSet {
  1740. constructor(parent = null) {
  1741. this._set = new Set(parent && parent._set);
  1742. }
  1743. has(ref) {
  1744. return this._set.has(ref.toString());
  1745. }
  1746. put(ref) {
  1747. this._set.add(ref.toString());
  1748. }
  1749. remove(ref) {
  1750. this._set.delete(ref.toString());
  1751. }
  1752. [Symbol.iterator]() {
  1753. return this._set.values();
  1754. }
  1755. clear() {
  1756. this._set.clear();
  1757. }
  1758. }
  1759. exports.RefSet = RefSet;
  1760. class RefSetCache {
  1761. constructor() {
  1762. this._map = new Map();
  1763. }
  1764. get size() {
  1765. return this._map.size;
  1766. }
  1767. get(ref) {
  1768. return this._map.get(ref.toString());
  1769. }
  1770. has(ref) {
  1771. return this._map.has(ref.toString());
  1772. }
  1773. put(ref, obj) {
  1774. this._map.set(ref.toString(), obj);
  1775. }
  1776. putAlias(ref, aliasRef) {
  1777. this._map.set(ref.toString(), this.get(aliasRef));
  1778. }
  1779. [Symbol.iterator]() {
  1780. return this._map.values();
  1781. }
  1782. clear() {
  1783. this._map.clear();
  1784. }
  1785. }
  1786. exports.RefSetCache = RefSetCache;
  1787. function isName(v, name) {
  1788. return v instanceof Name && (name === undefined || v.name === name);
  1789. }
  1790. function isCmd(v, cmd) {
  1791. return v instanceof Cmd && (cmd === undefined || v.cmd === cmd);
  1792. }
  1793. function isDict(v, type) {
  1794. return v instanceof Dict && (type === undefined || isName(v.get("Type"), type));
  1795. }
  1796. function isRefsEqual(v1, v2) {
  1797. return v1.num === v2.num && v1.gen === v2.gen;
  1798. }
  1799. function clearPrimitiveCaches() {
  1800. Cmd._clearCache();
  1801. Name._clearCache();
  1802. Ref._clearCache();
  1803. }
  1804. /***/ }),
  1805. /* 6 */
  1806. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  1807. Object.defineProperty(exports, "__esModule", ({
  1808. value: true
  1809. }));
  1810. exports.XRefParseException = exports.XRefEntryException = exports.ParserEOFException = exports.MissingDataException = exports.DocStats = void 0;
  1811. exports.collectActions = collectActions;
  1812. exports.encodeToXmlString = encodeToXmlString;
  1813. exports.escapePDFName = escapePDFName;
  1814. exports.getArrayLookupTableFactory = getArrayLookupTableFactory;
  1815. exports.getInheritableProperty = getInheritableProperty;
  1816. exports.getLookupTableFactory = getLookupTableFactory;
  1817. exports.getNewAnnotationsMap = getNewAnnotationsMap;
  1818. exports.isWhiteSpace = isWhiteSpace;
  1819. exports.log2 = log2;
  1820. exports.numberToString = numberToString;
  1821. exports.parseXFAPath = parseXFAPath;
  1822. exports.readInt8 = readInt8;
  1823. exports.readUint16 = readUint16;
  1824. exports.readUint32 = readUint32;
  1825. exports.recoverJsURL = recoverJsURL;
  1826. exports.toRomanNumerals = toRomanNumerals;
  1827. exports.validateCSSFont = validateCSSFont;
  1828. var _util = __w_pdfjs_require__(2);
  1829. var _primitives = __w_pdfjs_require__(5);
  1830. var _base_stream = __w_pdfjs_require__(7);
  1831. function getLookupTableFactory(initializer) {
  1832. let lookup;
  1833. return function () {
  1834. if (initializer) {
  1835. lookup = Object.create(null);
  1836. initializer(lookup);
  1837. initializer = null;
  1838. }
  1839. return lookup;
  1840. };
  1841. }
  1842. function getArrayLookupTableFactory(initializer) {
  1843. let lookup;
  1844. return function () {
  1845. if (initializer) {
  1846. let arr = initializer();
  1847. initializer = null;
  1848. lookup = Object.create(null);
  1849. for (let i = 0, ii = arr.length; i < ii; i += 2) {
  1850. lookup[arr[i]] = arr[i + 1];
  1851. }
  1852. arr = null;
  1853. }
  1854. return lookup;
  1855. };
  1856. }
  1857. class MissingDataException extends _util.BaseException {
  1858. constructor(begin, end) {
  1859. super(`Missing data [${begin}, ${end})`, "MissingDataException");
  1860. this.begin = begin;
  1861. this.end = end;
  1862. }
  1863. }
  1864. exports.MissingDataException = MissingDataException;
  1865. class ParserEOFException extends _util.BaseException {
  1866. constructor(msg) {
  1867. super(msg, "ParserEOFException");
  1868. }
  1869. }
  1870. exports.ParserEOFException = ParserEOFException;
  1871. class XRefEntryException extends _util.BaseException {
  1872. constructor(msg) {
  1873. super(msg, "XRefEntryException");
  1874. }
  1875. }
  1876. exports.XRefEntryException = XRefEntryException;
  1877. class XRefParseException extends _util.BaseException {
  1878. constructor(msg) {
  1879. super(msg, "XRefParseException");
  1880. }
  1881. }
  1882. exports.XRefParseException = XRefParseException;
  1883. class DocStats {
  1884. constructor(handler) {
  1885. this._handler = handler;
  1886. this._streamTypes = new Set();
  1887. this._fontTypes = new Set();
  1888. }
  1889. _send() {
  1890. const streamTypes = Object.create(null),
  1891. fontTypes = Object.create(null);
  1892. for (const type of this._streamTypes) {
  1893. streamTypes[type] = true;
  1894. }
  1895. for (const type of this._fontTypes) {
  1896. fontTypes[type] = true;
  1897. }
  1898. this._handler.send("DocStats", {
  1899. streamTypes,
  1900. fontTypes
  1901. });
  1902. }
  1903. addStreamType(type) {
  1904. if (this._streamTypes.has(type)) {
  1905. return;
  1906. }
  1907. this._streamTypes.add(type);
  1908. this._send();
  1909. }
  1910. addFontType(type) {
  1911. if (this._fontTypes.has(type)) {
  1912. return;
  1913. }
  1914. this._fontTypes.add(type);
  1915. this._send();
  1916. }
  1917. }
  1918. exports.DocStats = DocStats;
  1919. function getInheritableProperty({
  1920. dict,
  1921. key,
  1922. getArray = false,
  1923. stopWhenFound = true
  1924. }) {
  1925. let values;
  1926. const visited = new _primitives.RefSet();
  1927. while (dict instanceof _primitives.Dict && !(dict.objId && visited.has(dict.objId))) {
  1928. if (dict.objId) {
  1929. visited.put(dict.objId);
  1930. }
  1931. const value = getArray ? dict.getArray(key) : dict.get(key);
  1932. if (value !== undefined) {
  1933. if (stopWhenFound) {
  1934. return value;
  1935. }
  1936. if (!values) {
  1937. values = [];
  1938. }
  1939. values.push(value);
  1940. }
  1941. dict = dict.get("Parent");
  1942. }
  1943. return values;
  1944. }
  1945. 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"];
  1946. function toRomanNumerals(number, lowerCase = false) {
  1947. (0, _util.assert)(Number.isInteger(number) && number > 0, "The number should be a positive integer.");
  1948. const romanBuf = [];
  1949. let pos;
  1950. while (number >= 1000) {
  1951. number -= 1000;
  1952. romanBuf.push("M");
  1953. }
  1954. pos = number / 100 | 0;
  1955. number %= 100;
  1956. romanBuf.push(ROMAN_NUMBER_MAP[pos]);
  1957. pos = number / 10 | 0;
  1958. number %= 10;
  1959. romanBuf.push(ROMAN_NUMBER_MAP[10 + pos]);
  1960. romanBuf.push(ROMAN_NUMBER_MAP[20 + number]);
  1961. const romanStr = romanBuf.join("");
  1962. return lowerCase ? romanStr.toLowerCase() : romanStr;
  1963. }
  1964. function log2(x) {
  1965. if (x <= 0) {
  1966. return 0;
  1967. }
  1968. return Math.ceil(Math.log2(x));
  1969. }
  1970. function readInt8(data, offset) {
  1971. return data[offset] << 24 >> 24;
  1972. }
  1973. function readUint16(data, offset) {
  1974. return data[offset] << 8 | data[offset + 1];
  1975. }
  1976. function readUint32(data, offset) {
  1977. return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0;
  1978. }
  1979. function isWhiteSpace(ch) {
  1980. return ch === 0x20 || ch === 0x09 || ch === 0x0d || ch === 0x0a;
  1981. }
  1982. function parseXFAPath(path) {
  1983. const positionPattern = /(.+)\[(\d+)\]$/;
  1984. return path.split(".").map(component => {
  1985. const m = component.match(positionPattern);
  1986. if (m) {
  1987. return {
  1988. name: m[1],
  1989. pos: parseInt(m[2], 10)
  1990. };
  1991. }
  1992. return {
  1993. name: component,
  1994. pos: 0
  1995. };
  1996. });
  1997. }
  1998. function escapePDFName(str) {
  1999. const buffer = [];
  2000. let start = 0;
  2001. for (let i = 0, ii = str.length; i < ii; i++) {
  2002. const char = str.charCodeAt(i);
  2003. 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) {
  2004. if (start < i) {
  2005. buffer.push(str.substring(start, i));
  2006. }
  2007. buffer.push(`#${char.toString(16)}`);
  2008. start = i + 1;
  2009. }
  2010. }
  2011. if (buffer.length === 0) {
  2012. return str;
  2013. }
  2014. if (start < str.length) {
  2015. buffer.push(str.substring(start, str.length));
  2016. }
  2017. return buffer.join("");
  2018. }
  2019. function _collectJS(entry, xref, list, parents) {
  2020. if (!entry) {
  2021. return;
  2022. }
  2023. let parent = null;
  2024. if (entry instanceof _primitives.Ref) {
  2025. if (parents.has(entry)) {
  2026. return;
  2027. }
  2028. parent = entry;
  2029. parents.put(parent);
  2030. entry = xref.fetch(entry);
  2031. }
  2032. if (Array.isArray(entry)) {
  2033. for (const element of entry) {
  2034. _collectJS(element, xref, list, parents);
  2035. }
  2036. } else if (entry instanceof _primitives.Dict) {
  2037. if ((0, _primitives.isName)(entry.get("S"), "JavaScript")) {
  2038. const js = entry.get("JS");
  2039. let code;
  2040. if (js instanceof _base_stream.BaseStream) {
  2041. code = js.getString();
  2042. } else if (typeof js === "string") {
  2043. code = js;
  2044. }
  2045. code = code && (0, _util.stringToPDFString)(code).replace(/\u0000/g, "");
  2046. if (code) {
  2047. list.push(code);
  2048. }
  2049. }
  2050. _collectJS(entry.getRaw("Next"), xref, list, parents);
  2051. }
  2052. if (parent) {
  2053. parents.remove(parent);
  2054. }
  2055. }
  2056. function collectActions(xref, dict, eventType) {
  2057. const actions = Object.create(null);
  2058. const additionalActionsDicts = getInheritableProperty({
  2059. dict,
  2060. key: "AA",
  2061. stopWhenFound: false
  2062. });
  2063. if (additionalActionsDicts) {
  2064. for (let i = additionalActionsDicts.length - 1; i >= 0; i--) {
  2065. const additionalActions = additionalActionsDicts[i];
  2066. if (!(additionalActions instanceof _primitives.Dict)) {
  2067. continue;
  2068. }
  2069. for (const key of additionalActions.getKeys()) {
  2070. const action = eventType[key];
  2071. if (!action) {
  2072. continue;
  2073. }
  2074. const actionDict = additionalActions.getRaw(key);
  2075. const parents = new _primitives.RefSet();
  2076. const list = [];
  2077. _collectJS(actionDict, xref, list, parents);
  2078. if (list.length > 0) {
  2079. actions[action] = list;
  2080. }
  2081. }
  2082. }
  2083. }
  2084. if (dict.has("A")) {
  2085. const actionDict = dict.get("A");
  2086. const parents = new _primitives.RefSet();
  2087. const list = [];
  2088. _collectJS(actionDict, xref, list, parents);
  2089. if (list.length > 0) {
  2090. actions.Action = list;
  2091. }
  2092. }
  2093. return (0, _util.objectSize)(actions) > 0 ? actions : null;
  2094. }
  2095. const XMLEntities = {
  2096. 0x3c: "&lt;",
  2097. 0x3e: "&gt;",
  2098. 0x26: "&amp;",
  2099. 0x22: "&quot;",
  2100. 0x27: "&apos;"
  2101. };
  2102. function encodeToXmlString(str) {
  2103. const buffer = [];
  2104. let start = 0;
  2105. for (let i = 0, ii = str.length; i < ii; i++) {
  2106. const char = str.codePointAt(i);
  2107. if (0x20 <= char && char <= 0x7e) {
  2108. const entity = XMLEntities[char];
  2109. if (entity) {
  2110. if (start < i) {
  2111. buffer.push(str.substring(start, i));
  2112. }
  2113. buffer.push(entity);
  2114. start = i + 1;
  2115. }
  2116. } else {
  2117. if (start < i) {
  2118. buffer.push(str.substring(start, i));
  2119. }
  2120. buffer.push(`&#x${char.toString(16).toUpperCase()};`);
  2121. if (char > 0xd7ff && (char < 0xe000 || char > 0xfffd)) {
  2122. i++;
  2123. }
  2124. start = i + 1;
  2125. }
  2126. }
  2127. if (buffer.length === 0) {
  2128. return str;
  2129. }
  2130. if (start < str.length) {
  2131. buffer.push(str.substring(start, str.length));
  2132. }
  2133. return buffer.join("");
  2134. }
  2135. function validateCSSFont(cssFontInfo) {
  2136. const DEFAULT_CSS_FONT_OBLIQUE = "14";
  2137. const DEFAULT_CSS_FONT_WEIGHT = "400";
  2138. const CSS_FONT_WEIGHT_VALUES = new Set(["100", "200", "300", "400", "500", "600", "700", "800", "900", "1000", "normal", "bold", "bolder", "lighter"]);
  2139. const {
  2140. fontFamily,
  2141. fontWeight,
  2142. italicAngle
  2143. } = cssFontInfo;
  2144. if (/^".*"$/.test(fontFamily)) {
  2145. if (/[^\\]"/.test(fontFamily.slice(1, fontFamily.length - 1))) {
  2146. (0, _util.warn)(`XFA - FontFamily contains some unescaped ": ${fontFamily}.`);
  2147. return false;
  2148. }
  2149. } else if (/^'.*'$/.test(fontFamily)) {
  2150. if (/[^\\]'/.test(fontFamily.slice(1, fontFamily.length - 1))) {
  2151. (0, _util.warn)(`XFA - FontFamily contains some unescaped ': ${fontFamily}.`);
  2152. return false;
  2153. }
  2154. } else {
  2155. for (const ident of fontFamily.split(/[ \t]+/)) {
  2156. if (/^(\d|(-(\d|-)))/.test(ident) || !/^[\w-\\]+$/.test(ident)) {
  2157. (0, _util.warn)(`XFA - FontFamily contains some invalid <custom-ident>: ${fontFamily}.`);
  2158. return false;
  2159. }
  2160. }
  2161. }
  2162. const weight = fontWeight ? fontWeight.toString() : "";
  2163. cssFontInfo.fontWeight = CSS_FONT_WEIGHT_VALUES.has(weight) ? weight : DEFAULT_CSS_FONT_WEIGHT;
  2164. const angle = parseFloat(italicAngle);
  2165. cssFontInfo.italicAngle = isNaN(angle) || angle < -90 || angle > 90 ? DEFAULT_CSS_FONT_OBLIQUE : italicAngle.toString();
  2166. return true;
  2167. }
  2168. function recoverJsURL(str) {
  2169. const URL_OPEN_METHODS = ["app.launchURL", "window.open", "xfa.host.gotoURL"];
  2170. const regex = new RegExp("^\\s*(" + URL_OPEN_METHODS.join("|").split(".").join("\\.") + ")\\((?:'|\")([^'\"]*)(?:'|\")(?:,\\s*(\\w+)\\)|\\))", "i");
  2171. const jsUrl = regex.exec(str);
  2172. if (jsUrl && jsUrl[2]) {
  2173. const url = jsUrl[2];
  2174. let newWindow = false;
  2175. if (jsUrl[3] === "true" && jsUrl[1] === "app.launchURL") {
  2176. newWindow = true;
  2177. }
  2178. return {
  2179. url,
  2180. newWindow
  2181. };
  2182. }
  2183. return null;
  2184. }
  2185. function numberToString(value) {
  2186. if (Number.isInteger(value)) {
  2187. return value.toString();
  2188. }
  2189. const roundedValue = Math.round(value * 100);
  2190. if (roundedValue % 100 === 0) {
  2191. return (roundedValue / 100).toString();
  2192. }
  2193. if (roundedValue % 10 === 0) {
  2194. return value.toFixed(1);
  2195. }
  2196. return value.toFixed(2);
  2197. }
  2198. function getNewAnnotationsMap(annotationStorage) {
  2199. if (!annotationStorage) {
  2200. return null;
  2201. }
  2202. const newAnnotationsByPage = new Map();
  2203. for (const [key, value] of annotationStorage) {
  2204. if (!key.startsWith(_util.AnnotationEditorPrefix)) {
  2205. continue;
  2206. }
  2207. let annotations = newAnnotationsByPage.get(value.pageIndex);
  2208. if (!annotations) {
  2209. annotations = [];
  2210. newAnnotationsByPage.set(value.pageIndex, annotations);
  2211. }
  2212. annotations.push(value);
  2213. }
  2214. return newAnnotationsByPage.size > 0 ? newAnnotationsByPage : null;
  2215. }
  2216. /***/ }),
  2217. /* 7 */
  2218. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2219. Object.defineProperty(exports, "__esModule", ({
  2220. value: true
  2221. }));
  2222. exports.BaseStream = void 0;
  2223. var _util = __w_pdfjs_require__(2);
  2224. class BaseStream {
  2225. constructor() {
  2226. if (this.constructor === BaseStream) {
  2227. (0, _util.unreachable)("Cannot initialize BaseStream.");
  2228. }
  2229. }
  2230. get length() {
  2231. (0, _util.unreachable)("Abstract getter `length` accessed");
  2232. }
  2233. get isEmpty() {
  2234. (0, _util.unreachable)("Abstract getter `isEmpty` accessed");
  2235. }
  2236. get isDataLoaded() {
  2237. return (0, _util.shadow)(this, "isDataLoaded", true);
  2238. }
  2239. getByte() {
  2240. (0, _util.unreachable)("Abstract method `getByte` called");
  2241. }
  2242. getBytes(length) {
  2243. (0, _util.unreachable)("Abstract method `getBytes` called");
  2244. }
  2245. peekByte() {
  2246. const peekedByte = this.getByte();
  2247. if (peekedByte !== -1) {
  2248. this.pos--;
  2249. }
  2250. return peekedByte;
  2251. }
  2252. peekBytes(length) {
  2253. const bytes = this.getBytes(length);
  2254. this.pos -= bytes.length;
  2255. return bytes;
  2256. }
  2257. getUint16() {
  2258. const b0 = this.getByte();
  2259. const b1 = this.getByte();
  2260. if (b0 === -1 || b1 === -1) {
  2261. return -1;
  2262. }
  2263. return (b0 << 8) + b1;
  2264. }
  2265. getInt32() {
  2266. const b0 = this.getByte();
  2267. const b1 = this.getByte();
  2268. const b2 = this.getByte();
  2269. const b3 = this.getByte();
  2270. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  2271. }
  2272. getByteRange(begin, end) {
  2273. (0, _util.unreachable)("Abstract method `getByteRange` called");
  2274. }
  2275. getString(length) {
  2276. return (0, _util.bytesToString)(this.getBytes(length));
  2277. }
  2278. skip(n) {
  2279. this.pos += n || 1;
  2280. }
  2281. reset() {
  2282. (0, _util.unreachable)("Abstract method `reset` called");
  2283. }
  2284. moveStart() {
  2285. (0, _util.unreachable)("Abstract method `moveStart` called");
  2286. }
  2287. makeSubStream(start, length, dict = null) {
  2288. (0, _util.unreachable)("Abstract method `makeSubStream` called");
  2289. }
  2290. getBaseStreams() {
  2291. return null;
  2292. }
  2293. }
  2294. exports.BaseStream = BaseStream;
  2295. /***/ }),
  2296. /* 8 */
  2297. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2298. Object.defineProperty(exports, "__esModule", ({
  2299. value: true
  2300. }));
  2301. exports.NetworkPdfManager = exports.LocalPdfManager = void 0;
  2302. var _util = __w_pdfjs_require__(2);
  2303. var _chunked_stream = __w_pdfjs_require__(9);
  2304. var _core_utils = __w_pdfjs_require__(6);
  2305. var _document = __w_pdfjs_require__(11);
  2306. var _stream = __w_pdfjs_require__(10);
  2307. function parseDocBaseUrl(url) {
  2308. if (url) {
  2309. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(url);
  2310. if (absoluteUrl) {
  2311. return absoluteUrl.href;
  2312. }
  2313. (0, _util.warn)(`Invalid absolute docBaseUrl: "${url}".`);
  2314. }
  2315. return null;
  2316. }
  2317. class BasePdfManager {
  2318. constructor() {
  2319. if (this.constructor === BasePdfManager) {
  2320. (0, _util.unreachable)("Cannot initialize BasePdfManager.");
  2321. }
  2322. }
  2323. get docId() {
  2324. return this._docId;
  2325. }
  2326. get password() {
  2327. return this._password;
  2328. }
  2329. get docBaseUrl() {
  2330. const catalog = this.pdfDocument.catalog;
  2331. return (0, _util.shadow)(this, "docBaseUrl", catalog.baseUrl || this._docBaseUrl);
  2332. }
  2333. onLoadedStream() {
  2334. (0, _util.unreachable)("Abstract method `onLoadedStream` called");
  2335. }
  2336. ensureDoc(prop, args) {
  2337. return this.ensure(this.pdfDocument, prop, args);
  2338. }
  2339. ensureXRef(prop, args) {
  2340. return this.ensure(this.pdfDocument.xref, prop, args);
  2341. }
  2342. ensureCatalog(prop, args) {
  2343. return this.ensure(this.pdfDocument.catalog, prop, args);
  2344. }
  2345. getPage(pageIndex) {
  2346. return this.pdfDocument.getPage(pageIndex);
  2347. }
  2348. fontFallback(id, handler) {
  2349. return this.pdfDocument.fontFallback(id, handler);
  2350. }
  2351. loadXfaFonts(handler, task) {
  2352. return this.pdfDocument.loadXfaFonts(handler, task);
  2353. }
  2354. loadXfaImages() {
  2355. return this.pdfDocument.loadXfaImages();
  2356. }
  2357. serializeXfaData(annotationStorage) {
  2358. return this.pdfDocument.serializeXfaData(annotationStorage);
  2359. }
  2360. cleanup(manuallyTriggered = false) {
  2361. return this.pdfDocument.cleanup(manuallyTriggered);
  2362. }
  2363. async ensure(obj, prop, args) {
  2364. (0, _util.unreachable)("Abstract method `ensure` called");
  2365. }
  2366. requestRange(begin, end) {
  2367. (0, _util.unreachable)("Abstract method `requestRange` called");
  2368. }
  2369. requestLoadedStream() {
  2370. (0, _util.unreachable)("Abstract method `requestLoadedStream` called");
  2371. }
  2372. sendProgressiveData(chunk) {
  2373. (0, _util.unreachable)("Abstract method `sendProgressiveData` called");
  2374. }
  2375. updatePassword(password) {
  2376. this._password = password;
  2377. }
  2378. terminate(reason) {
  2379. (0, _util.unreachable)("Abstract method `terminate` called");
  2380. }
  2381. }
  2382. class LocalPdfManager extends BasePdfManager {
  2383. constructor(docId, data, password, msgHandler, evaluatorOptions, enableXfa, docBaseUrl) {
  2384. super();
  2385. this._docId = docId;
  2386. this._password = password;
  2387. this._docBaseUrl = parseDocBaseUrl(docBaseUrl);
  2388. this.msgHandler = msgHandler;
  2389. this.evaluatorOptions = evaluatorOptions;
  2390. this.enableXfa = enableXfa;
  2391. const stream = new _stream.Stream(data);
  2392. this.pdfDocument = new _document.PDFDocument(this, stream);
  2393. this._loadedStreamPromise = Promise.resolve(stream);
  2394. }
  2395. async ensure(obj, prop, args) {
  2396. const value = obj[prop];
  2397. if (typeof value === "function") {
  2398. return value.apply(obj, args);
  2399. }
  2400. return value;
  2401. }
  2402. requestRange(begin, end) {
  2403. return Promise.resolve();
  2404. }
  2405. requestLoadedStream() {}
  2406. onLoadedStream() {
  2407. return this._loadedStreamPromise;
  2408. }
  2409. terminate(reason) {}
  2410. }
  2411. exports.LocalPdfManager = LocalPdfManager;
  2412. class NetworkPdfManager extends BasePdfManager {
  2413. constructor(docId, pdfNetworkStream, args, evaluatorOptions, enableXfa, docBaseUrl) {
  2414. super();
  2415. this._docId = docId;
  2416. this._password = args.password;
  2417. this._docBaseUrl = parseDocBaseUrl(docBaseUrl);
  2418. this.msgHandler = args.msgHandler;
  2419. this.evaluatorOptions = evaluatorOptions;
  2420. this.enableXfa = enableXfa;
  2421. this.streamManager = new _chunked_stream.ChunkedStreamManager(pdfNetworkStream, {
  2422. msgHandler: args.msgHandler,
  2423. length: args.length,
  2424. disableAutoFetch: args.disableAutoFetch,
  2425. rangeChunkSize: args.rangeChunkSize
  2426. });
  2427. this.pdfDocument = new _document.PDFDocument(this, this.streamManager.getStream());
  2428. }
  2429. async ensure(obj, prop, args) {
  2430. try {
  2431. const value = obj[prop];
  2432. if (typeof value === "function") {
  2433. return value.apply(obj, args);
  2434. }
  2435. return value;
  2436. } catch (ex) {
  2437. if (!(ex instanceof _core_utils.MissingDataException)) {
  2438. throw ex;
  2439. }
  2440. await this.requestRange(ex.begin, ex.end);
  2441. return this.ensure(obj, prop, args);
  2442. }
  2443. }
  2444. requestRange(begin, end) {
  2445. return this.streamManager.requestRange(begin, end);
  2446. }
  2447. requestLoadedStream() {
  2448. this.streamManager.requestAllChunks();
  2449. }
  2450. sendProgressiveData(chunk) {
  2451. this.streamManager.onReceiveData({
  2452. chunk
  2453. });
  2454. }
  2455. onLoadedStream() {
  2456. return this.streamManager.onLoadedStream();
  2457. }
  2458. terminate(reason) {
  2459. this.streamManager.abort(reason);
  2460. }
  2461. }
  2462. exports.NetworkPdfManager = NetworkPdfManager;
  2463. /***/ }),
  2464. /* 9 */
  2465. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2466. Object.defineProperty(exports, "__esModule", ({
  2467. value: true
  2468. }));
  2469. exports.ChunkedStreamManager = exports.ChunkedStream = void 0;
  2470. var _util = __w_pdfjs_require__(2);
  2471. var _core_utils = __w_pdfjs_require__(6);
  2472. var _stream = __w_pdfjs_require__(10);
  2473. class ChunkedStream extends _stream.Stream {
  2474. constructor(length, chunkSize, manager) {
  2475. super(new Uint8Array(length), 0, length, null);
  2476. this.chunkSize = chunkSize;
  2477. this._loadedChunks = new Set();
  2478. this.numChunks = Math.ceil(length / chunkSize);
  2479. this.manager = manager;
  2480. this.progressiveDataLength = 0;
  2481. this.lastSuccessfulEnsureByteChunk = -1;
  2482. }
  2483. getMissingChunks() {
  2484. const chunks = [];
  2485. for (let chunk = 0, n = this.numChunks; chunk < n; ++chunk) {
  2486. if (!this._loadedChunks.has(chunk)) {
  2487. chunks.push(chunk);
  2488. }
  2489. }
  2490. return chunks;
  2491. }
  2492. get numChunksLoaded() {
  2493. return this._loadedChunks.size;
  2494. }
  2495. get isDataLoaded() {
  2496. return this.numChunksLoaded === this.numChunks;
  2497. }
  2498. onReceiveData(begin, chunk) {
  2499. const chunkSize = this.chunkSize;
  2500. if (begin % chunkSize !== 0) {
  2501. throw new Error(`Bad begin offset: ${begin}`);
  2502. }
  2503. const end = begin + chunk.byteLength;
  2504. if (end % chunkSize !== 0 && end !== this.bytes.length) {
  2505. throw new Error(`Bad end offset: ${end}`);
  2506. }
  2507. this.bytes.set(new Uint8Array(chunk), begin);
  2508. const beginChunk = Math.floor(begin / chunkSize);
  2509. const endChunk = Math.floor((end - 1) / chunkSize) + 1;
  2510. for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  2511. this._loadedChunks.add(curChunk);
  2512. }
  2513. }
  2514. onReceiveProgressiveData(data) {
  2515. let position = this.progressiveDataLength;
  2516. const beginChunk = Math.floor(position / this.chunkSize);
  2517. this.bytes.set(new Uint8Array(data), position);
  2518. position += data.byteLength;
  2519. this.progressiveDataLength = position;
  2520. const endChunk = position >= this.end ? this.numChunks : Math.floor(position / this.chunkSize);
  2521. for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  2522. this._loadedChunks.add(curChunk);
  2523. }
  2524. }
  2525. ensureByte(pos) {
  2526. if (pos < this.progressiveDataLength) {
  2527. return;
  2528. }
  2529. const chunk = Math.floor(pos / this.chunkSize);
  2530. if (chunk > this.numChunks) {
  2531. return;
  2532. }
  2533. if (chunk === this.lastSuccessfulEnsureByteChunk) {
  2534. return;
  2535. }
  2536. if (!this._loadedChunks.has(chunk)) {
  2537. throw new _core_utils.MissingDataException(pos, pos + 1);
  2538. }
  2539. this.lastSuccessfulEnsureByteChunk = chunk;
  2540. }
  2541. ensureRange(begin, end) {
  2542. if (begin >= end) {
  2543. return;
  2544. }
  2545. if (end <= this.progressiveDataLength) {
  2546. return;
  2547. }
  2548. const beginChunk = Math.floor(begin / this.chunkSize);
  2549. if (beginChunk > this.numChunks) {
  2550. return;
  2551. }
  2552. const endChunk = Math.min(Math.floor((end - 1) / this.chunkSize) + 1, this.numChunks);
  2553. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  2554. if (!this._loadedChunks.has(chunk)) {
  2555. throw new _core_utils.MissingDataException(begin, end);
  2556. }
  2557. }
  2558. }
  2559. nextEmptyChunk(beginChunk) {
  2560. const numChunks = this.numChunks;
  2561. for (let i = 0; i < numChunks; ++i) {
  2562. const chunk = (beginChunk + i) % numChunks;
  2563. if (!this._loadedChunks.has(chunk)) {
  2564. return chunk;
  2565. }
  2566. }
  2567. return null;
  2568. }
  2569. hasChunk(chunk) {
  2570. return this._loadedChunks.has(chunk);
  2571. }
  2572. getByte() {
  2573. const pos = this.pos;
  2574. if (pos >= this.end) {
  2575. return -1;
  2576. }
  2577. if (pos >= this.progressiveDataLength) {
  2578. this.ensureByte(pos);
  2579. }
  2580. return this.bytes[this.pos++];
  2581. }
  2582. getBytes(length) {
  2583. const bytes = this.bytes;
  2584. const pos = this.pos;
  2585. const strEnd = this.end;
  2586. if (!length) {
  2587. if (strEnd > this.progressiveDataLength) {
  2588. this.ensureRange(pos, strEnd);
  2589. }
  2590. return bytes.subarray(pos, strEnd);
  2591. }
  2592. let end = pos + length;
  2593. if (end > strEnd) {
  2594. end = strEnd;
  2595. }
  2596. if (end > this.progressiveDataLength) {
  2597. this.ensureRange(pos, end);
  2598. }
  2599. this.pos = end;
  2600. return bytes.subarray(pos, end);
  2601. }
  2602. getByteRange(begin, end) {
  2603. if (begin < 0) {
  2604. begin = 0;
  2605. }
  2606. if (end > this.end) {
  2607. end = this.end;
  2608. }
  2609. if (end > this.progressiveDataLength) {
  2610. this.ensureRange(begin, end);
  2611. }
  2612. return this.bytes.subarray(begin, end);
  2613. }
  2614. makeSubStream(start, length, dict = null) {
  2615. if (length) {
  2616. if (start + length > this.progressiveDataLength) {
  2617. this.ensureRange(start, start + length);
  2618. }
  2619. } else {
  2620. if (start >= this.progressiveDataLength) {
  2621. this.ensureByte(start);
  2622. }
  2623. }
  2624. function ChunkedStreamSubstream() {}
  2625. ChunkedStreamSubstream.prototype = Object.create(this);
  2626. ChunkedStreamSubstream.prototype.getMissingChunks = function () {
  2627. const chunkSize = this.chunkSize;
  2628. const beginChunk = Math.floor(this.start / chunkSize);
  2629. const endChunk = Math.floor((this.end - 1) / chunkSize) + 1;
  2630. const missingChunks = [];
  2631. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  2632. if (!this._loadedChunks.has(chunk)) {
  2633. missingChunks.push(chunk);
  2634. }
  2635. }
  2636. return missingChunks;
  2637. };
  2638. Object.defineProperty(ChunkedStreamSubstream.prototype, "isDataLoaded", {
  2639. get() {
  2640. if (this.numChunksLoaded === this.numChunks) {
  2641. return true;
  2642. }
  2643. return this.getMissingChunks().length === 0;
  2644. },
  2645. configurable: true
  2646. });
  2647. const subStream = new ChunkedStreamSubstream();
  2648. subStream.pos = subStream.start = start;
  2649. subStream.end = start + length || this.end;
  2650. subStream.dict = dict;
  2651. return subStream;
  2652. }
  2653. getBaseStreams() {
  2654. return [this];
  2655. }
  2656. }
  2657. exports.ChunkedStream = ChunkedStream;
  2658. class ChunkedStreamManager {
  2659. constructor(pdfNetworkStream, args) {
  2660. this.length = args.length;
  2661. this.chunkSize = args.rangeChunkSize;
  2662. this.stream = new ChunkedStream(this.length, this.chunkSize, this);
  2663. this.pdfNetworkStream = pdfNetworkStream;
  2664. this.disableAutoFetch = args.disableAutoFetch;
  2665. this.msgHandler = args.msgHandler;
  2666. this.currRequestId = 0;
  2667. this._chunksNeededByRequest = new Map();
  2668. this._requestsByChunk = new Map();
  2669. this._promisesByRequest = new Map();
  2670. this.progressiveDataLength = 0;
  2671. this.aborted = false;
  2672. this._loadedStreamCapability = (0, _util.createPromiseCapability)();
  2673. }
  2674. onLoadedStream() {
  2675. return this._loadedStreamCapability.promise;
  2676. }
  2677. sendRequest(begin, end) {
  2678. const rangeReader = this.pdfNetworkStream.getRangeReader(begin, end);
  2679. if (!rangeReader.isStreamingSupported) {
  2680. rangeReader.onProgress = this.onProgress.bind(this);
  2681. }
  2682. let chunks = [],
  2683. loaded = 0;
  2684. return new Promise((resolve, reject) => {
  2685. const readChunk = chunk => {
  2686. try {
  2687. if (!chunk.done) {
  2688. const data = chunk.value;
  2689. chunks.push(data);
  2690. loaded += (0, _util.arrayByteLength)(data);
  2691. if (rangeReader.isStreamingSupported) {
  2692. this.onProgress({
  2693. loaded
  2694. });
  2695. }
  2696. rangeReader.read().then(readChunk, reject);
  2697. return;
  2698. }
  2699. const chunkData = (0, _util.arraysToBytes)(chunks);
  2700. chunks = null;
  2701. resolve(chunkData);
  2702. } catch (e) {
  2703. reject(e);
  2704. }
  2705. };
  2706. rangeReader.read().then(readChunk, reject);
  2707. }).then(data => {
  2708. if (this.aborted) {
  2709. return;
  2710. }
  2711. this.onReceiveData({
  2712. chunk: data,
  2713. begin
  2714. });
  2715. });
  2716. }
  2717. requestAllChunks() {
  2718. const missingChunks = this.stream.getMissingChunks();
  2719. this._requestChunks(missingChunks);
  2720. return this._loadedStreamCapability.promise;
  2721. }
  2722. _requestChunks(chunks) {
  2723. const requestId = this.currRequestId++;
  2724. const chunksNeeded = new Set();
  2725. this._chunksNeededByRequest.set(requestId, chunksNeeded);
  2726. for (const chunk of chunks) {
  2727. if (!this.stream.hasChunk(chunk)) {
  2728. chunksNeeded.add(chunk);
  2729. }
  2730. }
  2731. if (chunksNeeded.size === 0) {
  2732. return Promise.resolve();
  2733. }
  2734. const capability = (0, _util.createPromiseCapability)();
  2735. this._promisesByRequest.set(requestId, capability);
  2736. const chunksToRequest = [];
  2737. for (const chunk of chunksNeeded) {
  2738. let requestIds = this._requestsByChunk.get(chunk);
  2739. if (!requestIds) {
  2740. requestIds = [];
  2741. this._requestsByChunk.set(chunk, requestIds);
  2742. chunksToRequest.push(chunk);
  2743. }
  2744. requestIds.push(requestId);
  2745. }
  2746. if (chunksToRequest.length > 0) {
  2747. const groupedChunksToRequest = this.groupChunks(chunksToRequest);
  2748. for (const groupedChunk of groupedChunksToRequest) {
  2749. const begin = groupedChunk.beginChunk * this.chunkSize;
  2750. const end = Math.min(groupedChunk.endChunk * this.chunkSize, this.length);
  2751. this.sendRequest(begin, end).catch(capability.reject);
  2752. }
  2753. }
  2754. return capability.promise.catch(reason => {
  2755. if (this.aborted) {
  2756. return;
  2757. }
  2758. throw reason;
  2759. });
  2760. }
  2761. getStream() {
  2762. return this.stream;
  2763. }
  2764. requestRange(begin, end) {
  2765. end = Math.min(end, this.length);
  2766. const beginChunk = this.getBeginChunk(begin);
  2767. const endChunk = this.getEndChunk(end);
  2768. const chunks = [];
  2769. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  2770. chunks.push(chunk);
  2771. }
  2772. return this._requestChunks(chunks);
  2773. }
  2774. requestRanges(ranges = []) {
  2775. const chunksToRequest = [];
  2776. for (const range of ranges) {
  2777. const beginChunk = this.getBeginChunk(range.begin);
  2778. const endChunk = this.getEndChunk(range.end);
  2779. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  2780. if (!chunksToRequest.includes(chunk)) {
  2781. chunksToRequest.push(chunk);
  2782. }
  2783. }
  2784. }
  2785. chunksToRequest.sort(function (a, b) {
  2786. return a - b;
  2787. });
  2788. return this._requestChunks(chunksToRequest);
  2789. }
  2790. groupChunks(chunks) {
  2791. const groupedChunks = [];
  2792. let beginChunk = -1;
  2793. let prevChunk = -1;
  2794. for (let i = 0, ii = chunks.length; i < ii; ++i) {
  2795. const chunk = chunks[i];
  2796. if (beginChunk < 0) {
  2797. beginChunk = chunk;
  2798. }
  2799. if (prevChunk >= 0 && prevChunk + 1 !== chunk) {
  2800. groupedChunks.push({
  2801. beginChunk,
  2802. endChunk: prevChunk + 1
  2803. });
  2804. beginChunk = chunk;
  2805. }
  2806. if (i + 1 === chunks.length) {
  2807. groupedChunks.push({
  2808. beginChunk,
  2809. endChunk: chunk + 1
  2810. });
  2811. }
  2812. prevChunk = chunk;
  2813. }
  2814. return groupedChunks;
  2815. }
  2816. onProgress(args) {
  2817. this.msgHandler.send("DocProgress", {
  2818. loaded: this.stream.numChunksLoaded * this.chunkSize + args.loaded,
  2819. total: this.length
  2820. });
  2821. }
  2822. onReceiveData(args) {
  2823. const chunk = args.chunk;
  2824. const isProgressive = args.begin === undefined;
  2825. const begin = isProgressive ? this.progressiveDataLength : args.begin;
  2826. const end = begin + chunk.byteLength;
  2827. const beginChunk = Math.floor(begin / this.chunkSize);
  2828. const endChunk = end < this.length ? Math.floor(end / this.chunkSize) : Math.ceil(end / this.chunkSize);
  2829. if (isProgressive) {
  2830. this.stream.onReceiveProgressiveData(chunk);
  2831. this.progressiveDataLength = end;
  2832. } else {
  2833. this.stream.onReceiveData(begin, chunk);
  2834. }
  2835. if (this.stream.isDataLoaded) {
  2836. this._loadedStreamCapability.resolve(this.stream);
  2837. }
  2838. const loadedRequests = [];
  2839. for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  2840. const requestIds = this._requestsByChunk.get(curChunk);
  2841. if (!requestIds) {
  2842. continue;
  2843. }
  2844. this._requestsByChunk.delete(curChunk);
  2845. for (const requestId of requestIds) {
  2846. const chunksNeeded = this._chunksNeededByRequest.get(requestId);
  2847. if (chunksNeeded.has(curChunk)) {
  2848. chunksNeeded.delete(curChunk);
  2849. }
  2850. if (chunksNeeded.size > 0) {
  2851. continue;
  2852. }
  2853. loadedRequests.push(requestId);
  2854. }
  2855. }
  2856. if (!this.disableAutoFetch && this._requestsByChunk.size === 0) {
  2857. let nextEmptyChunk;
  2858. if (this.stream.numChunksLoaded === 1) {
  2859. const lastChunk = this.stream.numChunks - 1;
  2860. if (!this.stream.hasChunk(lastChunk)) {
  2861. nextEmptyChunk = lastChunk;
  2862. }
  2863. } else {
  2864. nextEmptyChunk = this.stream.nextEmptyChunk(endChunk);
  2865. }
  2866. if (Number.isInteger(nextEmptyChunk)) {
  2867. this._requestChunks([nextEmptyChunk]);
  2868. }
  2869. }
  2870. for (const requestId of loadedRequests) {
  2871. const capability = this._promisesByRequest.get(requestId);
  2872. this._promisesByRequest.delete(requestId);
  2873. capability.resolve();
  2874. }
  2875. this.msgHandler.send("DocProgress", {
  2876. loaded: this.stream.numChunksLoaded * this.chunkSize,
  2877. total: this.length
  2878. });
  2879. }
  2880. onError(err) {
  2881. this._loadedStreamCapability.reject(err);
  2882. }
  2883. getBeginChunk(begin) {
  2884. return Math.floor(begin / this.chunkSize);
  2885. }
  2886. getEndChunk(end) {
  2887. return Math.floor((end - 1) / this.chunkSize) + 1;
  2888. }
  2889. abort(reason) {
  2890. this.aborted = true;
  2891. if (this.pdfNetworkStream) {
  2892. this.pdfNetworkStream.cancelAllRequests(reason);
  2893. }
  2894. for (const capability of this._promisesByRequest.values()) {
  2895. capability.reject(reason);
  2896. }
  2897. }
  2898. }
  2899. exports.ChunkedStreamManager = ChunkedStreamManager;
  2900. /***/ }),
  2901. /* 10 */
  2902. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2903. Object.defineProperty(exports, "__esModule", ({
  2904. value: true
  2905. }));
  2906. exports.StringStream = exports.Stream = exports.NullStream = void 0;
  2907. var _base_stream = __w_pdfjs_require__(7);
  2908. var _util = __w_pdfjs_require__(2);
  2909. class Stream extends _base_stream.BaseStream {
  2910. constructor(arrayBuffer, start, length, dict) {
  2911. super();
  2912. this.bytes = arrayBuffer instanceof Uint8Array ? arrayBuffer : new Uint8Array(arrayBuffer);
  2913. this.start = start || 0;
  2914. this.pos = this.start;
  2915. this.end = start + length || this.bytes.length;
  2916. this.dict = dict;
  2917. }
  2918. get length() {
  2919. return this.end - this.start;
  2920. }
  2921. get isEmpty() {
  2922. return this.length === 0;
  2923. }
  2924. getByte() {
  2925. if (this.pos >= this.end) {
  2926. return -1;
  2927. }
  2928. return this.bytes[this.pos++];
  2929. }
  2930. getBytes(length) {
  2931. const bytes = this.bytes;
  2932. const pos = this.pos;
  2933. const strEnd = this.end;
  2934. if (!length) {
  2935. return bytes.subarray(pos, strEnd);
  2936. }
  2937. let end = pos + length;
  2938. if (end > strEnd) {
  2939. end = strEnd;
  2940. }
  2941. this.pos = end;
  2942. return bytes.subarray(pos, end);
  2943. }
  2944. getByteRange(begin, end) {
  2945. if (begin < 0) {
  2946. begin = 0;
  2947. }
  2948. if (end > this.end) {
  2949. end = this.end;
  2950. }
  2951. return this.bytes.subarray(begin, end);
  2952. }
  2953. reset() {
  2954. this.pos = this.start;
  2955. }
  2956. moveStart() {
  2957. this.start = this.pos;
  2958. }
  2959. makeSubStream(start, length, dict = null) {
  2960. return new Stream(this.bytes.buffer, start, length, dict);
  2961. }
  2962. }
  2963. exports.Stream = Stream;
  2964. class StringStream extends Stream {
  2965. constructor(str) {
  2966. super((0, _util.stringToBytes)(str));
  2967. }
  2968. }
  2969. exports.StringStream = StringStream;
  2970. class NullStream extends Stream {
  2971. constructor() {
  2972. super(new Uint8Array(0));
  2973. }
  2974. }
  2975. exports.NullStream = NullStream;
  2976. /***/ }),
  2977. /* 11 */
  2978. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2979. Object.defineProperty(exports, "__esModule", ({
  2980. value: true
  2981. }));
  2982. exports.Page = exports.PDFDocument = void 0;
  2983. var _util = __w_pdfjs_require__(2);
  2984. var _core_utils = __w_pdfjs_require__(6);
  2985. var _primitives = __w_pdfjs_require__(5);
  2986. var _xfa_fonts = __w_pdfjs_require__(12);
  2987. var _annotation = __w_pdfjs_require__(22);
  2988. var _base_stream = __w_pdfjs_require__(7);
  2989. var _crypto = __w_pdfjs_require__(67);
  2990. var _catalog = __w_pdfjs_require__(69);
  2991. var _cleanup_helper = __w_pdfjs_require__(71);
  2992. var _dataset_reader = __w_pdfjs_require__(100);
  2993. var _parser = __w_pdfjs_require__(27);
  2994. var _stream = __w_pdfjs_require__(10);
  2995. var _object_loader = __w_pdfjs_require__(75);
  2996. var _operator_list = __w_pdfjs_require__(62);
  2997. var _evaluator = __w_pdfjs_require__(25);
  2998. var _decode_stream = __w_pdfjs_require__(29);
  2999. var _struct_tree = __w_pdfjs_require__(74);
  3000. var _writer = __w_pdfjs_require__(65);
  3001. var _factory = __w_pdfjs_require__(76);
  3002. var _xref = __w_pdfjs_require__(101);
  3003. const DEFAULT_USER_UNIT = 1.0;
  3004. const LETTER_SIZE_MEDIABOX = [0, 0, 612, 792];
  3005. class Page {
  3006. constructor({
  3007. pdfManager,
  3008. xref,
  3009. pageIndex,
  3010. pageDict,
  3011. ref,
  3012. globalIdFactory,
  3013. fontCache,
  3014. builtInCMapCache,
  3015. standardFontDataCache,
  3016. globalImageCache,
  3017. nonBlendModesSet,
  3018. xfaFactory
  3019. }) {
  3020. this.pdfManager = pdfManager;
  3021. this.pageIndex = pageIndex;
  3022. this.pageDict = pageDict;
  3023. this.xref = xref;
  3024. this.ref = ref;
  3025. this.fontCache = fontCache;
  3026. this.builtInCMapCache = builtInCMapCache;
  3027. this.standardFontDataCache = standardFontDataCache;
  3028. this.globalImageCache = globalImageCache;
  3029. this.nonBlendModesSet = nonBlendModesSet;
  3030. this.evaluatorOptions = pdfManager.evaluatorOptions;
  3031. this.resourcesPromise = null;
  3032. this.xfaFactory = xfaFactory;
  3033. const idCounters = {
  3034. obj: 0
  3035. };
  3036. this._localIdFactory = class extends globalIdFactory {
  3037. static createObjId() {
  3038. return `p${pageIndex}_${++idCounters.obj}`;
  3039. }
  3040. static getPageObjId() {
  3041. return `page${ref.toString()}`;
  3042. }
  3043. };
  3044. }
  3045. _getInheritableProperty(key, getArray = false) {
  3046. const value = (0, _core_utils.getInheritableProperty)({
  3047. dict: this.pageDict,
  3048. key,
  3049. getArray,
  3050. stopWhenFound: false
  3051. });
  3052. if (!Array.isArray(value)) {
  3053. return value;
  3054. }
  3055. if (value.length === 1 || !(value[0] instanceof _primitives.Dict)) {
  3056. return value[0];
  3057. }
  3058. return _primitives.Dict.merge({
  3059. xref: this.xref,
  3060. dictArray: value
  3061. });
  3062. }
  3063. get content() {
  3064. return this.pageDict.getArray("Contents");
  3065. }
  3066. get resources() {
  3067. const resources = this._getInheritableProperty("Resources");
  3068. return (0, _util.shadow)(this, "resources", resources instanceof _primitives.Dict ? resources : _primitives.Dict.empty);
  3069. }
  3070. _getBoundingBox(name) {
  3071. if (this.xfaData) {
  3072. return this.xfaData.bbox;
  3073. }
  3074. const box = this._getInheritableProperty(name, true);
  3075. if (Array.isArray(box) && box.length === 4) {
  3076. if (box[2] - box[0] !== 0 && box[3] - box[1] !== 0) {
  3077. return box;
  3078. }
  3079. (0, _util.warn)(`Empty /${name} entry.`);
  3080. }
  3081. return null;
  3082. }
  3083. get mediaBox() {
  3084. return (0, _util.shadow)(this, "mediaBox", this._getBoundingBox("MediaBox") || LETTER_SIZE_MEDIABOX);
  3085. }
  3086. get cropBox() {
  3087. return (0, _util.shadow)(this, "cropBox", this._getBoundingBox("CropBox") || this.mediaBox);
  3088. }
  3089. get userUnit() {
  3090. let obj = this.pageDict.get("UserUnit");
  3091. if (typeof obj !== "number" || obj <= 0) {
  3092. obj = DEFAULT_USER_UNIT;
  3093. }
  3094. return (0, _util.shadow)(this, "userUnit", obj);
  3095. }
  3096. get view() {
  3097. const {
  3098. cropBox,
  3099. mediaBox
  3100. } = this;
  3101. let view;
  3102. if (cropBox === mediaBox || (0, _util.isArrayEqual)(cropBox, mediaBox)) {
  3103. view = mediaBox;
  3104. } else {
  3105. const box = _util.Util.intersect(cropBox, mediaBox);
  3106. if (box && box[2] - box[0] !== 0 && box[3] - box[1] !== 0) {
  3107. view = box;
  3108. } else {
  3109. (0, _util.warn)("Empty /CropBox and /MediaBox intersection.");
  3110. }
  3111. }
  3112. return (0, _util.shadow)(this, "view", view || mediaBox);
  3113. }
  3114. get rotate() {
  3115. let rotate = this._getInheritableProperty("Rotate") || 0;
  3116. if (rotate % 90 !== 0) {
  3117. rotate = 0;
  3118. } else if (rotate >= 360) {
  3119. rotate %= 360;
  3120. } else if (rotate < 0) {
  3121. rotate = (rotate % 360 + 360) % 360;
  3122. }
  3123. return (0, _util.shadow)(this, "rotate", rotate);
  3124. }
  3125. _onSubStreamError(handler, reason, objId) {
  3126. if (this.evaluatorOptions.ignoreErrors) {
  3127. handler.send("UnsupportedFeature", {
  3128. featureId: _util.UNSUPPORTED_FEATURES.errorContentSubStream
  3129. });
  3130. (0, _util.warn)(`getContentStream - ignoring sub-stream (${objId}): "${reason}".`);
  3131. return;
  3132. }
  3133. throw reason;
  3134. }
  3135. getContentStream(handler) {
  3136. return this.pdfManager.ensure(this, "content").then(content => {
  3137. if (content instanceof _base_stream.BaseStream) {
  3138. return content;
  3139. }
  3140. if (Array.isArray(content)) {
  3141. return new _decode_stream.StreamsSequenceStream(content, this._onSubStreamError.bind(this, handler));
  3142. }
  3143. return new _stream.NullStream();
  3144. });
  3145. }
  3146. get xfaData() {
  3147. return (0, _util.shadow)(this, "xfaData", this.xfaFactory ? {
  3148. bbox: this.xfaFactory.getBoundingBox(this.pageIndex)
  3149. } : null);
  3150. }
  3151. async saveNewAnnotations(handler, task, annotations) {
  3152. if (this.xfaFactory) {
  3153. throw new Error("XFA: Cannot save new annotations.");
  3154. }
  3155. const partialEvaluator = new _evaluator.PartialEvaluator({
  3156. xref: this.xref,
  3157. handler,
  3158. pageIndex: this.pageIndex,
  3159. idFactory: this._localIdFactory,
  3160. fontCache: this.fontCache,
  3161. builtInCMapCache: this.builtInCMapCache,
  3162. standardFontDataCache: this.standardFontDataCache,
  3163. globalImageCache: this.globalImageCache,
  3164. options: this.evaluatorOptions
  3165. });
  3166. const pageDict = this.pageDict;
  3167. const annotationsArray = this.annotations.slice();
  3168. const newData = await _annotation.AnnotationFactory.saveNewAnnotations(partialEvaluator, task, annotations);
  3169. for (const {
  3170. ref
  3171. } of newData.annotations) {
  3172. annotationsArray.push(ref);
  3173. }
  3174. const savedDict = pageDict.get("Annots");
  3175. pageDict.set("Annots", annotationsArray);
  3176. const buffer = [];
  3177. let transform = null;
  3178. if (this.xref.encrypt) {
  3179. transform = this.xref.encrypt.createCipherTransform(this.ref.num, this.ref.gen);
  3180. }
  3181. (0, _writer.writeObject)(this.ref, pageDict, buffer, transform);
  3182. if (savedDict) {
  3183. pageDict.set("Annots", savedDict);
  3184. }
  3185. const objects = newData.dependencies;
  3186. objects.push({
  3187. ref: this.ref,
  3188. data: buffer.join("")
  3189. }, ...newData.annotations);
  3190. return objects;
  3191. }
  3192. save(handler, task, annotationStorage) {
  3193. const partialEvaluator = new _evaluator.PartialEvaluator({
  3194. xref: this.xref,
  3195. handler,
  3196. pageIndex: this.pageIndex,
  3197. idFactory: this._localIdFactory,
  3198. fontCache: this.fontCache,
  3199. builtInCMapCache: this.builtInCMapCache,
  3200. standardFontDataCache: this.standardFontDataCache,
  3201. globalImageCache: this.globalImageCache,
  3202. options: this.evaluatorOptions
  3203. });
  3204. return this._parsedAnnotations.then(function (annotations) {
  3205. const newRefsPromises = [];
  3206. for (const annotation of annotations) {
  3207. if (!annotation.mustBePrinted(annotationStorage)) {
  3208. continue;
  3209. }
  3210. newRefsPromises.push(annotation.save(partialEvaluator, task, annotationStorage).catch(function (reason) {
  3211. (0, _util.warn)("save - ignoring annotation data during " + `"${task.name}" task: "${reason}".`);
  3212. return null;
  3213. }));
  3214. }
  3215. return Promise.all(newRefsPromises).then(function (newRefs) {
  3216. return newRefs.filter(newRef => !!newRef);
  3217. });
  3218. });
  3219. }
  3220. loadResources(keys) {
  3221. if (!this.resourcesPromise) {
  3222. this.resourcesPromise = this.pdfManager.ensure(this, "resources");
  3223. }
  3224. return this.resourcesPromise.then(() => {
  3225. const objectLoader = new _object_loader.ObjectLoader(this.resources, keys, this.xref);
  3226. return objectLoader.load();
  3227. });
  3228. }
  3229. getOperatorList({
  3230. handler,
  3231. sink,
  3232. task,
  3233. intent,
  3234. cacheKey,
  3235. annotationStorage = null
  3236. }) {
  3237. const contentStreamPromise = this.getContentStream(handler);
  3238. const resourcesPromise = this.loadResources(["ColorSpace", "ExtGState", "Font", "Pattern", "Properties", "Shading", "XObject"]);
  3239. const partialEvaluator = new _evaluator.PartialEvaluator({
  3240. xref: this.xref,
  3241. handler,
  3242. pageIndex: this.pageIndex,
  3243. idFactory: this._localIdFactory,
  3244. fontCache: this.fontCache,
  3245. builtInCMapCache: this.builtInCMapCache,
  3246. standardFontDataCache: this.standardFontDataCache,
  3247. globalImageCache: this.globalImageCache,
  3248. options: this.evaluatorOptions
  3249. });
  3250. const newAnnotationsByPage = !this.xfaFactory ? (0, _core_utils.getNewAnnotationsMap)(annotationStorage) : null;
  3251. let newAnnotationsPromise = Promise.resolve(null);
  3252. if (newAnnotationsByPage) {
  3253. const newAnnotations = newAnnotationsByPage.get(this.pageIndex);
  3254. if (newAnnotations) {
  3255. newAnnotationsPromise = _annotation.AnnotationFactory.printNewAnnotations(partialEvaluator, task, newAnnotations);
  3256. }
  3257. }
  3258. const dataPromises = Promise.all([contentStreamPromise, resourcesPromise]);
  3259. const pageListPromise = dataPromises.then(([contentStream]) => {
  3260. const opList = new _operator_list.OperatorList(intent, sink);
  3261. handler.send("StartRenderPage", {
  3262. transparency: partialEvaluator.hasBlendModes(this.resources, this.nonBlendModesSet),
  3263. pageIndex: this.pageIndex,
  3264. cacheKey
  3265. });
  3266. return partialEvaluator.getOperatorList({
  3267. stream: contentStream,
  3268. task,
  3269. resources: this.resources,
  3270. operatorList: opList
  3271. }).then(function () {
  3272. return opList;
  3273. });
  3274. });
  3275. return Promise.all([pageListPromise, this._parsedAnnotations, newAnnotationsPromise]).then(function ([pageOpList, annotations, newAnnotations]) {
  3276. if (newAnnotations) {
  3277. annotations = annotations.concat(newAnnotations);
  3278. }
  3279. if (annotations.length === 0 || intent & _util.RenderingIntentFlag.ANNOTATIONS_DISABLE) {
  3280. pageOpList.flush(true);
  3281. return {
  3282. length: pageOpList.totalLength
  3283. };
  3284. }
  3285. const renderForms = !!(intent & _util.RenderingIntentFlag.ANNOTATIONS_FORMS),
  3286. intentAny = !!(intent & _util.RenderingIntentFlag.ANY),
  3287. intentDisplay = !!(intent & _util.RenderingIntentFlag.DISPLAY),
  3288. intentPrint = !!(intent & _util.RenderingIntentFlag.PRINT);
  3289. const opListPromises = [];
  3290. for (const annotation of annotations) {
  3291. if (intentAny || intentDisplay && annotation.mustBeViewed(annotationStorage) || intentPrint && annotation.mustBePrinted(annotationStorage)) {
  3292. opListPromises.push(annotation.getOperatorList(partialEvaluator, task, intent, renderForms, annotationStorage).catch(function (reason) {
  3293. (0, _util.warn)("getOperatorList - ignoring annotation data during " + `"${task.name}" task: "${reason}".`);
  3294. return null;
  3295. }));
  3296. }
  3297. }
  3298. return Promise.all(opListPromises).then(function (opLists) {
  3299. let form = false,
  3300. canvas = false;
  3301. for (const {
  3302. opList,
  3303. separateForm,
  3304. separateCanvas
  3305. } of opLists) {
  3306. pageOpList.addOpList(opList);
  3307. if (separateForm) {
  3308. form = separateForm;
  3309. }
  3310. if (separateCanvas) {
  3311. canvas = separateCanvas;
  3312. }
  3313. }
  3314. pageOpList.flush(true, {
  3315. form,
  3316. canvas
  3317. });
  3318. return {
  3319. length: pageOpList.totalLength
  3320. };
  3321. });
  3322. });
  3323. }
  3324. extractTextContent({
  3325. handler,
  3326. task,
  3327. includeMarkedContent,
  3328. sink,
  3329. combineTextItems
  3330. }) {
  3331. const contentStreamPromise = this.getContentStream(handler);
  3332. const resourcesPromise = this.loadResources(["ExtGState", "Font", "Properties", "XObject"]);
  3333. const dataPromises = Promise.all([contentStreamPromise, resourcesPromise]);
  3334. return dataPromises.then(([contentStream]) => {
  3335. const partialEvaluator = new _evaluator.PartialEvaluator({
  3336. xref: this.xref,
  3337. handler,
  3338. pageIndex: this.pageIndex,
  3339. idFactory: this._localIdFactory,
  3340. fontCache: this.fontCache,
  3341. builtInCMapCache: this.builtInCMapCache,
  3342. standardFontDataCache: this.standardFontDataCache,
  3343. globalImageCache: this.globalImageCache,
  3344. options: this.evaluatorOptions
  3345. });
  3346. return partialEvaluator.getTextContent({
  3347. stream: contentStream,
  3348. task,
  3349. resources: this.resources,
  3350. includeMarkedContent,
  3351. combineTextItems,
  3352. sink,
  3353. viewBox: this.view
  3354. });
  3355. });
  3356. }
  3357. async getStructTree() {
  3358. const structTreeRoot = await this.pdfManager.ensureCatalog("structTreeRoot");
  3359. if (!structTreeRoot) {
  3360. return null;
  3361. }
  3362. const structTree = await this.pdfManager.ensure(this, "_parseStructTree", [structTreeRoot]);
  3363. return structTree.serializable;
  3364. }
  3365. _parseStructTree(structTreeRoot) {
  3366. const tree = new _struct_tree.StructTreePage(structTreeRoot, this.pageDict);
  3367. tree.parse();
  3368. return tree;
  3369. }
  3370. getAnnotationsData(intent) {
  3371. return this._parsedAnnotations.then(function (annotations) {
  3372. const annotationsData = [];
  3373. if (annotations.length === 0) {
  3374. return annotationsData;
  3375. }
  3376. const intentAny = !!(intent & _util.RenderingIntentFlag.ANY),
  3377. intentDisplay = !!(intent & _util.RenderingIntentFlag.DISPLAY),
  3378. intentPrint = !!(intent & _util.RenderingIntentFlag.PRINT);
  3379. for (const annotation of annotations) {
  3380. if (intentAny || intentDisplay && annotation.viewable || intentPrint && annotation.printable) {
  3381. annotationsData.push(annotation.data);
  3382. }
  3383. }
  3384. return annotationsData;
  3385. });
  3386. }
  3387. get annotations() {
  3388. const annots = this._getInheritableProperty("Annots");
  3389. return (0, _util.shadow)(this, "annotations", Array.isArray(annots) ? annots : []);
  3390. }
  3391. get _parsedAnnotations() {
  3392. const parsedAnnotations = this.pdfManager.ensure(this, "annotations").then(() => {
  3393. const annotationPromises = [];
  3394. for (const annotationRef of this.annotations) {
  3395. annotationPromises.push(_annotation.AnnotationFactory.create(this.xref, annotationRef, this.pdfManager, this._localIdFactory, false).catch(function (reason) {
  3396. (0, _util.warn)(`_parsedAnnotations: "${reason}".`);
  3397. return null;
  3398. }));
  3399. }
  3400. return Promise.all(annotationPromises).then(function (annotations) {
  3401. return annotations.filter(annotation => !!annotation);
  3402. });
  3403. });
  3404. return (0, _util.shadow)(this, "_parsedAnnotations", parsedAnnotations);
  3405. }
  3406. get jsActions() {
  3407. const actions = (0, _core_utils.collectActions)(this.xref, this.pageDict, _util.PageActionEventType);
  3408. return (0, _util.shadow)(this, "jsActions", actions);
  3409. }
  3410. }
  3411. exports.Page = Page;
  3412. const PDF_HEADER_SIGNATURE = new Uint8Array([0x25, 0x50, 0x44, 0x46, 0x2d]);
  3413. const STARTXREF_SIGNATURE = new Uint8Array([0x73, 0x74, 0x61, 0x72, 0x74, 0x78, 0x72, 0x65, 0x66]);
  3414. const ENDOBJ_SIGNATURE = new Uint8Array([0x65, 0x6e, 0x64, 0x6f, 0x62, 0x6a]);
  3415. const FINGERPRINT_FIRST_BYTES = 1024;
  3416. const EMPTY_FINGERPRINT = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00";
  3417. const PDF_HEADER_VERSION_REGEXP = /^[1-9]\.\d$/;
  3418. function find(stream, signature, limit = 1024, backwards = false) {
  3419. const signatureLength = signature.length;
  3420. const scanBytes = stream.peekBytes(limit);
  3421. const scanLength = scanBytes.length - signatureLength;
  3422. if (scanLength <= 0) {
  3423. return false;
  3424. }
  3425. if (backwards) {
  3426. const signatureEnd = signatureLength - 1;
  3427. let pos = scanBytes.length - 1;
  3428. while (pos >= signatureEnd) {
  3429. let j = 0;
  3430. while (j < signatureLength && scanBytes[pos - j] === signature[signatureEnd - j]) {
  3431. j++;
  3432. }
  3433. if (j >= signatureLength) {
  3434. stream.pos += pos - signatureEnd;
  3435. return true;
  3436. }
  3437. pos--;
  3438. }
  3439. } else {
  3440. let pos = 0;
  3441. while (pos <= scanLength) {
  3442. let j = 0;
  3443. while (j < signatureLength && scanBytes[pos + j] === signature[j]) {
  3444. j++;
  3445. }
  3446. if (j >= signatureLength) {
  3447. stream.pos += pos;
  3448. return true;
  3449. }
  3450. pos++;
  3451. }
  3452. }
  3453. return false;
  3454. }
  3455. class PDFDocument {
  3456. constructor(pdfManager, stream) {
  3457. if (stream.length <= 0) {
  3458. throw new _util.InvalidPDFException("The PDF file is empty, i.e. its size is zero bytes.");
  3459. }
  3460. this.pdfManager = pdfManager;
  3461. this.stream = stream;
  3462. this.xref = new _xref.XRef(stream, pdfManager);
  3463. this._pagePromises = new Map();
  3464. this._version = null;
  3465. const idCounters = {
  3466. font: 0
  3467. };
  3468. this._globalIdFactory = class {
  3469. static getDocId() {
  3470. return `g_${pdfManager.docId}`;
  3471. }
  3472. static createFontId() {
  3473. return `f${++idCounters.font}`;
  3474. }
  3475. static createObjId() {
  3476. (0, _util.unreachable)("Abstract method `createObjId` called.");
  3477. }
  3478. static getPageObjId() {
  3479. (0, _util.unreachable)("Abstract method `getPageObjId` called.");
  3480. }
  3481. };
  3482. }
  3483. parse(recoveryMode) {
  3484. this.xref.parse(recoveryMode);
  3485. this.catalog = new _catalog.Catalog(this.pdfManager, this.xref);
  3486. if (this.catalog.version) {
  3487. this._version = this.catalog.version;
  3488. }
  3489. }
  3490. get linearization() {
  3491. let linearization = null;
  3492. try {
  3493. linearization = _parser.Linearization.create(this.stream);
  3494. } catch (err) {
  3495. if (err instanceof _core_utils.MissingDataException) {
  3496. throw err;
  3497. }
  3498. (0, _util.info)(err);
  3499. }
  3500. return (0, _util.shadow)(this, "linearization", linearization);
  3501. }
  3502. get startXRef() {
  3503. const stream = this.stream;
  3504. let startXRef = 0;
  3505. if (this.linearization) {
  3506. stream.reset();
  3507. if (find(stream, ENDOBJ_SIGNATURE)) {
  3508. startXRef = stream.pos + 6 - stream.start;
  3509. }
  3510. } else {
  3511. const step = 1024;
  3512. const startXRefLength = STARTXREF_SIGNATURE.length;
  3513. let found = false,
  3514. pos = stream.end;
  3515. while (!found && pos > 0) {
  3516. pos -= step - startXRefLength;
  3517. if (pos < 0) {
  3518. pos = 0;
  3519. }
  3520. stream.pos = pos;
  3521. found = find(stream, STARTXREF_SIGNATURE, step, true);
  3522. }
  3523. if (found) {
  3524. stream.skip(9);
  3525. let ch;
  3526. do {
  3527. ch = stream.getByte();
  3528. } while ((0, _core_utils.isWhiteSpace)(ch));
  3529. let str = "";
  3530. while (ch >= 0x20 && ch <= 0x39) {
  3531. str += String.fromCharCode(ch);
  3532. ch = stream.getByte();
  3533. }
  3534. startXRef = parseInt(str, 10);
  3535. if (isNaN(startXRef)) {
  3536. startXRef = 0;
  3537. }
  3538. }
  3539. }
  3540. return (0, _util.shadow)(this, "startXRef", startXRef);
  3541. }
  3542. checkHeader() {
  3543. const stream = this.stream;
  3544. stream.reset();
  3545. if (!find(stream, PDF_HEADER_SIGNATURE)) {
  3546. return;
  3547. }
  3548. stream.moveStart();
  3549. const MAX_PDF_VERSION_LENGTH = 12;
  3550. let version = "",
  3551. ch;
  3552. while ((ch = stream.getByte()) > 0x20) {
  3553. if (version.length >= MAX_PDF_VERSION_LENGTH) {
  3554. break;
  3555. }
  3556. version += String.fromCharCode(ch);
  3557. }
  3558. if (!this._version) {
  3559. this._version = version.substring(5);
  3560. }
  3561. }
  3562. parseStartXRef() {
  3563. this.xref.setStartXRef(this.startXRef);
  3564. }
  3565. get numPages() {
  3566. let num = 0;
  3567. if (this.catalog.hasActualNumPages) {
  3568. num = this.catalog.numPages;
  3569. } else if (this.xfaFactory) {
  3570. num = this.xfaFactory.getNumPages();
  3571. } else if (this.linearization) {
  3572. num = this.linearization.numPages;
  3573. } else {
  3574. num = this.catalog.numPages;
  3575. }
  3576. return (0, _util.shadow)(this, "numPages", num);
  3577. }
  3578. _hasOnlyDocumentSignatures(fields, recursionDepth = 0) {
  3579. const RECURSION_LIMIT = 10;
  3580. if (!Array.isArray(fields)) {
  3581. return false;
  3582. }
  3583. return fields.every(field => {
  3584. field = this.xref.fetchIfRef(field);
  3585. if (!(field instanceof _primitives.Dict)) {
  3586. return false;
  3587. }
  3588. if (field.has("Kids")) {
  3589. if (++recursionDepth > RECURSION_LIMIT) {
  3590. (0, _util.warn)("_hasOnlyDocumentSignatures: maximum recursion depth reached");
  3591. return false;
  3592. }
  3593. return this._hasOnlyDocumentSignatures(field.get("Kids"), recursionDepth);
  3594. }
  3595. const isSignature = (0, _primitives.isName)(field.get("FT"), "Sig");
  3596. const rectangle = field.get("Rect");
  3597. const isInvisible = Array.isArray(rectangle) && rectangle.every(value => value === 0);
  3598. return isSignature && isInvisible;
  3599. });
  3600. }
  3601. get _xfaStreams() {
  3602. const acroForm = this.catalog.acroForm;
  3603. if (!acroForm) {
  3604. return null;
  3605. }
  3606. const xfa = acroForm.get("XFA");
  3607. const entries = {
  3608. "xdp:xdp": "",
  3609. template: "",
  3610. datasets: "",
  3611. config: "",
  3612. connectionSet: "",
  3613. localeSet: "",
  3614. stylesheet: "",
  3615. "/xdp:xdp": ""
  3616. };
  3617. if (xfa instanceof _base_stream.BaseStream && !xfa.isEmpty) {
  3618. entries["xdp:xdp"] = xfa;
  3619. return entries;
  3620. }
  3621. if (!Array.isArray(xfa) || xfa.length === 0) {
  3622. return null;
  3623. }
  3624. for (let i = 0, ii = xfa.length; i < ii; i += 2) {
  3625. let name;
  3626. if (i === 0) {
  3627. name = "xdp:xdp";
  3628. } else if (i === ii - 2) {
  3629. name = "/xdp:xdp";
  3630. } else {
  3631. name = xfa[i];
  3632. }
  3633. if (!entries.hasOwnProperty(name)) {
  3634. continue;
  3635. }
  3636. const data = this.xref.fetchIfRef(xfa[i + 1]);
  3637. if (!(data instanceof _base_stream.BaseStream) || data.isEmpty) {
  3638. continue;
  3639. }
  3640. entries[name] = data;
  3641. }
  3642. return entries;
  3643. }
  3644. get xfaDatasets() {
  3645. const streams = this._xfaStreams;
  3646. if (!streams) {
  3647. return (0, _util.shadow)(this, "xfaDatasets", null);
  3648. }
  3649. for (const key of ["datasets", "xdp:xdp"]) {
  3650. const stream = streams[key];
  3651. if (!stream) {
  3652. continue;
  3653. }
  3654. try {
  3655. const str = (0, _util.stringToUTF8String)(stream.getString());
  3656. const data = {
  3657. [key]: str
  3658. };
  3659. return (0, _util.shadow)(this, "xfaDatasets", new _dataset_reader.DatasetReader(data));
  3660. } catch (_) {
  3661. (0, _util.warn)("XFA - Invalid utf-8 string.");
  3662. break;
  3663. }
  3664. }
  3665. return (0, _util.shadow)(this, "xfaDatasets", null);
  3666. }
  3667. get xfaData() {
  3668. const streams = this._xfaStreams;
  3669. if (!streams) {
  3670. return null;
  3671. }
  3672. const data = Object.create(null);
  3673. for (const [key, stream] of Object.entries(streams)) {
  3674. if (!stream) {
  3675. continue;
  3676. }
  3677. try {
  3678. data[key] = (0, _util.stringToUTF8String)(stream.getString());
  3679. } catch (_) {
  3680. (0, _util.warn)("XFA - Invalid utf-8 string.");
  3681. return null;
  3682. }
  3683. }
  3684. return data;
  3685. }
  3686. get xfaFactory() {
  3687. let data;
  3688. if (this.pdfManager.enableXfa && this.catalog.needsRendering && this.formInfo.hasXfa && !this.formInfo.hasAcroForm) {
  3689. data = this.xfaData;
  3690. }
  3691. return (0, _util.shadow)(this, "xfaFactory", data ? new _factory.XFAFactory(data) : null);
  3692. }
  3693. get isPureXfa() {
  3694. return this.xfaFactory ? this.xfaFactory.isValid() : false;
  3695. }
  3696. get htmlForXfa() {
  3697. return this.xfaFactory ? this.xfaFactory.getPages() : null;
  3698. }
  3699. async loadXfaImages() {
  3700. const xfaImagesDict = await this.pdfManager.ensureCatalog("xfaImages");
  3701. if (!xfaImagesDict) {
  3702. return;
  3703. }
  3704. const keys = xfaImagesDict.getKeys();
  3705. const objectLoader = new _object_loader.ObjectLoader(xfaImagesDict, keys, this.xref);
  3706. await objectLoader.load();
  3707. const xfaImages = new Map();
  3708. for (const key of keys) {
  3709. const stream = xfaImagesDict.get(key);
  3710. if (stream instanceof _base_stream.BaseStream) {
  3711. xfaImages.set(key, stream.getBytes());
  3712. }
  3713. }
  3714. this.xfaFactory.setImages(xfaImages);
  3715. }
  3716. async loadXfaFonts(handler, task) {
  3717. const acroForm = await this.pdfManager.ensureCatalog("acroForm");
  3718. if (!acroForm) {
  3719. return;
  3720. }
  3721. const resources = await acroForm.getAsync("DR");
  3722. if (!(resources instanceof _primitives.Dict)) {
  3723. return;
  3724. }
  3725. const objectLoader = new _object_loader.ObjectLoader(resources, ["Font"], this.xref);
  3726. await objectLoader.load();
  3727. const fontRes = resources.get("Font");
  3728. if (!(fontRes instanceof _primitives.Dict)) {
  3729. return;
  3730. }
  3731. const options = Object.assign(Object.create(null), this.pdfManager.evaluatorOptions);
  3732. options.useSystemFonts = false;
  3733. const partialEvaluator = new _evaluator.PartialEvaluator({
  3734. xref: this.xref,
  3735. handler,
  3736. pageIndex: -1,
  3737. idFactory: this._globalIdFactory,
  3738. fontCache: this.catalog.fontCache,
  3739. builtInCMapCache: this.catalog.builtInCMapCache,
  3740. standardFontDataCache: this.catalog.standardFontDataCache,
  3741. options
  3742. });
  3743. const operatorList = new _operator_list.OperatorList();
  3744. const pdfFonts = [];
  3745. const initialState = {
  3746. get font() {
  3747. return pdfFonts.at(-1);
  3748. },
  3749. set font(font) {
  3750. pdfFonts.push(font);
  3751. },
  3752. clone() {
  3753. return this;
  3754. }
  3755. };
  3756. const fonts = new Map();
  3757. fontRes.forEach((fontName, font) => {
  3758. fonts.set(fontName, font);
  3759. });
  3760. const promises = [];
  3761. for (const [fontName, font] of fonts) {
  3762. const descriptor = font.get("FontDescriptor");
  3763. if (!(descriptor instanceof _primitives.Dict)) {
  3764. continue;
  3765. }
  3766. let fontFamily = descriptor.get("FontFamily");
  3767. fontFamily = fontFamily.replace(/[ ]+(\d)/g, "$1");
  3768. const fontWeight = descriptor.get("FontWeight");
  3769. const italicAngle = -descriptor.get("ItalicAngle");
  3770. const cssFontInfo = {
  3771. fontFamily,
  3772. fontWeight,
  3773. italicAngle
  3774. };
  3775. if (!(0, _core_utils.validateCSSFont)(cssFontInfo)) {
  3776. continue;
  3777. }
  3778. promises.push(partialEvaluator.handleSetFont(resources, [_primitives.Name.get(fontName), 1], null, operatorList, task, initialState, null, cssFontInfo).catch(function (reason) {
  3779. (0, _util.warn)(`loadXfaFonts: "${reason}".`);
  3780. return null;
  3781. }));
  3782. }
  3783. await Promise.all(promises);
  3784. const missingFonts = this.xfaFactory.setFonts(pdfFonts);
  3785. if (!missingFonts) {
  3786. return;
  3787. }
  3788. options.ignoreErrors = true;
  3789. promises.length = 0;
  3790. pdfFonts.length = 0;
  3791. const reallyMissingFonts = new Set();
  3792. for (const missing of missingFonts) {
  3793. if (!(0, _xfa_fonts.getXfaFontName)(`${missing}-Regular`)) {
  3794. reallyMissingFonts.add(missing);
  3795. }
  3796. }
  3797. if (reallyMissingFonts.size) {
  3798. missingFonts.push("PdfJS-Fallback");
  3799. }
  3800. for (const missing of missingFonts) {
  3801. if (reallyMissingFonts.has(missing)) {
  3802. continue;
  3803. }
  3804. for (const fontInfo of [{
  3805. name: "Regular",
  3806. fontWeight: 400,
  3807. italicAngle: 0
  3808. }, {
  3809. name: "Bold",
  3810. fontWeight: 700,
  3811. italicAngle: 0
  3812. }, {
  3813. name: "Italic",
  3814. fontWeight: 400,
  3815. italicAngle: 12
  3816. }, {
  3817. name: "BoldItalic",
  3818. fontWeight: 700,
  3819. italicAngle: 12
  3820. }]) {
  3821. const name = `${missing}-${fontInfo.name}`;
  3822. const dict = (0, _xfa_fonts.getXfaFontDict)(name);
  3823. promises.push(partialEvaluator.handleSetFont(resources, [_primitives.Name.get(name), 1], null, operatorList, task, initialState, dict, {
  3824. fontFamily: missing,
  3825. fontWeight: fontInfo.fontWeight,
  3826. italicAngle: fontInfo.italicAngle
  3827. }).catch(function (reason) {
  3828. (0, _util.warn)(`loadXfaFonts: "${reason}".`);
  3829. return null;
  3830. }));
  3831. }
  3832. }
  3833. await Promise.all(promises);
  3834. this.xfaFactory.appendFonts(pdfFonts, reallyMissingFonts);
  3835. }
  3836. async serializeXfaData(annotationStorage) {
  3837. return this.xfaFactory ? this.xfaFactory.serializeData(annotationStorage) : null;
  3838. }
  3839. get formInfo() {
  3840. const formInfo = {
  3841. hasFields: false,
  3842. hasAcroForm: false,
  3843. hasXfa: false,
  3844. hasSignatures: false
  3845. };
  3846. const acroForm = this.catalog.acroForm;
  3847. if (!acroForm) {
  3848. return (0, _util.shadow)(this, "formInfo", formInfo);
  3849. }
  3850. try {
  3851. const fields = acroForm.get("Fields");
  3852. const hasFields = Array.isArray(fields) && fields.length > 0;
  3853. formInfo.hasFields = hasFields;
  3854. const xfa = acroForm.get("XFA");
  3855. formInfo.hasXfa = Array.isArray(xfa) && xfa.length > 0 || xfa instanceof _base_stream.BaseStream && !xfa.isEmpty;
  3856. const sigFlags = acroForm.get("SigFlags");
  3857. const hasSignatures = !!(sigFlags & 0x1);
  3858. const hasOnlyDocumentSignatures = hasSignatures && this._hasOnlyDocumentSignatures(fields);
  3859. formInfo.hasAcroForm = hasFields && !hasOnlyDocumentSignatures;
  3860. formInfo.hasSignatures = hasSignatures;
  3861. } catch (ex) {
  3862. if (ex instanceof _core_utils.MissingDataException) {
  3863. throw ex;
  3864. }
  3865. (0, _util.warn)(`Cannot fetch form information: "${ex}".`);
  3866. }
  3867. return (0, _util.shadow)(this, "formInfo", formInfo);
  3868. }
  3869. get documentInfo() {
  3870. let version = this._version;
  3871. if (typeof version !== "string" || !PDF_HEADER_VERSION_REGEXP.test(version)) {
  3872. (0, _util.warn)(`Invalid PDF header version number: ${version}`);
  3873. version = null;
  3874. }
  3875. const docInfo = {
  3876. PDFFormatVersion: version,
  3877. Language: this.catalog.lang,
  3878. EncryptFilterName: this.xref.encrypt ? this.xref.encrypt.filterName : null,
  3879. IsLinearized: !!this.linearization,
  3880. IsAcroFormPresent: this.formInfo.hasAcroForm,
  3881. IsXFAPresent: this.formInfo.hasXfa,
  3882. IsCollectionPresent: !!this.catalog.collection,
  3883. IsSignaturesPresent: this.formInfo.hasSignatures
  3884. };
  3885. let infoDict;
  3886. try {
  3887. infoDict = this.xref.trailer.get("Info");
  3888. } catch (err) {
  3889. if (err instanceof _core_utils.MissingDataException) {
  3890. throw err;
  3891. }
  3892. (0, _util.info)("The document information dictionary is invalid.");
  3893. }
  3894. if (!(infoDict instanceof _primitives.Dict)) {
  3895. return (0, _util.shadow)(this, "documentInfo", docInfo);
  3896. }
  3897. for (const key of infoDict.getKeys()) {
  3898. const value = infoDict.get(key);
  3899. switch (key) {
  3900. case "Title":
  3901. case "Author":
  3902. case "Subject":
  3903. case "Keywords":
  3904. case "Creator":
  3905. case "Producer":
  3906. case "CreationDate":
  3907. case "ModDate":
  3908. if (typeof value === "string") {
  3909. docInfo[key] = (0, _util.stringToPDFString)(value);
  3910. continue;
  3911. }
  3912. break;
  3913. case "Trapped":
  3914. if (value instanceof _primitives.Name) {
  3915. docInfo[key] = value;
  3916. continue;
  3917. }
  3918. break;
  3919. default:
  3920. let customValue;
  3921. switch (typeof value) {
  3922. case "string":
  3923. customValue = (0, _util.stringToPDFString)(value);
  3924. break;
  3925. case "number":
  3926. case "boolean":
  3927. customValue = value;
  3928. break;
  3929. default:
  3930. if (value instanceof _primitives.Name) {
  3931. customValue = value;
  3932. }
  3933. break;
  3934. }
  3935. if (customValue === undefined) {
  3936. (0, _util.warn)(`Bad value, for custom key "${key}", in Info: ${value}.`);
  3937. continue;
  3938. }
  3939. if (!docInfo.Custom) {
  3940. docInfo.Custom = Object.create(null);
  3941. }
  3942. docInfo.Custom[key] = customValue;
  3943. continue;
  3944. }
  3945. (0, _util.warn)(`Bad value, for key "${key}", in Info: ${value}.`);
  3946. }
  3947. return (0, _util.shadow)(this, "documentInfo", docInfo);
  3948. }
  3949. get fingerprints() {
  3950. function validate(data) {
  3951. return typeof data === "string" && data.length > 0 && data !== EMPTY_FINGERPRINT;
  3952. }
  3953. function hexString(hash) {
  3954. const buf = [];
  3955. for (let i = 0, ii = hash.length; i < ii; i++) {
  3956. const hex = hash[i].toString(16);
  3957. buf.push(hex.padStart(2, "0"));
  3958. }
  3959. return buf.join("");
  3960. }
  3961. const idArray = this.xref.trailer.get("ID");
  3962. let hashOriginal, hashModified;
  3963. if (Array.isArray(idArray) && validate(idArray[0])) {
  3964. hashOriginal = (0, _util.stringToBytes)(idArray[0]);
  3965. if (idArray[1] !== idArray[0] && validate(idArray[1])) {
  3966. hashModified = (0, _util.stringToBytes)(idArray[1]);
  3967. }
  3968. } else {
  3969. hashOriginal = (0, _crypto.calculateMD5)(this.stream.getByteRange(0, FINGERPRINT_FIRST_BYTES), 0, FINGERPRINT_FIRST_BYTES);
  3970. }
  3971. return (0, _util.shadow)(this, "fingerprints", [hexString(hashOriginal), hashModified ? hexString(hashModified) : null]);
  3972. }
  3973. async _getLinearizationPage(pageIndex) {
  3974. const {
  3975. catalog,
  3976. linearization,
  3977. xref
  3978. } = this;
  3979. const ref = _primitives.Ref.get(linearization.objectNumberFirst, 0);
  3980. try {
  3981. const obj = await xref.fetchAsync(ref);
  3982. if (obj instanceof _primitives.Dict) {
  3983. let type = obj.getRaw("Type");
  3984. if (type instanceof _primitives.Ref) {
  3985. type = await xref.fetchAsync(type);
  3986. }
  3987. if ((0, _primitives.isName)(type, "Page") || !obj.has("Type") && !obj.has("Kids")) {
  3988. if (!catalog.pageKidsCountCache.has(ref)) {
  3989. catalog.pageKidsCountCache.put(ref, 1);
  3990. }
  3991. if (!catalog.pageIndexCache.has(ref)) {
  3992. catalog.pageIndexCache.put(ref, 0);
  3993. }
  3994. return [obj, ref];
  3995. }
  3996. }
  3997. throw new _util.FormatError("The Linearization dictionary doesn't point to a valid Page dictionary.");
  3998. } catch (reason) {
  3999. (0, _util.warn)(`_getLinearizationPage: "${reason.message}".`);
  4000. return catalog.getPageDict(pageIndex);
  4001. }
  4002. }
  4003. getPage(pageIndex) {
  4004. const cachedPromise = this._pagePromises.get(pageIndex);
  4005. if (cachedPromise) {
  4006. return cachedPromise;
  4007. }
  4008. const {
  4009. catalog,
  4010. linearization,
  4011. xfaFactory
  4012. } = this;
  4013. let promise;
  4014. if (xfaFactory) {
  4015. promise = Promise.resolve([_primitives.Dict.empty, null]);
  4016. } else if (linearization && linearization.pageFirst === pageIndex) {
  4017. promise = this._getLinearizationPage(pageIndex);
  4018. } else {
  4019. promise = catalog.getPageDict(pageIndex);
  4020. }
  4021. promise = promise.then(([pageDict, ref]) => {
  4022. return new Page({
  4023. pdfManager: this.pdfManager,
  4024. xref: this.xref,
  4025. pageIndex,
  4026. pageDict,
  4027. ref,
  4028. globalIdFactory: this._globalIdFactory,
  4029. fontCache: catalog.fontCache,
  4030. builtInCMapCache: catalog.builtInCMapCache,
  4031. standardFontDataCache: catalog.standardFontDataCache,
  4032. globalImageCache: catalog.globalImageCache,
  4033. nonBlendModesSet: catalog.nonBlendModesSet,
  4034. xfaFactory
  4035. });
  4036. });
  4037. this._pagePromises.set(pageIndex, promise);
  4038. return promise;
  4039. }
  4040. async checkFirstPage(recoveryMode = false) {
  4041. if (recoveryMode) {
  4042. return;
  4043. }
  4044. try {
  4045. await this.getPage(0);
  4046. } catch (reason) {
  4047. if (reason instanceof _core_utils.XRefEntryException) {
  4048. this._pagePromises.delete(0);
  4049. await this.cleanup();
  4050. throw new _core_utils.XRefParseException();
  4051. }
  4052. }
  4053. }
  4054. async checkLastPage(recoveryMode = false) {
  4055. const {
  4056. catalog,
  4057. pdfManager
  4058. } = this;
  4059. catalog.setActualNumPages();
  4060. let numPages;
  4061. try {
  4062. await Promise.all([pdfManager.ensureDoc("xfaFactory"), pdfManager.ensureDoc("linearization"), pdfManager.ensureCatalog("numPages")]);
  4063. if (this.xfaFactory) {
  4064. return;
  4065. } else if (this.linearization) {
  4066. numPages = this.linearization.numPages;
  4067. } else {
  4068. numPages = catalog.numPages;
  4069. }
  4070. if (!Number.isInteger(numPages)) {
  4071. throw new _util.FormatError("Page count is not an integer.");
  4072. } else if (numPages <= 1) {
  4073. return;
  4074. }
  4075. await this.getPage(numPages - 1);
  4076. } catch (reason) {
  4077. this._pagePromises.delete(numPages - 1);
  4078. await this.cleanup();
  4079. if (reason instanceof _core_utils.XRefEntryException && !recoveryMode) {
  4080. throw new _core_utils.XRefParseException();
  4081. }
  4082. (0, _util.warn)(`checkLastPage - invalid /Pages tree /Count: ${numPages}.`);
  4083. let pagesTree;
  4084. try {
  4085. pagesTree = await catalog.getAllPageDicts(recoveryMode);
  4086. } catch (reasonAll) {
  4087. if (reasonAll instanceof _core_utils.XRefEntryException && !recoveryMode) {
  4088. throw new _core_utils.XRefParseException();
  4089. }
  4090. catalog.setActualNumPages(1);
  4091. return;
  4092. }
  4093. for (const [pageIndex, [pageDict, ref]] of pagesTree) {
  4094. let promise;
  4095. if (pageDict instanceof Error) {
  4096. promise = Promise.reject(pageDict);
  4097. promise.catch(() => {});
  4098. } else {
  4099. promise = Promise.resolve(new Page({
  4100. pdfManager,
  4101. xref: this.xref,
  4102. pageIndex,
  4103. pageDict,
  4104. ref,
  4105. globalIdFactory: this._globalIdFactory,
  4106. fontCache: catalog.fontCache,
  4107. builtInCMapCache: catalog.builtInCMapCache,
  4108. standardFontDataCache: catalog.standardFontDataCache,
  4109. globalImageCache: catalog.globalImageCache,
  4110. nonBlendModesSet: catalog.nonBlendModesSet,
  4111. xfaFactory: null
  4112. }));
  4113. }
  4114. this._pagePromises.set(pageIndex, promise);
  4115. }
  4116. catalog.setActualNumPages(pagesTree.size);
  4117. }
  4118. }
  4119. fontFallback(id, handler) {
  4120. return this.catalog.fontFallback(id, handler);
  4121. }
  4122. async cleanup(manuallyTriggered = false) {
  4123. return this.catalog ? this.catalog.cleanup(manuallyTriggered) : (0, _cleanup_helper.clearGlobalCaches)();
  4124. }
  4125. _collectFieldObjects(name, fieldRef, promises) {
  4126. const field = this.xref.fetchIfRef(fieldRef);
  4127. if (field.has("T")) {
  4128. const partName = (0, _util.stringToPDFString)(field.get("T"));
  4129. if (name === "") {
  4130. name = partName;
  4131. } else {
  4132. name = `${name}.${partName}`;
  4133. }
  4134. }
  4135. if (!promises.has(name)) {
  4136. promises.set(name, []);
  4137. }
  4138. promises.get(name).push(_annotation.AnnotationFactory.create(this.xref, fieldRef, this.pdfManager, this._localIdFactory, true).then(annotation => annotation && annotation.getFieldObject()).catch(function (reason) {
  4139. (0, _util.warn)(`_collectFieldObjects: "${reason}".`);
  4140. return null;
  4141. }));
  4142. if (field.has("Kids")) {
  4143. const kids = field.get("Kids");
  4144. for (const kid of kids) {
  4145. this._collectFieldObjects(name, kid, promises);
  4146. }
  4147. }
  4148. }
  4149. get fieldObjects() {
  4150. if (!this.formInfo.hasFields) {
  4151. return (0, _util.shadow)(this, "fieldObjects", Promise.resolve(null));
  4152. }
  4153. const allFields = Object.create(null);
  4154. const fieldPromises = new Map();
  4155. for (const fieldRef of this.catalog.acroForm.get("Fields")) {
  4156. this._collectFieldObjects("", fieldRef, fieldPromises);
  4157. }
  4158. const allPromises = [];
  4159. for (const [name, promises] of fieldPromises) {
  4160. allPromises.push(Promise.all(promises).then(fields => {
  4161. fields = fields.filter(field => !!field);
  4162. if (fields.length > 0) {
  4163. allFields[name] = fields;
  4164. }
  4165. }));
  4166. }
  4167. return (0, _util.shadow)(this, "fieldObjects", Promise.all(allPromises).then(() => allFields));
  4168. }
  4169. get hasJSActions() {
  4170. const promise = this.pdfManager.ensureDoc("_parseHasJSActions");
  4171. return (0, _util.shadow)(this, "hasJSActions", promise);
  4172. }
  4173. async _parseHasJSActions() {
  4174. const [catalogJsActions, fieldObjects] = await Promise.all([this.pdfManager.ensureCatalog("jsActions"), this.pdfManager.ensureDoc("fieldObjects")]);
  4175. if (catalogJsActions) {
  4176. return true;
  4177. }
  4178. if (fieldObjects) {
  4179. return Object.values(fieldObjects).some(fieldObject => fieldObject.some(object => object.actions !== null));
  4180. }
  4181. return false;
  4182. }
  4183. get calculationOrderIds() {
  4184. const acroForm = this.catalog.acroForm;
  4185. if (!acroForm || !acroForm.has("CO")) {
  4186. return (0, _util.shadow)(this, "calculationOrderIds", null);
  4187. }
  4188. const calculationOrder = acroForm.get("CO");
  4189. if (!Array.isArray(calculationOrder) || calculationOrder.length === 0) {
  4190. return (0, _util.shadow)(this, "calculationOrderIds", null);
  4191. }
  4192. const ids = [];
  4193. for (const id of calculationOrder) {
  4194. if (id instanceof _primitives.Ref) {
  4195. ids.push(id.toString());
  4196. }
  4197. }
  4198. if (ids.length === 0) {
  4199. return (0, _util.shadow)(this, "calculationOrderIds", null);
  4200. }
  4201. return (0, _util.shadow)(this, "calculationOrderIds", ids);
  4202. }
  4203. }
  4204. exports.PDFDocument = PDFDocument;
  4205. /***/ }),
  4206. /* 12 */
  4207. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  4208. Object.defineProperty(exports, "__esModule", ({
  4209. value: true
  4210. }));
  4211. exports.getXfaFontDict = getXfaFontDict;
  4212. exports.getXfaFontName = getXfaFontName;
  4213. var _calibri_factors = __w_pdfjs_require__(13);
  4214. var _primitives = __w_pdfjs_require__(5);
  4215. var _helvetica_factors = __w_pdfjs_require__(14);
  4216. var _liberationsans_widths = __w_pdfjs_require__(15);
  4217. var _myriadpro_factors = __w_pdfjs_require__(16);
  4218. var _segoeui_factors = __w_pdfjs_require__(17);
  4219. var _core_utils = __w_pdfjs_require__(6);
  4220. var _fonts_utils = __w_pdfjs_require__(18);
  4221. const getXFAFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  4222. t["MyriadPro-Regular"] = t["PdfJS-Fallback-Regular"] = {
  4223. name: "LiberationSans-Regular",
  4224. factors: _myriadpro_factors.MyriadProRegularFactors,
  4225. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  4226. baseMapping: _liberationsans_widths.LiberationSansRegularMapping,
  4227. metrics: _myriadpro_factors.MyriadProRegularMetrics
  4228. };
  4229. t["MyriadPro-Bold"] = t["PdfJS-Fallback-Bold"] = {
  4230. name: "LiberationSans-Bold",
  4231. factors: _myriadpro_factors.MyriadProBoldFactors,
  4232. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  4233. baseMapping: _liberationsans_widths.LiberationSansBoldMapping,
  4234. metrics: _myriadpro_factors.MyriadProBoldMetrics
  4235. };
  4236. t["MyriadPro-It"] = t["MyriadPro-Italic"] = t["PdfJS-Fallback-Italic"] = {
  4237. name: "LiberationSans-Italic",
  4238. factors: _myriadpro_factors.MyriadProItalicFactors,
  4239. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  4240. baseMapping: _liberationsans_widths.LiberationSansItalicMapping,
  4241. metrics: _myriadpro_factors.MyriadProItalicMetrics
  4242. };
  4243. t["MyriadPro-BoldIt"] = t["MyriadPro-BoldItalic"] = t["PdfJS-Fallback-BoldItalic"] = {
  4244. name: "LiberationSans-BoldItalic",
  4245. factors: _myriadpro_factors.MyriadProBoldItalicFactors,
  4246. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  4247. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping,
  4248. metrics: _myriadpro_factors.MyriadProBoldItalicMetrics
  4249. };
  4250. t.ArialMT = t.Arial = t["Arial-Regular"] = {
  4251. name: "LiberationSans-Regular",
  4252. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  4253. baseMapping: _liberationsans_widths.LiberationSansRegularMapping
  4254. };
  4255. t["Arial-BoldMT"] = t["Arial-Bold"] = {
  4256. name: "LiberationSans-Bold",
  4257. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  4258. baseMapping: _liberationsans_widths.LiberationSansBoldMapping
  4259. };
  4260. t["Arial-ItalicMT"] = t["Arial-Italic"] = {
  4261. name: "LiberationSans-Italic",
  4262. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  4263. baseMapping: _liberationsans_widths.LiberationSansItalicMapping
  4264. };
  4265. t["Arial-BoldItalicMT"] = t["Arial-BoldItalic"] = {
  4266. name: "LiberationSans-BoldItalic",
  4267. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  4268. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping
  4269. };
  4270. t["Calibri-Regular"] = {
  4271. name: "LiberationSans-Regular",
  4272. factors: _calibri_factors.CalibriRegularFactors,
  4273. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  4274. baseMapping: _liberationsans_widths.LiberationSansRegularMapping,
  4275. metrics: _calibri_factors.CalibriRegularMetrics
  4276. };
  4277. t["Calibri-Bold"] = {
  4278. name: "LiberationSans-Bold",
  4279. factors: _calibri_factors.CalibriBoldFactors,
  4280. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  4281. baseMapping: _liberationsans_widths.LiberationSansBoldMapping,
  4282. metrics: _calibri_factors.CalibriBoldMetrics
  4283. };
  4284. t["Calibri-Italic"] = {
  4285. name: "LiberationSans-Italic",
  4286. factors: _calibri_factors.CalibriItalicFactors,
  4287. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  4288. baseMapping: _liberationsans_widths.LiberationSansItalicMapping,
  4289. metrics: _calibri_factors.CalibriItalicMetrics
  4290. };
  4291. t["Calibri-BoldItalic"] = {
  4292. name: "LiberationSans-BoldItalic",
  4293. factors: _calibri_factors.CalibriBoldItalicFactors,
  4294. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  4295. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping,
  4296. metrics: _calibri_factors.CalibriBoldItalicMetrics
  4297. };
  4298. t["Segoeui-Regular"] = {
  4299. name: "LiberationSans-Regular",
  4300. factors: _segoeui_factors.SegoeuiRegularFactors,
  4301. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  4302. baseMapping: _liberationsans_widths.LiberationSansRegularMapping,
  4303. metrics: _segoeui_factors.SegoeuiRegularMetrics
  4304. };
  4305. t["Segoeui-Bold"] = {
  4306. name: "LiberationSans-Bold",
  4307. factors: _segoeui_factors.SegoeuiBoldFactors,
  4308. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  4309. baseMapping: _liberationsans_widths.LiberationSansBoldMapping,
  4310. metrics: _segoeui_factors.SegoeuiBoldMetrics
  4311. };
  4312. t["Segoeui-Italic"] = {
  4313. name: "LiberationSans-Italic",
  4314. factors: _segoeui_factors.SegoeuiItalicFactors,
  4315. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  4316. baseMapping: _liberationsans_widths.LiberationSansItalicMapping,
  4317. metrics: _segoeui_factors.SegoeuiItalicMetrics
  4318. };
  4319. t["Segoeui-BoldItalic"] = {
  4320. name: "LiberationSans-BoldItalic",
  4321. factors: _segoeui_factors.SegoeuiBoldItalicFactors,
  4322. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  4323. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping,
  4324. metrics: _segoeui_factors.SegoeuiBoldItalicMetrics
  4325. };
  4326. t["Helvetica-Regular"] = t.Helvetica = {
  4327. name: "LiberationSans-Regular",
  4328. factors: _helvetica_factors.HelveticaRegularFactors,
  4329. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  4330. baseMapping: _liberationsans_widths.LiberationSansRegularMapping,
  4331. metrics: _helvetica_factors.HelveticaRegularMetrics
  4332. };
  4333. t["Helvetica-Bold"] = {
  4334. name: "LiberationSans-Bold",
  4335. factors: _helvetica_factors.HelveticaBoldFactors,
  4336. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  4337. baseMapping: _liberationsans_widths.LiberationSansBoldMapping,
  4338. metrics: _helvetica_factors.HelveticaBoldMetrics
  4339. };
  4340. t["Helvetica-Italic"] = {
  4341. name: "LiberationSans-Italic",
  4342. factors: _helvetica_factors.HelveticaItalicFactors,
  4343. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  4344. baseMapping: _liberationsans_widths.LiberationSansItalicMapping,
  4345. metrics: _helvetica_factors.HelveticaItalicMetrics
  4346. };
  4347. t["Helvetica-BoldItalic"] = {
  4348. name: "LiberationSans-BoldItalic",
  4349. factors: _helvetica_factors.HelveticaBoldItalicFactors,
  4350. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  4351. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping,
  4352. metrics: _helvetica_factors.HelveticaBoldItalicMetrics
  4353. };
  4354. });
  4355. function getXfaFontName(name) {
  4356. const fontName = (0, _fonts_utils.normalizeFontName)(name);
  4357. const fontMap = getXFAFontMap();
  4358. return fontMap[fontName];
  4359. }
  4360. function getXfaFontWidths(name) {
  4361. const info = getXfaFontName(name);
  4362. if (!info) {
  4363. return null;
  4364. }
  4365. const {
  4366. baseWidths,
  4367. baseMapping,
  4368. factors
  4369. } = info;
  4370. let rescaledBaseWidths;
  4371. if (!factors) {
  4372. rescaledBaseWidths = baseWidths;
  4373. } else {
  4374. rescaledBaseWidths = baseWidths.map((w, i) => w * factors[i]);
  4375. }
  4376. let currentCode = -2;
  4377. let currentArray;
  4378. const newWidths = [];
  4379. for (const [unicode, glyphIndex] of baseMapping.map((charUnicode, index) => [charUnicode, index]).sort(([unicode1], [unicode2]) => unicode1 - unicode2)) {
  4380. if (unicode === -1) {
  4381. continue;
  4382. }
  4383. if (unicode === currentCode + 1) {
  4384. currentArray.push(rescaledBaseWidths[glyphIndex]);
  4385. currentCode += 1;
  4386. } else {
  4387. currentCode = unicode;
  4388. currentArray = [rescaledBaseWidths[glyphIndex]];
  4389. newWidths.push(unicode, currentArray);
  4390. }
  4391. }
  4392. return newWidths;
  4393. }
  4394. function getXfaFontDict(name) {
  4395. const widths = getXfaFontWidths(name);
  4396. const dict = new _primitives.Dict(null);
  4397. dict.set("BaseFont", _primitives.Name.get(name));
  4398. dict.set("Type", _primitives.Name.get("Font"));
  4399. dict.set("Subtype", _primitives.Name.get("CIDFontType2"));
  4400. dict.set("Encoding", _primitives.Name.get("Identity-H"));
  4401. dict.set("CIDToGIDMap", _primitives.Name.get("Identity"));
  4402. dict.set("W", widths);
  4403. dict.set("FirstChar", widths[0]);
  4404. dict.set("LastChar", widths.at(-2) + widths.at(-1).length - 1);
  4405. const descriptor = new _primitives.Dict(null);
  4406. dict.set("FontDescriptor", descriptor);
  4407. const systemInfo = new _primitives.Dict(null);
  4408. systemInfo.set("Ordering", "Identity");
  4409. systemInfo.set("Registry", "Adobe");
  4410. systemInfo.set("Supplement", 0);
  4411. dict.set("CIDSystemInfo", systemInfo);
  4412. return dict;
  4413. }
  4414. /***/ }),
  4415. /* 13 */
  4416. /***/ ((__unused_webpack_module, exports) => {
  4417. Object.defineProperty(exports, "__esModule", ({
  4418. value: true
  4419. }));
  4420. exports.CalibriRegularMetrics = exports.CalibriRegularFactors = exports.CalibriItalicMetrics = exports.CalibriItalicFactors = exports.CalibriBoldMetrics = exports.CalibriBoldItalicMetrics = exports.CalibriBoldItalicFactors = exports.CalibriBoldFactors = void 0;
  4421. 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];
  4422. exports.CalibriBoldFactors = CalibriBoldFactors;
  4423. const CalibriBoldMetrics = {
  4424. lineHeight: 1.2207,
  4425. lineGap: 0.2207
  4426. };
  4427. exports.CalibriBoldMetrics = CalibriBoldMetrics;
  4428. 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];
  4429. exports.CalibriBoldItalicFactors = CalibriBoldItalicFactors;
  4430. const CalibriBoldItalicMetrics = {
  4431. lineHeight: 1.2207,
  4432. lineGap: 0.2207
  4433. };
  4434. exports.CalibriBoldItalicMetrics = CalibriBoldItalicMetrics;
  4435. 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];
  4436. exports.CalibriItalicFactors = CalibriItalicFactors;
  4437. const CalibriItalicMetrics = {
  4438. lineHeight: 1.2207,
  4439. lineGap: 0.2207
  4440. };
  4441. exports.CalibriItalicMetrics = CalibriItalicMetrics;
  4442. 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];
  4443. exports.CalibriRegularFactors = CalibriRegularFactors;
  4444. const CalibriRegularMetrics = {
  4445. lineHeight: 1.2207,
  4446. lineGap: 0.2207
  4447. };
  4448. exports.CalibriRegularMetrics = CalibriRegularMetrics;
  4449. /***/ }),
  4450. /* 14 */
  4451. /***/ ((__unused_webpack_module, exports) => {
  4452. Object.defineProperty(exports, "__esModule", ({
  4453. value: true
  4454. }));
  4455. exports.HelveticaRegularMetrics = exports.HelveticaRegularFactors = exports.HelveticaItalicMetrics = exports.HelveticaItalicFactors = exports.HelveticaBoldMetrics = exports.HelveticaBoldItalicMetrics = exports.HelveticaBoldItalicFactors = exports.HelveticaBoldFactors = void 0;
  4456. 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];
  4457. exports.HelveticaBoldFactors = HelveticaBoldFactors;
  4458. const HelveticaBoldMetrics = {
  4459. lineHeight: 1.2,
  4460. lineGap: 0.2
  4461. };
  4462. exports.HelveticaBoldMetrics = HelveticaBoldMetrics;
  4463. 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];
  4464. exports.HelveticaBoldItalicFactors = HelveticaBoldItalicFactors;
  4465. const HelveticaBoldItalicMetrics = {
  4466. lineHeight: 1.35,
  4467. lineGap: 0.2
  4468. };
  4469. exports.HelveticaBoldItalicMetrics = HelveticaBoldItalicMetrics;
  4470. 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];
  4471. exports.HelveticaItalicFactors = HelveticaItalicFactors;
  4472. const HelveticaItalicMetrics = {
  4473. lineHeight: 1.35,
  4474. lineGap: 0.2
  4475. };
  4476. exports.HelveticaItalicMetrics = HelveticaItalicMetrics;
  4477. 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];
  4478. exports.HelveticaRegularFactors = HelveticaRegularFactors;
  4479. const HelveticaRegularMetrics = {
  4480. lineHeight: 1.2,
  4481. lineGap: 0.2
  4482. };
  4483. exports.HelveticaRegularMetrics = HelveticaRegularMetrics;
  4484. /***/ }),
  4485. /* 15 */
  4486. /***/ ((__unused_webpack_module, exports) => {
  4487. Object.defineProperty(exports, "__esModule", ({
  4488. value: true
  4489. }));
  4490. exports.LiberationSansRegularWidths = exports.LiberationSansRegularMapping = exports.LiberationSansItalicWidths = exports.LiberationSansItalicMapping = exports.LiberationSansBoldWidths = exports.LiberationSansBoldMapping = exports.LiberationSansBoldItalicWidths = exports.LiberationSansBoldItalicMapping = void 0;
  4491. 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];
  4492. exports.LiberationSansBoldWidths = LiberationSansBoldWidths;
  4493. 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];
  4494. exports.LiberationSansBoldMapping = LiberationSansBoldMapping;
  4495. 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];
  4496. exports.LiberationSansBoldItalicWidths = LiberationSansBoldItalicWidths;
  4497. 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];
  4498. exports.LiberationSansBoldItalicMapping = LiberationSansBoldItalicMapping;
  4499. 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];
  4500. exports.LiberationSansItalicWidths = LiberationSansItalicWidths;
  4501. 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];
  4502. exports.LiberationSansItalicMapping = LiberationSansItalicMapping;
  4503. 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];
  4504. exports.LiberationSansRegularWidths = LiberationSansRegularWidths;
  4505. 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];
  4506. exports.LiberationSansRegularMapping = LiberationSansRegularMapping;
  4507. /***/ }),
  4508. /* 16 */
  4509. /***/ ((__unused_webpack_module, exports) => {
  4510. Object.defineProperty(exports, "__esModule", ({
  4511. value: true
  4512. }));
  4513. exports.MyriadProRegularMetrics = exports.MyriadProRegularFactors = exports.MyriadProItalicMetrics = exports.MyriadProItalicFactors = exports.MyriadProBoldMetrics = exports.MyriadProBoldItalicMetrics = exports.MyriadProBoldItalicFactors = exports.MyriadProBoldFactors = void 0;
  4514. 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];
  4515. exports.MyriadProBoldFactors = MyriadProBoldFactors;
  4516. const MyriadProBoldMetrics = {
  4517. lineHeight: 1.2,
  4518. lineGap: 0.2
  4519. };
  4520. exports.MyriadProBoldMetrics = MyriadProBoldMetrics;
  4521. 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];
  4522. exports.MyriadProBoldItalicFactors = MyriadProBoldItalicFactors;
  4523. const MyriadProBoldItalicMetrics = {
  4524. lineHeight: 1.2,
  4525. lineGap: 0.2
  4526. };
  4527. exports.MyriadProBoldItalicMetrics = MyriadProBoldItalicMetrics;
  4528. 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];
  4529. exports.MyriadProItalicFactors = MyriadProItalicFactors;
  4530. const MyriadProItalicMetrics = {
  4531. lineHeight: 1.2,
  4532. lineGap: 0.2
  4533. };
  4534. exports.MyriadProItalicMetrics = MyriadProItalicMetrics;
  4535. 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];
  4536. exports.MyriadProRegularFactors = MyriadProRegularFactors;
  4537. const MyriadProRegularMetrics = {
  4538. lineHeight: 1.2,
  4539. lineGap: 0.2
  4540. };
  4541. exports.MyriadProRegularMetrics = MyriadProRegularMetrics;
  4542. /***/ }),
  4543. /* 17 */
  4544. /***/ ((__unused_webpack_module, exports) => {
  4545. Object.defineProperty(exports, "__esModule", ({
  4546. value: true
  4547. }));
  4548. exports.SegoeuiRegularMetrics = exports.SegoeuiRegularFactors = exports.SegoeuiItalicMetrics = exports.SegoeuiItalicFactors = exports.SegoeuiBoldMetrics = exports.SegoeuiBoldItalicMetrics = exports.SegoeuiBoldItalicFactors = exports.SegoeuiBoldFactors = void 0;
  4549. 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];
  4550. exports.SegoeuiBoldFactors = SegoeuiBoldFactors;
  4551. const SegoeuiBoldMetrics = {
  4552. lineHeight: 1.33008,
  4553. lineGap: 0
  4554. };
  4555. exports.SegoeuiBoldMetrics = SegoeuiBoldMetrics;
  4556. 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];
  4557. exports.SegoeuiBoldItalicFactors = SegoeuiBoldItalicFactors;
  4558. const SegoeuiBoldItalicMetrics = {
  4559. lineHeight: 1.33008,
  4560. lineGap: 0
  4561. };
  4562. exports.SegoeuiBoldItalicMetrics = SegoeuiBoldItalicMetrics;
  4563. 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];
  4564. exports.SegoeuiItalicFactors = SegoeuiItalicFactors;
  4565. const SegoeuiItalicMetrics = {
  4566. lineHeight: 1.33008,
  4567. lineGap: 0
  4568. };
  4569. exports.SegoeuiItalicMetrics = SegoeuiItalicMetrics;
  4570. 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];
  4571. exports.SegoeuiRegularFactors = SegoeuiRegularFactors;
  4572. const SegoeuiRegularMetrics = {
  4573. lineHeight: 1.33008,
  4574. lineGap: 0
  4575. };
  4576. exports.SegoeuiRegularMetrics = SegoeuiRegularMetrics;
  4577. /***/ }),
  4578. /* 18 */
  4579. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  4580. Object.defineProperty(exports, "__esModule", ({
  4581. value: true
  4582. }));
  4583. exports.SEAC_ANALYSIS_ENABLED = exports.MacStandardGlyphOrdering = exports.FontFlags = void 0;
  4584. exports.getFontType = getFontType;
  4585. exports.normalizeFontName = normalizeFontName;
  4586. exports.recoverGlyphName = recoverGlyphName;
  4587. exports.type1FontGlyphMapping = type1FontGlyphMapping;
  4588. var _util = __w_pdfjs_require__(2);
  4589. var _encodings = __w_pdfjs_require__(19);
  4590. var _glyphlist = __w_pdfjs_require__(20);
  4591. var _unicode = __w_pdfjs_require__(21);
  4592. const SEAC_ANALYSIS_ENABLED = true;
  4593. exports.SEAC_ANALYSIS_ENABLED = SEAC_ANALYSIS_ENABLED;
  4594. const FontFlags = {
  4595. FixedPitch: 1,
  4596. Serif: 2,
  4597. Symbolic: 4,
  4598. Script: 8,
  4599. Nonsymbolic: 32,
  4600. Italic: 64,
  4601. AllCap: 65536,
  4602. SmallCap: 131072,
  4603. ForceBold: 262144
  4604. };
  4605. exports.FontFlags = FontFlags;
  4606. 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"];
  4607. exports.MacStandardGlyphOrdering = MacStandardGlyphOrdering;
  4608. function getFontType(type, subtype, isStandardFont = false) {
  4609. switch (type) {
  4610. case "Type1":
  4611. if (isStandardFont) {
  4612. return _util.FontType.TYPE1STANDARD;
  4613. }
  4614. return subtype === "Type1C" ? _util.FontType.TYPE1C : _util.FontType.TYPE1;
  4615. case "CIDFontType0":
  4616. return subtype === "CIDFontType0C" ? _util.FontType.CIDFONTTYPE0C : _util.FontType.CIDFONTTYPE0;
  4617. case "OpenType":
  4618. return _util.FontType.OPENTYPE;
  4619. case "TrueType":
  4620. return _util.FontType.TRUETYPE;
  4621. case "CIDFontType2":
  4622. return _util.FontType.CIDFONTTYPE2;
  4623. case "MMType1":
  4624. return _util.FontType.MMTYPE1;
  4625. case "Type0":
  4626. return _util.FontType.TYPE0;
  4627. default:
  4628. return _util.FontType.UNKNOWN;
  4629. }
  4630. }
  4631. function recoverGlyphName(name, glyphsUnicodeMap) {
  4632. if (glyphsUnicodeMap[name] !== undefined) {
  4633. return name;
  4634. }
  4635. const unicode = (0, _unicode.getUnicodeForGlyph)(name, glyphsUnicodeMap);
  4636. if (unicode !== -1) {
  4637. for (const key in glyphsUnicodeMap) {
  4638. if (glyphsUnicodeMap[key] === unicode) {
  4639. return key;
  4640. }
  4641. }
  4642. }
  4643. (0, _util.info)("Unable to recover a standard glyph name for: " + name);
  4644. return name;
  4645. }
  4646. function type1FontGlyphMapping(properties, builtInEncoding, glyphNames) {
  4647. const charCodeToGlyphId = Object.create(null);
  4648. let glyphId, charCode, baseEncoding;
  4649. const isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
  4650. if (properties.isInternalFont) {
  4651. baseEncoding = builtInEncoding;
  4652. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  4653. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  4654. if (glyphId >= 0) {
  4655. charCodeToGlyphId[charCode] = glyphId;
  4656. } else {
  4657. charCodeToGlyphId[charCode] = 0;
  4658. }
  4659. }
  4660. } else if (properties.baseEncodingName) {
  4661. baseEncoding = (0, _encodings.getEncoding)(properties.baseEncodingName);
  4662. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  4663. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  4664. if (glyphId >= 0) {
  4665. charCodeToGlyphId[charCode] = glyphId;
  4666. } else {
  4667. charCodeToGlyphId[charCode] = 0;
  4668. }
  4669. }
  4670. } else if (isSymbolicFont) {
  4671. for (charCode in builtInEncoding) {
  4672. charCodeToGlyphId[charCode] = builtInEncoding[charCode];
  4673. }
  4674. } else {
  4675. baseEncoding = _encodings.StandardEncoding;
  4676. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  4677. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  4678. if (glyphId >= 0) {
  4679. charCodeToGlyphId[charCode] = glyphId;
  4680. } else {
  4681. charCodeToGlyphId[charCode] = 0;
  4682. }
  4683. }
  4684. }
  4685. const differences = properties.differences;
  4686. let glyphsUnicodeMap;
  4687. if (differences) {
  4688. for (charCode in differences) {
  4689. const glyphName = differences[charCode];
  4690. glyphId = glyphNames.indexOf(glyphName);
  4691. if (glyphId === -1) {
  4692. if (!glyphsUnicodeMap) {
  4693. glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  4694. }
  4695. const standardGlyphName = recoverGlyphName(glyphName, glyphsUnicodeMap);
  4696. if (standardGlyphName !== glyphName) {
  4697. glyphId = glyphNames.indexOf(standardGlyphName);
  4698. }
  4699. }
  4700. if (glyphId >= 0) {
  4701. charCodeToGlyphId[charCode] = glyphId;
  4702. } else {
  4703. charCodeToGlyphId[charCode] = 0;
  4704. }
  4705. }
  4706. }
  4707. return charCodeToGlyphId;
  4708. }
  4709. function normalizeFontName(name) {
  4710. return name.replace(/[,_]/g, "-").replace(/\s/g, "");
  4711. }
  4712. /***/ }),
  4713. /* 19 */
  4714. /***/ ((__unused_webpack_module, exports) => {
  4715. Object.defineProperty(exports, "__esModule", ({
  4716. value: true
  4717. }));
  4718. exports.ZapfDingbatsEncoding = exports.WinAnsiEncoding = exports.SymbolSetEncoding = exports.StandardEncoding = exports.MacRomanEncoding = exports.ExpertEncoding = void 0;
  4719. exports.getEncoding = getEncoding;
  4720. 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"];
  4721. exports.ExpertEncoding = ExpertEncoding;
  4722. 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", "", "", "", ""];
  4723. 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"];
  4724. exports.MacRomanEncoding = MacRomanEncoding;
  4725. 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", "", "", "", ""];
  4726. exports.StandardEncoding = StandardEncoding;
  4727. 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"];
  4728. exports.WinAnsiEncoding = WinAnsiEncoding;
  4729. 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", ""];
  4730. exports.SymbolSetEncoding = SymbolSetEncoding;
  4731. 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", ""];
  4732. exports.ZapfDingbatsEncoding = ZapfDingbatsEncoding;
  4733. function getEncoding(encodingName) {
  4734. switch (encodingName) {
  4735. case "WinAnsiEncoding":
  4736. return WinAnsiEncoding;
  4737. case "StandardEncoding":
  4738. return StandardEncoding;
  4739. case "MacRomanEncoding":
  4740. return MacRomanEncoding;
  4741. case "SymbolSetEncoding":
  4742. return SymbolSetEncoding;
  4743. case "ZapfDingbatsEncoding":
  4744. return ZapfDingbatsEncoding;
  4745. case "ExpertEncoding":
  4746. return ExpertEncoding;
  4747. case "MacExpertEncoding":
  4748. return MacExpertEncoding;
  4749. default:
  4750. return null;
  4751. }
  4752. }
  4753. /***/ }),
  4754. /* 20 */
  4755. /***/ ((__unused_webpack_module, __webpack_exports__, __w_pdfjs_require__) => {
  4756. __w_pdfjs_require__.r(__webpack_exports__);
  4757. /* harmony export */ __w_pdfjs_require__.d(__webpack_exports__, {
  4758. /* harmony export */ "getDingbatsGlyphsUnicode": () => (/* binding */ getDingbatsGlyphsUnicode),
  4759. /* harmony export */ "getGlyphsUnicode": () => (/* binding */ getGlyphsUnicode)
  4760. /* harmony export */ });
  4761. /* harmony import */ var _core_utils_js__WEBPACK_IMPORTED_MODULE_0__ = __w_pdfjs_require__(6);
  4762. const getGlyphsUnicode = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getArrayLookupTableFactory)(function () {
  4763. return [
  4764. "A",
  4765. 0x0041,
  4766. "AE",
  4767. 0x00c6,
  4768. "AEacute",
  4769. 0x01fc,
  4770. "AEmacron",
  4771. 0x01e2,
  4772. "AEsmall",
  4773. 0xf7e6,
  4774. "Aacute",
  4775. 0x00c1,
  4776. "Aacutesmall",
  4777. 0xf7e1,
  4778. "Abreve",
  4779. 0x0102,
  4780. "Abreveacute",
  4781. 0x1eae,
  4782. "Abrevecyrillic",
  4783. 0x04d0,
  4784. "Abrevedotbelow",
  4785. 0x1eb6,
  4786. "Abrevegrave",
  4787. 0x1eb0,
  4788. "Abrevehookabove",
  4789. 0x1eb2,
  4790. "Abrevetilde",
  4791. 0x1eb4,
  4792. "Acaron",
  4793. 0x01cd,
  4794. "Acircle",
  4795. 0x24b6,
  4796. "Acircumflex",
  4797. 0x00c2,
  4798. "Acircumflexacute",
  4799. 0x1ea4,
  4800. "Acircumflexdotbelow",
  4801. 0x1eac,
  4802. "Acircumflexgrave",
  4803. 0x1ea6,
  4804. "Acircumflexhookabove",
  4805. 0x1ea8,
  4806. "Acircumflexsmall",
  4807. 0xf7e2,
  4808. "Acircumflextilde",
  4809. 0x1eaa,
  4810. "Acute",
  4811. 0xf6c9,
  4812. "Acutesmall",
  4813. 0xf7b4,
  4814. "Acyrillic",
  4815. 0x0410,
  4816. "Adblgrave",
  4817. 0x0200,
  4818. "Adieresis",
  4819. 0x00c4,
  4820. "Adieresiscyrillic",
  4821. 0x04d2,
  4822. "Adieresismacron",
  4823. 0x01de,
  4824. "Adieresissmall",
  4825. 0xf7e4,
  4826. "Adotbelow",
  4827. 0x1ea0,
  4828. "Adotmacron",
  4829. 0x01e0,
  4830. "Agrave",
  4831. 0x00c0,
  4832. "Agravesmall",
  4833. 0xf7e0,
  4834. "Ahookabove",
  4835. 0x1ea2,
  4836. "Aiecyrillic",
  4837. 0x04d4,
  4838. "Ainvertedbreve",
  4839. 0x0202,
  4840. "Alpha",
  4841. 0x0391,
  4842. "Alphatonos",
  4843. 0x0386,
  4844. "Amacron",
  4845. 0x0100,
  4846. "Amonospace",
  4847. 0xff21,
  4848. "Aogonek",
  4849. 0x0104,
  4850. "Aring",
  4851. 0x00c5,
  4852. "Aringacute",
  4853. 0x01fa,
  4854. "Aringbelow",
  4855. 0x1e00,
  4856. "Aringsmall",
  4857. 0xf7e5,
  4858. "Asmall",
  4859. 0xf761,
  4860. "Atilde",
  4861. 0x00c3,
  4862. "Atildesmall",
  4863. 0xf7e3,
  4864. "Aybarmenian",
  4865. 0x0531,
  4866. "B",
  4867. 0x0042,
  4868. "Bcircle",
  4869. 0x24b7,
  4870. "Bdotaccent",
  4871. 0x1e02,
  4872. "Bdotbelow",
  4873. 0x1e04,
  4874. "Becyrillic",
  4875. 0x0411,
  4876. "Benarmenian",
  4877. 0x0532,
  4878. "Beta",
  4879. 0x0392,
  4880. "Bhook",
  4881. 0x0181,
  4882. "Blinebelow",
  4883. 0x1e06,
  4884. "Bmonospace",
  4885. 0xff22,
  4886. "Brevesmall",
  4887. 0xf6f4,
  4888. "Bsmall",
  4889. 0xf762,
  4890. "Btopbar",
  4891. 0x0182,
  4892. "C",
  4893. 0x0043,
  4894. "Caarmenian",
  4895. 0x053e,
  4896. "Cacute",
  4897. 0x0106,
  4898. "Caron",
  4899. 0xf6ca,
  4900. "Caronsmall",
  4901. 0xf6f5,
  4902. "Ccaron",
  4903. 0x010c,
  4904. "Ccedilla",
  4905. 0x00c7,
  4906. "Ccedillaacute",
  4907. 0x1e08,
  4908. "Ccedillasmall",
  4909. 0xf7e7,
  4910. "Ccircle",
  4911. 0x24b8,
  4912. "Ccircumflex",
  4913. 0x0108,
  4914. "Cdot",
  4915. 0x010a,
  4916. "Cdotaccent",
  4917. 0x010a,
  4918. "Cedillasmall",
  4919. 0xf7b8,
  4920. "Chaarmenian",
  4921. 0x0549,
  4922. "Cheabkhasiancyrillic",
  4923. 0x04bc,
  4924. "Checyrillic",
  4925. 0x0427,
  4926. "Chedescenderabkhasiancyrillic",
  4927. 0x04be,
  4928. "Chedescendercyrillic",
  4929. 0x04b6,
  4930. "Chedieresiscyrillic",
  4931. 0x04f4,
  4932. "Cheharmenian",
  4933. 0x0543,
  4934. "Chekhakassiancyrillic",
  4935. 0x04cb,
  4936. "Cheverticalstrokecyrillic",
  4937. 0x04b8,
  4938. "Chi",
  4939. 0x03a7,
  4940. "Chook",
  4941. 0x0187,
  4942. "Circumflexsmall",
  4943. 0xf6f6,
  4944. "Cmonospace",
  4945. 0xff23,
  4946. "Coarmenian",
  4947. 0x0551,
  4948. "Csmall",
  4949. 0xf763,
  4950. "D",
  4951. 0x0044,
  4952. "DZ",
  4953. 0x01f1,
  4954. "DZcaron",
  4955. 0x01c4,
  4956. "Daarmenian",
  4957. 0x0534,
  4958. "Dafrican",
  4959. 0x0189,
  4960. "Dcaron",
  4961. 0x010e,
  4962. "Dcedilla",
  4963. 0x1e10,
  4964. "Dcircle",
  4965. 0x24b9,
  4966. "Dcircumflexbelow",
  4967. 0x1e12,
  4968. "Dcroat",
  4969. 0x0110,
  4970. "Ddotaccent",
  4971. 0x1e0a,
  4972. "Ddotbelow",
  4973. 0x1e0c,
  4974. "Decyrillic",
  4975. 0x0414,
  4976. "Deicoptic",
  4977. 0x03ee,
  4978. "Delta",
  4979. 0x2206,
  4980. "Deltagreek",
  4981. 0x0394,
  4982. "Dhook",
  4983. 0x018a,
  4984. "Dieresis",
  4985. 0xf6cb,
  4986. "DieresisAcute",
  4987. 0xf6cc,
  4988. "DieresisGrave",
  4989. 0xf6cd,
  4990. "Dieresissmall",
  4991. 0xf7a8,
  4992. "Digammagreek",
  4993. 0x03dc,
  4994. "Djecyrillic",
  4995. 0x0402,
  4996. "Dlinebelow",
  4997. 0x1e0e,
  4998. "Dmonospace",
  4999. 0xff24,
  5000. "Dotaccentsmall",
  5001. 0xf6f7,
  5002. "Dslash",
  5003. 0x0110,
  5004. "Dsmall",
  5005. 0xf764,
  5006. "Dtopbar",
  5007. 0x018b,
  5008. "Dz",
  5009. 0x01f2,
  5010. "Dzcaron",
  5011. 0x01c5,
  5012. "Dzeabkhasiancyrillic",
  5013. 0x04e0,
  5014. "Dzecyrillic",
  5015. 0x0405,
  5016. "Dzhecyrillic",
  5017. 0x040f,
  5018. "E",
  5019. 0x0045,
  5020. "Eacute",
  5021. 0x00c9,
  5022. "Eacutesmall",
  5023. 0xf7e9,
  5024. "Ebreve",
  5025. 0x0114,
  5026. "Ecaron",
  5027. 0x011a,
  5028. "Ecedillabreve",
  5029. 0x1e1c,
  5030. "Echarmenian",
  5031. 0x0535,
  5032. "Ecircle",
  5033. 0x24ba,
  5034. "Ecircumflex",
  5035. 0x00ca,
  5036. "Ecircumflexacute",
  5037. 0x1ebe,
  5038. "Ecircumflexbelow",
  5039. 0x1e18,
  5040. "Ecircumflexdotbelow",
  5041. 0x1ec6,
  5042. "Ecircumflexgrave",
  5043. 0x1ec0,
  5044. "Ecircumflexhookabove",
  5045. 0x1ec2,
  5046. "Ecircumflexsmall",
  5047. 0xf7ea,
  5048. "Ecircumflextilde",
  5049. 0x1ec4,
  5050. "Ecyrillic",
  5051. 0x0404,
  5052. "Edblgrave",
  5053. 0x0204,
  5054. "Edieresis",
  5055. 0x00cb,
  5056. "Edieresissmall",
  5057. 0xf7eb,
  5058. "Edot",
  5059. 0x0116,
  5060. "Edotaccent",
  5061. 0x0116,
  5062. "Edotbelow",
  5063. 0x1eb8,
  5064. "Efcyrillic",
  5065. 0x0424,
  5066. "Egrave",
  5067. 0x00c8,
  5068. "Egravesmall",
  5069. 0xf7e8,
  5070. "Eharmenian",
  5071. 0x0537,
  5072. "Ehookabove",
  5073. 0x1eba,
  5074. "Eightroman",
  5075. 0x2167,
  5076. "Einvertedbreve",
  5077. 0x0206,
  5078. "Eiotifiedcyrillic",
  5079. 0x0464,
  5080. "Elcyrillic",
  5081. 0x041b,
  5082. "Elevenroman",
  5083. 0x216a,
  5084. "Emacron",
  5085. 0x0112,
  5086. "Emacronacute",
  5087. 0x1e16,
  5088. "Emacrongrave",
  5089. 0x1e14,
  5090. "Emcyrillic",
  5091. 0x041c,
  5092. "Emonospace",
  5093. 0xff25,
  5094. "Encyrillic",
  5095. 0x041d,
  5096. "Endescendercyrillic",
  5097. 0x04a2,
  5098. "Eng",
  5099. 0x014a,
  5100. "Enghecyrillic",
  5101. 0x04a4,
  5102. "Enhookcyrillic",
  5103. 0x04c7,
  5104. "Eogonek",
  5105. 0x0118,
  5106. "Eopen",
  5107. 0x0190,
  5108. "Epsilon",
  5109. 0x0395,
  5110. "Epsilontonos",
  5111. 0x0388,
  5112. "Ercyrillic",
  5113. 0x0420,
  5114. "Ereversed",
  5115. 0x018e,
  5116. "Ereversedcyrillic",
  5117. 0x042d,
  5118. "Escyrillic",
  5119. 0x0421,
  5120. "Esdescendercyrillic",
  5121. 0x04aa,
  5122. "Esh",
  5123. 0x01a9,
  5124. "Esmall",
  5125. 0xf765,
  5126. "Eta",
  5127. 0x0397,
  5128. "Etarmenian",
  5129. 0x0538,
  5130. "Etatonos",
  5131. 0x0389,
  5132. "Eth",
  5133. 0x00d0,
  5134. "Ethsmall",
  5135. 0xf7f0,
  5136. "Etilde",
  5137. 0x1ebc,
  5138. "Etildebelow",
  5139. 0x1e1a,
  5140. "Euro",
  5141. 0x20ac,
  5142. "Ezh",
  5143. 0x01b7,
  5144. "Ezhcaron",
  5145. 0x01ee,
  5146. "Ezhreversed",
  5147. 0x01b8,
  5148. "F",
  5149. 0x0046,
  5150. "Fcircle",
  5151. 0x24bb,
  5152. "Fdotaccent",
  5153. 0x1e1e,
  5154. "Feharmenian",
  5155. 0x0556,
  5156. "Feicoptic",
  5157. 0x03e4,
  5158. "Fhook",
  5159. 0x0191,
  5160. "Fitacyrillic",
  5161. 0x0472,
  5162. "Fiveroman",
  5163. 0x2164,
  5164. "Fmonospace",
  5165. 0xff26,
  5166. "Fourroman",
  5167. 0x2163,
  5168. "Fsmall",
  5169. 0xf766,
  5170. "G",
  5171. 0x0047,
  5172. "GBsquare",
  5173. 0x3387,
  5174. "Gacute",
  5175. 0x01f4,
  5176. "Gamma",
  5177. 0x0393,
  5178. "Gammaafrican",
  5179. 0x0194,
  5180. "Gangiacoptic",
  5181. 0x03ea,
  5182. "Gbreve",
  5183. 0x011e,
  5184. "Gcaron",
  5185. 0x01e6,
  5186. "Gcedilla",
  5187. 0x0122,
  5188. "Gcircle",
  5189. 0x24bc,
  5190. "Gcircumflex",
  5191. 0x011c,
  5192. "Gcommaaccent",
  5193. 0x0122,
  5194. "Gdot",
  5195. 0x0120,
  5196. "Gdotaccent",
  5197. 0x0120,
  5198. "Gecyrillic",
  5199. 0x0413,
  5200. "Ghadarmenian",
  5201. 0x0542,
  5202. "Ghemiddlehookcyrillic",
  5203. 0x0494,
  5204. "Ghestrokecyrillic",
  5205. 0x0492,
  5206. "Gheupturncyrillic",
  5207. 0x0490,
  5208. "Ghook",
  5209. 0x0193,
  5210. "Gimarmenian",
  5211. 0x0533,
  5212. "Gjecyrillic",
  5213. 0x0403,
  5214. "Gmacron",
  5215. 0x1e20,
  5216. "Gmonospace",
  5217. 0xff27,
  5218. "Grave",
  5219. 0xf6ce,
  5220. "Gravesmall",
  5221. 0xf760,
  5222. "Gsmall",
  5223. 0xf767,
  5224. "Gsmallhook",
  5225. 0x029b,
  5226. "Gstroke",
  5227. 0x01e4,
  5228. "H",
  5229. 0x0048,
  5230. "H18533",
  5231. 0x25cf,
  5232. "H18543",
  5233. 0x25aa,
  5234. "H18551",
  5235. 0x25ab,
  5236. "H22073",
  5237. 0x25a1,
  5238. "HPsquare",
  5239. 0x33cb,
  5240. "Haabkhasiancyrillic",
  5241. 0x04a8,
  5242. "Hadescendercyrillic",
  5243. 0x04b2,
  5244. "Hardsigncyrillic",
  5245. 0x042a,
  5246. "Hbar",
  5247. 0x0126,
  5248. "Hbrevebelow",
  5249. 0x1e2a,
  5250. "Hcedilla",
  5251. 0x1e28,
  5252. "Hcircle",
  5253. 0x24bd,
  5254. "Hcircumflex",
  5255. 0x0124,
  5256. "Hdieresis",
  5257. 0x1e26,
  5258. "Hdotaccent",
  5259. 0x1e22,
  5260. "Hdotbelow",
  5261. 0x1e24,
  5262. "Hmonospace",
  5263. 0xff28,
  5264. "Hoarmenian",
  5265. 0x0540,
  5266. "Horicoptic",
  5267. 0x03e8,
  5268. "Hsmall",
  5269. 0xf768,
  5270. "Hungarumlaut",
  5271. 0xf6cf,
  5272. "Hungarumlautsmall",
  5273. 0xf6f8,
  5274. "Hzsquare",
  5275. 0x3390,
  5276. "I",
  5277. 0x0049,
  5278. "IAcyrillic",
  5279. 0x042f,
  5280. "IJ",
  5281. 0x0132,
  5282. "IUcyrillic",
  5283. 0x042e,
  5284. "Iacute",
  5285. 0x00cd,
  5286. "Iacutesmall",
  5287. 0xf7ed,
  5288. "Ibreve",
  5289. 0x012c,
  5290. "Icaron",
  5291. 0x01cf,
  5292. "Icircle",
  5293. 0x24be,
  5294. "Icircumflex",
  5295. 0x00ce,
  5296. "Icircumflexsmall",
  5297. 0xf7ee,
  5298. "Icyrillic",
  5299. 0x0406,
  5300. "Idblgrave",
  5301. 0x0208,
  5302. "Idieresis",
  5303. 0x00cf,
  5304. "Idieresisacute",
  5305. 0x1e2e,
  5306. "Idieresiscyrillic",
  5307. 0x04e4,
  5308. "Idieresissmall",
  5309. 0xf7ef,
  5310. "Idot",
  5311. 0x0130,
  5312. "Idotaccent",
  5313. 0x0130,
  5314. "Idotbelow",
  5315. 0x1eca,
  5316. "Iebrevecyrillic",
  5317. 0x04d6,
  5318. "Iecyrillic",
  5319. 0x0415,
  5320. "Ifraktur",
  5321. 0x2111,
  5322. "Igrave",
  5323. 0x00cc,
  5324. "Igravesmall",
  5325. 0xf7ec,
  5326. "Ihookabove",
  5327. 0x1ec8,
  5328. "Iicyrillic",
  5329. 0x0418,
  5330. "Iinvertedbreve",
  5331. 0x020a,
  5332. "Iishortcyrillic",
  5333. 0x0419,
  5334. "Imacron",
  5335. 0x012a,
  5336. "Imacroncyrillic",
  5337. 0x04e2,
  5338. "Imonospace",
  5339. 0xff29,
  5340. "Iniarmenian",
  5341. 0x053b,
  5342. "Iocyrillic",
  5343. 0x0401,
  5344. "Iogonek",
  5345. 0x012e,
  5346. "Iota",
  5347. 0x0399,
  5348. "Iotaafrican",
  5349. 0x0196,
  5350. "Iotadieresis",
  5351. 0x03aa,
  5352. "Iotatonos",
  5353. 0x038a,
  5354. "Ismall",
  5355. 0xf769,
  5356. "Istroke",
  5357. 0x0197,
  5358. "Itilde",
  5359. 0x0128,
  5360. "Itildebelow",
  5361. 0x1e2c,
  5362. "Izhitsacyrillic",
  5363. 0x0474,
  5364. "Izhitsadblgravecyrillic",
  5365. 0x0476,
  5366. "J",
  5367. 0x004a,
  5368. "Jaarmenian",
  5369. 0x0541,
  5370. "Jcircle",
  5371. 0x24bf,
  5372. "Jcircumflex",
  5373. 0x0134,
  5374. "Jecyrillic",
  5375. 0x0408,
  5376. "Jheharmenian",
  5377. 0x054b,
  5378. "Jmonospace",
  5379. 0xff2a,
  5380. "Jsmall",
  5381. 0xf76a,
  5382. "K",
  5383. 0x004b,
  5384. "KBsquare",
  5385. 0x3385,
  5386. "KKsquare",
  5387. 0x33cd,
  5388. "Kabashkircyrillic",
  5389. 0x04a0,
  5390. "Kacute",
  5391. 0x1e30,
  5392. "Kacyrillic",
  5393. 0x041a,
  5394. "Kadescendercyrillic",
  5395. 0x049a,
  5396. "Kahookcyrillic",
  5397. 0x04c3,
  5398. "Kappa",
  5399. 0x039a,
  5400. "Kastrokecyrillic",
  5401. 0x049e,
  5402. "Kaverticalstrokecyrillic",
  5403. 0x049c,
  5404. "Kcaron",
  5405. 0x01e8,
  5406. "Kcedilla",
  5407. 0x0136,
  5408. "Kcircle",
  5409. 0x24c0,
  5410. "Kcommaaccent",
  5411. 0x0136,
  5412. "Kdotbelow",
  5413. 0x1e32,
  5414. "Keharmenian",
  5415. 0x0554,
  5416. "Kenarmenian",
  5417. 0x053f,
  5418. "Khacyrillic",
  5419. 0x0425,
  5420. "Kheicoptic",
  5421. 0x03e6,
  5422. "Khook",
  5423. 0x0198,
  5424. "Kjecyrillic",
  5425. 0x040c,
  5426. "Klinebelow",
  5427. 0x1e34,
  5428. "Kmonospace",
  5429. 0xff2b,
  5430. "Koppacyrillic",
  5431. 0x0480,
  5432. "Koppagreek",
  5433. 0x03de,
  5434. "Ksicyrillic",
  5435. 0x046e,
  5436. "Ksmall",
  5437. 0xf76b,
  5438. "L",
  5439. 0x004c,
  5440. "LJ",
  5441. 0x01c7,
  5442. "LL",
  5443. 0xf6bf,
  5444. "Lacute",
  5445. 0x0139,
  5446. "Lambda",
  5447. 0x039b,
  5448. "Lcaron",
  5449. 0x013d,
  5450. "Lcedilla",
  5451. 0x013b,
  5452. "Lcircle",
  5453. 0x24c1,
  5454. "Lcircumflexbelow",
  5455. 0x1e3c,
  5456. "Lcommaaccent",
  5457. 0x013b,
  5458. "Ldot",
  5459. 0x013f,
  5460. "Ldotaccent",
  5461. 0x013f,
  5462. "Ldotbelow",
  5463. 0x1e36,
  5464. "Ldotbelowmacron",
  5465. 0x1e38,
  5466. "Liwnarmenian",
  5467. 0x053c,
  5468. "Lj",
  5469. 0x01c8,
  5470. "Ljecyrillic",
  5471. 0x0409,
  5472. "Llinebelow",
  5473. 0x1e3a,
  5474. "Lmonospace",
  5475. 0xff2c,
  5476. "Lslash",
  5477. 0x0141,
  5478. "Lslashsmall",
  5479. 0xf6f9,
  5480. "Lsmall",
  5481. 0xf76c,
  5482. "M",
  5483. 0x004d,
  5484. "MBsquare",
  5485. 0x3386,
  5486. "Macron",
  5487. 0xf6d0,
  5488. "Macronsmall",
  5489. 0xf7af,
  5490. "Macute",
  5491. 0x1e3e,
  5492. "Mcircle",
  5493. 0x24c2,
  5494. "Mdotaccent",
  5495. 0x1e40,
  5496. "Mdotbelow",
  5497. 0x1e42,
  5498. "Menarmenian",
  5499. 0x0544,
  5500. "Mmonospace",
  5501. 0xff2d,
  5502. "Msmall",
  5503. 0xf76d,
  5504. "Mturned",
  5505. 0x019c,
  5506. "Mu",
  5507. 0x039c,
  5508. "N",
  5509. 0x004e,
  5510. "NJ",
  5511. 0x01ca,
  5512. "Nacute",
  5513. 0x0143,
  5514. "Ncaron",
  5515. 0x0147,
  5516. "Ncedilla",
  5517. 0x0145,
  5518. "Ncircle",
  5519. 0x24c3,
  5520. "Ncircumflexbelow",
  5521. 0x1e4a,
  5522. "Ncommaaccent",
  5523. 0x0145,
  5524. "Ndotaccent",
  5525. 0x1e44,
  5526. "Ndotbelow",
  5527. 0x1e46,
  5528. "Nhookleft",
  5529. 0x019d,
  5530. "Nineroman",
  5531. 0x2168,
  5532. "Nj",
  5533. 0x01cb,
  5534. "Njecyrillic",
  5535. 0x040a,
  5536. "Nlinebelow",
  5537. 0x1e48,
  5538. "Nmonospace",
  5539. 0xff2e,
  5540. "Nowarmenian",
  5541. 0x0546,
  5542. "Nsmall",
  5543. 0xf76e,
  5544. "Ntilde",
  5545. 0x00d1,
  5546. "Ntildesmall",
  5547. 0xf7f1,
  5548. "Nu",
  5549. 0x039d,
  5550. "O",
  5551. 0x004f,
  5552. "OE",
  5553. 0x0152,
  5554. "OEsmall",
  5555. 0xf6fa,
  5556. "Oacute",
  5557. 0x00d3,
  5558. "Oacutesmall",
  5559. 0xf7f3,
  5560. "Obarredcyrillic",
  5561. 0x04e8,
  5562. "Obarreddieresiscyrillic",
  5563. 0x04ea,
  5564. "Obreve",
  5565. 0x014e,
  5566. "Ocaron",
  5567. 0x01d1,
  5568. "Ocenteredtilde",
  5569. 0x019f,
  5570. "Ocircle",
  5571. 0x24c4,
  5572. "Ocircumflex",
  5573. 0x00d4,
  5574. "Ocircumflexacute",
  5575. 0x1ed0,
  5576. "Ocircumflexdotbelow",
  5577. 0x1ed8,
  5578. "Ocircumflexgrave",
  5579. 0x1ed2,
  5580. "Ocircumflexhookabove",
  5581. 0x1ed4,
  5582. "Ocircumflexsmall",
  5583. 0xf7f4,
  5584. "Ocircumflextilde",
  5585. 0x1ed6,
  5586. "Ocyrillic",
  5587. 0x041e,
  5588. "Odblacute",
  5589. 0x0150,
  5590. "Odblgrave",
  5591. 0x020c,
  5592. "Odieresis",
  5593. 0x00d6,
  5594. "Odieresiscyrillic",
  5595. 0x04e6,
  5596. "Odieresissmall",
  5597. 0xf7f6,
  5598. "Odotbelow",
  5599. 0x1ecc,
  5600. "Ogoneksmall",
  5601. 0xf6fb,
  5602. "Ograve",
  5603. 0x00d2,
  5604. "Ogravesmall",
  5605. 0xf7f2,
  5606. "Oharmenian",
  5607. 0x0555,
  5608. "Ohm",
  5609. 0x2126,
  5610. "Ohookabove",
  5611. 0x1ece,
  5612. "Ohorn",
  5613. 0x01a0,
  5614. "Ohornacute",
  5615. 0x1eda,
  5616. "Ohorndotbelow",
  5617. 0x1ee2,
  5618. "Ohorngrave",
  5619. 0x1edc,
  5620. "Ohornhookabove",
  5621. 0x1ede,
  5622. "Ohorntilde",
  5623. 0x1ee0,
  5624. "Ohungarumlaut",
  5625. 0x0150,
  5626. "Oi",
  5627. 0x01a2,
  5628. "Oinvertedbreve",
  5629. 0x020e,
  5630. "Omacron",
  5631. 0x014c,
  5632. "Omacronacute",
  5633. 0x1e52,
  5634. "Omacrongrave",
  5635. 0x1e50,
  5636. "Omega",
  5637. 0x2126,
  5638. "Omegacyrillic",
  5639. 0x0460,
  5640. "Omegagreek",
  5641. 0x03a9,
  5642. "Omegaroundcyrillic",
  5643. 0x047a,
  5644. "Omegatitlocyrillic",
  5645. 0x047c,
  5646. "Omegatonos",
  5647. 0x038f,
  5648. "Omicron",
  5649. 0x039f,
  5650. "Omicrontonos",
  5651. 0x038c,
  5652. "Omonospace",
  5653. 0xff2f,
  5654. "Oneroman",
  5655. 0x2160,
  5656. "Oogonek",
  5657. 0x01ea,
  5658. "Oogonekmacron",
  5659. 0x01ec,
  5660. "Oopen",
  5661. 0x0186,
  5662. "Oslash",
  5663. 0x00d8,
  5664. "Oslashacute",
  5665. 0x01fe,
  5666. "Oslashsmall",
  5667. 0xf7f8,
  5668. "Osmall",
  5669. 0xf76f,
  5670. "Ostrokeacute",
  5671. 0x01fe,
  5672. "Otcyrillic",
  5673. 0x047e,
  5674. "Otilde",
  5675. 0x00d5,
  5676. "Otildeacute",
  5677. 0x1e4c,
  5678. "Otildedieresis",
  5679. 0x1e4e,
  5680. "Otildesmall",
  5681. 0xf7f5,
  5682. "P",
  5683. 0x0050,
  5684. "Pacute",
  5685. 0x1e54,
  5686. "Pcircle",
  5687. 0x24c5,
  5688. "Pdotaccent",
  5689. 0x1e56,
  5690. "Pecyrillic",
  5691. 0x041f,
  5692. "Peharmenian",
  5693. 0x054a,
  5694. "Pemiddlehookcyrillic",
  5695. 0x04a6,
  5696. "Phi",
  5697. 0x03a6,
  5698. "Phook",
  5699. 0x01a4,
  5700. "Pi",
  5701. 0x03a0,
  5702. "Piwrarmenian",
  5703. 0x0553,
  5704. "Pmonospace",
  5705. 0xff30,
  5706. "Psi",
  5707. 0x03a8,
  5708. "Psicyrillic",
  5709. 0x0470,
  5710. "Psmall",
  5711. 0xf770,
  5712. "Q",
  5713. 0x0051,
  5714. "Qcircle",
  5715. 0x24c6,
  5716. "Qmonospace",
  5717. 0xff31,
  5718. "Qsmall",
  5719. 0xf771,
  5720. "R",
  5721. 0x0052,
  5722. "Raarmenian",
  5723. 0x054c,
  5724. "Racute",
  5725. 0x0154,
  5726. "Rcaron",
  5727. 0x0158,
  5728. "Rcedilla",
  5729. 0x0156,
  5730. "Rcircle",
  5731. 0x24c7,
  5732. "Rcommaaccent",
  5733. 0x0156,
  5734. "Rdblgrave",
  5735. 0x0210,
  5736. "Rdotaccent",
  5737. 0x1e58,
  5738. "Rdotbelow",
  5739. 0x1e5a,
  5740. "Rdotbelowmacron",
  5741. 0x1e5c,
  5742. "Reharmenian",
  5743. 0x0550,
  5744. "Rfraktur",
  5745. 0x211c,
  5746. "Rho",
  5747. 0x03a1,
  5748. "Ringsmall",
  5749. 0xf6fc,
  5750. "Rinvertedbreve",
  5751. 0x0212,
  5752. "Rlinebelow",
  5753. 0x1e5e,
  5754. "Rmonospace",
  5755. 0xff32,
  5756. "Rsmall",
  5757. 0xf772,
  5758. "Rsmallinverted",
  5759. 0x0281,
  5760. "Rsmallinvertedsuperior",
  5761. 0x02b6,
  5762. "S",
  5763. 0x0053,
  5764. "SF010000",
  5765. 0x250c,
  5766. "SF020000",
  5767. 0x2514,
  5768. "SF030000",
  5769. 0x2510,
  5770. "SF040000",
  5771. 0x2518,
  5772. "SF050000",
  5773. 0x253c,
  5774. "SF060000",
  5775. 0x252c,
  5776. "SF070000",
  5777. 0x2534,
  5778. "SF080000",
  5779. 0x251c,
  5780. "SF090000",
  5781. 0x2524,
  5782. "SF100000",
  5783. 0x2500,
  5784. "SF110000",
  5785. 0x2502,
  5786. "SF190000",
  5787. 0x2561,
  5788. "SF200000",
  5789. 0x2562,
  5790. "SF210000",
  5791. 0x2556,
  5792. "SF220000",
  5793. 0x2555,
  5794. "SF230000",
  5795. 0x2563,
  5796. "SF240000",
  5797. 0x2551,
  5798. "SF250000",
  5799. 0x2557,
  5800. "SF260000",
  5801. 0x255d,
  5802. "SF270000",
  5803. 0x255c,
  5804. "SF280000",
  5805. 0x255b,
  5806. "SF360000",
  5807. 0x255e,
  5808. "SF370000",
  5809. 0x255f,
  5810. "SF380000",
  5811. 0x255a,
  5812. "SF390000",
  5813. 0x2554,
  5814. "SF400000",
  5815. 0x2569,
  5816. "SF410000",
  5817. 0x2566,
  5818. "SF420000",
  5819. 0x2560,
  5820. "SF430000",
  5821. 0x2550,
  5822. "SF440000",
  5823. 0x256c,
  5824. "SF450000",
  5825. 0x2567,
  5826. "SF460000",
  5827. 0x2568,
  5828. "SF470000",
  5829. 0x2564,
  5830. "SF480000",
  5831. 0x2565,
  5832. "SF490000",
  5833. 0x2559,
  5834. "SF500000",
  5835. 0x2558,
  5836. "SF510000",
  5837. 0x2552,
  5838. "SF520000",
  5839. 0x2553,
  5840. "SF530000",
  5841. 0x256b,
  5842. "SF540000",
  5843. 0x256a,
  5844. "Sacute",
  5845. 0x015a,
  5846. "Sacutedotaccent",
  5847. 0x1e64,
  5848. "Sampigreek",
  5849. 0x03e0,
  5850. "Scaron",
  5851. 0x0160,
  5852. "Scarondotaccent",
  5853. 0x1e66,
  5854. "Scaronsmall",
  5855. 0xf6fd,
  5856. "Scedilla",
  5857. 0x015e,
  5858. "Schwa",
  5859. 0x018f,
  5860. "Schwacyrillic",
  5861. 0x04d8,
  5862. "Schwadieresiscyrillic",
  5863. 0x04da,
  5864. "Scircle",
  5865. 0x24c8,
  5866. "Scircumflex",
  5867. 0x015c,
  5868. "Scommaaccent",
  5869. 0x0218,
  5870. "Sdotaccent",
  5871. 0x1e60,
  5872. "Sdotbelow",
  5873. 0x1e62,
  5874. "Sdotbelowdotaccent",
  5875. 0x1e68,
  5876. "Seharmenian",
  5877. 0x054d,
  5878. "Sevenroman",
  5879. 0x2166,
  5880. "Shaarmenian",
  5881. 0x0547,
  5882. "Shacyrillic",
  5883. 0x0428,
  5884. "Shchacyrillic",
  5885. 0x0429,
  5886. "Sheicoptic",
  5887. 0x03e2,
  5888. "Shhacyrillic",
  5889. 0x04ba,
  5890. "Shimacoptic",
  5891. 0x03ec,
  5892. "Sigma",
  5893. 0x03a3,
  5894. "Sixroman",
  5895. 0x2165,
  5896. "Smonospace",
  5897. 0xff33,
  5898. "Softsigncyrillic",
  5899. 0x042c,
  5900. "Ssmall",
  5901. 0xf773,
  5902. "Stigmagreek",
  5903. 0x03da,
  5904. "T",
  5905. 0x0054,
  5906. "Tau",
  5907. 0x03a4,
  5908. "Tbar",
  5909. 0x0166,
  5910. "Tcaron",
  5911. 0x0164,
  5912. "Tcedilla",
  5913. 0x0162,
  5914. "Tcircle",
  5915. 0x24c9,
  5916. "Tcircumflexbelow",
  5917. 0x1e70,
  5918. "Tcommaaccent",
  5919. 0x0162,
  5920. "Tdotaccent",
  5921. 0x1e6a,
  5922. "Tdotbelow",
  5923. 0x1e6c,
  5924. "Tecyrillic",
  5925. 0x0422,
  5926. "Tedescendercyrillic",
  5927. 0x04ac,
  5928. "Tenroman",
  5929. 0x2169,
  5930. "Tetsecyrillic",
  5931. 0x04b4,
  5932. "Theta",
  5933. 0x0398,
  5934. "Thook",
  5935. 0x01ac,
  5936. "Thorn",
  5937. 0x00de,
  5938. "Thornsmall",
  5939. 0xf7fe,
  5940. "Threeroman",
  5941. 0x2162,
  5942. "Tildesmall",
  5943. 0xf6fe,
  5944. "Tiwnarmenian",
  5945. 0x054f,
  5946. "Tlinebelow",
  5947. 0x1e6e,
  5948. "Tmonospace",
  5949. 0xff34,
  5950. "Toarmenian",
  5951. 0x0539,
  5952. "Tonefive",
  5953. 0x01bc,
  5954. "Tonesix",
  5955. 0x0184,
  5956. "Tonetwo",
  5957. 0x01a7,
  5958. "Tretroflexhook",
  5959. 0x01ae,
  5960. "Tsecyrillic",
  5961. 0x0426,
  5962. "Tshecyrillic",
  5963. 0x040b,
  5964. "Tsmall",
  5965. 0xf774,
  5966. "Twelveroman",
  5967. 0x216b,
  5968. "Tworoman",
  5969. 0x2161,
  5970. "U",
  5971. 0x0055,
  5972. "Uacute",
  5973. 0x00da,
  5974. "Uacutesmall",
  5975. 0xf7fa,
  5976. "Ubreve",
  5977. 0x016c,
  5978. "Ucaron",
  5979. 0x01d3,
  5980. "Ucircle",
  5981. 0x24ca,
  5982. "Ucircumflex",
  5983. 0x00db,
  5984. "Ucircumflexbelow",
  5985. 0x1e76,
  5986. "Ucircumflexsmall",
  5987. 0xf7fb,
  5988. "Ucyrillic",
  5989. 0x0423,
  5990. "Udblacute",
  5991. 0x0170,
  5992. "Udblgrave",
  5993. 0x0214,
  5994. "Udieresis",
  5995. 0x00dc,
  5996. "Udieresisacute",
  5997. 0x01d7,
  5998. "Udieresisbelow",
  5999. 0x1e72,
  6000. "Udieresiscaron",
  6001. 0x01d9,
  6002. "Udieresiscyrillic",
  6003. 0x04f0,
  6004. "Udieresisgrave",
  6005. 0x01db,
  6006. "Udieresismacron",
  6007. 0x01d5,
  6008. "Udieresissmall",
  6009. 0xf7fc,
  6010. "Udotbelow",
  6011. 0x1ee4,
  6012. "Ugrave",
  6013. 0x00d9,
  6014. "Ugravesmall",
  6015. 0xf7f9,
  6016. "Uhookabove",
  6017. 0x1ee6,
  6018. "Uhorn",
  6019. 0x01af,
  6020. "Uhornacute",
  6021. 0x1ee8,
  6022. "Uhorndotbelow",
  6023. 0x1ef0,
  6024. "Uhorngrave",
  6025. 0x1eea,
  6026. "Uhornhookabove",
  6027. 0x1eec,
  6028. "Uhorntilde",
  6029. 0x1eee,
  6030. "Uhungarumlaut",
  6031. 0x0170,
  6032. "Uhungarumlautcyrillic",
  6033. 0x04f2,
  6034. "Uinvertedbreve",
  6035. 0x0216,
  6036. "Ukcyrillic",
  6037. 0x0478,
  6038. "Umacron",
  6039. 0x016a,
  6040. "Umacroncyrillic",
  6041. 0x04ee,
  6042. "Umacrondieresis",
  6043. 0x1e7a,
  6044. "Umonospace",
  6045. 0xff35,
  6046. "Uogonek",
  6047. 0x0172,
  6048. "Upsilon",
  6049. 0x03a5,
  6050. "Upsilon1",
  6051. 0x03d2,
  6052. "Upsilonacutehooksymbolgreek",
  6053. 0x03d3,
  6054. "Upsilonafrican",
  6055. 0x01b1,
  6056. "Upsilondieresis",
  6057. 0x03ab,
  6058. "Upsilondieresishooksymbolgreek",
  6059. 0x03d4,
  6060. "Upsilonhooksymbol",
  6061. 0x03d2,
  6062. "Upsilontonos",
  6063. 0x038e,
  6064. "Uring",
  6065. 0x016e,
  6066. "Ushortcyrillic",
  6067. 0x040e,
  6068. "Usmall",
  6069. 0xf775,
  6070. "Ustraightcyrillic",
  6071. 0x04ae,
  6072. "Ustraightstrokecyrillic",
  6073. 0x04b0,
  6074. "Utilde",
  6075. 0x0168,
  6076. "Utildeacute",
  6077. 0x1e78,
  6078. "Utildebelow",
  6079. 0x1e74,
  6080. "V",
  6081. 0x0056,
  6082. "Vcircle",
  6083. 0x24cb,
  6084. "Vdotbelow",
  6085. 0x1e7e,
  6086. "Vecyrillic",
  6087. 0x0412,
  6088. "Vewarmenian",
  6089. 0x054e,
  6090. "Vhook",
  6091. 0x01b2,
  6092. "Vmonospace",
  6093. 0xff36,
  6094. "Voarmenian",
  6095. 0x0548,
  6096. "Vsmall",
  6097. 0xf776,
  6098. "Vtilde",
  6099. 0x1e7c,
  6100. "W",
  6101. 0x0057,
  6102. "Wacute",
  6103. 0x1e82,
  6104. "Wcircle",
  6105. 0x24cc,
  6106. "Wcircumflex",
  6107. 0x0174,
  6108. "Wdieresis",
  6109. 0x1e84,
  6110. "Wdotaccent",
  6111. 0x1e86,
  6112. "Wdotbelow",
  6113. 0x1e88,
  6114. "Wgrave",
  6115. 0x1e80,
  6116. "Wmonospace",
  6117. 0xff37,
  6118. "Wsmall",
  6119. 0xf777,
  6120. "X",
  6121. 0x0058,
  6122. "Xcircle",
  6123. 0x24cd,
  6124. "Xdieresis",
  6125. 0x1e8c,
  6126. "Xdotaccent",
  6127. 0x1e8a,
  6128. "Xeharmenian",
  6129. 0x053d,
  6130. "Xi",
  6131. 0x039e,
  6132. "Xmonospace",
  6133. 0xff38,
  6134. "Xsmall",
  6135. 0xf778,
  6136. "Y",
  6137. 0x0059,
  6138. "Yacute",
  6139. 0x00dd,
  6140. "Yacutesmall",
  6141. 0xf7fd,
  6142. "Yatcyrillic",
  6143. 0x0462,
  6144. "Ycircle",
  6145. 0x24ce,
  6146. "Ycircumflex",
  6147. 0x0176,
  6148. "Ydieresis",
  6149. 0x0178,
  6150. "Ydieresissmall",
  6151. 0xf7ff,
  6152. "Ydotaccent",
  6153. 0x1e8e,
  6154. "Ydotbelow",
  6155. 0x1ef4,
  6156. "Yericyrillic",
  6157. 0x042b,
  6158. "Yerudieresiscyrillic",
  6159. 0x04f8,
  6160. "Ygrave",
  6161. 0x1ef2,
  6162. "Yhook",
  6163. 0x01b3,
  6164. "Yhookabove",
  6165. 0x1ef6,
  6166. "Yiarmenian",
  6167. 0x0545,
  6168. "Yicyrillic",
  6169. 0x0407,
  6170. "Yiwnarmenian",
  6171. 0x0552,
  6172. "Ymonospace",
  6173. 0xff39,
  6174. "Ysmall",
  6175. 0xf779,
  6176. "Ytilde",
  6177. 0x1ef8,
  6178. "Yusbigcyrillic",
  6179. 0x046a,
  6180. "Yusbigiotifiedcyrillic",
  6181. 0x046c,
  6182. "Yuslittlecyrillic",
  6183. 0x0466,
  6184. "Yuslittleiotifiedcyrillic",
  6185. 0x0468,
  6186. "Z",
  6187. 0x005a,
  6188. "Zaarmenian",
  6189. 0x0536,
  6190. "Zacute",
  6191. 0x0179,
  6192. "Zcaron",
  6193. 0x017d,
  6194. "Zcaronsmall",
  6195. 0xf6ff,
  6196. "Zcircle",
  6197. 0x24cf,
  6198. "Zcircumflex",
  6199. 0x1e90,
  6200. "Zdot",
  6201. 0x017b,
  6202. "Zdotaccent",
  6203. 0x017b,
  6204. "Zdotbelow",
  6205. 0x1e92,
  6206. "Zecyrillic",
  6207. 0x0417,
  6208. "Zedescendercyrillic",
  6209. 0x0498,
  6210. "Zedieresiscyrillic",
  6211. 0x04de,
  6212. "Zeta",
  6213. 0x0396,
  6214. "Zhearmenian",
  6215. 0x053a,
  6216. "Zhebrevecyrillic",
  6217. 0x04c1,
  6218. "Zhecyrillic",
  6219. 0x0416,
  6220. "Zhedescendercyrillic",
  6221. 0x0496,
  6222. "Zhedieresiscyrillic",
  6223. 0x04dc,
  6224. "Zlinebelow",
  6225. 0x1e94,
  6226. "Zmonospace",
  6227. 0xff3a,
  6228. "Zsmall",
  6229. 0xf77a,
  6230. "Zstroke",
  6231. 0x01b5,
  6232. "a",
  6233. 0x0061,
  6234. "aabengali",
  6235. 0x0986,
  6236. "aacute",
  6237. 0x00e1,
  6238. "aadeva",
  6239. 0x0906,
  6240. "aagujarati",
  6241. 0x0a86,
  6242. "aagurmukhi",
  6243. 0x0a06,
  6244. "aamatragurmukhi",
  6245. 0x0a3e,
  6246. "aarusquare",
  6247. 0x3303,
  6248. "aavowelsignbengali",
  6249. 0x09be,
  6250. "aavowelsigndeva",
  6251. 0x093e,
  6252. "aavowelsigngujarati",
  6253. 0x0abe,
  6254. "abbreviationmarkarmenian",
  6255. 0x055f,
  6256. "abbreviationsigndeva",
  6257. 0x0970,
  6258. "abengali",
  6259. 0x0985,
  6260. "abopomofo",
  6261. 0x311a,
  6262. "abreve",
  6263. 0x0103,
  6264. "abreveacute",
  6265. 0x1eaf,
  6266. "abrevecyrillic",
  6267. 0x04d1,
  6268. "abrevedotbelow",
  6269. 0x1eb7,
  6270. "abrevegrave",
  6271. 0x1eb1,
  6272. "abrevehookabove",
  6273. 0x1eb3,
  6274. "abrevetilde",
  6275. 0x1eb5,
  6276. "acaron",
  6277. 0x01ce,
  6278. "acircle",
  6279. 0x24d0,
  6280. "acircumflex",
  6281. 0x00e2,
  6282. "acircumflexacute",
  6283. 0x1ea5,
  6284. "acircumflexdotbelow",
  6285. 0x1ead,
  6286. "acircumflexgrave",
  6287. 0x1ea7,
  6288. "acircumflexhookabove",
  6289. 0x1ea9,
  6290. "acircumflextilde",
  6291. 0x1eab,
  6292. "acute",
  6293. 0x00b4,
  6294. "acutebelowcmb",
  6295. 0x0317,
  6296. "acutecmb",
  6297. 0x0301,
  6298. "acutecomb",
  6299. 0x0301,
  6300. "acutedeva",
  6301. 0x0954,
  6302. "acutelowmod",
  6303. 0x02cf,
  6304. "acutetonecmb",
  6305. 0x0341,
  6306. "acyrillic",
  6307. 0x0430,
  6308. "adblgrave",
  6309. 0x0201,
  6310. "addakgurmukhi",
  6311. 0x0a71,
  6312. "adeva",
  6313. 0x0905,
  6314. "adieresis",
  6315. 0x00e4,
  6316. "adieresiscyrillic",
  6317. 0x04d3,
  6318. "adieresismacron",
  6319. 0x01df,
  6320. "adotbelow",
  6321. 0x1ea1,
  6322. "adotmacron",
  6323. 0x01e1,
  6324. "ae",
  6325. 0x00e6,
  6326. "aeacute",
  6327. 0x01fd,
  6328. "aekorean",
  6329. 0x3150,
  6330. "aemacron",
  6331. 0x01e3,
  6332. "afii00208",
  6333. 0x2015,
  6334. "afii08941",
  6335. 0x20a4,
  6336. "afii10017",
  6337. 0x0410,
  6338. "afii10018",
  6339. 0x0411,
  6340. "afii10019",
  6341. 0x0412,
  6342. "afii10020",
  6343. 0x0413,
  6344. "afii10021",
  6345. 0x0414,
  6346. "afii10022",
  6347. 0x0415,
  6348. "afii10023",
  6349. 0x0401,
  6350. "afii10024",
  6351. 0x0416,
  6352. "afii10025",
  6353. 0x0417,
  6354. "afii10026",
  6355. 0x0418,
  6356. "afii10027",
  6357. 0x0419,
  6358. "afii10028",
  6359. 0x041a,
  6360. "afii10029",
  6361. 0x041b,
  6362. "afii10030",
  6363. 0x041c,
  6364. "afii10031",
  6365. 0x041d,
  6366. "afii10032",
  6367. 0x041e,
  6368. "afii10033",
  6369. 0x041f,
  6370. "afii10034",
  6371. 0x0420,
  6372. "afii10035",
  6373. 0x0421,
  6374. "afii10036",
  6375. 0x0422,
  6376. "afii10037",
  6377. 0x0423,
  6378. "afii10038",
  6379. 0x0424,
  6380. "afii10039",
  6381. 0x0425,
  6382. "afii10040",
  6383. 0x0426,
  6384. "afii10041",
  6385. 0x0427,
  6386. "afii10042",
  6387. 0x0428,
  6388. "afii10043",
  6389. 0x0429,
  6390. "afii10044",
  6391. 0x042a,
  6392. "afii10045",
  6393. 0x042b,
  6394. "afii10046",
  6395. 0x042c,
  6396. "afii10047",
  6397. 0x042d,
  6398. "afii10048",
  6399. 0x042e,
  6400. "afii10049",
  6401. 0x042f,
  6402. "afii10050",
  6403. 0x0490,
  6404. "afii10051",
  6405. 0x0402,
  6406. "afii10052",
  6407. 0x0403,
  6408. "afii10053",
  6409. 0x0404,
  6410. "afii10054",
  6411. 0x0405,
  6412. "afii10055",
  6413. 0x0406,
  6414. "afii10056",
  6415. 0x0407,
  6416. "afii10057",
  6417. 0x0408,
  6418. "afii10058",
  6419. 0x0409,
  6420. "afii10059",
  6421. 0x040a,
  6422. "afii10060",
  6423. 0x040b,
  6424. "afii10061",
  6425. 0x040c,
  6426. "afii10062",
  6427. 0x040e,
  6428. "afii10063",
  6429. 0xf6c4,
  6430. "afii10064",
  6431. 0xf6c5,
  6432. "afii10065",
  6433. 0x0430,
  6434. "afii10066",
  6435. 0x0431,
  6436. "afii10067",
  6437. 0x0432,
  6438. "afii10068",
  6439. 0x0433,
  6440. "afii10069",
  6441. 0x0434,
  6442. "afii10070",
  6443. 0x0435,
  6444. "afii10071",
  6445. 0x0451,
  6446. "afii10072",
  6447. 0x0436,
  6448. "afii10073",
  6449. 0x0437,
  6450. "afii10074",
  6451. 0x0438,
  6452. "afii10075",
  6453. 0x0439,
  6454. "afii10076",
  6455. 0x043a,
  6456. "afii10077",
  6457. 0x043b,
  6458. "afii10078",
  6459. 0x043c,
  6460. "afii10079",
  6461. 0x043d,
  6462. "afii10080",
  6463. 0x043e,
  6464. "afii10081",
  6465. 0x043f,
  6466. "afii10082",
  6467. 0x0440,
  6468. "afii10083",
  6469. 0x0441,
  6470. "afii10084",
  6471. 0x0442,
  6472. "afii10085",
  6473. 0x0443,
  6474. "afii10086",
  6475. 0x0444,
  6476. "afii10087",
  6477. 0x0445,
  6478. "afii10088",
  6479. 0x0446,
  6480. "afii10089",
  6481. 0x0447,
  6482. "afii10090",
  6483. 0x0448,
  6484. "afii10091",
  6485. 0x0449,
  6486. "afii10092",
  6487. 0x044a,
  6488. "afii10093",
  6489. 0x044b,
  6490. "afii10094",
  6491. 0x044c,
  6492. "afii10095",
  6493. 0x044d,
  6494. "afii10096",
  6495. 0x044e,
  6496. "afii10097",
  6497. 0x044f,
  6498. "afii10098",
  6499. 0x0491,
  6500. "afii10099",
  6501. 0x0452,
  6502. "afii10100",
  6503. 0x0453,
  6504. "afii10101",
  6505. 0x0454,
  6506. "afii10102",
  6507. 0x0455,
  6508. "afii10103",
  6509. 0x0456,
  6510. "afii10104",
  6511. 0x0457,
  6512. "afii10105",
  6513. 0x0458,
  6514. "afii10106",
  6515. 0x0459,
  6516. "afii10107",
  6517. 0x045a,
  6518. "afii10108",
  6519. 0x045b,
  6520. "afii10109",
  6521. 0x045c,
  6522. "afii10110",
  6523. 0x045e,
  6524. "afii10145",
  6525. 0x040f,
  6526. "afii10146",
  6527. 0x0462,
  6528. "afii10147",
  6529. 0x0472,
  6530. "afii10148",
  6531. 0x0474,
  6532. "afii10192",
  6533. 0xf6c6,
  6534. "afii10193",
  6535. 0x045f,
  6536. "afii10194",
  6537. 0x0463,
  6538. "afii10195",
  6539. 0x0473,
  6540. "afii10196",
  6541. 0x0475,
  6542. "afii10831",
  6543. 0xf6c7,
  6544. "afii10832",
  6545. 0xf6c8,
  6546. "afii10846",
  6547. 0x04d9,
  6548. "afii299",
  6549. 0x200e,
  6550. "afii300",
  6551. 0x200f,
  6552. "afii301",
  6553. 0x200d,
  6554. "afii57381",
  6555. 0x066a,
  6556. "afii57388",
  6557. 0x060c,
  6558. "afii57392",
  6559. 0x0660,
  6560. "afii57393",
  6561. 0x0661,
  6562. "afii57394",
  6563. 0x0662,
  6564. "afii57395",
  6565. 0x0663,
  6566. "afii57396",
  6567. 0x0664,
  6568. "afii57397",
  6569. 0x0665,
  6570. "afii57398",
  6571. 0x0666,
  6572. "afii57399",
  6573. 0x0667,
  6574. "afii57400",
  6575. 0x0668,
  6576. "afii57401",
  6577. 0x0669,
  6578. "afii57403",
  6579. 0x061b,
  6580. "afii57407",
  6581. 0x061f,
  6582. "afii57409",
  6583. 0x0621,
  6584. "afii57410",
  6585. 0x0622,
  6586. "afii57411",
  6587. 0x0623,
  6588. "afii57412",
  6589. 0x0624,
  6590. "afii57413",
  6591. 0x0625,
  6592. "afii57414",
  6593. 0x0626,
  6594. "afii57415",
  6595. 0x0627,
  6596. "afii57416",
  6597. 0x0628,
  6598. "afii57417",
  6599. 0x0629,
  6600. "afii57418",
  6601. 0x062a,
  6602. "afii57419",
  6603. 0x062b,
  6604. "afii57420",
  6605. 0x062c,
  6606. "afii57421",
  6607. 0x062d,
  6608. "afii57422",
  6609. 0x062e,
  6610. "afii57423",
  6611. 0x062f,
  6612. "afii57424",
  6613. 0x0630,
  6614. "afii57425",
  6615. 0x0631,
  6616. "afii57426",
  6617. 0x0632,
  6618. "afii57427",
  6619. 0x0633,
  6620. "afii57428",
  6621. 0x0634,
  6622. "afii57429",
  6623. 0x0635,
  6624. "afii57430",
  6625. 0x0636,
  6626. "afii57431",
  6627. 0x0637,
  6628. "afii57432",
  6629. 0x0638,
  6630. "afii57433",
  6631. 0x0639,
  6632. "afii57434",
  6633. 0x063a,
  6634. "afii57440",
  6635. 0x0640,
  6636. "afii57441",
  6637. 0x0641,
  6638. "afii57442",
  6639. 0x0642,
  6640. "afii57443",
  6641. 0x0643,
  6642. "afii57444",
  6643. 0x0644,
  6644. "afii57445",
  6645. 0x0645,
  6646. "afii57446",
  6647. 0x0646,
  6648. "afii57448",
  6649. 0x0648,
  6650. "afii57449",
  6651. 0x0649,
  6652. "afii57450",
  6653. 0x064a,
  6654. "afii57451",
  6655. 0x064b,
  6656. "afii57452",
  6657. 0x064c,
  6658. "afii57453",
  6659. 0x064d,
  6660. "afii57454",
  6661. 0x064e,
  6662. "afii57455",
  6663. 0x064f,
  6664. "afii57456",
  6665. 0x0650,
  6666. "afii57457",
  6667. 0x0651,
  6668. "afii57458",
  6669. 0x0652,
  6670. "afii57470",
  6671. 0x0647,
  6672. "afii57505",
  6673. 0x06a4,
  6674. "afii57506",
  6675. 0x067e,
  6676. "afii57507",
  6677. 0x0686,
  6678. "afii57508",
  6679. 0x0698,
  6680. "afii57509",
  6681. 0x06af,
  6682. "afii57511",
  6683. 0x0679,
  6684. "afii57512",
  6685. 0x0688,
  6686. "afii57513",
  6687. 0x0691,
  6688. "afii57514",
  6689. 0x06ba,
  6690. "afii57519",
  6691. 0x06d2,
  6692. "afii57534",
  6693. 0x06d5,
  6694. "afii57636",
  6695. 0x20aa,
  6696. "afii57645",
  6697. 0x05be,
  6698. "afii57658",
  6699. 0x05c3,
  6700. "afii57664",
  6701. 0x05d0,
  6702. "afii57665",
  6703. 0x05d1,
  6704. "afii57666",
  6705. 0x05d2,
  6706. "afii57667",
  6707. 0x05d3,
  6708. "afii57668",
  6709. 0x05d4,
  6710. "afii57669",
  6711. 0x05d5,
  6712. "afii57670",
  6713. 0x05d6,
  6714. "afii57671",
  6715. 0x05d7,
  6716. "afii57672",
  6717. 0x05d8,
  6718. "afii57673",
  6719. 0x05d9,
  6720. "afii57674",
  6721. 0x05da,
  6722. "afii57675",
  6723. 0x05db,
  6724. "afii57676",
  6725. 0x05dc,
  6726. "afii57677",
  6727. 0x05dd,
  6728. "afii57678",
  6729. 0x05de,
  6730. "afii57679",
  6731. 0x05df,
  6732. "afii57680",
  6733. 0x05e0,
  6734. "afii57681",
  6735. 0x05e1,
  6736. "afii57682",
  6737. 0x05e2,
  6738. "afii57683",
  6739. 0x05e3,
  6740. "afii57684",
  6741. 0x05e4,
  6742. "afii57685",
  6743. 0x05e5,
  6744. "afii57686",
  6745. 0x05e6,
  6746. "afii57687",
  6747. 0x05e7,
  6748. "afii57688",
  6749. 0x05e8,
  6750. "afii57689",
  6751. 0x05e9,
  6752. "afii57690",
  6753. 0x05ea,
  6754. "afii57694",
  6755. 0xfb2a,
  6756. "afii57695",
  6757. 0xfb2b,
  6758. "afii57700",
  6759. 0xfb4b,
  6760. "afii57705",
  6761. 0xfb1f,
  6762. "afii57716",
  6763. 0x05f0,
  6764. "afii57717",
  6765. 0x05f1,
  6766. "afii57718",
  6767. 0x05f2,
  6768. "afii57723",
  6769. 0xfb35,
  6770. "afii57793",
  6771. 0x05b4,
  6772. "afii57794",
  6773. 0x05b5,
  6774. "afii57795",
  6775. 0x05b6,
  6776. "afii57796",
  6777. 0x05bb,
  6778. "afii57797",
  6779. 0x05b8,
  6780. "afii57798",
  6781. 0x05b7,
  6782. "afii57799",
  6783. 0x05b0,
  6784. "afii57800",
  6785. 0x05b2,
  6786. "afii57801",
  6787. 0x05b1,
  6788. "afii57802",
  6789. 0x05b3,
  6790. "afii57803",
  6791. 0x05c2,
  6792. "afii57804",
  6793. 0x05c1,
  6794. "afii57806",
  6795. 0x05b9,
  6796. "afii57807",
  6797. 0x05bc,
  6798. "afii57839",
  6799. 0x05bd,
  6800. "afii57841",
  6801. 0x05bf,
  6802. "afii57842",
  6803. 0x05c0,
  6804. "afii57929",
  6805. 0x02bc,
  6806. "afii61248",
  6807. 0x2105,
  6808. "afii61289",
  6809. 0x2113,
  6810. "afii61352",
  6811. 0x2116,
  6812. "afii61573",
  6813. 0x202c,
  6814. "afii61574",
  6815. 0x202d,
  6816. "afii61575",
  6817. 0x202e,
  6818. "afii61664",
  6819. 0x200c,
  6820. "afii63167",
  6821. 0x066d,
  6822. "afii64937",
  6823. 0x02bd,
  6824. "agrave",
  6825. 0x00e0,
  6826. "agujarati",
  6827. 0x0a85,
  6828. "agurmukhi",
  6829. 0x0a05,
  6830. "ahiragana",
  6831. 0x3042,
  6832. "ahookabove",
  6833. 0x1ea3,
  6834. "aibengali",
  6835. 0x0990,
  6836. "aibopomofo",
  6837. 0x311e,
  6838. "aideva",
  6839. 0x0910,
  6840. "aiecyrillic",
  6841. 0x04d5,
  6842. "aigujarati",
  6843. 0x0a90,
  6844. "aigurmukhi",
  6845. 0x0a10,
  6846. "aimatragurmukhi",
  6847. 0x0a48,
  6848. "ainarabic",
  6849. 0x0639,
  6850. "ainfinalarabic",
  6851. 0xfeca,
  6852. "aininitialarabic",
  6853. 0xfecb,
  6854. "ainmedialarabic",
  6855. 0xfecc,
  6856. "ainvertedbreve",
  6857. 0x0203,
  6858. "aivowelsignbengali",
  6859. 0x09c8,
  6860. "aivowelsigndeva",
  6861. 0x0948,
  6862. "aivowelsigngujarati",
  6863. 0x0ac8,
  6864. "akatakana",
  6865. 0x30a2,
  6866. "akatakanahalfwidth",
  6867. 0xff71,
  6868. "akorean",
  6869. 0x314f,
  6870. "alef",
  6871. 0x05d0,
  6872. "alefarabic",
  6873. 0x0627,
  6874. "alefdageshhebrew",
  6875. 0xfb30,
  6876. "aleffinalarabic",
  6877. 0xfe8e,
  6878. "alefhamzaabovearabic",
  6879. 0x0623,
  6880. "alefhamzaabovefinalarabic",
  6881. 0xfe84,
  6882. "alefhamzabelowarabic",
  6883. 0x0625,
  6884. "alefhamzabelowfinalarabic",
  6885. 0xfe88,
  6886. "alefhebrew",
  6887. 0x05d0,
  6888. "aleflamedhebrew",
  6889. 0xfb4f,
  6890. "alefmaddaabovearabic",
  6891. 0x0622,
  6892. "alefmaddaabovefinalarabic",
  6893. 0xfe82,
  6894. "alefmaksuraarabic",
  6895. 0x0649,
  6896. "alefmaksurafinalarabic",
  6897. 0xfef0,
  6898. "alefmaksurainitialarabic",
  6899. 0xfef3,
  6900. "alefmaksuramedialarabic",
  6901. 0xfef4,
  6902. "alefpatahhebrew",
  6903. 0xfb2e,
  6904. "alefqamatshebrew",
  6905. 0xfb2f,
  6906. "aleph",
  6907. 0x2135,
  6908. "allequal",
  6909. 0x224c,
  6910. "alpha",
  6911. 0x03b1,
  6912. "alphatonos",
  6913. 0x03ac,
  6914. "amacron",
  6915. 0x0101,
  6916. "amonospace",
  6917. 0xff41,
  6918. "ampersand",
  6919. 0x0026,
  6920. "ampersandmonospace",
  6921. 0xff06,
  6922. "ampersandsmall",
  6923. 0xf726,
  6924. "amsquare",
  6925. 0x33c2,
  6926. "anbopomofo",
  6927. 0x3122,
  6928. "angbopomofo",
  6929. 0x3124,
  6930. "angbracketleft",
  6931. 0x3008,
  6932. "angbracketright",
  6933. 0x3009,
  6934. "angkhankhuthai",
  6935. 0x0e5a,
  6936. "angle",
  6937. 0x2220,
  6938. "anglebracketleft",
  6939. 0x3008,
  6940. "anglebracketleftvertical",
  6941. 0xfe3f,
  6942. "anglebracketright",
  6943. 0x3009,
  6944. "anglebracketrightvertical",
  6945. 0xfe40,
  6946. "angleleft",
  6947. 0x2329,
  6948. "angleright",
  6949. 0x232a,
  6950. "angstrom",
  6951. 0x212b,
  6952. "anoteleia",
  6953. 0x0387,
  6954. "anudattadeva",
  6955. 0x0952,
  6956. "anusvarabengali",
  6957. 0x0982,
  6958. "anusvaradeva",
  6959. 0x0902,
  6960. "anusvaragujarati",
  6961. 0x0a82,
  6962. "aogonek",
  6963. 0x0105,
  6964. "apaatosquare",
  6965. 0x3300,
  6966. "aparen",
  6967. 0x249c,
  6968. "apostrophearmenian",
  6969. 0x055a,
  6970. "apostrophemod",
  6971. 0x02bc,
  6972. "apple",
  6973. 0xf8ff,
  6974. "approaches",
  6975. 0x2250,
  6976. "approxequal",
  6977. 0x2248,
  6978. "approxequalorimage",
  6979. 0x2252,
  6980. "approximatelyequal",
  6981. 0x2245,
  6982. "araeaekorean",
  6983. 0x318e,
  6984. "araeakorean",
  6985. 0x318d,
  6986. "arc",
  6987. 0x2312,
  6988. "arighthalfring",
  6989. 0x1e9a,
  6990. "aring",
  6991. 0x00e5,
  6992. "aringacute",
  6993. 0x01fb,
  6994. "aringbelow",
  6995. 0x1e01,
  6996. "arrowboth",
  6997. 0x2194,
  6998. "arrowdashdown",
  6999. 0x21e3,
  7000. "arrowdashleft",
  7001. 0x21e0,
  7002. "arrowdashright",
  7003. 0x21e2,
  7004. "arrowdashup",
  7005. 0x21e1,
  7006. "arrowdblboth",
  7007. 0x21d4,
  7008. "arrowdbldown",
  7009. 0x21d3,
  7010. "arrowdblleft",
  7011. 0x21d0,
  7012. "arrowdblright",
  7013. 0x21d2,
  7014. "arrowdblup",
  7015. 0x21d1,
  7016. "arrowdown",
  7017. 0x2193,
  7018. "arrowdownleft",
  7019. 0x2199,
  7020. "arrowdownright",
  7021. 0x2198,
  7022. "arrowdownwhite",
  7023. 0x21e9,
  7024. "arrowheaddownmod",
  7025. 0x02c5,
  7026. "arrowheadleftmod",
  7027. 0x02c2,
  7028. "arrowheadrightmod",
  7029. 0x02c3,
  7030. "arrowheadupmod",
  7031. 0x02c4,
  7032. "arrowhorizex",
  7033. 0xf8e7,
  7034. "arrowleft",
  7035. 0x2190,
  7036. "arrowleftdbl",
  7037. 0x21d0,
  7038. "arrowleftdblstroke",
  7039. 0x21cd,
  7040. "arrowleftoverright",
  7041. 0x21c6,
  7042. "arrowleftwhite",
  7043. 0x21e6,
  7044. "arrowright",
  7045. 0x2192,
  7046. "arrowrightdblstroke",
  7047. 0x21cf,
  7048. "arrowrightheavy",
  7049. 0x279e,
  7050. "arrowrightoverleft",
  7051. 0x21c4,
  7052. "arrowrightwhite",
  7053. 0x21e8,
  7054. "arrowtableft",
  7055. 0x21e4,
  7056. "arrowtabright",
  7057. 0x21e5,
  7058. "arrowup",
  7059. 0x2191,
  7060. "arrowupdn",
  7061. 0x2195,
  7062. "arrowupdnbse",
  7063. 0x21a8,
  7064. "arrowupdownbase",
  7065. 0x21a8,
  7066. "arrowupleft",
  7067. 0x2196,
  7068. "arrowupleftofdown",
  7069. 0x21c5,
  7070. "arrowupright",
  7071. 0x2197,
  7072. "arrowupwhite",
  7073. 0x21e7,
  7074. "arrowvertex",
  7075. 0xf8e6,
  7076. "asciicircum",
  7077. 0x005e,
  7078. "asciicircummonospace",
  7079. 0xff3e,
  7080. "asciitilde",
  7081. 0x007e,
  7082. "asciitildemonospace",
  7083. 0xff5e,
  7084. "ascript",
  7085. 0x0251,
  7086. "ascriptturned",
  7087. 0x0252,
  7088. "asmallhiragana",
  7089. 0x3041,
  7090. "asmallkatakana",
  7091. 0x30a1,
  7092. "asmallkatakanahalfwidth",
  7093. 0xff67,
  7094. "asterisk",
  7095. 0x002a,
  7096. "asteriskaltonearabic",
  7097. 0x066d,
  7098. "asteriskarabic",
  7099. 0x066d,
  7100. "asteriskmath",
  7101. 0x2217,
  7102. "asteriskmonospace",
  7103. 0xff0a,
  7104. "asterisksmall",
  7105. 0xfe61,
  7106. "asterism",
  7107. 0x2042,
  7108. "asuperior",
  7109. 0xf6e9,
  7110. "asymptoticallyequal",
  7111. 0x2243,
  7112. "at",
  7113. 0x0040,
  7114. "atilde",
  7115. 0x00e3,
  7116. "atmonospace",
  7117. 0xff20,
  7118. "atsmall",
  7119. 0xfe6b,
  7120. "aturned",
  7121. 0x0250,
  7122. "aubengali",
  7123. 0x0994,
  7124. "aubopomofo",
  7125. 0x3120,
  7126. "audeva",
  7127. 0x0914,
  7128. "augujarati",
  7129. 0x0a94,
  7130. "augurmukhi",
  7131. 0x0a14,
  7132. "aulengthmarkbengali",
  7133. 0x09d7,
  7134. "aumatragurmukhi",
  7135. 0x0a4c,
  7136. "auvowelsignbengali",
  7137. 0x09cc,
  7138. "auvowelsigndeva",
  7139. 0x094c,
  7140. "auvowelsigngujarati",
  7141. 0x0acc,
  7142. "avagrahadeva",
  7143. 0x093d,
  7144. "aybarmenian",
  7145. 0x0561,
  7146. "ayin",
  7147. 0x05e2,
  7148. "ayinaltonehebrew",
  7149. 0xfb20,
  7150. "ayinhebrew",
  7151. 0x05e2,
  7152. "b",
  7153. 0x0062,
  7154. "babengali",
  7155. 0x09ac,
  7156. "backslash",
  7157. 0x005c,
  7158. "backslashmonospace",
  7159. 0xff3c,
  7160. "badeva",
  7161. 0x092c,
  7162. "bagujarati",
  7163. 0x0aac,
  7164. "bagurmukhi",
  7165. 0x0a2c,
  7166. "bahiragana",
  7167. 0x3070,
  7168. "bahtthai",
  7169. 0x0e3f,
  7170. "bakatakana",
  7171. 0x30d0,
  7172. "bar",
  7173. 0x007c,
  7174. "barmonospace",
  7175. 0xff5c,
  7176. "bbopomofo",
  7177. 0x3105,
  7178. "bcircle",
  7179. 0x24d1,
  7180. "bdotaccent",
  7181. 0x1e03,
  7182. "bdotbelow",
  7183. 0x1e05,
  7184. "beamedsixteenthnotes",
  7185. 0x266c,
  7186. "because",
  7187. 0x2235,
  7188. "becyrillic",
  7189. 0x0431,
  7190. "beharabic",
  7191. 0x0628,
  7192. "behfinalarabic",
  7193. 0xfe90,
  7194. "behinitialarabic",
  7195. 0xfe91,
  7196. "behiragana",
  7197. 0x3079,
  7198. "behmedialarabic",
  7199. 0xfe92,
  7200. "behmeeminitialarabic",
  7201. 0xfc9f,
  7202. "behmeemisolatedarabic",
  7203. 0xfc08,
  7204. "behnoonfinalarabic",
  7205. 0xfc6d,
  7206. "bekatakana",
  7207. 0x30d9,
  7208. "benarmenian",
  7209. 0x0562,
  7210. "bet",
  7211. 0x05d1,
  7212. "beta",
  7213. 0x03b2,
  7214. "betasymbolgreek",
  7215. 0x03d0,
  7216. "betdagesh",
  7217. 0xfb31,
  7218. "betdageshhebrew",
  7219. 0xfb31,
  7220. "bethebrew",
  7221. 0x05d1,
  7222. "betrafehebrew",
  7223. 0xfb4c,
  7224. "bhabengali",
  7225. 0x09ad,
  7226. "bhadeva",
  7227. 0x092d,
  7228. "bhagujarati",
  7229. 0x0aad,
  7230. "bhagurmukhi",
  7231. 0x0a2d,
  7232. "bhook",
  7233. 0x0253,
  7234. "bihiragana",
  7235. 0x3073,
  7236. "bikatakana",
  7237. 0x30d3,
  7238. "bilabialclick",
  7239. 0x0298,
  7240. "bindigurmukhi",
  7241. 0x0a02,
  7242. "birusquare",
  7243. 0x3331,
  7244. "blackcircle",
  7245. 0x25cf,
  7246. "blackdiamond",
  7247. 0x25c6,
  7248. "blackdownpointingtriangle",
  7249. 0x25bc,
  7250. "blackleftpointingpointer",
  7251. 0x25c4,
  7252. "blackleftpointingtriangle",
  7253. 0x25c0,
  7254. "blacklenticularbracketleft",
  7255. 0x3010,
  7256. "blacklenticularbracketleftvertical",
  7257. 0xfe3b,
  7258. "blacklenticularbracketright",
  7259. 0x3011,
  7260. "blacklenticularbracketrightvertical",
  7261. 0xfe3c,
  7262. "blacklowerlefttriangle",
  7263. 0x25e3,
  7264. "blacklowerrighttriangle",
  7265. 0x25e2,
  7266. "blackrectangle",
  7267. 0x25ac,
  7268. "blackrightpointingpointer",
  7269. 0x25ba,
  7270. "blackrightpointingtriangle",
  7271. 0x25b6,
  7272. "blacksmallsquare",
  7273. 0x25aa,
  7274. "blacksmilingface",
  7275. 0x263b,
  7276. "blacksquare",
  7277. 0x25a0,
  7278. "blackstar",
  7279. 0x2605,
  7280. "blackupperlefttriangle",
  7281. 0x25e4,
  7282. "blackupperrighttriangle",
  7283. 0x25e5,
  7284. "blackuppointingsmalltriangle",
  7285. 0x25b4,
  7286. "blackuppointingtriangle",
  7287. 0x25b2,
  7288. "blank",
  7289. 0x2423,
  7290. "blinebelow",
  7291. 0x1e07,
  7292. "block",
  7293. 0x2588,
  7294. "bmonospace",
  7295. 0xff42,
  7296. "bobaimaithai",
  7297. 0x0e1a,
  7298. "bohiragana",
  7299. 0x307c,
  7300. "bokatakana",
  7301. 0x30dc,
  7302. "bparen",
  7303. 0x249d,
  7304. "bqsquare",
  7305. 0x33c3,
  7306. "braceex",
  7307. 0xf8f4,
  7308. "braceleft",
  7309. 0x007b,
  7310. "braceleftbt",
  7311. 0xf8f3,
  7312. "braceleftmid",
  7313. 0xf8f2,
  7314. "braceleftmonospace",
  7315. 0xff5b,
  7316. "braceleftsmall",
  7317. 0xfe5b,
  7318. "bracelefttp",
  7319. 0xf8f1,
  7320. "braceleftvertical",
  7321. 0xfe37,
  7322. "braceright",
  7323. 0x007d,
  7324. "bracerightbt",
  7325. 0xf8fe,
  7326. "bracerightmid",
  7327. 0xf8fd,
  7328. "bracerightmonospace",
  7329. 0xff5d,
  7330. "bracerightsmall",
  7331. 0xfe5c,
  7332. "bracerighttp",
  7333. 0xf8fc,
  7334. "bracerightvertical",
  7335. 0xfe38,
  7336. "bracketleft",
  7337. 0x005b,
  7338. "bracketleftbt",
  7339. 0xf8f0,
  7340. "bracketleftex",
  7341. 0xf8ef,
  7342. "bracketleftmonospace",
  7343. 0xff3b,
  7344. "bracketlefttp",
  7345. 0xf8ee,
  7346. "bracketright",
  7347. 0x005d,
  7348. "bracketrightbt",
  7349. 0xf8fb,
  7350. "bracketrightex",
  7351. 0xf8fa,
  7352. "bracketrightmonospace",
  7353. 0xff3d,
  7354. "bracketrighttp",
  7355. 0xf8f9,
  7356. "breve",
  7357. 0x02d8,
  7358. "brevebelowcmb",
  7359. 0x032e,
  7360. "brevecmb",
  7361. 0x0306,
  7362. "breveinvertedbelowcmb",
  7363. 0x032f,
  7364. "breveinvertedcmb",
  7365. 0x0311,
  7366. "breveinverteddoublecmb",
  7367. 0x0361,
  7368. "bridgebelowcmb",
  7369. 0x032a,
  7370. "bridgeinvertedbelowcmb",
  7371. 0x033a,
  7372. "brokenbar",
  7373. 0x00a6,
  7374. "bstroke",
  7375. 0x0180,
  7376. "bsuperior",
  7377. 0xf6ea,
  7378. "btopbar",
  7379. 0x0183,
  7380. "buhiragana",
  7381. 0x3076,
  7382. "bukatakana",
  7383. 0x30d6,
  7384. "bullet",
  7385. 0x2022,
  7386. "bulletinverse",
  7387. 0x25d8,
  7388. "bulletoperator",
  7389. 0x2219,
  7390. "bullseye",
  7391. 0x25ce,
  7392. "c",
  7393. 0x0063,
  7394. "caarmenian",
  7395. 0x056e,
  7396. "cabengali",
  7397. 0x099a,
  7398. "cacute",
  7399. 0x0107,
  7400. "cadeva",
  7401. 0x091a,
  7402. "cagujarati",
  7403. 0x0a9a,
  7404. "cagurmukhi",
  7405. 0x0a1a,
  7406. "calsquare",
  7407. 0x3388,
  7408. "candrabindubengali",
  7409. 0x0981,
  7410. "candrabinducmb",
  7411. 0x0310,
  7412. "candrabindudeva",
  7413. 0x0901,
  7414. "candrabindugujarati",
  7415. 0x0a81,
  7416. "capslock",
  7417. 0x21ea,
  7418. "careof",
  7419. 0x2105,
  7420. "caron",
  7421. 0x02c7,
  7422. "caronbelowcmb",
  7423. 0x032c,
  7424. "caroncmb",
  7425. 0x030c,
  7426. "carriagereturn",
  7427. 0x21b5,
  7428. "cbopomofo",
  7429. 0x3118,
  7430. "ccaron",
  7431. 0x010d,
  7432. "ccedilla",
  7433. 0x00e7,
  7434. "ccedillaacute",
  7435. 0x1e09,
  7436. "ccircle",
  7437. 0x24d2,
  7438. "ccircumflex",
  7439. 0x0109,
  7440. "ccurl",
  7441. 0x0255,
  7442. "cdot",
  7443. 0x010b,
  7444. "cdotaccent",
  7445. 0x010b,
  7446. "cdsquare",
  7447. 0x33c5,
  7448. "cedilla",
  7449. 0x00b8,
  7450. "cedillacmb",
  7451. 0x0327,
  7452. "cent",
  7453. 0x00a2,
  7454. "centigrade",
  7455. 0x2103,
  7456. "centinferior",
  7457. 0xf6df,
  7458. "centmonospace",
  7459. 0xffe0,
  7460. "centoldstyle",
  7461. 0xf7a2,
  7462. "centsuperior",
  7463. 0xf6e0,
  7464. "chaarmenian",
  7465. 0x0579,
  7466. "chabengali",
  7467. 0x099b,
  7468. "chadeva",
  7469. 0x091b,
  7470. "chagujarati",
  7471. 0x0a9b,
  7472. "chagurmukhi",
  7473. 0x0a1b,
  7474. "chbopomofo",
  7475. 0x3114,
  7476. "cheabkhasiancyrillic",
  7477. 0x04bd,
  7478. "checkmark",
  7479. 0x2713,
  7480. "checyrillic",
  7481. 0x0447,
  7482. "chedescenderabkhasiancyrillic",
  7483. 0x04bf,
  7484. "chedescendercyrillic",
  7485. 0x04b7,
  7486. "chedieresiscyrillic",
  7487. 0x04f5,
  7488. "cheharmenian",
  7489. 0x0573,
  7490. "chekhakassiancyrillic",
  7491. 0x04cc,
  7492. "cheverticalstrokecyrillic",
  7493. 0x04b9,
  7494. "chi",
  7495. 0x03c7,
  7496. "chieuchacirclekorean",
  7497. 0x3277,
  7498. "chieuchaparenkorean",
  7499. 0x3217,
  7500. "chieuchcirclekorean",
  7501. 0x3269,
  7502. "chieuchkorean",
  7503. 0x314a,
  7504. "chieuchparenkorean",
  7505. 0x3209,
  7506. "chochangthai",
  7507. 0x0e0a,
  7508. "chochanthai",
  7509. 0x0e08,
  7510. "chochingthai",
  7511. 0x0e09,
  7512. "chochoethai",
  7513. 0x0e0c,
  7514. "chook",
  7515. 0x0188,
  7516. "cieucacirclekorean",
  7517. 0x3276,
  7518. "cieucaparenkorean",
  7519. 0x3216,
  7520. "cieuccirclekorean",
  7521. 0x3268,
  7522. "cieuckorean",
  7523. 0x3148,
  7524. "cieucparenkorean",
  7525. 0x3208,
  7526. "cieucuparenkorean",
  7527. 0x321c,
  7528. "circle",
  7529. 0x25cb,
  7530. "circlecopyrt",
  7531. 0x00a9,
  7532. "circlemultiply",
  7533. 0x2297,
  7534. "circleot",
  7535. 0x2299,
  7536. "circleplus",
  7537. 0x2295,
  7538. "circlepostalmark",
  7539. 0x3036,
  7540. "circlewithlefthalfblack",
  7541. 0x25d0,
  7542. "circlewithrighthalfblack",
  7543. 0x25d1,
  7544. "circumflex",
  7545. 0x02c6,
  7546. "circumflexbelowcmb",
  7547. 0x032d,
  7548. "circumflexcmb",
  7549. 0x0302,
  7550. "clear",
  7551. 0x2327,
  7552. "clickalveolar",
  7553. 0x01c2,
  7554. "clickdental",
  7555. 0x01c0,
  7556. "clicklateral",
  7557. 0x01c1,
  7558. "clickretroflex",
  7559. 0x01c3,
  7560. "club",
  7561. 0x2663,
  7562. "clubsuitblack",
  7563. 0x2663,
  7564. "clubsuitwhite",
  7565. 0x2667,
  7566. "cmcubedsquare",
  7567. 0x33a4,
  7568. "cmonospace",
  7569. 0xff43,
  7570. "cmsquaredsquare",
  7571. 0x33a0,
  7572. "coarmenian",
  7573. 0x0581,
  7574. "colon",
  7575. 0x003a,
  7576. "colonmonetary",
  7577. 0x20a1,
  7578. "colonmonospace",
  7579. 0xff1a,
  7580. "colonsign",
  7581. 0x20a1,
  7582. "colonsmall",
  7583. 0xfe55,
  7584. "colontriangularhalfmod",
  7585. 0x02d1,
  7586. "colontriangularmod",
  7587. 0x02d0,
  7588. "comma",
  7589. 0x002c,
  7590. "commaabovecmb",
  7591. 0x0313,
  7592. "commaaboverightcmb",
  7593. 0x0315,
  7594. "commaaccent",
  7595. 0xf6c3,
  7596. "commaarabic",
  7597. 0x060c,
  7598. "commaarmenian",
  7599. 0x055d,
  7600. "commainferior",
  7601. 0xf6e1,
  7602. "commamonospace",
  7603. 0xff0c,
  7604. "commareversedabovecmb",
  7605. 0x0314,
  7606. "commareversedmod",
  7607. 0x02bd,
  7608. "commasmall",
  7609. 0xfe50,
  7610. "commasuperior",
  7611. 0xf6e2,
  7612. "commaturnedabovecmb",
  7613. 0x0312,
  7614. "commaturnedmod",
  7615. 0x02bb,
  7616. "compass",
  7617. 0x263c,
  7618. "congruent",
  7619. 0x2245,
  7620. "contourintegral",
  7621. 0x222e,
  7622. "control",
  7623. 0x2303,
  7624. "controlACK",
  7625. 0x0006,
  7626. "controlBEL",
  7627. 0x0007,
  7628. "controlBS",
  7629. 0x0008,
  7630. "controlCAN",
  7631. 0x0018,
  7632. "controlCR",
  7633. 0x000d,
  7634. "controlDC1",
  7635. 0x0011,
  7636. "controlDC2",
  7637. 0x0012,
  7638. "controlDC3",
  7639. 0x0013,
  7640. "controlDC4",
  7641. 0x0014,
  7642. "controlDEL",
  7643. 0x007f,
  7644. "controlDLE",
  7645. 0x0010,
  7646. "controlEM",
  7647. 0x0019,
  7648. "controlENQ",
  7649. 0x0005,
  7650. "controlEOT",
  7651. 0x0004,
  7652. "controlESC",
  7653. 0x001b,
  7654. "controlETB",
  7655. 0x0017,
  7656. "controlETX",
  7657. 0x0003,
  7658. "controlFF",
  7659. 0x000c,
  7660. "controlFS",
  7661. 0x001c,
  7662. "controlGS",
  7663. 0x001d,
  7664. "controlHT",
  7665. 0x0009,
  7666. "controlLF",
  7667. 0x000a,
  7668. "controlNAK",
  7669. 0x0015,
  7670. "controlNULL",
  7671. 0x0000,
  7672. "controlRS",
  7673. 0x001e,
  7674. "controlSI",
  7675. 0x000f,
  7676. "controlSO",
  7677. 0x000e,
  7678. "controlSOT",
  7679. 0x0002,
  7680. "controlSTX",
  7681. 0x0001,
  7682. "controlSUB",
  7683. 0x001a,
  7684. "controlSYN",
  7685. 0x0016,
  7686. "controlUS",
  7687. 0x001f,
  7688. "controlVT",
  7689. 0x000b,
  7690. "copyright",
  7691. 0x00a9,
  7692. "copyrightsans",
  7693. 0xf8e9,
  7694. "copyrightserif",
  7695. 0xf6d9,
  7696. "cornerbracketleft",
  7697. 0x300c,
  7698. "cornerbracketlefthalfwidth",
  7699. 0xff62,
  7700. "cornerbracketleftvertical",
  7701. 0xfe41,
  7702. "cornerbracketright",
  7703. 0x300d,
  7704. "cornerbracketrighthalfwidth",
  7705. 0xff63,
  7706. "cornerbracketrightvertical",
  7707. 0xfe42,
  7708. "corporationsquare",
  7709. 0x337f,
  7710. "cosquare",
  7711. 0x33c7,
  7712. "coverkgsquare",
  7713. 0x33c6,
  7714. "cparen",
  7715. 0x249e,
  7716. "cruzeiro",
  7717. 0x20a2,
  7718. "cstretched",
  7719. 0x0297,
  7720. "curlyand",
  7721. 0x22cf,
  7722. "curlyor",
  7723. 0x22ce,
  7724. "currency",
  7725. 0x00a4,
  7726. "cyrBreve",
  7727. 0xf6d1,
  7728. "cyrFlex",
  7729. 0xf6d2,
  7730. "cyrbreve",
  7731. 0xf6d4,
  7732. "cyrflex",
  7733. 0xf6d5,
  7734. "d",
  7735. 0x0064,
  7736. "daarmenian",
  7737. 0x0564,
  7738. "dabengali",
  7739. 0x09a6,
  7740. "dadarabic",
  7741. 0x0636,
  7742. "dadeva",
  7743. 0x0926,
  7744. "dadfinalarabic",
  7745. 0xfebe,
  7746. "dadinitialarabic",
  7747. 0xfebf,
  7748. "dadmedialarabic",
  7749. 0xfec0,
  7750. "dagesh",
  7751. 0x05bc,
  7752. "dageshhebrew",
  7753. 0x05bc,
  7754. "dagger",
  7755. 0x2020,
  7756. "daggerdbl",
  7757. 0x2021,
  7758. "dagujarati",
  7759. 0x0aa6,
  7760. "dagurmukhi",
  7761. 0x0a26,
  7762. "dahiragana",
  7763. 0x3060,
  7764. "dakatakana",
  7765. 0x30c0,
  7766. "dalarabic",
  7767. 0x062f,
  7768. "dalet",
  7769. 0x05d3,
  7770. "daletdagesh",
  7771. 0xfb33,
  7772. "daletdageshhebrew",
  7773. 0xfb33,
  7774. "dalethebrew",
  7775. 0x05d3,
  7776. "dalfinalarabic",
  7777. 0xfeaa,
  7778. "dammaarabic",
  7779. 0x064f,
  7780. "dammalowarabic",
  7781. 0x064f,
  7782. "dammatanaltonearabic",
  7783. 0x064c,
  7784. "dammatanarabic",
  7785. 0x064c,
  7786. "danda",
  7787. 0x0964,
  7788. "dargahebrew",
  7789. 0x05a7,
  7790. "dargalefthebrew",
  7791. 0x05a7,
  7792. "dasiapneumatacyrilliccmb",
  7793. 0x0485,
  7794. "dblGrave",
  7795. 0xf6d3,
  7796. "dblanglebracketleft",
  7797. 0x300a,
  7798. "dblanglebracketleftvertical",
  7799. 0xfe3d,
  7800. "dblanglebracketright",
  7801. 0x300b,
  7802. "dblanglebracketrightvertical",
  7803. 0xfe3e,
  7804. "dblarchinvertedbelowcmb",
  7805. 0x032b,
  7806. "dblarrowleft",
  7807. 0x21d4,
  7808. "dblarrowright",
  7809. 0x21d2,
  7810. "dbldanda",
  7811. 0x0965,
  7812. "dblgrave",
  7813. 0xf6d6,
  7814. "dblgravecmb",
  7815. 0x030f,
  7816. "dblintegral",
  7817. 0x222c,
  7818. "dbllowline",
  7819. 0x2017,
  7820. "dbllowlinecmb",
  7821. 0x0333,
  7822. "dbloverlinecmb",
  7823. 0x033f,
  7824. "dblprimemod",
  7825. 0x02ba,
  7826. "dblverticalbar",
  7827. 0x2016,
  7828. "dblverticallineabovecmb",
  7829. 0x030e,
  7830. "dbopomofo",
  7831. 0x3109,
  7832. "dbsquare",
  7833. 0x33c8,
  7834. "dcaron",
  7835. 0x010f,
  7836. "dcedilla",
  7837. 0x1e11,
  7838. "dcircle",
  7839. 0x24d3,
  7840. "dcircumflexbelow",
  7841. 0x1e13,
  7842. "dcroat",
  7843. 0x0111,
  7844. "ddabengali",
  7845. 0x09a1,
  7846. "ddadeva",
  7847. 0x0921,
  7848. "ddagujarati",
  7849. 0x0aa1,
  7850. "ddagurmukhi",
  7851. 0x0a21,
  7852. "ddalarabic",
  7853. 0x0688,
  7854. "ddalfinalarabic",
  7855. 0xfb89,
  7856. "dddhadeva",
  7857. 0x095c,
  7858. "ddhabengali",
  7859. 0x09a2,
  7860. "ddhadeva",
  7861. 0x0922,
  7862. "ddhagujarati",
  7863. 0x0aa2,
  7864. "ddhagurmukhi",
  7865. 0x0a22,
  7866. "ddotaccent",
  7867. 0x1e0b,
  7868. "ddotbelow",
  7869. 0x1e0d,
  7870. "decimalseparatorarabic",
  7871. 0x066b,
  7872. "decimalseparatorpersian",
  7873. 0x066b,
  7874. "decyrillic",
  7875. 0x0434,
  7876. "degree",
  7877. 0x00b0,
  7878. "dehihebrew",
  7879. 0x05ad,
  7880. "dehiragana",
  7881. 0x3067,
  7882. "deicoptic",
  7883. 0x03ef,
  7884. "dekatakana",
  7885. 0x30c7,
  7886. "deleteleft",
  7887. 0x232b,
  7888. "deleteright",
  7889. 0x2326,
  7890. "delta",
  7891. 0x03b4,
  7892. "deltaturned",
  7893. 0x018d,
  7894. "denominatorminusonenumeratorbengali",
  7895. 0x09f8,
  7896. "dezh",
  7897. 0x02a4,
  7898. "dhabengali",
  7899. 0x09a7,
  7900. "dhadeva",
  7901. 0x0927,
  7902. "dhagujarati",
  7903. 0x0aa7,
  7904. "dhagurmukhi",
  7905. 0x0a27,
  7906. "dhook",
  7907. 0x0257,
  7908. "dialytikatonos",
  7909. 0x0385,
  7910. "dialytikatonoscmb",
  7911. 0x0344,
  7912. "diamond",
  7913. 0x2666,
  7914. "diamondsuitwhite",
  7915. 0x2662,
  7916. "dieresis",
  7917. 0x00a8,
  7918. "dieresisacute",
  7919. 0xf6d7,
  7920. "dieresisbelowcmb",
  7921. 0x0324,
  7922. "dieresiscmb",
  7923. 0x0308,
  7924. "dieresisgrave",
  7925. 0xf6d8,
  7926. "dieresistonos",
  7927. 0x0385,
  7928. "dihiragana",
  7929. 0x3062,
  7930. "dikatakana",
  7931. 0x30c2,
  7932. "dittomark",
  7933. 0x3003,
  7934. "divide",
  7935. 0x00f7,
  7936. "divides",
  7937. 0x2223,
  7938. "divisionslash",
  7939. 0x2215,
  7940. "djecyrillic",
  7941. 0x0452,
  7942. "dkshade",
  7943. 0x2593,
  7944. "dlinebelow",
  7945. 0x1e0f,
  7946. "dlsquare",
  7947. 0x3397,
  7948. "dmacron",
  7949. 0x0111,
  7950. "dmonospace",
  7951. 0xff44,
  7952. "dnblock",
  7953. 0x2584,
  7954. "dochadathai",
  7955. 0x0e0e,
  7956. "dodekthai",
  7957. 0x0e14,
  7958. "dohiragana",
  7959. 0x3069,
  7960. "dokatakana",
  7961. 0x30c9,
  7962. "dollar",
  7963. 0x0024,
  7964. "dollarinferior",
  7965. 0xf6e3,
  7966. "dollarmonospace",
  7967. 0xff04,
  7968. "dollaroldstyle",
  7969. 0xf724,
  7970. "dollarsmall",
  7971. 0xfe69,
  7972. "dollarsuperior",
  7973. 0xf6e4,
  7974. "dong",
  7975. 0x20ab,
  7976. "dorusquare",
  7977. 0x3326,
  7978. "dotaccent",
  7979. 0x02d9,
  7980. "dotaccentcmb",
  7981. 0x0307,
  7982. "dotbelowcmb",
  7983. 0x0323,
  7984. "dotbelowcomb",
  7985. 0x0323,
  7986. "dotkatakana",
  7987. 0x30fb,
  7988. "dotlessi",
  7989. 0x0131,
  7990. "dotlessj",
  7991. 0xf6be,
  7992. "dotlessjstrokehook",
  7993. 0x0284,
  7994. "dotmath",
  7995. 0x22c5,
  7996. "dottedcircle",
  7997. 0x25cc,
  7998. "doubleyodpatah",
  7999. 0xfb1f,
  8000. "doubleyodpatahhebrew",
  8001. 0xfb1f,
  8002. "downtackbelowcmb",
  8003. 0x031e,
  8004. "downtackmod",
  8005. 0x02d5,
  8006. "dparen",
  8007. 0x249f,
  8008. "dsuperior",
  8009. 0xf6eb,
  8010. "dtail",
  8011. 0x0256,
  8012. "dtopbar",
  8013. 0x018c,
  8014. "duhiragana",
  8015. 0x3065,
  8016. "dukatakana",
  8017. 0x30c5,
  8018. "dz",
  8019. 0x01f3,
  8020. "dzaltone",
  8021. 0x02a3,
  8022. "dzcaron",
  8023. 0x01c6,
  8024. "dzcurl",
  8025. 0x02a5,
  8026. "dzeabkhasiancyrillic",
  8027. 0x04e1,
  8028. "dzecyrillic",
  8029. 0x0455,
  8030. "dzhecyrillic",
  8031. 0x045f,
  8032. "e",
  8033. 0x0065,
  8034. "eacute",
  8035. 0x00e9,
  8036. "earth",
  8037. 0x2641,
  8038. "ebengali",
  8039. 0x098f,
  8040. "ebopomofo",
  8041. 0x311c,
  8042. "ebreve",
  8043. 0x0115,
  8044. "ecandradeva",
  8045. 0x090d,
  8046. "ecandragujarati",
  8047. 0x0a8d,
  8048. "ecandravowelsigndeva",
  8049. 0x0945,
  8050. "ecandravowelsigngujarati",
  8051. 0x0ac5,
  8052. "ecaron",
  8053. 0x011b,
  8054. "ecedillabreve",
  8055. 0x1e1d,
  8056. "echarmenian",
  8057. 0x0565,
  8058. "echyiwnarmenian",
  8059. 0x0587,
  8060. "ecircle",
  8061. 0x24d4,
  8062. "ecircumflex",
  8063. 0x00ea,
  8064. "ecircumflexacute",
  8065. 0x1ebf,
  8066. "ecircumflexbelow",
  8067. 0x1e19,
  8068. "ecircumflexdotbelow",
  8069. 0x1ec7,
  8070. "ecircumflexgrave",
  8071. 0x1ec1,
  8072. "ecircumflexhookabove",
  8073. 0x1ec3,
  8074. "ecircumflextilde",
  8075. 0x1ec5,
  8076. "ecyrillic",
  8077. 0x0454,
  8078. "edblgrave",
  8079. 0x0205,
  8080. "edeva",
  8081. 0x090f,
  8082. "edieresis",
  8083. 0x00eb,
  8084. "edot",
  8085. 0x0117,
  8086. "edotaccent",
  8087. 0x0117,
  8088. "edotbelow",
  8089. 0x1eb9,
  8090. "eegurmukhi",
  8091. 0x0a0f,
  8092. "eematragurmukhi",
  8093. 0x0a47,
  8094. "efcyrillic",
  8095. 0x0444,
  8096. "egrave",
  8097. 0x00e8,
  8098. "egujarati",
  8099. 0x0a8f,
  8100. "eharmenian",
  8101. 0x0567,
  8102. "ehbopomofo",
  8103. 0x311d,
  8104. "ehiragana",
  8105. 0x3048,
  8106. "ehookabove",
  8107. 0x1ebb,
  8108. "eibopomofo",
  8109. 0x311f,
  8110. "eight",
  8111. 0x0038,
  8112. "eightarabic",
  8113. 0x0668,
  8114. "eightbengali",
  8115. 0x09ee,
  8116. "eightcircle",
  8117. 0x2467,
  8118. "eightcircleinversesansserif",
  8119. 0x2791,
  8120. "eightdeva",
  8121. 0x096e,
  8122. "eighteencircle",
  8123. 0x2471,
  8124. "eighteenparen",
  8125. 0x2485,
  8126. "eighteenperiod",
  8127. 0x2499,
  8128. "eightgujarati",
  8129. 0x0aee,
  8130. "eightgurmukhi",
  8131. 0x0a6e,
  8132. "eighthackarabic",
  8133. 0x0668,
  8134. "eighthangzhou",
  8135. 0x3028,
  8136. "eighthnotebeamed",
  8137. 0x266b,
  8138. "eightideographicparen",
  8139. 0x3227,
  8140. "eightinferior",
  8141. 0x2088,
  8142. "eightmonospace",
  8143. 0xff18,
  8144. "eightoldstyle",
  8145. 0xf738,
  8146. "eightparen",
  8147. 0x247b,
  8148. "eightperiod",
  8149. 0x248f,
  8150. "eightpersian",
  8151. 0x06f8,
  8152. "eightroman",
  8153. 0x2177,
  8154. "eightsuperior",
  8155. 0x2078,
  8156. "eightthai",
  8157. 0x0e58,
  8158. "einvertedbreve",
  8159. 0x0207,
  8160. "eiotifiedcyrillic",
  8161. 0x0465,
  8162. "ekatakana",
  8163. 0x30a8,
  8164. "ekatakanahalfwidth",
  8165. 0xff74,
  8166. "ekonkargurmukhi",
  8167. 0x0a74,
  8168. "ekorean",
  8169. 0x3154,
  8170. "elcyrillic",
  8171. 0x043b,
  8172. "element",
  8173. 0x2208,
  8174. "elevencircle",
  8175. 0x246a,
  8176. "elevenparen",
  8177. 0x247e,
  8178. "elevenperiod",
  8179. 0x2492,
  8180. "elevenroman",
  8181. 0x217a,
  8182. "ellipsis",
  8183. 0x2026,
  8184. "ellipsisvertical",
  8185. 0x22ee,
  8186. "emacron",
  8187. 0x0113,
  8188. "emacronacute",
  8189. 0x1e17,
  8190. "emacrongrave",
  8191. 0x1e15,
  8192. "emcyrillic",
  8193. 0x043c,
  8194. "emdash",
  8195. 0x2014,
  8196. "emdashvertical",
  8197. 0xfe31,
  8198. "emonospace",
  8199. 0xff45,
  8200. "emphasismarkarmenian",
  8201. 0x055b,
  8202. "emptyset",
  8203. 0x2205,
  8204. "enbopomofo",
  8205. 0x3123,
  8206. "encyrillic",
  8207. 0x043d,
  8208. "endash",
  8209. 0x2013,
  8210. "endashvertical",
  8211. 0xfe32,
  8212. "endescendercyrillic",
  8213. 0x04a3,
  8214. "eng",
  8215. 0x014b,
  8216. "engbopomofo",
  8217. 0x3125,
  8218. "enghecyrillic",
  8219. 0x04a5,
  8220. "enhookcyrillic",
  8221. 0x04c8,
  8222. "enspace",
  8223. 0x2002,
  8224. "eogonek",
  8225. 0x0119,
  8226. "eokorean",
  8227. 0x3153,
  8228. "eopen",
  8229. 0x025b,
  8230. "eopenclosed",
  8231. 0x029a,
  8232. "eopenreversed",
  8233. 0x025c,
  8234. "eopenreversedclosed",
  8235. 0x025e,
  8236. "eopenreversedhook",
  8237. 0x025d,
  8238. "eparen",
  8239. 0x24a0,
  8240. "epsilon",
  8241. 0x03b5,
  8242. "epsilontonos",
  8243. 0x03ad,
  8244. "equal",
  8245. 0x003d,
  8246. "equalmonospace",
  8247. 0xff1d,
  8248. "equalsmall",
  8249. 0xfe66,
  8250. "equalsuperior",
  8251. 0x207c,
  8252. "equivalence",
  8253. 0x2261,
  8254. "erbopomofo",
  8255. 0x3126,
  8256. "ercyrillic",
  8257. 0x0440,
  8258. "ereversed",
  8259. 0x0258,
  8260. "ereversedcyrillic",
  8261. 0x044d,
  8262. "escyrillic",
  8263. 0x0441,
  8264. "esdescendercyrillic",
  8265. 0x04ab,
  8266. "esh",
  8267. 0x0283,
  8268. "eshcurl",
  8269. 0x0286,
  8270. "eshortdeva",
  8271. 0x090e,
  8272. "eshortvowelsigndeva",
  8273. 0x0946,
  8274. "eshreversedloop",
  8275. 0x01aa,
  8276. "eshsquatreversed",
  8277. 0x0285,
  8278. "esmallhiragana",
  8279. 0x3047,
  8280. "esmallkatakana",
  8281. 0x30a7,
  8282. "esmallkatakanahalfwidth",
  8283. 0xff6a,
  8284. "estimated",
  8285. 0x212e,
  8286. "esuperior",
  8287. 0xf6ec,
  8288. "eta",
  8289. 0x03b7,
  8290. "etarmenian",
  8291. 0x0568,
  8292. "etatonos",
  8293. 0x03ae,
  8294. "eth",
  8295. 0x00f0,
  8296. "etilde",
  8297. 0x1ebd,
  8298. "etildebelow",
  8299. 0x1e1b,
  8300. "etnahtafoukhhebrew",
  8301. 0x0591,
  8302. "etnahtafoukhlefthebrew",
  8303. 0x0591,
  8304. "etnahtahebrew",
  8305. 0x0591,
  8306. "etnahtalefthebrew",
  8307. 0x0591,
  8308. "eturned",
  8309. 0x01dd,
  8310. "eukorean",
  8311. 0x3161,
  8312. "euro",
  8313. 0x20ac,
  8314. "evowelsignbengali",
  8315. 0x09c7,
  8316. "evowelsigndeva",
  8317. 0x0947,
  8318. "evowelsigngujarati",
  8319. 0x0ac7,
  8320. "exclam",
  8321. 0x0021,
  8322. "exclamarmenian",
  8323. 0x055c,
  8324. "exclamdbl",
  8325. 0x203c,
  8326. "exclamdown",
  8327. 0x00a1,
  8328. "exclamdownsmall",
  8329. 0xf7a1,
  8330. "exclammonospace",
  8331. 0xff01,
  8332. "exclamsmall",
  8333. 0xf721,
  8334. "existential",
  8335. 0x2203,
  8336. "ezh",
  8337. 0x0292,
  8338. "ezhcaron",
  8339. 0x01ef,
  8340. "ezhcurl",
  8341. 0x0293,
  8342. "ezhreversed",
  8343. 0x01b9,
  8344. "ezhtail",
  8345. 0x01ba,
  8346. "f",
  8347. 0x0066,
  8348. "fadeva",
  8349. 0x095e,
  8350. "fagurmukhi",
  8351. 0x0a5e,
  8352. "fahrenheit",
  8353. 0x2109,
  8354. "fathaarabic",
  8355. 0x064e,
  8356. "fathalowarabic",
  8357. 0x064e,
  8358. "fathatanarabic",
  8359. 0x064b,
  8360. "fbopomofo",
  8361. 0x3108,
  8362. "fcircle",
  8363. 0x24d5,
  8364. "fdotaccent",
  8365. 0x1e1f,
  8366. "feharabic",
  8367. 0x0641,
  8368. "feharmenian",
  8369. 0x0586,
  8370. "fehfinalarabic",
  8371. 0xfed2,
  8372. "fehinitialarabic",
  8373. 0xfed3,
  8374. "fehmedialarabic",
  8375. 0xfed4,
  8376. "feicoptic",
  8377. 0x03e5,
  8378. "female",
  8379. 0x2640,
  8380. "ff",
  8381. 0xfb00,
  8382. "f_f",
  8383. 0xfb00,
  8384. "ffi",
  8385. 0xfb03,
  8386. "ffl",
  8387. 0xfb04,
  8388. "fi",
  8389. 0xfb01,
  8390. "fifteencircle",
  8391. 0x246e,
  8392. "fifteenparen",
  8393. 0x2482,
  8394. "fifteenperiod",
  8395. 0x2496,
  8396. "figuredash",
  8397. 0x2012,
  8398. "filledbox",
  8399. 0x25a0,
  8400. "filledrect",
  8401. 0x25ac,
  8402. "finalkaf",
  8403. 0x05da,
  8404. "finalkafdagesh",
  8405. 0xfb3a,
  8406. "finalkafdageshhebrew",
  8407. 0xfb3a,
  8408. "finalkafhebrew",
  8409. 0x05da,
  8410. "finalmem",
  8411. 0x05dd,
  8412. "finalmemhebrew",
  8413. 0x05dd,
  8414. "finalnun",
  8415. 0x05df,
  8416. "finalnunhebrew",
  8417. 0x05df,
  8418. "finalpe",
  8419. 0x05e3,
  8420. "finalpehebrew",
  8421. 0x05e3,
  8422. "finaltsadi",
  8423. 0x05e5,
  8424. "finaltsadihebrew",
  8425. 0x05e5,
  8426. "firsttonechinese",
  8427. 0x02c9,
  8428. "fisheye",
  8429. 0x25c9,
  8430. "fitacyrillic",
  8431. 0x0473,
  8432. "five",
  8433. 0x0035,
  8434. "fivearabic",
  8435. 0x0665,
  8436. "fivebengali",
  8437. 0x09eb,
  8438. "fivecircle",
  8439. 0x2464,
  8440. "fivecircleinversesansserif",
  8441. 0x278e,
  8442. "fivedeva",
  8443. 0x096b,
  8444. "fiveeighths",
  8445. 0x215d,
  8446. "fivegujarati",
  8447. 0x0aeb,
  8448. "fivegurmukhi",
  8449. 0x0a6b,
  8450. "fivehackarabic",
  8451. 0x0665,
  8452. "fivehangzhou",
  8453. 0x3025,
  8454. "fiveideographicparen",
  8455. 0x3224,
  8456. "fiveinferior",
  8457. 0x2085,
  8458. "fivemonospace",
  8459. 0xff15,
  8460. "fiveoldstyle",
  8461. 0xf735,
  8462. "fiveparen",
  8463. 0x2478,
  8464. "fiveperiod",
  8465. 0x248c,
  8466. "fivepersian",
  8467. 0x06f5,
  8468. "fiveroman",
  8469. 0x2174,
  8470. "fivesuperior",
  8471. 0x2075,
  8472. "fivethai",
  8473. 0x0e55,
  8474. "fl",
  8475. 0xfb02,
  8476. "florin",
  8477. 0x0192,
  8478. "fmonospace",
  8479. 0xff46,
  8480. "fmsquare",
  8481. 0x3399,
  8482. "fofanthai",
  8483. 0x0e1f,
  8484. "fofathai",
  8485. 0x0e1d,
  8486. "fongmanthai",
  8487. 0x0e4f,
  8488. "forall",
  8489. 0x2200,
  8490. "four",
  8491. 0x0034,
  8492. "fourarabic",
  8493. 0x0664,
  8494. "fourbengali",
  8495. 0x09ea,
  8496. "fourcircle",
  8497. 0x2463,
  8498. "fourcircleinversesansserif",
  8499. 0x278d,
  8500. "fourdeva",
  8501. 0x096a,
  8502. "fourgujarati",
  8503. 0x0aea,
  8504. "fourgurmukhi",
  8505. 0x0a6a,
  8506. "fourhackarabic",
  8507. 0x0664,
  8508. "fourhangzhou",
  8509. 0x3024,
  8510. "fourideographicparen",
  8511. 0x3223,
  8512. "fourinferior",
  8513. 0x2084,
  8514. "fourmonospace",
  8515. 0xff14,
  8516. "fournumeratorbengali",
  8517. 0x09f7,
  8518. "fouroldstyle",
  8519. 0xf734,
  8520. "fourparen",
  8521. 0x2477,
  8522. "fourperiod",
  8523. 0x248b,
  8524. "fourpersian",
  8525. 0x06f4,
  8526. "fourroman",
  8527. 0x2173,
  8528. "foursuperior",
  8529. 0x2074,
  8530. "fourteencircle",
  8531. 0x246d,
  8532. "fourteenparen",
  8533. 0x2481,
  8534. "fourteenperiod",
  8535. 0x2495,
  8536. "fourthai",
  8537. 0x0e54,
  8538. "fourthtonechinese",
  8539. 0x02cb,
  8540. "fparen",
  8541. 0x24a1,
  8542. "fraction",
  8543. 0x2044,
  8544. "franc",
  8545. 0x20a3,
  8546. "g",
  8547. 0x0067,
  8548. "gabengali",
  8549. 0x0997,
  8550. "gacute",
  8551. 0x01f5,
  8552. "gadeva",
  8553. 0x0917,
  8554. "gafarabic",
  8555. 0x06af,
  8556. "gaffinalarabic",
  8557. 0xfb93,
  8558. "gafinitialarabic",
  8559. 0xfb94,
  8560. "gafmedialarabic",
  8561. 0xfb95,
  8562. "gagujarati",
  8563. 0x0a97,
  8564. "gagurmukhi",
  8565. 0x0a17,
  8566. "gahiragana",
  8567. 0x304c,
  8568. "gakatakana",
  8569. 0x30ac,
  8570. "gamma",
  8571. 0x03b3,
  8572. "gammalatinsmall",
  8573. 0x0263,
  8574. "gammasuperior",
  8575. 0x02e0,
  8576. "gangiacoptic",
  8577. 0x03eb,
  8578. "gbopomofo",
  8579. 0x310d,
  8580. "gbreve",
  8581. 0x011f,
  8582. "gcaron",
  8583. 0x01e7,
  8584. "gcedilla",
  8585. 0x0123,
  8586. "gcircle",
  8587. 0x24d6,
  8588. "gcircumflex",
  8589. 0x011d,
  8590. "gcommaaccent",
  8591. 0x0123,
  8592. "gdot",
  8593. 0x0121,
  8594. "gdotaccent",
  8595. 0x0121,
  8596. "gecyrillic",
  8597. 0x0433,
  8598. "gehiragana",
  8599. 0x3052,
  8600. "gekatakana",
  8601. 0x30b2,
  8602. "geometricallyequal",
  8603. 0x2251,
  8604. "gereshaccenthebrew",
  8605. 0x059c,
  8606. "gereshhebrew",
  8607. 0x05f3,
  8608. "gereshmuqdamhebrew",
  8609. 0x059d,
  8610. "germandbls",
  8611. 0x00df,
  8612. "gershayimaccenthebrew",
  8613. 0x059e,
  8614. "gershayimhebrew",
  8615. 0x05f4,
  8616. "getamark",
  8617. 0x3013,
  8618. "ghabengali",
  8619. 0x0998,
  8620. "ghadarmenian",
  8621. 0x0572,
  8622. "ghadeva",
  8623. 0x0918,
  8624. "ghagujarati",
  8625. 0x0a98,
  8626. "ghagurmukhi",
  8627. 0x0a18,
  8628. "ghainarabic",
  8629. 0x063a,
  8630. "ghainfinalarabic",
  8631. 0xfece,
  8632. "ghaininitialarabic",
  8633. 0xfecf,
  8634. "ghainmedialarabic",
  8635. 0xfed0,
  8636. "ghemiddlehookcyrillic",
  8637. 0x0495,
  8638. "ghestrokecyrillic",
  8639. 0x0493,
  8640. "gheupturncyrillic",
  8641. 0x0491,
  8642. "ghhadeva",
  8643. 0x095a,
  8644. "ghhagurmukhi",
  8645. 0x0a5a,
  8646. "ghook",
  8647. 0x0260,
  8648. "ghzsquare",
  8649. 0x3393,
  8650. "gihiragana",
  8651. 0x304e,
  8652. "gikatakana",
  8653. 0x30ae,
  8654. "gimarmenian",
  8655. 0x0563,
  8656. "gimel",
  8657. 0x05d2,
  8658. "gimeldagesh",
  8659. 0xfb32,
  8660. "gimeldageshhebrew",
  8661. 0xfb32,
  8662. "gimelhebrew",
  8663. 0x05d2,
  8664. "gjecyrillic",
  8665. 0x0453,
  8666. "glottalinvertedstroke",
  8667. 0x01be,
  8668. "glottalstop",
  8669. 0x0294,
  8670. "glottalstopinverted",
  8671. 0x0296,
  8672. "glottalstopmod",
  8673. 0x02c0,
  8674. "glottalstopreversed",
  8675. 0x0295,
  8676. "glottalstopreversedmod",
  8677. 0x02c1,
  8678. "glottalstopreversedsuperior",
  8679. 0x02e4,
  8680. "glottalstopstroke",
  8681. 0x02a1,
  8682. "glottalstopstrokereversed",
  8683. 0x02a2,
  8684. "gmacron",
  8685. 0x1e21,
  8686. "gmonospace",
  8687. 0xff47,
  8688. "gohiragana",
  8689. 0x3054,
  8690. "gokatakana",
  8691. 0x30b4,
  8692. "gparen",
  8693. 0x24a2,
  8694. "gpasquare",
  8695. 0x33ac,
  8696. "gradient",
  8697. 0x2207,
  8698. "grave",
  8699. 0x0060,
  8700. "gravebelowcmb",
  8701. 0x0316,
  8702. "gravecmb",
  8703. 0x0300,
  8704. "gravecomb",
  8705. 0x0300,
  8706. "gravedeva",
  8707. 0x0953,
  8708. "gravelowmod",
  8709. 0x02ce,
  8710. "gravemonospace",
  8711. 0xff40,
  8712. "gravetonecmb",
  8713. 0x0340,
  8714. "greater",
  8715. 0x003e,
  8716. "greaterequal",
  8717. 0x2265,
  8718. "greaterequalorless",
  8719. 0x22db,
  8720. "greatermonospace",
  8721. 0xff1e,
  8722. "greaterorequivalent",
  8723. 0x2273,
  8724. "greaterorless",
  8725. 0x2277,
  8726. "greateroverequal",
  8727. 0x2267,
  8728. "greatersmall",
  8729. 0xfe65,
  8730. "gscript",
  8731. 0x0261,
  8732. "gstroke",
  8733. 0x01e5,
  8734. "guhiragana",
  8735. 0x3050,
  8736. "guillemotleft",
  8737. 0x00ab,
  8738. "guillemotright",
  8739. 0x00bb,
  8740. "guilsinglleft",
  8741. 0x2039,
  8742. "guilsinglright",
  8743. 0x203a,
  8744. "gukatakana",
  8745. 0x30b0,
  8746. "guramusquare",
  8747. 0x3318,
  8748. "gysquare",
  8749. 0x33c9,
  8750. "h",
  8751. 0x0068,
  8752. "haabkhasiancyrillic",
  8753. 0x04a9,
  8754. "haaltonearabic",
  8755. 0x06c1,
  8756. "habengali",
  8757. 0x09b9,
  8758. "hadescendercyrillic",
  8759. 0x04b3,
  8760. "hadeva",
  8761. 0x0939,
  8762. "hagujarati",
  8763. 0x0ab9,
  8764. "hagurmukhi",
  8765. 0x0a39,
  8766. "haharabic",
  8767. 0x062d,
  8768. "hahfinalarabic",
  8769. 0xfea2,
  8770. "hahinitialarabic",
  8771. 0xfea3,
  8772. "hahiragana",
  8773. 0x306f,
  8774. "hahmedialarabic",
  8775. 0xfea4,
  8776. "haitusquare",
  8777. 0x332a,
  8778. "hakatakana",
  8779. 0x30cf,
  8780. "hakatakanahalfwidth",
  8781. 0xff8a,
  8782. "halantgurmukhi",
  8783. 0x0a4d,
  8784. "hamzaarabic",
  8785. 0x0621,
  8786. "hamzalowarabic",
  8787. 0x0621,
  8788. "hangulfiller",
  8789. 0x3164,
  8790. "hardsigncyrillic",
  8791. 0x044a,
  8792. "harpoonleftbarbup",
  8793. 0x21bc,
  8794. "harpoonrightbarbup",
  8795. 0x21c0,
  8796. "hasquare",
  8797. 0x33ca,
  8798. "hatafpatah",
  8799. 0x05b2,
  8800. "hatafpatah16",
  8801. 0x05b2,
  8802. "hatafpatah23",
  8803. 0x05b2,
  8804. "hatafpatah2f",
  8805. 0x05b2,
  8806. "hatafpatahhebrew",
  8807. 0x05b2,
  8808. "hatafpatahnarrowhebrew",
  8809. 0x05b2,
  8810. "hatafpatahquarterhebrew",
  8811. 0x05b2,
  8812. "hatafpatahwidehebrew",
  8813. 0x05b2,
  8814. "hatafqamats",
  8815. 0x05b3,
  8816. "hatafqamats1b",
  8817. 0x05b3,
  8818. "hatafqamats28",
  8819. 0x05b3,
  8820. "hatafqamats34",
  8821. 0x05b3,
  8822. "hatafqamatshebrew",
  8823. 0x05b3,
  8824. "hatafqamatsnarrowhebrew",
  8825. 0x05b3,
  8826. "hatafqamatsquarterhebrew",
  8827. 0x05b3,
  8828. "hatafqamatswidehebrew",
  8829. 0x05b3,
  8830. "hatafsegol",
  8831. 0x05b1,
  8832. "hatafsegol17",
  8833. 0x05b1,
  8834. "hatafsegol24",
  8835. 0x05b1,
  8836. "hatafsegol30",
  8837. 0x05b1,
  8838. "hatafsegolhebrew",
  8839. 0x05b1,
  8840. "hatafsegolnarrowhebrew",
  8841. 0x05b1,
  8842. "hatafsegolquarterhebrew",
  8843. 0x05b1,
  8844. "hatafsegolwidehebrew",
  8845. 0x05b1,
  8846. "hbar",
  8847. 0x0127,
  8848. "hbopomofo",
  8849. 0x310f,
  8850. "hbrevebelow",
  8851. 0x1e2b,
  8852. "hcedilla",
  8853. 0x1e29,
  8854. "hcircle",
  8855. 0x24d7,
  8856. "hcircumflex",
  8857. 0x0125,
  8858. "hdieresis",
  8859. 0x1e27,
  8860. "hdotaccent",
  8861. 0x1e23,
  8862. "hdotbelow",
  8863. 0x1e25,
  8864. "he",
  8865. 0x05d4,
  8866. "heart",
  8867. 0x2665,
  8868. "heartsuitblack",
  8869. 0x2665,
  8870. "heartsuitwhite",
  8871. 0x2661,
  8872. "hedagesh",
  8873. 0xfb34,
  8874. "hedageshhebrew",
  8875. 0xfb34,
  8876. "hehaltonearabic",
  8877. 0x06c1,
  8878. "heharabic",
  8879. 0x0647,
  8880. "hehebrew",
  8881. 0x05d4,
  8882. "hehfinalaltonearabic",
  8883. 0xfba7,
  8884. "hehfinalalttwoarabic",
  8885. 0xfeea,
  8886. "hehfinalarabic",
  8887. 0xfeea,
  8888. "hehhamzaabovefinalarabic",
  8889. 0xfba5,
  8890. "hehhamzaaboveisolatedarabic",
  8891. 0xfba4,
  8892. "hehinitialaltonearabic",
  8893. 0xfba8,
  8894. "hehinitialarabic",
  8895. 0xfeeb,
  8896. "hehiragana",
  8897. 0x3078,
  8898. "hehmedialaltonearabic",
  8899. 0xfba9,
  8900. "hehmedialarabic",
  8901. 0xfeec,
  8902. "heiseierasquare",
  8903. 0x337b,
  8904. "hekatakana",
  8905. 0x30d8,
  8906. "hekatakanahalfwidth",
  8907. 0xff8d,
  8908. "hekutaarusquare",
  8909. 0x3336,
  8910. "henghook",
  8911. 0x0267,
  8912. "herutusquare",
  8913. 0x3339,
  8914. "het",
  8915. 0x05d7,
  8916. "hethebrew",
  8917. 0x05d7,
  8918. "hhook",
  8919. 0x0266,
  8920. "hhooksuperior",
  8921. 0x02b1,
  8922. "hieuhacirclekorean",
  8923. 0x327b,
  8924. "hieuhaparenkorean",
  8925. 0x321b,
  8926. "hieuhcirclekorean",
  8927. 0x326d,
  8928. "hieuhkorean",
  8929. 0x314e,
  8930. "hieuhparenkorean",
  8931. 0x320d,
  8932. "hihiragana",
  8933. 0x3072,
  8934. "hikatakana",
  8935. 0x30d2,
  8936. "hikatakanahalfwidth",
  8937. 0xff8b,
  8938. "hiriq",
  8939. 0x05b4,
  8940. "hiriq14",
  8941. 0x05b4,
  8942. "hiriq21",
  8943. 0x05b4,
  8944. "hiriq2d",
  8945. 0x05b4,
  8946. "hiriqhebrew",
  8947. 0x05b4,
  8948. "hiriqnarrowhebrew",
  8949. 0x05b4,
  8950. "hiriqquarterhebrew",
  8951. 0x05b4,
  8952. "hiriqwidehebrew",
  8953. 0x05b4,
  8954. "hlinebelow",
  8955. 0x1e96,
  8956. "hmonospace",
  8957. 0xff48,
  8958. "hoarmenian",
  8959. 0x0570,
  8960. "hohipthai",
  8961. 0x0e2b,
  8962. "hohiragana",
  8963. 0x307b,
  8964. "hokatakana",
  8965. 0x30db,
  8966. "hokatakanahalfwidth",
  8967. 0xff8e,
  8968. "holam",
  8969. 0x05b9,
  8970. "holam19",
  8971. 0x05b9,
  8972. "holam26",
  8973. 0x05b9,
  8974. "holam32",
  8975. 0x05b9,
  8976. "holamhebrew",
  8977. 0x05b9,
  8978. "holamnarrowhebrew",
  8979. 0x05b9,
  8980. "holamquarterhebrew",
  8981. 0x05b9,
  8982. "holamwidehebrew",
  8983. 0x05b9,
  8984. "honokhukthai",
  8985. 0x0e2e,
  8986. "hookabovecomb",
  8987. 0x0309,
  8988. "hookcmb",
  8989. 0x0309,
  8990. "hookpalatalizedbelowcmb",
  8991. 0x0321,
  8992. "hookretroflexbelowcmb",
  8993. 0x0322,
  8994. "hoonsquare",
  8995. 0x3342,
  8996. "horicoptic",
  8997. 0x03e9,
  8998. "horizontalbar",
  8999. 0x2015,
  9000. "horncmb",
  9001. 0x031b,
  9002. "hotsprings",
  9003. 0x2668,
  9004. "house",
  9005. 0x2302,
  9006. "hparen",
  9007. 0x24a3,
  9008. "hsuperior",
  9009. 0x02b0,
  9010. "hturned",
  9011. 0x0265,
  9012. "huhiragana",
  9013. 0x3075,
  9014. "huiitosquare",
  9015. 0x3333,
  9016. "hukatakana",
  9017. 0x30d5,
  9018. "hukatakanahalfwidth",
  9019. 0xff8c,
  9020. "hungarumlaut",
  9021. 0x02dd,
  9022. "hungarumlautcmb",
  9023. 0x030b,
  9024. "hv",
  9025. 0x0195,
  9026. "hyphen",
  9027. 0x002d,
  9028. "hypheninferior",
  9029. 0xf6e5,
  9030. "hyphenmonospace",
  9031. 0xff0d,
  9032. "hyphensmall",
  9033. 0xfe63,
  9034. "hyphensuperior",
  9035. 0xf6e6,
  9036. "hyphentwo",
  9037. 0x2010,
  9038. "i",
  9039. 0x0069,
  9040. "iacute",
  9041. 0x00ed,
  9042. "iacyrillic",
  9043. 0x044f,
  9044. "ibengali",
  9045. 0x0987,
  9046. "ibopomofo",
  9047. 0x3127,
  9048. "ibreve",
  9049. 0x012d,
  9050. "icaron",
  9051. 0x01d0,
  9052. "icircle",
  9053. 0x24d8,
  9054. "icircumflex",
  9055. 0x00ee,
  9056. "icyrillic",
  9057. 0x0456,
  9058. "idblgrave",
  9059. 0x0209,
  9060. "ideographearthcircle",
  9061. 0x328f,
  9062. "ideographfirecircle",
  9063. 0x328b,
  9064. "ideographicallianceparen",
  9065. 0x323f,
  9066. "ideographiccallparen",
  9067. 0x323a,
  9068. "ideographiccentrecircle",
  9069. 0x32a5,
  9070. "ideographicclose",
  9071. 0x3006,
  9072. "ideographiccomma",
  9073. 0x3001,
  9074. "ideographiccommaleft",
  9075. 0xff64,
  9076. "ideographiccongratulationparen",
  9077. 0x3237,
  9078. "ideographiccorrectcircle",
  9079. 0x32a3,
  9080. "ideographicearthparen",
  9081. 0x322f,
  9082. "ideographicenterpriseparen",
  9083. 0x323d,
  9084. "ideographicexcellentcircle",
  9085. 0x329d,
  9086. "ideographicfestivalparen",
  9087. 0x3240,
  9088. "ideographicfinancialcircle",
  9089. 0x3296,
  9090. "ideographicfinancialparen",
  9091. 0x3236,
  9092. "ideographicfireparen",
  9093. 0x322b,
  9094. "ideographichaveparen",
  9095. 0x3232,
  9096. "ideographichighcircle",
  9097. 0x32a4,
  9098. "ideographiciterationmark",
  9099. 0x3005,
  9100. "ideographiclaborcircle",
  9101. 0x3298,
  9102. "ideographiclaborparen",
  9103. 0x3238,
  9104. "ideographicleftcircle",
  9105. 0x32a7,
  9106. "ideographiclowcircle",
  9107. 0x32a6,
  9108. "ideographicmedicinecircle",
  9109. 0x32a9,
  9110. "ideographicmetalparen",
  9111. 0x322e,
  9112. "ideographicmoonparen",
  9113. 0x322a,
  9114. "ideographicnameparen",
  9115. 0x3234,
  9116. "ideographicperiod",
  9117. 0x3002,
  9118. "ideographicprintcircle",
  9119. 0x329e,
  9120. "ideographicreachparen",
  9121. 0x3243,
  9122. "ideographicrepresentparen",
  9123. 0x3239,
  9124. "ideographicresourceparen",
  9125. 0x323e,
  9126. "ideographicrightcircle",
  9127. 0x32a8,
  9128. "ideographicsecretcircle",
  9129. 0x3299,
  9130. "ideographicselfparen",
  9131. 0x3242,
  9132. "ideographicsocietyparen",
  9133. 0x3233,
  9134. "ideographicspace",
  9135. 0x3000,
  9136. "ideographicspecialparen",
  9137. 0x3235,
  9138. "ideographicstockparen",
  9139. 0x3231,
  9140. "ideographicstudyparen",
  9141. 0x323b,
  9142. "ideographicsunparen",
  9143. 0x3230,
  9144. "ideographicsuperviseparen",
  9145. 0x323c,
  9146. "ideographicwaterparen",
  9147. 0x322c,
  9148. "ideographicwoodparen",
  9149. 0x322d,
  9150. "ideographiczero",
  9151. 0x3007,
  9152. "ideographmetalcircle",
  9153. 0x328e,
  9154. "ideographmooncircle",
  9155. 0x328a,
  9156. "ideographnamecircle",
  9157. 0x3294,
  9158. "ideographsuncircle",
  9159. 0x3290,
  9160. "ideographwatercircle",
  9161. 0x328c,
  9162. "ideographwoodcircle",
  9163. 0x328d,
  9164. "ideva",
  9165. 0x0907,
  9166. "idieresis",
  9167. 0x00ef,
  9168. "idieresisacute",
  9169. 0x1e2f,
  9170. "idieresiscyrillic",
  9171. 0x04e5,
  9172. "idotbelow",
  9173. 0x1ecb,
  9174. "iebrevecyrillic",
  9175. 0x04d7,
  9176. "iecyrillic",
  9177. 0x0435,
  9178. "ieungacirclekorean",
  9179. 0x3275,
  9180. "ieungaparenkorean",
  9181. 0x3215,
  9182. "ieungcirclekorean",
  9183. 0x3267,
  9184. "ieungkorean",
  9185. 0x3147,
  9186. "ieungparenkorean",
  9187. 0x3207,
  9188. "igrave",
  9189. 0x00ec,
  9190. "igujarati",
  9191. 0x0a87,
  9192. "igurmukhi",
  9193. 0x0a07,
  9194. "ihiragana",
  9195. 0x3044,
  9196. "ihookabove",
  9197. 0x1ec9,
  9198. "iibengali",
  9199. 0x0988,
  9200. "iicyrillic",
  9201. 0x0438,
  9202. "iideva",
  9203. 0x0908,
  9204. "iigujarati",
  9205. 0x0a88,
  9206. "iigurmukhi",
  9207. 0x0a08,
  9208. "iimatragurmukhi",
  9209. 0x0a40,
  9210. "iinvertedbreve",
  9211. 0x020b,
  9212. "iishortcyrillic",
  9213. 0x0439,
  9214. "iivowelsignbengali",
  9215. 0x09c0,
  9216. "iivowelsigndeva",
  9217. 0x0940,
  9218. "iivowelsigngujarati",
  9219. 0x0ac0,
  9220. "ij",
  9221. 0x0133,
  9222. "ikatakana",
  9223. 0x30a4,
  9224. "ikatakanahalfwidth",
  9225. 0xff72,
  9226. "ikorean",
  9227. 0x3163,
  9228. "ilde",
  9229. 0x02dc,
  9230. "iluyhebrew",
  9231. 0x05ac,
  9232. "imacron",
  9233. 0x012b,
  9234. "imacroncyrillic",
  9235. 0x04e3,
  9236. "imageorapproximatelyequal",
  9237. 0x2253,
  9238. "imatragurmukhi",
  9239. 0x0a3f,
  9240. "imonospace",
  9241. 0xff49,
  9242. "increment",
  9243. 0x2206,
  9244. "infinity",
  9245. 0x221e,
  9246. "iniarmenian",
  9247. 0x056b,
  9248. "integral",
  9249. 0x222b,
  9250. "integralbottom",
  9251. 0x2321,
  9252. "integralbt",
  9253. 0x2321,
  9254. "integralex",
  9255. 0xf8f5,
  9256. "integraltop",
  9257. 0x2320,
  9258. "integraltp",
  9259. 0x2320,
  9260. "intersection",
  9261. 0x2229,
  9262. "intisquare",
  9263. 0x3305,
  9264. "invbullet",
  9265. 0x25d8,
  9266. "invcircle",
  9267. 0x25d9,
  9268. "invsmileface",
  9269. 0x263b,
  9270. "iocyrillic",
  9271. 0x0451,
  9272. "iogonek",
  9273. 0x012f,
  9274. "iota",
  9275. 0x03b9,
  9276. "iotadieresis",
  9277. 0x03ca,
  9278. "iotadieresistonos",
  9279. 0x0390,
  9280. "iotalatin",
  9281. 0x0269,
  9282. "iotatonos",
  9283. 0x03af,
  9284. "iparen",
  9285. 0x24a4,
  9286. "irigurmukhi",
  9287. 0x0a72,
  9288. "ismallhiragana",
  9289. 0x3043,
  9290. "ismallkatakana",
  9291. 0x30a3,
  9292. "ismallkatakanahalfwidth",
  9293. 0xff68,
  9294. "issharbengali",
  9295. 0x09fa,
  9296. "istroke",
  9297. 0x0268,
  9298. "isuperior",
  9299. 0xf6ed,
  9300. "iterationhiragana",
  9301. 0x309d,
  9302. "iterationkatakana",
  9303. 0x30fd,
  9304. "itilde",
  9305. 0x0129,
  9306. "itildebelow",
  9307. 0x1e2d,
  9308. "iubopomofo",
  9309. 0x3129,
  9310. "iucyrillic",
  9311. 0x044e,
  9312. "ivowelsignbengali",
  9313. 0x09bf,
  9314. "ivowelsigndeva",
  9315. 0x093f,
  9316. "ivowelsigngujarati",
  9317. 0x0abf,
  9318. "izhitsacyrillic",
  9319. 0x0475,
  9320. "izhitsadblgravecyrillic",
  9321. 0x0477,
  9322. "j",
  9323. 0x006a,
  9324. "jaarmenian",
  9325. 0x0571,
  9326. "jabengali",
  9327. 0x099c,
  9328. "jadeva",
  9329. 0x091c,
  9330. "jagujarati",
  9331. 0x0a9c,
  9332. "jagurmukhi",
  9333. 0x0a1c,
  9334. "jbopomofo",
  9335. 0x3110,
  9336. "jcaron",
  9337. 0x01f0,
  9338. "jcircle",
  9339. 0x24d9,
  9340. "jcircumflex",
  9341. 0x0135,
  9342. "jcrossedtail",
  9343. 0x029d,
  9344. "jdotlessstroke",
  9345. 0x025f,
  9346. "jecyrillic",
  9347. 0x0458,
  9348. "jeemarabic",
  9349. 0x062c,
  9350. "jeemfinalarabic",
  9351. 0xfe9e,
  9352. "jeeminitialarabic",
  9353. 0xfe9f,
  9354. "jeemmedialarabic",
  9355. 0xfea0,
  9356. "jeharabic",
  9357. 0x0698,
  9358. "jehfinalarabic",
  9359. 0xfb8b,
  9360. "jhabengali",
  9361. 0x099d,
  9362. "jhadeva",
  9363. 0x091d,
  9364. "jhagujarati",
  9365. 0x0a9d,
  9366. "jhagurmukhi",
  9367. 0x0a1d,
  9368. "jheharmenian",
  9369. 0x057b,
  9370. "jis",
  9371. 0x3004,
  9372. "jmonospace",
  9373. 0xff4a,
  9374. "jparen",
  9375. 0x24a5,
  9376. "jsuperior",
  9377. 0x02b2,
  9378. "k",
  9379. 0x006b,
  9380. "kabashkircyrillic",
  9381. 0x04a1,
  9382. "kabengali",
  9383. 0x0995,
  9384. "kacute",
  9385. 0x1e31,
  9386. "kacyrillic",
  9387. 0x043a,
  9388. "kadescendercyrillic",
  9389. 0x049b,
  9390. "kadeva",
  9391. 0x0915,
  9392. "kaf",
  9393. 0x05db,
  9394. "kafarabic",
  9395. 0x0643,
  9396. "kafdagesh",
  9397. 0xfb3b,
  9398. "kafdageshhebrew",
  9399. 0xfb3b,
  9400. "kaffinalarabic",
  9401. 0xfeda,
  9402. "kafhebrew",
  9403. 0x05db,
  9404. "kafinitialarabic",
  9405. 0xfedb,
  9406. "kafmedialarabic",
  9407. 0xfedc,
  9408. "kafrafehebrew",
  9409. 0xfb4d,
  9410. "kagujarati",
  9411. 0x0a95,
  9412. "kagurmukhi",
  9413. 0x0a15,
  9414. "kahiragana",
  9415. 0x304b,
  9416. "kahookcyrillic",
  9417. 0x04c4,
  9418. "kakatakana",
  9419. 0x30ab,
  9420. "kakatakanahalfwidth",
  9421. 0xff76,
  9422. "kappa",
  9423. 0x03ba,
  9424. "kappasymbolgreek",
  9425. 0x03f0,
  9426. "kapyeounmieumkorean",
  9427. 0x3171,
  9428. "kapyeounphieuphkorean",
  9429. 0x3184,
  9430. "kapyeounpieupkorean",
  9431. 0x3178,
  9432. "kapyeounssangpieupkorean",
  9433. 0x3179,
  9434. "karoriisquare",
  9435. 0x330d,
  9436. "kashidaautoarabic",
  9437. 0x0640,
  9438. "kashidaautonosidebearingarabic",
  9439. 0x0640,
  9440. "kasmallkatakana",
  9441. 0x30f5,
  9442. "kasquare",
  9443. 0x3384,
  9444. "kasraarabic",
  9445. 0x0650,
  9446. "kasratanarabic",
  9447. 0x064d,
  9448. "kastrokecyrillic",
  9449. 0x049f,
  9450. "katahiraprolongmarkhalfwidth",
  9451. 0xff70,
  9452. "kaverticalstrokecyrillic",
  9453. 0x049d,
  9454. "kbopomofo",
  9455. 0x310e,
  9456. "kcalsquare",
  9457. 0x3389,
  9458. "kcaron",
  9459. 0x01e9,
  9460. "kcedilla",
  9461. 0x0137,
  9462. "kcircle",
  9463. 0x24da,
  9464. "kcommaaccent",
  9465. 0x0137,
  9466. "kdotbelow",
  9467. 0x1e33,
  9468. "keharmenian",
  9469. 0x0584,
  9470. "kehiragana",
  9471. 0x3051,
  9472. "kekatakana",
  9473. 0x30b1,
  9474. "kekatakanahalfwidth",
  9475. 0xff79,
  9476. "kenarmenian",
  9477. 0x056f,
  9478. "kesmallkatakana",
  9479. 0x30f6,
  9480. "kgreenlandic",
  9481. 0x0138,
  9482. "khabengali",
  9483. 0x0996,
  9484. "khacyrillic",
  9485. 0x0445,
  9486. "khadeva",
  9487. 0x0916,
  9488. "khagujarati",
  9489. 0x0a96,
  9490. "khagurmukhi",
  9491. 0x0a16,
  9492. "khaharabic",
  9493. 0x062e,
  9494. "khahfinalarabic",
  9495. 0xfea6,
  9496. "khahinitialarabic",
  9497. 0xfea7,
  9498. "khahmedialarabic",
  9499. 0xfea8,
  9500. "kheicoptic",
  9501. 0x03e7,
  9502. "khhadeva",
  9503. 0x0959,
  9504. "khhagurmukhi",
  9505. 0x0a59,
  9506. "khieukhacirclekorean",
  9507. 0x3278,
  9508. "khieukhaparenkorean",
  9509. 0x3218,
  9510. "khieukhcirclekorean",
  9511. 0x326a,
  9512. "khieukhkorean",
  9513. 0x314b,
  9514. "khieukhparenkorean",
  9515. 0x320a,
  9516. "khokhaithai",
  9517. 0x0e02,
  9518. "khokhonthai",
  9519. 0x0e05,
  9520. "khokhuatthai",
  9521. 0x0e03,
  9522. "khokhwaithai",
  9523. 0x0e04,
  9524. "khomutthai",
  9525. 0x0e5b,
  9526. "khook",
  9527. 0x0199,
  9528. "khorakhangthai",
  9529. 0x0e06,
  9530. "khzsquare",
  9531. 0x3391,
  9532. "kihiragana",
  9533. 0x304d,
  9534. "kikatakana",
  9535. 0x30ad,
  9536. "kikatakanahalfwidth",
  9537. 0xff77,
  9538. "kiroguramusquare",
  9539. 0x3315,
  9540. "kiromeetorusquare",
  9541. 0x3316,
  9542. "kirosquare",
  9543. 0x3314,
  9544. "kiyeokacirclekorean",
  9545. 0x326e,
  9546. "kiyeokaparenkorean",
  9547. 0x320e,
  9548. "kiyeokcirclekorean",
  9549. 0x3260,
  9550. "kiyeokkorean",
  9551. 0x3131,
  9552. "kiyeokparenkorean",
  9553. 0x3200,
  9554. "kiyeoksioskorean",
  9555. 0x3133,
  9556. "kjecyrillic",
  9557. 0x045c,
  9558. "klinebelow",
  9559. 0x1e35,
  9560. "klsquare",
  9561. 0x3398,
  9562. "kmcubedsquare",
  9563. 0x33a6,
  9564. "kmonospace",
  9565. 0xff4b,
  9566. "kmsquaredsquare",
  9567. 0x33a2,
  9568. "kohiragana",
  9569. 0x3053,
  9570. "kohmsquare",
  9571. 0x33c0,
  9572. "kokaithai",
  9573. 0x0e01,
  9574. "kokatakana",
  9575. 0x30b3,
  9576. "kokatakanahalfwidth",
  9577. 0xff7a,
  9578. "kooposquare",
  9579. 0x331e,
  9580. "koppacyrillic",
  9581. 0x0481,
  9582. "koreanstandardsymbol",
  9583. 0x327f,
  9584. "koroniscmb",
  9585. 0x0343,
  9586. "kparen",
  9587. 0x24a6,
  9588. "kpasquare",
  9589. 0x33aa,
  9590. "ksicyrillic",
  9591. 0x046f,
  9592. "ktsquare",
  9593. 0x33cf,
  9594. "kturned",
  9595. 0x029e,
  9596. "kuhiragana",
  9597. 0x304f,
  9598. "kukatakana",
  9599. 0x30af,
  9600. "kukatakanahalfwidth",
  9601. 0xff78,
  9602. "kvsquare",
  9603. 0x33b8,
  9604. "kwsquare",
  9605. 0x33be,
  9606. "l",
  9607. 0x006c,
  9608. "labengali",
  9609. 0x09b2,
  9610. "lacute",
  9611. 0x013a,
  9612. "ladeva",
  9613. 0x0932,
  9614. "lagujarati",
  9615. 0x0ab2,
  9616. "lagurmukhi",
  9617. 0x0a32,
  9618. "lakkhangyaothai",
  9619. 0x0e45,
  9620. "lamaleffinalarabic",
  9621. 0xfefc,
  9622. "lamalefhamzaabovefinalarabic",
  9623. 0xfef8,
  9624. "lamalefhamzaaboveisolatedarabic",
  9625. 0xfef7,
  9626. "lamalefhamzabelowfinalarabic",
  9627. 0xfefa,
  9628. "lamalefhamzabelowisolatedarabic",
  9629. 0xfef9,
  9630. "lamalefisolatedarabic",
  9631. 0xfefb,
  9632. "lamalefmaddaabovefinalarabic",
  9633. 0xfef6,
  9634. "lamalefmaddaaboveisolatedarabic",
  9635. 0xfef5,
  9636. "lamarabic",
  9637. 0x0644,
  9638. "lambda",
  9639. 0x03bb,
  9640. "lambdastroke",
  9641. 0x019b,
  9642. "lamed",
  9643. 0x05dc,
  9644. "lameddagesh",
  9645. 0xfb3c,
  9646. "lameddageshhebrew",
  9647. 0xfb3c,
  9648. "lamedhebrew",
  9649. 0x05dc,
  9650. "lamfinalarabic",
  9651. 0xfede,
  9652. "lamhahinitialarabic",
  9653. 0xfcca,
  9654. "laminitialarabic",
  9655. 0xfedf,
  9656. "lamjeeminitialarabic",
  9657. 0xfcc9,
  9658. "lamkhahinitialarabic",
  9659. 0xfccb,
  9660. "lamlamhehisolatedarabic",
  9661. 0xfdf2,
  9662. "lammedialarabic",
  9663. 0xfee0,
  9664. "lammeemhahinitialarabic",
  9665. 0xfd88,
  9666. "lammeeminitialarabic",
  9667. 0xfccc,
  9668. "largecircle",
  9669. 0x25ef,
  9670. "lbar",
  9671. 0x019a,
  9672. "lbelt",
  9673. 0x026c,
  9674. "lbopomofo",
  9675. 0x310c,
  9676. "lcaron",
  9677. 0x013e,
  9678. "lcedilla",
  9679. 0x013c,
  9680. "lcircle",
  9681. 0x24db,
  9682. "lcircumflexbelow",
  9683. 0x1e3d,
  9684. "lcommaaccent",
  9685. 0x013c,
  9686. "ldot",
  9687. 0x0140,
  9688. "ldotaccent",
  9689. 0x0140,
  9690. "ldotbelow",
  9691. 0x1e37,
  9692. "ldotbelowmacron",
  9693. 0x1e39,
  9694. "leftangleabovecmb",
  9695. 0x031a,
  9696. "lefttackbelowcmb",
  9697. 0x0318,
  9698. "less",
  9699. 0x003c,
  9700. "lessequal",
  9701. 0x2264,
  9702. "lessequalorgreater",
  9703. 0x22da,
  9704. "lessmonospace",
  9705. 0xff1c,
  9706. "lessorequivalent",
  9707. 0x2272,
  9708. "lessorgreater",
  9709. 0x2276,
  9710. "lessoverequal",
  9711. 0x2266,
  9712. "lesssmall",
  9713. 0xfe64,
  9714. "lezh",
  9715. 0x026e,
  9716. "lfblock",
  9717. 0x258c,
  9718. "lhookretroflex",
  9719. 0x026d,
  9720. "lira",
  9721. 0x20a4,
  9722. "liwnarmenian",
  9723. 0x056c,
  9724. "lj",
  9725. 0x01c9,
  9726. "ljecyrillic",
  9727. 0x0459,
  9728. "ll",
  9729. 0xf6c0,
  9730. "lladeva",
  9731. 0x0933,
  9732. "llagujarati",
  9733. 0x0ab3,
  9734. "llinebelow",
  9735. 0x1e3b,
  9736. "llladeva",
  9737. 0x0934,
  9738. "llvocalicbengali",
  9739. 0x09e1,
  9740. "llvocalicdeva",
  9741. 0x0961,
  9742. "llvocalicvowelsignbengali",
  9743. 0x09e3,
  9744. "llvocalicvowelsigndeva",
  9745. 0x0963,
  9746. "lmiddletilde",
  9747. 0x026b,
  9748. "lmonospace",
  9749. 0xff4c,
  9750. "lmsquare",
  9751. 0x33d0,
  9752. "lochulathai",
  9753. 0x0e2c,
  9754. "logicaland",
  9755. 0x2227,
  9756. "logicalnot",
  9757. 0x00ac,
  9758. "logicalnotreversed",
  9759. 0x2310,
  9760. "logicalor",
  9761. 0x2228,
  9762. "lolingthai",
  9763. 0x0e25,
  9764. "longs",
  9765. 0x017f,
  9766. "lowlinecenterline",
  9767. 0xfe4e,
  9768. "lowlinecmb",
  9769. 0x0332,
  9770. "lowlinedashed",
  9771. 0xfe4d,
  9772. "lozenge",
  9773. 0x25ca,
  9774. "lparen",
  9775. 0x24a7,
  9776. "lslash",
  9777. 0x0142,
  9778. "lsquare",
  9779. 0x2113,
  9780. "lsuperior",
  9781. 0xf6ee,
  9782. "ltshade",
  9783. 0x2591,
  9784. "luthai",
  9785. 0x0e26,
  9786. "lvocalicbengali",
  9787. 0x098c,
  9788. "lvocalicdeva",
  9789. 0x090c,
  9790. "lvocalicvowelsignbengali",
  9791. 0x09e2,
  9792. "lvocalicvowelsigndeva",
  9793. 0x0962,
  9794. "lxsquare",
  9795. 0x33d3,
  9796. "m",
  9797. 0x006d,
  9798. "mabengali",
  9799. 0x09ae,
  9800. "macron",
  9801. 0x00af,
  9802. "macronbelowcmb",
  9803. 0x0331,
  9804. "macroncmb",
  9805. 0x0304,
  9806. "macronlowmod",
  9807. 0x02cd,
  9808. "macronmonospace",
  9809. 0xffe3,
  9810. "macute",
  9811. 0x1e3f,
  9812. "madeva",
  9813. 0x092e,
  9814. "magujarati",
  9815. 0x0aae,
  9816. "magurmukhi",
  9817. 0x0a2e,
  9818. "mahapakhhebrew",
  9819. 0x05a4,
  9820. "mahapakhlefthebrew",
  9821. 0x05a4,
  9822. "mahiragana",
  9823. 0x307e,
  9824. "maichattawalowleftthai",
  9825. 0xf895,
  9826. "maichattawalowrightthai",
  9827. 0xf894,
  9828. "maichattawathai",
  9829. 0x0e4b,
  9830. "maichattawaupperleftthai",
  9831. 0xf893,
  9832. "maieklowleftthai",
  9833. 0xf88c,
  9834. "maieklowrightthai",
  9835. 0xf88b,
  9836. "maiekthai",
  9837. 0x0e48,
  9838. "maiekupperleftthai",
  9839. 0xf88a,
  9840. "maihanakatleftthai",
  9841. 0xf884,
  9842. "maihanakatthai",
  9843. 0x0e31,
  9844. "maitaikhuleftthai",
  9845. 0xf889,
  9846. "maitaikhuthai",
  9847. 0x0e47,
  9848. "maitholowleftthai",
  9849. 0xf88f,
  9850. "maitholowrightthai",
  9851. 0xf88e,
  9852. "maithothai",
  9853. 0x0e49,
  9854. "maithoupperleftthai",
  9855. 0xf88d,
  9856. "maitrilowleftthai",
  9857. 0xf892,
  9858. "maitrilowrightthai",
  9859. 0xf891,
  9860. "maitrithai",
  9861. 0x0e4a,
  9862. "maitriupperleftthai",
  9863. 0xf890,
  9864. "maiyamokthai",
  9865. 0x0e46,
  9866. "makatakana",
  9867. 0x30de,
  9868. "makatakanahalfwidth",
  9869. 0xff8f,
  9870. "male",
  9871. 0x2642,
  9872. "mansyonsquare",
  9873. 0x3347,
  9874. "maqafhebrew",
  9875. 0x05be,
  9876. "mars",
  9877. 0x2642,
  9878. "masoracirclehebrew",
  9879. 0x05af,
  9880. "masquare",
  9881. 0x3383,
  9882. "mbopomofo",
  9883. 0x3107,
  9884. "mbsquare",
  9885. 0x33d4,
  9886. "mcircle",
  9887. 0x24dc,
  9888. "mcubedsquare",
  9889. 0x33a5,
  9890. "mdotaccent",
  9891. 0x1e41,
  9892. "mdotbelow",
  9893. 0x1e43,
  9894. "meemarabic",
  9895. 0x0645,
  9896. "meemfinalarabic",
  9897. 0xfee2,
  9898. "meeminitialarabic",
  9899. 0xfee3,
  9900. "meemmedialarabic",
  9901. 0xfee4,
  9902. "meemmeeminitialarabic",
  9903. 0xfcd1,
  9904. "meemmeemisolatedarabic",
  9905. 0xfc48,
  9906. "meetorusquare",
  9907. 0x334d,
  9908. "mehiragana",
  9909. 0x3081,
  9910. "meizierasquare",
  9911. 0x337e,
  9912. "mekatakana",
  9913. 0x30e1,
  9914. "mekatakanahalfwidth",
  9915. 0xff92,
  9916. "mem",
  9917. 0x05de,
  9918. "memdagesh",
  9919. 0xfb3e,
  9920. "memdageshhebrew",
  9921. 0xfb3e,
  9922. "memhebrew",
  9923. 0x05de,
  9924. "menarmenian",
  9925. 0x0574,
  9926. "merkhahebrew",
  9927. 0x05a5,
  9928. "merkhakefulahebrew",
  9929. 0x05a6,
  9930. "merkhakefulalefthebrew",
  9931. 0x05a6,
  9932. "merkhalefthebrew",
  9933. 0x05a5,
  9934. "mhook",
  9935. 0x0271,
  9936. "mhzsquare",
  9937. 0x3392,
  9938. "middledotkatakanahalfwidth",
  9939. 0xff65,
  9940. "middot",
  9941. 0x00b7,
  9942. "mieumacirclekorean",
  9943. 0x3272,
  9944. "mieumaparenkorean",
  9945. 0x3212,
  9946. "mieumcirclekorean",
  9947. 0x3264,
  9948. "mieumkorean",
  9949. 0x3141,
  9950. "mieumpansioskorean",
  9951. 0x3170,
  9952. "mieumparenkorean",
  9953. 0x3204,
  9954. "mieumpieupkorean",
  9955. 0x316e,
  9956. "mieumsioskorean",
  9957. 0x316f,
  9958. "mihiragana",
  9959. 0x307f,
  9960. "mikatakana",
  9961. 0x30df,
  9962. "mikatakanahalfwidth",
  9963. 0xff90,
  9964. "minus",
  9965. 0x2212,
  9966. "minusbelowcmb",
  9967. 0x0320,
  9968. "minuscircle",
  9969. 0x2296,
  9970. "minusmod",
  9971. 0x02d7,
  9972. "minusplus",
  9973. 0x2213,
  9974. "minute",
  9975. 0x2032,
  9976. "miribaarusquare",
  9977. 0x334a,
  9978. "mirisquare",
  9979. 0x3349,
  9980. "mlonglegturned",
  9981. 0x0270,
  9982. "mlsquare",
  9983. 0x3396,
  9984. "mmcubedsquare",
  9985. 0x33a3,
  9986. "mmonospace",
  9987. 0xff4d,
  9988. "mmsquaredsquare",
  9989. 0x339f,
  9990. "mohiragana",
  9991. 0x3082,
  9992. "mohmsquare",
  9993. 0x33c1,
  9994. "mokatakana",
  9995. 0x30e2,
  9996. "mokatakanahalfwidth",
  9997. 0xff93,
  9998. "molsquare",
  9999. 0x33d6,
  10000. "momathai",
  10001. 0x0e21,
  10002. "moverssquare",
  10003. 0x33a7,
  10004. "moverssquaredsquare",
  10005. 0x33a8,
  10006. "mparen",
  10007. 0x24a8,
  10008. "mpasquare",
  10009. 0x33ab,
  10010. "mssquare",
  10011. 0x33b3,
  10012. "msuperior",
  10013. 0xf6ef,
  10014. "mturned",
  10015. 0x026f,
  10016. "mu",
  10017. 0x00b5,
  10018. "mu1",
  10019. 0x00b5,
  10020. "muasquare",
  10021. 0x3382,
  10022. "muchgreater",
  10023. 0x226b,
  10024. "muchless",
  10025. 0x226a,
  10026. "mufsquare",
  10027. 0x338c,
  10028. "mugreek",
  10029. 0x03bc,
  10030. "mugsquare",
  10031. 0x338d,
  10032. "muhiragana",
  10033. 0x3080,
  10034. "mukatakana",
  10035. 0x30e0,
  10036. "mukatakanahalfwidth",
  10037. 0xff91,
  10038. "mulsquare",
  10039. 0x3395,
  10040. "multiply",
  10041. 0x00d7,
  10042. "mumsquare",
  10043. 0x339b,
  10044. "munahhebrew",
  10045. 0x05a3,
  10046. "munahlefthebrew",
  10047. 0x05a3,
  10048. "musicalnote",
  10049. 0x266a,
  10050. "musicalnotedbl",
  10051. 0x266b,
  10052. "musicflatsign",
  10053. 0x266d,
  10054. "musicsharpsign",
  10055. 0x266f,
  10056. "mussquare",
  10057. 0x33b2,
  10058. "muvsquare",
  10059. 0x33b6,
  10060. "muwsquare",
  10061. 0x33bc,
  10062. "mvmegasquare",
  10063. 0x33b9,
  10064. "mvsquare",
  10065. 0x33b7,
  10066. "mwmegasquare",
  10067. 0x33bf,
  10068. "mwsquare",
  10069. 0x33bd,
  10070. "n",
  10071. 0x006e,
  10072. "nabengali",
  10073. 0x09a8,
  10074. "nabla",
  10075. 0x2207,
  10076. "nacute",
  10077. 0x0144,
  10078. "nadeva",
  10079. 0x0928,
  10080. "nagujarati",
  10081. 0x0aa8,
  10082. "nagurmukhi",
  10083. 0x0a28,
  10084. "nahiragana",
  10085. 0x306a,
  10086. "nakatakana",
  10087. 0x30ca,
  10088. "nakatakanahalfwidth",
  10089. 0xff85,
  10090. "napostrophe",
  10091. 0x0149,
  10092. "nasquare",
  10093. 0x3381,
  10094. "nbopomofo",
  10095. 0x310b,
  10096. "nbspace",
  10097. 0x00a0,
  10098. "ncaron",
  10099. 0x0148,
  10100. "ncedilla",
  10101. 0x0146,
  10102. "ncircle",
  10103. 0x24dd,
  10104. "ncircumflexbelow",
  10105. 0x1e4b,
  10106. "ncommaaccent",
  10107. 0x0146,
  10108. "ndotaccent",
  10109. 0x1e45,
  10110. "ndotbelow",
  10111. 0x1e47,
  10112. "nehiragana",
  10113. 0x306d,
  10114. "nekatakana",
  10115. 0x30cd,
  10116. "nekatakanahalfwidth",
  10117. 0xff88,
  10118. "newsheqelsign",
  10119. 0x20aa,
  10120. "nfsquare",
  10121. 0x338b,
  10122. "ngabengali",
  10123. 0x0999,
  10124. "ngadeva",
  10125. 0x0919,
  10126. "ngagujarati",
  10127. 0x0a99,
  10128. "ngagurmukhi",
  10129. 0x0a19,
  10130. "ngonguthai",
  10131. 0x0e07,
  10132. "nhiragana",
  10133. 0x3093,
  10134. "nhookleft",
  10135. 0x0272,
  10136. "nhookretroflex",
  10137. 0x0273,
  10138. "nieunacirclekorean",
  10139. 0x326f,
  10140. "nieunaparenkorean",
  10141. 0x320f,
  10142. "nieuncieuckorean",
  10143. 0x3135,
  10144. "nieuncirclekorean",
  10145. 0x3261,
  10146. "nieunhieuhkorean",
  10147. 0x3136,
  10148. "nieunkorean",
  10149. 0x3134,
  10150. "nieunpansioskorean",
  10151. 0x3168,
  10152. "nieunparenkorean",
  10153. 0x3201,
  10154. "nieunsioskorean",
  10155. 0x3167,
  10156. "nieuntikeutkorean",
  10157. 0x3166,
  10158. "nihiragana",
  10159. 0x306b,
  10160. "nikatakana",
  10161. 0x30cb,
  10162. "nikatakanahalfwidth",
  10163. 0xff86,
  10164. "nikhahitleftthai",
  10165. 0xf899,
  10166. "nikhahitthai",
  10167. 0x0e4d,
  10168. "nine",
  10169. 0x0039,
  10170. "ninearabic",
  10171. 0x0669,
  10172. "ninebengali",
  10173. 0x09ef,
  10174. "ninecircle",
  10175. 0x2468,
  10176. "ninecircleinversesansserif",
  10177. 0x2792,
  10178. "ninedeva",
  10179. 0x096f,
  10180. "ninegujarati",
  10181. 0x0aef,
  10182. "ninegurmukhi",
  10183. 0x0a6f,
  10184. "ninehackarabic",
  10185. 0x0669,
  10186. "ninehangzhou",
  10187. 0x3029,
  10188. "nineideographicparen",
  10189. 0x3228,
  10190. "nineinferior",
  10191. 0x2089,
  10192. "ninemonospace",
  10193. 0xff19,
  10194. "nineoldstyle",
  10195. 0xf739,
  10196. "nineparen",
  10197. 0x247c,
  10198. "nineperiod",
  10199. 0x2490,
  10200. "ninepersian",
  10201. 0x06f9,
  10202. "nineroman",
  10203. 0x2178,
  10204. "ninesuperior",
  10205. 0x2079,
  10206. "nineteencircle",
  10207. 0x2472,
  10208. "nineteenparen",
  10209. 0x2486,
  10210. "nineteenperiod",
  10211. 0x249a,
  10212. "ninethai",
  10213. 0x0e59,
  10214. "nj",
  10215. 0x01cc,
  10216. "njecyrillic",
  10217. 0x045a,
  10218. "nkatakana",
  10219. 0x30f3,
  10220. "nkatakanahalfwidth",
  10221. 0xff9d,
  10222. "nlegrightlong",
  10223. 0x019e,
  10224. "nlinebelow",
  10225. 0x1e49,
  10226. "nmonospace",
  10227. 0xff4e,
  10228. "nmsquare",
  10229. 0x339a,
  10230. "nnabengali",
  10231. 0x09a3,
  10232. "nnadeva",
  10233. 0x0923,
  10234. "nnagujarati",
  10235. 0x0aa3,
  10236. "nnagurmukhi",
  10237. 0x0a23,
  10238. "nnnadeva",
  10239. 0x0929,
  10240. "nohiragana",
  10241. 0x306e,
  10242. "nokatakana",
  10243. 0x30ce,
  10244. "nokatakanahalfwidth",
  10245. 0xff89,
  10246. "nonbreakingspace",
  10247. 0x00a0,
  10248. "nonenthai",
  10249. 0x0e13,
  10250. "nonuthai",
  10251. 0x0e19,
  10252. "noonarabic",
  10253. 0x0646,
  10254. "noonfinalarabic",
  10255. 0xfee6,
  10256. "noonghunnaarabic",
  10257. 0x06ba,
  10258. "noonghunnafinalarabic",
  10259. 0xfb9f,
  10260. "nooninitialarabic",
  10261. 0xfee7,
  10262. "noonjeeminitialarabic",
  10263. 0xfcd2,
  10264. "noonjeemisolatedarabic",
  10265. 0xfc4b,
  10266. "noonmedialarabic",
  10267. 0xfee8,
  10268. "noonmeeminitialarabic",
  10269. 0xfcd5,
  10270. "noonmeemisolatedarabic",
  10271. 0xfc4e,
  10272. "noonnoonfinalarabic",
  10273. 0xfc8d,
  10274. "notcontains",
  10275. 0x220c,
  10276. "notelement",
  10277. 0x2209,
  10278. "notelementof",
  10279. 0x2209,
  10280. "notequal",
  10281. 0x2260,
  10282. "notgreater",
  10283. 0x226f,
  10284. "notgreaternorequal",
  10285. 0x2271,
  10286. "notgreaternorless",
  10287. 0x2279,
  10288. "notidentical",
  10289. 0x2262,
  10290. "notless",
  10291. 0x226e,
  10292. "notlessnorequal",
  10293. 0x2270,
  10294. "notparallel",
  10295. 0x2226,
  10296. "notprecedes",
  10297. 0x2280,
  10298. "notsubset",
  10299. 0x2284,
  10300. "notsucceeds",
  10301. 0x2281,
  10302. "notsuperset",
  10303. 0x2285,
  10304. "nowarmenian",
  10305. 0x0576,
  10306. "nparen",
  10307. 0x24a9,
  10308. "nssquare",
  10309. 0x33b1,
  10310. "nsuperior",
  10311. 0x207f,
  10312. "ntilde",
  10313. 0x00f1,
  10314. "nu",
  10315. 0x03bd,
  10316. "nuhiragana",
  10317. 0x306c,
  10318. "nukatakana",
  10319. 0x30cc,
  10320. "nukatakanahalfwidth",
  10321. 0xff87,
  10322. "nuktabengali",
  10323. 0x09bc,
  10324. "nuktadeva",
  10325. 0x093c,
  10326. "nuktagujarati",
  10327. 0x0abc,
  10328. "nuktagurmukhi",
  10329. 0x0a3c,
  10330. "numbersign",
  10331. 0x0023,
  10332. "numbersignmonospace",
  10333. 0xff03,
  10334. "numbersignsmall",
  10335. 0xfe5f,
  10336. "numeralsigngreek",
  10337. 0x0374,
  10338. "numeralsignlowergreek",
  10339. 0x0375,
  10340. "numero",
  10341. 0x2116,
  10342. "nun",
  10343. 0x05e0,
  10344. "nundagesh",
  10345. 0xfb40,
  10346. "nundageshhebrew",
  10347. 0xfb40,
  10348. "nunhebrew",
  10349. 0x05e0,
  10350. "nvsquare",
  10351. 0x33b5,
  10352. "nwsquare",
  10353. 0x33bb,
  10354. "nyabengali",
  10355. 0x099e,
  10356. "nyadeva",
  10357. 0x091e,
  10358. "nyagujarati",
  10359. 0x0a9e,
  10360. "nyagurmukhi",
  10361. 0x0a1e,
  10362. "o",
  10363. 0x006f,
  10364. "oacute",
  10365. 0x00f3,
  10366. "oangthai",
  10367. 0x0e2d,
  10368. "obarred",
  10369. 0x0275,
  10370. "obarredcyrillic",
  10371. 0x04e9,
  10372. "obarreddieresiscyrillic",
  10373. 0x04eb,
  10374. "obengali",
  10375. 0x0993,
  10376. "obopomofo",
  10377. 0x311b,
  10378. "obreve",
  10379. 0x014f,
  10380. "ocandradeva",
  10381. 0x0911,
  10382. "ocandragujarati",
  10383. 0x0a91,
  10384. "ocandravowelsigndeva",
  10385. 0x0949,
  10386. "ocandravowelsigngujarati",
  10387. 0x0ac9,
  10388. "ocaron",
  10389. 0x01d2,
  10390. "ocircle",
  10391. 0x24de,
  10392. "ocircumflex",
  10393. 0x00f4,
  10394. "ocircumflexacute",
  10395. 0x1ed1,
  10396. "ocircumflexdotbelow",
  10397. 0x1ed9,
  10398. "ocircumflexgrave",
  10399. 0x1ed3,
  10400. "ocircumflexhookabove",
  10401. 0x1ed5,
  10402. "ocircumflextilde",
  10403. 0x1ed7,
  10404. "ocyrillic",
  10405. 0x043e,
  10406. "odblacute",
  10407. 0x0151,
  10408. "odblgrave",
  10409. 0x020d,
  10410. "odeva",
  10411. 0x0913,
  10412. "odieresis",
  10413. 0x00f6,
  10414. "odieresiscyrillic",
  10415. 0x04e7,
  10416. "odotbelow",
  10417. 0x1ecd,
  10418. "oe",
  10419. 0x0153,
  10420. "oekorean",
  10421. 0x315a,
  10422. "ogonek",
  10423. 0x02db,
  10424. "ogonekcmb",
  10425. 0x0328,
  10426. "ograve",
  10427. 0x00f2,
  10428. "ogujarati",
  10429. 0x0a93,
  10430. "oharmenian",
  10431. 0x0585,
  10432. "ohiragana",
  10433. 0x304a,
  10434. "ohookabove",
  10435. 0x1ecf,
  10436. "ohorn",
  10437. 0x01a1,
  10438. "ohornacute",
  10439. 0x1edb,
  10440. "ohorndotbelow",
  10441. 0x1ee3,
  10442. "ohorngrave",
  10443. 0x1edd,
  10444. "ohornhookabove",
  10445. 0x1edf,
  10446. "ohorntilde",
  10447. 0x1ee1,
  10448. "ohungarumlaut",
  10449. 0x0151,
  10450. "oi",
  10451. 0x01a3,
  10452. "oinvertedbreve",
  10453. 0x020f,
  10454. "okatakana",
  10455. 0x30aa,
  10456. "okatakanahalfwidth",
  10457. 0xff75,
  10458. "okorean",
  10459. 0x3157,
  10460. "olehebrew",
  10461. 0x05ab,
  10462. "omacron",
  10463. 0x014d,
  10464. "omacronacute",
  10465. 0x1e53,
  10466. "omacrongrave",
  10467. 0x1e51,
  10468. "omdeva",
  10469. 0x0950,
  10470. "omega",
  10471. 0x03c9,
  10472. "omega1",
  10473. 0x03d6,
  10474. "omegacyrillic",
  10475. 0x0461,
  10476. "omegalatinclosed",
  10477. 0x0277,
  10478. "omegaroundcyrillic",
  10479. 0x047b,
  10480. "omegatitlocyrillic",
  10481. 0x047d,
  10482. "omegatonos",
  10483. 0x03ce,
  10484. "omgujarati",
  10485. 0x0ad0,
  10486. "omicron",
  10487. 0x03bf,
  10488. "omicrontonos",
  10489. 0x03cc,
  10490. "omonospace",
  10491. 0xff4f,
  10492. "one",
  10493. 0x0031,
  10494. "onearabic",
  10495. 0x0661,
  10496. "onebengali",
  10497. 0x09e7,
  10498. "onecircle",
  10499. 0x2460,
  10500. "onecircleinversesansserif",
  10501. 0x278a,
  10502. "onedeva",
  10503. 0x0967,
  10504. "onedotenleader",
  10505. 0x2024,
  10506. "oneeighth",
  10507. 0x215b,
  10508. "onefitted",
  10509. 0xf6dc,
  10510. "onegujarati",
  10511. 0x0ae7,
  10512. "onegurmukhi",
  10513. 0x0a67,
  10514. "onehackarabic",
  10515. 0x0661,
  10516. "onehalf",
  10517. 0x00bd,
  10518. "onehangzhou",
  10519. 0x3021,
  10520. "oneideographicparen",
  10521. 0x3220,
  10522. "oneinferior",
  10523. 0x2081,
  10524. "onemonospace",
  10525. 0xff11,
  10526. "onenumeratorbengali",
  10527. 0x09f4,
  10528. "oneoldstyle",
  10529. 0xf731,
  10530. "oneparen",
  10531. 0x2474,
  10532. "oneperiod",
  10533. 0x2488,
  10534. "onepersian",
  10535. 0x06f1,
  10536. "onequarter",
  10537. 0x00bc,
  10538. "oneroman",
  10539. 0x2170,
  10540. "onesuperior",
  10541. 0x00b9,
  10542. "onethai",
  10543. 0x0e51,
  10544. "onethird",
  10545. 0x2153,
  10546. "oogonek",
  10547. 0x01eb,
  10548. "oogonekmacron",
  10549. 0x01ed,
  10550. "oogurmukhi",
  10551. 0x0a13,
  10552. "oomatragurmukhi",
  10553. 0x0a4b,
  10554. "oopen",
  10555. 0x0254,
  10556. "oparen",
  10557. 0x24aa,
  10558. "openbullet",
  10559. 0x25e6,
  10560. "option",
  10561. 0x2325,
  10562. "ordfeminine",
  10563. 0x00aa,
  10564. "ordmasculine",
  10565. 0x00ba,
  10566. "orthogonal",
  10567. 0x221f,
  10568. "oshortdeva",
  10569. 0x0912,
  10570. "oshortvowelsigndeva",
  10571. 0x094a,
  10572. "oslash",
  10573. 0x00f8,
  10574. "oslashacute",
  10575. 0x01ff,
  10576. "osmallhiragana",
  10577. 0x3049,
  10578. "osmallkatakana",
  10579. 0x30a9,
  10580. "osmallkatakanahalfwidth",
  10581. 0xff6b,
  10582. "ostrokeacute",
  10583. 0x01ff,
  10584. "osuperior",
  10585. 0xf6f0,
  10586. "otcyrillic",
  10587. 0x047f,
  10588. "otilde",
  10589. 0x00f5,
  10590. "otildeacute",
  10591. 0x1e4d,
  10592. "otildedieresis",
  10593. 0x1e4f,
  10594. "oubopomofo",
  10595. 0x3121,
  10596. "overline",
  10597. 0x203e,
  10598. "overlinecenterline",
  10599. 0xfe4a,
  10600. "overlinecmb",
  10601. 0x0305,
  10602. "overlinedashed",
  10603. 0xfe49,
  10604. "overlinedblwavy",
  10605. 0xfe4c,
  10606. "overlinewavy",
  10607. 0xfe4b,
  10608. "overscore",
  10609. 0x00af,
  10610. "ovowelsignbengali",
  10611. 0x09cb,
  10612. "ovowelsigndeva",
  10613. 0x094b,
  10614. "ovowelsigngujarati",
  10615. 0x0acb,
  10616. "p",
  10617. 0x0070,
  10618. "paampssquare",
  10619. 0x3380,
  10620. "paasentosquare",
  10621. 0x332b,
  10622. "pabengali",
  10623. 0x09aa,
  10624. "pacute",
  10625. 0x1e55,
  10626. "padeva",
  10627. 0x092a,
  10628. "pagedown",
  10629. 0x21df,
  10630. "pageup",
  10631. 0x21de,
  10632. "pagujarati",
  10633. 0x0aaa,
  10634. "pagurmukhi",
  10635. 0x0a2a,
  10636. "pahiragana",
  10637. 0x3071,
  10638. "paiyannoithai",
  10639. 0x0e2f,
  10640. "pakatakana",
  10641. 0x30d1,
  10642. "palatalizationcyrilliccmb",
  10643. 0x0484,
  10644. "palochkacyrillic",
  10645. 0x04c0,
  10646. "pansioskorean",
  10647. 0x317f,
  10648. "paragraph",
  10649. 0x00b6,
  10650. "parallel",
  10651. 0x2225,
  10652. "parenleft",
  10653. 0x0028,
  10654. "parenleftaltonearabic",
  10655. 0xfd3e,
  10656. "parenleftbt",
  10657. 0xf8ed,
  10658. "parenleftex",
  10659. 0xf8ec,
  10660. "parenleftinferior",
  10661. 0x208d,
  10662. "parenleftmonospace",
  10663. 0xff08,
  10664. "parenleftsmall",
  10665. 0xfe59,
  10666. "parenleftsuperior",
  10667. 0x207d,
  10668. "parenlefttp",
  10669. 0xf8eb,
  10670. "parenleftvertical",
  10671. 0xfe35,
  10672. "parenright",
  10673. 0x0029,
  10674. "parenrightaltonearabic",
  10675. 0xfd3f,
  10676. "parenrightbt",
  10677. 0xf8f8,
  10678. "parenrightex",
  10679. 0xf8f7,
  10680. "parenrightinferior",
  10681. 0x208e,
  10682. "parenrightmonospace",
  10683. 0xff09,
  10684. "parenrightsmall",
  10685. 0xfe5a,
  10686. "parenrightsuperior",
  10687. 0x207e,
  10688. "parenrighttp",
  10689. 0xf8f6,
  10690. "parenrightvertical",
  10691. 0xfe36,
  10692. "partialdiff",
  10693. 0x2202,
  10694. "paseqhebrew",
  10695. 0x05c0,
  10696. "pashtahebrew",
  10697. 0x0599,
  10698. "pasquare",
  10699. 0x33a9,
  10700. "patah",
  10701. 0x05b7,
  10702. "patah11",
  10703. 0x05b7,
  10704. "patah1d",
  10705. 0x05b7,
  10706. "patah2a",
  10707. 0x05b7,
  10708. "patahhebrew",
  10709. 0x05b7,
  10710. "patahnarrowhebrew",
  10711. 0x05b7,
  10712. "patahquarterhebrew",
  10713. 0x05b7,
  10714. "patahwidehebrew",
  10715. 0x05b7,
  10716. "pazerhebrew",
  10717. 0x05a1,
  10718. "pbopomofo",
  10719. 0x3106,
  10720. "pcircle",
  10721. 0x24df,
  10722. "pdotaccent",
  10723. 0x1e57,
  10724. "pe",
  10725. 0x05e4,
  10726. "pecyrillic",
  10727. 0x043f,
  10728. "pedagesh",
  10729. 0xfb44,
  10730. "pedageshhebrew",
  10731. 0xfb44,
  10732. "peezisquare",
  10733. 0x333b,
  10734. "pefinaldageshhebrew",
  10735. 0xfb43,
  10736. "peharabic",
  10737. 0x067e,
  10738. "peharmenian",
  10739. 0x057a,
  10740. "pehebrew",
  10741. 0x05e4,
  10742. "pehfinalarabic",
  10743. 0xfb57,
  10744. "pehinitialarabic",
  10745. 0xfb58,
  10746. "pehiragana",
  10747. 0x307a,
  10748. "pehmedialarabic",
  10749. 0xfb59,
  10750. "pekatakana",
  10751. 0x30da,
  10752. "pemiddlehookcyrillic",
  10753. 0x04a7,
  10754. "perafehebrew",
  10755. 0xfb4e,
  10756. "percent",
  10757. 0x0025,
  10758. "percentarabic",
  10759. 0x066a,
  10760. "percentmonospace",
  10761. 0xff05,
  10762. "percentsmall",
  10763. 0xfe6a,
  10764. "period",
  10765. 0x002e,
  10766. "periodarmenian",
  10767. 0x0589,
  10768. "periodcentered",
  10769. 0x00b7,
  10770. "periodhalfwidth",
  10771. 0xff61,
  10772. "periodinferior",
  10773. 0xf6e7,
  10774. "periodmonospace",
  10775. 0xff0e,
  10776. "periodsmall",
  10777. 0xfe52,
  10778. "periodsuperior",
  10779. 0xf6e8,
  10780. "perispomenigreekcmb",
  10781. 0x0342,
  10782. "perpendicular",
  10783. 0x22a5,
  10784. "perthousand",
  10785. 0x2030,
  10786. "peseta",
  10787. 0x20a7,
  10788. "pfsquare",
  10789. 0x338a,
  10790. "phabengali",
  10791. 0x09ab,
  10792. "phadeva",
  10793. 0x092b,
  10794. "phagujarati",
  10795. 0x0aab,
  10796. "phagurmukhi",
  10797. 0x0a2b,
  10798. "phi",
  10799. 0x03c6,
  10800. "phi1",
  10801. 0x03d5,
  10802. "phieuphacirclekorean",
  10803. 0x327a,
  10804. "phieuphaparenkorean",
  10805. 0x321a,
  10806. "phieuphcirclekorean",
  10807. 0x326c,
  10808. "phieuphkorean",
  10809. 0x314d,
  10810. "phieuphparenkorean",
  10811. 0x320c,
  10812. "philatin",
  10813. 0x0278,
  10814. "phinthuthai",
  10815. 0x0e3a,
  10816. "phisymbolgreek",
  10817. 0x03d5,
  10818. "phook",
  10819. 0x01a5,
  10820. "phophanthai",
  10821. 0x0e1e,
  10822. "phophungthai",
  10823. 0x0e1c,
  10824. "phosamphaothai",
  10825. 0x0e20,
  10826. "pi",
  10827. 0x03c0,
  10828. "pieupacirclekorean",
  10829. 0x3273,
  10830. "pieupaparenkorean",
  10831. 0x3213,
  10832. "pieupcieuckorean",
  10833. 0x3176,
  10834. "pieupcirclekorean",
  10835. 0x3265,
  10836. "pieupkiyeokkorean",
  10837. 0x3172,
  10838. "pieupkorean",
  10839. 0x3142,
  10840. "pieupparenkorean",
  10841. 0x3205,
  10842. "pieupsioskiyeokkorean",
  10843. 0x3174,
  10844. "pieupsioskorean",
  10845. 0x3144,
  10846. "pieupsiostikeutkorean",
  10847. 0x3175,
  10848. "pieupthieuthkorean",
  10849. 0x3177,
  10850. "pieuptikeutkorean",
  10851. 0x3173,
  10852. "pihiragana",
  10853. 0x3074,
  10854. "pikatakana",
  10855. 0x30d4,
  10856. "pisymbolgreek",
  10857. 0x03d6,
  10858. "piwrarmenian",
  10859. 0x0583,
  10860. "plus",
  10861. 0x002b,
  10862. "plusbelowcmb",
  10863. 0x031f,
  10864. "pluscircle",
  10865. 0x2295,
  10866. "plusminus",
  10867. 0x00b1,
  10868. "plusmod",
  10869. 0x02d6,
  10870. "plusmonospace",
  10871. 0xff0b,
  10872. "plussmall",
  10873. 0xfe62,
  10874. "plussuperior",
  10875. 0x207a,
  10876. "pmonospace",
  10877. 0xff50,
  10878. "pmsquare",
  10879. 0x33d8,
  10880. "pohiragana",
  10881. 0x307d,
  10882. "pointingindexdownwhite",
  10883. 0x261f,
  10884. "pointingindexleftwhite",
  10885. 0x261c,
  10886. "pointingindexrightwhite",
  10887. 0x261e,
  10888. "pointingindexupwhite",
  10889. 0x261d,
  10890. "pokatakana",
  10891. 0x30dd,
  10892. "poplathai",
  10893. 0x0e1b,
  10894. "postalmark",
  10895. 0x3012,
  10896. "postalmarkface",
  10897. 0x3020,
  10898. "pparen",
  10899. 0x24ab,
  10900. "precedes",
  10901. 0x227a,
  10902. "prescription",
  10903. 0x211e,
  10904. "primemod",
  10905. 0x02b9,
  10906. "primereversed",
  10907. 0x2035,
  10908. "product",
  10909. 0x220f,
  10910. "projective",
  10911. 0x2305,
  10912. "prolongedkana",
  10913. 0x30fc,
  10914. "propellor",
  10915. 0x2318,
  10916. "propersubset",
  10917. 0x2282,
  10918. "propersuperset",
  10919. 0x2283,
  10920. "proportion",
  10921. 0x2237,
  10922. "proportional",
  10923. 0x221d,
  10924. "psi",
  10925. 0x03c8,
  10926. "psicyrillic",
  10927. 0x0471,
  10928. "psilipneumatacyrilliccmb",
  10929. 0x0486,
  10930. "pssquare",
  10931. 0x33b0,
  10932. "puhiragana",
  10933. 0x3077,
  10934. "pukatakana",
  10935. 0x30d7,
  10936. "pvsquare",
  10937. 0x33b4,
  10938. "pwsquare",
  10939. 0x33ba,
  10940. "q",
  10941. 0x0071,
  10942. "qadeva",
  10943. 0x0958,
  10944. "qadmahebrew",
  10945. 0x05a8,
  10946. "qafarabic",
  10947. 0x0642,
  10948. "qaffinalarabic",
  10949. 0xfed6,
  10950. "qafinitialarabic",
  10951. 0xfed7,
  10952. "qafmedialarabic",
  10953. 0xfed8,
  10954. "qamats",
  10955. 0x05b8,
  10956. "qamats10",
  10957. 0x05b8,
  10958. "qamats1a",
  10959. 0x05b8,
  10960. "qamats1c",
  10961. 0x05b8,
  10962. "qamats27",
  10963. 0x05b8,
  10964. "qamats29",
  10965. 0x05b8,
  10966. "qamats33",
  10967. 0x05b8,
  10968. "qamatsde",
  10969. 0x05b8,
  10970. "qamatshebrew",
  10971. 0x05b8,
  10972. "qamatsnarrowhebrew",
  10973. 0x05b8,
  10974. "qamatsqatanhebrew",
  10975. 0x05b8,
  10976. "qamatsqatannarrowhebrew",
  10977. 0x05b8,
  10978. "qamatsqatanquarterhebrew",
  10979. 0x05b8,
  10980. "qamatsqatanwidehebrew",
  10981. 0x05b8,
  10982. "qamatsquarterhebrew",
  10983. 0x05b8,
  10984. "qamatswidehebrew",
  10985. 0x05b8,
  10986. "qarneyparahebrew",
  10987. 0x059f,
  10988. "qbopomofo",
  10989. 0x3111,
  10990. "qcircle",
  10991. 0x24e0,
  10992. "qhook",
  10993. 0x02a0,
  10994. "qmonospace",
  10995. 0xff51,
  10996. "qof",
  10997. 0x05e7,
  10998. "qofdagesh",
  10999. 0xfb47,
  11000. "qofdageshhebrew",
  11001. 0xfb47,
  11002. "qofhebrew",
  11003. 0x05e7,
  11004. "qparen",
  11005. 0x24ac,
  11006. "quarternote",
  11007. 0x2669,
  11008. "qubuts",
  11009. 0x05bb,
  11010. "qubuts18",
  11011. 0x05bb,
  11012. "qubuts25",
  11013. 0x05bb,
  11014. "qubuts31",
  11015. 0x05bb,
  11016. "qubutshebrew",
  11017. 0x05bb,
  11018. "qubutsnarrowhebrew",
  11019. 0x05bb,
  11020. "qubutsquarterhebrew",
  11021. 0x05bb,
  11022. "qubutswidehebrew",
  11023. 0x05bb,
  11024. "question",
  11025. 0x003f,
  11026. "questionarabic",
  11027. 0x061f,
  11028. "questionarmenian",
  11029. 0x055e,
  11030. "questiondown",
  11031. 0x00bf,
  11032. "questiondownsmall",
  11033. 0xf7bf,
  11034. "questiongreek",
  11035. 0x037e,
  11036. "questionmonospace",
  11037. 0xff1f,
  11038. "questionsmall",
  11039. 0xf73f,
  11040. "quotedbl",
  11041. 0x0022,
  11042. "quotedblbase",
  11043. 0x201e,
  11044. "quotedblleft",
  11045. 0x201c,
  11046. "quotedblmonospace",
  11047. 0xff02,
  11048. "quotedblprime",
  11049. 0x301e,
  11050. "quotedblprimereversed",
  11051. 0x301d,
  11052. "quotedblright",
  11053. 0x201d,
  11054. "quoteleft",
  11055. 0x2018,
  11056. "quoteleftreversed",
  11057. 0x201b,
  11058. "quotereversed",
  11059. 0x201b,
  11060. "quoteright",
  11061. 0x2019,
  11062. "quoterightn",
  11063. 0x0149,
  11064. "quotesinglbase",
  11065. 0x201a,
  11066. "quotesingle",
  11067. 0x0027,
  11068. "quotesinglemonospace",
  11069. 0xff07,
  11070. "r",
  11071. 0x0072,
  11072. "raarmenian",
  11073. 0x057c,
  11074. "rabengali",
  11075. 0x09b0,
  11076. "racute",
  11077. 0x0155,
  11078. "radeva",
  11079. 0x0930,
  11080. "radical",
  11081. 0x221a,
  11082. "radicalex",
  11083. 0xf8e5,
  11084. "radoverssquare",
  11085. 0x33ae,
  11086. "radoverssquaredsquare",
  11087. 0x33af,
  11088. "radsquare",
  11089. 0x33ad,
  11090. "rafe",
  11091. 0x05bf,
  11092. "rafehebrew",
  11093. 0x05bf,
  11094. "ragujarati",
  11095. 0x0ab0,
  11096. "ragurmukhi",
  11097. 0x0a30,
  11098. "rahiragana",
  11099. 0x3089,
  11100. "rakatakana",
  11101. 0x30e9,
  11102. "rakatakanahalfwidth",
  11103. 0xff97,
  11104. "ralowerdiagonalbengali",
  11105. 0x09f1,
  11106. "ramiddlediagonalbengali",
  11107. 0x09f0,
  11108. "ramshorn",
  11109. 0x0264,
  11110. "ratio",
  11111. 0x2236,
  11112. "rbopomofo",
  11113. 0x3116,
  11114. "rcaron",
  11115. 0x0159,
  11116. "rcedilla",
  11117. 0x0157,
  11118. "rcircle",
  11119. 0x24e1,
  11120. "rcommaaccent",
  11121. 0x0157,
  11122. "rdblgrave",
  11123. 0x0211,
  11124. "rdotaccent",
  11125. 0x1e59,
  11126. "rdotbelow",
  11127. 0x1e5b,
  11128. "rdotbelowmacron",
  11129. 0x1e5d,
  11130. "referencemark",
  11131. 0x203b,
  11132. "reflexsubset",
  11133. 0x2286,
  11134. "reflexsuperset",
  11135. 0x2287,
  11136. "registered",
  11137. 0x00ae,
  11138. "registersans",
  11139. 0xf8e8,
  11140. "registerserif",
  11141. 0xf6da,
  11142. "reharabic",
  11143. 0x0631,
  11144. "reharmenian",
  11145. 0x0580,
  11146. "rehfinalarabic",
  11147. 0xfeae,
  11148. "rehiragana",
  11149. 0x308c,
  11150. "rekatakana",
  11151. 0x30ec,
  11152. "rekatakanahalfwidth",
  11153. 0xff9a,
  11154. "resh",
  11155. 0x05e8,
  11156. "reshdageshhebrew",
  11157. 0xfb48,
  11158. "reshhebrew",
  11159. 0x05e8,
  11160. "reversedtilde",
  11161. 0x223d,
  11162. "reviahebrew",
  11163. 0x0597,
  11164. "reviamugrashhebrew",
  11165. 0x0597,
  11166. "revlogicalnot",
  11167. 0x2310,
  11168. "rfishhook",
  11169. 0x027e,
  11170. "rfishhookreversed",
  11171. 0x027f,
  11172. "rhabengali",
  11173. 0x09dd,
  11174. "rhadeva",
  11175. 0x095d,
  11176. "rho",
  11177. 0x03c1,
  11178. "rhook",
  11179. 0x027d,
  11180. "rhookturned",
  11181. 0x027b,
  11182. "rhookturnedsuperior",
  11183. 0x02b5,
  11184. "rhosymbolgreek",
  11185. 0x03f1,
  11186. "rhotichookmod",
  11187. 0x02de,
  11188. "rieulacirclekorean",
  11189. 0x3271,
  11190. "rieulaparenkorean",
  11191. 0x3211,
  11192. "rieulcirclekorean",
  11193. 0x3263,
  11194. "rieulhieuhkorean",
  11195. 0x3140,
  11196. "rieulkiyeokkorean",
  11197. 0x313a,
  11198. "rieulkiyeoksioskorean",
  11199. 0x3169,
  11200. "rieulkorean",
  11201. 0x3139,
  11202. "rieulmieumkorean",
  11203. 0x313b,
  11204. "rieulpansioskorean",
  11205. 0x316c,
  11206. "rieulparenkorean",
  11207. 0x3203,
  11208. "rieulphieuphkorean",
  11209. 0x313f,
  11210. "rieulpieupkorean",
  11211. 0x313c,
  11212. "rieulpieupsioskorean",
  11213. 0x316b,
  11214. "rieulsioskorean",
  11215. 0x313d,
  11216. "rieulthieuthkorean",
  11217. 0x313e,
  11218. "rieultikeutkorean",
  11219. 0x316a,
  11220. "rieulyeorinhieuhkorean",
  11221. 0x316d,
  11222. "rightangle",
  11223. 0x221f,
  11224. "righttackbelowcmb",
  11225. 0x0319,
  11226. "righttriangle",
  11227. 0x22bf,
  11228. "rihiragana",
  11229. 0x308a,
  11230. "rikatakana",
  11231. 0x30ea,
  11232. "rikatakanahalfwidth",
  11233. 0xff98,
  11234. "ring",
  11235. 0x02da,
  11236. "ringbelowcmb",
  11237. 0x0325,
  11238. "ringcmb",
  11239. 0x030a,
  11240. "ringhalfleft",
  11241. 0x02bf,
  11242. "ringhalfleftarmenian",
  11243. 0x0559,
  11244. "ringhalfleftbelowcmb",
  11245. 0x031c,
  11246. "ringhalfleftcentered",
  11247. 0x02d3,
  11248. "ringhalfright",
  11249. 0x02be,
  11250. "ringhalfrightbelowcmb",
  11251. 0x0339,
  11252. "ringhalfrightcentered",
  11253. 0x02d2,
  11254. "rinvertedbreve",
  11255. 0x0213,
  11256. "rittorusquare",
  11257. 0x3351,
  11258. "rlinebelow",
  11259. 0x1e5f,
  11260. "rlongleg",
  11261. 0x027c,
  11262. "rlonglegturned",
  11263. 0x027a,
  11264. "rmonospace",
  11265. 0xff52,
  11266. "rohiragana",
  11267. 0x308d,
  11268. "rokatakana",
  11269. 0x30ed,
  11270. "rokatakanahalfwidth",
  11271. 0xff9b,
  11272. "roruathai",
  11273. 0x0e23,
  11274. "rparen",
  11275. 0x24ad,
  11276. "rrabengali",
  11277. 0x09dc,
  11278. "rradeva",
  11279. 0x0931,
  11280. "rragurmukhi",
  11281. 0x0a5c,
  11282. "rreharabic",
  11283. 0x0691,
  11284. "rrehfinalarabic",
  11285. 0xfb8d,
  11286. "rrvocalicbengali",
  11287. 0x09e0,
  11288. "rrvocalicdeva",
  11289. 0x0960,
  11290. "rrvocalicgujarati",
  11291. 0x0ae0,
  11292. "rrvocalicvowelsignbengali",
  11293. 0x09c4,
  11294. "rrvocalicvowelsigndeva",
  11295. 0x0944,
  11296. "rrvocalicvowelsigngujarati",
  11297. 0x0ac4,
  11298. "rsuperior",
  11299. 0xf6f1,
  11300. "rtblock",
  11301. 0x2590,
  11302. "rturned",
  11303. 0x0279,
  11304. "rturnedsuperior",
  11305. 0x02b4,
  11306. "ruhiragana",
  11307. 0x308b,
  11308. "rukatakana",
  11309. 0x30eb,
  11310. "rukatakanahalfwidth",
  11311. 0xff99,
  11312. "rupeemarkbengali",
  11313. 0x09f2,
  11314. "rupeesignbengali",
  11315. 0x09f3,
  11316. "rupiah",
  11317. 0xf6dd,
  11318. "ruthai",
  11319. 0x0e24,
  11320. "rvocalicbengali",
  11321. 0x098b,
  11322. "rvocalicdeva",
  11323. 0x090b,
  11324. "rvocalicgujarati",
  11325. 0x0a8b,
  11326. "rvocalicvowelsignbengali",
  11327. 0x09c3,
  11328. "rvocalicvowelsigndeva",
  11329. 0x0943,
  11330. "rvocalicvowelsigngujarati",
  11331. 0x0ac3,
  11332. "s",
  11333. 0x0073,
  11334. "sabengali",
  11335. 0x09b8,
  11336. "sacute",
  11337. 0x015b,
  11338. "sacutedotaccent",
  11339. 0x1e65,
  11340. "sadarabic",
  11341. 0x0635,
  11342. "sadeva",
  11343. 0x0938,
  11344. "sadfinalarabic",
  11345. 0xfeba,
  11346. "sadinitialarabic",
  11347. 0xfebb,
  11348. "sadmedialarabic",
  11349. 0xfebc,
  11350. "sagujarati",
  11351. 0x0ab8,
  11352. "sagurmukhi",
  11353. 0x0a38,
  11354. "sahiragana",
  11355. 0x3055,
  11356. "sakatakana",
  11357. 0x30b5,
  11358. "sakatakanahalfwidth",
  11359. 0xff7b,
  11360. "sallallahoualayhewasallamarabic",
  11361. 0xfdfa,
  11362. "samekh",
  11363. 0x05e1,
  11364. "samekhdagesh",
  11365. 0xfb41,
  11366. "samekhdageshhebrew",
  11367. 0xfb41,
  11368. "samekhhebrew",
  11369. 0x05e1,
  11370. "saraaathai",
  11371. 0x0e32,
  11372. "saraaethai",
  11373. 0x0e41,
  11374. "saraaimaimalaithai",
  11375. 0x0e44,
  11376. "saraaimaimuanthai",
  11377. 0x0e43,
  11378. "saraamthai",
  11379. 0x0e33,
  11380. "saraathai",
  11381. 0x0e30,
  11382. "saraethai",
  11383. 0x0e40,
  11384. "saraiileftthai",
  11385. 0xf886,
  11386. "saraiithai",
  11387. 0x0e35,
  11388. "saraileftthai",
  11389. 0xf885,
  11390. "saraithai",
  11391. 0x0e34,
  11392. "saraothai",
  11393. 0x0e42,
  11394. "saraueeleftthai",
  11395. 0xf888,
  11396. "saraueethai",
  11397. 0x0e37,
  11398. "saraueleftthai",
  11399. 0xf887,
  11400. "sarauethai",
  11401. 0x0e36,
  11402. "sarauthai",
  11403. 0x0e38,
  11404. "sarauuthai",
  11405. 0x0e39,
  11406. "sbopomofo",
  11407. 0x3119,
  11408. "scaron",
  11409. 0x0161,
  11410. "scarondotaccent",
  11411. 0x1e67,
  11412. "scedilla",
  11413. 0x015f,
  11414. "schwa",
  11415. 0x0259,
  11416. "schwacyrillic",
  11417. 0x04d9,
  11418. "schwadieresiscyrillic",
  11419. 0x04db,
  11420. "schwahook",
  11421. 0x025a,
  11422. "scircle",
  11423. 0x24e2,
  11424. "scircumflex",
  11425. 0x015d,
  11426. "scommaaccent",
  11427. 0x0219,
  11428. "sdotaccent",
  11429. 0x1e61,
  11430. "sdotbelow",
  11431. 0x1e63,
  11432. "sdotbelowdotaccent",
  11433. 0x1e69,
  11434. "seagullbelowcmb",
  11435. 0x033c,
  11436. "second",
  11437. 0x2033,
  11438. "secondtonechinese",
  11439. 0x02ca,
  11440. "section",
  11441. 0x00a7,
  11442. "seenarabic",
  11443. 0x0633,
  11444. "seenfinalarabic",
  11445. 0xfeb2,
  11446. "seeninitialarabic",
  11447. 0xfeb3,
  11448. "seenmedialarabic",
  11449. 0xfeb4,
  11450. "segol",
  11451. 0x05b6,
  11452. "segol13",
  11453. 0x05b6,
  11454. "segol1f",
  11455. 0x05b6,
  11456. "segol2c",
  11457. 0x05b6,
  11458. "segolhebrew",
  11459. 0x05b6,
  11460. "segolnarrowhebrew",
  11461. 0x05b6,
  11462. "segolquarterhebrew",
  11463. 0x05b6,
  11464. "segoltahebrew",
  11465. 0x0592,
  11466. "segolwidehebrew",
  11467. 0x05b6,
  11468. "seharmenian",
  11469. 0x057d,
  11470. "sehiragana",
  11471. 0x305b,
  11472. "sekatakana",
  11473. 0x30bb,
  11474. "sekatakanahalfwidth",
  11475. 0xff7e,
  11476. "semicolon",
  11477. 0x003b,
  11478. "semicolonarabic",
  11479. 0x061b,
  11480. "semicolonmonospace",
  11481. 0xff1b,
  11482. "semicolonsmall",
  11483. 0xfe54,
  11484. "semivoicedmarkkana",
  11485. 0x309c,
  11486. "semivoicedmarkkanahalfwidth",
  11487. 0xff9f,
  11488. "sentisquare",
  11489. 0x3322,
  11490. "sentosquare",
  11491. 0x3323,
  11492. "seven",
  11493. 0x0037,
  11494. "sevenarabic",
  11495. 0x0667,
  11496. "sevenbengali",
  11497. 0x09ed,
  11498. "sevencircle",
  11499. 0x2466,
  11500. "sevencircleinversesansserif",
  11501. 0x2790,
  11502. "sevendeva",
  11503. 0x096d,
  11504. "seveneighths",
  11505. 0x215e,
  11506. "sevengujarati",
  11507. 0x0aed,
  11508. "sevengurmukhi",
  11509. 0x0a6d,
  11510. "sevenhackarabic",
  11511. 0x0667,
  11512. "sevenhangzhou",
  11513. 0x3027,
  11514. "sevenideographicparen",
  11515. 0x3226,
  11516. "seveninferior",
  11517. 0x2087,
  11518. "sevenmonospace",
  11519. 0xff17,
  11520. "sevenoldstyle",
  11521. 0xf737,
  11522. "sevenparen",
  11523. 0x247a,
  11524. "sevenperiod",
  11525. 0x248e,
  11526. "sevenpersian",
  11527. 0x06f7,
  11528. "sevenroman",
  11529. 0x2176,
  11530. "sevensuperior",
  11531. 0x2077,
  11532. "seventeencircle",
  11533. 0x2470,
  11534. "seventeenparen",
  11535. 0x2484,
  11536. "seventeenperiod",
  11537. 0x2498,
  11538. "seventhai",
  11539. 0x0e57,
  11540. "sfthyphen",
  11541. 0x00ad,
  11542. "shaarmenian",
  11543. 0x0577,
  11544. "shabengali",
  11545. 0x09b6,
  11546. "shacyrillic",
  11547. 0x0448,
  11548. "shaddaarabic",
  11549. 0x0651,
  11550. "shaddadammaarabic",
  11551. 0xfc61,
  11552. "shaddadammatanarabic",
  11553. 0xfc5e,
  11554. "shaddafathaarabic",
  11555. 0xfc60,
  11556. "shaddakasraarabic",
  11557. 0xfc62,
  11558. "shaddakasratanarabic",
  11559. 0xfc5f,
  11560. "shade",
  11561. 0x2592,
  11562. "shadedark",
  11563. 0x2593,
  11564. "shadelight",
  11565. 0x2591,
  11566. "shademedium",
  11567. 0x2592,
  11568. "shadeva",
  11569. 0x0936,
  11570. "shagujarati",
  11571. 0x0ab6,
  11572. "shagurmukhi",
  11573. 0x0a36,
  11574. "shalshelethebrew",
  11575. 0x0593,
  11576. "shbopomofo",
  11577. 0x3115,
  11578. "shchacyrillic",
  11579. 0x0449,
  11580. "sheenarabic",
  11581. 0x0634,
  11582. "sheenfinalarabic",
  11583. 0xfeb6,
  11584. "sheeninitialarabic",
  11585. 0xfeb7,
  11586. "sheenmedialarabic",
  11587. 0xfeb8,
  11588. "sheicoptic",
  11589. 0x03e3,
  11590. "sheqel",
  11591. 0x20aa,
  11592. "sheqelhebrew",
  11593. 0x20aa,
  11594. "sheva",
  11595. 0x05b0,
  11596. "sheva115",
  11597. 0x05b0,
  11598. "sheva15",
  11599. 0x05b0,
  11600. "sheva22",
  11601. 0x05b0,
  11602. "sheva2e",
  11603. 0x05b0,
  11604. "shevahebrew",
  11605. 0x05b0,
  11606. "shevanarrowhebrew",
  11607. 0x05b0,
  11608. "shevaquarterhebrew",
  11609. 0x05b0,
  11610. "shevawidehebrew",
  11611. 0x05b0,
  11612. "shhacyrillic",
  11613. 0x04bb,
  11614. "shimacoptic",
  11615. 0x03ed,
  11616. "shin",
  11617. 0x05e9,
  11618. "shindagesh",
  11619. 0xfb49,
  11620. "shindageshhebrew",
  11621. 0xfb49,
  11622. "shindageshshindot",
  11623. 0xfb2c,
  11624. "shindageshshindothebrew",
  11625. 0xfb2c,
  11626. "shindageshsindot",
  11627. 0xfb2d,
  11628. "shindageshsindothebrew",
  11629. 0xfb2d,
  11630. "shindothebrew",
  11631. 0x05c1,
  11632. "shinhebrew",
  11633. 0x05e9,
  11634. "shinshindot",
  11635. 0xfb2a,
  11636. "shinshindothebrew",
  11637. 0xfb2a,
  11638. "shinsindot",
  11639. 0xfb2b,
  11640. "shinsindothebrew",
  11641. 0xfb2b,
  11642. "shook",
  11643. 0x0282,
  11644. "sigma",
  11645. 0x03c3,
  11646. "sigma1",
  11647. 0x03c2,
  11648. "sigmafinal",
  11649. 0x03c2,
  11650. "sigmalunatesymbolgreek",
  11651. 0x03f2,
  11652. "sihiragana",
  11653. 0x3057,
  11654. "sikatakana",
  11655. 0x30b7,
  11656. "sikatakanahalfwidth",
  11657. 0xff7c,
  11658. "siluqhebrew",
  11659. 0x05bd,
  11660. "siluqlefthebrew",
  11661. 0x05bd,
  11662. "similar",
  11663. 0x223c,
  11664. "sindothebrew",
  11665. 0x05c2,
  11666. "siosacirclekorean",
  11667. 0x3274,
  11668. "siosaparenkorean",
  11669. 0x3214,
  11670. "sioscieuckorean",
  11671. 0x317e,
  11672. "sioscirclekorean",
  11673. 0x3266,
  11674. "sioskiyeokkorean",
  11675. 0x317a,
  11676. "sioskorean",
  11677. 0x3145,
  11678. "siosnieunkorean",
  11679. 0x317b,
  11680. "siosparenkorean",
  11681. 0x3206,
  11682. "siospieupkorean",
  11683. 0x317d,
  11684. "siostikeutkorean",
  11685. 0x317c,
  11686. "six",
  11687. 0x0036,
  11688. "sixarabic",
  11689. 0x0666,
  11690. "sixbengali",
  11691. 0x09ec,
  11692. "sixcircle",
  11693. 0x2465,
  11694. "sixcircleinversesansserif",
  11695. 0x278f,
  11696. "sixdeva",
  11697. 0x096c,
  11698. "sixgujarati",
  11699. 0x0aec,
  11700. "sixgurmukhi",
  11701. 0x0a6c,
  11702. "sixhackarabic",
  11703. 0x0666,
  11704. "sixhangzhou",
  11705. 0x3026,
  11706. "sixideographicparen",
  11707. 0x3225,
  11708. "sixinferior",
  11709. 0x2086,
  11710. "sixmonospace",
  11711. 0xff16,
  11712. "sixoldstyle",
  11713. 0xf736,
  11714. "sixparen",
  11715. 0x2479,
  11716. "sixperiod",
  11717. 0x248d,
  11718. "sixpersian",
  11719. 0x06f6,
  11720. "sixroman",
  11721. 0x2175,
  11722. "sixsuperior",
  11723. 0x2076,
  11724. "sixteencircle",
  11725. 0x246f,
  11726. "sixteencurrencydenominatorbengali",
  11727. 0x09f9,
  11728. "sixteenparen",
  11729. 0x2483,
  11730. "sixteenperiod",
  11731. 0x2497,
  11732. "sixthai",
  11733. 0x0e56,
  11734. "slash",
  11735. 0x002f,
  11736. "slashmonospace",
  11737. 0xff0f,
  11738. "slong",
  11739. 0x017f,
  11740. "slongdotaccent",
  11741. 0x1e9b,
  11742. "smileface",
  11743. 0x263a,
  11744. "smonospace",
  11745. 0xff53,
  11746. "sofpasuqhebrew",
  11747. 0x05c3,
  11748. "softhyphen",
  11749. 0x00ad,
  11750. "softsigncyrillic",
  11751. 0x044c,
  11752. "sohiragana",
  11753. 0x305d,
  11754. "sokatakana",
  11755. 0x30bd,
  11756. "sokatakanahalfwidth",
  11757. 0xff7f,
  11758. "soliduslongoverlaycmb",
  11759. 0x0338,
  11760. "solidusshortoverlaycmb",
  11761. 0x0337,
  11762. "sorusithai",
  11763. 0x0e29,
  11764. "sosalathai",
  11765. 0x0e28,
  11766. "sosothai",
  11767. 0x0e0b,
  11768. "sosuathai",
  11769. 0x0e2a,
  11770. "space",
  11771. 0x0020,
  11772. "spacehackarabic",
  11773. 0x0020,
  11774. "spade",
  11775. 0x2660,
  11776. "spadesuitblack",
  11777. 0x2660,
  11778. "spadesuitwhite",
  11779. 0x2664,
  11780. "sparen",
  11781. 0x24ae,
  11782. "squarebelowcmb",
  11783. 0x033b,
  11784. "squarecc",
  11785. 0x33c4,
  11786. "squarecm",
  11787. 0x339d,
  11788. "squarediagonalcrosshatchfill",
  11789. 0x25a9,
  11790. "squarehorizontalfill",
  11791. 0x25a4,
  11792. "squarekg",
  11793. 0x338f,
  11794. "squarekm",
  11795. 0x339e,
  11796. "squarekmcapital",
  11797. 0x33ce,
  11798. "squareln",
  11799. 0x33d1,
  11800. "squarelog",
  11801. 0x33d2,
  11802. "squaremg",
  11803. 0x338e,
  11804. "squaremil",
  11805. 0x33d5,
  11806. "squaremm",
  11807. 0x339c,
  11808. "squaremsquared",
  11809. 0x33a1,
  11810. "squareorthogonalcrosshatchfill",
  11811. 0x25a6,
  11812. "squareupperlefttolowerrightfill",
  11813. 0x25a7,
  11814. "squareupperrighttolowerleftfill",
  11815. 0x25a8,
  11816. "squareverticalfill",
  11817. 0x25a5,
  11818. "squarewhitewithsmallblack",
  11819. 0x25a3,
  11820. "srsquare",
  11821. 0x33db,
  11822. "ssabengali",
  11823. 0x09b7,
  11824. "ssadeva",
  11825. 0x0937,
  11826. "ssagujarati",
  11827. 0x0ab7,
  11828. "ssangcieuckorean",
  11829. 0x3149,
  11830. "ssanghieuhkorean",
  11831. 0x3185,
  11832. "ssangieungkorean",
  11833. 0x3180,
  11834. "ssangkiyeokkorean",
  11835. 0x3132,
  11836. "ssangnieunkorean",
  11837. 0x3165,
  11838. "ssangpieupkorean",
  11839. 0x3143,
  11840. "ssangsioskorean",
  11841. 0x3146,
  11842. "ssangtikeutkorean",
  11843. 0x3138,
  11844. "ssuperior",
  11845. 0xf6f2,
  11846. "sterling",
  11847. 0x00a3,
  11848. "sterlingmonospace",
  11849. 0xffe1,
  11850. "strokelongoverlaycmb",
  11851. 0x0336,
  11852. "strokeshortoverlaycmb",
  11853. 0x0335,
  11854. "subset",
  11855. 0x2282,
  11856. "subsetnotequal",
  11857. 0x228a,
  11858. "subsetorequal",
  11859. 0x2286,
  11860. "succeeds",
  11861. 0x227b,
  11862. "suchthat",
  11863. 0x220b,
  11864. "suhiragana",
  11865. 0x3059,
  11866. "sukatakana",
  11867. 0x30b9,
  11868. "sukatakanahalfwidth",
  11869. 0xff7d,
  11870. "sukunarabic",
  11871. 0x0652,
  11872. "summation",
  11873. 0x2211,
  11874. "sun",
  11875. 0x263c,
  11876. "superset",
  11877. 0x2283,
  11878. "supersetnotequal",
  11879. 0x228b,
  11880. "supersetorequal",
  11881. 0x2287,
  11882. "svsquare",
  11883. 0x33dc,
  11884. "syouwaerasquare",
  11885. 0x337c,
  11886. "t",
  11887. 0x0074,
  11888. "tabengali",
  11889. 0x09a4,
  11890. "tackdown",
  11891. 0x22a4,
  11892. "tackleft",
  11893. 0x22a3,
  11894. "tadeva",
  11895. 0x0924,
  11896. "tagujarati",
  11897. 0x0aa4,
  11898. "tagurmukhi",
  11899. 0x0a24,
  11900. "taharabic",
  11901. 0x0637,
  11902. "tahfinalarabic",
  11903. 0xfec2,
  11904. "tahinitialarabic",
  11905. 0xfec3,
  11906. "tahiragana",
  11907. 0x305f,
  11908. "tahmedialarabic",
  11909. 0xfec4,
  11910. "taisyouerasquare",
  11911. 0x337d,
  11912. "takatakana",
  11913. 0x30bf,
  11914. "takatakanahalfwidth",
  11915. 0xff80,
  11916. "tatweelarabic",
  11917. 0x0640,
  11918. "tau",
  11919. 0x03c4,
  11920. "tav",
  11921. 0x05ea,
  11922. "tavdages",
  11923. 0xfb4a,
  11924. "tavdagesh",
  11925. 0xfb4a,
  11926. "tavdageshhebrew",
  11927. 0xfb4a,
  11928. "tavhebrew",
  11929. 0x05ea,
  11930. "tbar",
  11931. 0x0167,
  11932. "tbopomofo",
  11933. 0x310a,
  11934. "tcaron",
  11935. 0x0165,
  11936. "tccurl",
  11937. 0x02a8,
  11938. "tcedilla",
  11939. 0x0163,
  11940. "tcheharabic",
  11941. 0x0686,
  11942. "tchehfinalarabic",
  11943. 0xfb7b,
  11944. "tchehinitialarabic",
  11945. 0xfb7c,
  11946. "tchehmedialarabic",
  11947. 0xfb7d,
  11948. "tcircle",
  11949. 0x24e3,
  11950. "tcircumflexbelow",
  11951. 0x1e71,
  11952. "tcommaaccent",
  11953. 0x0163,
  11954. "tdieresis",
  11955. 0x1e97,
  11956. "tdotaccent",
  11957. 0x1e6b,
  11958. "tdotbelow",
  11959. 0x1e6d,
  11960. "tecyrillic",
  11961. 0x0442,
  11962. "tedescendercyrillic",
  11963. 0x04ad,
  11964. "teharabic",
  11965. 0x062a,
  11966. "tehfinalarabic",
  11967. 0xfe96,
  11968. "tehhahinitialarabic",
  11969. 0xfca2,
  11970. "tehhahisolatedarabic",
  11971. 0xfc0c,
  11972. "tehinitialarabic",
  11973. 0xfe97,
  11974. "tehiragana",
  11975. 0x3066,
  11976. "tehjeeminitialarabic",
  11977. 0xfca1,
  11978. "tehjeemisolatedarabic",
  11979. 0xfc0b,
  11980. "tehmarbutaarabic",
  11981. 0x0629,
  11982. "tehmarbutafinalarabic",
  11983. 0xfe94,
  11984. "tehmedialarabic",
  11985. 0xfe98,
  11986. "tehmeeminitialarabic",
  11987. 0xfca4,
  11988. "tehmeemisolatedarabic",
  11989. 0xfc0e,
  11990. "tehnoonfinalarabic",
  11991. 0xfc73,
  11992. "tekatakana",
  11993. 0x30c6,
  11994. "tekatakanahalfwidth",
  11995. 0xff83,
  11996. "telephone",
  11997. 0x2121,
  11998. "telephoneblack",
  11999. 0x260e,
  12000. "telishagedolahebrew",
  12001. 0x05a0,
  12002. "telishaqetanahebrew",
  12003. 0x05a9,
  12004. "tencircle",
  12005. 0x2469,
  12006. "tenideographicparen",
  12007. 0x3229,
  12008. "tenparen",
  12009. 0x247d,
  12010. "tenperiod",
  12011. 0x2491,
  12012. "tenroman",
  12013. 0x2179,
  12014. "tesh",
  12015. 0x02a7,
  12016. "tet",
  12017. 0x05d8,
  12018. "tetdagesh",
  12019. 0xfb38,
  12020. "tetdageshhebrew",
  12021. 0xfb38,
  12022. "tethebrew",
  12023. 0x05d8,
  12024. "tetsecyrillic",
  12025. 0x04b5,
  12026. "tevirhebrew",
  12027. 0x059b,
  12028. "tevirlefthebrew",
  12029. 0x059b,
  12030. "thabengali",
  12031. 0x09a5,
  12032. "thadeva",
  12033. 0x0925,
  12034. "thagujarati",
  12035. 0x0aa5,
  12036. "thagurmukhi",
  12037. 0x0a25,
  12038. "thalarabic",
  12039. 0x0630,
  12040. "thalfinalarabic",
  12041. 0xfeac,
  12042. "thanthakhatlowleftthai",
  12043. 0xf898,
  12044. "thanthakhatlowrightthai",
  12045. 0xf897,
  12046. "thanthakhatthai",
  12047. 0x0e4c,
  12048. "thanthakhatupperleftthai",
  12049. 0xf896,
  12050. "theharabic",
  12051. 0x062b,
  12052. "thehfinalarabic",
  12053. 0xfe9a,
  12054. "thehinitialarabic",
  12055. 0xfe9b,
  12056. "thehmedialarabic",
  12057. 0xfe9c,
  12058. "thereexists",
  12059. 0x2203,
  12060. "therefore",
  12061. 0x2234,
  12062. "theta",
  12063. 0x03b8,
  12064. "theta1",
  12065. 0x03d1,
  12066. "thetasymbolgreek",
  12067. 0x03d1,
  12068. "thieuthacirclekorean",
  12069. 0x3279,
  12070. "thieuthaparenkorean",
  12071. 0x3219,
  12072. "thieuthcirclekorean",
  12073. 0x326b,
  12074. "thieuthkorean",
  12075. 0x314c,
  12076. "thieuthparenkorean",
  12077. 0x320b,
  12078. "thirteencircle",
  12079. 0x246c,
  12080. "thirteenparen",
  12081. 0x2480,
  12082. "thirteenperiod",
  12083. 0x2494,
  12084. "thonangmonthothai",
  12085. 0x0e11,
  12086. "thook",
  12087. 0x01ad,
  12088. "thophuthaothai",
  12089. 0x0e12,
  12090. "thorn",
  12091. 0x00fe,
  12092. "thothahanthai",
  12093. 0x0e17,
  12094. "thothanthai",
  12095. 0x0e10,
  12096. "thothongthai",
  12097. 0x0e18,
  12098. "thothungthai",
  12099. 0x0e16,
  12100. "thousandcyrillic",
  12101. 0x0482,
  12102. "thousandsseparatorarabic",
  12103. 0x066c,
  12104. "thousandsseparatorpersian",
  12105. 0x066c,
  12106. "three",
  12107. 0x0033,
  12108. "threearabic",
  12109. 0x0663,
  12110. "threebengali",
  12111. 0x09e9,
  12112. "threecircle",
  12113. 0x2462,
  12114. "threecircleinversesansserif",
  12115. 0x278c,
  12116. "threedeva",
  12117. 0x0969,
  12118. "threeeighths",
  12119. 0x215c,
  12120. "threegujarati",
  12121. 0x0ae9,
  12122. "threegurmukhi",
  12123. 0x0a69,
  12124. "threehackarabic",
  12125. 0x0663,
  12126. "threehangzhou",
  12127. 0x3023,
  12128. "threeideographicparen",
  12129. 0x3222,
  12130. "threeinferior",
  12131. 0x2083,
  12132. "threemonospace",
  12133. 0xff13,
  12134. "threenumeratorbengali",
  12135. 0x09f6,
  12136. "threeoldstyle",
  12137. 0xf733,
  12138. "threeparen",
  12139. 0x2476,
  12140. "threeperiod",
  12141. 0x248a,
  12142. "threepersian",
  12143. 0x06f3,
  12144. "threequarters",
  12145. 0x00be,
  12146. "threequartersemdash",
  12147. 0xf6de,
  12148. "threeroman",
  12149. 0x2172,
  12150. "threesuperior",
  12151. 0x00b3,
  12152. "threethai",
  12153. 0x0e53,
  12154. "thzsquare",
  12155. 0x3394,
  12156. "tihiragana",
  12157. 0x3061,
  12158. "tikatakana",
  12159. 0x30c1,
  12160. "tikatakanahalfwidth",
  12161. 0xff81,
  12162. "tikeutacirclekorean",
  12163. 0x3270,
  12164. "tikeutaparenkorean",
  12165. 0x3210,
  12166. "tikeutcirclekorean",
  12167. 0x3262,
  12168. "tikeutkorean",
  12169. 0x3137,
  12170. "tikeutparenkorean",
  12171. 0x3202,
  12172. "tilde",
  12173. 0x02dc,
  12174. "tildebelowcmb",
  12175. 0x0330,
  12176. "tildecmb",
  12177. 0x0303,
  12178. "tildecomb",
  12179. 0x0303,
  12180. "tildedoublecmb",
  12181. 0x0360,
  12182. "tildeoperator",
  12183. 0x223c,
  12184. "tildeoverlaycmb",
  12185. 0x0334,
  12186. "tildeverticalcmb",
  12187. 0x033e,
  12188. "timescircle",
  12189. 0x2297,
  12190. "tipehahebrew",
  12191. 0x0596,
  12192. "tipehalefthebrew",
  12193. 0x0596,
  12194. "tippigurmukhi",
  12195. 0x0a70,
  12196. "titlocyrilliccmb",
  12197. 0x0483,
  12198. "tiwnarmenian",
  12199. 0x057f,
  12200. "tlinebelow",
  12201. 0x1e6f,
  12202. "tmonospace",
  12203. 0xff54,
  12204. "toarmenian",
  12205. 0x0569,
  12206. "tohiragana",
  12207. 0x3068,
  12208. "tokatakana",
  12209. 0x30c8,
  12210. "tokatakanahalfwidth",
  12211. 0xff84,
  12212. "tonebarextrahighmod",
  12213. 0x02e5,
  12214. "tonebarextralowmod",
  12215. 0x02e9,
  12216. "tonebarhighmod",
  12217. 0x02e6,
  12218. "tonebarlowmod",
  12219. 0x02e8,
  12220. "tonebarmidmod",
  12221. 0x02e7,
  12222. "tonefive",
  12223. 0x01bd,
  12224. "tonesix",
  12225. 0x0185,
  12226. "tonetwo",
  12227. 0x01a8,
  12228. "tonos",
  12229. 0x0384,
  12230. "tonsquare",
  12231. 0x3327,
  12232. "topatakthai",
  12233. 0x0e0f,
  12234. "tortoiseshellbracketleft",
  12235. 0x3014,
  12236. "tortoiseshellbracketleftsmall",
  12237. 0xfe5d,
  12238. "tortoiseshellbracketleftvertical",
  12239. 0xfe39,
  12240. "tortoiseshellbracketright",
  12241. 0x3015,
  12242. "tortoiseshellbracketrightsmall",
  12243. 0xfe5e,
  12244. "tortoiseshellbracketrightvertical",
  12245. 0xfe3a,
  12246. "totaothai",
  12247. 0x0e15,
  12248. "tpalatalhook",
  12249. 0x01ab,
  12250. "tparen",
  12251. 0x24af,
  12252. "trademark",
  12253. 0x2122,
  12254. "trademarksans",
  12255. 0xf8ea,
  12256. "trademarkserif",
  12257. 0xf6db,
  12258. "tretroflexhook",
  12259. 0x0288,
  12260. "triagdn",
  12261. 0x25bc,
  12262. "triaglf",
  12263. 0x25c4,
  12264. "triagrt",
  12265. 0x25ba,
  12266. "triagup",
  12267. 0x25b2,
  12268. "ts",
  12269. 0x02a6,
  12270. "tsadi",
  12271. 0x05e6,
  12272. "tsadidagesh",
  12273. 0xfb46,
  12274. "tsadidageshhebrew",
  12275. 0xfb46,
  12276. "tsadihebrew",
  12277. 0x05e6,
  12278. "tsecyrillic",
  12279. 0x0446,
  12280. "tsere",
  12281. 0x05b5,
  12282. "tsere12",
  12283. 0x05b5,
  12284. "tsere1e",
  12285. 0x05b5,
  12286. "tsere2b",
  12287. 0x05b5,
  12288. "tserehebrew",
  12289. 0x05b5,
  12290. "tserenarrowhebrew",
  12291. 0x05b5,
  12292. "tserequarterhebrew",
  12293. 0x05b5,
  12294. "tserewidehebrew",
  12295. 0x05b5,
  12296. "tshecyrillic",
  12297. 0x045b,
  12298. "tsuperior",
  12299. 0xf6f3,
  12300. "ttabengali",
  12301. 0x099f,
  12302. "ttadeva",
  12303. 0x091f,
  12304. "ttagujarati",
  12305. 0x0a9f,
  12306. "ttagurmukhi",
  12307. 0x0a1f,
  12308. "tteharabic",
  12309. 0x0679,
  12310. "ttehfinalarabic",
  12311. 0xfb67,
  12312. "ttehinitialarabic",
  12313. 0xfb68,
  12314. "ttehmedialarabic",
  12315. 0xfb69,
  12316. "tthabengali",
  12317. 0x09a0,
  12318. "tthadeva",
  12319. 0x0920,
  12320. "tthagujarati",
  12321. 0x0aa0,
  12322. "tthagurmukhi",
  12323. 0x0a20,
  12324. "tturned",
  12325. 0x0287,
  12326. "tuhiragana",
  12327. 0x3064,
  12328. "tukatakana",
  12329. 0x30c4,
  12330. "tukatakanahalfwidth",
  12331. 0xff82,
  12332. "tusmallhiragana",
  12333. 0x3063,
  12334. "tusmallkatakana",
  12335. 0x30c3,
  12336. "tusmallkatakanahalfwidth",
  12337. 0xff6f,
  12338. "twelvecircle",
  12339. 0x246b,
  12340. "twelveparen",
  12341. 0x247f,
  12342. "twelveperiod",
  12343. 0x2493,
  12344. "twelveroman",
  12345. 0x217b,
  12346. "twentycircle",
  12347. 0x2473,
  12348. "twentyhangzhou",
  12349. 0x5344,
  12350. "twentyparen",
  12351. 0x2487,
  12352. "twentyperiod",
  12353. 0x249b,
  12354. "two",
  12355. 0x0032,
  12356. "twoarabic",
  12357. 0x0662,
  12358. "twobengali",
  12359. 0x09e8,
  12360. "twocircle",
  12361. 0x2461,
  12362. "twocircleinversesansserif",
  12363. 0x278b,
  12364. "twodeva",
  12365. 0x0968,
  12366. "twodotenleader",
  12367. 0x2025,
  12368. "twodotleader",
  12369. 0x2025,
  12370. "twodotleadervertical",
  12371. 0xfe30,
  12372. "twogujarati",
  12373. 0x0ae8,
  12374. "twogurmukhi",
  12375. 0x0a68,
  12376. "twohackarabic",
  12377. 0x0662,
  12378. "twohangzhou",
  12379. 0x3022,
  12380. "twoideographicparen",
  12381. 0x3221,
  12382. "twoinferior",
  12383. 0x2082,
  12384. "twomonospace",
  12385. 0xff12,
  12386. "twonumeratorbengali",
  12387. 0x09f5,
  12388. "twooldstyle",
  12389. 0xf732,
  12390. "twoparen",
  12391. 0x2475,
  12392. "twoperiod",
  12393. 0x2489,
  12394. "twopersian",
  12395. 0x06f2,
  12396. "tworoman",
  12397. 0x2171,
  12398. "twostroke",
  12399. 0x01bb,
  12400. "twosuperior",
  12401. 0x00b2,
  12402. "twothai",
  12403. 0x0e52,
  12404. "twothirds",
  12405. 0x2154,
  12406. "u",
  12407. 0x0075,
  12408. "uacute",
  12409. 0x00fa,
  12410. "ubar",
  12411. 0x0289,
  12412. "ubengali",
  12413. 0x0989,
  12414. "ubopomofo",
  12415. 0x3128,
  12416. "ubreve",
  12417. 0x016d,
  12418. "ucaron",
  12419. 0x01d4,
  12420. "ucircle",
  12421. 0x24e4,
  12422. "ucircumflex",
  12423. 0x00fb,
  12424. "ucircumflexbelow",
  12425. 0x1e77,
  12426. "ucyrillic",
  12427. 0x0443,
  12428. "udattadeva",
  12429. 0x0951,
  12430. "udblacute",
  12431. 0x0171,
  12432. "udblgrave",
  12433. 0x0215,
  12434. "udeva",
  12435. 0x0909,
  12436. "udieresis",
  12437. 0x00fc,
  12438. "udieresisacute",
  12439. 0x01d8,
  12440. "udieresisbelow",
  12441. 0x1e73,
  12442. "udieresiscaron",
  12443. 0x01da,
  12444. "udieresiscyrillic",
  12445. 0x04f1,
  12446. "udieresisgrave",
  12447. 0x01dc,
  12448. "udieresismacron",
  12449. 0x01d6,
  12450. "udotbelow",
  12451. 0x1ee5,
  12452. "ugrave",
  12453. 0x00f9,
  12454. "ugujarati",
  12455. 0x0a89,
  12456. "ugurmukhi",
  12457. 0x0a09,
  12458. "uhiragana",
  12459. 0x3046,
  12460. "uhookabove",
  12461. 0x1ee7,
  12462. "uhorn",
  12463. 0x01b0,
  12464. "uhornacute",
  12465. 0x1ee9,
  12466. "uhorndotbelow",
  12467. 0x1ef1,
  12468. "uhorngrave",
  12469. 0x1eeb,
  12470. "uhornhookabove",
  12471. 0x1eed,
  12472. "uhorntilde",
  12473. 0x1eef,
  12474. "uhungarumlaut",
  12475. 0x0171,
  12476. "uhungarumlautcyrillic",
  12477. 0x04f3,
  12478. "uinvertedbreve",
  12479. 0x0217,
  12480. "ukatakana",
  12481. 0x30a6,
  12482. "ukatakanahalfwidth",
  12483. 0xff73,
  12484. "ukcyrillic",
  12485. 0x0479,
  12486. "ukorean",
  12487. 0x315c,
  12488. "umacron",
  12489. 0x016b,
  12490. "umacroncyrillic",
  12491. 0x04ef,
  12492. "umacrondieresis",
  12493. 0x1e7b,
  12494. "umatragurmukhi",
  12495. 0x0a41,
  12496. "umonospace",
  12497. 0xff55,
  12498. "underscore",
  12499. 0x005f,
  12500. "underscoredbl",
  12501. 0x2017,
  12502. "underscoremonospace",
  12503. 0xff3f,
  12504. "underscorevertical",
  12505. 0xfe33,
  12506. "underscorewavy",
  12507. 0xfe4f,
  12508. "union",
  12509. 0x222a,
  12510. "universal",
  12511. 0x2200,
  12512. "uogonek",
  12513. 0x0173,
  12514. "uparen",
  12515. 0x24b0,
  12516. "upblock",
  12517. 0x2580,
  12518. "upperdothebrew",
  12519. 0x05c4,
  12520. "upsilon",
  12521. 0x03c5,
  12522. "upsilondieresis",
  12523. 0x03cb,
  12524. "upsilondieresistonos",
  12525. 0x03b0,
  12526. "upsilonlatin",
  12527. 0x028a,
  12528. "upsilontonos",
  12529. 0x03cd,
  12530. "uptackbelowcmb",
  12531. 0x031d,
  12532. "uptackmod",
  12533. 0x02d4,
  12534. "uragurmukhi",
  12535. 0x0a73,
  12536. "uring",
  12537. 0x016f,
  12538. "ushortcyrillic",
  12539. 0x045e,
  12540. "usmallhiragana",
  12541. 0x3045,
  12542. "usmallkatakana",
  12543. 0x30a5,
  12544. "usmallkatakanahalfwidth",
  12545. 0xff69,
  12546. "ustraightcyrillic",
  12547. 0x04af,
  12548. "ustraightstrokecyrillic",
  12549. 0x04b1,
  12550. "utilde",
  12551. 0x0169,
  12552. "utildeacute",
  12553. 0x1e79,
  12554. "utildebelow",
  12555. 0x1e75,
  12556. "uubengali",
  12557. 0x098a,
  12558. "uudeva",
  12559. 0x090a,
  12560. "uugujarati",
  12561. 0x0a8a,
  12562. "uugurmukhi",
  12563. 0x0a0a,
  12564. "uumatragurmukhi",
  12565. 0x0a42,
  12566. "uuvowelsignbengali",
  12567. 0x09c2,
  12568. "uuvowelsigndeva",
  12569. 0x0942,
  12570. "uuvowelsigngujarati",
  12571. 0x0ac2,
  12572. "uvowelsignbengali",
  12573. 0x09c1,
  12574. "uvowelsigndeva",
  12575. 0x0941,
  12576. "uvowelsigngujarati",
  12577. 0x0ac1,
  12578. "v",
  12579. 0x0076,
  12580. "vadeva",
  12581. 0x0935,
  12582. "vagujarati",
  12583. 0x0ab5,
  12584. "vagurmukhi",
  12585. 0x0a35,
  12586. "vakatakana",
  12587. 0x30f7,
  12588. "vav",
  12589. 0x05d5,
  12590. "vavdagesh",
  12591. 0xfb35,
  12592. "vavdagesh65",
  12593. 0xfb35,
  12594. "vavdageshhebrew",
  12595. 0xfb35,
  12596. "vavhebrew",
  12597. 0x05d5,
  12598. "vavholam",
  12599. 0xfb4b,
  12600. "vavholamhebrew",
  12601. 0xfb4b,
  12602. "vavvavhebrew",
  12603. 0x05f0,
  12604. "vavyodhebrew",
  12605. 0x05f1,
  12606. "vcircle",
  12607. 0x24e5,
  12608. "vdotbelow",
  12609. 0x1e7f,
  12610. "vecyrillic",
  12611. 0x0432,
  12612. "veharabic",
  12613. 0x06a4,
  12614. "vehfinalarabic",
  12615. 0xfb6b,
  12616. "vehinitialarabic",
  12617. 0xfb6c,
  12618. "vehmedialarabic",
  12619. 0xfb6d,
  12620. "vekatakana",
  12621. 0x30f9,
  12622. "venus",
  12623. 0x2640,
  12624. "verticalbar",
  12625. 0x007c,
  12626. "verticallineabovecmb",
  12627. 0x030d,
  12628. "verticallinebelowcmb",
  12629. 0x0329,
  12630. "verticallinelowmod",
  12631. 0x02cc,
  12632. "verticallinemod",
  12633. 0x02c8,
  12634. "vewarmenian",
  12635. 0x057e,
  12636. "vhook",
  12637. 0x028b,
  12638. "vikatakana",
  12639. 0x30f8,
  12640. "viramabengali",
  12641. 0x09cd,
  12642. "viramadeva",
  12643. 0x094d,
  12644. "viramagujarati",
  12645. 0x0acd,
  12646. "visargabengali",
  12647. 0x0983,
  12648. "visargadeva",
  12649. 0x0903,
  12650. "visargagujarati",
  12651. 0x0a83,
  12652. "vmonospace",
  12653. 0xff56,
  12654. "voarmenian",
  12655. 0x0578,
  12656. "voicediterationhiragana",
  12657. 0x309e,
  12658. "voicediterationkatakana",
  12659. 0x30fe,
  12660. "voicedmarkkana",
  12661. 0x309b,
  12662. "voicedmarkkanahalfwidth",
  12663. 0xff9e,
  12664. "vokatakana",
  12665. 0x30fa,
  12666. "vparen",
  12667. 0x24b1,
  12668. "vtilde",
  12669. 0x1e7d,
  12670. "vturned",
  12671. 0x028c,
  12672. "vuhiragana",
  12673. 0x3094,
  12674. "vukatakana",
  12675. 0x30f4,
  12676. "w",
  12677. 0x0077,
  12678. "wacute",
  12679. 0x1e83,
  12680. "waekorean",
  12681. 0x3159,
  12682. "wahiragana",
  12683. 0x308f,
  12684. "wakatakana",
  12685. 0x30ef,
  12686. "wakatakanahalfwidth",
  12687. 0xff9c,
  12688. "wakorean",
  12689. 0x3158,
  12690. "wasmallhiragana",
  12691. 0x308e,
  12692. "wasmallkatakana",
  12693. 0x30ee,
  12694. "wattosquare",
  12695. 0x3357,
  12696. "wavedash",
  12697. 0x301c,
  12698. "wavyunderscorevertical",
  12699. 0xfe34,
  12700. "wawarabic",
  12701. 0x0648,
  12702. "wawfinalarabic",
  12703. 0xfeee,
  12704. "wawhamzaabovearabic",
  12705. 0x0624,
  12706. "wawhamzaabovefinalarabic",
  12707. 0xfe86,
  12708. "wbsquare",
  12709. 0x33dd,
  12710. "wcircle",
  12711. 0x24e6,
  12712. "wcircumflex",
  12713. 0x0175,
  12714. "wdieresis",
  12715. 0x1e85,
  12716. "wdotaccent",
  12717. 0x1e87,
  12718. "wdotbelow",
  12719. 0x1e89,
  12720. "wehiragana",
  12721. 0x3091,
  12722. "weierstrass",
  12723. 0x2118,
  12724. "wekatakana",
  12725. 0x30f1,
  12726. "wekorean",
  12727. 0x315e,
  12728. "weokorean",
  12729. 0x315d,
  12730. "wgrave",
  12731. 0x1e81,
  12732. "whitebullet",
  12733. 0x25e6,
  12734. "whitecircle",
  12735. 0x25cb,
  12736. "whitecircleinverse",
  12737. 0x25d9,
  12738. "whitecornerbracketleft",
  12739. 0x300e,
  12740. "whitecornerbracketleftvertical",
  12741. 0xfe43,
  12742. "whitecornerbracketright",
  12743. 0x300f,
  12744. "whitecornerbracketrightvertical",
  12745. 0xfe44,
  12746. "whitediamond",
  12747. 0x25c7,
  12748. "whitediamondcontainingblacksmalldiamond",
  12749. 0x25c8,
  12750. "whitedownpointingsmalltriangle",
  12751. 0x25bf,
  12752. "whitedownpointingtriangle",
  12753. 0x25bd,
  12754. "whiteleftpointingsmalltriangle",
  12755. 0x25c3,
  12756. "whiteleftpointingtriangle",
  12757. 0x25c1,
  12758. "whitelenticularbracketleft",
  12759. 0x3016,
  12760. "whitelenticularbracketright",
  12761. 0x3017,
  12762. "whiterightpointingsmalltriangle",
  12763. 0x25b9,
  12764. "whiterightpointingtriangle",
  12765. 0x25b7,
  12766. "whitesmallsquare",
  12767. 0x25ab,
  12768. "whitesmilingface",
  12769. 0x263a,
  12770. "whitesquare",
  12771. 0x25a1,
  12772. "whitestar",
  12773. 0x2606,
  12774. "whitetelephone",
  12775. 0x260f,
  12776. "whitetortoiseshellbracketleft",
  12777. 0x3018,
  12778. "whitetortoiseshellbracketright",
  12779. 0x3019,
  12780. "whiteuppointingsmalltriangle",
  12781. 0x25b5,
  12782. "whiteuppointingtriangle",
  12783. 0x25b3,
  12784. "wihiragana",
  12785. 0x3090,
  12786. "wikatakana",
  12787. 0x30f0,
  12788. "wikorean",
  12789. 0x315f,
  12790. "wmonospace",
  12791. 0xff57,
  12792. "wohiragana",
  12793. 0x3092,
  12794. "wokatakana",
  12795. 0x30f2,
  12796. "wokatakanahalfwidth",
  12797. 0xff66,
  12798. "won",
  12799. 0x20a9,
  12800. "wonmonospace",
  12801. 0xffe6,
  12802. "wowaenthai",
  12803. 0x0e27,
  12804. "wparen",
  12805. 0x24b2,
  12806. "wring",
  12807. 0x1e98,
  12808. "wsuperior",
  12809. 0x02b7,
  12810. "wturned",
  12811. 0x028d,
  12812. "wynn",
  12813. 0x01bf,
  12814. "x",
  12815. 0x0078,
  12816. "xabovecmb",
  12817. 0x033d,
  12818. "xbopomofo",
  12819. 0x3112,
  12820. "xcircle",
  12821. 0x24e7,
  12822. "xdieresis",
  12823. 0x1e8d,
  12824. "xdotaccent",
  12825. 0x1e8b,
  12826. "xeharmenian",
  12827. 0x056d,
  12828. "xi",
  12829. 0x03be,
  12830. "xmonospace",
  12831. 0xff58,
  12832. "xparen",
  12833. 0x24b3,
  12834. "xsuperior",
  12835. 0x02e3,
  12836. "y",
  12837. 0x0079,
  12838. "yaadosquare",
  12839. 0x334e,
  12840. "yabengali",
  12841. 0x09af,
  12842. "yacute",
  12843. 0x00fd,
  12844. "yadeva",
  12845. 0x092f,
  12846. "yaekorean",
  12847. 0x3152,
  12848. "yagujarati",
  12849. 0x0aaf,
  12850. "yagurmukhi",
  12851. 0x0a2f,
  12852. "yahiragana",
  12853. 0x3084,
  12854. "yakatakana",
  12855. 0x30e4,
  12856. "yakatakanahalfwidth",
  12857. 0xff94,
  12858. "yakorean",
  12859. 0x3151,
  12860. "yamakkanthai",
  12861. 0x0e4e,
  12862. "yasmallhiragana",
  12863. 0x3083,
  12864. "yasmallkatakana",
  12865. 0x30e3,
  12866. "yasmallkatakanahalfwidth",
  12867. 0xff6c,
  12868. "yatcyrillic",
  12869. 0x0463,
  12870. "ycircle",
  12871. 0x24e8,
  12872. "ycircumflex",
  12873. 0x0177,
  12874. "ydieresis",
  12875. 0x00ff,
  12876. "ydotaccent",
  12877. 0x1e8f,
  12878. "ydotbelow",
  12879. 0x1ef5,
  12880. "yeharabic",
  12881. 0x064a,
  12882. "yehbarreearabic",
  12883. 0x06d2,
  12884. "yehbarreefinalarabic",
  12885. 0xfbaf,
  12886. "yehfinalarabic",
  12887. 0xfef2,
  12888. "yehhamzaabovearabic",
  12889. 0x0626,
  12890. "yehhamzaabovefinalarabic",
  12891. 0xfe8a,
  12892. "yehhamzaaboveinitialarabic",
  12893. 0xfe8b,
  12894. "yehhamzaabovemedialarabic",
  12895. 0xfe8c,
  12896. "yehinitialarabic",
  12897. 0xfef3,
  12898. "yehmedialarabic",
  12899. 0xfef4,
  12900. "yehmeeminitialarabic",
  12901. 0xfcdd,
  12902. "yehmeemisolatedarabic",
  12903. 0xfc58,
  12904. "yehnoonfinalarabic",
  12905. 0xfc94,
  12906. "yehthreedotsbelowarabic",
  12907. 0x06d1,
  12908. "yekorean",
  12909. 0x3156,
  12910. "yen",
  12911. 0x00a5,
  12912. "yenmonospace",
  12913. 0xffe5,
  12914. "yeokorean",
  12915. 0x3155,
  12916. "yeorinhieuhkorean",
  12917. 0x3186,
  12918. "yerahbenyomohebrew",
  12919. 0x05aa,
  12920. "yerahbenyomolefthebrew",
  12921. 0x05aa,
  12922. "yericyrillic",
  12923. 0x044b,
  12924. "yerudieresiscyrillic",
  12925. 0x04f9,
  12926. "yesieungkorean",
  12927. 0x3181,
  12928. "yesieungpansioskorean",
  12929. 0x3183,
  12930. "yesieungsioskorean",
  12931. 0x3182,
  12932. "yetivhebrew",
  12933. 0x059a,
  12934. "ygrave",
  12935. 0x1ef3,
  12936. "yhook",
  12937. 0x01b4,
  12938. "yhookabove",
  12939. 0x1ef7,
  12940. "yiarmenian",
  12941. 0x0575,
  12942. "yicyrillic",
  12943. 0x0457,
  12944. "yikorean",
  12945. 0x3162,
  12946. "yinyang",
  12947. 0x262f,
  12948. "yiwnarmenian",
  12949. 0x0582,
  12950. "ymonospace",
  12951. 0xff59,
  12952. "yod",
  12953. 0x05d9,
  12954. "yoddagesh",
  12955. 0xfb39,
  12956. "yoddageshhebrew",
  12957. 0xfb39,
  12958. "yodhebrew",
  12959. 0x05d9,
  12960. "yodyodhebrew",
  12961. 0x05f2,
  12962. "yodyodpatahhebrew",
  12963. 0xfb1f,
  12964. "yohiragana",
  12965. 0x3088,
  12966. "yoikorean",
  12967. 0x3189,
  12968. "yokatakana",
  12969. 0x30e8,
  12970. "yokatakanahalfwidth",
  12971. 0xff96,
  12972. "yokorean",
  12973. 0x315b,
  12974. "yosmallhiragana",
  12975. 0x3087,
  12976. "yosmallkatakana",
  12977. 0x30e7,
  12978. "yosmallkatakanahalfwidth",
  12979. 0xff6e,
  12980. "yotgreek",
  12981. 0x03f3,
  12982. "yoyaekorean",
  12983. 0x3188,
  12984. "yoyakorean",
  12985. 0x3187,
  12986. "yoyakthai",
  12987. 0x0e22,
  12988. "yoyingthai",
  12989. 0x0e0d,
  12990. "yparen",
  12991. 0x24b4,
  12992. "ypogegrammeni",
  12993. 0x037a,
  12994. "ypogegrammenigreekcmb",
  12995. 0x0345,
  12996. "yr",
  12997. 0x01a6,
  12998. "yring",
  12999. 0x1e99,
  13000. "ysuperior",
  13001. 0x02b8,
  13002. "ytilde",
  13003. 0x1ef9,
  13004. "yturned",
  13005. 0x028e,
  13006. "yuhiragana",
  13007. 0x3086,
  13008. "yuikorean",
  13009. 0x318c,
  13010. "yukatakana",
  13011. 0x30e6,
  13012. "yukatakanahalfwidth",
  13013. 0xff95,
  13014. "yukorean",
  13015. 0x3160,
  13016. "yusbigcyrillic",
  13017. 0x046b,
  13018. "yusbigiotifiedcyrillic",
  13019. 0x046d,
  13020. "yuslittlecyrillic",
  13021. 0x0467,
  13022. "yuslittleiotifiedcyrillic",
  13023. 0x0469,
  13024. "yusmallhiragana",
  13025. 0x3085,
  13026. "yusmallkatakana",
  13027. 0x30e5,
  13028. "yusmallkatakanahalfwidth",
  13029. 0xff6d,
  13030. "yuyekorean",
  13031. 0x318b,
  13032. "yuyeokorean",
  13033. 0x318a,
  13034. "yyabengali",
  13035. 0x09df,
  13036. "yyadeva",
  13037. 0x095f,
  13038. "z",
  13039. 0x007a,
  13040. "zaarmenian",
  13041. 0x0566,
  13042. "zacute",
  13043. 0x017a,
  13044. "zadeva",
  13045. 0x095b,
  13046. "zagurmukhi",
  13047. 0x0a5b,
  13048. "zaharabic",
  13049. 0x0638,
  13050. "zahfinalarabic",
  13051. 0xfec6,
  13052. "zahinitialarabic",
  13053. 0xfec7,
  13054. "zahiragana",
  13055. 0x3056,
  13056. "zahmedialarabic",
  13057. 0xfec8,
  13058. "zainarabic",
  13059. 0x0632,
  13060. "zainfinalarabic",
  13061. 0xfeb0,
  13062. "zakatakana",
  13063. 0x30b6,
  13064. "zaqefgadolhebrew",
  13065. 0x0595,
  13066. "zaqefqatanhebrew",
  13067. 0x0594,
  13068. "zarqahebrew",
  13069. 0x0598,
  13070. "zayin",
  13071. 0x05d6,
  13072. "zayindagesh",
  13073. 0xfb36,
  13074. "zayindageshhebrew",
  13075. 0xfb36,
  13076. "zayinhebrew",
  13077. 0x05d6,
  13078. "zbopomofo",
  13079. 0x3117,
  13080. "zcaron",
  13081. 0x017e,
  13082. "zcircle",
  13083. 0x24e9,
  13084. "zcircumflex",
  13085. 0x1e91,
  13086. "zcurl",
  13087. 0x0291,
  13088. "zdot",
  13089. 0x017c,
  13090. "zdotaccent",
  13091. 0x017c,
  13092. "zdotbelow",
  13093. 0x1e93,
  13094. "zecyrillic",
  13095. 0x0437,
  13096. "zedescendercyrillic",
  13097. 0x0499,
  13098. "zedieresiscyrillic",
  13099. 0x04df,
  13100. "zehiragana",
  13101. 0x305c,
  13102. "zekatakana",
  13103. 0x30bc,
  13104. "zero",
  13105. 0x0030,
  13106. "zeroarabic",
  13107. 0x0660,
  13108. "zerobengali",
  13109. 0x09e6,
  13110. "zerodeva",
  13111. 0x0966,
  13112. "zerogujarati",
  13113. 0x0ae6,
  13114. "zerogurmukhi",
  13115. 0x0a66,
  13116. "zerohackarabic",
  13117. 0x0660,
  13118. "zeroinferior",
  13119. 0x2080,
  13120. "zeromonospace",
  13121. 0xff10,
  13122. "zerooldstyle",
  13123. 0xf730,
  13124. "zeropersian",
  13125. 0x06f0,
  13126. "zerosuperior",
  13127. 0x2070,
  13128. "zerothai",
  13129. 0x0e50,
  13130. "zerowidthjoiner",
  13131. 0xfeff,
  13132. "zerowidthnonjoiner",
  13133. 0x200c,
  13134. "zerowidthspace",
  13135. 0x200b,
  13136. "zeta",
  13137. 0x03b6,
  13138. "zhbopomofo",
  13139. 0x3113,
  13140. "zhearmenian",
  13141. 0x056a,
  13142. "zhebrevecyrillic",
  13143. 0x04c2,
  13144. "zhecyrillic",
  13145. 0x0436,
  13146. "zhedescendercyrillic",
  13147. 0x0497,
  13148. "zhedieresiscyrillic",
  13149. 0x04dd,
  13150. "zihiragana",
  13151. 0x3058,
  13152. "zikatakana",
  13153. 0x30b8,
  13154. "zinorhebrew",
  13155. 0x05ae,
  13156. "zlinebelow",
  13157. 0x1e95,
  13158. "zmonospace",
  13159. 0xff5a,
  13160. "zohiragana",
  13161. 0x305e,
  13162. "zokatakana",
  13163. 0x30be,
  13164. "zparen",
  13165. 0x24b5,
  13166. "zretroflexhook",
  13167. 0x0290,
  13168. "zstroke",
  13169. 0x01b6,
  13170. "zuhiragana",
  13171. 0x305a,
  13172. "zukatakana",
  13173. 0x30ba,
  13174. ".notdef",
  13175. 0x0000,
  13176. "angbracketleftbig",
  13177. 0x2329,
  13178. "angbracketleftBig",
  13179. 0x2329,
  13180. "angbracketleftbigg",
  13181. 0x2329,
  13182. "angbracketleftBigg",
  13183. 0x2329,
  13184. "angbracketrightBig",
  13185. 0x232a,
  13186. "angbracketrightbig",
  13187. 0x232a,
  13188. "angbracketrightBigg",
  13189. 0x232a,
  13190. "angbracketrightbigg",
  13191. 0x232a,
  13192. "arrowhookleft",
  13193. 0x21aa,
  13194. "arrowhookright",
  13195. 0x21a9,
  13196. "arrowlefttophalf",
  13197. 0x21bc,
  13198. "arrowleftbothalf",
  13199. 0x21bd,
  13200. "arrownortheast",
  13201. 0x2197,
  13202. "arrownorthwest",
  13203. 0x2196,
  13204. "arrowrighttophalf",
  13205. 0x21c0,
  13206. "arrowrightbothalf",
  13207. 0x21c1,
  13208. "arrowsoutheast",
  13209. 0x2198,
  13210. "arrowsouthwest",
  13211. 0x2199,
  13212. "backslashbig",
  13213. 0x2216,
  13214. "backslashBig",
  13215. 0x2216,
  13216. "backslashBigg",
  13217. 0x2216,
  13218. "backslashbigg",
  13219. 0x2216,
  13220. "bardbl",
  13221. 0x2016,
  13222. "bracehtipdownleft",
  13223. 0xfe37,
  13224. "bracehtipdownright",
  13225. 0xfe37,
  13226. "bracehtipupleft",
  13227. 0xfe38,
  13228. "bracehtipupright",
  13229. 0xfe38,
  13230. "braceleftBig",
  13231. 0x007b,
  13232. "braceleftbig",
  13233. 0x007b,
  13234. "braceleftbigg",
  13235. 0x007b,
  13236. "braceleftBigg",
  13237. 0x007b,
  13238. "bracerightBig",
  13239. 0x007d,
  13240. "bracerightbig",
  13241. 0x007d,
  13242. "bracerightbigg",
  13243. 0x007d,
  13244. "bracerightBigg",
  13245. 0x007d,
  13246. "bracketleftbig",
  13247. 0x005b,
  13248. "bracketleftBig",
  13249. 0x005b,
  13250. "bracketleftbigg",
  13251. 0x005b,
  13252. "bracketleftBigg",
  13253. 0x005b,
  13254. "bracketrightBig",
  13255. 0x005d,
  13256. "bracketrightbig",
  13257. 0x005d,
  13258. "bracketrightbigg",
  13259. 0x005d,
  13260. "bracketrightBigg",
  13261. 0x005d,
  13262. "ceilingleftbig",
  13263. 0x2308,
  13264. "ceilingleftBig",
  13265. 0x2308,
  13266. "ceilingleftBigg",
  13267. 0x2308,
  13268. "ceilingleftbigg",
  13269. 0x2308,
  13270. "ceilingrightbig",
  13271. 0x2309,
  13272. "ceilingrightBig",
  13273. 0x2309,
  13274. "ceilingrightbigg",
  13275. 0x2309,
  13276. "ceilingrightBigg",
  13277. 0x2309,
  13278. "circledotdisplay",
  13279. 0x2299,
  13280. "circledottext",
  13281. 0x2299,
  13282. "circlemultiplydisplay",
  13283. 0x2297,
  13284. "circlemultiplytext",
  13285. 0x2297,
  13286. "circleplusdisplay",
  13287. 0x2295,
  13288. "circleplustext",
  13289. 0x2295,
  13290. "contintegraldisplay",
  13291. 0x222e,
  13292. "contintegraltext",
  13293. 0x222e,
  13294. "coproductdisplay",
  13295. 0x2210,
  13296. "coproducttext",
  13297. 0x2210,
  13298. "floorleftBig",
  13299. 0x230a,
  13300. "floorleftbig",
  13301. 0x230a,
  13302. "floorleftbigg",
  13303. 0x230a,
  13304. "floorleftBigg",
  13305. 0x230a,
  13306. "floorrightbig",
  13307. 0x230b,
  13308. "floorrightBig",
  13309. 0x230b,
  13310. "floorrightBigg",
  13311. 0x230b,
  13312. "floorrightbigg",
  13313. 0x230b,
  13314. "hatwide",
  13315. 0x0302,
  13316. "hatwider",
  13317. 0x0302,
  13318. "hatwidest",
  13319. 0x0302,
  13320. "intercal",
  13321. 0x1d40,
  13322. "integraldisplay",
  13323. 0x222b,
  13324. "integraltext",
  13325. 0x222b,
  13326. "intersectiondisplay",
  13327. 0x22c2,
  13328. "intersectiontext",
  13329. 0x22c2,
  13330. "logicalanddisplay",
  13331. 0x2227,
  13332. "logicalandtext",
  13333. 0x2227,
  13334. "logicalordisplay",
  13335. 0x2228,
  13336. "logicalortext",
  13337. 0x2228,
  13338. "parenleftBig",
  13339. 0x0028,
  13340. "parenleftbig",
  13341. 0x0028,
  13342. "parenleftBigg",
  13343. 0x0028,
  13344. "parenleftbigg",
  13345. 0x0028,
  13346. "parenrightBig",
  13347. 0x0029,
  13348. "parenrightbig",
  13349. 0x0029,
  13350. "parenrightBigg",
  13351. 0x0029,
  13352. "parenrightbigg",
  13353. 0x0029,
  13354. "prime",
  13355. 0x2032,
  13356. "productdisplay",
  13357. 0x220f,
  13358. "producttext",
  13359. 0x220f,
  13360. "radicalbig",
  13361. 0x221a,
  13362. "radicalBig",
  13363. 0x221a,
  13364. "radicalBigg",
  13365. 0x221a,
  13366. "radicalbigg",
  13367. 0x221a,
  13368. "radicalbt",
  13369. 0x221a,
  13370. "radicaltp",
  13371. 0x221a,
  13372. "radicalvertex",
  13373. 0x221a,
  13374. "slashbig",
  13375. 0x002f,
  13376. "slashBig",
  13377. 0x002f,
  13378. "slashBigg",
  13379. 0x002f,
  13380. "slashbigg",
  13381. 0x002f,
  13382. "summationdisplay",
  13383. 0x2211,
  13384. "summationtext",
  13385. 0x2211,
  13386. "tildewide",
  13387. 0x02dc,
  13388. "tildewider",
  13389. 0x02dc,
  13390. "tildewidest",
  13391. 0x02dc,
  13392. "uniondisplay",
  13393. 0x22c3,
  13394. "unionmultidisplay",
  13395. 0x228e,
  13396. "unionmultitext",
  13397. 0x228e,
  13398. "unionsqdisplay",
  13399. 0x2294,
  13400. "unionsqtext",
  13401. 0x2294,
  13402. "uniontext",
  13403. 0x22c3,
  13404. "vextenddouble",
  13405. 0x2225,
  13406. "vextendsingle",
  13407. 0x2223
  13408. ];
  13409. });
  13410. const getDingbatsGlyphsUnicode = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getArrayLookupTableFactory)(function () {
  13411. return [
  13412. "space",
  13413. 0x0020,
  13414. "a1",
  13415. 0x2701,
  13416. "a2",
  13417. 0x2702,
  13418. "a202",
  13419. 0x2703,
  13420. "a3",
  13421. 0x2704,
  13422. "a4",
  13423. 0x260e,
  13424. "a5",
  13425. 0x2706,
  13426. "a119",
  13427. 0x2707,
  13428. "a118",
  13429. 0x2708,
  13430. "a117",
  13431. 0x2709,
  13432. "a11",
  13433. 0x261b,
  13434. "a12",
  13435. 0x261e,
  13436. "a13",
  13437. 0x270c,
  13438. "a14",
  13439. 0x270d,
  13440. "a15",
  13441. 0x270e,
  13442. "a16",
  13443. 0x270f,
  13444. "a105",
  13445. 0x2710,
  13446. "a17",
  13447. 0x2711,
  13448. "a18",
  13449. 0x2712,
  13450. "a19",
  13451. 0x2713,
  13452. "a20",
  13453. 0x2714,
  13454. "a21",
  13455. 0x2715,
  13456. "a22",
  13457. 0x2716,
  13458. "a23",
  13459. 0x2717,
  13460. "a24",
  13461. 0x2718,
  13462. "a25",
  13463. 0x2719,
  13464. "a26",
  13465. 0x271a,
  13466. "a27",
  13467. 0x271b,
  13468. "a28",
  13469. 0x271c,
  13470. "a6",
  13471. 0x271d,
  13472. "a7",
  13473. 0x271e,
  13474. "a8",
  13475. 0x271f,
  13476. "a9",
  13477. 0x2720,
  13478. "a10",
  13479. 0x2721,
  13480. "a29",
  13481. 0x2722,
  13482. "a30",
  13483. 0x2723,
  13484. "a31",
  13485. 0x2724,
  13486. "a32",
  13487. 0x2725,
  13488. "a33",
  13489. 0x2726,
  13490. "a34",
  13491. 0x2727,
  13492. "a35",
  13493. 0x2605,
  13494. "a36",
  13495. 0x2729,
  13496. "a37",
  13497. 0x272a,
  13498. "a38",
  13499. 0x272b,
  13500. "a39",
  13501. 0x272c,
  13502. "a40",
  13503. 0x272d,
  13504. "a41",
  13505. 0x272e,
  13506. "a42",
  13507. 0x272f,
  13508. "a43",
  13509. 0x2730,
  13510. "a44",
  13511. 0x2731,
  13512. "a45",
  13513. 0x2732,
  13514. "a46",
  13515. 0x2733,
  13516. "a47",
  13517. 0x2734,
  13518. "a48",
  13519. 0x2735,
  13520. "a49",
  13521. 0x2736,
  13522. "a50",
  13523. 0x2737,
  13524. "a51",
  13525. 0x2738,
  13526. "a52",
  13527. 0x2739,
  13528. "a53",
  13529. 0x273a,
  13530. "a54",
  13531. 0x273b,
  13532. "a55",
  13533. 0x273c,
  13534. "a56",
  13535. 0x273d,
  13536. "a57",
  13537. 0x273e,
  13538. "a58",
  13539. 0x273f,
  13540. "a59",
  13541. 0x2740,
  13542. "a60",
  13543. 0x2741,
  13544. "a61",
  13545. 0x2742,
  13546. "a62",
  13547. 0x2743,
  13548. "a63",
  13549. 0x2744,
  13550. "a64",
  13551. 0x2745,
  13552. "a65",
  13553. 0x2746,
  13554. "a66",
  13555. 0x2747,
  13556. "a67",
  13557. 0x2748,
  13558. "a68",
  13559. 0x2749,
  13560. "a69",
  13561. 0x274a,
  13562. "a70",
  13563. 0x274b,
  13564. "a71",
  13565. 0x25cf,
  13566. "a72",
  13567. 0x274d,
  13568. "a73",
  13569. 0x25a0,
  13570. "a74",
  13571. 0x274f,
  13572. "a203",
  13573. 0x2750,
  13574. "a75",
  13575. 0x2751,
  13576. "a204",
  13577. 0x2752,
  13578. "a76",
  13579. 0x25b2,
  13580. "a77",
  13581. 0x25bc,
  13582. "a78",
  13583. 0x25c6,
  13584. "a79",
  13585. 0x2756,
  13586. "a81",
  13587. 0x25d7,
  13588. "a82",
  13589. 0x2758,
  13590. "a83",
  13591. 0x2759,
  13592. "a84",
  13593. 0x275a,
  13594. "a97",
  13595. 0x275b,
  13596. "a98",
  13597. 0x275c,
  13598. "a99",
  13599. 0x275d,
  13600. "a100",
  13601. 0x275e,
  13602. "a101",
  13603. 0x2761,
  13604. "a102",
  13605. 0x2762,
  13606. "a103",
  13607. 0x2763,
  13608. "a104",
  13609. 0x2764,
  13610. "a106",
  13611. 0x2765,
  13612. "a107",
  13613. 0x2766,
  13614. "a108",
  13615. 0x2767,
  13616. "a112",
  13617. 0x2663,
  13618. "a111",
  13619. 0x2666,
  13620. "a110",
  13621. 0x2665,
  13622. "a109",
  13623. 0x2660,
  13624. "a120",
  13625. 0x2460,
  13626. "a121",
  13627. 0x2461,
  13628. "a122",
  13629. 0x2462,
  13630. "a123",
  13631. 0x2463,
  13632. "a124",
  13633. 0x2464,
  13634. "a125",
  13635. 0x2465,
  13636. "a126",
  13637. 0x2466,
  13638. "a127",
  13639. 0x2467,
  13640. "a128",
  13641. 0x2468,
  13642. "a129",
  13643. 0x2469,
  13644. "a130",
  13645. 0x2776,
  13646. "a131",
  13647. 0x2777,
  13648. "a132",
  13649. 0x2778,
  13650. "a133",
  13651. 0x2779,
  13652. "a134",
  13653. 0x277a,
  13654. "a135",
  13655. 0x277b,
  13656. "a136",
  13657. 0x277c,
  13658. "a137",
  13659. 0x277d,
  13660. "a138",
  13661. 0x277e,
  13662. "a139",
  13663. 0x277f,
  13664. "a140",
  13665. 0x2780,
  13666. "a141",
  13667. 0x2781,
  13668. "a142",
  13669. 0x2782,
  13670. "a143",
  13671. 0x2783,
  13672. "a144",
  13673. 0x2784,
  13674. "a145",
  13675. 0x2785,
  13676. "a146",
  13677. 0x2786,
  13678. "a147",
  13679. 0x2787,
  13680. "a148",
  13681. 0x2788,
  13682. "a149",
  13683. 0x2789,
  13684. "a150",
  13685. 0x278a,
  13686. "a151",
  13687. 0x278b,
  13688. "a152",
  13689. 0x278c,
  13690. "a153",
  13691. 0x278d,
  13692. "a154",
  13693. 0x278e,
  13694. "a155",
  13695. 0x278f,
  13696. "a156",
  13697. 0x2790,
  13698. "a157",
  13699. 0x2791,
  13700. "a158",
  13701. 0x2792,
  13702. "a159",
  13703. 0x2793,
  13704. "a160",
  13705. 0x2794,
  13706. "a161",
  13707. 0x2192,
  13708. "a163",
  13709. 0x2194,
  13710. "a164",
  13711. 0x2195,
  13712. "a196",
  13713. 0x2798,
  13714. "a165",
  13715. 0x2799,
  13716. "a192",
  13717. 0x279a,
  13718. "a166",
  13719. 0x279b,
  13720. "a167",
  13721. 0x279c,
  13722. "a168",
  13723. 0x279d,
  13724. "a169",
  13725. 0x279e,
  13726. "a170",
  13727. 0x279f,
  13728. "a171",
  13729. 0x27a0,
  13730. "a172",
  13731. 0x27a1,
  13732. "a173",
  13733. 0x27a2,
  13734. "a162",
  13735. 0x27a3,
  13736. "a174",
  13737. 0x27a4,
  13738. "a175",
  13739. 0x27a5,
  13740. "a176",
  13741. 0x27a6,
  13742. "a177",
  13743. 0x27a7,
  13744. "a178",
  13745. 0x27a8,
  13746. "a179",
  13747. 0x27a9,
  13748. "a193",
  13749. 0x27aa,
  13750. "a180",
  13751. 0x27ab,
  13752. "a199",
  13753. 0x27ac,
  13754. "a181",
  13755. 0x27ad,
  13756. "a200",
  13757. 0x27ae,
  13758. "a182",
  13759. 0x27af,
  13760. "a201",
  13761. 0x27b1,
  13762. "a183",
  13763. 0x27b2,
  13764. "a184",
  13765. 0x27b3,
  13766. "a197",
  13767. 0x27b4,
  13768. "a185",
  13769. 0x27b5,
  13770. "a194",
  13771. 0x27b6,
  13772. "a198",
  13773. 0x27b7,
  13774. "a186",
  13775. 0x27b8,
  13776. "a195",
  13777. 0x27b9,
  13778. "a187",
  13779. 0x27ba,
  13780. "a188",
  13781. 0x27bb,
  13782. "a189",
  13783. 0x27bc,
  13784. "a190",
  13785. 0x27bd,
  13786. "a191",
  13787. 0x27be,
  13788. "a89",
  13789. 0x2768,
  13790. "a90",
  13791. 0x2769,
  13792. "a93",
  13793. 0x276a,
  13794. "a94",
  13795. 0x276b,
  13796. "a91",
  13797. 0x276c,
  13798. "a92",
  13799. 0x276d,
  13800. "a205",
  13801. 0x276e,
  13802. "a85",
  13803. 0x276f,
  13804. "a206",
  13805. 0x2770,
  13806. "a86",
  13807. 0x2771,
  13808. "a87",
  13809. 0x2772,
  13810. "a88",
  13811. 0x2773,
  13812. "a95",
  13813. 0x2774,
  13814. "a96",
  13815. 0x2775,
  13816. ".notdef",
  13817. 0x0000
  13818. ];
  13819. });
  13820. /***/ }),
  13821. /* 21 */
  13822. /***/ ((__unused_webpack_module, __webpack_exports__, __w_pdfjs_require__) => {
  13823. __w_pdfjs_require__.r(__webpack_exports__);
  13824. /* harmony export */ __w_pdfjs_require__.d(__webpack_exports__, {
  13825. /* harmony export */ "clearUnicodeCaches": () => (/* binding */ clearUnicodeCaches),
  13826. /* harmony export */ "getCharUnicodeCategory": () => (/* binding */ getCharUnicodeCategory),
  13827. /* harmony export */ "getNormalizedUnicodes": () => (/* binding */ getNormalizedUnicodes),
  13828. /* harmony export */ "getUnicodeForGlyph": () => (/* binding */ getUnicodeForGlyph),
  13829. /* harmony export */ "getUnicodeRangeFor": () => (/* binding */ getUnicodeRangeFor),
  13830. /* harmony export */ "mapSpecialUnicodeValues": () => (/* binding */ mapSpecialUnicodeValues),
  13831. /* harmony export */ "reverseIfRtl": () => (/* binding */ reverseIfRtl)
  13832. /* harmony export */ });
  13833. /* harmony import */ var _core_utils_js__WEBPACK_IMPORTED_MODULE_0__ = __w_pdfjs_require__(6);
  13834. const getSpecialPUASymbols = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getLookupTableFactory)(function (t) {
  13835. t[63721] = 0x00a9;
  13836. t[63193] = 0x00a9;
  13837. t[63720] = 0x00ae;
  13838. t[63194] = 0x00ae;
  13839. t[63722] = 0x2122;
  13840. t[63195] = 0x2122;
  13841. t[63729] = 0x23a7;
  13842. t[63730] = 0x23a8;
  13843. t[63731] = 0x23a9;
  13844. t[63740] = 0x23ab;
  13845. t[63741] = 0x23ac;
  13846. t[63742] = 0x23ad;
  13847. t[63726] = 0x23a1;
  13848. t[63727] = 0x23a2;
  13849. t[63728] = 0x23a3;
  13850. t[63737] = 0x23a4;
  13851. t[63738] = 0x23a5;
  13852. t[63739] = 0x23a6;
  13853. t[63723] = 0x239b;
  13854. t[63724] = 0x239c;
  13855. t[63725] = 0x239d;
  13856. t[63734] = 0x239e;
  13857. t[63735] = 0x239f;
  13858. t[63736] = 0x23a0;
  13859. });
  13860. function mapSpecialUnicodeValues(code) {
  13861. if (code >= 0xfff0 && code <= 0xffff) {
  13862. return 0;
  13863. } else if (code >= 0xf600 && code <= 0xf8ff) {
  13864. return getSpecialPUASymbols()[code] || code;
  13865. } else if (code === 0x00ad) {
  13866. return 0x002d;
  13867. }
  13868. return code;
  13869. }
  13870. function getUnicodeForGlyph(name, glyphsUnicodeMap) {
  13871. let unicode = glyphsUnicodeMap[name];
  13872. if (unicode !== undefined) {
  13873. return unicode;
  13874. }
  13875. if (!name) {
  13876. return -1;
  13877. }
  13878. if (name[0] === "u") {
  13879. const nameLen = name.length;
  13880. let hexStr;
  13881. if (nameLen === 7 && name[1] === "n" && name[2] === "i") {
  13882. hexStr = name.substring(3);
  13883. } else if (nameLen >= 5 && nameLen <= 7) {
  13884. hexStr = name.substring(1);
  13885. } else {
  13886. return -1;
  13887. }
  13888. if (hexStr === hexStr.toUpperCase()) {
  13889. unicode = parseInt(hexStr, 16);
  13890. if (unicode >= 0) {
  13891. return unicode;
  13892. }
  13893. }
  13894. }
  13895. return -1;
  13896. }
  13897. const UnicodeRanges = [
  13898. {
  13899. begin: 0x0000,
  13900. end: 0x007f
  13901. },
  13902. {
  13903. begin: 0x0080,
  13904. end: 0x00ff
  13905. },
  13906. {
  13907. begin: 0x0100,
  13908. end: 0x017f
  13909. },
  13910. {
  13911. begin: 0x0180,
  13912. end: 0x024f
  13913. },
  13914. {
  13915. begin: 0x0250,
  13916. end: 0x02af
  13917. },
  13918. {
  13919. begin: 0x02b0,
  13920. end: 0x02ff
  13921. },
  13922. {
  13923. begin: 0x0300,
  13924. end: 0x036f
  13925. },
  13926. {
  13927. begin: 0x0370,
  13928. end: 0x03ff
  13929. },
  13930. {
  13931. begin: 0x2c80,
  13932. end: 0x2cff
  13933. },
  13934. {
  13935. begin: 0x0400,
  13936. end: 0x04ff
  13937. },
  13938. {
  13939. begin: 0x0530,
  13940. end: 0x058f
  13941. },
  13942. {
  13943. begin: 0x0590,
  13944. end: 0x05ff
  13945. },
  13946. {
  13947. begin: 0xa500,
  13948. end: 0xa63f
  13949. },
  13950. {
  13951. begin: 0x0600,
  13952. end: 0x06ff
  13953. },
  13954. {
  13955. begin: 0x07c0,
  13956. end: 0x07ff
  13957. },
  13958. {
  13959. begin: 0x0900,
  13960. end: 0x097f
  13961. },
  13962. {
  13963. begin: 0x0980,
  13964. end: 0x09ff
  13965. },
  13966. {
  13967. begin: 0x0a00,
  13968. end: 0x0a7f
  13969. },
  13970. {
  13971. begin: 0x0a80,
  13972. end: 0x0aff
  13973. },
  13974. {
  13975. begin: 0x0b00,
  13976. end: 0x0b7f
  13977. },
  13978. {
  13979. begin: 0x0b80,
  13980. end: 0x0bff
  13981. },
  13982. {
  13983. begin: 0x0c00,
  13984. end: 0x0c7f
  13985. },
  13986. {
  13987. begin: 0x0c80,
  13988. end: 0x0cff
  13989. },
  13990. {
  13991. begin: 0x0d00,
  13992. end: 0x0d7f
  13993. },
  13994. {
  13995. begin: 0x0e00,
  13996. end: 0x0e7f
  13997. },
  13998. {
  13999. begin: 0x0e80,
  14000. end: 0x0eff
  14001. },
  14002. {
  14003. begin: 0x10a0,
  14004. end: 0x10ff
  14005. },
  14006. {
  14007. begin: 0x1b00,
  14008. end: 0x1b7f
  14009. },
  14010. {
  14011. begin: 0x1100,
  14012. end: 0x11ff
  14013. },
  14014. {
  14015. begin: 0x1e00,
  14016. end: 0x1eff
  14017. },
  14018. {
  14019. begin: 0x1f00,
  14020. end: 0x1fff
  14021. },
  14022. {
  14023. begin: 0x2000,
  14024. end: 0x206f
  14025. },
  14026. {
  14027. begin: 0x2070,
  14028. end: 0x209f
  14029. },
  14030. {
  14031. begin: 0x20a0,
  14032. end: 0x20cf
  14033. },
  14034. {
  14035. begin: 0x20d0,
  14036. end: 0x20ff
  14037. },
  14038. {
  14039. begin: 0x2100,
  14040. end: 0x214f
  14041. },
  14042. {
  14043. begin: 0x2150,
  14044. end: 0x218f
  14045. },
  14046. {
  14047. begin: 0x2190,
  14048. end: 0x21ff
  14049. },
  14050. {
  14051. begin: 0x2200,
  14052. end: 0x22ff
  14053. },
  14054. {
  14055. begin: 0x2300,
  14056. end: 0x23ff
  14057. },
  14058. {
  14059. begin: 0x2400,
  14060. end: 0x243f
  14061. },
  14062. {
  14063. begin: 0x2440,
  14064. end: 0x245f
  14065. },
  14066. {
  14067. begin: 0x2460,
  14068. end: 0x24ff
  14069. },
  14070. {
  14071. begin: 0x2500,
  14072. end: 0x257f
  14073. },
  14074. {
  14075. begin: 0x2580,
  14076. end: 0x259f
  14077. },
  14078. {
  14079. begin: 0x25a0,
  14080. end: 0x25ff
  14081. },
  14082. {
  14083. begin: 0x2600,
  14084. end: 0x26ff
  14085. },
  14086. {
  14087. begin: 0x2700,
  14088. end: 0x27bf
  14089. },
  14090. {
  14091. begin: 0x3000,
  14092. end: 0x303f
  14093. },
  14094. {
  14095. begin: 0x3040,
  14096. end: 0x309f
  14097. },
  14098. {
  14099. begin: 0x30a0,
  14100. end: 0x30ff
  14101. },
  14102. {
  14103. begin: 0x3100,
  14104. end: 0x312f
  14105. },
  14106. {
  14107. begin: 0x3130,
  14108. end: 0x318f
  14109. },
  14110. {
  14111. begin: 0xa840,
  14112. end: 0xa87f
  14113. },
  14114. {
  14115. begin: 0x3200,
  14116. end: 0x32ff
  14117. },
  14118. {
  14119. begin: 0x3300,
  14120. end: 0x33ff
  14121. },
  14122. {
  14123. begin: 0xac00,
  14124. end: 0xd7af
  14125. },
  14126. {
  14127. begin: 0xd800,
  14128. end: 0xdfff
  14129. },
  14130. {
  14131. begin: 0x10900,
  14132. end: 0x1091f
  14133. },
  14134. {
  14135. begin: 0x4e00,
  14136. end: 0x9fff
  14137. },
  14138. {
  14139. begin: 0xe000,
  14140. end: 0xf8ff
  14141. },
  14142. {
  14143. begin: 0x31c0,
  14144. end: 0x31ef
  14145. },
  14146. {
  14147. begin: 0xfb00,
  14148. end: 0xfb4f
  14149. },
  14150. {
  14151. begin: 0xfb50,
  14152. end: 0xfdff
  14153. },
  14154. {
  14155. begin: 0xfe20,
  14156. end: 0xfe2f
  14157. },
  14158. {
  14159. begin: 0xfe10,
  14160. end: 0xfe1f
  14161. },
  14162. {
  14163. begin: 0xfe50,
  14164. end: 0xfe6f
  14165. },
  14166. {
  14167. begin: 0xfe70,
  14168. end: 0xfeff
  14169. },
  14170. {
  14171. begin: 0xff00,
  14172. end: 0xffef
  14173. },
  14174. {
  14175. begin: 0xfff0,
  14176. end: 0xffff
  14177. },
  14178. {
  14179. begin: 0x0f00,
  14180. end: 0x0fff
  14181. },
  14182. {
  14183. begin: 0x0700,
  14184. end: 0x074f
  14185. },
  14186. {
  14187. begin: 0x0780,
  14188. end: 0x07bf
  14189. },
  14190. {
  14191. begin: 0x0d80,
  14192. end: 0x0dff
  14193. },
  14194. {
  14195. begin: 0x1000,
  14196. end: 0x109f
  14197. },
  14198. {
  14199. begin: 0x1200,
  14200. end: 0x137f
  14201. },
  14202. {
  14203. begin: 0x13a0,
  14204. end: 0x13ff
  14205. },
  14206. {
  14207. begin: 0x1400,
  14208. end: 0x167f
  14209. },
  14210. {
  14211. begin: 0x1680,
  14212. end: 0x169f
  14213. },
  14214. {
  14215. begin: 0x16a0,
  14216. end: 0x16ff
  14217. },
  14218. {
  14219. begin: 0x1780,
  14220. end: 0x17ff
  14221. },
  14222. {
  14223. begin: 0x1800,
  14224. end: 0x18af
  14225. },
  14226. {
  14227. begin: 0x2800,
  14228. end: 0x28ff
  14229. },
  14230. {
  14231. begin: 0xa000,
  14232. end: 0xa48f
  14233. },
  14234. {
  14235. begin: 0x1700,
  14236. end: 0x171f
  14237. },
  14238. {
  14239. begin: 0x10300,
  14240. end: 0x1032f
  14241. },
  14242. {
  14243. begin: 0x10330,
  14244. end: 0x1034f
  14245. },
  14246. {
  14247. begin: 0x10400,
  14248. end: 0x1044f
  14249. },
  14250. {
  14251. begin: 0x1d000,
  14252. end: 0x1d0ff
  14253. },
  14254. {
  14255. begin: 0x1d400,
  14256. end: 0x1d7ff
  14257. },
  14258. {
  14259. begin: 0xff000,
  14260. end: 0xffffd
  14261. },
  14262. {
  14263. begin: 0xfe00,
  14264. end: 0xfe0f
  14265. },
  14266. {
  14267. begin: 0xe0000,
  14268. end: 0xe007f
  14269. },
  14270. {
  14271. begin: 0x1900,
  14272. end: 0x194f
  14273. },
  14274. {
  14275. begin: 0x1950,
  14276. end: 0x197f
  14277. },
  14278. {
  14279. begin: 0x1980,
  14280. end: 0x19df
  14281. },
  14282. {
  14283. begin: 0x1a00,
  14284. end: 0x1a1f
  14285. },
  14286. {
  14287. begin: 0x2c00,
  14288. end: 0x2c5f
  14289. },
  14290. {
  14291. begin: 0x2d30,
  14292. end: 0x2d7f
  14293. },
  14294. {
  14295. begin: 0x4dc0,
  14296. end: 0x4dff
  14297. },
  14298. {
  14299. begin: 0xa800,
  14300. end: 0xa82f
  14301. },
  14302. {
  14303. begin: 0x10000,
  14304. end: 0x1007f
  14305. },
  14306. {
  14307. begin: 0x10140,
  14308. end: 0x1018f
  14309. },
  14310. {
  14311. begin: 0x10380,
  14312. end: 0x1039f
  14313. },
  14314. {
  14315. begin: 0x103a0,
  14316. end: 0x103df
  14317. },
  14318. {
  14319. begin: 0x10450,
  14320. end: 0x1047f
  14321. },
  14322. {
  14323. begin: 0x10480,
  14324. end: 0x104af
  14325. },
  14326. {
  14327. begin: 0x10800,
  14328. end: 0x1083f
  14329. },
  14330. {
  14331. begin: 0x10a00,
  14332. end: 0x10a5f
  14333. },
  14334. {
  14335. begin: 0x1d300,
  14336. end: 0x1d35f
  14337. },
  14338. {
  14339. begin: 0x12000,
  14340. end: 0x123ff
  14341. },
  14342. {
  14343. begin: 0x1d360,
  14344. end: 0x1d37f
  14345. },
  14346. {
  14347. begin: 0x1b80,
  14348. end: 0x1bbf
  14349. },
  14350. {
  14351. begin: 0x1c00,
  14352. end: 0x1c4f
  14353. },
  14354. {
  14355. begin: 0x1c50,
  14356. end: 0x1c7f
  14357. },
  14358. {
  14359. begin: 0xa880,
  14360. end: 0xa8df
  14361. },
  14362. {
  14363. begin: 0xa900,
  14364. end: 0xa92f
  14365. },
  14366. {
  14367. begin: 0xa930,
  14368. end: 0xa95f
  14369. },
  14370. {
  14371. begin: 0xaa00,
  14372. end: 0xaa5f
  14373. },
  14374. {
  14375. begin: 0x10190,
  14376. end: 0x101cf
  14377. },
  14378. {
  14379. begin: 0x101d0,
  14380. end: 0x101ff
  14381. },
  14382. {
  14383. begin: 0x102a0,
  14384. end: 0x102df
  14385. },
  14386. {
  14387. begin: 0x1f030,
  14388. end: 0x1f09f
  14389. }
  14390. ];
  14391. function getUnicodeRangeFor(value) {
  14392. for (let i = 0, ii = UnicodeRanges.length; i < ii; i++) {
  14393. const range = UnicodeRanges[i];
  14394. if (value >= range.begin && value < range.end) {
  14395. return i;
  14396. }
  14397. }
  14398. return -1;
  14399. }
  14400. function isRTLRangeFor(value) {
  14401. let range = UnicodeRanges[13];
  14402. if (value >= range.begin && value < range.end) {
  14403. return true;
  14404. }
  14405. range = UnicodeRanges[11];
  14406. if (value >= range.begin && value < range.end) {
  14407. return true;
  14408. }
  14409. return false;
  14410. }
  14411. const getNormalizedUnicodes = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getArrayLookupTableFactory)(function () {
  14412. return [
  14413. "\u00A8",
  14414. "\u0020\u0308",
  14415. "\u00AF",
  14416. "\u0020\u0304",
  14417. "\u00B4",
  14418. "\u0020\u0301",
  14419. "\u00B5",
  14420. "\u03BC",
  14421. "\u00B8",
  14422. "\u0020\u0327",
  14423. "\u0132",
  14424. "\u0049\u004A",
  14425. "\u0133",
  14426. "\u0069\u006A",
  14427. "\u013F",
  14428. "\u004C\u00B7",
  14429. "\u0140",
  14430. "\u006C\u00B7",
  14431. "\u0149",
  14432. "\u02BC\u006E",
  14433. "\u017F",
  14434. "\u0073",
  14435. "\u01C4",
  14436. "\u0044\u017D",
  14437. "\u01C5",
  14438. "\u0044\u017E",
  14439. "\u01C6",
  14440. "\u0064\u017E",
  14441. "\u01C7",
  14442. "\u004C\u004A",
  14443. "\u01C8",
  14444. "\u004C\u006A",
  14445. "\u01C9",
  14446. "\u006C\u006A",
  14447. "\u01CA",
  14448. "\u004E\u004A",
  14449. "\u01CB",
  14450. "\u004E\u006A",
  14451. "\u01CC",
  14452. "\u006E\u006A",
  14453. "\u01F1",
  14454. "\u0044\u005A",
  14455. "\u01F2",
  14456. "\u0044\u007A",
  14457. "\u01F3",
  14458. "\u0064\u007A",
  14459. "\u02D8",
  14460. "\u0020\u0306",
  14461. "\u02D9",
  14462. "\u0020\u0307",
  14463. "\u02DA",
  14464. "\u0020\u030A",
  14465. "\u02DB",
  14466. "\u0020\u0328",
  14467. "\u02DC",
  14468. "\u0020\u0303",
  14469. "\u02DD",
  14470. "\u0020\u030B",
  14471. "\u037A",
  14472. "\u0020\u0345",
  14473. "\u0384",
  14474. "\u0020\u0301",
  14475. "\u03D0",
  14476. "\u03B2",
  14477. "\u03D1",
  14478. "\u03B8",
  14479. "\u03D2",
  14480. "\u03A5",
  14481. "\u03D5",
  14482. "\u03C6",
  14483. "\u03D6",
  14484. "\u03C0",
  14485. "\u03F0",
  14486. "\u03BA",
  14487. "\u03F1",
  14488. "\u03C1",
  14489. "\u03F2",
  14490. "\u03C2",
  14491. "\u03F4",
  14492. "\u0398",
  14493. "\u03F5",
  14494. "\u03B5",
  14495. "\u03F9",
  14496. "\u03A3",
  14497. "\u0587",
  14498. "\u0565\u0582",
  14499. "\u0675",
  14500. "\u0627\u0674",
  14501. "\u0676",
  14502. "\u0648\u0674",
  14503. "\u0677",
  14504. "\u06C7\u0674",
  14505. "\u0678",
  14506. "\u064A\u0674",
  14507. "\u0E33",
  14508. "\u0E4D\u0E32",
  14509. "\u0EB3",
  14510. "\u0ECD\u0EB2",
  14511. "\u0EDC",
  14512. "\u0EAB\u0E99",
  14513. "\u0EDD",
  14514. "\u0EAB\u0EA1",
  14515. "\u0F77",
  14516. "\u0FB2\u0F81",
  14517. "\u0F79",
  14518. "\u0FB3\u0F81",
  14519. "\u1E9A",
  14520. "\u0061\u02BE",
  14521. "\u1FBD",
  14522. "\u0020\u0313",
  14523. "\u1FBF",
  14524. "\u0020\u0313",
  14525. "\u1FC0",
  14526. "\u0020\u0342",
  14527. "\u1FFE",
  14528. "\u0020\u0314",
  14529. "\u2002",
  14530. "\u0020",
  14531. "\u2003",
  14532. "\u0020",
  14533. "\u2004",
  14534. "\u0020",
  14535. "\u2005",
  14536. "\u0020",
  14537. "\u2006",
  14538. "\u0020",
  14539. "\u2008",
  14540. "\u0020",
  14541. "\u2009",
  14542. "\u0020",
  14543. "\u200A",
  14544. "\u0020",
  14545. "\u2017",
  14546. "\u0020\u0333",
  14547. "\u2024",
  14548. "\u002E",
  14549. "\u2025",
  14550. "\u002E\u002E",
  14551. "\u2026",
  14552. "\u002E\u002E\u002E",
  14553. "\u2033",
  14554. "\u2032\u2032",
  14555. "\u2034",
  14556. "\u2032\u2032\u2032",
  14557. "\u2036",
  14558. "\u2035\u2035",
  14559. "\u2037",
  14560. "\u2035\u2035\u2035",
  14561. "\u203C",
  14562. "\u0021\u0021",
  14563. "\u203E",
  14564. "\u0020\u0305",
  14565. "\u2047",
  14566. "\u003F\u003F",
  14567. "\u2048",
  14568. "\u003F\u0021",
  14569. "\u2049",
  14570. "\u0021\u003F",
  14571. "\u2057",
  14572. "\u2032\u2032\u2032\u2032",
  14573. "\u205F",
  14574. "\u0020",
  14575. "\u20A8",
  14576. "\u0052\u0073",
  14577. "\u2100",
  14578. "\u0061\u002F\u0063",
  14579. "\u2101",
  14580. "\u0061\u002F\u0073",
  14581. "\u2103",
  14582. "\u00B0\u0043",
  14583. "\u2105",
  14584. "\u0063\u002F\u006F",
  14585. "\u2106",
  14586. "\u0063\u002F\u0075",
  14587. "\u2107",
  14588. "\u0190",
  14589. "\u2109",
  14590. "\u00B0\u0046",
  14591. "\u2116",
  14592. "\u004E\u006F",
  14593. "\u2121",
  14594. "\u0054\u0045\u004C",
  14595. "\u2135",
  14596. "\u05D0",
  14597. "\u2136",
  14598. "\u05D1",
  14599. "\u2137",
  14600. "\u05D2",
  14601. "\u2138",
  14602. "\u05D3",
  14603. "\u213B",
  14604. "\u0046\u0041\u0058",
  14605. "\u2160",
  14606. "\u0049",
  14607. "\u2161",
  14608. "\u0049\u0049",
  14609. "\u2162",
  14610. "\u0049\u0049\u0049",
  14611. "\u2163",
  14612. "\u0049\u0056",
  14613. "\u2164",
  14614. "\u0056",
  14615. "\u2165",
  14616. "\u0056\u0049",
  14617. "\u2166",
  14618. "\u0056\u0049\u0049",
  14619. "\u2167",
  14620. "\u0056\u0049\u0049\u0049",
  14621. "\u2168",
  14622. "\u0049\u0058",
  14623. "\u2169",
  14624. "\u0058",
  14625. "\u216A",
  14626. "\u0058\u0049",
  14627. "\u216B",
  14628. "\u0058\u0049\u0049",
  14629. "\u216C",
  14630. "\u004C",
  14631. "\u216D",
  14632. "\u0043",
  14633. "\u216E",
  14634. "\u0044",
  14635. "\u216F",
  14636. "\u004D",
  14637. "\u2170",
  14638. "\u0069",
  14639. "\u2171",
  14640. "\u0069\u0069",
  14641. "\u2172",
  14642. "\u0069\u0069\u0069",
  14643. "\u2173",
  14644. "\u0069\u0076",
  14645. "\u2174",
  14646. "\u0076",
  14647. "\u2175",
  14648. "\u0076\u0069",
  14649. "\u2176",
  14650. "\u0076\u0069\u0069",
  14651. "\u2177",
  14652. "\u0076\u0069\u0069\u0069",
  14653. "\u2178",
  14654. "\u0069\u0078",
  14655. "\u2179",
  14656. "\u0078",
  14657. "\u217A",
  14658. "\u0078\u0069",
  14659. "\u217B",
  14660. "\u0078\u0069\u0069",
  14661. "\u217C",
  14662. "\u006C",
  14663. "\u217D",
  14664. "\u0063",
  14665. "\u217E",
  14666. "\u0064",
  14667. "\u217F",
  14668. "\u006D",
  14669. "\u222C",
  14670. "\u222B\u222B",
  14671. "\u222D",
  14672. "\u222B\u222B\u222B",
  14673. "\u222F",
  14674. "\u222E\u222E",
  14675. "\u2230",
  14676. "\u222E\u222E\u222E",
  14677. "\u2474",
  14678. "\u0028\u0031\u0029",
  14679. "\u2475",
  14680. "\u0028\u0032\u0029",
  14681. "\u2476",
  14682. "\u0028\u0033\u0029",
  14683. "\u2477",
  14684. "\u0028\u0034\u0029",
  14685. "\u2478",
  14686. "\u0028\u0035\u0029",
  14687. "\u2479",
  14688. "\u0028\u0036\u0029",
  14689. "\u247A",
  14690. "\u0028\u0037\u0029",
  14691. "\u247B",
  14692. "\u0028\u0038\u0029",
  14693. "\u247C",
  14694. "\u0028\u0039\u0029",
  14695. "\u247D",
  14696. "\u0028\u0031\u0030\u0029",
  14697. "\u247E",
  14698. "\u0028\u0031\u0031\u0029",
  14699. "\u247F",
  14700. "\u0028\u0031\u0032\u0029",
  14701. "\u2480",
  14702. "\u0028\u0031\u0033\u0029",
  14703. "\u2481",
  14704. "\u0028\u0031\u0034\u0029",
  14705. "\u2482",
  14706. "\u0028\u0031\u0035\u0029",
  14707. "\u2483",
  14708. "\u0028\u0031\u0036\u0029",
  14709. "\u2484",
  14710. "\u0028\u0031\u0037\u0029",
  14711. "\u2485",
  14712. "\u0028\u0031\u0038\u0029",
  14713. "\u2486",
  14714. "\u0028\u0031\u0039\u0029",
  14715. "\u2487",
  14716. "\u0028\u0032\u0030\u0029",
  14717. "\u2488",
  14718. "\u0031\u002E",
  14719. "\u2489",
  14720. "\u0032\u002E",
  14721. "\u248A",
  14722. "\u0033\u002E",
  14723. "\u248B",
  14724. "\u0034\u002E",
  14725. "\u248C",
  14726. "\u0035\u002E",
  14727. "\u248D",
  14728. "\u0036\u002E",
  14729. "\u248E",
  14730. "\u0037\u002E",
  14731. "\u248F",
  14732. "\u0038\u002E",
  14733. "\u2490",
  14734. "\u0039\u002E",
  14735. "\u2491",
  14736. "\u0031\u0030\u002E",
  14737. "\u2492",
  14738. "\u0031\u0031\u002E",
  14739. "\u2493",
  14740. "\u0031\u0032\u002E",
  14741. "\u2494",
  14742. "\u0031\u0033\u002E",
  14743. "\u2495",
  14744. "\u0031\u0034\u002E",
  14745. "\u2496",
  14746. "\u0031\u0035\u002E",
  14747. "\u2497",
  14748. "\u0031\u0036\u002E",
  14749. "\u2498",
  14750. "\u0031\u0037\u002E",
  14751. "\u2499",
  14752. "\u0031\u0038\u002E",
  14753. "\u249A",
  14754. "\u0031\u0039\u002E",
  14755. "\u249B",
  14756. "\u0032\u0030\u002E",
  14757. "\u249C",
  14758. "\u0028\u0061\u0029",
  14759. "\u249D",
  14760. "\u0028\u0062\u0029",
  14761. "\u249E",
  14762. "\u0028\u0063\u0029",
  14763. "\u249F",
  14764. "\u0028\u0064\u0029",
  14765. "\u24A0",
  14766. "\u0028\u0065\u0029",
  14767. "\u24A1",
  14768. "\u0028\u0066\u0029",
  14769. "\u24A2",
  14770. "\u0028\u0067\u0029",
  14771. "\u24A3",
  14772. "\u0028\u0068\u0029",
  14773. "\u24A4",
  14774. "\u0028\u0069\u0029",
  14775. "\u24A5",
  14776. "\u0028\u006A\u0029",
  14777. "\u24A6",
  14778. "\u0028\u006B\u0029",
  14779. "\u24A7",
  14780. "\u0028\u006C\u0029",
  14781. "\u24A8",
  14782. "\u0028\u006D\u0029",
  14783. "\u24A9",
  14784. "\u0028\u006E\u0029",
  14785. "\u24AA",
  14786. "\u0028\u006F\u0029",
  14787. "\u24AB",
  14788. "\u0028\u0070\u0029",
  14789. "\u24AC",
  14790. "\u0028\u0071\u0029",
  14791. "\u24AD",
  14792. "\u0028\u0072\u0029",
  14793. "\u24AE",
  14794. "\u0028\u0073\u0029",
  14795. "\u24AF",
  14796. "\u0028\u0074\u0029",
  14797. "\u24B0",
  14798. "\u0028\u0075\u0029",
  14799. "\u24B1",
  14800. "\u0028\u0076\u0029",
  14801. "\u24B2",
  14802. "\u0028\u0077\u0029",
  14803. "\u24B3",
  14804. "\u0028\u0078\u0029",
  14805. "\u24B4",
  14806. "\u0028\u0079\u0029",
  14807. "\u24B5",
  14808. "\u0028\u007A\u0029",
  14809. "\u2A0C",
  14810. "\u222B\u222B\u222B\u222B",
  14811. "\u2A74",
  14812. "\u003A\u003A\u003D",
  14813. "\u2A75",
  14814. "\u003D\u003D",
  14815. "\u2A76",
  14816. "\u003D\u003D\u003D",
  14817. "\u2E9F",
  14818. "\u6BCD",
  14819. "\u2EF3",
  14820. "\u9F9F",
  14821. "\u2F00",
  14822. "\u4E00",
  14823. "\u2F01",
  14824. "\u4E28",
  14825. "\u2F02",
  14826. "\u4E36",
  14827. "\u2F03",
  14828. "\u4E3F",
  14829. "\u2F04",
  14830. "\u4E59",
  14831. "\u2F05",
  14832. "\u4E85",
  14833. "\u2F06",
  14834. "\u4E8C",
  14835. "\u2F07",
  14836. "\u4EA0",
  14837. "\u2F08",
  14838. "\u4EBA",
  14839. "\u2F09",
  14840. "\u513F",
  14841. "\u2F0A",
  14842. "\u5165",
  14843. "\u2F0B",
  14844. "\u516B",
  14845. "\u2F0C",
  14846. "\u5182",
  14847. "\u2F0D",
  14848. "\u5196",
  14849. "\u2F0E",
  14850. "\u51AB",
  14851. "\u2F0F",
  14852. "\u51E0",
  14853. "\u2F10",
  14854. "\u51F5",
  14855. "\u2F11",
  14856. "\u5200",
  14857. "\u2F12",
  14858. "\u529B",
  14859. "\u2F13",
  14860. "\u52F9",
  14861. "\u2F14",
  14862. "\u5315",
  14863. "\u2F15",
  14864. "\u531A",
  14865. "\u2F16",
  14866. "\u5338",
  14867. "\u2F17",
  14868. "\u5341",
  14869. "\u2F18",
  14870. "\u535C",
  14871. "\u2F19",
  14872. "\u5369",
  14873. "\u2F1A",
  14874. "\u5382",
  14875. "\u2F1B",
  14876. "\u53B6",
  14877. "\u2F1C",
  14878. "\u53C8",
  14879. "\u2F1D",
  14880. "\u53E3",
  14881. "\u2F1E",
  14882. "\u56D7",
  14883. "\u2F1F",
  14884. "\u571F",
  14885. "\u2F20",
  14886. "\u58EB",
  14887. "\u2F21",
  14888. "\u5902",
  14889. "\u2F22",
  14890. "\u590A",
  14891. "\u2F23",
  14892. "\u5915",
  14893. "\u2F24",
  14894. "\u5927",
  14895. "\u2F25",
  14896. "\u5973",
  14897. "\u2F26",
  14898. "\u5B50",
  14899. "\u2F27",
  14900. "\u5B80",
  14901. "\u2F28",
  14902. "\u5BF8",
  14903. "\u2F29",
  14904. "\u5C0F",
  14905. "\u2F2A",
  14906. "\u5C22",
  14907. "\u2F2B",
  14908. "\u5C38",
  14909. "\u2F2C",
  14910. "\u5C6E",
  14911. "\u2F2D",
  14912. "\u5C71",
  14913. "\u2F2E",
  14914. "\u5DDB",
  14915. "\u2F2F",
  14916. "\u5DE5",
  14917. "\u2F30",
  14918. "\u5DF1",
  14919. "\u2F31",
  14920. "\u5DFE",
  14921. "\u2F32",
  14922. "\u5E72",
  14923. "\u2F33",
  14924. "\u5E7A",
  14925. "\u2F34",
  14926. "\u5E7F",
  14927. "\u2F35",
  14928. "\u5EF4",
  14929. "\u2F36",
  14930. "\u5EFE",
  14931. "\u2F37",
  14932. "\u5F0B",
  14933. "\u2F38",
  14934. "\u5F13",
  14935. "\u2F39",
  14936. "\u5F50",
  14937. "\u2F3A",
  14938. "\u5F61",
  14939. "\u2F3B",
  14940. "\u5F73",
  14941. "\u2F3C",
  14942. "\u5FC3",
  14943. "\u2F3D",
  14944. "\u6208",
  14945. "\u2F3E",
  14946. "\u6236",
  14947. "\u2F3F",
  14948. "\u624B",
  14949. "\u2F40",
  14950. "\u652F",
  14951. "\u2F41",
  14952. "\u6534",
  14953. "\u2F42",
  14954. "\u6587",
  14955. "\u2F43",
  14956. "\u6597",
  14957. "\u2F44",
  14958. "\u65A4",
  14959. "\u2F45",
  14960. "\u65B9",
  14961. "\u2F46",
  14962. "\u65E0",
  14963. "\u2F47",
  14964. "\u65E5",
  14965. "\u2F48",
  14966. "\u66F0",
  14967. "\u2F49",
  14968. "\u6708",
  14969. "\u2F4A",
  14970. "\u6728",
  14971. "\u2F4B",
  14972. "\u6B20",
  14973. "\u2F4C",
  14974. "\u6B62",
  14975. "\u2F4D",
  14976. "\u6B79",
  14977. "\u2F4E",
  14978. "\u6BB3",
  14979. "\u2F4F",
  14980. "\u6BCB",
  14981. "\u2F50",
  14982. "\u6BD4",
  14983. "\u2F51",
  14984. "\u6BDB",
  14985. "\u2F52",
  14986. "\u6C0F",
  14987. "\u2F53",
  14988. "\u6C14",
  14989. "\u2F54",
  14990. "\u6C34",
  14991. "\u2F55",
  14992. "\u706B",
  14993. "\u2F56",
  14994. "\u722A",
  14995. "\u2F57",
  14996. "\u7236",
  14997. "\u2F58",
  14998. "\u723B",
  14999. "\u2F59",
  15000. "\u723F",
  15001. "\u2F5A",
  15002. "\u7247",
  15003. "\u2F5B",
  15004. "\u7259",
  15005. "\u2F5C",
  15006. "\u725B",
  15007. "\u2F5D",
  15008. "\u72AC",
  15009. "\u2F5E",
  15010. "\u7384",
  15011. "\u2F5F",
  15012. "\u7389",
  15013. "\u2F60",
  15014. "\u74DC",
  15015. "\u2F61",
  15016. "\u74E6",
  15017. "\u2F62",
  15018. "\u7518",
  15019. "\u2F63",
  15020. "\u751F",
  15021. "\u2F64",
  15022. "\u7528",
  15023. "\u2F65",
  15024. "\u7530",
  15025. "\u2F66",
  15026. "\u758B",
  15027. "\u2F67",
  15028. "\u7592",
  15029. "\u2F68",
  15030. "\u7676",
  15031. "\u2F69",
  15032. "\u767D",
  15033. "\u2F6A",
  15034. "\u76AE",
  15035. "\u2F6B",
  15036. "\u76BF",
  15037. "\u2F6C",
  15038. "\u76EE",
  15039. "\u2F6D",
  15040. "\u77DB",
  15041. "\u2F6E",
  15042. "\u77E2",
  15043. "\u2F6F",
  15044. "\u77F3",
  15045. "\u2F70",
  15046. "\u793A",
  15047. "\u2F71",
  15048. "\u79B8",
  15049. "\u2F72",
  15050. "\u79BE",
  15051. "\u2F73",
  15052. "\u7A74",
  15053. "\u2F74",
  15054. "\u7ACB",
  15055. "\u2F75",
  15056. "\u7AF9",
  15057. "\u2F76",
  15058. "\u7C73",
  15059. "\u2F77",
  15060. "\u7CF8",
  15061. "\u2F78",
  15062. "\u7F36",
  15063. "\u2F79",
  15064. "\u7F51",
  15065. "\u2F7A",
  15066. "\u7F8A",
  15067. "\u2F7B",
  15068. "\u7FBD",
  15069. "\u2F7C",
  15070. "\u8001",
  15071. "\u2F7D",
  15072. "\u800C",
  15073. "\u2F7E",
  15074. "\u8012",
  15075. "\u2F7F",
  15076. "\u8033",
  15077. "\u2F80",
  15078. "\u807F",
  15079. "\u2F81",
  15080. "\u8089",
  15081. "\u2F82",
  15082. "\u81E3",
  15083. "\u2F83",
  15084. "\u81EA",
  15085. "\u2F84",
  15086. "\u81F3",
  15087. "\u2F85",
  15088. "\u81FC",
  15089. "\u2F86",
  15090. "\u820C",
  15091. "\u2F87",
  15092. "\u821B",
  15093. "\u2F88",
  15094. "\u821F",
  15095. "\u2F89",
  15096. "\u826E",
  15097. "\u2F8A",
  15098. "\u8272",
  15099. "\u2F8B",
  15100. "\u8278",
  15101. "\u2F8C",
  15102. "\u864D",
  15103. "\u2F8D",
  15104. "\u866B",
  15105. "\u2F8E",
  15106. "\u8840",
  15107. "\u2F8F",
  15108. "\u884C",
  15109. "\u2F90",
  15110. "\u8863",
  15111. "\u2F91",
  15112. "\u897E",
  15113. "\u2F92",
  15114. "\u898B",
  15115. "\u2F93",
  15116. "\u89D2",
  15117. "\u2F94",
  15118. "\u8A00",
  15119. "\u2F95",
  15120. "\u8C37",
  15121. "\u2F96",
  15122. "\u8C46",
  15123. "\u2F97",
  15124. "\u8C55",
  15125. "\u2F98",
  15126. "\u8C78",
  15127. "\u2F99",
  15128. "\u8C9D",
  15129. "\u2F9A",
  15130. "\u8D64",
  15131. "\u2F9B",
  15132. "\u8D70",
  15133. "\u2F9C",
  15134. "\u8DB3",
  15135. "\u2F9D",
  15136. "\u8EAB",
  15137. "\u2F9E",
  15138. "\u8ECA",
  15139. "\u2F9F",
  15140. "\u8F9B",
  15141. "\u2FA0",
  15142. "\u8FB0",
  15143. "\u2FA1",
  15144. "\u8FB5",
  15145. "\u2FA2",
  15146. "\u9091",
  15147. "\u2FA3",
  15148. "\u9149",
  15149. "\u2FA4",
  15150. "\u91C6",
  15151. "\u2FA5",
  15152. "\u91CC",
  15153. "\u2FA6",
  15154. "\u91D1",
  15155. "\u2FA7",
  15156. "\u9577",
  15157. "\u2FA8",
  15158. "\u9580",
  15159. "\u2FA9",
  15160. "\u961C",
  15161. "\u2FAA",
  15162. "\u96B6",
  15163. "\u2FAB",
  15164. "\u96B9",
  15165. "\u2FAC",
  15166. "\u96E8",
  15167. "\u2FAD",
  15168. "\u9751",
  15169. "\u2FAE",
  15170. "\u975E",
  15171. "\u2FAF",
  15172. "\u9762",
  15173. "\u2FB0",
  15174. "\u9769",
  15175. "\u2FB1",
  15176. "\u97CB",
  15177. "\u2FB2",
  15178. "\u97ED",
  15179. "\u2FB3",
  15180. "\u97F3",
  15181. "\u2FB4",
  15182. "\u9801",
  15183. "\u2FB5",
  15184. "\u98A8",
  15185. "\u2FB6",
  15186. "\u98DB",
  15187. "\u2FB7",
  15188. "\u98DF",
  15189. "\u2FB8",
  15190. "\u9996",
  15191. "\u2FB9",
  15192. "\u9999",
  15193. "\u2FBA",
  15194. "\u99AC",
  15195. "\u2FBB",
  15196. "\u9AA8",
  15197. "\u2FBC",
  15198. "\u9AD8",
  15199. "\u2FBD",
  15200. "\u9ADF",
  15201. "\u2FBE",
  15202. "\u9B25",
  15203. "\u2FBF",
  15204. "\u9B2F",
  15205. "\u2FC0",
  15206. "\u9B32",
  15207. "\u2FC1",
  15208. "\u9B3C",
  15209. "\u2FC2",
  15210. "\u9B5A",
  15211. "\u2FC3",
  15212. "\u9CE5",
  15213. "\u2FC4",
  15214. "\u9E75",
  15215. "\u2FC5",
  15216. "\u9E7F",
  15217. "\u2FC6",
  15218. "\u9EA5",
  15219. "\u2FC7",
  15220. "\u9EBB",
  15221. "\u2FC8",
  15222. "\u9EC3",
  15223. "\u2FC9",
  15224. "\u9ECD",
  15225. "\u2FCA",
  15226. "\u9ED1",
  15227. "\u2FCB",
  15228. "\u9EF9",
  15229. "\u2FCC",
  15230. "\u9EFD",
  15231. "\u2FCD",
  15232. "\u9F0E",
  15233. "\u2FCE",
  15234. "\u9F13",
  15235. "\u2FCF",
  15236. "\u9F20",
  15237. "\u2FD0",
  15238. "\u9F3B",
  15239. "\u2FD1",
  15240. "\u9F4A",
  15241. "\u2FD2",
  15242. "\u9F52",
  15243. "\u2FD3",
  15244. "\u9F8D",
  15245. "\u2FD4",
  15246. "\u9F9C",
  15247. "\u2FD5",
  15248. "\u9FA0",
  15249. "\u3036",
  15250. "\u3012",
  15251. "\u3038",
  15252. "\u5341",
  15253. "\u3039",
  15254. "\u5344",
  15255. "\u303A",
  15256. "\u5345",
  15257. "\u309B",
  15258. "\u0020\u3099",
  15259. "\u309C",
  15260. "\u0020\u309A",
  15261. "\u3131",
  15262. "\u1100",
  15263. "\u3132",
  15264. "\u1101",
  15265. "\u3133",
  15266. "\u11AA",
  15267. "\u3134",
  15268. "\u1102",
  15269. "\u3135",
  15270. "\u11AC",
  15271. "\u3136",
  15272. "\u11AD",
  15273. "\u3137",
  15274. "\u1103",
  15275. "\u3138",
  15276. "\u1104",
  15277. "\u3139",
  15278. "\u1105",
  15279. "\u313A",
  15280. "\u11B0",
  15281. "\u313B",
  15282. "\u11B1",
  15283. "\u313C",
  15284. "\u11B2",
  15285. "\u313D",
  15286. "\u11B3",
  15287. "\u313E",
  15288. "\u11B4",
  15289. "\u313F",
  15290. "\u11B5",
  15291. "\u3140",
  15292. "\u111A",
  15293. "\u3141",
  15294. "\u1106",
  15295. "\u3142",
  15296. "\u1107",
  15297. "\u3143",
  15298. "\u1108",
  15299. "\u3144",
  15300. "\u1121",
  15301. "\u3145",
  15302. "\u1109",
  15303. "\u3146",
  15304. "\u110A",
  15305. "\u3147",
  15306. "\u110B",
  15307. "\u3148",
  15308. "\u110C",
  15309. "\u3149",
  15310. "\u110D",
  15311. "\u314A",
  15312. "\u110E",
  15313. "\u314B",
  15314. "\u110F",
  15315. "\u314C",
  15316. "\u1110",
  15317. "\u314D",
  15318. "\u1111",
  15319. "\u314E",
  15320. "\u1112",
  15321. "\u314F",
  15322. "\u1161",
  15323. "\u3150",
  15324. "\u1162",
  15325. "\u3151",
  15326. "\u1163",
  15327. "\u3152",
  15328. "\u1164",
  15329. "\u3153",
  15330. "\u1165",
  15331. "\u3154",
  15332. "\u1166",
  15333. "\u3155",
  15334. "\u1167",
  15335. "\u3156",
  15336. "\u1168",
  15337. "\u3157",
  15338. "\u1169",
  15339. "\u3158",
  15340. "\u116A",
  15341. "\u3159",
  15342. "\u116B",
  15343. "\u315A",
  15344. "\u116C",
  15345. "\u315B",
  15346. "\u116D",
  15347. "\u315C",
  15348. "\u116E",
  15349. "\u315D",
  15350. "\u116F",
  15351. "\u315E",
  15352. "\u1170",
  15353. "\u315F",
  15354. "\u1171",
  15355. "\u3160",
  15356. "\u1172",
  15357. "\u3161",
  15358. "\u1173",
  15359. "\u3162",
  15360. "\u1174",
  15361. "\u3163",
  15362. "\u1175",
  15363. "\u3164",
  15364. "\u1160",
  15365. "\u3165",
  15366. "\u1114",
  15367. "\u3166",
  15368. "\u1115",
  15369. "\u3167",
  15370. "\u11C7",
  15371. "\u3168",
  15372. "\u11C8",
  15373. "\u3169",
  15374. "\u11CC",
  15375. "\u316A",
  15376. "\u11CE",
  15377. "\u316B",
  15378. "\u11D3",
  15379. "\u316C",
  15380. "\u11D7",
  15381. "\u316D",
  15382. "\u11D9",
  15383. "\u316E",
  15384. "\u111C",
  15385. "\u316F",
  15386. "\u11DD",
  15387. "\u3170",
  15388. "\u11DF",
  15389. "\u3171",
  15390. "\u111D",
  15391. "\u3172",
  15392. "\u111E",
  15393. "\u3173",
  15394. "\u1120",
  15395. "\u3174",
  15396. "\u1122",
  15397. "\u3175",
  15398. "\u1123",
  15399. "\u3176",
  15400. "\u1127",
  15401. "\u3177",
  15402. "\u1129",
  15403. "\u3178",
  15404. "\u112B",
  15405. "\u3179",
  15406. "\u112C",
  15407. "\u317A",
  15408. "\u112D",
  15409. "\u317B",
  15410. "\u112E",
  15411. "\u317C",
  15412. "\u112F",
  15413. "\u317D",
  15414. "\u1132",
  15415. "\u317E",
  15416. "\u1136",
  15417. "\u317F",
  15418. "\u1140",
  15419. "\u3180",
  15420. "\u1147",
  15421. "\u3181",
  15422. "\u114C",
  15423. "\u3182",
  15424. "\u11F1",
  15425. "\u3183",
  15426. "\u11F2",
  15427. "\u3184",
  15428. "\u1157",
  15429. "\u3185",
  15430. "\u1158",
  15431. "\u3186",
  15432. "\u1159",
  15433. "\u3187",
  15434. "\u1184",
  15435. "\u3188",
  15436. "\u1185",
  15437. "\u3189",
  15438. "\u1188",
  15439. "\u318A",
  15440. "\u1191",
  15441. "\u318B",
  15442. "\u1192",
  15443. "\u318C",
  15444. "\u1194",
  15445. "\u318D",
  15446. "\u119E",
  15447. "\u318E",
  15448. "\u11A1",
  15449. "\u3200",
  15450. "\u0028\u1100\u0029",
  15451. "\u3201",
  15452. "\u0028\u1102\u0029",
  15453. "\u3202",
  15454. "\u0028\u1103\u0029",
  15455. "\u3203",
  15456. "\u0028\u1105\u0029",
  15457. "\u3204",
  15458. "\u0028\u1106\u0029",
  15459. "\u3205",
  15460. "\u0028\u1107\u0029",
  15461. "\u3206",
  15462. "\u0028\u1109\u0029",
  15463. "\u3207",
  15464. "\u0028\u110B\u0029",
  15465. "\u3208",
  15466. "\u0028\u110C\u0029",
  15467. "\u3209",
  15468. "\u0028\u110E\u0029",
  15469. "\u320A",
  15470. "\u0028\u110F\u0029",
  15471. "\u320B",
  15472. "\u0028\u1110\u0029",
  15473. "\u320C",
  15474. "\u0028\u1111\u0029",
  15475. "\u320D",
  15476. "\u0028\u1112\u0029",
  15477. "\u320E",
  15478. "\u0028\u1100\u1161\u0029",
  15479. "\u320F",
  15480. "\u0028\u1102\u1161\u0029",
  15481. "\u3210",
  15482. "\u0028\u1103\u1161\u0029",
  15483. "\u3211",
  15484. "\u0028\u1105\u1161\u0029",
  15485. "\u3212",
  15486. "\u0028\u1106\u1161\u0029",
  15487. "\u3213",
  15488. "\u0028\u1107\u1161\u0029",
  15489. "\u3214",
  15490. "\u0028\u1109\u1161\u0029",
  15491. "\u3215",
  15492. "\u0028\u110B\u1161\u0029",
  15493. "\u3216",
  15494. "\u0028\u110C\u1161\u0029",
  15495. "\u3217",
  15496. "\u0028\u110E\u1161\u0029",
  15497. "\u3218",
  15498. "\u0028\u110F\u1161\u0029",
  15499. "\u3219",
  15500. "\u0028\u1110\u1161\u0029",
  15501. "\u321A",
  15502. "\u0028\u1111\u1161\u0029",
  15503. "\u321B",
  15504. "\u0028\u1112\u1161\u0029",
  15505. "\u321C",
  15506. "\u0028\u110C\u116E\u0029",
  15507. "\u321D",
  15508. "\u0028\u110B\u1169\u110C\u1165\u11AB\u0029",
  15509. "\u321E",
  15510. "\u0028\u110B\u1169\u1112\u116E\u0029",
  15511. "\u3220",
  15512. "\u0028\u4E00\u0029",
  15513. "\u3221",
  15514. "\u0028\u4E8C\u0029",
  15515. "\u3222",
  15516. "\u0028\u4E09\u0029",
  15517. "\u3223",
  15518. "\u0028\u56DB\u0029",
  15519. "\u3224",
  15520. "\u0028\u4E94\u0029",
  15521. "\u3225",
  15522. "\u0028\u516D\u0029",
  15523. "\u3226",
  15524. "\u0028\u4E03\u0029",
  15525. "\u3227",
  15526. "\u0028\u516B\u0029",
  15527. "\u3228",
  15528. "\u0028\u4E5D\u0029",
  15529. "\u3229",
  15530. "\u0028\u5341\u0029",
  15531. "\u322A",
  15532. "\u0028\u6708\u0029",
  15533. "\u322B",
  15534. "\u0028\u706B\u0029",
  15535. "\u322C",
  15536. "\u0028\u6C34\u0029",
  15537. "\u322D",
  15538. "\u0028\u6728\u0029",
  15539. "\u322E",
  15540. "\u0028\u91D1\u0029",
  15541. "\u322F",
  15542. "\u0028\u571F\u0029",
  15543. "\u3230",
  15544. "\u0028\u65E5\u0029",
  15545. "\u3231",
  15546. "\u0028\u682A\u0029",
  15547. "\u3232",
  15548. "\u0028\u6709\u0029",
  15549. "\u3233",
  15550. "\u0028\u793E\u0029",
  15551. "\u3234",
  15552. "\u0028\u540D\u0029",
  15553. "\u3235",
  15554. "\u0028\u7279\u0029",
  15555. "\u3236",
  15556. "\u0028\u8CA1\u0029",
  15557. "\u3237",
  15558. "\u0028\u795D\u0029",
  15559. "\u3238",
  15560. "\u0028\u52B4\u0029",
  15561. "\u3239",
  15562. "\u0028\u4EE3\u0029",
  15563. "\u323A",
  15564. "\u0028\u547C\u0029",
  15565. "\u323B",
  15566. "\u0028\u5B66\u0029",
  15567. "\u323C",
  15568. "\u0028\u76E3\u0029",
  15569. "\u323D",
  15570. "\u0028\u4F01\u0029",
  15571. "\u323E",
  15572. "\u0028\u8CC7\u0029",
  15573. "\u323F",
  15574. "\u0028\u5354\u0029",
  15575. "\u3240",
  15576. "\u0028\u796D\u0029",
  15577. "\u3241",
  15578. "\u0028\u4F11\u0029",
  15579. "\u3242",
  15580. "\u0028\u81EA\u0029",
  15581. "\u3243",
  15582. "\u0028\u81F3\u0029",
  15583. "\u32C0",
  15584. "\u0031\u6708",
  15585. "\u32C1",
  15586. "\u0032\u6708",
  15587. "\u32C2",
  15588. "\u0033\u6708",
  15589. "\u32C3",
  15590. "\u0034\u6708",
  15591. "\u32C4",
  15592. "\u0035\u6708",
  15593. "\u32C5",
  15594. "\u0036\u6708",
  15595. "\u32C6",
  15596. "\u0037\u6708",
  15597. "\u32C7",
  15598. "\u0038\u6708",
  15599. "\u32C8",
  15600. "\u0039\u6708",
  15601. "\u32C9",
  15602. "\u0031\u0030\u6708",
  15603. "\u32CA",
  15604. "\u0031\u0031\u6708",
  15605. "\u32CB",
  15606. "\u0031\u0032\u6708",
  15607. "\u3358",
  15608. "\u0030\u70B9",
  15609. "\u3359",
  15610. "\u0031\u70B9",
  15611. "\u335A",
  15612. "\u0032\u70B9",
  15613. "\u335B",
  15614. "\u0033\u70B9",
  15615. "\u335C",
  15616. "\u0034\u70B9",
  15617. "\u335D",
  15618. "\u0035\u70B9",
  15619. "\u335E",
  15620. "\u0036\u70B9",
  15621. "\u335F",
  15622. "\u0037\u70B9",
  15623. "\u3360",
  15624. "\u0038\u70B9",
  15625. "\u3361",
  15626. "\u0039\u70B9",
  15627. "\u3362",
  15628. "\u0031\u0030\u70B9",
  15629. "\u3363",
  15630. "\u0031\u0031\u70B9",
  15631. "\u3364",
  15632. "\u0031\u0032\u70B9",
  15633. "\u3365",
  15634. "\u0031\u0033\u70B9",
  15635. "\u3366",
  15636. "\u0031\u0034\u70B9",
  15637. "\u3367",
  15638. "\u0031\u0035\u70B9",
  15639. "\u3368",
  15640. "\u0031\u0036\u70B9",
  15641. "\u3369",
  15642. "\u0031\u0037\u70B9",
  15643. "\u336A",
  15644. "\u0031\u0038\u70B9",
  15645. "\u336B",
  15646. "\u0031\u0039\u70B9",
  15647. "\u336C",
  15648. "\u0032\u0030\u70B9",
  15649. "\u336D",
  15650. "\u0032\u0031\u70B9",
  15651. "\u336E",
  15652. "\u0032\u0032\u70B9",
  15653. "\u336F",
  15654. "\u0032\u0033\u70B9",
  15655. "\u3370",
  15656. "\u0032\u0034\u70B9",
  15657. "\u33E0",
  15658. "\u0031\u65E5",
  15659. "\u33E1",
  15660. "\u0032\u65E5",
  15661. "\u33E2",
  15662. "\u0033\u65E5",
  15663. "\u33E3",
  15664. "\u0034\u65E5",
  15665. "\u33E4",
  15666. "\u0035\u65E5",
  15667. "\u33E5",
  15668. "\u0036\u65E5",
  15669. "\u33E6",
  15670. "\u0037\u65E5",
  15671. "\u33E7",
  15672. "\u0038\u65E5",
  15673. "\u33E8",
  15674. "\u0039\u65E5",
  15675. "\u33E9",
  15676. "\u0031\u0030\u65E5",
  15677. "\u33EA",
  15678. "\u0031\u0031\u65E5",
  15679. "\u33EB",
  15680. "\u0031\u0032\u65E5",
  15681. "\u33EC",
  15682. "\u0031\u0033\u65E5",
  15683. "\u33ED",
  15684. "\u0031\u0034\u65E5",
  15685. "\u33EE",
  15686. "\u0031\u0035\u65E5",
  15687. "\u33EF",
  15688. "\u0031\u0036\u65E5",
  15689. "\u33F0",
  15690. "\u0031\u0037\u65E5",
  15691. "\u33F1",
  15692. "\u0031\u0038\u65E5",
  15693. "\u33F2",
  15694. "\u0031\u0039\u65E5",
  15695. "\u33F3",
  15696. "\u0032\u0030\u65E5",
  15697. "\u33F4",
  15698. "\u0032\u0031\u65E5",
  15699. "\u33F5",
  15700. "\u0032\u0032\u65E5",
  15701. "\u33F6",
  15702. "\u0032\u0033\u65E5",
  15703. "\u33F7",
  15704. "\u0032\u0034\u65E5",
  15705. "\u33F8",
  15706. "\u0032\u0035\u65E5",
  15707. "\u33F9",
  15708. "\u0032\u0036\u65E5",
  15709. "\u33FA",
  15710. "\u0032\u0037\u65E5",
  15711. "\u33FB",
  15712. "\u0032\u0038\u65E5",
  15713. "\u33FC",
  15714. "\u0032\u0039\u65E5",
  15715. "\u33FD",
  15716. "\u0033\u0030\u65E5",
  15717. "\u33FE",
  15718. "\u0033\u0031\u65E5",
  15719. "\uFB00",
  15720. "\u0066\u0066",
  15721. "\uFB01",
  15722. "\u0066\u0069",
  15723. "\uFB02",
  15724. "\u0066\u006C",
  15725. "\uFB03",
  15726. "\u0066\u0066\u0069",
  15727. "\uFB04",
  15728. "\u0066\u0066\u006C",
  15729. "\uFB05",
  15730. "\u017F\u0074",
  15731. "\uFB06",
  15732. "\u0073\u0074",
  15733. "\uFB13",
  15734. "\u0574\u0576",
  15735. "\uFB14",
  15736. "\u0574\u0565",
  15737. "\uFB15",
  15738. "\u0574\u056B",
  15739. "\uFB16",
  15740. "\u057E\u0576",
  15741. "\uFB17",
  15742. "\u0574\u056D",
  15743. "\uFB4F",
  15744. "\u05D0\u05DC",
  15745. "\uFB50",
  15746. "\u0671",
  15747. "\uFB51",
  15748. "\u0671",
  15749. "\uFB52",
  15750. "\u067B",
  15751. "\uFB53",
  15752. "\u067B",
  15753. "\uFB54",
  15754. "\u067B",
  15755. "\uFB55",
  15756. "\u067B",
  15757. "\uFB56",
  15758. "\u067E",
  15759. "\uFB57",
  15760. "\u067E",
  15761. "\uFB58",
  15762. "\u067E",
  15763. "\uFB59",
  15764. "\u067E",
  15765. "\uFB5A",
  15766. "\u0680",
  15767. "\uFB5B",
  15768. "\u0680",
  15769. "\uFB5C",
  15770. "\u0680",
  15771. "\uFB5D",
  15772. "\u0680",
  15773. "\uFB5E",
  15774. "\u067A",
  15775. "\uFB5F",
  15776. "\u067A",
  15777. "\uFB60",
  15778. "\u067A",
  15779. "\uFB61",
  15780. "\u067A",
  15781. "\uFB62",
  15782. "\u067F",
  15783. "\uFB63",
  15784. "\u067F",
  15785. "\uFB64",
  15786. "\u067F",
  15787. "\uFB65",
  15788. "\u067F",
  15789. "\uFB66",
  15790. "\u0679",
  15791. "\uFB67",
  15792. "\u0679",
  15793. "\uFB68",
  15794. "\u0679",
  15795. "\uFB69",
  15796. "\u0679",
  15797. "\uFB6A",
  15798. "\u06A4",
  15799. "\uFB6B",
  15800. "\u06A4",
  15801. "\uFB6C",
  15802. "\u06A4",
  15803. "\uFB6D",
  15804. "\u06A4",
  15805. "\uFB6E",
  15806. "\u06A6",
  15807. "\uFB6F",
  15808. "\u06A6",
  15809. "\uFB70",
  15810. "\u06A6",
  15811. "\uFB71",
  15812. "\u06A6",
  15813. "\uFB72",
  15814. "\u0684",
  15815. "\uFB73",
  15816. "\u0684",
  15817. "\uFB74",
  15818. "\u0684",
  15819. "\uFB75",
  15820. "\u0684",
  15821. "\uFB76",
  15822. "\u0683",
  15823. "\uFB77",
  15824. "\u0683",
  15825. "\uFB78",
  15826. "\u0683",
  15827. "\uFB79",
  15828. "\u0683",
  15829. "\uFB7A",
  15830. "\u0686",
  15831. "\uFB7B",
  15832. "\u0686",
  15833. "\uFB7C",
  15834. "\u0686",
  15835. "\uFB7D",
  15836. "\u0686",
  15837. "\uFB7E",
  15838. "\u0687",
  15839. "\uFB7F",
  15840. "\u0687",
  15841. "\uFB80",
  15842. "\u0687",
  15843. "\uFB81",
  15844. "\u0687",
  15845. "\uFB82",
  15846. "\u068D",
  15847. "\uFB83",
  15848. "\u068D",
  15849. "\uFB84",
  15850. "\u068C",
  15851. "\uFB85",
  15852. "\u068C",
  15853. "\uFB86",
  15854. "\u068E",
  15855. "\uFB87",
  15856. "\u068E",
  15857. "\uFB88",
  15858. "\u0688",
  15859. "\uFB89",
  15860. "\u0688",
  15861. "\uFB8A",
  15862. "\u0698",
  15863. "\uFB8B",
  15864. "\u0698",
  15865. "\uFB8C",
  15866. "\u0691",
  15867. "\uFB8D",
  15868. "\u0691",
  15869. "\uFB8E",
  15870. "\u06A9",
  15871. "\uFB8F",
  15872. "\u06A9",
  15873. "\uFB90",
  15874. "\u06A9",
  15875. "\uFB91",
  15876. "\u06A9",
  15877. "\uFB92",
  15878. "\u06AF",
  15879. "\uFB93",
  15880. "\u06AF",
  15881. "\uFB94",
  15882. "\u06AF",
  15883. "\uFB95",
  15884. "\u06AF",
  15885. "\uFB96",
  15886. "\u06B3",
  15887. "\uFB97",
  15888. "\u06B3",
  15889. "\uFB98",
  15890. "\u06B3",
  15891. "\uFB99",
  15892. "\u06B3",
  15893. "\uFB9A",
  15894. "\u06B1",
  15895. "\uFB9B",
  15896. "\u06B1",
  15897. "\uFB9C",
  15898. "\u06B1",
  15899. "\uFB9D",
  15900. "\u06B1",
  15901. "\uFB9E",
  15902. "\u06BA",
  15903. "\uFB9F",
  15904. "\u06BA",
  15905. "\uFBA0",
  15906. "\u06BB",
  15907. "\uFBA1",
  15908. "\u06BB",
  15909. "\uFBA2",
  15910. "\u06BB",
  15911. "\uFBA3",
  15912. "\u06BB",
  15913. "\uFBA4",
  15914. "\u06C0",
  15915. "\uFBA5",
  15916. "\u06C0",
  15917. "\uFBA6",
  15918. "\u06C1",
  15919. "\uFBA7",
  15920. "\u06C1",
  15921. "\uFBA8",
  15922. "\u06C1",
  15923. "\uFBA9",
  15924. "\u06C1",
  15925. "\uFBAA",
  15926. "\u06BE",
  15927. "\uFBAB",
  15928. "\u06BE",
  15929. "\uFBAC",
  15930. "\u06BE",
  15931. "\uFBAD",
  15932. "\u06BE",
  15933. "\uFBAE",
  15934. "\u06D2",
  15935. "\uFBAF",
  15936. "\u06D2",
  15937. "\uFBB0",
  15938. "\u06D3",
  15939. "\uFBB1",
  15940. "\u06D3",
  15941. "\uFBD3",
  15942. "\u06AD",
  15943. "\uFBD4",
  15944. "\u06AD",
  15945. "\uFBD5",
  15946. "\u06AD",
  15947. "\uFBD6",
  15948. "\u06AD",
  15949. "\uFBD7",
  15950. "\u06C7",
  15951. "\uFBD8",
  15952. "\u06C7",
  15953. "\uFBD9",
  15954. "\u06C6",
  15955. "\uFBDA",
  15956. "\u06C6",
  15957. "\uFBDB",
  15958. "\u06C8",
  15959. "\uFBDC",
  15960. "\u06C8",
  15961. "\uFBDD",
  15962. "\u0677",
  15963. "\uFBDE",
  15964. "\u06CB",
  15965. "\uFBDF",
  15966. "\u06CB",
  15967. "\uFBE0",
  15968. "\u06C5",
  15969. "\uFBE1",
  15970. "\u06C5",
  15971. "\uFBE2",
  15972. "\u06C9",
  15973. "\uFBE3",
  15974. "\u06C9",
  15975. "\uFBE4",
  15976. "\u06D0",
  15977. "\uFBE5",
  15978. "\u06D0",
  15979. "\uFBE6",
  15980. "\u06D0",
  15981. "\uFBE7",
  15982. "\u06D0",
  15983. "\uFBE8",
  15984. "\u0649",
  15985. "\uFBE9",
  15986. "\u0649",
  15987. "\uFBEA",
  15988. "\u0626\u0627",
  15989. "\uFBEB",
  15990. "\u0626\u0627",
  15991. "\uFBEC",
  15992. "\u0626\u06D5",
  15993. "\uFBED",
  15994. "\u0626\u06D5",
  15995. "\uFBEE",
  15996. "\u0626\u0648",
  15997. "\uFBEF",
  15998. "\u0626\u0648",
  15999. "\uFBF0",
  16000. "\u0626\u06C7",
  16001. "\uFBF1",
  16002. "\u0626\u06C7",
  16003. "\uFBF2",
  16004. "\u0626\u06C6",
  16005. "\uFBF3",
  16006. "\u0626\u06C6",
  16007. "\uFBF4",
  16008. "\u0626\u06C8",
  16009. "\uFBF5",
  16010. "\u0626\u06C8",
  16011. "\uFBF6",
  16012. "\u0626\u06D0",
  16013. "\uFBF7",
  16014. "\u0626\u06D0",
  16015. "\uFBF8",
  16016. "\u0626\u06D0",
  16017. "\uFBF9",
  16018. "\u0626\u0649",
  16019. "\uFBFA",
  16020. "\u0626\u0649",
  16021. "\uFBFB",
  16022. "\u0626\u0649",
  16023. "\uFBFC",
  16024. "\u06CC",
  16025. "\uFBFD",
  16026. "\u06CC",
  16027. "\uFBFE",
  16028. "\u06CC",
  16029. "\uFBFF",
  16030. "\u06CC",
  16031. "\uFC00",
  16032. "\u0626\u062C",
  16033. "\uFC01",
  16034. "\u0626\u062D",
  16035. "\uFC02",
  16036. "\u0626\u0645",
  16037. "\uFC03",
  16038. "\u0626\u0649",
  16039. "\uFC04",
  16040. "\u0626\u064A",
  16041. "\uFC05",
  16042. "\u0628\u062C",
  16043. "\uFC06",
  16044. "\u0628\u062D",
  16045. "\uFC07",
  16046. "\u0628\u062E",
  16047. "\uFC08",
  16048. "\u0628\u0645",
  16049. "\uFC09",
  16050. "\u0628\u0649",
  16051. "\uFC0A",
  16052. "\u0628\u064A",
  16053. "\uFC0B",
  16054. "\u062A\u062C",
  16055. "\uFC0C",
  16056. "\u062A\u062D",
  16057. "\uFC0D",
  16058. "\u062A\u062E",
  16059. "\uFC0E",
  16060. "\u062A\u0645",
  16061. "\uFC0F",
  16062. "\u062A\u0649",
  16063. "\uFC10",
  16064. "\u062A\u064A",
  16065. "\uFC11",
  16066. "\u062B\u062C",
  16067. "\uFC12",
  16068. "\u062B\u0645",
  16069. "\uFC13",
  16070. "\u062B\u0649",
  16071. "\uFC14",
  16072. "\u062B\u064A",
  16073. "\uFC15",
  16074. "\u062C\u062D",
  16075. "\uFC16",
  16076. "\u062C\u0645",
  16077. "\uFC17",
  16078. "\u062D\u062C",
  16079. "\uFC18",
  16080. "\u062D\u0645",
  16081. "\uFC19",
  16082. "\u062E\u062C",
  16083. "\uFC1A",
  16084. "\u062E\u062D",
  16085. "\uFC1B",
  16086. "\u062E\u0645",
  16087. "\uFC1C",
  16088. "\u0633\u062C",
  16089. "\uFC1D",
  16090. "\u0633\u062D",
  16091. "\uFC1E",
  16092. "\u0633\u062E",
  16093. "\uFC1F",
  16094. "\u0633\u0645",
  16095. "\uFC20",
  16096. "\u0635\u062D",
  16097. "\uFC21",
  16098. "\u0635\u0645",
  16099. "\uFC22",
  16100. "\u0636\u062C",
  16101. "\uFC23",
  16102. "\u0636\u062D",
  16103. "\uFC24",
  16104. "\u0636\u062E",
  16105. "\uFC25",
  16106. "\u0636\u0645",
  16107. "\uFC26",
  16108. "\u0637\u062D",
  16109. "\uFC27",
  16110. "\u0637\u0645",
  16111. "\uFC28",
  16112. "\u0638\u0645",
  16113. "\uFC29",
  16114. "\u0639\u062C",
  16115. "\uFC2A",
  16116. "\u0639\u0645",
  16117. "\uFC2B",
  16118. "\u063A\u062C",
  16119. "\uFC2C",
  16120. "\u063A\u0645",
  16121. "\uFC2D",
  16122. "\u0641\u062C",
  16123. "\uFC2E",
  16124. "\u0641\u062D",
  16125. "\uFC2F",
  16126. "\u0641\u062E",
  16127. "\uFC30",
  16128. "\u0641\u0645",
  16129. "\uFC31",
  16130. "\u0641\u0649",
  16131. "\uFC32",
  16132. "\u0641\u064A",
  16133. "\uFC33",
  16134. "\u0642\u062D",
  16135. "\uFC34",
  16136. "\u0642\u0645",
  16137. "\uFC35",
  16138. "\u0642\u0649",
  16139. "\uFC36",
  16140. "\u0642\u064A",
  16141. "\uFC37",
  16142. "\u0643\u0627",
  16143. "\uFC38",
  16144. "\u0643\u062C",
  16145. "\uFC39",
  16146. "\u0643\u062D",
  16147. "\uFC3A",
  16148. "\u0643\u062E",
  16149. "\uFC3B",
  16150. "\u0643\u0644",
  16151. "\uFC3C",
  16152. "\u0643\u0645",
  16153. "\uFC3D",
  16154. "\u0643\u0649",
  16155. "\uFC3E",
  16156. "\u0643\u064A",
  16157. "\uFC3F",
  16158. "\u0644\u062C",
  16159. "\uFC40",
  16160. "\u0644\u062D",
  16161. "\uFC41",
  16162. "\u0644\u062E",
  16163. "\uFC42",
  16164. "\u0644\u0645",
  16165. "\uFC43",
  16166. "\u0644\u0649",
  16167. "\uFC44",
  16168. "\u0644\u064A",
  16169. "\uFC45",
  16170. "\u0645\u062C",
  16171. "\uFC46",
  16172. "\u0645\u062D",
  16173. "\uFC47",
  16174. "\u0645\u062E",
  16175. "\uFC48",
  16176. "\u0645\u0645",
  16177. "\uFC49",
  16178. "\u0645\u0649",
  16179. "\uFC4A",
  16180. "\u0645\u064A",
  16181. "\uFC4B",
  16182. "\u0646\u062C",
  16183. "\uFC4C",
  16184. "\u0646\u062D",
  16185. "\uFC4D",
  16186. "\u0646\u062E",
  16187. "\uFC4E",
  16188. "\u0646\u0645",
  16189. "\uFC4F",
  16190. "\u0646\u0649",
  16191. "\uFC50",
  16192. "\u0646\u064A",
  16193. "\uFC51",
  16194. "\u0647\u062C",
  16195. "\uFC52",
  16196. "\u0647\u0645",
  16197. "\uFC53",
  16198. "\u0647\u0649",
  16199. "\uFC54",
  16200. "\u0647\u064A",
  16201. "\uFC55",
  16202. "\u064A\u062C",
  16203. "\uFC56",
  16204. "\u064A\u062D",
  16205. "\uFC57",
  16206. "\u064A\u062E",
  16207. "\uFC58",
  16208. "\u064A\u0645",
  16209. "\uFC59",
  16210. "\u064A\u0649",
  16211. "\uFC5A",
  16212. "\u064A\u064A",
  16213. "\uFC5B",
  16214. "\u0630\u0670",
  16215. "\uFC5C",
  16216. "\u0631\u0670",
  16217. "\uFC5D",
  16218. "\u0649\u0670",
  16219. "\uFC5E",
  16220. "\u0020\u064C\u0651",
  16221. "\uFC5F",
  16222. "\u0020\u064D\u0651",
  16223. "\uFC60",
  16224. "\u0020\u064E\u0651",
  16225. "\uFC61",
  16226. "\u0020\u064F\u0651",
  16227. "\uFC62",
  16228. "\u0020\u0650\u0651",
  16229. "\uFC63",
  16230. "\u0020\u0651\u0670",
  16231. "\uFC64",
  16232. "\u0626\u0631",
  16233. "\uFC65",
  16234. "\u0626\u0632",
  16235. "\uFC66",
  16236. "\u0626\u0645",
  16237. "\uFC67",
  16238. "\u0626\u0646",
  16239. "\uFC68",
  16240. "\u0626\u0649",
  16241. "\uFC69",
  16242. "\u0626\u064A",
  16243. "\uFC6A",
  16244. "\u0628\u0631",
  16245. "\uFC6B",
  16246. "\u0628\u0632",
  16247. "\uFC6C",
  16248. "\u0628\u0645",
  16249. "\uFC6D",
  16250. "\u0628\u0646",
  16251. "\uFC6E",
  16252. "\u0628\u0649",
  16253. "\uFC6F",
  16254. "\u0628\u064A",
  16255. "\uFC70",
  16256. "\u062A\u0631",
  16257. "\uFC71",
  16258. "\u062A\u0632",
  16259. "\uFC72",
  16260. "\u062A\u0645",
  16261. "\uFC73",
  16262. "\u062A\u0646",
  16263. "\uFC74",
  16264. "\u062A\u0649",
  16265. "\uFC75",
  16266. "\u062A\u064A",
  16267. "\uFC76",
  16268. "\u062B\u0631",
  16269. "\uFC77",
  16270. "\u062B\u0632",
  16271. "\uFC78",
  16272. "\u062B\u0645",
  16273. "\uFC79",
  16274. "\u062B\u0646",
  16275. "\uFC7A",
  16276. "\u062B\u0649",
  16277. "\uFC7B",
  16278. "\u062B\u064A",
  16279. "\uFC7C",
  16280. "\u0641\u0649",
  16281. "\uFC7D",
  16282. "\u0641\u064A",
  16283. "\uFC7E",
  16284. "\u0642\u0649",
  16285. "\uFC7F",
  16286. "\u0642\u064A",
  16287. "\uFC80",
  16288. "\u0643\u0627",
  16289. "\uFC81",
  16290. "\u0643\u0644",
  16291. "\uFC82",
  16292. "\u0643\u0645",
  16293. "\uFC83",
  16294. "\u0643\u0649",
  16295. "\uFC84",
  16296. "\u0643\u064A",
  16297. "\uFC85",
  16298. "\u0644\u0645",
  16299. "\uFC86",
  16300. "\u0644\u0649",
  16301. "\uFC87",
  16302. "\u0644\u064A",
  16303. "\uFC88",
  16304. "\u0645\u0627",
  16305. "\uFC89",
  16306. "\u0645\u0645",
  16307. "\uFC8A",
  16308. "\u0646\u0631",
  16309. "\uFC8B",
  16310. "\u0646\u0632",
  16311. "\uFC8C",
  16312. "\u0646\u0645",
  16313. "\uFC8D",
  16314. "\u0646\u0646",
  16315. "\uFC8E",
  16316. "\u0646\u0649",
  16317. "\uFC8F",
  16318. "\u0646\u064A",
  16319. "\uFC90",
  16320. "\u0649\u0670",
  16321. "\uFC91",
  16322. "\u064A\u0631",
  16323. "\uFC92",
  16324. "\u064A\u0632",
  16325. "\uFC93",
  16326. "\u064A\u0645",
  16327. "\uFC94",
  16328. "\u064A\u0646",
  16329. "\uFC95",
  16330. "\u064A\u0649",
  16331. "\uFC96",
  16332. "\u064A\u064A",
  16333. "\uFC97",
  16334. "\u0626\u062C",
  16335. "\uFC98",
  16336. "\u0626\u062D",
  16337. "\uFC99",
  16338. "\u0626\u062E",
  16339. "\uFC9A",
  16340. "\u0626\u0645",
  16341. "\uFC9B",
  16342. "\u0626\u0647",
  16343. "\uFC9C",
  16344. "\u0628\u062C",
  16345. "\uFC9D",
  16346. "\u0628\u062D",
  16347. "\uFC9E",
  16348. "\u0628\u062E",
  16349. "\uFC9F",
  16350. "\u0628\u0645",
  16351. "\uFCA0",
  16352. "\u0628\u0647",
  16353. "\uFCA1",
  16354. "\u062A\u062C",
  16355. "\uFCA2",
  16356. "\u062A\u062D",
  16357. "\uFCA3",
  16358. "\u062A\u062E",
  16359. "\uFCA4",
  16360. "\u062A\u0645",
  16361. "\uFCA5",
  16362. "\u062A\u0647",
  16363. "\uFCA6",
  16364. "\u062B\u0645",
  16365. "\uFCA7",
  16366. "\u062C\u062D",
  16367. "\uFCA8",
  16368. "\u062C\u0645",
  16369. "\uFCA9",
  16370. "\u062D\u062C",
  16371. "\uFCAA",
  16372. "\u062D\u0645",
  16373. "\uFCAB",
  16374. "\u062E\u062C",
  16375. "\uFCAC",
  16376. "\u062E\u0645",
  16377. "\uFCAD",
  16378. "\u0633\u062C",
  16379. "\uFCAE",
  16380. "\u0633\u062D",
  16381. "\uFCAF",
  16382. "\u0633\u062E",
  16383. "\uFCB0",
  16384. "\u0633\u0645",
  16385. "\uFCB1",
  16386. "\u0635\u062D",
  16387. "\uFCB2",
  16388. "\u0635\u062E",
  16389. "\uFCB3",
  16390. "\u0635\u0645",
  16391. "\uFCB4",
  16392. "\u0636\u062C",
  16393. "\uFCB5",
  16394. "\u0636\u062D",
  16395. "\uFCB6",
  16396. "\u0636\u062E",
  16397. "\uFCB7",
  16398. "\u0636\u0645",
  16399. "\uFCB8",
  16400. "\u0637\u062D",
  16401. "\uFCB9",
  16402. "\u0638\u0645",
  16403. "\uFCBA",
  16404. "\u0639\u062C",
  16405. "\uFCBB",
  16406. "\u0639\u0645",
  16407. "\uFCBC",
  16408. "\u063A\u062C",
  16409. "\uFCBD",
  16410. "\u063A\u0645",
  16411. "\uFCBE",
  16412. "\u0641\u062C",
  16413. "\uFCBF",
  16414. "\u0641\u062D",
  16415. "\uFCC0",
  16416. "\u0641\u062E",
  16417. "\uFCC1",
  16418. "\u0641\u0645",
  16419. "\uFCC2",
  16420. "\u0642\u062D",
  16421. "\uFCC3",
  16422. "\u0642\u0645",
  16423. "\uFCC4",
  16424. "\u0643\u062C",
  16425. "\uFCC5",
  16426. "\u0643\u062D",
  16427. "\uFCC6",
  16428. "\u0643\u062E",
  16429. "\uFCC7",
  16430. "\u0643\u0644",
  16431. "\uFCC8",
  16432. "\u0643\u0645",
  16433. "\uFCC9",
  16434. "\u0644\u062C",
  16435. "\uFCCA",
  16436. "\u0644\u062D",
  16437. "\uFCCB",
  16438. "\u0644\u062E",
  16439. "\uFCCC",
  16440. "\u0644\u0645",
  16441. "\uFCCD",
  16442. "\u0644\u0647",
  16443. "\uFCCE",
  16444. "\u0645\u062C",
  16445. "\uFCCF",
  16446. "\u0645\u062D",
  16447. "\uFCD0",
  16448. "\u0645\u062E",
  16449. "\uFCD1",
  16450. "\u0645\u0645",
  16451. "\uFCD2",
  16452. "\u0646\u062C",
  16453. "\uFCD3",
  16454. "\u0646\u062D",
  16455. "\uFCD4",
  16456. "\u0646\u062E",
  16457. "\uFCD5",
  16458. "\u0646\u0645",
  16459. "\uFCD6",
  16460. "\u0646\u0647",
  16461. "\uFCD7",
  16462. "\u0647\u062C",
  16463. "\uFCD8",
  16464. "\u0647\u0645",
  16465. "\uFCD9",
  16466. "\u0647\u0670",
  16467. "\uFCDA",
  16468. "\u064A\u062C",
  16469. "\uFCDB",
  16470. "\u064A\u062D",
  16471. "\uFCDC",
  16472. "\u064A\u062E",
  16473. "\uFCDD",
  16474. "\u064A\u0645",
  16475. "\uFCDE",
  16476. "\u064A\u0647",
  16477. "\uFCDF",
  16478. "\u0626\u0645",
  16479. "\uFCE0",
  16480. "\u0626\u0647",
  16481. "\uFCE1",
  16482. "\u0628\u0645",
  16483. "\uFCE2",
  16484. "\u0628\u0647",
  16485. "\uFCE3",
  16486. "\u062A\u0645",
  16487. "\uFCE4",
  16488. "\u062A\u0647",
  16489. "\uFCE5",
  16490. "\u062B\u0645",
  16491. "\uFCE6",
  16492. "\u062B\u0647",
  16493. "\uFCE7",
  16494. "\u0633\u0645",
  16495. "\uFCE8",
  16496. "\u0633\u0647",
  16497. "\uFCE9",
  16498. "\u0634\u0645",
  16499. "\uFCEA",
  16500. "\u0634\u0647",
  16501. "\uFCEB",
  16502. "\u0643\u0644",
  16503. "\uFCEC",
  16504. "\u0643\u0645",
  16505. "\uFCED",
  16506. "\u0644\u0645",
  16507. "\uFCEE",
  16508. "\u0646\u0645",
  16509. "\uFCEF",
  16510. "\u0646\u0647",
  16511. "\uFCF0",
  16512. "\u064A\u0645",
  16513. "\uFCF1",
  16514. "\u064A\u0647",
  16515. "\uFCF2",
  16516. "\u0640\u064E\u0651",
  16517. "\uFCF3",
  16518. "\u0640\u064F\u0651",
  16519. "\uFCF4",
  16520. "\u0640\u0650\u0651",
  16521. "\uFCF5",
  16522. "\u0637\u0649",
  16523. "\uFCF6",
  16524. "\u0637\u064A",
  16525. "\uFCF7",
  16526. "\u0639\u0649",
  16527. "\uFCF8",
  16528. "\u0639\u064A",
  16529. "\uFCF9",
  16530. "\u063A\u0649",
  16531. "\uFCFA",
  16532. "\u063A\u064A",
  16533. "\uFCFB",
  16534. "\u0633\u0649",
  16535. "\uFCFC",
  16536. "\u0633\u064A",
  16537. "\uFCFD",
  16538. "\u0634\u0649",
  16539. "\uFCFE",
  16540. "\u0634\u064A",
  16541. "\uFCFF",
  16542. "\u062D\u0649",
  16543. "\uFD00",
  16544. "\u062D\u064A",
  16545. "\uFD01",
  16546. "\u062C\u0649",
  16547. "\uFD02",
  16548. "\u062C\u064A",
  16549. "\uFD03",
  16550. "\u062E\u0649",
  16551. "\uFD04",
  16552. "\u062E\u064A",
  16553. "\uFD05",
  16554. "\u0635\u0649",
  16555. "\uFD06",
  16556. "\u0635\u064A",
  16557. "\uFD07",
  16558. "\u0636\u0649",
  16559. "\uFD08",
  16560. "\u0636\u064A",
  16561. "\uFD09",
  16562. "\u0634\u062C",
  16563. "\uFD0A",
  16564. "\u0634\u062D",
  16565. "\uFD0B",
  16566. "\u0634\u062E",
  16567. "\uFD0C",
  16568. "\u0634\u0645",
  16569. "\uFD0D",
  16570. "\u0634\u0631",
  16571. "\uFD0E",
  16572. "\u0633\u0631",
  16573. "\uFD0F",
  16574. "\u0635\u0631",
  16575. "\uFD10",
  16576. "\u0636\u0631",
  16577. "\uFD11",
  16578. "\u0637\u0649",
  16579. "\uFD12",
  16580. "\u0637\u064A",
  16581. "\uFD13",
  16582. "\u0639\u0649",
  16583. "\uFD14",
  16584. "\u0639\u064A",
  16585. "\uFD15",
  16586. "\u063A\u0649",
  16587. "\uFD16",
  16588. "\u063A\u064A",
  16589. "\uFD17",
  16590. "\u0633\u0649",
  16591. "\uFD18",
  16592. "\u0633\u064A",
  16593. "\uFD19",
  16594. "\u0634\u0649",
  16595. "\uFD1A",
  16596. "\u0634\u064A",
  16597. "\uFD1B",
  16598. "\u062D\u0649",
  16599. "\uFD1C",
  16600. "\u062D\u064A",
  16601. "\uFD1D",
  16602. "\u062C\u0649",
  16603. "\uFD1E",
  16604. "\u062C\u064A",
  16605. "\uFD1F",
  16606. "\u062E\u0649",
  16607. "\uFD20",
  16608. "\u062E\u064A",
  16609. "\uFD21",
  16610. "\u0635\u0649",
  16611. "\uFD22",
  16612. "\u0635\u064A",
  16613. "\uFD23",
  16614. "\u0636\u0649",
  16615. "\uFD24",
  16616. "\u0636\u064A",
  16617. "\uFD25",
  16618. "\u0634\u062C",
  16619. "\uFD26",
  16620. "\u0634\u062D",
  16621. "\uFD27",
  16622. "\u0634\u062E",
  16623. "\uFD28",
  16624. "\u0634\u0645",
  16625. "\uFD29",
  16626. "\u0634\u0631",
  16627. "\uFD2A",
  16628. "\u0633\u0631",
  16629. "\uFD2B",
  16630. "\u0635\u0631",
  16631. "\uFD2C",
  16632. "\u0636\u0631",
  16633. "\uFD2D",
  16634. "\u0634\u062C",
  16635. "\uFD2E",
  16636. "\u0634\u062D",
  16637. "\uFD2F",
  16638. "\u0634\u062E",
  16639. "\uFD30",
  16640. "\u0634\u0645",
  16641. "\uFD31",
  16642. "\u0633\u0647",
  16643. "\uFD32",
  16644. "\u0634\u0647",
  16645. "\uFD33",
  16646. "\u0637\u0645",
  16647. "\uFD34",
  16648. "\u0633\u062C",
  16649. "\uFD35",
  16650. "\u0633\u062D",
  16651. "\uFD36",
  16652. "\u0633\u062E",
  16653. "\uFD37",
  16654. "\u0634\u062C",
  16655. "\uFD38",
  16656. "\u0634\u062D",
  16657. "\uFD39",
  16658. "\u0634\u062E",
  16659. "\uFD3A",
  16660. "\u0637\u0645",
  16661. "\uFD3B",
  16662. "\u0638\u0645",
  16663. "\uFD3C",
  16664. "\u0627\u064B",
  16665. "\uFD3D",
  16666. "\u0627\u064B",
  16667. "\uFD50",
  16668. "\u062A\u062C\u0645",
  16669. "\uFD51",
  16670. "\u062A\u062D\u062C",
  16671. "\uFD52",
  16672. "\u062A\u062D\u062C",
  16673. "\uFD53",
  16674. "\u062A\u062D\u0645",
  16675. "\uFD54",
  16676. "\u062A\u062E\u0645",
  16677. "\uFD55",
  16678. "\u062A\u0645\u062C",
  16679. "\uFD56",
  16680. "\u062A\u0645\u062D",
  16681. "\uFD57",
  16682. "\u062A\u0645\u062E",
  16683. "\uFD58",
  16684. "\u062C\u0645\u062D",
  16685. "\uFD59",
  16686. "\u062C\u0645\u062D",
  16687. "\uFD5A",
  16688. "\u062D\u0645\u064A",
  16689. "\uFD5B",
  16690. "\u062D\u0645\u0649",
  16691. "\uFD5C",
  16692. "\u0633\u062D\u062C",
  16693. "\uFD5D",
  16694. "\u0633\u062C\u062D",
  16695. "\uFD5E",
  16696. "\u0633\u062C\u0649",
  16697. "\uFD5F",
  16698. "\u0633\u0645\u062D",
  16699. "\uFD60",
  16700. "\u0633\u0645\u062D",
  16701. "\uFD61",
  16702. "\u0633\u0645\u062C",
  16703. "\uFD62",
  16704. "\u0633\u0645\u0645",
  16705. "\uFD63",
  16706. "\u0633\u0645\u0645",
  16707. "\uFD64",
  16708. "\u0635\u062D\u062D",
  16709. "\uFD65",
  16710. "\u0635\u062D\u062D",
  16711. "\uFD66",
  16712. "\u0635\u0645\u0645",
  16713. "\uFD67",
  16714. "\u0634\u062D\u0645",
  16715. "\uFD68",
  16716. "\u0634\u062D\u0645",
  16717. "\uFD69",
  16718. "\u0634\u062C\u064A",
  16719. "\uFD6A",
  16720. "\u0634\u0645\u062E",
  16721. "\uFD6B",
  16722. "\u0634\u0645\u062E",
  16723. "\uFD6C",
  16724. "\u0634\u0645\u0645",
  16725. "\uFD6D",
  16726. "\u0634\u0645\u0645",
  16727. "\uFD6E",
  16728. "\u0636\u062D\u0649",
  16729. "\uFD6F",
  16730. "\u0636\u062E\u0645",
  16731. "\uFD70",
  16732. "\u0636\u062E\u0645",
  16733. "\uFD71",
  16734. "\u0637\u0645\u062D",
  16735. "\uFD72",
  16736. "\u0637\u0645\u062D",
  16737. "\uFD73",
  16738. "\u0637\u0645\u0645",
  16739. "\uFD74",
  16740. "\u0637\u0645\u064A",
  16741. "\uFD75",
  16742. "\u0639\u062C\u0645",
  16743. "\uFD76",
  16744. "\u0639\u0645\u0645",
  16745. "\uFD77",
  16746. "\u0639\u0645\u0645",
  16747. "\uFD78",
  16748. "\u0639\u0645\u0649",
  16749. "\uFD79",
  16750. "\u063A\u0645\u0645",
  16751. "\uFD7A",
  16752. "\u063A\u0645\u064A",
  16753. "\uFD7B",
  16754. "\u063A\u0645\u0649",
  16755. "\uFD7C",
  16756. "\u0641\u062E\u0645",
  16757. "\uFD7D",
  16758. "\u0641\u062E\u0645",
  16759. "\uFD7E",
  16760. "\u0642\u0645\u062D",
  16761. "\uFD7F",
  16762. "\u0642\u0645\u0645",
  16763. "\uFD80",
  16764. "\u0644\u062D\u0645",
  16765. "\uFD81",
  16766. "\u0644\u062D\u064A",
  16767. "\uFD82",
  16768. "\u0644\u062D\u0649",
  16769. "\uFD83",
  16770. "\u0644\u062C\u062C",
  16771. "\uFD84",
  16772. "\u0644\u062C\u062C",
  16773. "\uFD85",
  16774. "\u0644\u062E\u0645",
  16775. "\uFD86",
  16776. "\u0644\u062E\u0645",
  16777. "\uFD87",
  16778. "\u0644\u0645\u062D",
  16779. "\uFD88",
  16780. "\u0644\u0645\u062D",
  16781. "\uFD89",
  16782. "\u0645\u062D\u062C",
  16783. "\uFD8A",
  16784. "\u0645\u062D\u0645",
  16785. "\uFD8B",
  16786. "\u0645\u062D\u064A",
  16787. "\uFD8C",
  16788. "\u0645\u062C\u062D",
  16789. "\uFD8D",
  16790. "\u0645\u062C\u0645",
  16791. "\uFD8E",
  16792. "\u0645\u062E\u062C",
  16793. "\uFD8F",
  16794. "\u0645\u062E\u0645",
  16795. "\uFD92",
  16796. "\u0645\u062C\u062E",
  16797. "\uFD93",
  16798. "\u0647\u0645\u062C",
  16799. "\uFD94",
  16800. "\u0647\u0645\u0645",
  16801. "\uFD95",
  16802. "\u0646\u062D\u0645",
  16803. "\uFD96",
  16804. "\u0646\u062D\u0649",
  16805. "\uFD97",
  16806. "\u0646\u062C\u0645",
  16807. "\uFD98",
  16808. "\u0646\u062C\u0645",
  16809. "\uFD99",
  16810. "\u0646\u062C\u0649",
  16811. "\uFD9A",
  16812. "\u0646\u0645\u064A",
  16813. "\uFD9B",
  16814. "\u0646\u0645\u0649",
  16815. "\uFD9C",
  16816. "\u064A\u0645\u0645",
  16817. "\uFD9D",
  16818. "\u064A\u0645\u0645",
  16819. "\uFD9E",
  16820. "\u0628\u062E\u064A",
  16821. "\uFD9F",
  16822. "\u062A\u062C\u064A",
  16823. "\uFDA0",
  16824. "\u062A\u062C\u0649",
  16825. "\uFDA1",
  16826. "\u062A\u062E\u064A",
  16827. "\uFDA2",
  16828. "\u062A\u062E\u0649",
  16829. "\uFDA3",
  16830. "\u062A\u0645\u064A",
  16831. "\uFDA4",
  16832. "\u062A\u0645\u0649",
  16833. "\uFDA5",
  16834. "\u062C\u0645\u064A",
  16835. "\uFDA6",
  16836. "\u062C\u062D\u0649",
  16837. "\uFDA7",
  16838. "\u062C\u0645\u0649",
  16839. "\uFDA8",
  16840. "\u0633\u062E\u0649",
  16841. "\uFDA9",
  16842. "\u0635\u062D\u064A",
  16843. "\uFDAA",
  16844. "\u0634\u062D\u064A",
  16845. "\uFDAB",
  16846. "\u0636\u062D\u064A",
  16847. "\uFDAC",
  16848. "\u0644\u062C\u064A",
  16849. "\uFDAD",
  16850. "\u0644\u0645\u064A",
  16851. "\uFDAE",
  16852. "\u064A\u062D\u064A",
  16853. "\uFDAF",
  16854. "\u064A\u062C\u064A",
  16855. "\uFDB0",
  16856. "\u064A\u0645\u064A",
  16857. "\uFDB1",
  16858. "\u0645\u0645\u064A",
  16859. "\uFDB2",
  16860. "\u0642\u0645\u064A",
  16861. "\uFDB3",
  16862. "\u0646\u062D\u064A",
  16863. "\uFDB4",
  16864. "\u0642\u0645\u062D",
  16865. "\uFDB5",
  16866. "\u0644\u062D\u0645",
  16867. "\uFDB6",
  16868. "\u0639\u0645\u064A",
  16869. "\uFDB7",
  16870. "\u0643\u0645\u064A",
  16871. "\uFDB8",
  16872. "\u0646\u062C\u062D",
  16873. "\uFDB9",
  16874. "\u0645\u062E\u064A",
  16875. "\uFDBA",
  16876. "\u0644\u062C\u0645",
  16877. "\uFDBB",
  16878. "\u0643\u0645\u0645",
  16879. "\uFDBC",
  16880. "\u0644\u062C\u0645",
  16881. "\uFDBD",
  16882. "\u0646\u062C\u062D",
  16883. "\uFDBE",
  16884. "\u062C\u062D\u064A",
  16885. "\uFDBF",
  16886. "\u062D\u062C\u064A",
  16887. "\uFDC0",
  16888. "\u0645\u062C\u064A",
  16889. "\uFDC1",
  16890. "\u0641\u0645\u064A",
  16891. "\uFDC2",
  16892. "\u0628\u062D\u064A",
  16893. "\uFDC3",
  16894. "\u0643\u0645\u0645",
  16895. "\uFDC4",
  16896. "\u0639\u062C\u0645",
  16897. "\uFDC5",
  16898. "\u0635\u0645\u0645",
  16899. "\uFDC6",
  16900. "\u0633\u062E\u064A",
  16901. "\uFDC7",
  16902. "\u0646\u062C\u064A",
  16903. "\uFE49",
  16904. "\u203E",
  16905. "\uFE4A",
  16906. "\u203E",
  16907. "\uFE4B",
  16908. "\u203E",
  16909. "\uFE4C",
  16910. "\u203E",
  16911. "\uFE4D",
  16912. "\u005F",
  16913. "\uFE4E",
  16914. "\u005F",
  16915. "\uFE4F",
  16916. "\u005F",
  16917. "\uFE80",
  16918. "\u0621",
  16919. "\uFE81",
  16920. "\u0622",
  16921. "\uFE82",
  16922. "\u0622",
  16923. "\uFE83",
  16924. "\u0623",
  16925. "\uFE84",
  16926. "\u0623",
  16927. "\uFE85",
  16928. "\u0624",
  16929. "\uFE86",
  16930. "\u0624",
  16931. "\uFE87",
  16932. "\u0625",
  16933. "\uFE88",
  16934. "\u0625",
  16935. "\uFE89",
  16936. "\u0626",
  16937. "\uFE8A",
  16938. "\u0626",
  16939. "\uFE8B",
  16940. "\u0626",
  16941. "\uFE8C",
  16942. "\u0626",
  16943. "\uFE8D",
  16944. "\u0627",
  16945. "\uFE8E",
  16946. "\u0627",
  16947. "\uFE8F",
  16948. "\u0628",
  16949. "\uFE90",
  16950. "\u0628",
  16951. "\uFE91",
  16952. "\u0628",
  16953. "\uFE92",
  16954. "\u0628",
  16955. "\uFE93",
  16956. "\u0629",
  16957. "\uFE94",
  16958. "\u0629",
  16959. "\uFE95",
  16960. "\u062A",
  16961. "\uFE96",
  16962. "\u062A",
  16963. "\uFE97",
  16964. "\u062A",
  16965. "\uFE98",
  16966. "\u062A",
  16967. "\uFE99",
  16968. "\u062B",
  16969. "\uFE9A",
  16970. "\u062B",
  16971. "\uFE9B",
  16972. "\u062B",
  16973. "\uFE9C",
  16974. "\u062B",
  16975. "\uFE9D",
  16976. "\u062C",
  16977. "\uFE9E",
  16978. "\u062C",
  16979. "\uFE9F",
  16980. "\u062C",
  16981. "\uFEA0",
  16982. "\u062C",
  16983. "\uFEA1",
  16984. "\u062D",
  16985. "\uFEA2",
  16986. "\u062D",
  16987. "\uFEA3",
  16988. "\u062D",
  16989. "\uFEA4",
  16990. "\u062D",
  16991. "\uFEA5",
  16992. "\u062E",
  16993. "\uFEA6",
  16994. "\u062E",
  16995. "\uFEA7",
  16996. "\u062E",
  16997. "\uFEA8",
  16998. "\u062E",
  16999. "\uFEA9",
  17000. "\u062F",
  17001. "\uFEAA",
  17002. "\u062F",
  17003. "\uFEAB",
  17004. "\u0630",
  17005. "\uFEAC",
  17006. "\u0630",
  17007. "\uFEAD",
  17008. "\u0631",
  17009. "\uFEAE",
  17010. "\u0631",
  17011. "\uFEAF",
  17012. "\u0632",
  17013. "\uFEB0",
  17014. "\u0632",
  17015. "\uFEB1",
  17016. "\u0633",
  17017. "\uFEB2",
  17018. "\u0633",
  17019. "\uFEB3",
  17020. "\u0633",
  17021. "\uFEB4",
  17022. "\u0633",
  17023. "\uFEB5",
  17024. "\u0634",
  17025. "\uFEB6",
  17026. "\u0634",
  17027. "\uFEB7",
  17028. "\u0634",
  17029. "\uFEB8",
  17030. "\u0634",
  17031. "\uFEB9",
  17032. "\u0635",
  17033. "\uFEBA",
  17034. "\u0635",
  17035. "\uFEBB",
  17036. "\u0635",
  17037. "\uFEBC",
  17038. "\u0635",
  17039. "\uFEBD",
  17040. "\u0636",
  17041. "\uFEBE",
  17042. "\u0636",
  17043. "\uFEBF",
  17044. "\u0636",
  17045. "\uFEC0",
  17046. "\u0636",
  17047. "\uFEC1",
  17048. "\u0637",
  17049. "\uFEC2",
  17050. "\u0637",
  17051. "\uFEC3",
  17052. "\u0637",
  17053. "\uFEC4",
  17054. "\u0637",
  17055. "\uFEC5",
  17056. "\u0638",
  17057. "\uFEC6",
  17058. "\u0638",
  17059. "\uFEC7",
  17060. "\u0638",
  17061. "\uFEC8",
  17062. "\u0638",
  17063. "\uFEC9",
  17064. "\u0639",
  17065. "\uFECA",
  17066. "\u0639",
  17067. "\uFECB",
  17068. "\u0639",
  17069. "\uFECC",
  17070. "\u0639",
  17071. "\uFECD",
  17072. "\u063A",
  17073. "\uFECE",
  17074. "\u063A",
  17075. "\uFECF",
  17076. "\u063A",
  17077. "\uFED0",
  17078. "\u063A",
  17079. "\uFED1",
  17080. "\u0641",
  17081. "\uFED2",
  17082. "\u0641",
  17083. "\uFED3",
  17084. "\u0641",
  17085. "\uFED4",
  17086. "\u0641",
  17087. "\uFED5",
  17088. "\u0642",
  17089. "\uFED6",
  17090. "\u0642",
  17091. "\uFED7",
  17092. "\u0642",
  17093. "\uFED8",
  17094. "\u0642",
  17095. "\uFED9",
  17096. "\u0643",
  17097. "\uFEDA",
  17098. "\u0643",
  17099. "\uFEDB",
  17100. "\u0643",
  17101. "\uFEDC",
  17102. "\u0643",
  17103. "\uFEDD",
  17104. "\u0644",
  17105. "\uFEDE",
  17106. "\u0644",
  17107. "\uFEDF",
  17108. "\u0644",
  17109. "\uFEE0",
  17110. "\u0644",
  17111. "\uFEE1",
  17112. "\u0645",
  17113. "\uFEE2",
  17114. "\u0645",
  17115. "\uFEE3",
  17116. "\u0645",
  17117. "\uFEE4",
  17118. "\u0645",
  17119. "\uFEE5",
  17120. "\u0646",
  17121. "\uFEE6",
  17122. "\u0646",
  17123. "\uFEE7",
  17124. "\u0646",
  17125. "\uFEE8",
  17126. "\u0646",
  17127. "\uFEE9",
  17128. "\u0647",
  17129. "\uFEEA",
  17130. "\u0647",
  17131. "\uFEEB",
  17132. "\u0647",
  17133. "\uFEEC",
  17134. "\u0647",
  17135. "\uFEED",
  17136. "\u0648",
  17137. "\uFEEE",
  17138. "\u0648",
  17139. "\uFEEF",
  17140. "\u0649",
  17141. "\uFEF0",
  17142. "\u0649",
  17143. "\uFEF1",
  17144. "\u064A",
  17145. "\uFEF2",
  17146. "\u064A",
  17147. "\uFEF3",
  17148. "\u064A",
  17149. "\uFEF4",
  17150. "\u064A",
  17151. "\uFEF5",
  17152. "\u0644\u0622",
  17153. "\uFEF6",
  17154. "\u0644\u0622",
  17155. "\uFEF7",
  17156. "\u0644\u0623",
  17157. "\uFEF8",
  17158. "\u0644\u0623",
  17159. "\uFEF9",
  17160. "\u0644\u0625",
  17161. "\uFEFA",
  17162. "\u0644\u0625",
  17163. "\uFEFB",
  17164. "\u0644\u0627",
  17165. "\uFEFC",
  17166. "\u0644\u0627"
  17167. ];
  17168. });
  17169. function reverseIfRtl(chars) {
  17170. const charsLength = chars.length;
  17171. if (charsLength <= 1 || !isRTLRangeFor(chars.charCodeAt(0))) {
  17172. return chars;
  17173. }
  17174. const buf = [];
  17175. for (let ii = charsLength - 1; ii >= 0; ii--) {
  17176. buf.push(chars[ii]);
  17177. }
  17178. return buf.join("");
  17179. }
  17180. const SpecialCharRegExp = new RegExp("^(\\s)|(\\p{Mn})|(\\p{Cf})$", "u");
  17181. const CategoryCache = new Map();
  17182. function getCharUnicodeCategory(char) {
  17183. const cachedCategory = CategoryCache.get(char);
  17184. if (cachedCategory) {
  17185. return cachedCategory;
  17186. }
  17187. const groups = char.match(SpecialCharRegExp);
  17188. const category = {
  17189. isWhitespace: !!(groups && groups[1]),
  17190. isZeroWidthDiacritic: !!(groups && groups[2]),
  17191. isInvisibleFormatMark: !!(groups && groups[3])
  17192. };
  17193. CategoryCache.set(char, category);
  17194. return category;
  17195. }
  17196. function clearUnicodeCaches() {
  17197. CategoryCache.clear();
  17198. }
  17199. /***/ }),
  17200. /* 22 */
  17201. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  17202. Object.defineProperty(exports, "__esModule", ({
  17203. value: true
  17204. }));
  17205. exports.MarkupAnnotation = exports.AnnotationFactory = exports.AnnotationBorderStyle = exports.Annotation = void 0;
  17206. exports.getQuadPoints = getQuadPoints;
  17207. var _util = __w_pdfjs_require__(2);
  17208. var _core_utils = __w_pdfjs_require__(6);
  17209. var _default_appearance = __w_pdfjs_require__(23);
  17210. var _primitives = __w_pdfjs_require__(5);
  17211. var _writer = __w_pdfjs_require__(65);
  17212. var _base_stream = __w_pdfjs_require__(7);
  17213. var _bidi = __w_pdfjs_require__(60);
  17214. var _catalog = __w_pdfjs_require__(69);
  17215. var _colorspace = __w_pdfjs_require__(24);
  17216. var _file_spec = __w_pdfjs_require__(72);
  17217. var _object_loader = __w_pdfjs_require__(75);
  17218. var _operator_list = __w_pdfjs_require__(62);
  17219. var _stream = __w_pdfjs_require__(10);
  17220. var _factory = __w_pdfjs_require__(76);
  17221. class AnnotationFactory {
  17222. static create(xref, ref, pdfManager, idFactory, collectFields) {
  17223. return Promise.all([pdfManager.ensureCatalog("acroForm"), pdfManager.ensureCatalog("baseUrl"), pdfManager.ensureDoc("xfaDatasets"), collectFields ? this._getPageIndex(xref, ref, pdfManager) : -1]).then(([acroForm, baseUrl, xfaDatasets, pageIndex]) => pdfManager.ensure(this, "_create", [xref, ref, pdfManager, idFactory, acroForm, xfaDatasets, collectFields, pageIndex]));
  17224. }
  17225. static _create(xref, ref, pdfManager, idFactory, acroForm, xfaDatasets, collectFields, pageIndex = -1) {
  17226. const dict = xref.fetchIfRef(ref);
  17227. if (!(dict instanceof _primitives.Dict)) {
  17228. return undefined;
  17229. }
  17230. const id = ref instanceof _primitives.Ref ? ref.toString() : `annot_${idFactory.createObjId()}`;
  17231. let subtype = dict.get("Subtype");
  17232. subtype = subtype instanceof _primitives.Name ? subtype.name : null;
  17233. const parameters = {
  17234. xref,
  17235. ref,
  17236. dict,
  17237. subtype,
  17238. id,
  17239. pdfManager,
  17240. acroForm: acroForm instanceof _primitives.Dict ? acroForm : _primitives.Dict.empty,
  17241. xfaDatasets,
  17242. collectFields,
  17243. pageIndex
  17244. };
  17245. switch (subtype) {
  17246. case "Link":
  17247. return new LinkAnnotation(parameters);
  17248. case "Text":
  17249. return new TextAnnotation(parameters);
  17250. case "Widget":
  17251. let fieldType = (0, _core_utils.getInheritableProperty)({
  17252. dict,
  17253. key: "FT"
  17254. });
  17255. fieldType = fieldType instanceof _primitives.Name ? fieldType.name : null;
  17256. switch (fieldType) {
  17257. case "Tx":
  17258. return new TextWidgetAnnotation(parameters);
  17259. case "Btn":
  17260. return new ButtonWidgetAnnotation(parameters);
  17261. case "Ch":
  17262. return new ChoiceWidgetAnnotation(parameters);
  17263. case "Sig":
  17264. return new SignatureWidgetAnnotation(parameters);
  17265. }
  17266. (0, _util.warn)(`Unimplemented widget field type "${fieldType}", ` + "falling back to base field type.");
  17267. return new WidgetAnnotation(parameters);
  17268. case "Popup":
  17269. return new PopupAnnotation(parameters);
  17270. case "FreeText":
  17271. return new FreeTextAnnotation(parameters);
  17272. case "Line":
  17273. return new LineAnnotation(parameters);
  17274. case "Square":
  17275. return new SquareAnnotation(parameters);
  17276. case "Circle":
  17277. return new CircleAnnotation(parameters);
  17278. case "PolyLine":
  17279. return new PolylineAnnotation(parameters);
  17280. case "Polygon":
  17281. return new PolygonAnnotation(parameters);
  17282. case "Caret":
  17283. return new CaretAnnotation(parameters);
  17284. case "Ink":
  17285. return new InkAnnotation(parameters);
  17286. case "Highlight":
  17287. return new HighlightAnnotation(parameters);
  17288. case "Underline":
  17289. return new UnderlineAnnotation(parameters);
  17290. case "Squiggly":
  17291. return new SquigglyAnnotation(parameters);
  17292. case "StrikeOut":
  17293. return new StrikeOutAnnotation(parameters);
  17294. case "Stamp":
  17295. return new StampAnnotation(parameters);
  17296. case "FileAttachment":
  17297. return new FileAttachmentAnnotation(parameters);
  17298. default:
  17299. if (!collectFields) {
  17300. if (!subtype) {
  17301. (0, _util.warn)("Annotation is missing the required /Subtype.");
  17302. } else {
  17303. (0, _util.warn)(`Unimplemented annotation type "${subtype}", ` + "falling back to base annotation.");
  17304. }
  17305. }
  17306. return new Annotation(parameters);
  17307. }
  17308. }
  17309. static async _getPageIndex(xref, ref, pdfManager) {
  17310. try {
  17311. const annotDict = await xref.fetchIfRefAsync(ref);
  17312. if (!(annotDict instanceof _primitives.Dict)) {
  17313. return -1;
  17314. }
  17315. const pageRef = annotDict.getRaw("P");
  17316. if (!(pageRef instanceof _primitives.Ref)) {
  17317. return -1;
  17318. }
  17319. const pageIndex = await pdfManager.ensureCatalog("getPageIndex", [pageRef]);
  17320. return pageIndex;
  17321. } catch (ex) {
  17322. (0, _util.warn)(`_getPageIndex: "${ex}".`);
  17323. return -1;
  17324. }
  17325. }
  17326. static async saveNewAnnotations(evaluator, task, annotations) {
  17327. const xref = evaluator.xref;
  17328. let baseFontRef;
  17329. const dependencies = [];
  17330. const promises = [];
  17331. for (const annotation of annotations) {
  17332. switch (annotation.annotationType) {
  17333. case _util.AnnotationEditorType.FREETEXT:
  17334. if (!baseFontRef) {
  17335. const baseFont = new _primitives.Dict(xref);
  17336. baseFont.set("BaseFont", _primitives.Name.get("Helvetica"));
  17337. baseFont.set("Type", _primitives.Name.get("Font"));
  17338. baseFont.set("Subtype", _primitives.Name.get("Type1"));
  17339. baseFont.set("Encoding", _primitives.Name.get("WinAnsiEncoding"));
  17340. const buffer = [];
  17341. baseFontRef = xref.getNewRef();
  17342. (0, _writer.writeObject)(baseFontRef, baseFont, buffer, null);
  17343. dependencies.push({
  17344. ref: baseFontRef,
  17345. data: buffer.join("")
  17346. });
  17347. }
  17348. promises.push(FreeTextAnnotation.createNewAnnotation(xref, annotation, dependencies, {
  17349. evaluator,
  17350. task,
  17351. baseFontRef
  17352. }));
  17353. break;
  17354. case _util.AnnotationEditorType.INK:
  17355. promises.push(InkAnnotation.createNewAnnotation(xref, annotation, dependencies));
  17356. }
  17357. }
  17358. return {
  17359. annotations: await Promise.all(promises),
  17360. dependencies
  17361. };
  17362. }
  17363. static async printNewAnnotations(evaluator, task, annotations) {
  17364. if (!annotations) {
  17365. return null;
  17366. }
  17367. const xref = evaluator.xref;
  17368. const promises = [];
  17369. for (const annotation of annotations) {
  17370. switch (annotation.annotationType) {
  17371. case _util.AnnotationEditorType.FREETEXT:
  17372. promises.push(FreeTextAnnotation.createNewPrintAnnotation(xref, annotation, {
  17373. evaluator,
  17374. task
  17375. }));
  17376. break;
  17377. case _util.AnnotationEditorType.INK:
  17378. promises.push(InkAnnotation.createNewPrintAnnotation(xref, annotation));
  17379. break;
  17380. }
  17381. }
  17382. return Promise.all(promises);
  17383. }
  17384. }
  17385. exports.AnnotationFactory = AnnotationFactory;
  17386. function getRgbColor(color, defaultColor = new Uint8ClampedArray(3)) {
  17387. if (!Array.isArray(color)) {
  17388. return defaultColor;
  17389. }
  17390. const rgbColor = defaultColor || new Uint8ClampedArray(3);
  17391. switch (color.length) {
  17392. case 0:
  17393. return null;
  17394. case 1:
  17395. _colorspace.ColorSpace.singletons.gray.getRgbItem(color, 0, rgbColor, 0);
  17396. return rgbColor;
  17397. case 3:
  17398. _colorspace.ColorSpace.singletons.rgb.getRgbItem(color, 0, rgbColor, 0);
  17399. return rgbColor;
  17400. case 4:
  17401. _colorspace.ColorSpace.singletons.cmyk.getRgbItem(color, 0, rgbColor, 0);
  17402. return rgbColor;
  17403. default:
  17404. return defaultColor;
  17405. }
  17406. }
  17407. function getQuadPoints(dict, rect) {
  17408. if (!dict.has("QuadPoints")) {
  17409. return null;
  17410. }
  17411. const quadPoints = dict.getArray("QuadPoints");
  17412. if (!Array.isArray(quadPoints) || quadPoints.length === 0 || quadPoints.length % 8 > 0) {
  17413. return null;
  17414. }
  17415. const quadPointsLists = [];
  17416. for (let i = 0, ii = quadPoints.length / 8; i < ii; i++) {
  17417. quadPointsLists.push([]);
  17418. for (let j = i * 8, jj = i * 8 + 8; j < jj; j += 2) {
  17419. const x = quadPoints[j];
  17420. const y = quadPoints[j + 1];
  17421. if (rect !== null && (x < rect[0] || x > rect[2] || y < rect[1] || y > rect[3])) {
  17422. return null;
  17423. }
  17424. quadPointsLists[i].push({
  17425. x,
  17426. y
  17427. });
  17428. }
  17429. }
  17430. return quadPointsLists.map(quadPointsList => {
  17431. const [minX, maxX, minY, maxY] = quadPointsList.reduce(([mX, MX, mY, MY], quadPoint) => [Math.min(mX, quadPoint.x), Math.max(MX, quadPoint.x), Math.min(mY, quadPoint.y), Math.max(MY, quadPoint.y)], [Number.MAX_VALUE, Number.MIN_VALUE, Number.MAX_VALUE, Number.MIN_VALUE]);
  17432. return [{
  17433. x: minX,
  17434. y: maxY
  17435. }, {
  17436. x: maxX,
  17437. y: maxY
  17438. }, {
  17439. x: minX,
  17440. y: minY
  17441. }, {
  17442. x: maxX,
  17443. y: minY
  17444. }];
  17445. });
  17446. }
  17447. function getTransformMatrix(rect, bbox, matrix) {
  17448. const [minX, minY, maxX, maxY] = _util.Util.getAxialAlignedBoundingBox(bbox, matrix);
  17449. if (minX === maxX || minY === maxY) {
  17450. return [1, 0, 0, 1, rect[0], rect[1]];
  17451. }
  17452. const xRatio = (rect[2] - rect[0]) / (maxX - minX);
  17453. const yRatio = (rect[3] - rect[1]) / (maxY - minY);
  17454. return [xRatio, 0, 0, yRatio, rect[0] - minX * xRatio, rect[1] - minY * yRatio];
  17455. }
  17456. class Annotation {
  17457. constructor(params) {
  17458. const dict = params.dict;
  17459. this.setTitle(dict.get("T"));
  17460. this.setContents(dict.get("Contents"));
  17461. this.setModificationDate(dict.get("M"));
  17462. this.setFlags(dict.get("F"));
  17463. this.setRectangle(dict.getArray("Rect"));
  17464. this.setColor(dict.getArray("C"));
  17465. this.setBorderStyle(dict);
  17466. this.setAppearance(dict);
  17467. this.setOptionalContent(dict);
  17468. const MK = dict.get("MK");
  17469. this.setBorderAndBackgroundColors(MK);
  17470. this.setRotation(MK);
  17471. this._streams = [];
  17472. if (this.appearance) {
  17473. this._streams.push(this.appearance);
  17474. }
  17475. this.data = {
  17476. annotationFlags: this.flags,
  17477. borderStyle: this.borderStyle,
  17478. color: this.color,
  17479. backgroundColor: this.backgroundColor,
  17480. borderColor: this.borderColor,
  17481. rotation: this.rotation,
  17482. contentsObj: this._contents,
  17483. hasAppearance: !!this.appearance,
  17484. id: params.id,
  17485. modificationDate: this.modificationDate,
  17486. rect: this.rectangle,
  17487. subtype: params.subtype,
  17488. hasOwnCanvas: false
  17489. };
  17490. if (params.collectFields) {
  17491. const kids = dict.get("Kids");
  17492. if (Array.isArray(kids)) {
  17493. const kidIds = [];
  17494. for (const kid of kids) {
  17495. if (kid instanceof _primitives.Ref) {
  17496. kidIds.push(kid.toString());
  17497. }
  17498. }
  17499. if (kidIds.length !== 0) {
  17500. this.data.kidIds = kidIds;
  17501. }
  17502. }
  17503. this.data.actions = (0, _core_utils.collectActions)(params.xref, dict, _util.AnnotationActionEventType);
  17504. this.data.fieldName = this._constructFieldName(dict);
  17505. this.data.pageIndex = params.pageIndex;
  17506. }
  17507. this._fallbackFontDict = null;
  17508. }
  17509. _hasFlag(flags, flag) {
  17510. return !!(flags & flag);
  17511. }
  17512. _isViewable(flags) {
  17513. return !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, _util.AnnotationFlag.NOVIEW);
  17514. }
  17515. _isPrintable(flags) {
  17516. return this._hasFlag(flags, _util.AnnotationFlag.PRINT) && !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE);
  17517. }
  17518. mustBeViewed(annotationStorage) {
  17519. const storageEntry = annotationStorage && annotationStorage.get(this.data.id);
  17520. if (storageEntry && storageEntry.hidden !== undefined) {
  17521. return !storageEntry.hidden;
  17522. }
  17523. return this.viewable && !this._hasFlag(this.flags, _util.AnnotationFlag.HIDDEN);
  17524. }
  17525. mustBePrinted(annotationStorage) {
  17526. const storageEntry = annotationStorage && annotationStorage.get(this.data.id);
  17527. if (storageEntry && storageEntry.print !== undefined) {
  17528. return storageEntry.print;
  17529. }
  17530. return this.printable;
  17531. }
  17532. get viewable() {
  17533. if (this.data.quadPoints === null) {
  17534. return false;
  17535. }
  17536. if (this.flags === 0) {
  17537. return true;
  17538. }
  17539. return this._isViewable(this.flags);
  17540. }
  17541. get printable() {
  17542. if (this.data.quadPoints === null) {
  17543. return false;
  17544. }
  17545. if (this.flags === 0) {
  17546. return false;
  17547. }
  17548. return this._isPrintable(this.flags);
  17549. }
  17550. _parseStringHelper(data) {
  17551. const str = typeof data === "string" ? (0, _util.stringToPDFString)(data) : "";
  17552. const dir = str && (0, _bidi.bidi)(str).dir === "rtl" ? "rtl" : "ltr";
  17553. return {
  17554. str,
  17555. dir
  17556. };
  17557. }
  17558. setTitle(title) {
  17559. this._title = this._parseStringHelper(title);
  17560. }
  17561. setContents(contents) {
  17562. this._contents = this._parseStringHelper(contents);
  17563. }
  17564. setModificationDate(modificationDate) {
  17565. this.modificationDate = typeof modificationDate === "string" ? modificationDate : null;
  17566. }
  17567. setFlags(flags) {
  17568. this.flags = Number.isInteger(flags) && flags > 0 ? flags : 0;
  17569. }
  17570. hasFlag(flag) {
  17571. return this._hasFlag(this.flags, flag);
  17572. }
  17573. setRectangle(rectangle) {
  17574. if (Array.isArray(rectangle) && rectangle.length === 4) {
  17575. this.rectangle = _util.Util.normalizeRect(rectangle);
  17576. } else {
  17577. this.rectangle = [0, 0, 0, 0];
  17578. }
  17579. }
  17580. setColor(color) {
  17581. this.color = getRgbColor(color);
  17582. }
  17583. setLineEndings(lineEndings) {
  17584. this.lineEndings = ["None", "None"];
  17585. if (Array.isArray(lineEndings) && lineEndings.length === 2) {
  17586. for (let i = 0; i < 2; i++) {
  17587. const obj = lineEndings[i];
  17588. if (obj instanceof _primitives.Name) {
  17589. switch (obj.name) {
  17590. case "None":
  17591. continue;
  17592. case "Square":
  17593. case "Circle":
  17594. case "Diamond":
  17595. case "OpenArrow":
  17596. case "ClosedArrow":
  17597. case "Butt":
  17598. case "ROpenArrow":
  17599. case "RClosedArrow":
  17600. case "Slash":
  17601. this.lineEndings[i] = obj.name;
  17602. continue;
  17603. }
  17604. }
  17605. (0, _util.warn)(`Ignoring invalid lineEnding: ${obj}`);
  17606. }
  17607. }
  17608. }
  17609. setRotation(mk) {
  17610. this.rotation = 0;
  17611. if (mk instanceof _primitives.Dict) {
  17612. let angle = mk.get("R") || 0;
  17613. if (Number.isInteger(angle) && angle !== 0) {
  17614. angle %= 360;
  17615. if (angle < 0) {
  17616. angle += 360;
  17617. }
  17618. if (angle % 90 === 0) {
  17619. this.rotation = angle;
  17620. }
  17621. }
  17622. }
  17623. }
  17624. setBorderAndBackgroundColors(mk) {
  17625. if (mk instanceof _primitives.Dict) {
  17626. this.borderColor = getRgbColor(mk.getArray("BC"), null);
  17627. this.backgroundColor = getRgbColor(mk.getArray("BG"), null);
  17628. } else {
  17629. this.borderColor = this.backgroundColor = null;
  17630. }
  17631. }
  17632. setBorderStyle(borderStyle) {
  17633. this.borderStyle = new AnnotationBorderStyle();
  17634. if (!(borderStyle instanceof _primitives.Dict)) {
  17635. return;
  17636. }
  17637. if (borderStyle.has("BS")) {
  17638. const dict = borderStyle.get("BS");
  17639. const dictType = dict.get("Type");
  17640. if (!dictType || (0, _primitives.isName)(dictType, "Border")) {
  17641. this.borderStyle.setWidth(dict.get("W"), this.rectangle);
  17642. this.borderStyle.setStyle(dict.get("S"));
  17643. this.borderStyle.setDashArray(dict.getArray("D"));
  17644. }
  17645. } else if (borderStyle.has("Border")) {
  17646. const array = borderStyle.getArray("Border");
  17647. if (Array.isArray(array) && array.length >= 3) {
  17648. this.borderStyle.setHorizontalCornerRadius(array[0]);
  17649. this.borderStyle.setVerticalCornerRadius(array[1]);
  17650. this.borderStyle.setWidth(array[2], this.rectangle);
  17651. if (array.length === 4) {
  17652. this.borderStyle.setDashArray(array[3], true);
  17653. }
  17654. }
  17655. } else {
  17656. this.borderStyle.setWidth(0);
  17657. }
  17658. }
  17659. setAppearance(dict) {
  17660. this.appearance = null;
  17661. const appearanceStates = dict.get("AP");
  17662. if (!(appearanceStates instanceof _primitives.Dict)) {
  17663. return;
  17664. }
  17665. const normalAppearanceState = appearanceStates.get("N");
  17666. if (normalAppearanceState instanceof _base_stream.BaseStream) {
  17667. this.appearance = normalAppearanceState;
  17668. return;
  17669. }
  17670. if (!(normalAppearanceState instanceof _primitives.Dict)) {
  17671. return;
  17672. }
  17673. const as = dict.get("AS");
  17674. if (!(as instanceof _primitives.Name) || !normalAppearanceState.has(as.name)) {
  17675. return;
  17676. }
  17677. this.appearance = normalAppearanceState.get(as.name);
  17678. }
  17679. setOptionalContent(dict) {
  17680. this.oc = null;
  17681. const oc = dict.get("OC");
  17682. if (oc instanceof _primitives.Name) {
  17683. (0, _util.warn)("setOptionalContent: Support for /Name-entry is not implemented.");
  17684. } else if (oc instanceof _primitives.Dict) {
  17685. this.oc = oc;
  17686. }
  17687. }
  17688. loadResources(keys, appearance) {
  17689. return appearance.dict.getAsync("Resources").then(resources => {
  17690. if (!resources) {
  17691. return undefined;
  17692. }
  17693. const objectLoader = new _object_loader.ObjectLoader(resources, keys, resources.xref);
  17694. return objectLoader.load().then(function () {
  17695. return resources;
  17696. });
  17697. });
  17698. }
  17699. async getOperatorList(evaluator, task, intent, renderForms, annotationStorage) {
  17700. const data = this.data;
  17701. let appearance = this.appearance;
  17702. const isUsingOwnCanvas = !!(this.data.hasOwnCanvas && intent & _util.RenderingIntentFlag.DISPLAY);
  17703. if (!appearance) {
  17704. if (!isUsingOwnCanvas) {
  17705. return {
  17706. opList: new _operator_list.OperatorList(),
  17707. separateForm: false,
  17708. separateCanvas: false
  17709. };
  17710. }
  17711. appearance = new _stream.StringStream("");
  17712. appearance.dict = new _primitives.Dict();
  17713. }
  17714. const appearanceDict = appearance.dict;
  17715. const resources = await this.loadResources(["ExtGState", "ColorSpace", "Pattern", "Shading", "XObject", "Font"], appearance);
  17716. const bbox = appearanceDict.getArray("BBox") || [0, 0, 1, 1];
  17717. const matrix = appearanceDict.getArray("Matrix") || [1, 0, 0, 1, 0, 0];
  17718. const transform = getTransformMatrix(data.rect, bbox, matrix);
  17719. const opList = new _operator_list.OperatorList();
  17720. let optionalContent;
  17721. if (this.oc) {
  17722. optionalContent = await evaluator.parseMarkedContentProps(this.oc, null);
  17723. }
  17724. if (optionalContent !== undefined) {
  17725. opList.addOp(_util.OPS.beginMarkedContentProps, ["OC", optionalContent]);
  17726. }
  17727. opList.addOp(_util.OPS.beginAnnotation, [data.id, data.rect, transform, matrix, isUsingOwnCanvas]);
  17728. await evaluator.getOperatorList({
  17729. stream: appearance,
  17730. task,
  17731. resources,
  17732. operatorList: opList,
  17733. fallbackFontDict: this._fallbackFontDict
  17734. });
  17735. opList.addOp(_util.OPS.endAnnotation, []);
  17736. if (optionalContent !== undefined) {
  17737. opList.addOp(_util.OPS.endMarkedContent, []);
  17738. }
  17739. this.reset();
  17740. return {
  17741. opList,
  17742. separateForm: false,
  17743. separateCanvas: isUsingOwnCanvas
  17744. };
  17745. }
  17746. async save(evaluator, task, annotationStorage) {
  17747. return null;
  17748. }
  17749. getFieldObject() {
  17750. if (this.data.kidIds) {
  17751. return {
  17752. id: this.data.id,
  17753. actions: this.data.actions,
  17754. name: this.data.fieldName,
  17755. strokeColor: this.data.borderColor,
  17756. fillColor: this.data.backgroundColor,
  17757. type: "",
  17758. kidIds: this.data.kidIds,
  17759. page: this.data.pageIndex,
  17760. rotation: this.rotation
  17761. };
  17762. }
  17763. return null;
  17764. }
  17765. reset() {
  17766. for (const stream of this._streams) {
  17767. stream.reset();
  17768. }
  17769. }
  17770. _constructFieldName(dict) {
  17771. if (!dict.has("T") && !dict.has("Parent")) {
  17772. (0, _util.warn)("Unknown field name, falling back to empty field name.");
  17773. return "";
  17774. }
  17775. if (!dict.has("Parent")) {
  17776. return (0, _util.stringToPDFString)(dict.get("T"));
  17777. }
  17778. const fieldName = [];
  17779. if (dict.has("T")) {
  17780. fieldName.unshift((0, _util.stringToPDFString)(dict.get("T")));
  17781. }
  17782. let loopDict = dict;
  17783. const visited = new _primitives.RefSet();
  17784. if (dict.objId) {
  17785. visited.put(dict.objId);
  17786. }
  17787. while (loopDict.has("Parent")) {
  17788. loopDict = loopDict.get("Parent");
  17789. if (!(loopDict instanceof _primitives.Dict) || loopDict.objId && visited.has(loopDict.objId)) {
  17790. break;
  17791. }
  17792. if (loopDict.objId) {
  17793. visited.put(loopDict.objId);
  17794. }
  17795. if (loopDict.has("T")) {
  17796. fieldName.unshift((0, _util.stringToPDFString)(loopDict.get("T")));
  17797. }
  17798. }
  17799. return fieldName.join(".");
  17800. }
  17801. }
  17802. exports.Annotation = Annotation;
  17803. class AnnotationBorderStyle {
  17804. constructor() {
  17805. this.width = 1;
  17806. this.style = _util.AnnotationBorderStyleType.SOLID;
  17807. this.dashArray = [3];
  17808. this.horizontalCornerRadius = 0;
  17809. this.verticalCornerRadius = 0;
  17810. }
  17811. setWidth(width, rect = [0, 0, 0, 0]) {
  17812. if (width instanceof _primitives.Name) {
  17813. this.width = 0;
  17814. return;
  17815. }
  17816. if (typeof width === "number") {
  17817. if (width > 0) {
  17818. const maxWidth = (rect[2] - rect[0]) / 2;
  17819. const maxHeight = (rect[3] - rect[1]) / 2;
  17820. if (maxWidth > 0 && maxHeight > 0 && (width > maxWidth || width > maxHeight)) {
  17821. (0, _util.warn)(`AnnotationBorderStyle.setWidth - ignoring width: ${width}`);
  17822. width = 1;
  17823. }
  17824. }
  17825. this.width = width;
  17826. }
  17827. }
  17828. setStyle(style) {
  17829. if (!(style instanceof _primitives.Name)) {
  17830. return;
  17831. }
  17832. switch (style.name) {
  17833. case "S":
  17834. this.style = _util.AnnotationBorderStyleType.SOLID;
  17835. break;
  17836. case "D":
  17837. this.style = _util.AnnotationBorderStyleType.DASHED;
  17838. break;
  17839. case "B":
  17840. this.style = _util.AnnotationBorderStyleType.BEVELED;
  17841. break;
  17842. case "I":
  17843. this.style = _util.AnnotationBorderStyleType.INSET;
  17844. break;
  17845. case "U":
  17846. this.style = _util.AnnotationBorderStyleType.UNDERLINE;
  17847. break;
  17848. default:
  17849. break;
  17850. }
  17851. }
  17852. setDashArray(dashArray, forceStyle = false) {
  17853. if (Array.isArray(dashArray) && dashArray.length > 0) {
  17854. let isValid = true;
  17855. let allZeros = true;
  17856. for (const element of dashArray) {
  17857. const validNumber = +element >= 0;
  17858. if (!validNumber) {
  17859. isValid = false;
  17860. break;
  17861. } else if (element > 0) {
  17862. allZeros = false;
  17863. }
  17864. }
  17865. if (isValid && !allZeros) {
  17866. this.dashArray = dashArray;
  17867. if (forceStyle) {
  17868. this.setStyle(_primitives.Name.get("D"));
  17869. }
  17870. } else {
  17871. this.width = 0;
  17872. }
  17873. } else if (dashArray) {
  17874. this.width = 0;
  17875. }
  17876. }
  17877. setHorizontalCornerRadius(radius) {
  17878. if (Number.isInteger(radius)) {
  17879. this.horizontalCornerRadius = radius;
  17880. }
  17881. }
  17882. setVerticalCornerRadius(radius) {
  17883. if (Number.isInteger(radius)) {
  17884. this.verticalCornerRadius = radius;
  17885. }
  17886. }
  17887. }
  17888. exports.AnnotationBorderStyle = AnnotationBorderStyle;
  17889. class MarkupAnnotation extends Annotation {
  17890. constructor(parameters) {
  17891. super(parameters);
  17892. const dict = parameters.dict;
  17893. if (dict.has("IRT")) {
  17894. const rawIRT = dict.getRaw("IRT");
  17895. this.data.inReplyTo = rawIRT instanceof _primitives.Ref ? rawIRT.toString() : null;
  17896. const rt = dict.get("RT");
  17897. this.data.replyType = rt instanceof _primitives.Name ? rt.name : _util.AnnotationReplyType.REPLY;
  17898. }
  17899. if (this.data.replyType === _util.AnnotationReplyType.GROUP) {
  17900. const parent = dict.get("IRT");
  17901. this.setTitle(parent.get("T"));
  17902. this.data.titleObj = this._title;
  17903. this.setContents(parent.get("Contents"));
  17904. this.data.contentsObj = this._contents;
  17905. if (!parent.has("CreationDate")) {
  17906. this.data.creationDate = null;
  17907. } else {
  17908. this.setCreationDate(parent.get("CreationDate"));
  17909. this.data.creationDate = this.creationDate;
  17910. }
  17911. if (!parent.has("M")) {
  17912. this.data.modificationDate = null;
  17913. } else {
  17914. this.setModificationDate(parent.get("M"));
  17915. this.data.modificationDate = this.modificationDate;
  17916. }
  17917. this.data.hasPopup = parent.has("Popup");
  17918. if (!parent.has("C")) {
  17919. this.data.color = null;
  17920. } else {
  17921. this.setColor(parent.getArray("C"));
  17922. this.data.color = this.color;
  17923. }
  17924. } else {
  17925. this.data.titleObj = this._title;
  17926. this.setCreationDate(dict.get("CreationDate"));
  17927. this.data.creationDate = this.creationDate;
  17928. this.data.hasPopup = dict.has("Popup");
  17929. if (!dict.has("C")) {
  17930. this.data.color = null;
  17931. }
  17932. }
  17933. if (dict.has("RC")) {
  17934. this.data.richText = _factory.XFAFactory.getRichTextAsHtml(dict.get("RC"));
  17935. }
  17936. }
  17937. setCreationDate(creationDate) {
  17938. this.creationDate = typeof creationDate === "string" ? creationDate : null;
  17939. }
  17940. _setDefaultAppearance({
  17941. xref,
  17942. extra,
  17943. strokeColor,
  17944. fillColor,
  17945. blendMode,
  17946. strokeAlpha,
  17947. fillAlpha,
  17948. pointsCallback
  17949. }) {
  17950. let minX = Number.MAX_VALUE;
  17951. let minY = Number.MAX_VALUE;
  17952. let maxX = Number.MIN_VALUE;
  17953. let maxY = Number.MIN_VALUE;
  17954. const buffer = ["q"];
  17955. if (extra) {
  17956. buffer.push(extra);
  17957. }
  17958. if (strokeColor) {
  17959. buffer.push(`${strokeColor[0]} ${strokeColor[1]} ${strokeColor[2]} RG`);
  17960. }
  17961. if (fillColor) {
  17962. buffer.push(`${fillColor[0]} ${fillColor[1]} ${fillColor[2]} rg`);
  17963. }
  17964. let pointsArray = this.data.quadPoints;
  17965. if (!pointsArray) {
  17966. pointsArray = [[{
  17967. x: this.rectangle[0],
  17968. y: this.rectangle[3]
  17969. }, {
  17970. x: this.rectangle[2],
  17971. y: this.rectangle[3]
  17972. }, {
  17973. x: this.rectangle[0],
  17974. y: this.rectangle[1]
  17975. }, {
  17976. x: this.rectangle[2],
  17977. y: this.rectangle[1]
  17978. }]];
  17979. }
  17980. for (const points of pointsArray) {
  17981. const [mX, MX, mY, MY] = pointsCallback(buffer, points);
  17982. minX = Math.min(minX, mX);
  17983. maxX = Math.max(maxX, MX);
  17984. minY = Math.min(minY, mY);
  17985. maxY = Math.max(maxY, MY);
  17986. }
  17987. buffer.push("Q");
  17988. const formDict = new _primitives.Dict(xref);
  17989. const appearanceStreamDict = new _primitives.Dict(xref);
  17990. appearanceStreamDict.set("Subtype", _primitives.Name.get("Form"));
  17991. const appearanceStream = new _stream.StringStream(buffer.join(" "));
  17992. appearanceStream.dict = appearanceStreamDict;
  17993. formDict.set("Fm0", appearanceStream);
  17994. const gsDict = new _primitives.Dict(xref);
  17995. if (blendMode) {
  17996. gsDict.set("BM", _primitives.Name.get(blendMode));
  17997. }
  17998. if (typeof strokeAlpha === "number") {
  17999. gsDict.set("CA", strokeAlpha);
  18000. }
  18001. if (typeof fillAlpha === "number") {
  18002. gsDict.set("ca", fillAlpha);
  18003. }
  18004. const stateDict = new _primitives.Dict(xref);
  18005. stateDict.set("GS0", gsDict);
  18006. const resources = new _primitives.Dict(xref);
  18007. resources.set("ExtGState", stateDict);
  18008. resources.set("XObject", formDict);
  18009. const appearanceDict = new _primitives.Dict(xref);
  18010. appearanceDict.set("Resources", resources);
  18011. const bbox = this.data.rect = [minX, minY, maxX, maxY];
  18012. appearanceDict.set("BBox", bbox);
  18013. this.appearance = new _stream.StringStream("/GS0 gs /Fm0 Do");
  18014. this.appearance.dict = appearanceDict;
  18015. this._streams.push(this.appearance, appearanceStream);
  18016. }
  18017. static async createNewAnnotation(xref, annotation, dependencies, params) {
  18018. const annotationRef = xref.getNewRef();
  18019. const apRef = xref.getNewRef();
  18020. const annotationDict = this.createNewDict(annotation, xref, {
  18021. apRef
  18022. });
  18023. const ap = await this.createNewAppearanceStream(annotation, xref, params);
  18024. const buffer = [];
  18025. let transform = xref.encrypt ? xref.encrypt.createCipherTransform(apRef.num, apRef.gen) : null;
  18026. (0, _writer.writeObject)(apRef, ap, buffer, transform);
  18027. dependencies.push({
  18028. ref: apRef,
  18029. data: buffer.join("")
  18030. });
  18031. buffer.length = 0;
  18032. transform = xref.encrypt ? xref.encrypt.createCipherTransform(annotationRef.num, annotationRef.gen) : null;
  18033. (0, _writer.writeObject)(annotationRef, annotationDict, buffer, transform);
  18034. return {
  18035. ref: annotationRef,
  18036. data: buffer.join("")
  18037. };
  18038. }
  18039. static async createNewPrintAnnotation(xref, annotation, params) {
  18040. const ap = await this.createNewAppearanceStream(annotation, xref, params);
  18041. const annotationDict = this.createNewDict(annotation, xref, {
  18042. ap
  18043. });
  18044. return new this.prototype.constructor({
  18045. dict: annotationDict,
  18046. xref
  18047. });
  18048. }
  18049. }
  18050. exports.MarkupAnnotation = MarkupAnnotation;
  18051. class WidgetAnnotation extends Annotation {
  18052. constructor(params) {
  18053. super(params);
  18054. const dict = params.dict;
  18055. const data = this.data;
  18056. this.ref = params.ref;
  18057. data.annotationType = _util.AnnotationType.WIDGET;
  18058. if (data.fieldName === undefined) {
  18059. data.fieldName = this._constructFieldName(dict);
  18060. }
  18061. if (data.actions === undefined) {
  18062. data.actions = (0, _core_utils.collectActions)(params.xref, dict, _util.AnnotationActionEventType);
  18063. }
  18064. let fieldValue = (0, _core_utils.getInheritableProperty)({
  18065. dict,
  18066. key: "V",
  18067. getArray: true
  18068. });
  18069. data.fieldValue = this._decodeFormValue(fieldValue);
  18070. const defaultFieldValue = (0, _core_utils.getInheritableProperty)({
  18071. dict,
  18072. key: "DV",
  18073. getArray: true
  18074. });
  18075. data.defaultFieldValue = this._decodeFormValue(defaultFieldValue);
  18076. if (fieldValue === undefined && params.xfaDatasets) {
  18077. const path = this._title.str;
  18078. if (path) {
  18079. this._hasValueFromXFA = true;
  18080. data.fieldValue = fieldValue = params.xfaDatasets.getValue(path);
  18081. }
  18082. }
  18083. if (fieldValue === undefined && data.defaultFieldValue !== null) {
  18084. data.fieldValue = data.defaultFieldValue;
  18085. }
  18086. data.alternativeText = (0, _util.stringToPDFString)(dict.get("TU") || "");
  18087. const defaultAppearance = (0, _core_utils.getInheritableProperty)({
  18088. dict,
  18089. key: "DA"
  18090. }) || params.acroForm.get("DA");
  18091. this._defaultAppearance = typeof defaultAppearance === "string" ? defaultAppearance : "";
  18092. data.defaultAppearanceData = (0, _default_appearance.parseDefaultAppearance)(this._defaultAppearance);
  18093. const fieldType = (0, _core_utils.getInheritableProperty)({
  18094. dict,
  18095. key: "FT"
  18096. });
  18097. data.fieldType = fieldType instanceof _primitives.Name ? fieldType.name : null;
  18098. const localResources = (0, _core_utils.getInheritableProperty)({
  18099. dict,
  18100. key: "DR"
  18101. });
  18102. const acroFormResources = params.acroForm.get("DR");
  18103. const appearanceResources = this.appearance && this.appearance.dict.get("Resources");
  18104. this._fieldResources = {
  18105. localResources,
  18106. acroFormResources,
  18107. appearanceResources,
  18108. mergedResources: _primitives.Dict.merge({
  18109. xref: params.xref,
  18110. dictArray: [localResources, appearanceResources, acroFormResources],
  18111. mergeSubDicts: true
  18112. })
  18113. };
  18114. data.fieldFlags = (0, _core_utils.getInheritableProperty)({
  18115. dict,
  18116. key: "Ff"
  18117. });
  18118. if (!Number.isInteger(data.fieldFlags) || data.fieldFlags < 0) {
  18119. data.fieldFlags = 0;
  18120. }
  18121. data.readOnly = this.hasFieldFlag(_util.AnnotationFieldFlag.READONLY);
  18122. data.required = this.hasFieldFlag(_util.AnnotationFieldFlag.REQUIRED);
  18123. data.hidden = this._hasFlag(data.annotationFlags, _util.AnnotationFlag.HIDDEN);
  18124. }
  18125. _decodeFormValue(formValue) {
  18126. if (Array.isArray(formValue)) {
  18127. return formValue.filter(item => typeof item === "string").map(item => (0, _util.stringToPDFString)(item));
  18128. } else if (formValue instanceof _primitives.Name) {
  18129. return (0, _util.stringToPDFString)(formValue.name);
  18130. } else if (typeof formValue === "string") {
  18131. return (0, _util.stringToPDFString)(formValue);
  18132. }
  18133. return null;
  18134. }
  18135. hasFieldFlag(flag) {
  18136. return !!(this.data.fieldFlags & flag);
  18137. }
  18138. static _getRotationMatrix(rotation, width, height) {
  18139. switch (rotation) {
  18140. case 90:
  18141. return [0, 1, -1, 0, width, 0];
  18142. case 180:
  18143. return [-1, 0, 0, -1, width, height];
  18144. case 270:
  18145. return [0, -1, 1, 0, 0, height];
  18146. default:
  18147. throw new Error("Invalid rotation");
  18148. }
  18149. }
  18150. getRotationMatrix(annotationStorage) {
  18151. const storageEntry = annotationStorage ? annotationStorage.get(this.data.id) : undefined;
  18152. let rotation = storageEntry && storageEntry.rotation;
  18153. if (rotation === undefined) {
  18154. rotation = this.rotation;
  18155. }
  18156. if (rotation === 0) {
  18157. return _util.IDENTITY_MATRIX;
  18158. }
  18159. const width = this.data.rect[2] - this.data.rect[0];
  18160. const height = this.data.rect[3] - this.data.rect[1];
  18161. return WidgetAnnotation._getRotationMatrix(rotation, width, height);
  18162. }
  18163. getBorderAndBackgroundAppearances(annotationStorage) {
  18164. const storageEntry = annotationStorage ? annotationStorage.get(this.data.id) : undefined;
  18165. let rotation = storageEntry && storageEntry.rotation;
  18166. if (rotation === undefined) {
  18167. rotation = this.rotation;
  18168. }
  18169. if (!this.backgroundColor && !this.borderColor) {
  18170. return "";
  18171. }
  18172. const width = this.data.rect[2] - this.data.rect[0];
  18173. const height = this.data.rect[3] - this.data.rect[1];
  18174. const rect = rotation === 0 || rotation === 180 ? `0 0 ${width} ${height} re` : `0 0 ${height} ${width} re`;
  18175. let str = "";
  18176. if (this.backgroundColor) {
  18177. str = `${(0, _default_appearance.getPdfColor)(this.backgroundColor, true)} ${rect} f `;
  18178. }
  18179. if (this.borderColor) {
  18180. const borderWidth = this.borderStyle.width || 1;
  18181. str += `${borderWidth} w ${(0, _default_appearance.getPdfColor)(this.borderColor, false)} ${rect} S `;
  18182. }
  18183. return str;
  18184. }
  18185. async getOperatorList(evaluator, task, intent, renderForms, annotationStorage) {
  18186. if (renderForms && !(this instanceof SignatureWidgetAnnotation)) {
  18187. return {
  18188. opList: new _operator_list.OperatorList(),
  18189. separateForm: true,
  18190. separateCanvas: false
  18191. };
  18192. }
  18193. if (!this._hasText) {
  18194. return super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage);
  18195. }
  18196. const content = await this._getAppearance(evaluator, task, annotationStorage);
  18197. if (this.appearance && content === null) {
  18198. return super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage);
  18199. }
  18200. const opList = new _operator_list.OperatorList();
  18201. if (!this._defaultAppearance || content === null) {
  18202. return {
  18203. opList,
  18204. separateForm: false,
  18205. separateCanvas: false
  18206. };
  18207. }
  18208. const matrix = [1, 0, 0, 1, 0, 0];
  18209. const bbox = [0, 0, this.data.rect[2] - this.data.rect[0], this.data.rect[3] - this.data.rect[1]];
  18210. const transform = getTransformMatrix(this.data.rect, bbox, matrix);
  18211. let optionalContent;
  18212. if (this.oc) {
  18213. optionalContent = await evaluator.parseMarkedContentProps(this.oc, null);
  18214. }
  18215. if (optionalContent !== undefined) {
  18216. opList.addOp(_util.OPS.beginMarkedContentProps, ["OC", optionalContent]);
  18217. }
  18218. opList.addOp(_util.OPS.beginAnnotation, [this.data.id, this.data.rect, transform, this.getRotationMatrix(annotationStorage), false]);
  18219. const stream = new _stream.StringStream(content);
  18220. await evaluator.getOperatorList({
  18221. stream,
  18222. task,
  18223. resources: this._fieldResources.mergedResources,
  18224. operatorList: opList
  18225. });
  18226. opList.addOp(_util.OPS.endAnnotation, []);
  18227. if (optionalContent !== undefined) {
  18228. opList.addOp(_util.OPS.endMarkedContent, []);
  18229. }
  18230. return {
  18231. opList,
  18232. separateForm: false,
  18233. separateCanvas: false
  18234. };
  18235. }
  18236. _getMKDict(rotation) {
  18237. const mk = new _primitives.Dict(null);
  18238. if (rotation) {
  18239. mk.set("R", rotation);
  18240. }
  18241. if (this.borderColor) {
  18242. mk.set("BC", Array.from(this.borderColor).map(c => c / 255));
  18243. }
  18244. if (this.backgroundColor) {
  18245. mk.set("BG", Array.from(this.backgroundColor).map(c => c / 255));
  18246. }
  18247. return mk.size > 0 ? mk : null;
  18248. }
  18249. async save(evaluator, task, annotationStorage) {
  18250. const storageEntry = annotationStorage ? annotationStorage.get(this.data.id) : undefined;
  18251. let value = storageEntry && storageEntry.value;
  18252. let rotation = storageEntry && storageEntry.rotation;
  18253. if (value === this.data.fieldValue || value === undefined) {
  18254. if (!this._hasValueFromXFA && rotation === undefined) {
  18255. return null;
  18256. }
  18257. value = value || this.data.fieldValue;
  18258. }
  18259. 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])) {
  18260. return null;
  18261. }
  18262. if (rotation === undefined) {
  18263. rotation = this.rotation;
  18264. }
  18265. let appearance = await this._getAppearance(evaluator, task, annotationStorage);
  18266. if (appearance === null) {
  18267. return null;
  18268. }
  18269. const {
  18270. xref
  18271. } = evaluator;
  18272. const dict = xref.fetchIfRef(this.ref);
  18273. if (!(dict instanceof _primitives.Dict)) {
  18274. return null;
  18275. }
  18276. const bbox = [0, 0, this.data.rect[2] - this.data.rect[0], this.data.rect[3] - this.data.rect[1]];
  18277. const xfa = {
  18278. path: (0, _util.stringToPDFString)(dict.get("T") || ""),
  18279. value
  18280. };
  18281. const newRef = xref.getNewRef();
  18282. const AP = new _primitives.Dict(xref);
  18283. AP.set("N", newRef);
  18284. const encrypt = xref.encrypt;
  18285. let originalTransform = null;
  18286. let newTransform = null;
  18287. if (encrypt) {
  18288. originalTransform = encrypt.createCipherTransform(this.ref.num, this.ref.gen);
  18289. newTransform = encrypt.createCipherTransform(newRef.num, newRef.gen);
  18290. appearance = newTransform.encryptString(appearance);
  18291. }
  18292. const encoder = val => (0, _util.isAscii)(val) ? val : (0, _util.stringToUTF16BEString)(val);
  18293. dict.set("V", Array.isArray(value) ? value.map(encoder) : encoder(value));
  18294. dict.set("AP", AP);
  18295. dict.set("M", `D:${(0, _util.getModificationDate)()}`);
  18296. const maybeMK = this._getMKDict(rotation);
  18297. if (maybeMK) {
  18298. dict.set("MK", maybeMK);
  18299. }
  18300. const appearanceDict = new _primitives.Dict(xref);
  18301. appearanceDict.set("Length", appearance.length);
  18302. appearanceDict.set("Subtype", _primitives.Name.get("Form"));
  18303. appearanceDict.set("Resources", this._getSaveFieldResources(xref));
  18304. appearanceDict.set("BBox", bbox);
  18305. const rotationMatrix = this.getRotationMatrix(annotationStorage);
  18306. if (rotationMatrix !== _util.IDENTITY_MATRIX) {
  18307. appearanceDict.set("Matrix", rotationMatrix);
  18308. }
  18309. const bufferOriginal = [`${this.ref.num} ${this.ref.gen} obj\n`];
  18310. (0, _writer.writeDict)(dict, bufferOriginal, originalTransform);
  18311. bufferOriginal.push("\nendobj\n");
  18312. const bufferNew = [`${newRef.num} ${newRef.gen} obj\n`];
  18313. (0, _writer.writeDict)(appearanceDict, bufferNew, newTransform);
  18314. bufferNew.push(" stream\n", appearance, "\nendstream\nendobj\n");
  18315. return [{
  18316. ref: this.ref,
  18317. data: bufferOriginal.join(""),
  18318. xfa
  18319. }, {
  18320. ref: newRef,
  18321. data: bufferNew.join(""),
  18322. xfa: null
  18323. }];
  18324. }
  18325. async _getAppearance(evaluator, task, annotationStorage) {
  18326. const isPassword = this.hasFieldFlag(_util.AnnotationFieldFlag.PASSWORD);
  18327. if (isPassword) {
  18328. return null;
  18329. }
  18330. const storageEntry = annotationStorage ? annotationStorage.get(this.data.id) : undefined;
  18331. let value, rotation;
  18332. if (storageEntry) {
  18333. value = storageEntry.formattedValue || storageEntry.value;
  18334. rotation = storageEntry.rotation;
  18335. }
  18336. if (rotation === undefined && value === undefined) {
  18337. if (!this._hasValueFromXFA || this.appearance) {
  18338. return null;
  18339. }
  18340. }
  18341. if (value === undefined) {
  18342. value = this.data.fieldValue;
  18343. if (!value) {
  18344. return "";
  18345. }
  18346. }
  18347. if (Array.isArray(value) && value.length === 1) {
  18348. value = value[0];
  18349. }
  18350. (0, _util.assert)(typeof value === "string", "Expected `value` to be a string.");
  18351. value = value.trim();
  18352. if (value === "") {
  18353. return "";
  18354. }
  18355. if (rotation === undefined) {
  18356. rotation = this.rotation;
  18357. }
  18358. let lineCount = -1;
  18359. if (this.data.multiLine) {
  18360. lineCount = value.split(/\r\n|\r|\n/).length;
  18361. }
  18362. const defaultPadding = 2;
  18363. const hPadding = defaultPadding;
  18364. let totalHeight = this.data.rect[3] - this.data.rect[1];
  18365. let totalWidth = this.data.rect[2] - this.data.rect[0];
  18366. if (rotation === 90 || rotation === 270) {
  18367. [totalWidth, totalHeight] = [totalHeight, totalWidth];
  18368. }
  18369. if (!this._defaultAppearance) {
  18370. this.data.defaultAppearanceData = (0, _default_appearance.parseDefaultAppearance)(this._defaultAppearance = "/Helvetica 0 Tf 0 g");
  18371. }
  18372. const font = await WidgetAnnotation._getFontData(evaluator, task, this.data.defaultAppearanceData, this._fieldResources.mergedResources);
  18373. const [defaultAppearance, fontSize] = this._computeFontSize(totalHeight - defaultPadding, totalWidth - 2 * hPadding, value, font, lineCount);
  18374. let descent = font.descent;
  18375. if (isNaN(descent)) {
  18376. descent = 0;
  18377. }
  18378. const defaultVPadding = Math.min(Math.floor((totalHeight - fontSize) / 2), defaultPadding);
  18379. const vPadding = defaultVPadding + Math.abs(descent) * fontSize;
  18380. const alignment = this.data.textAlignment;
  18381. if (this.data.multiLine) {
  18382. return this._getMultilineAppearance(defaultAppearance, value, font, fontSize, totalWidth, totalHeight, alignment, hPadding, vPadding, annotationStorage);
  18383. }
  18384. const encodedString = font.encodeString(value).join("");
  18385. if (this.data.comb) {
  18386. return this._getCombAppearance(defaultAppearance, font, encodedString, totalWidth, hPadding, vPadding, annotationStorage);
  18387. }
  18388. const colors = this.getBorderAndBackgroundAppearances(annotationStorage);
  18389. if (alignment === 0 || alignment > 2) {
  18390. return `/Tx BMC q ${colors}BT ` + defaultAppearance + ` 1 0 0 1 ${hPadding} ${vPadding} Tm (${(0, _util.escapeString)(encodedString)}) Tj` + " ET Q EMC";
  18391. }
  18392. const renderedText = this._renderText(encodedString, font, fontSize, totalWidth, alignment, hPadding, vPadding);
  18393. return `/Tx BMC q ${colors}BT ` + defaultAppearance + ` 1 0 0 1 0 0 Tm ${renderedText}` + " ET Q EMC";
  18394. }
  18395. static async _getFontData(evaluator, task, appearanceData, resources) {
  18396. const operatorList = new _operator_list.OperatorList();
  18397. const initialState = {
  18398. font: null,
  18399. clone() {
  18400. return this;
  18401. }
  18402. };
  18403. const {
  18404. fontName,
  18405. fontSize
  18406. } = appearanceData;
  18407. await evaluator.handleSetFont(resources, [fontName && _primitives.Name.get(fontName), fontSize], null, operatorList, task, initialState, null);
  18408. return initialState.font;
  18409. }
  18410. _getTextWidth(text, font) {
  18411. return font.charsToGlyphs(text).reduce((width, glyph) => width + glyph.width, 0) / 1000;
  18412. }
  18413. _computeFontSize(height, width, text, font, lineCount) {
  18414. let {
  18415. fontSize
  18416. } = this.data.defaultAppearanceData;
  18417. if (!fontSize) {
  18418. const roundWithTwoDigits = x => Math.floor(x * 100) / 100;
  18419. if (lineCount === -1) {
  18420. const textWidth = this._getTextWidth(text, font);
  18421. fontSize = roundWithTwoDigits(Math.min(height / _util.LINE_FACTOR, width / textWidth));
  18422. } else {
  18423. const lines = text.split(/\r\n?|\n/);
  18424. const cachedLines = [];
  18425. for (const line of lines) {
  18426. const encoded = font.encodeString(line).join("");
  18427. const glyphs = font.charsToGlyphs(encoded);
  18428. const positions = font.getCharPositions(encoded);
  18429. cachedLines.push({
  18430. line: encoded,
  18431. glyphs,
  18432. positions
  18433. });
  18434. }
  18435. const isTooBig = fsize => {
  18436. let totalHeight = 0;
  18437. for (const cache of cachedLines) {
  18438. const chunks = this._splitLine(null, font, fsize, width, cache);
  18439. totalHeight += chunks.length * fsize;
  18440. if (totalHeight > height) {
  18441. return true;
  18442. }
  18443. }
  18444. return false;
  18445. };
  18446. fontSize = 12;
  18447. let lineHeight = fontSize * _util.LINE_FACTOR;
  18448. let numberOfLines = Math.round(height / lineHeight);
  18449. numberOfLines = Math.max(numberOfLines, lineCount);
  18450. while (true) {
  18451. lineHeight = height / numberOfLines;
  18452. fontSize = roundWithTwoDigits(lineHeight / _util.LINE_FACTOR);
  18453. if (isTooBig(fontSize)) {
  18454. numberOfLines++;
  18455. continue;
  18456. }
  18457. break;
  18458. }
  18459. }
  18460. const {
  18461. fontName,
  18462. fontColor
  18463. } = this.data.defaultAppearanceData;
  18464. this._defaultAppearance = (0, _default_appearance.createDefaultAppearance)({
  18465. fontSize,
  18466. fontName,
  18467. fontColor
  18468. });
  18469. }
  18470. return [this._defaultAppearance, fontSize];
  18471. }
  18472. _renderText(text, font, fontSize, totalWidth, alignment, hPadding, vPadding) {
  18473. let shift;
  18474. if (alignment === 1) {
  18475. const width = this._getTextWidth(text, font) * fontSize;
  18476. shift = (totalWidth - width) / 2;
  18477. } else if (alignment === 2) {
  18478. const width = this._getTextWidth(text, font) * fontSize;
  18479. shift = totalWidth - width - hPadding;
  18480. } else {
  18481. shift = hPadding;
  18482. }
  18483. shift = (0, _core_utils.numberToString)(shift);
  18484. vPadding = (0, _core_utils.numberToString)(vPadding);
  18485. return `${shift} ${vPadding} Td (${(0, _util.escapeString)(text)}) Tj`;
  18486. }
  18487. _getSaveFieldResources(xref) {
  18488. const {
  18489. localResources,
  18490. appearanceResources,
  18491. acroFormResources
  18492. } = this._fieldResources;
  18493. const fontName = this.data.defaultAppearanceData && this.data.defaultAppearanceData.fontName;
  18494. if (!fontName) {
  18495. return localResources || _primitives.Dict.empty;
  18496. }
  18497. for (const resources of [localResources, appearanceResources]) {
  18498. if (resources instanceof _primitives.Dict) {
  18499. const localFont = resources.get("Font");
  18500. if (localFont instanceof _primitives.Dict && localFont.has(fontName)) {
  18501. return resources;
  18502. }
  18503. }
  18504. }
  18505. if (acroFormResources instanceof _primitives.Dict) {
  18506. const acroFormFont = acroFormResources.get("Font");
  18507. if (acroFormFont instanceof _primitives.Dict && acroFormFont.has(fontName)) {
  18508. const subFontDict = new _primitives.Dict(xref);
  18509. subFontDict.set(fontName, acroFormFont.getRaw(fontName));
  18510. const subResourcesDict = new _primitives.Dict(xref);
  18511. subResourcesDict.set("Font", subFontDict);
  18512. return _primitives.Dict.merge({
  18513. xref,
  18514. dictArray: [subResourcesDict, localResources],
  18515. mergeSubDicts: true
  18516. });
  18517. }
  18518. }
  18519. return localResources || _primitives.Dict.empty;
  18520. }
  18521. getFieldObject() {
  18522. return null;
  18523. }
  18524. }
  18525. class TextWidgetAnnotation extends WidgetAnnotation {
  18526. constructor(params) {
  18527. super(params);
  18528. this._hasText = true;
  18529. const dict = params.dict;
  18530. if (typeof this.data.fieldValue !== "string") {
  18531. this.data.fieldValue = "";
  18532. }
  18533. let alignment = (0, _core_utils.getInheritableProperty)({
  18534. dict,
  18535. key: "Q"
  18536. });
  18537. if (!Number.isInteger(alignment) || alignment < 0 || alignment > 2) {
  18538. alignment = null;
  18539. }
  18540. this.data.textAlignment = alignment;
  18541. let maximumLength = (0, _core_utils.getInheritableProperty)({
  18542. dict,
  18543. key: "MaxLen"
  18544. });
  18545. if (!Number.isInteger(maximumLength) || maximumLength < 0) {
  18546. maximumLength = null;
  18547. }
  18548. this.data.maxLen = maximumLength;
  18549. this.data.multiLine = this.hasFieldFlag(_util.AnnotationFieldFlag.MULTILINE);
  18550. this.data.comb = this.hasFieldFlag(_util.AnnotationFieldFlag.COMB) && !this.hasFieldFlag(_util.AnnotationFieldFlag.MULTILINE) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PASSWORD) && !this.hasFieldFlag(_util.AnnotationFieldFlag.FILESELECT) && this.data.maxLen !== null;
  18551. this.data.doNotScroll = this.hasFieldFlag(_util.AnnotationFieldFlag.DONOTSCROLL);
  18552. }
  18553. _getCombAppearance(defaultAppearance, font, text, width, hPadding, vPadding, annotationStorage) {
  18554. const combWidth = (0, _core_utils.numberToString)(width / this.data.maxLen);
  18555. const buf = [];
  18556. const positions = font.getCharPositions(text);
  18557. for (const [start, end] of positions) {
  18558. buf.push(`(${(0, _util.escapeString)(text.substring(start, end))}) Tj`);
  18559. }
  18560. const colors = this.getBorderAndBackgroundAppearances(annotationStorage);
  18561. const renderedComb = buf.join(` ${combWidth} 0 Td `);
  18562. return `/Tx BMC q ${colors}BT ` + defaultAppearance + ` 1 0 0 1 ${hPadding} ${vPadding} Tm ${renderedComb}` + " ET Q EMC";
  18563. }
  18564. _getMultilineAppearance(defaultAppearance, text, font, fontSize, width, height, alignment, hPadding, vPadding, annotationStorage) {
  18565. const lines = text.split(/\r\n?|\n/);
  18566. const buf = [];
  18567. const totalWidth = width - 2 * hPadding;
  18568. for (const line of lines) {
  18569. const chunks = this._splitLine(line, font, fontSize, totalWidth);
  18570. for (const chunk of chunks) {
  18571. const padding = buf.length === 0 ? hPadding : 0;
  18572. buf.push(this._renderText(chunk, font, fontSize, width, alignment, padding, -fontSize));
  18573. }
  18574. }
  18575. const renderedText = buf.join("\n");
  18576. const colors = this.getBorderAndBackgroundAppearances(annotationStorage);
  18577. return `/Tx BMC q ${colors}BT ` + defaultAppearance + ` 1 0 0 1 0 ${height} Tm ${renderedText}` + " ET Q EMC";
  18578. }
  18579. _splitLine(line, font, fontSize, width, cache = {}) {
  18580. line = cache.line || font.encodeString(line).join("");
  18581. const glyphs = cache.glyphs || font.charsToGlyphs(line);
  18582. if (glyphs.length <= 1) {
  18583. return [line];
  18584. }
  18585. const positions = cache.positions || font.getCharPositions(line);
  18586. const scale = fontSize / 1000;
  18587. const chunks = [];
  18588. let lastSpacePosInStringStart = -1,
  18589. lastSpacePosInStringEnd = -1,
  18590. lastSpacePos = -1,
  18591. startChunk = 0,
  18592. currentWidth = 0;
  18593. for (let i = 0, ii = glyphs.length; i < ii; i++) {
  18594. const [start, end] = positions[i];
  18595. const glyph = glyphs[i];
  18596. const glyphWidth = glyph.width * scale;
  18597. if (glyph.unicode === " ") {
  18598. if (currentWidth + glyphWidth > width) {
  18599. chunks.push(line.substring(startChunk, start));
  18600. startChunk = start;
  18601. currentWidth = glyphWidth;
  18602. lastSpacePosInStringStart = -1;
  18603. lastSpacePos = -1;
  18604. } else {
  18605. currentWidth += glyphWidth;
  18606. lastSpacePosInStringStart = start;
  18607. lastSpacePosInStringEnd = end;
  18608. lastSpacePos = i;
  18609. }
  18610. } else {
  18611. if (currentWidth + glyphWidth > width) {
  18612. if (lastSpacePosInStringStart !== -1) {
  18613. chunks.push(line.substring(startChunk, lastSpacePosInStringEnd));
  18614. startChunk = lastSpacePosInStringEnd;
  18615. i = lastSpacePos + 1;
  18616. lastSpacePosInStringStart = -1;
  18617. currentWidth = 0;
  18618. } else {
  18619. chunks.push(line.substring(startChunk, start));
  18620. startChunk = start;
  18621. currentWidth = glyphWidth;
  18622. }
  18623. } else {
  18624. currentWidth += glyphWidth;
  18625. }
  18626. }
  18627. }
  18628. if (startChunk < line.length) {
  18629. chunks.push(line.substring(startChunk, line.length));
  18630. }
  18631. return chunks;
  18632. }
  18633. getFieldObject() {
  18634. return {
  18635. id: this.data.id,
  18636. value: this.data.fieldValue,
  18637. defaultValue: this.data.defaultFieldValue || "",
  18638. multiline: this.data.multiLine,
  18639. password: this.hasFieldFlag(_util.AnnotationFieldFlag.PASSWORD),
  18640. charLimit: this.data.maxLen,
  18641. comb: this.data.comb,
  18642. editable: !this.data.readOnly,
  18643. hidden: this.data.hidden,
  18644. name: this.data.fieldName,
  18645. rect: this.data.rect,
  18646. actions: this.data.actions,
  18647. page: this.data.pageIndex,
  18648. strokeColor: this.data.borderColor,
  18649. fillColor: this.data.backgroundColor,
  18650. rotation: this.rotation,
  18651. type: "text"
  18652. };
  18653. }
  18654. }
  18655. class ButtonWidgetAnnotation extends WidgetAnnotation {
  18656. constructor(params) {
  18657. super(params);
  18658. this.checkedAppearance = null;
  18659. this.uncheckedAppearance = null;
  18660. this.data.checkBox = !this.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
  18661. this.data.radioButton = this.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
  18662. this.data.pushButton = this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
  18663. this.data.isTooltipOnly = false;
  18664. if (this.data.checkBox) {
  18665. this._processCheckBox(params);
  18666. } else if (this.data.radioButton) {
  18667. this._processRadioButton(params);
  18668. } else if (this.data.pushButton) {
  18669. this.data.hasOwnCanvas = true;
  18670. this._processPushButton(params);
  18671. } else {
  18672. (0, _util.warn)("Invalid field flags for button widget annotation");
  18673. }
  18674. }
  18675. async getOperatorList(evaluator, task, intent, renderForms, annotationStorage) {
  18676. if (this.data.pushButton) {
  18677. return super.getOperatorList(evaluator, task, intent, false, annotationStorage);
  18678. }
  18679. let value = null;
  18680. let rotation = null;
  18681. if (annotationStorage) {
  18682. const storageEntry = annotationStorage.get(this.data.id);
  18683. value = storageEntry ? storageEntry.value : null;
  18684. rotation = storageEntry ? storageEntry.rotation : null;
  18685. }
  18686. if (value === null && this.appearance) {
  18687. return super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage);
  18688. }
  18689. if (value === null || value === undefined) {
  18690. if (this.data.checkBox) {
  18691. value = this.data.fieldValue === this.data.exportValue;
  18692. } else {
  18693. value = this.data.fieldValue === this.data.buttonValue;
  18694. }
  18695. }
  18696. const appearance = value ? this.checkedAppearance : this.uncheckedAppearance;
  18697. if (appearance) {
  18698. const savedAppearance = this.appearance;
  18699. const savedMatrix = appearance.dict.getArray("Matrix") || _util.IDENTITY_MATRIX;
  18700. if (rotation) {
  18701. appearance.dict.set("Matrix", this.getRotationMatrix(annotationStorage));
  18702. }
  18703. this.appearance = appearance;
  18704. const operatorList = super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage);
  18705. this.appearance = savedAppearance;
  18706. appearance.dict.set("Matrix", savedMatrix);
  18707. return operatorList;
  18708. }
  18709. return {
  18710. opList: new _operator_list.OperatorList(),
  18711. separateForm: false,
  18712. separateCanvas: false
  18713. };
  18714. }
  18715. async save(evaluator, task, annotationStorage) {
  18716. if (this.data.checkBox) {
  18717. return this._saveCheckbox(evaluator, task, annotationStorage);
  18718. }
  18719. if (this.data.radioButton) {
  18720. return this._saveRadioButton(evaluator, task, annotationStorage);
  18721. }
  18722. return null;
  18723. }
  18724. async _saveCheckbox(evaluator, task, annotationStorage) {
  18725. if (!annotationStorage) {
  18726. return null;
  18727. }
  18728. const storageEntry = annotationStorage.get(this.data.id);
  18729. let rotation = storageEntry && storageEntry.rotation;
  18730. let value = storageEntry && storageEntry.value;
  18731. if (rotation === undefined) {
  18732. if (value === undefined) {
  18733. return null;
  18734. }
  18735. const defaultValue = this.data.fieldValue === this.data.exportValue;
  18736. if (defaultValue === value) {
  18737. return null;
  18738. }
  18739. }
  18740. const dict = evaluator.xref.fetchIfRef(this.ref);
  18741. if (!(dict instanceof _primitives.Dict)) {
  18742. return null;
  18743. }
  18744. if (rotation === undefined) {
  18745. rotation = this.rotation;
  18746. }
  18747. if (value === undefined) {
  18748. value = this.data.fieldValue === this.data.exportValue;
  18749. }
  18750. const xfa = {
  18751. path: (0, _util.stringToPDFString)(dict.get("T") || ""),
  18752. value: value ? this.data.exportValue : ""
  18753. };
  18754. const name = _primitives.Name.get(value ? this.data.exportValue : "Off");
  18755. dict.set("V", name);
  18756. dict.set("AS", name);
  18757. dict.set("M", `D:${(0, _util.getModificationDate)()}`);
  18758. const maybeMK = this._getMKDict(rotation);
  18759. if (maybeMK) {
  18760. dict.set("MK", maybeMK);
  18761. }
  18762. const encrypt = evaluator.xref.encrypt;
  18763. let originalTransform = null;
  18764. if (encrypt) {
  18765. originalTransform = encrypt.createCipherTransform(this.ref.num, this.ref.gen);
  18766. }
  18767. const buffer = [`${this.ref.num} ${this.ref.gen} obj\n`];
  18768. (0, _writer.writeDict)(dict, buffer, originalTransform);
  18769. buffer.push("\nendobj\n");
  18770. return [{
  18771. ref: this.ref,
  18772. data: buffer.join(""),
  18773. xfa
  18774. }];
  18775. }
  18776. async _saveRadioButton(evaluator, task, annotationStorage) {
  18777. if (!annotationStorage) {
  18778. return null;
  18779. }
  18780. const storageEntry = annotationStorage.get(this.data.id);
  18781. let rotation = storageEntry && storageEntry.rotation;
  18782. let value = storageEntry && storageEntry.value;
  18783. if (rotation === undefined) {
  18784. if (value === undefined) {
  18785. return null;
  18786. }
  18787. const defaultValue = this.data.fieldValue === this.data.buttonValue;
  18788. if (defaultValue === value) {
  18789. return null;
  18790. }
  18791. }
  18792. const dict = evaluator.xref.fetchIfRef(this.ref);
  18793. if (!(dict instanceof _primitives.Dict)) {
  18794. return null;
  18795. }
  18796. if (value === undefined) {
  18797. value = this.data.fieldValue === this.data.buttonValue;
  18798. }
  18799. if (rotation === undefined) {
  18800. rotation = this.rotation;
  18801. }
  18802. const xfa = {
  18803. path: (0, _util.stringToPDFString)(dict.get("T") || ""),
  18804. value: value ? this.data.buttonValue : ""
  18805. };
  18806. const name = _primitives.Name.get(value ? this.data.buttonValue : "Off");
  18807. let parentBuffer = null;
  18808. const encrypt = evaluator.xref.encrypt;
  18809. if (value) {
  18810. if (this.parent instanceof _primitives.Ref) {
  18811. const parent = evaluator.xref.fetch(this.parent);
  18812. let parentTransform = null;
  18813. if (encrypt) {
  18814. parentTransform = encrypt.createCipherTransform(this.parent.num, this.parent.gen);
  18815. }
  18816. parent.set("V", name);
  18817. parentBuffer = [`${this.parent.num} ${this.parent.gen} obj\n`];
  18818. (0, _writer.writeDict)(parent, parentBuffer, parentTransform);
  18819. parentBuffer.push("\nendobj\n");
  18820. } else if (this.parent instanceof _primitives.Dict) {
  18821. this.parent.set("V", name);
  18822. }
  18823. }
  18824. dict.set("AS", name);
  18825. dict.set("M", `D:${(0, _util.getModificationDate)()}`);
  18826. const maybeMK = this._getMKDict(rotation);
  18827. if (maybeMK) {
  18828. dict.set("MK", maybeMK);
  18829. }
  18830. let originalTransform = null;
  18831. if (encrypt) {
  18832. originalTransform = encrypt.createCipherTransform(this.ref.num, this.ref.gen);
  18833. }
  18834. const buffer = [`${this.ref.num} ${this.ref.gen} obj\n`];
  18835. (0, _writer.writeDict)(dict, buffer, originalTransform);
  18836. buffer.push("\nendobj\n");
  18837. const newRefs = [{
  18838. ref: this.ref,
  18839. data: buffer.join(""),
  18840. xfa
  18841. }];
  18842. if (parentBuffer !== null) {
  18843. newRefs.push({
  18844. ref: this.parent,
  18845. data: parentBuffer.join(""),
  18846. xfa: null
  18847. });
  18848. }
  18849. return newRefs;
  18850. }
  18851. _getDefaultCheckedAppearance(params, type) {
  18852. const width = this.data.rect[2] - this.data.rect[0];
  18853. const height = this.data.rect[3] - this.data.rect[1];
  18854. const bbox = [0, 0, width, height];
  18855. const FONT_RATIO = 0.8;
  18856. const fontSize = Math.min(width, height) * FONT_RATIO;
  18857. let metrics, char;
  18858. if (type === "check") {
  18859. metrics = {
  18860. width: 0.755 * fontSize,
  18861. height: 0.705 * fontSize
  18862. };
  18863. char = "\x33";
  18864. } else if (type === "disc") {
  18865. metrics = {
  18866. width: 0.791 * fontSize,
  18867. height: 0.705 * fontSize
  18868. };
  18869. char = "\x6C";
  18870. } else {
  18871. (0, _util.unreachable)(`_getDefaultCheckedAppearance - unsupported type: ${type}`);
  18872. }
  18873. const xShift = (0, _core_utils.numberToString)((width - metrics.width) / 2);
  18874. const yShift = (0, _core_utils.numberToString)((height - metrics.height) / 2);
  18875. const appearance = `q BT /PdfJsZaDb ${fontSize} Tf 0 g ${xShift} ${yShift} Td (${char}) Tj ET Q`;
  18876. const appearanceStreamDict = new _primitives.Dict(params.xref);
  18877. appearanceStreamDict.set("FormType", 1);
  18878. appearanceStreamDict.set("Subtype", _primitives.Name.get("Form"));
  18879. appearanceStreamDict.set("Type", _primitives.Name.get("XObject"));
  18880. appearanceStreamDict.set("BBox", bbox);
  18881. appearanceStreamDict.set("Matrix", [1, 0, 0, 1, 0, 0]);
  18882. appearanceStreamDict.set("Length", appearance.length);
  18883. const resources = new _primitives.Dict(params.xref);
  18884. const font = new _primitives.Dict(params.xref);
  18885. font.set("PdfJsZaDb", this.fallbackFontDict);
  18886. resources.set("Font", font);
  18887. appearanceStreamDict.set("Resources", resources);
  18888. this.checkedAppearance = new _stream.StringStream(appearance);
  18889. this.checkedAppearance.dict = appearanceStreamDict;
  18890. this._streams.push(this.checkedAppearance);
  18891. }
  18892. _processCheckBox(params) {
  18893. const customAppearance = params.dict.get("AP");
  18894. if (!(customAppearance instanceof _primitives.Dict)) {
  18895. return;
  18896. }
  18897. const normalAppearance = customAppearance.get("N");
  18898. if (!(normalAppearance instanceof _primitives.Dict)) {
  18899. return;
  18900. }
  18901. const asValue = this._decodeFormValue(params.dict.get("AS"));
  18902. if (typeof asValue === "string") {
  18903. this.data.fieldValue = asValue;
  18904. }
  18905. const yes = this.data.fieldValue !== null && this.data.fieldValue !== "Off" ? this.data.fieldValue : "Yes";
  18906. const exportValues = normalAppearance.getKeys();
  18907. if (exportValues.length === 0) {
  18908. exportValues.push("Off", yes);
  18909. } else if (exportValues.length === 1) {
  18910. if (exportValues[0] === "Off") {
  18911. exportValues.push(yes);
  18912. } else {
  18913. exportValues.unshift("Off");
  18914. }
  18915. } else if (exportValues.includes(yes)) {
  18916. exportValues.length = 0;
  18917. exportValues.push("Off", yes);
  18918. } else {
  18919. const otherYes = exportValues.find(v => v !== "Off");
  18920. exportValues.length = 0;
  18921. exportValues.push("Off", otherYes);
  18922. }
  18923. if (!exportValues.includes(this.data.fieldValue)) {
  18924. this.data.fieldValue = "Off";
  18925. }
  18926. this.data.exportValue = exportValues[1];
  18927. this.checkedAppearance = normalAppearance.get(this.data.exportValue) || null;
  18928. this.uncheckedAppearance = normalAppearance.get("Off") || null;
  18929. if (this.checkedAppearance) {
  18930. this._streams.push(this.checkedAppearance);
  18931. } else {
  18932. this._getDefaultCheckedAppearance(params, "check");
  18933. }
  18934. if (this.uncheckedAppearance) {
  18935. this._streams.push(this.uncheckedAppearance);
  18936. }
  18937. this._fallbackFontDict = this.fallbackFontDict;
  18938. }
  18939. _processRadioButton(params) {
  18940. this.data.fieldValue = this.data.buttonValue = null;
  18941. const fieldParent = params.dict.get("Parent");
  18942. if (fieldParent instanceof _primitives.Dict) {
  18943. this.parent = params.dict.getRaw("Parent");
  18944. const fieldParentValue = fieldParent.get("V");
  18945. if (fieldParentValue instanceof _primitives.Name) {
  18946. this.data.fieldValue = this._decodeFormValue(fieldParentValue);
  18947. }
  18948. }
  18949. const appearanceStates = params.dict.get("AP");
  18950. if (!(appearanceStates instanceof _primitives.Dict)) {
  18951. return;
  18952. }
  18953. const normalAppearance = appearanceStates.get("N");
  18954. if (!(normalAppearance instanceof _primitives.Dict)) {
  18955. return;
  18956. }
  18957. for (const key of normalAppearance.getKeys()) {
  18958. if (key !== "Off") {
  18959. this.data.buttonValue = this._decodeFormValue(key);
  18960. break;
  18961. }
  18962. }
  18963. this.checkedAppearance = normalAppearance.get(this.data.buttonValue) || null;
  18964. this.uncheckedAppearance = normalAppearance.get("Off") || null;
  18965. if (this.checkedAppearance) {
  18966. this._streams.push(this.checkedAppearance);
  18967. } else {
  18968. this._getDefaultCheckedAppearance(params, "disc");
  18969. }
  18970. if (this.uncheckedAppearance) {
  18971. this._streams.push(this.uncheckedAppearance);
  18972. }
  18973. this._fallbackFontDict = this.fallbackFontDict;
  18974. }
  18975. _processPushButton(params) {
  18976. if (!params.dict.has("A") && !params.dict.has("AA") && !this.data.alternativeText) {
  18977. (0, _util.warn)("Push buttons without action dictionaries are not supported");
  18978. return;
  18979. }
  18980. this.data.isTooltipOnly = !params.dict.has("A") && !params.dict.has("AA");
  18981. _catalog.Catalog.parseDestDictionary({
  18982. destDict: params.dict,
  18983. resultObj: this.data,
  18984. docBaseUrl: params.pdfManager.docBaseUrl
  18985. });
  18986. }
  18987. getFieldObject() {
  18988. let type = "button";
  18989. let exportValues;
  18990. if (this.data.checkBox) {
  18991. type = "checkbox";
  18992. exportValues = this.data.exportValue;
  18993. } else if (this.data.radioButton) {
  18994. type = "radiobutton";
  18995. exportValues = this.data.buttonValue;
  18996. }
  18997. return {
  18998. id: this.data.id,
  18999. value: this.data.fieldValue || "Off",
  19000. defaultValue: this.data.defaultFieldValue,
  19001. exportValues,
  19002. editable: !this.data.readOnly,
  19003. name: this.data.fieldName,
  19004. rect: this.data.rect,
  19005. hidden: this.data.hidden,
  19006. actions: this.data.actions,
  19007. page: this.data.pageIndex,
  19008. strokeColor: this.data.borderColor,
  19009. fillColor: this.data.backgroundColor,
  19010. rotation: this.rotation,
  19011. type
  19012. };
  19013. }
  19014. get fallbackFontDict() {
  19015. const dict = new _primitives.Dict();
  19016. dict.set("BaseFont", _primitives.Name.get("ZapfDingbats"));
  19017. dict.set("Type", _primitives.Name.get("FallbackType"));
  19018. dict.set("Subtype", _primitives.Name.get("FallbackType"));
  19019. dict.set("Encoding", _primitives.Name.get("ZapfDingbatsEncoding"));
  19020. return (0, _util.shadow)(this, "fallbackFontDict", dict);
  19021. }
  19022. }
  19023. class ChoiceWidgetAnnotation extends WidgetAnnotation {
  19024. constructor(params) {
  19025. super(params);
  19026. this.data.options = [];
  19027. const options = (0, _core_utils.getInheritableProperty)({
  19028. dict: params.dict,
  19029. key: "Opt"
  19030. });
  19031. if (Array.isArray(options)) {
  19032. const xref = params.xref;
  19033. for (let i = 0, ii = options.length; i < ii; i++) {
  19034. const option = xref.fetchIfRef(options[i]);
  19035. const isOptionArray = Array.isArray(option);
  19036. this.data.options[i] = {
  19037. exportValue: this._decodeFormValue(isOptionArray ? xref.fetchIfRef(option[0]) : option),
  19038. displayValue: this._decodeFormValue(isOptionArray ? xref.fetchIfRef(option[1]) : option)
  19039. };
  19040. }
  19041. }
  19042. if (typeof this.data.fieldValue === "string") {
  19043. this.data.fieldValue = [this.data.fieldValue];
  19044. } else if (!this.data.fieldValue) {
  19045. this.data.fieldValue = [];
  19046. }
  19047. this.data.combo = this.hasFieldFlag(_util.AnnotationFieldFlag.COMBO);
  19048. this.data.multiSelect = this.hasFieldFlag(_util.AnnotationFieldFlag.MULTISELECT);
  19049. this._hasText = true;
  19050. }
  19051. getFieldObject() {
  19052. const type = this.data.combo ? "combobox" : "listbox";
  19053. const value = this.data.fieldValue.length > 0 ? this.data.fieldValue[0] : null;
  19054. return {
  19055. id: this.data.id,
  19056. value,
  19057. defaultValue: this.data.defaultFieldValue,
  19058. editable: !this.data.readOnly,
  19059. name: this.data.fieldName,
  19060. rect: this.data.rect,
  19061. numItems: this.data.fieldValue.length,
  19062. multipleSelection: this.data.multiSelect,
  19063. hidden: this.data.hidden,
  19064. actions: this.data.actions,
  19065. items: this.data.options,
  19066. page: this.data.pageIndex,
  19067. strokeColor: this.data.borderColor,
  19068. fillColor: this.data.backgroundColor,
  19069. rotation: this.rotation,
  19070. type
  19071. };
  19072. }
  19073. async _getAppearance(evaluator, task, annotationStorage) {
  19074. if (this.data.combo) {
  19075. return super._getAppearance(evaluator, task, annotationStorage);
  19076. }
  19077. if (!annotationStorage) {
  19078. return null;
  19079. }
  19080. const storageEntry = annotationStorage.get(this.data.id);
  19081. if (!storageEntry) {
  19082. return null;
  19083. }
  19084. const rotation = storageEntry.rotation;
  19085. let exportedValue = storageEntry.value;
  19086. if (rotation === undefined && exportedValue === undefined) {
  19087. return null;
  19088. }
  19089. if (exportedValue === undefined) {
  19090. exportedValue = this.data.fieldValue;
  19091. } else if (!Array.isArray(exportedValue)) {
  19092. exportedValue = [exportedValue];
  19093. }
  19094. const defaultPadding = 2;
  19095. const hPadding = defaultPadding;
  19096. let totalHeight = this.data.rect[3] - this.data.rect[1];
  19097. let totalWidth = this.data.rect[2] - this.data.rect[0];
  19098. if (rotation === 90 || rotation === 270) {
  19099. [totalWidth, totalHeight] = [totalHeight, totalWidth];
  19100. }
  19101. const lineCount = this.data.options.length;
  19102. const valueIndices = [];
  19103. for (let i = 0; i < lineCount; i++) {
  19104. const {
  19105. exportValue
  19106. } = this.data.options[i];
  19107. if (exportedValue.includes(exportValue)) {
  19108. valueIndices.push(i);
  19109. }
  19110. }
  19111. if (!this._defaultAppearance) {
  19112. this.data.defaultAppearanceData = (0, _default_appearance.parseDefaultAppearance)(this._defaultAppearance = "/Helvetica 0 Tf 0 g");
  19113. }
  19114. const font = await WidgetAnnotation._getFontData(evaluator, task, this.data.defaultAppearanceData, this._fieldResources.mergedResources);
  19115. let defaultAppearance;
  19116. let {
  19117. fontSize
  19118. } = this.data.defaultAppearanceData;
  19119. if (!fontSize) {
  19120. const lineHeight = (totalHeight - defaultPadding) / lineCount;
  19121. let lineWidth = -1;
  19122. let value;
  19123. for (const {
  19124. displayValue
  19125. } of this.data.options) {
  19126. const width = this._getTextWidth(displayValue, font);
  19127. if (width > lineWidth) {
  19128. lineWidth = width;
  19129. value = displayValue;
  19130. }
  19131. }
  19132. [defaultAppearance, fontSize] = this._computeFontSize(lineHeight, totalWidth - 2 * hPadding, value, font, -1);
  19133. } else {
  19134. defaultAppearance = this._defaultAppearance;
  19135. }
  19136. const lineHeight = fontSize * _util.LINE_FACTOR;
  19137. const vPadding = (lineHeight - fontSize) / 2;
  19138. const numberOfVisibleLines = Math.floor(totalHeight / lineHeight);
  19139. let firstIndex;
  19140. if (valueIndices.length === 1) {
  19141. const valuePosition = valueIndices[0];
  19142. const indexInPage = valuePosition % numberOfVisibleLines;
  19143. firstIndex = valuePosition - indexInPage;
  19144. } else {
  19145. firstIndex = valueIndices.length ? valueIndices[0] : 0;
  19146. }
  19147. const end = Math.min(firstIndex + numberOfVisibleLines + 1, lineCount);
  19148. const buf = ["/Tx BMC q", `1 1 ${totalWidth} ${totalHeight} re W n`];
  19149. if (valueIndices.length) {
  19150. buf.push("0.600006 0.756866 0.854904 rg");
  19151. for (const index of valueIndices) {
  19152. if (firstIndex <= index && index < end) {
  19153. buf.push(`1 ${totalHeight - (index - firstIndex + 1) * lineHeight} ${totalWidth} ${lineHeight} re f`);
  19154. }
  19155. }
  19156. }
  19157. buf.push("BT", defaultAppearance, `1 0 0 1 0 ${totalHeight} Tm`);
  19158. for (let i = firstIndex; i < end; i++) {
  19159. const {
  19160. displayValue
  19161. } = this.data.options[i];
  19162. const hpadding = i === firstIndex ? hPadding : 0;
  19163. const vpadding = i === firstIndex ? vPadding : 0;
  19164. buf.push(this._renderText(displayValue, font, fontSize, totalWidth, 0, hpadding, -lineHeight + vpadding));
  19165. }
  19166. buf.push("ET Q EMC");
  19167. return buf.join("\n");
  19168. }
  19169. }
  19170. class SignatureWidgetAnnotation extends WidgetAnnotation {
  19171. constructor(params) {
  19172. super(params);
  19173. this.data.fieldValue = null;
  19174. }
  19175. getFieldObject() {
  19176. return {
  19177. id: this.data.id,
  19178. value: null,
  19179. page: this.data.pageIndex,
  19180. type: "signature"
  19181. };
  19182. }
  19183. }
  19184. class TextAnnotation extends MarkupAnnotation {
  19185. constructor(parameters) {
  19186. const DEFAULT_ICON_SIZE = 22;
  19187. super(parameters);
  19188. const dict = parameters.dict;
  19189. this.data.annotationType = _util.AnnotationType.TEXT;
  19190. if (this.data.hasAppearance) {
  19191. this.data.name = "NoIcon";
  19192. } else {
  19193. this.data.rect[1] = this.data.rect[3] - DEFAULT_ICON_SIZE;
  19194. this.data.rect[2] = this.data.rect[0] + DEFAULT_ICON_SIZE;
  19195. this.data.name = dict.has("Name") ? dict.get("Name").name : "Note";
  19196. }
  19197. if (dict.has("State")) {
  19198. this.data.state = dict.get("State") || null;
  19199. this.data.stateModel = dict.get("StateModel") || null;
  19200. } else {
  19201. this.data.state = null;
  19202. this.data.stateModel = null;
  19203. }
  19204. }
  19205. }
  19206. class LinkAnnotation extends Annotation {
  19207. constructor(params) {
  19208. super(params);
  19209. this.data.annotationType = _util.AnnotationType.LINK;
  19210. const quadPoints = getQuadPoints(params.dict, this.rectangle);
  19211. if (quadPoints) {
  19212. this.data.quadPoints = quadPoints;
  19213. }
  19214. this.data.borderColor = this.data.borderColor || this.data.color;
  19215. _catalog.Catalog.parseDestDictionary({
  19216. destDict: params.dict,
  19217. resultObj: this.data,
  19218. docBaseUrl: params.pdfManager.docBaseUrl
  19219. });
  19220. }
  19221. }
  19222. class PopupAnnotation extends Annotation {
  19223. constructor(parameters) {
  19224. super(parameters);
  19225. this.data.annotationType = _util.AnnotationType.POPUP;
  19226. let parentItem = parameters.dict.get("Parent");
  19227. if (!parentItem) {
  19228. (0, _util.warn)("Popup annotation has a missing or invalid parent annotation.");
  19229. return;
  19230. }
  19231. const parentSubtype = parentItem.get("Subtype");
  19232. this.data.parentType = parentSubtype instanceof _primitives.Name ? parentSubtype.name : null;
  19233. const rawParent = parameters.dict.getRaw("Parent");
  19234. this.data.parentId = rawParent instanceof _primitives.Ref ? rawParent.toString() : null;
  19235. const parentRect = parentItem.getArray("Rect");
  19236. if (Array.isArray(parentRect) && parentRect.length === 4) {
  19237. this.data.parentRect = _util.Util.normalizeRect(parentRect);
  19238. } else {
  19239. this.data.parentRect = [0, 0, 0, 0];
  19240. }
  19241. const rt = parentItem.get("RT");
  19242. if ((0, _primitives.isName)(rt, _util.AnnotationReplyType.GROUP)) {
  19243. parentItem = parentItem.get("IRT");
  19244. }
  19245. if (!parentItem.has("M")) {
  19246. this.data.modificationDate = null;
  19247. } else {
  19248. this.setModificationDate(parentItem.get("M"));
  19249. this.data.modificationDate = this.modificationDate;
  19250. }
  19251. if (!parentItem.has("C")) {
  19252. this.data.color = null;
  19253. } else {
  19254. this.setColor(parentItem.getArray("C"));
  19255. this.data.color = this.color;
  19256. }
  19257. if (!this.viewable) {
  19258. const parentFlags = parentItem.get("F");
  19259. if (this._isViewable(parentFlags)) {
  19260. this.setFlags(parentFlags);
  19261. }
  19262. }
  19263. this.setTitle(parentItem.get("T"));
  19264. this.data.titleObj = this._title;
  19265. this.setContents(parentItem.get("Contents"));
  19266. this.data.contentsObj = this._contents;
  19267. if (parentItem.has("RC")) {
  19268. this.data.richText = _factory.XFAFactory.getRichTextAsHtml(parentItem.get("RC"));
  19269. }
  19270. }
  19271. }
  19272. class FreeTextAnnotation extends MarkupAnnotation {
  19273. constructor(parameters) {
  19274. super(parameters);
  19275. this.data.annotationType = _util.AnnotationType.FREETEXT;
  19276. }
  19277. static createNewDict(annotation, xref, {
  19278. apRef,
  19279. ap
  19280. }) {
  19281. const {
  19282. color,
  19283. fontSize,
  19284. rect,
  19285. rotation,
  19286. user,
  19287. value
  19288. } = annotation;
  19289. const freetext = new _primitives.Dict(xref);
  19290. freetext.set("Type", _primitives.Name.get("Annot"));
  19291. freetext.set("Subtype", _primitives.Name.get("FreeText"));
  19292. freetext.set("CreationDate", `D:${(0, _util.getModificationDate)()}`);
  19293. freetext.set("Rect", rect);
  19294. const da = `/Helv ${fontSize} Tf ${(0, _default_appearance.getPdfColor)(color, true)}`;
  19295. freetext.set("DA", da);
  19296. freetext.set("Contents", value);
  19297. freetext.set("F", 4);
  19298. freetext.set("Border", [0, 0, 0]);
  19299. freetext.set("Rotate", rotation);
  19300. if (user) {
  19301. freetext.set("T", (0, _util.stringToUTF8String)(user));
  19302. }
  19303. const n = new _primitives.Dict(xref);
  19304. freetext.set("AP", n);
  19305. if (apRef) {
  19306. n.set("N", apRef);
  19307. } else {
  19308. n.set("N", ap);
  19309. }
  19310. return freetext;
  19311. }
  19312. static async createNewAppearanceStream(annotation, xref, params) {
  19313. const {
  19314. baseFontRef,
  19315. evaluator,
  19316. task
  19317. } = params;
  19318. const {
  19319. color,
  19320. fontSize,
  19321. rect,
  19322. rotation,
  19323. value
  19324. } = annotation;
  19325. const resources = new _primitives.Dict(xref);
  19326. const font = new _primitives.Dict(xref);
  19327. if (baseFontRef) {
  19328. font.set("Helv", baseFontRef);
  19329. } else {
  19330. const baseFont = new _primitives.Dict(xref);
  19331. baseFont.set("BaseFont", _primitives.Name.get("Helvetica"));
  19332. baseFont.set("Type", _primitives.Name.get("Font"));
  19333. baseFont.set("Subtype", _primitives.Name.get("Type1"));
  19334. baseFont.set("Encoding", _primitives.Name.get("WinAnsiEncoding"));
  19335. font.set("Helv", baseFont);
  19336. }
  19337. resources.set("Font", font);
  19338. const helv = await WidgetAnnotation._getFontData(evaluator, task, {
  19339. fontName: "Helvetica",
  19340. fontSize
  19341. }, resources);
  19342. const [x1, y1, x2, y2] = rect;
  19343. let w = x2 - x1;
  19344. let h = y2 - y1;
  19345. if (rotation % 180 !== 0) {
  19346. [w, h] = [h, w];
  19347. }
  19348. const lines = value.split("\n");
  19349. const scale = fontSize / 1000;
  19350. let totalWidth = -Infinity;
  19351. const encodedLines = [];
  19352. for (let line of lines) {
  19353. line = helv.encodeString(line).join("");
  19354. encodedLines.push(line);
  19355. let lineWidth = 0;
  19356. const glyphs = helv.charsToGlyphs(line);
  19357. for (const glyph of glyphs) {
  19358. lineWidth += glyph.width * scale;
  19359. }
  19360. totalWidth = Math.max(totalWidth, lineWidth);
  19361. }
  19362. let hscale = 1;
  19363. if (totalWidth > w) {
  19364. hscale = w / totalWidth;
  19365. }
  19366. let vscale = 1;
  19367. const lineHeight = _util.LINE_FACTOR * fontSize;
  19368. const lineDescent = _util.LINE_DESCENT_FACTOR * fontSize;
  19369. const totalHeight = lineHeight * lines.length;
  19370. if (totalHeight > h) {
  19371. vscale = h / totalHeight;
  19372. }
  19373. const fscale = Math.min(hscale, vscale);
  19374. const newFontSize = fontSize * fscale;
  19375. 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`];
  19376. const vShift = (0, _core_utils.numberToString)(lineHeight);
  19377. for (const line of encodedLines) {
  19378. buffer.push(`0 -${vShift} Td (${(0, _util.escapeString)(line)}) Tj`);
  19379. }
  19380. buffer.push("ET", "Q");
  19381. const appearance = buffer.join("\n");
  19382. const appearanceStreamDict = new _primitives.Dict(xref);
  19383. appearanceStreamDict.set("FormType", 1);
  19384. appearanceStreamDict.set("Subtype", _primitives.Name.get("Form"));
  19385. appearanceStreamDict.set("Type", _primitives.Name.get("XObject"));
  19386. appearanceStreamDict.set("BBox", [0, 0, w, h]);
  19387. appearanceStreamDict.set("Length", appearance.length);
  19388. appearanceStreamDict.set("Resources", resources);
  19389. if (rotation) {
  19390. const matrix = WidgetAnnotation._getRotationMatrix(rotation, w, h);
  19391. appearanceStreamDict.set("Matrix", matrix);
  19392. }
  19393. const ap = new _stream.StringStream(appearance);
  19394. ap.dict = appearanceStreamDict;
  19395. return ap;
  19396. }
  19397. }
  19398. class LineAnnotation extends MarkupAnnotation {
  19399. constructor(parameters) {
  19400. super(parameters);
  19401. const {
  19402. dict
  19403. } = parameters;
  19404. this.data.annotationType = _util.AnnotationType.LINE;
  19405. const lineCoordinates = dict.getArray("L");
  19406. this.data.lineCoordinates = _util.Util.normalizeRect(lineCoordinates);
  19407. this.setLineEndings(dict.getArray("LE"));
  19408. this.data.lineEndings = this.lineEndings;
  19409. if (!this.appearance) {
  19410. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  19411. const strokeAlpha = dict.get("CA");
  19412. let fillColor = null,
  19413. interiorColor = dict.getArray("IC");
  19414. if (interiorColor) {
  19415. interiorColor = getRgbColor(interiorColor, null);
  19416. fillColor = interiorColor ? Array.from(interiorColor).map(c => c / 255) : null;
  19417. }
  19418. const fillAlpha = fillColor ? strokeAlpha : null;
  19419. const borderWidth = this.borderStyle.width || 1,
  19420. borderAdjust = 2 * borderWidth;
  19421. const bbox = [this.data.lineCoordinates[0] - borderAdjust, this.data.lineCoordinates[1] - borderAdjust, this.data.lineCoordinates[2] + borderAdjust, this.data.lineCoordinates[3] + borderAdjust];
  19422. if (!_util.Util.intersect(this.rectangle, bbox)) {
  19423. this.rectangle = bbox;
  19424. }
  19425. this._setDefaultAppearance({
  19426. xref: parameters.xref,
  19427. extra: `${borderWidth} w`,
  19428. strokeColor,
  19429. fillColor,
  19430. strokeAlpha,
  19431. fillAlpha,
  19432. pointsCallback: (buffer, points) => {
  19433. buffer.push(`${lineCoordinates[0]} ${lineCoordinates[1]} m`, `${lineCoordinates[2]} ${lineCoordinates[3]} l`, "S");
  19434. return [points[0].x - borderWidth, points[1].x + borderWidth, points[3].y - borderWidth, points[1].y + borderWidth];
  19435. }
  19436. });
  19437. }
  19438. }
  19439. }
  19440. class SquareAnnotation extends MarkupAnnotation {
  19441. constructor(parameters) {
  19442. super(parameters);
  19443. this.data.annotationType = _util.AnnotationType.SQUARE;
  19444. if (!this.appearance) {
  19445. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  19446. const strokeAlpha = parameters.dict.get("CA");
  19447. let fillColor = null,
  19448. interiorColor = parameters.dict.getArray("IC");
  19449. if (interiorColor) {
  19450. interiorColor = getRgbColor(interiorColor, null);
  19451. fillColor = interiorColor ? Array.from(interiorColor).map(c => c / 255) : null;
  19452. }
  19453. const fillAlpha = fillColor ? strokeAlpha : null;
  19454. if (this.borderStyle.width === 0 && !fillColor) {
  19455. return;
  19456. }
  19457. this._setDefaultAppearance({
  19458. xref: parameters.xref,
  19459. extra: `${this.borderStyle.width} w`,
  19460. strokeColor,
  19461. fillColor,
  19462. strokeAlpha,
  19463. fillAlpha,
  19464. pointsCallback: (buffer, points) => {
  19465. const x = points[2].x + this.borderStyle.width / 2;
  19466. const y = points[2].y + this.borderStyle.width / 2;
  19467. const width = points[3].x - points[2].x - this.borderStyle.width;
  19468. const height = points[1].y - points[3].y - this.borderStyle.width;
  19469. buffer.push(`${x} ${y} ${width} ${height} re`);
  19470. if (fillColor) {
  19471. buffer.push("B");
  19472. } else {
  19473. buffer.push("S");
  19474. }
  19475. return [points[0].x, points[1].x, points[3].y, points[1].y];
  19476. }
  19477. });
  19478. }
  19479. }
  19480. }
  19481. class CircleAnnotation extends MarkupAnnotation {
  19482. constructor(parameters) {
  19483. super(parameters);
  19484. this.data.annotationType = _util.AnnotationType.CIRCLE;
  19485. if (!this.appearance) {
  19486. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  19487. const strokeAlpha = parameters.dict.get("CA");
  19488. let fillColor = null;
  19489. let interiorColor = parameters.dict.getArray("IC");
  19490. if (interiorColor) {
  19491. interiorColor = getRgbColor(interiorColor, null);
  19492. fillColor = interiorColor ? Array.from(interiorColor).map(c => c / 255) : null;
  19493. }
  19494. const fillAlpha = fillColor ? strokeAlpha : null;
  19495. if (this.borderStyle.width === 0 && !fillColor) {
  19496. return;
  19497. }
  19498. const controlPointsDistance = 4 / 3 * Math.tan(Math.PI / (2 * 4));
  19499. this._setDefaultAppearance({
  19500. xref: parameters.xref,
  19501. extra: `${this.borderStyle.width} w`,
  19502. strokeColor,
  19503. fillColor,
  19504. strokeAlpha,
  19505. fillAlpha,
  19506. pointsCallback: (buffer, points) => {
  19507. const x0 = points[0].x + this.borderStyle.width / 2;
  19508. const y0 = points[0].y - this.borderStyle.width / 2;
  19509. const x1 = points[3].x - this.borderStyle.width / 2;
  19510. const y1 = points[3].y + this.borderStyle.width / 2;
  19511. const xMid = x0 + (x1 - x0) / 2;
  19512. const yMid = y0 + (y1 - y0) / 2;
  19513. const xOffset = (x1 - x0) / 2 * controlPointsDistance;
  19514. const yOffset = (y1 - y0) / 2 * controlPointsDistance;
  19515. 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");
  19516. if (fillColor) {
  19517. buffer.push("B");
  19518. } else {
  19519. buffer.push("S");
  19520. }
  19521. return [points[0].x, points[1].x, points[3].y, points[1].y];
  19522. }
  19523. });
  19524. }
  19525. }
  19526. }
  19527. class PolylineAnnotation extends MarkupAnnotation {
  19528. constructor(parameters) {
  19529. super(parameters);
  19530. const {
  19531. dict
  19532. } = parameters;
  19533. this.data.annotationType = _util.AnnotationType.POLYLINE;
  19534. this.data.vertices = [];
  19535. if (!(this instanceof PolygonAnnotation)) {
  19536. this.setLineEndings(dict.getArray("LE"));
  19537. this.data.lineEndings = this.lineEndings;
  19538. }
  19539. const rawVertices = dict.getArray("Vertices");
  19540. if (!Array.isArray(rawVertices)) {
  19541. return;
  19542. }
  19543. for (let i = 0, ii = rawVertices.length; i < ii; i += 2) {
  19544. this.data.vertices.push({
  19545. x: rawVertices[i],
  19546. y: rawVertices[i + 1]
  19547. });
  19548. }
  19549. if (!this.appearance) {
  19550. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  19551. const strokeAlpha = dict.get("CA");
  19552. const borderWidth = this.borderStyle.width || 1,
  19553. borderAdjust = 2 * borderWidth;
  19554. const bbox = [Infinity, Infinity, -Infinity, -Infinity];
  19555. for (const vertex of this.data.vertices) {
  19556. bbox[0] = Math.min(bbox[0], vertex.x - borderAdjust);
  19557. bbox[1] = Math.min(bbox[1], vertex.y - borderAdjust);
  19558. bbox[2] = Math.max(bbox[2], vertex.x + borderAdjust);
  19559. bbox[3] = Math.max(bbox[3], vertex.y + borderAdjust);
  19560. }
  19561. if (!_util.Util.intersect(this.rectangle, bbox)) {
  19562. this.rectangle = bbox;
  19563. }
  19564. this._setDefaultAppearance({
  19565. xref: parameters.xref,
  19566. extra: `${borderWidth} w`,
  19567. strokeColor,
  19568. strokeAlpha,
  19569. pointsCallback: (buffer, points) => {
  19570. const vertices = this.data.vertices;
  19571. for (let i = 0, ii = vertices.length; i < ii; i++) {
  19572. buffer.push(`${vertices[i].x} ${vertices[i].y} ${i === 0 ? "m" : "l"}`);
  19573. }
  19574. buffer.push("S");
  19575. return [points[0].x, points[1].x, points[3].y, points[1].y];
  19576. }
  19577. });
  19578. }
  19579. }
  19580. }
  19581. class PolygonAnnotation extends PolylineAnnotation {
  19582. constructor(parameters) {
  19583. super(parameters);
  19584. this.data.annotationType = _util.AnnotationType.POLYGON;
  19585. }
  19586. }
  19587. class CaretAnnotation extends MarkupAnnotation {
  19588. constructor(parameters) {
  19589. super(parameters);
  19590. this.data.annotationType = _util.AnnotationType.CARET;
  19591. }
  19592. }
  19593. class InkAnnotation extends MarkupAnnotation {
  19594. constructor(parameters) {
  19595. super(parameters);
  19596. this.data.annotationType = _util.AnnotationType.INK;
  19597. this.data.inkLists = [];
  19598. const rawInkLists = parameters.dict.getArray("InkList");
  19599. if (!Array.isArray(rawInkLists)) {
  19600. return;
  19601. }
  19602. const xref = parameters.xref;
  19603. for (let i = 0, ii = rawInkLists.length; i < ii; ++i) {
  19604. this.data.inkLists.push([]);
  19605. for (let j = 0, jj = rawInkLists[i].length; j < jj; j += 2) {
  19606. this.data.inkLists[i].push({
  19607. x: xref.fetchIfRef(rawInkLists[i][j]),
  19608. y: xref.fetchIfRef(rawInkLists[i][j + 1])
  19609. });
  19610. }
  19611. }
  19612. if (!this.appearance) {
  19613. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  19614. const strokeAlpha = parameters.dict.get("CA");
  19615. const borderWidth = this.borderStyle.width || 1,
  19616. borderAdjust = 2 * borderWidth;
  19617. const bbox = [Infinity, Infinity, -Infinity, -Infinity];
  19618. for (const inkLists of this.data.inkLists) {
  19619. for (const vertex of inkLists) {
  19620. bbox[0] = Math.min(bbox[0], vertex.x - borderAdjust);
  19621. bbox[1] = Math.min(bbox[1], vertex.y - borderAdjust);
  19622. bbox[2] = Math.max(bbox[2], vertex.x + borderAdjust);
  19623. bbox[3] = Math.max(bbox[3], vertex.y + borderAdjust);
  19624. }
  19625. }
  19626. if (!_util.Util.intersect(this.rectangle, bbox)) {
  19627. this.rectangle = bbox;
  19628. }
  19629. this._setDefaultAppearance({
  19630. xref: parameters.xref,
  19631. extra: `${borderWidth} w`,
  19632. strokeColor,
  19633. strokeAlpha,
  19634. pointsCallback: (buffer, points) => {
  19635. for (const inkList of this.data.inkLists) {
  19636. for (let i = 0, ii = inkList.length; i < ii; i++) {
  19637. buffer.push(`${inkList[i].x} ${inkList[i].y} ${i === 0 ? "m" : "l"}`);
  19638. }
  19639. buffer.push("S");
  19640. }
  19641. return [points[0].x, points[1].x, points[3].y, points[1].y];
  19642. }
  19643. });
  19644. }
  19645. }
  19646. static createNewDict(annotation, xref, {
  19647. apRef,
  19648. ap
  19649. }) {
  19650. const {
  19651. paths,
  19652. rect,
  19653. rotation
  19654. } = annotation;
  19655. const ink = new _primitives.Dict(xref);
  19656. ink.set("Type", _primitives.Name.get("Annot"));
  19657. ink.set("Subtype", _primitives.Name.get("Ink"));
  19658. ink.set("CreationDate", `D:${(0, _util.getModificationDate)()}`);
  19659. ink.set("Rect", rect);
  19660. ink.set("InkList", paths.map(p => p.points));
  19661. ink.set("F", 4);
  19662. ink.set("Border", [0, 0, 0]);
  19663. ink.set("Rotate", rotation);
  19664. const n = new _primitives.Dict(xref);
  19665. ink.set("AP", n);
  19666. if (apRef) {
  19667. n.set("N", apRef);
  19668. } else {
  19669. n.set("N", ap);
  19670. }
  19671. return ink;
  19672. }
  19673. static async createNewAppearanceStream(annotation, xref, params) {
  19674. const {
  19675. color,
  19676. rect,
  19677. rotation,
  19678. paths,
  19679. thickness,
  19680. opacity
  19681. } = annotation;
  19682. const [x1, y1, x2, y2] = rect;
  19683. let w = x2 - x1;
  19684. let h = y2 - y1;
  19685. if (rotation % 180 !== 0) {
  19686. [w, h] = [h, w];
  19687. }
  19688. const appearanceBuffer = [`${thickness} w 1 J 1 j`, `${(0, _default_appearance.getPdfColor)(color, false)}`];
  19689. if (opacity !== 1) {
  19690. appearanceBuffer.push("/R0 gs");
  19691. }
  19692. const buffer = [];
  19693. for (const {
  19694. bezier
  19695. } of paths) {
  19696. buffer.length = 0;
  19697. buffer.push(`${(0, _core_utils.numberToString)(bezier[0])} ${(0, _core_utils.numberToString)(bezier[1])} m`);
  19698. for (let i = 2, ii = bezier.length; i < ii; i += 6) {
  19699. const curve = bezier.slice(i, i + 6).map(_core_utils.numberToString).join(" ");
  19700. buffer.push(`${curve} c`);
  19701. }
  19702. buffer.push("S");
  19703. appearanceBuffer.push(buffer.join("\n"));
  19704. }
  19705. const appearance = appearanceBuffer.join("\n");
  19706. const appearanceStreamDict = new _primitives.Dict(xref);
  19707. appearanceStreamDict.set("FormType", 1);
  19708. appearanceStreamDict.set("Subtype", _primitives.Name.get("Form"));
  19709. appearanceStreamDict.set("Type", _primitives.Name.get("XObject"));
  19710. appearanceStreamDict.set("BBox", [0, 0, w, h]);
  19711. appearanceStreamDict.set("Length", appearance.length);
  19712. if (rotation) {
  19713. const matrix = WidgetAnnotation._getRotationMatrix(rotation, w, h);
  19714. appearanceStreamDict.set("Matrix", matrix);
  19715. }
  19716. if (opacity !== 1) {
  19717. const resources = new _primitives.Dict(xref);
  19718. const extGState = new _primitives.Dict(xref);
  19719. const r0 = new _primitives.Dict(xref);
  19720. r0.set("CA", opacity);
  19721. r0.set("Type", _primitives.Name.get("ExtGState"));
  19722. extGState.set("R0", r0);
  19723. resources.set("ExtGState", extGState);
  19724. appearanceStreamDict.set("Resources", resources);
  19725. }
  19726. const ap = new _stream.StringStream(appearance);
  19727. ap.dict = appearanceStreamDict;
  19728. return ap;
  19729. }
  19730. }
  19731. class HighlightAnnotation extends MarkupAnnotation {
  19732. constructor(parameters) {
  19733. super(parameters);
  19734. this.data.annotationType = _util.AnnotationType.HIGHLIGHT;
  19735. const quadPoints = this.data.quadPoints = getQuadPoints(parameters.dict, null);
  19736. if (quadPoints) {
  19737. const resources = this.appearance && this.appearance.dict.get("Resources");
  19738. if (!this.appearance || !(resources && resources.has("ExtGState"))) {
  19739. if (this.appearance) {
  19740. (0, _util.warn)("HighlightAnnotation - ignoring built-in appearance stream.");
  19741. }
  19742. const fillColor = this.color ? Array.from(this.color).map(c => c / 255) : [1, 1, 0];
  19743. const fillAlpha = parameters.dict.get("CA");
  19744. this._setDefaultAppearance({
  19745. xref: parameters.xref,
  19746. fillColor,
  19747. blendMode: "Multiply",
  19748. fillAlpha,
  19749. pointsCallback: (buffer, points) => {
  19750. 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");
  19751. return [points[0].x, points[1].x, points[3].y, points[1].y];
  19752. }
  19753. });
  19754. }
  19755. } else {
  19756. this.data.hasPopup = false;
  19757. }
  19758. }
  19759. }
  19760. class UnderlineAnnotation extends MarkupAnnotation {
  19761. constructor(parameters) {
  19762. super(parameters);
  19763. this.data.annotationType = _util.AnnotationType.UNDERLINE;
  19764. const quadPoints = this.data.quadPoints = getQuadPoints(parameters.dict, null);
  19765. if (quadPoints) {
  19766. if (!this.appearance) {
  19767. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  19768. const strokeAlpha = parameters.dict.get("CA");
  19769. this._setDefaultAppearance({
  19770. xref: parameters.xref,
  19771. extra: "[] 0 d 1 w",
  19772. strokeColor,
  19773. strokeAlpha,
  19774. pointsCallback: (buffer, points) => {
  19775. buffer.push(`${points[2].x} ${points[2].y} m`, `${points[3].x} ${points[3].y} l`, "S");
  19776. return [points[0].x, points[1].x, points[3].y, points[1].y];
  19777. }
  19778. });
  19779. }
  19780. } else {
  19781. this.data.hasPopup = false;
  19782. }
  19783. }
  19784. }
  19785. class SquigglyAnnotation extends MarkupAnnotation {
  19786. constructor(parameters) {
  19787. super(parameters);
  19788. this.data.annotationType = _util.AnnotationType.SQUIGGLY;
  19789. const quadPoints = this.data.quadPoints = getQuadPoints(parameters.dict, null);
  19790. if (quadPoints) {
  19791. if (!this.appearance) {
  19792. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  19793. const strokeAlpha = parameters.dict.get("CA");
  19794. this._setDefaultAppearance({
  19795. xref: parameters.xref,
  19796. extra: "[] 0 d 1 w",
  19797. strokeColor,
  19798. strokeAlpha,
  19799. pointsCallback: (buffer, points) => {
  19800. const dy = (points[0].y - points[2].y) / 6;
  19801. let shift = dy;
  19802. let x = points[2].x;
  19803. const y = points[2].y;
  19804. const xEnd = points[3].x;
  19805. buffer.push(`${x} ${y + shift} m`);
  19806. do {
  19807. x += 2;
  19808. shift = shift === 0 ? dy : 0;
  19809. buffer.push(`${x} ${y + shift} l`);
  19810. } while (x < xEnd);
  19811. buffer.push("S");
  19812. return [points[2].x, xEnd, y - 2 * dy, y + 2 * dy];
  19813. }
  19814. });
  19815. }
  19816. } else {
  19817. this.data.hasPopup = false;
  19818. }
  19819. }
  19820. }
  19821. class StrikeOutAnnotation extends MarkupAnnotation {
  19822. constructor(parameters) {
  19823. super(parameters);
  19824. this.data.annotationType = _util.AnnotationType.STRIKEOUT;
  19825. const quadPoints = this.data.quadPoints = getQuadPoints(parameters.dict, null);
  19826. if (quadPoints) {
  19827. if (!this.appearance) {
  19828. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  19829. const strokeAlpha = parameters.dict.get("CA");
  19830. this._setDefaultAppearance({
  19831. xref: parameters.xref,
  19832. extra: "[] 0 d 1 w",
  19833. strokeColor,
  19834. strokeAlpha,
  19835. pointsCallback: (buffer, points) => {
  19836. 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");
  19837. return [points[0].x, points[1].x, points[3].y, points[1].y];
  19838. }
  19839. });
  19840. }
  19841. } else {
  19842. this.data.hasPopup = false;
  19843. }
  19844. }
  19845. }
  19846. class StampAnnotation extends MarkupAnnotation {
  19847. constructor(parameters) {
  19848. super(parameters);
  19849. this.data.annotationType = _util.AnnotationType.STAMP;
  19850. }
  19851. }
  19852. class FileAttachmentAnnotation extends MarkupAnnotation {
  19853. constructor(parameters) {
  19854. super(parameters);
  19855. const file = new _file_spec.FileSpec(parameters.dict.get("FS"), parameters.xref);
  19856. this.data.annotationType = _util.AnnotationType.FILEATTACHMENT;
  19857. this.data.file = file.serializable;
  19858. }
  19859. }
  19860. /***/ }),
  19861. /* 23 */
  19862. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  19863. Object.defineProperty(exports, "__esModule", ({
  19864. value: true
  19865. }));
  19866. exports.createDefaultAppearance = createDefaultAppearance;
  19867. exports.getPdfColor = getPdfColor;
  19868. exports.parseDefaultAppearance = parseDefaultAppearance;
  19869. var _core_utils = __w_pdfjs_require__(6);
  19870. var _util = __w_pdfjs_require__(2);
  19871. var _colorspace = __w_pdfjs_require__(24);
  19872. var _evaluator = __w_pdfjs_require__(25);
  19873. var _primitives = __w_pdfjs_require__(5);
  19874. var _stream = __w_pdfjs_require__(10);
  19875. class DefaultAppearanceEvaluator extends _evaluator.EvaluatorPreprocessor {
  19876. constructor(str) {
  19877. super(new _stream.StringStream(str));
  19878. }
  19879. parse() {
  19880. const operation = {
  19881. fn: 0,
  19882. args: []
  19883. };
  19884. const result = {
  19885. fontSize: 0,
  19886. fontName: "",
  19887. fontColor: new Uint8ClampedArray(3)
  19888. };
  19889. try {
  19890. while (true) {
  19891. operation.args.length = 0;
  19892. if (!this.read(operation)) {
  19893. break;
  19894. }
  19895. if (this.savedStatesDepth !== 0) {
  19896. continue;
  19897. }
  19898. const {
  19899. fn,
  19900. args
  19901. } = operation;
  19902. switch (fn | 0) {
  19903. case _util.OPS.setFont:
  19904. const [fontName, fontSize] = args;
  19905. if (fontName instanceof _primitives.Name) {
  19906. result.fontName = fontName.name;
  19907. }
  19908. if (typeof fontSize === "number" && fontSize > 0) {
  19909. result.fontSize = fontSize;
  19910. }
  19911. break;
  19912. case _util.OPS.setFillRGBColor:
  19913. _colorspace.ColorSpace.singletons.rgb.getRgbItem(args, 0, result.fontColor, 0);
  19914. break;
  19915. case _util.OPS.setFillGray:
  19916. _colorspace.ColorSpace.singletons.gray.getRgbItem(args, 0, result.fontColor, 0);
  19917. break;
  19918. case _util.OPS.setFillColorSpace:
  19919. _colorspace.ColorSpace.singletons.cmyk.getRgbItem(args, 0, result.fontColor, 0);
  19920. break;
  19921. }
  19922. }
  19923. } catch (reason) {
  19924. (0, _util.warn)(`parseDefaultAppearance - ignoring errors: "${reason}".`);
  19925. }
  19926. return result;
  19927. }
  19928. }
  19929. function parseDefaultAppearance(str) {
  19930. return new DefaultAppearanceEvaluator(str).parse();
  19931. }
  19932. function getPdfColor(color, isFill) {
  19933. if (color[0] === color[1] && color[1] === color[2]) {
  19934. const gray = color[0] / 255;
  19935. return `${(0, _core_utils.numberToString)(gray)} ${isFill ? "g" : "G"}`;
  19936. }
  19937. return Array.from(color).map(c => (0, _core_utils.numberToString)(c / 255)).join(" ") + ` ${isFill ? "rg" : "RG"}`;
  19938. }
  19939. function createDefaultAppearance({
  19940. fontSize,
  19941. fontName,
  19942. fontColor
  19943. }) {
  19944. return `/${(0, _core_utils.escapePDFName)(fontName)} ${fontSize} Tf ${getPdfColor(fontColor, true)}`;
  19945. }
  19946. /***/ }),
  19947. /* 24 */
  19948. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  19949. Object.defineProperty(exports, "__esModule", ({
  19950. value: true
  19951. }));
  19952. exports.ColorSpace = void 0;
  19953. var _util = __w_pdfjs_require__(2);
  19954. var _primitives = __w_pdfjs_require__(5);
  19955. var _base_stream = __w_pdfjs_require__(7);
  19956. var _core_utils = __w_pdfjs_require__(6);
  19957. function resizeRgbImage(src, dest, w1, h1, w2, h2, alpha01) {
  19958. const COMPONENTS = 3;
  19959. alpha01 = alpha01 !== 1 ? 0 : alpha01;
  19960. const xRatio = w1 / w2;
  19961. const yRatio = h1 / h2;
  19962. let newIndex = 0,
  19963. oldIndex;
  19964. const xScaled = new Uint16Array(w2);
  19965. const w1Scanline = w1 * COMPONENTS;
  19966. for (let i = 0; i < w2; i++) {
  19967. xScaled[i] = Math.floor(i * xRatio) * COMPONENTS;
  19968. }
  19969. for (let i = 0; i < h2; i++) {
  19970. const py = Math.floor(i * yRatio) * w1Scanline;
  19971. for (let j = 0; j < w2; j++) {
  19972. oldIndex = py + xScaled[j];
  19973. dest[newIndex++] = src[oldIndex++];
  19974. dest[newIndex++] = src[oldIndex++];
  19975. dest[newIndex++] = src[oldIndex++];
  19976. newIndex += alpha01;
  19977. }
  19978. }
  19979. }
  19980. class ColorSpace {
  19981. constructor(name, numComps) {
  19982. if (this.constructor === ColorSpace) {
  19983. (0, _util.unreachable)("Cannot initialize ColorSpace.");
  19984. }
  19985. this.name = name;
  19986. this.numComps = numComps;
  19987. }
  19988. getRgb(src, srcOffset) {
  19989. const rgb = new Uint8ClampedArray(3);
  19990. this.getRgbItem(src, srcOffset, rgb, 0);
  19991. return rgb;
  19992. }
  19993. getRgbItem(src, srcOffset, dest, destOffset) {
  19994. (0, _util.unreachable)("Should not call ColorSpace.getRgbItem");
  19995. }
  19996. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  19997. (0, _util.unreachable)("Should not call ColorSpace.getRgbBuffer");
  19998. }
  19999. getOutputLength(inputLength, alpha01) {
  20000. (0, _util.unreachable)("Should not call ColorSpace.getOutputLength");
  20001. }
  20002. isPassthrough(bits) {
  20003. return false;
  20004. }
  20005. isDefaultDecode(decodeMap, bpc) {
  20006. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  20007. }
  20008. fillRgb(dest, originalWidth, originalHeight, width, height, actualHeight, bpc, comps, alpha01) {
  20009. const count = originalWidth * originalHeight;
  20010. let rgbBuf = null;
  20011. const numComponentColors = 1 << bpc;
  20012. const needsResizing = originalHeight !== height || originalWidth !== width;
  20013. if (this.isPassthrough(bpc)) {
  20014. rgbBuf = comps;
  20015. } else if (this.numComps === 1 && count > numComponentColors && this.name !== "DeviceGray" && this.name !== "DeviceRGB") {
  20016. const allColors = bpc <= 8 ? new Uint8Array(numComponentColors) : new Uint16Array(numComponentColors);
  20017. for (let i = 0; i < numComponentColors; i++) {
  20018. allColors[i] = i;
  20019. }
  20020. const colorMap = new Uint8ClampedArray(numComponentColors * 3);
  20021. this.getRgbBuffer(allColors, 0, numComponentColors, colorMap, 0, bpc, 0);
  20022. if (!needsResizing) {
  20023. let destPos = 0;
  20024. for (let i = 0; i < count; ++i) {
  20025. const key = comps[i] * 3;
  20026. dest[destPos++] = colorMap[key];
  20027. dest[destPos++] = colorMap[key + 1];
  20028. dest[destPos++] = colorMap[key + 2];
  20029. destPos += alpha01;
  20030. }
  20031. } else {
  20032. rgbBuf = new Uint8Array(count * 3);
  20033. let rgbPos = 0;
  20034. for (let i = 0; i < count; ++i) {
  20035. const key = comps[i] * 3;
  20036. rgbBuf[rgbPos++] = colorMap[key];
  20037. rgbBuf[rgbPos++] = colorMap[key + 1];
  20038. rgbBuf[rgbPos++] = colorMap[key + 2];
  20039. }
  20040. }
  20041. } else {
  20042. if (!needsResizing) {
  20043. this.getRgbBuffer(comps, 0, width * actualHeight, dest, 0, bpc, alpha01);
  20044. } else {
  20045. rgbBuf = new Uint8ClampedArray(count * 3);
  20046. this.getRgbBuffer(comps, 0, count, rgbBuf, 0, bpc, 0);
  20047. }
  20048. }
  20049. if (rgbBuf) {
  20050. if (needsResizing) {
  20051. resizeRgbImage(rgbBuf, dest, originalWidth, originalHeight, width, height, alpha01);
  20052. } else {
  20053. let destPos = 0,
  20054. rgbPos = 0;
  20055. for (let i = 0, ii = width * actualHeight; i < ii; i++) {
  20056. dest[destPos++] = rgbBuf[rgbPos++];
  20057. dest[destPos++] = rgbBuf[rgbPos++];
  20058. dest[destPos++] = rgbBuf[rgbPos++];
  20059. destPos += alpha01;
  20060. }
  20061. }
  20062. }
  20063. }
  20064. get usesZeroToOneRange() {
  20065. return (0, _util.shadow)(this, "usesZeroToOneRange", true);
  20066. }
  20067. static _cache(cacheKey, xref, localColorSpaceCache, parsedColorSpace) {
  20068. if (!localColorSpaceCache) {
  20069. throw new Error('ColorSpace._cache - expected "localColorSpaceCache" argument.');
  20070. }
  20071. if (!parsedColorSpace) {
  20072. throw new Error('ColorSpace._cache - expected "parsedColorSpace" argument.');
  20073. }
  20074. let csName, csRef;
  20075. if (cacheKey instanceof _primitives.Ref) {
  20076. csRef = cacheKey;
  20077. cacheKey = xref.fetch(cacheKey);
  20078. }
  20079. if (cacheKey instanceof _primitives.Name) {
  20080. csName = cacheKey.name;
  20081. }
  20082. if (csName || csRef) {
  20083. localColorSpaceCache.set(csName, csRef, parsedColorSpace);
  20084. }
  20085. }
  20086. static getCached(cacheKey, xref, localColorSpaceCache) {
  20087. if (!localColorSpaceCache) {
  20088. throw new Error('ColorSpace.getCached - expected "localColorSpaceCache" argument.');
  20089. }
  20090. if (cacheKey instanceof _primitives.Ref) {
  20091. const localColorSpace = localColorSpaceCache.getByRef(cacheKey);
  20092. if (localColorSpace) {
  20093. return localColorSpace;
  20094. }
  20095. try {
  20096. cacheKey = xref.fetch(cacheKey);
  20097. } catch (ex) {
  20098. if (ex instanceof _core_utils.MissingDataException) {
  20099. throw ex;
  20100. }
  20101. }
  20102. }
  20103. if (cacheKey instanceof _primitives.Name) {
  20104. const localColorSpace = localColorSpaceCache.getByName(cacheKey.name);
  20105. if (localColorSpace) {
  20106. return localColorSpace;
  20107. }
  20108. }
  20109. return null;
  20110. }
  20111. static async parseAsync({
  20112. cs,
  20113. xref,
  20114. resources = null,
  20115. pdfFunctionFactory,
  20116. localColorSpaceCache
  20117. }) {
  20118. const parsedColorSpace = this._parse(cs, xref, resources, pdfFunctionFactory);
  20119. this._cache(cs, xref, localColorSpaceCache, parsedColorSpace);
  20120. return parsedColorSpace;
  20121. }
  20122. static parse({
  20123. cs,
  20124. xref,
  20125. resources = null,
  20126. pdfFunctionFactory,
  20127. localColorSpaceCache
  20128. }) {
  20129. const cachedColorSpace = this.getCached(cs, xref, localColorSpaceCache);
  20130. if (cachedColorSpace) {
  20131. return cachedColorSpace;
  20132. }
  20133. const parsedColorSpace = this._parse(cs, xref, resources, pdfFunctionFactory);
  20134. this._cache(cs, xref, localColorSpaceCache, parsedColorSpace);
  20135. return parsedColorSpace;
  20136. }
  20137. static _parse(cs, xref, resources = null, pdfFunctionFactory) {
  20138. cs = xref.fetchIfRef(cs);
  20139. if (cs instanceof _primitives.Name) {
  20140. switch (cs.name) {
  20141. case "G":
  20142. case "DeviceGray":
  20143. return this.singletons.gray;
  20144. case "RGB":
  20145. case "DeviceRGB":
  20146. return this.singletons.rgb;
  20147. case "CMYK":
  20148. case "DeviceCMYK":
  20149. return this.singletons.cmyk;
  20150. case "Pattern":
  20151. return new PatternCS(null);
  20152. default:
  20153. if (resources instanceof _primitives.Dict) {
  20154. const colorSpaces = resources.get("ColorSpace");
  20155. if (colorSpaces instanceof _primitives.Dict) {
  20156. const resourcesCS = colorSpaces.get(cs.name);
  20157. if (resourcesCS) {
  20158. if (resourcesCS instanceof _primitives.Name) {
  20159. return this._parse(resourcesCS, xref, resources, pdfFunctionFactory);
  20160. }
  20161. cs = resourcesCS;
  20162. break;
  20163. }
  20164. }
  20165. }
  20166. throw new _util.FormatError(`Unrecognized ColorSpace: ${cs.name}`);
  20167. }
  20168. }
  20169. if (Array.isArray(cs)) {
  20170. const mode = xref.fetchIfRef(cs[0]).name;
  20171. let params, numComps, baseCS, whitePoint, blackPoint, gamma;
  20172. switch (mode) {
  20173. case "G":
  20174. case "DeviceGray":
  20175. return this.singletons.gray;
  20176. case "RGB":
  20177. case "DeviceRGB":
  20178. return this.singletons.rgb;
  20179. case "CMYK":
  20180. case "DeviceCMYK":
  20181. return this.singletons.cmyk;
  20182. case "CalGray":
  20183. params = xref.fetchIfRef(cs[1]);
  20184. whitePoint = params.getArray("WhitePoint");
  20185. blackPoint = params.getArray("BlackPoint");
  20186. gamma = params.get("Gamma");
  20187. return new CalGrayCS(whitePoint, blackPoint, gamma);
  20188. case "CalRGB":
  20189. params = xref.fetchIfRef(cs[1]);
  20190. whitePoint = params.getArray("WhitePoint");
  20191. blackPoint = params.getArray("BlackPoint");
  20192. gamma = params.getArray("Gamma");
  20193. const matrix = params.getArray("Matrix");
  20194. return new CalRGBCS(whitePoint, blackPoint, gamma, matrix);
  20195. case "ICCBased":
  20196. const stream = xref.fetchIfRef(cs[1]);
  20197. const dict = stream.dict;
  20198. numComps = dict.get("N");
  20199. const alt = dict.get("Alternate");
  20200. if (alt) {
  20201. const altCS = this._parse(alt, xref, resources, pdfFunctionFactory);
  20202. if (altCS.numComps === numComps) {
  20203. return altCS;
  20204. }
  20205. (0, _util.warn)("ICCBased color space: Ignoring incorrect /Alternate entry.");
  20206. }
  20207. if (numComps === 1) {
  20208. return this.singletons.gray;
  20209. } else if (numComps === 3) {
  20210. return this.singletons.rgb;
  20211. } else if (numComps === 4) {
  20212. return this.singletons.cmyk;
  20213. }
  20214. break;
  20215. case "Pattern":
  20216. baseCS = cs[1] || null;
  20217. if (baseCS) {
  20218. baseCS = this._parse(baseCS, xref, resources, pdfFunctionFactory);
  20219. }
  20220. return new PatternCS(baseCS);
  20221. case "I":
  20222. case "Indexed":
  20223. baseCS = this._parse(cs[1], xref, resources, pdfFunctionFactory);
  20224. const hiVal = xref.fetchIfRef(cs[2]) + 1;
  20225. const lookup = xref.fetchIfRef(cs[3]);
  20226. return new IndexedCS(baseCS, hiVal, lookup);
  20227. case "Separation":
  20228. case "DeviceN":
  20229. const name = xref.fetchIfRef(cs[1]);
  20230. numComps = Array.isArray(name) ? name.length : 1;
  20231. baseCS = this._parse(cs[2], xref, resources, pdfFunctionFactory);
  20232. const tintFn = pdfFunctionFactory.create(cs[3]);
  20233. return new AlternateCS(numComps, baseCS, tintFn);
  20234. case "Lab":
  20235. params = xref.fetchIfRef(cs[1]);
  20236. whitePoint = params.getArray("WhitePoint");
  20237. blackPoint = params.getArray("BlackPoint");
  20238. const range = params.getArray("Range");
  20239. return new LabCS(whitePoint, blackPoint, range);
  20240. default:
  20241. throw new _util.FormatError(`Unimplemented ColorSpace object: ${mode}`);
  20242. }
  20243. }
  20244. throw new _util.FormatError(`Unrecognized ColorSpace object: ${cs}`);
  20245. }
  20246. static isDefaultDecode(decode, numComps) {
  20247. if (!Array.isArray(decode)) {
  20248. return true;
  20249. }
  20250. if (numComps * 2 !== decode.length) {
  20251. (0, _util.warn)("The decode map is not the correct length");
  20252. return true;
  20253. }
  20254. for (let i = 0, ii = decode.length; i < ii; i += 2) {
  20255. if (decode[i] !== 0 || decode[i + 1] !== 1) {
  20256. return false;
  20257. }
  20258. }
  20259. return true;
  20260. }
  20261. static get singletons() {
  20262. return (0, _util.shadow)(this, "singletons", {
  20263. get gray() {
  20264. return (0, _util.shadow)(this, "gray", new DeviceGrayCS());
  20265. },
  20266. get rgb() {
  20267. return (0, _util.shadow)(this, "rgb", new DeviceRgbCS());
  20268. },
  20269. get cmyk() {
  20270. return (0, _util.shadow)(this, "cmyk", new DeviceCmykCS());
  20271. }
  20272. });
  20273. }
  20274. }
  20275. exports.ColorSpace = ColorSpace;
  20276. class AlternateCS extends ColorSpace {
  20277. constructor(numComps, base, tintFn) {
  20278. super("Alternate", numComps);
  20279. this.base = base;
  20280. this.tintFn = tintFn;
  20281. this.tmpBuf = new Float32Array(base.numComps);
  20282. }
  20283. getRgbItem(src, srcOffset, dest, destOffset) {
  20284. const tmpBuf = this.tmpBuf;
  20285. this.tintFn(src, srcOffset, tmpBuf, 0);
  20286. this.base.getRgbItem(tmpBuf, 0, dest, destOffset);
  20287. }
  20288. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  20289. const tintFn = this.tintFn;
  20290. const base = this.base;
  20291. const scale = 1 / ((1 << bits) - 1);
  20292. const baseNumComps = base.numComps;
  20293. const usesZeroToOneRange = base.usesZeroToOneRange;
  20294. const isPassthrough = (base.isPassthrough(8) || !usesZeroToOneRange) && alpha01 === 0;
  20295. let pos = isPassthrough ? destOffset : 0;
  20296. const baseBuf = isPassthrough ? dest : new Uint8ClampedArray(baseNumComps * count);
  20297. const numComps = this.numComps;
  20298. const scaled = new Float32Array(numComps);
  20299. const tinted = new Float32Array(baseNumComps);
  20300. let i, j;
  20301. for (i = 0; i < count; i++) {
  20302. for (j = 0; j < numComps; j++) {
  20303. scaled[j] = src[srcOffset++] * scale;
  20304. }
  20305. tintFn(scaled, 0, tinted, 0);
  20306. if (usesZeroToOneRange) {
  20307. for (j = 0; j < baseNumComps; j++) {
  20308. baseBuf[pos++] = tinted[j] * 255;
  20309. }
  20310. } else {
  20311. base.getRgbItem(tinted, 0, baseBuf, pos);
  20312. pos += baseNumComps;
  20313. }
  20314. }
  20315. if (!isPassthrough) {
  20316. base.getRgbBuffer(baseBuf, 0, count, dest, destOffset, 8, alpha01);
  20317. }
  20318. }
  20319. getOutputLength(inputLength, alpha01) {
  20320. return this.base.getOutputLength(inputLength * this.base.numComps / this.numComps, alpha01);
  20321. }
  20322. }
  20323. class PatternCS extends ColorSpace {
  20324. constructor(baseCS) {
  20325. super("Pattern", null);
  20326. this.base = baseCS;
  20327. }
  20328. isDefaultDecode(decodeMap, bpc) {
  20329. (0, _util.unreachable)("Should not call PatternCS.isDefaultDecode");
  20330. }
  20331. }
  20332. class IndexedCS extends ColorSpace {
  20333. constructor(base, highVal, lookup) {
  20334. super("Indexed", 1);
  20335. this.base = base;
  20336. this.highVal = highVal;
  20337. const length = base.numComps * highVal;
  20338. this.lookup = new Uint8Array(length);
  20339. if (lookup instanceof _base_stream.BaseStream) {
  20340. const bytes = lookup.getBytes(length);
  20341. this.lookup.set(bytes);
  20342. } else if (typeof lookup === "string") {
  20343. for (let i = 0; i < length; ++i) {
  20344. this.lookup[i] = lookup.charCodeAt(i) & 0xff;
  20345. }
  20346. } else {
  20347. throw new _util.FormatError(`IndexedCS - unrecognized lookup table: ${lookup}`);
  20348. }
  20349. }
  20350. getRgbItem(src, srcOffset, dest, destOffset) {
  20351. const numComps = this.base.numComps;
  20352. const start = src[srcOffset] * numComps;
  20353. this.base.getRgbBuffer(this.lookup, start, 1, dest, destOffset, 8, 0);
  20354. }
  20355. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  20356. const base = this.base;
  20357. const numComps = base.numComps;
  20358. const outputDelta = base.getOutputLength(numComps, alpha01);
  20359. const lookup = this.lookup;
  20360. for (let i = 0; i < count; ++i) {
  20361. const lookupPos = src[srcOffset++] * numComps;
  20362. base.getRgbBuffer(lookup, lookupPos, 1, dest, destOffset, 8, alpha01);
  20363. destOffset += outputDelta;
  20364. }
  20365. }
  20366. getOutputLength(inputLength, alpha01) {
  20367. return this.base.getOutputLength(inputLength * this.base.numComps, alpha01);
  20368. }
  20369. isDefaultDecode(decodeMap, bpc) {
  20370. if (!Array.isArray(decodeMap)) {
  20371. return true;
  20372. }
  20373. if (decodeMap.length !== 2) {
  20374. (0, _util.warn)("Decode map length is not correct");
  20375. return true;
  20376. }
  20377. if (!Number.isInteger(bpc) || bpc < 1) {
  20378. (0, _util.warn)("Bits per component is not correct");
  20379. return true;
  20380. }
  20381. return decodeMap[0] === 0 && decodeMap[1] === (1 << bpc) - 1;
  20382. }
  20383. }
  20384. class DeviceGrayCS extends ColorSpace {
  20385. constructor() {
  20386. super("DeviceGray", 1);
  20387. }
  20388. getRgbItem(src, srcOffset, dest, destOffset) {
  20389. const c = src[srcOffset] * 255;
  20390. dest[destOffset] = dest[destOffset + 1] = dest[destOffset + 2] = c;
  20391. }
  20392. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  20393. const scale = 255 / ((1 << bits) - 1);
  20394. let j = srcOffset,
  20395. q = destOffset;
  20396. for (let i = 0; i < count; ++i) {
  20397. const c = scale * src[j++];
  20398. dest[q++] = c;
  20399. dest[q++] = c;
  20400. dest[q++] = c;
  20401. q += alpha01;
  20402. }
  20403. }
  20404. getOutputLength(inputLength, alpha01) {
  20405. return inputLength * (3 + alpha01);
  20406. }
  20407. }
  20408. class DeviceRgbCS extends ColorSpace {
  20409. constructor() {
  20410. super("DeviceRGB", 3);
  20411. }
  20412. getRgbItem(src, srcOffset, dest, destOffset) {
  20413. dest[destOffset] = src[srcOffset] * 255;
  20414. dest[destOffset + 1] = src[srcOffset + 1] * 255;
  20415. dest[destOffset + 2] = src[srcOffset + 2] * 255;
  20416. }
  20417. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  20418. if (bits === 8 && alpha01 === 0) {
  20419. dest.set(src.subarray(srcOffset, srcOffset + count * 3), destOffset);
  20420. return;
  20421. }
  20422. const scale = 255 / ((1 << bits) - 1);
  20423. let j = srcOffset,
  20424. q = destOffset;
  20425. for (let i = 0; i < count; ++i) {
  20426. dest[q++] = scale * src[j++];
  20427. dest[q++] = scale * src[j++];
  20428. dest[q++] = scale * src[j++];
  20429. q += alpha01;
  20430. }
  20431. }
  20432. getOutputLength(inputLength, alpha01) {
  20433. return inputLength * (3 + alpha01) / 3 | 0;
  20434. }
  20435. isPassthrough(bits) {
  20436. return bits === 8;
  20437. }
  20438. }
  20439. const DeviceCmykCS = function DeviceCmykCSClosure() {
  20440. function convertToRgb(src, srcOffset, srcScale, dest, destOffset) {
  20441. const c = src[srcOffset] * srcScale;
  20442. const m = src[srcOffset + 1] * srcScale;
  20443. const y = src[srcOffset + 2] * srcScale;
  20444. const k = src[srcOffset + 3] * srcScale;
  20445. 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);
  20446. 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);
  20447. 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);
  20448. }
  20449. class DeviceCmykCS extends ColorSpace {
  20450. constructor() {
  20451. super("DeviceCMYK", 4);
  20452. }
  20453. getRgbItem(src, srcOffset, dest, destOffset) {
  20454. convertToRgb(src, srcOffset, 1, dest, destOffset);
  20455. }
  20456. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  20457. const scale = 1 / ((1 << bits) - 1);
  20458. for (let i = 0; i < count; i++) {
  20459. convertToRgb(src, srcOffset, scale, dest, destOffset);
  20460. srcOffset += 4;
  20461. destOffset += 3 + alpha01;
  20462. }
  20463. }
  20464. getOutputLength(inputLength, alpha01) {
  20465. return inputLength / 4 * (3 + alpha01) | 0;
  20466. }
  20467. }
  20468. return DeviceCmykCS;
  20469. }();
  20470. const CalGrayCS = function CalGrayCSClosure() {
  20471. function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
  20472. const A = src[srcOffset] * scale;
  20473. const AG = A ** cs.G;
  20474. const L = cs.YW * AG;
  20475. const val = Math.max(295.8 * L ** 0.3333333333333333 - 40.8, 0);
  20476. dest[destOffset] = val;
  20477. dest[destOffset + 1] = val;
  20478. dest[destOffset + 2] = val;
  20479. }
  20480. class CalGrayCS extends ColorSpace {
  20481. constructor(whitePoint, blackPoint, gamma) {
  20482. super("CalGray", 1);
  20483. if (!whitePoint) {
  20484. throw new _util.FormatError("WhitePoint missing - required for color space CalGray");
  20485. }
  20486. blackPoint = blackPoint || [0, 0, 0];
  20487. gamma = gamma || 1;
  20488. this.XW = whitePoint[0];
  20489. this.YW = whitePoint[1];
  20490. this.ZW = whitePoint[2];
  20491. this.XB = blackPoint[0];
  20492. this.YB = blackPoint[1];
  20493. this.ZB = blackPoint[2];
  20494. this.G = gamma;
  20495. if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
  20496. throw new _util.FormatError(`Invalid WhitePoint components for ${this.name}` + ", no fallback available");
  20497. }
  20498. if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
  20499. (0, _util.info)(`Invalid BlackPoint for ${this.name}, falling back to default.`);
  20500. this.XB = this.YB = this.ZB = 0;
  20501. }
  20502. if (this.XB !== 0 || this.YB !== 0 || this.ZB !== 0) {
  20503. (0, _util.warn)(`${this.name}, BlackPoint: XB: ${this.XB}, YB: ${this.YB}, ` + `ZB: ${this.ZB}, only default values are supported.`);
  20504. }
  20505. if (this.G < 1) {
  20506. (0, _util.info)(`Invalid Gamma: ${this.G} for ${this.name}, ` + "falling back to default.");
  20507. this.G = 1;
  20508. }
  20509. }
  20510. getRgbItem(src, srcOffset, dest, destOffset) {
  20511. convertToRgb(this, src, srcOffset, dest, destOffset, 1);
  20512. }
  20513. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  20514. const scale = 1 / ((1 << bits) - 1);
  20515. for (let i = 0; i < count; ++i) {
  20516. convertToRgb(this, src, srcOffset, dest, destOffset, scale);
  20517. srcOffset += 1;
  20518. destOffset += 3 + alpha01;
  20519. }
  20520. }
  20521. getOutputLength(inputLength, alpha01) {
  20522. return inputLength * (3 + alpha01);
  20523. }
  20524. }
  20525. return CalGrayCS;
  20526. }();
  20527. const CalRGBCS = function CalRGBCSClosure() {
  20528. const BRADFORD_SCALE_MATRIX = new Float32Array([0.8951, 0.2664, -0.1614, -0.7502, 1.7135, 0.0367, 0.0389, -0.0685, 1.0296]);
  20529. 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]);
  20530. 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]);
  20531. const FLAT_WHITEPOINT_MATRIX = new Float32Array([1, 1, 1]);
  20532. const tempNormalizeMatrix = new Float32Array(3);
  20533. const tempConvertMatrix1 = new Float32Array(3);
  20534. const tempConvertMatrix2 = new Float32Array(3);
  20535. const DECODE_L_CONSTANT = ((8 + 16) / 116) ** 3 / 8.0;
  20536. function matrixProduct(a, b, result) {
  20537. result[0] = a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
  20538. result[1] = a[3] * b[0] + a[4] * b[1] + a[5] * b[2];
  20539. result[2] = a[6] * b[0] + a[7] * b[1] + a[8] * b[2];
  20540. }
  20541. function convertToFlat(sourceWhitePoint, LMS, result) {
  20542. result[0] = LMS[0] * 1 / sourceWhitePoint[0];
  20543. result[1] = LMS[1] * 1 / sourceWhitePoint[1];
  20544. result[2] = LMS[2] * 1 / sourceWhitePoint[2];
  20545. }
  20546. function convertToD65(sourceWhitePoint, LMS, result) {
  20547. const D65X = 0.95047;
  20548. const D65Y = 1;
  20549. const D65Z = 1.08883;
  20550. result[0] = LMS[0] * D65X / sourceWhitePoint[0];
  20551. result[1] = LMS[1] * D65Y / sourceWhitePoint[1];
  20552. result[2] = LMS[2] * D65Z / sourceWhitePoint[2];
  20553. }
  20554. function sRGBTransferFunction(color) {
  20555. if (color <= 0.0031308) {
  20556. return adjustToRange(0, 1, 12.92 * color);
  20557. }
  20558. if (color >= 0.99554525) {
  20559. return 1;
  20560. }
  20561. return adjustToRange(0, 1, (1 + 0.055) * color ** (1 / 2.4) - 0.055);
  20562. }
  20563. function adjustToRange(min, max, value) {
  20564. return Math.max(min, Math.min(max, value));
  20565. }
  20566. function decodeL(L) {
  20567. if (L < 0) {
  20568. return -decodeL(-L);
  20569. }
  20570. if (L > 8.0) {
  20571. return ((L + 16) / 116) ** 3;
  20572. }
  20573. return L * DECODE_L_CONSTANT;
  20574. }
  20575. function compensateBlackPoint(sourceBlackPoint, XYZ_Flat, result) {
  20576. if (sourceBlackPoint[0] === 0 && sourceBlackPoint[1] === 0 && sourceBlackPoint[2] === 0) {
  20577. result[0] = XYZ_Flat[0];
  20578. result[1] = XYZ_Flat[1];
  20579. result[2] = XYZ_Flat[2];
  20580. return;
  20581. }
  20582. const zeroDecodeL = decodeL(0);
  20583. const X_DST = zeroDecodeL;
  20584. const X_SRC = decodeL(sourceBlackPoint[0]);
  20585. const Y_DST = zeroDecodeL;
  20586. const Y_SRC = decodeL(sourceBlackPoint[1]);
  20587. const Z_DST = zeroDecodeL;
  20588. const Z_SRC = decodeL(sourceBlackPoint[2]);
  20589. const X_Scale = (1 - X_DST) / (1 - X_SRC);
  20590. const X_Offset = 1 - X_Scale;
  20591. const Y_Scale = (1 - Y_DST) / (1 - Y_SRC);
  20592. const Y_Offset = 1 - Y_Scale;
  20593. const Z_Scale = (1 - Z_DST) / (1 - Z_SRC);
  20594. const Z_Offset = 1 - Z_Scale;
  20595. result[0] = XYZ_Flat[0] * X_Scale + X_Offset;
  20596. result[1] = XYZ_Flat[1] * Y_Scale + Y_Offset;
  20597. result[2] = XYZ_Flat[2] * Z_Scale + Z_Offset;
  20598. }
  20599. function normalizeWhitePointToFlat(sourceWhitePoint, XYZ_In, result) {
  20600. if (sourceWhitePoint[0] === 1 && sourceWhitePoint[2] === 1) {
  20601. result[0] = XYZ_In[0];
  20602. result[1] = XYZ_In[1];
  20603. result[2] = XYZ_In[2];
  20604. return;
  20605. }
  20606. const LMS = result;
  20607. matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
  20608. const LMS_Flat = tempNormalizeMatrix;
  20609. convertToFlat(sourceWhitePoint, LMS, LMS_Flat);
  20610. matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_Flat, result);
  20611. }
  20612. function normalizeWhitePointToD65(sourceWhitePoint, XYZ_In, result) {
  20613. const LMS = result;
  20614. matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
  20615. const LMS_D65 = tempNormalizeMatrix;
  20616. convertToD65(sourceWhitePoint, LMS, LMS_D65);
  20617. matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_D65, result);
  20618. }
  20619. function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
  20620. const A = adjustToRange(0, 1, src[srcOffset] * scale);
  20621. const B = adjustToRange(0, 1, src[srcOffset + 1] * scale);
  20622. const C = adjustToRange(0, 1, src[srcOffset + 2] * scale);
  20623. const AGR = A === 1 ? 1 : A ** cs.GR;
  20624. const BGG = B === 1 ? 1 : B ** cs.GG;
  20625. const CGB = C === 1 ? 1 : C ** cs.GB;
  20626. const X = cs.MXA * AGR + cs.MXB * BGG + cs.MXC * CGB;
  20627. const Y = cs.MYA * AGR + cs.MYB * BGG + cs.MYC * CGB;
  20628. const Z = cs.MZA * AGR + cs.MZB * BGG + cs.MZC * CGB;
  20629. const XYZ = tempConvertMatrix1;
  20630. XYZ[0] = X;
  20631. XYZ[1] = Y;
  20632. XYZ[2] = Z;
  20633. const XYZ_Flat = tempConvertMatrix2;
  20634. normalizeWhitePointToFlat(cs.whitePoint, XYZ, XYZ_Flat);
  20635. const XYZ_Black = tempConvertMatrix1;
  20636. compensateBlackPoint(cs.blackPoint, XYZ_Flat, XYZ_Black);
  20637. const XYZ_D65 = tempConvertMatrix2;
  20638. normalizeWhitePointToD65(FLAT_WHITEPOINT_MATRIX, XYZ_Black, XYZ_D65);
  20639. const SRGB = tempConvertMatrix1;
  20640. matrixProduct(SRGB_D65_XYZ_TO_RGB_MATRIX, XYZ_D65, SRGB);
  20641. dest[destOffset] = sRGBTransferFunction(SRGB[0]) * 255;
  20642. dest[destOffset + 1] = sRGBTransferFunction(SRGB[1]) * 255;
  20643. dest[destOffset + 2] = sRGBTransferFunction(SRGB[2]) * 255;
  20644. }
  20645. class CalRGBCS extends ColorSpace {
  20646. constructor(whitePoint, blackPoint, gamma, matrix) {
  20647. super("CalRGB", 3);
  20648. if (!whitePoint) {
  20649. throw new _util.FormatError("WhitePoint missing - required for color space CalRGB");
  20650. }
  20651. blackPoint = blackPoint || new Float32Array(3);
  20652. gamma = gamma || new Float32Array([1, 1, 1]);
  20653. matrix = matrix || new Float32Array([1, 0, 0, 0, 1, 0, 0, 0, 1]);
  20654. const XW = whitePoint[0];
  20655. const YW = whitePoint[1];
  20656. const ZW = whitePoint[2];
  20657. this.whitePoint = whitePoint;
  20658. const XB = blackPoint[0];
  20659. const YB = blackPoint[1];
  20660. const ZB = blackPoint[2];
  20661. this.blackPoint = blackPoint;
  20662. this.GR = gamma[0];
  20663. this.GG = gamma[1];
  20664. this.GB = gamma[2];
  20665. this.MXA = matrix[0];
  20666. this.MYA = matrix[1];
  20667. this.MZA = matrix[2];
  20668. this.MXB = matrix[3];
  20669. this.MYB = matrix[4];
  20670. this.MZB = matrix[5];
  20671. this.MXC = matrix[6];
  20672. this.MYC = matrix[7];
  20673. this.MZC = matrix[8];
  20674. if (XW < 0 || ZW < 0 || YW !== 1) {
  20675. throw new _util.FormatError(`Invalid WhitePoint components for ${this.name}` + ", no fallback available");
  20676. }
  20677. if (XB < 0 || YB < 0 || ZB < 0) {
  20678. (0, _util.info)(`Invalid BlackPoint for ${this.name} [${XB}, ${YB}, ${ZB}], ` + "falling back to default.");
  20679. this.blackPoint = new Float32Array(3);
  20680. }
  20681. if (this.GR < 0 || this.GG < 0 || this.GB < 0) {
  20682. (0, _util.info)(`Invalid Gamma [${this.GR}, ${this.GG}, ${this.GB}] for ` + `${this.name}, falling back to default.`);
  20683. this.GR = this.GG = this.GB = 1;
  20684. }
  20685. }
  20686. getRgbItem(src, srcOffset, dest, destOffset) {
  20687. convertToRgb(this, src, srcOffset, dest, destOffset, 1);
  20688. }
  20689. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  20690. const scale = 1 / ((1 << bits) - 1);
  20691. for (let i = 0; i < count; ++i) {
  20692. convertToRgb(this, src, srcOffset, dest, destOffset, scale);
  20693. srcOffset += 3;
  20694. destOffset += 3 + alpha01;
  20695. }
  20696. }
  20697. getOutputLength(inputLength, alpha01) {
  20698. return inputLength * (3 + alpha01) / 3 | 0;
  20699. }
  20700. }
  20701. return CalRGBCS;
  20702. }();
  20703. const LabCS = function LabCSClosure() {
  20704. function fn_g(x) {
  20705. let result;
  20706. if (x >= 6 / 29) {
  20707. result = x ** 3;
  20708. } else {
  20709. result = 108 / 841 * (x - 4 / 29);
  20710. }
  20711. return result;
  20712. }
  20713. function decode(value, high1, low2, high2) {
  20714. return low2 + value * (high2 - low2) / high1;
  20715. }
  20716. function convertToRgb(cs, src, srcOffset, maxVal, dest, destOffset) {
  20717. let Ls = src[srcOffset];
  20718. let as = src[srcOffset + 1];
  20719. let bs = src[srcOffset + 2];
  20720. if (maxVal !== false) {
  20721. Ls = decode(Ls, maxVal, 0, 100);
  20722. as = decode(as, maxVal, cs.amin, cs.amax);
  20723. bs = decode(bs, maxVal, cs.bmin, cs.bmax);
  20724. }
  20725. if (as > cs.amax) {
  20726. as = cs.amax;
  20727. } else if (as < cs.amin) {
  20728. as = cs.amin;
  20729. }
  20730. if (bs > cs.bmax) {
  20731. bs = cs.bmax;
  20732. } else if (bs < cs.bmin) {
  20733. bs = cs.bmin;
  20734. }
  20735. const M = (Ls + 16) / 116;
  20736. const L = M + as / 500;
  20737. const N = M - bs / 200;
  20738. const X = cs.XW * fn_g(L);
  20739. const Y = cs.YW * fn_g(M);
  20740. const Z = cs.ZW * fn_g(N);
  20741. let r, g, b;
  20742. if (cs.ZW < 1) {
  20743. r = X * 3.1339 + Y * -1.617 + Z * -0.4906;
  20744. g = X * -0.9785 + Y * 1.916 + Z * 0.0333;
  20745. b = X * 0.072 + Y * -0.229 + Z * 1.4057;
  20746. } else {
  20747. r = X * 3.2406 + Y * -1.5372 + Z * -0.4986;
  20748. g = X * -0.9689 + Y * 1.8758 + Z * 0.0415;
  20749. b = X * 0.0557 + Y * -0.204 + Z * 1.057;
  20750. }
  20751. dest[destOffset] = Math.sqrt(r) * 255;
  20752. dest[destOffset + 1] = Math.sqrt(g) * 255;
  20753. dest[destOffset + 2] = Math.sqrt(b) * 255;
  20754. }
  20755. class LabCS extends ColorSpace {
  20756. constructor(whitePoint, blackPoint, range) {
  20757. super("Lab", 3);
  20758. if (!whitePoint) {
  20759. throw new _util.FormatError("WhitePoint missing - required for color space Lab");
  20760. }
  20761. blackPoint = blackPoint || [0, 0, 0];
  20762. range = range || [-100, 100, -100, 100];
  20763. this.XW = whitePoint[0];
  20764. this.YW = whitePoint[1];
  20765. this.ZW = whitePoint[2];
  20766. this.amin = range[0];
  20767. this.amax = range[1];
  20768. this.bmin = range[2];
  20769. this.bmax = range[3];
  20770. this.XB = blackPoint[0];
  20771. this.YB = blackPoint[1];
  20772. this.ZB = blackPoint[2];
  20773. if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
  20774. throw new _util.FormatError("Invalid WhitePoint components, no fallback available");
  20775. }
  20776. if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
  20777. (0, _util.info)("Invalid BlackPoint, falling back to default");
  20778. this.XB = this.YB = this.ZB = 0;
  20779. }
  20780. if (this.amin > this.amax || this.bmin > this.bmax) {
  20781. (0, _util.info)("Invalid Range, falling back to defaults");
  20782. this.amin = -100;
  20783. this.amax = 100;
  20784. this.bmin = -100;
  20785. this.bmax = 100;
  20786. }
  20787. }
  20788. getRgbItem(src, srcOffset, dest, destOffset) {
  20789. convertToRgb(this, src, srcOffset, false, dest, destOffset);
  20790. }
  20791. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  20792. const maxVal = (1 << bits) - 1;
  20793. for (let i = 0; i < count; i++) {
  20794. convertToRgb(this, src, srcOffset, maxVal, dest, destOffset);
  20795. srcOffset += 3;
  20796. destOffset += 3 + alpha01;
  20797. }
  20798. }
  20799. getOutputLength(inputLength, alpha01) {
  20800. return inputLength * (3 + alpha01) / 3 | 0;
  20801. }
  20802. isDefaultDecode(decodeMap, bpc) {
  20803. return true;
  20804. }
  20805. get usesZeroToOneRange() {
  20806. return (0, _util.shadow)(this, "usesZeroToOneRange", false);
  20807. }
  20808. }
  20809. return LabCS;
  20810. }();
  20811. /***/ }),
  20812. /* 25 */
  20813. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  20814. Object.defineProperty(exports, "__esModule", ({
  20815. value: true
  20816. }));
  20817. exports.PartialEvaluator = exports.EvaluatorPreprocessor = void 0;
  20818. var _util = __w_pdfjs_require__(2);
  20819. var _cmap = __w_pdfjs_require__(26);
  20820. var _primitives = __w_pdfjs_require__(5);
  20821. var _fonts = __w_pdfjs_require__(44);
  20822. var _fonts_utils = __w_pdfjs_require__(18);
  20823. var _encodings = __w_pdfjs_require__(19);
  20824. var _standard_fonts = __w_pdfjs_require__(47);
  20825. var _unicode = __w_pdfjs_require__(21);
  20826. var _pattern = __w_pdfjs_require__(56);
  20827. var _xfa_fonts = __w_pdfjs_require__(12);
  20828. var _to_unicode_map = __w_pdfjs_require__(48);
  20829. var _function = __w_pdfjs_require__(57);
  20830. var _parser = __w_pdfjs_require__(27);
  20831. var _image_utils = __w_pdfjs_require__(59);
  20832. var _stream = __w_pdfjs_require__(10);
  20833. var _base_stream = __w_pdfjs_require__(7);
  20834. var _bidi = __w_pdfjs_require__(60);
  20835. var _colorspace = __w_pdfjs_require__(24);
  20836. var _decode_stream = __w_pdfjs_require__(29);
  20837. var _glyphlist = __w_pdfjs_require__(20);
  20838. var _core_utils = __w_pdfjs_require__(6);
  20839. var _metrics = __w_pdfjs_require__(51);
  20840. var _murmurhash = __w_pdfjs_require__(61);
  20841. var _operator_list = __w_pdfjs_require__(62);
  20842. var _image = __w_pdfjs_require__(63);
  20843. const DefaultPartialEvaluatorOptions = Object.freeze({
  20844. maxImageSize: -1,
  20845. disableFontFace: false,
  20846. ignoreErrors: false,
  20847. isEvalSupported: true,
  20848. fontExtraProperties: false,
  20849. useSystemFonts: true,
  20850. cMapUrl: null,
  20851. standardFontDataUrl: null
  20852. });
  20853. const PatternType = {
  20854. TILING: 1,
  20855. SHADING: 2
  20856. };
  20857. const TEXT_CHUNK_BATCH_SIZE = 10;
  20858. const deferred = Promise.resolve();
  20859. function normalizeBlendMode(value, parsingArray = false) {
  20860. if (Array.isArray(value)) {
  20861. for (let i = 0, ii = value.length; i < ii; i++) {
  20862. const maybeBM = normalizeBlendMode(value[i], true);
  20863. if (maybeBM) {
  20864. return maybeBM;
  20865. }
  20866. }
  20867. (0, _util.warn)(`Unsupported blend mode Array: ${value}`);
  20868. return "source-over";
  20869. }
  20870. if (!(value instanceof _primitives.Name)) {
  20871. if (parsingArray) {
  20872. return null;
  20873. }
  20874. return "source-over";
  20875. }
  20876. switch (value.name) {
  20877. case "Normal":
  20878. case "Compatible":
  20879. return "source-over";
  20880. case "Multiply":
  20881. return "multiply";
  20882. case "Screen":
  20883. return "screen";
  20884. case "Overlay":
  20885. return "overlay";
  20886. case "Darken":
  20887. return "darken";
  20888. case "Lighten":
  20889. return "lighten";
  20890. case "ColorDodge":
  20891. return "color-dodge";
  20892. case "ColorBurn":
  20893. return "color-burn";
  20894. case "HardLight":
  20895. return "hard-light";
  20896. case "SoftLight":
  20897. return "soft-light";
  20898. case "Difference":
  20899. return "difference";
  20900. case "Exclusion":
  20901. return "exclusion";
  20902. case "Hue":
  20903. return "hue";
  20904. case "Saturation":
  20905. return "saturation";
  20906. case "Color":
  20907. return "color";
  20908. case "Luminosity":
  20909. return "luminosity";
  20910. }
  20911. if (parsingArray) {
  20912. return null;
  20913. }
  20914. (0, _util.warn)(`Unsupported blend mode: ${value.name}`);
  20915. return "source-over";
  20916. }
  20917. function incrementCachedImageMaskCount(data) {
  20918. if (data.fn === _util.OPS.paintImageMaskXObject && data.args[0] && data.args[0].count > 0) {
  20919. data.args[0].count++;
  20920. }
  20921. }
  20922. class TimeSlotManager {
  20923. static get TIME_SLOT_DURATION_MS() {
  20924. return (0, _util.shadow)(this, "TIME_SLOT_DURATION_MS", 20);
  20925. }
  20926. static get CHECK_TIME_EVERY() {
  20927. return (0, _util.shadow)(this, "CHECK_TIME_EVERY", 100);
  20928. }
  20929. constructor() {
  20930. this.reset();
  20931. }
  20932. check() {
  20933. if (++this.checked < TimeSlotManager.CHECK_TIME_EVERY) {
  20934. return false;
  20935. }
  20936. this.checked = 0;
  20937. return this.endTime <= Date.now();
  20938. }
  20939. reset() {
  20940. this.endTime = Date.now() + TimeSlotManager.TIME_SLOT_DURATION_MS;
  20941. this.checked = 0;
  20942. }
  20943. }
  20944. class PartialEvaluator {
  20945. constructor({
  20946. xref,
  20947. handler,
  20948. pageIndex,
  20949. idFactory,
  20950. fontCache,
  20951. builtInCMapCache,
  20952. standardFontDataCache,
  20953. globalImageCache,
  20954. options = null
  20955. }) {
  20956. this.xref = xref;
  20957. this.handler = handler;
  20958. this.pageIndex = pageIndex;
  20959. this.idFactory = idFactory;
  20960. this.fontCache = fontCache;
  20961. this.builtInCMapCache = builtInCMapCache;
  20962. this.standardFontDataCache = standardFontDataCache;
  20963. this.globalImageCache = globalImageCache;
  20964. this.options = options || DefaultPartialEvaluatorOptions;
  20965. this.parsingType3Font = false;
  20966. this._fetchBuiltInCMapBound = this.fetchBuiltInCMap.bind(this);
  20967. }
  20968. get _pdfFunctionFactory() {
  20969. const pdfFunctionFactory = new _function.PDFFunctionFactory({
  20970. xref: this.xref,
  20971. isEvalSupported: this.options.isEvalSupported
  20972. });
  20973. return (0, _util.shadow)(this, "_pdfFunctionFactory", pdfFunctionFactory);
  20974. }
  20975. clone(newOptions = null) {
  20976. const newEvaluator = Object.create(this);
  20977. newEvaluator.options = Object.assign(Object.create(null), this.options, newOptions);
  20978. return newEvaluator;
  20979. }
  20980. hasBlendModes(resources, nonBlendModesSet) {
  20981. if (!(resources instanceof _primitives.Dict)) {
  20982. return false;
  20983. }
  20984. if (resources.objId && nonBlendModesSet.has(resources.objId)) {
  20985. return false;
  20986. }
  20987. const processed = new _primitives.RefSet(nonBlendModesSet);
  20988. if (resources.objId) {
  20989. processed.put(resources.objId);
  20990. }
  20991. const nodes = [resources],
  20992. xref = this.xref;
  20993. while (nodes.length) {
  20994. const node = nodes.shift();
  20995. const graphicStates = node.get("ExtGState");
  20996. if (graphicStates instanceof _primitives.Dict) {
  20997. for (let graphicState of graphicStates.getRawValues()) {
  20998. if (graphicState instanceof _primitives.Ref) {
  20999. if (processed.has(graphicState)) {
  21000. continue;
  21001. }
  21002. try {
  21003. graphicState = xref.fetch(graphicState);
  21004. } catch (ex) {
  21005. processed.put(graphicState);
  21006. (0, _util.info)(`hasBlendModes - ignoring ExtGState: "${ex}".`);
  21007. continue;
  21008. }
  21009. }
  21010. if (!(graphicState instanceof _primitives.Dict)) {
  21011. continue;
  21012. }
  21013. if (graphicState.objId) {
  21014. processed.put(graphicState.objId);
  21015. }
  21016. const bm = graphicState.get("BM");
  21017. if (bm instanceof _primitives.Name) {
  21018. if (bm.name !== "Normal") {
  21019. return true;
  21020. }
  21021. continue;
  21022. }
  21023. if (bm !== undefined && Array.isArray(bm)) {
  21024. for (const element of bm) {
  21025. if (element instanceof _primitives.Name && element.name !== "Normal") {
  21026. return true;
  21027. }
  21028. }
  21029. }
  21030. }
  21031. }
  21032. const xObjects = node.get("XObject");
  21033. if (!(xObjects instanceof _primitives.Dict)) {
  21034. continue;
  21035. }
  21036. for (let xObject of xObjects.getRawValues()) {
  21037. if (xObject instanceof _primitives.Ref) {
  21038. if (processed.has(xObject)) {
  21039. continue;
  21040. }
  21041. try {
  21042. xObject = xref.fetch(xObject);
  21043. } catch (ex) {
  21044. processed.put(xObject);
  21045. (0, _util.info)(`hasBlendModes - ignoring XObject: "${ex}".`);
  21046. continue;
  21047. }
  21048. }
  21049. if (!(xObject instanceof _base_stream.BaseStream)) {
  21050. continue;
  21051. }
  21052. if (xObject.dict.objId) {
  21053. processed.put(xObject.dict.objId);
  21054. }
  21055. const xResources = xObject.dict.get("Resources");
  21056. if (!(xResources instanceof _primitives.Dict)) {
  21057. continue;
  21058. }
  21059. if (xResources.objId && processed.has(xResources.objId)) {
  21060. continue;
  21061. }
  21062. nodes.push(xResources);
  21063. if (xResources.objId) {
  21064. processed.put(xResources.objId);
  21065. }
  21066. }
  21067. }
  21068. for (const ref of processed) {
  21069. nonBlendModesSet.put(ref);
  21070. }
  21071. return false;
  21072. }
  21073. async fetchBuiltInCMap(name) {
  21074. const cachedData = this.builtInCMapCache.get(name);
  21075. if (cachedData) {
  21076. return cachedData;
  21077. }
  21078. let data;
  21079. if (this.options.cMapUrl !== null) {
  21080. const url = `${this.options.cMapUrl}${name}.bcmap`;
  21081. const response = await fetch(url);
  21082. if (!response.ok) {
  21083. throw new Error(`fetchBuiltInCMap: failed to fetch file "${url}" with "${response.statusText}".`);
  21084. }
  21085. data = {
  21086. cMapData: new Uint8Array(await response.arrayBuffer()),
  21087. compressionType: _util.CMapCompressionType.BINARY
  21088. };
  21089. } else {
  21090. data = await this.handler.sendWithPromise("FetchBuiltInCMap", {
  21091. name
  21092. });
  21093. }
  21094. if (data.compressionType !== _util.CMapCompressionType.NONE) {
  21095. this.builtInCMapCache.set(name, data);
  21096. }
  21097. return data;
  21098. }
  21099. async fetchStandardFontData(name) {
  21100. const cachedData = this.standardFontDataCache.get(name);
  21101. if (cachedData) {
  21102. return new _stream.Stream(cachedData);
  21103. }
  21104. if (this.options.useSystemFonts && name !== "Symbol" && name !== "ZapfDingbats") {
  21105. return null;
  21106. }
  21107. const standardFontNameToFileName = (0, _standard_fonts.getFontNameToFileMap)(),
  21108. filename = standardFontNameToFileName[name];
  21109. let data;
  21110. if (this.options.standardFontDataUrl !== null) {
  21111. const url = `${this.options.standardFontDataUrl}${filename}`;
  21112. const response = await fetch(url);
  21113. if (!response.ok) {
  21114. (0, _util.warn)(`fetchStandardFontData: failed to fetch file "${url}" with "${response.statusText}".`);
  21115. } else {
  21116. data = await response.arrayBuffer();
  21117. }
  21118. } else {
  21119. try {
  21120. data = await this.handler.sendWithPromise("FetchStandardFontData", {
  21121. filename
  21122. });
  21123. } catch (e) {
  21124. (0, _util.warn)(`fetchStandardFontData: failed to fetch file "${filename}" with "${e}".`);
  21125. }
  21126. }
  21127. if (!data) {
  21128. return null;
  21129. }
  21130. this.standardFontDataCache.set(name, data);
  21131. return new _stream.Stream(data);
  21132. }
  21133. async buildFormXObject(resources, xobj, smask, operatorList, task, initialState, localColorSpaceCache) {
  21134. const dict = xobj.dict;
  21135. const matrix = dict.getArray("Matrix");
  21136. let bbox = dict.getArray("BBox");
  21137. if (Array.isArray(bbox) && bbox.length === 4) {
  21138. bbox = _util.Util.normalizeRect(bbox);
  21139. } else {
  21140. bbox = null;
  21141. }
  21142. let optionalContent, groupOptions;
  21143. if (dict.has("OC")) {
  21144. optionalContent = await this.parseMarkedContentProps(dict.get("OC"), resources);
  21145. }
  21146. if (optionalContent !== undefined) {
  21147. operatorList.addOp(_util.OPS.beginMarkedContentProps, ["OC", optionalContent]);
  21148. }
  21149. const group = dict.get("Group");
  21150. if (group) {
  21151. groupOptions = {
  21152. matrix,
  21153. bbox,
  21154. smask,
  21155. isolated: false,
  21156. knockout: false
  21157. };
  21158. const groupSubtype = group.get("S");
  21159. let colorSpace = null;
  21160. if ((0, _primitives.isName)(groupSubtype, "Transparency")) {
  21161. groupOptions.isolated = group.get("I") || false;
  21162. groupOptions.knockout = group.get("K") || false;
  21163. if (group.has("CS")) {
  21164. const cs = group.getRaw("CS");
  21165. const cachedColorSpace = _colorspace.ColorSpace.getCached(cs, this.xref, localColorSpaceCache);
  21166. if (cachedColorSpace) {
  21167. colorSpace = cachedColorSpace;
  21168. } else {
  21169. colorSpace = await this.parseColorSpace({
  21170. cs,
  21171. resources,
  21172. localColorSpaceCache
  21173. });
  21174. }
  21175. }
  21176. }
  21177. if (smask && smask.backdrop) {
  21178. colorSpace = colorSpace || _colorspace.ColorSpace.singletons.rgb;
  21179. smask.backdrop = colorSpace.getRgb(smask.backdrop, 0);
  21180. }
  21181. operatorList.addOp(_util.OPS.beginGroup, [groupOptions]);
  21182. }
  21183. const args = group ? [matrix, null] : [matrix, bbox];
  21184. operatorList.addOp(_util.OPS.paintFormXObjectBegin, args);
  21185. return this.getOperatorList({
  21186. stream: xobj,
  21187. task,
  21188. resources: dict.get("Resources") || resources,
  21189. operatorList,
  21190. initialState
  21191. }).then(function () {
  21192. operatorList.addOp(_util.OPS.paintFormXObjectEnd, []);
  21193. if (group) {
  21194. operatorList.addOp(_util.OPS.endGroup, [groupOptions]);
  21195. }
  21196. if (optionalContent !== undefined) {
  21197. operatorList.addOp(_util.OPS.endMarkedContent, []);
  21198. }
  21199. });
  21200. }
  21201. _sendImgData(objId, imgData, cacheGlobally = false) {
  21202. const transfers = imgData ? [imgData.bitmap || imgData.data.buffer] : null;
  21203. if (this.parsingType3Font || cacheGlobally) {
  21204. return this.handler.send("commonobj", [objId, "Image", imgData], transfers);
  21205. }
  21206. return this.handler.send("obj", [objId, this.pageIndex, "Image", imgData], transfers);
  21207. }
  21208. async buildPaintImageXObject({
  21209. resources,
  21210. image,
  21211. isInline = false,
  21212. operatorList,
  21213. cacheKey,
  21214. localImageCache,
  21215. localColorSpaceCache
  21216. }) {
  21217. const dict = image.dict;
  21218. const imageRef = dict.objId;
  21219. const w = dict.get("W", "Width");
  21220. const h = dict.get("H", "Height");
  21221. if (!(w && typeof w === "number") || !(h && typeof h === "number")) {
  21222. (0, _util.warn)("Image dimensions are missing, or not numbers.");
  21223. return;
  21224. }
  21225. const maxImageSize = this.options.maxImageSize;
  21226. if (maxImageSize !== -1 && w * h > maxImageSize) {
  21227. const msg = "Image exceeded maximum allowed size and was removed.";
  21228. if (this.options.ignoreErrors) {
  21229. (0, _util.warn)(msg);
  21230. return;
  21231. }
  21232. throw new Error(msg);
  21233. }
  21234. let optionalContent;
  21235. if (dict.has("OC")) {
  21236. optionalContent = await this.parseMarkedContentProps(dict.get("OC"), resources);
  21237. }
  21238. const imageMask = dict.get("IM", "ImageMask") || false;
  21239. let imgData, args;
  21240. if (imageMask) {
  21241. const interpolate = dict.get("I", "Interpolate");
  21242. const bitStrideLength = w + 7 >> 3;
  21243. const imgArray = image.getBytes(bitStrideLength * h);
  21244. const decode = dict.getArray("D", "Decode");
  21245. if (this.parsingType3Font) {
  21246. imgData = _image.PDFImage.createRawMask({
  21247. imgArray,
  21248. width: w,
  21249. height: h,
  21250. imageIsFromDecodeStream: image instanceof _decode_stream.DecodeStream,
  21251. inverseDecode: !!decode && decode[0] > 0,
  21252. interpolate
  21253. });
  21254. imgData.cached = !!cacheKey;
  21255. args = [imgData];
  21256. operatorList.addImageOps(_util.OPS.paintImageMaskXObject, args, optionalContent);
  21257. if (cacheKey) {
  21258. localImageCache.set(cacheKey, imageRef, {
  21259. fn: _util.OPS.paintImageMaskXObject,
  21260. args,
  21261. optionalContent
  21262. });
  21263. }
  21264. return;
  21265. }
  21266. imgData = _image.PDFImage.createMask({
  21267. imgArray,
  21268. width: w,
  21269. height: h,
  21270. imageIsFromDecodeStream: image instanceof _decode_stream.DecodeStream,
  21271. inverseDecode: !!decode && decode[0] > 0,
  21272. interpolate
  21273. });
  21274. if (imgData.isSingleOpaquePixel) {
  21275. operatorList.addImageOps(_util.OPS.paintSolidColorImageMask, [], optionalContent);
  21276. if (cacheKey) {
  21277. localImageCache.set(cacheKey, imageRef, {
  21278. fn: _util.OPS.paintSolidColorImageMask,
  21279. args: [],
  21280. optionalContent
  21281. });
  21282. }
  21283. return;
  21284. }
  21285. const objId = `mask_${this.idFactory.createObjId()}`;
  21286. operatorList.addDependency(objId);
  21287. this._sendImgData(objId, imgData);
  21288. args = [{
  21289. data: objId,
  21290. width: imgData.width,
  21291. height: imgData.height,
  21292. interpolate: imgData.interpolate,
  21293. count: 1
  21294. }];
  21295. operatorList.addImageOps(_util.OPS.paintImageMaskXObject, args, optionalContent);
  21296. if (cacheKey) {
  21297. localImageCache.set(cacheKey, imageRef, {
  21298. fn: _util.OPS.paintImageMaskXObject,
  21299. args,
  21300. optionalContent
  21301. });
  21302. }
  21303. return;
  21304. }
  21305. const softMask = dict.get("SM", "SMask") || false;
  21306. const mask = dict.get("Mask") || false;
  21307. const SMALL_IMAGE_DIMENSIONS = 200;
  21308. if (isInline && !softMask && !mask && w + h < SMALL_IMAGE_DIMENSIONS) {
  21309. const imageObj = new _image.PDFImage({
  21310. xref: this.xref,
  21311. res: resources,
  21312. image,
  21313. isInline,
  21314. pdfFunctionFactory: this._pdfFunctionFactory,
  21315. localColorSpaceCache
  21316. });
  21317. imgData = imageObj.createImageData(true);
  21318. operatorList.addImageOps(_util.OPS.paintInlineImageXObject, [imgData], optionalContent);
  21319. return;
  21320. }
  21321. let objId = `img_${this.idFactory.createObjId()}`,
  21322. cacheGlobally = false;
  21323. if (this.parsingType3Font) {
  21324. objId = `${this.idFactory.getDocId()}_type3_${objId}`;
  21325. } else if (imageRef) {
  21326. cacheGlobally = this.globalImageCache.shouldCache(imageRef, this.pageIndex);
  21327. if (cacheGlobally) {
  21328. objId = `${this.idFactory.getDocId()}_${objId}`;
  21329. }
  21330. }
  21331. operatorList.addDependency(objId);
  21332. args = [objId, w, h];
  21333. _image.PDFImage.buildImage({
  21334. xref: this.xref,
  21335. res: resources,
  21336. image,
  21337. isInline,
  21338. pdfFunctionFactory: this._pdfFunctionFactory,
  21339. localColorSpaceCache
  21340. }).then(imageObj => {
  21341. imgData = imageObj.createImageData(false);
  21342. if (cacheKey && imageRef && cacheGlobally) {
  21343. this.globalImageCache.addByteSize(imageRef, imgData.data.length);
  21344. }
  21345. return this._sendImgData(objId, imgData, cacheGlobally);
  21346. }).catch(reason => {
  21347. (0, _util.warn)(`Unable to decode image "${objId}": "${reason}".`);
  21348. return this._sendImgData(objId, null, cacheGlobally);
  21349. });
  21350. operatorList.addImageOps(_util.OPS.paintImageXObject, args, optionalContent);
  21351. if (cacheKey) {
  21352. localImageCache.set(cacheKey, imageRef, {
  21353. fn: _util.OPS.paintImageXObject,
  21354. args,
  21355. optionalContent
  21356. });
  21357. if (imageRef) {
  21358. (0, _util.assert)(!isInline, "Cannot cache an inline image globally.");
  21359. this.globalImageCache.addPageIndex(imageRef, this.pageIndex);
  21360. if (cacheGlobally) {
  21361. this.globalImageCache.setData(imageRef, {
  21362. objId,
  21363. fn: _util.OPS.paintImageXObject,
  21364. args,
  21365. optionalContent,
  21366. byteSize: 0
  21367. });
  21368. }
  21369. }
  21370. }
  21371. }
  21372. handleSMask(smask, resources, operatorList, task, stateManager, localColorSpaceCache) {
  21373. const smaskContent = smask.get("G");
  21374. const smaskOptions = {
  21375. subtype: smask.get("S").name,
  21376. backdrop: smask.get("BC")
  21377. };
  21378. const transferObj = smask.get("TR");
  21379. if ((0, _function.isPDFFunction)(transferObj)) {
  21380. const transferFn = this._pdfFunctionFactory.create(transferObj);
  21381. const transferMap = new Uint8Array(256);
  21382. const tmp = new Float32Array(1);
  21383. for (let i = 0; i < 256; i++) {
  21384. tmp[0] = i / 255;
  21385. transferFn(tmp, 0, tmp, 0);
  21386. transferMap[i] = tmp[0] * 255 | 0;
  21387. }
  21388. smaskOptions.transferMap = transferMap;
  21389. }
  21390. return this.buildFormXObject(resources, smaskContent, smaskOptions, operatorList, task, stateManager.state.clone(), localColorSpaceCache);
  21391. }
  21392. handleTransferFunction(tr) {
  21393. let transferArray;
  21394. if (Array.isArray(tr)) {
  21395. transferArray = tr;
  21396. } else if ((0, _function.isPDFFunction)(tr)) {
  21397. transferArray = [tr];
  21398. } else {
  21399. return null;
  21400. }
  21401. const transferMaps = [];
  21402. let numFns = 0,
  21403. numEffectfulFns = 0;
  21404. for (const entry of transferArray) {
  21405. const transferObj = this.xref.fetchIfRef(entry);
  21406. numFns++;
  21407. if ((0, _primitives.isName)(transferObj, "Identity")) {
  21408. transferMaps.push(null);
  21409. continue;
  21410. } else if (!(0, _function.isPDFFunction)(transferObj)) {
  21411. return null;
  21412. }
  21413. const transferFn = this._pdfFunctionFactory.create(transferObj);
  21414. const transferMap = new Uint8Array(256),
  21415. tmp = new Float32Array(1);
  21416. for (let j = 0; j < 256; j++) {
  21417. tmp[0] = j / 255;
  21418. transferFn(tmp, 0, tmp, 0);
  21419. transferMap[j] = tmp[0] * 255 | 0;
  21420. }
  21421. transferMaps.push(transferMap);
  21422. numEffectfulFns++;
  21423. }
  21424. if (!(numFns === 1 || numFns === 4)) {
  21425. return null;
  21426. }
  21427. if (numEffectfulFns === 0) {
  21428. return null;
  21429. }
  21430. return transferMaps;
  21431. }
  21432. handleTilingType(fn, color, resources, pattern, patternDict, operatorList, task, localTilingPatternCache) {
  21433. const tilingOpList = new _operator_list.OperatorList();
  21434. const patternResources = _primitives.Dict.merge({
  21435. xref: this.xref,
  21436. dictArray: [patternDict.get("Resources"), resources]
  21437. });
  21438. return this.getOperatorList({
  21439. stream: pattern,
  21440. task,
  21441. resources: patternResources,
  21442. operatorList: tilingOpList
  21443. }).then(function () {
  21444. const operatorListIR = tilingOpList.getIR();
  21445. const tilingPatternIR = (0, _pattern.getTilingPatternIR)(operatorListIR, patternDict, color);
  21446. operatorList.addDependencies(tilingOpList.dependencies);
  21447. operatorList.addOp(fn, tilingPatternIR);
  21448. if (patternDict.objId) {
  21449. localTilingPatternCache.set(null, patternDict.objId, {
  21450. operatorListIR,
  21451. dict: patternDict
  21452. });
  21453. }
  21454. }).catch(reason => {
  21455. if (reason instanceof _util.AbortException) {
  21456. return;
  21457. }
  21458. if (this.options.ignoreErrors) {
  21459. this.handler.send("UnsupportedFeature", {
  21460. featureId: _util.UNSUPPORTED_FEATURES.errorTilingPattern
  21461. });
  21462. (0, _util.warn)(`handleTilingType - ignoring pattern: "${reason}".`);
  21463. return;
  21464. }
  21465. throw reason;
  21466. });
  21467. }
  21468. handleSetFont(resources, fontArgs, fontRef, operatorList, task, state, fallbackFontDict = null, cssFontInfo = null) {
  21469. const fontName = fontArgs && fontArgs[0] instanceof _primitives.Name ? fontArgs[0].name : null;
  21470. return this.loadFont(fontName, fontRef, resources, fallbackFontDict, cssFontInfo).then(translated => {
  21471. if (!translated.font.isType3Font) {
  21472. return translated;
  21473. }
  21474. return translated.loadType3Data(this, resources, task).then(function () {
  21475. operatorList.addDependencies(translated.type3Dependencies);
  21476. return translated;
  21477. }).catch(reason => {
  21478. this.handler.send("UnsupportedFeature", {
  21479. featureId: _util.UNSUPPORTED_FEATURES.errorFontLoadType3
  21480. });
  21481. return new TranslatedFont({
  21482. loadedName: "g_font_error",
  21483. font: new _fonts.ErrorFont(`Type3 font load error: ${reason}`),
  21484. dict: translated.font,
  21485. evaluatorOptions: this.options
  21486. });
  21487. });
  21488. }).then(translated => {
  21489. state.font = translated.font;
  21490. translated.send(this.handler);
  21491. return translated.loadedName;
  21492. });
  21493. }
  21494. handleText(chars, state) {
  21495. const font = state.font;
  21496. const glyphs = font.charsToGlyphs(chars);
  21497. if (font.data) {
  21498. const isAddToPathSet = !!(state.textRenderingMode & _util.TextRenderingMode.ADD_TO_PATH_FLAG);
  21499. if (isAddToPathSet || state.fillColorSpace.name === "Pattern" || font.disableFontFace || this.options.disableFontFace) {
  21500. PartialEvaluator.buildFontPaths(font, glyphs, this.handler, this.options);
  21501. }
  21502. }
  21503. return glyphs;
  21504. }
  21505. ensureStateFont(state) {
  21506. if (state.font) {
  21507. return;
  21508. }
  21509. const reason = new _util.FormatError("Missing setFont (Tf) operator before text rendering operator.");
  21510. if (this.options.ignoreErrors) {
  21511. this.handler.send("UnsupportedFeature", {
  21512. featureId: _util.UNSUPPORTED_FEATURES.errorFontState
  21513. });
  21514. (0, _util.warn)(`ensureStateFont: "${reason}".`);
  21515. return;
  21516. }
  21517. throw reason;
  21518. }
  21519. async setGState({
  21520. resources,
  21521. gState,
  21522. operatorList,
  21523. cacheKey,
  21524. task,
  21525. stateManager,
  21526. localGStateCache,
  21527. localColorSpaceCache
  21528. }) {
  21529. const gStateRef = gState.objId;
  21530. let isSimpleGState = true;
  21531. const gStateObj = [];
  21532. const gStateKeys = gState.getKeys();
  21533. let promise = Promise.resolve();
  21534. for (let i = 0, ii = gStateKeys.length; i < ii; i++) {
  21535. const key = gStateKeys[i];
  21536. const value = gState.get(key);
  21537. switch (key) {
  21538. case "Type":
  21539. break;
  21540. case "LW":
  21541. case "LC":
  21542. case "LJ":
  21543. case "ML":
  21544. case "D":
  21545. case "RI":
  21546. case "FL":
  21547. case "CA":
  21548. case "ca":
  21549. gStateObj.push([key, value]);
  21550. break;
  21551. case "Font":
  21552. isSimpleGState = false;
  21553. promise = promise.then(() => {
  21554. return this.handleSetFont(resources, null, value[0], operatorList, task, stateManager.state).then(function (loadedName) {
  21555. operatorList.addDependency(loadedName);
  21556. gStateObj.push([key, [loadedName, value[1]]]);
  21557. });
  21558. });
  21559. break;
  21560. case "BM":
  21561. gStateObj.push([key, normalizeBlendMode(value)]);
  21562. break;
  21563. case "SMask":
  21564. if ((0, _primitives.isName)(value, "None")) {
  21565. gStateObj.push([key, false]);
  21566. break;
  21567. }
  21568. if (value instanceof _primitives.Dict) {
  21569. isSimpleGState = false;
  21570. promise = promise.then(() => {
  21571. return this.handleSMask(value, resources, operatorList, task, stateManager, localColorSpaceCache);
  21572. });
  21573. gStateObj.push([key, true]);
  21574. } else {
  21575. (0, _util.warn)("Unsupported SMask type");
  21576. }
  21577. break;
  21578. case "TR":
  21579. const transferMaps = this.handleTransferFunction(value);
  21580. gStateObj.push([key, transferMaps]);
  21581. break;
  21582. case "OP":
  21583. case "op":
  21584. case "OPM":
  21585. case "BG":
  21586. case "BG2":
  21587. case "UCR":
  21588. case "UCR2":
  21589. case "TR2":
  21590. case "HT":
  21591. case "SM":
  21592. case "SA":
  21593. case "AIS":
  21594. case "TK":
  21595. (0, _util.info)("graphic state operator " + key);
  21596. break;
  21597. default:
  21598. (0, _util.info)("Unknown graphic state operator " + key);
  21599. break;
  21600. }
  21601. }
  21602. return promise.then(function () {
  21603. if (gStateObj.length > 0) {
  21604. operatorList.addOp(_util.OPS.setGState, [gStateObj]);
  21605. }
  21606. if (isSimpleGState) {
  21607. localGStateCache.set(cacheKey, gStateRef, gStateObj);
  21608. }
  21609. });
  21610. }
  21611. loadFont(fontName, font, resources, fallbackFontDict = null, cssFontInfo = null) {
  21612. const errorFont = async () => {
  21613. return new TranslatedFont({
  21614. loadedName: "g_font_error",
  21615. font: new _fonts.ErrorFont(`Font "${fontName}" is not available.`),
  21616. dict: font,
  21617. evaluatorOptions: this.options
  21618. });
  21619. };
  21620. const xref = this.xref;
  21621. let fontRef;
  21622. if (font) {
  21623. if (font instanceof _primitives.Ref) {
  21624. fontRef = font;
  21625. }
  21626. } else {
  21627. const fontRes = resources.get("Font");
  21628. if (fontRes) {
  21629. fontRef = fontRes.getRaw(fontName);
  21630. }
  21631. }
  21632. if (!fontRef) {
  21633. const partialMsg = `Font "${fontName || font && font.toString()}" is not available`;
  21634. if (!this.options.ignoreErrors && !this.parsingType3Font) {
  21635. (0, _util.warn)(`${partialMsg}.`);
  21636. return errorFont();
  21637. }
  21638. this.handler.send("UnsupportedFeature", {
  21639. featureId: _util.UNSUPPORTED_FEATURES.errorFontMissing
  21640. });
  21641. (0, _util.warn)(`${partialMsg} -- attempting to fallback to a default font.`);
  21642. if (fallbackFontDict) {
  21643. fontRef = fallbackFontDict;
  21644. } else {
  21645. fontRef = PartialEvaluator.fallbackFontDict;
  21646. }
  21647. }
  21648. if (this.parsingType3Font && this.type3FontRefs.has(fontRef)) {
  21649. return errorFont();
  21650. }
  21651. if (this.fontCache.has(fontRef)) {
  21652. return this.fontCache.get(fontRef);
  21653. }
  21654. font = xref.fetchIfRef(fontRef);
  21655. if (!(font instanceof _primitives.Dict)) {
  21656. return errorFont();
  21657. }
  21658. if (font.cacheKey && this.fontCache.has(font.cacheKey)) {
  21659. return this.fontCache.get(font.cacheKey);
  21660. }
  21661. const fontCapability = (0, _util.createPromiseCapability)();
  21662. let preEvaluatedFont;
  21663. try {
  21664. preEvaluatedFont = this.preEvaluateFont(font);
  21665. preEvaluatedFont.cssFontInfo = cssFontInfo;
  21666. } catch (reason) {
  21667. (0, _util.warn)(`loadFont - preEvaluateFont failed: "${reason}".`);
  21668. return errorFont();
  21669. }
  21670. const {
  21671. descriptor,
  21672. hash
  21673. } = preEvaluatedFont;
  21674. const fontRefIsRef = fontRef instanceof _primitives.Ref;
  21675. let fontID;
  21676. if (fontRefIsRef) {
  21677. fontID = `f${fontRef.toString()}`;
  21678. }
  21679. if (hash && descriptor instanceof _primitives.Dict) {
  21680. if (!descriptor.fontAliases) {
  21681. descriptor.fontAliases = Object.create(null);
  21682. }
  21683. const fontAliases = descriptor.fontAliases;
  21684. if (fontAliases[hash]) {
  21685. const aliasFontRef = fontAliases[hash].aliasRef;
  21686. if (fontRefIsRef && aliasFontRef && this.fontCache.has(aliasFontRef)) {
  21687. this.fontCache.putAlias(fontRef, aliasFontRef);
  21688. return this.fontCache.get(fontRef);
  21689. }
  21690. } else {
  21691. fontAliases[hash] = {
  21692. fontID: this.idFactory.createFontId()
  21693. };
  21694. }
  21695. if (fontRefIsRef) {
  21696. fontAliases[hash].aliasRef = fontRef;
  21697. }
  21698. fontID = fontAliases[hash].fontID;
  21699. }
  21700. if (fontRefIsRef) {
  21701. this.fontCache.put(fontRef, fontCapability.promise);
  21702. } else {
  21703. if (!fontID) {
  21704. fontID = this.idFactory.createFontId();
  21705. }
  21706. font.cacheKey = `cacheKey_${fontID}`;
  21707. this.fontCache.put(font.cacheKey, fontCapability.promise);
  21708. }
  21709. (0, _util.assert)(fontID && fontID.startsWith("f"), 'The "fontID" must be (correctly) defined.');
  21710. font.loadedName = `${this.idFactory.getDocId()}_${fontID}`;
  21711. this.translateFont(preEvaluatedFont).then(translatedFont => {
  21712. if (translatedFont.fontType !== undefined) {
  21713. xref.stats.addFontType(translatedFont.fontType);
  21714. }
  21715. fontCapability.resolve(new TranslatedFont({
  21716. loadedName: font.loadedName,
  21717. font: translatedFont,
  21718. dict: font,
  21719. evaluatorOptions: this.options
  21720. }));
  21721. }).catch(reason => {
  21722. this.handler.send("UnsupportedFeature", {
  21723. featureId: _util.UNSUPPORTED_FEATURES.errorFontTranslate
  21724. });
  21725. (0, _util.warn)(`loadFont - translateFont failed: "${reason}".`);
  21726. try {
  21727. const fontFile3 = descriptor && descriptor.get("FontFile3");
  21728. const subtype = fontFile3 && fontFile3.get("Subtype");
  21729. const fontType = (0, _fonts_utils.getFontType)(preEvaluatedFont.type, subtype && subtype.name);
  21730. if (fontType !== undefined) {
  21731. xref.stats.addFontType(fontType);
  21732. }
  21733. } catch (ex) {}
  21734. fontCapability.resolve(new TranslatedFont({
  21735. loadedName: font.loadedName,
  21736. font: new _fonts.ErrorFont(reason instanceof Error ? reason.message : reason),
  21737. dict: font,
  21738. evaluatorOptions: this.options
  21739. }));
  21740. });
  21741. return fontCapability.promise;
  21742. }
  21743. buildPath(operatorList, fn, args, parsingText = false) {
  21744. const lastIndex = operatorList.length - 1;
  21745. if (!args) {
  21746. args = [];
  21747. }
  21748. let minMax;
  21749. if (lastIndex < 0 || operatorList.fnArray[lastIndex] !== _util.OPS.constructPath) {
  21750. if (parsingText) {
  21751. (0, _util.warn)(`Encountered path operator "${fn}" inside of a text object.`);
  21752. operatorList.addOp(_util.OPS.save, null);
  21753. }
  21754. minMax = [Infinity, -Infinity, Infinity, -Infinity];
  21755. operatorList.addOp(_util.OPS.constructPath, [[fn], args, minMax]);
  21756. if (parsingText) {
  21757. operatorList.addOp(_util.OPS.restore, null);
  21758. }
  21759. } else {
  21760. const opArgs = operatorList.argsArray[lastIndex];
  21761. opArgs[0].push(fn);
  21762. Array.prototype.push.apply(opArgs[1], args);
  21763. minMax = opArgs[2];
  21764. }
  21765. switch (fn) {
  21766. case _util.OPS.rectangle:
  21767. minMax[0] = Math.min(minMax[0], args[0], args[0] + args[2]);
  21768. minMax[1] = Math.max(minMax[1], args[0], args[0] + args[2]);
  21769. minMax[2] = Math.min(minMax[2], args[1], args[1] + args[3]);
  21770. minMax[3] = Math.max(minMax[3], args[1], args[1] + args[3]);
  21771. break;
  21772. case _util.OPS.moveTo:
  21773. case _util.OPS.lineTo:
  21774. minMax[0] = Math.min(minMax[0], args[0]);
  21775. minMax[1] = Math.max(minMax[1], args[0]);
  21776. minMax[2] = Math.min(minMax[2], args[1]);
  21777. minMax[3] = Math.max(minMax[3], args[1]);
  21778. break;
  21779. }
  21780. }
  21781. parseColorSpace({
  21782. cs,
  21783. resources,
  21784. localColorSpaceCache
  21785. }) {
  21786. return _colorspace.ColorSpace.parseAsync({
  21787. cs,
  21788. xref: this.xref,
  21789. resources,
  21790. pdfFunctionFactory: this._pdfFunctionFactory,
  21791. localColorSpaceCache
  21792. }).catch(reason => {
  21793. if (reason instanceof _util.AbortException) {
  21794. return null;
  21795. }
  21796. if (this.options.ignoreErrors) {
  21797. this.handler.send("UnsupportedFeature", {
  21798. featureId: _util.UNSUPPORTED_FEATURES.errorColorSpace
  21799. });
  21800. (0, _util.warn)(`parseColorSpace - ignoring ColorSpace: "${reason}".`);
  21801. return null;
  21802. }
  21803. throw reason;
  21804. });
  21805. }
  21806. parseShading({
  21807. shading,
  21808. resources,
  21809. localColorSpaceCache,
  21810. localShadingPatternCache
  21811. }) {
  21812. let id = localShadingPatternCache.get(shading);
  21813. if (!id) {
  21814. var shadingFill = _pattern.Pattern.parseShading(shading, this.xref, resources, this.handler, this._pdfFunctionFactory, localColorSpaceCache);
  21815. const patternIR = shadingFill.getIR();
  21816. id = `pattern_${this.idFactory.createObjId()}`;
  21817. localShadingPatternCache.set(shading, id);
  21818. this.handler.send("obj", [id, this.pageIndex, "Pattern", patternIR]);
  21819. }
  21820. return id;
  21821. }
  21822. handleColorN(operatorList, fn, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache) {
  21823. const patternName = args.pop();
  21824. if (patternName instanceof _primitives.Name) {
  21825. const rawPattern = patterns.getRaw(patternName.name);
  21826. const localTilingPattern = rawPattern instanceof _primitives.Ref && localTilingPatternCache.getByRef(rawPattern);
  21827. if (localTilingPattern) {
  21828. try {
  21829. const color = cs.base ? cs.base.getRgb(args, 0) : null;
  21830. const tilingPatternIR = (0, _pattern.getTilingPatternIR)(localTilingPattern.operatorListIR, localTilingPattern.dict, color);
  21831. operatorList.addOp(fn, tilingPatternIR);
  21832. return undefined;
  21833. } catch (ex) {}
  21834. }
  21835. const pattern = this.xref.fetchIfRef(rawPattern);
  21836. if (pattern) {
  21837. const dict = pattern instanceof _base_stream.BaseStream ? pattern.dict : pattern;
  21838. const typeNum = dict.get("PatternType");
  21839. if (typeNum === PatternType.TILING) {
  21840. const color = cs.base ? cs.base.getRgb(args, 0) : null;
  21841. return this.handleTilingType(fn, color, resources, pattern, dict, operatorList, task, localTilingPatternCache);
  21842. } else if (typeNum === PatternType.SHADING) {
  21843. const shading = dict.get("Shading");
  21844. const matrix = dict.getArray("Matrix");
  21845. const objId = this.parseShading({
  21846. shading,
  21847. resources,
  21848. localColorSpaceCache,
  21849. localShadingPatternCache
  21850. });
  21851. operatorList.addOp(fn, ["Shading", objId, matrix]);
  21852. return undefined;
  21853. }
  21854. throw new _util.FormatError(`Unknown PatternType: ${typeNum}`);
  21855. }
  21856. }
  21857. throw new _util.FormatError(`Unknown PatternName: ${patternName}`);
  21858. }
  21859. _parseVisibilityExpression(array, nestingCounter, currentResult) {
  21860. const MAX_NESTING = 10;
  21861. if (++nestingCounter > MAX_NESTING) {
  21862. (0, _util.warn)("Visibility expression is too deeply nested");
  21863. return;
  21864. }
  21865. const length = array.length;
  21866. const operator = this.xref.fetchIfRef(array[0]);
  21867. if (length < 2 || !(operator instanceof _primitives.Name)) {
  21868. (0, _util.warn)("Invalid visibility expression");
  21869. return;
  21870. }
  21871. switch (operator.name) {
  21872. case "And":
  21873. case "Or":
  21874. case "Not":
  21875. currentResult.push(operator.name);
  21876. break;
  21877. default:
  21878. (0, _util.warn)(`Invalid operator ${operator.name} in visibility expression`);
  21879. return;
  21880. }
  21881. for (let i = 1; i < length; i++) {
  21882. const raw = array[i];
  21883. const object = this.xref.fetchIfRef(raw);
  21884. if (Array.isArray(object)) {
  21885. const nestedResult = [];
  21886. currentResult.push(nestedResult);
  21887. this._parseVisibilityExpression(object, nestingCounter, nestedResult);
  21888. } else if (raw instanceof _primitives.Ref) {
  21889. currentResult.push(raw.toString());
  21890. }
  21891. }
  21892. }
  21893. async parseMarkedContentProps(contentProperties, resources) {
  21894. let optionalContent;
  21895. if (contentProperties instanceof _primitives.Name) {
  21896. const properties = resources.get("Properties");
  21897. optionalContent = properties.get(contentProperties.name);
  21898. } else if (contentProperties instanceof _primitives.Dict) {
  21899. optionalContent = contentProperties;
  21900. } else {
  21901. throw new _util.FormatError("Optional content properties malformed.");
  21902. }
  21903. const optionalContentType = optionalContent.get("Type").name;
  21904. if (optionalContentType === "OCG") {
  21905. return {
  21906. type: optionalContentType,
  21907. id: optionalContent.objId
  21908. };
  21909. } else if (optionalContentType === "OCMD") {
  21910. const expression = optionalContent.get("VE");
  21911. if (Array.isArray(expression)) {
  21912. const result = [];
  21913. this._parseVisibilityExpression(expression, 0, result);
  21914. if (result.length > 0) {
  21915. return {
  21916. type: "OCMD",
  21917. expression: result
  21918. };
  21919. }
  21920. }
  21921. const optionalContentGroups = optionalContent.get("OCGs");
  21922. if (Array.isArray(optionalContentGroups) || optionalContentGroups instanceof _primitives.Dict) {
  21923. const groupIds = [];
  21924. if (Array.isArray(optionalContentGroups)) {
  21925. for (const ocg of optionalContentGroups) {
  21926. groupIds.push(ocg.toString());
  21927. }
  21928. } else {
  21929. groupIds.push(optionalContentGroups.objId);
  21930. }
  21931. return {
  21932. type: optionalContentType,
  21933. ids: groupIds,
  21934. policy: optionalContent.get("P") instanceof _primitives.Name ? optionalContent.get("P").name : null,
  21935. expression: null
  21936. };
  21937. } else if (optionalContentGroups instanceof _primitives.Ref) {
  21938. return {
  21939. type: optionalContentType,
  21940. id: optionalContentGroups.toString()
  21941. };
  21942. }
  21943. }
  21944. return null;
  21945. }
  21946. getOperatorList({
  21947. stream,
  21948. task,
  21949. resources,
  21950. operatorList,
  21951. initialState = null,
  21952. fallbackFontDict = null
  21953. }) {
  21954. resources = resources || _primitives.Dict.empty;
  21955. initialState = initialState || new EvalState();
  21956. if (!operatorList) {
  21957. throw new Error('getOperatorList: missing "operatorList" parameter');
  21958. }
  21959. const self = this;
  21960. const xref = this.xref;
  21961. let parsingText = false;
  21962. const localImageCache = new _image_utils.LocalImageCache();
  21963. const localColorSpaceCache = new _image_utils.LocalColorSpaceCache();
  21964. const localGStateCache = new _image_utils.LocalGStateCache();
  21965. const localTilingPatternCache = new _image_utils.LocalTilingPatternCache();
  21966. const localShadingPatternCache = new Map();
  21967. const xobjs = resources.get("XObject") || _primitives.Dict.empty;
  21968. const patterns = resources.get("Pattern") || _primitives.Dict.empty;
  21969. const stateManager = new StateManager(initialState);
  21970. const preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
  21971. const timeSlotManager = new TimeSlotManager();
  21972. function closePendingRestoreOPS(argument) {
  21973. for (let i = 0, ii = preprocessor.savedStatesDepth; i < ii; i++) {
  21974. operatorList.addOp(_util.OPS.restore, []);
  21975. }
  21976. }
  21977. return new Promise(function promiseBody(resolve, reject) {
  21978. const next = function (promise) {
  21979. Promise.all([promise, operatorList.ready]).then(function () {
  21980. try {
  21981. promiseBody(resolve, reject);
  21982. } catch (ex) {
  21983. reject(ex);
  21984. }
  21985. }, reject);
  21986. };
  21987. task.ensureNotTerminated();
  21988. timeSlotManager.reset();
  21989. const operation = {};
  21990. let stop, i, ii, cs, name, isValidName;
  21991. while (!(stop = timeSlotManager.check())) {
  21992. operation.args = null;
  21993. if (!preprocessor.read(operation)) {
  21994. break;
  21995. }
  21996. let args = operation.args;
  21997. let fn = operation.fn;
  21998. switch (fn | 0) {
  21999. case _util.OPS.paintXObject:
  22000. isValidName = args[0] instanceof _primitives.Name;
  22001. name = args[0].name;
  22002. if (isValidName) {
  22003. const localImage = localImageCache.getByName(name);
  22004. if (localImage) {
  22005. operatorList.addImageOps(localImage.fn, localImage.args, localImage.optionalContent);
  22006. incrementCachedImageMaskCount(localImage);
  22007. args = null;
  22008. continue;
  22009. }
  22010. }
  22011. next(new Promise(function (resolveXObject, rejectXObject) {
  22012. if (!isValidName) {
  22013. throw new _util.FormatError("XObject must be referred to by name.");
  22014. }
  22015. let xobj = xobjs.getRaw(name);
  22016. if (xobj instanceof _primitives.Ref) {
  22017. const localImage = localImageCache.getByRef(xobj);
  22018. if (localImage) {
  22019. operatorList.addImageOps(localImage.fn, localImage.args, localImage.optionalContent);
  22020. incrementCachedImageMaskCount(localImage);
  22021. resolveXObject();
  22022. return;
  22023. }
  22024. const globalImage = self.globalImageCache.getData(xobj, self.pageIndex);
  22025. if (globalImage) {
  22026. operatorList.addDependency(globalImage.objId);
  22027. operatorList.addImageOps(globalImage.fn, globalImage.args, globalImage.optionalContent);
  22028. resolveXObject();
  22029. return;
  22030. }
  22031. xobj = xref.fetch(xobj);
  22032. }
  22033. if (!(xobj instanceof _base_stream.BaseStream)) {
  22034. throw new _util.FormatError("XObject should be a stream");
  22035. }
  22036. const type = xobj.dict.get("Subtype");
  22037. if (!(type instanceof _primitives.Name)) {
  22038. throw new _util.FormatError("XObject should have a Name subtype");
  22039. }
  22040. if (type.name === "Form") {
  22041. stateManager.save();
  22042. self.buildFormXObject(resources, xobj, null, operatorList, task, stateManager.state.clone(), localColorSpaceCache).then(function () {
  22043. stateManager.restore();
  22044. resolveXObject();
  22045. }, rejectXObject);
  22046. return;
  22047. } else if (type.name === "Image") {
  22048. self.buildPaintImageXObject({
  22049. resources,
  22050. image: xobj,
  22051. operatorList,
  22052. cacheKey: name,
  22053. localImageCache,
  22054. localColorSpaceCache
  22055. }).then(resolveXObject, rejectXObject);
  22056. return;
  22057. } else if (type.name === "PS") {
  22058. (0, _util.info)("Ignored XObject subtype PS");
  22059. } else {
  22060. throw new _util.FormatError(`Unhandled XObject subtype ${type.name}`);
  22061. }
  22062. resolveXObject();
  22063. }).catch(function (reason) {
  22064. if (reason instanceof _util.AbortException) {
  22065. return;
  22066. }
  22067. if (self.options.ignoreErrors) {
  22068. self.handler.send("UnsupportedFeature", {
  22069. featureId: _util.UNSUPPORTED_FEATURES.errorXObject
  22070. });
  22071. (0, _util.warn)(`getOperatorList - ignoring XObject: "${reason}".`);
  22072. return;
  22073. }
  22074. throw reason;
  22075. }));
  22076. return;
  22077. case _util.OPS.setFont:
  22078. var fontSize = args[1];
  22079. next(self.handleSetFont(resources, args, null, operatorList, task, stateManager.state, fallbackFontDict).then(function (loadedName) {
  22080. operatorList.addDependency(loadedName);
  22081. operatorList.addOp(_util.OPS.setFont, [loadedName, fontSize]);
  22082. }));
  22083. return;
  22084. case _util.OPS.beginText:
  22085. parsingText = true;
  22086. break;
  22087. case _util.OPS.endText:
  22088. parsingText = false;
  22089. break;
  22090. case _util.OPS.endInlineImage:
  22091. var cacheKey = args[0].cacheKey;
  22092. if (cacheKey) {
  22093. const localImage = localImageCache.getByName(cacheKey);
  22094. if (localImage) {
  22095. operatorList.addImageOps(localImage.fn, localImage.args, localImage.optionalContent);
  22096. incrementCachedImageMaskCount(localImage);
  22097. args = null;
  22098. continue;
  22099. }
  22100. }
  22101. next(self.buildPaintImageXObject({
  22102. resources,
  22103. image: args[0],
  22104. isInline: true,
  22105. operatorList,
  22106. cacheKey,
  22107. localImageCache,
  22108. localColorSpaceCache
  22109. }));
  22110. return;
  22111. case _util.OPS.showText:
  22112. if (!stateManager.state.font) {
  22113. self.ensureStateFont(stateManager.state);
  22114. continue;
  22115. }
  22116. args[0] = self.handleText(args[0], stateManager.state);
  22117. break;
  22118. case _util.OPS.showSpacedText:
  22119. if (!stateManager.state.font) {
  22120. self.ensureStateFont(stateManager.state);
  22121. continue;
  22122. }
  22123. var arr = args[0];
  22124. var combinedGlyphs = [];
  22125. var arrLength = arr.length;
  22126. var state = stateManager.state;
  22127. for (i = 0; i < arrLength; ++i) {
  22128. const arrItem = arr[i];
  22129. if (typeof arrItem === "string") {
  22130. Array.prototype.push.apply(combinedGlyphs, self.handleText(arrItem, state));
  22131. } else if (typeof arrItem === "number") {
  22132. combinedGlyphs.push(arrItem);
  22133. }
  22134. }
  22135. args[0] = combinedGlyphs;
  22136. fn = _util.OPS.showText;
  22137. break;
  22138. case _util.OPS.nextLineShowText:
  22139. if (!stateManager.state.font) {
  22140. self.ensureStateFont(stateManager.state);
  22141. continue;
  22142. }
  22143. operatorList.addOp(_util.OPS.nextLine);
  22144. args[0] = self.handleText(args[0], stateManager.state);
  22145. fn = _util.OPS.showText;
  22146. break;
  22147. case _util.OPS.nextLineSetSpacingShowText:
  22148. if (!stateManager.state.font) {
  22149. self.ensureStateFont(stateManager.state);
  22150. continue;
  22151. }
  22152. operatorList.addOp(_util.OPS.nextLine);
  22153. operatorList.addOp(_util.OPS.setWordSpacing, [args.shift()]);
  22154. operatorList.addOp(_util.OPS.setCharSpacing, [args.shift()]);
  22155. args[0] = self.handleText(args[0], stateManager.state);
  22156. fn = _util.OPS.showText;
  22157. break;
  22158. case _util.OPS.setTextRenderingMode:
  22159. stateManager.state.textRenderingMode = args[0];
  22160. break;
  22161. case _util.OPS.setFillColorSpace:
  22162. {
  22163. const cachedColorSpace = _colorspace.ColorSpace.getCached(args[0], xref, localColorSpaceCache);
  22164. if (cachedColorSpace) {
  22165. stateManager.state.fillColorSpace = cachedColorSpace;
  22166. continue;
  22167. }
  22168. next(self.parseColorSpace({
  22169. cs: args[0],
  22170. resources,
  22171. localColorSpaceCache
  22172. }).then(function (colorSpace) {
  22173. if (colorSpace) {
  22174. stateManager.state.fillColorSpace = colorSpace;
  22175. }
  22176. }));
  22177. return;
  22178. }
  22179. case _util.OPS.setStrokeColorSpace:
  22180. {
  22181. const cachedColorSpace = _colorspace.ColorSpace.getCached(args[0], xref, localColorSpaceCache);
  22182. if (cachedColorSpace) {
  22183. stateManager.state.strokeColorSpace = cachedColorSpace;
  22184. continue;
  22185. }
  22186. next(self.parseColorSpace({
  22187. cs: args[0],
  22188. resources,
  22189. localColorSpaceCache
  22190. }).then(function (colorSpace) {
  22191. if (colorSpace) {
  22192. stateManager.state.strokeColorSpace = colorSpace;
  22193. }
  22194. }));
  22195. return;
  22196. }
  22197. case _util.OPS.setFillColor:
  22198. cs = stateManager.state.fillColorSpace;
  22199. args = cs.getRgb(args, 0);
  22200. fn = _util.OPS.setFillRGBColor;
  22201. break;
  22202. case _util.OPS.setStrokeColor:
  22203. cs = stateManager.state.strokeColorSpace;
  22204. args = cs.getRgb(args, 0);
  22205. fn = _util.OPS.setStrokeRGBColor;
  22206. break;
  22207. case _util.OPS.setFillGray:
  22208. stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.gray;
  22209. args = _colorspace.ColorSpace.singletons.gray.getRgb(args, 0);
  22210. fn = _util.OPS.setFillRGBColor;
  22211. break;
  22212. case _util.OPS.setStrokeGray:
  22213. stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.gray;
  22214. args = _colorspace.ColorSpace.singletons.gray.getRgb(args, 0);
  22215. fn = _util.OPS.setStrokeRGBColor;
  22216. break;
  22217. case _util.OPS.setFillCMYKColor:
  22218. stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.cmyk;
  22219. args = _colorspace.ColorSpace.singletons.cmyk.getRgb(args, 0);
  22220. fn = _util.OPS.setFillRGBColor;
  22221. break;
  22222. case _util.OPS.setStrokeCMYKColor:
  22223. stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.cmyk;
  22224. args = _colorspace.ColorSpace.singletons.cmyk.getRgb(args, 0);
  22225. fn = _util.OPS.setStrokeRGBColor;
  22226. break;
  22227. case _util.OPS.setFillRGBColor:
  22228. stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.rgb;
  22229. args = _colorspace.ColorSpace.singletons.rgb.getRgb(args, 0);
  22230. break;
  22231. case _util.OPS.setStrokeRGBColor:
  22232. stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.rgb;
  22233. args = _colorspace.ColorSpace.singletons.rgb.getRgb(args, 0);
  22234. break;
  22235. case _util.OPS.setFillColorN:
  22236. cs = stateManager.state.fillColorSpace;
  22237. if (cs.name === "Pattern") {
  22238. next(self.handleColorN(operatorList, _util.OPS.setFillColorN, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache));
  22239. return;
  22240. }
  22241. args = cs.getRgb(args, 0);
  22242. fn = _util.OPS.setFillRGBColor;
  22243. break;
  22244. case _util.OPS.setStrokeColorN:
  22245. cs = stateManager.state.strokeColorSpace;
  22246. if (cs.name === "Pattern") {
  22247. next(self.handleColorN(operatorList, _util.OPS.setStrokeColorN, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache));
  22248. return;
  22249. }
  22250. args = cs.getRgb(args, 0);
  22251. fn = _util.OPS.setStrokeRGBColor;
  22252. break;
  22253. case _util.OPS.shadingFill:
  22254. var shadingRes = resources.get("Shading");
  22255. if (!shadingRes) {
  22256. throw new _util.FormatError("No shading resource found");
  22257. }
  22258. var shading = shadingRes.get(args[0].name);
  22259. if (!shading) {
  22260. throw new _util.FormatError("No shading object found");
  22261. }
  22262. const patternId = self.parseShading({
  22263. shading,
  22264. resources,
  22265. localColorSpaceCache,
  22266. localShadingPatternCache
  22267. });
  22268. args = [patternId];
  22269. fn = _util.OPS.shadingFill;
  22270. break;
  22271. case _util.OPS.setGState:
  22272. isValidName = args[0] instanceof _primitives.Name;
  22273. name = args[0].name;
  22274. if (isValidName) {
  22275. const localGStateObj = localGStateCache.getByName(name);
  22276. if (localGStateObj) {
  22277. if (localGStateObj.length > 0) {
  22278. operatorList.addOp(_util.OPS.setGState, [localGStateObj]);
  22279. }
  22280. args = null;
  22281. continue;
  22282. }
  22283. }
  22284. next(new Promise(function (resolveGState, rejectGState) {
  22285. if (!isValidName) {
  22286. throw new _util.FormatError("GState must be referred to by name.");
  22287. }
  22288. const extGState = resources.get("ExtGState");
  22289. if (!(extGState instanceof _primitives.Dict)) {
  22290. throw new _util.FormatError("ExtGState should be a dictionary.");
  22291. }
  22292. const gState = extGState.get(name);
  22293. if (!(gState instanceof _primitives.Dict)) {
  22294. throw new _util.FormatError("GState should be a dictionary.");
  22295. }
  22296. self.setGState({
  22297. resources,
  22298. gState,
  22299. operatorList,
  22300. cacheKey: name,
  22301. task,
  22302. stateManager,
  22303. localGStateCache,
  22304. localColorSpaceCache
  22305. }).then(resolveGState, rejectGState);
  22306. }).catch(function (reason) {
  22307. if (reason instanceof _util.AbortException) {
  22308. return;
  22309. }
  22310. if (self.options.ignoreErrors) {
  22311. self.handler.send("UnsupportedFeature", {
  22312. featureId: _util.UNSUPPORTED_FEATURES.errorExtGState
  22313. });
  22314. (0, _util.warn)(`getOperatorList - ignoring ExtGState: "${reason}".`);
  22315. return;
  22316. }
  22317. throw reason;
  22318. }));
  22319. return;
  22320. case _util.OPS.moveTo:
  22321. case _util.OPS.lineTo:
  22322. case _util.OPS.curveTo:
  22323. case _util.OPS.curveTo2:
  22324. case _util.OPS.curveTo3:
  22325. case _util.OPS.closePath:
  22326. case _util.OPS.rectangle:
  22327. self.buildPath(operatorList, fn, args, parsingText);
  22328. continue;
  22329. case _util.OPS.markPoint:
  22330. case _util.OPS.markPointProps:
  22331. case _util.OPS.beginCompat:
  22332. case _util.OPS.endCompat:
  22333. continue;
  22334. case _util.OPS.beginMarkedContentProps:
  22335. if (!(args[0] instanceof _primitives.Name)) {
  22336. (0, _util.warn)(`Expected name for beginMarkedContentProps arg0=${args[0]}`);
  22337. continue;
  22338. }
  22339. if (args[0].name === "OC") {
  22340. next(self.parseMarkedContentProps(args[1], resources).then(data => {
  22341. operatorList.addOp(_util.OPS.beginMarkedContentProps, ["OC", data]);
  22342. }).catch(reason => {
  22343. if (reason instanceof _util.AbortException) {
  22344. return;
  22345. }
  22346. if (self.options.ignoreErrors) {
  22347. self.handler.send("UnsupportedFeature", {
  22348. featureId: _util.UNSUPPORTED_FEATURES.errorMarkedContent
  22349. });
  22350. (0, _util.warn)(`getOperatorList - ignoring beginMarkedContentProps: "${reason}".`);
  22351. return;
  22352. }
  22353. throw reason;
  22354. }));
  22355. return;
  22356. }
  22357. args = [args[0].name, args[1] instanceof _primitives.Dict ? args[1].get("MCID") : null];
  22358. break;
  22359. case _util.OPS.beginMarkedContent:
  22360. case _util.OPS.endMarkedContent:
  22361. default:
  22362. if (args !== null) {
  22363. for (i = 0, ii = args.length; i < ii; i++) {
  22364. if (args[i] instanceof _primitives.Dict) {
  22365. break;
  22366. }
  22367. }
  22368. if (i < ii) {
  22369. (0, _util.warn)("getOperatorList - ignoring operator: " + fn);
  22370. continue;
  22371. }
  22372. }
  22373. }
  22374. operatorList.addOp(fn, args);
  22375. }
  22376. if (stop) {
  22377. next(deferred);
  22378. return;
  22379. }
  22380. closePendingRestoreOPS();
  22381. resolve();
  22382. }).catch(reason => {
  22383. if (reason instanceof _util.AbortException) {
  22384. return;
  22385. }
  22386. if (this.options.ignoreErrors) {
  22387. this.handler.send("UnsupportedFeature", {
  22388. featureId: _util.UNSUPPORTED_FEATURES.errorOperatorList
  22389. });
  22390. (0, _util.warn)(`getOperatorList - ignoring errors during "${task.name}" ` + `task: "${reason}".`);
  22391. closePendingRestoreOPS();
  22392. return;
  22393. }
  22394. throw reason;
  22395. });
  22396. }
  22397. getTextContent({
  22398. stream,
  22399. task,
  22400. resources,
  22401. stateManager = null,
  22402. combineTextItems = false,
  22403. includeMarkedContent = false,
  22404. sink,
  22405. seenStyles = new Set(),
  22406. viewBox
  22407. }) {
  22408. resources = resources || _primitives.Dict.empty;
  22409. stateManager = stateManager || new StateManager(new TextState());
  22410. const NormalizedUnicodes = (0, _unicode.getNormalizedUnicodes)();
  22411. const textContent = {
  22412. items: [],
  22413. styles: Object.create(null)
  22414. };
  22415. const textContentItem = {
  22416. initialized: false,
  22417. str: [],
  22418. totalWidth: 0,
  22419. totalHeight: 0,
  22420. width: 0,
  22421. height: 0,
  22422. vertical: false,
  22423. prevTransform: null,
  22424. textAdvanceScale: 0,
  22425. spaceInFlowMin: 0,
  22426. spaceInFlowMax: 0,
  22427. trackingSpaceMin: Infinity,
  22428. negativeSpaceMax: -Infinity,
  22429. notASpace: -Infinity,
  22430. transform: null,
  22431. fontName: null,
  22432. hasEOL: false
  22433. };
  22434. const twoLastChars = [" ", " "];
  22435. let twoLastCharsPos = 0;
  22436. function saveLastChar(char) {
  22437. const nextPos = (twoLastCharsPos + 1) % 2;
  22438. const ret = twoLastChars[twoLastCharsPos] !== " " && twoLastChars[nextPos] === " ";
  22439. twoLastChars[twoLastCharsPos] = char;
  22440. twoLastCharsPos = nextPos;
  22441. return ret;
  22442. }
  22443. function resetLastChars() {
  22444. twoLastChars[0] = twoLastChars[1] = " ";
  22445. twoLastCharsPos = 0;
  22446. }
  22447. const TRACKING_SPACE_FACTOR = 0.1;
  22448. const NOT_A_SPACE_FACTOR = 0.03;
  22449. const NEGATIVE_SPACE_FACTOR = -0.2;
  22450. const SPACE_IN_FLOW_MIN_FACTOR = 0.1;
  22451. const SPACE_IN_FLOW_MAX_FACTOR = 0.6;
  22452. const self = this;
  22453. const xref = this.xref;
  22454. const showSpacedTextBuffer = [];
  22455. let xobjs = null;
  22456. const emptyXObjectCache = new _image_utils.LocalImageCache();
  22457. const emptyGStateCache = new _image_utils.LocalGStateCache();
  22458. const preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
  22459. let textState;
  22460. function getCurrentTextTransform() {
  22461. const font = textState.font;
  22462. const tsm = [textState.fontSize * textState.textHScale, 0, 0, textState.fontSize, 0, textState.textRise];
  22463. if (font.isType3Font && (textState.fontSize <= 1 || font.isCharBBox) && !(0, _util.isArrayEqual)(textState.fontMatrix, _util.FONT_IDENTITY_MATRIX)) {
  22464. const glyphHeight = font.bbox[3] - font.bbox[1];
  22465. if (glyphHeight > 0) {
  22466. tsm[3] *= glyphHeight * textState.fontMatrix[3];
  22467. }
  22468. }
  22469. return _util.Util.transform(textState.ctm, _util.Util.transform(textState.textMatrix, tsm));
  22470. }
  22471. function ensureTextContentItem() {
  22472. if (textContentItem.initialized) {
  22473. return textContentItem;
  22474. }
  22475. const font = textState.font,
  22476. loadedName = font.loadedName;
  22477. if (!seenStyles.has(loadedName)) {
  22478. seenStyles.add(loadedName);
  22479. textContent.styles[loadedName] = {
  22480. fontFamily: font.fallbackName,
  22481. ascent: font.ascent,
  22482. descent: font.descent,
  22483. vertical: font.vertical
  22484. };
  22485. }
  22486. textContentItem.fontName = loadedName;
  22487. const trm = textContentItem.transform = getCurrentTextTransform();
  22488. if (!font.vertical) {
  22489. textContentItem.width = textContentItem.totalWidth = 0;
  22490. textContentItem.height = textContentItem.totalHeight = Math.hypot(trm[2], trm[3]);
  22491. textContentItem.vertical = false;
  22492. } else {
  22493. textContentItem.width = textContentItem.totalWidth = Math.hypot(trm[0], trm[1]);
  22494. textContentItem.height = textContentItem.totalHeight = 0;
  22495. textContentItem.vertical = true;
  22496. }
  22497. const scaleLineX = Math.hypot(textState.textLineMatrix[0], textState.textLineMatrix[1]);
  22498. const scaleCtmX = Math.hypot(textState.ctm[0], textState.ctm[1]);
  22499. textContentItem.textAdvanceScale = scaleCtmX * scaleLineX;
  22500. textContentItem.trackingSpaceMin = textState.fontSize * TRACKING_SPACE_FACTOR;
  22501. textContentItem.notASpace = textState.fontSize * NOT_A_SPACE_FACTOR;
  22502. textContentItem.negativeSpaceMax = textState.fontSize * NEGATIVE_SPACE_FACTOR;
  22503. textContentItem.spaceInFlowMin = textState.fontSize * SPACE_IN_FLOW_MIN_FACTOR;
  22504. textContentItem.spaceInFlowMax = textState.fontSize * SPACE_IN_FLOW_MAX_FACTOR;
  22505. textContentItem.hasEOL = false;
  22506. textContentItem.initialized = true;
  22507. return textContentItem;
  22508. }
  22509. function updateAdvanceScale() {
  22510. if (!textContentItem.initialized) {
  22511. return;
  22512. }
  22513. const scaleLineX = Math.hypot(textState.textLineMatrix[0], textState.textLineMatrix[1]);
  22514. const scaleCtmX = Math.hypot(textState.ctm[0], textState.ctm[1]);
  22515. const scaleFactor = scaleCtmX * scaleLineX;
  22516. if (scaleFactor === textContentItem.textAdvanceScale) {
  22517. return;
  22518. }
  22519. if (!textContentItem.vertical) {
  22520. textContentItem.totalWidth += textContentItem.width * textContentItem.textAdvanceScale;
  22521. textContentItem.width = 0;
  22522. } else {
  22523. textContentItem.totalHeight += textContentItem.height * textContentItem.textAdvanceScale;
  22524. textContentItem.height = 0;
  22525. }
  22526. textContentItem.textAdvanceScale = scaleFactor;
  22527. }
  22528. function runBidiTransform(textChunk) {
  22529. const text = textChunk.str.join("");
  22530. const bidiResult = (0, _bidi.bidi)(text, -1, textChunk.vertical);
  22531. return {
  22532. str: bidiResult.str,
  22533. dir: bidiResult.dir,
  22534. width: Math.abs(textChunk.totalWidth),
  22535. height: Math.abs(textChunk.totalHeight),
  22536. transform: textChunk.transform,
  22537. fontName: textChunk.fontName,
  22538. hasEOL: textChunk.hasEOL
  22539. };
  22540. }
  22541. function handleSetFont(fontName, fontRef) {
  22542. return self.loadFont(fontName, fontRef, resources).then(function (translated) {
  22543. if (!translated.font.isType3Font) {
  22544. return translated;
  22545. }
  22546. return translated.loadType3Data(self, resources, task).catch(function () {}).then(function () {
  22547. return translated;
  22548. });
  22549. }).then(function (translated) {
  22550. textState.font = translated.font;
  22551. textState.fontMatrix = translated.font.fontMatrix || _util.FONT_IDENTITY_MATRIX;
  22552. });
  22553. }
  22554. function applyInverseRotation(x, y, matrix) {
  22555. const scale = Math.hypot(matrix[0], matrix[1]);
  22556. return [(matrix[0] * x + matrix[1] * y) / scale, (matrix[2] * x + matrix[3] * y) / scale];
  22557. }
  22558. function compareWithLastPosition() {
  22559. const currentTransform = getCurrentTextTransform();
  22560. let posX = currentTransform[4];
  22561. let posY = currentTransform[5];
  22562. const shiftedX = posX - viewBox[0];
  22563. const shiftedY = posY - viewBox[1];
  22564. if (shiftedX < 0 || shiftedX > viewBox[2] || shiftedY < 0 || shiftedY > viewBox[3]) {
  22565. return false;
  22566. }
  22567. if (!combineTextItems || !textState.font || !textContentItem.prevTransform) {
  22568. return true;
  22569. }
  22570. let lastPosX = textContentItem.prevTransform[4];
  22571. let lastPosY = textContentItem.prevTransform[5];
  22572. if (lastPosX === posX && lastPosY === posY) {
  22573. return true;
  22574. }
  22575. let rotate = -1;
  22576. if (currentTransform[0] && currentTransform[1] === 0 && currentTransform[2] === 0) {
  22577. rotate = currentTransform[0] > 0 ? 0 : 180;
  22578. } else if (currentTransform[1] && currentTransform[0] === 0 && currentTransform[3] === 0) {
  22579. rotate = currentTransform[1] > 0 ? 90 : 270;
  22580. }
  22581. switch (rotate) {
  22582. case 0:
  22583. break;
  22584. case 90:
  22585. [posX, posY] = [posY, posX];
  22586. [lastPosX, lastPosY] = [lastPosY, lastPosX];
  22587. break;
  22588. case 180:
  22589. [posX, posY, lastPosX, lastPosY] = [-posX, -posY, -lastPosX, -lastPosY];
  22590. break;
  22591. case 270:
  22592. [posX, posY] = [-posY, -posX];
  22593. [lastPosX, lastPosY] = [-lastPosY, -lastPosX];
  22594. break;
  22595. default:
  22596. [posX, posY] = applyInverseRotation(posX, posY, currentTransform);
  22597. [lastPosX, lastPosY] = applyInverseRotation(lastPosX, lastPosY, textContentItem.prevTransform);
  22598. }
  22599. if (textState.font.vertical) {
  22600. const advanceY = (lastPosY - posY) / textContentItem.textAdvanceScale;
  22601. const advanceX = posX - lastPosX;
  22602. const textOrientation = Math.sign(textContentItem.height);
  22603. if (advanceY < textOrientation * textContentItem.negativeSpaceMax) {
  22604. if (Math.abs(advanceX) > 0.5 * textContentItem.width) {
  22605. appendEOL();
  22606. return true;
  22607. }
  22608. resetLastChars();
  22609. flushTextContentItem();
  22610. return true;
  22611. }
  22612. if (Math.abs(advanceX) > textContentItem.width) {
  22613. appendEOL();
  22614. return true;
  22615. }
  22616. if (advanceY <= textOrientation * textContentItem.notASpace) {
  22617. resetLastChars();
  22618. }
  22619. if (advanceY <= textOrientation * textContentItem.trackingSpaceMin) {
  22620. textContentItem.height += advanceY;
  22621. } else if (!addFakeSpaces(advanceY, textContentItem.prevTransform, textOrientation)) {
  22622. if (textContentItem.str.length === 0) {
  22623. resetLastChars();
  22624. textContent.items.push({
  22625. str: " ",
  22626. dir: "ltr",
  22627. width: 0,
  22628. height: Math.abs(advanceY),
  22629. transform: textContentItem.prevTransform,
  22630. fontName: textContentItem.fontName,
  22631. hasEOL: false
  22632. });
  22633. } else {
  22634. textContentItem.height += advanceY;
  22635. }
  22636. }
  22637. return true;
  22638. }
  22639. const advanceX = (posX - lastPosX) / textContentItem.textAdvanceScale;
  22640. const advanceY = posY - lastPosY;
  22641. const textOrientation = Math.sign(textContentItem.width);
  22642. if (advanceX < textOrientation * textContentItem.negativeSpaceMax) {
  22643. if (Math.abs(advanceY) > 0.5 * textContentItem.height) {
  22644. appendEOL();
  22645. return true;
  22646. }
  22647. resetLastChars();
  22648. flushTextContentItem();
  22649. return true;
  22650. }
  22651. if (Math.abs(advanceY) > textContentItem.height) {
  22652. appendEOL();
  22653. return true;
  22654. }
  22655. if (advanceX <= textOrientation * textContentItem.notASpace) {
  22656. resetLastChars();
  22657. }
  22658. if (advanceX <= textOrientation * textContentItem.trackingSpaceMin) {
  22659. textContentItem.width += advanceX;
  22660. } else if (!addFakeSpaces(advanceX, textContentItem.prevTransform, textOrientation)) {
  22661. if (textContentItem.str.length === 0) {
  22662. resetLastChars();
  22663. textContent.items.push({
  22664. str: " ",
  22665. dir: "ltr",
  22666. width: Math.abs(advanceX),
  22667. height: 0,
  22668. transform: textContentItem.prevTransform,
  22669. fontName: textContentItem.fontName,
  22670. hasEOL: false
  22671. });
  22672. } else {
  22673. textContentItem.width += advanceX;
  22674. }
  22675. }
  22676. return true;
  22677. }
  22678. function buildTextContentItem({
  22679. chars,
  22680. extraSpacing
  22681. }) {
  22682. const font = textState.font;
  22683. if (!chars) {
  22684. const charSpacing = textState.charSpacing + extraSpacing;
  22685. if (charSpacing) {
  22686. if (!font.vertical) {
  22687. textState.translateTextMatrix(charSpacing * textState.textHScale, 0);
  22688. } else {
  22689. textState.translateTextMatrix(0, -charSpacing);
  22690. }
  22691. }
  22692. return;
  22693. }
  22694. const glyphs = font.charsToGlyphs(chars);
  22695. const scale = textState.fontMatrix[0] * textState.fontSize;
  22696. for (let i = 0, ii = glyphs.length; i < ii; i++) {
  22697. const glyph = glyphs[i];
  22698. if (glyph.isInvisibleFormatMark) {
  22699. continue;
  22700. }
  22701. let charSpacing = textState.charSpacing + (i + 1 === ii ? extraSpacing : 0);
  22702. let glyphWidth = glyph.width;
  22703. if (font.vertical) {
  22704. glyphWidth = glyph.vmetric ? glyph.vmetric[0] : -glyphWidth;
  22705. }
  22706. let scaledDim = glyphWidth * scale;
  22707. if (glyph.isWhitespace) {
  22708. if (!font.vertical) {
  22709. charSpacing += scaledDim + textState.wordSpacing;
  22710. textState.translateTextMatrix(charSpacing * textState.textHScale, 0);
  22711. } else {
  22712. charSpacing += -scaledDim + textState.wordSpacing;
  22713. textState.translateTextMatrix(0, -charSpacing);
  22714. }
  22715. saveLastChar(" ");
  22716. continue;
  22717. }
  22718. if (!compareWithLastPosition()) {
  22719. continue;
  22720. }
  22721. const textChunk = ensureTextContentItem();
  22722. if (glyph.isZeroWidthDiacritic) {
  22723. scaledDim = 0;
  22724. }
  22725. if (!font.vertical) {
  22726. scaledDim *= textState.textHScale;
  22727. textState.translateTextMatrix(scaledDim, 0);
  22728. textChunk.width += scaledDim;
  22729. } else {
  22730. textState.translateTextMatrix(0, scaledDim);
  22731. scaledDim = Math.abs(scaledDim);
  22732. textChunk.height += scaledDim;
  22733. }
  22734. if (scaledDim) {
  22735. textChunk.prevTransform = getCurrentTextTransform();
  22736. }
  22737. let glyphUnicode = glyph.unicode;
  22738. glyphUnicode = NormalizedUnicodes[glyphUnicode] || glyphUnicode;
  22739. glyphUnicode = (0, _unicode.reverseIfRtl)(glyphUnicode);
  22740. if (saveLastChar(glyphUnicode)) {
  22741. textChunk.str.push(" ");
  22742. }
  22743. textChunk.str.push(glyphUnicode);
  22744. if (charSpacing) {
  22745. if (!font.vertical) {
  22746. textState.translateTextMatrix(charSpacing * textState.textHScale, 0);
  22747. } else {
  22748. textState.translateTextMatrix(0, -charSpacing);
  22749. }
  22750. }
  22751. }
  22752. }
  22753. function appendEOL() {
  22754. resetLastChars();
  22755. if (textContentItem.initialized) {
  22756. textContentItem.hasEOL = true;
  22757. flushTextContentItem();
  22758. } else {
  22759. textContent.items.push({
  22760. str: "",
  22761. dir: "ltr",
  22762. width: 0,
  22763. height: 0,
  22764. transform: getCurrentTextTransform(),
  22765. fontName: textState.font.loadedName,
  22766. hasEOL: true
  22767. });
  22768. }
  22769. }
  22770. function addFakeSpaces(width, transf, textOrientation) {
  22771. if (textOrientation * textContentItem.spaceInFlowMin <= width && width <= textOrientation * textContentItem.spaceInFlowMax) {
  22772. if (textContentItem.initialized) {
  22773. resetLastChars();
  22774. textContentItem.str.push(" ");
  22775. }
  22776. return false;
  22777. }
  22778. const fontName = textContentItem.fontName;
  22779. let height = 0;
  22780. if (textContentItem.vertical) {
  22781. height = width;
  22782. width = 0;
  22783. }
  22784. flushTextContentItem();
  22785. resetLastChars();
  22786. textContent.items.push({
  22787. str: " ",
  22788. dir: "ltr",
  22789. width: Math.abs(width),
  22790. height: Math.abs(height),
  22791. transform: transf || getCurrentTextTransform(),
  22792. fontName,
  22793. hasEOL: false
  22794. });
  22795. return true;
  22796. }
  22797. function flushTextContentItem() {
  22798. if (!textContentItem.initialized || !textContentItem.str) {
  22799. return;
  22800. }
  22801. if (!textContentItem.vertical) {
  22802. textContentItem.totalWidth += textContentItem.width * textContentItem.textAdvanceScale;
  22803. } else {
  22804. textContentItem.totalHeight += textContentItem.height * textContentItem.textAdvanceScale;
  22805. }
  22806. textContent.items.push(runBidiTransform(textContentItem));
  22807. textContentItem.initialized = false;
  22808. textContentItem.str.length = 0;
  22809. }
  22810. function enqueueChunk(batch = false) {
  22811. const length = textContent.items.length;
  22812. if (length === 0) {
  22813. return;
  22814. }
  22815. if (batch && length < TEXT_CHUNK_BATCH_SIZE) {
  22816. return;
  22817. }
  22818. sink.enqueue(textContent, length);
  22819. textContent.items = [];
  22820. textContent.styles = Object.create(null);
  22821. }
  22822. const timeSlotManager = new TimeSlotManager();
  22823. return new Promise(function promiseBody(resolve, reject) {
  22824. const next = function (promise) {
  22825. enqueueChunk(true);
  22826. Promise.all([promise, sink.ready]).then(function () {
  22827. try {
  22828. promiseBody(resolve, reject);
  22829. } catch (ex) {
  22830. reject(ex);
  22831. }
  22832. }, reject);
  22833. };
  22834. task.ensureNotTerminated();
  22835. timeSlotManager.reset();
  22836. const operation = {};
  22837. let stop,
  22838. args = [];
  22839. while (!(stop = timeSlotManager.check())) {
  22840. args.length = 0;
  22841. operation.args = args;
  22842. if (!preprocessor.read(operation)) {
  22843. break;
  22844. }
  22845. textState = stateManager.state;
  22846. const fn = operation.fn;
  22847. args = operation.args;
  22848. switch (fn | 0) {
  22849. case _util.OPS.setFont:
  22850. var fontNameArg = args[0].name,
  22851. fontSizeArg = args[1];
  22852. if (textState.font && fontNameArg === textState.fontName && fontSizeArg === textState.fontSize) {
  22853. break;
  22854. }
  22855. flushTextContentItem();
  22856. textState.fontName = fontNameArg;
  22857. textState.fontSize = fontSizeArg;
  22858. next(handleSetFont(fontNameArg, null));
  22859. return;
  22860. case _util.OPS.setTextRise:
  22861. textState.textRise = args[0];
  22862. break;
  22863. case _util.OPS.setHScale:
  22864. textState.textHScale = args[0] / 100;
  22865. break;
  22866. case _util.OPS.setLeading:
  22867. textState.leading = args[0];
  22868. break;
  22869. case _util.OPS.moveText:
  22870. textState.translateTextLineMatrix(args[0], args[1]);
  22871. textState.textMatrix = textState.textLineMatrix.slice();
  22872. break;
  22873. case _util.OPS.setLeadingMoveText:
  22874. textState.leading = -args[1];
  22875. textState.translateTextLineMatrix(args[0], args[1]);
  22876. textState.textMatrix = textState.textLineMatrix.slice();
  22877. break;
  22878. case _util.OPS.nextLine:
  22879. textState.carriageReturn();
  22880. break;
  22881. case _util.OPS.setTextMatrix:
  22882. textState.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
  22883. textState.setTextLineMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
  22884. updateAdvanceScale();
  22885. break;
  22886. case _util.OPS.setCharSpacing:
  22887. textState.charSpacing = args[0];
  22888. break;
  22889. case _util.OPS.setWordSpacing:
  22890. textState.wordSpacing = args[0];
  22891. break;
  22892. case _util.OPS.beginText:
  22893. textState.textMatrix = _util.IDENTITY_MATRIX.slice();
  22894. textState.textLineMatrix = _util.IDENTITY_MATRIX.slice();
  22895. break;
  22896. case _util.OPS.showSpacedText:
  22897. if (!stateManager.state.font) {
  22898. self.ensureStateFont(stateManager.state);
  22899. continue;
  22900. }
  22901. const spaceFactor = (textState.font.vertical ? 1 : -1) * textState.fontSize / 1000;
  22902. const elements = args[0];
  22903. for (let i = 0, ii = elements.length; i < ii - 1; i++) {
  22904. const item = elements[i];
  22905. if (typeof item === "string") {
  22906. showSpacedTextBuffer.push(item);
  22907. } else if (typeof item === "number" && item !== 0) {
  22908. const str = showSpacedTextBuffer.join("");
  22909. showSpacedTextBuffer.length = 0;
  22910. buildTextContentItem({
  22911. chars: str,
  22912. extraSpacing: item * spaceFactor
  22913. });
  22914. }
  22915. }
  22916. const item = elements.at(-1);
  22917. if (typeof item === "string") {
  22918. showSpacedTextBuffer.push(item);
  22919. }
  22920. if (showSpacedTextBuffer.length > 0) {
  22921. const str = showSpacedTextBuffer.join("");
  22922. showSpacedTextBuffer.length = 0;
  22923. buildTextContentItem({
  22924. chars: str,
  22925. extraSpacing: 0
  22926. });
  22927. }
  22928. break;
  22929. case _util.OPS.showText:
  22930. if (!stateManager.state.font) {
  22931. self.ensureStateFont(stateManager.state);
  22932. continue;
  22933. }
  22934. buildTextContentItem({
  22935. chars: args[0],
  22936. extraSpacing: 0
  22937. });
  22938. break;
  22939. case _util.OPS.nextLineShowText:
  22940. if (!stateManager.state.font) {
  22941. self.ensureStateFont(stateManager.state);
  22942. continue;
  22943. }
  22944. textState.carriageReturn();
  22945. buildTextContentItem({
  22946. chars: args[0],
  22947. extraSpacing: 0
  22948. });
  22949. break;
  22950. case _util.OPS.nextLineSetSpacingShowText:
  22951. if (!stateManager.state.font) {
  22952. self.ensureStateFont(stateManager.state);
  22953. continue;
  22954. }
  22955. textState.wordSpacing = args[0];
  22956. textState.charSpacing = args[1];
  22957. textState.carriageReturn();
  22958. buildTextContentItem({
  22959. chars: args[2],
  22960. extraSpacing: 0
  22961. });
  22962. break;
  22963. case _util.OPS.paintXObject:
  22964. flushTextContentItem();
  22965. if (!xobjs) {
  22966. xobjs = resources.get("XObject") || _primitives.Dict.empty;
  22967. }
  22968. var isValidName = args[0] instanceof _primitives.Name;
  22969. var name = args[0].name;
  22970. if (isValidName && emptyXObjectCache.getByName(name)) {
  22971. break;
  22972. }
  22973. next(new Promise(function (resolveXObject, rejectXObject) {
  22974. if (!isValidName) {
  22975. throw new _util.FormatError("XObject must be referred to by name.");
  22976. }
  22977. let xobj = xobjs.getRaw(name);
  22978. if (xobj instanceof _primitives.Ref) {
  22979. if (emptyXObjectCache.getByRef(xobj)) {
  22980. resolveXObject();
  22981. return;
  22982. }
  22983. const globalImage = self.globalImageCache.getData(xobj, self.pageIndex);
  22984. if (globalImage) {
  22985. resolveXObject();
  22986. return;
  22987. }
  22988. xobj = xref.fetch(xobj);
  22989. }
  22990. if (!(xobj instanceof _base_stream.BaseStream)) {
  22991. throw new _util.FormatError("XObject should be a stream");
  22992. }
  22993. const type = xobj.dict.get("Subtype");
  22994. if (!(type instanceof _primitives.Name)) {
  22995. throw new _util.FormatError("XObject should have a Name subtype");
  22996. }
  22997. if (type.name !== "Form") {
  22998. emptyXObjectCache.set(name, xobj.dict.objId, true);
  22999. resolveXObject();
  23000. return;
  23001. }
  23002. const currentState = stateManager.state.clone();
  23003. const xObjStateManager = new StateManager(currentState);
  23004. const matrix = xobj.dict.getArray("Matrix");
  23005. if (Array.isArray(matrix) && matrix.length === 6) {
  23006. xObjStateManager.transform(matrix);
  23007. }
  23008. enqueueChunk();
  23009. const sinkWrapper = {
  23010. enqueueInvoked: false,
  23011. enqueue(chunk, size) {
  23012. this.enqueueInvoked = true;
  23013. sink.enqueue(chunk, size);
  23014. },
  23015. get desiredSize() {
  23016. return sink.desiredSize;
  23017. },
  23018. get ready() {
  23019. return sink.ready;
  23020. }
  23021. };
  23022. self.getTextContent({
  23023. stream: xobj,
  23024. task,
  23025. resources: xobj.dict.get("Resources") || resources,
  23026. stateManager: xObjStateManager,
  23027. combineTextItems,
  23028. includeMarkedContent,
  23029. sink: sinkWrapper,
  23030. seenStyles,
  23031. viewBox
  23032. }).then(function () {
  23033. if (!sinkWrapper.enqueueInvoked) {
  23034. emptyXObjectCache.set(name, xobj.dict.objId, true);
  23035. }
  23036. resolveXObject();
  23037. }, rejectXObject);
  23038. }).catch(function (reason) {
  23039. if (reason instanceof _util.AbortException) {
  23040. return;
  23041. }
  23042. if (self.options.ignoreErrors) {
  23043. (0, _util.warn)(`getTextContent - ignoring XObject: "${reason}".`);
  23044. return;
  23045. }
  23046. throw reason;
  23047. }));
  23048. return;
  23049. case _util.OPS.setGState:
  23050. isValidName = args[0] instanceof _primitives.Name;
  23051. name = args[0].name;
  23052. if (isValidName && emptyGStateCache.getByName(name)) {
  23053. break;
  23054. }
  23055. next(new Promise(function (resolveGState, rejectGState) {
  23056. if (!isValidName) {
  23057. throw new _util.FormatError("GState must be referred to by name.");
  23058. }
  23059. const extGState = resources.get("ExtGState");
  23060. if (!(extGState instanceof _primitives.Dict)) {
  23061. throw new _util.FormatError("ExtGState should be a dictionary.");
  23062. }
  23063. const gState = extGState.get(name);
  23064. if (!(gState instanceof _primitives.Dict)) {
  23065. throw new _util.FormatError("GState should be a dictionary.");
  23066. }
  23067. const gStateFont = gState.get("Font");
  23068. if (!gStateFont) {
  23069. emptyGStateCache.set(name, gState.objId, true);
  23070. resolveGState();
  23071. return;
  23072. }
  23073. flushTextContentItem();
  23074. textState.fontName = null;
  23075. textState.fontSize = gStateFont[1];
  23076. handleSetFont(null, gStateFont[0]).then(resolveGState, rejectGState);
  23077. }).catch(function (reason) {
  23078. if (reason instanceof _util.AbortException) {
  23079. return;
  23080. }
  23081. if (self.options.ignoreErrors) {
  23082. (0, _util.warn)(`getTextContent - ignoring ExtGState: "${reason}".`);
  23083. return;
  23084. }
  23085. throw reason;
  23086. }));
  23087. return;
  23088. case _util.OPS.beginMarkedContent:
  23089. flushTextContentItem();
  23090. if (includeMarkedContent) {
  23091. textContent.items.push({
  23092. type: "beginMarkedContent",
  23093. tag: args[0] instanceof _primitives.Name ? args[0].name : null
  23094. });
  23095. }
  23096. break;
  23097. case _util.OPS.beginMarkedContentProps:
  23098. flushTextContentItem();
  23099. if (includeMarkedContent) {
  23100. let mcid = null;
  23101. if (args[1] instanceof _primitives.Dict) {
  23102. mcid = args[1].get("MCID");
  23103. }
  23104. textContent.items.push({
  23105. type: "beginMarkedContentProps",
  23106. id: Number.isInteger(mcid) ? `${self.idFactory.getPageObjId()}_mcid${mcid}` : null,
  23107. tag: args[0] instanceof _primitives.Name ? args[0].name : null
  23108. });
  23109. }
  23110. break;
  23111. case _util.OPS.endMarkedContent:
  23112. flushTextContentItem();
  23113. if (includeMarkedContent) {
  23114. textContent.items.push({
  23115. type: "endMarkedContent"
  23116. });
  23117. }
  23118. break;
  23119. }
  23120. if (textContent.items.length >= sink.desiredSize) {
  23121. stop = true;
  23122. break;
  23123. }
  23124. }
  23125. if (stop) {
  23126. next(deferred);
  23127. return;
  23128. }
  23129. flushTextContentItem();
  23130. enqueueChunk();
  23131. resolve();
  23132. }).catch(reason => {
  23133. if (reason instanceof _util.AbortException) {
  23134. return;
  23135. }
  23136. if (this.options.ignoreErrors) {
  23137. (0, _util.warn)(`getTextContent - ignoring errors during "${task.name}" ` + `task: "${reason}".`);
  23138. flushTextContentItem();
  23139. enqueueChunk();
  23140. return;
  23141. }
  23142. throw reason;
  23143. });
  23144. }
  23145. extractDataStructures(dict, baseDict, properties) {
  23146. const xref = this.xref;
  23147. let cidToGidBytes;
  23148. const toUnicodePromise = this.readToUnicode(properties.toUnicode || dict.get("ToUnicode") || baseDict.get("ToUnicode"));
  23149. if (properties.composite) {
  23150. const cidSystemInfo = dict.get("CIDSystemInfo");
  23151. if (cidSystemInfo instanceof _primitives.Dict) {
  23152. properties.cidSystemInfo = {
  23153. registry: (0, _util.stringToPDFString)(cidSystemInfo.get("Registry")),
  23154. ordering: (0, _util.stringToPDFString)(cidSystemInfo.get("Ordering")),
  23155. supplement: cidSystemInfo.get("Supplement")
  23156. };
  23157. }
  23158. try {
  23159. const cidToGidMap = dict.get("CIDToGIDMap");
  23160. if (cidToGidMap instanceof _base_stream.BaseStream) {
  23161. cidToGidBytes = cidToGidMap.getBytes();
  23162. }
  23163. } catch (ex) {
  23164. if (!this.options.ignoreErrors) {
  23165. throw ex;
  23166. }
  23167. (0, _util.warn)(`extractDataStructures - ignoring CIDToGIDMap data: "${ex}".`);
  23168. }
  23169. }
  23170. const differences = [];
  23171. let baseEncodingName = null;
  23172. let encoding;
  23173. if (dict.has("Encoding")) {
  23174. encoding = dict.get("Encoding");
  23175. if (encoding instanceof _primitives.Dict) {
  23176. baseEncodingName = encoding.get("BaseEncoding");
  23177. baseEncodingName = baseEncodingName instanceof _primitives.Name ? baseEncodingName.name : null;
  23178. if (encoding.has("Differences")) {
  23179. const diffEncoding = encoding.get("Differences");
  23180. let index = 0;
  23181. for (let j = 0, jj = diffEncoding.length; j < jj; j++) {
  23182. const data = xref.fetchIfRef(diffEncoding[j]);
  23183. if (typeof data === "number") {
  23184. index = data;
  23185. } else if (data instanceof _primitives.Name) {
  23186. differences[index++] = data.name;
  23187. } else {
  23188. throw new _util.FormatError(`Invalid entry in 'Differences' array: ${data}`);
  23189. }
  23190. }
  23191. }
  23192. } else if (encoding instanceof _primitives.Name) {
  23193. baseEncodingName = encoding.name;
  23194. } else {
  23195. const msg = "Encoding is not a Name nor a Dict";
  23196. if (!this.options.ignoreErrors) {
  23197. throw new _util.FormatError(msg);
  23198. }
  23199. (0, _util.warn)(msg);
  23200. }
  23201. if (baseEncodingName !== "MacRomanEncoding" && baseEncodingName !== "MacExpertEncoding" && baseEncodingName !== "WinAnsiEncoding") {
  23202. baseEncodingName = null;
  23203. }
  23204. }
  23205. if (baseEncodingName) {
  23206. properties.defaultEncoding = (0, _encodings.getEncoding)(baseEncodingName);
  23207. } else {
  23208. const isSymbolicFont = !!(properties.flags & _fonts_utils.FontFlags.Symbolic);
  23209. const isNonsymbolicFont = !!(properties.flags & _fonts_utils.FontFlags.Nonsymbolic);
  23210. encoding = _encodings.StandardEncoding;
  23211. if (properties.type === "TrueType" && !isNonsymbolicFont) {
  23212. encoding = _encodings.WinAnsiEncoding;
  23213. }
  23214. if (isSymbolicFont) {
  23215. encoding = _encodings.MacRomanEncoding;
  23216. if (!properties.file || properties.isInternalFont) {
  23217. if (/Symbol/i.test(properties.name)) {
  23218. encoding = _encodings.SymbolSetEncoding;
  23219. } else if (/Dingbats|Wingdings/i.test(properties.name)) {
  23220. encoding = _encodings.ZapfDingbatsEncoding;
  23221. }
  23222. }
  23223. }
  23224. properties.defaultEncoding = encoding;
  23225. }
  23226. properties.differences = differences;
  23227. properties.baseEncodingName = baseEncodingName;
  23228. properties.hasEncoding = !!baseEncodingName || differences.length > 0;
  23229. properties.dict = dict;
  23230. return toUnicodePromise.then(readToUnicode => {
  23231. properties.toUnicode = readToUnicode;
  23232. return this.buildToUnicode(properties);
  23233. }).then(builtToUnicode => {
  23234. properties.toUnicode = builtToUnicode;
  23235. if (cidToGidBytes) {
  23236. properties.cidToGidMap = this.readCidToGidMap(cidToGidBytes, builtToUnicode);
  23237. }
  23238. return properties;
  23239. });
  23240. }
  23241. _simpleFontToUnicode(properties, forceGlyphs = false) {
  23242. (0, _util.assert)(!properties.composite, "Must be a simple font.");
  23243. const toUnicode = [];
  23244. const encoding = properties.defaultEncoding.slice();
  23245. const baseEncodingName = properties.baseEncodingName;
  23246. const differences = properties.differences;
  23247. for (const charcode in differences) {
  23248. const glyphName = differences[charcode];
  23249. if (glyphName === ".notdef") {
  23250. continue;
  23251. }
  23252. encoding[charcode] = glyphName;
  23253. }
  23254. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  23255. for (const charcode in encoding) {
  23256. let glyphName = encoding[charcode];
  23257. if (glyphName === "") {
  23258. continue;
  23259. } else if (glyphsUnicodeMap[glyphName] === undefined) {
  23260. let code = 0;
  23261. switch (glyphName[0]) {
  23262. case "G":
  23263. if (glyphName.length === 3) {
  23264. code = parseInt(glyphName.substring(1), 16);
  23265. }
  23266. break;
  23267. case "g":
  23268. if (glyphName.length === 5) {
  23269. code = parseInt(glyphName.substring(1), 16);
  23270. }
  23271. break;
  23272. case "C":
  23273. case "c":
  23274. if (glyphName.length >= 3 && glyphName.length <= 4) {
  23275. const codeStr = glyphName.substring(1);
  23276. if (forceGlyphs) {
  23277. code = parseInt(codeStr, 16);
  23278. break;
  23279. }
  23280. code = +codeStr;
  23281. if (Number.isNaN(code) && Number.isInteger(parseInt(codeStr, 16))) {
  23282. return this._simpleFontToUnicode(properties, true);
  23283. }
  23284. }
  23285. break;
  23286. default:
  23287. const unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
  23288. if (unicode !== -1) {
  23289. code = unicode;
  23290. }
  23291. }
  23292. if (code > 0 && code <= 0x10ffff && Number.isInteger(code)) {
  23293. if (baseEncodingName && code === +charcode) {
  23294. const baseEncoding = (0, _encodings.getEncoding)(baseEncodingName);
  23295. if (baseEncoding && (glyphName = baseEncoding[charcode])) {
  23296. toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]);
  23297. continue;
  23298. }
  23299. }
  23300. toUnicode[charcode] = String.fromCodePoint(code);
  23301. }
  23302. continue;
  23303. }
  23304. toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]);
  23305. }
  23306. return toUnicode;
  23307. }
  23308. async buildToUnicode(properties) {
  23309. properties.hasIncludedToUnicodeMap = !!properties.toUnicode && properties.toUnicode.length > 0;
  23310. if (properties.hasIncludedToUnicodeMap) {
  23311. if (!properties.composite && properties.hasEncoding) {
  23312. properties.fallbackToUnicode = this._simpleFontToUnicode(properties);
  23313. }
  23314. return properties.toUnicode;
  23315. }
  23316. if (!properties.composite) {
  23317. return new _to_unicode_map.ToUnicodeMap(this._simpleFontToUnicode(properties));
  23318. }
  23319. 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"))) {
  23320. const {
  23321. registry,
  23322. ordering
  23323. } = properties.cidSystemInfo;
  23324. const ucs2CMapName = _primitives.Name.get(`${registry}-${ordering}-UCS2`);
  23325. const ucs2CMap = await _cmap.CMapFactory.create({
  23326. encoding: ucs2CMapName,
  23327. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  23328. useCMap: null
  23329. });
  23330. const toUnicode = [];
  23331. properties.cMap.forEach(function (charcode, cid) {
  23332. if (cid > 0xffff) {
  23333. throw new _util.FormatError("Max size of CID is 65,535");
  23334. }
  23335. const ucs2 = ucs2CMap.lookup(cid);
  23336. if (ucs2) {
  23337. toUnicode[charcode] = String.fromCharCode((ucs2.charCodeAt(0) << 8) + ucs2.charCodeAt(1));
  23338. }
  23339. });
  23340. return new _to_unicode_map.ToUnicodeMap(toUnicode);
  23341. }
  23342. return new _to_unicode_map.IdentityToUnicodeMap(properties.firstChar, properties.lastChar);
  23343. }
  23344. readToUnicode(cmapObj) {
  23345. if (!cmapObj) {
  23346. return Promise.resolve(null);
  23347. }
  23348. if (cmapObj instanceof _primitives.Name) {
  23349. return _cmap.CMapFactory.create({
  23350. encoding: cmapObj,
  23351. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  23352. useCMap: null
  23353. }).then(function (cmap) {
  23354. if (cmap instanceof _cmap.IdentityCMap) {
  23355. return new _to_unicode_map.IdentityToUnicodeMap(0, 0xffff);
  23356. }
  23357. return new _to_unicode_map.ToUnicodeMap(cmap.getMap());
  23358. });
  23359. } else if (cmapObj instanceof _base_stream.BaseStream) {
  23360. return _cmap.CMapFactory.create({
  23361. encoding: cmapObj,
  23362. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  23363. useCMap: null
  23364. }).then(function (cmap) {
  23365. if (cmap instanceof _cmap.IdentityCMap) {
  23366. return new _to_unicode_map.IdentityToUnicodeMap(0, 0xffff);
  23367. }
  23368. const map = new Array(cmap.length);
  23369. cmap.forEach(function (charCode, token) {
  23370. if (typeof token === "number") {
  23371. map[charCode] = String.fromCodePoint(token);
  23372. return;
  23373. }
  23374. const str = [];
  23375. for (let k = 0; k < token.length; k += 2) {
  23376. const w1 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
  23377. if ((w1 & 0xf800) !== 0xd800) {
  23378. str.push(w1);
  23379. continue;
  23380. }
  23381. k += 2;
  23382. const w2 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
  23383. str.push(((w1 & 0x3ff) << 10) + (w2 & 0x3ff) + 0x10000);
  23384. }
  23385. map[charCode] = String.fromCodePoint.apply(String, str);
  23386. });
  23387. return new _to_unicode_map.ToUnicodeMap(map);
  23388. }, reason => {
  23389. if (reason instanceof _util.AbortException) {
  23390. return null;
  23391. }
  23392. if (this.options.ignoreErrors) {
  23393. this.handler.send("UnsupportedFeature", {
  23394. featureId: _util.UNSUPPORTED_FEATURES.errorFontToUnicode
  23395. });
  23396. (0, _util.warn)(`readToUnicode - ignoring ToUnicode data: "${reason}".`);
  23397. return null;
  23398. }
  23399. throw reason;
  23400. });
  23401. }
  23402. return Promise.resolve(null);
  23403. }
  23404. readCidToGidMap(glyphsData, toUnicode) {
  23405. const result = [];
  23406. for (let j = 0, jj = glyphsData.length; j < jj; j++) {
  23407. const glyphID = glyphsData[j++] << 8 | glyphsData[j];
  23408. const code = j >> 1;
  23409. if (glyphID === 0 && !toUnicode.has(code)) {
  23410. continue;
  23411. }
  23412. result[code] = glyphID;
  23413. }
  23414. return result;
  23415. }
  23416. extractWidths(dict, descriptor, properties) {
  23417. const xref = this.xref;
  23418. let glyphsWidths = [];
  23419. let defaultWidth = 0;
  23420. const glyphsVMetrics = [];
  23421. let defaultVMetrics;
  23422. let i, ii, j, jj, start, code, widths;
  23423. if (properties.composite) {
  23424. defaultWidth = dict.has("DW") ? dict.get("DW") : 1000;
  23425. widths = dict.get("W");
  23426. if (widths) {
  23427. for (i = 0, ii = widths.length; i < ii; i++) {
  23428. start = xref.fetchIfRef(widths[i++]);
  23429. code = xref.fetchIfRef(widths[i]);
  23430. if (Array.isArray(code)) {
  23431. for (j = 0, jj = code.length; j < jj; j++) {
  23432. glyphsWidths[start++] = xref.fetchIfRef(code[j]);
  23433. }
  23434. } else {
  23435. const width = xref.fetchIfRef(widths[++i]);
  23436. for (j = start; j <= code; j++) {
  23437. glyphsWidths[j] = width;
  23438. }
  23439. }
  23440. }
  23441. }
  23442. if (properties.vertical) {
  23443. let vmetrics = dict.getArray("DW2") || [880, -1000];
  23444. defaultVMetrics = [vmetrics[1], defaultWidth * 0.5, vmetrics[0]];
  23445. vmetrics = dict.get("W2");
  23446. if (vmetrics) {
  23447. for (i = 0, ii = vmetrics.length; i < ii; i++) {
  23448. start = xref.fetchIfRef(vmetrics[i++]);
  23449. code = xref.fetchIfRef(vmetrics[i]);
  23450. if (Array.isArray(code)) {
  23451. for (j = 0, jj = code.length; j < jj; j++) {
  23452. glyphsVMetrics[start++] = [xref.fetchIfRef(code[j++]), xref.fetchIfRef(code[j++]), xref.fetchIfRef(code[j])];
  23453. }
  23454. } else {
  23455. const vmetric = [xref.fetchIfRef(vmetrics[++i]), xref.fetchIfRef(vmetrics[++i]), xref.fetchIfRef(vmetrics[++i])];
  23456. for (j = start; j <= code; j++) {
  23457. glyphsVMetrics[j] = vmetric;
  23458. }
  23459. }
  23460. }
  23461. }
  23462. }
  23463. } else {
  23464. const firstChar = properties.firstChar;
  23465. widths = dict.get("Widths");
  23466. if (widths) {
  23467. j = firstChar;
  23468. for (i = 0, ii = widths.length; i < ii; i++) {
  23469. glyphsWidths[j++] = xref.fetchIfRef(widths[i]);
  23470. }
  23471. defaultWidth = parseFloat(descriptor.get("MissingWidth")) || 0;
  23472. } else {
  23473. const baseFontName = dict.get("BaseFont");
  23474. if (baseFontName instanceof _primitives.Name) {
  23475. const metrics = this.getBaseFontMetrics(baseFontName.name);
  23476. glyphsWidths = this.buildCharCodeToWidth(metrics.widths, properties);
  23477. defaultWidth = metrics.defaultWidth;
  23478. }
  23479. }
  23480. }
  23481. let isMonospace = true;
  23482. let firstWidth = defaultWidth;
  23483. for (const glyph in glyphsWidths) {
  23484. const glyphWidth = glyphsWidths[glyph];
  23485. if (!glyphWidth) {
  23486. continue;
  23487. }
  23488. if (!firstWidth) {
  23489. firstWidth = glyphWidth;
  23490. continue;
  23491. }
  23492. if (firstWidth !== glyphWidth) {
  23493. isMonospace = false;
  23494. break;
  23495. }
  23496. }
  23497. if (isMonospace) {
  23498. properties.flags |= _fonts_utils.FontFlags.FixedPitch;
  23499. }
  23500. properties.defaultWidth = defaultWidth;
  23501. properties.widths = glyphsWidths;
  23502. properties.defaultVMetrics = defaultVMetrics;
  23503. properties.vmetrics = glyphsVMetrics;
  23504. }
  23505. isSerifFont(baseFontName) {
  23506. const fontNameWoStyle = baseFontName.split("-")[0];
  23507. return fontNameWoStyle in (0, _standard_fonts.getSerifFonts)() || fontNameWoStyle.search(/serif/gi) !== -1;
  23508. }
  23509. getBaseFontMetrics(name) {
  23510. let defaultWidth = 0;
  23511. let widths = Object.create(null);
  23512. let monospace = false;
  23513. const stdFontMap = (0, _standard_fonts.getStdFontMap)();
  23514. let lookupName = stdFontMap[name] || name;
  23515. const Metrics = (0, _metrics.getMetrics)();
  23516. if (!(lookupName in Metrics)) {
  23517. if (this.isSerifFont(name)) {
  23518. lookupName = "Times-Roman";
  23519. } else {
  23520. lookupName = "Helvetica";
  23521. }
  23522. }
  23523. const glyphWidths = Metrics[lookupName];
  23524. if (typeof glyphWidths === "number") {
  23525. defaultWidth = glyphWidths;
  23526. monospace = true;
  23527. } else {
  23528. widths = glyphWidths();
  23529. }
  23530. return {
  23531. defaultWidth,
  23532. monospace,
  23533. widths
  23534. };
  23535. }
  23536. buildCharCodeToWidth(widthsByGlyphName, properties) {
  23537. const widths = Object.create(null);
  23538. const differences = properties.differences;
  23539. const encoding = properties.defaultEncoding;
  23540. for (let charCode = 0; charCode < 256; charCode++) {
  23541. if (charCode in differences && widthsByGlyphName[differences[charCode]]) {
  23542. widths[charCode] = widthsByGlyphName[differences[charCode]];
  23543. continue;
  23544. }
  23545. if (charCode in encoding && widthsByGlyphName[encoding[charCode]]) {
  23546. widths[charCode] = widthsByGlyphName[encoding[charCode]];
  23547. continue;
  23548. }
  23549. }
  23550. return widths;
  23551. }
  23552. preEvaluateFont(dict) {
  23553. const baseDict = dict;
  23554. let type = dict.get("Subtype");
  23555. if (!(type instanceof _primitives.Name)) {
  23556. throw new _util.FormatError("invalid font Subtype");
  23557. }
  23558. let composite = false;
  23559. let hash, toUnicode;
  23560. if (type.name === "Type0") {
  23561. const df = dict.get("DescendantFonts");
  23562. if (!df) {
  23563. throw new _util.FormatError("Descendant fonts are not specified");
  23564. }
  23565. dict = Array.isArray(df) ? this.xref.fetchIfRef(df[0]) : df;
  23566. if (!(dict instanceof _primitives.Dict)) {
  23567. throw new _util.FormatError("Descendant font is not a dictionary.");
  23568. }
  23569. type = dict.get("Subtype");
  23570. if (!(type instanceof _primitives.Name)) {
  23571. throw new _util.FormatError("invalid font Subtype");
  23572. }
  23573. composite = true;
  23574. }
  23575. const firstChar = dict.get("FirstChar") || 0,
  23576. lastChar = dict.get("LastChar") || (composite ? 0xffff : 0xff);
  23577. const descriptor = dict.get("FontDescriptor");
  23578. if (descriptor) {
  23579. hash = new _murmurhash.MurmurHash3_64();
  23580. const encoding = baseDict.getRaw("Encoding");
  23581. if (encoding instanceof _primitives.Name) {
  23582. hash.update(encoding.name);
  23583. } else if (encoding instanceof _primitives.Ref) {
  23584. hash.update(encoding.toString());
  23585. } else if (encoding instanceof _primitives.Dict) {
  23586. for (const entry of encoding.getRawValues()) {
  23587. if (entry instanceof _primitives.Name) {
  23588. hash.update(entry.name);
  23589. } else if (entry instanceof _primitives.Ref) {
  23590. hash.update(entry.toString());
  23591. } else if (Array.isArray(entry)) {
  23592. const diffLength = entry.length,
  23593. diffBuf = new Array(diffLength);
  23594. for (let j = 0; j < diffLength; j++) {
  23595. const diffEntry = entry[j];
  23596. if (diffEntry instanceof _primitives.Name) {
  23597. diffBuf[j] = diffEntry.name;
  23598. } else if (typeof diffEntry === "number" || diffEntry instanceof _primitives.Ref) {
  23599. diffBuf[j] = diffEntry.toString();
  23600. }
  23601. }
  23602. hash.update(diffBuf.join());
  23603. }
  23604. }
  23605. }
  23606. hash.update(`${firstChar}-${lastChar}`);
  23607. toUnicode = dict.get("ToUnicode") || baseDict.get("ToUnicode");
  23608. if (toUnicode instanceof _base_stream.BaseStream) {
  23609. const stream = toUnicode.str || toUnicode;
  23610. const uint8array = stream.buffer ? new Uint8Array(stream.buffer.buffer, 0, stream.bufferLength) : new Uint8Array(stream.bytes.buffer, stream.start, stream.end - stream.start);
  23611. hash.update(uint8array);
  23612. } else if (toUnicode instanceof _primitives.Name) {
  23613. hash.update(toUnicode.name);
  23614. }
  23615. const widths = dict.get("Widths") || baseDict.get("Widths");
  23616. if (Array.isArray(widths)) {
  23617. const widthsBuf = [];
  23618. for (const entry of widths) {
  23619. if (typeof entry === "number" || entry instanceof _primitives.Ref) {
  23620. widthsBuf.push(entry.toString());
  23621. }
  23622. }
  23623. hash.update(widthsBuf.join());
  23624. }
  23625. if (composite) {
  23626. hash.update("compositeFont");
  23627. const compositeWidths = dict.get("W") || baseDict.get("W");
  23628. if (Array.isArray(compositeWidths)) {
  23629. const widthsBuf = [];
  23630. for (const entry of compositeWidths) {
  23631. if (typeof entry === "number" || entry instanceof _primitives.Ref) {
  23632. widthsBuf.push(entry.toString());
  23633. } else if (Array.isArray(entry)) {
  23634. const subWidthsBuf = [];
  23635. for (const element of entry) {
  23636. if (typeof element === "number" || element instanceof _primitives.Ref) {
  23637. subWidthsBuf.push(element.toString());
  23638. }
  23639. }
  23640. widthsBuf.push(`[${subWidthsBuf.join()}]`);
  23641. }
  23642. }
  23643. hash.update(widthsBuf.join());
  23644. }
  23645. const cidToGidMap = dict.getRaw("CIDToGIDMap") || baseDict.getRaw("CIDToGIDMap");
  23646. if (cidToGidMap instanceof _primitives.Name) {
  23647. hash.update(cidToGidMap.name);
  23648. } else if (cidToGidMap instanceof _primitives.Ref) {
  23649. hash.update(cidToGidMap.toString());
  23650. } else if (cidToGidMap instanceof _base_stream.BaseStream) {
  23651. hash.update(cidToGidMap.peekBytes());
  23652. }
  23653. }
  23654. }
  23655. return {
  23656. descriptor,
  23657. dict,
  23658. baseDict,
  23659. composite,
  23660. type: type.name,
  23661. firstChar,
  23662. lastChar,
  23663. toUnicode,
  23664. hash: hash ? hash.hexdigest() : ""
  23665. };
  23666. }
  23667. async translateFont({
  23668. descriptor,
  23669. dict,
  23670. baseDict,
  23671. composite,
  23672. type,
  23673. firstChar,
  23674. lastChar,
  23675. toUnicode,
  23676. cssFontInfo
  23677. }) {
  23678. const isType3Font = type === "Type3";
  23679. let properties;
  23680. if (!descriptor) {
  23681. if (isType3Font) {
  23682. descriptor = new _primitives.Dict(null);
  23683. descriptor.set("FontName", _primitives.Name.get(type));
  23684. descriptor.set("FontBBox", dict.getArray("FontBBox") || [0, 0, 0, 0]);
  23685. } else {
  23686. let baseFontName = dict.get("BaseFont");
  23687. if (!(baseFontName instanceof _primitives.Name)) {
  23688. throw new _util.FormatError("Base font is not specified");
  23689. }
  23690. baseFontName = baseFontName.name.replace(/[,_]/g, "-");
  23691. const metrics = this.getBaseFontMetrics(baseFontName);
  23692. const fontNameWoStyle = baseFontName.split("-")[0];
  23693. 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);
  23694. properties = {
  23695. type,
  23696. name: baseFontName,
  23697. loadedName: baseDict.loadedName,
  23698. widths: metrics.widths,
  23699. defaultWidth: metrics.defaultWidth,
  23700. isSimulatedFlags: true,
  23701. flags,
  23702. firstChar,
  23703. lastChar,
  23704. toUnicode,
  23705. xHeight: 0,
  23706. capHeight: 0,
  23707. italicAngle: 0,
  23708. isType3Font
  23709. };
  23710. const widths = dict.get("Widths");
  23711. const standardFontName = (0, _standard_fonts.getStandardFontName)(baseFontName);
  23712. let file = null;
  23713. if (standardFontName) {
  23714. properties.isStandardFont = true;
  23715. file = await this.fetchStandardFontData(standardFontName);
  23716. properties.isInternalFont = !!file;
  23717. }
  23718. return this.extractDataStructures(dict, dict, properties).then(newProperties => {
  23719. if (widths) {
  23720. const glyphWidths = [];
  23721. let j = firstChar;
  23722. for (let i = 0, ii = widths.length; i < ii; i++) {
  23723. glyphWidths[j++] = this.xref.fetchIfRef(widths[i]);
  23724. }
  23725. newProperties.widths = glyphWidths;
  23726. } else {
  23727. newProperties.widths = this.buildCharCodeToWidth(metrics.widths, newProperties);
  23728. }
  23729. return new _fonts.Font(baseFontName, file, newProperties);
  23730. });
  23731. }
  23732. }
  23733. let fontName = descriptor.get("FontName");
  23734. let baseFont = dict.get("BaseFont");
  23735. if (typeof fontName === "string") {
  23736. fontName = _primitives.Name.get(fontName);
  23737. }
  23738. if (typeof baseFont === "string") {
  23739. baseFont = _primitives.Name.get(baseFont);
  23740. }
  23741. if (!isType3Font) {
  23742. const fontNameStr = fontName && fontName.name;
  23743. const baseFontStr = baseFont && baseFont.name;
  23744. if (fontNameStr !== baseFontStr) {
  23745. (0, _util.info)(`The FontDescriptor's FontName is "${fontNameStr}" but ` + `should be the same as the Font's BaseFont "${baseFontStr}".`);
  23746. if (fontNameStr && baseFontStr && baseFontStr.startsWith(fontNameStr)) {
  23747. fontName = baseFont;
  23748. }
  23749. }
  23750. }
  23751. fontName = fontName || baseFont;
  23752. if (!(fontName instanceof _primitives.Name)) {
  23753. throw new _util.FormatError("invalid font name");
  23754. }
  23755. let fontFile, subtype, length1, length2, length3;
  23756. try {
  23757. fontFile = descriptor.get("FontFile", "FontFile2", "FontFile3");
  23758. } catch (ex) {
  23759. if (!this.options.ignoreErrors) {
  23760. throw ex;
  23761. }
  23762. (0, _util.warn)(`translateFont - fetching "${fontName.name}" font file: "${ex}".`);
  23763. fontFile = new _stream.NullStream();
  23764. }
  23765. let isStandardFont = false;
  23766. let isInternalFont = false;
  23767. let glyphScaleFactors = null;
  23768. if (fontFile) {
  23769. if (fontFile.dict) {
  23770. const subtypeEntry = fontFile.dict.get("Subtype");
  23771. if (subtypeEntry instanceof _primitives.Name) {
  23772. subtype = subtypeEntry.name;
  23773. }
  23774. length1 = fontFile.dict.get("Length1");
  23775. length2 = fontFile.dict.get("Length2");
  23776. length3 = fontFile.dict.get("Length3");
  23777. }
  23778. } else if (cssFontInfo) {
  23779. const standardFontName = (0, _xfa_fonts.getXfaFontName)(fontName.name);
  23780. if (standardFontName) {
  23781. cssFontInfo.fontFamily = `${cssFontInfo.fontFamily}-PdfJS-XFA`;
  23782. cssFontInfo.metrics = standardFontName.metrics || null;
  23783. glyphScaleFactors = standardFontName.factors || null;
  23784. fontFile = await this.fetchStandardFontData(standardFontName.name);
  23785. isInternalFont = !!fontFile;
  23786. baseDict = dict = (0, _xfa_fonts.getXfaFontDict)(fontName.name);
  23787. composite = true;
  23788. }
  23789. } else if (!isType3Font) {
  23790. const standardFontName = (0, _standard_fonts.getStandardFontName)(fontName.name);
  23791. if (standardFontName) {
  23792. isStandardFont = true;
  23793. fontFile = await this.fetchStandardFontData(standardFontName);
  23794. isInternalFont = !!fontFile;
  23795. }
  23796. }
  23797. properties = {
  23798. type,
  23799. name: fontName.name,
  23800. subtype,
  23801. file: fontFile,
  23802. length1,
  23803. length2,
  23804. length3,
  23805. isStandardFont,
  23806. isInternalFont,
  23807. loadedName: baseDict.loadedName,
  23808. composite,
  23809. fixedPitch: false,
  23810. fontMatrix: dict.getArray("FontMatrix") || _util.FONT_IDENTITY_MATRIX,
  23811. firstChar,
  23812. lastChar,
  23813. toUnicode,
  23814. bbox: descriptor.getArray("FontBBox") || dict.getArray("FontBBox"),
  23815. ascent: descriptor.get("Ascent"),
  23816. descent: descriptor.get("Descent"),
  23817. xHeight: descriptor.get("XHeight") || 0,
  23818. capHeight: descriptor.get("CapHeight") || 0,
  23819. flags: descriptor.get("Flags"),
  23820. italicAngle: descriptor.get("ItalicAngle") || 0,
  23821. isType3Font,
  23822. cssFontInfo,
  23823. scaleFactors: glyphScaleFactors
  23824. };
  23825. if (composite) {
  23826. const cidEncoding = baseDict.get("Encoding");
  23827. if (cidEncoding instanceof _primitives.Name) {
  23828. properties.cidEncoding = cidEncoding.name;
  23829. }
  23830. const cMap = await _cmap.CMapFactory.create({
  23831. encoding: cidEncoding,
  23832. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  23833. useCMap: null
  23834. });
  23835. properties.cMap = cMap;
  23836. properties.vertical = properties.cMap.vertical;
  23837. }
  23838. return this.extractDataStructures(dict, baseDict, properties).then(newProperties => {
  23839. this.extractWidths(dict, descriptor, newProperties);
  23840. return new _fonts.Font(fontName.name, fontFile, newProperties);
  23841. });
  23842. }
  23843. static buildFontPaths(font, glyphs, handler, evaluatorOptions) {
  23844. function buildPath(fontChar) {
  23845. const glyphName = `${font.loadedName}_path_${fontChar}`;
  23846. try {
  23847. if (font.renderer.hasBuiltPath(fontChar)) {
  23848. return;
  23849. }
  23850. handler.send("commonobj", [glyphName, "FontPath", font.renderer.getPathJs(fontChar)]);
  23851. } catch (reason) {
  23852. if (evaluatorOptions.ignoreErrors) {
  23853. handler.send("UnsupportedFeature", {
  23854. featureId: _util.UNSUPPORTED_FEATURES.errorFontBuildPath
  23855. });
  23856. (0, _util.warn)(`buildFontPaths - ignoring ${glyphName} glyph: "${reason}".`);
  23857. return;
  23858. }
  23859. throw reason;
  23860. }
  23861. }
  23862. for (const glyph of glyphs) {
  23863. buildPath(glyph.fontChar);
  23864. const accent = glyph.accent;
  23865. if (accent && accent.fontChar) {
  23866. buildPath(accent.fontChar);
  23867. }
  23868. }
  23869. }
  23870. static get fallbackFontDict() {
  23871. const dict = new _primitives.Dict();
  23872. dict.set("BaseFont", _primitives.Name.get("PDFJS-FallbackFont"));
  23873. dict.set("Type", _primitives.Name.get("FallbackType"));
  23874. dict.set("Subtype", _primitives.Name.get("FallbackType"));
  23875. dict.set("Encoding", _primitives.Name.get("WinAnsiEncoding"));
  23876. return (0, _util.shadow)(this, "fallbackFontDict", dict);
  23877. }
  23878. }
  23879. exports.PartialEvaluator = PartialEvaluator;
  23880. class TranslatedFont {
  23881. constructor({
  23882. loadedName,
  23883. font,
  23884. dict,
  23885. evaluatorOptions
  23886. }) {
  23887. this.loadedName = loadedName;
  23888. this.font = font;
  23889. this.dict = dict;
  23890. this._evaluatorOptions = evaluatorOptions || DefaultPartialEvaluatorOptions;
  23891. this.type3Loaded = null;
  23892. this.type3Dependencies = font.isType3Font ? new Set() : null;
  23893. this.sent = false;
  23894. }
  23895. send(handler) {
  23896. if (this.sent) {
  23897. return;
  23898. }
  23899. this.sent = true;
  23900. handler.send("commonobj", [this.loadedName, "Font", this.font.exportData(this._evaluatorOptions.fontExtraProperties)]);
  23901. }
  23902. fallback(handler) {
  23903. if (!this.font.data) {
  23904. return;
  23905. }
  23906. this.font.disableFontFace = true;
  23907. PartialEvaluator.buildFontPaths(this.font, this.font.glyphCacheValues, handler, this._evaluatorOptions);
  23908. }
  23909. loadType3Data(evaluator, resources, task) {
  23910. if (this.type3Loaded) {
  23911. return this.type3Loaded;
  23912. }
  23913. if (!this.font.isType3Font) {
  23914. throw new Error("Must be a Type3 font.");
  23915. }
  23916. const type3Evaluator = evaluator.clone({
  23917. ignoreErrors: false
  23918. });
  23919. type3Evaluator.parsingType3Font = true;
  23920. const type3FontRefs = new _primitives.RefSet(evaluator.type3FontRefs);
  23921. if (this.dict.objId && !type3FontRefs.has(this.dict.objId)) {
  23922. type3FontRefs.put(this.dict.objId);
  23923. }
  23924. type3Evaluator.type3FontRefs = type3FontRefs;
  23925. const translatedFont = this.font,
  23926. type3Dependencies = this.type3Dependencies;
  23927. let loadCharProcsPromise = Promise.resolve();
  23928. const charProcs = this.dict.get("CharProcs");
  23929. const fontResources = this.dict.get("Resources") || resources;
  23930. const charProcOperatorList = Object.create(null);
  23931. const fontBBox = _util.Util.normalizeRect(translatedFont.bbox || [0, 0, 0, 0]),
  23932. width = fontBBox[2] - fontBBox[0],
  23933. height = fontBBox[3] - fontBBox[1];
  23934. const fontBBoxSize = Math.hypot(width, height);
  23935. for (const key of charProcs.getKeys()) {
  23936. loadCharProcsPromise = loadCharProcsPromise.then(() => {
  23937. const glyphStream = charProcs.get(key);
  23938. const operatorList = new _operator_list.OperatorList();
  23939. return type3Evaluator.getOperatorList({
  23940. stream: glyphStream,
  23941. task,
  23942. resources: fontResources,
  23943. operatorList
  23944. }).then(() => {
  23945. if (operatorList.fnArray[0] === _util.OPS.setCharWidthAndBounds) {
  23946. this._removeType3ColorOperators(operatorList, fontBBoxSize);
  23947. }
  23948. charProcOperatorList[key] = operatorList.getIR();
  23949. for (const dependency of operatorList.dependencies) {
  23950. type3Dependencies.add(dependency);
  23951. }
  23952. }).catch(function (reason) {
  23953. (0, _util.warn)(`Type3 font resource "${key}" is not available.`);
  23954. const dummyOperatorList = new _operator_list.OperatorList();
  23955. charProcOperatorList[key] = dummyOperatorList.getIR();
  23956. });
  23957. });
  23958. }
  23959. this.type3Loaded = loadCharProcsPromise.then(() => {
  23960. translatedFont.charProcOperatorList = charProcOperatorList;
  23961. if (this._bbox) {
  23962. translatedFont.isCharBBox = true;
  23963. translatedFont.bbox = this._bbox;
  23964. }
  23965. });
  23966. return this.type3Loaded;
  23967. }
  23968. _removeType3ColorOperators(operatorList, fontBBoxSize = NaN) {
  23969. const charBBox = _util.Util.normalizeRect(operatorList.argsArray[0].slice(2)),
  23970. width = charBBox[2] - charBBox[0],
  23971. height = charBBox[3] - charBBox[1];
  23972. const charBBoxSize = Math.hypot(width, height);
  23973. if (width === 0 || height === 0) {
  23974. operatorList.fnArray.splice(0, 1);
  23975. operatorList.argsArray.splice(0, 1);
  23976. } else if (fontBBoxSize === 0 || Math.round(charBBoxSize / fontBBoxSize) >= 10) {
  23977. if (!this._bbox) {
  23978. this._bbox = [Infinity, Infinity, -Infinity, -Infinity];
  23979. }
  23980. this._bbox[0] = Math.min(this._bbox[0], charBBox[0]);
  23981. this._bbox[1] = Math.min(this._bbox[1], charBBox[1]);
  23982. this._bbox[2] = Math.max(this._bbox[2], charBBox[2]);
  23983. this._bbox[3] = Math.max(this._bbox[3], charBBox[3]);
  23984. }
  23985. let i = 0,
  23986. ii = operatorList.length;
  23987. while (i < ii) {
  23988. switch (operatorList.fnArray[i]) {
  23989. case _util.OPS.setCharWidthAndBounds:
  23990. break;
  23991. case _util.OPS.setStrokeColorSpace:
  23992. case _util.OPS.setFillColorSpace:
  23993. case _util.OPS.setStrokeColor:
  23994. case _util.OPS.setStrokeColorN:
  23995. case _util.OPS.setFillColor:
  23996. case _util.OPS.setFillColorN:
  23997. case _util.OPS.setStrokeGray:
  23998. case _util.OPS.setFillGray:
  23999. case _util.OPS.setStrokeRGBColor:
  24000. case _util.OPS.setFillRGBColor:
  24001. case _util.OPS.setStrokeCMYKColor:
  24002. case _util.OPS.setFillCMYKColor:
  24003. case _util.OPS.shadingFill:
  24004. case _util.OPS.setRenderingIntent:
  24005. operatorList.fnArray.splice(i, 1);
  24006. operatorList.argsArray.splice(i, 1);
  24007. ii--;
  24008. continue;
  24009. case _util.OPS.setGState:
  24010. const [gStateObj] = operatorList.argsArray[i];
  24011. let j = 0,
  24012. jj = gStateObj.length;
  24013. while (j < jj) {
  24014. const [gStateKey] = gStateObj[j];
  24015. switch (gStateKey) {
  24016. case "TR":
  24017. case "TR2":
  24018. case "HT":
  24019. case "BG":
  24020. case "BG2":
  24021. case "UCR":
  24022. case "UCR2":
  24023. gStateObj.splice(j, 1);
  24024. jj--;
  24025. continue;
  24026. }
  24027. j++;
  24028. }
  24029. break;
  24030. }
  24031. i++;
  24032. }
  24033. }
  24034. }
  24035. class StateManager {
  24036. constructor(initialState = new EvalState()) {
  24037. this.state = initialState;
  24038. this.stateStack = [];
  24039. }
  24040. save() {
  24041. const old = this.state;
  24042. this.stateStack.push(this.state);
  24043. this.state = old.clone();
  24044. }
  24045. restore() {
  24046. const prev = this.stateStack.pop();
  24047. if (prev) {
  24048. this.state = prev;
  24049. }
  24050. }
  24051. transform(args) {
  24052. this.state.ctm = _util.Util.transform(this.state.ctm, args);
  24053. }
  24054. }
  24055. class TextState {
  24056. constructor() {
  24057. this.ctm = new Float32Array(_util.IDENTITY_MATRIX);
  24058. this.fontName = null;
  24059. this.fontSize = 0;
  24060. this.font = null;
  24061. this.fontMatrix = _util.FONT_IDENTITY_MATRIX;
  24062. this.textMatrix = _util.IDENTITY_MATRIX.slice();
  24063. this.textLineMatrix = _util.IDENTITY_MATRIX.slice();
  24064. this.charSpacing = 0;
  24065. this.wordSpacing = 0;
  24066. this.leading = 0;
  24067. this.textHScale = 1;
  24068. this.textRise = 0;
  24069. }
  24070. setTextMatrix(a, b, c, d, e, f) {
  24071. const m = this.textMatrix;
  24072. m[0] = a;
  24073. m[1] = b;
  24074. m[2] = c;
  24075. m[3] = d;
  24076. m[4] = e;
  24077. m[5] = f;
  24078. }
  24079. setTextLineMatrix(a, b, c, d, e, f) {
  24080. const m = this.textLineMatrix;
  24081. m[0] = a;
  24082. m[1] = b;
  24083. m[2] = c;
  24084. m[3] = d;
  24085. m[4] = e;
  24086. m[5] = f;
  24087. }
  24088. translateTextMatrix(x, y) {
  24089. const m = this.textMatrix;
  24090. m[4] = m[0] * x + m[2] * y + m[4];
  24091. m[5] = m[1] * x + m[3] * y + m[5];
  24092. }
  24093. translateTextLineMatrix(x, y) {
  24094. const m = this.textLineMatrix;
  24095. m[4] = m[0] * x + m[2] * y + m[4];
  24096. m[5] = m[1] * x + m[3] * y + m[5];
  24097. }
  24098. carriageReturn() {
  24099. this.translateTextLineMatrix(0, -this.leading);
  24100. this.textMatrix = this.textLineMatrix.slice();
  24101. }
  24102. clone() {
  24103. const clone = Object.create(this);
  24104. clone.textMatrix = this.textMatrix.slice();
  24105. clone.textLineMatrix = this.textLineMatrix.slice();
  24106. clone.fontMatrix = this.fontMatrix.slice();
  24107. return clone;
  24108. }
  24109. }
  24110. class EvalState {
  24111. constructor() {
  24112. this.ctm = new Float32Array(_util.IDENTITY_MATRIX);
  24113. this.font = null;
  24114. this.textRenderingMode = _util.TextRenderingMode.FILL;
  24115. this.fillColorSpace = _colorspace.ColorSpace.singletons.gray;
  24116. this.strokeColorSpace = _colorspace.ColorSpace.singletons.gray;
  24117. }
  24118. clone() {
  24119. return Object.create(this);
  24120. }
  24121. }
  24122. class EvaluatorPreprocessor {
  24123. static get opMap() {
  24124. const getOPMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  24125. t.w = {
  24126. id: _util.OPS.setLineWidth,
  24127. numArgs: 1,
  24128. variableArgs: false
  24129. };
  24130. t.J = {
  24131. id: _util.OPS.setLineCap,
  24132. numArgs: 1,
  24133. variableArgs: false
  24134. };
  24135. t.j = {
  24136. id: _util.OPS.setLineJoin,
  24137. numArgs: 1,
  24138. variableArgs: false
  24139. };
  24140. t.M = {
  24141. id: _util.OPS.setMiterLimit,
  24142. numArgs: 1,
  24143. variableArgs: false
  24144. };
  24145. t.d = {
  24146. id: _util.OPS.setDash,
  24147. numArgs: 2,
  24148. variableArgs: false
  24149. };
  24150. t.ri = {
  24151. id: _util.OPS.setRenderingIntent,
  24152. numArgs: 1,
  24153. variableArgs: false
  24154. };
  24155. t.i = {
  24156. id: _util.OPS.setFlatness,
  24157. numArgs: 1,
  24158. variableArgs: false
  24159. };
  24160. t.gs = {
  24161. id: _util.OPS.setGState,
  24162. numArgs: 1,
  24163. variableArgs: false
  24164. };
  24165. t.q = {
  24166. id: _util.OPS.save,
  24167. numArgs: 0,
  24168. variableArgs: false
  24169. };
  24170. t.Q = {
  24171. id: _util.OPS.restore,
  24172. numArgs: 0,
  24173. variableArgs: false
  24174. };
  24175. t.cm = {
  24176. id: _util.OPS.transform,
  24177. numArgs: 6,
  24178. variableArgs: false
  24179. };
  24180. t.m = {
  24181. id: _util.OPS.moveTo,
  24182. numArgs: 2,
  24183. variableArgs: false
  24184. };
  24185. t.l = {
  24186. id: _util.OPS.lineTo,
  24187. numArgs: 2,
  24188. variableArgs: false
  24189. };
  24190. t.c = {
  24191. id: _util.OPS.curveTo,
  24192. numArgs: 6,
  24193. variableArgs: false
  24194. };
  24195. t.v = {
  24196. id: _util.OPS.curveTo2,
  24197. numArgs: 4,
  24198. variableArgs: false
  24199. };
  24200. t.y = {
  24201. id: _util.OPS.curveTo3,
  24202. numArgs: 4,
  24203. variableArgs: false
  24204. };
  24205. t.h = {
  24206. id: _util.OPS.closePath,
  24207. numArgs: 0,
  24208. variableArgs: false
  24209. };
  24210. t.re = {
  24211. id: _util.OPS.rectangle,
  24212. numArgs: 4,
  24213. variableArgs: false
  24214. };
  24215. t.S = {
  24216. id: _util.OPS.stroke,
  24217. numArgs: 0,
  24218. variableArgs: false
  24219. };
  24220. t.s = {
  24221. id: _util.OPS.closeStroke,
  24222. numArgs: 0,
  24223. variableArgs: false
  24224. };
  24225. t.f = {
  24226. id: _util.OPS.fill,
  24227. numArgs: 0,
  24228. variableArgs: false
  24229. };
  24230. t.F = {
  24231. id: _util.OPS.fill,
  24232. numArgs: 0,
  24233. variableArgs: false
  24234. };
  24235. t["f*"] = {
  24236. id: _util.OPS.eoFill,
  24237. numArgs: 0,
  24238. variableArgs: false
  24239. };
  24240. t.B = {
  24241. id: _util.OPS.fillStroke,
  24242. numArgs: 0,
  24243. variableArgs: false
  24244. };
  24245. t["B*"] = {
  24246. id: _util.OPS.eoFillStroke,
  24247. numArgs: 0,
  24248. variableArgs: false
  24249. };
  24250. t.b = {
  24251. id: _util.OPS.closeFillStroke,
  24252. numArgs: 0,
  24253. variableArgs: false
  24254. };
  24255. t["b*"] = {
  24256. id: _util.OPS.closeEOFillStroke,
  24257. numArgs: 0,
  24258. variableArgs: false
  24259. };
  24260. t.n = {
  24261. id: _util.OPS.endPath,
  24262. numArgs: 0,
  24263. variableArgs: false
  24264. };
  24265. t.W = {
  24266. id: _util.OPS.clip,
  24267. numArgs: 0,
  24268. variableArgs: false
  24269. };
  24270. t["W*"] = {
  24271. id: _util.OPS.eoClip,
  24272. numArgs: 0,
  24273. variableArgs: false
  24274. };
  24275. t.BT = {
  24276. id: _util.OPS.beginText,
  24277. numArgs: 0,
  24278. variableArgs: false
  24279. };
  24280. t.ET = {
  24281. id: _util.OPS.endText,
  24282. numArgs: 0,
  24283. variableArgs: false
  24284. };
  24285. t.Tc = {
  24286. id: _util.OPS.setCharSpacing,
  24287. numArgs: 1,
  24288. variableArgs: false
  24289. };
  24290. t.Tw = {
  24291. id: _util.OPS.setWordSpacing,
  24292. numArgs: 1,
  24293. variableArgs: false
  24294. };
  24295. t.Tz = {
  24296. id: _util.OPS.setHScale,
  24297. numArgs: 1,
  24298. variableArgs: false
  24299. };
  24300. t.TL = {
  24301. id: _util.OPS.setLeading,
  24302. numArgs: 1,
  24303. variableArgs: false
  24304. };
  24305. t.Tf = {
  24306. id: _util.OPS.setFont,
  24307. numArgs: 2,
  24308. variableArgs: false
  24309. };
  24310. t.Tr = {
  24311. id: _util.OPS.setTextRenderingMode,
  24312. numArgs: 1,
  24313. variableArgs: false
  24314. };
  24315. t.Ts = {
  24316. id: _util.OPS.setTextRise,
  24317. numArgs: 1,
  24318. variableArgs: false
  24319. };
  24320. t.Td = {
  24321. id: _util.OPS.moveText,
  24322. numArgs: 2,
  24323. variableArgs: false
  24324. };
  24325. t.TD = {
  24326. id: _util.OPS.setLeadingMoveText,
  24327. numArgs: 2,
  24328. variableArgs: false
  24329. };
  24330. t.Tm = {
  24331. id: _util.OPS.setTextMatrix,
  24332. numArgs: 6,
  24333. variableArgs: false
  24334. };
  24335. t["T*"] = {
  24336. id: _util.OPS.nextLine,
  24337. numArgs: 0,
  24338. variableArgs: false
  24339. };
  24340. t.Tj = {
  24341. id: _util.OPS.showText,
  24342. numArgs: 1,
  24343. variableArgs: false
  24344. };
  24345. t.TJ = {
  24346. id: _util.OPS.showSpacedText,
  24347. numArgs: 1,
  24348. variableArgs: false
  24349. };
  24350. t["'"] = {
  24351. id: _util.OPS.nextLineShowText,
  24352. numArgs: 1,
  24353. variableArgs: false
  24354. };
  24355. t['"'] = {
  24356. id: _util.OPS.nextLineSetSpacingShowText,
  24357. numArgs: 3,
  24358. variableArgs: false
  24359. };
  24360. t.d0 = {
  24361. id: _util.OPS.setCharWidth,
  24362. numArgs: 2,
  24363. variableArgs: false
  24364. };
  24365. t.d1 = {
  24366. id: _util.OPS.setCharWidthAndBounds,
  24367. numArgs: 6,
  24368. variableArgs: false
  24369. };
  24370. t.CS = {
  24371. id: _util.OPS.setStrokeColorSpace,
  24372. numArgs: 1,
  24373. variableArgs: false
  24374. };
  24375. t.cs = {
  24376. id: _util.OPS.setFillColorSpace,
  24377. numArgs: 1,
  24378. variableArgs: false
  24379. };
  24380. t.SC = {
  24381. id: _util.OPS.setStrokeColor,
  24382. numArgs: 4,
  24383. variableArgs: true
  24384. };
  24385. t.SCN = {
  24386. id: _util.OPS.setStrokeColorN,
  24387. numArgs: 33,
  24388. variableArgs: true
  24389. };
  24390. t.sc = {
  24391. id: _util.OPS.setFillColor,
  24392. numArgs: 4,
  24393. variableArgs: true
  24394. };
  24395. t.scn = {
  24396. id: _util.OPS.setFillColorN,
  24397. numArgs: 33,
  24398. variableArgs: true
  24399. };
  24400. t.G = {
  24401. id: _util.OPS.setStrokeGray,
  24402. numArgs: 1,
  24403. variableArgs: false
  24404. };
  24405. t.g = {
  24406. id: _util.OPS.setFillGray,
  24407. numArgs: 1,
  24408. variableArgs: false
  24409. };
  24410. t.RG = {
  24411. id: _util.OPS.setStrokeRGBColor,
  24412. numArgs: 3,
  24413. variableArgs: false
  24414. };
  24415. t.rg = {
  24416. id: _util.OPS.setFillRGBColor,
  24417. numArgs: 3,
  24418. variableArgs: false
  24419. };
  24420. t.K = {
  24421. id: _util.OPS.setStrokeCMYKColor,
  24422. numArgs: 4,
  24423. variableArgs: false
  24424. };
  24425. t.k = {
  24426. id: _util.OPS.setFillCMYKColor,
  24427. numArgs: 4,
  24428. variableArgs: false
  24429. };
  24430. t.sh = {
  24431. id: _util.OPS.shadingFill,
  24432. numArgs: 1,
  24433. variableArgs: false
  24434. };
  24435. t.BI = {
  24436. id: _util.OPS.beginInlineImage,
  24437. numArgs: 0,
  24438. variableArgs: false
  24439. };
  24440. t.ID = {
  24441. id: _util.OPS.beginImageData,
  24442. numArgs: 0,
  24443. variableArgs: false
  24444. };
  24445. t.EI = {
  24446. id: _util.OPS.endInlineImage,
  24447. numArgs: 1,
  24448. variableArgs: false
  24449. };
  24450. t.Do = {
  24451. id: _util.OPS.paintXObject,
  24452. numArgs: 1,
  24453. variableArgs: false
  24454. };
  24455. t.MP = {
  24456. id: _util.OPS.markPoint,
  24457. numArgs: 1,
  24458. variableArgs: false
  24459. };
  24460. t.DP = {
  24461. id: _util.OPS.markPointProps,
  24462. numArgs: 2,
  24463. variableArgs: false
  24464. };
  24465. t.BMC = {
  24466. id: _util.OPS.beginMarkedContent,
  24467. numArgs: 1,
  24468. variableArgs: false
  24469. };
  24470. t.BDC = {
  24471. id: _util.OPS.beginMarkedContentProps,
  24472. numArgs: 2,
  24473. variableArgs: false
  24474. };
  24475. t.EMC = {
  24476. id: _util.OPS.endMarkedContent,
  24477. numArgs: 0,
  24478. variableArgs: false
  24479. };
  24480. t.BX = {
  24481. id: _util.OPS.beginCompat,
  24482. numArgs: 0,
  24483. variableArgs: false
  24484. };
  24485. t.EX = {
  24486. id: _util.OPS.endCompat,
  24487. numArgs: 0,
  24488. variableArgs: false
  24489. };
  24490. t.BM = null;
  24491. t.BD = null;
  24492. t.true = null;
  24493. t.fa = null;
  24494. t.fal = null;
  24495. t.fals = null;
  24496. t.false = null;
  24497. t.nu = null;
  24498. t.nul = null;
  24499. t.null = null;
  24500. });
  24501. return (0, _util.shadow)(this, "opMap", getOPMap());
  24502. }
  24503. static get MAX_INVALID_PATH_OPS() {
  24504. return (0, _util.shadow)(this, "MAX_INVALID_PATH_OPS", 10);
  24505. }
  24506. constructor(stream, xref, stateManager = new StateManager()) {
  24507. this.parser = new _parser.Parser({
  24508. lexer: new _parser.Lexer(stream, EvaluatorPreprocessor.opMap),
  24509. xref
  24510. });
  24511. this.stateManager = stateManager;
  24512. this.nonProcessedArgs = [];
  24513. this._isPathOp = false;
  24514. this._numInvalidPathOPS = 0;
  24515. }
  24516. get savedStatesDepth() {
  24517. return this.stateManager.stateStack.length;
  24518. }
  24519. read(operation) {
  24520. let args = operation.args;
  24521. while (true) {
  24522. const obj = this.parser.getObj();
  24523. if (obj instanceof _primitives.Cmd) {
  24524. const cmd = obj.cmd;
  24525. const opSpec = EvaluatorPreprocessor.opMap[cmd];
  24526. if (!opSpec) {
  24527. (0, _util.warn)(`Unknown command "${cmd}".`);
  24528. continue;
  24529. }
  24530. const fn = opSpec.id;
  24531. const numArgs = opSpec.numArgs;
  24532. let argsLength = args !== null ? args.length : 0;
  24533. if (!this._isPathOp) {
  24534. this._numInvalidPathOPS = 0;
  24535. }
  24536. this._isPathOp = fn >= _util.OPS.moveTo && fn <= _util.OPS.endPath;
  24537. if (!opSpec.variableArgs) {
  24538. if (argsLength !== numArgs) {
  24539. const nonProcessedArgs = this.nonProcessedArgs;
  24540. while (argsLength > numArgs) {
  24541. nonProcessedArgs.push(args.shift());
  24542. argsLength--;
  24543. }
  24544. while (argsLength < numArgs && nonProcessedArgs.length !== 0) {
  24545. if (args === null) {
  24546. args = [];
  24547. }
  24548. args.unshift(nonProcessedArgs.pop());
  24549. argsLength++;
  24550. }
  24551. }
  24552. if (argsLength < numArgs) {
  24553. const partialMsg = `command ${cmd}: expected ${numArgs} args, ` + `but received ${argsLength} args.`;
  24554. if (this._isPathOp && ++this._numInvalidPathOPS > EvaluatorPreprocessor.MAX_INVALID_PATH_OPS) {
  24555. throw new _util.FormatError(`Invalid ${partialMsg}`);
  24556. }
  24557. (0, _util.warn)(`Skipping ${partialMsg}`);
  24558. if (args !== null) {
  24559. args.length = 0;
  24560. }
  24561. continue;
  24562. }
  24563. } else if (argsLength > numArgs) {
  24564. (0, _util.info)(`Command ${cmd}: expected [0, ${numArgs}] args, ` + `but received ${argsLength} args.`);
  24565. }
  24566. this.preprocessCommand(fn, args);
  24567. operation.fn = fn;
  24568. operation.args = args;
  24569. return true;
  24570. }
  24571. if (obj === _primitives.EOF) {
  24572. return false;
  24573. }
  24574. if (obj !== null) {
  24575. if (args === null) {
  24576. args = [];
  24577. }
  24578. args.push(obj);
  24579. if (args.length > 33) {
  24580. throw new _util.FormatError("Too many arguments");
  24581. }
  24582. }
  24583. }
  24584. }
  24585. preprocessCommand(fn, args) {
  24586. switch (fn | 0) {
  24587. case _util.OPS.save:
  24588. this.stateManager.save();
  24589. break;
  24590. case _util.OPS.restore:
  24591. this.stateManager.restore();
  24592. break;
  24593. case _util.OPS.transform:
  24594. this.stateManager.transform(args);
  24595. break;
  24596. }
  24597. }
  24598. }
  24599. exports.EvaluatorPreprocessor = EvaluatorPreprocessor;
  24600. /***/ }),
  24601. /* 26 */
  24602. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  24603. Object.defineProperty(exports, "__esModule", ({
  24604. value: true
  24605. }));
  24606. exports.IdentityCMap = exports.CMapFactory = exports.CMap = void 0;
  24607. var _util = __w_pdfjs_require__(2);
  24608. var _primitives = __w_pdfjs_require__(5);
  24609. var _base_stream = __w_pdfjs_require__(7);
  24610. var _parser = __w_pdfjs_require__(27);
  24611. var _core_utils = __w_pdfjs_require__(6);
  24612. var _stream = __w_pdfjs_require__(10);
  24613. 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"];
  24614. const MAX_MAP_RANGE = 2 ** 24 - 1;
  24615. class CMap {
  24616. constructor(builtInCMap = false) {
  24617. this.codespaceRanges = [[], [], [], []];
  24618. this.numCodespaceRanges = 0;
  24619. this._map = [];
  24620. this.name = "";
  24621. this.vertical = false;
  24622. this.useCMap = null;
  24623. this.builtInCMap = builtInCMap;
  24624. }
  24625. addCodespaceRange(n, low, high) {
  24626. this.codespaceRanges[n - 1].push(low, high);
  24627. this.numCodespaceRanges++;
  24628. }
  24629. mapCidRange(low, high, dstLow) {
  24630. if (high - low > MAX_MAP_RANGE) {
  24631. throw new Error("mapCidRange - ignoring data above MAX_MAP_RANGE.");
  24632. }
  24633. while (low <= high) {
  24634. this._map[low++] = dstLow++;
  24635. }
  24636. }
  24637. mapBfRange(low, high, dstLow) {
  24638. if (high - low > MAX_MAP_RANGE) {
  24639. throw new Error("mapBfRange - ignoring data above MAX_MAP_RANGE.");
  24640. }
  24641. const lastByte = dstLow.length - 1;
  24642. while (low <= high) {
  24643. this._map[low++] = dstLow;
  24644. const nextCharCode = dstLow.charCodeAt(lastByte) + 1;
  24645. if (nextCharCode > 0xff) {
  24646. dstLow = dstLow.substring(0, lastByte - 1) + String.fromCharCode(dstLow.charCodeAt(lastByte - 1) + 1) + "\x00";
  24647. continue;
  24648. }
  24649. dstLow = dstLow.substring(0, lastByte) + String.fromCharCode(nextCharCode);
  24650. }
  24651. }
  24652. mapBfRangeToArray(low, high, array) {
  24653. if (high - low > MAX_MAP_RANGE) {
  24654. throw new Error("mapBfRangeToArray - ignoring data above MAX_MAP_RANGE.");
  24655. }
  24656. const ii = array.length;
  24657. let i = 0;
  24658. while (low <= high && i < ii) {
  24659. this._map[low] = array[i++];
  24660. ++low;
  24661. }
  24662. }
  24663. mapOne(src, dst) {
  24664. this._map[src] = dst;
  24665. }
  24666. lookup(code) {
  24667. return this._map[code];
  24668. }
  24669. contains(code) {
  24670. return this._map[code] !== undefined;
  24671. }
  24672. forEach(callback) {
  24673. const map = this._map;
  24674. const length = map.length;
  24675. if (length <= 0x10000) {
  24676. for (let i = 0; i < length; i++) {
  24677. if (map[i] !== undefined) {
  24678. callback(i, map[i]);
  24679. }
  24680. }
  24681. } else {
  24682. for (const i in map) {
  24683. callback(i, map[i]);
  24684. }
  24685. }
  24686. }
  24687. charCodeOf(value) {
  24688. const map = this._map;
  24689. if (map.length <= 0x10000) {
  24690. return map.indexOf(value);
  24691. }
  24692. for (const charCode in map) {
  24693. if (map[charCode] === value) {
  24694. return charCode | 0;
  24695. }
  24696. }
  24697. return -1;
  24698. }
  24699. getMap() {
  24700. return this._map;
  24701. }
  24702. readCharCode(str, offset, out) {
  24703. let c = 0;
  24704. const codespaceRanges = this.codespaceRanges;
  24705. for (let n = 0, nn = codespaceRanges.length; n < nn; n++) {
  24706. c = (c << 8 | str.charCodeAt(offset + n)) >>> 0;
  24707. const codespaceRange = codespaceRanges[n];
  24708. for (let k = 0, kk = codespaceRange.length; k < kk;) {
  24709. const low = codespaceRange[k++];
  24710. const high = codespaceRange[k++];
  24711. if (c >= low && c <= high) {
  24712. out.charcode = c;
  24713. out.length = n + 1;
  24714. return;
  24715. }
  24716. }
  24717. }
  24718. out.charcode = 0;
  24719. out.length = 1;
  24720. }
  24721. getCharCodeLength(charCode) {
  24722. const codespaceRanges = this.codespaceRanges;
  24723. for (let n = 0, nn = codespaceRanges.length; n < nn; n++) {
  24724. const codespaceRange = codespaceRanges[n];
  24725. for (let k = 0, kk = codespaceRange.length; k < kk;) {
  24726. const low = codespaceRange[k++];
  24727. const high = codespaceRange[k++];
  24728. if (charCode >= low && charCode <= high) {
  24729. return n + 1;
  24730. }
  24731. }
  24732. }
  24733. return 1;
  24734. }
  24735. get length() {
  24736. return this._map.length;
  24737. }
  24738. get isIdentityCMap() {
  24739. if (!(this.name === "Identity-H" || this.name === "Identity-V")) {
  24740. return false;
  24741. }
  24742. if (this._map.length !== 0x10000) {
  24743. return false;
  24744. }
  24745. for (let i = 0; i < 0x10000; i++) {
  24746. if (this._map[i] !== i) {
  24747. return false;
  24748. }
  24749. }
  24750. return true;
  24751. }
  24752. }
  24753. exports.CMap = CMap;
  24754. class IdentityCMap extends CMap {
  24755. constructor(vertical, n) {
  24756. super();
  24757. this.vertical = vertical;
  24758. this.addCodespaceRange(n, 0, 0xffff);
  24759. }
  24760. mapCidRange(low, high, dstLow) {
  24761. (0, _util.unreachable)("should not call mapCidRange");
  24762. }
  24763. mapBfRange(low, high, dstLow) {
  24764. (0, _util.unreachable)("should not call mapBfRange");
  24765. }
  24766. mapBfRangeToArray(low, high, array) {
  24767. (0, _util.unreachable)("should not call mapBfRangeToArray");
  24768. }
  24769. mapOne(src, dst) {
  24770. (0, _util.unreachable)("should not call mapCidOne");
  24771. }
  24772. lookup(code) {
  24773. return Number.isInteger(code) && code <= 0xffff ? code : undefined;
  24774. }
  24775. contains(code) {
  24776. return Number.isInteger(code) && code <= 0xffff;
  24777. }
  24778. forEach(callback) {
  24779. for (let i = 0; i <= 0xffff; i++) {
  24780. callback(i, i);
  24781. }
  24782. }
  24783. charCodeOf(value) {
  24784. return Number.isInteger(value) && value <= 0xffff ? value : -1;
  24785. }
  24786. getMap() {
  24787. const map = new Array(0x10000);
  24788. for (let i = 0; i <= 0xffff; i++) {
  24789. map[i] = i;
  24790. }
  24791. return map;
  24792. }
  24793. get length() {
  24794. return 0x10000;
  24795. }
  24796. get isIdentityCMap() {
  24797. (0, _util.unreachable)("should not access .isIdentityCMap");
  24798. }
  24799. }
  24800. exports.IdentityCMap = IdentityCMap;
  24801. const BinaryCMapReader = function BinaryCMapReaderClosure() {
  24802. function hexToInt(a, size) {
  24803. let n = 0;
  24804. for (let i = 0; i <= size; i++) {
  24805. n = n << 8 | a[i];
  24806. }
  24807. return n >>> 0;
  24808. }
  24809. function hexToStr(a, size) {
  24810. if (size === 1) {
  24811. return String.fromCharCode(a[0], a[1]);
  24812. }
  24813. if (size === 3) {
  24814. return String.fromCharCode(a[0], a[1], a[2], a[3]);
  24815. }
  24816. return String.fromCharCode.apply(null, a.subarray(0, size + 1));
  24817. }
  24818. function addHex(a, b, size) {
  24819. let c = 0;
  24820. for (let i = size; i >= 0; i--) {
  24821. c += a[i] + b[i];
  24822. a[i] = c & 255;
  24823. c >>= 8;
  24824. }
  24825. }
  24826. function incHex(a, size) {
  24827. let c = 1;
  24828. for (let i = size; i >= 0 && c > 0; i--) {
  24829. c += a[i];
  24830. a[i] = c & 255;
  24831. c >>= 8;
  24832. }
  24833. }
  24834. const MAX_NUM_SIZE = 16;
  24835. const MAX_ENCODED_NUM_SIZE = 19;
  24836. class BinaryCMapStream {
  24837. constructor(data) {
  24838. this.buffer = data;
  24839. this.pos = 0;
  24840. this.end = data.length;
  24841. this.tmpBuf = new Uint8Array(MAX_ENCODED_NUM_SIZE);
  24842. }
  24843. readByte() {
  24844. if (this.pos >= this.end) {
  24845. return -1;
  24846. }
  24847. return this.buffer[this.pos++];
  24848. }
  24849. readNumber() {
  24850. let n = 0;
  24851. let last;
  24852. do {
  24853. const b = this.readByte();
  24854. if (b < 0) {
  24855. throw new _util.FormatError("unexpected EOF in bcmap");
  24856. }
  24857. last = !(b & 0x80);
  24858. n = n << 7 | b & 0x7f;
  24859. } while (!last);
  24860. return n;
  24861. }
  24862. readSigned() {
  24863. const n = this.readNumber();
  24864. return n & 1 ? ~(n >>> 1) : n >>> 1;
  24865. }
  24866. readHex(num, size) {
  24867. num.set(this.buffer.subarray(this.pos, this.pos + size + 1));
  24868. this.pos += size + 1;
  24869. }
  24870. readHexNumber(num, size) {
  24871. let last;
  24872. const stack = this.tmpBuf;
  24873. let sp = 0;
  24874. do {
  24875. const b = this.readByte();
  24876. if (b < 0) {
  24877. throw new _util.FormatError("unexpected EOF in bcmap");
  24878. }
  24879. last = !(b & 0x80);
  24880. stack[sp++] = b & 0x7f;
  24881. } while (!last);
  24882. let i = size,
  24883. buffer = 0,
  24884. bufferSize = 0;
  24885. while (i >= 0) {
  24886. while (bufferSize < 8 && stack.length > 0) {
  24887. buffer |= stack[--sp] << bufferSize;
  24888. bufferSize += 7;
  24889. }
  24890. num[i] = buffer & 255;
  24891. i--;
  24892. buffer >>= 8;
  24893. bufferSize -= 8;
  24894. }
  24895. }
  24896. readHexSigned(num, size) {
  24897. this.readHexNumber(num, size);
  24898. const sign = num[size] & 1 ? 255 : 0;
  24899. let c = 0;
  24900. for (let i = 0; i <= size; i++) {
  24901. c = (c & 1) << 8 | num[i];
  24902. num[i] = c >> 1 ^ sign;
  24903. }
  24904. }
  24905. readString() {
  24906. const len = this.readNumber();
  24907. let s = "";
  24908. for (let i = 0; i < len; i++) {
  24909. s += String.fromCharCode(this.readNumber());
  24910. }
  24911. return s;
  24912. }
  24913. }
  24914. class BinaryCMapReader {
  24915. async process(data, cMap, extend) {
  24916. const stream = new BinaryCMapStream(data);
  24917. const header = stream.readByte();
  24918. cMap.vertical = !!(header & 1);
  24919. let useCMap = null;
  24920. const start = new Uint8Array(MAX_NUM_SIZE);
  24921. const end = new Uint8Array(MAX_NUM_SIZE);
  24922. const char = new Uint8Array(MAX_NUM_SIZE);
  24923. const charCode = new Uint8Array(MAX_NUM_SIZE);
  24924. const tmp = new Uint8Array(MAX_NUM_SIZE);
  24925. let code;
  24926. let b;
  24927. while ((b = stream.readByte()) >= 0) {
  24928. const type = b >> 5;
  24929. if (type === 7) {
  24930. switch (b & 0x1f) {
  24931. case 0:
  24932. stream.readString();
  24933. break;
  24934. case 1:
  24935. useCMap = stream.readString();
  24936. break;
  24937. }
  24938. continue;
  24939. }
  24940. const sequence = !!(b & 0x10);
  24941. const dataSize = b & 15;
  24942. if (dataSize + 1 > MAX_NUM_SIZE) {
  24943. throw new Error("BinaryCMapReader.process: Invalid dataSize.");
  24944. }
  24945. const ucs2DataSize = 1;
  24946. const subitemsCount = stream.readNumber();
  24947. switch (type) {
  24948. case 0:
  24949. stream.readHex(start, dataSize);
  24950. stream.readHexNumber(end, dataSize);
  24951. addHex(end, start, dataSize);
  24952. cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
  24953. for (let i = 1; i < subitemsCount; i++) {
  24954. incHex(end, dataSize);
  24955. stream.readHexNumber(start, dataSize);
  24956. addHex(start, end, dataSize);
  24957. stream.readHexNumber(end, dataSize);
  24958. addHex(end, start, dataSize);
  24959. cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
  24960. }
  24961. break;
  24962. case 1:
  24963. stream.readHex(start, dataSize);
  24964. stream.readHexNumber(end, dataSize);
  24965. addHex(end, start, dataSize);
  24966. stream.readNumber();
  24967. for (let i = 1; i < subitemsCount; i++) {
  24968. incHex(end, dataSize);
  24969. stream.readHexNumber(start, dataSize);
  24970. addHex(start, end, dataSize);
  24971. stream.readHexNumber(end, dataSize);
  24972. addHex(end, start, dataSize);
  24973. stream.readNumber();
  24974. }
  24975. break;
  24976. case 2:
  24977. stream.readHex(char, dataSize);
  24978. code = stream.readNumber();
  24979. cMap.mapOne(hexToInt(char, dataSize), code);
  24980. for (let i = 1; i < subitemsCount; i++) {
  24981. incHex(char, dataSize);
  24982. if (!sequence) {
  24983. stream.readHexNumber(tmp, dataSize);
  24984. addHex(char, tmp, dataSize);
  24985. }
  24986. code = stream.readSigned() + (code + 1);
  24987. cMap.mapOne(hexToInt(char, dataSize), code);
  24988. }
  24989. break;
  24990. case 3:
  24991. stream.readHex(start, dataSize);
  24992. stream.readHexNumber(end, dataSize);
  24993. addHex(end, start, dataSize);
  24994. code = stream.readNumber();
  24995. cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
  24996. for (let i = 1; i < subitemsCount; i++) {
  24997. incHex(end, dataSize);
  24998. if (!sequence) {
  24999. stream.readHexNumber(start, dataSize);
  25000. addHex(start, end, dataSize);
  25001. } else {
  25002. start.set(end);
  25003. }
  25004. stream.readHexNumber(end, dataSize);
  25005. addHex(end, start, dataSize);
  25006. code = stream.readNumber();
  25007. cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
  25008. }
  25009. break;
  25010. case 4:
  25011. stream.readHex(char, ucs2DataSize);
  25012. stream.readHex(charCode, dataSize);
  25013. cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
  25014. for (let i = 1; i < subitemsCount; i++) {
  25015. incHex(char, ucs2DataSize);
  25016. if (!sequence) {
  25017. stream.readHexNumber(tmp, ucs2DataSize);
  25018. addHex(char, tmp, ucs2DataSize);
  25019. }
  25020. incHex(charCode, dataSize);
  25021. stream.readHexSigned(tmp, dataSize);
  25022. addHex(charCode, tmp, dataSize);
  25023. cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
  25024. }
  25025. break;
  25026. case 5:
  25027. stream.readHex(start, ucs2DataSize);
  25028. stream.readHexNumber(end, ucs2DataSize);
  25029. addHex(end, start, ucs2DataSize);
  25030. stream.readHex(charCode, dataSize);
  25031. cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
  25032. for (let i = 1; i < subitemsCount; i++) {
  25033. incHex(end, ucs2DataSize);
  25034. if (!sequence) {
  25035. stream.readHexNumber(start, ucs2DataSize);
  25036. addHex(start, end, ucs2DataSize);
  25037. } else {
  25038. start.set(end);
  25039. }
  25040. stream.readHexNumber(end, ucs2DataSize);
  25041. addHex(end, start, ucs2DataSize);
  25042. stream.readHex(charCode, dataSize);
  25043. cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
  25044. }
  25045. break;
  25046. default:
  25047. throw new Error(`BinaryCMapReader.process - unknown type: ${type}`);
  25048. }
  25049. }
  25050. if (useCMap) {
  25051. return extend(useCMap);
  25052. }
  25053. return cMap;
  25054. }
  25055. }
  25056. return BinaryCMapReader;
  25057. }();
  25058. const CMapFactory = function CMapFactoryClosure() {
  25059. function strToInt(str) {
  25060. let a = 0;
  25061. for (let i = 0; i < str.length; i++) {
  25062. a = a << 8 | str.charCodeAt(i);
  25063. }
  25064. return a >>> 0;
  25065. }
  25066. function expectString(obj) {
  25067. if (typeof obj !== "string") {
  25068. throw new _util.FormatError("Malformed CMap: expected string.");
  25069. }
  25070. }
  25071. function expectInt(obj) {
  25072. if (!Number.isInteger(obj)) {
  25073. throw new _util.FormatError("Malformed CMap: expected int.");
  25074. }
  25075. }
  25076. function parseBfChar(cMap, lexer) {
  25077. while (true) {
  25078. let obj = lexer.getObj();
  25079. if (obj === _primitives.EOF) {
  25080. break;
  25081. }
  25082. if ((0, _primitives.isCmd)(obj, "endbfchar")) {
  25083. return;
  25084. }
  25085. expectString(obj);
  25086. const src = strToInt(obj);
  25087. obj = lexer.getObj();
  25088. expectString(obj);
  25089. const dst = obj;
  25090. cMap.mapOne(src, dst);
  25091. }
  25092. }
  25093. function parseBfRange(cMap, lexer) {
  25094. while (true) {
  25095. let obj = lexer.getObj();
  25096. if (obj === _primitives.EOF) {
  25097. break;
  25098. }
  25099. if ((0, _primitives.isCmd)(obj, "endbfrange")) {
  25100. return;
  25101. }
  25102. expectString(obj);
  25103. const low = strToInt(obj);
  25104. obj = lexer.getObj();
  25105. expectString(obj);
  25106. const high = strToInt(obj);
  25107. obj = lexer.getObj();
  25108. if (Number.isInteger(obj) || typeof obj === "string") {
  25109. const dstLow = Number.isInteger(obj) ? String.fromCharCode(obj) : obj;
  25110. cMap.mapBfRange(low, high, dstLow);
  25111. } else if ((0, _primitives.isCmd)(obj, "[")) {
  25112. obj = lexer.getObj();
  25113. const array = [];
  25114. while (!(0, _primitives.isCmd)(obj, "]") && obj !== _primitives.EOF) {
  25115. array.push(obj);
  25116. obj = lexer.getObj();
  25117. }
  25118. cMap.mapBfRangeToArray(low, high, array);
  25119. } else {
  25120. break;
  25121. }
  25122. }
  25123. throw new _util.FormatError("Invalid bf range.");
  25124. }
  25125. function parseCidChar(cMap, lexer) {
  25126. while (true) {
  25127. let obj = lexer.getObj();
  25128. if (obj === _primitives.EOF) {
  25129. break;
  25130. }
  25131. if ((0, _primitives.isCmd)(obj, "endcidchar")) {
  25132. return;
  25133. }
  25134. expectString(obj);
  25135. const src = strToInt(obj);
  25136. obj = lexer.getObj();
  25137. expectInt(obj);
  25138. const dst = obj;
  25139. cMap.mapOne(src, dst);
  25140. }
  25141. }
  25142. function parseCidRange(cMap, lexer) {
  25143. while (true) {
  25144. let obj = lexer.getObj();
  25145. if (obj === _primitives.EOF) {
  25146. break;
  25147. }
  25148. if ((0, _primitives.isCmd)(obj, "endcidrange")) {
  25149. return;
  25150. }
  25151. expectString(obj);
  25152. const low = strToInt(obj);
  25153. obj = lexer.getObj();
  25154. expectString(obj);
  25155. const high = strToInt(obj);
  25156. obj = lexer.getObj();
  25157. expectInt(obj);
  25158. const dstLow = obj;
  25159. cMap.mapCidRange(low, high, dstLow);
  25160. }
  25161. }
  25162. function parseCodespaceRange(cMap, lexer) {
  25163. while (true) {
  25164. let obj = lexer.getObj();
  25165. if (obj === _primitives.EOF) {
  25166. break;
  25167. }
  25168. if ((0, _primitives.isCmd)(obj, "endcodespacerange")) {
  25169. return;
  25170. }
  25171. if (typeof obj !== "string") {
  25172. break;
  25173. }
  25174. const low = strToInt(obj);
  25175. obj = lexer.getObj();
  25176. if (typeof obj !== "string") {
  25177. break;
  25178. }
  25179. const high = strToInt(obj);
  25180. cMap.addCodespaceRange(obj.length, low, high);
  25181. }
  25182. throw new _util.FormatError("Invalid codespace range.");
  25183. }
  25184. function parseWMode(cMap, lexer) {
  25185. const obj = lexer.getObj();
  25186. if (Number.isInteger(obj)) {
  25187. cMap.vertical = !!obj;
  25188. }
  25189. }
  25190. function parseCMapName(cMap, lexer) {
  25191. const obj = lexer.getObj();
  25192. if (obj instanceof _primitives.Name) {
  25193. cMap.name = obj.name;
  25194. }
  25195. }
  25196. async function parseCMap(cMap, lexer, fetchBuiltInCMap, useCMap) {
  25197. let previous, embeddedUseCMap;
  25198. objLoop: while (true) {
  25199. try {
  25200. const obj = lexer.getObj();
  25201. if (obj === _primitives.EOF) {
  25202. break;
  25203. } else if (obj instanceof _primitives.Name) {
  25204. if (obj.name === "WMode") {
  25205. parseWMode(cMap, lexer);
  25206. } else if (obj.name === "CMapName") {
  25207. parseCMapName(cMap, lexer);
  25208. }
  25209. previous = obj;
  25210. } else if (obj instanceof _primitives.Cmd) {
  25211. switch (obj.cmd) {
  25212. case "endcmap":
  25213. break objLoop;
  25214. case "usecmap":
  25215. if (previous instanceof _primitives.Name) {
  25216. embeddedUseCMap = previous.name;
  25217. }
  25218. break;
  25219. case "begincodespacerange":
  25220. parseCodespaceRange(cMap, lexer);
  25221. break;
  25222. case "beginbfchar":
  25223. parseBfChar(cMap, lexer);
  25224. break;
  25225. case "begincidchar":
  25226. parseCidChar(cMap, lexer);
  25227. break;
  25228. case "beginbfrange":
  25229. parseBfRange(cMap, lexer);
  25230. break;
  25231. case "begincidrange":
  25232. parseCidRange(cMap, lexer);
  25233. break;
  25234. }
  25235. }
  25236. } catch (ex) {
  25237. if (ex instanceof _core_utils.MissingDataException) {
  25238. throw ex;
  25239. }
  25240. (0, _util.warn)("Invalid cMap data: " + ex);
  25241. continue;
  25242. }
  25243. }
  25244. if (!useCMap && embeddedUseCMap) {
  25245. useCMap = embeddedUseCMap;
  25246. }
  25247. if (useCMap) {
  25248. return extendCMap(cMap, fetchBuiltInCMap, useCMap);
  25249. }
  25250. return cMap;
  25251. }
  25252. async function extendCMap(cMap, fetchBuiltInCMap, useCMap) {
  25253. cMap.useCMap = await createBuiltInCMap(useCMap, fetchBuiltInCMap);
  25254. if (cMap.numCodespaceRanges === 0) {
  25255. const useCodespaceRanges = cMap.useCMap.codespaceRanges;
  25256. for (let i = 0; i < useCodespaceRanges.length; i++) {
  25257. cMap.codespaceRanges[i] = useCodespaceRanges[i].slice();
  25258. }
  25259. cMap.numCodespaceRanges = cMap.useCMap.numCodespaceRanges;
  25260. }
  25261. cMap.useCMap.forEach(function (key, value) {
  25262. if (!cMap.contains(key)) {
  25263. cMap.mapOne(key, cMap.useCMap.lookup(key));
  25264. }
  25265. });
  25266. return cMap;
  25267. }
  25268. async function createBuiltInCMap(name, fetchBuiltInCMap) {
  25269. if (name === "Identity-H") {
  25270. return new IdentityCMap(false, 2);
  25271. } else if (name === "Identity-V") {
  25272. return new IdentityCMap(true, 2);
  25273. }
  25274. if (!BUILT_IN_CMAPS.includes(name)) {
  25275. throw new Error("Unknown CMap name: " + name);
  25276. }
  25277. if (!fetchBuiltInCMap) {
  25278. throw new Error("Built-in CMap parameters are not provided.");
  25279. }
  25280. const {
  25281. cMapData,
  25282. compressionType
  25283. } = await fetchBuiltInCMap(name);
  25284. const cMap = new CMap(true);
  25285. if (compressionType === _util.CMapCompressionType.BINARY) {
  25286. return new BinaryCMapReader().process(cMapData, cMap, useCMap => {
  25287. return extendCMap(cMap, fetchBuiltInCMap, useCMap);
  25288. });
  25289. }
  25290. if (compressionType === _util.CMapCompressionType.NONE) {
  25291. const lexer = new _parser.Lexer(new _stream.Stream(cMapData));
  25292. return parseCMap(cMap, lexer, fetchBuiltInCMap, null);
  25293. }
  25294. throw new Error("TODO: Only BINARY/NONE CMap compression is currently supported.");
  25295. }
  25296. return {
  25297. async create(params) {
  25298. const encoding = params.encoding;
  25299. const fetchBuiltInCMap = params.fetchBuiltInCMap;
  25300. const useCMap = params.useCMap;
  25301. if (encoding instanceof _primitives.Name) {
  25302. return createBuiltInCMap(encoding.name, fetchBuiltInCMap);
  25303. } else if (encoding instanceof _base_stream.BaseStream) {
  25304. const parsedCMap = await parseCMap(new CMap(), new _parser.Lexer(encoding), fetchBuiltInCMap, useCMap);
  25305. if (parsedCMap.isIdentityCMap) {
  25306. return createBuiltInCMap(parsedCMap.name, fetchBuiltInCMap);
  25307. }
  25308. return parsedCMap;
  25309. }
  25310. throw new Error("Encoding required.");
  25311. }
  25312. };
  25313. }();
  25314. exports.CMapFactory = CMapFactory;
  25315. /***/ }),
  25316. /* 27 */
  25317. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  25318. Object.defineProperty(exports, "__esModule", ({
  25319. value: true
  25320. }));
  25321. exports.Parser = exports.Linearization = exports.Lexer = void 0;
  25322. var _util = __w_pdfjs_require__(2);
  25323. var _primitives = __w_pdfjs_require__(5);
  25324. var _core_utils = __w_pdfjs_require__(6);
  25325. var _ascii_85_stream = __w_pdfjs_require__(28);
  25326. var _ascii_hex_stream = __w_pdfjs_require__(30);
  25327. var _ccitt_stream = __w_pdfjs_require__(31);
  25328. var _flate_stream = __w_pdfjs_require__(33);
  25329. var _jbig2_stream = __w_pdfjs_require__(34);
  25330. var _jpeg_stream = __w_pdfjs_require__(37);
  25331. var _jpx_stream = __w_pdfjs_require__(39);
  25332. var _lzw_stream = __w_pdfjs_require__(41);
  25333. var _stream = __w_pdfjs_require__(10);
  25334. var _predictor_stream = __w_pdfjs_require__(42);
  25335. var _run_length_stream = __w_pdfjs_require__(43);
  25336. const MAX_LENGTH_TO_CACHE = 1000;
  25337. const MAX_ADLER32_LENGTH = 5552;
  25338. function computeAdler32(bytes) {
  25339. const bytesLength = bytes.length;
  25340. let a = 1,
  25341. b = 0;
  25342. for (let i = 0; i < bytesLength; ++i) {
  25343. a += bytes[i] & 0xff;
  25344. b += a;
  25345. }
  25346. return b % 65521 << 16 | a % 65521;
  25347. }
  25348. class Parser {
  25349. constructor({
  25350. lexer,
  25351. xref,
  25352. allowStreams = false,
  25353. recoveryMode = false
  25354. }) {
  25355. this.lexer = lexer;
  25356. this.xref = xref;
  25357. this.allowStreams = allowStreams;
  25358. this.recoveryMode = recoveryMode;
  25359. this.imageCache = Object.create(null);
  25360. this.refill();
  25361. }
  25362. refill() {
  25363. this.buf1 = this.lexer.getObj();
  25364. this.buf2 = this.lexer.getObj();
  25365. }
  25366. shift() {
  25367. if (this.buf2 instanceof _primitives.Cmd && this.buf2.cmd === "ID") {
  25368. this.buf1 = this.buf2;
  25369. this.buf2 = null;
  25370. } else {
  25371. this.buf1 = this.buf2;
  25372. this.buf2 = this.lexer.getObj();
  25373. }
  25374. }
  25375. tryShift() {
  25376. try {
  25377. this.shift();
  25378. return true;
  25379. } catch (e) {
  25380. if (e instanceof _core_utils.MissingDataException) {
  25381. throw e;
  25382. }
  25383. return false;
  25384. }
  25385. }
  25386. getObj(cipherTransform = null) {
  25387. const buf1 = this.buf1;
  25388. this.shift();
  25389. if (buf1 instanceof _primitives.Cmd) {
  25390. switch (buf1.cmd) {
  25391. case "BI":
  25392. return this.makeInlineImage(cipherTransform);
  25393. case "[":
  25394. const array = [];
  25395. while (!(0, _primitives.isCmd)(this.buf1, "]") && this.buf1 !== _primitives.EOF) {
  25396. array.push(this.getObj(cipherTransform));
  25397. }
  25398. if (this.buf1 === _primitives.EOF) {
  25399. if (this.recoveryMode) {
  25400. return array;
  25401. }
  25402. throw new _core_utils.ParserEOFException("End of file inside array.");
  25403. }
  25404. this.shift();
  25405. return array;
  25406. case "<<":
  25407. const dict = new _primitives.Dict(this.xref);
  25408. while (!(0, _primitives.isCmd)(this.buf1, ">>") && this.buf1 !== _primitives.EOF) {
  25409. if (!(this.buf1 instanceof _primitives.Name)) {
  25410. (0, _util.info)("Malformed dictionary: key must be a name object");
  25411. this.shift();
  25412. continue;
  25413. }
  25414. const key = this.buf1.name;
  25415. this.shift();
  25416. if (this.buf1 === _primitives.EOF) {
  25417. break;
  25418. }
  25419. dict.set(key, this.getObj(cipherTransform));
  25420. }
  25421. if (this.buf1 === _primitives.EOF) {
  25422. if (this.recoveryMode) {
  25423. return dict;
  25424. }
  25425. throw new _core_utils.ParserEOFException("End of file inside dictionary.");
  25426. }
  25427. if ((0, _primitives.isCmd)(this.buf2, "stream")) {
  25428. return this.allowStreams ? this.makeStream(dict, cipherTransform) : dict;
  25429. }
  25430. this.shift();
  25431. return dict;
  25432. default:
  25433. return buf1;
  25434. }
  25435. }
  25436. if (Number.isInteger(buf1)) {
  25437. if (Number.isInteger(this.buf1) && (0, _primitives.isCmd)(this.buf2, "R")) {
  25438. const ref = _primitives.Ref.get(buf1, this.buf1);
  25439. this.shift();
  25440. this.shift();
  25441. return ref;
  25442. }
  25443. return buf1;
  25444. }
  25445. if (typeof buf1 === "string") {
  25446. if (cipherTransform) {
  25447. return cipherTransform.decryptString(buf1);
  25448. }
  25449. return buf1;
  25450. }
  25451. return buf1;
  25452. }
  25453. findDefaultInlineStreamEnd(stream) {
  25454. const E = 0x45,
  25455. I = 0x49,
  25456. SPACE = 0x20,
  25457. LF = 0xa,
  25458. CR = 0xd,
  25459. NUL = 0x0;
  25460. const lexer = this.lexer,
  25461. startPos = stream.pos,
  25462. n = 10;
  25463. let state = 0,
  25464. ch,
  25465. maybeEIPos;
  25466. while ((ch = stream.getByte()) !== -1) {
  25467. if (state === 0) {
  25468. state = ch === E ? 1 : 0;
  25469. } else if (state === 1) {
  25470. state = ch === I ? 2 : 0;
  25471. } else {
  25472. (0, _util.assert)(state === 2, "findDefaultInlineStreamEnd - invalid state.");
  25473. if (ch === SPACE || ch === LF || ch === CR) {
  25474. maybeEIPos = stream.pos;
  25475. const followingBytes = stream.peekBytes(n);
  25476. for (let i = 0, ii = followingBytes.length; i < ii; i++) {
  25477. ch = followingBytes[i];
  25478. if (ch === NUL && followingBytes[i + 1] !== NUL) {
  25479. continue;
  25480. }
  25481. if (ch !== LF && ch !== CR && (ch < SPACE || ch > 0x7f)) {
  25482. state = 0;
  25483. break;
  25484. }
  25485. }
  25486. if (state !== 2) {
  25487. continue;
  25488. }
  25489. if (lexer.knownCommands) {
  25490. const nextObj = lexer.peekObj();
  25491. if (nextObj instanceof _primitives.Cmd && !lexer.knownCommands[nextObj.cmd]) {
  25492. state = 0;
  25493. }
  25494. } else {
  25495. (0, _util.warn)("findDefaultInlineStreamEnd - `lexer.knownCommands` is undefined.");
  25496. }
  25497. if (state === 2) {
  25498. break;
  25499. }
  25500. } else {
  25501. state = 0;
  25502. }
  25503. }
  25504. }
  25505. if (ch === -1) {
  25506. (0, _util.warn)("findDefaultInlineStreamEnd: " + "Reached the end of the stream without finding a valid EI marker");
  25507. if (maybeEIPos) {
  25508. (0, _util.warn)('... trying to recover by using the last "EI" occurrence.');
  25509. stream.skip(-(stream.pos - maybeEIPos));
  25510. }
  25511. }
  25512. let endOffset = 4;
  25513. stream.skip(-endOffset);
  25514. ch = stream.peekByte();
  25515. stream.skip(endOffset);
  25516. if (!(0, _core_utils.isWhiteSpace)(ch)) {
  25517. endOffset--;
  25518. }
  25519. return stream.pos - endOffset - startPos;
  25520. }
  25521. findDCTDecodeInlineStreamEnd(stream) {
  25522. const startPos = stream.pos;
  25523. let foundEOI = false,
  25524. b,
  25525. markerLength;
  25526. while ((b = stream.getByte()) !== -1) {
  25527. if (b !== 0xff) {
  25528. continue;
  25529. }
  25530. switch (stream.getByte()) {
  25531. case 0x00:
  25532. break;
  25533. case 0xff:
  25534. stream.skip(-1);
  25535. break;
  25536. case 0xd9:
  25537. foundEOI = true;
  25538. break;
  25539. case 0xc0:
  25540. case 0xc1:
  25541. case 0xc2:
  25542. case 0xc3:
  25543. case 0xc5:
  25544. case 0xc6:
  25545. case 0xc7:
  25546. case 0xc9:
  25547. case 0xca:
  25548. case 0xcb:
  25549. case 0xcd:
  25550. case 0xce:
  25551. case 0xcf:
  25552. case 0xc4:
  25553. case 0xcc:
  25554. case 0xda:
  25555. case 0xdb:
  25556. case 0xdc:
  25557. case 0xdd:
  25558. case 0xde:
  25559. case 0xdf:
  25560. case 0xe0:
  25561. case 0xe1:
  25562. case 0xe2:
  25563. case 0xe3:
  25564. case 0xe4:
  25565. case 0xe5:
  25566. case 0xe6:
  25567. case 0xe7:
  25568. case 0xe8:
  25569. case 0xe9:
  25570. case 0xea:
  25571. case 0xeb:
  25572. case 0xec:
  25573. case 0xed:
  25574. case 0xee:
  25575. case 0xef:
  25576. case 0xfe:
  25577. markerLength = stream.getUint16();
  25578. if (markerLength > 2) {
  25579. stream.skip(markerLength - 2);
  25580. } else {
  25581. stream.skip(-2);
  25582. }
  25583. break;
  25584. }
  25585. if (foundEOI) {
  25586. break;
  25587. }
  25588. }
  25589. const length = stream.pos - startPos;
  25590. if (b === -1) {
  25591. (0, _util.warn)("Inline DCTDecode image stream: " + "EOI marker not found, searching for /EI/ instead.");
  25592. stream.skip(-length);
  25593. return this.findDefaultInlineStreamEnd(stream);
  25594. }
  25595. this.inlineStreamSkipEI(stream);
  25596. return length;
  25597. }
  25598. findASCII85DecodeInlineStreamEnd(stream) {
  25599. const TILDE = 0x7e,
  25600. GT = 0x3e;
  25601. const startPos = stream.pos;
  25602. let ch;
  25603. while ((ch = stream.getByte()) !== -1) {
  25604. if (ch === TILDE) {
  25605. const tildePos = stream.pos;
  25606. ch = stream.peekByte();
  25607. while ((0, _core_utils.isWhiteSpace)(ch)) {
  25608. stream.skip();
  25609. ch = stream.peekByte();
  25610. }
  25611. if (ch === GT) {
  25612. stream.skip();
  25613. break;
  25614. }
  25615. if (stream.pos > tildePos) {
  25616. const maybeEI = stream.peekBytes(2);
  25617. if (maybeEI[0] === 0x45 && maybeEI[1] === 0x49) {
  25618. break;
  25619. }
  25620. }
  25621. }
  25622. }
  25623. const length = stream.pos - startPos;
  25624. if (ch === -1) {
  25625. (0, _util.warn)("Inline ASCII85Decode image stream: " + "EOD marker not found, searching for /EI/ instead.");
  25626. stream.skip(-length);
  25627. return this.findDefaultInlineStreamEnd(stream);
  25628. }
  25629. this.inlineStreamSkipEI(stream);
  25630. return length;
  25631. }
  25632. findASCIIHexDecodeInlineStreamEnd(stream) {
  25633. const GT = 0x3e;
  25634. const startPos = stream.pos;
  25635. let ch;
  25636. while ((ch = stream.getByte()) !== -1) {
  25637. if (ch === GT) {
  25638. break;
  25639. }
  25640. }
  25641. const length = stream.pos - startPos;
  25642. if (ch === -1) {
  25643. (0, _util.warn)("Inline ASCIIHexDecode image stream: " + "EOD marker not found, searching for /EI/ instead.");
  25644. stream.skip(-length);
  25645. return this.findDefaultInlineStreamEnd(stream);
  25646. }
  25647. this.inlineStreamSkipEI(stream);
  25648. return length;
  25649. }
  25650. inlineStreamSkipEI(stream) {
  25651. const E = 0x45,
  25652. I = 0x49;
  25653. let state = 0,
  25654. ch;
  25655. while ((ch = stream.getByte()) !== -1) {
  25656. if (state === 0) {
  25657. state = ch === E ? 1 : 0;
  25658. } else if (state === 1) {
  25659. state = ch === I ? 2 : 0;
  25660. } else if (state === 2) {
  25661. break;
  25662. }
  25663. }
  25664. }
  25665. makeInlineImage(cipherTransform) {
  25666. const lexer = this.lexer;
  25667. const stream = lexer.stream;
  25668. const dict = new _primitives.Dict(this.xref);
  25669. let dictLength;
  25670. while (!(0, _primitives.isCmd)(this.buf1, "ID") && this.buf1 !== _primitives.EOF) {
  25671. if (!(this.buf1 instanceof _primitives.Name)) {
  25672. throw new _util.FormatError("Dictionary key must be a name object");
  25673. }
  25674. const key = this.buf1.name;
  25675. this.shift();
  25676. if (this.buf1 === _primitives.EOF) {
  25677. break;
  25678. }
  25679. dict.set(key, this.getObj(cipherTransform));
  25680. }
  25681. if (lexer.beginInlineImagePos !== -1) {
  25682. dictLength = stream.pos - lexer.beginInlineImagePos;
  25683. }
  25684. const filter = dict.get("F", "Filter");
  25685. let filterName;
  25686. if (filter instanceof _primitives.Name) {
  25687. filterName = filter.name;
  25688. } else if (Array.isArray(filter)) {
  25689. const filterZero = this.xref.fetchIfRef(filter[0]);
  25690. if (filterZero instanceof _primitives.Name) {
  25691. filterName = filterZero.name;
  25692. }
  25693. }
  25694. const startPos = stream.pos;
  25695. let length;
  25696. switch (filterName) {
  25697. case "DCT":
  25698. case "DCTDecode":
  25699. length = this.findDCTDecodeInlineStreamEnd(stream);
  25700. break;
  25701. case "A85":
  25702. case "ASCII85Decode":
  25703. length = this.findASCII85DecodeInlineStreamEnd(stream);
  25704. break;
  25705. case "AHx":
  25706. case "ASCIIHexDecode":
  25707. length = this.findASCIIHexDecodeInlineStreamEnd(stream);
  25708. break;
  25709. default:
  25710. length = this.findDefaultInlineStreamEnd(stream);
  25711. }
  25712. let imageStream = stream.makeSubStream(startPos, length, dict);
  25713. let cacheKey;
  25714. if (length < MAX_LENGTH_TO_CACHE && dictLength < MAX_ADLER32_LENGTH) {
  25715. const imageBytes = imageStream.getBytes();
  25716. imageStream.reset();
  25717. const initialStreamPos = stream.pos;
  25718. stream.pos = lexer.beginInlineImagePos;
  25719. const dictBytes = stream.getBytes(dictLength);
  25720. stream.pos = initialStreamPos;
  25721. cacheKey = computeAdler32(imageBytes) + "_" + computeAdler32(dictBytes);
  25722. const cacheEntry = this.imageCache[cacheKey];
  25723. if (cacheEntry !== undefined) {
  25724. this.buf2 = _primitives.Cmd.get("EI");
  25725. this.shift();
  25726. cacheEntry.reset();
  25727. return cacheEntry;
  25728. }
  25729. }
  25730. if (cipherTransform) {
  25731. imageStream = cipherTransform.createStream(imageStream, length);
  25732. }
  25733. imageStream = this.filter(imageStream, dict, length);
  25734. imageStream.dict = dict;
  25735. if (cacheKey !== undefined) {
  25736. imageStream.cacheKey = `inline_${length}_${cacheKey}`;
  25737. this.imageCache[cacheKey] = imageStream;
  25738. }
  25739. this.buf2 = _primitives.Cmd.get("EI");
  25740. this.shift();
  25741. return imageStream;
  25742. }
  25743. _findStreamLength(startPos, signature) {
  25744. const {
  25745. stream
  25746. } = this.lexer;
  25747. stream.pos = startPos;
  25748. const SCAN_BLOCK_LENGTH = 2048;
  25749. const signatureLength = signature.length;
  25750. while (stream.pos < stream.end) {
  25751. const scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH);
  25752. const scanLength = scanBytes.length - signatureLength;
  25753. if (scanLength <= 0) {
  25754. break;
  25755. }
  25756. let pos = 0;
  25757. while (pos < scanLength) {
  25758. let j = 0;
  25759. while (j < signatureLength && scanBytes[pos + j] === signature[j]) {
  25760. j++;
  25761. }
  25762. if (j >= signatureLength) {
  25763. stream.pos += pos;
  25764. return stream.pos - startPos;
  25765. }
  25766. pos++;
  25767. }
  25768. stream.pos += scanLength;
  25769. }
  25770. return -1;
  25771. }
  25772. makeStream(dict, cipherTransform) {
  25773. const lexer = this.lexer;
  25774. let stream = lexer.stream;
  25775. lexer.skipToNextLine();
  25776. const startPos = stream.pos - 1;
  25777. let length = dict.get("Length");
  25778. if (!Number.isInteger(length)) {
  25779. (0, _util.info)(`Bad length "${length && length.toString()}" in stream.`);
  25780. length = 0;
  25781. }
  25782. stream.pos = startPos + length;
  25783. lexer.nextChar();
  25784. if (this.tryShift() && (0, _primitives.isCmd)(this.buf2, "endstream")) {
  25785. this.shift();
  25786. } else {
  25787. const ENDSTREAM_SIGNATURE = new Uint8Array([0x65, 0x6e, 0x64, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d]);
  25788. let actualLength = this._findStreamLength(startPos, ENDSTREAM_SIGNATURE);
  25789. if (actualLength < 0) {
  25790. const MAX_TRUNCATION = 1;
  25791. for (let i = 1; i <= MAX_TRUNCATION; i++) {
  25792. const end = ENDSTREAM_SIGNATURE.length - i;
  25793. const TRUNCATED_SIGNATURE = ENDSTREAM_SIGNATURE.slice(0, end);
  25794. const maybeLength = this._findStreamLength(startPos, TRUNCATED_SIGNATURE);
  25795. if (maybeLength >= 0) {
  25796. const lastByte = stream.peekBytes(end + 1)[end];
  25797. if (!(0, _core_utils.isWhiteSpace)(lastByte)) {
  25798. break;
  25799. }
  25800. (0, _util.info)(`Found "${(0, _util.bytesToString)(TRUNCATED_SIGNATURE)}" when ` + "searching for endstream command.");
  25801. actualLength = maybeLength;
  25802. break;
  25803. }
  25804. }
  25805. if (actualLength < 0) {
  25806. throw new _util.FormatError("Missing endstream command.");
  25807. }
  25808. }
  25809. length = actualLength;
  25810. lexer.nextChar();
  25811. this.shift();
  25812. this.shift();
  25813. }
  25814. this.shift();
  25815. stream = stream.makeSubStream(startPos, length, dict);
  25816. if (cipherTransform) {
  25817. stream = cipherTransform.createStream(stream, length);
  25818. }
  25819. stream = this.filter(stream, dict, length);
  25820. stream.dict = dict;
  25821. return stream;
  25822. }
  25823. filter(stream, dict, length) {
  25824. let filter = dict.get("F", "Filter");
  25825. let params = dict.get("DP", "DecodeParms");
  25826. if (filter instanceof _primitives.Name) {
  25827. if (Array.isArray(params)) {
  25828. (0, _util.warn)("/DecodeParms should not be an Array, when /Filter is a Name.");
  25829. }
  25830. return this.makeFilter(stream, filter.name, length, params);
  25831. }
  25832. let maybeLength = length;
  25833. if (Array.isArray(filter)) {
  25834. const filterArray = filter;
  25835. const paramsArray = params;
  25836. for (let i = 0, ii = filterArray.length; i < ii; ++i) {
  25837. filter = this.xref.fetchIfRef(filterArray[i]);
  25838. if (!(filter instanceof _primitives.Name)) {
  25839. throw new _util.FormatError(`Bad filter name "${filter}"`);
  25840. }
  25841. params = null;
  25842. if (Array.isArray(paramsArray) && i in paramsArray) {
  25843. params = this.xref.fetchIfRef(paramsArray[i]);
  25844. }
  25845. stream = this.makeFilter(stream, filter.name, maybeLength, params);
  25846. maybeLength = null;
  25847. }
  25848. }
  25849. return stream;
  25850. }
  25851. makeFilter(stream, name, maybeLength, params) {
  25852. if (maybeLength === 0) {
  25853. (0, _util.warn)(`Empty "${name}" stream.`);
  25854. return new _stream.NullStream();
  25855. }
  25856. const xrefStats = this.xref.stats;
  25857. try {
  25858. switch (name) {
  25859. case "Fl":
  25860. case "FlateDecode":
  25861. xrefStats.addStreamType(_util.StreamType.FLATE);
  25862. if (params) {
  25863. return new _predictor_stream.PredictorStream(new _flate_stream.FlateStream(stream, maybeLength), maybeLength, params);
  25864. }
  25865. return new _flate_stream.FlateStream(stream, maybeLength);
  25866. case "LZW":
  25867. case "LZWDecode":
  25868. xrefStats.addStreamType(_util.StreamType.LZW);
  25869. let earlyChange = 1;
  25870. if (params) {
  25871. if (params.has("EarlyChange")) {
  25872. earlyChange = params.get("EarlyChange");
  25873. }
  25874. return new _predictor_stream.PredictorStream(new _lzw_stream.LZWStream(stream, maybeLength, earlyChange), maybeLength, params);
  25875. }
  25876. return new _lzw_stream.LZWStream(stream, maybeLength, earlyChange);
  25877. case "DCT":
  25878. case "DCTDecode":
  25879. xrefStats.addStreamType(_util.StreamType.DCT);
  25880. return new _jpeg_stream.JpegStream(stream, maybeLength, params);
  25881. case "JPX":
  25882. case "JPXDecode":
  25883. xrefStats.addStreamType(_util.StreamType.JPX);
  25884. return new _jpx_stream.JpxStream(stream, maybeLength, params);
  25885. case "A85":
  25886. case "ASCII85Decode":
  25887. xrefStats.addStreamType(_util.StreamType.A85);
  25888. return new _ascii_85_stream.Ascii85Stream(stream, maybeLength);
  25889. case "AHx":
  25890. case "ASCIIHexDecode":
  25891. xrefStats.addStreamType(_util.StreamType.AHX);
  25892. return new _ascii_hex_stream.AsciiHexStream(stream, maybeLength);
  25893. case "CCF":
  25894. case "CCITTFaxDecode":
  25895. xrefStats.addStreamType(_util.StreamType.CCF);
  25896. return new _ccitt_stream.CCITTFaxStream(stream, maybeLength, params);
  25897. case "RL":
  25898. case "RunLengthDecode":
  25899. xrefStats.addStreamType(_util.StreamType.RLX);
  25900. return new _run_length_stream.RunLengthStream(stream, maybeLength);
  25901. case "JBIG2Decode":
  25902. xrefStats.addStreamType(_util.StreamType.JBIG);
  25903. return new _jbig2_stream.Jbig2Stream(stream, maybeLength, params);
  25904. }
  25905. (0, _util.warn)(`Filter "${name}" is not supported.`);
  25906. return stream;
  25907. } catch (ex) {
  25908. if (ex instanceof _core_utils.MissingDataException) {
  25909. throw ex;
  25910. }
  25911. (0, _util.warn)(`Invalid stream: "${ex}"`);
  25912. return new _stream.NullStream();
  25913. }
  25914. }
  25915. }
  25916. exports.Parser = Parser;
  25917. 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];
  25918. function toHexDigit(ch) {
  25919. if (ch >= 0x30 && ch <= 0x39) {
  25920. return ch & 0x0f;
  25921. }
  25922. if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {
  25923. return (ch & 0x0f) + 9;
  25924. }
  25925. return -1;
  25926. }
  25927. class Lexer {
  25928. constructor(stream, knownCommands = null) {
  25929. this.stream = stream;
  25930. this.nextChar();
  25931. this.strBuf = [];
  25932. this.knownCommands = knownCommands;
  25933. this._hexStringNumWarn = 0;
  25934. this.beginInlineImagePos = -1;
  25935. }
  25936. nextChar() {
  25937. return this.currentChar = this.stream.getByte();
  25938. }
  25939. peekChar() {
  25940. return this.stream.peekByte();
  25941. }
  25942. getNumber() {
  25943. let ch = this.currentChar;
  25944. let eNotation = false;
  25945. let divideBy = 0;
  25946. let sign = 0;
  25947. if (ch === 0x2d) {
  25948. sign = -1;
  25949. ch = this.nextChar();
  25950. if (ch === 0x2d) {
  25951. ch = this.nextChar();
  25952. }
  25953. } else if (ch === 0x2b) {
  25954. sign = 1;
  25955. ch = this.nextChar();
  25956. }
  25957. if (ch === 0x0a || ch === 0x0d) {
  25958. do {
  25959. ch = this.nextChar();
  25960. } while (ch === 0x0a || ch === 0x0d);
  25961. }
  25962. if (ch === 0x2e) {
  25963. divideBy = 10;
  25964. ch = this.nextChar();
  25965. }
  25966. if (ch < 0x30 || ch > 0x39) {
  25967. if ((0, _core_utils.isWhiteSpace)(ch) || ch === -1) {
  25968. if (divideBy === 10 && sign === 0) {
  25969. (0, _util.warn)("Lexer.getNumber - treating a single decimal point as zero.");
  25970. return 0;
  25971. }
  25972. if (divideBy === 0 && sign === -1) {
  25973. (0, _util.warn)("Lexer.getNumber - treating a single minus sign as zero.");
  25974. return 0;
  25975. }
  25976. }
  25977. throw new _util.FormatError(`Invalid number: ${String.fromCharCode(ch)} (charCode ${ch})`);
  25978. }
  25979. sign = sign || 1;
  25980. let baseValue = ch - 0x30;
  25981. let powerValue = 0;
  25982. let powerValueSign = 1;
  25983. while ((ch = this.nextChar()) >= 0) {
  25984. if (ch >= 0x30 && ch <= 0x39) {
  25985. const currentDigit = ch - 0x30;
  25986. if (eNotation) {
  25987. powerValue = powerValue * 10 + currentDigit;
  25988. } else {
  25989. if (divideBy !== 0) {
  25990. divideBy *= 10;
  25991. }
  25992. baseValue = baseValue * 10 + currentDigit;
  25993. }
  25994. } else if (ch === 0x2e) {
  25995. if (divideBy === 0) {
  25996. divideBy = 1;
  25997. } else {
  25998. break;
  25999. }
  26000. } else if (ch === 0x2d) {
  26001. (0, _util.warn)("Badly formatted number: minus sign in the middle");
  26002. } else if (ch === 0x45 || ch === 0x65) {
  26003. ch = this.peekChar();
  26004. if (ch === 0x2b || ch === 0x2d) {
  26005. powerValueSign = ch === 0x2d ? -1 : 1;
  26006. this.nextChar();
  26007. } else if (ch < 0x30 || ch > 0x39) {
  26008. break;
  26009. }
  26010. eNotation = true;
  26011. } else {
  26012. break;
  26013. }
  26014. }
  26015. if (divideBy !== 0) {
  26016. baseValue /= divideBy;
  26017. }
  26018. if (eNotation) {
  26019. baseValue *= 10 ** (powerValueSign * powerValue);
  26020. }
  26021. return sign * baseValue;
  26022. }
  26023. getString() {
  26024. let numParen = 1;
  26025. let done = false;
  26026. const strBuf = this.strBuf;
  26027. strBuf.length = 0;
  26028. let ch = this.nextChar();
  26029. while (true) {
  26030. let charBuffered = false;
  26031. switch (ch | 0) {
  26032. case -1:
  26033. (0, _util.warn)("Unterminated string");
  26034. done = true;
  26035. break;
  26036. case 0x28:
  26037. ++numParen;
  26038. strBuf.push("(");
  26039. break;
  26040. case 0x29:
  26041. if (--numParen === 0) {
  26042. this.nextChar();
  26043. done = true;
  26044. } else {
  26045. strBuf.push(")");
  26046. }
  26047. break;
  26048. case 0x5c:
  26049. ch = this.nextChar();
  26050. switch (ch) {
  26051. case -1:
  26052. (0, _util.warn)("Unterminated string");
  26053. done = true;
  26054. break;
  26055. case 0x6e:
  26056. strBuf.push("\n");
  26057. break;
  26058. case 0x72:
  26059. strBuf.push("\r");
  26060. break;
  26061. case 0x74:
  26062. strBuf.push("\t");
  26063. break;
  26064. case 0x62:
  26065. strBuf.push("\b");
  26066. break;
  26067. case 0x66:
  26068. strBuf.push("\f");
  26069. break;
  26070. case 0x5c:
  26071. case 0x28:
  26072. case 0x29:
  26073. strBuf.push(String.fromCharCode(ch));
  26074. break;
  26075. case 0x30:
  26076. case 0x31:
  26077. case 0x32:
  26078. case 0x33:
  26079. case 0x34:
  26080. case 0x35:
  26081. case 0x36:
  26082. case 0x37:
  26083. let x = ch & 0x0f;
  26084. ch = this.nextChar();
  26085. charBuffered = true;
  26086. if (ch >= 0x30 && ch <= 0x37) {
  26087. x = (x << 3) + (ch & 0x0f);
  26088. ch = this.nextChar();
  26089. if (ch >= 0x30 && ch <= 0x37) {
  26090. charBuffered = false;
  26091. x = (x << 3) + (ch & 0x0f);
  26092. }
  26093. }
  26094. strBuf.push(String.fromCharCode(x));
  26095. break;
  26096. case 0x0d:
  26097. if (this.peekChar() === 0x0a) {
  26098. this.nextChar();
  26099. }
  26100. break;
  26101. case 0x0a:
  26102. break;
  26103. default:
  26104. strBuf.push(String.fromCharCode(ch));
  26105. break;
  26106. }
  26107. break;
  26108. default:
  26109. strBuf.push(String.fromCharCode(ch));
  26110. break;
  26111. }
  26112. if (done) {
  26113. break;
  26114. }
  26115. if (!charBuffered) {
  26116. ch = this.nextChar();
  26117. }
  26118. }
  26119. return strBuf.join("");
  26120. }
  26121. getName() {
  26122. let ch, previousCh;
  26123. const strBuf = this.strBuf;
  26124. strBuf.length = 0;
  26125. while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
  26126. if (ch === 0x23) {
  26127. ch = this.nextChar();
  26128. if (specialChars[ch]) {
  26129. (0, _util.warn)("Lexer_getName: " + "NUMBER SIGN (#) should be followed by a hexadecimal number.");
  26130. strBuf.push("#");
  26131. break;
  26132. }
  26133. const x = toHexDigit(ch);
  26134. if (x !== -1) {
  26135. previousCh = ch;
  26136. ch = this.nextChar();
  26137. const x2 = toHexDigit(ch);
  26138. if (x2 === -1) {
  26139. (0, _util.warn)(`Lexer_getName: Illegal digit (${String.fromCharCode(ch)}) ` + "in hexadecimal number.");
  26140. strBuf.push("#", String.fromCharCode(previousCh));
  26141. if (specialChars[ch]) {
  26142. break;
  26143. }
  26144. strBuf.push(String.fromCharCode(ch));
  26145. continue;
  26146. }
  26147. strBuf.push(String.fromCharCode(x << 4 | x2));
  26148. } else {
  26149. strBuf.push("#", String.fromCharCode(ch));
  26150. }
  26151. } else {
  26152. strBuf.push(String.fromCharCode(ch));
  26153. }
  26154. }
  26155. if (strBuf.length > 127) {
  26156. (0, _util.warn)(`Name token is longer than allowed by the spec: ${strBuf.length}`);
  26157. }
  26158. return _primitives.Name.get(strBuf.join(""));
  26159. }
  26160. _hexStringWarn(ch) {
  26161. const MAX_HEX_STRING_NUM_WARN = 5;
  26162. if (this._hexStringNumWarn++ === MAX_HEX_STRING_NUM_WARN) {
  26163. (0, _util.warn)("getHexString - ignoring additional invalid characters.");
  26164. return;
  26165. }
  26166. if (this._hexStringNumWarn > MAX_HEX_STRING_NUM_WARN) {
  26167. return;
  26168. }
  26169. (0, _util.warn)(`getHexString - ignoring invalid character: ${ch}`);
  26170. }
  26171. getHexString() {
  26172. const strBuf = this.strBuf;
  26173. strBuf.length = 0;
  26174. let ch = this.currentChar;
  26175. let isFirstHex = true;
  26176. let firstDigit, secondDigit;
  26177. this._hexStringNumWarn = 0;
  26178. while (true) {
  26179. if (ch < 0) {
  26180. (0, _util.warn)("Unterminated hex string");
  26181. break;
  26182. } else if (ch === 0x3e) {
  26183. this.nextChar();
  26184. break;
  26185. } else if (specialChars[ch] === 1) {
  26186. ch = this.nextChar();
  26187. continue;
  26188. } else {
  26189. if (isFirstHex) {
  26190. firstDigit = toHexDigit(ch);
  26191. if (firstDigit === -1) {
  26192. this._hexStringWarn(ch);
  26193. ch = this.nextChar();
  26194. continue;
  26195. }
  26196. } else {
  26197. secondDigit = toHexDigit(ch);
  26198. if (secondDigit === -1) {
  26199. this._hexStringWarn(ch);
  26200. ch = this.nextChar();
  26201. continue;
  26202. }
  26203. strBuf.push(String.fromCharCode(firstDigit << 4 | secondDigit));
  26204. }
  26205. isFirstHex = !isFirstHex;
  26206. ch = this.nextChar();
  26207. }
  26208. }
  26209. return strBuf.join("");
  26210. }
  26211. getObj() {
  26212. let comment = false;
  26213. let ch = this.currentChar;
  26214. while (true) {
  26215. if (ch < 0) {
  26216. return _primitives.EOF;
  26217. }
  26218. if (comment) {
  26219. if (ch === 0x0a || ch === 0x0d) {
  26220. comment = false;
  26221. }
  26222. } else if (ch === 0x25) {
  26223. comment = true;
  26224. } else if (specialChars[ch] !== 1) {
  26225. break;
  26226. }
  26227. ch = this.nextChar();
  26228. }
  26229. switch (ch | 0) {
  26230. case 0x30:
  26231. case 0x31:
  26232. case 0x32:
  26233. case 0x33:
  26234. case 0x34:
  26235. case 0x35:
  26236. case 0x36:
  26237. case 0x37:
  26238. case 0x38:
  26239. case 0x39:
  26240. case 0x2b:
  26241. case 0x2d:
  26242. case 0x2e:
  26243. return this.getNumber();
  26244. case 0x28:
  26245. return this.getString();
  26246. case 0x2f:
  26247. return this.getName();
  26248. case 0x5b:
  26249. this.nextChar();
  26250. return _primitives.Cmd.get("[");
  26251. case 0x5d:
  26252. this.nextChar();
  26253. return _primitives.Cmd.get("]");
  26254. case 0x3c:
  26255. ch = this.nextChar();
  26256. if (ch === 0x3c) {
  26257. this.nextChar();
  26258. return _primitives.Cmd.get("<<");
  26259. }
  26260. return this.getHexString();
  26261. case 0x3e:
  26262. ch = this.nextChar();
  26263. if (ch === 0x3e) {
  26264. this.nextChar();
  26265. return _primitives.Cmd.get(">>");
  26266. }
  26267. return _primitives.Cmd.get(">");
  26268. case 0x7b:
  26269. this.nextChar();
  26270. return _primitives.Cmd.get("{");
  26271. case 0x7d:
  26272. this.nextChar();
  26273. return _primitives.Cmd.get("}");
  26274. case 0x29:
  26275. this.nextChar();
  26276. throw new _util.FormatError(`Illegal character: ${ch}`);
  26277. }
  26278. let str = String.fromCharCode(ch);
  26279. if (ch < 0x20 || ch > 0x7f) {
  26280. const nextCh = this.peekChar();
  26281. if (nextCh >= 0x20 && nextCh <= 0x7f) {
  26282. this.nextChar();
  26283. return _primitives.Cmd.get(str);
  26284. }
  26285. }
  26286. const knownCommands = this.knownCommands;
  26287. let knownCommandFound = knownCommands && knownCommands[str] !== undefined;
  26288. while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
  26289. const possibleCommand = str + String.fromCharCode(ch);
  26290. if (knownCommandFound && knownCommands[possibleCommand] === undefined) {
  26291. break;
  26292. }
  26293. if (str.length === 128) {
  26294. throw new _util.FormatError(`Command token too long: ${str.length}`);
  26295. }
  26296. str = possibleCommand;
  26297. knownCommandFound = knownCommands && knownCommands[str] !== undefined;
  26298. }
  26299. if (str === "true") {
  26300. return true;
  26301. }
  26302. if (str === "false") {
  26303. return false;
  26304. }
  26305. if (str === "null") {
  26306. return null;
  26307. }
  26308. if (str === "BI") {
  26309. this.beginInlineImagePos = this.stream.pos;
  26310. }
  26311. return _primitives.Cmd.get(str);
  26312. }
  26313. peekObj() {
  26314. const streamPos = this.stream.pos,
  26315. currentChar = this.currentChar,
  26316. beginInlineImagePos = this.beginInlineImagePos;
  26317. let nextObj;
  26318. try {
  26319. nextObj = this.getObj();
  26320. } catch (ex) {
  26321. if (ex instanceof _core_utils.MissingDataException) {
  26322. throw ex;
  26323. }
  26324. (0, _util.warn)(`peekObj: ${ex}`);
  26325. }
  26326. this.stream.pos = streamPos;
  26327. this.currentChar = currentChar;
  26328. this.beginInlineImagePos = beginInlineImagePos;
  26329. return nextObj;
  26330. }
  26331. skipToNextLine() {
  26332. let ch = this.currentChar;
  26333. while (ch >= 0) {
  26334. if (ch === 0x0d) {
  26335. ch = this.nextChar();
  26336. if (ch === 0x0a) {
  26337. this.nextChar();
  26338. }
  26339. break;
  26340. } else if (ch === 0x0a) {
  26341. this.nextChar();
  26342. break;
  26343. }
  26344. ch = this.nextChar();
  26345. }
  26346. }
  26347. }
  26348. exports.Lexer = Lexer;
  26349. class Linearization {
  26350. static create(stream) {
  26351. function getInt(linDict, name, allowZeroValue = false) {
  26352. const obj = linDict.get(name);
  26353. if (Number.isInteger(obj) && (allowZeroValue ? obj >= 0 : obj > 0)) {
  26354. return obj;
  26355. }
  26356. throw new Error(`The "${name}" parameter in the linearization ` + "dictionary is invalid.");
  26357. }
  26358. function getHints(linDict) {
  26359. const hints = linDict.get("H");
  26360. let hintsLength;
  26361. if (Array.isArray(hints) && ((hintsLength = hints.length) === 2 || hintsLength === 4)) {
  26362. for (let index = 0; index < hintsLength; index++) {
  26363. const hint = hints[index];
  26364. if (!(Number.isInteger(hint) && hint > 0)) {
  26365. throw new Error(`Hint (${index}) in the linearization dictionary is invalid.`);
  26366. }
  26367. }
  26368. return hints;
  26369. }
  26370. throw new Error("Hint array in the linearization dictionary is invalid.");
  26371. }
  26372. const parser = new Parser({
  26373. lexer: new Lexer(stream),
  26374. xref: null
  26375. });
  26376. const obj1 = parser.getObj();
  26377. const obj2 = parser.getObj();
  26378. const obj3 = parser.getObj();
  26379. const linDict = parser.getObj();
  26380. let obj, length;
  26381. if (!(Number.isInteger(obj1) && Number.isInteger(obj2) && (0, _primitives.isCmd)(obj3, "obj") && linDict instanceof _primitives.Dict && typeof (obj = linDict.get("Linearized")) === "number" && obj > 0)) {
  26382. return null;
  26383. } else if ((length = getInt(linDict, "L")) !== stream.length) {
  26384. throw new Error('The "L" parameter in the linearization dictionary ' + "does not equal the stream length.");
  26385. }
  26386. return {
  26387. length,
  26388. hints: getHints(linDict),
  26389. objectNumberFirst: getInt(linDict, "O"),
  26390. endFirst: getInt(linDict, "E"),
  26391. numPages: getInt(linDict, "N"),
  26392. mainXRefEntriesOffset: getInt(linDict, "T"),
  26393. pageFirst: linDict.has("P") ? getInt(linDict, "P", true) : 0
  26394. };
  26395. }
  26396. }
  26397. exports.Linearization = Linearization;
  26398. /***/ }),
  26399. /* 28 */
  26400. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  26401. Object.defineProperty(exports, "__esModule", ({
  26402. value: true
  26403. }));
  26404. exports.Ascii85Stream = void 0;
  26405. var _decode_stream = __w_pdfjs_require__(29);
  26406. var _core_utils = __w_pdfjs_require__(6);
  26407. class Ascii85Stream extends _decode_stream.DecodeStream {
  26408. constructor(str, maybeLength) {
  26409. if (maybeLength) {
  26410. maybeLength *= 0.8;
  26411. }
  26412. super(maybeLength);
  26413. this.str = str;
  26414. this.dict = str.dict;
  26415. this.input = new Uint8Array(5);
  26416. }
  26417. readBlock() {
  26418. const TILDA_CHAR = 0x7e;
  26419. const Z_LOWER_CHAR = 0x7a;
  26420. const EOF = -1;
  26421. const str = this.str;
  26422. let c = str.getByte();
  26423. while ((0, _core_utils.isWhiteSpace)(c)) {
  26424. c = str.getByte();
  26425. }
  26426. if (c === EOF || c === TILDA_CHAR) {
  26427. this.eof = true;
  26428. return;
  26429. }
  26430. const bufferLength = this.bufferLength;
  26431. let buffer, i;
  26432. if (c === Z_LOWER_CHAR) {
  26433. buffer = this.ensureBuffer(bufferLength + 4);
  26434. for (i = 0; i < 4; ++i) {
  26435. buffer[bufferLength + i] = 0;
  26436. }
  26437. this.bufferLength += 4;
  26438. } else {
  26439. const input = this.input;
  26440. input[0] = c;
  26441. for (i = 1; i < 5; ++i) {
  26442. c = str.getByte();
  26443. while ((0, _core_utils.isWhiteSpace)(c)) {
  26444. c = str.getByte();
  26445. }
  26446. input[i] = c;
  26447. if (c === EOF || c === TILDA_CHAR) {
  26448. break;
  26449. }
  26450. }
  26451. buffer = this.ensureBuffer(bufferLength + i - 1);
  26452. this.bufferLength += i - 1;
  26453. if (i < 5) {
  26454. for (; i < 5; ++i) {
  26455. input[i] = 0x21 + 84;
  26456. }
  26457. this.eof = true;
  26458. }
  26459. let t = 0;
  26460. for (i = 0; i < 5; ++i) {
  26461. t = t * 85 + (input[i] - 0x21);
  26462. }
  26463. for (i = 3; i >= 0; --i) {
  26464. buffer[bufferLength + i] = t & 0xff;
  26465. t >>= 8;
  26466. }
  26467. }
  26468. }
  26469. }
  26470. exports.Ascii85Stream = Ascii85Stream;
  26471. /***/ }),
  26472. /* 29 */
  26473. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  26474. Object.defineProperty(exports, "__esModule", ({
  26475. value: true
  26476. }));
  26477. exports.StreamsSequenceStream = exports.DecodeStream = void 0;
  26478. var _base_stream = __w_pdfjs_require__(7);
  26479. var _stream = __w_pdfjs_require__(10);
  26480. const emptyBuffer = new Uint8Array(0);
  26481. class DecodeStream extends _base_stream.BaseStream {
  26482. constructor(maybeMinBufferLength) {
  26483. super();
  26484. this._rawMinBufferLength = maybeMinBufferLength || 0;
  26485. this.pos = 0;
  26486. this.bufferLength = 0;
  26487. this.eof = false;
  26488. this.buffer = emptyBuffer;
  26489. this.minBufferLength = 512;
  26490. if (maybeMinBufferLength) {
  26491. while (this.minBufferLength < maybeMinBufferLength) {
  26492. this.minBufferLength *= 2;
  26493. }
  26494. }
  26495. }
  26496. get isEmpty() {
  26497. while (!this.eof && this.bufferLength === 0) {
  26498. this.readBlock();
  26499. }
  26500. return this.bufferLength === 0;
  26501. }
  26502. ensureBuffer(requested) {
  26503. const buffer = this.buffer;
  26504. if (requested <= buffer.byteLength) {
  26505. return buffer;
  26506. }
  26507. let size = this.minBufferLength;
  26508. while (size < requested) {
  26509. size *= 2;
  26510. }
  26511. const buffer2 = new Uint8Array(size);
  26512. buffer2.set(buffer);
  26513. return this.buffer = buffer2;
  26514. }
  26515. getByte() {
  26516. const pos = this.pos;
  26517. while (this.bufferLength <= pos) {
  26518. if (this.eof) {
  26519. return -1;
  26520. }
  26521. this.readBlock();
  26522. }
  26523. return this.buffer[this.pos++];
  26524. }
  26525. getBytes(length) {
  26526. const pos = this.pos;
  26527. let end;
  26528. if (length) {
  26529. this.ensureBuffer(pos + length);
  26530. end = pos + length;
  26531. while (!this.eof && this.bufferLength < end) {
  26532. this.readBlock();
  26533. }
  26534. const bufEnd = this.bufferLength;
  26535. if (end > bufEnd) {
  26536. end = bufEnd;
  26537. }
  26538. } else {
  26539. while (!this.eof) {
  26540. this.readBlock();
  26541. }
  26542. end = this.bufferLength;
  26543. }
  26544. this.pos = end;
  26545. return this.buffer.subarray(pos, end);
  26546. }
  26547. reset() {
  26548. this.pos = 0;
  26549. }
  26550. makeSubStream(start, length, dict = null) {
  26551. if (length === undefined) {
  26552. while (!this.eof) {
  26553. this.readBlock();
  26554. }
  26555. } else {
  26556. const end = start + length;
  26557. while (this.bufferLength <= end && !this.eof) {
  26558. this.readBlock();
  26559. }
  26560. }
  26561. return new _stream.Stream(this.buffer, start, length, dict);
  26562. }
  26563. getBaseStreams() {
  26564. return this.str ? this.str.getBaseStreams() : null;
  26565. }
  26566. }
  26567. exports.DecodeStream = DecodeStream;
  26568. class StreamsSequenceStream extends DecodeStream {
  26569. constructor(streams, onError = null) {
  26570. let maybeLength = 0;
  26571. for (const stream of streams) {
  26572. maybeLength += stream instanceof DecodeStream ? stream._rawMinBufferLength : stream.length;
  26573. }
  26574. super(maybeLength);
  26575. this.streams = streams;
  26576. this._onError = onError;
  26577. }
  26578. readBlock() {
  26579. const streams = this.streams;
  26580. if (streams.length === 0) {
  26581. this.eof = true;
  26582. return;
  26583. }
  26584. const stream = streams.shift();
  26585. let chunk;
  26586. try {
  26587. chunk = stream.getBytes();
  26588. } catch (reason) {
  26589. if (this._onError) {
  26590. this._onError(reason, stream.dict && stream.dict.objId);
  26591. return;
  26592. }
  26593. throw reason;
  26594. }
  26595. const bufferLength = this.bufferLength;
  26596. const newLength = bufferLength + chunk.length;
  26597. const buffer = this.ensureBuffer(newLength);
  26598. buffer.set(chunk, bufferLength);
  26599. this.bufferLength = newLength;
  26600. }
  26601. getBaseStreams() {
  26602. const baseStreamsBuf = [];
  26603. for (const stream of this.streams) {
  26604. const baseStreams = stream.getBaseStreams();
  26605. if (baseStreams) {
  26606. baseStreamsBuf.push(...baseStreams);
  26607. }
  26608. }
  26609. return baseStreamsBuf.length > 0 ? baseStreamsBuf : null;
  26610. }
  26611. }
  26612. exports.StreamsSequenceStream = StreamsSequenceStream;
  26613. /***/ }),
  26614. /* 30 */
  26615. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  26616. Object.defineProperty(exports, "__esModule", ({
  26617. value: true
  26618. }));
  26619. exports.AsciiHexStream = void 0;
  26620. var _decode_stream = __w_pdfjs_require__(29);
  26621. class AsciiHexStream extends _decode_stream.DecodeStream {
  26622. constructor(str, maybeLength) {
  26623. if (maybeLength) {
  26624. maybeLength *= 0.5;
  26625. }
  26626. super(maybeLength);
  26627. this.str = str;
  26628. this.dict = str.dict;
  26629. this.firstDigit = -1;
  26630. }
  26631. readBlock() {
  26632. const UPSTREAM_BLOCK_SIZE = 8000;
  26633. const bytes = this.str.getBytes(UPSTREAM_BLOCK_SIZE);
  26634. if (!bytes.length) {
  26635. this.eof = true;
  26636. return;
  26637. }
  26638. const maxDecodeLength = bytes.length + 1 >> 1;
  26639. const buffer = this.ensureBuffer(this.bufferLength + maxDecodeLength);
  26640. let bufferLength = this.bufferLength;
  26641. let firstDigit = this.firstDigit;
  26642. for (const ch of bytes) {
  26643. let digit;
  26644. if (ch >= 0x30 && ch <= 0x39) {
  26645. digit = ch & 0x0f;
  26646. } else if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {
  26647. digit = (ch & 0x0f) + 9;
  26648. } else if (ch === 0x3e) {
  26649. this.eof = true;
  26650. break;
  26651. } else {
  26652. continue;
  26653. }
  26654. if (firstDigit < 0) {
  26655. firstDigit = digit;
  26656. } else {
  26657. buffer[bufferLength++] = firstDigit << 4 | digit;
  26658. firstDigit = -1;
  26659. }
  26660. }
  26661. if (firstDigit >= 0 && this.eof) {
  26662. buffer[bufferLength++] = firstDigit << 4;
  26663. firstDigit = -1;
  26664. }
  26665. this.firstDigit = firstDigit;
  26666. this.bufferLength = bufferLength;
  26667. }
  26668. }
  26669. exports.AsciiHexStream = AsciiHexStream;
  26670. /***/ }),
  26671. /* 31 */
  26672. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  26673. Object.defineProperty(exports, "__esModule", ({
  26674. value: true
  26675. }));
  26676. exports.CCITTFaxStream = void 0;
  26677. var _ccitt = __w_pdfjs_require__(32);
  26678. var _decode_stream = __w_pdfjs_require__(29);
  26679. var _primitives = __w_pdfjs_require__(5);
  26680. class CCITTFaxStream extends _decode_stream.DecodeStream {
  26681. constructor(str, maybeLength, params) {
  26682. super(maybeLength);
  26683. this.str = str;
  26684. this.dict = str.dict;
  26685. if (!(params instanceof _primitives.Dict)) {
  26686. params = _primitives.Dict.empty;
  26687. }
  26688. const source = {
  26689. next() {
  26690. return str.getByte();
  26691. }
  26692. };
  26693. this.ccittFaxDecoder = new _ccitt.CCITTFaxDecoder(source, {
  26694. K: params.get("K"),
  26695. EndOfLine: params.get("EndOfLine"),
  26696. EncodedByteAlign: params.get("EncodedByteAlign"),
  26697. Columns: params.get("Columns"),
  26698. Rows: params.get("Rows"),
  26699. EndOfBlock: params.get("EndOfBlock"),
  26700. BlackIs1: params.get("BlackIs1")
  26701. });
  26702. }
  26703. readBlock() {
  26704. while (!this.eof) {
  26705. const c = this.ccittFaxDecoder.readNextChar();
  26706. if (c === -1) {
  26707. this.eof = true;
  26708. return;
  26709. }
  26710. this.ensureBuffer(this.bufferLength + 1);
  26711. this.buffer[this.bufferLength++] = c;
  26712. }
  26713. }
  26714. }
  26715. exports.CCITTFaxStream = CCITTFaxStream;
  26716. /***/ }),
  26717. /* 32 */
  26718. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  26719. Object.defineProperty(exports, "__esModule", ({
  26720. value: true
  26721. }));
  26722. exports.CCITTFaxDecoder = void 0;
  26723. var _util = __w_pdfjs_require__(2);
  26724. const ccittEOL = -2;
  26725. const ccittEOF = -1;
  26726. const twoDimPass = 0;
  26727. const twoDimHoriz = 1;
  26728. const twoDimVert0 = 2;
  26729. const twoDimVertR1 = 3;
  26730. const twoDimVertL1 = 4;
  26731. const twoDimVertR2 = 5;
  26732. const twoDimVertL2 = 6;
  26733. const twoDimVertR3 = 7;
  26734. const twoDimVertL3 = 8;
  26735. 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]];
  26736. 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]];
  26737. 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]];
  26738. 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]];
  26739. 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]];
  26740. 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]];
  26741. class CCITTFaxDecoder {
  26742. constructor(source, options = {}) {
  26743. if (!source || typeof source.next !== "function") {
  26744. throw new Error('CCITTFaxDecoder - invalid "source" parameter.');
  26745. }
  26746. this.source = source;
  26747. this.eof = false;
  26748. this.encoding = options.K || 0;
  26749. this.eoline = options.EndOfLine || false;
  26750. this.byteAlign = options.EncodedByteAlign || false;
  26751. this.columns = options.Columns || 1728;
  26752. this.rows = options.Rows || 0;
  26753. let eoblock = options.EndOfBlock;
  26754. if (eoblock === null || eoblock === undefined) {
  26755. eoblock = true;
  26756. }
  26757. this.eoblock = eoblock;
  26758. this.black = options.BlackIs1 || false;
  26759. this.codingLine = new Uint32Array(this.columns + 1);
  26760. this.refLine = new Uint32Array(this.columns + 2);
  26761. this.codingLine[0] = this.columns;
  26762. this.codingPos = 0;
  26763. this.row = 0;
  26764. this.nextLine2D = this.encoding < 0;
  26765. this.inputBits = 0;
  26766. this.inputBuf = 0;
  26767. this.outputBits = 0;
  26768. this.rowsDone = false;
  26769. let code1;
  26770. while ((code1 = this._lookBits(12)) === 0) {
  26771. this._eatBits(1);
  26772. }
  26773. if (code1 === 1) {
  26774. this._eatBits(12);
  26775. }
  26776. if (this.encoding > 0) {
  26777. this.nextLine2D = !this._lookBits(1);
  26778. this._eatBits(1);
  26779. }
  26780. }
  26781. readNextChar() {
  26782. if (this.eof) {
  26783. return -1;
  26784. }
  26785. const refLine = this.refLine;
  26786. const codingLine = this.codingLine;
  26787. const columns = this.columns;
  26788. let refPos, blackPixels, bits, i;
  26789. if (this.outputBits === 0) {
  26790. if (this.rowsDone) {
  26791. this.eof = true;
  26792. }
  26793. if (this.eof) {
  26794. return -1;
  26795. }
  26796. this.err = false;
  26797. let code1, code2, code3;
  26798. if (this.nextLine2D) {
  26799. for (i = 0; codingLine[i] < columns; ++i) {
  26800. refLine[i] = codingLine[i];
  26801. }
  26802. refLine[i++] = columns;
  26803. refLine[i] = columns;
  26804. codingLine[0] = 0;
  26805. this.codingPos = 0;
  26806. refPos = 0;
  26807. blackPixels = 0;
  26808. while (codingLine[this.codingPos] < columns) {
  26809. code1 = this._getTwoDimCode();
  26810. switch (code1) {
  26811. case twoDimPass:
  26812. this._addPixels(refLine[refPos + 1], blackPixels);
  26813. if (refLine[refPos + 1] < columns) {
  26814. refPos += 2;
  26815. }
  26816. break;
  26817. case twoDimHoriz:
  26818. code1 = code2 = 0;
  26819. if (blackPixels) {
  26820. do {
  26821. code1 += code3 = this._getBlackCode();
  26822. } while (code3 >= 64);
  26823. do {
  26824. code2 += code3 = this._getWhiteCode();
  26825. } while (code3 >= 64);
  26826. } else {
  26827. do {
  26828. code1 += code3 = this._getWhiteCode();
  26829. } while (code3 >= 64);
  26830. do {
  26831. code2 += code3 = this._getBlackCode();
  26832. } while (code3 >= 64);
  26833. }
  26834. this._addPixels(codingLine[this.codingPos] + code1, blackPixels);
  26835. if (codingLine[this.codingPos] < columns) {
  26836. this._addPixels(codingLine[this.codingPos] + code2, blackPixels ^ 1);
  26837. }
  26838. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  26839. refPos += 2;
  26840. }
  26841. break;
  26842. case twoDimVertR3:
  26843. this._addPixels(refLine[refPos] + 3, blackPixels);
  26844. blackPixels ^= 1;
  26845. if (codingLine[this.codingPos] < columns) {
  26846. ++refPos;
  26847. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  26848. refPos += 2;
  26849. }
  26850. }
  26851. break;
  26852. case twoDimVertR2:
  26853. this._addPixels(refLine[refPos] + 2, blackPixels);
  26854. blackPixels ^= 1;
  26855. if (codingLine[this.codingPos] < columns) {
  26856. ++refPos;
  26857. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  26858. refPos += 2;
  26859. }
  26860. }
  26861. break;
  26862. case twoDimVertR1:
  26863. this._addPixels(refLine[refPos] + 1, blackPixels);
  26864. blackPixels ^= 1;
  26865. if (codingLine[this.codingPos] < columns) {
  26866. ++refPos;
  26867. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  26868. refPos += 2;
  26869. }
  26870. }
  26871. break;
  26872. case twoDimVert0:
  26873. this._addPixels(refLine[refPos], blackPixels);
  26874. blackPixels ^= 1;
  26875. if (codingLine[this.codingPos] < columns) {
  26876. ++refPos;
  26877. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  26878. refPos += 2;
  26879. }
  26880. }
  26881. break;
  26882. case twoDimVertL3:
  26883. this._addPixelsNeg(refLine[refPos] - 3, blackPixels);
  26884. blackPixels ^= 1;
  26885. if (codingLine[this.codingPos] < columns) {
  26886. if (refPos > 0) {
  26887. --refPos;
  26888. } else {
  26889. ++refPos;
  26890. }
  26891. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  26892. refPos += 2;
  26893. }
  26894. }
  26895. break;
  26896. case twoDimVertL2:
  26897. this._addPixelsNeg(refLine[refPos] - 2, blackPixels);
  26898. blackPixels ^= 1;
  26899. if (codingLine[this.codingPos] < columns) {
  26900. if (refPos > 0) {
  26901. --refPos;
  26902. } else {
  26903. ++refPos;
  26904. }
  26905. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  26906. refPos += 2;
  26907. }
  26908. }
  26909. break;
  26910. case twoDimVertL1:
  26911. this._addPixelsNeg(refLine[refPos] - 1, blackPixels);
  26912. blackPixels ^= 1;
  26913. if (codingLine[this.codingPos] < columns) {
  26914. if (refPos > 0) {
  26915. --refPos;
  26916. } else {
  26917. ++refPos;
  26918. }
  26919. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  26920. refPos += 2;
  26921. }
  26922. }
  26923. break;
  26924. case ccittEOF:
  26925. this._addPixels(columns, 0);
  26926. this.eof = true;
  26927. break;
  26928. default:
  26929. (0, _util.info)("bad 2d code");
  26930. this._addPixels(columns, 0);
  26931. this.err = true;
  26932. }
  26933. }
  26934. } else {
  26935. codingLine[0] = 0;
  26936. this.codingPos = 0;
  26937. blackPixels = 0;
  26938. while (codingLine[this.codingPos] < columns) {
  26939. code1 = 0;
  26940. if (blackPixels) {
  26941. do {
  26942. code1 += code3 = this._getBlackCode();
  26943. } while (code3 >= 64);
  26944. } else {
  26945. do {
  26946. code1 += code3 = this._getWhiteCode();
  26947. } while (code3 >= 64);
  26948. }
  26949. this._addPixels(codingLine[this.codingPos] + code1, blackPixels);
  26950. blackPixels ^= 1;
  26951. }
  26952. }
  26953. let gotEOL = false;
  26954. if (this.byteAlign) {
  26955. this.inputBits &= ~7;
  26956. }
  26957. if (!this.eoblock && this.row === this.rows - 1) {
  26958. this.rowsDone = true;
  26959. } else {
  26960. code1 = this._lookBits(12);
  26961. if (this.eoline) {
  26962. while (code1 !== ccittEOF && code1 !== 1) {
  26963. this._eatBits(1);
  26964. code1 = this._lookBits(12);
  26965. }
  26966. } else {
  26967. while (code1 === 0) {
  26968. this._eatBits(1);
  26969. code1 = this._lookBits(12);
  26970. }
  26971. }
  26972. if (code1 === 1) {
  26973. this._eatBits(12);
  26974. gotEOL = true;
  26975. } else if (code1 === ccittEOF) {
  26976. this.eof = true;
  26977. }
  26978. }
  26979. if (!this.eof && this.encoding > 0 && !this.rowsDone) {
  26980. this.nextLine2D = !this._lookBits(1);
  26981. this._eatBits(1);
  26982. }
  26983. if (this.eoblock && gotEOL && this.byteAlign) {
  26984. code1 = this._lookBits(12);
  26985. if (code1 === 1) {
  26986. this._eatBits(12);
  26987. if (this.encoding > 0) {
  26988. this._lookBits(1);
  26989. this._eatBits(1);
  26990. }
  26991. if (this.encoding >= 0) {
  26992. for (i = 0; i < 4; ++i) {
  26993. code1 = this._lookBits(12);
  26994. if (code1 !== 1) {
  26995. (0, _util.info)("bad rtc code: " + code1);
  26996. }
  26997. this._eatBits(12);
  26998. if (this.encoding > 0) {
  26999. this._lookBits(1);
  27000. this._eatBits(1);
  27001. }
  27002. }
  27003. }
  27004. this.eof = true;
  27005. }
  27006. } else if (this.err && this.eoline) {
  27007. while (true) {
  27008. code1 = this._lookBits(13);
  27009. if (code1 === ccittEOF) {
  27010. this.eof = true;
  27011. return -1;
  27012. }
  27013. if (code1 >> 1 === 1) {
  27014. break;
  27015. }
  27016. this._eatBits(1);
  27017. }
  27018. this._eatBits(12);
  27019. if (this.encoding > 0) {
  27020. this._eatBits(1);
  27021. this.nextLine2D = !(code1 & 1);
  27022. }
  27023. }
  27024. if (codingLine[0] > 0) {
  27025. this.outputBits = codingLine[this.codingPos = 0];
  27026. } else {
  27027. this.outputBits = codingLine[this.codingPos = 1];
  27028. }
  27029. this.row++;
  27030. }
  27031. let c;
  27032. if (this.outputBits >= 8) {
  27033. c = this.codingPos & 1 ? 0 : 0xff;
  27034. this.outputBits -= 8;
  27035. if (this.outputBits === 0 && codingLine[this.codingPos] < columns) {
  27036. this.codingPos++;
  27037. this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];
  27038. }
  27039. } else {
  27040. bits = 8;
  27041. c = 0;
  27042. do {
  27043. if (typeof this.outputBits !== "number") {
  27044. throw new _util.FormatError('Invalid /CCITTFaxDecode data, "outputBits" must be a number.');
  27045. }
  27046. if (this.outputBits > bits) {
  27047. c <<= bits;
  27048. if (!(this.codingPos & 1)) {
  27049. c |= 0xff >> 8 - bits;
  27050. }
  27051. this.outputBits -= bits;
  27052. bits = 0;
  27053. } else {
  27054. c <<= this.outputBits;
  27055. if (!(this.codingPos & 1)) {
  27056. c |= 0xff >> 8 - this.outputBits;
  27057. }
  27058. bits -= this.outputBits;
  27059. this.outputBits = 0;
  27060. if (codingLine[this.codingPos] < columns) {
  27061. this.codingPos++;
  27062. this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];
  27063. } else if (bits > 0) {
  27064. c <<= bits;
  27065. bits = 0;
  27066. }
  27067. }
  27068. } while (bits);
  27069. }
  27070. if (this.black) {
  27071. c ^= 0xff;
  27072. }
  27073. return c;
  27074. }
  27075. _addPixels(a1, blackPixels) {
  27076. const codingLine = this.codingLine;
  27077. let codingPos = this.codingPos;
  27078. if (a1 > codingLine[codingPos]) {
  27079. if (a1 > this.columns) {
  27080. (0, _util.info)("row is wrong length");
  27081. this.err = true;
  27082. a1 = this.columns;
  27083. }
  27084. if (codingPos & 1 ^ blackPixels) {
  27085. ++codingPos;
  27086. }
  27087. codingLine[codingPos] = a1;
  27088. }
  27089. this.codingPos = codingPos;
  27090. }
  27091. _addPixelsNeg(a1, blackPixels) {
  27092. const codingLine = this.codingLine;
  27093. let codingPos = this.codingPos;
  27094. if (a1 > codingLine[codingPos]) {
  27095. if (a1 > this.columns) {
  27096. (0, _util.info)("row is wrong length");
  27097. this.err = true;
  27098. a1 = this.columns;
  27099. }
  27100. if (codingPos & 1 ^ blackPixels) {
  27101. ++codingPos;
  27102. }
  27103. codingLine[codingPos] = a1;
  27104. } else if (a1 < codingLine[codingPos]) {
  27105. if (a1 < 0) {
  27106. (0, _util.info)("invalid code");
  27107. this.err = true;
  27108. a1 = 0;
  27109. }
  27110. while (codingPos > 0 && a1 < codingLine[codingPos - 1]) {
  27111. --codingPos;
  27112. }
  27113. codingLine[codingPos] = a1;
  27114. }
  27115. this.codingPos = codingPos;
  27116. }
  27117. _findTableCode(start, end, table, limit) {
  27118. const limitValue = limit || 0;
  27119. for (let i = start; i <= end; ++i) {
  27120. let code = this._lookBits(i);
  27121. if (code === ccittEOF) {
  27122. return [true, 1, false];
  27123. }
  27124. if (i < end) {
  27125. code <<= end - i;
  27126. }
  27127. if (!limitValue || code >= limitValue) {
  27128. const p = table[code - limitValue];
  27129. if (p[0] === i) {
  27130. this._eatBits(i);
  27131. return [true, p[1], true];
  27132. }
  27133. }
  27134. }
  27135. return [false, 0, false];
  27136. }
  27137. _getTwoDimCode() {
  27138. let code = 0;
  27139. let p;
  27140. if (this.eoblock) {
  27141. code = this._lookBits(7);
  27142. p = twoDimTable[code];
  27143. if (p && p[0] > 0) {
  27144. this._eatBits(p[0]);
  27145. return p[1];
  27146. }
  27147. } else {
  27148. const result = this._findTableCode(1, 7, twoDimTable);
  27149. if (result[0] && result[2]) {
  27150. return result[1];
  27151. }
  27152. }
  27153. (0, _util.info)("Bad two dim code");
  27154. return ccittEOF;
  27155. }
  27156. _getWhiteCode() {
  27157. let code = 0;
  27158. let p;
  27159. if (this.eoblock) {
  27160. code = this._lookBits(12);
  27161. if (code === ccittEOF) {
  27162. return 1;
  27163. }
  27164. if (code >> 5 === 0) {
  27165. p = whiteTable1[code];
  27166. } else {
  27167. p = whiteTable2[code >> 3];
  27168. }
  27169. if (p[0] > 0) {
  27170. this._eatBits(p[0]);
  27171. return p[1];
  27172. }
  27173. } else {
  27174. let result = this._findTableCode(1, 9, whiteTable2);
  27175. if (result[0]) {
  27176. return result[1];
  27177. }
  27178. result = this._findTableCode(11, 12, whiteTable1);
  27179. if (result[0]) {
  27180. return result[1];
  27181. }
  27182. }
  27183. (0, _util.info)("bad white code");
  27184. this._eatBits(1);
  27185. return 1;
  27186. }
  27187. _getBlackCode() {
  27188. let code, p;
  27189. if (this.eoblock) {
  27190. code = this._lookBits(13);
  27191. if (code === ccittEOF) {
  27192. return 1;
  27193. }
  27194. if (code >> 7 === 0) {
  27195. p = blackTable1[code];
  27196. } else if (code >> 9 === 0 && code >> 7 !== 0) {
  27197. p = blackTable2[(code >> 1) - 64];
  27198. } else {
  27199. p = blackTable3[code >> 7];
  27200. }
  27201. if (p[0] > 0) {
  27202. this._eatBits(p[0]);
  27203. return p[1];
  27204. }
  27205. } else {
  27206. let result = this._findTableCode(2, 6, blackTable3);
  27207. if (result[0]) {
  27208. return result[1];
  27209. }
  27210. result = this._findTableCode(7, 12, blackTable2, 64);
  27211. if (result[0]) {
  27212. return result[1];
  27213. }
  27214. result = this._findTableCode(10, 13, blackTable1);
  27215. if (result[0]) {
  27216. return result[1];
  27217. }
  27218. }
  27219. (0, _util.info)("bad black code");
  27220. this._eatBits(1);
  27221. return 1;
  27222. }
  27223. _lookBits(n) {
  27224. let c;
  27225. while (this.inputBits < n) {
  27226. if ((c = this.source.next()) === -1) {
  27227. if (this.inputBits === 0) {
  27228. return ccittEOF;
  27229. }
  27230. return this.inputBuf << n - this.inputBits & 0xffff >> 16 - n;
  27231. }
  27232. this.inputBuf = this.inputBuf << 8 | c;
  27233. this.inputBits += 8;
  27234. }
  27235. return this.inputBuf >> this.inputBits - n & 0xffff >> 16 - n;
  27236. }
  27237. _eatBits(n) {
  27238. if ((this.inputBits -= n) < 0) {
  27239. this.inputBits = 0;
  27240. }
  27241. }
  27242. }
  27243. exports.CCITTFaxDecoder = CCITTFaxDecoder;
  27244. /***/ }),
  27245. /* 33 */
  27246. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  27247. Object.defineProperty(exports, "__esModule", ({
  27248. value: true
  27249. }));
  27250. exports.FlateStream = void 0;
  27251. var _decode_stream = __w_pdfjs_require__(29);
  27252. var _util = __w_pdfjs_require__(2);
  27253. const codeLenCodeMap = new Int32Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]);
  27254. 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]);
  27255. 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]);
  27256. 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];
  27257. 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];
  27258. class FlateStream extends _decode_stream.DecodeStream {
  27259. constructor(str, maybeLength) {
  27260. super(maybeLength);
  27261. this.str = str;
  27262. this.dict = str.dict;
  27263. const cmf = str.getByte();
  27264. const flg = str.getByte();
  27265. if (cmf === -1 || flg === -1) {
  27266. throw new _util.FormatError(`Invalid header in flate stream: ${cmf}, ${flg}`);
  27267. }
  27268. if ((cmf & 0x0f) !== 0x08) {
  27269. throw new _util.FormatError(`Unknown compression method in flate stream: ${cmf}, ${flg}`);
  27270. }
  27271. if (((cmf << 8) + flg) % 31 !== 0) {
  27272. throw new _util.FormatError(`Bad FCHECK in flate stream: ${cmf}, ${flg}`);
  27273. }
  27274. if (flg & 0x20) {
  27275. throw new _util.FormatError(`FDICT bit set in flate stream: ${cmf}, ${flg}`);
  27276. }
  27277. this.codeSize = 0;
  27278. this.codeBuf = 0;
  27279. }
  27280. getBits(bits) {
  27281. const str = this.str;
  27282. let codeSize = this.codeSize;
  27283. let codeBuf = this.codeBuf;
  27284. let b;
  27285. while (codeSize < bits) {
  27286. if ((b = str.getByte()) === -1) {
  27287. throw new _util.FormatError("Bad encoding in flate stream");
  27288. }
  27289. codeBuf |= b << codeSize;
  27290. codeSize += 8;
  27291. }
  27292. b = codeBuf & (1 << bits) - 1;
  27293. this.codeBuf = codeBuf >> bits;
  27294. this.codeSize = codeSize -= bits;
  27295. return b;
  27296. }
  27297. getCode(table) {
  27298. const str = this.str;
  27299. const codes = table[0];
  27300. const maxLen = table[1];
  27301. let codeSize = this.codeSize;
  27302. let codeBuf = this.codeBuf;
  27303. let b;
  27304. while (codeSize < maxLen) {
  27305. if ((b = str.getByte()) === -1) {
  27306. break;
  27307. }
  27308. codeBuf |= b << codeSize;
  27309. codeSize += 8;
  27310. }
  27311. const code = codes[codeBuf & (1 << maxLen) - 1];
  27312. const codeLen = code >> 16;
  27313. const codeVal = code & 0xffff;
  27314. if (codeLen < 1 || codeSize < codeLen) {
  27315. throw new _util.FormatError("Bad encoding in flate stream");
  27316. }
  27317. this.codeBuf = codeBuf >> codeLen;
  27318. this.codeSize = codeSize - codeLen;
  27319. return codeVal;
  27320. }
  27321. generateHuffmanTable(lengths) {
  27322. const n = lengths.length;
  27323. let maxLen = 0;
  27324. let i;
  27325. for (i = 0; i < n; ++i) {
  27326. if (lengths[i] > maxLen) {
  27327. maxLen = lengths[i];
  27328. }
  27329. }
  27330. const size = 1 << maxLen;
  27331. const codes = new Int32Array(size);
  27332. for (let len = 1, code = 0, skip = 2; len <= maxLen; ++len, code <<= 1, skip <<= 1) {
  27333. for (let val = 0; val < n; ++val) {
  27334. if (lengths[val] === len) {
  27335. let code2 = 0;
  27336. let t = code;
  27337. for (i = 0; i < len; ++i) {
  27338. code2 = code2 << 1 | t & 1;
  27339. t >>= 1;
  27340. }
  27341. for (i = code2; i < size; i += skip) {
  27342. codes[i] = len << 16 | val;
  27343. }
  27344. ++code;
  27345. }
  27346. }
  27347. }
  27348. return [codes, maxLen];
  27349. }
  27350. readBlock() {
  27351. let buffer, len;
  27352. const str = this.str;
  27353. let hdr = this.getBits(3);
  27354. if (hdr & 1) {
  27355. this.eof = true;
  27356. }
  27357. hdr >>= 1;
  27358. if (hdr === 0) {
  27359. let b;
  27360. if ((b = str.getByte()) === -1) {
  27361. throw new _util.FormatError("Bad block header in flate stream");
  27362. }
  27363. let blockLen = b;
  27364. if ((b = str.getByte()) === -1) {
  27365. throw new _util.FormatError("Bad block header in flate stream");
  27366. }
  27367. blockLen |= b << 8;
  27368. if ((b = str.getByte()) === -1) {
  27369. throw new _util.FormatError("Bad block header in flate stream");
  27370. }
  27371. let check = b;
  27372. if ((b = str.getByte()) === -1) {
  27373. throw new _util.FormatError("Bad block header in flate stream");
  27374. }
  27375. check |= b << 8;
  27376. if (check !== (~blockLen & 0xffff) && (blockLen !== 0 || check !== 0)) {
  27377. throw new _util.FormatError("Bad uncompressed block length in flate stream");
  27378. }
  27379. this.codeBuf = 0;
  27380. this.codeSize = 0;
  27381. const bufferLength = this.bufferLength,
  27382. end = bufferLength + blockLen;
  27383. buffer = this.ensureBuffer(end);
  27384. this.bufferLength = end;
  27385. if (blockLen === 0) {
  27386. if (str.peekByte() === -1) {
  27387. this.eof = true;
  27388. }
  27389. } else {
  27390. const block = str.getBytes(blockLen);
  27391. buffer.set(block, bufferLength);
  27392. if (block.length < blockLen) {
  27393. this.eof = true;
  27394. }
  27395. }
  27396. return;
  27397. }
  27398. let litCodeTable;
  27399. let distCodeTable;
  27400. if (hdr === 1) {
  27401. litCodeTable = fixedLitCodeTab;
  27402. distCodeTable = fixedDistCodeTab;
  27403. } else if (hdr === 2) {
  27404. const numLitCodes = this.getBits(5) + 257;
  27405. const numDistCodes = this.getBits(5) + 1;
  27406. const numCodeLenCodes = this.getBits(4) + 4;
  27407. const codeLenCodeLengths = new Uint8Array(codeLenCodeMap.length);
  27408. let i;
  27409. for (i = 0; i < numCodeLenCodes; ++i) {
  27410. codeLenCodeLengths[codeLenCodeMap[i]] = this.getBits(3);
  27411. }
  27412. const codeLenCodeTab = this.generateHuffmanTable(codeLenCodeLengths);
  27413. len = 0;
  27414. i = 0;
  27415. const codes = numLitCodes + numDistCodes;
  27416. const codeLengths = new Uint8Array(codes);
  27417. let bitsLength, bitsOffset, what;
  27418. while (i < codes) {
  27419. const code = this.getCode(codeLenCodeTab);
  27420. if (code === 16) {
  27421. bitsLength = 2;
  27422. bitsOffset = 3;
  27423. what = len;
  27424. } else if (code === 17) {
  27425. bitsLength = 3;
  27426. bitsOffset = 3;
  27427. what = len = 0;
  27428. } else if (code === 18) {
  27429. bitsLength = 7;
  27430. bitsOffset = 11;
  27431. what = len = 0;
  27432. } else {
  27433. codeLengths[i++] = len = code;
  27434. continue;
  27435. }
  27436. let repeatLength = this.getBits(bitsLength) + bitsOffset;
  27437. while (repeatLength-- > 0) {
  27438. codeLengths[i++] = what;
  27439. }
  27440. }
  27441. litCodeTable = this.generateHuffmanTable(codeLengths.subarray(0, numLitCodes));
  27442. distCodeTable = this.generateHuffmanTable(codeLengths.subarray(numLitCodes, codes));
  27443. } else {
  27444. throw new _util.FormatError("Unknown block type in flate stream");
  27445. }
  27446. buffer = this.buffer;
  27447. let limit = buffer ? buffer.length : 0;
  27448. let pos = this.bufferLength;
  27449. while (true) {
  27450. let code1 = this.getCode(litCodeTable);
  27451. if (code1 < 256) {
  27452. if (pos + 1 >= limit) {
  27453. buffer = this.ensureBuffer(pos + 1);
  27454. limit = buffer.length;
  27455. }
  27456. buffer[pos++] = code1;
  27457. continue;
  27458. }
  27459. if (code1 === 256) {
  27460. this.bufferLength = pos;
  27461. return;
  27462. }
  27463. code1 -= 257;
  27464. code1 = lengthDecode[code1];
  27465. let code2 = code1 >> 16;
  27466. if (code2 > 0) {
  27467. code2 = this.getBits(code2);
  27468. }
  27469. len = (code1 & 0xffff) + code2;
  27470. code1 = this.getCode(distCodeTable);
  27471. code1 = distDecode[code1];
  27472. code2 = code1 >> 16;
  27473. if (code2 > 0) {
  27474. code2 = this.getBits(code2);
  27475. }
  27476. const dist = (code1 & 0xffff) + code2;
  27477. if (pos + len >= limit) {
  27478. buffer = this.ensureBuffer(pos + len);
  27479. limit = buffer.length;
  27480. }
  27481. for (let k = 0; k < len; ++k, ++pos) {
  27482. buffer[pos] = buffer[pos - dist];
  27483. }
  27484. }
  27485. }
  27486. }
  27487. exports.FlateStream = FlateStream;
  27488. /***/ }),
  27489. /* 34 */
  27490. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  27491. Object.defineProperty(exports, "__esModule", ({
  27492. value: true
  27493. }));
  27494. exports.Jbig2Stream = void 0;
  27495. var _base_stream = __w_pdfjs_require__(7);
  27496. var _decode_stream = __w_pdfjs_require__(29);
  27497. var _primitives = __w_pdfjs_require__(5);
  27498. var _jbig = __w_pdfjs_require__(35);
  27499. var _util = __w_pdfjs_require__(2);
  27500. class Jbig2Stream extends _decode_stream.DecodeStream {
  27501. constructor(stream, maybeLength, params) {
  27502. super(maybeLength);
  27503. this.stream = stream;
  27504. this.dict = stream.dict;
  27505. this.maybeLength = maybeLength;
  27506. this.params = params;
  27507. }
  27508. get bytes() {
  27509. return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength));
  27510. }
  27511. ensureBuffer(requested) {}
  27512. readBlock() {
  27513. if (this.eof) {
  27514. return;
  27515. }
  27516. const jbig2Image = new _jbig.Jbig2Image();
  27517. const chunks = [];
  27518. if (this.params instanceof _primitives.Dict) {
  27519. const globalsStream = this.params.get("JBIG2Globals");
  27520. if (globalsStream instanceof _base_stream.BaseStream) {
  27521. const globals = globalsStream.getBytes();
  27522. chunks.push({
  27523. data: globals,
  27524. start: 0,
  27525. end: globals.length
  27526. });
  27527. }
  27528. }
  27529. chunks.push({
  27530. data: this.bytes,
  27531. start: 0,
  27532. end: this.bytes.length
  27533. });
  27534. const data = jbig2Image.parseChunks(chunks);
  27535. const dataLength = data.length;
  27536. for (let i = 0; i < dataLength; i++) {
  27537. data[i] ^= 0xff;
  27538. }
  27539. this.buffer = data;
  27540. this.bufferLength = dataLength;
  27541. this.eof = true;
  27542. }
  27543. }
  27544. exports.Jbig2Stream = Jbig2Stream;
  27545. /***/ }),
  27546. /* 35 */
  27547. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  27548. Object.defineProperty(exports, "__esModule", ({
  27549. value: true
  27550. }));
  27551. exports.Jbig2Image = void 0;
  27552. var _util = __w_pdfjs_require__(2);
  27553. var _core_utils = __w_pdfjs_require__(6);
  27554. var _arithmetic_decoder = __w_pdfjs_require__(36);
  27555. var _ccitt = __w_pdfjs_require__(32);
  27556. class Jbig2Error extends _util.BaseException {
  27557. constructor(msg) {
  27558. super(`JBIG2 error: ${msg}`, "Jbig2Error");
  27559. }
  27560. }
  27561. class ContextCache {
  27562. getContexts(id) {
  27563. if (id in this) {
  27564. return this[id];
  27565. }
  27566. return this[id] = new Int8Array(1 << 16);
  27567. }
  27568. }
  27569. class DecodingContext {
  27570. constructor(data, start, end) {
  27571. this.data = data;
  27572. this.start = start;
  27573. this.end = end;
  27574. }
  27575. get decoder() {
  27576. const decoder = new _arithmetic_decoder.ArithmeticDecoder(this.data, this.start, this.end);
  27577. return (0, _util.shadow)(this, "decoder", decoder);
  27578. }
  27579. get contextCache() {
  27580. const cache = new ContextCache();
  27581. return (0, _util.shadow)(this, "contextCache", cache);
  27582. }
  27583. }
  27584. function decodeInteger(contextCache, procedure, decoder) {
  27585. const contexts = contextCache.getContexts(procedure);
  27586. let prev = 1;
  27587. function readBits(length) {
  27588. let v = 0;
  27589. for (let i = 0; i < length; i++) {
  27590. const bit = decoder.readBit(contexts, prev);
  27591. prev = prev < 256 ? prev << 1 | bit : (prev << 1 | bit) & 511 | 256;
  27592. v = v << 1 | bit;
  27593. }
  27594. return v >>> 0;
  27595. }
  27596. const sign = readBits(1);
  27597. 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);
  27598. if (sign === 0) {
  27599. return value;
  27600. } else if (value > 0) {
  27601. return -value;
  27602. }
  27603. return null;
  27604. }
  27605. function decodeIAID(contextCache, decoder, codeLength) {
  27606. const contexts = contextCache.getContexts("IAID");
  27607. let prev = 1;
  27608. for (let i = 0; i < codeLength; i++) {
  27609. const bit = decoder.readBit(contexts, prev);
  27610. prev = prev << 1 | bit;
  27611. }
  27612. if (codeLength < 31) {
  27613. return prev & (1 << codeLength) - 1;
  27614. }
  27615. return prev & 0x7fffffff;
  27616. }
  27617. 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"];
  27618. const CodingTemplates = [[{
  27619. x: -1,
  27620. y: -2
  27621. }, {
  27622. x: 0,
  27623. y: -2
  27624. }, {
  27625. x: 1,
  27626. y: -2
  27627. }, {
  27628. x: -2,
  27629. y: -1
  27630. }, {
  27631. x: -1,
  27632. y: -1
  27633. }, {
  27634. x: 0,
  27635. y: -1
  27636. }, {
  27637. x: 1,
  27638. y: -1
  27639. }, {
  27640. x: 2,
  27641. y: -1
  27642. }, {
  27643. x: -4,
  27644. y: 0
  27645. }, {
  27646. x: -3,
  27647. y: 0
  27648. }, {
  27649. x: -2,
  27650. y: 0
  27651. }, {
  27652. x: -1,
  27653. y: 0
  27654. }], [{
  27655. x: -1,
  27656. y: -2
  27657. }, {
  27658. x: 0,
  27659. y: -2
  27660. }, {
  27661. x: 1,
  27662. y: -2
  27663. }, {
  27664. x: 2,
  27665. y: -2
  27666. }, {
  27667. x: -2,
  27668. y: -1
  27669. }, {
  27670. x: -1,
  27671. y: -1
  27672. }, {
  27673. x: 0,
  27674. y: -1
  27675. }, {
  27676. x: 1,
  27677. y: -1
  27678. }, {
  27679. x: 2,
  27680. y: -1
  27681. }, {
  27682. x: -3,
  27683. y: 0
  27684. }, {
  27685. x: -2,
  27686. y: 0
  27687. }, {
  27688. x: -1,
  27689. y: 0
  27690. }], [{
  27691. x: -1,
  27692. y: -2
  27693. }, {
  27694. x: 0,
  27695. y: -2
  27696. }, {
  27697. x: 1,
  27698. y: -2
  27699. }, {
  27700. x: -2,
  27701. y: -1
  27702. }, {
  27703. x: -1,
  27704. y: -1
  27705. }, {
  27706. x: 0,
  27707. y: -1
  27708. }, {
  27709. x: 1,
  27710. y: -1
  27711. }, {
  27712. x: -2,
  27713. y: 0
  27714. }, {
  27715. x: -1,
  27716. y: 0
  27717. }], [{
  27718. x: -3,
  27719. y: -1
  27720. }, {
  27721. x: -2,
  27722. y: -1
  27723. }, {
  27724. x: -1,
  27725. y: -1
  27726. }, {
  27727. x: 0,
  27728. y: -1
  27729. }, {
  27730. x: 1,
  27731. y: -1
  27732. }, {
  27733. x: -4,
  27734. y: 0
  27735. }, {
  27736. x: -3,
  27737. y: 0
  27738. }, {
  27739. x: -2,
  27740. y: 0
  27741. }, {
  27742. x: -1,
  27743. y: 0
  27744. }]];
  27745. const RefinementTemplates = [{
  27746. coding: [{
  27747. x: 0,
  27748. y: -1
  27749. }, {
  27750. x: 1,
  27751. y: -1
  27752. }, {
  27753. x: -1,
  27754. y: 0
  27755. }],
  27756. reference: [{
  27757. x: 0,
  27758. y: -1
  27759. }, {
  27760. x: 1,
  27761. y: -1
  27762. }, {
  27763. x: -1,
  27764. y: 0
  27765. }, {
  27766. x: 0,
  27767. y: 0
  27768. }, {
  27769. x: 1,
  27770. y: 0
  27771. }, {
  27772. x: -1,
  27773. y: 1
  27774. }, {
  27775. x: 0,
  27776. y: 1
  27777. }, {
  27778. x: 1,
  27779. y: 1
  27780. }]
  27781. }, {
  27782. coding: [{
  27783. x: -1,
  27784. y: -1
  27785. }, {
  27786. x: 0,
  27787. y: -1
  27788. }, {
  27789. x: 1,
  27790. y: -1
  27791. }, {
  27792. x: -1,
  27793. y: 0
  27794. }],
  27795. reference: [{
  27796. x: 0,
  27797. y: -1
  27798. }, {
  27799. x: -1,
  27800. y: 0
  27801. }, {
  27802. x: 0,
  27803. y: 0
  27804. }, {
  27805. x: 1,
  27806. y: 0
  27807. }, {
  27808. x: 0,
  27809. y: 1
  27810. }, {
  27811. x: 1,
  27812. y: 1
  27813. }]
  27814. }];
  27815. const ReusedContexts = [0x9b25, 0x0795, 0x00e5, 0x0195];
  27816. const RefinementReusedContexts = [0x0020, 0x0008];
  27817. function decodeBitmapTemplate0(width, height, decodingContext) {
  27818. const decoder = decodingContext.decoder;
  27819. const contexts = decodingContext.contextCache.getContexts("GB");
  27820. const bitmap = [];
  27821. let contextLabel, i, j, pixel, row, row1, row2;
  27822. const OLD_PIXEL_MASK = 0x7bf7;
  27823. for (i = 0; i < height; i++) {
  27824. row = bitmap[i] = new Uint8Array(width);
  27825. row1 = i < 1 ? row : bitmap[i - 1];
  27826. row2 = i < 2 ? row : bitmap[i - 2];
  27827. contextLabel = row2[0] << 13 | row2[1] << 12 | row2[2] << 11 | row1[0] << 7 | row1[1] << 6 | row1[2] << 5 | row1[3] << 4;
  27828. for (j = 0; j < width; j++) {
  27829. row[j] = pixel = decoder.readBit(contexts, contextLabel);
  27830. contextLabel = (contextLabel & OLD_PIXEL_MASK) << 1 | (j + 3 < width ? row2[j + 3] << 11 : 0) | (j + 4 < width ? row1[j + 4] << 4 : 0) | pixel;
  27831. }
  27832. }
  27833. return bitmap;
  27834. }
  27835. function decodeBitmap(mmr, width, height, templateIndex, prediction, skip, at, decodingContext) {
  27836. if (mmr) {
  27837. const input = new Reader(decodingContext.data, decodingContext.start, decodingContext.end);
  27838. return decodeMMRBitmap(input, width, height, false);
  27839. }
  27840. 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) {
  27841. return decodeBitmapTemplate0(width, height, decodingContext);
  27842. }
  27843. const useskip = !!skip;
  27844. const template = CodingTemplates[templateIndex].concat(at);
  27845. template.sort(function (a, b) {
  27846. return a.y - b.y || a.x - b.x;
  27847. });
  27848. const templateLength = template.length;
  27849. const templateX = new Int8Array(templateLength);
  27850. const templateY = new Int8Array(templateLength);
  27851. const changingTemplateEntries = [];
  27852. let reuseMask = 0,
  27853. minX = 0,
  27854. maxX = 0,
  27855. minY = 0;
  27856. let c, k;
  27857. for (k = 0; k < templateLength; k++) {
  27858. templateX[k] = template[k].x;
  27859. templateY[k] = template[k].y;
  27860. minX = Math.min(minX, template[k].x);
  27861. maxX = Math.max(maxX, template[k].x);
  27862. minY = Math.min(minY, template[k].y);
  27863. if (k < templateLength - 1 && template[k].y === template[k + 1].y && template[k].x === template[k + 1].x - 1) {
  27864. reuseMask |= 1 << templateLength - 1 - k;
  27865. } else {
  27866. changingTemplateEntries.push(k);
  27867. }
  27868. }
  27869. const changingEntriesLength = changingTemplateEntries.length;
  27870. const changingTemplateX = new Int8Array(changingEntriesLength);
  27871. const changingTemplateY = new Int8Array(changingEntriesLength);
  27872. const changingTemplateBit = new Uint16Array(changingEntriesLength);
  27873. for (c = 0; c < changingEntriesLength; c++) {
  27874. k = changingTemplateEntries[c];
  27875. changingTemplateX[c] = template[k].x;
  27876. changingTemplateY[c] = template[k].y;
  27877. changingTemplateBit[c] = 1 << templateLength - 1 - k;
  27878. }
  27879. const sbb_left = -minX;
  27880. const sbb_top = -minY;
  27881. const sbb_right = width - maxX;
  27882. const pseudoPixelContext = ReusedContexts[templateIndex];
  27883. let row = new Uint8Array(width);
  27884. const bitmap = [];
  27885. const decoder = decodingContext.decoder;
  27886. const contexts = decodingContext.contextCache.getContexts("GB");
  27887. let ltp = 0,
  27888. j,
  27889. i0,
  27890. j0,
  27891. contextLabel = 0,
  27892. bit,
  27893. shift;
  27894. for (let i = 0; i < height; i++) {
  27895. if (prediction) {
  27896. const sltp = decoder.readBit(contexts, pseudoPixelContext);
  27897. ltp ^= sltp;
  27898. if (ltp) {
  27899. bitmap.push(row);
  27900. continue;
  27901. }
  27902. }
  27903. row = new Uint8Array(row);
  27904. bitmap.push(row);
  27905. for (j = 0; j < width; j++) {
  27906. if (useskip && skip[i][j]) {
  27907. row[j] = 0;
  27908. continue;
  27909. }
  27910. if (j >= sbb_left && j < sbb_right && i >= sbb_top) {
  27911. contextLabel = contextLabel << 1 & reuseMask;
  27912. for (k = 0; k < changingEntriesLength; k++) {
  27913. i0 = i + changingTemplateY[k];
  27914. j0 = j + changingTemplateX[k];
  27915. bit = bitmap[i0][j0];
  27916. if (bit) {
  27917. bit = changingTemplateBit[k];
  27918. contextLabel |= bit;
  27919. }
  27920. }
  27921. } else {
  27922. contextLabel = 0;
  27923. shift = templateLength - 1;
  27924. for (k = 0; k < templateLength; k++, shift--) {
  27925. j0 = j + templateX[k];
  27926. if (j0 >= 0 && j0 < width) {
  27927. i0 = i + templateY[k];
  27928. if (i0 >= 0) {
  27929. bit = bitmap[i0][j0];
  27930. if (bit) {
  27931. contextLabel |= bit << shift;
  27932. }
  27933. }
  27934. }
  27935. }
  27936. }
  27937. const pixel = decoder.readBit(contexts, contextLabel);
  27938. row[j] = pixel;
  27939. }
  27940. }
  27941. return bitmap;
  27942. }
  27943. function decodeRefinement(width, height, templateIndex, referenceBitmap, offsetX, offsetY, prediction, at, decodingContext) {
  27944. let codingTemplate = RefinementTemplates[templateIndex].coding;
  27945. if (templateIndex === 0) {
  27946. codingTemplate = codingTemplate.concat([at[0]]);
  27947. }
  27948. const codingTemplateLength = codingTemplate.length;
  27949. const codingTemplateX = new Int32Array(codingTemplateLength);
  27950. const codingTemplateY = new Int32Array(codingTemplateLength);
  27951. let k;
  27952. for (k = 0; k < codingTemplateLength; k++) {
  27953. codingTemplateX[k] = codingTemplate[k].x;
  27954. codingTemplateY[k] = codingTemplate[k].y;
  27955. }
  27956. let referenceTemplate = RefinementTemplates[templateIndex].reference;
  27957. if (templateIndex === 0) {
  27958. referenceTemplate = referenceTemplate.concat([at[1]]);
  27959. }
  27960. const referenceTemplateLength = referenceTemplate.length;
  27961. const referenceTemplateX = new Int32Array(referenceTemplateLength);
  27962. const referenceTemplateY = new Int32Array(referenceTemplateLength);
  27963. for (k = 0; k < referenceTemplateLength; k++) {
  27964. referenceTemplateX[k] = referenceTemplate[k].x;
  27965. referenceTemplateY[k] = referenceTemplate[k].y;
  27966. }
  27967. const referenceWidth = referenceBitmap[0].length;
  27968. const referenceHeight = referenceBitmap.length;
  27969. const pseudoPixelContext = RefinementReusedContexts[templateIndex];
  27970. const bitmap = [];
  27971. const decoder = decodingContext.decoder;
  27972. const contexts = decodingContext.contextCache.getContexts("GR");
  27973. let ltp = 0;
  27974. for (let i = 0; i < height; i++) {
  27975. if (prediction) {
  27976. const sltp = decoder.readBit(contexts, pseudoPixelContext);
  27977. ltp ^= sltp;
  27978. if (ltp) {
  27979. throw new Jbig2Error("prediction is not supported");
  27980. }
  27981. }
  27982. const row = new Uint8Array(width);
  27983. bitmap.push(row);
  27984. for (let j = 0; j < width; j++) {
  27985. let i0, j0;
  27986. let contextLabel = 0;
  27987. for (k = 0; k < codingTemplateLength; k++) {
  27988. i0 = i + codingTemplateY[k];
  27989. j0 = j + codingTemplateX[k];
  27990. if (i0 < 0 || j0 < 0 || j0 >= width) {
  27991. contextLabel <<= 1;
  27992. } else {
  27993. contextLabel = contextLabel << 1 | bitmap[i0][j0];
  27994. }
  27995. }
  27996. for (k = 0; k < referenceTemplateLength; k++) {
  27997. i0 = i + referenceTemplateY[k] - offsetY;
  27998. j0 = j + referenceTemplateX[k] - offsetX;
  27999. if (i0 < 0 || i0 >= referenceHeight || j0 < 0 || j0 >= referenceWidth) {
  28000. contextLabel <<= 1;
  28001. } else {
  28002. contextLabel = contextLabel << 1 | referenceBitmap[i0][j0];
  28003. }
  28004. }
  28005. const pixel = decoder.readBit(contexts, contextLabel);
  28006. row[j] = pixel;
  28007. }
  28008. }
  28009. return bitmap;
  28010. }
  28011. function decodeSymbolDictionary(huffman, refinement, symbols, numberOfNewSymbols, numberOfExportedSymbols, huffmanTables, templateIndex, at, refinementTemplateIndex, refinementAt, decodingContext, huffmanInput) {
  28012. if (huffman && refinement) {
  28013. throw new Jbig2Error("symbol refinement with Huffman is not supported");
  28014. }
  28015. const newSymbols = [];
  28016. let currentHeight = 0;
  28017. let symbolCodeLength = (0, _core_utils.log2)(symbols.length + numberOfNewSymbols);
  28018. const decoder = decodingContext.decoder;
  28019. const contextCache = decodingContext.contextCache;
  28020. let tableB1, symbolWidths;
  28021. if (huffman) {
  28022. tableB1 = getStandardTable(1);
  28023. symbolWidths = [];
  28024. symbolCodeLength = Math.max(symbolCodeLength, 1);
  28025. }
  28026. while (newSymbols.length < numberOfNewSymbols) {
  28027. const deltaHeight = huffman ? huffmanTables.tableDeltaHeight.decode(huffmanInput) : decodeInteger(contextCache, "IADH", decoder);
  28028. currentHeight += deltaHeight;
  28029. let currentWidth = 0,
  28030. totalWidth = 0;
  28031. const firstSymbol = huffman ? symbolWidths.length : 0;
  28032. while (true) {
  28033. const deltaWidth = huffman ? huffmanTables.tableDeltaWidth.decode(huffmanInput) : decodeInteger(contextCache, "IADW", decoder);
  28034. if (deltaWidth === null) {
  28035. break;
  28036. }
  28037. currentWidth += deltaWidth;
  28038. totalWidth += currentWidth;
  28039. let bitmap;
  28040. if (refinement) {
  28041. const numberOfInstances = decodeInteger(contextCache, "IAAI", decoder);
  28042. if (numberOfInstances > 1) {
  28043. bitmap = decodeTextRegion(huffman, refinement, currentWidth, currentHeight, 0, numberOfInstances, 1, symbols.concat(newSymbols), symbolCodeLength, 0, 0, 1, 0, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext, 0, huffmanInput);
  28044. } else {
  28045. const symbolId = decodeIAID(contextCache, decoder, symbolCodeLength);
  28046. const rdx = decodeInteger(contextCache, "IARDX", decoder);
  28047. const rdy = decodeInteger(contextCache, "IARDY", decoder);
  28048. const symbol = symbolId < symbols.length ? symbols[symbolId] : newSymbols[symbolId - symbols.length];
  28049. bitmap = decodeRefinement(currentWidth, currentHeight, refinementTemplateIndex, symbol, rdx, rdy, false, refinementAt, decodingContext);
  28050. }
  28051. newSymbols.push(bitmap);
  28052. } else if (huffman) {
  28053. symbolWidths.push(currentWidth);
  28054. } else {
  28055. bitmap = decodeBitmap(false, currentWidth, currentHeight, templateIndex, false, null, at, decodingContext);
  28056. newSymbols.push(bitmap);
  28057. }
  28058. }
  28059. if (huffman && !refinement) {
  28060. const bitmapSize = huffmanTables.tableBitmapSize.decode(huffmanInput);
  28061. huffmanInput.byteAlign();
  28062. let collectiveBitmap;
  28063. if (bitmapSize === 0) {
  28064. collectiveBitmap = readUncompressedBitmap(huffmanInput, totalWidth, currentHeight);
  28065. } else {
  28066. const originalEnd = huffmanInput.end;
  28067. const bitmapEnd = huffmanInput.position + bitmapSize;
  28068. huffmanInput.end = bitmapEnd;
  28069. collectiveBitmap = decodeMMRBitmap(huffmanInput, totalWidth, currentHeight, false);
  28070. huffmanInput.end = originalEnd;
  28071. huffmanInput.position = bitmapEnd;
  28072. }
  28073. const numberOfSymbolsDecoded = symbolWidths.length;
  28074. if (firstSymbol === numberOfSymbolsDecoded - 1) {
  28075. newSymbols.push(collectiveBitmap);
  28076. } else {
  28077. let i,
  28078. y,
  28079. xMin = 0,
  28080. xMax,
  28081. bitmapWidth,
  28082. symbolBitmap;
  28083. for (i = firstSymbol; i < numberOfSymbolsDecoded; i++) {
  28084. bitmapWidth = symbolWidths[i];
  28085. xMax = xMin + bitmapWidth;
  28086. symbolBitmap = [];
  28087. for (y = 0; y < currentHeight; y++) {
  28088. symbolBitmap.push(collectiveBitmap[y].subarray(xMin, xMax));
  28089. }
  28090. newSymbols.push(symbolBitmap);
  28091. xMin = xMax;
  28092. }
  28093. }
  28094. }
  28095. }
  28096. const exportedSymbols = [],
  28097. flags = [];
  28098. let currentFlag = false,
  28099. i,
  28100. ii;
  28101. const totalSymbolsLength = symbols.length + numberOfNewSymbols;
  28102. while (flags.length < totalSymbolsLength) {
  28103. let runLength = huffman ? tableB1.decode(huffmanInput) : decodeInteger(contextCache, "IAEX", decoder);
  28104. while (runLength--) {
  28105. flags.push(currentFlag);
  28106. }
  28107. currentFlag = !currentFlag;
  28108. }
  28109. for (i = 0, ii = symbols.length; i < ii; i++) {
  28110. if (flags[i]) {
  28111. exportedSymbols.push(symbols[i]);
  28112. }
  28113. }
  28114. for (let j = 0; j < numberOfNewSymbols; i++, j++) {
  28115. if (flags[i]) {
  28116. exportedSymbols.push(newSymbols[j]);
  28117. }
  28118. }
  28119. return exportedSymbols;
  28120. }
  28121. function decodeTextRegion(huffman, refinement, width, height, defaultPixelValue, numberOfSymbolInstances, stripSize, inputSymbols, symbolCodeLength, transposed, dsOffset, referenceCorner, combinationOperator, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext, logStripSize, huffmanInput) {
  28122. if (huffman && refinement) {
  28123. throw new Jbig2Error("refinement with Huffman is not supported");
  28124. }
  28125. const bitmap = [];
  28126. let i, row;
  28127. for (i = 0; i < height; i++) {
  28128. row = new Uint8Array(width);
  28129. if (defaultPixelValue) {
  28130. for (let j = 0; j < width; j++) {
  28131. row[j] = defaultPixelValue;
  28132. }
  28133. }
  28134. bitmap.push(row);
  28135. }
  28136. const decoder = decodingContext.decoder;
  28137. const contextCache = decodingContext.contextCache;
  28138. let stripT = huffman ? -huffmanTables.tableDeltaT.decode(huffmanInput) : -decodeInteger(contextCache, "IADT", decoder);
  28139. let firstS = 0;
  28140. i = 0;
  28141. while (i < numberOfSymbolInstances) {
  28142. const deltaT = huffman ? huffmanTables.tableDeltaT.decode(huffmanInput) : decodeInteger(contextCache, "IADT", decoder);
  28143. stripT += deltaT;
  28144. const deltaFirstS = huffman ? huffmanTables.tableFirstS.decode(huffmanInput) : decodeInteger(contextCache, "IAFS", decoder);
  28145. firstS += deltaFirstS;
  28146. let currentS = firstS;
  28147. do {
  28148. let currentT = 0;
  28149. if (stripSize > 1) {
  28150. currentT = huffman ? huffmanInput.readBits(logStripSize) : decodeInteger(contextCache, "IAIT", decoder);
  28151. }
  28152. const t = stripSize * stripT + currentT;
  28153. const symbolId = huffman ? huffmanTables.symbolIDTable.decode(huffmanInput) : decodeIAID(contextCache, decoder, symbolCodeLength);
  28154. const applyRefinement = refinement && (huffman ? huffmanInput.readBit() : decodeInteger(contextCache, "IARI", decoder));
  28155. let symbolBitmap = inputSymbols[symbolId];
  28156. let symbolWidth = symbolBitmap[0].length;
  28157. let symbolHeight = symbolBitmap.length;
  28158. if (applyRefinement) {
  28159. const rdw = decodeInteger(contextCache, "IARDW", decoder);
  28160. const rdh = decodeInteger(contextCache, "IARDH", decoder);
  28161. const rdx = decodeInteger(contextCache, "IARDX", decoder);
  28162. const rdy = decodeInteger(contextCache, "IARDY", decoder);
  28163. symbolWidth += rdw;
  28164. symbolHeight += rdh;
  28165. symbolBitmap = decodeRefinement(symbolWidth, symbolHeight, refinementTemplateIndex, symbolBitmap, (rdw >> 1) + rdx, (rdh >> 1) + rdy, false, refinementAt, decodingContext);
  28166. }
  28167. const offsetT = t - (referenceCorner & 1 ? 0 : symbolHeight - 1);
  28168. const offsetS = currentS - (referenceCorner & 2 ? symbolWidth - 1 : 0);
  28169. let s2, t2, symbolRow;
  28170. if (transposed) {
  28171. for (s2 = 0; s2 < symbolHeight; s2++) {
  28172. row = bitmap[offsetS + s2];
  28173. if (!row) {
  28174. continue;
  28175. }
  28176. symbolRow = symbolBitmap[s2];
  28177. const maxWidth = Math.min(width - offsetT, symbolWidth);
  28178. switch (combinationOperator) {
  28179. case 0:
  28180. for (t2 = 0; t2 < maxWidth; t2++) {
  28181. row[offsetT + t2] |= symbolRow[t2];
  28182. }
  28183. break;
  28184. case 2:
  28185. for (t2 = 0; t2 < maxWidth; t2++) {
  28186. row[offsetT + t2] ^= symbolRow[t2];
  28187. }
  28188. break;
  28189. default:
  28190. throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
  28191. }
  28192. }
  28193. currentS += symbolHeight - 1;
  28194. } else {
  28195. for (t2 = 0; t2 < symbolHeight; t2++) {
  28196. row = bitmap[offsetT + t2];
  28197. if (!row) {
  28198. continue;
  28199. }
  28200. symbolRow = symbolBitmap[t2];
  28201. switch (combinationOperator) {
  28202. case 0:
  28203. for (s2 = 0; s2 < symbolWidth; s2++) {
  28204. row[offsetS + s2] |= symbolRow[s2];
  28205. }
  28206. break;
  28207. case 2:
  28208. for (s2 = 0; s2 < symbolWidth; s2++) {
  28209. row[offsetS + s2] ^= symbolRow[s2];
  28210. }
  28211. break;
  28212. default:
  28213. throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
  28214. }
  28215. }
  28216. currentS += symbolWidth - 1;
  28217. }
  28218. i++;
  28219. const deltaS = huffman ? huffmanTables.tableDeltaS.decode(huffmanInput) : decodeInteger(contextCache, "IADS", decoder);
  28220. if (deltaS === null) {
  28221. break;
  28222. }
  28223. currentS += deltaS + dsOffset;
  28224. } while (true);
  28225. }
  28226. return bitmap;
  28227. }
  28228. function decodePatternDictionary(mmr, patternWidth, patternHeight, maxPatternIndex, template, decodingContext) {
  28229. const at = [];
  28230. if (!mmr) {
  28231. at.push({
  28232. x: -patternWidth,
  28233. y: 0
  28234. });
  28235. if (template === 0) {
  28236. at.push({
  28237. x: -3,
  28238. y: -1
  28239. }, {
  28240. x: 2,
  28241. y: -2
  28242. }, {
  28243. x: -2,
  28244. y: -2
  28245. });
  28246. }
  28247. }
  28248. const collectiveWidth = (maxPatternIndex + 1) * patternWidth;
  28249. const collectiveBitmap = decodeBitmap(mmr, collectiveWidth, patternHeight, template, false, null, at, decodingContext);
  28250. const patterns = [];
  28251. for (let i = 0; i <= maxPatternIndex; i++) {
  28252. const patternBitmap = [];
  28253. const xMin = patternWidth * i;
  28254. const xMax = xMin + patternWidth;
  28255. for (let y = 0; y < patternHeight; y++) {
  28256. patternBitmap.push(collectiveBitmap[y].subarray(xMin, xMax));
  28257. }
  28258. patterns.push(patternBitmap);
  28259. }
  28260. return patterns;
  28261. }
  28262. function decodeHalftoneRegion(mmr, patterns, template, regionWidth, regionHeight, defaultPixelValue, enableSkip, combinationOperator, gridWidth, gridHeight, gridOffsetX, gridOffsetY, gridVectorX, gridVectorY, decodingContext) {
  28263. const skip = null;
  28264. if (enableSkip) {
  28265. throw new Jbig2Error("skip is not supported");
  28266. }
  28267. if (combinationOperator !== 0) {
  28268. throw new Jbig2Error(`operator "${combinationOperator}" is not supported in halftone region`);
  28269. }
  28270. const regionBitmap = [];
  28271. let i, j, row;
  28272. for (i = 0; i < regionHeight; i++) {
  28273. row = new Uint8Array(regionWidth);
  28274. if (defaultPixelValue) {
  28275. for (j = 0; j < regionWidth; j++) {
  28276. row[j] = defaultPixelValue;
  28277. }
  28278. }
  28279. regionBitmap.push(row);
  28280. }
  28281. const numberOfPatterns = patterns.length;
  28282. const pattern0 = patterns[0];
  28283. const patternWidth = pattern0[0].length,
  28284. patternHeight = pattern0.length;
  28285. const bitsPerValue = (0, _core_utils.log2)(numberOfPatterns);
  28286. const at = [];
  28287. if (!mmr) {
  28288. at.push({
  28289. x: template <= 1 ? 3 : 2,
  28290. y: -1
  28291. });
  28292. if (template === 0) {
  28293. at.push({
  28294. x: -3,
  28295. y: -1
  28296. }, {
  28297. x: 2,
  28298. y: -2
  28299. }, {
  28300. x: -2,
  28301. y: -2
  28302. });
  28303. }
  28304. }
  28305. const grayScaleBitPlanes = [];
  28306. let mmrInput, bitmap;
  28307. if (mmr) {
  28308. mmrInput = new Reader(decodingContext.data, decodingContext.start, decodingContext.end);
  28309. }
  28310. for (i = bitsPerValue - 1; i >= 0; i--) {
  28311. if (mmr) {
  28312. bitmap = decodeMMRBitmap(mmrInput, gridWidth, gridHeight, true);
  28313. } else {
  28314. bitmap = decodeBitmap(false, gridWidth, gridHeight, template, false, skip, at, decodingContext);
  28315. }
  28316. grayScaleBitPlanes[i] = bitmap;
  28317. }
  28318. let mg, ng, bit, patternIndex, patternBitmap, x, y, patternRow, regionRow;
  28319. for (mg = 0; mg < gridHeight; mg++) {
  28320. for (ng = 0; ng < gridWidth; ng++) {
  28321. bit = 0;
  28322. patternIndex = 0;
  28323. for (j = bitsPerValue - 1; j >= 0; j--) {
  28324. bit ^= grayScaleBitPlanes[j][mg][ng];
  28325. patternIndex |= bit << j;
  28326. }
  28327. patternBitmap = patterns[patternIndex];
  28328. x = gridOffsetX + mg * gridVectorY + ng * gridVectorX >> 8;
  28329. y = gridOffsetY + mg * gridVectorX - ng * gridVectorY >> 8;
  28330. if (x >= 0 && x + patternWidth <= regionWidth && y >= 0 && y + patternHeight <= regionHeight) {
  28331. for (i = 0; i < patternHeight; i++) {
  28332. regionRow = regionBitmap[y + i];
  28333. patternRow = patternBitmap[i];
  28334. for (j = 0; j < patternWidth; j++) {
  28335. regionRow[x + j] |= patternRow[j];
  28336. }
  28337. }
  28338. } else {
  28339. let regionX, regionY;
  28340. for (i = 0; i < patternHeight; i++) {
  28341. regionY = y + i;
  28342. if (regionY < 0 || regionY >= regionHeight) {
  28343. continue;
  28344. }
  28345. regionRow = regionBitmap[regionY];
  28346. patternRow = patternBitmap[i];
  28347. for (j = 0; j < patternWidth; j++) {
  28348. regionX = x + j;
  28349. if (regionX >= 0 && regionX < regionWidth) {
  28350. regionRow[regionX] |= patternRow[j];
  28351. }
  28352. }
  28353. }
  28354. }
  28355. }
  28356. }
  28357. return regionBitmap;
  28358. }
  28359. function readSegmentHeader(data, start) {
  28360. const segmentHeader = {};
  28361. segmentHeader.number = (0, _core_utils.readUint32)(data, start);
  28362. const flags = data[start + 4];
  28363. const segmentType = flags & 0x3f;
  28364. if (!SegmentTypes[segmentType]) {
  28365. throw new Jbig2Error("invalid segment type: " + segmentType);
  28366. }
  28367. segmentHeader.type = segmentType;
  28368. segmentHeader.typeName = SegmentTypes[segmentType];
  28369. segmentHeader.deferredNonRetain = !!(flags & 0x80);
  28370. const pageAssociationFieldSize = !!(flags & 0x40);
  28371. const referredFlags = data[start + 5];
  28372. let referredToCount = referredFlags >> 5 & 7;
  28373. const retainBits = [referredFlags & 31];
  28374. let position = start + 6;
  28375. if (referredFlags === 7) {
  28376. referredToCount = (0, _core_utils.readUint32)(data, position - 1) & 0x1fffffff;
  28377. position += 3;
  28378. let bytes = referredToCount + 7 >> 3;
  28379. retainBits[0] = data[position++];
  28380. while (--bytes > 0) {
  28381. retainBits.push(data[position++]);
  28382. }
  28383. } else if (referredFlags === 5 || referredFlags === 6) {
  28384. throw new Jbig2Error("invalid referred-to flags");
  28385. }
  28386. segmentHeader.retainBits = retainBits;
  28387. let referredToSegmentNumberSize = 4;
  28388. if (segmentHeader.number <= 256) {
  28389. referredToSegmentNumberSize = 1;
  28390. } else if (segmentHeader.number <= 65536) {
  28391. referredToSegmentNumberSize = 2;
  28392. }
  28393. const referredTo = [];
  28394. let i, ii;
  28395. for (i = 0; i < referredToCount; i++) {
  28396. let number;
  28397. if (referredToSegmentNumberSize === 1) {
  28398. number = data[position];
  28399. } else if (referredToSegmentNumberSize === 2) {
  28400. number = (0, _core_utils.readUint16)(data, position);
  28401. } else {
  28402. number = (0, _core_utils.readUint32)(data, position);
  28403. }
  28404. referredTo.push(number);
  28405. position += referredToSegmentNumberSize;
  28406. }
  28407. segmentHeader.referredTo = referredTo;
  28408. if (!pageAssociationFieldSize) {
  28409. segmentHeader.pageAssociation = data[position++];
  28410. } else {
  28411. segmentHeader.pageAssociation = (0, _core_utils.readUint32)(data, position);
  28412. position += 4;
  28413. }
  28414. segmentHeader.length = (0, _core_utils.readUint32)(data, position);
  28415. position += 4;
  28416. if (segmentHeader.length === 0xffffffff) {
  28417. if (segmentType === 38) {
  28418. const genericRegionInfo = readRegionSegmentInformation(data, position);
  28419. const genericRegionSegmentFlags = data[position + RegionSegmentInformationFieldLength];
  28420. const genericRegionMmr = !!(genericRegionSegmentFlags & 1);
  28421. const searchPatternLength = 6;
  28422. const searchPattern = new Uint8Array(searchPatternLength);
  28423. if (!genericRegionMmr) {
  28424. searchPattern[0] = 0xff;
  28425. searchPattern[1] = 0xac;
  28426. }
  28427. searchPattern[2] = genericRegionInfo.height >>> 24 & 0xff;
  28428. searchPattern[3] = genericRegionInfo.height >> 16 & 0xff;
  28429. searchPattern[4] = genericRegionInfo.height >> 8 & 0xff;
  28430. searchPattern[5] = genericRegionInfo.height & 0xff;
  28431. for (i = position, ii = data.length; i < ii; i++) {
  28432. let j = 0;
  28433. while (j < searchPatternLength && searchPattern[j] === data[i + j]) {
  28434. j++;
  28435. }
  28436. if (j === searchPatternLength) {
  28437. segmentHeader.length = i + searchPatternLength;
  28438. break;
  28439. }
  28440. }
  28441. if (segmentHeader.length === 0xffffffff) {
  28442. throw new Jbig2Error("segment end was not found");
  28443. }
  28444. } else {
  28445. throw new Jbig2Error("invalid unknown segment length");
  28446. }
  28447. }
  28448. segmentHeader.headerEnd = position;
  28449. return segmentHeader;
  28450. }
  28451. function readSegments(header, data, start, end) {
  28452. const segments = [];
  28453. let position = start;
  28454. while (position < end) {
  28455. const segmentHeader = readSegmentHeader(data, position);
  28456. position = segmentHeader.headerEnd;
  28457. const segment = {
  28458. header: segmentHeader,
  28459. data
  28460. };
  28461. if (!header.randomAccess) {
  28462. segment.start = position;
  28463. position += segmentHeader.length;
  28464. segment.end = position;
  28465. }
  28466. segments.push(segment);
  28467. if (segmentHeader.type === 51) {
  28468. break;
  28469. }
  28470. }
  28471. if (header.randomAccess) {
  28472. for (let i = 0, ii = segments.length; i < ii; i++) {
  28473. segments[i].start = position;
  28474. position += segments[i].header.length;
  28475. segments[i].end = position;
  28476. }
  28477. }
  28478. return segments;
  28479. }
  28480. function readRegionSegmentInformation(data, start) {
  28481. return {
  28482. width: (0, _core_utils.readUint32)(data, start),
  28483. height: (0, _core_utils.readUint32)(data, start + 4),
  28484. x: (0, _core_utils.readUint32)(data, start + 8),
  28485. y: (0, _core_utils.readUint32)(data, start + 12),
  28486. combinationOperator: data[start + 16] & 7
  28487. };
  28488. }
  28489. const RegionSegmentInformationFieldLength = 17;
  28490. function processSegment(segment, visitor) {
  28491. const header = segment.header;
  28492. const data = segment.data,
  28493. end = segment.end;
  28494. let position = segment.start;
  28495. let args, at, i, atLength;
  28496. switch (header.type) {
  28497. case 0:
  28498. const dictionary = {};
  28499. const dictionaryFlags = (0, _core_utils.readUint16)(data, position);
  28500. dictionary.huffman = !!(dictionaryFlags & 1);
  28501. dictionary.refinement = !!(dictionaryFlags & 2);
  28502. dictionary.huffmanDHSelector = dictionaryFlags >> 2 & 3;
  28503. dictionary.huffmanDWSelector = dictionaryFlags >> 4 & 3;
  28504. dictionary.bitmapSizeSelector = dictionaryFlags >> 6 & 1;
  28505. dictionary.aggregationInstancesSelector = dictionaryFlags >> 7 & 1;
  28506. dictionary.bitmapCodingContextUsed = !!(dictionaryFlags & 256);
  28507. dictionary.bitmapCodingContextRetained = !!(dictionaryFlags & 512);
  28508. dictionary.template = dictionaryFlags >> 10 & 3;
  28509. dictionary.refinementTemplate = dictionaryFlags >> 12 & 1;
  28510. position += 2;
  28511. if (!dictionary.huffman) {
  28512. atLength = dictionary.template === 0 ? 4 : 1;
  28513. at = [];
  28514. for (i = 0; i < atLength; i++) {
  28515. at.push({
  28516. x: (0, _core_utils.readInt8)(data, position),
  28517. y: (0, _core_utils.readInt8)(data, position + 1)
  28518. });
  28519. position += 2;
  28520. }
  28521. dictionary.at = at;
  28522. }
  28523. if (dictionary.refinement && !dictionary.refinementTemplate) {
  28524. at = [];
  28525. for (i = 0; i < 2; i++) {
  28526. at.push({
  28527. x: (0, _core_utils.readInt8)(data, position),
  28528. y: (0, _core_utils.readInt8)(data, position + 1)
  28529. });
  28530. position += 2;
  28531. }
  28532. dictionary.refinementAt = at;
  28533. }
  28534. dictionary.numberOfExportedSymbols = (0, _core_utils.readUint32)(data, position);
  28535. position += 4;
  28536. dictionary.numberOfNewSymbols = (0, _core_utils.readUint32)(data, position);
  28537. position += 4;
  28538. args = [dictionary, header.number, header.referredTo, data, position, end];
  28539. break;
  28540. case 6:
  28541. case 7:
  28542. const textRegion = {};
  28543. textRegion.info = readRegionSegmentInformation(data, position);
  28544. position += RegionSegmentInformationFieldLength;
  28545. const textRegionSegmentFlags = (0, _core_utils.readUint16)(data, position);
  28546. position += 2;
  28547. textRegion.huffman = !!(textRegionSegmentFlags & 1);
  28548. textRegion.refinement = !!(textRegionSegmentFlags & 2);
  28549. textRegion.logStripSize = textRegionSegmentFlags >> 2 & 3;
  28550. textRegion.stripSize = 1 << textRegion.logStripSize;
  28551. textRegion.referenceCorner = textRegionSegmentFlags >> 4 & 3;
  28552. textRegion.transposed = !!(textRegionSegmentFlags & 64);
  28553. textRegion.combinationOperator = textRegionSegmentFlags >> 7 & 3;
  28554. textRegion.defaultPixelValue = textRegionSegmentFlags >> 9 & 1;
  28555. textRegion.dsOffset = textRegionSegmentFlags << 17 >> 27;
  28556. textRegion.refinementTemplate = textRegionSegmentFlags >> 15 & 1;
  28557. if (textRegion.huffman) {
  28558. const textRegionHuffmanFlags = (0, _core_utils.readUint16)(data, position);
  28559. position += 2;
  28560. textRegion.huffmanFS = textRegionHuffmanFlags & 3;
  28561. textRegion.huffmanDS = textRegionHuffmanFlags >> 2 & 3;
  28562. textRegion.huffmanDT = textRegionHuffmanFlags >> 4 & 3;
  28563. textRegion.huffmanRefinementDW = textRegionHuffmanFlags >> 6 & 3;
  28564. textRegion.huffmanRefinementDH = textRegionHuffmanFlags >> 8 & 3;
  28565. textRegion.huffmanRefinementDX = textRegionHuffmanFlags >> 10 & 3;
  28566. textRegion.huffmanRefinementDY = textRegionHuffmanFlags >> 12 & 3;
  28567. textRegion.huffmanRefinementSizeSelector = !!(textRegionHuffmanFlags & 0x4000);
  28568. }
  28569. if (textRegion.refinement && !textRegion.refinementTemplate) {
  28570. at = [];
  28571. for (i = 0; i < 2; i++) {
  28572. at.push({
  28573. x: (0, _core_utils.readInt8)(data, position),
  28574. y: (0, _core_utils.readInt8)(data, position + 1)
  28575. });
  28576. position += 2;
  28577. }
  28578. textRegion.refinementAt = at;
  28579. }
  28580. textRegion.numberOfSymbolInstances = (0, _core_utils.readUint32)(data, position);
  28581. position += 4;
  28582. args = [textRegion, header.referredTo, data, position, end];
  28583. break;
  28584. case 16:
  28585. const patternDictionary = {};
  28586. const patternDictionaryFlags = data[position++];
  28587. patternDictionary.mmr = !!(patternDictionaryFlags & 1);
  28588. patternDictionary.template = patternDictionaryFlags >> 1 & 3;
  28589. patternDictionary.patternWidth = data[position++];
  28590. patternDictionary.patternHeight = data[position++];
  28591. patternDictionary.maxPatternIndex = (0, _core_utils.readUint32)(data, position);
  28592. position += 4;
  28593. args = [patternDictionary, header.number, data, position, end];
  28594. break;
  28595. case 22:
  28596. case 23:
  28597. const halftoneRegion = {};
  28598. halftoneRegion.info = readRegionSegmentInformation(data, position);
  28599. position += RegionSegmentInformationFieldLength;
  28600. const halftoneRegionFlags = data[position++];
  28601. halftoneRegion.mmr = !!(halftoneRegionFlags & 1);
  28602. halftoneRegion.template = halftoneRegionFlags >> 1 & 3;
  28603. halftoneRegion.enableSkip = !!(halftoneRegionFlags & 8);
  28604. halftoneRegion.combinationOperator = halftoneRegionFlags >> 4 & 7;
  28605. halftoneRegion.defaultPixelValue = halftoneRegionFlags >> 7 & 1;
  28606. halftoneRegion.gridWidth = (0, _core_utils.readUint32)(data, position);
  28607. position += 4;
  28608. halftoneRegion.gridHeight = (0, _core_utils.readUint32)(data, position);
  28609. position += 4;
  28610. halftoneRegion.gridOffsetX = (0, _core_utils.readUint32)(data, position) & 0xffffffff;
  28611. position += 4;
  28612. halftoneRegion.gridOffsetY = (0, _core_utils.readUint32)(data, position) & 0xffffffff;
  28613. position += 4;
  28614. halftoneRegion.gridVectorX = (0, _core_utils.readUint16)(data, position);
  28615. position += 2;
  28616. halftoneRegion.gridVectorY = (0, _core_utils.readUint16)(data, position);
  28617. position += 2;
  28618. args = [halftoneRegion, header.referredTo, data, position, end];
  28619. break;
  28620. case 38:
  28621. case 39:
  28622. const genericRegion = {};
  28623. genericRegion.info = readRegionSegmentInformation(data, position);
  28624. position += RegionSegmentInformationFieldLength;
  28625. const genericRegionSegmentFlags = data[position++];
  28626. genericRegion.mmr = !!(genericRegionSegmentFlags & 1);
  28627. genericRegion.template = genericRegionSegmentFlags >> 1 & 3;
  28628. genericRegion.prediction = !!(genericRegionSegmentFlags & 8);
  28629. if (!genericRegion.mmr) {
  28630. atLength = genericRegion.template === 0 ? 4 : 1;
  28631. at = [];
  28632. for (i = 0; i < atLength; i++) {
  28633. at.push({
  28634. x: (0, _core_utils.readInt8)(data, position),
  28635. y: (0, _core_utils.readInt8)(data, position + 1)
  28636. });
  28637. position += 2;
  28638. }
  28639. genericRegion.at = at;
  28640. }
  28641. args = [genericRegion, data, position, end];
  28642. break;
  28643. case 48:
  28644. const pageInfo = {
  28645. width: (0, _core_utils.readUint32)(data, position),
  28646. height: (0, _core_utils.readUint32)(data, position + 4),
  28647. resolutionX: (0, _core_utils.readUint32)(data, position + 8),
  28648. resolutionY: (0, _core_utils.readUint32)(data, position + 12)
  28649. };
  28650. if (pageInfo.height === 0xffffffff) {
  28651. delete pageInfo.height;
  28652. }
  28653. const pageSegmentFlags = data[position + 16];
  28654. (0, _core_utils.readUint16)(data, position + 17);
  28655. pageInfo.lossless = !!(pageSegmentFlags & 1);
  28656. pageInfo.refinement = !!(pageSegmentFlags & 2);
  28657. pageInfo.defaultPixelValue = pageSegmentFlags >> 2 & 1;
  28658. pageInfo.combinationOperator = pageSegmentFlags >> 3 & 3;
  28659. pageInfo.requiresBuffer = !!(pageSegmentFlags & 32);
  28660. pageInfo.combinationOperatorOverride = !!(pageSegmentFlags & 64);
  28661. args = [pageInfo];
  28662. break;
  28663. case 49:
  28664. break;
  28665. case 50:
  28666. break;
  28667. case 51:
  28668. break;
  28669. case 53:
  28670. args = [header.number, data, position, end];
  28671. break;
  28672. case 62:
  28673. break;
  28674. default:
  28675. throw new Jbig2Error(`segment type ${header.typeName}(${header.type}) is not implemented`);
  28676. }
  28677. const callbackName = "on" + header.typeName;
  28678. if (callbackName in visitor) {
  28679. visitor[callbackName].apply(visitor, args);
  28680. }
  28681. }
  28682. function processSegments(segments, visitor) {
  28683. for (let i = 0, ii = segments.length; i < ii; i++) {
  28684. processSegment(segments[i], visitor);
  28685. }
  28686. }
  28687. function parseJbig2Chunks(chunks) {
  28688. const visitor = new SimpleSegmentVisitor();
  28689. for (let i = 0, ii = chunks.length; i < ii; i++) {
  28690. const chunk = chunks[i];
  28691. const segments = readSegments({}, chunk.data, chunk.start, chunk.end);
  28692. processSegments(segments, visitor);
  28693. }
  28694. return visitor.buffer;
  28695. }
  28696. function parseJbig2(data) {
  28697. throw new Error("Not implemented: parseJbig2");
  28698. }
  28699. class SimpleSegmentVisitor {
  28700. onPageInformation(info) {
  28701. this.currentPageInfo = info;
  28702. const rowSize = info.width + 7 >> 3;
  28703. const buffer = new Uint8ClampedArray(rowSize * info.height);
  28704. if (info.defaultPixelValue) {
  28705. buffer.fill(0xff);
  28706. }
  28707. this.buffer = buffer;
  28708. }
  28709. drawBitmap(regionInfo, bitmap) {
  28710. const pageInfo = this.currentPageInfo;
  28711. const width = regionInfo.width,
  28712. height = regionInfo.height;
  28713. const rowSize = pageInfo.width + 7 >> 3;
  28714. const combinationOperator = pageInfo.combinationOperatorOverride ? regionInfo.combinationOperator : pageInfo.combinationOperator;
  28715. const buffer = this.buffer;
  28716. const mask0 = 128 >> (regionInfo.x & 7);
  28717. let offset0 = regionInfo.y * rowSize + (regionInfo.x >> 3);
  28718. let i, j, mask, offset;
  28719. switch (combinationOperator) {
  28720. case 0:
  28721. for (i = 0; i < height; i++) {
  28722. mask = mask0;
  28723. offset = offset0;
  28724. for (j = 0; j < width; j++) {
  28725. if (bitmap[i][j]) {
  28726. buffer[offset] |= mask;
  28727. }
  28728. mask >>= 1;
  28729. if (!mask) {
  28730. mask = 128;
  28731. offset++;
  28732. }
  28733. }
  28734. offset0 += rowSize;
  28735. }
  28736. break;
  28737. case 2:
  28738. for (i = 0; i < height; i++) {
  28739. mask = mask0;
  28740. offset = offset0;
  28741. for (j = 0; j < width; j++) {
  28742. if (bitmap[i][j]) {
  28743. buffer[offset] ^= mask;
  28744. }
  28745. mask >>= 1;
  28746. if (!mask) {
  28747. mask = 128;
  28748. offset++;
  28749. }
  28750. }
  28751. offset0 += rowSize;
  28752. }
  28753. break;
  28754. default:
  28755. throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
  28756. }
  28757. }
  28758. onImmediateGenericRegion(region, data, start, end) {
  28759. const regionInfo = region.info;
  28760. const decodingContext = new DecodingContext(data, start, end);
  28761. const bitmap = decodeBitmap(region.mmr, regionInfo.width, regionInfo.height, region.template, region.prediction, null, region.at, decodingContext);
  28762. this.drawBitmap(regionInfo, bitmap);
  28763. }
  28764. onImmediateLosslessGenericRegion() {
  28765. this.onImmediateGenericRegion.apply(this, arguments);
  28766. }
  28767. onSymbolDictionary(dictionary, currentSegment, referredSegments, data, start, end) {
  28768. let huffmanTables, huffmanInput;
  28769. if (dictionary.huffman) {
  28770. huffmanTables = getSymbolDictionaryHuffmanTables(dictionary, referredSegments, this.customTables);
  28771. huffmanInput = new Reader(data, start, end);
  28772. }
  28773. let symbols = this.symbols;
  28774. if (!symbols) {
  28775. this.symbols = symbols = {};
  28776. }
  28777. const inputSymbols = [];
  28778. for (const referredSegment of referredSegments) {
  28779. const referredSymbols = symbols[referredSegment];
  28780. if (referredSymbols) {
  28781. inputSymbols.push(...referredSymbols);
  28782. }
  28783. }
  28784. const decodingContext = new DecodingContext(data, start, end);
  28785. symbols[currentSegment] = decodeSymbolDictionary(dictionary.huffman, dictionary.refinement, inputSymbols, dictionary.numberOfNewSymbols, dictionary.numberOfExportedSymbols, huffmanTables, dictionary.template, dictionary.at, dictionary.refinementTemplate, dictionary.refinementAt, decodingContext, huffmanInput);
  28786. }
  28787. onImmediateTextRegion(region, referredSegments, data, start, end) {
  28788. const regionInfo = region.info;
  28789. let huffmanTables, huffmanInput;
  28790. const symbols = this.symbols;
  28791. const inputSymbols = [];
  28792. for (const referredSegment of referredSegments) {
  28793. const referredSymbols = symbols[referredSegment];
  28794. if (referredSymbols) {
  28795. inputSymbols.push(...referredSymbols);
  28796. }
  28797. }
  28798. const symbolCodeLength = (0, _core_utils.log2)(inputSymbols.length);
  28799. if (region.huffman) {
  28800. huffmanInput = new Reader(data, start, end);
  28801. huffmanTables = getTextRegionHuffmanTables(region, referredSegments, this.customTables, inputSymbols.length, huffmanInput);
  28802. }
  28803. const decodingContext = new DecodingContext(data, start, end);
  28804. 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);
  28805. this.drawBitmap(regionInfo, bitmap);
  28806. }
  28807. onImmediateLosslessTextRegion() {
  28808. this.onImmediateTextRegion.apply(this, arguments);
  28809. }
  28810. onPatternDictionary(dictionary, currentSegment, data, start, end) {
  28811. let patterns = this.patterns;
  28812. if (!patterns) {
  28813. this.patterns = patterns = {};
  28814. }
  28815. const decodingContext = new DecodingContext(data, start, end);
  28816. patterns[currentSegment] = decodePatternDictionary(dictionary.mmr, dictionary.patternWidth, dictionary.patternHeight, dictionary.maxPatternIndex, dictionary.template, decodingContext);
  28817. }
  28818. onImmediateHalftoneRegion(region, referredSegments, data, start, end) {
  28819. const patterns = this.patterns[referredSegments[0]];
  28820. const regionInfo = region.info;
  28821. const decodingContext = new DecodingContext(data, start, end);
  28822. 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);
  28823. this.drawBitmap(regionInfo, bitmap);
  28824. }
  28825. onImmediateLosslessHalftoneRegion() {
  28826. this.onImmediateHalftoneRegion.apply(this, arguments);
  28827. }
  28828. onTables(currentSegment, data, start, end) {
  28829. let customTables = this.customTables;
  28830. if (!customTables) {
  28831. this.customTables = customTables = {};
  28832. }
  28833. customTables[currentSegment] = decodeTablesSegment(data, start, end);
  28834. }
  28835. }
  28836. class HuffmanLine {
  28837. constructor(lineData) {
  28838. if (lineData.length === 2) {
  28839. this.isOOB = true;
  28840. this.rangeLow = 0;
  28841. this.prefixLength = lineData[0];
  28842. this.rangeLength = 0;
  28843. this.prefixCode = lineData[1];
  28844. this.isLowerRange = false;
  28845. } else {
  28846. this.isOOB = false;
  28847. this.rangeLow = lineData[0];
  28848. this.prefixLength = lineData[1];
  28849. this.rangeLength = lineData[2];
  28850. this.prefixCode = lineData[3];
  28851. this.isLowerRange = lineData[4] === "lower";
  28852. }
  28853. }
  28854. }
  28855. class HuffmanTreeNode {
  28856. constructor(line) {
  28857. this.children = [];
  28858. if (line) {
  28859. this.isLeaf = true;
  28860. this.rangeLength = line.rangeLength;
  28861. this.rangeLow = line.rangeLow;
  28862. this.isLowerRange = line.isLowerRange;
  28863. this.isOOB = line.isOOB;
  28864. } else {
  28865. this.isLeaf = false;
  28866. }
  28867. }
  28868. buildTree(line, shift) {
  28869. const bit = line.prefixCode >> shift & 1;
  28870. if (shift <= 0) {
  28871. this.children[bit] = new HuffmanTreeNode(line);
  28872. } else {
  28873. let node = this.children[bit];
  28874. if (!node) {
  28875. this.children[bit] = node = new HuffmanTreeNode(null);
  28876. }
  28877. node.buildTree(line, shift - 1);
  28878. }
  28879. }
  28880. decodeNode(reader) {
  28881. if (this.isLeaf) {
  28882. if (this.isOOB) {
  28883. return null;
  28884. }
  28885. const htOffset = reader.readBits(this.rangeLength);
  28886. return this.rangeLow + (this.isLowerRange ? -htOffset : htOffset);
  28887. }
  28888. const node = this.children[reader.readBit()];
  28889. if (!node) {
  28890. throw new Jbig2Error("invalid Huffman data");
  28891. }
  28892. return node.decodeNode(reader);
  28893. }
  28894. }
  28895. class HuffmanTable {
  28896. constructor(lines, prefixCodesDone) {
  28897. if (!prefixCodesDone) {
  28898. this.assignPrefixCodes(lines);
  28899. }
  28900. this.rootNode = new HuffmanTreeNode(null);
  28901. for (let i = 0, ii = lines.length; i < ii; i++) {
  28902. const line = lines[i];
  28903. if (line.prefixLength > 0) {
  28904. this.rootNode.buildTree(line, line.prefixLength - 1);
  28905. }
  28906. }
  28907. }
  28908. decode(reader) {
  28909. return this.rootNode.decodeNode(reader);
  28910. }
  28911. assignPrefixCodes(lines) {
  28912. const linesLength = lines.length;
  28913. let prefixLengthMax = 0;
  28914. for (let i = 0; i < linesLength; i++) {
  28915. prefixLengthMax = Math.max(prefixLengthMax, lines[i].prefixLength);
  28916. }
  28917. const histogram = new Uint32Array(prefixLengthMax + 1);
  28918. for (let i = 0; i < linesLength; i++) {
  28919. histogram[lines[i].prefixLength]++;
  28920. }
  28921. let currentLength = 1,
  28922. firstCode = 0,
  28923. currentCode,
  28924. currentTemp,
  28925. line;
  28926. histogram[0] = 0;
  28927. while (currentLength <= prefixLengthMax) {
  28928. firstCode = firstCode + histogram[currentLength - 1] << 1;
  28929. currentCode = firstCode;
  28930. currentTemp = 0;
  28931. while (currentTemp < linesLength) {
  28932. line = lines[currentTemp];
  28933. if (line.prefixLength === currentLength) {
  28934. line.prefixCode = currentCode;
  28935. currentCode++;
  28936. }
  28937. currentTemp++;
  28938. }
  28939. currentLength++;
  28940. }
  28941. }
  28942. }
  28943. function decodeTablesSegment(data, start, end) {
  28944. const flags = data[start];
  28945. const lowestValue = (0, _core_utils.readUint32)(data, start + 1) & 0xffffffff;
  28946. const highestValue = (0, _core_utils.readUint32)(data, start + 5) & 0xffffffff;
  28947. const reader = new Reader(data, start + 9, end);
  28948. const prefixSizeBits = (flags >> 1 & 7) + 1;
  28949. const rangeSizeBits = (flags >> 4 & 7) + 1;
  28950. const lines = [];
  28951. let prefixLength,
  28952. rangeLength,
  28953. currentRangeLow = lowestValue;
  28954. do {
  28955. prefixLength = reader.readBits(prefixSizeBits);
  28956. rangeLength = reader.readBits(rangeSizeBits);
  28957. lines.push(new HuffmanLine([currentRangeLow, prefixLength, rangeLength, 0]));
  28958. currentRangeLow += 1 << rangeLength;
  28959. } while (currentRangeLow < highestValue);
  28960. prefixLength = reader.readBits(prefixSizeBits);
  28961. lines.push(new HuffmanLine([lowestValue - 1, prefixLength, 32, 0, "lower"]));
  28962. prefixLength = reader.readBits(prefixSizeBits);
  28963. lines.push(new HuffmanLine([highestValue, prefixLength, 32, 0]));
  28964. if (flags & 1) {
  28965. prefixLength = reader.readBits(prefixSizeBits);
  28966. lines.push(new HuffmanLine([prefixLength, 0]));
  28967. }
  28968. return new HuffmanTable(lines, false);
  28969. }
  28970. const standardTablesCache = {};
  28971. function getStandardTable(number) {
  28972. let table = standardTablesCache[number];
  28973. if (table) {
  28974. return table;
  28975. }
  28976. let lines;
  28977. switch (number) {
  28978. case 1:
  28979. lines = [[0, 1, 4, 0x0], [16, 2, 8, 0x2], [272, 3, 16, 0x6], [65808, 3, 32, 0x7]];
  28980. break;
  28981. case 2:
  28982. 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]];
  28983. break;
  28984. case 3:
  28985. 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]];
  28986. break;
  28987. case 4:
  28988. 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]];
  28989. break;
  28990. case 5:
  28991. 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]];
  28992. break;
  28993. case 6:
  28994. 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]];
  28995. break;
  28996. case 7:
  28997. 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]];
  28998. break;
  28999. case 8:
  29000. 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]];
  29001. break;
  29002. case 9:
  29003. 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]];
  29004. break;
  29005. case 10:
  29006. 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]];
  29007. break;
  29008. case 11:
  29009. 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]];
  29010. break;
  29011. case 12:
  29012. 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]];
  29013. break;
  29014. case 13:
  29015. 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]];
  29016. break;
  29017. case 14:
  29018. lines = [[-2, 3, 0, 0x4], [-1, 3, 0, 0x5], [0, 1, 0, 0x0], [1, 3, 0, 0x6], [2, 3, 0, 0x7]];
  29019. break;
  29020. case 15:
  29021. 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]];
  29022. break;
  29023. default:
  29024. throw new Jbig2Error(`standard table B.${number} does not exist`);
  29025. }
  29026. for (let i = 0, ii = lines.length; i < ii; i++) {
  29027. lines[i] = new HuffmanLine(lines[i]);
  29028. }
  29029. table = new HuffmanTable(lines, true);
  29030. standardTablesCache[number] = table;
  29031. return table;
  29032. }
  29033. class Reader {
  29034. constructor(data, start, end) {
  29035. this.data = data;
  29036. this.start = start;
  29037. this.end = end;
  29038. this.position = start;
  29039. this.shift = -1;
  29040. this.currentByte = 0;
  29041. }
  29042. readBit() {
  29043. if (this.shift < 0) {
  29044. if (this.position >= this.end) {
  29045. throw new Jbig2Error("end of data while reading bit");
  29046. }
  29047. this.currentByte = this.data[this.position++];
  29048. this.shift = 7;
  29049. }
  29050. const bit = this.currentByte >> this.shift & 1;
  29051. this.shift--;
  29052. return bit;
  29053. }
  29054. readBits(numBits) {
  29055. let result = 0,
  29056. i;
  29057. for (i = numBits - 1; i >= 0; i--) {
  29058. result |= this.readBit() << i;
  29059. }
  29060. return result;
  29061. }
  29062. byteAlign() {
  29063. this.shift = -1;
  29064. }
  29065. next() {
  29066. if (this.position >= this.end) {
  29067. return -1;
  29068. }
  29069. return this.data[this.position++];
  29070. }
  29071. }
  29072. function getCustomHuffmanTable(index, referredTo, customTables) {
  29073. let currentIndex = 0;
  29074. for (let i = 0, ii = referredTo.length; i < ii; i++) {
  29075. const table = customTables[referredTo[i]];
  29076. if (table) {
  29077. if (index === currentIndex) {
  29078. return table;
  29079. }
  29080. currentIndex++;
  29081. }
  29082. }
  29083. throw new Jbig2Error("can't find custom Huffman table");
  29084. }
  29085. function getTextRegionHuffmanTables(textRegion, referredTo, customTables, numberOfSymbols, reader) {
  29086. const codes = [];
  29087. for (let i = 0; i <= 34; i++) {
  29088. const codeLength = reader.readBits(4);
  29089. codes.push(new HuffmanLine([i, codeLength, 0, 0]));
  29090. }
  29091. const runCodesTable = new HuffmanTable(codes, false);
  29092. codes.length = 0;
  29093. for (let i = 0; i < numberOfSymbols;) {
  29094. const codeLength = runCodesTable.decode(reader);
  29095. if (codeLength >= 32) {
  29096. let repeatedLength, numberOfRepeats, j;
  29097. switch (codeLength) {
  29098. case 32:
  29099. if (i === 0) {
  29100. throw new Jbig2Error("no previous value in symbol ID table");
  29101. }
  29102. numberOfRepeats = reader.readBits(2) + 3;
  29103. repeatedLength = codes[i - 1].prefixLength;
  29104. break;
  29105. case 33:
  29106. numberOfRepeats = reader.readBits(3) + 3;
  29107. repeatedLength = 0;
  29108. break;
  29109. case 34:
  29110. numberOfRepeats = reader.readBits(7) + 11;
  29111. repeatedLength = 0;
  29112. break;
  29113. default:
  29114. throw new Jbig2Error("invalid code length in symbol ID table");
  29115. }
  29116. for (j = 0; j < numberOfRepeats; j++) {
  29117. codes.push(new HuffmanLine([i, repeatedLength, 0, 0]));
  29118. i++;
  29119. }
  29120. } else {
  29121. codes.push(new HuffmanLine([i, codeLength, 0, 0]));
  29122. i++;
  29123. }
  29124. }
  29125. reader.byteAlign();
  29126. const symbolIDTable = new HuffmanTable(codes, false);
  29127. let customIndex = 0,
  29128. tableFirstS,
  29129. tableDeltaS,
  29130. tableDeltaT;
  29131. switch (textRegion.huffmanFS) {
  29132. case 0:
  29133. case 1:
  29134. tableFirstS = getStandardTable(textRegion.huffmanFS + 6);
  29135. break;
  29136. case 3:
  29137. tableFirstS = getCustomHuffmanTable(customIndex, referredTo, customTables);
  29138. customIndex++;
  29139. break;
  29140. default:
  29141. throw new Jbig2Error("invalid Huffman FS selector");
  29142. }
  29143. switch (textRegion.huffmanDS) {
  29144. case 0:
  29145. case 1:
  29146. case 2:
  29147. tableDeltaS = getStandardTable(textRegion.huffmanDS + 8);
  29148. break;
  29149. case 3:
  29150. tableDeltaS = getCustomHuffmanTable(customIndex, referredTo, customTables);
  29151. customIndex++;
  29152. break;
  29153. default:
  29154. throw new Jbig2Error("invalid Huffman DS selector");
  29155. }
  29156. switch (textRegion.huffmanDT) {
  29157. case 0:
  29158. case 1:
  29159. case 2:
  29160. tableDeltaT = getStandardTable(textRegion.huffmanDT + 11);
  29161. break;
  29162. case 3:
  29163. tableDeltaT = getCustomHuffmanTable(customIndex, referredTo, customTables);
  29164. customIndex++;
  29165. break;
  29166. default:
  29167. throw new Jbig2Error("invalid Huffman DT selector");
  29168. }
  29169. if (textRegion.refinement) {
  29170. throw new Jbig2Error("refinement with Huffman is not supported");
  29171. }
  29172. return {
  29173. symbolIDTable,
  29174. tableFirstS,
  29175. tableDeltaS,
  29176. tableDeltaT
  29177. };
  29178. }
  29179. function getSymbolDictionaryHuffmanTables(dictionary, referredTo, customTables) {
  29180. let customIndex = 0,
  29181. tableDeltaHeight,
  29182. tableDeltaWidth;
  29183. switch (dictionary.huffmanDHSelector) {
  29184. case 0:
  29185. case 1:
  29186. tableDeltaHeight = getStandardTable(dictionary.huffmanDHSelector + 4);
  29187. break;
  29188. case 3:
  29189. tableDeltaHeight = getCustomHuffmanTable(customIndex, referredTo, customTables);
  29190. customIndex++;
  29191. break;
  29192. default:
  29193. throw new Jbig2Error("invalid Huffman DH selector");
  29194. }
  29195. switch (dictionary.huffmanDWSelector) {
  29196. case 0:
  29197. case 1:
  29198. tableDeltaWidth = getStandardTable(dictionary.huffmanDWSelector + 2);
  29199. break;
  29200. case 3:
  29201. tableDeltaWidth = getCustomHuffmanTable(customIndex, referredTo, customTables);
  29202. customIndex++;
  29203. break;
  29204. default:
  29205. throw new Jbig2Error("invalid Huffman DW selector");
  29206. }
  29207. let tableBitmapSize, tableAggregateInstances;
  29208. if (dictionary.bitmapSizeSelector) {
  29209. tableBitmapSize = getCustomHuffmanTable(customIndex, referredTo, customTables);
  29210. customIndex++;
  29211. } else {
  29212. tableBitmapSize = getStandardTable(1);
  29213. }
  29214. if (dictionary.aggregationInstancesSelector) {
  29215. tableAggregateInstances = getCustomHuffmanTable(customIndex, referredTo, customTables);
  29216. } else {
  29217. tableAggregateInstances = getStandardTable(1);
  29218. }
  29219. return {
  29220. tableDeltaHeight,
  29221. tableDeltaWidth,
  29222. tableBitmapSize,
  29223. tableAggregateInstances
  29224. };
  29225. }
  29226. function readUncompressedBitmap(reader, width, height) {
  29227. const bitmap = [];
  29228. for (let y = 0; y < height; y++) {
  29229. const row = new Uint8Array(width);
  29230. bitmap.push(row);
  29231. for (let x = 0; x < width; x++) {
  29232. row[x] = reader.readBit();
  29233. }
  29234. reader.byteAlign();
  29235. }
  29236. return bitmap;
  29237. }
  29238. function decodeMMRBitmap(input, width, height, endOfBlock) {
  29239. const params = {
  29240. K: -1,
  29241. Columns: width,
  29242. Rows: height,
  29243. BlackIs1: true,
  29244. EndOfBlock: endOfBlock
  29245. };
  29246. const decoder = new _ccitt.CCITTFaxDecoder(input, params);
  29247. const bitmap = [];
  29248. let currentByte,
  29249. eof = false;
  29250. for (let y = 0; y < height; y++) {
  29251. const row = new Uint8Array(width);
  29252. bitmap.push(row);
  29253. let shift = -1;
  29254. for (let x = 0; x < width; x++) {
  29255. if (shift < 0) {
  29256. currentByte = decoder.readNextChar();
  29257. if (currentByte === -1) {
  29258. currentByte = 0;
  29259. eof = true;
  29260. }
  29261. shift = 7;
  29262. }
  29263. row[x] = currentByte >> shift & 1;
  29264. shift--;
  29265. }
  29266. }
  29267. if (endOfBlock && !eof) {
  29268. const lookForEOFLimit = 5;
  29269. for (let i = 0; i < lookForEOFLimit; i++) {
  29270. if (decoder.readNextChar() === -1) {
  29271. break;
  29272. }
  29273. }
  29274. }
  29275. return bitmap;
  29276. }
  29277. class Jbig2Image {
  29278. parseChunks(chunks) {
  29279. return parseJbig2Chunks(chunks);
  29280. }
  29281. parse(data) {
  29282. throw new Error("Not implemented: Jbig2Image.parse");
  29283. }
  29284. }
  29285. exports.Jbig2Image = Jbig2Image;
  29286. /***/ }),
  29287. /* 36 */
  29288. /***/ ((__unused_webpack_module, exports) => {
  29289. Object.defineProperty(exports, "__esModule", ({
  29290. value: true
  29291. }));
  29292. exports.ArithmeticDecoder = void 0;
  29293. const QeTable = [{
  29294. qe: 0x5601,
  29295. nmps: 1,
  29296. nlps: 1,
  29297. switchFlag: 1
  29298. }, {
  29299. qe: 0x3401,
  29300. nmps: 2,
  29301. nlps: 6,
  29302. switchFlag: 0
  29303. }, {
  29304. qe: 0x1801,
  29305. nmps: 3,
  29306. nlps: 9,
  29307. switchFlag: 0
  29308. }, {
  29309. qe: 0x0ac1,
  29310. nmps: 4,
  29311. nlps: 12,
  29312. switchFlag: 0
  29313. }, {
  29314. qe: 0x0521,
  29315. nmps: 5,
  29316. nlps: 29,
  29317. switchFlag: 0
  29318. }, {
  29319. qe: 0x0221,
  29320. nmps: 38,
  29321. nlps: 33,
  29322. switchFlag: 0
  29323. }, {
  29324. qe: 0x5601,
  29325. nmps: 7,
  29326. nlps: 6,
  29327. switchFlag: 1
  29328. }, {
  29329. qe: 0x5401,
  29330. nmps: 8,
  29331. nlps: 14,
  29332. switchFlag: 0
  29333. }, {
  29334. qe: 0x4801,
  29335. nmps: 9,
  29336. nlps: 14,
  29337. switchFlag: 0
  29338. }, {
  29339. qe: 0x3801,
  29340. nmps: 10,
  29341. nlps: 14,
  29342. switchFlag: 0
  29343. }, {
  29344. qe: 0x3001,
  29345. nmps: 11,
  29346. nlps: 17,
  29347. switchFlag: 0
  29348. }, {
  29349. qe: 0x2401,
  29350. nmps: 12,
  29351. nlps: 18,
  29352. switchFlag: 0
  29353. }, {
  29354. qe: 0x1c01,
  29355. nmps: 13,
  29356. nlps: 20,
  29357. switchFlag: 0
  29358. }, {
  29359. qe: 0x1601,
  29360. nmps: 29,
  29361. nlps: 21,
  29362. switchFlag: 0
  29363. }, {
  29364. qe: 0x5601,
  29365. nmps: 15,
  29366. nlps: 14,
  29367. switchFlag: 1
  29368. }, {
  29369. qe: 0x5401,
  29370. nmps: 16,
  29371. nlps: 14,
  29372. switchFlag: 0
  29373. }, {
  29374. qe: 0x5101,
  29375. nmps: 17,
  29376. nlps: 15,
  29377. switchFlag: 0
  29378. }, {
  29379. qe: 0x4801,
  29380. nmps: 18,
  29381. nlps: 16,
  29382. switchFlag: 0
  29383. }, {
  29384. qe: 0x3801,
  29385. nmps: 19,
  29386. nlps: 17,
  29387. switchFlag: 0
  29388. }, {
  29389. qe: 0x3401,
  29390. nmps: 20,
  29391. nlps: 18,
  29392. switchFlag: 0
  29393. }, {
  29394. qe: 0x3001,
  29395. nmps: 21,
  29396. nlps: 19,
  29397. switchFlag: 0
  29398. }, {
  29399. qe: 0x2801,
  29400. nmps: 22,
  29401. nlps: 19,
  29402. switchFlag: 0
  29403. }, {
  29404. qe: 0x2401,
  29405. nmps: 23,
  29406. nlps: 20,
  29407. switchFlag: 0
  29408. }, {
  29409. qe: 0x2201,
  29410. nmps: 24,
  29411. nlps: 21,
  29412. switchFlag: 0
  29413. }, {
  29414. qe: 0x1c01,
  29415. nmps: 25,
  29416. nlps: 22,
  29417. switchFlag: 0
  29418. }, {
  29419. qe: 0x1801,
  29420. nmps: 26,
  29421. nlps: 23,
  29422. switchFlag: 0
  29423. }, {
  29424. qe: 0x1601,
  29425. nmps: 27,
  29426. nlps: 24,
  29427. switchFlag: 0
  29428. }, {
  29429. qe: 0x1401,
  29430. nmps: 28,
  29431. nlps: 25,
  29432. switchFlag: 0
  29433. }, {
  29434. qe: 0x1201,
  29435. nmps: 29,
  29436. nlps: 26,
  29437. switchFlag: 0
  29438. }, {
  29439. qe: 0x1101,
  29440. nmps: 30,
  29441. nlps: 27,
  29442. switchFlag: 0
  29443. }, {
  29444. qe: 0x0ac1,
  29445. nmps: 31,
  29446. nlps: 28,
  29447. switchFlag: 0
  29448. }, {
  29449. qe: 0x09c1,
  29450. nmps: 32,
  29451. nlps: 29,
  29452. switchFlag: 0
  29453. }, {
  29454. qe: 0x08a1,
  29455. nmps: 33,
  29456. nlps: 30,
  29457. switchFlag: 0
  29458. }, {
  29459. qe: 0x0521,
  29460. nmps: 34,
  29461. nlps: 31,
  29462. switchFlag: 0
  29463. }, {
  29464. qe: 0x0441,
  29465. nmps: 35,
  29466. nlps: 32,
  29467. switchFlag: 0
  29468. }, {
  29469. qe: 0x02a1,
  29470. nmps: 36,
  29471. nlps: 33,
  29472. switchFlag: 0
  29473. }, {
  29474. qe: 0x0221,
  29475. nmps: 37,
  29476. nlps: 34,
  29477. switchFlag: 0
  29478. }, {
  29479. qe: 0x0141,
  29480. nmps: 38,
  29481. nlps: 35,
  29482. switchFlag: 0
  29483. }, {
  29484. qe: 0x0111,
  29485. nmps: 39,
  29486. nlps: 36,
  29487. switchFlag: 0
  29488. }, {
  29489. qe: 0x0085,
  29490. nmps: 40,
  29491. nlps: 37,
  29492. switchFlag: 0
  29493. }, {
  29494. qe: 0x0049,
  29495. nmps: 41,
  29496. nlps: 38,
  29497. switchFlag: 0
  29498. }, {
  29499. qe: 0x0025,
  29500. nmps: 42,
  29501. nlps: 39,
  29502. switchFlag: 0
  29503. }, {
  29504. qe: 0x0015,
  29505. nmps: 43,
  29506. nlps: 40,
  29507. switchFlag: 0
  29508. }, {
  29509. qe: 0x0009,
  29510. nmps: 44,
  29511. nlps: 41,
  29512. switchFlag: 0
  29513. }, {
  29514. qe: 0x0005,
  29515. nmps: 45,
  29516. nlps: 42,
  29517. switchFlag: 0
  29518. }, {
  29519. qe: 0x0001,
  29520. nmps: 45,
  29521. nlps: 43,
  29522. switchFlag: 0
  29523. }, {
  29524. qe: 0x5601,
  29525. nmps: 46,
  29526. nlps: 46,
  29527. switchFlag: 0
  29528. }];
  29529. class ArithmeticDecoder {
  29530. constructor(data, start, end) {
  29531. this.data = data;
  29532. this.bp = start;
  29533. this.dataEnd = end;
  29534. this.chigh = data[start];
  29535. this.clow = 0;
  29536. this.byteIn();
  29537. this.chigh = this.chigh << 7 & 0xffff | this.clow >> 9 & 0x7f;
  29538. this.clow = this.clow << 7 & 0xffff;
  29539. this.ct -= 7;
  29540. this.a = 0x8000;
  29541. }
  29542. byteIn() {
  29543. const data = this.data;
  29544. let bp = this.bp;
  29545. if (data[bp] === 0xff) {
  29546. if (data[bp + 1] > 0x8f) {
  29547. this.clow += 0xff00;
  29548. this.ct = 8;
  29549. } else {
  29550. bp++;
  29551. this.clow += data[bp] << 9;
  29552. this.ct = 7;
  29553. this.bp = bp;
  29554. }
  29555. } else {
  29556. bp++;
  29557. this.clow += bp < this.dataEnd ? data[bp] << 8 : 0xff00;
  29558. this.ct = 8;
  29559. this.bp = bp;
  29560. }
  29561. if (this.clow > 0xffff) {
  29562. this.chigh += this.clow >> 16;
  29563. this.clow &= 0xffff;
  29564. }
  29565. }
  29566. readBit(contexts, pos) {
  29567. let cx_index = contexts[pos] >> 1,
  29568. cx_mps = contexts[pos] & 1;
  29569. const qeTableIcx = QeTable[cx_index];
  29570. const qeIcx = qeTableIcx.qe;
  29571. let d;
  29572. let a = this.a - qeIcx;
  29573. if (this.chigh < qeIcx) {
  29574. if (a < qeIcx) {
  29575. a = qeIcx;
  29576. d = cx_mps;
  29577. cx_index = qeTableIcx.nmps;
  29578. } else {
  29579. a = qeIcx;
  29580. d = 1 ^ cx_mps;
  29581. if (qeTableIcx.switchFlag === 1) {
  29582. cx_mps = d;
  29583. }
  29584. cx_index = qeTableIcx.nlps;
  29585. }
  29586. } else {
  29587. this.chigh -= qeIcx;
  29588. if ((a & 0x8000) !== 0) {
  29589. this.a = a;
  29590. return cx_mps;
  29591. }
  29592. if (a < qeIcx) {
  29593. d = 1 ^ cx_mps;
  29594. if (qeTableIcx.switchFlag === 1) {
  29595. cx_mps = d;
  29596. }
  29597. cx_index = qeTableIcx.nlps;
  29598. } else {
  29599. d = cx_mps;
  29600. cx_index = qeTableIcx.nmps;
  29601. }
  29602. }
  29603. do {
  29604. if (this.ct === 0) {
  29605. this.byteIn();
  29606. }
  29607. a <<= 1;
  29608. this.chigh = this.chigh << 1 & 0xffff | this.clow >> 15 & 1;
  29609. this.clow = this.clow << 1 & 0xffff;
  29610. this.ct--;
  29611. } while ((a & 0x8000) === 0);
  29612. this.a = a;
  29613. contexts[pos] = cx_index << 1 | cx_mps;
  29614. return d;
  29615. }
  29616. }
  29617. exports.ArithmeticDecoder = ArithmeticDecoder;
  29618. /***/ }),
  29619. /* 37 */
  29620. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  29621. Object.defineProperty(exports, "__esModule", ({
  29622. value: true
  29623. }));
  29624. exports.JpegStream = void 0;
  29625. var _decode_stream = __w_pdfjs_require__(29);
  29626. var _primitives = __w_pdfjs_require__(5);
  29627. var _jpg = __w_pdfjs_require__(38);
  29628. var _util = __w_pdfjs_require__(2);
  29629. class JpegStream extends _decode_stream.DecodeStream {
  29630. constructor(stream, maybeLength, params) {
  29631. let ch;
  29632. while ((ch = stream.getByte()) !== -1) {
  29633. if (ch === 0xff) {
  29634. stream.skip(-1);
  29635. break;
  29636. }
  29637. }
  29638. super(maybeLength);
  29639. this.stream = stream;
  29640. this.dict = stream.dict;
  29641. this.maybeLength = maybeLength;
  29642. this.params = params;
  29643. }
  29644. get bytes() {
  29645. return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength));
  29646. }
  29647. ensureBuffer(requested) {}
  29648. readBlock() {
  29649. if (this.eof) {
  29650. return;
  29651. }
  29652. const jpegOptions = {
  29653. decodeTransform: undefined,
  29654. colorTransform: undefined
  29655. };
  29656. const decodeArr = this.dict.getArray("D", "Decode");
  29657. if (this.forceRGB && Array.isArray(decodeArr)) {
  29658. const bitsPerComponent = this.dict.get("BPC", "BitsPerComponent") || 8;
  29659. const decodeArrLength = decodeArr.length;
  29660. const transform = new Int32Array(decodeArrLength);
  29661. let transformNeeded = false;
  29662. const maxValue = (1 << bitsPerComponent) - 1;
  29663. for (let i = 0; i < decodeArrLength; i += 2) {
  29664. transform[i] = (decodeArr[i + 1] - decodeArr[i]) * 256 | 0;
  29665. transform[i + 1] = decodeArr[i] * maxValue | 0;
  29666. if (transform[i] !== 256 || transform[i + 1] !== 0) {
  29667. transformNeeded = true;
  29668. }
  29669. }
  29670. if (transformNeeded) {
  29671. jpegOptions.decodeTransform = transform;
  29672. }
  29673. }
  29674. if (this.params instanceof _primitives.Dict) {
  29675. const colorTransform = this.params.get("ColorTransform");
  29676. if (Number.isInteger(colorTransform)) {
  29677. jpegOptions.colorTransform = colorTransform;
  29678. }
  29679. }
  29680. const jpegImage = new _jpg.JpegImage(jpegOptions);
  29681. jpegImage.parse(this.bytes);
  29682. const data = jpegImage.getData({
  29683. width: this.drawWidth,
  29684. height: this.drawHeight,
  29685. forceRGB: this.forceRGB,
  29686. isSourcePDF: true
  29687. });
  29688. this.buffer = data;
  29689. this.bufferLength = data.length;
  29690. this.eof = true;
  29691. }
  29692. }
  29693. exports.JpegStream = JpegStream;
  29694. /***/ }),
  29695. /* 38 */
  29696. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  29697. Object.defineProperty(exports, "__esModule", ({
  29698. value: true
  29699. }));
  29700. exports.JpegImage = void 0;
  29701. var _util = __w_pdfjs_require__(2);
  29702. var _core_utils = __w_pdfjs_require__(6);
  29703. class JpegError extends _util.BaseException {
  29704. constructor(msg) {
  29705. super(`JPEG error: ${msg}`, "JpegError");
  29706. }
  29707. }
  29708. class DNLMarkerError extends _util.BaseException {
  29709. constructor(message, scanLines) {
  29710. super(message, "DNLMarkerError");
  29711. this.scanLines = scanLines;
  29712. }
  29713. }
  29714. class EOIMarkerError extends _util.BaseException {
  29715. constructor(msg) {
  29716. super(msg, "EOIMarkerError");
  29717. }
  29718. }
  29719. 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]);
  29720. const dctCos1 = 4017;
  29721. const dctSin1 = 799;
  29722. const dctCos3 = 3406;
  29723. const dctSin3 = 2276;
  29724. const dctCos6 = 1567;
  29725. const dctSin6 = 3784;
  29726. const dctSqrt2 = 5793;
  29727. const dctSqrt1d2 = 2896;
  29728. function buildHuffmanTable(codeLengths, values) {
  29729. let k = 0,
  29730. i,
  29731. j,
  29732. length = 16;
  29733. while (length > 0 && !codeLengths[length - 1]) {
  29734. length--;
  29735. }
  29736. const code = [{
  29737. children: [],
  29738. index: 0
  29739. }];
  29740. let p = code[0],
  29741. q;
  29742. for (i = 0; i < length; i++) {
  29743. for (j = 0; j < codeLengths[i]; j++) {
  29744. p = code.pop();
  29745. p.children[p.index] = values[k];
  29746. while (p.index > 0) {
  29747. p = code.pop();
  29748. }
  29749. p.index++;
  29750. code.push(p);
  29751. while (code.length <= i) {
  29752. code.push(q = {
  29753. children: [],
  29754. index: 0
  29755. });
  29756. p.children[p.index] = q.children;
  29757. p = q;
  29758. }
  29759. k++;
  29760. }
  29761. if (i + 1 < length) {
  29762. code.push(q = {
  29763. children: [],
  29764. index: 0
  29765. });
  29766. p.children[p.index] = q.children;
  29767. p = q;
  29768. }
  29769. }
  29770. return code[0].children;
  29771. }
  29772. function getBlockBufferOffset(component, row, col) {
  29773. return 64 * ((component.blocksPerLine + 1) * row + col);
  29774. }
  29775. function decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successivePrev, successive, parseDNLMarker = false) {
  29776. const mcusPerLine = frame.mcusPerLine;
  29777. const progressive = frame.progressive;
  29778. const startOffset = offset;
  29779. let bitsData = 0,
  29780. bitsCount = 0;
  29781. function readBit() {
  29782. if (bitsCount > 0) {
  29783. bitsCount--;
  29784. return bitsData >> bitsCount & 1;
  29785. }
  29786. bitsData = data[offset++];
  29787. if (bitsData === 0xff) {
  29788. const nextByte = data[offset++];
  29789. if (nextByte) {
  29790. if (nextByte === 0xdc && parseDNLMarker) {
  29791. offset += 2;
  29792. const scanLines = (0, _core_utils.readUint16)(data, offset);
  29793. offset += 2;
  29794. if (scanLines > 0 && scanLines !== frame.scanLines) {
  29795. throw new DNLMarkerError("Found DNL marker (0xFFDC) while parsing scan data", scanLines);
  29796. }
  29797. } else if (nextByte === 0xd9) {
  29798. if (parseDNLMarker) {
  29799. const maybeScanLines = blockRow * (frame.precision === 8 ? 8 : 0);
  29800. if (maybeScanLines > 0 && Math.round(frame.scanLines / maybeScanLines) >= 10) {
  29801. throw new DNLMarkerError("Found EOI marker (0xFFD9) while parsing scan data, " + "possibly caused by incorrect `scanLines` parameter", maybeScanLines);
  29802. }
  29803. }
  29804. throw new EOIMarkerError("Found EOI marker (0xFFD9) while parsing scan data");
  29805. }
  29806. throw new JpegError(`unexpected marker ${(bitsData << 8 | nextByte).toString(16)}`);
  29807. }
  29808. }
  29809. bitsCount = 7;
  29810. return bitsData >>> 7;
  29811. }
  29812. function decodeHuffman(tree) {
  29813. let node = tree;
  29814. while (true) {
  29815. node = node[readBit()];
  29816. switch (typeof node) {
  29817. case "number":
  29818. return node;
  29819. case "object":
  29820. continue;
  29821. }
  29822. throw new JpegError("invalid huffman sequence");
  29823. }
  29824. }
  29825. function receive(length) {
  29826. let n = 0;
  29827. while (length > 0) {
  29828. n = n << 1 | readBit();
  29829. length--;
  29830. }
  29831. return n;
  29832. }
  29833. function receiveAndExtend(length) {
  29834. if (length === 1) {
  29835. return readBit() === 1 ? 1 : -1;
  29836. }
  29837. const n = receive(length);
  29838. if (n >= 1 << length - 1) {
  29839. return n;
  29840. }
  29841. return n + (-1 << length) + 1;
  29842. }
  29843. function decodeBaseline(component, blockOffset) {
  29844. const t = decodeHuffman(component.huffmanTableDC);
  29845. const diff = t === 0 ? 0 : receiveAndExtend(t);
  29846. component.blockData[blockOffset] = component.pred += diff;
  29847. let k = 1;
  29848. while (k < 64) {
  29849. const rs = decodeHuffman(component.huffmanTableAC);
  29850. const s = rs & 15,
  29851. r = rs >> 4;
  29852. if (s === 0) {
  29853. if (r < 15) {
  29854. break;
  29855. }
  29856. k += 16;
  29857. continue;
  29858. }
  29859. k += r;
  29860. const z = dctZigZag[k];
  29861. component.blockData[blockOffset + z] = receiveAndExtend(s);
  29862. k++;
  29863. }
  29864. }
  29865. function decodeDCFirst(component, blockOffset) {
  29866. const t = decodeHuffman(component.huffmanTableDC);
  29867. const diff = t === 0 ? 0 : receiveAndExtend(t) << successive;
  29868. component.blockData[blockOffset] = component.pred += diff;
  29869. }
  29870. function decodeDCSuccessive(component, blockOffset) {
  29871. component.blockData[blockOffset] |= readBit() << successive;
  29872. }
  29873. let eobrun = 0;
  29874. function decodeACFirst(component, blockOffset) {
  29875. if (eobrun > 0) {
  29876. eobrun--;
  29877. return;
  29878. }
  29879. let k = spectralStart;
  29880. const e = spectralEnd;
  29881. while (k <= e) {
  29882. const rs = decodeHuffman(component.huffmanTableAC);
  29883. const s = rs & 15,
  29884. r = rs >> 4;
  29885. if (s === 0) {
  29886. if (r < 15) {
  29887. eobrun = receive(r) + (1 << r) - 1;
  29888. break;
  29889. }
  29890. k += 16;
  29891. continue;
  29892. }
  29893. k += r;
  29894. const z = dctZigZag[k];
  29895. component.blockData[blockOffset + z] = receiveAndExtend(s) * (1 << successive);
  29896. k++;
  29897. }
  29898. }
  29899. let successiveACState = 0,
  29900. successiveACNextValue;
  29901. function decodeACSuccessive(component, blockOffset) {
  29902. let k = spectralStart;
  29903. const e = spectralEnd;
  29904. let r = 0;
  29905. let s;
  29906. let rs;
  29907. while (k <= e) {
  29908. const offsetZ = blockOffset + dctZigZag[k];
  29909. const sign = component.blockData[offsetZ] < 0 ? -1 : 1;
  29910. switch (successiveACState) {
  29911. case 0:
  29912. rs = decodeHuffman(component.huffmanTableAC);
  29913. s = rs & 15;
  29914. r = rs >> 4;
  29915. if (s === 0) {
  29916. if (r < 15) {
  29917. eobrun = receive(r) + (1 << r);
  29918. successiveACState = 4;
  29919. } else {
  29920. r = 16;
  29921. successiveACState = 1;
  29922. }
  29923. } else {
  29924. if (s !== 1) {
  29925. throw new JpegError("invalid ACn encoding");
  29926. }
  29927. successiveACNextValue = receiveAndExtend(s);
  29928. successiveACState = r ? 2 : 3;
  29929. }
  29930. continue;
  29931. case 1:
  29932. case 2:
  29933. if (component.blockData[offsetZ]) {
  29934. component.blockData[offsetZ] += sign * (readBit() << successive);
  29935. } else {
  29936. r--;
  29937. if (r === 0) {
  29938. successiveACState = successiveACState === 2 ? 3 : 0;
  29939. }
  29940. }
  29941. break;
  29942. case 3:
  29943. if (component.blockData[offsetZ]) {
  29944. component.blockData[offsetZ] += sign * (readBit() << successive);
  29945. } else {
  29946. component.blockData[offsetZ] = successiveACNextValue << successive;
  29947. successiveACState = 0;
  29948. }
  29949. break;
  29950. case 4:
  29951. if (component.blockData[offsetZ]) {
  29952. component.blockData[offsetZ] += sign * (readBit() << successive);
  29953. }
  29954. break;
  29955. }
  29956. k++;
  29957. }
  29958. if (successiveACState === 4) {
  29959. eobrun--;
  29960. if (eobrun === 0) {
  29961. successiveACState = 0;
  29962. }
  29963. }
  29964. }
  29965. let blockRow = 0;
  29966. function decodeMcu(component, decode, mcu, row, col) {
  29967. const mcuRow = mcu / mcusPerLine | 0;
  29968. const mcuCol = mcu % mcusPerLine;
  29969. blockRow = mcuRow * component.v + row;
  29970. const blockCol = mcuCol * component.h + col;
  29971. const blockOffset = getBlockBufferOffset(component, blockRow, blockCol);
  29972. decode(component, blockOffset);
  29973. }
  29974. function decodeBlock(component, decode, mcu) {
  29975. blockRow = mcu / component.blocksPerLine | 0;
  29976. const blockCol = mcu % component.blocksPerLine;
  29977. const blockOffset = getBlockBufferOffset(component, blockRow, blockCol);
  29978. decode(component, blockOffset);
  29979. }
  29980. const componentsLength = components.length;
  29981. let component, i, j, k, n;
  29982. let decodeFn;
  29983. if (progressive) {
  29984. if (spectralStart === 0) {
  29985. decodeFn = successivePrev === 0 ? decodeDCFirst : decodeDCSuccessive;
  29986. } else {
  29987. decodeFn = successivePrev === 0 ? decodeACFirst : decodeACSuccessive;
  29988. }
  29989. } else {
  29990. decodeFn = decodeBaseline;
  29991. }
  29992. let mcu = 0,
  29993. fileMarker;
  29994. let mcuExpected;
  29995. if (componentsLength === 1) {
  29996. mcuExpected = components[0].blocksPerLine * components[0].blocksPerColumn;
  29997. } else {
  29998. mcuExpected = mcusPerLine * frame.mcusPerColumn;
  29999. }
  30000. let h, v;
  30001. while (mcu <= mcuExpected) {
  30002. const mcuToRead = resetInterval ? Math.min(mcuExpected - mcu, resetInterval) : mcuExpected;
  30003. if (mcuToRead > 0) {
  30004. for (i = 0; i < componentsLength; i++) {
  30005. components[i].pred = 0;
  30006. }
  30007. eobrun = 0;
  30008. if (componentsLength === 1) {
  30009. component = components[0];
  30010. for (n = 0; n < mcuToRead; n++) {
  30011. decodeBlock(component, decodeFn, mcu);
  30012. mcu++;
  30013. }
  30014. } else {
  30015. for (n = 0; n < mcuToRead; n++) {
  30016. for (i = 0; i < componentsLength; i++) {
  30017. component = components[i];
  30018. h = component.h;
  30019. v = component.v;
  30020. for (j = 0; j < v; j++) {
  30021. for (k = 0; k < h; k++) {
  30022. decodeMcu(component, decodeFn, mcu, j, k);
  30023. }
  30024. }
  30025. }
  30026. mcu++;
  30027. }
  30028. }
  30029. }
  30030. bitsCount = 0;
  30031. fileMarker = findNextFileMarker(data, offset);
  30032. if (!fileMarker) {
  30033. break;
  30034. }
  30035. if (fileMarker.invalid) {
  30036. const partialMsg = mcuToRead > 0 ? "unexpected" : "excessive";
  30037. (0, _util.warn)(`decodeScan - ${partialMsg} MCU data, current marker is: ${fileMarker.invalid}`);
  30038. offset = fileMarker.offset;
  30039. }
  30040. if (fileMarker.marker >= 0xffd0 && fileMarker.marker <= 0xffd7) {
  30041. offset += 2;
  30042. } else {
  30043. break;
  30044. }
  30045. }
  30046. return offset - startOffset;
  30047. }
  30048. function quantizeAndInverse(component, blockBufferOffset, p) {
  30049. const qt = component.quantizationTable,
  30050. blockData = component.blockData;
  30051. let v0, v1, v2, v3, v4, v5, v6, v7;
  30052. let p0, p1, p2, p3, p4, p5, p6, p7;
  30053. let t;
  30054. if (!qt) {
  30055. throw new JpegError("missing required Quantization Table.");
  30056. }
  30057. for (let row = 0; row < 64; row += 8) {
  30058. p0 = blockData[blockBufferOffset + row];
  30059. p1 = blockData[blockBufferOffset + row + 1];
  30060. p2 = blockData[blockBufferOffset + row + 2];
  30061. p3 = blockData[blockBufferOffset + row + 3];
  30062. p4 = blockData[blockBufferOffset + row + 4];
  30063. p5 = blockData[blockBufferOffset + row + 5];
  30064. p6 = blockData[blockBufferOffset + row + 6];
  30065. p7 = blockData[blockBufferOffset + row + 7];
  30066. p0 *= qt[row];
  30067. if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
  30068. t = dctSqrt2 * p0 + 512 >> 10;
  30069. p[row] = t;
  30070. p[row + 1] = t;
  30071. p[row + 2] = t;
  30072. p[row + 3] = t;
  30073. p[row + 4] = t;
  30074. p[row + 5] = t;
  30075. p[row + 6] = t;
  30076. p[row + 7] = t;
  30077. continue;
  30078. }
  30079. p1 *= qt[row + 1];
  30080. p2 *= qt[row + 2];
  30081. p3 *= qt[row + 3];
  30082. p4 *= qt[row + 4];
  30083. p5 *= qt[row + 5];
  30084. p6 *= qt[row + 6];
  30085. p7 *= qt[row + 7];
  30086. v0 = dctSqrt2 * p0 + 128 >> 8;
  30087. v1 = dctSqrt2 * p4 + 128 >> 8;
  30088. v2 = p2;
  30089. v3 = p6;
  30090. v4 = dctSqrt1d2 * (p1 - p7) + 128 >> 8;
  30091. v7 = dctSqrt1d2 * (p1 + p7) + 128 >> 8;
  30092. v5 = p3 << 4;
  30093. v6 = p5 << 4;
  30094. v0 = v0 + v1 + 1 >> 1;
  30095. v1 = v0 - v1;
  30096. t = v2 * dctSin6 + v3 * dctCos6 + 128 >> 8;
  30097. v2 = v2 * dctCos6 - v3 * dctSin6 + 128 >> 8;
  30098. v3 = t;
  30099. v4 = v4 + v6 + 1 >> 1;
  30100. v6 = v4 - v6;
  30101. v7 = v7 + v5 + 1 >> 1;
  30102. v5 = v7 - v5;
  30103. v0 = v0 + v3 + 1 >> 1;
  30104. v3 = v0 - v3;
  30105. v1 = v1 + v2 + 1 >> 1;
  30106. v2 = v1 - v2;
  30107. t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
  30108. v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
  30109. v7 = t;
  30110. t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
  30111. v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
  30112. v6 = t;
  30113. p[row] = v0 + v7;
  30114. p[row + 7] = v0 - v7;
  30115. p[row + 1] = v1 + v6;
  30116. p[row + 6] = v1 - v6;
  30117. p[row + 2] = v2 + v5;
  30118. p[row + 5] = v2 - v5;
  30119. p[row + 3] = v3 + v4;
  30120. p[row + 4] = v3 - v4;
  30121. }
  30122. for (let col = 0; col < 8; ++col) {
  30123. p0 = p[col];
  30124. p1 = p[col + 8];
  30125. p2 = p[col + 16];
  30126. p3 = p[col + 24];
  30127. p4 = p[col + 32];
  30128. p5 = p[col + 40];
  30129. p6 = p[col + 48];
  30130. p7 = p[col + 56];
  30131. if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
  30132. t = dctSqrt2 * p0 + 8192 >> 14;
  30133. if (t < -2040) {
  30134. t = 0;
  30135. } else if (t >= 2024) {
  30136. t = 255;
  30137. } else {
  30138. t = t + 2056 >> 4;
  30139. }
  30140. blockData[blockBufferOffset + col] = t;
  30141. blockData[blockBufferOffset + col + 8] = t;
  30142. blockData[blockBufferOffset + col + 16] = t;
  30143. blockData[blockBufferOffset + col + 24] = t;
  30144. blockData[blockBufferOffset + col + 32] = t;
  30145. blockData[blockBufferOffset + col + 40] = t;
  30146. blockData[blockBufferOffset + col + 48] = t;
  30147. blockData[blockBufferOffset + col + 56] = t;
  30148. continue;
  30149. }
  30150. v0 = dctSqrt2 * p0 + 2048 >> 12;
  30151. v1 = dctSqrt2 * p4 + 2048 >> 12;
  30152. v2 = p2;
  30153. v3 = p6;
  30154. v4 = dctSqrt1d2 * (p1 - p7) + 2048 >> 12;
  30155. v7 = dctSqrt1d2 * (p1 + p7) + 2048 >> 12;
  30156. v5 = p3;
  30157. v6 = p5;
  30158. v0 = (v0 + v1 + 1 >> 1) + 4112;
  30159. v1 = v0 - v1;
  30160. t = v2 * dctSin6 + v3 * dctCos6 + 2048 >> 12;
  30161. v2 = v2 * dctCos6 - v3 * dctSin6 + 2048 >> 12;
  30162. v3 = t;
  30163. v4 = v4 + v6 + 1 >> 1;
  30164. v6 = v4 - v6;
  30165. v7 = v7 + v5 + 1 >> 1;
  30166. v5 = v7 - v5;
  30167. v0 = v0 + v3 + 1 >> 1;
  30168. v3 = v0 - v3;
  30169. v1 = v1 + v2 + 1 >> 1;
  30170. v2 = v1 - v2;
  30171. t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
  30172. v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
  30173. v7 = t;
  30174. t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
  30175. v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
  30176. v6 = t;
  30177. p0 = v0 + v7;
  30178. p7 = v0 - v7;
  30179. p1 = v1 + v6;
  30180. p6 = v1 - v6;
  30181. p2 = v2 + v5;
  30182. p5 = v2 - v5;
  30183. p3 = v3 + v4;
  30184. p4 = v3 - v4;
  30185. if (p0 < 16) {
  30186. p0 = 0;
  30187. } else if (p0 >= 4080) {
  30188. p0 = 255;
  30189. } else {
  30190. p0 >>= 4;
  30191. }
  30192. if (p1 < 16) {
  30193. p1 = 0;
  30194. } else if (p1 >= 4080) {
  30195. p1 = 255;
  30196. } else {
  30197. p1 >>= 4;
  30198. }
  30199. if (p2 < 16) {
  30200. p2 = 0;
  30201. } else if (p2 >= 4080) {
  30202. p2 = 255;
  30203. } else {
  30204. p2 >>= 4;
  30205. }
  30206. if (p3 < 16) {
  30207. p3 = 0;
  30208. } else if (p3 >= 4080) {
  30209. p3 = 255;
  30210. } else {
  30211. p3 >>= 4;
  30212. }
  30213. if (p4 < 16) {
  30214. p4 = 0;
  30215. } else if (p4 >= 4080) {
  30216. p4 = 255;
  30217. } else {
  30218. p4 >>= 4;
  30219. }
  30220. if (p5 < 16) {
  30221. p5 = 0;
  30222. } else if (p5 >= 4080) {
  30223. p5 = 255;
  30224. } else {
  30225. p5 >>= 4;
  30226. }
  30227. if (p6 < 16) {
  30228. p6 = 0;
  30229. } else if (p6 >= 4080) {
  30230. p6 = 255;
  30231. } else {
  30232. p6 >>= 4;
  30233. }
  30234. if (p7 < 16) {
  30235. p7 = 0;
  30236. } else if (p7 >= 4080) {
  30237. p7 = 255;
  30238. } else {
  30239. p7 >>= 4;
  30240. }
  30241. blockData[blockBufferOffset + col] = p0;
  30242. blockData[blockBufferOffset + col + 8] = p1;
  30243. blockData[blockBufferOffset + col + 16] = p2;
  30244. blockData[blockBufferOffset + col + 24] = p3;
  30245. blockData[blockBufferOffset + col + 32] = p4;
  30246. blockData[blockBufferOffset + col + 40] = p5;
  30247. blockData[blockBufferOffset + col + 48] = p6;
  30248. blockData[blockBufferOffset + col + 56] = p7;
  30249. }
  30250. }
  30251. function buildComponentData(frame, component) {
  30252. const blocksPerLine = component.blocksPerLine;
  30253. const blocksPerColumn = component.blocksPerColumn;
  30254. const computationBuffer = new Int16Array(64);
  30255. for (let blockRow = 0; blockRow < blocksPerColumn; blockRow++) {
  30256. for (let blockCol = 0; blockCol < blocksPerLine; blockCol++) {
  30257. const offset = getBlockBufferOffset(component, blockRow, blockCol);
  30258. quantizeAndInverse(component, offset, computationBuffer);
  30259. }
  30260. }
  30261. return component.blockData;
  30262. }
  30263. function findNextFileMarker(data, currentPos, startPos = currentPos) {
  30264. const maxPos = data.length - 1;
  30265. let newPos = startPos < currentPos ? startPos : currentPos;
  30266. if (currentPos >= maxPos) {
  30267. return null;
  30268. }
  30269. const currentMarker = (0, _core_utils.readUint16)(data, currentPos);
  30270. if (currentMarker >= 0xffc0 && currentMarker <= 0xfffe) {
  30271. return {
  30272. invalid: null,
  30273. marker: currentMarker,
  30274. offset: currentPos
  30275. };
  30276. }
  30277. let newMarker = (0, _core_utils.readUint16)(data, newPos);
  30278. while (!(newMarker >= 0xffc0 && newMarker <= 0xfffe)) {
  30279. if (++newPos >= maxPos) {
  30280. return null;
  30281. }
  30282. newMarker = (0, _core_utils.readUint16)(data, newPos);
  30283. }
  30284. return {
  30285. invalid: currentMarker.toString(16),
  30286. marker: newMarker,
  30287. offset: newPos
  30288. };
  30289. }
  30290. class JpegImage {
  30291. constructor({
  30292. decodeTransform = null,
  30293. colorTransform = -1
  30294. } = {}) {
  30295. this._decodeTransform = decodeTransform;
  30296. this._colorTransform = colorTransform;
  30297. }
  30298. parse(data, {
  30299. dnlScanLines = null
  30300. } = {}) {
  30301. function readDataBlock() {
  30302. const length = (0, _core_utils.readUint16)(data, offset);
  30303. offset += 2;
  30304. let endOffset = offset + length - 2;
  30305. const fileMarker = findNextFileMarker(data, endOffset, offset);
  30306. if (fileMarker && fileMarker.invalid) {
  30307. (0, _util.warn)("readDataBlock - incorrect length, current marker is: " + fileMarker.invalid);
  30308. endOffset = fileMarker.offset;
  30309. }
  30310. const array = data.subarray(offset, endOffset);
  30311. offset += array.length;
  30312. return array;
  30313. }
  30314. function prepareComponents(frame) {
  30315. const mcusPerLine = Math.ceil(frame.samplesPerLine / 8 / frame.maxH);
  30316. const mcusPerColumn = Math.ceil(frame.scanLines / 8 / frame.maxV);
  30317. for (let i = 0, ii = frame.components.length; i < ii; i++) {
  30318. const component = frame.components[i];
  30319. const blocksPerLine = Math.ceil(Math.ceil(frame.samplesPerLine / 8) * component.h / frame.maxH);
  30320. const blocksPerColumn = Math.ceil(Math.ceil(frame.scanLines / 8) * component.v / frame.maxV);
  30321. const blocksPerLineForMcu = mcusPerLine * component.h;
  30322. const blocksPerColumnForMcu = mcusPerColumn * component.v;
  30323. const blocksBufferSize = 64 * blocksPerColumnForMcu * (blocksPerLineForMcu + 1);
  30324. component.blockData = new Int16Array(blocksBufferSize);
  30325. component.blocksPerLine = blocksPerLine;
  30326. component.blocksPerColumn = blocksPerColumn;
  30327. }
  30328. frame.mcusPerLine = mcusPerLine;
  30329. frame.mcusPerColumn = mcusPerColumn;
  30330. }
  30331. let offset = 0;
  30332. let jfif = null;
  30333. let adobe = null;
  30334. let frame, resetInterval;
  30335. let numSOSMarkers = 0;
  30336. const quantizationTables = [];
  30337. const huffmanTablesAC = [],
  30338. huffmanTablesDC = [];
  30339. let fileMarker = (0, _core_utils.readUint16)(data, offset);
  30340. offset += 2;
  30341. if (fileMarker !== 0xffd8) {
  30342. throw new JpegError("SOI not found");
  30343. }
  30344. fileMarker = (0, _core_utils.readUint16)(data, offset);
  30345. offset += 2;
  30346. markerLoop: while (fileMarker !== 0xffd9) {
  30347. let i, j, l;
  30348. switch (fileMarker) {
  30349. case 0xffe0:
  30350. case 0xffe1:
  30351. case 0xffe2:
  30352. case 0xffe3:
  30353. case 0xffe4:
  30354. case 0xffe5:
  30355. case 0xffe6:
  30356. case 0xffe7:
  30357. case 0xffe8:
  30358. case 0xffe9:
  30359. case 0xffea:
  30360. case 0xffeb:
  30361. case 0xffec:
  30362. case 0xffed:
  30363. case 0xffee:
  30364. case 0xffef:
  30365. case 0xfffe:
  30366. const appData = readDataBlock();
  30367. if (fileMarker === 0xffe0) {
  30368. if (appData[0] === 0x4a && appData[1] === 0x46 && appData[2] === 0x49 && appData[3] === 0x46 && appData[4] === 0) {
  30369. jfif = {
  30370. version: {
  30371. major: appData[5],
  30372. minor: appData[6]
  30373. },
  30374. densityUnits: appData[7],
  30375. xDensity: appData[8] << 8 | appData[9],
  30376. yDensity: appData[10] << 8 | appData[11],
  30377. thumbWidth: appData[12],
  30378. thumbHeight: appData[13],
  30379. thumbData: appData.subarray(14, 14 + 3 * appData[12] * appData[13])
  30380. };
  30381. }
  30382. }
  30383. if (fileMarker === 0xffee) {
  30384. if (appData[0] === 0x41 && appData[1] === 0x64 && appData[2] === 0x6f && appData[3] === 0x62 && appData[4] === 0x65) {
  30385. adobe = {
  30386. version: appData[5] << 8 | appData[6],
  30387. flags0: appData[7] << 8 | appData[8],
  30388. flags1: appData[9] << 8 | appData[10],
  30389. transformCode: appData[11]
  30390. };
  30391. }
  30392. }
  30393. break;
  30394. case 0xffdb:
  30395. const quantizationTablesLength = (0, _core_utils.readUint16)(data, offset);
  30396. offset += 2;
  30397. const quantizationTablesEnd = quantizationTablesLength + offset - 2;
  30398. let z;
  30399. while (offset < quantizationTablesEnd) {
  30400. const quantizationTableSpec = data[offset++];
  30401. const tableData = new Uint16Array(64);
  30402. if (quantizationTableSpec >> 4 === 0) {
  30403. for (j = 0; j < 64; j++) {
  30404. z = dctZigZag[j];
  30405. tableData[z] = data[offset++];
  30406. }
  30407. } else if (quantizationTableSpec >> 4 === 1) {
  30408. for (j = 0; j < 64; j++) {
  30409. z = dctZigZag[j];
  30410. tableData[z] = (0, _core_utils.readUint16)(data, offset);
  30411. offset += 2;
  30412. }
  30413. } else {
  30414. throw new JpegError("DQT - invalid table spec");
  30415. }
  30416. quantizationTables[quantizationTableSpec & 15] = tableData;
  30417. }
  30418. break;
  30419. case 0xffc0:
  30420. case 0xffc1:
  30421. case 0xffc2:
  30422. if (frame) {
  30423. throw new JpegError("Only single frame JPEGs supported");
  30424. }
  30425. offset += 2;
  30426. frame = {};
  30427. frame.extended = fileMarker === 0xffc1;
  30428. frame.progressive = fileMarker === 0xffc2;
  30429. frame.precision = data[offset++];
  30430. const sofScanLines = (0, _core_utils.readUint16)(data, offset);
  30431. offset += 2;
  30432. frame.scanLines = dnlScanLines || sofScanLines;
  30433. frame.samplesPerLine = (0, _core_utils.readUint16)(data, offset);
  30434. offset += 2;
  30435. frame.components = [];
  30436. frame.componentIds = {};
  30437. const componentsCount = data[offset++];
  30438. let maxH = 0,
  30439. maxV = 0;
  30440. for (i = 0; i < componentsCount; i++) {
  30441. const componentId = data[offset];
  30442. const h = data[offset + 1] >> 4;
  30443. const v = data[offset + 1] & 15;
  30444. if (maxH < h) {
  30445. maxH = h;
  30446. }
  30447. if (maxV < v) {
  30448. maxV = v;
  30449. }
  30450. const qId = data[offset + 2];
  30451. l = frame.components.push({
  30452. h,
  30453. v,
  30454. quantizationId: qId,
  30455. quantizationTable: null
  30456. });
  30457. frame.componentIds[componentId] = l - 1;
  30458. offset += 3;
  30459. }
  30460. frame.maxH = maxH;
  30461. frame.maxV = maxV;
  30462. prepareComponents(frame);
  30463. break;
  30464. case 0xffc4:
  30465. const huffmanLength = (0, _core_utils.readUint16)(data, offset);
  30466. offset += 2;
  30467. for (i = 2; i < huffmanLength;) {
  30468. const huffmanTableSpec = data[offset++];
  30469. const codeLengths = new Uint8Array(16);
  30470. let codeLengthSum = 0;
  30471. for (j = 0; j < 16; j++, offset++) {
  30472. codeLengthSum += codeLengths[j] = data[offset];
  30473. }
  30474. const huffmanValues = new Uint8Array(codeLengthSum);
  30475. for (j = 0; j < codeLengthSum; j++, offset++) {
  30476. huffmanValues[j] = data[offset];
  30477. }
  30478. i += 17 + codeLengthSum;
  30479. (huffmanTableSpec >> 4 === 0 ? huffmanTablesDC : huffmanTablesAC)[huffmanTableSpec & 15] = buildHuffmanTable(codeLengths, huffmanValues);
  30480. }
  30481. break;
  30482. case 0xffdd:
  30483. offset += 2;
  30484. resetInterval = (0, _core_utils.readUint16)(data, offset);
  30485. offset += 2;
  30486. break;
  30487. case 0xffda:
  30488. const parseDNLMarker = ++numSOSMarkers === 1 && !dnlScanLines;
  30489. offset += 2;
  30490. const selectorsCount = data[offset++],
  30491. components = [];
  30492. for (i = 0; i < selectorsCount; i++) {
  30493. const index = data[offset++];
  30494. const componentIndex = frame.componentIds[index];
  30495. const component = frame.components[componentIndex];
  30496. component.index = index;
  30497. const tableSpec = data[offset++];
  30498. component.huffmanTableDC = huffmanTablesDC[tableSpec >> 4];
  30499. component.huffmanTableAC = huffmanTablesAC[tableSpec & 15];
  30500. components.push(component);
  30501. }
  30502. const spectralStart = data[offset++],
  30503. spectralEnd = data[offset++],
  30504. successiveApproximation = data[offset++];
  30505. try {
  30506. const processed = decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successiveApproximation >> 4, successiveApproximation & 15, parseDNLMarker);
  30507. offset += processed;
  30508. } catch (ex) {
  30509. if (ex instanceof DNLMarkerError) {
  30510. (0, _util.warn)(`${ex.message} -- attempting to re-parse the JPEG image.`);
  30511. return this.parse(data, {
  30512. dnlScanLines: ex.scanLines
  30513. });
  30514. } else if (ex instanceof EOIMarkerError) {
  30515. (0, _util.warn)(`${ex.message} -- ignoring the rest of the image data.`);
  30516. break markerLoop;
  30517. }
  30518. throw ex;
  30519. }
  30520. break;
  30521. case 0xffdc:
  30522. offset += 4;
  30523. break;
  30524. case 0xffff:
  30525. if (data[offset] !== 0xff) {
  30526. offset--;
  30527. }
  30528. break;
  30529. default:
  30530. const nextFileMarker = findNextFileMarker(data, offset - 2, offset - 3);
  30531. if (nextFileMarker && nextFileMarker.invalid) {
  30532. (0, _util.warn)("JpegImage.parse - unexpected data, current marker is: " + nextFileMarker.invalid);
  30533. offset = nextFileMarker.offset;
  30534. break;
  30535. }
  30536. if (!nextFileMarker || offset >= data.length - 1) {
  30537. (0, _util.warn)("JpegImage.parse - reached the end of the image data " + "without finding an EOI marker (0xFFD9).");
  30538. break markerLoop;
  30539. }
  30540. throw new JpegError("JpegImage.parse - unknown marker: " + fileMarker.toString(16));
  30541. }
  30542. fileMarker = (0, _core_utils.readUint16)(data, offset);
  30543. offset += 2;
  30544. }
  30545. this.width = frame.samplesPerLine;
  30546. this.height = frame.scanLines;
  30547. this.jfif = jfif;
  30548. this.adobe = adobe;
  30549. this.components = [];
  30550. for (let i = 0, ii = frame.components.length; i < ii; i++) {
  30551. const component = frame.components[i];
  30552. const quantizationTable = quantizationTables[component.quantizationId];
  30553. if (quantizationTable) {
  30554. component.quantizationTable = quantizationTable;
  30555. }
  30556. this.components.push({
  30557. index: component.index,
  30558. output: buildComponentData(frame, component),
  30559. scaleX: component.h / frame.maxH,
  30560. scaleY: component.v / frame.maxV,
  30561. blocksPerLine: component.blocksPerLine,
  30562. blocksPerColumn: component.blocksPerColumn
  30563. });
  30564. }
  30565. this.numComponents = this.components.length;
  30566. return undefined;
  30567. }
  30568. _getLinearizedBlockData(width, height, isSourcePDF = false) {
  30569. const scaleX = this.width / width,
  30570. scaleY = this.height / height;
  30571. let component, componentScaleX, componentScaleY, blocksPerScanline;
  30572. let x, y, i, j, k;
  30573. let index;
  30574. let offset = 0;
  30575. let output;
  30576. const numComponents = this.components.length;
  30577. const dataLength = width * height * numComponents;
  30578. const data = new Uint8ClampedArray(dataLength);
  30579. const xScaleBlockOffset = new Uint32Array(width);
  30580. const mask3LSB = 0xfffffff8;
  30581. let lastComponentScaleX;
  30582. for (i = 0; i < numComponents; i++) {
  30583. component = this.components[i];
  30584. componentScaleX = component.scaleX * scaleX;
  30585. componentScaleY = component.scaleY * scaleY;
  30586. offset = i;
  30587. output = component.output;
  30588. blocksPerScanline = component.blocksPerLine + 1 << 3;
  30589. if (componentScaleX !== lastComponentScaleX) {
  30590. for (x = 0; x < width; x++) {
  30591. j = 0 | x * componentScaleX;
  30592. xScaleBlockOffset[x] = (j & mask3LSB) << 3 | j & 7;
  30593. }
  30594. lastComponentScaleX = componentScaleX;
  30595. }
  30596. for (y = 0; y < height; y++) {
  30597. j = 0 | y * componentScaleY;
  30598. index = blocksPerScanline * (j & mask3LSB) | (j & 7) << 3;
  30599. for (x = 0; x < width; x++) {
  30600. data[offset] = output[index + xScaleBlockOffset[x]];
  30601. offset += numComponents;
  30602. }
  30603. }
  30604. }
  30605. let transform = this._decodeTransform;
  30606. if (!isSourcePDF && numComponents === 4 && !transform) {
  30607. transform = new Int32Array([-256, 255, -256, 255, -256, 255, -256, 255]);
  30608. }
  30609. if (transform) {
  30610. for (i = 0; i < dataLength;) {
  30611. for (j = 0, k = 0; j < numComponents; j++, i++, k += 2) {
  30612. data[i] = (data[i] * transform[k] >> 8) + transform[k + 1];
  30613. }
  30614. }
  30615. }
  30616. return data;
  30617. }
  30618. get _isColorConversionNeeded() {
  30619. if (this.adobe) {
  30620. return !!this.adobe.transformCode;
  30621. }
  30622. if (this.numComponents === 3) {
  30623. if (this._colorTransform === 0) {
  30624. return false;
  30625. } else if (this.components[0].index === 0x52 && this.components[1].index === 0x47 && this.components[2].index === 0x42) {
  30626. return false;
  30627. }
  30628. return true;
  30629. }
  30630. if (this._colorTransform === 1) {
  30631. return true;
  30632. }
  30633. return false;
  30634. }
  30635. _convertYccToRgb(data) {
  30636. let Y, Cb, Cr;
  30637. for (let i = 0, length = data.length; i < length; i += 3) {
  30638. Y = data[i];
  30639. Cb = data[i + 1];
  30640. Cr = data[i + 2];
  30641. data[i] = Y - 179.456 + 1.402 * Cr;
  30642. data[i + 1] = Y + 135.459 - 0.344 * Cb - 0.714 * Cr;
  30643. data[i + 2] = Y - 226.816 + 1.772 * Cb;
  30644. }
  30645. return data;
  30646. }
  30647. _convertYcckToRgb(data) {
  30648. let Y, Cb, Cr, k;
  30649. let offset = 0;
  30650. for (let i = 0, length = data.length; i < length; i += 4) {
  30651. Y = data[i];
  30652. Cb = data[i + 1];
  30653. Cr = data[i + 2];
  30654. k = data[i + 3];
  30655. 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);
  30656. 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);
  30657. 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);
  30658. }
  30659. return data.subarray(0, offset);
  30660. }
  30661. _convertYcckToCmyk(data) {
  30662. let Y, Cb, Cr;
  30663. for (let i = 0, length = data.length; i < length; i += 4) {
  30664. Y = data[i];
  30665. Cb = data[i + 1];
  30666. Cr = data[i + 2];
  30667. data[i] = 434.456 - Y - 1.402 * Cr;
  30668. data[i + 1] = 119.541 - Y + 0.344 * Cb + 0.714 * Cr;
  30669. data[i + 2] = 481.816 - Y - 1.772 * Cb;
  30670. }
  30671. return data;
  30672. }
  30673. _convertCmykToRgb(data) {
  30674. let c, m, y, k;
  30675. let offset = 0;
  30676. for (let i = 0, length = data.length; i < length; i += 4) {
  30677. c = data[i];
  30678. m = data[i + 1];
  30679. y = data[i + 2];
  30680. k = data[i + 3];
  30681. 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);
  30682. 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);
  30683. 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);
  30684. }
  30685. return data.subarray(0, offset);
  30686. }
  30687. getData({
  30688. width,
  30689. height,
  30690. forceRGB = false,
  30691. isSourcePDF = false
  30692. }) {
  30693. if (this.numComponents > 4) {
  30694. throw new JpegError("Unsupported color mode");
  30695. }
  30696. const data = this._getLinearizedBlockData(width, height, isSourcePDF);
  30697. if (this.numComponents === 1 && forceRGB) {
  30698. const dataLength = data.length;
  30699. const rgbData = new Uint8ClampedArray(dataLength * 3);
  30700. let offset = 0;
  30701. for (let i = 0; i < dataLength; i++) {
  30702. const grayColor = data[i];
  30703. rgbData[offset++] = grayColor;
  30704. rgbData[offset++] = grayColor;
  30705. rgbData[offset++] = grayColor;
  30706. }
  30707. return rgbData;
  30708. } else if (this.numComponents === 3 && this._isColorConversionNeeded) {
  30709. return this._convertYccToRgb(data);
  30710. } else if (this.numComponents === 4) {
  30711. if (this._isColorConversionNeeded) {
  30712. if (forceRGB) {
  30713. return this._convertYcckToRgb(data);
  30714. }
  30715. return this._convertYcckToCmyk(data);
  30716. } else if (forceRGB) {
  30717. return this._convertCmykToRgb(data);
  30718. }
  30719. }
  30720. return data;
  30721. }
  30722. }
  30723. exports.JpegImage = JpegImage;
  30724. /***/ }),
  30725. /* 39 */
  30726. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  30727. Object.defineProperty(exports, "__esModule", ({
  30728. value: true
  30729. }));
  30730. exports.JpxStream = void 0;
  30731. var _decode_stream = __w_pdfjs_require__(29);
  30732. var _jpx = __w_pdfjs_require__(40);
  30733. var _util = __w_pdfjs_require__(2);
  30734. class JpxStream extends _decode_stream.DecodeStream {
  30735. constructor(stream, maybeLength, params) {
  30736. super(maybeLength);
  30737. this.stream = stream;
  30738. this.dict = stream.dict;
  30739. this.maybeLength = maybeLength;
  30740. this.params = params;
  30741. }
  30742. get bytes() {
  30743. return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength));
  30744. }
  30745. ensureBuffer(requested) {}
  30746. readBlock() {
  30747. if (this.eof) {
  30748. return;
  30749. }
  30750. const jpxImage = new _jpx.JpxImage();
  30751. jpxImage.parse(this.bytes);
  30752. const width = jpxImage.width;
  30753. const height = jpxImage.height;
  30754. const componentsCount = jpxImage.componentsCount;
  30755. const tileCount = jpxImage.tiles.length;
  30756. if (tileCount === 1) {
  30757. this.buffer = jpxImage.tiles[0].items;
  30758. } else {
  30759. const data = new Uint8ClampedArray(width * height * componentsCount);
  30760. for (let k = 0; k < tileCount; k++) {
  30761. const tileComponents = jpxImage.tiles[k];
  30762. const tileWidth = tileComponents.width;
  30763. const tileHeight = tileComponents.height;
  30764. const tileLeft = tileComponents.left;
  30765. const tileTop = tileComponents.top;
  30766. const src = tileComponents.items;
  30767. let srcPosition = 0;
  30768. let dataPosition = (width * tileTop + tileLeft) * componentsCount;
  30769. const imgRowSize = width * componentsCount;
  30770. const tileRowSize = tileWidth * componentsCount;
  30771. for (let j = 0; j < tileHeight; j++) {
  30772. const rowBytes = src.subarray(srcPosition, srcPosition + tileRowSize);
  30773. data.set(rowBytes, dataPosition);
  30774. srcPosition += tileRowSize;
  30775. dataPosition += imgRowSize;
  30776. }
  30777. }
  30778. this.buffer = data;
  30779. }
  30780. this.bufferLength = this.buffer.length;
  30781. this.eof = true;
  30782. }
  30783. }
  30784. exports.JpxStream = JpxStream;
  30785. /***/ }),
  30786. /* 40 */
  30787. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  30788. Object.defineProperty(exports, "__esModule", ({
  30789. value: true
  30790. }));
  30791. exports.JpxImage = void 0;
  30792. var _util = __w_pdfjs_require__(2);
  30793. var _core_utils = __w_pdfjs_require__(6);
  30794. var _arithmetic_decoder = __w_pdfjs_require__(36);
  30795. class JpxError extends _util.BaseException {
  30796. constructor(msg) {
  30797. super(`JPX error: ${msg}`, "JpxError");
  30798. }
  30799. }
  30800. const SubbandsGainLog2 = {
  30801. LL: 0,
  30802. LH: 1,
  30803. HL: 1,
  30804. HH: 2
  30805. };
  30806. class JpxImage {
  30807. constructor() {
  30808. this.failOnCorruptedImage = false;
  30809. }
  30810. parse(data) {
  30811. const head = (0, _core_utils.readUint16)(data, 0);
  30812. if (head === 0xff4f) {
  30813. this.parseCodestream(data, 0, data.length);
  30814. return;
  30815. }
  30816. const length = data.length;
  30817. let position = 0;
  30818. while (position < length) {
  30819. let headerSize = 8;
  30820. let lbox = (0, _core_utils.readUint32)(data, position);
  30821. const tbox = (0, _core_utils.readUint32)(data, position + 4);
  30822. position += headerSize;
  30823. if (lbox === 1) {
  30824. lbox = (0, _core_utils.readUint32)(data, position) * 4294967296 + (0, _core_utils.readUint32)(data, position + 4);
  30825. position += 8;
  30826. headerSize += 8;
  30827. }
  30828. if (lbox === 0) {
  30829. lbox = length - position + headerSize;
  30830. }
  30831. if (lbox < headerSize) {
  30832. throw new JpxError("Invalid box field size");
  30833. }
  30834. const dataLength = lbox - headerSize;
  30835. let jumpDataLength = true;
  30836. switch (tbox) {
  30837. case 0x6a703268:
  30838. jumpDataLength = false;
  30839. break;
  30840. case 0x636f6c72:
  30841. const method = data[position];
  30842. if (method === 1) {
  30843. const colorspace = (0, _core_utils.readUint32)(data, position + 3);
  30844. switch (colorspace) {
  30845. case 16:
  30846. case 17:
  30847. case 18:
  30848. break;
  30849. default:
  30850. (0, _util.warn)("Unknown colorspace " + colorspace);
  30851. break;
  30852. }
  30853. } else if (method === 2) {
  30854. (0, _util.info)("ICC profile not supported");
  30855. }
  30856. break;
  30857. case 0x6a703263:
  30858. this.parseCodestream(data, position, position + dataLength);
  30859. break;
  30860. case 0x6a502020:
  30861. if ((0, _core_utils.readUint32)(data, position) !== 0x0d0a870a) {
  30862. (0, _util.warn)("Invalid JP2 signature");
  30863. }
  30864. break;
  30865. case 0x6a501a1a:
  30866. case 0x66747970:
  30867. case 0x72726571:
  30868. case 0x72657320:
  30869. case 0x69686472:
  30870. break;
  30871. default:
  30872. const headerType = String.fromCharCode(tbox >> 24 & 0xff, tbox >> 16 & 0xff, tbox >> 8 & 0xff, tbox & 0xff);
  30873. (0, _util.warn)(`Unsupported header type ${tbox} (${headerType}).`);
  30874. break;
  30875. }
  30876. if (jumpDataLength) {
  30877. position += dataLength;
  30878. }
  30879. }
  30880. }
  30881. parseImageProperties(stream) {
  30882. let newByte = stream.getByte();
  30883. while (newByte >= 0) {
  30884. const oldByte = newByte;
  30885. newByte = stream.getByte();
  30886. const code = oldByte << 8 | newByte;
  30887. if (code === 0xff51) {
  30888. stream.skip(4);
  30889. const Xsiz = stream.getInt32() >>> 0;
  30890. const Ysiz = stream.getInt32() >>> 0;
  30891. const XOsiz = stream.getInt32() >>> 0;
  30892. const YOsiz = stream.getInt32() >>> 0;
  30893. stream.skip(16);
  30894. const Csiz = stream.getUint16();
  30895. this.width = Xsiz - XOsiz;
  30896. this.height = Ysiz - YOsiz;
  30897. this.componentsCount = Csiz;
  30898. this.bitsPerComponent = 8;
  30899. return;
  30900. }
  30901. }
  30902. throw new JpxError("No size marker found in JPX stream");
  30903. }
  30904. parseCodestream(data, start, end) {
  30905. const context = {};
  30906. let doNotRecover = false;
  30907. try {
  30908. let position = start;
  30909. while (position + 1 < end) {
  30910. const code = (0, _core_utils.readUint16)(data, position);
  30911. position += 2;
  30912. let length = 0,
  30913. j,
  30914. sqcd,
  30915. spqcds,
  30916. spqcdSize,
  30917. scalarExpounded,
  30918. tile;
  30919. switch (code) {
  30920. case 0xff4f:
  30921. context.mainHeader = true;
  30922. break;
  30923. case 0xffd9:
  30924. break;
  30925. case 0xff51:
  30926. length = (0, _core_utils.readUint16)(data, position);
  30927. const siz = {};
  30928. siz.Xsiz = (0, _core_utils.readUint32)(data, position + 4);
  30929. siz.Ysiz = (0, _core_utils.readUint32)(data, position + 8);
  30930. siz.XOsiz = (0, _core_utils.readUint32)(data, position + 12);
  30931. siz.YOsiz = (0, _core_utils.readUint32)(data, position + 16);
  30932. siz.XTsiz = (0, _core_utils.readUint32)(data, position + 20);
  30933. siz.YTsiz = (0, _core_utils.readUint32)(data, position + 24);
  30934. siz.XTOsiz = (0, _core_utils.readUint32)(data, position + 28);
  30935. siz.YTOsiz = (0, _core_utils.readUint32)(data, position + 32);
  30936. const componentsCount = (0, _core_utils.readUint16)(data, position + 36);
  30937. siz.Csiz = componentsCount;
  30938. const components = [];
  30939. j = position + 38;
  30940. for (let i = 0; i < componentsCount; i++) {
  30941. const component = {
  30942. precision: (data[j] & 0x7f) + 1,
  30943. isSigned: !!(data[j] & 0x80),
  30944. XRsiz: data[j + 1],
  30945. YRsiz: data[j + 2]
  30946. };
  30947. j += 3;
  30948. calculateComponentDimensions(component, siz);
  30949. components.push(component);
  30950. }
  30951. context.SIZ = siz;
  30952. context.components = components;
  30953. calculateTileGrids(context, components);
  30954. context.QCC = [];
  30955. context.COC = [];
  30956. break;
  30957. case 0xff5c:
  30958. length = (0, _core_utils.readUint16)(data, position);
  30959. const qcd = {};
  30960. j = position + 2;
  30961. sqcd = data[j++];
  30962. switch (sqcd & 0x1f) {
  30963. case 0:
  30964. spqcdSize = 8;
  30965. scalarExpounded = true;
  30966. break;
  30967. case 1:
  30968. spqcdSize = 16;
  30969. scalarExpounded = false;
  30970. break;
  30971. case 2:
  30972. spqcdSize = 16;
  30973. scalarExpounded = true;
  30974. break;
  30975. default:
  30976. throw new Error("Invalid SQcd value " + sqcd);
  30977. }
  30978. qcd.noQuantization = spqcdSize === 8;
  30979. qcd.scalarExpounded = scalarExpounded;
  30980. qcd.guardBits = sqcd >> 5;
  30981. spqcds = [];
  30982. while (j < length + position) {
  30983. const spqcd = {};
  30984. if (spqcdSize === 8) {
  30985. spqcd.epsilon = data[j++] >> 3;
  30986. spqcd.mu = 0;
  30987. } else {
  30988. spqcd.epsilon = data[j] >> 3;
  30989. spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1];
  30990. j += 2;
  30991. }
  30992. spqcds.push(spqcd);
  30993. }
  30994. qcd.SPqcds = spqcds;
  30995. if (context.mainHeader) {
  30996. context.QCD = qcd;
  30997. } else {
  30998. context.currentTile.QCD = qcd;
  30999. context.currentTile.QCC = [];
  31000. }
  31001. break;
  31002. case 0xff5d:
  31003. length = (0, _core_utils.readUint16)(data, position);
  31004. const qcc = {};
  31005. j = position + 2;
  31006. let cqcc;
  31007. if (context.SIZ.Csiz < 257) {
  31008. cqcc = data[j++];
  31009. } else {
  31010. cqcc = (0, _core_utils.readUint16)(data, j);
  31011. j += 2;
  31012. }
  31013. sqcd = data[j++];
  31014. switch (sqcd & 0x1f) {
  31015. case 0:
  31016. spqcdSize = 8;
  31017. scalarExpounded = true;
  31018. break;
  31019. case 1:
  31020. spqcdSize = 16;
  31021. scalarExpounded = false;
  31022. break;
  31023. case 2:
  31024. spqcdSize = 16;
  31025. scalarExpounded = true;
  31026. break;
  31027. default:
  31028. throw new Error("Invalid SQcd value " + sqcd);
  31029. }
  31030. qcc.noQuantization = spqcdSize === 8;
  31031. qcc.scalarExpounded = scalarExpounded;
  31032. qcc.guardBits = sqcd >> 5;
  31033. spqcds = [];
  31034. while (j < length + position) {
  31035. const spqcd = {};
  31036. if (spqcdSize === 8) {
  31037. spqcd.epsilon = data[j++] >> 3;
  31038. spqcd.mu = 0;
  31039. } else {
  31040. spqcd.epsilon = data[j] >> 3;
  31041. spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1];
  31042. j += 2;
  31043. }
  31044. spqcds.push(spqcd);
  31045. }
  31046. qcc.SPqcds = spqcds;
  31047. if (context.mainHeader) {
  31048. context.QCC[cqcc] = qcc;
  31049. } else {
  31050. context.currentTile.QCC[cqcc] = qcc;
  31051. }
  31052. break;
  31053. case 0xff52:
  31054. length = (0, _core_utils.readUint16)(data, position);
  31055. const cod = {};
  31056. j = position + 2;
  31057. const scod = data[j++];
  31058. cod.entropyCoderWithCustomPrecincts = !!(scod & 1);
  31059. cod.sopMarkerUsed = !!(scod & 2);
  31060. cod.ephMarkerUsed = !!(scod & 4);
  31061. cod.progressionOrder = data[j++];
  31062. cod.layersCount = (0, _core_utils.readUint16)(data, j);
  31063. j += 2;
  31064. cod.multipleComponentTransform = data[j++];
  31065. cod.decompositionLevelsCount = data[j++];
  31066. cod.xcb = (data[j++] & 0xf) + 2;
  31067. cod.ycb = (data[j++] & 0xf) + 2;
  31068. const blockStyle = data[j++];
  31069. cod.selectiveArithmeticCodingBypass = !!(blockStyle & 1);
  31070. cod.resetContextProbabilities = !!(blockStyle & 2);
  31071. cod.terminationOnEachCodingPass = !!(blockStyle & 4);
  31072. cod.verticallyStripe = !!(blockStyle & 8);
  31073. cod.predictableTermination = !!(blockStyle & 16);
  31074. cod.segmentationSymbolUsed = !!(blockStyle & 32);
  31075. cod.reversibleTransformation = data[j++];
  31076. if (cod.entropyCoderWithCustomPrecincts) {
  31077. const precinctsSizes = [];
  31078. while (j < length + position) {
  31079. const precinctsSize = data[j++];
  31080. precinctsSizes.push({
  31081. PPx: precinctsSize & 0xf,
  31082. PPy: precinctsSize >> 4
  31083. });
  31084. }
  31085. cod.precinctsSizes = precinctsSizes;
  31086. }
  31087. const unsupported = [];
  31088. if (cod.selectiveArithmeticCodingBypass) {
  31089. unsupported.push("selectiveArithmeticCodingBypass");
  31090. }
  31091. if (cod.terminationOnEachCodingPass) {
  31092. unsupported.push("terminationOnEachCodingPass");
  31093. }
  31094. if (cod.verticallyStripe) {
  31095. unsupported.push("verticallyStripe");
  31096. }
  31097. if (cod.predictableTermination) {
  31098. unsupported.push("predictableTermination");
  31099. }
  31100. if (unsupported.length > 0) {
  31101. doNotRecover = true;
  31102. (0, _util.warn)(`JPX: Unsupported COD options (${unsupported.join(", ")}).`);
  31103. }
  31104. if (context.mainHeader) {
  31105. context.COD = cod;
  31106. } else {
  31107. context.currentTile.COD = cod;
  31108. context.currentTile.COC = [];
  31109. }
  31110. break;
  31111. case 0xff90:
  31112. length = (0, _core_utils.readUint16)(data, position);
  31113. tile = {};
  31114. tile.index = (0, _core_utils.readUint16)(data, position + 2);
  31115. tile.length = (0, _core_utils.readUint32)(data, position + 4);
  31116. tile.dataEnd = tile.length + position - 2;
  31117. tile.partIndex = data[position + 8];
  31118. tile.partsCount = data[position + 9];
  31119. context.mainHeader = false;
  31120. if (tile.partIndex === 0) {
  31121. tile.COD = context.COD;
  31122. tile.COC = context.COC.slice(0);
  31123. tile.QCD = context.QCD;
  31124. tile.QCC = context.QCC.slice(0);
  31125. }
  31126. context.currentTile = tile;
  31127. break;
  31128. case 0xff93:
  31129. tile = context.currentTile;
  31130. if (tile.partIndex === 0) {
  31131. initializeTile(context, tile.index);
  31132. buildPackets(context);
  31133. }
  31134. length = tile.dataEnd - position;
  31135. parseTilePackets(context, data, position, length);
  31136. break;
  31137. case 0xff53:
  31138. (0, _util.warn)("JPX: Codestream code 0xFF53 (COC) is not implemented.");
  31139. case 0xff55:
  31140. case 0xff57:
  31141. case 0xff58:
  31142. case 0xff64:
  31143. length = (0, _core_utils.readUint16)(data, position);
  31144. break;
  31145. default:
  31146. throw new Error("Unknown codestream code: " + code.toString(16));
  31147. }
  31148. position += length;
  31149. }
  31150. } catch (e) {
  31151. if (doNotRecover || this.failOnCorruptedImage) {
  31152. throw new JpxError(e.message);
  31153. } else {
  31154. (0, _util.warn)(`JPX: Trying to recover from: "${e.message}".`);
  31155. }
  31156. }
  31157. this.tiles = transformComponents(context);
  31158. this.width = context.SIZ.Xsiz - context.SIZ.XOsiz;
  31159. this.height = context.SIZ.Ysiz - context.SIZ.YOsiz;
  31160. this.componentsCount = context.SIZ.Csiz;
  31161. }
  31162. }
  31163. exports.JpxImage = JpxImage;
  31164. function calculateComponentDimensions(component, siz) {
  31165. component.x0 = Math.ceil(siz.XOsiz / component.XRsiz);
  31166. component.x1 = Math.ceil(siz.Xsiz / component.XRsiz);
  31167. component.y0 = Math.ceil(siz.YOsiz / component.YRsiz);
  31168. component.y1 = Math.ceil(siz.Ysiz / component.YRsiz);
  31169. component.width = component.x1 - component.x0;
  31170. component.height = component.y1 - component.y0;
  31171. }
  31172. function calculateTileGrids(context, components) {
  31173. const siz = context.SIZ;
  31174. const tiles = [];
  31175. let tile;
  31176. const numXtiles = Math.ceil((siz.Xsiz - siz.XTOsiz) / siz.XTsiz);
  31177. const numYtiles = Math.ceil((siz.Ysiz - siz.YTOsiz) / siz.YTsiz);
  31178. for (let q = 0; q < numYtiles; q++) {
  31179. for (let p = 0; p < numXtiles; p++) {
  31180. tile = {};
  31181. tile.tx0 = Math.max(siz.XTOsiz + p * siz.XTsiz, siz.XOsiz);
  31182. tile.ty0 = Math.max(siz.YTOsiz + q * siz.YTsiz, siz.YOsiz);
  31183. tile.tx1 = Math.min(siz.XTOsiz + (p + 1) * siz.XTsiz, siz.Xsiz);
  31184. tile.ty1 = Math.min(siz.YTOsiz + (q + 1) * siz.YTsiz, siz.Ysiz);
  31185. tile.width = tile.tx1 - tile.tx0;
  31186. tile.height = tile.ty1 - tile.ty0;
  31187. tile.components = [];
  31188. tiles.push(tile);
  31189. }
  31190. }
  31191. context.tiles = tiles;
  31192. const componentsCount = siz.Csiz;
  31193. for (let i = 0, ii = componentsCount; i < ii; i++) {
  31194. const component = components[i];
  31195. for (let j = 0, jj = tiles.length; j < jj; j++) {
  31196. const tileComponent = {};
  31197. tile = tiles[j];
  31198. tileComponent.tcx0 = Math.ceil(tile.tx0 / component.XRsiz);
  31199. tileComponent.tcy0 = Math.ceil(tile.ty0 / component.YRsiz);
  31200. tileComponent.tcx1 = Math.ceil(tile.tx1 / component.XRsiz);
  31201. tileComponent.tcy1 = Math.ceil(tile.ty1 / component.YRsiz);
  31202. tileComponent.width = tileComponent.tcx1 - tileComponent.tcx0;
  31203. tileComponent.height = tileComponent.tcy1 - tileComponent.tcy0;
  31204. tile.components[i] = tileComponent;
  31205. }
  31206. }
  31207. }
  31208. function getBlocksDimensions(context, component, r) {
  31209. const codOrCoc = component.codingStyleParameters;
  31210. const result = {};
  31211. if (!codOrCoc.entropyCoderWithCustomPrecincts) {
  31212. result.PPx = 15;
  31213. result.PPy = 15;
  31214. } else {
  31215. result.PPx = codOrCoc.precinctsSizes[r].PPx;
  31216. result.PPy = codOrCoc.precinctsSizes[r].PPy;
  31217. }
  31218. result.xcb_ = r > 0 ? Math.min(codOrCoc.xcb, result.PPx - 1) : Math.min(codOrCoc.xcb, result.PPx);
  31219. result.ycb_ = r > 0 ? Math.min(codOrCoc.ycb, result.PPy - 1) : Math.min(codOrCoc.ycb, result.PPy);
  31220. return result;
  31221. }
  31222. function buildPrecincts(context, resolution, dimensions) {
  31223. const precinctWidth = 1 << dimensions.PPx;
  31224. const precinctHeight = 1 << dimensions.PPy;
  31225. const isZeroRes = resolution.resLevel === 0;
  31226. const precinctWidthInSubband = 1 << dimensions.PPx + (isZeroRes ? 0 : -1);
  31227. const precinctHeightInSubband = 1 << dimensions.PPy + (isZeroRes ? 0 : -1);
  31228. const numprecinctswide = resolution.trx1 > resolution.trx0 ? Math.ceil(resolution.trx1 / precinctWidth) - Math.floor(resolution.trx0 / precinctWidth) : 0;
  31229. const numprecinctshigh = resolution.try1 > resolution.try0 ? Math.ceil(resolution.try1 / precinctHeight) - Math.floor(resolution.try0 / precinctHeight) : 0;
  31230. const numprecincts = numprecinctswide * numprecinctshigh;
  31231. resolution.precinctParameters = {
  31232. precinctWidth,
  31233. precinctHeight,
  31234. numprecinctswide,
  31235. numprecinctshigh,
  31236. numprecincts,
  31237. precinctWidthInSubband,
  31238. precinctHeightInSubband
  31239. };
  31240. }
  31241. function buildCodeblocks(context, subband, dimensions) {
  31242. const xcb_ = dimensions.xcb_;
  31243. const ycb_ = dimensions.ycb_;
  31244. const codeblockWidth = 1 << xcb_;
  31245. const codeblockHeight = 1 << ycb_;
  31246. const cbx0 = subband.tbx0 >> xcb_;
  31247. const cby0 = subband.tby0 >> ycb_;
  31248. const cbx1 = subband.tbx1 + codeblockWidth - 1 >> xcb_;
  31249. const cby1 = subband.tby1 + codeblockHeight - 1 >> ycb_;
  31250. const precinctParameters = subband.resolution.precinctParameters;
  31251. const codeblocks = [];
  31252. const precincts = [];
  31253. let i, j, codeblock, precinctNumber;
  31254. for (j = cby0; j < cby1; j++) {
  31255. for (i = cbx0; i < cbx1; i++) {
  31256. codeblock = {
  31257. cbx: i,
  31258. cby: j,
  31259. tbx0: codeblockWidth * i,
  31260. tby0: codeblockHeight * j,
  31261. tbx1: codeblockWidth * (i + 1),
  31262. tby1: codeblockHeight * (j + 1)
  31263. };
  31264. codeblock.tbx0_ = Math.max(subband.tbx0, codeblock.tbx0);
  31265. codeblock.tby0_ = Math.max(subband.tby0, codeblock.tby0);
  31266. codeblock.tbx1_ = Math.min(subband.tbx1, codeblock.tbx1);
  31267. codeblock.tby1_ = Math.min(subband.tby1, codeblock.tby1);
  31268. const pi = Math.floor((codeblock.tbx0_ - subband.tbx0) / precinctParameters.precinctWidthInSubband);
  31269. const pj = Math.floor((codeblock.tby0_ - subband.tby0) / precinctParameters.precinctHeightInSubband);
  31270. precinctNumber = pi + pj * precinctParameters.numprecinctswide;
  31271. codeblock.precinctNumber = precinctNumber;
  31272. codeblock.subbandType = subband.type;
  31273. codeblock.Lblock = 3;
  31274. if (codeblock.tbx1_ <= codeblock.tbx0_ || codeblock.tby1_ <= codeblock.tby0_) {
  31275. continue;
  31276. }
  31277. codeblocks.push(codeblock);
  31278. let precinct = precincts[precinctNumber];
  31279. if (precinct !== undefined) {
  31280. if (i < precinct.cbxMin) {
  31281. precinct.cbxMin = i;
  31282. } else if (i > precinct.cbxMax) {
  31283. precinct.cbxMax = i;
  31284. }
  31285. if (j < precinct.cbyMin) {
  31286. precinct.cbxMin = j;
  31287. } else if (j > precinct.cbyMax) {
  31288. precinct.cbyMax = j;
  31289. }
  31290. } else {
  31291. precincts[precinctNumber] = precinct = {
  31292. cbxMin: i,
  31293. cbyMin: j,
  31294. cbxMax: i,
  31295. cbyMax: j
  31296. };
  31297. }
  31298. codeblock.precinct = precinct;
  31299. }
  31300. }
  31301. subband.codeblockParameters = {
  31302. codeblockWidth: xcb_,
  31303. codeblockHeight: ycb_,
  31304. numcodeblockwide: cbx1 - cbx0 + 1,
  31305. numcodeblockhigh: cby1 - cby0 + 1
  31306. };
  31307. subband.codeblocks = codeblocks;
  31308. subband.precincts = precincts;
  31309. }
  31310. function createPacket(resolution, precinctNumber, layerNumber) {
  31311. const precinctCodeblocks = [];
  31312. const subbands = resolution.subbands;
  31313. for (let i = 0, ii = subbands.length; i < ii; i++) {
  31314. const subband = subbands[i];
  31315. const codeblocks = subband.codeblocks;
  31316. for (let j = 0, jj = codeblocks.length; j < jj; j++) {
  31317. const codeblock = codeblocks[j];
  31318. if (codeblock.precinctNumber !== precinctNumber) {
  31319. continue;
  31320. }
  31321. precinctCodeblocks.push(codeblock);
  31322. }
  31323. }
  31324. return {
  31325. layerNumber,
  31326. codeblocks: precinctCodeblocks
  31327. };
  31328. }
  31329. function LayerResolutionComponentPositionIterator(context) {
  31330. const siz = context.SIZ;
  31331. const tileIndex = context.currentTile.index;
  31332. const tile = context.tiles[tileIndex];
  31333. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  31334. const componentsCount = siz.Csiz;
  31335. let maxDecompositionLevelsCount = 0;
  31336. for (let q = 0; q < componentsCount; q++) {
  31337. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount);
  31338. }
  31339. let l = 0,
  31340. r = 0,
  31341. i = 0,
  31342. k = 0;
  31343. this.nextPacket = function JpxImage_nextPacket() {
  31344. for (; l < layersCount; l++) {
  31345. for (; r <= maxDecompositionLevelsCount; r++) {
  31346. for (; i < componentsCount; i++) {
  31347. const component = tile.components[i];
  31348. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  31349. continue;
  31350. }
  31351. const resolution = component.resolutions[r];
  31352. const numprecincts = resolution.precinctParameters.numprecincts;
  31353. for (; k < numprecincts;) {
  31354. const packet = createPacket(resolution, k, l);
  31355. k++;
  31356. return packet;
  31357. }
  31358. k = 0;
  31359. }
  31360. i = 0;
  31361. }
  31362. r = 0;
  31363. }
  31364. throw new JpxError("Out of packets");
  31365. };
  31366. }
  31367. function ResolutionLayerComponentPositionIterator(context) {
  31368. const siz = context.SIZ;
  31369. const tileIndex = context.currentTile.index;
  31370. const tile = context.tiles[tileIndex];
  31371. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  31372. const componentsCount = siz.Csiz;
  31373. let maxDecompositionLevelsCount = 0;
  31374. for (let q = 0; q < componentsCount; q++) {
  31375. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount);
  31376. }
  31377. let r = 0,
  31378. l = 0,
  31379. i = 0,
  31380. k = 0;
  31381. this.nextPacket = function JpxImage_nextPacket() {
  31382. for (; r <= maxDecompositionLevelsCount; r++) {
  31383. for (; l < layersCount; l++) {
  31384. for (; i < componentsCount; i++) {
  31385. const component = tile.components[i];
  31386. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  31387. continue;
  31388. }
  31389. const resolution = component.resolutions[r];
  31390. const numprecincts = resolution.precinctParameters.numprecincts;
  31391. for (; k < numprecincts;) {
  31392. const packet = createPacket(resolution, k, l);
  31393. k++;
  31394. return packet;
  31395. }
  31396. k = 0;
  31397. }
  31398. i = 0;
  31399. }
  31400. l = 0;
  31401. }
  31402. throw new JpxError("Out of packets");
  31403. };
  31404. }
  31405. function ResolutionPositionComponentLayerIterator(context) {
  31406. const siz = context.SIZ;
  31407. const tileIndex = context.currentTile.index;
  31408. const tile = context.tiles[tileIndex];
  31409. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  31410. const componentsCount = siz.Csiz;
  31411. let l, r, c, p;
  31412. let maxDecompositionLevelsCount = 0;
  31413. for (c = 0; c < componentsCount; c++) {
  31414. const component = tile.components[c];
  31415. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, component.codingStyleParameters.decompositionLevelsCount);
  31416. }
  31417. const maxNumPrecinctsInLevel = new Int32Array(maxDecompositionLevelsCount + 1);
  31418. for (r = 0; r <= maxDecompositionLevelsCount; ++r) {
  31419. let maxNumPrecincts = 0;
  31420. for (c = 0; c < componentsCount; ++c) {
  31421. const resolutions = tile.components[c].resolutions;
  31422. if (r < resolutions.length) {
  31423. maxNumPrecincts = Math.max(maxNumPrecincts, resolutions[r].precinctParameters.numprecincts);
  31424. }
  31425. }
  31426. maxNumPrecinctsInLevel[r] = maxNumPrecincts;
  31427. }
  31428. l = 0;
  31429. r = 0;
  31430. c = 0;
  31431. p = 0;
  31432. this.nextPacket = function JpxImage_nextPacket() {
  31433. for (; r <= maxDecompositionLevelsCount; r++) {
  31434. for (; p < maxNumPrecinctsInLevel[r]; p++) {
  31435. for (; c < componentsCount; c++) {
  31436. const component = tile.components[c];
  31437. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  31438. continue;
  31439. }
  31440. const resolution = component.resolutions[r];
  31441. const numprecincts = resolution.precinctParameters.numprecincts;
  31442. if (p >= numprecincts) {
  31443. continue;
  31444. }
  31445. for (; l < layersCount;) {
  31446. const packet = createPacket(resolution, p, l);
  31447. l++;
  31448. return packet;
  31449. }
  31450. l = 0;
  31451. }
  31452. c = 0;
  31453. }
  31454. p = 0;
  31455. }
  31456. throw new JpxError("Out of packets");
  31457. };
  31458. }
  31459. function PositionComponentResolutionLayerIterator(context) {
  31460. const siz = context.SIZ;
  31461. const tileIndex = context.currentTile.index;
  31462. const tile = context.tiles[tileIndex];
  31463. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  31464. const componentsCount = siz.Csiz;
  31465. const precinctsSizes = getPrecinctSizesInImageScale(tile);
  31466. const precinctsIterationSizes = precinctsSizes;
  31467. let l = 0,
  31468. r = 0,
  31469. c = 0,
  31470. px = 0,
  31471. py = 0;
  31472. this.nextPacket = function JpxImage_nextPacket() {
  31473. for (; py < precinctsIterationSizes.maxNumHigh; py++) {
  31474. for (; px < precinctsIterationSizes.maxNumWide; px++) {
  31475. for (; c < componentsCount; c++) {
  31476. const component = tile.components[c];
  31477. const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  31478. for (; r <= decompositionLevelsCount; r++) {
  31479. const resolution = component.resolutions[r];
  31480. const sizeInImageScale = precinctsSizes.components[c].resolutions[r];
  31481. const k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution);
  31482. if (k === null) {
  31483. continue;
  31484. }
  31485. for (; l < layersCount;) {
  31486. const packet = createPacket(resolution, k, l);
  31487. l++;
  31488. return packet;
  31489. }
  31490. l = 0;
  31491. }
  31492. r = 0;
  31493. }
  31494. c = 0;
  31495. }
  31496. px = 0;
  31497. }
  31498. throw new JpxError("Out of packets");
  31499. };
  31500. }
  31501. function ComponentPositionResolutionLayerIterator(context) {
  31502. const siz = context.SIZ;
  31503. const tileIndex = context.currentTile.index;
  31504. const tile = context.tiles[tileIndex];
  31505. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  31506. const componentsCount = siz.Csiz;
  31507. const precinctsSizes = getPrecinctSizesInImageScale(tile);
  31508. let l = 0,
  31509. r = 0,
  31510. c = 0,
  31511. px = 0,
  31512. py = 0;
  31513. this.nextPacket = function JpxImage_nextPacket() {
  31514. for (; c < componentsCount; ++c) {
  31515. const component = tile.components[c];
  31516. const precinctsIterationSizes = precinctsSizes.components[c];
  31517. const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  31518. for (; py < precinctsIterationSizes.maxNumHigh; py++) {
  31519. for (; px < precinctsIterationSizes.maxNumWide; px++) {
  31520. for (; r <= decompositionLevelsCount; r++) {
  31521. const resolution = component.resolutions[r];
  31522. const sizeInImageScale = precinctsIterationSizes.resolutions[r];
  31523. const k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution);
  31524. if (k === null) {
  31525. continue;
  31526. }
  31527. for (; l < layersCount;) {
  31528. const packet = createPacket(resolution, k, l);
  31529. l++;
  31530. return packet;
  31531. }
  31532. l = 0;
  31533. }
  31534. r = 0;
  31535. }
  31536. px = 0;
  31537. }
  31538. py = 0;
  31539. }
  31540. throw new JpxError("Out of packets");
  31541. };
  31542. }
  31543. function getPrecinctIndexIfExist(pxIndex, pyIndex, sizeInImageScale, precinctIterationSizes, resolution) {
  31544. const posX = pxIndex * precinctIterationSizes.minWidth;
  31545. const posY = pyIndex * precinctIterationSizes.minHeight;
  31546. if (posX % sizeInImageScale.width !== 0 || posY % sizeInImageScale.height !== 0) {
  31547. return null;
  31548. }
  31549. const startPrecinctRowIndex = posY / sizeInImageScale.width * resolution.precinctParameters.numprecinctswide;
  31550. return posX / sizeInImageScale.height + startPrecinctRowIndex;
  31551. }
  31552. function getPrecinctSizesInImageScale(tile) {
  31553. const componentsCount = tile.components.length;
  31554. let minWidth = Number.MAX_VALUE;
  31555. let minHeight = Number.MAX_VALUE;
  31556. let maxNumWide = 0;
  31557. let maxNumHigh = 0;
  31558. const sizePerComponent = new Array(componentsCount);
  31559. for (let c = 0; c < componentsCount; c++) {
  31560. const component = tile.components[c];
  31561. const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  31562. const sizePerResolution = new Array(decompositionLevelsCount + 1);
  31563. let minWidthCurrentComponent = Number.MAX_VALUE;
  31564. let minHeightCurrentComponent = Number.MAX_VALUE;
  31565. let maxNumWideCurrentComponent = 0;
  31566. let maxNumHighCurrentComponent = 0;
  31567. let scale = 1;
  31568. for (let r = decompositionLevelsCount; r >= 0; --r) {
  31569. const resolution = component.resolutions[r];
  31570. const widthCurrentResolution = scale * resolution.precinctParameters.precinctWidth;
  31571. const heightCurrentResolution = scale * resolution.precinctParameters.precinctHeight;
  31572. minWidthCurrentComponent = Math.min(minWidthCurrentComponent, widthCurrentResolution);
  31573. minHeightCurrentComponent = Math.min(minHeightCurrentComponent, heightCurrentResolution);
  31574. maxNumWideCurrentComponent = Math.max(maxNumWideCurrentComponent, resolution.precinctParameters.numprecinctswide);
  31575. maxNumHighCurrentComponent = Math.max(maxNumHighCurrentComponent, resolution.precinctParameters.numprecinctshigh);
  31576. sizePerResolution[r] = {
  31577. width: widthCurrentResolution,
  31578. height: heightCurrentResolution
  31579. };
  31580. scale <<= 1;
  31581. }
  31582. minWidth = Math.min(minWidth, minWidthCurrentComponent);
  31583. minHeight = Math.min(minHeight, minHeightCurrentComponent);
  31584. maxNumWide = Math.max(maxNumWide, maxNumWideCurrentComponent);
  31585. maxNumHigh = Math.max(maxNumHigh, maxNumHighCurrentComponent);
  31586. sizePerComponent[c] = {
  31587. resolutions: sizePerResolution,
  31588. minWidth: minWidthCurrentComponent,
  31589. minHeight: minHeightCurrentComponent,
  31590. maxNumWide: maxNumWideCurrentComponent,
  31591. maxNumHigh: maxNumHighCurrentComponent
  31592. };
  31593. }
  31594. return {
  31595. components: sizePerComponent,
  31596. minWidth,
  31597. minHeight,
  31598. maxNumWide,
  31599. maxNumHigh
  31600. };
  31601. }
  31602. function buildPackets(context) {
  31603. const siz = context.SIZ;
  31604. const tileIndex = context.currentTile.index;
  31605. const tile = context.tiles[tileIndex];
  31606. const componentsCount = siz.Csiz;
  31607. for (let c = 0; c < componentsCount; c++) {
  31608. const component = tile.components[c];
  31609. const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  31610. const resolutions = [];
  31611. const subbands = [];
  31612. for (let r = 0; r <= decompositionLevelsCount; r++) {
  31613. const blocksDimensions = getBlocksDimensions(context, component, r);
  31614. const resolution = {};
  31615. const scale = 1 << decompositionLevelsCount - r;
  31616. resolution.trx0 = Math.ceil(component.tcx0 / scale);
  31617. resolution.try0 = Math.ceil(component.tcy0 / scale);
  31618. resolution.trx1 = Math.ceil(component.tcx1 / scale);
  31619. resolution.try1 = Math.ceil(component.tcy1 / scale);
  31620. resolution.resLevel = r;
  31621. buildPrecincts(context, resolution, blocksDimensions);
  31622. resolutions.push(resolution);
  31623. let subband;
  31624. if (r === 0) {
  31625. subband = {};
  31626. subband.type = "LL";
  31627. subband.tbx0 = Math.ceil(component.tcx0 / scale);
  31628. subband.tby0 = Math.ceil(component.tcy0 / scale);
  31629. subband.tbx1 = Math.ceil(component.tcx1 / scale);
  31630. subband.tby1 = Math.ceil(component.tcy1 / scale);
  31631. subband.resolution = resolution;
  31632. buildCodeblocks(context, subband, blocksDimensions);
  31633. subbands.push(subband);
  31634. resolution.subbands = [subband];
  31635. } else {
  31636. const bscale = 1 << decompositionLevelsCount - r + 1;
  31637. const resolutionSubbands = [];
  31638. subband = {};
  31639. subband.type = "HL";
  31640. subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5);
  31641. subband.tby0 = Math.ceil(component.tcy0 / bscale);
  31642. subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5);
  31643. subband.tby1 = Math.ceil(component.tcy1 / bscale);
  31644. subband.resolution = resolution;
  31645. buildCodeblocks(context, subband, blocksDimensions);
  31646. subbands.push(subband);
  31647. resolutionSubbands.push(subband);
  31648. subband = {};
  31649. subband.type = "LH";
  31650. subband.tbx0 = Math.ceil(component.tcx0 / bscale);
  31651. subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5);
  31652. subband.tbx1 = Math.ceil(component.tcx1 / bscale);
  31653. subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5);
  31654. subband.resolution = resolution;
  31655. buildCodeblocks(context, subband, blocksDimensions);
  31656. subbands.push(subband);
  31657. resolutionSubbands.push(subband);
  31658. subband = {};
  31659. subband.type = "HH";
  31660. subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5);
  31661. subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5);
  31662. subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5);
  31663. subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5);
  31664. subband.resolution = resolution;
  31665. buildCodeblocks(context, subband, blocksDimensions);
  31666. subbands.push(subband);
  31667. resolutionSubbands.push(subband);
  31668. resolution.subbands = resolutionSubbands;
  31669. }
  31670. }
  31671. component.resolutions = resolutions;
  31672. component.subbands = subbands;
  31673. }
  31674. const progressionOrder = tile.codingStyleDefaultParameters.progressionOrder;
  31675. switch (progressionOrder) {
  31676. case 0:
  31677. tile.packetsIterator = new LayerResolutionComponentPositionIterator(context);
  31678. break;
  31679. case 1:
  31680. tile.packetsIterator = new ResolutionLayerComponentPositionIterator(context);
  31681. break;
  31682. case 2:
  31683. tile.packetsIterator = new ResolutionPositionComponentLayerIterator(context);
  31684. break;
  31685. case 3:
  31686. tile.packetsIterator = new PositionComponentResolutionLayerIterator(context);
  31687. break;
  31688. case 4:
  31689. tile.packetsIterator = new ComponentPositionResolutionLayerIterator(context);
  31690. break;
  31691. default:
  31692. throw new JpxError(`Unsupported progression order ${progressionOrder}`);
  31693. }
  31694. }
  31695. function parseTilePackets(context, data, offset, dataLength) {
  31696. let position = 0;
  31697. let buffer,
  31698. bufferSize = 0,
  31699. skipNextBit = false;
  31700. function readBits(count) {
  31701. while (bufferSize < count) {
  31702. const b = data[offset + position];
  31703. position++;
  31704. if (skipNextBit) {
  31705. buffer = buffer << 7 | b;
  31706. bufferSize += 7;
  31707. skipNextBit = false;
  31708. } else {
  31709. buffer = buffer << 8 | b;
  31710. bufferSize += 8;
  31711. }
  31712. if (b === 0xff) {
  31713. skipNextBit = true;
  31714. }
  31715. }
  31716. bufferSize -= count;
  31717. return buffer >>> bufferSize & (1 << count) - 1;
  31718. }
  31719. function skipMarkerIfEqual(value) {
  31720. if (data[offset + position - 1] === 0xff && data[offset + position] === value) {
  31721. skipBytes(1);
  31722. return true;
  31723. } else if (data[offset + position] === 0xff && data[offset + position + 1] === value) {
  31724. skipBytes(2);
  31725. return true;
  31726. }
  31727. return false;
  31728. }
  31729. function skipBytes(count) {
  31730. position += count;
  31731. }
  31732. function alignToByte() {
  31733. bufferSize = 0;
  31734. if (skipNextBit) {
  31735. position++;
  31736. skipNextBit = false;
  31737. }
  31738. }
  31739. function readCodingpasses() {
  31740. if (readBits(1) === 0) {
  31741. return 1;
  31742. }
  31743. if (readBits(1) === 0) {
  31744. return 2;
  31745. }
  31746. let value = readBits(2);
  31747. if (value < 3) {
  31748. return value + 3;
  31749. }
  31750. value = readBits(5);
  31751. if (value < 31) {
  31752. return value + 6;
  31753. }
  31754. value = readBits(7);
  31755. return value + 37;
  31756. }
  31757. const tileIndex = context.currentTile.index;
  31758. const tile = context.tiles[tileIndex];
  31759. const sopMarkerUsed = context.COD.sopMarkerUsed;
  31760. const ephMarkerUsed = context.COD.ephMarkerUsed;
  31761. const packetsIterator = tile.packetsIterator;
  31762. while (position < dataLength) {
  31763. alignToByte();
  31764. if (sopMarkerUsed && skipMarkerIfEqual(0x91)) {
  31765. skipBytes(4);
  31766. }
  31767. const packet = packetsIterator.nextPacket();
  31768. if (!readBits(1)) {
  31769. continue;
  31770. }
  31771. const layerNumber = packet.layerNumber,
  31772. queue = [];
  31773. let codeblock;
  31774. for (let i = 0, ii = packet.codeblocks.length; i < ii; i++) {
  31775. codeblock = packet.codeblocks[i];
  31776. let precinct = codeblock.precinct;
  31777. const codeblockColumn = codeblock.cbx - precinct.cbxMin;
  31778. const codeblockRow = codeblock.cby - precinct.cbyMin;
  31779. let codeblockIncluded = false;
  31780. let firstTimeInclusion = false;
  31781. let valueReady, zeroBitPlanesTree;
  31782. if (codeblock.included !== undefined) {
  31783. codeblockIncluded = !!readBits(1);
  31784. } else {
  31785. precinct = codeblock.precinct;
  31786. let inclusionTree;
  31787. if (precinct.inclusionTree !== undefined) {
  31788. inclusionTree = precinct.inclusionTree;
  31789. } else {
  31790. const width = precinct.cbxMax - precinct.cbxMin + 1;
  31791. const height = precinct.cbyMax - precinct.cbyMin + 1;
  31792. inclusionTree = new InclusionTree(width, height, layerNumber);
  31793. zeroBitPlanesTree = new TagTree(width, height);
  31794. precinct.inclusionTree = inclusionTree;
  31795. precinct.zeroBitPlanesTree = zeroBitPlanesTree;
  31796. for (let l = 0; l < layerNumber; l++) {
  31797. if (readBits(1) !== 0) {
  31798. throw new JpxError("Invalid tag tree");
  31799. }
  31800. }
  31801. }
  31802. if (inclusionTree.reset(codeblockColumn, codeblockRow, layerNumber)) {
  31803. while (true) {
  31804. if (readBits(1)) {
  31805. valueReady = !inclusionTree.nextLevel();
  31806. if (valueReady) {
  31807. codeblock.included = true;
  31808. codeblockIncluded = firstTimeInclusion = true;
  31809. break;
  31810. }
  31811. } else {
  31812. inclusionTree.incrementValue(layerNumber);
  31813. break;
  31814. }
  31815. }
  31816. }
  31817. }
  31818. if (!codeblockIncluded) {
  31819. continue;
  31820. }
  31821. if (firstTimeInclusion) {
  31822. zeroBitPlanesTree = precinct.zeroBitPlanesTree;
  31823. zeroBitPlanesTree.reset(codeblockColumn, codeblockRow);
  31824. while (true) {
  31825. if (readBits(1)) {
  31826. valueReady = !zeroBitPlanesTree.nextLevel();
  31827. if (valueReady) {
  31828. break;
  31829. }
  31830. } else {
  31831. zeroBitPlanesTree.incrementValue();
  31832. }
  31833. }
  31834. codeblock.zeroBitPlanes = zeroBitPlanesTree.value;
  31835. }
  31836. const codingpasses = readCodingpasses();
  31837. while (readBits(1)) {
  31838. codeblock.Lblock++;
  31839. }
  31840. const codingpassesLog2 = (0, _core_utils.log2)(codingpasses);
  31841. const bits = (codingpasses < 1 << codingpassesLog2 ? codingpassesLog2 - 1 : codingpassesLog2) + codeblock.Lblock;
  31842. const codedDataLength = readBits(bits);
  31843. queue.push({
  31844. codeblock,
  31845. codingpasses,
  31846. dataLength: codedDataLength
  31847. });
  31848. }
  31849. alignToByte();
  31850. if (ephMarkerUsed) {
  31851. skipMarkerIfEqual(0x92);
  31852. }
  31853. while (queue.length > 0) {
  31854. const packetItem = queue.shift();
  31855. codeblock = packetItem.codeblock;
  31856. if (codeblock.data === undefined) {
  31857. codeblock.data = [];
  31858. }
  31859. codeblock.data.push({
  31860. data,
  31861. start: offset + position,
  31862. end: offset + position + packetItem.dataLength,
  31863. codingpasses: packetItem.codingpasses
  31864. });
  31865. position += packetItem.dataLength;
  31866. }
  31867. }
  31868. return position;
  31869. }
  31870. function copyCoefficients(coefficients, levelWidth, levelHeight, subband, delta, mb, reversible, segmentationSymbolUsed, resetContextProbabilities) {
  31871. const x0 = subband.tbx0;
  31872. const y0 = subband.tby0;
  31873. const width = subband.tbx1 - subband.tbx0;
  31874. const codeblocks = subband.codeblocks;
  31875. const right = subband.type.charAt(0) === "H" ? 1 : 0;
  31876. const bottom = subband.type.charAt(1) === "H" ? levelWidth : 0;
  31877. for (let i = 0, ii = codeblocks.length; i < ii; ++i) {
  31878. const codeblock = codeblocks[i];
  31879. const blockWidth = codeblock.tbx1_ - codeblock.tbx0_;
  31880. const blockHeight = codeblock.tby1_ - codeblock.tby0_;
  31881. if (blockWidth === 0 || blockHeight === 0) {
  31882. continue;
  31883. }
  31884. if (codeblock.data === undefined) {
  31885. continue;
  31886. }
  31887. const bitModel = new BitModel(blockWidth, blockHeight, codeblock.subbandType, codeblock.zeroBitPlanes, mb);
  31888. let currentCodingpassType = 2;
  31889. const data = codeblock.data;
  31890. let totalLength = 0,
  31891. codingpasses = 0;
  31892. let j, jj, dataItem;
  31893. for (j = 0, jj = data.length; j < jj; j++) {
  31894. dataItem = data[j];
  31895. totalLength += dataItem.end - dataItem.start;
  31896. codingpasses += dataItem.codingpasses;
  31897. }
  31898. const encodedData = new Uint8Array(totalLength);
  31899. let position = 0;
  31900. for (j = 0, jj = data.length; j < jj; j++) {
  31901. dataItem = data[j];
  31902. const chunk = dataItem.data.subarray(dataItem.start, dataItem.end);
  31903. encodedData.set(chunk, position);
  31904. position += chunk.length;
  31905. }
  31906. const decoder = new _arithmetic_decoder.ArithmeticDecoder(encodedData, 0, totalLength);
  31907. bitModel.setDecoder(decoder);
  31908. for (j = 0; j < codingpasses; j++) {
  31909. switch (currentCodingpassType) {
  31910. case 0:
  31911. bitModel.runSignificancePropagationPass();
  31912. break;
  31913. case 1:
  31914. bitModel.runMagnitudeRefinementPass();
  31915. break;
  31916. case 2:
  31917. bitModel.runCleanupPass();
  31918. if (segmentationSymbolUsed) {
  31919. bitModel.checkSegmentationSymbol();
  31920. }
  31921. break;
  31922. }
  31923. if (resetContextProbabilities) {
  31924. bitModel.reset();
  31925. }
  31926. currentCodingpassType = (currentCodingpassType + 1) % 3;
  31927. }
  31928. let offset = codeblock.tbx0_ - x0 + (codeblock.tby0_ - y0) * width;
  31929. const sign = bitModel.coefficentsSign;
  31930. const magnitude = bitModel.coefficentsMagnitude;
  31931. const bitsDecoded = bitModel.bitsDecoded;
  31932. const magnitudeCorrection = reversible ? 0 : 0.5;
  31933. let k, n, nb;
  31934. position = 0;
  31935. const interleave = subband.type !== "LL";
  31936. for (j = 0; j < blockHeight; j++) {
  31937. const row = offset / width | 0;
  31938. const levelOffset = 2 * row * (levelWidth - width) + right + bottom;
  31939. for (k = 0; k < blockWidth; k++) {
  31940. n = magnitude[position];
  31941. if (n !== 0) {
  31942. n = (n + magnitudeCorrection) * delta;
  31943. if (sign[position] !== 0) {
  31944. n = -n;
  31945. }
  31946. nb = bitsDecoded[position];
  31947. const pos = interleave ? levelOffset + (offset << 1) : offset;
  31948. if (reversible && nb >= mb) {
  31949. coefficients[pos] = n;
  31950. } else {
  31951. coefficients[pos] = n * (1 << mb - nb);
  31952. }
  31953. }
  31954. offset++;
  31955. position++;
  31956. }
  31957. offset += width - blockWidth;
  31958. }
  31959. }
  31960. }
  31961. function transformTile(context, tile, c) {
  31962. const component = tile.components[c];
  31963. const codingStyleParameters = component.codingStyleParameters;
  31964. const quantizationParameters = component.quantizationParameters;
  31965. const decompositionLevelsCount = codingStyleParameters.decompositionLevelsCount;
  31966. const spqcds = quantizationParameters.SPqcds;
  31967. const scalarExpounded = quantizationParameters.scalarExpounded;
  31968. const guardBits = quantizationParameters.guardBits;
  31969. const segmentationSymbolUsed = codingStyleParameters.segmentationSymbolUsed;
  31970. const resetContextProbabilities = codingStyleParameters.resetContextProbabilities;
  31971. const precision = context.components[c].precision;
  31972. const reversible = codingStyleParameters.reversibleTransformation;
  31973. const transform = reversible ? new ReversibleTransform() : new IrreversibleTransform();
  31974. const subbandCoefficients = [];
  31975. let b = 0;
  31976. for (let i = 0; i <= decompositionLevelsCount; i++) {
  31977. const resolution = component.resolutions[i];
  31978. const width = resolution.trx1 - resolution.trx0;
  31979. const height = resolution.try1 - resolution.try0;
  31980. const coefficients = new Float32Array(width * height);
  31981. for (let j = 0, jj = resolution.subbands.length; j < jj; j++) {
  31982. let mu, epsilon;
  31983. if (!scalarExpounded) {
  31984. mu = spqcds[0].mu;
  31985. epsilon = spqcds[0].epsilon + (i > 0 ? 1 - i : 0);
  31986. } else {
  31987. mu = spqcds[b].mu;
  31988. epsilon = spqcds[b].epsilon;
  31989. b++;
  31990. }
  31991. const subband = resolution.subbands[j];
  31992. const gainLog2 = SubbandsGainLog2[subband.type];
  31993. const delta = reversible ? 1 : 2 ** (precision + gainLog2 - epsilon) * (1 + mu / 2048);
  31994. const mb = guardBits + epsilon - 1;
  31995. copyCoefficients(coefficients, width, height, subband, delta, mb, reversible, segmentationSymbolUsed, resetContextProbabilities);
  31996. }
  31997. subbandCoefficients.push({
  31998. width,
  31999. height,
  32000. items: coefficients
  32001. });
  32002. }
  32003. const result = transform.calculate(subbandCoefficients, component.tcx0, component.tcy0);
  32004. return {
  32005. left: component.tcx0,
  32006. top: component.tcy0,
  32007. width: result.width,
  32008. height: result.height,
  32009. items: result.items
  32010. };
  32011. }
  32012. function transformComponents(context) {
  32013. const siz = context.SIZ;
  32014. const components = context.components;
  32015. const componentsCount = siz.Csiz;
  32016. const resultImages = [];
  32017. for (let i = 0, ii = context.tiles.length; i < ii; i++) {
  32018. const tile = context.tiles[i];
  32019. const transformedTiles = [];
  32020. for (let c = 0; c < componentsCount; c++) {
  32021. transformedTiles[c] = transformTile(context, tile, c);
  32022. }
  32023. const tile0 = transformedTiles[0];
  32024. const out = new Uint8ClampedArray(tile0.items.length * componentsCount);
  32025. const result = {
  32026. left: tile0.left,
  32027. top: tile0.top,
  32028. width: tile0.width,
  32029. height: tile0.height,
  32030. items: out
  32031. };
  32032. let shift, offset;
  32033. let pos = 0,
  32034. j,
  32035. jj,
  32036. y0,
  32037. y1,
  32038. y2;
  32039. if (tile.codingStyleDefaultParameters.multipleComponentTransform) {
  32040. const fourComponents = componentsCount === 4;
  32041. const y0items = transformedTiles[0].items;
  32042. const y1items = transformedTiles[1].items;
  32043. const y2items = transformedTiles[2].items;
  32044. const y3items = fourComponents ? transformedTiles[3].items : null;
  32045. shift = components[0].precision - 8;
  32046. offset = (128 << shift) + 0.5;
  32047. const component0 = tile.components[0];
  32048. const alpha01 = componentsCount - 3;
  32049. jj = y0items.length;
  32050. if (!component0.codingStyleParameters.reversibleTransformation) {
  32051. for (j = 0; j < jj; j++, pos += alpha01) {
  32052. y0 = y0items[j] + offset;
  32053. y1 = y1items[j];
  32054. y2 = y2items[j];
  32055. out[pos++] = y0 + 1.402 * y2 >> shift;
  32056. out[pos++] = y0 - 0.34413 * y1 - 0.71414 * y2 >> shift;
  32057. out[pos++] = y0 + 1.772 * y1 >> shift;
  32058. }
  32059. } else {
  32060. for (j = 0; j < jj; j++, pos += alpha01) {
  32061. y0 = y0items[j] + offset;
  32062. y1 = y1items[j];
  32063. y2 = y2items[j];
  32064. const g = y0 - (y2 + y1 >> 2);
  32065. out[pos++] = g + y2 >> shift;
  32066. out[pos++] = g >> shift;
  32067. out[pos++] = g + y1 >> shift;
  32068. }
  32069. }
  32070. if (fourComponents) {
  32071. for (j = 0, pos = 3; j < jj; j++, pos += 4) {
  32072. out[pos] = y3items[j] + offset >> shift;
  32073. }
  32074. }
  32075. } else {
  32076. for (let c = 0; c < componentsCount; c++) {
  32077. const items = transformedTiles[c].items;
  32078. shift = components[c].precision - 8;
  32079. offset = (128 << shift) + 0.5;
  32080. for (pos = c, j = 0, jj = items.length; j < jj; j++) {
  32081. out[pos] = items[j] + offset >> shift;
  32082. pos += componentsCount;
  32083. }
  32084. }
  32085. }
  32086. resultImages.push(result);
  32087. }
  32088. return resultImages;
  32089. }
  32090. function initializeTile(context, tileIndex) {
  32091. const siz = context.SIZ;
  32092. const componentsCount = siz.Csiz;
  32093. const tile = context.tiles[tileIndex];
  32094. for (let c = 0; c < componentsCount; c++) {
  32095. const component = tile.components[c];
  32096. const qcdOrQcc = context.currentTile.QCC[c] !== undefined ? context.currentTile.QCC[c] : context.currentTile.QCD;
  32097. component.quantizationParameters = qcdOrQcc;
  32098. const codOrCoc = context.currentTile.COC[c] !== undefined ? context.currentTile.COC[c] : context.currentTile.COD;
  32099. component.codingStyleParameters = codOrCoc;
  32100. }
  32101. tile.codingStyleDefaultParameters = context.currentTile.COD;
  32102. }
  32103. class TagTree {
  32104. constructor(width, height) {
  32105. const levelsLength = (0, _core_utils.log2)(Math.max(width, height)) + 1;
  32106. this.levels = [];
  32107. for (let i = 0; i < levelsLength; i++) {
  32108. const level = {
  32109. width,
  32110. height,
  32111. items: []
  32112. };
  32113. this.levels.push(level);
  32114. width = Math.ceil(width / 2);
  32115. height = Math.ceil(height / 2);
  32116. }
  32117. }
  32118. reset(i, j) {
  32119. let currentLevel = 0,
  32120. value = 0,
  32121. level;
  32122. while (currentLevel < this.levels.length) {
  32123. level = this.levels[currentLevel];
  32124. const index = i + j * level.width;
  32125. if (level.items[index] !== undefined) {
  32126. value = level.items[index];
  32127. break;
  32128. }
  32129. level.index = index;
  32130. i >>= 1;
  32131. j >>= 1;
  32132. currentLevel++;
  32133. }
  32134. currentLevel--;
  32135. level = this.levels[currentLevel];
  32136. level.items[level.index] = value;
  32137. this.currentLevel = currentLevel;
  32138. delete this.value;
  32139. }
  32140. incrementValue() {
  32141. const level = this.levels[this.currentLevel];
  32142. level.items[level.index]++;
  32143. }
  32144. nextLevel() {
  32145. let currentLevel = this.currentLevel;
  32146. let level = this.levels[currentLevel];
  32147. const value = level.items[level.index];
  32148. currentLevel--;
  32149. if (currentLevel < 0) {
  32150. this.value = value;
  32151. return false;
  32152. }
  32153. this.currentLevel = currentLevel;
  32154. level = this.levels[currentLevel];
  32155. level.items[level.index] = value;
  32156. return true;
  32157. }
  32158. }
  32159. class InclusionTree {
  32160. constructor(width, height, defaultValue) {
  32161. const levelsLength = (0, _core_utils.log2)(Math.max(width, height)) + 1;
  32162. this.levels = [];
  32163. for (let i = 0; i < levelsLength; i++) {
  32164. const items = new Uint8Array(width * height);
  32165. for (let j = 0, jj = items.length; j < jj; j++) {
  32166. items[j] = defaultValue;
  32167. }
  32168. const level = {
  32169. width,
  32170. height,
  32171. items
  32172. };
  32173. this.levels.push(level);
  32174. width = Math.ceil(width / 2);
  32175. height = Math.ceil(height / 2);
  32176. }
  32177. }
  32178. reset(i, j, stopValue) {
  32179. let currentLevel = 0;
  32180. while (currentLevel < this.levels.length) {
  32181. const level = this.levels[currentLevel];
  32182. const index = i + j * level.width;
  32183. level.index = index;
  32184. const value = level.items[index];
  32185. if (value === 0xff) {
  32186. break;
  32187. }
  32188. if (value > stopValue) {
  32189. this.currentLevel = currentLevel;
  32190. this.propagateValues();
  32191. return false;
  32192. }
  32193. i >>= 1;
  32194. j >>= 1;
  32195. currentLevel++;
  32196. }
  32197. this.currentLevel = currentLevel - 1;
  32198. return true;
  32199. }
  32200. incrementValue(stopValue) {
  32201. const level = this.levels[this.currentLevel];
  32202. level.items[level.index] = stopValue + 1;
  32203. this.propagateValues();
  32204. }
  32205. propagateValues() {
  32206. let levelIndex = this.currentLevel;
  32207. let level = this.levels[levelIndex];
  32208. const currentValue = level.items[level.index];
  32209. while (--levelIndex >= 0) {
  32210. level = this.levels[levelIndex];
  32211. level.items[level.index] = currentValue;
  32212. }
  32213. }
  32214. nextLevel() {
  32215. let currentLevel = this.currentLevel;
  32216. let level = this.levels[currentLevel];
  32217. const value = level.items[level.index];
  32218. level.items[level.index] = 0xff;
  32219. currentLevel--;
  32220. if (currentLevel < 0) {
  32221. return false;
  32222. }
  32223. this.currentLevel = currentLevel;
  32224. level = this.levels[currentLevel];
  32225. level.items[level.index] = value;
  32226. return true;
  32227. }
  32228. }
  32229. const BitModel = function BitModelClosure() {
  32230. const UNIFORM_CONTEXT = 17;
  32231. const RUNLENGTH_CONTEXT = 18;
  32232. 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]);
  32233. 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]);
  32234. 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]);
  32235. class BitModel {
  32236. constructor(width, height, subband, zeroBitPlanes, mb) {
  32237. this.width = width;
  32238. this.height = height;
  32239. let contextLabelTable;
  32240. if (subband === "HH") {
  32241. contextLabelTable = HHContextLabel;
  32242. } else if (subband === "HL") {
  32243. contextLabelTable = HLContextLabel;
  32244. } else {
  32245. contextLabelTable = LLAndLHContextsLabel;
  32246. }
  32247. this.contextLabelTable = contextLabelTable;
  32248. const coefficientCount = width * height;
  32249. this.neighborsSignificance = new Uint8Array(coefficientCount);
  32250. this.coefficentsSign = new Uint8Array(coefficientCount);
  32251. let coefficentsMagnitude;
  32252. if (mb > 14) {
  32253. coefficentsMagnitude = new Uint32Array(coefficientCount);
  32254. } else if (mb > 6) {
  32255. coefficentsMagnitude = new Uint16Array(coefficientCount);
  32256. } else {
  32257. coefficentsMagnitude = new Uint8Array(coefficientCount);
  32258. }
  32259. this.coefficentsMagnitude = coefficentsMagnitude;
  32260. this.processingFlags = new Uint8Array(coefficientCount);
  32261. const bitsDecoded = new Uint8Array(coefficientCount);
  32262. if (zeroBitPlanes !== 0) {
  32263. for (let i = 0; i < coefficientCount; i++) {
  32264. bitsDecoded[i] = zeroBitPlanes;
  32265. }
  32266. }
  32267. this.bitsDecoded = bitsDecoded;
  32268. this.reset();
  32269. }
  32270. setDecoder(decoder) {
  32271. this.decoder = decoder;
  32272. }
  32273. reset() {
  32274. this.contexts = new Int8Array(19);
  32275. this.contexts[0] = 4 << 1 | 0;
  32276. this.contexts[UNIFORM_CONTEXT] = 46 << 1 | 0;
  32277. this.contexts[RUNLENGTH_CONTEXT] = 3 << 1 | 0;
  32278. }
  32279. setNeighborsSignificance(row, column, index) {
  32280. const neighborsSignificance = this.neighborsSignificance;
  32281. const width = this.width,
  32282. height = this.height;
  32283. const left = column > 0;
  32284. const right = column + 1 < width;
  32285. let i;
  32286. if (row > 0) {
  32287. i = index - width;
  32288. if (left) {
  32289. neighborsSignificance[i - 1] += 0x10;
  32290. }
  32291. if (right) {
  32292. neighborsSignificance[i + 1] += 0x10;
  32293. }
  32294. neighborsSignificance[i] += 0x04;
  32295. }
  32296. if (row + 1 < height) {
  32297. i = index + width;
  32298. if (left) {
  32299. neighborsSignificance[i - 1] += 0x10;
  32300. }
  32301. if (right) {
  32302. neighborsSignificance[i + 1] += 0x10;
  32303. }
  32304. neighborsSignificance[i] += 0x04;
  32305. }
  32306. if (left) {
  32307. neighborsSignificance[index - 1] += 0x01;
  32308. }
  32309. if (right) {
  32310. neighborsSignificance[index + 1] += 0x01;
  32311. }
  32312. neighborsSignificance[index] |= 0x80;
  32313. }
  32314. runSignificancePropagationPass() {
  32315. const decoder = this.decoder;
  32316. const width = this.width,
  32317. height = this.height;
  32318. const coefficentsMagnitude = this.coefficentsMagnitude;
  32319. const coefficentsSign = this.coefficentsSign;
  32320. const neighborsSignificance = this.neighborsSignificance;
  32321. const processingFlags = this.processingFlags;
  32322. const contexts = this.contexts;
  32323. const labels = this.contextLabelTable;
  32324. const bitsDecoded = this.bitsDecoded;
  32325. const processedInverseMask = ~1;
  32326. const processedMask = 1;
  32327. const firstMagnitudeBitMask = 2;
  32328. for (let i0 = 0; i0 < height; i0 += 4) {
  32329. for (let j = 0; j < width; j++) {
  32330. let index = i0 * width + j;
  32331. for (let i1 = 0; i1 < 4; i1++, index += width) {
  32332. const i = i0 + i1;
  32333. if (i >= height) {
  32334. break;
  32335. }
  32336. processingFlags[index] &= processedInverseMask;
  32337. if (coefficentsMagnitude[index] || !neighborsSignificance[index]) {
  32338. continue;
  32339. }
  32340. const contextLabel = labels[neighborsSignificance[index]];
  32341. const decision = decoder.readBit(contexts, contextLabel);
  32342. if (decision) {
  32343. const sign = this.decodeSignBit(i, j, index);
  32344. coefficentsSign[index] = sign;
  32345. coefficentsMagnitude[index] = 1;
  32346. this.setNeighborsSignificance(i, j, index);
  32347. processingFlags[index] |= firstMagnitudeBitMask;
  32348. }
  32349. bitsDecoded[index]++;
  32350. processingFlags[index] |= processedMask;
  32351. }
  32352. }
  32353. }
  32354. }
  32355. decodeSignBit(row, column, index) {
  32356. const width = this.width,
  32357. height = this.height;
  32358. const coefficentsMagnitude = this.coefficentsMagnitude;
  32359. const coefficentsSign = this.coefficentsSign;
  32360. let contribution, sign0, sign1, significance1;
  32361. let contextLabel, decoded;
  32362. significance1 = column > 0 && coefficentsMagnitude[index - 1] !== 0;
  32363. if (column + 1 < width && coefficentsMagnitude[index + 1] !== 0) {
  32364. sign1 = coefficentsSign[index + 1];
  32365. if (significance1) {
  32366. sign0 = coefficentsSign[index - 1];
  32367. contribution = 1 - sign1 - sign0;
  32368. } else {
  32369. contribution = 1 - sign1 - sign1;
  32370. }
  32371. } else if (significance1) {
  32372. sign0 = coefficentsSign[index - 1];
  32373. contribution = 1 - sign0 - sign0;
  32374. } else {
  32375. contribution = 0;
  32376. }
  32377. const horizontalContribution = 3 * contribution;
  32378. significance1 = row > 0 && coefficentsMagnitude[index - width] !== 0;
  32379. if (row + 1 < height && coefficentsMagnitude[index + width] !== 0) {
  32380. sign1 = coefficentsSign[index + width];
  32381. if (significance1) {
  32382. sign0 = coefficentsSign[index - width];
  32383. contribution = 1 - sign1 - sign0 + horizontalContribution;
  32384. } else {
  32385. contribution = 1 - sign1 - sign1 + horizontalContribution;
  32386. }
  32387. } else if (significance1) {
  32388. sign0 = coefficentsSign[index - width];
  32389. contribution = 1 - sign0 - sign0 + horizontalContribution;
  32390. } else {
  32391. contribution = horizontalContribution;
  32392. }
  32393. if (contribution >= 0) {
  32394. contextLabel = 9 + contribution;
  32395. decoded = this.decoder.readBit(this.contexts, contextLabel);
  32396. } else {
  32397. contextLabel = 9 - contribution;
  32398. decoded = this.decoder.readBit(this.contexts, contextLabel) ^ 1;
  32399. }
  32400. return decoded;
  32401. }
  32402. runMagnitudeRefinementPass() {
  32403. const decoder = this.decoder;
  32404. const width = this.width,
  32405. height = this.height;
  32406. const coefficentsMagnitude = this.coefficentsMagnitude;
  32407. const neighborsSignificance = this.neighborsSignificance;
  32408. const contexts = this.contexts;
  32409. const bitsDecoded = this.bitsDecoded;
  32410. const processingFlags = this.processingFlags;
  32411. const processedMask = 1;
  32412. const firstMagnitudeBitMask = 2;
  32413. const length = width * height;
  32414. const width4 = width * 4;
  32415. for (let index0 = 0, indexNext; index0 < length; index0 = indexNext) {
  32416. indexNext = Math.min(length, index0 + width4);
  32417. for (let j = 0; j < width; j++) {
  32418. for (let index = index0 + j; index < indexNext; index += width) {
  32419. if (!coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) {
  32420. continue;
  32421. }
  32422. let contextLabel = 16;
  32423. if ((processingFlags[index] & firstMagnitudeBitMask) !== 0) {
  32424. processingFlags[index] ^= firstMagnitudeBitMask;
  32425. const significance = neighborsSignificance[index] & 127;
  32426. contextLabel = significance === 0 ? 15 : 14;
  32427. }
  32428. const bit = decoder.readBit(contexts, contextLabel);
  32429. coefficentsMagnitude[index] = coefficentsMagnitude[index] << 1 | bit;
  32430. bitsDecoded[index]++;
  32431. processingFlags[index] |= processedMask;
  32432. }
  32433. }
  32434. }
  32435. }
  32436. runCleanupPass() {
  32437. const decoder = this.decoder;
  32438. const width = this.width,
  32439. height = this.height;
  32440. const neighborsSignificance = this.neighborsSignificance;
  32441. const coefficentsMagnitude = this.coefficentsMagnitude;
  32442. const coefficentsSign = this.coefficentsSign;
  32443. const contexts = this.contexts;
  32444. const labels = this.contextLabelTable;
  32445. const bitsDecoded = this.bitsDecoded;
  32446. const processingFlags = this.processingFlags;
  32447. const processedMask = 1;
  32448. const firstMagnitudeBitMask = 2;
  32449. const oneRowDown = width;
  32450. const twoRowsDown = width * 2;
  32451. const threeRowsDown = width * 3;
  32452. let iNext;
  32453. for (let i0 = 0; i0 < height; i0 = iNext) {
  32454. iNext = Math.min(i0 + 4, height);
  32455. const indexBase = i0 * width;
  32456. const checkAllEmpty = i0 + 3 < height;
  32457. for (let j = 0; j < width; j++) {
  32458. const index0 = indexBase + j;
  32459. 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;
  32460. let i1 = 0,
  32461. index = index0;
  32462. let i = i0,
  32463. sign;
  32464. if (allEmpty) {
  32465. const hasSignificantCoefficent = decoder.readBit(contexts, RUNLENGTH_CONTEXT);
  32466. if (!hasSignificantCoefficent) {
  32467. bitsDecoded[index0]++;
  32468. bitsDecoded[index0 + oneRowDown]++;
  32469. bitsDecoded[index0 + twoRowsDown]++;
  32470. bitsDecoded[index0 + threeRowsDown]++;
  32471. continue;
  32472. }
  32473. i1 = decoder.readBit(contexts, UNIFORM_CONTEXT) << 1 | decoder.readBit(contexts, UNIFORM_CONTEXT);
  32474. if (i1 !== 0) {
  32475. i = i0 + i1;
  32476. index += i1 * width;
  32477. }
  32478. sign = this.decodeSignBit(i, j, index);
  32479. coefficentsSign[index] = sign;
  32480. coefficentsMagnitude[index] = 1;
  32481. this.setNeighborsSignificance(i, j, index);
  32482. processingFlags[index] |= firstMagnitudeBitMask;
  32483. index = index0;
  32484. for (let i2 = i0; i2 <= i; i2++, index += width) {
  32485. bitsDecoded[index]++;
  32486. }
  32487. i1++;
  32488. }
  32489. for (i = i0 + i1; i < iNext; i++, index += width) {
  32490. if (coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) {
  32491. continue;
  32492. }
  32493. const contextLabel = labels[neighborsSignificance[index]];
  32494. const decision = decoder.readBit(contexts, contextLabel);
  32495. if (decision === 1) {
  32496. sign = this.decodeSignBit(i, j, index);
  32497. coefficentsSign[index] = sign;
  32498. coefficentsMagnitude[index] = 1;
  32499. this.setNeighborsSignificance(i, j, index);
  32500. processingFlags[index] |= firstMagnitudeBitMask;
  32501. }
  32502. bitsDecoded[index]++;
  32503. }
  32504. }
  32505. }
  32506. }
  32507. checkSegmentationSymbol() {
  32508. const decoder = this.decoder;
  32509. const contexts = this.contexts;
  32510. 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);
  32511. if (symbol !== 0xa) {
  32512. throw new JpxError("Invalid segmentation symbol");
  32513. }
  32514. }
  32515. }
  32516. return BitModel;
  32517. }();
  32518. class Transform {
  32519. constructor() {
  32520. if (this.constructor === Transform) {
  32521. (0, _util.unreachable)("Cannot initialize Transform.");
  32522. }
  32523. }
  32524. calculate(subbands, u0, v0) {
  32525. let ll = subbands[0];
  32526. for (let i = 1, ii = subbands.length; i < ii; i++) {
  32527. ll = this.iterate(ll, subbands[i], u0, v0);
  32528. }
  32529. return ll;
  32530. }
  32531. extend(buffer, offset, size) {
  32532. let i1 = offset - 1,
  32533. j1 = offset + 1;
  32534. let i2 = offset + size - 2,
  32535. j2 = offset + size;
  32536. buffer[i1--] = buffer[j1++];
  32537. buffer[j2++] = buffer[i2--];
  32538. buffer[i1--] = buffer[j1++];
  32539. buffer[j2++] = buffer[i2--];
  32540. buffer[i1--] = buffer[j1++];
  32541. buffer[j2++] = buffer[i2--];
  32542. buffer[i1] = buffer[j1];
  32543. buffer[j2] = buffer[i2];
  32544. }
  32545. filter(x, offset, length) {
  32546. (0, _util.unreachable)("Abstract method `filter` called");
  32547. }
  32548. iterate(ll, hl_lh_hh, u0, v0) {
  32549. const llWidth = ll.width,
  32550. llHeight = ll.height;
  32551. let llItems = ll.items;
  32552. const width = hl_lh_hh.width;
  32553. const height = hl_lh_hh.height;
  32554. const items = hl_lh_hh.items;
  32555. let i, j, k, l, u, v;
  32556. for (k = 0, i = 0; i < llHeight; i++) {
  32557. l = i * 2 * width;
  32558. for (j = 0; j < llWidth; j++, k++, l += 2) {
  32559. items[l] = llItems[k];
  32560. }
  32561. }
  32562. llItems = ll.items = null;
  32563. const bufferPadding = 4;
  32564. const rowBuffer = new Float32Array(width + 2 * bufferPadding);
  32565. if (width === 1) {
  32566. if ((u0 & 1) !== 0) {
  32567. for (v = 0, k = 0; v < height; v++, k += width) {
  32568. items[k] *= 0.5;
  32569. }
  32570. }
  32571. } else {
  32572. for (v = 0, k = 0; v < height; v++, k += width) {
  32573. rowBuffer.set(items.subarray(k, k + width), bufferPadding);
  32574. this.extend(rowBuffer, bufferPadding, width);
  32575. this.filter(rowBuffer, bufferPadding, width);
  32576. items.set(rowBuffer.subarray(bufferPadding, bufferPadding + width), k);
  32577. }
  32578. }
  32579. let numBuffers = 16;
  32580. const colBuffers = [];
  32581. for (i = 0; i < numBuffers; i++) {
  32582. colBuffers.push(new Float32Array(height + 2 * bufferPadding));
  32583. }
  32584. let b,
  32585. currentBuffer = 0;
  32586. ll = bufferPadding + height;
  32587. if (height === 1) {
  32588. if ((v0 & 1) !== 0) {
  32589. for (u = 0; u < width; u++) {
  32590. items[u] *= 0.5;
  32591. }
  32592. }
  32593. } else {
  32594. for (u = 0; u < width; u++) {
  32595. if (currentBuffer === 0) {
  32596. numBuffers = Math.min(width - u, numBuffers);
  32597. for (k = u, l = bufferPadding; l < ll; k += width, l++) {
  32598. for (b = 0; b < numBuffers; b++) {
  32599. colBuffers[b][l] = items[k + b];
  32600. }
  32601. }
  32602. currentBuffer = numBuffers;
  32603. }
  32604. currentBuffer--;
  32605. const buffer = colBuffers[currentBuffer];
  32606. this.extend(buffer, bufferPadding, height);
  32607. this.filter(buffer, bufferPadding, height);
  32608. if (currentBuffer === 0) {
  32609. k = u - numBuffers + 1;
  32610. for (l = bufferPadding; l < ll; k += width, l++) {
  32611. for (b = 0; b < numBuffers; b++) {
  32612. items[k + b] = colBuffers[b][l];
  32613. }
  32614. }
  32615. }
  32616. }
  32617. }
  32618. return {
  32619. width,
  32620. height,
  32621. items
  32622. };
  32623. }
  32624. }
  32625. class IrreversibleTransform extends Transform {
  32626. filter(x, offset, length) {
  32627. const len = length >> 1;
  32628. offset |= 0;
  32629. let j, n, current, next;
  32630. const alpha = -1.586134342059924;
  32631. const beta = -0.052980118572961;
  32632. const gamma = 0.882911075530934;
  32633. const delta = 0.443506852043971;
  32634. const K = 1.230174104914001;
  32635. const K_ = 1 / K;
  32636. j = offset - 3;
  32637. for (n = len + 4; n--; j += 2) {
  32638. x[j] *= K_;
  32639. }
  32640. j = offset - 2;
  32641. current = delta * x[j - 1];
  32642. for (n = len + 3; n--; j += 2) {
  32643. next = delta * x[j + 1];
  32644. x[j] = K * x[j] - current - next;
  32645. if (n--) {
  32646. j += 2;
  32647. current = delta * x[j + 1];
  32648. x[j] = K * x[j] - current - next;
  32649. } else {
  32650. break;
  32651. }
  32652. }
  32653. j = offset - 1;
  32654. current = gamma * x[j - 1];
  32655. for (n = len + 2; n--; j += 2) {
  32656. next = gamma * x[j + 1];
  32657. x[j] -= current + next;
  32658. if (n--) {
  32659. j += 2;
  32660. current = gamma * x[j + 1];
  32661. x[j] -= current + next;
  32662. } else {
  32663. break;
  32664. }
  32665. }
  32666. j = offset;
  32667. current = beta * x[j - 1];
  32668. for (n = len + 1; n--; j += 2) {
  32669. next = beta * x[j + 1];
  32670. x[j] -= current + next;
  32671. if (n--) {
  32672. j += 2;
  32673. current = beta * x[j + 1];
  32674. x[j] -= current + next;
  32675. } else {
  32676. break;
  32677. }
  32678. }
  32679. if (len !== 0) {
  32680. j = offset + 1;
  32681. current = alpha * x[j - 1];
  32682. for (n = len; n--; j += 2) {
  32683. next = alpha * x[j + 1];
  32684. x[j] -= current + next;
  32685. if (n--) {
  32686. j += 2;
  32687. current = alpha * x[j + 1];
  32688. x[j] -= current + next;
  32689. } else {
  32690. break;
  32691. }
  32692. }
  32693. }
  32694. }
  32695. }
  32696. class ReversibleTransform extends Transform {
  32697. filter(x, offset, length) {
  32698. const len = length >> 1;
  32699. offset |= 0;
  32700. let j, n;
  32701. for (j = offset, n = len + 1; n--; j += 2) {
  32702. x[j] -= x[j - 1] + x[j + 1] + 2 >> 2;
  32703. }
  32704. for (j = offset + 1, n = len; n--; j += 2) {
  32705. x[j] += x[j - 1] + x[j + 1] >> 1;
  32706. }
  32707. }
  32708. }
  32709. /***/ }),
  32710. /* 41 */
  32711. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  32712. Object.defineProperty(exports, "__esModule", ({
  32713. value: true
  32714. }));
  32715. exports.LZWStream = void 0;
  32716. var _decode_stream = __w_pdfjs_require__(29);
  32717. class LZWStream extends _decode_stream.DecodeStream {
  32718. constructor(str, maybeLength, earlyChange) {
  32719. super(maybeLength);
  32720. this.str = str;
  32721. this.dict = str.dict;
  32722. this.cachedData = 0;
  32723. this.bitsCached = 0;
  32724. const maxLzwDictionarySize = 4096;
  32725. const lzwState = {
  32726. earlyChange,
  32727. codeLength: 9,
  32728. nextCode: 258,
  32729. dictionaryValues: new Uint8Array(maxLzwDictionarySize),
  32730. dictionaryLengths: new Uint16Array(maxLzwDictionarySize),
  32731. dictionaryPrevCodes: new Uint16Array(maxLzwDictionarySize),
  32732. currentSequence: new Uint8Array(maxLzwDictionarySize),
  32733. currentSequenceLength: 0
  32734. };
  32735. for (let i = 0; i < 256; ++i) {
  32736. lzwState.dictionaryValues[i] = i;
  32737. lzwState.dictionaryLengths[i] = 1;
  32738. }
  32739. this.lzwState = lzwState;
  32740. }
  32741. readBits(n) {
  32742. let bitsCached = this.bitsCached;
  32743. let cachedData = this.cachedData;
  32744. while (bitsCached < n) {
  32745. const c = this.str.getByte();
  32746. if (c === -1) {
  32747. this.eof = true;
  32748. return null;
  32749. }
  32750. cachedData = cachedData << 8 | c;
  32751. bitsCached += 8;
  32752. }
  32753. this.bitsCached = bitsCached -= n;
  32754. this.cachedData = cachedData;
  32755. this.lastCode = null;
  32756. return cachedData >>> bitsCached & (1 << n) - 1;
  32757. }
  32758. readBlock() {
  32759. const blockSize = 512,
  32760. decodedSizeDelta = blockSize;
  32761. let estimatedDecodedSize = blockSize * 2;
  32762. let i, j, q;
  32763. const lzwState = this.lzwState;
  32764. if (!lzwState) {
  32765. return;
  32766. }
  32767. const earlyChange = lzwState.earlyChange;
  32768. let nextCode = lzwState.nextCode;
  32769. const dictionaryValues = lzwState.dictionaryValues;
  32770. const dictionaryLengths = lzwState.dictionaryLengths;
  32771. const dictionaryPrevCodes = lzwState.dictionaryPrevCodes;
  32772. let codeLength = lzwState.codeLength;
  32773. let prevCode = lzwState.prevCode;
  32774. const currentSequence = lzwState.currentSequence;
  32775. let currentSequenceLength = lzwState.currentSequenceLength;
  32776. let decodedLength = 0;
  32777. let currentBufferLength = this.bufferLength;
  32778. let buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
  32779. for (i = 0; i < blockSize; i++) {
  32780. const code = this.readBits(codeLength);
  32781. const hasPrev = currentSequenceLength > 0;
  32782. if (code < 256) {
  32783. currentSequence[0] = code;
  32784. currentSequenceLength = 1;
  32785. } else if (code >= 258) {
  32786. if (code < nextCode) {
  32787. currentSequenceLength = dictionaryLengths[code];
  32788. for (j = currentSequenceLength - 1, q = code; j >= 0; j--) {
  32789. currentSequence[j] = dictionaryValues[q];
  32790. q = dictionaryPrevCodes[q];
  32791. }
  32792. } else {
  32793. currentSequence[currentSequenceLength++] = currentSequence[0];
  32794. }
  32795. } else if (code === 256) {
  32796. codeLength = 9;
  32797. nextCode = 258;
  32798. currentSequenceLength = 0;
  32799. continue;
  32800. } else {
  32801. this.eof = true;
  32802. delete this.lzwState;
  32803. break;
  32804. }
  32805. if (hasPrev) {
  32806. dictionaryPrevCodes[nextCode] = prevCode;
  32807. dictionaryLengths[nextCode] = dictionaryLengths[prevCode] + 1;
  32808. dictionaryValues[nextCode] = currentSequence[0];
  32809. nextCode++;
  32810. codeLength = nextCode + earlyChange & nextCode + earlyChange - 1 ? codeLength : Math.min(Math.log(nextCode + earlyChange) / 0.6931471805599453 + 1, 12) | 0;
  32811. }
  32812. prevCode = code;
  32813. decodedLength += currentSequenceLength;
  32814. if (estimatedDecodedSize < decodedLength) {
  32815. do {
  32816. estimatedDecodedSize += decodedSizeDelta;
  32817. } while (estimatedDecodedSize < decodedLength);
  32818. buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
  32819. }
  32820. for (j = 0; j < currentSequenceLength; j++) {
  32821. buffer[currentBufferLength++] = currentSequence[j];
  32822. }
  32823. }
  32824. lzwState.nextCode = nextCode;
  32825. lzwState.codeLength = codeLength;
  32826. lzwState.prevCode = prevCode;
  32827. lzwState.currentSequenceLength = currentSequenceLength;
  32828. this.bufferLength = currentBufferLength;
  32829. }
  32830. }
  32831. exports.LZWStream = LZWStream;
  32832. /***/ }),
  32833. /* 42 */
  32834. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  32835. Object.defineProperty(exports, "__esModule", ({
  32836. value: true
  32837. }));
  32838. exports.PredictorStream = void 0;
  32839. var _decode_stream = __w_pdfjs_require__(29);
  32840. var _primitives = __w_pdfjs_require__(5);
  32841. var _util = __w_pdfjs_require__(2);
  32842. class PredictorStream extends _decode_stream.DecodeStream {
  32843. constructor(str, maybeLength, params) {
  32844. super(maybeLength);
  32845. if (!(params instanceof _primitives.Dict)) {
  32846. return str;
  32847. }
  32848. const predictor = this.predictor = params.get("Predictor") || 1;
  32849. if (predictor <= 1) {
  32850. return str;
  32851. }
  32852. if (predictor !== 2 && (predictor < 10 || predictor > 15)) {
  32853. throw new _util.FormatError(`Unsupported predictor: ${predictor}`);
  32854. }
  32855. if (predictor === 2) {
  32856. this.readBlock = this.readBlockTiff;
  32857. } else {
  32858. this.readBlock = this.readBlockPng;
  32859. }
  32860. this.str = str;
  32861. this.dict = str.dict;
  32862. const colors = this.colors = params.get("Colors") || 1;
  32863. const bits = this.bits = params.get("BPC", "BitsPerComponent") || 8;
  32864. const columns = this.columns = params.get("Columns") || 1;
  32865. this.pixBytes = colors * bits + 7 >> 3;
  32866. this.rowBytes = columns * colors * bits + 7 >> 3;
  32867. return this;
  32868. }
  32869. readBlockTiff() {
  32870. const rowBytes = this.rowBytes;
  32871. const bufferLength = this.bufferLength;
  32872. const buffer = this.ensureBuffer(bufferLength + rowBytes);
  32873. const bits = this.bits;
  32874. const colors = this.colors;
  32875. const rawBytes = this.str.getBytes(rowBytes);
  32876. this.eof = !rawBytes.length;
  32877. if (this.eof) {
  32878. return;
  32879. }
  32880. let inbuf = 0,
  32881. outbuf = 0;
  32882. let inbits = 0,
  32883. outbits = 0;
  32884. let pos = bufferLength;
  32885. let i;
  32886. if (bits === 1 && colors === 1) {
  32887. for (i = 0; i < rowBytes; ++i) {
  32888. let c = rawBytes[i] ^ inbuf;
  32889. c ^= c >> 1;
  32890. c ^= c >> 2;
  32891. c ^= c >> 4;
  32892. inbuf = (c & 1) << 7;
  32893. buffer[pos++] = c;
  32894. }
  32895. } else if (bits === 8) {
  32896. for (i = 0; i < colors; ++i) {
  32897. buffer[pos++] = rawBytes[i];
  32898. }
  32899. for (; i < rowBytes; ++i) {
  32900. buffer[pos] = buffer[pos - colors] + rawBytes[i];
  32901. pos++;
  32902. }
  32903. } else if (bits === 16) {
  32904. const bytesPerPixel = colors * 2;
  32905. for (i = 0; i < bytesPerPixel; ++i) {
  32906. buffer[pos++] = rawBytes[i];
  32907. }
  32908. for (; i < rowBytes; i += 2) {
  32909. const sum = ((rawBytes[i] & 0xff) << 8) + (rawBytes[i + 1] & 0xff) + ((buffer[pos - bytesPerPixel] & 0xff) << 8) + (buffer[pos - bytesPerPixel + 1] & 0xff);
  32910. buffer[pos++] = sum >> 8 & 0xff;
  32911. buffer[pos++] = sum & 0xff;
  32912. }
  32913. } else {
  32914. const compArray = new Uint8Array(colors + 1);
  32915. const bitMask = (1 << bits) - 1;
  32916. let j = 0,
  32917. k = bufferLength;
  32918. const columns = this.columns;
  32919. for (i = 0; i < columns; ++i) {
  32920. for (let kk = 0; kk < colors; ++kk) {
  32921. if (inbits < bits) {
  32922. inbuf = inbuf << 8 | rawBytes[j++] & 0xff;
  32923. inbits += 8;
  32924. }
  32925. compArray[kk] = compArray[kk] + (inbuf >> inbits - bits) & bitMask;
  32926. inbits -= bits;
  32927. outbuf = outbuf << bits | compArray[kk];
  32928. outbits += bits;
  32929. if (outbits >= 8) {
  32930. buffer[k++] = outbuf >> outbits - 8 & 0xff;
  32931. outbits -= 8;
  32932. }
  32933. }
  32934. }
  32935. if (outbits > 0) {
  32936. buffer[k++] = (outbuf << 8 - outbits) + (inbuf & (1 << 8 - outbits) - 1);
  32937. }
  32938. }
  32939. this.bufferLength += rowBytes;
  32940. }
  32941. readBlockPng() {
  32942. const rowBytes = this.rowBytes;
  32943. const pixBytes = this.pixBytes;
  32944. const predictor = this.str.getByte();
  32945. const rawBytes = this.str.getBytes(rowBytes);
  32946. this.eof = !rawBytes.length;
  32947. if (this.eof) {
  32948. return;
  32949. }
  32950. const bufferLength = this.bufferLength;
  32951. const buffer = this.ensureBuffer(bufferLength + rowBytes);
  32952. let prevRow = buffer.subarray(bufferLength - rowBytes, bufferLength);
  32953. if (prevRow.length === 0) {
  32954. prevRow = new Uint8Array(rowBytes);
  32955. }
  32956. let i,
  32957. j = bufferLength,
  32958. up,
  32959. c;
  32960. switch (predictor) {
  32961. case 0:
  32962. for (i = 0; i < rowBytes; ++i) {
  32963. buffer[j++] = rawBytes[i];
  32964. }
  32965. break;
  32966. case 1:
  32967. for (i = 0; i < pixBytes; ++i) {
  32968. buffer[j++] = rawBytes[i];
  32969. }
  32970. for (; i < rowBytes; ++i) {
  32971. buffer[j] = buffer[j - pixBytes] + rawBytes[i] & 0xff;
  32972. j++;
  32973. }
  32974. break;
  32975. case 2:
  32976. for (i = 0; i < rowBytes; ++i) {
  32977. buffer[j++] = prevRow[i] + rawBytes[i] & 0xff;
  32978. }
  32979. break;
  32980. case 3:
  32981. for (i = 0; i < pixBytes; ++i) {
  32982. buffer[j++] = (prevRow[i] >> 1) + rawBytes[i];
  32983. }
  32984. for (; i < rowBytes; ++i) {
  32985. buffer[j] = (prevRow[i] + buffer[j - pixBytes] >> 1) + rawBytes[i] & 0xff;
  32986. j++;
  32987. }
  32988. break;
  32989. case 4:
  32990. for (i = 0; i < pixBytes; ++i) {
  32991. up = prevRow[i];
  32992. c = rawBytes[i];
  32993. buffer[j++] = up + c;
  32994. }
  32995. for (; i < rowBytes; ++i) {
  32996. up = prevRow[i];
  32997. const upLeft = prevRow[i - pixBytes];
  32998. const left = buffer[j - pixBytes];
  32999. const p = left + up - upLeft;
  33000. let pa = p - left;
  33001. if (pa < 0) {
  33002. pa = -pa;
  33003. }
  33004. let pb = p - up;
  33005. if (pb < 0) {
  33006. pb = -pb;
  33007. }
  33008. let pc = p - upLeft;
  33009. if (pc < 0) {
  33010. pc = -pc;
  33011. }
  33012. c = rawBytes[i];
  33013. if (pa <= pb && pa <= pc) {
  33014. buffer[j++] = left + c;
  33015. } else if (pb <= pc) {
  33016. buffer[j++] = up + c;
  33017. } else {
  33018. buffer[j++] = upLeft + c;
  33019. }
  33020. }
  33021. break;
  33022. default:
  33023. throw new _util.FormatError(`Unsupported predictor: ${predictor}`);
  33024. }
  33025. this.bufferLength += rowBytes;
  33026. }
  33027. }
  33028. exports.PredictorStream = PredictorStream;
  33029. /***/ }),
  33030. /* 43 */
  33031. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  33032. Object.defineProperty(exports, "__esModule", ({
  33033. value: true
  33034. }));
  33035. exports.RunLengthStream = void 0;
  33036. var _decode_stream = __w_pdfjs_require__(29);
  33037. class RunLengthStream extends _decode_stream.DecodeStream {
  33038. constructor(str, maybeLength) {
  33039. super(maybeLength);
  33040. this.str = str;
  33041. this.dict = str.dict;
  33042. }
  33043. readBlock() {
  33044. const repeatHeader = this.str.getBytes(2);
  33045. if (!repeatHeader || repeatHeader.length < 2 || repeatHeader[0] === 128) {
  33046. this.eof = true;
  33047. return;
  33048. }
  33049. let buffer;
  33050. let bufferLength = this.bufferLength;
  33051. let n = repeatHeader[0];
  33052. if (n < 128) {
  33053. buffer = this.ensureBuffer(bufferLength + n + 1);
  33054. buffer[bufferLength++] = repeatHeader[1];
  33055. if (n > 0) {
  33056. const source = this.str.getBytes(n);
  33057. buffer.set(source, bufferLength);
  33058. bufferLength += n;
  33059. }
  33060. } else {
  33061. n = 257 - n;
  33062. const b = repeatHeader[1];
  33063. buffer = this.ensureBuffer(bufferLength + n + 1);
  33064. for (let i = 0; i < n; i++) {
  33065. buffer[bufferLength++] = b;
  33066. }
  33067. }
  33068. this.bufferLength = bufferLength;
  33069. }
  33070. }
  33071. exports.RunLengthStream = RunLengthStream;
  33072. /***/ }),
  33073. /* 44 */
  33074. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  33075. Object.defineProperty(exports, "__esModule", ({
  33076. value: true
  33077. }));
  33078. exports.Font = exports.ErrorFont = void 0;
  33079. var _util = __w_pdfjs_require__(2);
  33080. var _cff_parser = __w_pdfjs_require__(45);
  33081. var _fonts_utils = __w_pdfjs_require__(18);
  33082. var _unicode = __w_pdfjs_require__(21);
  33083. var _glyphlist = __w_pdfjs_require__(20);
  33084. var _encodings = __w_pdfjs_require__(19);
  33085. var _standard_fonts = __w_pdfjs_require__(47);
  33086. var _to_unicode_map = __w_pdfjs_require__(48);
  33087. var _cff_font = __w_pdfjs_require__(49);
  33088. var _font_renderer = __w_pdfjs_require__(50);
  33089. var _metrics = __w_pdfjs_require__(51);
  33090. var _glyf = __w_pdfjs_require__(52);
  33091. var _cmap = __w_pdfjs_require__(26);
  33092. var _opentype_file_builder = __w_pdfjs_require__(53);
  33093. var _core_utils = __w_pdfjs_require__(6);
  33094. var _stream = __w_pdfjs_require__(10);
  33095. var _type1_font = __w_pdfjs_require__(54);
  33096. const PRIVATE_USE_AREAS = [[0xe000, 0xf8ff], [0x100000, 0x10fffd]];
  33097. const PDF_GLYPH_SPACE_UNITS = 1000;
  33098. const EXPORT_DATA_PROPERTIES = ["ascent", "bbox", "black", "bold", "charProcOperatorList", "composite", "cssFontInfo", "data", "defaultVMetrics", "defaultWidth", "descent", "fallbackName", "fontMatrix", "fontType", "isType3Font", "italic", "loadedName", "mimetype", "missingFile", "name", "remeasure", "subtype", "type", "vertical"];
  33099. const EXPORT_DATA_EXTRA_PROPERTIES = ["cMap", "defaultEncoding", "differences", "isMonospace", "isSerifFont", "isSymbolicFont", "seacMap", "toFontChar", "toUnicode", "vmetrics", "widths"];
  33100. function adjustWidths(properties) {
  33101. if (!properties.fontMatrix) {
  33102. return;
  33103. }
  33104. if (properties.fontMatrix[0] === _util.FONT_IDENTITY_MATRIX[0]) {
  33105. return;
  33106. }
  33107. const scale = 0.001 / properties.fontMatrix[0];
  33108. const glyphsWidths = properties.widths;
  33109. for (const glyph in glyphsWidths) {
  33110. glyphsWidths[glyph] *= scale;
  33111. }
  33112. properties.defaultWidth *= scale;
  33113. }
  33114. function adjustToUnicode(properties, builtInEncoding) {
  33115. if (properties.isInternalFont) {
  33116. return;
  33117. }
  33118. if (builtInEncoding === properties.defaultEncoding) {
  33119. return;
  33120. }
  33121. if (properties.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
  33122. return;
  33123. }
  33124. const toUnicode = [],
  33125. glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  33126. for (const charCode in builtInEncoding) {
  33127. if (properties.hasIncludedToUnicodeMap) {
  33128. if (properties.toUnicode.has(charCode)) {
  33129. continue;
  33130. }
  33131. } else if (properties.hasEncoding) {
  33132. if (properties.differences.length === 0 || properties.differences[charCode] !== undefined) {
  33133. continue;
  33134. }
  33135. }
  33136. const glyphName = builtInEncoding[charCode];
  33137. const unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
  33138. if (unicode !== -1) {
  33139. toUnicode[charCode] = String.fromCharCode(unicode);
  33140. }
  33141. }
  33142. if (toUnicode.length > 0) {
  33143. properties.toUnicode.amend(toUnicode);
  33144. }
  33145. }
  33146. function amendFallbackToUnicode(properties) {
  33147. if (!properties.fallbackToUnicode) {
  33148. return;
  33149. }
  33150. if (properties.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
  33151. return;
  33152. }
  33153. const toUnicode = [];
  33154. for (const charCode in properties.fallbackToUnicode) {
  33155. if (properties.toUnicode.has(charCode)) {
  33156. continue;
  33157. }
  33158. toUnicode[charCode] = properties.fallbackToUnicode[charCode];
  33159. }
  33160. if (toUnicode.length > 0) {
  33161. properties.toUnicode.amend(toUnicode);
  33162. }
  33163. }
  33164. class Glyph {
  33165. constructor(originalCharCode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) {
  33166. this.originalCharCode = originalCharCode;
  33167. this.fontChar = fontChar;
  33168. this.unicode = unicode;
  33169. this.accent = accent;
  33170. this.width = width;
  33171. this.vmetric = vmetric;
  33172. this.operatorListId = operatorListId;
  33173. this.isSpace = isSpace;
  33174. this.isInFont = isInFont;
  33175. const category = (0, _unicode.getCharUnicodeCategory)(unicode);
  33176. this.isWhitespace = category.isWhitespace;
  33177. this.isZeroWidthDiacritic = category.isZeroWidthDiacritic;
  33178. this.isInvisibleFormatMark = category.isInvisibleFormatMark;
  33179. }
  33180. matchesForCache(originalCharCode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) {
  33181. return this.originalCharCode === originalCharCode && this.fontChar === fontChar && this.unicode === unicode && this.accent === accent && this.width === width && this.vmetric === vmetric && this.operatorListId === operatorListId && this.isSpace === isSpace && this.isInFont === isInFont;
  33182. }
  33183. }
  33184. function int16(b0, b1) {
  33185. return (b0 << 8) + b1;
  33186. }
  33187. function writeSignedInt16(bytes, index, value) {
  33188. bytes[index + 1] = value;
  33189. bytes[index] = value >>> 8;
  33190. }
  33191. function signedInt16(b0, b1) {
  33192. const value = (b0 << 8) + b1;
  33193. return value & 1 << 15 ? value - 0x10000 : value;
  33194. }
  33195. function int32(b0, b1, b2, b3) {
  33196. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  33197. }
  33198. function string16(value) {
  33199. return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
  33200. }
  33201. function safeString16(value) {
  33202. if (value > 0x7fff) {
  33203. value = 0x7fff;
  33204. } else if (value < -0x8000) {
  33205. value = -0x8000;
  33206. }
  33207. return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
  33208. }
  33209. function isTrueTypeFile(file) {
  33210. const header = file.peekBytes(4);
  33211. return (0, _core_utils.readUint32)(header, 0) === 0x00010000 || (0, _util.bytesToString)(header) === "true";
  33212. }
  33213. function isTrueTypeCollectionFile(file) {
  33214. const header = file.peekBytes(4);
  33215. return (0, _util.bytesToString)(header) === "ttcf";
  33216. }
  33217. function isOpenTypeFile(file) {
  33218. const header = file.peekBytes(4);
  33219. return (0, _util.bytesToString)(header) === "OTTO";
  33220. }
  33221. function isType1File(file) {
  33222. const header = file.peekBytes(2);
  33223. if (header[0] === 0x25 && header[1] === 0x21) {
  33224. return true;
  33225. }
  33226. if (header[0] === 0x80 && header[1] === 0x01) {
  33227. return true;
  33228. }
  33229. return false;
  33230. }
  33231. function isCFFFile(file) {
  33232. const header = file.peekBytes(4);
  33233. if (header[0] >= 1 && header[3] >= 1 && header[3] <= 4) {
  33234. return true;
  33235. }
  33236. return false;
  33237. }
  33238. function getFontFileType(file, {
  33239. type,
  33240. subtype,
  33241. composite
  33242. }) {
  33243. let fileType, fileSubtype;
  33244. if (isTrueTypeFile(file) || isTrueTypeCollectionFile(file)) {
  33245. if (composite) {
  33246. fileType = "CIDFontType2";
  33247. } else {
  33248. fileType = "TrueType";
  33249. }
  33250. } else if (isOpenTypeFile(file)) {
  33251. if (composite) {
  33252. fileType = "CIDFontType2";
  33253. } else {
  33254. fileType = "OpenType";
  33255. }
  33256. } else if (isType1File(file)) {
  33257. if (composite) {
  33258. fileType = "CIDFontType0";
  33259. } else {
  33260. fileType = type === "MMType1" ? "MMType1" : "Type1";
  33261. }
  33262. } else if (isCFFFile(file)) {
  33263. if (composite) {
  33264. fileType = "CIDFontType0";
  33265. fileSubtype = "CIDFontType0C";
  33266. } else {
  33267. fileType = type === "MMType1" ? "MMType1" : "Type1";
  33268. fileSubtype = "Type1C";
  33269. }
  33270. } else {
  33271. (0, _util.warn)("getFontFileType: Unable to detect correct font file Type/Subtype.");
  33272. fileType = type;
  33273. fileSubtype = subtype;
  33274. }
  33275. return [fileType, fileSubtype];
  33276. }
  33277. function applyStandardFontGlyphMap(map, glyphMap) {
  33278. for (const charCode in glyphMap) {
  33279. map[+charCode] = glyphMap[charCode];
  33280. }
  33281. }
  33282. function buildToFontChar(encoding, glyphsUnicodeMap, differences) {
  33283. const toFontChar = [];
  33284. let unicode;
  33285. for (let i = 0, ii = encoding.length; i < ii; i++) {
  33286. unicode = (0, _unicode.getUnicodeForGlyph)(encoding[i], glyphsUnicodeMap);
  33287. if (unicode !== -1) {
  33288. toFontChar[i] = unicode;
  33289. }
  33290. }
  33291. for (const charCode in differences) {
  33292. unicode = (0, _unicode.getUnicodeForGlyph)(differences[charCode], glyphsUnicodeMap);
  33293. if (unicode !== -1) {
  33294. toFontChar[+charCode] = unicode;
  33295. }
  33296. }
  33297. return toFontChar;
  33298. }
  33299. function convertCidString(charCode, cid, shouldThrow = false) {
  33300. switch (cid.length) {
  33301. case 1:
  33302. return cid.charCodeAt(0);
  33303. case 2:
  33304. return cid.charCodeAt(0) << 8 | cid.charCodeAt(1);
  33305. }
  33306. const msg = `Unsupported CID string (charCode ${charCode}): "${cid}".`;
  33307. if (shouldThrow) {
  33308. throw new _util.FormatError(msg);
  33309. }
  33310. (0, _util.warn)(msg);
  33311. return cid;
  33312. }
  33313. function adjustMapping(charCodeToGlyphId, hasGlyph, newGlyphZeroId, toUnicode) {
  33314. const newMap = Object.create(null);
  33315. const toUnicodeExtraMap = new Map();
  33316. const toFontChar = [];
  33317. const usedGlyphIds = new Set();
  33318. let privateUseAreaIndex = 0;
  33319. const privateUseOffetStart = PRIVATE_USE_AREAS[privateUseAreaIndex][0];
  33320. let nextAvailableFontCharCode = privateUseOffetStart;
  33321. let privateUseOffetEnd = PRIVATE_USE_AREAS[privateUseAreaIndex][1];
  33322. for (let originalCharCode in charCodeToGlyphId) {
  33323. originalCharCode |= 0;
  33324. let glyphId = charCodeToGlyphId[originalCharCode];
  33325. if (!hasGlyph(glyphId)) {
  33326. continue;
  33327. }
  33328. if (nextAvailableFontCharCode > privateUseOffetEnd) {
  33329. privateUseAreaIndex++;
  33330. if (privateUseAreaIndex >= PRIVATE_USE_AREAS.length) {
  33331. (0, _util.warn)("Ran out of space in font private use area.");
  33332. break;
  33333. }
  33334. nextAvailableFontCharCode = PRIVATE_USE_AREAS[privateUseAreaIndex][0];
  33335. privateUseOffetEnd = PRIVATE_USE_AREAS[privateUseAreaIndex][1];
  33336. }
  33337. const fontCharCode = nextAvailableFontCharCode++;
  33338. if (glyphId === 0) {
  33339. glyphId = newGlyphZeroId;
  33340. }
  33341. let unicode = toUnicode.get(originalCharCode);
  33342. if (typeof unicode === "string") {
  33343. unicode = unicode.codePointAt(0);
  33344. }
  33345. if (unicode && unicode < privateUseOffetStart && !usedGlyphIds.has(glyphId)) {
  33346. toUnicodeExtraMap.set(unicode, glyphId);
  33347. usedGlyphIds.add(glyphId);
  33348. }
  33349. newMap[fontCharCode] = glyphId;
  33350. toFontChar[originalCharCode] = fontCharCode;
  33351. }
  33352. return {
  33353. toFontChar,
  33354. charCodeToGlyphId: newMap,
  33355. toUnicodeExtraMap,
  33356. nextAvailableFontCharCode
  33357. };
  33358. }
  33359. function getRanges(glyphs, toUnicodeExtraMap, numGlyphs) {
  33360. const codes = [];
  33361. for (const charCode in glyphs) {
  33362. if (glyphs[charCode] >= numGlyphs) {
  33363. continue;
  33364. }
  33365. codes.push({
  33366. fontCharCode: charCode | 0,
  33367. glyphId: glyphs[charCode]
  33368. });
  33369. }
  33370. if (toUnicodeExtraMap) {
  33371. for (const [unicode, glyphId] of toUnicodeExtraMap) {
  33372. if (glyphId >= numGlyphs) {
  33373. continue;
  33374. }
  33375. codes.push({
  33376. fontCharCode: unicode,
  33377. glyphId
  33378. });
  33379. }
  33380. }
  33381. if (codes.length === 0) {
  33382. codes.push({
  33383. fontCharCode: 0,
  33384. glyphId: 0
  33385. });
  33386. }
  33387. codes.sort(function fontGetRangesSort(a, b) {
  33388. return a.fontCharCode - b.fontCharCode;
  33389. });
  33390. const ranges = [];
  33391. const length = codes.length;
  33392. for (let n = 0; n < length;) {
  33393. const start = codes[n].fontCharCode;
  33394. const codeIndices = [codes[n].glyphId];
  33395. ++n;
  33396. let end = start;
  33397. while (n < length && end + 1 === codes[n].fontCharCode) {
  33398. codeIndices.push(codes[n].glyphId);
  33399. ++end;
  33400. ++n;
  33401. if (end === 0xffff) {
  33402. break;
  33403. }
  33404. }
  33405. ranges.push([start, end, codeIndices]);
  33406. }
  33407. return ranges;
  33408. }
  33409. function createCmapTable(glyphs, toUnicodeExtraMap, numGlyphs) {
  33410. const ranges = getRanges(glyphs, toUnicodeExtraMap, numGlyphs);
  33411. const numTables = ranges.at(-1)[1] > 0xffff ? 2 : 1;
  33412. let cmap = "\x00\x00" + string16(numTables) + "\x00\x03" + "\x00\x01" + (0, _util.string32)(4 + numTables * 8);
  33413. let i, ii, j, jj;
  33414. for (i = ranges.length - 1; i >= 0; --i) {
  33415. if (ranges[i][0] <= 0xffff) {
  33416. break;
  33417. }
  33418. }
  33419. const bmpLength = i + 1;
  33420. if (ranges[i][0] < 0xffff && ranges[i][1] === 0xffff) {
  33421. ranges[i][1] = 0xfffe;
  33422. }
  33423. const trailingRangesCount = ranges[i][1] < 0xffff ? 1 : 0;
  33424. const segCount = bmpLength + trailingRangesCount;
  33425. const searchParams = _opentype_file_builder.OpenTypeFileBuilder.getSearchParams(segCount, 2);
  33426. let startCount = "";
  33427. let endCount = "";
  33428. let idDeltas = "";
  33429. let idRangeOffsets = "";
  33430. let glyphsIds = "";
  33431. let bias = 0;
  33432. let range, start, end, codes;
  33433. for (i = 0, ii = bmpLength; i < ii; i++) {
  33434. range = ranges[i];
  33435. start = range[0];
  33436. end = range[1];
  33437. startCount += string16(start);
  33438. endCount += string16(end);
  33439. codes = range[2];
  33440. let contiguous = true;
  33441. for (j = 1, jj = codes.length; j < jj; ++j) {
  33442. if (codes[j] !== codes[j - 1] + 1) {
  33443. contiguous = false;
  33444. break;
  33445. }
  33446. }
  33447. if (!contiguous) {
  33448. const offset = (segCount - i) * 2 + bias * 2;
  33449. bias += end - start + 1;
  33450. idDeltas += string16(0);
  33451. idRangeOffsets += string16(offset);
  33452. for (j = 0, jj = codes.length; j < jj; ++j) {
  33453. glyphsIds += string16(codes[j]);
  33454. }
  33455. } else {
  33456. const startCode = codes[0];
  33457. idDeltas += string16(startCode - start & 0xffff);
  33458. idRangeOffsets += string16(0);
  33459. }
  33460. }
  33461. if (trailingRangesCount > 0) {
  33462. endCount += "\xFF\xFF";
  33463. startCount += "\xFF\xFF";
  33464. idDeltas += "\x00\x01";
  33465. idRangeOffsets += "\x00\x00";
  33466. }
  33467. const format314 = "\x00\x00" + string16(2 * segCount) + string16(searchParams.range) + string16(searchParams.entry) + string16(searchParams.rangeShift) + endCount + "\x00\x00" + startCount + idDeltas + idRangeOffsets + glyphsIds;
  33468. let format31012 = "";
  33469. let header31012 = "";
  33470. if (numTables > 1) {
  33471. cmap += "\x00\x03" + "\x00\x0A" + (0, _util.string32)(4 + numTables * 8 + 4 + format314.length);
  33472. format31012 = "";
  33473. for (i = 0, ii = ranges.length; i < ii; i++) {
  33474. range = ranges[i];
  33475. start = range[0];
  33476. codes = range[2];
  33477. let code = codes[0];
  33478. for (j = 1, jj = codes.length; j < jj; ++j) {
  33479. if (codes[j] !== codes[j - 1] + 1) {
  33480. end = range[0] + j - 1;
  33481. format31012 += (0, _util.string32)(start) + (0, _util.string32)(end) + (0, _util.string32)(code);
  33482. start = end + 1;
  33483. code = codes[j];
  33484. }
  33485. }
  33486. format31012 += (0, _util.string32)(start) + (0, _util.string32)(range[1]) + (0, _util.string32)(code);
  33487. }
  33488. header31012 = "\x00\x0C" + "\x00\x00" + (0, _util.string32)(format31012.length + 16) + "\x00\x00\x00\x00" + (0, _util.string32)(format31012.length / 12);
  33489. }
  33490. return cmap + "\x00\x04" + string16(format314.length + 4) + format314 + header31012 + format31012;
  33491. }
  33492. function validateOS2Table(os2, file) {
  33493. file.pos = (file.start || 0) + os2.offset;
  33494. const version = file.getUint16();
  33495. file.skip(60);
  33496. const selection = file.getUint16();
  33497. if (version < 4 && selection & 0x0300) {
  33498. return false;
  33499. }
  33500. const firstChar = file.getUint16();
  33501. const lastChar = file.getUint16();
  33502. if (firstChar > lastChar) {
  33503. return false;
  33504. }
  33505. file.skip(6);
  33506. const usWinAscent = file.getUint16();
  33507. if (usWinAscent === 0) {
  33508. return false;
  33509. }
  33510. os2.data[8] = os2.data[9] = 0;
  33511. return true;
  33512. }
  33513. function createOS2Table(properties, charstrings, override) {
  33514. override = override || {
  33515. unitsPerEm: 0,
  33516. yMax: 0,
  33517. yMin: 0,
  33518. ascent: 0,
  33519. descent: 0
  33520. };
  33521. let ulUnicodeRange1 = 0;
  33522. let ulUnicodeRange2 = 0;
  33523. let ulUnicodeRange3 = 0;
  33524. let ulUnicodeRange4 = 0;
  33525. let firstCharIndex = null;
  33526. let lastCharIndex = 0;
  33527. if (charstrings) {
  33528. for (let code in charstrings) {
  33529. code |= 0;
  33530. if (firstCharIndex > code || !firstCharIndex) {
  33531. firstCharIndex = code;
  33532. }
  33533. if (lastCharIndex < code) {
  33534. lastCharIndex = code;
  33535. }
  33536. const position = (0, _unicode.getUnicodeRangeFor)(code);
  33537. if (position < 32) {
  33538. ulUnicodeRange1 |= 1 << position;
  33539. } else if (position < 64) {
  33540. ulUnicodeRange2 |= 1 << position - 32;
  33541. } else if (position < 96) {
  33542. ulUnicodeRange3 |= 1 << position - 64;
  33543. } else if (position < 123) {
  33544. ulUnicodeRange4 |= 1 << position - 96;
  33545. } else {
  33546. throw new _util.FormatError("Unicode ranges Bits > 123 are reserved for internal usage");
  33547. }
  33548. }
  33549. if (lastCharIndex > 0xffff) {
  33550. lastCharIndex = 0xffff;
  33551. }
  33552. } else {
  33553. firstCharIndex = 0;
  33554. lastCharIndex = 255;
  33555. }
  33556. const bbox = properties.bbox || [0, 0, 0, 0];
  33557. const unitsPerEm = override.unitsPerEm || 1 / (properties.fontMatrix || _util.FONT_IDENTITY_MATRIX)[0];
  33558. const scale = properties.ascentScaled ? 1.0 : unitsPerEm / PDF_GLYPH_SPACE_UNITS;
  33559. const typoAscent = override.ascent || Math.round(scale * (properties.ascent || bbox[3]));
  33560. let typoDescent = override.descent || Math.round(scale * (properties.descent || bbox[1]));
  33561. if (typoDescent > 0 && properties.descent > 0 && bbox[1] < 0) {
  33562. typoDescent = -typoDescent;
  33563. }
  33564. const winAscent = override.yMax || typoAscent;
  33565. const winDescent = -override.yMin || -typoDescent;
  33566. 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";
  33567. }
  33568. function createPostTable(properties) {
  33569. const angle = Math.floor(properties.italicAngle * 2 ** 16);
  33570. 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";
  33571. }
  33572. function createPostscriptName(name) {
  33573. return name.replace(/[^\x21-\x7E]|[[\](){}<>/%]/g, "").slice(0, 63);
  33574. }
  33575. function createNameTable(name, proto) {
  33576. if (!proto) {
  33577. proto = [[], []];
  33578. }
  33579. 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"];
  33580. const stringsUnicode = [];
  33581. let i, ii, j, jj, str;
  33582. for (i = 0, ii = strings.length; i < ii; i++) {
  33583. str = proto[1][i] || strings[i];
  33584. const strBufUnicode = [];
  33585. for (j = 0, jj = str.length; j < jj; j++) {
  33586. strBufUnicode.push(string16(str.charCodeAt(j)));
  33587. }
  33588. stringsUnicode.push(strBufUnicode.join(""));
  33589. }
  33590. const names = [strings, stringsUnicode];
  33591. const platforms = ["\x00\x01", "\x00\x03"];
  33592. const encodings = ["\x00\x00", "\x00\x01"];
  33593. const languages = ["\x00\x00", "\x04\x09"];
  33594. const namesRecordCount = strings.length * platforms.length;
  33595. let nameTable = "\x00\x00" + string16(namesRecordCount) + string16(namesRecordCount * 12 + 6);
  33596. let strOffset = 0;
  33597. for (i = 0, ii = platforms.length; i < ii; i++) {
  33598. const strs = names[i];
  33599. for (j = 0, jj = strs.length; j < jj; j++) {
  33600. str = strs[j];
  33601. const nameRecord = platforms[i] + encodings[i] + languages[i] + string16(j) + string16(str.length) + string16(strOffset);
  33602. nameTable += nameRecord;
  33603. strOffset += str.length;
  33604. }
  33605. }
  33606. nameTable += strings.join("") + stringsUnicode.join("");
  33607. return nameTable;
  33608. }
  33609. class Font {
  33610. constructor(name, file, properties) {
  33611. this.name = name;
  33612. this.psName = null;
  33613. this.mimetype = null;
  33614. this.disableFontFace = false;
  33615. this.loadedName = properties.loadedName;
  33616. this.isType3Font = properties.isType3Font;
  33617. this.missingFile = false;
  33618. this.cssFontInfo = properties.cssFontInfo;
  33619. this._charsCache = Object.create(null);
  33620. this._glyphCache = Object.create(null);
  33621. let isSerifFont = !!(properties.flags & _fonts_utils.FontFlags.Serif);
  33622. if (!isSerifFont && !properties.isSimulatedFlags) {
  33623. const baseName = name.replace(/[,_]/g, "-").split("-")[0],
  33624. serifFonts = (0, _standard_fonts.getSerifFonts)();
  33625. for (const namePart of baseName.split("+")) {
  33626. if (serifFonts[namePart]) {
  33627. isSerifFont = true;
  33628. break;
  33629. }
  33630. }
  33631. }
  33632. this.isSerifFont = isSerifFont;
  33633. this.isSymbolicFont = !!(properties.flags & _fonts_utils.FontFlags.Symbolic);
  33634. this.isMonospace = !!(properties.flags & _fonts_utils.FontFlags.FixedPitch);
  33635. let type = properties.type;
  33636. let subtype = properties.subtype;
  33637. this.type = type;
  33638. this.subtype = subtype;
  33639. let fallbackName = "sans-serif";
  33640. if (this.isMonospace) {
  33641. fallbackName = "monospace";
  33642. } else if (this.isSerifFont) {
  33643. fallbackName = "serif";
  33644. }
  33645. this.fallbackName = fallbackName;
  33646. this.differences = properties.differences;
  33647. this.widths = properties.widths;
  33648. this.defaultWidth = properties.defaultWidth;
  33649. this.composite = properties.composite;
  33650. this.cMap = properties.cMap;
  33651. this.capHeight = properties.capHeight / PDF_GLYPH_SPACE_UNITS;
  33652. this.ascent = properties.ascent / PDF_GLYPH_SPACE_UNITS;
  33653. this.descent = properties.descent / PDF_GLYPH_SPACE_UNITS;
  33654. this.lineHeight = this.ascent - this.descent;
  33655. this.fontMatrix = properties.fontMatrix;
  33656. this.bbox = properties.bbox;
  33657. this.defaultEncoding = properties.defaultEncoding;
  33658. this.toUnicode = properties.toUnicode;
  33659. this.toFontChar = [];
  33660. if (properties.type === "Type3") {
  33661. for (let charCode = 0; charCode < 256; charCode++) {
  33662. this.toFontChar[charCode] = this.differences[charCode] || properties.defaultEncoding[charCode];
  33663. }
  33664. this.fontType = _util.FontType.TYPE3;
  33665. return;
  33666. }
  33667. this.cidEncoding = properties.cidEncoding || "";
  33668. this.vertical = !!properties.vertical;
  33669. if (this.vertical) {
  33670. this.vmetrics = properties.vmetrics;
  33671. this.defaultVMetrics = properties.defaultVMetrics;
  33672. }
  33673. if (!file || file.isEmpty) {
  33674. if (file) {
  33675. (0, _util.warn)('Font file is empty in "' + name + '" (' + this.loadedName + ")");
  33676. }
  33677. this.fallbackToSystemFont(properties);
  33678. return;
  33679. }
  33680. [type, subtype] = getFontFileType(file, properties);
  33681. if (type !== this.type || subtype !== this.subtype) {
  33682. (0, _util.info)("Inconsistent font file Type/SubType, expected: " + `${this.type}/${this.subtype} but found: ${type}/${subtype}.`);
  33683. }
  33684. let data;
  33685. try {
  33686. switch (type) {
  33687. case "MMType1":
  33688. (0, _util.info)("MMType1 font (" + name + "), falling back to Type1.");
  33689. case "Type1":
  33690. case "CIDFontType0":
  33691. this.mimetype = "font/opentype";
  33692. const cff = subtype === "Type1C" || subtype === "CIDFontType0C" ? new _cff_font.CFFFont(file, properties) : new _type1_font.Type1Font(name, file, properties);
  33693. adjustWidths(properties);
  33694. data = this.convert(name, cff, properties);
  33695. break;
  33696. case "OpenType":
  33697. case "TrueType":
  33698. case "CIDFontType2":
  33699. this.mimetype = "font/opentype";
  33700. data = this.checkAndRepair(name, file, properties);
  33701. if (this.isOpenType) {
  33702. adjustWidths(properties);
  33703. type = "OpenType";
  33704. }
  33705. break;
  33706. default:
  33707. throw new _util.FormatError(`Font ${type} is not supported`);
  33708. }
  33709. } catch (e) {
  33710. (0, _util.warn)(e);
  33711. this.fallbackToSystemFont(properties);
  33712. return;
  33713. }
  33714. amendFallbackToUnicode(properties);
  33715. this.data = data;
  33716. this.fontType = (0, _fonts_utils.getFontType)(type, subtype, properties.isStandardFont);
  33717. this.fontMatrix = properties.fontMatrix;
  33718. this.widths = properties.widths;
  33719. this.defaultWidth = properties.defaultWidth;
  33720. this.toUnicode = properties.toUnicode;
  33721. this.seacMap = properties.seacMap;
  33722. }
  33723. get renderer() {
  33724. const renderer = _font_renderer.FontRendererFactory.create(this, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  33725. return (0, _util.shadow)(this, "renderer", renderer);
  33726. }
  33727. exportData(extraProperties = false) {
  33728. const exportDataProperties = extraProperties ? [...EXPORT_DATA_PROPERTIES, ...EXPORT_DATA_EXTRA_PROPERTIES] : EXPORT_DATA_PROPERTIES;
  33729. const data = Object.create(null);
  33730. let property, value;
  33731. for (property of exportDataProperties) {
  33732. value = this[property];
  33733. if (value !== undefined) {
  33734. data[property] = value;
  33735. }
  33736. }
  33737. return data;
  33738. }
  33739. fallbackToSystemFont(properties) {
  33740. this.missingFile = true;
  33741. const name = this.name;
  33742. const type = this.type;
  33743. const subtype = this.subtype;
  33744. let fontName = (0, _fonts_utils.normalizeFontName)(name);
  33745. const stdFontMap = (0, _standard_fonts.getStdFontMap)(),
  33746. nonStdFontMap = (0, _standard_fonts.getNonStdFontMap)();
  33747. const isStandardFont = !!stdFontMap[fontName];
  33748. const isMappedToStandardFont = !!(nonStdFontMap[fontName] && stdFontMap[nonStdFontMap[fontName]]);
  33749. fontName = stdFontMap[fontName] || nonStdFontMap[fontName] || fontName;
  33750. const fontBasicMetricsMap = (0, _metrics.getFontBasicMetrics)();
  33751. const metrics = fontBasicMetricsMap[fontName];
  33752. if (metrics) {
  33753. if (isNaN(this.ascent)) {
  33754. this.ascent = metrics.ascent / PDF_GLYPH_SPACE_UNITS;
  33755. }
  33756. if (isNaN(this.descent)) {
  33757. this.descent = metrics.descent / PDF_GLYPH_SPACE_UNITS;
  33758. }
  33759. if (isNaN(this.capHeight)) {
  33760. this.capHeight = metrics.capHeight / PDF_GLYPH_SPACE_UNITS;
  33761. }
  33762. }
  33763. this.bold = fontName.search(/bold/gi) !== -1;
  33764. this.italic = fontName.search(/oblique/gi) !== -1 || fontName.search(/italic/gi) !== -1;
  33765. this.black = name.search(/Black/g) !== -1;
  33766. const isNarrow = name.search(/Narrow/g) !== -1;
  33767. this.remeasure = (!isStandardFont || isNarrow) && Object.keys(this.widths).length > 0;
  33768. if ((isStandardFont || isMappedToStandardFont) && type === "CIDFontType2" && this.cidEncoding.startsWith("Identity-")) {
  33769. const cidToGidMap = properties.cidToGidMap;
  33770. const map = [];
  33771. applyStandardFontGlyphMap(map, (0, _standard_fonts.getGlyphMapForStandardFonts)());
  33772. if (/Arial-?Black/i.test(name)) {
  33773. applyStandardFontGlyphMap(map, (0, _standard_fonts.getSupplementalGlyphMapForArialBlack)());
  33774. } else if (/Calibri/i.test(name)) {
  33775. applyStandardFontGlyphMap(map, (0, _standard_fonts.getSupplementalGlyphMapForCalibri)());
  33776. }
  33777. if (cidToGidMap) {
  33778. for (const charCode in map) {
  33779. const cid = map[charCode];
  33780. if (cidToGidMap[cid] !== undefined) {
  33781. map[+charCode] = cidToGidMap[cid];
  33782. }
  33783. }
  33784. if (cidToGidMap.length !== this.toUnicode.length && properties.hasIncludedToUnicodeMap && this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
  33785. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  33786. const cid = map[charCode];
  33787. if (cidToGidMap[cid] === undefined) {
  33788. map[+charCode] = unicodeCharCode;
  33789. }
  33790. });
  33791. }
  33792. }
  33793. if (!(this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap)) {
  33794. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  33795. map[+charCode] = unicodeCharCode;
  33796. });
  33797. }
  33798. this.toFontChar = map;
  33799. this.toUnicode = new _to_unicode_map.ToUnicodeMap(map);
  33800. } else if (/Symbol/i.test(fontName)) {
  33801. this.toFontChar = buildToFontChar(_encodings.SymbolSetEncoding, (0, _glyphlist.getGlyphsUnicode)(), this.differences);
  33802. } else if (/Dingbats/i.test(fontName)) {
  33803. if (/Wingdings/i.test(name)) {
  33804. (0, _util.warn)("Non-embedded Wingdings font, falling back to ZapfDingbats.");
  33805. }
  33806. this.toFontChar = buildToFontChar(_encodings.ZapfDingbatsEncoding, (0, _glyphlist.getDingbatsGlyphsUnicode)(), this.differences);
  33807. } else if (isStandardFont) {
  33808. const map = buildToFontChar(this.defaultEncoding, (0, _glyphlist.getGlyphsUnicode)(), this.differences);
  33809. if (type === "CIDFontType2" && !this.cidEncoding.startsWith("Identity-") && !(this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap)) {
  33810. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  33811. map[+charCode] = unicodeCharCode;
  33812. });
  33813. }
  33814. this.toFontChar = map;
  33815. } else {
  33816. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  33817. const map = [];
  33818. this.toUnicode.forEach((charCode, unicodeCharCode) => {
  33819. if (!this.composite) {
  33820. const glyphName = this.differences[charCode] || this.defaultEncoding[charCode];
  33821. const unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
  33822. if (unicode !== -1) {
  33823. unicodeCharCode = unicode;
  33824. }
  33825. }
  33826. map[+charCode] = unicodeCharCode;
  33827. });
  33828. if (this.composite && this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
  33829. if (/Verdana/i.test(name)) {
  33830. applyStandardFontGlyphMap(map, (0, _standard_fonts.getGlyphMapForStandardFonts)());
  33831. }
  33832. }
  33833. this.toFontChar = map;
  33834. }
  33835. amendFallbackToUnicode(properties);
  33836. this.loadedName = fontName.split("-")[0];
  33837. this.fontType = (0, _fonts_utils.getFontType)(type, subtype, properties.isStandardFont);
  33838. }
  33839. checkAndRepair(name, font, properties) {
  33840. const VALID_TABLES = ["OS/2", "cmap", "head", "hhea", "hmtx", "maxp", "name", "post", "loca", "glyf", "fpgm", "prep", "cvt ", "CFF "];
  33841. function readTables(file, numTables) {
  33842. const tables = Object.create(null);
  33843. tables["OS/2"] = null;
  33844. tables.cmap = null;
  33845. tables.head = null;
  33846. tables.hhea = null;
  33847. tables.hmtx = null;
  33848. tables.maxp = null;
  33849. tables.name = null;
  33850. tables.post = null;
  33851. for (let i = 0; i < numTables; i++) {
  33852. const table = readTableEntry(file);
  33853. if (!VALID_TABLES.includes(table.tag)) {
  33854. continue;
  33855. }
  33856. if (table.length === 0) {
  33857. continue;
  33858. }
  33859. tables[table.tag] = table;
  33860. }
  33861. return tables;
  33862. }
  33863. function readTableEntry(file) {
  33864. const tag = file.getString(4);
  33865. const checksum = file.getInt32() >>> 0;
  33866. const offset = file.getInt32() >>> 0;
  33867. const length = file.getInt32() >>> 0;
  33868. const previousPosition = file.pos;
  33869. file.pos = file.start || 0;
  33870. file.skip(offset);
  33871. const data = file.getBytes(length);
  33872. file.pos = previousPosition;
  33873. if (tag === "head") {
  33874. data[8] = data[9] = data[10] = data[11] = 0;
  33875. data[17] |= 0x20;
  33876. }
  33877. return {
  33878. tag,
  33879. checksum,
  33880. length,
  33881. offset,
  33882. data
  33883. };
  33884. }
  33885. function readOpenTypeHeader(ttf) {
  33886. return {
  33887. version: ttf.getString(4),
  33888. numTables: ttf.getUint16(),
  33889. searchRange: ttf.getUint16(),
  33890. entrySelector: ttf.getUint16(),
  33891. rangeShift: ttf.getUint16()
  33892. };
  33893. }
  33894. function readTrueTypeCollectionHeader(ttc) {
  33895. const ttcTag = ttc.getString(4);
  33896. (0, _util.assert)(ttcTag === "ttcf", "Must be a TrueType Collection font.");
  33897. const majorVersion = ttc.getUint16();
  33898. const minorVersion = ttc.getUint16();
  33899. const numFonts = ttc.getInt32() >>> 0;
  33900. const offsetTable = [];
  33901. for (let i = 0; i < numFonts; i++) {
  33902. offsetTable.push(ttc.getInt32() >>> 0);
  33903. }
  33904. const header = {
  33905. ttcTag,
  33906. majorVersion,
  33907. minorVersion,
  33908. numFonts,
  33909. offsetTable
  33910. };
  33911. switch (majorVersion) {
  33912. case 1:
  33913. return header;
  33914. case 2:
  33915. header.dsigTag = ttc.getInt32() >>> 0;
  33916. header.dsigLength = ttc.getInt32() >>> 0;
  33917. header.dsigOffset = ttc.getInt32() >>> 0;
  33918. return header;
  33919. }
  33920. throw new _util.FormatError(`Invalid TrueType Collection majorVersion: ${majorVersion}.`);
  33921. }
  33922. function readTrueTypeCollectionData(ttc, fontName) {
  33923. const {
  33924. numFonts,
  33925. offsetTable
  33926. } = readTrueTypeCollectionHeader(ttc);
  33927. const fontNameParts = fontName.split("+");
  33928. let fallbackData;
  33929. for (let i = 0; i < numFonts; i++) {
  33930. ttc.pos = (ttc.start || 0) + offsetTable[i];
  33931. const potentialHeader = readOpenTypeHeader(ttc);
  33932. const potentialTables = readTables(ttc, potentialHeader.numTables);
  33933. if (!potentialTables.name) {
  33934. throw new _util.FormatError('TrueType Collection font must contain a "name" table.');
  33935. }
  33936. const nameTable = readNameTable(potentialTables.name);
  33937. for (let j = 0, jj = nameTable.length; j < jj; j++) {
  33938. for (let k = 0, kk = nameTable[j].length; k < kk; k++) {
  33939. const nameEntry = nameTable[j][k] && nameTable[j][k].replace(/\s/g, "");
  33940. if (!nameEntry) {
  33941. continue;
  33942. }
  33943. if (nameEntry === fontName) {
  33944. return {
  33945. header: potentialHeader,
  33946. tables: potentialTables
  33947. };
  33948. }
  33949. if (fontNameParts.length < 2) {
  33950. continue;
  33951. }
  33952. for (const part of fontNameParts) {
  33953. if (nameEntry === part) {
  33954. fallbackData = {
  33955. name: part,
  33956. header: potentialHeader,
  33957. tables: potentialTables
  33958. };
  33959. }
  33960. }
  33961. }
  33962. }
  33963. }
  33964. if (fallbackData) {
  33965. (0, _util.warn)(`TrueType Collection does not contain "${fontName}" font, ` + `falling back to "${fallbackData.name}" font instead.`);
  33966. return {
  33967. header: fallbackData.header,
  33968. tables: fallbackData.tables
  33969. };
  33970. }
  33971. throw new _util.FormatError(`TrueType Collection does not contain "${fontName}" font.`);
  33972. }
  33973. function readCmapTable(cmap, file, isSymbolicFont, hasEncoding) {
  33974. if (!cmap) {
  33975. (0, _util.warn)("No cmap table available.");
  33976. return {
  33977. platformId: -1,
  33978. encodingId: -1,
  33979. mappings: [],
  33980. hasShortCmap: false
  33981. };
  33982. }
  33983. let segment;
  33984. let start = (file.start || 0) + cmap.offset;
  33985. file.pos = start;
  33986. file.skip(2);
  33987. const numTables = file.getUint16();
  33988. let potentialTable;
  33989. let canBreak = false;
  33990. for (let i = 0; i < numTables; i++) {
  33991. const platformId = file.getUint16();
  33992. const encodingId = file.getUint16();
  33993. const offset = file.getInt32() >>> 0;
  33994. let useTable = false;
  33995. if (potentialTable && potentialTable.platformId === platformId && potentialTable.encodingId === encodingId) {
  33996. continue;
  33997. }
  33998. if (platformId === 0 && (encodingId === 0 || encodingId === 1 || encodingId === 3)) {
  33999. useTable = true;
  34000. } else if (platformId === 1 && encodingId === 0) {
  34001. useTable = true;
  34002. } else if (platformId === 3 && encodingId === 1 && (hasEncoding || !potentialTable)) {
  34003. useTable = true;
  34004. if (!isSymbolicFont) {
  34005. canBreak = true;
  34006. }
  34007. } else if (isSymbolicFont && platformId === 3 && encodingId === 0) {
  34008. useTable = true;
  34009. let correctlySorted = true;
  34010. if (i < numTables - 1) {
  34011. const nextBytes = file.peekBytes(2),
  34012. nextPlatformId = int16(nextBytes[0], nextBytes[1]);
  34013. if (nextPlatformId < platformId) {
  34014. correctlySorted = false;
  34015. }
  34016. }
  34017. if (correctlySorted) {
  34018. canBreak = true;
  34019. }
  34020. }
  34021. if (useTable) {
  34022. potentialTable = {
  34023. platformId,
  34024. encodingId,
  34025. offset
  34026. };
  34027. }
  34028. if (canBreak) {
  34029. break;
  34030. }
  34031. }
  34032. if (potentialTable) {
  34033. file.pos = start + potentialTable.offset;
  34034. }
  34035. if (!potentialTable || file.peekByte() === -1) {
  34036. (0, _util.warn)("Could not find a preferred cmap table.");
  34037. return {
  34038. platformId: -1,
  34039. encodingId: -1,
  34040. mappings: [],
  34041. hasShortCmap: false
  34042. };
  34043. }
  34044. const format = file.getUint16();
  34045. let hasShortCmap = false;
  34046. const mappings = [];
  34047. let j, glyphId;
  34048. if (format === 0) {
  34049. file.skip(2 + 2);
  34050. for (j = 0; j < 256; j++) {
  34051. const index = file.getByte();
  34052. if (!index) {
  34053. continue;
  34054. }
  34055. mappings.push({
  34056. charCode: j,
  34057. glyphId: index
  34058. });
  34059. }
  34060. hasShortCmap = true;
  34061. } else if (format === 2) {
  34062. file.skip(2 + 2);
  34063. const subHeaderKeys = [];
  34064. let maxSubHeaderKey = 0;
  34065. for (let i = 0; i < 256; i++) {
  34066. const subHeaderKey = file.getUint16() >> 3;
  34067. subHeaderKeys.push(subHeaderKey);
  34068. maxSubHeaderKey = Math.max(subHeaderKey, maxSubHeaderKey);
  34069. }
  34070. const subHeaders = [];
  34071. for (let i = 0; i <= maxSubHeaderKey; i++) {
  34072. subHeaders.push({
  34073. firstCode: file.getUint16(),
  34074. entryCount: file.getUint16(),
  34075. idDelta: signedInt16(file.getByte(), file.getByte()),
  34076. idRangePos: file.pos + file.getUint16()
  34077. });
  34078. }
  34079. for (let i = 0; i < 256; i++) {
  34080. if (subHeaderKeys[i] === 0) {
  34081. file.pos = subHeaders[0].idRangePos + 2 * i;
  34082. glyphId = file.getUint16();
  34083. mappings.push({
  34084. charCode: i,
  34085. glyphId
  34086. });
  34087. } else {
  34088. const s = subHeaders[subHeaderKeys[i]];
  34089. for (j = 0; j < s.entryCount; j++) {
  34090. const charCode = (i << 8) + j + s.firstCode;
  34091. file.pos = s.idRangePos + 2 * j;
  34092. glyphId = file.getUint16();
  34093. if (glyphId !== 0) {
  34094. glyphId = (glyphId + s.idDelta) % 65536;
  34095. }
  34096. mappings.push({
  34097. charCode,
  34098. glyphId
  34099. });
  34100. }
  34101. }
  34102. }
  34103. } else if (format === 4) {
  34104. file.skip(2 + 2);
  34105. const segCount = file.getUint16() >> 1;
  34106. file.skip(6);
  34107. const segments = [];
  34108. let segIndex;
  34109. for (segIndex = 0; segIndex < segCount; segIndex++) {
  34110. segments.push({
  34111. end: file.getUint16()
  34112. });
  34113. }
  34114. file.skip(2);
  34115. for (segIndex = 0; segIndex < segCount; segIndex++) {
  34116. segments[segIndex].start = file.getUint16();
  34117. }
  34118. for (segIndex = 0; segIndex < segCount; segIndex++) {
  34119. segments[segIndex].delta = file.getUint16();
  34120. }
  34121. let offsetsCount = 0,
  34122. offsetIndex;
  34123. for (segIndex = 0; segIndex < segCount; segIndex++) {
  34124. segment = segments[segIndex];
  34125. const rangeOffset = file.getUint16();
  34126. if (!rangeOffset) {
  34127. segment.offsetIndex = -1;
  34128. continue;
  34129. }
  34130. offsetIndex = (rangeOffset >> 1) - (segCount - segIndex);
  34131. segment.offsetIndex = offsetIndex;
  34132. offsetsCount = Math.max(offsetsCount, offsetIndex + segment.end - segment.start + 1);
  34133. }
  34134. const offsets = [];
  34135. for (j = 0; j < offsetsCount; j++) {
  34136. offsets.push(file.getUint16());
  34137. }
  34138. for (segIndex = 0; segIndex < segCount; segIndex++) {
  34139. segment = segments[segIndex];
  34140. start = segment.start;
  34141. const end = segment.end;
  34142. const delta = segment.delta;
  34143. offsetIndex = segment.offsetIndex;
  34144. for (j = start; j <= end; j++) {
  34145. if (j === 0xffff) {
  34146. continue;
  34147. }
  34148. glyphId = offsetIndex < 0 ? j : offsets[offsetIndex + j - start];
  34149. glyphId = glyphId + delta & 0xffff;
  34150. mappings.push({
  34151. charCode: j,
  34152. glyphId
  34153. });
  34154. }
  34155. }
  34156. } else if (format === 6) {
  34157. file.skip(2 + 2);
  34158. const firstCode = file.getUint16();
  34159. const entryCount = file.getUint16();
  34160. for (j = 0; j < entryCount; j++) {
  34161. glyphId = file.getUint16();
  34162. const charCode = firstCode + j;
  34163. mappings.push({
  34164. charCode,
  34165. glyphId
  34166. });
  34167. }
  34168. } else if (format === 12) {
  34169. file.skip(2 + 4 + 4);
  34170. const nGroups = file.getInt32() >>> 0;
  34171. for (j = 0; j < nGroups; j++) {
  34172. const startCharCode = file.getInt32() >>> 0;
  34173. const endCharCode = file.getInt32() >>> 0;
  34174. let glyphCode = file.getInt32() >>> 0;
  34175. for (let charCode = startCharCode; charCode <= endCharCode; charCode++) {
  34176. mappings.push({
  34177. charCode,
  34178. glyphId: glyphCode++
  34179. });
  34180. }
  34181. }
  34182. } else {
  34183. (0, _util.warn)("cmap table has unsupported format: " + format);
  34184. return {
  34185. platformId: -1,
  34186. encodingId: -1,
  34187. mappings: [],
  34188. hasShortCmap: false
  34189. };
  34190. }
  34191. mappings.sort(function (a, b) {
  34192. return a.charCode - b.charCode;
  34193. });
  34194. for (let i = 1; i < mappings.length; i++) {
  34195. if (mappings[i - 1].charCode === mappings[i].charCode) {
  34196. mappings.splice(i, 1);
  34197. i--;
  34198. }
  34199. }
  34200. return {
  34201. platformId: potentialTable.platformId,
  34202. encodingId: potentialTable.encodingId,
  34203. mappings,
  34204. hasShortCmap
  34205. };
  34206. }
  34207. function sanitizeMetrics(file, header, metrics, headTable, numGlyphs, dupFirstEntry) {
  34208. if (!header) {
  34209. if (metrics) {
  34210. metrics.data = null;
  34211. }
  34212. return;
  34213. }
  34214. file.pos = (file.start || 0) + header.offset;
  34215. file.pos += 4;
  34216. file.pos += 2;
  34217. file.pos += 2;
  34218. file.pos += 2;
  34219. file.pos += 2;
  34220. file.pos += 2;
  34221. file.pos += 2;
  34222. file.pos += 2;
  34223. file.pos += 2;
  34224. file.pos += 2;
  34225. const caretOffset = file.getUint16();
  34226. file.pos += 8;
  34227. file.pos += 2;
  34228. let numOfMetrics = file.getUint16();
  34229. if (caretOffset !== 0) {
  34230. const macStyle = int16(headTable.data[44], headTable.data[45]);
  34231. if (!(macStyle & 2)) {
  34232. header.data[22] = 0;
  34233. header.data[23] = 0;
  34234. }
  34235. }
  34236. if (numOfMetrics > numGlyphs) {
  34237. (0, _util.info)(`The numOfMetrics (${numOfMetrics}) should not be ` + `greater than the numGlyphs (${numGlyphs}).`);
  34238. numOfMetrics = numGlyphs;
  34239. header.data[34] = (numOfMetrics & 0xff00) >> 8;
  34240. header.data[35] = numOfMetrics & 0x00ff;
  34241. }
  34242. const numOfSidebearings = numGlyphs - numOfMetrics;
  34243. const numMissing = numOfSidebearings - (metrics.length - numOfMetrics * 4 >> 1);
  34244. if (numMissing > 0) {
  34245. const entries = new Uint8Array(metrics.length + numMissing * 2);
  34246. entries.set(metrics.data);
  34247. if (dupFirstEntry) {
  34248. entries[metrics.length] = metrics.data[2];
  34249. entries[metrics.length + 1] = metrics.data[3];
  34250. }
  34251. metrics.data = entries;
  34252. }
  34253. }
  34254. function sanitizeGlyph(source, sourceStart, sourceEnd, dest, destStart, hintsValid) {
  34255. const glyphProfile = {
  34256. length: 0,
  34257. sizeOfInstructions: 0
  34258. };
  34259. if (sourceEnd - sourceStart <= 12) {
  34260. return glyphProfile;
  34261. }
  34262. const glyf = source.subarray(sourceStart, sourceEnd);
  34263. let contoursCount = signedInt16(glyf[0], glyf[1]);
  34264. if (contoursCount < 0) {
  34265. contoursCount = -1;
  34266. writeSignedInt16(glyf, 0, contoursCount);
  34267. dest.set(glyf, destStart);
  34268. glyphProfile.length = glyf.length;
  34269. return glyphProfile;
  34270. }
  34271. let i,
  34272. j = 10,
  34273. flagsCount = 0;
  34274. for (i = 0; i < contoursCount; i++) {
  34275. const endPoint = glyf[j] << 8 | glyf[j + 1];
  34276. flagsCount = endPoint + 1;
  34277. j += 2;
  34278. }
  34279. const instructionsStart = j;
  34280. const instructionsLength = glyf[j] << 8 | glyf[j + 1];
  34281. glyphProfile.sizeOfInstructions = instructionsLength;
  34282. j += 2 + instructionsLength;
  34283. const instructionsEnd = j;
  34284. let coordinatesLength = 0;
  34285. for (i = 0; i < flagsCount; i++) {
  34286. const flag = glyf[j++];
  34287. if (flag & 0xc0) {
  34288. glyf[j - 1] = flag & 0x3f;
  34289. }
  34290. let xLength = 2;
  34291. if (flag & 2) {
  34292. xLength = 1;
  34293. } else if (flag & 16) {
  34294. xLength = 0;
  34295. }
  34296. let yLength = 2;
  34297. if (flag & 4) {
  34298. yLength = 1;
  34299. } else if (flag & 32) {
  34300. yLength = 0;
  34301. }
  34302. const xyLength = xLength + yLength;
  34303. coordinatesLength += xyLength;
  34304. if (flag & 8) {
  34305. const repeat = glyf[j++];
  34306. i += repeat;
  34307. coordinatesLength += repeat * xyLength;
  34308. }
  34309. }
  34310. if (coordinatesLength === 0) {
  34311. return glyphProfile;
  34312. }
  34313. let glyphDataLength = j + coordinatesLength;
  34314. if (glyphDataLength > glyf.length) {
  34315. return glyphProfile;
  34316. }
  34317. if (!hintsValid && instructionsLength > 0) {
  34318. dest.set(glyf.subarray(0, instructionsStart), destStart);
  34319. dest.set([0, 0], destStart + instructionsStart);
  34320. dest.set(glyf.subarray(instructionsEnd, glyphDataLength), destStart + instructionsStart + 2);
  34321. glyphDataLength -= instructionsLength;
  34322. if (glyf.length - glyphDataLength > 3) {
  34323. glyphDataLength = glyphDataLength + 3 & ~3;
  34324. }
  34325. glyphProfile.length = glyphDataLength;
  34326. return glyphProfile;
  34327. }
  34328. if (glyf.length - glyphDataLength > 3) {
  34329. glyphDataLength = glyphDataLength + 3 & ~3;
  34330. dest.set(glyf.subarray(0, glyphDataLength), destStart);
  34331. glyphProfile.length = glyphDataLength;
  34332. return glyphProfile;
  34333. }
  34334. dest.set(glyf, destStart);
  34335. glyphProfile.length = glyf.length;
  34336. return glyphProfile;
  34337. }
  34338. function sanitizeHead(head, numGlyphs, locaLength) {
  34339. const data = head.data;
  34340. const version = int32(data[0], data[1], data[2], data[3]);
  34341. if (version >> 16 !== 1) {
  34342. (0, _util.info)("Attempting to fix invalid version in head table: " + version);
  34343. data[0] = 0;
  34344. data[1] = 1;
  34345. data[2] = 0;
  34346. data[3] = 0;
  34347. }
  34348. const indexToLocFormat = int16(data[50], data[51]);
  34349. if (indexToLocFormat < 0 || indexToLocFormat > 1) {
  34350. (0, _util.info)("Attempting to fix invalid indexToLocFormat in head table: " + indexToLocFormat);
  34351. const numGlyphsPlusOne = numGlyphs + 1;
  34352. if (locaLength === numGlyphsPlusOne << 1) {
  34353. data[50] = 0;
  34354. data[51] = 0;
  34355. } else if (locaLength === numGlyphsPlusOne << 2) {
  34356. data[50] = 0;
  34357. data[51] = 1;
  34358. } else {
  34359. throw new _util.FormatError("Could not fix indexToLocFormat: " + indexToLocFormat);
  34360. }
  34361. }
  34362. }
  34363. function sanitizeGlyphLocations(loca, glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry, maxSizeOfInstructions) {
  34364. let itemSize, itemDecode, itemEncode;
  34365. if (isGlyphLocationsLong) {
  34366. itemSize = 4;
  34367. itemDecode = function fontItemDecodeLong(data, offset) {
  34368. return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
  34369. };
  34370. itemEncode = function fontItemEncodeLong(data, offset, value) {
  34371. data[offset] = value >>> 24 & 0xff;
  34372. data[offset + 1] = value >> 16 & 0xff;
  34373. data[offset + 2] = value >> 8 & 0xff;
  34374. data[offset + 3] = value & 0xff;
  34375. };
  34376. } else {
  34377. itemSize = 2;
  34378. itemDecode = function fontItemDecode(data, offset) {
  34379. return data[offset] << 9 | data[offset + 1] << 1;
  34380. };
  34381. itemEncode = function fontItemEncode(data, offset, value) {
  34382. data[offset] = value >> 9 & 0xff;
  34383. data[offset + 1] = value >> 1 & 0xff;
  34384. };
  34385. }
  34386. const numGlyphsOut = dupFirstEntry ? numGlyphs + 1 : numGlyphs;
  34387. const locaDataSize = itemSize * (1 + numGlyphsOut);
  34388. const locaData = new Uint8Array(locaDataSize);
  34389. locaData.set(loca.data.subarray(0, locaDataSize));
  34390. loca.data = locaData;
  34391. const oldGlyfData = glyf.data;
  34392. const oldGlyfDataLength = oldGlyfData.length;
  34393. const newGlyfData = new Uint8Array(oldGlyfDataLength);
  34394. let i, j;
  34395. const locaEntries = [];
  34396. for (i = 0, j = 0; i < numGlyphs + 1; i++, j += itemSize) {
  34397. let offset = itemDecode(locaData, j);
  34398. if (offset > oldGlyfDataLength) {
  34399. offset = oldGlyfDataLength;
  34400. }
  34401. locaEntries.push({
  34402. index: i,
  34403. offset,
  34404. endOffset: 0
  34405. });
  34406. }
  34407. locaEntries.sort((a, b) => {
  34408. return a.offset - b.offset;
  34409. });
  34410. for (i = 0; i < numGlyphs; i++) {
  34411. locaEntries[i].endOffset = locaEntries[i + 1].offset;
  34412. }
  34413. locaEntries.sort((a, b) => {
  34414. return a.index - b.index;
  34415. });
  34416. for (i = 0; i < numGlyphs; i++) {
  34417. const {
  34418. offset,
  34419. endOffset
  34420. } = locaEntries[i];
  34421. if (offset !== 0 || endOffset !== 0) {
  34422. break;
  34423. }
  34424. const nextOffset = locaEntries[i + 1].offset;
  34425. if (nextOffset === 0) {
  34426. continue;
  34427. }
  34428. locaEntries[i].endOffset = nextOffset;
  34429. break;
  34430. }
  34431. const missingGlyphs = Object.create(null);
  34432. let writeOffset = 0;
  34433. itemEncode(locaData, 0, writeOffset);
  34434. for (i = 0, j = itemSize; i < numGlyphs; i++, j += itemSize) {
  34435. const glyphProfile = sanitizeGlyph(oldGlyfData, locaEntries[i].offset, locaEntries[i].endOffset, newGlyfData, writeOffset, hintsValid);
  34436. const newLength = glyphProfile.length;
  34437. if (newLength === 0) {
  34438. missingGlyphs[i] = true;
  34439. }
  34440. if (glyphProfile.sizeOfInstructions > maxSizeOfInstructions) {
  34441. maxSizeOfInstructions = glyphProfile.sizeOfInstructions;
  34442. }
  34443. writeOffset += newLength;
  34444. itemEncode(locaData, j, writeOffset);
  34445. }
  34446. if (writeOffset === 0) {
  34447. const simpleGlyph = new Uint8Array([0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 49, 0]);
  34448. for (i = 0, j = itemSize; i < numGlyphsOut; i++, j += itemSize) {
  34449. itemEncode(locaData, j, simpleGlyph.length);
  34450. }
  34451. glyf.data = simpleGlyph;
  34452. } else if (dupFirstEntry) {
  34453. const firstEntryLength = itemDecode(locaData, itemSize);
  34454. if (newGlyfData.length > firstEntryLength + writeOffset) {
  34455. glyf.data = newGlyfData.subarray(0, firstEntryLength + writeOffset);
  34456. } else {
  34457. glyf.data = new Uint8Array(firstEntryLength + writeOffset);
  34458. glyf.data.set(newGlyfData.subarray(0, writeOffset));
  34459. }
  34460. glyf.data.set(newGlyfData.subarray(0, firstEntryLength), writeOffset);
  34461. itemEncode(loca.data, locaData.length - itemSize, writeOffset + firstEntryLength);
  34462. } else {
  34463. glyf.data = newGlyfData.subarray(0, writeOffset);
  34464. }
  34465. return {
  34466. missingGlyphs,
  34467. maxSizeOfInstructions
  34468. };
  34469. }
  34470. function readPostScriptTable(post, propertiesObj, maxpNumGlyphs) {
  34471. const start = (font.start || 0) + post.offset;
  34472. font.pos = start;
  34473. const length = post.length,
  34474. end = start + length;
  34475. const version = font.getInt32();
  34476. font.skip(28);
  34477. let glyphNames;
  34478. let valid = true;
  34479. let i;
  34480. switch (version) {
  34481. case 0x00010000:
  34482. glyphNames = _fonts_utils.MacStandardGlyphOrdering;
  34483. break;
  34484. case 0x00020000:
  34485. const numGlyphs = font.getUint16();
  34486. if (numGlyphs !== maxpNumGlyphs) {
  34487. valid = false;
  34488. break;
  34489. }
  34490. const glyphNameIndexes = [];
  34491. for (i = 0; i < numGlyphs; ++i) {
  34492. const index = font.getUint16();
  34493. if (index >= 32768) {
  34494. valid = false;
  34495. break;
  34496. }
  34497. glyphNameIndexes.push(index);
  34498. }
  34499. if (!valid) {
  34500. break;
  34501. }
  34502. const customNames = [],
  34503. strBuf = [];
  34504. while (font.pos < end) {
  34505. const stringLength = font.getByte();
  34506. strBuf.length = stringLength;
  34507. for (i = 0; i < stringLength; ++i) {
  34508. strBuf[i] = String.fromCharCode(font.getByte());
  34509. }
  34510. customNames.push(strBuf.join(""));
  34511. }
  34512. glyphNames = [];
  34513. for (i = 0; i < numGlyphs; ++i) {
  34514. const j = glyphNameIndexes[i];
  34515. if (j < 258) {
  34516. glyphNames.push(_fonts_utils.MacStandardGlyphOrdering[j]);
  34517. continue;
  34518. }
  34519. glyphNames.push(customNames[j - 258]);
  34520. }
  34521. break;
  34522. case 0x00030000:
  34523. break;
  34524. default:
  34525. (0, _util.warn)("Unknown/unsupported post table version " + version);
  34526. valid = false;
  34527. if (propertiesObj.defaultEncoding) {
  34528. glyphNames = propertiesObj.defaultEncoding;
  34529. }
  34530. break;
  34531. }
  34532. propertiesObj.glyphNames = glyphNames;
  34533. return valid;
  34534. }
  34535. function readNameTable(nameTable) {
  34536. const start = (font.start || 0) + nameTable.offset;
  34537. font.pos = start;
  34538. const names = [[], []];
  34539. const length = nameTable.length,
  34540. end = start + length;
  34541. const format = font.getUint16();
  34542. const FORMAT_0_HEADER_LENGTH = 6;
  34543. if (format !== 0 || length < FORMAT_0_HEADER_LENGTH) {
  34544. return names;
  34545. }
  34546. const numRecords = font.getUint16();
  34547. const stringsStart = font.getUint16();
  34548. const records = [];
  34549. const NAME_RECORD_LENGTH = 12;
  34550. let i, ii;
  34551. for (i = 0; i < numRecords && font.pos + NAME_RECORD_LENGTH <= end; i++) {
  34552. const r = {
  34553. platform: font.getUint16(),
  34554. encoding: font.getUint16(),
  34555. language: font.getUint16(),
  34556. name: font.getUint16(),
  34557. length: font.getUint16(),
  34558. offset: font.getUint16()
  34559. };
  34560. if (r.platform === 1 && r.encoding === 0 && r.language === 0 || r.platform === 3 && r.encoding === 1 && r.language === 0x409) {
  34561. records.push(r);
  34562. }
  34563. }
  34564. for (i = 0, ii = records.length; i < ii; i++) {
  34565. const record = records[i];
  34566. if (record.length <= 0) {
  34567. continue;
  34568. }
  34569. const pos = start + stringsStart + record.offset;
  34570. if (pos + record.length > end) {
  34571. continue;
  34572. }
  34573. font.pos = pos;
  34574. const nameIndex = record.name;
  34575. if (record.encoding) {
  34576. let str = "";
  34577. for (let j = 0, jj = record.length; j < jj; j += 2) {
  34578. str += String.fromCharCode(font.getUint16());
  34579. }
  34580. names[1][nameIndex] = str;
  34581. } else {
  34582. names[0][nameIndex] = font.getString(record.length);
  34583. }
  34584. }
  34585. return names;
  34586. }
  34587. 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];
  34588. function sanitizeTTProgram(table, ttContext) {
  34589. let data = table.data;
  34590. let i = 0,
  34591. j,
  34592. n,
  34593. b,
  34594. funcId,
  34595. pc,
  34596. lastEndf = 0,
  34597. lastDeff = 0;
  34598. const stack = [];
  34599. const callstack = [];
  34600. const functionsCalled = [];
  34601. let tooComplexToFollowFunctions = ttContext.tooComplexToFollowFunctions;
  34602. let inFDEF = false,
  34603. ifLevel = 0,
  34604. inELSE = 0;
  34605. for (let ii = data.length; i < ii;) {
  34606. const op = data[i++];
  34607. if (op === 0x40) {
  34608. n = data[i++];
  34609. if (inFDEF || inELSE) {
  34610. i += n;
  34611. } else {
  34612. for (j = 0; j < n; j++) {
  34613. stack.push(data[i++]);
  34614. }
  34615. }
  34616. } else if (op === 0x41) {
  34617. n = data[i++];
  34618. if (inFDEF || inELSE) {
  34619. i += n * 2;
  34620. } else {
  34621. for (j = 0; j < n; j++) {
  34622. b = data[i++];
  34623. stack.push(b << 8 | data[i++]);
  34624. }
  34625. }
  34626. } else if ((op & 0xf8) === 0xb0) {
  34627. n = op - 0xb0 + 1;
  34628. if (inFDEF || inELSE) {
  34629. i += n;
  34630. } else {
  34631. for (j = 0; j < n; j++) {
  34632. stack.push(data[i++]);
  34633. }
  34634. }
  34635. } else if ((op & 0xf8) === 0xb8) {
  34636. n = op - 0xb8 + 1;
  34637. if (inFDEF || inELSE) {
  34638. i += n * 2;
  34639. } else {
  34640. for (j = 0; j < n; j++) {
  34641. b = data[i++];
  34642. stack.push(b << 8 | data[i++]);
  34643. }
  34644. }
  34645. } else if (op === 0x2b && !tooComplexToFollowFunctions) {
  34646. if (!inFDEF && !inELSE) {
  34647. funcId = stack.at(-1);
  34648. if (isNaN(funcId)) {
  34649. (0, _util.info)("TT: CALL empty stack (or invalid entry).");
  34650. } else {
  34651. ttContext.functionsUsed[funcId] = true;
  34652. if (funcId in ttContext.functionsStackDeltas) {
  34653. const newStackLength = stack.length + ttContext.functionsStackDeltas[funcId];
  34654. if (newStackLength < 0) {
  34655. (0, _util.warn)("TT: CALL invalid functions stack delta.");
  34656. ttContext.hintsValid = false;
  34657. return;
  34658. }
  34659. stack.length = newStackLength;
  34660. } else if (funcId in ttContext.functionsDefined && !functionsCalled.includes(funcId)) {
  34661. callstack.push({
  34662. data,
  34663. i,
  34664. stackTop: stack.length - 1
  34665. });
  34666. functionsCalled.push(funcId);
  34667. pc = ttContext.functionsDefined[funcId];
  34668. if (!pc) {
  34669. (0, _util.warn)("TT: CALL non-existent function");
  34670. ttContext.hintsValid = false;
  34671. return;
  34672. }
  34673. data = pc.data;
  34674. i = pc.i;
  34675. }
  34676. }
  34677. }
  34678. } else if (op === 0x2c && !tooComplexToFollowFunctions) {
  34679. if (inFDEF || inELSE) {
  34680. (0, _util.warn)("TT: nested FDEFs not allowed");
  34681. tooComplexToFollowFunctions = true;
  34682. }
  34683. inFDEF = true;
  34684. lastDeff = i;
  34685. funcId = stack.pop();
  34686. ttContext.functionsDefined[funcId] = {
  34687. data,
  34688. i
  34689. };
  34690. } else if (op === 0x2d) {
  34691. if (inFDEF) {
  34692. inFDEF = false;
  34693. lastEndf = i;
  34694. } else {
  34695. pc = callstack.pop();
  34696. if (!pc) {
  34697. (0, _util.warn)("TT: ENDF bad stack");
  34698. ttContext.hintsValid = false;
  34699. return;
  34700. }
  34701. funcId = functionsCalled.pop();
  34702. data = pc.data;
  34703. i = pc.i;
  34704. ttContext.functionsStackDeltas[funcId] = stack.length - pc.stackTop;
  34705. }
  34706. } else if (op === 0x89) {
  34707. if (inFDEF || inELSE) {
  34708. (0, _util.warn)("TT: nested IDEFs not allowed");
  34709. tooComplexToFollowFunctions = true;
  34710. }
  34711. inFDEF = true;
  34712. lastDeff = i;
  34713. } else if (op === 0x58) {
  34714. ++ifLevel;
  34715. } else if (op === 0x1b) {
  34716. inELSE = ifLevel;
  34717. } else if (op === 0x59) {
  34718. if (inELSE === ifLevel) {
  34719. inELSE = 0;
  34720. }
  34721. --ifLevel;
  34722. } else if (op === 0x1c) {
  34723. if (!inFDEF && !inELSE) {
  34724. const offset = stack.at(-1);
  34725. if (offset > 0) {
  34726. i += offset - 1;
  34727. }
  34728. }
  34729. }
  34730. if (!inFDEF && !inELSE) {
  34731. let stackDelta = 0;
  34732. if (op <= 0x8e) {
  34733. stackDelta = TTOpsStackDeltas[op];
  34734. } else if (op >= 0xc0 && op <= 0xdf) {
  34735. stackDelta = -1;
  34736. } else if (op >= 0xe0) {
  34737. stackDelta = -2;
  34738. }
  34739. if (op >= 0x71 && op <= 0x75) {
  34740. n = stack.pop();
  34741. if (!isNaN(n)) {
  34742. stackDelta = -n * 2;
  34743. }
  34744. }
  34745. while (stackDelta < 0 && stack.length > 0) {
  34746. stack.pop();
  34747. stackDelta++;
  34748. }
  34749. while (stackDelta > 0) {
  34750. stack.push(NaN);
  34751. stackDelta--;
  34752. }
  34753. }
  34754. }
  34755. ttContext.tooComplexToFollowFunctions = tooComplexToFollowFunctions;
  34756. const content = [data];
  34757. if (i > data.length) {
  34758. content.push(new Uint8Array(i - data.length));
  34759. }
  34760. if (lastDeff > lastEndf) {
  34761. (0, _util.warn)("TT: complementing a missing function tail");
  34762. content.push(new Uint8Array([0x22, 0x2d]));
  34763. }
  34764. foldTTTable(table, content);
  34765. }
  34766. function checkInvalidFunctions(ttContext, maxFunctionDefs) {
  34767. if (ttContext.tooComplexToFollowFunctions) {
  34768. return;
  34769. }
  34770. if (ttContext.functionsDefined.length > maxFunctionDefs) {
  34771. (0, _util.warn)("TT: more functions defined than expected");
  34772. ttContext.hintsValid = false;
  34773. return;
  34774. }
  34775. for (let j = 0, jj = ttContext.functionsUsed.length; j < jj; j++) {
  34776. if (j > maxFunctionDefs) {
  34777. (0, _util.warn)("TT: invalid function id: " + j);
  34778. ttContext.hintsValid = false;
  34779. return;
  34780. }
  34781. if (ttContext.functionsUsed[j] && !ttContext.functionsDefined[j]) {
  34782. (0, _util.warn)("TT: undefined function: " + j);
  34783. ttContext.hintsValid = false;
  34784. return;
  34785. }
  34786. }
  34787. }
  34788. function foldTTTable(table, content) {
  34789. if (content.length > 1) {
  34790. let newLength = 0;
  34791. let j, jj;
  34792. for (j = 0, jj = content.length; j < jj; j++) {
  34793. newLength += content[j].length;
  34794. }
  34795. newLength = newLength + 3 & ~3;
  34796. const result = new Uint8Array(newLength);
  34797. let pos = 0;
  34798. for (j = 0, jj = content.length; j < jj; j++) {
  34799. result.set(content[j], pos);
  34800. pos += content[j].length;
  34801. }
  34802. table.data = result;
  34803. table.length = newLength;
  34804. }
  34805. }
  34806. function sanitizeTTPrograms(fpgm, prep, cvt, maxFunctionDefs) {
  34807. const ttContext = {
  34808. functionsDefined: [],
  34809. functionsUsed: [],
  34810. functionsStackDeltas: [],
  34811. tooComplexToFollowFunctions: false,
  34812. hintsValid: true
  34813. };
  34814. if (fpgm) {
  34815. sanitizeTTProgram(fpgm, ttContext);
  34816. }
  34817. if (prep) {
  34818. sanitizeTTProgram(prep, ttContext);
  34819. }
  34820. if (fpgm) {
  34821. checkInvalidFunctions(ttContext, maxFunctionDefs);
  34822. }
  34823. if (cvt && cvt.length & 1) {
  34824. const cvtData = new Uint8Array(cvt.length + 1);
  34825. cvtData.set(cvt.data);
  34826. cvt.data = cvtData;
  34827. }
  34828. return ttContext.hintsValid;
  34829. }
  34830. font = new _stream.Stream(new Uint8Array(font.getBytes()));
  34831. let header, tables;
  34832. if (isTrueTypeCollectionFile(font)) {
  34833. const ttcData = readTrueTypeCollectionData(font, this.name);
  34834. header = ttcData.header;
  34835. tables = ttcData.tables;
  34836. } else {
  34837. header = readOpenTypeHeader(font);
  34838. tables = readTables(font, header.numTables);
  34839. }
  34840. let cff, cffFile;
  34841. const isTrueType = !tables["CFF "];
  34842. if (!isTrueType) {
  34843. const isComposite = properties.composite && ((properties.cidToGidMap || []).length > 0 || !(properties.cMap instanceof _cmap.IdentityCMap));
  34844. if (header.version === "OTTO" && !isComposite || !tables.head || !tables.hhea || !tables.maxp || !tables.post) {
  34845. cffFile = new _stream.Stream(tables["CFF "].data);
  34846. cff = new _cff_font.CFFFont(cffFile, properties);
  34847. adjustWidths(properties);
  34848. return this.convert(name, cff, properties);
  34849. }
  34850. delete tables.glyf;
  34851. delete tables.loca;
  34852. delete tables.fpgm;
  34853. delete tables.prep;
  34854. delete tables["cvt "];
  34855. this.isOpenType = true;
  34856. } else {
  34857. if (!tables.loca) {
  34858. throw new _util.FormatError('Required "loca" table is not found');
  34859. }
  34860. if (!tables.glyf) {
  34861. (0, _util.warn)('Required "glyf" table is not found -- trying to recover.');
  34862. tables.glyf = {
  34863. tag: "glyf",
  34864. data: new Uint8Array(0)
  34865. };
  34866. }
  34867. this.isOpenType = false;
  34868. }
  34869. if (!tables.maxp) {
  34870. throw new _util.FormatError('Required "maxp" table is not found');
  34871. }
  34872. font.pos = (font.start || 0) + tables.maxp.offset;
  34873. const version = font.getInt32();
  34874. const numGlyphs = font.getUint16();
  34875. if (properties.scaleFactors && properties.scaleFactors.length === numGlyphs && isTrueType) {
  34876. const {
  34877. scaleFactors
  34878. } = properties;
  34879. const isGlyphLocationsLong = int16(tables.head.data[50], tables.head.data[51]);
  34880. const glyphs = new _glyf.GlyfTable({
  34881. glyfTable: tables.glyf.data,
  34882. isGlyphLocationsLong,
  34883. locaTable: tables.loca.data,
  34884. numGlyphs
  34885. });
  34886. glyphs.scale(scaleFactors);
  34887. const {
  34888. glyf,
  34889. loca,
  34890. isLocationLong
  34891. } = glyphs.write();
  34892. tables.glyf.data = glyf;
  34893. tables.loca.data = loca;
  34894. if (isLocationLong !== !!isGlyphLocationsLong) {
  34895. tables.head.data[50] = 0;
  34896. tables.head.data[51] = isLocationLong ? 1 : 0;
  34897. }
  34898. const metrics = tables.hmtx.data;
  34899. for (let i = 0; i < numGlyphs; i++) {
  34900. const j = 4 * i;
  34901. const advanceWidth = Math.round(scaleFactors[i] * int16(metrics[j], metrics[j + 1]));
  34902. metrics[j] = advanceWidth >> 8 & 0xff;
  34903. metrics[j + 1] = advanceWidth & 0xff;
  34904. const lsb = Math.round(scaleFactors[i] * signedInt16(metrics[j + 2], metrics[j + 3]));
  34905. writeSignedInt16(metrics, j + 2, lsb);
  34906. }
  34907. }
  34908. let numGlyphsOut = numGlyphs + 1;
  34909. let dupFirstEntry = true;
  34910. if (numGlyphsOut > 0xffff) {
  34911. dupFirstEntry = false;
  34912. numGlyphsOut = numGlyphs;
  34913. (0, _util.warn)("Not enough space in glyfs to duplicate first glyph.");
  34914. }
  34915. let maxFunctionDefs = 0;
  34916. let maxSizeOfInstructions = 0;
  34917. if (version >= 0x00010000 && tables.maxp.length >= 22) {
  34918. font.pos += 8;
  34919. const maxZones = font.getUint16();
  34920. if (maxZones > 2) {
  34921. tables.maxp.data[14] = 0;
  34922. tables.maxp.data[15] = 2;
  34923. }
  34924. font.pos += 4;
  34925. maxFunctionDefs = font.getUint16();
  34926. font.pos += 4;
  34927. maxSizeOfInstructions = font.getUint16();
  34928. }
  34929. tables.maxp.data[4] = numGlyphsOut >> 8;
  34930. tables.maxp.data[5] = numGlyphsOut & 255;
  34931. const hintsValid = sanitizeTTPrograms(tables.fpgm, tables.prep, tables["cvt "], maxFunctionDefs);
  34932. if (!hintsValid) {
  34933. delete tables.fpgm;
  34934. delete tables.prep;
  34935. delete tables["cvt "];
  34936. }
  34937. sanitizeMetrics(font, tables.hhea, tables.hmtx, tables.head, numGlyphsOut, dupFirstEntry);
  34938. if (!tables.head) {
  34939. throw new _util.FormatError('Required "head" table is not found');
  34940. }
  34941. sanitizeHead(tables.head, numGlyphs, isTrueType ? tables.loca.length : 0);
  34942. let missingGlyphs = Object.create(null);
  34943. if (isTrueType) {
  34944. const isGlyphLocationsLong = int16(tables.head.data[50], tables.head.data[51]);
  34945. const glyphsInfo = sanitizeGlyphLocations(tables.loca, tables.glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry, maxSizeOfInstructions);
  34946. missingGlyphs = glyphsInfo.missingGlyphs;
  34947. if (version >= 0x00010000 && tables.maxp.length >= 22) {
  34948. tables.maxp.data[26] = glyphsInfo.maxSizeOfInstructions >> 8;
  34949. tables.maxp.data[27] = glyphsInfo.maxSizeOfInstructions & 255;
  34950. }
  34951. }
  34952. if (!tables.hhea) {
  34953. throw new _util.FormatError('Required "hhea" table is not found');
  34954. }
  34955. if (tables.hhea.data[10] === 0 && tables.hhea.data[11] === 0) {
  34956. tables.hhea.data[10] = 0xff;
  34957. tables.hhea.data[11] = 0xff;
  34958. }
  34959. const metricsOverride = {
  34960. unitsPerEm: int16(tables.head.data[18], tables.head.data[19]),
  34961. yMax: int16(tables.head.data[42], tables.head.data[43]),
  34962. yMin: signedInt16(tables.head.data[38], tables.head.data[39]),
  34963. ascent: signedInt16(tables.hhea.data[4], tables.hhea.data[5]),
  34964. descent: signedInt16(tables.hhea.data[6], tables.hhea.data[7]),
  34965. lineGap: signedInt16(tables.hhea.data[8], tables.hhea.data[9])
  34966. };
  34967. this.ascent = metricsOverride.ascent / metricsOverride.unitsPerEm;
  34968. this.descent = metricsOverride.descent / metricsOverride.unitsPerEm;
  34969. this.lineGap = metricsOverride.lineGap / metricsOverride.unitsPerEm;
  34970. if (this.cssFontInfo && this.cssFontInfo.lineHeight) {
  34971. this.lineHeight = this.cssFontInfo.metrics.lineHeight;
  34972. this.lineGap = this.cssFontInfo.metrics.lineGap;
  34973. } else {
  34974. this.lineHeight = this.ascent - this.descent + this.lineGap;
  34975. }
  34976. if (tables.post) {
  34977. readPostScriptTable(tables.post, properties, numGlyphs);
  34978. }
  34979. tables.post = {
  34980. tag: "post",
  34981. data: createPostTable(properties)
  34982. };
  34983. const charCodeToGlyphId = [];
  34984. function hasGlyph(glyphId) {
  34985. return !missingGlyphs[glyphId];
  34986. }
  34987. if (properties.composite) {
  34988. const cidToGidMap = properties.cidToGidMap || [];
  34989. const isCidToGidMapEmpty = cidToGidMap.length === 0;
  34990. properties.cMap.forEach(function (charCode, cid) {
  34991. if (typeof cid === "string") {
  34992. cid = convertCidString(charCode, cid, true);
  34993. }
  34994. if (cid > 0xffff) {
  34995. throw new _util.FormatError("Max size of CID is 65,535");
  34996. }
  34997. let glyphId = -1;
  34998. if (isCidToGidMapEmpty) {
  34999. glyphId = cid;
  35000. } else if (cidToGidMap[cid] !== undefined) {
  35001. glyphId = cidToGidMap[cid];
  35002. }
  35003. if (glyphId >= 0 && glyphId < numGlyphs && hasGlyph(glyphId)) {
  35004. charCodeToGlyphId[charCode] = glyphId;
  35005. }
  35006. });
  35007. } else {
  35008. const cmapTable = readCmapTable(tables.cmap, font, this.isSymbolicFont, properties.hasEncoding);
  35009. const cmapPlatformId = cmapTable.platformId;
  35010. const cmapEncodingId = cmapTable.encodingId;
  35011. const cmapMappings = cmapTable.mappings;
  35012. const cmapMappingsLength = cmapMappings.length;
  35013. let baseEncoding = [],
  35014. forcePostTable = false;
  35015. if (properties.hasEncoding && (properties.baseEncodingName === "MacRomanEncoding" || properties.baseEncodingName === "WinAnsiEncoding")) {
  35016. baseEncoding = (0, _encodings.getEncoding)(properties.baseEncodingName);
  35017. }
  35018. if (properties.hasEncoding && !this.isSymbolicFont && (cmapPlatformId === 3 && cmapEncodingId === 1 || cmapPlatformId === 1 && cmapEncodingId === 0)) {
  35019. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  35020. for (let charCode = 0; charCode < 256; charCode++) {
  35021. let glyphName;
  35022. if (this.differences[charCode] !== undefined) {
  35023. glyphName = this.differences[charCode];
  35024. } else if (baseEncoding.length && baseEncoding[charCode] !== "") {
  35025. glyphName = baseEncoding[charCode];
  35026. } else {
  35027. glyphName = _encodings.StandardEncoding[charCode];
  35028. }
  35029. if (!glyphName) {
  35030. continue;
  35031. }
  35032. const standardGlyphName = (0, _fonts_utils.recoverGlyphName)(glyphName, glyphsUnicodeMap);
  35033. let unicodeOrCharCode;
  35034. if (cmapPlatformId === 3 && cmapEncodingId === 1) {
  35035. unicodeOrCharCode = glyphsUnicodeMap[standardGlyphName];
  35036. } else if (cmapPlatformId === 1 && cmapEncodingId === 0) {
  35037. unicodeOrCharCode = _encodings.MacRomanEncoding.indexOf(standardGlyphName);
  35038. }
  35039. if (unicodeOrCharCode === undefined) {
  35040. if (!properties.glyphNames && properties.hasIncludedToUnicodeMap && !(this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap)) {
  35041. const unicode = this.toUnicode.get(charCode);
  35042. if (unicode) {
  35043. unicodeOrCharCode = unicode.codePointAt(0);
  35044. }
  35045. }
  35046. if (unicodeOrCharCode === undefined) {
  35047. continue;
  35048. }
  35049. }
  35050. for (let i = 0; i < cmapMappingsLength; ++i) {
  35051. if (cmapMappings[i].charCode !== unicodeOrCharCode) {
  35052. continue;
  35053. }
  35054. charCodeToGlyphId[charCode] = cmapMappings[i].glyphId;
  35055. break;
  35056. }
  35057. }
  35058. } else if (cmapPlatformId === 0) {
  35059. for (let i = 0; i < cmapMappingsLength; ++i) {
  35060. charCodeToGlyphId[cmapMappings[i].charCode] = cmapMappings[i].glyphId;
  35061. }
  35062. forcePostTable = true;
  35063. } else {
  35064. for (let i = 0; i < cmapMappingsLength; ++i) {
  35065. let charCode = cmapMappings[i].charCode;
  35066. if (cmapPlatformId === 3 && charCode >= 0xf000 && charCode <= 0xf0ff) {
  35067. charCode &= 0xff;
  35068. }
  35069. charCodeToGlyphId[charCode] = cmapMappings[i].glyphId;
  35070. }
  35071. }
  35072. if (properties.glyphNames && (baseEncoding.length || this.differences.length)) {
  35073. for (let i = 0; i < 256; ++i) {
  35074. if (!forcePostTable && charCodeToGlyphId[i] !== undefined) {
  35075. continue;
  35076. }
  35077. const glyphName = this.differences[i] || baseEncoding[i];
  35078. if (!glyphName) {
  35079. continue;
  35080. }
  35081. const glyphId = properties.glyphNames.indexOf(glyphName);
  35082. if (glyphId > 0 && hasGlyph(glyphId)) {
  35083. charCodeToGlyphId[i] = glyphId;
  35084. }
  35085. }
  35086. }
  35087. }
  35088. if (charCodeToGlyphId.length === 0) {
  35089. charCodeToGlyphId[0] = 0;
  35090. }
  35091. let glyphZeroId = numGlyphsOut - 1;
  35092. if (!dupFirstEntry) {
  35093. glyphZeroId = 0;
  35094. }
  35095. if (!properties.cssFontInfo) {
  35096. const newMapping = adjustMapping(charCodeToGlyphId, hasGlyph, glyphZeroId, this.toUnicode);
  35097. this.toFontChar = newMapping.toFontChar;
  35098. tables.cmap = {
  35099. tag: "cmap",
  35100. data: createCmapTable(newMapping.charCodeToGlyphId, newMapping.toUnicodeExtraMap, numGlyphsOut)
  35101. };
  35102. if (!tables["OS/2"] || !validateOS2Table(tables["OS/2"], font)) {
  35103. tables["OS/2"] = {
  35104. tag: "OS/2",
  35105. data: createOS2Table(properties, newMapping.charCodeToGlyphId, metricsOverride)
  35106. };
  35107. }
  35108. }
  35109. if (!isTrueType) {
  35110. try {
  35111. cffFile = new _stream.Stream(tables["CFF "].data);
  35112. const parser = new _cff_parser.CFFParser(cffFile, properties, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  35113. cff = parser.parse();
  35114. cff.duplicateFirstGlyph();
  35115. const compiler = new _cff_parser.CFFCompiler(cff);
  35116. tables["CFF "].data = compiler.compile();
  35117. } catch (e) {
  35118. (0, _util.warn)("Failed to compile font " + properties.loadedName);
  35119. }
  35120. }
  35121. if (!tables.name) {
  35122. tables.name = {
  35123. tag: "name",
  35124. data: createNameTable(this.name)
  35125. };
  35126. } else {
  35127. const namePrototype = readNameTable(tables.name);
  35128. tables.name.data = createNameTable(name, namePrototype);
  35129. this.psName = namePrototype[0][6] || null;
  35130. }
  35131. const builder = new _opentype_file_builder.OpenTypeFileBuilder(header.version);
  35132. for (const tableTag in tables) {
  35133. builder.addTable(tableTag, tables[tableTag].data);
  35134. }
  35135. return builder.toArray();
  35136. }
  35137. convert(fontName, font, properties) {
  35138. properties.fixedPitch = false;
  35139. if (properties.builtInEncoding) {
  35140. adjustToUnicode(properties, properties.builtInEncoding);
  35141. }
  35142. let glyphZeroId = 1;
  35143. if (font instanceof _cff_font.CFFFont) {
  35144. glyphZeroId = font.numGlyphs - 1;
  35145. }
  35146. const mapping = font.getGlyphMapping(properties);
  35147. let newMapping = null;
  35148. let newCharCodeToGlyphId = mapping;
  35149. let toUnicodeExtraMap = null;
  35150. if (!properties.cssFontInfo) {
  35151. newMapping = adjustMapping(mapping, font.hasGlyphId.bind(font), glyphZeroId, this.toUnicode);
  35152. this.toFontChar = newMapping.toFontChar;
  35153. newCharCodeToGlyphId = newMapping.charCodeToGlyphId;
  35154. toUnicodeExtraMap = newMapping.toUnicodeExtraMap;
  35155. }
  35156. const numGlyphs = font.numGlyphs;
  35157. function getCharCodes(charCodeToGlyphId, glyphId) {
  35158. let charCodes = null;
  35159. for (const charCode in charCodeToGlyphId) {
  35160. if (glyphId === charCodeToGlyphId[charCode]) {
  35161. if (!charCodes) {
  35162. charCodes = [];
  35163. }
  35164. charCodes.push(charCode | 0);
  35165. }
  35166. }
  35167. return charCodes;
  35168. }
  35169. function createCharCode(charCodeToGlyphId, glyphId) {
  35170. for (const charCode in charCodeToGlyphId) {
  35171. if (glyphId === charCodeToGlyphId[charCode]) {
  35172. return charCode | 0;
  35173. }
  35174. }
  35175. newMapping.charCodeToGlyphId[newMapping.nextAvailableFontCharCode] = glyphId;
  35176. return newMapping.nextAvailableFontCharCode++;
  35177. }
  35178. const seacs = font.seacs;
  35179. if (newMapping && _fonts_utils.SEAC_ANALYSIS_ENABLED && seacs && seacs.length) {
  35180. const matrix = properties.fontMatrix || _util.FONT_IDENTITY_MATRIX;
  35181. const charset = font.getCharset();
  35182. const seacMap = Object.create(null);
  35183. for (let glyphId in seacs) {
  35184. glyphId |= 0;
  35185. const seac = seacs[glyphId];
  35186. const baseGlyphName = _encodings.StandardEncoding[seac[2]];
  35187. const accentGlyphName = _encodings.StandardEncoding[seac[3]];
  35188. const baseGlyphId = charset.indexOf(baseGlyphName);
  35189. const accentGlyphId = charset.indexOf(accentGlyphName);
  35190. if (baseGlyphId < 0 || accentGlyphId < 0) {
  35191. continue;
  35192. }
  35193. const accentOffset = {
  35194. x: seac[0] * matrix[0] + seac[1] * matrix[2] + matrix[4],
  35195. y: seac[0] * matrix[1] + seac[1] * matrix[3] + matrix[5]
  35196. };
  35197. const charCodes = getCharCodes(mapping, glyphId);
  35198. if (!charCodes) {
  35199. continue;
  35200. }
  35201. for (let i = 0, ii = charCodes.length; i < ii; i++) {
  35202. const charCode = charCodes[i];
  35203. const charCodeToGlyphId = newMapping.charCodeToGlyphId;
  35204. const baseFontCharCode = createCharCode(charCodeToGlyphId, baseGlyphId);
  35205. const accentFontCharCode = createCharCode(charCodeToGlyphId, accentGlyphId);
  35206. seacMap[charCode] = {
  35207. baseFontCharCode,
  35208. accentFontCharCode,
  35209. accentOffset
  35210. };
  35211. }
  35212. }
  35213. properties.seacMap = seacMap;
  35214. }
  35215. const unitsPerEm = 1 / (properties.fontMatrix || _util.FONT_IDENTITY_MATRIX)[0];
  35216. const builder = new _opentype_file_builder.OpenTypeFileBuilder("\x4F\x54\x54\x4F");
  35217. builder.addTable("CFF ", font.data);
  35218. builder.addTable("OS/2", createOS2Table(properties, newCharCodeToGlyphId));
  35219. builder.addTable("cmap", createCmapTable(newCharCodeToGlyphId, toUnicodeExtraMap, numGlyphs));
  35220. 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");
  35221. 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));
  35222. builder.addTable("hmtx", function fontFieldsHmtx() {
  35223. const charstrings = font.charstrings;
  35224. const cffWidths = font.cff ? font.cff.widths : null;
  35225. let hmtx = "\x00\x00\x00\x00";
  35226. for (let i = 1, ii = numGlyphs; i < ii; i++) {
  35227. let width = 0;
  35228. if (charstrings) {
  35229. const charstring = charstrings[i - 1];
  35230. width = "width" in charstring ? charstring.width : 0;
  35231. } else if (cffWidths) {
  35232. width = Math.ceil(cffWidths[i] || 0);
  35233. }
  35234. hmtx += string16(width) + string16(0);
  35235. }
  35236. return hmtx;
  35237. }());
  35238. builder.addTable("maxp", "\x00\x00\x50\x00" + string16(numGlyphs));
  35239. builder.addTable("name", createNameTable(fontName));
  35240. builder.addTable("post", createPostTable(properties));
  35241. return builder.toArray();
  35242. }
  35243. get spaceWidth() {
  35244. const possibleSpaceReplacements = ["space", "minus", "one", "i", "I"];
  35245. let width;
  35246. for (let i = 0, ii = possibleSpaceReplacements.length; i < ii; i++) {
  35247. const glyphName = possibleSpaceReplacements[i];
  35248. if (glyphName in this.widths) {
  35249. width = this.widths[glyphName];
  35250. break;
  35251. }
  35252. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  35253. const glyphUnicode = glyphsUnicodeMap[glyphName];
  35254. let charcode = 0;
  35255. if (this.composite && this.cMap.contains(glyphUnicode)) {
  35256. charcode = this.cMap.lookup(glyphUnicode);
  35257. if (typeof charcode === "string") {
  35258. charcode = convertCidString(glyphUnicode, charcode);
  35259. }
  35260. }
  35261. if (!charcode && this.toUnicode) {
  35262. charcode = this.toUnicode.charCodeOf(glyphUnicode);
  35263. }
  35264. if (charcode <= 0) {
  35265. charcode = glyphUnicode;
  35266. }
  35267. width = this.widths[charcode];
  35268. if (width) {
  35269. break;
  35270. }
  35271. }
  35272. width = width || this.defaultWidth;
  35273. return (0, _util.shadow)(this, "spaceWidth", width);
  35274. }
  35275. _charToGlyph(charcode, isSpace = false) {
  35276. let fontCharCode, width, operatorListId;
  35277. let widthCode = charcode;
  35278. if (this.cMap && this.cMap.contains(charcode)) {
  35279. widthCode = this.cMap.lookup(charcode);
  35280. if (typeof widthCode === "string") {
  35281. widthCode = convertCidString(charcode, widthCode);
  35282. }
  35283. }
  35284. width = this.widths[widthCode];
  35285. if (typeof width !== "number") {
  35286. width = this.defaultWidth;
  35287. }
  35288. const vmetric = this.vmetrics && this.vmetrics[widthCode];
  35289. let unicode = this.toUnicode.get(charcode) || charcode;
  35290. if (typeof unicode === "number") {
  35291. unicode = String.fromCharCode(unicode);
  35292. }
  35293. let isInFont = this.toFontChar[charcode] !== undefined;
  35294. fontCharCode = this.toFontChar[charcode] || charcode;
  35295. if (this.missingFile) {
  35296. const glyphName = this.differences[charcode] || this.defaultEncoding[charcode];
  35297. if ((glyphName === ".notdef" || glyphName === "") && this.type === "Type1") {
  35298. fontCharCode = 0x20;
  35299. }
  35300. fontCharCode = (0, _unicode.mapSpecialUnicodeValues)(fontCharCode);
  35301. }
  35302. if (this.isType3Font) {
  35303. operatorListId = fontCharCode;
  35304. }
  35305. let accent = null;
  35306. if (this.seacMap && this.seacMap[charcode]) {
  35307. isInFont = true;
  35308. const seac = this.seacMap[charcode];
  35309. fontCharCode = seac.baseFontCharCode;
  35310. accent = {
  35311. fontChar: String.fromCodePoint(seac.accentFontCharCode),
  35312. offset: seac.accentOffset
  35313. };
  35314. }
  35315. let fontChar = "";
  35316. if (typeof fontCharCode === "number") {
  35317. if (fontCharCode <= 0x10ffff) {
  35318. fontChar = String.fromCodePoint(fontCharCode);
  35319. } else {
  35320. (0, _util.warn)(`charToGlyph - invalid fontCharCode: ${fontCharCode}`);
  35321. }
  35322. }
  35323. let glyph = this._glyphCache[charcode];
  35324. if (!glyph || !glyph.matchesForCache(charcode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont)) {
  35325. glyph = new Glyph(charcode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont);
  35326. this._glyphCache[charcode] = glyph;
  35327. }
  35328. return glyph;
  35329. }
  35330. charsToGlyphs(chars) {
  35331. let glyphs = this._charsCache[chars];
  35332. if (glyphs) {
  35333. return glyphs;
  35334. }
  35335. glyphs = [];
  35336. if (this.cMap) {
  35337. const c = Object.create(null),
  35338. ii = chars.length;
  35339. let i = 0;
  35340. while (i < ii) {
  35341. this.cMap.readCharCode(chars, i, c);
  35342. const {
  35343. charcode,
  35344. length
  35345. } = c;
  35346. i += length;
  35347. const glyph = this._charToGlyph(charcode, length === 1 && chars.charCodeAt(i - 1) === 0x20);
  35348. glyphs.push(glyph);
  35349. }
  35350. } else {
  35351. for (let i = 0, ii = chars.length; i < ii; ++i) {
  35352. const charcode = chars.charCodeAt(i);
  35353. const glyph = this._charToGlyph(charcode, charcode === 0x20);
  35354. glyphs.push(glyph);
  35355. }
  35356. }
  35357. return this._charsCache[chars] = glyphs;
  35358. }
  35359. getCharPositions(chars) {
  35360. const positions = [];
  35361. if (this.cMap) {
  35362. const c = Object.create(null);
  35363. let i = 0;
  35364. while (i < chars.length) {
  35365. this.cMap.readCharCode(chars, i, c);
  35366. const length = c.length;
  35367. positions.push([i, i + length]);
  35368. i += length;
  35369. }
  35370. } else {
  35371. for (let i = 0, ii = chars.length; i < ii; ++i) {
  35372. positions.push([i, i + 1]);
  35373. }
  35374. }
  35375. return positions;
  35376. }
  35377. get glyphCacheValues() {
  35378. return Object.values(this._glyphCache);
  35379. }
  35380. encodeString(str) {
  35381. const buffers = [];
  35382. const currentBuf = [];
  35383. const hasCurrentBufErrors = () => buffers.length % 2 === 1;
  35384. const getCharCode = this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap ? unicode => this.toUnicode.charCodeOf(unicode) : unicode => this.toUnicode.charCodeOf(String.fromCodePoint(unicode));
  35385. for (let i = 0, ii = str.length; i < ii; i++) {
  35386. const unicode = str.codePointAt(i);
  35387. if (unicode > 0xd7ff && (unicode < 0xe000 || unicode > 0xfffd)) {
  35388. i++;
  35389. }
  35390. if (this.toUnicode) {
  35391. const charCode = getCharCode(unicode);
  35392. if (charCode !== -1) {
  35393. if (hasCurrentBufErrors()) {
  35394. buffers.push(currentBuf.join(""));
  35395. currentBuf.length = 0;
  35396. }
  35397. const charCodeLength = this.cMap ? this.cMap.getCharCodeLength(charCode) : 1;
  35398. for (let j = charCodeLength - 1; j >= 0; j--) {
  35399. currentBuf.push(String.fromCharCode(charCode >> 8 * j & 0xff));
  35400. }
  35401. continue;
  35402. }
  35403. }
  35404. if (!hasCurrentBufErrors()) {
  35405. buffers.push(currentBuf.join(""));
  35406. currentBuf.length = 0;
  35407. }
  35408. currentBuf.push(String.fromCodePoint(unicode));
  35409. }
  35410. buffers.push(currentBuf.join(""));
  35411. return buffers;
  35412. }
  35413. }
  35414. exports.Font = Font;
  35415. class ErrorFont {
  35416. constructor(error) {
  35417. this.error = error;
  35418. this.loadedName = "g_font_error";
  35419. this.missingFile = true;
  35420. }
  35421. charsToGlyphs() {
  35422. return [];
  35423. }
  35424. encodeString(chars) {
  35425. return [chars];
  35426. }
  35427. exportData(extraProperties = false) {
  35428. return {
  35429. error: this.error
  35430. };
  35431. }
  35432. }
  35433. exports.ErrorFont = ErrorFont;
  35434. /***/ }),
  35435. /* 45 */
  35436. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  35437. Object.defineProperty(exports, "__esModule", ({
  35438. value: true
  35439. }));
  35440. exports.CFFTopDict = exports.CFFStrings = exports.CFFStandardStrings = exports.CFFPrivateDict = exports.CFFParser = exports.CFFIndex = exports.CFFHeader = exports.CFFFDSelect = exports.CFFCompiler = exports.CFFCharset = exports.CFF = void 0;
  35441. var _util = __w_pdfjs_require__(2);
  35442. var _charsets = __w_pdfjs_require__(46);
  35443. var _encodings = __w_pdfjs_require__(19);
  35444. const MAX_SUBR_NESTING = 10;
  35445. 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"];
  35446. exports.CFFStandardStrings = CFFStandardStrings;
  35447. const NUM_STANDARD_CFF_STRINGS = 391;
  35448. const CFFParser = function CFFParserClosure() {
  35449. const CharstringValidationData = [null, {
  35450. id: "hstem",
  35451. min: 2,
  35452. stackClearing: true,
  35453. stem: true
  35454. }, null, {
  35455. id: "vstem",
  35456. min: 2,
  35457. stackClearing: true,
  35458. stem: true
  35459. }, {
  35460. id: "vmoveto",
  35461. min: 1,
  35462. stackClearing: true
  35463. }, {
  35464. id: "rlineto",
  35465. min: 2,
  35466. resetStack: true
  35467. }, {
  35468. id: "hlineto",
  35469. min: 1,
  35470. resetStack: true
  35471. }, {
  35472. id: "vlineto",
  35473. min: 1,
  35474. resetStack: true
  35475. }, {
  35476. id: "rrcurveto",
  35477. min: 6,
  35478. resetStack: true
  35479. }, null, {
  35480. id: "callsubr",
  35481. min: 1,
  35482. undefStack: true
  35483. }, {
  35484. id: "return",
  35485. min: 0,
  35486. undefStack: true
  35487. }, null, null, {
  35488. id: "endchar",
  35489. min: 0,
  35490. stackClearing: true
  35491. }, null, null, null, {
  35492. id: "hstemhm",
  35493. min: 2,
  35494. stackClearing: true,
  35495. stem: true
  35496. }, {
  35497. id: "hintmask",
  35498. min: 0,
  35499. stackClearing: true
  35500. }, {
  35501. id: "cntrmask",
  35502. min: 0,
  35503. stackClearing: true
  35504. }, {
  35505. id: "rmoveto",
  35506. min: 2,
  35507. stackClearing: true
  35508. }, {
  35509. id: "hmoveto",
  35510. min: 1,
  35511. stackClearing: true
  35512. }, {
  35513. id: "vstemhm",
  35514. min: 2,
  35515. stackClearing: true,
  35516. stem: true
  35517. }, {
  35518. id: "rcurveline",
  35519. min: 8,
  35520. resetStack: true
  35521. }, {
  35522. id: "rlinecurve",
  35523. min: 8,
  35524. resetStack: true
  35525. }, {
  35526. id: "vvcurveto",
  35527. min: 4,
  35528. resetStack: true
  35529. }, {
  35530. id: "hhcurveto",
  35531. min: 4,
  35532. resetStack: true
  35533. }, null, {
  35534. id: "callgsubr",
  35535. min: 1,
  35536. undefStack: true
  35537. }, {
  35538. id: "vhcurveto",
  35539. min: 4,
  35540. resetStack: true
  35541. }, {
  35542. id: "hvcurveto",
  35543. min: 4,
  35544. resetStack: true
  35545. }];
  35546. const CharstringValidationData12 = [null, null, null, {
  35547. id: "and",
  35548. min: 2,
  35549. stackDelta: -1
  35550. }, {
  35551. id: "or",
  35552. min: 2,
  35553. stackDelta: -1
  35554. }, {
  35555. id: "not",
  35556. min: 1,
  35557. stackDelta: 0
  35558. }, null, null, null, {
  35559. id: "abs",
  35560. min: 1,
  35561. stackDelta: 0
  35562. }, {
  35563. id: "add",
  35564. min: 2,
  35565. stackDelta: -1,
  35566. stackFn: function stack_div(stack, index) {
  35567. stack[index - 2] = stack[index - 2] + stack[index - 1];
  35568. }
  35569. }, {
  35570. id: "sub",
  35571. min: 2,
  35572. stackDelta: -1,
  35573. stackFn: function stack_div(stack, index) {
  35574. stack[index - 2] = stack[index - 2] - stack[index - 1];
  35575. }
  35576. }, {
  35577. id: "div",
  35578. min: 2,
  35579. stackDelta: -1,
  35580. stackFn: function stack_div(stack, index) {
  35581. stack[index - 2] = stack[index - 2] / stack[index - 1];
  35582. }
  35583. }, null, {
  35584. id: "neg",
  35585. min: 1,
  35586. stackDelta: 0,
  35587. stackFn: function stack_div(stack, index) {
  35588. stack[index - 1] = -stack[index - 1];
  35589. }
  35590. }, {
  35591. id: "eq",
  35592. min: 2,
  35593. stackDelta: -1
  35594. }, null, null, {
  35595. id: "drop",
  35596. min: 1,
  35597. stackDelta: -1
  35598. }, null, {
  35599. id: "put",
  35600. min: 2,
  35601. stackDelta: -2
  35602. }, {
  35603. id: "get",
  35604. min: 1,
  35605. stackDelta: 0
  35606. }, {
  35607. id: "ifelse",
  35608. min: 4,
  35609. stackDelta: -3
  35610. }, {
  35611. id: "random",
  35612. min: 0,
  35613. stackDelta: 1
  35614. }, {
  35615. id: "mul",
  35616. min: 2,
  35617. stackDelta: -1,
  35618. stackFn: function stack_div(stack, index) {
  35619. stack[index - 2] = stack[index - 2] * stack[index - 1];
  35620. }
  35621. }, null, {
  35622. id: "sqrt",
  35623. min: 1,
  35624. stackDelta: 0
  35625. }, {
  35626. id: "dup",
  35627. min: 1,
  35628. stackDelta: 1
  35629. }, {
  35630. id: "exch",
  35631. min: 2,
  35632. stackDelta: 0
  35633. }, {
  35634. id: "index",
  35635. min: 2,
  35636. stackDelta: 0
  35637. }, {
  35638. id: "roll",
  35639. min: 3,
  35640. stackDelta: -2
  35641. }, null, null, null, {
  35642. id: "hflex",
  35643. min: 7,
  35644. resetStack: true
  35645. }, {
  35646. id: "flex",
  35647. min: 13,
  35648. resetStack: true
  35649. }, {
  35650. id: "hflex1",
  35651. min: 9,
  35652. resetStack: true
  35653. }, {
  35654. id: "flex1",
  35655. min: 11,
  35656. resetStack: true
  35657. }];
  35658. class CFFParser {
  35659. constructor(file, properties, seacAnalysisEnabled) {
  35660. this.bytes = file.getBytes();
  35661. this.properties = properties;
  35662. this.seacAnalysisEnabled = !!seacAnalysisEnabled;
  35663. }
  35664. parse() {
  35665. const properties = this.properties;
  35666. const cff = new CFF();
  35667. this.cff = cff;
  35668. const header = this.parseHeader();
  35669. const nameIndex = this.parseIndex(header.endPos);
  35670. const topDictIndex = this.parseIndex(nameIndex.endPos);
  35671. const stringIndex = this.parseIndex(topDictIndex.endPos);
  35672. const globalSubrIndex = this.parseIndex(stringIndex.endPos);
  35673. const topDictParsed = this.parseDict(topDictIndex.obj.get(0));
  35674. const topDict = this.createDict(CFFTopDict, topDictParsed, cff.strings);
  35675. cff.header = header.obj;
  35676. cff.names = this.parseNameIndex(nameIndex.obj);
  35677. cff.strings = this.parseStringIndex(stringIndex.obj);
  35678. cff.topDict = topDict;
  35679. cff.globalSubrIndex = globalSubrIndex.obj;
  35680. this.parsePrivateDict(cff.topDict);
  35681. cff.isCIDFont = topDict.hasName("ROS");
  35682. const charStringOffset = topDict.getByName("CharStrings");
  35683. const charStringIndex = this.parseIndex(charStringOffset).obj;
  35684. const fontMatrix = topDict.getByName("FontMatrix");
  35685. if (fontMatrix) {
  35686. properties.fontMatrix = fontMatrix;
  35687. }
  35688. const fontBBox = topDict.getByName("FontBBox");
  35689. if (fontBBox) {
  35690. properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
  35691. properties.descent = Math.min(fontBBox[1], fontBBox[3]);
  35692. properties.ascentScaled = true;
  35693. }
  35694. let charset, encoding;
  35695. if (cff.isCIDFont) {
  35696. const fdArrayIndex = this.parseIndex(topDict.getByName("FDArray")).obj;
  35697. for (let i = 0, ii = fdArrayIndex.count; i < ii; ++i) {
  35698. const dictRaw = fdArrayIndex.get(i);
  35699. const fontDict = this.createDict(CFFTopDict, this.parseDict(dictRaw), cff.strings);
  35700. this.parsePrivateDict(fontDict);
  35701. cff.fdArray.push(fontDict);
  35702. }
  35703. encoding = null;
  35704. charset = this.parseCharsets(topDict.getByName("charset"), charStringIndex.count, cff.strings, true);
  35705. cff.fdSelect = this.parseFDSelect(topDict.getByName("FDSelect"), charStringIndex.count);
  35706. } else {
  35707. charset = this.parseCharsets(topDict.getByName("charset"), charStringIndex.count, cff.strings, false);
  35708. encoding = this.parseEncoding(topDict.getByName("Encoding"), properties, cff.strings, charset.charset);
  35709. }
  35710. cff.charset = charset;
  35711. cff.encoding = encoding;
  35712. const charStringsAndSeacs = this.parseCharStrings({
  35713. charStrings: charStringIndex,
  35714. localSubrIndex: topDict.privateDict.subrsIndex,
  35715. globalSubrIndex: globalSubrIndex.obj,
  35716. fdSelect: cff.fdSelect,
  35717. fdArray: cff.fdArray,
  35718. privateDict: topDict.privateDict
  35719. });
  35720. cff.charStrings = charStringsAndSeacs.charStrings;
  35721. cff.seacs = charStringsAndSeacs.seacs;
  35722. cff.widths = charStringsAndSeacs.widths;
  35723. return cff;
  35724. }
  35725. parseHeader() {
  35726. let bytes = this.bytes;
  35727. const bytesLength = bytes.length;
  35728. let offset = 0;
  35729. while (offset < bytesLength && bytes[offset] !== 1) {
  35730. ++offset;
  35731. }
  35732. if (offset >= bytesLength) {
  35733. throw new _util.FormatError("Invalid CFF header");
  35734. }
  35735. if (offset !== 0) {
  35736. (0, _util.info)("cff data is shifted");
  35737. bytes = bytes.subarray(offset);
  35738. this.bytes = bytes;
  35739. }
  35740. const major = bytes[0];
  35741. const minor = bytes[1];
  35742. const hdrSize = bytes[2];
  35743. const offSize = bytes[3];
  35744. const header = new CFFHeader(major, minor, hdrSize, offSize);
  35745. return {
  35746. obj: header,
  35747. endPos: hdrSize
  35748. };
  35749. }
  35750. parseDict(dict) {
  35751. let pos = 0;
  35752. function parseOperand() {
  35753. let value = dict[pos++];
  35754. if (value === 30) {
  35755. return parseFloatOperand();
  35756. } else if (value === 28) {
  35757. value = dict[pos++];
  35758. value = (value << 24 | dict[pos++] << 16) >> 16;
  35759. return value;
  35760. } else if (value === 29) {
  35761. value = dict[pos++];
  35762. value = value << 8 | dict[pos++];
  35763. value = value << 8 | dict[pos++];
  35764. value = value << 8 | dict[pos++];
  35765. return value;
  35766. } else if (value >= 32 && value <= 246) {
  35767. return value - 139;
  35768. } else if (value >= 247 && value <= 250) {
  35769. return (value - 247) * 256 + dict[pos++] + 108;
  35770. } else if (value >= 251 && value <= 254) {
  35771. return -((value - 251) * 256) - dict[pos++] - 108;
  35772. }
  35773. (0, _util.warn)('CFFParser_parseDict: "' + value + '" is a reserved command.');
  35774. return NaN;
  35775. }
  35776. function parseFloatOperand() {
  35777. let str = "";
  35778. const eof = 15;
  35779. const lookup = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ".", "E", "E-", null, "-"];
  35780. const length = dict.length;
  35781. while (pos < length) {
  35782. const b = dict[pos++];
  35783. const b1 = b >> 4;
  35784. const b2 = b & 15;
  35785. if (b1 === eof) {
  35786. break;
  35787. }
  35788. str += lookup[b1];
  35789. if (b2 === eof) {
  35790. break;
  35791. }
  35792. str += lookup[b2];
  35793. }
  35794. return parseFloat(str);
  35795. }
  35796. let operands = [];
  35797. const entries = [];
  35798. pos = 0;
  35799. const end = dict.length;
  35800. while (pos < end) {
  35801. let b = dict[pos];
  35802. if (b <= 21) {
  35803. if (b === 12) {
  35804. b = b << 8 | dict[++pos];
  35805. }
  35806. entries.push([b, operands]);
  35807. operands = [];
  35808. ++pos;
  35809. } else {
  35810. operands.push(parseOperand());
  35811. }
  35812. }
  35813. return entries;
  35814. }
  35815. parseIndex(pos) {
  35816. const cffIndex = new CFFIndex();
  35817. const bytes = this.bytes;
  35818. const count = bytes[pos++] << 8 | bytes[pos++];
  35819. const offsets = [];
  35820. let end = pos;
  35821. let i, ii;
  35822. if (count !== 0) {
  35823. const offsetSize = bytes[pos++];
  35824. const startPos = pos + (count + 1) * offsetSize - 1;
  35825. for (i = 0, ii = count + 1; i < ii; ++i) {
  35826. let offset = 0;
  35827. for (let j = 0; j < offsetSize; ++j) {
  35828. offset <<= 8;
  35829. offset += bytes[pos++];
  35830. }
  35831. offsets.push(startPos + offset);
  35832. }
  35833. end = offsets[count];
  35834. }
  35835. for (i = 0, ii = offsets.length - 1; i < ii; ++i) {
  35836. const offsetStart = offsets[i];
  35837. const offsetEnd = offsets[i + 1];
  35838. cffIndex.add(bytes.subarray(offsetStart, offsetEnd));
  35839. }
  35840. return {
  35841. obj: cffIndex,
  35842. endPos: end
  35843. };
  35844. }
  35845. parseNameIndex(index) {
  35846. const names = [];
  35847. for (let i = 0, ii = index.count; i < ii; ++i) {
  35848. const name = index.get(i);
  35849. names.push((0, _util.bytesToString)(name));
  35850. }
  35851. return names;
  35852. }
  35853. parseStringIndex(index) {
  35854. const strings = new CFFStrings();
  35855. for (let i = 0, ii = index.count; i < ii; ++i) {
  35856. const data = index.get(i);
  35857. strings.add((0, _util.bytesToString)(data));
  35858. }
  35859. return strings;
  35860. }
  35861. createDict(Type, dict, strings) {
  35862. const cffDict = new Type(strings);
  35863. for (let i = 0, ii = dict.length; i < ii; ++i) {
  35864. const pair = dict[i];
  35865. const key = pair[0];
  35866. const value = pair[1];
  35867. cffDict.setByKey(key, value);
  35868. }
  35869. return cffDict;
  35870. }
  35871. parseCharString(state, data, localSubrIndex, globalSubrIndex) {
  35872. if (!data || state.callDepth > MAX_SUBR_NESTING) {
  35873. return false;
  35874. }
  35875. let stackSize = state.stackSize;
  35876. const stack = state.stack;
  35877. const length = data.length;
  35878. for (let j = 0; j < length;) {
  35879. const value = data[j++];
  35880. let validationCommand = null;
  35881. if (value === 12) {
  35882. const q = data[j++];
  35883. if (q === 0) {
  35884. data[j - 2] = 139;
  35885. data[j - 1] = 22;
  35886. stackSize = 0;
  35887. } else {
  35888. validationCommand = CharstringValidationData12[q];
  35889. }
  35890. } else if (value === 28) {
  35891. stack[stackSize] = (data[j] << 24 | data[j + 1] << 16) >> 16;
  35892. j += 2;
  35893. stackSize++;
  35894. } else if (value === 14) {
  35895. if (stackSize >= 4) {
  35896. stackSize -= 4;
  35897. if (this.seacAnalysisEnabled) {
  35898. state.seac = stack.slice(stackSize, stackSize + 4);
  35899. return false;
  35900. }
  35901. }
  35902. validationCommand = CharstringValidationData[value];
  35903. } else if (value >= 32 && value <= 246) {
  35904. stack[stackSize] = value - 139;
  35905. stackSize++;
  35906. } else if (value >= 247 && value <= 254) {
  35907. stack[stackSize] = value < 251 ? (value - 247 << 8) + data[j] + 108 : -(value - 251 << 8) - data[j] - 108;
  35908. j++;
  35909. stackSize++;
  35910. } else if (value === 255) {
  35911. stack[stackSize] = (data[j] << 24 | data[j + 1] << 16 | data[j + 2] << 8 | data[j + 3]) / 65536;
  35912. j += 4;
  35913. stackSize++;
  35914. } else if (value === 19 || value === 20) {
  35915. state.hints += stackSize >> 1;
  35916. j += state.hints + 7 >> 3;
  35917. stackSize %= 2;
  35918. validationCommand = CharstringValidationData[value];
  35919. } else if (value === 10 || value === 29) {
  35920. let subrsIndex;
  35921. if (value === 10) {
  35922. subrsIndex = localSubrIndex;
  35923. } else {
  35924. subrsIndex = globalSubrIndex;
  35925. }
  35926. if (!subrsIndex) {
  35927. validationCommand = CharstringValidationData[value];
  35928. (0, _util.warn)("Missing subrsIndex for " + validationCommand.id);
  35929. return false;
  35930. }
  35931. let bias = 32768;
  35932. if (subrsIndex.count < 1240) {
  35933. bias = 107;
  35934. } else if (subrsIndex.count < 33900) {
  35935. bias = 1131;
  35936. }
  35937. const subrNumber = stack[--stackSize] + bias;
  35938. if (subrNumber < 0 || subrNumber >= subrsIndex.count || isNaN(subrNumber)) {
  35939. validationCommand = CharstringValidationData[value];
  35940. (0, _util.warn)("Out of bounds subrIndex for " + validationCommand.id);
  35941. return false;
  35942. }
  35943. state.stackSize = stackSize;
  35944. state.callDepth++;
  35945. const valid = this.parseCharString(state, subrsIndex.get(subrNumber), localSubrIndex, globalSubrIndex);
  35946. if (!valid) {
  35947. return false;
  35948. }
  35949. state.callDepth--;
  35950. stackSize = state.stackSize;
  35951. continue;
  35952. } else if (value === 11) {
  35953. state.stackSize = stackSize;
  35954. return true;
  35955. } else if (value === 0 && j === data.length) {
  35956. data[j - 1] = 14;
  35957. validationCommand = CharstringValidationData[14];
  35958. } else {
  35959. validationCommand = CharstringValidationData[value];
  35960. }
  35961. if (validationCommand) {
  35962. if (validationCommand.stem) {
  35963. state.hints += stackSize >> 1;
  35964. if (value === 3 || value === 23) {
  35965. state.hasVStems = true;
  35966. } else if (state.hasVStems && (value === 1 || value === 18)) {
  35967. (0, _util.warn)("CFF stem hints are in wrong order");
  35968. data[j - 1] = value === 1 ? 3 : 23;
  35969. }
  35970. }
  35971. if ("min" in validationCommand) {
  35972. if (!state.undefStack && stackSize < validationCommand.min) {
  35973. (0, _util.warn)("Not enough parameters for " + validationCommand.id + "; actual: " + stackSize + ", expected: " + validationCommand.min);
  35974. if (stackSize === 0) {
  35975. data[j - 1] = 14;
  35976. return true;
  35977. }
  35978. return false;
  35979. }
  35980. }
  35981. if (state.firstStackClearing && validationCommand.stackClearing) {
  35982. state.firstStackClearing = false;
  35983. stackSize -= validationCommand.min;
  35984. if (stackSize >= 2 && validationCommand.stem) {
  35985. stackSize %= 2;
  35986. } else if (stackSize > 1) {
  35987. (0, _util.warn)("Found too many parameters for stack-clearing command");
  35988. }
  35989. if (stackSize > 0) {
  35990. state.width = stack[stackSize - 1];
  35991. }
  35992. }
  35993. if ("stackDelta" in validationCommand) {
  35994. if ("stackFn" in validationCommand) {
  35995. validationCommand.stackFn(stack, stackSize);
  35996. }
  35997. stackSize += validationCommand.stackDelta;
  35998. } else if (validationCommand.stackClearing) {
  35999. stackSize = 0;
  36000. } else if (validationCommand.resetStack) {
  36001. stackSize = 0;
  36002. state.undefStack = false;
  36003. } else if (validationCommand.undefStack) {
  36004. stackSize = 0;
  36005. state.undefStack = true;
  36006. state.firstStackClearing = false;
  36007. }
  36008. }
  36009. }
  36010. state.stackSize = stackSize;
  36011. return true;
  36012. }
  36013. parseCharStrings({
  36014. charStrings,
  36015. localSubrIndex,
  36016. globalSubrIndex,
  36017. fdSelect,
  36018. fdArray,
  36019. privateDict
  36020. }) {
  36021. const seacs = [];
  36022. const widths = [];
  36023. const count = charStrings.count;
  36024. for (let i = 0; i < count; i++) {
  36025. const charstring = charStrings.get(i);
  36026. const state = {
  36027. callDepth: 0,
  36028. stackSize: 0,
  36029. stack: [],
  36030. undefStack: true,
  36031. hints: 0,
  36032. firstStackClearing: true,
  36033. seac: null,
  36034. width: null,
  36035. hasVStems: false
  36036. };
  36037. let valid = true;
  36038. let localSubrToUse = null;
  36039. let privateDictToUse = privateDict;
  36040. if (fdSelect && fdArray.length) {
  36041. const fdIndex = fdSelect.getFDIndex(i);
  36042. if (fdIndex === -1) {
  36043. (0, _util.warn)("Glyph index is not in fd select.");
  36044. valid = false;
  36045. }
  36046. if (fdIndex >= fdArray.length) {
  36047. (0, _util.warn)("Invalid fd index for glyph index.");
  36048. valid = false;
  36049. }
  36050. if (valid) {
  36051. privateDictToUse = fdArray[fdIndex].privateDict;
  36052. localSubrToUse = privateDictToUse.subrsIndex;
  36053. }
  36054. } else if (localSubrIndex) {
  36055. localSubrToUse = localSubrIndex;
  36056. }
  36057. if (valid) {
  36058. valid = this.parseCharString(state, charstring, localSubrToUse, globalSubrIndex);
  36059. }
  36060. if (state.width !== null) {
  36061. const nominalWidth = privateDictToUse.getByName("nominalWidthX");
  36062. widths[i] = nominalWidth + state.width;
  36063. } else {
  36064. const defaultWidth = privateDictToUse.getByName("defaultWidthX");
  36065. widths[i] = defaultWidth;
  36066. }
  36067. if (state.seac !== null) {
  36068. seacs[i] = state.seac;
  36069. }
  36070. if (!valid) {
  36071. charStrings.set(i, new Uint8Array([14]));
  36072. }
  36073. }
  36074. return {
  36075. charStrings,
  36076. seacs,
  36077. widths
  36078. };
  36079. }
  36080. emptyPrivateDictionary(parentDict) {
  36081. const privateDict = this.createDict(CFFPrivateDict, [], parentDict.strings);
  36082. parentDict.setByKey(18, [0, 0]);
  36083. parentDict.privateDict = privateDict;
  36084. }
  36085. parsePrivateDict(parentDict) {
  36086. if (!parentDict.hasName("Private")) {
  36087. this.emptyPrivateDictionary(parentDict);
  36088. return;
  36089. }
  36090. const privateOffset = parentDict.getByName("Private");
  36091. if (!Array.isArray(privateOffset) || privateOffset.length !== 2) {
  36092. parentDict.removeByName("Private");
  36093. return;
  36094. }
  36095. const size = privateOffset[0];
  36096. const offset = privateOffset[1];
  36097. if (size === 0 || offset >= this.bytes.length) {
  36098. this.emptyPrivateDictionary(parentDict);
  36099. return;
  36100. }
  36101. const privateDictEnd = offset + size;
  36102. const dictData = this.bytes.subarray(offset, privateDictEnd);
  36103. const dict = this.parseDict(dictData);
  36104. const privateDict = this.createDict(CFFPrivateDict, dict, parentDict.strings);
  36105. parentDict.privateDict = privateDict;
  36106. if (!privateDict.getByName("Subrs")) {
  36107. return;
  36108. }
  36109. const subrsOffset = privateDict.getByName("Subrs");
  36110. const relativeOffset = offset + subrsOffset;
  36111. if (subrsOffset === 0 || relativeOffset >= this.bytes.length) {
  36112. this.emptyPrivateDictionary(parentDict);
  36113. return;
  36114. }
  36115. const subrsIndex = this.parseIndex(relativeOffset);
  36116. privateDict.subrsIndex = subrsIndex.obj;
  36117. }
  36118. parseCharsets(pos, length, strings, cid) {
  36119. if (pos === 0) {
  36120. return new CFFCharset(true, CFFCharsetPredefinedTypes.ISO_ADOBE, _charsets.ISOAdobeCharset);
  36121. } else if (pos === 1) {
  36122. return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT, _charsets.ExpertCharset);
  36123. } else if (pos === 2) {
  36124. return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT_SUBSET, _charsets.ExpertSubsetCharset);
  36125. }
  36126. const bytes = this.bytes;
  36127. const start = pos;
  36128. const format = bytes[pos++];
  36129. const charset = [cid ? 0 : ".notdef"];
  36130. let id, count, i;
  36131. length -= 1;
  36132. switch (format) {
  36133. case 0:
  36134. for (i = 0; i < length; i++) {
  36135. id = bytes[pos++] << 8 | bytes[pos++];
  36136. charset.push(cid ? id : strings.get(id));
  36137. }
  36138. break;
  36139. case 1:
  36140. while (charset.length <= length) {
  36141. id = bytes[pos++] << 8 | bytes[pos++];
  36142. count = bytes[pos++];
  36143. for (i = 0; i <= count; i++) {
  36144. charset.push(cid ? id++ : strings.get(id++));
  36145. }
  36146. }
  36147. break;
  36148. case 2:
  36149. while (charset.length <= length) {
  36150. id = bytes[pos++] << 8 | bytes[pos++];
  36151. count = bytes[pos++] << 8 | bytes[pos++];
  36152. for (i = 0; i <= count; i++) {
  36153. charset.push(cid ? id++ : strings.get(id++));
  36154. }
  36155. }
  36156. break;
  36157. default:
  36158. throw new _util.FormatError("Unknown charset format");
  36159. }
  36160. const end = pos;
  36161. const raw = bytes.subarray(start, end);
  36162. return new CFFCharset(false, format, charset, raw);
  36163. }
  36164. parseEncoding(pos, properties, strings, charset) {
  36165. const encoding = Object.create(null);
  36166. const bytes = this.bytes;
  36167. let predefined = false;
  36168. let format, i, ii;
  36169. let raw = null;
  36170. function readSupplement() {
  36171. const supplementsCount = bytes[pos++];
  36172. for (i = 0; i < supplementsCount; i++) {
  36173. const code = bytes[pos++];
  36174. const sid = (bytes[pos++] << 8) + (bytes[pos++] & 0xff);
  36175. encoding[code] = charset.indexOf(strings.get(sid));
  36176. }
  36177. }
  36178. if (pos === 0 || pos === 1) {
  36179. predefined = true;
  36180. format = pos;
  36181. const baseEncoding = pos ? _encodings.ExpertEncoding : _encodings.StandardEncoding;
  36182. for (i = 0, ii = charset.length; i < ii; i++) {
  36183. const index = baseEncoding.indexOf(charset[i]);
  36184. if (index !== -1) {
  36185. encoding[index] = i;
  36186. }
  36187. }
  36188. } else {
  36189. const dataStart = pos;
  36190. format = bytes[pos++];
  36191. switch (format & 0x7f) {
  36192. case 0:
  36193. const glyphsCount = bytes[pos++];
  36194. for (i = 1; i <= glyphsCount; i++) {
  36195. encoding[bytes[pos++]] = i;
  36196. }
  36197. break;
  36198. case 1:
  36199. const rangesCount = bytes[pos++];
  36200. let gid = 1;
  36201. for (i = 0; i < rangesCount; i++) {
  36202. const start = bytes[pos++];
  36203. const left = bytes[pos++];
  36204. for (let j = start; j <= start + left; j++) {
  36205. encoding[j] = gid++;
  36206. }
  36207. }
  36208. break;
  36209. default:
  36210. throw new _util.FormatError(`Unknown encoding format: ${format} in CFF`);
  36211. }
  36212. const dataEnd = pos;
  36213. if (format & 0x80) {
  36214. bytes[dataStart] &= 0x7f;
  36215. readSupplement();
  36216. }
  36217. raw = bytes.subarray(dataStart, dataEnd);
  36218. }
  36219. format &= 0x7f;
  36220. return new CFFEncoding(predefined, format, encoding, raw);
  36221. }
  36222. parseFDSelect(pos, length) {
  36223. const bytes = this.bytes;
  36224. const format = bytes[pos++];
  36225. const fdSelect = [];
  36226. let i;
  36227. switch (format) {
  36228. case 0:
  36229. for (i = 0; i < length; ++i) {
  36230. const id = bytes[pos++];
  36231. fdSelect.push(id);
  36232. }
  36233. break;
  36234. case 3:
  36235. const rangesCount = bytes[pos++] << 8 | bytes[pos++];
  36236. for (i = 0; i < rangesCount; ++i) {
  36237. let first = bytes[pos++] << 8 | bytes[pos++];
  36238. if (i === 0 && first !== 0) {
  36239. (0, _util.warn)("parseFDSelect: The first range must have a first GID of 0" + " -- trying to recover.");
  36240. first = 0;
  36241. }
  36242. const fdIndex = bytes[pos++];
  36243. const next = bytes[pos] << 8 | bytes[pos + 1];
  36244. for (let j = first; j < next; ++j) {
  36245. fdSelect.push(fdIndex);
  36246. }
  36247. }
  36248. pos += 2;
  36249. break;
  36250. default:
  36251. throw new _util.FormatError(`parseFDSelect: Unknown format "${format}".`);
  36252. }
  36253. if (fdSelect.length !== length) {
  36254. throw new _util.FormatError("parseFDSelect: Invalid font data.");
  36255. }
  36256. return new CFFFDSelect(format, fdSelect);
  36257. }
  36258. }
  36259. return CFFParser;
  36260. }();
  36261. exports.CFFParser = CFFParser;
  36262. class CFF {
  36263. constructor() {
  36264. this.header = null;
  36265. this.names = [];
  36266. this.topDict = null;
  36267. this.strings = new CFFStrings();
  36268. this.globalSubrIndex = null;
  36269. this.encoding = null;
  36270. this.charset = null;
  36271. this.charStrings = null;
  36272. this.fdArray = [];
  36273. this.fdSelect = null;
  36274. this.isCIDFont = false;
  36275. }
  36276. duplicateFirstGlyph() {
  36277. if (this.charStrings.count >= 65535) {
  36278. (0, _util.warn)("Not enough space in charstrings to duplicate first glyph.");
  36279. return;
  36280. }
  36281. const glyphZero = this.charStrings.get(0);
  36282. this.charStrings.add(glyphZero);
  36283. if (this.isCIDFont) {
  36284. this.fdSelect.fdSelect.push(this.fdSelect.fdSelect[0]);
  36285. }
  36286. }
  36287. hasGlyphId(id) {
  36288. if (id < 0 || id >= this.charStrings.count) {
  36289. return false;
  36290. }
  36291. const glyph = this.charStrings.get(id);
  36292. return glyph.length > 0;
  36293. }
  36294. }
  36295. exports.CFF = CFF;
  36296. class CFFHeader {
  36297. constructor(major, minor, hdrSize, offSize) {
  36298. this.major = major;
  36299. this.minor = minor;
  36300. this.hdrSize = hdrSize;
  36301. this.offSize = offSize;
  36302. }
  36303. }
  36304. exports.CFFHeader = CFFHeader;
  36305. class CFFStrings {
  36306. constructor() {
  36307. this.strings = [];
  36308. }
  36309. get(index) {
  36310. if (index >= 0 && index <= NUM_STANDARD_CFF_STRINGS - 1) {
  36311. return CFFStandardStrings[index];
  36312. }
  36313. if (index - NUM_STANDARD_CFF_STRINGS <= this.strings.length) {
  36314. return this.strings[index - NUM_STANDARD_CFF_STRINGS];
  36315. }
  36316. return CFFStandardStrings[0];
  36317. }
  36318. getSID(str) {
  36319. let index = CFFStandardStrings.indexOf(str);
  36320. if (index !== -1) {
  36321. return index;
  36322. }
  36323. index = this.strings.indexOf(str);
  36324. if (index !== -1) {
  36325. return index + NUM_STANDARD_CFF_STRINGS;
  36326. }
  36327. return -1;
  36328. }
  36329. add(value) {
  36330. this.strings.push(value);
  36331. }
  36332. get count() {
  36333. return this.strings.length;
  36334. }
  36335. }
  36336. exports.CFFStrings = CFFStrings;
  36337. class CFFIndex {
  36338. constructor() {
  36339. this.objects = [];
  36340. this.length = 0;
  36341. }
  36342. add(data) {
  36343. this.length += data.length;
  36344. this.objects.push(data);
  36345. }
  36346. set(index, data) {
  36347. this.length += data.length - this.objects[index].length;
  36348. this.objects[index] = data;
  36349. }
  36350. get(index) {
  36351. return this.objects[index];
  36352. }
  36353. get count() {
  36354. return this.objects.length;
  36355. }
  36356. }
  36357. exports.CFFIndex = CFFIndex;
  36358. class CFFDict {
  36359. constructor(tables, strings) {
  36360. this.keyToNameMap = tables.keyToNameMap;
  36361. this.nameToKeyMap = tables.nameToKeyMap;
  36362. this.defaults = tables.defaults;
  36363. this.types = tables.types;
  36364. this.opcodes = tables.opcodes;
  36365. this.order = tables.order;
  36366. this.strings = strings;
  36367. this.values = Object.create(null);
  36368. }
  36369. setByKey(key, value) {
  36370. if (!(key in this.keyToNameMap)) {
  36371. return false;
  36372. }
  36373. const valueLength = value.length;
  36374. if (valueLength === 0) {
  36375. return true;
  36376. }
  36377. for (let i = 0; i < valueLength; i++) {
  36378. if (isNaN(value[i])) {
  36379. (0, _util.warn)('Invalid CFFDict value: "' + value + '" for key "' + key + '".');
  36380. return true;
  36381. }
  36382. }
  36383. const type = this.types[key];
  36384. if (type === "num" || type === "sid" || type === "offset") {
  36385. value = value[0];
  36386. }
  36387. this.values[key] = value;
  36388. return true;
  36389. }
  36390. setByName(name, value) {
  36391. if (!(name in this.nameToKeyMap)) {
  36392. throw new _util.FormatError(`Invalid dictionary name "${name}"`);
  36393. }
  36394. this.values[this.nameToKeyMap[name]] = value;
  36395. }
  36396. hasName(name) {
  36397. return this.nameToKeyMap[name] in this.values;
  36398. }
  36399. getByName(name) {
  36400. if (!(name in this.nameToKeyMap)) {
  36401. throw new _util.FormatError(`Invalid dictionary name ${name}"`);
  36402. }
  36403. const key = this.nameToKeyMap[name];
  36404. if (!(key in this.values)) {
  36405. return this.defaults[key];
  36406. }
  36407. return this.values[key];
  36408. }
  36409. removeByName(name) {
  36410. delete this.values[this.nameToKeyMap[name]];
  36411. }
  36412. static createTables(layout) {
  36413. const tables = {
  36414. keyToNameMap: {},
  36415. nameToKeyMap: {},
  36416. defaults: {},
  36417. types: {},
  36418. opcodes: {},
  36419. order: []
  36420. };
  36421. for (let i = 0, ii = layout.length; i < ii; ++i) {
  36422. const entry = layout[i];
  36423. const key = Array.isArray(entry[0]) ? (entry[0][0] << 8) + entry[0][1] : entry[0];
  36424. tables.keyToNameMap[key] = entry[1];
  36425. tables.nameToKeyMap[entry[1]] = key;
  36426. tables.types[key] = entry[2];
  36427. tables.defaults[key] = entry[3];
  36428. tables.opcodes[key] = Array.isArray(entry[0]) ? entry[0] : [entry[0]];
  36429. tables.order.push(key);
  36430. }
  36431. return tables;
  36432. }
  36433. }
  36434. const CFFTopDict = function CFFTopDictClosure() {
  36435. const layout = [[[12, 30], "ROS", ["sid", "sid", "num"], null], [[12, 20], "SyntheticBase", "num", null], [0, "version", "sid", null], [1, "Notice", "sid", null], [[12, 0], "Copyright", "sid", null], [2, "FullName", "sid", null], [3, "FamilyName", "sid", null], [4, "Weight", "sid", null], [[12, 1], "isFixedPitch", "num", 0], [[12, 2], "ItalicAngle", "num", 0], [[12, 3], "UnderlinePosition", "num", -100], [[12, 4], "UnderlineThickness", "num", 50], [[12, 5], "PaintType", "num", 0], [[12, 6], "CharstringType", "num", 2], [[12, 7], "FontMatrix", ["num", "num", "num", "num", "num", "num"], [0.001, 0, 0, 0.001, 0, 0]], [13, "UniqueID", "num", null], [5, "FontBBox", ["num", "num", "num", "num"], [0, 0, 0, 0]], [[12, 8], "StrokeWidth", "num", 0], [14, "XUID", "array", null], [15, "charset", "offset", 0], [16, "Encoding", "offset", 0], [17, "CharStrings", "offset", 0], [18, "Private", ["offset", "offset"], null], [[12, 21], "PostScript", "sid", null], [[12, 22], "BaseFontName", "sid", null], [[12, 23], "BaseFontBlend", "delta", null], [[12, 31], "CIDFontVersion", "num", 0], [[12, 32], "CIDFontRevision", "num", 0], [[12, 33], "CIDFontType", "num", 0], [[12, 34], "CIDCount", "num", 8720], [[12, 35], "UIDBase", "num", null], [[12, 37], "FDSelect", "offset", null], [[12, 36], "FDArray", "offset", null], [[12, 38], "FontName", "sid", null]];
  36436. let tables = null;
  36437. class CFFTopDict extends CFFDict {
  36438. constructor(strings) {
  36439. if (tables === null) {
  36440. tables = CFFDict.createTables(layout);
  36441. }
  36442. super(tables, strings);
  36443. this.privateDict = null;
  36444. }
  36445. }
  36446. return CFFTopDict;
  36447. }();
  36448. exports.CFFTopDict = CFFTopDict;
  36449. const CFFPrivateDict = function CFFPrivateDictClosure() {
  36450. const layout = [[6, "BlueValues", "delta", null], [7, "OtherBlues", "delta", null], [8, "FamilyBlues", "delta", null], [9, "FamilyOtherBlues", "delta", null], [[12, 9], "BlueScale", "num", 0.039625], [[12, 10], "BlueShift", "num", 7], [[12, 11], "BlueFuzz", "num", 1], [10, "StdHW", "num", null], [11, "StdVW", "num", null], [[12, 12], "StemSnapH", "delta", null], [[12, 13], "StemSnapV", "delta", null], [[12, 14], "ForceBold", "num", 0], [[12, 17], "LanguageGroup", "num", 0], [[12, 18], "ExpansionFactor", "num", 0.06], [[12, 19], "initialRandomSeed", "num", 0], [20, "defaultWidthX", "num", 0], [21, "nominalWidthX", "num", 0], [19, "Subrs", "offset", null]];
  36451. let tables = null;
  36452. class CFFPrivateDict extends CFFDict {
  36453. constructor(strings) {
  36454. if (tables === null) {
  36455. tables = CFFDict.createTables(layout);
  36456. }
  36457. super(tables, strings);
  36458. this.subrsIndex = null;
  36459. }
  36460. }
  36461. return CFFPrivateDict;
  36462. }();
  36463. exports.CFFPrivateDict = CFFPrivateDict;
  36464. const CFFCharsetPredefinedTypes = {
  36465. ISO_ADOBE: 0,
  36466. EXPERT: 1,
  36467. EXPERT_SUBSET: 2
  36468. };
  36469. class CFFCharset {
  36470. constructor(predefined, format, charset, raw) {
  36471. this.predefined = predefined;
  36472. this.format = format;
  36473. this.charset = charset;
  36474. this.raw = raw;
  36475. }
  36476. }
  36477. exports.CFFCharset = CFFCharset;
  36478. class CFFEncoding {
  36479. constructor(predefined, format, encoding, raw) {
  36480. this.predefined = predefined;
  36481. this.format = format;
  36482. this.encoding = encoding;
  36483. this.raw = raw;
  36484. }
  36485. }
  36486. class CFFFDSelect {
  36487. constructor(format, fdSelect) {
  36488. this.format = format;
  36489. this.fdSelect = fdSelect;
  36490. }
  36491. getFDIndex(glyphIndex) {
  36492. if (glyphIndex < 0 || glyphIndex >= this.fdSelect.length) {
  36493. return -1;
  36494. }
  36495. return this.fdSelect[glyphIndex];
  36496. }
  36497. }
  36498. exports.CFFFDSelect = CFFFDSelect;
  36499. class CFFOffsetTracker {
  36500. constructor() {
  36501. this.offsets = Object.create(null);
  36502. }
  36503. isTracking(key) {
  36504. return key in this.offsets;
  36505. }
  36506. track(key, location) {
  36507. if (key in this.offsets) {
  36508. throw new _util.FormatError(`Already tracking location of ${key}`);
  36509. }
  36510. this.offsets[key] = location;
  36511. }
  36512. offset(value) {
  36513. for (const key in this.offsets) {
  36514. this.offsets[key] += value;
  36515. }
  36516. }
  36517. setEntryLocation(key, values, output) {
  36518. if (!(key in this.offsets)) {
  36519. throw new _util.FormatError(`Not tracking location of ${key}`);
  36520. }
  36521. const data = output.data;
  36522. const dataOffset = this.offsets[key];
  36523. const size = 5;
  36524. for (let i = 0, ii = values.length; i < ii; ++i) {
  36525. const offset0 = i * size + dataOffset;
  36526. const offset1 = offset0 + 1;
  36527. const offset2 = offset0 + 2;
  36528. const offset3 = offset0 + 3;
  36529. const offset4 = offset0 + 4;
  36530. if (data[offset0] !== 0x1d || data[offset1] !== 0 || data[offset2] !== 0 || data[offset3] !== 0 || data[offset4] !== 0) {
  36531. throw new _util.FormatError("writing to an offset that is not empty");
  36532. }
  36533. const value = values[i];
  36534. data[offset0] = 0x1d;
  36535. data[offset1] = value >> 24 & 0xff;
  36536. data[offset2] = value >> 16 & 0xff;
  36537. data[offset3] = value >> 8 & 0xff;
  36538. data[offset4] = value & 0xff;
  36539. }
  36540. }
  36541. }
  36542. class CFFCompiler {
  36543. constructor(cff) {
  36544. this.cff = cff;
  36545. }
  36546. compile() {
  36547. const cff = this.cff;
  36548. const output = {
  36549. data: [],
  36550. length: 0,
  36551. add(data) {
  36552. this.data = this.data.concat(data);
  36553. this.length = this.data.length;
  36554. }
  36555. };
  36556. const header = this.compileHeader(cff.header);
  36557. output.add(header);
  36558. const nameIndex = this.compileNameIndex(cff.names);
  36559. output.add(nameIndex);
  36560. if (cff.isCIDFont) {
  36561. if (cff.topDict.hasName("FontMatrix")) {
  36562. const base = cff.topDict.getByName("FontMatrix");
  36563. cff.topDict.removeByName("FontMatrix");
  36564. for (let i = 0, ii = cff.fdArray.length; i < ii; i++) {
  36565. const subDict = cff.fdArray[i];
  36566. let matrix = base.slice(0);
  36567. if (subDict.hasName("FontMatrix")) {
  36568. matrix = _util.Util.transform(matrix, subDict.getByName("FontMatrix"));
  36569. }
  36570. subDict.setByName("FontMatrix", matrix);
  36571. }
  36572. }
  36573. }
  36574. const xuid = cff.topDict.getByName("XUID");
  36575. if (xuid && xuid.length > 16) {
  36576. cff.topDict.removeByName("XUID");
  36577. }
  36578. cff.topDict.setByName("charset", 0);
  36579. let compiled = this.compileTopDicts([cff.topDict], output.length, cff.isCIDFont);
  36580. output.add(compiled.output);
  36581. const topDictTracker = compiled.trackers[0];
  36582. const stringIndex = this.compileStringIndex(cff.strings.strings);
  36583. output.add(stringIndex);
  36584. const globalSubrIndex = this.compileIndex(cff.globalSubrIndex);
  36585. output.add(globalSubrIndex);
  36586. if (cff.encoding && cff.topDict.hasName("Encoding")) {
  36587. if (cff.encoding.predefined) {
  36588. topDictTracker.setEntryLocation("Encoding", [cff.encoding.format], output);
  36589. } else {
  36590. const encoding = this.compileEncoding(cff.encoding);
  36591. topDictTracker.setEntryLocation("Encoding", [output.length], output);
  36592. output.add(encoding);
  36593. }
  36594. }
  36595. const charset = this.compileCharset(cff.charset, cff.charStrings.count, cff.strings, cff.isCIDFont);
  36596. topDictTracker.setEntryLocation("charset", [output.length], output);
  36597. output.add(charset);
  36598. const charStrings = this.compileCharStrings(cff.charStrings);
  36599. topDictTracker.setEntryLocation("CharStrings", [output.length], output);
  36600. output.add(charStrings);
  36601. if (cff.isCIDFont) {
  36602. topDictTracker.setEntryLocation("FDSelect", [output.length], output);
  36603. const fdSelect = this.compileFDSelect(cff.fdSelect);
  36604. output.add(fdSelect);
  36605. compiled = this.compileTopDicts(cff.fdArray, output.length, true);
  36606. topDictTracker.setEntryLocation("FDArray", [output.length], output);
  36607. output.add(compiled.output);
  36608. const fontDictTrackers = compiled.trackers;
  36609. this.compilePrivateDicts(cff.fdArray, fontDictTrackers, output);
  36610. }
  36611. this.compilePrivateDicts([cff.topDict], [topDictTracker], output);
  36612. output.add([0]);
  36613. return output.data;
  36614. }
  36615. encodeNumber(value) {
  36616. if (Number.isInteger(value)) {
  36617. return this.encodeInteger(value);
  36618. }
  36619. return this.encodeFloat(value);
  36620. }
  36621. static get EncodeFloatRegExp() {
  36622. return (0, _util.shadow)(this, "EncodeFloatRegExp", /\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/);
  36623. }
  36624. encodeFloat(num) {
  36625. let value = num.toString();
  36626. const m = CFFCompiler.EncodeFloatRegExp.exec(value);
  36627. if (m) {
  36628. const epsilon = parseFloat("1e" + ((m[2] ? +m[2] : 0) + m[1].length));
  36629. value = (Math.round(num * epsilon) / epsilon).toString();
  36630. }
  36631. let nibbles = "";
  36632. let i, ii;
  36633. for (i = 0, ii = value.length; i < ii; ++i) {
  36634. const a = value[i];
  36635. if (a === "e") {
  36636. nibbles += value[++i] === "-" ? "c" : "b";
  36637. } else if (a === ".") {
  36638. nibbles += "a";
  36639. } else if (a === "-") {
  36640. nibbles += "e";
  36641. } else {
  36642. nibbles += a;
  36643. }
  36644. }
  36645. nibbles += nibbles.length & 1 ? "f" : "ff";
  36646. const out = [30];
  36647. for (i = 0, ii = nibbles.length; i < ii; i += 2) {
  36648. out.push(parseInt(nibbles.substring(i, i + 2), 16));
  36649. }
  36650. return out;
  36651. }
  36652. encodeInteger(value) {
  36653. let code;
  36654. if (value >= -107 && value <= 107) {
  36655. code = [value + 139];
  36656. } else if (value >= 108 && value <= 1131) {
  36657. value -= 108;
  36658. code = [(value >> 8) + 247, value & 0xff];
  36659. } else if (value >= -1131 && value <= -108) {
  36660. value = -value - 108;
  36661. code = [(value >> 8) + 251, value & 0xff];
  36662. } else if (value >= -32768 && value <= 32767) {
  36663. code = [0x1c, value >> 8 & 0xff, value & 0xff];
  36664. } else {
  36665. code = [0x1d, value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff];
  36666. }
  36667. return code;
  36668. }
  36669. compileHeader(header) {
  36670. return [header.major, header.minor, 4, header.offSize];
  36671. }
  36672. compileNameIndex(names) {
  36673. const nameIndex = new CFFIndex();
  36674. for (let i = 0, ii = names.length; i < ii; ++i) {
  36675. const name = names[i];
  36676. const length = Math.min(name.length, 127);
  36677. let sanitizedName = new Array(length);
  36678. for (let j = 0; j < length; j++) {
  36679. let char = name[j];
  36680. if (char < "!" || char > "~" || char === "[" || char === "]" || char === "(" || char === ")" || char === "{" || char === "}" || char === "<" || char === ">" || char === "/" || char === "%") {
  36681. char = "_";
  36682. }
  36683. sanitizedName[j] = char;
  36684. }
  36685. sanitizedName = sanitizedName.join("");
  36686. if (sanitizedName === "") {
  36687. sanitizedName = "Bad_Font_Name";
  36688. }
  36689. nameIndex.add((0, _util.stringToBytes)(sanitizedName));
  36690. }
  36691. return this.compileIndex(nameIndex);
  36692. }
  36693. compileTopDicts(dicts, length, removeCidKeys) {
  36694. const fontDictTrackers = [];
  36695. let fdArrayIndex = new CFFIndex();
  36696. for (let i = 0, ii = dicts.length; i < ii; ++i) {
  36697. const fontDict = dicts[i];
  36698. if (removeCidKeys) {
  36699. fontDict.removeByName("CIDFontVersion");
  36700. fontDict.removeByName("CIDFontRevision");
  36701. fontDict.removeByName("CIDFontType");
  36702. fontDict.removeByName("CIDCount");
  36703. fontDict.removeByName("UIDBase");
  36704. }
  36705. const fontDictTracker = new CFFOffsetTracker();
  36706. const fontDictData = this.compileDict(fontDict, fontDictTracker);
  36707. fontDictTrackers.push(fontDictTracker);
  36708. fdArrayIndex.add(fontDictData);
  36709. fontDictTracker.offset(length);
  36710. }
  36711. fdArrayIndex = this.compileIndex(fdArrayIndex, fontDictTrackers);
  36712. return {
  36713. trackers: fontDictTrackers,
  36714. output: fdArrayIndex
  36715. };
  36716. }
  36717. compilePrivateDicts(dicts, trackers, output) {
  36718. for (let i = 0, ii = dicts.length; i < ii; ++i) {
  36719. const fontDict = dicts[i];
  36720. const privateDict = fontDict.privateDict;
  36721. if (!privateDict || !fontDict.hasName("Private")) {
  36722. throw new _util.FormatError("There must be a private dictionary.");
  36723. }
  36724. const privateDictTracker = new CFFOffsetTracker();
  36725. const privateDictData = this.compileDict(privateDict, privateDictTracker);
  36726. let outputLength = output.length;
  36727. privateDictTracker.offset(outputLength);
  36728. if (!privateDictData.length) {
  36729. outputLength = 0;
  36730. }
  36731. trackers[i].setEntryLocation("Private", [privateDictData.length, outputLength], output);
  36732. output.add(privateDictData);
  36733. if (privateDict.subrsIndex && privateDict.hasName("Subrs")) {
  36734. const subrs = this.compileIndex(privateDict.subrsIndex);
  36735. privateDictTracker.setEntryLocation("Subrs", [privateDictData.length], output);
  36736. output.add(subrs);
  36737. }
  36738. }
  36739. }
  36740. compileDict(dict, offsetTracker) {
  36741. const out = [];
  36742. for (const key of dict.order) {
  36743. if (!(key in dict.values)) {
  36744. continue;
  36745. }
  36746. let values = dict.values[key];
  36747. let types = dict.types[key];
  36748. if (!Array.isArray(types)) {
  36749. types = [types];
  36750. }
  36751. if (!Array.isArray(values)) {
  36752. values = [values];
  36753. }
  36754. if (values.length === 0) {
  36755. continue;
  36756. }
  36757. for (let j = 0, jj = types.length; j < jj; ++j) {
  36758. const type = types[j];
  36759. const value = values[j];
  36760. switch (type) {
  36761. case "num":
  36762. case "sid":
  36763. out.push(...this.encodeNumber(value));
  36764. break;
  36765. case "offset":
  36766. const name = dict.keyToNameMap[key];
  36767. if (!offsetTracker.isTracking(name)) {
  36768. offsetTracker.track(name, out.length);
  36769. }
  36770. out.push(0x1d, 0, 0, 0, 0);
  36771. break;
  36772. case "array":
  36773. case "delta":
  36774. out.push(...this.encodeNumber(value));
  36775. for (let k = 1, kk = values.length; k < kk; ++k) {
  36776. out.push(...this.encodeNumber(values[k]));
  36777. }
  36778. break;
  36779. default:
  36780. throw new _util.FormatError(`Unknown data type of ${type}`);
  36781. }
  36782. }
  36783. out.push(...dict.opcodes[key]);
  36784. }
  36785. return out;
  36786. }
  36787. compileStringIndex(strings) {
  36788. const stringIndex = new CFFIndex();
  36789. for (let i = 0, ii = strings.length; i < ii; ++i) {
  36790. stringIndex.add((0, _util.stringToBytes)(strings[i]));
  36791. }
  36792. return this.compileIndex(stringIndex);
  36793. }
  36794. compileGlobalSubrIndex() {
  36795. const globalSubrIndex = this.cff.globalSubrIndex;
  36796. this.out.writeByteArray(this.compileIndex(globalSubrIndex));
  36797. }
  36798. compileCharStrings(charStrings) {
  36799. const charStringsIndex = new CFFIndex();
  36800. for (let i = 0; i < charStrings.count; i++) {
  36801. const glyph = charStrings.get(i);
  36802. if (glyph.length === 0) {
  36803. charStringsIndex.add(new Uint8Array([0x8b, 0x0e]));
  36804. continue;
  36805. }
  36806. charStringsIndex.add(glyph);
  36807. }
  36808. return this.compileIndex(charStringsIndex);
  36809. }
  36810. compileCharset(charset, numGlyphs, strings, isCIDFont) {
  36811. let out;
  36812. const numGlyphsLessNotDef = numGlyphs - 1;
  36813. if (isCIDFont) {
  36814. out = new Uint8Array([2, 0, 0, numGlyphsLessNotDef >> 8 & 0xff, numGlyphsLessNotDef & 0xff]);
  36815. } else {
  36816. const length = 1 + numGlyphsLessNotDef * 2;
  36817. out = new Uint8Array(length);
  36818. out[0] = 0;
  36819. let charsetIndex = 0;
  36820. const numCharsets = charset.charset.length;
  36821. let warned = false;
  36822. for (let i = 1; i < out.length; i += 2) {
  36823. let sid = 0;
  36824. if (charsetIndex < numCharsets) {
  36825. const name = charset.charset[charsetIndex++];
  36826. sid = strings.getSID(name);
  36827. if (sid === -1) {
  36828. sid = 0;
  36829. if (!warned) {
  36830. warned = true;
  36831. (0, _util.warn)(`Couldn't find ${name} in CFF strings`);
  36832. }
  36833. }
  36834. }
  36835. out[i] = sid >> 8 & 0xff;
  36836. out[i + 1] = sid & 0xff;
  36837. }
  36838. }
  36839. return this.compileTypedArray(out);
  36840. }
  36841. compileEncoding(encoding) {
  36842. return this.compileTypedArray(encoding.raw);
  36843. }
  36844. compileFDSelect(fdSelect) {
  36845. const format = fdSelect.format;
  36846. let out, i;
  36847. switch (format) {
  36848. case 0:
  36849. out = new Uint8Array(1 + fdSelect.fdSelect.length);
  36850. out[0] = format;
  36851. for (i = 0; i < fdSelect.fdSelect.length; i++) {
  36852. out[i + 1] = fdSelect.fdSelect[i];
  36853. }
  36854. break;
  36855. case 3:
  36856. const start = 0;
  36857. let lastFD = fdSelect.fdSelect[0];
  36858. const ranges = [format, 0, 0, start >> 8 & 0xff, start & 0xff, lastFD];
  36859. for (i = 1; i < fdSelect.fdSelect.length; i++) {
  36860. const currentFD = fdSelect.fdSelect[i];
  36861. if (currentFD !== lastFD) {
  36862. ranges.push(i >> 8 & 0xff, i & 0xff, currentFD);
  36863. lastFD = currentFD;
  36864. }
  36865. }
  36866. const numRanges = (ranges.length - 3) / 3;
  36867. ranges[1] = numRanges >> 8 & 0xff;
  36868. ranges[2] = numRanges & 0xff;
  36869. ranges.push(i >> 8 & 0xff, i & 0xff);
  36870. out = new Uint8Array(ranges);
  36871. break;
  36872. }
  36873. return this.compileTypedArray(out);
  36874. }
  36875. compileTypedArray(data) {
  36876. const out = [];
  36877. for (let i = 0, ii = data.length; i < ii; ++i) {
  36878. out[i] = data[i];
  36879. }
  36880. return out;
  36881. }
  36882. compileIndex(index, trackers = []) {
  36883. const objects = index.objects;
  36884. const count = objects.length;
  36885. if (count === 0) {
  36886. return [0, 0, 0];
  36887. }
  36888. const data = [count >> 8 & 0xff, count & 0xff];
  36889. let lastOffset = 1,
  36890. i;
  36891. for (i = 0; i < count; ++i) {
  36892. lastOffset += objects[i].length;
  36893. }
  36894. let offsetSize;
  36895. if (lastOffset < 0x100) {
  36896. offsetSize = 1;
  36897. } else if (lastOffset < 0x10000) {
  36898. offsetSize = 2;
  36899. } else if (lastOffset < 0x1000000) {
  36900. offsetSize = 3;
  36901. } else {
  36902. offsetSize = 4;
  36903. }
  36904. data.push(offsetSize);
  36905. let relativeOffset = 1;
  36906. for (i = 0; i < count + 1; i++) {
  36907. if (offsetSize === 1) {
  36908. data.push(relativeOffset & 0xff);
  36909. } else if (offsetSize === 2) {
  36910. data.push(relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
  36911. } else if (offsetSize === 3) {
  36912. data.push(relativeOffset >> 16 & 0xff, relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
  36913. } else {
  36914. data.push(relativeOffset >>> 24 & 0xff, relativeOffset >> 16 & 0xff, relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
  36915. }
  36916. if (objects[i]) {
  36917. relativeOffset += objects[i].length;
  36918. }
  36919. }
  36920. for (i = 0; i < count; i++) {
  36921. if (trackers[i]) {
  36922. trackers[i].offset(data.length);
  36923. }
  36924. for (let j = 0, jj = objects[i].length; j < jj; j++) {
  36925. data.push(objects[i][j]);
  36926. }
  36927. }
  36928. return data;
  36929. }
  36930. }
  36931. exports.CFFCompiler = CFFCompiler;
  36932. /***/ }),
  36933. /* 46 */
  36934. /***/ ((__unused_webpack_module, exports) => {
  36935. Object.defineProperty(exports, "__esModule", ({
  36936. value: true
  36937. }));
  36938. exports.ISOAdobeCharset = exports.ExpertSubsetCharset = exports.ExpertCharset = void 0;
  36939. 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"];
  36940. exports.ISOAdobeCharset = ISOAdobeCharset;
  36941. 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"];
  36942. exports.ExpertCharset = ExpertCharset;
  36943. 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"];
  36944. exports.ExpertSubsetCharset = ExpertSubsetCharset;
  36945. /***/ }),
  36946. /* 47 */
  36947. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  36948. Object.defineProperty(exports, "__esModule", ({
  36949. value: true
  36950. }));
  36951. exports.getSerifFonts = exports.getNonStdFontMap = exports.getGlyphMapForStandardFonts = exports.getFontNameToFileMap = void 0;
  36952. exports.getStandardFontName = getStandardFontName;
  36953. exports.getSymbolsFonts = exports.getSupplementalGlyphMapForCalibri = exports.getSupplementalGlyphMapForArialBlack = exports.getStdFontMap = void 0;
  36954. var _core_utils = __w_pdfjs_require__(6);
  36955. var _fonts_utils = __w_pdfjs_require__(18);
  36956. const getStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  36957. t["Times-Roman"] = "Times-Roman";
  36958. t.Helvetica = "Helvetica";
  36959. t.Courier = "Courier";
  36960. t.Symbol = "Symbol";
  36961. t["Times-Bold"] = "Times-Bold";
  36962. t["Helvetica-Bold"] = "Helvetica-Bold";
  36963. t["Courier-Bold"] = "Courier-Bold";
  36964. t.ZapfDingbats = "ZapfDingbats";
  36965. t["Times-Italic"] = "Times-Italic";
  36966. t["Helvetica-Oblique"] = "Helvetica-Oblique";
  36967. t["Courier-Oblique"] = "Courier-Oblique";
  36968. t["Times-BoldItalic"] = "Times-BoldItalic";
  36969. t["Helvetica-BoldOblique"] = "Helvetica-BoldOblique";
  36970. t["Courier-BoldOblique"] = "Courier-BoldOblique";
  36971. t.ArialNarrow = "Helvetica";
  36972. t["ArialNarrow-Bold"] = "Helvetica-Bold";
  36973. t["ArialNarrow-BoldItalic"] = "Helvetica-BoldOblique";
  36974. t["ArialNarrow-Italic"] = "Helvetica-Oblique";
  36975. t.ArialBlack = "Helvetica";
  36976. t["ArialBlack-Bold"] = "Helvetica-Bold";
  36977. t["ArialBlack-BoldItalic"] = "Helvetica-BoldOblique";
  36978. t["ArialBlack-Italic"] = "Helvetica-Oblique";
  36979. t["Arial-Black"] = "Helvetica";
  36980. t["Arial-Black-Bold"] = "Helvetica-Bold";
  36981. t["Arial-Black-BoldItalic"] = "Helvetica-BoldOblique";
  36982. t["Arial-Black-Italic"] = "Helvetica-Oblique";
  36983. t.Arial = "Helvetica";
  36984. t["Arial-Bold"] = "Helvetica-Bold";
  36985. t["Arial-BoldItalic"] = "Helvetica-BoldOblique";
  36986. t["Arial-Italic"] = "Helvetica-Oblique";
  36987. t.ArialMT = "Helvetica";
  36988. t["Arial-BoldItalicMT"] = "Helvetica-BoldOblique";
  36989. t["Arial-BoldMT"] = "Helvetica-Bold";
  36990. t["Arial-ItalicMT"] = "Helvetica-Oblique";
  36991. t.ArialUnicodeMS = "Helvetica";
  36992. t["ArialUnicodeMS-Bold"] = "Helvetica-Bold";
  36993. t["ArialUnicodeMS-BoldItalic"] = "Helvetica-BoldOblique";
  36994. t["ArialUnicodeMS-Italic"] = "Helvetica-Oblique";
  36995. t["Courier-BoldItalic"] = "Courier-BoldOblique";
  36996. t["Courier-Italic"] = "Courier-Oblique";
  36997. t.CourierNew = "Courier";
  36998. t["CourierNew-Bold"] = "Courier-Bold";
  36999. t["CourierNew-BoldItalic"] = "Courier-BoldOblique";
  37000. t["CourierNew-Italic"] = "Courier-Oblique";
  37001. t["CourierNewPS-BoldItalicMT"] = "Courier-BoldOblique";
  37002. t["CourierNewPS-BoldMT"] = "Courier-Bold";
  37003. t["CourierNewPS-ItalicMT"] = "Courier-Oblique";
  37004. t.CourierNewPSMT = "Courier";
  37005. t["Helvetica-BoldItalic"] = "Helvetica-BoldOblique";
  37006. t["Helvetica-Italic"] = "Helvetica-Oblique";
  37007. t["Symbol-Bold"] = "Symbol";
  37008. t["Symbol-BoldItalic"] = "Symbol";
  37009. t["Symbol-Italic"] = "Symbol";
  37010. t.TimesNewRoman = "Times-Roman";
  37011. t["TimesNewRoman-Bold"] = "Times-Bold";
  37012. t["TimesNewRoman-BoldItalic"] = "Times-BoldItalic";
  37013. t["TimesNewRoman-Italic"] = "Times-Italic";
  37014. t.TimesNewRomanPS = "Times-Roman";
  37015. t["TimesNewRomanPS-Bold"] = "Times-Bold";
  37016. t["TimesNewRomanPS-BoldItalic"] = "Times-BoldItalic";
  37017. t["TimesNewRomanPS-BoldItalicMT"] = "Times-BoldItalic";
  37018. t["TimesNewRomanPS-BoldMT"] = "Times-Bold";
  37019. t["TimesNewRomanPS-Italic"] = "Times-Italic";
  37020. t["TimesNewRomanPS-ItalicMT"] = "Times-Italic";
  37021. t.TimesNewRomanPSMT = "Times-Roman";
  37022. t["TimesNewRomanPSMT-Bold"] = "Times-Bold";
  37023. t["TimesNewRomanPSMT-BoldItalic"] = "Times-BoldItalic";
  37024. t["TimesNewRomanPSMT-Italic"] = "Times-Italic";
  37025. });
  37026. exports.getStdFontMap = getStdFontMap;
  37027. const getFontNameToFileMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  37028. t.Courier = "FoxitFixed.pfb";
  37029. t["Courier-Bold"] = "FoxitFixedBold.pfb";
  37030. t["Courier-BoldOblique"] = "FoxitFixedBoldItalic.pfb";
  37031. t["Courier-Oblique"] = "FoxitFixedItalic.pfb";
  37032. t.Helvetica = "FoxitSans.pfb";
  37033. t["Helvetica-Bold"] = "FoxitSansBold.pfb";
  37034. t["Helvetica-BoldOblique"] = "FoxitSansBoldItalic.pfb";
  37035. t["Helvetica-Oblique"] = "FoxitSansItalic.pfb";
  37036. t["Times-Roman"] = "FoxitSerif.pfb";
  37037. t["Times-Bold"] = "FoxitSerifBold.pfb";
  37038. t["Times-BoldItalic"] = "FoxitSerifBoldItalic.pfb";
  37039. t["Times-Italic"] = "FoxitSerifItalic.pfb";
  37040. t.Symbol = "FoxitSymbol.pfb";
  37041. t.ZapfDingbats = "FoxitDingbats.pfb";
  37042. t["LiberationSans-Regular"] = "LiberationSans-Regular.ttf";
  37043. t["LiberationSans-Bold"] = "LiberationSans-Bold.ttf";
  37044. t["LiberationSans-Italic"] = "LiberationSans-Italic.ttf";
  37045. t["LiberationSans-BoldItalic"] = "LiberationSans-BoldItalic.ttf";
  37046. });
  37047. exports.getFontNameToFileMap = getFontNameToFileMap;
  37048. const getNonStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  37049. t.Calibri = "Helvetica";
  37050. t["Calibri-Bold"] = "Helvetica-Bold";
  37051. t["Calibri-BoldItalic"] = "Helvetica-BoldOblique";
  37052. t["Calibri-Italic"] = "Helvetica-Oblique";
  37053. t.CenturyGothic = "Helvetica";
  37054. t["CenturyGothic-Bold"] = "Helvetica-Bold";
  37055. t["CenturyGothic-BoldItalic"] = "Helvetica-BoldOblique";
  37056. t["CenturyGothic-Italic"] = "Helvetica-Oblique";
  37057. t.ComicSansMS = "Comic Sans MS";
  37058. t["ComicSansMS-Bold"] = "Comic Sans MS-Bold";
  37059. t["ComicSansMS-BoldItalic"] = "Comic Sans MS-BoldItalic";
  37060. t["ComicSansMS-Italic"] = "Comic Sans MS-Italic";
  37061. t["ItcSymbol-Bold"] = "Helvetica-Bold";
  37062. t["ItcSymbol-BoldItalic"] = "Helvetica-BoldOblique";
  37063. t["ItcSymbol-Book"] = "Helvetica";
  37064. t["ItcSymbol-BookItalic"] = "Helvetica-Oblique";
  37065. t["ItcSymbol-Medium"] = "Helvetica";
  37066. t["ItcSymbol-MediumItalic"] = "Helvetica-Oblique";
  37067. t.LucidaConsole = "Courier";
  37068. t["LucidaConsole-Bold"] = "Courier-Bold";
  37069. t["LucidaConsole-BoldItalic"] = "Courier-BoldOblique";
  37070. t["LucidaConsole-Italic"] = "Courier-Oblique";
  37071. t["LucidaSans-Demi"] = "Helvetica-Bold";
  37072. t["MS-Gothic"] = "MS Gothic";
  37073. t["MS-Gothic-Bold"] = "MS Gothic-Bold";
  37074. t["MS-Gothic-BoldItalic"] = "MS Gothic-BoldItalic";
  37075. t["MS-Gothic-Italic"] = "MS Gothic-Italic";
  37076. t["MS-Mincho"] = "MS Mincho";
  37077. t["MS-Mincho-Bold"] = "MS Mincho-Bold";
  37078. t["MS-Mincho-BoldItalic"] = "MS Mincho-BoldItalic";
  37079. t["MS-Mincho-Italic"] = "MS Mincho-Italic";
  37080. t["MS-PGothic"] = "MS PGothic";
  37081. t["MS-PGothic-Bold"] = "MS PGothic-Bold";
  37082. t["MS-PGothic-BoldItalic"] = "MS PGothic-BoldItalic";
  37083. t["MS-PGothic-Italic"] = "MS PGothic-Italic";
  37084. t["MS-PMincho"] = "MS PMincho";
  37085. t["MS-PMincho-Bold"] = "MS PMincho-Bold";
  37086. t["MS-PMincho-BoldItalic"] = "MS PMincho-BoldItalic";
  37087. t["MS-PMincho-Italic"] = "MS PMincho-Italic";
  37088. t.NuptialScript = "Times-Italic";
  37089. t.SegoeUISymbol = "Helvetica";
  37090. t.Wingdings = "ZapfDingbats";
  37091. t["Wingdings-Regular"] = "ZapfDingbats";
  37092. });
  37093. exports.getNonStdFontMap = getNonStdFontMap;
  37094. const getSerifFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
  37095. t["Adobe Jenson"] = true;
  37096. t["Adobe Text"] = true;
  37097. t.Albertus = true;
  37098. t.Aldus = true;
  37099. t.Alexandria = true;
  37100. t.Algerian = true;
  37101. t["American Typewriter"] = true;
  37102. t.Antiqua = true;
  37103. t.Apex = true;
  37104. t.Arno = true;
  37105. t.Aster = true;
  37106. t.Aurora = true;
  37107. t.Baskerville = true;
  37108. t.Bell = true;
  37109. t.Bembo = true;
  37110. t["Bembo Schoolbook"] = true;
  37111. t.Benguiat = true;
  37112. t["Berkeley Old Style"] = true;
  37113. t["Bernhard Modern"] = true;
  37114. t["Berthold City"] = true;
  37115. t.Bodoni = true;
  37116. t["Bauer Bodoni"] = true;
  37117. t["Book Antiqua"] = true;
  37118. t.Bookman = true;
  37119. t["Bordeaux Roman"] = true;
  37120. t["Californian FB"] = true;
  37121. t.Calisto = true;
  37122. t.Calvert = true;
  37123. t.Capitals = true;
  37124. t.Cambria = true;
  37125. t.Cartier = true;
  37126. t.Caslon = true;
  37127. t.Catull = true;
  37128. t.Centaur = true;
  37129. t["Century Old Style"] = true;
  37130. t["Century Schoolbook"] = true;
  37131. t.Chaparral = true;
  37132. t["Charis SIL"] = true;
  37133. t.Cheltenham = true;
  37134. t["Cholla Slab"] = true;
  37135. t.Clarendon = true;
  37136. t.Clearface = true;
  37137. t.Cochin = true;
  37138. t.Colonna = true;
  37139. t["Computer Modern"] = true;
  37140. t["Concrete Roman"] = true;
  37141. t.Constantia = true;
  37142. t["Cooper Black"] = true;
  37143. t.Corona = true;
  37144. t.Ecotype = true;
  37145. t.Egyptienne = true;
  37146. t.Elephant = true;
  37147. t.Excelsior = true;
  37148. t.Fairfield = true;
  37149. t["FF Scala"] = true;
  37150. t.Folkard = true;
  37151. t.Footlight = true;
  37152. t.FreeSerif = true;
  37153. t["Friz Quadrata"] = true;
  37154. t.Garamond = true;
  37155. t.Gentium = true;
  37156. t.Georgia = true;
  37157. t.Gloucester = true;
  37158. t["Goudy Old Style"] = true;
  37159. t["Goudy Schoolbook"] = true;
  37160. t["Goudy Pro Font"] = true;
  37161. t.Granjon = true;
  37162. t["Guardian Egyptian"] = true;
  37163. t.Heather = true;
  37164. t.Hercules = true;
  37165. t["High Tower Text"] = true;
  37166. t.Hiroshige = true;
  37167. t["Hoefler Text"] = true;
  37168. t["Humana Serif"] = true;
  37169. t.Imprint = true;
  37170. t["Ionic No. 5"] = true;
  37171. t.Janson = true;
  37172. t.Joanna = true;
  37173. t.Korinna = true;
  37174. t.Lexicon = true;
  37175. t.LiberationSerif = true;
  37176. t["Liberation Serif"] = true;
  37177. t["Linux Libertine"] = true;
  37178. t.Literaturnaya = true;
  37179. t.Lucida = true;
  37180. t["Lucida Bright"] = true;
  37181. t.Melior = true;
  37182. t.Memphis = true;
  37183. t.Miller = true;
  37184. t.Minion = true;
  37185. t.Modern = true;
  37186. t["Mona Lisa"] = true;
  37187. t["Mrs Eaves"] = true;
  37188. t["MS Serif"] = true;
  37189. t["Museo Slab"] = true;
  37190. t["New York"] = true;
  37191. t["Nimbus Roman"] = true;
  37192. t["NPS Rawlinson Roadway"] = true;
  37193. t.NuptialScript = true;
  37194. t.Palatino = true;
  37195. t.Perpetua = true;
  37196. t.Plantin = true;
  37197. t["Plantin Schoolbook"] = true;
  37198. t.Playbill = true;
  37199. t["Poor Richard"] = true;
  37200. t["Rawlinson Roadway"] = true;
  37201. t.Renault = true;
  37202. t.Requiem = true;
  37203. t.Rockwell = true;
  37204. t.Roman = true;
  37205. t["Rotis Serif"] = true;
  37206. t.Sabon = true;
  37207. t.Scala = true;
  37208. t.Seagull = true;
  37209. t.Sistina = true;
  37210. t.Souvenir = true;
  37211. t.STIX = true;
  37212. t["Stone Informal"] = true;
  37213. t["Stone Serif"] = true;
  37214. t.Sylfaen = true;
  37215. t.Times = true;
  37216. t.Trajan = true;
  37217. t["Trinité"] = true;
  37218. t["Trump Mediaeval"] = true;
  37219. t.Utopia = true;
  37220. t["Vale Type"] = true;
  37221. t["Bitstream Vera"] = true;
  37222. t["Vera Serif"] = true;
  37223. t.Versailles = true;
  37224. t.Wanted = true;
  37225. t.Weiss = true;
  37226. t["Wide Latin"] = true;
  37227. t.Windsor = true;
  37228. t.XITS = true;
  37229. });
  37230. exports.getSerifFonts = getSerifFonts;
  37231. const getSymbolsFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
  37232. t.Dingbats = true;
  37233. t.Symbol = true;
  37234. t.ZapfDingbats = true;
  37235. });
  37236. exports.getSymbolsFonts = getSymbolsFonts;
  37237. const getGlyphMapForStandardFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
  37238. t[2] = 10;
  37239. t[3] = 32;
  37240. t[4] = 33;
  37241. t[5] = 34;
  37242. t[6] = 35;
  37243. t[7] = 36;
  37244. t[8] = 37;
  37245. t[9] = 38;
  37246. t[10] = 39;
  37247. t[11] = 40;
  37248. t[12] = 41;
  37249. t[13] = 42;
  37250. t[14] = 43;
  37251. t[15] = 44;
  37252. t[16] = 45;
  37253. t[17] = 46;
  37254. t[18] = 47;
  37255. t[19] = 48;
  37256. t[20] = 49;
  37257. t[21] = 50;
  37258. t[22] = 51;
  37259. t[23] = 52;
  37260. t[24] = 53;
  37261. t[25] = 54;
  37262. t[26] = 55;
  37263. t[27] = 56;
  37264. t[28] = 57;
  37265. t[29] = 58;
  37266. t[30] = 894;
  37267. t[31] = 60;
  37268. t[32] = 61;
  37269. t[33] = 62;
  37270. t[34] = 63;
  37271. t[35] = 64;
  37272. t[36] = 65;
  37273. t[37] = 66;
  37274. t[38] = 67;
  37275. t[39] = 68;
  37276. t[40] = 69;
  37277. t[41] = 70;
  37278. t[42] = 71;
  37279. t[43] = 72;
  37280. t[44] = 73;
  37281. t[45] = 74;
  37282. t[46] = 75;
  37283. t[47] = 76;
  37284. t[48] = 77;
  37285. t[49] = 78;
  37286. t[50] = 79;
  37287. t[51] = 80;
  37288. t[52] = 81;
  37289. t[53] = 82;
  37290. t[54] = 83;
  37291. t[55] = 84;
  37292. t[56] = 85;
  37293. t[57] = 86;
  37294. t[58] = 87;
  37295. t[59] = 88;
  37296. t[60] = 89;
  37297. t[61] = 90;
  37298. t[62] = 91;
  37299. t[63] = 92;
  37300. t[64] = 93;
  37301. t[65] = 94;
  37302. t[66] = 95;
  37303. t[67] = 96;
  37304. t[68] = 97;
  37305. t[69] = 98;
  37306. t[70] = 99;
  37307. t[71] = 100;
  37308. t[72] = 101;
  37309. t[73] = 102;
  37310. t[74] = 103;
  37311. t[75] = 104;
  37312. t[76] = 105;
  37313. t[77] = 106;
  37314. t[78] = 107;
  37315. t[79] = 108;
  37316. t[80] = 109;
  37317. t[81] = 110;
  37318. t[82] = 111;
  37319. t[83] = 112;
  37320. t[84] = 113;
  37321. t[85] = 114;
  37322. t[86] = 115;
  37323. t[87] = 116;
  37324. t[88] = 117;
  37325. t[89] = 118;
  37326. t[90] = 119;
  37327. t[91] = 120;
  37328. t[92] = 121;
  37329. t[93] = 122;
  37330. t[94] = 123;
  37331. t[95] = 124;
  37332. t[96] = 125;
  37333. t[97] = 126;
  37334. t[98] = 196;
  37335. t[99] = 197;
  37336. t[100] = 199;
  37337. t[101] = 201;
  37338. t[102] = 209;
  37339. t[103] = 214;
  37340. t[104] = 220;
  37341. t[105] = 225;
  37342. t[106] = 224;
  37343. t[107] = 226;
  37344. t[108] = 228;
  37345. t[109] = 227;
  37346. t[110] = 229;
  37347. t[111] = 231;
  37348. t[112] = 233;
  37349. t[113] = 232;
  37350. t[114] = 234;
  37351. t[115] = 235;
  37352. t[116] = 237;
  37353. t[117] = 236;
  37354. t[118] = 238;
  37355. t[119] = 239;
  37356. t[120] = 241;
  37357. t[121] = 243;
  37358. t[122] = 242;
  37359. t[123] = 244;
  37360. t[124] = 246;
  37361. t[125] = 245;
  37362. t[126] = 250;
  37363. t[127] = 249;
  37364. t[128] = 251;
  37365. t[129] = 252;
  37366. t[130] = 8224;
  37367. t[131] = 176;
  37368. t[132] = 162;
  37369. t[133] = 163;
  37370. t[134] = 167;
  37371. t[135] = 8226;
  37372. t[136] = 182;
  37373. t[137] = 223;
  37374. t[138] = 174;
  37375. t[139] = 169;
  37376. t[140] = 8482;
  37377. t[141] = 180;
  37378. t[142] = 168;
  37379. t[143] = 8800;
  37380. t[144] = 198;
  37381. t[145] = 216;
  37382. t[146] = 8734;
  37383. t[147] = 177;
  37384. t[148] = 8804;
  37385. t[149] = 8805;
  37386. t[150] = 165;
  37387. t[151] = 181;
  37388. t[152] = 8706;
  37389. t[153] = 8721;
  37390. t[154] = 8719;
  37391. t[156] = 8747;
  37392. t[157] = 170;
  37393. t[158] = 186;
  37394. t[159] = 8486;
  37395. t[160] = 230;
  37396. t[161] = 248;
  37397. t[162] = 191;
  37398. t[163] = 161;
  37399. t[164] = 172;
  37400. t[165] = 8730;
  37401. t[166] = 402;
  37402. t[167] = 8776;
  37403. t[168] = 8710;
  37404. t[169] = 171;
  37405. t[170] = 187;
  37406. t[171] = 8230;
  37407. t[200] = 193;
  37408. t[203] = 205;
  37409. t[210] = 218;
  37410. t[223] = 711;
  37411. t[224] = 321;
  37412. t[225] = 322;
  37413. t[226] = 352;
  37414. t[227] = 353;
  37415. t[228] = 381;
  37416. t[229] = 382;
  37417. t[233] = 221;
  37418. t[234] = 253;
  37419. t[252] = 263;
  37420. t[253] = 268;
  37421. t[254] = 269;
  37422. t[258] = 258;
  37423. t[260] = 260;
  37424. t[261] = 261;
  37425. t[265] = 280;
  37426. t[266] = 281;
  37427. t[267] = 282;
  37428. t[268] = 283;
  37429. t[269] = 313;
  37430. t[275] = 323;
  37431. t[276] = 324;
  37432. t[278] = 328;
  37433. t[283] = 344;
  37434. t[284] = 345;
  37435. t[285] = 346;
  37436. t[286] = 347;
  37437. t[292] = 367;
  37438. t[295] = 377;
  37439. t[296] = 378;
  37440. t[298] = 380;
  37441. t[305] = 963;
  37442. t[306] = 964;
  37443. t[307] = 966;
  37444. t[308] = 8215;
  37445. t[309] = 8252;
  37446. t[310] = 8319;
  37447. t[311] = 8359;
  37448. t[312] = 8592;
  37449. t[313] = 8593;
  37450. t[337] = 9552;
  37451. t[493] = 1039;
  37452. t[494] = 1040;
  37453. t[672] = 1488;
  37454. t[673] = 1489;
  37455. t[674] = 1490;
  37456. t[675] = 1491;
  37457. t[676] = 1492;
  37458. t[677] = 1493;
  37459. t[678] = 1494;
  37460. t[679] = 1495;
  37461. t[680] = 1496;
  37462. t[681] = 1497;
  37463. t[682] = 1498;
  37464. t[683] = 1499;
  37465. t[684] = 1500;
  37466. t[685] = 1501;
  37467. t[686] = 1502;
  37468. t[687] = 1503;
  37469. t[688] = 1504;
  37470. t[689] = 1505;
  37471. t[690] = 1506;
  37472. t[691] = 1507;
  37473. t[692] = 1508;
  37474. t[693] = 1509;
  37475. t[694] = 1510;
  37476. t[695] = 1511;
  37477. t[696] = 1512;
  37478. t[697] = 1513;
  37479. t[698] = 1514;
  37480. t[705] = 1524;
  37481. t[706] = 8362;
  37482. t[710] = 64288;
  37483. t[711] = 64298;
  37484. t[759] = 1617;
  37485. t[761] = 1776;
  37486. t[763] = 1778;
  37487. t[775] = 1652;
  37488. t[777] = 1764;
  37489. t[778] = 1780;
  37490. t[779] = 1781;
  37491. t[780] = 1782;
  37492. t[782] = 771;
  37493. t[783] = 64726;
  37494. t[786] = 8363;
  37495. t[788] = 8532;
  37496. t[790] = 768;
  37497. t[791] = 769;
  37498. t[792] = 768;
  37499. t[795] = 803;
  37500. t[797] = 64336;
  37501. t[798] = 64337;
  37502. t[799] = 64342;
  37503. t[800] = 64343;
  37504. t[801] = 64344;
  37505. t[802] = 64345;
  37506. t[803] = 64362;
  37507. t[804] = 64363;
  37508. t[805] = 64364;
  37509. t[2424] = 7821;
  37510. t[2425] = 7822;
  37511. t[2426] = 7823;
  37512. t[2427] = 7824;
  37513. t[2428] = 7825;
  37514. t[2429] = 7826;
  37515. t[2430] = 7827;
  37516. t[2433] = 7682;
  37517. t[2678] = 8045;
  37518. t[2679] = 8046;
  37519. t[2830] = 1552;
  37520. t[2838] = 686;
  37521. t[2840] = 751;
  37522. t[2842] = 753;
  37523. t[2843] = 754;
  37524. t[2844] = 755;
  37525. t[2846] = 757;
  37526. t[2856] = 767;
  37527. t[2857] = 848;
  37528. t[2858] = 849;
  37529. t[2862] = 853;
  37530. t[2863] = 854;
  37531. t[2864] = 855;
  37532. t[2865] = 861;
  37533. t[2866] = 862;
  37534. t[2906] = 7460;
  37535. t[2908] = 7462;
  37536. t[2909] = 7463;
  37537. t[2910] = 7464;
  37538. t[2912] = 7466;
  37539. t[2913] = 7467;
  37540. t[2914] = 7468;
  37541. t[2916] = 7470;
  37542. t[2917] = 7471;
  37543. t[2918] = 7472;
  37544. t[2920] = 7474;
  37545. t[2921] = 7475;
  37546. t[2922] = 7476;
  37547. t[2924] = 7478;
  37548. t[2925] = 7479;
  37549. t[2926] = 7480;
  37550. t[2928] = 7482;
  37551. t[2929] = 7483;
  37552. t[2930] = 7484;
  37553. t[2932] = 7486;
  37554. t[2933] = 7487;
  37555. t[2934] = 7488;
  37556. t[2936] = 7490;
  37557. t[2937] = 7491;
  37558. t[2938] = 7492;
  37559. t[2940] = 7494;
  37560. t[2941] = 7495;
  37561. t[2942] = 7496;
  37562. t[2944] = 7498;
  37563. t[2946] = 7500;
  37564. t[2948] = 7502;
  37565. t[2950] = 7504;
  37566. t[2951] = 7505;
  37567. t[2952] = 7506;
  37568. t[2954] = 7508;
  37569. t[2955] = 7509;
  37570. t[2956] = 7510;
  37571. t[2958] = 7512;
  37572. t[2959] = 7513;
  37573. t[2960] = 7514;
  37574. t[2962] = 7516;
  37575. t[2963] = 7517;
  37576. t[2964] = 7518;
  37577. t[2966] = 7520;
  37578. t[2967] = 7521;
  37579. t[2968] = 7522;
  37580. t[2970] = 7524;
  37581. t[2971] = 7525;
  37582. t[2972] = 7526;
  37583. t[2974] = 7528;
  37584. t[2975] = 7529;
  37585. t[2976] = 7530;
  37586. t[2978] = 1537;
  37587. t[2979] = 1538;
  37588. t[2980] = 1539;
  37589. t[2982] = 1549;
  37590. t[2983] = 1551;
  37591. t[2984] = 1552;
  37592. t[2986] = 1554;
  37593. t[2987] = 1555;
  37594. t[2988] = 1556;
  37595. t[2990] = 1623;
  37596. t[2991] = 1624;
  37597. t[2995] = 1775;
  37598. t[2999] = 1791;
  37599. t[3002] = 64290;
  37600. t[3003] = 64291;
  37601. t[3004] = 64292;
  37602. t[3006] = 64294;
  37603. t[3007] = 64295;
  37604. t[3008] = 64296;
  37605. t[3011] = 1900;
  37606. t[3014] = 8223;
  37607. t[3015] = 8244;
  37608. t[3017] = 7532;
  37609. t[3018] = 7533;
  37610. t[3019] = 7534;
  37611. t[3075] = 7590;
  37612. t[3076] = 7591;
  37613. t[3079] = 7594;
  37614. t[3080] = 7595;
  37615. t[3083] = 7598;
  37616. t[3084] = 7599;
  37617. t[3087] = 7602;
  37618. t[3088] = 7603;
  37619. t[3091] = 7606;
  37620. t[3092] = 7607;
  37621. t[3095] = 7610;
  37622. t[3096] = 7611;
  37623. t[3099] = 7614;
  37624. t[3100] = 7615;
  37625. t[3103] = 7618;
  37626. t[3104] = 7619;
  37627. t[3107] = 8337;
  37628. t[3108] = 8338;
  37629. t[3116] = 1884;
  37630. t[3119] = 1885;
  37631. t[3120] = 1885;
  37632. t[3123] = 1886;
  37633. t[3124] = 1886;
  37634. t[3127] = 1887;
  37635. t[3128] = 1887;
  37636. t[3131] = 1888;
  37637. t[3132] = 1888;
  37638. t[3135] = 1889;
  37639. t[3136] = 1889;
  37640. t[3139] = 1890;
  37641. t[3140] = 1890;
  37642. t[3143] = 1891;
  37643. t[3144] = 1891;
  37644. t[3147] = 1892;
  37645. t[3148] = 1892;
  37646. t[3153] = 580;
  37647. t[3154] = 581;
  37648. t[3157] = 584;
  37649. t[3158] = 585;
  37650. t[3161] = 588;
  37651. t[3162] = 589;
  37652. t[3165] = 891;
  37653. t[3166] = 892;
  37654. t[3169] = 1274;
  37655. t[3170] = 1275;
  37656. t[3173] = 1278;
  37657. t[3174] = 1279;
  37658. t[3181] = 7622;
  37659. t[3182] = 7623;
  37660. t[3282] = 11799;
  37661. t[3316] = 578;
  37662. t[3379] = 42785;
  37663. t[3393] = 1159;
  37664. t[3416] = 8377;
  37665. });
  37666. exports.getGlyphMapForStandardFonts = getGlyphMapForStandardFonts;
  37667. const getSupplementalGlyphMapForArialBlack = (0, _core_utils.getLookupTableFactory)(function (t) {
  37668. t[227] = 322;
  37669. t[264] = 261;
  37670. t[291] = 346;
  37671. });
  37672. exports.getSupplementalGlyphMapForArialBlack = getSupplementalGlyphMapForArialBlack;
  37673. const getSupplementalGlyphMapForCalibri = (0, _core_utils.getLookupTableFactory)(function (t) {
  37674. t[1] = 32;
  37675. t[4] = 65;
  37676. t[6] = 193;
  37677. t[17] = 66;
  37678. t[18] = 67;
  37679. t[21] = 268;
  37680. t[24] = 68;
  37681. t[28] = 69;
  37682. t[30] = 201;
  37683. t[32] = 282;
  37684. t[38] = 70;
  37685. t[39] = 71;
  37686. t[44] = 72;
  37687. t[47] = 73;
  37688. t[49] = 205;
  37689. t[58] = 74;
  37690. t[60] = 75;
  37691. t[62] = 76;
  37692. t[68] = 77;
  37693. t[69] = 78;
  37694. t[75] = 79;
  37695. t[87] = 80;
  37696. t[89] = 81;
  37697. t[90] = 82;
  37698. t[92] = 344;
  37699. t[94] = 83;
  37700. t[97] = 352;
  37701. t[100] = 84;
  37702. t[104] = 85;
  37703. t[115] = 86;
  37704. t[116] = 87;
  37705. t[121] = 88;
  37706. t[122] = 89;
  37707. t[124] = 221;
  37708. t[127] = 90;
  37709. t[129] = 381;
  37710. t[258] = 97;
  37711. t[260] = 225;
  37712. t[268] = 261;
  37713. t[271] = 98;
  37714. t[272] = 99;
  37715. t[273] = 263;
  37716. t[275] = 269;
  37717. t[282] = 100;
  37718. t[286] = 101;
  37719. t[288] = 233;
  37720. t[290] = 283;
  37721. t[295] = 281;
  37722. t[296] = 102;
  37723. t[336] = 103;
  37724. t[346] = 104;
  37725. t[349] = 105;
  37726. t[351] = 237;
  37727. t[361] = 106;
  37728. t[364] = 107;
  37729. t[367] = 108;
  37730. t[371] = 322;
  37731. t[373] = 109;
  37732. t[374] = 110;
  37733. t[381] = 111;
  37734. t[383] = 243;
  37735. t[393] = 112;
  37736. t[395] = 113;
  37737. t[396] = 114;
  37738. t[398] = 345;
  37739. t[400] = 115;
  37740. t[401] = 347;
  37741. t[403] = 353;
  37742. t[410] = 116;
  37743. t[437] = 117;
  37744. t[448] = 118;
  37745. t[449] = 119;
  37746. t[454] = 120;
  37747. t[455] = 121;
  37748. t[457] = 253;
  37749. t[460] = 122;
  37750. t[462] = 382;
  37751. t[463] = 380;
  37752. t[853] = 44;
  37753. t[855] = 58;
  37754. t[856] = 46;
  37755. t[876] = 47;
  37756. t[878] = 45;
  37757. t[882] = 45;
  37758. t[894] = 40;
  37759. t[895] = 41;
  37760. t[896] = 91;
  37761. t[897] = 93;
  37762. t[923] = 64;
  37763. t[1004] = 48;
  37764. t[1005] = 49;
  37765. t[1006] = 50;
  37766. t[1007] = 51;
  37767. t[1008] = 52;
  37768. t[1009] = 53;
  37769. t[1010] = 54;
  37770. t[1011] = 55;
  37771. t[1012] = 56;
  37772. t[1013] = 57;
  37773. t[1081] = 37;
  37774. t[1085] = 43;
  37775. t[1086] = 45;
  37776. });
  37777. exports.getSupplementalGlyphMapForCalibri = getSupplementalGlyphMapForCalibri;
  37778. function getStandardFontName(name) {
  37779. const fontName = (0, _fonts_utils.normalizeFontName)(name);
  37780. const stdFontMap = getStdFontMap();
  37781. return stdFontMap[fontName];
  37782. }
  37783. /***/ }),
  37784. /* 48 */
  37785. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  37786. Object.defineProperty(exports, "__esModule", ({
  37787. value: true
  37788. }));
  37789. exports.ToUnicodeMap = exports.IdentityToUnicodeMap = void 0;
  37790. var _util = __w_pdfjs_require__(2);
  37791. class ToUnicodeMap {
  37792. constructor(cmap = []) {
  37793. this._map = cmap;
  37794. }
  37795. get length() {
  37796. return this._map.length;
  37797. }
  37798. forEach(callback) {
  37799. for (const charCode in this._map) {
  37800. callback(charCode, this._map[charCode].charCodeAt(0));
  37801. }
  37802. }
  37803. has(i) {
  37804. return this._map[i] !== undefined;
  37805. }
  37806. get(i) {
  37807. return this._map[i];
  37808. }
  37809. charCodeOf(value) {
  37810. const map = this._map;
  37811. if (map.length <= 0x10000) {
  37812. return map.indexOf(value);
  37813. }
  37814. for (const charCode in map) {
  37815. if (map[charCode] === value) {
  37816. return charCode | 0;
  37817. }
  37818. }
  37819. return -1;
  37820. }
  37821. amend(map) {
  37822. for (const charCode in map) {
  37823. this._map[charCode] = map[charCode];
  37824. }
  37825. }
  37826. }
  37827. exports.ToUnicodeMap = ToUnicodeMap;
  37828. class IdentityToUnicodeMap {
  37829. constructor(firstChar, lastChar) {
  37830. this.firstChar = firstChar;
  37831. this.lastChar = lastChar;
  37832. }
  37833. get length() {
  37834. return this.lastChar + 1 - this.firstChar;
  37835. }
  37836. forEach(callback) {
  37837. for (let i = this.firstChar, ii = this.lastChar; i <= ii; i++) {
  37838. callback(i, i);
  37839. }
  37840. }
  37841. has(i) {
  37842. return this.firstChar <= i && i <= this.lastChar;
  37843. }
  37844. get(i) {
  37845. if (this.firstChar <= i && i <= this.lastChar) {
  37846. return String.fromCharCode(i);
  37847. }
  37848. return undefined;
  37849. }
  37850. charCodeOf(v) {
  37851. return Number.isInteger(v) && v >= this.firstChar && v <= this.lastChar ? v : -1;
  37852. }
  37853. amend(map) {
  37854. (0, _util.unreachable)("Should not call amend()");
  37855. }
  37856. }
  37857. exports.IdentityToUnicodeMap = IdentityToUnicodeMap;
  37858. /***/ }),
  37859. /* 49 */
  37860. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  37861. Object.defineProperty(exports, "__esModule", ({
  37862. value: true
  37863. }));
  37864. exports.CFFFont = void 0;
  37865. var _cff_parser = __w_pdfjs_require__(45);
  37866. var _fonts_utils = __w_pdfjs_require__(18);
  37867. var _util = __w_pdfjs_require__(2);
  37868. class CFFFont {
  37869. constructor(file, properties) {
  37870. this.properties = properties;
  37871. const parser = new _cff_parser.CFFParser(file, properties, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  37872. this.cff = parser.parse();
  37873. this.cff.duplicateFirstGlyph();
  37874. const compiler = new _cff_parser.CFFCompiler(this.cff);
  37875. this.seacs = this.cff.seacs;
  37876. try {
  37877. this.data = compiler.compile();
  37878. } catch (e) {
  37879. (0, _util.warn)("Failed to compile font " + properties.loadedName);
  37880. this.data = file;
  37881. }
  37882. this._createBuiltInEncoding();
  37883. }
  37884. get numGlyphs() {
  37885. return this.cff.charStrings.count;
  37886. }
  37887. getCharset() {
  37888. return this.cff.charset.charset;
  37889. }
  37890. getGlyphMapping() {
  37891. const cff = this.cff;
  37892. const properties = this.properties;
  37893. const charsets = cff.charset.charset;
  37894. let charCodeToGlyphId;
  37895. let glyphId;
  37896. if (properties.composite) {
  37897. charCodeToGlyphId = Object.create(null);
  37898. let charCode;
  37899. if (cff.isCIDFont) {
  37900. for (glyphId = 0; glyphId < charsets.length; glyphId++) {
  37901. const cid = charsets[glyphId];
  37902. charCode = properties.cMap.charCodeOf(cid);
  37903. charCodeToGlyphId[charCode] = glyphId;
  37904. }
  37905. } else {
  37906. for (glyphId = 0; glyphId < cff.charStrings.count; glyphId++) {
  37907. charCode = properties.cMap.charCodeOf(glyphId);
  37908. charCodeToGlyphId[charCode] = glyphId;
  37909. }
  37910. }
  37911. return charCodeToGlyphId;
  37912. }
  37913. let encoding = cff.encoding ? cff.encoding.encoding : null;
  37914. if (properties.isInternalFont) {
  37915. encoding = properties.defaultEncoding;
  37916. }
  37917. charCodeToGlyphId = (0, _fonts_utils.type1FontGlyphMapping)(properties, encoding, charsets);
  37918. return charCodeToGlyphId;
  37919. }
  37920. hasGlyphId(id) {
  37921. return this.cff.hasGlyphId(id);
  37922. }
  37923. _createBuiltInEncoding() {
  37924. const {
  37925. charset,
  37926. encoding
  37927. } = this.cff;
  37928. if (!charset || !encoding) {
  37929. return;
  37930. }
  37931. const charsets = charset.charset,
  37932. encodings = encoding.encoding;
  37933. const map = [];
  37934. for (const charCode in encodings) {
  37935. const glyphId = encodings[charCode];
  37936. if (glyphId >= 0) {
  37937. const glyphName = charsets[glyphId];
  37938. if (glyphName) {
  37939. map[charCode] = glyphName;
  37940. }
  37941. }
  37942. }
  37943. if (map.length > 0) {
  37944. this.properties.builtInEncoding = map;
  37945. }
  37946. }
  37947. }
  37948. exports.CFFFont = CFFFont;
  37949. /***/ }),
  37950. /* 50 */
  37951. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  37952. Object.defineProperty(exports, "__esModule", ({
  37953. value: true
  37954. }));
  37955. exports.FontRendererFactory = void 0;
  37956. var _util = __w_pdfjs_require__(2);
  37957. var _cff_parser = __w_pdfjs_require__(45);
  37958. var _glyphlist = __w_pdfjs_require__(20);
  37959. var _encodings = __w_pdfjs_require__(19);
  37960. var _stream = __w_pdfjs_require__(10);
  37961. function getUint32(data, offset) {
  37962. return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0;
  37963. }
  37964. function getUint16(data, offset) {
  37965. return data[offset] << 8 | data[offset + 1];
  37966. }
  37967. function getInt16(data, offset) {
  37968. return (data[offset] << 24 | data[offset + 1] << 16) >> 16;
  37969. }
  37970. function getInt8(data, offset) {
  37971. return data[offset] << 24 >> 24;
  37972. }
  37973. function getFloat214(data, offset) {
  37974. return getInt16(data, offset) / 16384;
  37975. }
  37976. function getSubroutineBias(subrs) {
  37977. const numSubrs = subrs.length;
  37978. let bias = 32768;
  37979. if (numSubrs < 1240) {
  37980. bias = 107;
  37981. } else if (numSubrs < 33900) {
  37982. bias = 1131;
  37983. }
  37984. return bias;
  37985. }
  37986. function parseCmap(data, start, end) {
  37987. const offset = getUint16(data, start + 2) === 1 ? getUint32(data, start + 8) : getUint32(data, start + 16);
  37988. const format = getUint16(data, start + offset);
  37989. let ranges, p, i;
  37990. if (format === 4) {
  37991. getUint16(data, start + offset + 2);
  37992. const segCount = getUint16(data, start + offset + 6) >> 1;
  37993. p = start + offset + 14;
  37994. ranges = [];
  37995. for (i = 0; i < segCount; i++, p += 2) {
  37996. ranges[i] = {
  37997. end: getUint16(data, p)
  37998. };
  37999. }
  38000. p += 2;
  38001. for (i = 0; i < segCount; i++, p += 2) {
  38002. ranges[i].start = getUint16(data, p);
  38003. }
  38004. for (i = 0; i < segCount; i++, p += 2) {
  38005. ranges[i].idDelta = getUint16(data, p);
  38006. }
  38007. for (i = 0; i < segCount; i++, p += 2) {
  38008. let idOffset = getUint16(data, p);
  38009. if (idOffset === 0) {
  38010. continue;
  38011. }
  38012. ranges[i].ids = [];
  38013. for (let j = 0, jj = ranges[i].end - ranges[i].start + 1; j < jj; j++) {
  38014. ranges[i].ids[j] = getUint16(data, p + idOffset);
  38015. idOffset += 2;
  38016. }
  38017. }
  38018. return ranges;
  38019. } else if (format === 12) {
  38020. const groups = getUint32(data, start + offset + 12);
  38021. p = start + offset + 16;
  38022. ranges = [];
  38023. for (i = 0; i < groups; i++) {
  38024. start = getUint32(data, p);
  38025. ranges.push({
  38026. start,
  38027. end: getUint32(data, p + 4),
  38028. idDelta: getUint32(data, p + 8) - start
  38029. });
  38030. p += 12;
  38031. }
  38032. return ranges;
  38033. }
  38034. throw new _util.FormatError(`unsupported cmap: ${format}`);
  38035. }
  38036. function parseCff(data, start, end, seacAnalysisEnabled) {
  38037. const properties = {};
  38038. const parser = new _cff_parser.CFFParser(new _stream.Stream(data, start, end - start), properties, seacAnalysisEnabled);
  38039. const cff = parser.parse();
  38040. return {
  38041. glyphs: cff.charStrings.objects,
  38042. subrs: cff.topDict.privateDict && cff.topDict.privateDict.subrsIndex && cff.topDict.privateDict.subrsIndex.objects,
  38043. gsubrs: cff.globalSubrIndex && cff.globalSubrIndex.objects,
  38044. isCFFCIDFont: cff.isCIDFont,
  38045. fdSelect: cff.fdSelect,
  38046. fdArray: cff.fdArray
  38047. };
  38048. }
  38049. function parseGlyfTable(glyf, loca, isGlyphLocationsLong) {
  38050. let itemSize, itemDecode;
  38051. if (isGlyphLocationsLong) {
  38052. itemSize = 4;
  38053. itemDecode = getUint32;
  38054. } else {
  38055. itemSize = 2;
  38056. itemDecode = (data, offset) => 2 * getUint16(data, offset);
  38057. }
  38058. const glyphs = [];
  38059. let startOffset = itemDecode(loca, 0);
  38060. for (let j = itemSize; j < loca.length; j += itemSize) {
  38061. const endOffset = itemDecode(loca, j);
  38062. glyphs.push(glyf.subarray(startOffset, endOffset));
  38063. startOffset = endOffset;
  38064. }
  38065. return glyphs;
  38066. }
  38067. function lookupCmap(ranges, unicode) {
  38068. const code = unicode.codePointAt(0);
  38069. let gid = 0,
  38070. l = 0,
  38071. r = ranges.length - 1;
  38072. while (l < r) {
  38073. const c = l + r + 1 >> 1;
  38074. if (code < ranges[c].start) {
  38075. r = c - 1;
  38076. } else {
  38077. l = c;
  38078. }
  38079. }
  38080. if (ranges[l].start <= code && code <= ranges[l].end) {
  38081. gid = ranges[l].idDelta + (ranges[l].ids ? ranges[l].ids[code - ranges[l].start] : code) & 0xffff;
  38082. }
  38083. return {
  38084. charCode: code,
  38085. glyphId: gid
  38086. };
  38087. }
  38088. function compileGlyf(code, cmds, font) {
  38089. function moveTo(x, y) {
  38090. cmds.push({
  38091. cmd: "moveTo",
  38092. args: [x, y]
  38093. });
  38094. }
  38095. function lineTo(x, y) {
  38096. cmds.push({
  38097. cmd: "lineTo",
  38098. args: [x, y]
  38099. });
  38100. }
  38101. function quadraticCurveTo(xa, ya, x, y) {
  38102. cmds.push({
  38103. cmd: "quadraticCurveTo",
  38104. args: [xa, ya, x, y]
  38105. });
  38106. }
  38107. let i = 0;
  38108. const numberOfContours = getInt16(code, i);
  38109. let flags;
  38110. let x = 0,
  38111. y = 0;
  38112. i += 10;
  38113. if (numberOfContours < 0) {
  38114. do {
  38115. flags = getUint16(code, i);
  38116. const glyphIndex = getUint16(code, i + 2);
  38117. i += 4;
  38118. let arg1, arg2;
  38119. if (flags & 0x01) {
  38120. if (flags & 0x02) {
  38121. arg1 = getInt16(code, i);
  38122. arg2 = getInt16(code, i + 2);
  38123. } else {
  38124. arg1 = getUint16(code, i);
  38125. arg2 = getUint16(code, i + 2);
  38126. }
  38127. i += 4;
  38128. } else {
  38129. if (flags & 0x02) {
  38130. arg1 = getInt8(code, i++);
  38131. arg2 = getInt8(code, i++);
  38132. } else {
  38133. arg1 = code[i++];
  38134. arg2 = code[i++];
  38135. }
  38136. }
  38137. if (flags & 0x02) {
  38138. x = arg1;
  38139. y = arg2;
  38140. } else {
  38141. x = 0;
  38142. y = 0;
  38143. }
  38144. let scaleX = 1,
  38145. scaleY = 1,
  38146. scale01 = 0,
  38147. scale10 = 0;
  38148. if (flags & 0x08) {
  38149. scaleX = scaleY = getFloat214(code, i);
  38150. i += 2;
  38151. } else if (flags & 0x40) {
  38152. scaleX = getFloat214(code, i);
  38153. scaleY = getFloat214(code, i + 2);
  38154. i += 4;
  38155. } else if (flags & 0x80) {
  38156. scaleX = getFloat214(code, i);
  38157. scale01 = getFloat214(code, i + 2);
  38158. scale10 = getFloat214(code, i + 4);
  38159. scaleY = getFloat214(code, i + 6);
  38160. i += 8;
  38161. }
  38162. const subglyph = font.glyphs[glyphIndex];
  38163. if (subglyph) {
  38164. cmds.push({
  38165. cmd: "save"
  38166. }, {
  38167. cmd: "transform",
  38168. args: [scaleX, scale01, scale10, scaleY, x, y]
  38169. });
  38170. if (!(flags & 0x02)) {}
  38171. compileGlyf(subglyph, cmds, font);
  38172. cmds.push({
  38173. cmd: "restore"
  38174. });
  38175. }
  38176. } while (flags & 0x20);
  38177. } else {
  38178. const endPtsOfContours = [];
  38179. let j, jj;
  38180. for (j = 0; j < numberOfContours; j++) {
  38181. endPtsOfContours.push(getUint16(code, i));
  38182. i += 2;
  38183. }
  38184. const instructionLength = getUint16(code, i);
  38185. i += 2 + instructionLength;
  38186. const numberOfPoints = endPtsOfContours.at(-1) + 1;
  38187. const points = [];
  38188. while (points.length < numberOfPoints) {
  38189. flags = code[i++];
  38190. let repeat = 1;
  38191. if (flags & 0x08) {
  38192. repeat += code[i++];
  38193. }
  38194. while (repeat-- > 0) {
  38195. points.push({
  38196. flags
  38197. });
  38198. }
  38199. }
  38200. for (j = 0; j < numberOfPoints; j++) {
  38201. switch (points[j].flags & 0x12) {
  38202. case 0x00:
  38203. x += getInt16(code, i);
  38204. i += 2;
  38205. break;
  38206. case 0x02:
  38207. x -= code[i++];
  38208. break;
  38209. case 0x12:
  38210. x += code[i++];
  38211. break;
  38212. }
  38213. points[j].x = x;
  38214. }
  38215. for (j = 0; j < numberOfPoints; j++) {
  38216. switch (points[j].flags & 0x24) {
  38217. case 0x00:
  38218. y += getInt16(code, i);
  38219. i += 2;
  38220. break;
  38221. case 0x04:
  38222. y -= code[i++];
  38223. break;
  38224. case 0x24:
  38225. y += code[i++];
  38226. break;
  38227. }
  38228. points[j].y = y;
  38229. }
  38230. let startPoint = 0;
  38231. for (i = 0; i < numberOfContours; i++) {
  38232. const endPoint = endPtsOfContours[i];
  38233. const contour = points.slice(startPoint, endPoint + 1);
  38234. if (contour[0].flags & 1) {
  38235. contour.push(contour[0]);
  38236. } else if (contour.at(-1).flags & 1) {
  38237. contour.unshift(contour.at(-1));
  38238. } else {
  38239. const p = {
  38240. flags: 1,
  38241. x: (contour[0].x + contour.at(-1).x) / 2,
  38242. y: (contour[0].y + contour.at(-1).y) / 2
  38243. };
  38244. contour.unshift(p);
  38245. contour.push(p);
  38246. }
  38247. moveTo(contour[0].x, contour[0].y);
  38248. for (j = 1, jj = contour.length; j < jj; j++) {
  38249. if (contour[j].flags & 1) {
  38250. lineTo(contour[j].x, contour[j].y);
  38251. } else if (contour[j + 1].flags & 1) {
  38252. quadraticCurveTo(contour[j].x, contour[j].y, contour[j + 1].x, contour[j + 1].y);
  38253. j++;
  38254. } else {
  38255. quadraticCurveTo(contour[j].x, contour[j].y, (contour[j].x + contour[j + 1].x) / 2, (contour[j].y + contour[j + 1].y) / 2);
  38256. }
  38257. }
  38258. startPoint = endPoint + 1;
  38259. }
  38260. }
  38261. }
  38262. function compileCharString(charStringCode, cmds, font, glyphId) {
  38263. function moveTo(x, y) {
  38264. cmds.push({
  38265. cmd: "moveTo",
  38266. args: [x, y]
  38267. });
  38268. }
  38269. function lineTo(x, y) {
  38270. cmds.push({
  38271. cmd: "lineTo",
  38272. args: [x, y]
  38273. });
  38274. }
  38275. function bezierCurveTo(x1, y1, x2, y2, x, y) {
  38276. cmds.push({
  38277. cmd: "bezierCurveTo",
  38278. args: [x1, y1, x2, y2, x, y]
  38279. });
  38280. }
  38281. const stack = [];
  38282. let x = 0,
  38283. y = 0;
  38284. let stems = 0;
  38285. function parse(code) {
  38286. let i = 0;
  38287. while (i < code.length) {
  38288. let stackClean = false;
  38289. let v = code[i++];
  38290. let xa, xb, ya, yb, y1, y2, y3, n, subrCode;
  38291. switch (v) {
  38292. case 1:
  38293. stems += stack.length >> 1;
  38294. stackClean = true;
  38295. break;
  38296. case 3:
  38297. stems += stack.length >> 1;
  38298. stackClean = true;
  38299. break;
  38300. case 4:
  38301. y += stack.pop();
  38302. moveTo(x, y);
  38303. stackClean = true;
  38304. break;
  38305. case 5:
  38306. while (stack.length > 0) {
  38307. x += stack.shift();
  38308. y += stack.shift();
  38309. lineTo(x, y);
  38310. }
  38311. break;
  38312. case 6:
  38313. while (stack.length > 0) {
  38314. x += stack.shift();
  38315. lineTo(x, y);
  38316. if (stack.length === 0) {
  38317. break;
  38318. }
  38319. y += stack.shift();
  38320. lineTo(x, y);
  38321. }
  38322. break;
  38323. case 7:
  38324. while (stack.length > 0) {
  38325. y += stack.shift();
  38326. lineTo(x, y);
  38327. if (stack.length === 0) {
  38328. break;
  38329. }
  38330. x += stack.shift();
  38331. lineTo(x, y);
  38332. }
  38333. break;
  38334. case 8:
  38335. while (stack.length > 0) {
  38336. xa = x + stack.shift();
  38337. ya = y + stack.shift();
  38338. xb = xa + stack.shift();
  38339. yb = ya + stack.shift();
  38340. x = xb + stack.shift();
  38341. y = yb + stack.shift();
  38342. bezierCurveTo(xa, ya, xb, yb, x, y);
  38343. }
  38344. break;
  38345. case 10:
  38346. n = stack.pop();
  38347. subrCode = null;
  38348. if (font.isCFFCIDFont) {
  38349. const fdIndex = font.fdSelect.getFDIndex(glyphId);
  38350. if (fdIndex >= 0 && fdIndex < font.fdArray.length) {
  38351. const fontDict = font.fdArray[fdIndex];
  38352. let subrs;
  38353. if (fontDict.privateDict && fontDict.privateDict.subrsIndex) {
  38354. subrs = fontDict.privateDict.subrsIndex.objects;
  38355. }
  38356. if (subrs) {
  38357. n += getSubroutineBias(subrs);
  38358. subrCode = subrs[n];
  38359. }
  38360. } else {
  38361. (0, _util.warn)("Invalid fd index for glyph index.");
  38362. }
  38363. } else {
  38364. subrCode = font.subrs[n + font.subrsBias];
  38365. }
  38366. if (subrCode) {
  38367. parse(subrCode);
  38368. }
  38369. break;
  38370. case 11:
  38371. return;
  38372. case 12:
  38373. v = code[i++];
  38374. switch (v) {
  38375. case 34:
  38376. xa = x + stack.shift();
  38377. xb = xa + stack.shift();
  38378. y1 = y + stack.shift();
  38379. x = xb + stack.shift();
  38380. bezierCurveTo(xa, y, xb, y1, x, y1);
  38381. xa = x + stack.shift();
  38382. xb = xa + stack.shift();
  38383. x = xb + stack.shift();
  38384. bezierCurveTo(xa, y1, xb, y, x, y);
  38385. break;
  38386. case 35:
  38387. xa = x + stack.shift();
  38388. ya = y + stack.shift();
  38389. xb = xa + stack.shift();
  38390. yb = ya + stack.shift();
  38391. x = xb + stack.shift();
  38392. y = yb + stack.shift();
  38393. bezierCurveTo(xa, ya, xb, yb, x, y);
  38394. xa = x + stack.shift();
  38395. ya = y + stack.shift();
  38396. xb = xa + stack.shift();
  38397. yb = ya + stack.shift();
  38398. x = xb + stack.shift();
  38399. y = yb + stack.shift();
  38400. bezierCurveTo(xa, ya, xb, yb, x, y);
  38401. stack.pop();
  38402. break;
  38403. case 36:
  38404. xa = x + stack.shift();
  38405. y1 = y + stack.shift();
  38406. xb = xa + stack.shift();
  38407. y2 = y1 + stack.shift();
  38408. x = xb + stack.shift();
  38409. bezierCurveTo(xa, y1, xb, y2, x, y2);
  38410. xa = x + stack.shift();
  38411. xb = xa + stack.shift();
  38412. y3 = y2 + stack.shift();
  38413. x = xb + stack.shift();
  38414. bezierCurveTo(xa, y2, xb, y3, x, y);
  38415. break;
  38416. case 37:
  38417. const x0 = x,
  38418. y0 = y;
  38419. xa = x + stack.shift();
  38420. ya = y + stack.shift();
  38421. xb = xa + stack.shift();
  38422. yb = ya + stack.shift();
  38423. x = xb + stack.shift();
  38424. y = yb + stack.shift();
  38425. bezierCurveTo(xa, ya, xb, yb, x, y);
  38426. xa = x + stack.shift();
  38427. ya = y + stack.shift();
  38428. xb = xa + stack.shift();
  38429. yb = ya + stack.shift();
  38430. x = xb;
  38431. y = yb;
  38432. if (Math.abs(x - x0) > Math.abs(y - y0)) {
  38433. x += stack.shift();
  38434. } else {
  38435. y += stack.shift();
  38436. }
  38437. bezierCurveTo(xa, ya, xb, yb, x, y);
  38438. break;
  38439. default:
  38440. throw new _util.FormatError(`unknown operator: 12 ${v}`);
  38441. }
  38442. break;
  38443. case 14:
  38444. if (stack.length >= 4) {
  38445. const achar = stack.pop();
  38446. const bchar = stack.pop();
  38447. y = stack.pop();
  38448. x = stack.pop();
  38449. cmds.push({
  38450. cmd: "save"
  38451. }, {
  38452. cmd: "translate",
  38453. args: [x, y]
  38454. });
  38455. let cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[_encodings.StandardEncoding[achar]]));
  38456. compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId);
  38457. cmds.push({
  38458. cmd: "restore"
  38459. });
  38460. cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[_encodings.StandardEncoding[bchar]]));
  38461. compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId);
  38462. }
  38463. return;
  38464. case 18:
  38465. stems += stack.length >> 1;
  38466. stackClean = true;
  38467. break;
  38468. case 19:
  38469. stems += stack.length >> 1;
  38470. i += stems + 7 >> 3;
  38471. stackClean = true;
  38472. break;
  38473. case 20:
  38474. stems += stack.length >> 1;
  38475. i += stems + 7 >> 3;
  38476. stackClean = true;
  38477. break;
  38478. case 21:
  38479. y += stack.pop();
  38480. x += stack.pop();
  38481. moveTo(x, y);
  38482. stackClean = true;
  38483. break;
  38484. case 22:
  38485. x += stack.pop();
  38486. moveTo(x, y);
  38487. stackClean = true;
  38488. break;
  38489. case 23:
  38490. stems += stack.length >> 1;
  38491. stackClean = true;
  38492. break;
  38493. case 24:
  38494. while (stack.length > 2) {
  38495. xa = x + stack.shift();
  38496. ya = y + stack.shift();
  38497. xb = xa + stack.shift();
  38498. yb = ya + stack.shift();
  38499. x = xb + stack.shift();
  38500. y = yb + stack.shift();
  38501. bezierCurveTo(xa, ya, xb, yb, x, y);
  38502. }
  38503. x += stack.shift();
  38504. y += stack.shift();
  38505. lineTo(x, y);
  38506. break;
  38507. case 25:
  38508. while (stack.length > 6) {
  38509. x += stack.shift();
  38510. y += stack.shift();
  38511. lineTo(x, y);
  38512. }
  38513. xa = x + stack.shift();
  38514. ya = y + stack.shift();
  38515. xb = xa + stack.shift();
  38516. yb = ya + stack.shift();
  38517. x = xb + stack.shift();
  38518. y = yb + stack.shift();
  38519. bezierCurveTo(xa, ya, xb, yb, x, y);
  38520. break;
  38521. case 26:
  38522. if (stack.length % 2) {
  38523. x += stack.shift();
  38524. }
  38525. while (stack.length > 0) {
  38526. xa = x;
  38527. ya = y + stack.shift();
  38528. xb = xa + stack.shift();
  38529. yb = ya + stack.shift();
  38530. x = xb;
  38531. y = yb + stack.shift();
  38532. bezierCurveTo(xa, ya, xb, yb, x, y);
  38533. }
  38534. break;
  38535. case 27:
  38536. if (stack.length % 2) {
  38537. y += stack.shift();
  38538. }
  38539. while (stack.length > 0) {
  38540. xa = x + stack.shift();
  38541. ya = y;
  38542. xb = xa + stack.shift();
  38543. yb = ya + stack.shift();
  38544. x = xb + stack.shift();
  38545. y = yb;
  38546. bezierCurveTo(xa, ya, xb, yb, x, y);
  38547. }
  38548. break;
  38549. case 28:
  38550. stack.push((code[i] << 24 | code[i + 1] << 16) >> 16);
  38551. i += 2;
  38552. break;
  38553. case 29:
  38554. n = stack.pop() + font.gsubrsBias;
  38555. subrCode = font.gsubrs[n];
  38556. if (subrCode) {
  38557. parse(subrCode);
  38558. }
  38559. break;
  38560. case 30:
  38561. while (stack.length > 0) {
  38562. xa = x;
  38563. ya = y + stack.shift();
  38564. xb = xa + stack.shift();
  38565. yb = ya + stack.shift();
  38566. x = xb + stack.shift();
  38567. y = yb + (stack.length === 1 ? stack.shift() : 0);
  38568. bezierCurveTo(xa, ya, xb, yb, x, y);
  38569. if (stack.length === 0) {
  38570. break;
  38571. }
  38572. xa = x + stack.shift();
  38573. ya = y;
  38574. xb = xa + stack.shift();
  38575. yb = ya + stack.shift();
  38576. y = yb + stack.shift();
  38577. x = xb + (stack.length === 1 ? stack.shift() : 0);
  38578. bezierCurveTo(xa, ya, xb, yb, x, y);
  38579. }
  38580. break;
  38581. case 31:
  38582. while (stack.length > 0) {
  38583. xa = x + stack.shift();
  38584. ya = y;
  38585. xb = xa + stack.shift();
  38586. yb = ya + stack.shift();
  38587. y = yb + stack.shift();
  38588. x = xb + (stack.length === 1 ? stack.shift() : 0);
  38589. bezierCurveTo(xa, ya, xb, yb, x, y);
  38590. if (stack.length === 0) {
  38591. break;
  38592. }
  38593. xa = x;
  38594. ya = y + stack.shift();
  38595. xb = xa + stack.shift();
  38596. yb = ya + stack.shift();
  38597. x = xb + stack.shift();
  38598. y = yb + (stack.length === 1 ? stack.shift() : 0);
  38599. bezierCurveTo(xa, ya, xb, yb, x, y);
  38600. }
  38601. break;
  38602. default:
  38603. if (v < 32) {
  38604. throw new _util.FormatError(`unknown operator: ${v}`);
  38605. }
  38606. if (v < 247) {
  38607. stack.push(v - 139);
  38608. } else if (v < 251) {
  38609. stack.push((v - 247) * 256 + code[i++] + 108);
  38610. } else if (v < 255) {
  38611. stack.push(-(v - 251) * 256 - code[i++] - 108);
  38612. } else {
  38613. stack.push((code[i] << 24 | code[i + 1] << 16 | code[i + 2] << 8 | code[i + 3]) / 65536);
  38614. i += 4;
  38615. }
  38616. break;
  38617. }
  38618. if (stackClean) {
  38619. stack.length = 0;
  38620. }
  38621. }
  38622. }
  38623. parse(charStringCode);
  38624. }
  38625. const NOOP = [];
  38626. class CompiledFont {
  38627. constructor(fontMatrix) {
  38628. if (this.constructor === CompiledFont) {
  38629. (0, _util.unreachable)("Cannot initialize CompiledFont.");
  38630. }
  38631. this.fontMatrix = fontMatrix;
  38632. this.compiledGlyphs = Object.create(null);
  38633. this.compiledCharCodeToGlyphId = Object.create(null);
  38634. }
  38635. getPathJs(unicode) {
  38636. const {
  38637. charCode,
  38638. glyphId
  38639. } = lookupCmap(this.cmap, unicode);
  38640. let fn = this.compiledGlyphs[glyphId];
  38641. if (!fn) {
  38642. try {
  38643. fn = this.compileGlyph(this.glyphs[glyphId], glyphId);
  38644. this.compiledGlyphs[glyphId] = fn;
  38645. } catch (ex) {
  38646. this.compiledGlyphs[glyphId] = NOOP;
  38647. if (this.compiledCharCodeToGlyphId[charCode] === undefined) {
  38648. this.compiledCharCodeToGlyphId[charCode] = glyphId;
  38649. }
  38650. throw ex;
  38651. }
  38652. }
  38653. if (this.compiledCharCodeToGlyphId[charCode] === undefined) {
  38654. this.compiledCharCodeToGlyphId[charCode] = glyphId;
  38655. }
  38656. return fn;
  38657. }
  38658. compileGlyph(code, glyphId) {
  38659. if (!code || code.length === 0 || code[0] === 14) {
  38660. return NOOP;
  38661. }
  38662. let fontMatrix = this.fontMatrix;
  38663. if (this.isCFFCIDFont) {
  38664. const fdIndex = this.fdSelect.getFDIndex(glyphId);
  38665. if (fdIndex >= 0 && fdIndex < this.fdArray.length) {
  38666. const fontDict = this.fdArray[fdIndex];
  38667. fontMatrix = fontDict.getByName("FontMatrix") || _util.FONT_IDENTITY_MATRIX;
  38668. } else {
  38669. (0, _util.warn)("Invalid fd index for glyph index.");
  38670. }
  38671. }
  38672. const cmds = [{
  38673. cmd: "save"
  38674. }, {
  38675. cmd: "transform",
  38676. args: fontMatrix.slice()
  38677. }, {
  38678. cmd: "scale",
  38679. args: ["size", "-size"]
  38680. }];
  38681. this.compileGlyphImpl(code, cmds, glyphId);
  38682. cmds.push({
  38683. cmd: "restore"
  38684. });
  38685. return cmds;
  38686. }
  38687. compileGlyphImpl() {
  38688. (0, _util.unreachable)("Children classes should implement this.");
  38689. }
  38690. hasBuiltPath(unicode) {
  38691. const {
  38692. charCode,
  38693. glyphId
  38694. } = lookupCmap(this.cmap, unicode);
  38695. return this.compiledGlyphs[glyphId] !== undefined && this.compiledCharCodeToGlyphId[charCode] !== undefined;
  38696. }
  38697. }
  38698. class TrueTypeCompiled extends CompiledFont {
  38699. constructor(glyphs, cmap, fontMatrix) {
  38700. super(fontMatrix || [0.000488, 0, 0, 0.000488, 0, 0]);
  38701. this.glyphs = glyphs;
  38702. this.cmap = cmap;
  38703. }
  38704. compileGlyphImpl(code, cmds) {
  38705. compileGlyf(code, cmds, this);
  38706. }
  38707. }
  38708. class Type2Compiled extends CompiledFont {
  38709. constructor(cffInfo, cmap, fontMatrix, glyphNameMap) {
  38710. super(fontMatrix || [0.001, 0, 0, 0.001, 0, 0]);
  38711. this.glyphs = cffInfo.glyphs;
  38712. this.gsubrs = cffInfo.gsubrs || [];
  38713. this.subrs = cffInfo.subrs || [];
  38714. this.cmap = cmap;
  38715. this.glyphNameMap = glyphNameMap || (0, _glyphlist.getGlyphsUnicode)();
  38716. this.gsubrsBias = getSubroutineBias(this.gsubrs);
  38717. this.subrsBias = getSubroutineBias(this.subrs);
  38718. this.isCFFCIDFont = cffInfo.isCFFCIDFont;
  38719. this.fdSelect = cffInfo.fdSelect;
  38720. this.fdArray = cffInfo.fdArray;
  38721. }
  38722. compileGlyphImpl(code, cmds, glyphId) {
  38723. compileCharString(code, cmds, this, glyphId);
  38724. }
  38725. }
  38726. class FontRendererFactory {
  38727. static create(font, seacAnalysisEnabled) {
  38728. const data = new Uint8Array(font.data);
  38729. let cmap, glyf, loca, cff, indexToLocFormat, unitsPerEm;
  38730. const numTables = getUint16(data, 4);
  38731. for (let i = 0, p = 12; i < numTables; i++, p += 16) {
  38732. const tag = (0, _util.bytesToString)(data.subarray(p, p + 4));
  38733. const offset = getUint32(data, p + 8);
  38734. const length = getUint32(data, p + 12);
  38735. switch (tag) {
  38736. case "cmap":
  38737. cmap = parseCmap(data, offset, offset + length);
  38738. break;
  38739. case "glyf":
  38740. glyf = data.subarray(offset, offset + length);
  38741. break;
  38742. case "loca":
  38743. loca = data.subarray(offset, offset + length);
  38744. break;
  38745. case "head":
  38746. unitsPerEm = getUint16(data, offset + 18);
  38747. indexToLocFormat = getUint16(data, offset + 50);
  38748. break;
  38749. case "CFF ":
  38750. cff = parseCff(data, offset, offset + length, seacAnalysisEnabled);
  38751. break;
  38752. }
  38753. }
  38754. if (glyf) {
  38755. const fontMatrix = !unitsPerEm ? font.fontMatrix : [1 / unitsPerEm, 0, 0, 1 / unitsPerEm, 0, 0];
  38756. return new TrueTypeCompiled(parseGlyfTable(glyf, loca, indexToLocFormat), cmap, fontMatrix);
  38757. }
  38758. return new Type2Compiled(cff, cmap, font.fontMatrix, font.glyphNameMap);
  38759. }
  38760. }
  38761. exports.FontRendererFactory = FontRendererFactory;
  38762. /***/ }),
  38763. /* 51 */
  38764. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  38765. Object.defineProperty(exports, "__esModule", ({
  38766. value: true
  38767. }));
  38768. exports.getMetrics = exports.getFontBasicMetrics = void 0;
  38769. var _core_utils = __w_pdfjs_require__(6);
  38770. const getMetrics = (0, _core_utils.getLookupTableFactory)(function (t) {
  38771. t.Courier = 600;
  38772. t["Courier-Bold"] = 600;
  38773. t["Courier-BoldOblique"] = 600;
  38774. t["Courier-Oblique"] = 600;
  38775. t.Helvetica = (0, _core_utils.getLookupTableFactory)(function (t) {
  38776. t.space = 278;
  38777. t.exclam = 278;
  38778. t.quotedbl = 355;
  38779. t.numbersign = 556;
  38780. t.dollar = 556;
  38781. t.percent = 889;
  38782. t.ampersand = 667;
  38783. t.quoteright = 222;
  38784. t.parenleft = 333;
  38785. t.parenright = 333;
  38786. t.asterisk = 389;
  38787. t.plus = 584;
  38788. t.comma = 278;
  38789. t.hyphen = 333;
  38790. t.period = 278;
  38791. t.slash = 278;
  38792. t.zero = 556;
  38793. t.one = 556;
  38794. t.two = 556;
  38795. t.three = 556;
  38796. t.four = 556;
  38797. t.five = 556;
  38798. t.six = 556;
  38799. t.seven = 556;
  38800. t.eight = 556;
  38801. t.nine = 556;
  38802. t.colon = 278;
  38803. t.semicolon = 278;
  38804. t.less = 584;
  38805. t.equal = 584;
  38806. t.greater = 584;
  38807. t.question = 556;
  38808. t.at = 1015;
  38809. t.A = 667;
  38810. t.B = 667;
  38811. t.C = 722;
  38812. t.D = 722;
  38813. t.E = 667;
  38814. t.F = 611;
  38815. t.G = 778;
  38816. t.H = 722;
  38817. t.I = 278;
  38818. t.J = 500;
  38819. t.K = 667;
  38820. t.L = 556;
  38821. t.M = 833;
  38822. t.N = 722;
  38823. t.O = 778;
  38824. t.P = 667;
  38825. t.Q = 778;
  38826. t.R = 722;
  38827. t.S = 667;
  38828. t.T = 611;
  38829. t.U = 722;
  38830. t.V = 667;
  38831. t.W = 944;
  38832. t.X = 667;
  38833. t.Y = 667;
  38834. t.Z = 611;
  38835. t.bracketleft = 278;
  38836. t.backslash = 278;
  38837. t.bracketright = 278;
  38838. t.asciicircum = 469;
  38839. t.underscore = 556;
  38840. t.quoteleft = 222;
  38841. t.a = 556;
  38842. t.b = 556;
  38843. t.c = 500;
  38844. t.d = 556;
  38845. t.e = 556;
  38846. t.f = 278;
  38847. t.g = 556;
  38848. t.h = 556;
  38849. t.i = 222;
  38850. t.j = 222;
  38851. t.k = 500;
  38852. t.l = 222;
  38853. t.m = 833;
  38854. t.n = 556;
  38855. t.o = 556;
  38856. t.p = 556;
  38857. t.q = 556;
  38858. t.r = 333;
  38859. t.s = 500;
  38860. t.t = 278;
  38861. t.u = 556;
  38862. t.v = 500;
  38863. t.w = 722;
  38864. t.x = 500;
  38865. t.y = 500;
  38866. t.z = 500;
  38867. t.braceleft = 334;
  38868. t.bar = 260;
  38869. t.braceright = 334;
  38870. t.asciitilde = 584;
  38871. t.exclamdown = 333;
  38872. t.cent = 556;
  38873. t.sterling = 556;
  38874. t.fraction = 167;
  38875. t.yen = 556;
  38876. t.florin = 556;
  38877. t.section = 556;
  38878. t.currency = 556;
  38879. t.quotesingle = 191;
  38880. t.quotedblleft = 333;
  38881. t.guillemotleft = 556;
  38882. t.guilsinglleft = 333;
  38883. t.guilsinglright = 333;
  38884. t.fi = 500;
  38885. t.fl = 500;
  38886. t.endash = 556;
  38887. t.dagger = 556;
  38888. t.daggerdbl = 556;
  38889. t.periodcentered = 278;
  38890. t.paragraph = 537;
  38891. t.bullet = 350;
  38892. t.quotesinglbase = 222;
  38893. t.quotedblbase = 333;
  38894. t.quotedblright = 333;
  38895. t.guillemotright = 556;
  38896. t.ellipsis = 1000;
  38897. t.perthousand = 1000;
  38898. t.questiondown = 611;
  38899. t.grave = 333;
  38900. t.acute = 333;
  38901. t.circumflex = 333;
  38902. t.tilde = 333;
  38903. t.macron = 333;
  38904. t.breve = 333;
  38905. t.dotaccent = 333;
  38906. t.dieresis = 333;
  38907. t.ring = 333;
  38908. t.cedilla = 333;
  38909. t.hungarumlaut = 333;
  38910. t.ogonek = 333;
  38911. t.caron = 333;
  38912. t.emdash = 1000;
  38913. t.AE = 1000;
  38914. t.ordfeminine = 370;
  38915. t.Lslash = 556;
  38916. t.Oslash = 778;
  38917. t.OE = 1000;
  38918. t.ordmasculine = 365;
  38919. t.ae = 889;
  38920. t.dotlessi = 278;
  38921. t.lslash = 222;
  38922. t.oslash = 611;
  38923. t.oe = 944;
  38924. t.germandbls = 611;
  38925. t.Idieresis = 278;
  38926. t.eacute = 556;
  38927. t.abreve = 556;
  38928. t.uhungarumlaut = 556;
  38929. t.ecaron = 556;
  38930. t.Ydieresis = 667;
  38931. t.divide = 584;
  38932. t.Yacute = 667;
  38933. t.Acircumflex = 667;
  38934. t.aacute = 556;
  38935. t.Ucircumflex = 722;
  38936. t.yacute = 500;
  38937. t.scommaaccent = 500;
  38938. t.ecircumflex = 556;
  38939. t.Uring = 722;
  38940. t.Udieresis = 722;
  38941. t.aogonek = 556;
  38942. t.Uacute = 722;
  38943. t.uogonek = 556;
  38944. t.Edieresis = 667;
  38945. t.Dcroat = 722;
  38946. t.commaaccent = 250;
  38947. t.copyright = 737;
  38948. t.Emacron = 667;
  38949. t.ccaron = 500;
  38950. t.aring = 556;
  38951. t.Ncommaaccent = 722;
  38952. t.lacute = 222;
  38953. t.agrave = 556;
  38954. t.Tcommaaccent = 611;
  38955. t.Cacute = 722;
  38956. t.atilde = 556;
  38957. t.Edotaccent = 667;
  38958. t.scaron = 500;
  38959. t.scedilla = 500;
  38960. t.iacute = 278;
  38961. t.lozenge = 471;
  38962. t.Rcaron = 722;
  38963. t.Gcommaaccent = 778;
  38964. t.ucircumflex = 556;
  38965. t.acircumflex = 556;
  38966. t.Amacron = 667;
  38967. t.rcaron = 333;
  38968. t.ccedilla = 500;
  38969. t.Zdotaccent = 611;
  38970. t.Thorn = 667;
  38971. t.Omacron = 778;
  38972. t.Racute = 722;
  38973. t.Sacute = 667;
  38974. t.dcaron = 643;
  38975. t.Umacron = 722;
  38976. t.uring = 556;
  38977. t.threesuperior = 333;
  38978. t.Ograve = 778;
  38979. t.Agrave = 667;
  38980. t.Abreve = 667;
  38981. t.multiply = 584;
  38982. t.uacute = 556;
  38983. t.Tcaron = 611;
  38984. t.partialdiff = 476;
  38985. t.ydieresis = 500;
  38986. t.Nacute = 722;
  38987. t.icircumflex = 278;
  38988. t.Ecircumflex = 667;
  38989. t.adieresis = 556;
  38990. t.edieresis = 556;
  38991. t.cacute = 500;
  38992. t.nacute = 556;
  38993. t.umacron = 556;
  38994. t.Ncaron = 722;
  38995. t.Iacute = 278;
  38996. t.plusminus = 584;
  38997. t.brokenbar = 260;
  38998. t.registered = 737;
  38999. t.Gbreve = 778;
  39000. t.Idotaccent = 278;
  39001. t.summation = 600;
  39002. t.Egrave = 667;
  39003. t.racute = 333;
  39004. t.omacron = 556;
  39005. t.Zacute = 611;
  39006. t.Zcaron = 611;
  39007. t.greaterequal = 549;
  39008. t.Eth = 722;
  39009. t.Ccedilla = 722;
  39010. t.lcommaaccent = 222;
  39011. t.tcaron = 317;
  39012. t.eogonek = 556;
  39013. t.Uogonek = 722;
  39014. t.Aacute = 667;
  39015. t.Adieresis = 667;
  39016. t.egrave = 556;
  39017. t.zacute = 500;
  39018. t.iogonek = 222;
  39019. t.Oacute = 778;
  39020. t.oacute = 556;
  39021. t.amacron = 556;
  39022. t.sacute = 500;
  39023. t.idieresis = 278;
  39024. t.Ocircumflex = 778;
  39025. t.Ugrave = 722;
  39026. t.Delta = 612;
  39027. t.thorn = 556;
  39028. t.twosuperior = 333;
  39029. t.Odieresis = 778;
  39030. t.mu = 556;
  39031. t.igrave = 278;
  39032. t.ohungarumlaut = 556;
  39033. t.Eogonek = 667;
  39034. t.dcroat = 556;
  39035. t.threequarters = 834;
  39036. t.Scedilla = 667;
  39037. t.lcaron = 299;
  39038. t.Kcommaaccent = 667;
  39039. t.Lacute = 556;
  39040. t.trademark = 1000;
  39041. t.edotaccent = 556;
  39042. t.Igrave = 278;
  39043. t.Imacron = 278;
  39044. t.Lcaron = 556;
  39045. t.onehalf = 834;
  39046. t.lessequal = 549;
  39047. t.ocircumflex = 556;
  39048. t.ntilde = 556;
  39049. t.Uhungarumlaut = 722;
  39050. t.Eacute = 667;
  39051. t.emacron = 556;
  39052. t.gbreve = 556;
  39053. t.onequarter = 834;
  39054. t.Scaron = 667;
  39055. t.Scommaaccent = 667;
  39056. t.Ohungarumlaut = 778;
  39057. t.degree = 400;
  39058. t.ograve = 556;
  39059. t.Ccaron = 722;
  39060. t.ugrave = 556;
  39061. t.radical = 453;
  39062. t.Dcaron = 722;
  39063. t.rcommaaccent = 333;
  39064. t.Ntilde = 722;
  39065. t.otilde = 556;
  39066. t.Rcommaaccent = 722;
  39067. t.Lcommaaccent = 556;
  39068. t.Atilde = 667;
  39069. t.Aogonek = 667;
  39070. t.Aring = 667;
  39071. t.Otilde = 778;
  39072. t.zdotaccent = 500;
  39073. t.Ecaron = 667;
  39074. t.Iogonek = 278;
  39075. t.kcommaaccent = 500;
  39076. t.minus = 584;
  39077. t.Icircumflex = 278;
  39078. t.ncaron = 556;
  39079. t.tcommaaccent = 278;
  39080. t.logicalnot = 584;
  39081. t.odieresis = 556;
  39082. t.udieresis = 556;
  39083. t.notequal = 549;
  39084. t.gcommaaccent = 556;
  39085. t.eth = 556;
  39086. t.zcaron = 500;
  39087. t.ncommaaccent = 556;
  39088. t.onesuperior = 333;
  39089. t.imacron = 278;
  39090. t.Euro = 556;
  39091. });
  39092. t["Helvetica-Bold"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  39093. t.space = 278;
  39094. t.exclam = 333;
  39095. t.quotedbl = 474;
  39096. t.numbersign = 556;
  39097. t.dollar = 556;
  39098. t.percent = 889;
  39099. t.ampersand = 722;
  39100. t.quoteright = 278;
  39101. t.parenleft = 333;
  39102. t.parenright = 333;
  39103. t.asterisk = 389;
  39104. t.plus = 584;
  39105. t.comma = 278;
  39106. t.hyphen = 333;
  39107. t.period = 278;
  39108. t.slash = 278;
  39109. t.zero = 556;
  39110. t.one = 556;
  39111. t.two = 556;
  39112. t.three = 556;
  39113. t.four = 556;
  39114. t.five = 556;
  39115. t.six = 556;
  39116. t.seven = 556;
  39117. t.eight = 556;
  39118. t.nine = 556;
  39119. t.colon = 333;
  39120. t.semicolon = 333;
  39121. t.less = 584;
  39122. t.equal = 584;
  39123. t.greater = 584;
  39124. t.question = 611;
  39125. t.at = 975;
  39126. t.A = 722;
  39127. t.B = 722;
  39128. t.C = 722;
  39129. t.D = 722;
  39130. t.E = 667;
  39131. t.F = 611;
  39132. t.G = 778;
  39133. t.H = 722;
  39134. t.I = 278;
  39135. t.J = 556;
  39136. t.K = 722;
  39137. t.L = 611;
  39138. t.M = 833;
  39139. t.N = 722;
  39140. t.O = 778;
  39141. t.P = 667;
  39142. t.Q = 778;
  39143. t.R = 722;
  39144. t.S = 667;
  39145. t.T = 611;
  39146. t.U = 722;
  39147. t.V = 667;
  39148. t.W = 944;
  39149. t.X = 667;
  39150. t.Y = 667;
  39151. t.Z = 611;
  39152. t.bracketleft = 333;
  39153. t.backslash = 278;
  39154. t.bracketright = 333;
  39155. t.asciicircum = 584;
  39156. t.underscore = 556;
  39157. t.quoteleft = 278;
  39158. t.a = 556;
  39159. t.b = 611;
  39160. t.c = 556;
  39161. t.d = 611;
  39162. t.e = 556;
  39163. t.f = 333;
  39164. t.g = 611;
  39165. t.h = 611;
  39166. t.i = 278;
  39167. t.j = 278;
  39168. t.k = 556;
  39169. t.l = 278;
  39170. t.m = 889;
  39171. t.n = 611;
  39172. t.o = 611;
  39173. t.p = 611;
  39174. t.q = 611;
  39175. t.r = 389;
  39176. t.s = 556;
  39177. t.t = 333;
  39178. t.u = 611;
  39179. t.v = 556;
  39180. t.w = 778;
  39181. t.x = 556;
  39182. t.y = 556;
  39183. t.z = 500;
  39184. t.braceleft = 389;
  39185. t.bar = 280;
  39186. t.braceright = 389;
  39187. t.asciitilde = 584;
  39188. t.exclamdown = 333;
  39189. t.cent = 556;
  39190. t.sterling = 556;
  39191. t.fraction = 167;
  39192. t.yen = 556;
  39193. t.florin = 556;
  39194. t.section = 556;
  39195. t.currency = 556;
  39196. t.quotesingle = 238;
  39197. t.quotedblleft = 500;
  39198. t.guillemotleft = 556;
  39199. t.guilsinglleft = 333;
  39200. t.guilsinglright = 333;
  39201. t.fi = 611;
  39202. t.fl = 611;
  39203. t.endash = 556;
  39204. t.dagger = 556;
  39205. t.daggerdbl = 556;
  39206. t.periodcentered = 278;
  39207. t.paragraph = 556;
  39208. t.bullet = 350;
  39209. t.quotesinglbase = 278;
  39210. t.quotedblbase = 500;
  39211. t.quotedblright = 500;
  39212. t.guillemotright = 556;
  39213. t.ellipsis = 1000;
  39214. t.perthousand = 1000;
  39215. t.questiondown = 611;
  39216. t.grave = 333;
  39217. t.acute = 333;
  39218. t.circumflex = 333;
  39219. t.tilde = 333;
  39220. t.macron = 333;
  39221. t.breve = 333;
  39222. t.dotaccent = 333;
  39223. t.dieresis = 333;
  39224. t.ring = 333;
  39225. t.cedilla = 333;
  39226. t.hungarumlaut = 333;
  39227. t.ogonek = 333;
  39228. t.caron = 333;
  39229. t.emdash = 1000;
  39230. t.AE = 1000;
  39231. t.ordfeminine = 370;
  39232. t.Lslash = 611;
  39233. t.Oslash = 778;
  39234. t.OE = 1000;
  39235. t.ordmasculine = 365;
  39236. t.ae = 889;
  39237. t.dotlessi = 278;
  39238. t.lslash = 278;
  39239. t.oslash = 611;
  39240. t.oe = 944;
  39241. t.germandbls = 611;
  39242. t.Idieresis = 278;
  39243. t.eacute = 556;
  39244. t.abreve = 556;
  39245. t.uhungarumlaut = 611;
  39246. t.ecaron = 556;
  39247. t.Ydieresis = 667;
  39248. t.divide = 584;
  39249. t.Yacute = 667;
  39250. t.Acircumflex = 722;
  39251. t.aacute = 556;
  39252. t.Ucircumflex = 722;
  39253. t.yacute = 556;
  39254. t.scommaaccent = 556;
  39255. t.ecircumflex = 556;
  39256. t.Uring = 722;
  39257. t.Udieresis = 722;
  39258. t.aogonek = 556;
  39259. t.Uacute = 722;
  39260. t.uogonek = 611;
  39261. t.Edieresis = 667;
  39262. t.Dcroat = 722;
  39263. t.commaaccent = 250;
  39264. t.copyright = 737;
  39265. t.Emacron = 667;
  39266. t.ccaron = 556;
  39267. t.aring = 556;
  39268. t.Ncommaaccent = 722;
  39269. t.lacute = 278;
  39270. t.agrave = 556;
  39271. t.Tcommaaccent = 611;
  39272. t.Cacute = 722;
  39273. t.atilde = 556;
  39274. t.Edotaccent = 667;
  39275. t.scaron = 556;
  39276. t.scedilla = 556;
  39277. t.iacute = 278;
  39278. t.lozenge = 494;
  39279. t.Rcaron = 722;
  39280. t.Gcommaaccent = 778;
  39281. t.ucircumflex = 611;
  39282. t.acircumflex = 556;
  39283. t.Amacron = 722;
  39284. t.rcaron = 389;
  39285. t.ccedilla = 556;
  39286. t.Zdotaccent = 611;
  39287. t.Thorn = 667;
  39288. t.Omacron = 778;
  39289. t.Racute = 722;
  39290. t.Sacute = 667;
  39291. t.dcaron = 743;
  39292. t.Umacron = 722;
  39293. t.uring = 611;
  39294. t.threesuperior = 333;
  39295. t.Ograve = 778;
  39296. t.Agrave = 722;
  39297. t.Abreve = 722;
  39298. t.multiply = 584;
  39299. t.uacute = 611;
  39300. t.Tcaron = 611;
  39301. t.partialdiff = 494;
  39302. t.ydieresis = 556;
  39303. t.Nacute = 722;
  39304. t.icircumflex = 278;
  39305. t.Ecircumflex = 667;
  39306. t.adieresis = 556;
  39307. t.edieresis = 556;
  39308. t.cacute = 556;
  39309. t.nacute = 611;
  39310. t.umacron = 611;
  39311. t.Ncaron = 722;
  39312. t.Iacute = 278;
  39313. t.plusminus = 584;
  39314. t.brokenbar = 280;
  39315. t.registered = 737;
  39316. t.Gbreve = 778;
  39317. t.Idotaccent = 278;
  39318. t.summation = 600;
  39319. t.Egrave = 667;
  39320. t.racute = 389;
  39321. t.omacron = 611;
  39322. t.Zacute = 611;
  39323. t.Zcaron = 611;
  39324. t.greaterequal = 549;
  39325. t.Eth = 722;
  39326. t.Ccedilla = 722;
  39327. t.lcommaaccent = 278;
  39328. t.tcaron = 389;
  39329. t.eogonek = 556;
  39330. t.Uogonek = 722;
  39331. t.Aacute = 722;
  39332. t.Adieresis = 722;
  39333. t.egrave = 556;
  39334. t.zacute = 500;
  39335. t.iogonek = 278;
  39336. t.Oacute = 778;
  39337. t.oacute = 611;
  39338. t.amacron = 556;
  39339. t.sacute = 556;
  39340. t.idieresis = 278;
  39341. t.Ocircumflex = 778;
  39342. t.Ugrave = 722;
  39343. t.Delta = 612;
  39344. t.thorn = 611;
  39345. t.twosuperior = 333;
  39346. t.Odieresis = 778;
  39347. t.mu = 611;
  39348. t.igrave = 278;
  39349. t.ohungarumlaut = 611;
  39350. t.Eogonek = 667;
  39351. t.dcroat = 611;
  39352. t.threequarters = 834;
  39353. t.Scedilla = 667;
  39354. t.lcaron = 400;
  39355. t.Kcommaaccent = 722;
  39356. t.Lacute = 611;
  39357. t.trademark = 1000;
  39358. t.edotaccent = 556;
  39359. t.Igrave = 278;
  39360. t.Imacron = 278;
  39361. t.Lcaron = 611;
  39362. t.onehalf = 834;
  39363. t.lessequal = 549;
  39364. t.ocircumflex = 611;
  39365. t.ntilde = 611;
  39366. t.Uhungarumlaut = 722;
  39367. t.Eacute = 667;
  39368. t.emacron = 556;
  39369. t.gbreve = 611;
  39370. t.onequarter = 834;
  39371. t.Scaron = 667;
  39372. t.Scommaaccent = 667;
  39373. t.Ohungarumlaut = 778;
  39374. t.degree = 400;
  39375. t.ograve = 611;
  39376. t.Ccaron = 722;
  39377. t.ugrave = 611;
  39378. t.radical = 549;
  39379. t.Dcaron = 722;
  39380. t.rcommaaccent = 389;
  39381. t.Ntilde = 722;
  39382. t.otilde = 611;
  39383. t.Rcommaaccent = 722;
  39384. t.Lcommaaccent = 611;
  39385. t.Atilde = 722;
  39386. t.Aogonek = 722;
  39387. t.Aring = 722;
  39388. t.Otilde = 778;
  39389. t.zdotaccent = 500;
  39390. t.Ecaron = 667;
  39391. t.Iogonek = 278;
  39392. t.kcommaaccent = 556;
  39393. t.minus = 584;
  39394. t.Icircumflex = 278;
  39395. t.ncaron = 611;
  39396. t.tcommaaccent = 333;
  39397. t.logicalnot = 584;
  39398. t.odieresis = 611;
  39399. t.udieresis = 611;
  39400. t.notequal = 549;
  39401. t.gcommaaccent = 611;
  39402. t.eth = 611;
  39403. t.zcaron = 500;
  39404. t.ncommaaccent = 611;
  39405. t.onesuperior = 333;
  39406. t.imacron = 278;
  39407. t.Euro = 556;
  39408. });
  39409. t["Helvetica-BoldOblique"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  39410. t.space = 278;
  39411. t.exclam = 333;
  39412. t.quotedbl = 474;
  39413. t.numbersign = 556;
  39414. t.dollar = 556;
  39415. t.percent = 889;
  39416. t.ampersand = 722;
  39417. t.quoteright = 278;
  39418. t.parenleft = 333;
  39419. t.parenright = 333;
  39420. t.asterisk = 389;
  39421. t.plus = 584;
  39422. t.comma = 278;
  39423. t.hyphen = 333;
  39424. t.period = 278;
  39425. t.slash = 278;
  39426. t.zero = 556;
  39427. t.one = 556;
  39428. t.two = 556;
  39429. t.three = 556;
  39430. t.four = 556;
  39431. t.five = 556;
  39432. t.six = 556;
  39433. t.seven = 556;
  39434. t.eight = 556;
  39435. t.nine = 556;
  39436. t.colon = 333;
  39437. t.semicolon = 333;
  39438. t.less = 584;
  39439. t.equal = 584;
  39440. t.greater = 584;
  39441. t.question = 611;
  39442. t.at = 975;
  39443. t.A = 722;
  39444. t.B = 722;
  39445. t.C = 722;
  39446. t.D = 722;
  39447. t.E = 667;
  39448. t.F = 611;
  39449. t.G = 778;
  39450. t.H = 722;
  39451. t.I = 278;
  39452. t.J = 556;
  39453. t.K = 722;
  39454. t.L = 611;
  39455. t.M = 833;
  39456. t.N = 722;
  39457. t.O = 778;
  39458. t.P = 667;
  39459. t.Q = 778;
  39460. t.R = 722;
  39461. t.S = 667;
  39462. t.T = 611;
  39463. t.U = 722;
  39464. t.V = 667;
  39465. t.W = 944;
  39466. t.X = 667;
  39467. t.Y = 667;
  39468. t.Z = 611;
  39469. t.bracketleft = 333;
  39470. t.backslash = 278;
  39471. t.bracketright = 333;
  39472. t.asciicircum = 584;
  39473. t.underscore = 556;
  39474. t.quoteleft = 278;
  39475. t.a = 556;
  39476. t.b = 611;
  39477. t.c = 556;
  39478. t.d = 611;
  39479. t.e = 556;
  39480. t.f = 333;
  39481. t.g = 611;
  39482. t.h = 611;
  39483. t.i = 278;
  39484. t.j = 278;
  39485. t.k = 556;
  39486. t.l = 278;
  39487. t.m = 889;
  39488. t.n = 611;
  39489. t.o = 611;
  39490. t.p = 611;
  39491. t.q = 611;
  39492. t.r = 389;
  39493. t.s = 556;
  39494. t.t = 333;
  39495. t.u = 611;
  39496. t.v = 556;
  39497. t.w = 778;
  39498. t.x = 556;
  39499. t.y = 556;
  39500. t.z = 500;
  39501. t.braceleft = 389;
  39502. t.bar = 280;
  39503. t.braceright = 389;
  39504. t.asciitilde = 584;
  39505. t.exclamdown = 333;
  39506. t.cent = 556;
  39507. t.sterling = 556;
  39508. t.fraction = 167;
  39509. t.yen = 556;
  39510. t.florin = 556;
  39511. t.section = 556;
  39512. t.currency = 556;
  39513. t.quotesingle = 238;
  39514. t.quotedblleft = 500;
  39515. t.guillemotleft = 556;
  39516. t.guilsinglleft = 333;
  39517. t.guilsinglright = 333;
  39518. t.fi = 611;
  39519. t.fl = 611;
  39520. t.endash = 556;
  39521. t.dagger = 556;
  39522. t.daggerdbl = 556;
  39523. t.periodcentered = 278;
  39524. t.paragraph = 556;
  39525. t.bullet = 350;
  39526. t.quotesinglbase = 278;
  39527. t.quotedblbase = 500;
  39528. t.quotedblright = 500;
  39529. t.guillemotright = 556;
  39530. t.ellipsis = 1000;
  39531. t.perthousand = 1000;
  39532. t.questiondown = 611;
  39533. t.grave = 333;
  39534. t.acute = 333;
  39535. t.circumflex = 333;
  39536. t.tilde = 333;
  39537. t.macron = 333;
  39538. t.breve = 333;
  39539. t.dotaccent = 333;
  39540. t.dieresis = 333;
  39541. t.ring = 333;
  39542. t.cedilla = 333;
  39543. t.hungarumlaut = 333;
  39544. t.ogonek = 333;
  39545. t.caron = 333;
  39546. t.emdash = 1000;
  39547. t.AE = 1000;
  39548. t.ordfeminine = 370;
  39549. t.Lslash = 611;
  39550. t.Oslash = 778;
  39551. t.OE = 1000;
  39552. t.ordmasculine = 365;
  39553. t.ae = 889;
  39554. t.dotlessi = 278;
  39555. t.lslash = 278;
  39556. t.oslash = 611;
  39557. t.oe = 944;
  39558. t.germandbls = 611;
  39559. t.Idieresis = 278;
  39560. t.eacute = 556;
  39561. t.abreve = 556;
  39562. t.uhungarumlaut = 611;
  39563. t.ecaron = 556;
  39564. t.Ydieresis = 667;
  39565. t.divide = 584;
  39566. t.Yacute = 667;
  39567. t.Acircumflex = 722;
  39568. t.aacute = 556;
  39569. t.Ucircumflex = 722;
  39570. t.yacute = 556;
  39571. t.scommaaccent = 556;
  39572. t.ecircumflex = 556;
  39573. t.Uring = 722;
  39574. t.Udieresis = 722;
  39575. t.aogonek = 556;
  39576. t.Uacute = 722;
  39577. t.uogonek = 611;
  39578. t.Edieresis = 667;
  39579. t.Dcroat = 722;
  39580. t.commaaccent = 250;
  39581. t.copyright = 737;
  39582. t.Emacron = 667;
  39583. t.ccaron = 556;
  39584. t.aring = 556;
  39585. t.Ncommaaccent = 722;
  39586. t.lacute = 278;
  39587. t.agrave = 556;
  39588. t.Tcommaaccent = 611;
  39589. t.Cacute = 722;
  39590. t.atilde = 556;
  39591. t.Edotaccent = 667;
  39592. t.scaron = 556;
  39593. t.scedilla = 556;
  39594. t.iacute = 278;
  39595. t.lozenge = 494;
  39596. t.Rcaron = 722;
  39597. t.Gcommaaccent = 778;
  39598. t.ucircumflex = 611;
  39599. t.acircumflex = 556;
  39600. t.Amacron = 722;
  39601. t.rcaron = 389;
  39602. t.ccedilla = 556;
  39603. t.Zdotaccent = 611;
  39604. t.Thorn = 667;
  39605. t.Omacron = 778;
  39606. t.Racute = 722;
  39607. t.Sacute = 667;
  39608. t.dcaron = 743;
  39609. t.Umacron = 722;
  39610. t.uring = 611;
  39611. t.threesuperior = 333;
  39612. t.Ograve = 778;
  39613. t.Agrave = 722;
  39614. t.Abreve = 722;
  39615. t.multiply = 584;
  39616. t.uacute = 611;
  39617. t.Tcaron = 611;
  39618. t.partialdiff = 494;
  39619. t.ydieresis = 556;
  39620. t.Nacute = 722;
  39621. t.icircumflex = 278;
  39622. t.Ecircumflex = 667;
  39623. t.adieresis = 556;
  39624. t.edieresis = 556;
  39625. t.cacute = 556;
  39626. t.nacute = 611;
  39627. t.umacron = 611;
  39628. t.Ncaron = 722;
  39629. t.Iacute = 278;
  39630. t.plusminus = 584;
  39631. t.brokenbar = 280;
  39632. t.registered = 737;
  39633. t.Gbreve = 778;
  39634. t.Idotaccent = 278;
  39635. t.summation = 600;
  39636. t.Egrave = 667;
  39637. t.racute = 389;
  39638. t.omacron = 611;
  39639. t.Zacute = 611;
  39640. t.Zcaron = 611;
  39641. t.greaterequal = 549;
  39642. t.Eth = 722;
  39643. t.Ccedilla = 722;
  39644. t.lcommaaccent = 278;
  39645. t.tcaron = 389;
  39646. t.eogonek = 556;
  39647. t.Uogonek = 722;
  39648. t.Aacute = 722;
  39649. t.Adieresis = 722;
  39650. t.egrave = 556;
  39651. t.zacute = 500;
  39652. t.iogonek = 278;
  39653. t.Oacute = 778;
  39654. t.oacute = 611;
  39655. t.amacron = 556;
  39656. t.sacute = 556;
  39657. t.idieresis = 278;
  39658. t.Ocircumflex = 778;
  39659. t.Ugrave = 722;
  39660. t.Delta = 612;
  39661. t.thorn = 611;
  39662. t.twosuperior = 333;
  39663. t.Odieresis = 778;
  39664. t.mu = 611;
  39665. t.igrave = 278;
  39666. t.ohungarumlaut = 611;
  39667. t.Eogonek = 667;
  39668. t.dcroat = 611;
  39669. t.threequarters = 834;
  39670. t.Scedilla = 667;
  39671. t.lcaron = 400;
  39672. t.Kcommaaccent = 722;
  39673. t.Lacute = 611;
  39674. t.trademark = 1000;
  39675. t.edotaccent = 556;
  39676. t.Igrave = 278;
  39677. t.Imacron = 278;
  39678. t.Lcaron = 611;
  39679. t.onehalf = 834;
  39680. t.lessequal = 549;
  39681. t.ocircumflex = 611;
  39682. t.ntilde = 611;
  39683. t.Uhungarumlaut = 722;
  39684. t.Eacute = 667;
  39685. t.emacron = 556;
  39686. t.gbreve = 611;
  39687. t.onequarter = 834;
  39688. t.Scaron = 667;
  39689. t.Scommaaccent = 667;
  39690. t.Ohungarumlaut = 778;
  39691. t.degree = 400;
  39692. t.ograve = 611;
  39693. t.Ccaron = 722;
  39694. t.ugrave = 611;
  39695. t.radical = 549;
  39696. t.Dcaron = 722;
  39697. t.rcommaaccent = 389;
  39698. t.Ntilde = 722;
  39699. t.otilde = 611;
  39700. t.Rcommaaccent = 722;
  39701. t.Lcommaaccent = 611;
  39702. t.Atilde = 722;
  39703. t.Aogonek = 722;
  39704. t.Aring = 722;
  39705. t.Otilde = 778;
  39706. t.zdotaccent = 500;
  39707. t.Ecaron = 667;
  39708. t.Iogonek = 278;
  39709. t.kcommaaccent = 556;
  39710. t.minus = 584;
  39711. t.Icircumflex = 278;
  39712. t.ncaron = 611;
  39713. t.tcommaaccent = 333;
  39714. t.logicalnot = 584;
  39715. t.odieresis = 611;
  39716. t.udieresis = 611;
  39717. t.notequal = 549;
  39718. t.gcommaaccent = 611;
  39719. t.eth = 611;
  39720. t.zcaron = 500;
  39721. t.ncommaaccent = 611;
  39722. t.onesuperior = 333;
  39723. t.imacron = 278;
  39724. t.Euro = 556;
  39725. });
  39726. t["Helvetica-Oblique"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  39727. t.space = 278;
  39728. t.exclam = 278;
  39729. t.quotedbl = 355;
  39730. t.numbersign = 556;
  39731. t.dollar = 556;
  39732. t.percent = 889;
  39733. t.ampersand = 667;
  39734. t.quoteright = 222;
  39735. t.parenleft = 333;
  39736. t.parenright = 333;
  39737. t.asterisk = 389;
  39738. t.plus = 584;
  39739. t.comma = 278;
  39740. t.hyphen = 333;
  39741. t.period = 278;
  39742. t.slash = 278;
  39743. t.zero = 556;
  39744. t.one = 556;
  39745. t.two = 556;
  39746. t.three = 556;
  39747. t.four = 556;
  39748. t.five = 556;
  39749. t.six = 556;
  39750. t.seven = 556;
  39751. t.eight = 556;
  39752. t.nine = 556;
  39753. t.colon = 278;
  39754. t.semicolon = 278;
  39755. t.less = 584;
  39756. t.equal = 584;
  39757. t.greater = 584;
  39758. t.question = 556;
  39759. t.at = 1015;
  39760. t.A = 667;
  39761. t.B = 667;
  39762. t.C = 722;
  39763. t.D = 722;
  39764. t.E = 667;
  39765. t.F = 611;
  39766. t.G = 778;
  39767. t.H = 722;
  39768. t.I = 278;
  39769. t.J = 500;
  39770. t.K = 667;
  39771. t.L = 556;
  39772. t.M = 833;
  39773. t.N = 722;
  39774. t.O = 778;
  39775. t.P = 667;
  39776. t.Q = 778;
  39777. t.R = 722;
  39778. t.S = 667;
  39779. t.T = 611;
  39780. t.U = 722;
  39781. t.V = 667;
  39782. t.W = 944;
  39783. t.X = 667;
  39784. t.Y = 667;
  39785. t.Z = 611;
  39786. t.bracketleft = 278;
  39787. t.backslash = 278;
  39788. t.bracketright = 278;
  39789. t.asciicircum = 469;
  39790. t.underscore = 556;
  39791. t.quoteleft = 222;
  39792. t.a = 556;
  39793. t.b = 556;
  39794. t.c = 500;
  39795. t.d = 556;
  39796. t.e = 556;
  39797. t.f = 278;
  39798. t.g = 556;
  39799. t.h = 556;
  39800. t.i = 222;
  39801. t.j = 222;
  39802. t.k = 500;
  39803. t.l = 222;
  39804. t.m = 833;
  39805. t.n = 556;
  39806. t.o = 556;
  39807. t.p = 556;
  39808. t.q = 556;
  39809. t.r = 333;
  39810. t.s = 500;
  39811. t.t = 278;
  39812. t.u = 556;
  39813. t.v = 500;
  39814. t.w = 722;
  39815. t.x = 500;
  39816. t.y = 500;
  39817. t.z = 500;
  39818. t.braceleft = 334;
  39819. t.bar = 260;
  39820. t.braceright = 334;
  39821. t.asciitilde = 584;
  39822. t.exclamdown = 333;
  39823. t.cent = 556;
  39824. t.sterling = 556;
  39825. t.fraction = 167;
  39826. t.yen = 556;
  39827. t.florin = 556;
  39828. t.section = 556;
  39829. t.currency = 556;
  39830. t.quotesingle = 191;
  39831. t.quotedblleft = 333;
  39832. t.guillemotleft = 556;
  39833. t.guilsinglleft = 333;
  39834. t.guilsinglright = 333;
  39835. t.fi = 500;
  39836. t.fl = 500;
  39837. t.endash = 556;
  39838. t.dagger = 556;
  39839. t.daggerdbl = 556;
  39840. t.periodcentered = 278;
  39841. t.paragraph = 537;
  39842. t.bullet = 350;
  39843. t.quotesinglbase = 222;
  39844. t.quotedblbase = 333;
  39845. t.quotedblright = 333;
  39846. t.guillemotright = 556;
  39847. t.ellipsis = 1000;
  39848. t.perthousand = 1000;
  39849. t.questiondown = 611;
  39850. t.grave = 333;
  39851. t.acute = 333;
  39852. t.circumflex = 333;
  39853. t.tilde = 333;
  39854. t.macron = 333;
  39855. t.breve = 333;
  39856. t.dotaccent = 333;
  39857. t.dieresis = 333;
  39858. t.ring = 333;
  39859. t.cedilla = 333;
  39860. t.hungarumlaut = 333;
  39861. t.ogonek = 333;
  39862. t.caron = 333;
  39863. t.emdash = 1000;
  39864. t.AE = 1000;
  39865. t.ordfeminine = 370;
  39866. t.Lslash = 556;
  39867. t.Oslash = 778;
  39868. t.OE = 1000;
  39869. t.ordmasculine = 365;
  39870. t.ae = 889;
  39871. t.dotlessi = 278;
  39872. t.lslash = 222;
  39873. t.oslash = 611;
  39874. t.oe = 944;
  39875. t.germandbls = 611;
  39876. t.Idieresis = 278;
  39877. t.eacute = 556;
  39878. t.abreve = 556;
  39879. t.uhungarumlaut = 556;
  39880. t.ecaron = 556;
  39881. t.Ydieresis = 667;
  39882. t.divide = 584;
  39883. t.Yacute = 667;
  39884. t.Acircumflex = 667;
  39885. t.aacute = 556;
  39886. t.Ucircumflex = 722;
  39887. t.yacute = 500;
  39888. t.scommaaccent = 500;
  39889. t.ecircumflex = 556;
  39890. t.Uring = 722;
  39891. t.Udieresis = 722;
  39892. t.aogonek = 556;
  39893. t.Uacute = 722;
  39894. t.uogonek = 556;
  39895. t.Edieresis = 667;
  39896. t.Dcroat = 722;
  39897. t.commaaccent = 250;
  39898. t.copyright = 737;
  39899. t.Emacron = 667;
  39900. t.ccaron = 500;
  39901. t.aring = 556;
  39902. t.Ncommaaccent = 722;
  39903. t.lacute = 222;
  39904. t.agrave = 556;
  39905. t.Tcommaaccent = 611;
  39906. t.Cacute = 722;
  39907. t.atilde = 556;
  39908. t.Edotaccent = 667;
  39909. t.scaron = 500;
  39910. t.scedilla = 500;
  39911. t.iacute = 278;
  39912. t.lozenge = 471;
  39913. t.Rcaron = 722;
  39914. t.Gcommaaccent = 778;
  39915. t.ucircumflex = 556;
  39916. t.acircumflex = 556;
  39917. t.Amacron = 667;
  39918. t.rcaron = 333;
  39919. t.ccedilla = 500;
  39920. t.Zdotaccent = 611;
  39921. t.Thorn = 667;
  39922. t.Omacron = 778;
  39923. t.Racute = 722;
  39924. t.Sacute = 667;
  39925. t.dcaron = 643;
  39926. t.Umacron = 722;
  39927. t.uring = 556;
  39928. t.threesuperior = 333;
  39929. t.Ograve = 778;
  39930. t.Agrave = 667;
  39931. t.Abreve = 667;
  39932. t.multiply = 584;
  39933. t.uacute = 556;
  39934. t.Tcaron = 611;
  39935. t.partialdiff = 476;
  39936. t.ydieresis = 500;
  39937. t.Nacute = 722;
  39938. t.icircumflex = 278;
  39939. t.Ecircumflex = 667;
  39940. t.adieresis = 556;
  39941. t.edieresis = 556;
  39942. t.cacute = 500;
  39943. t.nacute = 556;
  39944. t.umacron = 556;
  39945. t.Ncaron = 722;
  39946. t.Iacute = 278;
  39947. t.plusminus = 584;
  39948. t.brokenbar = 260;
  39949. t.registered = 737;
  39950. t.Gbreve = 778;
  39951. t.Idotaccent = 278;
  39952. t.summation = 600;
  39953. t.Egrave = 667;
  39954. t.racute = 333;
  39955. t.omacron = 556;
  39956. t.Zacute = 611;
  39957. t.Zcaron = 611;
  39958. t.greaterequal = 549;
  39959. t.Eth = 722;
  39960. t.Ccedilla = 722;
  39961. t.lcommaaccent = 222;
  39962. t.tcaron = 317;
  39963. t.eogonek = 556;
  39964. t.Uogonek = 722;
  39965. t.Aacute = 667;
  39966. t.Adieresis = 667;
  39967. t.egrave = 556;
  39968. t.zacute = 500;
  39969. t.iogonek = 222;
  39970. t.Oacute = 778;
  39971. t.oacute = 556;
  39972. t.amacron = 556;
  39973. t.sacute = 500;
  39974. t.idieresis = 278;
  39975. t.Ocircumflex = 778;
  39976. t.Ugrave = 722;
  39977. t.Delta = 612;
  39978. t.thorn = 556;
  39979. t.twosuperior = 333;
  39980. t.Odieresis = 778;
  39981. t.mu = 556;
  39982. t.igrave = 278;
  39983. t.ohungarumlaut = 556;
  39984. t.Eogonek = 667;
  39985. t.dcroat = 556;
  39986. t.threequarters = 834;
  39987. t.Scedilla = 667;
  39988. t.lcaron = 299;
  39989. t.Kcommaaccent = 667;
  39990. t.Lacute = 556;
  39991. t.trademark = 1000;
  39992. t.edotaccent = 556;
  39993. t.Igrave = 278;
  39994. t.Imacron = 278;
  39995. t.Lcaron = 556;
  39996. t.onehalf = 834;
  39997. t.lessequal = 549;
  39998. t.ocircumflex = 556;
  39999. t.ntilde = 556;
  40000. t.Uhungarumlaut = 722;
  40001. t.Eacute = 667;
  40002. t.emacron = 556;
  40003. t.gbreve = 556;
  40004. t.onequarter = 834;
  40005. t.Scaron = 667;
  40006. t.Scommaaccent = 667;
  40007. t.Ohungarumlaut = 778;
  40008. t.degree = 400;
  40009. t.ograve = 556;
  40010. t.Ccaron = 722;
  40011. t.ugrave = 556;
  40012. t.radical = 453;
  40013. t.Dcaron = 722;
  40014. t.rcommaaccent = 333;
  40015. t.Ntilde = 722;
  40016. t.otilde = 556;
  40017. t.Rcommaaccent = 722;
  40018. t.Lcommaaccent = 556;
  40019. t.Atilde = 667;
  40020. t.Aogonek = 667;
  40021. t.Aring = 667;
  40022. t.Otilde = 778;
  40023. t.zdotaccent = 500;
  40024. t.Ecaron = 667;
  40025. t.Iogonek = 278;
  40026. t.kcommaaccent = 500;
  40027. t.minus = 584;
  40028. t.Icircumflex = 278;
  40029. t.ncaron = 556;
  40030. t.tcommaaccent = 278;
  40031. t.logicalnot = 584;
  40032. t.odieresis = 556;
  40033. t.udieresis = 556;
  40034. t.notequal = 549;
  40035. t.gcommaaccent = 556;
  40036. t.eth = 556;
  40037. t.zcaron = 500;
  40038. t.ncommaaccent = 556;
  40039. t.onesuperior = 333;
  40040. t.imacron = 278;
  40041. t.Euro = 556;
  40042. });
  40043. t.Symbol = (0, _core_utils.getLookupTableFactory)(function (t) {
  40044. t.space = 250;
  40045. t.exclam = 333;
  40046. t.universal = 713;
  40047. t.numbersign = 500;
  40048. t.existential = 549;
  40049. t.percent = 833;
  40050. t.ampersand = 778;
  40051. t.suchthat = 439;
  40052. t.parenleft = 333;
  40053. t.parenright = 333;
  40054. t.asteriskmath = 500;
  40055. t.plus = 549;
  40056. t.comma = 250;
  40057. t.minus = 549;
  40058. t.period = 250;
  40059. t.slash = 278;
  40060. t.zero = 500;
  40061. t.one = 500;
  40062. t.two = 500;
  40063. t.three = 500;
  40064. t.four = 500;
  40065. t.five = 500;
  40066. t.six = 500;
  40067. t.seven = 500;
  40068. t.eight = 500;
  40069. t.nine = 500;
  40070. t.colon = 278;
  40071. t.semicolon = 278;
  40072. t.less = 549;
  40073. t.equal = 549;
  40074. t.greater = 549;
  40075. t.question = 444;
  40076. t.congruent = 549;
  40077. t.Alpha = 722;
  40078. t.Beta = 667;
  40079. t.Chi = 722;
  40080. t.Delta = 612;
  40081. t.Epsilon = 611;
  40082. t.Phi = 763;
  40083. t.Gamma = 603;
  40084. t.Eta = 722;
  40085. t.Iota = 333;
  40086. t.theta1 = 631;
  40087. t.Kappa = 722;
  40088. t.Lambda = 686;
  40089. t.Mu = 889;
  40090. t.Nu = 722;
  40091. t.Omicron = 722;
  40092. t.Pi = 768;
  40093. t.Theta = 741;
  40094. t.Rho = 556;
  40095. t.Sigma = 592;
  40096. t.Tau = 611;
  40097. t.Upsilon = 690;
  40098. t.sigma1 = 439;
  40099. t.Omega = 768;
  40100. t.Xi = 645;
  40101. t.Psi = 795;
  40102. t.Zeta = 611;
  40103. t.bracketleft = 333;
  40104. t.therefore = 863;
  40105. t.bracketright = 333;
  40106. t.perpendicular = 658;
  40107. t.underscore = 500;
  40108. t.radicalex = 500;
  40109. t.alpha = 631;
  40110. t.beta = 549;
  40111. t.chi = 549;
  40112. t.delta = 494;
  40113. t.epsilon = 439;
  40114. t.phi = 521;
  40115. t.gamma = 411;
  40116. t.eta = 603;
  40117. t.iota = 329;
  40118. t.phi1 = 603;
  40119. t.kappa = 549;
  40120. t.lambda = 549;
  40121. t.mu = 576;
  40122. t.nu = 521;
  40123. t.omicron = 549;
  40124. t.pi = 549;
  40125. t.theta = 521;
  40126. t.rho = 549;
  40127. t.sigma = 603;
  40128. t.tau = 439;
  40129. t.upsilon = 576;
  40130. t.omega1 = 713;
  40131. t.omega = 686;
  40132. t.xi = 493;
  40133. t.psi = 686;
  40134. t.zeta = 494;
  40135. t.braceleft = 480;
  40136. t.bar = 200;
  40137. t.braceright = 480;
  40138. t.similar = 549;
  40139. t.Euro = 750;
  40140. t.Upsilon1 = 620;
  40141. t.minute = 247;
  40142. t.lessequal = 549;
  40143. t.fraction = 167;
  40144. t.infinity = 713;
  40145. t.florin = 500;
  40146. t.club = 753;
  40147. t.diamond = 753;
  40148. t.heart = 753;
  40149. t.spade = 753;
  40150. t.arrowboth = 1042;
  40151. t.arrowleft = 987;
  40152. t.arrowup = 603;
  40153. t.arrowright = 987;
  40154. t.arrowdown = 603;
  40155. t.degree = 400;
  40156. t.plusminus = 549;
  40157. t.second = 411;
  40158. t.greaterequal = 549;
  40159. t.multiply = 549;
  40160. t.proportional = 713;
  40161. t.partialdiff = 494;
  40162. t.bullet = 460;
  40163. t.divide = 549;
  40164. t.notequal = 549;
  40165. t.equivalence = 549;
  40166. t.approxequal = 549;
  40167. t.ellipsis = 1000;
  40168. t.arrowvertex = 603;
  40169. t.arrowhorizex = 1000;
  40170. t.carriagereturn = 658;
  40171. t.aleph = 823;
  40172. t.Ifraktur = 686;
  40173. t.Rfraktur = 795;
  40174. t.weierstrass = 987;
  40175. t.circlemultiply = 768;
  40176. t.circleplus = 768;
  40177. t.emptyset = 823;
  40178. t.intersection = 768;
  40179. t.union = 768;
  40180. t.propersuperset = 713;
  40181. t.reflexsuperset = 713;
  40182. t.notsubset = 713;
  40183. t.propersubset = 713;
  40184. t.reflexsubset = 713;
  40185. t.element = 713;
  40186. t.notelement = 713;
  40187. t.angle = 768;
  40188. t.gradient = 713;
  40189. t.registerserif = 790;
  40190. t.copyrightserif = 790;
  40191. t.trademarkserif = 890;
  40192. t.product = 823;
  40193. t.radical = 549;
  40194. t.dotmath = 250;
  40195. t.logicalnot = 713;
  40196. t.logicaland = 603;
  40197. t.logicalor = 603;
  40198. t.arrowdblboth = 1042;
  40199. t.arrowdblleft = 987;
  40200. t.arrowdblup = 603;
  40201. t.arrowdblright = 987;
  40202. t.arrowdbldown = 603;
  40203. t.lozenge = 494;
  40204. t.angleleft = 329;
  40205. t.registersans = 790;
  40206. t.copyrightsans = 790;
  40207. t.trademarksans = 786;
  40208. t.summation = 713;
  40209. t.parenlefttp = 384;
  40210. t.parenleftex = 384;
  40211. t.parenleftbt = 384;
  40212. t.bracketlefttp = 384;
  40213. t.bracketleftex = 384;
  40214. t.bracketleftbt = 384;
  40215. t.bracelefttp = 494;
  40216. t.braceleftmid = 494;
  40217. t.braceleftbt = 494;
  40218. t.braceex = 494;
  40219. t.angleright = 329;
  40220. t.integral = 274;
  40221. t.integraltp = 686;
  40222. t.integralex = 686;
  40223. t.integralbt = 686;
  40224. t.parenrighttp = 384;
  40225. t.parenrightex = 384;
  40226. t.parenrightbt = 384;
  40227. t.bracketrighttp = 384;
  40228. t.bracketrightex = 384;
  40229. t.bracketrightbt = 384;
  40230. t.bracerighttp = 494;
  40231. t.bracerightmid = 494;
  40232. t.bracerightbt = 494;
  40233. t.apple = 790;
  40234. });
  40235. t["Times-Roman"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  40236. t.space = 250;
  40237. t.exclam = 333;
  40238. t.quotedbl = 408;
  40239. t.numbersign = 500;
  40240. t.dollar = 500;
  40241. t.percent = 833;
  40242. t.ampersand = 778;
  40243. t.quoteright = 333;
  40244. t.parenleft = 333;
  40245. t.parenright = 333;
  40246. t.asterisk = 500;
  40247. t.plus = 564;
  40248. t.comma = 250;
  40249. t.hyphen = 333;
  40250. t.period = 250;
  40251. t.slash = 278;
  40252. t.zero = 500;
  40253. t.one = 500;
  40254. t.two = 500;
  40255. t.three = 500;
  40256. t.four = 500;
  40257. t.five = 500;
  40258. t.six = 500;
  40259. t.seven = 500;
  40260. t.eight = 500;
  40261. t.nine = 500;
  40262. t.colon = 278;
  40263. t.semicolon = 278;
  40264. t.less = 564;
  40265. t.equal = 564;
  40266. t.greater = 564;
  40267. t.question = 444;
  40268. t.at = 921;
  40269. t.A = 722;
  40270. t.B = 667;
  40271. t.C = 667;
  40272. t.D = 722;
  40273. t.E = 611;
  40274. t.F = 556;
  40275. t.G = 722;
  40276. t.H = 722;
  40277. t.I = 333;
  40278. t.J = 389;
  40279. t.K = 722;
  40280. t.L = 611;
  40281. t.M = 889;
  40282. t.N = 722;
  40283. t.O = 722;
  40284. t.P = 556;
  40285. t.Q = 722;
  40286. t.R = 667;
  40287. t.S = 556;
  40288. t.T = 611;
  40289. t.U = 722;
  40290. t.V = 722;
  40291. t.W = 944;
  40292. t.X = 722;
  40293. t.Y = 722;
  40294. t.Z = 611;
  40295. t.bracketleft = 333;
  40296. t.backslash = 278;
  40297. t.bracketright = 333;
  40298. t.asciicircum = 469;
  40299. t.underscore = 500;
  40300. t.quoteleft = 333;
  40301. t.a = 444;
  40302. t.b = 500;
  40303. t.c = 444;
  40304. t.d = 500;
  40305. t.e = 444;
  40306. t.f = 333;
  40307. t.g = 500;
  40308. t.h = 500;
  40309. t.i = 278;
  40310. t.j = 278;
  40311. t.k = 500;
  40312. t.l = 278;
  40313. t.m = 778;
  40314. t.n = 500;
  40315. t.o = 500;
  40316. t.p = 500;
  40317. t.q = 500;
  40318. t.r = 333;
  40319. t.s = 389;
  40320. t.t = 278;
  40321. t.u = 500;
  40322. t.v = 500;
  40323. t.w = 722;
  40324. t.x = 500;
  40325. t.y = 500;
  40326. t.z = 444;
  40327. t.braceleft = 480;
  40328. t.bar = 200;
  40329. t.braceright = 480;
  40330. t.asciitilde = 541;
  40331. t.exclamdown = 333;
  40332. t.cent = 500;
  40333. t.sterling = 500;
  40334. t.fraction = 167;
  40335. t.yen = 500;
  40336. t.florin = 500;
  40337. t.section = 500;
  40338. t.currency = 500;
  40339. t.quotesingle = 180;
  40340. t.quotedblleft = 444;
  40341. t.guillemotleft = 500;
  40342. t.guilsinglleft = 333;
  40343. t.guilsinglright = 333;
  40344. t.fi = 556;
  40345. t.fl = 556;
  40346. t.endash = 500;
  40347. t.dagger = 500;
  40348. t.daggerdbl = 500;
  40349. t.periodcentered = 250;
  40350. t.paragraph = 453;
  40351. t.bullet = 350;
  40352. t.quotesinglbase = 333;
  40353. t.quotedblbase = 444;
  40354. t.quotedblright = 444;
  40355. t.guillemotright = 500;
  40356. t.ellipsis = 1000;
  40357. t.perthousand = 1000;
  40358. t.questiondown = 444;
  40359. t.grave = 333;
  40360. t.acute = 333;
  40361. t.circumflex = 333;
  40362. t.tilde = 333;
  40363. t.macron = 333;
  40364. t.breve = 333;
  40365. t.dotaccent = 333;
  40366. t.dieresis = 333;
  40367. t.ring = 333;
  40368. t.cedilla = 333;
  40369. t.hungarumlaut = 333;
  40370. t.ogonek = 333;
  40371. t.caron = 333;
  40372. t.emdash = 1000;
  40373. t.AE = 889;
  40374. t.ordfeminine = 276;
  40375. t.Lslash = 611;
  40376. t.Oslash = 722;
  40377. t.OE = 889;
  40378. t.ordmasculine = 310;
  40379. t.ae = 667;
  40380. t.dotlessi = 278;
  40381. t.lslash = 278;
  40382. t.oslash = 500;
  40383. t.oe = 722;
  40384. t.germandbls = 500;
  40385. t.Idieresis = 333;
  40386. t.eacute = 444;
  40387. t.abreve = 444;
  40388. t.uhungarumlaut = 500;
  40389. t.ecaron = 444;
  40390. t.Ydieresis = 722;
  40391. t.divide = 564;
  40392. t.Yacute = 722;
  40393. t.Acircumflex = 722;
  40394. t.aacute = 444;
  40395. t.Ucircumflex = 722;
  40396. t.yacute = 500;
  40397. t.scommaaccent = 389;
  40398. t.ecircumflex = 444;
  40399. t.Uring = 722;
  40400. t.Udieresis = 722;
  40401. t.aogonek = 444;
  40402. t.Uacute = 722;
  40403. t.uogonek = 500;
  40404. t.Edieresis = 611;
  40405. t.Dcroat = 722;
  40406. t.commaaccent = 250;
  40407. t.copyright = 760;
  40408. t.Emacron = 611;
  40409. t.ccaron = 444;
  40410. t.aring = 444;
  40411. t.Ncommaaccent = 722;
  40412. t.lacute = 278;
  40413. t.agrave = 444;
  40414. t.Tcommaaccent = 611;
  40415. t.Cacute = 667;
  40416. t.atilde = 444;
  40417. t.Edotaccent = 611;
  40418. t.scaron = 389;
  40419. t.scedilla = 389;
  40420. t.iacute = 278;
  40421. t.lozenge = 471;
  40422. t.Rcaron = 667;
  40423. t.Gcommaaccent = 722;
  40424. t.ucircumflex = 500;
  40425. t.acircumflex = 444;
  40426. t.Amacron = 722;
  40427. t.rcaron = 333;
  40428. t.ccedilla = 444;
  40429. t.Zdotaccent = 611;
  40430. t.Thorn = 556;
  40431. t.Omacron = 722;
  40432. t.Racute = 667;
  40433. t.Sacute = 556;
  40434. t.dcaron = 588;
  40435. t.Umacron = 722;
  40436. t.uring = 500;
  40437. t.threesuperior = 300;
  40438. t.Ograve = 722;
  40439. t.Agrave = 722;
  40440. t.Abreve = 722;
  40441. t.multiply = 564;
  40442. t.uacute = 500;
  40443. t.Tcaron = 611;
  40444. t.partialdiff = 476;
  40445. t.ydieresis = 500;
  40446. t.Nacute = 722;
  40447. t.icircumflex = 278;
  40448. t.Ecircumflex = 611;
  40449. t.adieresis = 444;
  40450. t.edieresis = 444;
  40451. t.cacute = 444;
  40452. t.nacute = 500;
  40453. t.umacron = 500;
  40454. t.Ncaron = 722;
  40455. t.Iacute = 333;
  40456. t.plusminus = 564;
  40457. t.brokenbar = 200;
  40458. t.registered = 760;
  40459. t.Gbreve = 722;
  40460. t.Idotaccent = 333;
  40461. t.summation = 600;
  40462. t.Egrave = 611;
  40463. t.racute = 333;
  40464. t.omacron = 500;
  40465. t.Zacute = 611;
  40466. t.Zcaron = 611;
  40467. t.greaterequal = 549;
  40468. t.Eth = 722;
  40469. t.Ccedilla = 667;
  40470. t.lcommaaccent = 278;
  40471. t.tcaron = 326;
  40472. t.eogonek = 444;
  40473. t.Uogonek = 722;
  40474. t.Aacute = 722;
  40475. t.Adieresis = 722;
  40476. t.egrave = 444;
  40477. t.zacute = 444;
  40478. t.iogonek = 278;
  40479. t.Oacute = 722;
  40480. t.oacute = 500;
  40481. t.amacron = 444;
  40482. t.sacute = 389;
  40483. t.idieresis = 278;
  40484. t.Ocircumflex = 722;
  40485. t.Ugrave = 722;
  40486. t.Delta = 612;
  40487. t.thorn = 500;
  40488. t.twosuperior = 300;
  40489. t.Odieresis = 722;
  40490. t.mu = 500;
  40491. t.igrave = 278;
  40492. t.ohungarumlaut = 500;
  40493. t.Eogonek = 611;
  40494. t.dcroat = 500;
  40495. t.threequarters = 750;
  40496. t.Scedilla = 556;
  40497. t.lcaron = 344;
  40498. t.Kcommaaccent = 722;
  40499. t.Lacute = 611;
  40500. t.trademark = 980;
  40501. t.edotaccent = 444;
  40502. t.Igrave = 333;
  40503. t.Imacron = 333;
  40504. t.Lcaron = 611;
  40505. t.onehalf = 750;
  40506. t.lessequal = 549;
  40507. t.ocircumflex = 500;
  40508. t.ntilde = 500;
  40509. t.Uhungarumlaut = 722;
  40510. t.Eacute = 611;
  40511. t.emacron = 444;
  40512. t.gbreve = 500;
  40513. t.onequarter = 750;
  40514. t.Scaron = 556;
  40515. t.Scommaaccent = 556;
  40516. t.Ohungarumlaut = 722;
  40517. t.degree = 400;
  40518. t.ograve = 500;
  40519. t.Ccaron = 667;
  40520. t.ugrave = 500;
  40521. t.radical = 453;
  40522. t.Dcaron = 722;
  40523. t.rcommaaccent = 333;
  40524. t.Ntilde = 722;
  40525. t.otilde = 500;
  40526. t.Rcommaaccent = 667;
  40527. t.Lcommaaccent = 611;
  40528. t.Atilde = 722;
  40529. t.Aogonek = 722;
  40530. t.Aring = 722;
  40531. t.Otilde = 722;
  40532. t.zdotaccent = 444;
  40533. t.Ecaron = 611;
  40534. t.Iogonek = 333;
  40535. t.kcommaaccent = 500;
  40536. t.minus = 564;
  40537. t.Icircumflex = 333;
  40538. t.ncaron = 500;
  40539. t.tcommaaccent = 278;
  40540. t.logicalnot = 564;
  40541. t.odieresis = 500;
  40542. t.udieresis = 500;
  40543. t.notequal = 549;
  40544. t.gcommaaccent = 500;
  40545. t.eth = 500;
  40546. t.zcaron = 444;
  40547. t.ncommaaccent = 500;
  40548. t.onesuperior = 300;
  40549. t.imacron = 278;
  40550. t.Euro = 500;
  40551. });
  40552. t["Times-Bold"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  40553. t.space = 250;
  40554. t.exclam = 333;
  40555. t.quotedbl = 555;
  40556. t.numbersign = 500;
  40557. t.dollar = 500;
  40558. t.percent = 1000;
  40559. t.ampersand = 833;
  40560. t.quoteright = 333;
  40561. t.parenleft = 333;
  40562. t.parenright = 333;
  40563. t.asterisk = 500;
  40564. t.plus = 570;
  40565. t.comma = 250;
  40566. t.hyphen = 333;
  40567. t.period = 250;
  40568. t.slash = 278;
  40569. t.zero = 500;
  40570. t.one = 500;
  40571. t.two = 500;
  40572. t.three = 500;
  40573. t.four = 500;
  40574. t.five = 500;
  40575. t.six = 500;
  40576. t.seven = 500;
  40577. t.eight = 500;
  40578. t.nine = 500;
  40579. t.colon = 333;
  40580. t.semicolon = 333;
  40581. t.less = 570;
  40582. t.equal = 570;
  40583. t.greater = 570;
  40584. t.question = 500;
  40585. t.at = 930;
  40586. t.A = 722;
  40587. t.B = 667;
  40588. t.C = 722;
  40589. t.D = 722;
  40590. t.E = 667;
  40591. t.F = 611;
  40592. t.G = 778;
  40593. t.H = 778;
  40594. t.I = 389;
  40595. t.J = 500;
  40596. t.K = 778;
  40597. t.L = 667;
  40598. t.M = 944;
  40599. t.N = 722;
  40600. t.O = 778;
  40601. t.P = 611;
  40602. t.Q = 778;
  40603. t.R = 722;
  40604. t.S = 556;
  40605. t.T = 667;
  40606. t.U = 722;
  40607. t.V = 722;
  40608. t.W = 1000;
  40609. t.X = 722;
  40610. t.Y = 722;
  40611. t.Z = 667;
  40612. t.bracketleft = 333;
  40613. t.backslash = 278;
  40614. t.bracketright = 333;
  40615. t.asciicircum = 581;
  40616. t.underscore = 500;
  40617. t.quoteleft = 333;
  40618. t.a = 500;
  40619. t.b = 556;
  40620. t.c = 444;
  40621. t.d = 556;
  40622. t.e = 444;
  40623. t.f = 333;
  40624. t.g = 500;
  40625. t.h = 556;
  40626. t.i = 278;
  40627. t.j = 333;
  40628. t.k = 556;
  40629. t.l = 278;
  40630. t.m = 833;
  40631. t.n = 556;
  40632. t.o = 500;
  40633. t.p = 556;
  40634. t.q = 556;
  40635. t.r = 444;
  40636. t.s = 389;
  40637. t.t = 333;
  40638. t.u = 556;
  40639. t.v = 500;
  40640. t.w = 722;
  40641. t.x = 500;
  40642. t.y = 500;
  40643. t.z = 444;
  40644. t.braceleft = 394;
  40645. t.bar = 220;
  40646. t.braceright = 394;
  40647. t.asciitilde = 520;
  40648. t.exclamdown = 333;
  40649. t.cent = 500;
  40650. t.sterling = 500;
  40651. t.fraction = 167;
  40652. t.yen = 500;
  40653. t.florin = 500;
  40654. t.section = 500;
  40655. t.currency = 500;
  40656. t.quotesingle = 278;
  40657. t.quotedblleft = 500;
  40658. t.guillemotleft = 500;
  40659. t.guilsinglleft = 333;
  40660. t.guilsinglright = 333;
  40661. t.fi = 556;
  40662. t.fl = 556;
  40663. t.endash = 500;
  40664. t.dagger = 500;
  40665. t.daggerdbl = 500;
  40666. t.periodcentered = 250;
  40667. t.paragraph = 540;
  40668. t.bullet = 350;
  40669. t.quotesinglbase = 333;
  40670. t.quotedblbase = 500;
  40671. t.quotedblright = 500;
  40672. t.guillemotright = 500;
  40673. t.ellipsis = 1000;
  40674. t.perthousand = 1000;
  40675. t.questiondown = 500;
  40676. t.grave = 333;
  40677. t.acute = 333;
  40678. t.circumflex = 333;
  40679. t.tilde = 333;
  40680. t.macron = 333;
  40681. t.breve = 333;
  40682. t.dotaccent = 333;
  40683. t.dieresis = 333;
  40684. t.ring = 333;
  40685. t.cedilla = 333;
  40686. t.hungarumlaut = 333;
  40687. t.ogonek = 333;
  40688. t.caron = 333;
  40689. t.emdash = 1000;
  40690. t.AE = 1000;
  40691. t.ordfeminine = 300;
  40692. t.Lslash = 667;
  40693. t.Oslash = 778;
  40694. t.OE = 1000;
  40695. t.ordmasculine = 330;
  40696. t.ae = 722;
  40697. t.dotlessi = 278;
  40698. t.lslash = 278;
  40699. t.oslash = 500;
  40700. t.oe = 722;
  40701. t.germandbls = 556;
  40702. t.Idieresis = 389;
  40703. t.eacute = 444;
  40704. t.abreve = 500;
  40705. t.uhungarumlaut = 556;
  40706. t.ecaron = 444;
  40707. t.Ydieresis = 722;
  40708. t.divide = 570;
  40709. t.Yacute = 722;
  40710. t.Acircumflex = 722;
  40711. t.aacute = 500;
  40712. t.Ucircumflex = 722;
  40713. t.yacute = 500;
  40714. t.scommaaccent = 389;
  40715. t.ecircumflex = 444;
  40716. t.Uring = 722;
  40717. t.Udieresis = 722;
  40718. t.aogonek = 500;
  40719. t.Uacute = 722;
  40720. t.uogonek = 556;
  40721. t.Edieresis = 667;
  40722. t.Dcroat = 722;
  40723. t.commaaccent = 250;
  40724. t.copyright = 747;
  40725. t.Emacron = 667;
  40726. t.ccaron = 444;
  40727. t.aring = 500;
  40728. t.Ncommaaccent = 722;
  40729. t.lacute = 278;
  40730. t.agrave = 500;
  40731. t.Tcommaaccent = 667;
  40732. t.Cacute = 722;
  40733. t.atilde = 500;
  40734. t.Edotaccent = 667;
  40735. t.scaron = 389;
  40736. t.scedilla = 389;
  40737. t.iacute = 278;
  40738. t.lozenge = 494;
  40739. t.Rcaron = 722;
  40740. t.Gcommaaccent = 778;
  40741. t.ucircumflex = 556;
  40742. t.acircumflex = 500;
  40743. t.Amacron = 722;
  40744. t.rcaron = 444;
  40745. t.ccedilla = 444;
  40746. t.Zdotaccent = 667;
  40747. t.Thorn = 611;
  40748. t.Omacron = 778;
  40749. t.Racute = 722;
  40750. t.Sacute = 556;
  40751. t.dcaron = 672;
  40752. t.Umacron = 722;
  40753. t.uring = 556;
  40754. t.threesuperior = 300;
  40755. t.Ograve = 778;
  40756. t.Agrave = 722;
  40757. t.Abreve = 722;
  40758. t.multiply = 570;
  40759. t.uacute = 556;
  40760. t.Tcaron = 667;
  40761. t.partialdiff = 494;
  40762. t.ydieresis = 500;
  40763. t.Nacute = 722;
  40764. t.icircumflex = 278;
  40765. t.Ecircumflex = 667;
  40766. t.adieresis = 500;
  40767. t.edieresis = 444;
  40768. t.cacute = 444;
  40769. t.nacute = 556;
  40770. t.umacron = 556;
  40771. t.Ncaron = 722;
  40772. t.Iacute = 389;
  40773. t.plusminus = 570;
  40774. t.brokenbar = 220;
  40775. t.registered = 747;
  40776. t.Gbreve = 778;
  40777. t.Idotaccent = 389;
  40778. t.summation = 600;
  40779. t.Egrave = 667;
  40780. t.racute = 444;
  40781. t.omacron = 500;
  40782. t.Zacute = 667;
  40783. t.Zcaron = 667;
  40784. t.greaterequal = 549;
  40785. t.Eth = 722;
  40786. t.Ccedilla = 722;
  40787. t.lcommaaccent = 278;
  40788. t.tcaron = 416;
  40789. t.eogonek = 444;
  40790. t.Uogonek = 722;
  40791. t.Aacute = 722;
  40792. t.Adieresis = 722;
  40793. t.egrave = 444;
  40794. t.zacute = 444;
  40795. t.iogonek = 278;
  40796. t.Oacute = 778;
  40797. t.oacute = 500;
  40798. t.amacron = 500;
  40799. t.sacute = 389;
  40800. t.idieresis = 278;
  40801. t.Ocircumflex = 778;
  40802. t.Ugrave = 722;
  40803. t.Delta = 612;
  40804. t.thorn = 556;
  40805. t.twosuperior = 300;
  40806. t.Odieresis = 778;
  40807. t.mu = 556;
  40808. t.igrave = 278;
  40809. t.ohungarumlaut = 500;
  40810. t.Eogonek = 667;
  40811. t.dcroat = 556;
  40812. t.threequarters = 750;
  40813. t.Scedilla = 556;
  40814. t.lcaron = 394;
  40815. t.Kcommaaccent = 778;
  40816. t.Lacute = 667;
  40817. t.trademark = 1000;
  40818. t.edotaccent = 444;
  40819. t.Igrave = 389;
  40820. t.Imacron = 389;
  40821. t.Lcaron = 667;
  40822. t.onehalf = 750;
  40823. t.lessequal = 549;
  40824. t.ocircumflex = 500;
  40825. t.ntilde = 556;
  40826. t.Uhungarumlaut = 722;
  40827. t.Eacute = 667;
  40828. t.emacron = 444;
  40829. t.gbreve = 500;
  40830. t.onequarter = 750;
  40831. t.Scaron = 556;
  40832. t.Scommaaccent = 556;
  40833. t.Ohungarumlaut = 778;
  40834. t.degree = 400;
  40835. t.ograve = 500;
  40836. t.Ccaron = 722;
  40837. t.ugrave = 556;
  40838. t.radical = 549;
  40839. t.Dcaron = 722;
  40840. t.rcommaaccent = 444;
  40841. t.Ntilde = 722;
  40842. t.otilde = 500;
  40843. t.Rcommaaccent = 722;
  40844. t.Lcommaaccent = 667;
  40845. t.Atilde = 722;
  40846. t.Aogonek = 722;
  40847. t.Aring = 722;
  40848. t.Otilde = 778;
  40849. t.zdotaccent = 444;
  40850. t.Ecaron = 667;
  40851. t.Iogonek = 389;
  40852. t.kcommaaccent = 556;
  40853. t.minus = 570;
  40854. t.Icircumflex = 389;
  40855. t.ncaron = 556;
  40856. t.tcommaaccent = 333;
  40857. t.logicalnot = 570;
  40858. t.odieresis = 500;
  40859. t.udieresis = 556;
  40860. t.notequal = 549;
  40861. t.gcommaaccent = 500;
  40862. t.eth = 500;
  40863. t.zcaron = 444;
  40864. t.ncommaaccent = 556;
  40865. t.onesuperior = 300;
  40866. t.imacron = 278;
  40867. t.Euro = 500;
  40868. });
  40869. t["Times-BoldItalic"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  40870. t.space = 250;
  40871. t.exclam = 389;
  40872. t.quotedbl = 555;
  40873. t.numbersign = 500;
  40874. t.dollar = 500;
  40875. t.percent = 833;
  40876. t.ampersand = 778;
  40877. t.quoteright = 333;
  40878. t.parenleft = 333;
  40879. t.parenright = 333;
  40880. t.asterisk = 500;
  40881. t.plus = 570;
  40882. t.comma = 250;
  40883. t.hyphen = 333;
  40884. t.period = 250;
  40885. t.slash = 278;
  40886. t.zero = 500;
  40887. t.one = 500;
  40888. t.two = 500;
  40889. t.three = 500;
  40890. t.four = 500;
  40891. t.five = 500;
  40892. t.six = 500;
  40893. t.seven = 500;
  40894. t.eight = 500;
  40895. t.nine = 500;
  40896. t.colon = 333;
  40897. t.semicolon = 333;
  40898. t.less = 570;
  40899. t.equal = 570;
  40900. t.greater = 570;
  40901. t.question = 500;
  40902. t.at = 832;
  40903. t.A = 667;
  40904. t.B = 667;
  40905. t.C = 667;
  40906. t.D = 722;
  40907. t.E = 667;
  40908. t.F = 667;
  40909. t.G = 722;
  40910. t.H = 778;
  40911. t.I = 389;
  40912. t.J = 500;
  40913. t.K = 667;
  40914. t.L = 611;
  40915. t.M = 889;
  40916. t.N = 722;
  40917. t.O = 722;
  40918. t.P = 611;
  40919. t.Q = 722;
  40920. t.R = 667;
  40921. t.S = 556;
  40922. t.T = 611;
  40923. t.U = 722;
  40924. t.V = 667;
  40925. t.W = 889;
  40926. t.X = 667;
  40927. t.Y = 611;
  40928. t.Z = 611;
  40929. t.bracketleft = 333;
  40930. t.backslash = 278;
  40931. t.bracketright = 333;
  40932. t.asciicircum = 570;
  40933. t.underscore = 500;
  40934. t.quoteleft = 333;
  40935. t.a = 500;
  40936. t.b = 500;
  40937. t.c = 444;
  40938. t.d = 500;
  40939. t.e = 444;
  40940. t.f = 333;
  40941. t.g = 500;
  40942. t.h = 556;
  40943. t.i = 278;
  40944. t.j = 278;
  40945. t.k = 500;
  40946. t.l = 278;
  40947. t.m = 778;
  40948. t.n = 556;
  40949. t.o = 500;
  40950. t.p = 500;
  40951. t.q = 500;
  40952. t.r = 389;
  40953. t.s = 389;
  40954. t.t = 278;
  40955. t.u = 556;
  40956. t.v = 444;
  40957. t.w = 667;
  40958. t.x = 500;
  40959. t.y = 444;
  40960. t.z = 389;
  40961. t.braceleft = 348;
  40962. t.bar = 220;
  40963. t.braceright = 348;
  40964. t.asciitilde = 570;
  40965. t.exclamdown = 389;
  40966. t.cent = 500;
  40967. t.sterling = 500;
  40968. t.fraction = 167;
  40969. t.yen = 500;
  40970. t.florin = 500;
  40971. t.section = 500;
  40972. t.currency = 500;
  40973. t.quotesingle = 278;
  40974. t.quotedblleft = 500;
  40975. t.guillemotleft = 500;
  40976. t.guilsinglleft = 333;
  40977. t.guilsinglright = 333;
  40978. t.fi = 556;
  40979. t.fl = 556;
  40980. t.endash = 500;
  40981. t.dagger = 500;
  40982. t.daggerdbl = 500;
  40983. t.periodcentered = 250;
  40984. t.paragraph = 500;
  40985. t.bullet = 350;
  40986. t.quotesinglbase = 333;
  40987. t.quotedblbase = 500;
  40988. t.quotedblright = 500;
  40989. t.guillemotright = 500;
  40990. t.ellipsis = 1000;
  40991. t.perthousand = 1000;
  40992. t.questiondown = 500;
  40993. t.grave = 333;
  40994. t.acute = 333;
  40995. t.circumflex = 333;
  40996. t.tilde = 333;
  40997. t.macron = 333;
  40998. t.breve = 333;
  40999. t.dotaccent = 333;
  41000. t.dieresis = 333;
  41001. t.ring = 333;
  41002. t.cedilla = 333;
  41003. t.hungarumlaut = 333;
  41004. t.ogonek = 333;
  41005. t.caron = 333;
  41006. t.emdash = 1000;
  41007. t.AE = 944;
  41008. t.ordfeminine = 266;
  41009. t.Lslash = 611;
  41010. t.Oslash = 722;
  41011. t.OE = 944;
  41012. t.ordmasculine = 300;
  41013. t.ae = 722;
  41014. t.dotlessi = 278;
  41015. t.lslash = 278;
  41016. t.oslash = 500;
  41017. t.oe = 722;
  41018. t.germandbls = 500;
  41019. t.Idieresis = 389;
  41020. t.eacute = 444;
  41021. t.abreve = 500;
  41022. t.uhungarumlaut = 556;
  41023. t.ecaron = 444;
  41024. t.Ydieresis = 611;
  41025. t.divide = 570;
  41026. t.Yacute = 611;
  41027. t.Acircumflex = 667;
  41028. t.aacute = 500;
  41029. t.Ucircumflex = 722;
  41030. t.yacute = 444;
  41031. t.scommaaccent = 389;
  41032. t.ecircumflex = 444;
  41033. t.Uring = 722;
  41034. t.Udieresis = 722;
  41035. t.aogonek = 500;
  41036. t.Uacute = 722;
  41037. t.uogonek = 556;
  41038. t.Edieresis = 667;
  41039. t.Dcroat = 722;
  41040. t.commaaccent = 250;
  41041. t.copyright = 747;
  41042. t.Emacron = 667;
  41043. t.ccaron = 444;
  41044. t.aring = 500;
  41045. t.Ncommaaccent = 722;
  41046. t.lacute = 278;
  41047. t.agrave = 500;
  41048. t.Tcommaaccent = 611;
  41049. t.Cacute = 667;
  41050. t.atilde = 500;
  41051. t.Edotaccent = 667;
  41052. t.scaron = 389;
  41053. t.scedilla = 389;
  41054. t.iacute = 278;
  41055. t.lozenge = 494;
  41056. t.Rcaron = 667;
  41057. t.Gcommaaccent = 722;
  41058. t.ucircumflex = 556;
  41059. t.acircumflex = 500;
  41060. t.Amacron = 667;
  41061. t.rcaron = 389;
  41062. t.ccedilla = 444;
  41063. t.Zdotaccent = 611;
  41064. t.Thorn = 611;
  41065. t.Omacron = 722;
  41066. t.Racute = 667;
  41067. t.Sacute = 556;
  41068. t.dcaron = 608;
  41069. t.Umacron = 722;
  41070. t.uring = 556;
  41071. t.threesuperior = 300;
  41072. t.Ograve = 722;
  41073. t.Agrave = 667;
  41074. t.Abreve = 667;
  41075. t.multiply = 570;
  41076. t.uacute = 556;
  41077. t.Tcaron = 611;
  41078. t.partialdiff = 494;
  41079. t.ydieresis = 444;
  41080. t.Nacute = 722;
  41081. t.icircumflex = 278;
  41082. t.Ecircumflex = 667;
  41083. t.adieresis = 500;
  41084. t.edieresis = 444;
  41085. t.cacute = 444;
  41086. t.nacute = 556;
  41087. t.umacron = 556;
  41088. t.Ncaron = 722;
  41089. t.Iacute = 389;
  41090. t.plusminus = 570;
  41091. t.brokenbar = 220;
  41092. t.registered = 747;
  41093. t.Gbreve = 722;
  41094. t.Idotaccent = 389;
  41095. t.summation = 600;
  41096. t.Egrave = 667;
  41097. t.racute = 389;
  41098. t.omacron = 500;
  41099. t.Zacute = 611;
  41100. t.Zcaron = 611;
  41101. t.greaterequal = 549;
  41102. t.Eth = 722;
  41103. t.Ccedilla = 667;
  41104. t.lcommaaccent = 278;
  41105. t.tcaron = 366;
  41106. t.eogonek = 444;
  41107. t.Uogonek = 722;
  41108. t.Aacute = 667;
  41109. t.Adieresis = 667;
  41110. t.egrave = 444;
  41111. t.zacute = 389;
  41112. t.iogonek = 278;
  41113. t.Oacute = 722;
  41114. t.oacute = 500;
  41115. t.amacron = 500;
  41116. t.sacute = 389;
  41117. t.idieresis = 278;
  41118. t.Ocircumflex = 722;
  41119. t.Ugrave = 722;
  41120. t.Delta = 612;
  41121. t.thorn = 500;
  41122. t.twosuperior = 300;
  41123. t.Odieresis = 722;
  41124. t.mu = 576;
  41125. t.igrave = 278;
  41126. t.ohungarumlaut = 500;
  41127. t.Eogonek = 667;
  41128. t.dcroat = 500;
  41129. t.threequarters = 750;
  41130. t.Scedilla = 556;
  41131. t.lcaron = 382;
  41132. t.Kcommaaccent = 667;
  41133. t.Lacute = 611;
  41134. t.trademark = 1000;
  41135. t.edotaccent = 444;
  41136. t.Igrave = 389;
  41137. t.Imacron = 389;
  41138. t.Lcaron = 611;
  41139. t.onehalf = 750;
  41140. t.lessequal = 549;
  41141. t.ocircumflex = 500;
  41142. t.ntilde = 556;
  41143. t.Uhungarumlaut = 722;
  41144. t.Eacute = 667;
  41145. t.emacron = 444;
  41146. t.gbreve = 500;
  41147. t.onequarter = 750;
  41148. t.Scaron = 556;
  41149. t.Scommaaccent = 556;
  41150. t.Ohungarumlaut = 722;
  41151. t.degree = 400;
  41152. t.ograve = 500;
  41153. t.Ccaron = 667;
  41154. t.ugrave = 556;
  41155. t.radical = 549;
  41156. t.Dcaron = 722;
  41157. t.rcommaaccent = 389;
  41158. t.Ntilde = 722;
  41159. t.otilde = 500;
  41160. t.Rcommaaccent = 667;
  41161. t.Lcommaaccent = 611;
  41162. t.Atilde = 667;
  41163. t.Aogonek = 667;
  41164. t.Aring = 667;
  41165. t.Otilde = 722;
  41166. t.zdotaccent = 389;
  41167. t.Ecaron = 667;
  41168. t.Iogonek = 389;
  41169. t.kcommaaccent = 500;
  41170. t.minus = 606;
  41171. t.Icircumflex = 389;
  41172. t.ncaron = 556;
  41173. t.tcommaaccent = 278;
  41174. t.logicalnot = 606;
  41175. t.odieresis = 500;
  41176. t.udieresis = 556;
  41177. t.notequal = 549;
  41178. t.gcommaaccent = 500;
  41179. t.eth = 500;
  41180. t.zcaron = 389;
  41181. t.ncommaaccent = 556;
  41182. t.onesuperior = 300;
  41183. t.imacron = 278;
  41184. t.Euro = 500;
  41185. });
  41186. t["Times-Italic"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  41187. t.space = 250;
  41188. t.exclam = 333;
  41189. t.quotedbl = 420;
  41190. t.numbersign = 500;
  41191. t.dollar = 500;
  41192. t.percent = 833;
  41193. t.ampersand = 778;
  41194. t.quoteright = 333;
  41195. t.parenleft = 333;
  41196. t.parenright = 333;
  41197. t.asterisk = 500;
  41198. t.plus = 675;
  41199. t.comma = 250;
  41200. t.hyphen = 333;
  41201. t.period = 250;
  41202. t.slash = 278;
  41203. t.zero = 500;
  41204. t.one = 500;
  41205. t.two = 500;
  41206. t.three = 500;
  41207. t.four = 500;
  41208. t.five = 500;
  41209. t.six = 500;
  41210. t.seven = 500;
  41211. t.eight = 500;
  41212. t.nine = 500;
  41213. t.colon = 333;
  41214. t.semicolon = 333;
  41215. t.less = 675;
  41216. t.equal = 675;
  41217. t.greater = 675;
  41218. t.question = 500;
  41219. t.at = 920;
  41220. t.A = 611;
  41221. t.B = 611;
  41222. t.C = 667;
  41223. t.D = 722;
  41224. t.E = 611;
  41225. t.F = 611;
  41226. t.G = 722;
  41227. t.H = 722;
  41228. t.I = 333;
  41229. t.J = 444;
  41230. t.K = 667;
  41231. t.L = 556;
  41232. t.M = 833;
  41233. t.N = 667;
  41234. t.O = 722;
  41235. t.P = 611;
  41236. t.Q = 722;
  41237. t.R = 611;
  41238. t.S = 500;
  41239. t.T = 556;
  41240. t.U = 722;
  41241. t.V = 611;
  41242. t.W = 833;
  41243. t.X = 611;
  41244. t.Y = 556;
  41245. t.Z = 556;
  41246. t.bracketleft = 389;
  41247. t.backslash = 278;
  41248. t.bracketright = 389;
  41249. t.asciicircum = 422;
  41250. t.underscore = 500;
  41251. t.quoteleft = 333;
  41252. t.a = 500;
  41253. t.b = 500;
  41254. t.c = 444;
  41255. t.d = 500;
  41256. t.e = 444;
  41257. t.f = 278;
  41258. t.g = 500;
  41259. t.h = 500;
  41260. t.i = 278;
  41261. t.j = 278;
  41262. t.k = 444;
  41263. t.l = 278;
  41264. t.m = 722;
  41265. t.n = 500;
  41266. t.o = 500;
  41267. t.p = 500;
  41268. t.q = 500;
  41269. t.r = 389;
  41270. t.s = 389;
  41271. t.t = 278;
  41272. t.u = 500;
  41273. t.v = 444;
  41274. t.w = 667;
  41275. t.x = 444;
  41276. t.y = 444;
  41277. t.z = 389;
  41278. t.braceleft = 400;
  41279. t.bar = 275;
  41280. t.braceright = 400;
  41281. t.asciitilde = 541;
  41282. t.exclamdown = 389;
  41283. t.cent = 500;
  41284. t.sterling = 500;
  41285. t.fraction = 167;
  41286. t.yen = 500;
  41287. t.florin = 500;
  41288. t.section = 500;
  41289. t.currency = 500;
  41290. t.quotesingle = 214;
  41291. t.quotedblleft = 556;
  41292. t.guillemotleft = 500;
  41293. t.guilsinglleft = 333;
  41294. t.guilsinglright = 333;
  41295. t.fi = 500;
  41296. t.fl = 500;
  41297. t.endash = 500;
  41298. t.dagger = 500;
  41299. t.daggerdbl = 500;
  41300. t.periodcentered = 250;
  41301. t.paragraph = 523;
  41302. t.bullet = 350;
  41303. t.quotesinglbase = 333;
  41304. t.quotedblbase = 556;
  41305. t.quotedblright = 556;
  41306. t.guillemotright = 500;
  41307. t.ellipsis = 889;
  41308. t.perthousand = 1000;
  41309. t.questiondown = 500;
  41310. t.grave = 333;
  41311. t.acute = 333;
  41312. t.circumflex = 333;
  41313. t.tilde = 333;
  41314. t.macron = 333;
  41315. t.breve = 333;
  41316. t.dotaccent = 333;
  41317. t.dieresis = 333;
  41318. t.ring = 333;
  41319. t.cedilla = 333;
  41320. t.hungarumlaut = 333;
  41321. t.ogonek = 333;
  41322. t.caron = 333;
  41323. t.emdash = 889;
  41324. t.AE = 889;
  41325. t.ordfeminine = 276;
  41326. t.Lslash = 556;
  41327. t.Oslash = 722;
  41328. t.OE = 944;
  41329. t.ordmasculine = 310;
  41330. t.ae = 667;
  41331. t.dotlessi = 278;
  41332. t.lslash = 278;
  41333. t.oslash = 500;
  41334. t.oe = 667;
  41335. t.germandbls = 500;
  41336. t.Idieresis = 333;
  41337. t.eacute = 444;
  41338. t.abreve = 500;
  41339. t.uhungarumlaut = 500;
  41340. t.ecaron = 444;
  41341. t.Ydieresis = 556;
  41342. t.divide = 675;
  41343. t.Yacute = 556;
  41344. t.Acircumflex = 611;
  41345. t.aacute = 500;
  41346. t.Ucircumflex = 722;
  41347. t.yacute = 444;
  41348. t.scommaaccent = 389;
  41349. t.ecircumflex = 444;
  41350. t.Uring = 722;
  41351. t.Udieresis = 722;
  41352. t.aogonek = 500;
  41353. t.Uacute = 722;
  41354. t.uogonek = 500;
  41355. t.Edieresis = 611;
  41356. t.Dcroat = 722;
  41357. t.commaaccent = 250;
  41358. t.copyright = 760;
  41359. t.Emacron = 611;
  41360. t.ccaron = 444;
  41361. t.aring = 500;
  41362. t.Ncommaaccent = 667;
  41363. t.lacute = 278;
  41364. t.agrave = 500;
  41365. t.Tcommaaccent = 556;
  41366. t.Cacute = 667;
  41367. t.atilde = 500;
  41368. t.Edotaccent = 611;
  41369. t.scaron = 389;
  41370. t.scedilla = 389;
  41371. t.iacute = 278;
  41372. t.lozenge = 471;
  41373. t.Rcaron = 611;
  41374. t.Gcommaaccent = 722;
  41375. t.ucircumflex = 500;
  41376. t.acircumflex = 500;
  41377. t.Amacron = 611;
  41378. t.rcaron = 389;
  41379. t.ccedilla = 444;
  41380. t.Zdotaccent = 556;
  41381. t.Thorn = 611;
  41382. t.Omacron = 722;
  41383. t.Racute = 611;
  41384. t.Sacute = 500;
  41385. t.dcaron = 544;
  41386. t.Umacron = 722;
  41387. t.uring = 500;
  41388. t.threesuperior = 300;
  41389. t.Ograve = 722;
  41390. t.Agrave = 611;
  41391. t.Abreve = 611;
  41392. t.multiply = 675;
  41393. t.uacute = 500;
  41394. t.Tcaron = 556;
  41395. t.partialdiff = 476;
  41396. t.ydieresis = 444;
  41397. t.Nacute = 667;
  41398. t.icircumflex = 278;
  41399. t.Ecircumflex = 611;
  41400. t.adieresis = 500;
  41401. t.edieresis = 444;
  41402. t.cacute = 444;
  41403. t.nacute = 500;
  41404. t.umacron = 500;
  41405. t.Ncaron = 667;
  41406. t.Iacute = 333;
  41407. t.plusminus = 675;
  41408. t.brokenbar = 275;
  41409. t.registered = 760;
  41410. t.Gbreve = 722;
  41411. t.Idotaccent = 333;
  41412. t.summation = 600;
  41413. t.Egrave = 611;
  41414. t.racute = 389;
  41415. t.omacron = 500;
  41416. t.Zacute = 556;
  41417. t.Zcaron = 556;
  41418. t.greaterequal = 549;
  41419. t.Eth = 722;
  41420. t.Ccedilla = 667;
  41421. t.lcommaaccent = 278;
  41422. t.tcaron = 300;
  41423. t.eogonek = 444;
  41424. t.Uogonek = 722;
  41425. t.Aacute = 611;
  41426. t.Adieresis = 611;
  41427. t.egrave = 444;
  41428. t.zacute = 389;
  41429. t.iogonek = 278;
  41430. t.Oacute = 722;
  41431. t.oacute = 500;
  41432. t.amacron = 500;
  41433. t.sacute = 389;
  41434. t.idieresis = 278;
  41435. t.Ocircumflex = 722;
  41436. t.Ugrave = 722;
  41437. t.Delta = 612;
  41438. t.thorn = 500;
  41439. t.twosuperior = 300;
  41440. t.Odieresis = 722;
  41441. t.mu = 500;
  41442. t.igrave = 278;
  41443. t.ohungarumlaut = 500;
  41444. t.Eogonek = 611;
  41445. t.dcroat = 500;
  41446. t.threequarters = 750;
  41447. t.Scedilla = 500;
  41448. t.lcaron = 300;
  41449. t.Kcommaaccent = 667;
  41450. t.Lacute = 556;
  41451. t.trademark = 980;
  41452. t.edotaccent = 444;
  41453. t.Igrave = 333;
  41454. t.Imacron = 333;
  41455. t.Lcaron = 611;
  41456. t.onehalf = 750;
  41457. t.lessequal = 549;
  41458. t.ocircumflex = 500;
  41459. t.ntilde = 500;
  41460. t.Uhungarumlaut = 722;
  41461. t.Eacute = 611;
  41462. t.emacron = 444;
  41463. t.gbreve = 500;
  41464. t.onequarter = 750;
  41465. t.Scaron = 500;
  41466. t.Scommaaccent = 500;
  41467. t.Ohungarumlaut = 722;
  41468. t.degree = 400;
  41469. t.ograve = 500;
  41470. t.Ccaron = 667;
  41471. t.ugrave = 500;
  41472. t.radical = 453;
  41473. t.Dcaron = 722;
  41474. t.rcommaaccent = 389;
  41475. t.Ntilde = 667;
  41476. t.otilde = 500;
  41477. t.Rcommaaccent = 611;
  41478. t.Lcommaaccent = 556;
  41479. t.Atilde = 611;
  41480. t.Aogonek = 611;
  41481. t.Aring = 611;
  41482. t.Otilde = 722;
  41483. t.zdotaccent = 389;
  41484. t.Ecaron = 611;
  41485. t.Iogonek = 333;
  41486. t.kcommaaccent = 444;
  41487. t.minus = 675;
  41488. t.Icircumflex = 333;
  41489. t.ncaron = 500;
  41490. t.tcommaaccent = 278;
  41491. t.logicalnot = 675;
  41492. t.odieresis = 500;
  41493. t.udieresis = 500;
  41494. t.notequal = 549;
  41495. t.gcommaaccent = 500;
  41496. t.eth = 500;
  41497. t.zcaron = 389;
  41498. t.ncommaaccent = 500;
  41499. t.onesuperior = 300;
  41500. t.imacron = 278;
  41501. t.Euro = 500;
  41502. });
  41503. t.ZapfDingbats = (0, _core_utils.getLookupTableFactory)(function (t) {
  41504. t.space = 278;
  41505. t.a1 = 974;
  41506. t.a2 = 961;
  41507. t.a202 = 974;
  41508. t.a3 = 980;
  41509. t.a4 = 719;
  41510. t.a5 = 789;
  41511. t.a119 = 790;
  41512. t.a118 = 791;
  41513. t.a117 = 690;
  41514. t.a11 = 960;
  41515. t.a12 = 939;
  41516. t.a13 = 549;
  41517. t.a14 = 855;
  41518. t.a15 = 911;
  41519. t.a16 = 933;
  41520. t.a105 = 911;
  41521. t.a17 = 945;
  41522. t.a18 = 974;
  41523. t.a19 = 755;
  41524. t.a20 = 846;
  41525. t.a21 = 762;
  41526. t.a22 = 761;
  41527. t.a23 = 571;
  41528. t.a24 = 677;
  41529. t.a25 = 763;
  41530. t.a26 = 760;
  41531. t.a27 = 759;
  41532. t.a28 = 754;
  41533. t.a6 = 494;
  41534. t.a7 = 552;
  41535. t.a8 = 537;
  41536. t.a9 = 577;
  41537. t.a10 = 692;
  41538. t.a29 = 786;
  41539. t.a30 = 788;
  41540. t.a31 = 788;
  41541. t.a32 = 790;
  41542. t.a33 = 793;
  41543. t.a34 = 794;
  41544. t.a35 = 816;
  41545. t.a36 = 823;
  41546. t.a37 = 789;
  41547. t.a38 = 841;
  41548. t.a39 = 823;
  41549. t.a40 = 833;
  41550. t.a41 = 816;
  41551. t.a42 = 831;
  41552. t.a43 = 923;
  41553. t.a44 = 744;
  41554. t.a45 = 723;
  41555. t.a46 = 749;
  41556. t.a47 = 790;
  41557. t.a48 = 792;
  41558. t.a49 = 695;
  41559. t.a50 = 776;
  41560. t.a51 = 768;
  41561. t.a52 = 792;
  41562. t.a53 = 759;
  41563. t.a54 = 707;
  41564. t.a55 = 708;
  41565. t.a56 = 682;
  41566. t.a57 = 701;
  41567. t.a58 = 826;
  41568. t.a59 = 815;
  41569. t.a60 = 789;
  41570. t.a61 = 789;
  41571. t.a62 = 707;
  41572. t.a63 = 687;
  41573. t.a64 = 696;
  41574. t.a65 = 689;
  41575. t.a66 = 786;
  41576. t.a67 = 787;
  41577. t.a68 = 713;
  41578. t.a69 = 791;
  41579. t.a70 = 785;
  41580. t.a71 = 791;
  41581. t.a72 = 873;
  41582. t.a73 = 761;
  41583. t.a74 = 762;
  41584. t.a203 = 762;
  41585. t.a75 = 759;
  41586. t.a204 = 759;
  41587. t.a76 = 892;
  41588. t.a77 = 892;
  41589. t.a78 = 788;
  41590. t.a79 = 784;
  41591. t.a81 = 438;
  41592. t.a82 = 138;
  41593. t.a83 = 277;
  41594. t.a84 = 415;
  41595. t.a97 = 392;
  41596. t.a98 = 392;
  41597. t.a99 = 668;
  41598. t.a100 = 668;
  41599. t.a89 = 390;
  41600. t.a90 = 390;
  41601. t.a93 = 317;
  41602. t.a94 = 317;
  41603. t.a91 = 276;
  41604. t.a92 = 276;
  41605. t.a205 = 509;
  41606. t.a85 = 509;
  41607. t.a206 = 410;
  41608. t.a86 = 410;
  41609. t.a87 = 234;
  41610. t.a88 = 234;
  41611. t.a95 = 334;
  41612. t.a96 = 334;
  41613. t.a101 = 732;
  41614. t.a102 = 544;
  41615. t.a103 = 544;
  41616. t.a104 = 910;
  41617. t.a106 = 667;
  41618. t.a107 = 760;
  41619. t.a108 = 760;
  41620. t.a112 = 776;
  41621. t.a111 = 595;
  41622. t.a110 = 694;
  41623. t.a109 = 626;
  41624. t.a120 = 788;
  41625. t.a121 = 788;
  41626. t.a122 = 788;
  41627. t.a123 = 788;
  41628. t.a124 = 788;
  41629. t.a125 = 788;
  41630. t.a126 = 788;
  41631. t.a127 = 788;
  41632. t.a128 = 788;
  41633. t.a129 = 788;
  41634. t.a130 = 788;
  41635. t.a131 = 788;
  41636. t.a132 = 788;
  41637. t.a133 = 788;
  41638. t.a134 = 788;
  41639. t.a135 = 788;
  41640. t.a136 = 788;
  41641. t.a137 = 788;
  41642. t.a138 = 788;
  41643. t.a139 = 788;
  41644. t.a140 = 788;
  41645. t.a141 = 788;
  41646. t.a142 = 788;
  41647. t.a143 = 788;
  41648. t.a144 = 788;
  41649. t.a145 = 788;
  41650. t.a146 = 788;
  41651. t.a147 = 788;
  41652. t.a148 = 788;
  41653. t.a149 = 788;
  41654. t.a150 = 788;
  41655. t.a151 = 788;
  41656. t.a152 = 788;
  41657. t.a153 = 788;
  41658. t.a154 = 788;
  41659. t.a155 = 788;
  41660. t.a156 = 788;
  41661. t.a157 = 788;
  41662. t.a158 = 788;
  41663. t.a159 = 788;
  41664. t.a160 = 894;
  41665. t.a161 = 838;
  41666. t.a163 = 1016;
  41667. t.a164 = 458;
  41668. t.a196 = 748;
  41669. t.a165 = 924;
  41670. t.a192 = 748;
  41671. t.a166 = 918;
  41672. t.a167 = 927;
  41673. t.a168 = 928;
  41674. t.a169 = 928;
  41675. t.a170 = 834;
  41676. t.a171 = 873;
  41677. t.a172 = 828;
  41678. t.a173 = 924;
  41679. t.a162 = 924;
  41680. t.a174 = 917;
  41681. t.a175 = 930;
  41682. t.a176 = 931;
  41683. t.a177 = 463;
  41684. t.a178 = 883;
  41685. t.a179 = 836;
  41686. t.a193 = 836;
  41687. t.a180 = 867;
  41688. t.a199 = 867;
  41689. t.a181 = 696;
  41690. t.a200 = 696;
  41691. t.a182 = 874;
  41692. t.a201 = 874;
  41693. t.a183 = 760;
  41694. t.a184 = 946;
  41695. t.a197 = 771;
  41696. t.a185 = 865;
  41697. t.a194 = 771;
  41698. t.a198 = 888;
  41699. t.a186 = 967;
  41700. t.a195 = 888;
  41701. t.a187 = 831;
  41702. t.a188 = 873;
  41703. t.a189 = 927;
  41704. t.a190 = 970;
  41705. t.a191 = 918;
  41706. });
  41707. });
  41708. exports.getMetrics = getMetrics;
  41709. const getFontBasicMetrics = (0, _core_utils.getLookupTableFactory)(function (t) {
  41710. t.Courier = {
  41711. ascent: 629,
  41712. descent: -157,
  41713. capHeight: 562,
  41714. xHeight: -426
  41715. };
  41716. t["Courier-Bold"] = {
  41717. ascent: 629,
  41718. descent: -157,
  41719. capHeight: 562,
  41720. xHeight: 439
  41721. };
  41722. t["Courier-Oblique"] = {
  41723. ascent: 629,
  41724. descent: -157,
  41725. capHeight: 562,
  41726. xHeight: 426
  41727. };
  41728. t["Courier-BoldOblique"] = {
  41729. ascent: 629,
  41730. descent: -157,
  41731. capHeight: 562,
  41732. xHeight: 426
  41733. };
  41734. t.Helvetica = {
  41735. ascent: 718,
  41736. descent: -207,
  41737. capHeight: 718,
  41738. xHeight: 523
  41739. };
  41740. t["Helvetica-Bold"] = {
  41741. ascent: 718,
  41742. descent: -207,
  41743. capHeight: 718,
  41744. xHeight: 532
  41745. };
  41746. t["Helvetica-Oblique"] = {
  41747. ascent: 718,
  41748. descent: -207,
  41749. capHeight: 718,
  41750. xHeight: 523
  41751. };
  41752. t["Helvetica-BoldOblique"] = {
  41753. ascent: 718,
  41754. descent: -207,
  41755. capHeight: 718,
  41756. xHeight: 532
  41757. };
  41758. t["Times-Roman"] = {
  41759. ascent: 683,
  41760. descent: -217,
  41761. capHeight: 662,
  41762. xHeight: 450
  41763. };
  41764. t["Times-Bold"] = {
  41765. ascent: 683,
  41766. descent: -217,
  41767. capHeight: 676,
  41768. xHeight: 461
  41769. };
  41770. t["Times-Italic"] = {
  41771. ascent: 683,
  41772. descent: -217,
  41773. capHeight: 653,
  41774. xHeight: 441
  41775. };
  41776. t["Times-BoldItalic"] = {
  41777. ascent: 683,
  41778. descent: -217,
  41779. capHeight: 669,
  41780. xHeight: 462
  41781. };
  41782. t.Symbol = {
  41783. ascent: Math.NaN,
  41784. descent: Math.NaN,
  41785. capHeight: Math.NaN,
  41786. xHeight: Math.NaN
  41787. };
  41788. t.ZapfDingbats = {
  41789. ascent: Math.NaN,
  41790. descent: Math.NaN,
  41791. capHeight: Math.NaN,
  41792. xHeight: Math.NaN
  41793. };
  41794. });
  41795. exports.getFontBasicMetrics = getFontBasicMetrics;
  41796. /***/ }),
  41797. /* 52 */
  41798. /***/ ((__unused_webpack_module, exports) => {
  41799. Object.defineProperty(exports, "__esModule", ({
  41800. value: true
  41801. }));
  41802. exports.GlyfTable = void 0;
  41803. const ON_CURVE_POINT = 1 << 0;
  41804. const X_SHORT_VECTOR = 1 << 1;
  41805. const Y_SHORT_VECTOR = 1 << 2;
  41806. const REPEAT_FLAG = 1 << 3;
  41807. const X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR = 1 << 4;
  41808. const Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR = 1 << 5;
  41809. const OVERLAP_SIMPLE = 1 << 6;
  41810. const ARG_1_AND_2_ARE_WORDS = 1 << 0;
  41811. const ARGS_ARE_XY_VALUES = 1 << 1;
  41812. const WE_HAVE_A_SCALE = 1 << 3;
  41813. const MORE_COMPONENTS = 1 << 5;
  41814. const WE_HAVE_AN_X_AND_Y_SCALE = 1 << 6;
  41815. const WE_HAVE_A_TWO_BY_TWO = 1 << 7;
  41816. const WE_HAVE_INSTRUCTIONS = 1 << 8;
  41817. class GlyfTable {
  41818. constructor({
  41819. glyfTable,
  41820. isGlyphLocationsLong,
  41821. locaTable,
  41822. numGlyphs
  41823. }) {
  41824. this.glyphs = [];
  41825. const loca = new DataView(locaTable.buffer, locaTable.byteOffset, locaTable.byteLength);
  41826. const glyf = new DataView(glyfTable.buffer, glyfTable.byteOffset, glyfTable.byteLength);
  41827. const offsetSize = isGlyphLocationsLong ? 4 : 2;
  41828. let prev = isGlyphLocationsLong ? loca.getUint32(0) : 2 * loca.getUint16(0);
  41829. let pos = 0;
  41830. for (let i = 0; i < numGlyphs; i++) {
  41831. pos += offsetSize;
  41832. const next = isGlyphLocationsLong ? loca.getUint32(pos) : 2 * loca.getUint16(pos);
  41833. if (next === prev) {
  41834. this.glyphs.push(new Glyph({}));
  41835. continue;
  41836. }
  41837. const glyph = Glyph.parse(prev, glyf);
  41838. this.glyphs.push(glyph);
  41839. prev = next;
  41840. }
  41841. }
  41842. getSize() {
  41843. return this.glyphs.reduce((a, g) => {
  41844. const size = g.getSize();
  41845. return a + (size + 3 & ~3);
  41846. }, 0);
  41847. }
  41848. write() {
  41849. const totalSize = this.getSize();
  41850. const glyfTable = new DataView(new ArrayBuffer(totalSize));
  41851. const isLocationLong = totalSize > 0x1fffe;
  41852. const offsetSize = isLocationLong ? 4 : 2;
  41853. const locaTable = new DataView(new ArrayBuffer((this.glyphs.length + 1) * offsetSize));
  41854. if (isLocationLong) {
  41855. locaTable.setUint32(0, 0);
  41856. } else {
  41857. locaTable.setUint16(0, 0);
  41858. }
  41859. let pos = 0;
  41860. let locaIndex = 0;
  41861. for (const glyph of this.glyphs) {
  41862. pos += glyph.write(pos, glyfTable);
  41863. pos = pos + 3 & ~3;
  41864. locaIndex += offsetSize;
  41865. if (isLocationLong) {
  41866. locaTable.setUint32(locaIndex, pos);
  41867. } else {
  41868. locaTable.setUint16(locaIndex, pos >> 1);
  41869. }
  41870. }
  41871. return {
  41872. isLocationLong,
  41873. loca: new Uint8Array(locaTable.buffer),
  41874. glyf: new Uint8Array(glyfTable.buffer)
  41875. };
  41876. }
  41877. scale(factors) {
  41878. for (let i = 0, ii = this.glyphs.length; i < ii; i++) {
  41879. this.glyphs[i].scale(factors[i]);
  41880. }
  41881. }
  41882. }
  41883. exports.GlyfTable = GlyfTable;
  41884. class Glyph {
  41885. constructor({
  41886. header = null,
  41887. simple = null,
  41888. composites = null
  41889. }) {
  41890. this.header = header;
  41891. this.simple = simple;
  41892. this.composites = composites;
  41893. }
  41894. static parse(pos, glyf) {
  41895. const [read, header] = GlyphHeader.parse(pos, glyf);
  41896. pos += read;
  41897. if (header.numberOfContours < 0) {
  41898. const composites = [];
  41899. while (true) {
  41900. const [n, composite] = CompositeGlyph.parse(pos, glyf);
  41901. pos += n;
  41902. composites.push(composite);
  41903. if (!(composite.flags & MORE_COMPONENTS)) {
  41904. break;
  41905. }
  41906. }
  41907. return new Glyph({
  41908. header,
  41909. composites
  41910. });
  41911. }
  41912. const simple = SimpleGlyph.parse(pos, glyf, header.numberOfContours);
  41913. return new Glyph({
  41914. header,
  41915. simple
  41916. });
  41917. }
  41918. getSize() {
  41919. if (!this.header) {
  41920. return 0;
  41921. }
  41922. const size = this.simple ? this.simple.getSize() : this.composites.reduce((a, c) => a + c.getSize(), 0);
  41923. return this.header.getSize() + size;
  41924. }
  41925. write(pos, buf) {
  41926. if (!this.header) {
  41927. return 0;
  41928. }
  41929. const spos = pos;
  41930. pos += this.header.write(pos, buf);
  41931. if (this.simple) {
  41932. pos += this.simple.write(pos, buf);
  41933. } else {
  41934. for (const composite of this.composites) {
  41935. pos += composite.write(pos, buf);
  41936. }
  41937. }
  41938. return pos - spos;
  41939. }
  41940. scale(factor) {
  41941. if (!this.header) {
  41942. return;
  41943. }
  41944. const xMiddle = (this.header.xMin + this.header.xMax) / 2;
  41945. this.header.scale(xMiddle, factor);
  41946. if (this.simple) {
  41947. this.simple.scale(xMiddle, factor);
  41948. } else {
  41949. for (const composite of this.composites) {
  41950. composite.scale(xMiddle, factor);
  41951. }
  41952. }
  41953. }
  41954. }
  41955. class GlyphHeader {
  41956. constructor({
  41957. numberOfContours,
  41958. xMin,
  41959. yMin,
  41960. xMax,
  41961. yMax
  41962. }) {
  41963. this.numberOfContours = numberOfContours;
  41964. this.xMin = xMin;
  41965. this.yMin = yMin;
  41966. this.xMax = xMax;
  41967. this.yMax = yMax;
  41968. }
  41969. static parse(pos, glyf) {
  41970. return [10, new GlyphHeader({
  41971. numberOfContours: glyf.getInt16(pos),
  41972. xMin: glyf.getInt16(pos + 2),
  41973. yMin: glyf.getInt16(pos + 4),
  41974. xMax: glyf.getInt16(pos + 6),
  41975. yMax: glyf.getInt16(pos + 8)
  41976. })];
  41977. }
  41978. getSize() {
  41979. return 10;
  41980. }
  41981. write(pos, buf) {
  41982. buf.setInt16(pos, this.numberOfContours);
  41983. buf.setInt16(pos + 2, this.xMin);
  41984. buf.setInt16(pos + 4, this.yMin);
  41985. buf.setInt16(pos + 6, this.xMax);
  41986. buf.setInt16(pos + 8, this.yMax);
  41987. return 10;
  41988. }
  41989. scale(x, factor) {
  41990. this.xMin = Math.round(x + (this.xMin - x) * factor);
  41991. this.xMax = Math.round(x + (this.xMax - x) * factor);
  41992. }
  41993. }
  41994. class Contour {
  41995. constructor({
  41996. flags,
  41997. xCoordinates,
  41998. yCoordinates
  41999. }) {
  42000. this.xCoordinates = xCoordinates;
  42001. this.yCoordinates = yCoordinates;
  42002. this.flags = flags;
  42003. }
  42004. }
  42005. class SimpleGlyph {
  42006. constructor({
  42007. contours,
  42008. instructions
  42009. }) {
  42010. this.contours = contours;
  42011. this.instructions = instructions;
  42012. }
  42013. static parse(pos, glyf, numberOfContours) {
  42014. const endPtsOfContours = [];
  42015. for (let i = 0; i < numberOfContours; i++) {
  42016. const endPt = glyf.getUint16(pos);
  42017. pos += 2;
  42018. endPtsOfContours.push(endPt);
  42019. }
  42020. const numberOfPt = endPtsOfContours[numberOfContours - 1] + 1;
  42021. const instructionLength = glyf.getUint16(pos);
  42022. pos += 2;
  42023. const instructions = new Uint8Array(glyf).slice(pos, pos + instructionLength);
  42024. pos += instructionLength;
  42025. const flags = [];
  42026. for (let i = 0; i < numberOfPt; pos++, i++) {
  42027. let flag = glyf.getUint8(pos);
  42028. flags.push(flag);
  42029. if (flag & REPEAT_FLAG) {
  42030. const count = glyf.getUint8(++pos);
  42031. flag ^= REPEAT_FLAG;
  42032. for (let m = 0; m < count; m++) {
  42033. flags.push(flag);
  42034. }
  42035. i += count;
  42036. }
  42037. }
  42038. const allXCoordinates = [];
  42039. let xCoordinates = [];
  42040. let yCoordinates = [];
  42041. let pointFlags = [];
  42042. const contours = [];
  42043. let endPtsOfContoursIndex = 0;
  42044. let lastCoordinate = 0;
  42045. for (let i = 0; i < numberOfPt; i++) {
  42046. const flag = flags[i];
  42047. if (flag & X_SHORT_VECTOR) {
  42048. const x = glyf.getUint8(pos++);
  42049. lastCoordinate += flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR ? x : -x;
  42050. xCoordinates.push(lastCoordinate);
  42051. } else if (flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR) {
  42052. xCoordinates.push(lastCoordinate);
  42053. } else {
  42054. lastCoordinate += glyf.getInt16(pos);
  42055. pos += 2;
  42056. xCoordinates.push(lastCoordinate);
  42057. }
  42058. if (endPtsOfContours[endPtsOfContoursIndex] === i) {
  42059. endPtsOfContoursIndex++;
  42060. allXCoordinates.push(xCoordinates);
  42061. xCoordinates = [];
  42062. }
  42063. }
  42064. lastCoordinate = 0;
  42065. endPtsOfContoursIndex = 0;
  42066. for (let i = 0; i < numberOfPt; i++) {
  42067. const flag = flags[i];
  42068. if (flag & Y_SHORT_VECTOR) {
  42069. const y = glyf.getUint8(pos++);
  42070. lastCoordinate += flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR ? y : -y;
  42071. yCoordinates.push(lastCoordinate);
  42072. } else if (flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR) {
  42073. yCoordinates.push(lastCoordinate);
  42074. } else {
  42075. lastCoordinate += glyf.getInt16(pos);
  42076. pos += 2;
  42077. yCoordinates.push(lastCoordinate);
  42078. }
  42079. pointFlags.push(flag & ON_CURVE_POINT | flag & OVERLAP_SIMPLE);
  42080. if (endPtsOfContours[endPtsOfContoursIndex] === i) {
  42081. xCoordinates = allXCoordinates[endPtsOfContoursIndex];
  42082. endPtsOfContoursIndex++;
  42083. contours.push(new Contour({
  42084. flags: pointFlags,
  42085. xCoordinates,
  42086. yCoordinates
  42087. }));
  42088. yCoordinates = [];
  42089. pointFlags = [];
  42090. }
  42091. }
  42092. return new SimpleGlyph({
  42093. contours,
  42094. instructions
  42095. });
  42096. }
  42097. getSize() {
  42098. let size = this.contours.length * 2 + 2 + this.instructions.length;
  42099. let lastX = 0;
  42100. let lastY = 0;
  42101. for (const contour of this.contours) {
  42102. size += contour.flags.length;
  42103. for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) {
  42104. const x = contour.xCoordinates[i];
  42105. const y = contour.yCoordinates[i];
  42106. let abs = Math.abs(x - lastX);
  42107. if (abs > 255) {
  42108. size += 2;
  42109. } else if (abs > 0) {
  42110. size += 1;
  42111. }
  42112. lastX = x;
  42113. abs = Math.abs(y - lastY);
  42114. if (abs > 255) {
  42115. size += 2;
  42116. } else if (abs > 0) {
  42117. size += 1;
  42118. }
  42119. lastY = y;
  42120. }
  42121. }
  42122. return size;
  42123. }
  42124. write(pos, buf) {
  42125. const spos = pos;
  42126. const xCoordinates = [];
  42127. const yCoordinates = [];
  42128. const flags = [];
  42129. let lastX = 0;
  42130. let lastY = 0;
  42131. for (const contour of this.contours) {
  42132. for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) {
  42133. let flag = contour.flags[i];
  42134. const x = contour.xCoordinates[i];
  42135. let delta = x - lastX;
  42136. if (delta === 0) {
  42137. flag |= X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR;
  42138. xCoordinates.push(0);
  42139. } else {
  42140. const abs = Math.abs(delta);
  42141. if (abs <= 255) {
  42142. flag |= delta >= 0 ? X_SHORT_VECTOR | X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR : X_SHORT_VECTOR;
  42143. xCoordinates.push(abs);
  42144. } else {
  42145. xCoordinates.push(delta);
  42146. }
  42147. }
  42148. lastX = x;
  42149. const y = contour.yCoordinates[i];
  42150. delta = y - lastY;
  42151. if (delta === 0) {
  42152. flag |= Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR;
  42153. yCoordinates.push(0);
  42154. } else {
  42155. const abs = Math.abs(delta);
  42156. if (abs <= 255) {
  42157. flag |= delta >= 0 ? Y_SHORT_VECTOR | Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR : Y_SHORT_VECTOR;
  42158. yCoordinates.push(abs);
  42159. } else {
  42160. yCoordinates.push(delta);
  42161. }
  42162. }
  42163. lastY = y;
  42164. flags.push(flag);
  42165. }
  42166. buf.setUint16(pos, xCoordinates.length - 1);
  42167. pos += 2;
  42168. }
  42169. buf.setUint16(pos, this.instructions.length);
  42170. pos += 2;
  42171. if (this.instructions.length) {
  42172. new Uint8Array(buf.buffer, 0, buf.buffer.byteLength).set(this.instructions, pos);
  42173. pos += this.instructions.length;
  42174. }
  42175. for (const flag of flags) {
  42176. buf.setUint8(pos++, flag);
  42177. }
  42178. for (let i = 0, ii = xCoordinates.length; i < ii; i++) {
  42179. const x = xCoordinates[i];
  42180. const flag = flags[i];
  42181. if (flag & X_SHORT_VECTOR) {
  42182. buf.setUint8(pos++, x);
  42183. } else if (!(flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR)) {
  42184. buf.setInt16(pos, x);
  42185. pos += 2;
  42186. }
  42187. }
  42188. for (let i = 0, ii = yCoordinates.length; i < ii; i++) {
  42189. const y = yCoordinates[i];
  42190. const flag = flags[i];
  42191. if (flag & Y_SHORT_VECTOR) {
  42192. buf.setUint8(pos++, y);
  42193. } else if (!(flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR)) {
  42194. buf.setInt16(pos, y);
  42195. pos += 2;
  42196. }
  42197. }
  42198. return pos - spos;
  42199. }
  42200. scale(x, factor) {
  42201. for (const contour of this.contours) {
  42202. if (contour.xCoordinates.length === 0) {
  42203. continue;
  42204. }
  42205. for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) {
  42206. contour.xCoordinates[i] = Math.round(x + (contour.xCoordinates[i] - x) * factor);
  42207. }
  42208. }
  42209. }
  42210. }
  42211. class CompositeGlyph {
  42212. constructor({
  42213. flags,
  42214. glyphIndex,
  42215. argument1,
  42216. argument2,
  42217. transf,
  42218. instructions
  42219. }) {
  42220. this.flags = flags;
  42221. this.glyphIndex = glyphIndex;
  42222. this.argument1 = argument1;
  42223. this.argument2 = argument2;
  42224. this.transf = transf;
  42225. this.instructions = instructions;
  42226. }
  42227. static parse(pos, glyf) {
  42228. const spos = pos;
  42229. const transf = [];
  42230. let flags = glyf.getUint16(pos);
  42231. const glyphIndex = glyf.getUint16(pos + 2);
  42232. pos += 4;
  42233. let argument1, argument2;
  42234. if (flags & ARG_1_AND_2_ARE_WORDS) {
  42235. if (flags & ARGS_ARE_XY_VALUES) {
  42236. argument1 = glyf.getInt16(pos);
  42237. argument2 = glyf.getInt16(pos + 2);
  42238. } else {
  42239. argument1 = glyf.getUint16(pos);
  42240. argument2 = glyf.getUint16(pos + 2);
  42241. }
  42242. pos += 4;
  42243. flags ^= ARG_1_AND_2_ARE_WORDS;
  42244. } else {
  42245. if (flags & ARGS_ARE_XY_VALUES) {
  42246. argument1 = glyf.getInt8(pos);
  42247. argument2 = glyf.getInt8(pos + 1);
  42248. } else {
  42249. argument1 = glyf.getUint8(pos);
  42250. argument2 = glyf.getUint8(pos + 1);
  42251. }
  42252. pos += 2;
  42253. }
  42254. if (flags & WE_HAVE_A_SCALE) {
  42255. transf.push(glyf.getUint16(pos));
  42256. pos += 2;
  42257. } else if (flags & WE_HAVE_AN_X_AND_Y_SCALE) {
  42258. transf.push(glyf.getUint16(pos), glyf.getUint16(pos + 2));
  42259. pos += 4;
  42260. } else if (flags & WE_HAVE_A_TWO_BY_TWO) {
  42261. transf.push(glyf.getUint16(pos), glyf.getUint16(pos + 2), glyf.getUint16(pos + 4), glyf.getUint16(pos + 6));
  42262. pos += 8;
  42263. }
  42264. let instructions = null;
  42265. if (flags & WE_HAVE_INSTRUCTIONS) {
  42266. const instructionLength = glyf.getUint16(pos);
  42267. pos += 2;
  42268. instructions = new Uint8Array(glyf).slice(pos, pos + instructionLength);
  42269. pos += instructionLength;
  42270. }
  42271. return [pos - spos, new CompositeGlyph({
  42272. flags,
  42273. glyphIndex,
  42274. argument1,
  42275. argument2,
  42276. transf,
  42277. instructions
  42278. })];
  42279. }
  42280. getSize() {
  42281. let size = 2 + 2 + this.transf.length * 2;
  42282. if (this.flags & WE_HAVE_INSTRUCTIONS) {
  42283. size += 2 + this.instructions.length;
  42284. }
  42285. size += 2;
  42286. if (this.flags & 2) {
  42287. if (!(this.argument1 >= -128 && this.argument1 <= 127 && this.argument2 >= -128 && this.argument2 <= 127)) {
  42288. size += 2;
  42289. }
  42290. } else {
  42291. if (!(this.argument1 >= 0 && this.argument1 <= 255 && this.argument2 >= 0 && this.argument2 <= 255)) {
  42292. size += 2;
  42293. }
  42294. }
  42295. return size;
  42296. }
  42297. write(pos, buf) {
  42298. const spos = pos;
  42299. if (this.flags & ARGS_ARE_XY_VALUES) {
  42300. if (!(this.argument1 >= -128 && this.argument1 <= 127 && this.argument2 >= -128 && this.argument2 <= 127)) {
  42301. this.flags |= ARG_1_AND_2_ARE_WORDS;
  42302. }
  42303. } else {
  42304. if (!(this.argument1 >= 0 && this.argument1 <= 255 && this.argument2 >= 0 && this.argument2 <= 255)) {
  42305. this.flags |= ARG_1_AND_2_ARE_WORDS;
  42306. }
  42307. }
  42308. buf.setUint16(pos, this.flags);
  42309. buf.setUint16(pos + 2, this.glyphIndex);
  42310. pos += 4;
  42311. if (this.flags & ARG_1_AND_2_ARE_WORDS) {
  42312. if (this.flags & ARGS_ARE_XY_VALUES) {
  42313. buf.setInt16(pos, this.argument1);
  42314. buf.setInt16(pos + 2, this.argument2);
  42315. } else {
  42316. buf.setUint16(pos, this.argument1);
  42317. buf.setUint16(pos + 2, this.argument2);
  42318. }
  42319. pos += 4;
  42320. } else {
  42321. buf.setUint8(pos, this.argument1);
  42322. buf.setUint8(pos + 1, this.argument2);
  42323. pos += 2;
  42324. }
  42325. if (this.flags & WE_HAVE_INSTRUCTIONS) {
  42326. buf.setUint16(pos, this.instructions.length);
  42327. pos += 2;
  42328. if (this.instructions.length) {
  42329. new Uint8Array(buf.buffer, 0, buf.buffer.byteLength).set(this.instructions, pos);
  42330. pos += this.instructions.length;
  42331. }
  42332. }
  42333. return pos - spos;
  42334. }
  42335. scale(x, factor) {}
  42336. }
  42337. /***/ }),
  42338. /* 53 */
  42339. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  42340. Object.defineProperty(exports, "__esModule", ({
  42341. value: true
  42342. }));
  42343. exports.OpenTypeFileBuilder = void 0;
  42344. var _core_utils = __w_pdfjs_require__(6);
  42345. var _util = __w_pdfjs_require__(2);
  42346. function writeInt16(dest, offset, num) {
  42347. dest[offset] = num >> 8 & 0xff;
  42348. dest[offset + 1] = num & 0xff;
  42349. }
  42350. function writeInt32(dest, offset, num) {
  42351. dest[offset] = num >> 24 & 0xff;
  42352. dest[offset + 1] = num >> 16 & 0xff;
  42353. dest[offset + 2] = num >> 8 & 0xff;
  42354. dest[offset + 3] = num & 0xff;
  42355. }
  42356. function writeData(dest, offset, data) {
  42357. if (data instanceof Uint8Array) {
  42358. dest.set(data, offset);
  42359. } else if (typeof data === "string") {
  42360. for (let i = 0, ii = data.length; i < ii; i++) {
  42361. dest[offset++] = data.charCodeAt(i) & 0xff;
  42362. }
  42363. } else {
  42364. for (let i = 0, ii = data.length; i < ii; i++) {
  42365. dest[offset++] = data[i] & 0xff;
  42366. }
  42367. }
  42368. }
  42369. const OTF_HEADER_SIZE = 12;
  42370. const OTF_TABLE_ENTRY_SIZE = 16;
  42371. class OpenTypeFileBuilder {
  42372. constructor(sfnt) {
  42373. this.sfnt = sfnt;
  42374. this.tables = Object.create(null);
  42375. }
  42376. static getSearchParams(entriesCount, entrySize) {
  42377. let maxPower2 = 1,
  42378. log2 = 0;
  42379. while ((maxPower2 ^ entriesCount) > maxPower2) {
  42380. maxPower2 <<= 1;
  42381. log2++;
  42382. }
  42383. const searchRange = maxPower2 * entrySize;
  42384. return {
  42385. range: searchRange,
  42386. entry: log2,
  42387. rangeShift: entrySize * entriesCount - searchRange
  42388. };
  42389. }
  42390. toArray() {
  42391. let sfnt = this.sfnt;
  42392. const tables = this.tables;
  42393. const tablesNames = Object.keys(tables);
  42394. tablesNames.sort();
  42395. const numTables = tablesNames.length;
  42396. let i, j, jj, table, tableName;
  42397. let offset = OTF_HEADER_SIZE + numTables * OTF_TABLE_ENTRY_SIZE;
  42398. const tableOffsets = [offset];
  42399. for (i = 0; i < numTables; i++) {
  42400. table = tables[tablesNames[i]];
  42401. const paddedLength = (table.length + 3 & ~3) >>> 0;
  42402. offset += paddedLength;
  42403. tableOffsets.push(offset);
  42404. }
  42405. const file = new Uint8Array(offset);
  42406. for (i = 0; i < numTables; i++) {
  42407. table = tables[tablesNames[i]];
  42408. writeData(file, tableOffsets[i], table);
  42409. }
  42410. if (sfnt === "true") {
  42411. sfnt = (0, _util.string32)(0x00010000);
  42412. }
  42413. file[0] = sfnt.charCodeAt(0) & 0xff;
  42414. file[1] = sfnt.charCodeAt(1) & 0xff;
  42415. file[2] = sfnt.charCodeAt(2) & 0xff;
  42416. file[3] = sfnt.charCodeAt(3) & 0xff;
  42417. writeInt16(file, 4, numTables);
  42418. const searchParams = OpenTypeFileBuilder.getSearchParams(numTables, 16);
  42419. writeInt16(file, 6, searchParams.range);
  42420. writeInt16(file, 8, searchParams.entry);
  42421. writeInt16(file, 10, searchParams.rangeShift);
  42422. offset = OTF_HEADER_SIZE;
  42423. for (i = 0; i < numTables; i++) {
  42424. tableName = tablesNames[i];
  42425. file[offset] = tableName.charCodeAt(0) & 0xff;
  42426. file[offset + 1] = tableName.charCodeAt(1) & 0xff;
  42427. file[offset + 2] = tableName.charCodeAt(2) & 0xff;
  42428. file[offset + 3] = tableName.charCodeAt(3) & 0xff;
  42429. let checksum = 0;
  42430. for (j = tableOffsets[i], jj = tableOffsets[i + 1]; j < jj; j += 4) {
  42431. const quad = (0, _core_utils.readUint32)(file, j);
  42432. checksum = checksum + quad >>> 0;
  42433. }
  42434. writeInt32(file, offset + 4, checksum);
  42435. writeInt32(file, offset + 8, tableOffsets[i]);
  42436. writeInt32(file, offset + 12, tables[tableName].length);
  42437. offset += OTF_TABLE_ENTRY_SIZE;
  42438. }
  42439. return file;
  42440. }
  42441. addTable(tag, data) {
  42442. if (tag in this.tables) {
  42443. throw new Error("Table " + tag + " already exists");
  42444. }
  42445. this.tables[tag] = data;
  42446. }
  42447. }
  42448. exports.OpenTypeFileBuilder = OpenTypeFileBuilder;
  42449. /***/ }),
  42450. /* 54 */
  42451. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  42452. Object.defineProperty(exports, "__esModule", ({
  42453. value: true
  42454. }));
  42455. exports.Type1Font = void 0;
  42456. var _cff_parser = __w_pdfjs_require__(45);
  42457. var _fonts_utils = __w_pdfjs_require__(18);
  42458. var _core_utils = __w_pdfjs_require__(6);
  42459. var _stream = __w_pdfjs_require__(10);
  42460. var _type1_parser = __w_pdfjs_require__(55);
  42461. var _util = __w_pdfjs_require__(2);
  42462. function findBlock(streamBytes, signature, startIndex) {
  42463. const streamBytesLength = streamBytes.length;
  42464. const signatureLength = signature.length;
  42465. const scanLength = streamBytesLength - signatureLength;
  42466. let i = startIndex,
  42467. found = false;
  42468. while (i < scanLength) {
  42469. let j = 0;
  42470. while (j < signatureLength && streamBytes[i + j] === signature[j]) {
  42471. j++;
  42472. }
  42473. if (j >= signatureLength) {
  42474. i += j;
  42475. while (i < streamBytesLength && (0, _core_utils.isWhiteSpace)(streamBytes[i])) {
  42476. i++;
  42477. }
  42478. found = true;
  42479. break;
  42480. }
  42481. i++;
  42482. }
  42483. return {
  42484. found,
  42485. length: i
  42486. };
  42487. }
  42488. function getHeaderBlock(stream, suggestedLength) {
  42489. const EEXEC_SIGNATURE = [0x65, 0x65, 0x78, 0x65, 0x63];
  42490. const streamStartPos = stream.pos;
  42491. let headerBytes, headerBytesLength, block;
  42492. try {
  42493. headerBytes = stream.getBytes(suggestedLength);
  42494. headerBytesLength = headerBytes.length;
  42495. } catch (ex) {}
  42496. if (headerBytesLength === suggestedLength) {
  42497. block = findBlock(headerBytes, EEXEC_SIGNATURE, suggestedLength - 2 * EEXEC_SIGNATURE.length);
  42498. if (block.found && block.length === suggestedLength) {
  42499. return {
  42500. stream: new _stream.Stream(headerBytes),
  42501. length: suggestedLength
  42502. };
  42503. }
  42504. }
  42505. (0, _util.warn)('Invalid "Length1" property in Type1 font -- trying to recover.');
  42506. stream.pos = streamStartPos;
  42507. const SCAN_BLOCK_LENGTH = 2048;
  42508. let actualLength;
  42509. while (true) {
  42510. const scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH);
  42511. block = findBlock(scanBytes, EEXEC_SIGNATURE, 0);
  42512. if (block.length === 0) {
  42513. break;
  42514. }
  42515. stream.pos += block.length;
  42516. if (block.found) {
  42517. actualLength = stream.pos - streamStartPos;
  42518. break;
  42519. }
  42520. }
  42521. stream.pos = streamStartPos;
  42522. if (actualLength) {
  42523. return {
  42524. stream: new _stream.Stream(stream.getBytes(actualLength)),
  42525. length: actualLength
  42526. };
  42527. }
  42528. (0, _util.warn)('Unable to recover "Length1" property in Type1 font -- using as is.');
  42529. return {
  42530. stream: new _stream.Stream(stream.getBytes(suggestedLength)),
  42531. length: suggestedLength
  42532. };
  42533. }
  42534. function getEexecBlock(stream, suggestedLength) {
  42535. const eexecBytes = stream.getBytes();
  42536. return {
  42537. stream: new _stream.Stream(eexecBytes),
  42538. length: eexecBytes.length
  42539. };
  42540. }
  42541. class Type1Font {
  42542. constructor(name, file, properties) {
  42543. const PFB_HEADER_SIZE = 6;
  42544. let headerBlockLength = properties.length1;
  42545. let eexecBlockLength = properties.length2;
  42546. let pfbHeader = file.peekBytes(PFB_HEADER_SIZE);
  42547. const pfbHeaderPresent = pfbHeader[0] === 0x80 && pfbHeader[1] === 0x01;
  42548. if (pfbHeaderPresent) {
  42549. file.skip(PFB_HEADER_SIZE);
  42550. headerBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
  42551. }
  42552. const headerBlock = getHeaderBlock(file, headerBlockLength);
  42553. const headerBlockParser = new _type1_parser.Type1Parser(headerBlock.stream, false, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  42554. headerBlockParser.extractFontHeader(properties);
  42555. if (pfbHeaderPresent) {
  42556. pfbHeader = file.getBytes(PFB_HEADER_SIZE);
  42557. eexecBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
  42558. }
  42559. const eexecBlock = getEexecBlock(file, eexecBlockLength);
  42560. const eexecBlockParser = new _type1_parser.Type1Parser(eexecBlock.stream, true, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  42561. const data = eexecBlockParser.extractFontProgram(properties);
  42562. for (const key in data.properties) {
  42563. properties[key] = data.properties[key];
  42564. }
  42565. const charstrings = data.charstrings;
  42566. const type2Charstrings = this.getType2Charstrings(charstrings);
  42567. const subrs = this.getType2Subrs(data.subrs);
  42568. this.charstrings = charstrings;
  42569. this.data = this.wrap(name, type2Charstrings, this.charstrings, subrs, properties);
  42570. this.seacs = this.getSeacs(data.charstrings);
  42571. }
  42572. get numGlyphs() {
  42573. return this.charstrings.length + 1;
  42574. }
  42575. getCharset() {
  42576. const charset = [".notdef"];
  42577. for (const {
  42578. glyphName
  42579. } of this.charstrings) {
  42580. charset.push(glyphName);
  42581. }
  42582. return charset;
  42583. }
  42584. getGlyphMapping(properties) {
  42585. const charstrings = this.charstrings;
  42586. if (properties.composite) {
  42587. const charCodeToGlyphId = Object.create(null);
  42588. for (let glyphId = 0, charstringsLen = charstrings.length; glyphId < charstringsLen; glyphId++) {
  42589. const charCode = properties.cMap.charCodeOf(glyphId);
  42590. charCodeToGlyphId[charCode] = glyphId + 1;
  42591. }
  42592. return charCodeToGlyphId;
  42593. }
  42594. const glyphNames = [".notdef"];
  42595. let builtInEncoding, glyphId;
  42596. for (glyphId = 0; glyphId < charstrings.length; glyphId++) {
  42597. glyphNames.push(charstrings[glyphId].glyphName);
  42598. }
  42599. const encoding = properties.builtInEncoding;
  42600. if (encoding) {
  42601. builtInEncoding = Object.create(null);
  42602. for (const charCode in encoding) {
  42603. glyphId = glyphNames.indexOf(encoding[charCode]);
  42604. if (glyphId >= 0) {
  42605. builtInEncoding[charCode] = glyphId;
  42606. }
  42607. }
  42608. }
  42609. return (0, _fonts_utils.type1FontGlyphMapping)(properties, builtInEncoding, glyphNames);
  42610. }
  42611. hasGlyphId(id) {
  42612. if (id < 0 || id >= this.numGlyphs) {
  42613. return false;
  42614. }
  42615. if (id === 0) {
  42616. return true;
  42617. }
  42618. const glyph = this.charstrings[id - 1];
  42619. return glyph.charstring.length > 0;
  42620. }
  42621. getSeacs(charstrings) {
  42622. const seacMap = [];
  42623. for (let i = 0, ii = charstrings.length; i < ii; i++) {
  42624. const charstring = charstrings[i];
  42625. if (charstring.seac) {
  42626. seacMap[i + 1] = charstring.seac;
  42627. }
  42628. }
  42629. return seacMap;
  42630. }
  42631. getType2Charstrings(type1Charstrings) {
  42632. const type2Charstrings = [];
  42633. for (let i = 0, ii = type1Charstrings.length; i < ii; i++) {
  42634. type2Charstrings.push(type1Charstrings[i].charstring);
  42635. }
  42636. return type2Charstrings;
  42637. }
  42638. getType2Subrs(type1Subrs) {
  42639. let bias = 0;
  42640. const count = type1Subrs.length;
  42641. if (count < 1133) {
  42642. bias = 107;
  42643. } else if (count < 33769) {
  42644. bias = 1131;
  42645. } else {
  42646. bias = 32768;
  42647. }
  42648. const type2Subrs = [];
  42649. let i;
  42650. for (i = 0; i < bias; i++) {
  42651. type2Subrs.push([0x0b]);
  42652. }
  42653. for (i = 0; i < count; i++) {
  42654. type2Subrs.push(type1Subrs[i]);
  42655. }
  42656. return type2Subrs;
  42657. }
  42658. wrap(name, glyphs, charstrings, subrs, properties) {
  42659. const cff = new _cff_parser.CFF();
  42660. cff.header = new _cff_parser.CFFHeader(1, 0, 4, 4);
  42661. cff.names = [name];
  42662. const topDict = new _cff_parser.CFFTopDict();
  42663. topDict.setByName("version", 391);
  42664. topDict.setByName("Notice", 392);
  42665. topDict.setByName("FullName", 393);
  42666. topDict.setByName("FamilyName", 394);
  42667. topDict.setByName("Weight", 395);
  42668. topDict.setByName("Encoding", null);
  42669. topDict.setByName("FontMatrix", properties.fontMatrix);
  42670. topDict.setByName("FontBBox", properties.bbox);
  42671. topDict.setByName("charset", null);
  42672. topDict.setByName("CharStrings", null);
  42673. topDict.setByName("Private", null);
  42674. cff.topDict = topDict;
  42675. const strings = new _cff_parser.CFFStrings();
  42676. strings.add("Version 0.11");
  42677. strings.add("See original notice");
  42678. strings.add(name);
  42679. strings.add(name);
  42680. strings.add("Medium");
  42681. cff.strings = strings;
  42682. cff.globalSubrIndex = new _cff_parser.CFFIndex();
  42683. const count = glyphs.length;
  42684. const charsetArray = [".notdef"];
  42685. let i, ii;
  42686. for (i = 0; i < count; i++) {
  42687. const glyphName = charstrings[i].glyphName;
  42688. const index = _cff_parser.CFFStandardStrings.indexOf(glyphName);
  42689. if (index === -1) {
  42690. strings.add(glyphName);
  42691. }
  42692. charsetArray.push(glyphName);
  42693. }
  42694. cff.charset = new _cff_parser.CFFCharset(false, 0, charsetArray);
  42695. const charStringsIndex = new _cff_parser.CFFIndex();
  42696. charStringsIndex.add([0x8b, 0x0e]);
  42697. for (i = 0; i < count; i++) {
  42698. charStringsIndex.add(glyphs[i]);
  42699. }
  42700. cff.charStrings = charStringsIndex;
  42701. const privateDict = new _cff_parser.CFFPrivateDict();
  42702. privateDict.setByName("Subrs", null);
  42703. const fields = ["BlueValues", "OtherBlues", "FamilyBlues", "FamilyOtherBlues", "StemSnapH", "StemSnapV", "BlueShift", "BlueFuzz", "BlueScale", "LanguageGroup", "ExpansionFactor", "ForceBold", "StdHW", "StdVW"];
  42704. for (i = 0, ii = fields.length; i < ii; i++) {
  42705. const field = fields[i];
  42706. if (!(field in properties.privateData)) {
  42707. continue;
  42708. }
  42709. const value = properties.privateData[field];
  42710. if (Array.isArray(value)) {
  42711. for (let j = value.length - 1; j > 0; j--) {
  42712. value[j] -= value[j - 1];
  42713. }
  42714. }
  42715. privateDict.setByName(field, value);
  42716. }
  42717. cff.topDict.privateDict = privateDict;
  42718. const subrIndex = new _cff_parser.CFFIndex();
  42719. for (i = 0, ii = subrs.length; i < ii; i++) {
  42720. subrIndex.add(subrs[i]);
  42721. }
  42722. privateDict.subrsIndex = subrIndex;
  42723. const compiler = new _cff_parser.CFFCompiler(cff);
  42724. return compiler.compile();
  42725. }
  42726. }
  42727. exports.Type1Font = Type1Font;
  42728. /***/ }),
  42729. /* 55 */
  42730. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  42731. Object.defineProperty(exports, "__esModule", ({
  42732. value: true
  42733. }));
  42734. exports.Type1Parser = void 0;
  42735. var _encodings = __w_pdfjs_require__(19);
  42736. var _core_utils = __w_pdfjs_require__(6);
  42737. var _stream = __w_pdfjs_require__(10);
  42738. var _util = __w_pdfjs_require__(2);
  42739. const HINTING_ENABLED = false;
  42740. const Type1CharString = function Type1CharStringClosure() {
  42741. const COMMAND_MAP = {
  42742. hstem: [1],
  42743. vstem: [3],
  42744. vmoveto: [4],
  42745. rlineto: [5],
  42746. hlineto: [6],
  42747. vlineto: [7],
  42748. rrcurveto: [8],
  42749. callsubr: [10],
  42750. flex: [12, 35],
  42751. drop: [12, 18],
  42752. endchar: [14],
  42753. rmoveto: [21],
  42754. hmoveto: [22],
  42755. vhcurveto: [30],
  42756. hvcurveto: [31]
  42757. };
  42758. class Type1CharString {
  42759. constructor() {
  42760. this.width = 0;
  42761. this.lsb = 0;
  42762. this.flexing = false;
  42763. this.output = [];
  42764. this.stack = [];
  42765. }
  42766. convert(encoded, subrs, seacAnalysisEnabled) {
  42767. const count = encoded.length;
  42768. let error = false;
  42769. let wx, sbx, subrNumber;
  42770. for (let i = 0; i < count; i++) {
  42771. let value = encoded[i];
  42772. if (value < 32) {
  42773. if (value === 12) {
  42774. value = (value << 8) + encoded[++i];
  42775. }
  42776. switch (value) {
  42777. case 1:
  42778. if (!HINTING_ENABLED) {
  42779. this.stack = [];
  42780. break;
  42781. }
  42782. error = this.executeCommand(2, COMMAND_MAP.hstem);
  42783. break;
  42784. case 3:
  42785. if (!HINTING_ENABLED) {
  42786. this.stack = [];
  42787. break;
  42788. }
  42789. error = this.executeCommand(2, COMMAND_MAP.vstem);
  42790. break;
  42791. case 4:
  42792. if (this.flexing) {
  42793. if (this.stack.length < 1) {
  42794. error = true;
  42795. break;
  42796. }
  42797. const dy = this.stack.pop();
  42798. this.stack.push(0, dy);
  42799. break;
  42800. }
  42801. error = this.executeCommand(1, COMMAND_MAP.vmoveto);
  42802. break;
  42803. case 5:
  42804. error = this.executeCommand(2, COMMAND_MAP.rlineto);
  42805. break;
  42806. case 6:
  42807. error = this.executeCommand(1, COMMAND_MAP.hlineto);
  42808. break;
  42809. case 7:
  42810. error = this.executeCommand(1, COMMAND_MAP.vlineto);
  42811. break;
  42812. case 8:
  42813. error = this.executeCommand(6, COMMAND_MAP.rrcurveto);
  42814. break;
  42815. case 9:
  42816. this.stack = [];
  42817. break;
  42818. case 10:
  42819. if (this.stack.length < 1) {
  42820. error = true;
  42821. break;
  42822. }
  42823. subrNumber = this.stack.pop();
  42824. if (!subrs[subrNumber]) {
  42825. error = true;
  42826. break;
  42827. }
  42828. error = this.convert(subrs[subrNumber], subrs, seacAnalysisEnabled);
  42829. break;
  42830. case 11:
  42831. return error;
  42832. case 13:
  42833. if (this.stack.length < 2) {
  42834. error = true;
  42835. break;
  42836. }
  42837. wx = this.stack.pop();
  42838. sbx = this.stack.pop();
  42839. this.lsb = sbx;
  42840. this.width = wx;
  42841. this.stack.push(wx, sbx);
  42842. error = this.executeCommand(2, COMMAND_MAP.hmoveto);
  42843. break;
  42844. case 14:
  42845. this.output.push(COMMAND_MAP.endchar[0]);
  42846. break;
  42847. case 21:
  42848. if (this.flexing) {
  42849. break;
  42850. }
  42851. error = this.executeCommand(2, COMMAND_MAP.rmoveto);
  42852. break;
  42853. case 22:
  42854. if (this.flexing) {
  42855. this.stack.push(0);
  42856. break;
  42857. }
  42858. error = this.executeCommand(1, COMMAND_MAP.hmoveto);
  42859. break;
  42860. case 30:
  42861. error = this.executeCommand(4, COMMAND_MAP.vhcurveto);
  42862. break;
  42863. case 31:
  42864. error = this.executeCommand(4, COMMAND_MAP.hvcurveto);
  42865. break;
  42866. case (12 << 8) + 0:
  42867. this.stack = [];
  42868. break;
  42869. case (12 << 8) + 1:
  42870. if (!HINTING_ENABLED) {
  42871. this.stack = [];
  42872. break;
  42873. }
  42874. error = this.executeCommand(2, COMMAND_MAP.vstem);
  42875. break;
  42876. case (12 << 8) + 2:
  42877. if (!HINTING_ENABLED) {
  42878. this.stack = [];
  42879. break;
  42880. }
  42881. error = this.executeCommand(2, COMMAND_MAP.hstem);
  42882. break;
  42883. case (12 << 8) + 6:
  42884. if (seacAnalysisEnabled) {
  42885. const asb = this.stack.at(-5);
  42886. this.seac = this.stack.splice(-4, 4);
  42887. this.seac[0] += this.lsb - asb;
  42888. error = this.executeCommand(0, COMMAND_MAP.endchar);
  42889. } else {
  42890. error = this.executeCommand(4, COMMAND_MAP.endchar);
  42891. }
  42892. break;
  42893. case (12 << 8) + 7:
  42894. if (this.stack.length < 4) {
  42895. error = true;
  42896. break;
  42897. }
  42898. this.stack.pop();
  42899. wx = this.stack.pop();
  42900. const sby = this.stack.pop();
  42901. sbx = this.stack.pop();
  42902. this.lsb = sbx;
  42903. this.width = wx;
  42904. this.stack.push(wx, sbx, sby);
  42905. error = this.executeCommand(3, COMMAND_MAP.rmoveto);
  42906. break;
  42907. case (12 << 8) + 12:
  42908. if (this.stack.length < 2) {
  42909. error = true;
  42910. break;
  42911. }
  42912. const num2 = this.stack.pop();
  42913. const num1 = this.stack.pop();
  42914. this.stack.push(num1 / num2);
  42915. break;
  42916. case (12 << 8) + 16:
  42917. if (this.stack.length < 2) {
  42918. error = true;
  42919. break;
  42920. }
  42921. subrNumber = this.stack.pop();
  42922. const numArgs = this.stack.pop();
  42923. if (subrNumber === 0 && numArgs === 3) {
  42924. const flexArgs = this.stack.splice(this.stack.length - 17, 17);
  42925. 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]);
  42926. error = this.executeCommand(13, COMMAND_MAP.flex, true);
  42927. this.flexing = false;
  42928. this.stack.push(flexArgs[15], flexArgs[16]);
  42929. } else if (subrNumber === 1 && numArgs === 0) {
  42930. this.flexing = true;
  42931. }
  42932. break;
  42933. case (12 << 8) + 17:
  42934. break;
  42935. case (12 << 8) + 33:
  42936. this.stack = [];
  42937. break;
  42938. default:
  42939. (0, _util.warn)('Unknown type 1 charstring command of "' + value + '"');
  42940. break;
  42941. }
  42942. if (error) {
  42943. break;
  42944. }
  42945. continue;
  42946. } else if (value <= 246) {
  42947. value -= 139;
  42948. } else if (value <= 250) {
  42949. value = (value - 247) * 256 + encoded[++i] + 108;
  42950. } else if (value <= 254) {
  42951. value = -((value - 251) * 256) - encoded[++i] - 108;
  42952. } else {
  42953. value = (encoded[++i] & 0xff) << 24 | (encoded[++i] & 0xff) << 16 | (encoded[++i] & 0xff) << 8 | (encoded[++i] & 0xff) << 0;
  42954. }
  42955. this.stack.push(value);
  42956. }
  42957. return error;
  42958. }
  42959. executeCommand(howManyArgs, command, keepStack) {
  42960. const stackLength = this.stack.length;
  42961. if (howManyArgs > stackLength) {
  42962. return true;
  42963. }
  42964. const start = stackLength - howManyArgs;
  42965. for (let i = start; i < stackLength; i++) {
  42966. let value = this.stack[i];
  42967. if (Number.isInteger(value)) {
  42968. this.output.push(28, value >> 8 & 0xff, value & 0xff);
  42969. } else {
  42970. value = 65536 * value | 0;
  42971. this.output.push(255, value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
  42972. }
  42973. }
  42974. this.output.push.apply(this.output, command);
  42975. if (keepStack) {
  42976. this.stack.splice(start, howManyArgs);
  42977. } else {
  42978. this.stack.length = 0;
  42979. }
  42980. return false;
  42981. }
  42982. }
  42983. return Type1CharString;
  42984. }();
  42985. const Type1Parser = function Type1ParserClosure() {
  42986. const EEXEC_ENCRYPT_KEY = 55665;
  42987. const CHAR_STRS_ENCRYPT_KEY = 4330;
  42988. function isHexDigit(code) {
  42989. return code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102;
  42990. }
  42991. function decrypt(data, key, discardNumber) {
  42992. if (discardNumber >= data.length) {
  42993. return new Uint8Array(0);
  42994. }
  42995. const c1 = 52845,
  42996. c2 = 22719;
  42997. let r = key | 0,
  42998. i,
  42999. j;
  43000. for (i = 0; i < discardNumber; i++) {
  43001. r = (data[i] + r) * c1 + c2 & (1 << 16) - 1;
  43002. }
  43003. const count = data.length - discardNumber;
  43004. const decrypted = new Uint8Array(count);
  43005. for (i = discardNumber, j = 0; j < count; i++, j++) {
  43006. const value = data[i];
  43007. decrypted[j] = value ^ r >> 8;
  43008. r = (value + r) * c1 + c2 & (1 << 16) - 1;
  43009. }
  43010. return decrypted;
  43011. }
  43012. function decryptAscii(data, key, discardNumber) {
  43013. const c1 = 52845,
  43014. c2 = 22719;
  43015. let r = key | 0;
  43016. const count = data.length,
  43017. maybeLength = count >>> 1;
  43018. const decrypted = new Uint8Array(maybeLength);
  43019. let i, j;
  43020. for (i = 0, j = 0; i < count; i++) {
  43021. const digit1 = data[i];
  43022. if (!isHexDigit(digit1)) {
  43023. continue;
  43024. }
  43025. i++;
  43026. let digit2;
  43027. while (i < count && !isHexDigit(digit2 = data[i])) {
  43028. i++;
  43029. }
  43030. if (i < count) {
  43031. const value = parseInt(String.fromCharCode(digit1, digit2), 16);
  43032. decrypted[j++] = value ^ r >> 8;
  43033. r = (value + r) * c1 + c2 & (1 << 16) - 1;
  43034. }
  43035. }
  43036. return decrypted.slice(discardNumber, j);
  43037. }
  43038. function isSpecial(c) {
  43039. return c === 0x2f || c === 0x5b || c === 0x5d || c === 0x7b || c === 0x7d || c === 0x28 || c === 0x29;
  43040. }
  43041. class Type1Parser {
  43042. constructor(stream, encrypted, seacAnalysisEnabled) {
  43043. if (encrypted) {
  43044. const data = stream.getBytes();
  43045. 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]));
  43046. stream = new _stream.Stream(isBinary ? decrypt(data, EEXEC_ENCRYPT_KEY, 4) : decryptAscii(data, EEXEC_ENCRYPT_KEY, 4));
  43047. }
  43048. this.seacAnalysisEnabled = !!seacAnalysisEnabled;
  43049. this.stream = stream;
  43050. this.nextChar();
  43051. }
  43052. readNumberArray() {
  43053. this.getToken();
  43054. const array = [];
  43055. while (true) {
  43056. const token = this.getToken();
  43057. if (token === null || token === "]" || token === "}") {
  43058. break;
  43059. }
  43060. array.push(parseFloat(token || 0));
  43061. }
  43062. return array;
  43063. }
  43064. readNumber() {
  43065. const token = this.getToken();
  43066. return parseFloat(token || 0);
  43067. }
  43068. readInt() {
  43069. const token = this.getToken();
  43070. return parseInt(token || 0, 10) | 0;
  43071. }
  43072. readBoolean() {
  43073. const token = this.getToken();
  43074. return token === "true" ? 1 : 0;
  43075. }
  43076. nextChar() {
  43077. return this.currentChar = this.stream.getByte();
  43078. }
  43079. prevChar() {
  43080. this.stream.skip(-2);
  43081. return this.currentChar = this.stream.getByte();
  43082. }
  43083. getToken() {
  43084. let comment = false;
  43085. let ch = this.currentChar;
  43086. while (true) {
  43087. if (ch === -1) {
  43088. return null;
  43089. }
  43090. if (comment) {
  43091. if (ch === 0x0a || ch === 0x0d) {
  43092. comment = false;
  43093. }
  43094. } else if (ch === 0x25) {
  43095. comment = true;
  43096. } else if (!(0, _core_utils.isWhiteSpace)(ch)) {
  43097. break;
  43098. }
  43099. ch = this.nextChar();
  43100. }
  43101. if (isSpecial(ch)) {
  43102. this.nextChar();
  43103. return String.fromCharCode(ch);
  43104. }
  43105. let token = "";
  43106. do {
  43107. token += String.fromCharCode(ch);
  43108. ch = this.nextChar();
  43109. } while (ch >= 0 && !(0, _core_utils.isWhiteSpace)(ch) && !isSpecial(ch));
  43110. return token;
  43111. }
  43112. readCharStrings(bytes, lenIV) {
  43113. if (lenIV === -1) {
  43114. return bytes;
  43115. }
  43116. return decrypt(bytes, CHAR_STRS_ENCRYPT_KEY, lenIV);
  43117. }
  43118. extractFontProgram(properties) {
  43119. const stream = this.stream;
  43120. const subrs = [],
  43121. charstrings = [];
  43122. const privateData = Object.create(null);
  43123. privateData.lenIV = 4;
  43124. const program = {
  43125. subrs: [],
  43126. charstrings: [],
  43127. properties: {
  43128. privateData
  43129. }
  43130. };
  43131. let token, length, data, lenIV;
  43132. while ((token = this.getToken()) !== null) {
  43133. if (token !== "/") {
  43134. continue;
  43135. }
  43136. token = this.getToken();
  43137. switch (token) {
  43138. case "CharStrings":
  43139. this.getToken();
  43140. this.getToken();
  43141. this.getToken();
  43142. this.getToken();
  43143. while (true) {
  43144. token = this.getToken();
  43145. if (token === null || token === "end") {
  43146. break;
  43147. }
  43148. if (token !== "/") {
  43149. continue;
  43150. }
  43151. const glyph = this.getToken();
  43152. length = this.readInt();
  43153. this.getToken();
  43154. data = length > 0 ? stream.getBytes(length) : new Uint8Array(0);
  43155. lenIV = program.properties.privateData.lenIV;
  43156. const encoded = this.readCharStrings(data, lenIV);
  43157. this.nextChar();
  43158. token = this.getToken();
  43159. if (token === "noaccess") {
  43160. this.getToken();
  43161. } else if (token === "/") {
  43162. this.prevChar();
  43163. }
  43164. charstrings.push({
  43165. glyph,
  43166. encoded
  43167. });
  43168. }
  43169. break;
  43170. case "Subrs":
  43171. this.readInt();
  43172. this.getToken();
  43173. while (this.getToken() === "dup") {
  43174. const index = this.readInt();
  43175. length = this.readInt();
  43176. this.getToken();
  43177. data = length > 0 ? stream.getBytes(length) : new Uint8Array(0);
  43178. lenIV = program.properties.privateData.lenIV;
  43179. const encoded = this.readCharStrings(data, lenIV);
  43180. this.nextChar();
  43181. token = this.getToken();
  43182. if (token === "noaccess") {
  43183. this.getToken();
  43184. }
  43185. subrs[index] = encoded;
  43186. }
  43187. break;
  43188. case "BlueValues":
  43189. case "OtherBlues":
  43190. case "FamilyBlues":
  43191. case "FamilyOtherBlues":
  43192. const blueArray = this.readNumberArray();
  43193. if (blueArray.length > 0 && blueArray.length % 2 === 0 && HINTING_ENABLED) {
  43194. program.properties.privateData[token] = blueArray;
  43195. }
  43196. break;
  43197. case "StemSnapH":
  43198. case "StemSnapV":
  43199. program.properties.privateData[token] = this.readNumberArray();
  43200. break;
  43201. case "StdHW":
  43202. case "StdVW":
  43203. program.properties.privateData[token] = this.readNumberArray()[0];
  43204. break;
  43205. case "BlueShift":
  43206. case "lenIV":
  43207. case "BlueFuzz":
  43208. case "BlueScale":
  43209. case "LanguageGroup":
  43210. case "ExpansionFactor":
  43211. program.properties.privateData[token] = this.readNumber();
  43212. break;
  43213. case "ForceBold":
  43214. program.properties.privateData[token] = this.readBoolean();
  43215. break;
  43216. }
  43217. }
  43218. for (const {
  43219. encoded,
  43220. glyph
  43221. } of charstrings) {
  43222. const charString = new Type1CharString();
  43223. const error = charString.convert(encoded, subrs, this.seacAnalysisEnabled);
  43224. let output = charString.output;
  43225. if (error) {
  43226. output = [14];
  43227. }
  43228. const charStringObject = {
  43229. glyphName: glyph,
  43230. charstring: output,
  43231. width: charString.width,
  43232. lsb: charString.lsb,
  43233. seac: charString.seac
  43234. };
  43235. if (glyph === ".notdef") {
  43236. program.charstrings.unshift(charStringObject);
  43237. } else {
  43238. program.charstrings.push(charStringObject);
  43239. }
  43240. if (properties.builtInEncoding) {
  43241. const index = properties.builtInEncoding.indexOf(glyph);
  43242. if (index > -1 && properties.widths[index] === undefined && index >= properties.firstChar && index <= properties.lastChar) {
  43243. properties.widths[index] = charString.width;
  43244. }
  43245. }
  43246. }
  43247. return program;
  43248. }
  43249. extractFontHeader(properties) {
  43250. let token;
  43251. while ((token = this.getToken()) !== null) {
  43252. if (token !== "/") {
  43253. continue;
  43254. }
  43255. token = this.getToken();
  43256. switch (token) {
  43257. case "FontMatrix":
  43258. const matrix = this.readNumberArray();
  43259. properties.fontMatrix = matrix;
  43260. break;
  43261. case "Encoding":
  43262. const encodingArg = this.getToken();
  43263. let encoding;
  43264. if (!/^\d+$/.test(encodingArg)) {
  43265. encoding = (0, _encodings.getEncoding)(encodingArg);
  43266. } else {
  43267. encoding = [];
  43268. const size = parseInt(encodingArg, 10) | 0;
  43269. this.getToken();
  43270. for (let j = 0; j < size; j++) {
  43271. token = this.getToken();
  43272. while (token !== "dup" && token !== "def") {
  43273. token = this.getToken();
  43274. if (token === null) {
  43275. return;
  43276. }
  43277. }
  43278. if (token === "def") {
  43279. break;
  43280. }
  43281. const index = this.readInt();
  43282. this.getToken();
  43283. const glyph = this.getToken();
  43284. encoding[index] = glyph;
  43285. this.getToken();
  43286. }
  43287. }
  43288. properties.builtInEncoding = encoding;
  43289. break;
  43290. case "FontBBox":
  43291. const fontBBox = this.readNumberArray();
  43292. properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
  43293. properties.descent = Math.min(fontBBox[1], fontBBox[3]);
  43294. properties.ascentScaled = true;
  43295. break;
  43296. }
  43297. }
  43298. }
  43299. }
  43300. return Type1Parser;
  43301. }();
  43302. exports.Type1Parser = Type1Parser;
  43303. /***/ }),
  43304. /* 56 */
  43305. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  43306. Object.defineProperty(exports, "__esModule", ({
  43307. value: true
  43308. }));
  43309. exports.Pattern = void 0;
  43310. exports.getTilingPatternIR = getTilingPatternIR;
  43311. var _util = __w_pdfjs_require__(2);
  43312. var _base_stream = __w_pdfjs_require__(7);
  43313. var _colorspace = __w_pdfjs_require__(24);
  43314. var _core_utils = __w_pdfjs_require__(6);
  43315. const ShadingType = {
  43316. FUNCTION_BASED: 1,
  43317. AXIAL: 2,
  43318. RADIAL: 3,
  43319. FREE_FORM_MESH: 4,
  43320. LATTICE_FORM_MESH: 5,
  43321. COONS_PATCH_MESH: 6,
  43322. TENSOR_PATCH_MESH: 7
  43323. };
  43324. class Pattern {
  43325. constructor() {
  43326. (0, _util.unreachable)("Cannot initialize Pattern.");
  43327. }
  43328. static parseShading(shading, xref, res, handler, pdfFunctionFactory, localColorSpaceCache) {
  43329. const dict = shading instanceof _base_stream.BaseStream ? shading.dict : shading;
  43330. const type = dict.get("ShadingType");
  43331. try {
  43332. switch (type) {
  43333. case ShadingType.AXIAL:
  43334. case ShadingType.RADIAL:
  43335. return new RadialAxialShading(dict, xref, res, pdfFunctionFactory, localColorSpaceCache);
  43336. case ShadingType.FREE_FORM_MESH:
  43337. case ShadingType.LATTICE_FORM_MESH:
  43338. case ShadingType.COONS_PATCH_MESH:
  43339. case ShadingType.TENSOR_PATCH_MESH:
  43340. return new MeshShading(shading, xref, res, pdfFunctionFactory, localColorSpaceCache);
  43341. default:
  43342. throw new _util.FormatError("Unsupported ShadingType: " + type);
  43343. }
  43344. } catch (ex) {
  43345. if (ex instanceof _core_utils.MissingDataException) {
  43346. throw ex;
  43347. }
  43348. handler.send("UnsupportedFeature", {
  43349. featureId: _util.UNSUPPORTED_FEATURES.shadingPattern
  43350. });
  43351. (0, _util.warn)(ex);
  43352. return new DummyShading();
  43353. }
  43354. }
  43355. }
  43356. exports.Pattern = Pattern;
  43357. class BaseShading {
  43358. static get SMALL_NUMBER() {
  43359. return (0, _util.shadow)(this, "SMALL_NUMBER", 1e-6);
  43360. }
  43361. constructor() {
  43362. if (this.constructor === BaseShading) {
  43363. (0, _util.unreachable)("Cannot initialize BaseShading.");
  43364. }
  43365. }
  43366. getIR() {
  43367. (0, _util.unreachable)("Abstract method `getIR` called.");
  43368. }
  43369. }
  43370. class RadialAxialShading extends BaseShading {
  43371. constructor(dict, xref, resources, pdfFunctionFactory, localColorSpaceCache) {
  43372. super();
  43373. this.coordsArr = dict.getArray("Coords");
  43374. this.shadingType = dict.get("ShadingType");
  43375. const cs = _colorspace.ColorSpace.parse({
  43376. cs: dict.getRaw("CS") || dict.getRaw("ColorSpace"),
  43377. xref,
  43378. resources,
  43379. pdfFunctionFactory,
  43380. localColorSpaceCache
  43381. });
  43382. const bbox = dict.getArray("BBox");
  43383. if (Array.isArray(bbox) && bbox.length === 4) {
  43384. this.bbox = _util.Util.normalizeRect(bbox);
  43385. } else {
  43386. this.bbox = null;
  43387. }
  43388. let t0 = 0.0,
  43389. t1 = 1.0;
  43390. if (dict.has("Domain")) {
  43391. const domainArr = dict.getArray("Domain");
  43392. t0 = domainArr[0];
  43393. t1 = domainArr[1];
  43394. }
  43395. let extendStart = false,
  43396. extendEnd = false;
  43397. if (dict.has("Extend")) {
  43398. const extendArr = dict.getArray("Extend");
  43399. extendStart = extendArr[0];
  43400. extendEnd = extendArr[1];
  43401. }
  43402. if (this.shadingType === ShadingType.RADIAL && (!extendStart || !extendEnd)) {
  43403. const [x1, y1, r1, x2, y2, r2] = this.coordsArr;
  43404. const distance = Math.hypot(x1 - x2, y1 - y2);
  43405. if (r1 <= r2 + distance && r2 <= r1 + distance) {
  43406. (0, _util.warn)("Unsupported radial gradient.");
  43407. }
  43408. }
  43409. this.extendStart = extendStart;
  43410. this.extendEnd = extendEnd;
  43411. const fnObj = dict.getRaw("Function");
  43412. const fn = pdfFunctionFactory.createFromArray(fnObj);
  43413. const NUMBER_OF_SAMPLES = 10;
  43414. const step = (t1 - t0) / NUMBER_OF_SAMPLES;
  43415. const colorStops = this.colorStops = [];
  43416. if (t0 >= t1 || step <= 0) {
  43417. (0, _util.info)("Bad shading domain.");
  43418. return;
  43419. }
  43420. const color = new Float32Array(cs.numComps),
  43421. ratio = new Float32Array(1);
  43422. let rgbColor;
  43423. for (let i = 0; i <= NUMBER_OF_SAMPLES; i++) {
  43424. ratio[0] = t0 + i * step;
  43425. fn(ratio, 0, color, 0);
  43426. rgbColor = cs.getRgb(color, 0);
  43427. const cssColor = _util.Util.makeHexColor(rgbColor[0], rgbColor[1], rgbColor[2]);
  43428. colorStops.push([i / NUMBER_OF_SAMPLES, cssColor]);
  43429. }
  43430. let background = "transparent";
  43431. if (dict.has("Background")) {
  43432. rgbColor = cs.getRgb(dict.get("Background"), 0);
  43433. background = _util.Util.makeHexColor(rgbColor[0], rgbColor[1], rgbColor[2]);
  43434. }
  43435. if (!extendStart) {
  43436. colorStops.unshift([0, background]);
  43437. colorStops[1][0] += BaseShading.SMALL_NUMBER;
  43438. }
  43439. if (!extendEnd) {
  43440. colorStops.at(-1)[0] -= BaseShading.SMALL_NUMBER;
  43441. colorStops.push([1, background]);
  43442. }
  43443. this.colorStops = colorStops;
  43444. }
  43445. getIR() {
  43446. const coordsArr = this.coordsArr;
  43447. const shadingType = this.shadingType;
  43448. let type, p0, p1, r0, r1;
  43449. if (shadingType === ShadingType.AXIAL) {
  43450. p0 = [coordsArr[0], coordsArr[1]];
  43451. p1 = [coordsArr[2], coordsArr[3]];
  43452. r0 = null;
  43453. r1 = null;
  43454. type = "axial";
  43455. } else if (shadingType === ShadingType.RADIAL) {
  43456. p0 = [coordsArr[0], coordsArr[1]];
  43457. p1 = [coordsArr[3], coordsArr[4]];
  43458. r0 = coordsArr[2];
  43459. r1 = coordsArr[5];
  43460. type = "radial";
  43461. } else {
  43462. (0, _util.unreachable)(`getPattern type unknown: ${shadingType}`);
  43463. }
  43464. return ["RadialAxial", type, this.bbox, this.colorStops, p0, p1, r0, r1];
  43465. }
  43466. }
  43467. class MeshStreamReader {
  43468. constructor(stream, context) {
  43469. this.stream = stream;
  43470. this.context = context;
  43471. this.buffer = 0;
  43472. this.bufferLength = 0;
  43473. const numComps = context.numComps;
  43474. this.tmpCompsBuf = new Float32Array(numComps);
  43475. const csNumComps = context.colorSpace.numComps;
  43476. this.tmpCsCompsBuf = context.colorFn ? new Float32Array(csNumComps) : this.tmpCompsBuf;
  43477. }
  43478. get hasData() {
  43479. if (this.stream.end) {
  43480. return this.stream.pos < this.stream.end;
  43481. }
  43482. if (this.bufferLength > 0) {
  43483. return true;
  43484. }
  43485. const nextByte = this.stream.getByte();
  43486. if (nextByte < 0) {
  43487. return false;
  43488. }
  43489. this.buffer = nextByte;
  43490. this.bufferLength = 8;
  43491. return true;
  43492. }
  43493. readBits(n) {
  43494. let buffer = this.buffer;
  43495. let bufferLength = this.bufferLength;
  43496. if (n === 32) {
  43497. if (bufferLength === 0) {
  43498. return (this.stream.getByte() << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte()) >>> 0;
  43499. }
  43500. buffer = buffer << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte();
  43501. const nextByte = this.stream.getByte();
  43502. this.buffer = nextByte & (1 << bufferLength) - 1;
  43503. return (buffer << 8 - bufferLength | (nextByte & 0xff) >> bufferLength) >>> 0;
  43504. }
  43505. if (n === 8 && bufferLength === 0) {
  43506. return this.stream.getByte();
  43507. }
  43508. while (bufferLength < n) {
  43509. buffer = buffer << 8 | this.stream.getByte();
  43510. bufferLength += 8;
  43511. }
  43512. bufferLength -= n;
  43513. this.bufferLength = bufferLength;
  43514. this.buffer = buffer & (1 << bufferLength) - 1;
  43515. return buffer >> bufferLength;
  43516. }
  43517. align() {
  43518. this.buffer = 0;
  43519. this.bufferLength = 0;
  43520. }
  43521. readFlag() {
  43522. return this.readBits(this.context.bitsPerFlag);
  43523. }
  43524. readCoordinate() {
  43525. const bitsPerCoordinate = this.context.bitsPerCoordinate;
  43526. const xi = this.readBits(bitsPerCoordinate);
  43527. const yi = this.readBits(bitsPerCoordinate);
  43528. const decode = this.context.decode;
  43529. const scale = bitsPerCoordinate < 32 ? 1 / ((1 << bitsPerCoordinate) - 1) : 2.3283064365386963e-10;
  43530. return [xi * scale * (decode[1] - decode[0]) + decode[0], yi * scale * (decode[3] - decode[2]) + decode[2]];
  43531. }
  43532. readComponents() {
  43533. const numComps = this.context.numComps;
  43534. const bitsPerComponent = this.context.bitsPerComponent;
  43535. const scale = bitsPerComponent < 32 ? 1 / ((1 << bitsPerComponent) - 1) : 2.3283064365386963e-10;
  43536. const decode = this.context.decode;
  43537. const components = this.tmpCompsBuf;
  43538. for (let i = 0, j = 4; i < numComps; i++, j += 2) {
  43539. const ci = this.readBits(bitsPerComponent);
  43540. components[i] = ci * scale * (decode[j + 1] - decode[j]) + decode[j];
  43541. }
  43542. const color = this.tmpCsCompsBuf;
  43543. if (this.context.colorFn) {
  43544. this.context.colorFn(components, 0, color, 0);
  43545. }
  43546. return this.context.colorSpace.getRgb(color, 0);
  43547. }
  43548. }
  43549. const getB = function getBClosure() {
  43550. function buildB(count) {
  43551. const lut = [];
  43552. for (let i = 0; i <= count; i++) {
  43553. const t = i / count,
  43554. t_ = 1 - t;
  43555. lut.push(new Float32Array([t_ * t_ * t_, 3 * t * t_ * t_, 3 * t * t * t_, t * t * t]));
  43556. }
  43557. return lut;
  43558. }
  43559. const cache = [];
  43560. return function (count) {
  43561. if (!cache[count]) {
  43562. cache[count] = buildB(count);
  43563. }
  43564. return cache[count];
  43565. };
  43566. }();
  43567. class MeshShading extends BaseShading {
  43568. static get MIN_SPLIT_PATCH_CHUNKS_AMOUNT() {
  43569. return (0, _util.shadow)(this, "MIN_SPLIT_PATCH_CHUNKS_AMOUNT", 3);
  43570. }
  43571. static get MAX_SPLIT_PATCH_CHUNKS_AMOUNT() {
  43572. return (0, _util.shadow)(this, "MAX_SPLIT_PATCH_CHUNKS_AMOUNT", 20);
  43573. }
  43574. static get TRIANGLE_DENSITY() {
  43575. return (0, _util.shadow)(this, "TRIANGLE_DENSITY", 20);
  43576. }
  43577. constructor(stream, xref, resources, pdfFunctionFactory, localColorSpaceCache) {
  43578. super();
  43579. if (!(stream instanceof _base_stream.BaseStream)) {
  43580. throw new _util.FormatError("Mesh data is not a stream");
  43581. }
  43582. const dict = stream.dict;
  43583. this.shadingType = dict.get("ShadingType");
  43584. const bbox = dict.getArray("BBox");
  43585. if (Array.isArray(bbox) && bbox.length === 4) {
  43586. this.bbox = _util.Util.normalizeRect(bbox);
  43587. } else {
  43588. this.bbox = null;
  43589. }
  43590. const cs = _colorspace.ColorSpace.parse({
  43591. cs: dict.getRaw("CS") || dict.getRaw("ColorSpace"),
  43592. xref,
  43593. resources,
  43594. pdfFunctionFactory,
  43595. localColorSpaceCache
  43596. });
  43597. this.background = dict.has("Background") ? cs.getRgb(dict.get("Background"), 0) : null;
  43598. const fnObj = dict.getRaw("Function");
  43599. const fn = fnObj ? pdfFunctionFactory.createFromArray(fnObj) : null;
  43600. this.coords = [];
  43601. this.colors = [];
  43602. this.figures = [];
  43603. const decodeContext = {
  43604. bitsPerCoordinate: dict.get("BitsPerCoordinate"),
  43605. bitsPerComponent: dict.get("BitsPerComponent"),
  43606. bitsPerFlag: dict.get("BitsPerFlag"),
  43607. decode: dict.getArray("Decode"),
  43608. colorFn: fn,
  43609. colorSpace: cs,
  43610. numComps: fn ? 1 : cs.numComps
  43611. };
  43612. const reader = new MeshStreamReader(stream, decodeContext);
  43613. let patchMesh = false;
  43614. switch (this.shadingType) {
  43615. case ShadingType.FREE_FORM_MESH:
  43616. this._decodeType4Shading(reader);
  43617. break;
  43618. case ShadingType.LATTICE_FORM_MESH:
  43619. const verticesPerRow = dict.get("VerticesPerRow") | 0;
  43620. if (verticesPerRow < 2) {
  43621. throw new _util.FormatError("Invalid VerticesPerRow");
  43622. }
  43623. this._decodeType5Shading(reader, verticesPerRow);
  43624. break;
  43625. case ShadingType.COONS_PATCH_MESH:
  43626. this._decodeType6Shading(reader);
  43627. patchMesh = true;
  43628. break;
  43629. case ShadingType.TENSOR_PATCH_MESH:
  43630. this._decodeType7Shading(reader);
  43631. patchMesh = true;
  43632. break;
  43633. default:
  43634. (0, _util.unreachable)("Unsupported mesh type.");
  43635. break;
  43636. }
  43637. if (patchMesh) {
  43638. this._updateBounds();
  43639. for (let i = 0, ii = this.figures.length; i < ii; i++) {
  43640. this._buildFigureFromPatch(i);
  43641. }
  43642. }
  43643. this._updateBounds();
  43644. this._packData();
  43645. }
  43646. _decodeType4Shading(reader) {
  43647. const coords = this.coords;
  43648. const colors = this.colors;
  43649. const operators = [];
  43650. const ps = [];
  43651. let verticesLeft = 0;
  43652. while (reader.hasData) {
  43653. const f = reader.readFlag();
  43654. const coord = reader.readCoordinate();
  43655. const color = reader.readComponents();
  43656. if (verticesLeft === 0) {
  43657. if (!(0 <= f && f <= 2)) {
  43658. throw new _util.FormatError("Unknown type4 flag");
  43659. }
  43660. switch (f) {
  43661. case 0:
  43662. verticesLeft = 3;
  43663. break;
  43664. case 1:
  43665. ps.push(ps.at(-2), ps.at(-1));
  43666. verticesLeft = 1;
  43667. break;
  43668. case 2:
  43669. ps.push(ps.at(-3), ps.at(-1));
  43670. verticesLeft = 1;
  43671. break;
  43672. }
  43673. operators.push(f);
  43674. }
  43675. ps.push(coords.length);
  43676. coords.push(coord);
  43677. colors.push(color);
  43678. verticesLeft--;
  43679. reader.align();
  43680. }
  43681. this.figures.push({
  43682. type: "triangles",
  43683. coords: new Int32Array(ps),
  43684. colors: new Int32Array(ps)
  43685. });
  43686. }
  43687. _decodeType5Shading(reader, verticesPerRow) {
  43688. const coords = this.coords;
  43689. const colors = this.colors;
  43690. const ps = [];
  43691. while (reader.hasData) {
  43692. const coord = reader.readCoordinate();
  43693. const color = reader.readComponents();
  43694. ps.push(coords.length);
  43695. coords.push(coord);
  43696. colors.push(color);
  43697. }
  43698. this.figures.push({
  43699. type: "lattice",
  43700. coords: new Int32Array(ps),
  43701. colors: new Int32Array(ps),
  43702. verticesPerRow
  43703. });
  43704. }
  43705. _decodeType6Shading(reader) {
  43706. const coords = this.coords;
  43707. const colors = this.colors;
  43708. const ps = new Int32Array(16);
  43709. const cs = new Int32Array(4);
  43710. while (reader.hasData) {
  43711. const f = reader.readFlag();
  43712. if (!(0 <= f && f <= 3)) {
  43713. throw new _util.FormatError("Unknown type6 flag");
  43714. }
  43715. const pi = coords.length;
  43716. for (let i = 0, ii = f !== 0 ? 8 : 12; i < ii; i++) {
  43717. coords.push(reader.readCoordinate());
  43718. }
  43719. const ci = colors.length;
  43720. for (let i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
  43721. colors.push(reader.readComponents());
  43722. }
  43723. let tmp1, tmp2, tmp3, tmp4;
  43724. switch (f) {
  43725. case 0:
  43726. ps[12] = pi + 3;
  43727. ps[13] = pi + 4;
  43728. ps[14] = pi + 5;
  43729. ps[15] = pi + 6;
  43730. ps[8] = pi + 2;
  43731. ps[11] = pi + 7;
  43732. ps[4] = pi + 1;
  43733. ps[7] = pi + 8;
  43734. ps[0] = pi;
  43735. ps[1] = pi + 11;
  43736. ps[2] = pi + 10;
  43737. ps[3] = pi + 9;
  43738. cs[2] = ci + 1;
  43739. cs[3] = ci + 2;
  43740. cs[0] = ci;
  43741. cs[1] = ci + 3;
  43742. break;
  43743. case 1:
  43744. tmp1 = ps[12];
  43745. tmp2 = ps[13];
  43746. tmp3 = ps[14];
  43747. tmp4 = ps[15];
  43748. ps[12] = tmp4;
  43749. ps[13] = pi + 0;
  43750. ps[14] = pi + 1;
  43751. ps[15] = pi + 2;
  43752. ps[8] = tmp3;
  43753. ps[11] = pi + 3;
  43754. ps[4] = tmp2;
  43755. ps[7] = pi + 4;
  43756. ps[0] = tmp1;
  43757. ps[1] = pi + 7;
  43758. ps[2] = pi + 6;
  43759. ps[3] = pi + 5;
  43760. tmp1 = cs[2];
  43761. tmp2 = cs[3];
  43762. cs[2] = tmp2;
  43763. cs[3] = ci;
  43764. cs[0] = tmp1;
  43765. cs[1] = ci + 1;
  43766. break;
  43767. case 2:
  43768. tmp1 = ps[15];
  43769. tmp2 = ps[11];
  43770. ps[12] = ps[3];
  43771. ps[13] = pi + 0;
  43772. ps[14] = pi + 1;
  43773. ps[15] = pi + 2;
  43774. ps[8] = ps[7];
  43775. ps[11] = pi + 3;
  43776. ps[4] = tmp2;
  43777. ps[7] = pi + 4;
  43778. ps[0] = tmp1;
  43779. ps[1] = pi + 7;
  43780. ps[2] = pi + 6;
  43781. ps[3] = pi + 5;
  43782. tmp1 = cs[3];
  43783. cs[2] = cs[1];
  43784. cs[3] = ci;
  43785. cs[0] = tmp1;
  43786. cs[1] = ci + 1;
  43787. break;
  43788. case 3:
  43789. ps[12] = ps[0];
  43790. ps[13] = pi + 0;
  43791. ps[14] = pi + 1;
  43792. ps[15] = pi + 2;
  43793. ps[8] = ps[1];
  43794. ps[11] = pi + 3;
  43795. ps[4] = ps[2];
  43796. ps[7] = pi + 4;
  43797. ps[0] = ps[3];
  43798. ps[1] = pi + 7;
  43799. ps[2] = pi + 6;
  43800. ps[3] = pi + 5;
  43801. cs[2] = cs[0];
  43802. cs[3] = ci;
  43803. cs[0] = cs[1];
  43804. cs[1] = ci + 1;
  43805. break;
  43806. }
  43807. ps[5] = coords.length;
  43808. 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]);
  43809. ps[6] = coords.length;
  43810. 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]);
  43811. ps[9] = coords.length;
  43812. 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]);
  43813. ps[10] = coords.length;
  43814. 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]);
  43815. this.figures.push({
  43816. type: "patch",
  43817. coords: new Int32Array(ps),
  43818. colors: new Int32Array(cs)
  43819. });
  43820. }
  43821. }
  43822. _decodeType7Shading(reader) {
  43823. const coords = this.coords;
  43824. const colors = this.colors;
  43825. const ps = new Int32Array(16);
  43826. const cs = new Int32Array(4);
  43827. while (reader.hasData) {
  43828. const f = reader.readFlag();
  43829. if (!(0 <= f && f <= 3)) {
  43830. throw new _util.FormatError("Unknown type7 flag");
  43831. }
  43832. const pi = coords.length;
  43833. for (let i = 0, ii = f !== 0 ? 12 : 16; i < ii; i++) {
  43834. coords.push(reader.readCoordinate());
  43835. }
  43836. const ci = colors.length;
  43837. for (let i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
  43838. colors.push(reader.readComponents());
  43839. }
  43840. let tmp1, tmp2, tmp3, tmp4;
  43841. switch (f) {
  43842. case 0:
  43843. ps[12] = pi + 3;
  43844. ps[13] = pi + 4;
  43845. ps[14] = pi + 5;
  43846. ps[15] = pi + 6;
  43847. ps[8] = pi + 2;
  43848. ps[9] = pi + 13;
  43849. ps[10] = pi + 14;
  43850. ps[11] = pi + 7;
  43851. ps[4] = pi + 1;
  43852. ps[5] = pi + 12;
  43853. ps[6] = pi + 15;
  43854. ps[7] = pi + 8;
  43855. ps[0] = pi;
  43856. ps[1] = pi + 11;
  43857. ps[2] = pi + 10;
  43858. ps[3] = pi + 9;
  43859. cs[2] = ci + 1;
  43860. cs[3] = ci + 2;
  43861. cs[0] = ci;
  43862. cs[1] = ci + 3;
  43863. break;
  43864. case 1:
  43865. tmp1 = ps[12];
  43866. tmp2 = ps[13];
  43867. tmp3 = ps[14];
  43868. tmp4 = ps[15];
  43869. ps[12] = tmp4;
  43870. ps[13] = pi + 0;
  43871. ps[14] = pi + 1;
  43872. ps[15] = pi + 2;
  43873. ps[8] = tmp3;
  43874. ps[9] = pi + 9;
  43875. ps[10] = pi + 10;
  43876. ps[11] = pi + 3;
  43877. ps[4] = tmp2;
  43878. ps[5] = pi + 8;
  43879. ps[6] = pi + 11;
  43880. ps[7] = pi + 4;
  43881. ps[0] = tmp1;
  43882. ps[1] = pi + 7;
  43883. ps[2] = pi + 6;
  43884. ps[3] = pi + 5;
  43885. tmp1 = cs[2];
  43886. tmp2 = cs[3];
  43887. cs[2] = tmp2;
  43888. cs[3] = ci;
  43889. cs[0] = tmp1;
  43890. cs[1] = ci + 1;
  43891. break;
  43892. case 2:
  43893. tmp1 = ps[15];
  43894. tmp2 = ps[11];
  43895. ps[12] = ps[3];
  43896. ps[13] = pi + 0;
  43897. ps[14] = pi + 1;
  43898. ps[15] = pi + 2;
  43899. ps[8] = ps[7];
  43900. ps[9] = pi + 9;
  43901. ps[10] = pi + 10;
  43902. ps[11] = pi + 3;
  43903. ps[4] = tmp2;
  43904. ps[5] = pi + 8;
  43905. ps[6] = pi + 11;
  43906. ps[7] = pi + 4;
  43907. ps[0] = tmp1;
  43908. ps[1] = pi + 7;
  43909. ps[2] = pi + 6;
  43910. ps[3] = pi + 5;
  43911. tmp1 = cs[3];
  43912. cs[2] = cs[1];
  43913. cs[3] = ci;
  43914. cs[0] = tmp1;
  43915. cs[1] = ci + 1;
  43916. break;
  43917. case 3:
  43918. ps[12] = ps[0];
  43919. ps[13] = pi + 0;
  43920. ps[14] = pi + 1;
  43921. ps[15] = pi + 2;
  43922. ps[8] = ps[1];
  43923. ps[9] = pi + 9;
  43924. ps[10] = pi + 10;
  43925. ps[11] = pi + 3;
  43926. ps[4] = ps[2];
  43927. ps[5] = pi + 8;
  43928. ps[6] = pi + 11;
  43929. ps[7] = pi + 4;
  43930. ps[0] = ps[3];
  43931. ps[1] = pi + 7;
  43932. ps[2] = pi + 6;
  43933. ps[3] = pi + 5;
  43934. cs[2] = cs[0];
  43935. cs[3] = ci;
  43936. cs[0] = cs[1];
  43937. cs[1] = ci + 1;
  43938. break;
  43939. }
  43940. this.figures.push({
  43941. type: "patch",
  43942. coords: new Int32Array(ps),
  43943. colors: new Int32Array(cs)
  43944. });
  43945. }
  43946. }
  43947. _buildFigureFromPatch(index) {
  43948. const figure = this.figures[index];
  43949. (0, _util.assert)(figure.type === "patch", "Unexpected patch mesh figure");
  43950. const coords = this.coords,
  43951. colors = this.colors;
  43952. const pi = figure.coords;
  43953. const ci = figure.colors;
  43954. const figureMinX = Math.min(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
  43955. const figureMinY = Math.min(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
  43956. const figureMaxX = Math.max(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
  43957. const figureMaxY = Math.max(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
  43958. let splitXBy = Math.ceil((figureMaxX - figureMinX) * MeshShading.TRIANGLE_DENSITY / (this.bounds[2] - this.bounds[0]));
  43959. splitXBy = Math.max(MeshShading.MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MeshShading.MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitXBy));
  43960. let splitYBy = Math.ceil((figureMaxY - figureMinY) * MeshShading.TRIANGLE_DENSITY / (this.bounds[3] - this.bounds[1]));
  43961. splitYBy = Math.max(MeshShading.MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MeshShading.MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitYBy));
  43962. const verticesPerRow = splitXBy + 1;
  43963. const figureCoords = new Int32Array((splitYBy + 1) * verticesPerRow);
  43964. const figureColors = new Int32Array((splitYBy + 1) * verticesPerRow);
  43965. let k = 0;
  43966. const cl = new Uint8Array(3),
  43967. cr = new Uint8Array(3);
  43968. const c0 = colors[ci[0]],
  43969. c1 = colors[ci[1]],
  43970. c2 = colors[ci[2]],
  43971. c3 = colors[ci[3]];
  43972. const bRow = getB(splitYBy),
  43973. bCol = getB(splitXBy);
  43974. for (let row = 0; row <= splitYBy; row++) {
  43975. cl[0] = (c0[0] * (splitYBy - row) + c2[0] * row) / splitYBy | 0;
  43976. cl[1] = (c0[1] * (splitYBy - row) + c2[1] * row) / splitYBy | 0;
  43977. cl[2] = (c0[2] * (splitYBy - row) + c2[2] * row) / splitYBy | 0;
  43978. cr[0] = (c1[0] * (splitYBy - row) + c3[0] * row) / splitYBy | 0;
  43979. cr[1] = (c1[1] * (splitYBy - row) + c3[1] * row) / splitYBy | 0;
  43980. cr[2] = (c1[2] * (splitYBy - row) + c3[2] * row) / splitYBy | 0;
  43981. for (let col = 0; col <= splitXBy; col++, k++) {
  43982. if ((row === 0 || row === splitYBy) && (col === 0 || col === splitXBy)) {
  43983. continue;
  43984. }
  43985. let x = 0,
  43986. y = 0;
  43987. let q = 0;
  43988. for (let i = 0; i <= 3; i++) {
  43989. for (let j = 0; j <= 3; j++, q++) {
  43990. const m = bRow[row][i] * bCol[col][j];
  43991. x += coords[pi[q]][0] * m;
  43992. y += coords[pi[q]][1] * m;
  43993. }
  43994. }
  43995. figureCoords[k] = coords.length;
  43996. coords.push([x, y]);
  43997. figureColors[k] = colors.length;
  43998. const newColor = new Uint8Array(3);
  43999. newColor[0] = (cl[0] * (splitXBy - col) + cr[0] * col) / splitXBy | 0;
  44000. newColor[1] = (cl[1] * (splitXBy - col) + cr[1] * col) / splitXBy | 0;
  44001. newColor[2] = (cl[2] * (splitXBy - col) + cr[2] * col) / splitXBy | 0;
  44002. colors.push(newColor);
  44003. }
  44004. }
  44005. figureCoords[0] = pi[0];
  44006. figureColors[0] = ci[0];
  44007. figureCoords[splitXBy] = pi[3];
  44008. figureColors[splitXBy] = ci[1];
  44009. figureCoords[verticesPerRow * splitYBy] = pi[12];
  44010. figureColors[verticesPerRow * splitYBy] = ci[2];
  44011. figureCoords[verticesPerRow * splitYBy + splitXBy] = pi[15];
  44012. figureColors[verticesPerRow * splitYBy + splitXBy] = ci[3];
  44013. this.figures[index] = {
  44014. type: "lattice",
  44015. coords: figureCoords,
  44016. colors: figureColors,
  44017. verticesPerRow
  44018. };
  44019. }
  44020. _updateBounds() {
  44021. let minX = this.coords[0][0],
  44022. minY = this.coords[0][1],
  44023. maxX = minX,
  44024. maxY = minY;
  44025. for (let i = 1, ii = this.coords.length; i < ii; i++) {
  44026. const x = this.coords[i][0],
  44027. y = this.coords[i][1];
  44028. minX = minX > x ? x : minX;
  44029. minY = minY > y ? y : minY;
  44030. maxX = maxX < x ? x : maxX;
  44031. maxY = maxY < y ? y : maxY;
  44032. }
  44033. this.bounds = [minX, minY, maxX, maxY];
  44034. }
  44035. _packData() {
  44036. let i, ii, j, jj;
  44037. const coords = this.coords;
  44038. const coordsPacked = new Float32Array(coords.length * 2);
  44039. for (i = 0, j = 0, ii = coords.length; i < ii; i++) {
  44040. const xy = coords[i];
  44041. coordsPacked[j++] = xy[0];
  44042. coordsPacked[j++] = xy[1];
  44043. }
  44044. this.coords = coordsPacked;
  44045. const colors = this.colors;
  44046. const colorsPacked = new Uint8Array(colors.length * 3);
  44047. for (i = 0, j = 0, ii = colors.length; i < ii; i++) {
  44048. const c = colors[i];
  44049. colorsPacked[j++] = c[0];
  44050. colorsPacked[j++] = c[1];
  44051. colorsPacked[j++] = c[2];
  44052. }
  44053. this.colors = colorsPacked;
  44054. const figures = this.figures;
  44055. for (i = 0, ii = figures.length; i < ii; i++) {
  44056. const figure = figures[i],
  44057. ps = figure.coords,
  44058. cs = figure.colors;
  44059. for (j = 0, jj = ps.length; j < jj; j++) {
  44060. ps[j] *= 2;
  44061. cs[j] *= 3;
  44062. }
  44063. }
  44064. }
  44065. getIR() {
  44066. return ["Mesh", this.shadingType, this.coords, this.colors, this.figures, this.bounds, this.bbox, this.background];
  44067. }
  44068. }
  44069. class DummyShading extends BaseShading {
  44070. getIR() {
  44071. return ["Dummy"];
  44072. }
  44073. }
  44074. function getTilingPatternIR(operatorList, dict, color) {
  44075. const matrix = dict.getArray("Matrix");
  44076. const bbox = _util.Util.normalizeRect(dict.getArray("BBox"));
  44077. const xstep = dict.get("XStep");
  44078. const ystep = dict.get("YStep");
  44079. const paintType = dict.get("PaintType");
  44080. const tilingType = dict.get("TilingType");
  44081. if (bbox[2] - bbox[0] === 0 || bbox[3] - bbox[1] === 0) {
  44082. throw new _util.FormatError(`Invalid getTilingPatternIR /BBox array: [${bbox}].`);
  44083. }
  44084. return ["TilingPattern", color, operatorList, matrix, bbox, xstep, ystep, paintType, tilingType];
  44085. }
  44086. /***/ }),
  44087. /* 57 */
  44088. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  44089. Object.defineProperty(exports, "__esModule", ({
  44090. value: true
  44091. }));
  44092. exports.PostScriptEvaluator = exports.PostScriptCompiler = exports.PDFFunctionFactory = void 0;
  44093. exports.isPDFFunction = isPDFFunction;
  44094. var _primitives = __w_pdfjs_require__(5);
  44095. var _util = __w_pdfjs_require__(2);
  44096. var _ps_parser = __w_pdfjs_require__(58);
  44097. var _base_stream = __w_pdfjs_require__(7);
  44098. var _image_utils = __w_pdfjs_require__(59);
  44099. class PDFFunctionFactory {
  44100. constructor({
  44101. xref,
  44102. isEvalSupported = true
  44103. }) {
  44104. this.xref = xref;
  44105. this.isEvalSupported = isEvalSupported !== false;
  44106. }
  44107. create(fn) {
  44108. const cachedFunction = this.getCached(fn);
  44109. if (cachedFunction) {
  44110. return cachedFunction;
  44111. }
  44112. const parsedFunction = PDFFunction.parse({
  44113. xref: this.xref,
  44114. isEvalSupported: this.isEvalSupported,
  44115. fn: fn instanceof _primitives.Ref ? this.xref.fetch(fn) : fn
  44116. });
  44117. this._cache(fn, parsedFunction);
  44118. return parsedFunction;
  44119. }
  44120. createFromArray(fnObj) {
  44121. const cachedFunction = this.getCached(fnObj);
  44122. if (cachedFunction) {
  44123. return cachedFunction;
  44124. }
  44125. const parsedFunction = PDFFunction.parseArray({
  44126. xref: this.xref,
  44127. isEvalSupported: this.isEvalSupported,
  44128. fnObj: fnObj instanceof _primitives.Ref ? this.xref.fetch(fnObj) : fnObj
  44129. });
  44130. this._cache(fnObj, parsedFunction);
  44131. return parsedFunction;
  44132. }
  44133. getCached(cacheKey) {
  44134. let fnRef;
  44135. if (cacheKey instanceof _primitives.Ref) {
  44136. fnRef = cacheKey;
  44137. } else if (cacheKey instanceof _primitives.Dict) {
  44138. fnRef = cacheKey.objId;
  44139. } else if (cacheKey instanceof _base_stream.BaseStream) {
  44140. fnRef = cacheKey.dict && cacheKey.dict.objId;
  44141. }
  44142. if (fnRef) {
  44143. const localFunction = this._localFunctionCache.getByRef(fnRef);
  44144. if (localFunction) {
  44145. return localFunction;
  44146. }
  44147. }
  44148. return null;
  44149. }
  44150. _cache(cacheKey, parsedFunction) {
  44151. if (!parsedFunction) {
  44152. throw new Error('PDFFunctionFactory._cache - expected "parsedFunction" argument.');
  44153. }
  44154. let fnRef;
  44155. if (cacheKey instanceof _primitives.Ref) {
  44156. fnRef = cacheKey;
  44157. } else if (cacheKey instanceof _primitives.Dict) {
  44158. fnRef = cacheKey.objId;
  44159. } else if (cacheKey instanceof _base_stream.BaseStream) {
  44160. fnRef = cacheKey.dict && cacheKey.dict.objId;
  44161. }
  44162. if (fnRef) {
  44163. this._localFunctionCache.set(null, fnRef, parsedFunction);
  44164. }
  44165. }
  44166. get _localFunctionCache() {
  44167. return (0, _util.shadow)(this, "_localFunctionCache", new _image_utils.LocalFunctionCache());
  44168. }
  44169. }
  44170. exports.PDFFunctionFactory = PDFFunctionFactory;
  44171. function toNumberArray(arr) {
  44172. if (!Array.isArray(arr)) {
  44173. return null;
  44174. }
  44175. const length = arr.length;
  44176. for (let i = 0; i < length; i++) {
  44177. if (typeof arr[i] !== "number") {
  44178. const result = new Array(length);
  44179. for (let j = 0; j < length; j++) {
  44180. result[j] = +arr[j];
  44181. }
  44182. return result;
  44183. }
  44184. }
  44185. return arr;
  44186. }
  44187. class PDFFunction {
  44188. static getSampleArray(size, outputSize, bps, stream) {
  44189. let i, ii;
  44190. let length = 1;
  44191. for (i = 0, ii = size.length; i < ii; i++) {
  44192. length *= size[i];
  44193. }
  44194. length *= outputSize;
  44195. const array = new Array(length);
  44196. let codeSize = 0;
  44197. let codeBuf = 0;
  44198. const sampleMul = 1.0 / (2.0 ** bps - 1);
  44199. const strBytes = stream.getBytes((length * bps + 7) / 8);
  44200. let strIdx = 0;
  44201. for (i = 0; i < length; i++) {
  44202. while (codeSize < bps) {
  44203. codeBuf <<= 8;
  44204. codeBuf |= strBytes[strIdx++];
  44205. codeSize += 8;
  44206. }
  44207. codeSize -= bps;
  44208. array[i] = (codeBuf >> codeSize) * sampleMul;
  44209. codeBuf &= (1 << codeSize) - 1;
  44210. }
  44211. return array;
  44212. }
  44213. static parse({
  44214. xref,
  44215. isEvalSupported,
  44216. fn
  44217. }) {
  44218. const dict = fn.dict || fn;
  44219. const typeNum = dict.get("FunctionType");
  44220. switch (typeNum) {
  44221. case 0:
  44222. return this.constructSampled({
  44223. xref,
  44224. isEvalSupported,
  44225. fn,
  44226. dict
  44227. });
  44228. case 1:
  44229. break;
  44230. case 2:
  44231. return this.constructInterpolated({
  44232. xref,
  44233. isEvalSupported,
  44234. dict
  44235. });
  44236. case 3:
  44237. return this.constructStiched({
  44238. xref,
  44239. isEvalSupported,
  44240. dict
  44241. });
  44242. case 4:
  44243. return this.constructPostScript({
  44244. xref,
  44245. isEvalSupported,
  44246. fn,
  44247. dict
  44248. });
  44249. }
  44250. throw new _util.FormatError("Unknown type of function");
  44251. }
  44252. static parseArray({
  44253. xref,
  44254. isEvalSupported,
  44255. fnObj
  44256. }) {
  44257. if (!Array.isArray(fnObj)) {
  44258. return this.parse({
  44259. xref,
  44260. isEvalSupported,
  44261. fn: fnObj
  44262. });
  44263. }
  44264. const fnArray = [];
  44265. for (let j = 0, jj = fnObj.length; j < jj; j++) {
  44266. fnArray.push(this.parse({
  44267. xref,
  44268. isEvalSupported,
  44269. fn: xref.fetchIfRef(fnObj[j])
  44270. }));
  44271. }
  44272. return function (src, srcOffset, dest, destOffset) {
  44273. for (let i = 0, ii = fnArray.length; i < ii; i++) {
  44274. fnArray[i](src, srcOffset, dest, destOffset + i);
  44275. }
  44276. };
  44277. }
  44278. static constructSampled({
  44279. xref,
  44280. isEvalSupported,
  44281. fn,
  44282. dict
  44283. }) {
  44284. function toMultiArray(arr) {
  44285. const inputLength = arr.length;
  44286. const out = [];
  44287. let index = 0;
  44288. for (let i = 0; i < inputLength; i += 2) {
  44289. out[index++] = [arr[i], arr[i + 1]];
  44290. }
  44291. return out;
  44292. }
  44293. function interpolate(x, xmin, xmax, ymin, ymax) {
  44294. return ymin + (x - xmin) * ((ymax - ymin) / (xmax - xmin));
  44295. }
  44296. let domain = toNumberArray(dict.getArray("Domain"));
  44297. let range = toNumberArray(dict.getArray("Range"));
  44298. if (!domain || !range) {
  44299. throw new _util.FormatError("No domain or range");
  44300. }
  44301. const inputSize = domain.length / 2;
  44302. const outputSize = range.length / 2;
  44303. domain = toMultiArray(domain);
  44304. range = toMultiArray(range);
  44305. const size = toNumberArray(dict.getArray("Size"));
  44306. const bps = dict.get("BitsPerSample");
  44307. const order = dict.get("Order") || 1;
  44308. if (order !== 1) {
  44309. (0, _util.info)("No support for cubic spline interpolation: " + order);
  44310. }
  44311. let encode = toNumberArray(dict.getArray("Encode"));
  44312. if (!encode) {
  44313. encode = [];
  44314. for (let i = 0; i < inputSize; ++i) {
  44315. encode.push([0, size[i] - 1]);
  44316. }
  44317. } else {
  44318. encode = toMultiArray(encode);
  44319. }
  44320. let decode = toNumberArray(dict.getArray("Decode"));
  44321. if (!decode) {
  44322. decode = range;
  44323. } else {
  44324. decode = toMultiArray(decode);
  44325. }
  44326. const samples = this.getSampleArray(size, outputSize, bps, fn);
  44327. return function constructSampledFn(src, srcOffset, dest, destOffset) {
  44328. const cubeVertices = 1 << inputSize;
  44329. const cubeN = new Float64Array(cubeVertices);
  44330. const cubeVertex = new Uint32Array(cubeVertices);
  44331. let i, j;
  44332. for (j = 0; j < cubeVertices; j++) {
  44333. cubeN[j] = 1;
  44334. }
  44335. let k = outputSize,
  44336. pos = 1;
  44337. for (i = 0; i < inputSize; ++i) {
  44338. const domain_2i = domain[i][0];
  44339. const domain_2i_1 = domain[i][1];
  44340. const xi = Math.min(Math.max(src[srcOffset + i], domain_2i), domain_2i_1);
  44341. let e = interpolate(xi, domain_2i, domain_2i_1, encode[i][0], encode[i][1]);
  44342. const size_i = size[i];
  44343. e = Math.min(Math.max(e, 0), size_i - 1);
  44344. const e0 = e < size_i - 1 ? Math.floor(e) : e - 1;
  44345. const n0 = e0 + 1 - e;
  44346. const n1 = e - e0;
  44347. const offset0 = e0 * k;
  44348. const offset1 = offset0 + k;
  44349. for (j = 0; j < cubeVertices; j++) {
  44350. if (j & pos) {
  44351. cubeN[j] *= n1;
  44352. cubeVertex[j] += offset1;
  44353. } else {
  44354. cubeN[j] *= n0;
  44355. cubeVertex[j] += offset0;
  44356. }
  44357. }
  44358. k *= size_i;
  44359. pos <<= 1;
  44360. }
  44361. for (j = 0; j < outputSize; ++j) {
  44362. let rj = 0;
  44363. for (i = 0; i < cubeVertices; i++) {
  44364. rj += samples[cubeVertex[i] + j] * cubeN[i];
  44365. }
  44366. rj = interpolate(rj, 0, 1, decode[j][0], decode[j][1]);
  44367. dest[destOffset + j] = Math.min(Math.max(rj, range[j][0]), range[j][1]);
  44368. }
  44369. };
  44370. }
  44371. static constructInterpolated({
  44372. xref,
  44373. isEvalSupported,
  44374. dict
  44375. }) {
  44376. const c0 = toNumberArray(dict.getArray("C0")) || [0];
  44377. const c1 = toNumberArray(dict.getArray("C1")) || [1];
  44378. const n = dict.get("N");
  44379. const diff = [];
  44380. for (let i = 0, ii = c0.length; i < ii; ++i) {
  44381. diff.push(c1[i] - c0[i]);
  44382. }
  44383. const length = diff.length;
  44384. return function constructInterpolatedFn(src, srcOffset, dest, destOffset) {
  44385. const x = n === 1 ? src[srcOffset] : src[srcOffset] ** n;
  44386. for (let j = 0; j < length; ++j) {
  44387. dest[destOffset + j] = c0[j] + x * diff[j];
  44388. }
  44389. };
  44390. }
  44391. static constructStiched({
  44392. xref,
  44393. isEvalSupported,
  44394. dict
  44395. }) {
  44396. const domain = toNumberArray(dict.getArray("Domain"));
  44397. if (!domain) {
  44398. throw new _util.FormatError("No domain");
  44399. }
  44400. const inputSize = domain.length / 2;
  44401. if (inputSize !== 1) {
  44402. throw new _util.FormatError("Bad domain for stiched function");
  44403. }
  44404. const fnRefs = dict.get("Functions");
  44405. const fns = [];
  44406. for (let i = 0, ii = fnRefs.length; i < ii; ++i) {
  44407. fns.push(this.parse({
  44408. xref,
  44409. isEvalSupported,
  44410. fn: xref.fetchIfRef(fnRefs[i])
  44411. }));
  44412. }
  44413. const bounds = toNumberArray(dict.getArray("Bounds"));
  44414. const encode = toNumberArray(dict.getArray("Encode"));
  44415. const tmpBuf = new Float32Array(1);
  44416. return function constructStichedFn(src, srcOffset, dest, destOffset) {
  44417. const clip = function constructStichedFromIRClip(v, min, max) {
  44418. if (v > max) {
  44419. v = max;
  44420. } else if (v < min) {
  44421. v = min;
  44422. }
  44423. return v;
  44424. };
  44425. const v = clip(src[srcOffset], domain[0], domain[1]);
  44426. const length = bounds.length;
  44427. let i;
  44428. for (i = 0; i < length; ++i) {
  44429. if (v < bounds[i]) {
  44430. break;
  44431. }
  44432. }
  44433. let dmin = domain[0];
  44434. if (i > 0) {
  44435. dmin = bounds[i - 1];
  44436. }
  44437. let dmax = domain[1];
  44438. if (i < bounds.length) {
  44439. dmax = bounds[i];
  44440. }
  44441. const rmin = encode[2 * i];
  44442. const rmax = encode[2 * i + 1];
  44443. tmpBuf[0] = dmin === dmax ? rmin : rmin + (v - dmin) * (rmax - rmin) / (dmax - dmin);
  44444. fns[i](tmpBuf, 0, dest, destOffset);
  44445. };
  44446. }
  44447. static constructPostScript({
  44448. xref,
  44449. isEvalSupported,
  44450. fn,
  44451. dict
  44452. }) {
  44453. const domain = toNumberArray(dict.getArray("Domain"));
  44454. const range = toNumberArray(dict.getArray("Range"));
  44455. if (!domain) {
  44456. throw new _util.FormatError("No domain.");
  44457. }
  44458. if (!range) {
  44459. throw new _util.FormatError("No range.");
  44460. }
  44461. const lexer = new _ps_parser.PostScriptLexer(fn);
  44462. const parser = new _ps_parser.PostScriptParser(lexer);
  44463. const code = parser.parse();
  44464. if (isEvalSupported && _util.FeatureTest.isEvalSupported) {
  44465. const compiled = new PostScriptCompiler().compile(code, domain, range);
  44466. if (compiled) {
  44467. return new Function("src", "srcOffset", "dest", "destOffset", compiled);
  44468. }
  44469. }
  44470. (0, _util.info)("Unable to compile PS function");
  44471. const numOutputs = range.length >> 1;
  44472. const numInputs = domain.length >> 1;
  44473. const evaluator = new PostScriptEvaluator(code);
  44474. const cache = Object.create(null);
  44475. const MAX_CACHE_SIZE = 2048 * 4;
  44476. let cache_available = MAX_CACHE_SIZE;
  44477. const tmpBuf = new Float32Array(numInputs);
  44478. return function constructPostScriptFn(src, srcOffset, dest, destOffset) {
  44479. let i, value;
  44480. let key = "";
  44481. const input = tmpBuf;
  44482. for (i = 0; i < numInputs; i++) {
  44483. value = src[srcOffset + i];
  44484. input[i] = value;
  44485. key += value + "_";
  44486. }
  44487. const cachedValue = cache[key];
  44488. if (cachedValue !== undefined) {
  44489. dest.set(cachedValue, destOffset);
  44490. return;
  44491. }
  44492. const output = new Float32Array(numOutputs);
  44493. const stack = evaluator.execute(input);
  44494. const stackIndex = stack.length - numOutputs;
  44495. for (i = 0; i < numOutputs; i++) {
  44496. value = stack[stackIndex + i];
  44497. let bound = range[i * 2];
  44498. if (value < bound) {
  44499. value = bound;
  44500. } else {
  44501. bound = range[i * 2 + 1];
  44502. if (value > bound) {
  44503. value = bound;
  44504. }
  44505. }
  44506. output[i] = value;
  44507. }
  44508. if (cache_available > 0) {
  44509. cache_available--;
  44510. cache[key] = output;
  44511. }
  44512. dest.set(output, destOffset);
  44513. };
  44514. }
  44515. }
  44516. function isPDFFunction(v) {
  44517. let fnDict;
  44518. if (typeof v !== "object") {
  44519. return false;
  44520. } else if (v instanceof _primitives.Dict) {
  44521. fnDict = v;
  44522. } else if (v instanceof _base_stream.BaseStream) {
  44523. fnDict = v.dict;
  44524. } else {
  44525. return false;
  44526. }
  44527. return fnDict.has("FunctionType");
  44528. }
  44529. class PostScriptStack {
  44530. static get MAX_STACK_SIZE() {
  44531. return (0, _util.shadow)(this, "MAX_STACK_SIZE", 100);
  44532. }
  44533. constructor(initialStack) {
  44534. this.stack = !initialStack ? [] : Array.prototype.slice.call(initialStack, 0);
  44535. }
  44536. push(value) {
  44537. if (this.stack.length >= PostScriptStack.MAX_STACK_SIZE) {
  44538. throw new Error("PostScript function stack overflow.");
  44539. }
  44540. this.stack.push(value);
  44541. }
  44542. pop() {
  44543. if (this.stack.length <= 0) {
  44544. throw new Error("PostScript function stack underflow.");
  44545. }
  44546. return this.stack.pop();
  44547. }
  44548. copy(n) {
  44549. if (this.stack.length + n >= PostScriptStack.MAX_STACK_SIZE) {
  44550. throw new Error("PostScript function stack overflow.");
  44551. }
  44552. const stack = this.stack;
  44553. for (let i = stack.length - n, j = n - 1; j >= 0; j--, i++) {
  44554. stack.push(stack[i]);
  44555. }
  44556. }
  44557. index(n) {
  44558. this.push(this.stack[this.stack.length - n - 1]);
  44559. }
  44560. roll(n, p) {
  44561. const stack = this.stack;
  44562. const l = stack.length - n;
  44563. const r = stack.length - 1;
  44564. const c = l + (p - Math.floor(p / n) * n);
  44565. for (let i = l, j = r; i < j; i++, j--) {
  44566. const t = stack[i];
  44567. stack[i] = stack[j];
  44568. stack[j] = t;
  44569. }
  44570. for (let i = l, j = c - 1; i < j; i++, j--) {
  44571. const t = stack[i];
  44572. stack[i] = stack[j];
  44573. stack[j] = t;
  44574. }
  44575. for (let i = c, j = r; i < j; i++, j--) {
  44576. const t = stack[i];
  44577. stack[i] = stack[j];
  44578. stack[j] = t;
  44579. }
  44580. }
  44581. }
  44582. class PostScriptEvaluator {
  44583. constructor(operators) {
  44584. this.operators = operators;
  44585. }
  44586. execute(initialStack) {
  44587. const stack = new PostScriptStack(initialStack);
  44588. let counter = 0;
  44589. const operators = this.operators;
  44590. const length = operators.length;
  44591. let operator, a, b;
  44592. while (counter < length) {
  44593. operator = operators[counter++];
  44594. if (typeof operator === "number") {
  44595. stack.push(operator);
  44596. continue;
  44597. }
  44598. switch (operator) {
  44599. case "jz":
  44600. b = stack.pop();
  44601. a = stack.pop();
  44602. if (!a) {
  44603. counter = b;
  44604. }
  44605. break;
  44606. case "j":
  44607. a = stack.pop();
  44608. counter = a;
  44609. break;
  44610. case "abs":
  44611. a = stack.pop();
  44612. stack.push(Math.abs(a));
  44613. break;
  44614. case "add":
  44615. b = stack.pop();
  44616. a = stack.pop();
  44617. stack.push(a + b);
  44618. break;
  44619. case "and":
  44620. b = stack.pop();
  44621. a = stack.pop();
  44622. if (typeof a === "boolean" && typeof b === "boolean") {
  44623. stack.push(a && b);
  44624. } else {
  44625. stack.push(a & b);
  44626. }
  44627. break;
  44628. case "atan":
  44629. a = stack.pop();
  44630. stack.push(Math.atan(a));
  44631. break;
  44632. case "bitshift":
  44633. b = stack.pop();
  44634. a = stack.pop();
  44635. if (a > 0) {
  44636. stack.push(a << b);
  44637. } else {
  44638. stack.push(a >> b);
  44639. }
  44640. break;
  44641. case "ceiling":
  44642. a = stack.pop();
  44643. stack.push(Math.ceil(a));
  44644. break;
  44645. case "copy":
  44646. a = stack.pop();
  44647. stack.copy(a);
  44648. break;
  44649. case "cos":
  44650. a = stack.pop();
  44651. stack.push(Math.cos(a));
  44652. break;
  44653. case "cvi":
  44654. a = stack.pop() | 0;
  44655. stack.push(a);
  44656. break;
  44657. case "cvr":
  44658. break;
  44659. case "div":
  44660. b = stack.pop();
  44661. a = stack.pop();
  44662. stack.push(a / b);
  44663. break;
  44664. case "dup":
  44665. stack.copy(1);
  44666. break;
  44667. case "eq":
  44668. b = stack.pop();
  44669. a = stack.pop();
  44670. stack.push(a === b);
  44671. break;
  44672. case "exch":
  44673. stack.roll(2, 1);
  44674. break;
  44675. case "exp":
  44676. b = stack.pop();
  44677. a = stack.pop();
  44678. stack.push(a ** b);
  44679. break;
  44680. case "false":
  44681. stack.push(false);
  44682. break;
  44683. case "floor":
  44684. a = stack.pop();
  44685. stack.push(Math.floor(a));
  44686. break;
  44687. case "ge":
  44688. b = stack.pop();
  44689. a = stack.pop();
  44690. stack.push(a >= b);
  44691. break;
  44692. case "gt":
  44693. b = stack.pop();
  44694. a = stack.pop();
  44695. stack.push(a > b);
  44696. break;
  44697. case "idiv":
  44698. b = stack.pop();
  44699. a = stack.pop();
  44700. stack.push(a / b | 0);
  44701. break;
  44702. case "index":
  44703. a = stack.pop();
  44704. stack.index(a);
  44705. break;
  44706. case "le":
  44707. b = stack.pop();
  44708. a = stack.pop();
  44709. stack.push(a <= b);
  44710. break;
  44711. case "ln":
  44712. a = stack.pop();
  44713. stack.push(Math.log(a));
  44714. break;
  44715. case "log":
  44716. a = stack.pop();
  44717. stack.push(Math.log(a) / Math.LN10);
  44718. break;
  44719. case "lt":
  44720. b = stack.pop();
  44721. a = stack.pop();
  44722. stack.push(a < b);
  44723. break;
  44724. case "mod":
  44725. b = stack.pop();
  44726. a = stack.pop();
  44727. stack.push(a % b);
  44728. break;
  44729. case "mul":
  44730. b = stack.pop();
  44731. a = stack.pop();
  44732. stack.push(a * b);
  44733. break;
  44734. case "ne":
  44735. b = stack.pop();
  44736. a = stack.pop();
  44737. stack.push(a !== b);
  44738. break;
  44739. case "neg":
  44740. a = stack.pop();
  44741. stack.push(-a);
  44742. break;
  44743. case "not":
  44744. a = stack.pop();
  44745. if (typeof a === "boolean") {
  44746. stack.push(!a);
  44747. } else {
  44748. stack.push(~a);
  44749. }
  44750. break;
  44751. case "or":
  44752. b = stack.pop();
  44753. a = stack.pop();
  44754. if (typeof a === "boolean" && typeof b === "boolean") {
  44755. stack.push(a || b);
  44756. } else {
  44757. stack.push(a | b);
  44758. }
  44759. break;
  44760. case "pop":
  44761. stack.pop();
  44762. break;
  44763. case "roll":
  44764. b = stack.pop();
  44765. a = stack.pop();
  44766. stack.roll(a, b);
  44767. break;
  44768. case "round":
  44769. a = stack.pop();
  44770. stack.push(Math.round(a));
  44771. break;
  44772. case "sin":
  44773. a = stack.pop();
  44774. stack.push(Math.sin(a));
  44775. break;
  44776. case "sqrt":
  44777. a = stack.pop();
  44778. stack.push(Math.sqrt(a));
  44779. break;
  44780. case "sub":
  44781. b = stack.pop();
  44782. a = stack.pop();
  44783. stack.push(a - b);
  44784. break;
  44785. case "true":
  44786. stack.push(true);
  44787. break;
  44788. case "truncate":
  44789. a = stack.pop();
  44790. a = a < 0 ? Math.ceil(a) : Math.floor(a);
  44791. stack.push(a);
  44792. break;
  44793. case "xor":
  44794. b = stack.pop();
  44795. a = stack.pop();
  44796. if (typeof a === "boolean" && typeof b === "boolean") {
  44797. stack.push(a !== b);
  44798. } else {
  44799. stack.push(a ^ b);
  44800. }
  44801. break;
  44802. default:
  44803. throw new _util.FormatError(`Unknown operator ${operator}`);
  44804. }
  44805. }
  44806. return stack.stack;
  44807. }
  44808. }
  44809. exports.PostScriptEvaluator = PostScriptEvaluator;
  44810. const PostScriptCompiler = function PostScriptCompilerClosure() {
  44811. class AstNode {
  44812. constructor(type) {
  44813. this.type = type;
  44814. }
  44815. visit(visitor) {
  44816. (0, _util.unreachable)("abstract method");
  44817. }
  44818. }
  44819. class AstArgument extends AstNode {
  44820. constructor(index, min, max) {
  44821. super("args");
  44822. this.index = index;
  44823. this.min = min;
  44824. this.max = max;
  44825. }
  44826. visit(visitor) {
  44827. visitor.visitArgument(this);
  44828. }
  44829. }
  44830. class AstLiteral extends AstNode {
  44831. constructor(number) {
  44832. super("literal");
  44833. this.number = number;
  44834. this.min = number;
  44835. this.max = number;
  44836. }
  44837. visit(visitor) {
  44838. visitor.visitLiteral(this);
  44839. }
  44840. }
  44841. class AstBinaryOperation extends AstNode {
  44842. constructor(op, arg1, arg2, min, max) {
  44843. super("binary");
  44844. this.op = op;
  44845. this.arg1 = arg1;
  44846. this.arg2 = arg2;
  44847. this.min = min;
  44848. this.max = max;
  44849. }
  44850. visit(visitor) {
  44851. visitor.visitBinaryOperation(this);
  44852. }
  44853. }
  44854. class AstMin extends AstNode {
  44855. constructor(arg, max) {
  44856. super("max");
  44857. this.arg = arg;
  44858. this.min = arg.min;
  44859. this.max = max;
  44860. }
  44861. visit(visitor) {
  44862. visitor.visitMin(this);
  44863. }
  44864. }
  44865. class AstVariable extends AstNode {
  44866. constructor(index, min, max) {
  44867. super("var");
  44868. this.index = index;
  44869. this.min = min;
  44870. this.max = max;
  44871. }
  44872. visit(visitor) {
  44873. visitor.visitVariable(this);
  44874. }
  44875. }
  44876. class AstVariableDefinition extends AstNode {
  44877. constructor(variable, arg) {
  44878. super("definition");
  44879. this.variable = variable;
  44880. this.arg = arg;
  44881. }
  44882. visit(visitor) {
  44883. visitor.visitVariableDefinition(this);
  44884. }
  44885. }
  44886. class ExpressionBuilderVisitor {
  44887. constructor() {
  44888. this.parts = [];
  44889. }
  44890. visitArgument(arg) {
  44891. this.parts.push("Math.max(", arg.min, ", Math.min(", arg.max, ", src[srcOffset + ", arg.index, "]))");
  44892. }
  44893. visitVariable(variable) {
  44894. this.parts.push("v", variable.index);
  44895. }
  44896. visitLiteral(literal) {
  44897. this.parts.push(literal.number);
  44898. }
  44899. visitBinaryOperation(operation) {
  44900. this.parts.push("(");
  44901. operation.arg1.visit(this);
  44902. this.parts.push(" ", operation.op, " ");
  44903. operation.arg2.visit(this);
  44904. this.parts.push(")");
  44905. }
  44906. visitVariableDefinition(definition) {
  44907. this.parts.push("var ");
  44908. definition.variable.visit(this);
  44909. this.parts.push(" = ");
  44910. definition.arg.visit(this);
  44911. this.parts.push(";");
  44912. }
  44913. visitMin(max) {
  44914. this.parts.push("Math.min(");
  44915. max.arg.visit(this);
  44916. this.parts.push(", ", max.max, ")");
  44917. }
  44918. toString() {
  44919. return this.parts.join("");
  44920. }
  44921. }
  44922. function buildAddOperation(num1, num2) {
  44923. if (num2.type === "literal" && num2.number === 0) {
  44924. return num1;
  44925. }
  44926. if (num1.type === "literal" && num1.number === 0) {
  44927. return num2;
  44928. }
  44929. if (num2.type === "literal" && num1.type === "literal") {
  44930. return new AstLiteral(num1.number + num2.number);
  44931. }
  44932. return new AstBinaryOperation("+", num1, num2, num1.min + num2.min, num1.max + num2.max);
  44933. }
  44934. function buildMulOperation(num1, num2) {
  44935. if (num2.type === "literal") {
  44936. if (num2.number === 0) {
  44937. return new AstLiteral(0);
  44938. } else if (num2.number === 1) {
  44939. return num1;
  44940. } else if (num1.type === "literal") {
  44941. return new AstLiteral(num1.number * num2.number);
  44942. }
  44943. }
  44944. if (num1.type === "literal") {
  44945. if (num1.number === 0) {
  44946. return new AstLiteral(0);
  44947. } else if (num1.number === 1) {
  44948. return num2;
  44949. }
  44950. }
  44951. const min = Math.min(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
  44952. const max = Math.max(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
  44953. return new AstBinaryOperation("*", num1, num2, min, max);
  44954. }
  44955. function buildSubOperation(num1, num2) {
  44956. if (num2.type === "literal") {
  44957. if (num2.number === 0) {
  44958. return num1;
  44959. } else if (num1.type === "literal") {
  44960. return new AstLiteral(num1.number - num2.number);
  44961. }
  44962. }
  44963. if (num2.type === "binary" && num2.op === "-" && num1.type === "literal" && num1.number === 1 && num2.arg1.type === "literal" && num2.arg1.number === 1) {
  44964. return num2.arg2;
  44965. }
  44966. return new AstBinaryOperation("-", num1, num2, num1.min - num2.max, num1.max - num2.min);
  44967. }
  44968. function buildMinOperation(num1, max) {
  44969. if (num1.min >= max) {
  44970. return new AstLiteral(max);
  44971. } else if (num1.max <= max) {
  44972. return num1;
  44973. }
  44974. return new AstMin(num1, max);
  44975. }
  44976. class PostScriptCompiler {
  44977. compile(code, domain, range) {
  44978. const stack = [];
  44979. const instructions = [];
  44980. const inputSize = domain.length >> 1,
  44981. outputSize = range.length >> 1;
  44982. let lastRegister = 0;
  44983. let n, j;
  44984. let num1, num2, ast1, ast2, tmpVar, item;
  44985. for (let i = 0; i < inputSize; i++) {
  44986. stack.push(new AstArgument(i, domain[i * 2], domain[i * 2 + 1]));
  44987. }
  44988. for (let i = 0, ii = code.length; i < ii; i++) {
  44989. item = code[i];
  44990. if (typeof item === "number") {
  44991. stack.push(new AstLiteral(item));
  44992. continue;
  44993. }
  44994. switch (item) {
  44995. case "add":
  44996. if (stack.length < 2) {
  44997. return null;
  44998. }
  44999. num2 = stack.pop();
  45000. num1 = stack.pop();
  45001. stack.push(buildAddOperation(num1, num2));
  45002. break;
  45003. case "cvr":
  45004. if (stack.length < 1) {
  45005. return null;
  45006. }
  45007. break;
  45008. case "mul":
  45009. if (stack.length < 2) {
  45010. return null;
  45011. }
  45012. num2 = stack.pop();
  45013. num1 = stack.pop();
  45014. stack.push(buildMulOperation(num1, num2));
  45015. break;
  45016. case "sub":
  45017. if (stack.length < 2) {
  45018. return null;
  45019. }
  45020. num2 = stack.pop();
  45021. num1 = stack.pop();
  45022. stack.push(buildSubOperation(num1, num2));
  45023. break;
  45024. case "exch":
  45025. if (stack.length < 2) {
  45026. return null;
  45027. }
  45028. ast1 = stack.pop();
  45029. ast2 = stack.pop();
  45030. stack.push(ast1, ast2);
  45031. break;
  45032. case "pop":
  45033. if (stack.length < 1) {
  45034. return null;
  45035. }
  45036. stack.pop();
  45037. break;
  45038. case "index":
  45039. if (stack.length < 1) {
  45040. return null;
  45041. }
  45042. num1 = stack.pop();
  45043. if (num1.type !== "literal") {
  45044. return null;
  45045. }
  45046. n = num1.number;
  45047. if (n < 0 || !Number.isInteger(n) || stack.length < n) {
  45048. return null;
  45049. }
  45050. ast1 = stack[stack.length - n - 1];
  45051. if (ast1.type === "literal" || ast1.type === "var") {
  45052. stack.push(ast1);
  45053. break;
  45054. }
  45055. tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
  45056. stack[stack.length - n - 1] = tmpVar;
  45057. stack.push(tmpVar);
  45058. instructions.push(new AstVariableDefinition(tmpVar, ast1));
  45059. break;
  45060. case "dup":
  45061. if (stack.length < 1) {
  45062. return null;
  45063. }
  45064. 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]) {
  45065. num1 = stack.pop();
  45066. stack.push(buildMinOperation(num1, code[i + 1]));
  45067. i += 6;
  45068. break;
  45069. }
  45070. ast1 = stack.at(-1);
  45071. if (ast1.type === "literal" || ast1.type === "var") {
  45072. stack.push(ast1);
  45073. break;
  45074. }
  45075. tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
  45076. stack[stack.length - 1] = tmpVar;
  45077. stack.push(tmpVar);
  45078. instructions.push(new AstVariableDefinition(tmpVar, ast1));
  45079. break;
  45080. case "roll":
  45081. if (stack.length < 2) {
  45082. return null;
  45083. }
  45084. num2 = stack.pop();
  45085. num1 = stack.pop();
  45086. if (num2.type !== "literal" || num1.type !== "literal") {
  45087. return null;
  45088. }
  45089. j = num2.number;
  45090. n = num1.number;
  45091. if (n <= 0 || !Number.isInteger(n) || !Number.isInteger(j) || stack.length < n) {
  45092. return null;
  45093. }
  45094. j = (j % n + n) % n;
  45095. if (j === 0) {
  45096. break;
  45097. }
  45098. Array.prototype.push.apply(stack, stack.splice(stack.length - n, n - j));
  45099. break;
  45100. default:
  45101. return null;
  45102. }
  45103. }
  45104. if (stack.length !== outputSize) {
  45105. return null;
  45106. }
  45107. const result = [];
  45108. for (const instruction of instructions) {
  45109. const statementBuilder = new ExpressionBuilderVisitor();
  45110. instruction.visit(statementBuilder);
  45111. result.push(statementBuilder.toString());
  45112. }
  45113. for (let i = 0, ii = stack.length; i < ii; i++) {
  45114. const expr = stack[i],
  45115. statementBuilder = new ExpressionBuilderVisitor();
  45116. expr.visit(statementBuilder);
  45117. const min = range[i * 2],
  45118. max = range[i * 2 + 1];
  45119. const out = [statementBuilder.toString()];
  45120. if (min > expr.min) {
  45121. out.unshift("Math.max(", min, ", ");
  45122. out.push(")");
  45123. }
  45124. if (max < expr.max) {
  45125. out.unshift("Math.min(", max, ", ");
  45126. out.push(")");
  45127. }
  45128. out.unshift("dest[destOffset + ", i, "] = ");
  45129. out.push(";");
  45130. result.push(out.join(""));
  45131. }
  45132. return result.join("\n");
  45133. }
  45134. }
  45135. return PostScriptCompiler;
  45136. }();
  45137. exports.PostScriptCompiler = PostScriptCompiler;
  45138. /***/ }),
  45139. /* 58 */
  45140. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  45141. Object.defineProperty(exports, "__esModule", ({
  45142. value: true
  45143. }));
  45144. exports.PostScriptParser = exports.PostScriptLexer = void 0;
  45145. var _util = __w_pdfjs_require__(2);
  45146. var _primitives = __w_pdfjs_require__(5);
  45147. var _core_utils = __w_pdfjs_require__(6);
  45148. class PostScriptParser {
  45149. constructor(lexer) {
  45150. this.lexer = lexer;
  45151. this.operators = [];
  45152. this.token = null;
  45153. this.prev = null;
  45154. }
  45155. nextToken() {
  45156. this.prev = this.token;
  45157. this.token = this.lexer.getToken();
  45158. }
  45159. accept(type) {
  45160. if (this.token.type === type) {
  45161. this.nextToken();
  45162. return true;
  45163. }
  45164. return false;
  45165. }
  45166. expect(type) {
  45167. if (this.accept(type)) {
  45168. return true;
  45169. }
  45170. throw new _util.FormatError(`Unexpected symbol: found ${this.token.type} expected ${type}.`);
  45171. }
  45172. parse() {
  45173. this.nextToken();
  45174. this.expect(PostScriptTokenTypes.LBRACE);
  45175. this.parseBlock();
  45176. this.expect(PostScriptTokenTypes.RBRACE);
  45177. return this.operators;
  45178. }
  45179. parseBlock() {
  45180. while (true) {
  45181. if (this.accept(PostScriptTokenTypes.NUMBER)) {
  45182. this.operators.push(this.prev.value);
  45183. } else if (this.accept(PostScriptTokenTypes.OPERATOR)) {
  45184. this.operators.push(this.prev.value);
  45185. } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
  45186. this.parseCondition();
  45187. } else {
  45188. return;
  45189. }
  45190. }
  45191. }
  45192. parseCondition() {
  45193. const conditionLocation = this.operators.length;
  45194. this.operators.push(null, null);
  45195. this.parseBlock();
  45196. this.expect(PostScriptTokenTypes.RBRACE);
  45197. if (this.accept(PostScriptTokenTypes.IF)) {
  45198. this.operators[conditionLocation] = this.operators.length;
  45199. this.operators[conditionLocation + 1] = "jz";
  45200. } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
  45201. const jumpLocation = this.operators.length;
  45202. this.operators.push(null, null);
  45203. const endOfTrue = this.operators.length;
  45204. this.parseBlock();
  45205. this.expect(PostScriptTokenTypes.RBRACE);
  45206. this.expect(PostScriptTokenTypes.IFELSE);
  45207. this.operators[jumpLocation] = this.operators.length;
  45208. this.operators[jumpLocation + 1] = "j";
  45209. this.operators[conditionLocation] = endOfTrue;
  45210. this.operators[conditionLocation + 1] = "jz";
  45211. } else {
  45212. throw new _util.FormatError("PS Function: error parsing conditional.");
  45213. }
  45214. }
  45215. }
  45216. exports.PostScriptParser = PostScriptParser;
  45217. const PostScriptTokenTypes = {
  45218. LBRACE: 0,
  45219. RBRACE: 1,
  45220. NUMBER: 2,
  45221. OPERATOR: 3,
  45222. IF: 4,
  45223. IFELSE: 5
  45224. };
  45225. class PostScriptToken {
  45226. static get opCache() {
  45227. return (0, _util.shadow)(this, "opCache", Object.create(null));
  45228. }
  45229. constructor(type, value) {
  45230. this.type = type;
  45231. this.value = value;
  45232. }
  45233. static getOperator(op) {
  45234. const opValue = PostScriptToken.opCache[op];
  45235. if (opValue) {
  45236. return opValue;
  45237. }
  45238. return PostScriptToken.opCache[op] = new PostScriptToken(PostScriptTokenTypes.OPERATOR, op);
  45239. }
  45240. static get LBRACE() {
  45241. return (0, _util.shadow)(this, "LBRACE", new PostScriptToken(PostScriptTokenTypes.LBRACE, "{"));
  45242. }
  45243. static get RBRACE() {
  45244. return (0, _util.shadow)(this, "RBRACE", new PostScriptToken(PostScriptTokenTypes.RBRACE, "}"));
  45245. }
  45246. static get IF() {
  45247. return (0, _util.shadow)(this, "IF", new PostScriptToken(PostScriptTokenTypes.IF, "IF"));
  45248. }
  45249. static get IFELSE() {
  45250. return (0, _util.shadow)(this, "IFELSE", new PostScriptToken(PostScriptTokenTypes.IFELSE, "IFELSE"));
  45251. }
  45252. }
  45253. class PostScriptLexer {
  45254. constructor(stream) {
  45255. this.stream = stream;
  45256. this.nextChar();
  45257. this.strBuf = [];
  45258. }
  45259. nextChar() {
  45260. return this.currentChar = this.stream.getByte();
  45261. }
  45262. getToken() {
  45263. let comment = false;
  45264. let ch = this.currentChar;
  45265. while (true) {
  45266. if (ch < 0) {
  45267. return _primitives.EOF;
  45268. }
  45269. if (comment) {
  45270. if (ch === 0x0a || ch === 0x0d) {
  45271. comment = false;
  45272. }
  45273. } else if (ch === 0x25) {
  45274. comment = true;
  45275. } else if (!(0, _core_utils.isWhiteSpace)(ch)) {
  45276. break;
  45277. }
  45278. ch = this.nextChar();
  45279. }
  45280. switch (ch | 0) {
  45281. case 0x30:
  45282. case 0x31:
  45283. case 0x32:
  45284. case 0x33:
  45285. case 0x34:
  45286. case 0x35:
  45287. case 0x36:
  45288. case 0x37:
  45289. case 0x38:
  45290. case 0x39:
  45291. case 0x2b:
  45292. case 0x2d:
  45293. case 0x2e:
  45294. return new PostScriptToken(PostScriptTokenTypes.NUMBER, this.getNumber());
  45295. case 0x7b:
  45296. this.nextChar();
  45297. return PostScriptToken.LBRACE;
  45298. case 0x7d:
  45299. this.nextChar();
  45300. return PostScriptToken.RBRACE;
  45301. }
  45302. const strBuf = this.strBuf;
  45303. strBuf.length = 0;
  45304. strBuf[0] = String.fromCharCode(ch);
  45305. while ((ch = this.nextChar()) >= 0 && (ch >= 0x41 && ch <= 0x5a || ch >= 0x61 && ch <= 0x7a)) {
  45306. strBuf.push(String.fromCharCode(ch));
  45307. }
  45308. const str = strBuf.join("");
  45309. switch (str.toLowerCase()) {
  45310. case "if":
  45311. return PostScriptToken.IF;
  45312. case "ifelse":
  45313. return PostScriptToken.IFELSE;
  45314. default:
  45315. return PostScriptToken.getOperator(str);
  45316. }
  45317. }
  45318. getNumber() {
  45319. let ch = this.currentChar;
  45320. const strBuf = this.strBuf;
  45321. strBuf.length = 0;
  45322. strBuf[0] = String.fromCharCode(ch);
  45323. while ((ch = this.nextChar()) >= 0) {
  45324. if (ch >= 0x30 && ch <= 0x39 || ch === 0x2d || ch === 0x2e) {
  45325. strBuf.push(String.fromCharCode(ch));
  45326. } else {
  45327. break;
  45328. }
  45329. }
  45330. const value = parseFloat(strBuf.join(""));
  45331. if (isNaN(value)) {
  45332. throw new _util.FormatError(`Invalid floating point number: ${value}`);
  45333. }
  45334. return value;
  45335. }
  45336. }
  45337. exports.PostScriptLexer = PostScriptLexer;
  45338. /***/ }),
  45339. /* 59 */
  45340. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  45341. Object.defineProperty(exports, "__esModule", ({
  45342. value: true
  45343. }));
  45344. exports.LocalTilingPatternCache = exports.LocalImageCache = exports.LocalGStateCache = exports.LocalFunctionCache = exports.LocalColorSpaceCache = exports.GlobalImageCache = void 0;
  45345. var _util = __w_pdfjs_require__(2);
  45346. var _primitives = __w_pdfjs_require__(5);
  45347. class BaseLocalCache {
  45348. constructor(options) {
  45349. if (this.constructor === BaseLocalCache) {
  45350. (0, _util.unreachable)("Cannot initialize BaseLocalCache.");
  45351. }
  45352. this._onlyRefs = (options && options.onlyRefs) === true;
  45353. if (!this._onlyRefs) {
  45354. this._nameRefMap = new Map();
  45355. this._imageMap = new Map();
  45356. }
  45357. this._imageCache = new _primitives.RefSetCache();
  45358. }
  45359. getByName(name) {
  45360. if (this._onlyRefs) {
  45361. (0, _util.unreachable)("Should not call `getByName` method.");
  45362. }
  45363. const ref = this._nameRefMap.get(name);
  45364. if (ref) {
  45365. return this.getByRef(ref);
  45366. }
  45367. return this._imageMap.get(name) || null;
  45368. }
  45369. getByRef(ref) {
  45370. return this._imageCache.get(ref) || null;
  45371. }
  45372. set(name, ref, data) {
  45373. (0, _util.unreachable)("Abstract method `set` called.");
  45374. }
  45375. }
  45376. class LocalImageCache extends BaseLocalCache {
  45377. set(name, ref = null, data) {
  45378. if (typeof name !== "string") {
  45379. throw new Error('LocalImageCache.set - expected "name" argument.');
  45380. }
  45381. if (ref) {
  45382. if (this._imageCache.has(ref)) {
  45383. return;
  45384. }
  45385. this._nameRefMap.set(name, ref);
  45386. this._imageCache.put(ref, data);
  45387. return;
  45388. }
  45389. if (this._imageMap.has(name)) {
  45390. return;
  45391. }
  45392. this._imageMap.set(name, data);
  45393. }
  45394. }
  45395. exports.LocalImageCache = LocalImageCache;
  45396. class LocalColorSpaceCache extends BaseLocalCache {
  45397. set(name = null, ref = null, data) {
  45398. if (typeof name !== "string" && !ref) {
  45399. throw new Error('LocalColorSpaceCache.set - expected "name" and/or "ref" argument.');
  45400. }
  45401. if (ref) {
  45402. if (this._imageCache.has(ref)) {
  45403. return;
  45404. }
  45405. if (name !== null) {
  45406. this._nameRefMap.set(name, ref);
  45407. }
  45408. this._imageCache.put(ref, data);
  45409. return;
  45410. }
  45411. if (this._imageMap.has(name)) {
  45412. return;
  45413. }
  45414. this._imageMap.set(name, data);
  45415. }
  45416. }
  45417. exports.LocalColorSpaceCache = LocalColorSpaceCache;
  45418. class LocalFunctionCache extends BaseLocalCache {
  45419. constructor(options) {
  45420. super({
  45421. onlyRefs: true
  45422. });
  45423. }
  45424. set(name = null, ref, data) {
  45425. if (!ref) {
  45426. throw new Error('LocalFunctionCache.set - expected "ref" argument.');
  45427. }
  45428. if (this._imageCache.has(ref)) {
  45429. return;
  45430. }
  45431. this._imageCache.put(ref, data);
  45432. }
  45433. }
  45434. exports.LocalFunctionCache = LocalFunctionCache;
  45435. class LocalGStateCache extends BaseLocalCache {
  45436. set(name, ref = null, data) {
  45437. if (typeof name !== "string") {
  45438. throw new Error('LocalGStateCache.set - expected "name" argument.');
  45439. }
  45440. if (ref) {
  45441. if (this._imageCache.has(ref)) {
  45442. return;
  45443. }
  45444. this._nameRefMap.set(name, ref);
  45445. this._imageCache.put(ref, data);
  45446. return;
  45447. }
  45448. if (this._imageMap.has(name)) {
  45449. return;
  45450. }
  45451. this._imageMap.set(name, data);
  45452. }
  45453. }
  45454. exports.LocalGStateCache = LocalGStateCache;
  45455. class LocalTilingPatternCache extends BaseLocalCache {
  45456. constructor(options) {
  45457. super({
  45458. onlyRefs: true
  45459. });
  45460. }
  45461. set(name = null, ref, data) {
  45462. if (!ref) {
  45463. throw new Error('LocalTilingPatternCache.set - expected "ref" argument.');
  45464. }
  45465. if (this._imageCache.has(ref)) {
  45466. return;
  45467. }
  45468. this._imageCache.put(ref, data);
  45469. }
  45470. }
  45471. exports.LocalTilingPatternCache = LocalTilingPatternCache;
  45472. class GlobalImageCache {
  45473. static get NUM_PAGES_THRESHOLD() {
  45474. return (0, _util.shadow)(this, "NUM_PAGES_THRESHOLD", 2);
  45475. }
  45476. static get MIN_IMAGES_TO_CACHE() {
  45477. return (0, _util.shadow)(this, "MIN_IMAGES_TO_CACHE", 10);
  45478. }
  45479. static get MAX_BYTE_SIZE() {
  45480. return (0, _util.shadow)(this, "MAX_BYTE_SIZE", 40e6);
  45481. }
  45482. constructor() {
  45483. this._refCache = new _primitives.RefSetCache();
  45484. this._imageCache = new _primitives.RefSetCache();
  45485. }
  45486. get _byteSize() {
  45487. let byteSize = 0;
  45488. for (const imageData of this._imageCache) {
  45489. byteSize += imageData.byteSize;
  45490. }
  45491. return byteSize;
  45492. }
  45493. get _cacheLimitReached() {
  45494. if (this._imageCache.size < GlobalImageCache.MIN_IMAGES_TO_CACHE) {
  45495. return false;
  45496. }
  45497. if (this._byteSize < GlobalImageCache.MAX_BYTE_SIZE) {
  45498. return false;
  45499. }
  45500. return true;
  45501. }
  45502. shouldCache(ref, pageIndex) {
  45503. const pageIndexSet = this._refCache.get(ref);
  45504. const numPages = pageIndexSet ? pageIndexSet.size + (pageIndexSet.has(pageIndex) ? 0 : 1) : 1;
  45505. if (numPages < GlobalImageCache.NUM_PAGES_THRESHOLD) {
  45506. return false;
  45507. }
  45508. if (!this._imageCache.has(ref) && this._cacheLimitReached) {
  45509. return false;
  45510. }
  45511. return true;
  45512. }
  45513. addPageIndex(ref, pageIndex) {
  45514. let pageIndexSet = this._refCache.get(ref);
  45515. if (!pageIndexSet) {
  45516. pageIndexSet = new Set();
  45517. this._refCache.put(ref, pageIndexSet);
  45518. }
  45519. pageIndexSet.add(pageIndex);
  45520. }
  45521. addByteSize(ref, byteSize) {
  45522. const imageData = this._imageCache.get(ref);
  45523. if (!imageData) {
  45524. return;
  45525. }
  45526. if (imageData.byteSize) {
  45527. return;
  45528. }
  45529. imageData.byteSize = byteSize;
  45530. }
  45531. getData(ref, pageIndex) {
  45532. const pageIndexSet = this._refCache.get(ref);
  45533. if (!pageIndexSet) {
  45534. return null;
  45535. }
  45536. if (pageIndexSet.size < GlobalImageCache.NUM_PAGES_THRESHOLD) {
  45537. return null;
  45538. }
  45539. const imageData = this._imageCache.get(ref);
  45540. if (!imageData) {
  45541. return null;
  45542. }
  45543. pageIndexSet.add(pageIndex);
  45544. return imageData;
  45545. }
  45546. setData(ref, data) {
  45547. if (!this._refCache.has(ref)) {
  45548. throw new Error('GlobalImageCache.setData - expected "addPageIndex" to have been called.');
  45549. }
  45550. if (this._imageCache.has(ref)) {
  45551. return;
  45552. }
  45553. if (this._cacheLimitReached) {
  45554. (0, _util.warn)("GlobalImageCache.setData - cache limit reached.");
  45555. return;
  45556. }
  45557. this._imageCache.put(ref, data);
  45558. }
  45559. clear(onlyData = false) {
  45560. if (!onlyData) {
  45561. this._refCache.clear();
  45562. }
  45563. this._imageCache.clear();
  45564. }
  45565. }
  45566. exports.GlobalImageCache = GlobalImageCache;
  45567. /***/ }),
  45568. /* 60 */
  45569. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  45570. Object.defineProperty(exports, "__esModule", ({
  45571. value: true
  45572. }));
  45573. exports.bidi = bidi;
  45574. var _util = __w_pdfjs_require__(2);
  45575. 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"];
  45576. 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"];
  45577. function isOdd(i) {
  45578. return (i & 1) !== 0;
  45579. }
  45580. function isEven(i) {
  45581. return (i & 1) === 0;
  45582. }
  45583. function findUnequal(arr, start, value) {
  45584. let j, jj;
  45585. for (j = start, jj = arr.length; j < jj; ++j) {
  45586. if (arr[j] !== value) {
  45587. return j;
  45588. }
  45589. }
  45590. return j;
  45591. }
  45592. function setValues(arr, start, end, value) {
  45593. for (let j = start; j < end; ++j) {
  45594. arr[j] = value;
  45595. }
  45596. }
  45597. function reverseValues(arr, start, end) {
  45598. for (let i = start, j = end - 1; i < j; ++i, --j) {
  45599. const temp = arr[i];
  45600. arr[i] = arr[j];
  45601. arr[j] = temp;
  45602. }
  45603. }
  45604. function createBidiText(str, isLTR, vertical = false) {
  45605. let dir = "ltr";
  45606. if (vertical) {
  45607. dir = "ttb";
  45608. } else if (!isLTR) {
  45609. dir = "rtl";
  45610. }
  45611. return {
  45612. str,
  45613. dir
  45614. };
  45615. }
  45616. const chars = [];
  45617. const types = [];
  45618. function bidi(str, startLevel = -1, vertical = false) {
  45619. let isLTR = true;
  45620. const strLength = str.length;
  45621. if (strLength === 0 || vertical) {
  45622. return createBidiText(str, isLTR, vertical);
  45623. }
  45624. chars.length = strLength;
  45625. types.length = strLength;
  45626. let numBidi = 0;
  45627. let i, ii;
  45628. for (i = 0; i < strLength; ++i) {
  45629. chars[i] = str.charAt(i);
  45630. const charCode = str.charCodeAt(i);
  45631. let charType = "L";
  45632. if (charCode <= 0x00ff) {
  45633. charType = baseTypes[charCode];
  45634. } else if (0x0590 <= charCode && charCode <= 0x05f4) {
  45635. charType = "R";
  45636. } else if (0x0600 <= charCode && charCode <= 0x06ff) {
  45637. charType = arabicTypes[charCode & 0xff];
  45638. if (!charType) {
  45639. (0, _util.warn)("Bidi: invalid Unicode character " + charCode.toString(16));
  45640. }
  45641. } else if (0x0700 <= charCode && charCode <= 0x08ac) {
  45642. charType = "AL";
  45643. }
  45644. if (charType === "R" || charType === "AL" || charType === "AN") {
  45645. numBidi++;
  45646. }
  45647. types[i] = charType;
  45648. }
  45649. if (numBidi === 0) {
  45650. isLTR = true;
  45651. return createBidiText(str, isLTR);
  45652. }
  45653. if (startLevel === -1) {
  45654. if (numBidi / strLength < 0.3 && strLength > 4) {
  45655. isLTR = true;
  45656. startLevel = 0;
  45657. } else {
  45658. isLTR = false;
  45659. startLevel = 1;
  45660. }
  45661. }
  45662. const levels = [];
  45663. for (i = 0; i < strLength; ++i) {
  45664. levels[i] = startLevel;
  45665. }
  45666. const e = isOdd(startLevel) ? "R" : "L";
  45667. const sor = e;
  45668. const eor = sor;
  45669. let lastType = sor;
  45670. for (i = 0; i < strLength; ++i) {
  45671. if (types[i] === "NSM") {
  45672. types[i] = lastType;
  45673. } else {
  45674. lastType = types[i];
  45675. }
  45676. }
  45677. lastType = sor;
  45678. let t;
  45679. for (i = 0; i < strLength; ++i) {
  45680. t = types[i];
  45681. if (t === "EN") {
  45682. types[i] = lastType === "AL" ? "AN" : "EN";
  45683. } else if (t === "R" || t === "L" || t === "AL") {
  45684. lastType = t;
  45685. }
  45686. }
  45687. for (i = 0; i < strLength; ++i) {
  45688. t = types[i];
  45689. if (t === "AL") {
  45690. types[i] = "R";
  45691. }
  45692. }
  45693. for (i = 1; i < strLength - 1; ++i) {
  45694. if (types[i] === "ES" && types[i - 1] === "EN" && types[i + 1] === "EN") {
  45695. types[i] = "EN";
  45696. }
  45697. if (types[i] === "CS" && (types[i - 1] === "EN" || types[i - 1] === "AN") && types[i + 1] === types[i - 1]) {
  45698. types[i] = types[i - 1];
  45699. }
  45700. }
  45701. for (i = 0; i < strLength; ++i) {
  45702. if (types[i] === "EN") {
  45703. for (let j = i - 1; j >= 0; --j) {
  45704. if (types[j] !== "ET") {
  45705. break;
  45706. }
  45707. types[j] = "EN";
  45708. }
  45709. for (let j = i + 1; j < strLength; ++j) {
  45710. if (types[j] !== "ET") {
  45711. break;
  45712. }
  45713. types[j] = "EN";
  45714. }
  45715. }
  45716. }
  45717. for (i = 0; i < strLength; ++i) {
  45718. t = types[i];
  45719. if (t === "WS" || t === "ES" || t === "ET" || t === "CS") {
  45720. types[i] = "ON";
  45721. }
  45722. }
  45723. lastType = sor;
  45724. for (i = 0; i < strLength; ++i) {
  45725. t = types[i];
  45726. if (t === "EN") {
  45727. types[i] = lastType === "L" ? "L" : "EN";
  45728. } else if (t === "R" || t === "L") {
  45729. lastType = t;
  45730. }
  45731. }
  45732. for (i = 0; i < strLength; ++i) {
  45733. if (types[i] === "ON") {
  45734. const end = findUnequal(types, i + 1, "ON");
  45735. let before = sor;
  45736. if (i > 0) {
  45737. before = types[i - 1];
  45738. }
  45739. let after = eor;
  45740. if (end + 1 < strLength) {
  45741. after = types[end + 1];
  45742. }
  45743. if (before !== "L") {
  45744. before = "R";
  45745. }
  45746. if (after !== "L") {
  45747. after = "R";
  45748. }
  45749. if (before === after) {
  45750. setValues(types, i, end, before);
  45751. }
  45752. i = end - 1;
  45753. }
  45754. }
  45755. for (i = 0; i < strLength; ++i) {
  45756. if (types[i] === "ON") {
  45757. types[i] = e;
  45758. }
  45759. }
  45760. for (i = 0; i < strLength; ++i) {
  45761. t = types[i];
  45762. if (isEven(levels[i])) {
  45763. if (t === "R") {
  45764. levels[i] += 1;
  45765. } else if (t === "AN" || t === "EN") {
  45766. levels[i] += 2;
  45767. }
  45768. } else {
  45769. if (t === "L" || t === "AN" || t === "EN") {
  45770. levels[i] += 1;
  45771. }
  45772. }
  45773. }
  45774. let highestLevel = -1;
  45775. let lowestOddLevel = 99;
  45776. let level;
  45777. for (i = 0, ii = levels.length; i < ii; ++i) {
  45778. level = levels[i];
  45779. if (highestLevel < level) {
  45780. highestLevel = level;
  45781. }
  45782. if (lowestOddLevel > level && isOdd(level)) {
  45783. lowestOddLevel = level;
  45784. }
  45785. }
  45786. for (level = highestLevel; level >= lowestOddLevel; --level) {
  45787. let start = -1;
  45788. for (i = 0, ii = levels.length; i < ii; ++i) {
  45789. if (levels[i] < level) {
  45790. if (start >= 0) {
  45791. reverseValues(chars, start, i);
  45792. start = -1;
  45793. }
  45794. } else if (start < 0) {
  45795. start = i;
  45796. }
  45797. }
  45798. if (start >= 0) {
  45799. reverseValues(chars, start, levels.length);
  45800. }
  45801. }
  45802. for (i = 0, ii = chars.length; i < ii; ++i) {
  45803. const ch = chars[i];
  45804. if (ch === "<" || ch === ">") {
  45805. chars[i] = "";
  45806. }
  45807. }
  45808. return createBidiText(chars.join(""), isLTR);
  45809. }
  45810. /***/ }),
  45811. /* 61 */
  45812. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  45813. Object.defineProperty(exports, "__esModule", ({
  45814. value: true
  45815. }));
  45816. exports.MurmurHash3_64 = void 0;
  45817. var _util = __w_pdfjs_require__(2);
  45818. const SEED = 0xc3d2e1f0;
  45819. const MASK_HIGH = 0xffff0000;
  45820. const MASK_LOW = 0xffff;
  45821. class MurmurHash3_64 {
  45822. constructor(seed) {
  45823. this.h1 = seed ? seed & 0xffffffff : SEED;
  45824. this.h2 = seed ? seed & 0xffffffff : SEED;
  45825. }
  45826. update(input) {
  45827. let data, length;
  45828. if (typeof input === "string") {
  45829. data = new Uint8Array(input.length * 2);
  45830. length = 0;
  45831. for (let i = 0, ii = input.length; i < ii; i++) {
  45832. const code = input.charCodeAt(i);
  45833. if (code <= 0xff) {
  45834. data[length++] = code;
  45835. } else {
  45836. data[length++] = code >>> 8;
  45837. data[length++] = code & 0xff;
  45838. }
  45839. }
  45840. } else if ((0, _util.isArrayBuffer)(input)) {
  45841. data = input.slice();
  45842. length = data.byteLength;
  45843. } else {
  45844. throw new Error("Wrong data format in MurmurHash3_64_update. " + "Input must be a string or array.");
  45845. }
  45846. const blockCounts = length >> 2;
  45847. const tailLength = length - blockCounts * 4;
  45848. const dataUint32 = new Uint32Array(data.buffer, 0, blockCounts);
  45849. let k1 = 0,
  45850. k2 = 0;
  45851. let h1 = this.h1,
  45852. h2 = this.h2;
  45853. const C1 = 0xcc9e2d51,
  45854. C2 = 0x1b873593;
  45855. const C1_LOW = C1 & MASK_LOW,
  45856. C2_LOW = C2 & MASK_LOW;
  45857. for (let i = 0; i < blockCounts; i++) {
  45858. if (i & 1) {
  45859. k1 = dataUint32[i];
  45860. k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
  45861. k1 = k1 << 15 | k1 >>> 17;
  45862. k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
  45863. h1 ^= k1;
  45864. h1 = h1 << 13 | h1 >>> 19;
  45865. h1 = h1 * 5 + 0xe6546b64;
  45866. } else {
  45867. k2 = dataUint32[i];
  45868. k2 = k2 * C1 & MASK_HIGH | k2 * C1_LOW & MASK_LOW;
  45869. k2 = k2 << 15 | k2 >>> 17;
  45870. k2 = k2 * C2 & MASK_HIGH | k2 * C2_LOW & MASK_LOW;
  45871. h2 ^= k2;
  45872. h2 = h2 << 13 | h2 >>> 19;
  45873. h2 = h2 * 5 + 0xe6546b64;
  45874. }
  45875. }
  45876. k1 = 0;
  45877. switch (tailLength) {
  45878. case 3:
  45879. k1 ^= data[blockCounts * 4 + 2] << 16;
  45880. case 2:
  45881. k1 ^= data[blockCounts * 4 + 1] << 8;
  45882. case 1:
  45883. k1 ^= data[blockCounts * 4];
  45884. k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
  45885. k1 = k1 << 15 | k1 >>> 17;
  45886. k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
  45887. if (blockCounts & 1) {
  45888. h1 ^= k1;
  45889. } else {
  45890. h2 ^= k1;
  45891. }
  45892. }
  45893. this.h1 = h1;
  45894. this.h2 = h2;
  45895. }
  45896. hexdigest() {
  45897. let h1 = this.h1,
  45898. h2 = this.h2;
  45899. h1 ^= h2 >>> 1;
  45900. h1 = h1 * 0xed558ccd & MASK_HIGH | h1 * 0x8ccd & MASK_LOW;
  45901. h2 = h2 * 0xff51afd7 & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xafd7ed55 & MASK_HIGH) >>> 16;
  45902. h1 ^= h2 >>> 1;
  45903. h1 = h1 * 0x1a85ec53 & MASK_HIGH | h1 * 0xec53 & MASK_LOW;
  45904. h2 = h2 * 0xc4ceb9fe & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xb9fe1a85 & MASK_HIGH) >>> 16;
  45905. h1 ^= h2 >>> 1;
  45906. const hex1 = (h1 >>> 0).toString(16),
  45907. hex2 = (h2 >>> 0).toString(16);
  45908. return hex1.padStart(8, "0") + hex2.padStart(8, "0");
  45909. }
  45910. }
  45911. exports.MurmurHash3_64 = MurmurHash3_64;
  45912. /***/ }),
  45913. /* 62 */
  45914. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  45915. Object.defineProperty(exports, "__esModule", ({
  45916. value: true
  45917. }));
  45918. exports.OperatorList = void 0;
  45919. var _util = __w_pdfjs_require__(2);
  45920. function addState(parentState, pattern, checkFn, iterateFn, processFn) {
  45921. let state = parentState;
  45922. for (let i = 0, ii = pattern.length - 1; i < ii; i++) {
  45923. const item = pattern[i];
  45924. state = state[item] || (state[item] = []);
  45925. }
  45926. state[pattern.at(-1)] = {
  45927. checkFn,
  45928. iterateFn,
  45929. processFn
  45930. };
  45931. }
  45932. const InitialState = [];
  45933. addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintInlineImageXObject, _util.OPS.restore], null, function iterateInlineImageGroup(context, i) {
  45934. const fnArray = context.fnArray;
  45935. const iFirstSave = context.iCurr - 3;
  45936. const pos = (i - iFirstSave) % 4;
  45937. switch (pos) {
  45938. case 0:
  45939. return fnArray[i] === _util.OPS.save;
  45940. case 1:
  45941. return fnArray[i] === _util.OPS.transform;
  45942. case 2:
  45943. return fnArray[i] === _util.OPS.paintInlineImageXObject;
  45944. case 3:
  45945. return fnArray[i] === _util.OPS.restore;
  45946. }
  45947. throw new Error(`iterateInlineImageGroup - invalid pos: ${pos}`);
  45948. }, function foundInlineImageGroup(context, i) {
  45949. const MIN_IMAGES_IN_INLINE_IMAGES_BLOCK = 10;
  45950. const MAX_IMAGES_IN_INLINE_IMAGES_BLOCK = 200;
  45951. const MAX_WIDTH = 1000;
  45952. const IMAGE_PADDING = 1;
  45953. const fnArray = context.fnArray,
  45954. argsArray = context.argsArray;
  45955. const curr = context.iCurr;
  45956. const iFirstSave = curr - 3;
  45957. const iFirstTransform = curr - 2;
  45958. const iFirstPIIXO = curr - 1;
  45959. const count = Math.min(Math.floor((i - iFirstSave) / 4), MAX_IMAGES_IN_INLINE_IMAGES_BLOCK);
  45960. if (count < MIN_IMAGES_IN_INLINE_IMAGES_BLOCK) {
  45961. return i - (i - iFirstSave) % 4;
  45962. }
  45963. let maxX = 0;
  45964. const map = [];
  45965. let maxLineHeight = 0;
  45966. let currentX = IMAGE_PADDING,
  45967. currentY = IMAGE_PADDING;
  45968. for (let q = 0; q < count; q++) {
  45969. const transform = argsArray[iFirstTransform + (q << 2)];
  45970. const img = argsArray[iFirstPIIXO + (q << 2)][0];
  45971. if (currentX + img.width > MAX_WIDTH) {
  45972. maxX = Math.max(maxX, currentX);
  45973. currentY += maxLineHeight + 2 * IMAGE_PADDING;
  45974. currentX = 0;
  45975. maxLineHeight = 0;
  45976. }
  45977. map.push({
  45978. transform,
  45979. x: currentX,
  45980. y: currentY,
  45981. w: img.width,
  45982. h: img.height
  45983. });
  45984. currentX += img.width + 2 * IMAGE_PADDING;
  45985. maxLineHeight = Math.max(maxLineHeight, img.height);
  45986. }
  45987. const imgWidth = Math.max(maxX, currentX) + IMAGE_PADDING;
  45988. const imgHeight = currentY + maxLineHeight + IMAGE_PADDING;
  45989. const imgData = new Uint8Array(imgWidth * imgHeight * 4);
  45990. const imgRowSize = imgWidth << 2;
  45991. for (let q = 0; q < count; q++) {
  45992. const data = argsArray[iFirstPIIXO + (q << 2)][0].data;
  45993. const rowSize = map[q].w << 2;
  45994. let dataOffset = 0;
  45995. let offset = map[q].x + map[q].y * imgWidth << 2;
  45996. imgData.set(data.subarray(0, rowSize), offset - imgRowSize);
  45997. for (let k = 0, kk = map[q].h; k < kk; k++) {
  45998. imgData.set(data.subarray(dataOffset, dataOffset + rowSize), offset);
  45999. dataOffset += rowSize;
  46000. offset += imgRowSize;
  46001. }
  46002. imgData.set(data.subarray(dataOffset - rowSize, dataOffset), offset);
  46003. while (offset >= 0) {
  46004. data[offset - 4] = data[offset];
  46005. data[offset - 3] = data[offset + 1];
  46006. data[offset - 2] = data[offset + 2];
  46007. data[offset - 1] = data[offset + 3];
  46008. data[offset + rowSize] = data[offset + rowSize - 4];
  46009. data[offset + rowSize + 1] = data[offset + rowSize - 3];
  46010. data[offset + rowSize + 2] = data[offset + rowSize - 2];
  46011. data[offset + rowSize + 3] = data[offset + rowSize - 1];
  46012. offset -= imgRowSize;
  46013. }
  46014. }
  46015. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintInlineImageXObjectGroup);
  46016. argsArray.splice(iFirstSave, count * 4, [{
  46017. width: imgWidth,
  46018. height: imgHeight,
  46019. kind: _util.ImageKind.RGBA_32BPP,
  46020. data: imgData
  46021. }, map]);
  46022. return iFirstSave + 1;
  46023. });
  46024. addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintImageMaskXObject, _util.OPS.restore], null, function iterateImageMaskGroup(context, i) {
  46025. const fnArray = context.fnArray;
  46026. const iFirstSave = context.iCurr - 3;
  46027. const pos = (i - iFirstSave) % 4;
  46028. switch (pos) {
  46029. case 0:
  46030. return fnArray[i] === _util.OPS.save;
  46031. case 1:
  46032. return fnArray[i] === _util.OPS.transform;
  46033. case 2:
  46034. return fnArray[i] === _util.OPS.paintImageMaskXObject;
  46035. case 3:
  46036. return fnArray[i] === _util.OPS.restore;
  46037. }
  46038. throw new Error(`iterateImageMaskGroup - invalid pos: ${pos}`);
  46039. }, function foundImageMaskGroup(context, i) {
  46040. const MIN_IMAGES_IN_MASKS_BLOCK = 10;
  46041. const MAX_IMAGES_IN_MASKS_BLOCK = 100;
  46042. const MAX_SAME_IMAGES_IN_MASKS_BLOCK = 1000;
  46043. const fnArray = context.fnArray,
  46044. argsArray = context.argsArray;
  46045. const curr = context.iCurr;
  46046. const iFirstSave = curr - 3;
  46047. const iFirstTransform = curr - 2;
  46048. const iFirstPIMXO = curr - 1;
  46049. let count = Math.floor((i - iFirstSave) / 4);
  46050. if (count < MIN_IMAGES_IN_MASKS_BLOCK) {
  46051. return i - (i - iFirstSave) % 4;
  46052. }
  46053. let isSameImage = false;
  46054. let iTransform, transformArgs;
  46055. const firstPIMXOArg0 = argsArray[iFirstPIMXO][0];
  46056. const firstTransformArg0 = argsArray[iFirstTransform][0],
  46057. firstTransformArg1 = argsArray[iFirstTransform][1],
  46058. firstTransformArg2 = argsArray[iFirstTransform][2],
  46059. firstTransformArg3 = argsArray[iFirstTransform][3];
  46060. if (firstTransformArg1 === firstTransformArg2) {
  46061. isSameImage = true;
  46062. iTransform = iFirstTransform + 4;
  46063. let iPIMXO = iFirstPIMXO + 4;
  46064. for (let q = 1; q < count; q++, iTransform += 4, iPIMXO += 4) {
  46065. transformArgs = argsArray[iTransform];
  46066. if (argsArray[iPIMXO][0] !== firstPIMXOArg0 || transformArgs[0] !== firstTransformArg0 || transformArgs[1] !== firstTransformArg1 || transformArgs[2] !== firstTransformArg2 || transformArgs[3] !== firstTransformArg3) {
  46067. if (q < MIN_IMAGES_IN_MASKS_BLOCK) {
  46068. isSameImage = false;
  46069. } else {
  46070. count = q;
  46071. }
  46072. break;
  46073. }
  46074. }
  46075. }
  46076. if (isSameImage) {
  46077. count = Math.min(count, MAX_SAME_IMAGES_IN_MASKS_BLOCK);
  46078. const positions = new Float32Array(count * 2);
  46079. iTransform = iFirstTransform;
  46080. for (let q = 0; q < count; q++, iTransform += 4) {
  46081. transformArgs = argsArray[iTransform];
  46082. positions[q << 1] = transformArgs[4];
  46083. positions[(q << 1) + 1] = transformArgs[5];
  46084. }
  46085. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageMaskXObjectRepeat);
  46086. argsArray.splice(iFirstSave, count * 4, [firstPIMXOArg0, firstTransformArg0, firstTransformArg1, firstTransformArg2, firstTransformArg3, positions]);
  46087. } else {
  46088. count = Math.min(count, MAX_IMAGES_IN_MASKS_BLOCK);
  46089. const images = [];
  46090. for (let q = 0; q < count; q++) {
  46091. transformArgs = argsArray[iFirstTransform + (q << 2)];
  46092. const maskParams = argsArray[iFirstPIMXO + (q << 2)][0];
  46093. images.push({
  46094. data: maskParams.data,
  46095. width: maskParams.width,
  46096. height: maskParams.height,
  46097. interpolate: maskParams.interpolate,
  46098. count: maskParams.count,
  46099. transform: transformArgs
  46100. });
  46101. }
  46102. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageMaskXObjectGroup);
  46103. argsArray.splice(iFirstSave, count * 4, [images]);
  46104. }
  46105. return iFirstSave + 1;
  46106. });
  46107. addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintImageXObject, _util.OPS.restore], function (context) {
  46108. const argsArray = context.argsArray;
  46109. const iFirstTransform = context.iCurr - 2;
  46110. return argsArray[iFirstTransform][1] === 0 && argsArray[iFirstTransform][2] === 0;
  46111. }, function iterateImageGroup(context, i) {
  46112. const fnArray = context.fnArray,
  46113. argsArray = context.argsArray;
  46114. const iFirstSave = context.iCurr - 3;
  46115. const pos = (i - iFirstSave) % 4;
  46116. switch (pos) {
  46117. case 0:
  46118. return fnArray[i] === _util.OPS.save;
  46119. case 1:
  46120. if (fnArray[i] !== _util.OPS.transform) {
  46121. return false;
  46122. }
  46123. const iFirstTransform = context.iCurr - 2;
  46124. const firstTransformArg0 = argsArray[iFirstTransform][0];
  46125. const firstTransformArg3 = argsArray[iFirstTransform][3];
  46126. if (argsArray[i][0] !== firstTransformArg0 || argsArray[i][1] !== 0 || argsArray[i][2] !== 0 || argsArray[i][3] !== firstTransformArg3) {
  46127. return false;
  46128. }
  46129. return true;
  46130. case 2:
  46131. if (fnArray[i] !== _util.OPS.paintImageXObject) {
  46132. return false;
  46133. }
  46134. const iFirstPIXO = context.iCurr - 1;
  46135. const firstPIXOArg0 = argsArray[iFirstPIXO][0];
  46136. if (argsArray[i][0] !== firstPIXOArg0) {
  46137. return false;
  46138. }
  46139. return true;
  46140. case 3:
  46141. return fnArray[i] === _util.OPS.restore;
  46142. }
  46143. throw new Error(`iterateImageGroup - invalid pos: ${pos}`);
  46144. }, function (context, i) {
  46145. const MIN_IMAGES_IN_BLOCK = 3;
  46146. const MAX_IMAGES_IN_BLOCK = 1000;
  46147. const fnArray = context.fnArray,
  46148. argsArray = context.argsArray;
  46149. const curr = context.iCurr;
  46150. const iFirstSave = curr - 3;
  46151. const iFirstTransform = curr - 2;
  46152. const iFirstPIXO = curr - 1;
  46153. const firstPIXOArg0 = argsArray[iFirstPIXO][0];
  46154. const firstTransformArg0 = argsArray[iFirstTransform][0];
  46155. const firstTransformArg3 = argsArray[iFirstTransform][3];
  46156. const count = Math.min(Math.floor((i - iFirstSave) / 4), MAX_IMAGES_IN_BLOCK);
  46157. if (count < MIN_IMAGES_IN_BLOCK) {
  46158. return i - (i - iFirstSave) % 4;
  46159. }
  46160. const positions = new Float32Array(count * 2);
  46161. let iTransform = iFirstTransform;
  46162. for (let q = 0; q < count; q++, iTransform += 4) {
  46163. const transformArgs = argsArray[iTransform];
  46164. positions[q << 1] = transformArgs[4];
  46165. positions[(q << 1) + 1] = transformArgs[5];
  46166. }
  46167. const args = [firstPIXOArg0, firstTransformArg0, firstTransformArg3, positions];
  46168. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageXObjectRepeat);
  46169. argsArray.splice(iFirstSave, count * 4, args);
  46170. return iFirstSave + 1;
  46171. });
  46172. addState(InitialState, [_util.OPS.beginText, _util.OPS.setFont, _util.OPS.setTextMatrix, _util.OPS.showText, _util.OPS.endText], null, function iterateShowTextGroup(context, i) {
  46173. const fnArray = context.fnArray,
  46174. argsArray = context.argsArray;
  46175. const iFirstSave = context.iCurr - 4;
  46176. const pos = (i - iFirstSave) % 5;
  46177. switch (pos) {
  46178. case 0:
  46179. return fnArray[i] === _util.OPS.beginText;
  46180. case 1:
  46181. return fnArray[i] === _util.OPS.setFont;
  46182. case 2:
  46183. return fnArray[i] === _util.OPS.setTextMatrix;
  46184. case 3:
  46185. if (fnArray[i] !== _util.OPS.showText) {
  46186. return false;
  46187. }
  46188. const iFirstSetFont = context.iCurr - 3;
  46189. const firstSetFontArg0 = argsArray[iFirstSetFont][0];
  46190. const firstSetFontArg1 = argsArray[iFirstSetFont][1];
  46191. if (argsArray[i][0] !== firstSetFontArg0 || argsArray[i][1] !== firstSetFontArg1) {
  46192. return false;
  46193. }
  46194. return true;
  46195. case 4:
  46196. return fnArray[i] === _util.OPS.endText;
  46197. }
  46198. throw new Error(`iterateShowTextGroup - invalid pos: ${pos}`);
  46199. }, function (context, i) {
  46200. const MIN_CHARS_IN_BLOCK = 3;
  46201. const MAX_CHARS_IN_BLOCK = 1000;
  46202. const fnArray = context.fnArray,
  46203. argsArray = context.argsArray;
  46204. const curr = context.iCurr;
  46205. const iFirstBeginText = curr - 4;
  46206. const iFirstSetFont = curr - 3;
  46207. const iFirstSetTextMatrix = curr - 2;
  46208. const iFirstShowText = curr - 1;
  46209. const iFirstEndText = curr;
  46210. const firstSetFontArg0 = argsArray[iFirstSetFont][0];
  46211. const firstSetFontArg1 = argsArray[iFirstSetFont][1];
  46212. let count = Math.min(Math.floor((i - iFirstBeginText) / 5), MAX_CHARS_IN_BLOCK);
  46213. if (count < MIN_CHARS_IN_BLOCK) {
  46214. return i - (i - iFirstBeginText) % 5;
  46215. }
  46216. let iFirst = iFirstBeginText;
  46217. 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) {
  46218. count++;
  46219. iFirst -= 5;
  46220. }
  46221. let iEndText = iFirst + 4;
  46222. for (let q = 1; q < count; q++) {
  46223. fnArray.splice(iEndText, 3);
  46224. argsArray.splice(iEndText, 3);
  46225. iEndText += 2;
  46226. }
  46227. return iEndText + 1;
  46228. });
  46229. class NullOptimizer {
  46230. constructor(queue) {
  46231. this.queue = queue;
  46232. }
  46233. _optimize() {}
  46234. push(fn, args) {
  46235. this.queue.fnArray.push(fn);
  46236. this.queue.argsArray.push(args);
  46237. this._optimize();
  46238. }
  46239. flush() {}
  46240. reset() {}
  46241. }
  46242. class QueueOptimizer extends NullOptimizer {
  46243. constructor(queue) {
  46244. super(queue);
  46245. this.state = null;
  46246. this.context = {
  46247. iCurr: 0,
  46248. fnArray: queue.fnArray,
  46249. argsArray: queue.argsArray
  46250. };
  46251. this.match = null;
  46252. this.lastProcessed = 0;
  46253. }
  46254. _optimize() {
  46255. const fnArray = this.queue.fnArray;
  46256. let i = this.lastProcessed,
  46257. ii = fnArray.length;
  46258. let state = this.state;
  46259. let match = this.match;
  46260. if (!state && !match && i + 1 === ii && !InitialState[fnArray[i]]) {
  46261. this.lastProcessed = ii;
  46262. return;
  46263. }
  46264. const context = this.context;
  46265. while (i < ii) {
  46266. if (match) {
  46267. const iterate = (0, match.iterateFn)(context, i);
  46268. if (iterate) {
  46269. i++;
  46270. continue;
  46271. }
  46272. i = (0, match.processFn)(context, i + 1);
  46273. ii = fnArray.length;
  46274. match = null;
  46275. state = null;
  46276. if (i >= ii) {
  46277. break;
  46278. }
  46279. }
  46280. state = (state || InitialState)[fnArray[i]];
  46281. if (!state || Array.isArray(state)) {
  46282. i++;
  46283. continue;
  46284. }
  46285. context.iCurr = i;
  46286. i++;
  46287. if (state.checkFn && !(0, state.checkFn)(context)) {
  46288. state = null;
  46289. continue;
  46290. }
  46291. match = state;
  46292. state = null;
  46293. }
  46294. this.state = state;
  46295. this.match = match;
  46296. this.lastProcessed = i;
  46297. }
  46298. flush() {
  46299. while (this.match) {
  46300. const length = this.queue.fnArray.length;
  46301. this.lastProcessed = (0, this.match.processFn)(this.context, length);
  46302. this.match = null;
  46303. this.state = null;
  46304. this._optimize();
  46305. }
  46306. }
  46307. reset() {
  46308. this.state = null;
  46309. this.match = null;
  46310. this.lastProcessed = 0;
  46311. }
  46312. }
  46313. class OperatorList {
  46314. static get CHUNK_SIZE() {
  46315. return (0, _util.shadow)(this, "CHUNK_SIZE", 1000);
  46316. }
  46317. static get CHUNK_SIZE_ABOUT() {
  46318. return (0, _util.shadow)(this, "CHUNK_SIZE_ABOUT", this.CHUNK_SIZE - 5);
  46319. }
  46320. constructor(intent = 0, streamSink) {
  46321. this._streamSink = streamSink;
  46322. this.fnArray = [];
  46323. this.argsArray = [];
  46324. if (streamSink && !(intent & _util.RenderingIntentFlag.OPLIST)) {
  46325. this.optimizer = new QueueOptimizer(this);
  46326. } else {
  46327. this.optimizer = new NullOptimizer(this);
  46328. }
  46329. this.dependencies = new Set();
  46330. this._totalLength = 0;
  46331. this.weight = 0;
  46332. this._resolved = streamSink ? null : Promise.resolve();
  46333. }
  46334. get length() {
  46335. return this.argsArray.length;
  46336. }
  46337. get ready() {
  46338. return this._resolved || this._streamSink.ready;
  46339. }
  46340. get totalLength() {
  46341. return this._totalLength + this.length;
  46342. }
  46343. addOp(fn, args) {
  46344. this.optimizer.push(fn, args);
  46345. this.weight++;
  46346. if (this._streamSink) {
  46347. if (this.weight >= OperatorList.CHUNK_SIZE) {
  46348. this.flush();
  46349. } else if (this.weight >= OperatorList.CHUNK_SIZE_ABOUT && (fn === _util.OPS.restore || fn === _util.OPS.endText)) {
  46350. this.flush();
  46351. }
  46352. }
  46353. }
  46354. addImageOps(fn, args, optionalContent) {
  46355. if (optionalContent !== undefined) {
  46356. this.addOp(_util.OPS.beginMarkedContentProps, ["OC", optionalContent]);
  46357. }
  46358. this.addOp(fn, args);
  46359. if (optionalContent !== undefined) {
  46360. this.addOp(_util.OPS.endMarkedContent, []);
  46361. }
  46362. }
  46363. addDependency(dependency) {
  46364. if (this.dependencies.has(dependency)) {
  46365. return;
  46366. }
  46367. this.dependencies.add(dependency);
  46368. this.addOp(_util.OPS.dependency, [dependency]);
  46369. }
  46370. addDependencies(dependencies) {
  46371. for (const dependency of dependencies) {
  46372. this.addDependency(dependency);
  46373. }
  46374. }
  46375. addOpList(opList) {
  46376. if (!(opList instanceof OperatorList)) {
  46377. (0, _util.warn)('addOpList - ignoring invalid "opList" parameter.');
  46378. return;
  46379. }
  46380. for (const dependency of opList.dependencies) {
  46381. this.dependencies.add(dependency);
  46382. }
  46383. for (let i = 0, ii = opList.length; i < ii; i++) {
  46384. this.addOp(opList.fnArray[i], opList.argsArray[i]);
  46385. }
  46386. }
  46387. getIR() {
  46388. return {
  46389. fnArray: this.fnArray,
  46390. argsArray: this.argsArray,
  46391. length: this.length
  46392. };
  46393. }
  46394. get _transfers() {
  46395. const transfers = [];
  46396. const {
  46397. fnArray,
  46398. argsArray,
  46399. length
  46400. } = this;
  46401. for (let i = 0; i < length; i++) {
  46402. switch (fnArray[i]) {
  46403. case _util.OPS.paintInlineImageXObject:
  46404. case _util.OPS.paintInlineImageXObjectGroup:
  46405. case _util.OPS.paintImageMaskXObject:
  46406. const arg = argsArray[i][0];
  46407. if (!arg.cached && arg.data && arg.data.buffer instanceof ArrayBuffer) {
  46408. transfers.push(arg.data.buffer);
  46409. }
  46410. break;
  46411. }
  46412. }
  46413. return transfers;
  46414. }
  46415. flush(lastChunk = false, separateAnnots = null) {
  46416. this.optimizer.flush();
  46417. const length = this.length;
  46418. this._totalLength += length;
  46419. this._streamSink.enqueue({
  46420. fnArray: this.fnArray,
  46421. argsArray: this.argsArray,
  46422. lastChunk,
  46423. separateAnnots,
  46424. length
  46425. }, 1, this._transfers);
  46426. this.dependencies.clear();
  46427. this.fnArray.length = 0;
  46428. this.argsArray.length = 0;
  46429. this.weight = 0;
  46430. this.optimizer.reset();
  46431. }
  46432. }
  46433. exports.OperatorList = OperatorList;
  46434. /***/ }),
  46435. /* 63 */
  46436. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  46437. Object.defineProperty(exports, "__esModule", ({
  46438. value: true
  46439. }));
  46440. exports.PDFImage = void 0;
  46441. var _util = __w_pdfjs_require__(2);
  46442. var _image_utils = __w_pdfjs_require__(64);
  46443. var _base_stream = __w_pdfjs_require__(7);
  46444. var _colorspace = __w_pdfjs_require__(24);
  46445. var _decode_stream = __w_pdfjs_require__(29);
  46446. var _jpeg_stream = __w_pdfjs_require__(37);
  46447. var _jpx = __w_pdfjs_require__(40);
  46448. var _primitives = __w_pdfjs_require__(5);
  46449. function decodeAndClamp(value, addend, coefficient, max) {
  46450. value = addend + value * coefficient;
  46451. if (value < 0) {
  46452. value = 0;
  46453. } else if (value > max) {
  46454. value = max;
  46455. }
  46456. return value;
  46457. }
  46458. function resizeImageMask(src, bpc, w1, h1, w2, h2) {
  46459. const length = w2 * h2;
  46460. let dest;
  46461. if (bpc <= 8) {
  46462. dest = new Uint8Array(length);
  46463. } else if (bpc <= 16) {
  46464. dest = new Uint16Array(length);
  46465. } else {
  46466. dest = new Uint32Array(length);
  46467. }
  46468. const xRatio = w1 / w2;
  46469. const yRatio = h1 / h2;
  46470. let i,
  46471. j,
  46472. py,
  46473. newIndex = 0,
  46474. oldIndex;
  46475. const xScaled = new Uint16Array(w2);
  46476. const w1Scanline = w1;
  46477. for (i = 0; i < w2; i++) {
  46478. xScaled[i] = Math.floor(i * xRatio);
  46479. }
  46480. for (i = 0; i < h2; i++) {
  46481. py = Math.floor(i * yRatio) * w1Scanline;
  46482. for (j = 0; j < w2; j++) {
  46483. oldIndex = py + xScaled[j];
  46484. dest[newIndex++] = src[oldIndex];
  46485. }
  46486. }
  46487. return dest;
  46488. }
  46489. class PDFImage {
  46490. constructor({
  46491. xref,
  46492. res,
  46493. image,
  46494. isInline = false,
  46495. smask = null,
  46496. mask = null,
  46497. isMask = false,
  46498. pdfFunctionFactory,
  46499. localColorSpaceCache
  46500. }) {
  46501. this.image = image;
  46502. const dict = image.dict;
  46503. const filter = dict.get("F", "Filter");
  46504. let filterName;
  46505. if (filter instanceof _primitives.Name) {
  46506. filterName = filter.name;
  46507. } else if (Array.isArray(filter)) {
  46508. const filterZero = xref.fetchIfRef(filter[0]);
  46509. if (filterZero instanceof _primitives.Name) {
  46510. filterName = filterZero.name;
  46511. }
  46512. }
  46513. switch (filterName) {
  46514. case "JPXDecode":
  46515. const jpxImage = new _jpx.JpxImage();
  46516. jpxImage.parseImageProperties(image.stream);
  46517. image.stream.reset();
  46518. image.width = jpxImage.width;
  46519. image.height = jpxImage.height;
  46520. image.bitsPerComponent = jpxImage.bitsPerComponent;
  46521. image.numComps = jpxImage.componentsCount;
  46522. break;
  46523. case "JBIG2Decode":
  46524. image.bitsPerComponent = 1;
  46525. image.numComps = 1;
  46526. break;
  46527. }
  46528. let width = dict.get("W", "Width");
  46529. let height = dict.get("H", "Height");
  46530. if (Number.isInteger(image.width) && image.width > 0 && Number.isInteger(image.height) && image.height > 0 && (image.width !== width || image.height !== height)) {
  46531. (0, _util.warn)("PDFImage - using the Width/Height of the image data, " + "rather than the image dictionary.");
  46532. width = image.width;
  46533. height = image.height;
  46534. }
  46535. if (width < 1 || height < 1) {
  46536. throw new _util.FormatError(`Invalid image width: ${width} or height: ${height}`);
  46537. }
  46538. this.width = width;
  46539. this.height = height;
  46540. this.interpolate = dict.get("I", "Interpolate");
  46541. this.imageMask = dict.get("IM", "ImageMask") || false;
  46542. this.matte = dict.get("Matte") || false;
  46543. let bitsPerComponent = image.bitsPerComponent;
  46544. if (!bitsPerComponent) {
  46545. bitsPerComponent = dict.get("BPC", "BitsPerComponent");
  46546. if (!bitsPerComponent) {
  46547. if (this.imageMask) {
  46548. bitsPerComponent = 1;
  46549. } else {
  46550. throw new _util.FormatError(`Bits per component missing in image: ${this.imageMask}`);
  46551. }
  46552. }
  46553. }
  46554. this.bpc = bitsPerComponent;
  46555. if (!this.imageMask) {
  46556. let colorSpace = dict.getRaw("CS") || dict.getRaw("ColorSpace");
  46557. if (!colorSpace) {
  46558. (0, _util.info)("JPX images (which do not require color spaces)");
  46559. switch (image.numComps) {
  46560. case 1:
  46561. colorSpace = _primitives.Name.get("DeviceGray");
  46562. break;
  46563. case 3:
  46564. colorSpace = _primitives.Name.get("DeviceRGB");
  46565. break;
  46566. case 4:
  46567. colorSpace = _primitives.Name.get("DeviceCMYK");
  46568. break;
  46569. default:
  46570. throw new Error(`JPX images with ${image.numComps} color components not supported.`);
  46571. }
  46572. }
  46573. this.colorSpace = _colorspace.ColorSpace.parse({
  46574. cs: colorSpace,
  46575. xref,
  46576. resources: isInline ? res : null,
  46577. pdfFunctionFactory,
  46578. localColorSpaceCache
  46579. });
  46580. this.numComps = this.colorSpace.numComps;
  46581. }
  46582. this.decode = dict.getArray("D", "Decode");
  46583. this.needsDecode = false;
  46584. if (this.decode && (this.colorSpace && !this.colorSpace.isDefaultDecode(this.decode, bitsPerComponent) || isMask && !_colorspace.ColorSpace.isDefaultDecode(this.decode, 1))) {
  46585. this.needsDecode = true;
  46586. const max = (1 << bitsPerComponent) - 1;
  46587. this.decodeCoefficients = [];
  46588. this.decodeAddends = [];
  46589. const isIndexed = this.colorSpace && this.colorSpace.name === "Indexed";
  46590. for (let i = 0, j = 0; i < this.decode.length; i += 2, ++j) {
  46591. const dmin = this.decode[i];
  46592. const dmax = this.decode[i + 1];
  46593. this.decodeCoefficients[j] = isIndexed ? (dmax - dmin) / max : dmax - dmin;
  46594. this.decodeAddends[j] = isIndexed ? dmin : max * dmin;
  46595. }
  46596. }
  46597. if (smask) {
  46598. this.smask = new PDFImage({
  46599. xref,
  46600. res,
  46601. image: smask,
  46602. isInline,
  46603. pdfFunctionFactory,
  46604. localColorSpaceCache
  46605. });
  46606. } else if (mask) {
  46607. if (mask instanceof _base_stream.BaseStream) {
  46608. const maskDict = mask.dict,
  46609. imageMask = maskDict.get("IM", "ImageMask");
  46610. if (!imageMask) {
  46611. (0, _util.warn)("Ignoring /Mask in image without /ImageMask.");
  46612. } else {
  46613. this.mask = new PDFImage({
  46614. xref,
  46615. res,
  46616. image: mask,
  46617. isInline,
  46618. isMask: true,
  46619. pdfFunctionFactory,
  46620. localColorSpaceCache
  46621. });
  46622. }
  46623. } else {
  46624. this.mask = mask;
  46625. }
  46626. }
  46627. }
  46628. static async buildImage({
  46629. xref,
  46630. res,
  46631. image,
  46632. isInline = false,
  46633. pdfFunctionFactory,
  46634. localColorSpaceCache
  46635. }) {
  46636. const imageData = image;
  46637. let smaskData = null;
  46638. let maskData = null;
  46639. const smask = image.dict.get("SMask");
  46640. const mask = image.dict.get("Mask");
  46641. if (smask) {
  46642. if (smask instanceof _base_stream.BaseStream) {
  46643. smaskData = smask;
  46644. } else {
  46645. (0, _util.warn)("Unsupported /SMask format.");
  46646. }
  46647. } else if (mask) {
  46648. if (mask instanceof _base_stream.BaseStream || Array.isArray(mask)) {
  46649. maskData = mask;
  46650. } else {
  46651. (0, _util.warn)("Unsupported /Mask format.");
  46652. }
  46653. }
  46654. return new PDFImage({
  46655. xref,
  46656. res,
  46657. image: imageData,
  46658. isInline,
  46659. smask: smaskData,
  46660. mask: maskData,
  46661. pdfFunctionFactory,
  46662. localColorSpaceCache
  46663. });
  46664. }
  46665. static createRawMask({
  46666. imgArray,
  46667. width,
  46668. height,
  46669. imageIsFromDecodeStream,
  46670. inverseDecode,
  46671. interpolate
  46672. }) {
  46673. const computedLength = (width + 7 >> 3) * height;
  46674. const actualLength = imgArray.byteLength;
  46675. const haveFullData = computedLength === actualLength;
  46676. let data, i;
  46677. if (imageIsFromDecodeStream && (!inverseDecode || haveFullData)) {
  46678. data = imgArray;
  46679. } else if (!inverseDecode) {
  46680. data = new Uint8Array(imgArray);
  46681. } else {
  46682. data = new Uint8Array(computedLength);
  46683. data.set(imgArray);
  46684. data.fill(0xff, actualLength);
  46685. }
  46686. if (inverseDecode) {
  46687. for (i = 0; i < actualLength; i++) {
  46688. data[i] ^= 0xff;
  46689. }
  46690. }
  46691. return {
  46692. data,
  46693. width,
  46694. height,
  46695. interpolate
  46696. };
  46697. }
  46698. static createMask({
  46699. imgArray,
  46700. width,
  46701. height,
  46702. imageIsFromDecodeStream,
  46703. inverseDecode,
  46704. interpolate
  46705. }) {
  46706. const isSingleOpaquePixel = width === 1 && height === 1 && inverseDecode === (imgArray.length === 0 || !!(imgArray[0] & 128));
  46707. if (isSingleOpaquePixel) {
  46708. return {
  46709. isSingleOpaquePixel
  46710. };
  46711. }
  46712. if (_util.FeatureTest.isOffscreenCanvasSupported) {
  46713. const canvas = new OffscreenCanvas(width, height);
  46714. const ctx = canvas.getContext("2d");
  46715. const imgData = ctx.createImageData(width, height);
  46716. (0, _image_utils.applyMaskImageData)({
  46717. src: imgArray,
  46718. dest: imgData.data,
  46719. width,
  46720. height,
  46721. inverseDecode
  46722. });
  46723. ctx.putImageData(imgData, 0, 0);
  46724. const bitmap = canvas.transferToImageBitmap();
  46725. return {
  46726. data: null,
  46727. width,
  46728. height,
  46729. interpolate,
  46730. bitmap
  46731. };
  46732. }
  46733. return this.createRawMask({
  46734. imgArray,
  46735. width,
  46736. height,
  46737. inverseDecode,
  46738. imageIsFromDecodeStream,
  46739. interpolate
  46740. });
  46741. }
  46742. get drawWidth() {
  46743. return Math.max(this.width, this.smask && this.smask.width || 0, this.mask && this.mask.width || 0);
  46744. }
  46745. get drawHeight() {
  46746. return Math.max(this.height, this.smask && this.smask.height || 0, this.mask && this.mask.height || 0);
  46747. }
  46748. decodeBuffer(buffer) {
  46749. const bpc = this.bpc;
  46750. const numComps = this.numComps;
  46751. const decodeAddends = this.decodeAddends;
  46752. const decodeCoefficients = this.decodeCoefficients;
  46753. const max = (1 << bpc) - 1;
  46754. let i, ii;
  46755. if (bpc === 1) {
  46756. for (i = 0, ii = buffer.length; i < ii; i++) {
  46757. buffer[i] = +!buffer[i];
  46758. }
  46759. return;
  46760. }
  46761. let index = 0;
  46762. for (i = 0, ii = this.width * this.height; i < ii; i++) {
  46763. for (let j = 0; j < numComps; j++) {
  46764. buffer[index] = decodeAndClamp(buffer[index], decodeAddends[j], decodeCoefficients[j], max);
  46765. index++;
  46766. }
  46767. }
  46768. }
  46769. getComponents(buffer) {
  46770. const bpc = this.bpc;
  46771. if (bpc === 8) {
  46772. return buffer;
  46773. }
  46774. const width = this.width;
  46775. const height = this.height;
  46776. const numComps = this.numComps;
  46777. const length = width * height * numComps;
  46778. let bufferPos = 0;
  46779. let output;
  46780. if (bpc <= 8) {
  46781. output = new Uint8Array(length);
  46782. } else if (bpc <= 16) {
  46783. output = new Uint16Array(length);
  46784. } else {
  46785. output = new Uint32Array(length);
  46786. }
  46787. const rowComps = width * numComps;
  46788. const max = (1 << bpc) - 1;
  46789. let i = 0,
  46790. ii,
  46791. buf;
  46792. if (bpc === 1) {
  46793. let mask, loop1End, loop2End;
  46794. for (let j = 0; j < height; j++) {
  46795. loop1End = i + (rowComps & ~7);
  46796. loop2End = i + rowComps;
  46797. while (i < loop1End) {
  46798. buf = buffer[bufferPos++];
  46799. output[i] = buf >> 7 & 1;
  46800. output[i + 1] = buf >> 6 & 1;
  46801. output[i + 2] = buf >> 5 & 1;
  46802. output[i + 3] = buf >> 4 & 1;
  46803. output[i + 4] = buf >> 3 & 1;
  46804. output[i + 5] = buf >> 2 & 1;
  46805. output[i + 6] = buf >> 1 & 1;
  46806. output[i + 7] = buf & 1;
  46807. i += 8;
  46808. }
  46809. if (i < loop2End) {
  46810. buf = buffer[bufferPos++];
  46811. mask = 128;
  46812. while (i < loop2End) {
  46813. output[i++] = +!!(buf & mask);
  46814. mask >>= 1;
  46815. }
  46816. }
  46817. }
  46818. } else {
  46819. let bits = 0;
  46820. buf = 0;
  46821. for (i = 0, ii = length; i < ii; ++i) {
  46822. if (i % rowComps === 0) {
  46823. buf = 0;
  46824. bits = 0;
  46825. }
  46826. while (bits < bpc) {
  46827. buf = buf << 8 | buffer[bufferPos++];
  46828. bits += 8;
  46829. }
  46830. const remainingBits = bits - bpc;
  46831. let value = buf >> remainingBits;
  46832. if (value < 0) {
  46833. value = 0;
  46834. } else if (value > max) {
  46835. value = max;
  46836. }
  46837. output[i] = value;
  46838. buf &= (1 << remainingBits) - 1;
  46839. bits = remainingBits;
  46840. }
  46841. }
  46842. return output;
  46843. }
  46844. fillOpacity(rgbaBuf, width, height, actualHeight, image) {
  46845. const smask = this.smask;
  46846. const mask = this.mask;
  46847. let alphaBuf, sw, sh, i, ii, j;
  46848. if (smask) {
  46849. sw = smask.width;
  46850. sh = smask.height;
  46851. alphaBuf = new Uint8ClampedArray(sw * sh);
  46852. smask.fillGrayBuffer(alphaBuf);
  46853. if (sw !== width || sh !== height) {
  46854. alphaBuf = resizeImageMask(alphaBuf, smask.bpc, sw, sh, width, height);
  46855. }
  46856. } else if (mask) {
  46857. if (mask instanceof PDFImage) {
  46858. sw = mask.width;
  46859. sh = mask.height;
  46860. alphaBuf = new Uint8ClampedArray(sw * sh);
  46861. mask.numComps = 1;
  46862. mask.fillGrayBuffer(alphaBuf);
  46863. for (i = 0, ii = sw * sh; i < ii; ++i) {
  46864. alphaBuf[i] = 255 - alphaBuf[i];
  46865. }
  46866. if (sw !== width || sh !== height) {
  46867. alphaBuf = resizeImageMask(alphaBuf, mask.bpc, sw, sh, width, height);
  46868. }
  46869. } else if (Array.isArray(mask)) {
  46870. alphaBuf = new Uint8ClampedArray(width * height);
  46871. const numComps = this.numComps;
  46872. for (i = 0, ii = width * height; i < ii; ++i) {
  46873. let opacity = 0;
  46874. const imageOffset = i * numComps;
  46875. for (j = 0; j < numComps; ++j) {
  46876. const color = image[imageOffset + j];
  46877. const maskOffset = j * 2;
  46878. if (color < mask[maskOffset] || color > mask[maskOffset + 1]) {
  46879. opacity = 255;
  46880. break;
  46881. }
  46882. }
  46883. alphaBuf[i] = opacity;
  46884. }
  46885. } else {
  46886. throw new _util.FormatError("Unknown mask format.");
  46887. }
  46888. }
  46889. if (alphaBuf) {
  46890. for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
  46891. rgbaBuf[j] = alphaBuf[i];
  46892. }
  46893. } else {
  46894. for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
  46895. rgbaBuf[j] = 255;
  46896. }
  46897. }
  46898. }
  46899. undoPreblend(buffer, width, height) {
  46900. const matte = this.smask && this.smask.matte;
  46901. if (!matte) {
  46902. return;
  46903. }
  46904. const matteRgb = this.colorSpace.getRgb(matte, 0);
  46905. const matteR = matteRgb[0];
  46906. const matteG = matteRgb[1];
  46907. const matteB = matteRgb[2];
  46908. const length = width * height * 4;
  46909. for (let i = 0; i < length; i += 4) {
  46910. const alpha = buffer[i + 3];
  46911. if (alpha === 0) {
  46912. buffer[i] = 255;
  46913. buffer[i + 1] = 255;
  46914. buffer[i + 2] = 255;
  46915. continue;
  46916. }
  46917. const k = 255 / alpha;
  46918. buffer[i] = (buffer[i] - matteR) * k + matteR;
  46919. buffer[i + 1] = (buffer[i + 1] - matteG) * k + matteG;
  46920. buffer[i + 2] = (buffer[i + 2] - matteB) * k + matteB;
  46921. }
  46922. }
  46923. createImageData(forceRGBA = false) {
  46924. const drawWidth = this.drawWidth;
  46925. const drawHeight = this.drawHeight;
  46926. const imgData = {
  46927. width: drawWidth,
  46928. height: drawHeight,
  46929. interpolate: this.interpolate,
  46930. kind: 0,
  46931. data: null
  46932. };
  46933. const numComps = this.numComps;
  46934. const originalWidth = this.width;
  46935. const originalHeight = this.height;
  46936. const bpc = this.bpc;
  46937. const rowBytes = originalWidth * numComps * bpc + 7 >> 3;
  46938. if (!forceRGBA) {
  46939. let kind;
  46940. if (this.colorSpace.name === "DeviceGray" && bpc === 1) {
  46941. kind = _util.ImageKind.GRAYSCALE_1BPP;
  46942. } else if (this.colorSpace.name === "DeviceRGB" && bpc === 8 && !this.needsDecode) {
  46943. kind = _util.ImageKind.RGB_24BPP;
  46944. }
  46945. if (kind && !this.smask && !this.mask && drawWidth === originalWidth && drawHeight === originalHeight) {
  46946. imgData.kind = kind;
  46947. imgData.data = this.getImageBytes(originalHeight * rowBytes, {});
  46948. if (this.needsDecode) {
  46949. (0, _util.assert)(kind === _util.ImageKind.GRAYSCALE_1BPP, "PDFImage.createImageData: The image must be grayscale.");
  46950. const buffer = imgData.data;
  46951. for (let i = 0, ii = buffer.length; i < ii; i++) {
  46952. buffer[i] ^= 0xff;
  46953. }
  46954. }
  46955. return imgData;
  46956. }
  46957. if (this.image instanceof _jpeg_stream.JpegStream && !this.smask && !this.mask) {
  46958. let imageLength = originalHeight * rowBytes;
  46959. switch (this.colorSpace.name) {
  46960. case "DeviceGray":
  46961. imageLength *= 3;
  46962. case "DeviceRGB":
  46963. case "DeviceCMYK":
  46964. imgData.kind = _util.ImageKind.RGB_24BPP;
  46965. imgData.data = this.getImageBytes(imageLength, {
  46966. drawWidth,
  46967. drawHeight,
  46968. forceRGB: true
  46969. });
  46970. return imgData;
  46971. }
  46972. }
  46973. }
  46974. const imgArray = this.getImageBytes(originalHeight * rowBytes, {
  46975. internal: true
  46976. });
  46977. const actualHeight = 0 | imgArray.length / rowBytes * drawHeight / originalHeight;
  46978. const comps = this.getComponents(imgArray);
  46979. let alpha01, maybeUndoPreblend;
  46980. if (!forceRGBA && !this.smask && !this.mask) {
  46981. imgData.kind = _util.ImageKind.RGB_24BPP;
  46982. imgData.data = new Uint8ClampedArray(drawWidth * drawHeight * 3);
  46983. alpha01 = 0;
  46984. maybeUndoPreblend = false;
  46985. } else {
  46986. imgData.kind = _util.ImageKind.RGBA_32BPP;
  46987. imgData.data = new Uint8ClampedArray(drawWidth * drawHeight * 4);
  46988. alpha01 = 1;
  46989. maybeUndoPreblend = true;
  46990. this.fillOpacity(imgData.data, drawWidth, drawHeight, actualHeight, comps);
  46991. }
  46992. if (this.needsDecode) {
  46993. this.decodeBuffer(comps);
  46994. }
  46995. this.colorSpace.fillRgb(imgData.data, originalWidth, originalHeight, drawWidth, drawHeight, actualHeight, bpc, comps, alpha01);
  46996. if (maybeUndoPreblend) {
  46997. this.undoPreblend(imgData.data, drawWidth, actualHeight);
  46998. }
  46999. return imgData;
  47000. }
  47001. fillGrayBuffer(buffer) {
  47002. const numComps = this.numComps;
  47003. if (numComps !== 1) {
  47004. throw new _util.FormatError(`Reading gray scale from a color image: ${numComps}`);
  47005. }
  47006. const width = this.width;
  47007. const height = this.height;
  47008. const bpc = this.bpc;
  47009. const rowBytes = width * numComps * bpc + 7 >> 3;
  47010. const imgArray = this.getImageBytes(height * rowBytes, {
  47011. internal: true
  47012. });
  47013. const comps = this.getComponents(imgArray);
  47014. let i, length;
  47015. if (bpc === 1) {
  47016. length = width * height;
  47017. if (this.needsDecode) {
  47018. for (i = 0; i < length; ++i) {
  47019. buffer[i] = comps[i] - 1 & 255;
  47020. }
  47021. } else {
  47022. for (i = 0; i < length; ++i) {
  47023. buffer[i] = -comps[i] & 255;
  47024. }
  47025. }
  47026. return;
  47027. }
  47028. if (this.needsDecode) {
  47029. this.decodeBuffer(comps);
  47030. }
  47031. length = width * height;
  47032. const scale = 255 / ((1 << bpc) - 1);
  47033. for (i = 0; i < length; ++i) {
  47034. buffer[i] = scale * comps[i];
  47035. }
  47036. }
  47037. getImageBytes(length, {
  47038. drawWidth,
  47039. drawHeight,
  47040. forceRGB = false,
  47041. internal = false
  47042. }) {
  47043. this.image.reset();
  47044. this.image.drawWidth = drawWidth || this.width;
  47045. this.image.drawHeight = drawHeight || this.height;
  47046. this.image.forceRGB = !!forceRGB;
  47047. const imageBytes = this.image.getBytes(length);
  47048. if (internal || this.image instanceof _decode_stream.DecodeStream) {
  47049. return imageBytes;
  47050. }
  47051. (0, _util.assert)(imageBytes instanceof Uint8Array, 'PDFImage.getImageBytes: Unsupported "imageBytes" type.');
  47052. return new Uint8Array(imageBytes);
  47053. }
  47054. }
  47055. exports.PDFImage = PDFImage;
  47056. /***/ }),
  47057. /* 64 */
  47058. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  47059. Object.defineProperty(exports, "__esModule", ({
  47060. value: true
  47061. }));
  47062. exports.applyMaskImageData = applyMaskImageData;
  47063. var _util = __w_pdfjs_require__(2);
  47064. function applyMaskImageData({
  47065. src,
  47066. srcPos = 0,
  47067. dest,
  47068. destPos = 0,
  47069. width,
  47070. height,
  47071. inverseDecode = false
  47072. }) {
  47073. const opaque = _util.FeatureTest.isLittleEndian ? 0xff000000 : 0x000000ff;
  47074. const [zeroMapping, oneMapping] = !inverseDecode ? [opaque, 0] : [0, opaque];
  47075. const widthInSource = width >> 3;
  47076. const widthRemainder = width & 7;
  47077. const srcLength = src.length;
  47078. dest = new Uint32Array(dest.buffer);
  47079. for (let i = 0; i < height; i++) {
  47080. for (const max = srcPos + widthInSource; srcPos < max; srcPos++) {
  47081. const elem = srcPos < srcLength ? src[srcPos] : 255;
  47082. dest[destPos++] = elem & 0b10000000 ? oneMapping : zeroMapping;
  47083. dest[destPos++] = elem & 0b1000000 ? oneMapping : zeroMapping;
  47084. dest[destPos++] = elem & 0b100000 ? oneMapping : zeroMapping;
  47085. dest[destPos++] = elem & 0b10000 ? oneMapping : zeroMapping;
  47086. dest[destPos++] = elem & 0b1000 ? oneMapping : zeroMapping;
  47087. dest[destPos++] = elem & 0b100 ? oneMapping : zeroMapping;
  47088. dest[destPos++] = elem & 0b10 ? oneMapping : zeroMapping;
  47089. dest[destPos++] = elem & 0b1 ? oneMapping : zeroMapping;
  47090. }
  47091. if (widthRemainder === 0) {
  47092. continue;
  47093. }
  47094. const elem = srcPos < srcLength ? src[srcPos++] : 255;
  47095. for (let j = 0; j < widthRemainder; j++) {
  47096. dest[destPos++] = elem & 1 << 7 - j ? oneMapping : zeroMapping;
  47097. }
  47098. }
  47099. return {
  47100. srcPos,
  47101. destPos
  47102. };
  47103. }
  47104. /***/ }),
  47105. /* 65 */
  47106. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  47107. Object.defineProperty(exports, "__esModule", ({
  47108. value: true
  47109. }));
  47110. exports.incrementalUpdate = incrementalUpdate;
  47111. exports.writeDict = writeDict;
  47112. exports.writeObject = writeObject;
  47113. var _util = __w_pdfjs_require__(2);
  47114. var _primitives = __w_pdfjs_require__(5);
  47115. var _core_utils = __w_pdfjs_require__(6);
  47116. var _xml_parser = __w_pdfjs_require__(66);
  47117. var _base_stream = __w_pdfjs_require__(7);
  47118. var _crypto = __w_pdfjs_require__(67);
  47119. function writeObject(ref, obj, buffer, transform) {
  47120. buffer.push(`${ref.num} ${ref.gen} obj\n`);
  47121. if (obj instanceof _primitives.Dict) {
  47122. writeDict(obj, buffer, transform);
  47123. } else if (obj instanceof _base_stream.BaseStream) {
  47124. writeStream(obj, buffer, transform);
  47125. }
  47126. buffer.push("\nendobj\n");
  47127. }
  47128. function writeDict(dict, buffer, transform) {
  47129. buffer.push("<<");
  47130. for (const key of dict.getKeys()) {
  47131. buffer.push(` /${(0, _core_utils.escapePDFName)(key)} `);
  47132. writeValue(dict.getRaw(key), buffer, transform);
  47133. }
  47134. buffer.push(">>");
  47135. }
  47136. function writeStream(stream, buffer, transform) {
  47137. writeDict(stream.dict, buffer, transform);
  47138. buffer.push(" stream\n");
  47139. let string = stream.getString();
  47140. if (transform !== null) {
  47141. string = transform.encryptString(string);
  47142. }
  47143. buffer.push(string, "\nendstream\n");
  47144. }
  47145. function writeArray(array, buffer, transform) {
  47146. buffer.push("[");
  47147. let first = true;
  47148. for (const val of array) {
  47149. if (!first) {
  47150. buffer.push(" ");
  47151. } else {
  47152. first = false;
  47153. }
  47154. writeValue(val, buffer, transform);
  47155. }
  47156. buffer.push("]");
  47157. }
  47158. function writeValue(value, buffer, transform) {
  47159. if (value instanceof _primitives.Name) {
  47160. buffer.push(`/${(0, _core_utils.escapePDFName)(value.name)}`);
  47161. } else if (value instanceof _primitives.Ref) {
  47162. buffer.push(`${value.num} ${value.gen} R`);
  47163. } else if (Array.isArray(value)) {
  47164. writeArray(value, buffer, transform);
  47165. } else if (typeof value === "string") {
  47166. if (transform !== null) {
  47167. value = transform.encryptString(value);
  47168. }
  47169. buffer.push(`(${(0, _util.escapeString)(value)})`);
  47170. } else if (typeof value === "number") {
  47171. buffer.push((0, _core_utils.numberToString)(value));
  47172. } else if (typeof value === "boolean") {
  47173. buffer.push(value.toString());
  47174. } else if (value instanceof _primitives.Dict) {
  47175. writeDict(value, buffer, transform);
  47176. } else if (value instanceof _base_stream.BaseStream) {
  47177. writeStream(value, buffer, transform);
  47178. } else if (value === null) {
  47179. buffer.push("null");
  47180. } else {
  47181. (0, _util.warn)(`Unhandled value in writer: ${typeof value}, please file a bug.`);
  47182. }
  47183. }
  47184. function writeInt(number, size, offset, buffer) {
  47185. for (let i = size + offset - 1; i > offset - 1; i--) {
  47186. buffer[i] = number & 0xff;
  47187. number >>= 8;
  47188. }
  47189. return offset + size;
  47190. }
  47191. function writeString(string, offset, buffer) {
  47192. for (let i = 0, len = string.length; i < len; i++) {
  47193. buffer[offset + i] = string.charCodeAt(i) & 0xff;
  47194. }
  47195. }
  47196. function computeMD5(filesize, xrefInfo) {
  47197. const time = Math.floor(Date.now() / 1000);
  47198. const filename = xrefInfo.filename || "";
  47199. const md5Buffer = [time.toString(), filename, filesize.toString()];
  47200. let md5BufferLen = md5Buffer.reduce((a, str) => a + str.length, 0);
  47201. for (const value of Object.values(xrefInfo.info)) {
  47202. md5Buffer.push(value);
  47203. md5BufferLen += value.length;
  47204. }
  47205. const array = new Uint8Array(md5BufferLen);
  47206. let offset = 0;
  47207. for (const str of md5Buffer) {
  47208. writeString(str, offset, array);
  47209. offset += str.length;
  47210. }
  47211. return (0, _util.bytesToString)((0, _crypto.calculateMD5)(array));
  47212. }
  47213. function writeXFADataForAcroform(str, newRefs) {
  47214. const xml = new _xml_parser.SimpleXMLParser({
  47215. hasAttributes: true
  47216. }).parseFromString(str);
  47217. for (const {
  47218. xfa
  47219. } of newRefs) {
  47220. if (!xfa) {
  47221. continue;
  47222. }
  47223. const {
  47224. path,
  47225. value
  47226. } = xfa;
  47227. if (!path) {
  47228. continue;
  47229. }
  47230. const node = xml.documentElement.searchNode((0, _core_utils.parseXFAPath)(path), 0);
  47231. if (node) {
  47232. if (Array.isArray(value)) {
  47233. node.childNodes = value.map(val => new _xml_parser.SimpleDOMNode("value", val));
  47234. } else {
  47235. node.childNodes = [new _xml_parser.SimpleDOMNode("#text", value)];
  47236. }
  47237. } else {
  47238. (0, _util.warn)(`Node not found for path: ${path}`);
  47239. }
  47240. }
  47241. const buffer = [];
  47242. xml.documentElement.dump(buffer);
  47243. return buffer.join("");
  47244. }
  47245. function updateXFA({
  47246. xfaData,
  47247. xfaDatasetsRef,
  47248. hasXfaDatasetsEntry,
  47249. acroFormRef,
  47250. acroForm,
  47251. newRefs,
  47252. xref,
  47253. xrefInfo
  47254. }) {
  47255. if (xref === null) {
  47256. return;
  47257. }
  47258. if (!hasXfaDatasetsEntry) {
  47259. if (!acroFormRef) {
  47260. (0, _util.warn)("XFA - Cannot save it");
  47261. return;
  47262. }
  47263. const oldXfa = acroForm.get("XFA");
  47264. const newXfa = oldXfa.slice();
  47265. newXfa.splice(2, 0, "datasets");
  47266. newXfa.splice(3, 0, xfaDatasetsRef);
  47267. acroForm.set("XFA", newXfa);
  47268. const encrypt = xref.encrypt;
  47269. let transform = null;
  47270. if (encrypt) {
  47271. transform = encrypt.createCipherTransform(acroFormRef.num, acroFormRef.gen);
  47272. }
  47273. const buffer = [`${acroFormRef.num} ${acroFormRef.gen} obj\n`];
  47274. writeDict(acroForm, buffer, transform);
  47275. buffer.push("\n");
  47276. acroForm.set("XFA", oldXfa);
  47277. newRefs.push({
  47278. ref: acroFormRef,
  47279. data: buffer.join("")
  47280. });
  47281. }
  47282. if (xfaData === null) {
  47283. const datasets = xref.fetchIfRef(xfaDatasetsRef);
  47284. xfaData = writeXFADataForAcroform(datasets.getString(), newRefs);
  47285. }
  47286. const encrypt = xref.encrypt;
  47287. if (encrypt) {
  47288. const transform = encrypt.createCipherTransform(xfaDatasetsRef.num, xfaDatasetsRef.gen);
  47289. xfaData = transform.encryptString(xfaData);
  47290. }
  47291. const data = `${xfaDatasetsRef.num} ${xfaDatasetsRef.gen} obj\n` + `<< /Type /EmbeddedFile /Length ${xfaData.length}>>\nstream\n` + xfaData + "\nendstream\nendobj\n";
  47292. newRefs.push({
  47293. ref: xfaDatasetsRef,
  47294. data
  47295. });
  47296. }
  47297. function incrementalUpdate({
  47298. originalData,
  47299. xrefInfo,
  47300. newRefs,
  47301. xref = null,
  47302. hasXfa = false,
  47303. xfaDatasetsRef = null,
  47304. hasXfaDatasetsEntry = false,
  47305. acroFormRef = null,
  47306. acroForm = null,
  47307. xfaData = null
  47308. }) {
  47309. if (hasXfa) {
  47310. updateXFA({
  47311. xfaData,
  47312. xfaDatasetsRef,
  47313. hasXfaDatasetsEntry,
  47314. acroFormRef,
  47315. acroForm,
  47316. newRefs,
  47317. xref,
  47318. xrefInfo
  47319. });
  47320. }
  47321. const newXref = new _primitives.Dict(null);
  47322. const refForXrefTable = xrefInfo.newRef;
  47323. let buffer, baseOffset;
  47324. const lastByte = originalData.at(-1);
  47325. if (lastByte === 0x0a || lastByte === 0x0d) {
  47326. buffer = [];
  47327. baseOffset = originalData.length;
  47328. } else {
  47329. buffer = ["\n"];
  47330. baseOffset = originalData.length + 1;
  47331. }
  47332. newXref.set("Size", refForXrefTable.num + 1);
  47333. newXref.set("Prev", xrefInfo.startXRef);
  47334. newXref.set("Type", _primitives.Name.get("XRef"));
  47335. if (xrefInfo.rootRef !== null) {
  47336. newXref.set("Root", xrefInfo.rootRef);
  47337. }
  47338. if (xrefInfo.infoRef !== null) {
  47339. newXref.set("Info", xrefInfo.infoRef);
  47340. }
  47341. if (xrefInfo.encryptRef !== null) {
  47342. newXref.set("Encrypt", xrefInfo.encryptRef);
  47343. }
  47344. newRefs.push({
  47345. ref: refForXrefTable,
  47346. data: ""
  47347. });
  47348. newRefs = newRefs.sort((a, b) => {
  47349. return a.ref.num - b.ref.num;
  47350. });
  47351. const xrefTableData = [[0, 1, 0xffff]];
  47352. const indexes = [0, 1];
  47353. let maxOffset = 0;
  47354. for (const {
  47355. ref,
  47356. data
  47357. } of newRefs) {
  47358. maxOffset = Math.max(maxOffset, baseOffset);
  47359. xrefTableData.push([1, baseOffset, Math.min(ref.gen, 0xffff)]);
  47360. baseOffset += data.length;
  47361. indexes.push(ref.num, 1);
  47362. buffer.push(data);
  47363. }
  47364. newXref.set("Index", indexes);
  47365. if (Array.isArray(xrefInfo.fileIds) && xrefInfo.fileIds.length > 0) {
  47366. const md5 = computeMD5(baseOffset, xrefInfo);
  47367. newXref.set("ID", [xrefInfo.fileIds[0], md5]);
  47368. }
  47369. const offsetSize = Math.ceil(Math.log2(maxOffset) / 8);
  47370. const sizes = [1, offsetSize, 2];
  47371. const structSize = sizes[0] + sizes[1] + sizes[2];
  47372. const tableLength = structSize * xrefTableData.length;
  47373. newXref.set("W", sizes);
  47374. newXref.set("Length", tableLength);
  47375. buffer.push(`${refForXrefTable.num} ${refForXrefTable.gen} obj\n`);
  47376. writeDict(newXref, buffer, null);
  47377. buffer.push(" stream\n");
  47378. const bufferLen = buffer.reduce((a, str) => a + str.length, 0);
  47379. const footer = `\nendstream\nendobj\nstartxref\n${baseOffset}\n%%EOF\n`;
  47380. const array = new Uint8Array(originalData.length + bufferLen + tableLength + footer.length);
  47381. array.set(originalData);
  47382. let offset = originalData.length;
  47383. for (const str of buffer) {
  47384. writeString(str, offset, array);
  47385. offset += str.length;
  47386. }
  47387. for (const [type, objOffset, gen] of xrefTableData) {
  47388. offset = writeInt(type, sizes[0], offset, array);
  47389. offset = writeInt(objOffset, sizes[1], offset, array);
  47390. offset = writeInt(gen, sizes[2], offset, array);
  47391. }
  47392. writeString(footer, offset, array);
  47393. return array;
  47394. }
  47395. /***/ }),
  47396. /* 66 */
  47397. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  47398. Object.defineProperty(exports, "__esModule", ({
  47399. value: true
  47400. }));
  47401. exports.XMLParserErrorCode = exports.XMLParserBase = exports.SimpleXMLParser = exports.SimpleDOMNode = void 0;
  47402. var _core_utils = __w_pdfjs_require__(6);
  47403. const XMLParserErrorCode = {
  47404. NoError: 0,
  47405. EndOfDocument: -1,
  47406. UnterminatedCdat: -2,
  47407. UnterminatedXmlDeclaration: -3,
  47408. UnterminatedDoctypeDeclaration: -4,
  47409. UnterminatedComment: -5,
  47410. MalformedElement: -6,
  47411. OutOfMemory: -7,
  47412. UnterminatedAttributeValue: -8,
  47413. UnterminatedElement: -9,
  47414. ElementNeverBegun: -10
  47415. };
  47416. exports.XMLParserErrorCode = XMLParserErrorCode;
  47417. function isWhitespace(s, index) {
  47418. const ch = s[index];
  47419. return ch === " " || ch === "\n" || ch === "\r" || ch === "\t";
  47420. }
  47421. function isWhitespaceString(s) {
  47422. for (let i = 0, ii = s.length; i < ii; i++) {
  47423. if (!isWhitespace(s, i)) {
  47424. return false;
  47425. }
  47426. }
  47427. return true;
  47428. }
  47429. class XMLParserBase {
  47430. _resolveEntities(s) {
  47431. return s.replace(/&([^;]+);/g, (all, entity) => {
  47432. if (entity.substring(0, 2) === "#x") {
  47433. return String.fromCodePoint(parseInt(entity.substring(2), 16));
  47434. } else if (entity.substring(0, 1) === "#") {
  47435. return String.fromCodePoint(parseInt(entity.substring(1), 10));
  47436. }
  47437. switch (entity) {
  47438. case "lt":
  47439. return "<";
  47440. case "gt":
  47441. return ">";
  47442. case "amp":
  47443. return "&";
  47444. case "quot":
  47445. return '"';
  47446. case "apos":
  47447. return "'";
  47448. }
  47449. return this.onResolveEntity(entity);
  47450. });
  47451. }
  47452. _parseContent(s, start) {
  47453. const attributes = [];
  47454. let pos = start;
  47455. function skipWs() {
  47456. while (pos < s.length && isWhitespace(s, pos)) {
  47457. ++pos;
  47458. }
  47459. }
  47460. while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== ">" && s[pos] !== "/") {
  47461. ++pos;
  47462. }
  47463. const name = s.substring(start, pos);
  47464. skipWs();
  47465. while (pos < s.length && s[pos] !== ">" && s[pos] !== "/" && s[pos] !== "?") {
  47466. skipWs();
  47467. let attrName = "",
  47468. attrValue = "";
  47469. while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== "=") {
  47470. attrName += s[pos];
  47471. ++pos;
  47472. }
  47473. skipWs();
  47474. if (s[pos] !== "=") {
  47475. return null;
  47476. }
  47477. ++pos;
  47478. skipWs();
  47479. const attrEndChar = s[pos];
  47480. if (attrEndChar !== '"' && attrEndChar !== "'") {
  47481. return null;
  47482. }
  47483. const attrEndIndex = s.indexOf(attrEndChar, ++pos);
  47484. if (attrEndIndex < 0) {
  47485. return null;
  47486. }
  47487. attrValue = s.substring(pos, attrEndIndex);
  47488. attributes.push({
  47489. name: attrName,
  47490. value: this._resolveEntities(attrValue)
  47491. });
  47492. pos = attrEndIndex + 1;
  47493. skipWs();
  47494. }
  47495. return {
  47496. name,
  47497. attributes,
  47498. parsed: pos - start
  47499. };
  47500. }
  47501. _parseProcessingInstruction(s, start) {
  47502. let pos = start;
  47503. function skipWs() {
  47504. while (pos < s.length && isWhitespace(s, pos)) {
  47505. ++pos;
  47506. }
  47507. }
  47508. while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== ">" && s[pos] !== "?" && s[pos] !== "/") {
  47509. ++pos;
  47510. }
  47511. const name = s.substring(start, pos);
  47512. skipWs();
  47513. const attrStart = pos;
  47514. while (pos < s.length && (s[pos] !== "?" || s[pos + 1] !== ">")) {
  47515. ++pos;
  47516. }
  47517. const value = s.substring(attrStart, pos);
  47518. return {
  47519. name,
  47520. value,
  47521. parsed: pos - start
  47522. };
  47523. }
  47524. parseXml(s) {
  47525. let i = 0;
  47526. while (i < s.length) {
  47527. const ch = s[i];
  47528. let j = i;
  47529. if (ch === "<") {
  47530. ++j;
  47531. const ch2 = s[j];
  47532. let q;
  47533. switch (ch2) {
  47534. case "/":
  47535. ++j;
  47536. q = s.indexOf(">", j);
  47537. if (q < 0) {
  47538. this.onError(XMLParserErrorCode.UnterminatedElement);
  47539. return;
  47540. }
  47541. this.onEndElement(s.substring(j, q));
  47542. j = q + 1;
  47543. break;
  47544. case "?":
  47545. ++j;
  47546. const pi = this._parseProcessingInstruction(s, j);
  47547. if (s.substring(j + pi.parsed, j + pi.parsed + 2) !== "?>") {
  47548. this.onError(XMLParserErrorCode.UnterminatedXmlDeclaration);
  47549. return;
  47550. }
  47551. this.onPi(pi.name, pi.value);
  47552. j += pi.parsed + 2;
  47553. break;
  47554. case "!":
  47555. if (s.substring(j + 1, j + 3) === "--") {
  47556. q = s.indexOf("-->", j + 3);
  47557. if (q < 0) {
  47558. this.onError(XMLParserErrorCode.UnterminatedComment);
  47559. return;
  47560. }
  47561. this.onComment(s.substring(j + 3, q));
  47562. j = q + 3;
  47563. } else if (s.substring(j + 1, j + 8) === "[CDATA[") {
  47564. q = s.indexOf("]]>", j + 8);
  47565. if (q < 0) {
  47566. this.onError(XMLParserErrorCode.UnterminatedCdat);
  47567. return;
  47568. }
  47569. this.onCdata(s.substring(j + 8, q));
  47570. j = q + 3;
  47571. } else if (s.substring(j + 1, j + 8) === "DOCTYPE") {
  47572. const q2 = s.indexOf("[", j + 8);
  47573. let complexDoctype = false;
  47574. q = s.indexOf(">", j + 8);
  47575. if (q < 0) {
  47576. this.onError(XMLParserErrorCode.UnterminatedDoctypeDeclaration);
  47577. return;
  47578. }
  47579. if (q2 > 0 && q > q2) {
  47580. q = s.indexOf("]>", j + 8);
  47581. if (q < 0) {
  47582. this.onError(XMLParserErrorCode.UnterminatedDoctypeDeclaration);
  47583. return;
  47584. }
  47585. complexDoctype = true;
  47586. }
  47587. const doctypeContent = s.substring(j + 8, q + (complexDoctype ? 1 : 0));
  47588. this.onDoctype(doctypeContent);
  47589. j = q + (complexDoctype ? 2 : 1);
  47590. } else {
  47591. this.onError(XMLParserErrorCode.MalformedElement);
  47592. return;
  47593. }
  47594. break;
  47595. default:
  47596. const content = this._parseContent(s, j);
  47597. if (content === null) {
  47598. this.onError(XMLParserErrorCode.MalformedElement);
  47599. return;
  47600. }
  47601. let isClosed = false;
  47602. if (s.substring(j + content.parsed, j + content.parsed + 2) === "/>") {
  47603. isClosed = true;
  47604. } else if (s.substring(j + content.parsed, j + content.parsed + 1) !== ">") {
  47605. this.onError(XMLParserErrorCode.UnterminatedElement);
  47606. return;
  47607. }
  47608. this.onBeginElement(content.name, content.attributes, isClosed);
  47609. j += content.parsed + (isClosed ? 2 : 1);
  47610. break;
  47611. }
  47612. } else {
  47613. while (j < s.length && s[j] !== "<") {
  47614. j++;
  47615. }
  47616. const text = s.substring(i, j);
  47617. this.onText(this._resolveEntities(text));
  47618. }
  47619. i = j;
  47620. }
  47621. }
  47622. onResolveEntity(name) {
  47623. return `&${name};`;
  47624. }
  47625. onPi(name, value) {}
  47626. onComment(text) {}
  47627. onCdata(text) {}
  47628. onDoctype(doctypeContent) {}
  47629. onText(text) {}
  47630. onBeginElement(name, attributes, isEmpty) {}
  47631. onEndElement(name) {}
  47632. onError(code) {}
  47633. }
  47634. exports.XMLParserBase = XMLParserBase;
  47635. class SimpleDOMNode {
  47636. constructor(nodeName, nodeValue) {
  47637. this.nodeName = nodeName;
  47638. this.nodeValue = nodeValue;
  47639. Object.defineProperty(this, "parentNode", {
  47640. value: null,
  47641. writable: true
  47642. });
  47643. }
  47644. get firstChild() {
  47645. return this.childNodes && this.childNodes[0];
  47646. }
  47647. get nextSibling() {
  47648. const childNodes = this.parentNode.childNodes;
  47649. if (!childNodes) {
  47650. return undefined;
  47651. }
  47652. const index = childNodes.indexOf(this);
  47653. if (index === -1) {
  47654. return undefined;
  47655. }
  47656. return childNodes[index + 1];
  47657. }
  47658. get textContent() {
  47659. if (!this.childNodes) {
  47660. return this.nodeValue || "";
  47661. }
  47662. return this.childNodes.map(function (child) {
  47663. return child.textContent;
  47664. }).join("");
  47665. }
  47666. get children() {
  47667. return this.childNodes || [];
  47668. }
  47669. hasChildNodes() {
  47670. return this.childNodes && this.childNodes.length > 0;
  47671. }
  47672. searchNode(paths, pos) {
  47673. if (pos >= paths.length) {
  47674. return this;
  47675. }
  47676. const component = paths[pos];
  47677. const stack = [];
  47678. let node = this;
  47679. while (true) {
  47680. if (component.name === node.nodeName) {
  47681. if (component.pos === 0) {
  47682. const res = node.searchNode(paths, pos + 1);
  47683. if (res !== null) {
  47684. return res;
  47685. }
  47686. } else if (stack.length === 0) {
  47687. return null;
  47688. } else {
  47689. const [parent] = stack.pop();
  47690. let siblingPos = 0;
  47691. for (const child of parent.childNodes) {
  47692. if (component.name === child.nodeName) {
  47693. if (siblingPos === component.pos) {
  47694. return child.searchNode(paths, pos + 1);
  47695. }
  47696. siblingPos++;
  47697. }
  47698. }
  47699. return node.searchNode(paths, pos + 1);
  47700. }
  47701. }
  47702. if (node.childNodes && node.childNodes.length !== 0) {
  47703. stack.push([node, 0]);
  47704. node = node.childNodes[0];
  47705. } else if (stack.length === 0) {
  47706. return null;
  47707. } else {
  47708. while (stack.length !== 0) {
  47709. const [parent, currentPos] = stack.pop();
  47710. const newPos = currentPos + 1;
  47711. if (newPos < parent.childNodes.length) {
  47712. stack.push([parent, newPos]);
  47713. node = parent.childNodes[newPos];
  47714. break;
  47715. }
  47716. }
  47717. if (stack.length === 0) {
  47718. return null;
  47719. }
  47720. }
  47721. }
  47722. }
  47723. dump(buffer) {
  47724. if (this.nodeName === "#text") {
  47725. buffer.push((0, _core_utils.encodeToXmlString)(this.nodeValue));
  47726. return;
  47727. }
  47728. buffer.push(`<${this.nodeName}`);
  47729. if (this.attributes) {
  47730. for (const attribute of this.attributes) {
  47731. buffer.push(` ${attribute.name}="${(0, _core_utils.encodeToXmlString)(attribute.value)}"`);
  47732. }
  47733. }
  47734. if (this.hasChildNodes()) {
  47735. buffer.push(">");
  47736. for (const child of this.childNodes) {
  47737. child.dump(buffer);
  47738. }
  47739. buffer.push(`</${this.nodeName}>`);
  47740. } else if (this.nodeValue) {
  47741. buffer.push(`>${(0, _core_utils.encodeToXmlString)(this.nodeValue)}</${this.nodeName}>`);
  47742. } else {
  47743. buffer.push("/>");
  47744. }
  47745. }
  47746. }
  47747. exports.SimpleDOMNode = SimpleDOMNode;
  47748. class SimpleXMLParser extends XMLParserBase {
  47749. constructor({
  47750. hasAttributes = false,
  47751. lowerCaseName = false
  47752. }) {
  47753. super();
  47754. this._currentFragment = null;
  47755. this._stack = null;
  47756. this._errorCode = XMLParserErrorCode.NoError;
  47757. this._hasAttributes = hasAttributes;
  47758. this._lowerCaseName = lowerCaseName;
  47759. }
  47760. parseFromString(data) {
  47761. this._currentFragment = [];
  47762. this._stack = [];
  47763. this._errorCode = XMLParserErrorCode.NoError;
  47764. this.parseXml(data);
  47765. if (this._errorCode !== XMLParserErrorCode.NoError) {
  47766. return undefined;
  47767. }
  47768. const [documentElement] = this._currentFragment;
  47769. if (!documentElement) {
  47770. return undefined;
  47771. }
  47772. return {
  47773. documentElement
  47774. };
  47775. }
  47776. onText(text) {
  47777. if (isWhitespaceString(text)) {
  47778. return;
  47779. }
  47780. const node = new SimpleDOMNode("#text", text);
  47781. this._currentFragment.push(node);
  47782. }
  47783. onCdata(text) {
  47784. const node = new SimpleDOMNode("#text", text);
  47785. this._currentFragment.push(node);
  47786. }
  47787. onBeginElement(name, attributes, isEmpty) {
  47788. if (this._lowerCaseName) {
  47789. name = name.toLowerCase();
  47790. }
  47791. const node = new SimpleDOMNode(name);
  47792. node.childNodes = [];
  47793. if (this._hasAttributes) {
  47794. node.attributes = attributes;
  47795. }
  47796. this._currentFragment.push(node);
  47797. if (isEmpty) {
  47798. return;
  47799. }
  47800. this._stack.push(this._currentFragment);
  47801. this._currentFragment = node.childNodes;
  47802. }
  47803. onEndElement(name) {
  47804. this._currentFragment = this._stack.pop() || [];
  47805. const lastElement = this._currentFragment.at(-1);
  47806. if (!lastElement) {
  47807. return null;
  47808. }
  47809. for (let i = 0, ii = lastElement.childNodes.length; i < ii; i++) {
  47810. lastElement.childNodes[i].parentNode = lastElement;
  47811. }
  47812. return lastElement;
  47813. }
  47814. onError(code) {
  47815. this._errorCode = code;
  47816. }
  47817. }
  47818. exports.SimpleXMLParser = SimpleXMLParser;
  47819. /***/ }),
  47820. /* 67 */
  47821. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  47822. Object.defineProperty(exports, "__esModule", ({
  47823. value: true
  47824. }));
  47825. exports.calculateSHA256 = exports.calculateMD5 = exports.PDF20 = exports.PDF17 = exports.CipherTransformFactory = exports.ARCFourCipher = exports.AES256Cipher = exports.AES128Cipher = void 0;
  47826. exports.calculateSHA384 = calculateSHA384;
  47827. exports.calculateSHA512 = void 0;
  47828. var _util = __w_pdfjs_require__(2);
  47829. var _primitives = __w_pdfjs_require__(5);
  47830. var _decrypt_stream = __w_pdfjs_require__(68);
  47831. class ARCFourCipher {
  47832. constructor(key) {
  47833. this.a = 0;
  47834. this.b = 0;
  47835. const s = new Uint8Array(256);
  47836. const keyLength = key.length;
  47837. for (let i = 0; i < 256; ++i) {
  47838. s[i] = i;
  47839. }
  47840. for (let i = 0, j = 0; i < 256; ++i) {
  47841. const tmp = s[i];
  47842. j = j + tmp + key[i % keyLength] & 0xff;
  47843. s[i] = s[j];
  47844. s[j] = tmp;
  47845. }
  47846. this.s = s;
  47847. }
  47848. encryptBlock(data) {
  47849. let a = this.a,
  47850. b = this.b;
  47851. const s = this.s;
  47852. const n = data.length;
  47853. const output = new Uint8Array(n);
  47854. for (let i = 0; i < n; ++i) {
  47855. a = a + 1 & 0xff;
  47856. const tmp = s[a];
  47857. b = b + tmp & 0xff;
  47858. const tmp2 = s[b];
  47859. s[a] = tmp2;
  47860. s[b] = tmp;
  47861. output[i] = data[i] ^ s[tmp + tmp2 & 0xff];
  47862. }
  47863. this.a = a;
  47864. this.b = b;
  47865. return output;
  47866. }
  47867. decryptBlock(data) {
  47868. return this.encryptBlock(data);
  47869. }
  47870. encrypt(data) {
  47871. return this.encryptBlock(data);
  47872. }
  47873. }
  47874. exports.ARCFourCipher = ARCFourCipher;
  47875. const calculateMD5 = function calculateMD5Closure() {
  47876. 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]);
  47877. 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]);
  47878. function hash(data, offset, length) {
  47879. let h0 = 1732584193,
  47880. h1 = -271733879,
  47881. h2 = -1732584194,
  47882. h3 = 271733878;
  47883. const paddedLength = length + 72 & ~63;
  47884. const padded = new Uint8Array(paddedLength);
  47885. let i, j;
  47886. for (i = 0; i < length; ++i) {
  47887. padded[i] = data[offset++];
  47888. }
  47889. padded[i++] = 0x80;
  47890. const n = paddedLength - 8;
  47891. while (i < n) {
  47892. padded[i++] = 0;
  47893. }
  47894. padded[i++] = length << 3 & 0xff;
  47895. padded[i++] = length >> 5 & 0xff;
  47896. padded[i++] = length >> 13 & 0xff;
  47897. padded[i++] = length >> 21 & 0xff;
  47898. padded[i++] = length >>> 29 & 0xff;
  47899. padded[i++] = 0;
  47900. padded[i++] = 0;
  47901. padded[i++] = 0;
  47902. const w = new Int32Array(16);
  47903. for (i = 0; i < paddedLength;) {
  47904. for (j = 0; j < 16; ++j, i += 4) {
  47905. w[j] = padded[i] | padded[i + 1] << 8 | padded[i + 2] << 16 | padded[i + 3] << 24;
  47906. }
  47907. let a = h0,
  47908. b = h1,
  47909. c = h2,
  47910. d = h3,
  47911. f,
  47912. g;
  47913. for (j = 0; j < 64; ++j) {
  47914. if (j < 16) {
  47915. f = b & c | ~b & d;
  47916. g = j;
  47917. } else if (j < 32) {
  47918. f = d & b | ~d & c;
  47919. g = 5 * j + 1 & 15;
  47920. } else if (j < 48) {
  47921. f = b ^ c ^ d;
  47922. g = 3 * j + 5 & 15;
  47923. } else {
  47924. f = c ^ (b | ~d);
  47925. g = 7 * j & 15;
  47926. }
  47927. const tmp = d,
  47928. rotateArg = a + f + k[j] + w[g] | 0,
  47929. rotate = r[j];
  47930. d = c;
  47931. c = b;
  47932. b = b + (rotateArg << rotate | rotateArg >>> 32 - rotate) | 0;
  47933. a = tmp;
  47934. }
  47935. h0 = h0 + a | 0;
  47936. h1 = h1 + b | 0;
  47937. h2 = h2 + c | 0;
  47938. h3 = h3 + d | 0;
  47939. }
  47940. 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]);
  47941. }
  47942. return hash;
  47943. }();
  47944. exports.calculateMD5 = calculateMD5;
  47945. class Word64 {
  47946. constructor(highInteger, lowInteger) {
  47947. this.high = highInteger | 0;
  47948. this.low = lowInteger | 0;
  47949. }
  47950. and(word) {
  47951. this.high &= word.high;
  47952. this.low &= word.low;
  47953. }
  47954. xor(word) {
  47955. this.high ^= word.high;
  47956. this.low ^= word.low;
  47957. }
  47958. or(word) {
  47959. this.high |= word.high;
  47960. this.low |= word.low;
  47961. }
  47962. shiftRight(places) {
  47963. if (places >= 32) {
  47964. this.low = this.high >>> places - 32 | 0;
  47965. this.high = 0;
  47966. } else {
  47967. this.low = this.low >>> places | this.high << 32 - places;
  47968. this.high = this.high >>> places | 0;
  47969. }
  47970. }
  47971. shiftLeft(places) {
  47972. if (places >= 32) {
  47973. this.high = this.low << places - 32;
  47974. this.low = 0;
  47975. } else {
  47976. this.high = this.high << places | this.low >>> 32 - places;
  47977. this.low <<= places;
  47978. }
  47979. }
  47980. rotateRight(places) {
  47981. let low, high;
  47982. if (places & 32) {
  47983. high = this.low;
  47984. low = this.high;
  47985. } else {
  47986. low = this.low;
  47987. high = this.high;
  47988. }
  47989. places &= 31;
  47990. this.low = low >>> places | high << 32 - places;
  47991. this.high = high >>> places | low << 32 - places;
  47992. }
  47993. not() {
  47994. this.high = ~this.high;
  47995. this.low = ~this.low;
  47996. }
  47997. add(word) {
  47998. const lowAdd = (this.low >>> 0) + (word.low >>> 0);
  47999. let highAdd = (this.high >>> 0) + (word.high >>> 0);
  48000. if (lowAdd > 0xffffffff) {
  48001. highAdd += 1;
  48002. }
  48003. this.low = lowAdd | 0;
  48004. this.high = highAdd | 0;
  48005. }
  48006. copyTo(bytes, offset) {
  48007. bytes[offset] = this.high >>> 24 & 0xff;
  48008. bytes[offset + 1] = this.high >> 16 & 0xff;
  48009. bytes[offset + 2] = this.high >> 8 & 0xff;
  48010. bytes[offset + 3] = this.high & 0xff;
  48011. bytes[offset + 4] = this.low >>> 24 & 0xff;
  48012. bytes[offset + 5] = this.low >> 16 & 0xff;
  48013. bytes[offset + 6] = this.low >> 8 & 0xff;
  48014. bytes[offset + 7] = this.low & 0xff;
  48015. }
  48016. assign(word) {
  48017. this.high = word.high;
  48018. this.low = word.low;
  48019. }
  48020. }
  48021. const calculateSHA256 = function calculateSHA256Closure() {
  48022. function rotr(x, n) {
  48023. return x >>> n | x << 32 - n;
  48024. }
  48025. function ch(x, y, z) {
  48026. return x & y ^ ~x & z;
  48027. }
  48028. function maj(x, y, z) {
  48029. return x & y ^ x & z ^ y & z;
  48030. }
  48031. function sigma(x) {
  48032. return rotr(x, 2) ^ rotr(x, 13) ^ rotr(x, 22);
  48033. }
  48034. function sigmaPrime(x) {
  48035. return rotr(x, 6) ^ rotr(x, 11) ^ rotr(x, 25);
  48036. }
  48037. function littleSigma(x) {
  48038. return rotr(x, 7) ^ rotr(x, 18) ^ x >>> 3;
  48039. }
  48040. function littleSigmaPrime(x) {
  48041. return rotr(x, 17) ^ rotr(x, 19) ^ x >>> 10;
  48042. }
  48043. 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];
  48044. function hash(data, offset, length) {
  48045. let h0 = 0x6a09e667,
  48046. h1 = 0xbb67ae85,
  48047. h2 = 0x3c6ef372,
  48048. h3 = 0xa54ff53a,
  48049. h4 = 0x510e527f,
  48050. h5 = 0x9b05688c,
  48051. h6 = 0x1f83d9ab,
  48052. h7 = 0x5be0cd19;
  48053. const paddedLength = Math.ceil((length + 9) / 64) * 64;
  48054. const padded = new Uint8Array(paddedLength);
  48055. let i, j;
  48056. for (i = 0; i < length; ++i) {
  48057. padded[i] = data[offset++];
  48058. }
  48059. padded[i++] = 0x80;
  48060. const n = paddedLength - 8;
  48061. while (i < n) {
  48062. padded[i++] = 0;
  48063. }
  48064. padded[i++] = 0;
  48065. padded[i++] = 0;
  48066. padded[i++] = 0;
  48067. padded[i++] = length >>> 29 & 0xff;
  48068. padded[i++] = length >> 21 & 0xff;
  48069. padded[i++] = length >> 13 & 0xff;
  48070. padded[i++] = length >> 5 & 0xff;
  48071. padded[i++] = length << 3 & 0xff;
  48072. const w = new Uint32Array(64);
  48073. for (i = 0; i < paddedLength;) {
  48074. for (j = 0; j < 16; ++j) {
  48075. w[j] = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
  48076. i += 4;
  48077. }
  48078. for (j = 16; j < 64; ++j) {
  48079. w[j] = littleSigmaPrime(w[j - 2]) + w[j - 7] + littleSigma(w[j - 15]) + w[j - 16] | 0;
  48080. }
  48081. let a = h0,
  48082. b = h1,
  48083. c = h2,
  48084. d = h3,
  48085. e = h4,
  48086. f = h5,
  48087. g = h6,
  48088. h = h7,
  48089. t1,
  48090. t2;
  48091. for (j = 0; j < 64; ++j) {
  48092. t1 = h + sigmaPrime(e) + ch(e, f, g) + k[j] + w[j];
  48093. t2 = sigma(a) + maj(a, b, c);
  48094. h = g;
  48095. g = f;
  48096. f = e;
  48097. e = d + t1 | 0;
  48098. d = c;
  48099. c = b;
  48100. b = a;
  48101. a = t1 + t2 | 0;
  48102. }
  48103. h0 = h0 + a | 0;
  48104. h1 = h1 + b | 0;
  48105. h2 = h2 + c | 0;
  48106. h3 = h3 + d | 0;
  48107. h4 = h4 + e | 0;
  48108. h5 = h5 + f | 0;
  48109. h6 = h6 + g | 0;
  48110. h7 = h7 + h | 0;
  48111. }
  48112. 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]);
  48113. }
  48114. return hash;
  48115. }();
  48116. exports.calculateSHA256 = calculateSHA256;
  48117. const calculateSHA512 = function calculateSHA512Closure() {
  48118. function ch(result, x, y, z, tmp) {
  48119. result.assign(x);
  48120. result.and(y);
  48121. tmp.assign(x);
  48122. tmp.not();
  48123. tmp.and(z);
  48124. result.xor(tmp);
  48125. }
  48126. function maj(result, x, y, z, tmp) {
  48127. result.assign(x);
  48128. result.and(y);
  48129. tmp.assign(x);
  48130. tmp.and(z);
  48131. result.xor(tmp);
  48132. tmp.assign(y);
  48133. tmp.and(z);
  48134. result.xor(tmp);
  48135. }
  48136. function sigma(result, x, tmp) {
  48137. result.assign(x);
  48138. result.rotateRight(28);
  48139. tmp.assign(x);
  48140. tmp.rotateRight(34);
  48141. result.xor(tmp);
  48142. tmp.assign(x);
  48143. tmp.rotateRight(39);
  48144. result.xor(tmp);
  48145. }
  48146. function sigmaPrime(result, x, tmp) {
  48147. result.assign(x);
  48148. result.rotateRight(14);
  48149. tmp.assign(x);
  48150. tmp.rotateRight(18);
  48151. result.xor(tmp);
  48152. tmp.assign(x);
  48153. tmp.rotateRight(41);
  48154. result.xor(tmp);
  48155. }
  48156. function littleSigma(result, x, tmp) {
  48157. result.assign(x);
  48158. result.rotateRight(1);
  48159. tmp.assign(x);
  48160. tmp.rotateRight(8);
  48161. result.xor(tmp);
  48162. tmp.assign(x);
  48163. tmp.shiftRight(7);
  48164. result.xor(tmp);
  48165. }
  48166. function littleSigmaPrime(result, x, tmp) {
  48167. result.assign(x);
  48168. result.rotateRight(19);
  48169. tmp.assign(x);
  48170. tmp.rotateRight(61);
  48171. result.xor(tmp);
  48172. tmp.assign(x);
  48173. tmp.shiftRight(6);
  48174. result.xor(tmp);
  48175. }
  48176. 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)];
  48177. function hash(data, offset, length, mode384 = false) {
  48178. let h0, h1, h2, h3, h4, h5, h6, h7;
  48179. if (!mode384) {
  48180. h0 = new Word64(0x6a09e667, 0xf3bcc908);
  48181. h1 = new Word64(0xbb67ae85, 0x84caa73b);
  48182. h2 = new Word64(0x3c6ef372, 0xfe94f82b);
  48183. h3 = new Word64(0xa54ff53a, 0x5f1d36f1);
  48184. h4 = new Word64(0x510e527f, 0xade682d1);
  48185. h5 = new Word64(0x9b05688c, 0x2b3e6c1f);
  48186. h6 = new Word64(0x1f83d9ab, 0xfb41bd6b);
  48187. h7 = new Word64(0x5be0cd19, 0x137e2179);
  48188. } else {
  48189. h0 = new Word64(0xcbbb9d5d, 0xc1059ed8);
  48190. h1 = new Word64(0x629a292a, 0x367cd507);
  48191. h2 = new Word64(0x9159015a, 0x3070dd17);
  48192. h3 = new Word64(0x152fecd8, 0xf70e5939);
  48193. h4 = new Word64(0x67332667, 0xffc00b31);
  48194. h5 = new Word64(0x8eb44a87, 0x68581511);
  48195. h6 = new Word64(0xdb0c2e0d, 0x64f98fa7);
  48196. h7 = new Word64(0x47b5481d, 0xbefa4fa4);
  48197. }
  48198. const paddedLength = Math.ceil((length + 17) / 128) * 128;
  48199. const padded = new Uint8Array(paddedLength);
  48200. let i, j;
  48201. for (i = 0; i < length; ++i) {
  48202. padded[i] = data[offset++];
  48203. }
  48204. padded[i++] = 0x80;
  48205. const n = paddedLength - 16;
  48206. while (i < n) {
  48207. padded[i++] = 0;
  48208. }
  48209. padded[i++] = 0;
  48210. padded[i++] = 0;
  48211. padded[i++] = 0;
  48212. padded[i++] = 0;
  48213. padded[i++] = 0;
  48214. padded[i++] = 0;
  48215. padded[i++] = 0;
  48216. padded[i++] = 0;
  48217. padded[i++] = 0;
  48218. padded[i++] = 0;
  48219. padded[i++] = 0;
  48220. padded[i++] = length >>> 29 & 0xff;
  48221. padded[i++] = length >> 21 & 0xff;
  48222. padded[i++] = length >> 13 & 0xff;
  48223. padded[i++] = length >> 5 & 0xff;
  48224. padded[i++] = length << 3 & 0xff;
  48225. const w = new Array(80);
  48226. for (i = 0; i < 80; i++) {
  48227. w[i] = new Word64(0, 0);
  48228. }
  48229. let a = new Word64(0, 0),
  48230. b = new Word64(0, 0),
  48231. c = new Word64(0, 0);
  48232. let d = new Word64(0, 0),
  48233. e = new Word64(0, 0),
  48234. f = new Word64(0, 0);
  48235. let g = new Word64(0, 0),
  48236. h = new Word64(0, 0);
  48237. const t1 = new Word64(0, 0),
  48238. t2 = new Word64(0, 0);
  48239. const tmp1 = new Word64(0, 0),
  48240. tmp2 = new Word64(0, 0);
  48241. let tmp3;
  48242. for (i = 0; i < paddedLength;) {
  48243. for (j = 0; j < 16; ++j) {
  48244. w[j].high = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
  48245. w[j].low = padded[i + 4] << 24 | padded[i + 5] << 16 | padded[i + 6] << 8 | padded[i + 7];
  48246. i += 8;
  48247. }
  48248. for (j = 16; j < 80; ++j) {
  48249. tmp3 = w[j];
  48250. littleSigmaPrime(tmp3, w[j - 2], tmp2);
  48251. tmp3.add(w[j - 7]);
  48252. littleSigma(tmp1, w[j - 15], tmp2);
  48253. tmp3.add(tmp1);
  48254. tmp3.add(w[j - 16]);
  48255. }
  48256. a.assign(h0);
  48257. b.assign(h1);
  48258. c.assign(h2);
  48259. d.assign(h3);
  48260. e.assign(h4);
  48261. f.assign(h5);
  48262. g.assign(h6);
  48263. h.assign(h7);
  48264. for (j = 0; j < 80; ++j) {
  48265. t1.assign(h);
  48266. sigmaPrime(tmp1, e, tmp2);
  48267. t1.add(tmp1);
  48268. ch(tmp1, e, f, g, tmp2);
  48269. t1.add(tmp1);
  48270. t1.add(k[j]);
  48271. t1.add(w[j]);
  48272. sigma(t2, a, tmp2);
  48273. maj(tmp1, a, b, c, tmp2);
  48274. t2.add(tmp1);
  48275. tmp3 = h;
  48276. h = g;
  48277. g = f;
  48278. f = e;
  48279. d.add(t1);
  48280. e = d;
  48281. d = c;
  48282. c = b;
  48283. b = a;
  48284. tmp3.assign(t1);
  48285. tmp3.add(t2);
  48286. a = tmp3;
  48287. }
  48288. h0.add(a);
  48289. h1.add(b);
  48290. h2.add(c);
  48291. h3.add(d);
  48292. h4.add(e);
  48293. h5.add(f);
  48294. h6.add(g);
  48295. h7.add(h);
  48296. }
  48297. let result;
  48298. if (!mode384) {
  48299. result = new Uint8Array(64);
  48300. h0.copyTo(result, 0);
  48301. h1.copyTo(result, 8);
  48302. h2.copyTo(result, 16);
  48303. h3.copyTo(result, 24);
  48304. h4.copyTo(result, 32);
  48305. h5.copyTo(result, 40);
  48306. h6.copyTo(result, 48);
  48307. h7.copyTo(result, 56);
  48308. } else {
  48309. result = new Uint8Array(48);
  48310. h0.copyTo(result, 0);
  48311. h1.copyTo(result, 8);
  48312. h2.copyTo(result, 16);
  48313. h3.copyTo(result, 24);
  48314. h4.copyTo(result, 32);
  48315. h5.copyTo(result, 40);
  48316. }
  48317. return result;
  48318. }
  48319. return hash;
  48320. }();
  48321. exports.calculateSHA512 = calculateSHA512;
  48322. function calculateSHA384(data, offset, length) {
  48323. return calculateSHA512(data, offset, length, true);
  48324. }
  48325. class NullCipher {
  48326. decryptBlock(data) {
  48327. return data;
  48328. }
  48329. encrypt(data) {
  48330. return data;
  48331. }
  48332. }
  48333. class AESBaseCipher {
  48334. constructor() {
  48335. if (this.constructor === AESBaseCipher) {
  48336. (0, _util.unreachable)("Cannot initialize AESBaseCipher.");
  48337. }
  48338. 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]);
  48339. 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]);
  48340. 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]);
  48341. this._mixCol = new Uint8Array(256);
  48342. for (let i = 0; i < 256; i++) {
  48343. if (i < 128) {
  48344. this._mixCol[i] = i << 1;
  48345. } else {
  48346. this._mixCol[i] = i << 1 ^ 0x1b;
  48347. }
  48348. }
  48349. this.buffer = new Uint8Array(16);
  48350. this.bufferPosition = 0;
  48351. }
  48352. _expandKey(cipherKey) {
  48353. (0, _util.unreachable)("Cannot call `_expandKey` on the base class");
  48354. }
  48355. _decrypt(input, key) {
  48356. let t, u, v;
  48357. const state = new Uint8Array(16);
  48358. state.set(input);
  48359. for (let j = 0, k = this._keySize; j < 16; ++j, ++k) {
  48360. state[j] ^= key[k];
  48361. }
  48362. for (let i = this._cyclesOfRepetition - 1; i >= 1; --i) {
  48363. t = state[13];
  48364. state[13] = state[9];
  48365. state[9] = state[5];
  48366. state[5] = state[1];
  48367. state[1] = t;
  48368. t = state[14];
  48369. u = state[10];
  48370. state[14] = state[6];
  48371. state[10] = state[2];
  48372. state[6] = t;
  48373. state[2] = u;
  48374. t = state[15];
  48375. u = state[11];
  48376. v = state[7];
  48377. state[15] = state[3];
  48378. state[11] = t;
  48379. state[7] = u;
  48380. state[3] = v;
  48381. for (let j = 0; j < 16; ++j) {
  48382. state[j] = this._inv_s[state[j]];
  48383. }
  48384. for (let j = 0, k = i * 16; j < 16; ++j, ++k) {
  48385. state[j] ^= key[k];
  48386. }
  48387. for (let j = 0; j < 16; j += 4) {
  48388. const s0 = this._mix[state[j]];
  48389. const s1 = this._mix[state[j + 1]];
  48390. const s2 = this._mix[state[j + 2]];
  48391. const s3 = this._mix[state[j + 3]];
  48392. t = s0 ^ s1 >>> 8 ^ s1 << 24 ^ s2 >>> 16 ^ s2 << 16 ^ s3 >>> 24 ^ s3 << 8;
  48393. state[j] = t >>> 24 & 0xff;
  48394. state[j + 1] = t >> 16 & 0xff;
  48395. state[j + 2] = t >> 8 & 0xff;
  48396. state[j + 3] = t & 0xff;
  48397. }
  48398. }
  48399. t = state[13];
  48400. state[13] = state[9];
  48401. state[9] = state[5];
  48402. state[5] = state[1];
  48403. state[1] = t;
  48404. t = state[14];
  48405. u = state[10];
  48406. state[14] = state[6];
  48407. state[10] = state[2];
  48408. state[6] = t;
  48409. state[2] = u;
  48410. t = state[15];
  48411. u = state[11];
  48412. v = state[7];
  48413. state[15] = state[3];
  48414. state[11] = t;
  48415. state[7] = u;
  48416. state[3] = v;
  48417. for (let j = 0; j < 16; ++j) {
  48418. state[j] = this._inv_s[state[j]];
  48419. state[j] ^= key[j];
  48420. }
  48421. return state;
  48422. }
  48423. _encrypt(input, key) {
  48424. const s = this._s;
  48425. let t, u, v;
  48426. const state = new Uint8Array(16);
  48427. state.set(input);
  48428. for (let j = 0; j < 16; ++j) {
  48429. state[j] ^= key[j];
  48430. }
  48431. for (let i = 1; i < this._cyclesOfRepetition; i++) {
  48432. for (let j = 0; j < 16; ++j) {
  48433. state[j] = s[state[j]];
  48434. }
  48435. v = state[1];
  48436. state[1] = state[5];
  48437. state[5] = state[9];
  48438. state[9] = state[13];
  48439. state[13] = v;
  48440. v = state[2];
  48441. u = state[6];
  48442. state[2] = state[10];
  48443. state[6] = state[14];
  48444. state[10] = v;
  48445. state[14] = u;
  48446. v = state[3];
  48447. u = state[7];
  48448. t = state[11];
  48449. state[3] = state[15];
  48450. state[7] = v;
  48451. state[11] = u;
  48452. state[15] = t;
  48453. for (let j = 0; j < 16; j += 4) {
  48454. const s0 = state[j + 0];
  48455. const s1 = state[j + 1];
  48456. const s2 = state[j + 2];
  48457. const s3 = state[j + 3];
  48458. t = s0 ^ s1 ^ s2 ^ s3;
  48459. state[j + 0] ^= t ^ this._mixCol[s0 ^ s1];
  48460. state[j + 1] ^= t ^ this._mixCol[s1 ^ s2];
  48461. state[j + 2] ^= t ^ this._mixCol[s2 ^ s3];
  48462. state[j + 3] ^= t ^ this._mixCol[s3 ^ s0];
  48463. }
  48464. for (let j = 0, k = i * 16; j < 16; ++j, ++k) {
  48465. state[j] ^= key[k];
  48466. }
  48467. }
  48468. for (let j = 0; j < 16; ++j) {
  48469. state[j] = s[state[j]];
  48470. }
  48471. v = state[1];
  48472. state[1] = state[5];
  48473. state[5] = state[9];
  48474. state[9] = state[13];
  48475. state[13] = v;
  48476. v = state[2];
  48477. u = state[6];
  48478. state[2] = state[10];
  48479. state[6] = state[14];
  48480. state[10] = v;
  48481. state[14] = u;
  48482. v = state[3];
  48483. u = state[7];
  48484. t = state[11];
  48485. state[3] = state[15];
  48486. state[7] = v;
  48487. state[11] = u;
  48488. state[15] = t;
  48489. for (let j = 0, k = this._keySize; j < 16; ++j, ++k) {
  48490. state[j] ^= key[k];
  48491. }
  48492. return state;
  48493. }
  48494. _decryptBlock2(data, finalize) {
  48495. const sourceLength = data.length;
  48496. let buffer = this.buffer,
  48497. bufferLength = this.bufferPosition;
  48498. const result = [];
  48499. let iv = this.iv;
  48500. for (let i = 0; i < sourceLength; ++i) {
  48501. buffer[bufferLength] = data[i];
  48502. ++bufferLength;
  48503. if (bufferLength < 16) {
  48504. continue;
  48505. }
  48506. const plain = this._decrypt(buffer, this._key);
  48507. for (let j = 0; j < 16; ++j) {
  48508. plain[j] ^= iv[j];
  48509. }
  48510. iv = buffer;
  48511. result.push(plain);
  48512. buffer = new Uint8Array(16);
  48513. bufferLength = 0;
  48514. }
  48515. this.buffer = buffer;
  48516. this.bufferLength = bufferLength;
  48517. this.iv = iv;
  48518. if (result.length === 0) {
  48519. return new Uint8Array(0);
  48520. }
  48521. let outputLength = 16 * result.length;
  48522. if (finalize) {
  48523. const lastBlock = result.at(-1);
  48524. let psLen = lastBlock[15];
  48525. if (psLen <= 16) {
  48526. for (let i = 15, ii = 16 - psLen; i >= ii; --i) {
  48527. if (lastBlock[i] !== psLen) {
  48528. psLen = 0;
  48529. break;
  48530. }
  48531. }
  48532. outputLength -= psLen;
  48533. result[result.length - 1] = lastBlock.subarray(0, 16 - psLen);
  48534. }
  48535. }
  48536. const output = new Uint8Array(outputLength);
  48537. for (let i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  48538. output.set(result[i], j);
  48539. }
  48540. return output;
  48541. }
  48542. decryptBlock(data, finalize, iv = null) {
  48543. const sourceLength = data.length;
  48544. const buffer = this.buffer;
  48545. let bufferLength = this.bufferPosition;
  48546. if (iv) {
  48547. this.iv = iv;
  48548. } else {
  48549. for (let i = 0; bufferLength < 16 && i < sourceLength; ++i, ++bufferLength) {
  48550. buffer[bufferLength] = data[i];
  48551. }
  48552. if (bufferLength < 16) {
  48553. this.bufferLength = bufferLength;
  48554. return new Uint8Array(0);
  48555. }
  48556. this.iv = buffer;
  48557. data = data.subarray(16);
  48558. }
  48559. this.buffer = new Uint8Array(16);
  48560. this.bufferLength = 0;
  48561. this.decryptBlock = this._decryptBlock2;
  48562. return this.decryptBlock(data, finalize);
  48563. }
  48564. encrypt(data, iv) {
  48565. const sourceLength = data.length;
  48566. let buffer = this.buffer,
  48567. bufferLength = this.bufferPosition;
  48568. const result = [];
  48569. if (!iv) {
  48570. iv = new Uint8Array(16);
  48571. }
  48572. for (let i = 0; i < sourceLength; ++i) {
  48573. buffer[bufferLength] = data[i];
  48574. ++bufferLength;
  48575. if (bufferLength < 16) {
  48576. continue;
  48577. }
  48578. for (let j = 0; j < 16; ++j) {
  48579. buffer[j] ^= iv[j];
  48580. }
  48581. const cipher = this._encrypt(buffer, this._key);
  48582. iv = cipher;
  48583. result.push(cipher);
  48584. buffer = new Uint8Array(16);
  48585. bufferLength = 0;
  48586. }
  48587. this.buffer = buffer;
  48588. this.bufferLength = bufferLength;
  48589. this.iv = iv;
  48590. if (result.length === 0) {
  48591. return new Uint8Array(0);
  48592. }
  48593. const outputLength = 16 * result.length;
  48594. const output = new Uint8Array(outputLength);
  48595. for (let i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  48596. output.set(result[i], j);
  48597. }
  48598. return output;
  48599. }
  48600. }
  48601. class AES128Cipher extends AESBaseCipher {
  48602. constructor(key) {
  48603. super();
  48604. this._cyclesOfRepetition = 10;
  48605. this._keySize = 160;
  48606. 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]);
  48607. this._key = this._expandKey(key);
  48608. }
  48609. _expandKey(cipherKey) {
  48610. const b = 176;
  48611. const s = this._s;
  48612. const rcon = this._rcon;
  48613. const result = new Uint8Array(b);
  48614. result.set(cipherKey);
  48615. for (let j = 16, i = 1; j < b; ++i) {
  48616. let t1 = result[j - 3];
  48617. let t2 = result[j - 2];
  48618. let t3 = result[j - 1];
  48619. let t4 = result[j - 4];
  48620. t1 = s[t1];
  48621. t2 = s[t2];
  48622. t3 = s[t3];
  48623. t4 = s[t4];
  48624. t1 ^= rcon[i];
  48625. for (let n = 0; n < 4; ++n) {
  48626. result[j] = t1 ^= result[j - 16];
  48627. j++;
  48628. result[j] = t2 ^= result[j - 16];
  48629. j++;
  48630. result[j] = t3 ^= result[j - 16];
  48631. j++;
  48632. result[j] = t4 ^= result[j - 16];
  48633. j++;
  48634. }
  48635. }
  48636. return result;
  48637. }
  48638. }
  48639. exports.AES128Cipher = AES128Cipher;
  48640. class AES256Cipher extends AESBaseCipher {
  48641. constructor(key) {
  48642. super();
  48643. this._cyclesOfRepetition = 14;
  48644. this._keySize = 224;
  48645. this._key = this._expandKey(key);
  48646. }
  48647. _expandKey(cipherKey) {
  48648. const b = 240;
  48649. const s = this._s;
  48650. const result = new Uint8Array(b);
  48651. result.set(cipherKey);
  48652. let r = 1;
  48653. let t1, t2, t3, t4;
  48654. for (let j = 32, i = 1; j < b; ++i) {
  48655. if (j % 32 === 16) {
  48656. t1 = s[t1];
  48657. t2 = s[t2];
  48658. t3 = s[t3];
  48659. t4 = s[t4];
  48660. } else if (j % 32 === 0) {
  48661. t1 = result[j - 3];
  48662. t2 = result[j - 2];
  48663. t3 = result[j - 1];
  48664. t4 = result[j - 4];
  48665. t1 = s[t1];
  48666. t2 = s[t2];
  48667. t3 = s[t3];
  48668. t4 = s[t4];
  48669. t1 ^= r;
  48670. if ((r <<= 1) >= 256) {
  48671. r = (r ^ 0x1b) & 0xff;
  48672. }
  48673. }
  48674. for (let n = 0; n < 4; ++n) {
  48675. result[j] = t1 ^= result[j - 32];
  48676. j++;
  48677. result[j] = t2 ^= result[j - 32];
  48678. j++;
  48679. result[j] = t3 ^= result[j - 32];
  48680. j++;
  48681. result[j] = t4 ^= result[j - 32];
  48682. j++;
  48683. }
  48684. }
  48685. return result;
  48686. }
  48687. }
  48688. exports.AES256Cipher = AES256Cipher;
  48689. class PDF17 {
  48690. checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {
  48691. const hashData = new Uint8Array(password.length + 56);
  48692. hashData.set(password, 0);
  48693. hashData.set(ownerValidationSalt, password.length);
  48694. hashData.set(userBytes, password.length + ownerValidationSalt.length);
  48695. const result = calculateSHA256(hashData, 0, hashData.length);
  48696. return (0, _util.isArrayEqual)(result, ownerPassword);
  48697. }
  48698. checkUserPassword(password, userValidationSalt, userPassword) {
  48699. const hashData = new Uint8Array(password.length + 8);
  48700. hashData.set(password, 0);
  48701. hashData.set(userValidationSalt, password.length);
  48702. const result = calculateSHA256(hashData, 0, hashData.length);
  48703. return (0, _util.isArrayEqual)(result, userPassword);
  48704. }
  48705. getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
  48706. const hashData = new Uint8Array(password.length + 56);
  48707. hashData.set(password, 0);
  48708. hashData.set(ownerKeySalt, password.length);
  48709. hashData.set(userBytes, password.length + ownerKeySalt.length);
  48710. const key = calculateSHA256(hashData, 0, hashData.length);
  48711. const cipher = new AES256Cipher(key);
  48712. return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));
  48713. }
  48714. getUserKey(password, userKeySalt, userEncryption) {
  48715. const hashData = new Uint8Array(password.length + 8);
  48716. hashData.set(password, 0);
  48717. hashData.set(userKeySalt, password.length);
  48718. const key = calculateSHA256(hashData, 0, hashData.length);
  48719. const cipher = new AES256Cipher(key);
  48720. return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));
  48721. }
  48722. }
  48723. exports.PDF17 = PDF17;
  48724. const PDF20 = function PDF20Closure() {
  48725. function calculatePDF20Hash(password, input, userBytes) {
  48726. let k = calculateSHA256(input, 0, input.length).subarray(0, 32);
  48727. let e = [0];
  48728. let i = 0;
  48729. while (i < 64 || e.at(-1) > i - 32) {
  48730. const combinedLength = password.length + k.length + userBytes.length,
  48731. combinedArray = new Uint8Array(combinedLength);
  48732. let writeOffset = 0;
  48733. combinedArray.set(password, writeOffset);
  48734. writeOffset += password.length;
  48735. combinedArray.set(k, writeOffset);
  48736. writeOffset += k.length;
  48737. combinedArray.set(userBytes, writeOffset);
  48738. const k1 = new Uint8Array(combinedLength * 64);
  48739. for (let j = 0, pos = 0; j < 64; j++, pos += combinedLength) {
  48740. k1.set(combinedArray, pos);
  48741. }
  48742. const cipher = new AES128Cipher(k.subarray(0, 16));
  48743. e = cipher.encrypt(k1, k.subarray(16, 32));
  48744. let remainder = 0;
  48745. for (let z = 0; z < 16; z++) {
  48746. remainder *= 256 % 3;
  48747. remainder %= 3;
  48748. remainder += (e[z] >>> 0) % 3;
  48749. remainder %= 3;
  48750. }
  48751. if (remainder === 0) {
  48752. k = calculateSHA256(e, 0, e.length);
  48753. } else if (remainder === 1) {
  48754. k = calculateSHA384(e, 0, e.length);
  48755. } else if (remainder === 2) {
  48756. k = calculateSHA512(e, 0, e.length);
  48757. }
  48758. i++;
  48759. }
  48760. return k.subarray(0, 32);
  48761. }
  48762. class PDF20 {
  48763. hash(password, concatBytes, userBytes) {
  48764. return calculatePDF20Hash(password, concatBytes, userBytes);
  48765. }
  48766. checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {
  48767. const hashData = new Uint8Array(password.length + 56);
  48768. hashData.set(password, 0);
  48769. hashData.set(ownerValidationSalt, password.length);
  48770. hashData.set(userBytes, password.length + ownerValidationSalt.length);
  48771. const result = calculatePDF20Hash(password, hashData, userBytes);
  48772. return (0, _util.isArrayEqual)(result, ownerPassword);
  48773. }
  48774. checkUserPassword(password, userValidationSalt, userPassword) {
  48775. const hashData = new Uint8Array(password.length + 8);
  48776. hashData.set(password, 0);
  48777. hashData.set(userValidationSalt, password.length);
  48778. const result = calculatePDF20Hash(password, hashData, []);
  48779. return (0, _util.isArrayEqual)(result, userPassword);
  48780. }
  48781. getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
  48782. const hashData = new Uint8Array(password.length + 56);
  48783. hashData.set(password, 0);
  48784. hashData.set(ownerKeySalt, password.length);
  48785. hashData.set(userBytes, password.length + ownerKeySalt.length);
  48786. const key = calculatePDF20Hash(password, hashData, userBytes);
  48787. const cipher = new AES256Cipher(key);
  48788. return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));
  48789. }
  48790. getUserKey(password, userKeySalt, userEncryption) {
  48791. const hashData = new Uint8Array(password.length + 8);
  48792. hashData.set(password, 0);
  48793. hashData.set(userKeySalt, password.length);
  48794. const key = calculatePDF20Hash(password, hashData, []);
  48795. const cipher = new AES256Cipher(key);
  48796. return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));
  48797. }
  48798. }
  48799. return PDF20;
  48800. }();
  48801. exports.PDF20 = PDF20;
  48802. class CipherTransform {
  48803. constructor(stringCipherConstructor, streamCipherConstructor) {
  48804. this.StringCipherConstructor = stringCipherConstructor;
  48805. this.StreamCipherConstructor = streamCipherConstructor;
  48806. }
  48807. createStream(stream, length) {
  48808. const cipher = new this.StreamCipherConstructor();
  48809. return new _decrypt_stream.DecryptStream(stream, length, function cipherTransformDecryptStream(data, finalize) {
  48810. return cipher.decryptBlock(data, finalize);
  48811. });
  48812. }
  48813. decryptString(s) {
  48814. const cipher = new this.StringCipherConstructor();
  48815. let data = (0, _util.stringToBytes)(s);
  48816. data = cipher.decryptBlock(data, true);
  48817. return (0, _util.bytesToString)(data);
  48818. }
  48819. encryptString(s) {
  48820. const cipher = new this.StringCipherConstructor();
  48821. if (cipher instanceof AESBaseCipher) {
  48822. const strLen = s.length;
  48823. const pad = 16 - strLen % 16;
  48824. s += String.fromCharCode(pad).repeat(pad);
  48825. const iv = new Uint8Array(16);
  48826. if (typeof crypto !== "undefined") {
  48827. crypto.getRandomValues(iv);
  48828. } else {
  48829. for (let i = 0; i < 16; i++) {
  48830. iv[i] = Math.floor(256 * Math.random());
  48831. }
  48832. }
  48833. let data = (0, _util.stringToBytes)(s);
  48834. data = cipher.encrypt(data, iv);
  48835. const buf = new Uint8Array(16 + data.length);
  48836. buf.set(iv);
  48837. buf.set(data, 16);
  48838. return (0, _util.bytesToString)(buf);
  48839. }
  48840. let data = (0, _util.stringToBytes)(s);
  48841. data = cipher.encrypt(data);
  48842. return (0, _util.bytesToString)(data);
  48843. }
  48844. }
  48845. const CipherTransformFactory = function CipherTransformFactoryClosure() {
  48846. 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]);
  48847. function createEncryptionKey20(revision, password, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms) {
  48848. if (password) {
  48849. const passwordLength = Math.min(127, password.length);
  48850. password = password.subarray(0, passwordLength);
  48851. } else {
  48852. password = [];
  48853. }
  48854. let pdfAlgorithm;
  48855. if (revision === 6) {
  48856. pdfAlgorithm = new PDF20();
  48857. } else {
  48858. pdfAlgorithm = new PDF17();
  48859. }
  48860. if (pdfAlgorithm.checkUserPassword(password, userValidationSalt, userPassword)) {
  48861. return pdfAlgorithm.getUserKey(password, userKeySalt, userEncryption);
  48862. } else if (password.length && pdfAlgorithm.checkOwnerPassword(password, ownerValidationSalt, uBytes, ownerPassword)) {
  48863. return pdfAlgorithm.getOwnerKey(password, ownerKeySalt, uBytes, ownerEncryption);
  48864. }
  48865. return null;
  48866. }
  48867. function prepareKeyData(fileId, password, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata) {
  48868. const hashDataSize = 40 + ownerPassword.length + fileId.length;
  48869. const hashData = new Uint8Array(hashDataSize);
  48870. let i = 0,
  48871. j,
  48872. n;
  48873. if (password) {
  48874. n = Math.min(32, password.length);
  48875. for (; i < n; ++i) {
  48876. hashData[i] = password[i];
  48877. }
  48878. }
  48879. j = 0;
  48880. while (i < 32) {
  48881. hashData[i++] = defaultPasswordBytes[j++];
  48882. }
  48883. for (j = 0, n = ownerPassword.length; j < n; ++j) {
  48884. hashData[i++] = ownerPassword[j];
  48885. }
  48886. hashData[i++] = flags & 0xff;
  48887. hashData[i++] = flags >> 8 & 0xff;
  48888. hashData[i++] = flags >> 16 & 0xff;
  48889. hashData[i++] = flags >>> 24 & 0xff;
  48890. for (j = 0, n = fileId.length; j < n; ++j) {
  48891. hashData[i++] = fileId[j];
  48892. }
  48893. if (revision >= 4 && !encryptMetadata) {
  48894. hashData[i++] = 0xff;
  48895. hashData[i++] = 0xff;
  48896. hashData[i++] = 0xff;
  48897. hashData[i++] = 0xff;
  48898. }
  48899. let hash = calculateMD5(hashData, 0, i);
  48900. const keyLengthInBytes = keyLength >> 3;
  48901. if (revision >= 3) {
  48902. for (j = 0; j < 50; ++j) {
  48903. hash = calculateMD5(hash, 0, keyLengthInBytes);
  48904. }
  48905. }
  48906. const encryptionKey = hash.subarray(0, keyLengthInBytes);
  48907. let cipher, checkData;
  48908. if (revision >= 3) {
  48909. for (i = 0; i < 32; ++i) {
  48910. hashData[i] = defaultPasswordBytes[i];
  48911. }
  48912. for (j = 0, n = fileId.length; j < n; ++j) {
  48913. hashData[i++] = fileId[j];
  48914. }
  48915. cipher = new ARCFourCipher(encryptionKey);
  48916. checkData = cipher.encryptBlock(calculateMD5(hashData, 0, i));
  48917. n = encryptionKey.length;
  48918. const derivedKey = new Uint8Array(n);
  48919. for (j = 1; j <= 19; ++j) {
  48920. for (let k = 0; k < n; ++k) {
  48921. derivedKey[k] = encryptionKey[k] ^ j;
  48922. }
  48923. cipher = new ARCFourCipher(derivedKey);
  48924. checkData = cipher.encryptBlock(checkData);
  48925. }
  48926. for (j = 0, n = checkData.length; j < n; ++j) {
  48927. if (userPassword[j] !== checkData[j]) {
  48928. return null;
  48929. }
  48930. }
  48931. } else {
  48932. cipher = new ARCFourCipher(encryptionKey);
  48933. checkData = cipher.encryptBlock(defaultPasswordBytes);
  48934. for (j = 0, n = checkData.length; j < n; ++j) {
  48935. if (userPassword[j] !== checkData[j]) {
  48936. return null;
  48937. }
  48938. }
  48939. }
  48940. return encryptionKey;
  48941. }
  48942. function decodeUserPassword(password, ownerPassword, revision, keyLength) {
  48943. const hashData = new Uint8Array(32);
  48944. let i = 0;
  48945. const n = Math.min(32, password.length);
  48946. for (; i < n; ++i) {
  48947. hashData[i] = password[i];
  48948. }
  48949. let j = 0;
  48950. while (i < 32) {
  48951. hashData[i++] = defaultPasswordBytes[j++];
  48952. }
  48953. let hash = calculateMD5(hashData, 0, i);
  48954. const keyLengthInBytes = keyLength >> 3;
  48955. if (revision >= 3) {
  48956. for (j = 0; j < 50; ++j) {
  48957. hash = calculateMD5(hash, 0, hash.length);
  48958. }
  48959. }
  48960. let cipher, userPassword;
  48961. if (revision >= 3) {
  48962. userPassword = ownerPassword;
  48963. const derivedKey = new Uint8Array(keyLengthInBytes);
  48964. for (j = 19; j >= 0; j--) {
  48965. for (let k = 0; k < keyLengthInBytes; ++k) {
  48966. derivedKey[k] = hash[k] ^ j;
  48967. }
  48968. cipher = new ARCFourCipher(derivedKey);
  48969. userPassword = cipher.encryptBlock(userPassword);
  48970. }
  48971. } else {
  48972. cipher = new ARCFourCipher(hash.subarray(0, keyLengthInBytes));
  48973. userPassword = cipher.encryptBlock(ownerPassword);
  48974. }
  48975. return userPassword;
  48976. }
  48977. const identityName = _primitives.Name.get("Identity");
  48978. function buildObjectKey(num, gen, encryptionKey, isAes = false) {
  48979. const key = new Uint8Array(encryptionKey.length + 9);
  48980. const n = encryptionKey.length;
  48981. let i;
  48982. for (i = 0; i < n; ++i) {
  48983. key[i] = encryptionKey[i];
  48984. }
  48985. key[i++] = num & 0xff;
  48986. key[i++] = num >> 8 & 0xff;
  48987. key[i++] = num >> 16 & 0xff;
  48988. key[i++] = gen & 0xff;
  48989. key[i++] = gen >> 8 & 0xff;
  48990. if (isAes) {
  48991. key[i++] = 0x73;
  48992. key[i++] = 0x41;
  48993. key[i++] = 0x6c;
  48994. key[i++] = 0x54;
  48995. }
  48996. const hash = calculateMD5(key, 0, i);
  48997. return hash.subarray(0, Math.min(encryptionKey.length + 5, 16));
  48998. }
  48999. function buildCipherConstructor(cf, name, num, gen, key) {
  49000. if (!(name instanceof _primitives.Name)) {
  49001. throw new _util.FormatError("Invalid crypt filter name.");
  49002. }
  49003. const cryptFilter = cf.get(name.name);
  49004. let cfm;
  49005. if (cryptFilter !== null && cryptFilter !== undefined) {
  49006. cfm = cryptFilter.get("CFM");
  49007. }
  49008. if (!cfm || cfm.name === "None") {
  49009. return function cipherTransformFactoryBuildCipherConstructorNone() {
  49010. return new NullCipher();
  49011. };
  49012. }
  49013. if (cfm.name === "V2") {
  49014. return function cipherTransformFactoryBuildCipherConstructorV2() {
  49015. return new ARCFourCipher(buildObjectKey(num, gen, key, false));
  49016. };
  49017. }
  49018. if (cfm.name === "AESV2") {
  49019. return function cipherTransformFactoryBuildCipherConstructorAESV2() {
  49020. return new AES128Cipher(buildObjectKey(num, gen, key, true));
  49021. };
  49022. }
  49023. if (cfm.name === "AESV3") {
  49024. return function cipherTransformFactoryBuildCipherConstructorAESV3() {
  49025. return new AES256Cipher(key);
  49026. };
  49027. }
  49028. throw new _util.FormatError("Unknown crypto method");
  49029. }
  49030. class CipherTransformFactory {
  49031. constructor(dict, fileId, password) {
  49032. const filter = dict.get("Filter");
  49033. if (!(0, _primitives.isName)(filter, "Standard")) {
  49034. throw new _util.FormatError("unknown encryption method");
  49035. }
  49036. this.filterName = filter.name;
  49037. this.dict = dict;
  49038. const algorithm = dict.get("V");
  49039. if (!Number.isInteger(algorithm) || algorithm !== 1 && algorithm !== 2 && algorithm !== 4 && algorithm !== 5) {
  49040. throw new _util.FormatError("unsupported encryption algorithm");
  49041. }
  49042. this.algorithm = algorithm;
  49043. let keyLength = dict.get("Length");
  49044. if (!keyLength) {
  49045. if (algorithm <= 3) {
  49046. keyLength = 40;
  49047. } else {
  49048. const cfDict = dict.get("CF");
  49049. const streamCryptoName = dict.get("StmF");
  49050. if (cfDict instanceof _primitives.Dict && streamCryptoName instanceof _primitives.Name) {
  49051. cfDict.suppressEncryption = true;
  49052. const handlerDict = cfDict.get(streamCryptoName.name);
  49053. keyLength = handlerDict && handlerDict.get("Length") || 128;
  49054. if (keyLength < 40) {
  49055. keyLength <<= 3;
  49056. }
  49057. }
  49058. }
  49059. }
  49060. if (!Number.isInteger(keyLength) || keyLength < 40 || keyLength % 8 !== 0) {
  49061. throw new _util.FormatError("invalid key length");
  49062. }
  49063. const ownerPassword = (0, _util.stringToBytes)(dict.get("O")).subarray(0, 32);
  49064. const userPassword = (0, _util.stringToBytes)(dict.get("U")).subarray(0, 32);
  49065. const flags = dict.get("P");
  49066. const revision = dict.get("R");
  49067. const encryptMetadata = (algorithm === 4 || algorithm === 5) && dict.get("EncryptMetadata") !== false;
  49068. this.encryptMetadata = encryptMetadata;
  49069. const fileIdBytes = (0, _util.stringToBytes)(fileId);
  49070. let passwordBytes;
  49071. if (password) {
  49072. if (revision === 6) {
  49073. try {
  49074. password = (0, _util.utf8StringToString)(password);
  49075. } catch (ex) {
  49076. (0, _util.warn)("CipherTransformFactory: " + "Unable to convert UTF8 encoded password.");
  49077. }
  49078. }
  49079. passwordBytes = (0, _util.stringToBytes)(password);
  49080. }
  49081. let encryptionKey;
  49082. if (algorithm !== 5) {
  49083. encryptionKey = prepareKeyData(fileIdBytes, passwordBytes, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
  49084. } else {
  49085. const ownerValidationSalt = (0, _util.stringToBytes)(dict.get("O")).subarray(32, 40);
  49086. const ownerKeySalt = (0, _util.stringToBytes)(dict.get("O")).subarray(40, 48);
  49087. const uBytes = (0, _util.stringToBytes)(dict.get("U")).subarray(0, 48);
  49088. const userValidationSalt = (0, _util.stringToBytes)(dict.get("U")).subarray(32, 40);
  49089. const userKeySalt = (0, _util.stringToBytes)(dict.get("U")).subarray(40, 48);
  49090. const ownerEncryption = (0, _util.stringToBytes)(dict.get("OE"));
  49091. const userEncryption = (0, _util.stringToBytes)(dict.get("UE"));
  49092. const perms = (0, _util.stringToBytes)(dict.get("Perms"));
  49093. encryptionKey = createEncryptionKey20(revision, passwordBytes, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms);
  49094. }
  49095. if (!encryptionKey && !password) {
  49096. throw new _util.PasswordException("No password given", _util.PasswordResponses.NEED_PASSWORD);
  49097. } else if (!encryptionKey && password) {
  49098. const decodedPassword = decodeUserPassword(passwordBytes, ownerPassword, revision, keyLength);
  49099. encryptionKey = prepareKeyData(fileIdBytes, decodedPassword, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
  49100. }
  49101. if (!encryptionKey) {
  49102. throw new _util.PasswordException("Incorrect Password", _util.PasswordResponses.INCORRECT_PASSWORD);
  49103. }
  49104. this.encryptionKey = encryptionKey;
  49105. if (algorithm >= 4) {
  49106. const cf = dict.get("CF");
  49107. if (cf instanceof _primitives.Dict) {
  49108. cf.suppressEncryption = true;
  49109. }
  49110. this.cf = cf;
  49111. this.stmf = dict.get("StmF") || identityName;
  49112. this.strf = dict.get("StrF") || identityName;
  49113. this.eff = dict.get("EFF") || this.stmf;
  49114. }
  49115. }
  49116. createCipherTransform(num, gen) {
  49117. if (this.algorithm === 4 || this.algorithm === 5) {
  49118. return new CipherTransform(buildCipherConstructor(this.cf, this.strf, num, gen, this.encryptionKey), buildCipherConstructor(this.cf, this.stmf, num, gen, this.encryptionKey));
  49119. }
  49120. const key = buildObjectKey(num, gen, this.encryptionKey, false);
  49121. const cipherConstructor = function buildCipherCipherConstructor() {
  49122. return new ARCFourCipher(key);
  49123. };
  49124. return new CipherTransform(cipherConstructor, cipherConstructor);
  49125. }
  49126. }
  49127. return CipherTransformFactory;
  49128. }();
  49129. exports.CipherTransformFactory = CipherTransformFactory;
  49130. /***/ }),
  49131. /* 68 */
  49132. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  49133. Object.defineProperty(exports, "__esModule", ({
  49134. value: true
  49135. }));
  49136. exports.DecryptStream = void 0;
  49137. var _decode_stream = __w_pdfjs_require__(29);
  49138. const chunkSize = 512;
  49139. class DecryptStream extends _decode_stream.DecodeStream {
  49140. constructor(str, maybeLength, decrypt) {
  49141. super(maybeLength);
  49142. this.str = str;
  49143. this.dict = str.dict;
  49144. this.decrypt = decrypt;
  49145. this.nextChunk = null;
  49146. this.initialized = false;
  49147. }
  49148. readBlock() {
  49149. let chunk;
  49150. if (this.initialized) {
  49151. chunk = this.nextChunk;
  49152. } else {
  49153. chunk = this.str.getBytes(chunkSize);
  49154. this.initialized = true;
  49155. }
  49156. if (!chunk || chunk.length === 0) {
  49157. this.eof = true;
  49158. return;
  49159. }
  49160. this.nextChunk = this.str.getBytes(chunkSize);
  49161. const hasMoreData = this.nextChunk && this.nextChunk.length > 0;
  49162. const decrypt = this.decrypt;
  49163. chunk = decrypt(chunk, !hasMoreData);
  49164. let bufferLength = this.bufferLength;
  49165. const n = chunk.length,
  49166. buffer = this.ensureBuffer(bufferLength + n);
  49167. for (let i = 0; i < n; i++) {
  49168. buffer[bufferLength++] = chunk[i];
  49169. }
  49170. this.bufferLength = bufferLength;
  49171. }
  49172. }
  49173. exports.DecryptStream = DecryptStream;
  49174. /***/ }),
  49175. /* 69 */
  49176. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  49177. Object.defineProperty(exports, "__esModule", ({
  49178. value: true
  49179. }));
  49180. exports.Catalog = void 0;
  49181. var _core_utils = __w_pdfjs_require__(6);
  49182. var _util = __w_pdfjs_require__(2);
  49183. var _primitives = __w_pdfjs_require__(5);
  49184. var _name_number_tree = __w_pdfjs_require__(70);
  49185. var _base_stream = __w_pdfjs_require__(7);
  49186. var _cleanup_helper = __w_pdfjs_require__(71);
  49187. var _colorspace = __w_pdfjs_require__(24);
  49188. var _file_spec = __w_pdfjs_require__(72);
  49189. var _image_utils = __w_pdfjs_require__(59);
  49190. var _metadata_parser = __w_pdfjs_require__(73);
  49191. var _struct_tree = __w_pdfjs_require__(74);
  49192. function fetchDestination(dest) {
  49193. if (dest instanceof _primitives.Dict) {
  49194. dest = dest.get("D");
  49195. }
  49196. return Array.isArray(dest) ? dest : null;
  49197. }
  49198. class Catalog {
  49199. constructor(pdfManager, xref) {
  49200. this.pdfManager = pdfManager;
  49201. this.xref = xref;
  49202. this._catDict = xref.getCatalogObj();
  49203. if (!(this._catDict instanceof _primitives.Dict)) {
  49204. throw new _util.FormatError("Catalog object is not a dictionary.");
  49205. }
  49206. this.toplevelPagesDict;
  49207. this._actualNumPages = null;
  49208. this.fontCache = new _primitives.RefSetCache();
  49209. this.builtInCMapCache = new Map();
  49210. this.standardFontDataCache = new Map();
  49211. this.globalImageCache = new _image_utils.GlobalImageCache();
  49212. this.pageKidsCountCache = new _primitives.RefSetCache();
  49213. this.pageIndexCache = new _primitives.RefSetCache();
  49214. this.nonBlendModesSet = new _primitives.RefSet();
  49215. }
  49216. get version() {
  49217. const version = this._catDict.get("Version");
  49218. return (0, _util.shadow)(this, "version", version instanceof _primitives.Name ? version.name : null);
  49219. }
  49220. get lang() {
  49221. const lang = this._catDict.get("Lang");
  49222. return (0, _util.shadow)(this, "lang", typeof lang === "string" ? (0, _util.stringToPDFString)(lang) : null);
  49223. }
  49224. get needsRendering() {
  49225. const needsRendering = this._catDict.get("NeedsRendering");
  49226. return (0, _util.shadow)(this, "needsRendering", typeof needsRendering === "boolean" ? needsRendering : false);
  49227. }
  49228. get collection() {
  49229. let collection = null;
  49230. try {
  49231. const obj = this._catDict.get("Collection");
  49232. if (obj instanceof _primitives.Dict && obj.size > 0) {
  49233. collection = obj;
  49234. }
  49235. } catch (ex) {
  49236. if (ex instanceof _core_utils.MissingDataException) {
  49237. throw ex;
  49238. }
  49239. (0, _util.info)("Cannot fetch Collection entry; assuming no collection is present.");
  49240. }
  49241. return (0, _util.shadow)(this, "collection", collection);
  49242. }
  49243. get acroForm() {
  49244. let acroForm = null;
  49245. try {
  49246. const obj = this._catDict.get("AcroForm");
  49247. if (obj instanceof _primitives.Dict && obj.size > 0) {
  49248. acroForm = obj;
  49249. }
  49250. } catch (ex) {
  49251. if (ex instanceof _core_utils.MissingDataException) {
  49252. throw ex;
  49253. }
  49254. (0, _util.info)("Cannot fetch AcroForm entry; assuming no forms are present.");
  49255. }
  49256. return (0, _util.shadow)(this, "acroForm", acroForm);
  49257. }
  49258. get acroFormRef() {
  49259. const value = this._catDict.getRaw("AcroForm");
  49260. return (0, _util.shadow)(this, "acroFormRef", value instanceof _primitives.Ref ? value : null);
  49261. }
  49262. get metadata() {
  49263. const streamRef = this._catDict.getRaw("Metadata");
  49264. if (!(streamRef instanceof _primitives.Ref)) {
  49265. return (0, _util.shadow)(this, "metadata", null);
  49266. }
  49267. let metadata = null;
  49268. try {
  49269. const suppressEncryption = !(this.xref.encrypt && this.xref.encrypt.encryptMetadata);
  49270. const stream = this.xref.fetch(streamRef, suppressEncryption);
  49271. if (stream instanceof _base_stream.BaseStream && stream.dict instanceof _primitives.Dict) {
  49272. const type = stream.dict.get("Type");
  49273. const subtype = stream.dict.get("Subtype");
  49274. if ((0, _primitives.isName)(type, "Metadata") && (0, _primitives.isName)(subtype, "XML")) {
  49275. const data = (0, _util.stringToUTF8String)(stream.getString());
  49276. if (data) {
  49277. metadata = new _metadata_parser.MetadataParser(data).serializable;
  49278. }
  49279. }
  49280. }
  49281. } catch (ex) {
  49282. if (ex instanceof _core_utils.MissingDataException) {
  49283. throw ex;
  49284. }
  49285. (0, _util.info)(`Skipping invalid Metadata: "${ex}".`);
  49286. }
  49287. return (0, _util.shadow)(this, "metadata", metadata);
  49288. }
  49289. get markInfo() {
  49290. let markInfo = null;
  49291. try {
  49292. markInfo = this._readMarkInfo();
  49293. } catch (ex) {
  49294. if (ex instanceof _core_utils.MissingDataException) {
  49295. throw ex;
  49296. }
  49297. (0, _util.warn)("Unable to read mark info.");
  49298. }
  49299. return (0, _util.shadow)(this, "markInfo", markInfo);
  49300. }
  49301. _readMarkInfo() {
  49302. const obj = this._catDict.get("MarkInfo");
  49303. if (!(obj instanceof _primitives.Dict)) {
  49304. return null;
  49305. }
  49306. const markInfo = {
  49307. Marked: false,
  49308. UserProperties: false,
  49309. Suspects: false
  49310. };
  49311. for (const key in markInfo) {
  49312. const value = obj.get(key);
  49313. if (typeof value === "boolean") {
  49314. markInfo[key] = value;
  49315. }
  49316. }
  49317. return markInfo;
  49318. }
  49319. get structTreeRoot() {
  49320. let structTree = null;
  49321. try {
  49322. structTree = this._readStructTreeRoot();
  49323. } catch (ex) {
  49324. if (ex instanceof _core_utils.MissingDataException) {
  49325. throw ex;
  49326. }
  49327. (0, _util.warn)("Unable read to structTreeRoot info.");
  49328. }
  49329. return (0, _util.shadow)(this, "structTreeRoot", structTree);
  49330. }
  49331. _readStructTreeRoot() {
  49332. const obj = this._catDict.get("StructTreeRoot");
  49333. if (!(obj instanceof _primitives.Dict)) {
  49334. return null;
  49335. }
  49336. const root = new _struct_tree.StructTreeRoot(obj);
  49337. root.init();
  49338. return root;
  49339. }
  49340. get toplevelPagesDict() {
  49341. const pagesObj = this._catDict.get("Pages");
  49342. if (!(pagesObj instanceof _primitives.Dict)) {
  49343. throw new _util.FormatError("Invalid top-level pages dictionary.");
  49344. }
  49345. return (0, _util.shadow)(this, "toplevelPagesDict", pagesObj);
  49346. }
  49347. get documentOutline() {
  49348. let obj = null;
  49349. try {
  49350. obj = this._readDocumentOutline();
  49351. } catch (ex) {
  49352. if (ex instanceof _core_utils.MissingDataException) {
  49353. throw ex;
  49354. }
  49355. (0, _util.warn)("Unable to read document outline.");
  49356. }
  49357. return (0, _util.shadow)(this, "documentOutline", obj);
  49358. }
  49359. _readDocumentOutline() {
  49360. let obj = this._catDict.get("Outlines");
  49361. if (!(obj instanceof _primitives.Dict)) {
  49362. return null;
  49363. }
  49364. obj = obj.getRaw("First");
  49365. if (!(obj instanceof _primitives.Ref)) {
  49366. return null;
  49367. }
  49368. const root = {
  49369. items: []
  49370. };
  49371. const queue = [{
  49372. obj,
  49373. parent: root
  49374. }];
  49375. const processed = new _primitives.RefSet();
  49376. processed.put(obj);
  49377. const xref = this.xref,
  49378. blackColor = new Uint8ClampedArray(3);
  49379. while (queue.length > 0) {
  49380. const i = queue.shift();
  49381. const outlineDict = xref.fetchIfRef(i.obj);
  49382. if (outlineDict === null) {
  49383. continue;
  49384. }
  49385. if (!outlineDict.has("Title")) {
  49386. throw new _util.FormatError("Invalid outline item encountered.");
  49387. }
  49388. const data = {
  49389. url: null,
  49390. dest: null
  49391. };
  49392. Catalog.parseDestDictionary({
  49393. destDict: outlineDict,
  49394. resultObj: data,
  49395. docBaseUrl: this.pdfManager.docBaseUrl
  49396. });
  49397. const title = outlineDict.get("Title");
  49398. const flags = outlineDict.get("F") || 0;
  49399. const color = outlineDict.getArray("C");
  49400. const count = outlineDict.get("Count");
  49401. let rgbColor = blackColor;
  49402. if (Array.isArray(color) && color.length === 3 && (color[0] !== 0 || color[1] !== 0 || color[2] !== 0)) {
  49403. rgbColor = _colorspace.ColorSpace.singletons.rgb.getRgb(color, 0);
  49404. }
  49405. const outlineItem = {
  49406. dest: data.dest,
  49407. url: data.url,
  49408. unsafeUrl: data.unsafeUrl,
  49409. newWindow: data.newWindow,
  49410. title: (0, _util.stringToPDFString)(title),
  49411. color: rgbColor,
  49412. count: Number.isInteger(count) ? count : undefined,
  49413. bold: !!(flags & 2),
  49414. italic: !!(flags & 1),
  49415. items: []
  49416. };
  49417. i.parent.items.push(outlineItem);
  49418. obj = outlineDict.getRaw("First");
  49419. if (obj instanceof _primitives.Ref && !processed.has(obj)) {
  49420. queue.push({
  49421. obj,
  49422. parent: outlineItem
  49423. });
  49424. processed.put(obj);
  49425. }
  49426. obj = outlineDict.getRaw("Next");
  49427. if (obj instanceof _primitives.Ref && !processed.has(obj)) {
  49428. queue.push({
  49429. obj,
  49430. parent: i.parent
  49431. });
  49432. processed.put(obj);
  49433. }
  49434. }
  49435. return root.items.length > 0 ? root.items : null;
  49436. }
  49437. get permissions() {
  49438. let permissions = null;
  49439. try {
  49440. permissions = this._readPermissions();
  49441. } catch (ex) {
  49442. if (ex instanceof _core_utils.MissingDataException) {
  49443. throw ex;
  49444. }
  49445. (0, _util.warn)("Unable to read permissions.");
  49446. }
  49447. return (0, _util.shadow)(this, "permissions", permissions);
  49448. }
  49449. _readPermissions() {
  49450. const encrypt = this.xref.trailer.get("Encrypt");
  49451. if (!(encrypt instanceof _primitives.Dict)) {
  49452. return null;
  49453. }
  49454. let flags = encrypt.get("P");
  49455. if (typeof flags !== "number") {
  49456. return null;
  49457. }
  49458. flags += 2 ** 32;
  49459. const permissions = [];
  49460. for (const key in _util.PermissionFlag) {
  49461. const value = _util.PermissionFlag[key];
  49462. if (flags & value) {
  49463. permissions.push(value);
  49464. }
  49465. }
  49466. return permissions;
  49467. }
  49468. get optionalContentConfig() {
  49469. let config = null;
  49470. try {
  49471. const properties = this._catDict.get("OCProperties");
  49472. if (!properties) {
  49473. return (0, _util.shadow)(this, "optionalContentConfig", null);
  49474. }
  49475. const defaultConfig = properties.get("D");
  49476. if (!defaultConfig) {
  49477. return (0, _util.shadow)(this, "optionalContentConfig", null);
  49478. }
  49479. const groupsData = properties.get("OCGs");
  49480. if (!Array.isArray(groupsData)) {
  49481. return (0, _util.shadow)(this, "optionalContentConfig", null);
  49482. }
  49483. const groups = [];
  49484. const groupRefs = [];
  49485. for (const groupRef of groupsData) {
  49486. if (!(groupRef instanceof _primitives.Ref)) {
  49487. continue;
  49488. }
  49489. groupRefs.push(groupRef);
  49490. const group = this.xref.fetchIfRef(groupRef);
  49491. groups.push({
  49492. id: groupRef.toString(),
  49493. name: typeof group.get("Name") === "string" ? (0, _util.stringToPDFString)(group.get("Name")) : null,
  49494. intent: typeof group.get("Intent") === "string" ? (0, _util.stringToPDFString)(group.get("Intent")) : null
  49495. });
  49496. }
  49497. config = this._readOptionalContentConfig(defaultConfig, groupRefs);
  49498. config.groups = groups;
  49499. } catch (ex) {
  49500. if (ex instanceof _core_utils.MissingDataException) {
  49501. throw ex;
  49502. }
  49503. (0, _util.warn)(`Unable to read optional content config: ${ex}`);
  49504. }
  49505. return (0, _util.shadow)(this, "optionalContentConfig", config);
  49506. }
  49507. _readOptionalContentConfig(config, contentGroupRefs) {
  49508. function parseOnOff(refs) {
  49509. const onParsed = [];
  49510. if (Array.isArray(refs)) {
  49511. for (const value of refs) {
  49512. if (!(value instanceof _primitives.Ref)) {
  49513. continue;
  49514. }
  49515. if (contentGroupRefs.includes(value)) {
  49516. onParsed.push(value.toString());
  49517. }
  49518. }
  49519. }
  49520. return onParsed;
  49521. }
  49522. function parseOrder(refs, nestedLevels = 0) {
  49523. if (!Array.isArray(refs)) {
  49524. return null;
  49525. }
  49526. const order = [];
  49527. for (const value of refs) {
  49528. if (value instanceof _primitives.Ref && contentGroupRefs.includes(value)) {
  49529. parsedOrderRefs.put(value);
  49530. order.push(value.toString());
  49531. continue;
  49532. }
  49533. const nestedOrder = parseNestedOrder(value, nestedLevels);
  49534. if (nestedOrder) {
  49535. order.push(nestedOrder);
  49536. }
  49537. }
  49538. if (nestedLevels > 0) {
  49539. return order;
  49540. }
  49541. const hiddenGroups = [];
  49542. for (const groupRef of contentGroupRefs) {
  49543. if (parsedOrderRefs.has(groupRef)) {
  49544. continue;
  49545. }
  49546. hiddenGroups.push(groupRef.toString());
  49547. }
  49548. if (hiddenGroups.length) {
  49549. order.push({
  49550. name: null,
  49551. order: hiddenGroups
  49552. });
  49553. }
  49554. return order;
  49555. }
  49556. function parseNestedOrder(ref, nestedLevels) {
  49557. if (++nestedLevels > MAX_NESTED_LEVELS) {
  49558. (0, _util.warn)("parseNestedOrder - reached MAX_NESTED_LEVELS.");
  49559. return null;
  49560. }
  49561. const value = xref.fetchIfRef(ref);
  49562. if (!Array.isArray(value)) {
  49563. return null;
  49564. }
  49565. const nestedName = xref.fetchIfRef(value[0]);
  49566. if (typeof nestedName !== "string") {
  49567. return null;
  49568. }
  49569. const nestedOrder = parseOrder(value.slice(1), nestedLevels);
  49570. if (!nestedOrder || !nestedOrder.length) {
  49571. return null;
  49572. }
  49573. return {
  49574. name: (0, _util.stringToPDFString)(nestedName),
  49575. order: nestedOrder
  49576. };
  49577. }
  49578. const xref = this.xref,
  49579. parsedOrderRefs = new _primitives.RefSet(),
  49580. MAX_NESTED_LEVELS = 10;
  49581. return {
  49582. name: typeof config.get("Name") === "string" ? (0, _util.stringToPDFString)(config.get("Name")) : null,
  49583. creator: typeof config.get("Creator") === "string" ? (0, _util.stringToPDFString)(config.get("Creator")) : null,
  49584. baseState: config.get("BaseState") instanceof _primitives.Name ? config.get("BaseState").name : null,
  49585. on: parseOnOff(config.get("ON")),
  49586. off: parseOnOff(config.get("OFF")),
  49587. order: parseOrder(config.get("Order")),
  49588. groups: null
  49589. };
  49590. }
  49591. setActualNumPages(num = null) {
  49592. this._actualNumPages = num;
  49593. }
  49594. get hasActualNumPages() {
  49595. return this._actualNumPages !== null;
  49596. }
  49597. get _pagesCount() {
  49598. const obj = this.toplevelPagesDict.get("Count");
  49599. if (!Number.isInteger(obj)) {
  49600. throw new _util.FormatError("Page count in top-level pages dictionary is not an integer.");
  49601. }
  49602. return (0, _util.shadow)(this, "_pagesCount", obj);
  49603. }
  49604. get numPages() {
  49605. return this.hasActualNumPages ? this._actualNumPages : this._pagesCount;
  49606. }
  49607. get destinations() {
  49608. const obj = this._readDests(),
  49609. dests = Object.create(null);
  49610. if (obj instanceof _name_number_tree.NameTree) {
  49611. for (const [key, value] of obj.getAll()) {
  49612. const dest = fetchDestination(value);
  49613. if (dest) {
  49614. dests[(0, _util.stringToPDFString)(key)] = dest;
  49615. }
  49616. }
  49617. } else if (obj instanceof _primitives.Dict) {
  49618. obj.forEach(function (key, value) {
  49619. const dest = fetchDestination(value);
  49620. if (dest) {
  49621. dests[key] = dest;
  49622. }
  49623. });
  49624. }
  49625. return (0, _util.shadow)(this, "destinations", dests);
  49626. }
  49627. getDestination(id) {
  49628. const obj = this._readDests();
  49629. if (obj instanceof _name_number_tree.NameTree) {
  49630. const dest = fetchDestination(obj.get(id));
  49631. if (dest) {
  49632. return dest;
  49633. }
  49634. const allDest = this.destinations[id];
  49635. if (allDest) {
  49636. (0, _util.warn)(`Found "${id}" at an incorrect position in the NameTree.`);
  49637. return allDest;
  49638. }
  49639. } else if (obj instanceof _primitives.Dict) {
  49640. const dest = fetchDestination(obj.get(id));
  49641. if (dest) {
  49642. return dest;
  49643. }
  49644. }
  49645. return null;
  49646. }
  49647. _readDests() {
  49648. const obj = this._catDict.get("Names");
  49649. if (obj && obj.has("Dests")) {
  49650. return new _name_number_tree.NameTree(obj.getRaw("Dests"), this.xref);
  49651. } else if (this._catDict.has("Dests")) {
  49652. return this._catDict.get("Dests");
  49653. }
  49654. return undefined;
  49655. }
  49656. get pageLabels() {
  49657. let obj = null;
  49658. try {
  49659. obj = this._readPageLabels();
  49660. } catch (ex) {
  49661. if (ex instanceof _core_utils.MissingDataException) {
  49662. throw ex;
  49663. }
  49664. (0, _util.warn)("Unable to read page labels.");
  49665. }
  49666. return (0, _util.shadow)(this, "pageLabels", obj);
  49667. }
  49668. _readPageLabels() {
  49669. const obj = this._catDict.getRaw("PageLabels");
  49670. if (!obj) {
  49671. return null;
  49672. }
  49673. const pageLabels = new Array(this.numPages);
  49674. let style = null,
  49675. prefix = "";
  49676. const numberTree = new _name_number_tree.NumberTree(obj, this.xref);
  49677. const nums = numberTree.getAll();
  49678. let currentLabel = "",
  49679. currentIndex = 1;
  49680. for (let i = 0, ii = this.numPages; i < ii; i++) {
  49681. const labelDict = nums.get(i);
  49682. if (labelDict !== undefined) {
  49683. if (!(labelDict instanceof _primitives.Dict)) {
  49684. throw new _util.FormatError("PageLabel is not a dictionary.");
  49685. }
  49686. if (labelDict.has("Type") && !(0, _primitives.isName)(labelDict.get("Type"), "PageLabel")) {
  49687. throw new _util.FormatError("Invalid type in PageLabel dictionary.");
  49688. }
  49689. if (labelDict.has("S")) {
  49690. const s = labelDict.get("S");
  49691. if (!(s instanceof _primitives.Name)) {
  49692. throw new _util.FormatError("Invalid style in PageLabel dictionary.");
  49693. }
  49694. style = s.name;
  49695. } else {
  49696. style = null;
  49697. }
  49698. if (labelDict.has("P")) {
  49699. const p = labelDict.get("P");
  49700. if (typeof p !== "string") {
  49701. throw new _util.FormatError("Invalid prefix in PageLabel dictionary.");
  49702. }
  49703. prefix = (0, _util.stringToPDFString)(p);
  49704. } else {
  49705. prefix = "";
  49706. }
  49707. if (labelDict.has("St")) {
  49708. const st = labelDict.get("St");
  49709. if (!(Number.isInteger(st) && st >= 1)) {
  49710. throw new _util.FormatError("Invalid start in PageLabel dictionary.");
  49711. }
  49712. currentIndex = st;
  49713. } else {
  49714. currentIndex = 1;
  49715. }
  49716. }
  49717. switch (style) {
  49718. case "D":
  49719. currentLabel = currentIndex;
  49720. break;
  49721. case "R":
  49722. case "r":
  49723. currentLabel = (0, _core_utils.toRomanNumerals)(currentIndex, style === "r");
  49724. break;
  49725. case "A":
  49726. case "a":
  49727. const LIMIT = 26;
  49728. const A_UPPER_CASE = 0x41,
  49729. A_LOWER_CASE = 0x61;
  49730. const baseCharCode = style === "a" ? A_LOWER_CASE : A_UPPER_CASE;
  49731. const letterIndex = currentIndex - 1;
  49732. const character = String.fromCharCode(baseCharCode + letterIndex % LIMIT);
  49733. currentLabel = character.repeat(Math.floor(letterIndex / LIMIT) + 1);
  49734. break;
  49735. default:
  49736. if (style) {
  49737. throw new _util.FormatError(`Invalid style "${style}" in PageLabel dictionary.`);
  49738. }
  49739. currentLabel = "";
  49740. }
  49741. pageLabels[i] = prefix + currentLabel;
  49742. currentIndex++;
  49743. }
  49744. return pageLabels;
  49745. }
  49746. get pageLayout() {
  49747. const obj = this._catDict.get("PageLayout");
  49748. let pageLayout = "";
  49749. if (obj instanceof _primitives.Name) {
  49750. switch (obj.name) {
  49751. case "SinglePage":
  49752. case "OneColumn":
  49753. case "TwoColumnLeft":
  49754. case "TwoColumnRight":
  49755. case "TwoPageLeft":
  49756. case "TwoPageRight":
  49757. pageLayout = obj.name;
  49758. }
  49759. }
  49760. return (0, _util.shadow)(this, "pageLayout", pageLayout);
  49761. }
  49762. get pageMode() {
  49763. const obj = this._catDict.get("PageMode");
  49764. let pageMode = "UseNone";
  49765. if (obj instanceof _primitives.Name) {
  49766. switch (obj.name) {
  49767. case "UseNone":
  49768. case "UseOutlines":
  49769. case "UseThumbs":
  49770. case "FullScreen":
  49771. case "UseOC":
  49772. case "UseAttachments":
  49773. pageMode = obj.name;
  49774. }
  49775. }
  49776. return (0, _util.shadow)(this, "pageMode", pageMode);
  49777. }
  49778. get viewerPreferences() {
  49779. const obj = this._catDict.get("ViewerPreferences");
  49780. if (!(obj instanceof _primitives.Dict)) {
  49781. return (0, _util.shadow)(this, "viewerPreferences", null);
  49782. }
  49783. let prefs = null;
  49784. for (const key of obj.getKeys()) {
  49785. const value = obj.get(key);
  49786. let prefValue;
  49787. switch (key) {
  49788. case "HideToolbar":
  49789. case "HideMenubar":
  49790. case "HideWindowUI":
  49791. case "FitWindow":
  49792. case "CenterWindow":
  49793. case "DisplayDocTitle":
  49794. case "PickTrayByPDFSize":
  49795. if (typeof value === "boolean") {
  49796. prefValue = value;
  49797. }
  49798. break;
  49799. case "NonFullScreenPageMode":
  49800. if (value instanceof _primitives.Name) {
  49801. switch (value.name) {
  49802. case "UseNone":
  49803. case "UseOutlines":
  49804. case "UseThumbs":
  49805. case "UseOC":
  49806. prefValue = value.name;
  49807. break;
  49808. default:
  49809. prefValue = "UseNone";
  49810. }
  49811. }
  49812. break;
  49813. case "Direction":
  49814. if (value instanceof _primitives.Name) {
  49815. switch (value.name) {
  49816. case "L2R":
  49817. case "R2L":
  49818. prefValue = value.name;
  49819. break;
  49820. default:
  49821. prefValue = "L2R";
  49822. }
  49823. }
  49824. break;
  49825. case "ViewArea":
  49826. case "ViewClip":
  49827. case "PrintArea":
  49828. case "PrintClip":
  49829. if (value instanceof _primitives.Name) {
  49830. switch (value.name) {
  49831. case "MediaBox":
  49832. case "CropBox":
  49833. case "BleedBox":
  49834. case "TrimBox":
  49835. case "ArtBox":
  49836. prefValue = value.name;
  49837. break;
  49838. default:
  49839. prefValue = "CropBox";
  49840. }
  49841. }
  49842. break;
  49843. case "PrintScaling":
  49844. if (value instanceof _primitives.Name) {
  49845. switch (value.name) {
  49846. case "None":
  49847. case "AppDefault":
  49848. prefValue = value.name;
  49849. break;
  49850. default:
  49851. prefValue = "AppDefault";
  49852. }
  49853. }
  49854. break;
  49855. case "Duplex":
  49856. if (value instanceof _primitives.Name) {
  49857. switch (value.name) {
  49858. case "Simplex":
  49859. case "DuplexFlipShortEdge":
  49860. case "DuplexFlipLongEdge":
  49861. prefValue = value.name;
  49862. break;
  49863. default:
  49864. prefValue = "None";
  49865. }
  49866. }
  49867. break;
  49868. case "PrintPageRange":
  49869. if (Array.isArray(value) && value.length % 2 === 0) {
  49870. const isValid = value.every((page, i, arr) => {
  49871. return Number.isInteger(page) && page > 0 && (i === 0 || page >= arr[i - 1]) && page <= this.numPages;
  49872. });
  49873. if (isValid) {
  49874. prefValue = value;
  49875. }
  49876. }
  49877. break;
  49878. case "NumCopies":
  49879. if (Number.isInteger(value) && value > 0) {
  49880. prefValue = value;
  49881. }
  49882. break;
  49883. default:
  49884. (0, _util.warn)(`Ignoring non-standard key in ViewerPreferences: ${key}.`);
  49885. continue;
  49886. }
  49887. if (prefValue === undefined) {
  49888. (0, _util.warn)(`Bad value, for key "${key}", in ViewerPreferences: ${value}.`);
  49889. continue;
  49890. }
  49891. if (!prefs) {
  49892. prefs = Object.create(null);
  49893. }
  49894. prefs[key] = prefValue;
  49895. }
  49896. return (0, _util.shadow)(this, "viewerPreferences", prefs);
  49897. }
  49898. get openAction() {
  49899. const obj = this._catDict.get("OpenAction");
  49900. const openAction = Object.create(null);
  49901. if (obj instanceof _primitives.Dict) {
  49902. const destDict = new _primitives.Dict(this.xref);
  49903. destDict.set("A", obj);
  49904. const resultObj = {
  49905. url: null,
  49906. dest: null,
  49907. action: null
  49908. };
  49909. Catalog.parseDestDictionary({
  49910. destDict,
  49911. resultObj
  49912. });
  49913. if (Array.isArray(resultObj.dest)) {
  49914. openAction.dest = resultObj.dest;
  49915. } else if (resultObj.action) {
  49916. openAction.action = resultObj.action;
  49917. }
  49918. } else if (Array.isArray(obj)) {
  49919. openAction.dest = obj;
  49920. }
  49921. return (0, _util.shadow)(this, "openAction", (0, _util.objectSize)(openAction) > 0 ? openAction : null);
  49922. }
  49923. get attachments() {
  49924. const obj = this._catDict.get("Names");
  49925. let attachments = null;
  49926. if (obj instanceof _primitives.Dict && obj.has("EmbeddedFiles")) {
  49927. const nameTree = new _name_number_tree.NameTree(obj.getRaw("EmbeddedFiles"), this.xref);
  49928. for (const [key, value] of nameTree.getAll()) {
  49929. const fs = new _file_spec.FileSpec(value, this.xref);
  49930. if (!attachments) {
  49931. attachments = Object.create(null);
  49932. }
  49933. attachments[(0, _util.stringToPDFString)(key)] = fs.serializable;
  49934. }
  49935. }
  49936. return (0, _util.shadow)(this, "attachments", attachments);
  49937. }
  49938. get xfaImages() {
  49939. const obj = this._catDict.get("Names");
  49940. let xfaImages = null;
  49941. if (obj instanceof _primitives.Dict && obj.has("XFAImages")) {
  49942. const nameTree = new _name_number_tree.NameTree(obj.getRaw("XFAImages"), this.xref);
  49943. for (const [key, value] of nameTree.getAll()) {
  49944. if (!xfaImages) {
  49945. xfaImages = new _primitives.Dict(this.xref);
  49946. }
  49947. xfaImages.set((0, _util.stringToPDFString)(key), value);
  49948. }
  49949. }
  49950. return (0, _util.shadow)(this, "xfaImages", xfaImages);
  49951. }
  49952. _collectJavaScript() {
  49953. const obj = this._catDict.get("Names");
  49954. let javaScript = null;
  49955. function appendIfJavaScriptDict(name, jsDict) {
  49956. if (!(jsDict instanceof _primitives.Dict)) {
  49957. return;
  49958. }
  49959. if (!(0, _primitives.isName)(jsDict.get("S"), "JavaScript")) {
  49960. return;
  49961. }
  49962. let js = jsDict.get("JS");
  49963. if (js instanceof _base_stream.BaseStream) {
  49964. js = js.getString();
  49965. } else if (typeof js !== "string") {
  49966. return;
  49967. }
  49968. if (javaScript === null) {
  49969. javaScript = new Map();
  49970. }
  49971. js = (0, _util.stringToPDFString)(js).replace(/\u0000/g, "");
  49972. javaScript.set(name, js);
  49973. }
  49974. if (obj instanceof _primitives.Dict && obj.has("JavaScript")) {
  49975. const nameTree = new _name_number_tree.NameTree(obj.getRaw("JavaScript"), this.xref);
  49976. for (const [key, value] of nameTree.getAll()) {
  49977. appendIfJavaScriptDict((0, _util.stringToPDFString)(key), value);
  49978. }
  49979. }
  49980. const openAction = this._catDict.get("OpenAction");
  49981. if (openAction) {
  49982. appendIfJavaScriptDict("OpenAction", openAction);
  49983. }
  49984. return javaScript;
  49985. }
  49986. get javaScript() {
  49987. const javaScript = this._collectJavaScript();
  49988. return (0, _util.shadow)(this, "javaScript", javaScript ? [...javaScript.values()] : null);
  49989. }
  49990. get jsActions() {
  49991. const javaScript = this._collectJavaScript();
  49992. let actions = (0, _core_utils.collectActions)(this.xref, this._catDict, _util.DocumentActionEventType);
  49993. if (javaScript) {
  49994. if (!actions) {
  49995. actions = Object.create(null);
  49996. }
  49997. for (const [key, val] of javaScript) {
  49998. if (key in actions) {
  49999. actions[key].push(val);
  50000. } else {
  50001. actions[key] = [val];
  50002. }
  50003. }
  50004. }
  50005. return (0, _util.shadow)(this, "jsActions", actions);
  50006. }
  50007. async fontFallback(id, handler) {
  50008. const translatedFonts = await Promise.all(this.fontCache);
  50009. for (const translatedFont of translatedFonts) {
  50010. if (translatedFont.loadedName === id) {
  50011. translatedFont.fallback(handler);
  50012. return;
  50013. }
  50014. }
  50015. }
  50016. async cleanup(manuallyTriggered = false) {
  50017. (0, _cleanup_helper.clearGlobalCaches)();
  50018. this.globalImageCache.clear(manuallyTriggered);
  50019. this.pageKidsCountCache.clear();
  50020. this.pageIndexCache.clear();
  50021. this.nonBlendModesSet.clear();
  50022. const translatedFonts = await Promise.all(this.fontCache);
  50023. for (const {
  50024. dict
  50025. } of translatedFonts) {
  50026. delete dict.cacheKey;
  50027. }
  50028. this.fontCache.clear();
  50029. this.builtInCMapCache.clear();
  50030. this.standardFontDataCache.clear();
  50031. }
  50032. async getPageDict(pageIndex) {
  50033. const nodesToVisit = [this.toplevelPagesDict];
  50034. const visitedNodes = new _primitives.RefSet();
  50035. const pagesRef = this._catDict.getRaw("Pages");
  50036. if (pagesRef instanceof _primitives.Ref) {
  50037. visitedNodes.put(pagesRef);
  50038. }
  50039. const xref = this.xref,
  50040. pageKidsCountCache = this.pageKidsCountCache,
  50041. pageIndexCache = this.pageIndexCache;
  50042. let currentPageIndex = 0;
  50043. while (nodesToVisit.length) {
  50044. const currentNode = nodesToVisit.pop();
  50045. if (currentNode instanceof _primitives.Ref) {
  50046. const count = pageKidsCountCache.get(currentNode);
  50047. if (count >= 0 && currentPageIndex + count <= pageIndex) {
  50048. currentPageIndex += count;
  50049. continue;
  50050. }
  50051. if (visitedNodes.has(currentNode)) {
  50052. throw new _util.FormatError("Pages tree contains circular reference.");
  50053. }
  50054. visitedNodes.put(currentNode);
  50055. const obj = await xref.fetchAsync(currentNode);
  50056. if (obj instanceof _primitives.Dict) {
  50057. let type = obj.getRaw("Type");
  50058. if (type instanceof _primitives.Ref) {
  50059. type = await xref.fetchAsync(type);
  50060. }
  50061. if ((0, _primitives.isName)(type, "Page") || !obj.has("Kids")) {
  50062. if (!pageKidsCountCache.has(currentNode)) {
  50063. pageKidsCountCache.put(currentNode, 1);
  50064. }
  50065. if (!pageIndexCache.has(currentNode)) {
  50066. pageIndexCache.put(currentNode, currentPageIndex);
  50067. }
  50068. if (currentPageIndex === pageIndex) {
  50069. return [obj, currentNode];
  50070. }
  50071. currentPageIndex++;
  50072. continue;
  50073. }
  50074. }
  50075. nodesToVisit.push(obj);
  50076. continue;
  50077. }
  50078. if (!(currentNode instanceof _primitives.Dict)) {
  50079. throw new _util.FormatError("Page dictionary kid reference points to wrong type of object.");
  50080. }
  50081. const {
  50082. objId
  50083. } = currentNode;
  50084. let count = currentNode.getRaw("Count");
  50085. if (count instanceof _primitives.Ref) {
  50086. count = await xref.fetchAsync(count);
  50087. }
  50088. if (Number.isInteger(count) && count >= 0) {
  50089. if (objId && !pageKidsCountCache.has(objId)) {
  50090. pageKidsCountCache.put(objId, count);
  50091. }
  50092. if (currentPageIndex + count <= pageIndex) {
  50093. currentPageIndex += count;
  50094. continue;
  50095. }
  50096. }
  50097. let kids = currentNode.getRaw("Kids");
  50098. if (kids instanceof _primitives.Ref) {
  50099. kids = await xref.fetchAsync(kids);
  50100. }
  50101. if (!Array.isArray(kids)) {
  50102. let type = currentNode.getRaw("Type");
  50103. if (type instanceof _primitives.Ref) {
  50104. type = await xref.fetchAsync(type);
  50105. }
  50106. if ((0, _primitives.isName)(type, "Page") || !currentNode.has("Kids")) {
  50107. if (currentPageIndex === pageIndex) {
  50108. return [currentNode, null];
  50109. }
  50110. currentPageIndex++;
  50111. continue;
  50112. }
  50113. throw new _util.FormatError("Page dictionary kids object is not an array.");
  50114. }
  50115. for (let last = kids.length - 1; last >= 0; last--) {
  50116. nodesToVisit.push(kids[last]);
  50117. }
  50118. }
  50119. throw new Error(`Page index ${pageIndex} not found.`);
  50120. }
  50121. async getAllPageDicts(recoveryMode = false) {
  50122. const queue = [{
  50123. currentNode: this.toplevelPagesDict,
  50124. posInKids: 0
  50125. }];
  50126. const visitedNodes = new _primitives.RefSet();
  50127. const pagesRef = this._catDict.getRaw("Pages");
  50128. if (pagesRef instanceof _primitives.Ref) {
  50129. visitedNodes.put(pagesRef);
  50130. }
  50131. const map = new Map(),
  50132. xref = this.xref,
  50133. pageIndexCache = this.pageIndexCache;
  50134. let pageIndex = 0;
  50135. function addPageDict(pageDict, pageRef) {
  50136. if (pageRef && !pageIndexCache.has(pageRef)) {
  50137. pageIndexCache.put(pageRef, pageIndex);
  50138. }
  50139. map.set(pageIndex++, [pageDict, pageRef]);
  50140. }
  50141. function addPageError(error) {
  50142. if (error instanceof _core_utils.XRefEntryException && !recoveryMode) {
  50143. throw error;
  50144. }
  50145. map.set(pageIndex++, [error, null]);
  50146. }
  50147. while (queue.length > 0) {
  50148. const queueItem = queue.at(-1);
  50149. const {
  50150. currentNode,
  50151. posInKids
  50152. } = queueItem;
  50153. let kids = currentNode.getRaw("Kids");
  50154. if (kids instanceof _primitives.Ref) {
  50155. try {
  50156. kids = await xref.fetchAsync(kids);
  50157. } catch (ex) {
  50158. addPageError(ex);
  50159. break;
  50160. }
  50161. }
  50162. if (!Array.isArray(kids)) {
  50163. addPageError(new _util.FormatError("Page dictionary kids object is not an array."));
  50164. break;
  50165. }
  50166. if (posInKids >= kids.length) {
  50167. queue.pop();
  50168. continue;
  50169. }
  50170. const kidObj = kids[posInKids];
  50171. let obj;
  50172. if (kidObj instanceof _primitives.Ref) {
  50173. if (visitedNodes.has(kidObj)) {
  50174. addPageError(new _util.FormatError("Pages tree contains circular reference."));
  50175. break;
  50176. }
  50177. visitedNodes.put(kidObj);
  50178. try {
  50179. obj = await xref.fetchAsync(kidObj);
  50180. } catch (ex) {
  50181. addPageError(ex);
  50182. break;
  50183. }
  50184. } else {
  50185. obj = kidObj;
  50186. }
  50187. if (!(obj instanceof _primitives.Dict)) {
  50188. addPageError(new _util.FormatError("Page dictionary kid reference points to wrong type of object."));
  50189. break;
  50190. }
  50191. let type = obj.getRaw("Type");
  50192. if (type instanceof _primitives.Ref) {
  50193. try {
  50194. type = await xref.fetchAsync(type);
  50195. } catch (ex) {
  50196. addPageError(ex);
  50197. break;
  50198. }
  50199. }
  50200. if ((0, _primitives.isName)(type, "Page") || !obj.has("Kids")) {
  50201. addPageDict(obj, kidObj instanceof _primitives.Ref ? kidObj : null);
  50202. } else {
  50203. queue.push({
  50204. currentNode: obj,
  50205. posInKids: 0
  50206. });
  50207. }
  50208. queueItem.posInKids++;
  50209. }
  50210. return map;
  50211. }
  50212. getPageIndex(pageRef) {
  50213. const cachedPageIndex = this.pageIndexCache.get(pageRef);
  50214. if (cachedPageIndex !== undefined) {
  50215. return Promise.resolve(cachedPageIndex);
  50216. }
  50217. const xref = this.xref;
  50218. function pagesBeforeRef(kidRef) {
  50219. let total = 0,
  50220. parentRef;
  50221. return xref.fetchAsync(kidRef).then(function (node) {
  50222. if ((0, _primitives.isRefsEqual)(kidRef, pageRef) && !(0, _primitives.isDict)(node, "Page") && !(node instanceof _primitives.Dict && !node.has("Type") && node.has("Contents"))) {
  50223. throw new _util.FormatError("The reference does not point to a /Page dictionary.");
  50224. }
  50225. if (!node) {
  50226. return null;
  50227. }
  50228. if (!(node instanceof _primitives.Dict)) {
  50229. throw new _util.FormatError("Node must be a dictionary.");
  50230. }
  50231. parentRef = node.getRaw("Parent");
  50232. return node.getAsync("Parent");
  50233. }).then(function (parent) {
  50234. if (!parent) {
  50235. return null;
  50236. }
  50237. if (!(parent instanceof _primitives.Dict)) {
  50238. throw new _util.FormatError("Parent must be a dictionary.");
  50239. }
  50240. return parent.getAsync("Kids");
  50241. }).then(function (kids) {
  50242. if (!kids) {
  50243. return null;
  50244. }
  50245. const kidPromises = [];
  50246. let found = false;
  50247. for (let i = 0, ii = kids.length; i < ii; i++) {
  50248. const kid = kids[i];
  50249. if (!(kid instanceof _primitives.Ref)) {
  50250. throw new _util.FormatError("Kid must be a reference.");
  50251. }
  50252. if ((0, _primitives.isRefsEqual)(kid, kidRef)) {
  50253. found = true;
  50254. break;
  50255. }
  50256. kidPromises.push(xref.fetchAsync(kid).then(function (obj) {
  50257. if (!(obj instanceof _primitives.Dict)) {
  50258. throw new _util.FormatError("Kid node must be a dictionary.");
  50259. }
  50260. if (obj.has("Count")) {
  50261. total += obj.get("Count");
  50262. } else {
  50263. total++;
  50264. }
  50265. }));
  50266. }
  50267. if (!found) {
  50268. throw new _util.FormatError("Kid reference not found in parent's kids.");
  50269. }
  50270. return Promise.all(kidPromises).then(function () {
  50271. return [total, parentRef];
  50272. });
  50273. });
  50274. }
  50275. let total = 0;
  50276. const next = ref => pagesBeforeRef(ref).then(args => {
  50277. if (!args) {
  50278. this.pageIndexCache.put(pageRef, total);
  50279. return total;
  50280. }
  50281. const [count, parentRef] = args;
  50282. total += count;
  50283. return next(parentRef);
  50284. });
  50285. return next(pageRef);
  50286. }
  50287. get baseUrl() {
  50288. const uri = this._catDict.get("URI");
  50289. if (uri instanceof _primitives.Dict) {
  50290. const base = uri.get("Base");
  50291. if (typeof base === "string") {
  50292. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(base, null, {
  50293. tryConvertEncoding: true
  50294. });
  50295. if (absoluteUrl) {
  50296. return (0, _util.shadow)(this, "baseUrl", absoluteUrl.href);
  50297. }
  50298. }
  50299. }
  50300. return (0, _util.shadow)(this, "baseUrl", null);
  50301. }
  50302. static parseDestDictionary(params) {
  50303. const destDict = params.destDict;
  50304. if (!(destDict instanceof _primitives.Dict)) {
  50305. (0, _util.warn)("parseDestDictionary: `destDict` must be a dictionary.");
  50306. return;
  50307. }
  50308. const resultObj = params.resultObj;
  50309. if (typeof resultObj !== "object") {
  50310. (0, _util.warn)("parseDestDictionary: `resultObj` must be an object.");
  50311. return;
  50312. }
  50313. const docBaseUrl = params.docBaseUrl || null;
  50314. let action = destDict.get("A"),
  50315. url,
  50316. dest;
  50317. if (!(action instanceof _primitives.Dict)) {
  50318. if (destDict.has("Dest")) {
  50319. action = destDict.get("Dest");
  50320. } else {
  50321. action = destDict.get("AA");
  50322. if (action instanceof _primitives.Dict) {
  50323. if (action.has("D")) {
  50324. action = action.get("D");
  50325. } else if (action.has("U")) {
  50326. action = action.get("U");
  50327. }
  50328. }
  50329. }
  50330. }
  50331. if (action instanceof _primitives.Dict) {
  50332. const actionType = action.get("S");
  50333. if (!(actionType instanceof _primitives.Name)) {
  50334. (0, _util.warn)("parseDestDictionary: Invalid type in Action dictionary.");
  50335. return;
  50336. }
  50337. const actionName = actionType.name;
  50338. switch (actionName) {
  50339. case "ResetForm":
  50340. const flags = action.get("Flags");
  50341. const include = ((typeof flags === "number" ? flags : 0) & 1) === 0;
  50342. const fields = [];
  50343. const refs = [];
  50344. for (const obj of action.get("Fields") || []) {
  50345. if (obj instanceof _primitives.Ref) {
  50346. refs.push(obj.toString());
  50347. } else if (typeof obj === "string") {
  50348. fields.push((0, _util.stringToPDFString)(obj));
  50349. }
  50350. }
  50351. resultObj.resetForm = {
  50352. fields,
  50353. refs,
  50354. include
  50355. };
  50356. break;
  50357. case "URI":
  50358. url = action.get("URI");
  50359. if (url instanceof _primitives.Name) {
  50360. url = "/" + url.name;
  50361. }
  50362. break;
  50363. case "GoTo":
  50364. dest = action.get("D");
  50365. break;
  50366. case "Launch":
  50367. case "GoToR":
  50368. const urlDict = action.get("F");
  50369. if (urlDict instanceof _primitives.Dict) {
  50370. url = urlDict.get("F") || null;
  50371. } else if (typeof urlDict === "string") {
  50372. url = urlDict;
  50373. }
  50374. let remoteDest = action.get("D");
  50375. if (remoteDest) {
  50376. if (remoteDest instanceof _primitives.Name) {
  50377. remoteDest = remoteDest.name;
  50378. }
  50379. if (typeof url === "string") {
  50380. const baseUrl = url.split("#")[0];
  50381. if (typeof remoteDest === "string") {
  50382. url = baseUrl + "#" + remoteDest;
  50383. } else if (Array.isArray(remoteDest)) {
  50384. url = baseUrl + "#" + JSON.stringify(remoteDest);
  50385. }
  50386. }
  50387. }
  50388. const newWindow = action.get("NewWindow");
  50389. if (typeof newWindow === "boolean") {
  50390. resultObj.newWindow = newWindow;
  50391. }
  50392. break;
  50393. case "Named":
  50394. const namedAction = action.get("N");
  50395. if (namedAction instanceof _primitives.Name) {
  50396. resultObj.action = namedAction.name;
  50397. }
  50398. break;
  50399. case "JavaScript":
  50400. const jsAction = action.get("JS");
  50401. let js;
  50402. if (jsAction instanceof _base_stream.BaseStream) {
  50403. js = jsAction.getString();
  50404. } else if (typeof jsAction === "string") {
  50405. js = jsAction;
  50406. }
  50407. const jsURL = js && (0, _core_utils.recoverJsURL)((0, _util.stringToPDFString)(js));
  50408. if (jsURL) {
  50409. url = jsURL.url;
  50410. resultObj.newWindow = jsURL.newWindow;
  50411. break;
  50412. }
  50413. default:
  50414. if (actionName === "JavaScript" || actionName === "SubmitForm") {
  50415. break;
  50416. }
  50417. (0, _util.warn)(`parseDestDictionary - unsupported action: "${actionName}".`);
  50418. break;
  50419. }
  50420. } else if (destDict.has("Dest")) {
  50421. dest = destDict.get("Dest");
  50422. }
  50423. if (typeof url === "string") {
  50424. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(url, docBaseUrl, {
  50425. addDefaultProtocol: true,
  50426. tryConvertEncoding: true
  50427. });
  50428. if (absoluteUrl) {
  50429. resultObj.url = absoluteUrl.href;
  50430. }
  50431. resultObj.unsafeUrl = url;
  50432. }
  50433. if (dest) {
  50434. if (dest instanceof _primitives.Name) {
  50435. dest = dest.name;
  50436. }
  50437. if (typeof dest === "string") {
  50438. resultObj.dest = (0, _util.stringToPDFString)(dest);
  50439. } else if (Array.isArray(dest)) {
  50440. resultObj.dest = dest;
  50441. }
  50442. }
  50443. }
  50444. }
  50445. exports.Catalog = Catalog;
  50446. /***/ }),
  50447. /* 70 */
  50448. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  50449. Object.defineProperty(exports, "__esModule", ({
  50450. value: true
  50451. }));
  50452. exports.NumberTree = exports.NameTree = void 0;
  50453. var _primitives = __w_pdfjs_require__(5);
  50454. var _util = __w_pdfjs_require__(2);
  50455. class NameOrNumberTree {
  50456. constructor(root, xref, type) {
  50457. if (this.constructor === NameOrNumberTree) {
  50458. (0, _util.unreachable)("Cannot initialize NameOrNumberTree.");
  50459. }
  50460. this.root = root;
  50461. this.xref = xref;
  50462. this._type = type;
  50463. }
  50464. getAll() {
  50465. const map = new Map();
  50466. if (!this.root) {
  50467. return map;
  50468. }
  50469. const xref = this.xref;
  50470. const processed = new _primitives.RefSet();
  50471. processed.put(this.root);
  50472. const queue = [this.root];
  50473. while (queue.length > 0) {
  50474. const obj = xref.fetchIfRef(queue.shift());
  50475. if (!(obj instanceof _primitives.Dict)) {
  50476. continue;
  50477. }
  50478. if (obj.has("Kids")) {
  50479. const kids = obj.get("Kids");
  50480. if (!Array.isArray(kids)) {
  50481. continue;
  50482. }
  50483. for (const kid of kids) {
  50484. if (processed.has(kid)) {
  50485. throw new _util.FormatError(`Duplicate entry in "${this._type}" tree.`);
  50486. }
  50487. queue.push(kid);
  50488. processed.put(kid);
  50489. }
  50490. continue;
  50491. }
  50492. const entries = obj.get(this._type);
  50493. if (!Array.isArray(entries)) {
  50494. continue;
  50495. }
  50496. for (let i = 0, ii = entries.length; i < ii; i += 2) {
  50497. map.set(xref.fetchIfRef(entries[i]), xref.fetchIfRef(entries[i + 1]));
  50498. }
  50499. }
  50500. return map;
  50501. }
  50502. get(key) {
  50503. if (!this.root) {
  50504. return null;
  50505. }
  50506. const xref = this.xref;
  50507. let kidsOrEntries = xref.fetchIfRef(this.root);
  50508. let loopCount = 0;
  50509. const MAX_LEVELS = 10;
  50510. while (kidsOrEntries.has("Kids")) {
  50511. if (++loopCount > MAX_LEVELS) {
  50512. (0, _util.warn)(`Search depth limit reached for "${this._type}" tree.`);
  50513. return null;
  50514. }
  50515. const kids = kidsOrEntries.get("Kids");
  50516. if (!Array.isArray(kids)) {
  50517. return null;
  50518. }
  50519. let l = 0,
  50520. r = kids.length - 1;
  50521. while (l <= r) {
  50522. const m = l + r >> 1;
  50523. const kid = xref.fetchIfRef(kids[m]);
  50524. const limits = kid.get("Limits");
  50525. if (key < xref.fetchIfRef(limits[0])) {
  50526. r = m - 1;
  50527. } else if (key > xref.fetchIfRef(limits[1])) {
  50528. l = m + 1;
  50529. } else {
  50530. kidsOrEntries = kid;
  50531. break;
  50532. }
  50533. }
  50534. if (l > r) {
  50535. return null;
  50536. }
  50537. }
  50538. const entries = kidsOrEntries.get(this._type);
  50539. if (Array.isArray(entries)) {
  50540. let l = 0,
  50541. r = entries.length - 2;
  50542. while (l <= r) {
  50543. const tmp = l + r >> 1,
  50544. m = tmp + (tmp & 1);
  50545. const currentKey = xref.fetchIfRef(entries[m]);
  50546. if (key < currentKey) {
  50547. r = m - 2;
  50548. } else if (key > currentKey) {
  50549. l = m + 2;
  50550. } else {
  50551. return xref.fetchIfRef(entries[m + 1]);
  50552. }
  50553. }
  50554. }
  50555. return null;
  50556. }
  50557. }
  50558. class NameTree extends NameOrNumberTree {
  50559. constructor(root, xref) {
  50560. super(root, xref, "Names");
  50561. }
  50562. }
  50563. exports.NameTree = NameTree;
  50564. class NumberTree extends NameOrNumberTree {
  50565. constructor(root, xref) {
  50566. super(root, xref, "Nums");
  50567. }
  50568. }
  50569. exports.NumberTree = NumberTree;
  50570. /***/ }),
  50571. /* 71 */
  50572. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  50573. Object.defineProperty(exports, "__esModule", ({
  50574. value: true
  50575. }));
  50576. exports.clearGlobalCaches = clearGlobalCaches;
  50577. var _primitives = __w_pdfjs_require__(5);
  50578. var _unicode = __w_pdfjs_require__(21);
  50579. function clearGlobalCaches() {
  50580. (0, _primitives.clearPrimitiveCaches)();
  50581. (0, _unicode.clearUnicodeCaches)();
  50582. }
  50583. /***/ }),
  50584. /* 72 */
  50585. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  50586. Object.defineProperty(exports, "__esModule", ({
  50587. value: true
  50588. }));
  50589. exports.FileSpec = void 0;
  50590. var _util = __w_pdfjs_require__(2);
  50591. var _base_stream = __w_pdfjs_require__(7);
  50592. var _primitives = __w_pdfjs_require__(5);
  50593. function pickPlatformItem(dict) {
  50594. if (dict.has("UF")) {
  50595. return dict.get("UF");
  50596. } else if (dict.has("F")) {
  50597. return dict.get("F");
  50598. } else if (dict.has("Unix")) {
  50599. return dict.get("Unix");
  50600. } else if (dict.has("Mac")) {
  50601. return dict.get("Mac");
  50602. } else if (dict.has("DOS")) {
  50603. return dict.get("DOS");
  50604. }
  50605. return null;
  50606. }
  50607. class FileSpec {
  50608. constructor(root, xref) {
  50609. if (!(root instanceof _primitives.Dict)) {
  50610. return;
  50611. }
  50612. this.xref = xref;
  50613. this.root = root;
  50614. if (root.has("FS")) {
  50615. this.fs = root.get("FS");
  50616. }
  50617. this.description = root.has("Desc") ? (0, _util.stringToPDFString)(root.get("Desc")) : "";
  50618. if (root.has("RF")) {
  50619. (0, _util.warn)("Related file specifications are not supported");
  50620. }
  50621. this.contentAvailable = true;
  50622. if (!root.has("EF")) {
  50623. this.contentAvailable = false;
  50624. (0, _util.warn)("Non-embedded file specifications are not supported");
  50625. }
  50626. }
  50627. get filename() {
  50628. if (!this._filename && this.root) {
  50629. const filename = pickPlatformItem(this.root) || "unnamed";
  50630. this._filename = (0, _util.stringToPDFString)(filename).replace(/\\\\/g, "\\").replace(/\\\//g, "/").replace(/\\/g, "/");
  50631. }
  50632. return this._filename;
  50633. }
  50634. get content() {
  50635. if (!this.contentAvailable) {
  50636. return null;
  50637. }
  50638. if (!this.contentRef && this.root) {
  50639. this.contentRef = pickPlatformItem(this.root.get("EF"));
  50640. }
  50641. let content = null;
  50642. if (this.contentRef) {
  50643. const fileObj = this.xref.fetchIfRef(this.contentRef);
  50644. if (fileObj instanceof _base_stream.BaseStream) {
  50645. content = fileObj.getBytes();
  50646. } else {
  50647. (0, _util.warn)("Embedded file specification points to non-existing/invalid content");
  50648. }
  50649. } else {
  50650. (0, _util.warn)("Embedded file specification does not have a content");
  50651. }
  50652. return content;
  50653. }
  50654. get serializable() {
  50655. return {
  50656. filename: this.filename,
  50657. content: this.content
  50658. };
  50659. }
  50660. }
  50661. exports.FileSpec = FileSpec;
  50662. /***/ }),
  50663. /* 73 */
  50664. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  50665. Object.defineProperty(exports, "__esModule", ({
  50666. value: true
  50667. }));
  50668. exports.MetadataParser = void 0;
  50669. var _xml_parser = __w_pdfjs_require__(66);
  50670. class MetadataParser {
  50671. constructor(data) {
  50672. data = this._repair(data);
  50673. const parser = new _xml_parser.SimpleXMLParser({
  50674. lowerCaseName: true
  50675. });
  50676. const xmlDocument = parser.parseFromString(data);
  50677. this._metadataMap = new Map();
  50678. this._data = data;
  50679. if (xmlDocument) {
  50680. this._parse(xmlDocument);
  50681. }
  50682. }
  50683. _repair(data) {
  50684. return data.replace(/^[^<]+/, "").replace(/>\\376\\377([^<]+)/g, function (all, codes) {
  50685. const bytes = codes.replace(/\\([0-3])([0-7])([0-7])/g, function (code, d1, d2, d3) {
  50686. return String.fromCharCode(d1 * 64 + d2 * 8 + d3 * 1);
  50687. }).replace(/&(amp|apos|gt|lt|quot);/g, function (str, name) {
  50688. switch (name) {
  50689. case "amp":
  50690. return "&";
  50691. case "apos":
  50692. return "'";
  50693. case "gt":
  50694. return ">";
  50695. case "lt":
  50696. return "<";
  50697. case "quot":
  50698. return '"';
  50699. }
  50700. throw new Error(`_repair: ${name} isn't defined.`);
  50701. });
  50702. const charBuf = [];
  50703. for (let i = 0, ii = bytes.length; i < ii; i += 2) {
  50704. const code = bytes.charCodeAt(i) * 256 + bytes.charCodeAt(i + 1);
  50705. if (code >= 32 && code < 127 && code !== 60 && code !== 62 && code !== 38) {
  50706. charBuf.push(String.fromCharCode(code));
  50707. } else {
  50708. charBuf.push("&#x" + (0x10000 + code).toString(16).substring(1) + ";");
  50709. }
  50710. }
  50711. return ">" + charBuf.join("");
  50712. });
  50713. }
  50714. _getSequence(entry) {
  50715. const name = entry.nodeName;
  50716. if (name !== "rdf:bag" && name !== "rdf:seq" && name !== "rdf:alt") {
  50717. return null;
  50718. }
  50719. return entry.childNodes.filter(node => node.nodeName === "rdf:li");
  50720. }
  50721. _parseArray(entry) {
  50722. if (!entry.hasChildNodes()) {
  50723. return;
  50724. }
  50725. const [seqNode] = entry.childNodes;
  50726. const sequence = this._getSequence(seqNode) || [];
  50727. this._metadataMap.set(entry.nodeName, sequence.map(node => node.textContent.trim()));
  50728. }
  50729. _parse(xmlDocument) {
  50730. let rdf = xmlDocument.documentElement;
  50731. if (rdf.nodeName !== "rdf:rdf") {
  50732. rdf = rdf.firstChild;
  50733. while (rdf && rdf.nodeName !== "rdf:rdf") {
  50734. rdf = rdf.nextSibling;
  50735. }
  50736. }
  50737. if (!rdf || rdf.nodeName !== "rdf:rdf" || !rdf.hasChildNodes()) {
  50738. return;
  50739. }
  50740. for (const desc of rdf.childNodes) {
  50741. if (desc.nodeName !== "rdf:description") {
  50742. continue;
  50743. }
  50744. for (const entry of desc.childNodes) {
  50745. const name = entry.nodeName;
  50746. switch (name) {
  50747. case "#text":
  50748. continue;
  50749. case "dc:creator":
  50750. case "dc:subject":
  50751. this._parseArray(entry);
  50752. continue;
  50753. }
  50754. this._metadataMap.set(name, entry.textContent.trim());
  50755. }
  50756. }
  50757. }
  50758. get serializable() {
  50759. return {
  50760. parsedData: this._metadataMap,
  50761. rawData: this._data
  50762. };
  50763. }
  50764. }
  50765. exports.MetadataParser = MetadataParser;
  50766. /***/ }),
  50767. /* 74 */
  50768. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  50769. Object.defineProperty(exports, "__esModule", ({
  50770. value: true
  50771. }));
  50772. exports.StructTreeRoot = exports.StructTreePage = void 0;
  50773. var _primitives = __w_pdfjs_require__(5);
  50774. var _util = __w_pdfjs_require__(2);
  50775. var _name_number_tree = __w_pdfjs_require__(70);
  50776. const MAX_DEPTH = 40;
  50777. const StructElementType = {
  50778. PAGE_CONTENT: "PAGE_CONTENT",
  50779. STREAM_CONTENT: "STREAM_CONTENT",
  50780. OBJECT: "OBJECT",
  50781. ELEMENT: "ELEMENT"
  50782. };
  50783. class StructTreeRoot {
  50784. constructor(rootDict) {
  50785. this.dict = rootDict;
  50786. this.roleMap = new Map();
  50787. }
  50788. init() {
  50789. this.readRoleMap();
  50790. }
  50791. readRoleMap() {
  50792. const roleMapDict = this.dict.get("RoleMap");
  50793. if (!(roleMapDict instanceof _primitives.Dict)) {
  50794. return;
  50795. }
  50796. roleMapDict.forEach((key, value) => {
  50797. if (!(value instanceof _primitives.Name)) {
  50798. return;
  50799. }
  50800. this.roleMap.set(key, value.name);
  50801. });
  50802. }
  50803. }
  50804. exports.StructTreeRoot = StructTreeRoot;
  50805. class StructElementNode {
  50806. constructor(tree, dict) {
  50807. this.tree = tree;
  50808. this.dict = dict;
  50809. this.kids = [];
  50810. this.parseKids();
  50811. }
  50812. get role() {
  50813. const nameObj = this.dict.get("S");
  50814. const name = nameObj instanceof _primitives.Name ? nameObj.name : "";
  50815. const {
  50816. root
  50817. } = this.tree;
  50818. if (root.roleMap.has(name)) {
  50819. return root.roleMap.get(name);
  50820. }
  50821. return name;
  50822. }
  50823. parseKids() {
  50824. let pageObjId = null;
  50825. const objRef = this.dict.getRaw("Pg");
  50826. if (objRef instanceof _primitives.Ref) {
  50827. pageObjId = objRef.toString();
  50828. }
  50829. const kids = this.dict.get("K");
  50830. if (Array.isArray(kids)) {
  50831. for (const kid of kids) {
  50832. const element = this.parseKid(pageObjId, kid);
  50833. if (element) {
  50834. this.kids.push(element);
  50835. }
  50836. }
  50837. } else {
  50838. const element = this.parseKid(pageObjId, kids);
  50839. if (element) {
  50840. this.kids.push(element);
  50841. }
  50842. }
  50843. }
  50844. parseKid(pageObjId, kid) {
  50845. if (Number.isInteger(kid)) {
  50846. if (this.tree.pageDict.objId !== pageObjId) {
  50847. return null;
  50848. }
  50849. return new StructElement({
  50850. type: StructElementType.PAGE_CONTENT,
  50851. mcid: kid,
  50852. pageObjId
  50853. });
  50854. }
  50855. let kidDict = null;
  50856. if (kid instanceof _primitives.Ref) {
  50857. kidDict = this.dict.xref.fetch(kid);
  50858. } else if (kid instanceof _primitives.Dict) {
  50859. kidDict = kid;
  50860. }
  50861. if (!kidDict) {
  50862. return null;
  50863. }
  50864. const pageRef = kidDict.getRaw("Pg");
  50865. if (pageRef instanceof _primitives.Ref) {
  50866. pageObjId = pageRef.toString();
  50867. }
  50868. const type = kidDict.get("Type") instanceof _primitives.Name ? kidDict.get("Type").name : null;
  50869. if (type === "MCR") {
  50870. if (this.tree.pageDict.objId !== pageObjId) {
  50871. return null;
  50872. }
  50873. return new StructElement({
  50874. type: StructElementType.STREAM_CONTENT,
  50875. refObjId: kidDict.getRaw("Stm") instanceof _primitives.Ref ? kidDict.getRaw("Stm").toString() : null,
  50876. pageObjId,
  50877. mcid: kidDict.get("MCID")
  50878. });
  50879. }
  50880. if (type === "OBJR") {
  50881. if (this.tree.pageDict.objId !== pageObjId) {
  50882. return null;
  50883. }
  50884. return new StructElement({
  50885. type: StructElementType.OBJECT,
  50886. refObjId: kidDict.getRaw("Obj") instanceof _primitives.Ref ? kidDict.getRaw("Obj").toString() : null,
  50887. pageObjId
  50888. });
  50889. }
  50890. return new StructElement({
  50891. type: StructElementType.ELEMENT,
  50892. dict: kidDict
  50893. });
  50894. }
  50895. }
  50896. class StructElement {
  50897. constructor({
  50898. type,
  50899. dict = null,
  50900. mcid = null,
  50901. pageObjId = null,
  50902. refObjId = null
  50903. }) {
  50904. this.type = type;
  50905. this.dict = dict;
  50906. this.mcid = mcid;
  50907. this.pageObjId = pageObjId;
  50908. this.refObjId = refObjId;
  50909. this.parentNode = null;
  50910. }
  50911. }
  50912. class StructTreePage {
  50913. constructor(structTreeRoot, pageDict) {
  50914. this.root = structTreeRoot;
  50915. this.rootDict = structTreeRoot ? structTreeRoot.dict : null;
  50916. this.pageDict = pageDict;
  50917. this.nodes = [];
  50918. }
  50919. parse() {
  50920. if (!this.root || !this.rootDict) {
  50921. return;
  50922. }
  50923. const parentTree = this.rootDict.get("ParentTree");
  50924. if (!parentTree) {
  50925. return;
  50926. }
  50927. const id = this.pageDict.get("StructParents");
  50928. if (!Number.isInteger(id)) {
  50929. return;
  50930. }
  50931. const numberTree = new _name_number_tree.NumberTree(parentTree, this.rootDict.xref);
  50932. const parentArray = numberTree.get(id);
  50933. if (!Array.isArray(parentArray)) {
  50934. return;
  50935. }
  50936. const map = new Map();
  50937. for (const ref of parentArray) {
  50938. if (ref instanceof _primitives.Ref) {
  50939. this.addNode(this.rootDict.xref.fetch(ref), map);
  50940. }
  50941. }
  50942. }
  50943. addNode(dict, map, level = 0) {
  50944. if (level > MAX_DEPTH) {
  50945. (0, _util.warn)("StructTree MAX_DEPTH reached.");
  50946. return null;
  50947. }
  50948. if (map.has(dict)) {
  50949. return map.get(dict);
  50950. }
  50951. const element = new StructElementNode(this, dict);
  50952. map.set(dict, element);
  50953. const parent = dict.get("P");
  50954. if (!parent || (0, _primitives.isName)(parent.get("Type"), "StructTreeRoot")) {
  50955. if (!this.addTopLevelNode(dict, element)) {
  50956. map.delete(dict);
  50957. }
  50958. return element;
  50959. }
  50960. const parentNode = this.addNode(parent, map, level + 1);
  50961. if (!parentNode) {
  50962. return element;
  50963. }
  50964. let save = false;
  50965. for (const kid of parentNode.kids) {
  50966. if (kid.type === StructElementType.ELEMENT && kid.dict === dict) {
  50967. kid.parentNode = element;
  50968. save = true;
  50969. }
  50970. }
  50971. if (!save) {
  50972. map.delete(dict);
  50973. }
  50974. return element;
  50975. }
  50976. addTopLevelNode(dict, element) {
  50977. const obj = this.rootDict.get("K");
  50978. if (!obj) {
  50979. return false;
  50980. }
  50981. if (obj instanceof _primitives.Dict) {
  50982. if (obj.objId !== dict.objId) {
  50983. return false;
  50984. }
  50985. this.nodes[0] = element;
  50986. return true;
  50987. }
  50988. if (!Array.isArray(obj)) {
  50989. return true;
  50990. }
  50991. let save = false;
  50992. for (let i = 0; i < obj.length; i++) {
  50993. const kidRef = obj[i];
  50994. if (kidRef && kidRef.toString() === dict.objId) {
  50995. this.nodes[i] = element;
  50996. save = true;
  50997. }
  50998. }
  50999. return save;
  51000. }
  51001. get serializable() {
  51002. function nodeToSerializable(node, parent, level = 0) {
  51003. if (level > MAX_DEPTH) {
  51004. (0, _util.warn)("StructTree too deep to be fully serialized.");
  51005. return;
  51006. }
  51007. const obj = Object.create(null);
  51008. obj.role = node.role;
  51009. obj.children = [];
  51010. parent.children.push(obj);
  51011. const alt = node.dict.get("Alt");
  51012. if (typeof alt === "string") {
  51013. obj.alt = (0, _util.stringToPDFString)(alt);
  51014. }
  51015. const lang = node.dict.get("Lang");
  51016. if (typeof lang === "string") {
  51017. obj.lang = (0, _util.stringToPDFString)(lang);
  51018. }
  51019. for (const kid of node.kids) {
  51020. const kidElement = kid.type === StructElementType.ELEMENT ? kid.parentNode : null;
  51021. if (kidElement) {
  51022. nodeToSerializable(kidElement, obj, level + 1);
  51023. continue;
  51024. } else if (kid.type === StructElementType.PAGE_CONTENT || kid.type === StructElementType.STREAM_CONTENT) {
  51025. obj.children.push({
  51026. type: "content",
  51027. id: `page${kid.pageObjId}_mcid${kid.mcid}`
  51028. });
  51029. } else if (kid.type === StructElementType.OBJECT) {
  51030. obj.children.push({
  51031. type: "object",
  51032. id: kid.refObjId
  51033. });
  51034. }
  51035. }
  51036. }
  51037. const root = Object.create(null);
  51038. root.children = [];
  51039. root.role = "Root";
  51040. for (const child of this.nodes) {
  51041. if (!child) {
  51042. continue;
  51043. }
  51044. nodeToSerializable(child, root);
  51045. }
  51046. return root;
  51047. }
  51048. }
  51049. exports.StructTreePage = StructTreePage;
  51050. /***/ }),
  51051. /* 75 */
  51052. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  51053. Object.defineProperty(exports, "__esModule", ({
  51054. value: true
  51055. }));
  51056. exports.ObjectLoader = void 0;
  51057. var _primitives = __w_pdfjs_require__(5);
  51058. var _base_stream = __w_pdfjs_require__(7);
  51059. var _core_utils = __w_pdfjs_require__(6);
  51060. var _util = __w_pdfjs_require__(2);
  51061. function mayHaveChildren(value) {
  51062. return value instanceof _primitives.Ref || value instanceof _primitives.Dict || value instanceof _base_stream.BaseStream || Array.isArray(value);
  51063. }
  51064. function addChildren(node, nodesToVisit) {
  51065. if (node instanceof _primitives.Dict) {
  51066. node = node.getRawValues();
  51067. } else if (node instanceof _base_stream.BaseStream) {
  51068. node = node.dict.getRawValues();
  51069. } else if (!Array.isArray(node)) {
  51070. return;
  51071. }
  51072. for (const rawValue of node) {
  51073. if (mayHaveChildren(rawValue)) {
  51074. nodesToVisit.push(rawValue);
  51075. }
  51076. }
  51077. }
  51078. class ObjectLoader {
  51079. constructor(dict, keys, xref) {
  51080. this.dict = dict;
  51081. this.keys = keys;
  51082. this.xref = xref;
  51083. this.refSet = null;
  51084. }
  51085. async load() {
  51086. if (this.xref.stream.isDataLoaded) {
  51087. return undefined;
  51088. }
  51089. const {
  51090. keys,
  51091. dict
  51092. } = this;
  51093. this.refSet = new _primitives.RefSet();
  51094. const nodesToVisit = [];
  51095. for (let i = 0, ii = keys.length; i < ii; i++) {
  51096. const rawValue = dict.getRaw(keys[i]);
  51097. if (rawValue !== undefined) {
  51098. nodesToVisit.push(rawValue);
  51099. }
  51100. }
  51101. return this._walk(nodesToVisit);
  51102. }
  51103. async _walk(nodesToVisit) {
  51104. const nodesToRevisit = [];
  51105. const pendingRequests = [];
  51106. while (nodesToVisit.length) {
  51107. let currentNode = nodesToVisit.pop();
  51108. if (currentNode instanceof _primitives.Ref) {
  51109. if (this.refSet.has(currentNode)) {
  51110. continue;
  51111. }
  51112. try {
  51113. this.refSet.put(currentNode);
  51114. currentNode = this.xref.fetch(currentNode);
  51115. } catch (ex) {
  51116. if (!(ex instanceof _core_utils.MissingDataException)) {
  51117. (0, _util.warn)(`ObjectLoader._walk - requesting all data: "${ex}".`);
  51118. this.refSet = null;
  51119. const {
  51120. manager
  51121. } = this.xref.stream;
  51122. return manager.requestAllChunks();
  51123. }
  51124. nodesToRevisit.push(currentNode);
  51125. pendingRequests.push({
  51126. begin: ex.begin,
  51127. end: ex.end
  51128. });
  51129. }
  51130. }
  51131. if (currentNode instanceof _base_stream.BaseStream) {
  51132. const baseStreams = currentNode.getBaseStreams();
  51133. if (baseStreams) {
  51134. let foundMissingData = false;
  51135. for (const stream of baseStreams) {
  51136. if (stream.isDataLoaded) {
  51137. continue;
  51138. }
  51139. foundMissingData = true;
  51140. pendingRequests.push({
  51141. begin: stream.start,
  51142. end: stream.end
  51143. });
  51144. }
  51145. if (foundMissingData) {
  51146. nodesToRevisit.push(currentNode);
  51147. }
  51148. }
  51149. }
  51150. addChildren(currentNode, nodesToVisit);
  51151. }
  51152. if (pendingRequests.length) {
  51153. await this.xref.stream.manager.requestRanges(pendingRequests);
  51154. for (const node of nodesToRevisit) {
  51155. if (node instanceof _primitives.Ref) {
  51156. this.refSet.remove(node);
  51157. }
  51158. }
  51159. return this._walk(nodesToRevisit);
  51160. }
  51161. this.refSet = null;
  51162. return undefined;
  51163. }
  51164. }
  51165. exports.ObjectLoader = ObjectLoader;
  51166. /***/ }),
  51167. /* 76 */
  51168. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  51169. Object.defineProperty(exports, "__esModule", ({
  51170. value: true
  51171. }));
  51172. exports.XFAFactory = void 0;
  51173. var _xfa_object = __w_pdfjs_require__(77);
  51174. var _bind = __w_pdfjs_require__(81);
  51175. var _data = __w_pdfjs_require__(87);
  51176. var _fonts = __w_pdfjs_require__(85);
  51177. var _utils = __w_pdfjs_require__(78);
  51178. var _util = __w_pdfjs_require__(2);
  51179. var _parser = __w_pdfjs_require__(88);
  51180. var _xhtml = __w_pdfjs_require__(98);
  51181. class XFAFactory {
  51182. constructor(data) {
  51183. try {
  51184. this.root = new _parser.XFAParser().parse(XFAFactory._createDocument(data));
  51185. const binder = new _bind.Binder(this.root);
  51186. this.form = binder.bind();
  51187. this.dataHandler = new _data.DataHandler(this.root, binder.getData());
  51188. this.form[_xfa_object.$globalData].template = this.form;
  51189. } catch (e) {
  51190. (0, _util.warn)(`XFA - an error occurred during parsing and binding: ${e}`);
  51191. }
  51192. }
  51193. isValid() {
  51194. return this.root && this.form;
  51195. }
  51196. _createPagesHelper() {
  51197. const iterator = this.form[_xfa_object.$toPages]();
  51198. return new Promise((resolve, reject) => {
  51199. const nextIteration = () => {
  51200. try {
  51201. const value = iterator.next();
  51202. if (value.done) {
  51203. resolve(value.value);
  51204. } else {
  51205. setTimeout(nextIteration, 0);
  51206. }
  51207. } catch (e) {
  51208. reject(e);
  51209. }
  51210. };
  51211. setTimeout(nextIteration, 0);
  51212. });
  51213. }
  51214. async _createPages() {
  51215. try {
  51216. this.pages = await this._createPagesHelper();
  51217. this.dims = this.pages.children.map(c => {
  51218. const {
  51219. width,
  51220. height
  51221. } = c.attributes.style;
  51222. return [0, 0, parseInt(width), parseInt(height)];
  51223. });
  51224. } catch (e) {
  51225. (0, _util.warn)(`XFA - an error occurred during layout: ${e}`);
  51226. }
  51227. }
  51228. getBoundingBox(pageIndex) {
  51229. return this.dims[pageIndex];
  51230. }
  51231. async getNumPages() {
  51232. if (!this.pages) {
  51233. await this._createPages();
  51234. }
  51235. return this.dims.length;
  51236. }
  51237. setImages(images) {
  51238. this.form[_xfa_object.$globalData].images = images;
  51239. }
  51240. setFonts(fonts) {
  51241. this.form[_xfa_object.$globalData].fontFinder = new _fonts.FontFinder(fonts);
  51242. const missingFonts = [];
  51243. for (let typeface of this.form[_xfa_object.$globalData].usedTypefaces) {
  51244. typeface = (0, _utils.stripQuotes)(typeface);
  51245. const font = this.form[_xfa_object.$globalData].fontFinder.find(typeface);
  51246. if (!font) {
  51247. missingFonts.push(typeface);
  51248. }
  51249. }
  51250. if (missingFonts.length > 0) {
  51251. return missingFonts;
  51252. }
  51253. return null;
  51254. }
  51255. appendFonts(fonts, reallyMissingFonts) {
  51256. this.form[_xfa_object.$globalData].fontFinder.add(fonts, reallyMissingFonts);
  51257. }
  51258. async getPages() {
  51259. if (!this.pages) {
  51260. await this._createPages();
  51261. }
  51262. const pages = this.pages;
  51263. this.pages = null;
  51264. return pages;
  51265. }
  51266. serializeData(storage) {
  51267. return this.dataHandler.serialize(storage);
  51268. }
  51269. static _createDocument(data) {
  51270. if (!data["/xdp:xdp"]) {
  51271. return data["xdp:xdp"];
  51272. }
  51273. return Object.values(data).join("");
  51274. }
  51275. static getRichTextAsHtml(rc) {
  51276. if (!rc || typeof rc !== "string") {
  51277. return null;
  51278. }
  51279. try {
  51280. let root = new _parser.XFAParser(_xhtml.XhtmlNamespace, true).parse(rc);
  51281. if (!["body", "xhtml"].includes(root[_xfa_object.$nodeName])) {
  51282. const newRoot = _xhtml.XhtmlNamespace.body({});
  51283. newRoot[_xfa_object.$appendChild](root);
  51284. root = newRoot;
  51285. }
  51286. const result = root[_xfa_object.$toHTML]();
  51287. if (!result.success) {
  51288. return null;
  51289. }
  51290. const {
  51291. html
  51292. } = result;
  51293. const {
  51294. attributes
  51295. } = html;
  51296. if (attributes) {
  51297. if (attributes.class) {
  51298. attributes.class = attributes.class.filter(attr => !attr.startsWith("xfa"));
  51299. }
  51300. attributes.dir = "auto";
  51301. }
  51302. return {
  51303. html,
  51304. str: root[_xfa_object.$text]()
  51305. };
  51306. } catch (e) {
  51307. (0, _util.warn)(`XFA - an error occurred during parsing of rich text: ${e}`);
  51308. }
  51309. return null;
  51310. }
  51311. }
  51312. exports.XFAFactory = XFAFactory;
  51313. /***/ }),
  51314. /* 77 */
  51315. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  51316. Object.defineProperty(exports, "__esModule", ({
  51317. value: true
  51318. }));
  51319. 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;
  51320. var _utils = __w_pdfjs_require__(78);
  51321. var _util = __w_pdfjs_require__(2);
  51322. var _core_utils = __w_pdfjs_require__(6);
  51323. var _namespaces = __w_pdfjs_require__(79);
  51324. var _som = __w_pdfjs_require__(80);
  51325. const $acceptWhitespace = Symbol();
  51326. exports.$acceptWhitespace = $acceptWhitespace;
  51327. const $addHTML = Symbol();
  51328. exports.$addHTML = $addHTML;
  51329. const $appendChild = Symbol();
  51330. exports.$appendChild = $appendChild;
  51331. const $childrenToHTML = Symbol();
  51332. exports.$childrenToHTML = $childrenToHTML;
  51333. const $clean = Symbol();
  51334. exports.$clean = $clean;
  51335. const $cleanPage = Symbol();
  51336. exports.$cleanPage = $cleanPage;
  51337. const $cleanup = Symbol();
  51338. exports.$cleanup = $cleanup;
  51339. const $clone = Symbol();
  51340. exports.$clone = $clone;
  51341. const $consumed = Symbol();
  51342. exports.$consumed = $consumed;
  51343. const $content = Symbol("content");
  51344. exports.$content = $content;
  51345. const $data = Symbol("data");
  51346. exports.$data = $data;
  51347. const $dump = Symbol();
  51348. exports.$dump = $dump;
  51349. const $extra = Symbol("extra");
  51350. exports.$extra = $extra;
  51351. const $finalize = Symbol();
  51352. exports.$finalize = $finalize;
  51353. const $flushHTML = Symbol();
  51354. exports.$flushHTML = $flushHTML;
  51355. const $getAttributeIt = Symbol();
  51356. exports.$getAttributeIt = $getAttributeIt;
  51357. const $getAttributes = Symbol();
  51358. exports.$getAttributes = $getAttributes;
  51359. const $getAvailableSpace = Symbol();
  51360. exports.$getAvailableSpace = $getAvailableSpace;
  51361. const $getChildrenByClass = Symbol();
  51362. exports.$getChildrenByClass = $getChildrenByClass;
  51363. const $getChildrenByName = Symbol();
  51364. exports.$getChildrenByName = $getChildrenByName;
  51365. const $getChildrenByNameIt = Symbol();
  51366. exports.$getChildrenByNameIt = $getChildrenByNameIt;
  51367. const $getDataValue = Symbol();
  51368. exports.$getDataValue = $getDataValue;
  51369. const $getExtra = Symbol();
  51370. exports.$getExtra = $getExtra;
  51371. const $getRealChildrenByNameIt = Symbol();
  51372. exports.$getRealChildrenByNameIt = $getRealChildrenByNameIt;
  51373. const $getChildren = Symbol();
  51374. exports.$getChildren = $getChildren;
  51375. const $getContainedChildren = Symbol();
  51376. exports.$getContainedChildren = $getContainedChildren;
  51377. const $getNextPage = Symbol();
  51378. exports.$getNextPage = $getNextPage;
  51379. const $getSubformParent = Symbol();
  51380. exports.$getSubformParent = $getSubformParent;
  51381. const $getParent = Symbol();
  51382. exports.$getParent = $getParent;
  51383. const $getTemplateRoot = Symbol();
  51384. exports.$getTemplateRoot = $getTemplateRoot;
  51385. const $globalData = Symbol();
  51386. exports.$globalData = $globalData;
  51387. const $hasSettableValue = Symbol();
  51388. exports.$hasSettableValue = $hasSettableValue;
  51389. const $ids = Symbol();
  51390. exports.$ids = $ids;
  51391. const $indexOf = Symbol();
  51392. exports.$indexOf = $indexOf;
  51393. const $insertAt = Symbol();
  51394. exports.$insertAt = $insertAt;
  51395. const $isCDATAXml = Symbol();
  51396. exports.$isCDATAXml = $isCDATAXml;
  51397. const $isBindable = Symbol();
  51398. exports.$isBindable = $isBindable;
  51399. const $isDataValue = Symbol();
  51400. exports.$isDataValue = $isDataValue;
  51401. const $isDescendent = Symbol();
  51402. exports.$isDescendent = $isDescendent;
  51403. const $isNsAgnostic = Symbol();
  51404. exports.$isNsAgnostic = $isNsAgnostic;
  51405. const $isSplittable = Symbol();
  51406. exports.$isSplittable = $isSplittable;
  51407. const $isThereMoreWidth = Symbol();
  51408. exports.$isThereMoreWidth = $isThereMoreWidth;
  51409. const $isTransparent = Symbol();
  51410. exports.$isTransparent = $isTransparent;
  51411. const $isUsable = Symbol();
  51412. exports.$isUsable = $isUsable;
  51413. const $lastAttribute = Symbol();
  51414. const $namespaceId = Symbol("namespaceId");
  51415. exports.$namespaceId = $namespaceId;
  51416. const $nodeName = Symbol("nodeName");
  51417. exports.$nodeName = $nodeName;
  51418. const $nsAttributes = Symbol();
  51419. exports.$nsAttributes = $nsAttributes;
  51420. const $onChild = Symbol();
  51421. exports.$onChild = $onChild;
  51422. const $onChildCheck = Symbol();
  51423. exports.$onChildCheck = $onChildCheck;
  51424. const $onText = Symbol();
  51425. exports.$onText = $onText;
  51426. const $pushGlyphs = Symbol();
  51427. exports.$pushGlyphs = $pushGlyphs;
  51428. const $popPara = Symbol();
  51429. exports.$popPara = $popPara;
  51430. const $pushPara = Symbol();
  51431. exports.$pushPara = $pushPara;
  51432. const $removeChild = Symbol();
  51433. exports.$removeChild = $removeChild;
  51434. const $root = Symbol("root");
  51435. exports.$root = $root;
  51436. const $resolvePrototypes = Symbol();
  51437. exports.$resolvePrototypes = $resolvePrototypes;
  51438. const $searchNode = Symbol();
  51439. exports.$searchNode = $searchNode;
  51440. const $setId = Symbol();
  51441. exports.$setId = $setId;
  51442. const $setSetAttributes = Symbol();
  51443. exports.$setSetAttributes = $setSetAttributes;
  51444. const $setValue = Symbol();
  51445. exports.$setValue = $setValue;
  51446. const $tabIndex = Symbol();
  51447. exports.$tabIndex = $tabIndex;
  51448. const $text = Symbol();
  51449. exports.$text = $text;
  51450. const $toPages = Symbol();
  51451. exports.$toPages = $toPages;
  51452. const $toHTML = Symbol();
  51453. exports.$toHTML = $toHTML;
  51454. const $toString = Symbol();
  51455. exports.$toString = $toString;
  51456. const $toStyle = Symbol();
  51457. exports.$toStyle = $toStyle;
  51458. const $uid = Symbol("uid");
  51459. exports.$uid = $uid;
  51460. const _applyPrototype = Symbol();
  51461. const _attributes = Symbol();
  51462. const _attributeNames = Symbol();
  51463. const _children = Symbol("_children");
  51464. const _cloneAttribute = Symbol();
  51465. const _dataValue = Symbol();
  51466. const _defaultValue = Symbol();
  51467. const _filteredChildrenGenerator = Symbol();
  51468. const _getPrototype = Symbol();
  51469. const _getUnsetAttributes = Symbol();
  51470. const _hasChildren = Symbol();
  51471. const _max = Symbol();
  51472. const _options = Symbol();
  51473. const _parent = Symbol("parent");
  51474. const _resolvePrototypesHelper = Symbol();
  51475. const _setAttributes = Symbol();
  51476. const _validator = Symbol();
  51477. let uid = 0;
  51478. const NS_DATASETS = _namespaces.NamespaceIds.datasets.id;
  51479. class XFAObject {
  51480. constructor(nsId, name, hasChildren = false) {
  51481. this[$namespaceId] = nsId;
  51482. this[$nodeName] = name;
  51483. this[_hasChildren] = hasChildren;
  51484. this[_parent] = null;
  51485. this[_children] = [];
  51486. this[$uid] = `${name}${uid++}`;
  51487. this[$globalData] = null;
  51488. }
  51489. [$onChild](child) {
  51490. if (!this[_hasChildren] || !this[$onChildCheck](child)) {
  51491. return false;
  51492. }
  51493. const name = child[$nodeName];
  51494. const node = this[name];
  51495. if (node instanceof XFAObjectArray) {
  51496. if (node.push(child)) {
  51497. this[$appendChild](child);
  51498. return true;
  51499. }
  51500. } else {
  51501. if (node !== null) {
  51502. this[$removeChild](node);
  51503. }
  51504. this[name] = child;
  51505. this[$appendChild](child);
  51506. return true;
  51507. }
  51508. let id = "";
  51509. if (this.id) {
  51510. id = ` (id: ${this.id})`;
  51511. } else if (this.name) {
  51512. id = ` (name: ${this.name} ${this.h.value})`;
  51513. }
  51514. (0, _util.warn)(`XFA - node "${this[$nodeName]}"${id} has already enough "${name}"!`);
  51515. return false;
  51516. }
  51517. [$onChildCheck](child) {
  51518. return this.hasOwnProperty(child[$nodeName]) && child[$namespaceId] === this[$namespaceId];
  51519. }
  51520. [$isNsAgnostic]() {
  51521. return false;
  51522. }
  51523. [$acceptWhitespace]() {
  51524. return false;
  51525. }
  51526. [$isCDATAXml]() {
  51527. return false;
  51528. }
  51529. [$isBindable]() {
  51530. return false;
  51531. }
  51532. [$popPara]() {
  51533. if (this.para) {
  51534. this[$getTemplateRoot]()[$extra].paraStack.pop();
  51535. }
  51536. }
  51537. [$pushPara]() {
  51538. this[$getTemplateRoot]()[$extra].paraStack.push(this.para);
  51539. }
  51540. [$setId](ids) {
  51541. if (this.id && this[$namespaceId] === _namespaces.NamespaceIds.template.id) {
  51542. ids.set(this.id, this);
  51543. }
  51544. }
  51545. [$getTemplateRoot]() {
  51546. return this[$globalData].template;
  51547. }
  51548. [$isSplittable]() {
  51549. return false;
  51550. }
  51551. [$isThereMoreWidth]() {
  51552. return false;
  51553. }
  51554. [$appendChild](child) {
  51555. child[_parent] = this;
  51556. this[_children].push(child);
  51557. if (!child[$globalData] && this[$globalData]) {
  51558. child[$globalData] = this[$globalData];
  51559. }
  51560. }
  51561. [$removeChild](child) {
  51562. const i = this[_children].indexOf(child);
  51563. this[_children].splice(i, 1);
  51564. }
  51565. [$hasSettableValue]() {
  51566. return this.hasOwnProperty("value");
  51567. }
  51568. [$setValue](_) {}
  51569. [$onText](_) {}
  51570. [$finalize]() {}
  51571. [$clean](builder) {
  51572. delete this[_hasChildren];
  51573. if (this[$cleanup]) {
  51574. builder.clean(this[$cleanup]);
  51575. delete this[$cleanup];
  51576. }
  51577. }
  51578. [$indexOf](child) {
  51579. return this[_children].indexOf(child);
  51580. }
  51581. [$insertAt](i, child) {
  51582. child[_parent] = this;
  51583. this[_children].splice(i, 0, child);
  51584. if (!child[$globalData] && this[$globalData]) {
  51585. child[$globalData] = this[$globalData];
  51586. }
  51587. }
  51588. [$isTransparent]() {
  51589. return !this.name;
  51590. }
  51591. [$lastAttribute]() {
  51592. return "";
  51593. }
  51594. [$text]() {
  51595. if (this[_children].length === 0) {
  51596. return this[$content];
  51597. }
  51598. return this[_children].map(c => c[$text]()).join("");
  51599. }
  51600. get [_attributeNames]() {
  51601. const proto = Object.getPrototypeOf(this);
  51602. if (!proto._attributes) {
  51603. const attributes = proto._attributes = new Set();
  51604. for (const name of Object.getOwnPropertyNames(this)) {
  51605. if (this[name] === null || this[name] instanceof XFAObject || this[name] instanceof XFAObjectArray) {
  51606. break;
  51607. }
  51608. attributes.add(name);
  51609. }
  51610. }
  51611. return (0, _util.shadow)(this, _attributeNames, proto._attributes);
  51612. }
  51613. [$isDescendent](parent) {
  51614. let node = this;
  51615. while (node) {
  51616. if (node === parent) {
  51617. return true;
  51618. }
  51619. node = node[$getParent]();
  51620. }
  51621. return false;
  51622. }
  51623. [$getParent]() {
  51624. return this[_parent];
  51625. }
  51626. [$getSubformParent]() {
  51627. return this[$getParent]();
  51628. }
  51629. [$getChildren](name = null) {
  51630. if (!name) {
  51631. return this[_children];
  51632. }
  51633. return this[name];
  51634. }
  51635. [$dump]() {
  51636. const dumped = Object.create(null);
  51637. if (this[$content]) {
  51638. dumped.$content = this[$content];
  51639. }
  51640. for (const name of Object.getOwnPropertyNames(this)) {
  51641. const value = this[name];
  51642. if (value === null) {
  51643. continue;
  51644. }
  51645. if (value instanceof XFAObject) {
  51646. dumped[name] = value[$dump]();
  51647. } else if (value instanceof XFAObjectArray) {
  51648. if (!value.isEmpty()) {
  51649. dumped[name] = value.dump();
  51650. }
  51651. } else {
  51652. dumped[name] = value;
  51653. }
  51654. }
  51655. return dumped;
  51656. }
  51657. [$toStyle]() {
  51658. return null;
  51659. }
  51660. [$toHTML]() {
  51661. return _utils.HTMLResult.EMPTY;
  51662. }
  51663. *[$getContainedChildren]() {
  51664. for (const node of this[$getChildren]()) {
  51665. yield node;
  51666. }
  51667. }
  51668. *[_filteredChildrenGenerator](filter, include) {
  51669. for (const node of this[$getContainedChildren]()) {
  51670. if (!filter || include === filter.has(node[$nodeName])) {
  51671. const availableSpace = this[$getAvailableSpace]();
  51672. const res = node[$toHTML](availableSpace);
  51673. if (!res.success) {
  51674. this[$extra].failingNode = node;
  51675. }
  51676. yield res;
  51677. }
  51678. }
  51679. }
  51680. [$flushHTML]() {
  51681. return null;
  51682. }
  51683. [$addHTML](html, bbox) {
  51684. this[$extra].children.push(html);
  51685. }
  51686. [$getAvailableSpace]() {}
  51687. [$childrenToHTML]({
  51688. filter = null,
  51689. include = true
  51690. }) {
  51691. if (!this[$extra].generator) {
  51692. this[$extra].generator = this[_filteredChildrenGenerator](filter, include);
  51693. } else {
  51694. const availableSpace = this[$getAvailableSpace]();
  51695. const res = this[$extra].failingNode[$toHTML](availableSpace);
  51696. if (!res.success) {
  51697. return res;
  51698. }
  51699. if (res.html) {
  51700. this[$addHTML](res.html, res.bbox);
  51701. }
  51702. delete this[$extra].failingNode;
  51703. }
  51704. while (true) {
  51705. const gen = this[$extra].generator.next();
  51706. if (gen.done) {
  51707. break;
  51708. }
  51709. const res = gen.value;
  51710. if (!res.success) {
  51711. return res;
  51712. }
  51713. if (res.html) {
  51714. this[$addHTML](res.html, res.bbox);
  51715. }
  51716. }
  51717. this[$extra].generator = null;
  51718. return _utils.HTMLResult.EMPTY;
  51719. }
  51720. [$setSetAttributes](attributes) {
  51721. this[_setAttributes] = new Set(Object.keys(attributes));
  51722. }
  51723. [_getUnsetAttributes](protoAttributes) {
  51724. const allAttr = this[_attributeNames];
  51725. const setAttr = this[_setAttributes];
  51726. return [...protoAttributes].filter(x => allAttr.has(x) && !setAttr.has(x));
  51727. }
  51728. [$resolvePrototypes](ids, ancestors = new Set()) {
  51729. for (const child of this[_children]) {
  51730. child[_resolvePrototypesHelper](ids, ancestors);
  51731. }
  51732. }
  51733. [_resolvePrototypesHelper](ids, ancestors) {
  51734. const proto = this[_getPrototype](ids, ancestors);
  51735. if (proto) {
  51736. this[_applyPrototype](proto, ids, ancestors);
  51737. } else {
  51738. this[$resolvePrototypes](ids, ancestors);
  51739. }
  51740. }
  51741. [_getPrototype](ids, ancestors) {
  51742. const {
  51743. use,
  51744. usehref
  51745. } = this;
  51746. if (!use && !usehref) {
  51747. return null;
  51748. }
  51749. let proto = null;
  51750. let somExpression = null;
  51751. let id = null;
  51752. let ref = use;
  51753. if (usehref) {
  51754. ref = usehref;
  51755. if (usehref.startsWith("#som(") && usehref.endsWith(")")) {
  51756. somExpression = usehref.slice("#som(".length, usehref.length - 1);
  51757. } else if (usehref.startsWith(".#som(") && usehref.endsWith(")")) {
  51758. somExpression = usehref.slice(".#som(".length, usehref.length - 1);
  51759. } else if (usehref.startsWith("#")) {
  51760. id = usehref.slice(1);
  51761. } else if (usehref.startsWith(".#")) {
  51762. id = usehref.slice(2);
  51763. }
  51764. } else if (use.startsWith("#")) {
  51765. id = use.slice(1);
  51766. } else {
  51767. somExpression = use;
  51768. }
  51769. this.use = this.usehref = "";
  51770. if (id) {
  51771. proto = ids.get(id);
  51772. } else {
  51773. proto = (0, _som.searchNode)(ids.get($root), this, somExpression, true, false);
  51774. if (proto) {
  51775. proto = proto[0];
  51776. }
  51777. }
  51778. if (!proto) {
  51779. (0, _util.warn)(`XFA - Invalid prototype reference: ${ref}.`);
  51780. return null;
  51781. }
  51782. if (proto[$nodeName] !== this[$nodeName]) {
  51783. (0, _util.warn)(`XFA - Incompatible prototype: ${proto[$nodeName]} !== ${this[$nodeName]}.`);
  51784. return null;
  51785. }
  51786. if (ancestors.has(proto)) {
  51787. (0, _util.warn)(`XFA - Cycle detected in prototypes use.`);
  51788. return null;
  51789. }
  51790. ancestors.add(proto);
  51791. const protoProto = proto[_getPrototype](ids, ancestors);
  51792. if (protoProto) {
  51793. proto[_applyPrototype](protoProto, ids, ancestors);
  51794. }
  51795. proto[$resolvePrototypes](ids, ancestors);
  51796. ancestors.delete(proto);
  51797. return proto;
  51798. }
  51799. [_applyPrototype](proto, ids, ancestors) {
  51800. if (ancestors.has(proto)) {
  51801. (0, _util.warn)(`XFA - Cycle detected in prototypes use.`);
  51802. return;
  51803. }
  51804. if (!this[$content] && proto[$content]) {
  51805. this[$content] = proto[$content];
  51806. }
  51807. const newAncestors = new Set(ancestors);
  51808. newAncestors.add(proto);
  51809. for (const unsetAttrName of this[_getUnsetAttributes](proto[_setAttributes])) {
  51810. this[unsetAttrName] = proto[unsetAttrName];
  51811. if (this[_setAttributes]) {
  51812. this[_setAttributes].add(unsetAttrName);
  51813. }
  51814. }
  51815. for (const name of Object.getOwnPropertyNames(this)) {
  51816. if (this[_attributeNames].has(name)) {
  51817. continue;
  51818. }
  51819. const value = this[name];
  51820. const protoValue = proto[name];
  51821. if (value instanceof XFAObjectArray) {
  51822. for (const child of value[_children]) {
  51823. child[_resolvePrototypesHelper](ids, ancestors);
  51824. }
  51825. for (let i = value[_children].length, ii = protoValue[_children].length; i < ii; i++) {
  51826. const child = proto[_children][i][$clone]();
  51827. if (value.push(child)) {
  51828. child[_parent] = this;
  51829. this[_children].push(child);
  51830. child[_resolvePrototypesHelper](ids, ancestors);
  51831. } else {
  51832. break;
  51833. }
  51834. }
  51835. continue;
  51836. }
  51837. if (value !== null) {
  51838. value[$resolvePrototypes](ids, ancestors);
  51839. if (protoValue) {
  51840. value[_applyPrototype](protoValue, ids, ancestors);
  51841. }
  51842. continue;
  51843. }
  51844. if (protoValue !== null) {
  51845. const child = protoValue[$clone]();
  51846. child[_parent] = this;
  51847. this[name] = child;
  51848. this[_children].push(child);
  51849. child[_resolvePrototypesHelper](ids, ancestors);
  51850. }
  51851. }
  51852. }
  51853. static [_cloneAttribute](obj) {
  51854. if (Array.isArray(obj)) {
  51855. return obj.map(x => XFAObject[_cloneAttribute](x));
  51856. }
  51857. if (typeof obj === "object" && obj !== null) {
  51858. return Object.assign({}, obj);
  51859. }
  51860. return obj;
  51861. }
  51862. [$clone]() {
  51863. const clone = Object.create(Object.getPrototypeOf(this));
  51864. for (const $symbol of Object.getOwnPropertySymbols(this)) {
  51865. try {
  51866. clone[$symbol] = this[$symbol];
  51867. } catch (_) {
  51868. (0, _util.shadow)(clone, $symbol, this[$symbol]);
  51869. }
  51870. }
  51871. clone[$uid] = `${clone[$nodeName]}${uid++}`;
  51872. clone[_children] = [];
  51873. for (const name of Object.getOwnPropertyNames(this)) {
  51874. if (this[_attributeNames].has(name)) {
  51875. clone[name] = XFAObject[_cloneAttribute](this[name]);
  51876. continue;
  51877. }
  51878. const value = this[name];
  51879. if (value instanceof XFAObjectArray) {
  51880. clone[name] = new XFAObjectArray(value[_max]);
  51881. } else {
  51882. clone[name] = null;
  51883. }
  51884. }
  51885. for (const child of this[_children]) {
  51886. const name = child[$nodeName];
  51887. const clonedChild = child[$clone]();
  51888. clone[_children].push(clonedChild);
  51889. clonedChild[_parent] = clone;
  51890. if (clone[name] === null) {
  51891. clone[name] = clonedChild;
  51892. } else {
  51893. clone[name][_children].push(clonedChild);
  51894. }
  51895. }
  51896. return clone;
  51897. }
  51898. [$getChildren](name = null) {
  51899. if (!name) {
  51900. return this[_children];
  51901. }
  51902. return this[_children].filter(c => c[$nodeName] === name);
  51903. }
  51904. [$getChildrenByClass](name) {
  51905. return this[name];
  51906. }
  51907. [$getChildrenByName](name, allTransparent, first = true) {
  51908. return Array.from(this[$getChildrenByNameIt](name, allTransparent, first));
  51909. }
  51910. *[$getChildrenByNameIt](name, allTransparent, first = true) {
  51911. if (name === "parent") {
  51912. yield this[_parent];
  51913. return;
  51914. }
  51915. for (const child of this[_children]) {
  51916. if (child[$nodeName] === name) {
  51917. yield child;
  51918. }
  51919. if (child.name === name) {
  51920. yield child;
  51921. }
  51922. if (allTransparent || child[$isTransparent]()) {
  51923. yield* child[$getChildrenByNameIt](name, allTransparent, false);
  51924. }
  51925. }
  51926. if (first && this[_attributeNames].has(name)) {
  51927. yield new XFAAttribute(this, name, this[name]);
  51928. }
  51929. }
  51930. }
  51931. exports.XFAObject = XFAObject;
  51932. class XFAObjectArray {
  51933. constructor(max = Infinity) {
  51934. this[_max] = max;
  51935. this[_children] = [];
  51936. }
  51937. push(child) {
  51938. const len = this[_children].length;
  51939. if (len <= this[_max]) {
  51940. this[_children].push(child);
  51941. return true;
  51942. }
  51943. (0, _util.warn)(`XFA - node "${child[$nodeName]}" accepts no more than ${this[_max]} children`);
  51944. return false;
  51945. }
  51946. isEmpty() {
  51947. return this[_children].length === 0;
  51948. }
  51949. dump() {
  51950. return this[_children].length === 1 ? this[_children][0][$dump]() : this[_children].map(x => x[$dump]());
  51951. }
  51952. [$clone]() {
  51953. const clone = new XFAObjectArray(this[_max]);
  51954. clone[_children] = this[_children].map(c => c[$clone]());
  51955. return clone;
  51956. }
  51957. get children() {
  51958. return this[_children];
  51959. }
  51960. clear() {
  51961. this[_children].length = 0;
  51962. }
  51963. }
  51964. exports.XFAObjectArray = XFAObjectArray;
  51965. class XFAAttribute {
  51966. constructor(node, name, value) {
  51967. this[_parent] = node;
  51968. this[$nodeName] = name;
  51969. this[$content] = value;
  51970. this[$consumed] = false;
  51971. this[$uid] = `attribute${uid++}`;
  51972. }
  51973. [$getParent]() {
  51974. return this[_parent];
  51975. }
  51976. [$isDataValue]() {
  51977. return true;
  51978. }
  51979. [$getDataValue]() {
  51980. return this[$content].trim();
  51981. }
  51982. [$setValue](value) {
  51983. value = value.value || "";
  51984. this[$content] = value.toString();
  51985. }
  51986. [$text]() {
  51987. return this[$content];
  51988. }
  51989. [$isDescendent](parent) {
  51990. return this[_parent] === parent || this[_parent][$isDescendent](parent);
  51991. }
  51992. }
  51993. exports.XFAAttribute = XFAAttribute;
  51994. class XmlObject extends XFAObject {
  51995. constructor(nsId, name, attributes = {}) {
  51996. super(nsId, name);
  51997. this[$content] = "";
  51998. this[_dataValue] = null;
  51999. if (name !== "#text") {
  52000. const map = new Map();
  52001. this[_attributes] = map;
  52002. for (const [attrName, value] of Object.entries(attributes)) {
  52003. map.set(attrName, new XFAAttribute(this, attrName, value));
  52004. }
  52005. if (attributes.hasOwnProperty($nsAttributes)) {
  52006. const dataNode = attributes[$nsAttributes].xfa.dataNode;
  52007. if (dataNode !== undefined) {
  52008. if (dataNode === "dataGroup") {
  52009. this[_dataValue] = false;
  52010. } else if (dataNode === "dataValue") {
  52011. this[_dataValue] = true;
  52012. }
  52013. }
  52014. }
  52015. }
  52016. this[$consumed] = false;
  52017. }
  52018. [$toString](buf) {
  52019. const tagName = this[$nodeName];
  52020. if (tagName === "#text") {
  52021. buf.push((0, _core_utils.encodeToXmlString)(this[$content]));
  52022. return;
  52023. }
  52024. const utf8TagName = (0, _util.utf8StringToString)(tagName);
  52025. const prefix = this[$namespaceId] === NS_DATASETS ? "xfa:" : "";
  52026. buf.push(`<${prefix}${utf8TagName}`);
  52027. for (const [name, value] of this[_attributes].entries()) {
  52028. const utf8Name = (0, _util.utf8StringToString)(name);
  52029. buf.push(` ${utf8Name}="${(0, _core_utils.encodeToXmlString)(value[$content])}"`);
  52030. }
  52031. if (this[_dataValue] !== null) {
  52032. if (this[_dataValue]) {
  52033. buf.push(` xfa:dataNode="dataValue"`);
  52034. } else {
  52035. buf.push(` xfa:dataNode="dataGroup"`);
  52036. }
  52037. }
  52038. if (!this[$content] && this[_children].length === 0) {
  52039. buf.push("/>");
  52040. return;
  52041. }
  52042. buf.push(">");
  52043. if (this[$content]) {
  52044. if (typeof this[$content] === "string") {
  52045. buf.push((0, _core_utils.encodeToXmlString)(this[$content]));
  52046. } else {
  52047. this[$content][$toString](buf);
  52048. }
  52049. } else {
  52050. for (const child of this[_children]) {
  52051. child[$toString](buf);
  52052. }
  52053. }
  52054. buf.push(`</${prefix}${utf8TagName}>`);
  52055. }
  52056. [$onChild](child) {
  52057. if (this[$content]) {
  52058. const node = new XmlObject(this[$namespaceId], "#text");
  52059. this[$appendChild](node);
  52060. node[$content] = this[$content];
  52061. this[$content] = "";
  52062. }
  52063. this[$appendChild](child);
  52064. return true;
  52065. }
  52066. [$onText](str) {
  52067. this[$content] += str;
  52068. }
  52069. [$finalize]() {
  52070. if (this[$content] && this[_children].length > 0) {
  52071. const node = new XmlObject(this[$namespaceId], "#text");
  52072. this[$appendChild](node);
  52073. node[$content] = this[$content];
  52074. delete this[$content];
  52075. }
  52076. }
  52077. [$toHTML]() {
  52078. if (this[$nodeName] === "#text") {
  52079. return _utils.HTMLResult.success({
  52080. name: "#text",
  52081. value: this[$content]
  52082. });
  52083. }
  52084. return _utils.HTMLResult.EMPTY;
  52085. }
  52086. [$getChildren](name = null) {
  52087. if (!name) {
  52088. return this[_children];
  52089. }
  52090. return this[_children].filter(c => c[$nodeName] === name);
  52091. }
  52092. [$getAttributes]() {
  52093. return this[_attributes];
  52094. }
  52095. [$getChildrenByClass](name) {
  52096. const value = this[_attributes].get(name);
  52097. if (value !== undefined) {
  52098. return value;
  52099. }
  52100. return this[$getChildren](name);
  52101. }
  52102. *[$getChildrenByNameIt](name, allTransparent) {
  52103. const value = this[_attributes].get(name);
  52104. if (value) {
  52105. yield value;
  52106. }
  52107. for (const child of this[_children]) {
  52108. if (child[$nodeName] === name) {
  52109. yield child;
  52110. }
  52111. if (allTransparent) {
  52112. yield* child[$getChildrenByNameIt](name, allTransparent);
  52113. }
  52114. }
  52115. }
  52116. *[$getAttributeIt](name, skipConsumed) {
  52117. const value = this[_attributes].get(name);
  52118. if (value && (!skipConsumed || !value[$consumed])) {
  52119. yield value;
  52120. }
  52121. for (const child of this[_children]) {
  52122. yield* child[$getAttributeIt](name, skipConsumed);
  52123. }
  52124. }
  52125. *[$getRealChildrenByNameIt](name, allTransparent, skipConsumed) {
  52126. for (const child of this[_children]) {
  52127. if (child[$nodeName] === name && (!skipConsumed || !child[$consumed])) {
  52128. yield child;
  52129. }
  52130. if (allTransparent) {
  52131. yield* child[$getRealChildrenByNameIt](name, allTransparent, skipConsumed);
  52132. }
  52133. }
  52134. }
  52135. [$isDataValue]() {
  52136. if (this[_dataValue] === null) {
  52137. return this[_children].length === 0 || this[_children][0][$namespaceId] === _namespaces.NamespaceIds.xhtml.id;
  52138. }
  52139. return this[_dataValue];
  52140. }
  52141. [$getDataValue]() {
  52142. if (this[_dataValue] === null) {
  52143. if (this[_children].length === 0) {
  52144. return this[$content].trim();
  52145. }
  52146. if (this[_children][0][$namespaceId] === _namespaces.NamespaceIds.xhtml.id) {
  52147. return this[_children][0][$text]().trim();
  52148. }
  52149. return null;
  52150. }
  52151. return this[$content].trim();
  52152. }
  52153. [$setValue](value) {
  52154. value = value.value || "";
  52155. this[$content] = value.toString();
  52156. }
  52157. [$dump](hasNS = false) {
  52158. const dumped = Object.create(null);
  52159. if (hasNS) {
  52160. dumped.$ns = this[$namespaceId];
  52161. }
  52162. if (this[$content]) {
  52163. dumped.$content = this[$content];
  52164. }
  52165. dumped.$name = this[$nodeName];
  52166. dumped.children = [];
  52167. for (const child of this[_children]) {
  52168. dumped.children.push(child[$dump](hasNS));
  52169. }
  52170. dumped.attributes = Object.create(null);
  52171. for (const [name, value] of this[_attributes]) {
  52172. dumped.attributes[name] = value[$content];
  52173. }
  52174. return dumped;
  52175. }
  52176. }
  52177. exports.XmlObject = XmlObject;
  52178. class ContentObject extends XFAObject {
  52179. constructor(nsId, name) {
  52180. super(nsId, name);
  52181. this[$content] = "";
  52182. }
  52183. [$onText](text) {
  52184. this[$content] += text;
  52185. }
  52186. [$finalize]() {}
  52187. }
  52188. exports.ContentObject = ContentObject;
  52189. class OptionObject extends ContentObject {
  52190. constructor(nsId, name, options) {
  52191. super(nsId, name);
  52192. this[_options] = options;
  52193. }
  52194. [$finalize]() {
  52195. this[$content] = (0, _utils.getKeyword)({
  52196. data: this[$content],
  52197. defaultValue: this[_options][0],
  52198. validate: k => this[_options].includes(k)
  52199. });
  52200. }
  52201. [$clean](builder) {
  52202. super[$clean](builder);
  52203. delete this[_options];
  52204. }
  52205. }
  52206. exports.OptionObject = OptionObject;
  52207. class StringObject extends ContentObject {
  52208. [$finalize]() {
  52209. this[$content] = this[$content].trim();
  52210. }
  52211. }
  52212. exports.StringObject = StringObject;
  52213. class IntegerObject extends ContentObject {
  52214. constructor(nsId, name, defaultValue, validator) {
  52215. super(nsId, name);
  52216. this[_defaultValue] = defaultValue;
  52217. this[_validator] = validator;
  52218. }
  52219. [$finalize]() {
  52220. this[$content] = (0, _utils.getInteger)({
  52221. data: this[$content],
  52222. defaultValue: this[_defaultValue],
  52223. validate: this[_validator]
  52224. });
  52225. }
  52226. [$clean](builder) {
  52227. super[$clean](builder);
  52228. delete this[_defaultValue];
  52229. delete this[_validator];
  52230. }
  52231. }
  52232. exports.IntegerObject = IntegerObject;
  52233. class Option01 extends IntegerObject {
  52234. constructor(nsId, name) {
  52235. super(nsId, name, 0, n => n === 1);
  52236. }
  52237. }
  52238. exports.Option01 = Option01;
  52239. class Option10 extends IntegerObject {
  52240. constructor(nsId, name) {
  52241. super(nsId, name, 1, n => n === 0);
  52242. }
  52243. }
  52244. exports.Option10 = Option10;
  52245. /***/ }),
  52246. /* 78 */
  52247. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  52248. Object.defineProperty(exports, "__esModule", ({
  52249. value: true
  52250. }));
  52251. exports.HTMLResult = void 0;
  52252. exports.getBBox = getBBox;
  52253. exports.getColor = getColor;
  52254. exports.getFloat = getFloat;
  52255. exports.getInteger = getInteger;
  52256. exports.getKeyword = getKeyword;
  52257. exports.getMeasurement = getMeasurement;
  52258. exports.getRatio = getRatio;
  52259. exports.getRelevant = getRelevant;
  52260. exports.getStringOption = getStringOption;
  52261. exports.stripQuotes = stripQuotes;
  52262. var _util = __w_pdfjs_require__(2);
  52263. const dimConverters = {
  52264. pt: x => x,
  52265. cm: x => x / 2.54 * 72,
  52266. mm: x => x / (10 * 2.54) * 72,
  52267. in: x => x * 72,
  52268. px: x => x
  52269. };
  52270. const measurementPattern = /([+-]?\d+\.?\d*)(.*)/;
  52271. function stripQuotes(str) {
  52272. if (str.startsWith("'") || str.startsWith('"')) {
  52273. return str.slice(1, str.length - 1);
  52274. }
  52275. return str;
  52276. }
  52277. function getInteger({
  52278. data,
  52279. defaultValue,
  52280. validate
  52281. }) {
  52282. if (!data) {
  52283. return defaultValue;
  52284. }
  52285. data = data.trim();
  52286. const n = parseInt(data, 10);
  52287. if (!isNaN(n) && validate(n)) {
  52288. return n;
  52289. }
  52290. return defaultValue;
  52291. }
  52292. function getFloat({
  52293. data,
  52294. defaultValue,
  52295. validate
  52296. }) {
  52297. if (!data) {
  52298. return defaultValue;
  52299. }
  52300. data = data.trim();
  52301. const n = parseFloat(data);
  52302. if (!isNaN(n) && validate(n)) {
  52303. return n;
  52304. }
  52305. return defaultValue;
  52306. }
  52307. function getKeyword({
  52308. data,
  52309. defaultValue,
  52310. validate
  52311. }) {
  52312. if (!data) {
  52313. return defaultValue;
  52314. }
  52315. data = data.trim();
  52316. if (validate(data)) {
  52317. return data;
  52318. }
  52319. return defaultValue;
  52320. }
  52321. function getStringOption(data, options) {
  52322. return getKeyword({
  52323. data,
  52324. defaultValue: options[0],
  52325. validate: k => options.includes(k)
  52326. });
  52327. }
  52328. function getMeasurement(str, def = "0") {
  52329. def = def || "0";
  52330. if (!str) {
  52331. return getMeasurement(def);
  52332. }
  52333. const match = str.trim().match(measurementPattern);
  52334. if (!match) {
  52335. return getMeasurement(def);
  52336. }
  52337. const [, valueStr, unit] = match;
  52338. const value = parseFloat(valueStr);
  52339. if (isNaN(value)) {
  52340. return getMeasurement(def);
  52341. }
  52342. if (value === 0) {
  52343. return 0;
  52344. }
  52345. const conv = dimConverters[unit];
  52346. if (conv) {
  52347. return conv(value);
  52348. }
  52349. return value;
  52350. }
  52351. function getRatio(data) {
  52352. if (!data) {
  52353. return {
  52354. num: 1,
  52355. den: 1
  52356. };
  52357. }
  52358. const ratio = data.trim().split(/\s*:\s*/).map(x => parseFloat(x)).filter(x => !isNaN(x));
  52359. if (ratio.length === 1) {
  52360. ratio.push(1);
  52361. }
  52362. if (ratio.length === 0) {
  52363. return {
  52364. num: 1,
  52365. den: 1
  52366. };
  52367. }
  52368. const [num, den] = ratio;
  52369. return {
  52370. num,
  52371. den
  52372. };
  52373. }
  52374. function getRelevant(data) {
  52375. if (!data) {
  52376. return [];
  52377. }
  52378. return data.trim().split(/\s+/).map(e => {
  52379. return {
  52380. excluded: e[0] === "-",
  52381. viewname: e.substring(1)
  52382. };
  52383. });
  52384. }
  52385. function getColor(data, def = [0, 0, 0]) {
  52386. let [r, g, b] = def;
  52387. if (!data) {
  52388. return {
  52389. r,
  52390. g,
  52391. b
  52392. };
  52393. }
  52394. 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);
  52395. if (color.length < 3) {
  52396. return {
  52397. r,
  52398. g,
  52399. b
  52400. };
  52401. }
  52402. [r, g, b] = color;
  52403. return {
  52404. r,
  52405. g,
  52406. b
  52407. };
  52408. }
  52409. function getBBox(data) {
  52410. const def = -1;
  52411. if (!data) {
  52412. return {
  52413. x: def,
  52414. y: def,
  52415. width: def,
  52416. height: def
  52417. };
  52418. }
  52419. const bbox = data.trim().split(/\s*,\s*/).map(m => getMeasurement(m, "-1"));
  52420. if (bbox.length < 4 || bbox[2] < 0 || bbox[3] < 0) {
  52421. return {
  52422. x: def,
  52423. y: def,
  52424. width: def,
  52425. height: def
  52426. };
  52427. }
  52428. const [x, y, width, height] = bbox;
  52429. return {
  52430. x,
  52431. y,
  52432. width,
  52433. height
  52434. };
  52435. }
  52436. class HTMLResult {
  52437. static get FAILURE() {
  52438. return (0, _util.shadow)(this, "FAILURE", new HTMLResult(false, null, null, null));
  52439. }
  52440. static get EMPTY() {
  52441. return (0, _util.shadow)(this, "EMPTY", new HTMLResult(true, null, null, null));
  52442. }
  52443. constructor(success, html, bbox, breakNode) {
  52444. this.success = success;
  52445. this.html = html;
  52446. this.bbox = bbox;
  52447. this.breakNode = breakNode;
  52448. }
  52449. isBreak() {
  52450. return !!this.breakNode;
  52451. }
  52452. static breakNode(node) {
  52453. return new HTMLResult(false, null, null, node);
  52454. }
  52455. static success(html, bbox = null) {
  52456. return new HTMLResult(true, html, bbox, null);
  52457. }
  52458. }
  52459. exports.HTMLResult = HTMLResult;
  52460. /***/ }),
  52461. /* 79 */
  52462. /***/ ((__unused_webpack_module, exports) => {
  52463. Object.defineProperty(exports, "__esModule", ({
  52464. value: true
  52465. }));
  52466. exports.NamespaceIds = exports.$buildXFAObject = void 0;
  52467. const $buildXFAObject = Symbol();
  52468. exports.$buildXFAObject = $buildXFAObject;
  52469. const NamespaceIds = {
  52470. config: {
  52471. id: 0,
  52472. check: ns => ns.startsWith("http://www.xfa.org/schema/xci/")
  52473. },
  52474. connectionSet: {
  52475. id: 1,
  52476. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-connection-set/")
  52477. },
  52478. datasets: {
  52479. id: 2,
  52480. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-data/")
  52481. },
  52482. form: {
  52483. id: 3,
  52484. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-form/")
  52485. },
  52486. localeSet: {
  52487. id: 4,
  52488. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-locale-set/")
  52489. },
  52490. pdf: {
  52491. id: 5,
  52492. check: ns => ns === "http://ns.adobe.com/xdp/pdf/"
  52493. },
  52494. signature: {
  52495. id: 6,
  52496. check: ns => ns === "http://www.w3.org/2000/09/xmldsig#"
  52497. },
  52498. sourceSet: {
  52499. id: 7,
  52500. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-source-set/")
  52501. },
  52502. stylesheet: {
  52503. id: 8,
  52504. check: ns => ns === "http://www.w3.org/1999/XSL/Transform"
  52505. },
  52506. template: {
  52507. id: 9,
  52508. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-template/")
  52509. },
  52510. xdc: {
  52511. id: 10,
  52512. check: ns => ns.startsWith("http://www.xfa.org/schema/xdc/")
  52513. },
  52514. xdp: {
  52515. id: 11,
  52516. check: ns => ns === "http://ns.adobe.com/xdp/"
  52517. },
  52518. xfdf: {
  52519. id: 12,
  52520. check: ns => ns === "http://ns.adobe.com/xfdf/"
  52521. },
  52522. xhtml: {
  52523. id: 13,
  52524. check: ns => ns === "http://www.w3.org/1999/xhtml"
  52525. },
  52526. xmpmeta: {
  52527. id: 14,
  52528. check: ns => ns === "http://ns.adobe.com/xmpmeta/"
  52529. }
  52530. };
  52531. exports.NamespaceIds = NamespaceIds;
  52532. /***/ }),
  52533. /* 80 */
  52534. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  52535. Object.defineProperty(exports, "__esModule", ({
  52536. value: true
  52537. }));
  52538. exports.createDataNode = createDataNode;
  52539. exports.searchNode = searchNode;
  52540. var _xfa_object = __w_pdfjs_require__(77);
  52541. var _namespaces = __w_pdfjs_require__(79);
  52542. var _util = __w_pdfjs_require__(2);
  52543. const namePattern = /^[^.[]+/;
  52544. const indexPattern = /^[^\]]+/;
  52545. const operators = {
  52546. dot: 0,
  52547. dotDot: 1,
  52548. dotHash: 2,
  52549. dotBracket: 3,
  52550. dotParen: 4
  52551. };
  52552. 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]]);
  52553. const somCache = new WeakMap();
  52554. const NS_DATASETS = _namespaces.NamespaceIds.datasets.id;
  52555. function parseIndex(index) {
  52556. index = index.trim();
  52557. if (index === "*") {
  52558. return Infinity;
  52559. }
  52560. return parseInt(index, 10) || 0;
  52561. }
  52562. function parseExpression(expr, dotDotAllowed, noExpr = true) {
  52563. let match = expr.match(namePattern);
  52564. if (!match) {
  52565. return null;
  52566. }
  52567. let [name] = match;
  52568. const parsed = [{
  52569. name,
  52570. cacheName: "." + name,
  52571. index: 0,
  52572. js: null,
  52573. formCalc: null,
  52574. operator: operators.dot
  52575. }];
  52576. let pos = name.length;
  52577. while (pos < expr.length) {
  52578. const spos = pos;
  52579. const char = expr.charAt(pos++);
  52580. if (char === "[") {
  52581. match = expr.slice(pos).match(indexPattern);
  52582. if (!match) {
  52583. (0, _util.warn)("XFA - Invalid index in SOM expression");
  52584. return null;
  52585. }
  52586. parsed.at(-1).index = parseIndex(match[0]);
  52587. pos += match[0].length + 1;
  52588. continue;
  52589. }
  52590. let operator;
  52591. switch (expr.charAt(pos)) {
  52592. case ".":
  52593. if (!dotDotAllowed) {
  52594. return null;
  52595. }
  52596. pos++;
  52597. operator = operators.dotDot;
  52598. break;
  52599. case "#":
  52600. pos++;
  52601. operator = operators.dotHash;
  52602. break;
  52603. case "[":
  52604. if (noExpr) {
  52605. (0, _util.warn)("XFA - SOM expression contains a FormCalc subexpression which is not supported for now.");
  52606. return null;
  52607. }
  52608. operator = operators.dotBracket;
  52609. break;
  52610. case "(":
  52611. if (noExpr) {
  52612. (0, _util.warn)("XFA - SOM expression contains a JavaScript subexpression which is not supported for now.");
  52613. return null;
  52614. }
  52615. operator = operators.dotParen;
  52616. break;
  52617. default:
  52618. operator = operators.dot;
  52619. break;
  52620. }
  52621. match = expr.slice(pos).match(namePattern);
  52622. if (!match) {
  52623. break;
  52624. }
  52625. [name] = match;
  52626. pos += name.length;
  52627. parsed.push({
  52628. name,
  52629. cacheName: expr.slice(spos, pos),
  52630. operator,
  52631. index: 0,
  52632. js: null,
  52633. formCalc: null
  52634. });
  52635. }
  52636. return parsed;
  52637. }
  52638. function searchNode(root, container, expr, dotDotAllowed = true, useCache = true) {
  52639. const parsed = parseExpression(expr, dotDotAllowed);
  52640. if (!parsed) {
  52641. return null;
  52642. }
  52643. const fn = shortcuts.get(parsed[0].name);
  52644. let i = 0;
  52645. let isQualified;
  52646. if (fn) {
  52647. isQualified = true;
  52648. root = [fn(root, container)];
  52649. i = 1;
  52650. } else {
  52651. isQualified = container === null;
  52652. root = [container || root];
  52653. }
  52654. for (let ii = parsed.length; i < ii; i++) {
  52655. const {
  52656. name,
  52657. cacheName,
  52658. operator,
  52659. index
  52660. } = parsed[i];
  52661. const nodes = [];
  52662. for (const node of root) {
  52663. if (!(node instanceof _xfa_object.XFAObject)) {
  52664. continue;
  52665. }
  52666. let children, cached;
  52667. if (useCache) {
  52668. cached = somCache.get(node);
  52669. if (!cached) {
  52670. cached = new Map();
  52671. somCache.set(node, cached);
  52672. }
  52673. children = cached.get(cacheName);
  52674. }
  52675. if (!children) {
  52676. switch (operator) {
  52677. case operators.dot:
  52678. children = node[_xfa_object.$getChildrenByName](name, false);
  52679. break;
  52680. case operators.dotDot:
  52681. children = node[_xfa_object.$getChildrenByName](name, true);
  52682. break;
  52683. case operators.dotHash:
  52684. children = node[_xfa_object.$getChildrenByClass](name);
  52685. if (children instanceof _xfa_object.XFAObjectArray) {
  52686. children = children.children;
  52687. } else {
  52688. children = [children];
  52689. }
  52690. break;
  52691. default:
  52692. break;
  52693. }
  52694. if (useCache) {
  52695. cached.set(cacheName, children);
  52696. }
  52697. }
  52698. if (children.length > 0) {
  52699. nodes.push(children);
  52700. }
  52701. }
  52702. if (nodes.length === 0 && !isQualified && i === 0) {
  52703. const parent = container[_xfa_object.$getParent]();
  52704. container = parent;
  52705. if (!container) {
  52706. return null;
  52707. }
  52708. i = -1;
  52709. root = [container];
  52710. continue;
  52711. }
  52712. if (isFinite(index)) {
  52713. root = nodes.filter(node => index < node.length).map(node => node[index]);
  52714. } else {
  52715. root = nodes.flat();
  52716. }
  52717. }
  52718. if (root.length === 0) {
  52719. return null;
  52720. }
  52721. return root;
  52722. }
  52723. function createNodes(root, path) {
  52724. let node = null;
  52725. for (const {
  52726. name,
  52727. index
  52728. } of path) {
  52729. for (let i = 0, ii = !isFinite(index) ? 0 : index; i <= ii; i++) {
  52730. const nsId = root[_xfa_object.$namespaceId] === NS_DATASETS ? -1 : root[_xfa_object.$namespaceId];
  52731. node = new _xfa_object.XmlObject(nsId, name);
  52732. root[_xfa_object.$appendChild](node);
  52733. }
  52734. root = node;
  52735. }
  52736. return node;
  52737. }
  52738. function createDataNode(root, container, expr) {
  52739. const parsed = parseExpression(expr);
  52740. if (!parsed) {
  52741. return null;
  52742. }
  52743. if (parsed.some(x => x.operator === operators.dotDot)) {
  52744. return null;
  52745. }
  52746. const fn = shortcuts.get(parsed[0].name);
  52747. let i = 0;
  52748. if (fn) {
  52749. root = fn(root, container);
  52750. i = 1;
  52751. } else {
  52752. root = container || root;
  52753. }
  52754. for (let ii = parsed.length; i < ii; i++) {
  52755. const {
  52756. name,
  52757. operator,
  52758. index
  52759. } = parsed[i];
  52760. if (!isFinite(index)) {
  52761. parsed[i].index = 0;
  52762. return createNodes(root, parsed.slice(i));
  52763. }
  52764. let children;
  52765. switch (operator) {
  52766. case operators.dot:
  52767. children = root[_xfa_object.$getChildrenByName](name, false);
  52768. break;
  52769. case operators.dotDot:
  52770. children = root[_xfa_object.$getChildrenByName](name, true);
  52771. break;
  52772. case operators.dotHash:
  52773. children = root[_xfa_object.$getChildrenByClass](name);
  52774. if (children instanceof _xfa_object.XFAObjectArray) {
  52775. children = children.children;
  52776. } else {
  52777. children = [children];
  52778. }
  52779. break;
  52780. default:
  52781. break;
  52782. }
  52783. if (children.length === 0) {
  52784. return createNodes(root, parsed.slice(i));
  52785. }
  52786. if (index < children.length) {
  52787. const child = children[index];
  52788. if (!(child instanceof _xfa_object.XFAObject)) {
  52789. (0, _util.warn)(`XFA - Cannot create a node.`);
  52790. return null;
  52791. }
  52792. root = child;
  52793. } else {
  52794. parsed[i].index = index - children.length;
  52795. return createNodes(root, parsed.slice(i));
  52796. }
  52797. }
  52798. return null;
  52799. }
  52800. /***/ }),
  52801. /* 81 */
  52802. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  52803. Object.defineProperty(exports, "__esModule", ({
  52804. value: true
  52805. }));
  52806. exports.Binder = void 0;
  52807. var _xfa_object = __w_pdfjs_require__(77);
  52808. var _template = __w_pdfjs_require__(82);
  52809. var _som = __w_pdfjs_require__(80);
  52810. var _namespaces = __w_pdfjs_require__(79);
  52811. var _util = __w_pdfjs_require__(2);
  52812. const NS_DATASETS = _namespaces.NamespaceIds.datasets.id;
  52813. function createText(content) {
  52814. const node = new _template.Text({});
  52815. node[_xfa_object.$content] = content;
  52816. return node;
  52817. }
  52818. class Binder {
  52819. constructor(root) {
  52820. this.root = root;
  52821. this.datasets = root.datasets;
  52822. if (root.datasets && root.datasets.data) {
  52823. this.data = root.datasets.data;
  52824. } else {
  52825. this.data = new _xfa_object.XmlObject(_namespaces.NamespaceIds.datasets.id, "data");
  52826. }
  52827. this.emptyMerge = this.data[_xfa_object.$getChildren]().length === 0;
  52828. this.root.form = this.form = root.template[_xfa_object.$clone]();
  52829. }
  52830. _isConsumeData() {
  52831. return !this.emptyMerge && this._mergeMode;
  52832. }
  52833. _isMatchTemplate() {
  52834. return !this._isConsumeData();
  52835. }
  52836. bind() {
  52837. this._bindElement(this.form, this.data);
  52838. return this.form;
  52839. }
  52840. getData() {
  52841. return this.data;
  52842. }
  52843. _bindValue(formNode, data, picture) {
  52844. formNode[_xfa_object.$data] = data;
  52845. if (formNode[_xfa_object.$hasSettableValue]()) {
  52846. if (data[_xfa_object.$isDataValue]()) {
  52847. const value = data[_xfa_object.$getDataValue]();
  52848. formNode[_xfa_object.$setValue](createText(value));
  52849. } else if (formNode instanceof _template.Field && formNode.ui && formNode.ui.choiceList && formNode.ui.choiceList.open === "multiSelect") {
  52850. const value = data[_xfa_object.$getChildren]().map(child => child[_xfa_object.$content].trim()).join("\n");
  52851. formNode[_xfa_object.$setValue](createText(value));
  52852. } else if (this._isConsumeData()) {
  52853. (0, _util.warn)(`XFA - Nodes haven't the same type.`);
  52854. }
  52855. } else if (!data[_xfa_object.$isDataValue]() || this._isMatchTemplate()) {
  52856. this._bindElement(formNode, data);
  52857. } else {
  52858. (0, _util.warn)(`XFA - Nodes haven't the same type.`);
  52859. }
  52860. }
  52861. _findDataByNameToConsume(name, isValue, dataNode, global) {
  52862. if (!name) {
  52863. return null;
  52864. }
  52865. let generator, match;
  52866. for (let i = 0; i < 3; i++) {
  52867. generator = dataNode[_xfa_object.$getRealChildrenByNameIt](name, false, true);
  52868. while (true) {
  52869. match = generator.next().value;
  52870. if (!match) {
  52871. break;
  52872. }
  52873. if (isValue === match[_xfa_object.$isDataValue]()) {
  52874. return match;
  52875. }
  52876. }
  52877. if (dataNode[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.datasets.id && dataNode[_xfa_object.$nodeName] === "data") {
  52878. break;
  52879. }
  52880. dataNode = dataNode[_xfa_object.$getParent]();
  52881. }
  52882. if (!global) {
  52883. return null;
  52884. }
  52885. generator = this.data[_xfa_object.$getRealChildrenByNameIt](name, true, false);
  52886. match = generator.next().value;
  52887. if (match) {
  52888. return match;
  52889. }
  52890. generator = this.data[_xfa_object.$getAttributeIt](name, true);
  52891. match = generator.next().value;
  52892. if (match && match[_xfa_object.$isDataValue]()) {
  52893. return match;
  52894. }
  52895. return null;
  52896. }
  52897. _setProperties(formNode, dataNode) {
  52898. if (!formNode.hasOwnProperty("setProperty")) {
  52899. return;
  52900. }
  52901. for (const {
  52902. ref,
  52903. target,
  52904. connection
  52905. } of formNode.setProperty.children) {
  52906. if (connection) {
  52907. continue;
  52908. }
  52909. if (!ref) {
  52910. continue;
  52911. }
  52912. const nodes = (0, _som.searchNode)(this.root, dataNode, ref, false, false);
  52913. if (!nodes) {
  52914. (0, _util.warn)(`XFA - Invalid reference: ${ref}.`);
  52915. continue;
  52916. }
  52917. const [node] = nodes;
  52918. if (!node[_xfa_object.$isDescendent](this.data)) {
  52919. (0, _util.warn)(`XFA - Invalid node: must be a data node.`);
  52920. continue;
  52921. }
  52922. const targetNodes = (0, _som.searchNode)(this.root, formNode, target, false, false);
  52923. if (!targetNodes) {
  52924. (0, _util.warn)(`XFA - Invalid target: ${target}.`);
  52925. continue;
  52926. }
  52927. const [targetNode] = targetNodes;
  52928. if (!targetNode[_xfa_object.$isDescendent](formNode)) {
  52929. (0, _util.warn)(`XFA - Invalid target: must be a property or subproperty.`);
  52930. continue;
  52931. }
  52932. const targetParent = targetNode[_xfa_object.$getParent]();
  52933. if (targetNode instanceof _template.SetProperty || targetParent instanceof _template.SetProperty) {
  52934. (0, _util.warn)(`XFA - Invalid target: cannot be a setProperty or one of its properties.`);
  52935. continue;
  52936. }
  52937. if (targetNode instanceof _template.BindItems || targetParent instanceof _template.BindItems) {
  52938. (0, _util.warn)(`XFA - Invalid target: cannot be a bindItems or one of its properties.`);
  52939. continue;
  52940. }
  52941. const content = node[_xfa_object.$text]();
  52942. const name = targetNode[_xfa_object.$nodeName];
  52943. if (targetNode instanceof _xfa_object.XFAAttribute) {
  52944. const attrs = Object.create(null);
  52945. attrs[name] = content;
  52946. const obj = Reflect.construct(Object.getPrototypeOf(targetParent).constructor, [attrs]);
  52947. targetParent[name] = obj[name];
  52948. continue;
  52949. }
  52950. if (!targetNode.hasOwnProperty(_xfa_object.$content)) {
  52951. (0, _util.warn)(`XFA - Invalid node to use in setProperty`);
  52952. continue;
  52953. }
  52954. targetNode[_xfa_object.$data] = node;
  52955. targetNode[_xfa_object.$content] = content;
  52956. targetNode[_xfa_object.$finalize]();
  52957. }
  52958. }
  52959. _bindItems(formNode, dataNode) {
  52960. if (!formNode.hasOwnProperty("items") || !formNode.hasOwnProperty("bindItems") || formNode.bindItems.isEmpty()) {
  52961. return;
  52962. }
  52963. for (const item of formNode.items.children) {
  52964. formNode[_xfa_object.$removeChild](item);
  52965. }
  52966. formNode.items.clear();
  52967. const labels = new _template.Items({});
  52968. const values = new _template.Items({});
  52969. formNode[_xfa_object.$appendChild](labels);
  52970. formNode.items.push(labels);
  52971. formNode[_xfa_object.$appendChild](values);
  52972. formNode.items.push(values);
  52973. for (const {
  52974. ref,
  52975. labelRef,
  52976. valueRef,
  52977. connection
  52978. } of formNode.bindItems.children) {
  52979. if (connection) {
  52980. continue;
  52981. }
  52982. if (!ref) {
  52983. continue;
  52984. }
  52985. const nodes = (0, _som.searchNode)(this.root, dataNode, ref, false, false);
  52986. if (!nodes) {
  52987. (0, _util.warn)(`XFA - Invalid reference: ${ref}.`);
  52988. continue;
  52989. }
  52990. for (const node of nodes) {
  52991. if (!node[_xfa_object.$isDescendent](this.datasets)) {
  52992. (0, _util.warn)(`XFA - Invalid ref (${ref}): must be a datasets child.`);
  52993. continue;
  52994. }
  52995. const labelNodes = (0, _som.searchNode)(this.root, node, labelRef, true, false);
  52996. if (!labelNodes) {
  52997. (0, _util.warn)(`XFA - Invalid label: ${labelRef}.`);
  52998. continue;
  52999. }
  53000. const [labelNode] = labelNodes;
  53001. if (!labelNode[_xfa_object.$isDescendent](this.datasets)) {
  53002. (0, _util.warn)(`XFA - Invalid label: must be a datasets child.`);
  53003. continue;
  53004. }
  53005. const valueNodes = (0, _som.searchNode)(this.root, node, valueRef, true, false);
  53006. if (!valueNodes) {
  53007. (0, _util.warn)(`XFA - Invalid value: ${valueRef}.`);
  53008. continue;
  53009. }
  53010. const [valueNode] = valueNodes;
  53011. if (!valueNode[_xfa_object.$isDescendent](this.datasets)) {
  53012. (0, _util.warn)(`XFA - Invalid value: must be a datasets child.`);
  53013. continue;
  53014. }
  53015. const label = createText(labelNode[_xfa_object.$text]());
  53016. const value = createText(valueNode[_xfa_object.$text]());
  53017. labels[_xfa_object.$appendChild](label);
  53018. labels.text.push(label);
  53019. values[_xfa_object.$appendChild](value);
  53020. values.text.push(value);
  53021. }
  53022. }
  53023. }
  53024. _bindOccurrences(formNode, matches, picture) {
  53025. let baseClone;
  53026. if (matches.length > 1) {
  53027. baseClone = formNode[_xfa_object.$clone]();
  53028. baseClone[_xfa_object.$removeChild](baseClone.occur);
  53029. baseClone.occur = null;
  53030. }
  53031. this._bindValue(formNode, matches[0], picture);
  53032. this._setProperties(formNode, matches[0]);
  53033. this._bindItems(formNode, matches[0]);
  53034. if (matches.length === 1) {
  53035. return;
  53036. }
  53037. const parent = formNode[_xfa_object.$getParent]();
  53038. const name = formNode[_xfa_object.$nodeName];
  53039. const pos = parent[_xfa_object.$indexOf](formNode);
  53040. for (let i = 1, ii = matches.length; i < ii; i++) {
  53041. const match = matches[i];
  53042. const clone = baseClone[_xfa_object.$clone]();
  53043. parent[name].push(clone);
  53044. parent[_xfa_object.$insertAt](pos + i, clone);
  53045. this._bindValue(clone, match, picture);
  53046. this._setProperties(clone, match);
  53047. this._bindItems(clone, match);
  53048. }
  53049. }
  53050. _createOccurrences(formNode) {
  53051. if (!this.emptyMerge) {
  53052. return;
  53053. }
  53054. const {
  53055. occur
  53056. } = formNode;
  53057. if (!occur || occur.initial <= 1) {
  53058. return;
  53059. }
  53060. const parent = formNode[_xfa_object.$getParent]();
  53061. const name = formNode[_xfa_object.$nodeName];
  53062. if (!(parent[name] instanceof _xfa_object.XFAObjectArray)) {
  53063. return;
  53064. }
  53065. let currentNumber;
  53066. if (formNode.name) {
  53067. currentNumber = parent[name].children.filter(e => e.name === formNode.name).length;
  53068. } else {
  53069. currentNumber = parent[name].children.length;
  53070. }
  53071. const pos = parent[_xfa_object.$indexOf](formNode) + 1;
  53072. const ii = occur.initial - currentNumber;
  53073. if (ii) {
  53074. const nodeClone = formNode[_xfa_object.$clone]();
  53075. nodeClone[_xfa_object.$removeChild](nodeClone.occur);
  53076. nodeClone.occur = null;
  53077. parent[name].push(nodeClone);
  53078. parent[_xfa_object.$insertAt](pos, nodeClone);
  53079. for (let i = 1; i < ii; i++) {
  53080. const clone = nodeClone[_xfa_object.$clone]();
  53081. parent[name].push(clone);
  53082. parent[_xfa_object.$insertAt](pos + i, clone);
  53083. }
  53084. }
  53085. }
  53086. _getOccurInfo(formNode) {
  53087. const {
  53088. name,
  53089. occur
  53090. } = formNode;
  53091. if (!occur || !name) {
  53092. return [1, 1];
  53093. }
  53094. const max = occur.max === -1 ? Infinity : occur.max;
  53095. return [occur.min, max];
  53096. }
  53097. _setAndBind(formNode, dataNode) {
  53098. this._setProperties(formNode, dataNode);
  53099. this._bindItems(formNode, dataNode);
  53100. this._bindElement(formNode, dataNode);
  53101. }
  53102. _bindElement(formNode, dataNode) {
  53103. const uselessNodes = [];
  53104. this._createOccurrences(formNode);
  53105. for (const child of formNode[_xfa_object.$getChildren]()) {
  53106. if (child[_xfa_object.$data]) {
  53107. continue;
  53108. }
  53109. if (this._mergeMode === undefined && child[_xfa_object.$nodeName] === "subform") {
  53110. this._mergeMode = child.mergeMode === "consumeData";
  53111. const dataChildren = dataNode[_xfa_object.$getChildren]();
  53112. if (dataChildren.length > 0) {
  53113. this._bindOccurrences(child, [dataChildren[0]], null);
  53114. } else if (this.emptyMerge) {
  53115. const nsId = dataNode[_xfa_object.$namespaceId] === NS_DATASETS ? -1 : dataNode[_xfa_object.$namespaceId];
  53116. const dataChild = child[_xfa_object.$data] = new _xfa_object.XmlObject(nsId, child.name || "root");
  53117. dataNode[_xfa_object.$appendChild](dataChild);
  53118. this._bindElement(child, dataChild);
  53119. }
  53120. continue;
  53121. }
  53122. if (!child[_xfa_object.$isBindable]()) {
  53123. continue;
  53124. }
  53125. let global = false;
  53126. let picture = null;
  53127. let ref = null;
  53128. let match = null;
  53129. if (child.bind) {
  53130. switch (child.bind.match) {
  53131. case "none":
  53132. this._setAndBind(child, dataNode);
  53133. continue;
  53134. case "global":
  53135. global = true;
  53136. break;
  53137. case "dataRef":
  53138. if (!child.bind.ref) {
  53139. (0, _util.warn)(`XFA - ref is empty in node ${child[_xfa_object.$nodeName]}.`);
  53140. this._setAndBind(child, dataNode);
  53141. continue;
  53142. }
  53143. ref = child.bind.ref;
  53144. break;
  53145. default:
  53146. break;
  53147. }
  53148. if (child.bind.picture) {
  53149. picture = child.bind.picture[_xfa_object.$content];
  53150. }
  53151. }
  53152. const [min, max] = this._getOccurInfo(child);
  53153. if (ref) {
  53154. match = (0, _som.searchNode)(this.root, dataNode, ref, true, false);
  53155. if (match === null) {
  53156. match = (0, _som.createDataNode)(this.data, dataNode, ref);
  53157. if (!match) {
  53158. continue;
  53159. }
  53160. if (this._isConsumeData()) {
  53161. match[_xfa_object.$consumed] = true;
  53162. }
  53163. this._setAndBind(child, match);
  53164. continue;
  53165. } else {
  53166. if (this._isConsumeData()) {
  53167. match = match.filter(node => !node[_xfa_object.$consumed]);
  53168. }
  53169. if (match.length > max) {
  53170. match = match.slice(0, max);
  53171. } else if (match.length === 0) {
  53172. match = null;
  53173. }
  53174. if (match && this._isConsumeData()) {
  53175. match.forEach(node => {
  53176. node[_xfa_object.$consumed] = true;
  53177. });
  53178. }
  53179. }
  53180. } else {
  53181. if (!child.name) {
  53182. this._setAndBind(child, dataNode);
  53183. continue;
  53184. }
  53185. if (this._isConsumeData()) {
  53186. const matches = [];
  53187. while (matches.length < max) {
  53188. const found = this._findDataByNameToConsume(child.name, child[_xfa_object.$hasSettableValue](), dataNode, global);
  53189. if (!found) {
  53190. break;
  53191. }
  53192. found[_xfa_object.$consumed] = true;
  53193. matches.push(found);
  53194. }
  53195. match = matches.length > 0 ? matches : null;
  53196. } else {
  53197. match = dataNode[_xfa_object.$getRealChildrenByNameIt](child.name, false, this.emptyMerge).next().value;
  53198. if (!match) {
  53199. if (min === 0) {
  53200. uselessNodes.push(child);
  53201. continue;
  53202. }
  53203. const nsId = dataNode[_xfa_object.$namespaceId] === NS_DATASETS ? -1 : dataNode[_xfa_object.$namespaceId];
  53204. match = child[_xfa_object.$data] = new _xfa_object.XmlObject(nsId, child.name);
  53205. if (this.emptyMerge) {
  53206. match[_xfa_object.$consumed] = true;
  53207. }
  53208. dataNode[_xfa_object.$appendChild](match);
  53209. this._setAndBind(child, match);
  53210. continue;
  53211. }
  53212. if (this.emptyMerge) {
  53213. match[_xfa_object.$consumed] = true;
  53214. }
  53215. match = [match];
  53216. }
  53217. }
  53218. if (match) {
  53219. this._bindOccurrences(child, match, picture);
  53220. } else if (min > 0) {
  53221. this._setAndBind(child, dataNode);
  53222. } else {
  53223. uselessNodes.push(child);
  53224. }
  53225. }
  53226. uselessNodes.forEach(node => node[_xfa_object.$getParent]()[_xfa_object.$removeChild](node));
  53227. }
  53228. }
  53229. exports.Binder = Binder;
  53230. /***/ }),
  53231. /* 82 */
  53232. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  53233. Object.defineProperty(exports, "__esModule", ({
  53234. value: true
  53235. }));
  53236. exports.Value = exports.Text = exports.TemplateNamespace = exports.Template = exports.SetProperty = exports.Items = exports.Field = exports.BindItems = void 0;
  53237. var _xfa_object = __w_pdfjs_require__(77);
  53238. var _namespaces = __w_pdfjs_require__(79);
  53239. var _layout = __w_pdfjs_require__(83);
  53240. var _html_utils = __w_pdfjs_require__(84);
  53241. var _utils = __w_pdfjs_require__(78);
  53242. var _util = __w_pdfjs_require__(2);
  53243. var _fonts = __w_pdfjs_require__(85);
  53244. var _core_utils = __w_pdfjs_require__(6);
  53245. var _som = __w_pdfjs_require__(80);
  53246. const TEMPLATE_NS_ID = _namespaces.NamespaceIds.template.id;
  53247. const SVG_NS = "http://www.w3.org/2000/svg";
  53248. const MAX_ATTEMPTS_FOR_LRTB_LAYOUT = 2;
  53249. const MAX_EMPTY_PAGES = 3;
  53250. const DEFAULT_TAB_INDEX = 5000;
  53251. const HEADING_PATTERN = /^H(\d+)$/;
  53252. 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"]);
  53253. 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"]];
  53254. function getBorderDims(node) {
  53255. if (!node || !node.border) {
  53256. return {
  53257. w: 0,
  53258. h: 0
  53259. };
  53260. }
  53261. const borderExtra = node.border[_xfa_object.$getExtra]();
  53262. if (!borderExtra) {
  53263. return {
  53264. w: 0,
  53265. h: 0
  53266. };
  53267. }
  53268. return {
  53269. w: borderExtra.widths[0] + borderExtra.widths[2] + borderExtra.insets[0] + borderExtra.insets[2],
  53270. h: borderExtra.widths[1] + borderExtra.widths[3] + borderExtra.insets[1] + borderExtra.insets[3]
  53271. };
  53272. }
  53273. function hasMargin(node) {
  53274. return node.margin && (node.margin.topInset || node.margin.rightInset || node.margin.bottomInset || node.margin.leftInset);
  53275. }
  53276. function _setValue(templateNode, value) {
  53277. if (!templateNode.value) {
  53278. const nodeValue = new Value({});
  53279. templateNode[_xfa_object.$appendChild](nodeValue);
  53280. templateNode.value = nodeValue;
  53281. }
  53282. templateNode.value[_xfa_object.$setValue](value);
  53283. }
  53284. function* getContainedChildren(node) {
  53285. for (const child of node[_xfa_object.$getChildren]()) {
  53286. if (child instanceof SubformSet) {
  53287. yield* child[_xfa_object.$getContainedChildren]();
  53288. continue;
  53289. }
  53290. yield child;
  53291. }
  53292. }
  53293. function isRequired(node) {
  53294. return node.validate && node.validate.nullTest === "error";
  53295. }
  53296. function setTabIndex(node) {
  53297. while (node) {
  53298. if (!node.traversal) {
  53299. node[_xfa_object.$tabIndex] = node[_xfa_object.$getParent]()[_xfa_object.$tabIndex];
  53300. return;
  53301. }
  53302. if (node[_xfa_object.$tabIndex]) {
  53303. return;
  53304. }
  53305. let next = null;
  53306. for (const child of node.traversal[_xfa_object.$getChildren]()) {
  53307. if (child.operation === "next") {
  53308. next = child;
  53309. break;
  53310. }
  53311. }
  53312. if (!next || !next.ref) {
  53313. node[_xfa_object.$tabIndex] = node[_xfa_object.$getParent]()[_xfa_object.$tabIndex];
  53314. return;
  53315. }
  53316. const root = node[_xfa_object.$getTemplateRoot]();
  53317. node[_xfa_object.$tabIndex] = ++root[_xfa_object.$tabIndex];
  53318. const ref = root[_xfa_object.$searchNode](next.ref, node);
  53319. if (!ref) {
  53320. return;
  53321. }
  53322. node = ref[0];
  53323. }
  53324. }
  53325. function applyAssist(obj, attributes) {
  53326. const assist = obj.assist;
  53327. if (assist) {
  53328. const assistTitle = assist[_xfa_object.$toHTML]();
  53329. if (assistTitle) {
  53330. attributes.title = assistTitle;
  53331. }
  53332. const role = assist.role;
  53333. const match = role.match(HEADING_PATTERN);
  53334. if (match) {
  53335. const ariaRole = "heading";
  53336. const ariaLevel = match[1];
  53337. attributes.role = ariaRole;
  53338. attributes["aria-level"] = ariaLevel;
  53339. }
  53340. }
  53341. if (obj.layout === "table") {
  53342. attributes.role = "table";
  53343. } else if (obj.layout === "row") {
  53344. attributes.role = "row";
  53345. } else {
  53346. const parent = obj[_xfa_object.$getParent]();
  53347. if (parent.layout === "row") {
  53348. if (parent.assist && parent.assist.role === "TH") {
  53349. attributes.role = "columnheader";
  53350. } else {
  53351. attributes.role = "cell";
  53352. }
  53353. }
  53354. }
  53355. }
  53356. function ariaLabel(obj) {
  53357. if (!obj.assist) {
  53358. return null;
  53359. }
  53360. const assist = obj.assist;
  53361. if (assist.speak && assist.speak[_xfa_object.$content] !== "") {
  53362. return assist.speak[_xfa_object.$content];
  53363. }
  53364. if (assist.toolTip) {
  53365. return assist.toolTip[_xfa_object.$content];
  53366. }
  53367. return null;
  53368. }
  53369. function valueToHtml(value) {
  53370. return _utils.HTMLResult.success({
  53371. name: "div",
  53372. attributes: {
  53373. class: ["xfaRich"],
  53374. style: Object.create(null)
  53375. },
  53376. children: [{
  53377. name: "span",
  53378. attributes: {
  53379. style: Object.create(null)
  53380. },
  53381. value
  53382. }]
  53383. });
  53384. }
  53385. function setFirstUnsplittable(node) {
  53386. const root = node[_xfa_object.$getTemplateRoot]();
  53387. if (root[_xfa_object.$extra].firstUnsplittable === null) {
  53388. root[_xfa_object.$extra].firstUnsplittable = node;
  53389. root[_xfa_object.$extra].noLayoutFailure = true;
  53390. }
  53391. }
  53392. function unsetFirstUnsplittable(node) {
  53393. const root = node[_xfa_object.$getTemplateRoot]();
  53394. if (root[_xfa_object.$extra].firstUnsplittable === node) {
  53395. root[_xfa_object.$extra].noLayoutFailure = false;
  53396. }
  53397. }
  53398. function handleBreak(node) {
  53399. if (node[_xfa_object.$extra]) {
  53400. return false;
  53401. }
  53402. node[_xfa_object.$extra] = Object.create(null);
  53403. if (node.targetType === "auto") {
  53404. return false;
  53405. }
  53406. const root = node[_xfa_object.$getTemplateRoot]();
  53407. let target = null;
  53408. if (node.target) {
  53409. target = root[_xfa_object.$searchNode](node.target, node[_xfa_object.$getParent]());
  53410. if (!target) {
  53411. return false;
  53412. }
  53413. target = target[0];
  53414. }
  53415. const {
  53416. currentPageArea,
  53417. currentContentArea
  53418. } = root[_xfa_object.$extra];
  53419. if (node.targetType === "pageArea") {
  53420. if (!(target instanceof PageArea)) {
  53421. target = null;
  53422. }
  53423. if (node.startNew) {
  53424. node[_xfa_object.$extra].target = target || currentPageArea;
  53425. return true;
  53426. } else if (target && target !== currentPageArea) {
  53427. node[_xfa_object.$extra].target = target;
  53428. return true;
  53429. }
  53430. return false;
  53431. }
  53432. if (!(target instanceof ContentArea)) {
  53433. target = null;
  53434. }
  53435. const pageArea = target && target[_xfa_object.$getParent]();
  53436. let index;
  53437. let nextPageArea = pageArea;
  53438. if (node.startNew) {
  53439. if (target) {
  53440. const contentAreas = pageArea.contentArea.children;
  53441. const indexForCurrent = contentAreas.indexOf(currentContentArea);
  53442. const indexForTarget = contentAreas.indexOf(target);
  53443. if (indexForCurrent !== -1 && indexForCurrent < indexForTarget) {
  53444. nextPageArea = null;
  53445. }
  53446. index = indexForTarget - 1;
  53447. } else {
  53448. index = currentPageArea.contentArea.children.indexOf(currentContentArea);
  53449. }
  53450. } else if (target && target !== currentContentArea) {
  53451. const contentAreas = pageArea.contentArea.children;
  53452. index = contentAreas.indexOf(target) - 1;
  53453. nextPageArea = pageArea === currentPageArea ? null : pageArea;
  53454. } else {
  53455. return false;
  53456. }
  53457. node[_xfa_object.$extra].target = nextPageArea;
  53458. node[_xfa_object.$extra].index = index;
  53459. return true;
  53460. }
  53461. function handleOverflow(node, extraNode, space) {
  53462. const root = node[_xfa_object.$getTemplateRoot]();
  53463. const saved = root[_xfa_object.$extra].noLayoutFailure;
  53464. const savedMethod = extraNode[_xfa_object.$getSubformParent];
  53465. extraNode[_xfa_object.$getSubformParent] = () => node;
  53466. root[_xfa_object.$extra].noLayoutFailure = true;
  53467. const res = extraNode[_xfa_object.$toHTML](space);
  53468. node[_xfa_object.$addHTML](res.html, res.bbox);
  53469. root[_xfa_object.$extra].noLayoutFailure = saved;
  53470. extraNode[_xfa_object.$getSubformParent] = savedMethod;
  53471. }
  53472. class AppearanceFilter extends _xfa_object.StringObject {
  53473. constructor(attributes) {
  53474. super(TEMPLATE_NS_ID, "appearanceFilter");
  53475. this.id = attributes.id || "";
  53476. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  53477. this.use = attributes.use || "";
  53478. this.usehref = attributes.usehref || "";
  53479. }
  53480. }
  53481. class Arc extends _xfa_object.XFAObject {
  53482. constructor(attributes) {
  53483. super(TEMPLATE_NS_ID, "arc", true);
  53484. this.circular = (0, _utils.getInteger)({
  53485. data: attributes.circular,
  53486. defaultValue: 0,
  53487. validate: x => x === 1
  53488. });
  53489. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  53490. this.id = attributes.id || "";
  53491. this.startAngle = (0, _utils.getFloat)({
  53492. data: attributes.startAngle,
  53493. defaultValue: 0,
  53494. validate: x => true
  53495. });
  53496. this.sweepAngle = (0, _utils.getFloat)({
  53497. data: attributes.sweepAngle,
  53498. defaultValue: 360,
  53499. validate: x => true
  53500. });
  53501. this.use = attributes.use || "";
  53502. this.usehref = attributes.usehref || "";
  53503. this.edge = null;
  53504. this.fill = null;
  53505. }
  53506. [_xfa_object.$toHTML]() {
  53507. const edge = this.edge || new Edge({});
  53508. const edgeStyle = edge[_xfa_object.$toStyle]();
  53509. const style = Object.create(null);
  53510. if (this.fill && this.fill.presence === "visible") {
  53511. Object.assign(style, this.fill[_xfa_object.$toStyle]());
  53512. } else {
  53513. style.fill = "transparent";
  53514. }
  53515. style.strokeWidth = (0, _html_utils.measureToString)(edge.presence === "visible" ? edge.thickness : 0);
  53516. style.stroke = edgeStyle.color;
  53517. let arc;
  53518. const attributes = {
  53519. xmlns: SVG_NS,
  53520. style: {
  53521. width: "100%",
  53522. height: "100%",
  53523. overflow: "visible"
  53524. }
  53525. };
  53526. if (this.sweepAngle === 360) {
  53527. arc = {
  53528. name: "ellipse",
  53529. attributes: {
  53530. xmlns: SVG_NS,
  53531. cx: "50%",
  53532. cy: "50%",
  53533. rx: "50%",
  53534. ry: "50%",
  53535. style
  53536. }
  53537. };
  53538. } else {
  53539. const startAngle = this.startAngle * Math.PI / 180;
  53540. const sweepAngle = this.sweepAngle * Math.PI / 180;
  53541. const largeArc = this.sweepAngle > 180 ? 1 : 0;
  53542. 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))];
  53543. arc = {
  53544. name: "path",
  53545. attributes: {
  53546. xmlns: SVG_NS,
  53547. d: `M ${x1} ${y1} A 50 50 0 ${largeArc} 0 ${x2} ${y2}`,
  53548. vectorEffect: "non-scaling-stroke",
  53549. style
  53550. }
  53551. };
  53552. Object.assign(attributes, {
  53553. viewBox: "0 0 100 100",
  53554. preserveAspectRatio: "none"
  53555. });
  53556. }
  53557. const svg = {
  53558. name: "svg",
  53559. children: [arc],
  53560. attributes
  53561. };
  53562. const parent = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  53563. if (hasMargin(parent)) {
  53564. return _utils.HTMLResult.success({
  53565. name: "div",
  53566. attributes: {
  53567. style: {
  53568. display: "inline",
  53569. width: "100%",
  53570. height: "100%"
  53571. }
  53572. },
  53573. children: [svg]
  53574. });
  53575. }
  53576. svg.attributes.style.position = "absolute";
  53577. return _utils.HTMLResult.success(svg);
  53578. }
  53579. }
  53580. class Area extends _xfa_object.XFAObject {
  53581. constructor(attributes) {
  53582. super(TEMPLATE_NS_ID, "area", true);
  53583. this.colSpan = (0, _utils.getInteger)({
  53584. data: attributes.colSpan,
  53585. defaultValue: 1,
  53586. validate: n => n >= 1 || n === -1
  53587. });
  53588. this.id = attributes.id || "";
  53589. this.name = attributes.name || "";
  53590. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  53591. this.use = attributes.use || "";
  53592. this.usehref = attributes.usehref || "";
  53593. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  53594. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  53595. this.desc = null;
  53596. this.extras = null;
  53597. this.area = new _xfa_object.XFAObjectArray();
  53598. this.draw = new _xfa_object.XFAObjectArray();
  53599. this.exObject = new _xfa_object.XFAObjectArray();
  53600. this.exclGroup = new _xfa_object.XFAObjectArray();
  53601. this.field = new _xfa_object.XFAObjectArray();
  53602. this.subform = new _xfa_object.XFAObjectArray();
  53603. this.subformSet = new _xfa_object.XFAObjectArray();
  53604. }
  53605. *[_xfa_object.$getContainedChildren]() {
  53606. yield* getContainedChildren(this);
  53607. }
  53608. [_xfa_object.$isTransparent]() {
  53609. return true;
  53610. }
  53611. [_xfa_object.$isBindable]() {
  53612. return true;
  53613. }
  53614. [_xfa_object.$addHTML](html, bbox) {
  53615. const [x, y, w, h] = bbox;
  53616. this[_xfa_object.$extra].width = Math.max(this[_xfa_object.$extra].width, x + w);
  53617. this[_xfa_object.$extra].height = Math.max(this[_xfa_object.$extra].height, y + h);
  53618. this[_xfa_object.$extra].children.push(html);
  53619. }
  53620. [_xfa_object.$getAvailableSpace]() {
  53621. return this[_xfa_object.$extra].availableSpace;
  53622. }
  53623. [_xfa_object.$toHTML](availableSpace) {
  53624. const style = (0, _html_utils.toStyle)(this, "position");
  53625. const attributes = {
  53626. style,
  53627. id: this[_xfa_object.$uid],
  53628. class: ["xfaArea"]
  53629. };
  53630. if ((0, _html_utils.isPrintOnly)(this)) {
  53631. attributes.class.push("xfaPrintOnly");
  53632. }
  53633. if (this.name) {
  53634. attributes.xfaName = this.name;
  53635. }
  53636. const children = [];
  53637. this[_xfa_object.$extra] = {
  53638. children,
  53639. width: 0,
  53640. height: 0,
  53641. availableSpace
  53642. };
  53643. const result = this[_xfa_object.$childrenToHTML]({
  53644. filter: new Set(["area", "draw", "field", "exclGroup", "subform", "subformSet"]),
  53645. include: true
  53646. });
  53647. if (!result.success) {
  53648. if (result.isBreak()) {
  53649. return result;
  53650. }
  53651. delete this[_xfa_object.$extra];
  53652. return _utils.HTMLResult.FAILURE;
  53653. }
  53654. style.width = (0, _html_utils.measureToString)(this[_xfa_object.$extra].width);
  53655. style.height = (0, _html_utils.measureToString)(this[_xfa_object.$extra].height);
  53656. const html = {
  53657. name: "div",
  53658. attributes,
  53659. children
  53660. };
  53661. const bbox = [this.x, this.y, this[_xfa_object.$extra].width, this[_xfa_object.$extra].height];
  53662. delete this[_xfa_object.$extra];
  53663. return _utils.HTMLResult.success(html, bbox);
  53664. }
  53665. }
  53666. class Assist extends _xfa_object.XFAObject {
  53667. constructor(attributes) {
  53668. super(TEMPLATE_NS_ID, "assist", true);
  53669. this.id = attributes.id || "";
  53670. this.role = attributes.role || "";
  53671. this.use = attributes.use || "";
  53672. this.usehref = attributes.usehref || "";
  53673. this.speak = null;
  53674. this.toolTip = null;
  53675. }
  53676. [_xfa_object.$toHTML]() {
  53677. return this.toolTip && this.toolTip[_xfa_object.$content] ? this.toolTip[_xfa_object.$content] : null;
  53678. }
  53679. }
  53680. class Barcode extends _xfa_object.XFAObject {
  53681. constructor(attributes) {
  53682. super(TEMPLATE_NS_ID, "barcode", true);
  53683. this.charEncoding = (0, _utils.getKeyword)({
  53684. data: attributes.charEncoding ? attributes.charEncoding.toLowerCase() : "",
  53685. defaultValue: "",
  53686. 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}/)
  53687. });
  53688. this.checksum = (0, _utils.getStringOption)(attributes.checksum, ["none", "1mod10", "1mod10_1mod11", "2mod10", "auto"]);
  53689. this.dataColumnCount = (0, _utils.getInteger)({
  53690. data: attributes.dataColumnCount,
  53691. defaultValue: -1,
  53692. validate: x => x >= 0
  53693. });
  53694. this.dataLength = (0, _utils.getInteger)({
  53695. data: attributes.dataLength,
  53696. defaultValue: -1,
  53697. validate: x => x >= 0
  53698. });
  53699. this.dataPrep = (0, _utils.getStringOption)(attributes.dataPrep, ["none", "flateCompress"]);
  53700. this.dataRowCount = (0, _utils.getInteger)({
  53701. data: attributes.dataRowCount,
  53702. defaultValue: -1,
  53703. validate: x => x >= 0
  53704. });
  53705. this.endChar = attributes.endChar || "";
  53706. this.errorCorrectionLevel = (0, _utils.getInteger)({
  53707. data: attributes.errorCorrectionLevel,
  53708. defaultValue: -1,
  53709. validate: x => x >= 0 && x <= 8
  53710. });
  53711. this.id = attributes.id || "";
  53712. this.moduleHeight = (0, _utils.getMeasurement)(attributes.moduleHeight, "5mm");
  53713. this.moduleWidth = (0, _utils.getMeasurement)(attributes.moduleWidth, "0.25mm");
  53714. this.printCheckDigit = (0, _utils.getInteger)({
  53715. data: attributes.printCheckDigit,
  53716. defaultValue: 0,
  53717. validate: x => x === 1
  53718. });
  53719. this.rowColumnRatio = (0, _utils.getRatio)(attributes.rowColumnRatio);
  53720. this.startChar = attributes.startChar || "";
  53721. this.textLocation = (0, _utils.getStringOption)(attributes.textLocation, ["below", "above", "aboveEmbedded", "belowEmbedded", "none"]);
  53722. this.truncate = (0, _utils.getInteger)({
  53723. data: attributes.truncate,
  53724. defaultValue: 0,
  53725. validate: x => x === 1
  53726. });
  53727. 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"]);
  53728. this.upsMode = (0, _utils.getStringOption)(attributes.upsMode, ["usCarrier", "internationalCarrier", "secureSymbol", "standardSymbol"]);
  53729. this.use = attributes.use || "";
  53730. this.usehref = attributes.usehref || "";
  53731. this.wideNarrowRatio = (0, _utils.getRatio)(attributes.wideNarrowRatio);
  53732. this.encrypt = null;
  53733. this.extras = null;
  53734. }
  53735. }
  53736. class Bind extends _xfa_object.XFAObject {
  53737. constructor(attributes) {
  53738. super(TEMPLATE_NS_ID, "bind", true);
  53739. this.match = (0, _utils.getStringOption)(attributes.match, ["once", "dataRef", "global", "none"]);
  53740. this.ref = attributes.ref || "";
  53741. this.picture = null;
  53742. }
  53743. }
  53744. class BindItems extends _xfa_object.XFAObject {
  53745. constructor(attributes) {
  53746. super(TEMPLATE_NS_ID, "bindItems");
  53747. this.connection = attributes.connection || "";
  53748. this.labelRef = attributes.labelRef || "";
  53749. this.ref = attributes.ref || "";
  53750. this.valueRef = attributes.valueRef || "";
  53751. }
  53752. }
  53753. exports.BindItems = BindItems;
  53754. class Bookend extends _xfa_object.XFAObject {
  53755. constructor(attributes) {
  53756. super(TEMPLATE_NS_ID, "bookend");
  53757. this.id = attributes.id || "";
  53758. this.leader = attributes.leader || "";
  53759. this.trailer = attributes.trailer || "";
  53760. this.use = attributes.use || "";
  53761. this.usehref = attributes.usehref || "";
  53762. }
  53763. }
  53764. class BooleanElement extends _xfa_object.Option01 {
  53765. constructor(attributes) {
  53766. super(TEMPLATE_NS_ID, "boolean");
  53767. this.id = attributes.id || "";
  53768. this.name = attributes.name || "";
  53769. this.use = attributes.use || "";
  53770. this.usehref = attributes.usehref || "";
  53771. }
  53772. [_xfa_object.$toHTML](availableSpace) {
  53773. return valueToHtml(this[_xfa_object.$content] === 1 ? "1" : "0");
  53774. }
  53775. }
  53776. class Border extends _xfa_object.XFAObject {
  53777. constructor(attributes) {
  53778. super(TEMPLATE_NS_ID, "border", true);
  53779. this.break = (0, _utils.getStringOption)(attributes.break, ["close", "open"]);
  53780. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  53781. this.id = attributes.id || "";
  53782. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  53783. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  53784. this.use = attributes.use || "";
  53785. this.usehref = attributes.usehref || "";
  53786. this.corner = new _xfa_object.XFAObjectArray(4);
  53787. this.edge = new _xfa_object.XFAObjectArray(4);
  53788. this.extras = null;
  53789. this.fill = null;
  53790. this.margin = null;
  53791. }
  53792. [_xfa_object.$getExtra]() {
  53793. if (!this[_xfa_object.$extra]) {
  53794. const edges = this.edge.children.slice();
  53795. if (edges.length < 4) {
  53796. const defaultEdge = edges.at(-1) || new Edge({});
  53797. for (let i = edges.length; i < 4; i++) {
  53798. edges.push(defaultEdge);
  53799. }
  53800. }
  53801. const widths = edges.map(edge => edge.thickness);
  53802. const insets = [0, 0, 0, 0];
  53803. if (this.margin) {
  53804. insets[0] = this.margin.topInset;
  53805. insets[1] = this.margin.rightInset;
  53806. insets[2] = this.margin.bottomInset;
  53807. insets[3] = this.margin.leftInset;
  53808. }
  53809. this[_xfa_object.$extra] = {
  53810. widths,
  53811. insets,
  53812. edges
  53813. };
  53814. }
  53815. return this[_xfa_object.$extra];
  53816. }
  53817. [_xfa_object.$toStyle]() {
  53818. const {
  53819. edges
  53820. } = this[_xfa_object.$getExtra]();
  53821. const edgeStyles = edges.map(node => {
  53822. const style = node[_xfa_object.$toStyle]();
  53823. style.color = style.color || "#000000";
  53824. return style;
  53825. });
  53826. const style = Object.create(null);
  53827. if (this.margin) {
  53828. Object.assign(style, this.margin[_xfa_object.$toStyle]());
  53829. }
  53830. if (this.fill && this.fill.presence === "visible") {
  53831. Object.assign(style, this.fill[_xfa_object.$toStyle]());
  53832. }
  53833. if (this.corner.children.some(node => node.radius !== 0)) {
  53834. const cornerStyles = this.corner.children.map(node => node[_xfa_object.$toStyle]());
  53835. if (cornerStyles.length === 2 || cornerStyles.length === 3) {
  53836. const last = cornerStyles.at(-1);
  53837. for (let i = cornerStyles.length; i < 4; i++) {
  53838. cornerStyles.push(last);
  53839. }
  53840. }
  53841. style.borderRadius = cornerStyles.map(s => s.radius).join(" ");
  53842. }
  53843. switch (this.presence) {
  53844. case "invisible":
  53845. case "hidden":
  53846. style.borderStyle = "";
  53847. break;
  53848. case "inactive":
  53849. style.borderStyle = "none";
  53850. break;
  53851. default:
  53852. style.borderStyle = edgeStyles.map(s => s.style).join(" ");
  53853. break;
  53854. }
  53855. style.borderWidth = edgeStyles.map(s => s.width).join(" ");
  53856. style.borderColor = edgeStyles.map(s => s.color).join(" ");
  53857. return style;
  53858. }
  53859. }
  53860. class Break extends _xfa_object.XFAObject {
  53861. constructor(attributes) {
  53862. super(TEMPLATE_NS_ID, "break", true);
  53863. this.after = (0, _utils.getStringOption)(attributes.after, ["auto", "contentArea", "pageArea", "pageEven", "pageOdd"]);
  53864. this.afterTarget = attributes.afterTarget || "";
  53865. this.before = (0, _utils.getStringOption)(attributes.before, ["auto", "contentArea", "pageArea", "pageEven", "pageOdd"]);
  53866. this.beforeTarget = attributes.beforeTarget || "";
  53867. this.bookendLeader = attributes.bookendLeader || "";
  53868. this.bookendTrailer = attributes.bookendTrailer || "";
  53869. this.id = attributes.id || "";
  53870. this.overflowLeader = attributes.overflowLeader || "";
  53871. this.overflowTarget = attributes.overflowTarget || "";
  53872. this.overflowTrailer = attributes.overflowTrailer || "";
  53873. this.startNew = (0, _utils.getInteger)({
  53874. data: attributes.startNew,
  53875. defaultValue: 0,
  53876. validate: x => x === 1
  53877. });
  53878. this.use = attributes.use || "";
  53879. this.usehref = attributes.usehref || "";
  53880. this.extras = null;
  53881. }
  53882. }
  53883. class BreakAfter extends _xfa_object.XFAObject {
  53884. constructor(attributes) {
  53885. super(TEMPLATE_NS_ID, "breakAfter", true);
  53886. this.id = attributes.id || "";
  53887. this.leader = attributes.leader || "";
  53888. this.startNew = (0, _utils.getInteger)({
  53889. data: attributes.startNew,
  53890. defaultValue: 0,
  53891. validate: x => x === 1
  53892. });
  53893. this.target = attributes.target || "";
  53894. this.targetType = (0, _utils.getStringOption)(attributes.targetType, ["auto", "contentArea", "pageArea"]);
  53895. this.trailer = attributes.trailer || "";
  53896. this.use = attributes.use || "";
  53897. this.usehref = attributes.usehref || "";
  53898. this.script = null;
  53899. }
  53900. }
  53901. class BreakBefore extends _xfa_object.XFAObject {
  53902. constructor(attributes) {
  53903. super(TEMPLATE_NS_ID, "breakBefore", true);
  53904. this.id = attributes.id || "";
  53905. this.leader = attributes.leader || "";
  53906. this.startNew = (0, _utils.getInteger)({
  53907. data: attributes.startNew,
  53908. defaultValue: 0,
  53909. validate: x => x === 1
  53910. });
  53911. this.target = attributes.target || "";
  53912. this.targetType = (0, _utils.getStringOption)(attributes.targetType, ["auto", "contentArea", "pageArea"]);
  53913. this.trailer = attributes.trailer || "";
  53914. this.use = attributes.use || "";
  53915. this.usehref = attributes.usehref || "";
  53916. this.script = null;
  53917. }
  53918. [_xfa_object.$toHTML](availableSpace) {
  53919. this[_xfa_object.$extra] = {};
  53920. return _utils.HTMLResult.FAILURE;
  53921. }
  53922. }
  53923. class Button extends _xfa_object.XFAObject {
  53924. constructor(attributes) {
  53925. super(TEMPLATE_NS_ID, "button", true);
  53926. this.highlight = (0, _utils.getStringOption)(attributes.highlight, ["inverted", "none", "outline", "push"]);
  53927. this.id = attributes.id || "";
  53928. this.use = attributes.use || "";
  53929. this.usehref = attributes.usehref || "";
  53930. this.extras = null;
  53931. }
  53932. [_xfa_object.$toHTML](availableSpace) {
  53933. const parent = this[_xfa_object.$getParent]();
  53934. const grandpa = parent[_xfa_object.$getParent]();
  53935. const htmlButton = {
  53936. name: "button",
  53937. attributes: {
  53938. id: this[_xfa_object.$uid],
  53939. class: ["xfaButton"],
  53940. style: {}
  53941. },
  53942. children: []
  53943. };
  53944. for (const event of grandpa.event.children) {
  53945. if (event.activity !== "click" || !event.script) {
  53946. continue;
  53947. }
  53948. const jsURL = (0, _core_utils.recoverJsURL)(event.script[_xfa_object.$content]);
  53949. if (!jsURL) {
  53950. continue;
  53951. }
  53952. const href = (0, _html_utils.fixURL)(jsURL.url);
  53953. if (!href) {
  53954. continue;
  53955. }
  53956. htmlButton.children.push({
  53957. name: "a",
  53958. attributes: {
  53959. id: "link" + this[_xfa_object.$uid],
  53960. href,
  53961. newWindow: jsURL.newWindow,
  53962. class: ["xfaLink"],
  53963. style: {}
  53964. },
  53965. children: []
  53966. });
  53967. }
  53968. return _utils.HTMLResult.success(htmlButton);
  53969. }
  53970. }
  53971. class Calculate extends _xfa_object.XFAObject {
  53972. constructor(attributes) {
  53973. super(TEMPLATE_NS_ID, "calculate", true);
  53974. this.id = attributes.id || "";
  53975. this.override = (0, _utils.getStringOption)(attributes.override, ["disabled", "error", "ignore", "warning"]);
  53976. this.use = attributes.use || "";
  53977. this.usehref = attributes.usehref || "";
  53978. this.extras = null;
  53979. this.message = null;
  53980. this.script = null;
  53981. }
  53982. }
  53983. class Caption extends _xfa_object.XFAObject {
  53984. constructor(attributes) {
  53985. super(TEMPLATE_NS_ID, "caption", true);
  53986. this.id = attributes.id || "";
  53987. this.placement = (0, _utils.getStringOption)(attributes.placement, ["left", "bottom", "inline", "right", "top"]);
  53988. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  53989. this.reserve = Math.ceil((0, _utils.getMeasurement)(attributes.reserve));
  53990. this.use = attributes.use || "";
  53991. this.usehref = attributes.usehref || "";
  53992. this.extras = null;
  53993. this.font = null;
  53994. this.margin = null;
  53995. this.para = null;
  53996. this.value = null;
  53997. }
  53998. [_xfa_object.$setValue](value) {
  53999. _setValue(this, value);
  54000. }
  54001. [_xfa_object.$getExtra](availableSpace) {
  54002. if (!this[_xfa_object.$extra]) {
  54003. let {
  54004. width,
  54005. height
  54006. } = availableSpace;
  54007. switch (this.placement) {
  54008. case "left":
  54009. case "right":
  54010. case "inline":
  54011. width = this.reserve <= 0 ? width : this.reserve;
  54012. break;
  54013. case "top":
  54014. case "bottom":
  54015. height = this.reserve <= 0 ? height : this.reserve;
  54016. break;
  54017. }
  54018. this[_xfa_object.$extra] = (0, _html_utils.layoutNode)(this, {
  54019. width,
  54020. height
  54021. });
  54022. }
  54023. return this[_xfa_object.$extra];
  54024. }
  54025. [_xfa_object.$toHTML](availableSpace) {
  54026. if (!this.value) {
  54027. return _utils.HTMLResult.EMPTY;
  54028. }
  54029. this[_xfa_object.$pushPara]();
  54030. const value = this.value[_xfa_object.$toHTML](availableSpace).html;
  54031. if (!value) {
  54032. this[_xfa_object.$popPara]();
  54033. return _utils.HTMLResult.EMPTY;
  54034. }
  54035. const savedReserve = this.reserve;
  54036. if (this.reserve <= 0) {
  54037. const {
  54038. w,
  54039. h
  54040. } = this[_xfa_object.$getExtra](availableSpace);
  54041. switch (this.placement) {
  54042. case "left":
  54043. case "right":
  54044. case "inline":
  54045. this.reserve = w;
  54046. break;
  54047. case "top":
  54048. case "bottom":
  54049. this.reserve = h;
  54050. break;
  54051. }
  54052. }
  54053. const children = [];
  54054. if (typeof value === "string") {
  54055. children.push({
  54056. name: "#text",
  54057. value
  54058. });
  54059. } else {
  54060. children.push(value);
  54061. }
  54062. const style = (0, _html_utils.toStyle)(this, "font", "margin", "visibility");
  54063. switch (this.placement) {
  54064. case "left":
  54065. case "right":
  54066. if (this.reserve > 0) {
  54067. style.width = (0, _html_utils.measureToString)(this.reserve);
  54068. }
  54069. break;
  54070. case "top":
  54071. case "bottom":
  54072. if (this.reserve > 0) {
  54073. style.height = (0, _html_utils.measureToString)(this.reserve);
  54074. }
  54075. break;
  54076. }
  54077. (0, _html_utils.setPara)(this, null, value);
  54078. this[_xfa_object.$popPara]();
  54079. this.reserve = savedReserve;
  54080. return _utils.HTMLResult.success({
  54081. name: "div",
  54082. attributes: {
  54083. style,
  54084. class: ["xfaCaption"]
  54085. },
  54086. children
  54087. });
  54088. }
  54089. }
  54090. class Certificate extends _xfa_object.StringObject {
  54091. constructor(attributes) {
  54092. super(TEMPLATE_NS_ID, "certificate");
  54093. this.id = attributes.id || "";
  54094. this.name = attributes.name || "";
  54095. this.use = attributes.use || "";
  54096. this.usehref = attributes.usehref || "";
  54097. }
  54098. }
  54099. class Certificates extends _xfa_object.XFAObject {
  54100. constructor(attributes) {
  54101. super(TEMPLATE_NS_ID, "certificates", true);
  54102. this.credentialServerPolicy = (0, _utils.getStringOption)(attributes.credentialServerPolicy, ["optional", "required"]);
  54103. this.id = attributes.id || "";
  54104. this.url = attributes.url || "";
  54105. this.urlPolicy = attributes.urlPolicy || "";
  54106. this.use = attributes.use || "";
  54107. this.usehref = attributes.usehref || "";
  54108. this.encryption = null;
  54109. this.issuers = null;
  54110. this.keyUsage = null;
  54111. this.oids = null;
  54112. this.signing = null;
  54113. this.subjectDNs = null;
  54114. }
  54115. }
  54116. class CheckButton extends _xfa_object.XFAObject {
  54117. constructor(attributes) {
  54118. super(TEMPLATE_NS_ID, "checkButton", true);
  54119. this.id = attributes.id || "";
  54120. this.mark = (0, _utils.getStringOption)(attributes.mark, ["default", "check", "circle", "cross", "diamond", "square", "star"]);
  54121. this.shape = (0, _utils.getStringOption)(attributes.shape, ["square", "round"]);
  54122. this.size = (0, _utils.getMeasurement)(attributes.size, "10pt");
  54123. this.use = attributes.use || "";
  54124. this.usehref = attributes.usehref || "";
  54125. this.border = null;
  54126. this.extras = null;
  54127. this.margin = null;
  54128. }
  54129. [_xfa_object.$toHTML](availableSpace) {
  54130. const style = (0, _html_utils.toStyle)("margin");
  54131. const size = (0, _html_utils.measureToString)(this.size);
  54132. style.width = style.height = size;
  54133. let type;
  54134. let className;
  54135. let groupId;
  54136. const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  54137. const items = field.items.children.length && field.items.children[0][_xfa_object.$toHTML]().html || [];
  54138. const exportedValue = {
  54139. on: (items[0] !== undefined ? items[0] : "on").toString(),
  54140. off: (items[1] !== undefined ? items[1] : "off").toString()
  54141. };
  54142. const value = field.value && field.value[_xfa_object.$text]() || "off";
  54143. const checked = value === exportedValue.on || undefined;
  54144. const container = field[_xfa_object.$getSubformParent]();
  54145. const fieldId = field[_xfa_object.$uid];
  54146. let dataId;
  54147. if (container instanceof ExclGroup) {
  54148. groupId = container[_xfa_object.$uid];
  54149. type = "radio";
  54150. className = "xfaRadio";
  54151. dataId = container[_xfa_object.$data] && container[_xfa_object.$data][_xfa_object.$uid] || container[_xfa_object.$uid];
  54152. } else {
  54153. type = "checkbox";
  54154. className = "xfaCheckbox";
  54155. dataId = field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid];
  54156. }
  54157. const input = {
  54158. name: "input",
  54159. attributes: {
  54160. class: [className],
  54161. style,
  54162. fieldId,
  54163. dataId,
  54164. type,
  54165. checked,
  54166. xfaOn: exportedValue.on,
  54167. xfaOff: exportedValue.off,
  54168. "aria-label": ariaLabel(field),
  54169. "aria-required": false
  54170. }
  54171. };
  54172. if (groupId) {
  54173. input.attributes.name = groupId;
  54174. }
  54175. if (isRequired(field)) {
  54176. input.attributes["aria-required"] = true;
  54177. input.attributes.required = true;
  54178. }
  54179. return _utils.HTMLResult.success({
  54180. name: "label",
  54181. attributes: {
  54182. class: ["xfaLabel"]
  54183. },
  54184. children: [input]
  54185. });
  54186. }
  54187. }
  54188. class ChoiceList extends _xfa_object.XFAObject {
  54189. constructor(attributes) {
  54190. super(TEMPLATE_NS_ID, "choiceList", true);
  54191. this.commitOn = (0, _utils.getStringOption)(attributes.commitOn, ["select", "exit"]);
  54192. this.id = attributes.id || "";
  54193. this.open = (0, _utils.getStringOption)(attributes.open, ["userControl", "always", "multiSelect", "onEntry"]);
  54194. this.textEntry = (0, _utils.getInteger)({
  54195. data: attributes.textEntry,
  54196. defaultValue: 0,
  54197. validate: x => x === 1
  54198. });
  54199. this.use = attributes.use || "";
  54200. this.usehref = attributes.usehref || "";
  54201. this.border = null;
  54202. this.extras = null;
  54203. this.margin = null;
  54204. }
  54205. [_xfa_object.$toHTML](availableSpace) {
  54206. const style = (0, _html_utils.toStyle)(this, "border", "margin");
  54207. const ui = this[_xfa_object.$getParent]();
  54208. const field = ui[_xfa_object.$getParent]();
  54209. const fontSize = field.font && field.font.size || 10;
  54210. const optionStyle = {
  54211. fontSize: `calc(${fontSize}px * var(--scale-factor))`
  54212. };
  54213. const children = [];
  54214. if (field.items.children.length > 0) {
  54215. const items = field.items;
  54216. let displayedIndex = 0;
  54217. let saveIndex = 0;
  54218. if (items.children.length === 2) {
  54219. displayedIndex = items.children[0].save;
  54220. saveIndex = 1 - displayedIndex;
  54221. }
  54222. const displayed = items.children[displayedIndex][_xfa_object.$toHTML]().html;
  54223. const values = items.children[saveIndex][_xfa_object.$toHTML]().html;
  54224. let selected = false;
  54225. const value = field.value && field.value[_xfa_object.$text]() || "";
  54226. for (let i = 0, ii = displayed.length; i < ii; i++) {
  54227. const option = {
  54228. name: "option",
  54229. attributes: {
  54230. value: values[i] || displayed[i],
  54231. style: optionStyle
  54232. },
  54233. value: displayed[i]
  54234. };
  54235. if (values[i] === value) {
  54236. option.attributes.selected = selected = true;
  54237. }
  54238. children.push(option);
  54239. }
  54240. if (!selected) {
  54241. children.splice(0, 0, {
  54242. name: "option",
  54243. attributes: {
  54244. hidden: true,
  54245. selected: true
  54246. },
  54247. value: " "
  54248. });
  54249. }
  54250. }
  54251. const selectAttributes = {
  54252. class: ["xfaSelect"],
  54253. fieldId: field[_xfa_object.$uid],
  54254. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  54255. style,
  54256. "aria-label": ariaLabel(field),
  54257. "aria-required": false
  54258. };
  54259. if (isRequired(field)) {
  54260. selectAttributes["aria-required"] = true;
  54261. selectAttributes.required = true;
  54262. }
  54263. if (this.open === "multiSelect") {
  54264. selectAttributes.multiple = true;
  54265. }
  54266. return _utils.HTMLResult.success({
  54267. name: "label",
  54268. attributes: {
  54269. class: ["xfaLabel"]
  54270. },
  54271. children: [{
  54272. name: "select",
  54273. children,
  54274. attributes: selectAttributes
  54275. }]
  54276. });
  54277. }
  54278. }
  54279. class Color extends _xfa_object.XFAObject {
  54280. constructor(attributes) {
  54281. super(TEMPLATE_NS_ID, "color", true);
  54282. this.cSpace = (0, _utils.getStringOption)(attributes.cSpace, ["SRGB"]);
  54283. this.id = attributes.id || "";
  54284. this.use = attributes.use || "";
  54285. this.usehref = attributes.usehref || "";
  54286. this.value = attributes.value ? (0, _utils.getColor)(attributes.value) : "";
  54287. this.extras = null;
  54288. }
  54289. [_xfa_object.$hasSettableValue]() {
  54290. return false;
  54291. }
  54292. [_xfa_object.$toStyle]() {
  54293. return this.value ? _util.Util.makeHexColor(this.value.r, this.value.g, this.value.b) : null;
  54294. }
  54295. }
  54296. class Comb extends _xfa_object.XFAObject {
  54297. constructor(attributes) {
  54298. super(TEMPLATE_NS_ID, "comb");
  54299. this.id = attributes.id || "";
  54300. this.numberOfCells = (0, _utils.getInteger)({
  54301. data: attributes.numberOfCells,
  54302. defaultValue: 0,
  54303. validate: x => x >= 0
  54304. });
  54305. this.use = attributes.use || "";
  54306. this.usehref = attributes.usehref || "";
  54307. }
  54308. }
  54309. class Connect extends _xfa_object.XFAObject {
  54310. constructor(attributes) {
  54311. super(TEMPLATE_NS_ID, "connect", true);
  54312. this.connection = attributes.connection || "";
  54313. this.id = attributes.id || "";
  54314. this.ref = attributes.ref || "";
  54315. this.usage = (0, _utils.getStringOption)(attributes.usage, ["exportAndImport", "exportOnly", "importOnly"]);
  54316. this.use = attributes.use || "";
  54317. this.usehref = attributes.usehref || "";
  54318. this.picture = null;
  54319. }
  54320. }
  54321. class ContentArea extends _xfa_object.XFAObject {
  54322. constructor(attributes) {
  54323. super(TEMPLATE_NS_ID, "contentArea", true);
  54324. this.h = (0, _utils.getMeasurement)(attributes.h);
  54325. this.id = attributes.id || "";
  54326. this.name = attributes.name || "";
  54327. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  54328. this.use = attributes.use || "";
  54329. this.usehref = attributes.usehref || "";
  54330. this.w = (0, _utils.getMeasurement)(attributes.w);
  54331. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  54332. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  54333. this.desc = null;
  54334. this.extras = null;
  54335. }
  54336. [_xfa_object.$toHTML](availableSpace) {
  54337. const left = (0, _html_utils.measureToString)(this.x);
  54338. const top = (0, _html_utils.measureToString)(this.y);
  54339. const style = {
  54340. left,
  54341. top,
  54342. width: (0, _html_utils.measureToString)(this.w),
  54343. height: (0, _html_utils.measureToString)(this.h)
  54344. };
  54345. const classNames = ["xfaContentarea"];
  54346. if ((0, _html_utils.isPrintOnly)(this)) {
  54347. classNames.push("xfaPrintOnly");
  54348. }
  54349. return _utils.HTMLResult.success({
  54350. name: "div",
  54351. children: [],
  54352. attributes: {
  54353. style,
  54354. class: classNames,
  54355. id: this[_xfa_object.$uid]
  54356. }
  54357. });
  54358. }
  54359. }
  54360. class Corner extends _xfa_object.XFAObject {
  54361. constructor(attributes) {
  54362. super(TEMPLATE_NS_ID, "corner", true);
  54363. this.id = attributes.id || "";
  54364. this.inverted = (0, _utils.getInteger)({
  54365. data: attributes.inverted,
  54366. defaultValue: 0,
  54367. validate: x => x === 1
  54368. });
  54369. this.join = (0, _utils.getStringOption)(attributes.join, ["square", "round"]);
  54370. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  54371. this.radius = (0, _utils.getMeasurement)(attributes.radius);
  54372. this.stroke = (0, _utils.getStringOption)(attributes.stroke, ["solid", "dashDot", "dashDotDot", "dashed", "dotted", "embossed", "etched", "lowered", "raised"]);
  54373. this.thickness = (0, _utils.getMeasurement)(attributes.thickness, "0.5pt");
  54374. this.use = attributes.use || "";
  54375. this.usehref = attributes.usehref || "";
  54376. this.color = null;
  54377. this.extras = null;
  54378. }
  54379. [_xfa_object.$toStyle]() {
  54380. const style = (0, _html_utils.toStyle)(this, "visibility");
  54381. style.radius = (0, _html_utils.measureToString)(this.join === "square" ? 0 : this.radius);
  54382. return style;
  54383. }
  54384. }
  54385. class DateElement extends _xfa_object.ContentObject {
  54386. constructor(attributes) {
  54387. super(TEMPLATE_NS_ID, "date");
  54388. this.id = attributes.id || "";
  54389. this.name = attributes.name || "";
  54390. this.use = attributes.use || "";
  54391. this.usehref = attributes.usehref || "";
  54392. }
  54393. [_xfa_object.$finalize]() {
  54394. const date = this[_xfa_object.$content].trim();
  54395. this[_xfa_object.$content] = date ? new Date(date) : null;
  54396. }
  54397. [_xfa_object.$toHTML](availableSpace) {
  54398. return valueToHtml(this[_xfa_object.$content] ? this[_xfa_object.$content].toString() : "");
  54399. }
  54400. }
  54401. class DateTime extends _xfa_object.ContentObject {
  54402. constructor(attributes) {
  54403. super(TEMPLATE_NS_ID, "dateTime");
  54404. this.id = attributes.id || "";
  54405. this.name = attributes.name || "";
  54406. this.use = attributes.use || "";
  54407. this.usehref = attributes.usehref || "";
  54408. }
  54409. [_xfa_object.$finalize]() {
  54410. const date = this[_xfa_object.$content].trim();
  54411. this[_xfa_object.$content] = date ? new Date(date) : null;
  54412. }
  54413. [_xfa_object.$toHTML](availableSpace) {
  54414. return valueToHtml(this[_xfa_object.$content] ? this[_xfa_object.$content].toString() : "");
  54415. }
  54416. }
  54417. class DateTimeEdit extends _xfa_object.XFAObject {
  54418. constructor(attributes) {
  54419. super(TEMPLATE_NS_ID, "dateTimeEdit", true);
  54420. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  54421. this.id = attributes.id || "";
  54422. this.picker = (0, _utils.getStringOption)(attributes.picker, ["host", "none"]);
  54423. this.use = attributes.use || "";
  54424. this.usehref = attributes.usehref || "";
  54425. this.border = null;
  54426. this.comb = null;
  54427. this.extras = null;
  54428. this.margin = null;
  54429. }
  54430. [_xfa_object.$toHTML](availableSpace) {
  54431. const style = (0, _html_utils.toStyle)(this, "border", "font", "margin");
  54432. const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  54433. const html = {
  54434. name: "input",
  54435. attributes: {
  54436. type: "text",
  54437. fieldId: field[_xfa_object.$uid],
  54438. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  54439. class: ["xfaTextfield"],
  54440. style,
  54441. "aria-label": ariaLabel(field),
  54442. "aria-required": false
  54443. }
  54444. };
  54445. if (isRequired(field)) {
  54446. html.attributes["aria-required"] = true;
  54447. html.attributes.required = true;
  54448. }
  54449. return _utils.HTMLResult.success({
  54450. name: "label",
  54451. attributes: {
  54452. class: ["xfaLabel"]
  54453. },
  54454. children: [html]
  54455. });
  54456. }
  54457. }
  54458. class Decimal extends _xfa_object.ContentObject {
  54459. constructor(attributes) {
  54460. super(TEMPLATE_NS_ID, "decimal");
  54461. this.fracDigits = (0, _utils.getInteger)({
  54462. data: attributes.fracDigits,
  54463. defaultValue: 2,
  54464. validate: x => true
  54465. });
  54466. this.id = attributes.id || "";
  54467. this.leadDigits = (0, _utils.getInteger)({
  54468. data: attributes.leadDigits,
  54469. defaultValue: -1,
  54470. validate: x => true
  54471. });
  54472. this.name = attributes.name || "";
  54473. this.use = attributes.use || "";
  54474. this.usehref = attributes.usehref || "";
  54475. }
  54476. [_xfa_object.$finalize]() {
  54477. const number = parseFloat(this[_xfa_object.$content].trim());
  54478. this[_xfa_object.$content] = isNaN(number) ? null : number;
  54479. }
  54480. [_xfa_object.$toHTML](availableSpace) {
  54481. return valueToHtml(this[_xfa_object.$content] !== null ? this[_xfa_object.$content].toString() : "");
  54482. }
  54483. }
  54484. class DefaultUi extends _xfa_object.XFAObject {
  54485. constructor(attributes) {
  54486. super(TEMPLATE_NS_ID, "defaultUi", true);
  54487. this.id = attributes.id || "";
  54488. this.use = attributes.use || "";
  54489. this.usehref = attributes.usehref || "";
  54490. this.extras = null;
  54491. }
  54492. }
  54493. class Desc extends _xfa_object.XFAObject {
  54494. constructor(attributes) {
  54495. super(TEMPLATE_NS_ID, "desc", true);
  54496. this.id = attributes.id || "";
  54497. this.use = attributes.use || "";
  54498. this.usehref = attributes.usehref || "";
  54499. this.boolean = new _xfa_object.XFAObjectArray();
  54500. this.date = new _xfa_object.XFAObjectArray();
  54501. this.dateTime = new _xfa_object.XFAObjectArray();
  54502. this.decimal = new _xfa_object.XFAObjectArray();
  54503. this.exData = new _xfa_object.XFAObjectArray();
  54504. this.float = new _xfa_object.XFAObjectArray();
  54505. this.image = new _xfa_object.XFAObjectArray();
  54506. this.integer = new _xfa_object.XFAObjectArray();
  54507. this.text = new _xfa_object.XFAObjectArray();
  54508. this.time = new _xfa_object.XFAObjectArray();
  54509. }
  54510. }
  54511. class DigestMethod extends _xfa_object.OptionObject {
  54512. constructor(attributes) {
  54513. super(TEMPLATE_NS_ID, "digestMethod", ["", "SHA1", "SHA256", "SHA512", "RIPEMD160"]);
  54514. this.id = attributes.id || "";
  54515. this.use = attributes.use || "";
  54516. this.usehref = attributes.usehref || "";
  54517. }
  54518. }
  54519. class DigestMethods extends _xfa_object.XFAObject {
  54520. constructor(attributes) {
  54521. super(TEMPLATE_NS_ID, "digestMethods", true);
  54522. this.id = attributes.id || "";
  54523. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  54524. this.use = attributes.use || "";
  54525. this.usehref = attributes.usehref || "";
  54526. this.digestMethod = new _xfa_object.XFAObjectArray();
  54527. }
  54528. }
  54529. class Draw extends _xfa_object.XFAObject {
  54530. constructor(attributes) {
  54531. super(TEMPLATE_NS_ID, "draw", true);
  54532. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  54533. this.colSpan = (0, _utils.getInteger)({
  54534. data: attributes.colSpan,
  54535. defaultValue: 1,
  54536. validate: n => n >= 1 || n === -1
  54537. });
  54538. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  54539. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  54540. this.id = attributes.id || "";
  54541. this.locale = attributes.locale || "";
  54542. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  54543. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  54544. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  54545. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  54546. this.name = attributes.name || "";
  54547. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  54548. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  54549. this.rotate = (0, _utils.getInteger)({
  54550. data: attributes.rotate,
  54551. defaultValue: 0,
  54552. validate: x => x % 90 === 0
  54553. });
  54554. this.use = attributes.use || "";
  54555. this.usehref = attributes.usehref || "";
  54556. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  54557. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  54558. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  54559. this.assist = null;
  54560. this.border = null;
  54561. this.caption = null;
  54562. this.desc = null;
  54563. this.extras = null;
  54564. this.font = null;
  54565. this.keep = null;
  54566. this.margin = null;
  54567. this.para = null;
  54568. this.traversal = null;
  54569. this.ui = null;
  54570. this.value = null;
  54571. this.setProperty = new _xfa_object.XFAObjectArray();
  54572. }
  54573. [_xfa_object.$setValue](value) {
  54574. _setValue(this, value);
  54575. }
  54576. [_xfa_object.$toHTML](availableSpace) {
  54577. setTabIndex(this);
  54578. if (this.presence === "hidden" || this.presence === "inactive") {
  54579. return _utils.HTMLResult.EMPTY;
  54580. }
  54581. (0, _html_utils.fixDimensions)(this);
  54582. this[_xfa_object.$pushPara]();
  54583. const savedW = this.w;
  54584. const savedH = this.h;
  54585. const {
  54586. w,
  54587. h,
  54588. isBroken
  54589. } = (0, _html_utils.layoutNode)(this, availableSpace);
  54590. if (w && this.w === "") {
  54591. if (isBroken && this[_xfa_object.$getSubformParent]()[_xfa_object.$isThereMoreWidth]()) {
  54592. this[_xfa_object.$popPara]();
  54593. return _utils.HTMLResult.FAILURE;
  54594. }
  54595. this.w = w;
  54596. }
  54597. if (h && this.h === "") {
  54598. this.h = h;
  54599. }
  54600. setFirstUnsplittable(this);
  54601. if (!(0, _layout.checkDimensions)(this, availableSpace)) {
  54602. this.w = savedW;
  54603. this.h = savedH;
  54604. this[_xfa_object.$popPara]();
  54605. return _utils.HTMLResult.FAILURE;
  54606. }
  54607. unsetFirstUnsplittable(this);
  54608. const style = (0, _html_utils.toStyle)(this, "font", "hAlign", "dimensions", "position", "presence", "rotate", "anchorType", "border", "margin");
  54609. (0, _html_utils.setMinMaxDimensions)(this, style);
  54610. if (style.margin) {
  54611. style.padding = style.margin;
  54612. delete style.margin;
  54613. }
  54614. const classNames = ["xfaDraw"];
  54615. if (this.font) {
  54616. classNames.push("xfaFont");
  54617. }
  54618. if ((0, _html_utils.isPrintOnly)(this)) {
  54619. classNames.push("xfaPrintOnly");
  54620. }
  54621. const attributes = {
  54622. style,
  54623. id: this[_xfa_object.$uid],
  54624. class: classNames
  54625. };
  54626. if (this.name) {
  54627. attributes.xfaName = this.name;
  54628. }
  54629. const html = {
  54630. name: "div",
  54631. attributes,
  54632. children: []
  54633. };
  54634. applyAssist(this, attributes);
  54635. const bbox = (0, _html_utils.computeBbox)(this, html, availableSpace);
  54636. const value = this.value ? this.value[_xfa_object.$toHTML](availableSpace).html : null;
  54637. if (value === null) {
  54638. this.w = savedW;
  54639. this.h = savedH;
  54640. this[_xfa_object.$popPara]();
  54641. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  54642. }
  54643. html.children.push(value);
  54644. (0, _html_utils.setPara)(this, style, value);
  54645. this.w = savedW;
  54646. this.h = savedH;
  54647. this[_xfa_object.$popPara]();
  54648. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  54649. }
  54650. }
  54651. class Edge extends _xfa_object.XFAObject {
  54652. constructor(attributes) {
  54653. super(TEMPLATE_NS_ID, "edge", true);
  54654. this.cap = (0, _utils.getStringOption)(attributes.cap, ["square", "butt", "round"]);
  54655. this.id = attributes.id || "";
  54656. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  54657. this.stroke = (0, _utils.getStringOption)(attributes.stroke, ["solid", "dashDot", "dashDotDot", "dashed", "dotted", "embossed", "etched", "lowered", "raised"]);
  54658. this.thickness = (0, _utils.getMeasurement)(attributes.thickness, "0.5pt");
  54659. this.use = attributes.use || "";
  54660. this.usehref = attributes.usehref || "";
  54661. this.color = null;
  54662. this.extras = null;
  54663. }
  54664. [_xfa_object.$toStyle]() {
  54665. const style = (0, _html_utils.toStyle)(this, "visibility");
  54666. Object.assign(style, {
  54667. linecap: this.cap,
  54668. width: (0, _html_utils.measureToString)(this.thickness),
  54669. color: this.color ? this.color[_xfa_object.$toStyle]() : "#000000",
  54670. style: ""
  54671. });
  54672. if (this.presence !== "visible") {
  54673. style.style = "none";
  54674. } else {
  54675. switch (this.stroke) {
  54676. case "solid":
  54677. style.style = "solid";
  54678. break;
  54679. case "dashDot":
  54680. style.style = "dashed";
  54681. break;
  54682. case "dashDotDot":
  54683. style.style = "dashed";
  54684. break;
  54685. case "dashed":
  54686. style.style = "dashed";
  54687. break;
  54688. case "dotted":
  54689. style.style = "dotted";
  54690. break;
  54691. case "embossed":
  54692. style.style = "ridge";
  54693. break;
  54694. case "etched":
  54695. style.style = "groove";
  54696. break;
  54697. case "lowered":
  54698. style.style = "inset";
  54699. break;
  54700. case "raised":
  54701. style.style = "outset";
  54702. break;
  54703. }
  54704. }
  54705. return style;
  54706. }
  54707. }
  54708. class Encoding extends _xfa_object.OptionObject {
  54709. constructor(attributes) {
  54710. super(TEMPLATE_NS_ID, "encoding", ["adbe.x509.rsa_sha1", "adbe.pkcs7.detached", "adbe.pkcs7.sha1"]);
  54711. this.id = attributes.id || "";
  54712. this.use = attributes.use || "";
  54713. this.usehref = attributes.usehref || "";
  54714. }
  54715. }
  54716. class Encodings extends _xfa_object.XFAObject {
  54717. constructor(attributes) {
  54718. super(TEMPLATE_NS_ID, "encodings", true);
  54719. this.id = attributes.id || "";
  54720. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  54721. this.use = attributes.use || "";
  54722. this.usehref = attributes.usehref || "";
  54723. this.encoding = new _xfa_object.XFAObjectArray();
  54724. }
  54725. }
  54726. class Encrypt extends _xfa_object.XFAObject {
  54727. constructor(attributes) {
  54728. super(TEMPLATE_NS_ID, "encrypt", true);
  54729. this.id = attributes.id || "";
  54730. this.use = attributes.use || "";
  54731. this.usehref = attributes.usehref || "";
  54732. this.certificate = null;
  54733. }
  54734. }
  54735. class EncryptData extends _xfa_object.XFAObject {
  54736. constructor(attributes) {
  54737. super(TEMPLATE_NS_ID, "encryptData", true);
  54738. this.id = attributes.id || "";
  54739. this.operation = (0, _utils.getStringOption)(attributes.operation, ["encrypt", "decrypt"]);
  54740. this.target = attributes.target || "";
  54741. this.use = attributes.use || "";
  54742. this.usehref = attributes.usehref || "";
  54743. this.filter = null;
  54744. this.manifest = null;
  54745. }
  54746. }
  54747. class Encryption extends _xfa_object.XFAObject {
  54748. constructor(attributes) {
  54749. super(TEMPLATE_NS_ID, "encryption", true);
  54750. this.id = attributes.id || "";
  54751. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  54752. this.use = attributes.use || "";
  54753. this.usehref = attributes.usehref || "";
  54754. this.certificate = new _xfa_object.XFAObjectArray();
  54755. }
  54756. }
  54757. class EncryptionMethod extends _xfa_object.OptionObject {
  54758. constructor(attributes) {
  54759. super(TEMPLATE_NS_ID, "encryptionMethod", ["", "AES256-CBC", "TRIPLEDES-CBC", "AES128-CBC", "AES192-CBC"]);
  54760. this.id = attributes.id || "";
  54761. this.use = attributes.use || "";
  54762. this.usehref = attributes.usehref || "";
  54763. }
  54764. }
  54765. class EncryptionMethods extends _xfa_object.XFAObject {
  54766. constructor(attributes) {
  54767. super(TEMPLATE_NS_ID, "encryptionMethods", true);
  54768. this.id = attributes.id || "";
  54769. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  54770. this.use = attributes.use || "";
  54771. this.usehref = attributes.usehref || "";
  54772. this.encryptionMethod = new _xfa_object.XFAObjectArray();
  54773. }
  54774. }
  54775. class Event extends _xfa_object.XFAObject {
  54776. constructor(attributes) {
  54777. super(TEMPLATE_NS_ID, "event", true);
  54778. 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"]);
  54779. this.id = attributes.id || "";
  54780. this.listen = (0, _utils.getStringOption)(attributes.listen, ["refOnly", "refAndDescendents"]);
  54781. this.name = attributes.name || "";
  54782. this.ref = attributes.ref || "";
  54783. this.use = attributes.use || "";
  54784. this.usehref = attributes.usehref || "";
  54785. this.extras = null;
  54786. this.encryptData = null;
  54787. this.execute = null;
  54788. this.script = null;
  54789. this.signData = null;
  54790. this.submit = null;
  54791. }
  54792. }
  54793. class ExData extends _xfa_object.ContentObject {
  54794. constructor(attributes) {
  54795. super(TEMPLATE_NS_ID, "exData");
  54796. this.contentType = attributes.contentType || "";
  54797. this.href = attributes.href || "";
  54798. this.id = attributes.id || "";
  54799. this.maxLength = (0, _utils.getInteger)({
  54800. data: attributes.maxLength,
  54801. defaultValue: -1,
  54802. validate: x => x >= -1
  54803. });
  54804. this.name = attributes.name || "";
  54805. this.rid = attributes.rid || "";
  54806. this.transferEncoding = (0, _utils.getStringOption)(attributes.transferEncoding, ["none", "base64", "package"]);
  54807. this.use = attributes.use || "";
  54808. this.usehref = attributes.usehref || "";
  54809. }
  54810. [_xfa_object.$isCDATAXml]() {
  54811. return this.contentType === "text/html";
  54812. }
  54813. [_xfa_object.$onChild](child) {
  54814. if (this.contentType === "text/html" && child[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.xhtml.id) {
  54815. this[_xfa_object.$content] = child;
  54816. return true;
  54817. }
  54818. if (this.contentType === "text/xml") {
  54819. this[_xfa_object.$content] = child;
  54820. return true;
  54821. }
  54822. return false;
  54823. }
  54824. [_xfa_object.$toHTML](availableSpace) {
  54825. if (this.contentType !== "text/html" || !this[_xfa_object.$content]) {
  54826. return _utils.HTMLResult.EMPTY;
  54827. }
  54828. return this[_xfa_object.$content][_xfa_object.$toHTML](availableSpace);
  54829. }
  54830. }
  54831. class ExObject extends _xfa_object.XFAObject {
  54832. constructor(attributes) {
  54833. super(TEMPLATE_NS_ID, "exObject", true);
  54834. this.archive = attributes.archive || "";
  54835. this.classId = attributes.classId || "";
  54836. this.codeBase = attributes.codeBase || "";
  54837. this.codeType = attributes.codeType || "";
  54838. this.id = attributes.id || "";
  54839. this.name = attributes.name || "";
  54840. this.use = attributes.use || "";
  54841. this.usehref = attributes.usehref || "";
  54842. this.extras = null;
  54843. this.boolean = new _xfa_object.XFAObjectArray();
  54844. this.date = new _xfa_object.XFAObjectArray();
  54845. this.dateTime = new _xfa_object.XFAObjectArray();
  54846. this.decimal = new _xfa_object.XFAObjectArray();
  54847. this.exData = new _xfa_object.XFAObjectArray();
  54848. this.exObject = new _xfa_object.XFAObjectArray();
  54849. this.float = new _xfa_object.XFAObjectArray();
  54850. this.image = new _xfa_object.XFAObjectArray();
  54851. this.integer = new _xfa_object.XFAObjectArray();
  54852. this.text = new _xfa_object.XFAObjectArray();
  54853. this.time = new _xfa_object.XFAObjectArray();
  54854. }
  54855. }
  54856. class ExclGroup extends _xfa_object.XFAObject {
  54857. constructor(attributes) {
  54858. super(TEMPLATE_NS_ID, "exclGroup", true);
  54859. this.access = (0, _utils.getStringOption)(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]);
  54860. this.accessKey = attributes.accessKey || "";
  54861. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  54862. this.colSpan = (0, _utils.getInteger)({
  54863. data: attributes.colSpan,
  54864. defaultValue: 1,
  54865. validate: n => n >= 1 || n === -1
  54866. });
  54867. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  54868. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  54869. this.id = attributes.id || "";
  54870. this.layout = (0, _utils.getStringOption)(attributes.layout, ["position", "lr-tb", "rl-row", "rl-tb", "row", "table", "tb"]);
  54871. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  54872. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  54873. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  54874. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  54875. this.name = attributes.name || "";
  54876. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  54877. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  54878. this.use = attributes.use || "";
  54879. this.usehref = attributes.usehref || "";
  54880. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  54881. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  54882. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  54883. this.assist = null;
  54884. this.bind = null;
  54885. this.border = null;
  54886. this.calculate = null;
  54887. this.caption = null;
  54888. this.desc = null;
  54889. this.extras = null;
  54890. this.margin = null;
  54891. this.para = null;
  54892. this.traversal = null;
  54893. this.validate = null;
  54894. this.connect = new _xfa_object.XFAObjectArray();
  54895. this.event = new _xfa_object.XFAObjectArray();
  54896. this.field = new _xfa_object.XFAObjectArray();
  54897. this.setProperty = new _xfa_object.XFAObjectArray();
  54898. }
  54899. [_xfa_object.$isBindable]() {
  54900. return true;
  54901. }
  54902. [_xfa_object.$hasSettableValue]() {
  54903. return true;
  54904. }
  54905. [_xfa_object.$setValue](value) {
  54906. for (const field of this.field.children) {
  54907. if (!field.value) {
  54908. const nodeValue = new Value({});
  54909. field[_xfa_object.$appendChild](nodeValue);
  54910. field.value = nodeValue;
  54911. }
  54912. field.value[_xfa_object.$setValue](value);
  54913. }
  54914. }
  54915. [_xfa_object.$isThereMoreWidth]() {
  54916. return this.layout.endsWith("-tb") && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine > 0 || this[_xfa_object.$getParent]()[_xfa_object.$isThereMoreWidth]();
  54917. }
  54918. [_xfa_object.$isSplittable]() {
  54919. const parent = this[_xfa_object.$getSubformParent]();
  54920. if (!parent[_xfa_object.$isSplittable]()) {
  54921. return false;
  54922. }
  54923. if (this[_xfa_object.$extra]._isSplittable !== undefined) {
  54924. return this[_xfa_object.$extra]._isSplittable;
  54925. }
  54926. if (this.layout === "position" || this.layout.includes("row")) {
  54927. this[_xfa_object.$extra]._isSplittable = false;
  54928. return false;
  54929. }
  54930. if (parent.layout && parent.layout.endsWith("-tb") && parent[_xfa_object.$extra].numberInLine !== 0) {
  54931. return false;
  54932. }
  54933. this[_xfa_object.$extra]._isSplittable = true;
  54934. return true;
  54935. }
  54936. [_xfa_object.$flushHTML]() {
  54937. return (0, _layout.flushHTML)(this);
  54938. }
  54939. [_xfa_object.$addHTML](html, bbox) {
  54940. (0, _layout.addHTML)(this, html, bbox);
  54941. }
  54942. [_xfa_object.$getAvailableSpace]() {
  54943. return (0, _layout.getAvailableSpace)(this);
  54944. }
  54945. [_xfa_object.$toHTML](availableSpace) {
  54946. setTabIndex(this);
  54947. if (this.presence === "hidden" || this.presence === "inactive" || this.h === 0 || this.w === 0) {
  54948. return _utils.HTMLResult.EMPTY;
  54949. }
  54950. (0, _html_utils.fixDimensions)(this);
  54951. const children = [];
  54952. const attributes = {
  54953. id: this[_xfa_object.$uid],
  54954. class: []
  54955. };
  54956. (0, _html_utils.setAccess)(this, attributes.class);
  54957. if (!this[_xfa_object.$extra]) {
  54958. this[_xfa_object.$extra] = Object.create(null);
  54959. }
  54960. Object.assign(this[_xfa_object.$extra], {
  54961. children,
  54962. attributes,
  54963. attempt: 0,
  54964. line: null,
  54965. numberInLine: 0,
  54966. availableSpace: {
  54967. width: Math.min(this.w || Infinity, availableSpace.width),
  54968. height: Math.min(this.h || Infinity, availableSpace.height)
  54969. },
  54970. width: 0,
  54971. height: 0,
  54972. prevHeight: 0,
  54973. currentWidth: 0
  54974. });
  54975. const isSplittable = this[_xfa_object.$isSplittable]();
  54976. if (!isSplittable) {
  54977. setFirstUnsplittable(this);
  54978. }
  54979. if (!(0, _layout.checkDimensions)(this, availableSpace)) {
  54980. return _utils.HTMLResult.FAILURE;
  54981. }
  54982. const filter = new Set(["field"]);
  54983. if (this.layout.includes("row")) {
  54984. const columnWidths = this[_xfa_object.$getSubformParent]().columnWidths;
  54985. if (Array.isArray(columnWidths) && columnWidths.length > 0) {
  54986. this[_xfa_object.$extra].columnWidths = columnWidths;
  54987. this[_xfa_object.$extra].currentColumn = 0;
  54988. }
  54989. }
  54990. const style = (0, _html_utils.toStyle)(this, "anchorType", "dimensions", "position", "presence", "border", "margin", "hAlign");
  54991. const classNames = ["xfaExclgroup"];
  54992. const cl = (0, _html_utils.layoutClass)(this);
  54993. if (cl) {
  54994. classNames.push(cl);
  54995. }
  54996. if ((0, _html_utils.isPrintOnly)(this)) {
  54997. classNames.push("xfaPrintOnly");
  54998. }
  54999. attributes.style = style;
  55000. attributes.class = classNames;
  55001. if (this.name) {
  55002. attributes.xfaName = this.name;
  55003. }
  55004. this[_xfa_object.$pushPara]();
  55005. const isLrTb = this.layout === "lr-tb" || this.layout === "rl-tb";
  55006. const maxRun = isLrTb ? MAX_ATTEMPTS_FOR_LRTB_LAYOUT : 1;
  55007. for (; this[_xfa_object.$extra].attempt < maxRun; this[_xfa_object.$extra].attempt++) {
  55008. if (isLrTb && this[_xfa_object.$extra].attempt === MAX_ATTEMPTS_FOR_LRTB_LAYOUT - 1) {
  55009. this[_xfa_object.$extra].numberInLine = 0;
  55010. }
  55011. const result = this[_xfa_object.$childrenToHTML]({
  55012. filter,
  55013. include: true
  55014. });
  55015. if (result.success) {
  55016. break;
  55017. }
  55018. if (result.isBreak()) {
  55019. this[_xfa_object.$popPara]();
  55020. return result;
  55021. }
  55022. if (isLrTb && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine === 0 && !this[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  55023. this[_xfa_object.$extra].attempt = maxRun;
  55024. break;
  55025. }
  55026. }
  55027. this[_xfa_object.$popPara]();
  55028. if (!isSplittable) {
  55029. unsetFirstUnsplittable(this);
  55030. }
  55031. if (this[_xfa_object.$extra].attempt === maxRun) {
  55032. if (!isSplittable) {
  55033. delete this[_xfa_object.$extra];
  55034. }
  55035. return _utils.HTMLResult.FAILURE;
  55036. }
  55037. let marginH = 0;
  55038. let marginV = 0;
  55039. if (this.margin) {
  55040. marginH = this.margin.leftInset + this.margin.rightInset;
  55041. marginV = this.margin.topInset + this.margin.bottomInset;
  55042. }
  55043. const width = Math.max(this[_xfa_object.$extra].width + marginH, this.w || 0);
  55044. const height = Math.max(this[_xfa_object.$extra].height + marginV, this.h || 0);
  55045. const bbox = [this.x, this.y, width, height];
  55046. if (this.w === "") {
  55047. style.width = (0, _html_utils.measureToString)(width);
  55048. }
  55049. if (this.h === "") {
  55050. style.height = (0, _html_utils.measureToString)(height);
  55051. }
  55052. const html = {
  55053. name: "div",
  55054. attributes,
  55055. children
  55056. };
  55057. applyAssist(this, attributes);
  55058. delete this[_xfa_object.$extra];
  55059. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  55060. }
  55061. }
  55062. class Execute extends _xfa_object.XFAObject {
  55063. constructor(attributes) {
  55064. super(TEMPLATE_NS_ID, "execute");
  55065. this.connection = attributes.connection || "";
  55066. this.executeType = (0, _utils.getStringOption)(attributes.executeType, ["import", "remerge"]);
  55067. this.id = attributes.id || "";
  55068. this.runAt = (0, _utils.getStringOption)(attributes.runAt, ["client", "both", "server"]);
  55069. this.use = attributes.use || "";
  55070. this.usehref = attributes.usehref || "";
  55071. }
  55072. }
  55073. class Extras extends _xfa_object.XFAObject {
  55074. constructor(attributes) {
  55075. super(TEMPLATE_NS_ID, "extras", true);
  55076. this.id = attributes.id || "";
  55077. this.name = attributes.name || "";
  55078. this.use = attributes.use || "";
  55079. this.usehref = attributes.usehref || "";
  55080. this.boolean = new _xfa_object.XFAObjectArray();
  55081. this.date = new _xfa_object.XFAObjectArray();
  55082. this.dateTime = new _xfa_object.XFAObjectArray();
  55083. this.decimal = new _xfa_object.XFAObjectArray();
  55084. this.exData = new _xfa_object.XFAObjectArray();
  55085. this.extras = new _xfa_object.XFAObjectArray();
  55086. this.float = new _xfa_object.XFAObjectArray();
  55087. this.image = new _xfa_object.XFAObjectArray();
  55088. this.integer = new _xfa_object.XFAObjectArray();
  55089. this.text = new _xfa_object.XFAObjectArray();
  55090. this.time = new _xfa_object.XFAObjectArray();
  55091. }
  55092. }
  55093. class Field extends _xfa_object.XFAObject {
  55094. constructor(attributes) {
  55095. super(TEMPLATE_NS_ID, "field", true);
  55096. this.access = (0, _utils.getStringOption)(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]);
  55097. this.accessKey = attributes.accessKey || "";
  55098. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  55099. this.colSpan = (0, _utils.getInteger)({
  55100. data: attributes.colSpan,
  55101. defaultValue: 1,
  55102. validate: n => n >= 1 || n === -1
  55103. });
  55104. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  55105. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  55106. this.id = attributes.id || "";
  55107. this.locale = attributes.locale || "";
  55108. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  55109. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  55110. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  55111. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  55112. this.name = attributes.name || "";
  55113. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  55114. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  55115. this.rotate = (0, _utils.getInteger)({
  55116. data: attributes.rotate,
  55117. defaultValue: 0,
  55118. validate: x => x % 90 === 0
  55119. });
  55120. this.use = attributes.use || "";
  55121. this.usehref = attributes.usehref || "";
  55122. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  55123. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  55124. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  55125. this.assist = null;
  55126. this.bind = null;
  55127. this.border = null;
  55128. this.calculate = null;
  55129. this.caption = null;
  55130. this.desc = null;
  55131. this.extras = null;
  55132. this.font = null;
  55133. this.format = null;
  55134. this.items = new _xfa_object.XFAObjectArray(2);
  55135. this.keep = null;
  55136. this.margin = null;
  55137. this.para = null;
  55138. this.traversal = null;
  55139. this.ui = null;
  55140. this.validate = null;
  55141. this.value = null;
  55142. this.bindItems = new _xfa_object.XFAObjectArray();
  55143. this.connect = new _xfa_object.XFAObjectArray();
  55144. this.event = new _xfa_object.XFAObjectArray();
  55145. this.setProperty = new _xfa_object.XFAObjectArray();
  55146. }
  55147. [_xfa_object.$isBindable]() {
  55148. return true;
  55149. }
  55150. [_xfa_object.$setValue](value) {
  55151. _setValue(this, value);
  55152. }
  55153. [_xfa_object.$toHTML](availableSpace) {
  55154. setTabIndex(this);
  55155. if (!this.ui) {
  55156. this.ui = new Ui({});
  55157. this.ui[_xfa_object.$globalData] = this[_xfa_object.$globalData];
  55158. this[_xfa_object.$appendChild](this.ui);
  55159. let node;
  55160. switch (this.items.children.length) {
  55161. case 0:
  55162. node = new TextEdit({});
  55163. this.ui.textEdit = node;
  55164. break;
  55165. case 1:
  55166. node = new CheckButton({});
  55167. this.ui.checkButton = node;
  55168. break;
  55169. case 2:
  55170. node = new ChoiceList({});
  55171. this.ui.choiceList = node;
  55172. break;
  55173. }
  55174. this.ui[_xfa_object.$appendChild](node);
  55175. }
  55176. if (!this.ui || this.presence === "hidden" || this.presence === "inactive" || this.h === 0 || this.w === 0) {
  55177. return _utils.HTMLResult.EMPTY;
  55178. }
  55179. if (this.caption) {
  55180. delete this.caption[_xfa_object.$extra];
  55181. }
  55182. this[_xfa_object.$pushPara]();
  55183. const caption = this.caption ? this.caption[_xfa_object.$toHTML](availableSpace).html : null;
  55184. const savedW = this.w;
  55185. const savedH = this.h;
  55186. let marginH = 0;
  55187. let marginV = 0;
  55188. if (this.margin) {
  55189. marginH = this.margin.leftInset + this.margin.rightInset;
  55190. marginV = this.margin.topInset + this.margin.bottomInset;
  55191. }
  55192. let borderDims = null;
  55193. if (this.w === "" || this.h === "") {
  55194. let width = null;
  55195. let height = null;
  55196. let uiW = 0;
  55197. let uiH = 0;
  55198. if (this.ui.checkButton) {
  55199. uiW = uiH = this.ui.checkButton.size;
  55200. } else {
  55201. const {
  55202. w,
  55203. h
  55204. } = (0, _html_utils.layoutNode)(this, availableSpace);
  55205. if (w !== null) {
  55206. uiW = w;
  55207. uiH = h;
  55208. } else {
  55209. uiH = (0, _fonts.getMetrics)(this.font, true).lineNoGap;
  55210. }
  55211. }
  55212. borderDims = getBorderDims(this.ui[_xfa_object.$getExtra]());
  55213. uiW += borderDims.w;
  55214. uiH += borderDims.h;
  55215. if (this.caption) {
  55216. const {
  55217. w,
  55218. h,
  55219. isBroken
  55220. } = this.caption[_xfa_object.$getExtra](availableSpace);
  55221. if (isBroken && this[_xfa_object.$getSubformParent]()[_xfa_object.$isThereMoreWidth]()) {
  55222. this[_xfa_object.$popPara]();
  55223. return _utils.HTMLResult.FAILURE;
  55224. }
  55225. width = w;
  55226. height = h;
  55227. switch (this.caption.placement) {
  55228. case "left":
  55229. case "right":
  55230. case "inline":
  55231. width += uiW;
  55232. break;
  55233. case "top":
  55234. case "bottom":
  55235. height += uiH;
  55236. break;
  55237. }
  55238. } else {
  55239. width = uiW;
  55240. height = uiH;
  55241. }
  55242. if (width && this.w === "") {
  55243. width += marginH;
  55244. this.w = Math.min(this.maxW <= 0 ? Infinity : this.maxW, this.minW + 1 < width ? width : this.minW);
  55245. }
  55246. if (height && this.h === "") {
  55247. height += marginV;
  55248. this.h = Math.min(this.maxH <= 0 ? Infinity : this.maxH, this.minH + 1 < height ? height : this.minH);
  55249. }
  55250. }
  55251. this[_xfa_object.$popPara]();
  55252. (0, _html_utils.fixDimensions)(this);
  55253. setFirstUnsplittable(this);
  55254. if (!(0, _layout.checkDimensions)(this, availableSpace)) {
  55255. this.w = savedW;
  55256. this.h = savedH;
  55257. this[_xfa_object.$popPara]();
  55258. return _utils.HTMLResult.FAILURE;
  55259. }
  55260. unsetFirstUnsplittable(this);
  55261. const style = (0, _html_utils.toStyle)(this, "font", "dimensions", "position", "rotate", "anchorType", "presence", "margin", "hAlign");
  55262. (0, _html_utils.setMinMaxDimensions)(this, style);
  55263. const classNames = ["xfaField"];
  55264. if (this.font) {
  55265. classNames.push("xfaFont");
  55266. }
  55267. if ((0, _html_utils.isPrintOnly)(this)) {
  55268. classNames.push("xfaPrintOnly");
  55269. }
  55270. const attributes = {
  55271. style,
  55272. id: this[_xfa_object.$uid],
  55273. class: classNames
  55274. };
  55275. if (style.margin) {
  55276. style.padding = style.margin;
  55277. delete style.margin;
  55278. }
  55279. (0, _html_utils.setAccess)(this, classNames);
  55280. if (this.name) {
  55281. attributes.xfaName = this.name;
  55282. }
  55283. const children = [];
  55284. const html = {
  55285. name: "div",
  55286. attributes,
  55287. children
  55288. };
  55289. applyAssist(this, attributes);
  55290. const borderStyle = this.border ? this.border[_xfa_object.$toStyle]() : null;
  55291. const bbox = (0, _html_utils.computeBbox)(this, html, availableSpace);
  55292. const ui = this.ui[_xfa_object.$toHTML]().html;
  55293. if (!ui) {
  55294. Object.assign(style, borderStyle);
  55295. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  55296. }
  55297. if (this[_xfa_object.$tabIndex]) {
  55298. if (ui.children && ui.children[0]) {
  55299. ui.children[0].attributes.tabindex = this[_xfa_object.$tabIndex];
  55300. } else {
  55301. ui.attributes.tabindex = this[_xfa_object.$tabIndex];
  55302. }
  55303. }
  55304. if (!ui.attributes.style) {
  55305. ui.attributes.style = Object.create(null);
  55306. }
  55307. let aElement = null;
  55308. if (this.ui.button) {
  55309. if (ui.children.length === 1) {
  55310. [aElement] = ui.children.splice(0, 1);
  55311. }
  55312. Object.assign(ui.attributes.style, borderStyle);
  55313. } else {
  55314. Object.assign(style, borderStyle);
  55315. }
  55316. children.push(ui);
  55317. if (this.value) {
  55318. if (this.ui.imageEdit) {
  55319. ui.children.push(this.value[_xfa_object.$toHTML]().html);
  55320. } else if (!this.ui.button) {
  55321. let value = "";
  55322. if (this.value.exData) {
  55323. value = this.value.exData[_xfa_object.$text]();
  55324. } else if (this.value.text) {
  55325. value = this.value.text[_xfa_object.$getExtra]();
  55326. } else {
  55327. const htmlValue = this.value[_xfa_object.$toHTML]().html;
  55328. if (htmlValue !== null) {
  55329. value = htmlValue.children[0].value;
  55330. }
  55331. }
  55332. if (this.ui.textEdit && this.value.text && this.value.text.maxChars) {
  55333. ui.children[0].attributes.maxLength = this.value.text.maxChars;
  55334. }
  55335. if (value) {
  55336. if (this.ui.numericEdit) {
  55337. value = parseFloat(value);
  55338. value = isNaN(value) ? "" : value.toString();
  55339. }
  55340. if (ui.children[0].name === "textarea") {
  55341. ui.children[0].attributes.textContent = value;
  55342. } else {
  55343. ui.children[0].attributes.value = value;
  55344. }
  55345. }
  55346. }
  55347. }
  55348. if (!this.ui.imageEdit && ui.children && ui.children[0] && this.h) {
  55349. borderDims = borderDims || getBorderDims(this.ui[_xfa_object.$getExtra]());
  55350. let captionHeight = 0;
  55351. if (this.caption && ["top", "bottom"].includes(this.caption.placement)) {
  55352. captionHeight = this.caption.reserve;
  55353. if (captionHeight <= 0) {
  55354. captionHeight = this.caption[_xfa_object.$getExtra](availableSpace).h;
  55355. }
  55356. const inputHeight = this.h - captionHeight - marginV - borderDims.h;
  55357. ui.children[0].attributes.style.height = (0, _html_utils.measureToString)(inputHeight);
  55358. } else {
  55359. ui.children[0].attributes.style.height = "100%";
  55360. }
  55361. }
  55362. if (aElement) {
  55363. ui.children.push(aElement);
  55364. }
  55365. if (!caption) {
  55366. if (ui.attributes.class) {
  55367. ui.attributes.class.push("xfaLeft");
  55368. }
  55369. this.w = savedW;
  55370. this.h = savedH;
  55371. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  55372. }
  55373. if (this.ui.button) {
  55374. if (style.padding) {
  55375. delete style.padding;
  55376. }
  55377. if (caption.name === "div") {
  55378. caption.name = "span";
  55379. }
  55380. ui.children.push(caption);
  55381. return _utils.HTMLResult.success(html, bbox);
  55382. } else if (this.ui.checkButton) {
  55383. caption.attributes.class[0] = "xfaCaptionForCheckButton";
  55384. }
  55385. if (!ui.attributes.class) {
  55386. ui.attributes.class = [];
  55387. }
  55388. ui.children.splice(0, 0, caption);
  55389. switch (this.caption.placement) {
  55390. case "left":
  55391. ui.attributes.class.push("xfaLeft");
  55392. break;
  55393. case "right":
  55394. ui.attributes.class.push("xfaRight");
  55395. break;
  55396. case "top":
  55397. ui.attributes.class.push("xfaTop");
  55398. break;
  55399. case "bottom":
  55400. ui.attributes.class.push("xfaBottom");
  55401. break;
  55402. case "inline":
  55403. ui.attributes.class.push("xfaLeft");
  55404. break;
  55405. }
  55406. this.w = savedW;
  55407. this.h = savedH;
  55408. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  55409. }
  55410. }
  55411. exports.Field = Field;
  55412. class Fill extends _xfa_object.XFAObject {
  55413. constructor(attributes) {
  55414. super(TEMPLATE_NS_ID, "fill", true);
  55415. this.id = attributes.id || "";
  55416. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  55417. this.use = attributes.use || "";
  55418. this.usehref = attributes.usehref || "";
  55419. this.color = null;
  55420. this.extras = null;
  55421. this.linear = null;
  55422. this.pattern = null;
  55423. this.radial = null;
  55424. this.solid = null;
  55425. this.stipple = null;
  55426. }
  55427. [_xfa_object.$toStyle]() {
  55428. const parent = this[_xfa_object.$getParent]();
  55429. const grandpa = parent[_xfa_object.$getParent]();
  55430. const ggrandpa = grandpa[_xfa_object.$getParent]();
  55431. const style = Object.create(null);
  55432. let propName = "color";
  55433. let altPropName = propName;
  55434. if (parent instanceof Border) {
  55435. propName = "background-color";
  55436. altPropName = "background";
  55437. if (ggrandpa instanceof Ui) {
  55438. style.backgroundColor = "white";
  55439. }
  55440. }
  55441. if (parent instanceof Rectangle || parent instanceof Arc) {
  55442. propName = altPropName = "fill";
  55443. style.fill = "white";
  55444. }
  55445. for (const name of Object.getOwnPropertyNames(this)) {
  55446. if (name === "extras" || name === "color") {
  55447. continue;
  55448. }
  55449. const obj = this[name];
  55450. if (!(obj instanceof _xfa_object.XFAObject)) {
  55451. continue;
  55452. }
  55453. const color = obj[_xfa_object.$toStyle](this.color);
  55454. if (color) {
  55455. style[color.startsWith("#") ? propName : altPropName] = color;
  55456. }
  55457. return style;
  55458. }
  55459. if (this.color && this.color.value) {
  55460. const color = this.color[_xfa_object.$toStyle]();
  55461. style[color.startsWith("#") ? propName : altPropName] = color;
  55462. }
  55463. return style;
  55464. }
  55465. }
  55466. class Filter extends _xfa_object.XFAObject {
  55467. constructor(attributes) {
  55468. super(TEMPLATE_NS_ID, "filter", true);
  55469. this.addRevocationInfo = (0, _utils.getStringOption)(attributes.addRevocationInfo, ["", "required", "optional", "none"]);
  55470. this.id = attributes.id || "";
  55471. this.name = attributes.name || "";
  55472. this.use = attributes.use || "";
  55473. this.usehref = attributes.usehref || "";
  55474. this.version = (0, _utils.getInteger)({
  55475. data: this.version,
  55476. defaultValue: 5,
  55477. validate: x => x >= 1 && x <= 5
  55478. });
  55479. this.appearanceFilter = null;
  55480. this.certificates = null;
  55481. this.digestMethods = null;
  55482. this.encodings = null;
  55483. this.encryptionMethods = null;
  55484. this.handler = null;
  55485. this.lockDocument = null;
  55486. this.mdp = null;
  55487. this.reasons = null;
  55488. this.timeStamp = null;
  55489. }
  55490. }
  55491. class Float extends _xfa_object.ContentObject {
  55492. constructor(attributes) {
  55493. super(TEMPLATE_NS_ID, "float");
  55494. this.id = attributes.id || "";
  55495. this.name = attributes.name || "";
  55496. this.use = attributes.use || "";
  55497. this.usehref = attributes.usehref || "";
  55498. }
  55499. [_xfa_object.$finalize]() {
  55500. const number = parseFloat(this[_xfa_object.$content].trim());
  55501. this[_xfa_object.$content] = isNaN(number) ? null : number;
  55502. }
  55503. [_xfa_object.$toHTML](availableSpace) {
  55504. return valueToHtml(this[_xfa_object.$content] !== null ? this[_xfa_object.$content].toString() : "");
  55505. }
  55506. }
  55507. class Font extends _xfa_object.XFAObject {
  55508. constructor(attributes) {
  55509. super(TEMPLATE_NS_ID, "font", true);
  55510. this.baselineShift = (0, _utils.getMeasurement)(attributes.baselineShift);
  55511. this.fontHorizontalScale = (0, _utils.getFloat)({
  55512. data: attributes.fontHorizontalScale,
  55513. defaultValue: 100,
  55514. validate: x => x >= 0
  55515. });
  55516. this.fontVerticalScale = (0, _utils.getFloat)({
  55517. data: attributes.fontVerticalScale,
  55518. defaultValue: 100,
  55519. validate: x => x >= 0
  55520. });
  55521. this.id = attributes.id || "";
  55522. this.kerningMode = (0, _utils.getStringOption)(attributes.kerningMode, ["none", "pair"]);
  55523. this.letterSpacing = (0, _utils.getMeasurement)(attributes.letterSpacing, "0");
  55524. this.lineThrough = (0, _utils.getInteger)({
  55525. data: attributes.lineThrough,
  55526. defaultValue: 0,
  55527. validate: x => x === 1 || x === 2
  55528. });
  55529. this.lineThroughPeriod = (0, _utils.getStringOption)(attributes.lineThroughPeriod, ["all", "word"]);
  55530. this.overline = (0, _utils.getInteger)({
  55531. data: attributes.overline,
  55532. defaultValue: 0,
  55533. validate: x => x === 1 || x === 2
  55534. });
  55535. this.overlinePeriod = (0, _utils.getStringOption)(attributes.overlinePeriod, ["all", "word"]);
  55536. this.posture = (0, _utils.getStringOption)(attributes.posture, ["normal", "italic"]);
  55537. this.size = (0, _utils.getMeasurement)(attributes.size, "10pt");
  55538. this.typeface = attributes.typeface || "Courier";
  55539. this.underline = (0, _utils.getInteger)({
  55540. data: attributes.underline,
  55541. defaultValue: 0,
  55542. validate: x => x === 1 || x === 2
  55543. });
  55544. this.underlinePeriod = (0, _utils.getStringOption)(attributes.underlinePeriod, ["all", "word"]);
  55545. this.use = attributes.use || "";
  55546. this.usehref = attributes.usehref || "";
  55547. this.weight = (0, _utils.getStringOption)(attributes.weight, ["normal", "bold"]);
  55548. this.extras = null;
  55549. this.fill = null;
  55550. }
  55551. [_xfa_object.$clean](builder) {
  55552. super[_xfa_object.$clean](builder);
  55553. this[_xfa_object.$globalData].usedTypefaces.add(this.typeface);
  55554. }
  55555. [_xfa_object.$toStyle]() {
  55556. const style = (0, _html_utils.toStyle)(this, "fill");
  55557. const color = style.color;
  55558. if (color) {
  55559. if (color === "#000000") {
  55560. delete style.color;
  55561. } else if (!color.startsWith("#")) {
  55562. style.background = color;
  55563. style.backgroundClip = "text";
  55564. style.color = "transparent";
  55565. }
  55566. }
  55567. if (this.baselineShift) {
  55568. style.verticalAlign = (0, _html_utils.measureToString)(this.baselineShift);
  55569. }
  55570. style.fontKerning = this.kerningMode === "none" ? "none" : "normal";
  55571. style.letterSpacing = (0, _html_utils.measureToString)(this.letterSpacing);
  55572. if (this.lineThrough !== 0) {
  55573. style.textDecoration = "line-through";
  55574. if (this.lineThrough === 2) {
  55575. style.textDecorationStyle = "double";
  55576. }
  55577. }
  55578. if (this.overline !== 0) {
  55579. style.textDecoration = "overline";
  55580. if (this.overline === 2) {
  55581. style.textDecorationStyle = "double";
  55582. }
  55583. }
  55584. style.fontStyle = this.posture;
  55585. style.fontSize = (0, _html_utils.measureToString)(0.99 * this.size);
  55586. (0, _html_utils.setFontFamily)(this, this, this[_xfa_object.$globalData].fontFinder, style);
  55587. if (this.underline !== 0) {
  55588. style.textDecoration = "underline";
  55589. if (this.underline === 2) {
  55590. style.textDecorationStyle = "double";
  55591. }
  55592. }
  55593. style.fontWeight = this.weight;
  55594. return style;
  55595. }
  55596. }
  55597. class Format extends _xfa_object.XFAObject {
  55598. constructor(attributes) {
  55599. super(TEMPLATE_NS_ID, "format", true);
  55600. this.id = attributes.id || "";
  55601. this.use = attributes.use || "";
  55602. this.usehref = attributes.usehref || "";
  55603. this.extras = null;
  55604. this.picture = null;
  55605. }
  55606. }
  55607. class Handler extends _xfa_object.StringObject {
  55608. constructor(attributes) {
  55609. super(TEMPLATE_NS_ID, "handler");
  55610. this.id = attributes.id || "";
  55611. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  55612. this.use = attributes.use || "";
  55613. this.usehref = attributes.usehref || "";
  55614. }
  55615. }
  55616. class Hyphenation extends _xfa_object.XFAObject {
  55617. constructor(attributes) {
  55618. super(TEMPLATE_NS_ID, "hyphenation");
  55619. this.excludeAllCaps = (0, _utils.getInteger)({
  55620. data: attributes.excludeAllCaps,
  55621. defaultValue: 0,
  55622. validate: x => x === 1
  55623. });
  55624. this.excludeInitialCap = (0, _utils.getInteger)({
  55625. data: attributes.excludeInitialCap,
  55626. defaultValue: 0,
  55627. validate: x => x === 1
  55628. });
  55629. this.hyphenate = (0, _utils.getInteger)({
  55630. data: attributes.hyphenate,
  55631. defaultValue: 0,
  55632. validate: x => x === 1
  55633. });
  55634. this.id = attributes.id || "";
  55635. this.pushCharacterCount = (0, _utils.getInteger)({
  55636. data: attributes.pushCharacterCount,
  55637. defaultValue: 3,
  55638. validate: x => x >= 0
  55639. });
  55640. this.remainCharacterCount = (0, _utils.getInteger)({
  55641. data: attributes.remainCharacterCount,
  55642. defaultValue: 3,
  55643. validate: x => x >= 0
  55644. });
  55645. this.use = attributes.use || "";
  55646. this.usehref = attributes.usehref || "";
  55647. this.wordCharacterCount = (0, _utils.getInteger)({
  55648. data: attributes.wordCharacterCount,
  55649. defaultValue: 7,
  55650. validate: x => x >= 0
  55651. });
  55652. }
  55653. }
  55654. class Image extends _xfa_object.StringObject {
  55655. constructor(attributes) {
  55656. super(TEMPLATE_NS_ID, "image");
  55657. this.aspect = (0, _utils.getStringOption)(attributes.aspect, ["fit", "actual", "height", "none", "width"]);
  55658. this.contentType = attributes.contentType || "";
  55659. this.href = attributes.href || "";
  55660. this.id = attributes.id || "";
  55661. this.name = attributes.name || "";
  55662. this.transferEncoding = (0, _utils.getStringOption)(attributes.transferEncoding, ["base64", "none", "package"]);
  55663. this.use = attributes.use || "";
  55664. this.usehref = attributes.usehref || "";
  55665. }
  55666. [_xfa_object.$toHTML]() {
  55667. if (this.contentType && !MIMES.has(this.contentType.toLowerCase())) {
  55668. return _utils.HTMLResult.EMPTY;
  55669. }
  55670. let buffer = this[_xfa_object.$globalData].images && this[_xfa_object.$globalData].images.get(this.href);
  55671. if (!buffer && (this.href || !this[_xfa_object.$content])) {
  55672. return _utils.HTMLResult.EMPTY;
  55673. }
  55674. if (!buffer && this.transferEncoding === "base64") {
  55675. buffer = (0, _util.stringToBytes)(atob(this[_xfa_object.$content]));
  55676. }
  55677. if (!buffer) {
  55678. return _utils.HTMLResult.EMPTY;
  55679. }
  55680. if (!this.contentType) {
  55681. for (const [header, type] of IMAGES_HEADERS) {
  55682. if (buffer.length > header.length && header.every((x, i) => x === buffer[i])) {
  55683. this.contentType = type;
  55684. break;
  55685. }
  55686. }
  55687. if (!this.contentType) {
  55688. return _utils.HTMLResult.EMPTY;
  55689. }
  55690. }
  55691. const blob = new Blob([buffer], {
  55692. type: this.contentType
  55693. });
  55694. let style;
  55695. switch (this.aspect) {
  55696. case "fit":
  55697. case "actual":
  55698. break;
  55699. case "height":
  55700. style = {
  55701. height: "100%",
  55702. objectFit: "fill"
  55703. };
  55704. break;
  55705. case "none":
  55706. style = {
  55707. width: "100%",
  55708. height: "100%",
  55709. objectFit: "fill"
  55710. };
  55711. break;
  55712. case "width":
  55713. style = {
  55714. width: "100%",
  55715. objectFit: "fill"
  55716. };
  55717. break;
  55718. }
  55719. const parent = this[_xfa_object.$getParent]();
  55720. return _utils.HTMLResult.success({
  55721. name: "img",
  55722. attributes: {
  55723. class: ["xfaImage"],
  55724. style,
  55725. src: URL.createObjectURL(blob),
  55726. alt: parent ? ariaLabel(parent[_xfa_object.$getParent]()) : null
  55727. }
  55728. });
  55729. }
  55730. }
  55731. class ImageEdit extends _xfa_object.XFAObject {
  55732. constructor(attributes) {
  55733. super(TEMPLATE_NS_ID, "imageEdit", true);
  55734. this.data = (0, _utils.getStringOption)(attributes.data, ["link", "embed"]);
  55735. this.id = attributes.id || "";
  55736. this.use = attributes.use || "";
  55737. this.usehref = attributes.usehref || "";
  55738. this.border = null;
  55739. this.extras = null;
  55740. this.margin = null;
  55741. }
  55742. [_xfa_object.$toHTML](availableSpace) {
  55743. if (this.data === "embed") {
  55744. return _utils.HTMLResult.success({
  55745. name: "div",
  55746. children: [],
  55747. attributes: {}
  55748. });
  55749. }
  55750. return _utils.HTMLResult.EMPTY;
  55751. }
  55752. }
  55753. class Integer extends _xfa_object.ContentObject {
  55754. constructor(attributes) {
  55755. super(TEMPLATE_NS_ID, "integer");
  55756. this.id = attributes.id || "";
  55757. this.name = attributes.name || "";
  55758. this.use = attributes.use || "";
  55759. this.usehref = attributes.usehref || "";
  55760. }
  55761. [_xfa_object.$finalize]() {
  55762. const number = parseInt(this[_xfa_object.$content].trim(), 10);
  55763. this[_xfa_object.$content] = isNaN(number) ? null : number;
  55764. }
  55765. [_xfa_object.$toHTML](availableSpace) {
  55766. return valueToHtml(this[_xfa_object.$content] !== null ? this[_xfa_object.$content].toString() : "");
  55767. }
  55768. }
  55769. class Issuers extends _xfa_object.XFAObject {
  55770. constructor(attributes) {
  55771. super(TEMPLATE_NS_ID, "issuers", true);
  55772. this.id = attributes.id || "";
  55773. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  55774. this.use = attributes.use || "";
  55775. this.usehref = attributes.usehref || "";
  55776. this.certificate = new _xfa_object.XFAObjectArray();
  55777. }
  55778. }
  55779. class Items extends _xfa_object.XFAObject {
  55780. constructor(attributes) {
  55781. super(TEMPLATE_NS_ID, "items", true);
  55782. this.id = attributes.id || "";
  55783. this.name = attributes.name || "";
  55784. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  55785. this.ref = attributes.ref || "";
  55786. this.save = (0, _utils.getInteger)({
  55787. data: attributes.save,
  55788. defaultValue: 0,
  55789. validate: x => x === 1
  55790. });
  55791. this.use = attributes.use || "";
  55792. this.usehref = attributes.usehref || "";
  55793. this.boolean = new _xfa_object.XFAObjectArray();
  55794. this.date = new _xfa_object.XFAObjectArray();
  55795. this.dateTime = new _xfa_object.XFAObjectArray();
  55796. this.decimal = new _xfa_object.XFAObjectArray();
  55797. this.exData = new _xfa_object.XFAObjectArray();
  55798. this.float = new _xfa_object.XFAObjectArray();
  55799. this.image = new _xfa_object.XFAObjectArray();
  55800. this.integer = new _xfa_object.XFAObjectArray();
  55801. this.text = new _xfa_object.XFAObjectArray();
  55802. this.time = new _xfa_object.XFAObjectArray();
  55803. }
  55804. [_xfa_object.$toHTML]() {
  55805. const output = [];
  55806. for (const child of this[_xfa_object.$getChildren]()) {
  55807. output.push(child[_xfa_object.$text]());
  55808. }
  55809. return _utils.HTMLResult.success(output);
  55810. }
  55811. }
  55812. exports.Items = Items;
  55813. class Keep extends _xfa_object.XFAObject {
  55814. constructor(attributes) {
  55815. super(TEMPLATE_NS_ID, "keep", true);
  55816. this.id = attributes.id || "";
  55817. const options = ["none", "contentArea", "pageArea"];
  55818. this.intact = (0, _utils.getStringOption)(attributes.intact, options);
  55819. this.next = (0, _utils.getStringOption)(attributes.next, options);
  55820. this.previous = (0, _utils.getStringOption)(attributes.previous, options);
  55821. this.use = attributes.use || "";
  55822. this.usehref = attributes.usehref || "";
  55823. this.extras = null;
  55824. }
  55825. }
  55826. class KeyUsage extends _xfa_object.XFAObject {
  55827. constructor(attributes) {
  55828. super(TEMPLATE_NS_ID, "keyUsage");
  55829. const options = ["", "yes", "no"];
  55830. this.crlSign = (0, _utils.getStringOption)(attributes.crlSign, options);
  55831. this.dataEncipherment = (0, _utils.getStringOption)(attributes.dataEncipherment, options);
  55832. this.decipherOnly = (0, _utils.getStringOption)(attributes.decipherOnly, options);
  55833. this.digitalSignature = (0, _utils.getStringOption)(attributes.digitalSignature, options);
  55834. this.encipherOnly = (0, _utils.getStringOption)(attributes.encipherOnly, options);
  55835. this.id = attributes.id || "";
  55836. this.keyAgreement = (0, _utils.getStringOption)(attributes.keyAgreement, options);
  55837. this.keyCertSign = (0, _utils.getStringOption)(attributes.keyCertSign, options);
  55838. this.keyEncipherment = (0, _utils.getStringOption)(attributes.keyEncipherment, options);
  55839. this.nonRepudiation = (0, _utils.getStringOption)(attributes.nonRepudiation, options);
  55840. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  55841. this.use = attributes.use || "";
  55842. this.usehref = attributes.usehref || "";
  55843. }
  55844. }
  55845. class Line extends _xfa_object.XFAObject {
  55846. constructor(attributes) {
  55847. super(TEMPLATE_NS_ID, "line", true);
  55848. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  55849. this.id = attributes.id || "";
  55850. this.slope = (0, _utils.getStringOption)(attributes.slope, ["\\", "/"]);
  55851. this.use = attributes.use || "";
  55852. this.usehref = attributes.usehref || "";
  55853. this.edge = null;
  55854. }
  55855. [_xfa_object.$toHTML]() {
  55856. const parent = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  55857. const edge = this.edge || new Edge({});
  55858. const edgeStyle = edge[_xfa_object.$toStyle]();
  55859. const style = Object.create(null);
  55860. const thickness = edge.presence === "visible" ? edge.thickness : 0;
  55861. style.strokeWidth = (0, _html_utils.measureToString)(thickness);
  55862. style.stroke = edgeStyle.color;
  55863. let x1, y1, x2, y2;
  55864. let width = "100%";
  55865. let height = "100%";
  55866. if (parent.w <= thickness) {
  55867. [x1, y1, x2, y2] = ["50%", 0, "50%", "100%"];
  55868. width = style.strokeWidth;
  55869. } else if (parent.h <= thickness) {
  55870. [x1, y1, x2, y2] = [0, "50%", "100%", "50%"];
  55871. height = style.strokeWidth;
  55872. } else {
  55873. if (this.slope === "\\") {
  55874. [x1, y1, x2, y2] = [0, 0, "100%", "100%"];
  55875. } else {
  55876. [x1, y1, x2, y2] = [0, "100%", "100%", 0];
  55877. }
  55878. }
  55879. const line = {
  55880. name: "line",
  55881. attributes: {
  55882. xmlns: SVG_NS,
  55883. x1,
  55884. y1,
  55885. x2,
  55886. y2,
  55887. style
  55888. }
  55889. };
  55890. const svg = {
  55891. name: "svg",
  55892. children: [line],
  55893. attributes: {
  55894. xmlns: SVG_NS,
  55895. width,
  55896. height,
  55897. style: {
  55898. overflow: "visible"
  55899. }
  55900. }
  55901. };
  55902. if (hasMargin(parent)) {
  55903. return _utils.HTMLResult.success({
  55904. name: "div",
  55905. attributes: {
  55906. style: {
  55907. display: "inline",
  55908. width: "100%",
  55909. height: "100%"
  55910. }
  55911. },
  55912. children: [svg]
  55913. });
  55914. }
  55915. svg.attributes.style.position = "absolute";
  55916. return _utils.HTMLResult.success(svg);
  55917. }
  55918. }
  55919. class Linear extends _xfa_object.XFAObject {
  55920. constructor(attributes) {
  55921. super(TEMPLATE_NS_ID, "linear", true);
  55922. this.id = attributes.id || "";
  55923. this.type = (0, _utils.getStringOption)(attributes.type, ["toRight", "toBottom", "toLeft", "toTop"]);
  55924. this.use = attributes.use || "";
  55925. this.usehref = attributes.usehref || "";
  55926. this.color = null;
  55927. this.extras = null;
  55928. }
  55929. [_xfa_object.$toStyle](startColor) {
  55930. startColor = startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  55931. const transf = this.type.replace(/([RBLT])/, " $1").toLowerCase();
  55932. const endColor = this.color ? this.color[_xfa_object.$toStyle]() : "#000000";
  55933. return `linear-gradient(${transf}, ${startColor}, ${endColor})`;
  55934. }
  55935. }
  55936. class LockDocument extends _xfa_object.ContentObject {
  55937. constructor(attributes) {
  55938. super(TEMPLATE_NS_ID, "lockDocument");
  55939. this.id = attributes.id || "";
  55940. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  55941. this.use = attributes.use || "";
  55942. this.usehref = attributes.usehref || "";
  55943. }
  55944. [_xfa_object.$finalize]() {
  55945. this[_xfa_object.$content] = (0, _utils.getStringOption)(this[_xfa_object.$content], ["auto", "0", "1"]);
  55946. }
  55947. }
  55948. class Manifest extends _xfa_object.XFAObject {
  55949. constructor(attributes) {
  55950. super(TEMPLATE_NS_ID, "manifest", true);
  55951. this.action = (0, _utils.getStringOption)(attributes.action, ["include", "all", "exclude"]);
  55952. this.id = attributes.id || "";
  55953. this.name = attributes.name || "";
  55954. this.use = attributes.use || "";
  55955. this.usehref = attributes.usehref || "";
  55956. this.extras = null;
  55957. this.ref = new _xfa_object.XFAObjectArray();
  55958. }
  55959. }
  55960. class Margin extends _xfa_object.XFAObject {
  55961. constructor(attributes) {
  55962. super(TEMPLATE_NS_ID, "margin", true);
  55963. this.bottomInset = (0, _utils.getMeasurement)(attributes.bottomInset, "0");
  55964. this.id = attributes.id || "";
  55965. this.leftInset = (0, _utils.getMeasurement)(attributes.leftInset, "0");
  55966. this.rightInset = (0, _utils.getMeasurement)(attributes.rightInset, "0");
  55967. this.topInset = (0, _utils.getMeasurement)(attributes.topInset, "0");
  55968. this.use = attributes.use || "";
  55969. this.usehref = attributes.usehref || "";
  55970. this.extras = null;
  55971. }
  55972. [_xfa_object.$toStyle]() {
  55973. return {
  55974. 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)
  55975. };
  55976. }
  55977. }
  55978. class Mdp extends _xfa_object.XFAObject {
  55979. constructor(attributes) {
  55980. super(TEMPLATE_NS_ID, "mdp");
  55981. this.id = attributes.id || "";
  55982. this.permissions = (0, _utils.getInteger)({
  55983. data: attributes.permissions,
  55984. defaultValue: 2,
  55985. validate: x => x === 1 || x === 3
  55986. });
  55987. this.signatureType = (0, _utils.getStringOption)(attributes.signatureType, ["filler", "author"]);
  55988. this.use = attributes.use || "";
  55989. this.usehref = attributes.usehref || "";
  55990. }
  55991. }
  55992. class Medium extends _xfa_object.XFAObject {
  55993. constructor(attributes) {
  55994. super(TEMPLATE_NS_ID, "medium");
  55995. this.id = attributes.id || "";
  55996. this.imagingBBox = (0, _utils.getBBox)(attributes.imagingBBox);
  55997. this.long = (0, _utils.getMeasurement)(attributes.long);
  55998. this.orientation = (0, _utils.getStringOption)(attributes.orientation, ["portrait", "landscape"]);
  55999. this.short = (0, _utils.getMeasurement)(attributes.short);
  56000. this.stock = attributes.stock || "";
  56001. this.trayIn = (0, _utils.getStringOption)(attributes.trayIn, ["auto", "delegate", "pageFront"]);
  56002. this.trayOut = (0, _utils.getStringOption)(attributes.trayOut, ["auto", "delegate"]);
  56003. this.use = attributes.use || "";
  56004. this.usehref = attributes.usehref || "";
  56005. }
  56006. }
  56007. class Message extends _xfa_object.XFAObject {
  56008. constructor(attributes) {
  56009. super(TEMPLATE_NS_ID, "message", true);
  56010. this.id = attributes.id || "";
  56011. this.use = attributes.use || "";
  56012. this.usehref = attributes.usehref || "";
  56013. this.text = new _xfa_object.XFAObjectArray();
  56014. }
  56015. }
  56016. class NumericEdit extends _xfa_object.XFAObject {
  56017. constructor(attributes) {
  56018. super(TEMPLATE_NS_ID, "numericEdit", true);
  56019. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  56020. this.id = attributes.id || "";
  56021. this.use = attributes.use || "";
  56022. this.usehref = attributes.usehref || "";
  56023. this.border = null;
  56024. this.comb = null;
  56025. this.extras = null;
  56026. this.margin = null;
  56027. }
  56028. [_xfa_object.$toHTML](availableSpace) {
  56029. const style = (0, _html_utils.toStyle)(this, "border", "font", "margin");
  56030. const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  56031. const html = {
  56032. name: "input",
  56033. attributes: {
  56034. type: "text",
  56035. fieldId: field[_xfa_object.$uid],
  56036. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  56037. class: ["xfaTextfield"],
  56038. style,
  56039. "aria-label": ariaLabel(field),
  56040. "aria-required": false
  56041. }
  56042. };
  56043. if (isRequired(field)) {
  56044. html.attributes["aria-required"] = true;
  56045. html.attributes.required = true;
  56046. }
  56047. return _utils.HTMLResult.success({
  56048. name: "label",
  56049. attributes: {
  56050. class: ["xfaLabel"]
  56051. },
  56052. children: [html]
  56053. });
  56054. }
  56055. }
  56056. class Occur extends _xfa_object.XFAObject {
  56057. constructor(attributes) {
  56058. super(TEMPLATE_NS_ID, "occur", true);
  56059. this.id = attributes.id || "";
  56060. this.initial = attributes.initial !== "" ? (0, _utils.getInteger)({
  56061. data: attributes.initial,
  56062. defaultValue: "",
  56063. validate: x => true
  56064. }) : "";
  56065. this.max = attributes.max !== "" ? (0, _utils.getInteger)({
  56066. data: attributes.max,
  56067. defaultValue: 1,
  56068. validate: x => true
  56069. }) : "";
  56070. this.min = attributes.min !== "" ? (0, _utils.getInteger)({
  56071. data: attributes.min,
  56072. defaultValue: 1,
  56073. validate: x => true
  56074. }) : "";
  56075. this.use = attributes.use || "";
  56076. this.usehref = attributes.usehref || "";
  56077. this.extras = null;
  56078. }
  56079. [_xfa_object.$clean]() {
  56080. const parent = this[_xfa_object.$getParent]();
  56081. const originalMin = this.min;
  56082. if (this.min === "") {
  56083. this.min = parent instanceof PageArea || parent instanceof PageSet ? 0 : 1;
  56084. }
  56085. if (this.max === "") {
  56086. if (originalMin === "") {
  56087. this.max = parent instanceof PageArea || parent instanceof PageSet ? -1 : 1;
  56088. } else {
  56089. this.max = this.min;
  56090. }
  56091. }
  56092. if (this.max !== -1 && this.max < this.min) {
  56093. this.max = this.min;
  56094. }
  56095. if (this.initial === "") {
  56096. this.initial = parent instanceof Template ? 1 : this.min;
  56097. }
  56098. }
  56099. }
  56100. class Oid extends _xfa_object.StringObject {
  56101. constructor(attributes) {
  56102. super(TEMPLATE_NS_ID, "oid");
  56103. this.id = attributes.id || "";
  56104. this.name = attributes.name || "";
  56105. this.use = attributes.use || "";
  56106. this.usehref = attributes.usehref || "";
  56107. }
  56108. }
  56109. class Oids extends _xfa_object.XFAObject {
  56110. constructor(attributes) {
  56111. super(TEMPLATE_NS_ID, "oids", true);
  56112. this.id = attributes.id || "";
  56113. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  56114. this.use = attributes.use || "";
  56115. this.usehref = attributes.usehref || "";
  56116. this.oid = new _xfa_object.XFAObjectArray();
  56117. }
  56118. }
  56119. class Overflow extends _xfa_object.XFAObject {
  56120. constructor(attributes) {
  56121. super(TEMPLATE_NS_ID, "overflow");
  56122. this.id = attributes.id || "";
  56123. this.leader = attributes.leader || "";
  56124. this.target = attributes.target || "";
  56125. this.trailer = attributes.trailer || "";
  56126. this.use = attributes.use || "";
  56127. this.usehref = attributes.usehref || "";
  56128. }
  56129. [_xfa_object.$getExtra]() {
  56130. if (!this[_xfa_object.$extra]) {
  56131. const parent = this[_xfa_object.$getParent]();
  56132. const root = this[_xfa_object.$getTemplateRoot]();
  56133. const target = root[_xfa_object.$searchNode](this.target, parent);
  56134. const leader = root[_xfa_object.$searchNode](this.leader, parent);
  56135. const trailer = root[_xfa_object.$searchNode](this.trailer, parent);
  56136. this[_xfa_object.$extra] = {
  56137. target: target && target[0] || null,
  56138. leader: leader && leader[0] || null,
  56139. trailer: trailer && trailer[0] || null,
  56140. addLeader: false,
  56141. addTrailer: false
  56142. };
  56143. }
  56144. return this[_xfa_object.$extra];
  56145. }
  56146. }
  56147. class PageArea extends _xfa_object.XFAObject {
  56148. constructor(attributes) {
  56149. super(TEMPLATE_NS_ID, "pageArea", true);
  56150. this.blankOrNotBlank = (0, _utils.getStringOption)(attributes.blankOrNotBlank, ["any", "blank", "notBlank"]);
  56151. this.id = attributes.id || "";
  56152. this.initialNumber = (0, _utils.getInteger)({
  56153. data: attributes.initialNumber,
  56154. defaultValue: 1,
  56155. validate: x => true
  56156. });
  56157. this.name = attributes.name || "";
  56158. this.numbered = (0, _utils.getInteger)({
  56159. data: attributes.numbered,
  56160. defaultValue: 1,
  56161. validate: x => true
  56162. });
  56163. this.oddOrEven = (0, _utils.getStringOption)(attributes.oddOrEven, ["any", "even", "odd"]);
  56164. this.pagePosition = (0, _utils.getStringOption)(attributes.pagePosition, ["any", "first", "last", "only", "rest"]);
  56165. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  56166. this.use = attributes.use || "";
  56167. this.usehref = attributes.usehref || "";
  56168. this.desc = null;
  56169. this.extras = null;
  56170. this.medium = null;
  56171. this.occur = null;
  56172. this.area = new _xfa_object.XFAObjectArray();
  56173. this.contentArea = new _xfa_object.XFAObjectArray();
  56174. this.draw = new _xfa_object.XFAObjectArray();
  56175. this.exclGroup = new _xfa_object.XFAObjectArray();
  56176. this.field = new _xfa_object.XFAObjectArray();
  56177. this.subform = new _xfa_object.XFAObjectArray();
  56178. }
  56179. [_xfa_object.$isUsable]() {
  56180. if (!this[_xfa_object.$extra]) {
  56181. this[_xfa_object.$extra] = {
  56182. numberOfUse: 0
  56183. };
  56184. return true;
  56185. }
  56186. return !this.occur || this.occur.max === -1 || this[_xfa_object.$extra].numberOfUse < this.occur.max;
  56187. }
  56188. [_xfa_object.$cleanPage]() {
  56189. delete this[_xfa_object.$extra];
  56190. }
  56191. [_xfa_object.$getNextPage]() {
  56192. if (!this[_xfa_object.$extra]) {
  56193. this[_xfa_object.$extra] = {
  56194. numberOfUse: 0
  56195. };
  56196. }
  56197. const parent = this[_xfa_object.$getParent]();
  56198. if (parent.relation === "orderedOccurrence") {
  56199. if (this[_xfa_object.$isUsable]()) {
  56200. this[_xfa_object.$extra].numberOfUse += 1;
  56201. return this;
  56202. }
  56203. }
  56204. return parent[_xfa_object.$getNextPage]();
  56205. }
  56206. [_xfa_object.$getAvailableSpace]() {
  56207. return this[_xfa_object.$extra].space || {
  56208. width: 0,
  56209. height: 0
  56210. };
  56211. }
  56212. [_xfa_object.$toHTML]() {
  56213. if (!this[_xfa_object.$extra]) {
  56214. this[_xfa_object.$extra] = {
  56215. numberOfUse: 1
  56216. };
  56217. }
  56218. const children = [];
  56219. this[_xfa_object.$extra].children = children;
  56220. const style = Object.create(null);
  56221. if (this.medium && this.medium.short && this.medium.long) {
  56222. style.width = (0, _html_utils.measureToString)(this.medium.short);
  56223. style.height = (0, _html_utils.measureToString)(this.medium.long);
  56224. this[_xfa_object.$extra].space = {
  56225. width: this.medium.short,
  56226. height: this.medium.long
  56227. };
  56228. if (this.medium.orientation === "landscape") {
  56229. const x = style.width;
  56230. style.width = style.height;
  56231. style.height = x;
  56232. this[_xfa_object.$extra].space = {
  56233. width: this.medium.long,
  56234. height: this.medium.short
  56235. };
  56236. }
  56237. } else {
  56238. (0, _util.warn)("XFA - No medium specified in pageArea: please file a bug.");
  56239. }
  56240. this[_xfa_object.$childrenToHTML]({
  56241. filter: new Set(["area", "draw", "field", "subform"]),
  56242. include: true
  56243. });
  56244. this[_xfa_object.$childrenToHTML]({
  56245. filter: new Set(["contentArea"]),
  56246. include: true
  56247. });
  56248. return _utils.HTMLResult.success({
  56249. name: "div",
  56250. children,
  56251. attributes: {
  56252. class: ["xfaPage"],
  56253. id: this[_xfa_object.$uid],
  56254. style,
  56255. xfaName: this.name
  56256. }
  56257. });
  56258. }
  56259. }
  56260. class PageSet extends _xfa_object.XFAObject {
  56261. constructor(attributes) {
  56262. super(TEMPLATE_NS_ID, "pageSet", true);
  56263. this.duplexImposition = (0, _utils.getStringOption)(attributes.duplexImposition, ["longEdge", "shortEdge"]);
  56264. this.id = attributes.id || "";
  56265. this.name = attributes.name || "";
  56266. this.relation = (0, _utils.getStringOption)(attributes.relation, ["orderedOccurrence", "duplexPaginated", "simplexPaginated"]);
  56267. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  56268. this.use = attributes.use || "";
  56269. this.usehref = attributes.usehref || "";
  56270. this.extras = null;
  56271. this.occur = null;
  56272. this.pageArea = new _xfa_object.XFAObjectArray();
  56273. this.pageSet = new _xfa_object.XFAObjectArray();
  56274. }
  56275. [_xfa_object.$cleanPage]() {
  56276. for (const page of this.pageArea.children) {
  56277. page[_xfa_object.$cleanPage]();
  56278. }
  56279. for (const page of this.pageSet.children) {
  56280. page[_xfa_object.$cleanPage]();
  56281. }
  56282. }
  56283. [_xfa_object.$isUsable]() {
  56284. return !this.occur || this.occur.max === -1 || this[_xfa_object.$extra].numberOfUse < this.occur.max;
  56285. }
  56286. [_xfa_object.$getNextPage]() {
  56287. if (!this[_xfa_object.$extra]) {
  56288. this[_xfa_object.$extra] = {
  56289. numberOfUse: 1,
  56290. pageIndex: -1,
  56291. pageSetIndex: -1
  56292. };
  56293. }
  56294. if (this.relation === "orderedOccurrence") {
  56295. if (this[_xfa_object.$extra].pageIndex + 1 < this.pageArea.children.length) {
  56296. this[_xfa_object.$extra].pageIndex += 1;
  56297. const pageArea = this.pageArea.children[this[_xfa_object.$extra].pageIndex];
  56298. return pageArea[_xfa_object.$getNextPage]();
  56299. }
  56300. if (this[_xfa_object.$extra].pageSetIndex + 1 < this.pageSet.children.length) {
  56301. this[_xfa_object.$extra].pageSetIndex += 1;
  56302. return this.pageSet.children[this[_xfa_object.$extra].pageSetIndex][_xfa_object.$getNextPage]();
  56303. }
  56304. if (this[_xfa_object.$isUsable]()) {
  56305. this[_xfa_object.$extra].numberOfUse += 1;
  56306. this[_xfa_object.$extra].pageIndex = -1;
  56307. this[_xfa_object.$extra].pageSetIndex = -1;
  56308. return this[_xfa_object.$getNextPage]();
  56309. }
  56310. const parent = this[_xfa_object.$getParent]();
  56311. if (parent instanceof PageSet) {
  56312. return parent[_xfa_object.$getNextPage]();
  56313. }
  56314. this[_xfa_object.$cleanPage]();
  56315. return this[_xfa_object.$getNextPage]();
  56316. }
  56317. const pageNumber = this[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].pageNumber;
  56318. const parity = pageNumber % 2 === 0 ? "even" : "odd";
  56319. const position = pageNumber === 0 ? "first" : "rest";
  56320. let page = this.pageArea.children.find(p => p.oddOrEven === parity && p.pagePosition === position);
  56321. if (page) {
  56322. return page;
  56323. }
  56324. page = this.pageArea.children.find(p => p.oddOrEven === "any" && p.pagePosition === position);
  56325. if (page) {
  56326. return page;
  56327. }
  56328. page = this.pageArea.children.find(p => p.oddOrEven === "any" && p.pagePosition === "any");
  56329. if (page) {
  56330. return page;
  56331. }
  56332. return this.pageArea.children[0];
  56333. }
  56334. }
  56335. class Para extends _xfa_object.XFAObject {
  56336. constructor(attributes) {
  56337. super(TEMPLATE_NS_ID, "para", true);
  56338. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  56339. this.id = attributes.id || "";
  56340. this.lineHeight = attributes.lineHeight ? (0, _utils.getMeasurement)(attributes.lineHeight, "0pt") : "";
  56341. this.marginLeft = attributes.marginLeft ? (0, _utils.getMeasurement)(attributes.marginLeft, "0pt") : "";
  56342. this.marginRight = attributes.marginRight ? (0, _utils.getMeasurement)(attributes.marginRight, "0pt") : "";
  56343. this.orphans = (0, _utils.getInteger)({
  56344. data: attributes.orphans,
  56345. defaultValue: 0,
  56346. validate: x => x >= 0
  56347. });
  56348. this.preserve = attributes.preserve || "";
  56349. this.radixOffset = attributes.radixOffset ? (0, _utils.getMeasurement)(attributes.radixOffset, "0pt") : "";
  56350. this.spaceAbove = attributes.spaceAbove ? (0, _utils.getMeasurement)(attributes.spaceAbove, "0pt") : "";
  56351. this.spaceBelow = attributes.spaceBelow ? (0, _utils.getMeasurement)(attributes.spaceBelow, "0pt") : "";
  56352. this.tabDefault = attributes.tabDefault ? (0, _utils.getMeasurement)(this.tabDefault) : "";
  56353. this.tabStops = (attributes.tabStops || "").trim().split(/\s+/).map((x, i) => i % 2 === 1 ? (0, _utils.getMeasurement)(x) : x);
  56354. this.textIndent = attributes.textIndent ? (0, _utils.getMeasurement)(attributes.textIndent, "0pt") : "";
  56355. this.use = attributes.use || "";
  56356. this.usehref = attributes.usehref || "";
  56357. this.vAlign = (0, _utils.getStringOption)(attributes.vAlign, ["top", "bottom", "middle"]);
  56358. this.widows = (0, _utils.getInteger)({
  56359. data: attributes.widows,
  56360. defaultValue: 0,
  56361. validate: x => x >= 0
  56362. });
  56363. this.hyphenation = null;
  56364. }
  56365. [_xfa_object.$toStyle]() {
  56366. const style = (0, _html_utils.toStyle)(this, "hAlign");
  56367. if (this.marginLeft !== "") {
  56368. style.paddingLeft = (0, _html_utils.measureToString)(this.marginLeft);
  56369. }
  56370. if (this.marginRight !== "") {
  56371. style.paddingight = (0, _html_utils.measureToString)(this.marginRight);
  56372. }
  56373. if (this.spaceAbove !== "") {
  56374. style.paddingTop = (0, _html_utils.measureToString)(this.spaceAbove);
  56375. }
  56376. if (this.spaceBelow !== "") {
  56377. style.paddingBottom = (0, _html_utils.measureToString)(this.spaceBelow);
  56378. }
  56379. if (this.textIndent !== "") {
  56380. style.textIndent = (0, _html_utils.measureToString)(this.textIndent);
  56381. (0, _html_utils.fixTextIndent)(style);
  56382. }
  56383. if (this.lineHeight > 0) {
  56384. style.lineHeight = (0, _html_utils.measureToString)(this.lineHeight);
  56385. }
  56386. if (this.tabDefault !== "") {
  56387. style.tabSize = (0, _html_utils.measureToString)(this.tabDefault);
  56388. }
  56389. if (this.tabStops.length > 0) {}
  56390. if (this.hyphenatation) {
  56391. Object.assign(style, this.hyphenatation[_xfa_object.$toStyle]());
  56392. }
  56393. return style;
  56394. }
  56395. }
  56396. class PasswordEdit extends _xfa_object.XFAObject {
  56397. constructor(attributes) {
  56398. super(TEMPLATE_NS_ID, "passwordEdit", true);
  56399. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  56400. this.id = attributes.id || "";
  56401. this.passwordChar = attributes.passwordChar || "*";
  56402. this.use = attributes.use || "";
  56403. this.usehref = attributes.usehref || "";
  56404. this.border = null;
  56405. this.extras = null;
  56406. this.margin = null;
  56407. }
  56408. }
  56409. class Pattern extends _xfa_object.XFAObject {
  56410. constructor(attributes) {
  56411. super(TEMPLATE_NS_ID, "pattern", true);
  56412. this.id = attributes.id || "";
  56413. this.type = (0, _utils.getStringOption)(attributes.type, ["crossHatch", "crossDiagonal", "diagonalLeft", "diagonalRight", "horizontal", "vertical"]);
  56414. this.use = attributes.use || "";
  56415. this.usehref = attributes.usehref || "";
  56416. this.color = null;
  56417. this.extras = null;
  56418. }
  56419. [_xfa_object.$toStyle](startColor) {
  56420. startColor = startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  56421. const endColor = this.color ? this.color[_xfa_object.$toStyle]() : "#000000";
  56422. const width = 5;
  56423. const cmd = "repeating-linear-gradient";
  56424. const colors = `${startColor},${startColor} ${width}px,${endColor} ${width}px,${endColor} ${2 * width}px`;
  56425. switch (this.type) {
  56426. case "crossHatch":
  56427. return `${cmd}(to top,${colors}) ${cmd}(to right,${colors})`;
  56428. case "crossDiagonal":
  56429. return `${cmd}(45deg,${colors}) ${cmd}(-45deg,${colors})`;
  56430. case "diagonalLeft":
  56431. return `${cmd}(45deg,${colors})`;
  56432. case "diagonalRight":
  56433. return `${cmd}(-45deg,${colors})`;
  56434. case "horizontal":
  56435. return `${cmd}(to top,${colors})`;
  56436. case "vertical":
  56437. return `${cmd}(to right,${colors})`;
  56438. }
  56439. return "";
  56440. }
  56441. }
  56442. class Picture extends _xfa_object.StringObject {
  56443. constructor(attributes) {
  56444. super(TEMPLATE_NS_ID, "picture");
  56445. this.id = attributes.id || "";
  56446. this.use = attributes.use || "";
  56447. this.usehref = attributes.usehref || "";
  56448. }
  56449. }
  56450. class Proto extends _xfa_object.XFAObject {
  56451. constructor(attributes) {
  56452. super(TEMPLATE_NS_ID, "proto", true);
  56453. this.appearanceFilter = new _xfa_object.XFAObjectArray();
  56454. this.arc = new _xfa_object.XFAObjectArray();
  56455. this.area = new _xfa_object.XFAObjectArray();
  56456. this.assist = new _xfa_object.XFAObjectArray();
  56457. this.barcode = new _xfa_object.XFAObjectArray();
  56458. this.bindItems = new _xfa_object.XFAObjectArray();
  56459. this.bookend = new _xfa_object.XFAObjectArray();
  56460. this.boolean = new _xfa_object.XFAObjectArray();
  56461. this.border = new _xfa_object.XFAObjectArray();
  56462. this.break = new _xfa_object.XFAObjectArray();
  56463. this.breakAfter = new _xfa_object.XFAObjectArray();
  56464. this.breakBefore = new _xfa_object.XFAObjectArray();
  56465. this.button = new _xfa_object.XFAObjectArray();
  56466. this.calculate = new _xfa_object.XFAObjectArray();
  56467. this.caption = new _xfa_object.XFAObjectArray();
  56468. this.certificate = new _xfa_object.XFAObjectArray();
  56469. this.certificates = new _xfa_object.XFAObjectArray();
  56470. this.checkButton = new _xfa_object.XFAObjectArray();
  56471. this.choiceList = new _xfa_object.XFAObjectArray();
  56472. this.color = new _xfa_object.XFAObjectArray();
  56473. this.comb = new _xfa_object.XFAObjectArray();
  56474. this.connect = new _xfa_object.XFAObjectArray();
  56475. this.contentArea = new _xfa_object.XFAObjectArray();
  56476. this.corner = new _xfa_object.XFAObjectArray();
  56477. this.date = new _xfa_object.XFAObjectArray();
  56478. this.dateTime = new _xfa_object.XFAObjectArray();
  56479. this.dateTimeEdit = new _xfa_object.XFAObjectArray();
  56480. this.decimal = new _xfa_object.XFAObjectArray();
  56481. this.defaultUi = new _xfa_object.XFAObjectArray();
  56482. this.desc = new _xfa_object.XFAObjectArray();
  56483. this.digestMethod = new _xfa_object.XFAObjectArray();
  56484. this.digestMethods = new _xfa_object.XFAObjectArray();
  56485. this.draw = new _xfa_object.XFAObjectArray();
  56486. this.edge = new _xfa_object.XFAObjectArray();
  56487. this.encoding = new _xfa_object.XFAObjectArray();
  56488. this.encodings = new _xfa_object.XFAObjectArray();
  56489. this.encrypt = new _xfa_object.XFAObjectArray();
  56490. this.encryptData = new _xfa_object.XFAObjectArray();
  56491. this.encryption = new _xfa_object.XFAObjectArray();
  56492. this.encryptionMethod = new _xfa_object.XFAObjectArray();
  56493. this.encryptionMethods = new _xfa_object.XFAObjectArray();
  56494. this.event = new _xfa_object.XFAObjectArray();
  56495. this.exData = new _xfa_object.XFAObjectArray();
  56496. this.exObject = new _xfa_object.XFAObjectArray();
  56497. this.exclGroup = new _xfa_object.XFAObjectArray();
  56498. this.execute = new _xfa_object.XFAObjectArray();
  56499. this.extras = new _xfa_object.XFAObjectArray();
  56500. this.field = new _xfa_object.XFAObjectArray();
  56501. this.fill = new _xfa_object.XFAObjectArray();
  56502. this.filter = new _xfa_object.XFAObjectArray();
  56503. this.float = new _xfa_object.XFAObjectArray();
  56504. this.font = new _xfa_object.XFAObjectArray();
  56505. this.format = new _xfa_object.XFAObjectArray();
  56506. this.handler = new _xfa_object.XFAObjectArray();
  56507. this.hyphenation = new _xfa_object.XFAObjectArray();
  56508. this.image = new _xfa_object.XFAObjectArray();
  56509. this.imageEdit = new _xfa_object.XFAObjectArray();
  56510. this.integer = new _xfa_object.XFAObjectArray();
  56511. this.issuers = new _xfa_object.XFAObjectArray();
  56512. this.items = new _xfa_object.XFAObjectArray();
  56513. this.keep = new _xfa_object.XFAObjectArray();
  56514. this.keyUsage = new _xfa_object.XFAObjectArray();
  56515. this.line = new _xfa_object.XFAObjectArray();
  56516. this.linear = new _xfa_object.XFAObjectArray();
  56517. this.lockDocument = new _xfa_object.XFAObjectArray();
  56518. this.manifest = new _xfa_object.XFAObjectArray();
  56519. this.margin = new _xfa_object.XFAObjectArray();
  56520. this.mdp = new _xfa_object.XFAObjectArray();
  56521. this.medium = new _xfa_object.XFAObjectArray();
  56522. this.message = new _xfa_object.XFAObjectArray();
  56523. this.numericEdit = new _xfa_object.XFAObjectArray();
  56524. this.occur = new _xfa_object.XFAObjectArray();
  56525. this.oid = new _xfa_object.XFAObjectArray();
  56526. this.oids = new _xfa_object.XFAObjectArray();
  56527. this.overflow = new _xfa_object.XFAObjectArray();
  56528. this.pageArea = new _xfa_object.XFAObjectArray();
  56529. this.pageSet = new _xfa_object.XFAObjectArray();
  56530. this.para = new _xfa_object.XFAObjectArray();
  56531. this.passwordEdit = new _xfa_object.XFAObjectArray();
  56532. this.pattern = new _xfa_object.XFAObjectArray();
  56533. this.picture = new _xfa_object.XFAObjectArray();
  56534. this.radial = new _xfa_object.XFAObjectArray();
  56535. this.reason = new _xfa_object.XFAObjectArray();
  56536. this.reasons = new _xfa_object.XFAObjectArray();
  56537. this.rectangle = new _xfa_object.XFAObjectArray();
  56538. this.ref = new _xfa_object.XFAObjectArray();
  56539. this.script = new _xfa_object.XFAObjectArray();
  56540. this.setProperty = new _xfa_object.XFAObjectArray();
  56541. this.signData = new _xfa_object.XFAObjectArray();
  56542. this.signature = new _xfa_object.XFAObjectArray();
  56543. this.signing = new _xfa_object.XFAObjectArray();
  56544. this.solid = new _xfa_object.XFAObjectArray();
  56545. this.speak = new _xfa_object.XFAObjectArray();
  56546. this.stipple = new _xfa_object.XFAObjectArray();
  56547. this.subform = new _xfa_object.XFAObjectArray();
  56548. this.subformSet = new _xfa_object.XFAObjectArray();
  56549. this.subjectDN = new _xfa_object.XFAObjectArray();
  56550. this.subjectDNs = new _xfa_object.XFAObjectArray();
  56551. this.submit = new _xfa_object.XFAObjectArray();
  56552. this.text = new _xfa_object.XFAObjectArray();
  56553. this.textEdit = new _xfa_object.XFAObjectArray();
  56554. this.time = new _xfa_object.XFAObjectArray();
  56555. this.timeStamp = new _xfa_object.XFAObjectArray();
  56556. this.toolTip = new _xfa_object.XFAObjectArray();
  56557. this.traversal = new _xfa_object.XFAObjectArray();
  56558. this.traverse = new _xfa_object.XFAObjectArray();
  56559. this.ui = new _xfa_object.XFAObjectArray();
  56560. this.validate = new _xfa_object.XFAObjectArray();
  56561. this.value = new _xfa_object.XFAObjectArray();
  56562. this.variables = new _xfa_object.XFAObjectArray();
  56563. }
  56564. }
  56565. class Radial extends _xfa_object.XFAObject {
  56566. constructor(attributes) {
  56567. super(TEMPLATE_NS_ID, "radial", true);
  56568. this.id = attributes.id || "";
  56569. this.type = (0, _utils.getStringOption)(attributes.type, ["toEdge", "toCenter"]);
  56570. this.use = attributes.use || "";
  56571. this.usehref = attributes.usehref || "";
  56572. this.color = null;
  56573. this.extras = null;
  56574. }
  56575. [_xfa_object.$toStyle](startColor) {
  56576. startColor = startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  56577. const endColor = this.color ? this.color[_xfa_object.$toStyle]() : "#000000";
  56578. const colors = this.type === "toEdge" ? `${startColor},${endColor}` : `${endColor},${startColor}`;
  56579. return `radial-gradient(circle at center, ${colors})`;
  56580. }
  56581. }
  56582. class Reason extends _xfa_object.StringObject {
  56583. constructor(attributes) {
  56584. super(TEMPLATE_NS_ID, "reason");
  56585. this.id = attributes.id || "";
  56586. this.name = attributes.name || "";
  56587. this.use = attributes.use || "";
  56588. this.usehref = attributes.usehref || "";
  56589. }
  56590. }
  56591. class Reasons extends _xfa_object.XFAObject {
  56592. constructor(attributes) {
  56593. super(TEMPLATE_NS_ID, "reasons", true);
  56594. this.id = attributes.id || "";
  56595. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  56596. this.use = attributes.use || "";
  56597. this.usehref = attributes.usehref || "";
  56598. this.reason = new _xfa_object.XFAObjectArray();
  56599. }
  56600. }
  56601. class Rectangle extends _xfa_object.XFAObject {
  56602. constructor(attributes) {
  56603. super(TEMPLATE_NS_ID, "rectangle", true);
  56604. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  56605. this.id = attributes.id || "";
  56606. this.use = attributes.use || "";
  56607. this.usehref = attributes.usehref || "";
  56608. this.corner = new _xfa_object.XFAObjectArray(4);
  56609. this.edge = new _xfa_object.XFAObjectArray(4);
  56610. this.fill = null;
  56611. }
  56612. [_xfa_object.$toHTML]() {
  56613. const edge = this.edge.children.length ? this.edge.children[0] : new Edge({});
  56614. const edgeStyle = edge[_xfa_object.$toStyle]();
  56615. const style = Object.create(null);
  56616. if (this.fill && this.fill.presence === "visible") {
  56617. Object.assign(style, this.fill[_xfa_object.$toStyle]());
  56618. } else {
  56619. style.fill = "transparent";
  56620. }
  56621. style.strokeWidth = (0, _html_utils.measureToString)(edge.presence === "visible" ? edge.thickness : 0);
  56622. style.stroke = edgeStyle.color;
  56623. const corner = this.corner.children.length ? this.corner.children[0] : new Corner({});
  56624. const cornerStyle = corner[_xfa_object.$toStyle]();
  56625. const rect = {
  56626. name: "rect",
  56627. attributes: {
  56628. xmlns: SVG_NS,
  56629. width: "100%",
  56630. height: "100%",
  56631. x: 0,
  56632. y: 0,
  56633. rx: cornerStyle.radius,
  56634. ry: cornerStyle.radius,
  56635. style
  56636. }
  56637. };
  56638. const svg = {
  56639. name: "svg",
  56640. children: [rect],
  56641. attributes: {
  56642. xmlns: SVG_NS,
  56643. style: {
  56644. overflow: "visible"
  56645. },
  56646. width: "100%",
  56647. height: "100%"
  56648. }
  56649. };
  56650. const parent = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  56651. if (hasMargin(parent)) {
  56652. return _utils.HTMLResult.success({
  56653. name: "div",
  56654. attributes: {
  56655. style: {
  56656. display: "inline",
  56657. width: "100%",
  56658. height: "100%"
  56659. }
  56660. },
  56661. children: [svg]
  56662. });
  56663. }
  56664. svg.attributes.style.position = "absolute";
  56665. return _utils.HTMLResult.success(svg);
  56666. }
  56667. }
  56668. class RefElement extends _xfa_object.StringObject {
  56669. constructor(attributes) {
  56670. super(TEMPLATE_NS_ID, "ref");
  56671. this.id = attributes.id || "";
  56672. this.use = attributes.use || "";
  56673. this.usehref = attributes.usehref || "";
  56674. }
  56675. }
  56676. class Script extends _xfa_object.StringObject {
  56677. constructor(attributes) {
  56678. super(TEMPLATE_NS_ID, "script");
  56679. this.binding = attributes.binding || "";
  56680. this.contentType = attributes.contentType || "";
  56681. this.id = attributes.id || "";
  56682. this.name = attributes.name || "";
  56683. this.runAt = (0, _utils.getStringOption)(attributes.runAt, ["client", "both", "server"]);
  56684. this.use = attributes.use || "";
  56685. this.usehref = attributes.usehref || "";
  56686. }
  56687. }
  56688. class SetProperty extends _xfa_object.XFAObject {
  56689. constructor(attributes) {
  56690. super(TEMPLATE_NS_ID, "setProperty");
  56691. this.connection = attributes.connection || "";
  56692. this.ref = attributes.ref || "";
  56693. this.target = attributes.target || "";
  56694. }
  56695. }
  56696. exports.SetProperty = SetProperty;
  56697. class SignData extends _xfa_object.XFAObject {
  56698. constructor(attributes) {
  56699. super(TEMPLATE_NS_ID, "signData", true);
  56700. this.id = attributes.id || "";
  56701. this.operation = (0, _utils.getStringOption)(attributes.operation, ["sign", "clear", "verify"]);
  56702. this.ref = attributes.ref || "";
  56703. this.target = attributes.target || "";
  56704. this.use = attributes.use || "";
  56705. this.usehref = attributes.usehref || "";
  56706. this.filter = null;
  56707. this.manifest = null;
  56708. }
  56709. }
  56710. class Signature extends _xfa_object.XFAObject {
  56711. constructor(attributes) {
  56712. super(TEMPLATE_NS_ID, "signature", true);
  56713. this.id = attributes.id || "";
  56714. this.type = (0, _utils.getStringOption)(attributes.type, ["PDF1.3", "PDF1.6"]);
  56715. this.use = attributes.use || "";
  56716. this.usehref = attributes.usehref || "";
  56717. this.border = null;
  56718. this.extras = null;
  56719. this.filter = null;
  56720. this.manifest = null;
  56721. this.margin = null;
  56722. }
  56723. }
  56724. class Signing extends _xfa_object.XFAObject {
  56725. constructor(attributes) {
  56726. super(TEMPLATE_NS_ID, "signing", true);
  56727. this.id = attributes.id || "";
  56728. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  56729. this.use = attributes.use || "";
  56730. this.usehref = attributes.usehref || "";
  56731. this.certificate = new _xfa_object.XFAObjectArray();
  56732. }
  56733. }
  56734. class Solid extends _xfa_object.XFAObject {
  56735. constructor(attributes) {
  56736. super(TEMPLATE_NS_ID, "solid", true);
  56737. this.id = attributes.id || "";
  56738. this.use = attributes.use || "";
  56739. this.usehref = attributes.usehref || "";
  56740. this.extras = null;
  56741. }
  56742. [_xfa_object.$toStyle](startColor) {
  56743. return startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  56744. }
  56745. }
  56746. class Speak extends _xfa_object.StringObject {
  56747. constructor(attributes) {
  56748. super(TEMPLATE_NS_ID, "speak");
  56749. this.disable = (0, _utils.getInteger)({
  56750. data: attributes.disable,
  56751. defaultValue: 0,
  56752. validate: x => x === 1
  56753. });
  56754. this.id = attributes.id || "";
  56755. this.priority = (0, _utils.getStringOption)(attributes.priority, ["custom", "caption", "name", "toolTip"]);
  56756. this.rid = attributes.rid || "";
  56757. this.use = attributes.use || "";
  56758. this.usehref = attributes.usehref || "";
  56759. }
  56760. }
  56761. class Stipple extends _xfa_object.XFAObject {
  56762. constructor(attributes) {
  56763. super(TEMPLATE_NS_ID, "stipple", true);
  56764. this.id = attributes.id || "";
  56765. this.rate = (0, _utils.getInteger)({
  56766. data: attributes.rate,
  56767. defaultValue: 50,
  56768. validate: x => x >= 0 && x <= 100
  56769. });
  56770. this.use = attributes.use || "";
  56771. this.usehref = attributes.usehref || "";
  56772. this.color = null;
  56773. this.extras = null;
  56774. }
  56775. [_xfa_object.$toStyle](bgColor) {
  56776. const alpha = this.rate / 100;
  56777. 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));
  56778. }
  56779. }
  56780. class Subform extends _xfa_object.XFAObject {
  56781. constructor(attributes) {
  56782. super(TEMPLATE_NS_ID, "subform", true);
  56783. this.access = (0, _utils.getStringOption)(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]);
  56784. this.allowMacro = (0, _utils.getInteger)({
  56785. data: attributes.allowMacro,
  56786. defaultValue: 0,
  56787. validate: x => x === 1
  56788. });
  56789. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  56790. this.colSpan = (0, _utils.getInteger)({
  56791. data: attributes.colSpan,
  56792. defaultValue: 1,
  56793. validate: n => n >= 1 || n === -1
  56794. });
  56795. this.columnWidths = (attributes.columnWidths || "").trim().split(/\s+/).map(x => x === "-1" ? -1 : (0, _utils.getMeasurement)(x));
  56796. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  56797. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  56798. this.id = attributes.id || "";
  56799. this.layout = (0, _utils.getStringOption)(attributes.layout, ["position", "lr-tb", "rl-row", "rl-tb", "row", "table", "tb"]);
  56800. this.locale = attributes.locale || "";
  56801. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  56802. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  56803. this.mergeMode = (0, _utils.getStringOption)(attributes.mergeMode, ["consumeData", "matchTemplate"]);
  56804. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  56805. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  56806. this.name = attributes.name || "";
  56807. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  56808. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  56809. this.restoreState = (0, _utils.getStringOption)(attributes.restoreState, ["manual", "auto"]);
  56810. this.scope = (0, _utils.getStringOption)(attributes.scope, ["name", "none"]);
  56811. this.use = attributes.use || "";
  56812. this.usehref = attributes.usehref || "";
  56813. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  56814. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  56815. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  56816. this.assist = null;
  56817. this.bind = null;
  56818. this.bookend = null;
  56819. this.border = null;
  56820. this.break = null;
  56821. this.calculate = null;
  56822. this.desc = null;
  56823. this.extras = null;
  56824. this.keep = null;
  56825. this.margin = null;
  56826. this.occur = null;
  56827. this.overflow = null;
  56828. this.pageSet = null;
  56829. this.para = null;
  56830. this.traversal = null;
  56831. this.validate = null;
  56832. this.variables = null;
  56833. this.area = new _xfa_object.XFAObjectArray();
  56834. this.breakAfter = new _xfa_object.XFAObjectArray();
  56835. this.breakBefore = new _xfa_object.XFAObjectArray();
  56836. this.connect = new _xfa_object.XFAObjectArray();
  56837. this.draw = new _xfa_object.XFAObjectArray();
  56838. this.event = new _xfa_object.XFAObjectArray();
  56839. this.exObject = new _xfa_object.XFAObjectArray();
  56840. this.exclGroup = new _xfa_object.XFAObjectArray();
  56841. this.field = new _xfa_object.XFAObjectArray();
  56842. this.proto = new _xfa_object.XFAObjectArray();
  56843. this.setProperty = new _xfa_object.XFAObjectArray();
  56844. this.subform = new _xfa_object.XFAObjectArray();
  56845. this.subformSet = new _xfa_object.XFAObjectArray();
  56846. }
  56847. [_xfa_object.$getSubformParent]() {
  56848. const parent = this[_xfa_object.$getParent]();
  56849. if (parent instanceof SubformSet) {
  56850. return parent[_xfa_object.$getSubformParent]();
  56851. }
  56852. return parent;
  56853. }
  56854. [_xfa_object.$isBindable]() {
  56855. return true;
  56856. }
  56857. [_xfa_object.$isThereMoreWidth]() {
  56858. return this.layout.endsWith("-tb") && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine > 0 || this[_xfa_object.$getParent]()[_xfa_object.$isThereMoreWidth]();
  56859. }
  56860. *[_xfa_object.$getContainedChildren]() {
  56861. yield* getContainedChildren(this);
  56862. }
  56863. [_xfa_object.$flushHTML]() {
  56864. return (0, _layout.flushHTML)(this);
  56865. }
  56866. [_xfa_object.$addHTML](html, bbox) {
  56867. (0, _layout.addHTML)(this, html, bbox);
  56868. }
  56869. [_xfa_object.$getAvailableSpace]() {
  56870. return (0, _layout.getAvailableSpace)(this);
  56871. }
  56872. [_xfa_object.$isSplittable]() {
  56873. const parent = this[_xfa_object.$getSubformParent]();
  56874. if (!parent[_xfa_object.$isSplittable]()) {
  56875. return false;
  56876. }
  56877. if (this[_xfa_object.$extra]._isSplittable !== undefined) {
  56878. return this[_xfa_object.$extra]._isSplittable;
  56879. }
  56880. if (this.layout === "position" || this.layout.includes("row")) {
  56881. this[_xfa_object.$extra]._isSplittable = false;
  56882. return false;
  56883. }
  56884. if (this.keep && this.keep.intact !== "none") {
  56885. this[_xfa_object.$extra]._isSplittable = false;
  56886. return false;
  56887. }
  56888. if (parent.layout && parent.layout.endsWith("-tb") && parent[_xfa_object.$extra].numberInLine !== 0) {
  56889. return false;
  56890. }
  56891. this[_xfa_object.$extra]._isSplittable = true;
  56892. return true;
  56893. }
  56894. [_xfa_object.$toHTML](availableSpace) {
  56895. setTabIndex(this);
  56896. if (this.break) {
  56897. if (this.break.after !== "auto" || this.break.afterTarget !== "") {
  56898. const node = new BreakAfter({
  56899. targetType: this.break.after,
  56900. target: this.break.afterTarget,
  56901. startNew: this.break.startNew.toString()
  56902. });
  56903. node[_xfa_object.$globalData] = this[_xfa_object.$globalData];
  56904. this[_xfa_object.$appendChild](node);
  56905. this.breakAfter.push(node);
  56906. }
  56907. if (this.break.before !== "auto" || this.break.beforeTarget !== "") {
  56908. const node = new BreakBefore({
  56909. targetType: this.break.before,
  56910. target: this.break.beforeTarget,
  56911. startNew: this.break.startNew.toString()
  56912. });
  56913. node[_xfa_object.$globalData] = this[_xfa_object.$globalData];
  56914. this[_xfa_object.$appendChild](node);
  56915. this.breakBefore.push(node);
  56916. }
  56917. if (this.break.overflowTarget !== "") {
  56918. const node = new Overflow({
  56919. target: this.break.overflowTarget,
  56920. leader: this.break.overflowLeader,
  56921. trailer: this.break.overflowTrailer
  56922. });
  56923. node[_xfa_object.$globalData] = this[_xfa_object.$globalData];
  56924. this[_xfa_object.$appendChild](node);
  56925. this.overflow.push(node);
  56926. }
  56927. this[_xfa_object.$removeChild](this.break);
  56928. this.break = null;
  56929. }
  56930. if (this.presence === "hidden" || this.presence === "inactive") {
  56931. return _utils.HTMLResult.EMPTY;
  56932. }
  56933. if (this.breakBefore.children.length > 1 || this.breakAfter.children.length > 1) {
  56934. (0, _util.warn)("XFA - Several breakBefore or breakAfter in subforms: please file a bug.");
  56935. }
  56936. if (this.breakBefore.children.length >= 1) {
  56937. const breakBefore = this.breakBefore.children[0];
  56938. if (handleBreak(breakBefore)) {
  56939. return _utils.HTMLResult.breakNode(breakBefore);
  56940. }
  56941. }
  56942. if (this[_xfa_object.$extra] && this[_xfa_object.$extra].afterBreakAfter) {
  56943. return _utils.HTMLResult.EMPTY;
  56944. }
  56945. (0, _html_utils.fixDimensions)(this);
  56946. const children = [];
  56947. const attributes = {
  56948. id: this[_xfa_object.$uid],
  56949. class: []
  56950. };
  56951. (0, _html_utils.setAccess)(this, attributes.class);
  56952. if (!this[_xfa_object.$extra]) {
  56953. this[_xfa_object.$extra] = Object.create(null);
  56954. }
  56955. Object.assign(this[_xfa_object.$extra], {
  56956. children,
  56957. line: null,
  56958. attributes,
  56959. attempt: 0,
  56960. numberInLine: 0,
  56961. availableSpace: {
  56962. width: Math.min(this.w || Infinity, availableSpace.width),
  56963. height: Math.min(this.h || Infinity, availableSpace.height)
  56964. },
  56965. width: 0,
  56966. height: 0,
  56967. prevHeight: 0,
  56968. currentWidth: 0
  56969. });
  56970. const root = this[_xfa_object.$getTemplateRoot]();
  56971. const savedNoLayoutFailure = root[_xfa_object.$extra].noLayoutFailure;
  56972. const isSplittable = this[_xfa_object.$isSplittable]();
  56973. if (!isSplittable) {
  56974. setFirstUnsplittable(this);
  56975. }
  56976. if (!(0, _layout.checkDimensions)(this, availableSpace)) {
  56977. return _utils.HTMLResult.FAILURE;
  56978. }
  56979. const filter = new Set(["area", "draw", "exclGroup", "field", "subform", "subformSet"]);
  56980. if (this.layout.includes("row")) {
  56981. const columnWidths = this[_xfa_object.$getSubformParent]().columnWidths;
  56982. if (Array.isArray(columnWidths) && columnWidths.length > 0) {
  56983. this[_xfa_object.$extra].columnWidths = columnWidths;
  56984. this[_xfa_object.$extra].currentColumn = 0;
  56985. }
  56986. }
  56987. const style = (0, _html_utils.toStyle)(this, "anchorType", "dimensions", "position", "presence", "border", "margin", "hAlign");
  56988. const classNames = ["xfaSubform"];
  56989. const cl = (0, _html_utils.layoutClass)(this);
  56990. if (cl) {
  56991. classNames.push(cl);
  56992. }
  56993. attributes.style = style;
  56994. attributes.class = classNames;
  56995. if (this.name) {
  56996. attributes.xfaName = this.name;
  56997. }
  56998. if (this.overflow) {
  56999. const overflowExtra = this.overflow[_xfa_object.$getExtra]();
  57000. if (overflowExtra.addLeader) {
  57001. overflowExtra.addLeader = false;
  57002. handleOverflow(this, overflowExtra.leader, availableSpace);
  57003. }
  57004. }
  57005. this[_xfa_object.$pushPara]();
  57006. const isLrTb = this.layout === "lr-tb" || this.layout === "rl-tb";
  57007. const maxRun = isLrTb ? MAX_ATTEMPTS_FOR_LRTB_LAYOUT : 1;
  57008. for (; this[_xfa_object.$extra].attempt < maxRun; this[_xfa_object.$extra].attempt++) {
  57009. if (isLrTb && this[_xfa_object.$extra].attempt === MAX_ATTEMPTS_FOR_LRTB_LAYOUT - 1) {
  57010. this[_xfa_object.$extra].numberInLine = 0;
  57011. }
  57012. const result = this[_xfa_object.$childrenToHTML]({
  57013. filter,
  57014. include: true
  57015. });
  57016. if (result.success) {
  57017. break;
  57018. }
  57019. if (result.isBreak()) {
  57020. this[_xfa_object.$popPara]();
  57021. return result;
  57022. }
  57023. if (isLrTb && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine === 0 && !root[_xfa_object.$extra].noLayoutFailure) {
  57024. this[_xfa_object.$extra].attempt = maxRun;
  57025. break;
  57026. }
  57027. }
  57028. this[_xfa_object.$popPara]();
  57029. if (!isSplittable) {
  57030. unsetFirstUnsplittable(this);
  57031. }
  57032. root[_xfa_object.$extra].noLayoutFailure = savedNoLayoutFailure;
  57033. if (this[_xfa_object.$extra].attempt === maxRun) {
  57034. if (this.overflow) {
  57035. this[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].overflowNode = this.overflow;
  57036. }
  57037. if (!isSplittable) {
  57038. delete this[_xfa_object.$extra];
  57039. }
  57040. return _utils.HTMLResult.FAILURE;
  57041. }
  57042. if (this.overflow) {
  57043. const overflowExtra = this.overflow[_xfa_object.$getExtra]();
  57044. if (overflowExtra.addTrailer) {
  57045. overflowExtra.addTrailer = false;
  57046. handleOverflow(this, overflowExtra.trailer, availableSpace);
  57047. }
  57048. }
  57049. let marginH = 0;
  57050. let marginV = 0;
  57051. if (this.margin) {
  57052. marginH = this.margin.leftInset + this.margin.rightInset;
  57053. marginV = this.margin.topInset + this.margin.bottomInset;
  57054. }
  57055. const width = Math.max(this[_xfa_object.$extra].width + marginH, this.w || 0);
  57056. const height = Math.max(this[_xfa_object.$extra].height + marginV, this.h || 0);
  57057. const bbox = [this.x, this.y, width, height];
  57058. if (this.w === "") {
  57059. style.width = (0, _html_utils.measureToString)(width);
  57060. }
  57061. if (this.h === "") {
  57062. style.height = (0, _html_utils.measureToString)(height);
  57063. }
  57064. if ((style.width === "0px" || style.height === "0px") && children.length === 0) {
  57065. return _utils.HTMLResult.EMPTY;
  57066. }
  57067. const html = {
  57068. name: "div",
  57069. attributes,
  57070. children
  57071. };
  57072. applyAssist(this, attributes);
  57073. const result = _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  57074. if (this.breakAfter.children.length >= 1) {
  57075. const breakAfter = this.breakAfter.children[0];
  57076. if (handleBreak(breakAfter)) {
  57077. this[_xfa_object.$extra].afterBreakAfter = result;
  57078. return _utils.HTMLResult.breakNode(breakAfter);
  57079. }
  57080. }
  57081. delete this[_xfa_object.$extra];
  57082. return result;
  57083. }
  57084. }
  57085. class SubformSet extends _xfa_object.XFAObject {
  57086. constructor(attributes) {
  57087. super(TEMPLATE_NS_ID, "subformSet", true);
  57088. this.id = attributes.id || "";
  57089. this.name = attributes.name || "";
  57090. this.relation = (0, _utils.getStringOption)(attributes.relation, ["ordered", "choice", "unordered"]);
  57091. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  57092. this.use = attributes.use || "";
  57093. this.usehref = attributes.usehref || "";
  57094. this.bookend = null;
  57095. this.break = null;
  57096. this.desc = null;
  57097. this.extras = null;
  57098. this.occur = null;
  57099. this.overflow = null;
  57100. this.breakAfter = new _xfa_object.XFAObjectArray();
  57101. this.breakBefore = new _xfa_object.XFAObjectArray();
  57102. this.subform = new _xfa_object.XFAObjectArray();
  57103. this.subformSet = new _xfa_object.XFAObjectArray();
  57104. }
  57105. *[_xfa_object.$getContainedChildren]() {
  57106. yield* getContainedChildren(this);
  57107. }
  57108. [_xfa_object.$getSubformParent]() {
  57109. let parent = this[_xfa_object.$getParent]();
  57110. while (!(parent instanceof Subform)) {
  57111. parent = parent[_xfa_object.$getParent]();
  57112. }
  57113. return parent;
  57114. }
  57115. [_xfa_object.$isBindable]() {
  57116. return true;
  57117. }
  57118. }
  57119. class SubjectDN extends _xfa_object.ContentObject {
  57120. constructor(attributes) {
  57121. super(TEMPLATE_NS_ID, "subjectDN");
  57122. this.delimiter = attributes.delimiter || ",";
  57123. this.id = attributes.id || "";
  57124. this.name = attributes.name || "";
  57125. this.use = attributes.use || "";
  57126. this.usehref = attributes.usehref || "";
  57127. }
  57128. [_xfa_object.$finalize]() {
  57129. this[_xfa_object.$content] = new Map(this[_xfa_object.$content].split(this.delimiter).map(kv => {
  57130. kv = kv.split("=", 2);
  57131. kv[0] = kv[0].trim();
  57132. return kv;
  57133. }));
  57134. }
  57135. }
  57136. class SubjectDNs extends _xfa_object.XFAObject {
  57137. constructor(attributes) {
  57138. super(TEMPLATE_NS_ID, "subjectDNs", true);
  57139. this.id = attributes.id || "";
  57140. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  57141. this.use = attributes.use || "";
  57142. this.usehref = attributes.usehref || "";
  57143. this.subjectDN = new _xfa_object.XFAObjectArray();
  57144. }
  57145. }
  57146. class Submit extends _xfa_object.XFAObject {
  57147. constructor(attributes) {
  57148. super(TEMPLATE_NS_ID, "submit", true);
  57149. this.embedPDF = (0, _utils.getInteger)({
  57150. data: attributes.embedPDF,
  57151. defaultValue: 0,
  57152. validate: x => x === 1
  57153. });
  57154. this.format = (0, _utils.getStringOption)(attributes.format, ["xdp", "formdata", "pdf", "urlencoded", "xfd", "xml"]);
  57155. this.id = attributes.id || "";
  57156. this.target = attributes.target || "";
  57157. this.textEncoding = (0, _utils.getKeyword)({
  57158. data: attributes.textEncoding ? attributes.textEncoding.toLowerCase() : "",
  57159. defaultValue: "",
  57160. 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}/)
  57161. });
  57162. this.use = attributes.use || "";
  57163. this.usehref = attributes.usehref || "";
  57164. this.xdpContent = attributes.xdpContent || "";
  57165. this.encrypt = null;
  57166. this.encryptData = new _xfa_object.XFAObjectArray();
  57167. this.signData = new _xfa_object.XFAObjectArray();
  57168. }
  57169. }
  57170. class Template extends _xfa_object.XFAObject {
  57171. constructor(attributes) {
  57172. super(TEMPLATE_NS_ID, "template", true);
  57173. this.baseProfile = (0, _utils.getStringOption)(attributes.baseProfile, ["full", "interactiveForms"]);
  57174. this.extras = null;
  57175. this.subform = new _xfa_object.XFAObjectArray();
  57176. }
  57177. [_xfa_object.$finalize]() {
  57178. if (this.subform.children.length === 0) {
  57179. (0, _util.warn)("XFA - No subforms in template node.");
  57180. }
  57181. if (this.subform.children.length >= 2) {
  57182. (0, _util.warn)("XFA - Several subforms in template node: please file a bug.");
  57183. }
  57184. this[_xfa_object.$tabIndex] = DEFAULT_TAB_INDEX;
  57185. }
  57186. [_xfa_object.$isSplittable]() {
  57187. return true;
  57188. }
  57189. [_xfa_object.$searchNode](expr, container) {
  57190. if (expr.startsWith("#")) {
  57191. return [this[_xfa_object.$ids].get(expr.slice(1))];
  57192. }
  57193. return (0, _som.searchNode)(this, container, expr, true, true);
  57194. }
  57195. *[_xfa_object.$toPages]() {
  57196. if (!this.subform.children.length) {
  57197. return _utils.HTMLResult.success({
  57198. name: "div",
  57199. children: []
  57200. });
  57201. }
  57202. this[_xfa_object.$extra] = {
  57203. overflowNode: null,
  57204. firstUnsplittable: null,
  57205. currentContentArea: null,
  57206. currentPageArea: null,
  57207. noLayoutFailure: false,
  57208. pageNumber: 1,
  57209. pagePosition: "first",
  57210. oddOrEven: "odd",
  57211. blankOrNotBlank: "nonBlank",
  57212. paraStack: []
  57213. };
  57214. const root = this.subform.children[0];
  57215. root.pageSet[_xfa_object.$cleanPage]();
  57216. const pageAreas = root.pageSet.pageArea.children;
  57217. const mainHtml = {
  57218. name: "div",
  57219. children: []
  57220. };
  57221. let pageArea = null;
  57222. let breakBefore = null;
  57223. let breakBeforeTarget = null;
  57224. if (root.breakBefore.children.length >= 1) {
  57225. breakBefore = root.breakBefore.children[0];
  57226. breakBeforeTarget = breakBefore.target;
  57227. } else if (root.subform.children.length >= 1 && root.subform.children[0].breakBefore.children.length >= 1) {
  57228. breakBefore = root.subform.children[0].breakBefore.children[0];
  57229. breakBeforeTarget = breakBefore.target;
  57230. } else if (root.break && root.break.beforeTarget) {
  57231. breakBefore = root.break;
  57232. breakBeforeTarget = breakBefore.beforeTarget;
  57233. } else if (root.subform.children.length >= 1 && root.subform.children[0].break && root.subform.children[0].break.beforeTarget) {
  57234. breakBefore = root.subform.children[0].break;
  57235. breakBeforeTarget = breakBefore.beforeTarget;
  57236. }
  57237. if (breakBefore) {
  57238. const target = this[_xfa_object.$searchNode](breakBeforeTarget, breakBefore[_xfa_object.$getParent]());
  57239. if (target instanceof PageArea) {
  57240. pageArea = target;
  57241. breakBefore[_xfa_object.$extra] = {};
  57242. }
  57243. }
  57244. if (!pageArea) {
  57245. pageArea = pageAreas[0];
  57246. }
  57247. pageArea[_xfa_object.$extra] = {
  57248. numberOfUse: 1
  57249. };
  57250. const pageAreaParent = pageArea[_xfa_object.$getParent]();
  57251. pageAreaParent[_xfa_object.$extra] = {
  57252. numberOfUse: 1,
  57253. pageIndex: pageAreaParent.pageArea.children.indexOf(pageArea),
  57254. pageSetIndex: 0
  57255. };
  57256. let targetPageArea;
  57257. let leader = null;
  57258. let trailer = null;
  57259. let hasSomething = true;
  57260. let hasSomethingCounter = 0;
  57261. let startIndex = 0;
  57262. while (true) {
  57263. if (!hasSomething) {
  57264. mainHtml.children.pop();
  57265. if (++hasSomethingCounter === MAX_EMPTY_PAGES) {
  57266. (0, _util.warn)("XFA - Something goes wrong: please file a bug.");
  57267. return mainHtml;
  57268. }
  57269. } else {
  57270. hasSomethingCounter = 0;
  57271. }
  57272. targetPageArea = null;
  57273. this[_xfa_object.$extra].currentPageArea = pageArea;
  57274. const page = pageArea[_xfa_object.$toHTML]().html;
  57275. mainHtml.children.push(page);
  57276. if (leader) {
  57277. this[_xfa_object.$extra].noLayoutFailure = true;
  57278. page.children.push(leader[_xfa_object.$toHTML](pageArea[_xfa_object.$extra].space).html);
  57279. leader = null;
  57280. }
  57281. if (trailer) {
  57282. this[_xfa_object.$extra].noLayoutFailure = true;
  57283. page.children.push(trailer[_xfa_object.$toHTML](pageArea[_xfa_object.$extra].space).html);
  57284. trailer = null;
  57285. }
  57286. const contentAreas = pageArea.contentArea.children;
  57287. const htmlContentAreas = page.children.filter(node => node.attributes.class.includes("xfaContentarea"));
  57288. hasSomething = false;
  57289. this[_xfa_object.$extra].firstUnsplittable = null;
  57290. this[_xfa_object.$extra].noLayoutFailure = false;
  57291. const flush = index => {
  57292. const html = root[_xfa_object.$flushHTML]();
  57293. if (html) {
  57294. hasSomething = hasSomething || html.children && html.children.length !== 0;
  57295. htmlContentAreas[index].children.push(html);
  57296. }
  57297. };
  57298. for (let i = startIndex, ii = contentAreas.length; i < ii; i++) {
  57299. const contentArea = this[_xfa_object.$extra].currentContentArea = contentAreas[i];
  57300. const space = {
  57301. width: contentArea.w,
  57302. height: contentArea.h
  57303. };
  57304. startIndex = 0;
  57305. if (leader) {
  57306. htmlContentAreas[i].children.push(leader[_xfa_object.$toHTML](space).html);
  57307. leader = null;
  57308. }
  57309. if (trailer) {
  57310. htmlContentAreas[i].children.push(trailer[_xfa_object.$toHTML](space).html);
  57311. trailer = null;
  57312. }
  57313. const html = root[_xfa_object.$toHTML](space);
  57314. if (html.success) {
  57315. if (html.html) {
  57316. hasSomething = hasSomething || html.html.children && html.html.children.length !== 0;
  57317. htmlContentAreas[i].children.push(html.html);
  57318. } else if (!hasSomething && mainHtml.children.length > 1) {
  57319. mainHtml.children.pop();
  57320. }
  57321. return mainHtml;
  57322. }
  57323. if (html.isBreak()) {
  57324. const node = html.breakNode;
  57325. flush(i);
  57326. if (node.targetType === "auto") {
  57327. continue;
  57328. }
  57329. if (node.leader) {
  57330. leader = this[_xfa_object.$searchNode](node.leader, node[_xfa_object.$getParent]());
  57331. leader = leader ? leader[0] : null;
  57332. }
  57333. if (node.trailer) {
  57334. trailer = this[_xfa_object.$searchNode](node.trailer, node[_xfa_object.$getParent]());
  57335. trailer = trailer ? trailer[0] : null;
  57336. }
  57337. if (node.targetType === "pageArea") {
  57338. targetPageArea = node[_xfa_object.$extra].target;
  57339. i = Infinity;
  57340. } else if (!node[_xfa_object.$extra].target) {
  57341. i = node[_xfa_object.$extra].index;
  57342. } else {
  57343. targetPageArea = node[_xfa_object.$extra].target;
  57344. startIndex = node[_xfa_object.$extra].index + 1;
  57345. i = Infinity;
  57346. }
  57347. continue;
  57348. }
  57349. if (this[_xfa_object.$extra].overflowNode) {
  57350. const node = this[_xfa_object.$extra].overflowNode;
  57351. this[_xfa_object.$extra].overflowNode = null;
  57352. const overflowExtra = node[_xfa_object.$getExtra]();
  57353. const target = overflowExtra.target;
  57354. overflowExtra.addLeader = overflowExtra.leader !== null;
  57355. overflowExtra.addTrailer = overflowExtra.trailer !== null;
  57356. flush(i);
  57357. const currentIndex = i;
  57358. i = Infinity;
  57359. if (target instanceof PageArea) {
  57360. targetPageArea = target;
  57361. } else if (target instanceof ContentArea) {
  57362. const index = contentAreas.indexOf(target);
  57363. if (index !== -1) {
  57364. if (index > currentIndex) {
  57365. i = index - 1;
  57366. } else {
  57367. startIndex = index;
  57368. }
  57369. } else {
  57370. targetPageArea = target[_xfa_object.$getParent]();
  57371. startIndex = targetPageArea.contentArea.children.indexOf(target);
  57372. }
  57373. }
  57374. continue;
  57375. }
  57376. flush(i);
  57377. }
  57378. this[_xfa_object.$extra].pageNumber += 1;
  57379. if (targetPageArea) {
  57380. if (targetPageArea[_xfa_object.$isUsable]()) {
  57381. targetPageArea[_xfa_object.$extra].numberOfUse += 1;
  57382. } else {
  57383. targetPageArea = null;
  57384. }
  57385. }
  57386. pageArea = targetPageArea || pageArea[_xfa_object.$getNextPage]();
  57387. yield null;
  57388. }
  57389. }
  57390. }
  57391. exports.Template = Template;
  57392. class Text extends _xfa_object.ContentObject {
  57393. constructor(attributes) {
  57394. super(TEMPLATE_NS_ID, "text");
  57395. this.id = attributes.id || "";
  57396. this.maxChars = (0, _utils.getInteger)({
  57397. data: attributes.maxChars,
  57398. defaultValue: 0,
  57399. validate: x => x >= 0
  57400. });
  57401. this.name = attributes.name || "";
  57402. this.rid = attributes.rid || "";
  57403. this.use = attributes.use || "";
  57404. this.usehref = attributes.usehref || "";
  57405. }
  57406. [_xfa_object.$acceptWhitespace]() {
  57407. return true;
  57408. }
  57409. [_xfa_object.$onChild](child) {
  57410. if (child[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.xhtml.id) {
  57411. this[_xfa_object.$content] = child;
  57412. return true;
  57413. }
  57414. (0, _util.warn)(`XFA - Invalid content in Text: ${child[_xfa_object.$nodeName]}.`);
  57415. return false;
  57416. }
  57417. [_xfa_object.$onText](str) {
  57418. if (this[_xfa_object.$content] instanceof _xfa_object.XFAObject) {
  57419. return;
  57420. }
  57421. super[_xfa_object.$onText](str);
  57422. }
  57423. [_xfa_object.$finalize]() {
  57424. if (typeof this[_xfa_object.$content] === "string") {
  57425. this[_xfa_object.$content] = this[_xfa_object.$content].replace(/\r\n/g, "\n");
  57426. }
  57427. }
  57428. [_xfa_object.$getExtra]() {
  57429. if (typeof this[_xfa_object.$content] === "string") {
  57430. return this[_xfa_object.$content].split(/[\u2029\u2028\n]/).reduce((acc, line) => {
  57431. if (line) {
  57432. acc.push(line);
  57433. }
  57434. return acc;
  57435. }, []).join("\n");
  57436. }
  57437. return this[_xfa_object.$content][_xfa_object.$text]();
  57438. }
  57439. [_xfa_object.$toHTML](availableSpace) {
  57440. if (typeof this[_xfa_object.$content] === "string") {
  57441. const html = valueToHtml(this[_xfa_object.$content]).html;
  57442. if (this[_xfa_object.$content].includes("\u2029")) {
  57443. html.name = "div";
  57444. html.children = [];
  57445. this[_xfa_object.$content].split("\u2029").map(para => para.split(/[\u2028\n]/).reduce((acc, line) => {
  57446. acc.push({
  57447. name: "span",
  57448. value: line
  57449. }, {
  57450. name: "br"
  57451. });
  57452. return acc;
  57453. }, [])).forEach(lines => {
  57454. html.children.push({
  57455. name: "p",
  57456. children: lines
  57457. });
  57458. });
  57459. } else if (/[\u2028\n]/.test(this[_xfa_object.$content])) {
  57460. html.name = "div";
  57461. html.children = [];
  57462. this[_xfa_object.$content].split(/[\u2028\n]/).forEach(line => {
  57463. html.children.push({
  57464. name: "span",
  57465. value: line
  57466. }, {
  57467. name: "br"
  57468. });
  57469. });
  57470. }
  57471. return _utils.HTMLResult.success(html);
  57472. }
  57473. return this[_xfa_object.$content][_xfa_object.$toHTML](availableSpace);
  57474. }
  57475. }
  57476. exports.Text = Text;
  57477. class TextEdit extends _xfa_object.XFAObject {
  57478. constructor(attributes) {
  57479. super(TEMPLATE_NS_ID, "textEdit", true);
  57480. this.allowRichText = (0, _utils.getInteger)({
  57481. data: attributes.allowRichText,
  57482. defaultValue: 0,
  57483. validate: x => x === 1
  57484. });
  57485. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  57486. this.id = attributes.id || "";
  57487. this.multiLine = (0, _utils.getInteger)({
  57488. data: attributes.multiLine,
  57489. defaultValue: "",
  57490. validate: x => x === 0 || x === 1
  57491. });
  57492. this.use = attributes.use || "";
  57493. this.usehref = attributes.usehref || "";
  57494. this.vScrollPolicy = (0, _utils.getStringOption)(attributes.vScrollPolicy, ["auto", "off", "on"]);
  57495. this.border = null;
  57496. this.comb = null;
  57497. this.extras = null;
  57498. this.margin = null;
  57499. }
  57500. [_xfa_object.$toHTML](availableSpace) {
  57501. const style = (0, _html_utils.toStyle)(this, "border", "font", "margin");
  57502. let html;
  57503. const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  57504. if (this.multiLine === "") {
  57505. this.multiLine = field instanceof Draw ? 1 : 0;
  57506. }
  57507. if (this.multiLine === 1) {
  57508. html = {
  57509. name: "textarea",
  57510. attributes: {
  57511. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  57512. fieldId: field[_xfa_object.$uid],
  57513. class: ["xfaTextfield"],
  57514. style,
  57515. "aria-label": ariaLabel(field),
  57516. "aria-required": false
  57517. }
  57518. };
  57519. } else {
  57520. html = {
  57521. name: "input",
  57522. attributes: {
  57523. type: "text",
  57524. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  57525. fieldId: field[_xfa_object.$uid],
  57526. class: ["xfaTextfield"],
  57527. style,
  57528. "aria-label": ariaLabel(field),
  57529. "aria-required": false
  57530. }
  57531. };
  57532. }
  57533. if (isRequired(field)) {
  57534. html.attributes["aria-required"] = true;
  57535. html.attributes.required = true;
  57536. }
  57537. return _utils.HTMLResult.success({
  57538. name: "label",
  57539. attributes: {
  57540. class: ["xfaLabel"]
  57541. },
  57542. children: [html]
  57543. });
  57544. }
  57545. }
  57546. class Time extends _xfa_object.StringObject {
  57547. constructor(attributes) {
  57548. super(TEMPLATE_NS_ID, "time");
  57549. this.id = attributes.id || "";
  57550. this.name = attributes.name || "";
  57551. this.use = attributes.use || "";
  57552. this.usehref = attributes.usehref || "";
  57553. }
  57554. [_xfa_object.$finalize]() {
  57555. const date = this[_xfa_object.$content].trim();
  57556. this[_xfa_object.$content] = date ? new Date(date) : null;
  57557. }
  57558. [_xfa_object.$toHTML](availableSpace) {
  57559. return valueToHtml(this[_xfa_object.$content] ? this[_xfa_object.$content].toString() : "");
  57560. }
  57561. }
  57562. class TimeStamp extends _xfa_object.XFAObject {
  57563. constructor(attributes) {
  57564. super(TEMPLATE_NS_ID, "timeStamp");
  57565. this.id = attributes.id || "";
  57566. this.server = attributes.server || "";
  57567. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  57568. this.use = attributes.use || "";
  57569. this.usehref = attributes.usehref || "";
  57570. }
  57571. }
  57572. class ToolTip extends _xfa_object.StringObject {
  57573. constructor(attributes) {
  57574. super(TEMPLATE_NS_ID, "toolTip");
  57575. this.id = attributes.id || "";
  57576. this.rid = attributes.rid || "";
  57577. this.use = attributes.use || "";
  57578. this.usehref = attributes.usehref || "";
  57579. }
  57580. }
  57581. class Traversal extends _xfa_object.XFAObject {
  57582. constructor(attributes) {
  57583. super(TEMPLATE_NS_ID, "traversal", true);
  57584. this.id = attributes.id || "";
  57585. this.use = attributes.use || "";
  57586. this.usehref = attributes.usehref || "";
  57587. this.extras = null;
  57588. this.traverse = new _xfa_object.XFAObjectArray();
  57589. }
  57590. }
  57591. class Traverse extends _xfa_object.XFAObject {
  57592. constructor(attributes) {
  57593. super(TEMPLATE_NS_ID, "traverse", true);
  57594. this.id = attributes.id || "";
  57595. this.operation = (0, _utils.getStringOption)(attributes.operation, ["next", "back", "down", "first", "left", "right", "up"]);
  57596. this.ref = attributes.ref || "";
  57597. this.use = attributes.use || "";
  57598. this.usehref = attributes.usehref || "";
  57599. this.extras = null;
  57600. this.script = null;
  57601. }
  57602. get name() {
  57603. return this.operation;
  57604. }
  57605. [_xfa_object.$isTransparent]() {
  57606. return false;
  57607. }
  57608. }
  57609. class Ui extends _xfa_object.XFAObject {
  57610. constructor(attributes) {
  57611. super(TEMPLATE_NS_ID, "ui", true);
  57612. this.id = attributes.id || "";
  57613. this.use = attributes.use || "";
  57614. this.usehref = attributes.usehref || "";
  57615. this.extras = null;
  57616. this.picture = null;
  57617. this.barcode = null;
  57618. this.button = null;
  57619. this.checkButton = null;
  57620. this.choiceList = null;
  57621. this.dateTimeEdit = null;
  57622. this.defaultUi = null;
  57623. this.imageEdit = null;
  57624. this.numericEdit = null;
  57625. this.passwordEdit = null;
  57626. this.signature = null;
  57627. this.textEdit = null;
  57628. }
  57629. [_xfa_object.$getExtra]() {
  57630. if (this[_xfa_object.$extra] === undefined) {
  57631. for (const name of Object.getOwnPropertyNames(this)) {
  57632. if (name === "extras" || name === "picture") {
  57633. continue;
  57634. }
  57635. const obj = this[name];
  57636. if (!(obj instanceof _xfa_object.XFAObject)) {
  57637. continue;
  57638. }
  57639. this[_xfa_object.$extra] = obj;
  57640. return obj;
  57641. }
  57642. this[_xfa_object.$extra] = null;
  57643. }
  57644. return this[_xfa_object.$extra];
  57645. }
  57646. [_xfa_object.$toHTML](availableSpace) {
  57647. const obj = this[_xfa_object.$getExtra]();
  57648. if (obj) {
  57649. return obj[_xfa_object.$toHTML](availableSpace);
  57650. }
  57651. return _utils.HTMLResult.EMPTY;
  57652. }
  57653. }
  57654. class Validate extends _xfa_object.XFAObject {
  57655. constructor(attributes) {
  57656. super(TEMPLATE_NS_ID, "validate", true);
  57657. this.formatTest = (0, _utils.getStringOption)(attributes.formatTest, ["warning", "disabled", "error"]);
  57658. this.id = attributes.id || "";
  57659. this.nullTest = (0, _utils.getStringOption)(attributes.nullTest, ["disabled", "error", "warning"]);
  57660. this.scriptTest = (0, _utils.getStringOption)(attributes.scriptTest, ["error", "disabled", "warning"]);
  57661. this.use = attributes.use || "";
  57662. this.usehref = attributes.usehref || "";
  57663. this.extras = null;
  57664. this.message = null;
  57665. this.picture = null;
  57666. this.script = null;
  57667. }
  57668. }
  57669. class Value extends _xfa_object.XFAObject {
  57670. constructor(attributes) {
  57671. super(TEMPLATE_NS_ID, "value", true);
  57672. this.id = attributes.id || "";
  57673. this.override = (0, _utils.getInteger)({
  57674. data: attributes.override,
  57675. defaultValue: 0,
  57676. validate: x => x === 1
  57677. });
  57678. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  57679. this.use = attributes.use || "";
  57680. this.usehref = attributes.usehref || "";
  57681. this.arc = null;
  57682. this.boolean = null;
  57683. this.date = null;
  57684. this.dateTime = null;
  57685. this.decimal = null;
  57686. this.exData = null;
  57687. this.float = null;
  57688. this.image = null;
  57689. this.integer = null;
  57690. this.line = null;
  57691. this.rectangle = null;
  57692. this.text = null;
  57693. this.time = null;
  57694. }
  57695. [_xfa_object.$setValue](value) {
  57696. const parent = this[_xfa_object.$getParent]();
  57697. if (parent instanceof Field) {
  57698. if (parent.ui && parent.ui.imageEdit) {
  57699. if (!this.image) {
  57700. this.image = new Image({});
  57701. this[_xfa_object.$appendChild](this.image);
  57702. }
  57703. this.image[_xfa_object.$content] = value[_xfa_object.$content];
  57704. return;
  57705. }
  57706. }
  57707. const valueName = value[_xfa_object.$nodeName];
  57708. if (this[valueName] !== null) {
  57709. this[valueName][_xfa_object.$content] = value[_xfa_object.$content];
  57710. return;
  57711. }
  57712. for (const name of Object.getOwnPropertyNames(this)) {
  57713. const obj = this[name];
  57714. if (obj instanceof _xfa_object.XFAObject) {
  57715. this[name] = null;
  57716. this[_xfa_object.$removeChild](obj);
  57717. }
  57718. }
  57719. this[value[_xfa_object.$nodeName]] = value;
  57720. this[_xfa_object.$appendChild](value);
  57721. }
  57722. [_xfa_object.$text]() {
  57723. if (this.exData) {
  57724. if (typeof this.exData[_xfa_object.$content] === "string") {
  57725. return this.exData[_xfa_object.$content].trim();
  57726. }
  57727. return this.exData[_xfa_object.$content][_xfa_object.$text]().trim();
  57728. }
  57729. for (const name of Object.getOwnPropertyNames(this)) {
  57730. if (name === "image") {
  57731. continue;
  57732. }
  57733. const obj = this[name];
  57734. if (obj instanceof _xfa_object.XFAObject) {
  57735. return (obj[_xfa_object.$content] || "").toString().trim();
  57736. }
  57737. }
  57738. return null;
  57739. }
  57740. [_xfa_object.$toHTML](availableSpace) {
  57741. for (const name of Object.getOwnPropertyNames(this)) {
  57742. const obj = this[name];
  57743. if (!(obj instanceof _xfa_object.XFAObject)) {
  57744. continue;
  57745. }
  57746. return obj[_xfa_object.$toHTML](availableSpace);
  57747. }
  57748. return _utils.HTMLResult.EMPTY;
  57749. }
  57750. }
  57751. exports.Value = Value;
  57752. class Variables extends _xfa_object.XFAObject {
  57753. constructor(attributes) {
  57754. super(TEMPLATE_NS_ID, "variables", true);
  57755. this.id = attributes.id || "";
  57756. this.use = attributes.use || "";
  57757. this.usehref = attributes.usehref || "";
  57758. this.boolean = new _xfa_object.XFAObjectArray();
  57759. this.date = new _xfa_object.XFAObjectArray();
  57760. this.dateTime = new _xfa_object.XFAObjectArray();
  57761. this.decimal = new _xfa_object.XFAObjectArray();
  57762. this.exData = new _xfa_object.XFAObjectArray();
  57763. this.float = new _xfa_object.XFAObjectArray();
  57764. this.image = new _xfa_object.XFAObjectArray();
  57765. this.integer = new _xfa_object.XFAObjectArray();
  57766. this.manifest = new _xfa_object.XFAObjectArray();
  57767. this.script = new _xfa_object.XFAObjectArray();
  57768. this.text = new _xfa_object.XFAObjectArray();
  57769. this.time = new _xfa_object.XFAObjectArray();
  57770. }
  57771. [_xfa_object.$isTransparent]() {
  57772. return true;
  57773. }
  57774. }
  57775. class TemplateNamespace {
  57776. static [_namespaces.$buildXFAObject](name, attributes) {
  57777. if (TemplateNamespace.hasOwnProperty(name)) {
  57778. const node = TemplateNamespace[name](attributes);
  57779. node[_xfa_object.$setSetAttributes](attributes);
  57780. return node;
  57781. }
  57782. return undefined;
  57783. }
  57784. static appearanceFilter(attrs) {
  57785. return new AppearanceFilter(attrs);
  57786. }
  57787. static arc(attrs) {
  57788. return new Arc(attrs);
  57789. }
  57790. static area(attrs) {
  57791. return new Area(attrs);
  57792. }
  57793. static assist(attrs) {
  57794. return new Assist(attrs);
  57795. }
  57796. static barcode(attrs) {
  57797. return new Barcode(attrs);
  57798. }
  57799. static bind(attrs) {
  57800. return new Bind(attrs);
  57801. }
  57802. static bindItems(attrs) {
  57803. return new BindItems(attrs);
  57804. }
  57805. static bookend(attrs) {
  57806. return new Bookend(attrs);
  57807. }
  57808. static boolean(attrs) {
  57809. return new BooleanElement(attrs);
  57810. }
  57811. static border(attrs) {
  57812. return new Border(attrs);
  57813. }
  57814. static break(attrs) {
  57815. return new Break(attrs);
  57816. }
  57817. static breakAfter(attrs) {
  57818. return new BreakAfter(attrs);
  57819. }
  57820. static breakBefore(attrs) {
  57821. return new BreakBefore(attrs);
  57822. }
  57823. static button(attrs) {
  57824. return new Button(attrs);
  57825. }
  57826. static calculate(attrs) {
  57827. return new Calculate(attrs);
  57828. }
  57829. static caption(attrs) {
  57830. return new Caption(attrs);
  57831. }
  57832. static certificate(attrs) {
  57833. return new Certificate(attrs);
  57834. }
  57835. static certificates(attrs) {
  57836. return new Certificates(attrs);
  57837. }
  57838. static checkButton(attrs) {
  57839. return new CheckButton(attrs);
  57840. }
  57841. static choiceList(attrs) {
  57842. return new ChoiceList(attrs);
  57843. }
  57844. static color(attrs) {
  57845. return new Color(attrs);
  57846. }
  57847. static comb(attrs) {
  57848. return new Comb(attrs);
  57849. }
  57850. static connect(attrs) {
  57851. return new Connect(attrs);
  57852. }
  57853. static contentArea(attrs) {
  57854. return new ContentArea(attrs);
  57855. }
  57856. static corner(attrs) {
  57857. return new Corner(attrs);
  57858. }
  57859. static date(attrs) {
  57860. return new DateElement(attrs);
  57861. }
  57862. static dateTime(attrs) {
  57863. return new DateTime(attrs);
  57864. }
  57865. static dateTimeEdit(attrs) {
  57866. return new DateTimeEdit(attrs);
  57867. }
  57868. static decimal(attrs) {
  57869. return new Decimal(attrs);
  57870. }
  57871. static defaultUi(attrs) {
  57872. return new DefaultUi(attrs);
  57873. }
  57874. static desc(attrs) {
  57875. return new Desc(attrs);
  57876. }
  57877. static digestMethod(attrs) {
  57878. return new DigestMethod(attrs);
  57879. }
  57880. static digestMethods(attrs) {
  57881. return new DigestMethods(attrs);
  57882. }
  57883. static draw(attrs) {
  57884. return new Draw(attrs);
  57885. }
  57886. static edge(attrs) {
  57887. return new Edge(attrs);
  57888. }
  57889. static encoding(attrs) {
  57890. return new Encoding(attrs);
  57891. }
  57892. static encodings(attrs) {
  57893. return new Encodings(attrs);
  57894. }
  57895. static encrypt(attrs) {
  57896. return new Encrypt(attrs);
  57897. }
  57898. static encryptData(attrs) {
  57899. return new EncryptData(attrs);
  57900. }
  57901. static encryption(attrs) {
  57902. return new Encryption(attrs);
  57903. }
  57904. static encryptionMethod(attrs) {
  57905. return new EncryptionMethod(attrs);
  57906. }
  57907. static encryptionMethods(attrs) {
  57908. return new EncryptionMethods(attrs);
  57909. }
  57910. static event(attrs) {
  57911. return new Event(attrs);
  57912. }
  57913. static exData(attrs) {
  57914. return new ExData(attrs);
  57915. }
  57916. static exObject(attrs) {
  57917. return new ExObject(attrs);
  57918. }
  57919. static exclGroup(attrs) {
  57920. return new ExclGroup(attrs);
  57921. }
  57922. static execute(attrs) {
  57923. return new Execute(attrs);
  57924. }
  57925. static extras(attrs) {
  57926. return new Extras(attrs);
  57927. }
  57928. static field(attrs) {
  57929. return new Field(attrs);
  57930. }
  57931. static fill(attrs) {
  57932. return new Fill(attrs);
  57933. }
  57934. static filter(attrs) {
  57935. return new Filter(attrs);
  57936. }
  57937. static float(attrs) {
  57938. return new Float(attrs);
  57939. }
  57940. static font(attrs) {
  57941. return new Font(attrs);
  57942. }
  57943. static format(attrs) {
  57944. return new Format(attrs);
  57945. }
  57946. static handler(attrs) {
  57947. return new Handler(attrs);
  57948. }
  57949. static hyphenation(attrs) {
  57950. return new Hyphenation(attrs);
  57951. }
  57952. static image(attrs) {
  57953. return new Image(attrs);
  57954. }
  57955. static imageEdit(attrs) {
  57956. return new ImageEdit(attrs);
  57957. }
  57958. static integer(attrs) {
  57959. return new Integer(attrs);
  57960. }
  57961. static issuers(attrs) {
  57962. return new Issuers(attrs);
  57963. }
  57964. static items(attrs) {
  57965. return new Items(attrs);
  57966. }
  57967. static keep(attrs) {
  57968. return new Keep(attrs);
  57969. }
  57970. static keyUsage(attrs) {
  57971. return new KeyUsage(attrs);
  57972. }
  57973. static line(attrs) {
  57974. return new Line(attrs);
  57975. }
  57976. static linear(attrs) {
  57977. return new Linear(attrs);
  57978. }
  57979. static lockDocument(attrs) {
  57980. return new LockDocument(attrs);
  57981. }
  57982. static manifest(attrs) {
  57983. return new Manifest(attrs);
  57984. }
  57985. static margin(attrs) {
  57986. return new Margin(attrs);
  57987. }
  57988. static mdp(attrs) {
  57989. return new Mdp(attrs);
  57990. }
  57991. static medium(attrs) {
  57992. return new Medium(attrs);
  57993. }
  57994. static message(attrs) {
  57995. return new Message(attrs);
  57996. }
  57997. static numericEdit(attrs) {
  57998. return new NumericEdit(attrs);
  57999. }
  58000. static occur(attrs) {
  58001. return new Occur(attrs);
  58002. }
  58003. static oid(attrs) {
  58004. return new Oid(attrs);
  58005. }
  58006. static oids(attrs) {
  58007. return new Oids(attrs);
  58008. }
  58009. static overflow(attrs) {
  58010. return new Overflow(attrs);
  58011. }
  58012. static pageArea(attrs) {
  58013. return new PageArea(attrs);
  58014. }
  58015. static pageSet(attrs) {
  58016. return new PageSet(attrs);
  58017. }
  58018. static para(attrs) {
  58019. return new Para(attrs);
  58020. }
  58021. static passwordEdit(attrs) {
  58022. return new PasswordEdit(attrs);
  58023. }
  58024. static pattern(attrs) {
  58025. return new Pattern(attrs);
  58026. }
  58027. static picture(attrs) {
  58028. return new Picture(attrs);
  58029. }
  58030. static proto(attrs) {
  58031. return new Proto(attrs);
  58032. }
  58033. static radial(attrs) {
  58034. return new Radial(attrs);
  58035. }
  58036. static reason(attrs) {
  58037. return new Reason(attrs);
  58038. }
  58039. static reasons(attrs) {
  58040. return new Reasons(attrs);
  58041. }
  58042. static rectangle(attrs) {
  58043. return new Rectangle(attrs);
  58044. }
  58045. static ref(attrs) {
  58046. return new RefElement(attrs);
  58047. }
  58048. static script(attrs) {
  58049. return new Script(attrs);
  58050. }
  58051. static setProperty(attrs) {
  58052. return new SetProperty(attrs);
  58053. }
  58054. static signData(attrs) {
  58055. return new SignData(attrs);
  58056. }
  58057. static signature(attrs) {
  58058. return new Signature(attrs);
  58059. }
  58060. static signing(attrs) {
  58061. return new Signing(attrs);
  58062. }
  58063. static solid(attrs) {
  58064. return new Solid(attrs);
  58065. }
  58066. static speak(attrs) {
  58067. return new Speak(attrs);
  58068. }
  58069. static stipple(attrs) {
  58070. return new Stipple(attrs);
  58071. }
  58072. static subform(attrs) {
  58073. return new Subform(attrs);
  58074. }
  58075. static subformSet(attrs) {
  58076. return new SubformSet(attrs);
  58077. }
  58078. static subjectDN(attrs) {
  58079. return new SubjectDN(attrs);
  58080. }
  58081. static subjectDNs(attrs) {
  58082. return new SubjectDNs(attrs);
  58083. }
  58084. static submit(attrs) {
  58085. return new Submit(attrs);
  58086. }
  58087. static template(attrs) {
  58088. return new Template(attrs);
  58089. }
  58090. static text(attrs) {
  58091. return new Text(attrs);
  58092. }
  58093. static textEdit(attrs) {
  58094. return new TextEdit(attrs);
  58095. }
  58096. static time(attrs) {
  58097. return new Time(attrs);
  58098. }
  58099. static timeStamp(attrs) {
  58100. return new TimeStamp(attrs);
  58101. }
  58102. static toolTip(attrs) {
  58103. return new ToolTip(attrs);
  58104. }
  58105. static traversal(attrs) {
  58106. return new Traversal(attrs);
  58107. }
  58108. static traverse(attrs) {
  58109. return new Traverse(attrs);
  58110. }
  58111. static ui(attrs) {
  58112. return new Ui(attrs);
  58113. }
  58114. static validate(attrs) {
  58115. return new Validate(attrs);
  58116. }
  58117. static value(attrs) {
  58118. return new Value(attrs);
  58119. }
  58120. static variables(attrs) {
  58121. return new Variables(attrs);
  58122. }
  58123. }
  58124. exports.TemplateNamespace = TemplateNamespace;
  58125. /***/ }),
  58126. /* 83 */
  58127. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  58128. Object.defineProperty(exports, "__esModule", ({
  58129. value: true
  58130. }));
  58131. exports.addHTML = addHTML;
  58132. exports.checkDimensions = checkDimensions;
  58133. exports.flushHTML = flushHTML;
  58134. exports.getAvailableSpace = getAvailableSpace;
  58135. var _xfa_object = __w_pdfjs_require__(77);
  58136. var _html_utils = __w_pdfjs_require__(84);
  58137. function createLine(node, children) {
  58138. return {
  58139. name: "div",
  58140. attributes: {
  58141. class: [node.layout === "lr-tb" ? "xfaLr" : "xfaRl"]
  58142. },
  58143. children
  58144. };
  58145. }
  58146. function flushHTML(node) {
  58147. if (!node[_xfa_object.$extra]) {
  58148. return null;
  58149. }
  58150. const attributes = node[_xfa_object.$extra].attributes;
  58151. const html = {
  58152. name: "div",
  58153. attributes,
  58154. children: node[_xfa_object.$extra].children
  58155. };
  58156. if (node[_xfa_object.$extra].failingNode) {
  58157. const htmlFromFailing = node[_xfa_object.$extra].failingNode[_xfa_object.$flushHTML]();
  58158. if (htmlFromFailing) {
  58159. if (node.layout.endsWith("-tb")) {
  58160. html.children.push(createLine(node, [htmlFromFailing]));
  58161. } else {
  58162. html.children.push(htmlFromFailing);
  58163. }
  58164. }
  58165. }
  58166. if (html.children.length === 0) {
  58167. return null;
  58168. }
  58169. return html;
  58170. }
  58171. function addHTML(node, html, bbox) {
  58172. const extra = node[_xfa_object.$extra];
  58173. const availableSpace = extra.availableSpace;
  58174. const [x, y, w, h] = bbox;
  58175. switch (node.layout) {
  58176. case "position":
  58177. {
  58178. extra.width = Math.max(extra.width, x + w);
  58179. extra.height = Math.max(extra.height, y + h);
  58180. extra.children.push(html);
  58181. break;
  58182. }
  58183. case "lr-tb":
  58184. case "rl-tb":
  58185. if (!extra.line || extra.attempt === 1) {
  58186. extra.line = createLine(node, []);
  58187. extra.children.push(extra.line);
  58188. extra.numberInLine = 0;
  58189. }
  58190. extra.numberInLine += 1;
  58191. extra.line.children.push(html);
  58192. if (extra.attempt === 0) {
  58193. extra.currentWidth += w;
  58194. extra.height = Math.max(extra.height, extra.prevHeight + h);
  58195. } else {
  58196. extra.currentWidth = w;
  58197. extra.prevHeight = extra.height;
  58198. extra.height += h;
  58199. extra.attempt = 0;
  58200. }
  58201. extra.width = Math.max(extra.width, extra.currentWidth);
  58202. break;
  58203. case "rl-row":
  58204. case "row":
  58205. {
  58206. extra.children.push(html);
  58207. extra.width += w;
  58208. extra.height = Math.max(extra.height, h);
  58209. const height = (0, _html_utils.measureToString)(extra.height);
  58210. for (const child of extra.children) {
  58211. child.attributes.style.height = height;
  58212. }
  58213. break;
  58214. }
  58215. case "table":
  58216. {
  58217. extra.width = Math.min(availableSpace.width, Math.max(extra.width, w));
  58218. extra.height += h;
  58219. extra.children.push(html);
  58220. break;
  58221. }
  58222. case "tb":
  58223. {
  58224. extra.width = Math.min(availableSpace.width, Math.max(extra.width, w));
  58225. extra.height += h;
  58226. extra.children.push(html);
  58227. break;
  58228. }
  58229. }
  58230. }
  58231. function getAvailableSpace(node) {
  58232. const availableSpace = node[_xfa_object.$extra].availableSpace;
  58233. const marginV = node.margin ? node.margin.topInset + node.margin.bottomInset : 0;
  58234. const marginH = node.margin ? node.margin.leftInset + node.margin.rightInset : 0;
  58235. switch (node.layout) {
  58236. case "lr-tb":
  58237. case "rl-tb":
  58238. if (node[_xfa_object.$extra].attempt === 0) {
  58239. return {
  58240. width: availableSpace.width - marginH - node[_xfa_object.$extra].currentWidth,
  58241. height: availableSpace.height - marginV - node[_xfa_object.$extra].prevHeight
  58242. };
  58243. }
  58244. return {
  58245. width: availableSpace.width - marginH,
  58246. height: availableSpace.height - marginV - node[_xfa_object.$extra].height
  58247. };
  58248. case "rl-row":
  58249. case "row":
  58250. const width = node[_xfa_object.$extra].columnWidths.slice(node[_xfa_object.$extra].currentColumn).reduce((a, x) => a + x);
  58251. return {
  58252. width,
  58253. height: availableSpace.height - marginH
  58254. };
  58255. case "table":
  58256. case "tb":
  58257. return {
  58258. width: availableSpace.width - marginH,
  58259. height: availableSpace.height - marginV - node[_xfa_object.$extra].height
  58260. };
  58261. case "position":
  58262. default:
  58263. return availableSpace;
  58264. }
  58265. }
  58266. function getTransformedBBox(node) {
  58267. let w = node.w === "" ? NaN : node.w;
  58268. let h = node.h === "" ? NaN : node.h;
  58269. let [centerX, centerY] = [0, 0];
  58270. switch (node.anchorType || "") {
  58271. case "bottomCenter":
  58272. [centerX, centerY] = [w / 2, h];
  58273. break;
  58274. case "bottomLeft":
  58275. [centerX, centerY] = [0, h];
  58276. break;
  58277. case "bottomRight":
  58278. [centerX, centerY] = [w, h];
  58279. break;
  58280. case "middleCenter":
  58281. [centerX, centerY] = [w / 2, h / 2];
  58282. break;
  58283. case "middleLeft":
  58284. [centerX, centerY] = [0, h / 2];
  58285. break;
  58286. case "middleRight":
  58287. [centerX, centerY] = [w, h / 2];
  58288. break;
  58289. case "topCenter":
  58290. [centerX, centerY] = [w / 2, 0];
  58291. break;
  58292. case "topRight":
  58293. [centerX, centerY] = [w, 0];
  58294. break;
  58295. }
  58296. let x, y;
  58297. switch (node.rotate || 0) {
  58298. case 0:
  58299. [x, y] = [-centerX, -centerY];
  58300. break;
  58301. case 90:
  58302. [x, y] = [-centerY, centerX];
  58303. [w, h] = [h, -w];
  58304. break;
  58305. case 180:
  58306. [x, y] = [centerX, centerY];
  58307. [w, h] = [-w, -h];
  58308. break;
  58309. case 270:
  58310. [x, y] = [centerY, -centerX];
  58311. [w, h] = [-h, w];
  58312. break;
  58313. }
  58314. return [node.x + x + Math.min(0, w), node.y + y + Math.min(0, h), Math.abs(w), Math.abs(h)];
  58315. }
  58316. function checkDimensions(node, space) {
  58317. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].firstUnsplittable === null) {
  58318. return true;
  58319. }
  58320. if (node.w === 0 || node.h === 0) {
  58321. return true;
  58322. }
  58323. const ERROR = 2;
  58324. const parent = node[_xfa_object.$getSubformParent]();
  58325. const attempt = parent[_xfa_object.$extra] && parent[_xfa_object.$extra].attempt || 0;
  58326. const [, y, w, h] = getTransformedBBox(node);
  58327. switch (parent.layout) {
  58328. case "lr-tb":
  58329. case "rl-tb":
  58330. if (attempt === 0) {
  58331. if (!node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  58332. if (node.h !== "" && Math.round(h - space.height) > ERROR) {
  58333. return false;
  58334. }
  58335. if (node.w !== "") {
  58336. if (Math.round(w - space.width) <= ERROR) {
  58337. return true;
  58338. }
  58339. if (parent[_xfa_object.$extra].numberInLine === 0) {
  58340. return space.height > ERROR;
  58341. }
  58342. return false;
  58343. }
  58344. return space.width > ERROR;
  58345. }
  58346. if (node.w !== "") {
  58347. return Math.round(w - space.width) <= ERROR;
  58348. }
  58349. return space.width > ERROR;
  58350. }
  58351. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  58352. return true;
  58353. }
  58354. if (node.h !== "" && Math.round(h - space.height) > ERROR) {
  58355. return false;
  58356. }
  58357. if (node.w === "" || Math.round(w - space.width) <= ERROR) {
  58358. return space.height > ERROR;
  58359. }
  58360. if (parent[_xfa_object.$isThereMoreWidth]()) {
  58361. return false;
  58362. }
  58363. return space.height > ERROR;
  58364. case "table":
  58365. case "tb":
  58366. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  58367. return true;
  58368. }
  58369. if (node.h !== "" && !node[_xfa_object.$isSplittable]()) {
  58370. return Math.round(h - space.height) <= ERROR;
  58371. }
  58372. if (node.w === "" || Math.round(w - space.width) <= ERROR) {
  58373. return space.height > ERROR;
  58374. }
  58375. if (parent[_xfa_object.$isThereMoreWidth]()) {
  58376. return false;
  58377. }
  58378. return space.height > ERROR;
  58379. case "position":
  58380. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  58381. return true;
  58382. }
  58383. if (node.h === "" || Math.round(h + y - space.height) <= ERROR) {
  58384. return true;
  58385. }
  58386. const area = node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].currentContentArea;
  58387. return h + y > area.h;
  58388. case "rl-row":
  58389. case "row":
  58390. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  58391. return true;
  58392. }
  58393. if (node.h !== "") {
  58394. return Math.round(h - space.height) <= ERROR;
  58395. }
  58396. return true;
  58397. default:
  58398. return true;
  58399. }
  58400. }
  58401. /***/ }),
  58402. /* 84 */
  58403. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  58404. Object.defineProperty(exports, "__esModule", ({
  58405. value: true
  58406. }));
  58407. exports.computeBbox = computeBbox;
  58408. exports.createWrapper = createWrapper;
  58409. exports.fixDimensions = fixDimensions;
  58410. exports.fixTextIndent = fixTextIndent;
  58411. exports.fixURL = fixURL;
  58412. exports.isPrintOnly = isPrintOnly;
  58413. exports.layoutClass = layoutClass;
  58414. exports.layoutNode = layoutNode;
  58415. exports.measureToString = measureToString;
  58416. exports.setAccess = setAccess;
  58417. exports.setFontFamily = setFontFamily;
  58418. exports.setMinMaxDimensions = setMinMaxDimensions;
  58419. exports.setPara = setPara;
  58420. exports.toStyle = toStyle;
  58421. var _xfa_object = __w_pdfjs_require__(77);
  58422. var _util = __w_pdfjs_require__(2);
  58423. var _utils = __w_pdfjs_require__(78);
  58424. var _fonts = __w_pdfjs_require__(85);
  58425. var _text = __w_pdfjs_require__(86);
  58426. function measureToString(m) {
  58427. if (typeof m === "string") {
  58428. return "0px";
  58429. }
  58430. return Number.isInteger(m) ? `${m}px` : `${m.toFixed(2)}px`;
  58431. }
  58432. const converters = {
  58433. anchorType(node, style) {
  58434. const parent = node[_xfa_object.$getSubformParent]();
  58435. if (!parent || parent.layout && parent.layout !== "position") {
  58436. return;
  58437. }
  58438. if (!("transform" in style)) {
  58439. style.transform = "";
  58440. }
  58441. switch (node.anchorType) {
  58442. case "bottomCenter":
  58443. style.transform += "translate(-50%, -100%)";
  58444. break;
  58445. case "bottomLeft":
  58446. style.transform += "translate(0,-100%)";
  58447. break;
  58448. case "bottomRight":
  58449. style.transform += "translate(-100%,-100%)";
  58450. break;
  58451. case "middleCenter":
  58452. style.transform += "translate(-50%,-50%)";
  58453. break;
  58454. case "middleLeft":
  58455. style.transform += "translate(0,-50%)";
  58456. break;
  58457. case "middleRight":
  58458. style.transform += "translate(-100%,-50%)";
  58459. break;
  58460. case "topCenter":
  58461. style.transform += "translate(-50%,0)";
  58462. break;
  58463. case "topRight":
  58464. style.transform += "translate(-100%,0)";
  58465. break;
  58466. }
  58467. },
  58468. dimensions(node, style) {
  58469. const parent = node[_xfa_object.$getSubformParent]();
  58470. let width = node.w;
  58471. const height = node.h;
  58472. if (parent.layout && parent.layout.includes("row")) {
  58473. const extra = parent[_xfa_object.$extra];
  58474. const colSpan = node.colSpan;
  58475. let w;
  58476. if (colSpan === -1) {
  58477. w = extra.columnWidths.slice(extra.currentColumn).reduce((a, x) => a + x, 0);
  58478. extra.currentColumn = 0;
  58479. } else {
  58480. w = extra.columnWidths.slice(extra.currentColumn, extra.currentColumn + colSpan).reduce((a, x) => a + x, 0);
  58481. extra.currentColumn = (extra.currentColumn + node.colSpan) % extra.columnWidths.length;
  58482. }
  58483. if (!isNaN(w)) {
  58484. width = node.w = w;
  58485. }
  58486. }
  58487. if (width !== "") {
  58488. style.width = measureToString(width);
  58489. } else {
  58490. style.width = "auto";
  58491. }
  58492. if (height !== "") {
  58493. style.height = measureToString(height);
  58494. } else {
  58495. style.height = "auto";
  58496. }
  58497. },
  58498. position(node, style) {
  58499. const parent = node[_xfa_object.$getSubformParent]();
  58500. if (parent && parent.layout && parent.layout !== "position") {
  58501. return;
  58502. }
  58503. style.position = "absolute";
  58504. style.left = measureToString(node.x);
  58505. style.top = measureToString(node.y);
  58506. },
  58507. rotate(node, style) {
  58508. if (node.rotate) {
  58509. if (!("transform" in style)) {
  58510. style.transform = "";
  58511. }
  58512. style.transform += `rotate(-${node.rotate}deg)`;
  58513. style.transformOrigin = "top left";
  58514. }
  58515. },
  58516. presence(node, style) {
  58517. switch (node.presence) {
  58518. case "invisible":
  58519. style.visibility = "hidden";
  58520. break;
  58521. case "hidden":
  58522. case "inactive":
  58523. style.display = "none";
  58524. break;
  58525. }
  58526. },
  58527. hAlign(node, style) {
  58528. if (node[_xfa_object.$nodeName] === "para") {
  58529. switch (node.hAlign) {
  58530. case "justifyAll":
  58531. style.textAlign = "justify-all";
  58532. break;
  58533. case "radix":
  58534. style.textAlign = "left";
  58535. break;
  58536. default:
  58537. style.textAlign = node.hAlign;
  58538. }
  58539. } else {
  58540. switch (node.hAlign) {
  58541. case "left":
  58542. style.alignSelf = "start";
  58543. break;
  58544. case "center":
  58545. style.alignSelf = "center";
  58546. break;
  58547. case "right":
  58548. style.alignSelf = "end";
  58549. break;
  58550. }
  58551. }
  58552. },
  58553. margin(node, style) {
  58554. if (node.margin) {
  58555. style.margin = node.margin[_xfa_object.$toStyle]().margin;
  58556. }
  58557. }
  58558. };
  58559. function setMinMaxDimensions(node, style) {
  58560. const parent = node[_xfa_object.$getSubformParent]();
  58561. if (parent.layout === "position") {
  58562. if (node.minW > 0) {
  58563. style.minWidth = measureToString(node.minW);
  58564. }
  58565. if (node.maxW > 0) {
  58566. style.maxWidth = measureToString(node.maxW);
  58567. }
  58568. if (node.minH > 0) {
  58569. style.minHeight = measureToString(node.minH);
  58570. }
  58571. if (node.maxH > 0) {
  58572. style.maxHeight = measureToString(node.maxH);
  58573. }
  58574. }
  58575. }
  58576. function layoutText(text, xfaFont, margin, lineHeight, fontFinder, width) {
  58577. const measure = new _text.TextMeasure(xfaFont, margin, lineHeight, fontFinder);
  58578. if (typeof text === "string") {
  58579. measure.addString(text);
  58580. } else {
  58581. text[_xfa_object.$pushGlyphs](measure);
  58582. }
  58583. return measure.compute(width);
  58584. }
  58585. function layoutNode(node, availableSpace) {
  58586. let height = null;
  58587. let width = null;
  58588. let isBroken = false;
  58589. if ((!node.w || !node.h) && node.value) {
  58590. let marginH = 0;
  58591. let marginV = 0;
  58592. if (node.margin) {
  58593. marginH = node.margin.leftInset + node.margin.rightInset;
  58594. marginV = node.margin.topInset + node.margin.bottomInset;
  58595. }
  58596. let lineHeight = null;
  58597. let margin = null;
  58598. if (node.para) {
  58599. margin = Object.create(null);
  58600. lineHeight = node.para.lineHeight === "" ? null : node.para.lineHeight;
  58601. margin.top = node.para.spaceAbove === "" ? 0 : node.para.spaceAbove;
  58602. margin.bottom = node.para.spaceBelow === "" ? 0 : node.para.spaceBelow;
  58603. margin.left = node.para.marginLeft === "" ? 0 : node.para.marginLeft;
  58604. margin.right = node.para.marginRight === "" ? 0 : node.para.marginRight;
  58605. }
  58606. let font = node.font;
  58607. if (!font) {
  58608. const root = node[_xfa_object.$getTemplateRoot]();
  58609. let parent = node[_xfa_object.$getParent]();
  58610. while (parent && parent !== root) {
  58611. if (parent.font) {
  58612. font = parent.font;
  58613. break;
  58614. }
  58615. parent = parent[_xfa_object.$getParent]();
  58616. }
  58617. }
  58618. const maxWidth = (node.w || availableSpace.width) - marginH;
  58619. const fontFinder = node[_xfa_object.$globalData].fontFinder;
  58620. if (node.value.exData && node.value.exData[_xfa_object.$content] && node.value.exData.contentType === "text/html") {
  58621. const res = layoutText(node.value.exData[_xfa_object.$content], font, margin, lineHeight, fontFinder, maxWidth);
  58622. width = res.width;
  58623. height = res.height;
  58624. isBroken = res.isBroken;
  58625. } else {
  58626. const text = node.value[_xfa_object.$text]();
  58627. if (text) {
  58628. const res = layoutText(text, font, margin, lineHeight, fontFinder, maxWidth);
  58629. width = res.width;
  58630. height = res.height;
  58631. isBroken = res.isBroken;
  58632. }
  58633. }
  58634. if (width !== null && !node.w) {
  58635. width += marginH;
  58636. }
  58637. if (height !== null && !node.h) {
  58638. height += marginV;
  58639. }
  58640. }
  58641. return {
  58642. w: width,
  58643. h: height,
  58644. isBroken
  58645. };
  58646. }
  58647. function computeBbox(node, html, availableSpace) {
  58648. let bbox;
  58649. if (node.w !== "" && node.h !== "") {
  58650. bbox = [node.x, node.y, node.w, node.h];
  58651. } else {
  58652. if (!availableSpace) {
  58653. return null;
  58654. }
  58655. let width = node.w;
  58656. if (width === "") {
  58657. if (node.maxW === 0) {
  58658. const parent = node[_xfa_object.$getSubformParent]();
  58659. if (parent.layout === "position" && parent.w !== "") {
  58660. width = 0;
  58661. } else {
  58662. width = node.minW;
  58663. }
  58664. } else {
  58665. width = Math.min(node.maxW, availableSpace.width);
  58666. }
  58667. html.attributes.style.width = measureToString(width);
  58668. }
  58669. let height = node.h;
  58670. if (height === "") {
  58671. if (node.maxH === 0) {
  58672. const parent = node[_xfa_object.$getSubformParent]();
  58673. if (parent.layout === "position" && parent.h !== "") {
  58674. height = 0;
  58675. } else {
  58676. height = node.minH;
  58677. }
  58678. } else {
  58679. height = Math.min(node.maxH, availableSpace.height);
  58680. }
  58681. html.attributes.style.height = measureToString(height);
  58682. }
  58683. bbox = [node.x, node.y, width, height];
  58684. }
  58685. return bbox;
  58686. }
  58687. function fixDimensions(node) {
  58688. const parent = node[_xfa_object.$getSubformParent]();
  58689. if (parent.layout && parent.layout.includes("row")) {
  58690. const extra = parent[_xfa_object.$extra];
  58691. const colSpan = node.colSpan;
  58692. let width;
  58693. if (colSpan === -1) {
  58694. width = extra.columnWidths.slice(extra.currentColumn).reduce((a, w) => a + w, 0);
  58695. } else {
  58696. width = extra.columnWidths.slice(extra.currentColumn, extra.currentColumn + colSpan).reduce((a, w) => a + w, 0);
  58697. }
  58698. if (!isNaN(width)) {
  58699. node.w = width;
  58700. }
  58701. }
  58702. if (parent.layout && parent.layout !== "position") {
  58703. node.x = node.y = 0;
  58704. }
  58705. if (node.layout === "table") {
  58706. if (node.w === "" && Array.isArray(node.columnWidths)) {
  58707. node.w = node.columnWidths.reduce((a, x) => a + x, 0);
  58708. }
  58709. }
  58710. }
  58711. function layoutClass(node) {
  58712. switch (node.layout) {
  58713. case "position":
  58714. return "xfaPosition";
  58715. case "lr-tb":
  58716. return "xfaLrTb";
  58717. case "rl-row":
  58718. return "xfaRlRow";
  58719. case "rl-tb":
  58720. return "xfaRlTb";
  58721. case "row":
  58722. return "xfaRow";
  58723. case "table":
  58724. return "xfaTable";
  58725. case "tb":
  58726. return "xfaTb";
  58727. default:
  58728. return "xfaPosition";
  58729. }
  58730. }
  58731. function toStyle(node, ...names) {
  58732. const style = Object.create(null);
  58733. for (const name of names) {
  58734. const value = node[name];
  58735. if (value === null) {
  58736. continue;
  58737. }
  58738. if (converters.hasOwnProperty(name)) {
  58739. converters[name](node, style);
  58740. continue;
  58741. }
  58742. if (value instanceof _xfa_object.XFAObject) {
  58743. const newStyle = value[_xfa_object.$toStyle]();
  58744. if (newStyle) {
  58745. Object.assign(style, newStyle);
  58746. } else {
  58747. (0, _util.warn)(`(DEBUG) - XFA - style for ${name} not implemented yet`);
  58748. }
  58749. }
  58750. }
  58751. return style;
  58752. }
  58753. function createWrapper(node, html) {
  58754. const {
  58755. attributes
  58756. } = html;
  58757. const {
  58758. style
  58759. } = attributes;
  58760. const wrapper = {
  58761. name: "div",
  58762. attributes: {
  58763. class: ["xfaWrapper"],
  58764. style: Object.create(null)
  58765. },
  58766. children: []
  58767. };
  58768. attributes.class.push("xfaWrapped");
  58769. if (node.border) {
  58770. const {
  58771. widths,
  58772. insets
  58773. } = node.border[_xfa_object.$extra];
  58774. let width, height;
  58775. let top = insets[0];
  58776. let left = insets[3];
  58777. const insetsH = insets[0] + insets[2];
  58778. const insetsW = insets[1] + insets[3];
  58779. switch (node.border.hand) {
  58780. case "even":
  58781. top -= widths[0] / 2;
  58782. left -= widths[3] / 2;
  58783. width = `calc(100% + ${(widths[1] + widths[3]) / 2 - insetsW}px)`;
  58784. height = `calc(100% + ${(widths[0] + widths[2]) / 2 - insetsH}px)`;
  58785. break;
  58786. case "left":
  58787. top -= widths[0];
  58788. left -= widths[3];
  58789. width = `calc(100% + ${widths[1] + widths[3] - insetsW}px)`;
  58790. height = `calc(100% + ${widths[0] + widths[2] - insetsH}px)`;
  58791. break;
  58792. case "right":
  58793. width = insetsW ? `calc(100% - ${insetsW}px)` : "100%";
  58794. height = insetsH ? `calc(100% - ${insetsH}px)` : "100%";
  58795. break;
  58796. }
  58797. const classNames = ["xfaBorder"];
  58798. if (isPrintOnly(node.border)) {
  58799. classNames.push("xfaPrintOnly");
  58800. }
  58801. const border = {
  58802. name: "div",
  58803. attributes: {
  58804. class: classNames,
  58805. style: {
  58806. top: `${top}px`,
  58807. left: `${left}px`,
  58808. width,
  58809. height
  58810. }
  58811. },
  58812. children: []
  58813. };
  58814. for (const key of ["border", "borderWidth", "borderColor", "borderRadius", "borderStyle"]) {
  58815. if (style[key] !== undefined) {
  58816. border.attributes.style[key] = style[key];
  58817. delete style[key];
  58818. }
  58819. }
  58820. wrapper.children.push(border, html);
  58821. } else {
  58822. wrapper.children.push(html);
  58823. }
  58824. for (const key of ["background", "backgroundClip", "top", "left", "width", "height", "minWidth", "minHeight", "maxWidth", "maxHeight", "transform", "transformOrigin", "visibility"]) {
  58825. if (style[key] !== undefined) {
  58826. wrapper.attributes.style[key] = style[key];
  58827. delete style[key];
  58828. }
  58829. }
  58830. if (style.position === "absolute") {
  58831. wrapper.attributes.style.position = "absolute";
  58832. } else {
  58833. wrapper.attributes.style.position = "relative";
  58834. }
  58835. delete style.position;
  58836. if (style.alignSelf) {
  58837. wrapper.attributes.style.alignSelf = style.alignSelf;
  58838. delete style.alignSelf;
  58839. }
  58840. return wrapper;
  58841. }
  58842. function fixTextIndent(styles) {
  58843. const indent = (0, _utils.getMeasurement)(styles.textIndent, "0px");
  58844. if (indent >= 0) {
  58845. return;
  58846. }
  58847. const align = styles.textAlign === "right" ? "right" : "left";
  58848. const name = "padding" + (align === "left" ? "Left" : "Right");
  58849. const padding = (0, _utils.getMeasurement)(styles[name], "0px");
  58850. styles[name] = `${padding - indent}px`;
  58851. }
  58852. function setAccess(node, classNames) {
  58853. switch (node.access) {
  58854. case "nonInteractive":
  58855. classNames.push("xfaNonInteractive");
  58856. break;
  58857. case "readOnly":
  58858. classNames.push("xfaReadOnly");
  58859. break;
  58860. case "protected":
  58861. classNames.push("xfaDisabled");
  58862. break;
  58863. }
  58864. }
  58865. function isPrintOnly(node) {
  58866. return node.relevant.length > 0 && !node.relevant[0].excluded && node.relevant[0].viewname === "print";
  58867. }
  58868. function getCurrentPara(node) {
  58869. const stack = node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].paraStack;
  58870. return stack.length ? stack.at(-1) : null;
  58871. }
  58872. function setPara(node, nodeStyle, value) {
  58873. if (value.attributes.class && value.attributes.class.includes("xfaRich")) {
  58874. if (nodeStyle) {
  58875. if (node.h === "") {
  58876. nodeStyle.height = "auto";
  58877. }
  58878. if (node.w === "") {
  58879. nodeStyle.width = "auto";
  58880. }
  58881. }
  58882. const para = getCurrentPara(node);
  58883. if (para) {
  58884. const valueStyle = value.attributes.style;
  58885. valueStyle.display = "flex";
  58886. valueStyle.flexDirection = "column";
  58887. switch (para.vAlign) {
  58888. case "top":
  58889. valueStyle.justifyContent = "start";
  58890. break;
  58891. case "bottom":
  58892. valueStyle.justifyContent = "end";
  58893. break;
  58894. case "middle":
  58895. valueStyle.justifyContent = "center";
  58896. break;
  58897. }
  58898. const paraStyle = para[_xfa_object.$toStyle]();
  58899. for (const [key, val] of Object.entries(paraStyle)) {
  58900. if (!(key in valueStyle)) {
  58901. valueStyle[key] = val;
  58902. }
  58903. }
  58904. }
  58905. }
  58906. }
  58907. function setFontFamily(xfaFont, node, fontFinder, style) {
  58908. if (!fontFinder) {
  58909. delete style.fontFamily;
  58910. return;
  58911. }
  58912. const name = (0, _utils.stripQuotes)(xfaFont.typeface);
  58913. style.fontFamily = `"${name}"`;
  58914. const typeface = fontFinder.find(name);
  58915. if (typeface) {
  58916. const {
  58917. fontFamily
  58918. } = typeface.regular.cssFontInfo;
  58919. if (fontFamily !== name) {
  58920. style.fontFamily = `"${fontFamily}"`;
  58921. }
  58922. const para = getCurrentPara(node);
  58923. if (para && para.lineHeight !== "") {
  58924. return;
  58925. }
  58926. if (style.lineHeight) {
  58927. return;
  58928. }
  58929. const pdfFont = (0, _fonts.selectFont)(xfaFont, typeface);
  58930. if (pdfFont) {
  58931. style.lineHeight = Math.max(1.2, pdfFont.lineHeight);
  58932. }
  58933. }
  58934. }
  58935. function fixURL(str) {
  58936. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(str, null, {
  58937. addDefaultProtocol: true,
  58938. tryConvertEncoding: true
  58939. });
  58940. return absoluteUrl ? absoluteUrl.href : null;
  58941. }
  58942. /***/ }),
  58943. /* 85 */
  58944. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  58945. Object.defineProperty(exports, "__esModule", ({
  58946. value: true
  58947. }));
  58948. exports.FontFinder = void 0;
  58949. exports.getMetrics = getMetrics;
  58950. exports.selectFont = selectFont;
  58951. var _xfa_object = __w_pdfjs_require__(77);
  58952. var _utils = __w_pdfjs_require__(78);
  58953. var _util = __w_pdfjs_require__(2);
  58954. class FontFinder {
  58955. constructor(pdfFonts) {
  58956. this.fonts = new Map();
  58957. this.cache = new Map();
  58958. this.warned = new Set();
  58959. this.defaultFont = null;
  58960. this.add(pdfFonts);
  58961. }
  58962. add(pdfFonts, reallyMissingFonts = null) {
  58963. for (const pdfFont of pdfFonts) {
  58964. this.addPdfFont(pdfFont);
  58965. }
  58966. for (const pdfFont of this.fonts.values()) {
  58967. if (!pdfFont.regular) {
  58968. pdfFont.regular = pdfFont.italic || pdfFont.bold || pdfFont.bolditalic;
  58969. }
  58970. }
  58971. if (!reallyMissingFonts || reallyMissingFonts.size === 0) {
  58972. return;
  58973. }
  58974. const myriad = this.fonts.get("PdfJS-Fallback-PdfJS-XFA");
  58975. for (const missing of reallyMissingFonts) {
  58976. this.fonts.set(missing, myriad);
  58977. }
  58978. }
  58979. addPdfFont(pdfFont) {
  58980. const cssFontInfo = pdfFont.cssFontInfo;
  58981. const name = cssFontInfo.fontFamily;
  58982. let font = this.fonts.get(name);
  58983. if (!font) {
  58984. font = Object.create(null);
  58985. this.fonts.set(name, font);
  58986. if (!this.defaultFont) {
  58987. this.defaultFont = font;
  58988. }
  58989. }
  58990. let property = "";
  58991. const fontWeight = parseFloat(cssFontInfo.fontWeight);
  58992. if (parseFloat(cssFontInfo.italicAngle) !== 0) {
  58993. property = fontWeight >= 700 ? "bolditalic" : "italic";
  58994. } else if (fontWeight >= 700) {
  58995. property = "bold";
  58996. }
  58997. if (!property) {
  58998. if (pdfFont.name.includes("Bold") || pdfFont.psName && pdfFont.psName.includes("Bold")) {
  58999. property = "bold";
  59000. }
  59001. if (pdfFont.name.includes("Italic") || pdfFont.name.endsWith("It") || pdfFont.psName && (pdfFont.psName.includes("Italic") || pdfFont.psName.endsWith("It"))) {
  59002. property += "italic";
  59003. }
  59004. }
  59005. if (!property) {
  59006. property = "regular";
  59007. }
  59008. font[property] = pdfFont;
  59009. }
  59010. getDefault() {
  59011. return this.defaultFont;
  59012. }
  59013. find(fontName, mustWarn = true) {
  59014. let font = this.fonts.get(fontName) || this.cache.get(fontName);
  59015. if (font) {
  59016. return font;
  59017. }
  59018. const pattern = /,|-|_| |bolditalic|bold|italic|regular|it/gi;
  59019. let name = fontName.replace(pattern, "");
  59020. font = this.fonts.get(name);
  59021. if (font) {
  59022. this.cache.set(fontName, font);
  59023. return font;
  59024. }
  59025. name = name.toLowerCase();
  59026. const maybe = [];
  59027. for (const [family, pdfFont] of this.fonts.entries()) {
  59028. if (family.replace(pattern, "").toLowerCase().startsWith(name)) {
  59029. maybe.push(pdfFont);
  59030. }
  59031. }
  59032. if (maybe.length === 0) {
  59033. for (const [, pdfFont] of this.fonts.entries()) {
  59034. if (pdfFont.regular.name && pdfFont.regular.name.replace(pattern, "").toLowerCase().startsWith(name)) {
  59035. maybe.push(pdfFont);
  59036. }
  59037. }
  59038. }
  59039. if (maybe.length === 0) {
  59040. name = name.replace(/psmt|mt/gi, "");
  59041. for (const [family, pdfFont] of this.fonts.entries()) {
  59042. if (family.replace(pattern, "").toLowerCase().startsWith(name)) {
  59043. maybe.push(pdfFont);
  59044. }
  59045. }
  59046. }
  59047. if (maybe.length === 0) {
  59048. for (const pdfFont of this.fonts.values()) {
  59049. if (pdfFont.regular.name && pdfFont.regular.name.replace(pattern, "").toLowerCase().startsWith(name)) {
  59050. maybe.push(pdfFont);
  59051. }
  59052. }
  59053. }
  59054. if (maybe.length >= 1) {
  59055. if (maybe.length !== 1 && mustWarn) {
  59056. (0, _util.warn)(`XFA - Too many choices to guess the correct font: ${fontName}`);
  59057. }
  59058. this.cache.set(fontName, maybe[0]);
  59059. return maybe[0];
  59060. }
  59061. if (mustWarn && !this.warned.has(fontName)) {
  59062. this.warned.add(fontName);
  59063. (0, _util.warn)(`XFA - Cannot find the font: ${fontName}`);
  59064. }
  59065. return null;
  59066. }
  59067. }
  59068. exports.FontFinder = FontFinder;
  59069. function selectFont(xfaFont, typeface) {
  59070. if (xfaFont.posture === "italic") {
  59071. if (xfaFont.weight === "bold") {
  59072. return typeface.bolditalic;
  59073. }
  59074. return typeface.italic;
  59075. } else if (xfaFont.weight === "bold") {
  59076. return typeface.bold;
  59077. }
  59078. return typeface.regular;
  59079. }
  59080. function getMetrics(xfaFont, real = false) {
  59081. let pdfFont = null;
  59082. if (xfaFont) {
  59083. const name = (0, _utils.stripQuotes)(xfaFont.typeface);
  59084. const typeface = xfaFont[_xfa_object.$globalData].fontFinder.find(name);
  59085. pdfFont = selectFont(xfaFont, typeface);
  59086. }
  59087. if (!pdfFont) {
  59088. return {
  59089. lineHeight: 12,
  59090. lineGap: 2,
  59091. lineNoGap: 10
  59092. };
  59093. }
  59094. const size = xfaFont.size || 10;
  59095. const lineHeight = pdfFont.lineHeight ? Math.max(real ? 0 : 1.2, pdfFont.lineHeight) : 1.2;
  59096. const lineGap = pdfFont.lineGap === undefined ? 0.2 : pdfFont.lineGap;
  59097. return {
  59098. lineHeight: lineHeight * size,
  59099. lineGap: lineGap * size,
  59100. lineNoGap: Math.max(1, lineHeight - lineGap) * size
  59101. };
  59102. }
  59103. /***/ }),
  59104. /* 86 */
  59105. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  59106. Object.defineProperty(exports, "__esModule", ({
  59107. value: true
  59108. }));
  59109. exports.TextMeasure = void 0;
  59110. var _fonts = __w_pdfjs_require__(85);
  59111. const WIDTH_FACTOR = 1.02;
  59112. class FontInfo {
  59113. constructor(xfaFont, margin, lineHeight, fontFinder) {
  59114. this.lineHeight = lineHeight;
  59115. this.paraMargin = margin || {
  59116. top: 0,
  59117. bottom: 0,
  59118. left: 0,
  59119. right: 0
  59120. };
  59121. if (!xfaFont) {
  59122. [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder);
  59123. return;
  59124. }
  59125. this.xfaFont = {
  59126. typeface: xfaFont.typeface,
  59127. posture: xfaFont.posture,
  59128. weight: xfaFont.weight,
  59129. size: xfaFont.size,
  59130. letterSpacing: xfaFont.letterSpacing
  59131. };
  59132. const typeface = fontFinder.find(xfaFont.typeface);
  59133. if (!typeface) {
  59134. [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder);
  59135. return;
  59136. }
  59137. this.pdfFont = (0, _fonts.selectFont)(xfaFont, typeface);
  59138. if (!this.pdfFont) {
  59139. [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder);
  59140. }
  59141. }
  59142. defaultFont(fontFinder) {
  59143. const font = fontFinder.find("Helvetica", false) || fontFinder.find("Myriad Pro", false) || fontFinder.find("Arial", false) || fontFinder.getDefault();
  59144. if (font && font.regular) {
  59145. const pdfFont = font.regular;
  59146. const info = pdfFont.cssFontInfo;
  59147. const xfaFont = {
  59148. typeface: info.fontFamily,
  59149. posture: "normal",
  59150. weight: "normal",
  59151. size: 10,
  59152. letterSpacing: 0
  59153. };
  59154. return [pdfFont, xfaFont];
  59155. }
  59156. const xfaFont = {
  59157. typeface: "Courier",
  59158. posture: "normal",
  59159. weight: "normal",
  59160. size: 10,
  59161. letterSpacing: 0
  59162. };
  59163. return [null, xfaFont];
  59164. }
  59165. }
  59166. class FontSelector {
  59167. constructor(defaultXfaFont, defaultParaMargin, defaultLineHeight, fontFinder) {
  59168. this.fontFinder = fontFinder;
  59169. this.stack = [new FontInfo(defaultXfaFont, defaultParaMargin, defaultLineHeight, fontFinder)];
  59170. }
  59171. pushData(xfaFont, margin, lineHeight) {
  59172. const lastFont = this.stack.at(-1);
  59173. for (const name of ["typeface", "posture", "weight", "size", "letterSpacing"]) {
  59174. if (!xfaFont[name]) {
  59175. xfaFont[name] = lastFont.xfaFont[name];
  59176. }
  59177. }
  59178. for (const name of ["top", "bottom", "left", "right"]) {
  59179. if (isNaN(margin[name])) {
  59180. margin[name] = lastFont.paraMargin[name];
  59181. }
  59182. }
  59183. const fontInfo = new FontInfo(xfaFont, margin, lineHeight || lastFont.lineHeight, this.fontFinder);
  59184. if (!fontInfo.pdfFont) {
  59185. fontInfo.pdfFont = lastFont.pdfFont;
  59186. }
  59187. this.stack.push(fontInfo);
  59188. }
  59189. popFont() {
  59190. this.stack.pop();
  59191. }
  59192. topFont() {
  59193. return this.stack.at(-1);
  59194. }
  59195. }
  59196. class TextMeasure {
  59197. constructor(defaultXfaFont, defaultParaMargin, defaultLineHeight, fonts) {
  59198. this.glyphs = [];
  59199. this.fontSelector = new FontSelector(defaultXfaFont, defaultParaMargin, defaultLineHeight, fonts);
  59200. this.extraHeight = 0;
  59201. }
  59202. pushData(xfaFont, margin, lineHeight) {
  59203. this.fontSelector.pushData(xfaFont, margin, lineHeight);
  59204. }
  59205. popFont(xfaFont) {
  59206. return this.fontSelector.popFont();
  59207. }
  59208. addPara() {
  59209. const lastFont = this.fontSelector.topFont();
  59210. this.extraHeight += lastFont.paraMargin.top + lastFont.paraMargin.bottom;
  59211. }
  59212. addString(str) {
  59213. if (!str) {
  59214. return;
  59215. }
  59216. const lastFont = this.fontSelector.topFont();
  59217. const fontSize = lastFont.xfaFont.size;
  59218. if (lastFont.pdfFont) {
  59219. const letterSpacing = lastFont.xfaFont.letterSpacing;
  59220. const pdfFont = lastFont.pdfFont;
  59221. const fontLineHeight = pdfFont.lineHeight || 1.2;
  59222. const lineHeight = lastFont.lineHeight || Math.max(1.2, fontLineHeight) * fontSize;
  59223. const lineGap = pdfFont.lineGap === undefined ? 0.2 : pdfFont.lineGap;
  59224. const noGap = fontLineHeight - lineGap;
  59225. const firstLineHeight = Math.max(1, noGap) * fontSize;
  59226. const scale = fontSize / 1000;
  59227. const fallbackWidth = pdfFont.defaultWidth || pdfFont.charsToGlyphs(" ")[0].width;
  59228. for (const line of str.split(/[\u2029\n]/)) {
  59229. const encodedLine = pdfFont.encodeString(line).join("");
  59230. const glyphs = pdfFont.charsToGlyphs(encodedLine);
  59231. for (const glyph of glyphs) {
  59232. const width = glyph.width || fallbackWidth;
  59233. this.glyphs.push([width * scale + letterSpacing, lineHeight, firstLineHeight, glyph.unicode, false]);
  59234. }
  59235. this.glyphs.push([0, 0, 0, "\n", true]);
  59236. }
  59237. this.glyphs.pop();
  59238. return;
  59239. }
  59240. for (const line of str.split(/[\u2029\n]/)) {
  59241. for (const char of line.split("")) {
  59242. this.glyphs.push([fontSize, 1.2 * fontSize, fontSize, char, false]);
  59243. }
  59244. this.glyphs.push([0, 0, 0, "\n", true]);
  59245. }
  59246. this.glyphs.pop();
  59247. }
  59248. compute(maxWidth) {
  59249. let lastSpacePos = -1,
  59250. lastSpaceWidth = 0,
  59251. width = 0,
  59252. height = 0,
  59253. currentLineWidth = 0,
  59254. currentLineHeight = 0;
  59255. let isBroken = false;
  59256. let isFirstLine = true;
  59257. for (let i = 0, ii = this.glyphs.length; i < ii; i++) {
  59258. const [glyphWidth, lineHeight, firstLineHeight, char, isEOL] = this.glyphs[i];
  59259. const isSpace = char === " ";
  59260. const glyphHeight = isFirstLine ? firstLineHeight : lineHeight;
  59261. if (isEOL) {
  59262. width = Math.max(width, currentLineWidth);
  59263. currentLineWidth = 0;
  59264. height += currentLineHeight;
  59265. currentLineHeight = glyphHeight;
  59266. lastSpacePos = -1;
  59267. lastSpaceWidth = 0;
  59268. isFirstLine = false;
  59269. continue;
  59270. }
  59271. if (isSpace) {
  59272. if (currentLineWidth + glyphWidth > maxWidth) {
  59273. width = Math.max(width, currentLineWidth);
  59274. currentLineWidth = 0;
  59275. height += currentLineHeight;
  59276. currentLineHeight = glyphHeight;
  59277. lastSpacePos = -1;
  59278. lastSpaceWidth = 0;
  59279. isBroken = true;
  59280. isFirstLine = false;
  59281. } else {
  59282. currentLineHeight = Math.max(glyphHeight, currentLineHeight);
  59283. lastSpaceWidth = currentLineWidth;
  59284. currentLineWidth += glyphWidth;
  59285. lastSpacePos = i;
  59286. }
  59287. continue;
  59288. }
  59289. if (currentLineWidth + glyphWidth > maxWidth) {
  59290. height += currentLineHeight;
  59291. currentLineHeight = glyphHeight;
  59292. if (lastSpacePos !== -1) {
  59293. i = lastSpacePos;
  59294. width = Math.max(width, lastSpaceWidth);
  59295. currentLineWidth = 0;
  59296. lastSpacePos = -1;
  59297. lastSpaceWidth = 0;
  59298. } else {
  59299. width = Math.max(width, currentLineWidth);
  59300. currentLineWidth = glyphWidth;
  59301. }
  59302. isBroken = true;
  59303. isFirstLine = false;
  59304. continue;
  59305. }
  59306. currentLineWidth += glyphWidth;
  59307. currentLineHeight = Math.max(glyphHeight, currentLineHeight);
  59308. }
  59309. width = Math.max(width, currentLineWidth);
  59310. height += currentLineHeight + this.extraHeight;
  59311. return {
  59312. width: WIDTH_FACTOR * width,
  59313. height,
  59314. isBroken
  59315. };
  59316. }
  59317. }
  59318. exports.TextMeasure = TextMeasure;
  59319. /***/ }),
  59320. /* 87 */
  59321. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  59322. Object.defineProperty(exports, "__esModule", ({
  59323. value: true
  59324. }));
  59325. exports.DataHandler = void 0;
  59326. var _xfa_object = __w_pdfjs_require__(77);
  59327. class DataHandler {
  59328. constructor(root, data) {
  59329. this.data = data;
  59330. this.dataset = root.datasets || null;
  59331. }
  59332. serialize(storage) {
  59333. const stack = [[-1, this.data[_xfa_object.$getChildren]()]];
  59334. while (stack.length > 0) {
  59335. const last = stack.at(-1);
  59336. const [i, children] = last;
  59337. if (i + 1 === children.length) {
  59338. stack.pop();
  59339. continue;
  59340. }
  59341. const child = children[++last[0]];
  59342. const storageEntry = storage.get(child[_xfa_object.$uid]);
  59343. if (storageEntry) {
  59344. child[_xfa_object.$setValue](storageEntry);
  59345. } else {
  59346. const attributes = child[_xfa_object.$getAttributes]();
  59347. for (const value of attributes.values()) {
  59348. const entry = storage.get(value[_xfa_object.$uid]);
  59349. if (entry) {
  59350. value[_xfa_object.$setValue](entry);
  59351. break;
  59352. }
  59353. }
  59354. }
  59355. const nodes = child[_xfa_object.$getChildren]();
  59356. if (nodes.length > 0) {
  59357. stack.push([-1, nodes]);
  59358. }
  59359. }
  59360. const buf = [`<xfa:datasets xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/">`];
  59361. if (this.dataset) {
  59362. for (const child of this.dataset[_xfa_object.$getChildren]()) {
  59363. if (child[_xfa_object.$nodeName] !== "data") {
  59364. child[_xfa_object.$toString](buf);
  59365. }
  59366. }
  59367. }
  59368. this.data[_xfa_object.$toString](buf);
  59369. buf.push("</xfa:datasets>");
  59370. return buf.join("");
  59371. }
  59372. }
  59373. exports.DataHandler = DataHandler;
  59374. /***/ }),
  59375. /* 88 */
  59376. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  59377. Object.defineProperty(exports, "__esModule", ({
  59378. value: true
  59379. }));
  59380. exports.XFAParser = void 0;
  59381. var _xfa_object = __w_pdfjs_require__(77);
  59382. var _xml_parser = __w_pdfjs_require__(66);
  59383. var _builder = __w_pdfjs_require__(89);
  59384. var _util = __w_pdfjs_require__(2);
  59385. class XFAParser extends _xml_parser.XMLParserBase {
  59386. constructor(rootNameSpace = null, richText = false) {
  59387. super();
  59388. this._builder = new _builder.Builder(rootNameSpace);
  59389. this._stack = [];
  59390. this._globalData = {
  59391. usedTypefaces: new Set()
  59392. };
  59393. this._ids = new Map();
  59394. this._current = this._builder.buildRoot(this._ids);
  59395. this._errorCode = _xml_parser.XMLParserErrorCode.NoError;
  59396. this._whiteRegex = /^\s+$/;
  59397. this._nbsps = /\xa0+/g;
  59398. this._richText = richText;
  59399. }
  59400. parse(data) {
  59401. this.parseXml(data);
  59402. if (this._errorCode !== _xml_parser.XMLParserErrorCode.NoError) {
  59403. return undefined;
  59404. }
  59405. this._current[_xfa_object.$finalize]();
  59406. return this._current.element;
  59407. }
  59408. onText(text) {
  59409. text = text.replace(this._nbsps, match => match.slice(1) + " ");
  59410. if (this._richText || this._current[_xfa_object.$acceptWhitespace]()) {
  59411. this._current[_xfa_object.$onText](text, this._richText);
  59412. return;
  59413. }
  59414. if (this._whiteRegex.test(text)) {
  59415. return;
  59416. }
  59417. this._current[_xfa_object.$onText](text.trim());
  59418. }
  59419. onCdata(text) {
  59420. this._current[_xfa_object.$onText](text);
  59421. }
  59422. _mkAttributes(attributes, tagName) {
  59423. let namespace = null;
  59424. let prefixes = null;
  59425. const attributeObj = Object.create({});
  59426. for (const {
  59427. name,
  59428. value
  59429. } of attributes) {
  59430. if (name === "xmlns") {
  59431. if (!namespace) {
  59432. namespace = value;
  59433. } else {
  59434. (0, _util.warn)(`XFA - multiple namespace definition in <${tagName}>`);
  59435. }
  59436. } else if (name.startsWith("xmlns:")) {
  59437. const prefix = name.substring("xmlns:".length);
  59438. if (!prefixes) {
  59439. prefixes = [];
  59440. }
  59441. prefixes.push({
  59442. prefix,
  59443. value
  59444. });
  59445. } else {
  59446. const i = name.indexOf(":");
  59447. if (i === -1) {
  59448. attributeObj[name] = value;
  59449. } else {
  59450. let nsAttrs = attributeObj[_xfa_object.$nsAttributes];
  59451. if (!nsAttrs) {
  59452. nsAttrs = attributeObj[_xfa_object.$nsAttributes] = Object.create(null);
  59453. }
  59454. const [ns, attrName] = [name.slice(0, i), name.slice(i + 1)];
  59455. let attrs = nsAttrs[ns];
  59456. if (!attrs) {
  59457. attrs = nsAttrs[ns] = Object.create(null);
  59458. }
  59459. attrs[attrName] = value;
  59460. }
  59461. }
  59462. }
  59463. return [namespace, prefixes, attributeObj];
  59464. }
  59465. _getNameAndPrefix(name, nsAgnostic) {
  59466. const i = name.indexOf(":");
  59467. if (i === -1) {
  59468. return [name, null];
  59469. }
  59470. return [name.substring(i + 1), nsAgnostic ? "" : name.substring(0, i)];
  59471. }
  59472. onBeginElement(tagName, attributes, isEmpty) {
  59473. const [namespace, prefixes, attributesObj] = this._mkAttributes(attributes, tagName);
  59474. const [name, nsPrefix] = this._getNameAndPrefix(tagName, this._builder.isNsAgnostic());
  59475. const node = this._builder.build({
  59476. nsPrefix,
  59477. name,
  59478. attributes: attributesObj,
  59479. namespace,
  59480. prefixes
  59481. });
  59482. node[_xfa_object.$globalData] = this._globalData;
  59483. if (isEmpty) {
  59484. node[_xfa_object.$finalize]();
  59485. if (this._current[_xfa_object.$onChild](node)) {
  59486. node[_xfa_object.$setId](this._ids);
  59487. }
  59488. node[_xfa_object.$clean](this._builder);
  59489. return;
  59490. }
  59491. this._stack.push(this._current);
  59492. this._current = node;
  59493. }
  59494. onEndElement(name) {
  59495. const node = this._current;
  59496. if (node[_xfa_object.$isCDATAXml]() && typeof node[_xfa_object.$content] === "string") {
  59497. const parser = new XFAParser();
  59498. parser._globalData = this._globalData;
  59499. const root = parser.parse(node[_xfa_object.$content]);
  59500. node[_xfa_object.$content] = null;
  59501. node[_xfa_object.$onChild](root);
  59502. }
  59503. node[_xfa_object.$finalize]();
  59504. this._current = this._stack.pop();
  59505. if (this._current[_xfa_object.$onChild](node)) {
  59506. node[_xfa_object.$setId](this._ids);
  59507. }
  59508. node[_xfa_object.$clean](this._builder);
  59509. }
  59510. onError(code) {
  59511. this._errorCode = code;
  59512. }
  59513. }
  59514. exports.XFAParser = XFAParser;
  59515. /***/ }),
  59516. /* 89 */
  59517. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  59518. Object.defineProperty(exports, "__esModule", ({
  59519. value: true
  59520. }));
  59521. exports.Builder = void 0;
  59522. var _namespaces = __w_pdfjs_require__(79);
  59523. var _xfa_object = __w_pdfjs_require__(77);
  59524. var _setup = __w_pdfjs_require__(90);
  59525. var _template = __w_pdfjs_require__(82);
  59526. var _unknown = __w_pdfjs_require__(99);
  59527. var _util = __w_pdfjs_require__(2);
  59528. class Root extends _xfa_object.XFAObject {
  59529. constructor(ids) {
  59530. super(-1, "root", Object.create(null));
  59531. this.element = null;
  59532. this[_xfa_object.$ids] = ids;
  59533. }
  59534. [_xfa_object.$onChild](child) {
  59535. this.element = child;
  59536. return true;
  59537. }
  59538. [_xfa_object.$finalize]() {
  59539. super[_xfa_object.$finalize]();
  59540. if (this.element.template instanceof _template.Template) {
  59541. this[_xfa_object.$ids].set(_xfa_object.$root, this.element);
  59542. this.element.template[_xfa_object.$resolvePrototypes](this[_xfa_object.$ids]);
  59543. this.element.template[_xfa_object.$ids] = this[_xfa_object.$ids];
  59544. }
  59545. }
  59546. }
  59547. class Empty extends _xfa_object.XFAObject {
  59548. constructor() {
  59549. super(-1, "", Object.create(null));
  59550. }
  59551. [_xfa_object.$onChild](_) {
  59552. return false;
  59553. }
  59554. }
  59555. class Builder {
  59556. constructor(rootNameSpace = null) {
  59557. this._namespaceStack = [];
  59558. this._nsAgnosticLevel = 0;
  59559. this._namespacePrefixes = new Map();
  59560. this._namespaces = new Map();
  59561. this._nextNsId = Math.max(...Object.values(_namespaces.NamespaceIds).map(({
  59562. id
  59563. }) => id));
  59564. this._currentNamespace = rootNameSpace || new _unknown.UnknownNamespace(++this._nextNsId);
  59565. }
  59566. buildRoot(ids) {
  59567. return new Root(ids);
  59568. }
  59569. build({
  59570. nsPrefix,
  59571. name,
  59572. attributes,
  59573. namespace,
  59574. prefixes
  59575. }) {
  59576. const hasNamespaceDef = namespace !== null;
  59577. if (hasNamespaceDef) {
  59578. this._namespaceStack.push(this._currentNamespace);
  59579. this._currentNamespace = this._searchNamespace(namespace);
  59580. }
  59581. if (prefixes) {
  59582. this._addNamespacePrefix(prefixes);
  59583. }
  59584. if (attributes.hasOwnProperty(_xfa_object.$nsAttributes)) {
  59585. const dataTemplate = _setup.NamespaceSetUp.datasets;
  59586. const nsAttrs = attributes[_xfa_object.$nsAttributes];
  59587. let xfaAttrs = null;
  59588. for (const [ns, attrs] of Object.entries(nsAttrs)) {
  59589. const nsToUse = this._getNamespaceToUse(ns);
  59590. if (nsToUse === dataTemplate) {
  59591. xfaAttrs = {
  59592. xfa: attrs
  59593. };
  59594. break;
  59595. }
  59596. }
  59597. if (xfaAttrs) {
  59598. attributes[_xfa_object.$nsAttributes] = xfaAttrs;
  59599. } else {
  59600. delete attributes[_xfa_object.$nsAttributes];
  59601. }
  59602. }
  59603. const namespaceToUse = this._getNamespaceToUse(nsPrefix);
  59604. const node = namespaceToUse && namespaceToUse[_namespaces.$buildXFAObject](name, attributes) || new Empty();
  59605. if (node[_xfa_object.$isNsAgnostic]()) {
  59606. this._nsAgnosticLevel++;
  59607. }
  59608. if (hasNamespaceDef || prefixes || node[_xfa_object.$isNsAgnostic]()) {
  59609. node[_xfa_object.$cleanup] = {
  59610. hasNamespace: hasNamespaceDef,
  59611. prefixes,
  59612. nsAgnostic: node[_xfa_object.$isNsAgnostic]()
  59613. };
  59614. }
  59615. return node;
  59616. }
  59617. isNsAgnostic() {
  59618. return this._nsAgnosticLevel > 0;
  59619. }
  59620. _searchNamespace(nsName) {
  59621. let ns = this._namespaces.get(nsName);
  59622. if (ns) {
  59623. return ns;
  59624. }
  59625. for (const [name, {
  59626. check
  59627. }] of Object.entries(_namespaces.NamespaceIds)) {
  59628. if (check(nsName)) {
  59629. ns = _setup.NamespaceSetUp[name];
  59630. if (ns) {
  59631. this._namespaces.set(nsName, ns);
  59632. return ns;
  59633. }
  59634. break;
  59635. }
  59636. }
  59637. ns = new _unknown.UnknownNamespace(++this._nextNsId);
  59638. this._namespaces.set(nsName, ns);
  59639. return ns;
  59640. }
  59641. _addNamespacePrefix(prefixes) {
  59642. for (const {
  59643. prefix,
  59644. value
  59645. } of prefixes) {
  59646. const namespace = this._searchNamespace(value);
  59647. let prefixStack = this._namespacePrefixes.get(prefix);
  59648. if (!prefixStack) {
  59649. prefixStack = [];
  59650. this._namespacePrefixes.set(prefix, prefixStack);
  59651. }
  59652. prefixStack.push(namespace);
  59653. }
  59654. }
  59655. _getNamespaceToUse(prefix) {
  59656. if (!prefix) {
  59657. return this._currentNamespace;
  59658. }
  59659. const prefixStack = this._namespacePrefixes.get(prefix);
  59660. if (prefixStack && prefixStack.length > 0) {
  59661. return prefixStack.at(-1);
  59662. }
  59663. (0, _util.warn)(`Unknown namespace prefix: ${prefix}.`);
  59664. return null;
  59665. }
  59666. clean(data) {
  59667. const {
  59668. hasNamespace,
  59669. prefixes,
  59670. nsAgnostic
  59671. } = data;
  59672. if (hasNamespace) {
  59673. this._currentNamespace = this._namespaceStack.pop();
  59674. }
  59675. if (prefixes) {
  59676. prefixes.forEach(({
  59677. prefix
  59678. }) => {
  59679. this._namespacePrefixes.get(prefix).pop();
  59680. });
  59681. }
  59682. if (nsAgnostic) {
  59683. this._nsAgnosticLevel--;
  59684. }
  59685. }
  59686. }
  59687. exports.Builder = Builder;
  59688. /***/ }),
  59689. /* 90 */
  59690. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  59691. Object.defineProperty(exports, "__esModule", ({
  59692. value: true
  59693. }));
  59694. exports.NamespaceSetUp = void 0;
  59695. var _config = __w_pdfjs_require__(91);
  59696. var _connection_set = __w_pdfjs_require__(92);
  59697. var _datasets = __w_pdfjs_require__(93);
  59698. var _locale_set = __w_pdfjs_require__(94);
  59699. var _signature = __w_pdfjs_require__(95);
  59700. var _stylesheet = __w_pdfjs_require__(96);
  59701. var _template = __w_pdfjs_require__(82);
  59702. var _xdp = __w_pdfjs_require__(97);
  59703. var _xhtml = __w_pdfjs_require__(98);
  59704. const NamespaceSetUp = {
  59705. config: _config.ConfigNamespace,
  59706. connection: _connection_set.ConnectionSetNamespace,
  59707. datasets: _datasets.DatasetsNamespace,
  59708. localeSet: _locale_set.LocaleSetNamespace,
  59709. signature: _signature.SignatureNamespace,
  59710. stylesheet: _stylesheet.StylesheetNamespace,
  59711. template: _template.TemplateNamespace,
  59712. xdp: _xdp.XdpNamespace,
  59713. xhtml: _xhtml.XhtmlNamespace
  59714. };
  59715. exports.NamespaceSetUp = NamespaceSetUp;
  59716. /***/ }),
  59717. /* 91 */
  59718. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  59719. Object.defineProperty(exports, "__esModule", ({
  59720. value: true
  59721. }));
  59722. exports.ConfigNamespace = void 0;
  59723. var _namespaces = __w_pdfjs_require__(79);
  59724. var _xfa_object = __w_pdfjs_require__(77);
  59725. var _utils = __w_pdfjs_require__(78);
  59726. var _util = __w_pdfjs_require__(2);
  59727. const CONFIG_NS_ID = _namespaces.NamespaceIds.config.id;
  59728. class Acrobat extends _xfa_object.XFAObject {
  59729. constructor(attributes) {
  59730. super(CONFIG_NS_ID, "acrobat", true);
  59731. this.acrobat7 = null;
  59732. this.autoSave = null;
  59733. this.common = null;
  59734. this.validate = null;
  59735. this.validateApprovalSignatures = null;
  59736. this.submitUrl = new _xfa_object.XFAObjectArray();
  59737. }
  59738. }
  59739. class Acrobat7 extends _xfa_object.XFAObject {
  59740. constructor(attributes) {
  59741. super(CONFIG_NS_ID, "acrobat7", true);
  59742. this.dynamicRender = null;
  59743. }
  59744. }
  59745. class ADBE_JSConsole extends _xfa_object.OptionObject {
  59746. constructor(attributes) {
  59747. super(CONFIG_NS_ID, "ADBE_JSConsole", ["delegate", "Enable", "Disable"]);
  59748. }
  59749. }
  59750. class ADBE_JSDebugger extends _xfa_object.OptionObject {
  59751. constructor(attributes) {
  59752. super(CONFIG_NS_ID, "ADBE_JSDebugger", ["delegate", "Enable", "Disable"]);
  59753. }
  59754. }
  59755. class AddSilentPrint extends _xfa_object.Option01 {
  59756. constructor(attributes) {
  59757. super(CONFIG_NS_ID, "addSilentPrint");
  59758. }
  59759. }
  59760. class AddViewerPreferences extends _xfa_object.Option01 {
  59761. constructor(attributes) {
  59762. super(CONFIG_NS_ID, "addViewerPreferences");
  59763. }
  59764. }
  59765. class AdjustData extends _xfa_object.Option10 {
  59766. constructor(attributes) {
  59767. super(CONFIG_NS_ID, "adjustData");
  59768. }
  59769. }
  59770. class AdobeExtensionLevel extends _xfa_object.IntegerObject {
  59771. constructor(attributes) {
  59772. super(CONFIG_NS_ID, "adobeExtensionLevel", 0, n => n >= 1 && n <= 8);
  59773. }
  59774. }
  59775. class Agent extends _xfa_object.XFAObject {
  59776. constructor(attributes) {
  59777. super(CONFIG_NS_ID, "agent", true);
  59778. this.name = attributes.name ? attributes.name.trim() : "";
  59779. this.common = new _xfa_object.XFAObjectArray();
  59780. }
  59781. }
  59782. class AlwaysEmbed extends _xfa_object.ContentObject {
  59783. constructor(attributes) {
  59784. super(CONFIG_NS_ID, "alwaysEmbed");
  59785. }
  59786. }
  59787. class Amd extends _xfa_object.StringObject {
  59788. constructor(attributes) {
  59789. super(CONFIG_NS_ID, "amd");
  59790. }
  59791. }
  59792. class Area extends _xfa_object.XFAObject {
  59793. constructor(attributes) {
  59794. super(CONFIG_NS_ID, "area");
  59795. this.level = (0, _utils.getInteger)({
  59796. data: attributes.level,
  59797. defaultValue: 0,
  59798. validate: n => n >= 1 && n <= 3
  59799. });
  59800. this.name = (0, _utils.getStringOption)(attributes.name, ["", "barcode", "coreinit", "deviceDriver", "font", "general", "layout", "merge", "script", "signature", "sourceSet", "templateCache"]);
  59801. }
  59802. }
  59803. class Attributes extends _xfa_object.OptionObject {
  59804. constructor(attributes) {
  59805. super(CONFIG_NS_ID, "attributes", ["preserve", "delegate", "ignore"]);
  59806. }
  59807. }
  59808. class AutoSave extends _xfa_object.OptionObject {
  59809. constructor(attributes) {
  59810. super(CONFIG_NS_ID, "autoSave", ["disabled", "enabled"]);
  59811. }
  59812. }
  59813. class Base extends _xfa_object.StringObject {
  59814. constructor(attributes) {
  59815. super(CONFIG_NS_ID, "base");
  59816. }
  59817. }
  59818. class BatchOutput extends _xfa_object.XFAObject {
  59819. constructor(attributes) {
  59820. super(CONFIG_NS_ID, "batchOutput");
  59821. this.format = (0, _utils.getStringOption)(attributes.format, ["none", "concat", "zip", "zipCompress"]);
  59822. }
  59823. }
  59824. class BehaviorOverride extends _xfa_object.ContentObject {
  59825. constructor(attributes) {
  59826. super(CONFIG_NS_ID, "behaviorOverride");
  59827. }
  59828. [_xfa_object.$finalize]() {
  59829. this[_xfa_object.$content] = new Map(this[_xfa_object.$content].trim().split(/\s+/).filter(x => x.includes(":")).map(x => x.split(":", 2)));
  59830. }
  59831. }
  59832. class Cache extends _xfa_object.XFAObject {
  59833. constructor(attributes) {
  59834. super(CONFIG_NS_ID, "cache", true);
  59835. this.templateCache = null;
  59836. }
  59837. }
  59838. class Change extends _xfa_object.Option01 {
  59839. constructor(attributes) {
  59840. super(CONFIG_NS_ID, "change");
  59841. }
  59842. }
  59843. class Common extends _xfa_object.XFAObject {
  59844. constructor(attributes) {
  59845. super(CONFIG_NS_ID, "common", true);
  59846. this.data = null;
  59847. this.locale = null;
  59848. this.localeSet = null;
  59849. this.messaging = null;
  59850. this.suppressBanner = null;
  59851. this.template = null;
  59852. this.validationMessaging = null;
  59853. this.versionControl = null;
  59854. this.log = new _xfa_object.XFAObjectArray();
  59855. }
  59856. }
  59857. class Compress extends _xfa_object.XFAObject {
  59858. constructor(attributes) {
  59859. super(CONFIG_NS_ID, "compress");
  59860. this.scope = (0, _utils.getStringOption)(attributes.scope, ["imageOnly", "document"]);
  59861. }
  59862. }
  59863. class CompressLogicalStructure extends _xfa_object.Option01 {
  59864. constructor(attributes) {
  59865. super(CONFIG_NS_ID, "compressLogicalStructure");
  59866. }
  59867. }
  59868. class CompressObjectStream extends _xfa_object.Option10 {
  59869. constructor(attributes) {
  59870. super(CONFIG_NS_ID, "compressObjectStream");
  59871. }
  59872. }
  59873. class Compression extends _xfa_object.XFAObject {
  59874. constructor(attributes) {
  59875. super(CONFIG_NS_ID, "compression", true);
  59876. this.compressLogicalStructure = null;
  59877. this.compressObjectStream = null;
  59878. this.level = null;
  59879. this.type = null;
  59880. }
  59881. }
  59882. class Config extends _xfa_object.XFAObject {
  59883. constructor(attributes) {
  59884. super(CONFIG_NS_ID, "config", true);
  59885. this.acrobat = null;
  59886. this.present = null;
  59887. this.trace = null;
  59888. this.agent = new _xfa_object.XFAObjectArray();
  59889. }
  59890. }
  59891. class Conformance extends _xfa_object.OptionObject {
  59892. constructor(attributes) {
  59893. super(CONFIG_NS_ID, "conformance", ["A", "B"]);
  59894. }
  59895. }
  59896. class ContentCopy extends _xfa_object.Option01 {
  59897. constructor(attributes) {
  59898. super(CONFIG_NS_ID, "contentCopy");
  59899. }
  59900. }
  59901. class Copies extends _xfa_object.IntegerObject {
  59902. constructor(attributes) {
  59903. super(CONFIG_NS_ID, "copies", 1, n => n >= 1);
  59904. }
  59905. }
  59906. class Creator extends _xfa_object.StringObject {
  59907. constructor(attributes) {
  59908. super(CONFIG_NS_ID, "creator");
  59909. }
  59910. }
  59911. class CurrentPage extends _xfa_object.IntegerObject {
  59912. constructor(attributes) {
  59913. super(CONFIG_NS_ID, "currentPage", 0, n => n >= 0);
  59914. }
  59915. }
  59916. class Data extends _xfa_object.XFAObject {
  59917. constructor(attributes) {
  59918. super(CONFIG_NS_ID, "data", true);
  59919. this.adjustData = null;
  59920. this.attributes = null;
  59921. this.incrementalLoad = null;
  59922. this.outputXSL = null;
  59923. this.range = null;
  59924. this.record = null;
  59925. this.startNode = null;
  59926. this.uri = null;
  59927. this.window = null;
  59928. this.xsl = null;
  59929. this.excludeNS = new _xfa_object.XFAObjectArray();
  59930. this.transform = new _xfa_object.XFAObjectArray();
  59931. }
  59932. }
  59933. class Debug extends _xfa_object.XFAObject {
  59934. constructor(attributes) {
  59935. super(CONFIG_NS_ID, "debug", true);
  59936. this.uri = null;
  59937. }
  59938. }
  59939. class DefaultTypeface extends _xfa_object.ContentObject {
  59940. constructor(attributes) {
  59941. super(CONFIG_NS_ID, "defaultTypeface");
  59942. this.writingScript = (0, _utils.getStringOption)(attributes.writingScript, ["*", "Arabic", "Cyrillic", "EastEuropeanRoman", "Greek", "Hebrew", "Japanese", "Korean", "Roman", "SimplifiedChinese", "Thai", "TraditionalChinese", "Vietnamese"]);
  59943. }
  59944. }
  59945. class Destination extends _xfa_object.OptionObject {
  59946. constructor(attributes) {
  59947. super(CONFIG_NS_ID, "destination", ["pdf", "pcl", "ps", "webClient", "zpl"]);
  59948. }
  59949. }
  59950. class DocumentAssembly extends _xfa_object.Option01 {
  59951. constructor(attributes) {
  59952. super(CONFIG_NS_ID, "documentAssembly");
  59953. }
  59954. }
  59955. class Driver extends _xfa_object.XFAObject {
  59956. constructor(attributes) {
  59957. super(CONFIG_NS_ID, "driver", true);
  59958. this.name = attributes.name ? attributes.name.trim() : "";
  59959. this.fontInfo = null;
  59960. this.xdc = null;
  59961. }
  59962. }
  59963. class DuplexOption extends _xfa_object.OptionObject {
  59964. constructor(attributes) {
  59965. super(CONFIG_NS_ID, "duplexOption", ["simplex", "duplexFlipLongEdge", "duplexFlipShortEdge"]);
  59966. }
  59967. }
  59968. class DynamicRender extends _xfa_object.OptionObject {
  59969. constructor(attributes) {
  59970. super(CONFIG_NS_ID, "dynamicRender", ["forbidden", "required"]);
  59971. }
  59972. }
  59973. class Embed extends _xfa_object.Option01 {
  59974. constructor(attributes) {
  59975. super(CONFIG_NS_ID, "embed");
  59976. }
  59977. }
  59978. class Encrypt extends _xfa_object.Option01 {
  59979. constructor(attributes) {
  59980. super(CONFIG_NS_ID, "encrypt");
  59981. }
  59982. }
  59983. class Encryption extends _xfa_object.XFAObject {
  59984. constructor(attributes) {
  59985. super(CONFIG_NS_ID, "encryption", true);
  59986. this.encrypt = null;
  59987. this.encryptionLevel = null;
  59988. this.permissions = null;
  59989. }
  59990. }
  59991. class EncryptionLevel extends _xfa_object.OptionObject {
  59992. constructor(attributes) {
  59993. super(CONFIG_NS_ID, "encryptionLevel", ["40bit", "128bit"]);
  59994. }
  59995. }
  59996. class Enforce extends _xfa_object.StringObject {
  59997. constructor(attributes) {
  59998. super(CONFIG_NS_ID, "enforce");
  59999. }
  60000. }
  60001. class Equate extends _xfa_object.XFAObject {
  60002. constructor(attributes) {
  60003. super(CONFIG_NS_ID, "equate");
  60004. this.force = (0, _utils.getInteger)({
  60005. data: attributes.force,
  60006. defaultValue: 1,
  60007. validate: n => n === 0
  60008. });
  60009. this.from = attributes.from || "";
  60010. this.to = attributes.to || "";
  60011. }
  60012. }
  60013. class EquateRange extends _xfa_object.XFAObject {
  60014. constructor(attributes) {
  60015. super(CONFIG_NS_ID, "equateRange");
  60016. this.from = attributes.from || "";
  60017. this.to = attributes.to || "";
  60018. this._unicodeRange = attributes.unicodeRange || "";
  60019. }
  60020. get unicodeRange() {
  60021. const ranges = [];
  60022. const unicodeRegex = /U\+([0-9a-fA-F]+)/;
  60023. const unicodeRange = this._unicodeRange;
  60024. for (let range of unicodeRange.split(",").map(x => x.trim()).filter(x => !!x)) {
  60025. range = range.split("-", 2).map(x => {
  60026. const found = x.match(unicodeRegex);
  60027. if (!found) {
  60028. return 0;
  60029. }
  60030. return parseInt(found[1], 16);
  60031. });
  60032. if (range.length === 1) {
  60033. range.push(range[0]);
  60034. }
  60035. ranges.push(range);
  60036. }
  60037. return (0, _util.shadow)(this, "unicodeRange", ranges);
  60038. }
  60039. }
  60040. class Exclude extends _xfa_object.ContentObject {
  60041. constructor(attributes) {
  60042. super(CONFIG_NS_ID, "exclude");
  60043. }
  60044. [_xfa_object.$finalize]() {
  60045. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/).filter(x => x && ["calculate", "close", "enter", "exit", "initialize", "ready", "validate"].includes(x));
  60046. }
  60047. }
  60048. class ExcludeNS extends _xfa_object.StringObject {
  60049. constructor(attributes) {
  60050. super(CONFIG_NS_ID, "excludeNS");
  60051. }
  60052. }
  60053. class FlipLabel extends _xfa_object.OptionObject {
  60054. constructor(attributes) {
  60055. super(CONFIG_NS_ID, "flipLabel", ["usePrinterSetting", "on", "off"]);
  60056. }
  60057. }
  60058. class FontInfo extends _xfa_object.XFAObject {
  60059. constructor(attributes) {
  60060. super(CONFIG_NS_ID, "fontInfo", true);
  60061. this.embed = null;
  60062. this.map = null;
  60063. this.subsetBelow = null;
  60064. this.alwaysEmbed = new _xfa_object.XFAObjectArray();
  60065. this.defaultTypeface = new _xfa_object.XFAObjectArray();
  60066. this.neverEmbed = new _xfa_object.XFAObjectArray();
  60067. }
  60068. }
  60069. class FormFieldFilling extends _xfa_object.Option01 {
  60070. constructor(attributes) {
  60071. super(CONFIG_NS_ID, "formFieldFilling");
  60072. }
  60073. }
  60074. class GroupParent extends _xfa_object.StringObject {
  60075. constructor(attributes) {
  60076. super(CONFIG_NS_ID, "groupParent");
  60077. }
  60078. }
  60079. class IfEmpty extends _xfa_object.OptionObject {
  60080. constructor(attributes) {
  60081. super(CONFIG_NS_ID, "ifEmpty", ["dataValue", "dataGroup", "ignore", "remove"]);
  60082. }
  60083. }
  60084. class IncludeXDPContent extends _xfa_object.StringObject {
  60085. constructor(attributes) {
  60086. super(CONFIG_NS_ID, "includeXDPContent");
  60087. }
  60088. }
  60089. class IncrementalLoad extends _xfa_object.OptionObject {
  60090. constructor(attributes) {
  60091. super(CONFIG_NS_ID, "incrementalLoad", ["none", "forwardOnly"]);
  60092. }
  60093. }
  60094. class IncrementalMerge extends _xfa_object.Option01 {
  60095. constructor(attributes) {
  60096. super(CONFIG_NS_ID, "incrementalMerge");
  60097. }
  60098. }
  60099. class Interactive extends _xfa_object.Option01 {
  60100. constructor(attributes) {
  60101. super(CONFIG_NS_ID, "interactive");
  60102. }
  60103. }
  60104. class Jog extends _xfa_object.OptionObject {
  60105. constructor(attributes) {
  60106. super(CONFIG_NS_ID, "jog", ["usePrinterSetting", "none", "pageSet"]);
  60107. }
  60108. }
  60109. class LabelPrinter extends _xfa_object.XFAObject {
  60110. constructor(attributes) {
  60111. super(CONFIG_NS_ID, "labelPrinter", true);
  60112. this.name = (0, _utils.getStringOption)(attributes.name, ["zpl", "dpl", "ipl", "tcpl"]);
  60113. this.batchOutput = null;
  60114. this.flipLabel = null;
  60115. this.fontInfo = null;
  60116. this.xdc = null;
  60117. }
  60118. }
  60119. class Layout extends _xfa_object.OptionObject {
  60120. constructor(attributes) {
  60121. super(CONFIG_NS_ID, "layout", ["paginate", "panel"]);
  60122. }
  60123. }
  60124. class Level extends _xfa_object.IntegerObject {
  60125. constructor(attributes) {
  60126. super(CONFIG_NS_ID, "level", 0, n => n > 0);
  60127. }
  60128. }
  60129. class Linearized extends _xfa_object.Option01 {
  60130. constructor(attributes) {
  60131. super(CONFIG_NS_ID, "linearized");
  60132. }
  60133. }
  60134. class Locale extends _xfa_object.StringObject {
  60135. constructor(attributes) {
  60136. super(CONFIG_NS_ID, "locale");
  60137. }
  60138. }
  60139. class LocaleSet extends _xfa_object.StringObject {
  60140. constructor(attributes) {
  60141. super(CONFIG_NS_ID, "localeSet");
  60142. }
  60143. }
  60144. class Log extends _xfa_object.XFAObject {
  60145. constructor(attributes) {
  60146. super(CONFIG_NS_ID, "log", true);
  60147. this.mode = null;
  60148. this.threshold = null;
  60149. this.to = null;
  60150. this.uri = null;
  60151. }
  60152. }
  60153. class MapElement extends _xfa_object.XFAObject {
  60154. constructor(attributes) {
  60155. super(CONFIG_NS_ID, "map", true);
  60156. this.equate = new _xfa_object.XFAObjectArray();
  60157. this.equateRange = new _xfa_object.XFAObjectArray();
  60158. }
  60159. }
  60160. class MediumInfo extends _xfa_object.XFAObject {
  60161. constructor(attributes) {
  60162. super(CONFIG_NS_ID, "mediumInfo", true);
  60163. this.map = null;
  60164. }
  60165. }
  60166. class Message extends _xfa_object.XFAObject {
  60167. constructor(attributes) {
  60168. super(CONFIG_NS_ID, "message", true);
  60169. this.msgId = null;
  60170. this.severity = null;
  60171. }
  60172. }
  60173. class Messaging extends _xfa_object.XFAObject {
  60174. constructor(attributes) {
  60175. super(CONFIG_NS_ID, "messaging", true);
  60176. this.message = new _xfa_object.XFAObjectArray();
  60177. }
  60178. }
  60179. class Mode extends _xfa_object.OptionObject {
  60180. constructor(attributes) {
  60181. super(CONFIG_NS_ID, "mode", ["append", "overwrite"]);
  60182. }
  60183. }
  60184. class ModifyAnnots extends _xfa_object.Option01 {
  60185. constructor(attributes) {
  60186. super(CONFIG_NS_ID, "modifyAnnots");
  60187. }
  60188. }
  60189. class MsgId extends _xfa_object.IntegerObject {
  60190. constructor(attributes) {
  60191. super(CONFIG_NS_ID, "msgId", 1, n => n >= 1);
  60192. }
  60193. }
  60194. class NameAttr extends _xfa_object.StringObject {
  60195. constructor(attributes) {
  60196. super(CONFIG_NS_ID, "nameAttr");
  60197. }
  60198. }
  60199. class NeverEmbed extends _xfa_object.ContentObject {
  60200. constructor(attributes) {
  60201. super(CONFIG_NS_ID, "neverEmbed");
  60202. }
  60203. }
  60204. class NumberOfCopies extends _xfa_object.IntegerObject {
  60205. constructor(attributes) {
  60206. super(CONFIG_NS_ID, "numberOfCopies", null, n => n >= 2 && n <= 5);
  60207. }
  60208. }
  60209. class OpenAction extends _xfa_object.XFAObject {
  60210. constructor(attributes) {
  60211. super(CONFIG_NS_ID, "openAction", true);
  60212. this.destination = null;
  60213. }
  60214. }
  60215. class Output extends _xfa_object.XFAObject {
  60216. constructor(attributes) {
  60217. super(CONFIG_NS_ID, "output", true);
  60218. this.to = null;
  60219. this.type = null;
  60220. this.uri = null;
  60221. }
  60222. }
  60223. class OutputBin extends _xfa_object.StringObject {
  60224. constructor(attributes) {
  60225. super(CONFIG_NS_ID, "outputBin");
  60226. }
  60227. }
  60228. class OutputXSL extends _xfa_object.XFAObject {
  60229. constructor(attributes) {
  60230. super(CONFIG_NS_ID, "outputXSL", true);
  60231. this.uri = null;
  60232. }
  60233. }
  60234. class Overprint extends _xfa_object.OptionObject {
  60235. constructor(attributes) {
  60236. super(CONFIG_NS_ID, "overprint", ["none", "both", "draw", "field"]);
  60237. }
  60238. }
  60239. class Packets extends _xfa_object.StringObject {
  60240. constructor(attributes) {
  60241. super(CONFIG_NS_ID, "packets");
  60242. }
  60243. [_xfa_object.$finalize]() {
  60244. if (this[_xfa_object.$content] === "*") {
  60245. return;
  60246. }
  60247. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/).filter(x => ["config", "datasets", "template", "xfdf", "xslt"].includes(x));
  60248. }
  60249. }
  60250. class PageOffset extends _xfa_object.XFAObject {
  60251. constructor(attributes) {
  60252. super(CONFIG_NS_ID, "pageOffset");
  60253. this.x = (0, _utils.getInteger)({
  60254. data: attributes.x,
  60255. defaultValue: "useXDCSetting",
  60256. validate: n => true
  60257. });
  60258. this.y = (0, _utils.getInteger)({
  60259. data: attributes.y,
  60260. defaultValue: "useXDCSetting",
  60261. validate: n => true
  60262. });
  60263. }
  60264. }
  60265. class PageRange extends _xfa_object.StringObject {
  60266. constructor(attributes) {
  60267. super(CONFIG_NS_ID, "pageRange");
  60268. }
  60269. [_xfa_object.$finalize]() {
  60270. const numbers = this[_xfa_object.$content].trim().split(/\s+/).map(x => parseInt(x, 10));
  60271. const ranges = [];
  60272. for (let i = 0, ii = numbers.length; i < ii; i += 2) {
  60273. ranges.push(numbers.slice(i, i + 2));
  60274. }
  60275. this[_xfa_object.$content] = ranges;
  60276. }
  60277. }
  60278. class Pagination extends _xfa_object.OptionObject {
  60279. constructor(attributes) {
  60280. super(CONFIG_NS_ID, "pagination", ["simplex", "duplexShortEdge", "duplexLongEdge"]);
  60281. }
  60282. }
  60283. class PaginationOverride extends _xfa_object.OptionObject {
  60284. constructor(attributes) {
  60285. super(CONFIG_NS_ID, "paginationOverride", ["none", "forceDuplex", "forceDuplexLongEdge", "forceDuplexShortEdge", "forceSimplex"]);
  60286. }
  60287. }
  60288. class Part extends _xfa_object.IntegerObject {
  60289. constructor(attributes) {
  60290. super(CONFIG_NS_ID, "part", 1, n => false);
  60291. }
  60292. }
  60293. class Pcl extends _xfa_object.XFAObject {
  60294. constructor(attributes) {
  60295. super(CONFIG_NS_ID, "pcl", true);
  60296. this.name = attributes.name || "";
  60297. this.batchOutput = null;
  60298. this.fontInfo = null;
  60299. this.jog = null;
  60300. this.mediumInfo = null;
  60301. this.outputBin = null;
  60302. this.pageOffset = null;
  60303. this.staple = null;
  60304. this.xdc = null;
  60305. }
  60306. }
  60307. class Pdf extends _xfa_object.XFAObject {
  60308. constructor(attributes) {
  60309. super(CONFIG_NS_ID, "pdf", true);
  60310. this.name = attributes.name || "";
  60311. this.adobeExtensionLevel = null;
  60312. this.batchOutput = null;
  60313. this.compression = null;
  60314. this.creator = null;
  60315. this.encryption = null;
  60316. this.fontInfo = null;
  60317. this.interactive = null;
  60318. this.linearized = null;
  60319. this.openAction = null;
  60320. this.pdfa = null;
  60321. this.producer = null;
  60322. this.renderPolicy = null;
  60323. this.scriptModel = null;
  60324. this.silentPrint = null;
  60325. this.submitFormat = null;
  60326. this.tagged = null;
  60327. this.version = null;
  60328. this.viewerPreferences = null;
  60329. this.xdc = null;
  60330. }
  60331. }
  60332. class Pdfa extends _xfa_object.XFAObject {
  60333. constructor(attributes) {
  60334. super(CONFIG_NS_ID, "pdfa", true);
  60335. this.amd = null;
  60336. this.conformance = null;
  60337. this.includeXDPContent = null;
  60338. this.part = null;
  60339. }
  60340. }
  60341. class Permissions extends _xfa_object.XFAObject {
  60342. constructor(attributes) {
  60343. super(CONFIG_NS_ID, "permissions", true);
  60344. this.accessibleContent = null;
  60345. this.change = null;
  60346. this.contentCopy = null;
  60347. this.documentAssembly = null;
  60348. this.formFieldFilling = null;
  60349. this.modifyAnnots = null;
  60350. this.plaintextMetadata = null;
  60351. this.print = null;
  60352. this.printHighQuality = null;
  60353. }
  60354. }
  60355. class PickTrayByPDFSize extends _xfa_object.Option01 {
  60356. constructor(attributes) {
  60357. super(CONFIG_NS_ID, "pickTrayByPDFSize");
  60358. }
  60359. }
  60360. class Picture extends _xfa_object.StringObject {
  60361. constructor(attributes) {
  60362. super(CONFIG_NS_ID, "picture");
  60363. }
  60364. }
  60365. class PlaintextMetadata extends _xfa_object.Option01 {
  60366. constructor(attributes) {
  60367. super(CONFIG_NS_ID, "plaintextMetadata");
  60368. }
  60369. }
  60370. class Presence extends _xfa_object.OptionObject {
  60371. constructor(attributes) {
  60372. super(CONFIG_NS_ID, "presence", ["preserve", "dissolve", "dissolveStructure", "ignore", "remove"]);
  60373. }
  60374. }
  60375. class Present extends _xfa_object.XFAObject {
  60376. constructor(attributes) {
  60377. super(CONFIG_NS_ID, "present", true);
  60378. this.behaviorOverride = null;
  60379. this.cache = null;
  60380. this.common = null;
  60381. this.copies = null;
  60382. this.destination = null;
  60383. this.incrementalMerge = null;
  60384. this.layout = null;
  60385. this.output = null;
  60386. this.overprint = null;
  60387. this.pagination = null;
  60388. this.paginationOverride = null;
  60389. this.script = null;
  60390. this.validate = null;
  60391. this.xdp = null;
  60392. this.driver = new _xfa_object.XFAObjectArray();
  60393. this.labelPrinter = new _xfa_object.XFAObjectArray();
  60394. this.pcl = new _xfa_object.XFAObjectArray();
  60395. this.pdf = new _xfa_object.XFAObjectArray();
  60396. this.ps = new _xfa_object.XFAObjectArray();
  60397. this.submitUrl = new _xfa_object.XFAObjectArray();
  60398. this.webClient = new _xfa_object.XFAObjectArray();
  60399. this.zpl = new _xfa_object.XFAObjectArray();
  60400. }
  60401. }
  60402. class Print extends _xfa_object.Option01 {
  60403. constructor(attributes) {
  60404. super(CONFIG_NS_ID, "print");
  60405. }
  60406. }
  60407. class PrintHighQuality extends _xfa_object.Option01 {
  60408. constructor(attributes) {
  60409. super(CONFIG_NS_ID, "printHighQuality");
  60410. }
  60411. }
  60412. class PrintScaling extends _xfa_object.OptionObject {
  60413. constructor(attributes) {
  60414. super(CONFIG_NS_ID, "printScaling", ["appdefault", "noScaling"]);
  60415. }
  60416. }
  60417. class PrinterName extends _xfa_object.StringObject {
  60418. constructor(attributes) {
  60419. super(CONFIG_NS_ID, "printerName");
  60420. }
  60421. }
  60422. class Producer extends _xfa_object.StringObject {
  60423. constructor(attributes) {
  60424. super(CONFIG_NS_ID, "producer");
  60425. }
  60426. }
  60427. class Ps extends _xfa_object.XFAObject {
  60428. constructor(attributes) {
  60429. super(CONFIG_NS_ID, "ps", true);
  60430. this.name = attributes.name || "";
  60431. this.batchOutput = null;
  60432. this.fontInfo = null;
  60433. this.jog = null;
  60434. this.mediumInfo = null;
  60435. this.outputBin = null;
  60436. this.staple = null;
  60437. this.xdc = null;
  60438. }
  60439. }
  60440. class Range extends _xfa_object.ContentObject {
  60441. constructor(attributes) {
  60442. super(CONFIG_NS_ID, "range");
  60443. }
  60444. [_xfa_object.$finalize]() {
  60445. 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 => {
  60446. if (range.length === 1) {
  60447. range.push(range[0]);
  60448. }
  60449. return range;
  60450. });
  60451. }
  60452. }
  60453. class Record extends _xfa_object.ContentObject {
  60454. constructor(attributes) {
  60455. super(CONFIG_NS_ID, "record");
  60456. }
  60457. [_xfa_object.$finalize]() {
  60458. this[_xfa_object.$content] = this[_xfa_object.$content].trim();
  60459. const n = parseInt(this[_xfa_object.$content], 10);
  60460. if (!isNaN(n) && n >= 0) {
  60461. this[_xfa_object.$content] = n;
  60462. }
  60463. }
  60464. }
  60465. class Relevant extends _xfa_object.ContentObject {
  60466. constructor(attributes) {
  60467. super(CONFIG_NS_ID, "relevant");
  60468. }
  60469. [_xfa_object.$finalize]() {
  60470. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/);
  60471. }
  60472. }
  60473. class Rename extends _xfa_object.ContentObject {
  60474. constructor(attributes) {
  60475. super(CONFIG_NS_ID, "rename");
  60476. }
  60477. [_xfa_object.$finalize]() {
  60478. this[_xfa_object.$content] = this[_xfa_object.$content].trim();
  60479. if (this[_xfa_object.$content].toLowerCase().startsWith("xml") || this[_xfa_object.$content].match(new RegExp("[\\p{L}_][\\p{L}\\d._\\p{M}-]*", "u"))) {
  60480. (0, _util.warn)("XFA - Rename: invalid XFA name");
  60481. }
  60482. }
  60483. }
  60484. class RenderPolicy extends _xfa_object.OptionObject {
  60485. constructor(attributes) {
  60486. super(CONFIG_NS_ID, "renderPolicy", ["server", "client"]);
  60487. }
  60488. }
  60489. class RunScripts extends _xfa_object.OptionObject {
  60490. constructor(attributes) {
  60491. super(CONFIG_NS_ID, "runScripts", ["both", "client", "none", "server"]);
  60492. }
  60493. }
  60494. class Script extends _xfa_object.XFAObject {
  60495. constructor(attributes) {
  60496. super(CONFIG_NS_ID, "script", true);
  60497. this.currentPage = null;
  60498. this.exclude = null;
  60499. this.runScripts = null;
  60500. }
  60501. }
  60502. class ScriptModel extends _xfa_object.OptionObject {
  60503. constructor(attributes) {
  60504. super(CONFIG_NS_ID, "scriptModel", ["XFA", "none"]);
  60505. }
  60506. }
  60507. class Severity extends _xfa_object.OptionObject {
  60508. constructor(attributes) {
  60509. super(CONFIG_NS_ID, "severity", ["ignore", "error", "information", "trace", "warning"]);
  60510. }
  60511. }
  60512. class SilentPrint extends _xfa_object.XFAObject {
  60513. constructor(attributes) {
  60514. super(CONFIG_NS_ID, "silentPrint", true);
  60515. this.addSilentPrint = null;
  60516. this.printerName = null;
  60517. }
  60518. }
  60519. class Staple extends _xfa_object.XFAObject {
  60520. constructor(attributes) {
  60521. super(CONFIG_NS_ID, "staple");
  60522. this.mode = (0, _utils.getStringOption)(attributes.mode, ["usePrinterSetting", "on", "off"]);
  60523. }
  60524. }
  60525. class StartNode extends _xfa_object.StringObject {
  60526. constructor(attributes) {
  60527. super(CONFIG_NS_ID, "startNode");
  60528. }
  60529. }
  60530. class StartPage extends _xfa_object.IntegerObject {
  60531. constructor(attributes) {
  60532. super(CONFIG_NS_ID, "startPage", 0, n => true);
  60533. }
  60534. }
  60535. class SubmitFormat extends _xfa_object.OptionObject {
  60536. constructor(attributes) {
  60537. super(CONFIG_NS_ID, "submitFormat", ["html", "delegate", "fdf", "xml", "pdf"]);
  60538. }
  60539. }
  60540. class SubmitUrl extends _xfa_object.StringObject {
  60541. constructor(attributes) {
  60542. super(CONFIG_NS_ID, "submitUrl");
  60543. }
  60544. }
  60545. class SubsetBelow extends _xfa_object.IntegerObject {
  60546. constructor(attributes) {
  60547. super(CONFIG_NS_ID, "subsetBelow", 100, n => n >= 0 && n <= 100);
  60548. }
  60549. }
  60550. class SuppressBanner extends _xfa_object.Option01 {
  60551. constructor(attributes) {
  60552. super(CONFIG_NS_ID, "suppressBanner");
  60553. }
  60554. }
  60555. class Tagged extends _xfa_object.Option01 {
  60556. constructor(attributes) {
  60557. super(CONFIG_NS_ID, "tagged");
  60558. }
  60559. }
  60560. class Template extends _xfa_object.XFAObject {
  60561. constructor(attributes) {
  60562. super(CONFIG_NS_ID, "template", true);
  60563. this.base = null;
  60564. this.relevant = null;
  60565. this.startPage = null;
  60566. this.uri = null;
  60567. this.xsl = null;
  60568. }
  60569. }
  60570. class Threshold extends _xfa_object.OptionObject {
  60571. constructor(attributes) {
  60572. super(CONFIG_NS_ID, "threshold", ["trace", "error", "information", "warning"]);
  60573. }
  60574. }
  60575. class To extends _xfa_object.OptionObject {
  60576. constructor(attributes) {
  60577. super(CONFIG_NS_ID, "to", ["null", "memory", "stderr", "stdout", "system", "uri"]);
  60578. }
  60579. }
  60580. class TemplateCache extends _xfa_object.XFAObject {
  60581. constructor(attributes) {
  60582. super(CONFIG_NS_ID, "templateCache");
  60583. this.maxEntries = (0, _utils.getInteger)({
  60584. data: attributes.maxEntries,
  60585. defaultValue: 5,
  60586. validate: n => n >= 0
  60587. });
  60588. }
  60589. }
  60590. class Trace extends _xfa_object.XFAObject {
  60591. constructor(attributes) {
  60592. super(CONFIG_NS_ID, "trace", true);
  60593. this.area = new _xfa_object.XFAObjectArray();
  60594. }
  60595. }
  60596. class Transform extends _xfa_object.XFAObject {
  60597. constructor(attributes) {
  60598. super(CONFIG_NS_ID, "transform", true);
  60599. this.groupParent = null;
  60600. this.ifEmpty = null;
  60601. this.nameAttr = null;
  60602. this.picture = null;
  60603. this.presence = null;
  60604. this.rename = null;
  60605. this.whitespace = null;
  60606. }
  60607. }
  60608. class Type extends _xfa_object.OptionObject {
  60609. constructor(attributes) {
  60610. super(CONFIG_NS_ID, "type", ["none", "ascii85", "asciiHex", "ccittfax", "flate", "lzw", "runLength", "native", "xdp", "mergedXDP"]);
  60611. }
  60612. }
  60613. class Uri extends _xfa_object.StringObject {
  60614. constructor(attributes) {
  60615. super(CONFIG_NS_ID, "uri");
  60616. }
  60617. }
  60618. class Validate extends _xfa_object.OptionObject {
  60619. constructor(attributes) {
  60620. super(CONFIG_NS_ID, "validate", ["preSubmit", "prePrint", "preExecute", "preSave"]);
  60621. }
  60622. }
  60623. class ValidateApprovalSignatures extends _xfa_object.ContentObject {
  60624. constructor(attributes) {
  60625. super(CONFIG_NS_ID, "validateApprovalSignatures");
  60626. }
  60627. [_xfa_object.$finalize]() {
  60628. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/).filter(x => ["docReady", "postSign"].includes(x));
  60629. }
  60630. }
  60631. class ValidationMessaging extends _xfa_object.OptionObject {
  60632. constructor(attributes) {
  60633. super(CONFIG_NS_ID, "validationMessaging", ["allMessagesIndividually", "allMessagesTogether", "firstMessageOnly", "noMessages"]);
  60634. }
  60635. }
  60636. class Version extends _xfa_object.OptionObject {
  60637. constructor(attributes) {
  60638. super(CONFIG_NS_ID, "version", ["1.7", "1.6", "1.5", "1.4", "1.3", "1.2"]);
  60639. }
  60640. }
  60641. class VersionControl extends _xfa_object.XFAObject {
  60642. constructor(attributes) {
  60643. super(CONFIG_NS_ID, "VersionControl");
  60644. this.outputBelow = (0, _utils.getStringOption)(attributes.outputBelow, ["warn", "error", "update"]);
  60645. this.sourceAbove = (0, _utils.getStringOption)(attributes.sourceAbove, ["warn", "error"]);
  60646. this.sourceBelow = (0, _utils.getStringOption)(attributes.sourceBelow, ["update", "maintain"]);
  60647. }
  60648. }
  60649. class ViewerPreferences extends _xfa_object.XFAObject {
  60650. constructor(attributes) {
  60651. super(CONFIG_NS_ID, "viewerPreferences", true);
  60652. this.ADBE_JSConsole = null;
  60653. this.ADBE_JSDebugger = null;
  60654. this.addViewerPreferences = null;
  60655. this.duplexOption = null;
  60656. this.enforce = null;
  60657. this.numberOfCopies = null;
  60658. this.pageRange = null;
  60659. this.pickTrayByPDFSize = null;
  60660. this.printScaling = null;
  60661. }
  60662. }
  60663. class WebClient extends _xfa_object.XFAObject {
  60664. constructor(attributes) {
  60665. super(CONFIG_NS_ID, "webClient", true);
  60666. this.name = attributes.name ? attributes.name.trim() : "";
  60667. this.fontInfo = null;
  60668. this.xdc = null;
  60669. }
  60670. }
  60671. class Whitespace extends _xfa_object.OptionObject {
  60672. constructor(attributes) {
  60673. super(CONFIG_NS_ID, "whitespace", ["preserve", "ltrim", "normalize", "rtrim", "trim"]);
  60674. }
  60675. }
  60676. class Window extends _xfa_object.ContentObject {
  60677. constructor(attributes) {
  60678. super(CONFIG_NS_ID, "window");
  60679. }
  60680. [_xfa_object.$finalize]() {
  60681. const pair = this[_xfa_object.$content].trim().split(/\s*,\s*/, 2).map(x => parseInt(x, 10));
  60682. if (pair.some(x => isNaN(x))) {
  60683. this[_xfa_object.$content] = [0, 0];
  60684. return;
  60685. }
  60686. if (pair.length === 1) {
  60687. pair.push(pair[0]);
  60688. }
  60689. this[_xfa_object.$content] = pair;
  60690. }
  60691. }
  60692. class Xdc extends _xfa_object.XFAObject {
  60693. constructor(attributes) {
  60694. super(CONFIG_NS_ID, "xdc", true);
  60695. this.uri = new _xfa_object.XFAObjectArray();
  60696. this.xsl = new _xfa_object.XFAObjectArray();
  60697. }
  60698. }
  60699. class Xdp extends _xfa_object.XFAObject {
  60700. constructor(attributes) {
  60701. super(CONFIG_NS_ID, "xdp", true);
  60702. this.packets = null;
  60703. }
  60704. }
  60705. class Xsl extends _xfa_object.XFAObject {
  60706. constructor(attributes) {
  60707. super(CONFIG_NS_ID, "xsl", true);
  60708. this.debug = null;
  60709. this.uri = null;
  60710. }
  60711. }
  60712. class Zpl extends _xfa_object.XFAObject {
  60713. constructor(attributes) {
  60714. super(CONFIG_NS_ID, "zpl", true);
  60715. this.name = attributes.name ? attributes.name.trim() : "";
  60716. this.batchOutput = null;
  60717. this.flipLabel = null;
  60718. this.fontInfo = null;
  60719. this.xdc = null;
  60720. }
  60721. }
  60722. class ConfigNamespace {
  60723. static [_namespaces.$buildXFAObject](name, attributes) {
  60724. if (ConfigNamespace.hasOwnProperty(name)) {
  60725. return ConfigNamespace[name](attributes);
  60726. }
  60727. return undefined;
  60728. }
  60729. static acrobat(attrs) {
  60730. return new Acrobat(attrs);
  60731. }
  60732. static acrobat7(attrs) {
  60733. return new Acrobat7(attrs);
  60734. }
  60735. static ADBE_JSConsole(attrs) {
  60736. return new ADBE_JSConsole(attrs);
  60737. }
  60738. static ADBE_JSDebugger(attrs) {
  60739. return new ADBE_JSDebugger(attrs);
  60740. }
  60741. static addSilentPrint(attrs) {
  60742. return new AddSilentPrint(attrs);
  60743. }
  60744. static addViewerPreferences(attrs) {
  60745. return new AddViewerPreferences(attrs);
  60746. }
  60747. static adjustData(attrs) {
  60748. return new AdjustData(attrs);
  60749. }
  60750. static adobeExtensionLevel(attrs) {
  60751. return new AdobeExtensionLevel(attrs);
  60752. }
  60753. static agent(attrs) {
  60754. return new Agent(attrs);
  60755. }
  60756. static alwaysEmbed(attrs) {
  60757. return new AlwaysEmbed(attrs);
  60758. }
  60759. static amd(attrs) {
  60760. return new Amd(attrs);
  60761. }
  60762. static area(attrs) {
  60763. return new Area(attrs);
  60764. }
  60765. static attributes(attrs) {
  60766. return new Attributes(attrs);
  60767. }
  60768. static autoSave(attrs) {
  60769. return new AutoSave(attrs);
  60770. }
  60771. static base(attrs) {
  60772. return new Base(attrs);
  60773. }
  60774. static batchOutput(attrs) {
  60775. return new BatchOutput(attrs);
  60776. }
  60777. static behaviorOverride(attrs) {
  60778. return new BehaviorOverride(attrs);
  60779. }
  60780. static cache(attrs) {
  60781. return new Cache(attrs);
  60782. }
  60783. static change(attrs) {
  60784. return new Change(attrs);
  60785. }
  60786. static common(attrs) {
  60787. return new Common(attrs);
  60788. }
  60789. static compress(attrs) {
  60790. return new Compress(attrs);
  60791. }
  60792. static compressLogicalStructure(attrs) {
  60793. return new CompressLogicalStructure(attrs);
  60794. }
  60795. static compressObjectStream(attrs) {
  60796. return new CompressObjectStream(attrs);
  60797. }
  60798. static compression(attrs) {
  60799. return new Compression(attrs);
  60800. }
  60801. static config(attrs) {
  60802. return new Config(attrs);
  60803. }
  60804. static conformance(attrs) {
  60805. return new Conformance(attrs);
  60806. }
  60807. static contentCopy(attrs) {
  60808. return new ContentCopy(attrs);
  60809. }
  60810. static copies(attrs) {
  60811. return new Copies(attrs);
  60812. }
  60813. static creator(attrs) {
  60814. return new Creator(attrs);
  60815. }
  60816. static currentPage(attrs) {
  60817. return new CurrentPage(attrs);
  60818. }
  60819. static data(attrs) {
  60820. return new Data(attrs);
  60821. }
  60822. static debug(attrs) {
  60823. return new Debug(attrs);
  60824. }
  60825. static defaultTypeface(attrs) {
  60826. return new DefaultTypeface(attrs);
  60827. }
  60828. static destination(attrs) {
  60829. return new Destination(attrs);
  60830. }
  60831. static documentAssembly(attrs) {
  60832. return new DocumentAssembly(attrs);
  60833. }
  60834. static driver(attrs) {
  60835. return new Driver(attrs);
  60836. }
  60837. static duplexOption(attrs) {
  60838. return new DuplexOption(attrs);
  60839. }
  60840. static dynamicRender(attrs) {
  60841. return new DynamicRender(attrs);
  60842. }
  60843. static embed(attrs) {
  60844. return new Embed(attrs);
  60845. }
  60846. static encrypt(attrs) {
  60847. return new Encrypt(attrs);
  60848. }
  60849. static encryption(attrs) {
  60850. return new Encryption(attrs);
  60851. }
  60852. static encryptionLevel(attrs) {
  60853. return new EncryptionLevel(attrs);
  60854. }
  60855. static enforce(attrs) {
  60856. return new Enforce(attrs);
  60857. }
  60858. static equate(attrs) {
  60859. return new Equate(attrs);
  60860. }
  60861. static equateRange(attrs) {
  60862. return new EquateRange(attrs);
  60863. }
  60864. static exclude(attrs) {
  60865. return new Exclude(attrs);
  60866. }
  60867. static excludeNS(attrs) {
  60868. return new ExcludeNS(attrs);
  60869. }
  60870. static flipLabel(attrs) {
  60871. return new FlipLabel(attrs);
  60872. }
  60873. static fontInfo(attrs) {
  60874. return new FontInfo(attrs);
  60875. }
  60876. static formFieldFilling(attrs) {
  60877. return new FormFieldFilling(attrs);
  60878. }
  60879. static groupParent(attrs) {
  60880. return new GroupParent(attrs);
  60881. }
  60882. static ifEmpty(attrs) {
  60883. return new IfEmpty(attrs);
  60884. }
  60885. static includeXDPContent(attrs) {
  60886. return new IncludeXDPContent(attrs);
  60887. }
  60888. static incrementalLoad(attrs) {
  60889. return new IncrementalLoad(attrs);
  60890. }
  60891. static incrementalMerge(attrs) {
  60892. return new IncrementalMerge(attrs);
  60893. }
  60894. static interactive(attrs) {
  60895. return new Interactive(attrs);
  60896. }
  60897. static jog(attrs) {
  60898. return new Jog(attrs);
  60899. }
  60900. static labelPrinter(attrs) {
  60901. return new LabelPrinter(attrs);
  60902. }
  60903. static layout(attrs) {
  60904. return new Layout(attrs);
  60905. }
  60906. static level(attrs) {
  60907. return new Level(attrs);
  60908. }
  60909. static linearized(attrs) {
  60910. return new Linearized(attrs);
  60911. }
  60912. static locale(attrs) {
  60913. return new Locale(attrs);
  60914. }
  60915. static localeSet(attrs) {
  60916. return new LocaleSet(attrs);
  60917. }
  60918. static log(attrs) {
  60919. return new Log(attrs);
  60920. }
  60921. static map(attrs) {
  60922. return new MapElement(attrs);
  60923. }
  60924. static mediumInfo(attrs) {
  60925. return new MediumInfo(attrs);
  60926. }
  60927. static message(attrs) {
  60928. return new Message(attrs);
  60929. }
  60930. static messaging(attrs) {
  60931. return new Messaging(attrs);
  60932. }
  60933. static mode(attrs) {
  60934. return new Mode(attrs);
  60935. }
  60936. static modifyAnnots(attrs) {
  60937. return new ModifyAnnots(attrs);
  60938. }
  60939. static msgId(attrs) {
  60940. return new MsgId(attrs);
  60941. }
  60942. static nameAttr(attrs) {
  60943. return new NameAttr(attrs);
  60944. }
  60945. static neverEmbed(attrs) {
  60946. return new NeverEmbed(attrs);
  60947. }
  60948. static numberOfCopies(attrs) {
  60949. return new NumberOfCopies(attrs);
  60950. }
  60951. static openAction(attrs) {
  60952. return new OpenAction(attrs);
  60953. }
  60954. static output(attrs) {
  60955. return new Output(attrs);
  60956. }
  60957. static outputBin(attrs) {
  60958. return new OutputBin(attrs);
  60959. }
  60960. static outputXSL(attrs) {
  60961. return new OutputXSL(attrs);
  60962. }
  60963. static overprint(attrs) {
  60964. return new Overprint(attrs);
  60965. }
  60966. static packets(attrs) {
  60967. return new Packets(attrs);
  60968. }
  60969. static pageOffset(attrs) {
  60970. return new PageOffset(attrs);
  60971. }
  60972. static pageRange(attrs) {
  60973. return new PageRange(attrs);
  60974. }
  60975. static pagination(attrs) {
  60976. return new Pagination(attrs);
  60977. }
  60978. static paginationOverride(attrs) {
  60979. return new PaginationOverride(attrs);
  60980. }
  60981. static part(attrs) {
  60982. return new Part(attrs);
  60983. }
  60984. static pcl(attrs) {
  60985. return new Pcl(attrs);
  60986. }
  60987. static pdf(attrs) {
  60988. return new Pdf(attrs);
  60989. }
  60990. static pdfa(attrs) {
  60991. return new Pdfa(attrs);
  60992. }
  60993. static permissions(attrs) {
  60994. return new Permissions(attrs);
  60995. }
  60996. static pickTrayByPDFSize(attrs) {
  60997. return new PickTrayByPDFSize(attrs);
  60998. }
  60999. static picture(attrs) {
  61000. return new Picture(attrs);
  61001. }
  61002. static plaintextMetadata(attrs) {
  61003. return new PlaintextMetadata(attrs);
  61004. }
  61005. static presence(attrs) {
  61006. return new Presence(attrs);
  61007. }
  61008. static present(attrs) {
  61009. return new Present(attrs);
  61010. }
  61011. static print(attrs) {
  61012. return new Print(attrs);
  61013. }
  61014. static printHighQuality(attrs) {
  61015. return new PrintHighQuality(attrs);
  61016. }
  61017. static printScaling(attrs) {
  61018. return new PrintScaling(attrs);
  61019. }
  61020. static printerName(attrs) {
  61021. return new PrinterName(attrs);
  61022. }
  61023. static producer(attrs) {
  61024. return new Producer(attrs);
  61025. }
  61026. static ps(attrs) {
  61027. return new Ps(attrs);
  61028. }
  61029. static range(attrs) {
  61030. return new Range(attrs);
  61031. }
  61032. static record(attrs) {
  61033. return new Record(attrs);
  61034. }
  61035. static relevant(attrs) {
  61036. return new Relevant(attrs);
  61037. }
  61038. static rename(attrs) {
  61039. return new Rename(attrs);
  61040. }
  61041. static renderPolicy(attrs) {
  61042. return new RenderPolicy(attrs);
  61043. }
  61044. static runScripts(attrs) {
  61045. return new RunScripts(attrs);
  61046. }
  61047. static script(attrs) {
  61048. return new Script(attrs);
  61049. }
  61050. static scriptModel(attrs) {
  61051. return new ScriptModel(attrs);
  61052. }
  61053. static severity(attrs) {
  61054. return new Severity(attrs);
  61055. }
  61056. static silentPrint(attrs) {
  61057. return new SilentPrint(attrs);
  61058. }
  61059. static staple(attrs) {
  61060. return new Staple(attrs);
  61061. }
  61062. static startNode(attrs) {
  61063. return new StartNode(attrs);
  61064. }
  61065. static startPage(attrs) {
  61066. return new StartPage(attrs);
  61067. }
  61068. static submitFormat(attrs) {
  61069. return new SubmitFormat(attrs);
  61070. }
  61071. static submitUrl(attrs) {
  61072. return new SubmitUrl(attrs);
  61073. }
  61074. static subsetBelow(attrs) {
  61075. return new SubsetBelow(attrs);
  61076. }
  61077. static suppressBanner(attrs) {
  61078. return new SuppressBanner(attrs);
  61079. }
  61080. static tagged(attrs) {
  61081. return new Tagged(attrs);
  61082. }
  61083. static template(attrs) {
  61084. return new Template(attrs);
  61085. }
  61086. static templateCache(attrs) {
  61087. return new TemplateCache(attrs);
  61088. }
  61089. static threshold(attrs) {
  61090. return new Threshold(attrs);
  61091. }
  61092. static to(attrs) {
  61093. return new To(attrs);
  61094. }
  61095. static trace(attrs) {
  61096. return new Trace(attrs);
  61097. }
  61098. static transform(attrs) {
  61099. return new Transform(attrs);
  61100. }
  61101. static type(attrs) {
  61102. return new Type(attrs);
  61103. }
  61104. static uri(attrs) {
  61105. return new Uri(attrs);
  61106. }
  61107. static validate(attrs) {
  61108. return new Validate(attrs);
  61109. }
  61110. static validateApprovalSignatures(attrs) {
  61111. return new ValidateApprovalSignatures(attrs);
  61112. }
  61113. static validationMessaging(attrs) {
  61114. return new ValidationMessaging(attrs);
  61115. }
  61116. static version(attrs) {
  61117. return new Version(attrs);
  61118. }
  61119. static versionControl(attrs) {
  61120. return new VersionControl(attrs);
  61121. }
  61122. static viewerPreferences(attrs) {
  61123. return new ViewerPreferences(attrs);
  61124. }
  61125. static webClient(attrs) {
  61126. return new WebClient(attrs);
  61127. }
  61128. static whitespace(attrs) {
  61129. return new Whitespace(attrs);
  61130. }
  61131. static window(attrs) {
  61132. return new Window(attrs);
  61133. }
  61134. static xdc(attrs) {
  61135. return new Xdc(attrs);
  61136. }
  61137. static xdp(attrs) {
  61138. return new Xdp(attrs);
  61139. }
  61140. static xsl(attrs) {
  61141. return new Xsl(attrs);
  61142. }
  61143. static zpl(attrs) {
  61144. return new Zpl(attrs);
  61145. }
  61146. }
  61147. exports.ConfigNamespace = ConfigNamespace;
  61148. /***/ }),
  61149. /* 92 */
  61150. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  61151. Object.defineProperty(exports, "__esModule", ({
  61152. value: true
  61153. }));
  61154. exports.ConnectionSetNamespace = void 0;
  61155. var _namespaces = __w_pdfjs_require__(79);
  61156. var _xfa_object = __w_pdfjs_require__(77);
  61157. const CONNECTION_SET_NS_ID = _namespaces.NamespaceIds.connectionSet.id;
  61158. class ConnectionSet extends _xfa_object.XFAObject {
  61159. constructor(attributes) {
  61160. super(CONNECTION_SET_NS_ID, "connectionSet", true);
  61161. this.wsdlConnection = new _xfa_object.XFAObjectArray();
  61162. this.xmlConnection = new _xfa_object.XFAObjectArray();
  61163. this.xsdConnection = new _xfa_object.XFAObjectArray();
  61164. }
  61165. }
  61166. class EffectiveInputPolicy extends _xfa_object.XFAObject {
  61167. constructor(attributes) {
  61168. super(CONNECTION_SET_NS_ID, "effectiveInputPolicy");
  61169. this.id = attributes.id || "";
  61170. this.name = attributes.name || "";
  61171. this.use = attributes.use || "";
  61172. this.usehref = attributes.usehref || "";
  61173. }
  61174. }
  61175. class EffectiveOutputPolicy extends _xfa_object.XFAObject {
  61176. constructor(attributes) {
  61177. super(CONNECTION_SET_NS_ID, "effectiveOutputPolicy");
  61178. this.id = attributes.id || "";
  61179. this.name = attributes.name || "";
  61180. this.use = attributes.use || "";
  61181. this.usehref = attributes.usehref || "";
  61182. }
  61183. }
  61184. class Operation extends _xfa_object.StringObject {
  61185. constructor(attributes) {
  61186. super(CONNECTION_SET_NS_ID, "operation");
  61187. this.id = attributes.id || "";
  61188. this.input = attributes.input || "";
  61189. this.name = attributes.name || "";
  61190. this.output = attributes.output || "";
  61191. this.use = attributes.use || "";
  61192. this.usehref = attributes.usehref || "";
  61193. }
  61194. }
  61195. class RootElement extends _xfa_object.StringObject {
  61196. constructor(attributes) {
  61197. super(CONNECTION_SET_NS_ID, "rootElement");
  61198. this.id = attributes.id || "";
  61199. this.name = attributes.name || "";
  61200. this.use = attributes.use || "";
  61201. this.usehref = attributes.usehref || "";
  61202. }
  61203. }
  61204. class SoapAction extends _xfa_object.StringObject {
  61205. constructor(attributes) {
  61206. super(CONNECTION_SET_NS_ID, "soapAction");
  61207. this.id = attributes.id || "";
  61208. this.name = attributes.name || "";
  61209. this.use = attributes.use || "";
  61210. this.usehref = attributes.usehref || "";
  61211. }
  61212. }
  61213. class SoapAddress extends _xfa_object.StringObject {
  61214. constructor(attributes) {
  61215. super(CONNECTION_SET_NS_ID, "soapAddress");
  61216. this.id = attributes.id || "";
  61217. this.name = attributes.name || "";
  61218. this.use = attributes.use || "";
  61219. this.usehref = attributes.usehref || "";
  61220. }
  61221. }
  61222. class Uri extends _xfa_object.StringObject {
  61223. constructor(attributes) {
  61224. super(CONNECTION_SET_NS_ID, "uri");
  61225. this.id = attributes.id || "";
  61226. this.name = attributes.name || "";
  61227. this.use = attributes.use || "";
  61228. this.usehref = attributes.usehref || "";
  61229. }
  61230. }
  61231. class WsdlAddress extends _xfa_object.StringObject {
  61232. constructor(attributes) {
  61233. super(CONNECTION_SET_NS_ID, "wsdlAddress");
  61234. this.id = attributes.id || "";
  61235. this.name = attributes.name || "";
  61236. this.use = attributes.use || "";
  61237. this.usehref = attributes.usehref || "";
  61238. }
  61239. }
  61240. class WsdlConnection extends _xfa_object.XFAObject {
  61241. constructor(attributes) {
  61242. super(CONNECTION_SET_NS_ID, "wsdlConnection", true);
  61243. this.dataDescription = attributes.dataDescription || "";
  61244. this.name = attributes.name || "";
  61245. this.effectiveInputPolicy = null;
  61246. this.effectiveOutputPolicy = null;
  61247. this.operation = null;
  61248. this.soapAction = null;
  61249. this.soapAddress = null;
  61250. this.wsdlAddress = null;
  61251. }
  61252. }
  61253. class XmlConnection extends _xfa_object.XFAObject {
  61254. constructor(attributes) {
  61255. super(CONNECTION_SET_NS_ID, "xmlConnection", true);
  61256. this.dataDescription = attributes.dataDescription || "";
  61257. this.name = attributes.name || "";
  61258. this.uri = null;
  61259. }
  61260. }
  61261. class XsdConnection extends _xfa_object.XFAObject {
  61262. constructor(attributes) {
  61263. super(CONNECTION_SET_NS_ID, "xsdConnection", true);
  61264. this.dataDescription = attributes.dataDescription || "";
  61265. this.name = attributes.name || "";
  61266. this.rootElement = null;
  61267. this.uri = null;
  61268. }
  61269. }
  61270. class ConnectionSetNamespace {
  61271. static [_namespaces.$buildXFAObject](name, attributes) {
  61272. if (ConnectionSetNamespace.hasOwnProperty(name)) {
  61273. return ConnectionSetNamespace[name](attributes);
  61274. }
  61275. return undefined;
  61276. }
  61277. static connectionSet(attrs) {
  61278. return new ConnectionSet(attrs);
  61279. }
  61280. static effectiveInputPolicy(attrs) {
  61281. return new EffectiveInputPolicy(attrs);
  61282. }
  61283. static effectiveOutputPolicy(attrs) {
  61284. return new EffectiveOutputPolicy(attrs);
  61285. }
  61286. static operation(attrs) {
  61287. return new Operation(attrs);
  61288. }
  61289. static rootElement(attrs) {
  61290. return new RootElement(attrs);
  61291. }
  61292. static soapAction(attrs) {
  61293. return new SoapAction(attrs);
  61294. }
  61295. static soapAddress(attrs) {
  61296. return new SoapAddress(attrs);
  61297. }
  61298. static uri(attrs) {
  61299. return new Uri(attrs);
  61300. }
  61301. static wsdlAddress(attrs) {
  61302. return new WsdlAddress(attrs);
  61303. }
  61304. static wsdlConnection(attrs) {
  61305. return new WsdlConnection(attrs);
  61306. }
  61307. static xmlConnection(attrs) {
  61308. return new XmlConnection(attrs);
  61309. }
  61310. static xsdConnection(attrs) {
  61311. return new XsdConnection(attrs);
  61312. }
  61313. }
  61314. exports.ConnectionSetNamespace = ConnectionSetNamespace;
  61315. /***/ }),
  61316. /* 93 */
  61317. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  61318. Object.defineProperty(exports, "__esModule", ({
  61319. value: true
  61320. }));
  61321. exports.DatasetsNamespace = void 0;
  61322. var _xfa_object = __w_pdfjs_require__(77);
  61323. var _namespaces = __w_pdfjs_require__(79);
  61324. const DATASETS_NS_ID = _namespaces.NamespaceIds.datasets.id;
  61325. class Data extends _xfa_object.XmlObject {
  61326. constructor(attributes) {
  61327. super(DATASETS_NS_ID, "data", attributes);
  61328. }
  61329. [_xfa_object.$isNsAgnostic]() {
  61330. return true;
  61331. }
  61332. }
  61333. class Datasets extends _xfa_object.XFAObject {
  61334. constructor(attributes) {
  61335. super(DATASETS_NS_ID, "datasets", true);
  61336. this.data = null;
  61337. this.Signature = null;
  61338. }
  61339. [_xfa_object.$onChild](child) {
  61340. const name = child[_xfa_object.$nodeName];
  61341. if (name === "data" && child[_xfa_object.$namespaceId] === DATASETS_NS_ID || name === "Signature" && child[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.signature.id) {
  61342. this[name] = child;
  61343. }
  61344. this[_xfa_object.$appendChild](child);
  61345. }
  61346. }
  61347. class DatasetsNamespace {
  61348. static [_namespaces.$buildXFAObject](name, attributes) {
  61349. if (DatasetsNamespace.hasOwnProperty(name)) {
  61350. return DatasetsNamespace[name](attributes);
  61351. }
  61352. return undefined;
  61353. }
  61354. static datasets(attributes) {
  61355. return new Datasets(attributes);
  61356. }
  61357. static data(attributes) {
  61358. return new Data(attributes);
  61359. }
  61360. }
  61361. exports.DatasetsNamespace = DatasetsNamespace;
  61362. /***/ }),
  61363. /* 94 */
  61364. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  61365. Object.defineProperty(exports, "__esModule", ({
  61366. value: true
  61367. }));
  61368. exports.LocaleSetNamespace = void 0;
  61369. var _namespaces = __w_pdfjs_require__(79);
  61370. var _xfa_object = __w_pdfjs_require__(77);
  61371. var _utils = __w_pdfjs_require__(78);
  61372. const LOCALE_SET_NS_ID = _namespaces.NamespaceIds.localeSet.id;
  61373. class CalendarSymbols extends _xfa_object.XFAObject {
  61374. constructor(attributes) {
  61375. super(LOCALE_SET_NS_ID, "calendarSymbols", true);
  61376. this.name = "gregorian";
  61377. this.dayNames = new _xfa_object.XFAObjectArray(2);
  61378. this.eraNames = null;
  61379. this.meridiemNames = null;
  61380. this.monthNames = new _xfa_object.XFAObjectArray(2);
  61381. }
  61382. }
  61383. class CurrencySymbol extends _xfa_object.StringObject {
  61384. constructor(attributes) {
  61385. super(LOCALE_SET_NS_ID, "currencySymbol");
  61386. this.name = (0, _utils.getStringOption)(attributes.name, ["symbol", "isoname", "decimal"]);
  61387. }
  61388. }
  61389. class CurrencySymbols extends _xfa_object.XFAObject {
  61390. constructor(attributes) {
  61391. super(LOCALE_SET_NS_ID, "currencySymbols", true);
  61392. this.currencySymbol = new _xfa_object.XFAObjectArray(3);
  61393. }
  61394. }
  61395. class DatePattern extends _xfa_object.StringObject {
  61396. constructor(attributes) {
  61397. super(LOCALE_SET_NS_ID, "datePattern");
  61398. this.name = (0, _utils.getStringOption)(attributes.name, ["full", "long", "med", "short"]);
  61399. }
  61400. }
  61401. class DatePatterns extends _xfa_object.XFAObject {
  61402. constructor(attributes) {
  61403. super(LOCALE_SET_NS_ID, "datePatterns", true);
  61404. this.datePattern = new _xfa_object.XFAObjectArray(4);
  61405. }
  61406. }
  61407. class DateTimeSymbols extends _xfa_object.ContentObject {
  61408. constructor(attributes) {
  61409. super(LOCALE_SET_NS_ID, "dateTimeSymbols");
  61410. }
  61411. }
  61412. class Day extends _xfa_object.StringObject {
  61413. constructor(attributes) {
  61414. super(LOCALE_SET_NS_ID, "day");
  61415. }
  61416. }
  61417. class DayNames extends _xfa_object.XFAObject {
  61418. constructor(attributes) {
  61419. super(LOCALE_SET_NS_ID, "dayNames", true);
  61420. this.abbr = (0, _utils.getInteger)({
  61421. data: attributes.abbr,
  61422. defaultValue: 0,
  61423. validate: x => x === 1
  61424. });
  61425. this.day = new _xfa_object.XFAObjectArray(7);
  61426. }
  61427. }
  61428. class Era extends _xfa_object.StringObject {
  61429. constructor(attributes) {
  61430. super(LOCALE_SET_NS_ID, "era");
  61431. }
  61432. }
  61433. class EraNames extends _xfa_object.XFAObject {
  61434. constructor(attributes) {
  61435. super(LOCALE_SET_NS_ID, "eraNames", true);
  61436. this.era = new _xfa_object.XFAObjectArray(2);
  61437. }
  61438. }
  61439. class Locale extends _xfa_object.XFAObject {
  61440. constructor(attributes) {
  61441. super(LOCALE_SET_NS_ID, "locale", true);
  61442. this.desc = attributes.desc || "";
  61443. this.name = "isoname";
  61444. this.calendarSymbols = null;
  61445. this.currencySymbols = null;
  61446. this.datePatterns = null;
  61447. this.dateTimeSymbols = null;
  61448. this.numberPatterns = null;
  61449. this.numberSymbols = null;
  61450. this.timePatterns = null;
  61451. this.typeFaces = null;
  61452. }
  61453. }
  61454. class LocaleSet extends _xfa_object.XFAObject {
  61455. constructor(attributes) {
  61456. super(LOCALE_SET_NS_ID, "localeSet", true);
  61457. this.locale = new _xfa_object.XFAObjectArray();
  61458. }
  61459. }
  61460. class Meridiem extends _xfa_object.StringObject {
  61461. constructor(attributes) {
  61462. super(LOCALE_SET_NS_ID, "meridiem");
  61463. }
  61464. }
  61465. class MeridiemNames extends _xfa_object.XFAObject {
  61466. constructor(attributes) {
  61467. super(LOCALE_SET_NS_ID, "meridiemNames", true);
  61468. this.meridiem = new _xfa_object.XFAObjectArray(2);
  61469. }
  61470. }
  61471. class Month extends _xfa_object.StringObject {
  61472. constructor(attributes) {
  61473. super(LOCALE_SET_NS_ID, "month");
  61474. }
  61475. }
  61476. class MonthNames extends _xfa_object.XFAObject {
  61477. constructor(attributes) {
  61478. super(LOCALE_SET_NS_ID, "monthNames", true);
  61479. this.abbr = (0, _utils.getInteger)({
  61480. data: attributes.abbr,
  61481. defaultValue: 0,
  61482. validate: x => x === 1
  61483. });
  61484. this.month = new _xfa_object.XFAObjectArray(12);
  61485. }
  61486. }
  61487. class NumberPattern extends _xfa_object.StringObject {
  61488. constructor(attributes) {
  61489. super(LOCALE_SET_NS_ID, "numberPattern");
  61490. this.name = (0, _utils.getStringOption)(attributes.name, ["full", "long", "med", "short"]);
  61491. }
  61492. }
  61493. class NumberPatterns extends _xfa_object.XFAObject {
  61494. constructor(attributes) {
  61495. super(LOCALE_SET_NS_ID, "numberPatterns", true);
  61496. this.numberPattern = new _xfa_object.XFAObjectArray(4);
  61497. }
  61498. }
  61499. class NumberSymbol extends _xfa_object.StringObject {
  61500. constructor(attributes) {
  61501. super(LOCALE_SET_NS_ID, "numberSymbol");
  61502. this.name = (0, _utils.getStringOption)(attributes.name, ["decimal", "grouping", "percent", "minus", "zero"]);
  61503. }
  61504. }
  61505. class NumberSymbols extends _xfa_object.XFAObject {
  61506. constructor(attributes) {
  61507. super(LOCALE_SET_NS_ID, "numberSymbols", true);
  61508. this.numberSymbol = new _xfa_object.XFAObjectArray(5);
  61509. }
  61510. }
  61511. class TimePattern extends _xfa_object.StringObject {
  61512. constructor(attributes) {
  61513. super(LOCALE_SET_NS_ID, "timePattern");
  61514. this.name = (0, _utils.getStringOption)(attributes.name, ["full", "long", "med", "short"]);
  61515. }
  61516. }
  61517. class TimePatterns extends _xfa_object.XFAObject {
  61518. constructor(attributes) {
  61519. super(LOCALE_SET_NS_ID, "timePatterns", true);
  61520. this.timePattern = new _xfa_object.XFAObjectArray(4);
  61521. }
  61522. }
  61523. class TypeFace extends _xfa_object.XFAObject {
  61524. constructor(attributes) {
  61525. super(LOCALE_SET_NS_ID, "typeFace", true);
  61526. this.name = attributes.name | "";
  61527. }
  61528. }
  61529. class TypeFaces extends _xfa_object.XFAObject {
  61530. constructor(attributes) {
  61531. super(LOCALE_SET_NS_ID, "typeFaces", true);
  61532. this.typeFace = new _xfa_object.XFAObjectArray();
  61533. }
  61534. }
  61535. class LocaleSetNamespace {
  61536. static [_namespaces.$buildXFAObject](name, attributes) {
  61537. if (LocaleSetNamespace.hasOwnProperty(name)) {
  61538. return LocaleSetNamespace[name](attributes);
  61539. }
  61540. return undefined;
  61541. }
  61542. static calendarSymbols(attrs) {
  61543. return new CalendarSymbols(attrs);
  61544. }
  61545. static currencySymbol(attrs) {
  61546. return new CurrencySymbol(attrs);
  61547. }
  61548. static currencySymbols(attrs) {
  61549. return new CurrencySymbols(attrs);
  61550. }
  61551. static datePattern(attrs) {
  61552. return new DatePattern(attrs);
  61553. }
  61554. static datePatterns(attrs) {
  61555. return new DatePatterns(attrs);
  61556. }
  61557. static dateTimeSymbols(attrs) {
  61558. return new DateTimeSymbols(attrs);
  61559. }
  61560. static day(attrs) {
  61561. return new Day(attrs);
  61562. }
  61563. static dayNames(attrs) {
  61564. return new DayNames(attrs);
  61565. }
  61566. static era(attrs) {
  61567. return new Era(attrs);
  61568. }
  61569. static eraNames(attrs) {
  61570. return new EraNames(attrs);
  61571. }
  61572. static locale(attrs) {
  61573. return new Locale(attrs);
  61574. }
  61575. static localeSet(attrs) {
  61576. return new LocaleSet(attrs);
  61577. }
  61578. static meridiem(attrs) {
  61579. return new Meridiem(attrs);
  61580. }
  61581. static meridiemNames(attrs) {
  61582. return new MeridiemNames(attrs);
  61583. }
  61584. static month(attrs) {
  61585. return new Month(attrs);
  61586. }
  61587. static monthNames(attrs) {
  61588. return new MonthNames(attrs);
  61589. }
  61590. static numberPattern(attrs) {
  61591. return new NumberPattern(attrs);
  61592. }
  61593. static numberPatterns(attrs) {
  61594. return new NumberPatterns(attrs);
  61595. }
  61596. static numberSymbol(attrs) {
  61597. return new NumberSymbol(attrs);
  61598. }
  61599. static numberSymbols(attrs) {
  61600. return new NumberSymbols(attrs);
  61601. }
  61602. static timePattern(attrs) {
  61603. return new TimePattern(attrs);
  61604. }
  61605. static timePatterns(attrs) {
  61606. return new TimePatterns(attrs);
  61607. }
  61608. static typeFace(attrs) {
  61609. return new TypeFace(attrs);
  61610. }
  61611. static typeFaces(attrs) {
  61612. return new TypeFaces(attrs);
  61613. }
  61614. }
  61615. exports.LocaleSetNamespace = LocaleSetNamespace;
  61616. /***/ }),
  61617. /* 95 */
  61618. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  61619. Object.defineProperty(exports, "__esModule", ({
  61620. value: true
  61621. }));
  61622. exports.SignatureNamespace = void 0;
  61623. var _namespaces = __w_pdfjs_require__(79);
  61624. var _xfa_object = __w_pdfjs_require__(77);
  61625. const SIGNATURE_NS_ID = _namespaces.NamespaceIds.signature.id;
  61626. class Signature extends _xfa_object.XFAObject {
  61627. constructor(attributes) {
  61628. super(SIGNATURE_NS_ID, "signature", true);
  61629. }
  61630. }
  61631. class SignatureNamespace {
  61632. static [_namespaces.$buildXFAObject](name, attributes) {
  61633. if (SignatureNamespace.hasOwnProperty(name)) {
  61634. return SignatureNamespace[name](attributes);
  61635. }
  61636. return undefined;
  61637. }
  61638. static signature(attributes) {
  61639. return new Signature(attributes);
  61640. }
  61641. }
  61642. exports.SignatureNamespace = SignatureNamespace;
  61643. /***/ }),
  61644. /* 96 */
  61645. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  61646. Object.defineProperty(exports, "__esModule", ({
  61647. value: true
  61648. }));
  61649. exports.StylesheetNamespace = void 0;
  61650. var _namespaces = __w_pdfjs_require__(79);
  61651. var _xfa_object = __w_pdfjs_require__(77);
  61652. const STYLESHEET_NS_ID = _namespaces.NamespaceIds.stylesheet.id;
  61653. class Stylesheet extends _xfa_object.XFAObject {
  61654. constructor(attributes) {
  61655. super(STYLESHEET_NS_ID, "stylesheet", true);
  61656. }
  61657. }
  61658. class StylesheetNamespace {
  61659. static [_namespaces.$buildXFAObject](name, attributes) {
  61660. if (StylesheetNamespace.hasOwnProperty(name)) {
  61661. return StylesheetNamespace[name](attributes);
  61662. }
  61663. return undefined;
  61664. }
  61665. static stylesheet(attributes) {
  61666. return new Stylesheet(attributes);
  61667. }
  61668. }
  61669. exports.StylesheetNamespace = StylesheetNamespace;
  61670. /***/ }),
  61671. /* 97 */
  61672. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  61673. Object.defineProperty(exports, "__esModule", ({
  61674. value: true
  61675. }));
  61676. exports.XdpNamespace = void 0;
  61677. var _namespaces = __w_pdfjs_require__(79);
  61678. var _xfa_object = __w_pdfjs_require__(77);
  61679. const XDP_NS_ID = _namespaces.NamespaceIds.xdp.id;
  61680. class Xdp extends _xfa_object.XFAObject {
  61681. constructor(attributes) {
  61682. super(XDP_NS_ID, "xdp", true);
  61683. this.uuid = attributes.uuid || "";
  61684. this.timeStamp = attributes.timeStamp || "";
  61685. this.config = null;
  61686. this.connectionSet = null;
  61687. this.datasets = null;
  61688. this.localeSet = null;
  61689. this.stylesheet = new _xfa_object.XFAObjectArray();
  61690. this.template = null;
  61691. }
  61692. [_xfa_object.$onChildCheck](child) {
  61693. const ns = _namespaces.NamespaceIds[child[_xfa_object.$nodeName]];
  61694. return ns && child[_xfa_object.$namespaceId] === ns.id;
  61695. }
  61696. }
  61697. class XdpNamespace {
  61698. static [_namespaces.$buildXFAObject](name, attributes) {
  61699. if (XdpNamespace.hasOwnProperty(name)) {
  61700. return XdpNamespace[name](attributes);
  61701. }
  61702. return undefined;
  61703. }
  61704. static xdp(attributes) {
  61705. return new Xdp(attributes);
  61706. }
  61707. }
  61708. exports.XdpNamespace = XdpNamespace;
  61709. /***/ }),
  61710. /* 98 */
  61711. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  61712. Object.defineProperty(exports, "__esModule", ({
  61713. value: true
  61714. }));
  61715. exports.XhtmlNamespace = void 0;
  61716. var _xfa_object = __w_pdfjs_require__(77);
  61717. var _namespaces = __w_pdfjs_require__(79);
  61718. var _html_utils = __w_pdfjs_require__(84);
  61719. var _utils = __w_pdfjs_require__(78);
  61720. const XHTML_NS_ID = _namespaces.NamespaceIds.xhtml.id;
  61721. const $richText = Symbol();
  61722. 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"]);
  61723. 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) => {
  61724. value = original.fontSize = (0, _utils.getMeasurement)(value);
  61725. return (0, _html_utils.measureToString)(0.99 * value);
  61726. }], ["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))]]);
  61727. const spacesRegExp = /\s+/g;
  61728. const crlfRegExp = /[\r\n]+/g;
  61729. const crlfForRichTextRegExp = /\r\n?/g;
  61730. function mapStyle(styleStr, node, richText) {
  61731. const style = Object.create(null);
  61732. if (!styleStr) {
  61733. return style;
  61734. }
  61735. const original = Object.create(null);
  61736. for (const [key, value] of styleStr.split(";").map(s => s.split(":", 2))) {
  61737. const mapping = StyleMapping.get(key);
  61738. if (mapping === "") {
  61739. continue;
  61740. }
  61741. let newValue = value;
  61742. if (mapping) {
  61743. if (typeof mapping === "string") {
  61744. newValue = mapping;
  61745. } else {
  61746. newValue = mapping(value, original);
  61747. }
  61748. }
  61749. if (key.endsWith("scale")) {
  61750. if (style.transform) {
  61751. style.transform = `${style[key]} ${newValue}`;
  61752. } else {
  61753. style.transform = newValue;
  61754. }
  61755. } else {
  61756. style[key.replaceAll(/-([a-zA-Z])/g, (_, x) => x.toUpperCase())] = newValue;
  61757. }
  61758. }
  61759. if (style.fontFamily) {
  61760. (0, _html_utils.setFontFamily)({
  61761. typeface: style.fontFamily,
  61762. weight: style.fontWeight || "normal",
  61763. posture: style.fontStyle || "normal",
  61764. size: original.fontSize || 0
  61765. }, node, node[_xfa_object.$globalData].fontFinder, style);
  61766. }
  61767. if (richText && style.verticalAlign && style.verticalAlign !== "0px" && style.fontSize) {
  61768. const SUB_SUPER_SCRIPT_FACTOR = 0.583;
  61769. const VERTICAL_FACTOR = 0.333;
  61770. const fontSize = (0, _utils.getMeasurement)(style.fontSize);
  61771. style.fontSize = (0, _html_utils.measureToString)(fontSize * SUB_SUPER_SCRIPT_FACTOR);
  61772. style.verticalAlign = (0, _html_utils.measureToString)(Math.sign((0, _utils.getMeasurement)(style.verticalAlign)) * fontSize * VERTICAL_FACTOR);
  61773. }
  61774. if (richText && style.fontSize) {
  61775. style.fontSize = `calc(${style.fontSize} * var(--scale-factor))`;
  61776. }
  61777. (0, _html_utils.fixTextIndent)(style);
  61778. return style;
  61779. }
  61780. function checkStyle(node) {
  61781. if (!node.style) {
  61782. return "";
  61783. }
  61784. return node.style.trim().split(/\s*;\s*/).filter(s => !!s).map(s => s.split(/\s*:\s*/, 2)).filter(([key, value]) => {
  61785. if (key === "font-family") {
  61786. node[_xfa_object.$globalData].usedTypefaces.add(value);
  61787. }
  61788. return VALID_STYLES.has(key);
  61789. }).map(kv => kv.join(":")).join(";");
  61790. }
  61791. const NoWhites = new Set(["body", "html"]);
  61792. class XhtmlObject extends _xfa_object.XmlObject {
  61793. constructor(attributes, name) {
  61794. super(XHTML_NS_ID, name);
  61795. this[$richText] = false;
  61796. this.style = attributes.style || "";
  61797. }
  61798. [_xfa_object.$clean](builder) {
  61799. super[_xfa_object.$clean](builder);
  61800. this.style = checkStyle(this);
  61801. }
  61802. [_xfa_object.$acceptWhitespace]() {
  61803. return !NoWhites.has(this[_xfa_object.$nodeName]);
  61804. }
  61805. [_xfa_object.$onText](str, richText = false) {
  61806. if (!richText) {
  61807. str = str.replace(crlfRegExp, "");
  61808. if (!this.style.includes("xfa-spacerun:yes")) {
  61809. str = str.replace(spacesRegExp, " ");
  61810. }
  61811. } else {
  61812. this[$richText] = true;
  61813. }
  61814. if (str) {
  61815. this[_xfa_object.$content] += str;
  61816. }
  61817. }
  61818. [_xfa_object.$pushGlyphs](measure, mustPop = true) {
  61819. const xfaFont = Object.create(null);
  61820. const margin = {
  61821. top: NaN,
  61822. bottom: NaN,
  61823. left: NaN,
  61824. right: NaN
  61825. };
  61826. let lineHeight = null;
  61827. for (const [key, value] of this.style.split(";").map(s => s.split(":", 2))) {
  61828. switch (key) {
  61829. case "font-family":
  61830. xfaFont.typeface = (0, _utils.stripQuotes)(value);
  61831. break;
  61832. case "font-size":
  61833. xfaFont.size = (0, _utils.getMeasurement)(value);
  61834. break;
  61835. case "font-weight":
  61836. xfaFont.weight = value;
  61837. break;
  61838. case "font-style":
  61839. xfaFont.posture = value;
  61840. break;
  61841. case "letter-spacing":
  61842. xfaFont.letterSpacing = (0, _utils.getMeasurement)(value);
  61843. break;
  61844. case "margin":
  61845. const values = value.split(/ \t/).map(x => (0, _utils.getMeasurement)(x));
  61846. switch (values.length) {
  61847. case 1:
  61848. margin.top = margin.bottom = margin.left = margin.right = values[0];
  61849. break;
  61850. case 2:
  61851. margin.top = margin.bottom = values[0];
  61852. margin.left = margin.right = values[1];
  61853. break;
  61854. case 3:
  61855. margin.top = values[0];
  61856. margin.bottom = values[2];
  61857. margin.left = margin.right = values[1];
  61858. break;
  61859. case 4:
  61860. margin.top = values[0];
  61861. margin.left = values[1];
  61862. margin.bottom = values[2];
  61863. margin.right = values[3];
  61864. break;
  61865. }
  61866. break;
  61867. case "margin-top":
  61868. margin.top = (0, _utils.getMeasurement)(value);
  61869. break;
  61870. case "margin-bottom":
  61871. margin.bottom = (0, _utils.getMeasurement)(value);
  61872. break;
  61873. case "margin-left":
  61874. margin.left = (0, _utils.getMeasurement)(value);
  61875. break;
  61876. case "margin-right":
  61877. margin.right = (0, _utils.getMeasurement)(value);
  61878. break;
  61879. case "line-height":
  61880. lineHeight = (0, _utils.getMeasurement)(value);
  61881. break;
  61882. }
  61883. }
  61884. measure.pushData(xfaFont, margin, lineHeight);
  61885. if (this[_xfa_object.$content]) {
  61886. measure.addString(this[_xfa_object.$content]);
  61887. } else {
  61888. for (const child of this[_xfa_object.$getChildren]()) {
  61889. if (child[_xfa_object.$nodeName] === "#text") {
  61890. measure.addString(child[_xfa_object.$content]);
  61891. continue;
  61892. }
  61893. child[_xfa_object.$pushGlyphs](measure);
  61894. }
  61895. }
  61896. if (mustPop) {
  61897. measure.popFont();
  61898. }
  61899. }
  61900. [_xfa_object.$toHTML](availableSpace) {
  61901. const children = [];
  61902. this[_xfa_object.$extra] = {
  61903. children
  61904. };
  61905. this[_xfa_object.$childrenToHTML]({});
  61906. if (children.length === 0 && !this[_xfa_object.$content]) {
  61907. return _utils.HTMLResult.EMPTY;
  61908. }
  61909. let value;
  61910. if (this[$richText]) {
  61911. value = this[_xfa_object.$content] ? this[_xfa_object.$content].replace(crlfForRichTextRegExp, "\n") : undefined;
  61912. } else {
  61913. value = this[_xfa_object.$content] || undefined;
  61914. }
  61915. return _utils.HTMLResult.success({
  61916. name: this[_xfa_object.$nodeName],
  61917. attributes: {
  61918. href: this.href,
  61919. style: mapStyle(this.style, this, this[$richText])
  61920. },
  61921. children,
  61922. value
  61923. });
  61924. }
  61925. }
  61926. class A extends XhtmlObject {
  61927. constructor(attributes) {
  61928. super(attributes, "a");
  61929. this.href = (0, _html_utils.fixURL)(attributes.href) || "";
  61930. }
  61931. }
  61932. class B extends XhtmlObject {
  61933. constructor(attributes) {
  61934. super(attributes, "b");
  61935. }
  61936. [_xfa_object.$pushGlyphs](measure) {
  61937. measure.pushFont({
  61938. weight: "bold"
  61939. });
  61940. super[_xfa_object.$pushGlyphs](measure);
  61941. measure.popFont();
  61942. }
  61943. }
  61944. class Body extends XhtmlObject {
  61945. constructor(attributes) {
  61946. super(attributes, "body");
  61947. }
  61948. [_xfa_object.$toHTML](availableSpace) {
  61949. const res = super[_xfa_object.$toHTML](availableSpace);
  61950. const {
  61951. html
  61952. } = res;
  61953. if (!html) {
  61954. return _utils.HTMLResult.EMPTY;
  61955. }
  61956. html.name = "div";
  61957. html.attributes.class = ["xfaRich"];
  61958. return res;
  61959. }
  61960. }
  61961. class Br extends XhtmlObject {
  61962. constructor(attributes) {
  61963. super(attributes, "br");
  61964. }
  61965. [_xfa_object.$text]() {
  61966. return "\n";
  61967. }
  61968. [_xfa_object.$pushGlyphs](measure) {
  61969. measure.addString("\n");
  61970. }
  61971. [_xfa_object.$toHTML](availableSpace) {
  61972. return _utils.HTMLResult.success({
  61973. name: "br"
  61974. });
  61975. }
  61976. }
  61977. class Html extends XhtmlObject {
  61978. constructor(attributes) {
  61979. super(attributes, "html");
  61980. }
  61981. [_xfa_object.$toHTML](availableSpace) {
  61982. const children = [];
  61983. this[_xfa_object.$extra] = {
  61984. children
  61985. };
  61986. this[_xfa_object.$childrenToHTML]({});
  61987. if (children.length === 0) {
  61988. return _utils.HTMLResult.success({
  61989. name: "div",
  61990. attributes: {
  61991. class: ["xfaRich"],
  61992. style: {}
  61993. },
  61994. value: this[_xfa_object.$content] || ""
  61995. });
  61996. }
  61997. if (children.length === 1) {
  61998. const child = children[0];
  61999. if (child.attributes && child.attributes.class.includes("xfaRich")) {
  62000. return _utils.HTMLResult.success(child);
  62001. }
  62002. }
  62003. return _utils.HTMLResult.success({
  62004. name: "div",
  62005. attributes: {
  62006. class: ["xfaRich"],
  62007. style: {}
  62008. },
  62009. children
  62010. });
  62011. }
  62012. }
  62013. class I extends XhtmlObject {
  62014. constructor(attributes) {
  62015. super(attributes, "i");
  62016. }
  62017. [_xfa_object.$pushGlyphs](measure) {
  62018. measure.pushFont({
  62019. posture: "italic"
  62020. });
  62021. super[_xfa_object.$pushGlyphs](measure);
  62022. measure.popFont();
  62023. }
  62024. }
  62025. class Li extends XhtmlObject {
  62026. constructor(attributes) {
  62027. super(attributes, "li");
  62028. }
  62029. }
  62030. class Ol extends XhtmlObject {
  62031. constructor(attributes) {
  62032. super(attributes, "ol");
  62033. }
  62034. }
  62035. class P extends XhtmlObject {
  62036. constructor(attributes) {
  62037. super(attributes, "p");
  62038. }
  62039. [_xfa_object.$pushGlyphs](measure) {
  62040. super[_xfa_object.$pushGlyphs](measure, false);
  62041. measure.addString("\n");
  62042. measure.addPara();
  62043. measure.popFont();
  62044. }
  62045. [_xfa_object.$text]() {
  62046. const siblings = this[_xfa_object.$getParent]()[_xfa_object.$getChildren]();
  62047. if (siblings.at(-1) === this) {
  62048. return super[_xfa_object.$text]();
  62049. }
  62050. return super[_xfa_object.$text]() + "\n";
  62051. }
  62052. }
  62053. class Span extends XhtmlObject {
  62054. constructor(attributes) {
  62055. super(attributes, "span");
  62056. }
  62057. }
  62058. class Sub extends XhtmlObject {
  62059. constructor(attributes) {
  62060. super(attributes, "sub");
  62061. }
  62062. }
  62063. class Sup extends XhtmlObject {
  62064. constructor(attributes) {
  62065. super(attributes, "sup");
  62066. }
  62067. }
  62068. class Ul extends XhtmlObject {
  62069. constructor(attributes) {
  62070. super(attributes, "ul");
  62071. }
  62072. }
  62073. class XhtmlNamespace {
  62074. static [_namespaces.$buildXFAObject](name, attributes) {
  62075. if (XhtmlNamespace.hasOwnProperty(name)) {
  62076. return XhtmlNamespace[name](attributes);
  62077. }
  62078. return undefined;
  62079. }
  62080. static a(attributes) {
  62081. return new A(attributes);
  62082. }
  62083. static b(attributes) {
  62084. return new B(attributes);
  62085. }
  62086. static body(attributes) {
  62087. return new Body(attributes);
  62088. }
  62089. static br(attributes) {
  62090. return new Br(attributes);
  62091. }
  62092. static html(attributes) {
  62093. return new Html(attributes);
  62094. }
  62095. static i(attributes) {
  62096. return new I(attributes);
  62097. }
  62098. static li(attributes) {
  62099. return new Li(attributes);
  62100. }
  62101. static ol(attributes) {
  62102. return new Ol(attributes);
  62103. }
  62104. static p(attributes) {
  62105. return new P(attributes);
  62106. }
  62107. static span(attributes) {
  62108. return new Span(attributes);
  62109. }
  62110. static sub(attributes) {
  62111. return new Sub(attributes);
  62112. }
  62113. static sup(attributes) {
  62114. return new Sup(attributes);
  62115. }
  62116. static ul(attributes) {
  62117. return new Ul(attributes);
  62118. }
  62119. }
  62120. exports.XhtmlNamespace = XhtmlNamespace;
  62121. /***/ }),
  62122. /* 99 */
  62123. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  62124. Object.defineProperty(exports, "__esModule", ({
  62125. value: true
  62126. }));
  62127. exports.UnknownNamespace = void 0;
  62128. var _namespaces = __w_pdfjs_require__(79);
  62129. var _xfa_object = __w_pdfjs_require__(77);
  62130. class UnknownNamespace {
  62131. constructor(nsId) {
  62132. this.namespaceId = nsId;
  62133. }
  62134. [_namespaces.$buildXFAObject](name, attributes) {
  62135. return new _xfa_object.XmlObject(this.namespaceId, name, attributes);
  62136. }
  62137. }
  62138. exports.UnknownNamespace = UnknownNamespace;
  62139. /***/ }),
  62140. /* 100 */
  62141. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  62142. Object.defineProperty(exports, "__esModule", ({
  62143. value: true
  62144. }));
  62145. exports.DatasetReader = void 0;
  62146. var _util = __w_pdfjs_require__(2);
  62147. var _core_utils = __w_pdfjs_require__(6);
  62148. var _xml_parser = __w_pdfjs_require__(66);
  62149. function decodeString(str) {
  62150. try {
  62151. return (0, _util.stringToUTF8String)(str);
  62152. } catch (ex) {
  62153. (0, _util.warn)(`UTF-8 decoding failed: "${ex}".`);
  62154. return str;
  62155. }
  62156. }
  62157. class DatasetXMLParser extends _xml_parser.SimpleXMLParser {
  62158. constructor(options) {
  62159. super(options);
  62160. this.node = null;
  62161. }
  62162. onEndElement(name) {
  62163. const node = super.onEndElement(name);
  62164. if (node && name === "xfa:datasets") {
  62165. this.node = node;
  62166. throw new Error("Aborting DatasetXMLParser.");
  62167. }
  62168. }
  62169. }
  62170. class DatasetReader {
  62171. constructor(data) {
  62172. if (data.datasets) {
  62173. this.node = new _xml_parser.SimpleXMLParser({
  62174. hasAttributes: true
  62175. }).parseFromString(data.datasets).documentElement;
  62176. } else {
  62177. const parser = new DatasetXMLParser({
  62178. hasAttributes: true
  62179. });
  62180. try {
  62181. parser.parseFromString(data["xdp:xdp"]);
  62182. } catch (_) {}
  62183. this.node = parser.node;
  62184. }
  62185. }
  62186. getValue(path) {
  62187. if (!this.node || !path) {
  62188. return "";
  62189. }
  62190. const node = this.node.searchNode((0, _core_utils.parseXFAPath)(path), 0);
  62191. if (!node) {
  62192. return "";
  62193. }
  62194. const first = node.firstChild;
  62195. if (first && first.nodeName === "value") {
  62196. return node.children.map(child => decodeString(child.textContent));
  62197. }
  62198. return decodeString(node.textContent);
  62199. }
  62200. }
  62201. exports.DatasetReader = DatasetReader;
  62202. /***/ }),
  62203. /* 101 */
  62204. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  62205. Object.defineProperty(exports, "__esModule", ({
  62206. value: true
  62207. }));
  62208. exports.XRef = void 0;
  62209. var _util = __w_pdfjs_require__(2);
  62210. var _primitives = __w_pdfjs_require__(5);
  62211. var _core_utils = __w_pdfjs_require__(6);
  62212. var _parser = __w_pdfjs_require__(27);
  62213. var _base_stream = __w_pdfjs_require__(7);
  62214. var _crypto = __w_pdfjs_require__(67);
  62215. class XRef {
  62216. constructor(stream, pdfManager) {
  62217. this.stream = stream;
  62218. this.pdfManager = pdfManager;
  62219. this.entries = [];
  62220. this.xrefstms = Object.create(null);
  62221. this._cacheMap = new Map();
  62222. this._pendingRefs = new _primitives.RefSet();
  62223. this.stats = new _core_utils.DocStats(pdfManager.msgHandler);
  62224. this._newRefNum = null;
  62225. }
  62226. getNewRef() {
  62227. if (this._newRefNum === null) {
  62228. this._newRefNum = this.entries.length || 1;
  62229. }
  62230. return _primitives.Ref.get(this._newRefNum++, 0);
  62231. }
  62232. resetNewRef() {
  62233. this._newRefNum = null;
  62234. }
  62235. setStartXRef(startXRef) {
  62236. this.startXRefQueue = [startXRef];
  62237. }
  62238. parse(recoveryMode = false) {
  62239. let trailerDict;
  62240. if (!recoveryMode) {
  62241. trailerDict = this.readXRef();
  62242. } else {
  62243. (0, _util.warn)("Indexing all PDF objects");
  62244. trailerDict = this.indexObjects();
  62245. }
  62246. trailerDict.assignXref(this);
  62247. this.trailer = trailerDict;
  62248. let encrypt;
  62249. try {
  62250. encrypt = trailerDict.get("Encrypt");
  62251. } catch (ex) {
  62252. if (ex instanceof _core_utils.MissingDataException) {
  62253. throw ex;
  62254. }
  62255. (0, _util.warn)(`XRef.parse - Invalid "Encrypt" reference: "${ex}".`);
  62256. }
  62257. if (encrypt instanceof _primitives.Dict) {
  62258. const ids = trailerDict.get("ID");
  62259. const fileId = ids && ids.length ? ids[0] : "";
  62260. encrypt.suppressEncryption = true;
  62261. this.encrypt = new _crypto.CipherTransformFactory(encrypt, fileId, this.pdfManager.password);
  62262. }
  62263. let root;
  62264. try {
  62265. root = trailerDict.get("Root");
  62266. } catch (ex) {
  62267. if (ex instanceof _core_utils.MissingDataException) {
  62268. throw ex;
  62269. }
  62270. (0, _util.warn)(`XRef.parse - Invalid "Root" reference: "${ex}".`);
  62271. }
  62272. if (root instanceof _primitives.Dict) {
  62273. try {
  62274. const pages = root.get("Pages");
  62275. if (pages instanceof _primitives.Dict) {
  62276. this.root = root;
  62277. return;
  62278. }
  62279. } catch (ex) {
  62280. if (ex instanceof _core_utils.MissingDataException) {
  62281. throw ex;
  62282. }
  62283. (0, _util.warn)(`XRef.parse - Invalid "Pages" reference: "${ex}".`);
  62284. }
  62285. }
  62286. if (!recoveryMode) {
  62287. throw new _core_utils.XRefParseException();
  62288. }
  62289. throw new _util.InvalidPDFException("Invalid Root reference.");
  62290. }
  62291. processXRefTable(parser) {
  62292. if (!("tableState" in this)) {
  62293. this.tableState = {
  62294. entryNum: 0,
  62295. streamPos: parser.lexer.stream.pos,
  62296. parserBuf1: parser.buf1,
  62297. parserBuf2: parser.buf2
  62298. };
  62299. }
  62300. const obj = this.readXRefTable(parser);
  62301. if (!(0, _primitives.isCmd)(obj, "trailer")) {
  62302. throw new _util.FormatError("Invalid XRef table: could not find trailer dictionary");
  62303. }
  62304. let dict = parser.getObj();
  62305. if (!(dict instanceof _primitives.Dict) && dict.dict) {
  62306. dict = dict.dict;
  62307. }
  62308. if (!(dict instanceof _primitives.Dict)) {
  62309. throw new _util.FormatError("Invalid XRef table: could not parse trailer dictionary");
  62310. }
  62311. delete this.tableState;
  62312. return dict;
  62313. }
  62314. readXRefTable(parser) {
  62315. const stream = parser.lexer.stream;
  62316. const tableState = this.tableState;
  62317. stream.pos = tableState.streamPos;
  62318. parser.buf1 = tableState.parserBuf1;
  62319. parser.buf2 = tableState.parserBuf2;
  62320. let obj;
  62321. while (true) {
  62322. if (!("firstEntryNum" in tableState) || !("entryCount" in tableState)) {
  62323. if ((0, _primitives.isCmd)(obj = parser.getObj(), "trailer")) {
  62324. break;
  62325. }
  62326. tableState.firstEntryNum = obj;
  62327. tableState.entryCount = parser.getObj();
  62328. }
  62329. let first = tableState.firstEntryNum;
  62330. const count = tableState.entryCount;
  62331. if (!Number.isInteger(first) || !Number.isInteger(count)) {
  62332. throw new _util.FormatError("Invalid XRef table: wrong types in subsection header");
  62333. }
  62334. for (let i = tableState.entryNum; i < count; i++) {
  62335. tableState.streamPos = stream.pos;
  62336. tableState.entryNum = i;
  62337. tableState.parserBuf1 = parser.buf1;
  62338. tableState.parserBuf2 = parser.buf2;
  62339. const entry = {};
  62340. entry.offset = parser.getObj();
  62341. entry.gen = parser.getObj();
  62342. const type = parser.getObj();
  62343. if (type instanceof _primitives.Cmd) {
  62344. switch (type.cmd) {
  62345. case "f":
  62346. entry.free = true;
  62347. break;
  62348. case "n":
  62349. entry.uncompressed = true;
  62350. break;
  62351. }
  62352. }
  62353. if (!Number.isInteger(entry.offset) || !Number.isInteger(entry.gen) || !(entry.free || entry.uncompressed)) {
  62354. throw new _util.FormatError(`Invalid entry in XRef subsection: ${first}, ${count}`);
  62355. }
  62356. if (i === 0 && entry.free && first === 1) {
  62357. first = 0;
  62358. }
  62359. if (!this.entries[i + first]) {
  62360. this.entries[i + first] = entry;
  62361. }
  62362. }
  62363. tableState.entryNum = 0;
  62364. tableState.streamPos = stream.pos;
  62365. tableState.parserBuf1 = parser.buf1;
  62366. tableState.parserBuf2 = parser.buf2;
  62367. delete tableState.firstEntryNum;
  62368. delete tableState.entryCount;
  62369. }
  62370. if (this.entries[0] && !this.entries[0].free) {
  62371. throw new _util.FormatError("Invalid XRef table: unexpected first object");
  62372. }
  62373. return obj;
  62374. }
  62375. processXRefStream(stream) {
  62376. if (!("streamState" in this)) {
  62377. const streamParameters = stream.dict;
  62378. const byteWidths = streamParameters.get("W");
  62379. let range = streamParameters.get("Index");
  62380. if (!range) {
  62381. range = [0, streamParameters.get("Size")];
  62382. }
  62383. this.streamState = {
  62384. entryRanges: range,
  62385. byteWidths,
  62386. entryNum: 0,
  62387. streamPos: stream.pos
  62388. };
  62389. }
  62390. this.readXRefStream(stream);
  62391. delete this.streamState;
  62392. return stream.dict;
  62393. }
  62394. readXRefStream(stream) {
  62395. const streamState = this.streamState;
  62396. stream.pos = streamState.streamPos;
  62397. const [typeFieldWidth, offsetFieldWidth, generationFieldWidth] = streamState.byteWidths;
  62398. const entryRanges = streamState.entryRanges;
  62399. while (entryRanges.length > 0) {
  62400. const [first, n] = entryRanges;
  62401. if (!Number.isInteger(first) || !Number.isInteger(n)) {
  62402. throw new _util.FormatError(`Invalid XRef range fields: ${first}, ${n}`);
  62403. }
  62404. if (!Number.isInteger(typeFieldWidth) || !Number.isInteger(offsetFieldWidth) || !Number.isInteger(generationFieldWidth)) {
  62405. throw new _util.FormatError(`Invalid XRef entry fields length: ${first}, ${n}`);
  62406. }
  62407. for (let i = streamState.entryNum; i < n; ++i) {
  62408. streamState.entryNum = i;
  62409. streamState.streamPos = stream.pos;
  62410. let type = 0,
  62411. offset = 0,
  62412. generation = 0;
  62413. for (let j = 0; j < typeFieldWidth; ++j) {
  62414. const typeByte = stream.getByte();
  62415. if (typeByte === -1) {
  62416. throw new _util.FormatError("Invalid XRef byteWidths 'type'.");
  62417. }
  62418. type = type << 8 | typeByte;
  62419. }
  62420. if (typeFieldWidth === 0) {
  62421. type = 1;
  62422. }
  62423. for (let j = 0; j < offsetFieldWidth; ++j) {
  62424. const offsetByte = stream.getByte();
  62425. if (offsetByte === -1) {
  62426. throw new _util.FormatError("Invalid XRef byteWidths 'offset'.");
  62427. }
  62428. offset = offset << 8 | offsetByte;
  62429. }
  62430. for (let j = 0; j < generationFieldWidth; ++j) {
  62431. const generationByte = stream.getByte();
  62432. if (generationByte === -1) {
  62433. throw new _util.FormatError("Invalid XRef byteWidths 'generation'.");
  62434. }
  62435. generation = generation << 8 | generationByte;
  62436. }
  62437. const entry = {};
  62438. entry.offset = offset;
  62439. entry.gen = generation;
  62440. switch (type) {
  62441. case 0:
  62442. entry.free = true;
  62443. break;
  62444. case 1:
  62445. entry.uncompressed = true;
  62446. break;
  62447. case 2:
  62448. break;
  62449. default:
  62450. throw new _util.FormatError(`Invalid XRef entry type: ${type}`);
  62451. }
  62452. if (!this.entries[first + i]) {
  62453. this.entries[first + i] = entry;
  62454. }
  62455. }
  62456. streamState.entryNum = 0;
  62457. streamState.streamPos = stream.pos;
  62458. entryRanges.splice(0, 2);
  62459. }
  62460. }
  62461. indexObjects() {
  62462. const TAB = 0x9,
  62463. LF = 0xa,
  62464. CR = 0xd,
  62465. SPACE = 0x20;
  62466. const PERCENT = 0x25,
  62467. LT = 0x3c;
  62468. function readToken(data, offset) {
  62469. let token = "",
  62470. ch = data[offset];
  62471. while (ch !== LF && ch !== CR && ch !== LT) {
  62472. if (++offset >= data.length) {
  62473. break;
  62474. }
  62475. token += String.fromCharCode(ch);
  62476. ch = data[offset];
  62477. }
  62478. return token;
  62479. }
  62480. function skipUntil(data, offset, what) {
  62481. const length = what.length,
  62482. dataLength = data.length;
  62483. let skipped = 0;
  62484. while (offset < dataLength) {
  62485. let i = 0;
  62486. while (i < length && data[offset + i] === what[i]) {
  62487. ++i;
  62488. }
  62489. if (i >= length) {
  62490. break;
  62491. }
  62492. offset++;
  62493. skipped++;
  62494. }
  62495. return skipped;
  62496. }
  62497. const objRegExp = /^(\d+)\s+(\d+)\s+obj\b/;
  62498. const endobjRegExp = /\bendobj[\b\s]$/;
  62499. const nestedObjRegExp = /\s+(\d+\s+\d+\s+obj[\b\s<])$/;
  62500. const CHECK_CONTENT_LENGTH = 25;
  62501. const trailerBytes = new Uint8Array([116, 114, 97, 105, 108, 101, 114]);
  62502. const startxrefBytes = new Uint8Array([115, 116, 97, 114, 116, 120, 114, 101, 102]);
  62503. const objBytes = new Uint8Array([111, 98, 106]);
  62504. const xrefBytes = new Uint8Array([47, 88, 82, 101, 102]);
  62505. this.entries.length = 0;
  62506. this._cacheMap.clear();
  62507. const stream = this.stream;
  62508. stream.pos = 0;
  62509. const buffer = stream.getBytes(),
  62510. length = buffer.length;
  62511. let position = stream.start;
  62512. const trailers = [],
  62513. xrefStms = [];
  62514. while (position < length) {
  62515. let ch = buffer[position];
  62516. if (ch === TAB || ch === LF || ch === CR || ch === SPACE) {
  62517. ++position;
  62518. continue;
  62519. }
  62520. if (ch === PERCENT) {
  62521. do {
  62522. ++position;
  62523. if (position >= length) {
  62524. break;
  62525. }
  62526. ch = buffer[position];
  62527. } while (ch !== LF && ch !== CR);
  62528. continue;
  62529. }
  62530. const token = readToken(buffer, position);
  62531. let m;
  62532. if (token.startsWith("xref") && (token.length === 4 || /\s/.test(token[4]))) {
  62533. position += skipUntil(buffer, position, trailerBytes);
  62534. trailers.push(position);
  62535. position += skipUntil(buffer, position, startxrefBytes);
  62536. } else if (m = objRegExp.exec(token)) {
  62537. const num = m[1] | 0,
  62538. gen = m[2] | 0;
  62539. let contentLength,
  62540. startPos = position + token.length,
  62541. updateEntries = false;
  62542. if (!this.entries[num]) {
  62543. updateEntries = true;
  62544. } else if (this.entries[num].gen === gen) {
  62545. try {
  62546. const parser = new _parser.Parser({
  62547. lexer: new _parser.Lexer(stream.makeSubStream(startPos))
  62548. });
  62549. parser.getObj();
  62550. updateEntries = true;
  62551. } catch (ex) {
  62552. if (ex instanceof _core_utils.ParserEOFException) {
  62553. (0, _util.warn)(`indexObjects -- checking object (${token}): "${ex}".`);
  62554. } else {
  62555. updateEntries = true;
  62556. }
  62557. }
  62558. }
  62559. if (updateEntries) {
  62560. this.entries[num] = {
  62561. offset: position - stream.start,
  62562. gen,
  62563. uncompressed: true
  62564. };
  62565. }
  62566. while (startPos < buffer.length) {
  62567. const endPos = startPos + skipUntil(buffer, startPos, objBytes) + 4;
  62568. contentLength = endPos - position;
  62569. const checkPos = Math.max(endPos - CHECK_CONTENT_LENGTH, startPos);
  62570. const tokenStr = (0, _util.bytesToString)(buffer.subarray(checkPos, endPos));
  62571. if (endobjRegExp.test(tokenStr)) {
  62572. break;
  62573. } else {
  62574. const objToken = nestedObjRegExp.exec(tokenStr);
  62575. if (objToken && objToken[1]) {
  62576. (0, _util.warn)('indexObjects: Found new "obj" inside of another "obj", ' + 'caused by missing "endobj" -- trying to recover.');
  62577. contentLength -= objToken[1].length;
  62578. break;
  62579. }
  62580. }
  62581. startPos = endPos;
  62582. }
  62583. const content = buffer.subarray(position, position + contentLength);
  62584. const xrefTagOffset = skipUntil(content, 0, xrefBytes);
  62585. if (xrefTagOffset < contentLength && content[xrefTagOffset + 5] < 64) {
  62586. xrefStms.push(position - stream.start);
  62587. this.xrefstms[position - stream.start] = 1;
  62588. }
  62589. position += contentLength;
  62590. } else if (token.startsWith("trailer") && (token.length === 7 || /\s/.test(token[7]))) {
  62591. trailers.push(position);
  62592. position += skipUntil(buffer, position, startxrefBytes);
  62593. } else {
  62594. position += token.length + 1;
  62595. }
  62596. }
  62597. for (let i = 0, ii = xrefStms.length; i < ii; ++i) {
  62598. this.startXRefQueue.push(xrefStms[i]);
  62599. this.readXRef(true);
  62600. }
  62601. let trailerDict;
  62602. for (let i = 0, ii = trailers.length; i < ii; ++i) {
  62603. stream.pos = trailers[i];
  62604. const parser = new _parser.Parser({
  62605. lexer: new _parser.Lexer(stream),
  62606. xref: this,
  62607. allowStreams: true,
  62608. recoveryMode: true
  62609. });
  62610. const obj = parser.getObj();
  62611. if (!(0, _primitives.isCmd)(obj, "trailer")) {
  62612. continue;
  62613. }
  62614. const dict = parser.getObj();
  62615. if (!(dict instanceof _primitives.Dict)) {
  62616. continue;
  62617. }
  62618. try {
  62619. const rootDict = dict.get("Root");
  62620. if (!(rootDict instanceof _primitives.Dict)) {
  62621. continue;
  62622. }
  62623. const pagesDict = rootDict.get("Pages");
  62624. if (!(pagesDict instanceof _primitives.Dict)) {
  62625. continue;
  62626. }
  62627. const pagesCount = pagesDict.get("Count");
  62628. if (!Number.isInteger(pagesCount)) {
  62629. continue;
  62630. }
  62631. } catch (ex) {
  62632. continue;
  62633. }
  62634. if (dict.has("ID")) {
  62635. return dict;
  62636. }
  62637. trailerDict = dict;
  62638. }
  62639. if (trailerDict) {
  62640. return trailerDict;
  62641. }
  62642. if (this.topDict) {
  62643. return this.topDict;
  62644. }
  62645. throw new _util.InvalidPDFException("Invalid PDF structure.");
  62646. }
  62647. readXRef(recoveryMode = false) {
  62648. const stream = this.stream;
  62649. const startXRefParsedCache = new Set();
  62650. try {
  62651. while (this.startXRefQueue.length) {
  62652. const startXRef = this.startXRefQueue[0];
  62653. if (startXRefParsedCache.has(startXRef)) {
  62654. (0, _util.warn)("readXRef - skipping XRef table since it was already parsed.");
  62655. this.startXRefQueue.shift();
  62656. continue;
  62657. }
  62658. startXRefParsedCache.add(startXRef);
  62659. stream.pos = startXRef + stream.start;
  62660. const parser = new _parser.Parser({
  62661. lexer: new _parser.Lexer(stream),
  62662. xref: this,
  62663. allowStreams: true
  62664. });
  62665. let obj = parser.getObj();
  62666. let dict;
  62667. if ((0, _primitives.isCmd)(obj, "xref")) {
  62668. dict = this.processXRefTable(parser);
  62669. if (!this.topDict) {
  62670. this.topDict = dict;
  62671. }
  62672. obj = dict.get("XRefStm");
  62673. if (Number.isInteger(obj)) {
  62674. const pos = obj;
  62675. if (!(pos in this.xrefstms)) {
  62676. this.xrefstms[pos] = 1;
  62677. this.startXRefQueue.push(pos);
  62678. }
  62679. }
  62680. } else if (Number.isInteger(obj)) {
  62681. if (!Number.isInteger(parser.getObj()) || !(0, _primitives.isCmd)(parser.getObj(), "obj") || !((obj = parser.getObj()) instanceof _base_stream.BaseStream)) {
  62682. throw new _util.FormatError("Invalid XRef stream");
  62683. }
  62684. dict = this.processXRefStream(obj);
  62685. if (!this.topDict) {
  62686. this.topDict = dict;
  62687. }
  62688. if (!dict) {
  62689. throw new _util.FormatError("Failed to read XRef stream");
  62690. }
  62691. } else {
  62692. throw new _util.FormatError("Invalid XRef stream header");
  62693. }
  62694. obj = dict.get("Prev");
  62695. if (Number.isInteger(obj)) {
  62696. this.startXRefQueue.push(obj);
  62697. } else if (obj instanceof _primitives.Ref) {
  62698. this.startXRefQueue.push(obj.num);
  62699. }
  62700. this.startXRefQueue.shift();
  62701. }
  62702. return this.topDict;
  62703. } catch (e) {
  62704. if (e instanceof _core_utils.MissingDataException) {
  62705. throw e;
  62706. }
  62707. (0, _util.info)("(while reading XRef): " + e);
  62708. this.startXRefQueue.shift();
  62709. }
  62710. if (recoveryMode) {
  62711. return undefined;
  62712. }
  62713. throw new _core_utils.XRefParseException();
  62714. }
  62715. getEntry(i) {
  62716. const xrefEntry = this.entries[i];
  62717. if (xrefEntry && !xrefEntry.free && xrefEntry.offset) {
  62718. return xrefEntry;
  62719. }
  62720. return null;
  62721. }
  62722. fetchIfRef(obj, suppressEncryption = false) {
  62723. if (obj instanceof _primitives.Ref) {
  62724. return this.fetch(obj, suppressEncryption);
  62725. }
  62726. return obj;
  62727. }
  62728. fetch(ref, suppressEncryption = false) {
  62729. if (!(ref instanceof _primitives.Ref)) {
  62730. throw new Error("ref object is not a reference");
  62731. }
  62732. const num = ref.num;
  62733. const cacheEntry = this._cacheMap.get(num);
  62734. if (cacheEntry !== undefined) {
  62735. if (cacheEntry instanceof _primitives.Dict && !cacheEntry.objId) {
  62736. cacheEntry.objId = ref.toString();
  62737. }
  62738. return cacheEntry;
  62739. }
  62740. let xrefEntry = this.getEntry(num);
  62741. if (xrefEntry === null) {
  62742. this._cacheMap.set(num, xrefEntry);
  62743. return xrefEntry;
  62744. }
  62745. if (this._pendingRefs.has(ref)) {
  62746. this._pendingRefs.remove(ref);
  62747. (0, _util.warn)(`Ignoring circular reference: ${ref}.`);
  62748. return _primitives.CIRCULAR_REF;
  62749. }
  62750. this._pendingRefs.put(ref);
  62751. try {
  62752. if (xrefEntry.uncompressed) {
  62753. xrefEntry = this.fetchUncompressed(ref, xrefEntry, suppressEncryption);
  62754. } else {
  62755. xrefEntry = this.fetchCompressed(ref, xrefEntry, suppressEncryption);
  62756. }
  62757. this._pendingRefs.remove(ref);
  62758. } catch (ex) {
  62759. this._pendingRefs.remove(ref);
  62760. throw ex;
  62761. }
  62762. if (xrefEntry instanceof _primitives.Dict) {
  62763. xrefEntry.objId = ref.toString();
  62764. } else if (xrefEntry instanceof _base_stream.BaseStream) {
  62765. xrefEntry.dict.objId = ref.toString();
  62766. }
  62767. return xrefEntry;
  62768. }
  62769. fetchUncompressed(ref, xrefEntry, suppressEncryption = false) {
  62770. const gen = ref.gen;
  62771. let num = ref.num;
  62772. if (xrefEntry.gen !== gen) {
  62773. throw new _core_utils.XRefEntryException(`Inconsistent generation in XRef: ${ref}`);
  62774. }
  62775. const stream = this.stream.makeSubStream(xrefEntry.offset + this.stream.start);
  62776. const parser = new _parser.Parser({
  62777. lexer: new _parser.Lexer(stream),
  62778. xref: this,
  62779. allowStreams: true
  62780. });
  62781. const obj1 = parser.getObj();
  62782. const obj2 = parser.getObj();
  62783. const obj3 = parser.getObj();
  62784. if (obj1 !== num || obj2 !== gen || !(obj3 instanceof _primitives.Cmd)) {
  62785. throw new _core_utils.XRefEntryException(`Bad (uncompressed) XRef entry: ${ref}`);
  62786. }
  62787. if (obj3.cmd !== "obj") {
  62788. if (obj3.cmd.startsWith("obj")) {
  62789. num = parseInt(obj3.cmd.substring(3), 10);
  62790. if (!Number.isNaN(num)) {
  62791. return num;
  62792. }
  62793. }
  62794. throw new _core_utils.XRefEntryException(`Bad (uncompressed) XRef entry: ${ref}`);
  62795. }
  62796. if (this.encrypt && !suppressEncryption) {
  62797. xrefEntry = parser.getObj(this.encrypt.createCipherTransform(num, gen));
  62798. } else {
  62799. xrefEntry = parser.getObj();
  62800. }
  62801. if (!(xrefEntry instanceof _base_stream.BaseStream)) {
  62802. this._cacheMap.set(num, xrefEntry);
  62803. }
  62804. return xrefEntry;
  62805. }
  62806. fetchCompressed(ref, xrefEntry, suppressEncryption = false) {
  62807. const tableOffset = xrefEntry.offset;
  62808. const stream = this.fetch(_primitives.Ref.get(tableOffset, 0));
  62809. if (!(stream instanceof _base_stream.BaseStream)) {
  62810. throw new _util.FormatError("bad ObjStm stream");
  62811. }
  62812. const first = stream.dict.get("First");
  62813. const n = stream.dict.get("N");
  62814. if (!Number.isInteger(first) || !Number.isInteger(n)) {
  62815. throw new _util.FormatError("invalid first and n parameters for ObjStm stream");
  62816. }
  62817. let parser = new _parser.Parser({
  62818. lexer: new _parser.Lexer(stream),
  62819. xref: this,
  62820. allowStreams: true
  62821. });
  62822. const nums = new Array(n);
  62823. const offsets = new Array(n);
  62824. for (let i = 0; i < n; ++i) {
  62825. const num = parser.getObj();
  62826. if (!Number.isInteger(num)) {
  62827. throw new _util.FormatError(`invalid object number in the ObjStm stream: ${num}`);
  62828. }
  62829. const offset = parser.getObj();
  62830. if (!Number.isInteger(offset)) {
  62831. throw new _util.FormatError(`invalid object offset in the ObjStm stream: ${offset}`);
  62832. }
  62833. nums[i] = num;
  62834. offsets[i] = offset;
  62835. }
  62836. const start = (stream.start || 0) + first;
  62837. const entries = new Array(n);
  62838. for (let i = 0; i < n; ++i) {
  62839. const length = i < n - 1 ? offsets[i + 1] - offsets[i] : undefined;
  62840. if (length < 0) {
  62841. throw new _util.FormatError("Invalid offset in the ObjStm stream.");
  62842. }
  62843. parser = new _parser.Parser({
  62844. lexer: new _parser.Lexer(stream.makeSubStream(start + offsets[i], length, stream.dict)),
  62845. xref: this,
  62846. allowStreams: true
  62847. });
  62848. const obj = parser.getObj();
  62849. entries[i] = obj;
  62850. if (obj instanceof _base_stream.BaseStream) {
  62851. continue;
  62852. }
  62853. const num = nums[i],
  62854. entry = this.entries[num];
  62855. if (entry && entry.offset === tableOffset && entry.gen === i) {
  62856. this._cacheMap.set(num, obj);
  62857. }
  62858. }
  62859. xrefEntry = entries[xrefEntry.gen];
  62860. if (xrefEntry === undefined) {
  62861. throw new _core_utils.XRefEntryException(`Bad (compressed) XRef entry: ${ref}`);
  62862. }
  62863. return xrefEntry;
  62864. }
  62865. async fetchIfRefAsync(obj, suppressEncryption) {
  62866. if (obj instanceof _primitives.Ref) {
  62867. return this.fetchAsync(obj, suppressEncryption);
  62868. }
  62869. return obj;
  62870. }
  62871. async fetchAsync(ref, suppressEncryption) {
  62872. try {
  62873. return this.fetch(ref, suppressEncryption);
  62874. } catch (ex) {
  62875. if (!(ex instanceof _core_utils.MissingDataException)) {
  62876. throw ex;
  62877. }
  62878. await this.pdfManager.requestRange(ex.begin, ex.end);
  62879. return this.fetchAsync(ref, suppressEncryption);
  62880. }
  62881. }
  62882. getCatalogObj() {
  62883. return this.root;
  62884. }
  62885. }
  62886. exports.XRef = XRef;
  62887. /***/ }),
  62888. /* 102 */
  62889. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  62890. Object.defineProperty(exports, "__esModule", ({
  62891. value: true
  62892. }));
  62893. exports.MessageHandler = void 0;
  62894. var _util = __w_pdfjs_require__(2);
  62895. const CallbackKind = {
  62896. UNKNOWN: 0,
  62897. DATA: 1,
  62898. ERROR: 2
  62899. };
  62900. const StreamKind = {
  62901. UNKNOWN: 0,
  62902. CANCEL: 1,
  62903. CANCEL_COMPLETE: 2,
  62904. CLOSE: 3,
  62905. ENQUEUE: 4,
  62906. ERROR: 5,
  62907. PULL: 6,
  62908. PULL_COMPLETE: 7,
  62909. START_COMPLETE: 8
  62910. };
  62911. function wrapReason(reason) {
  62912. if (!(reason instanceof Error || typeof reason === "object" && reason !== null)) {
  62913. (0, _util.unreachable)('wrapReason: Expected "reason" to be a (possibly cloned) Error.');
  62914. }
  62915. switch (reason.name) {
  62916. case "AbortException":
  62917. return new _util.AbortException(reason.message);
  62918. case "MissingPDFException":
  62919. return new _util.MissingPDFException(reason.message);
  62920. case "PasswordException":
  62921. return new _util.PasswordException(reason.message, reason.code);
  62922. case "UnexpectedResponseException":
  62923. return new _util.UnexpectedResponseException(reason.message, reason.status);
  62924. case "UnknownErrorException":
  62925. return new _util.UnknownErrorException(reason.message, reason.details);
  62926. default:
  62927. return new _util.UnknownErrorException(reason.message, reason.toString());
  62928. }
  62929. }
  62930. class MessageHandler {
  62931. constructor(sourceName, targetName, comObj) {
  62932. this.sourceName = sourceName;
  62933. this.targetName = targetName;
  62934. this.comObj = comObj;
  62935. this.callbackId = 1;
  62936. this.streamId = 1;
  62937. this.streamSinks = Object.create(null);
  62938. this.streamControllers = Object.create(null);
  62939. this.callbackCapabilities = Object.create(null);
  62940. this.actionHandler = Object.create(null);
  62941. this._onComObjOnMessage = event => {
  62942. const data = event.data;
  62943. if (data.targetName !== this.sourceName) {
  62944. return;
  62945. }
  62946. if (data.stream) {
  62947. this._processStreamMessage(data);
  62948. return;
  62949. }
  62950. if (data.callback) {
  62951. const callbackId = data.callbackId;
  62952. const capability = this.callbackCapabilities[callbackId];
  62953. if (!capability) {
  62954. throw new Error(`Cannot resolve callback ${callbackId}`);
  62955. }
  62956. delete this.callbackCapabilities[callbackId];
  62957. if (data.callback === CallbackKind.DATA) {
  62958. capability.resolve(data.data);
  62959. } else if (data.callback === CallbackKind.ERROR) {
  62960. capability.reject(wrapReason(data.reason));
  62961. } else {
  62962. throw new Error("Unexpected callback case");
  62963. }
  62964. return;
  62965. }
  62966. const action = this.actionHandler[data.action];
  62967. if (!action) {
  62968. throw new Error(`Unknown action from worker: ${data.action}`);
  62969. }
  62970. if (data.callbackId) {
  62971. const cbSourceName = this.sourceName;
  62972. const cbTargetName = data.sourceName;
  62973. new Promise(function (resolve) {
  62974. resolve(action(data.data));
  62975. }).then(function (result) {
  62976. comObj.postMessage({
  62977. sourceName: cbSourceName,
  62978. targetName: cbTargetName,
  62979. callback: CallbackKind.DATA,
  62980. callbackId: data.callbackId,
  62981. data: result
  62982. });
  62983. }, function (reason) {
  62984. comObj.postMessage({
  62985. sourceName: cbSourceName,
  62986. targetName: cbTargetName,
  62987. callback: CallbackKind.ERROR,
  62988. callbackId: data.callbackId,
  62989. reason: wrapReason(reason)
  62990. });
  62991. });
  62992. return;
  62993. }
  62994. if (data.streamId) {
  62995. this._createStreamSink(data);
  62996. return;
  62997. }
  62998. action(data.data);
  62999. };
  63000. comObj.addEventListener("message", this._onComObjOnMessage);
  63001. }
  63002. on(actionName, handler) {
  63003. const ah = this.actionHandler;
  63004. if (ah[actionName]) {
  63005. throw new Error(`There is already an actionName called "${actionName}"`);
  63006. }
  63007. ah[actionName] = handler;
  63008. }
  63009. send(actionName, data, transfers) {
  63010. this.comObj.postMessage({
  63011. sourceName: this.sourceName,
  63012. targetName: this.targetName,
  63013. action: actionName,
  63014. data
  63015. }, transfers);
  63016. }
  63017. sendWithPromise(actionName, data, transfers) {
  63018. const callbackId = this.callbackId++;
  63019. const capability = (0, _util.createPromiseCapability)();
  63020. this.callbackCapabilities[callbackId] = capability;
  63021. try {
  63022. this.comObj.postMessage({
  63023. sourceName: this.sourceName,
  63024. targetName: this.targetName,
  63025. action: actionName,
  63026. callbackId,
  63027. data
  63028. }, transfers);
  63029. } catch (ex) {
  63030. capability.reject(ex);
  63031. }
  63032. return capability.promise;
  63033. }
  63034. sendWithStream(actionName, data, queueingStrategy, transfers) {
  63035. const streamId = this.streamId++,
  63036. sourceName = this.sourceName,
  63037. targetName = this.targetName,
  63038. comObj = this.comObj;
  63039. return new ReadableStream({
  63040. start: controller => {
  63041. const startCapability = (0, _util.createPromiseCapability)();
  63042. this.streamControllers[streamId] = {
  63043. controller,
  63044. startCall: startCapability,
  63045. pullCall: null,
  63046. cancelCall: null,
  63047. isClosed: false
  63048. };
  63049. comObj.postMessage({
  63050. sourceName,
  63051. targetName,
  63052. action: actionName,
  63053. streamId,
  63054. data,
  63055. desiredSize: controller.desiredSize
  63056. }, transfers);
  63057. return startCapability.promise;
  63058. },
  63059. pull: controller => {
  63060. const pullCapability = (0, _util.createPromiseCapability)();
  63061. this.streamControllers[streamId].pullCall = pullCapability;
  63062. comObj.postMessage({
  63063. sourceName,
  63064. targetName,
  63065. stream: StreamKind.PULL,
  63066. streamId,
  63067. desiredSize: controller.desiredSize
  63068. });
  63069. return pullCapability.promise;
  63070. },
  63071. cancel: reason => {
  63072. (0, _util.assert)(reason instanceof Error, "cancel must have a valid reason");
  63073. const cancelCapability = (0, _util.createPromiseCapability)();
  63074. this.streamControllers[streamId].cancelCall = cancelCapability;
  63075. this.streamControllers[streamId].isClosed = true;
  63076. comObj.postMessage({
  63077. sourceName,
  63078. targetName,
  63079. stream: StreamKind.CANCEL,
  63080. streamId,
  63081. reason: wrapReason(reason)
  63082. });
  63083. return cancelCapability.promise;
  63084. }
  63085. }, queueingStrategy);
  63086. }
  63087. _createStreamSink(data) {
  63088. const streamId = data.streamId,
  63089. sourceName = this.sourceName,
  63090. targetName = data.sourceName,
  63091. comObj = this.comObj;
  63092. const self = this,
  63093. action = this.actionHandler[data.action];
  63094. const streamSink = {
  63095. enqueue(chunk, size = 1, transfers) {
  63096. if (this.isCancelled) {
  63097. return;
  63098. }
  63099. const lastDesiredSize = this.desiredSize;
  63100. this.desiredSize -= size;
  63101. if (lastDesiredSize > 0 && this.desiredSize <= 0) {
  63102. this.sinkCapability = (0, _util.createPromiseCapability)();
  63103. this.ready = this.sinkCapability.promise;
  63104. }
  63105. comObj.postMessage({
  63106. sourceName,
  63107. targetName,
  63108. stream: StreamKind.ENQUEUE,
  63109. streamId,
  63110. chunk
  63111. }, transfers);
  63112. },
  63113. close() {
  63114. if (this.isCancelled) {
  63115. return;
  63116. }
  63117. this.isCancelled = true;
  63118. comObj.postMessage({
  63119. sourceName,
  63120. targetName,
  63121. stream: StreamKind.CLOSE,
  63122. streamId
  63123. });
  63124. delete self.streamSinks[streamId];
  63125. },
  63126. error(reason) {
  63127. (0, _util.assert)(reason instanceof Error, "error must have a valid reason");
  63128. if (this.isCancelled) {
  63129. return;
  63130. }
  63131. this.isCancelled = true;
  63132. comObj.postMessage({
  63133. sourceName,
  63134. targetName,
  63135. stream: StreamKind.ERROR,
  63136. streamId,
  63137. reason: wrapReason(reason)
  63138. });
  63139. },
  63140. sinkCapability: (0, _util.createPromiseCapability)(),
  63141. onPull: null,
  63142. onCancel: null,
  63143. isCancelled: false,
  63144. desiredSize: data.desiredSize,
  63145. ready: null
  63146. };
  63147. streamSink.sinkCapability.resolve();
  63148. streamSink.ready = streamSink.sinkCapability.promise;
  63149. this.streamSinks[streamId] = streamSink;
  63150. new Promise(function (resolve) {
  63151. resolve(action(data.data, streamSink));
  63152. }).then(function () {
  63153. comObj.postMessage({
  63154. sourceName,
  63155. targetName,
  63156. stream: StreamKind.START_COMPLETE,
  63157. streamId,
  63158. success: true
  63159. });
  63160. }, function (reason) {
  63161. comObj.postMessage({
  63162. sourceName,
  63163. targetName,
  63164. stream: StreamKind.START_COMPLETE,
  63165. streamId,
  63166. reason: wrapReason(reason)
  63167. });
  63168. });
  63169. }
  63170. _processStreamMessage(data) {
  63171. const streamId = data.streamId,
  63172. sourceName = this.sourceName,
  63173. targetName = data.sourceName,
  63174. comObj = this.comObj;
  63175. const streamController = this.streamControllers[streamId],
  63176. streamSink = this.streamSinks[streamId];
  63177. switch (data.stream) {
  63178. case StreamKind.START_COMPLETE:
  63179. if (data.success) {
  63180. streamController.startCall.resolve();
  63181. } else {
  63182. streamController.startCall.reject(wrapReason(data.reason));
  63183. }
  63184. break;
  63185. case StreamKind.PULL_COMPLETE:
  63186. if (data.success) {
  63187. streamController.pullCall.resolve();
  63188. } else {
  63189. streamController.pullCall.reject(wrapReason(data.reason));
  63190. }
  63191. break;
  63192. case StreamKind.PULL:
  63193. if (!streamSink) {
  63194. comObj.postMessage({
  63195. sourceName,
  63196. targetName,
  63197. stream: StreamKind.PULL_COMPLETE,
  63198. streamId,
  63199. success: true
  63200. });
  63201. break;
  63202. }
  63203. if (streamSink.desiredSize <= 0 && data.desiredSize > 0) {
  63204. streamSink.sinkCapability.resolve();
  63205. }
  63206. streamSink.desiredSize = data.desiredSize;
  63207. new Promise(function (resolve) {
  63208. resolve(streamSink.onPull && streamSink.onPull());
  63209. }).then(function () {
  63210. comObj.postMessage({
  63211. sourceName,
  63212. targetName,
  63213. stream: StreamKind.PULL_COMPLETE,
  63214. streamId,
  63215. success: true
  63216. });
  63217. }, function (reason) {
  63218. comObj.postMessage({
  63219. sourceName,
  63220. targetName,
  63221. stream: StreamKind.PULL_COMPLETE,
  63222. streamId,
  63223. reason: wrapReason(reason)
  63224. });
  63225. });
  63226. break;
  63227. case StreamKind.ENQUEUE:
  63228. (0, _util.assert)(streamController, "enqueue should have stream controller");
  63229. if (streamController.isClosed) {
  63230. break;
  63231. }
  63232. streamController.controller.enqueue(data.chunk);
  63233. break;
  63234. case StreamKind.CLOSE:
  63235. (0, _util.assert)(streamController, "close should have stream controller");
  63236. if (streamController.isClosed) {
  63237. break;
  63238. }
  63239. streamController.isClosed = true;
  63240. streamController.controller.close();
  63241. this._deleteStreamController(streamController, streamId);
  63242. break;
  63243. case StreamKind.ERROR:
  63244. (0, _util.assert)(streamController, "error should have stream controller");
  63245. streamController.controller.error(wrapReason(data.reason));
  63246. this._deleteStreamController(streamController, streamId);
  63247. break;
  63248. case StreamKind.CANCEL_COMPLETE:
  63249. if (data.success) {
  63250. streamController.cancelCall.resolve();
  63251. } else {
  63252. streamController.cancelCall.reject(wrapReason(data.reason));
  63253. }
  63254. this._deleteStreamController(streamController, streamId);
  63255. break;
  63256. case StreamKind.CANCEL:
  63257. if (!streamSink) {
  63258. break;
  63259. }
  63260. new Promise(function (resolve) {
  63261. resolve(streamSink.onCancel && streamSink.onCancel(wrapReason(data.reason)));
  63262. }).then(function () {
  63263. comObj.postMessage({
  63264. sourceName,
  63265. targetName,
  63266. stream: StreamKind.CANCEL_COMPLETE,
  63267. streamId,
  63268. success: true
  63269. });
  63270. }, function (reason) {
  63271. comObj.postMessage({
  63272. sourceName,
  63273. targetName,
  63274. stream: StreamKind.CANCEL_COMPLETE,
  63275. streamId,
  63276. reason: wrapReason(reason)
  63277. });
  63278. });
  63279. streamSink.sinkCapability.reject(wrapReason(data.reason));
  63280. streamSink.isCancelled = true;
  63281. delete this.streamSinks[streamId];
  63282. break;
  63283. default:
  63284. throw new Error("Unexpected stream case");
  63285. }
  63286. }
  63287. async _deleteStreamController(streamController, streamId) {
  63288. await Promise.allSettled([streamController.startCall && streamController.startCall.promise, streamController.pullCall && streamController.pullCall.promise, streamController.cancelCall && streamController.cancelCall.promise]);
  63289. delete this.streamControllers[streamId];
  63290. }
  63291. destroy() {
  63292. this.comObj.removeEventListener("message", this._onComObjOnMessage);
  63293. }
  63294. }
  63295. exports.MessageHandler = MessageHandler;
  63296. /***/ }),
  63297. /* 103 */
  63298. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  63299. Object.defineProperty(exports, "__esModule", ({
  63300. value: true
  63301. }));
  63302. exports.PDFWorkerStream = void 0;
  63303. var _util = __w_pdfjs_require__(2);
  63304. class PDFWorkerStream {
  63305. constructor(msgHandler) {
  63306. this._msgHandler = msgHandler;
  63307. this._contentLength = null;
  63308. this._fullRequestReader = null;
  63309. this._rangeRequestReaders = [];
  63310. }
  63311. getFullReader() {
  63312. (0, _util.assert)(!this._fullRequestReader, "PDFWorkerStream.getFullReader can only be called once.");
  63313. this._fullRequestReader = new PDFWorkerStreamReader(this._msgHandler);
  63314. return this._fullRequestReader;
  63315. }
  63316. getRangeReader(begin, end) {
  63317. const reader = new PDFWorkerStreamRangeReader(begin, end, this._msgHandler);
  63318. this._rangeRequestReaders.push(reader);
  63319. return reader;
  63320. }
  63321. cancelAllRequests(reason) {
  63322. if (this._fullRequestReader) {
  63323. this._fullRequestReader.cancel(reason);
  63324. }
  63325. for (const reader of this._rangeRequestReaders.slice(0)) {
  63326. reader.cancel(reason);
  63327. }
  63328. }
  63329. }
  63330. exports.PDFWorkerStream = PDFWorkerStream;
  63331. class PDFWorkerStreamReader {
  63332. constructor(msgHandler) {
  63333. this._msgHandler = msgHandler;
  63334. this.onProgress = null;
  63335. this._contentLength = null;
  63336. this._isRangeSupported = false;
  63337. this._isStreamingSupported = false;
  63338. const readableStream = this._msgHandler.sendWithStream("GetReader");
  63339. this._reader = readableStream.getReader();
  63340. this._headersReady = this._msgHandler.sendWithPromise("ReaderHeadersReady").then(data => {
  63341. this._isStreamingSupported = data.isStreamingSupported;
  63342. this._isRangeSupported = data.isRangeSupported;
  63343. this._contentLength = data.contentLength;
  63344. });
  63345. }
  63346. get headersReady() {
  63347. return this._headersReady;
  63348. }
  63349. get contentLength() {
  63350. return this._contentLength;
  63351. }
  63352. get isStreamingSupported() {
  63353. return this._isStreamingSupported;
  63354. }
  63355. get isRangeSupported() {
  63356. return this._isRangeSupported;
  63357. }
  63358. async read() {
  63359. const {
  63360. value,
  63361. done
  63362. } = await this._reader.read();
  63363. if (done) {
  63364. return {
  63365. value: undefined,
  63366. done: true
  63367. };
  63368. }
  63369. return {
  63370. value: value.buffer,
  63371. done: false
  63372. };
  63373. }
  63374. cancel(reason) {
  63375. this._reader.cancel(reason);
  63376. }
  63377. }
  63378. class PDFWorkerStreamRangeReader {
  63379. constructor(begin, end, msgHandler) {
  63380. this._msgHandler = msgHandler;
  63381. this.onProgress = null;
  63382. const readableStream = this._msgHandler.sendWithStream("GetRangeReader", {
  63383. begin,
  63384. end
  63385. });
  63386. this._reader = readableStream.getReader();
  63387. }
  63388. get isStreamingSupported() {
  63389. return false;
  63390. }
  63391. async read() {
  63392. const {
  63393. value,
  63394. done
  63395. } = await this._reader.read();
  63396. if (done) {
  63397. return {
  63398. value: undefined,
  63399. done: true
  63400. };
  63401. }
  63402. return {
  63403. value: value.buffer,
  63404. done: false
  63405. };
  63406. }
  63407. cancel(reason) {
  63408. this._reader.cancel(reason);
  63409. }
  63410. }
  63411. /***/ })
  63412. /******/ ]);
  63413. /************************************************************************/
  63414. /******/ // The module cache
  63415. /******/ var __webpack_module_cache__ = {};
  63416. /******/
  63417. /******/ // The require function
  63418. /******/ function __w_pdfjs_require__(moduleId) {
  63419. /******/ // Check if module is in cache
  63420. /******/ var cachedModule = __webpack_module_cache__[moduleId];
  63421. /******/ if (cachedModule !== undefined) {
  63422. /******/ return cachedModule.exports;
  63423. /******/ }
  63424. /******/ // Create a new module (and put it into the cache)
  63425. /******/ var module = __webpack_module_cache__[moduleId] = {
  63426. /******/ // no module.id needed
  63427. /******/ // no module.loaded needed
  63428. /******/ exports: {}
  63429. /******/ };
  63430. /******/
  63431. /******/ // Execute the module function
  63432. /******/ __webpack_modules__[moduleId](module, module.exports, __w_pdfjs_require__);
  63433. /******/
  63434. /******/ // Return the exports of the module
  63435. /******/ return module.exports;
  63436. /******/ }
  63437. /******/
  63438. /************************************************************************/
  63439. /******/ /* webpack/runtime/define property getters */
  63440. /******/ (() => {
  63441. /******/ // define getter functions for harmony exports
  63442. /******/ __w_pdfjs_require__.d = (exports, definition) => {
  63443. /******/ for(var key in definition) {
  63444. /******/ if(__w_pdfjs_require__.o(definition, key) && !__w_pdfjs_require__.o(exports, key)) {
  63445. /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
  63446. /******/ }
  63447. /******/ }
  63448. /******/ };
  63449. /******/ })();
  63450. /******/
  63451. /******/ /* webpack/runtime/hasOwnProperty shorthand */
  63452. /******/ (() => {
  63453. /******/ __w_pdfjs_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
  63454. /******/ })();
  63455. /******/
  63456. /******/ /* webpack/runtime/make namespace object */
  63457. /******/ (() => {
  63458. /******/ // define __esModule on exports
  63459. /******/ __w_pdfjs_require__.r = (exports) => {
  63460. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  63461. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  63462. /******/ }
  63463. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  63464. /******/ };
  63465. /******/ })();
  63466. /******/
  63467. /************************************************************************/
  63468. var __webpack_exports__ = {};
  63469. // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
  63470. (() => {
  63471. var exports = __webpack_exports__;
  63472. Object.defineProperty(exports, "__esModule", ({
  63473. value: true
  63474. }));
  63475. Object.defineProperty(exports, "WorkerMessageHandler", ({
  63476. enumerable: true,
  63477. get: function () {
  63478. return _worker.WorkerMessageHandler;
  63479. }
  63480. }));
  63481. var _worker = __w_pdfjs_require__(1);
  63482. const pdfjsVersion = '2.15.349';
  63483. const pdfjsBuild = 'b8aa9c622';
  63484. })();
  63485. /******/ return __webpack_exports__;
  63486. /******/ })()
  63487. ;
  63488. });
  63489. //# sourceMappingURL=pdf.worker.js.map