index.js 638 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312
  1. var Ol = Object.defineProperty;
  2. var bl = (t, e, n) => e in t ? Ol(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
  3. var C = (t, e, n) => bl(t, typeof e != "symbol" ? e + "" : e, n);
  4. import { BehaviorSubject as lt, Subject as _t, Observable as sr, filter as Kt, tap as Wi, debounceTime as Sl, map as Da, ReplaySubject as Al, take as Nl, merge as xa, timer as Tl, distinctUntilChanged as Ml, skip as La, of as fr, combineLatest as Dl } from "rxjs";
  5. import { filter as xl, debounceTime as Ll, first as Ul, map as Pl } from "rxjs/operators";
  6. import * as St from "react";
  7. import kl, { useState as _i, useEffect as Ei, useRef as Lr, useMemo as Ua, createContext as Fl, useCallback as $l, useContext as Bl } from "react";
  8. function jl(t, e) {
  9. for (var n = 0; n < e.length; n++) {
  10. const r = e[n];
  11. if (typeof r != "string" && !Array.isArray(r)) {
  12. for (const s in r)
  13. if (s !== "default" && !(s in t)) {
  14. const i = Object.getOwnPropertyDescriptor(r, s);
  15. i && Object.defineProperty(t, s, i.get ? i : {
  16. enumerable: !0,
  17. get: () => r[s]
  18. });
  19. }
  20. }
  21. }
  22. return Object.freeze(Object.defineProperty(t, Symbol.toStringTag, { value: "Module" }));
  23. }
  24. function Hl() {
  25. Wl();
  26. }
  27. const gr = typeof global < "u" ? global : typeof self < "u" ? self : window;
  28. function Wl() {
  29. typeof gr.requestIdleCallback != "function" && (gr.requestIdleCallback = function(n) {
  30. const r = Date.now();
  31. return setTimeout(function() {
  32. const i = Math.max(0, 50 - (Date.now() - r));
  33. n({
  34. didTimeout: i === 0,
  35. timeRemaining() {
  36. return i;
  37. }
  38. });
  39. }, 1);
  40. }), typeof gr.cancelIdleCallback != "function" && (gr.cancelIdleCallback = function(n) {
  41. clearTimeout(n);
  42. });
  43. }
  44. var Pa = typeof global == "object" && global && global.Object === Object && global, zl = typeof self == "object" && self && self.Object === Object && self, En = Pa || zl || Function("return this")(), Mn = En.Symbol, ka = Object.prototype, Yl = ka.hasOwnProperty, Vl = ka.toString, Fn = Mn ? Mn.toStringTag : void 0;
  45. function Gl(t) {
  46. var e = Yl.call(t, Fn), n = t[Fn];
  47. try {
  48. t[Fn] = void 0;
  49. var r = !0;
  50. } catch {
  51. }
  52. var s = Vl.call(t);
  53. return r && (e ? t[Fn] = n : delete t[Fn]), s;
  54. }
  55. var Kl = Object.prototype, Xl = Kl.toString;
  56. function Jl(t) {
  57. return Xl.call(t);
  58. }
  59. var Zl = "[object Null]", Ql = "[object Undefined]", zi = Mn ? Mn.toStringTag : void 0;
  60. function ir(t) {
  61. return t == null ? t === void 0 ? Ql : Zl : zi && zi in Object(t) ? Gl(t) : Jl(t);
  62. }
  63. function Un(t) {
  64. return t != null && typeof t == "object";
  65. }
  66. var ql = "[object Symbol]";
  67. function os(t) {
  68. return typeof t == "symbol" || Un(t) && ir(t) == ql;
  69. }
  70. function ec(t, e) {
  71. for (var n = -1, r = t == null ? 0 : t.length, s = Array(r); ++n < r; )
  72. s[n] = e(t[n], n, t);
  73. return s;
  74. }
  75. var Dn = Array.isArray, Yi = Mn ? Mn.prototype : void 0, Vi = Yi ? Yi.toString : void 0;
  76. function Fa(t) {
  77. if (typeof t == "string")
  78. return t;
  79. if (Dn(t))
  80. return ec(t, Fa) + "";
  81. if (os(t))
  82. return Vi ? Vi.call(t) : "";
  83. var e = t + "";
  84. return e == "0" && 1 / t == -1 / 0 ? "-0" : e;
  85. }
  86. var tc = /\s/;
  87. function nc(t) {
  88. for (var e = t.length; e-- && tc.test(t.charAt(e)); )
  89. ;
  90. return e;
  91. }
  92. var rc = /^\s+/;
  93. function sc(t) {
  94. return t && t.slice(0, nc(t) + 1).replace(rc, "");
  95. }
  96. function yt(t) {
  97. var e = typeof t;
  98. return t != null && (e == "object" || e == "function");
  99. }
  100. var Gi = NaN, ic = /^[-+]0x[0-9a-f]+$/i, oc = /^0b[01]+$/i, ac = /^0o[0-7]+$/i, uc = parseInt;
  101. function Ki(t) {
  102. if (typeof t == "number")
  103. return t;
  104. if (os(t))
  105. return Gi;
  106. if (yt(t)) {
  107. var e = typeof t.valueOf == "function" ? t.valueOf() : t;
  108. t = yt(e) ? e + "" : e;
  109. }
  110. if (typeof t != "string")
  111. return t === 0 ? t : +t;
  112. t = sc(t);
  113. var n = oc.test(t);
  114. return n || ac.test(t) ? uc(t.slice(2), n ? 2 : 8) : ic.test(t) ? Gi : +t;
  115. }
  116. function $a(t) {
  117. return t;
  118. }
  119. var lc = "[object AsyncFunction]", cc = "[object Function]", hc = "[object GeneratorFunction]", dc = "[object Proxy]";
  120. function Ci(t) {
  121. if (!yt(t))
  122. return !1;
  123. var e = ir(t);
  124. return e == cc || e == hc || e == lc || e == dc;
  125. }
  126. var Cs = En["__core-js_shared__"], Xi = function() {
  127. var t = /[^.]+$/.exec(Cs && Cs.keys && Cs.keys.IE_PROTO || "");
  128. return t ? "Symbol(src)_1." + t : "";
  129. }();
  130. function fc(t) {
  131. return !!Xi && Xi in t;
  132. }
  133. var gc = Function.prototype, pc = gc.toString;
  134. function mc(t) {
  135. if (t != null) {
  136. try {
  137. return pc.call(t);
  138. } catch {
  139. }
  140. try {
  141. return t + "";
  142. } catch {
  143. }
  144. }
  145. return "";
  146. }
  147. var _c = /[\\^$.*+?()[\]{}|]/g, Ec = /^\[object .+?Constructor\]$/, Cc = Function.prototype, Rc = Object.prototype, Ic = Cc.toString, vc = Rc.hasOwnProperty, yc = RegExp(
  148. "^" + Ic.call(vc).replace(_c, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
  149. );
  150. function wc(t) {
  151. if (!yt(t) || fc(t))
  152. return !1;
  153. var e = Ci(t) ? yc : Ec;
  154. return e.test(mc(t));
  155. }
  156. function Oc(t, e) {
  157. return t == null ? void 0 : t[e];
  158. }
  159. function Ri(t, e) {
  160. var n = Oc(t, e);
  161. return wc(n) ? n : void 0;
  162. }
  163. var Ji = Object.create, bc = /* @__PURE__ */ function() {
  164. function t() {
  165. }
  166. return function(e) {
  167. if (!yt(e))
  168. return {};
  169. if (Ji)
  170. return Ji(e);
  171. t.prototype = e;
  172. var n = new t();
  173. return t.prototype = void 0, n;
  174. };
  175. }();
  176. function Sc(t, e, n) {
  177. switch (n.length) {
  178. case 0:
  179. return t.call(e);
  180. case 1:
  181. return t.call(e, n[0]);
  182. case 2:
  183. return t.call(e, n[0], n[1]);
  184. case 3:
  185. return t.call(e, n[0], n[1], n[2]);
  186. }
  187. return t.apply(e, n);
  188. }
  189. function Ac(t, e) {
  190. var n = -1, r = t.length;
  191. for (e || (e = Array(r)); ++n < r; )
  192. e[n] = t[n];
  193. return e;
  194. }
  195. var Nc = 800, Tc = 16, Mc = Date.now;
  196. function Dc(t) {
  197. var e = 0, n = 0;
  198. return function() {
  199. var r = Mc(), s = Tc - (r - n);
  200. if (n = r, s > 0) {
  201. if (++e >= Nc)
  202. return arguments[0];
  203. } else
  204. e = 0;
  205. return t.apply(void 0, arguments);
  206. };
  207. }
  208. function xc(t) {
  209. return function() {
  210. return t;
  211. };
  212. }
  213. var Kr = function() {
  214. try {
  215. var t = Ri(Object, "defineProperty");
  216. return t({}, "", {}), t;
  217. } catch {
  218. }
  219. }(), Lc = Kr ? function(t, e) {
  220. return Kr(t, "toString", {
  221. configurable: !0,
  222. enumerable: !1,
  223. value: xc(e),
  224. writable: !0
  225. });
  226. } : $a, Uc = Dc(Lc), Pc = 9007199254740991, kc = /^(?:0|[1-9]\d*)$/;
  227. function Ii(t, e) {
  228. var n = typeof t;
  229. return e = e == null ? Pc : e, !!e && (n == "number" || n != "symbol" && kc.test(t)) && t > -1 && t % 1 == 0 && t < e;
  230. }
  231. function vi(t, e, n) {
  232. e == "__proto__" && Kr ? Kr(t, e, {
  233. configurable: !0,
  234. enumerable: !0,
  235. value: n,
  236. writable: !0
  237. }) : t[e] = n;
  238. }
  239. function as(t, e) {
  240. return t === e || t !== t && e !== e;
  241. }
  242. var Fc = Object.prototype, $c = Fc.hasOwnProperty;
  243. function Ba(t, e, n) {
  244. var r = t[e];
  245. (!($c.call(t, e) && as(r, n)) || n === void 0 && !(e in t)) && vi(t, e, n);
  246. }
  247. function Bc(t, e, n, r) {
  248. var s = !n;
  249. n || (n = {});
  250. for (var i = -1, o = e.length; ++i < o; ) {
  251. var a = e[i], u = void 0;
  252. u === void 0 && (u = t[a]), s ? vi(n, a, u) : Ba(n, a, u);
  253. }
  254. return n;
  255. }
  256. var Zi = Math.max;
  257. function jc(t, e, n) {
  258. return e = Zi(e === void 0 ? t.length - 1 : e, 0), function() {
  259. for (var r = arguments, s = -1, i = Zi(r.length - e, 0), o = Array(i); ++s < i; )
  260. o[s] = r[e + s];
  261. s = -1;
  262. for (var a = Array(e + 1); ++s < e; )
  263. a[s] = r[s];
  264. return a[e] = n(o), Sc(t, this, a);
  265. };
  266. }
  267. function Hc(t, e) {
  268. return Uc(jc(t, e, $a), t + "");
  269. }
  270. var Wc = 9007199254740991;
  271. function ja(t) {
  272. return typeof t == "number" && t > -1 && t % 1 == 0 && t <= Wc;
  273. }
  274. function yi(t) {
  275. return t != null && ja(t.length) && !Ci(t);
  276. }
  277. function zc(t, e, n) {
  278. if (!yt(n))
  279. return !1;
  280. var r = typeof e;
  281. return (r == "number" ? yi(n) && Ii(e, n.length) : r == "string" && e in n) ? as(n[e], t) : !1;
  282. }
  283. function Ha(t) {
  284. return Hc(function(e, n) {
  285. var r = -1, s = n.length, i = s > 1 ? n[s - 1] : void 0, o = s > 2 ? n[2] : void 0;
  286. for (i = t.length > 3 && typeof i == "function" ? (s--, i) : void 0, o && zc(n[0], n[1], o) && (i = s < 3 ? void 0 : i, s = 1), e = Object(e); ++r < s; ) {
  287. var a = n[r];
  288. a && t(e, a, r, i);
  289. }
  290. return e;
  291. });
  292. }
  293. var Yc = Object.prototype;
  294. function Wa(t) {
  295. var e = t && t.constructor, n = typeof e == "function" && e.prototype || Yc;
  296. return t === n;
  297. }
  298. function Vc(t, e) {
  299. for (var n = -1, r = Array(t); ++n < t; )
  300. r[n] = e(n);
  301. return r;
  302. }
  303. var Gc = "[object Arguments]";
  304. function Qi(t) {
  305. return Un(t) && ir(t) == Gc;
  306. }
  307. var za = Object.prototype, Kc = za.hasOwnProperty, Xc = za.propertyIsEnumerable, Fs = Qi(/* @__PURE__ */ function() {
  308. return arguments;
  309. }()) ? Qi : function(t) {
  310. return Un(t) && Kc.call(t, "callee") && !Xc.call(t, "callee");
  311. };
  312. function Jc() {
  313. return !1;
  314. }
  315. var Ya = typeof exports == "object" && exports && !exports.nodeType && exports, qi = Ya && typeof module == "object" && module && !module.nodeType && module, Zc = qi && qi.exports === Ya, eo = Zc ? En.Buffer : void 0, Qc = eo ? eo.isBuffer : void 0, Va = Qc || Jc, qc = "[object Arguments]", eh = "[object Array]", th = "[object Boolean]", nh = "[object Date]", rh = "[object Error]", sh = "[object Function]", ih = "[object Map]", oh = "[object Number]", ah = "[object Object]", uh = "[object RegExp]", lh = "[object Set]", ch = "[object String]", hh = "[object WeakMap]", dh = "[object ArrayBuffer]", fh = "[object DataView]", gh = "[object Float32Array]", ph = "[object Float64Array]", mh = "[object Int8Array]", _h = "[object Int16Array]", Eh = "[object Int32Array]", Ch = "[object Uint8Array]", Rh = "[object Uint8ClampedArray]", Ih = "[object Uint16Array]", vh = "[object Uint32Array]", Qe = {};
  316. Qe[gh] = Qe[ph] = Qe[mh] = Qe[_h] = Qe[Eh] = Qe[Ch] = Qe[Rh] = Qe[Ih] = Qe[vh] = !0;
  317. Qe[qc] = Qe[eh] = Qe[dh] = Qe[th] = Qe[fh] = Qe[nh] = Qe[rh] = Qe[sh] = Qe[ih] = Qe[oh] = Qe[ah] = Qe[uh] = Qe[lh] = Qe[ch] = Qe[hh] = !1;
  318. function yh(t) {
  319. return Un(t) && ja(t.length) && !!Qe[ir(t)];
  320. }
  321. function wh(t) {
  322. return function(e) {
  323. return t(e);
  324. };
  325. }
  326. var Ga = typeof exports == "object" && exports && !exports.nodeType && exports, Jn = Ga && typeof module == "object" && module && !module.nodeType && module, Oh = Jn && Jn.exports === Ga, Rs = Oh && Pa.process, to = function() {
  327. try {
  328. var t = Jn && Jn.require && Jn.require("util").types;
  329. return t || Rs && Rs.binding && Rs.binding("util");
  330. } catch {
  331. }
  332. }(), no = to && to.isTypedArray, Ka = no ? wh(no) : yh;
  333. function bh(t, e) {
  334. var n = Dn(t), r = !n && Fs(t), s = !n && !r && Va(t), i = !n && !r && !s && Ka(t), o = n || r || s || i, a = o ? Vc(t.length, String) : [], u = a.length;
  335. for (var c in t)
  336. o && // Safari 9 has enumerable `arguments.length` in strict mode.
  337. (c == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
  338. s && (c == "offset" || c == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
  339. i && (c == "buffer" || c == "byteLength" || c == "byteOffset") || // Skip index properties.
  340. Ii(c, u)) || a.push(c);
  341. return a;
  342. }
  343. function Sh(t, e) {
  344. return function(n) {
  345. return t(e(n));
  346. };
  347. }
  348. function Ah(t) {
  349. var e = [];
  350. if (t != null)
  351. for (var n in Object(t))
  352. e.push(n);
  353. return e;
  354. }
  355. var Nh = Object.prototype, Th = Nh.hasOwnProperty;
  356. function Mh(t) {
  357. if (!yt(t))
  358. return Ah(t);
  359. var e = Wa(t), n = [];
  360. for (var r in t)
  361. r == "constructor" && (e || !Th.call(t, r)) || n.push(r);
  362. return n;
  363. }
  364. function Xa(t) {
  365. return yi(t) ? bh(t) : Mh(t);
  366. }
  367. var Dh = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, xh = /^\w*$/;
  368. function Lh(t, e) {
  369. if (Dn(t))
  370. return !1;
  371. var n = typeof t;
  372. return n == "number" || n == "symbol" || n == "boolean" || t == null || os(t) ? !0 : xh.test(t) || !Dh.test(t) || e != null && t in Object(e);
  373. }
  374. var qn = Ri(Object, "create");
  375. function Uh() {
  376. this.__data__ = qn ? qn(null) : {}, this.size = 0;
  377. }
  378. function Ph(t) {
  379. var e = this.has(t) && delete this.__data__[t];
  380. return this.size -= e ? 1 : 0, e;
  381. }
  382. var kh = "__lodash_hash_undefined__", Fh = Object.prototype, $h = Fh.hasOwnProperty;
  383. function Bh(t) {
  384. var e = this.__data__;
  385. if (qn) {
  386. var n = e[t];
  387. return n === kh ? void 0 : n;
  388. }
  389. return $h.call(e, t) ? e[t] : void 0;
  390. }
  391. var jh = Object.prototype, Hh = jh.hasOwnProperty;
  392. function Wh(t) {
  393. var e = this.__data__;
  394. return qn ? e[t] !== void 0 : Hh.call(e, t);
  395. }
  396. var zh = "__lodash_hash_undefined__";
  397. function Yh(t, e) {
  398. var n = this.__data__;
  399. return this.size += this.has(t) ? 0 : 1, n[t] = qn && e === void 0 ? zh : e, this;
  400. }
  401. function pn(t) {
  402. var e = -1, n = t == null ? 0 : t.length;
  403. for (this.clear(); ++e < n; ) {
  404. var r = t[e];
  405. this.set(r[0], r[1]);
  406. }
  407. }
  408. pn.prototype.clear = Uh;
  409. pn.prototype.delete = Ph;
  410. pn.prototype.get = Bh;
  411. pn.prototype.has = Wh;
  412. pn.prototype.set = Yh;
  413. function Vh() {
  414. this.__data__ = [], this.size = 0;
  415. }
  416. function us(t, e) {
  417. for (var n = t.length; n--; )
  418. if (as(t[n][0], e))
  419. return n;
  420. return -1;
  421. }
  422. var Gh = Array.prototype, Kh = Gh.splice;
  423. function Xh(t) {
  424. var e = this.__data__, n = us(e, t);
  425. if (n < 0)
  426. return !1;
  427. var r = e.length - 1;
  428. return n == r ? e.pop() : Kh.call(e, n, 1), --this.size, !0;
  429. }
  430. function Jh(t) {
  431. var e = this.__data__, n = us(e, t);
  432. return n < 0 ? void 0 : e[n][1];
  433. }
  434. function Zh(t) {
  435. return us(this.__data__, t) > -1;
  436. }
  437. function Qh(t, e) {
  438. var n = this.__data__, r = us(n, t);
  439. return r < 0 ? (++this.size, n.push([t, e])) : n[r][1] = e, this;
  440. }
  441. function Wt(t) {
  442. var e = -1, n = t == null ? 0 : t.length;
  443. for (this.clear(); ++e < n; ) {
  444. var r = t[e];
  445. this.set(r[0], r[1]);
  446. }
  447. }
  448. Wt.prototype.clear = Vh;
  449. Wt.prototype.delete = Xh;
  450. Wt.prototype.get = Jh;
  451. Wt.prototype.has = Zh;
  452. Wt.prototype.set = Qh;
  453. var Ja = Ri(En, "Map");
  454. function qh() {
  455. this.size = 0, this.__data__ = {
  456. hash: new pn(),
  457. map: new (Ja || Wt)(),
  458. string: new pn()
  459. };
  460. }
  461. function ed(t) {
  462. var e = typeof t;
  463. return e == "string" || e == "number" || e == "symbol" || e == "boolean" ? t !== "__proto__" : t === null;
  464. }
  465. function ls(t, e) {
  466. var n = t.__data__;
  467. return ed(e) ? n[typeof e == "string" ? "string" : "hash"] : n.map;
  468. }
  469. function td(t) {
  470. var e = ls(this, t).delete(t);
  471. return this.size -= e ? 1 : 0, e;
  472. }
  473. function nd(t) {
  474. return ls(this, t).get(t);
  475. }
  476. function rd(t) {
  477. return ls(this, t).has(t);
  478. }
  479. function sd(t, e) {
  480. var n = ls(this, t), r = n.size;
  481. return n.set(t, e), this.size += n.size == r ? 0 : 1, this;
  482. }
  483. function nn(t) {
  484. var e = -1, n = t == null ? 0 : t.length;
  485. for (this.clear(); ++e < n; ) {
  486. var r = t[e];
  487. this.set(r[0], r[1]);
  488. }
  489. }
  490. nn.prototype.clear = qh;
  491. nn.prototype.delete = td;
  492. nn.prototype.get = nd;
  493. nn.prototype.has = rd;
  494. nn.prototype.set = sd;
  495. var id = "Expected a function";
  496. function wi(t, e) {
  497. if (typeof t != "function" || e != null && typeof e != "function")
  498. throw new TypeError(id);
  499. var n = function() {
  500. var r = arguments, s = e ? e.apply(this, r) : r[0], i = n.cache;
  501. if (i.has(s))
  502. return i.get(s);
  503. var o = t.apply(this, r);
  504. return n.cache = i.set(s, o) || i, o;
  505. };
  506. return n.cache = new (wi.Cache || nn)(), n;
  507. }
  508. wi.Cache = nn;
  509. var od = 500;
  510. function ad(t) {
  511. var e = wi(t, function(r) {
  512. return n.size === od && n.clear(), r;
  513. }), n = e.cache;
  514. return e;
  515. }
  516. var ud = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, ld = /\\(\\)?/g, cd = ad(function(t) {
  517. var e = [];
  518. return t.charCodeAt(0) === 46 && e.push(""), t.replace(ud, function(n, r, s, i) {
  519. e.push(s ? i.replace(ld, "$1") : r || n);
  520. }), e;
  521. });
  522. function hd(t) {
  523. return t == null ? "" : Fa(t);
  524. }
  525. function Za(t, e) {
  526. return Dn(t) ? t : Lh(t, e) ? [t] : cd(hd(t));
  527. }
  528. function Qa(t) {
  529. if (typeof t == "string" || os(t))
  530. return t;
  531. var e = t + "";
  532. return e == "0" && 1 / t == -1 / 0 ? "-0" : e;
  533. }
  534. function dd(t, e) {
  535. e = Za(e, t);
  536. for (var n = 0, r = e.length; t != null && n < r; )
  537. t = t[Qa(e[n++])];
  538. return n && n == r ? t : void 0;
  539. }
  540. function b0(t, e, n) {
  541. var r = t == null ? void 0 : dd(t, e);
  542. return r === void 0 ? n : r;
  543. }
  544. var qa = Sh(Object.getPrototypeOf, Object), fd = "[object Object]", gd = Function.prototype, pd = Object.prototype, eu = gd.toString, md = pd.hasOwnProperty, _d = eu.call(Object);
  545. function Ed(t) {
  546. if (!Un(t) || ir(t) != fd)
  547. return !1;
  548. var e = qa(t);
  549. if (e === null)
  550. return !0;
  551. var n = md.call(e, "constructor") && e.constructor;
  552. return typeof n == "function" && n instanceof n && eu.call(n) == _d;
  553. }
  554. function Cd() {
  555. this.__data__ = new Wt(), this.size = 0;
  556. }
  557. function Rd(t) {
  558. var e = this.__data__, n = e.delete(t);
  559. return this.size = e.size, n;
  560. }
  561. function Id(t) {
  562. return this.__data__.get(t);
  563. }
  564. function vd(t) {
  565. return this.__data__.has(t);
  566. }
  567. var yd = 200;
  568. function wd(t, e) {
  569. var n = this.__data__;
  570. if (n instanceof Wt) {
  571. var r = n.__data__;
  572. if (!Ja || r.length < yd - 1)
  573. return r.push([t, e]), this.size = ++n.size, this;
  574. n = this.__data__ = new nn(r);
  575. }
  576. return n.set(t, e), this.size = n.size, this;
  577. }
  578. function Pn(t) {
  579. var e = this.__data__ = new Wt(t);
  580. this.size = e.size;
  581. }
  582. Pn.prototype.clear = Cd;
  583. Pn.prototype.delete = Rd;
  584. Pn.prototype.get = Id;
  585. Pn.prototype.has = vd;
  586. Pn.prototype.set = wd;
  587. var tu = typeof exports == "object" && exports && !exports.nodeType && exports, ro = tu && typeof module == "object" && module && !module.nodeType && module, Od = ro && ro.exports === tu, so = Od ? En.Buffer : void 0;
  588. so && so.allocUnsafe;
  589. function bd(t, e) {
  590. return t.slice();
  591. }
  592. var io = En.Uint8Array;
  593. function Sd(t) {
  594. var e = new t.constructor(t.byteLength);
  595. return new io(e).set(new io(t)), e;
  596. }
  597. function Ad(t, e) {
  598. var n = Sd(t.buffer);
  599. return new t.constructor(n, t.byteOffset, t.length);
  600. }
  601. function Nd(t) {
  602. return typeof t.constructor == "function" && !Wa(t) ? bc(qa(t)) : {};
  603. }
  604. function Td(t) {
  605. return function(e, n, r) {
  606. for (var s = -1, i = Object(e), o = r(e), a = o.length; a--; ) {
  607. var u = o[++s];
  608. if (n(i[u], u, i) === !1)
  609. break;
  610. }
  611. return e;
  612. };
  613. }
  614. var Md = Td(), Is = function() {
  615. return En.Date.now();
  616. }, Dd = "Expected a function", xd = Math.max, Ld = Math.min;
  617. function S0(t, e, n) {
  618. var r, s, i, o, a, u, c = 0, l = !1, h = !1, d = !0;
  619. if (typeof t != "function")
  620. throw new TypeError(Dd);
  621. e = Ki(e) || 0, yt(n) && (l = !!n.leading, h = "maxWait" in n, i = h ? xd(Ki(n.maxWait) || 0, e) : i, d = "trailing" in n ? !!n.trailing : d);
  622. function f(A) {
  623. var H = r, Z = s;
  624. return r = s = void 0, c = A, o = t.apply(Z, H), o;
  625. }
  626. function E(A) {
  627. return c = A, a = setTimeout(U, e), l ? f(A) : o;
  628. }
  629. function R(A) {
  630. var H = A - u, Z = A - c, fe = e - H;
  631. return h ? Ld(fe, i - Z) : fe;
  632. }
  633. function O(A) {
  634. var H = A - u, Z = A - c;
  635. return u === void 0 || H >= e || H < 0 || h && Z >= i;
  636. }
  637. function U() {
  638. var A = Is();
  639. if (O(A))
  640. return ne(A);
  641. a = setTimeout(U, R(A));
  642. }
  643. function ne(A) {
  644. return a = void 0, d && r ? f(A) : (r = s = void 0, o);
  645. }
  646. function X() {
  647. a !== void 0 && clearTimeout(a), c = 0, r = u = s = a = void 0;
  648. }
  649. function de() {
  650. return a === void 0 ? o : ne(Is());
  651. }
  652. function T() {
  653. var A = Is(), H = O(A);
  654. if (r = arguments, s = this, u = A, H) {
  655. if (a === void 0)
  656. return E(u);
  657. if (h)
  658. return clearTimeout(a), a = setTimeout(U, e), f(u);
  659. }
  660. return a === void 0 && (a = setTimeout(U, e)), o;
  661. }
  662. return T.cancel = X, T.flush = de, T;
  663. }
  664. function $s(t, e, n) {
  665. (n !== void 0 && !as(t[e], n) || n === void 0 && !(e in t)) && vi(t, e, n);
  666. }
  667. function Ud(t) {
  668. return Un(t) && yi(t);
  669. }
  670. function Bs(t, e) {
  671. if (!(e === "constructor" && typeof t[e] == "function") && e != "__proto__")
  672. return t[e];
  673. }
  674. function Pd(t) {
  675. return Bc(t, Xa(t));
  676. }
  677. function kd(t, e, n, r, s, i, o) {
  678. var a = Bs(t, n), u = Bs(e, n), c = o.get(u);
  679. if (c) {
  680. $s(t, n, c);
  681. return;
  682. }
  683. var l = i ? i(a, u, n + "", t, e, o) : void 0, h = l === void 0;
  684. if (h) {
  685. var d = Dn(u), f = !d && Va(u), E = !d && !f && Ka(u);
  686. l = u, d || f || E ? Dn(a) ? l = a : Ud(a) ? l = Ac(a) : f ? (h = !1, l = bd(u)) : E ? (h = !1, l = Ad(u)) : l = [] : Ed(u) || Fs(u) ? (l = a, Fs(a) ? l = Pd(a) : (!yt(a) || Ci(a)) && (l = Nd(u))) : h = !1;
  687. }
  688. h && (o.set(u, l), s(l, u, r, i, o), o.delete(u)), $s(t, n, l);
  689. }
  690. function Oi(t, e, n, r, s) {
  691. t !== e && Md(e, function(i, o) {
  692. if (s || (s = new Pn()), yt(i))
  693. kd(t, e, o, n, Oi, r, s);
  694. else {
  695. var a = r ? r(Bs(t, o), i, o + "", t, e, s) : void 0;
  696. a === void 0 && (a = i), $s(t, o, a);
  697. }
  698. }, Xa);
  699. }
  700. var A0 = Ha(function(t, e, n, r) {
  701. Oi(t, e, n, r);
  702. }), nu = Ha(function(t, e, n) {
  703. Oi(t, e, n);
  704. });
  705. function Fd(t, e, n, r) {
  706. if (!yt(t))
  707. return t;
  708. e = Za(e, t);
  709. for (var s = -1, i = e.length, o = i - 1, a = t; a != null && ++s < i; ) {
  710. var u = Qa(e[s]), c = n;
  711. if (u === "__proto__" || u === "constructor" || u === "prototype")
  712. return t;
  713. if (s != o) {
  714. var l = a[u];
  715. c = void 0, c === void 0 && (c = yt(l) ? l : Ii(e[s + 1]) ? [] : {});
  716. }
  717. Ba(a, u, c), a = a[u];
  718. }
  719. return t;
  720. }
  721. function N0(t, e, n) {
  722. return t == null ? t : Fd(t, e, n);
  723. }
  724. function wt(t) {
  725. return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
  726. }
  727. var vs, oo;
  728. function $d() {
  729. if (oo) return vs;
  730. oo = 1;
  731. var t = -1, e = 1, n = 0;
  732. function r(m, j, y, M, b) {
  733. if (m === j)
  734. return m ? [[n, m]] : [];
  735. if (y != null) {
  736. var w = fe(m, j, y);
  737. if (w)
  738. return w;
  739. }
  740. var k = a(m, j), $ = m.substring(0, k);
  741. m = m.substring(k), j = j.substring(k), k = c(m, j);
  742. var Y = m.substring(m.length - k);
  743. m = m.substring(0, m.length - k), j = j.substring(0, j.length - k);
  744. var se = s(m, j);
  745. return $ && se.unshift([n, $]), Y && se.push([n, Y]), ne(se, b), M && h(se), se;
  746. }
  747. function s(m, j) {
  748. var y;
  749. if (!m)
  750. return [[e, j]];
  751. if (!j)
  752. return [[t, m]];
  753. var M = m.length > j.length ? m : j, b = m.length > j.length ? j : m, w = M.indexOf(b);
  754. if (w !== -1)
  755. return y = [
  756. [e, M.substring(0, w)],
  757. [n, b],
  758. [e, M.substring(w + b.length)]
  759. ], m.length > j.length && (y[0][0] = y[2][0] = t), y;
  760. if (b.length === 1)
  761. return [
  762. [t, m],
  763. [e, j]
  764. ];
  765. var k = l(m, j);
  766. if (k) {
  767. var $ = k[0], Y = k[1], se = k[2], he = k[3], ge = k[4], Ae = r($, se), be = r(Y, he);
  768. return Ae.concat([[n, ge]], be);
  769. }
  770. return i(m, j);
  771. }
  772. function i(m, j) {
  773. for (var y = m.length, M = j.length, b = Math.ceil((y + M) / 2), w = b, k = 2 * b, $ = new Array(k), Y = new Array(k), se = 0; se < k; se++)
  774. $[se] = -1, Y[se] = -1;
  775. $[w + 1] = 0, Y[w + 1] = 0;
  776. for (var he = y - M, ge = he % 2 !== 0, Ae = 0, be = 0, v = 0, F = 0, V = 0; V < b; V++) {
  777. for (var K = -V + Ae; K <= V - be; K += 2) {
  778. var z = w + K, W;
  779. K === -V || K !== V && $[z - 1] < $[z + 1] ? W = $[z + 1] : W = $[z - 1] + 1;
  780. for (var ue = W - K; W < y && ue < M && m.charAt(W) === j.charAt(ue); )
  781. W++, ue++;
  782. if ($[z] = W, W > y)
  783. be += 2;
  784. else if (ue > M)
  785. Ae += 2;
  786. else if (ge) {
  787. var oe = w + he - K;
  788. if (oe >= 0 && oe < k && Y[oe] !== -1) {
  789. var B = y - Y[oe];
  790. if (W >= B)
  791. return o(m, j, W, ue);
  792. }
  793. }
  794. }
  795. for (var ee = -V + v; ee <= V - F; ee += 2) {
  796. var oe = w + ee, B;
  797. ee === -V || ee !== V && Y[oe - 1] < Y[oe + 1] ? B = Y[oe + 1] : B = Y[oe - 1] + 1;
  798. for (var ie = B - ee; B < y && ie < M && m.charAt(y - B - 1) === j.charAt(M - ie - 1); )
  799. B++, ie++;
  800. if (Y[oe] = B, B > y)
  801. F += 2;
  802. else if (ie > M)
  803. v += 2;
  804. else if (!ge) {
  805. var z = w + he - ee;
  806. if (z >= 0 && z < k && $[z] !== -1) {
  807. var W = $[z], ue = w + W - z;
  808. if (B = y - B, W >= B)
  809. return o(m, j, W, ue);
  810. }
  811. }
  812. }
  813. }
  814. return [
  815. [t, m],
  816. [e, j]
  817. ];
  818. }
  819. function o(m, j, y, M) {
  820. var b = m.substring(0, y), w = j.substring(0, M), k = m.substring(y), $ = j.substring(M), Y = r(b, w), se = r(k, $);
  821. return Y.concat(se);
  822. }
  823. function a(m, j) {
  824. if (!m || !j || m.charAt(0) !== j.charAt(0))
  825. return 0;
  826. for (var y = 0, M = Math.min(m.length, j.length), b = M, w = 0; y < b; )
  827. m.substring(w, b) == j.substring(w, b) ? (y = b, w = y) : M = b, b = Math.floor((M - y) / 2 + y);
  828. return X(m.charCodeAt(b - 1)) && b--, b;
  829. }
  830. function u(m, j) {
  831. var y = m.length, M = j.length;
  832. if (y == 0 || M == 0)
  833. return 0;
  834. y > M ? m = m.substring(y - M) : y < M && (j = j.substring(0, y));
  835. var b = Math.min(y, M);
  836. if (m == j)
  837. return b;
  838. for (var w = 0, k = 1; ; ) {
  839. var $ = m.substring(b - k), Y = j.indexOf($);
  840. if (Y == -1)
  841. return w;
  842. k += Y, (Y == 0 || m.substring(b - k) == j.substring(0, k)) && (w = k, k++);
  843. }
  844. }
  845. function c(m, j) {
  846. if (!m || !j || m.slice(-1) !== j.slice(-1))
  847. return 0;
  848. for (var y = 0, M = Math.min(m.length, j.length), b = M, w = 0; y < b; )
  849. m.substring(m.length - b, m.length - w) == j.substring(j.length - b, j.length - w) ? (y = b, w = y) : M = b, b = Math.floor((M - y) / 2 + y);
  850. return de(m.charCodeAt(m.length - b)) && b--, b;
  851. }
  852. function l(m, j) {
  853. var y = m.length > j.length ? m : j, M = m.length > j.length ? j : m;
  854. if (y.length < 4 || M.length * 2 < y.length)
  855. return null;
  856. function b(be, v, F) {
  857. for (var V = be.substring(F, F + Math.floor(be.length / 4)), K = -1, z = "", W, ue, oe, B; (K = v.indexOf(V, K + 1)) !== -1; ) {
  858. var ee = a(
  859. be.substring(F),
  860. v.substring(K)
  861. ), ie = c(
  862. be.substring(0, F),
  863. v.substring(0, K)
  864. );
  865. z.length < ie + ee && (z = v.substring(K - ie, K) + v.substring(K, K + ee), W = be.substring(0, F - ie), ue = be.substring(F + ee), oe = v.substring(0, K - ie), B = v.substring(K + ee));
  866. }
  867. return z.length * 2 >= be.length ? [
  868. W,
  869. ue,
  870. oe,
  871. B,
  872. z
  873. ] : null;
  874. }
  875. var w = b(
  876. y,
  877. M,
  878. Math.ceil(y.length / 4)
  879. ), k = b(
  880. y,
  881. M,
  882. Math.ceil(y.length / 2)
  883. ), $;
  884. if (!w && !k)
  885. return null;
  886. k ? w ? $ = w[4].length > k[4].length ? w : k : $ = k : $ = w;
  887. var Y, se, he, ge;
  888. m.length > j.length ? (Y = $[0], se = $[1], he = $[2], ge = $[3]) : (he = $[0], ge = $[1], Y = $[2], se = $[3]);
  889. var Ae = $[4];
  890. return [Y, se, he, ge, Ae];
  891. }
  892. function h(m) {
  893. for (var j = !1, y = [], M = 0, b = null, w = 0, k = 0, $ = 0, Y = 0, se = 0; w < m.length; )
  894. m[w][0] == n ? (y[M++] = w, k = Y, $ = se, Y = 0, se = 0, b = m[w][1]) : (m[w][0] == e ? Y += m[w][1].length : se += m[w][1].length, b && b.length <= Math.max(k, $) && b.length <= Math.max(Y, se) && (m.splice(y[M - 1], 0, [
  895. t,
  896. b
  897. ]), m[y[M - 1] + 1][0] = e, M--, M--, w = M > 0 ? y[M - 1] : -1, k = 0, $ = 0, Y = 0, se = 0, b = null, j = !0)), w++;
  898. for (j && ne(m), U(m), w = 1; w < m.length; ) {
  899. if (m[w - 1][0] == t && m[w][0] == e) {
  900. var he = m[w - 1][1], ge = m[w][1], Ae = u(he, ge), be = u(ge, he);
  901. Ae >= be ? (Ae >= he.length / 2 || Ae >= ge.length / 2) && (m.splice(w, 0, [
  902. n,
  903. ge.substring(0, Ae)
  904. ]), m[w - 1][1] = he.substring(
  905. 0,
  906. he.length - Ae
  907. ), m[w + 1][1] = ge.substring(Ae), w++) : (be >= he.length / 2 || be >= ge.length / 2) && (m.splice(w, 0, [
  908. n,
  909. he.substring(0, be)
  910. ]), m[w - 1][0] = e, m[w - 1][1] = ge.substring(
  911. 0,
  912. ge.length - be
  913. ), m[w + 1][0] = t, m[w + 1][1] = he.substring(be), w++), w++;
  914. }
  915. w++;
  916. }
  917. }
  918. var d = /[^a-zA-Z0-9]/, f = /\s/, E = /[\r\n]/, R = /\n\r?\n$/, O = /^\r?\n\r?\n/;
  919. function U(m) {
  920. function j(be, v) {
  921. if (!be || !v)
  922. return 6;
  923. var F = be.charAt(be.length - 1), V = v.charAt(0), K = F.match(d), z = V.match(d), W = K && F.match(f), ue = z && V.match(f), oe = W && F.match(E), B = ue && V.match(E), ee = oe && be.match(R), ie = B && v.match(O);
  924. return ee || ie ? 5 : oe || B ? 4 : K && !W && ue ? 3 : W || ue ? 2 : K || z ? 1 : 0;
  925. }
  926. for (var y = 1; y < m.length - 1; ) {
  927. if (m[y - 1][0] == n && m[y + 1][0] == n) {
  928. var M = m[y - 1][1], b = m[y][1], w = m[y + 1][1], k = c(M, b);
  929. if (k) {
  930. var $ = b.substring(b.length - k);
  931. M = M.substring(0, M.length - k), b = $ + b.substring(0, b.length - k), w = $ + w;
  932. }
  933. for (var Y = M, se = b, he = w, ge = j(M, b) + j(b, w); b.charAt(0) === w.charAt(0); ) {
  934. M += b.charAt(0), b = b.substring(1) + w.charAt(0), w = w.substring(1);
  935. var Ae = j(M, b) + j(b, w);
  936. Ae >= ge && (ge = Ae, Y = M, se = b, he = w);
  937. }
  938. m[y - 1][1] != Y && (Y ? m[y - 1][1] = Y : (m.splice(y - 1, 1), y--), m[y][1] = se, he ? m[y + 1][1] = he : (m.splice(y + 1, 1), y--));
  939. }
  940. y++;
  941. }
  942. }
  943. function ne(m, j) {
  944. m.push([n, ""]);
  945. for (var y = 0, M = 0, b = 0, w = "", k = "", $; y < m.length; ) {
  946. if (y < m.length - 1 && !m[y][1]) {
  947. m.splice(y, 1);
  948. continue;
  949. }
  950. switch (m[y][0]) {
  951. case e:
  952. b++, k += m[y][1], y++;
  953. break;
  954. case t:
  955. M++, w += m[y][1], y++;
  956. break;
  957. case n:
  958. var Y = y - b - M - 1;
  959. if (j) {
  960. if (Y >= 0 && A(m[Y][1])) {
  961. var se = m[Y][1].slice(-1);
  962. if (m[Y][1] = m[Y][1].slice(
  963. 0,
  964. -1
  965. ), w = se + w, k = se + k, !m[Y][1]) {
  966. m.splice(Y, 1), y--;
  967. var he = Y - 1;
  968. m[he] && m[he][0] === e && (b++, k = m[he][1] + k, he--), m[he] && m[he][0] === t && (M++, w = m[he][1] + w, he--), Y = he;
  969. }
  970. }
  971. if (T(m[y][1])) {
  972. var se = m[y][1].charAt(0);
  973. m[y][1] = m[y][1].slice(1), w += se, k += se;
  974. }
  975. }
  976. if (y < m.length - 1 && !m[y][1]) {
  977. m.splice(y, 1);
  978. break;
  979. }
  980. if (w.length > 0 || k.length > 0) {
  981. w.length > 0 && k.length > 0 && ($ = a(k, w), $ !== 0 && (Y >= 0 ? m[Y][1] += k.substring(
  982. 0,
  983. $
  984. ) : (m.splice(0, 0, [
  985. n,
  986. k.substring(0, $)
  987. ]), y++), k = k.substring($), w = w.substring($)), $ = c(k, w), $ !== 0 && (m[y][1] = k.substring(k.length - $) + m[y][1], k = k.substring(
  988. 0,
  989. k.length - $
  990. ), w = w.substring(
  991. 0,
  992. w.length - $
  993. )));
  994. var ge = b + M;
  995. w.length === 0 && k.length === 0 ? (m.splice(y - ge, ge), y = y - ge) : w.length === 0 ? (m.splice(y - ge, ge, [e, k]), y = y - ge + 1) : k.length === 0 ? (m.splice(y - ge, ge, [t, w]), y = y - ge + 1) : (m.splice(
  996. y - ge,
  997. ge,
  998. [t, w],
  999. [e, k]
  1000. ), y = y - ge + 2);
  1001. }
  1002. y !== 0 && m[y - 1][0] === n ? (m[y - 1][1] += m[y][1], m.splice(y, 1)) : y++, b = 0, M = 0, w = "", k = "";
  1003. break;
  1004. }
  1005. }
  1006. m[m.length - 1][1] === "" && m.pop();
  1007. var Ae = !1;
  1008. for (y = 1; y < m.length - 1; )
  1009. m[y - 1][0] === n && m[y + 1][0] === n && (m[y][1].substring(
  1010. m[y][1].length - m[y - 1][1].length
  1011. ) === m[y - 1][1] ? (m[y][1] = m[y - 1][1] + m[y][1].substring(
  1012. 0,
  1013. m[y][1].length - m[y - 1][1].length
  1014. ), m[y + 1][1] = m[y - 1][1] + m[y + 1][1], m.splice(y - 1, 1), Ae = !0) : m[y][1].substring(0, m[y + 1][1].length) == m[y + 1][1] && (m[y - 1][1] += m[y + 1][1], m[y][1] = m[y][1].substring(m[y + 1][1].length) + m[y + 1][1], m.splice(y + 1, 1), Ae = !0)), y++;
  1015. Ae && ne(m, j);
  1016. }
  1017. function X(m) {
  1018. return m >= 55296 && m <= 56319;
  1019. }
  1020. function de(m) {
  1021. return m >= 56320 && m <= 57343;
  1022. }
  1023. function T(m) {
  1024. return de(m.charCodeAt(0));
  1025. }
  1026. function A(m) {
  1027. return X(m.charCodeAt(m.length - 1));
  1028. }
  1029. function H(m) {
  1030. for (var j = [], y = 0; y < m.length; y++)
  1031. m[y][1].length > 0 && j.push(m[y]);
  1032. return j;
  1033. }
  1034. function Z(m, j, y, M) {
  1035. return A(m) || T(M) ? null : H([
  1036. [n, m],
  1037. [t, j],
  1038. [e, y],
  1039. [n, M]
  1040. ]);
  1041. }
  1042. function fe(m, j, y) {
  1043. var M = typeof y == "number" ? { index: y, length: 0 } : y.oldRange, b = typeof y == "number" ? null : y.newRange, w = m.length, k = j.length;
  1044. if (M.length === 0 && (b === null || b.length === 0)) {
  1045. var $ = M.index, Y = m.slice(0, $), se = m.slice($), he = b ? b.index : null;
  1046. e: {
  1047. var ge = $ + k - w;
  1048. if (he !== null && he !== ge || ge < 0 || ge > k)
  1049. break e;
  1050. var Ae = j.slice(0, ge), be = j.slice(ge);
  1051. if (be !== se)
  1052. break e;
  1053. var v = Math.min($, ge), F = Y.slice(0, v), V = Ae.slice(0, v);
  1054. if (F !== V)
  1055. break e;
  1056. var K = Y.slice(v), z = Ae.slice(v);
  1057. return Z(F, K, z, se);
  1058. }
  1059. e: {
  1060. if (he !== null && he !== $)
  1061. break e;
  1062. var W = $, Ae = j.slice(0, W), be = j.slice(W);
  1063. if (Ae !== Y)
  1064. break e;
  1065. var ue = Math.min(w - W, k - W), oe = se.slice(se.length - ue), B = be.slice(be.length - ue);
  1066. if (oe !== B)
  1067. break e;
  1068. var K = se.slice(0, se.length - ue), z = be.slice(0, be.length - ue);
  1069. return Z(Y, K, z, oe);
  1070. }
  1071. }
  1072. if (M.length > 0 && b && b.length === 0)
  1073. e: {
  1074. var F = m.slice(0, M.index), oe = m.slice(M.index + M.length), v = F.length, ue = oe.length;
  1075. if (k < v + ue)
  1076. break e;
  1077. var V = j.slice(0, v), B = j.slice(k - ue);
  1078. if (F !== V || oe !== B)
  1079. break e;
  1080. var K = m.slice(v, w - ue), z = j.slice(v, k - ue);
  1081. return Z(F, K, z, oe);
  1082. }
  1083. return null;
  1084. }
  1085. function ae(m, j, y, M) {
  1086. return r(m, j, y, M, !0);
  1087. }
  1088. return ae.INSERT = e, ae.DELETE = t, ae.EQUAL = n, vs = ae, vs;
  1089. }
  1090. var Bd = $d();
  1091. const ru = /* @__PURE__ */ wt(Bd);
  1092. function cs(t, e) {
  1093. const n = t.indexOf(e);
  1094. return n > -1 ? (t.splice(n, 1), !0) : !1;
  1095. }
  1096. function T0(t) {
  1097. const e = /* @__PURE__ */ new Set(), n = [];
  1098. for (const r of t)
  1099. e.has(r) || (e.add(r), n.push(r));
  1100. return n;
  1101. }
  1102. function jd(t, e) {
  1103. for (let n = t.length - 1; n > -1; n--) {
  1104. const r = t[n];
  1105. if (e(r, n))
  1106. return r;
  1107. }
  1108. return null;
  1109. }
  1110. function M0(t, e) {
  1111. if (t.length === 0)
  1112. return t;
  1113. const n = e % t.length;
  1114. return t.slice(n).concat(t.slice(0, n));
  1115. }
  1116. function D0(t, e) {
  1117. const n = /* @__PURE__ */ new Map();
  1118. return t.forEach((r) => {
  1119. const s = e(r);
  1120. let i = n.get(s);
  1121. n.has(s) || (i = [], n.set(s, i)), i.push(r);
  1122. }), n;
  1123. }
  1124. function x0(t) {
  1125. return Array.isArray(t) ? t : [t];
  1126. }
  1127. function L0(t) {
  1128. return ["true", "false"].includes(t.toLowerCase());
  1129. }
  1130. const or = "__INTERNAL_EDITOR__", su = `${or}DOCS_NORMAL`, iu = `${or}DOCS_FORMULA_BAR`, Hd = `${or}ZEN_EDITOR`, Wd = `\r
  1131. `, U0 = "isRowStylePrecedeColumnStyle", P0 = Symbol("AUTO_HEIGHT_FOR_MERGED_CELLS");
  1132. function k0(t) {
  1133. return `${or}${t}`;
  1134. }
  1135. function zd(t) {
  1136. return t.startsWith(or);
  1137. }
  1138. var bi = Symbol("$$IDENTIFIER_DECORATOR");
  1139. function Yd(t) {
  1140. return t && t[bi] === !0;
  1141. }
  1142. function ou(t) {
  1143. return typeof t == "function";
  1144. }
  1145. function ao(t) {
  1146. return !!(t && typeof t.useClass < "u");
  1147. }
  1148. function uo(t) {
  1149. return !!(t && typeof t.useFactory < "u");
  1150. }
  1151. function lo(t) {
  1152. return !!(t && typeof t.useValue < "u");
  1153. }
  1154. function Vd(t) {
  1155. return !!(t && typeof t.useExisting < "u");
  1156. }
  1157. function co(t) {
  1158. return !!(t && typeof t.useAsync < "u");
  1159. }
  1160. var au = Symbol("AsyncHook");
  1161. function ys(t) {
  1162. return !!(t && t.__symbol === au);
  1163. }
  1164. function Et(t) {
  1165. return typeof t > "u" ? "undefined" : ou(t) && !t[bi] ? t.name : t.toString();
  1166. }
  1167. var Gd = /* @__PURE__ */ function() {
  1168. var t = function(e, n) {
  1169. return t = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(r, s) {
  1170. r.__proto__ = s;
  1171. } || function(r, s) {
  1172. for (var i in s) Object.prototype.hasOwnProperty.call(s, i) && (r[i] = s[i]);
  1173. }, t(e, n);
  1174. };
  1175. return function(e, n) {
  1176. if (typeof n != "function" && n !== null)
  1177. throw new TypeError("Class extends value " + String(n) + " is not a constructor or null");
  1178. t(e, n);
  1179. function r() {
  1180. this.constructor = e;
  1181. }
  1182. e.prototype = n === null ? Object.create(n) : (r.prototype = n.prototype, new r());
  1183. };
  1184. }(), at = (
  1185. /** @class */
  1186. function(t) {
  1187. Gd(e, t);
  1188. function e(n) {
  1189. return t.call(this, "[redi]: ".concat(n)) || this;
  1190. }
  1191. return e;
  1192. }(Error)
  1193. ), Ge;
  1194. (function(t) {
  1195. t.MANY = "many", t.OPTIONAL = "optional", t.REQUIRED = "required";
  1196. })(Ge || (Ge = {}));
  1197. var $t;
  1198. (function(t) {
  1199. t.SELF = "self", t.SKIP_SELF = "skipSelf";
  1200. })($t || ($t = {}));
  1201. var uu = /* @__PURE__ */ function() {
  1202. var t = function(e, n) {
  1203. return t = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(r, s) {
  1204. r.__proto__ = s;
  1205. } || function(r, s) {
  1206. for (var i in s) Object.prototype.hasOwnProperty.call(s, i) && (r[i] = s[i]);
  1207. }, t(e, n);
  1208. };
  1209. return function(e, n) {
  1210. if (typeof n != "function" && n !== null)
  1211. throw new TypeError("Class extends value " + String(n) + " is not a constructor or null");
  1212. t(e, n);
  1213. function r() {
  1214. this.constructor = e;
  1215. }
  1216. e.prototype = n === null ? Object.create(n) : (r.prototype = n.prototype, new r());
  1217. };
  1218. }(), ho = Symbol("$$TARGET"), js = Symbol("$$DEPENDENCIES"), Kd = (
  1219. /** @class */
  1220. function(t) {
  1221. uu(e, t);
  1222. function e(n, r) {
  1223. var s = "Could not find dependency registered on the ".concat(n, ' (indexed) parameter of the constructor of "').concat(Et(r), '".');
  1224. return t.call(this, s) || this;
  1225. }
  1226. return e;
  1227. }(at)
  1228. ), lu = (
  1229. /** @class */
  1230. function(t) {
  1231. uu(e, t);
  1232. function e(n, r) {
  1233. var s = 'It seems that you register "undefined" as dependency on the '.concat(r + 1, ' parameter of "').concat(Et(n), '". Please make sure that there is not cyclic dependency among your TypeScript files, or consider using "forwardRef". For more info please visit our website https://redi.wendell.fun/docs/debug#could-not-find-dependency-registered-on');
  1234. return t.call(this, s) || this;
  1235. }
  1236. return e;
  1237. }(at)
  1238. );
  1239. function cu(t) {
  1240. var e = t;
  1241. return e[js] || [];
  1242. }
  1243. function Si(t, e) {
  1244. var n = cu(t), r = n.find(function(s) {
  1245. return s.paramIndex === e;
  1246. });
  1247. if (!r)
  1248. throw new Kd(e, t);
  1249. return r;
  1250. }
  1251. function Ai(t, e, n, r, s) {
  1252. r === void 0 && (r = Ge.REQUIRED);
  1253. var i = {
  1254. paramIndex: n,
  1255. identifier: e,
  1256. quantity: r,
  1257. lookUp: s,
  1258. withNew: !1
  1259. };
  1260. if (typeof e > "u")
  1261. throw new lu(t, n);
  1262. var o = t;
  1263. o[ho] === o ? o[js].push(i) : (o[js] = [i], o[ho] = o);
  1264. }
  1265. var fo = /* @__PURE__ */ new Set();
  1266. function Ct(t) {
  1267. if (fo.has(t))
  1268. throw new at('Identifier "'.concat(t, '" already exists.'));
  1269. fo.add(t);
  1270. var e = function(n, r, s) {
  1271. Ai(n, e, s);
  1272. };
  1273. return e.toString = function() {
  1274. return t;
  1275. }, e[bi] = !0, e;
  1276. }
  1277. function Xd(t, e, n) {
  1278. var r = Si(t, e);
  1279. r.lookUp = n;
  1280. }
  1281. function hu(t) {
  1282. return function e() {
  1283. return this instanceof e ? this : function(n, r, s) {
  1284. Xd(n, s, t);
  1285. };
  1286. };
  1287. }
  1288. var Jd = hu($t.SKIP_SELF), Zd = hu($t.SELF), Qd = /* @__PURE__ */ function() {
  1289. var t = function(e, n) {
  1290. return t = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(r, s) {
  1291. r.__proto__ = s;
  1292. } || function(r, s) {
  1293. for (var i in s) Object.prototype.hasOwnProperty.call(s, i) && (r[i] = s[i]);
  1294. }, t(e, n);
  1295. };
  1296. return function(e, n) {
  1297. if (typeof n != "function" && n !== null)
  1298. throw new TypeError("Class extends value " + String(n) + " is not a constructor or null");
  1299. t(e, n);
  1300. function r() {
  1301. this.constructor = e;
  1302. }
  1303. e.prototype = n === null ? Object.create(n) : (r.prototype = n.prototype, new r());
  1304. };
  1305. }(), Hs = (
  1306. /** @class */
  1307. function(t) {
  1308. Qd(e, t);
  1309. function e(n, r, s) {
  1310. var i = this, o = 'Expect "'.concat(r, '" dependency items for id "').concat(Et(n), '" but get ').concat(s, ".");
  1311. return s === 0 && (o += " Did you forget to register it?"), s > 1 && (o += " You register it more than once."), i = t.call(this, o) || this, i.quantity = r, i.actual = s, i;
  1312. }
  1313. return e;
  1314. }(at)
  1315. );
  1316. function Ni(t, e, n) {
  1317. if (e === Ge.OPTIONAL && n > 1 || e === Ge.REQUIRED && n !== 1)
  1318. throw new Hs(t, e, n);
  1319. }
  1320. function qd(t, e) {
  1321. return t === Ge.MANY ? e : e[0];
  1322. }
  1323. function ef(t, e, n) {
  1324. var r = Si(t, e);
  1325. r.quantity = n;
  1326. }
  1327. function Ti(t) {
  1328. return function e(n) {
  1329. return this instanceof e ? this : function(r, s, i) {
  1330. if (n)
  1331. Ai(r, n, i, t);
  1332. else {
  1333. if (t === Ge.REQUIRED)
  1334. throw new lu(r, i);
  1335. ef(r, i, t);
  1336. }
  1337. };
  1338. };
  1339. }
  1340. var tf = Ti(Ge.MANY), nf = Ti(Ge.OPTIONAL), ot = Ti(Ge.REQUIRED);
  1341. function rf(t, e, n) {
  1342. var r = Si(t, e);
  1343. r.withNew = n;
  1344. }
  1345. function sf(t) {
  1346. return function e() {
  1347. return this instanceof e ? this : function(n, r, s) {
  1348. rf(n, s, t);
  1349. };
  1350. };
  1351. }
  1352. var of = sf(!0);
  1353. function du(t, e) {
  1354. return e === void 0 && (e = 0), t ? t.map(function(n, r) {
  1355. if (r += e, !Array.isArray(n))
  1356. return {
  1357. paramIndex: r,
  1358. identifier: n,
  1359. quantity: Ge.REQUIRED,
  1360. withNew: !1
  1361. };
  1362. var s = n.slice(0, n.length - 1), i = n[n.length - 1], o, a = Ge.REQUIRED, u = !1;
  1363. return s.forEach(function(c) {
  1364. if (c instanceof Zd)
  1365. o = $t.SELF;
  1366. else if (c instanceof Jd)
  1367. o = $t.SKIP_SELF;
  1368. else if (c instanceof nf)
  1369. a = Ge.OPTIONAL;
  1370. else if (c instanceof tf)
  1371. a = Ge.MANY;
  1372. else if (c instanceof of)
  1373. u = !0;
  1374. else
  1375. throw new at("unknown dep modifier ".concat(c, "."));
  1376. }), {
  1377. paramIndex: r,
  1378. identifier: i,
  1379. quantity: a,
  1380. lookUp: o,
  1381. withNew: u
  1382. };
  1383. }) : [];
  1384. }
  1385. function F0(t, e, n) {
  1386. n === void 0 && (n = 0);
  1387. var r = du(e, n);
  1388. r.forEach(function(s) {
  1389. Ai(t, s.identifier, s.paramIndex, s.quantity, s.lookUp);
  1390. });
  1391. }
  1392. function $0(t) {
  1393. return {
  1394. unwrap: t
  1395. };
  1396. }
  1397. function af(t) {
  1398. return !!t && typeof t.unwrap == "function";
  1399. }
  1400. function uf(t) {
  1401. return af(t) ? t.unwrap() : t;
  1402. }
  1403. function go(t) {
  1404. return !!t && typeof t.dispose == "function";
  1405. }
  1406. var fu = /* @__PURE__ */ function() {
  1407. var t = function(e, n) {
  1408. return t = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(r, s) {
  1409. r.__proto__ = s;
  1410. } || function(r, s) {
  1411. for (var i in s) Object.prototype.hasOwnProperty.call(s, i) && (r[i] = s[i]);
  1412. }, t(e, n);
  1413. };
  1414. return function(e, n) {
  1415. if (typeof n != "function" && n !== null)
  1416. throw new TypeError("Class extends value " + String(n) + " is not a constructor or null");
  1417. t(e, n);
  1418. function r() {
  1419. this.constructor = e;
  1420. }
  1421. e.prototype = n === null ? Object.create(n) : (r.prototype = n.prototype, new r());
  1422. };
  1423. }();
  1424. function lf(t) {
  1425. return t.length === 1;
  1426. }
  1427. var hs = [];
  1428. function po(t) {
  1429. hs.push(t);
  1430. }
  1431. function mo() {
  1432. hs.pop();
  1433. }
  1434. function cf() {
  1435. hs.length = 0;
  1436. }
  1437. var _o = (
  1438. /** @class */
  1439. function(t) {
  1440. fu(e, t);
  1441. function e(n, r, s) {
  1442. var i = 'Cannot find "'.concat(Et(r), '" registered by any injector. It is the ').concat(s, 'th param of "').concat(Yd(n) ? Et(n) : n.name, '".');
  1443. return t.call(this, i) || this;
  1444. }
  1445. return e;
  1446. }(at)
  1447. ), Ur = (
  1448. /** @class */
  1449. function(t) {
  1450. fu(e, t);
  1451. function e(n) {
  1452. var r = this, s = 'Cannot find "'.concat(Et(n), '" registered by any injector. The stack of dependencies is: "').concat(hs.map(function(i) {
  1453. return Et(i);
  1454. }).join(" -> "), '".');
  1455. return r = t.call(this, s) || this, cf(), r;
  1456. }
  1457. return e;
  1458. }(at)
  1459. ), hf = (
  1460. /** @class */
  1461. function() {
  1462. function t(e) {
  1463. var n = this;
  1464. this.dependencyMap = /* @__PURE__ */ new Map(), this.normalizeDependencies(e).map(function(r) {
  1465. return n.add(r[0], r[1]);
  1466. });
  1467. }
  1468. return t.prototype.add = function(e, n) {
  1469. typeof n > "u" && (n = { useClass: e, lazy: !1 });
  1470. var r = this.dependencyMap.get(e);
  1471. typeof r > "u" && (r = [], this.dependencyMap.set(e, r)), r.push(n);
  1472. }, t.prototype.delete = function(e) {
  1473. this.dependencyMap.delete(e);
  1474. }, t.prototype.get = function(e, n) {
  1475. n === void 0 && (n = Ge.REQUIRED);
  1476. var r = this.dependencyMap.get(e);
  1477. return Ni(e, n, r.length), qd(n, r);
  1478. }, t.prototype.has = function(e) {
  1479. return this.dependencyMap.has(e);
  1480. }, t.prototype.append = function(e) {
  1481. var n = this;
  1482. this.normalizeDependencies(e).forEach(function(r) {
  1483. return n.add(r[0], r[1]);
  1484. });
  1485. }, t.prototype.dispose = function() {
  1486. this.dependencyMap.clear();
  1487. }, t.prototype.normalizeDependencies = function(e) {
  1488. return e.map(function(n) {
  1489. var r = n[0], s;
  1490. return lf(n) ? s = {
  1491. useClass: n[0],
  1492. lazy: !1
  1493. } : s = n[1], [r, s];
  1494. });
  1495. }, t;
  1496. }()
  1497. ), df = (
  1498. /** @class */
  1499. function() {
  1500. function t() {
  1501. this.resolvedDependencies = /* @__PURE__ */ new Map();
  1502. }
  1503. return t.prototype.add = function(e, n) {
  1504. var r = this.resolvedDependencies.get(e);
  1505. typeof r > "u" && (r = [], this.resolvedDependencies.set(e, r)), r.push(n);
  1506. }, t.prototype.has = function(e) {
  1507. return this.resolvedDependencies.has(e);
  1508. }, t.prototype.delete = function(e) {
  1509. if (this.resolvedDependencies.has(e)) {
  1510. var n = this.resolvedDependencies.get(e);
  1511. n.forEach(function(r) {
  1512. return go(r) ? r.dispose() : void 0;
  1513. }), this.resolvedDependencies.delete(e);
  1514. }
  1515. }, t.prototype.get = function(e, n) {
  1516. n === void 0 && (n = Ge.REQUIRED);
  1517. var r = this.resolvedDependencies.get(e);
  1518. if (!r)
  1519. throw new Ur(e);
  1520. return Ni(e, n, r.length), n === Ge.MANY ? r : r[0];
  1521. }, t.prototype.dispose = function() {
  1522. Array.from(this.resolvedDependencies.values()).forEach(function(e) {
  1523. e.forEach(function(n) {
  1524. return go(n) ? n.dispose() : void 0;
  1525. });
  1526. }), this.resolvedDependencies.clear();
  1527. }, t;
  1528. }()
  1529. ), Ws;
  1530. (function() {
  1531. if (typeof requestIdleCallback < "u" && typeof cancelIdleCallback < "u")
  1532. Ws = function(e, n) {
  1533. var r = requestIdleCallback(e, typeof n == "number" ? { timeout: n } : void 0), s = !1;
  1534. return function() {
  1535. s || (s = !0, cancelIdleCallback(r));
  1536. };
  1537. };
  1538. else {
  1539. var t = Object.freeze({
  1540. didTimeout: !0,
  1541. timeRemaining: function() {
  1542. return 15;
  1543. }
  1544. });
  1545. Ws = function(e) {
  1546. var n = setTimeout(function() {
  1547. return e(t);
  1548. }), r = !1;
  1549. return function() {
  1550. r || (r = !0, clearTimeout(n));
  1551. };
  1552. };
  1553. }
  1554. })();
  1555. var ff = (
  1556. /** @class */
  1557. function() {
  1558. function t(e) {
  1559. var n = this;
  1560. this.didRun = !1, this.selfExecutor = function() {
  1561. try {
  1562. n.value = e();
  1563. } catch (r) {
  1564. n.error = r;
  1565. } finally {
  1566. n.didRun = !0;
  1567. }
  1568. }, this.disposeCallback = Ws(function() {
  1569. return n.selfExecutor();
  1570. });
  1571. }
  1572. return t.prototype.hasRun = function() {
  1573. return this.didRun;
  1574. }, t.prototype.dispose = function() {
  1575. this.disposeCallback();
  1576. }, t.prototype.getValue = function() {
  1577. if (this.didRun || (this.dispose(), this.selfExecutor()), this.error)
  1578. throw this.error;
  1579. return this.value;
  1580. }, t;
  1581. }()
  1582. ), kn = /* @__PURE__ */ function() {
  1583. var t = function(e, n) {
  1584. return t = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(r, s) {
  1585. r.__proto__ = s;
  1586. } || function(r, s) {
  1587. for (var i in s) Object.prototype.hasOwnProperty.call(s, i) && (r[i] = s[i]);
  1588. }, t(e, n);
  1589. };
  1590. return function(e, n) {
  1591. if (typeof n != "function" && n !== null)
  1592. throw new TypeError("Class extends value " + String(n) + " is not a constructor or null");
  1593. t(e, n);
  1594. function r() {
  1595. this.constructor = e;
  1596. }
  1597. e.prototype = n === null ? Object.create(n) : (r.prototype = n.prototype, new r());
  1598. };
  1599. }(), Xr = function() {
  1600. return Xr = Object.assign || function(t) {
  1601. for (var e, n = 1, r = arguments.length; n < r; n++) {
  1602. e = arguments[n];
  1603. for (var s in e) Object.prototype.hasOwnProperty.call(e, s) && (t[s] = e[s]);
  1604. }
  1605. return t;
  1606. }, Xr.apply(this, arguments);
  1607. }, on = function(t, e, n) {
  1608. if (n || arguments.length === 2) for (var r = 0, s = e.length, i; r < s; r++)
  1609. (i || !(r in e)) && (i || (i = Array.prototype.slice.call(e, 0, r)), i[r] = e[r]);
  1610. return t.concat(i || Array.prototype.slice.call(e));
  1611. }, gf = 300, pr = Symbol("$$NOT_INSTANTIATED_SYMBOL"), pf = (
  1612. /** @class */
  1613. function(t) {
  1614. kn(e, t);
  1615. function e(n) {
  1616. return t.call(this, 'Detecting cyclic dependency. The last identifier is "'.concat(Et(n), '".')) || this;
  1617. }
  1618. return e;
  1619. }(at)
  1620. ), mf = (
  1621. /** @class */
  1622. function(t) {
  1623. kn(e, t);
  1624. function e() {
  1625. return t.call(this, "Injector cannot be accessed after it was disposed.") || this;
  1626. }
  1627. return e;
  1628. }(at)
  1629. ), _f = (
  1630. /** @class */
  1631. function(t) {
  1632. kn(e, t);
  1633. function e(n) {
  1634. return t.call(this, 'Async item "'.concat(Et(n), '" returns another async item.')) || this;
  1635. }
  1636. return e;
  1637. }(at)
  1638. ), Ef = (
  1639. /** @class */
  1640. function(t) {
  1641. kn(e, t);
  1642. function e(n) {
  1643. return t.call(this, 'Cannot get async item "'.concat(Et(n), '" from sync api.')) || this;
  1644. }
  1645. return e;
  1646. }(at)
  1647. ), Eo = (
  1648. /** @class */
  1649. function(t) {
  1650. kn(e, t);
  1651. function e(n) {
  1652. return t.call(this, 'Cannot add dependency "'.concat(Et(n), '" after it is already resolved.')) || this;
  1653. }
  1654. return e;
  1655. }(at)
  1656. ), Cf = (
  1657. /** @class */
  1658. function(t) {
  1659. kn(e, t);
  1660. function e(n) {
  1661. return t.call(this, 'Cannot dependency dependency "'.concat(Et(n), '" after it is already resolved.')) || this;
  1662. }
  1663. return e;
  1664. }(at)
  1665. ), Ot = (
  1666. /** @class */
  1667. function() {
  1668. function t(e, n) {
  1669. n === void 0 && (n = null), this.parent = n, this.children = [], this.resolutionOngoing = 0, this.disposingCallbacks = /* @__PURE__ */ new Set(), this.disposed = !1, this.dependencyCollection = new hf(e || []), this.resolvedDependencyCollection = new df(), n && n.children.push(this);
  1670. }
  1671. return t.prototype.onDispose = function(e) {
  1672. var n = this;
  1673. return this.disposingCallbacks.add(e), { dispose: function() {
  1674. return n.disposingCallbacks.delete(e);
  1675. } };
  1676. }, t.prototype.createChild = function(e) {
  1677. return this._ensureInjectorNotDisposed(), new t(e, this);
  1678. }, t.prototype.dispose = function() {
  1679. this.children.forEach(function(e) {
  1680. return e.dispose();
  1681. }), this.children.length = 0, this.dependencyCollection.dispose(), this.resolvedDependencyCollection.dispose(), this.deleteSelfFromParent(), this.disposed = !0, this.disposingCallbacks.forEach(function(e) {
  1682. return e();
  1683. }), this.disposingCallbacks.clear();
  1684. }, t.prototype.deleteSelfFromParent = function() {
  1685. if (this.parent) {
  1686. var e = this.parent.children.indexOf(this);
  1687. e > -1 && this.parent.children.splice(e, 1);
  1688. }
  1689. }, t.prototype.add = function(e) {
  1690. this._ensureInjectorNotDisposed();
  1691. var n = e[0], r = e[1];
  1692. if (this.resolvedDependencyCollection.has(n))
  1693. throw new Eo(n);
  1694. typeof r > "u" ? this.dependencyCollection.add(n) : co(r) || ao(r) || lo(r) || uo(r) ? this.dependencyCollection.add(n, r) : this.resolvedDependencyCollection.add(n, r);
  1695. }, t.prototype.replace = function(e) {
  1696. this._ensureInjectorNotDisposed();
  1697. var n = e[0];
  1698. if (this.resolvedDependencyCollection.has(n))
  1699. throw new Eo(n);
  1700. this.dependencyCollection.delete(n), e.length === 1 ? this.dependencyCollection.add(n) : this.dependencyCollection.add(n, e[1]);
  1701. }, t.prototype.delete = function(e) {
  1702. if (this._ensureInjectorNotDisposed(), this.resolvedDependencyCollection.has(e))
  1703. throw new Cf(e);
  1704. this.dependencyCollection.delete(e);
  1705. }, t.prototype.invoke = function(e) {
  1706. for (var n = this, r = [], s = 1; s < arguments.length; s++)
  1707. r[s - 1] = arguments[s];
  1708. this._ensureInjectorNotDisposed();
  1709. var i = {
  1710. get: function(o, a, u) {
  1711. return n._get(o, a, u);
  1712. },
  1713. has: function(o) {
  1714. return n.has(o);
  1715. }
  1716. };
  1717. return e.apply(void 0, on([i], r, !1));
  1718. }, t.prototype.has = function(e) {
  1719. var n;
  1720. return this.dependencyCollection.has(e) || ((n = this.parent) === null || n === void 0 ? void 0 : n.has(e)) || !1;
  1721. }, t.prototype.get = function(e, n, r) {
  1722. this._ensureInjectorNotDisposed();
  1723. var s = this._get(e, n, r);
  1724. if (Array.isArray(s) && s.some(function(i) {
  1725. return ys(i);
  1726. }) || ys(s))
  1727. throw new Ef(e);
  1728. return s;
  1729. }, t.prototype._get = function(e, n, r, s) {
  1730. var i = Ge.REQUIRED;
  1731. if (n === Ge.REQUIRED || n === Ge.OPTIONAL || n === Ge.MANY ? i = n : r = n, !s) {
  1732. var o = this.getValue(e, i, r);
  1733. if (o !== pr)
  1734. return o;
  1735. }
  1736. return this.createDependency(e, i, r, !s);
  1737. }, t.prototype.getAsync = function(e) {
  1738. this._ensureInjectorNotDisposed();
  1739. var n = this.getValue(e, Ge.REQUIRED);
  1740. if (n !== pr)
  1741. return Promise.resolve(n);
  1742. var r = this.createDependency(e, Ge.REQUIRED);
  1743. return ys(r) ? r.whenReady() : Promise.resolve(r);
  1744. }, t.prototype.createInstance = function(e) {
  1745. for (var n = [], r = 1; r < arguments.length; r++)
  1746. n[r - 1] = arguments[r];
  1747. return this._ensureInjectorNotDisposed(), this._resolveClassImpl.apply(this, on([{
  1748. useClass: e
  1749. }], n, !1));
  1750. }, t.prototype._resolveDependency = function(e, n, r) {
  1751. r === void 0 && (r = !0);
  1752. var s;
  1753. po(e);
  1754. try {
  1755. lo(n) ? s = this._resolveValueDependency(e, n) : uo(n) ? s = this._resolveFactory(e, n, r) : ao(n) ? s = this._resolveClass(e, n, r) : Vd(n) ? s = this._resolveExisting(e, n) : s = this._resolveAsync(e, n), mo();
  1756. } catch (i) {
  1757. throw mo(), i;
  1758. }
  1759. return s;
  1760. }, t.prototype._resolveExisting = function(e, n) {
  1761. var r = this.get(n.useExisting);
  1762. return this.resolvedDependencyCollection.add(e, r), r;
  1763. }, t.prototype._resolveValueDependency = function(e, n) {
  1764. var r = n.useValue;
  1765. return this.resolvedDependencyCollection.add(e, r), r;
  1766. }, t.prototype._resolveClass = function(e, n, r) {
  1767. var s = this;
  1768. r === void 0 && (r = !0);
  1769. var i;
  1770. if (n.lazy) {
  1771. var o = new ff(function() {
  1772. return s._ensureInjectorNotDisposed(), s._resolveClassImpl(n);
  1773. });
  1774. i = new Proxy(/* @__PURE__ */ Object.create(null), {
  1775. get: function(a, u) {
  1776. if (u in a)
  1777. return a[u];
  1778. if (u !== "whenReady") {
  1779. var c = o.getValue(), l = c[u];
  1780. return typeof l != "function" || (l = l.bind(c), a[u] = l), l;
  1781. }
  1782. },
  1783. set: function(a, u, c) {
  1784. return o.getValue()[u] = c, !0;
  1785. }
  1786. });
  1787. } else
  1788. i = this._resolveClassImpl(n);
  1789. return e && r && this.resolvedDependencyCollection.add(e, i), i;
  1790. }, t.prototype._resolveClassImpl = function(e) {
  1791. for (var n, r = [], s = 1; s < arguments.length; s++)
  1792. r[s - 1] = arguments[s];
  1793. var i = e.useClass;
  1794. this.markNewResolution(i);
  1795. for (var o = cu(i).sort(function(O, U) {
  1796. return O.paramIndex - U.paramIndex;
  1797. }).map(function(O) {
  1798. return Xr(Xr({}, O), { identifier: uf(O.identifier) });
  1799. }), a = [], u = 0, c = o; u < c.length; u++) {
  1800. var l = c[u];
  1801. try {
  1802. var h = this._get(l.identifier, l.quantity, l.lookUp, l.withNew);
  1803. a.push(h);
  1804. } catch (O) {
  1805. throw O instanceof Ur || O instanceof Hs && O.actual === 0 ? new _o(i, l.identifier, l.paramIndex) : O;
  1806. }
  1807. }
  1808. var d = on([], r, !0), f = o.length > 0 ? o[0].paramIndex : d.length;
  1809. if (d.length !== f) {
  1810. console.warn("[redi]: Expect ".concat(f, " custom parameter(s) of ").concat(Et(i), " but get ").concat(d.length, "."));
  1811. var E = f - d.length;
  1812. E > 0 ? d = on(on([], d, !0), Array.from({ length: E }).fill(void 0), !0) : d = d.slice(0, f);
  1813. }
  1814. var R = new (i.bind.apply(i, on(on([void 0], d, !1), a, !1)))();
  1815. return (n = e == null ? void 0 : e.onInstantiation) === null || n === void 0 || n.call(e, R), this.markResolutionCompleted(), R;
  1816. }, t.prototype._resolveFactory = function(e, n, r) {
  1817. var s;
  1818. this.markNewResolution(e);
  1819. for (var i = du(n.deps), o = [], a = 0, u = i; a < u.length; a++) {
  1820. var c = u[a];
  1821. try {
  1822. var l = this._get(c.identifier, c.quantity, c.lookUp, c.withNew);
  1823. o.push(l);
  1824. } catch (d) {
  1825. throw d instanceof Ur || d instanceof Hs && d.actual === 0 ? new _o(e, c.identifier, c.paramIndex) : d;
  1826. }
  1827. }
  1828. var h = n.useFactory.apply(null, o);
  1829. return r && this.resolvedDependencyCollection.add(e, h), this.markResolutionCompleted(), (s = n == null ? void 0 : n.onInstantiation) === null || s === void 0 || s.call(n, h), h;
  1830. }, t.prototype._resolveAsync = function(e, n) {
  1831. var r = this, s = {
  1832. __symbol: au,
  1833. whenReady: function() {
  1834. return r._resolveAsyncImpl(e, n);
  1835. }
  1836. };
  1837. return s;
  1838. }, t.prototype._resolveAsyncImpl = function(e, n) {
  1839. var r = this;
  1840. return n.useAsync().then(function(s) {
  1841. var i = r.getValue(e);
  1842. if (i !== pr)
  1843. return i;
  1844. var o;
  1845. if (Array.isArray(s)) {
  1846. var a = s[1];
  1847. if (co(a))
  1848. throw new _f(e);
  1849. o = r._resolveDependency(e, a);
  1850. } else ou(s) ? o = r._resolveClassImpl({
  1851. useClass: s,
  1852. onInstantiation: n.onInstantiation
  1853. }) : o = s;
  1854. return r.resolvedDependencyCollection.add(e, o), o;
  1855. });
  1856. }, t.prototype.getValue = function(e, n, r) {
  1857. var s = this;
  1858. n === void 0 && (n = Ge.REQUIRED);
  1859. var i = function() {
  1860. return s.dependencyCollection.has(e) && !s.resolvedDependencyCollection.has(e) ? pr : s.resolvedDependencyCollection.get(e, n);
  1861. }, o = function() {
  1862. return s.parent ? s.parent.getValue(e, n) : (Ni(e, n, 0), n === Ge.MANY ? [] : null);
  1863. };
  1864. return r === $t.SKIP_SELF ? o() : e === t ? this : r === $t.SELF || this.resolvedDependencyCollection.has(e) || this.dependencyCollection.has(e) ? i() : o();
  1865. }, t.prototype.createDependency = function(e, n, r, s) {
  1866. var i = this;
  1867. n === void 0 && (n = Ge.REQUIRED), s === void 0 && (s = !0);
  1868. var o = function() {
  1869. var u = i.dependencyCollection.get(e, n), c = null;
  1870. return Array.isArray(u) ? c = u.map(function(l) {
  1871. return i._resolveDependency(e, l, s);
  1872. }) : u && (c = i._resolveDependency(e, u, s)), c;
  1873. }, a = function() {
  1874. if (i.parent)
  1875. return i.parent.createDependency(e, n, void 0, s);
  1876. if (n === Ge.OPTIONAL)
  1877. return null;
  1878. throw po(e), new Ur(e);
  1879. };
  1880. return r === $t.SKIP_SELF ? a() : this.dependencyCollection.has(e) ? o() : a();
  1881. }, t.prototype.markNewResolution = function(e) {
  1882. if (this.resolutionOngoing += 1, this.resolutionOngoing >= gf)
  1883. throw new pf(e);
  1884. }, t.prototype.markResolutionCompleted = function() {
  1885. this.resolutionOngoing -= 1;
  1886. }, t.prototype._ensureInjectorNotDisposed = function() {
  1887. if (this.disposed)
  1888. throw new mf();
  1889. }, t;
  1890. }()
  1891. ), Co = typeof globalThis < "u" && globalThis || typeof window < "u" && window || typeof global < "u" && global, Ro = "REDI_GLOBAL_LOCK", Rf = typeof process < "u" && process.versions != null && process.versions.node != null;
  1892. Co[Ro] ? Rf || console.error(`[redi]: You are loading scripts of redi more than once! This may cause undesired behavior in your application.
  1893. Maybe your dependencies added redi as its dependency and bundled redi to its dist files. Or you import different versions of redi.
  1894. For more info please visit our website: https://redi.wendell.fun/en-US/docs/debug#import-scripts-of-redi-more-than-once`) : Co[Ro] = !0;
  1895. var Io = "REDI_CONTEXT_LOCK", If = typeof process < "u" && process.versions != null && process.versions.node != null, vo = typeof globalThis < "u" && globalThis || typeof window < "u" && window || typeof global < "u" && global;
  1896. vo[Io] ? If || console.error(`[redi]: "RediContext" is already created. You may import "RediContext" from different paths. Use "import { RediContext } from '@wendellhu/redi/react-bindings'; instead."`) : vo[Io] = !0;
  1897. var ds = St.createContext({
  1898. injector: null
  1899. });
  1900. ds.displayName = "RediContext";
  1901. var gu = ds.Provider, vf = ds.Consumer, Jr = function() {
  1902. return Jr = Object.assign || function(t) {
  1903. for (var e, n = 1, r = arguments.length; n < r; n++) {
  1904. e = arguments[n];
  1905. for (var s in e) Object.prototype.hasOwnProperty.call(e, s) && (t[s] = e[s]);
  1906. }
  1907. return t;
  1908. }, Jr.apply(this, arguments);
  1909. };
  1910. function yf(t) {
  1911. var e = t.children, n = t.dependencies, r = St.useRef(null);
  1912. return St.useEffect(function() {
  1913. return function() {
  1914. var s;
  1915. return (s = r.current) === null || s === void 0 ? void 0 : s.dispose();
  1916. };
  1917. }, []), St.createElement(vf, null, function(s) {
  1918. var i;
  1919. return r.current ? i = r.current : (i = s.injector ? s.injector.createChild(n) : new Ot(n), r.current = i), St.createElement(gu, { value: { injector: i } }, e);
  1920. });
  1921. }
  1922. function B0(t, e) {
  1923. return function(r) {
  1924. return St.createElement(
  1925. gu,
  1926. { value: { injector: e } },
  1927. St.createElement(t, Jr({}, r))
  1928. );
  1929. };
  1930. }
  1931. function j0(t, e) {
  1932. return function(r) {
  1933. return St.createElement(
  1934. yf,
  1935. { dependencies: e },
  1936. St.createElement(t, Jr({}, r))
  1937. );
  1938. };
  1939. }
  1940. var wf = /* @__PURE__ */ function() {
  1941. var t = function(e, n) {
  1942. return t = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(r, s) {
  1943. r.__proto__ = s;
  1944. } || function(r, s) {
  1945. for (var i in s) Object.prototype.hasOwnProperty.call(s, i) && (r[i] = s[i]);
  1946. }, t(e, n);
  1947. };
  1948. return function(e, n) {
  1949. if (typeof n != "function" && n !== null)
  1950. throw new TypeError("Class extends value " + String(n) + " is not a constructor or null");
  1951. t(e, n);
  1952. function r() {
  1953. this.constructor = e;
  1954. }
  1955. e.prototype = n === null ? Object.create(n) : (r.prototype = n.prototype, new r());
  1956. };
  1957. }(), Of = (
  1958. /** @class */
  1959. function(t) {
  1960. wf(e, t);
  1961. function e(n) {
  1962. return t.call(this, 'You should make "RediContext" as '.concat(n.constructor.name, "'s default context type. ") + "If you want to use multiple context, please check this on React doc site. https://reactjs.org/docs/context.html#classcontexttype") || this;
  1963. }
  1964. return e;
  1965. }(at)
  1966. );
  1967. function H0(t, e, n) {
  1968. return function() {
  1969. return {
  1970. get: function() {
  1971. var r = this, s = r.context;
  1972. if (!s || !s.injector)
  1973. throw new Of(r);
  1974. var i = s.injector, o = i.get(t, e || Ge.REQUIRED, n);
  1975. return o;
  1976. }
  1977. };
  1978. };
  1979. }
  1980. var bf = /* @__PURE__ */ function() {
  1981. var t = function(e, n) {
  1982. return t = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(r, s) {
  1983. r.__proto__ = s;
  1984. } || function(r, s) {
  1985. for (var i in s) Object.prototype.hasOwnProperty.call(s, i) && (r[i] = s[i]);
  1986. }, t(e, n);
  1987. };
  1988. return function(e, n) {
  1989. if (typeof n != "function" && n !== null)
  1990. throw new TypeError("Class extends value " + String(n) + " is not a constructor or null");
  1991. t(e, n);
  1992. function r() {
  1993. this.constructor = e;
  1994. }
  1995. e.prototype = n === null ? Object.create(n) : (r.prototype = n.prototype, new r());
  1996. };
  1997. }(), Sf = (
  1998. /** @class */
  1999. function(t) {
  2000. bf(e, t);
  2001. function e() {
  2002. return t.call(this, "Using dependency injection outside of a RediContext.") || this;
  2003. }
  2004. return e;
  2005. }(at)
  2006. );
  2007. function Af() {
  2008. var t = St.useContext(ds);
  2009. if (!t.injector)
  2010. throw new Sf();
  2011. return t.injector;
  2012. }
  2013. function W0(t, e, n) {
  2014. var r = Af();
  2015. return St.useMemo(function() {
  2016. return r.get(t, e, n);
  2017. }, [t, e, n]);
  2018. }
  2019. var Nf = function(t, e, n) {
  2020. if (n || arguments.length === 2) for (var r = 0, s = e.length, i; r < s; r++)
  2021. (i || !(r in e)) && (i || (i = Array.prototype.slice.call(e, 0, r)), i[r] = e[r]);
  2022. return t.concat(i || Array.prototype.slice.call(e));
  2023. };
  2024. function Tf(t, e) {
  2025. var n = t instanceof lt && typeof e > "u" ? t.getValue() : e, r = _i(n), s = r[0], i = r[1];
  2026. return Ei(function() {
  2027. var o = t.subscribe(function(a) {
  2028. return i(a);
  2029. });
  2030. return function() {
  2031. return o.unsubscribe();
  2032. };
  2033. }, [t]), s;
  2034. }
  2035. function yo(t) {
  2036. return typeof t == "function" ? t() : t;
  2037. }
  2038. function z0(t, e, n, r) {
  2039. if (typeof t == "function" && !r)
  2040. throw new at("Expected deps to be provided when observable is a function!");
  2041. var s = Lr(null), i = Lr(!1), o = Ua(function() {
  2042. return t;
  2043. }, Nf([], typeof r < "u" ? r : [t], !0)), a = _i(0);
  2044. a[0];
  2045. var u = a[1], c = Lr(function() {
  2046. var l;
  2047. if (o) {
  2048. var h = yo(o).subscribe(function(d) {
  2049. i.current = !0, l = d;
  2050. });
  2051. h.unsubscribe();
  2052. }
  2053. return l != null ? l : e;
  2054. }());
  2055. if (Ei(function() {
  2056. var l = null;
  2057. return o && (s.current = yo(o), l = s.current.subscribe(function(h) {
  2058. c.current = h, u(function(d) {
  2059. return d + 1;
  2060. });
  2061. })), function() {
  2062. return l == null ? void 0 : l.unsubscribe();
  2063. };
  2064. }, [o]), n && !i.current)
  2065. throw new Error("Expect `shouldHaveSyncValue` but not getting a sync value!");
  2066. return c.current;
  2067. }
  2068. function Y0(t) {
  2069. var e = _i(0), n = e[1];
  2070. Ei(function() {
  2071. var r = t.subscribe(function() {
  2072. return n(function(s) {
  2073. return s + 1;
  2074. });
  2075. });
  2076. return function() {
  2077. return r.unsubscribe();
  2078. };
  2079. }, []);
  2080. }
  2081. var zs = /* @__PURE__ */ new WeakMap();
  2082. function V0(t, e) {
  2083. var n = Lr(void 0), r = Tf(t, e), s = Ua(function() {
  2084. return Fl(r);
  2085. }, [t]), i = $l(function(o) {
  2086. return kl.createElement(s.Provider, { value: r }, o.children);
  2087. }, [t, r]);
  2088. return n.current !== t && (n.current && zs.delete(n.current), n.current = t, zs.set(t, s)), {
  2089. Provider: i,
  2090. value: r
  2091. };
  2092. }
  2093. function G0(t) {
  2094. var e = zs.get(t);
  2095. if (!e)
  2096. throw new at("try to read context value but no ancestor component subscribed it.");
  2097. return Bl(e);
  2098. }
  2099. function K0(t, e) {
  2100. e.forEach((n) => t.add(n));
  2101. }
  2102. function Mf(t, e) {
  2103. e.forEach(([n]) => {
  2104. t.has(n) && t.get(n);
  2105. });
  2106. }
  2107. function Df(t, e) {
  2108. if (Object.is(t, e))
  2109. return !0;
  2110. if (typeof t != "object" || !t || typeof e != "object" || !e)
  2111. return !1;
  2112. const n = Object.keys(t), r = Object.keys(e);
  2113. if (n.length !== r.length)
  2114. return !1;
  2115. const s = Object.prototype.hasOwnProperty.bind(e);
  2116. for (let i = 0; i < n.length; i++) {
  2117. const o = n[i];
  2118. if (!s(o))
  2119. return !1;
  2120. const a = t[o], u = e[o];
  2121. if (a !== u)
  2122. return !1;
  2123. }
  2124. return !0;
  2125. }
  2126. class wo extends Error {
  2127. constructor(e) {
  2128. super(e), this.name = "CustomCommandExecutionError";
  2129. }
  2130. }
  2131. class xf extends Error {
  2132. constructor() {
  2133. super("Canceled by facade"), this.name = "CanceledError";
  2134. }
  2135. }
  2136. async function Lf(t) {
  2137. for (const [e, n] of t.entries())
  2138. try {
  2139. if (!await n())
  2140. return {
  2141. index: e,
  2142. result: !1
  2143. };
  2144. } catch (r) {
  2145. return {
  2146. index: e,
  2147. result: !1,
  2148. error: r
  2149. };
  2150. }
  2151. return {
  2152. result: !0,
  2153. index: -1
  2154. };
  2155. }
  2156. function Uf(t) {
  2157. for (const [e, n] of t.entries())
  2158. try {
  2159. if (!n())
  2160. return {
  2161. index: e,
  2162. result: !1
  2163. };
  2164. } catch (r) {
  2165. return {
  2166. index: e,
  2167. result: !1,
  2168. error: r
  2169. };
  2170. }
  2171. return {
  2172. result: !0,
  2173. index: -1
  2174. };
  2175. }
  2176. function Oo(t) {
  2177. var e = typeof Symbol == "function" && Symbol.iterator, n = e && t[e], r = 0;
  2178. if (n) return n.call(t);
  2179. if (t && typeof t.length == "number") return {
  2180. next: function() {
  2181. return t && r >= t.length && (t = void 0), { value: t && t[r++], done: !t };
  2182. }
  2183. };
  2184. throw new TypeError(e ? "Object is not iterable." : "Symbol.iterator is not defined.");
  2185. }
  2186. function bo(t, e) {
  2187. var n = typeof Symbol == "function" && t[Symbol.iterator];
  2188. if (!n) return t;
  2189. var r = n.call(t), s, i = [], o;
  2190. try {
  2191. for (; (e === void 0 || e-- > 0) && !(s = r.next()).done; ) i.push(s.value);
  2192. } catch (a) {
  2193. o = { error: a };
  2194. } finally {
  2195. try {
  2196. s && !s.done && (n = r.return) && n.call(r);
  2197. } finally {
  2198. if (o) throw o.error;
  2199. }
  2200. }
  2201. return i;
  2202. }
  2203. function So(t, e, n) {
  2204. if (n || arguments.length === 2) for (var r = 0, s = e.length, i; r < s; r++)
  2205. (i || !(r in e)) && (i || (i = Array.prototype.slice.call(e, 0, r)), i[r] = e[r]);
  2206. return t.concat(i || Array.prototype.slice.call(e));
  2207. }
  2208. function Zn(t) {
  2209. return typeof t == "function";
  2210. }
  2211. function Pf(t) {
  2212. var e = function(r) {
  2213. Error.call(r), r.stack = new Error().stack;
  2214. }, n = t(e);
  2215. return n.prototype = Object.create(Error.prototype), n.prototype.constructor = n, n;
  2216. }
  2217. var ws = Pf(function(t) {
  2218. return function(n) {
  2219. t(this), this.message = n ? n.length + ` errors occurred during unsubscription:
  2220. ` + n.map(function(r, s) {
  2221. return s + 1 + ") " + r.toString();
  2222. }).join(`
  2223. `) : "", this.name = "UnsubscriptionError", this.errors = n;
  2224. };
  2225. });
  2226. function Ao(t, e) {
  2227. if (t) {
  2228. var n = t.indexOf(e);
  2229. 0 <= n && t.splice(n, 1);
  2230. }
  2231. }
  2232. var pu = function() {
  2233. function t(e) {
  2234. this.initialTeardown = e, this.closed = !1, this._parentage = null, this._finalizers = null;
  2235. }
  2236. return t.prototype.unsubscribe = function() {
  2237. var e, n, r, s, i;
  2238. if (!this.closed) {
  2239. this.closed = !0;
  2240. var o = this._parentage;
  2241. if (o)
  2242. if (this._parentage = null, Array.isArray(o))
  2243. try {
  2244. for (var a = Oo(o), u = a.next(); !u.done; u = a.next()) {
  2245. var c = u.value;
  2246. c.remove(this);
  2247. }
  2248. } catch (R) {
  2249. e = { error: R };
  2250. } finally {
  2251. try {
  2252. u && !u.done && (n = a.return) && n.call(a);
  2253. } finally {
  2254. if (e) throw e.error;
  2255. }
  2256. }
  2257. else
  2258. o.remove(this);
  2259. var l = this.initialTeardown;
  2260. if (Zn(l))
  2261. try {
  2262. l();
  2263. } catch (R) {
  2264. i = R instanceof ws ? R.errors : [R];
  2265. }
  2266. var h = this._finalizers;
  2267. if (h) {
  2268. this._finalizers = null;
  2269. try {
  2270. for (var d = Oo(h), f = d.next(); !f.done; f = d.next()) {
  2271. var E = f.value;
  2272. try {
  2273. No(E);
  2274. } catch (R) {
  2275. i = i != null ? i : [], R instanceof ws ? i = So(So([], bo(i)), bo(R.errors)) : i.push(R);
  2276. }
  2277. }
  2278. } catch (R) {
  2279. r = { error: R };
  2280. } finally {
  2281. try {
  2282. f && !f.done && (s = d.return) && s.call(d);
  2283. } finally {
  2284. if (r) throw r.error;
  2285. }
  2286. }
  2287. }
  2288. if (i)
  2289. throw new ws(i);
  2290. }
  2291. }, t.prototype.add = function(e) {
  2292. var n;
  2293. if (e && e !== this)
  2294. if (this.closed)
  2295. No(e);
  2296. else {
  2297. if (e instanceof t) {
  2298. if (e.closed || e._hasParent(this))
  2299. return;
  2300. e._addParent(this);
  2301. }
  2302. (this._finalizers = (n = this._finalizers) !== null && n !== void 0 ? n : []).push(e);
  2303. }
  2304. }, t.prototype._hasParent = function(e) {
  2305. var n = this._parentage;
  2306. return n === e || Array.isArray(n) && n.includes(e);
  2307. }, t.prototype._addParent = function(e) {
  2308. var n = this._parentage;
  2309. this._parentage = Array.isArray(n) ? (n.push(e), n) : n ? [n, e] : e;
  2310. }, t.prototype._removeParent = function(e) {
  2311. var n = this._parentage;
  2312. n === e ? this._parentage = null : Array.isArray(n) && Ao(n, e);
  2313. }, t.prototype.remove = function(e) {
  2314. var n = this._finalizers;
  2315. n && Ao(n, e), e instanceof t && e._removeParent(this);
  2316. }, t.EMPTY = function() {
  2317. var e = new t();
  2318. return e.closed = !0, e;
  2319. }(), t;
  2320. }();
  2321. pu.EMPTY;
  2322. function kf(t) {
  2323. return t instanceof pu || t && "closed" in t && Zn(t.remove) && Zn(t.add) && Zn(t.unsubscribe);
  2324. }
  2325. function No(t) {
  2326. Zn(t) ? t() : t.unsubscribe();
  2327. }
  2328. function Ze(t) {
  2329. let e = !1;
  2330. return t ? kf(t) ? {
  2331. dispose: () => t.unsubscribe()
  2332. } : typeof t == "function" ? {
  2333. dispose: () => {
  2334. e || (e = !0, t());
  2335. }
  2336. } : t : Ze(() => {
  2337. });
  2338. }
  2339. function X0(t) {
  2340. return Ze(() => {
  2341. t.unsubscribe();
  2342. });
  2343. }
  2344. class Mi {
  2345. constructor() {
  2346. C(this, "_disposables", /* @__PURE__ */ new Set());
  2347. }
  2348. add(e) {
  2349. const n = Ze(e);
  2350. return this._disposables.add(n), {
  2351. dispose: (r = !1) => {
  2352. r || n.dispose(), this._disposables.delete(n);
  2353. }
  2354. };
  2355. }
  2356. dispose() {
  2357. this._disposables.forEach((e) => {
  2358. e.dispose();
  2359. }), this._disposables.clear();
  2360. }
  2361. }
  2362. class nt {
  2363. constructor() {
  2364. C(this, "_disposed", !1);
  2365. C(this, "_collection", new Mi());
  2366. }
  2367. disposeWithMe(e) {
  2368. return this._collection.add(e);
  2369. }
  2370. ensureNotDisposed() {
  2371. if (this._disposed)
  2372. throw new Error("[Disposable]: object is disposed!");
  2373. }
  2374. dispose() {
  2375. this._disposed || (this._disposed = !0, this._collection.dispose());
  2376. }
  2377. }
  2378. class J0 extends nt {
  2379. constructor() {
  2380. super(...arguments);
  2381. C(this, "dispose$", new _t());
  2382. }
  2383. dispose() {
  2384. super.dispose(), this.dispose$.next(), this.dispose$.complete();
  2385. }
  2386. }
  2387. class Z0 extends nt {
  2388. constructor(n) {
  2389. super();
  2390. C(this, "_ref", 0);
  2391. this._rootDisposable = n;
  2392. }
  2393. inc() {
  2394. if (this._disposed)
  2395. throw new Error("[RCDisposable]: should not ref to a disposed.");
  2396. this._ref += 1;
  2397. }
  2398. dec() {
  2399. this._ref -= 1, this._ref === 0 && (this._rootDisposable.dispose(), this.dispose());
  2400. }
  2401. }
  2402. const fs = Ct("univer.context-service");
  2403. class Ff extends nt {
  2404. constructor() {
  2405. super(...arguments);
  2406. C(this, "_contextChanged$", new _t());
  2407. C(this, "contextChanged$", this._contextChanged$.asObservable());
  2408. C(this, "_contextMap", /* @__PURE__ */ new Map());
  2409. }
  2410. dispose() {
  2411. super.dispose(), this._contextChanged$.complete();
  2412. }
  2413. getContextValue(n) {
  2414. var r;
  2415. return (r = this._contextMap.get(n)) != null ? r : !1;
  2416. }
  2417. setContextValue(n, r) {
  2418. this._contextMap.set(n, r), this._contextChanged$.next({ [n]: r });
  2419. }
  2420. subscribeContextValue$(n) {
  2421. return new sr((r) => {
  2422. const s = this._contextChanged$.pipe(Kt((i) => typeof i[n] < "u")).subscribe((i) => r.next(i[n]));
  2423. return this._contextMap.has(n) && r.next(this._contextMap.get(n)), () => s.unsubscribe();
  2424. });
  2425. }
  2426. }
  2427. var $f = /* @__PURE__ */ ((t) => (t[t.SILENT = 0] = "SILENT", t[t.ERROR = 1] = "ERROR", t[t.WARN = 2] = "WARN", t[t.INFO = 3] = "INFO", t[t.VERBOSE = 4] = "VERBOSE", t))($f || {});
  2428. const Mt = Ct("univer.log");
  2429. class Bf extends nt {
  2430. constructor() {
  2431. super(...arguments);
  2432. C(this, "_logLevel", 3);
  2433. }
  2434. debug(...n) {
  2435. this._logLevel >= 4 && this._log(console.debug, ...n);
  2436. }
  2437. log(...n) {
  2438. this._logLevel >= 3 && this._log(console.log, ...n);
  2439. }
  2440. warn(...n) {
  2441. this._logLevel >= 2 && this._log(console.warn, ...n);
  2442. }
  2443. error(...n) {
  2444. this._logLevel >= 1 && this._log(console.error, ...n);
  2445. }
  2446. setLogLevel(n) {
  2447. this._logLevel = n;
  2448. }
  2449. _log(n, ...r) {
  2450. const s = r[0];
  2451. /^\[(.*?)\]/g.test(s) ? n(`\x1B[97;104m${s}\x1B[0m`, ...r.slice(1)) : n(...r);
  2452. }
  2453. }
  2454. var jf = Object.defineProperty, Hf = Object.getOwnPropertyDescriptor, Wf = (t, e, n, r) => {
  2455. for (var s = r > 1 ? void 0 : r ? Hf(e, n) : e, i = t.length - 1, o; i >= 0; i--)
  2456. (o = t[i]) && (s = (r ? o(e, n, s) : o(s)) || s);
  2457. return r && s && jf(e, n, s), s;
  2458. }, To = (t, e) => (n, r) => e(n, r, t), ar = /* @__PURE__ */ ((t) => (t[t.COMMAND = 0] = "COMMAND", t[t.OPERATION = 1] = "OPERATION", t[t.MUTATION = 2] = "MUTATION", t))(ar || {});
  2459. const Pt = Ct("anywhere.command-service");
  2460. class zf {
  2461. constructor() {
  2462. C(this, "_commands", /* @__PURE__ */ new Map());
  2463. C(this, "_commandTypes", /* @__PURE__ */ new Map());
  2464. }
  2465. registerCommand(e) {
  2466. if (this._commands.has(e.id))
  2467. throw new Error(`[CommandRegistry]: command "${e.id}" has been registered before.`);
  2468. return this._commands.set(e.id, e), this._commandTypes.set(e.id, e.type), Ze(() => {
  2469. this._commands.delete(e.id), this._commandTypes.delete(e.id);
  2470. });
  2471. }
  2472. hasCommand(e) {
  2473. return this._commands.has(e);
  2474. }
  2475. getCommand(e) {
  2476. return this._commands.has(e) ? [this._commands.get(e)] : null;
  2477. }
  2478. getCommandType(e) {
  2479. return this._commandTypes.get(e);
  2480. }
  2481. }
  2482. const Yf = {
  2483. id: "nil",
  2484. type: 0,
  2485. handler: () => !0
  2486. };
  2487. let Ys = class extends nt {
  2488. constructor(e, n) {
  2489. super();
  2490. C(this, "_commandRegistry");
  2491. C(this, "_beforeCommandExecutionListeners", []);
  2492. C(this, "_commandExecutedListeners", []);
  2493. C(this, "_multiCommandDisposables", /* @__PURE__ */ new Map());
  2494. C(this, "_commandExecutingLevel", 0);
  2495. C(this, "_commandExecutionStack", []);
  2496. this._injector = e, this._logService = n, this._commandRegistry = new zf(), this._registerCommand(Yf);
  2497. }
  2498. dispose() {
  2499. super.dispose(), this._commandExecutedListeners.length = 0, this._beforeCommandExecutionListeners.length = 0;
  2500. }
  2501. hasCommand(e) {
  2502. return this._commandRegistry.hasCommand(e);
  2503. }
  2504. registerCommand(e) {
  2505. return this._registerCommand(e);
  2506. }
  2507. registerMultipleCommand(e) {
  2508. return this._registerMultiCommand(e);
  2509. }
  2510. beforeCommandExecuted(e) {
  2511. if (this._beforeCommandExecutionListeners.indexOf(e) === -1)
  2512. return this._beforeCommandExecutionListeners.push(e), Ze(() => {
  2513. const n = this._beforeCommandExecutionListeners.indexOf(e);
  2514. this._beforeCommandExecutionListeners.splice(n, 1);
  2515. });
  2516. throw new Error("[CommandService]: could not add a listener twice.");
  2517. }
  2518. onCommandExecuted(e) {
  2519. if (this._commandExecutedListeners.indexOf(e) === -1)
  2520. return this._commandExecutedListeners.push(e), Ze(() => {
  2521. const n = this._commandExecutedListeners.indexOf(e);
  2522. this._commandExecutedListeners.splice(n, 1);
  2523. });
  2524. throw new Error("[CommandService]: could not add a listener twice.");
  2525. }
  2526. async executeCommand(e, n, r) {
  2527. try {
  2528. const s = this._commandRegistry.getCommand(e);
  2529. if (s) {
  2530. const [i] = s, o = {
  2531. id: i.id,
  2532. type: i.type,
  2533. params: n
  2534. }, a = this._pushCommandExecutionStack(o);
  2535. this._beforeCommandExecutionListeners.forEach((c) => c(o, r));
  2536. const u = await this._execute(i, n, r);
  2537. return this._commandExecutedListeners.forEach((c) => c(o, r)), a.dispose(), u;
  2538. }
  2539. throw new Error(`[CommandService]: command "${e}" is not registered.`);
  2540. } catch (s) {
  2541. if (s instanceof wo)
  2542. return !1;
  2543. throw s;
  2544. }
  2545. }
  2546. syncExecuteCommand(e, n, r) {
  2547. var s;
  2548. try {
  2549. const i = this._commandRegistry.getCommand(e);
  2550. if (i) {
  2551. const [o] = i, a = {
  2552. id: o.id,
  2553. type: o.type,
  2554. params: n
  2555. };
  2556. if (o.type === 2) {
  2557. const l = jd(
  2558. this._commandExecutionStack,
  2559. (h) => h.type === 0
  2560. /* COMMAND */
  2561. );
  2562. l && (a.params = (s = a.params) != null ? s : {}, a.params.trigger = l.id);
  2563. }
  2564. const u = this._pushCommandExecutionStack(a);
  2565. this._beforeCommandExecutionListeners.forEach((l) => l(a, r));
  2566. const c = this._syncExecute(o, n, r);
  2567. return this._commandExecutedListeners.forEach((l) => l(a, r)), u.dispose(), c;
  2568. }
  2569. throw new Error(`[CommandService]: command "${e}" is not registered.`);
  2570. } catch (i) {
  2571. if (i instanceof wo)
  2572. return !1;
  2573. throw i;
  2574. }
  2575. }
  2576. _pushCommandExecutionStack(e) {
  2577. return this._commandExecutionStack.push(e), Ze(() => cs(this._commandExecutionStack, e));
  2578. }
  2579. _registerCommand(e) {
  2580. return this._commandRegistry.registerCommand(e);
  2581. }
  2582. _registerMultiCommand(e) {
  2583. const n = this._commandRegistry.getCommand(e.id);
  2584. let r;
  2585. if (n) {
  2586. if (n[0].multi !== !0)
  2587. throw new Error("Command has registered as a single command.");
  2588. r = n[0];
  2589. } else {
  2590. const i = new Mi();
  2591. r = new Vf(e.id), i.add(this._commandRegistry.registerCommand(r)), i.add(
  2592. Ze(() => {
  2593. this._multiCommandDisposables.delete(e.id);
  2594. })
  2595. ), this._multiCommandDisposables.set(e.id, i);
  2596. }
  2597. const s = r.registerImplementation(e);
  2598. return Ze(() => {
  2599. var i;
  2600. s.dispose(), r.hasImplementations() || (i = this._multiCommandDisposables.get(e.id)) == null || i.dispose();
  2601. });
  2602. }
  2603. async _execute(e, n, r) {
  2604. this._logService.debug(
  2605. "[CommandService]",
  2606. `${"|-".repeat(Math.max(this._commandExecutingLevel, 0))}executing command "${e.id}"`
  2607. ), this._commandExecutingLevel++;
  2608. let s;
  2609. try {
  2610. s = await this._injector.invoke(e.handler, n, r), this._commandExecutingLevel--;
  2611. } catch (i) {
  2612. throw s = !1, this._commandExecutingLevel = 0, i;
  2613. }
  2614. return s;
  2615. }
  2616. _syncExecute(e, n, r) {
  2617. this._logService.debug(
  2618. "[CommandService]",
  2619. `${"|-".repeat(Math.max(0, this._commandExecutingLevel))}executing command "${e.id}".`
  2620. ), this._commandExecutingLevel++;
  2621. let s;
  2622. try {
  2623. if (s = this._injector.invoke(e.handler, n, r), s instanceof Promise)
  2624. throw new TypeError("[CommandService]: Command handler should not return a promise.");
  2625. this._commandExecutingLevel--;
  2626. } catch (i) {
  2627. throw s = !1, this._commandExecutingLevel = 0, i;
  2628. }
  2629. return s;
  2630. }
  2631. };
  2632. Ys = Wf([
  2633. To(0, ot(Ot)),
  2634. To(1, Mt)
  2635. ], Ys);
  2636. class Vf {
  2637. constructor(e) {
  2638. C(this, "name");
  2639. C(this, "multi", !0);
  2640. C(this, "type", 0);
  2641. C(this, "priority", 0);
  2642. C(this, "_implementations", []);
  2643. C(this, "handler", async (e, n) => {
  2644. if (!this._implementations.length)
  2645. return !1;
  2646. const r = e.get(Mt), s = e.get(fs), i = e.get(Ot);
  2647. for (const o of this._implementations) {
  2648. const a = o.command.preconditions;
  2649. if ((!a || a && a(s)) && (r.debug("[MultiCommand]", `executing implementation "${o.command.name}".`), await i.invoke(o.command.handler, n)))
  2650. return !0;
  2651. }
  2652. return !1;
  2653. });
  2654. this.id = e, this.name = e;
  2655. }
  2656. registerImplementation(e) {
  2657. const n = { command: e };
  2658. return this._implementations.push(n), this._implementations.sort((r, s) => s.command.priority - r.command.priority), Ze(() => {
  2659. const r = this._implementations.indexOf(n);
  2660. this._implementations.splice(r, 1);
  2661. });
  2662. }
  2663. hasImplementations() {
  2664. return this._implementations.length > 0;
  2665. }
  2666. }
  2667. function mu(t, e, n) {
  2668. const r = t.map((s) => () => e.syncExecuteCommand(s.id, s.params, n));
  2669. return Uf(r);
  2670. }
  2671. function Q0(t, e, n) {
  2672. const r = t.map((s) => () => e.executeCommand(s.id, s.params, n));
  2673. return Lf(r);
  2674. }
  2675. function Gf(t) {
  2676. return new sr((e) => {
  2677. const n = t((...r) => e.next(r));
  2678. return () => n == null ? void 0 : n.dispose();
  2679. });
  2680. }
  2681. function Kf(t) {
  2682. return function(n) {
  2683. return new sr((r) => (n.subscribe({
  2684. next: (s) => {
  2685. r.next(s), t(s) && r.complete();
  2686. },
  2687. complete: () => r.complete(),
  2688. error: (s) => r.error(s)
  2689. }), () => r.unsubscribe()));
  2690. };
  2691. }
  2692. function q0(t = 0) {
  2693. return (e) => {
  2694. let n = [];
  2695. return e.pipe(
  2696. Wi((r) => n.push(r)),
  2697. Sl(t),
  2698. Da(() => n),
  2699. Wi(() => n = [])
  2700. );
  2701. };
  2702. }
  2703. function eC(t) {
  2704. const e = new Al(1);
  2705. return setTimeout(() => e.next(), t), e.pipe(Nl(1));
  2706. }
  2707. const tC = (t) => new Promise((e) => {
  2708. xa(
  2709. Gf(t.onCommandExecuted.bind(t)).pipe(xl(([n]) => n.type === ar.MUTATION)),
  2710. Tl(300)
  2711. ).pipe(Ll(16), Ul()).subscribe(() => {
  2712. e();
  2713. });
  2714. });
  2715. function Xf(t, e) {
  2716. let n = 0, r = t.length - 1;
  2717. if (e < t[0]) return 0;
  2718. if (e >= t[t.length - 1]) return t.length - 1;
  2719. for (; n <= r; ) {
  2720. if (t[n] === e) {
  2721. for (; n < t.length && t[n] === e; )
  2722. n++;
  2723. return n;
  2724. }
  2725. if (e > t[n] && e < t[n + 1])
  2726. return n + 1;
  2727. if (t[r] === e) {
  2728. for (; r < t.length && t[r] === e; )
  2729. r++;
  2730. return r;
  2731. }
  2732. if (e > t[r - 1] && e < t[r])
  2733. return r;
  2734. n++, r--;
  2735. }
  2736. return -1;
  2737. }
  2738. function nC(t, e) {
  2739. let n = 0, r = t.length - 1;
  2740. for (; n <= r; ) {
  2741. const s = Math.floor((r + n) / 2);
  2742. if (e < t[s] && (s === 0 || e >= t[s - 1]))
  2743. return s;
  2744. if (e >= t[s])
  2745. n = s + 1;
  2746. else if (e < t[s])
  2747. r = s - 1;
  2748. else
  2749. return -1;
  2750. }
  2751. return -1;
  2752. }
  2753. function Jf(t, e) {
  2754. let n = 0, r = t.length;
  2755. for (; n < r; ) {
  2756. const s = Math.floor((n + r) / 2);
  2757. t[s] <= e ? n = s + 1 : r = s;
  2758. }
  2759. return n < t.length ? n : t.length - 1;
  2760. }
  2761. function rC(t, e, n = !1) {
  2762. let r = t.length - 1;
  2763. if (e < 0 || e < t[0])
  2764. return 0;
  2765. if (t.length < 40 || e <= t[20] || e >= t[r - 20] ? r = Xf(t, e) : r = Jf(t, e), n) {
  2766. const s = t[r];
  2767. return t.indexOf(s);
  2768. }
  2769. return r;
  2770. }
  2771. function sC(t) {
  2772. const e = new Blob([t], { type: "text/javascript" });
  2773. return window.URL.createObjectURL(e);
  2774. }
  2775. const mr = 2, Zf = 1;
  2776. function iC(t, e) {
  2777. if (e == null || t == null)
  2778. return !0;
  2779. const { left: n = 0, top: r = 0, height: s = 0, width: i = 0, angle: o = 0 } = e, { left: a = 0, top: u = 0, height: c = 0, width: l = 0, angle: h = 0 } = t, d = l, f = c, E = i, R = s;
  2780. return Math.abs(a - n) > mr || Math.abs(u - r) > mr || Math.abs(d - E) > mr || Math.abs(f - R) > mr || Math.abs(h - o) > Zf;
  2781. }
  2782. var _u = /* @__PURE__ */ ((t) => (t[t.DEFAULT_SERIES = 0] = "DEFAULT_SERIES", t[t.ALTERNATE_SERIES = 1] = "ALTERNATE_SERIES", t))(_u || {}), Xe = /* @__PURE__ */ ((t) => (t[t.NONE = 0] = "NONE", t[t.THIN = 1] = "THIN", t[t.HAIR = 2] = "HAIR", t[t.DOTTED = 3] = "DOTTED", t[t.DASHED = 4] = "DASHED", t[t.DASH_DOT = 5] = "DASH_DOT", t[t.DASH_DOT_DOT = 6] = "DASH_DOT_DOT", t[t.DOUBLE = 7] = "DOUBLE", t[t.MEDIUM = 8] = "MEDIUM", t[t.MEDIUM_DASHED = 9] = "MEDIUM_DASHED", t[t.MEDIUM_DASH_DOT = 10] = "MEDIUM_DASH_DOT", t[t.MEDIUM_DASH_DOT_DOT = 11] = "MEDIUM_DASH_DOT_DOT", t[t.SLANT_DASH_DOT = 12] = "SLANT_DASH_DOT", t[t.THICK = 13] = "THICK", t))(Xe || {}), Eu = /* @__PURE__ */ ((t) => (t.TOP = "top", t.BOTTOM = "bottom", t.LEFT = "left", t.RIGHT = "right", t.NONE = "none", t.ALL = "all", t.OUTSIDE = "outside", t.INSIDE = "inside", t.HORIZONTAL = "horizontal", t.VERTICAL = "vertical", t.TLBR = "tlbr", t.TLBC_TLMR = "tlbc_tlmr", t.TLBR_TLBC_TLMR = "tlbr_tlbc_tlmr", t.BLTR = "bl_tr", t.MLTR_BCTR = "mltr_bctr", t))(Eu || {}), vt = /* @__PURE__ */ ((t) => (t[t.UNSUPPORTED = 0] = "UNSUPPORTED", t[t.RGB = 1] = "RGB", t[t.HEX = 2] = "HEX", t[t.THEME = 3] = "THEME", t))(vt || {}), Cu = /* @__PURE__ */ ((t) => (t[t.ON = 0] = "ON", t[t.OFF = 1] = "OFF", t))(Cu || {}), Ru = /* @__PURE__ */ ((t) => (t[t.PASTE_NORMAL = 0] = "PASTE_NORMAL", t[t.PASTE_NO_BORDERS = 1] = "PASTE_NO_BORDERS", t[t.PASTE_FORMAT = 2] = "PASTE_FORMAT", t[t.PASTE_FORMULA = 3] = "PASTE_FORMULA", t[t.PASTE_DATA_VALIDATION = 4] = "PASTE_DATA_VALIDATION", t[t.PASTE_VALUES = 5] = "PASTE_VALUES", t[t.PASTE_CONDITIONAL_FORMATTING = 6] = "PASTE_CONDITIONAL_FORMATTING", t[t.PASTE_COLUMN_WIDTHS = 7] = "PASTE_COLUMN_WIDTHS", t))(Ru || {}), Iu = /* @__PURE__ */ ((t) => (t[t.LEFT = 0] = "LEFT", t[t.RIGHT = 1] = "RIGHT", t))(Iu || {}), vu = /* @__PURE__ */ ((t) => (t[t.DOCUMENT = 0] = "DOCUMENT", t[t.PROJECT = 1] = "PROJECT", t))(vu || {}), yu = /* @__PURE__ */ ((t) => (t[t.COLUMNS = 0] = "COLUMNS", t[t.ROWS = 1] = "ROWS", t))(yu || {}), wu = /* @__PURE__ */ ((t) => (t[t.UP = 0] = "UP", t[t.RIGHT = 1] = "RIGHT", t[t.DOWN = 2] = "DOWN", t[t.LEFT = 3] = "LEFT", t))(wu || {});
  2783. function oC(t) {
  2784. switch (t) {
  2785. case 3:
  2786. return 1;
  2787. case 1:
  2788. return 3;
  2789. case 0:
  2790. return 2;
  2791. case 2:
  2792. return 0;
  2793. }
  2794. }
  2795. var Ou = /* @__PURE__ */ ((t) => (t[t.INTERPOLATION_POINT_TYPE_UNSPECIFIED = 0] = "INTERPOLATION_POINT_TYPE_UNSPECIFIED", t[t.MIN = 1] = "MIN", t[t.MAX = 2] = "MAX", t[t.NUMBER = 3] = "NUMBER", t[t.PERCENT = 4] = "PERCENT", t[t.PERCENTILE = 5] = "PERCENTILE", t))(Ou || {}), ur = /* @__PURE__ */ ((t) => (t.EN_US = "enUS", t.FR_FR = "frFR", t.ZH_CN = "zhCN", t.RU_RU = "ruRU", t.ZH_TW = "zhTW", t.VI_VN = "viVN", t.FA_IR = "faIR", t))(ur || {}), Zr = /* @__PURE__ */ ((t) => (t[t.PERSON = 0] = "PERSON", t[t.FILE = 1] = "FILE", t[t.DATE = 2] = "DATE", t[t.LOCATION = 3] = "LOCATION", t[t.EVENT = 4] = "EVENT", t))(Zr || {}), bu = /* @__PURE__ */ ((t) => (t[t.RANGE = 0] = "RANGE", t[t.SHEET = 1] = "SHEET", t))(bu || {}), Qf = /* @__PURE__ */ ((t) => (t.Line = "line", t.LineInv = "lineInv", t.Triangle = "triangle", t.RtTriangle = "rtTriangle", t.Rect = "rect", t.Diamond = "diamond", t.Parallelogram = "parallelogram", t.Trapezoid = "trapezoid", t.NonIsocelesTrapezoid = "nonIsocelesTrapezoid", t.Pentagon = "pentagon", t.Hexagon = "hexagon", t.Heptagon = "heptagon", t.Octagon = "octagon", t.Decagon = "decagon", t.Dodecagon = "dodecagon", t.Star4 = "star4", t.Star5 = "star5", t.Star6 = "star6", t.Star7 = "star7", t.Star8 = "star8", t.Star10 = "star10", t.Star12 = "star12", t.Star16 = "star16", t.Star24 = "star24", t.Star32 = "star32", t.RoundRect = "roundRect", t.Round1Rect = "round1Rect", t.Round2SameRect = "round2SameRect", t.Round2DiagRect = "round2DiagRect", t.Ellipse = "ellipse", t))(Qf || {}), qf = /* @__PURE__ */ ((t) => (t.RightArrow = "rightArrow", t.LeftArrow = "leftArrow", t.UpArrow = "upArrow", t.DownArrow = "downArrow", t.LeftRightArrow = "leftRightArrow", t.UpDownArrow = "upDownArrow", t.QuadArrow = "quadArrow", t.LeftRightUpArrow = "leftRightUpArrow", t.BentArrow = "bentArrow", t.UturnArrow = "uturnArrow", t.CircularArrow = "circularArrow", t.NotchedRightArrow = "notchedRightArrow", t.HomePlate = "homePlate", t.Chevron = "chevron", t.LeftCircularArrow = "leftCircularArrow", t.LeftRightCircularArrow = "leftRightCircularArrow", t))(qf || {}), eg = /* @__PURE__ */ ((t) => (t.Plaque = "plaque", t.Can = "can", t.Cube = "cube", t.Bevel = "bevel", t.Donut = "donut", t.NoSmoking = "noSmoking", t.BlockArc = "blockArc", t.FoldedCorner = "foldedCorner", t))(eg || {}), tg = /* @__PURE__ */ ((t) => (t.SmileyFace = "smileyFace", t.Heart = "heart", t.LightningBolt = "lightningBolt", t.Sun = "sun", t.Moon = "moon", t.Cloud = "cloud", t.Arc = "arc", t.Backpack = "backpack", t.Frame = "frame", t.HalfFrame = "halfFrame", t.Corner = "corner", t.Chord = "chord", t.Pie = "pie", t.Teardrop = "teardrop", t.WedgeRectCallout = "wedgeRectCallout", t.WedgeRRectCallout = "wedgeRRectCallout", t.WedgeEllipseCallout = "wedgeEllipseCallout", t.CloudCallout = "cloudCallout", t.BorderCallout1 = "borderCallout1", t.BorderCallout2 = "borderCallout2", t.BorderCallout3 = "borderCallout3", t.AccentCallout1 = "accentCallout1", t.AccentCallout2 = "accentCallout2", t.AccentCallout3 = "accentCallout3", t.Callout1 = "callout1", t.Callout2 = "callout2", t.Callout3 = "callout3", t.ActionButtonBackPrevious = "actionButtonBackPrevious", t.ActionButtonEnd = "actionButtonEnd", t.ActionButtonForwardNext = "actionButtonForwardNext", t.ActionButtonHelp = "actionButtonHelp", t.ActionButtonHome = "actionButtonHome", t.ActionButtonInformation = "actionButtonInformation", t.ActionButtonMovie = "actionButtonMovie", t.ActionButtonReturn = "actionButtonReturn", t.ActionButtonSound = "actionButtonSound", t))(tg || {}), Su = /* @__PURE__ */ ((t) => (t[t.RELATIVE_DATE_UNSPECIFIED = 0] = "RELATIVE_DATE_UNSPECIFIED", t[t.PAST_YEAR = 1] = "PAST_YEAR", t[t.PAST_MONTH = 2] = "PAST_MONTH", t[t.PAST_WEEK = 3] = "PAST_WEEK", t[t.YESTERDAY = 4] = "YESTERDAY", t[t.TODAY = 5] = "TODAY", t[t.TOMORROW = 6] = "TOMORROW", t))(Su || {}), Au = /* @__PURE__ */ ((t) => (t[t.GRID = 0] = "GRID", t[t.KANBAN = 1] = "KANBAN", t[t.GANTT = 2] = "GANTT", t))(Au || {}), er = /* @__PURE__ */ ((t) => (t[t.UNSPECIFIED = 0] = "UNSPECIFIED", t[t.LEFT_TO_RIGHT = 1] = "LEFT_TO_RIGHT", t[t.RIGHT_TO_LEFT = 2] = "RIGHT_TO_LEFT", t))(er || {}), Nu = /* @__PURE__ */ ((t) => (t[t.DASH = 0] = "DASH", t[t.DASH_DOT_DOT_HEAVY = 1] = "DASH_DOT_DOT_HEAVY", t[t.DASH_DOT_HEAVY = 2] = "DASH_DOT_HEAVY", t[t.DASHED_HEAVY = 3] = "DASHED_HEAVY", t[t.DASH_LONG = 4] = "DASH_LONG", t[t.DASH_LONG_HEAVY = 5] = "DASH_LONG_HEAVY", t[t.DOT_DASH = 6] = "DOT_DASH", t[t.DOT_DOT_DASH = 7] = "DOT_DOT_DASH", t[t.DOTTED = 8] = "DOTTED", t[t.DOTTED_HEAVY = 9] = "DOTTED_HEAVY", t[t.DOUBLE = 10] = "DOUBLE", t[t.NONE = 11] = "NONE", t[t.SINGLE = 12] = "SINGLE", t[t.THICK = 13] = "THICK", t[t.WAVE = 14] = "WAVE", t[t.WAVY_DOUBLE = 15] = "WAVY_DOUBLE", t[t.WAVY_HEAVY = 16] = "WAVY_HEAVY", t[t.WORDS = 17] = "WORDS", t))(Nu || {}), Xt = /* @__PURE__ */ ((t) => (t[t.UNSPECIFIED = 0] = "UNSPECIFIED", t[t.LEFT = 1] = "LEFT", t[t.CENTER = 2] = "CENTER", t[t.RIGHT = 3] = "RIGHT", t[t.JUSTIFIED = 4] = "JUSTIFIED", t[t.BOTH = 5] = "BOTH", t[t.DISTRIBUTED = 6] = "DISTRIBUTED", t))(Xt || {}), hn = /* @__PURE__ */ ((t) => (t[t.UNSPECIFIED = 0] = "UNSPECIFIED", t[t.TOP = 1] = "TOP", t[t.MIDDLE = 2] = "MIDDLE", t[t.BOTTOM = 3] = "BOTTOM", t))(hn || {}), xn = /* @__PURE__ */ ((t) => (t[t.UNSPECIFIED = 0] = "UNSPECIFIED", t[t.OVERFLOW = 1] = "OVERFLOW", t[t.CLIP = 2] = "CLIP", t[t.WRAP = 3] = "WRAP", t))(xn || {}), Vs = /* @__PURE__ */ ((t) => (t[t.NORMAL = 0] = "NORMAL", t[t.ITALIC = 1] = "ITALIC", t))(Vs || {}), Gs = /* @__PURE__ */ ((t) => (t[t.NORMAL = 0] = "NORMAL", t[t.BOLD = 1] = "BOLD", t))(Gs || {}), Bt = /* @__PURE__ */ ((t) => (t[t.NORMAL = 1] = "NORMAL", t[t.SUBSCRIPT = 2] = "SUBSCRIPT", t[t.SUPERSCRIPT = 3] = "SUPERSCRIPT", t))(Bt || {}), we = /* @__PURE__ */ ((t) => (t[t.FALSE = 0] = "FALSE", t[t.TRUE = 1] = "TRUE", t))(we || {}), dn = /* @__PURE__ */ ((t) => (t[t.STRING = 1] = "STRING", t[t.NUMBER = 2] = "NUMBER", t[t.BOOLEAN = 3] = "BOOLEAN", t[t.FORCE_STRING = 4] = "FORCE_STRING", t))(dn || {}), ft = /* @__PURE__ */ ((t) => (t[t.DARK1 = 0] = "DARK1", t[t.LIGHT1 = 1] = "LIGHT1", t[t.DARK2 = 2] = "DARK2", t[t.LIGHT2 = 3] = "LIGHT2", t[t.ACCENT1 = 4] = "ACCENT1", t[t.ACCENT2 = 5] = "ACCENT2", t[t.ACCENT3 = 6] = "ACCENT3", t[t.ACCENT4 = 7] = "ACCENT4", t[t.ACCENT5 = 8] = "ACCENT5", t[t.ACCENT6 = 9] = "ACCENT6", t[t.HYPERLINK = 10] = "HYPERLINK", t[t.FOLLOWED_HYPERLINK = 11] = "FOLLOWED_HYPERLINK", t))(ft || {}), Di = /* @__PURE__ */ ((t) => (t.OFFICE = "Office", t.OFFICE_2007_2010 = "Office 2007-2010", t.GRAYSCALE = "Grayscale", t.BLUE_WARM = "Blue Warm", t.BLUE = "Blue", t.BLUE_II = "Blue II", t.BLUE_GREEN = "Blue Green", t.GREEN = "Green", t.GREEN_YELLOW = "Green Yellow", t.YELLOW = "Yellow", t.YELLOW_ORANGE = "Yellow Orange", t.ORANGE = "Orange", t.ORANGE_RED = "Orange Red", t.RED_ORANGE = "Red Orange", t.RED = "Red", t.RED_VIOLET = "Red Violet", t.VIOLET = "Violet", t.VIOLET_II = "Violet II", t.MEDIAN = "Median", t.PAPER = "Paper", t.MARQUEE = "Marquee", t.SLIPSTREAM = "Slipstream", t.Aspect = "Aspect", t))(Di || {});
  2796. const ng = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
  2797. let rg = (t) => crypto.getRandomValues(new Uint8Array(t)), sg = (t, e, n) => {
  2798. let r = (2 << Math.log2(t.length - 1)) - 1, s = -~(1.6 * r * e / t.length);
  2799. return (i = e) => {
  2800. let o = "";
  2801. for (; ; ) {
  2802. let a = n(s), u = s | 0;
  2803. for (; u--; )
  2804. if (o += t[a[u] & r] || "", o.length >= i) return o;
  2805. }
  2806. };
  2807. }, ig = (t, e = 21) => sg(t, e | 0, rg), og = (t = 21) => {
  2808. let e = "", n = crypto.getRandomValues(new Uint8Array(t |= 0));
  2809. for (; t--; )
  2810. e += ng[n[t] & 63];
  2811. return e;
  2812. };
  2813. const Tu = /* @__PURE__ */ new Set([
  2814. "ac",
  2815. "ad",
  2816. "ae",
  2817. "aero",
  2818. "af",
  2819. "ag",
  2820. "ai",
  2821. "al",
  2822. "am",
  2823. "ao",
  2824. "aq",
  2825. "ar",
  2826. "arpa",
  2827. "as",
  2828. "asia",
  2829. "at",
  2830. "au",
  2831. "aw",
  2832. "ax",
  2833. "az",
  2834. "ba",
  2835. "bb",
  2836. "bd",
  2837. "be",
  2838. "bf",
  2839. "bg",
  2840. "bh",
  2841. "bi",
  2842. "biz",
  2843. "bj",
  2844. "bm",
  2845. "bn",
  2846. "bo",
  2847. "br",
  2848. "bs",
  2849. "bt",
  2850. "bv",
  2851. "bw",
  2852. "by",
  2853. "bz",
  2854. "ca",
  2855. "cat",
  2856. "cc",
  2857. "cd",
  2858. "cf",
  2859. "cg",
  2860. "ch",
  2861. "ci",
  2862. "ck",
  2863. "cl",
  2864. "cm",
  2865. "cn",
  2866. "co",
  2867. "com",
  2868. "coop",
  2869. "cr",
  2870. "cu",
  2871. "cv",
  2872. "cw",
  2873. "cx",
  2874. "cy",
  2875. "cz",
  2876. "de",
  2877. "dj",
  2878. "dk",
  2879. "dm",
  2880. "do",
  2881. "dz",
  2882. "ec",
  2883. "edu",
  2884. "ee",
  2885. "eg",
  2886. "er",
  2887. "es",
  2888. "et",
  2889. "eu",
  2890. "fi",
  2891. "fj",
  2892. "fk",
  2893. "fm",
  2894. "fo",
  2895. "fr",
  2896. "ga",
  2897. "gb",
  2898. "gd",
  2899. "ge",
  2900. "gf",
  2901. "gg",
  2902. "gh",
  2903. "gi",
  2904. "gl",
  2905. "gm",
  2906. "gn",
  2907. "gov",
  2908. "gp",
  2909. "gq",
  2910. "gr",
  2911. "gs",
  2912. "gt",
  2913. "gu",
  2914. "gw",
  2915. "gy",
  2916. "hk",
  2917. "hm",
  2918. "hn",
  2919. "hr",
  2920. "ht",
  2921. "hu",
  2922. "id",
  2923. "ie",
  2924. "il",
  2925. "im",
  2926. "in",
  2927. "info",
  2928. "int",
  2929. "io",
  2930. "iq",
  2931. "ir",
  2932. "is",
  2933. "it",
  2934. "je",
  2935. "jm",
  2936. "jo",
  2937. "jobs",
  2938. "jp",
  2939. "ke",
  2940. "kg",
  2941. "kh",
  2942. "ki",
  2943. "km",
  2944. "kn",
  2945. "kp",
  2946. "kr",
  2947. "kw",
  2948. "ky",
  2949. "kz",
  2950. "la",
  2951. "lb",
  2952. "lc",
  2953. "li",
  2954. "lk",
  2955. "lr",
  2956. "ls",
  2957. "lt",
  2958. "lu",
  2959. "lv",
  2960. "ly",
  2961. "ma",
  2962. "mc",
  2963. "md",
  2964. "me",
  2965. "mg",
  2966. "mh",
  2967. "mil",
  2968. "mk",
  2969. "ml",
  2970. "mm",
  2971. "mn",
  2972. "mo",
  2973. "mobi",
  2974. "mp",
  2975. "mq",
  2976. "mr",
  2977. "ms",
  2978. "mt",
  2979. "mu",
  2980. "museum",
  2981. "mv",
  2982. "mw",
  2983. "mx",
  2984. "my",
  2985. "mz",
  2986. "na",
  2987. "name",
  2988. "nc",
  2989. "ne",
  2990. "net",
  2991. "nf",
  2992. "ng",
  2993. "ni",
  2994. "nl",
  2995. "no",
  2996. "np",
  2997. "nr",
  2998. "nu",
  2999. "nz",
  3000. "om",
  3001. "onion",
  3002. "org",
  3003. "pa",
  3004. "pe",
  3005. "pf",
  3006. "pg",
  3007. "ph",
  3008. "pk",
  3009. "pl",
  3010. "pm",
  3011. "pn",
  3012. "post",
  3013. "pr",
  3014. "pro",
  3015. "ps",
  3016. "pt",
  3017. "pw",
  3018. "py",
  3019. "qa",
  3020. "re",
  3021. "ro",
  3022. "rs",
  3023. "ru",
  3024. "rw",
  3025. "sa",
  3026. "sb",
  3027. "sc",
  3028. "sd",
  3029. "se",
  3030. "sg",
  3031. "sh",
  3032. "si",
  3033. "sj",
  3034. "sk",
  3035. "sl",
  3036. "sm",
  3037. "sn",
  3038. "so",
  3039. "sr",
  3040. "ss",
  3041. "st",
  3042. "su",
  3043. "sv",
  3044. "sx",
  3045. "sy",
  3046. "sz",
  3047. "tc",
  3048. "td",
  3049. "tel",
  3050. "tf",
  3051. "tg",
  3052. "th",
  3053. "tj",
  3054. "tk",
  3055. "tl",
  3056. "tm",
  3057. "tn",
  3058. "to",
  3059. "tr",
  3060. "tt",
  3061. "tv",
  3062. "tw",
  3063. "tz",
  3064. "ua",
  3065. "ug",
  3066. "uk",
  3067. "us",
  3068. "uy",
  3069. "uz",
  3070. "va",
  3071. "vc",
  3072. "ve",
  3073. "vg",
  3074. "vi",
  3075. "vn",
  3076. "vu",
  3077. "wf",
  3078. "ws",
  3079. "yt",
  3080. "za",
  3081. "zm",
  3082. "zw"
  3083. ]), ag = new RegExp(
  3084. "^(?:(?:(?:https?|ftp):)?\\/\\/)?(?:\\S+(?::\\S*)?@)?(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z0-9\\u00a1-\\uffff][a-z0-9\\u00a1-\\uffff_-]{0,62})?[a-z0-9\\u00a1-\\uffff]\\.)+(?:[a-z\\u00a1-\\uffff]{2,}\\.?))(?::\\d{2,5})?(?:[/?#]\\S*)?$",
  3085. "i"
  3086. );
  3087. function ug(t) {
  3088. if (!Number.isNaN(+t))
  3089. return !1;
  3090. if (t.startsWith("http://localhost:3002") || t.startsWith("localhost:3002"))
  3091. return !0;
  3092. if (ag.test(t)) {
  3093. if (Mu(t))
  3094. return !0;
  3095. try {
  3096. const r = new URL(Du(t)).hostname.split(".").pop();
  3097. if (r && Tu.has(r))
  3098. return !0;
  3099. } catch {
  3100. return !1;
  3101. }
  3102. }
  3103. return !1;
  3104. }
  3105. function Mu(t) {
  3106. return /^[a-zA-Z]+:\/\//.test(t);
  3107. }
  3108. function lg(t) {
  3109. return /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/.test(t);
  3110. }
  3111. function Du(t) {
  3112. return Mu(t) ? t : lg(t) ? `mailto://${t}` : `https://${t}`;
  3113. }
  3114. const cg = /^-ms-/, hg = /-([a-z])/g, Vt = [
  3115. "A",
  3116. "B",
  3117. "C",
  3118. "D",
  3119. "E",
  3120. "F",
  3121. "G",
  3122. "H",
  3123. "I",
  3124. "J",
  3125. "K",
  3126. "L",
  3127. "M",
  3128. "N",
  3129. "O",
  3130. "P",
  3131. "Q",
  3132. "R",
  3133. "S",
  3134. "T",
  3135. "U",
  3136. "V",
  3137. "W",
  3138. "X",
  3139. "Y",
  3140. "Z"
  3141. ];
  3142. function xi(t, e) {
  3143. const n = re.getValueType(t), r = re.getValueType(e);
  3144. return n !== r ? !1 : re.isArray(t) ? dg(t, e) : re.isObject(t) ? fg(t, e) : re.isDate(t) ? t.getTime() === e.getTime() : re.isRegExp(t) ? t.toString() === e.toString() : t === e;
  3145. }
  3146. function dg(t, e) {
  3147. if (t.length !== e.length)
  3148. return !1;
  3149. for (let n = 0, r = t.length; n < r; n++) {
  3150. const s = t[n], i = e[n];
  3151. if (!xi(s, i))
  3152. return !1;
  3153. }
  3154. return !0;
  3155. }
  3156. function fg(t, e) {
  3157. const n = Object.keys(t), r = Object.keys(e);
  3158. if (n.length !== r.length)
  3159. return !1;
  3160. for (const s of n) {
  3161. if (!r.includes(s))
  3162. return !1;
  3163. const i = t[s], o = e[s];
  3164. if (!xi(i, o))
  3165. return !1;
  3166. }
  3167. return !0;
  3168. }
  3169. class re {
  3170. static stringAt(e) {
  3171. let n = "", r = e;
  3172. for (; r >= Vt.length; )
  3173. r /= Vt.length, r -= 1, n += Vt[r % Vt.length];
  3174. const s = e % Vt.length;
  3175. return n += Vt[s], n;
  3176. }
  3177. static indexAt(e) {
  3178. let n = 0;
  3179. for (let r = 0; r < e.length - 1; r += 1) {
  3180. const s = e.charCodeAt(r) - 65, i = e.length - 1 - r;
  3181. n += Vt.length ** i + Vt.length * s;
  3182. }
  3183. return n += e.charCodeAt(e.length - 1) - 65, n;
  3184. }
  3185. static deleteBlank(e) {
  3186. return re.isString(e) ? e.replace(/\s/g, "") : e;
  3187. }
  3188. // eslint-disable-next-line complexity
  3189. static getSystemType() {
  3190. const e = navigator.userAgent, n = navigator.platform === "Win32" || navigator.platform === "Windows", r = navigator.platform === "Mac68K" || navigator.platform === "MacPPC" || navigator.platform === "Macintosh" || navigator.platform === "MacIntel";
  3191. if (r) return "Mac";
  3192. if (navigator.platform === "X11" && !n && !r) return "Unix";
  3193. if (String(navigator.platform).indexOf("Linux") > -1) return "Linux";
  3194. if (n) {
  3195. if (e.indexOf("Windows NT 5.0") > -1 || e.indexOf("Windows 2000") > -1) return "Windows 2000";
  3196. if (e.indexOf("Windows NT 5.1") > -1 || e.indexOf("Windows XP") > -1) return "Windows XP";
  3197. if (e.indexOf("Windows NT 5.2") > -1 || e.indexOf("Windows 2003") > -1) return "Windows 2003";
  3198. if (e.indexOf("Windows NT 6.0") > -1 || e.indexOf("Windows Vista") > -1) return "Windows Vista";
  3199. if (e.indexOf("Windows NT 6.1") > -1 || e.indexOf("Windows 7") > -1) return "Windows 7";
  3200. if (e.indexOf("Windows NT 10") > -1 || e.indexOf("Windows 10") > -1) return "Windows 10";
  3201. if (e.indexOf("Windows NT 11") > -1 || e.indexOf("Windows 11") > -1) return "Windows 11";
  3202. }
  3203. return "Unknown system";
  3204. }
  3205. static getBrowserType() {
  3206. const e = navigator.userAgent, n = e.indexOf("Opera") > -1, r = e.indexOf("compatible") > -1 && e.indexOf("MSIE") > -1 && !n, s = e.indexOf("Trident") > -1 && e.indexOf("rv:11.0") > -1, i = e.indexOf("Edge") > -1, o = e.indexOf("Firefox") > -1, a = e.indexOf("Safari") > -1 && e.indexOf("Chrome") === -1, u = e.indexOf("Chrome") > -1 && e.indexOf("Safari") > -1;
  3207. if (r) {
  3208. new RegExp("MSIE (\\d+\\.\\d+);").test(e);
  3209. const l = Number.parseFloat(RegExp.$1);
  3210. return l === 7 ? "IE7" : l === 8 ? "IE8" : l === 9 ? "IE9" : l === 10 ? "IE10" : "0";
  3211. }
  3212. return o ? "FF" : n ? "Opera" : a ? "Safari" : u ? "Chrome" : i ? "Edge" : s ? "IE11" : "Unknown browser";
  3213. }
  3214. /**
  3215. * Use this method without `Tools`.
  3216. *
  3217. * @deprecated
  3218. */
  3219. static generateRandomId(e = 21, n) {
  3220. return qt(e, n);
  3221. }
  3222. static getClassName(e) {
  3223. return e.constructor.name;
  3224. }
  3225. /** @deprecated This method is deprecated, please use `import { merge } from '@univerjs/core` instead */
  3226. static deepMerge(e, ...n) {
  3227. n.forEach((o) => o && i(o));
  3228. function r(o, a) {
  3229. o.forEach((u, c) => {
  3230. var l, h;
  3231. if (re.isArray(u)) {
  3232. const d = (l = a[c]) != null ? l : [];
  3233. a[c] = d, r(u, d);
  3234. return;
  3235. }
  3236. if (re.isObject(u)) {
  3237. const d = (h = a[c]) != null ? h : {};
  3238. a[c] = d, s(u, d);
  3239. return;
  3240. }
  3241. a[c] = u;
  3242. });
  3243. }
  3244. function s(o, a) {
  3245. Object.keys(o).forEach((u) => {
  3246. var l, h;
  3247. const c = o[u];
  3248. if (re.isObject(c)) {
  3249. const d = (l = a[u]) != null ? l : {};
  3250. a[u] = d, s(c, d);
  3251. return;
  3252. }
  3253. if (re.isArray(c)) {
  3254. const d = (h = a[u]) != null ? h : [];
  3255. a[u] = d, r(c, d);
  3256. return;
  3257. }
  3258. a[u] = c;
  3259. });
  3260. }
  3261. function i(o) {
  3262. Object.keys(o).forEach((a) => {
  3263. var c, l;
  3264. const u = o[a];
  3265. if (re.isArray(u)) {
  3266. const h = (c = e[a]) != null ? c : [];
  3267. e[a] = h, r(u, h);
  3268. return;
  3269. }
  3270. if (re.isObject(u)) {
  3271. const h = (l = e[a]) != null ? l : {};
  3272. e[a] = h, s(u, h);
  3273. return;
  3274. }
  3275. e[a] = u;
  3276. });
  3277. }
  3278. return e;
  3279. }
  3280. static numberFixed(e, n) {
  3281. return Number(Number(e).toFixed(n));
  3282. }
  3283. static diffValue(e, n) {
  3284. return xi(e, n);
  3285. }
  3286. static deepClone(e) {
  3287. if (!this.isDefine(e))
  3288. return e;
  3289. if (this.isRegExp(e))
  3290. return new RegExp(e);
  3291. if (this.isDate(e))
  3292. return new Date(e);
  3293. if (this.isArray(e)) {
  3294. const n = [];
  3295. return e.forEach((r, s) => {
  3296. n[s] = re.deepClone(r);
  3297. }), n;
  3298. }
  3299. if (this.isObject(e)) {
  3300. const n = {};
  3301. return Object.keys(e).forEach((r) => {
  3302. const s = e[r];
  3303. n[r] = re.deepClone(s);
  3304. }), Object.setPrototypeOf(n, Object.getPrototypeOf(e)), n;
  3305. }
  3306. return e;
  3307. }
  3308. static getLanguage() {
  3309. const e = "en-US";
  3310. return globalThis.navigator && (navigator.languages && navigator.languages[0] || navigator.language) || e;
  3311. }
  3312. static getValueType(e) {
  3313. return Object.prototype.toString.apply(e);
  3314. }
  3315. static isDefine(e) {
  3316. return e != null;
  3317. }
  3318. static isBlank(e) {
  3319. return this.isDefine(e) ? this.isString(e) ? e.trim() === "" : !1 : !0;
  3320. }
  3321. static isBoolean(e) {
  3322. return this.getValueType(e) === "[object Boolean]";
  3323. }
  3324. static isPlainObject(e) {
  3325. return this.isDefine(e) ? Object.getPrototypeOf(e) === Object.getPrototypeOf({}) : !1;
  3326. }
  3327. static isFunction(e) {
  3328. return this.getValueType(e) === "[object Function]";
  3329. }
  3330. static isDate(e) {
  3331. return this.getValueType(e) === "[object Date]";
  3332. }
  3333. static isRegExp(e) {
  3334. return this.getValueType(e) === "[object RegExp]";
  3335. }
  3336. static isArray(e) {
  3337. return this.getValueType(e) === "[object Array]";
  3338. }
  3339. static isString(e) {
  3340. return this.getValueType(e) === "[object String]";
  3341. }
  3342. static isNumber(e) {
  3343. return this.getValueType(e) === "[object Number]";
  3344. }
  3345. static isStringNumber(e) {
  3346. return !isNaN(Number.parseFloat(e)) && isFinite(e);
  3347. }
  3348. static isObject(e) {
  3349. return this.getValueType(e) === "[object Object]";
  3350. }
  3351. static isEmptyObject(e) {
  3352. for (const n in e)
  3353. return !1;
  3354. return !0;
  3355. }
  3356. static isMobile() {
  3357. let e = 0, n = 0;
  3358. return document.body.clientWidth && (e = document.body.clientWidth), document.body.clientHeight && (n = document.body.clientHeight), this.isAndroid() || this.isIPhone() || this.isTablet() || e < 350 && n < 500;
  3359. }
  3360. static isTablet() {
  3361. return /ipad|android|android 3.0|xoom|sch-i800|playbook|tablet|kindle/i.test(navigator.userAgent.toLowerCase());
  3362. }
  3363. static isWeChat() {
  3364. const e = navigator.userAgent.toLowerCase();
  3365. return String(e.match(/MicroMessenger/i)) === "micromessenger";
  3366. }
  3367. static isAndroid() {
  3368. const e = navigator.userAgent;
  3369. return e.indexOf("Android") > -1 || e.indexOf("Linux") > -1;
  3370. }
  3371. static isIPhone() {
  3372. return /iPhone/i.test(navigator.userAgent);
  3373. }
  3374. static isLegalUrl(e) {
  3375. return ug(e);
  3376. }
  3377. static normalizeUrl(e) {
  3378. return Du(e);
  3379. }
  3380. static topLevelDomainCombiningString() {
  3381. return [...Tu].join("|");
  3382. }
  3383. static itCount(e) {
  3384. return (n) => {
  3385. for (let r = 0; r < e; r++)
  3386. n && n();
  3387. };
  3388. }
  3389. static hasLength(e, n) {
  3390. return re.isDefine(e) ? re.isDefine(n) ? e.length === n : e.length > 0 : !1;
  3391. }
  3392. static capitalize(e) {
  3393. return e.charAt(0).toUpperCase() + e.slice(1);
  3394. }
  3395. // Used by camelCase as callback to replace()
  3396. static fCamelCase(e, n) {
  3397. return n.toUpperCase();
  3398. }
  3399. // Convert dashed to camelCase; used by the css and data modules
  3400. // Support: IE <=9 - 11, Edge 12 - 15
  3401. // Microsoft forgot to hump their vendor prefix (#9572)
  3402. static camelCase(e) {
  3403. return e.replace(cg, "ms-").replace(hg, this.fCamelCase);
  3404. }
  3405. /**
  3406. * remove all null from object
  3407. * @param obj
  3408. * @returns
  3409. */
  3410. static removeNull(e) {
  3411. return this.isObject(e) && Object.keys(e).forEach((n) => {
  3412. const r = e[n];
  3413. r == null ? delete e[n] : re.removeNull(r);
  3414. }), e;
  3415. }
  3416. /**
  3417. * Generate a two-dimensional array with the specified number of rows and columns, and fill in the values
  3418. * @param rows row length
  3419. * @param columns column length
  3420. * @param value value to be set
  3421. * @returns
  3422. */
  3423. static fillTwoDimensionalArray(e, n, r) {
  3424. return new Array(e).fill(r).map((s) => new Array(n).fill(r));
  3425. }
  3426. /**
  3427. * Generate a two-dimensional array with the specified number of rows and columns, and fill in the values
  3428. * @param rows row length
  3429. * @param columns column length
  3430. * @param value value to be set
  3431. * @returns
  3432. */
  3433. // static fillObjectMatrix<T>(rows: number, columns: number, value: T): IObjectMatrixPrimitiveType<T> {
  3434. // const matrix = new ObjectMatrix<T>();
  3435. // for (let r = 0; r < rows; r++) {
  3436. // for (let c = 0; c < columns; c++) {
  3437. // matrix.setValue(r, c, value);
  3438. // }
  3439. // }
  3440. // return matrix.getData();
  3441. // }
  3442. static numToWord(e) {
  3443. let n = "";
  3444. for (; e > 0; ) {
  3445. let r = e % 26;
  3446. r = r === 0 ? r = 26 : r, n = String.fromCharCode(96 + r) + n, e = (e - r) / 26;
  3447. }
  3448. return n.toLocaleUpperCase();
  3449. }
  3450. /**
  3451. *
  3452. * Column subscript letter to number
  3453. *
  3454. * @privateRemarks
  3455. * zh: 列下标 字母转数字
  3456. *
  3457. * @param a - Column subscript letter,e.g.,"A1"
  3458. * @returns Column subscript number,e.g.,0
  3459. *
  3460. */
  3461. static ABCatNum(e) {
  3462. if (e == null || e.length === 0)
  3463. return Number.NaN;
  3464. const n = e.toLowerCase().split(""), r = n.length;
  3465. let s = 0, i = 0;
  3466. for (let o = 0; o < r; o++)
  3467. i = n[o].charCodeAt(0) - 96, s += i * 26 ** (r - o - 1);
  3468. return s === 0 ? Number.NaN : s - 1;
  3469. }
  3470. /**
  3471. * en: Column subscript number to letter
  3472. *
  3473. * zh: 列下标 数字转字母
  3474. *
  3475. * @param n Column subscript number,e.g.,0
  3476. * @returns Column subscript letter,e.g.,"A1"
  3477. */
  3478. static chatAtABC(e) {
  3479. let i = "";
  3480. for (; e >= 0; )
  3481. i = String.fromCharCode(e % 26 + 97) + i, e = Math.floor(e / 26) - 1;
  3482. return i.toUpperCase();
  3483. }
  3484. static randSort(e) {
  3485. for (let n = 0, r = e.length; n < r; n++) {
  3486. const s = Number.parseInt((Math.random() * r).toString()), i = e[s];
  3487. e[s] = e[n], e[n] = i;
  3488. }
  3489. return e;
  3490. }
  3491. /**
  3492. * extend two objects
  3493. * @param originJson
  3494. * @param extendJson
  3495. * @returns
  3496. */
  3497. static commonExtend(e, n) {
  3498. const r = {};
  3499. for (const s in e)
  3500. r[s] = e[s];
  3501. for (const s in n)
  3502. n[s] != null && (r[s] = n[s]);
  3503. return r;
  3504. }
  3505. static commonExtend1(e, n) {
  3506. for (const r in e)
  3507. n[r] == null && (n[r] = e[r]);
  3508. return n;
  3509. }
  3510. static arrayToObject(e) {
  3511. const n = {};
  3512. return e.forEach((r, s) => {
  3513. n[s] = {}, r.forEach((i, o) => {
  3514. n[s][o] = i;
  3515. });
  3516. }), n;
  3517. }
  3518. static hasIntersectionBetweenTwoRanges(e, n, r, s) {
  3519. return n >= r && s >= e;
  3520. }
  3521. static isStartValidPosition(e) {
  3522. return /^[A-Za-z_]/.test(e);
  3523. }
  3524. static isValidParameter(e) {
  3525. const n = /[~!@#$%^&*()+=\-{}\[\]\|:;"'<>,?\/ ]+/.test(e), r = e.length <= 255;
  3526. return !n && r;
  3527. }
  3528. static clamp(e, n, r) {
  3529. return Math.max(n, Math.min(r, e));
  3530. }
  3531. static now() {
  3532. return performance && performance.now ? performance.now() : Date.now();
  3533. }
  3534. }
  3535. function qt(t = 21, e) {
  3536. return e ? ig(e, t)() : og(t);
  3537. }
  3538. function Mo(...t) {
  3539. const e = {}, n = t.length;
  3540. for (let r = n - 1; r >= 0; r--) {
  3541. const s = t[r];
  3542. if (s) {
  3543. const i = Object.keys(s);
  3544. for (const o of i)
  3545. e[o] === void 0 && (e[o] = s[o]);
  3546. }
  3547. }
  3548. return e;
  3549. }
  3550. const aC = () => typeof process < "u" && process.versions != null && process.versions.node != null;
  3551. function Os(t, e, n) {
  3552. const { dataStream: r, textRuns: s = [] } = t;
  3553. let i = e;
  3554. const o = [];
  3555. for (const a of s) {
  3556. const { st: u, ed: c } = a;
  3557. re.hasIntersectionBetweenTwoRanges(e, n, u, c) && (u > i ? (o.push(r.slice(i, u)), o.push(Do(r, {
  3558. ...a,
  3559. ed: Math.min(c, n)
  3560. }))) : o.push(Do(r, {
  3561. ...a,
  3562. st: i,
  3563. ed: Math.min(c, n)
  3564. }))), i = Math.max(e, Math.min(c, n));
  3565. }
  3566. return i !== n && o.push(r.slice(i, n)), o.join("");
  3567. }
  3568. function uC(t, e = !0) {
  3569. var n;
  3570. if (e && ((n = t.paragraphs) != null && n.length)) {
  3571. const { dataStream: r, paragraphs: s = [] } = t;
  3572. let i = "", o = -1;
  3573. for (const a of s) {
  3574. const { startIndex: u, paragraphStyle: c = {} } = a, { spaceAbove: l, spaceBelow: h, lineSpacing: d } = c, f = [];
  3575. l != null && (typeof l == "number" ? f.push(`margin-top: ${l}px`) : f.push(`margin-top: ${l.v}px`)), h != null && (typeof h == "number" ? f.push(`margin-bottom: ${h}px`) : f.push(`margin-bottom: ${h.v}px`)), d != null && f.push(`line-height: ${d}`), u > o + 1 ? i += `<p class="UniverNormal" ${f.length ? `style="${f.join("; ")};"` : ""}>${Os(t, o + 1, u)}</p>` : i += `<p class="UniverNormal" ${f.length ? `style="${f.join("; ")};"` : ""}></p>`, o = u;
  3576. }
  3577. return o !== r.length && (i += Os(t, o, r.length)), i;
  3578. } else
  3579. return Os(t, 0, t.dataStream.length);
  3580. }
  3581. function Do(t, e) {
  3582. const { st: n, ed: r, ts: s = {} } = e, { ff: i, fs: o, it: a, bl: u, ul: c, st: l, ol: h, bg: d, cl: f, va: E } = s;
  3583. let R = t.slice(n, r);
  3584. const O = [];
  3585. return a === we.TRUE && (R = `<i>${R}</i>`), E === Bt.SUPERSCRIPT ? R = `<sup>${R}</sup>` : E === Bt.SUBSCRIPT && (R = `<sub>${R}</sub>`), (c == null ? void 0 : c.s) === we.TRUE && (R = `<u>${R}</u>`), (l == null ? void 0 : l.s) === we.TRUE && (R = `<s>${R}</s>`), u === we.TRUE && (R = `<strong>${R}</strong>`), i && O.push(`font-family: ${i}`), f && O.push(`color: ${f.rgb}`), o && O.push(`font-size: ${o}pt`), h && O.push("text-decoration: overline"), d && O.push(`background: ${d.rgb}`), O.length ? `<span style="${O.join("; ")};">${R}</span>` : R;
  3586. }
  3587. const gg = {
  3588. [Di.OFFICE]: {
  3589. [ft.ACCENT1]: "#4472C4",
  3590. [ft.ACCENT2]: "#ED7D31",
  3591. [ft.ACCENT3]: "#A5A5A5",
  3592. [ft.ACCENT4]: "#70AD47",
  3593. [ft.ACCENT5]: "#5B9BD5",
  3594. [ft.ACCENT6]: "#70AD47",
  3595. [ft.DARK1]: "#000000",
  3596. [ft.DARK2]: "#44546A",
  3597. [ft.LIGHT1]: "#FFFFFF",
  3598. [ft.LIGHT2]: "#E7E6E6",
  3599. [ft.HYPERLINK]: "#0563C1",
  3600. [ft.FOLLOWED_HYPERLINK]: "#954F72"
  3601. }
  3602. };
  3603. class gs {
  3604. constructor() {
  3605. C(this, "_themeValue", ft.LIGHT1);
  3606. C(this, "_themeColors");
  3607. C(this, "_themeTint");
  3608. C(this, "_rgbValue", "");
  3609. C(this, "_colorType");
  3610. this._colorType = vt.UNSUPPORTED, this._themeColors = Di.OFFICE, this._themeTint = 0;
  3611. }
  3612. asRgbColor() {
  3613. return new Ks(this._rgbValue, this);
  3614. }
  3615. asThemeColor() {
  3616. return new Xs(this._themeValue, this._themeTint, this._themeColors, this);
  3617. }
  3618. build() {
  3619. switch (this._colorType) {
  3620. case vt.THEME:
  3621. return this.asThemeColor();
  3622. case vt.RGB:
  3623. return this.asRgbColor();
  3624. case vt.UNSUPPORTED:
  3625. throw new Error("unsupported color type");
  3626. }
  3627. }
  3628. setRgbColor(e) {
  3629. return this._colorType = vt.RGB, this._rgbValue = e, this;
  3630. }
  3631. setThemeColors(e) {
  3632. this._colorType = vt.THEME, this._themeColors = e;
  3633. }
  3634. setThemeTint(e) {
  3635. this._colorType = vt.THEME, this._themeTint = e;
  3636. }
  3637. setThemeColor(e) {
  3638. return this._colorType = vt.THEME, this._themeValue = e, this;
  3639. }
  3640. getColorType() {
  3641. return this._colorType;
  3642. }
  3643. }
  3644. class Ln {
  3645. constructor(e) {
  3646. C(this, "_builder");
  3647. this._builder = e;
  3648. }
  3649. static rgbColorToHexValue(e) {
  3650. return `#${((1 << 24) + (e.getRed() << 16) + (e.getGreen() << 8) + e.getBlue()).toString(16).slice(1)}`;
  3651. }
  3652. static hexValueToRgbColor(e) {
  3653. e ? e.indexOf("#") > -1 && (e = e.substring(1)) : e = "#000000";
  3654. const n = +`0x${e[0]}${e[1]}`, r = +`0x${e[2]}${e[3]}`, s = +`0x${e[4]}${e[5]}`;
  3655. return new gs().setRgbColor(`rgb(${n},${r},${s})`).asRgbColor();
  3656. }
  3657. static hexToRgbString(e) {
  3658. const n = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
  3659. e = e.replace(n, (i, o, a, u) => o + o + a + a + u + u);
  3660. const r = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);
  3661. let s = null;
  3662. if (r) {
  3663. const i = Number.parseInt(r[1], 16), o = Number.parseInt(r[2], 16), a = Number.parseInt(r[3], 16);
  3664. s = `rgba(${i},${o},${a})`;
  3665. }
  3666. return s;
  3667. }
  3668. asRgbColor() {
  3669. return this._builder.asRgbColor();
  3670. }
  3671. asThemeColor() {
  3672. return this._builder.asThemeColor();
  3673. }
  3674. getColorType() {
  3675. return this._builder.getColorType();
  3676. }
  3677. clone() {
  3678. return new Ln(this._builder);
  3679. }
  3680. equals(e) {
  3681. return !1;
  3682. }
  3683. }
  3684. class pg {
  3685. constructor(e) {
  3686. C(this, "_saturation", 0);
  3687. C(this, "_hue", 0);
  3688. C(this, "_lightness", 0);
  3689. C(this, "_alpha", 0);
  3690. const n = e.getRed() / 255, r = e.getGreen() / 255, s = e.getBlue() / 255, i = e.getAlpha() / 255, o = Math.min(n, Math.min(r, s)), a = Math.max(n, Math.max(r, s)), u = a - o;
  3691. if (a === o) {
  3692. this._hue = 0, this._saturation = 0, this._lightness = a;
  3693. return;
  3694. }
  3695. this._lightness = (o + a) / 2, this._lightness < 0.5 ? this._saturation = u / (a + o) : this._saturation = u / (2 - a - o), n === a && (this._hue = (r - s) / u), r === a && (this._hue = 2 + (s - n) / u), s === a && (this._hue = 4 + (n - r) / u), this._hue *= 60, this._hue < 0 && (this._hue += 360), this._alpha = i;
  3696. }
  3697. asRgbColor() {
  3698. const e = new gs();
  3699. if (this._saturation === 0)
  3700. return e.setRgbColor(
  3701. `rgba(${this._lightness * 255},${this._lightness * 255},${this._lightness * 255},${this._alpha * 255})`
  3702. ), e.asRgbColor();
  3703. let n;
  3704. this._lightness < 0.5 ? n = this._lightness * (1 + this._saturation) : n = this._lightness + this._saturation - this._lightness * this._saturation;
  3705. const r = 2 * this._lightness - n, s = this._hue / 360, i = s + 1 / 3, o = this.setColor(n, r, i), a = this.setColor(n, r, s), u = s - 1 / 3, c = this.setColor(n, r, u);
  3706. return e.setRgbColor(
  3707. `rgba(${Math.round(o * 255)},${Math.round(a * 255)},${Math.round(c * 255)},${this._alpha * 255})`
  3708. ), e.asRgbColor();
  3709. }
  3710. getLightness() {
  3711. return this._lightness;
  3712. }
  3713. getHue() {
  3714. return this._hue;
  3715. }
  3716. getSaturation() {
  3717. return this._saturation;
  3718. }
  3719. getAlpha() {
  3720. return this._alpha;
  3721. }
  3722. setColor(e, n, r) {
  3723. r < 0 && (r += 1), r > 1 && (r -= 1);
  3724. let s;
  3725. return 6 * r < 1 ? s = n + (e - n) * 6 * r : 2 * r < 1 ? s = e : 3 * r < 2 ? s = n + (e - n) * (2 / 3 - r) * 6 : s = n, s;
  3726. }
  3727. setLightness(e) {
  3728. this._lightness = e;
  3729. }
  3730. }
  3731. const It = class It extends Ln {
  3732. constructor(n, r) {
  3733. super(r);
  3734. C(this, "_cssString");
  3735. C(this, "_red");
  3736. C(this, "_green");
  3737. C(this, "_blue");
  3738. C(this, "_alpha");
  3739. let s = n.match(It.RGBA_EXTRACT);
  3740. if (s) {
  3741. const i = +s[1], o = +s[2], a = +s[3], u = +s[4];
  3742. this._cssString = n, this._red = i, this._green = o, this._blue = a, this._alpha = u;
  3743. return;
  3744. }
  3745. if (s = n.match(It.RGB_EXTRACT), s) {
  3746. const i = +s[1], o = +s[2], a = +s[3];
  3747. this._cssString = n, this._red = i, this._green = o, this._blue = a, this._alpha = 1;
  3748. return;
  3749. }
  3750. throw new Error("Invalid rgba or rgb color");
  3751. }
  3752. asHexString() {
  3753. return Ln.rgbColorToHexValue(this);
  3754. }
  3755. getRed() {
  3756. let n = this._red + It.RGB_COLOR_AMT;
  3757. return n > 255 ? n = 255 : n < 0 && (n = 0), n;
  3758. }
  3759. getGreen() {
  3760. let n = this._green + It.RGB_COLOR_AMT;
  3761. return n > 255 ? n = 255 : n < 0 && (n = 0), n;
  3762. }
  3763. getBlue() {
  3764. let n = this._blue + It.RGB_COLOR_AMT;
  3765. return n > 255 ? n = 255 : n < 0 && (n = 0), n;
  3766. }
  3767. getAlpha() {
  3768. return this._alpha;
  3769. }
  3770. getColorType() {
  3771. return vt.RGB;
  3772. }
  3773. clone() {
  3774. return new It(this._cssString, this._builder);
  3775. }
  3776. asThemeColor() {
  3777. throw new Error("rgb color not support to themeColor");
  3778. }
  3779. equals(n) {
  3780. return n instanceof It ? n._red === this._red && n._blue === this._blue && n._green === this._green && n._alpha === this._alpha : !1;
  3781. }
  3782. getCssString() {
  3783. return this._cssString;
  3784. }
  3785. };
  3786. C(It, "RGB_COLOR_AMT", 0), C(It, "RGBA_EXTRACT", new RegExp(
  3787. "\\s*rgba\\s*\\((\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d.\\d|\\d\\s*)\\)\\s*"
  3788. )), C(It, "RGB_EXTRACT", new RegExp("\\s*rgb\\s*\\((\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d+\\s*)\\)\\s*"));
  3789. let Ks = It;
  3790. const Gt = class Gt extends Ln {
  3791. constructor(n, r, s, i) {
  3792. super(i);
  3793. C(this, "_themeColorType");
  3794. C(this, "_themeTint");
  3795. C(this, "_themeColors");
  3796. this._themeColorType = n, this._themeTint = r, this._themeColors = s;
  3797. }
  3798. lumValue(n, r) {
  3799. if (n == null)
  3800. return r;
  3801. let s;
  3802. return n < 0 ? s = r * (1 + n) : s = r * (1 - n) + (255 - 255 * (1 - n)), s;
  3803. }
  3804. asRgbColor() {
  3805. const n = gg[this._themeColors];
  3806. if (n == null)
  3807. throw new Error("not find themeColors type");
  3808. const r = n[this._themeColorType];
  3809. if (r == null)
  3810. throw new Error("not find themeColors value");
  3811. let s;
  3812. if (Gt._cacheThemeColor.has(this._themeColors)) {
  3813. if (s = Gt._cacheThemeColor.get(this._themeColors), s.has(this._themeColorType))
  3814. return s.get(this._themeColorType);
  3815. } else
  3816. s = /* @__PURE__ */ new Map(), Gt._cacheThemeColor.set(this._themeColors, s);
  3817. const i = new pg(Ln.hexValueToRgbColor(r));
  3818. i.setLightness(this.lumValue(this._themeTint, i.getLightness() * 255) / 255);
  3819. const o = i.asRgbColor();
  3820. return s.set(this._themeColorType, o), o;
  3821. }
  3822. clone() {
  3823. return new Gt(this._themeColorType, this._themeTint, this._themeColors, this._builder);
  3824. }
  3825. equals(n) {
  3826. return n instanceof Gt ? n._themeColorType === this._themeColorType : !1;
  3827. }
  3828. getColorType() {
  3829. return vt.THEME;
  3830. }
  3831. getThemeColorType() {
  3832. return this._themeColorType;
  3833. }
  3834. };
  3835. C(Gt, "_cacheThemeColor", /* @__PURE__ */ new Map());
  3836. let Xs = Gt;
  3837. const lC = "rgb(", cC = "rgba(", xo = {
  3838. aliceBlue: [240, 248, 255],
  3839. antiqueWhite: [250, 235, 215],
  3840. aqua: [0, 255, 255],
  3841. aquamarine: [127, 255, 212],
  3842. azure: [240, 255, 255],
  3843. beige: [245, 245, 220],
  3844. bisque: [255, 228, 196],
  3845. black: [0, 0, 0],
  3846. blancheAlmond: [255, 235, 205],
  3847. blue: [0, 0, 255],
  3848. blueViolet: [138, 43, 226],
  3849. brown: [165, 42, 42],
  3850. burlyWood: [222, 184, 135],
  3851. cadetBlue: [95, 158, 160],
  3852. chartreuse: [127, 255, 0],
  3853. chocolate: [210, 105, 30],
  3854. coral: [255, 127, 80],
  3855. cornFlowerBlue: [100, 149, 237],
  3856. cornSilk: [255, 248, 220],
  3857. crimson: [220, 20, 60],
  3858. cyan: [0, 255, 255],
  3859. darkblue: [0, 0, 139],
  3860. darkCyan: [0, 139, 139],
  3861. darkGoldenrod: [184, 132, 11],
  3862. darkGray: [169, 169, 169],
  3863. darkGreen: [0, 100, 0],
  3864. darkGrey: [169, 169, 169],
  3865. darkKhaki: [189, 183, 107],
  3866. darkMagenta: [139, 0, 139],
  3867. darkOliveGreen: [85, 107, 47],
  3868. darkOrange: [255, 140, 0],
  3869. darkOrchid: [153, 50, 204],
  3870. darkRed: [139, 0, 0],
  3871. darkSalmon: [233, 150, 122],
  3872. darkSeaGreen: [143, 188, 143],
  3873. darkSlateBlue: [72, 61, 139],
  3874. darkSlateGray: [47, 79, 79],
  3875. darkSlateGrey: [47, 79, 79],
  3876. darkTurquoise: [0, 206, 209],
  3877. darkViolet: [148, 0, 211],
  3878. deepPink: [255, 20, 147],
  3879. deepSkyBlue: [0, 191, 255],
  3880. dimGray: [105, 105, 105],
  3881. dimGrey: [105, 105, 105],
  3882. dodgerBlue: [30, 144, 255],
  3883. firebrick: [178, 34, 34],
  3884. floralWhite: [255, 255, 240],
  3885. forestGreen: [34, 139, 34],
  3886. fuchsia: [255, 0, 255],
  3887. gainsboro: [220, 220, 220],
  3888. ghostWhite: [248, 248, 255],
  3889. gold: [255, 215, 0],
  3890. goldenrod: [218, 165, 32],
  3891. gray: [128, 128, 128],
  3892. green: [0, 128, 0],
  3893. greenYellow: [173, 255, 47],
  3894. grey: [128, 128, 128],
  3895. honeydew: [240, 255, 240],
  3896. hotPink: [255, 105, 180],
  3897. indianRed: [205, 92, 92],
  3898. indigo: [75, 0, 130],
  3899. ivory: [255, 255, 240],
  3900. khaki: [240, 230, 140],
  3901. lavender: [230, 230, 250],
  3902. lavenderBlush: [255, 240, 245],
  3903. lawnGreen: [124, 252, 0],
  3904. lemonChiffon: [255, 250, 205],
  3905. lightblue: [173, 216, 230],
  3906. lightCoral: [240, 128, 128],
  3907. lightCyan: [224, 255, 255],
  3908. lightGoldenrodYellow: [250, 250, 210],
  3909. lightGray: [211, 211, 211],
  3910. lightGreen: [144, 238, 144],
  3911. lightGrey: [211, 211, 211],
  3912. lightPink: [255, 182, 193],
  3913. lightSalmon: [255, 160, 122],
  3914. lightSeaGreen: [32, 178, 170],
  3915. lightSkyBlue: [135, 206, 250],
  3916. lightSlateGray: [119, 136, 153],
  3917. lightSlateGrey: [119, 136, 153],
  3918. lightSteelBlue: [176, 196, 222],
  3919. lightYellow: [255, 255, 224],
  3920. lime: [0, 255, 0],
  3921. limeGreen: [50, 205, 50],
  3922. linen: [250, 240, 230],
  3923. magenta: [255, 0, 255],
  3924. maroon: [128, 0, 0],
  3925. mediumAquamarine: [102, 205, 170],
  3926. mediumBlue: [0, 0, 205],
  3927. mediumOrchid: [186, 85, 211],
  3928. mediumPurple: [147, 112, 219],
  3929. mediumSeaGreen: [60, 179, 113],
  3930. mediumSlateBlue: [123, 104, 238],
  3931. mediumSpringGreen: [0, 250, 154],
  3932. mediumTurquoise: [72, 209, 204],
  3933. mediumVioletRed: [199, 21, 133],
  3934. midBightBlue: [25, 25, 112],
  3935. mintCream: [245, 255, 250],
  3936. mistyRose: [255, 228, 225],
  3937. moccasin: [255, 228, 181],
  3938. navajoWhite: [255, 222, 173],
  3939. navy: [0, 0, 128],
  3940. oldLace: [253, 245, 230],
  3941. olive: [128, 128, 0],
  3942. oliveDrab: [107, 142, 35],
  3943. orange: [255, 165, 0],
  3944. orangeRed: [255, 69, 0],
  3945. orchid: [218, 112, 214],
  3946. paleGoldenrod: [238, 232, 170],
  3947. paleGreen: [152, 251, 152],
  3948. paleTurquoise: [175, 238, 238],
  3949. paleVioletRed: [219, 112, 147],
  3950. papayaWhip: [255, 239, 213],
  3951. peachPuff: [255, 218, 185],
  3952. peru: [205, 133, 63],
  3953. pink: [255, 192, 203],
  3954. plum: [221, 160, 203],
  3955. powderBlue: [176, 224, 230],
  3956. purple: [128, 0, 128],
  3957. rebeccaPurple: [102, 51, 153],
  3958. red: [255, 0, 0],
  3959. rosyBrown: [188, 143, 143],
  3960. royalBlue: [65, 105, 225],
  3961. saddleBrown: [139, 69, 19],
  3962. salmon: [250, 128, 114],
  3963. sandyBrown: [244, 164, 96],
  3964. seaGreen: [46, 139, 87],
  3965. seashell: [255, 245, 238],
  3966. sienna: [160, 82, 45],
  3967. silver: [192, 192, 192],
  3968. skyBlue: [135, 206, 235],
  3969. slateBlue: [106, 90, 205],
  3970. slateGray: [119, 128, 144],
  3971. slateGrey: [119, 128, 144],
  3972. snow: [255, 255, 250],
  3973. springGreen: [0, 255, 127],
  3974. steelBlue: [70, 130, 180],
  3975. tan: [210, 180, 140],
  3976. teal: [0, 128, 128],
  3977. thistle: [216, 191, 216],
  3978. transparent: [255, 255, 255, 0],
  3979. tomato: [255, 99, 71],
  3980. turquoise: [64, 224, 208],
  3981. violet: [238, 130, 238],
  3982. wheat: [245, 222, 179],
  3983. white: [255, 255, 255],
  3984. whiteSmoke: [245, 245, 245],
  3985. yellow: [255, 255, 0],
  3986. yellowGreen: [154, 205, 5]
  3987. };
  3988. class Nt {
  3989. constructor(e) {
  3990. C(this, "_color");
  3991. C(this, "_rgbColor");
  3992. C(this, "_isValid", !1);
  3993. if (e == null) {
  3994. this._setNullColor();
  3995. return;
  3996. }
  3997. if (e instanceof Nt) {
  3998. this._color = { ...e._color }, this._rgbColor = { ...e._rgbColor };
  3999. return;
  4000. }
  4001. const n = xu(e);
  4002. if (n == null) {
  4003. this._setNullColor();
  4004. return;
  4005. }
  4006. this._color = n;
  4007. const r = Rg(this._color);
  4008. if (r == null) {
  4009. this._setNullColor();
  4010. return;
  4011. }
  4012. this._rgbColor = r, this._isValid = !0;
  4013. }
  4014. static mix(e, n, r) {
  4015. var c, l;
  4016. r = Math.min(1, Math.max(0, r));
  4017. const s = new Nt(e).toRgb(), i = new Nt(n).toRgb(), o = (c = s.a) != null ? c : 1, a = (l = i.a) != null ? l : 1, u = {
  4018. r: (i.r - s.r) * r + s.r,
  4019. g: (i.g - s.g) * r + s.g,
  4020. b: (i.b - s.b) * r + s.b,
  4021. a: (a - o) * r + o
  4022. };
  4023. return new Nt(u);
  4024. }
  4025. static getContrastRatio(e, n) {
  4026. const r = new Nt(e).getLuminance(), s = new Nt(n).getLuminance();
  4027. return (Math.max(r, s) + 0.05) / (Math.min(r, s) + 0.05);
  4028. }
  4029. get isValid() {
  4030. return this._isValid;
  4031. }
  4032. toRgb() {
  4033. return this._rgbColor;
  4034. }
  4035. toRgbString() {
  4036. const { r: e, g: n, b: r, a: s = 1 } = this.toRgb(), i = s < 1;
  4037. return `rgb${i ? "a" : ""}(${e},${n},${r}${i ? `,${s}` : ""})`;
  4038. }
  4039. toString() {
  4040. return this.toRgbString();
  4041. }
  4042. toHexString(e) {
  4043. const { r: n, g: r, b: s, a: i = 1 } = this.toRgb(), o = i < 1, a = [
  4044. _r(Math.round(n).toString(16)),
  4045. _r(Math.round(r).toString(16)),
  4046. _r(Math.round(s).toString(16)),
  4047. _r(Math.round(i * 255).toString(16))
  4048. ];
  4049. return e && a[0][0] === a[0][1] && a[1][0] === a[1][1] && a[2][0] === a[2][1] && a[3][0] === a[3][1] ? o ? `#${a[0][0]}${a[1][0]}${a[2][0]}${a[3][0]}` : `#${a[0][0]}${a[1][0]}${a[2][0]}` : o ? `#${a[0]}${a[1]}${a[2]}${a[3]}` : `#${a[0]}${a[1]}${a[2]}`;
  4050. }
  4051. toHsv() {
  4052. return wg(this.toRgb());
  4053. }
  4054. toHsl() {
  4055. return yg(this.toRgb());
  4056. }
  4057. lighten(e = 10) {
  4058. const n = this.toHsl();
  4059. return n.l += e, n.l = Math.min(Math.max(n.l, 0), 100), new Nt(n);
  4060. }
  4061. darken(e = 10) {
  4062. const n = this.toHsl();
  4063. return n.l -= e, n.l = Math.min(Math.max(n.l, 0), 100), new Nt(n);
  4064. }
  4065. setAlpha(e) {
  4066. return new Nt({ ...this._rgbColor, a: e });
  4067. }
  4068. getLuminance() {
  4069. let { r: e, g: n, b: r } = this.toRgb();
  4070. return e = bs(e), n = bs(n), r = bs(r), Number((0.2126 * e + 0.7152 * n + 0.0722 * r).toFixed(3));
  4071. }
  4072. getBrightness() {
  4073. const { r: e, g: n, b: r } = this.toRgb();
  4074. return (e * 299 + n * 587 + r * 114) / 1e3;
  4075. }
  4076. getAlpha() {
  4077. var e;
  4078. return (e = this._color.a) != null ? e : 1;
  4079. }
  4080. isDark() {
  4081. return this.getBrightness() < 128;
  4082. }
  4083. isLight() {
  4084. return !this.isDark();
  4085. }
  4086. _setNullColor() {
  4087. this._isValid = !1, this._color = {
  4088. r: 0,
  4089. g: 0,
  4090. b: 0,
  4091. a: 0
  4092. }, this._rgbColor = {
  4093. r: 0,
  4094. g: 0,
  4095. b: 0,
  4096. a: 0
  4097. };
  4098. }
  4099. }
  4100. const _r = (t) => t.length === 1 ? `0${t}` : t, bs = (t) => (t /= 255, t <= 0.03928 ? t / 12.92 : ((t + 0.055) / 1.055) ** 2.4), xu = (t) => {
  4101. if (bg(t)) {
  4102. if ("r" in t) {
  4103. const r = {
  4104. r: Math.round(t.r),
  4105. g: Math.round(t.g),
  4106. b: Math.round(t.b)
  4107. };
  4108. return t.a !== void 0 && (r.a = t.a), r;
  4109. }
  4110. if ("l" in t) {
  4111. const r = {
  4112. h: Math.round(t.h),
  4113. s: t.s,
  4114. l: t.l
  4115. };
  4116. return t.a !== void 0 && (r.a = t.a), r;
  4117. }
  4118. const n = {
  4119. h: Math.round(t.h),
  4120. s: t.s,
  4121. v: t.v
  4122. };
  4123. return t.a !== void 0 && (n.a = t.a), n;
  4124. }
  4125. const e = t.trim();
  4126. if (xo[e]) {
  4127. const n = xo[e], r = {
  4128. r: Math.round(n[0]),
  4129. g: Math.round(n[1]),
  4130. b: Math.round(n[2])
  4131. };
  4132. return r.a = n[3] || 1, r;
  4133. }
  4134. if (e.startsWith("#"))
  4135. return mg(e);
  4136. if (e.startsWith("rgb"))
  4137. return _g(e);
  4138. if (e.startsWith("hsl"))
  4139. return Eg(e);
  4140. if (e.startsWith("hsv"))
  4141. return Cg(e);
  4142. }, mg = (t) => {
  4143. const e = t.substring(1), n = new RegExp(`.{1,${e.length >= 6 ? 2 : 1}}`, "g");
  4144. let r = e.match(n);
  4145. if (!r || r.length < 3)
  4146. throw new Error(`The color '${t}' is illegal hex color`);
  4147. r[0].length === 1 && (r = r.map((i) => i + i));
  4148. const s = {
  4149. r: Number.parseInt(r[0], 16),
  4150. g: Number.parseInt(r[1], 16),
  4151. b: Number.parseInt(r[2], 16)
  4152. };
  4153. return r.length > 3 && (s.a = Number.parseInt(r[3], 16) / 255), s;
  4154. }, _g = (t) => {
  4155. const e = t.indexOf("(");
  4156. if (e === -1)
  4157. throw new Error(`The color '${t}' is illegal rgb color`);
  4158. const n = t.substring(e + 1, t.length - 1).split(",");
  4159. if (n.length < 3)
  4160. throw new Error(`The color '${t}' is illegal rgb color`);
  4161. const r = {
  4162. r: Number.parseInt(n[0], 10),
  4163. g: Number.parseInt(n[1], 10),
  4164. b: Number.parseInt(n[2], 10)
  4165. };
  4166. return n.length > 3 && (r.a = Number.parseFloat(n[3])), r;
  4167. }, Eg = (t) => {
  4168. const e = t.indexOf("(");
  4169. if (e === -1)
  4170. throw new Error(`The color '${t}' is illegal hsl color`);
  4171. const n = t.substring(e + 1, t.length - 1).split(",");
  4172. if (n.length < 3)
  4173. throw new Error(`The color '${t}' is illegal hsl color`);
  4174. const r = {
  4175. h: Number.parseInt(n[0], 10),
  4176. s: Number.parseFloat(n[1]),
  4177. l: Number.parseFloat(n[2])
  4178. };
  4179. return n.length > 3 && (r.a = Number.parseFloat(n[3])), r;
  4180. }, Cg = (t) => {
  4181. const e = t.indexOf("(");
  4182. if (e === -1)
  4183. throw new Error(`The color '${t}' is illegal hsv color`);
  4184. const n = t.substring(e + 1, t.length - 1).split(",");
  4185. if (n.length < 3)
  4186. throw new Error(`The color '${t}' is illegal hsv color`);
  4187. const r = {
  4188. h: Number.parseInt(n[0], 10),
  4189. s: Number.parseFloat(n[1]),
  4190. v: Number.parseFloat(n[2])
  4191. };
  4192. return n.length > 3 && (r.a = Number.parseFloat(n[3])), r;
  4193. }, Rg = (t) => {
  4194. const e = xu(t);
  4195. if (e != null)
  4196. return "r" in e ? e : "l" in e ? Ig(e) : vg(e);
  4197. }, Ss = (t, e, n) => (n < 0 && (n += 1), n > 1 && (n -= 1), n < 1 / 6 ? t + (e - t) * 6 * n : n < 1 / 2 ? e : n < 2 / 3 ? t + (e - t) * (2 / 3 - n) * 6 : t), Ig = (t) => {
  4198. let { h: e, s: n, l: r } = t;
  4199. e /= 360, n /= 100, r /= 100;
  4200. let s = 0, i = 0, o = 0;
  4201. if (n === 0)
  4202. s = i = o = r;
  4203. else {
  4204. const u = r < 0.5 ? r * (1 + n) : r + n - r * n, c = 2 * r - u;
  4205. s = Ss(c, u, e + 1 / 3), i = Ss(c, u, e), o = Ss(c, u, e - 1 / 3);
  4206. }
  4207. const a = {
  4208. r: Math.round(s * 255),
  4209. g: Math.round(i * 255),
  4210. b: Math.round(o * 255)
  4211. };
  4212. return t.a !== void 0 && (a.a = t.a), a;
  4213. }, vg = (t) => {
  4214. let { h: e, s: n, v: r } = t;
  4215. e = e / 360 * 6, n /= 100, r /= 100;
  4216. const s = Math.floor(e), i = e - s, o = r * (1 - n), a = r * (1 - i * n), u = r * (1 - (1 - i) * n), c = s % 6, l = [r, a, o, o, u, r][c], h = [u, r, r, a, o, o][c], d = [o, o, u, r, r, a][c], f = {
  4217. r: l * 255,
  4218. g: h * 255,
  4219. b: d * 255
  4220. };
  4221. return t.a !== void 0 && (f.a = t.a), f;
  4222. }, yg = (t) => {
  4223. let { r: e, g: n, b: r } = t;
  4224. e /= 255, n /= 255, r /= 255;
  4225. const s = Math.max(e, n, r), i = Math.min(e, n, r), o = (s + i) / 2;
  4226. let a, u;
  4227. if (s === i)
  4228. a = u = 0;
  4229. else {
  4230. const l = s - i;
  4231. switch (u = o > 0.5 ? l / (2 - s - i) : l / (s + i), s) {
  4232. case e:
  4233. a = (n - r) / l + (n < r ? 6 : 0);
  4234. break;
  4235. case n:
  4236. a = (r - e) / l + 2;
  4237. break;
  4238. default:
  4239. a = (e - n) / l + 4;
  4240. break;
  4241. }
  4242. a /= 6;
  4243. }
  4244. const c = {
  4245. h: Math.round(a * 360),
  4246. s: Math.round(u * 100),
  4247. l: Math.round(o * 100)
  4248. };
  4249. return t.a !== void 0 && (c.a = t.a), c;
  4250. }, wg = (t) => {
  4251. let { r: e, g: n, b: r } = t;
  4252. e /= 255, n /= 255, r /= 255;
  4253. const s = Math.max(e, n, r), i = Math.min(e, n, r);
  4254. let o;
  4255. const a = s, u = s - i, c = s === 0 ? 0 : u / s;
  4256. if (s === i)
  4257. o = 0;
  4258. else {
  4259. switch (s) {
  4260. case e:
  4261. o = (n - r) / u + (n < r ? 6 : 0);
  4262. break;
  4263. case n:
  4264. o = (r - e) / u + 2;
  4265. break;
  4266. default:
  4267. o = (e - n) / u + 4;
  4268. break;
  4269. }
  4270. o /= 6;
  4271. }
  4272. const l = {
  4273. h: Math.round(o * 360),
  4274. s: Math.round(c * 100),
  4275. v: Math.round(a * 100)
  4276. };
  4277. return t.a !== void 0 && (l.a = t.a), l;
  4278. }, Og = (t) => t == null, bg = (t) => !Og(t) && typeof t == "object";
  4279. function hC(t) {
  4280. const e = /^#(?:[0]{3}|[0]{6})\b/, n = /^rgb\s*\(\s*0+\s*,\s*0+\s*,\s*0+\s*\)$/, r = /^rgba\s*\(\s*0+\s*,\s*0+\s*,\s*0+\s*,\s*(1|1\.0*|0?\.\d+)\)$/, s = /^hsl\s*\(\s*0*\s*,\s*0%*\s*,\s*0%*\s*\)$/, i = /^hsla\s*\(\s*0*\s*,\s*0%*\s*,\s*0%*\s*,\s*(1|1\.0*|0?\.\d+)\)$/;
  4281. return !!(e.test(t) || n.test(t) || r.test(t) || s.test(t) || i.test(t));
  4282. }
  4283. function dC(t) {
  4284. const e = /^#(?:[Ff]{3}|[Ff]{6})\b/, n = /^rgb\s*\(\s*255\s*,\s*255\s*,\s*255\s*\)$/, r = /^rgba\s*\(\s*255\s*,\s*255\s*,\s*255\s*,\s*(1|1\.0*|0?\.\d+)\)$/, s = /^hsl\s*\(\s*0*\s*,\s*0%*\s*,\s*100%*\s*\)$/, i = /^hsla\s*\(\s*0*\s*,\s*0%*\s*,\s*100%*\s*,\s*(1|1\.0*|0?\.\d+)\)$/;
  4285. return !!(e.test(t) || n.test(t) || r.test(t) || s.test(t) || i.test(t));
  4286. }
  4287. var Pe = /* @__PURE__ */ ((t) => (t[t.COVER = 0] = "COVER", t[t.REPLACE = 1] = "REPLACE", t))(Pe || {});
  4288. function fC(t) {
  4289. return t && (t.s !== void 0 || t.p !== void 0 || t.v !== void 0 || t.t !== void 0 || t.f !== void 0 || t.si !== void 0 || t.custom !== void 0);
  4290. }
  4291. function gC(t) {
  4292. if (t.t !== void 0)
  4293. return t.t;
  4294. if (typeof t.v == "string")
  4295. return dn.STRING;
  4296. if (typeof t.v == "number")
  4297. return dn.NUMBER;
  4298. if (typeof t.v == "boolean")
  4299. return dn.BOOLEAN;
  4300. }
  4301. function pC(t) {
  4302. if (t == null)
  4303. return !0;
  4304. const { v: e, f: n, si: r, p: s, custom: i } = t;
  4305. return !(!(e == null || typeof e == "string" && e.length === 0) || n != null && n.length > 0 || r != null && r.length > 0 || s != null || i != null);
  4306. }
  4307. function mC(t) {
  4308. return t != null && (typeof t == "string" || typeof t == "number" || typeof t == "boolean");
  4309. }
  4310. var De = /* @__PURE__ */ ((t) => (t[t.NORMAL = 0] = "NORMAL", t[t.ROW = 1] = "ROW", t[t.COLUMN = 2] = "COLUMN", t[t.ALL = 3] = "ALL", t))(De || {}), tt = /* @__PURE__ */ ((t) => (t[t.NONE = 0] = "NONE", t[t.ROW = 1] = "ROW", t[t.COLUMN = 2] = "COLUMN", t[t.ALL = 3] = "ALL", t))(tt || {});
  4311. function _C(t) {
  4312. return [t.startRow, t.startColumn, t.endRow, t.endColumn];
  4313. }
  4314. var Sg = /* @__PURE__ */ ((t) => (t.NONE = "none", t.BACKWARD = "backward", t.FORWARD = "forward", t))(Sg || {}), Ag = /* @__PURE__ */ ((t) => (t.RECT = "RECT", t.TEXT = "TEXT", t))(Ag || {});
  4315. function EC(t, e, n) {
  4316. let r = !1, s = !1, i = t, o = e, a = t, u = e;
  4317. if (n == null)
  4318. return {
  4319. actualRow: t,
  4320. actualColumn: e,
  4321. isMergedMainCell: s,
  4322. isMerged: r,
  4323. endRow: i,
  4324. endColumn: o,
  4325. startRow: a,
  4326. startColumn: u
  4327. };
  4328. for (let c = 0; c < n.length; c++) {
  4329. const {
  4330. startRow: l,
  4331. endRow: h,
  4332. startColumn: d,
  4333. endColumn: f
  4334. } = n[c];
  4335. if (t === l && e === d) {
  4336. i = h, o = f, a = l, u = d, s = !0;
  4337. break;
  4338. }
  4339. if (t >= l && t <= h && e >= d && e <= f) {
  4340. i = h, o = f, a = l, u = d, r = !0;
  4341. break;
  4342. }
  4343. }
  4344. return {
  4345. actualRow: t,
  4346. actualColumn: e,
  4347. isMergedMainCell: s,
  4348. isMerged: r,
  4349. endRow: i,
  4350. endColumn: o,
  4351. startRow: a,
  4352. startColumn: u
  4353. };
  4354. }
  4355. var zn = /* @__PURE__ */ ((t) => (t.Raw = "raw", t.Intercepted = "intercepted", t.Both = "both", t))(zn || {});
  4356. function Ng(t) {
  4357. const { actualRow: e, actualColumn: n, isMerged: r, isMergedMainCell: s, mergeInfo: i } = t;
  4358. let { startY: o, endY: a, startX: u, endX: c } = t, l = e, h = n, d = e, f = n;
  4359. if (r && i) {
  4360. const {
  4361. startRow: E,
  4362. startColumn: R,
  4363. endRow: O,
  4364. endColumn: U,
  4365. startY: ne,
  4366. endY: X,
  4367. startX: de,
  4368. endX: T
  4369. } = i;
  4370. l = E, h = R, d = O, f = U, o = ne, a = X, u = de, c = T;
  4371. }
  4372. return s && (o = i.startY, a = i.endY, u = i.startX, c = i.endX, d = i.endRow, f = i.endColumn), {
  4373. startRow: l,
  4374. startColumn: h,
  4375. endRow: d,
  4376. endColumn: f,
  4377. startY: o,
  4378. endY: a,
  4379. startX: u,
  4380. endX: c
  4381. };
  4382. }
  4383. const CC = Ng;
  4384. function RC(t) {
  4385. if (!t)
  4386. return;
  4387. const {
  4388. actualRow: e,
  4389. actualColumn: n,
  4390. isMerged: r,
  4391. isMergedMainCell: s,
  4392. startRow: i,
  4393. startColumn: o,
  4394. endRow: a,
  4395. endColumn: u
  4396. } = t;
  4397. let c = e, l = n, h = e, d = n;
  4398. return (r || s) && (c = i, l = o, h = a, d = u), {
  4399. startRow: c,
  4400. startColumn: l,
  4401. endRow: h,
  4402. endColumn: d
  4403. };
  4404. }
  4405. function Tg(t) {
  4406. var n;
  4407. return !t || (((n = t == null ? void 0 : t.v) == null ? void 0 : n.toString()) || "").length === 0 && !t.p;
  4408. }
  4409. function IC(t) {
  4410. return Tg(t) && (t == null ? void 0 : t.coverable) !== !1;
  4411. }
  4412. function Lt(t) {
  4413. if (t) {
  4414. if (t.rgb)
  4415. return t.rgb;
  4416. if (t.th)
  4417. return new gs().setThemeColor(t.th).asThemeColor().asRgbColor().getCssString();
  4418. }
  4419. return null;
  4420. }
  4421. function vC(t) {
  4422. return re.isString(t) && t.substring(0, 1) === "=" && t.length > 1;
  4423. }
  4424. function yC(t) {
  4425. return re.isString(t) && t.length > 0;
  4426. }
  4427. function wC(t, e = !1) {
  4428. var i;
  4429. let n = "";
  4430. const r = /* @__PURE__ */ new Map([
  4431. [
  4432. "ff",
  4433. () => {
  4434. t.ff && (n += `font-family: ${t.ff}; `);
  4435. }
  4436. ],
  4437. [
  4438. "fs",
  4439. () => {
  4440. if (t.fs) {
  4441. let o = t.fs;
  4442. t.va && (o /= 2), n += `font-size: ${o}pt; `;
  4443. }
  4444. }
  4445. ],
  4446. [
  4447. "it",
  4448. () => {
  4449. t.it && (n += "font-style: italic; ");
  4450. }
  4451. ],
  4452. [
  4453. "bl",
  4454. () => {
  4455. t.bl && (n += "font-weight: bold; ");
  4456. }
  4457. ],
  4458. [
  4459. "ul",
  4460. () => {
  4461. var o;
  4462. (o = t.ul) != null && o.s && (n.indexOf("text-decoration-line") > -1 ? n = n.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g, (a, u) => `${u} underline`) : n += "text-decoration: underline; ", t.ul.cl && n.indexOf("text-decoration-color") === -1 && (n += `text-decoration-color: ${Lt(t.ul.cl)}; `), t.ul.t && n.indexOf("text-decoration-style") === -1 && (n += `text-decoration-style: ${t.ul.t} `));
  4463. }
  4464. ],
  4465. [
  4466. "st",
  4467. () => {
  4468. var o;
  4469. (o = t.st) != null && o.s && (n.indexOf("text-decoration-line") > -1 ? n = n.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g, (a, u) => `${u} line-through`) : n += "text-decoration-line: line-through; ", t.st.cl && n.indexOf("text-decoration-color") === -1 && (n += `text-decoration-color: ${Lt(t.st.cl)}; `), t.st.t && n.indexOf("text-decoration-style") === -1 && (n += `text-decoration-style: ${t.st.t} `));
  4470. }
  4471. ],
  4472. [
  4473. "ol",
  4474. () => {
  4475. var o;
  4476. (o = t.ol) != null && o.s && (n.indexOf("text-decoration-line") > -1 ? n = n.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g, (a, u) => `${u} overline`) : n += "text-decoration-line: overline; ", t.ol.cl && n.indexOf("text-decoration-color") === -1 && (n += `text-decoration-color: ${Lt(t.ol.cl)}; `), t.ol.t && n.indexOf("text-decoration-style") === -1 && (n += `text-decoration-style: ${t.ol.t} `));
  4477. }
  4478. ],
  4479. [
  4480. "bg",
  4481. () => {
  4482. t.bg && (n += `background: ${Lt(t.bg)}; `);
  4483. }
  4484. ],
  4485. [
  4486. "bd",
  4487. () => {
  4488. var o, a, u, c, l, h, d, f, E, R, O, U;
  4489. (o = t.bd) != null && o.b && (n += `border-bottom: ${Er((a = t.bd) == null ? void 0 : a.b.s)} ${(u = Lt(t.bd.b.cl)) != null ? u : ""}; `), (c = t.bd) != null && c.t && (n += `border-top: ${Er((l = t.bd) == null ? void 0 : l.t.s)} ${(h = Lt(t.bd.t.cl)) != null ? h : ""}; `), (d = t.bd) != null && d.r && (n += `border-right: ${Er((f = t.bd) == null ? void 0 : f.r.s)} ${(E = Lt(t.bd.r.cl)) != null ? E : ""}; `), (R = t.bd) != null && R.l && (n += `border-left: ${Er((O = t.bd) == null ? void 0 : O.l.s)} ${(U = Lt(t.bd.l.cl)) != null ? U : ""}; `);
  4490. }
  4491. ],
  4492. [
  4493. "cl",
  4494. () => {
  4495. t.cl && (n += `color: ${Lt(t.cl)}; `);
  4496. }
  4497. ],
  4498. [
  4499. "va",
  4500. () => {
  4501. t.va === Bt.SUBSCRIPT ? n += "vertical-align: sub; " : t.va === Bt.SUPERSCRIPT && (n += "vertical-align: super; ");
  4502. }
  4503. ],
  4504. [
  4505. "td",
  4506. () => {
  4507. t.td === er.LEFT_TO_RIGHT ? n += "direction: ltr; " : t.td === er.RIGHT_TO_LEFT && (n += "direction: rtl; ");
  4508. }
  4509. ],
  4510. [
  4511. "tr",
  4512. () => {
  4513. var o, a, u;
  4514. t.tr && (n += `--data-rotate: (${(o = t.tr) == null ? void 0 : o.a}deg${(a = t.tr) != null && a.v ? ` ,${(u = t.tr) == null ? void 0 : u.v}` : ""});`);
  4515. }
  4516. ],
  4517. [
  4518. "ht",
  4519. () => {
  4520. t.ht === Xt.LEFT ? n += "text-align: left; " : t.ht === Xt.RIGHT ? n += "text-align: right; " : t.ht === Xt.CENTER ? n += "text-align: center; " : t.ht === Xt.JUSTIFIED && (n += "text-align: justify; ");
  4521. }
  4522. ],
  4523. [
  4524. "vt",
  4525. () => {
  4526. t.vt === hn.BOTTOM ? n += "vertical-align: bottom; " : t.vt === hn.TOP ? n += "vertical-align: top; " : t.vt === hn.MIDDLE && (n += "vertical-align: middle; ");
  4527. }
  4528. ],
  4529. [
  4530. "tb",
  4531. () => {
  4532. t.tb === xn.CLIP ? n += "white-space: nowrap; overflow-x: hidden; " : t.tb === xn.WRAP && (n += "white-space: normal;");
  4533. }
  4534. ],
  4535. [
  4536. "pd",
  4537. () => {
  4538. var l, h, d, f, E, R, O, U;
  4539. const o = `${(l = t.pd) == null ? void 0 : l.b}pt`, a = `${(h = t.pd) == null ? void 0 : h.t}pt`, u = `${(d = t.pd) == null ? void 0 : d.l}pt`, c = `${(f = t.pd) == null ? void 0 : f.r}pt`;
  4540. (E = t.pd) != null && E.b && (n += `padding-bottom: ${o}; `), (R = t.pd) != null && R.t && (n += `padding-top: ${a}; `), (O = t.pd) != null && O.l && (n += `padding-left: ${u}; `), (U = t.pd) != null && U.r && (n += `padding-right: ${c}; `);
  4541. }
  4542. ]
  4543. ]), s = ["bd", "tr", "tb"];
  4544. for (const o in t)
  4545. e && s.includes(o) || (i = r.get(o)) == null || i();
  4546. return n;
  4547. }
  4548. function Er(t) {
  4549. let e = "";
  4550. return t === Xe.NONE ? e = "none" : t === Xe.THIN ? e = "0.5pt solid" : t === Xe.HAIR ? e = "0.5pt double" : t === Xe.DOTTED ? e = "0.5pt dotted" : t === Xe.DASHED || t === Xe.DASH_DOT ? e = "0.5pt dashed" : t === Xe.DASH_DOT_DOT ? e = "0.5pt dotted" : t === Xe.DOUBLE ? e = "0.5pt double" : t === Xe.MEDIUM ? e = "1pt solid" : t === Xe.MEDIUM_DASHED || t === Xe.MEDIUM_DASH_DOT ? e = "1pt dashed" : t === Xe.MEDIUM_DASH_DOT_DOT ? e = "1pt dotted" : t === Xe.SLANT_DASH_DOT ? e = "0.5pt dashed" : t === Xe.THICK && (e = "1.5pt solid"), e;
  4551. }
  4552. function OC(t) {
  4553. let e = 0;
  4554. if (t = t.trim(), t === "none")
  4555. e = Xe.NONE;
  4556. else if (t === "0.5pt solid")
  4557. e = Xe.THIN;
  4558. else if (t === "0.5pt double")
  4559. e = Xe.HAIR;
  4560. else if (t === "0.5pt dotted")
  4561. e = Xe.DOTTED;
  4562. else if (t === "0.5pt dashed")
  4563. e = Xe.DASHED;
  4564. else if (t === "1pt solid")
  4565. e = Xe.MEDIUM;
  4566. else if (t === "1pt dashed")
  4567. e = Xe.MEDIUM_DASHED;
  4568. else if (t === "1pt dotted")
  4569. e = Xe.MEDIUM_DASH_DOT_DOT;
  4570. else if (t === "1.5pt solid")
  4571. e = Xe.THICK;
  4572. else if (!t.includes("none"))
  4573. e = Xe.THIN;
  4574. else
  4575. return Xe.NONE;
  4576. return e;
  4577. }
  4578. function bC(t, e) {
  4579. let n = t.body;
  4580. if (e) {
  4581. const { headers: r, footers: s } = t;
  4582. r != null && r[e] ? n = r[e].body : s != null && s[e] && (n = s[e].body);
  4583. }
  4584. return n;
  4585. }
  4586. function SC(t, e) {
  4587. const { startRow: n, endRow: r, startColumn: s, endColumn: i, rangeType: o } = t;
  4588. if (n < 0 || s < 0 || r < 0 || i < 0 || !(Number.isNaN(n) && Number.isNaN(r)) && o === De.COLUMN || !(Number.isNaN(s) && Number.isNaN(i)) && o === De.ROW || o !== De.ROW && o !== De.COLUMN && (Number.isNaN(s) || Number.isNaN(n) || Number.isNaN(i) || Number.isNaN(r)))
  4589. return !1;
  4590. if (e) {
  4591. const a = e.getRowCount(), u = e.getColumnCount();
  4592. if (r >= a || i >= u)
  4593. return !1;
  4594. }
  4595. return !0;
  4596. }
  4597. function AC(t, e) {
  4598. return { startRow: t, endRow: t, startColumn: e, endColumn: e };
  4599. }
  4600. function Lu(t, e) {
  4601. return Object.prototype.toString.call(t) === Object.prototype.toString.call(e) ? Object.prototype.toString.call(t) === "[object Object]" || Object.prototype.toString.call(t) === "[object Array]" ? Object.keys(t).length !== Object.keys(e).length ? !1 : Object.keys(t).every((n) => Lu(t[n], e[n])) : t === e : !1;
  4602. }
  4603. function Mg(t, e) {
  4604. const n = t.ts || {}, r = e.ts || {};
  4605. return t.sId !== e.sId ? !1 : Lu(n, r);
  4606. }
  4607. function NC(t, e) {
  4608. return e.some((n) => t.indexOf(n) > -1);
  4609. }
  4610. var Pr = { exports: {} }, Dg = Pr.exports, Lo;
  4611. function xg() {
  4612. return Lo || (Lo = 1, function(t, e) {
  4613. (function(n, r) {
  4614. t.exports = r();
  4615. })(Dg, function() {
  4616. var n = 1e3, r = 6e4, s = 36e5, i = "millisecond", o = "second", a = "minute", u = "hour", c = "day", l = "week", h = "month", d = "quarter", f = "year", E = "date", R = "Invalid Date", O = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, U = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, ne = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(M) {
  4617. var b = ["th", "st", "nd", "rd"], w = M % 100;
  4618. return "[" + M + (b[(w - 20) % 10] || b[w] || b[0]) + "]";
  4619. } }, X = function(M, b, w) {
  4620. var k = String(M);
  4621. return !k || k.length >= b ? M : "" + Array(b + 1 - k.length).join(w) + M;
  4622. }, de = { s: X, z: function(M) {
  4623. var b = -M.utcOffset(), w = Math.abs(b), k = Math.floor(w / 60), $ = w % 60;
  4624. return (b <= 0 ? "+" : "-") + X(k, 2, "0") + ":" + X($, 2, "0");
  4625. }, m: function M(b, w) {
  4626. if (b.date() < w.date()) return -M(w, b);
  4627. var k = 12 * (w.year() - b.year()) + (w.month() - b.month()), $ = b.clone().add(k, h), Y = w - $ < 0, se = b.clone().add(k + (Y ? -1 : 1), h);
  4628. return +(-(k + (w - $) / (Y ? $ - se : se - $)) || 0);
  4629. }, a: function(M) {
  4630. return M < 0 ? Math.ceil(M) || 0 : Math.floor(M);
  4631. }, p: function(M) {
  4632. return { M: h, y: f, w: l, d: c, D: E, h: u, m: a, s: o, ms: i, Q: d }[M] || String(M || "").toLowerCase().replace(/s$/, "");
  4633. }, u: function(M) {
  4634. return M === void 0;
  4635. } }, T = "en", A = {};
  4636. A[T] = ne;
  4637. var H = "$isDayjsObject", Z = function(M) {
  4638. return M instanceof j || !(!M || !M[H]);
  4639. }, fe = function M(b, w, k) {
  4640. var $;
  4641. if (!b) return T;
  4642. if (typeof b == "string") {
  4643. var Y = b.toLowerCase();
  4644. A[Y] && ($ = Y), w && (A[Y] = w, $ = Y);
  4645. var se = b.split("-");
  4646. if (!$ && se.length > 1) return M(se[0]);
  4647. } else {
  4648. var he = b.name;
  4649. A[he] = b, $ = he;
  4650. }
  4651. return !k && $ && (T = $), $ || !k && T;
  4652. }, ae = function(M, b) {
  4653. if (Z(M)) return M.clone();
  4654. var w = typeof b == "object" ? b : {};
  4655. return w.date = M, w.args = arguments, new j(w);
  4656. }, m = de;
  4657. m.l = fe, m.i = Z, m.w = function(M, b) {
  4658. return ae(M, { locale: b.$L, utc: b.$u, x: b.$x, $offset: b.$offset });
  4659. };
  4660. var j = function() {
  4661. function M(w) {
  4662. this.$L = fe(w.locale, null, !0), this.parse(w), this.$x = this.$x || w.x || {}, this[H] = !0;
  4663. }
  4664. var b = M.prototype;
  4665. return b.parse = function(w) {
  4666. this.$d = function(k) {
  4667. var $ = k.date, Y = k.utc;
  4668. if ($ === null) return /* @__PURE__ */ new Date(NaN);
  4669. if (m.u($)) return /* @__PURE__ */ new Date();
  4670. if ($ instanceof Date) return new Date($);
  4671. if (typeof $ == "string" && !/Z$/i.test($)) {
  4672. var se = $.match(O);
  4673. if (se) {
  4674. var he = se[2] - 1 || 0, ge = (se[7] || "0").substring(0, 3);
  4675. return Y ? new Date(Date.UTC(se[1], he, se[3] || 1, se[4] || 0, se[5] || 0, se[6] || 0, ge)) : new Date(se[1], he, se[3] || 1, se[4] || 0, se[5] || 0, se[6] || 0, ge);
  4676. }
  4677. }
  4678. return new Date($);
  4679. }(w), this.init();
  4680. }, b.init = function() {
  4681. var w = this.$d;
  4682. this.$y = w.getFullYear(), this.$M = w.getMonth(), this.$D = w.getDate(), this.$W = w.getDay(), this.$H = w.getHours(), this.$m = w.getMinutes(), this.$s = w.getSeconds(), this.$ms = w.getMilliseconds();
  4683. }, b.$utils = function() {
  4684. return m;
  4685. }, b.isValid = function() {
  4686. return this.$d.toString() !== R;
  4687. }, b.isSame = function(w, k) {
  4688. var $ = ae(w);
  4689. return this.startOf(k) <= $ && $ <= this.endOf(k);
  4690. }, b.isAfter = function(w, k) {
  4691. return ae(w) < this.startOf(k);
  4692. }, b.isBefore = function(w, k) {
  4693. return this.endOf(k) < ae(w);
  4694. }, b.$g = function(w, k, $) {
  4695. return m.u(w) ? this[k] : this.set($, w);
  4696. }, b.unix = function() {
  4697. return Math.floor(this.valueOf() / 1e3);
  4698. }, b.valueOf = function() {
  4699. return this.$d.getTime();
  4700. }, b.startOf = function(w, k) {
  4701. var $ = this, Y = !!m.u(k) || k, se = m.p(w), he = function(z, W) {
  4702. var ue = m.w($.$u ? Date.UTC($.$y, W, z) : new Date($.$y, W, z), $);
  4703. return Y ? ue : ue.endOf(c);
  4704. }, ge = function(z, W) {
  4705. return m.w($.toDate()[z].apply($.toDate("s"), (Y ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(W)), $);
  4706. }, Ae = this.$W, be = this.$M, v = this.$D, F = "set" + (this.$u ? "UTC" : "");
  4707. switch (se) {
  4708. case f:
  4709. return Y ? he(1, 0) : he(31, 11);
  4710. case h:
  4711. return Y ? he(1, be) : he(0, be + 1);
  4712. case l:
  4713. var V = this.$locale().weekStart || 0, K = (Ae < V ? Ae + 7 : Ae) - V;
  4714. return he(Y ? v - K : v + (6 - K), be);
  4715. case c:
  4716. case E:
  4717. return ge(F + "Hours", 0);
  4718. case u:
  4719. return ge(F + "Minutes", 1);
  4720. case a:
  4721. return ge(F + "Seconds", 2);
  4722. case o:
  4723. return ge(F + "Milliseconds", 3);
  4724. default:
  4725. return this.clone();
  4726. }
  4727. }, b.endOf = function(w) {
  4728. return this.startOf(w, !1);
  4729. }, b.$set = function(w, k) {
  4730. var $, Y = m.p(w), se = "set" + (this.$u ? "UTC" : ""), he = ($ = {}, $[c] = se + "Date", $[E] = se + "Date", $[h] = se + "Month", $[f] = se + "FullYear", $[u] = se + "Hours", $[a] = se + "Minutes", $[o] = se + "Seconds", $[i] = se + "Milliseconds", $)[Y], ge = Y === c ? this.$D + (k - this.$W) : k;
  4731. if (Y === h || Y === f) {
  4732. var Ae = this.clone().set(E, 1);
  4733. Ae.$d[he](ge), Ae.init(), this.$d = Ae.set(E, Math.min(this.$D, Ae.daysInMonth())).$d;
  4734. } else he && this.$d[he](ge);
  4735. return this.init(), this;
  4736. }, b.set = function(w, k) {
  4737. return this.clone().$set(w, k);
  4738. }, b.get = function(w) {
  4739. return this[m.p(w)]();
  4740. }, b.add = function(w, k) {
  4741. var $, Y = this;
  4742. w = Number(w);
  4743. var se = m.p(k), he = function(be) {
  4744. var v = ae(Y);
  4745. return m.w(v.date(v.date() + Math.round(be * w)), Y);
  4746. };
  4747. if (se === h) return this.set(h, this.$M + w);
  4748. if (se === f) return this.set(f, this.$y + w);
  4749. if (se === c) return he(1);
  4750. if (se === l) return he(7);
  4751. var ge = ($ = {}, $[a] = r, $[u] = s, $[o] = n, $)[se] || 1, Ae = this.$d.getTime() + w * ge;
  4752. return m.w(Ae, this);
  4753. }, b.subtract = function(w, k) {
  4754. return this.add(-1 * w, k);
  4755. }, b.format = function(w) {
  4756. var k = this, $ = this.$locale();
  4757. if (!this.isValid()) return $.invalidDate || R;
  4758. var Y = w || "YYYY-MM-DDTHH:mm:ssZ", se = m.z(this), he = this.$H, ge = this.$m, Ae = this.$M, be = $.weekdays, v = $.months, F = $.meridiem, V = function(W, ue, oe, B) {
  4759. return W && (W[ue] || W(k, Y)) || oe[ue].slice(0, B);
  4760. }, K = function(W) {
  4761. return m.s(he % 12 || 12, W, "0");
  4762. }, z = F || function(W, ue, oe) {
  4763. var B = W < 12 ? "AM" : "PM";
  4764. return oe ? B.toLowerCase() : B;
  4765. };
  4766. return Y.replace(U, function(W, ue) {
  4767. return ue || function(oe) {
  4768. switch (oe) {
  4769. case "YY":
  4770. return String(k.$y).slice(-2);
  4771. case "YYYY":
  4772. return m.s(k.$y, 4, "0");
  4773. case "M":
  4774. return Ae + 1;
  4775. case "MM":
  4776. return m.s(Ae + 1, 2, "0");
  4777. case "MMM":
  4778. return V($.monthsShort, Ae, v, 3);
  4779. case "MMMM":
  4780. return V(v, Ae);
  4781. case "D":
  4782. return k.$D;
  4783. case "DD":
  4784. return m.s(k.$D, 2, "0");
  4785. case "d":
  4786. return String(k.$W);
  4787. case "dd":
  4788. return V($.weekdaysMin, k.$W, be, 2);
  4789. case "ddd":
  4790. return V($.weekdaysShort, k.$W, be, 3);
  4791. case "dddd":
  4792. return be[k.$W];
  4793. case "H":
  4794. return String(he);
  4795. case "HH":
  4796. return m.s(he, 2, "0");
  4797. case "h":
  4798. return K(1);
  4799. case "hh":
  4800. return K(2);
  4801. case "a":
  4802. return z(he, ge, !0);
  4803. case "A":
  4804. return z(he, ge, !1);
  4805. case "m":
  4806. return String(ge);
  4807. case "mm":
  4808. return m.s(ge, 2, "0");
  4809. case "s":
  4810. return String(k.$s);
  4811. case "ss":
  4812. return m.s(k.$s, 2, "0");
  4813. case "SSS":
  4814. return m.s(k.$ms, 3, "0");
  4815. case "Z":
  4816. return se;
  4817. }
  4818. return null;
  4819. }(W) || se.replace(":", "");
  4820. });
  4821. }, b.utcOffset = function() {
  4822. return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
  4823. }, b.diff = function(w, k, $) {
  4824. var Y, se = this, he = m.p(k), ge = ae(w), Ae = (ge.utcOffset() - this.utcOffset()) * r, be = this - ge, v = function() {
  4825. return m.m(se, ge);
  4826. };
  4827. switch (he) {
  4828. case f:
  4829. Y = v() / 12;
  4830. break;
  4831. case h:
  4832. Y = v();
  4833. break;
  4834. case d:
  4835. Y = v() / 3;
  4836. break;
  4837. case l:
  4838. Y = (be - Ae) / 6048e5;
  4839. break;
  4840. case c:
  4841. Y = (be - Ae) / 864e5;
  4842. break;
  4843. case u:
  4844. Y = be / s;
  4845. break;
  4846. case a:
  4847. Y = be / r;
  4848. break;
  4849. case o:
  4850. Y = be / n;
  4851. break;
  4852. default:
  4853. Y = be;
  4854. }
  4855. return $ ? Y : m.a(Y);
  4856. }, b.daysInMonth = function() {
  4857. return this.endOf(h).$D;
  4858. }, b.$locale = function() {
  4859. return A[this.$L];
  4860. }, b.locale = function(w, k) {
  4861. if (!w) return this.$L;
  4862. var $ = this.clone(), Y = fe(w, k, !0);
  4863. return Y && ($.$L = Y), $;
  4864. }, b.clone = function() {
  4865. return m.w(this.$d, this);
  4866. }, b.toDate = function() {
  4867. return new Date(this.valueOf());
  4868. }, b.toJSON = function() {
  4869. return this.isValid() ? this.toISOString() : null;
  4870. }, b.toISOString = function() {
  4871. return this.$d.toISOString();
  4872. }, b.toString = function() {
  4873. return this.$d.toUTCString();
  4874. }, M;
  4875. }(), y = j.prototype;
  4876. return ae.prototype = y, [["$ms", i], ["$s", o], ["$m", a], ["$H", u], ["$W", c], ["$M", h], ["$y", f], ["$D", E]].forEach(function(M) {
  4877. y[M[1]] = function(b) {
  4878. return this.$g(b, M[0], M[1]);
  4879. };
  4880. }), ae.extend = function(M, b) {
  4881. return M.$i || (M(b, j, ae), M.$i = !0), ae;
  4882. }, ae.locale = fe, ae.isDayjs = Z, ae.unix = function(M) {
  4883. return ae(1e3 * M);
  4884. }, ae.en = A[T], ae.Ls = A, ae.p = {}, ae;
  4885. });
  4886. }(Pr)), Pr.exports;
  4887. }
  4888. var Lg = xg();
  4889. const rn = /* @__PURE__ */ wt(Lg);
  4890. var kr = { exports: {} }, Ug = kr.exports, Uo;
  4891. function Pg() {
  4892. return Uo || (Uo = 1, function(t, e) {
  4893. (function(n, r) {
  4894. t.exports = r();
  4895. })(Ug, function() {
  4896. return function(n, r) {
  4897. var s = r.prototype, i = s.format;
  4898. s.format = function(o) {
  4899. var a = this, u = this.$locale();
  4900. if (!this.isValid()) return i.bind(this)(o);
  4901. var c = this.$utils(), l = (o || "YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g, function(h) {
  4902. switch (h) {
  4903. case "Q":
  4904. return Math.ceil((a.$M + 1) / 3);
  4905. case "Do":
  4906. return u.ordinal(a.$D);
  4907. case "gggg":
  4908. return a.weekYear();
  4909. case "GGGG":
  4910. return a.isoWeekYear();
  4911. case "wo":
  4912. return u.ordinal(a.week(), "W");
  4913. case "w":
  4914. case "ww":
  4915. return c.s(a.week(), h === "w" ? 1 : 2, "0");
  4916. case "W":
  4917. case "WW":
  4918. return c.s(a.isoWeek(), h === "W" ? 1 : 2, "0");
  4919. case "k":
  4920. case "kk":
  4921. return c.s(String(a.$H === 0 ? 24 : a.$H), h === "k" ? 1 : 2, "0");
  4922. case "X":
  4923. return Math.floor(a.$d.getTime() / 1e3);
  4924. case "x":
  4925. return a.$d.getTime();
  4926. case "z":
  4927. return "[" + a.offsetName() + "]";
  4928. case "zzz":
  4929. return "[" + a.offsetName("long") + "]";
  4930. default:
  4931. return h;
  4932. }
  4933. });
  4934. return i.bind(this)(l);
  4935. };
  4936. };
  4937. });
  4938. }(kr)), kr.exports;
  4939. }
  4940. var kg = Pg();
  4941. const Fg = /* @__PURE__ */ wt(kg);
  4942. var Fr = { exports: {} }, $g = Fr.exports, Po;
  4943. function Bg() {
  4944. return Po || (Po = 1, function(t, e) {
  4945. (function(n, r) {
  4946. t.exports = r();
  4947. })($g, function() {
  4948. var n = { LTS: "h:mm:ss A", LT: "h:mm A", L: "MM/DD/YYYY", LL: "MMMM D, YYYY", LLL: "MMMM D, YYYY h:mm A", LLLL: "dddd, MMMM D, YYYY h:mm A" }, r = /(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g, s = /\d/, i = /\d\d/, o = /\d\d?/, a = /\d*[^-_:/,()\s\d]+/, u = {}, c = function(O) {
  4949. return (O = +O) + (O > 68 ? 1900 : 2e3);
  4950. }, l = function(O) {
  4951. return function(U) {
  4952. this[O] = +U;
  4953. };
  4954. }, h = [/[+-]\d\d:?(\d\d)?|Z/, function(O) {
  4955. (this.zone || (this.zone = {})).offset = function(U) {
  4956. if (!U || U === "Z") return 0;
  4957. var ne = U.match(/([+-]|\d\d)/g), X = 60 * ne[1] + (+ne[2] || 0);
  4958. return X === 0 ? 0 : ne[0] === "+" ? -X : X;
  4959. }(O);
  4960. }], d = function(O) {
  4961. var U = u[O];
  4962. return U && (U.indexOf ? U : U.s.concat(U.f));
  4963. }, f = function(O, U) {
  4964. var ne, X = u.meridiem;
  4965. if (X) {
  4966. for (var de = 1; de <= 24; de += 1) if (O.indexOf(X(de, 0, U)) > -1) {
  4967. ne = de > 12;
  4968. break;
  4969. }
  4970. } else ne = O === (U ? "pm" : "PM");
  4971. return ne;
  4972. }, E = { A: [a, function(O) {
  4973. this.afternoon = f(O, !1);
  4974. }], a: [a, function(O) {
  4975. this.afternoon = f(O, !0);
  4976. }], Q: [s, function(O) {
  4977. this.month = 3 * (O - 1) + 1;
  4978. }], S: [s, function(O) {
  4979. this.milliseconds = 100 * +O;
  4980. }], SS: [i, function(O) {
  4981. this.milliseconds = 10 * +O;
  4982. }], SSS: [/\d{3}/, function(O) {
  4983. this.milliseconds = +O;
  4984. }], s: [o, l("seconds")], ss: [o, l("seconds")], m: [o, l("minutes")], mm: [o, l("minutes")], H: [o, l("hours")], h: [o, l("hours")], HH: [o, l("hours")], hh: [o, l("hours")], D: [o, l("day")], DD: [i, l("day")], Do: [a, function(O) {
  4985. var U = u.ordinal, ne = O.match(/\d+/);
  4986. if (this.day = ne[0], U) for (var X = 1; X <= 31; X += 1) U(X).replace(/\[|\]/g, "") === O && (this.day = X);
  4987. }], w: [o, l("week")], ww: [i, l("week")], M: [o, l("month")], MM: [i, l("month")], MMM: [a, function(O) {
  4988. var U = d("months"), ne = (d("monthsShort") || U.map(function(X) {
  4989. return X.slice(0, 3);
  4990. })).indexOf(O) + 1;
  4991. if (ne < 1) throw new Error();
  4992. this.month = ne % 12 || ne;
  4993. }], MMMM: [a, function(O) {
  4994. var U = d("months").indexOf(O) + 1;
  4995. if (U < 1) throw new Error();
  4996. this.month = U % 12 || U;
  4997. }], Y: [/[+-]?\d+/, l("year")], YY: [i, function(O) {
  4998. this.year = c(O);
  4999. }], YYYY: [/\d{4}/, l("year")], Z: h, ZZ: h };
  5000. function R(O) {
  5001. var U, ne;
  5002. U = O, ne = u && u.formats;
  5003. for (var X = (O = U.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, function(ae, m, j) {
  5004. var y = j && j.toUpperCase();
  5005. return m || ne[j] || n[j] || ne[y].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(M, b, w) {
  5006. return b || w.slice(1);
  5007. });
  5008. })).match(r), de = X.length, T = 0; T < de; T += 1) {
  5009. var A = X[T], H = E[A], Z = H && H[0], fe = H && H[1];
  5010. X[T] = fe ? { regex: Z, parser: fe } : A.replace(/^\[|\]$/g, "");
  5011. }
  5012. return function(ae) {
  5013. for (var m = {}, j = 0, y = 0; j < de; j += 1) {
  5014. var M = X[j];
  5015. if (typeof M == "string") y += M.length;
  5016. else {
  5017. var b = M.regex, w = M.parser, k = ae.slice(y), $ = b.exec(k)[0];
  5018. w.call(m, $), ae = ae.replace($, "");
  5019. }
  5020. }
  5021. return function(Y) {
  5022. var se = Y.afternoon;
  5023. if (se !== void 0) {
  5024. var he = Y.hours;
  5025. se ? he < 12 && (Y.hours += 12) : he === 12 && (Y.hours = 0), delete Y.afternoon;
  5026. }
  5027. }(m), m;
  5028. };
  5029. }
  5030. return function(O, U, ne) {
  5031. ne.p.customParseFormat = !0, O && O.parseTwoDigitYear && (c = O.parseTwoDigitYear);
  5032. var X = U.prototype, de = X.parse;
  5033. X.parse = function(T) {
  5034. var A = T.date, H = T.utc, Z = T.args;
  5035. this.$u = H;
  5036. var fe = Z[1];
  5037. if (typeof fe == "string") {
  5038. var ae = Z[2] === !0, m = Z[3] === !0, j = ae || m, y = Z[2];
  5039. m && (y = Z[2]), u = this.$locale(), !ae && y && (u = ne.Ls[y]), this.$d = function(k, $, Y, se) {
  5040. try {
  5041. if (["x", "X"].indexOf($) > -1) return new Date(($ === "X" ? 1e3 : 1) * k);
  5042. var he = R($)(k), ge = he.year, Ae = he.month, be = he.day, v = he.hours, F = he.minutes, V = he.seconds, K = he.milliseconds, z = he.zone, W = he.week, ue = /* @__PURE__ */ new Date(), oe = be || (ge || Ae ? 1 : ue.getDate()), B = ge || ue.getFullYear(), ee = 0;
  5043. ge && !Ae || (ee = Ae > 0 ? Ae - 1 : ue.getMonth());
  5044. var ie, pe = v || 0, Oe = F || 0, Me = V || 0, G = K || 0;
  5045. return z ? new Date(Date.UTC(B, ee, oe, pe, Oe, Me, G + 60 * z.offset * 1e3)) : Y ? new Date(Date.UTC(B, ee, oe, pe, Oe, Me, G)) : (ie = new Date(B, ee, oe, pe, Oe, Me, G), W && (ie = se(ie).week(W).toDate()), ie);
  5046. } catch {
  5047. return /* @__PURE__ */ new Date("");
  5048. }
  5049. }(A, fe, H, ne), this.init(), y && y !== !0 && (this.$L = this.locale(y).$L), j && A != this.format(fe) && (this.$d = /* @__PURE__ */ new Date("")), u = {};
  5050. } else if (fe instanceof Array) for (var M = fe.length, b = 1; b <= M; b += 1) {
  5051. Z[1] = fe[b - 1];
  5052. var w = ne.apply(this, Z);
  5053. if (w.isValid()) {
  5054. this.$d = w.$d, this.$L = w.$L, this.init();
  5055. break;
  5056. }
  5057. b === M && (this.$d = /* @__PURE__ */ new Date(""));
  5058. }
  5059. else de.call(this, T);
  5060. };
  5061. };
  5062. });
  5063. }(Fr)), Fr.exports;
  5064. }
  5065. var jg = Bg();
  5066. const Hg = /* @__PURE__ */ wt(jg);
  5067. var $r = { exports: {} }, Wg = $r.exports, ko;
  5068. function zg() {
  5069. return ko || (ko = 1, function(t, e) {
  5070. (function(n, r) {
  5071. t.exports = r();
  5072. })(Wg, function() {
  5073. return function(n, r, s) {
  5074. var i = r.prototype, o = function(h) {
  5075. return h && (h.indexOf ? h : h.s);
  5076. }, a = function(h, d, f, E, R) {
  5077. var O = h.name ? h : h.$locale(), U = o(O[d]), ne = o(O[f]), X = U || ne.map(function(T) {
  5078. return T.slice(0, E);
  5079. });
  5080. if (!R) return X;
  5081. var de = O.weekStart;
  5082. return X.map(function(T, A) {
  5083. return X[(A + (de || 0)) % 7];
  5084. });
  5085. }, u = function() {
  5086. return s.Ls[s.locale()];
  5087. }, c = function(h, d) {
  5088. return h.formats[d] || function(f) {
  5089. return f.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(E, R, O) {
  5090. return R || O.slice(1);
  5091. });
  5092. }(h.formats[d.toUpperCase()]);
  5093. }, l = function() {
  5094. var h = this;
  5095. return { months: function(d) {
  5096. return d ? d.format("MMMM") : a(h, "months");
  5097. }, monthsShort: function(d) {
  5098. return d ? d.format("MMM") : a(h, "monthsShort", "months", 3);
  5099. }, firstDayOfWeek: function() {
  5100. return h.$locale().weekStart || 0;
  5101. }, weekdays: function(d) {
  5102. return d ? d.format("dddd") : a(h, "weekdays");
  5103. }, weekdaysMin: function(d) {
  5104. return d ? d.format("dd") : a(h, "weekdaysMin", "weekdays", 2);
  5105. }, weekdaysShort: function(d) {
  5106. return d ? d.format("ddd") : a(h, "weekdaysShort", "weekdays", 3);
  5107. }, longDateFormat: function(d) {
  5108. return c(h.$locale(), d);
  5109. }, meridiem: this.$locale().meridiem, ordinal: this.$locale().ordinal };
  5110. };
  5111. i.localeData = function() {
  5112. return l.bind(this)();
  5113. }, s.localeData = function() {
  5114. var h = u();
  5115. return { firstDayOfWeek: function() {
  5116. return h.weekStart || 0;
  5117. }, weekdays: function() {
  5118. return s.weekdays();
  5119. }, weekdaysShort: function() {
  5120. return s.weekdaysShort();
  5121. }, weekdaysMin: function() {
  5122. return s.weekdaysMin();
  5123. }, months: function() {
  5124. return s.months();
  5125. }, monthsShort: function() {
  5126. return s.monthsShort();
  5127. }, longDateFormat: function(d) {
  5128. return c(h, d);
  5129. }, meridiem: h.meridiem, ordinal: h.ordinal };
  5130. }, s.months = function() {
  5131. return a(u(), "months");
  5132. }, s.monthsShort = function() {
  5133. return a(u(), "monthsShort", "months", 3);
  5134. }, s.weekdays = function(h) {
  5135. return a(u(), "weekdays", null, null, h);
  5136. }, s.weekdaysShort = function(h) {
  5137. return a(u(), "weekdaysShort", "weekdays", 3, h);
  5138. }, s.weekdaysMin = function(h) {
  5139. return a(u(), "weekdaysMin", "weekdays", 2, h);
  5140. };
  5141. };
  5142. });
  5143. }($r)), $r.exports;
  5144. }
  5145. var Yg = zg();
  5146. const Vg = /* @__PURE__ */ wt(Yg);
  5147. var Br = { exports: {} }, Gg = Br.exports, Fo;
  5148. function Kg() {
  5149. return Fo || (Fo = 1, function(t, e) {
  5150. (function(n, r) {
  5151. t.exports = r();
  5152. })(Gg, function() {
  5153. var n = { LTS: "h:mm:ss A", LT: "h:mm A", L: "MM/DD/YYYY", LL: "MMMM D, YYYY", LLL: "MMMM D, YYYY h:mm A", LLLL: "dddd, MMMM D, YYYY h:mm A" };
  5154. return function(r, s, i) {
  5155. var o = s.prototype, a = o.format;
  5156. i.en.formats = n, o.format = function(u) {
  5157. u === void 0 && (u = "YYYY-MM-DDTHH:mm:ssZ");
  5158. var c = this.$locale().formats, l = function(h, d) {
  5159. return h.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, function(f, E, R) {
  5160. var O = R && R.toUpperCase();
  5161. return E || d[R] || n[R] || d[O].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(U, ne, X) {
  5162. return ne || X.slice(1);
  5163. });
  5164. });
  5165. }(u, c === void 0 ? {} : c);
  5166. return a.call(this, l);
  5167. };
  5168. };
  5169. });
  5170. }(Br)), Br.exports;
  5171. }
  5172. var Xg = Kg();
  5173. const Jg = /* @__PURE__ */ wt(Xg);
  5174. var jr = { exports: {} }, Zg = jr.exports, $o;
  5175. function Qg() {
  5176. return $o || ($o = 1, function(t, e) {
  5177. (function(n, r) {
  5178. t.exports = r();
  5179. })(Zg, function() {
  5180. var n = "minute", r = /[+-]\d\d(?::?\d\d)?/g, s = /([+-]|\d\d)/g;
  5181. return function(i, o, a) {
  5182. var u = o.prototype;
  5183. a.utc = function(R) {
  5184. var O = { date: R, utc: !0, args: arguments };
  5185. return new o(O);
  5186. }, u.utc = function(R) {
  5187. var O = a(this.toDate(), { locale: this.$L, utc: !0 });
  5188. return R ? O.add(this.utcOffset(), n) : O;
  5189. }, u.local = function() {
  5190. return a(this.toDate(), { locale: this.$L, utc: !1 });
  5191. };
  5192. var c = u.parse;
  5193. u.parse = function(R) {
  5194. R.utc && (this.$u = !0), this.$utils().u(R.$offset) || (this.$offset = R.$offset), c.call(this, R);
  5195. };
  5196. var l = u.init;
  5197. u.init = function() {
  5198. if (this.$u) {
  5199. var R = this.$d;
  5200. this.$y = R.getUTCFullYear(), this.$M = R.getUTCMonth(), this.$D = R.getUTCDate(), this.$W = R.getUTCDay(), this.$H = R.getUTCHours(), this.$m = R.getUTCMinutes(), this.$s = R.getUTCSeconds(), this.$ms = R.getUTCMilliseconds();
  5201. } else l.call(this);
  5202. };
  5203. var h = u.utcOffset;
  5204. u.utcOffset = function(R, O) {
  5205. var U = this.$utils().u;
  5206. if (U(R)) return this.$u ? 0 : U(this.$offset) ? h.call(this) : this.$offset;
  5207. if (typeof R == "string" && (R = function(T) {
  5208. T === void 0 && (T = "");
  5209. var A = T.match(r);
  5210. if (!A) return null;
  5211. var H = ("" + A[0]).match(s) || ["-", 0, 0], Z = H[0], fe = 60 * +H[1] + +H[2];
  5212. return fe === 0 ? 0 : Z === "+" ? fe : -fe;
  5213. }(R), R === null)) return this;
  5214. var ne = Math.abs(R) <= 16 ? 60 * R : R, X = this;
  5215. if (O) return X.$offset = ne, X.$u = R === 0, X;
  5216. if (R !== 0) {
  5217. var de = this.$u ? this.toDate().getTimezoneOffset() : -1 * this.utcOffset();
  5218. (X = this.local().add(ne + de, n)).$offset = ne, X.$x.$localOffset = de;
  5219. } else X = this.utc();
  5220. return X;
  5221. };
  5222. var d = u.format;
  5223. u.format = function(R) {
  5224. var O = R || (this.$u ? "YYYY-MM-DDTHH:mm:ss[Z]" : "");
  5225. return d.call(this, O);
  5226. }, u.valueOf = function() {
  5227. var R = this.$utils().u(this.$offset) ? 0 : this.$offset + (this.$x.$localOffset || this.$d.getTimezoneOffset());
  5228. return this.$d.valueOf() - 6e4 * R;
  5229. }, u.isUTC = function() {
  5230. return !!this.$u;
  5231. }, u.toISOString = function() {
  5232. return this.toDate().toISOString();
  5233. }, u.toString = function() {
  5234. return this.toDate().toUTCString();
  5235. };
  5236. var f = u.toDate;
  5237. u.toDate = function(R) {
  5238. return R === "s" && this.$offset ? a(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate() : f.call(this);
  5239. };
  5240. var E = u.diff;
  5241. u.diff = function(R, O, U) {
  5242. if (R && this.$u === R.$u) return E.call(this, R, O, U);
  5243. var ne = this.local(), X = a(R).local();
  5244. return E.call(ne, X, O, U);
  5245. };
  5246. };
  5247. });
  5248. }(jr)), jr.exports;
  5249. }
  5250. var qg = Qg();
  5251. const ep = /* @__PURE__ */ wt(qg);
  5252. var Hr = { exports: {} }, tp = Hr.exports, Bo;
  5253. function np() {
  5254. return Bo || (Bo = 1, function(t, e) {
  5255. (function(n, r) {
  5256. t.exports = r();
  5257. })(tp, function() {
  5258. return function(n, r) {
  5259. r.prototype.weekday = function(s) {
  5260. var i = this.$locale().weekStart || 0, o = this.$W, a = (o < i ? o + 7 : o) - i;
  5261. return this.$utils().u(s) ? a : this.subtract(a, "day").add(s, "day");
  5262. };
  5263. };
  5264. });
  5265. }(Hr)), Hr.exports;
  5266. }
  5267. var rp = np();
  5268. const sp = /* @__PURE__ */ wt(rp);
  5269. var Wr = { exports: {} }, ip = Wr.exports, jo;
  5270. function op() {
  5271. return jo || (jo = 1, function(t, e) {
  5272. (function(n, r) {
  5273. t.exports = r();
  5274. })(ip, function() {
  5275. var n = "week", r = "year";
  5276. return function(s, i, o) {
  5277. var a = i.prototype;
  5278. a.week = function(u) {
  5279. if (u === void 0 && (u = null), u !== null) return this.add(7 * (u - this.week()), "day");
  5280. var c = this.$locale().yearStart || 1;
  5281. if (this.month() === 11 && this.date() > 25) {
  5282. var l = o(this).startOf(r).add(1, r).date(c), h = o(this).endOf(n);
  5283. if (l.isBefore(h)) return 1;
  5284. }
  5285. var d = o(this).startOf(r).date(c).startOf(n).subtract(1, "millisecond"), f = this.diff(d, n, !0);
  5286. return f < 0 ? o(this).startOf("week").week() : Math.ceil(f);
  5287. }, a.weeks = function(u) {
  5288. return u === void 0 && (u = null), this.week(u);
  5289. };
  5290. };
  5291. });
  5292. }(Wr)), Wr.exports;
  5293. }
  5294. var ap = op();
  5295. const up = /* @__PURE__ */ wt(ap);
  5296. var zr = { exports: {} }, lp = zr.exports, Ho;
  5297. function cp() {
  5298. return Ho || (Ho = 1, function(t, e) {
  5299. (function(n, r) {
  5300. t.exports = r();
  5301. })(lp, function() {
  5302. return function(n, r) {
  5303. r.prototype.weekYear = function() {
  5304. var s = this.month(), i = this.week(), o = this.year();
  5305. return i === 1 && s === 11 ? o + 1 : s === 0 && i >= 52 ? o - 1 : o;
  5306. };
  5307. };
  5308. });
  5309. }(zr)), zr.exports;
  5310. }
  5311. var hp = cp();
  5312. const dp = /* @__PURE__ */ wt(hp);
  5313. rn.extend(Hg);
  5314. rn.extend(Fg);
  5315. rn.extend(sp);
  5316. rn.extend(Vg);
  5317. rn.extend(up);
  5318. rn.extend(dp);
  5319. rn.extend(ep);
  5320. rn.extend(Jg);
  5321. function Li(t, e, n, r) {
  5322. if (t > e)
  5323. throw new Error("a1 should be less than a2");
  5324. if (n > r)
  5325. throw new Error("b1 should be less than b2");
  5326. if (e < n || r < t)
  5327. return [t, e];
  5328. if (n <= t && r >= e)
  5329. return [];
  5330. const s = r - n + 1;
  5331. return t < n && e > r ? [t, e - s] : n <= t && r < e ? [r + 1 - s, e - s] : n > t && r >= e ? [t, n - 1] : [t, e];
  5332. }
  5333. function TC(t) {
  5334. if (t == null)
  5335. return !1;
  5336. const e = t.bullet;
  5337. return (e == null ? void 0 : e.listId) != null;
  5338. }
  5339. function MC(t) {
  5340. if (t == null)
  5341. return !1;
  5342. const e = t.paragraphStyle;
  5343. return fp(e);
  5344. }
  5345. function fp(t) {
  5346. var e;
  5347. return !(t == null || (t.indentStart == null || t.indentStart.v === 0) && t.hanging == null || ((e = t.hanging) == null ? void 0 : e.v) === 0);
  5348. }
  5349. function gp(t, e, n) {
  5350. return t.slice(0, e) + n + t.slice(e);
  5351. }
  5352. function pp(t, e, n) {
  5353. return e > n ? t : t.slice(0, e) + t.slice(n);
  5354. }
  5355. const mp = /\s/g;
  5356. function DC(t) {
  5357. return t === null || t.toString().replace(mp, "") === "" || typeof t == "boolean" ? !1 : !isNaN(t);
  5358. }
  5359. function xC(t) {
  5360. let e = 0;
  5361. for (let n = 0; n < t.length; n++)
  5362. e = t.charCodeAt(n) + (e << 6) + (e << 16) - e;
  5363. return e >>> 0;
  5364. }
  5365. const Ye = Symbol("newer"), rt = Symbol("older");
  5366. class _p {
  5367. constructor(e) {
  5368. C(this, "entry");
  5369. this.entry = e;
  5370. }
  5371. [Symbol.iterator]() {
  5372. return this;
  5373. }
  5374. next() {
  5375. const e = this.entry;
  5376. return e ? (this.entry = e[Ye], { done: !1, value: e.key }) : { done: !0, value: void 0 };
  5377. }
  5378. }
  5379. class Ep {
  5380. constructor(e) {
  5381. C(this, "entry");
  5382. this.entry = e;
  5383. }
  5384. [Symbol.iterator]() {
  5385. return this;
  5386. }
  5387. next() {
  5388. const e = this.entry;
  5389. return e ? (this.entry = e[Ye], { done: !1, value: e.value }) : { done: !0, value: void 0 };
  5390. }
  5391. }
  5392. class Cp {
  5393. constructor(e) {
  5394. C(this, "entry");
  5395. this.entry = e;
  5396. }
  5397. [Symbol.iterator]() {
  5398. return this;
  5399. }
  5400. next() {
  5401. const e = this.entry;
  5402. return e ? (this.entry = e[Ye], { done: !1, value: [e.key, e.value] }) : { done: !0, value: void 0 };
  5403. }
  5404. }
  5405. var Ta, Ma;
  5406. Ma = Ye, Ta = rt;
  5407. class Wo {
  5408. constructor(e, n) {
  5409. C(this, "key");
  5410. C(this, "value");
  5411. C(this, Ma);
  5412. C(this, Ta);
  5413. this.key = e, this.value = n, this[Ye] = void 0, this[rt] = void 0;
  5414. }
  5415. toJSON() {
  5416. return {
  5417. key: this.key,
  5418. value: this.value
  5419. };
  5420. }
  5421. }
  5422. class Qr {
  5423. constructor(...e) {
  5424. C(this, "_keymap");
  5425. C(this, "size", 0);
  5426. C(this, "limit");
  5427. C(this, "oldest");
  5428. C(this, "newest");
  5429. C(this, "_onShiftListeners", []);
  5430. if (Cr.hasLength(e, 1)) {
  5431. if (Cr.isNumber(e[0])) {
  5432. const n = e[0];
  5433. this._initialize(n, void 0);
  5434. return;
  5435. }
  5436. if (Cr.isIterable(e[0])) {
  5437. const n = e[0];
  5438. this._initialize(0, n);
  5439. return;
  5440. }
  5441. return;
  5442. }
  5443. if (Cr.hasLength(e, 2)) {
  5444. const n = e[0], r = e[1];
  5445. this._initialize(n, r);
  5446. }
  5447. }
  5448. onShift(e) {
  5449. if (this._onShiftListeners.indexOf(e) === -1)
  5450. return this._onShiftListeners.push(e), Ze(() => cs(this._onShiftListeners, e));
  5451. throw new Error("[LRUMap]: the listener has been registered!");
  5452. }
  5453. _initialize(e, n) {
  5454. this.oldest = void 0, this.newest = void 0, this.size = 0, this.limit = e, this._keymap = /* @__PURE__ */ new Map(), n && (this.assign(n), e < 1 && (this.limit = this.size));
  5455. }
  5456. _markEntryAsUsed(e) {
  5457. e !== this.newest && (e[Ye] && (e === this.oldest && (this.oldest = e[Ye]), e[Ye][rt] = e[rt]), e[rt] && (e[rt][Ye] = e[Ye]), e[Ye] = void 0, e[rt] = this.newest, this.newest && (this.newest[Ye] = e), this.newest = e);
  5458. }
  5459. assign(e) {
  5460. let n, r = this.limit || Number.MAX_VALUE;
  5461. this._keymap.clear();
  5462. const s = e[Symbol.iterator]();
  5463. for (let i = s.next(); !i.done; i = s.next()) {
  5464. const o = new Wo(i.value[0], i.value[1]);
  5465. if (this._keymap.set(o.key, o), n ? (n[Ye] = o, o[rt] = n) : this.oldest = o, n = o, r-- === 0)
  5466. throw new Error("overflow");
  5467. }
  5468. this.newest = n, this.size = this._keymap.size;
  5469. }
  5470. set(e, n) {
  5471. let r = this._keymap.get(e);
  5472. return r ? (r.value = n, this._markEntryAsUsed(r), this) : (this._keymap.set(e, r = new Wo(e, n)), this.newest ? (this.newest[Ye] = r, r[rt] = this.newest) : this.oldest = r, this.newest = r, ++this.size, this.size > this.limit && this.shift(), this);
  5473. }
  5474. shift() {
  5475. const e = this.oldest;
  5476. if (e)
  5477. return this.oldest && this.oldest[Ye] ? (this.oldest = this.oldest[Ye], this.oldest[rt] = void 0) : (this.oldest = void 0, this.newest = void 0), e[Ye] = e[rt] = void 0, this._keymap.delete(e.key), --this.size, this._onShiftListeners.forEach((n) => n(e)), [e.key, e.value];
  5478. }
  5479. get(e) {
  5480. const n = this._keymap.get(e);
  5481. if (n)
  5482. return this._markEntryAsUsed(n), n.value;
  5483. }
  5484. has(e) {
  5485. return this._keymap.has(e);
  5486. }
  5487. find(e) {
  5488. const n = this._keymap.get(e);
  5489. return n ? n.value : void 0;
  5490. }
  5491. delete(e) {
  5492. const n = this._keymap.get(e);
  5493. if (n)
  5494. return this._keymap.delete(n.key), n[Ye] && n[rt] ? (n[rt][Ye] = n[Ye], n[Ye][rt] = n[rt]) : n[Ye] ? (n[Ye][rt] = void 0, this.oldest = n[Ye]) : n[rt] ? (n[rt][Ye] = void 0, this.newest = n[rt]) : this.oldest = this.newest = void 0, this.size--, n.value;
  5495. }
  5496. clear() {
  5497. this.oldest = void 0, this.newest = void 0, this.size = 0, this._keymap.clear();
  5498. }
  5499. keys() {
  5500. return new _p(this.oldest);
  5501. }
  5502. values() {
  5503. return new Ep(this.oldest);
  5504. }
  5505. entries() {
  5506. return this[Symbol.iterator]();
  5507. }
  5508. [Symbol.iterator]() {
  5509. return new Cp(this.oldest);
  5510. }
  5511. forEach(e, n) {
  5512. typeof n != "object" && (n = this);
  5513. let r = this.oldest;
  5514. for (; r; )
  5515. e.call(n, r.value, r.key, this), r = r[Ye];
  5516. }
  5517. toJSON() {
  5518. const e = new Array(this.size);
  5519. let n = 0, r = this.oldest;
  5520. for (; r; )
  5521. e[n++] = { key: r.key, value: r.value }, r = r[Ye];
  5522. return e;
  5523. }
  5524. toString() {
  5525. let e = "", n = this.oldest;
  5526. for (; n; )
  5527. e += `${String(n.key)}:${n.value}`, n = n[Ye], n && (e += " < ");
  5528. return e;
  5529. }
  5530. }
  5531. class Cr {
  5532. static hasLength(e, n) {
  5533. return e.length === n;
  5534. }
  5535. static getValueType(e) {
  5536. return Object.prototype.toString.apply(e);
  5537. }
  5538. static isObject(e) {
  5539. return this.getValueType(e) === "[object Object]";
  5540. }
  5541. static isIterable(e) {
  5542. return e[Symbol.iterator] != null;
  5543. }
  5544. static isNumber(e) {
  5545. return this.getValueType(e) === "[object Number]";
  5546. }
  5547. }
  5548. var Yr = { exports: {} }, Rp = Yr.exports, zo;
  5549. function Ip() {
  5550. return zo || (zo = 1, function(t, e) {
  5551. (function(n, r) {
  5552. t.exports = r();
  5553. })(typeof self < "u" ? self : Rp, function() {
  5554. return function() {
  5555. var n = { d: function(_, g) {
  5556. for (var p in g) n.o(g, p) && !n.o(_, p) && Object.defineProperty(_, p, { enumerable: !0, get: g[p] });
  5557. }, o: function(_, g) {
  5558. return Object.prototype.hasOwnProperty.call(_, g);
  5559. } }, r = {};
  5560. n.d(r, { default: function() {
  5561. return ht;
  5562. } });
  5563. var s = { 1078: "af", 1052: "sq", 1118: "am", 5121: "ar_DZ", 15361: "ar_BH", 3073: "ar_EG", 2049: "ar_IQ", 11265: "ar_JO", 13313: "ar_KW", 12289: "ar_LB", 4097: "ar_LY", 6145: "ar_MA", 8193: "ar_OM", 16385: "ar_QA", 1025: "ar_SA", 10241: "ar_SY", 7169: "ar_TN", 14337: "ar_AE", 9217: "ar_YE", 1067: "hy", 1101: "as", 2092: "az_AZ", 1068: "az_AZ", 1069: "eu", 1059: "be", 2117: "bn", 1093: "bn_IN", 5146: "bs", 1026: "bg", 1109: "my", 1027: "ca", 2052: "zh_CN", 3076: "zh_HK", 5124: "zh_MO", 4100: "zh_SG", 1028: "zh_TW", 1050: "hr", 1029: "cs", 1030: "da", 1125: "dv", 2067: "nl_BE", 1043: "nl_NL", 1126: "bin", 3081: "en_AU", 10249: "en_BZ", 4105: "en_CA", 9225: "en_CB", 2057: "en_GB", 16393: "en_IN", 6153: "en_IE", 8201: "en_JM", 5129: "en_NZ", 13321: "en_PH", 7177: "en_ZA", 11273: "en_TT", 1033: "en_US", 12297: "en_ZW", 1061: "et", 1071: "mk", 1080: "fo", 1065: "fa", 1124: "fil", 1035: "fi", 2060: "fr_BE", 11276: "fr_CM", 3084: "fr_CA", 9228: "fr_CG", 12300: "fr_CI", 1036: "fr_FR", 5132: "fr_LU", 13324: "fr_ML", 6156: "fr_MC", 14348: "fr_MA", 10252: "fr_SN", 4108: "fr_CH", 7180: "fr", 1122: "fy_NL", 2108: "gd_IE", 1084: "gd", 1110: "gl", 1079: "ka", 3079: "de_AT", 1031: "de_DE", 5127: "de_LI", 4103: "de_LU", 2055: "de_CH", 1032: "el", 1140: "gn", 1095: "gu", 1279: "en", 1037: "he", 1081: "hi", 1038: "hu", 1039: "is", 1136: "ig_NG", 1057: "id", 1040: "it_IT", 2064: "it_CH", 1041: "ja", 1099: "kn", 1120: "ks", 1087: "kk", 1107: "km", 1111: "kok", 1042: "ko", 1088: "ky", 1108: "lo", 1142: "la", 1062: "lv", 1063: "lt", 2110: "ms_BN", 1086: "ms_MY", 1100: "ml", 1082: "mt", 1112: "mni", 1153: "mi", 1102: "mr", 1104: "mn", 2128: "mn", 1121: "ne", 1044: "no_NO", 2068: "no_NO", 1096: "or", 1045: "pl", 1046: "pt_BR", 2070: "pt_PT", 1094: "pa", 1047: "rm", 2072: "ro_MO", 1048: "ro_RO", 1049: "ru", 2073: "ru_MO", 1083: "se", 1103: "sa", 3098: "sr_SP", 2074: "sr_SP", 1072: "st", 1074: "tn", 1113: "sd", 1115: "si", 1051: "sk", 1060: "sl", 1143: "so", 1070: "sb", 11274: "es_AR", 16394: "es_BO", 13322: "es_CL", 9226: "es_CO", 5130: "es_CR", 7178: "es_DO", 12298: "es_EC", 17418: "es_SV", 4106: "es_GT", 18442: "es_HN", 2058: "es_MX", 19466: "es_NI", 6154: "es_PA", 15370: "es_PY", 10250: "es_PE", 20490: "es_PR", 1034: "es_ES", 14346: "es_UY", 8202: "es_VE", 1089: "sw", 2077: "sv_FI", 1053: "sv_SE", 1114: "syc", 1064: "tg", 1097: "ta", 1092: "tt", 1098: "te", 1054: "th", 1105: "bo", 1073: "ts", 1055: "tr", 1090: "tk", 1058: "uk", 1056: "ur", 2115: "uz_UZ", 1091: "uz_UZ", 1075: "ve", 1066: "vi", 1106: "cy", 1076: "xh", 1085: "yi", 1077: "zu" };
  5564. const i = /^([a-z\d]+)(?:[_-]([a-z\d]+))?(?:\.([a-z\d]+))?(?:@([a-z\d]+))?$/i, o = {}, a = { group: " ", decimal: ".", positive: "+", negative: "-", percent: "%", exponent: "E", nan: "NaN", infinity: "∞", ampm: ["AM", "PM"], mmmm6: ["Muharram", "Safar", "Rabiʻ I", "Rabiʻ II", "Jumada I", "Jumada II", "Rajab", "Shaʻban", "Ramadan", "Shawwal", "Dhuʻl-Qiʻdah", "Dhuʻl-Hijjah"], mmm6: ["Muh.", "Saf.", "Rab. I", "Rab. II", "Jum. I", "Jum. II", "Raj.", "Sha.", "Ram.", "Shaw.", "Dhuʻl-Q.", "Dhuʻl-H."], mmmm: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], mmm: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], dddd: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], ddd: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"] };
  5565. function u(_) {
  5566. const g = i.exec(_);
  5567. if (!g) throw new SyntaxError("Malformed locale: ".concat(_));
  5568. return { lang: g[1] + (g[2] ? "_" + g[2] : ""), language: g[1], territory: g[2] || "", codeset: g[3] || "", modifier: g[4] || "" };
  5569. }
  5570. function c(_) {
  5571. if (typeof _ == "number") return s[65535 & _] || null;
  5572. const g = parseInt(_, 16);
  5573. return isFinite(g) && s[65535 & g] ? s[65535 & g] || null : i.test(_) ? _ : null;
  5574. }
  5575. function l(_) {
  5576. const g = c(_);
  5577. let p = null;
  5578. if (g) {
  5579. const S = u(g);
  5580. p = o[S.lang] || o[S.language] || null;
  5581. }
  5582. return p;
  5583. }
  5584. function h(_) {
  5585. return Object.assign({}, a, _);
  5586. }
  5587. function d(_, g) {
  5588. const p = typeof g == "object" ? g : u(g);
  5589. return o[p.lang] = h(_), p.language === p.lang || o[p.language] || (o[p.language] = h(_)), o[p.lang];
  5590. }
  5591. const f = h({ group: "," });
  5592. function E(_, g) {
  5593. if (typeof _ != "number") return _;
  5594. if (_ < 0) return -E(-_, g);
  5595. if (g) {
  5596. const p = 10 ** (g || 0) || 1;
  5597. return E(_ * p, 0) / p;
  5598. }
  5599. return Math.round(_);
  5600. }
  5601. f.isDefault = !0, d({ group: ",", ampm: ["上午", "下午"], mmmm: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"], mmm: ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"], dddd: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"], ddd: ["周日", "周一", "周二", "周三", "周四", "周五", "周六"] }, "zh_CN"), d({ group: ",", nan: "非數值", ampm: ["上午", "下午"], mmmm: ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"], mmm: ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"], dddd: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"], ddd: ["週日", "週一", "週二", "週三", "週四", "週五", "週六"] }, "zh_TW"), d({ group: ",", ampm: ["午前", "午後"], mmmm: ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"], mmm: ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"], dddd: ["日曜日", "月曜日", "火曜日", "水曜日", "木曜日", "金曜日", "土曜日"], ddd: ["日", "月", "火", "水", "木", "金", "土"] }, "ja"), d({ group: ",", ampm: ["오전", "오후"], mmmm: ["1월", "2월", "3월", "4월", "5월", "6월", "7월", "8월", "9월", "10월", "11월", "12월"], mmm: ["1월", "2월", "3월", "4월", "5월", "6월", "7월", "8월", "9월", "10월", "11월", "12월"], dddd: ["일요일", "월요일", "화요일", "수요일", "목요일", "금요일", "토요일"], ddd: ["일", "월", "화", "수", "목", "금", "토"] }, "ko"), d({ group: ",", ampm: ["ก่อนเที่ยง", "หลังเที่ยง"], mmmm: ["มกราคม", "กุมภาพันธ์", "มีนาคม", "เมษายน", "พฤษภาคม", "มิถุนายน", "กรกฎาคม", "สิงหาคม", "กันยายน", "ตุลาคม", "พฤศจิกายน", "ธันวาคม"], mmm: ["ม.ค.", "ก.พ.", "มี.ค.", "เม.ย.", "พ.ค.", "มิ.ย.", "ก.ค.", "ส.ค.", "ก.ย.", "ต.ค.", "พ.ย.", "ธ.ค."], dddd: ["วันอาทิตย์", "วันจันทร์", "วันอังคาร", "วันพุธ", "วันพฤหัสบดี", "วันศุกร์", "วันเสาร์"], ddd: ["อา.", "จ.", "อ.", "พ.", "พฤ.", "ศ.", "ส."] }, "th"), d({ decimal: ",", ampm: ["dop.", "odp."], mmmm: ["ledna", "února", "března", "dubna", "května", "června", "července", "srpna", "září", "října", "listopadu", "prosince"], mmm: ["led", "úno", "bře", "dub", "kvě", "čvn", "čvc", "srp", "zář", "říj", "lis", "pro"], dddd: ["neděle", "pondělí", "úterý", "středa", "čtvrtek", "pátek", "sobota"], ddd: ["ne", "po", "út", "st", "čt", "pá", "so"] }, "cs"), d({ group: ".", decimal: ",", mmmm: ["januar", "februar", "marts", "april", "maj", "juni", "juli", "august", "september", "oktober", "november", "december"], mmm: ["jan.", "feb.", "mar.", "apr.", "maj", "jun.", "jul.", "aug.", "sep.", "okt.", "nov.", "dec."], dddd: ["søndag", "mandag", "tirsdag", "onsdag", "torsdag", "fredag", "lørdag"], ddd: ["søn.", "man.", "tir.", "ons.", "tor.", "fre.", "lør."] }, "da"), d({ group: ".", decimal: ",", ampm: ["a.m.", "p.m."], mmmm: ["januari", "februari", "maart", "april", "mei", "juni", "juli", "augustus", "september", "oktober", "november", "december"], mmm: ["jan.", "feb.", "mrt.", "apr.", "mei", "jun.", "jul.", "aug.", "sep.", "okt.", "nov.", "dec."], dddd: ["zondag", "maandag", "dinsdag", "woensdag", "donderdag", "vrijdag", "zaterdag"], ddd: ["zo", "ma", "di", "wo", "do", "vr", "za"] }, "nl"), d({ group: "," }, "en"), d({ decimal: ",", nan: "epäluku", ampm: ["ap.", "ip."], mmmm: ["tammikuuta", "helmikuuta", "maaliskuuta", "huhtikuuta", "toukokuuta", "kesäkuuta", "heinäkuuta", "elokuuta", "syyskuuta", "lokakuuta", "marraskuuta", "joulukuuta"], mmm: ["tammik.", "helmik.", "maalisk.", "huhtik.", "toukok.", "kesäk.", "heinäk.", "elok.", "syysk.", "lokak.", "marrask.", "jouluk."], dddd: ["sunnuntaina", "maanantaina", "tiistaina", "keskiviikkona", "torstaina", "perjantaina", "lauantaina"], ddd: ["su", "ma", "ti", "ke", "to", "pe", "la"] }, "fi"), d({ group: " ", decimal: ",", mmmm: ["janvier", "février", "mars", "avril", "mai", "juin", "juillet", "août", "septembre", "octobre", "novembre", "décembre"], mmm: ["janv.", "févr.", "mars", "avr.", "mai", "juin", "juil.", "août", "sept.", "oct.", "nov.", "déc."], dddd: ["dimanche", "lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi"], ddd: ["dim.", "lun.", "mar.", "mer.", "jeu.", "ven.", "sam."] }, "fr"), d({ group: ".", decimal: ",", mmmm: ["Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"], mmm: ["Jan.", "Feb.", "März", "Apr.", "Mai", "Juni", "Juli", "Aug.", "Sept.", "Okt.", "Nov.", "Dez."], dddd: ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"], ddd: ["So.", "Mo.", "Di.", "Mi.", "Do.", "Fr.", "Sa."] }, "de"), d({ group: ".", decimal: ",", ampm: ["π.μ.", "μ.μ."], mmmm: ["Ιανουαρίου", "Φεβρουαρίου", "Μαρτίου", "Απριλίου", "Μαΐου", "Ιουνίου", "Ιουλίου", "Αυγούστου", "Σεπτεμβρίου", "Οκτωβρίου", "Νοεμβρίου", "Δεκεμβρίου"], mmm: ["Ιαν", "Φεβ", "Μαρ", "Απρ", "Μαΐ", "Ιουν", "Ιουλ", "Αυγ", "Σεπ", "Οκτ", "Νοε", "Δεκ"], dddd: ["Κυριακή", "Δευτέρα", "Τρίτη", "Τετάρτη", "Πέμπτη", "Παρασκευή", "Σάββατο"], ddd: ["Κυρ", "Δευ", "Τρί", "Τετ", "Πέμ", "Παρ", "Σάβ"] }, "el"), d({ decimal: ",", ampm: ["de.", "du."], mmmm: ["január", "február", "március", "április", "május", "június", "július", "augusztus", "szeptember", "október", "november", "december"], mmm: ["jan.", "febr.", "márc.", "ápr.", "máj.", "jún.", "júl.", "aug.", "szept.", "okt.", "nov.", "dec."], dddd: ["vasárnap", "hétfő", "kedd", "szerda", "csütörtök", "péntek", "szombat"], ddd: ["V", "H", "K", "Sze", "Cs", "P", "Szo"] }, "hu"), d({ group: ".", decimal: ",", ampm: ["f.h.", "e.h."], mmmm: ["janúar", "febrúar", "mars", "apríl", "maí", "júní", "júlí", "ágúst", "september", "október", "nóvember", "desember"], mmm: ["jan.", "feb.", "mar.", "apr.", "maí", "jún.", "júl.", "ágú.", "sep.", "okt.", "nóv.", "des."], dddd: ["sunnudagur", "mánudagur", "þriðjudagur", "miðvikudagur", "fimmtudagur", "föstudagur", "laugardagur"], ddd: ["sun.", "mán.", "þri.", "mið.", "fim.", "fös.", "lau."] }, "is"), d({ group: ".", decimal: ",", mmmm: ["Januari", "Februari", "Maret", "April", "Mei", "Juni", "Juli", "Agustus", "September", "Oktober", "November", "Desember"], mmm: ["Jan", "Feb", "Mar", "Apr", "Mei", "Jun", "Jul", "Agu", "Sep", "Okt", "Nov", "Des"], dddd: ["Minggu", "Senin", "Selasa", "Rabu", "Kamis", "Jumat", "Sabtu"], ddd: ["Min", "Sen", "Sel", "Rab", "Kam", "Jum", "Sab"] }, "id"), d({ group: ".", decimal: ",", mmmm: ["gennaio", "febbraio", "marzo", "aprile", "maggio", "giugno", "luglio", "agosto", "settembre", "ottobre", "novembre", "dicembre"], mmm: ["gen", "feb", "mar", "apr", "mag", "giu", "lug", "ago", "set", "ott", "nov", "dic"], dddd: ["domenica", "lunedì", "martedì", "mercoledì", "giovedì", "venerdì", "sabato"], ddd: ["dom", "lun", "mar", "mer", "gio", "ven", "sab"] }, "it"), d({ decimal: ",", ampm: ["a.m.", "p.m."], mmmm: ["januar", "februar", "mars", "april", "mai", "juni", "juli", "august", "september", "oktober", "november", "desember"], mmm: ["jan.", "feb.", "mar.", "apr.", "mai", "jun.", "jul.", "aug.", "sep.", "okt.", "nov.", "des."], dddd: ["søndag", "mandag", "tirsdag", "onsdag", "torsdag", "fredag", "lørdag"], ddd: ["søn.", "man.", "tir.", "ons.", "tor.", "fre.", "lør."] }, "nb"), d({ decimal: ",", mmmm: ["stycznia", "lutego", "marca", "kwietnia", "maja", "czerwca", "lipca", "sierpnia", "września", "października", "listopada", "grudnia"], mmm: ["sty", "lut", "mar", "kwi", "maj", "cze", "lip", "sie", "wrz", "paź", "lis", "gru"], dddd: ["niedziela", "poniedziałek", "wtorek", "środa", "czwartek", "piątek", "sobota"], ddd: ["niedz.", "pon.", "wt.", "śr.", "czw.", "pt.", "sob."] }, "pl"), d({ group: ".", decimal: ",", mmmm: ["janeiro", "fevereiro", "março", "abril", "maio", "junho", "julho", "agosto", "setembro", "outubro", "novembro", "dezembro"], mmm: ["jan.", "fev.", "mar.", "abr.", "mai.", "jun.", "jul.", "ago.", "set.", "out.", "nov.", "dez."], dddd: ["domingo", "segunda-feira", "terça-feira", "quarta-feira", "quinta-feira", "sexta-feira", "sábado"], ddd: ["dom.", "seg.", "ter.", "qua.", "qui.", "sex.", "sáb."] }, "pt"), d({ decimal: ",", nan: "не число", mmmm: ["января", "февраля", "марта", "апреля", "мая", "июня", "июля", "августа", "сентября", "октября", "ноября", "декабря"], mmm: ["янв.", "февр.", "мар.", "апр.", "мая", "июн.", "июл.", "авг.", "сент.", "окт.", "нояб.", "дек."], dddd: ["воскресенье", "понедельник", "вторник", "среда", "четверг", "пятница", "суббота"], ddd: ["вс", "пн", "вт", "ср", "чт", "пт", "сб"] }, "ru"), d({ decimal: ",", mmmm: ["januára", "februára", "marca", "apríla", "mája", "júna", "júla", "augusta", "septembra", "októbra", "novembra", "decembra"], mmm: ["jan", "feb", "mar", "apr", "máj", "jún", "júl", "aug", "sep", "okt", "nov", "dec"], dddd: ["nedeľa", "pondelok", "utorok", "streda", "štvrtok", "piatok", "sobota"], ddd: ["ne", "po", "ut", "st", "št", "pi", "so"] }, "sk"), d({ group: ".", decimal: ",", ampm: ["a. m.", "p. m."], mmmm: ["enero", "febrero", "marzo", "abril", "mayo", "junio", "julio", "agosto", "septiembre", "octubre", "noviembre", "diciembre"], mmm: ["ene.", "feb.", "mar.", "abr.", "may.", "jun.", "jul.", "ago.", "sept.", "oct.", "nov.", "dic."], dddd: ["domingo", "lunes", "martes", "miércoles", "jueves", "viernes", "sábado"], ddd: ["dom.", "lun.", "mar.", "mié.", "jue.", "vie.", "sáb."] }, "es"), d({ decimal: ",", ampm: ["fm", "em"], mmmm: ["januari", "februari", "mars", "april", "maj", "juni", "juli", "augusti", "september", "oktober", "november", "december"], mmm: ["jan.", "feb.", "mars", "apr.", "maj", "juni", "juli", "aug.", "sep.", "okt.", "nov.", "dec."], dddd: ["söndag", "måndag", "tisdag", "onsdag", "torsdag", "fredag", "lördag"], ddd: ["sön", "mån", "tis", "ons", "tors", "fre", "lör"] }, "sv"), d({ group: ".", decimal: ",", ampm: ["ÖÖ", "ÖS"], mmmm: ["Ocak", "Şubat", "Mart", "Nisan", "Mayıs", "Haziran", "Temmuz", "Ağustos", "Eylül", "Ekim", "Kasım", "Aralık"], mmm: ["Oca", "Şub", "Mar", "Nis", "May", "Haz", "Tem", "Ağu", "Eyl", "Eki", "Kas", "Ara"], dddd: ["Pazar", "Pazartesi", "Salı", "Çarşamba", "Perşembe", "Cuma", "Cumartesi"], ddd: ["Paz", "Pzt", "Sal", "Çar", "Per", "Cum", "Cmt"] }, "tr");
  5602. function R(_, g, p) {
  5603. const S = _ < 0 ? -1 : 1, N = 10 ** (g || 2), L = 10 ** (p || 2);
  5604. let x, P, I = Math.abs(_), Q = 0, _e = 0, J = 0, me = 1;
  5605. if ((_ = I) % 1 == 0) P = [_ * S, 1];
  5606. else if (_ < 1e-19) P = [S, 1e19];
  5607. else if (_ > 1e19) P = [1e19 * S, 1];
  5608. else {
  5609. do
  5610. if (I = 1 / (I - Math.floor(I)), x = me, me = me * Math.floor(I) + Q, Q = x, _e = J, J = Math.floor(_ * me + 0.5), J >= N || me >= L) return [S * _e, Q];
  5611. while (Math.abs(_ - J / me) >= 1e-10 && I !== Math.floor(I));
  5612. P = [S * J, me];
  5613. }
  5614. return P;
  5615. }
  5616. const O = { overflow: "######", dateErrorThrows: !1, dateErrorNumber: !0, dateSpanLarge: !0, leap1900: !0, nbsp: !0, throws: !0, invalid: "######", locale: "", ignoreTimezone: !1 }, U = Object.assign({}, O);
  5617. function ne(_) {
  5618. if (_ === null && (_ = O), _) {
  5619. for (const g in _) if (g in O) {
  5620. const p = _[g];
  5621. U[g] = p == null ? O[g] : p;
  5622. }
  5623. }
  5624. return { ...U };
  5625. }
  5626. const X = { "#": "", 0: "0", "?": " " }, de = { "@": "text", "-": "minus", "+": "plus" }, T = ["#000", "#FFF", "#F00", "#0F0", "#00F", "#FF0", "#F0F", "#0FF", "#000", "#FFF", "#F00", "#0F0", "#00F", "#FF0", "#F0F", "#0FF", "#800", "#080", "#008", "#880", "#808", "#088", "#CCC", "#888", "#99F", "#936", "#FFC", "#CFF", "#606", "#F88", "#06C", "#CCF", "#008", "#F0F", "#FF0", "#0FF", "#808", "#800", "#088", "#00F", "#0CF", "#CFF", "#CFC", "#FF9", "#9CF", "#F9C", "#C9F", "#FC9", "#36F", "#3CC", "#9C0", "#FC0"], A = ["¤", "$", "£", "¥", "֏", "؋", "৳", "฿", "៛", "₡", "₦", "₩", "₪", "₫", "€", "₭", "₮", "₱", "₲", "₴", "₸", "₹", "₺", "₼", "₽", "₾", "₿"], H = new RegExp("[" + A.join("") + "]");
  5627. function Z(_, g, p) {
  5628. return g[p + "_max"] = _.length, g[p + "_min"] = _.replace(/#/g, "").length, g;
  5629. }
  5630. const fe = {};
  5631. function ae(_) {
  5632. if (!(_ in fe)) {
  5633. const g = [], p = _.replace(/^[#,]+/, "").replace(/[1-9]\d*/g, (S) => "?".repeat(S.length));
  5634. for (let S = 0; S < p.length; S++) {
  5635. const N = p.charAt(S);
  5636. g[S] = N in X ? X[N] : N;
  5637. }
  5638. fe[_] = g.join("");
  5639. }
  5640. return fe[_];
  5641. }
  5642. function m(_, g) {
  5643. typeof _ == "string" && (_ = { type: "string", value: _ = _.replace(/ /g, X["?"]) }), g.push(_);
  5644. }
  5645. function j(_) {
  5646. const g = [], p = { scale: 1, percent: !1, text: !1, date: 0, date_eval: !1, date_system: 1, sec_decimals: 0, general: !1, clock: 24, int_pattern: [], frac_pattern: [], man_pattern: [], den_pattern: [], num_pattern: [], tokens: g };
  5647. let S = _ + "", N = "int", L = !1, x = null;
  5648. const P = [];
  5649. let I, Q, _e = !1;
  5650. for (; S && !L; ) {
  5651. if (I = /^General/i.exec(S)) p.general = !0, m({ type: "general" }, g);
  5652. else if (N === "int" && (I = /^[#?0]+(?:,[#?0]+)*/.exec(S)) || N === "den" && (I = /^[#?\d]+/.exec(S)) || (I = /^[#?0]+/.exec(S))) p[N + "_pattern"].push(I[0]), x = { type: N, num: I[0] }, m(x, g);
  5653. else if ((I = /^\//.exec(S)) && p[N + "_pattern"].length) {
  5654. if (!x) throw new SyntaxError("Missing a numerator in pattern ".concat(_));
  5655. p.fractions = !0, p.num_pattern.push(p[N + "_pattern"].pop()), x.type = "num", N = "den", m({ type: "div" }, g);
  5656. } else if (I = /^,+/.exec(S)) {
  5657. const D = S.charAt(1) in X;
  5658. Q.slice(-1) in X && (I[0].length > 1 || !D) ? p.scale = 1e-3 ** I[0].length : p.dec_fractions || m(I[0], g);
  5659. } else {
  5660. if (I = /^;/.exec(S)) {
  5661. L = !0;
  5662. break;
  5663. }
  5664. if (I = /^[@+-]/.exec(S)) I[0] === "@" && (p.text = !0), m({ type: de[I[0]] }, g);
  5665. else if (I = /^(?:\[(h+|m+|s+)\])/i.exec(S)) {
  5666. const D = I[1].toLowerCase(), q = D[0], Ce = { type: "", size: 0, date: 1, raw: I[0], pad: D.length };
  5667. q === "h" ? (Ce.size = 16, Ce.type = "hour-elap") : q === "m" ? (Ce.size = 32, Ce.type = "min-elap") : (Ce.size = 64, Ce.type = "sec-elap"), p.date = p.date | Ce.size, P.push(Ce), m(Ce, g);
  5668. } else if (I = /^(?:B2)/i.exec(S)) _e || (p.date_system = 6);
  5669. else if (I = /^(?:B1)/i.exec(S)) _e || (p.date_system = 1);
  5670. else if (I = /^(?:([hHmMsSyYbBdDegG])\1*)/.exec(S)) {
  5671. const D = { type: "", size: 0, date: 1, raw: I[0] }, q = I[0].toLowerCase(), Ce = q[0];
  5672. if (q === "y" || q === "yy") D.size = 2, D.type = "year-short";
  5673. else if (Ce === "y" || Ce === "e") D.size = 2, D.type = "year";
  5674. else if (q === "b" || q === "bb") D.size = 2, D.type = "b-year-short";
  5675. else if (Ce === "b") D.size = 2, D.type = "b-year";
  5676. else if (q === "d" || q === "dd") D.size = 8, D.type = "day", D.pad = /dd/.test(q);
  5677. else if (q === "ddd") D.size = 8, D.type = "weekday-short";
  5678. else if (Ce === "d") D.size = 8, D.type = "weekday";
  5679. else if (Ce === "h") D.size = 16, D.type = "hour", D.pad = /hh/i.test(q);
  5680. else if (Ce === "m") {
  5681. q.length === 3 ? (D.size = 4, D.type = "monthname-short") : q.length === 5 ? (D.size = 4, D.type = "monthname-single") : q.length >= 4 && (D.size = 4, D.type = "monthname");
  5682. const Se = P[P.length - 1];
  5683. !D.type && Se && !Se.used && 80 & Se.size && (Se.used = !0, D.size = 32, D.type = "min", D.pad = /mm/.test(q)), D.type || (D.size = 4, D.type = "month", D.pad = /mm/.test(q), D.indeterminate = !0);
  5684. } else if (Ce === "s") {
  5685. D.size = 64, D.type = "sec", D.pad = /ss/.test(q);
  5686. const Se = P[P.length - 1];
  5687. Se && 32 & Se.size ? D.used = !0 : Se && Se.indeterminate && (delete Se.indeterminate, Se.size = 32, Se.type = "min", D.used = !0);
  5688. }
  5689. p.date = p.date | D.size, p.date_eval = !0, P.push(D), m(D, g);
  5690. } else if (I = /^(?:AM\/PM|am\/pm|A\/P)/.exec(S)) p.clock = 12, p.date = 16 | p.date, p.date_eval = !0, m({ type: "am", short: I[0] === "A/P" }, g);
  5691. else if (p.date && (I = /^\.0{1,3}/i.exec(S))) {
  5692. const D = I[0].length - 1, q = [64, 128, 256, 512][D];
  5693. p.date = p.date | q, p.date_eval = !0, p.sec_decimals = Math.max(p.sec_decimals, D), m({ type: "subsec", size: q, decimals: D, date: 1, raw: I[0] }, g);
  5694. } else if ((I = /^\\(.)/.exec(S)) || (I = /^"([^"]*?)"/.exec(S))) m(I[1], g);
  5695. else if (I = /^\[(<[=>]?|>=?|=)\s*(-?[.\d]+)\]/.exec(S)) p.condition = [I[1], parseFloat(I[2], 10)];
  5696. else if (I = /^\[\$([^\]]+)\]/.exec(S)) {
  5697. const D = I[1].split("-"), q = D.length < 2 ? "" : D[D.length - 1], Ce = D[0];
  5698. Ce && m(Ce, g);
  5699. const Se = c(q);
  5700. Se && (p.locale = Se);
  5701. const Le = parseInt(q, 16);
  5702. isFinite(Le) && 16711680 & Le && (Le >> 16 & 255) === 6 && (p.date_system = 6), _e = !0;
  5703. } else if (I = /^\[(black|blue|cyan|green|magenta|red|white|yellow|color\s*(\d+))\]/i.exec(S)) p.color = I[2] ? T[parseInt(I[2], 10)] || "#000" : I[1].toLowerCase();
  5704. else if (!(I = /^\[(DBNum1|ENG|HIJ|JPN|TWN)\]/i.exec(S))) {
  5705. if (I = /^%/.exec(S)) p.scale = 100, p.percent = !0, m("%", g);
  5706. else if (I = /^_(\\.|.)/.exec(S)) m(" ", g);
  5707. else if (I = /^\./.exec(S)) m({ type: "point", value: I[0] }, g), p.dec_fractions = !0, N = "frac";
  5708. else if (I = /^[Ee]([+-]?|(?=[0#?]))/.exec(S)) p.exponential = !0, p.exp_plus = I[1] === "+", N = "man", m({ type: "exp", plus: I[1] === "+" }, g);
  5709. else if (!(I = /^\*(\\.|.)/.exec(S))) {
  5710. if (I = /^[BENn[]/.exec(S)) throw new SyntaxError("Unexpected char ".concat(S.charAt(0), " in pattern ").concat(_));
  5711. S[0] === "(" && (p.parens = !0), I = [S[0]], m(I[0], g);
  5712. }
  5713. }
  5714. }
  5715. Q = I[0], S = S.slice(I ? I[0].length : 1);
  5716. }
  5717. if (p.pattern = _.slice(0, _.length - S.length), /^((?:\[[^\]]+\])+)(;|$)/.test(p.pattern) && !/^\[(?:h+|m+|s+)\]/.test(p.pattern) && m({ type: "text" }, g), p.fractions && p.dec_fractions || p.fractions && p.exponential) throw new SyntaxError("Invalid pattern: ".concat(p.pattern));
  5718. const J = p.int_pattern.join("");
  5719. if (p.grouping = J.indexOf(",") >= 0, p.grouping) {
  5720. const D = J.split(","), q = D.length;
  5721. q === 2 ? (p.group_pri = D[1].length, p.group_sec = p.group_pri) : q > 2 && (p.group_pri = D[q - 1].length, p.group_sec = D[q - 2].length);
  5722. } else p.group_pri = 0, p.group_sec = 0;
  5723. Z(J.replace(/[,]/g, ""), p, "int"), Z(p.frac_pattern.join(""), p, "frac"), Z(p.man_pattern.join(""), p, "man");
  5724. let me = p.num_pattern.join(""), ye = p.den_pattern.join("");
  5725. const le = /\?/.test(ye) || /\?/.test(me);
  5726. return ye = ye.replace(/\d/g, le ? "?" : "#"), le && (ye = ye.replace(/#$/g, "?")), Z(me, p, "num"), Z(ye, p, "den"), le && (me = me.replace(/#$/g, "?")), p.int_padding = ae(p.int_pattern.join("")), p.man_padding = ae(p.man_pattern.join("")), p.num_padding = ae(me), p.den_padding = ae(ye), p.den_pattern.length && (p.denominator = parseInt(p.den_pattern.join("").replace(/\D/g, ""), 10)), p.integer = !!p.int_pattern.join("").length, p.fractions && g.forEach((D, q) => {
  5727. const Ce = g[q + 1];
  5728. D.type === "string" && Ce && (Ce.type === "num" ? D.rule = "num+int" : Ce.type === "div" ? D.rule = "num" : Ce.type === "den" && (D.rule = "den"));
  5729. }), p;
  5730. }
  5731. const y = (_) => {
  5732. const g = _.condition;
  5733. g && g[1] < 0 && (g[0] === "<" || g[0] === "<=" || g[0] === "=") || _.tokens.unshift({ type: "minus", volatile: !0 });
  5734. };
  5735. function M(_) {
  5736. const g = [];
  5737. let p, S = !1, N = null, L = _, x = 0, P = !1, I = 0, Q = 0;
  5738. do {
  5739. if (P = j(L), (P.date || P.general) && (P.int_pattern.length || P.frac_pattern.length || P.scale !== 1 || P.text)) throw new Error("Illegal format");
  5740. if (P.condition && (Q++, S = !0), P.text) {
  5741. if (N) throw new Error("Unexpected partition");
  5742. N = P;
  5743. }
  5744. P.locale && (p = c(P.locale)), g.push(P), x = L.charAt(P.pattern.length) === ";" ? 1 : 0, L = L.slice(P.pattern.length + x), I++;
  5745. } while (x && I < 4 && Q < 3);
  5746. if (x) throw new Error("Unexpected partition");
  5747. if (Q > 2) throw new Error("Unexpected condition");
  5748. const _e = g[3];
  5749. if (_e && (_e.int_pattern.length || _e.frac_pattern.length || _e.date)) throw new Error("Unexpected partition");
  5750. if (S) {
  5751. const J = g.length;
  5752. if (J === 1 && (g[1] = j("General"), g[1].generated = !0), J < 3) {
  5753. const me = g[0], ye = g[1];
  5754. if (y(me), ye.condition) y(ye);
  5755. else {
  5756. const le = me.condition;
  5757. (le[0] === "=" || le[1] >= 0 && (le[0] === ">" || le[0] === ">=")) && ye.tokens.unshift({ type: "minus", volatile: !0 });
  5758. }
  5759. } else g.forEach(y);
  5760. } else {
  5761. if (g.length < 4 && N) for (let J = 0, me = g.length; J < me; J++) g[J] === N && g.splice(J, 1);
  5762. if (g.length < 1 && N && (g[0] = j("General"), g[0].generated = !0), g.length < 2) {
  5763. const J = j(g[0].pattern);
  5764. J.tokens.unshift({ type: "minus", volatile: !0 }), J.generated = !0, g.push(J);
  5765. }
  5766. if (g.length < 3) {
  5767. const J = j(g[0].pattern);
  5768. J.generated = !0, g.push(J);
  5769. }
  5770. if (g.length < 4) if (N) g.push(N);
  5771. else {
  5772. const J = j("@");
  5773. J.generated = !0, g.push(J);
  5774. }
  5775. g[0].condition = [">", 0], g[1].condition = ["<", 0], g[2].condition = null;
  5776. }
  5777. return { pattern: _, partitions: g, locale: p };
  5778. }
  5779. const b = Math.floor;
  5780. function w(_) {
  5781. if ((!(arguments.length > 1 && arguments[1] !== void 0) || arguments[1]) && _ >= 0) {
  5782. if (_ === 0) return [1900, 1, 0];
  5783. if (_ === 60) return [1900, 2, 29];
  5784. if (_ < 60) return [1900, _ < 32 ? 1 : 2, (_ - 1) % 31 + 1];
  5785. }
  5786. let p = _ + 68569 + 2415019;
  5787. const S = b(4 * p / 146097);
  5788. p -= b((146097 * S + 3) / 4);
  5789. const N = b(4e3 * (p + 1) / 1461001);
  5790. p = p - b(1461 * N / 4) + 31;
  5791. const L = b(80 * p / 2447), x = p - b(2447 * L / 80);
  5792. p = b(L / 11);
  5793. const P = L + 2 - 12 * p;
  5794. return [0 | 100 * (S - 49) + N + p, 0 | P, 0 | x];
  5795. }
  5796. function k(_) {
  5797. return w(_ + 1462);
  5798. }
  5799. function $(_) {
  5800. if (_ === 60) throw new Error("#VALUE!");
  5801. if (_ <= 1) return [1317, 8, 29];
  5802. if (_ < 60) return [1317, _ < 32 ? 9 : 10, 1 + (_ - 2) % 30];
  5803. const g = 10631 / 30, p = 0.1335;
  5804. let S = _ + 466935;
  5805. const N = b(S / 10631);
  5806. S -= 10631 * N;
  5807. const L = b((S - p) / g);
  5808. S -= b(L * g + p);
  5809. const x = b((S + 28.5001) / 29.5);
  5810. return x === 13 ? [30 * N + L, 12, 30] : [30 * N + L, x, S - b(29.5001 * x - 29)];
  5811. }
  5812. function Y(_) {
  5813. let g = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0, p = !(arguments.length > 2 && arguments[2] !== void 0) || arguments[2];
  5814. const S = b(_);
  5815. return g === 6 ? $(S) : g === -1 ? k(S) : w(S, p);
  5816. }
  5817. const se = Math.floor, he = 86400;
  5818. function ge(_, g) {
  5819. let p = null;
  5820. if (Array.isArray(_)) {
  5821. const [S, N, L, x, P, I] = _;
  5822. p = Date.UTC(S, N == null ? 0 : N - 1, L != null ? L : 1, x || 0, P || 0, I || 0);
  5823. } else if (_ instanceof Date && (p = 1 * _, !g || !g.ignoreTimezone)) {
  5824. const S = /* @__PURE__ */ new Date();
  5825. S.setUTCFullYear(_.getFullYear(), _.getMonth(), _.getDate()), S.setUTCHours(_.getHours(), _.getMinutes(), _.getSeconds(), _.getMilliseconds()), p = 1 * S;
  5826. }
  5827. if (p != null && isFinite(p)) {
  5828. const S = p / 864e5;
  5829. return S - (S <= -25509 ? -25568 : -25569);
  5830. }
  5831. return _;
  5832. }
  5833. function Ae(_, g) {
  5834. let p = 0 | _;
  5835. const S = he * (_ - p);
  5836. let N = se(S);
  5837. S - N > 0.9999 && (N += 1, N === he && (N = 0, p += 1));
  5838. const L = N < 0 ? he + N : N, [x, P, I] = Y(_, 0, g && g.leap1900), Q = se(L / 60 / 60) % 60, _e = se(L / 60) % 60, J = se(L) % 60;
  5839. if (g && g.nativeDate) {
  5840. const me = /* @__PURE__ */ new Date(0);
  5841. return me.setUTCFullYear(x, P - 1, I), me.setUTCHours(Q, _e, J), me;
  5842. }
  5843. return [x, P, I, Q, _e, J];
  5844. }
  5845. function be(_) {
  5846. return !!(_[0] && _[0].percent || _[1] && _[1].percent || _[2] && _[2].percent || _[3] && _[3].percent);
  5847. }
  5848. function v(_) {
  5849. return !!(_[0] && _[0].date || _[1] && _[1].date || _[2] && _[2].date || _[3] && _[3].date);
  5850. }
  5851. function F(_) {
  5852. const [g, p, S, N] = _;
  5853. return !(g && !g.generated || p && !p.generated || S && !S.generated || !N || !N.text || N.generated);
  5854. }
  5855. const V = { text: 15, datetime: 10.8, date: 10.8, time: 10.8, percent: 10.6, currency: 10.4, grouped: 10.2, scientific: 6, number: 4, fraction: 2, general: 0, error: 0 }, K = [["DMY", 1], ["DM", 2], ["MY", 3], ["MDY", 4], ["MD", 5], ["hmsa", 6], ["hma", 7], ["hms", 8], ["hm", 9]], z = { total: 1, sign: 0, period: 0, int: 1, frac: 0 }, W = (_, g) => _.replace(/\./, g.decimal);
  5856. function ue(_, g, p, S) {
  5857. const N = 0 | p;
  5858. if (typeof p == "string") _.push(p);
  5859. else if (p === N) _.push(Math.abs(N));
  5860. else {
  5861. const L = Math.abs(p);
  5862. let x = L ? Math.floor(Math.log10(L)) : 0, P = x < 0 ? L * 10 ** -x : L / 10 ** x;
  5863. P === 10 && (P = 1, x++);
  5864. const I = function(_e) {
  5865. let J = !(arguments.length > 1 && arguments[1] !== void 0) || arguments[1];
  5866. const me = Math.abs(_e);
  5867. if (!me) return z;
  5868. const ye = J && _e < 0 ? 1 : 0, le = Math.floor(me), D = Math.floor(Math.log10(me) + 1);
  5869. let q = 0, Ce = 0;
  5870. if (le !== me) {
  5871. q = 1;
  5872. const Se = String(E(D < 0 ? me * 10 ** -D : me / 10 ** D, 15));
  5873. let Le = Se.length, Ue = !0, je = 0;
  5874. for (; je <= Se.length; ) {
  5875. if (Se[je] === ".") {
  5876. Le--;
  5877. break;
  5878. }
  5879. Se[je] === "0" && Ue ? Le-- : Ue = !1, je++;
  5880. }
  5881. Ce = Le - D, Ce < 0 && (Ce = 0, q = 0);
  5882. }
  5883. return { total: ye + Math.max(D, 1) + q + Ce, digits: Math.max(D, 0) + Ce, sign: ye, period: q, int: Math.max(D, 1), frac: Ce };
  5884. }(L), Q = () => {
  5885. const _e = Math.abs(x);
  5886. let J;
  5887. J = P === 1 ? P : E(P, 5), _.push(W(J + "", S), S.exponent, x < 0 ? S.negative : S.positive, _e < 10 ? "0" : "", _e);
  5888. };
  5889. if (x >= -4 && x <= -1) {
  5890. const _e = L.toPrecision(10 + x).replace(/\.?0+$/, "");
  5891. _.push(W(_e, S));
  5892. } else if (x === 10) {
  5893. const _e = L.toFixed(10).slice(0, 12).replace(/\.$/, "");
  5894. _.push(W(_e, S));
  5895. } else if (Math.abs(x) <= 9) if (I.total <= 11) {
  5896. const _e = E(L, 9).toFixed(I.frac);
  5897. _.push(W(_e, S));
  5898. } else x === 9 ? _.push(Math.floor(L)) : x >= 0 && x < 9 ? _.push(E(L, 9 - x)) : Q();
  5899. else I.total >= 12 ? Q() : Math.floor(L) === L ? _.push(Math.floor(L)) : _.push(W(E(L, 9).toFixed(I.frac), S));
  5900. }
  5901. return _;
  5902. }
  5903. const oe = 86400, B = { int: "integer", frac: "fraction", man: "mantissa", num: "numerator", den: "denominator" }, ee = function(_) {
  5904. let g = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
  5905. const p = Math.floor(Math.log10(_));
  5906. return g > 1 ? Math.floor(p / g) * g : p;
  5907. };
  5908. function ie(_, g, p, S) {
  5909. let N = "", L = "", x = "", P = "", I = "", Q = 0, _e = 0 | _, J = 0, me = 0, ye = 1, le = 0, D = 0, q = 0, Ce = 0, Se = 0, Le = 0;
  5910. const Ue = S || f;
  5911. if (!g.text && isFinite(g.scale) && g.scale !== 1 && (_ = function(Ie) {
  5912. if (Ie === 0) return Ie;
  5913. const Ne = Math.ceil(Math.log10(Ie < 0 ? -Ie : Ie)), te = 10 ** (16 - Math.floor(Ne));
  5914. return Math.round(Ie * te) / te;
  5915. }(_ * g.scale)), g.exponential) {
  5916. let Ie = Math.abs(_);
  5917. if (Ie) {
  5918. const Ne = 10 ** -ee(Ie, g.int_max), te = E(Ie * Ne, g.frac_max) / Ne;
  5919. Q = ee(te, g.int_max);
  5920. }
  5921. Ie /= 10 ** Q, _ = _ < 0 ? -Ie : Ie, N += Math.abs(Q);
  5922. }
  5923. if (g.integer) {
  5924. const Ie = Math.abs(E(_, g.fractions ? 1 : g.frac_max));
  5925. I += Ie < 1 ? "" : Math.floor(Ie);
  5926. }
  5927. if (g.grouping) {
  5928. let Ie = "", Ne = I.length;
  5929. for (Ne > g.group_pri && (Ne -= g.group_pri, Ie = Ue.group + I.slice(Ne, Ne + g.group_pri) + Ie); Ne > g.group_sec; ) Ne -= g.group_sec, Ie = Ue.group + I.slice(Ne, Ne + g.group_sec) + Ie;
  5930. I = Ne ? I.slice(0, Ne) + Ie : Ie;
  5931. }
  5932. g.dec_fractions && (P = String(E(_, g.frac_max)).split(".")[1] || "");
  5933. let je = !1;
  5934. if (g.fractions) {
  5935. const Ie = Math.abs(g.integer ? _ % 1 : _);
  5936. if (Ie) if (je = !0, isFinite(g.denominator)) x += g.denominator, L += E(Ie * g.denominator), L === "0" && (L = "", x = "", je = !1, I || (I = "0"));
  5937. else {
  5938. const Ne = R(Ie, g.integer ? g.num_max : 1 / 0, g.den_max);
  5939. L += Ne[0], x += Ne[1], g.integer && L === "0" && (I || (I = "0"), L = "", x = "", je = !1);
  5940. }
  5941. }
  5942. if (g.date) {
  5943. _e = Math.trunc(_);
  5944. const Ie = oe * (_ - _e);
  5945. if (J = Math.floor(Ie), Le = Ie - J, Math.abs(Le) < 1e-6 ? Le = 0 : Le > 0.9999 && (Le = 0, J += 1, J === oe && (J = 0, _e += 1)), Le) {
  5946. const Ne = 512 & g.date || 256 & g.date || 128 & g.date;
  5947. (Ne === 512 && Le > 0.9995 || Ne === 256 && Le > 0.995 || Ne === 128 && Le > 0.95 || !Ne && Le >= 0.5) && (J++, Le = 0);
  5948. }
  5949. if (_e || g.date_system) {
  5950. const Ne = Y(_, g.date_system, p.leap1900);
  5951. me = Ne[0], ye = Ne[1], le = Ne[2];
  5952. }
  5953. if (J) {
  5954. const Ne = J < 0 ? oe + J : J;
  5955. Se = Math.floor(Ne) % 60, Ce = Math.floor(Ne / 60) % 60, q = Math.floor(Ne / 60 / 60) % 60;
  5956. }
  5957. if (D = (6 + _e) % 7, g.date_eval && (dt = _, pt = _e + J / oe, p.dateSpanLarge ? dt < -694324 || pt >= 35830291 : dt < 0 || pt >= 2958466)) {
  5958. if (p.dateErrorThrows) throw new Error("Date out of bounds");
  5959. return p.dateErrorNumber ? ue(_ < 0 ? [Ue.negative] : [], 0, _, Ue).join("") : p.overflow;
  5960. }
  5961. }
  5962. var dt, pt;
  5963. if (g.int_padding && (I = g.int_padding.length === 1 ? I || g.int_padding : g.int_padding.substring(0, g.int_padding.length - I.length) + I), g.num_padding && (L = g.num_padding.length === 1 ? L || g.num_padding : g.num_padding.substring(0, g.num_padding.length - L.length) + L), g.den_padding && (x = g.den_padding.length === 1 ? x || g.den_padding : x + g.den_padding.slice(x.length)), g.man_padding) {
  5964. const Ie = g.exp_plus ? "+" : "";
  5965. N = g.man_padding.length === 1 ? (Q < 0 ? "-" : Ie) + (N || g.man_padding) : (Q < 0 ? "-" : Ie) + g.man_padding.slice(0, g.man_padding.length - N.length) + N;
  5966. }
  5967. const Ee = [];
  5968. let qe = 0;
  5969. const ve = { int: 0, frac: 0, man: 0, num: 0, den: 0 };
  5970. for (let Ie = 0, Ne = g.tokens.length; Ie < Ne; Ie++) {
  5971. const te = g.tokens[Ie], ut = te.num ? te.num.length : 0;
  5972. if (te.type === "string") te.rule ? te.rule === "num" ? je ? Ee.push(te.value) : (g.num_min > 0 || g.den_min > 0) && Ee.push(te.value.replace(/./g, X["?"])) : te.rule === "num+int" ? je && I ? Ee.push(te.value) : g.den_min > 0 && (I || g.num_min) && Ee.push(te.value.replace(/./g, X["?"])) : te.rule === "den" && (je ? Ee.push(te.value) : (g.den_min > 0 || g.den_min > 0) && Ee.push(te.value.replace(/./g, X["?"]))) : Ee.push(te.value);
  5973. else if (te.type === "error") Ee.push(p.invalid);
  5974. else if (te.type === "point") Ee.push(g.date ? te.value : Ue.decimal);
  5975. else if (te.type === "general") ue(Ee, 0, _, Ue);
  5976. else if (te.type === "exp") Ee.push(Ue.exponent);
  5977. else if (te.type === "minus") te.volatile && g.date || te.volatile && (_ >= 0 || typeof _ != "number") || (te.volatile && !g.fractions && (g.integer || g.dec_fractions) ? (_ < 0 && I && I !== "0" || P) && Ee.push(Ue.negative) : Ee.push(Ue.negative));
  5978. else if (te.type === "plus") Ee.push(Ue.positive);
  5979. else if (te.type === "text") Ee.push(_);
  5980. else if (te.type === "div") je ? Ee.push("/") : g.num_min > 0 || g.den_min > 0 ? Ee.push(X["?"]) : Ee.push(X["#"]);
  5981. else if (te.type === "int") if (g.int_pattern.length === 1) Ee.push(I);
  5982. else {
  5983. const $e = qe ? g.int_pattern.join("").length - ve.int : 1 / 0, At = qe === g.int_pattern.length - 1 ? 0 : g.int_pattern.join("").length - (ve.int + te.num.length);
  5984. Ee.push(I.substring(I.length - $e, I.length - At)), qe++, ve.int += te.num.length;
  5985. }
  5986. else if (te.type === "frac") {
  5987. const $e = ve.frac;
  5988. for (let At = 0; At < ut; At++) Ee.push(P[At + $e] || X[te.num[At]]);
  5989. ve.frac += ut;
  5990. } else if (te.type in B) g[te.type + "_pattern"].length === 1 ? (te.type === "int" && Ee.push(I), te.type === "frac" && Ee.push(P), te.type === "man" && Ee.push(N), te.type === "num" && Ee.push(L), te.type === "den" && Ee.push(x)) : (Ee.push(B[te.type].slice(ve[te.type], ve[te.type] + ut)), ve[te.type] += ut);
  5991. else if (te.type === "year") me < 0 && Ee.push(Ue.negative), Ee.push(String(Math.abs(me)).padStart(4, "0"));
  5992. else if (te.type === "year-short") {
  5993. const $e = me % 100;
  5994. Ee.push($e < 10 ? "0" : "", $e);
  5995. } else if (te.type === "month") Ee.push(te.pad && ye < 10 ? "0" : "", ye);
  5996. else if (te.type === "monthname-single") g.date_system === 6 ? Ee.push(Ue.mmmm6[ye - 1].charAt(0)) : Ee.push(Ue.mmmm[ye - 1].charAt(0));
  5997. else if (te.type === "monthname-short") g.date_system === 6 ? Ee.push(Ue.mmm6[ye - 1]) : Ee.push(Ue.mmm[ye - 1]);
  5998. else if (te.type === "monthname") g.date_system === 6 ? Ee.push(Ue.mmmm6[ye - 1]) : Ee.push(Ue.mmmm[ye - 1]);
  5999. else if (te.type === "weekday-short") Ee.push(Ue.ddd[D]);
  6000. else if (te.type === "weekday") Ee.push(Ue.dddd[D]);
  6001. else if (te.type === "day") Ee.push(te.pad && le < 10 ? "0" : "", le);
  6002. else if (te.type === "hour") {
  6003. const $e = q % g.clock || (g.clock < 24 ? g.clock : 0);
  6004. Ee.push(te.pad && $e < 10 ? "0" : "", $e);
  6005. } else if (te.type === "min") Ee.push(te.pad && Ce < 10 ? "0" : "", Ce);
  6006. else if (te.type === "sec") Ee.push(te.pad && Se < 10 ? "0" : "", Se);
  6007. else if (te.type === "subsec") {
  6008. Ee.push(Ue.decimal);
  6009. const $e = Le.toFixed(g.sec_decimals);
  6010. Ee.push($e.slice(2, 2 + te.decimals));
  6011. } else if (te.type === "am") {
  6012. const $e = q < 12 ? 0 : 1;
  6013. te.short && !S ? Ee.push("AP"[$e]) : Ee.push(Ue.ampm[$e]);
  6014. } else if (te.type === "hour-elap") {
  6015. _ < 0 && Ee.push(Ue.negative);
  6016. const $e = 24 * _e + Math.floor(Math.abs(J) / 3600);
  6017. Ee.push(String(Math.abs($e)).padStart(te.pad, "0"));
  6018. } else if (te.type === "min-elap") {
  6019. _ < 0 && Ee.push(Ue.negative);
  6020. const $e = 1440 * _e + Math.floor(Math.abs(J) / 60);
  6021. Ee.push(String(Math.abs($e)).padStart(te.pad, "0"));
  6022. } else if (te.type === "sec-elap") {
  6023. _ < 0 && Ee.push(Ue.negative);
  6024. const $e = _e * oe + Math.abs(J);
  6025. Ee.push(String(Math.abs($e)).padStart(te.pad, "0"));
  6026. } else if (te.type === "b-year") Ee.push(me + 543);
  6027. else if (te.type === "b-year-short") {
  6028. const $e = (me + 543) % 100;
  6029. Ee.push($e < 10 ? "0" : "", $e);
  6030. }
  6031. }
  6032. return p.nbsp ? Ee.join("") : Ee.join("").replace(/\u00a0/g, " ");
  6033. }
  6034. function pe(_, g) {
  6035. for (let p = 0; p < 3; p++) {
  6036. const S = g[p];
  6037. if (S) {
  6038. let N;
  6039. if (S.condition) {
  6040. const L = S.condition[0], x = S.condition[1];
  6041. L === "=" ? N = _ === x : L === ">" ? N = _ > x : L === "<" ? N = _ < x : L === ">=" ? N = _ >= x : L === "<=" ? N = _ <= x : L === "<>" && (N = _ !== x);
  6042. } else N = !0;
  6043. if (N) return S;
  6044. }
  6045. }
  6046. }
  6047. const Oe = j("@"), Me = "black", G = {};
  6048. function Re(_, g) {
  6049. if (_) {
  6050. const p = _[0];
  6051. g[p] = g[p] || {}, Re(_.slice(1), g[p]);
  6052. } else g.$ = !0;
  6053. }
  6054. ["d-F-y", "d-F-Y", "d-M-y", "d-M-Y", "F-d-y", "F-d-Y", "F-j-y", "F-j-Y", "j-F-y", "j-F-Y", "j-M-y", "j-M-Y", "M-d-y", "M-d-Y", "M-j-y", "M-j-Y", "m-d-y", "m-d-Y", "m-j-y", "m-j-Y", "n-d-y", "n-d-Y", "n-j-y", "n-j-Y", "y-F-d", "y-F-j", "y-M-d", "y-M-j", "Y-F-d", "Y-F-j", "Y-M-d", "Y-m-d", "Y-M-j", "Y-m-j", "Y-n-d", "Y-n-j", "j-F", "j-M", "d-F", "d-M", "n-d", "n-j", "n-Y", "m-d", "m-j", "m-Y", "M-Y", "M-y", "F-y", "F-Y", "Y-M", "Y-n", "Y-m", "Y-F", "Y-M"].forEach((_) => {
  6055. Re(_, G), Re(_ + " x", G), Re(_ + " l", G), Re(_ + " l x", G), Re("l " + _, G), Re("l " + _ + " x", G), Re(_ + " D", G), Re(_ + " D x", G), Re("D " + _, G), Re("D " + _ + " x", G);
  6056. });
  6057. const He = { jan: 1, feb: 2, mar: 3, apr: 4, may: 5, jun: 6, jul: 7, aug: 8, sep: 9, oct: 10, nov: 11, dec: 12 }, Be = { january: 1, february: 2, march: 3, april: 4, june: 6, july: 7, august: 8, september: 9, october: 10, november: 11, december: 12 }, xe = { sunday: "l", monday: "l", tuesday: "l", wednesday: "l", thursday: "l", friday: "l", saturday: "l", sun: "D", mon: "D", tue: "D", wed: "D", thu: "D", fri: "D", sat: "D" }, Je = (/* @__PURE__ */ new Date()).getUTCFullYear();
  6058. function Rt(_) {
  6059. const g = new RegExp("^([\\s+%" + A.join("") + "(-]*)(((?:(?:\\d[\\d,]*)(?:\\.\\d*)?|(?:\\.\\d+)))([eE][+-]?\\d+)?)([\\s%" + A.join("") + ")]*)$").exec(_);
  6060. if (g) {
  6061. const [, p, S, N, L, x] = g;
  6062. let P = 1, I = "", Q = !1, _e = !1, J = !1, me = !1, ye = !1, le = null, D = !1, q = parseFloat(S.replace(/,/g, ""));
  6063. if (!isFinite(q)) return null;
  6064. for (let Se = 0; Se < p.length; Se++) {
  6065. const Le = p[Se];
  6066. if (Le === "-") {
  6067. if (Q || _e) return null;
  6068. Q = !0, P = -1;
  6069. } else if (H.test(Le)) {
  6070. if (ye) return null;
  6071. ye = !0, le = Le;
  6072. } else if (Le === "(") {
  6073. if (_e || Q) return null;
  6074. _e = !0, P = -1;
  6075. } else if (Le === "%") {
  6076. if (me) return null;
  6077. me = !0;
  6078. }
  6079. }
  6080. for (let Se = 0; Se < x.length; Se++) {
  6081. const Le = x[Se];
  6082. if (H.test(Le)) {
  6083. if (ye) return null;
  6084. ye = !0, le = Le, D = !0;
  6085. } else if (Le === ")") {
  6086. if (J || !_e) return null;
  6087. J = !0;
  6088. } else if (Le === "%") {
  6089. if (me) return null;
  6090. me = !0;
  6091. }
  6092. }
  6093. if (L) {
  6094. if (me || ye) return null;
  6095. I = "0.00E+00";
  6096. } else if (me) {
  6097. if (ye) return null;
  6098. I = N.includes(".") ? "0.00%" : "0%", q *= 0.01;
  6099. } else if (ye) {
  6100. const Se = N.includes(".") ? "#,##0.00" : "#,##0";
  6101. I = D ? Se + le : le + Se;
  6102. } else N.includes(",") && (I = N.includes(".") ? "#,##0.00" : "#,##0");
  6103. const Ce = { v: q * P };
  6104. return I && (Ce.z = I), Ce;
  6105. }
  6106. }
  6107. const We = (_, g, p) => {
  6108. const S = p.path || "", N = Object.keys(g);
  6109. for (let L = 0; L < N.length; L++) {
  6110. let x;
  6111. const P = N[L];
  6112. if (g[P]) {
  6113. if (P === "$" || P === "€") _ || (x = p);
  6114. else if (P === "-") {
  6115. const I = /^(\s*([./-]|,\s)\s*|\s+)/.exec(_);
  6116. if (I) {
  6117. const Q = I[1] === "-" || I[1] === "/" || I[1] === "." ? I[1] : " ";
  6118. if (!p.sep || p.sep === Q) {
  6119. const _e = I[0].replace(/\s+/g, " ");
  6120. x = We(_.slice(I[0].length), g[P], { ...p, sep: Q, path: S + _e });
  6121. }
  6122. }
  6123. } else if (P === " ") {
  6124. const I = /^[,.]?\s+/.exec(_);
  6125. if (I) {
  6126. const Q = I[0].replace(/\s+/g, " ");
  6127. x = We(_.slice(I[0].length), g[P], { ...p, path: S + Q });
  6128. }
  6129. } else if (P === "j" || P === "d") {
  6130. const I = /^(0?[1-9]|1\d|2\d|3[01])\b/.exec(_);
  6131. I && (x = We(_.slice(I[0].length), g[P], { ...p, day: I[0], path: S + P }));
  6132. } else if (P === "n" || P === "m") {
  6133. const I = /^(0?[1-9]|1[012])\b/.exec(_);
  6134. I && (x = We(_.slice(I[0].length), g[P], { ...p, month: +I[0], _mon: I[0], path: S + P }));
  6135. } else if (P === "F" || P === "M") {
  6136. const I = /^([a-z]{3,9})\b/i.exec(_), Q = I && (P === "F" ? Be : He)[I[0].toLowerCase()];
  6137. Q && (x = We(_.slice(I[0].length), g[P], { ...p, month: Q, _mon: I[0], path: S + P }));
  6138. } else if (P === "l" || P === "D") {
  6139. const I = /^([a-z]{3,9})\b/i.exec(_);
  6140. (I && xe[I[0].toLowerCase()]) === P && (x = We(_.slice(I[0].length), g[P], { ...p, path: S + P }));
  6141. } else if (P === "y") {
  6142. const I = /^\d\d\b/.exec(_);
  6143. if (I) {
  6144. const Q = +I[0] >= 30 ? +I[0] + 1900 : +I[0] + 2e3;
  6145. x = We(_.slice(I[0].length), g[P], { ...p, year: Q, path: S + P });
  6146. }
  6147. } else if (P === "Y") {
  6148. const I = /^\d\d\d\d\b/.exec(_);
  6149. I && (x = We(_.slice(I[0].length), g[P], { ...p, year: +I[0], path: S + P }));
  6150. } else {
  6151. if (P !== "x") throw new Error('Unknown date token "'.concat(P, '"'));
  6152. {
  6153. const I = ze(_);
  6154. I && (x = We("", g[P], { ...p, time: I.v, tf: I.z, path: S + P }));
  6155. }
  6156. }
  6157. if (x) return x;
  6158. }
  6159. }
  6160. };
  6161. function et(_, g) {
  6162. const p = We(_.trim(), G, { path: "" });
  6163. if (p) {
  6164. var S;
  6165. if (p.sep === "." && p.path.length === 3) return null;
  6166. const N = +((S = p.year) !== null && S !== void 0 ? S : Je);
  6167. if (p.day || (p.day = 1), !function(P, I, Q) {
  6168. if (Q < 1 || I < 1 || I > 12) return !1;
  6169. if (I === 2) {
  6170. if (Q > (P % 4 == 0 && P % 100 != 0 || P % 400 == 0 || P === 1900 ? 29 : 28)) return !1;
  6171. } else if ((I === 4 || I === 6 || I === 9 || I === 11) && Q > 30 || (I === 1 || I === 3 || I === 5 || I === 7 || I === 8 || I === 10 || I === 12) && Q > 31) return !1;
  6172. return !0;
  6173. }(N, p.month, p.day)) return null;
  6174. let L = -1 / 0;
  6175. if (N < 1900) return null;
  6176. N <= 1900 && p.month <= 2 ? L = 25568 : N < 1e4 && (L = 25569);
  6177. const x = Date.UTC(N, p.month - 1, p.day) / 864e5 + L + (p.time || 0);
  6178. if (x >= 0 && x <= 2958465) {
  6179. const P = p._mon[0] === "0" || p.day[0] === "0" || p._mon.length === 2 && p.day.length === 2, I = p.path.replace(/[jdlDnmMFyYx-]/g, (Q) => Q === "j" || Q === "d" ? P ? "dd" : "d" : Q === "D" ? "ddd" : Q === "l" ? "dddd" : Q === "n" || Q === "m" ? P ? "mm" : "m" : Q === "M" ? "mmm" : Q === "F" ? "mmmm" : Q === "y" ? "yy" : Q === "x" ? p.tf || "" : Q === "Y" ? "yyyy" : Q);
  6180. return g && g.nativeDate ? { v: Ae(x, g), z: I } : { v: x, z: I };
  6181. }
  6182. }
  6183. return null;
  6184. }
  6185. function ze(_) {
  6186. const g = /^\s*([10]?\d|2[0-4])(?::([0-5]\d|\d))?(?::([0-5]\d|\d))?(\.\d{1,10})?(?:\s*([AP])M?)?\s*$/i.exec(_);
  6187. if (g) {
  6188. const [, p, S, N, L, x] = g;
  6189. if (L && !N || !x && !S && !N) return null;
  6190. let P = 1 * (p || 0);
  6191. if (x) {
  6192. if (P >= 13) return null;
  6193. x[0] !== "p" && x[0] !== "P" || (P += 12);
  6194. }
  6195. return { v: (60 * P * 60 + 60 * (1 * (S || 0)) + 1 * (N || 0) + 1 * (L || 0)) / 86400, z: (p.length === 2 ? "hh" : "h") + ":mm" + (N ? ":ss" : "") + (x ? " AM/PM" : "") };
  6196. }
  6197. return null;
  6198. }
  6199. function ct(_) {
  6200. return /^\s*true\s*$/i.test(_) ? { v: !0 } : /^\s*false\s*$/i.test(_) ? { v: !1 } : null;
  6201. }
  6202. const it = {};
  6203. function xt(_, g) {
  6204. const { pattern: p, partitions: S, locale: N } = _, L = (I) => {
  6205. const Q = Object.assign({}, ne(), g, I);
  6206. return N && (Q.locale = N), Q;
  6207. }, x = (I, Q) => {
  6208. const _e = L(Q);
  6209. return function(J, me, ye) {
  6210. const le = l(ye.locale), D = me[3] ? me[3] : Oe;
  6211. if (typeof J == "boolean" && (J = J ? "TRUE" : "FALSE"), J == null) return "";
  6212. if (typeof J != "number") return ie(J, D, ye, le);
  6213. if (!isFinite(J)) {
  6214. const Ce = le || f;
  6215. return isNaN(J) ? Ce.nan : (J < 0 ? Ce.negative : "") + Ce.infinity;
  6216. }
  6217. const q = pe(J, me);
  6218. return q ? ie(J, q, ye, le) : ye.overflow;
  6219. }(ge(I, _e), S, _e);
  6220. };
  6221. x.color = (I, Q) => function(_e, J) {
  6222. if (typeof _e != "number" || !isFinite(_e)) return (J[3] ? J[3].color : Oe.color) || Me;
  6223. const me = pe(_e, J);
  6224. return me && me.color || Me;
  6225. }(ge(I, L(Q)), S);
  6226. const P = function(I) {
  6227. var Q;
  6228. let _e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null;
  6229. const [J, me] = I, ye = J.frac_max, le = { type: "general", isDate: v(I), isText: F(I), isPercent: be(I), maxDecimals: J.general ? 9 : ye, scale: (Q = J.scale) !== null && Q !== void 0 ? Q : 1, color: 0, parentheses: 0, grouped: J.grouping ? 1 : 0, _partitions: I }, D = !le.isDate && !le.isText && !J.error && J.tokens.some((Ue) => Ue.type === "string" && (_e ? Ue.value === _e : H.test(Ue.value)));
  6230. let q = "G", Ce = ye >= 0 ? Math.min(15, ye) : "", Se = "", Le = "";
  6231. if (me && me.color && (Le = "-", le.color = 1), J.parens && (Se = "()", le.parentheses = 1), D) q = "C", le.type = "currency";
  6232. else if (J.error) le.type = "error", le.maxDecimals = 0;
  6233. else if (le.isDate) {
  6234. let Ue = 0, je = 0, dt = "";
  6235. J.tokens.forEach((Ee) => {
  6236. const qe = Ee.type;
  6237. /^(b-)?year/.test(qe) ? (dt += "Y", je++) : qe.startsWith("month") ? (dt += "M", je++) : /^(week)?day/.test(qe) ? (dt += "D", je++) : qe !== "hour" && qe !== "min" && qe !== "sec" && qe !== "am" || (dt += qe[0], Ue++);
  6238. }), le.type = "date", je && Ue ? le.type = "datetime" : !je && Ue && (le.type = "time");
  6239. const pt = K.find((Ee) => dt.startsWith(Ee[0]));
  6240. q = pt ? "D" : "G", Ce = pt ? pt[1] : "";
  6241. } else le.isText ? (q = "G", le.type = "text", Ce = "", le.maxDecimals = 0) : J.general ? (q = "G", le.type = "general", Ce = "") : J.fractions ? (q = "G", le.type = "fraction", Ce = "") : J.exponential ? (q = "S", le.type = "scientific") : le.isPercent ? (q = "P", le.type = "percent") : J.grouping ? (q = ",", le.type = "grouped") : (J.int_max || ye) && (q = "F", le.type = "number");
  6242. return le.code = q + Ce + Le + Se, le.level = V[le.type], Object.freeze(le);
  6243. }(S, (g || {}).currency) || new SyntaxError();
  6244. return x.info = P, x.dateInfo = function(I) {
  6245. const [Q] = I;
  6246. return { year: !!(2 & Q.date), month: !!(4 & Q.date), day: !!(8 & Q.date), hours: !!(16 & Q.date), minutes: !!(32 & Q.date), seconds: !!(64 & Q.date), clockType: Q.clock === 12 ? 12 : 24 };
  6247. }(S), x.isPercent = () => !!P.isPercent, x.isDate = () => !!P.isDate, x.isText = () => !!P.isText, x.pattern = p, _.error && (x.error = _.error), x.options = L, x.locale = N || g && g.locale || "", Object.freeze(x);
  6248. }
  6249. function ke(_, g) {
  6250. _ || (_ = "General");
  6251. let p = null;
  6252. return it[_] ? p = it[_] : (p = Object.assign({}, ne(), g).throws ? M(_) : function(S) {
  6253. try {
  6254. return M(S);
  6255. } catch (N) {
  6256. const L = { tokens: [{ type: "error" }], error: N.message };
  6257. return { pattern: S, partitions: [L, L, L, L], error: N.message, locale: null };
  6258. }
  6259. }(_), p.error || (it[_] = p)), xt(p, g);
  6260. }
  6261. ke.isDate = (_) => ke(_, { throws: !1 }).isDate(), ke.isPercent = (_) => ke(_, { throws: !1 }).isPercent(), ke.isText = (_) => ke(_, { throws: !1 }).isText(), ke.getInfo = (_, g) => ke(_, { ...g, throws: !1 }).info, ke.getDateInfo = (_, g) => ke(_, { ...g, throws: !1 }).dateInfo, ke.dateToSerial = ge, ke.dateFromSerial = Ae, ke.options = ne, ke.dec2frac = R, ke.round = E, ke.codeToLocale = s, ke.parseLocale = u, ke.getLocale = l, ke.addLocale = (_, g) => {
  6262. const p = u(g);
  6263. return delete it[p.lang], delete it[p.language], d(_, p);
  6264. }, ke.format = function(_, g, p) {
  6265. let S = arguments.length > 3 && arguments[3] !== void 0 && arguments[3];
  6266. const N = p && typeof p == "object" ? p : { locale: p, throws: !S };
  6267. return ke(_, N)(ge(g, N), N);
  6268. }, ke.is_date = ke.isDate, ke.parseNumber = Rt, ke.parseDate = et, ke.parseTime = ze, ke.parseBool = ct, ke.parseValue = function(_, g) {
  6269. var p, S, N;
  6270. return (p = (S = (N = Rt(_)) !== null && N !== void 0 ? N : et(_, g)) !== null && S !== void 0 ? S : ze(_)) !== null && p !== void 0 ? p : ct(_);
  6271. };
  6272. var ht = ke;
  6273. return r = r.default;
  6274. }();
  6275. });
  6276. }(Yr)), Yr.exports;
  6277. }
  6278. var As, Yo;
  6279. function vp() {
  6280. return Yo || (Yo = 1, As = Ip()), As;
  6281. }
  6282. var yp = vp();
  6283. const wp = /* @__PURE__ */ wt(yp), Op = wp;
  6284. function fn(t) {
  6285. let e = 0;
  6286. const n = Object.keys(t);
  6287. for (const r of n) {
  6288. const s = Number(r);
  6289. e = Math.max(e, s);
  6290. }
  6291. return e + 1;
  6292. }
  6293. function Vo(t, e, n) {
  6294. const r = fn(n), s = n;
  6295. for (let i = r - 1; i >= t; i--)
  6296. s[i + 1] = s[i];
  6297. s[t] = e;
  6298. }
  6299. function Go(t, e, n) {
  6300. const r = Object.keys(n).reduce((s, i) => Math.max(s, Number.parseInt(i)), 0) + 1;
  6301. for (let s = t; s < r; s++)
  6302. s < t + e ? delete n[s] : n[s] !== void 0 && (n[s - e] = n[s], delete n[s]);
  6303. }
  6304. function LC(t, e) {
  6305. const n = t, r = Object.keys(n), s = r.length, i = e, o = Object.keys(i), a = o.length, u = {};
  6306. let c = 0;
  6307. for (let l = 0; l < s; l++, c++) {
  6308. const h = r[l];
  6309. u[c] = n[h];
  6310. }
  6311. for (let l = 0; l < a; l++, c++) {
  6312. const h = o[l];
  6313. u[c] = i[h];
  6314. }
  6315. return u;
  6316. }
  6317. function UC(t, e, n) {
  6318. const r = n;
  6319. if (fn(n) > 0) {
  6320. const i = {};
  6321. let o = 0;
  6322. for (let a = t; a <= e; a++)
  6323. r[a] && (i[o] = r[a], o++);
  6324. return i;
  6325. }
  6326. return {};
  6327. }
  6328. function Ko(t, e, n, r) {
  6329. const s = t > n;
  6330. if (!s && t + e > n)
  6331. throw new Error("Invalid move operation");
  6332. s ? bp(t, e, n, r) : Sp(t, e, n, r);
  6333. }
  6334. function bp(t, e, n, r) {
  6335. const s = r, i = [];
  6336. for (let o = t; o < t + e; o++)
  6337. i.push(s[o]);
  6338. for (let o = t - 1; o >= n; o--) {
  6339. const a = s[o];
  6340. s[o + e] = a, a === void 0 && delete s[o + e];
  6341. }
  6342. i.forEach((o, a) => {
  6343. s[n + a] = o, o === void 0 && delete s[n + a];
  6344. });
  6345. }
  6346. function Sp(t, e, n, r) {
  6347. const s = r, i = [];
  6348. for (let o = t; o < t + e; o++)
  6349. i.push(s[o]);
  6350. for (let o = t + e; o < n; o++) {
  6351. const a = s[o];
  6352. s[o - e] = a, a === void 0 && delete s[o - e];
  6353. }
  6354. i.forEach((o, a) => {
  6355. s[n + a - e] = o, o === void 0 && delete s[n + a - e];
  6356. });
  6357. }
  6358. class kt {
  6359. constructor(e = {}) {
  6360. C(this, "_matrix");
  6361. this._setOriginValue(e);
  6362. }
  6363. static MakeObjectMatrixSize(e) {
  6364. return new kt({
  6365. [e - 1]: {}
  6366. });
  6367. }
  6368. getMatrix() {
  6369. return this._matrix;
  6370. }
  6371. forEach(e) {
  6372. const n = this._matrix, r = Object.keys(n);
  6373. for (const s of r) {
  6374. const i = Number(s), o = n[i];
  6375. if (e(i, o) === !1)
  6376. return this;
  6377. }
  6378. return this;
  6379. }
  6380. forRow(e) {
  6381. const n = this._matrix, r = Object.keys(n);
  6382. for (const s of r) {
  6383. const i = Number(s), o = n[i];
  6384. if (e(
  6385. i,
  6386. Object.keys(o).map((u) => Number(u))
  6387. ) === !1)
  6388. return this;
  6389. }
  6390. return this;
  6391. }
  6392. /**
  6393. * Iterate the object matrix with row priority, which means it scan the whole range row by row.
  6394. */
  6395. forValue(e) {
  6396. const n = this._matrix;
  6397. for (const r in n) {
  6398. const s = Number(r), i = n[s];
  6399. if (i)
  6400. for (const o in i) {
  6401. const a = Number(o), u = i[a];
  6402. if (e(s, a, u) === !1)
  6403. return this;
  6404. }
  6405. }
  6406. return this;
  6407. }
  6408. swapRow(e, n) {
  6409. const r = this._matrix[e], s = this._matrix[n];
  6410. this._matrix[e] = s, this._matrix[n] = r;
  6411. }
  6412. getRow(e) {
  6413. return this._matrix[e];
  6414. }
  6415. getRowOrCreate(e) {
  6416. let n = this.getRow(e);
  6417. return n == null && (n = {}, this._matrix[e] = n), n;
  6418. }
  6419. reset() {
  6420. this._setOriginValue({});
  6421. }
  6422. hasValue() {
  6423. const e = this._matrix, n = Object.keys(e);
  6424. if (n.length === 0)
  6425. return !1;
  6426. for (const r of n) {
  6427. const s = Number(r), i = e[s];
  6428. if (Object.keys(i).length > 0)
  6429. return !0;
  6430. }
  6431. return !1;
  6432. }
  6433. getValue(e, n) {
  6434. var r, s;
  6435. return (s = (r = this._matrix) == null ? void 0 : r[e]) == null ? void 0 : s[n];
  6436. }
  6437. setValue(e, n, r) {
  6438. const s = this.getRowOrCreate(e);
  6439. s[n] = r;
  6440. }
  6441. /**
  6442. * !!
  6443. * Please +1 ‘!’, who fell into this pit.
  6444. * @deprecated use `realDelete` or `splice`
  6445. */
  6446. deleteValue(e, n) {
  6447. var r, s;
  6448. (s = (r = this._matrix) == null ? void 0 : r[e]) == null || delete s[n];
  6449. }
  6450. realDeleteValue(e, n) {
  6451. var r, s, i;
  6452. if ((s = (r = this._matrix) == null ? void 0 : r[e]) == null || delete s[n], this.getRow(e)) {
  6453. const o = this.getRow(e);
  6454. if (o == null)
  6455. return;
  6456. Object.keys(o).length === 0 && ((i = this._matrix) == null || delete i[e]);
  6457. }
  6458. }
  6459. setRow(e, n) {
  6460. this._matrix[e] = n;
  6461. }
  6462. moveRows(e, n, r) {
  6463. Ko(e, n, r, this._matrix);
  6464. }
  6465. moveColumns(e, n, r) {
  6466. this.forEach((s, i) => {
  6467. Ko(e, n, r, i);
  6468. });
  6469. }
  6470. insertRows(e, n) {
  6471. for (let r = e; r < e + n; r++)
  6472. Vo(r, {}, this._matrix);
  6473. }
  6474. insertColumns(e, n) {
  6475. for (let r = e; r < e + n; r++)
  6476. this.forEach((s, i) => {
  6477. i && Vo(r, void 0, i);
  6478. });
  6479. }
  6480. removeRows(e, n) {
  6481. Go(e, n, this._matrix);
  6482. }
  6483. removeColumns(e, n) {
  6484. this.forEach((r, s) => {
  6485. s && Go(e, n, s);
  6486. });
  6487. }
  6488. /**
  6489. * Return a fragment of the original data matrix. Note that the returned matrix's row matrix would start from
  6490. * 0 not `startRow`. Neither does its column matrix. If you want to get the original matrix, use `getSlice`.
  6491. *
  6492. * @param startRow
  6493. * @param endRow
  6494. * @param startColumn
  6495. * @param endColumn
  6496. * @returns
  6497. */
  6498. getFragment(e, n, r, s) {
  6499. const i = new kt();
  6500. let o = 0;
  6501. for (let a = e; a <= n; a++) {
  6502. const u = {};
  6503. let c = 0;
  6504. for (let l = r; l <= s; l++) {
  6505. const h = this.getValue(a, l);
  6506. u[c] = h, c++;
  6507. }
  6508. i.setRow(o, u), o++;
  6509. }
  6510. return i;
  6511. }
  6512. /**
  6513. * Return a slice of the original data matrix. Note that the returned matrix's row matrix would start from
  6514. * `startRow` not 0, and the same does its column index. You may be looking for `getFragment` if you want
  6515. * both of the indexes start from 0.
  6516. *
  6517. * @param startRow
  6518. * @param endRow
  6519. * @param startColumn
  6520. * @param endColumn
  6521. * @returns
  6522. */
  6523. getSlice(e, n, r, s) {
  6524. const i = new kt();
  6525. for (let o = e; o <= n; o++)
  6526. for (let a = r; a <= s; a++) {
  6527. const u = this.getValue(o, a);
  6528. u && i.setValue(o, a, re.deepClone(u));
  6529. }
  6530. return i;
  6531. }
  6532. getSizeOf() {
  6533. return Object.keys(this._matrix).length;
  6534. }
  6535. getLength() {
  6536. return fn(this._matrix);
  6537. }
  6538. getRange() {
  6539. const r = this.getLength() - 1;
  6540. let s = 0;
  6541. const i = this.getLength();
  6542. for (let o = 0; o < i; o++) {
  6543. const a = this.getRow(o);
  6544. if (a) {
  6545. const u = fn(a) - 1;
  6546. s = u > s ? u : s;
  6547. }
  6548. }
  6549. return {
  6550. startRow: 0,
  6551. startColumn: 0,
  6552. endRow: r,
  6553. endColumn: s
  6554. };
  6555. }
  6556. toNativeArray() {
  6557. const e = new Array();
  6558. return this.forValue((n, r, s) => {
  6559. e.push(s);
  6560. }), e;
  6561. }
  6562. toArray() {
  6563. const e = [];
  6564. return this.forRow((n, r) => {
  6565. e[n] == null && (e[n] = []), r.forEach((s) => {
  6566. e[n][s] = this.getValue(n, s);
  6567. });
  6568. }), e;
  6569. }
  6570. toFullArray() {
  6571. const e = this.getRange(), { endColumn: n, endRow: r } = e, s = [];
  6572. for (let i = 0; i <= r; i++) {
  6573. const o = new Array(n + 1).fill(void 0);
  6574. s.push(o);
  6575. }
  6576. return this.forValue((i, o, a) => {
  6577. s[i][o] = a;
  6578. }), s;
  6579. }
  6580. /**
  6581. * @deprecated Use getMatrix as a substitute.
  6582. */
  6583. toJSON() {
  6584. return this._matrix;
  6585. }
  6586. clone() {
  6587. const e = JSON.stringify(this._matrix);
  6588. return JSON.parse(e);
  6589. }
  6590. /**
  6591. * @deprecated Use clone as a substitute.
  6592. */
  6593. getData() {
  6594. const e = JSON.stringify(this._matrix);
  6595. return JSON.parse(e);
  6596. }
  6597. getArrayData() {
  6598. let e = 0, n = 0, r = !1, s = !1;
  6599. const i = new kt();
  6600. return this.forEach((o, a) => {
  6601. r || (r = !0, e = o), Object.keys(a).forEach((u) => {
  6602. const c = Number(u);
  6603. s ? c < n && (n = c) : (s = !0, n = c);
  6604. const l = this.getValue(o, c);
  6605. i.setValue(o - e, c - n, l);
  6606. });
  6607. }), i.getData();
  6608. }
  6609. /**
  6610. * the function can only be used in all the row and column are positive integer
  6611. * @description the positive integer in V8 Object is stored in a fast memory space and it is sorted when we get the keys
  6612. * @returns {IRange} the start and end scope of the matrix
  6613. */
  6614. getStartEndScope() {
  6615. let e = 1 / 0, n = -1 / 0, r = 1 / 0, s = -1 / 0;
  6616. const i = Object.keys(this._matrix);
  6617. i.length > 0 && (e = +i[0], n = +i[i.length - 1]);
  6618. for (const o of i) {
  6619. const a = Object.keys(this._matrix[o]);
  6620. a.length > 0 && (r = Math.min(r, +a[0]), s = Math.max(s, +a[a.length - 1]));
  6621. }
  6622. return { startRow: e, endRow: n, startColumn: r, endColumn: s };
  6623. }
  6624. getDataRange() {
  6625. let e = 0, n = 0, r = 0, s = -1, i = !1, o = !1;
  6626. return this.forEach((a, u) => {
  6627. if (i || (i = !0, e = a), u == null)
  6628. return;
  6629. const c = fn(u) - 1;
  6630. c > r && (r = c), Object.keys(u).forEach((l) => {
  6631. const h = Number(l);
  6632. o ? h < n && (n = h) : (o = !0, n = h);
  6633. }), a > s && (s = a);
  6634. }), {
  6635. startRow: e,
  6636. startColumn: n,
  6637. endRow: s,
  6638. endColumn: r
  6639. };
  6640. }
  6641. getDiscreteRanges() {
  6642. const e = [];
  6643. return this.forEach((n, r) => {
  6644. Object.keys(r).forEach((s) => {
  6645. const i = Number(s);
  6646. let o = !1;
  6647. for (const a of e)
  6648. if (n >= a.startRow && n <= a.endRow + 1 && i >= a.startColumn && i <= a.endColumn + 1) {
  6649. a.endRow = Math.max(n, a.endRow), a.endColumn = Math.max(i, a.endColumn), o = !0;
  6650. break;
  6651. }
  6652. o || e.push({
  6653. startRow: n,
  6654. endRow: n,
  6655. startColumn: i,
  6656. endColumn: i
  6657. });
  6658. });
  6659. }), e;
  6660. }
  6661. merge(e) {
  6662. this.forValue((n, r) => {
  6663. const s = e.getValue(n, r);
  6664. s != null && this.setValue(n, r, s);
  6665. });
  6666. }
  6667. _setOriginValue(e = {}) {
  6668. this._matrix = e;
  6669. }
  6670. }
  6671. const PC = {
  6672. sheetId: "",
  6673. range: {
  6674. startRow: -1,
  6675. endRow: -1,
  6676. startColumn: -1,
  6677. endColumn: -1
  6678. }
  6679. }, kC = {
  6680. startRow: -1,
  6681. startColumn: -1,
  6682. endRow: -1,
  6683. endColumn: -1
  6684. }, FC = {
  6685. startRow: 0,
  6686. startColumn: 0,
  6687. endRow: 0,
  6688. endColumn: 0
  6689. }, $C = {
  6690. row: 0,
  6691. column: 0
  6692. }, gt = {
  6693. /**
  6694. * fontFamily
  6695. */
  6696. ff: "Arial",
  6697. /**
  6698. * fontSize
  6699. */
  6700. fs: 11,
  6701. /**
  6702. * italic
  6703. * 0: false
  6704. * 1: true
  6705. */
  6706. it: we.FALSE,
  6707. /**
  6708. * bold
  6709. * 0: false
  6710. * 1: true
  6711. */
  6712. bl: we.FALSE,
  6713. /**
  6714. * underline
  6715. */
  6716. ul: {
  6717. s: we.FALSE
  6718. },
  6719. /**
  6720. * strikethrough
  6721. */
  6722. st: {
  6723. s: we.FALSE
  6724. },
  6725. /**
  6726. * overline
  6727. */
  6728. ol: {
  6729. s: we.FALSE
  6730. },
  6731. /**
  6732. * textRotation
  6733. */
  6734. tr: {
  6735. a: 0,
  6736. /**
  6737. * true : 1
  6738. * false : 0
  6739. */
  6740. v: we.FALSE
  6741. },
  6742. /**
  6743. * textDirection
  6744. */
  6745. td: er.UNSPECIFIED,
  6746. /**
  6747. * color
  6748. */
  6749. cl: {
  6750. rgb: "#000"
  6751. },
  6752. /**
  6753. * background
  6754. */
  6755. bg: {
  6756. rgb: "#fff"
  6757. },
  6758. /**
  6759. * horizontalAlignment
  6760. */
  6761. ht: Xt.UNSPECIFIED,
  6762. /**
  6763. * verticalAlignment
  6764. */
  6765. vt: hn.UNSPECIFIED,
  6766. /**
  6767. * wrapStrategy
  6768. */
  6769. tb: xn.UNSPECIFIED,
  6770. /**
  6771. * padding
  6772. */
  6773. pd: {
  6774. t: 0,
  6775. r: 0,
  6776. b: 0,
  6777. l: 0
  6778. },
  6779. n: null,
  6780. /**
  6781. * border
  6782. */
  6783. bd: {
  6784. b: null,
  6785. l: null,
  6786. r: null,
  6787. t: null
  6788. }
  6789. }, Ap = {
  6790. id: "default_slide",
  6791. title: "defaultSlide",
  6792. pageSize: {
  6793. width: 300,
  6794. height: 300
  6795. }
  6796. }, BC = [su, Hd, iu];
  6797. var Np = /* @__PURE__ */ ((t) => (t.ARRAY_CONVERTOR = "ARRAY_CONVERTOR", t.MATRIX_CONVERTOR = "MATRIX_CONVERTOR", t))(Np || {});
  6798. function Rr(t, e) {
  6799. const { textRuns: n = [] } = e;
  6800. let r = 0;
  6801. for (const i of n) {
  6802. const { ts: o = {}, st: a, ed: u } = i;
  6803. if (o[t] == null)
  6804. return we.FALSE;
  6805. switch (t) {
  6806. case "bl":
  6807. // fallthrough
  6808. case "it": {
  6809. if (o[t] === we.FALSE)
  6810. return we.FALSE;
  6811. break;
  6812. }
  6813. case "ul":
  6814. // fallthrough
  6815. case "st": {
  6816. if (o[t].s === we.FALSE)
  6817. return we.FALSE;
  6818. break;
  6819. }
  6820. default:
  6821. throw new Error(`unknown style key: ${t} in IStyleBase`);
  6822. }
  6823. r += u - a;
  6824. }
  6825. return e.dataStream.indexOf(`\r
  6826. `) === r ? we.TRUE : we.FALSE;
  6827. }
  6828. const Qn = class Qn {
  6829. constructor(e, n, r) {
  6830. C(this, "_range");
  6831. C(this, "_worksheet");
  6832. this._deps = r, this._range = n, this._worksheet = e;
  6833. }
  6834. static foreach(e, n) {
  6835. const { startRow: r, startColumn: s, endRow: i, endColumn: o } = e;
  6836. for (let a = r; a <= i; a++)
  6837. for (let u = s; u <= o; u++)
  6838. n(a, u);
  6839. }
  6840. /**
  6841. * get current range data
  6842. *
  6843. * @returns current range
  6844. */
  6845. getRangeData() {
  6846. return this._range;
  6847. }
  6848. /**
  6849. * Returns the value of the top-left cell in the range. The value may be of type Number, Boolean, Date, or String
  6850. * depending on the value of the cell. Empty cells return an empty string.
  6851. * @returns The value in this cell
  6852. */
  6853. getValue() {
  6854. return this.getValues()[0][0];
  6855. }
  6856. /**
  6857. * Returns the rectangular grid of values for this range.
  6858. *
  6859. * Returns a two-dimensional array of values, indexed by row, then by column. The values may be of type Number,
  6860. * Boolean, Date, or String, depending on the value of the cell. Empty cells are represented by an empty string
  6861. * in the array. Remember that while a range index starts at 0, 0, same as the JavaScript array is indexed from [0][0].
  6862. *
  6863. * In web apps, a Date value isn't a legal parameter. getValues() fails to return data to a web app if the range
  6864. * contains a cell with a Date value. Instead, transform all the values retrieved from the sheet to a supported
  6865. * JavaScript primitive like a Number, Boolean, or String.
  6866. *
  6867. * @returns A two-dimensional array of values.
  6868. */
  6869. getValues() {
  6870. const { startRow: e, endRow: n, startColumn: r, endColumn: s } = this._range, i = [];
  6871. for (let o = e; o <= n; o++) {
  6872. const a = [];
  6873. for (let u = r; u <= s; u++)
  6874. a.push(this.getMatrix().getValue(o, u) || null);
  6875. i.push(a);
  6876. }
  6877. return i;
  6878. }
  6879. /**
  6880. * get range matrix
  6881. *
  6882. * @returns range matrix
  6883. */
  6884. getMatrix() {
  6885. const { startRow: e, endRow: n, startColumn: r, endColumn: s } = this._range, i = this._worksheet.getCellMatrix(), o = new kt();
  6886. for (let a = e; a <= n; a++)
  6887. for (let u = r; u <= s; u++)
  6888. o.setValue(a, u, i.getValue(a, u) || null);
  6889. return o;
  6890. }
  6891. /**
  6892. * get range matrix object
  6893. *
  6894. * @returns range matrix object
  6895. */
  6896. getMatrixObject() {
  6897. const { startRow: e, endRow: n, startColumn: r, endColumn: s } = this._range, i = this._worksheet.getCellMatrix(), o = new kt();
  6898. for (let a = e; a <= n; a++)
  6899. for (let u = r; u <= s; u++)
  6900. o.setValue(a - e, u - r, i.getValue(a, u) || {});
  6901. return o;
  6902. }
  6903. /**
  6904. * Returns a string description of the range, in A1 notation.
  6905. *
  6906. * @returns The string description of the range in A1 notation.
  6907. */
  6908. getA1Notation() {
  6909. const { startRow: e, endRow: n, startColumn: r, endColumn: s } = this._range;
  6910. let i, o;
  6911. return r < s ? (i = re.numToWord(r + 1) + (e + 1), o = re.numToWord(s + 1) + (n + 1)) : (i = re.numToWord(s + 1) + (n + 1), o = re.numToWord(r + 1) + (e + 1)), i === o ? `${i}` : `${i}:${o}`;
  6912. }
  6913. /**
  6914. * Returns the background color of the top-left cell in the range (for example, '#ffffff').
  6915. *
  6916. * @returns — The color code of the background.
  6917. */
  6918. getBackground() {
  6919. return this.getBackgrounds()[0][0];
  6920. }
  6921. /**
  6922. * Returns the background colors of the cells in the range (for example, '#ffffff').
  6923. *
  6924. * @returns — A two-dimensional array of color codes of the backgrounds.
  6925. */
  6926. getBackgrounds() {
  6927. const e = this._deps.getStyles();
  6928. return this.getValues().map(
  6929. (n) => n.map((r) => {
  6930. var i;
  6931. const s = e.getStyleByCell(r);
  6932. return ((i = s == null ? void 0 : s.bg) == null ? void 0 : i.rgb) || gt.bg.rgb;
  6933. })
  6934. );
  6935. }
  6936. /**
  6937. * Returns a given cell within a range.
  6938. *
  6939. * The row and column here are relative to the range
  6940. * e.g. "B2:D4", getCell(0,0) in this code returns the cell at B2
  6941. * @returns — A range containing a single cell at the specified coordinates.
  6942. */
  6943. getCell(e, n) {
  6944. const { startRow: r, startColumn: s } = this._range, i = {
  6945. startRow: r + e,
  6946. endRow: r + e,
  6947. startColumn: s + n,
  6948. endColumn: s + n
  6949. };
  6950. return new Qn(this._worksheet, i, this._deps);
  6951. }
  6952. /**
  6953. * Returns the starting column position for this range
  6954. *
  6955. * @returns — The range's starting column position in the spreadsheet.
  6956. */
  6957. getColumn() {
  6958. return this._range.startColumn;
  6959. }
  6960. /**
  6961. * Returns the data of the object structure, and can set whether to bring styles
  6962. */
  6963. getObjectValue(e = {}) {
  6964. return this.getObjectValues(e)[0][0];
  6965. }
  6966. /**
  6967. * Returns the data of the object structure, and can set whether to bring styles
  6968. *
  6969. * @param options set whether to include style
  6970. * @returns Returns a value in object format
  6971. */
  6972. getObjectValues(e = {}) {
  6973. var a;
  6974. const { startRow: n, endRow: r, startColumn: s, endColumn: i } = this._range, o = this._worksheet.getCellMatrix().getFragment(n, r, s, i).getData();
  6975. if (e.isIncludeStyle) {
  6976. const u = this._deps.getStyles();
  6977. for (let c = 0; c <= r - n; c++)
  6978. for (let l = 0; l <= i - s; l++) {
  6979. if (o == null || ((a = o == null ? void 0 : o[c]) == null ? void 0 : a[l]) == null)
  6980. continue;
  6981. const h = o[c][l].s;
  6982. h && (o[c][l].s = u.get(h));
  6983. }
  6984. }
  6985. return o;
  6986. }
  6987. /**
  6988. * Returns the font color of the cell in the top-left corner of the range, in CSS notation
  6989. */
  6990. getFontColor() {
  6991. return this.getFontColors()[0][0];
  6992. }
  6993. /**
  6994. * Returns the font colors of the cells in the range in CSS notation (such as '#ffffff' or 'white').
  6995. */
  6996. getFontColors() {
  6997. const e = this._deps.getStyles();
  6998. return this.getValues().map(
  6999. (n) => n.map((r) => {
  7000. var i;
  7001. const s = e.getStyleByCell(r);
  7002. return ((i = s == null ? void 0 : s.cl) == null ? void 0 : i.rgb) || gt.cl.rgb;
  7003. })
  7004. );
  7005. }
  7006. /**
  7007. * Returns the font families of the cells in the range.
  7008. */
  7009. getFontFamilies() {
  7010. return this._getStyles("ff");
  7011. }
  7012. /**
  7013. * Returns the font family of the cell in the top-left corner of the range.
  7014. */
  7015. getFontFamily() {
  7016. return this.getFontFamilies()[0][0];
  7017. }
  7018. /**
  7019. * Returns the underlines of the cells in the range.
  7020. */
  7021. getUnderlines() {
  7022. return this._getStyles("ul");
  7023. }
  7024. /**
  7025. * Returns the underline of the cells in the range.
  7026. */
  7027. getUnderline() {
  7028. var n, r;
  7029. const { p: e } = (n = this.getValue()) != null ? n : {};
  7030. return e && Array.isArray((r = e.body) == null ? void 0 : r.textRuns) && e.body.textRuns.length > 0 ? Rr("ul", e.body) === we.TRUE ? {
  7031. s: we.TRUE
  7032. } : {
  7033. s: we.FALSE
  7034. } : this.getUnderlines()[0][0];
  7035. }
  7036. /**
  7037. * Returns the overlines of the cells in the range.
  7038. */
  7039. getOverlines() {
  7040. return this._getStyles("ol");
  7041. }
  7042. /**
  7043. * Returns the overline of the cells in the range.
  7044. */
  7045. getOverline() {
  7046. return this.getOverlines()[0][0];
  7047. }
  7048. /**
  7049. * Returns the strikeThrough of the cells in the range.
  7050. */
  7051. getStrikeThrough() {
  7052. var n, r;
  7053. const { p: e } = (n = this.getValue()) != null ? n : {};
  7054. return e && Array.isArray((r = e.body) == null ? void 0 : r.textRuns) && e.body.textRuns.length > 0 ? Rr("st", e.body) === we.TRUE ? {
  7055. s: we.TRUE
  7056. } : {
  7057. s: we.FALSE
  7058. } : this.getStrikeThroughs()[0][0];
  7059. }
  7060. /**
  7061. * Returns the strikeThroughs of the cells in the range.
  7062. */
  7063. getStrikeThroughs() {
  7064. return this._getStyles("st");
  7065. }
  7066. /**
  7067. * Returns the font size in point size of the cell in the top-left corner of the range.
  7068. */
  7069. getFontSize() {
  7070. var n, r;
  7071. const e = ((n = this.getValue()) == null ? void 0 : n.p) || {};
  7072. return Array.isArray((r = e.body) == null ? void 0 : r.textRuns) && e.body.textRuns.length > 0 ? e.body.textRuns.some((s) => {
  7073. var i;
  7074. return ((i = s == null ? void 0 : s.ts) == null ? void 0 : i.fs) != null;
  7075. }) ? Math.max(...e.body.textRuns.map((s) => {
  7076. var i;
  7077. return ((i = s == null ? void 0 : s.ts) == null ? void 0 : i.fs) || 0;
  7078. })) : this.getFontSizes()[0][0] : this.getFontSizes()[0][0];
  7079. }
  7080. /**
  7081. * Returns the font sizes of the cells in the range.
  7082. */
  7083. getFontSizes() {
  7084. return this._getStyles("fs");
  7085. }
  7086. /**
  7087. * Returns the border info of the cells in the range.
  7088. */
  7089. getBorder() {
  7090. return this.getBorders()[0][0];
  7091. }
  7092. getBorders() {
  7093. return this._getStyles("bd");
  7094. }
  7095. /**
  7096. * Returns the font style ('italic' or 'normal') of the cell in the top-left corner of the range.
  7097. */
  7098. getFontStyle() {
  7099. var n, r;
  7100. const { p: e } = (n = this.getValue()) != null ? n : {};
  7101. return e && Array.isArray((r = e.body) == null ? void 0 : r.textRuns) && e.body.textRuns.length > 0 ? Rr("it", e.body) === we.TRUE ? Vs.ITALIC : Vs.NORMAL : this._getFontStyles()[0][0];
  7102. }
  7103. /**
  7104. * Returns the font styles of the cells in the range.
  7105. */
  7106. _getFontStyles() {
  7107. return this._getStyles("it");
  7108. }
  7109. /**
  7110. * Returns the font weight (normal/bold) of the cell in the top-left corner of the range.
  7111. * If the cell has rich text, the return value according to the textRuns of the rich text,
  7112. * when all styles of textRuns are bold, it will return FontWeight.BOLD,
  7113. * otherwise return FontWeight.NORMAL.
  7114. */
  7115. getFontWeight() {
  7116. var n, r;
  7117. const { p: e } = (n = this.getValue()) != null ? n : {};
  7118. return e && Array.isArray((r = e.body) == null ? void 0 : r.textRuns) && e.body.textRuns.length > 0 ? Rr("bl", e.body) === we.TRUE ? Gs.BOLD : Gs.NORMAL : this._getFontWeights()[0][0];
  7119. }
  7120. /**
  7121. * Returns the font weights of the cells in the range.
  7122. */
  7123. _getFontWeights() {
  7124. return this._getStyles("bl");
  7125. }
  7126. /**
  7127. * Returns the grid ID of the range's parent sheet.
  7128. */
  7129. getGridId() {
  7130. return this._worksheet.getSheetId();
  7131. }
  7132. /**
  7133. * Returns the height of the range.
  7134. */
  7135. getHeight() {
  7136. const { _range: e, _worksheet: n } = this, { startRow: r, endRow: s } = e;
  7137. let i = 0;
  7138. for (let o = 0; o <= s - r; o++) {
  7139. const a = n.getRowHeight(o);
  7140. i += a;
  7141. }
  7142. return i;
  7143. }
  7144. /**
  7145. * Returns the horizontal alignment of the text (left/center/right) of the cell in the top-left corner of the range.
  7146. */
  7147. getHorizontalAlignment() {
  7148. return this.getHorizontalAlignments()[0][0];
  7149. }
  7150. /**
  7151. *Returns the horizontal alignments of the cells in the range.
  7152. */
  7153. getHorizontalAlignments() {
  7154. return this._getStyles("ht");
  7155. }
  7156. /**
  7157. * Returns the end column position.
  7158. */
  7159. getLastColumn() {
  7160. return this._range.endColumn;
  7161. }
  7162. /**
  7163. * Returns the end row position.
  7164. */
  7165. getLastRow() {
  7166. return this._range.endRow;
  7167. }
  7168. /**
  7169. * Returns the number of columns in this range.
  7170. */
  7171. getNumColumns() {
  7172. const { startColumn: e, endColumn: n } = this._range;
  7173. return n - e + 1;
  7174. }
  7175. /**
  7176. * Returns the number of rows in this range.
  7177. */
  7178. getNumRows() {
  7179. const { startRow: e, endRow: n } = this._range;
  7180. return n - e + 1;
  7181. }
  7182. /**
  7183. * Returns the Rich Text value for the top left cell of the range, or null if the cell value is not text.
  7184. */
  7185. getRichTextValue() {
  7186. return this.getRichTextValues()[0][0];
  7187. }
  7188. /**
  7189. * Returns the Rich Text values for the cells in the range.
  7190. */
  7191. getRichTextValues() {
  7192. return this.getValues().map((e) => e.map((n) => (n == null ? void 0 : n.p) || ""));
  7193. }
  7194. /**
  7195. * Returns the row position for this range.
  7196. */
  7197. getRowIndex() {
  7198. return this._range.startRow;
  7199. }
  7200. /**
  7201. * Returns the sheet this range belongs to.
  7202. */
  7203. getSheet() {
  7204. return this._worksheet;
  7205. }
  7206. /**
  7207. * Returns the text direction for the top left cell of the range.
  7208. */
  7209. getTextDirection() {
  7210. return this.getTextDirections()[0][0];
  7211. }
  7212. /**
  7213. * Returns the text directions for the cells in the range.
  7214. */
  7215. getTextDirections() {
  7216. return this._getStyles("td");
  7217. }
  7218. /**
  7219. * Returns the text rotation settings for the top left cell of the range.
  7220. */
  7221. // getTextRotation(): number {
  7222. getTextRotation() {
  7223. return this.getTextRotations()[0][0];
  7224. }
  7225. /**
  7226. * Returns the text rotation settings for the cells in the range.
  7227. */
  7228. // getTextRotations(): number[][] {
  7229. getTextRotations() {
  7230. return this._getStyles("tr");
  7231. }
  7232. /**
  7233. * Returns the text style for the top left cell of the range.
  7234. */
  7235. getTextStyle() {
  7236. return this.getTextStyles()[0][0];
  7237. }
  7238. /**
  7239. * Returns the text styles for the cells in the range.
  7240. */
  7241. getTextStyles() {
  7242. const e = this._deps.getStyles();
  7243. return this.getValues().map((n) => n.map((r) => e.getStyleByCell(r)));
  7244. }
  7245. /**
  7246. * Returns the vertical alignment (top/middle/bottom) of the cell in the top-left corner of the range.
  7247. */
  7248. getVerticalAlignment() {
  7249. return this.getVerticalAlignments()[0][0];
  7250. }
  7251. /**
  7252. * Returns the vertical alignments of the cells in the range.
  7253. */
  7254. getVerticalAlignments() {
  7255. return this._getStyles("vt");
  7256. }
  7257. /**
  7258. * Returns the width of the range in columns.
  7259. */
  7260. getWidth() {
  7261. const { _range: e, _worksheet: n } = this, { startColumn: r, endColumn: s } = e;
  7262. let i = 0;
  7263. for (let o = 0; o <= s - r; o++)
  7264. i += n.getColumnWidth(o);
  7265. return i;
  7266. }
  7267. /**
  7268. * Returns whether the text in the cell wraps.
  7269. */
  7270. getWrap() {
  7271. return this.getWrapStrategy() === xn.WRAP ? we.TRUE : we.FALSE;
  7272. }
  7273. /**
  7274. * Returns the text wrapping strategies for the cells in the range.
  7275. */
  7276. getWrapStrategies() {
  7277. return this._getStyles("tb");
  7278. }
  7279. /**
  7280. * Returns the text wrapping strategy for the top left cell of the range.
  7281. */
  7282. getWrapStrategy() {
  7283. return this.getWrapStrategies()[0][0];
  7284. }
  7285. forEach(e) {
  7286. Qn.foreach(this._range, e);
  7287. }
  7288. /**
  7289. *
  7290. * @param arg Shorthand for the style that gets
  7291. * @returns style value
  7292. */
  7293. _getStyles(e) {
  7294. const n = this._deps.getStyles();
  7295. return this.getValues().map(
  7296. (r) => r.map((s) => {
  7297. const i = n && n.getStyleByCell(s);
  7298. return i && i[e] || gt[e];
  7299. })
  7300. );
  7301. }
  7302. };
  7303. C(Qn, "transformRange", (e, n) => {
  7304. const r = n.getMaxColumns() - 1, s = n.getMaxRows() - 1;
  7305. return e.rangeType === De.ALL ? {
  7306. startColumn: 0,
  7307. startRow: 0,
  7308. endColumn: r,
  7309. endRow: s
  7310. } : e.rangeType === De.COLUMN ? {
  7311. startRow: 0,
  7312. endRow: s,
  7313. startColumn: e.startColumn,
  7314. endColumn: e.endColumn
  7315. } : e.rangeType === De.ROW ? {
  7316. startColumn: 0,
  7317. endColumn: r,
  7318. startRow: e.startRow,
  7319. endRow: e.endRow
  7320. } : {
  7321. startColumn: e.startColumn,
  7322. endColumn: Math.min(e.endColumn, r),
  7323. startRow: e.startRow,
  7324. endRow: Math.min(e.endRow, s)
  7325. };
  7326. });
  7327. let tr = Qn;
  7328. function jC(t, e, n, r = !1) {
  7329. if (e === 0 && n === 0)
  7330. return t;
  7331. let s = { ...t };
  7332. const i = s.startAbsoluteRefType || tt.NONE, o = s.endAbsoluteRefType || tt.NONE, a = s.rangeType || De.NORMAL;
  7333. if (!r && i === tt.ALL && o === tt.ALL)
  7334. return s;
  7335. const u = Xo(s.startRow, n, s.startColumn, e, a), c = Xo(s.endRow, n, s.endColumn, e, a);
  7336. return r || i === tt.NONE && o === tt.NONE ? s = {
  7337. ...s,
  7338. startRow: u.row,
  7339. startColumn: u.column,
  7340. endRow: c.row,
  7341. endColumn: c.column
  7342. } : (i === tt.NONE ? s = { ...s, startRow: u.row, startColumn: u.column } : i === tt.COLUMN ? s = { ...s, startRow: u.row } : i === tt.ROW && (s = { ...s, startColumn: u.column }), o === tt.NONE ? s = { ...s, endRow: c.row, endColumn: c.column } : o === tt.COLUMN ? s = { ...s, endRow: c.row } : o === tt.ROW && (s = { ...s, endColumn: c.column }), s);
  7343. }
  7344. function Xo(t, e, n, r, s) {
  7345. return s === De.NORMAL ? { row: t + e, column: n + r } : s === De.ROW ? { row: t + e, column: n } : s === De.COLUMN ? { row: t, column: n + r } : { row: t, column: n };
  7346. }
  7347. function Uu(t) {
  7348. const e = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
  7349. for (const o of t)
  7350. e.add(o.startColumn), e.add(o.endColumn + 1), n.add(o.startRow), n.add(o.endRow + 1);
  7351. const r = Array.from(e).sort((o, a) => o - a), s = Array.from(n).sort((o, a) => o - a);
  7352. t.sort((o, a) => o.startRow - a.startRow || o.startColumn - a.startColumn);
  7353. const i = [];
  7354. for (let o = 0; o < s.length - 1; o++)
  7355. for (let a = 0; a < r.length - 1; a++) {
  7356. const u = r[a], c = r[a + 1] - 1, l = s[o], h = s[o + 1] - 1;
  7357. for (const d of t) {
  7358. if (d.startRow > h)
  7359. break;
  7360. if (d.startRow <= l && d.endRow >= h && d.startColumn <= u && d.endColumn >= c) {
  7361. i.push({
  7362. startColumn: u,
  7363. endColumn: c,
  7364. startRow: l,
  7365. endRow: h
  7366. });
  7367. break;
  7368. }
  7369. }
  7370. }
  7371. return i;
  7372. }
  7373. function Tp(t) {
  7374. t.sort((r, s) => r.startRow - s.startRow || r.startColumn - s.startColumn);
  7375. const e = {};
  7376. for (const r of t)
  7377. e[r.startRow] || (e[r.startRow] = []), e[r.startRow].push(r);
  7378. const n = [];
  7379. for (const r in e) {
  7380. const s = e[+r];
  7381. s.sort((o, a) => o.startColumn - a.startColumn);
  7382. let i = s[0];
  7383. for (let o = 1; o < s.length; o++) {
  7384. const a = s[o];
  7385. a.startColumn <= i.endColumn + 1 && a.startRow === i.startRow && a.endRow === i.endRow ? i.endColumn = Math.max(i.endColumn, a.endColumn) : (n.push(i), i = a);
  7386. }
  7387. n.push(i);
  7388. }
  7389. return n;
  7390. }
  7391. function Mp(t) {
  7392. t.sort((r, s) => r.startColumn - s.startColumn || r.startRow - s.startRow);
  7393. const e = {};
  7394. for (const r of t)
  7395. e[r.startColumn] || (e[r.startColumn] = []), e[r.startColumn].push(r);
  7396. const n = [];
  7397. for (const r in e) {
  7398. const s = e[+r];
  7399. s.sort((o, a) => o.startRow - a.startRow);
  7400. let i = s[0];
  7401. for (let o = 1; o < s.length; o++) {
  7402. const a = s[o];
  7403. a.startRow <= i.endRow + 1 && a.startColumn === i.startColumn && a.endColumn === i.endColumn ? i.endRow = Math.max(i.endRow, a.endRow) : (n.push(i), i = a);
  7404. }
  7405. n.push(i);
  7406. }
  7407. return n;
  7408. }
  7409. function Dp(t) {
  7410. const e = Uu(t), n = Tp(e);
  7411. return Mp(n);
  7412. }
  7413. function xp(t, e) {
  7414. const n = [];
  7415. return t.forEach((r) => {
  7416. n.push(...en.subtract(r, e));
  7417. }), en.mergeRanges(n);
  7418. }
  7419. function HC(t, e) {
  7420. const n = Jo(
  7421. t.startRow,
  7422. t.endRow,
  7423. e.startRow,
  7424. e.endRow
  7425. ), r = Jo(
  7426. t.startColumn,
  7427. t.endColumn,
  7428. e.startColumn,
  7429. e.endColumn
  7430. );
  7431. if (!n || !r)
  7432. return null;
  7433. const [s, i] = n, [o, a] = r, u = Lp(
  7434. t.rangeType,
  7435. e.rangeType,
  7436. s,
  7437. i,
  7438. o,
  7439. a
  7440. );
  7441. return {
  7442. startRow: s,
  7443. endRow: i,
  7444. startColumn: o,
  7445. endColumn: a,
  7446. rangeType: u
  7447. };
  7448. }
  7449. function Jo(t, e, n, r) {
  7450. const s = isNaN(t) ? -1 / 0 : t, i = isNaN(e) ? 1 / 0 : e, o = isNaN(n) ? -1 / 0 : n, a = isNaN(r) ? 1 / 0 : r, u = Math.max(s, o), c = Math.min(i, a);
  7451. if (u <= c) {
  7452. const l = u === -1 / 0 ? Number.NaN : u, h = c === 1 / 0 ? Number.NaN : c;
  7453. return [l, h];
  7454. } else
  7455. return null;
  7456. }
  7457. function Lp(t, e, n, r, s, i) {
  7458. const o = t !== void 0 ? t : Zo(n, r, s, i), a = e !== void 0 ? e : Zo(n, r, s, i);
  7459. return o === De.ALL || a === De.ALL ? o === a ? o : o === De.ALL ? a : o : o === a ? o : (o === De.NORMAL || a === De.NORMAL, De.NORMAL);
  7460. }
  7461. function Zo(t, e, n, r) {
  7462. const s = !isNaN(t) && !isNaN(e), i = !isNaN(n) && !isNaN(r);
  7463. return s && i ? De.NORMAL : s ? De.ROW : i ? De.COLUMN : De.ALL;
  7464. }
  7465. const Ut = class Ut {
  7466. /**
  7467. * Creates a deep copy of an IRange object
  7468. * @param src
  7469. * @example
  7470. * ```typescript
  7471. * const original = { startRow: 0, startColumn: 0, endRow: 1, endColumn: 1 };
  7472. * const copy = Rectangle.clone(original);
  7473. * // copy = { startRow: 0, startColumn: 0, endRow: 1, endColumn: 1 }
  7474. * ```
  7475. */
  7476. static clone(e) {
  7477. return e.rangeType !== void 0 ? {
  7478. startRow: e.startRow,
  7479. startColumn: e.startColumn,
  7480. endRow: e.endRow,
  7481. endColumn: e.endColumn,
  7482. rangeType: e.rangeType
  7483. } : {
  7484. startRow: e.startRow,
  7485. startColumn: e.startColumn,
  7486. endRow: e.endRow,
  7487. endColumn: e.endColumn
  7488. };
  7489. }
  7490. /**
  7491. * Checks if two ranges are equal by comparing their properties
  7492. * @param src
  7493. * @param target
  7494. * @example
  7495. * ```typescript
  7496. * const range1 = { startRow: 0, startColumn: 0, endRow: 1, endColumn: 1 };
  7497. * const range2 = { startRow: 0, startColumn: 0, endRow: 1, endColumn: 1 };
  7498. * const areEqual = Rectangle.equals(range1, range2); // true
  7499. * ```
  7500. */
  7501. static equals(e, n) {
  7502. return e == null || n == null ? !1 : e.endRow === n.endRow && e.endColumn === n.endColumn && e.startRow === n.startRow && e.startColumn === n.startColumn && (e.rangeType === n.rangeType || e.rangeType === void 0 && n.rangeType === De.NORMAL || n.rangeType === void 0 && e.rangeType === De.NORMAL);
  7503. }
  7504. /**
  7505. * Quickly checks if two normal ranges intersect. For specialized range types,
  7506. * use the intersects() method instead.
  7507. * @param rangeA
  7508. * @param rangeB
  7509. * @example
  7510. * ```typescript
  7511. * const range1 = { startRow: 0, startColumn: 0, endRow: 2, endColumn: 2 };
  7512. * const range2 = { startRow: 1, startColumn: 1, endRow: 3, endColumn: 3 };
  7513. * const doIntersect = Rectangle.simpleRangesIntersect(range1, range2); // true
  7514. * ```
  7515. */
  7516. static simpleRangesIntersect(e, n) {
  7517. const { startRow: r, endRow: s, startColumn: i, endColumn: o } = e, { startRow: a, endRow: u, startColumn: c, endColumn: l } = n, h = r <= u && s >= a, d = i <= l && o >= c;
  7518. return h && d;
  7519. }
  7520. /**
  7521. * Checks if two ranges intersect, handling special range types (ROW, COLUMN)
  7522. * @param src
  7523. * @param target
  7524. * @example
  7525. * ```typescript
  7526. * const rowRange = {
  7527. * startRow: 0, endRow: 2,
  7528. * startColumn: NaN, endColumn: NaN,
  7529. * rangeType: RANGE_TYPE.ROW
  7530. * };
  7531. * const colRange = {
  7532. * startRow: NaN, endRow: NaN,
  7533. * startColumn: 0, endColumn: 2,
  7534. * rangeType: RANGE_TYPE.COLUMN
  7535. * };
  7536. * const doIntersect = Rectangle.intersects(rowRange, colRange); // true
  7537. * ```
  7538. */
  7539. static intersects(e, n) {
  7540. if (e.rangeType === De.ROW && n.rangeType === De.COLUMN || e.rangeType === De.COLUMN && n.rangeType === De.ROW)
  7541. return !0;
  7542. if (e.rangeType === De.ROW && n.rangeType === De.ROW)
  7543. return e.startRow <= n.endRow && e.endRow >= n.startRow;
  7544. if (e.rangeType === De.COLUMN && n.rangeType === De.COLUMN)
  7545. return e.startColumn <= n.endColumn && e.endColumn >= n.startColumn;
  7546. const r = Math.floor(Number.MAX_SAFE_INTEGER / 10), s = Number.isNaN(e.startRow) ? 0 : e.startRow, i = Number.isNaN(e.endRow) ? r : e.endRow, o = Number.isNaN(e.startColumn) ? 0 : e.startColumn, a = Number.isNaN(e.endColumn) ? r : e.endColumn, u = Number.isNaN(n.startRow) ? 0 : n.startRow, c = Number.isNaN(n.endRow) ? r : n.endRow, l = Number.isNaN(n.startColumn) ? 0 : n.startColumn, h = Number.isNaN(n.endColumn) ? r : n.endColumn, d = Math.abs(o + a - l - h), f = Math.abs(o - a) + Math.abs(l - h), E = Math.abs(s + i - u - c), R = Math.abs(s - i) + Math.abs(u - c);
  7547. return d <= f && E <= R;
  7548. }
  7549. /**
  7550. * Gets the intersection range between two ranges
  7551. * @param src
  7552. * @param target
  7553. * @deprecated use `getIntersectRange` instead
  7554. * @example
  7555. * ```typescript
  7556. * const range1 = { startRow: 0, startColumn: 0, endRow: 2, endColumn: 2 };
  7557. * const range2 = { startRow: 1, startColumn: 1, endRow: 3, endColumn: 3 };
  7558. * const intersection = Rectangle.getIntersects(range1, range2);
  7559. * // intersection = { startRow: 1, startColumn: 1, endRow: 2, endColumn: 2 }
  7560. * ```
  7561. */
  7562. static getIntersects(e, n) {
  7563. const r = e.startRow, s = e.endRow, i = e.startColumn, o = e.endColumn, a = n.startRow, u = n.endRow, c = n.startColumn, l = n.endColumn;
  7564. let h, d, f, E;
  7565. if (a <= s)
  7566. a >= r ? d = a : d = r;
  7567. else
  7568. return null;
  7569. if (u >= r)
  7570. u >= s ? E = s : E = u;
  7571. else
  7572. return null;
  7573. if (c <= o)
  7574. c > i ? h = c : h = i;
  7575. else
  7576. return null;
  7577. if (l >= i)
  7578. l >= o ? f = o : f = l;
  7579. else
  7580. return null;
  7581. return {
  7582. startRow: d,
  7583. endRow: E,
  7584. startColumn: h,
  7585. endColumn: f,
  7586. rangeType: De.NORMAL
  7587. // TODO: this may not be accurate
  7588. };
  7589. }
  7590. /**
  7591. * Checks if one range completely contains another range
  7592. * @param src
  7593. * @param target
  7594. * @example
  7595. * ```typescript
  7596. * const outer = { startRow: 0, startColumn: 0, endRow: 3, endColumn: 3 };
  7597. * const inner = { startRow: 1, startColumn: 1, endRow: 2, endColumn: 2 };
  7598. * const contains = Rectangle.contains(outer, inner); // true
  7599. * ```
  7600. */
  7601. static contains(e, n) {
  7602. return e.startRow <= n.startRow && e.endRow >= n.endRow && e.startColumn <= n.startColumn && e.endColumn >= n.endColumn;
  7603. }
  7604. /**
  7605. * Checks if one range strictly contains another range (not equal)
  7606. * @param src
  7607. * @param target
  7608. * @example
  7609. * ```typescript
  7610. * const outer = { startRow: 0, startColumn: 0, endRow: 3, endColumn: 3 };
  7611. * const same = { startRow: 0, startColumn: 0, endRow: 3, endColumn: 3 };
  7612. * const realContains = Rectangle.realContain(outer, same); // false
  7613. * ```
  7614. */
  7615. static realContain(e, n) {
  7616. return Ut.contains(e, n) && (e.startRow < n.startRow || e.endRow > n.endRow || e.startColumn < n.startColumn || e.endColumn > n.endColumn);
  7617. }
  7618. /**
  7619. * Creates a union range that encompasses all input ranges
  7620. * @param {...any} ranges
  7621. * @example
  7622. * ```typescript
  7623. * const range1 = { startRow: 0, startColumn: 0, endRow: 1, endColumn: 1 };
  7624. * const range2 = { startRow: 2, startColumn: 2, endRow: 3, endColumn: 3 };
  7625. * const union = Rectangle.union(range1, range2);
  7626. * // union = { startRow: 0, startColumn: 0, endRow: 3, endColumn: 3 }
  7627. * ```
  7628. */
  7629. static union(...e) {
  7630. return e.reduce(
  7631. (n, r) => ({
  7632. startRow: Math.min(n.startRow, r.startRow),
  7633. startColumn: Math.min(n.startColumn, r.startColumn),
  7634. endRow: Math.max(n.endRow, r.endRow),
  7635. endColumn: Math.max(n.endColumn, r.endColumn),
  7636. rangeType: De.NORMAL
  7637. }),
  7638. e[0]
  7639. );
  7640. }
  7641. /**
  7642. * Creates a union range considering special range types (ROW, COLUMN)
  7643. * @param {...any} ranges
  7644. * @example
  7645. * ```typescript
  7646. * const rowRange = {
  7647. * startRow: 0, endRow: 2,
  7648. * rangeType: RANGE_TYPE.ROW
  7649. * };
  7650. * const normalRange = {
  7651. * startRow: 1, startColumn: 1,
  7652. * endRow: 3, endColumn: 3
  7653. * };
  7654. * const union = Rectangle.realUnion(rowRange, normalRange);
  7655. * // Result will have NaN for columns due to ROW type
  7656. * ```
  7657. */
  7658. static realUnion(...e) {
  7659. const n = e.some((i) => i.rangeType === De.COLUMN), r = e.some((i) => i.rangeType === De.ROW), s = Ut.union(...e);
  7660. return {
  7661. startColumn: r ? Number.NaN : s.startColumn,
  7662. endColumn: r ? Number.NaN : s.endColumn,
  7663. startRow: n ? Number.NaN : s.startRow,
  7664. endRow: n ? Number.NaN : s.endRow,
  7665. rangeType: r ? De.ROW : n ? De.COLUMN : De.NORMAL
  7666. };
  7667. }
  7668. /**
  7669. * Subtracts one range from another, returning the remaining areas as separate ranges
  7670. * @param range1
  7671. * @param range2
  7672. * @example
  7673. * ```typescript
  7674. * const range1 = { startRow: 0, startColumn: 0, endRow: 3, endColumn: 3 };
  7675. * const range2 = { startRow: 1, startColumn: 1, endRow: 2, endColumn: 2 };
  7676. * const result = Rectangle.subtract(range1, range2);
  7677. * // Results in up to 4 ranges representing the non-overlapping areas
  7678. * ```
  7679. */
  7680. static subtract(e, n) {
  7681. if (n.startRow > e.endRow || n.endRow < e.startRow || n.startColumn > e.endColumn || n.endColumn < e.startColumn)
  7682. return [e];
  7683. const r = [];
  7684. n.startRow >= e.startRow && r.push({
  7685. startRow: e.startRow,
  7686. startColumn: e.startColumn,
  7687. endRow: n.startRow - 1,
  7688. endColumn: e.endColumn
  7689. }), n.endRow <= e.endRow && r.push({
  7690. startRow: n.endRow + 1,
  7691. startColumn: e.startColumn,
  7692. endRow: e.endRow,
  7693. endColumn: e.endColumn
  7694. });
  7695. const s = Math.max(e.startRow, n.startRow), i = Math.min(e.endRow, n.endRow);
  7696. return n.startColumn >= e.startColumn && r.push({
  7697. startRow: s,
  7698. startColumn: e.startColumn,
  7699. endRow: i,
  7700. endColumn: n.startColumn - 1
  7701. }), n.endColumn <= e.endColumn && r.push({
  7702. startRow: s,
  7703. startColumn: n.endColumn + 1,
  7704. endRow: i,
  7705. endColumn: e.endColumn
  7706. }), r.filter((a) => a.startRow <= a.endRow && a.startColumn <= a.endColumn);
  7707. }
  7708. /**
  7709. * Merges overlapping or adjacent ranges into larger ranges
  7710. * @param ranges
  7711. * @example
  7712. * ```typescript
  7713. * const ranges = [
  7714. * { startRow: 0, startColumn: 0, endRow: 1, endColumn: 1 },
  7715. * { startRow: 1, startColumn: 1, endRow: 2, endColumn: 2 }
  7716. * ];
  7717. * const merged = Rectangle.mergeRanges(ranges);
  7718. * // Combines overlapping ranges into larger ones
  7719. * ```
  7720. */
  7721. static mergeRanges(e) {
  7722. return Dp(e);
  7723. }
  7724. /**
  7725. * Splits overlapping ranges into a grid of non-overlapping ranges
  7726. * @param ranges
  7727. * @example
  7728. * ```typescript
  7729. * const ranges = [
  7730. * { startRow: 0, startColumn: 0, endRow: 2, endColumn: 2 },
  7731. * { startRow: 1, startColumn: 1, endRow: 3, endColumn: 3 }
  7732. * ];
  7733. * const grid = Rectangle.splitIntoGrid(ranges);
  7734. * // Splits into non-overlapping grid sections
  7735. * ```
  7736. */
  7737. static splitIntoGrid(e) {
  7738. return Uu(e);
  7739. }
  7740. /**
  7741. * Subtracts multiple ranges from multiple ranges
  7742. * @param ranges1
  7743. * @param ranges2
  7744. * @example
  7745. * ```typescript
  7746. * const ranges1 = [{ startRow: 0, startColumn: 0, endRow: 3, endColumn: 3 }];
  7747. * const ranges2 = [
  7748. * { startRow: 1, startColumn: 1, endRow: 2, endColumn: 2 },
  7749. * { startRow: 2, startColumn: 2, endRow: 3, endColumn: 3 }
  7750. * ];
  7751. * const result = Rectangle.subtractMulti(ranges1, ranges2);
  7752. * // Returns remaining non-overlapping areas
  7753. * ```
  7754. */
  7755. static subtractMulti(e, n) {
  7756. if (!n.length)
  7757. return e;
  7758. let r = e;
  7759. return n.forEach((s) => {
  7760. r = xp(r, s);
  7761. }), r;
  7762. }
  7763. /**
  7764. * Checks if two rectangles defined by left, top, right, bottom coordinates intersect
  7765. * @param rect1
  7766. * @param rect2
  7767. * @example
  7768. * ```typescript
  7769. * const rect1 = { left: 0, top: 0, right: 10, bottom: 10 };
  7770. * const rect2 = { left: 5, top: 5, right: 15, bottom: 15 };
  7771. * const intersects = Rectangle.hasIntersectionBetweenTwoRect(rect1, rect2); // true
  7772. * ```
  7773. */
  7774. static hasIntersectionBetweenTwoRect(e, n) {
  7775. return !(e.left > n.right || // rect1 在 rect2 右侧
  7776. e.right < n.left || // rect1 在 rect2 左侧
  7777. e.top > n.bottom || // rect1 在 rect2 下方
  7778. e.bottom < n.top);
  7779. }
  7780. /**
  7781. * Gets the intersection area between two rectangles defined by LTRB coordinates
  7782. * @param rect1
  7783. * @param rect2
  7784. * @example
  7785. * ```typescript
  7786. * const rect1 = { left: 0, top: 0, right: 10, bottom: 10 };
  7787. * const rect2 = { left: 5, top: 5, right: 15, bottom: 15 };
  7788. * const intersection = Rectangle.getIntersectionBetweenTwoRect(rect1, rect2);
  7789. * // Returns { left: 5, top: 5, right: 10, bottom: 10, width: 5, height: 5 }
  7790. * ```
  7791. */
  7792. static getIntersectionBetweenTwoRect(e, n) {
  7793. const r = Math.max(e.left, n.left), s = Math.min(e.right, n.right), i = Math.max(e.top, n.top), o = Math.min(e.bottom, n.bottom);
  7794. return s <= r || o <= i ? null : {
  7795. left: r,
  7796. right: s,
  7797. top: i,
  7798. bottom: o,
  7799. width: s - r,
  7800. height: o - i
  7801. };
  7802. }
  7803. /**
  7804. * Sorts an array of ranges by startRow, then by startColumn
  7805. * @param ranges
  7806. * @example
  7807. * ```typescript
  7808. * const ranges = [
  7809. * { startRow: 1, startColumn: 0, endRow: 2, endColumn: 1 },
  7810. * { startRow: 0, startColumn: 0, endRow: 1, endColumn: 1 }
  7811. * ];
  7812. * const sorted = Rectangle.sort(ranges);
  7813. * // Ranges will be sorted by startRow first, then startColumn
  7814. * ```
  7815. */
  7816. static sort(e) {
  7817. return e.sort((n, r) => n.startRow - r.startRow || n.startColumn - r.startColumn);
  7818. }
  7819. };
  7820. /**
  7821. * Converts an absolute range to a relative range based on an origin range
  7822. * @param range
  7823. * @param originRange
  7824. * @example
  7825. * ```typescript
  7826. * const range = { startRow: 5, startColumn: 5, endRow: 7, endColumn: 7 };
  7827. * const origin = { startRow: 3, startColumn: 3, endRow: 8, endColumn: 8 };
  7828. * const relative = Rectangle.getRelativeRange(range, origin);
  7829. * // relative = { startRow: 2, startColumn: 2, endRow: 2, endColumn: 2 }
  7830. * ```
  7831. */
  7832. C(Ut, "getRelativeRange", (e, n) => ({
  7833. startRow: e.startRow - n.startRow,
  7834. endRow: e.endRow - e.startRow,
  7835. startColumn: e.startColumn - n.startColumn,
  7836. endColumn: e.endColumn - e.startColumn
  7837. })), /**
  7838. * Converts a relative range back to an absolute range based on origin
  7839. * @param relativeRange
  7840. * @param originRange
  7841. * @param absoluteRange
  7842. * @example
  7843. * ```typescript
  7844. * const relative = { startRow: 2, startColumn: 2, endRow: 2, endColumn: 2 };
  7845. * const origin = { startRow: 3, startColumn: 3, endRow: 8, endColumn: 8 };
  7846. * const absolute = Rectangle.getPositionRange(relative, origin);
  7847. * // absolute = { startRow: 5, startColumn: 5, endRow: 7, endColumn: 7 }
  7848. * ```
  7849. */
  7850. C(Ut, "getPositionRange", (e, n, r) => ({
  7851. ...r || {},
  7852. startRow: r && [tt.ROW, tt.ALL].includes(r.startAbsoluteRefType || 0) ? r.startRow : e.startRow + n.startRow,
  7853. endRow: r && [tt.ROW, tt.ALL].includes(r.endAbsoluteRefType || 0) ? r.endRow : e.endRow + e.startRow + n.startRow,
  7854. startColumn: r && [tt.COLUMN, tt.ALL].includes(r.startAbsoluteRefType || 0) ? r.startColumn : e.startColumn + n.startColumn,
  7855. endColumn: r && [tt.COLUMN, tt.ALL].includes(r.endAbsoluteRefType || 0) ? r.endColumn : e.endColumn + e.startColumn + n.startColumn
  7856. })), /**
  7857. * Moves a range horizontally by a specified step and optionally extends it
  7858. * @param range
  7859. * @param step
  7860. * @param length
  7861. * @example
  7862. * ```typescript
  7863. * const range = { startRow: 0, startColumn: 0, endRow: 1, endColumn: 1 };
  7864. * const moved = Rectangle.moveHorizontal(range, 2, 1);
  7865. * // moved = { startRow: 0, startColumn: 2, endRow: 1, endColumn: 4 }
  7866. * ```
  7867. */
  7868. C(Ut, "moveHorizontal", (e, n = 0, r = 0) => ({
  7869. ...e,
  7870. startColumn: e.startColumn + n,
  7871. endColumn: e.endColumn + n + r
  7872. })), /**
  7873. * Moves a range vertically by a specified step and optionally extends it
  7874. * @param range
  7875. * @param step
  7876. * @param length
  7877. * @example
  7878. * ```typescript
  7879. * const range = { startRow: 0, startColumn: 0, endRow: 1, endColumn: 1 };
  7880. * const moved = Rectangle.moveVertical(range, 2, 1);
  7881. * // moved = { startRow: 2, startColumn: 0, endRow: 4, endColumn: 1 }
  7882. * ```
  7883. */
  7884. C(Ut, "moveVertical", (e, n = 0, r = 0) => ({
  7885. ...e,
  7886. startRow: e.startRow + n,
  7887. endRow: e.endRow + n + r
  7888. })), /**
  7889. * Moves a range by specified offsets in both directions
  7890. * @param range
  7891. * @param offsetX
  7892. * @param offsetY
  7893. * @example
  7894. * ```typescript
  7895. * const range = { startRow: 0, startColumn: 0, endRow: 1, endColumn: 1 };
  7896. * const moved = Rectangle.moveOffset(range, 2, 3);
  7897. * // moved = { startRow: 3, startColumn: 2, endRow: 4, endColumn: 3 }
  7898. * ```
  7899. */
  7900. C(Ut, "moveOffset", (e, n, r) => ({
  7901. ...e,
  7902. startRow: e.startRow + r,
  7903. endRow: e.endRow + r,
  7904. startColumn: e.startColumn + n,
  7905. endColumn: e.endColumn + n
  7906. }));
  7907. let en = Ut;
  7908. function Up(t, e) {
  7909. if (t.length === 0 || t[0].length === 0) return null;
  7910. const n = new Array(t[0].length).fill(0);
  7911. let r = 0, s = null;
  7912. for (let i = 0; i < t.length; i++) {
  7913. for (let a = 0; a < t[0].length; a++)
  7914. n[a] = e(t[i][a]) ? n[a] + 1 : 0;
  7915. const o = Pp(n);
  7916. o.area > r && (r = o.area, s = {
  7917. startColumn: o.start,
  7918. startRow: i - o.height + 1,
  7919. endColumn: o.end,
  7920. endRow: i
  7921. });
  7922. }
  7923. return s;
  7924. }
  7925. function Pp(t) {
  7926. const e = [];
  7927. let n = 0, r = { area: 0, height: 0, start: 0, end: 0 }, s = 0;
  7928. for (; s < t.length; )
  7929. if (e.length === 0 || t[s] >= t[e[e.length - 1]])
  7930. e.push(s++);
  7931. else {
  7932. const i = t[e.pop()], o = e.length === 0 ? s : s - e[e.length - 1] - 1;
  7933. i * o > n && (n = i * o, r = { area: n, height: i, start: e.length === 0 ? 0 : e[e.length - 1] + 1, end: s - 1 });
  7934. }
  7935. for (; e.length > 0; ) {
  7936. const i = t[e.pop()], o = e.length === 0 ? s : s - e[e.length - 1] - 1;
  7937. i * o > n && (n = i * o, r = { area: n, height: i, start: e.length === 0 ? 0 : e[e.length - 1] + 1, end: s - 1 });
  7938. }
  7939. return r;
  7940. }
  7941. function kp(t, e) {
  7942. tr.foreach(e, (n, r) => {
  7943. t[n][r] = void 0;
  7944. });
  7945. }
  7946. function WC(t, e) {
  7947. const n = t.toFullArray(), r = [];
  7948. for (; ; ) {
  7949. const s = Up(n, e);
  7950. if (!s)
  7951. break;
  7952. r.push(s), kp(n, s);
  7953. }
  7954. return r;
  7955. }
  7956. class zC {
  7957. constructor(e, n) {
  7958. C(this, "_values", []);
  7959. C(this, "_keys", []);
  7960. C(this, "_keyMaps", /* @__PURE__ */ new Map());
  7961. this._values = e, this._keys = n, e.forEach((r) => {
  7962. this._initKeyMap(r);
  7963. });
  7964. }
  7965. _initKeyMap(e) {
  7966. this._keys.forEach((n) => {
  7967. const r = e[n], s = this._keyMaps.get(n) || /* @__PURE__ */ new Map();
  7968. s.set(r, e), this._keyMaps.set(n, s);
  7969. });
  7970. }
  7971. /**
  7972. * If a key group is specified, the order of values is determined by the key group, otherwise it depends on the keys at initialization
  7973. * @param {string} key
  7974. * @param {K[]} [keyGroup]
  7975. * @return {*}
  7976. * @memberof RefAlias
  7977. */
  7978. getValue(e, n) {
  7979. const r = n || this._keys;
  7980. for (let s = 0; s < r.length; s++) {
  7981. const i = this._keyMaps.get(r[s]);
  7982. if (i != null && i.has(e))
  7983. return i.get(e);
  7984. }
  7985. return null;
  7986. }
  7987. hasValue(e) {
  7988. for (let n = 0; n < this._keys.length; n++) {
  7989. const r = this._keyMaps.get(this._keys[n]);
  7990. if (r != null && r.has(e))
  7991. return !0;
  7992. }
  7993. return !1;
  7994. }
  7995. addValue(e) {
  7996. this._values.push(e), this._initKeyMap(e);
  7997. }
  7998. setValue(e, n, r) {
  7999. const s = this.getValue(e);
  8000. s && Object.keys(s).includes(n) && (s[n] = r);
  8001. }
  8002. deleteValue(e, n) {
  8003. const r = this.getValue(e, n);
  8004. if (r) {
  8005. this._keys.forEach((i) => {
  8006. const o = this._keyMaps.get(i), a = r[i];
  8007. o == null || o.delete(a);
  8008. });
  8009. const s = this._values.findIndex((i) => i === r);
  8010. this._values.splice(s, 1);
  8011. }
  8012. }
  8013. getValues() {
  8014. return this._values;
  8015. }
  8016. getKeyMap(e) {
  8017. var n;
  8018. return [...((n = this._keyMaps.get(e)) == null ? void 0 : n.keys()) || []];
  8019. }
  8020. clear() {
  8021. this._values = [], this._keys = [], this._keyMaps.clear();
  8022. }
  8023. }
  8024. function Qo(t, e, n, r) {
  8025. return {
  8026. forEach(s) {
  8027. for (let i = t; i <= e; i++)
  8028. for (let o = n; o <= r; o++)
  8029. s(i, o);
  8030. }
  8031. };
  8032. }
  8033. function YC(t) {
  8034. if (t == null || t.length === 0)
  8035. return Number.NaN;
  8036. const e = t.toLowerCase().split(""), n = e.length, r = (o) => o.charCodeAt(0) - 96;
  8037. let s = 0, i = 0;
  8038. for (let o = 0; o < n; o++)
  8039. i = r(e[o]), s += i * 26 ** (n - o - 1);
  8040. return s === 0 ? Number.NaN : s - 1;
  8041. }
  8042. const qr = 65, Pu = 90, Fp = 97;
  8043. function VC(t) {
  8044. const e = Pu - qr + 1;
  8045. let n = "";
  8046. for (; t >= 0; )
  8047. n = String.fromCharCode(t % e + qr) + n, t = Math.floor(t / e) - 1;
  8048. return n;
  8049. }
  8050. function $p(t, e) {
  8051. let n = "";
  8052. for (; e > 0; )
  8053. n += t, e--;
  8054. return n;
  8055. }
  8056. function GC(t, e = !1) {
  8057. const n = Pu - qr + 1;
  8058. let r = Fp;
  8059. e && (r = qr);
  8060. const s = String.fromCharCode(t % n + r), i = Math.floor(t / n) + 1;
  8061. return $p(s, i);
  8062. }
  8063. function KC(t, e) {
  8064. return t.zIndex > e.zIndex ? 1 : t.zIndex === e.zIndex ? 0 : -1;
  8065. }
  8066. function XC(t, e) {
  8067. return t.zIndex > e.zIndex ? -1 : t.zIndex === e.zIndex ? 0 : 1;
  8068. }
  8069. function ps(t = "index", e = 1) {
  8070. return (n, r) => n[t] > r[t] ? e : n[t] === r[t] ? 0 : -e;
  8071. }
  8072. var Bp = /* @__PURE__ */ ((t) => (t[t.character = 0] = "character", t[t.paragraph = 1] = "paragraph", t[t.table = 2] = "table", t[t.numbering = 3] = "numbering", t))(Bp || {}), jp = /* @__PURE__ */ ((t) => (t[t.TAB = 0] = "TAB", t[t.SPACE = 1] = "SPACE", t[t.NOTHING = 2] = "NOTHING", t))(jp || {}), Te = /* @__PURE__ */ ((t) => (t[t.BULLET = 0] = "BULLET", t[t.NONE = 1] = "NONE", t[t.DECIMAL = 2] = "DECIMAL", t[t.DECIMAL_ZERO = 3] = "DECIMAL_ZERO", t[t.UPPER_LETTER = 4] = "UPPER_LETTER", t[t.LOWER_LETTER = 5] = "LOWER_LETTER", t[t.UPPER_ROMAN = 6] = "UPPER_ROMAN", t[t.LOWER_ROMAN = 7] = "LOWER_ROMAN", t[t.ORDINAL = 8] = "ORDINAL", t[t.CARDINAL_TEXT = 9] = "CARDINAL_TEXT", t[t.ORDINAL_TEXT = 10] = "ORDINAL_TEXT", t[t.HEX = 11] = "HEX", t[t.CHICAGO = 12] = "CHICAGO", t[t.IDEOGRAPH_DIGITAL = 13] = "IDEOGRAPH_DIGITAL", t[t.JAPANESE_COUNTING = 14] = "JAPANESE_COUNTING", t[t.AIUEO = 15] = "AIUEO", t[t.IROHA = 16] = "IROHA", t[t.DECIMAL_FULL_WIDTH = 17] = "DECIMAL_FULL_WIDTH", t[t.DECIMAL_HALF_WIDTH = 18] = "DECIMAL_HALF_WIDTH", t[t.JAPANESE_LEGAL = 19] = "JAPANESE_LEGAL", t[t.JAPANESE_DIGITAL_TEN_THOUSAND = 20] = "JAPANESE_DIGITAL_TEN_THOUSAND", t[t.DECIMAL_ENCLOSED_CIRCLE = 21] = "DECIMAL_ENCLOSED_CIRCLE", t[t.DECIMAL_FULL_WIDTH2 = 22] = "DECIMAL_FULL_WIDTH2", t[t.AIUEO_FULL_WIDTH = 23] = "AIUEO_FULL_WIDTH", t[t.IROHA_FULL_WIDTH = 24] = "IROHA_FULL_WIDTH", t[t.GANADA = 25] = "GANADA", t[t.CHOSUNG = 26] = "CHOSUNG", t[t.DECIMAL_ENCLOSED_FULLSTOP = 27] = "DECIMAL_ENCLOSED_FULLSTOP", t[t.DECIMAL_ENCLOSED_PAREN = 28] = "DECIMAL_ENCLOSED_PAREN", t[t.DECIMAL_ENCLOSED_CIRCLE_CHINESE = 29] = "DECIMAL_ENCLOSED_CIRCLE_CHINESE", t[t.IDEOGRAPH_ENCLOSED_CIRCLE = 30] = "IDEOGRAPH_ENCLOSED_CIRCLE", t[t.IDEOGRAPH_TRADITIONAL = 31] = "IDEOGRAPH_TRADITIONAL", t[t.IDEOGRAPH_ZODIAC = 32] = "IDEOGRAPH_ZODIAC", t[t.IDEOGRAPH_ZODIAC_TRADITIONAL = 33] = "IDEOGRAPH_ZODIAC_TRADITIONAL", t[t.TAIWANESE_COUNTING = 34] = "TAIWANESE_COUNTING", t[t.IDEOGRAPH_LEGAL_TRADITIONAL = 35] = "IDEOGRAPH_LEGAL_TRADITIONAL", t[t.TAIWANESE_COUNTING_THOUSAND = 36] = "TAIWANESE_COUNTING_THOUSAND", t[t.TAIWANESE_DIGITAL = 37] = "TAIWANESE_DIGITAL", t[t.CHINESE_COUNTING = 38] = "CHINESE_COUNTING", t[t.CHINESE_LEGAL_SIMPLIFIED = 39] = "CHINESE_LEGAL_SIMPLIFIED", t[t.CHINESE_COUNTING_THOUSAND = 40] = "CHINESE_COUNTING_THOUSAND", t[t.KOREAN_DIGITAL = 41] = "KOREAN_DIGITAL", t[t.KOREAN_COUNTING = 42] = "KOREAN_COUNTING", t[t.KOREAN_LEGAL = 43] = "KOREAN_LEGAL", t[t.KOREAN_DIGITAL2 = 44] = "KOREAN_DIGITAL2", t[t.VIETNAMESE_COUNTING = 45] = "VIETNAMESE_COUNTING", t[t.RUSSIAN_LOWER = 46] = "RUSSIAN_LOWER", t[t.RUSSIAN_UPPER = 47] = "RUSSIAN_UPPER", t[t.NUMBER_IN_DASH = 48] = "NUMBER_IN_DASH", t[t.HEBREW1 = 49] = "HEBREW1", t[t.HEBREW2 = 50] = "HEBREW2", t[t.ARABIC_ALPHA = 51] = "ARABIC_ALPHA", t[t.ARABIC_ABJAD = 52] = "ARABIC_ABJAD", t[t.HINDI_VOWELS = 53] = "HINDI_VOWELS", t[t.HINDI_CONSONANTS = 54] = "HINDI_CONSONANTS", t[t.HINDI_NUMBERS = 55] = "HINDI_NUMBERS", t[t.HINDI_COUNTING = 56] = "HINDI_COUNTING", t[t.THAI_LETTERS = 57] = "THAI_LETTERS", t[t.THAI_NUMBERS = 58] = "THAI_NUMBERS", t[t.THAI_COUNTING = 59] = "THAI_COUNTING", t[t.CUSTOM = 60] = "CUSTOM", t))(Te || {}), ms = /* @__PURE__ */ ((t) => (t[t.BULLET_ALIGNMENT_UNSPECIFIED = 0] = "BULLET_ALIGNMENT_UNSPECIFIED", t[t.START = 1] = "START", t[t.CENTER = 2] = "CENTER", t[t.END = 3] = "END", t[t.BOTH = 4] = "BOTH", t))(ms || {}), mn = /* @__PURE__ */ ((t) => (t[t.HYPERLINK = 0] = "HYPERLINK", t[t.FIELD = 1] = "FIELD", t[t.SDT = 2] = "SDT", t[t.BOOKMARK = 3] = "BOOKMARK", t[t.COMMENT = 4] = "COMMENT", t[t.CUSTOM = 5] = "CUSTOM", t[t.MENTION = 6] = "MENTION", t[t.UNI_FORMULA = 7] = "UNI_FORMULA", t[t.DELTED = 9999] = "DELTED", t))(mn || {}), An = /* @__PURE__ */ ((t) => (t[t.COMMENT = 0] = "COMMENT", t[t.DELETED = 9999] = "DELETED", t))(An || {}), Hp = /* @__PURE__ */ ((t) => (t[t.DRAWING = 0] = "DRAWING", t[t.CUSTOM = 1] = "CUSTOM", t))(Hp || {}), ku = /* @__PURE__ */ ((t) => (t[t.UNSPECIFIED = 0] = "UNSPECIFIED", t[t.TRADITIONAL = 1] = "TRADITIONAL", t[t.MODERN = 2] = "MODERN", t))(ku || {}), Wp = /* @__PURE__ */ ((t) => (t[t.DEFAULT = 0] = "DEFAULT", t[t.LINES = 1] = "LINES", t[t.LINES_AND_CHARS = 2] = "LINES_AND_CHARS", t[t.SNAP_TO_CHARS = 3] = "SNAP_TO_CHARS", t))(Wp || {}), zp = /* @__PURE__ */ ((t) => (t[t.SECTION_TYPE_UNSPECIFIED = 0] = "SECTION_TYPE_UNSPECIFIED", t[t.CONTINUOUS = 1] = "CONTINUOUS", t[t.NEXT_PAGE = 2] = "NEXT_PAGE", t[t.EVEN_PAGE = 3] = "EVEN_PAGE", t[t.ODD_PAGE = 4] = "ODD_PAGE", t))(zp || {}), Yp = /* @__PURE__ */ ((t) => (t[t.COLUMN_SEPARATOR_STYLE_UNSPECIFIED = 0] = "COLUMN_SEPARATOR_STYLE_UNSPECIFIED", t[t.NONE = 1] = "NONE", t[t.BETWEEN_EACH_COLUMN = 2] = "BETWEEN_EACH_COLUMN", t))(Yp || {}), Vp = /* @__PURE__ */ ((t) => (t[t.NORMAL = 0] = "NORMAL", t[t.TBRL = 1] = "TBRL", t[t.LRTBV = 2] = "LRTBV", t))(Vp || {}), Gp = /* @__PURE__ */ ((t) => (t[t.TEXT_RUN = 0] = "TEXT_RUN", t[t.AUTO_TEXT = 1] = "AUTO_TEXT", t[t.PAGE_BREAK = 2] = "PAGE_BREAK", t[t.COLUMN_BREAK = 3] = "COLUMN_BREAK", t[t.FOOT_NOTE_REFERENCE = 4] = "FOOT_NOTE_REFERENCE", t[t.HORIZONTAL_RULE = 5] = "HORIZONTAL_RULE", t[t.EQUATION = 6] = "EQUATION", t[t.DRAWING = 7] = "DRAWING", t[t.PERSON = 8] = "PERSON", t[t.RICH_LINK = 9] = "RICH_LINK", t))(Gp || {}), Kp = /* @__PURE__ */ ((t) => (t[t.BOTH_SIDES = 0] = "BOTH_SIDES", t[t.LEFT = 1] = "LEFT", t[t.RIGHT = 2] = "RIGHT", t[t.LARGEST = 3] = "LARGEST", t))(Kp || {}), Xp = /* @__PURE__ */ ((t) => (t[t.INLINE = 0] = "INLINE", t[t.WRAP_NONE = 1] = "WRAP_NONE", t[t.WRAP_POLYGON = 2] = "WRAP_POLYGON", t[t.WRAP_SQUARE = 3] = "WRAP_SQUARE", t[t.WRAP_THROUGH = 4] = "WRAP_THROUGH", t[t.WRAP_TIGHT = 5] = "WRAP_TIGHT", t[t.WRAP_TOP_AND_BOTTOM = 6] = "WRAP_TOP_AND_BOTTOM", t))(Xp || {}), Jp = /* @__PURE__ */ ((t) => (t[t.NAMED_STYLE_TYPE_UNSPECIFIED = 0] = "NAMED_STYLE_TYPE_UNSPECIFIED", t[t.NORMAL_TEXT = 1] = "NORMAL_TEXT", t[t.TITLE = 2] = "TITLE", t[t.SUBTITLE = 3] = "SUBTITLE", t[t.HEADING_1 = 4] = "HEADING_1", t[t.HEADING_2 = 5] = "HEADING_2", t[t.HEADING_3 = 6] = "HEADING_3", t[t.HEADING_4 = 7] = "HEADING_4", t[t.HEADING_5 = 8] = "HEADING_5", t[t.HEADING_6 = 9] = "HEADING_6", t))(Jp || {}), Zp = /* @__PURE__ */ ((t) => (t[t.AUTO = 0] = "AUTO", t[t.AT_LEAST = 1] = "AT_LEAST", t[t.EXACT = 2] = "EXACT", t))(Zp || {}), Qp = /* @__PURE__ */ ((t) => (t[t.DASH_STYLE_UNSPECIFIED = 0] = "DASH_STYLE_UNSPECIFIED", t[t.SOLID = 1] = "SOLID", t[t.DOT = 2] = "DOT", t[t.DASH = 3] = "DASH", t))(Qp || {}), qp = /* @__PURE__ */ ((t) => (t[t.TAB_STOP_ALIGNMENT_UNSPECIFIED = 0] = "TAB_STOP_ALIGNMENT_UNSPECIFIED", t[t.START = 1] = "START", t[t.CENTER = 2] = "CENTER", t[t.END = 3] = "END", t))(qp || {}), em = /* @__PURE__ */ ((t) => (t[t.UNSPECIFIED = 0] = "UNSPECIFIED", t[t.SPECIFIED = 1] = "SPECIFIED", t))(em || {}), tm = /* @__PURE__ */ ((t) => (t[t.START = 0] = "START", t[t.CENTER = 1] = "CENTER", t[t.END = 2] = "END", t))(tm || {}), nm = /* @__PURE__ */ ((t) => (t[t.AUTO_FIT = 0] = "AUTO_FIT", t[t.FIXED = 1] = "FIXED", t))(nm || {}), rm = /* @__PURE__ */ ((t) => (t[t.NONE = 0] = "NONE", t[t.WRAP = 1] = "WRAP", t))(rm || {}), sm = /* @__PURE__ */ ((t) => (t[t.AUTO = 0] = "AUTO", t[t.AT_LEAST = 1] = "AT_LEAST", t[t.EXACT = 2] = "EXACT", t))(sm || {}), im = /* @__PURE__ */ ((t) => (t[t.CONTENT_ALIGNMENT_UNSPECIFIED = 0] = "CONTENT_ALIGNMENT_UNSPECIFIED", t[t.BOTH = 1] = "BOTH", t[t.TOP = 2] = "TOP", t[t.CENTER = 3] = "CENTER", t[t.BOTTOM = 4] = "BOTTOM", t))(im || {}), Yn = /* @__PURE__ */ ((t) => (t.NORMAL = "normal", t.BOLD = "bold", t.ITALIC = "italic", t))(Yn || {}), om = /* @__PURE__ */ ((t) => (t[t.PAGE = 0] = "PAGE", t[t.COLUMN = 1] = "COLUMN", t[t.CHARACTER = 2] = "CHARACTER", t[t.MARGIN = 3] = "MARGIN", t[t.INSIDE_MARGIN = 4] = "INSIDE_MARGIN", t[t.OUTSIDE_MARGIN = 5] = "OUTSIDE_MARGIN", t[t.LEFT_MARGIN = 6] = "LEFT_MARGIN", t[t.RIGHT_MARGIN = 7] = "RIGHT_MARGIN", t))(om || {}), am = /* @__PURE__ */ ((t) => (t[t.PAGE = 0] = "PAGE", t[t.PARAGRAPH = 1] = "PARAGRAPH", t[t.LINE = 2] = "LINE", t[t.MARGIN = 3] = "MARGIN", t[t.TOP_MARGIN = 4] = "TOP_MARGIN", t[t.BOTTOM_MARGIN = 5] = "BOTTOM_MARGIN", t[t.INSIDE_MARGIN = 6] = "INSIDE_MARGIN", t[t.OUTSIDE_MARGIN = 7] = "OUTSIDE_MARGIN", t))(am || {}), um = /* @__PURE__ */ ((t) => (t[t.POINT = 0] = "POINT", t[t.LINE = 1] = "LINE", t[t.CHARACTER = 2] = "CHARACTER", t[t.PIXEL = 3] = "PIXEL", t[t.PERCENT = 4] = "PERCENT", t))(um || {}), lm = /* @__PURE__ */ ((t) => (t[t.CENTER = 0] = "CENTER", t[t.INSIDE = 1] = "INSIDE", t[t.LEFT = 2] = "LEFT", t[t.OUTSIDE = 3] = "OUTSIDE", t[t.RIGHT = 4] = "RIGHT", t[t.BOTH = 5] = "BOTH", t[t.DISTRIBUTE = 6] = "DISTRIBUTE", t))(lm || {}), cm = /* @__PURE__ */ ((t) => (t[t.BOTTOM = 0] = "BOTTOM", t[t.CENTER = 1] = "CENTER", t[t.INSIDE = 2] = "INSIDE", t[t.OUTSIDE = 3] = "OUTSIDE", t[t.TOP = 4] = "TOP", t))(cm || {}), hm = /* @__PURE__ */ ((t) => (t[t.compressPunctuation = 0] = "compressPunctuation", t[t.compressPunctuationAndJapaneseKana = 1] = "compressPunctuationAndJapaneseKana", t[t.doNotCompress = 2] = "doNotCompress", t))(hm || {}), dm = /* @__PURE__ */ ((t) => (t[t.PORTRAIT = 0] = "PORTRAIT", t[t.LANDSCAPE = 1] = "LANDSCAPE", t))(dm || {}), fm = /* @__PURE__ */ ((t) => (t[t.forward = 0] = "forward", t[t.backward = 1] = "backward", t[t.front = 2] = "front", t[t.back = 3] = "back", t))(fm || {}), gm = /* @__PURE__ */ ((t) => (t[t.UNRECOGNIZED = -1] = "UNRECOGNIZED", t[t.DRAWING_IMAGE = 0] = "DRAWING_IMAGE", t[t.DRAWING_SHAPE = 1] = "DRAWING_SHAPE", t[t.DRAWING_CHART = 2] = "DRAWING_CHART", t[t.DRAWING_TABLE = 3] = "DRAWING_TABLE", t[t.DRAWING_SMART_ART = 4] = "DRAWING_SMART_ART", t[t.DRAWING_VIDEO = 5] = "DRAWING_VIDEO", t[t.DRAWING_GROUP = 6] = "DRAWING_GROUP", t[t.DRAWING_UNIT = 7] = "DRAWING_UNIT", t[t.DRAWING_DOM = 8] = "DRAWING_DOM", t))(gm || {}), Fu = /* @__PURE__ */ ((t) => (t[t.SLIDE = 0] = "SLIDE", t[t.MASTER = 1] = "MASTER", t[t.LAYOUT = 2] = "LAYOUT", t[t.HANDOUT_MASTER = 3] = "HANDOUT_MASTER", t[t.NOTES_MASTER = 4] = "NOTES_MASTER", t))(Fu || {}), pm = /* @__PURE__ */ ((t) => (t[t.SHAPE = 0] = "SHAPE", t[t.IMAGE = 1] = "IMAGE", t[t.TEXT = 2] = "TEXT", t[t.SPREADSHEET = 3] = "SPREADSHEET", t[t.DOCUMENT = 4] = "DOCUMENT", t[t.SLIDE = 5] = "SLIDE", t))(pm || {}), mm = /* @__PURE__ */ ((t) => (t[t.RELATIVE_SLIDE_LINK_UNSPECIFIED = 0] = "RELATIVE_SLIDE_LINK_UNSPECIFIED", t[t.NEXT_SLIDE = 1] = "NEXT_SLIDE", t[t.PREVIOUS_SLIDE = 2] = "PREVIOUS_SLIDE", t[t.FIRST_SLIDE = 3] = "FIRST_SLIDE", t[t.LAST_SLIDE = 4] = "LAST_SLIDE", t))(mm || {}), Fe = /* @__PURE__ */ ((t) => (t[t.UNIVER_UNKNOWN = 0] = "UNIVER_UNKNOWN", t[t.UNIVER_DOC = 1] = "UNIVER_DOC", t[t.UNIVER_SHEET = 2] = "UNIVER_SHEET", t[t.UNIVER_SLIDE = 3] = "UNIVER_SLIDE", t[t.UNIVER_PROJECT = 4] = "UNIVER_PROJECT", t[t.UNRECOGNIZED = -1] = "UNRECOGNIZED", t))(Fe || {}), Tt = /* @__PURE__ */ ((t) => (t[t.Reader = 0] = "Reader", t[t.Editor = 1] = "Editor", t[t.Owner = 2] = "Owner", t[t.UNRECOGNIZED = -1] = "UNRECOGNIZED", t))(Tt || {}), Js = /* @__PURE__ */ ((t) => (t[t.SomeCollaborator = 0] = "SomeCollaborator", t[t.AllCollaborator = 1] = "AllCollaborator", t[t.OneSelf = 2] = "OneSelf", t[t.UNRECOGNIZED = -1] = "UNRECOGNIZED", t))(Js || {});
  8073. class Ui extends nt {
  8074. }
  8075. function _m(t = re.generateRandomId(6), e = ur.EN_US, n = "") {
  8076. return {
  8077. id: t,
  8078. locale: e,
  8079. title: n,
  8080. // title should get from request.
  8081. tableSource: {},
  8082. drawings: {},
  8083. drawingsOrder: [],
  8084. headers: {},
  8085. footers: {},
  8086. body: {
  8087. dataStream: `\r
  8088. `,
  8089. textRuns: [],
  8090. customBlocks: [],
  8091. tables: [],
  8092. paragraphs: [
  8093. {
  8094. startIndex: 0,
  8095. paragraphStyle: {
  8096. spaceAbove: { v: 5 },
  8097. lineSpacing: 1,
  8098. spaceBelow: { v: 0 }
  8099. }
  8100. }
  8101. ],
  8102. sectionBreaks: [
  8103. {
  8104. startIndex: 1
  8105. }
  8106. ]
  8107. },
  8108. documentStyle: {
  8109. pageSize: {
  8110. width: 793.3333333333334,
  8111. height: 1122.6666666666667
  8112. },
  8113. documentFlavor: ku.TRADITIONAL,
  8114. marginTop: 50,
  8115. marginBottom: 50,
  8116. marginRight: 50,
  8117. marginLeft: 50,
  8118. renderConfig: {
  8119. zeroWidthParagraphBreak: we.FALSE,
  8120. vertexAngle: 0,
  8121. centerAngle: 0,
  8122. background: {
  8123. rgb: "#ccc"
  8124. }
  8125. },
  8126. autoHyphenation: we.TRUE,
  8127. doNotHyphenateCaps: we.FALSE,
  8128. consecutiveHyphenLimit: 2,
  8129. defaultHeaderId: "",
  8130. defaultFooterId: "",
  8131. evenPageHeaderId: "",
  8132. evenPageFooterId: "",
  8133. firstPageHeaderId: "",
  8134. firstPageFooterId: "",
  8135. evenAndOddHeaders: we.FALSE,
  8136. useFirstPageHeaderFooter: we.FALSE,
  8137. marginHeader: 30,
  8138. marginFooter: 30
  8139. },
  8140. settings: {}
  8141. };
  8142. }
  8143. var $n = {}, Ir = {}, vr = {}, qo;
  8144. function Em() {
  8145. if (qo) return vr;
  8146. qo = 1, Object.defineProperty(vr, "__esModule", { value: !0 });
  8147. function t(r, s) {
  8148. if (Array.isArray(s))
  8149. return !1;
  8150. for (let i in r)
  8151. if (!n(r[i], s[i]))
  8152. return !1;
  8153. for (let i in s)
  8154. if (r[i] === void 0)
  8155. return !1;
  8156. return !0;
  8157. }
  8158. function e(r, s) {
  8159. if (!Array.isArray(s) || r.length !== s.length)
  8160. return !1;
  8161. for (let i = 0; i < r.length; i++)
  8162. if (!n(r[i], s[i]))
  8163. return !1;
  8164. return !0;
  8165. }
  8166. function n(r, s) {
  8167. return r === s ? !0 : r === null || s === null || typeof r != "object" || typeof s != "object" ? !1 : Array.isArray(r) ? e(r, s) : t(r, s);
  8168. }
  8169. return vr.default = n, vr;
  8170. }
  8171. var yr = {}, ea;
  8172. function Cm() {
  8173. if (ea) return yr;
  8174. ea = 1, Object.defineProperty(yr, "__esModule", { value: !0 });
  8175. function t(e) {
  8176. if (e === null)
  8177. return null;
  8178. if (Array.isArray(e))
  8179. return e.map(t);
  8180. if (typeof e == "object") {
  8181. const n = {};
  8182. for (let r in e)
  8183. n[r] = t(e[r]);
  8184. return n;
  8185. } else
  8186. return e;
  8187. }
  8188. return yr.default = t, yr;
  8189. }
  8190. var Ns = {}, ta;
  8191. function $u() {
  8192. return ta || (ta = 1, function(t) {
  8193. Object.defineProperty(t, "__esModule", { value: !0 }), t.eachChildOf = t.advancer = t.readCursor = t.writeCursor = t.WriteCursor = t.ReadCursor = t.isValidPathItem = void 0;
  8194. function e(l, h) {
  8195. if (!l)
  8196. throw new Error(h);
  8197. }
  8198. const n = (l) => l != null && typeof l == "object" && !Array.isArray(l), r = (l, h) => (
  8199. // All the numbers, then all the letters. Just as the gods of ascii intended.
  8200. typeof l == typeof h ? l > h : typeof l == "string" && typeof h == "number"
  8201. );
  8202. function s(l, h) {
  8203. for (let d in l) {
  8204. const f = d;
  8205. h.write(f, l[f]);
  8206. }
  8207. }
  8208. t.isValidPathItem = (l) => typeof l == "number" || typeof l == "string" && l !== "__proto__";
  8209. class i {
  8210. constructor(h = null) {
  8211. this.parents = [], this.indexes = [], this.lcIdx = -1, this.idx = -1, this.container = h;
  8212. }
  8213. ascend() {
  8214. e(this.parents.length === this.indexes.length / 2), this.idx === 0 ? this.parents.length ? (this.lcIdx = this.indexes.pop(), this.container = this.parents.pop(), this.idx = this.indexes.pop()) : (this.lcIdx = 0, this.idx = -1) : (e(this.idx > 0), this.idx--, n(this.container[this.idx]) && this.idx--);
  8215. }
  8216. getPath() {
  8217. const h = [];
  8218. let d = this.container, f = this.parents.length - 1, E = this.idx;
  8219. for (; E >= 0; )
  8220. h.unshift(d[E]), E === 0 ? (E = this.indexes[f * 2], d = this.parents[f--]) : E -= n(d[E - 1]) ? 2 : 1;
  8221. return h;
  8222. }
  8223. }
  8224. class o extends i {
  8225. get() {
  8226. return this.container ? this.container.slice(this.idx + 1) : null;
  8227. }
  8228. // Its only valid to call this after descending into a child.
  8229. getKey() {
  8230. return e(this.container != null, "Invalid call to getKey before cursor descended"), this.container[this.idx];
  8231. }
  8232. getComponent() {
  8233. let h;
  8234. return this.container && this.container.length > this.idx + 1 && n(h = this.container[this.idx + 1]) ? h : null;
  8235. }
  8236. descendFirst() {
  8237. let h = this.idx + 1;
  8238. if (!this.container || h >= this.container.length || n(this.container[h]) && h + 1 >= this.container.length)
  8239. return !1;
  8240. n(this.container[h]) && h++;
  8241. const d = this.container[h];
  8242. return Array.isArray(d) ? (this.indexes.push(this.idx), this.parents.push(this.container), this.indexes.push(h), this.idx = 0, this.container = d) : this.idx = h, !0;
  8243. }
  8244. nextSibling() {
  8245. if (e(this.parents.length === this.indexes.length / 2), this.idx > 0 || this.parents.length === 0)
  8246. return !1;
  8247. const h = this.indexes[this.indexes.length - 1] + 1, d = this.parents[this.parents.length - 1];
  8248. return h >= d.length ? !1 : (e(!isNaN(h)), this.indexes[this.indexes.length - 1] = h, this.container = d[h], !0);
  8249. }
  8250. _init(h, d, f, E) {
  8251. this.container = h, this.idx = d, this.parents = f.slice(), this.indexes = E.slice();
  8252. }
  8253. clone() {
  8254. const h = new o();
  8255. return h._init(this.container, this.idx, this.parents, this.indexes), h;
  8256. }
  8257. *[Symbol.iterator]() {
  8258. if (this.descendFirst()) {
  8259. do
  8260. yield this.getKey();
  8261. while (this.nextSibling());
  8262. this.ascend();
  8263. }
  8264. }
  8265. // TODO(cleanup): Consider moving these functions out of cursor, since
  8266. // they're really just helper methods.
  8267. // It'd be really nice to do this using generators.
  8268. traverse(h, d) {
  8269. const f = this.getComponent();
  8270. f && d(f, h);
  8271. for (const E of this)
  8272. h && h.descend(E), this.traverse(h, d), h && h.ascend();
  8273. }
  8274. eachPick(h, d) {
  8275. this.traverse(h, (f, E) => {
  8276. f.p != null && d(f.p, E);
  8277. });
  8278. }
  8279. eachDrop(h, d) {
  8280. this.traverse(h, (f, E) => {
  8281. f.d != null && d(f.d, E);
  8282. });
  8283. }
  8284. }
  8285. t.ReadCursor = o;
  8286. class a extends i {
  8287. constructor(h = null) {
  8288. super(h), this.pendingDescent = [], this._op = h;
  8289. }
  8290. flushDescent() {
  8291. e(this.parents.length === this.indexes.length / 2), this.container === null && (this._op = this.container = []);
  8292. for (let h = 0; h < this.pendingDescent.length; h++) {
  8293. const d = this.pendingDescent[h];
  8294. let f = this.idx + 1;
  8295. if (f < this.container.length && n(this.container[f]) && f++, e(f === this.container.length || !n(this.container[f])), f === this.container.length)
  8296. this.container.push(d), this.idx = f;
  8297. else if (this.container[f] === d)
  8298. this.idx = f;
  8299. else {
  8300. if (!Array.isArray(this.container[f])) {
  8301. const E = this.container.splice(f, this.container.length - f);
  8302. this.container.push(E), this.lcIdx > -1 && (this.lcIdx = f);
  8303. }
  8304. for (this.indexes.push(this.idx), this.parents.push(this.container), this.lcIdx !== -1 && (e(r(d, this.container[this.lcIdx][0])), f = this.lcIdx + 1, this.lcIdx = -1); f < this.container.length && r(d, this.container[f][0]); )
  8305. f++;
  8306. if (this.indexes.push(f), this.idx = 0, f < this.container.length && this.container[f][0] === d)
  8307. this.container = this.container[f];
  8308. else {
  8309. const E = [d];
  8310. this.container.splice(f, 0, E), this.container = E;
  8311. }
  8312. }
  8313. }
  8314. this.pendingDescent.length = 0;
  8315. }
  8316. reset() {
  8317. this.lcIdx = -1;
  8318. }
  8319. // Creates and returns a component, creating one if need be. You should
  8320. // probably write to it immediately - ops are not valid with empty
  8321. // components.
  8322. getComponent() {
  8323. this.flushDescent();
  8324. const h = this.idx + 1;
  8325. if (h < this.container.length && n(this.container[h]))
  8326. return this.container[h];
  8327. {
  8328. const d = {};
  8329. return this.container.splice(h, 0, d), d;
  8330. }
  8331. }
  8332. write(h, d) {
  8333. const f = this.getComponent();
  8334. e(f[h] == null || f[h] === d, "Internal consistency error: Overwritten component. File a bug"), f[h] = d;
  8335. }
  8336. get() {
  8337. return this._op;
  8338. }
  8339. descend(h) {
  8340. if (!t.isValidPathItem(h))
  8341. throw Error("Invalid JSON key");
  8342. this.pendingDescent.push(h);
  8343. }
  8344. descendPath(h) {
  8345. return this.pendingDescent.push(...h), this;
  8346. }
  8347. ascend() {
  8348. this.pendingDescent.length ? this.pendingDescent.pop() : super.ascend();
  8349. }
  8350. mergeTree(h, d = s) {
  8351. if (h === null)
  8352. return;
  8353. if (e(Array.isArray(h)), h === this._op)
  8354. throw Error("Cannot merge into my own tree");
  8355. const f = this.lcIdx, E = this.parents.length;
  8356. let R = 0;
  8357. for (let O = 0; O < h.length; O++) {
  8358. const U = h[O];
  8359. typeof U == "string" || typeof U == "number" ? (R++, this.descend(U)) : Array.isArray(U) ? this.mergeTree(U, d) : typeof U == "object" && d(U, this);
  8360. }
  8361. for (; R--; )
  8362. this.ascend();
  8363. this.lcIdx = this.parents.length === E ? f : -1;
  8364. }
  8365. at(h, d) {
  8366. this.descendPath(h), d(this);
  8367. for (let f = 0; f < h.length; f++)
  8368. this.ascend();
  8369. return this;
  8370. }
  8371. // This is used by helpers, so the strict ordering guarantees are
  8372. // relaxed.
  8373. writeAtPath(h, d, f) {
  8374. return this.at(h, () => this.write(d, f)), this.reset(), this;
  8375. }
  8376. writeMove(h, d, f = 0) {
  8377. return this.writeAtPath(h, "p", f).writeAtPath(d, "d", f);
  8378. }
  8379. getPath() {
  8380. const h = super.getPath();
  8381. return h.push(...this.pendingDescent), h;
  8382. }
  8383. }
  8384. t.WriteCursor = a, t.writeCursor = () => new a(), t.readCursor = (l) => new o(l);
  8385. function u(l, h, d) {
  8386. let f, E;
  8387. E = f = l ? l.descendFirst() : !1;
  8388. function R(O) {
  8389. let U;
  8390. for (; E; ) {
  8391. const ne = U = l.getKey();
  8392. if (O != null) {
  8393. let X = !1;
  8394. if (h && typeof ne == "number" && (U = h(ne, l.getComponent()), U < 0 && (U = ~U, X = !0)), r(U, O))
  8395. return null;
  8396. if (U === O && !X)
  8397. return l;
  8398. }
  8399. d && typeof U == "number" && d(U, l.getComponent()), E = l.nextSibling();
  8400. }
  8401. return null;
  8402. }
  8403. return R.end = () => {
  8404. f && l.ascend();
  8405. }, R;
  8406. }
  8407. t.advancer = u;
  8408. function c(l, h, d) {
  8409. let f, E, R, O;
  8410. for (f = E = l && l.descendFirst(), R = O = h && h.descendFirst(); f || R; ) {
  8411. let U = f ? l.getKey() : null, ne = R ? h.getKey() : null;
  8412. U !== null && ne !== null && (r(ne, U) ? ne = null : U !== ne && (U = null)), d(U == null ? ne : U, U != null ? l : null, ne != null ? h : null), U != null && f && (f = l.nextSibling()), ne != null && R && (R = h.nextSibling());
  8413. }
  8414. E && l.ascend(), O && h.ascend();
  8415. }
  8416. t.eachChildOf = c;
  8417. }(Ns)), Ns;
  8418. }
  8419. var Ts = {}, na;
  8420. function Bu() {
  8421. return na || (na = 1, function(t) {
  8422. Object.defineProperty(t, "__esModule", { value: !0 }), t.ConflictType = void 0, function(e) {
  8423. e[e.RM_UNEXPECTED_CONTENT = 1] = "RM_UNEXPECTED_CONTENT", e[e.DROP_COLLISION = 2] = "DROP_COLLISION", e[e.BLACKHOLE = 3] = "BLACKHOLE";
  8424. }(t.ConflictType || (t.ConflictType = {}));
  8425. }(Ts)), Ts;
  8426. }
  8427. var an = {}, un = {}, ra;
  8428. function Pi() {
  8429. return ra || (ra = 1, Object.defineProperty(un, "__esModule", { value: !0 }), un.uniToStrPos = un.strPosToUni = void 0, un.strPosToUni = (t, e = t.length) => {
  8430. let n = 0, r = 0;
  8431. for (; r < e; r++) {
  8432. const s = t.charCodeAt(r);
  8433. s >= 55296 && s <= 57343 && (n++, r++);
  8434. }
  8435. if (r !== e)
  8436. throw Error("Invalid offset - splits unicode bytes");
  8437. return r - n;
  8438. }, un.uniToStrPos = (t, e) => {
  8439. let n = 0;
  8440. for (; e > 0; e--) {
  8441. const r = t.charCodeAt(n);
  8442. n += r >= 55296 && r <= 57343 ? 2 : 1;
  8443. }
  8444. return n;
  8445. }), un;
  8446. }
  8447. var Ms = {}, sa;
  8448. function Zs() {
  8449. return sa || (sa = 1, function(t) {
  8450. Object.defineProperty(t, "__esModule", { value: !0 }), t.uniSlice = t.dlen = t.eachOp = void 0;
  8451. const e = Pi(), n = (T) => {
  8452. if (!Array.isArray(T))
  8453. throw Error("Op must be an array of components");
  8454. let A = null;
  8455. for (let H = 0; H < T.length; H++) {
  8456. const Z = T[H];
  8457. switch (typeof Z) {
  8458. case "object":
  8459. if (typeof Z.d != "number" && typeof Z.d != "string")
  8460. throw Error("Delete must be number or string");
  8461. if (t.dlen(Z.d) <= 0)
  8462. throw Error("Deletes must not be empty");
  8463. break;
  8464. case "string":
  8465. if (!(Z.length > 0))
  8466. throw Error("Inserts cannot be empty");
  8467. break;
  8468. case "number":
  8469. if (!(Z > 0))
  8470. throw Error("Skip components must be >0");
  8471. if (typeof A == "number")
  8472. throw Error("Adjacent skip components should be combined");
  8473. break;
  8474. }
  8475. A = Z;
  8476. }
  8477. if (typeof A == "number")
  8478. throw Error("Op has a trailing skip");
  8479. };
  8480. function r(T, A) {
  8481. let H = 0, Z = 0;
  8482. for (let fe = 0; fe < T.length; fe++) {
  8483. const ae = T[fe];
  8484. switch (A(ae, H, Z), typeof ae) {
  8485. case "object":
  8486. H += t.dlen(ae.d);
  8487. break;
  8488. case "string":
  8489. Z += e.strPosToUni(ae);
  8490. break;
  8491. case "number":
  8492. H += ae, Z += ae;
  8493. break;
  8494. }
  8495. }
  8496. }
  8497. t.eachOp = r;
  8498. function s(T, A) {
  8499. const H = [], Z = a(H);
  8500. return r(T, (fe, ae, m) => {
  8501. Z(A(fe, ae, m));
  8502. }), h(H);
  8503. }
  8504. const i = (T) => T, o = (T) => s(T, i);
  8505. t.dlen = (T) => typeof T == "number" ? T : e.strPosToUni(T);
  8506. const a = (T) => (A) => {
  8507. if (!(!A || A.d === 0 || A.d === "")) if (T.length === 0)
  8508. T.push(A);
  8509. else if (typeof A == typeof T[T.length - 1])
  8510. if (typeof A == "object") {
  8511. const H = T[T.length - 1];
  8512. H.d = typeof H.d == "string" && typeof A.d == "string" ? H.d + A.d : t.dlen(H.d) + t.dlen(A.d);
  8513. } else
  8514. T[T.length - 1] += A;
  8515. else
  8516. T.push(A);
  8517. }, u = (T) => typeof T == "number" ? T : typeof T == "string" ? e.strPosToUni(T) : typeof T.d == "number" ? T.d : e.strPosToUni(T.d);
  8518. t.uniSlice = (T, A, H) => {
  8519. const Z = e.uniToStrPos(T, A), fe = H == null ? 1 / 0 : e.uniToStrPos(T, H);
  8520. return T.slice(Z, fe);
  8521. };
  8522. const c = (T, A, H) => typeof T == "number" ? H == null ? T - A : Math.min(T, H) - A : t.uniSlice(T, A, H), l = (T) => {
  8523. let A = 0, H = 0;
  8524. return { take: (ae, m) => {
  8525. if (A === T.length)
  8526. return ae === -1 ? null : ae;
  8527. const j = T[A];
  8528. let y;
  8529. if (typeof j == "number")
  8530. return ae === -1 || j - H <= ae ? (y = j - H, ++A, H = 0, y) : (H += ae, ae);
  8531. if (typeof j == "string") {
  8532. if (ae === -1 || m === "i" || e.strPosToUni(j.slice(H)) <= ae)
  8533. return y = j.slice(H), ++A, H = 0, y;
  8534. {
  8535. const M = H + e.uniToStrPos(j.slice(H), ae);
  8536. return y = j.slice(H, M), H = M, y;
  8537. }
  8538. } else {
  8539. if (ae === -1 || m === "d" || t.dlen(j.d) - H <= ae)
  8540. return y = { d: c(j.d, H) }, ++A, H = 0, y;
  8541. {
  8542. let M = c(j.d, H, H + ae);
  8543. return H += ae, { d: M };
  8544. }
  8545. }
  8546. }, peek: () => T[A] };
  8547. }, h = (T) => (T.length > 0 && typeof T[T.length - 1] == "number" && T.pop(), T);
  8548. function d(T, A, H) {
  8549. if (H !== "left" && H !== "right")
  8550. throw Error("side (" + H + ") must be 'left' or 'right'");
  8551. n(T), n(A);
  8552. const Z = [], fe = a(Z), { take: ae, peek: m } = l(T);
  8553. for (let y = 0; y < A.length; y++) {
  8554. const M = A[y];
  8555. let b, w;
  8556. switch (typeof M) {
  8557. case "number":
  8558. for (b = M; b > 0; )
  8559. w = ae(b, "i"), fe(w), typeof w != "string" && (b -= u(w));
  8560. break;
  8561. case "string":
  8562. H === "left" && typeof m() == "string" && fe(ae(-1)), fe(e.strPosToUni(M));
  8563. break;
  8564. case "object":
  8565. for (b = t.dlen(M.d); b > 0; )
  8566. switch (w = ae(b, "i"), typeof w) {
  8567. case "number":
  8568. b -= w;
  8569. break;
  8570. case "string":
  8571. fe(w);
  8572. break;
  8573. case "object":
  8574. b -= t.dlen(w.d);
  8575. }
  8576. break;
  8577. }
  8578. }
  8579. let j;
  8580. for (; j = ae(-1); )
  8581. fe(j);
  8582. return h(Z);
  8583. }
  8584. function f(T, A) {
  8585. n(T), n(A);
  8586. const H = [], Z = a(H), { take: fe } = l(T);
  8587. for (let m = 0; m < A.length; m++) {
  8588. const j = A[m];
  8589. let y, M;
  8590. switch (typeof j) {
  8591. case "number":
  8592. for (y = j; y > 0; )
  8593. M = fe(y, "d"), Z(M), typeof M != "object" && (y -= u(M));
  8594. break;
  8595. case "string":
  8596. Z(j);
  8597. break;
  8598. case "object":
  8599. y = t.dlen(j.d);
  8600. let b = 0;
  8601. for (; b < y; )
  8602. switch (M = fe(y - b, "d"), typeof M) {
  8603. case "number":
  8604. Z({ d: c(j.d, b, b + M) }), b += M;
  8605. break;
  8606. case "string":
  8607. b += e.strPosToUni(M);
  8608. break;
  8609. case "object":
  8610. Z(M);
  8611. }
  8612. break;
  8613. }
  8614. }
  8615. let ae;
  8616. for (; ae = fe(-1); )
  8617. Z(ae);
  8618. return h(H);
  8619. }
  8620. const E = (T, A) => {
  8621. let H = 0;
  8622. for (let Z = 0; Z < A.length && T > H; Z++) {
  8623. const fe = A[Z];
  8624. switch (typeof fe) {
  8625. case "number": {
  8626. H += fe;
  8627. break;
  8628. }
  8629. case "string":
  8630. const ae = e.strPosToUni(fe);
  8631. H += ae, T += ae;
  8632. break;
  8633. case "object":
  8634. T -= Math.min(t.dlen(fe.d), T - H);
  8635. break;
  8636. }
  8637. }
  8638. return T;
  8639. }, R = (T, A) => typeof T == "number" ? E(T, A) : T.map((H) => E(H, A));
  8640. function O(T, A, H) {
  8641. return s(T, (Z, fe) => typeof Z == "object" && typeof Z.d == "number" ? { d: H.slice(A, fe, fe + Z.d) } : Z);
  8642. }
  8643. function U(T) {
  8644. return s(T, (A) => {
  8645. switch (typeof A) {
  8646. case "object":
  8647. if (typeof A.d == "number")
  8648. throw Error("Cannot invert text op: Deleted characters missing from operation. makeInvertible must be called first.");
  8649. return A.d;
  8650. // delete -> insert
  8651. case "string":
  8652. return { d: A };
  8653. // Insert -> delete
  8654. case "number":
  8655. return A;
  8656. }
  8657. });
  8658. }
  8659. function ne(T) {
  8660. return s(T, (A) => typeof A == "object" && typeof A.d == "string" ? { d: e.strPosToUni(A.d) } : A);
  8661. }
  8662. function X(T) {
  8663. let A = !0;
  8664. return r(T, (H) => {
  8665. typeof H == "object" && typeof H.d == "number" && (A = !1);
  8666. }), A;
  8667. }
  8668. function de(T) {
  8669. return {
  8670. name: "text-unicode",
  8671. uri: "http://sharejs.org/types/text-unicode",
  8672. trim: h,
  8673. normalize: o,
  8674. checkOp: n,
  8675. /** Create a new text snapshot.
  8676. *
  8677. * @param {string} initial - initial snapshot data. Optional. Defaults to ''.
  8678. * @returns {Snap} Initial document snapshot object
  8679. */
  8680. create(A = "") {
  8681. if (typeof A != "string")
  8682. throw Error("Initial data must be a string");
  8683. return T.create(A);
  8684. },
  8685. /** Apply an operation to a document snapshot
  8686. */
  8687. apply(A, H) {
  8688. n(H);
  8689. const Z = T.builder(A);
  8690. for (let fe = 0; fe < H.length; fe++) {
  8691. const ae = H[fe];
  8692. switch (typeof ae) {
  8693. case "number":
  8694. Z.skip(ae);
  8695. break;
  8696. case "string":
  8697. Z.append(ae);
  8698. break;
  8699. case "object":
  8700. Z.del(t.dlen(ae.d));
  8701. break;
  8702. }
  8703. }
  8704. return Z.build();
  8705. },
  8706. transform: d,
  8707. compose: f,
  8708. transformPosition: E,
  8709. transformSelection: R,
  8710. isInvertible: X,
  8711. makeInvertible(A, H) {
  8712. return O(A, H, T);
  8713. },
  8714. stripInvertible: ne,
  8715. invert: U,
  8716. invertWithDoc(A, H) {
  8717. return U(O(A, H, T));
  8718. },
  8719. isNoop: (A) => A.length === 0
  8720. };
  8721. }
  8722. t.default = de;
  8723. }(Ms)), Ms;
  8724. }
  8725. var wr = {}, ia;
  8726. function Rm() {
  8727. if (ia) return wr;
  8728. ia = 1, Object.defineProperty(wr, "__esModule", { value: !0 });
  8729. const t = Zs(), e = Pi();
  8730. function n(r, s) {
  8731. return {
  8732. // Returns the text content of the document
  8733. get: r,
  8734. // Returns the number of characters in the string
  8735. getLength() {
  8736. return r().length;
  8737. },
  8738. // Insert the specified text at the given position in the document
  8739. insert(i, o, a) {
  8740. const u = e.strPosToUni(r(), i);
  8741. return s([u, o], a);
  8742. },
  8743. remove(i, o, a) {
  8744. const u = e.strPosToUni(r(), i);
  8745. return s([u, { d: o }], a);
  8746. },
  8747. // When you use this API, you should implement these two methods
  8748. // in your editing context.
  8749. //onInsert: function(pos, text) {},
  8750. //onRemove: function(pos, removedLength) {},
  8751. _onOp(i) {
  8752. t.eachOp(i, (o, a, u) => {
  8753. switch (typeof o) {
  8754. case "string":
  8755. this.onInsert && this.onInsert(u, o);
  8756. break;
  8757. case "object":
  8758. const c = t.dlen(o.d);
  8759. this.onRemove && this.onRemove(u, c);
  8760. }
  8761. });
  8762. },
  8763. onInsert: null,
  8764. onRemove: null
  8765. };
  8766. }
  8767. return wr.default = n, n.provides = { text: !0 }, wr;
  8768. }
  8769. var oa;
  8770. function Im() {
  8771. return oa || (oa = 1, function(t) {
  8772. var e = an.__createBinding || (Object.create ? function(d, f, E, R) {
  8773. R === void 0 && (R = E), Object.defineProperty(d, R, { enumerable: !0, get: function() {
  8774. return f[E];
  8775. } });
  8776. } : function(d, f, E, R) {
  8777. R === void 0 && (R = E), d[R] = f[E];
  8778. }), n = an.__setModuleDefault || (Object.create ? function(d, f) {
  8779. Object.defineProperty(d, "default", { enumerable: !0, value: f });
  8780. } : function(d, f) {
  8781. d.default = f;
  8782. }), r = an.__importStar || function(d) {
  8783. if (d && d.__esModule) return d;
  8784. var f = {};
  8785. if (d != null) for (var E in d) Object.hasOwnProperty.call(d, E) && e(f, d, E);
  8786. return n(f, d), f;
  8787. }, s = an.__importDefault || function(d) {
  8788. return d && d.__esModule ? d : { default: d };
  8789. };
  8790. Object.defineProperty(t, "__esModule", { value: !0 }), t.type = t.remove = t.insert = void 0;
  8791. const i = Pi(), o = r(Zs()), a = s(Rm()), u = {
  8792. create(d) {
  8793. return d;
  8794. },
  8795. toString(d) {
  8796. return d;
  8797. },
  8798. builder(d) {
  8799. if (typeof d != "string")
  8800. throw Error("Invalid document snapshot: " + d);
  8801. const f = [];
  8802. return {
  8803. skip(E) {
  8804. let R = i.uniToStrPos(d, E);
  8805. if (R > d.length)
  8806. throw Error("The op is too long for this document");
  8807. f.push(d.slice(0, R)), d = d.slice(R);
  8808. },
  8809. append(E) {
  8810. f.push(E);
  8811. },
  8812. del(E) {
  8813. d = d.slice(i.uniToStrPos(d, E));
  8814. },
  8815. build() {
  8816. return f.join("") + d;
  8817. }
  8818. };
  8819. },
  8820. slice: o.uniSlice
  8821. }, c = o.default(u), l = Object.assign(Object.assign({}, c), { api: a.default });
  8822. t.type = l, t.insert = (d, f) => f.length === 0 ? [] : d === 0 ? [f] : [d, f], t.remove = (d, f) => o.dlen(f) === 0 ? [] : d === 0 ? [{ d: f }] : [d, { d: f }];
  8823. var h = Zs();
  8824. Object.defineProperty(t, "makeType", { enumerable: !0, get: function() {
  8825. return h.default;
  8826. } });
  8827. }(an)), an;
  8828. }
  8829. var aa;
  8830. function vm() {
  8831. return aa || (aa = 1, function(t) {
  8832. var e = Ir.__importDefault || function(v) {
  8833. return v && v.__esModule ? v : {
  8834. default: v
  8835. };
  8836. };
  8837. Object.defineProperty(t, "__esModule", {
  8838. value: !0
  8839. }), t.editOp = t.replaceOp = t.insertOp = t.moveOp = t.removeOp = t.type = void 0;
  8840. const n = e(Em()), r = e(Cm()), s = $u(), i = Bu();
  8841. function o(v, F) {
  8842. if (!v) throw new Error(F);
  8843. }
  8844. t.type = {
  8845. name: "json1",
  8846. uri: "http://sharejs.org/types/JSONv1",
  8847. readCursor: s.readCursor,
  8848. writeCursor: s.writeCursor,
  8849. create: (v) => v,
  8850. isNoop: (v) => v == null,
  8851. setDebug(v) {
  8852. },
  8853. registerSubtype: U,
  8854. checkValidOp: fe,
  8855. normalize: ae,
  8856. apply: m,
  8857. transformPosition: j,
  8858. compose: y,
  8859. tryTransform: Y,
  8860. transform: he,
  8861. makeInvertible: w,
  8862. invert: M,
  8863. invertWithDoc: k,
  8864. RM_UNEXPECTED_CONTENT: i.ConflictType.RM_UNEXPECTED_CONTENT,
  8865. DROP_COLLISION: i.ConflictType.DROP_COLLISION,
  8866. BLACKHOLE: i.ConflictType.BLACKHOLE,
  8867. transformNoConflict: (v, F, V) => be(() => !0, v, F, V),
  8868. typeAllowingConflictsPred: (v) => Object.assign(Object.assign({}, t.type), {
  8869. transform: (F, V, K) => be(v, F, V, K)
  8870. })
  8871. };
  8872. const a = (v) => v ? v.getComponent() : null;
  8873. function u(v) {
  8874. return v && typeof v == "object" && !Array.isArray(v);
  8875. }
  8876. const c = (v) => Array.isArray(v) ? v.slice() : v !== null && typeof v == "object" ? Object.assign({}, v) : v, l = (v) => v && (v.p != null || v.r !== void 0), h = (v) => v && (v.d != null || v.i !== void 0);
  8877. function d(v, F) {
  8878. return o(v != null), typeof F == "number" ? (o(Array.isArray(v), "Invalid key - child is not an array"), (v = v.slice()).splice(F, 1)) : (o(u(v), "Invalid key - child is not an object"), delete (v = Object.assign({}, v))[F]), v;
  8879. }
  8880. function f(v, F, V) {
  8881. return typeof F == "number" ? (o(v != null, "Container is missing for key"), o(Array.isArray(v), "Cannot use numerical key for object container"), o(v.length >= F, "Cannot insert into out of bounds index"), v.splice(F, 0, V)) : (o(u(v), "Cannot insert into missing item"), o(v[F] === void 0, "Trying to overwrite value at key. Your op needs to remove it first"), v[F] = V), V;
  8882. }
  8883. t.removeOp = (v, F = !0) => s.writeCursor().writeAtPath(v, "r", F).get(), t.moveOp = (v, F) => s.writeCursor().writeMove(v, F).get(), t.insertOp = (v, F) => s.writeCursor().writeAtPath(v, "i", F).get(), t.replaceOp = (v, F, V) => s.writeCursor().at(v, (K) => {
  8884. K.write("r", F), K.write("i", V);
  8885. }).get(), t.editOp = (v, F, V, K = !1) => s.writeCursor().at(v, (z) => A(z, F, V, K)).get();
  8886. const E = (v, F) => v != null && (typeof F == "number" ? Array.isArray(v) : typeof v == "object"), R = (v, F) => E(v, F) ? v[F] : void 0, O = {};
  8887. function U(v) {
  8888. let F = v.type ? v.type : v;
  8889. F.name && (O[F.name] = F), F.uri && (O[F.uri] = F);
  8890. }
  8891. const ne = (v) => {
  8892. const F = O[v];
  8893. if (F) return F;
  8894. throw Error("Missing type: " + v);
  8895. };
  8896. U(Im());
  8897. const X = (v, F) => v + F;
  8898. U({
  8899. name: "number",
  8900. apply: X,
  8901. compose: X,
  8902. invert: (v) => -v,
  8903. transform: (v) => v
  8904. });
  8905. const de = (v) => v == null ? null : v.et ? ne(v.et) : v.es ? O["text-unicode"] : v.ena != null ? O.number : null, T = (v) => v.es ? v.es : v.ena != null ? v.ena : v.e, A = (v, F, V, K = !1) => {
  8906. const [z, W] = typeof F == "string" ? [ne(F), F] : [F, F.name];
  8907. !K && z.isNoop && z.isNoop(V) || (W === "number" ? v.write("ena", V) : W === "text-unicode" ? v.write("es", V) : (v.write("et", W), v.write("e", V)));
  8908. };
  8909. function H(v) {
  8910. o(typeof v == "number"), o(v >= 0), o(v === (0 | v));
  8911. }
  8912. function Z(v) {
  8913. typeof v == "number" ? H(v) : o(typeof v == "string");
  8914. }
  8915. function fe(v) {
  8916. if (v === null) return;
  8917. const F = /* @__PURE__ */ new Set(), V = /* @__PURE__ */ new Set(), K = (W) => {
  8918. let ue = !0, oe = !1;
  8919. for (let B in W) {
  8920. const ee = W[B];
  8921. if (ue = !1, o(B === "p" || B === "r" || B === "d" || B === "i" || B === "e" || B === "es" || B === "ena" || B === "et", "Invalid component item '" + B + "'"), B === "p") H(ee), o(!F.has(ee)), F.add(ee), o(W.r === void 0);
  8922. else if (B === "d") H(ee), o(!V.has(ee)), V.add(ee), o(W.i === void 0);
  8923. else if (B === "e" || B === "es" || B === "ena") {
  8924. o(!oe), oe = !0;
  8925. const ie = de(W);
  8926. o(ie, "Missing type in edit"), ie.checkValidOp && ie.checkValidOp(T(W));
  8927. }
  8928. }
  8929. o(!ue);
  8930. }, z = (W, ue, oe) => {
  8931. if (!Array.isArray(W)) throw Error("Op must be null or a list");
  8932. if (W.length === 0) throw Error("Empty descent");
  8933. ue || Z(W[0]);
  8934. let B = 1, ee = 0, ie = 0;
  8935. for (let pe = 0; pe < W.length; pe++) {
  8936. const Oe = W[pe];
  8937. if (o(Oe != null), Array.isArray(Oe)) {
  8938. const Me = z(Oe, !1);
  8939. if (ee) {
  8940. const G = typeof ie, Re = typeof Me;
  8941. G === Re ? o(ie < Me, "descent keys are not in order") : o(G === "number" && Re === "string");
  8942. }
  8943. ie = Me, ee++, B = 3;
  8944. } else typeof Oe == "object" ? (o(B === 1, `Prev not scalar - instead ${B}`), K(Oe), B = 2) : (o(B !== 3), Z(Oe), o(s.isValidPathItem(Oe), "Invalid path key"), B = 1);
  8945. }
  8946. return o(ee !== 1, "Operation makes multiple descents. Remove some []"), o(B === 2 || B === 3), W[0];
  8947. };
  8948. z(v, !0), o(F.size === V.size, "Mismatched picks and drops in op");
  8949. for (let W = 0; W < F.size; W++) o(F.has(W)), o(V.has(W));
  8950. }
  8951. function ae(v) {
  8952. let F = 0, V = [];
  8953. const K = s.writeCursor();
  8954. return K.mergeTree(v, (z, W) => {
  8955. const ue = de(z);
  8956. if (ue) {
  8957. const B = T(z);
  8958. A(W, ue, ue.normalize ? ue.normalize(B) : B);
  8959. }
  8960. for (const B of ["r", "p", "i", "d"]) if (z[B] !== void 0) {
  8961. const ee = B === "p" || B === "d" ? (oe = z[B], V[oe] == null && (V[oe] = F++), V[oe]) : z[B];
  8962. W.write(B, ee);
  8963. }
  8964. var oe;
  8965. }), K.get();
  8966. }
  8967. function m(v, F) {
  8968. if (fe(F), F === null) return v;
  8969. const V = [];
  8970. return function K(z, W) {
  8971. let ue = z, oe = 0, B = {
  8972. root: z
  8973. }, ee = 0, ie = B, pe = "root";
  8974. function Oe() {
  8975. for (; ee < oe; ee++) {
  8976. let Me = W[ee];
  8977. typeof Me != "object" && (o(E(ie, pe)), ie = ie[pe] = c(ie[pe]), pe = Me);
  8978. }
  8979. }
  8980. for (; oe < W.length; oe++) {
  8981. const Me = W[oe];
  8982. if (Array.isArray(Me)) {
  8983. const G = K(ue, Me);
  8984. G !== ue && G !== void 0 && (Oe(), ue = ie[pe] = G);
  8985. } else if (typeof Me == "object") {
  8986. Me.d != null ? (Oe(), ue = f(ie, pe, V[Me.d])) : Me.i !== void 0 && (Oe(), ue = f(ie, pe, Me.i));
  8987. const G = de(Me);
  8988. if (G) Oe(), ue = ie[pe] = G.apply(ue, T(Me));
  8989. else if (Me.e !== void 0) throw Error("Subtype " + Me.et + " undefined");
  8990. } else ue = R(ue, Me);
  8991. }
  8992. return B.root;
  8993. }(v = function K(z, W) {
  8994. const ue = [];
  8995. let oe = 0;
  8996. for (; oe < W.length; oe++) {
  8997. const pe = W[oe];
  8998. if (Array.isArray(pe)) break;
  8999. typeof pe != "object" && (ue.push(z), z = R(z, pe));
  9000. }
  9001. for (let pe = W.length - 1; pe >= oe; pe--) z = K(z, W[pe]);
  9002. for (--oe; oe >= 0; oe--) {
  9003. const pe = W[oe];
  9004. if (typeof pe != "object") {
  9005. const Oe = ue.pop();
  9006. z = z === R(Oe, pe) ? Oe : z === void 0 ? d(Oe, pe) : (ee = pe, ie = z, (B = c(B = Oe))[ee] = ie, B);
  9007. } else l(pe) && (o(z !== void 0, "Cannot pick up or remove undefined"), pe.p != null && (V[pe.p] = z), z = void 0);
  9008. }
  9009. var B, ee, ie;
  9010. return z;
  9011. }(v, F), F);
  9012. }
  9013. function j(v, F) {
  9014. v = v.slice(), fe(F);
  9015. const V = s.readCursor(F);
  9016. let K, z, W = !1;
  9017. const ue = [];
  9018. for (let B = 0; ; B++) {
  9019. const ee = v[B], ie = V.getComponent();
  9020. if (ie && (ie.r !== void 0 ? W = !0 : ie.p != null && (W = !1, K = ie.p, z = B)), B >= v.length) break;
  9021. let pe = 0;
  9022. const Oe = s.advancer(V, void 0, (G, Re) => {
  9023. l(Re) && pe++;
  9024. });
  9025. ue.unshift(Oe);
  9026. const Me = Oe(ee);
  9027. if (typeof ee == "number" && (v[B] -= pe), !Me) break;
  9028. }
  9029. if (ue.forEach((B) => B.end()), W) return null;
  9030. const oe = () => {
  9031. let B = 0;
  9032. if (K != null) {
  9033. const ee = V.getPath();
  9034. B = ee.length, v = ee.concat(v.slice(z));
  9035. }
  9036. for (; B < v.length; B++) {
  9037. const ee = v[B], ie = a(V), pe = de(ie);
  9038. if (pe) {
  9039. const G = T(ie);
  9040. pe.transformPosition && (v[B] = pe.transformPosition(v[B], G));
  9041. break;
  9042. }
  9043. let Oe = 0;
  9044. const Me = s.advancer(V, (G, Re) => h(Re) ? ~(G - Oe) : G - Oe, (G, Re) => {
  9045. h(Re) && Oe++;
  9046. })(ee);
  9047. if (typeof ee == "number" && (v[B] += Oe), !Me) break;
  9048. }
  9049. };
  9050. return K != null ? V.eachDrop(null, (B) => {
  9051. B === K && oe();
  9052. }) : oe(), v;
  9053. }
  9054. function y(v, F) {
  9055. if (fe(v), fe(F), v == null) return F;
  9056. if (F == null) return v;
  9057. let V = 0;
  9058. const K = s.readCursor(v), z = s.readCursor(F), W = s.writeCursor(), ue = [], oe = [], B = [], ee = [], ie = [], pe = [], Oe = /* @__PURE__ */ new Set();
  9059. K.traverse(null, (G) => {
  9060. G.p != null && (B[G.p] = K.clone());
  9061. }), z.traverse(null, (G) => {
  9062. G.d != null && (ee[G.d] = z.clone());
  9063. });
  9064. const Me = s.writeCursor();
  9065. return function G(Re, He, Be, xe, Je, Rt, We, et) {
  9066. o(He || Be);
  9067. const ze = a(He), ct = a(Be), it = !!ct && ct.r !== void 0, xt = !!ze && ze.i !== void 0, ke = ze ? ze.d : null, ht = ct ? ct.p : null, _ = (Rt || it) && ht == null;
  9068. if (ht != null) xe = ee[ht], We = oe[ht] = new s.WriteCursor();
  9069. else if (ct && ct.r !== void 0) xe = null;
  9070. else {
  9071. const D = a(xe);
  9072. D && D.d != null && (xe = null);
  9073. }
  9074. const g = a(xe);
  9075. if (ke != null) if (Re = B[ke], et = ue[ke] = new s.WriteCursor(), _) Rt && !it && et.write("r", !0);
  9076. else {
  9077. const D = ie[ke] = V++;
  9078. We.write("d", D);
  9079. }
  9080. else if (ze && ze.i !== void 0) Re = null;
  9081. else {
  9082. const D = a(Re);
  9083. D && D.p != null && (Re = null);
  9084. }
  9085. let p;
  9086. xt ? (o(Je === void 0), p = ze.i) : p = Je;
  9087. const S = (ht == null ? !xt || Rt || it : p === void 0) ? null : We.getComponent();
  9088. if (ht != null) {
  9089. if (!(Je !== void 0 || xt)) {
  9090. const D = ke != null ? ie[ke] : V++;
  9091. pe[ht] = D, et.write("p", D);
  9092. }
  9093. } else it && (xt || Je !== void 0 || (ct.r, et.write("r", ct.r)));
  9094. const N = _ ? null : de(ze), L = de(g);
  9095. if ((N || L) && (N && N.name, L && L.name), N && L) {
  9096. o(N === L);
  9097. const D = T(ze), q = T(g), Ce = N.compose(D, q);
  9098. A(We, N, Ce), Oe.add(g);
  9099. } else N ? A(We, N, T(ze)) : L && (A(We, L, T(g)), Oe.add(g));
  9100. const x = typeof p == "object" && p != null;
  9101. let P = !1, I = 0, Q = 0, _e = 0, J = 0, me = 0;
  9102. const ye = s.advancer(xe, (D, q) => h(q) ? J - D - 1 : D - J, (D, q) => {
  9103. h(q) && J++;
  9104. }), le = s.advancer(Re, (D, q) => l(q) ? I - D - 1 : D - I, (D, q) => {
  9105. l(q) && I++;
  9106. });
  9107. if (s.eachChildOf(He, Be, (D, q, Ce) => {
  9108. let Se, Le, Ue = D, je = D, dt = D;
  9109. if (typeof D == "number") {
  9110. let Ne = D + _e;
  9111. Le = ye(Ne), je = Ne + J;
  9112. let te = D + Q;
  9113. Se = le(te), h(a(Le)) && (Se = null), Ue = te + I, dt = D + me, o(Ue >= 0, "p1PickKey is negative"), o(je >= 0, "p2DropKey is negative");
  9114. const ut = h(a(q)), $e = l(a(Ce));
  9115. (ut || $e && !_) && me--, ut && Q--, $e && _e--;
  9116. } else Se = le(D), Le = ye(D);
  9117. et.descend(Ue), We.descend(je);
  9118. const pt = x && !h(a(q)) ? p[dt] : void 0, Ee = G(Se, q, Ce, Le, pt, _, We, et);
  9119. var qe, ve, Ie;
  9120. x && !_ ? pt !== Ee && (P || (p = Array.isArray(p) ? p.slice() : Object.assign({}, p), P = !0), qe = p, Ie = Ee, typeof (ve = dt) == "number" ? (o(Array.isArray(qe)), o(ve < qe.length)) : (o(!Array.isArray(qe)), o(qe[ve] !== void 0)), Ie === void 0 ? typeof ve == "number" ? qe.splice(ve, 1) : delete qe[ve] : qe[ve] = Ie) : o(Ee === void 0), We.ascend(), et.ascend();
  9121. }), le.end(), ye.end(), S != null) S.i = p;
  9122. else if (!Rt && !it && ht == null) return p;
  9123. }(K, K.clone(), z, z.clone(), void 0, !1, W, Me), W.reset(), W.mergeTree(Me.get()), W.reset(), W.get(), ue.map((G) => G.get()), oe.map((G) => G.get()), K.traverse(W, (G, Re) => {
  9124. const He = G.p;
  9125. if (He != null) {
  9126. const Be = ie[He];
  9127. Be != null && Re.write("p", Be);
  9128. const xe = ue[He];
  9129. xe && xe.get(), xe && Re.mergeTree(xe.get());
  9130. } else G.r !== void 0 && Re.write("r", G.r);
  9131. }), W.reset(), W.get(), z.traverse(W, (G, Re) => {
  9132. const He = G.d;
  9133. if (He != null) {
  9134. const xe = pe[He];
  9135. xe != null && Re.write("d", xe);
  9136. const Je = oe[He];
  9137. Je && Re.mergeTree(Je.get());
  9138. } else G.i !== void 0 && Re.write("i", G.i);
  9139. const Be = de(G);
  9140. Be && !Oe.has(G) && A(Re, Be, T(G));
  9141. }), W.get();
  9142. }
  9143. function M(v) {
  9144. if (v == null) return null;
  9145. const F = new s.ReadCursor(v), V = new s.WriteCursor();
  9146. let K;
  9147. const z = [], W = [];
  9148. return function ue(oe, B, ee) {
  9149. const ie = oe.getComponent();
  9150. let pe, Oe = !1;
  9151. if (ie) {
  9152. ie.p != null && (B.write("d", ie.p), z[ie.p] = oe.clone()), ie.r !== void 0 && B.write("i", ie.r), ie.d != null && (B.write("p", ie.d), ee = void 0), ie.i !== void 0 && (ee = pe = ie.i);
  9153. const G = de(ie);
  9154. G && (ee === void 0 ? (K || (K = /* @__PURE__ */ new Set()), K.add(ie)) : (T(ie), ee = G.apply(ee, T(ie)), Oe = !0));
  9155. }
  9156. let Me = 0;
  9157. for (const G of oe) {
  9158. B.descend(G);
  9159. const Re = typeof G == "number" ? G - Me : G, He = R(ee, Re);
  9160. h(oe.getComponent()) && Me++;
  9161. const Be = ue(oe, B, He);
  9162. if (ee !== void 0 && Be !== void 0) {
  9163. if (Oe || (Oe = !0, ee = c(ee)), !E(ee, Re)) throw Error("Cannot modify child - invalid operation");
  9164. ee[Re] = Be;
  9165. }
  9166. B.ascend();
  9167. }
  9168. if (pe === void 0) return Oe ? ee : void 0;
  9169. B.write("r", ee);
  9170. }(F, V, void 0), K && (V.reset(), function ue(oe, B, ee) {
  9171. const ie = B.getComponent();
  9172. if (ie) {
  9173. const G = ie.d;
  9174. if (G != null && (oe = z[G], ee = W[G] = s.writeCursor()), K.has(ie)) {
  9175. const Re = de(ie);
  9176. if (!Re.invert) throw Error(`Cannot invert subtype ${Re.name}`);
  9177. A(ee, Re, Re.invert(T(ie)));
  9178. }
  9179. }
  9180. let pe = 0, Oe = 0;
  9181. const Me = s.advancer(oe, (G, Re) => l(Re) ? pe - G - 1 : G - pe, (G, Re) => {
  9182. l(Re) && pe++;
  9183. });
  9184. for (const G of B) if (typeof G == "number") {
  9185. const Re = G - Oe, He = Me(Re), Be = Re + pe;
  9186. ee.descend(Be), ue(He, B, ee), h(B.getComponent()) && Oe++, ee.ascend();
  9187. } else ee.descend(G), ue(Me(G), B, ee), ee.ascend();
  9188. Me.end();
  9189. }(F.clone(), F, V), W.length && (V.reset(), F.traverse(V, (ue, oe) => {
  9190. const B = ue.p;
  9191. if (B != null) {
  9192. const ee = W[B];
  9193. ee && ee.get(), ee && oe.mergeTree(ee.get());
  9194. }
  9195. }))), V.get();
  9196. }
  9197. const b = (v, F) => v.some((V) => typeof V == "object" && (Array.isArray(V) ? b(V, F) : F(V)));
  9198. function w(v, F) {
  9199. if (v == null || !b(v, (B) => {
  9200. var ee;
  9201. return B.r !== void 0 || ((ee = de(B)) === null || ee === void 0 ? void 0 : ee.makeInvertible) != null;
  9202. })) return v;
  9203. const V = new s.ReadCursor(v), K = new s.WriteCursor();
  9204. let z = !1;
  9205. const W = [], ue = [], oe = (B, ee, ie) => {
  9206. const pe = B.getComponent();
  9207. let Oe = !1;
  9208. if (pe) {
  9209. pe.d != null && ee.write("d", pe.d), pe.i !== void 0 && ee.write("i", pe.i);
  9210. const G = pe.p;
  9211. if (G != null && (W[G] = B.clone(), o(ie !== void 0, "Operation picks up at an invalid key"), ue[G] = ie, ee.write("p", pe.p)), pe.r !== void 0 && ie === void 0) throw Error("Invalid doc / op in makeInvertible: removed item missing from doc");
  9212. const Re = de(pe);
  9213. Re && (Re.makeInvertible ? z = !0 : A(ee, Re, T(pe), !0));
  9214. }
  9215. let Me = 0;
  9216. for (const G of B) {
  9217. ee.descend(G);
  9218. const Re = typeof G == "number" ? G - Me : G, He = R(ie, Re), Be = oe(B, ee, He);
  9219. He !== Be && (Oe || (Oe = !0, ie = c(ie)), Be === void 0 ? (ie = d(ie, Re), typeof G == "number" && Me++) : ie[Re] = Be), ee.ascend();
  9220. }
  9221. return pe && (pe.r !== void 0 ? (ee.write("r", r.default(ie)), ie = void 0) : pe.p != null && (ie = void 0)), ie;
  9222. };
  9223. return oe(V, K, F), K.get(), z && (K.reset(), function B(ee, ie, pe, Oe, Me) {
  9224. const G = ie.getComponent();
  9225. if (G) {
  9226. G.i !== void 0 ? (Oe = G.i, Me = !0) : G.d != null && (Oe = ue[G.d], ee = W[G.d], Me = !1, G.d);
  9227. let xe = de(G);
  9228. if (xe && xe.makeInvertible) {
  9229. const Je = T(G);
  9230. A(pe, xe, xe.makeInvertible(Je, Oe), !0);
  9231. }
  9232. }
  9233. let Re = 0, He = 0;
  9234. const Be = s.advancer(ee, (xe, Je) => l(Je) ? Re - xe - 1 : xe - Re, (xe, Je) => {
  9235. l(Je) && Re++;
  9236. });
  9237. for (const xe of ie) if (typeof xe == "number") {
  9238. const Je = xe - He, Rt = Be(Je), We = Je + Re, et = R(Oe, Me ? Je : We);
  9239. pe.descend(xe), B(Rt, ie, pe, et, Me), h(ie.getComponent()) && He++, pe.ascend();
  9240. } else {
  9241. const Je = R(Oe, xe);
  9242. pe.descend(xe), B(Be(xe), ie, pe, Je, Me), pe.ascend();
  9243. }
  9244. Be.end();
  9245. }(V.clone(), V, K, F, !1)), K.get();
  9246. }
  9247. function k(v, F) {
  9248. return M(w(v, F));
  9249. }
  9250. const $ = (v) => {
  9251. if (v == null) return null;
  9252. const F = v.slice();
  9253. for (let V = 0; V < v.length; V++) {
  9254. const K = F[V];
  9255. Array.isArray(K) && (F[V] = $(K));
  9256. }
  9257. return F;
  9258. };
  9259. function Y(v, F, V) {
  9260. o(V === "left" || V === "right", "Direction must be left or right");
  9261. const K = V === "left" ? 0 : 1;
  9262. if (F == null) return {
  9263. ok: !0,
  9264. result: v
  9265. };
  9266. fe(v), fe(F);
  9267. let z = null;
  9268. const W = [], ue = [], oe = [], B = [], ee = [], ie = [], pe = [], Oe = [], Me = [], G = [], Re = [], He = [], Be = [], xe = [], Je = [];
  9269. let Rt = 0;
  9270. const We = s.readCursor(v), et = s.readCursor(F), ze = s.writeCursor();
  9271. if (function g(p, S = null, N) {
  9272. const L = a(S);
  9273. L && (L.r !== void 0 ? N = S.clone() : L.p != null && (N = null, ie[L.p] = p.clone()));
  9274. const x = p.getComponent();
  9275. let P;
  9276. x && (P = x.p) != null && (ee[P] = S ? S.clone() : null, oe[P] = p.clone(), N && (G[P] = !0, Me[P] = N), L && L.p != null && (xe[P] = L.p));
  9277. const I = s.advancer(S);
  9278. for (const Q of p) g(p, I(Q), N);
  9279. I.end();
  9280. }(et, We, null), function g(p, S, N, L, x) {
  9281. const P = N.getComponent();
  9282. let I, Q = !1;
  9283. P && ((I = P.d) != null ? (B[I] = N.clone(), L != null && (Je[L] == null && (Je[L] = []), Je[L].push(I)), G[I], p = ee[I] || null, S = oe[I] || null, G[I] ? (x && (Re[I] = !0), x = Me[I] || null) : !x || K !== 1 && xe[I] != null || z == null && (z = {
  9284. type: i.ConflictType.RM_UNEXPECTED_CONTENT,
  9285. op1: t.removeOp(x.getPath()),
  9286. op2: t.moveOp(S.getPath(), N.getPath())
  9287. }), Q = !0) : P.i !== void 0 && (p = S = null, Q = !0, x && z == null && (z = {
  9288. type: i.ConflictType.RM_UNEXPECTED_CONTENT,
  9289. op1: t.removeOp(x.getPath()),
  9290. op2: t.insertOp(N.getPath(), P.i)
  9291. })));
  9292. const _e = a(p);
  9293. _e && (_e.r !== void 0 ? x = p.clone() : _e.p != null && (_e.p, L = _e.p, x = null));
  9294. const J = de(P);
  9295. J && x && z == null && (z = {
  9296. type: i.ConflictType.RM_UNEXPECTED_CONTENT,
  9297. op1: t.removeOp(x.getPath()),
  9298. op2: t.editOp(N.getPath(), J, T(P), !0)
  9299. });
  9300. let me = 0, ye = 0;
  9301. const le = s.advancer(S, (q, Ce) => l(Ce) ? me - q - 1 : q - me, (q, Ce) => {
  9302. l(Ce) && me++;
  9303. }), D = s.advancer(p);
  9304. for (const q of N) if (typeof q == "number") {
  9305. const Ce = q - ye, Se = le(Ce);
  9306. ye += +g(D(Ce + me), Se, N, L, x);
  9307. } else {
  9308. const Ce = le(q);
  9309. g(D(q), Ce, N, L, x);
  9310. }
  9311. return le.end(), D.end(), Q;
  9312. }(We, et, et.clone(), null, null), B.map((g) => g && g.get()), z) return {
  9313. ok: !1,
  9314. conflict: z
  9315. };
  9316. Re.map((g) => !!g);
  9317. const ct = [];
  9318. let it = null;
  9319. (function g(p, S, N, L, x) {
  9320. let P = !1;
  9321. const I = a(S);
  9322. if (l(I)) {
  9323. const le = I.p;
  9324. le != null ? (N = B[le], L = He[le] = s.writeCursor(), P = !0, x = null) : (N = null, x = S.clone());
  9325. } else h(a(N)) && (N = null);
  9326. const Q = p.getComponent();
  9327. if (Q) {
  9328. const le = Q.p;
  9329. le != null ? (x && (Oe[le] = x), ct[le] = x || K === 1 && P ? null : L.getComponent(), W[le] = p.clone(), N && (pe[le] = N.clone())) : Q.r !== void 0 && (x || L.write("r", !0), (x || P) && (it == null && (it = /* @__PURE__ */ new Set()), it.add(Q)));
  9330. }
  9331. let _e = 0, J = 0;
  9332. const me = s.advancer(S, void 0, (le, D) => {
  9333. l(D) && _e++;
  9334. }), ye = s.advancer(N, (le, D) => h(D) ? ~(le - J) : le - J, (le, D) => {
  9335. h(D) && J++;
  9336. });
  9337. if (p) for (const le of p) if (typeof le == "string") {
  9338. const D = me(le), q = ye(le);
  9339. L.descend(le), g(p, D, q, L, x), L.ascend();
  9340. } else {
  9341. const D = me(le), q = le - _e, Ce = l(a(D)) ? null : ye(q), Se = q + J;
  9342. o(Se >= 0), L.descend(Se), g(p, D, Ce, L, x), L.ascend();
  9343. }
  9344. me.end(), ye.end();
  9345. })(We, et, et.clone(), ze, null), ze.reset();
  9346. let xt = [];
  9347. if (function g(p, S, N, L, x, P) {
  9348. o(S);
  9349. const I = S.getComponent();
  9350. let Q = a(L), _e = !1;
  9351. const J = (ve, Ie, Ne) => ve ? t.moveOp(ve.getPath(), Ie.getPath()) : t.insertOp(Ie.getPath(), Ne.i);
  9352. if (h(I)) {
  9353. const ve = I.d;
  9354. ve != null && (ue[ve] = S.clone());
  9355. const Ie = ve != null ? ct[ve] : null;
  9356. let Ne = !1;
  9357. if (I.i !== void 0 || ve != null && Ie) {
  9358. let te;
  9359. Q && (Q.i !== void 0 || (te = Q.d) != null && !G[te]) && (Ne = te != null ? ve != null && ve === xe[te] : n.default(Q.i, I.i), Ne || te != null && K !== 1 && xe[te] != null || z == null && (z = {
  9360. type: i.ConflictType.DROP_COLLISION,
  9361. op1: J(ve != null ? W[ve] : null, S, I),
  9362. op2: J(te != null ? oe[te] : null, L, Q)
  9363. })), Ne || (P ? z == null && (z = {
  9364. type: i.ConflictType.RM_UNEXPECTED_CONTENT,
  9365. op1: J(ve != null ? W[ve] : null, S, I),
  9366. op2: t.removeOp(P.getPath())
  9367. }) : (ve != null ? (xt[Rt] = ve, x.write("d", Ie.p = Rt++)) : x.write("i", r.default(I.i)), _e = !0));
  9368. } else if (ve != null && !Ie) {
  9369. const te = Oe[ve];
  9370. te && (P = te.clone());
  9371. }
  9372. ve != null ? (p = W[ve], N = ie[ve], L = pe[ve]) : I.i !== void 0 && (p = N = null, Ne || (L = null));
  9373. } else l(a(p)) && (p = N = L = null);
  9374. const me = a(p), ye = a(N);
  9375. if (l(ye)) {
  9376. const ve = ye.p;
  9377. ye.r !== void 0 && (!me || me.r === void 0) || G[ve] ? (L = null, P = N.clone()) : ve != null && (L = B[ve], K !== 1 && xe[ve] != null || ((x = Be[ve]) || (x = Be[ve] = s.writeCursor()), x.reset(), P = null));
  9378. } else !h(I) && h(Q) && (L = null);
  9379. Q = L != null ? L.getComponent() : null;
  9380. const le = de(I);
  9381. if (le) {
  9382. const ve = T(I);
  9383. if (P) z == null && (z = {
  9384. type: i.ConflictType.RM_UNEXPECTED_CONTENT,
  9385. op1: t.editOp(S.getPath(), le, ve, !0),
  9386. op2: t.removeOp(P.getPath())
  9387. });
  9388. else {
  9389. const Ie = de(Q);
  9390. let Ne;
  9391. if (Ie) {
  9392. if (le !== Ie) throw Error("Transforming incompatible types");
  9393. const te = T(Q);
  9394. Ne = le.transform(ve, te, V);
  9395. } else Ne = r.default(ve);
  9396. A(x, le, Ne);
  9397. }
  9398. }
  9399. let D = 0, q = 0, Ce = 0, Se = 0, Le = 0, Ue = 0, je = p != null && p.descendFirst(), dt = je;
  9400. const pt = s.advancer(N, void 0, (ve, Ie) => {
  9401. l(Ie) && Ce++;
  9402. });
  9403. let Ee = L != null && L.descendFirst(), qe = Ee;
  9404. for (const ve of S) if (typeof ve == "number") {
  9405. let Ie;
  9406. const Ne = h(S.getComponent()), te = ve - q;
  9407. {
  9408. let zt;
  9409. for (; je && typeof (zt = p.getKey()) == "number"; ) {
  9410. zt += D;
  9411. const bt = p.getComponent(), Cn = l(bt);
  9412. if (zt > te || zt === te && (!Cn || K === 0 && Ne)) break;
  9413. if (Cn) {
  9414. D--;
  9415. const sn = bt.p;
  9416. xe.includes(sn), bt.d, a(Be[bt.d]), l(a(Be[bt.d])), (bt.r === void 0 || it && it.has(bt)) && (sn == null || !ct[sn] || K !== 1 && xe.includes(sn)) || Le--;
  9417. }
  9418. je = p.nextSibling();
  9419. }
  9420. Ie = je && zt === te ? p : null;
  9421. }
  9422. const ut = te - D;
  9423. let $e = pt(ut);
  9424. const At = ut - Ce;
  9425. let dr = null;
  9426. {
  9427. let zt, bt;
  9428. for (; Ee && typeof (zt = L.getKey()) == "number"; ) {
  9429. bt = zt - Se;
  9430. const Cn = L.getComponent(), sn = h(Cn);
  9431. if (bt > At) break;
  9432. if (bt === At) {
  9433. if (!sn) {
  9434. dr = L;
  9435. break;
  9436. }
  9437. {
  9438. if (K === 0 && Ne) {
  9439. dr = L;
  9440. break;
  9441. }
  9442. const Yt = $e && l($e.getComponent());
  9443. if (K === 0 && Yt) break;
  9444. }
  9445. }
  9446. if (sn) {
  9447. const Yt = Cn.d;
  9448. G[Yt], xe[Yt], Cn.i === void 0 && (G[Yt] || xe[Yt] != null && K !== 1) ? (G[Yt] || xe[Yt] != null && K === 0) && (Se++, Ue--) : Se++;
  9449. }
  9450. Ee = L.nextSibling();
  9451. }
  9452. }
  9453. const Hi = At + Se + Le + Ue;
  9454. o(Hi >= 0, "trying to descend to a negative index"), x.descend(Hi), Ne && (Ie = $e = dr = null, q++), g(Ie, S, $e, dr, x, P) && Ue++, x.ascend();
  9455. } else {
  9456. let Ie;
  9457. for (; je && (Ie = p.getKey(), typeof Ie != "string" || !(Ie > ve || Ie === ve)); ) je = p.nextSibling();
  9458. const Ne = je && Ie === ve ? p : null, te = pt(ve);
  9459. let ut;
  9460. for (; Ee && (ut = L.getKey(), typeof ut != "string" || !(ut > ve || ut === ve)); ) Ee = L.nextSibling();
  9461. const $e = Ee && ut === ve ? L : null;
  9462. x.descend(ve), g(Ne, S, te, $e, x, P), x.ascend();
  9463. }
  9464. return pt.end(), dt && p.ascend(), qe && L.ascend(), _e;
  9465. }(We, We.clone(), et, et.clone(), ze, null), z) return {
  9466. ok: !1,
  9467. conflict: z
  9468. };
  9469. ze.reset();
  9470. const ke = (g, p, S) => g.traverse(p, (N, L) => {
  9471. N.d != null && S(N.d, g, L);
  9472. });
  9473. (G.length || He.length) && (ke(et, ze, (g, p, S) => {
  9474. G[g] && !Re[g] && S.write("r", !0), He[g] && S.mergeTree(He[g].get());
  9475. }), ze.reset());
  9476. const ht = [], _ = [];
  9477. if ((Be.length || G.length) && !z) {
  9478. const g = s.readCursor($(ze.get()));
  9479. if (ke(g, null, (p, S) => {
  9480. ht[p] = S.clone();
  9481. }), Be.forEach((p) => {
  9482. p && ke(s.readCursor(p.get()), null, (S, N) => {
  9483. ht[S] = N.clone();
  9484. });
  9485. }), function p(S, N, L, x, P, I) {
  9486. const Q = a(N);
  9487. if (Q && l(Q)) if (Q.p != null) {
  9488. const D = Q.p;
  9489. ht[D].getPath(), L = ht[D], x = _[D] = s.writeCursor();
  9490. } else Q.r !== void 0 && (L = null);
  9491. else h(a(L)) && (L = null);
  9492. const _e = S.getComponent();
  9493. if (_e) {
  9494. let D;
  9495. if ((D = _e.d) != null) {
  9496. const q = Be[D];
  9497. q && (q.get(), x.mergeTree(q.get()), L = s.readCursor(q.get()));
  9498. }
  9499. }
  9500. let J = 0, me = 0;
  9501. const ye = s.advancer(N, void 0, (D, q) => {
  9502. l(q) && J--;
  9503. }), le = s.advancer(L, (D, q) => h(q) ? -(D - me) - 1 : D - me, (D, q) => {
  9504. h(q) && me++;
  9505. });
  9506. for (const D of S) if (typeof D == "number") {
  9507. const q = ye(D), Ce = D + J, Se = le(Ce), Le = Ce + me;
  9508. x.descend(Le), p(S, q, Se, x), x.ascend();
  9509. } else x.descend(D), p(S, ye(D), le(D), x), x.ascend();
  9510. ye.end(), le.end();
  9511. }(et, g, g.clone(), ze), ze.reset(), z) return {
  9512. ok: !1,
  9513. conflict: z
  9514. };
  9515. if (ze.get(), _.length) {
  9516. const p = _.map((N) => N ? N.get() : null), S = s.readCursor($(ze.get()));
  9517. if (ke(S, ze, (N, L, x) => {
  9518. const P = p[N];
  9519. P && (x.mergeTree(P), p[N] = null);
  9520. }), p.find((N) => N)) {
  9521. const N = s.writeCursor(), L = s.writeCursor();
  9522. let x = 0, P = 0;
  9523. p.forEach((I) => {
  9524. I != null && ke(s.readCursor(I), null, (Q) => {
  9525. const _e = xt[Q];
  9526. N.writeMove(W[_e].getPath(), ue[_e].getPath(), x++);
  9527. const J = Je[_e];
  9528. J && J.forEach((me) => {
  9529. G[me] || K !== 1 && xe[me] != null || L.writeMove(oe[me].getPath(), B[me].getPath(), P++);
  9530. });
  9531. });
  9532. }), z = {
  9533. type: i.ConflictType.BLACKHOLE,
  9534. op1: N.get(),
  9535. op2: L.get()
  9536. };
  9537. }
  9538. }
  9539. }
  9540. return z ? {
  9541. ok: !1,
  9542. conflict: z
  9543. } : {
  9544. ok: !0,
  9545. result: ze.get()
  9546. };
  9547. }
  9548. const se = (v) => {
  9549. const F = new Error("Transform detected write conflict");
  9550. throw F.conflict = v, F.type = F.name = "writeConflict", F;
  9551. };
  9552. function he(v, F, V) {
  9553. const K = Y(v, F, V);
  9554. if (K.ok) return K.result;
  9555. se(K.conflict);
  9556. }
  9557. const ge = (v) => {
  9558. const F = s.writeCursor();
  9559. return s.readCursor(v).traverse(F, (V, K) => {
  9560. (h(V) || de(V)) && K.write("r", !0);
  9561. }), F.get();
  9562. }, Ae = (v, F) => {
  9563. const { type: V, op1: K, op2: z } = v;
  9564. switch (V) {
  9565. case i.ConflictType.DROP_COLLISION:
  9566. return F === "left" ? [null, ge(z)] : [ge(K), null];
  9567. case i.ConflictType.RM_UNEXPECTED_CONTENT:
  9568. let W = !1;
  9569. return s.readCursor(K).traverse(null, (ue) => {
  9570. ue.r !== void 0 && (W = !0);
  9571. }), W ? [null, ge(z)] : [ge(K), null];
  9572. case i.ConflictType.BLACKHOLE:
  9573. return [ge(K), ge(z)];
  9574. default:
  9575. throw Error("Unrecognised conflict: " + V);
  9576. }
  9577. };
  9578. function be(v, F, V, K) {
  9579. let z = null;
  9580. for (; ; ) {
  9581. const W = Y(F, V, K);
  9582. if (W.ok) return y(z, W.result);
  9583. {
  9584. const { conflict: ue } = W;
  9585. v(ue) || se(ue);
  9586. const [oe, B] = Ae(ue, K);
  9587. F = y(ae(F), oe), V = y(ae(V), B), z = y(z, B);
  9588. }
  9589. }
  9590. }
  9591. }(Ir)), Ir;
  9592. }
  9593. var ua;
  9594. function ym() {
  9595. return ua || (ua = 1, function(t) {
  9596. var e = $n.__createBinding || (Object.create ? function(i, o, a, u) {
  9597. u === void 0 && (u = a), Object.defineProperty(i, u, { enumerable: !0, get: function() {
  9598. return o[a];
  9599. } });
  9600. } : function(i, o, a, u) {
  9601. u === void 0 && (u = a), i[u] = o[a];
  9602. }), n = $n.__exportStar || function(i, o) {
  9603. for (var a in i) a !== "default" && !o.hasOwnProperty(a) && e(o, i, a);
  9604. };
  9605. Object.defineProperty(t, "__esModule", { value: !0 }), n(vm(), t);
  9606. var r = $u();
  9607. Object.defineProperty(t, "ReadCursor", { enumerable: !0, get: function() {
  9608. return r.ReadCursor;
  9609. } }), Object.defineProperty(t, "WriteCursor", { enumerable: !0, get: function() {
  9610. return r.WriteCursor;
  9611. } });
  9612. var s = Bu();
  9613. Object.defineProperty(t, "ConflictType", { enumerable: !0, get: function() {
  9614. return s.ConflictType;
  9615. } });
  9616. }($n)), $n;
  9617. }
  9618. var mt = ym();
  9619. const wm = /* @__PURE__ */ wt(mt), JC = /* @__PURE__ */ jl({
  9620. __proto__: null,
  9621. default: wm
  9622. }, [mt]);
  9623. var ce = /* @__PURE__ */ ((t) => (t.RETAIN = "r", t.INSERT = "i", t.DELETE = "d", t))(ce || {});
  9624. function _s(t, e = !1) {
  9625. const n = [];
  9626. for (const r of t) {
  9627. const { st: s, ed: i, ts: o } = r;
  9628. if (r.sId === void 0 && delete r.sId, s === i || !e && re.isEmptyObject(o) && r.sId == null)
  9629. continue;
  9630. if (n.length === 0) {
  9631. n.push(r);
  9632. continue;
  9633. }
  9634. const a = n.pop();
  9635. Mg(r, a) && re.hasIntersectionBetweenTwoRanges(a.st, a.ed, r.st, r.ed) ? n.push({
  9636. ...r,
  9637. st: a.st,
  9638. ed: i
  9639. }) : n.push(a, r);
  9640. }
  9641. return n;
  9642. }
  9643. function ju(t, e, n, r) {
  9644. var c;
  9645. const { textRuns: s } = t;
  9646. if (s == null)
  9647. return;
  9648. const i = [], o = s.length;
  9649. let a = !1;
  9650. const u = (c = e.textRuns) != null ? c : [];
  9651. if (u.length)
  9652. for (const l of u)
  9653. l.st += r, l.ed += r;
  9654. for (let l = 0; l < o; l++) {
  9655. const h = s[l], { st: d, ed: f } = h;
  9656. if (f <= r)
  9657. i.push(h);
  9658. else if (r > d && r < f) {
  9659. a = !0;
  9660. const E = {
  9661. ...h,
  9662. ed: r
  9663. };
  9664. i.push(E), u.length && i.push(...u);
  9665. const R = {
  9666. ...h,
  9667. st: r + n,
  9668. ed: f + n
  9669. };
  9670. i.push(R);
  9671. } else
  9672. h.st += n, h.ed += n, a || (a = !0, i.push(...u)), i.push(h);
  9673. }
  9674. a || (a = !0, i.push(...u)), t.textRuns = _s(i);
  9675. }
  9676. function Hu(t, e, n, r) {
  9677. const { paragraphs: s } = t;
  9678. if (s == null)
  9679. return;
  9680. const { paragraphs: i } = e, o = [];
  9681. for (let u = 0, c = s.length; u < c; u++) {
  9682. const l = s[u], { startIndex: h } = l;
  9683. h >= r && (l.startIndex += n), o.push(l.startIndex);
  9684. }
  9685. let a = -1;
  9686. if (i) {
  9687. for (let u = 0, c = i.length; u < c; u++) {
  9688. const l = i[u];
  9689. l.startIndex += r;
  9690. const h = l.startIndex;
  9691. a = o.indexOf(h);
  9692. }
  9693. a !== -1 && s.splice(a, 1), s.push(...i), s.sort(ps("startIndex"));
  9694. }
  9695. }
  9696. function Wu(t, e, n, r) {
  9697. const { sectionBreaks: s } = t;
  9698. if (s == null)
  9699. return;
  9700. for (let o = 0, a = s.length; o < a; o++) {
  9701. const u = s[o], { startIndex: c } = u;
  9702. c >= r && (u.startIndex += n);
  9703. }
  9704. const i = e.sectionBreaks;
  9705. if (i) {
  9706. for (let o = 0, a = i.length; o < a; o++) {
  9707. const u = i[o];
  9708. u.startIndex += r;
  9709. }
  9710. s.push(...i), s.sort(ps("startIndex"));
  9711. }
  9712. }
  9713. function zu(t, e, n, r) {
  9714. const { customBlocks: s = [] } = t;
  9715. for (let o = 0, a = s.length; o < a; o++) {
  9716. const u = s[o], { startIndex: c } = u;
  9717. c >= r && (u.startIndex += n);
  9718. }
  9719. const i = e.customBlocks;
  9720. if (i) {
  9721. for (let o = 0, a = i.length; o < a; o++) {
  9722. const u = i[o];
  9723. u.startIndex += r;
  9724. }
  9725. s.push(...i), s.sort(ps("startIndex"));
  9726. }
  9727. s.length && !t.customBlocks && (t.customBlocks = s);
  9728. }
  9729. function Yu(t, e, n, r) {
  9730. const { tables: s } = t;
  9731. if (s == null)
  9732. return;
  9733. for (let o = 0, a = s.length; o < a; o++) {
  9734. const u = s[o], { startIndex: c, endIndex: l } = u;
  9735. c > r ? (u.startIndex += n, u.endIndex += n) : l > r && (u.endIndex += n);
  9736. }
  9737. const i = e.tables;
  9738. if (i) {
  9739. for (let o = 0, a = i.length; o < a; o++) {
  9740. const u = i[o];
  9741. u.startIndex += r, u.endIndex += r;
  9742. }
  9743. s.push(...i), s.sort(ps("startIndex"));
  9744. }
  9745. }
  9746. const Vu = "$", la = (t) => t.split(Vu)[0];
  9747. function ki(t) {
  9748. if (t.length <= 1) return t;
  9749. t.sort((s, i) => s.startIndex - i.startIndex);
  9750. const e = [];
  9751. let n = { ...t[0] };
  9752. n.rangeId = la(n.rangeId);
  9753. for (let s = 1; s < t.length; s++) {
  9754. const i = t[s];
  9755. i.rangeId = la(i.rangeId), i.rangeId === n.rangeId && Df(n.properties, i.properties) && n.endIndex + 1 >= i.startIndex ? n.endIndex = i.endIndex : (e.push(n), n = { ...i });
  9756. }
  9757. e.push(n);
  9758. const r = /* @__PURE__ */ Object.create(null);
  9759. for (let s = 0, i = e.length; s < i; s++) {
  9760. const o = e[s], a = o.rangeId;
  9761. r[a] ? (o.rangeId = `${a}${Vu}${r[a]}`, r[a] = r[a] + 1) : r[a] = 1;
  9762. }
  9763. return e;
  9764. }
  9765. function Qs(t, e) {
  9766. const n = t.findIndex((s) => s.startIndex < e && s.endIndex >= e), r = t[n];
  9767. r && t.splice(
  9768. n,
  9769. 1,
  9770. {
  9771. rangeId: r.rangeId,
  9772. rangeType: r.rangeType,
  9773. startIndex: r.startIndex,
  9774. endIndex: e - 1,
  9775. properties: { ...r.properties }
  9776. },
  9777. {
  9778. rangeId: r.rangeId,
  9779. rangeType: r.rangeType,
  9780. startIndex: e,
  9781. endIndex: r.endIndex,
  9782. properties: { ...r.properties }
  9783. }
  9784. );
  9785. }
  9786. function Gu(t) {
  9787. if (t.length <= 1) return t;
  9788. t.sort((r, s) => r.startIndex - s.startIndex);
  9789. const e = [];
  9790. let n = { ...t[0] };
  9791. for (let r = 1; r < t.length; r++) {
  9792. const s = t[r];
  9793. s.id === n.id && n.endIndex + 1 >= s.startIndex ? n.endIndex = s.endIndex : (e.push(n), n = { ...s });
  9794. }
  9795. return e.push(n), e;
  9796. }
  9797. function qs(t, e) {
  9798. t.filter((r) => r.startIndex < e && r.endIndex >= e).forEach((r) => {
  9799. const s = t.indexOf(r);
  9800. t.splice(
  9801. s,
  9802. 1,
  9803. {
  9804. id: r.id,
  9805. type: r.type,
  9806. startIndex: r.startIndex,
  9807. endIndex: e - 1
  9808. },
  9809. {
  9810. id: r.id,
  9811. type: r.type,
  9812. startIndex: e,
  9813. endIndex: r.endIndex
  9814. }
  9815. );
  9816. });
  9817. }
  9818. function Om(t, e, n, r) {
  9819. t.customRanges || (t.customRanges = []);
  9820. const { customRanges: s } = t;
  9821. Qs(s, r);
  9822. for (let o = 0, a = s.length; o < a; o++) {
  9823. const u = s[o], { startIndex: c } = u;
  9824. c >= r && (u.startIndex += n, u.endIndex += n);
  9825. }
  9826. const i = [];
  9827. if (e.customRanges) {
  9828. for (let o = 0, a = e.customRanges.length; o < a; o++) {
  9829. const u = e.customRanges[o];
  9830. u.startIndex += r, u.endIndex += r, i.push(u);
  9831. }
  9832. s.push(...i);
  9833. }
  9834. t.customRanges = ki(s);
  9835. }
  9836. function bm(t, e, n, r) {
  9837. t.customDecorations || (t.customDecorations = []);
  9838. const { customDecorations: s } = t;
  9839. qs(s, r);
  9840. for (let o = 0, a = s.length; o < a; o++) {
  9841. const u = s[o], { startIndex: c } = u;
  9842. c >= r && (u.startIndex += n, u.endIndex += n);
  9843. }
  9844. const i = [];
  9845. if (e.customDecorations) {
  9846. for (let o = 0, a = e.customDecorations.length; o < a; o++) {
  9847. const u = e.customDecorations[o];
  9848. u.startIndex += r, u.endIndex += r, i.push(u);
  9849. }
  9850. s.push(...i);
  9851. }
  9852. t.customDecorations = Gu(s);
  9853. }
  9854. function Ku(t, e, n) {
  9855. const { textRuns: r } = t, s = n, i = n + e, o = [];
  9856. if (r) {
  9857. const a = [];
  9858. for (let u = 0, c = r.length; u < c; u++) {
  9859. const l = r[u], { st: h, ed: d } = l;
  9860. if (s <= h && i >= d) {
  9861. o.push({
  9862. ...l,
  9863. st: h - s,
  9864. ed: d - s
  9865. });
  9866. continue;
  9867. } else h <= s && d >= i ? (o.push({
  9868. ...l,
  9869. st: s - s,
  9870. ed: i - s
  9871. }), l.ed -= e) : s >= h && s < d ? (o.push({
  9872. ...l,
  9873. st: s - s,
  9874. ed: d - s
  9875. }), l.ed = s) : i > h && i <= d ? (o.push({
  9876. ...l,
  9877. st: h - s,
  9878. ed: i - s
  9879. }), l.st = i - e, l.ed -= e) : h >= i && (l.st -= e, l.ed -= e);
  9880. a.push(l);
  9881. }
  9882. t.textRuns = a;
  9883. }
  9884. return o.length === 0 && o.push({
  9885. st: 0,
  9886. ed: e,
  9887. ts: {}
  9888. }), o;
  9889. }
  9890. function Xu(t, e, n) {
  9891. const { paragraphs: r } = t, s = n, i = n + e, o = [];
  9892. if (r) {
  9893. const a = [];
  9894. for (let u = 0, c = r.length; u < c; u++) {
  9895. const l = r[u], { startIndex: h } = l;
  9896. if (h >= s && h < i) {
  9897. o.push({
  9898. ...l,
  9899. startIndex: h - n
  9900. });
  9901. continue;
  9902. } else h >= i && (l.startIndex -= e);
  9903. a.push(l);
  9904. }
  9905. t.paragraphs = a;
  9906. }
  9907. return o;
  9908. }
  9909. function Ju(t, e, n) {
  9910. const { sectionBreaks: r } = t, s = n, i = n + e - 1, o = [];
  9911. if (r) {
  9912. const a = [];
  9913. for (let u = 0, c = r.length; u < c; u++) {
  9914. const l = r[u], { startIndex: h } = l;
  9915. if (h >= s && h <= i) {
  9916. o.push({
  9917. ...l,
  9918. startIndex: h - n
  9919. });
  9920. continue;
  9921. } else h > i && (l.startIndex -= e);
  9922. a.push(l);
  9923. }
  9924. t.sectionBreaks = a;
  9925. }
  9926. return o;
  9927. }
  9928. function Zu(t, e, n) {
  9929. const { customBlocks: r = [] } = t, s = n, i = n + e - 1, o = [];
  9930. if (r) {
  9931. const a = [];
  9932. for (let u = 0, c = r.length; u < c; u++) {
  9933. const l = r[u], { startIndex: h } = l;
  9934. if (h >= s && h <= i) {
  9935. o.push({
  9936. ...l,
  9937. startIndex: h - n
  9938. });
  9939. continue;
  9940. } else h > i && (l.startIndex -= e);
  9941. a.push(l);
  9942. }
  9943. t.customBlocks = a;
  9944. }
  9945. return r.length && !t.customBlocks && (t.customBlocks = r), o;
  9946. }
  9947. function Qu(t, e, n) {
  9948. const { tables: r } = t, s = n, i = n + e - 1, o = [];
  9949. if (r) {
  9950. const a = [];
  9951. for (let u = 0, c = r.length; u < c; u++) {
  9952. const l = r[u], { startIndex: h, endIndex: d } = l;
  9953. if (s <= h && i >= d) {
  9954. o.push({
  9955. ...l,
  9956. startIndex: h - n,
  9957. endIndex: d - n
  9958. });
  9959. continue;
  9960. } else if (h <= s && d >= i) {
  9961. const f = Li(h, d, s, i);
  9962. if (f.length === 0 || (l.startIndex = f[0], l.endIndex = f[1], l.startIndex === l.endIndex))
  9963. continue;
  9964. } else i < h && (l.startIndex -= e, l.endIndex -= e);
  9965. a.push(l);
  9966. }
  9967. t.tables = a;
  9968. }
  9969. return o;
  9970. }
  9971. function Sm(t, e, n) {
  9972. const { customRanges: r } = t, s = n, i = n + e - 1, o = [];
  9973. if (r) {
  9974. const a = [];
  9975. for (let u = 0, c = r.length; u < c; u++) {
  9976. const l = r[u], { startIndex: h, endIndex: d } = l;
  9977. if (h >= s && d <= i) {
  9978. o.push(l);
  9979. continue;
  9980. } else if (Math.max(s, h) <= Math.min(i, d)) {
  9981. const f = Li(h, d, s, i);
  9982. if (f.length === 0)
  9983. continue;
  9984. l.startIndex = f[0], l.endIndex = f[1];
  9985. } else i < h && (l.startIndex -= e, l.endIndex -= e);
  9986. a.push(l);
  9987. }
  9988. t.customRanges = ki(a);
  9989. }
  9990. return o;
  9991. }
  9992. function Am(t, e, n, r = !0) {
  9993. const { customDecorations: s } = t, i = n, o = n + e - 1, a = [];
  9994. if (s) {
  9995. const u = [];
  9996. for (let c = 0, l = s.length; c < l; c++) {
  9997. const h = s[c], { startIndex: d, endIndex: f } = h;
  9998. if (d >= i && f <= o) {
  9999. a.push(h);
  10000. continue;
  10001. } else if (Math.max(i, d) <= Math.min(o, f)) {
  10002. const E = Li(d, f, i, o);
  10003. if (E.length === 0)
  10004. continue;
  10005. h.startIndex = E[0], h.endIndex = E[1];
  10006. } else o < d && r && (h.startIndex -= e, h.endIndex -= e);
  10007. u.push(h);
  10008. }
  10009. t.customDecorations = u;
  10010. }
  10011. return a;
  10012. }
  10013. var Nm = /* @__PURE__ */ ((t) => (t.ORDER_LIST_QUICK_1 = "1.", t.ORDER_LIST_QUICK_2 = "a)", t.ORDER_LIST_QUICK_3 = "a.", t.ORDER_LIST_QUICK_4 = "i.", t.ORDER_LIST_QUICK_5 = "A.", t.ORDER_LIST_QUICK_6 = "I.", t.ORDER_LIST_QUICK_7 = "01.", t))(Nm || {}), Ft = /* @__PURE__ */ ((t) => (t.BULLET_LIST = "BULLET_LIST", t.BULLET_LIST_1 = "BULLET_LIST_1", t.BULLET_LIST_2 = "BULLET_LIST_2", t.BULLET_LIST_3 = "BULLET_LIST_3", t.BULLET_LIST_4 = "BULLET_LIST_4", t.BULLET_LIST_5 = "BULLET_LIST_5", t.ORDER_LIST = "ORDER_LIST", t.ORDER_LIST_1 = "ORDER_LIST_1", t.ORDER_LIST_2 = "ORDER_LIST_2", t.ORDER_LIST_3 = "ORDER_LIST_3", t.ORDER_LIST_4 = "ORDER_LIST_4", t.ORDER_LIST_5 = "ORDER_LIST_5", t.ORDER_LIST_QUICK_2 = "ORDER_LIST_QUICK_2", t.ORDER_LIST_QUICK_3 = "ORDER_LIST_QUICK_3", t.ORDER_LIST_QUICK_4 = "ORDER_LIST_QUICK_4", t.ORDER_LIST_QUICK_5 = "ORDER_LIST_QUICK_5", t.ORDER_LIST_QUICK_6 = "ORDER_LIST_QUICK_6", t.CHECK_LIST = "CHECK_LIST", t.CHECK_LIST_CHECKED = "CHECK_LIST_CHECKED", t))(Ft || {});
  10014. const Or = {
  10015. "a)": { glyphFormat: "%1)", glyphType: Te.DECIMAL },
  10016. "1.": { glyphFormat: "%1.", glyphType: Te.DECIMAL },
  10017. "a.": { glyphFormat: "%1.", glyphType: Te.LOWER_LETTER },
  10018. "A.": { glyphFormat: "%1.", glyphType: Te.UPPER_LETTER },
  10019. "i.": { glyphFormat: "%1.", glyphType: Te.LOWER_ROMAN },
  10020. "I.": { glyphFormat: "%1.", glyphType: Te.UPPER_LETTER }
  10021. }, Rn = (t) => [
  10022. ...t,
  10023. ...t,
  10024. ...t
  10025. ].map((e, n) => ({
  10026. glyphFormat: ` %${n + 1}`,
  10027. glyphSymbol: e,
  10028. bulletAlignment: ms.START,
  10029. textStyle: {
  10030. fs: 12
  10031. },
  10032. startNumber: 0,
  10033. paragraphProperties: {
  10034. hanging: { v: 21 },
  10035. indentStart: { v: 21 * n }
  10036. }
  10037. })), In = (t) => t.map((e, n) => ({
  10038. ...e,
  10039. bulletAlignment: ms.START,
  10040. textStyle: {
  10041. fs: 12
  10042. },
  10043. startNumber: 0,
  10044. paragraphProperties: {
  10045. hanging: { v: 21 },
  10046. indentStart: { v: 21 * n }
  10047. }
  10048. })), ca = (t, e) => new Array(9).fill(0).map((n, r) => ({
  10049. glyphFormat: ` %${r + 1}`,
  10050. glyphSymbol: t,
  10051. bulletAlignment: ms.START,
  10052. textStyle: {
  10053. fs: 16
  10054. },
  10055. startNumber: 0,
  10056. paragraphProperties: {
  10057. hanging: { v: 21 },
  10058. indentStart: { v: 21 * r },
  10059. textStyle: e
  10060. }
  10061. })), Es = {
  10062. BULLET_LIST: {
  10063. listType: "BULLET_LIST",
  10064. nestingLevel: Rn(["●", "○", "■"])
  10065. },
  10066. BULLET_LIST_1: {
  10067. listType: "BULLET_LIST",
  10068. nestingLevel: Rn(["❖", "➢", "■"])
  10069. },
  10070. BULLET_LIST_2: {
  10071. listType: "BULLET_LIST",
  10072. nestingLevel: Rn(["✔", "●", "◆"])
  10073. },
  10074. BULLET_LIST_3: {
  10075. listType: "BULLET_LIST",
  10076. nestingLevel: Rn(["■", "◆", "○"])
  10077. },
  10078. BULLET_LIST_4: {
  10079. listType: "BULLET_LIST",
  10080. nestingLevel: Rn(["✧", "○", "■"])
  10081. },
  10082. BULLET_LIST_5: {
  10083. listType: "BULLET_LIST",
  10084. nestingLevel: Rn(["➢", "○", "◆"])
  10085. },
  10086. ORDER_LIST: {
  10087. listType: "ORDER_LIST",
  10088. nestingLevel: In([
  10089. { glyphFormat: "%1.", glyphType: Te.DECIMAL },
  10090. { glyphFormat: "%2.", glyphType: Te.LOWER_LETTER },
  10091. { glyphFormat: "%3.", glyphType: Te.LOWER_ROMAN },
  10092. { glyphFormat: "%4.", glyphType: Te.DECIMAL },
  10093. { glyphFormat: "%5.", glyphType: Te.LOWER_LETTER },
  10094. { glyphFormat: "%6.", glyphType: Te.LOWER_ROMAN },
  10095. { glyphFormat: "%7.", glyphType: Te.DECIMAL },
  10096. { glyphFormat: "%8.", glyphType: Te.LOWER_LETTER },
  10097. { glyphFormat: "%9.", glyphType: Te.LOWER_ROMAN }
  10098. ])
  10099. },
  10100. ORDER_LIST_1: {
  10101. listType: "ORDER_LIST",
  10102. nestingLevel: In([
  10103. { glyphFormat: "%1)", glyphType: Te.DECIMAL },
  10104. { glyphFormat: "%2)", glyphType: Te.LOWER_LETTER },
  10105. { glyphFormat: "%3)", glyphType: Te.LOWER_ROMAN },
  10106. { glyphFormat: "%4)", glyphType: Te.DECIMAL },
  10107. { glyphFormat: "%5)", glyphType: Te.LOWER_LETTER },
  10108. { glyphFormat: "%6)", glyphType: Te.LOWER_ROMAN },
  10109. { glyphFormat: "%7)", glyphType: Te.DECIMAL },
  10110. { glyphFormat: "%8)", glyphType: Te.LOWER_LETTER },
  10111. { glyphFormat: "%9)", glyphType: Te.LOWER_ROMAN }
  10112. ])
  10113. },
  10114. ORDER_LIST_2: {
  10115. listType: "ORDER_LIST",
  10116. nestingLevel: In([
  10117. "%1.",
  10118. "%1.%2.",
  10119. "%1.%2.%3.",
  10120. "%1.%2.%3.%4.",
  10121. "%1.%2.%3.%4.%5.",
  10122. "%1.%2.%3.%4.%5.%6.",
  10123. "%1.%2.%3.%4.%5.%6.%7."
  10124. ].map((t) => ({ glyphFormat: t, glyphType: Te.DECIMAL })))
  10125. },
  10126. ORDER_LIST_3: {
  10127. listType: "ORDER_LIST",
  10128. nestingLevel: In([
  10129. { glyphFormat: "%1.", glyphType: Te.UPPER_LETTER },
  10130. { glyphFormat: "%2.", glyphType: Te.LOWER_LETTER },
  10131. { glyphFormat: "%3.", glyphType: Te.LOWER_ROMAN },
  10132. { glyphFormat: "%4.", glyphType: Te.UPPER_LETTER },
  10133. { glyphFormat: "%5.", glyphType: Te.LOWER_LETTER },
  10134. { glyphFormat: "%6.", glyphType: Te.LOWER_ROMAN },
  10135. { glyphFormat: "%7.", glyphType: Te.UPPER_LETTER },
  10136. { glyphFormat: "%8.", glyphType: Te.LOWER_LETTER },
  10137. { glyphFormat: "%9.", glyphType: Te.LOWER_ROMAN }
  10138. ])
  10139. },
  10140. ORDER_LIST_4: {
  10141. listType: "ORDER_LIST",
  10142. nestingLevel: In([
  10143. { glyphFormat: "%1.", glyphType: Te.UPPER_LETTER },
  10144. { glyphFormat: "%2.", glyphType: Te.DECIMAL },
  10145. { glyphFormat: "%3.", glyphType: Te.LOWER_ROMAN },
  10146. { glyphFormat: "%4.", glyphType: Te.UPPER_LETTER },
  10147. { glyphFormat: "%5.", glyphType: Te.DECIMAL },
  10148. { glyphFormat: "%6.", glyphType: Te.LOWER_ROMAN },
  10149. { glyphFormat: "%7.", glyphType: Te.UPPER_LETTER },
  10150. { glyphFormat: "%8.", glyphType: Te.DECIMAL },
  10151. { glyphFormat: "%9.", glyphType: Te.LOWER_ROMAN }
  10152. ])
  10153. },
  10154. ORDER_LIST_5: {
  10155. listType: "ORDER_LIST",
  10156. nestingLevel: In([
  10157. { glyphFormat: "%1.", glyphType: Te.DECIMAL_ZERO },
  10158. { glyphFormat: "%2.", glyphType: Te.LOWER_LETTER },
  10159. { glyphFormat: "%3.", glyphType: Te.LOWER_ROMAN },
  10160. { glyphFormat: "%4.", glyphType: Te.DECIMAL_ZERO },
  10161. { glyphFormat: "%5.", glyphType: Te.LOWER_LETTER },
  10162. { glyphFormat: "%6.", glyphType: Te.LOWER_ROMAN },
  10163. { glyphFormat: "%7.", glyphType: Te.DECIMAL_ZERO },
  10164. { glyphFormat: "%8.", glyphType: Te.LOWER_LETTER },
  10165. { glyphFormat: "%9.", glyphType: Te.LOWER_ROMAN }
  10166. ])
  10167. },
  10168. CHECK_LIST: {
  10169. listType: "CHECK_LIST",
  10170. nestingLevel: ca("☐")
  10171. },
  10172. CHECK_LIST_CHECKED: {
  10173. listType: "CHECK_LIST_CHECKED",
  10174. nestingLevel: ca(
  10175. "☑",
  10176. {
  10177. st: {
  10178. s: we.TRUE
  10179. }
  10180. }
  10181. )
  10182. }
  10183. }, br = (t) => {
  10184. const { glyphFormat: e, glyphType: n } = t, r = re.deepClone(Es.ORDER_LIST);
  10185. return r.nestingLevel[0].glyphFormat = e, r.nestingLevel[0].glyphType = n, r;
  10186. }, Tm = {
  10187. ORDER_LIST_QUICK_2: br(Or[
  10188. "a)"
  10189. /* ORDER_LIST_QUICK_2 */
  10190. ]),
  10191. ORDER_LIST_QUICK_3: br(Or[
  10192. "a."
  10193. /* ORDER_LIST_QUICK_3 */
  10194. ]),
  10195. ORDER_LIST_QUICK_4: br(Or[
  10196. "i."
  10197. /* ORDER_LIST_QUICK_4 */
  10198. ]),
  10199. ORDER_LIST_QUICK_6: br(Or[
  10200. "I."
  10201. /* ORDER_LIST_QUICK_6 */
  10202. ])
  10203. };
  10204. Object.assign(Es, Tm);
  10205. const ZC = {
  10206. "1.": "ORDER_LIST",
  10207. "a)": "ORDER_LIST_QUICK_2",
  10208. "a.": "ORDER_LIST_QUICK_3",
  10209. "i.": "ORDER_LIST_QUICK_4",
  10210. "A.": "ORDER_LIST_3",
  10211. "I.": "ORDER_LIST_QUICK_6",
  10212. "01.": "ORDER_LIST_5"
  10213. /* ORDER_LIST_5 */
  10214. };
  10215. function Mm(t, e, n, r, s) {
  10216. const i = Dm(t, e, n, r, s), o = xm(t, e, n, r, s), a = Lm(t, e, n, r, s), u = Um(t, e, n, r, s), c = Pm(t, e, n, r, s), l = km(t, e, n, r), h = Fm(t, e, n, r, s);
  10217. return {
  10218. dataStream: "",
  10219. textRuns: i,
  10220. paragraphs: o,
  10221. sectionBreaks: a,
  10222. customBlocks: u,
  10223. tables: c,
  10224. customRanges: l,
  10225. customDecorations: h
  10226. };
  10227. }
  10228. function Dm(t, e, n, r, s) {
  10229. const { textRuns: i } = t, { textRuns: o } = e;
  10230. if (i == null || o == null)
  10231. return;
  10232. const a = Ku(t, n, r);
  10233. if (s !== Pe.REPLACE) {
  10234. const u = qu(o, a, s);
  10235. e.textRuns = u;
  10236. }
  10237. return ju(t, e, n, r), a;
  10238. }
  10239. function qu(t, e, n) {
  10240. if (e.length === 0)
  10241. return t;
  10242. t = re.deepClone(t), e = re.deepClone(e);
  10243. const r = [], s = t.length, i = e.length;
  10244. let o = 0, a = 0, u = null;
  10245. function c() {
  10246. return u ? (r.push(u), u = null, !0) : !1;
  10247. }
  10248. for (; o < s && a < i; ) {
  10249. const { st: f, ed: E, ts: R } = t[o], { st: O, ed: U, ts: ne, sId: X } = e[a];
  10250. let de;
  10251. if (n === Pe.COVER ? de = { ...ne, ...R } : de = { ...R }, E < O)
  10252. c() || r.push(t[o]), o++;
  10253. else if (U < f)
  10254. c() || r.push(e[a]), a++;
  10255. else {
  10256. const T = {
  10257. st: Math.min(f, O),
  10258. ed: Math.max(f, O),
  10259. ts: f < O ? { ...R } : { ...ne },
  10260. sId: f < O ? void 0 : X
  10261. };
  10262. T.ed > T.st && r.push(T), r.push({
  10263. st: Math.max(f, O),
  10264. ed: Math.min(E, U),
  10265. ts: de,
  10266. sId: X
  10267. }), E < U ? (o++, e[a].st = E, e[a].st === e[a].ed && a++) : (a++, t[o].st = U, t[o].st === t[o].ed && o++);
  10268. const A = {
  10269. st: Math.min(E, U),
  10270. ed: Math.max(E, U),
  10271. ts: E < U ? { ...ne } : { ...R },
  10272. sId: E < U ? X : void 0
  10273. };
  10274. u = A.ed > A.st ? A : null;
  10275. }
  10276. }
  10277. c();
  10278. const l = r[r.length - 1], h = t[s - 1], d = e[i - 1];
  10279. return l && l.ed !== Math.max(h.ed, d.ed) && (h.ed > d.ed ? r.push(h) : r.push(d)), _s(r);
  10280. }
  10281. function xm(t, e, n, r, s) {
  10282. const { paragraphs: i } = t, { paragraphs: o } = e;
  10283. if (i == null || o == null)
  10284. return;
  10285. const a = Xu(t, n, r);
  10286. if (s !== Pe.REPLACE) {
  10287. const u = [];
  10288. for (const c of o) {
  10289. const {
  10290. startIndex: l,
  10291. paragraphStyle: h,
  10292. bullet: d
  10293. } = c;
  10294. let f = [];
  10295. for (const E of a) {
  10296. const {
  10297. startIndex: R,
  10298. paragraphStyle: O,
  10299. bullet: U
  10300. } = E;
  10301. let ne, X;
  10302. if (s === Pe.COVER ? (ne = { ...O, ...h }, X = {
  10303. listId: "",
  10304. listType: Ft.BULLET_LIST,
  10305. nestingLevel: 0,
  10306. textStyle: {},
  10307. ...U,
  10308. ...d
  10309. }) : (ne = { ...h, ...O }, X = {
  10310. listId: "",
  10311. listType: Ft.BULLET_LIST,
  10312. nestingLevel: 0,
  10313. textStyle: {},
  10314. ...d,
  10315. ...U
  10316. }), l === R) {
  10317. f.push({
  10318. startIndex: l,
  10319. paragraphStyle: ne,
  10320. bullet: X
  10321. });
  10322. break;
  10323. }
  10324. }
  10325. u.push(...f), f = [];
  10326. }
  10327. e.paragraphs = u;
  10328. }
  10329. return Hu(t, e, n, r), a;
  10330. }
  10331. function Lm(t, e, n, r, s) {
  10332. const { sectionBreaks: i } = t, { sectionBreaks: o } = e;
  10333. if (i == null || o == null)
  10334. return;
  10335. const a = Ju(t, n, r);
  10336. if (s !== Pe.REPLACE) {
  10337. const u = [];
  10338. for (const c of o) {
  10339. const { startIndex: l } = c;
  10340. let h = [];
  10341. for (const d of a) {
  10342. const { startIndex: f } = d;
  10343. if (l === f) {
  10344. s === Pe.COVER ? h.push({
  10345. ...d,
  10346. ...c
  10347. }) : h.push({
  10348. ...c,
  10349. ...d
  10350. });
  10351. break;
  10352. }
  10353. }
  10354. u.push(...h), h = [];
  10355. }
  10356. e.sectionBreaks = u;
  10357. }
  10358. return Wu(t, e, n, r), a;
  10359. }
  10360. function Um(t, e, n, r, s) {
  10361. const { customBlocks: i = [] } = t, { customBlocks: o } = e;
  10362. if (i == null || o == null)
  10363. return;
  10364. const a = Zu(t, n, r);
  10365. if (s !== Pe.REPLACE) {
  10366. const u = [];
  10367. for (const c of o) {
  10368. const { startIndex: l } = c;
  10369. let h = [];
  10370. for (const d of a) {
  10371. const { startIndex: f } = d;
  10372. if (l === f) {
  10373. s === Pe.COVER ? h.push({
  10374. ...d,
  10375. ...c
  10376. }) : h.push({
  10377. ...c,
  10378. ...d
  10379. });
  10380. break;
  10381. }
  10382. }
  10383. u.push(...h), h = [];
  10384. }
  10385. e.customBlocks = u;
  10386. }
  10387. return zu(t, e, n, r), i.length && !t.customBlocks && (t.customBlocks = i), a;
  10388. }
  10389. function Pm(t, e, n, r, s) {
  10390. const { tables: i } = t, { tables: o } = e;
  10391. if (i == null || o == null)
  10392. return;
  10393. const a = Qu(t, n, r);
  10394. if (s !== Pe.REPLACE) {
  10395. const u = [];
  10396. for (const c of o) {
  10397. const { startIndex: l, endIndex: h } = c;
  10398. let d = [];
  10399. for (const f of a) {
  10400. const { startIndex: E, endIndex: R } = f;
  10401. if (E >= l && R <= h) {
  10402. s === Pe.COVER ? d.push({
  10403. ...f,
  10404. ...c
  10405. }) : d.push({
  10406. ...c,
  10407. ...f
  10408. });
  10409. break;
  10410. }
  10411. }
  10412. u.push(...d), d = [];
  10413. }
  10414. e.tables = u;
  10415. }
  10416. return Yu(t, e, n, r), a;
  10417. }
  10418. function km(t, e, n, r, s) {
  10419. t.customRanges || (t.customRanges = []), Qs(t.customRanges, r), Qs(t.customRanges, r + n);
  10420. const i = r, o = r + n - 1, { customRanges: a } = e, u = [], c = /* @__PURE__ */ new Map();
  10421. t.customRanges.forEach((h) => {
  10422. const { startIndex: d, endIndex: f } = h;
  10423. d >= i && f <= o ? c.set(h.rangeId, h) : u.push(h);
  10424. });
  10425. const l = [];
  10426. return a ? (a.forEach((h) => {
  10427. const { startIndex: d, endIndex: f } = h;
  10428. u.push({
  10429. ...h,
  10430. startIndex: d + r,
  10431. endIndex: f + r
  10432. });
  10433. }), t.customRanges = ki(u), l) : [];
  10434. }
  10435. function Fm(t, e, n, r, s) {
  10436. t.customDecorations || (t.customDecorations = []), qs(t.customDecorations, r), qs(t.customDecorations, r + n);
  10437. const i = [], { customDecorations: o } = t, { customDecorations: a = [] } = e;
  10438. if (s === Pe.REPLACE) {
  10439. for (let u = 0; u < o.length; u++) {
  10440. const c = o[u], { startIndex: l, endIndex: h } = c;
  10441. l >= r && h <= r + n - 1 && i.push(c);
  10442. }
  10443. a.forEach((u) => {
  10444. const { startIndex: c, endIndex: l } = u;
  10445. o.push({
  10446. ...u,
  10447. startIndex: c + r,
  10448. endIndex: l + r
  10449. });
  10450. });
  10451. } else
  10452. for (const u of a) {
  10453. const { id: c } = u;
  10454. if (u.type === An.DELETED) {
  10455. const l = o.filter((h) => h.id === c);
  10456. l.length && i.push(...l);
  10457. } else
  10458. o.push({
  10459. ...u,
  10460. startIndex: u.startIndex + r,
  10461. endIndex: u.endIndex + r
  10462. });
  10463. }
  10464. for (const u of i) {
  10465. const { id: c } = u, l = o.findIndex((h) => h.id === c);
  10466. l !== -1 && o.splice(l, 1);
  10467. }
  10468. return t.customDecorations = Gu(o), i;
  10469. }
  10470. var el = /* @__PURE__ */ ((t) => (t[t.copy = 0] = "copy", t[t.cut = 1] = "cut", t))(el || {});
  10471. function ei(t, e, n, r = !0) {
  10472. const { textRuns: s } = t;
  10473. if (s) {
  10474. const i = [];
  10475. for (const o of s) {
  10476. const a = re.deepClone(o), { st: u, ed: c } = a;
  10477. re.hasIntersectionBetweenTwoRanges(u, c, e, n) && (e >= u && e <= c ? i.push({
  10478. ...a,
  10479. st: e,
  10480. ed: Math.min(n, c)
  10481. }) : n >= u && n <= c ? i.push({
  10482. ...a,
  10483. st: Math.max(e, u),
  10484. ed: n
  10485. }) : i.push(a));
  10486. }
  10487. return _s(
  10488. i.map((o) => {
  10489. const { st: a, ed: u } = o;
  10490. return {
  10491. ...o,
  10492. st: a - e,
  10493. ed: u - e
  10494. };
  10495. })
  10496. );
  10497. } else if (r)
  10498. return [{
  10499. st: 0,
  10500. ed: n - e,
  10501. ts: {}
  10502. }];
  10503. }
  10504. function $m(t, e, n) {
  10505. const { tables: r = [] } = t, s = [];
  10506. for (const i of r) {
  10507. const o = re.deepClone(i), { startIndex: a, endIndex: u } = o;
  10508. a >= e && u <= n && s.push({
  10509. ...o,
  10510. startIndex: a - e,
  10511. endIndex: u - e
  10512. });
  10513. }
  10514. return s;
  10515. }
  10516. function Bm(t, e, n) {
  10517. const { paragraphs: r = [] } = t, s = [];
  10518. for (const i of r) {
  10519. const { startIndex: o } = i;
  10520. o >= e && o < n && s.push(re.deepClone(i));
  10521. }
  10522. if (s.length)
  10523. return s.map((i) => ({
  10524. ...i,
  10525. startIndex: i.startIndex - e
  10526. }));
  10527. }
  10528. function QC(t, e, n) {
  10529. const { sectionBreaks: r = [] } = t, s = [];
  10530. for (const i of r) {
  10531. const { startIndex: o } = i;
  10532. o >= e && o <= n && s.push(re.deepClone(i));
  10533. }
  10534. if (s.length)
  10535. return s.map((i) => ({
  10536. ...i,
  10537. startIndex: i.startIndex - e
  10538. }));
  10539. }
  10540. function jm(t, e, n) {
  10541. const { customBlocks: r = [] } = t, s = [];
  10542. for (const i of r) {
  10543. const { startIndex: o } = i;
  10544. o >= e && o <= n && s.push(re.deepClone(i));
  10545. }
  10546. if (s.length)
  10547. return s.map((i) => ({
  10548. ...i,
  10549. startIndex: i.startIndex - e
  10550. }));
  10551. }
  10552. function Dt(t, e, n, r = !0, s = 1) {
  10553. const { dataStream: i } = t, o = {
  10554. dataStream: i.slice(e, n)
  10555. };
  10556. o.textRuns = ei(t, e, n, r);
  10557. const a = $m(t, e, n);
  10558. if (a.length && (o.tables = a), o.paragraphs = Bm(t, e, n), s === 1) {
  10559. const c = Wm(t, e, n);
  10560. c ? o.customDecorations = c : r && (o.customDecorations = []);
  10561. }
  10562. const { customRanges: u } = Hm(t, e, n);
  10563. return u ? o.customRanges = u : r && (o.customRanges = []), o.customBlocks = jm(t, e, n), o;
  10564. }
  10565. function qC(t) {
  10566. const { dataStream: e, textRuns: n, paragraphs: r, customRanges: s, customDecorations: i, tables: o } = t;
  10567. let a = 0, u = 0;
  10568. s == null || s.forEach((l) => {
  10569. l.startIndex < 0 && (a = Math.max(a, -l.startIndex)), l.endIndex > e.length - 1 && (u = Math.max(u, l.endIndex - e.length + 1));
  10570. });
  10571. const c = `${e}`;
  10572. return n && (n[0] && (n[0].st = n[0].st - a), n[n.length - 1] && (n[n.length - 1].ed = n[n.length - 1].ed + u)), n == null || n.forEach((l) => {
  10573. l.st += a, l.ed += a;
  10574. }), r == null || r.forEach((l) => {
  10575. l.startIndex += a;
  10576. }), s == null || s.forEach((l) => {
  10577. l.startIndex += a, l.endIndex += a;
  10578. }), i == null || i.forEach((l) => {
  10579. l.startIndex += a, l.endIndex += u;
  10580. }), o == null || o.forEach((l) => {
  10581. l.startIndex += a, l.endIndex += u;
  10582. }), {
  10583. ...t,
  10584. dataStream: c,
  10585. textRuns: n,
  10586. paragraphs: r,
  10587. customRanges: s,
  10588. customDecorations: i,
  10589. tables: o
  10590. };
  10591. }
  10592. function Hm(t, e, n) {
  10593. if (t.customRanges == null)
  10594. return {};
  10595. const { customRanges: r } = t;
  10596. return {
  10597. customRanges: r.filter((a) => Math.max(a.startIndex, e) <= Math.min(a.endIndex, n - 1)).map((a) => ({
  10598. ...a,
  10599. startIndex: Math.max(a.startIndex, e),
  10600. endIndex: Math.min(a.endIndex, n - 1)
  10601. })).map((a) => ({
  10602. ...a,
  10603. startIndex: a.startIndex - e,
  10604. endIndex: a.endIndex - e
  10605. })),
  10606. leftOffset: 0,
  10607. rightOffset: 0
  10608. };
  10609. }
  10610. function Wm(t, e, n) {
  10611. if (t.customDecorations == null)
  10612. return;
  10613. const { customDecorations: r = [] } = t, s = [];
  10614. return r.forEach((i) => {
  10615. if (Math.max(i.startIndex, e) <= Math.min(i.endIndex, n - 1)) {
  10616. const o = re.deepClone(i);
  10617. s.push({
  10618. ...o,
  10619. startIndex: Math.max(o.startIndex - e, 0),
  10620. endIndex: Math.min(o.endIndex, n - 1) - e
  10621. });
  10622. }
  10623. }), s;
  10624. }
  10625. function zm(t, e, n) {
  10626. return t == null || e == null ? t != null ? t : e : qu(t, e, n);
  10627. }
  10628. function Ym(t, e, n) {
  10629. if (t == null || e == null)
  10630. return t != null ? t : e;
  10631. if (e.length === 0 || t.length === 0)
  10632. return t;
  10633. if (e.length > 1 || t.length > 1)
  10634. throw new Error("Cannot cover multiple customRanges");
  10635. return n === Pe.REPLACE ? [{
  10636. ...t[0]
  10637. }] : [{
  10638. ...e[0],
  10639. ...t[0]
  10640. }];
  10641. }
  10642. function Vm(t, e, n) {
  10643. return e.length === 0 || t.length === 0 || n === Pe.REPLACE ? t : [
  10644. ...t,
  10645. ...e.filter((r) => !t.some((s) => r.id === s.id))
  10646. ];
  10647. }
  10648. function ha(t, e, n = Pe.COVER) {
  10649. if (e.dataStream !== "")
  10650. throw new Error("Cannot compose other body with non-empty dataStream");
  10651. const r = {
  10652. dataStream: t.dataStream
  10653. }, {
  10654. textRuns: s,
  10655. paragraphs: i = [],
  10656. customRanges: o,
  10657. customDecorations: a = []
  10658. } = t, {
  10659. textRuns: u,
  10660. paragraphs: c = [],
  10661. customRanges: l,
  10662. customDecorations: h = []
  10663. } = e;
  10664. r.textRuns = zm(u, s, n), r.customRanges = Ym(l, o, n);
  10665. const d = Vm(h, a, n);
  10666. d.length && (r.customDecorations = d);
  10667. const f = [];
  10668. let E = 0, R = 0;
  10669. for (; E < i.length && R < c.length; ) {
  10670. const O = i[E], U = c[R], { startIndex: ne } = O, { startIndex: X } = U;
  10671. ne === X ? (f.push(re.deepMerge(O, U)), E++, R++) : ne < X ? (f.push(re.deepClone(O)), E++) : (f.push(re.deepClone(U)), R++);
  10672. }
  10673. return E < i.length && f.push(...i.slice(E)), R < c.length && f.push(...c.slice(R)), f.length && (r.paragraphs = f), r;
  10674. }
  10675. function Gm(t) {
  10676. const { body: e } = t;
  10677. if (e == null)
  10678. return !0;
  10679. const { textRuns: n, paragraphs: r, customRanges: s, customBlocks: i, customDecorations: o, tables: a } = e;
  10680. return n == null && r == null && s == null && i == null && o == null && a == null;
  10681. }
  10682. class Bn {
  10683. constructor(e) {
  10684. C(this, "_index", 0);
  10685. C(this, "_offset", 0);
  10686. this._actions = e;
  10687. }
  10688. hasNext() {
  10689. return this.peekLength() < Number.POSITIVE_INFINITY;
  10690. }
  10691. next(e) {
  10692. e || (e = Number.POSITIVE_INFINITY);
  10693. const n = this._actions[this._index];
  10694. if (n) {
  10695. const r = this._offset, s = n.len;
  10696. return e >= s - r ? (e = s - r, this._index += 1, this._offset = 0) : this._offset += e, n.t === ce.DELETE || n.t === ce.RETAIN && n.body == null ? re.deepClone({
  10697. ...n,
  10698. len: e
  10699. }) : re.deepClone({
  10700. ...n,
  10701. len: e,
  10702. body: Dt(n.body, r, r + e, !1)
  10703. });
  10704. } else
  10705. return {
  10706. t: ce.RETAIN,
  10707. len: Number.POSITIVE_INFINITY
  10708. };
  10709. }
  10710. peek() {
  10711. return this._actions[this._index];
  10712. }
  10713. peekLength() {
  10714. return this._actions[this._index] ? this._actions[this._index].len - this._offset : Number.POSITIVE_INFINITY;
  10715. }
  10716. peekType() {
  10717. const e = this._actions[this._index];
  10718. return e ? e.t : ce.RETAIN;
  10719. }
  10720. rest() {
  10721. if (this.hasNext()) {
  10722. if (this._offset === 0)
  10723. return this._actions.slice(this._index);
  10724. {
  10725. const e = this._offset, n = this._index, r = this.next(), s = this._actions.slice(this._index);
  10726. return this._offset = e, this._index = n, [r].concat(s);
  10727. }
  10728. } else return [];
  10729. }
  10730. }
  10731. class lr {
  10732. constructor() {
  10733. C(this, "cursor", 0);
  10734. }
  10735. reset() {
  10736. return this.cursor = 0, this;
  10737. }
  10738. moveCursor(e) {
  10739. this.cursor += e;
  10740. }
  10741. moveCursorTo(e) {
  10742. this.cursor = e;
  10743. }
  10744. }
  10745. function Km(t, e, n) {
  10746. const { dataStream: r } = t, s = n, i = n + e, o = Ku(t, e, n), a = Xu(t, e, n), u = Ju(t, e, n), c = Zu(t, e, n), l = Qu(t, e, n), h = Sm(t, e, n), d = Am(t, e, n);
  10747. let f = "";
  10748. return r && (t.dataStream = pp(r, s, i), f = r.slice(s, i)), {
  10749. dataStream: f,
  10750. textRuns: o,
  10751. paragraphs: a,
  10752. sectionBreaks: u,
  10753. customBlocks: c,
  10754. tables: l,
  10755. customRanges: h,
  10756. customDecorations: d
  10757. };
  10758. }
  10759. function Xm(t, e, n, r) {
  10760. t.dataStream = gp(t.dataStream, r, e.dataStream), ju(t, e, n, r), Hu(t, e, n, r), Wu(t, e, n, r), zu(t, e, n, r), Yu(t, e, n, r), Om(t, e, n, r), bm(t, e, n, r);
  10761. }
  10762. function Jm(t, e, n, r, s = Pe.COVER) {
  10763. return Mm(t, e, n, r, s);
  10764. }
  10765. function Zm(t, e, n) {
  10766. return e <= 0 ? { dataStream: "" } : Km(t, e, n);
  10767. }
  10768. function Qm(t, e, n, r) {
  10769. n !== 0 && Xm(t, e, n, r);
  10770. }
  10771. function qm(t, e) {
  10772. const n = new lr();
  10773. return n.reset(), e.forEach((r) => {
  10774. const s = re.deepClone(r);
  10775. switch (s.t) {
  10776. case ce.RETAIN: {
  10777. const { coverType: i, body: o, len: a } = s;
  10778. o != null && Jm(t, o, a, n.cursor, i), n.moveCursor(a);
  10779. break;
  10780. }
  10781. case ce.INSERT: {
  10782. const { body: i, len: o } = s;
  10783. Qm(t, i, o, n.cursor), n.moveCursor(o);
  10784. break;
  10785. }
  10786. case ce.DELETE: {
  10787. const { len: i } = s;
  10788. Zm(t, i, n.cursor);
  10789. break;
  10790. }
  10791. default:
  10792. throw new Error(`Unknown action type for action: ${s}.`);
  10793. }
  10794. }), t;
  10795. }
  10796. function e_(t, e, n, r, s) {
  10797. if (t == null || e == null)
  10798. return e;
  10799. if (t.length === 0 || e.length === 0)
  10800. return [];
  10801. e = re.deepClone(e), t = re.deepClone(t);
  10802. const i = [], o = e.length, a = t.length;
  10803. let u = 0, c = 0, l = null;
  10804. function h() {
  10805. return l ? (i.push(l), l = null, !0) : !1;
  10806. }
  10807. for (; u < o && c < a; ) {
  10808. const { st: R, ed: O, ts: U } = e[u], { st: ne, ed: X, ts: de, sId: T } = t[c];
  10809. let A = {};
  10810. if (s === 0)
  10811. A = { ...U }, n === Pe.COVER && r === Pe.REPLACE && de && (A = Object.assign({}, de, A));
  10812. else if (A = { ...U }, n === Pe.REPLACE) {
  10813. if (r === Pe.REPLACE)
  10814. A = { ...de };
  10815. else if (U && de) {
  10816. const H = Object.keys(U);
  10817. for (const Z of H)
  10818. de[Z] && delete A[Z];
  10819. }
  10820. } else if (r === Pe.REPLACE) {
  10821. if (de) {
  10822. const H = Object.keys(de);
  10823. for (const Z of H)
  10824. de[Z] !== void 0 && (A[Z] = de[Z]);
  10825. }
  10826. } else if (de) {
  10827. const H = Object.keys(de);
  10828. for (const Z of H)
  10829. A[Z] !== void 0 && delete A[Z];
  10830. }
  10831. if (O < ne)
  10832. h() || i.push(e[u]), u++;
  10833. else if (X < R)
  10834. h() || i.push(t[c]), c++;
  10835. else {
  10836. const H = {
  10837. st: Math.min(R, ne),
  10838. ed: Math.max(R, ne),
  10839. ts: R < ne ? { ...U } : { ...de },
  10840. sId: R < ne ? void 0 : T
  10841. };
  10842. H.ed > H.st && i.push(), i.push({
  10843. st: Math.max(R, ne),
  10844. ed: Math.min(O, X),
  10845. ts: A,
  10846. sId: T
  10847. }), O < X ? (u++, t[c].st = O, t[c].st === t[c].ed && c++) : (c++, e[u].st = X, e[u].st === e[u].ed && u++);
  10848. const Z = {
  10849. st: Math.min(O, X),
  10850. ed: Math.max(O, X),
  10851. ts: O < X ? { ...de } : { ...U },
  10852. sId: O < X ? T : void 0
  10853. };
  10854. l = Z.ed > Z.st ? Z : null;
  10855. }
  10856. }
  10857. h();
  10858. const d = i[i.length - 1], f = e[o - 1], E = t[a - 1];
  10859. return d.ed !== Math.max(f.ed, E.ed) && (f.ed > E.ed ? i.push(f) : i.push(E)), _s(i, !0);
  10860. }
  10861. function t_(t, e, n, r, s) {
  10862. if (t == null || e == null)
  10863. return e;
  10864. if (t.length === 0 || e.length === 0)
  10865. return [];
  10866. if (t.length > 1 || e.length > 1)
  10867. throw new Error("CustomRanges is only supported transform for length one now.");
  10868. const i = t[0], o = e[0];
  10869. if (n === Pe.REPLACE)
  10870. return s === 1 ? [re.deepClone(i)] : [re.deepClone(o)];
  10871. if (r === Pe.REPLACE) {
  10872. const a = re.deepClone(o);
  10873. return s === 1 && Object.assign(a, re.deepClone(i)), [a];
  10874. } else {
  10875. const a = re.deepClone(o);
  10876. return s === 1 && Object.assign(a, re.deepClone(i)), [a];
  10877. }
  10878. }
  10879. function da(t, e, n, r, s) {
  10880. const i = {
  10881. startIndex: e.startIndex
  10882. };
  10883. if (e.paragraphStyle && (i.paragraphStyle = re.deepClone(e.paragraphStyle), t.paragraphStyle)) {
  10884. if (n === Pe.REPLACE)
  10885. if (r === Pe.REPLACE)
  10886. s === 1 && (i.paragraphStyle = {
  10887. ...t.paragraphStyle
  10888. });
  10889. else if (s === 1) {
  10890. const o = Object.keys(t.paragraphStyle);
  10891. for (const a of o)
  10892. t.paragraphStyle[a] !== void 0 && (i.paragraphStyle[a] = t.paragraphStyle[a]);
  10893. } else {
  10894. const o = Object.keys(t.paragraphStyle);
  10895. for (const a of o)
  10896. i.paragraphStyle[a] === void 0 && (i.paragraphStyle[a] = t.paragraphStyle[a]);
  10897. }
  10898. else if (r === Pe.REPLACE)
  10899. if (s === 1) {
  10900. const o = Object.keys(t.paragraphStyle);
  10901. for (const a of o)
  10902. t.paragraphStyle[a] !== void 0 && (i.paragraphStyle[a] = t.paragraphStyle[a]);
  10903. } else {
  10904. const o = Object.keys(t.paragraphStyle);
  10905. for (const a of o)
  10906. i.paragraphStyle[a] === void 0 && (i.paragraphStyle[a] = t.paragraphStyle[a]);
  10907. }
  10908. else if (s === 1) {
  10909. const o = Object.keys(t.paragraphStyle);
  10910. for (const a of o)
  10911. i.paragraphStyle[a] && delete i.paragraphStyle[a];
  10912. }
  10913. }
  10914. return n === Pe.REPLACE && r === Pe.REPLACE ? i.bullet = s === 1 ? re.deepClone(t.bullet) : re.deepClone(e.bullet) : t.bullet === void 0 ? i.bullet = re.deepClone(e.bullet) : n === Pe.REPLACE || r === Pe.REPLACE ? i.bullet = s === 0 && e.bullet ? re.deepClone(e.bullet) : re.deepClone(t.bullet) : s === 0 && e.bullet !== void 0 && (i.bullet = re.deepClone(e.bullet)), i;
  10915. }
  10916. function n_(t, e) {
  10917. if (t == null || e == null)
  10918. return e;
  10919. if (t.length === 0 || e.length === 0)
  10920. return re.deepClone(e);
  10921. const n = [];
  10922. for (const r of e) {
  10923. const { id: s, type: i } = r;
  10924. let o = !1;
  10925. for (const a of t)
  10926. if (a.id === s) {
  10927. (a.type === An.DELETED || i === An.DELETED) && (o = !0, n.push({
  10928. ...r,
  10929. type: An.DELETED
  10930. }));
  10931. break;
  10932. }
  10933. o || n.push(r);
  10934. }
  10935. return n;
  10936. }
  10937. function r_(t, e, n = !1) {
  10938. const { body: r, coverType: s = Pe.COVER } = t, { body: i, coverType: o = Pe.COVER } = e;
  10939. if (r == null || r.dataStream !== "" || i == null || i.dataStream !== "")
  10940. throw new Error("Data stream is not supported in retain transform.");
  10941. const a = {
  10942. dataStream: ""
  10943. }, u = o, {
  10944. textRuns: c,
  10945. paragraphs: l = [],
  10946. customRanges: h,
  10947. customDecorations: d
  10948. } = r, {
  10949. textRuns: f,
  10950. paragraphs: E = [],
  10951. customRanges: R,
  10952. customDecorations: O
  10953. } = i, U = e_(
  10954. c,
  10955. f,
  10956. s,
  10957. o,
  10958. n ? 1 : 0
  10959. /* COVER */
  10960. );
  10961. U && (a.textRuns = U);
  10962. const ne = t_(
  10963. h,
  10964. R,
  10965. s,
  10966. o,
  10967. n ? 1 : 0
  10968. /* COVER */
  10969. );
  10970. ne && (a.customRanges = ne);
  10971. const X = n_(
  10972. d,
  10973. O
  10974. );
  10975. X && (a.customDecorations = X);
  10976. const de = [];
  10977. let T = 0, A = 0;
  10978. for (; T < l.length && A < E.length; ) {
  10979. const H = l[T], Z = E[A], { startIndex: fe } = H, { startIndex: ae } = Z;
  10980. if (fe === ae) {
  10981. let m = {
  10982. startIndex: fe
  10983. };
  10984. n ? m = da(
  10985. H,
  10986. Z,
  10987. s,
  10988. o,
  10989. 1
  10990. /* COVER_ONLY_NOT_EXISTED */
  10991. ) : m = da(
  10992. H,
  10993. Z,
  10994. s,
  10995. o,
  10996. 0
  10997. /* COVER */
  10998. ), de.push(m), T++, A++;
  10999. } else fe < ae ? T++ : (de.push(re.deepClone(Z)), A++);
  11000. }
  11001. return A < E.length && de.push(...E.slice(A)), de.length && (a.paragraphs = de), {
  11002. coverType: u,
  11003. body: a
  11004. };
  11005. }
  11006. function fa(t) {
  11007. return Object.keys(t).length === 1;
  11008. }
  11009. const wn = class wn {
  11010. constructor() {
  11011. C(this, "_actions", []);
  11012. }
  11013. static apply(e, n) {
  11014. return qm(e, n);
  11015. }
  11016. // eslint-disable-next-line complexity
  11017. static compose(e, n) {
  11018. const r = new Bn(e), s = new Bn(n), i = new wn();
  11019. for (; r.hasNext() || s.hasNext(); )
  11020. if (s.peekType() === ce.INSERT)
  11021. i.push(s.next());
  11022. else if (r.peekType() === ce.DELETE)
  11023. i.push(r.next());
  11024. else {
  11025. const o = Math.min(r.peekLength(), s.peekLength()), a = r.next(o), u = s.next(o);
  11026. if (a.t === ce.INSERT && u.t === ce.RETAIN)
  11027. u.body == null ? i.push(a) : i.push({
  11028. ...a,
  11029. body: ha(a.body, u.body, u.coverType)
  11030. });
  11031. else if (a.t === ce.RETAIN && u.t === ce.RETAIN)
  11032. if (a.body == null && u.body == null)
  11033. i.push(a.len !== Number.POSITIVE_INFINITY ? a : u);
  11034. else if (a.body && u.body) {
  11035. const c = a.coverType === Pe.REPLACE || u.coverType === Pe.REPLACE ? Pe.REPLACE : Pe.COVER;
  11036. i.push({
  11037. ...a,
  11038. t: ce.RETAIN,
  11039. coverType: c,
  11040. body: ha(a.body, u.body, u.coverType)
  11041. });
  11042. } else
  11043. i.push(a.body ? a : u);
  11044. else a.t === ce.RETAIN && u.t === ce.DELETE ? i.push(u) : a.t === ce.INSERT && (u.t, ce.DELETE);
  11045. }
  11046. return i.trimEndUselessRetainAction(), i.serialize();
  11047. }
  11048. /**
  11049. * |(this↓ \| other→) | **insert** | **retain** | **delete** |
  11050. * | ---------------- | ---------- | ---------- | ---------- |
  11051. * | **insert** | Case 1 | Case 2 | Case 2 |
  11052. * | **retain** | Case 1 | Case 5 | Case 4 |
  11053. * | **delete** | Case 1 | Case 3 | Case 3 |
  11054. *
  11055. * Case 1: When the other action type is an insert operation,
  11056. * the insert operation is retained regardless of the type of action this action
  11057. * Case 2: When this action type is an insert operation and the other action type is a
  11058. * non-insert operation, you need to retain the length of this action insert
  11059. * Case 3: When this action is a delete operation, there are two scenarios:
  11060. * 1) When other is a delete operation, since it is a delete operation, this has
  11061. * already been deleted, so the target does not need to be in delete, and it can
  11062. * be continued directly
  11063. * 2) When other is the retain operation, although this action delete occurs first,
  11064. * the delete priority is higher, so the delete operation is retained, and the origin
  11065. * delete has been applied, so it is directly continued
  11066. * Case 4: other is the delete operation, this is the retain operation, and the target delete operation
  11067. * is kept
  11068. * Case 5: When both other and this are retain operations
  11069. * 1) If the other body attribute does not exist, directly retain length
  11070. * 2) If the other body property exists, then execute the TransformBody logic to override it
  11071. */
  11072. // priority - if true, this actions takes priority over other, that is, this actions are considered to happen "first".
  11073. // thisActions is the target action.
  11074. static transform(e, n, r = "right") {
  11075. return this._transform(n, e, r === "left" ? "right" : "left");
  11076. }
  11077. // otherActions is the actions to be transformed.
  11078. static _transform(e, n, r = "right") {
  11079. const s = new Bn(e), i = new Bn(n), o = new wn();
  11080. for (; s.hasNext() || i.hasNext(); )
  11081. if (s.peekType() === ce.INSERT && (r === "left" || i.peekType() !== ce.INSERT)) {
  11082. const a = s.next();
  11083. o.retain(a.len);
  11084. } else if (i.peekType() === ce.INSERT)
  11085. o.push(i.next());
  11086. else {
  11087. const a = Math.min(s.peekLength(), i.peekLength()), u = s.next(a), c = i.next(a);
  11088. if (u.t === ce.DELETE)
  11089. continue;
  11090. if (c.t === ce.DELETE) {
  11091. o.push(c);
  11092. continue;
  11093. }
  11094. if (u.body == null || c.body == null)
  11095. o.push(c);
  11096. else {
  11097. const { coverType: l, body: h } = r_(u, c, r === "left");
  11098. o.push({
  11099. ...c,
  11100. t: ce.RETAIN,
  11101. coverType: l,
  11102. body: h
  11103. });
  11104. }
  11105. }
  11106. return o.trimEndUselessRetainAction(), o.serialize();
  11107. }
  11108. /**
  11109. * Used to transform selection. Why not named transformSelection?
  11110. * Because Univer Doc supports multiple Selections in one document, user need to encapsulate transformSelections at the application layer.
  11111. */
  11112. static transformPosition(e, n, r = !1) {
  11113. const s = new Bn(e);
  11114. let i = 0;
  11115. for (; s.hasNext() && i <= n; ) {
  11116. const o = s.peekLength(), a = s.peekType();
  11117. if (s.next(), a === ce.DELETE) {
  11118. n -= Math.min(o, n - i);
  11119. continue;
  11120. } else a === ce.INSERT && (i < n || !r) && (n += o);
  11121. i += o;
  11122. }
  11123. return n;
  11124. }
  11125. static isNoop(e) {
  11126. return e.length === 0;
  11127. }
  11128. static invert(e) {
  11129. const n = [];
  11130. for (const r of e)
  11131. if (r.t === ce.INSERT)
  11132. n.push({
  11133. t: ce.DELETE,
  11134. len: r.len,
  11135. body: r.body
  11136. });
  11137. else if (r.t === ce.DELETE) {
  11138. if (r.body == null)
  11139. throw new Error("Can not invert DELETE action without body property, makeInvertible must be called first.");
  11140. n.push({
  11141. t: ce.INSERT,
  11142. body: r.body,
  11143. len: r.len
  11144. });
  11145. } else if (r.body != null) {
  11146. if (r.oldBody == null)
  11147. throw new Error("Can not invert RETAIN action without oldBody property, makeInvertible must be called first.");
  11148. n.push({
  11149. t: ce.RETAIN,
  11150. body: r.oldBody,
  11151. oldBody: r.body,
  11152. len: r.len,
  11153. coverType: Pe.REPLACE
  11154. });
  11155. } else
  11156. n.push(r);
  11157. return n;
  11158. }
  11159. static makeInvertible(e, n) {
  11160. const r = [];
  11161. let s = 0;
  11162. for (const i of e) {
  11163. if (i.t === ce.DELETE && (i.body == null || i.body && i.body.dataStream.length !== i.len)) {
  11164. const o = Dt(n, s, s + i.len, !1);
  11165. i.len = o.dataStream.length, i.body = o;
  11166. }
  11167. if (i.t === ce.RETAIN && i.body != null) {
  11168. const o = Dt(n, s, s + i.len, !0);
  11169. i.oldBody = {
  11170. ...o,
  11171. dataStream: ""
  11172. }, i.len = o.dataStream.length;
  11173. }
  11174. r.push(i), i.t !== ce.INSERT && (s += i.len);
  11175. }
  11176. return r;
  11177. }
  11178. insert(e, n) {
  11179. const r = {
  11180. t: ce.INSERT,
  11181. body: n,
  11182. len: e
  11183. };
  11184. return this.push(r), this;
  11185. }
  11186. retain(e, n, r) {
  11187. const s = {
  11188. t: ce.RETAIN,
  11189. len: e
  11190. };
  11191. return n != null && (s.body = n), r != null && (s.coverType = r), this.push(s), this;
  11192. }
  11193. delete(e) {
  11194. const n = {
  11195. t: ce.DELETE,
  11196. len: e
  11197. };
  11198. return this.push(n), this;
  11199. }
  11200. empty() {
  11201. return this._actions = [], this;
  11202. }
  11203. serialize() {
  11204. return this._actions;
  11205. }
  11206. // eslint-disable-next-line complexity
  11207. push(...e) {
  11208. if (e.length > 1) {
  11209. for (const i of e)
  11210. this.push(i);
  11211. return this;
  11212. }
  11213. let n = this._actions.length, r = this._actions[n - 1];
  11214. const s = re.deepClone(e[0]);
  11215. if (s.t === ce.RETAIN && s.len === 0 && s.body == null)
  11216. return this;
  11217. if (typeof r == "object") {
  11218. if (r.t === ce.DELETE && s.t === ce.DELETE)
  11219. return r.len += s.len, this;
  11220. if (r.t === ce.DELETE && s.t === ce.INSERT && (n -= 1, r = this._actions[n - 1], r == null))
  11221. return this._actions.unshift(s), this;
  11222. if (r.t === ce.RETAIN && s.t === ce.RETAIN && r.body == null && s.body == null)
  11223. return r.len += s.len, this;
  11224. if (r.t === ce.INSERT && fa(r.body) && s.t === ce.INSERT && fa(s.body))
  11225. return r.len += s.len, r.body.dataStream += s.body.dataStream, this;
  11226. }
  11227. return n === this._actions.length ? this._actions.push(s) : this._actions.splice(n, 0, s), this;
  11228. }
  11229. trimEndUselessRetainAction() {
  11230. let e = this._actions[this._actions.length - 1];
  11231. for (; e && e.t === ce.RETAIN && Gm(e); )
  11232. this._actions.pop(), e = this._actions[this._actions.length - 1];
  11233. return this;
  11234. }
  11235. };
  11236. // static name = 'text-x';
  11237. C(wn, "id", "text-x"), C(wn, "uri", "https://github.com/dream-num/univer#text-x");
  11238. let Ke = wn;
  11239. Object.defineProperty(Ke, "name", {
  11240. value: "text-x"
  11241. });
  11242. const On = class On {
  11243. static registerSubtype(e) {
  11244. var n;
  11245. e == null || this._subTypes.has(e.name) && ((n = this._subTypes.get(e.name)) == null ? void 0 : n.id) !== Ke.id || (this._subTypes.set(e.name, e), mt.type.registerSubtype(e));
  11246. }
  11247. static apply(e, n) {
  11248. if (!mt.type.isNoop(n))
  11249. return mt.type.apply(e, n);
  11250. }
  11251. static compose(e, n) {
  11252. return mt.type.compose(e, n);
  11253. }
  11254. static transform(e, n, r) {
  11255. return mt.type.transform(e, n, r);
  11256. }
  11257. // Use to transform cursor position, just call TextXPro.transformPosition.
  11258. static transformPosition(e, n, r = "right") {
  11259. return e && e.length === 2 && e[0] === "body" && e[1].et === Ke.name ? Ke.transformPosition(e[1].e, n, r === "left") : n;
  11260. }
  11261. static invertWithDoc(e, n) {
  11262. return mt.type.invertWithDoc(e, n);
  11263. }
  11264. static isNoop(e) {
  11265. return mt.type.isNoop(e);
  11266. }
  11267. static getInstance() {
  11268. return this._instance == null && (this._instance = new On()), this._instance;
  11269. }
  11270. // eslint-disable-next-line ts/no-explicit-any
  11271. removeOp(e, n) {
  11272. return mt.removeOp(e, n);
  11273. }
  11274. moveOp(e, n) {
  11275. return mt.moveOp(e, n);
  11276. }
  11277. // eslint-disable-next-line ts/no-explicit-any
  11278. insertOp(e, n) {
  11279. return mt.insertOp(e, n);
  11280. }
  11281. // eslint-disable-next-line ts/no-explicit-any
  11282. replaceOp(e, n, r) {
  11283. return mt.replaceOp(e, n, r);
  11284. }
  11285. editOp(e, n = ["body"]) {
  11286. return mt.editOp(n, Ke.name, e);
  11287. }
  11288. };
  11289. // static name = 'json-x';
  11290. C(On, "uri", "https://github.com/dream-num/univer#json-x"), C(On, "_subTypes", /* @__PURE__ */ new Map()), C(On, "_instance", null);
  11291. let tn = On;
  11292. tn.registerSubtype(Ke);
  11293. const tl = {
  11294. id: "default_doc",
  11295. documentStyle: {}
  11296. };
  11297. class s_ extends Ui {
  11298. constructor(n) {
  11299. var r;
  11300. super();
  11301. C(this, "type", Fe.UNIVER_DOC);
  11302. C(this, "_name$", new lt(""));
  11303. C(this, "name$", this._name$.asObservable());
  11304. C(this, "snapshot");
  11305. this.snapshot = { ...tl, ...n }, this._name$.next((r = this.snapshot.title) != null ? r : "No Title");
  11306. }
  11307. getUnitId() {
  11308. throw new Error("Method not implemented.");
  11309. }
  11310. getRev() {
  11311. var n;
  11312. return (n = this.snapshot.rev) != null ? n : 1;
  11313. }
  11314. incrementRev() {
  11315. this.snapshot.rev = this.getRev() + 1;
  11316. }
  11317. setRev(n) {
  11318. this.snapshot.rev = n;
  11319. }
  11320. setName(n) {
  11321. this.snapshot.title = n, this._name$.next(n);
  11322. }
  11323. get drawings() {
  11324. return this.snapshot.drawings;
  11325. }
  11326. get documentStyle() {
  11327. return this.snapshot.documentStyle;
  11328. }
  11329. get lists() {
  11330. return this.snapshot.lists;
  11331. }
  11332. get zoomRatio() {
  11333. var n;
  11334. return ((n = this.snapshot.settings) == null ? void 0 : n.zoomRatio) || 1;
  11335. }
  11336. resetDrawing(n, r) {
  11337. this.snapshot.drawings = n, this.snapshot.drawingsOrder = r;
  11338. }
  11339. getBody() {
  11340. return this.snapshot.body;
  11341. }
  11342. getSnapshot() {
  11343. return this.snapshot;
  11344. }
  11345. getBulletPresetList() {
  11346. var s;
  11347. const n = (s = this.snapshot.lists) != null ? s : {};
  11348. return {
  11349. ...Es,
  11350. ...n
  11351. };
  11352. }
  11353. updateDocumentId(n) {
  11354. this.snapshot.id = n;
  11355. }
  11356. updateDocumentRenderConfig(n) {
  11357. const { documentStyle: r } = this.snapshot;
  11358. r.renderConfig == null ? r.renderConfig = n : r.renderConfig = {
  11359. ...r.renderConfig,
  11360. ...n
  11361. };
  11362. }
  11363. updateDocumentStyle(n) {
  11364. this.snapshot.documentStyle == null ? this.snapshot.documentStyle = n : this.snapshot.documentStyle = {
  11365. ...this.snapshot.documentStyle,
  11366. ...n
  11367. };
  11368. }
  11369. updateDocumentDataMargin(n) {
  11370. const { t: r, l: s, b: i, r: o } = n, { documentStyle: a } = this.snapshot;
  11371. r != null && (a.marginTop = r), s != null && (a.marginLeft = s), i != null && (a.marginBottom = i), o != null && (a.marginRight = o);
  11372. }
  11373. updateDocumentDataPageSize(n, r) {
  11374. const { documentStyle: s } = this.snapshot;
  11375. if (!s.pageSize) {
  11376. n = n != null ? n : Number.POSITIVE_INFINITY, r = r != null ? r : Number.POSITIVE_INFINITY, s.pageSize = {
  11377. width: n,
  11378. height: r
  11379. };
  11380. return;
  11381. }
  11382. n !== void 0 && (s.pageSize.width = n), r !== void 0 && (s.pageSize.height = r);
  11383. }
  11384. updateDrawing(n, r) {
  11385. const { drawings: s } = this, { width: i, height: o, left: a, top: u } = r, c = s == null ? void 0 : s[n];
  11386. if (!c)
  11387. return;
  11388. const l = c.docTransform;
  11389. l.size.width = i, l.size.height = o, l.positionH.posOffset = a, l.positionV.posOffset = u;
  11390. }
  11391. setZoomRatio(n = 1) {
  11392. this.snapshot.settings == null ? this.snapshot.settings = {
  11393. zoomRatio: n
  11394. } : this.snapshot.settings.zoomRatio = 1;
  11395. }
  11396. }
  11397. class jt extends s_ {
  11398. constructor(n) {
  11399. var s, i;
  11400. super(re.isEmptyObject(n) ? _m() : n);
  11401. C(this, "_unitId");
  11402. C(this, "headerModelMap", /* @__PURE__ */ new Map());
  11403. C(this, "footerModelMap", /* @__PURE__ */ new Map());
  11404. C(this, "change$", new lt(0));
  11405. const r = 6;
  11406. this._unitId = (s = this.snapshot.id) != null ? s : re.generateRandomId(r), this._initializeHeaderFooterModel(), this._name$.next((i = this.snapshot.title) != null ? i : "");
  11407. }
  11408. dispose() {
  11409. super.dispose(), this.headerModelMap.forEach((n) => {
  11410. n.dispose();
  11411. }), this.footerModelMap.forEach((n) => {
  11412. n.dispose();
  11413. }), this._name$.complete();
  11414. }
  11415. getDrawings() {
  11416. return this.snapshot.drawings;
  11417. }
  11418. getDrawingsOrder() {
  11419. return this.snapshot.drawingsOrder;
  11420. }
  11421. getCustomRanges() {
  11422. var n;
  11423. return (n = this.snapshot.body) == null ? void 0 : n.customRanges;
  11424. }
  11425. getCustomDecorations() {
  11426. var n;
  11427. return (n = this.snapshot.body) == null ? void 0 : n.customDecorations;
  11428. }
  11429. getSettings() {
  11430. return this.snapshot.settings;
  11431. }
  11432. // TODO: @JOCS do not use reset, please use apply to modify the snapshot.
  11433. reset(n) {
  11434. if (n.id && n.id !== this._unitId)
  11435. throw new Error("Cannot reset a document model with a different unit id!");
  11436. this.snapshot = { ...tl, ...n }, this._initializeHeaderFooterModel(), this.change$.next(this.change$.value + 1);
  11437. }
  11438. getSelfOrHeaderFooterModel(n) {
  11439. if (n != null) {
  11440. if (this.headerModelMap.has(n))
  11441. return this.headerModelMap.get(n);
  11442. if (this.footerModelMap.has(n))
  11443. return this.footerModelMap.get(n);
  11444. }
  11445. return this;
  11446. }
  11447. getUnitId() {
  11448. return this._unitId;
  11449. }
  11450. apply(n) {
  11451. if (!tn.isNoop(n))
  11452. return this.snapshot = tn.apply(this.snapshot, n), n != null && n.some((r) => Array.isArray(r) && ((r == null ? void 0 : r[0]) === "headers" || (r == null ? void 0 : r[0]) === "footers")) && (this.headerModelMap.clear(), this.footerModelMap.clear(), this._initializeHeaderFooterModel()), this.change$.next(this.change$.value + 1), this.snapshot;
  11453. }
  11454. sliceBody(n, r, s = el.copy) {
  11455. const i = this.getBody();
  11456. if (i != null)
  11457. return Dt(i, n, r, !1, s);
  11458. }
  11459. _initializeHeaderFooterModel() {
  11460. const { headers: n, footers: r } = this.getSnapshot();
  11461. if (n)
  11462. for (const s in n) {
  11463. const i = n[s];
  11464. this.headerModelMap.set(s, new jt(i)), this.headerModelMap.get(s).updateDocumentId(this.getUnitId());
  11465. }
  11466. if (r)
  11467. for (const s in r) {
  11468. const i = r[s];
  11469. this.footerModelMap.set(s, new jt(i)), this.footerModelMap.get(s).updateDocumentId(this.getUnitId());
  11470. }
  11471. }
  11472. updateDocumentId(n) {
  11473. super.updateDocumentId(n), this._unitId = n;
  11474. }
  11475. }
  11476. function i_(t) {
  11477. const { ranges: e, id: n, type: r } = t, s = new Ke();
  11478. let i = 0;
  11479. for (let o = 0; o < e.length; o++) {
  11480. const a = e[o], { startOffset: u, endOffset: c } = a;
  11481. u > 0 && s.push({
  11482. t: ce.RETAIN,
  11483. len: u - i
  11484. }), s.push({
  11485. t: ce.RETAIN,
  11486. body: {
  11487. dataStream: "",
  11488. customDecorations: [{
  11489. id: n,
  11490. type: r,
  11491. startIndex: 0,
  11492. endIndex: c - u - 1
  11493. }]
  11494. },
  11495. len: c - u
  11496. }), i = c;
  11497. }
  11498. return s;
  11499. }
  11500. function o_(t) {
  11501. var l, h, d;
  11502. const { id: e, segmentId: n, documentDataModel: r } = t, s = r == null ? void 0 : r.getBody();
  11503. if (!r || !s)
  11504. return !1;
  11505. const i = (d = (h = (l = r.getSelfOrHeaderFooterModel(n)) == null ? void 0 : l.getBody()) == null ? void 0 : h.customDecorations) == null ? void 0 : d.find((f) => f.id === e);
  11506. if (!i)
  11507. return !1;
  11508. const o = new Ke(), { startIndex: a, endIndex: u } = i, c = u - a + 1;
  11509. return o.push({
  11510. t: ce.RETAIN,
  11511. len: a
  11512. }), o.push({
  11513. t: ce.RETAIN,
  11514. len: c,
  11515. body: {
  11516. dataStream: "",
  11517. customDecorations: [
  11518. {
  11519. startIndex: 0,
  11520. endIndex: c - 1,
  11521. id: e,
  11522. type: An.DELETED
  11523. }
  11524. ]
  11525. }
  11526. }), o;
  11527. }
  11528. function nl(t, e, n, r) {
  11529. return t <= n && e >= n || t >= n && t <= r;
  11530. }
  11531. function a_(t, e) {
  11532. const n = [];
  11533. for (let r = 0, s = e.length; r < s; r++) {
  11534. const i = e[r];
  11535. t.collapsed ? i.startIndex < t.startOffset && t.startOffset <= i.endIndex && n.push(i) : nl(t.startOffset, t.endOffset - 1, i.startIndex, i.endIndex) && n.push(i);
  11536. }
  11537. return n;
  11538. }
  11539. function u_(t) {
  11540. return {
  11541. ...re.deepClone(t),
  11542. rangeId: qt()
  11543. };
  11544. }
  11545. function l_(t, e) {
  11546. const n = [];
  11547. let r = t[0];
  11548. for (const s of e)
  11549. s < t[0] || s > t[1] || (r < s && n.push([r, s - 1]), r = s + 1);
  11550. return r <= t[1] && n.push([r, t[1]]), n;
  11551. }
  11552. function rl(t, e, n, r) {
  11553. const s = [];
  11554. for (let i = 0, o = n.length; i < o; i++) {
  11555. const a = n[i];
  11556. if ((r === void 0 || a.rangeType === r) && Math.max(a.startIndex, t) <= Math.min(a.endIndex, e) && s.push({ ...a }), a.startIndex > e)
  11557. break;
  11558. }
  11559. return s;
  11560. }
  11561. function c_(t, e) {
  11562. var i, o, a, u, c;
  11563. const n = rl(t.startOffset, t.collapsed ? t.startOffset : t.endOffset - 1, (i = e.customRanges) != null ? i : []), r = Math.min(t.startOffset, (a = (o = n[0]) == null ? void 0 : o.startIndex) != null ? a : 1 / 0), s = Math.max(t.endOffset, ((c = (u = n[n.length - 1]) == null ? void 0 : u.endIndex) != null ? c : -1 / 0) + 1);
  11564. return {
  11565. startOffset: r,
  11566. endOffset: s,
  11567. collapsed: r === s
  11568. };
  11569. }
  11570. function h_(t) {
  11571. var h, d, f;
  11572. const { rangeId: e, segmentId: n, documentDataModel: r, insert: s } = t, i = (d = (h = r.getSelfOrHeaderFooterModel(n).getBody()) == null ? void 0 : h.customRanges) == null ? void 0 : d.find((E) => E.rangeId === e);
  11573. if (!i)
  11574. return !1;
  11575. const { startIndex: o, endIndex: a } = i, u = new Ke(), c = a - o + 1;
  11576. u.push({
  11577. t: ce.RETAIN,
  11578. len: o
  11579. }), u.push({
  11580. t: ce.RETAIN,
  11581. len: c,
  11582. body: {
  11583. dataStream: "",
  11584. customRanges: []
  11585. }
  11586. }), s && u.push({
  11587. t: ce.INSERT,
  11588. body: s,
  11589. len: s.dataStream.length
  11590. });
  11591. const l = a + 1 + ((f = s == null ? void 0 : s.dataStream.length) != null ? f : 0);
  11592. return u.selections = [{
  11593. startOffset: l,
  11594. endOffset: l,
  11595. collapsed: !0
  11596. }], u;
  11597. }
  11598. function d_(t) {
  11599. const { ranges: e, rangeId: n, rangeType: r, wholeEntity: s, properties: i, body: o } = t;
  11600. let a = 0;
  11601. const u = new Ke();
  11602. let c = !1;
  11603. return e.forEach((l) => {
  11604. var X, de, T;
  11605. const h = c_(l, o);
  11606. if (!h || !o)
  11607. return !1;
  11608. const { startOffset: d, endOffset: f } = h, E = (X = o.customRanges) != null ? X : [], R = (A, H, Z) => {
  11609. var y, M, b, w;
  11610. const fe = rl(A, H, E, r), ae = Math.min((M = (y = fe[0]) == null ? void 0 : y.startIndex) != null ? M : 1 / 0, A), m = Math.max((w = (b = fe[fe.length - 1]) == null ? void 0 : b.endIndex) != null ? w : -1 / 0, H), j = {
  11611. rangeId: Z ? `${n}$${Z}` : n,
  11612. rangeType: r,
  11613. startIndex: 0,
  11614. endIndex: m - ae,
  11615. wholeEntity: s,
  11616. properties: {
  11617. ...i
  11618. }
  11619. };
  11620. u.push({
  11621. t: ce.RETAIN,
  11622. len: ae - a
  11623. }), u.push({
  11624. t: ce.RETAIN,
  11625. len: m - ae + 1,
  11626. body: {
  11627. dataStream: "",
  11628. customRanges: [j]
  11629. },
  11630. coverType: Pe.COVER
  11631. }), a = m + 1;
  11632. }, O = ((de = o.paragraphs) != null ? de : []).filter((A) => A.startIndex < f && A.startIndex > d), U = ((T = o.customBlocks) != null ? T : []).filter((A) => A.startIndex < f && A.startIndex > d);
  11633. l_([d, f - 1], [...O.map((A) => A.startIndex), ...U.map((A) => A.startIndex)]).forEach(([A, H], Z) => R(A, H, Z)), c = !0, u.selections = [{
  11634. startOffset: h.endOffset,
  11635. endOffset: h.endOffset,
  11636. collapsed: !0
  11637. }];
  11638. }), c ? u : !1;
  11639. }
  11640. function sl(t, e, n = 0, r = null, s = !0) {
  11641. t.sort((c, l) => c.startOffset - l.startOffset);
  11642. const i = [], { paragraphs: o = [] } = e, a = o == null ? void 0 : o.find(
  11643. (c) => c.startIndex >= t[0].startOffset && c.startIndex < t[0].endOffset
  11644. );
  11645. let u = n;
  11646. if (t.forEach((c) => {
  11647. const { startOffset: l, endOffset: h } = c;
  11648. l > u && (i.push({
  11649. t: ce.RETAIN,
  11650. len: l - u
  11651. }), u = l), u < h && (i.push({
  11652. t: ce.DELETE,
  11653. len: h - u
  11654. }), u = h);
  11655. }), r && i.push({
  11656. t: ce.INSERT,
  11657. body: r,
  11658. len: r.dataStream.length
  11659. }), a && s) {
  11660. const c = o.find((l) => l.startIndex - n >= t[t.length - 1].endOffset - 1);
  11661. c && (c.startIndex > u && (i.push({
  11662. t: ce.RETAIN,
  11663. len: c.startIndex - u
  11664. }), u = c.startIndex), i.push({
  11665. t: ce.RETAIN,
  11666. len: 1,
  11667. body: {
  11668. dataStream: "",
  11669. paragraphs: [
  11670. {
  11671. ...c,
  11672. startIndex: 0,
  11673. bullet: a == null ? void 0 : a.bullet
  11674. }
  11675. ]
  11676. },
  11677. coverType: Pe.REPLACE
  11678. }));
  11679. }
  11680. return i;
  11681. }
  11682. function f_(t, e, n = 0) {
  11683. const r = [];
  11684. let s = n;
  11685. return t.forEach((i) => {
  11686. const { startOffset: o, endOffset: a } = i;
  11687. o > s && (r.push({
  11688. t: ce.RETAIN,
  11689. len: o - s
  11690. }), s = o), a > s && (r.push({
  11691. t: ce.RETAIN,
  11692. len: a - s,
  11693. body: {
  11694. ...re.deepClone(e),
  11695. dataStream: ""
  11696. }
  11697. }), s = a);
  11698. }), r;
  11699. }
  11700. const g_ = (t) => {
  11701. var h;
  11702. const { selection: e, body: n, doc: r } = t, s = e.segmentId, i = (h = r.getSelfOrHeaderFooterModel(s)) == null ? void 0 : h.getBody();
  11703. if (!i) return !1;
  11704. const o = e.collapsed ? null : Dt(i, e.startOffset, e.endOffset), a = ru(o ? o.dataStream : "", n.dataStream);
  11705. let u = 0;
  11706. const c = a.map(([d, f]) => {
  11707. switch (d) {
  11708. // retain
  11709. case 0: {
  11710. const E = {
  11711. t: ce.RETAIN,
  11712. body: {
  11713. ...Dt(n, u, u + f.length, !1),
  11714. dataStream: ""
  11715. },
  11716. len: f.length
  11717. };
  11718. return u += f.length, E;
  11719. }
  11720. // insert
  11721. case 1: {
  11722. const E = {
  11723. t: ce.INSERT,
  11724. body: Dt(n, u, u + f.length),
  11725. len: f.length
  11726. };
  11727. return u += f.length, E;
  11728. }
  11729. // delete
  11730. default:
  11731. return {
  11732. t: ce.DELETE,
  11733. len: f.length
  11734. };
  11735. }
  11736. }), l = new Ke();
  11737. return l.push({
  11738. t: ce.RETAIN,
  11739. len: e.startOffset
  11740. }), l.push(...c), l;
  11741. };
  11742. function p_(t, e) {
  11743. return !!((t == null ? void 0 : t.length) === (e == null ? void 0 : e.length) && (t != null && t.every((n, r) => JSON.stringify(n) === JSON.stringify(e == null ? void 0 : e[r]))));
  11744. }
  11745. const m_ = (t) => {
  11746. var h;
  11747. const { selection: e, body: n, doc: r } = t, s = e.segmentId, i = (h = r.getSelfOrHeaderFooterModel(s)) == null ? void 0 : h.getBody();
  11748. if (!i) return !1;
  11749. const o = e.collapsed ? null : Dt(i, e.startOffset, e.endOffset), a = ru(o ? o.dataStream : "", n.dataStream);
  11750. let u = 0;
  11751. const c = a.map(([d, f]) => {
  11752. switch (d) {
  11753. // retain
  11754. case 0: {
  11755. const E = ei(n, u, u + f.length, !1), R = ei(o, u, u + f.length, !1), O = {
  11756. t: ce.RETAIN,
  11757. body: p_(E, R) ? void 0 : {
  11758. textRuns: E,
  11759. dataStream: ""
  11760. },
  11761. len: f.length
  11762. };
  11763. return u += f.length, O;
  11764. }
  11765. // insert
  11766. case 1: {
  11767. const E = {
  11768. t: ce.INSERT,
  11769. body: Dt(n, u, u + f.length),
  11770. len: f.length
  11771. };
  11772. return u += f.length, E;
  11773. }
  11774. // delete
  11775. default:
  11776. return {
  11777. t: ce.DELETE,
  11778. len: f.length
  11779. };
  11780. }
  11781. });
  11782. if (c.every((d) => d.t === ce.RETAIN && !d.body))
  11783. return !1;
  11784. const l = new Ke();
  11785. return l.push({
  11786. t: ce.RETAIN,
  11787. len: e.startOffset
  11788. }), l.push(...c), l;
  11789. };
  11790. function __(t, e) {
  11791. const n = [], { customBlocks: r = [] } = t;
  11792. for (const s of e) {
  11793. const { startOffset: i, endOffset: o } = s;
  11794. if (!(i == null || o == null))
  11795. for (const a of r) {
  11796. const { startIndex: u } = a;
  11797. u >= i && u < o && n.push(a.blockId);
  11798. }
  11799. }
  11800. return n;
  11801. }
  11802. function E_(t, e = "") {
  11803. if (!e)
  11804. return ["body"];
  11805. const { headers: n, footers: r } = t.getSnapshot();
  11806. if (n == null && r == null)
  11807. throw new Error("Document data model must have headers or footers when update by segment id");
  11808. if ((n == null ? void 0 : n[e]) != null)
  11809. return ["headers", e, "body"];
  11810. if ((r == null ? void 0 : r[e]) != null)
  11811. return ["footers", e, "body"];
  11812. throw new Error("Segment id not found in headers or footers");
  11813. }
  11814. const C_ = (t) => {
  11815. var R, O, U, ne;
  11816. const { selection: e, documentDataModel: n, drawings: r } = t, { collapsed: s, startOffset: i, segmentId: o } = e, a = new Ke(), u = tn.getInstance(), c = [], l = n.getSelfOrHeaderFooterModel(o).getBody();
  11817. if (!l)
  11818. return !1;
  11819. const h = (O = (R = n.getSnapshot().drawingsOrder) == null ? void 0 : R.length) != null ? O : 0;
  11820. let d = 0;
  11821. if (s)
  11822. i > 0 && a.push({
  11823. t: ce.RETAIN,
  11824. len: i
  11825. });
  11826. else {
  11827. const X = sl([e], l, 0, null, !1);
  11828. a.push(...X);
  11829. const de = __(l, [e]), T = (U = n.getDrawings()) != null ? U : {}, A = (ne = n.getDrawingsOrder()) != null ? ne : [], H = de.sort((Z, fe) => A.indexOf(Z) > A.indexOf(fe) ? -1 : A.indexOf(Z) < A.indexOf(fe) ? 1 : 0);
  11830. if (H.length > 0)
  11831. for (const Z of H) {
  11832. const fe = T[Z], ae = A.indexOf(Z);
  11833. if (fe == null || ae < 0)
  11834. continue;
  11835. const m = u.removeOp(["drawings", Z], fe), j = u.removeOp(["drawingsOrder", ae], Z);
  11836. c.push(m), c.push(j), d++;
  11837. }
  11838. }
  11839. a.push({
  11840. t: ce.INSERT,
  11841. body: {
  11842. dataStream: "\b".repeat(r.length),
  11843. customBlocks: r.map((X, de) => ({
  11844. startIndex: de,
  11845. blockId: X.drawingId
  11846. }))
  11847. },
  11848. len: r.length
  11849. });
  11850. const f = E_(n, o), E = u.editOp(a.serialize(), f);
  11851. c.push(E);
  11852. for (const X of r) {
  11853. const { drawingId: de } = X, T = u.insertOp(["drawings", de], X), A = u.insertOp(["drawingsOrder", h - d], de);
  11854. c.push(T), c.push(A);
  11855. }
  11856. return c.reduce((X, de) => tn.compose(X, de), null);
  11857. }, R_ = (t) => {
  11858. var h, d, f;
  11859. const { paragraphs: e, segmentId: n, document: r } = t;
  11860. let s = t.listType;
  11861. const i = (d = (h = r.getSelfOrHeaderFooterModel(n).getBody()) == null ? void 0 : h.paragraphs) != null ? d : [], o = e.every((E) => {
  11862. var R;
  11863. return ((R = E.bullet) == null ? void 0 : R.listType.indexOf(s)) === 0;
  11864. });
  11865. let u = re.generateRandomId(6);
  11866. if (e.length === 1) {
  11867. const E = i.indexOf(e[0]), R = i[E - 1], O = i[E + 1];
  11868. R && R.bullet && R.bullet.listType.indexOf(s) === 0 ? (u = R.bullet.listId, s !== Ft.CHECK_LIST && (s = R.bullet.listType)) : O && O.bullet && O.bullet.listType.indexOf(s) === 0 && (u = O.bullet.listId, s !== Ft.CHECK_LIST && (s = O.bullet.listType));
  11869. }
  11870. const c = new lr();
  11871. c.reset();
  11872. const l = new Ke();
  11873. for (const E of e) {
  11874. const { startIndex: R, paragraphStyle: O = {}, bullet: U } = E;
  11875. l.push({
  11876. t: ce.RETAIN,
  11877. len: R - c.cursor
  11878. }), l.push({
  11879. t: ce.RETAIN,
  11880. len: 1,
  11881. body: {
  11882. dataStream: "",
  11883. paragraphs: [
  11884. o ? {
  11885. paragraphStyle: O,
  11886. startIndex: 0
  11887. } : {
  11888. startIndex: 0,
  11889. paragraphStyle: {
  11890. ...O
  11891. },
  11892. bullet: {
  11893. nestingLevel: (f = U == null ? void 0 : U.nestingLevel) != null ? f : 0,
  11894. textStyle: {
  11895. fs: 20
  11896. },
  11897. listType: s,
  11898. listId: u
  11899. }
  11900. }
  11901. ]
  11902. },
  11903. coverType: Pe.REPLACE
  11904. }), c.moveCursorTo(R + 1);
  11905. }
  11906. return l;
  11907. }, I_ = (t) => {
  11908. var h;
  11909. const { paragraphIndex: e, segmentId: n, document: r } = t, s = (h = r.getSelfOrHeaderFooterModel(n).getBody()) == null ? void 0 : h.paragraphs;
  11910. if (s == null)
  11911. return !1;
  11912. const i = s.find((d) => d.startIndex === e);
  11913. if (!(i != null && i.bullet) || i.bullet.listType.indexOf(Ft.CHECK_LIST) === -1)
  11914. return !1;
  11915. const o = new lr();
  11916. o.reset();
  11917. const a = new Ke(), { startIndex: u, paragraphStyle: c = {} } = i, l = i.bullet.listType === Ft.CHECK_LIST ? Ft.CHECK_LIST_CHECKED : Ft.CHECK_LIST;
  11918. return a.push({
  11919. t: ce.RETAIN,
  11920. len: u - o.cursor
  11921. }), a.push({
  11922. t: ce.RETAIN,
  11923. len: 1,
  11924. body: {
  11925. dataStream: "",
  11926. paragraphs: [
  11927. {
  11928. ...i,
  11929. paragraphStyle: c,
  11930. startIndex: 0,
  11931. bullet: {
  11932. ...i.bullet,
  11933. listType: l
  11934. }
  11935. }
  11936. ]
  11937. },
  11938. coverType: Pe.REPLACE
  11939. }), o.moveCursorTo(u + 1), a;
  11940. }, v_ = (t) => {
  11941. var l, h;
  11942. const { paragraphs: e, listType: n, segmentId: r, document: s } = t;
  11943. if (((l = s.getSelfOrHeaderFooterModel(r).getBody()) == null ? void 0 : l.paragraphs) == null)
  11944. return !1;
  11945. const a = re.generateRandomId(6), u = new lr();
  11946. u.reset();
  11947. const c = new Ke();
  11948. for (const d of e) {
  11949. const { startIndex: f, paragraphStyle: E = {}, bullet: R } = d;
  11950. c.push({
  11951. t: ce.RETAIN,
  11952. len: f - u.cursor
  11953. }), c.push({
  11954. t: ce.RETAIN,
  11955. len: 1,
  11956. body: {
  11957. dataStream: "",
  11958. paragraphs: [
  11959. {
  11960. startIndex: 0,
  11961. paragraphStyle: E,
  11962. bullet: {
  11963. nestingLevel: (h = R == null ? void 0 : R.nestingLevel) != null ? h : 0,
  11964. textStyle: (R == null ? void 0 : R.listType) === n ? R.textStyle : {
  11965. fs: 20
  11966. },
  11967. listType: n,
  11968. listId: a
  11969. }
  11970. }
  11971. ]
  11972. },
  11973. coverType: Pe.REPLACE
  11974. }), u.moveCursorTo(f + 1);
  11975. }
  11976. return c;
  11977. };
  11978. function y_(t, e) {
  11979. return e.some((n) => t.startIndex > n.startIndex && t.startIndex < n.endIndex);
  11980. }
  11981. const w_ = (t) => {
  11982. var l, h, d;
  11983. const { paragraphs: e, segmentId: n, document: r, type: s } = t, i = new lr();
  11984. i.reset();
  11985. const o = new Ke(), a = (l = r.getSnapshot().lists) != null ? l : {}, u = (d = (h = r.getBody()) == null ? void 0 : h.tables) != null ? d : [], c = {
  11986. ...Es,
  11987. ...a
  11988. };
  11989. for (const f of e) {
  11990. const { startIndex: E, paragraphStyle: R = {}, bullet: O } = f, U = y_(f, u);
  11991. if (o.push({
  11992. t: ce.RETAIN,
  11993. len: E - i.cursor
  11994. }), O) {
  11995. const ne = O.listType;
  11996. let X = c[ne].nestingLevel.length - 1;
  11997. U && (X = Math.min(X, 2)), o.push({
  11998. t: ce.RETAIN,
  11999. len: 1,
  12000. body: {
  12001. dataStream: "",
  12002. paragraphs: [
  12003. {
  12004. startIndex: 0,
  12005. paragraphStyle: {
  12006. ...R
  12007. },
  12008. bullet: {
  12009. ...O,
  12010. nestingLevel: Math.max(Math.min(O.nestingLevel + s, X), 0)
  12011. }
  12012. }
  12013. ]
  12014. },
  12015. coverType: Pe.REPLACE
  12016. });
  12017. } else
  12018. o.push({
  12019. t: ce.RETAIN,
  12020. len: 1
  12021. });
  12022. i.moveCursorTo(E + 1);
  12023. }
  12024. return o;
  12025. };
  12026. var O_ = /* @__PURE__ */ ((t) => (t.PARAGRAPH = "PARAGRAPH", t.SECTION_BREAK = "SECTION_BREAK", t.TABLE = "TABLE", t.TABLE_ROW = "TABLE_ROW", t.TABLE_CELL = "TABLE_CELL", t.CUSTOM_BLOCK = "CUSTOM_BLOCK", t))(O_ || {}), ln = /* @__PURE__ */ ((t) => (t.PARAGRAPH = "\r", t.SECTION_BREAK = `
  12027. `, t.TABLE_START = "", t.TABLE_ROW_START = "\x1B", t.TABLE_CELL_START = "", t.TABLE_CELL_END = "", t.TABLE_ROW_END = "", t.TABLE_END = "", t.CUSTOM_RANGE_START = "", t.CUSTOM_RANGE_END = "", t.COLUMN_BREAK = "\v", t.PAGE_BREAK = "\f", t.DOCS_END = "\0", t.TAB = " ", t.CUSTOM_BLOCK = "\b", t.LETTER = "", t.SPACE = " ", t))(ln || {});
  12028. function eR(t) {
  12029. return `${t}`;
  12030. }
  12031. const b_ = [
  12032. // DataStreamTreeTokenType.PARAGRAPH, // 段落
  12033. // DataStreamTreeTokenType.SECTION_BREAK, // 章节
  12034. ln.TABLE_START,
  12035. // 表格开始
  12036. ln.TABLE_ROW_START,
  12037. // 表格开始
  12038. ln.TABLE_CELL_START,
  12039. // 表格开始
  12040. ln.TABLE_CELL_END,
  12041. // 表格开始
  12042. ln.TABLE_ROW_END,
  12043. // 表格开始
  12044. ln.TABLE_END
  12045. // 表格结束
  12046. // DataStreamTreeTokenType.COLUMN_BREAK, // 换列
  12047. // DataStreamTreeTokenType.PAGE_BREAK, // 换页
  12048. // DataStreamTreeTokenType.DOCS_END, // 文档结尾
  12049. // DataStreamTreeTokenType.TAB, // 制表符
  12050. // DataStreamTreeTokenType.CUSTOM_BLOCK, // 图片 mention 等不参与文档流的场景
  12051. ], il = (t) => {
  12052. const e = t.endsWith(`\r
  12053. `) ? t.slice(0, -2) : t;
  12054. return b_.reduce((n, r) => n.replaceAll(r, ""), e);
  12055. }, S_ = (t) => t ? il(t).replaceAll("\r", "") === "" : !0, A_ = (t) => {
  12056. const e = t.replace(/\n/g, "\r"), n = [], r = [];
  12057. let s = 0, i = "";
  12058. const o = (u, c = !0) => {
  12059. const l = e.slice(s, u);
  12060. if (re.isLegalUrl(l)) {
  12061. const h = qt(), d = `${l}`, f = {
  12062. startIndex: s,
  12063. endIndex: s + d.length - 1,
  12064. rangeId: h,
  12065. rangeType: mn.HYPERLINK,
  12066. properties: {
  12067. url: t
  12068. }
  12069. };
  12070. r.push(f), i += d, s = u + 1, c && (i += "\r", n.push({ startIndex: u }));
  12071. } else
  12072. i += e.slice(s, u + 1), s = u + 1, c && n.push({ startIndex: u });
  12073. };
  12074. let a = 0;
  12075. for (let u = 0; u < e.length; u++)
  12076. e[u] === "\r" && (o(u), a = u);
  12077. return (a !== e.length - 1 || e.length === 1) && o(e.length, !1), {
  12078. dataStream: i,
  12079. paragraphs: n,
  12080. customRanges: r
  12081. };
  12082. };
  12083. function N_(t, e) {
  12084. if (typeof e > "u")
  12085. return { startOffset: t, endOffset: t, collapsed: !0 };
  12086. if (e < t)
  12087. throw new Error(`Cannot make a doc selection when endOffset ${e} is less than startOffset ${t}.`);
  12088. return { startOffset: t, endOffset: e, collapsed: t === e };
  12089. }
  12090. function T_(t) {
  12091. const { startOffset: e, endOffset: n, collapsed: r } = t, s = Math.min(e, n), i = Math.max(e, n);
  12092. return {
  12093. startOffset: s,
  12094. endOffset: i,
  12095. collapsed: r
  12096. };
  12097. }
  12098. function M_(t, e, n, r) {
  12099. return Math.max(t, n) <= Math.min(e, r);
  12100. }
  12101. class st {
  12102. }
  12103. C(st, "customRange", {
  12104. add: d_,
  12105. delete: h_,
  12106. copyCustomRange: u_,
  12107. getCustomRangesInterestsWithSelection: a_,
  12108. isIntersecting: nl
  12109. }), C(st, "customDecoration", {
  12110. add: i_,
  12111. delete: o_
  12112. }), C(st, "selection", {
  12113. replace: g_,
  12114. makeSelection: N_,
  12115. normalizeSelection: T_,
  12116. delete: sl,
  12117. replaceTextRuns: m_,
  12118. retain: f_
  12119. }), C(st, "range", {
  12120. isIntersects: M_
  12121. }), C(st, "transform", {
  12122. getPlainText: il,
  12123. fromPlainText: A_,
  12124. isEmptyDocument: S_
  12125. }), C(st, "paragraph", {
  12126. bullet: {
  12127. set: v_,
  12128. switch: R_,
  12129. toggleChecklist: I_,
  12130. changeNestLevel: w_
  12131. }
  12132. }), C(st, "drawing", {
  12133. add: C_
  12134. });
  12135. function D_(t) {
  12136. if (t.customRanges || (t.customRanges = []), !t.paragraphs) {
  12137. t.paragraphs = [];
  12138. for (let e = 0; e < t.dataStream.length; e++)
  12139. t.dataStream[e] === "\r" && t.paragraphs.push({ startIndex: e });
  12140. }
  12141. return t.customBlocks || (t.customBlocks = []), t.textRuns || (t.textRuns = []), t.customDecorations || (t.customDecorations = []), t.sectionBreaks || (t.sectionBreaks = []), t.tables || (t.tables = []), t;
  12142. }
  12143. function ol(t) {
  12144. var e;
  12145. return t.body = D_((e = t.body) != null ? e : { dataStream: "" }), t.drawingsOrder || (t.drawingsOrder = []), t.drawings || (t.drawings = {}), t.documentStyle || (t.documentStyle = {}), t;
  12146. }
  12147. class cr {
  12148. /**
  12149. * Creates a new TextStyleValue instance
  12150. * @param {ITextStyle} style The initial style object
  12151. * @example
  12152. * ```ts
  12153. * const style = TextStyleValue.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
  12154. * console.log(style);
  12155. * ```
  12156. */
  12157. constructor(e = {}) {
  12158. C(this, "_style");
  12159. this._style = e;
  12160. }
  12161. /**
  12162. * Creates an instance of TextStyleValue.
  12163. * @param {ITextStyle} style style object
  12164. * @returns {TextStyleValue} font style instance
  12165. * @example
  12166. * ```ts
  12167. * const style = TextStyleValue.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
  12168. * console.log(style);
  12169. * ```
  12170. */
  12171. static create(e = {}) {
  12172. return new cr(e);
  12173. }
  12174. /**
  12175. * Gets the font family
  12176. * @returns {Nullable<string>} The font family name or undefined
  12177. * @example
  12178. * ```ts
  12179. * const style = TextStyleValue.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
  12180. * console.log(style.fontFamily);
  12181. * ```
  12182. */
  12183. get fontFamily() {
  12184. return this._style.ff;
  12185. }
  12186. /**
  12187. * Gets the font size in points
  12188. * @returns {number | undefined} The font size or undefined
  12189. * @example
  12190. * ```ts
  12191. * const style = TextStyleValue.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
  12192. * console.log(style.fontSize);
  12193. * ```
  12194. */
  12195. get fontSize() {
  12196. return this._style.fs;
  12197. }
  12198. /**
  12199. * Gets whether the text is italic
  12200. * @returns {boolean} True if italic, false otherwise
  12201. * @example
  12202. * ```ts
  12203. * const style = TextStyleValue.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
  12204. * console.log(style.italic);
  12205. * ```
  12206. */
  12207. get italic() {
  12208. return this._style.it === we.TRUE;
  12209. }
  12210. /**
  12211. * Gets whether the text is bold
  12212. * @returns {boolean} True if bold, false otherwise
  12213. * @example
  12214. * ```ts
  12215. * const style = TextStyleValue.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
  12216. * console.log(style.bold);
  12217. * ```
  12218. */
  12219. get bold() {
  12220. return this._style.bl === we.TRUE;
  12221. }
  12222. /**
  12223. * Gets the underline decoration
  12224. * @returns {TextDecorationBuilder | undefined} The underline decoration or undefined
  12225. * @example
  12226. * ```ts
  12227. * const style = TextStyleValue.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
  12228. * console.log(style.underline);
  12229. * ```
  12230. */
  12231. get underline() {
  12232. return this._style.ul && Jt.create(this._style.ul);
  12233. }
  12234. /**
  12235. * Gets the bottom border line decoration
  12236. * @returns {TextDecorationBuilder | undefined} The bottom border line decoration or undefined
  12237. * @example
  12238. * ```ts
  12239. * const style = TextStyleValue.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
  12240. * console.log(style.bottomBorderLine);
  12241. * ```
  12242. */
  12243. get bottomBorderLine() {
  12244. return this._style.bbl && Jt.create(this._style.bbl);
  12245. }
  12246. /**
  12247. * Gets the strikethrough decoration
  12248. * @returns {TextDecorationBuilder | undefined} The strikethrough decoration or undefined
  12249. * @example
  12250. * ```ts
  12251. * const style = TextStyleValue.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
  12252. * console.log(style.strikethrough);
  12253. * ```
  12254. */
  12255. get strikethrough() {
  12256. return this._style.st && Jt.create(this._style.st);
  12257. }
  12258. /**
  12259. * Gets the overline decoration
  12260. * @returns {TextDecorationBuilder | undefined} The overline decoration or undefined
  12261. * @example
  12262. * ```ts
  12263. * const style = TextStyleValue.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
  12264. * console.log(style.overline);
  12265. * ```
  12266. */
  12267. get overline() {
  12268. return this._style.ol && Jt.create(this._style.ol);
  12269. }
  12270. /**
  12271. * Gets the background color
  12272. * @returns {Nullable<IColorStyle>} The background color or null/undefined
  12273. * @example
  12274. * ```ts
  12275. * const style = TextStyleValue.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
  12276. * console.log(style.background);
  12277. * ```
  12278. */
  12279. get background() {
  12280. return this._style.bg;
  12281. }
  12282. /**
  12283. * Gets the border settings
  12284. * @returns {Nullable<IBorderData>} The border settings or null/undefined
  12285. * @example
  12286. * ```ts
  12287. * const style = TextStyleValue.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
  12288. * console.log(style.border);
  12289. * ```
  12290. */
  12291. get border() {
  12292. return this._style.bd;
  12293. }
  12294. /**
  12295. * Gets the text color
  12296. * @returns {Nullable<IColorStyle>} The text color or null/undefined
  12297. * @example
  12298. * ```ts
  12299. * const style = TextStyleValue.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
  12300. * console.log(style.color);
  12301. * ```
  12302. */
  12303. get color() {
  12304. return this._style.cl;
  12305. }
  12306. /**
  12307. * Gets the vertical alignment (subscript/superscript)
  12308. * @returns {Nullable<BaselineOffset>} The vertical alignment or null/undefined
  12309. * @example
  12310. * ```ts
  12311. * const style = TextStyleValue.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
  12312. * console.log(style.verticalAlign);
  12313. * ```
  12314. */
  12315. get verticalAlign() {
  12316. return this._style.va;
  12317. }
  12318. /**
  12319. * Gets the number format pattern
  12320. * @returns {Nullable<{ pattern: string }>} The number format pattern or null/undefined
  12321. * @example
  12322. * ```ts
  12323. * const style = TextStyleValue.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
  12324. * console.log(style.numberFormat);
  12325. * ```
  12326. */
  12327. get numberFormat() {
  12328. return this._style.n;
  12329. }
  12330. /**
  12331. * Creates a copy of this font style as a builder
  12332. * @returns {TextStyleBuilder} A new TextStyleBuilder instance with the same style
  12333. * @example
  12334. * ```ts
  12335. * const style = TextStyleValue.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
  12336. * const copy = style.copy();
  12337. * console.log(copy);
  12338. * ```
  12339. */
  12340. copy() {
  12341. return Qt.create(re.deepClone(this._style));
  12342. }
  12343. /**
  12344. * Gets the raw style object
  12345. * @returns {ITextStyle} The underlying style object
  12346. * @example
  12347. * ```ts
  12348. * const style = TextStyleValue.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
  12349. * console.log(style.getValue());
  12350. * ```
  12351. */
  12352. getValue() {
  12353. return { ...this._style };
  12354. }
  12355. }
  12356. class Qt extends cr {
  12357. /**
  12358. * Creates a new TextStyleBuilder instance
  12359. * @param {ITextStyle} style Initial style object
  12360. * @returns {TextStyleBuilder} A new TextStyleBuilder instance
  12361. * @example
  12362. * ```ts
  12363. * const style = TextStyleBuilder.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
  12364. * console.log(style);
  12365. * ```
  12366. */
  12367. static create(e = {}) {
  12368. return new Qt(e);
  12369. }
  12370. /**
  12371. * Creates a new TextStyleBuilder instance
  12372. * @param {ITextStyle} style The initial style object
  12373. * @example
  12374. * ```ts
  12375. * const style = new TextStyleBuilder({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
  12376. * console.log(style);
  12377. * ```
  12378. */
  12379. constructor(e = {}) {
  12380. super(e);
  12381. }
  12382. /**
  12383. * Sets the font family
  12384. * @param {string} family The font family name
  12385. * @returns {TextStyleBuilder} The builder instance for chaining
  12386. * @example
  12387. * ```ts
  12388. * const style = TextStyleBuilder.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
  12389. * style.setFontFamily('Times New Roman');
  12390. * console.log(style.fontFamily);
  12391. * ```
  12392. */
  12393. setFontFamily(e) {
  12394. return this._style.ff = e, this;
  12395. }
  12396. /**
  12397. * Sets the font size in points
  12398. * @param {number} size The font size
  12399. * @returns {TextStyleBuilder} The builder instance for chaining
  12400. * @example
  12401. * ```ts
  12402. * const style = TextStyleBuilder.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
  12403. * style.setFontSize(14);
  12404. * console.log(style.fontSize);
  12405. * ```
  12406. */
  12407. setFontSize(e) {
  12408. return this._style.fs = e, this;
  12409. }
  12410. /**
  12411. * Sets the italic style
  12412. * @param {boolean} value True to make italic, false otherwise
  12413. * @returns {TextStyleBuilder} The builder instance for chaining
  12414. * @example
  12415. * ```ts
  12416. * const style = TextStyleBuilder.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
  12417. * style.setItalic(true);
  12418. * console.log(style.italic);
  12419. * ```
  12420. */
  12421. setItalic(e) {
  12422. return this._style.it = e ? 1 : 0, this;
  12423. }
  12424. /**
  12425. * Sets the bold style
  12426. * @param {boolean} value True to make bold, false otherwise
  12427. * @returns {TextStyleBuilder} The builder instance for chaining
  12428. * @example
  12429. * ```ts
  12430. * const style = TextStyleBuilder.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
  12431. * style.setBold(true);
  12432. * console.log(style.bold);
  12433. * ```
  12434. */
  12435. setBold(e) {
  12436. return this._style.bl = e ? 1 : 0, this;
  12437. }
  12438. /**
  12439. * Sets the underline decoration
  12440. * @param {TextDecorationBuilder} decoration The underline decoration settings
  12441. * @returns {TextStyleBuilder} The builder instance for chaining
  12442. * @example
  12443. * ```ts
  12444. * const style = TextStyleBuilder.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
  12445. * style.setUnderline({ type: 'single', color: '#FF0000' });
  12446. * console.log(style.underline);
  12447. * ```
  12448. */
  12449. setUnderline(e) {
  12450. return this._style.ul = e.build(), this;
  12451. }
  12452. /**
  12453. * Sets the bottom border line decoration
  12454. * @param {TextDecorationBuilder} decoration The bottom border line decoration settings
  12455. * @returns {TextStyleBuilder} The builder instance for chaining
  12456. * @example
  12457. * ```ts
  12458. * const style = TextStyleBuilder.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
  12459. * style.setBottomBorderLine({ type: 'single', color: '#FF0000' });
  12460. * console.log(style.bottomBorderLine);
  12461. * ```
  12462. */
  12463. setBottomBorderLine(e) {
  12464. return this._style.bbl = e.build(), this;
  12465. }
  12466. /**
  12467. * Sets the strikethrough decoration
  12468. * @param {TextDecorationBuilder} decoration The strikethrough decoration settings
  12469. * @returns {TextStyleBuilder} The builder instance for chaining
  12470. */
  12471. setStrikethrough(e) {
  12472. return this._style.st = e.build(), this;
  12473. }
  12474. /**
  12475. * Sets the overline decoration
  12476. * @param {TextDecorationBuilder} decoration The overline decoration settings
  12477. * @returns {TextStyleBuilder} The builder instance for chaining
  12478. */
  12479. setOverline(e) {
  12480. return this._style.ol = e.build(), this;
  12481. }
  12482. /**
  12483. * Sets the background color
  12484. * @param {IColorStyle | null} color The background color or null to remove
  12485. * @returns {TextStyleBuilder} The builder instance for chaining
  12486. */
  12487. setBackground(e) {
  12488. return this._style.bg = e, this;
  12489. }
  12490. /**
  12491. * Sets the border settings
  12492. * @param {IBorderData | null} border The border settings or null to remove
  12493. * @returns {TextStyleBuilder} The builder instance for chaining
  12494. */
  12495. setBorder(e) {
  12496. return this._style.bd = e, this;
  12497. }
  12498. /**
  12499. * Sets the text color
  12500. * @param {IColorStyle | null} color The text color or null to remove
  12501. * @returns {TextStyleBuilder} The builder instance for chaining
  12502. */
  12503. setColor(e) {
  12504. return this._style.cl = e, this;
  12505. }
  12506. /**
  12507. * Sets the vertical alignment (subscript/superscript)
  12508. * @param {BaselineOffset | null} offset The vertical alignment or null to remove
  12509. * @returns {TextStyleBuilder} The builder instance for chaining
  12510. */
  12511. setVerticalAlign(e) {
  12512. return this._style.va = e, this;
  12513. }
  12514. /**
  12515. * Creates a copy of this font style builder
  12516. * @returns {TextStyleBuilder} A new TextStyleBuilder instance with the same style
  12517. */
  12518. copy() {
  12519. return Qt.create(re.deepClone(this._style));
  12520. }
  12521. /**
  12522. * Builds and returns the final style object
  12523. * @returns {ITextStyle} The complete style object
  12524. */
  12525. build() {
  12526. return this.getValue();
  12527. }
  12528. }
  12529. class Jt {
  12530. /**
  12531. * Creates a new TextDecorationBuilder instance
  12532. * @param {ITextDecoration} decoration The initial decoration object
  12533. * @example
  12534. * ```ts
  12535. * const decoration = new TextDecorationBuilder({ s: 1, t: TextDecoration.SINGLE });
  12536. * ```
  12537. */
  12538. constructor(e = { s: 1 }) {
  12539. C(this, "_decoration");
  12540. this._decoration = e;
  12541. }
  12542. /**
  12543. * Creates an instance of TextDecorationBuilder.
  12544. * @param {ITextDecoration} decoration Initial decoration object
  12545. * @returns {TextDecorationBuilder} text decoration builder instance
  12546. * @example
  12547. * ```ts
  12548. * const decoration = TextDecorationBuilder.create({ s: 1, t: TextDecoration.SINGLE });
  12549. * console.log(decoration);
  12550. * ```
  12551. */
  12552. static create(e = { s: 1 }) {
  12553. return new Jt(e);
  12554. }
  12555. /**
  12556. * Gets whether the decoration is shown
  12557. * @returns {boolean} True if the decoration is shown
  12558. */
  12559. get show() {
  12560. return this._decoration.s === we.TRUE;
  12561. }
  12562. /**
  12563. * Gets whether the decoration color follows the font color
  12564. * @returns {boolean} True if the decoration color follows the font color
  12565. */
  12566. get followFontColor() {
  12567. return this._decoration.c === we.TRUE;
  12568. }
  12569. /**
  12570. * Gets the decoration color
  12571. * @returns {Nullable<IColorStyle>} The decoration color
  12572. */
  12573. get color() {
  12574. return this._decoration.cl;
  12575. }
  12576. /**
  12577. * Gets the decoration line type
  12578. * @returns {Nullable<TextDecoration>} The decoration line type
  12579. */
  12580. get type() {
  12581. return this._decoration.t;
  12582. }
  12583. /**
  12584. * Sets whether the decoration is shown
  12585. * @param {boolean} value True to show the decoration
  12586. * @returns {TextDecorationBuilder} The builder instance for chaining
  12587. * @example
  12588. * ```ts
  12589. * decoration.setShow(true);
  12590. * ```
  12591. */
  12592. setShow(e) {
  12593. return this._decoration.s = e ? 1 : 0, this;
  12594. }
  12595. /**
  12596. * Sets whether the decoration color follows the font color
  12597. * @param {boolean} value True to follow font color
  12598. * @returns {TextDecorationBuilder} The builder instance for chaining
  12599. * @example
  12600. * ```ts
  12601. * decoration.setFollowFontColor(false);
  12602. * ```
  12603. */
  12604. setFollowFontColor(e) {
  12605. return this._decoration.c = e ? 1 : 0, this;
  12606. }
  12607. /**
  12608. * Sets the decoration color
  12609. * @param {IColorStyle} color The color style
  12610. * @returns {TextDecorationBuilder} The builder instance for chaining
  12611. * @example
  12612. * ```ts
  12613. * decoration.setColor({ rgb: '#FF0000' });
  12614. * ```
  12615. */
  12616. setColor(e) {
  12617. return this._decoration.cl = e, this;
  12618. }
  12619. /**
  12620. * Sets the decoration line type
  12621. * @param {TextDecoration} type The line type
  12622. * @returns {TextDecorationBuilder} The builder instance for chaining
  12623. * @example
  12624. * ```ts
  12625. * decoration.setLineType(TextDecoration.SINGLE);
  12626. * ```
  12627. */
  12628. setLineType(e) {
  12629. return this._decoration.t = e, this;
  12630. }
  12631. /**
  12632. * Creates a copy of this text decoration builder
  12633. * @returns {TextDecorationBuilder} A new TextDecorationBuilder instance with the same decoration
  12634. * @example
  12635. * ```ts
  12636. * const copy = decoration.copy();
  12637. * ```
  12638. */
  12639. copy() {
  12640. return Jt.create(re.deepClone(this._decoration));
  12641. }
  12642. /**
  12643. * Builds and returns the final decoration object
  12644. * @returns {ITextDecoration} The complete text decoration object
  12645. * @example
  12646. * ```ts
  12647. * const style = decoration.build();
  12648. * ```
  12649. */
  12650. build() {
  12651. return { ...this._decoration };
  12652. }
  12653. }
  12654. class hr {
  12655. constructor(e = {}) {
  12656. C(this, "_style");
  12657. this._style = e;
  12658. }
  12659. /**
  12660. * Creates a new ParagraphStyleValue instance
  12661. * @param {IParagraphStyle} style The initial style object
  12662. * @returns A new ParagraphStyleValue instance
  12663. * @example
  12664. * ```ts
  12665. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  12666. * ```
  12667. */
  12668. static create(e = {}) {
  12669. return new hr(e);
  12670. }
  12671. /**
  12672. * Gets the first line indent
  12673. * @returns {Nullable<INumberUnit>} The first line indent
  12674. * @example
  12675. * ```ts
  12676. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  12677. * console.log(style.indentFirstLine);
  12678. * ```
  12679. */
  12680. get indentFirstLine() {
  12681. return this._style.indentFirstLine;
  12682. }
  12683. /**
  12684. * Gets the hanging indent
  12685. * @returns {Nullable<INumberUnit>} The hanging indent
  12686. * @example
  12687. * ```ts
  12688. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  12689. * console.log(style.hanging);
  12690. * ```
  12691. */
  12692. get hanging() {
  12693. return this._style.hanging;
  12694. }
  12695. /**
  12696. * Gets the indent start
  12697. * @returns {Nullable<INumberUnit>} The indent start
  12698. * @example
  12699. * ```ts
  12700. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  12701. * console.log(style.indentStart);
  12702. * ```
  12703. */
  12704. get indentStart() {
  12705. return this._style.indentStart;
  12706. }
  12707. /**
  12708. * Gets the indent end
  12709. * @returns {Nullable<INumberUnit>} The indent end
  12710. * @example
  12711. * ```ts
  12712. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  12713. * console.log(style.indentEnd);
  12714. * ```
  12715. */
  12716. get tabStops() {
  12717. return this._style.tabStops;
  12718. }
  12719. /**
  12720. * Gets the indent end
  12721. * @returns {Nullable<INumberUnit>} The indent end
  12722. * @example
  12723. * ```ts
  12724. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  12725. * console.log(style.indentEnd);
  12726. * ```
  12727. */
  12728. get indentEnd() {
  12729. return this._style.indentEnd;
  12730. }
  12731. /**
  12732. * Gets the text style
  12733. * @returns {Nullable<ITextStyle>} The text style
  12734. * @example
  12735. * ```ts
  12736. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  12737. * console.log(style.textStyle);
  12738. * ```
  12739. */
  12740. get textStyle() {
  12741. return this._style.textStyle;
  12742. }
  12743. /**
  12744. * Gets the heading id
  12745. * @returns {Nullable<string>} The heading id
  12746. * @example
  12747. * ```ts
  12748. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  12749. * console.log(style.headingId);
  12750. * ```
  12751. */
  12752. get headingId() {
  12753. return this._style.headingId;
  12754. }
  12755. /**
  12756. * Gets the named style type
  12757. * @returns {Nullable<NamedStyleType>} The named style type
  12758. * @example
  12759. * ```ts
  12760. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  12761. * console.log(style.namedStyleType);
  12762. * ```
  12763. */
  12764. get namedStyleType() {
  12765. return this._style.namedStyleType;
  12766. }
  12767. /**
  12768. * Gets the horizontal align
  12769. * @returns {Nullable<HorizontalAlign>} The horizontal align
  12770. * @example
  12771. * ```ts
  12772. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  12773. * console.log(style.horizontalAlign);
  12774. * ```
  12775. */
  12776. get horizontalAlign() {
  12777. return this._style.horizontalAlign;
  12778. }
  12779. /**
  12780. * Gets the line spacing
  12781. * @returns {Nullable<number>} The line spacing
  12782. * @example
  12783. * ```ts
  12784. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  12785. * console.log(style.lineSpacing);
  12786. * ```
  12787. */
  12788. get lineSpacing() {
  12789. return this._style.lineSpacing;
  12790. }
  12791. /**
  12792. * Gets the text direction
  12793. * @returns {Nullable<TextDirection>} The text direction
  12794. * @example
  12795. * ```ts
  12796. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  12797. * console.log(style.direction);
  12798. * ```
  12799. */
  12800. get direction() {
  12801. return this._style.direction;
  12802. }
  12803. /**
  12804. * Gets the spacing rule
  12805. * @returns {Nullable<SpacingRule>} The spacing rule
  12806. * @example
  12807. * ```ts
  12808. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  12809. * console.log(style.spacingRule);
  12810. * ```
  12811. */
  12812. get spacingRule() {
  12813. return this._style.spacingRule;
  12814. }
  12815. /**
  12816. * Gets the snap to grid
  12817. * @returns {Nullable<BooleanNumber>} The snap to grid
  12818. * @example
  12819. * ```ts
  12820. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  12821. * console.log(style.snapToGrid);
  12822. * ```
  12823. */
  12824. get snapToGrid() {
  12825. return this._style.snapToGrid;
  12826. }
  12827. /**
  12828. * Gets the space above
  12829. * @returns {Nullable<INumberUnit>} The space above
  12830. * @example
  12831. * ```ts
  12832. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  12833. * console.log(style.spaceAbove);
  12834. * ```
  12835. */
  12836. get spaceAbove() {
  12837. return this._style.spaceAbove;
  12838. }
  12839. /**
  12840. * Gets the space below
  12841. * @returns {Nullable<INumberUnit>} The space below
  12842. * @example
  12843. * ```ts
  12844. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  12845. * console.log(style.spaceBelow);
  12846. * ```
  12847. */
  12848. get spaceBelow() {
  12849. return this._style.spaceBelow;
  12850. }
  12851. /**
  12852. * Gets the border between
  12853. * @returns {Nullable<IParagraphBorder>} The border between
  12854. * @example
  12855. * ```ts
  12856. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  12857. * console.log(style.borderBetween);
  12858. * ```
  12859. */
  12860. get borderBetween() {
  12861. return this._style.borderBetween;
  12862. }
  12863. /**
  12864. * Gets the border top
  12865. * @returns {Nullable<IParagraphBorder>} The border top
  12866. * @example
  12867. * ```ts
  12868. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  12869. * console.log(style.borderTop);
  12870. * ```
  12871. */
  12872. get borderTop() {
  12873. return this._style.borderTop;
  12874. }
  12875. /**
  12876. * Gets the border bottom
  12877. * @returns {Nullable<IParagraphBorder>} The border bottom
  12878. * @example
  12879. * ```ts
  12880. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  12881. * console.log(style.borderBottom);
  12882. * ```
  12883. */
  12884. get borderBottom() {
  12885. return this._style.borderBottom;
  12886. }
  12887. /**
  12888. * Gets the border left
  12889. * @returns {Nullable<IParagraphBorder>} The border left
  12890. * @example
  12891. * ```ts
  12892. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  12893. * console.log(style.borderLeft);
  12894. * ```
  12895. */
  12896. get borderLeft() {
  12897. return this._style.borderLeft;
  12898. }
  12899. /**
  12900. * Gets the border right
  12901. * @returns {Nullable<IParagraphBorder>} The border right
  12902. * @example
  12903. * ```ts
  12904. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  12905. * console.log(style.borderRight);
  12906. * ```
  12907. */
  12908. get borderRight() {
  12909. return this._style.borderRight;
  12910. }
  12911. /**
  12912. * Gets the keep lines
  12913. * @returns {boolean} The keep lines
  12914. * @example
  12915. * ```ts
  12916. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  12917. * console.log(style.keepLines);
  12918. * ```
  12919. */
  12920. get keepLines() {
  12921. return this._style.keepLines === we.TRUE;
  12922. }
  12923. /**
  12924. * Gets the keep next
  12925. * @returns {boolean} The keep next
  12926. * @example
  12927. * ```ts
  12928. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  12929. * console.log(style.keepNext);
  12930. * ```
  12931. */
  12932. get keepNext() {
  12933. return this._style.keepNext === we.TRUE;
  12934. }
  12935. /**
  12936. * Gets the word wrap
  12937. * @returns {boolean} The word wrap
  12938. * @example
  12939. * ```ts
  12940. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  12941. * console.log(style.wordWrap);
  12942. * ```
  12943. */
  12944. get wordWrap() {
  12945. return this._style.wordWrap === we.TRUE;
  12946. }
  12947. /**
  12948. * Gets the widow control
  12949. * @returns {boolean} The widow control
  12950. * @example
  12951. * ```ts
  12952. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  12953. * console.log(style.widowControl);
  12954. * ```
  12955. */
  12956. get widowControl() {
  12957. return this._style.widowControl === we.TRUE;
  12958. }
  12959. /**
  12960. * Gets the shading
  12961. * @returns {Nullable<IShading>} The shading
  12962. * @example
  12963. * ```ts
  12964. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  12965. * console.log(style.shading);
  12966. * ```
  12967. */
  12968. get shading() {
  12969. return this._style.shading;
  12970. }
  12971. /**
  12972. * Gets the suppress hyphenation
  12973. * @returns {boolean} The suppress hyphenation
  12974. * @example
  12975. * ```ts
  12976. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  12977. * console.log(style.suppressHyphenation);
  12978. * ```
  12979. */
  12980. get suppressHyphenation() {
  12981. return this._style.suppressHyphenation === we.TRUE;
  12982. }
  12983. /**
  12984. * Creates a copy of the paragraph style
  12985. * @returns {ParagraphStyleBuilder} The copy
  12986. * @example
  12987. * ```ts
  12988. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  12989. * const copy = style.copy();
  12990. * ```
  12991. */
  12992. copy() {
  12993. return nr.create(re.deepClone(this._style));
  12994. }
  12995. /**
  12996. * Gets the value
  12997. * @returns {IParagraphStyle} The value
  12998. * @example
  12999. * ```ts
  13000. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  13001. * console.log(style.getValue());
  13002. * ```
  13003. */
  13004. getValue() {
  13005. return this._style;
  13006. }
  13007. }
  13008. class nr extends hr {
  13009. /**
  13010. * Creates a new paragraph style builder
  13011. * @param style The paragraph style
  13012. * @returns A new paragraph style builder
  13013. * @example
  13014. * ```ts
  13015. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  13016. * const copy = style.copy();
  13017. * ```
  13018. */
  13019. static create(e = {}) {
  13020. return new nr(e);
  13021. }
  13022. constructor(e = {}) {
  13023. super(e);
  13024. }
  13025. /**
  13026. * Sets the indent first line
  13027. * @param value The indent first line
  13028. * @returns {ParagraphStyleBuilder} The paragraph style builder
  13029. * @example
  13030. * ```ts
  13031. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  13032. * const copy = style.copy();
  13033. * copy.setIndentFirstLine(10);
  13034. * ```
  13035. */
  13036. setIndentFirstLine(e) {
  13037. return this._style.indentFirstLine = e, this;
  13038. }
  13039. /**
  13040. * Sets the hanging
  13041. * @param value The hanging
  13042. * @returns {ParagraphStyleBuilder} The paragraph style builder
  13043. * @example
  13044. * ```ts
  13045. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  13046. * const copy = style.copy();
  13047. * copy.setHanging(10);
  13048. * ```
  13049. */
  13050. setHanging(e) {
  13051. return this._style.hanging = e, this;
  13052. }
  13053. /**
  13054. * Sets the indent start
  13055. * @param value The indent start
  13056. * @returns {ParagraphStyleBuilder} The paragraph style builder
  13057. * @example
  13058. * ```ts
  13059. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  13060. * const copy = style.copy();
  13061. * copy.setIndentStart(10);
  13062. * ```
  13063. */
  13064. setIndentStart(e) {
  13065. return this._style.indentStart = e, this;
  13066. }
  13067. /**
  13068. * Sets the tab stops
  13069. * @param value The tab stops
  13070. * @returns {ParagraphStyleBuilder} The paragraph style builder
  13071. * @example
  13072. * ```ts
  13073. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  13074. * const copy = style.copy();
  13075. * copy.setTabStops([{ value: 10 }]);
  13076. * ```
  13077. */
  13078. setTabStops(e) {
  13079. return this._style.tabStops = e, this;
  13080. }
  13081. /**
  13082. * Sets the indent end
  13083. * @param value The indent end
  13084. * @returns {ParagraphStyleBuilder} The paragraph style builder
  13085. * @example
  13086. * ```ts
  13087. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  13088. * const copy = style.copy();
  13089. * copy.setIndentEnd(10);
  13090. * ```
  13091. */
  13092. setIndentEnd(e) {
  13093. return this._style.indentEnd = e, this;
  13094. }
  13095. /**
  13096. * Sets the text style
  13097. * @param value The text style
  13098. * @returns {ParagraphStyleBuilder} The paragraph style builder
  13099. * @example
  13100. * ```ts
  13101. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  13102. * const copy = style.copy();
  13103. * copy.setTextStyle({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
  13104. * ```
  13105. */
  13106. setTextStyle(e) {
  13107. return this._style.textStyle = e, this;
  13108. }
  13109. /**
  13110. * Sets the heading id
  13111. * @param value The heading id
  13112. * @returns {ParagraphStyleBuilder} The paragraph style builder
  13113. * @example
  13114. * ```ts
  13115. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  13116. * const copy = style.copy();
  13117. * copy.setHeadingId('test');
  13118. * ```
  13119. */
  13120. setHeadingId(e) {
  13121. return this._style.headingId = e, this;
  13122. }
  13123. /**
  13124. * Sets the named style type
  13125. * @param value The named style type
  13126. * @returns {ParagraphStyleBuilder} The paragraph style builder
  13127. * @example
  13128. * ```ts
  13129. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  13130. * const copy = style.copy();
  13131. * copy.setNamedStyleType(NamedStyleType.CHAPTER);
  13132. * ```
  13133. */
  13134. setNamedStyleType(e) {
  13135. return this._style.namedStyleType = e, this;
  13136. }
  13137. /**
  13138. * Sets the vertical align
  13139. * @param value The vertical align
  13140. * @returns {ParagraphStyleBuilder} The paragraph style builder
  13141. * @example
  13142. * ```ts
  13143. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  13144. * const copy = style.copy();
  13145. * copy.setVerticalAlign(VerticalAlign.CENTER);
  13146. * ```
  13147. */
  13148. setHorizontalAlign(e) {
  13149. return this._style.horizontalAlign = e, this;
  13150. }
  13151. /**
  13152. * Sets the line spacing
  13153. * @param value The line spacing
  13154. * @returns {ParagraphStyleBuilder} The paragraph style builder
  13155. * @example
  13156. * ```ts
  13157. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  13158. * const copy = style.copy();
  13159. * copy.setLineSpacing(10);
  13160. * ```
  13161. */
  13162. setLineSpacing(e) {
  13163. return this._style.lineSpacing = e, this;
  13164. }
  13165. /**
  13166. * Sets the text direction
  13167. * @param value The text direction
  13168. * @returns {ParagraphStyleBuilder} The paragraph style builder
  13169. * @example
  13170. * ```ts
  13171. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  13172. * const copy = style.copy();
  13173. * copy.setTextDirection(TextDirection.RIGHT_TO_LEFT);
  13174. * ```
  13175. */
  13176. setDirection(e) {
  13177. return this._style.direction = e, this;
  13178. }
  13179. /**
  13180. * Sets the spacing rule
  13181. * @param value The spacing rule
  13182. * @returns {ParagraphStyleBuilder} The paragraph style builder
  13183. * @example
  13184. * ```ts
  13185. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  13186. * const copy = style.copy();
  13187. * copy.setSpacingRule(SpacingRule.AUTO);
  13188. * ```
  13189. */
  13190. setSpacingRule(e) {
  13191. return this._style.spacingRule = e, this;
  13192. }
  13193. /**
  13194. * Sets the snap to grid
  13195. * @param value The snap to grid
  13196. * @returns {ParagraphStyleBuilder} The paragraph style builder
  13197. * @example
  13198. * ```ts
  13199. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  13200. * const copy = style.copy();
  13201. * copy.setSnapToGrid(true);
  13202. * ```
  13203. */
  13204. setSnapToGrid(e) {
  13205. return this._style.snapToGrid = e ? 1 : 0, this;
  13206. }
  13207. /**
  13208. * Sets the space above
  13209. * @param value The space above
  13210. * @returns {ParagraphStyleBuilder} The paragraph style builder
  13211. * @example
  13212. * ```ts
  13213. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  13214. * const copy = style.copy();
  13215. * copy.setSpaceAbove(10);
  13216. * ```
  13217. */
  13218. setSpaceAbove(e) {
  13219. return this._style.spaceAbove = e, this;
  13220. }
  13221. /**
  13222. * Sets the space below
  13223. * @param value The space below
  13224. * @returns {ParagraphStyleBuilder} The paragraph style builder
  13225. * @example
  13226. * ```ts
  13227. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  13228. * const copy = style.copy();
  13229. * copy.setSpaceBelow(10);
  13230. * ```
  13231. */
  13232. setSpaceBelow(e) {
  13233. return this._style.spaceBelow = e, this;
  13234. }
  13235. /**
  13236. * Sets the border between
  13237. * @param {IParagraphBorder} value The border between
  13238. * @returns {ParagraphStyleBuilder} The paragraph style builder
  13239. * @example
  13240. * ```ts
  13241. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  13242. * const copy = style.copy();
  13243. * copy.setBorderBetween({ color: 'red', width: 1 });
  13244. * ```
  13245. */
  13246. setBorderBetween(e) {
  13247. return this._style.borderBetween = e, this;
  13248. }
  13249. /**
  13250. * Sets the border top
  13251. * @param {IParagraphBorder} value The border top
  13252. * @returns {ParagraphStyleBuilder} The paragraph style builder
  13253. * @example
  13254. * ```ts
  13255. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  13256. * const copy = style.copy();
  13257. * copy.setBorderTop({ color: 'red', width: 1 });
  13258. * ```
  13259. */
  13260. setBorderTop(e) {
  13261. return this._style.borderTop = e, this;
  13262. }
  13263. /**
  13264. * Sets the border bottom
  13265. * @param {IParagraphBorder} value The border bottom
  13266. * @returns {ParagraphStyleBuilder} The paragraph style builder
  13267. * @example
  13268. * ```ts
  13269. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  13270. * const copy = style.copy();
  13271. * copy.setBorderBottom({ color: 'red', width: 1 });
  13272. * ```
  13273. */
  13274. setBorderBottom(e) {
  13275. return this._style.borderBottom = e, this;
  13276. }
  13277. /**
  13278. * Sets the border left
  13279. * @param {IParagraphBorder} value The border left
  13280. * @returns {ParagraphStyleBuilder} The paragraph style builder
  13281. * @example
  13282. * ```ts
  13283. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  13284. * const copy = style.copy();
  13285. * copy.setBorderLeft({ color: 'red', width: 1 });
  13286. * ```
  13287. */
  13288. setBorderLeft(e) {
  13289. return this._style.borderLeft = e, this;
  13290. }
  13291. /**
  13292. * Sets the border right
  13293. * @param {IParagraphBorder} value The border right
  13294. * @returns {ParagraphStyleBuilder} The paragraph style builder
  13295. * @example
  13296. * ```ts
  13297. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  13298. * const copy = style.copy();
  13299. * copy.setBorderRight({ color: 'red', width: 1 });
  13300. * ```
  13301. */
  13302. setBorderRight(e) {
  13303. return this._style.borderRight = e, this;
  13304. }
  13305. /**
  13306. * Sets the keep lines
  13307. * @param value The keep lines
  13308. * @returns {ParagraphStyleBuilder} The paragraph style builder
  13309. * @example
  13310. * ```ts
  13311. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  13312. * const copy = style.copy();
  13313. * copy.setKeepLines(true);
  13314. * ```
  13315. */
  13316. setKeepLines(e) {
  13317. return this._style.keepLines = e ? 1 : 0, this;
  13318. }
  13319. /**
  13320. * Sets the keep next
  13321. * @param value The keep next
  13322. * @returns {ParagraphStyleBuilder} The paragraph style builder
  13323. * @example
  13324. * ```ts
  13325. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  13326. * const copy = style.copy();
  13327. * copy.setKeepNext(true);
  13328. * ```
  13329. */
  13330. setKeepNext(e) {
  13331. return this._style.keepNext = e ? 1 : 0, this;
  13332. }
  13333. /**
  13334. * Sets the word wrap
  13335. * @param value The word wrap
  13336. * @returns {ParagraphStyleBuilder} The paragraph style builder
  13337. * @example
  13338. * ```ts
  13339. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  13340. * const copy = style.copy();
  13341. * copy.setWordWrap(true);
  13342. * ```
  13343. */
  13344. setWordWrap(e) {
  13345. return this._style.wordWrap = e ? 1 : 0, this;
  13346. }
  13347. /**
  13348. * Sets the widow control
  13349. * @param {boolean} value The widow control value
  13350. * @returns {ParagraphStyleBuilder} The paragraph style builder
  13351. * @example
  13352. * ```ts
  13353. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  13354. * const copy = style.copy();
  13355. * copy.setWidowControl(true);
  13356. * ```
  13357. */
  13358. setWidowControl(e) {
  13359. return this._style.widowControl = e ? 1 : 0, this;
  13360. }
  13361. /**
  13362. * Sets the shading style
  13363. * @param {IShading} value The shading configuration
  13364. * @returns {ParagraphStyleBuilder} The paragraph style builder
  13365. * @example
  13366. * ```ts
  13367. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  13368. * const copy = style.copy();
  13369. * copy.setShading({ backgroundColor: '#f0f0f0' });
  13370. * ```
  13371. */
  13372. setShading(e) {
  13373. return this._style.shading = e, this;
  13374. }
  13375. /**
  13376. * Sets whether to suppress hyphenation
  13377. * @param {boolean} value The suppress hyphenation value
  13378. * @returns {ParagraphStyleBuilder} The paragraph style builder
  13379. * @example
  13380. * ```ts
  13381. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  13382. * const copy = style.copy();
  13383. * copy.setSuppressHyphenation(true);
  13384. * ```
  13385. */
  13386. setSuppressHyphenation(e) {
  13387. return this._style.suppressHyphenation = e ? 1 : 0, this;
  13388. }
  13389. /**
  13390. * Creates a copy of the current paragraph style builder
  13391. * @returns {ParagraphStyleBuilder} A new instance of ParagraphStyleBuilder with the same settings
  13392. * @example
  13393. * ```ts
  13394. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  13395. * const copy = style.copy();
  13396. * ```
  13397. */
  13398. copy() {
  13399. return nr.create(re.deepClone(this._style));
  13400. }
  13401. /**
  13402. * Builds and returns the final paragraph style configuration
  13403. * @returns {IParagraphStyle} The constructed paragraph style object
  13404. * @example
  13405. * ```ts
  13406. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  13407. * const finalStyle = style.build();
  13408. * ```
  13409. */
  13410. build() {
  13411. return this.getValue();
  13412. }
  13413. }
  13414. class Zt {
  13415. constructor(e) {
  13416. C(this, "_data");
  13417. if (!e.body)
  13418. throw new Error("Invalid document data, body is required");
  13419. this._data = ol(e);
  13420. }
  13421. /**
  13422. * Creates a new RichTextValue instance
  13423. * @param {IDocumentData} data The initial data for the rich text value
  13424. * @returns {RichTextValue} A new RichTextValue instance
  13425. * @example
  13426. * ```ts
  13427. * const richText = RichTextValue.create({ body: { dataStream: 'Hello World\r\n' } });
  13428. * ```
  13429. */
  13430. static create(e) {
  13431. return new Zt(e);
  13432. }
  13433. /**
  13434. * Creates a new RichTextValue instance
  13435. * @param {IDocumentBody} data The initial data for the rich text value
  13436. * @returns {RichTextValue} A new RichTextValue instance
  13437. * @example
  13438. * ```ts
  13439. * const richText = RichTextValue.createByBody({ dataStream: 'Hello World\r\n' });
  13440. * ```
  13441. */
  13442. static createByBody(e) {
  13443. return new Zt({ body: e, id: "d", documentStyle: {} });
  13444. }
  13445. /**
  13446. * Creates a copy of the current RichTextValue instance
  13447. * @returns {RichTextValue} A new instance of RichTextValue with the same data
  13448. * @example
  13449. * ```ts
  13450. * const richText = RichTextValue.create({ body: { dataStream: 'Hello World\r\n' } });
  13451. * const copy = richText.copy();
  13452. * ```
  13453. */
  13454. copy() {
  13455. return gn.create(re.deepClone(this._data));
  13456. }
  13457. /**
  13458. * Slices the current RichTextValue instance
  13459. * @param {number} start The start index
  13460. * @param {number} end The end index
  13461. * @returns {RichTextBuilder} A new instance of RichTextBuilder with the sliced data
  13462. * @example
  13463. * ```ts
  13464. * const richText = RichTextValue.create({ body: { dataStream: 'Hello World\r\n' } });
  13465. * const sliced = richText.slice(0, 5);
  13466. * ```
  13467. */
  13468. slice(e, n) {
  13469. const { body: r, ...s } = this._data;
  13470. return gn.create({
  13471. ...re.deepClone(s),
  13472. body: Dt(r, e, n)
  13473. });
  13474. }
  13475. /**
  13476. * Converts the current RichTextValue instance to plain text
  13477. * @returns {string} The plain text representation of the current RichTextValue instance
  13478. * @example
  13479. * ```ts
  13480. * const richText = RichTextValue.create({ body: { dataStream: 'Hello World\r\n' } });
  13481. * const plainText = richText.toPlainText();
  13482. * ```
  13483. */
  13484. toPlainText() {
  13485. var e, n;
  13486. return st.transform.getPlainText((n = (e = this._data.body) == null ? void 0 : e.dataStream) != null ? n : "").replaceAll("\r", `
  13487. `);
  13488. }
  13489. /**
  13490. * Gets the paragraph style of the current RichTextValue instance
  13491. * @returns {ParagraphStyleValue} The paragraph style of the current RichTextValue instance
  13492. * @example
  13493. * ```ts
  13494. * const richText = RichTextValue.create({ body: { dataStream: 'Hello World\r\n' } });
  13495. * const style = richText.getParagraphStyle();
  13496. * ```
  13497. */
  13498. getParagraphStyle() {
  13499. var e, n;
  13500. return hr.create((n = (e = this._data.body) == null ? void 0 : e.paragraphs) == null ? void 0 : n[0].paragraphStyle);
  13501. }
  13502. /**
  13503. * Gets the paragraph bullet of the current RichTextValue instance
  13504. * @returns {ParagraphBulletValue} The paragraph bullet of the current RichTextValue instance
  13505. * @example
  13506. * ```ts
  13507. * const richText = RichTextValue.create({ body: { dataStream: 'Hello World\r\n' } });
  13508. * const bullet = richText.getParagraphBullet();
  13509. * ```
  13510. */
  13511. getParagraphBullet() {
  13512. var e, n;
  13513. return (n = (e = this._data.body) == null ? void 0 : e.paragraphs) == null ? void 0 : n[0].bullet;
  13514. }
  13515. /**
  13516. * Gets the paragraphs of the current RichTextValue instance
  13517. * @returns {RichTextValue[]} The paragraphs of the current RichTextValue instance
  13518. * @example
  13519. * ```ts
  13520. * const richText = RichTextValue.create({ body: { dataStream: 'Hello World\r\n' } });
  13521. * const paragraphs = richText.getParagraphs();
  13522. * ```
  13523. */
  13524. getParagraphs() {
  13525. var r, s;
  13526. const e = (s = (r = this._data.body) == null ? void 0 : r.paragraphs) != null ? s : [];
  13527. let n = 0;
  13528. return e.map((i) => {
  13529. const o = this.slice(n, i.startIndex);
  13530. return n = i.startIndex, o;
  13531. });
  13532. }
  13533. /**
  13534. * Gets the text runs of the current RichTextValue instance
  13535. * @returns {TextRunValue[]} The text runs of the current RichTextValue instance
  13536. * @example
  13537. * ```ts
  13538. * const richText = RichTextValue.create({ body: { dataStream: 'Hello World\r\n' } });
  13539. * const textRuns = richText.getTextRuns();
  13540. * ```
  13541. */
  13542. getTextRuns() {
  13543. var e, n;
  13544. return ((n = (e = this._data.body) == null ? void 0 : e.textRuns) != null ? n : []).map((r) => ({
  13545. ...r,
  13546. ts: r.ts ? cr.create(r.ts) : null
  13547. }));
  13548. }
  13549. /**
  13550. * Gets the links of the current RichTextValue instance
  13551. * @returns {ICustomRange[]} The links of the current RichTextValue instance
  13552. * @example
  13553. * ```ts
  13554. * const richText = RichTextValue.create({ body: { dataStream: 'Hello World\r\n' } });
  13555. * const links = richText.getLinks();
  13556. * ```
  13557. */
  13558. getLinks() {
  13559. var e, n, r;
  13560. return (r = (n = (e = this._data.body) == null ? void 0 : e.customRanges) == null ? void 0 : n.filter((s) => s.rangeType === mn.HYPERLINK)) != null ? r : [];
  13561. }
  13562. /**
  13563. * Gets the data of the current RichTextValue instance
  13564. * @returns {IDocumentData} The data of the current RichTextValue instance
  13565. * @example
  13566. * ```ts
  13567. * const richText = RichTextValue.create({ body: { dataStream: 'Hello World\r\n' } });
  13568. * const data = richText.getData();
  13569. * ```
  13570. */
  13571. getData() {
  13572. return this._data;
  13573. }
  13574. }
  13575. class gn extends Zt {
  13576. constructor(n) {
  13577. super(n);
  13578. C(this, "_doc");
  13579. this._doc = new jt(n);
  13580. }
  13581. static newEmptyData() {
  13582. return ol({
  13583. id: "d",
  13584. documentStyle: {},
  13585. drawings: {},
  13586. drawingsOrder: [],
  13587. body: {
  13588. dataStream: `\r
  13589. `,
  13590. customBlocks: [],
  13591. customRanges: [],
  13592. paragraphs: [{ startIndex: 0 }],
  13593. textRuns: [],
  13594. tables: [],
  13595. sectionBreaks: []
  13596. }
  13597. });
  13598. }
  13599. /**
  13600. * Creates a new RichTextBuilder instance
  13601. * @param {IDocumentData} data The initial data for the rich text builder
  13602. * @returns {RichTextBuilder} A new RichTextBuilder instance
  13603. */
  13604. static create(n) {
  13605. return new gn(n != null ? n : gn.newEmptyData());
  13606. }
  13607. insertText(n, r, s) {
  13608. var l, h;
  13609. let i = ((h = (l = this._data.body) == null ? void 0 : l.dataStream.length) != null ? h : 2) - 2, o, a;
  13610. if (typeof n == "string" ? o = n : (i = Math.min(n, i), o = r), typeof r == "object" ? a = r instanceof Qt ? r.build() : r : a = s instanceof Qt ? s.build() : s, !o) return this;
  13611. const u = {
  13612. dataStream: o,
  13613. textRuns: a ? [
  13614. {
  13615. ts: a,
  13616. st: i,
  13617. ed: i + o.length
  13618. }
  13619. ] : []
  13620. }, c = st.selection.replace({
  13621. doc: this._doc,
  13622. selection: { startOffset: i, endOffset: i, collapsed: !0 },
  13623. body: u
  13624. });
  13625. if (!c)
  13626. throw new Error("Insert text failed, please check.");
  13627. return Ke.apply(this._doc.getBody(), c.serialize()), this;
  13628. }
  13629. insertRichText(n, r) {
  13630. var a, u;
  13631. let s = ((u = (a = this._data.body) == null ? void 0 : a.dataStream.length) != null ? u : 2) - 2, i;
  13632. typeof n == "object" ? i = n instanceof Zt ? n.getData() : n : (s = Math.min(n, s), i = r instanceof Zt ? r.getData() : r);
  13633. const o = st.selection.replace({
  13634. doc: this._doc,
  13635. selection: { startOffset: s, endOffset: s, collapsed: !0 },
  13636. body: i.body
  13637. });
  13638. if (!o)
  13639. throw new Error("Insert text failed, please check.");
  13640. return Ke.apply(this._doc.getBody(), o.serialize()), this;
  13641. }
  13642. delete(n, r) {
  13643. if (r !== void 0) {
  13644. if (!r) return this;
  13645. const s = st.selection.delete([{ startOffset: n, endOffset: n + r, collapsed: !0 }], this._data.body);
  13646. Ke.apply(this._doc.getBody(), s);
  13647. }
  13648. return this;
  13649. }
  13650. /**
  13651. * Sets the style of the text at the specified start and end positions
  13652. * @param {number} start The start position of the text to set the style
  13653. * @param {number} end The end position of the text to set the style
  13654. * @param {TextStyleBuilder | ITextStyle} style The style to set
  13655. * @returns {RichTextBuilder} The current RichTextBuilder instance
  13656. * @example
  13657. * ```ts
  13658. * const richText = RichTextValue.create({ body: { dataStream: 'Hello World\r\n' } });
  13659. * const newRichText = richText.setStyle(5, 10, { ff: 'Arial', fs: 12 });
  13660. * ```
  13661. */
  13662. setStyle(n, r, s) {
  13663. const i = {
  13664. dataStream: "",
  13665. textRuns: [{
  13666. ts: s instanceof Qt ? s.build() : s,
  13667. st: 0,
  13668. ed: r - n
  13669. }]
  13670. }, o = st.selection.retain([{ startOffset: n, endOffset: r, collapsed: !0 }], i);
  13671. return Ke.apply(this._doc.getBody(), o), this;
  13672. }
  13673. /**
  13674. * Sets the link of the text at the specified start and end positions
  13675. * @param {number} start The start position of the text to set the link
  13676. * @param {number} end The end position of the text to set the link
  13677. * @param {string} link The link to set
  13678. * @returns {RichTextBuilder} The current RichTextBuilder instance
  13679. * @example
  13680. * ```ts
  13681. * const richText = RichTextValue.create({ body: { dataStream: 'Hello World\r\n' } });
  13682. * const newRichText = richText.setLink(5, 10, 'https://www.example.com');
  13683. * ```
  13684. */
  13685. setLink(n, r, s) {
  13686. const i = st.customRange.add({
  13687. rangeType: mn.HYPERLINK,
  13688. rangeId: qt(),
  13689. properties: {
  13690. url: s
  13691. },
  13692. ranges: [{ startOffset: n, endOffset: r, collapsed: !1 }],
  13693. body: this._data.body
  13694. });
  13695. if (!i)
  13696. throw new Error("Insert text failed, please check.");
  13697. return Ke.apply(this._doc.getBody(), i.serialize()), this;
  13698. }
  13699. cancelLink(n, r) {
  13700. if (typeof n == "string") {
  13701. const s = st.customRange.delete({
  13702. rangeId: n,
  13703. documentDataModel: this._doc
  13704. });
  13705. if (!s)
  13706. throw new Error("Insert text failed, please check.");
  13707. Ke.apply(this._doc.getBody(), s.serialize());
  13708. } else
  13709. this.slice(n, r).getLinks().forEach((i) => {
  13710. const o = st.customRange.delete({
  13711. rangeId: i.rangeId,
  13712. documentDataModel: this._doc
  13713. });
  13714. if (!o)
  13715. throw new Error("Insert text failed, please check.");
  13716. Ke.apply(this._doc.getBody(), o.serialize());
  13717. });
  13718. return this;
  13719. }
  13720. updateLink(n, r) {
  13721. var i, o;
  13722. const s = (o = (i = this._data.body) == null ? void 0 : i.customRanges) == null ? void 0 : o.find((a) => a.rangeId === n);
  13723. if (!s)
  13724. throw new Error("Link not found");
  13725. return s.properties.url = r, this;
  13726. }
  13727. insertParagraph(n, r) {
  13728. var o, a;
  13729. let s, i;
  13730. return typeof n == "object" ? (s = {
  13731. dataStream: "\r",
  13732. paragraphs: [{
  13733. startIndex: 0,
  13734. paragraphStyle: n.build()
  13735. }]
  13736. }, i = ((a = (o = this._data.body) == null ? void 0 : o.dataStream.length) != null ? a : 2) - 2) : (i = n, s = {
  13737. dataStream: "\r",
  13738. paragraphs: [{
  13739. startIndex: 0,
  13740. paragraphStyle: r == null ? void 0 : r.build()
  13741. }]
  13742. }), this.insertRichText(i, Zt.create({ body: s, id: "d", documentStyle: {} })), this;
  13743. }
  13744. insertLink(n, r, s) {
  13745. let i = "", o = "";
  13746. typeof n == "string" ? (i = n, o = r) : (i = r, o = s);
  13747. const a = gn.createByBody({
  13748. dataStream: i,
  13749. customRanges: [{
  13750. rangeType: mn.HYPERLINK,
  13751. rangeId: qt(),
  13752. properties: {
  13753. url: o
  13754. },
  13755. startIndex: 0,
  13756. endIndex: i.length - 1
  13757. }]
  13758. });
  13759. return typeof n == "number" ? this.insertRichText(n, a) : this.insertRichText(a);
  13760. }
  13761. }
  13762. function tR(t, e = 16) {
  13763. let n = 0, r = null;
  13764. return function(...i) {
  13765. const o = Date.now();
  13766. o - n < e ? (r && clearTimeout(r), r = setTimeout(() => {
  13767. n = o, t.apply(this, i);
  13768. }, e)) : (n = o, t.apply(this, i));
  13769. };
  13770. }
  13771. var Vn = /* @__PURE__ */ ((t) => (t[t.Style = 1] = "Style", t[t.Value = 2] = "Value", t))(Vn || {});
  13772. function nR(t) {
  13773. return `sheet_interceptor_${t}`;
  13774. }
  13775. const x_ = (t) => function(e, n) {
  13776. let r = -1, s = e;
  13777. for (let i = 0; i <= t.length; i++) {
  13778. if (i <= r)
  13779. throw new Error("[SheetInterceptorService]: next() called multiple times!");
  13780. if (r = i, i === t.length)
  13781. return s;
  13782. const o = t[i];
  13783. let a = !1;
  13784. if (s = o.handler(s, n, (u) => (a = !0, u)), !a)
  13785. break;
  13786. }
  13787. return s;
  13788. };
  13789. class rR {
  13790. constructor(e) {
  13791. C(this, "_interceptorsByName", /* @__PURE__ */ new Map());
  13792. C(this, "_interceptorPoints");
  13793. this._interceptorPoints = e;
  13794. }
  13795. /**
  13796. * Get the interceptors.
  13797. * @param name Name of the intercepted point.
  13798. * @param filter A callback function to filter the interceptors.
  13799. * @returns It will return a composed interceptor function. If you will perform the interceptor repeatedly,
  13800. * you should cache the result instead of calling this function multiple times.
  13801. */
  13802. fetchThroughInterceptors(e, n) {
  13803. const r = e;
  13804. let s = this._interceptorsByName.get(r);
  13805. return n && (s = s.filter(n)), x_(s || []);
  13806. }
  13807. intercept(e, n) {
  13808. const r = e;
  13809. this._interceptorsByName.has(r) || this._interceptorsByName.set(r, []);
  13810. const s = this._interceptorsByName.get(r);
  13811. return s.push(n), this._interceptorsByName.set(
  13812. r,
  13813. s.sort((i, o) => {
  13814. var a, u;
  13815. return ((a = o.priority) != null ? a : 0) - ((u = i.priority) != null ? u : 0);
  13816. })
  13817. // from large to small
  13818. ), () => cs(this._interceptorsByName.get(r), n);
  13819. }
  13820. getInterceptPoints() {
  13821. return this._interceptorPoints;
  13822. }
  13823. dispose() {
  13824. this._interceptorsByName.clear();
  13825. }
  13826. }
  13827. function sR(t) {
  13828. return `sheet_async_interceptor_${t}`;
  13829. }
  13830. const L_ = (t) => async function(e, n) {
  13831. let r = -1, s = e;
  13832. for (let i = 0; i <= t.length; i++) {
  13833. if (i <= r)
  13834. throw new Error("[SheetInterceptorService]: next() called multiple times!");
  13835. if (r = i, i === t.length)
  13836. return s;
  13837. const o = t[i];
  13838. let a = !1;
  13839. if (s = await o.handler(s, n, async (u) => (a = !0, u)), !a)
  13840. break;
  13841. }
  13842. return s;
  13843. };
  13844. class iR {
  13845. constructor(e) {
  13846. C(this, "_asyncInterceptorsByName", /* @__PURE__ */ new Map());
  13847. C(this, "_asyncInterceptorPoints");
  13848. this._asyncInterceptorPoints = e;
  13849. }
  13850. /**
  13851. * Get the interceptors.
  13852. * @param name Name of the intercepted point.
  13853. * @param filter A callback function to filter the interceptors.
  13854. * @returns It will return a composed interceptor function. If you will perform the interceptor repeatedly,
  13855. * you should cache the result instead of calling this function multiple times.
  13856. */
  13857. fetchThroughAsyncInterceptors(e, n) {
  13858. const r = e;
  13859. let s = this._asyncInterceptorsByName.get(r);
  13860. return n && (s = s.filter(n)), L_(s || []);
  13861. }
  13862. async interceptAsync(e, n) {
  13863. const r = e;
  13864. this._asyncInterceptorsByName.has(r) || this._asyncInterceptorsByName.set(r, []);
  13865. const s = this._asyncInterceptorsByName.get(r);
  13866. return s.push(n), this._asyncInterceptorsByName.set(
  13867. r,
  13868. s.sort((i, o) => {
  13869. var a, u;
  13870. return ((a = o.priority) != null ? a : 0) - ((u = i.priority) != null ? u : 0);
  13871. })
  13872. // from large to small
  13873. ), () => cs(this._asyncInterceptorsByName.get(r), n);
  13874. }
  13875. getInterceptPoints() {
  13876. return this._asyncInterceptorPoints;
  13877. }
  13878. dispose() {
  13879. this._asyncInterceptorsByName.clear();
  13880. }
  13881. }
  13882. function oR(t, e) {
  13883. for (const n in e)
  13884. e.hasOwnProperty(n) && (t[n] = e[n]);
  13885. }
  13886. class Fi extends nt {
  13887. static extend(e) {
  13888. Object.getOwnPropertyNames(e.prototype).forEach((n) => {
  13889. n !== "constructor" && (this.prototype[n] = e.prototype[n]);
  13890. }), Object.getOwnPropertyNames(e).forEach((n) => {
  13891. n !== "prototype" && n !== "name" && n !== "length" && (this[n] = e[n]);
  13892. });
  13893. }
  13894. }
  13895. const Ds = Symbol("initializers");
  13896. class al extends nt {
  13897. constructor(e) {
  13898. super(), this._injector = e;
  13899. const n = this, r = Object.getPrototypeOf(this)[Ds];
  13900. r && r.forEach(function(s) {
  13901. s.apply(n, [e]);
  13902. });
  13903. }
  13904. _initialize(e) {
  13905. }
  13906. static extend(e) {
  13907. Object.getOwnPropertyNames(e.prototype).forEach((n) => {
  13908. if (n === "_initialize") {
  13909. let r = this.prototype[Ds];
  13910. r || (r = [], this.prototype[Ds] = r), r.push(e.prototype._initialize);
  13911. } else n !== "constructor" && (this.prototype[n] = e.prototype[n]);
  13912. }), Object.getOwnPropertyNames(e).forEach((n) => {
  13913. n !== "prototype" && n !== "name" && n !== "length" && (this[n] = e[n]);
  13914. });
  13915. }
  13916. }
  13917. class $i {
  13918. constructor() {
  13919. C(this, "_data", []);
  13920. }
  13921. static create() {
  13922. return new $i();
  13923. }
  13924. add(e) {
  13925. this._data.indexOf(e) > -1 || this._data.push(e);
  13926. }
  13927. delete(e) {
  13928. const n = this._data.indexOf(e);
  13929. this._data.splice(n, 1);
  13930. }
  13931. getData() {
  13932. return this._data;
  13933. }
  13934. }
  13935. class ul {
  13936. constructor() {
  13937. C(this, "_data", /* @__PURE__ */ new Map());
  13938. }
  13939. static create() {
  13940. return new ul();
  13941. }
  13942. add(e, n) {
  13943. this._data.has(e) || this._data.set(e, n);
  13944. }
  13945. delete(e) {
  13946. this._data.delete(e);
  13947. }
  13948. getData() {
  13949. return this._data;
  13950. }
  13951. }
  13952. const U_ = "0.5.5";
  13953. function P_(t = "", e = ur.ZH_CN, n = "") {
  13954. return {
  13955. id: t,
  13956. sheetOrder: [],
  13957. name: n,
  13958. appVersion: U_,
  13959. locale: e,
  13960. styles: {},
  13961. sheets: {},
  13962. resources: []
  13963. };
  13964. }
  13965. class k_ {
  13966. constructor(e = {}) {
  13967. C(this, "_styles");
  13968. C(this, "_cacheMap", new Qr(1e5));
  13969. this._styles = e, this._generateCacheMap();
  13970. }
  13971. each(e) {
  13972. return Object.entries(this._styles).forEach(e), this;
  13973. }
  13974. search(e, n) {
  13975. if (this._cacheMap.has(n))
  13976. return this._cacheMap.get(n);
  13977. const r = this._getExistingStyleId(e);
  13978. return r || "-1";
  13979. }
  13980. get(e) {
  13981. return typeof e != "string" ? e : (e = String(e), this._styles[e]);
  13982. }
  13983. add(e, n) {
  13984. const r = re.generateRandomId(6);
  13985. return this._styles[r] = e, this._cacheMap.set(n, r), r;
  13986. }
  13987. setValue(e) {
  13988. if (e == null) return;
  13989. const n = JSON.stringify(e), r = this.search(e, n);
  13990. return r !== "-1" ? r : this.add(e, n);
  13991. }
  13992. toJSON() {
  13993. return this._styles;
  13994. }
  13995. getStyleByCell(e) {
  13996. let n;
  13997. e && re.isObject(e.s) ? n = e.s : n = (e == null ? void 0 : e.s) && this.get(e.s);
  13998. const r = e == null ? void 0 : e.interceptorStyle;
  13999. return r ? {
  14000. ...n,
  14001. ...r
  14002. } : n;
  14003. }
  14004. _generateCacheMap() {
  14005. const { _styles: e, _cacheMap: n } = this;
  14006. for (const r in e) {
  14007. const s = JSON.stringify(e[r]);
  14008. n.set(s, r);
  14009. }
  14010. }
  14011. _getExistingStyleId(e) {
  14012. const { _styles: n } = this;
  14013. for (const r in n)
  14014. if (re.diffValue(n[r], e))
  14015. return r;
  14016. return null;
  14017. }
  14018. }
  14019. const aR = (t, e) => e.length === t.length && !t.some((n) => e.some((r) => !en.equals(r, n))), uR = (t, e) => e.length === t.length && t.every((n, r) => {
  14020. const s = e[r];
  14021. return s.unitId === n.unitId && s.sheetId === n.sheetId && en.equals(n.range, s.range);
  14022. }), ti = {
  14023. t: 0,
  14024. b: 2,
  14025. // must over 1, see https://github.com/dream-num/univer/issues/2727
  14026. l: 2,
  14027. r: 2
  14028. }, F_ = (t) => ({
  14029. sbr: 0.6,
  14030. sbo: t,
  14031. spr: 0.6,
  14032. spo: t
  14033. }), ga = 90;
  14034. function Sr(t, e, n = {}) {
  14035. const r = t.length, {
  14036. textRotation: s,
  14037. paddingData: i,
  14038. horizontalAlign: o = Xt.UNSPECIFIED,
  14039. verticalAlign: a = hn.UNSPECIFIED,
  14040. wrapStrategy: u = xn.UNSPECIFIED,
  14041. cellValueType: c
  14042. } = n, { t: l, r: h, b: d, l: f } = i || ti, { vertexAngle: E, centerAngle: R } = ll(s), O = {
  14043. id: "d",
  14044. body: {
  14045. dataStream: `${t}${Wd}`,
  14046. textRuns: [
  14047. {
  14048. ts: e,
  14049. st: 0,
  14050. ed: r
  14051. }
  14052. ],
  14053. paragraphs: [
  14054. {
  14055. startIndex: r,
  14056. paragraphStyle: {
  14057. horizontalAlign: o
  14058. }
  14059. }
  14060. ],
  14061. sectionBreaks: [{
  14062. startIndex: r + 1
  14063. }]
  14064. },
  14065. documentStyle: {
  14066. pageSize: {
  14067. width: Number.POSITIVE_INFINITY,
  14068. height: Number.POSITIVE_INFINITY
  14069. },
  14070. marginTop: l,
  14071. marginBottom: d,
  14072. marginRight: h,
  14073. marginLeft: f,
  14074. renderConfig: {
  14075. horizontalAlign: o,
  14076. verticalAlign: a,
  14077. centerAngle: R,
  14078. vertexAngle: E,
  14079. wrapStrategy: u,
  14080. cellValueType: c,
  14081. zeroWidthParagraphBreak: 1
  14082. }
  14083. },
  14084. drawings: {},
  14085. drawingsOrder: []
  14086. };
  14087. return new jt(O);
  14088. }
  14089. function $_(t) {
  14090. if (!t) return {};
  14091. const {
  14092. tr: e,
  14093. td: n,
  14094. ht: r,
  14095. vt: s,
  14096. tb: i,
  14097. pd: o
  14098. } = t;
  14099. return {
  14100. textRotation: e,
  14101. textDirection: n,
  14102. horizontalAlign: r,
  14103. verticalAlign: s,
  14104. wrapStrategy: i,
  14105. paddingData: o
  14106. };
  14107. }
  14108. function pa(t) {
  14109. if (!t)
  14110. return {};
  14111. const { ff: e, fs: n, it: r, bl: s, ul: i, st: o, ol: a, cl: u } = t, c = {};
  14112. return e && (c.ff = e), n && (c.fs = n), r && (c.it = r), s && (c.bl = s), i && (c.ul = i), o && (c.st = o), a && (c.ol = a), u && (c.cl = u), c;
  14113. }
  14114. function B_(t, e, n) {
  14115. var i;
  14116. const r = t.getBody();
  14117. if ((i = r.customRanges) != null && i.some((o) => o.rangeType === mn.HYPERLINK))
  14118. return;
  14119. const s = st.customRange.add({
  14120. ranges: [
  14121. {
  14122. startOffset: 0,
  14123. endOffset: r.dataStream.length - 1,
  14124. collapsed: !1
  14125. }
  14126. ],
  14127. rangeId: n,
  14128. rangeType: mn.HYPERLINK,
  14129. body: r,
  14130. properties: {
  14131. url: e,
  14132. refId: n
  14133. }
  14134. });
  14135. s && Ke.apply(r, s.serialize());
  14136. }
  14137. function j_(t) {
  14138. return t != null;
  14139. }
  14140. const H_ = '"Helvetica Neue", Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "Heiti SC", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif';
  14141. function ma(t) {
  14142. const e = gt.ff, n = gt.fs;
  14143. if (!t) {
  14144. const h = `${n}pt ${e}`;
  14145. return {
  14146. fontCache: h,
  14147. fontString: h,
  14148. fontSize: n,
  14149. originFontSize: n,
  14150. fontFamily: e
  14151. };
  14152. }
  14153. let r = Yn.ITALIC;
  14154. (t.it === 0 || t.it === void 0) && (r = Yn.NORMAL);
  14155. let s = Yn.BOLD;
  14156. (t.bl === 0 || t.bl === void 0) && (s = Yn.NORMAL);
  14157. let i = n;
  14158. t.fs && (i = Math.ceil(t.fs));
  14159. let o = e;
  14160. if (t.ff) {
  14161. let h = t.ff;
  14162. h = h.replace(/"/g, "").replace(/'/g, ""), h.indexOf(" ") > -1 && (h = `"${h}"`), h == null && (h = e), o = h;
  14163. }
  14164. const { va: a } = t;
  14165. let u = i;
  14166. if (a === Bt.SUBSCRIPT || a === Bt.SUPERSCRIPT) {
  14167. const h = W_(o, u), { sbr: d, spr: f } = h;
  14168. u *= a === Bt.SUBSCRIPT ? d : f;
  14169. }
  14170. const c = `${r} ${s} ${u}pt ${o}`, l = `${c}, ${H_} `;
  14171. return {
  14172. fontCache: c,
  14173. fontString: l,
  14174. fontSize: u,
  14175. originFontSize: i,
  14176. fontFamily: o
  14177. };
  14178. }
  14179. function W_(t, e) {
  14180. return F_(e);
  14181. }
  14182. function ll(t) {
  14183. const { a: e = 0, v: n = we.FALSE } = t || { a: 0, v: we.FALSE };
  14184. let r = 0, s = e;
  14185. return n === we.TRUE && (r = ga, s = ga), { centerAngle: r, vertexAngle: s };
  14186. }
  14187. class z_ {
  14188. constructor(e, n) {
  14189. C(this, "_columnData", {});
  14190. this._config = e, this._columnData = n;
  14191. }
  14192. /**
  14193. * Get width and hidden status of columns in the sheet
  14194. * @returns
  14195. */
  14196. getColumnData() {
  14197. return this._columnData;
  14198. }
  14199. getColVisible(e) {
  14200. const { _columnData: n } = this, r = n[e];
  14201. return r ? r.hd !== we.TRUE : !0;
  14202. }
  14203. /**
  14204. * Get the column style
  14205. * @param {number} col Column index
  14206. * @returns {string | Nullable<IStyleData>} Style data, may be undefined
  14207. */
  14208. getColumnStyle(e) {
  14209. var n;
  14210. return (n = this._columnData[e]) == null ? void 0 : n.s;
  14211. }
  14212. /**
  14213. * Set the set column default style
  14214. * @param {number} col Column index
  14215. * @param {string | Nullable<IStyleData>} style Style data
  14216. */
  14217. setColumnStyle(e, n) {
  14218. const r = this.getColumnOrCreate(e);
  14219. r.s = n;
  14220. }
  14221. /**
  14222. * Get all hidden columns
  14223. * @param start Start index
  14224. * @param end End index
  14225. * @returns Hidden columns range list
  14226. */
  14227. getHiddenCols(e = 0, n = this.getSize() - 1) {
  14228. const r = [];
  14229. let s = !1, i = -1;
  14230. for (let o = e; o <= n; o++) {
  14231. const a = this.getColVisible(o);
  14232. s && a ? (s = !1, r.push({
  14233. rangeType: De.COLUMN,
  14234. startColumn: i,
  14235. endColumn: o - 1,
  14236. startRow: 0,
  14237. endRow: 0
  14238. })) : !s && !a && (s = !0, i = o);
  14239. }
  14240. return s && r.push({
  14241. startRow: 0,
  14242. endRow: 0,
  14243. startColumn: i,
  14244. endColumn: n,
  14245. rangeType: De.COLUMN
  14246. }), r;
  14247. }
  14248. /**
  14249. * Get all visible columns
  14250. * @param start Start index
  14251. * @param end End index
  14252. * @returns Visible columns range list
  14253. */
  14254. getVisibleCols(e = 0, n = this.getSize() - 1) {
  14255. const r = [];
  14256. let s = !1, i = -1;
  14257. for (let o = e; o <= n; o++) {
  14258. const a = this.getColVisible(o);
  14259. s && !a ? (s = !1, r.push({
  14260. rangeType: De.COLUMN,
  14261. startColumn: i,
  14262. endColumn: o - 1,
  14263. startRow: 0,
  14264. endRow: 0
  14265. })) : !s && a && (s = !0, i = o);
  14266. }
  14267. return s && r.push({
  14268. startRow: 0,
  14269. endRow: 0,
  14270. startColumn: i,
  14271. endColumn: n,
  14272. rangeType: De.COLUMN
  14273. }), r;
  14274. }
  14275. getColumnDatas(e, n) {
  14276. const r = {};
  14277. let s = 0;
  14278. for (let i = e; i < e + n; i++) {
  14279. const o = this.getColumnOrCreate(i);
  14280. r[s] = o, s++;
  14281. }
  14282. return r;
  14283. }
  14284. /**
  14285. * Get count of column in the sheet
  14286. * @returns
  14287. */
  14288. getSize() {
  14289. return fn(this._columnData);
  14290. }
  14291. /**
  14292. * Get the width of column
  14293. * @param columnPos column index
  14294. * @returns
  14295. */
  14296. getColumnWidth(e) {
  14297. const { _columnData: n } = this, r = this._config;
  14298. let s = 0;
  14299. return s = (n[e] || {
  14300. hd: we.FALSE,
  14301. w: r.defaultColumnWidth
  14302. }).w || r.defaultColumnWidth, s;
  14303. }
  14304. /**
  14305. * get given column data
  14306. * @param columnPos column index
  14307. */
  14308. getColumn(e) {
  14309. const n = this._columnData[e];
  14310. if (n)
  14311. return n;
  14312. }
  14313. /**
  14314. * Remove column data of given column
  14315. * @param columnPos
  14316. */
  14317. removeColumn(e) {
  14318. delete this._columnData[e];
  14319. }
  14320. /**
  14321. * get given column data or create a column data when it's null
  14322. * @param columnPos column index
  14323. * @returns {Partial<IColumnData>} columnData
  14324. */
  14325. getColumnOrCreate(e) {
  14326. const { _columnData: n } = this, r = n[e];
  14327. if (r)
  14328. return r;
  14329. const s = {};
  14330. return this._columnData[e] = s, s;
  14331. }
  14332. setCustomMetadata(e, n) {
  14333. const r = this.getColumn(e);
  14334. r && (r.custom = n);
  14335. }
  14336. getCustomMetadata(e) {
  14337. var n;
  14338. return (n = this.getColumn(e)) == null ? void 0 : n.custom;
  14339. }
  14340. }
  14341. class Y_ {
  14342. constructor(e, n, r) {
  14343. C(this, "_rowData");
  14344. this._config = e, this._viewModel = n, this._rowData = r;
  14345. }
  14346. /**
  14347. * Get height and hidden status of columns in the sheet
  14348. * @returns
  14349. */
  14350. getRowData() {
  14351. return this._rowData;
  14352. }
  14353. /**
  14354. * Get the row style
  14355. * @param {number} row Row index
  14356. * @returns {string | Nullable<IStyleData>} Style data, may be undefined
  14357. */
  14358. getRowStyle(e) {
  14359. var n;
  14360. return (n = this._rowData[e]) == null ? void 0 : n.s;
  14361. }
  14362. /**
  14363. * Set row default style
  14364. * @param {number} row The row index
  14365. * @param {string | Nullable<IStyleData>} style The style data
  14366. */
  14367. setRowStyle(e, n) {
  14368. const r = this.getRowOrCreate(e);
  14369. r.s = n;
  14370. }
  14371. getRowDatas(e, n) {
  14372. const r = {};
  14373. let s = 0;
  14374. for (let i = e; i < e + n; i++) {
  14375. const o = this.getRowOrCreate(i);
  14376. r[s] = o, s++;
  14377. }
  14378. return r;
  14379. }
  14380. getRowHeight(e, n = 1) {
  14381. const { _rowData: r } = this, s = this._config;
  14382. let i = 0;
  14383. for (let o = 0; o < n; o++) {
  14384. const a = r[o + e] || {
  14385. hd: we.FALSE,
  14386. h: s.defaultRowHeight
  14387. }, { ia: u, ah: c, h: l = s.defaultRowHeight } = a;
  14388. i += (u == null || u === we.TRUE) && typeof c == "number" ? c : l;
  14389. }
  14390. return i;
  14391. }
  14392. /**
  14393. * Get row data of given row
  14394. * @param rowPos row index
  14395. * @returns {Nullable<Partial<IRowData>>} rowData
  14396. */
  14397. getRow(e) {
  14398. return this._rowData[e];
  14399. }
  14400. /**
  14401. * Remove row data of given row
  14402. * @param rowPos
  14403. */
  14404. removeRow(e) {
  14405. delete this._rowData[e];
  14406. }
  14407. /**
  14408. * Get given row data or create a row data when it's null
  14409. * @param rowPos row index
  14410. * @returns {Partial<IRowData>} rowData
  14411. */
  14412. getRowOrCreate(e) {
  14413. const { _rowData: n } = this, r = n[e];
  14414. if (r)
  14415. return r;
  14416. const s = {};
  14417. return n[e] = s, s;
  14418. }
  14419. /**
  14420. * Get all hidden rows
  14421. * @param start Start index
  14422. * @param end End index
  14423. * @returns Hidden rows range list
  14424. */
  14425. getHiddenRows(e = 0, n = this.getSize() - 1) {
  14426. const r = [];
  14427. let s = !1, i = -1;
  14428. for (let o = e; o <= n; o++) {
  14429. const a = this.getRowRawVisible(o);
  14430. s && a ? (s = !1, r.push({
  14431. startRow: i,
  14432. endRow: o - 1,
  14433. startColumn: 0,
  14434. endColumn: 0,
  14435. rangeType: De.ROW
  14436. })) : !s && !a && (s = !0, i = o);
  14437. }
  14438. return s && r.push({ startRow: i, endRow: n, startColumn: 0, endColumn: 0, rangeType: De.ROW }), r;
  14439. }
  14440. /**
  14441. * Get all visible rows
  14442. * @param start Start index
  14443. * @param end End index
  14444. * @returns Visible rows range list
  14445. */
  14446. getVisibleRows(e = 0, n = this.getSize() - 1) {
  14447. const r = [];
  14448. let s = !1, i = -1;
  14449. for (let o = e; o <= n; o++) {
  14450. const a = this.getRowRawVisible(o);
  14451. s && !a ? (s = !1, r.push({
  14452. startRow: i,
  14453. endRow: o - 1,
  14454. startColumn: 0,
  14455. endColumn: 0,
  14456. rangeType: De.ROW
  14457. })) : !s && a && (s = !0, i = o);
  14458. }
  14459. return s && r.push({ startRow: i, endRow: n, startColumn: 0, endColumn: 0, rangeType: De.ROW }), r;
  14460. }
  14461. getRowRawVisible(e) {
  14462. const n = this.getRow(e);
  14463. return n ? n.hd !== we.TRUE : !0;
  14464. }
  14465. /**
  14466. * Get count of row in the sheet
  14467. * @returns {number} row count
  14468. */
  14469. getSize() {
  14470. return fn(this._rowData);
  14471. }
  14472. setCustomMetadata(e, n) {
  14473. const r = this.getRow(e);
  14474. r && (r.custom = n);
  14475. }
  14476. getCustomMetadata(e) {
  14477. var n;
  14478. return (n = this.getRow(e)) == null ? void 0 : n.custom;
  14479. }
  14480. }
  14481. const lR = "DEFAULT_WORKSHEET_ROW_COUNT", V_ = 1e3, cR = "DEFAULT_WORKSHEET_COLUMN_COUNT", G_ = 20, hR = "DEFAULT_WORKSHEET_ROW_HEIGHT", K_ = 24, dR = "DEFAULT_WORKSHEET_COLUMN_WIDTH", X_ = 88, fR = "DEFAULT_WORKSHEET_ROW_TITLE_WIDTH", J_ = 46, gR = "DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT", Z_ = 20;
  14482. function Q_(t) {
  14483. const e = {
  14484. name: "Sheet1",
  14485. // TODO: name should have i18n
  14486. id: "sheet-01",
  14487. tabColor: "",
  14488. hidden: we.FALSE,
  14489. rowCount: V_,
  14490. columnCount: G_,
  14491. zoomRatio: 1,
  14492. freeze: {
  14493. xSplit: 0,
  14494. ySplit: 0,
  14495. startRow: -1,
  14496. startColumn: -1
  14497. },
  14498. scrollTop: 0,
  14499. scrollLeft: 0,
  14500. defaultColumnWidth: X_,
  14501. defaultRowHeight: K_,
  14502. mergeData: [],
  14503. cellData: {},
  14504. rowData: {},
  14505. columnData: {},
  14506. showGridlines: we.TRUE,
  14507. rowHeader: {
  14508. width: J_,
  14509. hidden: we.FALSE
  14510. },
  14511. columnHeader: {
  14512. height: Z_,
  14513. hidden: we.FALSE
  14514. },
  14515. rightToLeft: we.FALSE
  14516. };
  14517. return Object.keys(e).forEach((n) => {
  14518. const r = n;
  14519. typeof t[r] > "u" && (t[r] = e[r]);
  14520. }), t;
  14521. }
  14522. class q_ extends nt {
  14523. constructor(n) {
  14524. super();
  14525. /**
  14526. * @property Cache for RANGE_TYPE.NORMAL
  14527. */
  14528. C(this, "_cellCache", /* @__PURE__ */ new Map());
  14529. /**
  14530. * @property Cache for RANGE_TYPE.ROW
  14531. */
  14532. C(this, "_rowCache", /* @__PURE__ */ new Map());
  14533. /**
  14534. * @property Cache for RANGE_TYPE.COLUMN
  14535. */
  14536. C(this, "_columnCache", /* @__PURE__ */ new Map());
  14537. /**
  14538. * @property Whether has RANGE_TYPE.ROW
  14539. */
  14540. C(this, "_hasRow", !1);
  14541. /**
  14542. * @property Whether has RANGE_TYPE.COLUMN
  14543. */
  14544. C(this, "_hasColumn", !1);
  14545. /**
  14546. * @property Whether has RANGE_TYPE.ALL
  14547. */
  14548. C(this, "_hasAll", !1);
  14549. /**
  14550. * @property Index for RANGE_TYPE.ALL
  14551. */
  14552. C(this, "_allIndex", -1);
  14553. /**
  14554. * @property the original merge data
  14555. */
  14556. C(this, "_mergeData");
  14557. C(this, "_rangeMap", new Qr(5e4));
  14558. C(this, "_skeletonCache", new Qr(5e4));
  14559. this._init(n.concat());
  14560. }
  14561. _init(n) {
  14562. this._mergeData = n, this._createCache(n);
  14563. }
  14564. _clearCache() {
  14565. this._cellCache.clear(), this._rowCache.clear(), this._columnCache.clear(), this._hasAll = !1, this._allIndex = -1, this._rangeMap.clear(), this._skeletonCache.clear(), this._hasColumn = !1, this._hasRow = !1;
  14566. }
  14567. _createCache(n) {
  14568. let r = 0;
  14569. for (const s of n) {
  14570. const { rangeType: i } = s;
  14571. i === De.ROW ? this._createRowCache(s, r) : i === De.COLUMN ? this._createColumnCache(s, r) : i === De.ALL ? this._createCellAllCache(r) : this._createCellCache(s, r), r++;
  14572. }
  14573. }
  14574. /**
  14575. * Rebuild the merge data cache when the merge data is changed.
  14576. * @param {IRange[]} mergeData
  14577. */
  14578. rebuild(n) {
  14579. this._clearCache(), this._init(n.concat());
  14580. }
  14581. _createRowCache(n, r) {
  14582. const { startRow: s, endRow: i } = n;
  14583. for (let o = s; o <= i; o++)
  14584. this._rowCache.set(o, r), this._hasRow = !0;
  14585. }
  14586. _createColumnCache(n, r) {
  14587. const { startColumn: s, endColumn: i } = n;
  14588. for (let o = s; o <= i; o++)
  14589. this._columnCache.set(o, r), this._hasColumn = !0;
  14590. }
  14591. _createCellAllCache(n) {
  14592. this._hasAll = !0, this._allIndex = n;
  14593. }
  14594. _createCellCache(n, r) {
  14595. for (let s = n.startRow; s <= n.endRow; s++) {
  14596. let i = this._cellCache.get(s);
  14597. i == null && (i = /* @__PURE__ */ new Map(), this._cellCache.set(s, i));
  14598. for (let o = n.startColumn; o <= n.endColumn; o++)
  14599. i.set(o, r);
  14600. }
  14601. }
  14602. add(n) {
  14603. this._mergeData.push(n), this._clearCache(), this._createCache(this._mergeData);
  14604. }
  14605. remove(n, r) {
  14606. const s = this._getMergeDataIndex(n, r);
  14607. s !== -1 && (this._mergeData.splice(s, 1), this._clearCache(), this._createCache(this._mergeData));
  14608. }
  14609. getMergedCell(n, r) {
  14610. const s = this._getMergeDataIndex(n, r);
  14611. return s !== -1 ? this._mergeData[s] : null;
  14612. }
  14613. /**
  14614. * Return index of merge data if (row,col) is in merge range. -1 means not in merge range.
  14615. * @param row
  14616. * @param column
  14617. * @returns {number} index of merge range.
  14618. */
  14619. getMergeDataIndex(n, r) {
  14620. return this._getMergeDataIndex(n, r);
  14621. }
  14622. isRowContainsMergedCell(n) {
  14623. return this._hasAll || !re.isEmptyObject(this._columnCache) ? !0 : this._mergeData.some((r) => r.startRow <= n && n <= r.endRow);
  14624. }
  14625. isColumnContainsMergedCell(n) {
  14626. return this._hasAll || !re.isEmptyObject(this._rowCache) ? !0 : this._mergeData.some((r) => r.startColumn <= n && n <= r.endColumn);
  14627. }
  14628. getMergedCellRange(n, r, s, i) {
  14629. const o = [], a = `${n}-${r}-${s}-${i}`;
  14630. if (this._rangeMap.has(a))
  14631. return this._getRangeFromCache(a);
  14632. let u = 0;
  14633. const c = [];
  14634. for (const l of this._mergeData || [])
  14635. en.intersects(l, {
  14636. startRow: n,
  14637. endRow: s,
  14638. startColumn: r,
  14639. endColumn: i
  14640. }) && (o.push({
  14641. ...l
  14642. }), c.push(u)), u++;
  14643. return this._rangeMap.set(a, c), o;
  14644. }
  14645. /**
  14646. * @deprecated sigificant performance impact, use _getCellMergeInfo instead.
  14647. * @param startRow
  14648. * @param startColumn
  14649. * @param endRow
  14650. * @param endColumn
  14651. */
  14652. getMergedCellRangeForSkeleton(n, r, s, i) {
  14653. const o = [], a = this._mergeData, u = `${n}-${r}-${s}-${i}`;
  14654. if (this._skeletonCache.has(u))
  14655. return this._getSkeletonRangeFromCache(u);
  14656. const c = [];
  14657. for (let l = 0; l < a.length; l++) {
  14658. const {
  14659. startRow: h,
  14660. endRow: d,
  14661. startColumn: f,
  14662. endColumn: E
  14663. } = a[l];
  14664. for (let R = n; R <= s; R++) {
  14665. let O = !1;
  14666. for (let U = r; U <= i; U++)
  14667. if (R >= h && R <= d && U >= f && U <= E) {
  14668. o.push({
  14669. startRow: h,
  14670. endRow: d,
  14671. startColumn: f,
  14672. endColumn: E
  14673. }), c.push(l), O = !0;
  14674. break;
  14675. }
  14676. if (O)
  14677. break;
  14678. }
  14679. }
  14680. return this._skeletonCache.set(u, c), o;
  14681. }
  14682. _getRangeFromCache(n) {
  14683. const r = this._rangeMap.get(n) || [], s = [];
  14684. for (const i of r)
  14685. s.push({
  14686. ...this._mergeData[i]
  14687. });
  14688. return s;
  14689. }
  14690. _getSkeletonRangeFromCache(n) {
  14691. const r = this._skeletonCache.get(n) || [], s = [];
  14692. for (const i of r)
  14693. s.push({
  14694. ...this._mergeData[i]
  14695. });
  14696. return s;
  14697. }
  14698. _getMergeDataIndex(n, r) {
  14699. var i;
  14700. if (this._hasAll)
  14701. return this._allIndex;
  14702. if (this._hasRow) {
  14703. const o = this._rowCache.get(n);
  14704. if (o !== void 0)
  14705. return o;
  14706. }
  14707. if (this._hasColumn) {
  14708. const o = this._columnCache.get(r);
  14709. if (o !== void 0)
  14710. return o;
  14711. }
  14712. const s = (i = this._cellCache.get(n)) == null ? void 0 : i.get(r);
  14713. return s !== void 0 ? s : -1;
  14714. }
  14715. getMergeDataSnapshot() {
  14716. return this._mergeData;
  14717. }
  14718. dispose() {
  14719. this._clearCache(), this._mergeData = [];
  14720. }
  14721. }
  14722. class eE extends nt {
  14723. constructor(n) {
  14724. super();
  14725. C(this, "_cellContentInterceptor", null);
  14726. C(this, "_rowFilteredInterceptor", null);
  14727. this.getRawCell = n;
  14728. }
  14729. dispose() {
  14730. super.dispose(), this._cellContentInterceptor = null, this._rowFilteredInterceptor = null;
  14731. }
  14732. getCell(n, r, s, i) {
  14733. return this._cellContentInterceptor ? this._cellContentInterceptor.getCell(n, r, Vn.Value | Vn.Style, s, i) : this.getRawCell(n, r);
  14734. }
  14735. getCellValueOnly(n, r) {
  14736. return this._cellContentInterceptor ? this._cellContentInterceptor.getCell(n, r, Vn.Value) : this.getRawCell(n, r);
  14737. }
  14738. getCellStyleOnly(n, r) {
  14739. return this._cellContentInterceptor ? this._cellContentInterceptor.getCell(n, r, Vn.Style) : this.getRawCell(n, r);
  14740. }
  14741. getRowFiltered(n) {
  14742. var r, s;
  14743. return (s = (r = this._rowFilteredInterceptor) == null ? void 0 : r.getRowFiltered(n)) != null ? s : !1;
  14744. }
  14745. registerCellContentInterceptor(n) {
  14746. if (this._cellContentInterceptor)
  14747. throw new Error("[SheetViewModel]: Interceptor already registered.");
  14748. return this._cellContentInterceptor = n, Ze(() => this._cellContentInterceptor = null);
  14749. }
  14750. registerRowFilteredInterceptor(n) {
  14751. if (this._rowFilteredInterceptor)
  14752. throw new Error("[SheetViewModel]: Interceptor already registered.");
  14753. return this._rowFilteredInterceptor = n, Ze(() => this._rowFilteredInterceptor = null);
  14754. }
  14755. }
  14756. const _a = {
  14757. isDeepClone: !1,
  14758. displayRawFormula: !1,
  14759. ignoreTextRotation: !1
  14760. };
  14761. class es {
  14762. constructor(e, n, r) {
  14763. C(this, "_sheetId");
  14764. C(this, "_snapshot");
  14765. C(this, "_cellData");
  14766. C(this, "_rowManager");
  14767. C(this, "_columnManager");
  14768. C(this, "_viewModel");
  14769. C(this, "_spanModel");
  14770. var a;
  14771. this.unitId = e, this._styles = r, this._snapshot = Q_(n);
  14772. const { columnData: s, rowData: i, cellData: o } = this._snapshot;
  14773. this._sheetId = (a = this._snapshot.id) != null ? a : re.generateRandomId(6), this._cellData = new kt(o), this._viewModel = new eE((u, c) => this.getCellRaw(u, c)), this._rowManager = new Y_(this._snapshot, this._viewModel, i), this._columnManager = new z_(this._snapshot, s), this._spanModel = new q_(this._snapshot.mergeData);
  14774. }
  14775. /**
  14776. * @internal
  14777. * @param callback
  14778. */
  14779. __interceptViewModel(e) {
  14780. e(this._viewModel);
  14781. }
  14782. getSnapshot() {
  14783. return this._snapshot;
  14784. }
  14785. /**
  14786. * Set the merge data of the sheet, all the merged cells will be rebuilt.
  14787. * @param mergeData
  14788. */
  14789. setMergeData(e) {
  14790. this._snapshot.mergeData = e, this.getSpanModel().rebuild(e);
  14791. }
  14792. getSpanModel() {
  14793. return this._spanModel;
  14794. }
  14795. getStyleDataByHash(e) {
  14796. return { ...this._styles.get(e) };
  14797. }
  14798. setStyleData(e) {
  14799. return this._styles.setValue(e);
  14800. }
  14801. /**
  14802. * Get the style of the column.
  14803. * @param {number} column The column index
  14804. * @param {boolean} [keepRaw] If true, return the raw style data, otherwise return the style data object
  14805. * @returns {Nullable<IStyleData>|string} The style of the column
  14806. */
  14807. getColumnStyle(e, n = !1) {
  14808. return n ? this._columnManager.getColumnStyle(e) : this._styles.get(this._columnManager.getColumnStyle(e));
  14809. }
  14810. /**
  14811. * Set the style of the column.
  14812. * @param {number} column The column index
  14813. * @param {string|Nullable<IStyleData>} style The style to be set
  14814. */
  14815. setColumnStyle(e, n) {
  14816. this._columnManager.setColumnStyle(e, n);
  14817. }
  14818. /**
  14819. * Get the style of the row.
  14820. * @param {number} row The row index
  14821. * @param {boolean} [keepRaw] If true, return the raw style data, otherwise return the style data object
  14822. * @returns {Nullable<IStyleData>} The style of the row
  14823. */
  14824. getRowStyle(e, n = !1) {
  14825. return n ? this._rowManager.getRowStyle(e) : this._styles.get(this._rowManager.getRowStyle(e));
  14826. }
  14827. /**
  14828. * Set the style of the row.
  14829. * @param {number} row
  14830. * @param {string|Nullable<IStyleData>} style The style to be set
  14831. */
  14832. setRowStyle(e, n) {
  14833. this._rowManager.setRowStyle(e, n);
  14834. }
  14835. /**
  14836. * this function is used to mixin default style to cell raw{number}
  14837. * @param {number} row The row index
  14838. * @param {number} col The column index
  14839. * @param cellRaw The cell raw data
  14840. * @param {boolean} isRowStylePrecedeColumnStyle The priority of row style and column style
  14841. */
  14842. mixinDefaultStyleToCellRaw(e, n, r, s) {
  14843. const i = this.getColumnStyle(n), o = this.getRowStyle(e), a = this.getDefaultCellStyleInternal();
  14844. if (a || i || o) {
  14845. let u = r == null ? void 0 : r.s;
  14846. typeof u == "string" && (u = this._styles.get(u));
  14847. const c = s ? Mo(a, i, o, u) : Mo(a, o, i, u);
  14848. r || (r = {}), r.s = c;
  14849. }
  14850. }
  14851. /**
  14852. * Get the default style of the worksheet.
  14853. * @returns {Nullable<IStyleData>} Default Style
  14854. */
  14855. getDefaultCellStyle() {
  14856. return this._snapshot.defaultStyle;
  14857. }
  14858. getDefaultCellStyleInternal() {
  14859. const e = this._snapshot.defaultStyle;
  14860. return this._styles.get(e);
  14861. }
  14862. /**
  14863. * Set Default Style, if the style has been set, all cells style will be base on this style.
  14864. * @param {Nullable<IStyleData>} style The style to be set as default style
  14865. */
  14866. setDefaultCellStyle(e) {
  14867. this._snapshot.defaultStyle = e;
  14868. }
  14869. /**
  14870. * Returns WorkSheet Cell Data Matrix
  14871. * @returns WorkSheet Cell Data Matrix
  14872. */
  14873. getCellMatrix() {
  14874. return this._cellData;
  14875. }
  14876. /**
  14877. * Get worksheet printable cell range.
  14878. * @returns
  14879. */
  14880. // eslint-disable-next-line max-lines-per-function
  14881. getCellMatrixPrintRange() {
  14882. const e = this.getCellMatrix(), n = this.getMergeData();
  14883. let r = -1, s = -1, i = -1, o = -1, a = !1, u = !1;
  14884. return e.forEach((c, l) => {
  14885. Object.keys(l).forEach((h) => {
  14886. const d = +h, f = e.getValue(c, d), E = f != null && f.s ? this._styles.get(f.s) : null, R = (E == null ? void 0 : E.bd) && (E.bd.b || E.bd.l || E.bd.r || E.bd.t || E.bd.bc_tr || E.bd.bl_tr || E.bd.ml_tr || E.bd.tl_bc || E.bd.tl_br || E.bd.tl_mr);
  14887. (f && (f.v || f.p) || E != null && E.bg || R) && (a ? r = Math.min(r, c) : (r = c, a = !0), s = Math.max(s, c), u ? i = Math.min(i, d) : (u = !0, i = d), o = Math.max(o, d));
  14888. });
  14889. }), n.forEach((c) => {
  14890. a ? r = Math.min(r, c.startRow) : (r = c.startRow, a = !0), s = Math.max(s, c.endRow), u ? i = Math.min(i, c.startColumn) : (i = c.startColumn, a = !0), o = Math.max(o, c.endColumn);
  14891. }), !a || !u ? null : {
  14892. startColumn: i,
  14893. startRow: r,
  14894. endColumn: o,
  14895. endRow: s
  14896. };
  14897. }
  14898. /**
  14899. * Returns Row Manager
  14900. * @returns Row Manager
  14901. */
  14902. getRowManager() {
  14903. return this._rowManager;
  14904. }
  14905. /**
  14906. * Returns the ID of its parent unit.
  14907. */
  14908. getUnitId() {
  14909. return this.unitId;
  14910. }
  14911. /**
  14912. * Returns the ID of the sheet represented by this object.
  14913. * @returns ID of the sheet
  14914. */
  14915. getSheetId() {
  14916. return this._sheetId;
  14917. }
  14918. /**
  14919. * Returns Column Manager
  14920. * @returns Column Manager
  14921. */
  14922. getColumnManager() {
  14923. return this._columnManager;
  14924. }
  14925. /**
  14926. * Returns the name of the sheet.
  14927. * @returns name of the sheet
  14928. */
  14929. getName() {
  14930. return this._snapshot.name;
  14931. }
  14932. /**
  14933. * Returns WorkSheet Clone Object
  14934. * @returns WorkSheet Clone Object
  14935. * @deprecated
  14936. */
  14937. clone() {
  14938. const { _snapshot: e } = this, n = re.deepClone(e);
  14939. return new es(this.unitId, n, this._styles);
  14940. }
  14941. /**
  14942. * Get the merged cell list of the sheet.
  14943. * @returns {IRange[]} merged cell list
  14944. */
  14945. getMergeData() {
  14946. return this._spanModel.getMergeDataSnapshot();
  14947. }
  14948. /**
  14949. * Get the merged cell Range of the sheet cell.
  14950. * If (row, col) is not in a merged cell, return null
  14951. *
  14952. * @param {number} row The row index of test cell
  14953. * @param {number} col The column index of test cell
  14954. * @returns {Nullable<IRange>} The merged cell range of the cell, if the cell is not in a merged cell, return null
  14955. */
  14956. getMergedCell(e, n) {
  14957. return this._spanModel.getMergedCell(e, n);
  14958. }
  14959. /**
  14960. * Get the merged cell info list which has intersection with the given range.
  14961. * @param {number} startRow The start row index of the range
  14962. * @param {number} startColumn The start column index of the range
  14963. * @param {number} endRow The end row index of the range
  14964. * @param {number} endColumn The end column index of the range
  14965. * @returns {IRange} The merged cell info list which has intersection with the given range or empty array if no merged cell in the range
  14966. */
  14967. getMergedCellRange(e, n, r, s) {
  14968. return this._spanModel.getMergedCellRange(e, n, r, s);
  14969. }
  14970. /**
  14971. * Get if the row contains merged cell
  14972. * @param {number} row The row index
  14973. * @returns {boolean} Is merge cell across row
  14974. */
  14975. isRowContainsMergedCell(e) {
  14976. return this._spanModel.isRowContainsMergedCell(e);
  14977. }
  14978. /**
  14979. * Get if the column contains merged cell
  14980. * @param {number} column The column index
  14981. * @returns {boolean} Is merge cell across column
  14982. */
  14983. isColumnContainsMergedCell(e) {
  14984. return this._spanModel.isColumnContainsMergedCell(e);
  14985. }
  14986. /**
  14987. * Get cell info with merge data
  14988. * @param {number} row - The row index of the cell.
  14989. * @param {number} column - The column index of the cell.
  14990. * @type {selectionCell}
  14991. * @property {number} actualRow - The actual row index of the cell
  14992. * @property {number} actualColumn - The actual column index of the cell
  14993. * @property {boolean} isMergedMainCell - Whether the cell is the main cell of the merged cell, only the upper left cell in the merged cell returns true here
  14994. * @property {boolean} isMerged - Whether the cell is in a merged cell, the upper left cell in the merged cell returns false here
  14995. * @property {number} endRow - The end row index of the merged cell
  14996. * @property {number} endColumn - The end column index of the merged cell
  14997. * @property {number} startRow - The start row index of the merged cell
  14998. * @property {number} startColumn - The start column index of the merged cell
  14999. * @returns {selectionCell} - The cell info with merge data
  15000. */
  15001. getCellInfoInMergeData(e, n) {
  15002. const r = this.getMergedCell(e, n);
  15003. let s = !1, i = !1, o = e, a = n, u = e, c = n;
  15004. if (r) {
  15005. const {
  15006. startRow: l,
  15007. endRow: h,
  15008. startColumn: d,
  15009. endColumn: f
  15010. } = r;
  15011. e === l && n === d ? (o = h, a = f, u = l, c = d, i = !0) : e >= l && e <= h && n >= d && n <= f && (o = h, a = f, u = l, c = d, s = !0);
  15012. }
  15013. return {
  15014. actualRow: e,
  15015. actualColumn: n,
  15016. isMergedMainCell: i,
  15017. isMerged: s,
  15018. endRow: o,
  15019. endColumn: a,
  15020. startRow: u,
  15021. startColumn: c
  15022. };
  15023. }
  15024. /**
  15025. * Get cellData, includes cellData, customRender, markers, dataValidate, etc.
  15026. *
  15027. * WARNING: All sheet CELL_CONTENT interceptors will be called in this method, cause performance issue.
  15028. * example: this._sheetInterceptorService.intercept(INTERCEPTOR_POINT.CELL_CONTENT);
  15029. *
  15030. * @param row
  15031. * @param col
  15032. * @returns ICellDataForSheetInterceptor
  15033. */
  15034. getCell(e, n) {
  15035. return e < 0 || n < 0 ? null : this._viewModel.getCell(e, n);
  15036. }
  15037. /**
  15038. * Get cellData only use effect on value interceptor
  15039. * @param {number} number row The row index of the cell.
  15040. * @param {number} number col The column index of the cell.
  15041. * @returns {Nullable<ICellDataForSheetInterceptor>} The cell data only use effect on value interceptor
  15042. */
  15043. getCellValueOnly(e, n) {
  15044. return e < 0 || n < 0 ? null : this._viewModel.getCellValueOnly(e, n);
  15045. }
  15046. /**
  15047. * Get cellData only use effect on style interceptor
  15048. * @param {number} row The row index of the cell.
  15049. * @param {number} col The column index of the cell.
  15050. * @returns {Nullable<ICellDataForSheetInterceptor>} The cell data only use effect on style interceptor
  15051. */
  15052. getCellStyleOnly(e, n) {
  15053. return e < 0 || n < 0 ? null : this._viewModel.getCellStyleOnly(e, n);
  15054. }
  15055. getCellRaw(e, n) {
  15056. return this.getCellMatrix().getValue(e, n);
  15057. }
  15058. // eslint-disable-next-line ts/no-explicit-any
  15059. getCellWithFilteredInterceptors(e, n, r, s) {
  15060. return this._viewModel.getCell(e, n, r, s);
  15061. }
  15062. getRowFiltered(e) {
  15063. return this._viewModel.getRowFiltered(e);
  15064. }
  15065. getMatrixWithMergedCells(e, n, r, s, i = zn.Raw) {
  15066. const o = this.getCellMatrix(), a = this._spanModel.getMergedCellRange(e, n, r, s), u = new kt();
  15067. return Qo(e, r, n, s).forEach((c, l) => {
  15068. var d;
  15069. let h;
  15070. if (i === zn.Raw)
  15071. h = this.getCellRaw(c, l);
  15072. else if (i === zn.Intercepted)
  15073. h = this.getCell(c, l);
  15074. else if (i === zn.Both) {
  15075. const f = this.getCellRaw(c, l);
  15076. if (f) {
  15077. h = { ...f };
  15078. const E = (d = this.getCell(c, l)) == null ? void 0 : d.v;
  15079. j_(E) && h && (h.displayV = String(E));
  15080. }
  15081. }
  15082. h && u.setValue(c, l, h);
  15083. }), a.forEach((c) => {
  15084. const { startColumn: l, startRow: h, endColumn: d, endRow: f } = c;
  15085. Qo(h, f, l, d).forEach((E, R) => {
  15086. E === h && R === l && u.setValue(E, R, {
  15087. ...o.getValue(E, R),
  15088. rowSpan: f - h + 1,
  15089. colSpan: d - l + 1
  15090. }), (E !== h || R !== l) && u.realDeleteValue(E, R);
  15091. });
  15092. }), u;
  15093. }
  15094. getRange(e, n, r, s) {
  15095. return typeof e == "object" ? new tr(this, e, {
  15096. getStyles: () => this._styles
  15097. }) : new tr(
  15098. this,
  15099. {
  15100. startRow: e,
  15101. startColumn: n,
  15102. endColumn: s || n,
  15103. endRow: r || e
  15104. },
  15105. {
  15106. getStyles: () => this._styles
  15107. }
  15108. );
  15109. }
  15110. getScrollLeftTopFromSnapshot() {
  15111. return {
  15112. scrollLeft: this._snapshot.scrollLeft,
  15113. scrollTop: this._snapshot.scrollTop
  15114. };
  15115. }
  15116. /**
  15117. * Return WorkSheetZoomRatio
  15118. * @return zoomRatio
  15119. */
  15120. getZoomRatio() {
  15121. return this._snapshot.zoomRatio || 1;
  15122. }
  15123. /**
  15124. * Returns WorkSheet Configures
  15125. * @returns WorkSheet Configures
  15126. */
  15127. getConfig() {
  15128. return this._snapshot;
  15129. }
  15130. /**
  15131. * Returns frozen.
  15132. * @returns frozen
  15133. */
  15134. getFreeze() {
  15135. return this._snapshot.freeze;
  15136. }
  15137. /**
  15138. * Returns the current number of columns in the sheet, regardless of content.
  15139. * @returns the current number of columns in the sheet, regardless of content
  15140. */
  15141. getMaxColumns() {
  15142. const { _snapshot: e } = this, { columnCount: n } = e;
  15143. return n;
  15144. }
  15145. /**
  15146. * Returns the current number of rows in the sheet, regardless of content.
  15147. * @returns the current number of rows in the sheet, regardless of content
  15148. */
  15149. getMaxRows() {
  15150. const { _snapshot: e } = this, { rowCount: n } = e;
  15151. return n;
  15152. }
  15153. getRowCount() {
  15154. return this._snapshot.rowCount;
  15155. }
  15156. setRowCount(e) {
  15157. this._snapshot.rowCount = e;
  15158. }
  15159. getColumnCount() {
  15160. return this._snapshot.columnCount;
  15161. }
  15162. setColumnCount(e) {
  15163. this._snapshot.columnCount = e;
  15164. }
  15165. /**
  15166. * isSheetHidden
  15167. * @returns hidden status of sheet
  15168. */
  15169. isSheetHidden() {
  15170. return this._snapshot.hidden;
  15171. }
  15172. /**
  15173. * Returns true if the sheet's gridlines are hidden; otherwise returns false. Gridlines are visible by default.
  15174. * @returns {boolean} Gridlines Hidden Status.
  15175. */
  15176. hasHiddenGridlines() {
  15177. const { _snapshot: e } = this, { showGridlines: n } = e;
  15178. return n === 0;
  15179. }
  15180. /**
  15181. * Returns the color of the gridlines, or undefined if the gridlines are not colored.
  15182. * @returns {string | undefined} returns the color of the gridlines, or undefined if the gridlines are default.
  15183. */
  15184. getGridlinesColor() {
  15185. return this.getConfig().gridlinesColor;
  15186. }
  15187. /**
  15188. * Gets the sheet tab color, or null if the sheet tab has no color.
  15189. * @returns the sheet tab color or null
  15190. */
  15191. getTabColor() {
  15192. const { _snapshot: e } = this, { tabColor: n } = e;
  15193. return n;
  15194. }
  15195. /**
  15196. * Gets the width in pixels of the given column.
  15197. * @param columnPosition column index
  15198. * @returns Gets the width in pixels of the given column.
  15199. */
  15200. getColumnWidth(e) {
  15201. return this.getColumnManager().getColumnWidth(e);
  15202. }
  15203. /**
  15204. * Gets the height in pixels of the given row.
  15205. * @param row row index
  15206. * @returns Gets the height in pixels of the given row.
  15207. */
  15208. getRowHeight(e) {
  15209. return this._viewModel.getRowFiltered(e) ? 0 : this.getRowManager().getRowHeight(e);
  15210. }
  15211. /**
  15212. * Row is filtered out, that means this row is invisible.
  15213. * @param row
  15214. * @returns {boolean} is row hidden by filter
  15215. */
  15216. isRowFiltered(e) {
  15217. return this._viewModel.getRowFiltered(e);
  15218. }
  15219. /**
  15220. * Get if the row is visible. It may be affected by features like filter and view.
  15221. * @param row the row index
  15222. * @returns {boolean} if the row in visible to the user
  15223. */
  15224. getRowVisible(e) {
  15225. return !this.isRowFiltered(e) && this.getRowRawVisible(e);
  15226. }
  15227. /**
  15228. * Get if the row does not have `hidden` property. This value won't affected by features like filter and view.
  15229. * @param row the row index
  15230. * @returns if the row does not have `hidden` property
  15231. */
  15232. getRowRawVisible(e) {
  15233. return this.getRowManager().getRowRawVisible(e);
  15234. }
  15235. getHiddenRows(e, n) {
  15236. const r = this.getMaxColumns() - 1, s = this._rowManager.getHiddenRows(e, n);
  15237. return s.forEach((i) => i.endColumn = r), s;
  15238. }
  15239. getColVisible(e) {
  15240. return this._columnManager.getColVisible(e);
  15241. }
  15242. getHiddenCols(e, n) {
  15243. const r = this.getMaxRows() - 1, s = this._columnManager.getHiddenCols(e, n);
  15244. return s.forEach((i) => i.endRow = r), s;
  15245. }
  15246. /**
  15247. * Get all visible rows in the sheet.(not include filter & view, like getRawVisibleRows)
  15248. * @returns Visible rows range list
  15249. */
  15250. getVisibleRows() {
  15251. const e = this.getRowCount();
  15252. return this._rowManager.getVisibleRows(0, e - 1);
  15253. }
  15254. /**
  15255. * Get all visible columns in the sheet.(not include filter & view)
  15256. * @returns Visible columns range list
  15257. */
  15258. getVisibleCols() {
  15259. const e = this.getColumnCount();
  15260. return this._columnManager.getVisibleCols(0, e - 1);
  15261. }
  15262. /**
  15263. * Returns true if this sheet layout is right-to-left. Returns false if the sheet uses the default left-to-right layout.
  15264. * @returns true if this sheet layout is right-to-left. Returns false if the sheet uses the default left-to-right layout.
  15265. */
  15266. isRightToLeft() {
  15267. const { _snapshot: e } = this, { rightToLeft: n } = e;
  15268. return n;
  15269. }
  15270. /**
  15271. * Returns the position of the last row that has content.
  15272. * @returns the position of the last row that has content.
  15273. */
  15274. getLastRowWithContent() {
  15275. return this._cellData.getLength() - 1;
  15276. }
  15277. /**
  15278. * Returns the position of the last column that has content.
  15279. * @returns the position of the last column that has content.
  15280. */
  15281. getLastColumnWithContent() {
  15282. return this._cellData.getRange().endColumn;
  15283. }
  15284. getDataRangeScope() {
  15285. return this._cellData.getStartEndScope();
  15286. }
  15287. cellHasValue(e) {
  15288. return e && (e.v !== void 0 || e.f !== void 0 || e.p !== void 0);
  15289. }
  15290. // #region iterators
  15291. // NOTE: performance intensive. Should keep an eye on methods in this region.
  15292. /**
  15293. * Iterate a range row by row.
  15294. *
  15295. * Performance intensive.
  15296. *
  15297. * @param range the iterate range
  15298. * @param skipEmpty whether to skip empty cells, default to be `true`
  15299. */
  15300. iterateByRow(e, n = !0) {
  15301. const { startRow: r, startColumn: s, endRow: i, endColumn: o } = e, a = this;
  15302. return {
  15303. [Symbol.iterator]: () => {
  15304. let u = r, c = s;
  15305. return {
  15306. next() {
  15307. for (; ; ) {
  15308. if (c > o && (u += 1, c = s), u > i)
  15309. return { done: !0, value: void 0 };
  15310. const l = a.getCell(u, c), h = !l, d = a.getMergedCell(u, c);
  15311. if (d) {
  15312. if (u !== d.startRow || c !== d.startColumn) {
  15313. c = d.endColumn + 1;
  15314. continue;
  15315. }
  15316. if (h && n) {
  15317. c = d.endColumn + 1;
  15318. continue;
  15319. }
  15320. const E = { row: u, col: c, value: l };
  15321. return E.colSpan = d.endColumn - d.startColumn + 1, E.rowSpan = d.endRow - d.startRow + 1, c = d.endColumn + 1, { done: !1, value: E };
  15322. }
  15323. if (h && n)
  15324. c += 1;
  15325. else {
  15326. const f = { row: u, col: c, value: l };
  15327. return c += 1, { done: !1, value: f };
  15328. }
  15329. }
  15330. }
  15331. };
  15332. }
  15333. };
  15334. }
  15335. /**
  15336. * Iterate a range column by column. This is pretty similar to `iterateByRow` but with different order.
  15337. *
  15338. * Performance intensive.
  15339. *
  15340. * @param range The iterate range.
  15341. * @param skipEmpty Whether to skip empty cells, default to be `true`.
  15342. * @param skipNonTopLeft Whether to skip non-top-left cells of merged cells, default to be `true`. If the
  15343. * parameter is set to `false`, the iterator will return cells in the top row.
  15344. */
  15345. iterateByColumn(e, n = !0, r = !0) {
  15346. const { startRow: s, startColumn: i, endRow: o, endColumn: a } = e, u = this;
  15347. return {
  15348. [Symbol.iterator]: () => {
  15349. let c = s, l = i;
  15350. return {
  15351. next() {
  15352. for (; ; ) {
  15353. if (c > o && (l += 1, c = s), l > a)
  15354. return { done: !0, value: void 0 };
  15355. const h = u.getMergedCell(c, l);
  15356. if (h) {
  15357. const E = c !== h.startRow, R = E || l !== h.startColumn;
  15358. if (r && R || !r && E) {
  15359. c = h.endRow + 1;
  15360. continue;
  15361. }
  15362. const O = u.getCell(h.startRow, h.startColumn);
  15363. if (!O && n) {
  15364. c = h.endRow + 1;
  15365. continue;
  15366. }
  15367. const ne = { row: c, col: h.startColumn, value: O };
  15368. return ne.colSpan = h.endColumn - h.startColumn + 1, ne.rowSpan = h.endRow - h.startRow + 1, c = h.endRow + 1, { done: !1, value: ne };
  15369. }
  15370. const d = u.getCell(c, l);
  15371. if (!d && n)
  15372. c += 1;
  15373. else {
  15374. const E = { row: c, col: l, value: d };
  15375. return c += 1, { done: !1, value: E };
  15376. }
  15377. }
  15378. }
  15379. };
  15380. }
  15381. };
  15382. }
  15383. /**
  15384. * This method generates a document model based on the cell's properties and handles the associated styles and configurations.
  15385. * If the cell does not exist, it will return null.
  15386. * PS: This method has significant impact on performance.
  15387. * @param cell
  15388. * @param options
  15389. */
  15390. // eslint-disable-next-line complexity, max-lines-per-function
  15391. _getCellDocumentModel(e, n = _a) {
  15392. var R;
  15393. const { isDeepClone: r, displayRawFormula: s, ignoreTextRotation: i } = {
  15394. ..._a,
  15395. ...n
  15396. }, o = this._styles.getStyleByCell(e);
  15397. if (!e)
  15398. return;
  15399. let a, u = "document";
  15400. const c = $_(o), l = i ? gt.tr : c.textRotation || gt.tr;
  15401. let h = c.horizontalAlign || gt.ht;
  15402. const d = c.verticalAlign || gt.vt, f = c.wrapStrategy || gt.tb, E = c.paddingData || ti;
  15403. if (e.f && s)
  15404. a = Sr(e.f.toString(), {}, { verticalAlign: d }), h = gt.ht;
  15405. else if (e.p) {
  15406. const { centerAngle: O, vertexAngle: U } = ll(l);
  15407. a = this._updateConfigAndGetDocumentModel(
  15408. r ? re.deepClone(e.p) : e.p,
  15409. h,
  15410. E,
  15411. {
  15412. horizontalAlign: h,
  15413. verticalAlign: d,
  15414. centerAngle: O,
  15415. vertexAngle: U,
  15416. wrapStrategy: f,
  15417. zeroWidthParagraphBreak: 1
  15418. }
  15419. );
  15420. } else if (e.v != null) {
  15421. const O = pa(o);
  15422. u = ma(O).fontCache;
  15423. let U = tE(e);
  15424. e.t === dn.FORCE_STRING && s && (U = `'${U}`), a = Sr(U, O, {
  15425. ...c,
  15426. textRotation: l,
  15427. cellValueType: e.t
  15428. });
  15429. }
  15430. return a && e.linkUrl && e.linkId && B_(a, e.linkUrl, e.linkId), {
  15431. documentModel: a,
  15432. fontString: u,
  15433. textRotation: l,
  15434. wrapStrategy: f,
  15435. verticalAlign: d,
  15436. horizontalAlign: h,
  15437. paddingData: E,
  15438. fill: (R = o == null ? void 0 : o.bg) == null ? void 0 : R.rgb
  15439. };
  15440. }
  15441. _updateConfigAndGetDocumentModel(e, n, r, s) {
  15442. var o, a, u, c, l;
  15443. if (!s || !((o = e.body) != null && o.dataStream))
  15444. return;
  15445. e.documentStyle || (e.documentStyle = {}), e.documentStyle.marginTop = (a = r.t) != null ? a : 0, e.documentStyle.marginBottom = (u = r.b) != null ? u : 2, e.documentStyle.marginLeft = (c = r.l) != null ? c : 2, e.documentStyle.marginRight = (l = r.r) != null ? l : 2, e.documentStyle.pageSize = {
  15446. width: Number.POSITIVE_INFINITY,
  15447. height: Number.POSITIVE_INFINITY
  15448. }, e.documentStyle.renderConfig = {
  15449. ...e.documentStyle.renderConfig,
  15450. ...s
  15451. };
  15452. const i = e.body.paragraphs || [];
  15453. for (const h of i)
  15454. h.paragraphStyle || (h.paragraphStyle = {}), h.paragraphStyle.horizontalAlign = n;
  15455. return new jt(e);
  15456. }
  15457. /**
  15458. * Only used for cell edit, and no need to rotate text when edit cell content!
  15459. */
  15460. getBlankCellDocumentModel(e) {
  15461. const n = this._getCellDocumentModel(e, { ignoreTextRotation: !0 }), r = this._styles.getStyleByCell(e), s = pa(r);
  15462. if (n != null)
  15463. return n.documentModel == null && (n.documentModel = Sr("", s)), n;
  15464. const i = "";
  15465. let o = "document";
  15466. const a = gt.tr, u = gt.ht, c = gt.vt, l = gt.tb, h = ti;
  15467. return o = ma({}).fontCache, {
  15468. documentModel: Sr(i, s),
  15469. fontString: o,
  15470. textRotation: a,
  15471. wrapStrategy: l,
  15472. verticalAlign: c,
  15473. horizontalAlign: u,
  15474. paddingData: h
  15475. };
  15476. }
  15477. // Only used for cell edit, and no need to rotate text when edit cell content!
  15478. getCellDocumentModelWithFormula(e) {
  15479. return this._getCellDocumentModel(e, {
  15480. isDeepClone: !0,
  15481. displayRawFormula: !0,
  15482. ignoreTextRotation: !0
  15483. });
  15484. }
  15485. /**
  15486. * Get custom metadata of worksheet
  15487. * @returns {CustomData | undefined} custom metadata
  15488. */
  15489. getCustomMetadata() {
  15490. return this._snapshot.custom;
  15491. }
  15492. /**
  15493. * Set custom metadata of workbook
  15494. * @param {CustomData | undefined} custom custom metadata
  15495. */
  15496. setCustomMetadata(e) {
  15497. this._snapshot.custom = e;
  15498. }
  15499. }
  15500. function tE(t) {
  15501. var r, s;
  15502. if (!t)
  15503. return "";
  15504. const e = (s = (r = t.p) == null ? void 0 : r.body) == null ? void 0 : s.dataStream;
  15505. if (e)
  15506. return st.transform.getPlainText(e);
  15507. const n = t.v;
  15508. return typeof n == "string" ? t.t === dn.BOOLEAN ? n.toUpperCase() : n.replace(/[\r\n]/g, "") : typeof n == "number" ? t.t === dn.BOOLEAN ? n ? "TRUE" : "FALSE" : n.toString() : typeof n == "boolean" ? n ? "TRUE" : "FALSE" : "";
  15509. }
  15510. function pR(t) {
  15511. if (t === null)
  15512. return "";
  15513. if (t != null && t.p) {
  15514. const e = t == null ? void 0 : t.p.body;
  15515. if (e == null)
  15516. return "";
  15517. const n = e.dataStream;
  15518. return st.transform.getPlainText(n);
  15519. }
  15520. return t == null ? void 0 : t.v;
  15521. }
  15522. var nE = Object.defineProperty, rE = Object.getOwnPropertyDescriptor, sE = (t, e, n, r) => {
  15523. for (var s = r > 1 ? void 0 : r ? rE(e, n) : e, i = t.length - 1, o; i >= 0; i--)
  15524. (o = t[i]) && (s = (r ? o(e, n, s) : o(s)) || s);
  15525. return r && s && nE(e, n, s), s;
  15526. }, iE = (t, e) => (n, r) => e(n, r, t);
  15527. function mR(t, e) {
  15528. return `${t.getUnitId()}|${e.getSheetId()}`;
  15529. }
  15530. let ts = class extends Ui {
  15531. constructor(e = {}, n) {
  15532. super();
  15533. C(this, "type", Fe.UNIVER_SHEET);
  15534. C(this, "_sheetCreated$", new _t());
  15535. C(this, "sheetCreated$", this._sheetCreated$.asObservable());
  15536. C(this, "_sheetDisposed$", new _t());
  15537. C(this, "sheetDisposed$", this._sheetDisposed$.asObservable());
  15538. C(this, "_activeSheet$", new lt(null));
  15539. C(this, "activeSheet$", this._activeSheet$.asObservable());
  15540. /**
  15541. * sheets list
  15542. * @private
  15543. */
  15544. C(this, "_worksheets");
  15545. /**
  15546. * Common style
  15547. * @private
  15548. */
  15549. C(this, "_styles");
  15550. /**
  15551. * number format
  15552. * @private
  15553. */
  15554. // private _formatManage: FormatManager;
  15555. C(this, "_snapshot");
  15556. C(this, "_unitId");
  15557. C(this, "_count");
  15558. C(this, "_name$");
  15559. C(this, "name$");
  15560. this._logService = n;
  15561. const r = P_();
  15562. re.isEmptyObject(e) ? this._snapshot = r : this._snapshot = re.commonExtend(r, e);
  15563. const { styles: s } = this._snapshot;
  15564. (this._snapshot.id == null || this._snapshot.id.length === 0) && (this._snapshot.id = re.generateRandomId(6)), this._unitId = this._snapshot.id, this._styles = new k_(s), this._count = 1, this._worksheets = /* @__PURE__ */ new Map(), this._name$ = new lt(e.name || ""), this.name$ = this._name$.asObservable(), this._parseWorksheetSnapshots();
  15565. }
  15566. get _activeSheet() {
  15567. return this._activeSheet$.getValue();
  15568. }
  15569. get name() {
  15570. return this._name$.getValue();
  15571. }
  15572. static isIRangeType(e) {
  15573. return typeof e == "string" || "startRow" in e || "row" in e;
  15574. }
  15575. dispose() {
  15576. super.dispose(), this._sheetCreated$.complete(), this._sheetDisposed$.complete(), this._activeSheet$.complete(), this._name$.complete();
  15577. }
  15578. /**
  15579. * Create a clone of the current snapshot.
  15580. * Call resourceLoaderService.saveWorkbook to save the data associated with the current plugin if needed.
  15581. * @memberof Workbook
  15582. */
  15583. save() {
  15584. return re.deepClone(this._snapshot);
  15585. }
  15586. /**
  15587. * Get current snapshot reference.
  15588. * Call resourceLoaderService.saveWorkbook to save the data associated with the current plugin if needed.
  15589. * @return {*} {IWorkbookData}
  15590. * @memberof Workbook
  15591. */
  15592. getSnapshot() {
  15593. return this._snapshot;
  15594. }
  15595. /** @deprecated use use name property instead */
  15596. getName() {
  15597. return this._snapshot.name;
  15598. }
  15599. setName(e) {
  15600. this._name$.next(e), this._snapshot.name = e;
  15601. }
  15602. getUnitId() {
  15603. return this._unitId;
  15604. }
  15605. getRev() {
  15606. var e;
  15607. return (e = this._snapshot.rev) != null ? e : 1;
  15608. }
  15609. incrementRev() {
  15610. this._snapshot.rev = this.getRev() + 1;
  15611. }
  15612. setRev(e) {
  15613. this._snapshot.rev = e;
  15614. }
  15615. /**
  15616. * Add a Worksheet into Workbook.
  15617. */
  15618. addWorksheet(e, n, r) {
  15619. const { sheets: s, sheetOrder: i } = this._snapshot;
  15620. if (s[e])
  15621. return !1;
  15622. s[e] = r, i.splice(n, 0, e);
  15623. const o = new es(this._unitId, r, this._styles);
  15624. return this._worksheets.set(e, o), this._sheetCreated$.next(o), !0;
  15625. }
  15626. getSheetOrders() {
  15627. return this._snapshot.sheetOrder;
  15628. }
  15629. getWorksheets() {
  15630. return this._worksheets;
  15631. }
  15632. getActiveSpreadsheet() {
  15633. return this;
  15634. }
  15635. getStyles() {
  15636. return this._styles;
  15637. }
  15638. getConfig() {
  15639. return this._snapshot;
  15640. }
  15641. getIndexBySheetId(e) {
  15642. const { sheetOrder: n } = this._snapshot;
  15643. return n.findIndex((r) => r === e);
  15644. }
  15645. getActiveSheet(e) {
  15646. if (!this._activeSheet && typeof e > "u")
  15647. throw new Error(`[Workbook]: no active Worksheet on Workbook ${this._unitId}!`);
  15648. return this._activeSheet;
  15649. }
  15650. /**
  15651. * If there is no active sheet, the first sheet would
  15652. * be set active.
  15653. * @returns
  15654. */
  15655. ensureActiveSheet() {
  15656. const e = this._activeSheet;
  15657. if (e)
  15658. return e;
  15659. const n = this._snapshot.sheetOrder;
  15660. for (let s = 0, i = n.length; s < i; s++) {
  15661. const o = this._worksheets.get(n[s]);
  15662. if (o && o.isSheetHidden() !== we.TRUE)
  15663. return this.setActiveSheet(o), o;
  15664. }
  15665. const r = this._worksheets.get(n[0]);
  15666. return this.setActiveSheet(r), r;
  15667. }
  15668. /**
  15669. * ActiveSheet should not be null!
  15670. * There is at least one sheet in a workbook. You can not delete all sheets in a workbook.
  15671. * @param worksheet
  15672. */
  15673. setActiveSheet(e) {
  15674. this._activeSheet$.next(e);
  15675. }
  15676. removeSheet(e) {
  15677. const n = this._worksheets.get(e);
  15678. return n ? (this._worksheets.delete(e), this._snapshot.sheetOrder.splice(this._snapshot.sheetOrder.indexOf(e), 1), delete this._snapshot.sheets[e], this._sheetDisposed$.next(n), !0) : !1;
  15679. }
  15680. getActiveSheetIndex() {
  15681. const { sheetOrder: e } = this._snapshot;
  15682. return e.findIndex((n) => this._worksheets.get(n) === this._activeSheet);
  15683. }
  15684. getSheetSize() {
  15685. return this._snapshot.sheetOrder.length;
  15686. }
  15687. getSheets() {
  15688. const { sheetOrder: e } = this._snapshot;
  15689. return e.map((n) => this._worksheets.get(n));
  15690. }
  15691. getSheetsName() {
  15692. const { sheetOrder: e } = this._snapshot, n = [];
  15693. return e.forEach((r) => {
  15694. const s = this._worksheets.get(r);
  15695. s && n.push(s.getName());
  15696. }), n;
  15697. }
  15698. getSheetIndex(e) {
  15699. const { sheetOrder: n } = this._snapshot;
  15700. return n.findIndex((r) => e.getSheetId() === r);
  15701. }
  15702. getSheetBySheetName(e) {
  15703. const { sheetOrder: n } = this._snapshot, r = n.find((s) => this._worksheets.get(s).getName() === e);
  15704. return this._worksheets.get(r);
  15705. }
  15706. getSheetBySheetId(e) {
  15707. return this._worksheets.get(e);
  15708. }
  15709. getSheetByIndex(e) {
  15710. const { sheetOrder: n } = this._snapshot;
  15711. return this._worksheets.get(n[e]);
  15712. }
  15713. getHiddenWorksheets() {
  15714. return this.getSheets().filter((e) => e.getConfig().hidden === we.TRUE).map((e) => e.getConfig().id);
  15715. }
  15716. getUnhiddenWorksheets() {
  15717. return this.getSheets().filter((e) => e.getConfig().hidden !== we.TRUE).map((e) => e.getConfig().id);
  15718. }
  15719. load(e) {
  15720. this._snapshot = e;
  15721. }
  15722. /**
  15723. * Check if sheet name is unique
  15724. * @param name sheet name
  15725. * @returns True if sheet name is unique
  15726. */
  15727. checkSheetName(e) {
  15728. return this.getSheetsName().includes(e);
  15729. }
  15730. /**
  15731. * Check whether the sheet name is unique and generate a new unique sheet name
  15732. * @param name sheet name
  15733. * @returns Unique sheet name
  15734. */
  15735. uniqueSheetName(e = "Sheet1") {
  15736. let n = e;
  15737. for (; this.checkSheetName(n); )
  15738. n = e + this._count, this._count++;
  15739. return n;
  15740. }
  15741. /**
  15742. * Automatically generate new sheet name
  15743. * @param name sheet name
  15744. * @returns New sheet name
  15745. */
  15746. generateNewSheetName(e) {
  15747. let n = e + this._count;
  15748. for (; this.checkSheetName(n); )
  15749. n = e + this._count, this._count++;
  15750. return n;
  15751. }
  15752. // FIXME: now we always create worksheet from DEFAULT_WORKSHEET?
  15753. /**
  15754. * Get Default Sheet
  15755. */
  15756. _parseWorksheetSnapshots() {
  15757. const { _snapshot: e, _worksheets: n } = this, { sheets: r, sheetOrder: s } = e;
  15758. if (re.isEmptyObject(r)) {
  15759. const i = re.generateRandomId();
  15760. r[i] = { id: i };
  15761. }
  15762. for (const i in r) {
  15763. const o = r[i], { name: a } = o;
  15764. o.name = this.uniqueSheetName(a), o.name !== a && this._logService.debug("[Workbook]", `The worksheet name ${a} is duplicated, we changed it to ${o.name}. Please fix the problem in your snapshot.`);
  15765. const u = new es(this._unitId, o, this._styles);
  15766. n.set(i, u), s.includes(i) || s.push(i);
  15767. }
  15768. this.ensureActiveSheet();
  15769. }
  15770. /**
  15771. * Get custom metadata of workbook
  15772. * @returns {CustomData | undefined} custom metadata
  15773. */
  15774. getCustomMetadata() {
  15775. return this._snapshot.custom;
  15776. }
  15777. /**
  15778. * Set custom metadata of workbook
  15779. * @param {CustomData | undefined} custom custom metadata
  15780. */
  15781. setCustomMetadata(e) {
  15782. this._snapshot.custom = e;
  15783. }
  15784. };
  15785. ts = sE([
  15786. iE(1, Mt)
  15787. ], ts);
  15788. class cl extends Ui {
  15789. constructor(n) {
  15790. var r;
  15791. super();
  15792. C(this, "type", Fe.UNIVER_SLIDE);
  15793. C(this, "_activePage$", new lt(null));
  15794. C(this, "activePage$", this._activePage$.asObservable());
  15795. C(this, "_name$");
  15796. C(this, "name$");
  15797. C(this, "_snapshot");
  15798. C(this, "_unitId");
  15799. this._snapshot = { ...Ap, ...n }, this._unitId = (r = this._snapshot.id) != null ? r : re.generateRandomId(6), this._name$ = new lt(this._snapshot.title), this.name$ = this._name$.asObservable();
  15800. }
  15801. get _activePage() {
  15802. var r, s;
  15803. const n = this._activePage$.getValue();
  15804. if (!n) {
  15805. const i = (r = this.getPageOrder()) == null ? void 0 : r[0];
  15806. return i ? (s = this.getPages()) == null ? void 0 : s[i] : null;
  15807. }
  15808. return n;
  15809. }
  15810. setName(n) {
  15811. var r;
  15812. this._snapshot.title = n, this._name$.next(n), this._unitId = (r = this._snapshot.id) != null ? r : qt(6);
  15813. }
  15814. getRev() {
  15815. return 0;
  15816. }
  15817. incrementRev() {
  15818. }
  15819. setRev(n) {
  15820. }
  15821. getSnapshot() {
  15822. return this._snapshot;
  15823. }
  15824. getUnitId() {
  15825. return this._unitId;
  15826. }
  15827. getPages() {
  15828. var n;
  15829. return (n = this._snapshot.body) == null ? void 0 : n.pages;
  15830. }
  15831. getPageOrder() {
  15832. var n;
  15833. return (n = this._snapshot.body) == null ? void 0 : n.pageOrder;
  15834. }
  15835. getPage(n) {
  15836. const r = this.getPages();
  15837. return r == null ? void 0 : r[n];
  15838. }
  15839. getElementsByPage(n) {
  15840. var r;
  15841. return (r = this.getPage(n)) == null ? void 0 : r.pageElements;
  15842. }
  15843. getElement(n, r) {
  15844. var s;
  15845. return (s = this.getElementsByPage(n)) == null ? void 0 : s[r];
  15846. }
  15847. getPageSize() {
  15848. return this._snapshot.pageSize;
  15849. }
  15850. getBlankPage() {
  15851. const n = qt(6);
  15852. return {
  15853. id: n,
  15854. pageType: Fu.SLIDE,
  15855. zIndex: 10,
  15856. title: n,
  15857. description: "",
  15858. pageBackgroundFill: {
  15859. rgb: "rgb(255,255,255)"
  15860. },
  15861. pageElements: {}
  15862. };
  15863. }
  15864. setActivePage(n) {
  15865. this._activePage$.next(n);
  15866. }
  15867. getActivePage() {
  15868. return this._activePage;
  15869. }
  15870. updatePage(n, r) {
  15871. this._snapshot.body && (this._snapshot.body.pages[n] = r);
  15872. }
  15873. appendPage(n) {
  15874. var i;
  15875. if (!this._snapshot.body) return;
  15876. this._snapshot.body.pages[n.id] = n;
  15877. const r = this._activePage, s = this._snapshot.body.pageOrder.indexOf((i = r == null ? void 0 : r.id) != null ? i : "");
  15878. this._snapshot.body.pageOrder.splice(s + 1, 0, n.id);
  15879. }
  15880. }
  15881. const Ar = "FOCUSING_UNIT", Gn = "FOCUSING_SHEET", Nr = "FOCUSING_DOC", Tr = "FOCUSING_SLIDE", _R = "FOCUSING_EDITOR_BUT_HIDDEN", oE = "EDITOR_ACTIVATED", ER = "FOCUSING_EDITOR_INPUT_FORMULA", aE = "FOCUSING_FX_BAR_EDITOR", CR = "FOCUSING_UNIVER_EDITOR", RR = "FOCUSING_EDITOR_INPUT_FORMULA", IR = "FOCUSING_PANEL_EDITOR", vR = "FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE", yR = "FOCUSING_COMMON_DRAWINGS", wR = "FORMULA_EDITOR_ACTIVATED";
  15882. var uE = Object.defineProperty, lE = Object.getOwnPropertyDescriptor, cE = (t, e, n, r) => {
  15883. for (var s = r > 1 ? void 0 : r ? lE(e, n) : e, i = t.length - 1, o; i >= 0; i--)
  15884. (o = t[i]) && (s = (r ? o(e, n, s) : o(s)) || s);
  15885. return r && s && uE(e, n, s), s;
  15886. }, Ea = (t, e) => (n, r) => e(n, r, t);
  15887. const _n = Ct("univer.current");
  15888. let ni = class extends nt {
  15889. constructor(e, n) {
  15890. super();
  15891. C(this, "_unitsByType", /* @__PURE__ */ new Map());
  15892. C(this, "_createHandler");
  15893. C(this, "_ctorByType", /* @__PURE__ */ new Map());
  15894. C(this, "_currentUnits", /* @__PURE__ */ new Map());
  15895. C(this, "_currentUnits$", new lt(this._currentUnits));
  15896. C(this, "currentUnits$", this._currentUnits$.asObservable());
  15897. C(this, "_unitAdded$", new _t());
  15898. C(this, "unitAdded$", this._unitAdded$.asObservable());
  15899. C(this, "_unitDisposed$", new _t());
  15900. C(this, "unitDisposed$", this._unitDisposed$.asObservable());
  15901. C(this, "_focused$", new lt(null));
  15902. C(this, "focused$", this._focused$.asObservable());
  15903. this._injector = e, this._contextService = n;
  15904. }
  15905. dispose() {
  15906. super.dispose(), this._focused$.complete();
  15907. }
  15908. __setCreateHandler(e) {
  15909. this._createHandler = e;
  15910. }
  15911. createUnit(e, n, r) {
  15912. return this._createHandler(e, n, this._ctorByType.get(e), r);
  15913. }
  15914. registerCtorForType(e, n) {
  15915. return this._ctorByType.set(e, n), {
  15916. dispose: () => {
  15917. this._ctorByType.delete(e);
  15918. }
  15919. };
  15920. }
  15921. getCurrentTypeOfUnit$(e) {
  15922. return this.currentUnits$.pipe(Da((n) => {
  15923. var r;
  15924. return (r = n.get(e)) != null ? r : null;
  15925. }), Ml());
  15926. }
  15927. getCurrentUnitForType(e) {
  15928. return this._currentUnits.get(e);
  15929. }
  15930. setCurrentUnitForType(e) {
  15931. const n = this._getUnitById(e);
  15932. if (!n) throw new Error(`[UniverInstanceService]: no document with unitId ${e}!`);
  15933. this._currentUnits.set(n[1], n[0]), this._currentUnits$.next(this._currentUnits);
  15934. }
  15935. getTypeOfUnitAdded$(e) {
  15936. return this._unitAdded$.pipe(Kt((n) => n.type === e));
  15937. }
  15938. /**
  15939. * Add a unit into Univer.
  15940. *
  15941. * @ignore
  15942. *
  15943. * @param unit The unit to be added.
  15944. */
  15945. __addUnit(e, n) {
  15946. var o;
  15947. const r = e.type;
  15948. this._unitsByType.has(r) || this._unitsByType.set(r, []);
  15949. const s = this._unitsByType.get(r), i = e.getUnitId();
  15950. if (s.findIndex((a) => a.getUnitId() === i) !== -1)
  15951. throw new Error(`[UniverInstanceService]: cannot create a unit with the same unit id: ${i}.`);
  15952. s.push(e), this._unitAdded$.next(e), ((o = n == null ? void 0 : n.makeCurrent) == null || o) && this.setCurrentUnitForType(e.getUnitId());
  15953. }
  15954. getTypeOfUnitDisposed$(e) {
  15955. return this.unitDisposed$.pipe(Kt((n) => n.type === e));
  15956. }
  15957. getUnit(e, n) {
  15958. var s;
  15959. const r = (s = this._getUnitById(e)) == null ? void 0 : s[0];
  15960. return n && (r == null ? void 0 : r.type) !== n ? null : r;
  15961. }
  15962. getCurrentUniverDocInstance() {
  15963. return this.getCurrentUnitForType(Fe.UNIVER_DOC);
  15964. }
  15965. getUniverDocInstance(e) {
  15966. return this.getUnit(e, Fe.UNIVER_DOC);
  15967. }
  15968. getUniverSheetInstance(e) {
  15969. return this.getUnit(e, Fe.UNIVER_SHEET);
  15970. }
  15971. getAllUnitsForType(e) {
  15972. var n;
  15973. return (n = this._unitsByType.get(e)) != null ? n : [];
  15974. }
  15975. changeDoc(e, n) {
  15976. const r = this.getAllUnitsForType(Fe.UNIVER_DOC), s = r.find((i) => i.getUnitId() === e);
  15977. if (s != null) {
  15978. const i = r.indexOf(s);
  15979. r.splice(i, 1);
  15980. }
  15981. this.__addUnit(n);
  15982. }
  15983. get focused() {
  15984. var n;
  15985. const e = this._focused$.getValue();
  15986. return e ? (n = this._getUnitById(e)) == null ? void 0 : n[0] : null;
  15987. }
  15988. focusUnit(e) {
  15989. this._focused$.next(e), this.focused instanceof ts ? (this._contextService.setContextValue(Ar, !0), this._contextService.setContextValue(Nr, !1), this._contextService.setContextValue(Gn, !0), this._contextService.setContextValue(Tr, !1), this.setCurrentUnitForType(e)) : this.focused instanceof jt ? (this._contextService.setContextValue(Ar, !0), this._contextService.setContextValue(Nr, !0), this._contextService.setContextValue(Gn, !1), this._contextService.setContextValue(Tr, !1), this.setCurrentUnitForType(e)) : this.focused instanceof cl ? (this._contextService.setContextValue(Ar, !0), this._contextService.setContextValue(Nr, !1), this._contextService.setContextValue(Gn, !1), this._contextService.setContextValue(Tr, !0), this.setCurrentUnitForType(e)) : (this._contextService.setContextValue(Ar, !1), this._contextService.setContextValue(Nr, !1), this._contextService.setContextValue(Gn, !1), this._contextService.setContextValue(Tr, !1));
  15990. }
  15991. getFocusedUnit() {
  15992. return this.focused;
  15993. }
  15994. getUnitType(e) {
  15995. const n = this._getUnitById(e);
  15996. return n ? n[1] : Fe.UNRECOGNIZED;
  15997. }
  15998. disposeUnit(e) {
  15999. const n = this._getUnitById(e);
  16000. if (!n) return !1;
  16001. const [r, s] = n, i = this._unitsByType.get(s), o = i.indexOf(r);
  16002. return i.splice(o, 1), this._tryRemoveCurrentUnitForType(e, s), this._tryBlurUnitOnRemoval(e), this._unitDisposed$.next(r), !0;
  16003. }
  16004. _tryRemoveCurrentUnitForType(e, n) {
  16005. const r = this.getCurrentUnitForType(n);
  16006. (r == null ? void 0 : r.getUnitId()) === e && (this._currentUnits.set(n, null), this._currentUnits$.next(this._currentUnits));
  16007. }
  16008. _tryBlurUnitOnRemoval(e) {
  16009. var n;
  16010. ((n = this.focused) == null ? void 0 : n.getUnitId()) === e && this._focused$.next(null);
  16011. }
  16012. _getUnitById(e) {
  16013. for (const [n, r] of this._unitsByType) {
  16014. const s = r.find((i) => i.getUnitId() === e);
  16015. if (s)
  16016. return [s, n];
  16017. }
  16018. }
  16019. };
  16020. ni = cE([
  16021. Ea(0, ot(Ot)),
  16022. Ea(1, fs)
  16023. ], ni);
  16024. var Ve = /* @__PURE__ */ ((t) => (t[t.Starting = 0] = "Starting", t[t.Ready = 1] = "Ready", t[t.Rendered = 2] = "Rendered", t[t.Steady = 3] = "Steady", t))(Ve || {});
  16025. const hE = {
  16026. 0: "Starting",
  16027. 1: "Ready",
  16028. 2: "Rendered",
  16029. 3: "Steady"
  16030. };
  16031. var dE = Object.defineProperty, fE = Object.getOwnPropertyDescriptor, gE = (t, e, n, r) => {
  16032. for (var s = r > 1 ? void 0 : r ? fE(e, n) : e, i = t.length - 1, o; i >= 0; i--)
  16033. (o = t[i]) && (s = (r ? o(e, n, s) : o(s)) || s);
  16034. return r && s && dE(e, n, s), s;
  16035. }, pE = (t, e) => (n, r) => e(n, r, t);
  16036. let Ht = class extends nt {
  16037. constructor(e) {
  16038. super();
  16039. C(this, "_lifecycle$", new lt(Ve.Starting));
  16040. C(this, "lifecycle$", this._lifecycle$.asObservable());
  16041. C(this, "_lock", !1);
  16042. this._logService = e, this._reportProgress(Ve.Starting);
  16043. }
  16044. get stage() {
  16045. return this._lifecycle$.getValue();
  16046. }
  16047. set stage(e) {
  16048. if (this._lock) throw new Error("[LifecycleService]: cannot set new stage when related logic is all handled!");
  16049. if (e < this.stage) throw new Error("[LifecycleService]: lifecycle stage cannot go backward!");
  16050. e !== this.stage && (this._lock = !0, this._reportProgress(e), this._lifecycle$.next(e), this._lock = !1);
  16051. }
  16052. dispose() {
  16053. this._lifecycle$.complete(), super.dispose();
  16054. }
  16055. /**
  16056. * Subscribe to lifecycle changes and all previous stages and the current
  16057. * stage will be emitted immediately.
  16058. * @returns
  16059. */
  16060. subscribeWithPrevious() {
  16061. return xa(hl(this.stage), this._lifecycle$.pipe(La(1))).pipe(Kf((e) => e === Ve.Steady));
  16062. }
  16063. _reportProgress(e) {
  16064. this._logService.debug("[LifecycleService]", `lifecycle progressed to "${hE[e]}".`);
  16065. }
  16066. };
  16067. Ht = gE([
  16068. pE(0, Mt)
  16069. ], Ht);
  16070. function hl(t) {
  16071. switch (t) {
  16072. case Ve.Starting:
  16073. return fr(Ve.Starting);
  16074. case Ve.Ready:
  16075. return fr(Ve.Starting, Ve.Ready);
  16076. case Ve.Rendered:
  16077. return fr(Ve.Starting, Ve.Ready, Ve.Rendered);
  16078. default:
  16079. return fr(
  16080. Ve.Starting,
  16081. Ve.Ready,
  16082. Ve.Rendered,
  16083. Ve.Steady
  16084. );
  16085. }
  16086. }
  16087. var mE = Object.defineProperty, _E = Object.getOwnPropertyDescriptor, EE = (t, e, n, r) => {
  16088. for (var s = r > 1 ? void 0 : r ? _E(e, n) : e, i = t.length - 1, o; i >= 0; i--)
  16089. (o = t[i]) && (s = (r ? o(e, n, s) : o(s)) || s);
  16090. return r && s && mE(e, n, s), s;
  16091. }, xs = (t, e) => (n, r) => e(n, r, t);
  16092. const cn = Ct("univer.undo-redo.service"), CE = 20;
  16093. class dl {
  16094. dispose() {
  16095. }
  16096. async dispatchToHandlers() {
  16097. return !1;
  16098. }
  16099. }
  16100. const RE = "univer.command.redo", IE = "univer.command.undo", Nn = new class extends dl {
  16101. constructor() {
  16102. super(...arguments);
  16103. C(this, "type", ar.COMMAND);
  16104. C(this, "id", IE);
  16105. }
  16106. handler(e) {
  16107. const n = e.get(cn), r = n.pitchTopUndoElement();
  16108. if (!r)
  16109. return !1;
  16110. const s = e.get(Pt);
  16111. return mu(r.undoMutations, s) ? (n.popUndoToRedo(), !0) : !1;
  16112. }
  16113. }(), Tn = new class extends dl {
  16114. constructor() {
  16115. super(...arguments);
  16116. C(this, "type", ar.COMMAND);
  16117. C(this, "id", RE);
  16118. }
  16119. handler(e) {
  16120. const n = e.get(cn), r = n.pitchTopRedoElement();
  16121. if (!r)
  16122. return !1;
  16123. const s = e.get(Pt);
  16124. return mu(r.redoMutations, s) ? (n.popRedoToUndo(), !0) : !1;
  16125. }
  16126. }();
  16127. let ri = class extends nt {
  16128. constructor(e, n, r) {
  16129. super();
  16130. C(this, "undoRedoStatus$");
  16131. C(this, "_undoRedoStatus$", new lt({ undos: 0, redos: 0 }));
  16132. // Undo and redo stacks are per unit.
  16133. C(this, "_undoStacks", /* @__PURE__ */ new Map());
  16134. C(this, "_redoStacks", /* @__PURE__ */ new Map());
  16135. C(this, "_batchingStatus", /* @__PURE__ */ new Map());
  16136. this._univerInstanceService = e, this._commandService = n, this._contextService = r, this.undoRedoStatus$ = this._undoRedoStatus$.asObservable(), this.disposeWithMe(this._commandService.registerCommand(Nn)), this.disposeWithMe(this._commandService.registerCommand(Tn)), this.disposeWithMe(Ze(() => this._undoRedoStatus$.complete())), this.disposeWithMe(Ze(this._univerInstanceService.focused$.subscribe(() => this._updateStatus())));
  16137. }
  16138. pushUndoRedo(e) {
  16139. const { unitID: n } = e, r = this._getRedoStack(n, !0), s = this._getUndoStack(n, !0);
  16140. if (r.length = 0, this._batchingStatus.has(e.unitID)) {
  16141. const o = this._batchingStatus.get(e.unitID), a = this._pitchUndoElement(e.unitID);
  16142. o === 0 || !a ? (i(e), this._batchingStatus.set(
  16143. e.unitID,
  16144. 1
  16145. /* CREATED */
  16146. )) : this._tryBatchingElements(a, e);
  16147. } else
  16148. i(e);
  16149. function i(o) {
  16150. s.push(o), s.length > CE && s.splice(0, 1);
  16151. }
  16152. this._updateStatus();
  16153. }
  16154. clearUndoRedo(e) {
  16155. const n = this._getRedoStack(e);
  16156. n && (n.length = 0);
  16157. const r = this._getUndoStack(e);
  16158. r && (r.length = 0), this._updateStatus();
  16159. }
  16160. pitchTopUndoElement() {
  16161. const e = this._getFocusedUnitId();
  16162. return this._pitchUndoElement(e);
  16163. }
  16164. pitchTopRedoElement() {
  16165. const e = this._getFocusedUnitId();
  16166. return this._pitchRedoElement(e);
  16167. }
  16168. _pitchUndoElement(e) {
  16169. const n = this._getUndoStack(e);
  16170. return n != null && n.length ? n[n.length - 1] : null;
  16171. }
  16172. _pitchRedoElement(e) {
  16173. const n = this._getRedoStack(e);
  16174. return n != null && n.length ? n[n.length - 1] : null;
  16175. }
  16176. popUndoToRedo() {
  16177. const n = this._getUndoStackForFocused().pop();
  16178. n && (this._getRedoStackForFocused().push(n), this._updateStatus());
  16179. }
  16180. popRedoToUndo() {
  16181. const n = this._getRedoStackForFocused().pop();
  16182. n && (this._getUndoStackForFocused().push(n), this._updateStatus());
  16183. }
  16184. __tempBatchingUndoRedo(e) {
  16185. if (this._batchingStatus.has(e))
  16186. throw new Error("[LocalUndoRedoService]: cannot batching undo redo twice at the same time!");
  16187. return this._batchingStatus.set(
  16188. e,
  16189. 0
  16190. /* WAITING */
  16191. ), Ze(() => this._batchingStatus.delete(e));
  16192. }
  16193. _updateStatus() {
  16194. var s, i;
  16195. const e = this._getFocusedUnitId(), n = e && ((s = this._undoStacks.get(e)) == null ? void 0 : s.length) || 0, r = e && ((i = this._redoStacks.get(e)) == null ? void 0 : i.length) || 0;
  16196. this._undoRedoStatus$.next({
  16197. undos: n,
  16198. redos: r
  16199. });
  16200. }
  16201. _getUndoStack(e, n = !1) {
  16202. let r = this._undoStacks.get(e);
  16203. return !r && n && (r = [], this._undoStacks.set(e, r)), r || null;
  16204. }
  16205. _getRedoStack(e, n = !1) {
  16206. let r = this._redoStacks.get(e);
  16207. return !r && n && (r = [], this._redoStacks.set(e, r)), r || null;
  16208. }
  16209. _getUndoStackForFocused() {
  16210. const e = this._getFocusedUnitId();
  16211. if (!e)
  16212. throw new Error("No focused univer instance!");
  16213. return this._getUndoStack(e, !0);
  16214. }
  16215. _getRedoStackForFocused() {
  16216. const e = this._getFocusedUnitId();
  16217. if (!e)
  16218. throw new Error("No focused univer instance!");
  16219. return this._getRedoStack(e, !0);
  16220. }
  16221. _tryBatchingElements(e, n) {
  16222. e.redoMutations.push(...n.redoMutations), e.undoMutations.push(...n.undoMutations);
  16223. }
  16224. _getFocusedUnitId() {
  16225. var i, o, a, u;
  16226. let e = "";
  16227. const n = this._contextService.getContextValue(Gn), r = this._contextService.getContextValue(aE), s = this._contextService.getContextValue(oE);
  16228. return n ? r ? e = iu : s ? e = su : e = (o = (i = this._univerInstanceService.getFocusedUnit()) == null ? void 0 : i.getUnitId()) != null ? o : "" : e = (u = (a = this._univerInstanceService.getFocusedUnit()) == null ? void 0 : a.getUnitId()) != null ? u : "", e;
  16229. }
  16230. };
  16231. ri = EE([
  16232. xs(0, _n),
  16233. xs(1, Pt),
  16234. xs(2, fs)
  16235. ], ri);
  16236. const Bi = Ct("core.resource-manager.service"), si = {
  16237. [Tt.Editor]: "Editor",
  16238. [Tt.Owner]: "Owner",
  16239. [Tt.Reader]: "Reader",
  16240. [Tt.UNRECOGNIZED]: "UNRECOGNIZED"
  16241. }, ii = (t) => t ? {
  16242. userID: `${si[t]}_${re.generateRandomId(8)}`,
  16243. name: si[t],
  16244. avatar: ""
  16245. } : {
  16246. userID: "",
  16247. name: "",
  16248. avatar: "",
  16249. anonymous: !0,
  16250. canBindAnonymous: !1
  16251. }, vE = (t, e) => t.startsWith(si[e]);
  16252. class rr {
  16253. constructor() {
  16254. C(this, "_model", /* @__PURE__ */ new Map());
  16255. C(this, "_userChange$", new _t());
  16256. C(this, "userChange$", this._userChange$.asObservable());
  16257. C(this, "_currentUser$", new lt(ii()));
  16258. /**
  16259. * When the current user undergoes a switch or change
  16260. * @memberof UserManagerService
  16261. */
  16262. C(this, "currentUser$", this._currentUser$.asObservable());
  16263. }
  16264. getCurrentUser() {
  16265. return this._currentUser$.getValue();
  16266. }
  16267. setCurrentUser(e) {
  16268. this.addUser(e), this._currentUser$.next(e);
  16269. }
  16270. addUser(e) {
  16271. this._model.set(e.userID, e), this._userChange$.next({ type: "add", user: e });
  16272. }
  16273. getUser(e, n) {
  16274. const r = this._model.get(e);
  16275. if (r)
  16276. return r;
  16277. n && n();
  16278. }
  16279. delete(e) {
  16280. const n = this.getUser(e);
  16281. this._model.delete(e), n && this._userChange$.next({ type: "delete", user: n });
  16282. }
  16283. clear() {
  16284. this._model.clear(), this._userChange$.next({ type: "clear" });
  16285. }
  16286. list() {
  16287. return Array.from(this._model.values());
  16288. }
  16289. }
  16290. var yE = Object.defineProperty, wE = Object.getOwnPropertyDescriptor, OE = (t, e, n, r) => {
  16291. for (var s = r > 1 ? void 0 : r ? wE(e, n) : e, i = t.length - 1, o; i >= 0; i--)
  16292. (o = t[i]) && (s = (r ? o(e, n, s) : o(s)) || s);
  16293. return r && s && yE(e, n, s), s;
  16294. }, Ca = (t, e) => (n, r) => e(n, r, t);
  16295. let oi = class {
  16296. // private _sheetPermissionPointMap: Map<string, { action: UnitAction; allowed: boolean }[]> = new Map();
  16297. constructor(t, e) {
  16298. C(this, "_permissionMap", /* @__PURE__ */ new Map([]));
  16299. this._resourceManagerService = t, this._userManagerService = e, this._initSnapshot(), this._initDefaultUser();
  16300. }
  16301. _initDefaultUser() {
  16302. const t = this._userManagerService.getCurrentUser();
  16303. t && t.userID || this._userManagerService.setCurrentUser(ii(Tt.Owner));
  16304. }
  16305. _getRole(t) {
  16306. const e = this._userManagerService.getCurrentUser();
  16307. return e ? vE(e.userID, t) : !1;
  16308. }
  16309. _initSnapshot() {
  16310. this._resourceManagerService.registerPluginResource({
  16311. toJson: (t) => {
  16312. const e = [...this._permissionMap.keys()].reduce((n, r) => {
  16313. const s = this._permissionMap.get(r);
  16314. return n[r] = s, n;
  16315. }, {});
  16316. return JSON.stringify(e);
  16317. },
  16318. parseJson: (t) => JSON.parse(t),
  16319. pluginName: "SHEET_AuthzIoMockService_PLUGIN",
  16320. businesses: [Fe.UNIVER_SHEET, Fe.UNIVER_DOC, Fe.UNIVER_SLIDE],
  16321. onLoad: (t, e) => {
  16322. for (const n in e)
  16323. this._permissionMap.set(n, e[n]);
  16324. },
  16325. onUnLoad: () => {
  16326. this._permissionMap.clear();
  16327. }
  16328. });
  16329. }
  16330. async create(t) {
  16331. return qt(8);
  16332. }
  16333. async allowed(t) {
  16334. return Promise.resolve([]);
  16335. }
  16336. async batchAllowed(t) {
  16337. return Promise.resolve([]);
  16338. }
  16339. // eslint-disable-next-line max-lines-per-function
  16340. async list(t) {
  16341. const e = [];
  16342. return t.objectIDs.forEach((n) => {
  16343. const r = this._permissionMap.get(n);
  16344. if (r) {
  16345. const s = {
  16346. objectID: n,
  16347. unitID: t.unitID,
  16348. objectType: r.objectType,
  16349. name: r.name,
  16350. shareOn: !1,
  16351. shareRole: Tt.Owner,
  16352. shareScope: -1,
  16353. scope: {
  16354. read: Js.AllCollaborator,
  16355. edit: Js.AllCollaborator
  16356. },
  16357. creator: ii(Tt.Owner),
  16358. strategies: [
  16359. {
  16360. action: 6,
  16361. role: 1
  16362. },
  16363. {
  16364. action: 16,
  16365. role: 1
  16366. },
  16367. {
  16368. action: 17,
  16369. role: 1
  16370. },
  16371. {
  16372. action: 18,
  16373. role: 1
  16374. },
  16375. {
  16376. action: 19,
  16377. role: 1
  16378. },
  16379. {
  16380. action: 33,
  16381. role: 1
  16382. },
  16383. {
  16384. action: 34,
  16385. role: 1
  16386. },
  16387. {
  16388. action: 35,
  16389. role: 1
  16390. },
  16391. {
  16392. action: 36,
  16393. role: 1
  16394. },
  16395. {
  16396. action: 37,
  16397. role: 1
  16398. },
  16399. {
  16400. action: 38,
  16401. role: 1
  16402. },
  16403. {
  16404. action: 39,
  16405. role: 1
  16406. },
  16407. {
  16408. action: 40,
  16409. role: 1
  16410. }
  16411. ],
  16412. actions: t.actions.map((i) => ({ action: i, allowed: this._getRole(Tt.Owner) || this._getRole(Tt.Editor) }))
  16413. };
  16414. e.push(s);
  16415. }
  16416. }), e;
  16417. }
  16418. async listCollaborators() {
  16419. return [];
  16420. }
  16421. async listRoles() {
  16422. return {
  16423. roles: [],
  16424. actions: []
  16425. };
  16426. }
  16427. async deleteCollaborator() {
  16428. }
  16429. async update(t) {
  16430. }
  16431. async updateCollaborator() {
  16432. }
  16433. async createCollaborator() {
  16434. }
  16435. async putCollaborators(t) {
  16436. }
  16437. };
  16438. oi = OE([
  16439. Ca(0, Bi),
  16440. Ca(1, ot(rr))
  16441. ], oi);
  16442. const bE = Ct("IAuthzIoIoService"), SE = Ct("univer.config-service");
  16443. class AE {
  16444. constructor() {
  16445. C(this, "_configChanged$", new _t());
  16446. C(this, "configChanged$", this._configChanged$.asObservable());
  16447. C(this, "_config", /* @__PURE__ */ new Map());
  16448. }
  16449. dispose() {
  16450. this._configChanged$.complete();
  16451. }
  16452. getConfig(e) {
  16453. return this._config.get(e);
  16454. }
  16455. setConfig(e, n, r) {
  16456. var o;
  16457. const { merge: s = !1 } = r || {};
  16458. let i = (o = this._config.get(e)) != null ? o : {};
  16459. s ? i = nu(i, n) : i = n, this._config.set(e, i), this._configChanged$.next({ [e]: i });
  16460. }
  16461. deleteConfig(e) {
  16462. return this._config.delete(e);
  16463. }
  16464. subscribeConfigValue$(e) {
  16465. return new sr((n) => {
  16466. Object.prototype.hasOwnProperty.call(this._config, e) && n.next(this._config.get(e));
  16467. const r = this.configChanged$.pipe(Kt((s) => Object.prototype.hasOwnProperty.call(s, e))).subscribe((s) => n.next(s[e]));
  16468. return () => r.unsubscribe();
  16469. });
  16470. }
  16471. }
  16472. class NE extends nt {
  16473. constructor() {
  16474. super(...arguments);
  16475. C(this, "_error$", new _t());
  16476. C(this, "error$", this._error$.asObservable());
  16477. }
  16478. dispose() {
  16479. this._error$.complete();
  16480. }
  16481. emit(n) {
  16482. this._error$.next({ errorKey: n });
  16483. }
  16484. }
  16485. class Vr extends nt {
  16486. constructor() {
  16487. super();
  16488. C(this, "_currentLocale$", new lt(ur.ZH_CN));
  16489. C(this, "currentLocale$", this._currentLocale$.asObservable());
  16490. C(this, "_locales", null);
  16491. C(this, "localeChanged$", new _t());
  16492. /**
  16493. * Translate a key to the current locale
  16494. *
  16495. * @param {string} key the key to translate
  16496. * @param {string[]} args optional arguments to replace in the translated string
  16497. * @returns {string} the translated string
  16498. *
  16499. * @example
  16500. * const locales = {
  16501. * [LocaleType.EN_US]: {
  16502. * foo: {
  16503. * bar: 'Hello'
  16504. * }
  16505. * }
  16506. * t('foo.bar') => 'Hello'
  16507. *
  16508. * @example
  16509. * const locales = {
  16510. * [LocaleType.EN_US]: {
  16511. * foo: {
  16512. * bar: 'Hello {0}'
  16513. * }
  16514. * }
  16515. * t('foo.bar', 'World') => 'Hello World'
  16516. */
  16517. C(this, "t", (n, ...r) => {
  16518. if (!this._locales) throw new Error("[LocaleService]: Locale not initialized");
  16519. const s = n.split("."), i = this.resolveKeyPath(this._locales[this._currentLocale], s);
  16520. if (typeof i == "string") {
  16521. let o = i;
  16522. return r.forEach((a, u) => {
  16523. o = o.replace(`{${u}}`, a);
  16524. }), o;
  16525. } else
  16526. return n;
  16527. });
  16528. this.disposeWithMe(Ze(() => this.localeChanged$.complete()));
  16529. }
  16530. get _currentLocale() {
  16531. return this._currentLocale$.value;
  16532. }
  16533. /**
  16534. * Load more locales after init.
  16535. *
  16536. * @param locales - Locale object
  16537. */
  16538. load(n) {
  16539. var r;
  16540. this._locales = nu((r = this._locales) != null ? r : {}, n);
  16541. }
  16542. setLocale(n) {
  16543. this._currentLocale$.next(n), this.localeChanged$.next();
  16544. }
  16545. getLocales() {
  16546. var n;
  16547. return (n = this._locales) == null ? void 0 : n[this._currentLocale];
  16548. }
  16549. getCurrentLocale() {
  16550. return this._currentLocale;
  16551. }
  16552. resolveKeyPath(n, r) {
  16553. const s = r.shift();
  16554. if (s && n && s in n) {
  16555. const i = n[s];
  16556. return r.length > 0 && (typeof i == "object" || Array.isArray(i)) ? this.resolveKeyPath(i, r) : i;
  16557. }
  16558. return null;
  16559. }
  16560. }
  16561. var TE = Object.defineProperty, ME = Object.getOwnPropertyDescriptor, DE = (t, e, n, r) => {
  16562. for (var s = r > 1 ? void 0 : r ? ME(e, n) : e, i = t.length - 1, o; i >= 0; i--)
  16563. (o = t[i]) && (s = (r ? o(e, n, s) : o(s)) || s);
  16564. return r && s && TE(e, n, s), s;
  16565. }, xE = (t, e) => (n, r) => e(n, r, t);
  16566. let ai = class {
  16567. constructor(t) {
  16568. this._userManagerService = t;
  16569. }
  16570. async list(t) {
  16571. return {
  16572. list: [{
  16573. type: Zr.PERSON,
  16574. mentions: [
  16575. {
  16576. objectType: Zr.PERSON,
  16577. objectId: this._userManagerService.getCurrentUser().userID,
  16578. label: this._userManagerService.getCurrentUser().name,
  16579. metadata: {
  16580. icon: this._userManagerService.getCurrentUser().avatar
  16581. }
  16582. }
  16583. ],
  16584. metadata: {},
  16585. title: "PEOPLE"
  16586. }],
  16587. page: t.page,
  16588. size: t.size,
  16589. total: 1
  16590. };
  16591. }
  16592. };
  16593. ai = DE([
  16594. xE(0, ot(rr))
  16595. ], ai);
  16596. const LE = Ct("univer.service.mention-io");
  16597. var fl = /* @__PURE__ */ ((t) => (t.INIT = "init", t.FETCHING = "fetching", t.DONE = "done", t))(fl || {});
  16598. const UE = Ct("univer.permission-service");
  16599. class PE extends nt {
  16600. constructor() {
  16601. super(...arguments);
  16602. C(this, "_permissionPointMap", /* @__PURE__ */ new Map());
  16603. C(this, "_permissionPointUpdate$", new _t());
  16604. C(this, "permissionPointUpdate$", this._permissionPointUpdate$.asObservable());
  16605. C(this, "_showComponents", !0);
  16606. }
  16607. setShowComponents(n) {
  16608. this._showComponents = n;
  16609. }
  16610. getShowComponents() {
  16611. return this._showComponents;
  16612. }
  16613. deletePermissionPoint(n) {
  16614. const r = this._permissionPointMap.get(n);
  16615. r && (r.complete(), this._permissionPointMap.delete(n));
  16616. }
  16617. addPermissionPoint(n) {
  16618. const r = n instanceof lt, s = r ? n.getValue() : n;
  16619. if (!s.id)
  16620. return !1;
  16621. if (this._permissionPointMap.get(s.id))
  16622. throw new Error(`${s.id} PermissionPoint already exists`);
  16623. return this._permissionPointMap.set(s.id, r ? n : new lt(s)), this._permissionPointUpdate$.next(s), !0;
  16624. }
  16625. updatePermissionPoint(n, r) {
  16626. const s = this._permissionPointMap.get(n);
  16627. if (!s)
  16628. return;
  16629. const i = s.getValue();
  16630. i.value = r, i.status = fl.DONE, s.next(i), this._permissionPointUpdate$.next(i);
  16631. }
  16632. clearPermissionMap() {
  16633. this._permissionPointMap.clear();
  16634. }
  16635. getPermissionPoint(n) {
  16636. const r = this._permissionPointMap.get(n);
  16637. if (r)
  16638. return r.getValue();
  16639. }
  16640. getPermissionPoint$(n) {
  16641. const r = this._permissionPointMap.get(n);
  16642. if (r)
  16643. return r;
  16644. }
  16645. composePermission$(n) {
  16646. const r = n.map((s) => {
  16647. var o;
  16648. const i = (o = this._permissionPointMap) == null ? void 0 : o.get(s);
  16649. if (!i)
  16650. throw new Error(`[PermissionService]: ${s} permissionPoint does not exist!`);
  16651. return i.asObservable();
  16652. });
  16653. return Dl(r).pipe(
  16654. // Check that all permissions exist
  16655. Pl((s) => s)
  16656. );
  16657. }
  16658. composePermission(n) {
  16659. return n.map((s) => {
  16660. var o;
  16661. const i = (o = this._permissionPointMap) == null ? void 0 : o.get(s);
  16662. if (!i)
  16663. throw new Error(`[PermissionService]: ${s} permissionPoint does not exist!`);
  16664. return i.getValue();
  16665. });
  16666. }
  16667. getAllPermissionPoint() {
  16668. const n = /* @__PURE__ */ new Map();
  16669. return this._permissionPointMap.forEach((r, s) => {
  16670. n.set(s, r);
  16671. }), n;
  16672. }
  16673. }
  16674. function kE(t, e) {
  16675. if (!e) return t;
  16676. const n = [];
  16677. for (const r of t) {
  16678. const s = e.find(([i]) => i === r[0]);
  16679. if (s) {
  16680. if (s[1] === null) continue;
  16681. n.push([r[0], s[1]]);
  16682. } else
  16683. n.push(r);
  16684. }
  16685. return n;
  16686. }
  16687. const gl = Symbol("DependentOn");
  16688. class Ra extends nt {
  16689. onStarting() {
  16690. }
  16691. onReady() {
  16692. }
  16693. onRendered() {
  16694. }
  16695. onSteady() {
  16696. }
  16697. getUniverInstanceType() {
  16698. return this.constructor.type;
  16699. }
  16700. getPluginName() {
  16701. return this.constructor.pluginName;
  16702. }
  16703. }
  16704. C(Ra, "pluginName"), C(Ra, "type", Fe.UNIVER_UNKNOWN);
  16705. class FE {
  16706. constructor() {
  16707. C(this, "_plugins", []);
  16708. }
  16709. addPlugin(e) {
  16710. this._plugins.push(e);
  16711. }
  16712. removePlugins() {
  16713. const e = this._plugins.slice();
  16714. return this._plugins.length = 0, e;
  16715. }
  16716. forEachPlugin(e) {
  16717. this._plugins.forEach(e);
  16718. }
  16719. }
  16720. class $E {
  16721. constructor() {
  16722. C(this, "_pluginsRegistered", []);
  16723. }
  16724. // eslint-disable-next-line ts/no-explicit-any
  16725. registerPlugin(e, n) {
  16726. this._pluginsRegistered.push({ plugin: e, options: n });
  16727. }
  16728. getRegisterPlugins() {
  16729. return this._pluginsRegistered.slice();
  16730. }
  16731. removePlugins() {
  16732. this._pluginsRegistered = [];
  16733. }
  16734. }
  16735. var BE = Object.defineProperty, jE = Object.getOwnPropertyDescriptor, pl = (t, e, n, r) => {
  16736. for (var s = r > 1 ? void 0 : r ? jE(e, n) : e, i = t.length - 1, o; i >= 0; i--)
  16737. (o = t[i]) && (s = (r ? o(e, n, s) : o(s)) || s);
  16738. return r && s && BE(e, n, s), s;
  16739. }, Gr = (t, e) => (n, r) => e(n, r, t);
  16740. const HE = 4;
  16741. function OR(...t) {
  16742. return function(e) {
  16743. e[gl] = t;
  16744. };
  16745. }
  16746. let ns = class {
  16747. constructor(t) {
  16748. C(this, "_pluginHolderForUniver");
  16749. C(this, "_pluginHoldersForTypes", /* @__PURE__ */ new Map());
  16750. C(this, "_seenPlugins", /* @__PURE__ */ new Set());
  16751. C(this, "_flushTimer");
  16752. this._injector = t, this._pluginHolderForUniver = this._injector.createInstance(
  16753. rs,
  16754. this._checkPluginSeen.bind(this),
  16755. this._immediateInitPlugin.bind(this)
  16756. ), this._pluginHoldersForTypes.set(Fe.UNIVER_UNKNOWN, this._pluginHolderForUniver), this._pluginHolderForUniver.start();
  16757. }
  16758. dispose() {
  16759. this._clearFlushTimer();
  16760. for (const t of this._pluginHoldersForTypes.values())
  16761. t.dispose();
  16762. this._pluginHolderForUniver.dispose();
  16763. }
  16764. /** Register a plugin into univer. */
  16765. registerPlugin(t, e) {
  16766. this._assertPluginValid(t), this._scheduleInitPlugin();
  16767. const { type: n } = t;
  16768. n === Fe.UNIVER_UNKNOWN ? (this._pluginHolderForUniver.register(t, e), this._pluginHolderForUniver.flush()) : this._ensurePluginHolderForType(n).register(t, e);
  16769. }
  16770. startPluginForType(t) {
  16771. this._ensurePluginHolderForType(t).start();
  16772. }
  16773. _ensurePluginHolderForType(t) {
  16774. if (!this._pluginHoldersForTypes.has(t)) {
  16775. const e = this._injector.createInstance(
  16776. rs,
  16777. this._checkPluginSeen.bind(this),
  16778. this._immediateInitPlugin.bind(this)
  16779. );
  16780. return this._pluginHoldersForTypes.set(t, e), e;
  16781. }
  16782. return this._pluginHoldersForTypes.get(t);
  16783. }
  16784. _immediateInitPlugin(t) {
  16785. this._seenPlugins.add(t.pluginName), this._ensurePluginHolderForType(t.type).immediateInitPlugin(t);
  16786. }
  16787. _checkPluginSeen(t) {
  16788. return this._seenPlugins.has(t.pluginName);
  16789. }
  16790. _assertPluginValid(t) {
  16791. const { type: e, pluginName: n } = t;
  16792. if (e === Fe.UNRECOGNIZED)
  16793. throw new Error(`[PluginService]: invalid plugin type for ${t.name}. Please assign a "type" to your plugin.`);
  16794. if (!n)
  16795. throw new Error(`[PluginService]: no plugin name for ${t.name}. Please assign a "pluginName" to your plugin.`);
  16796. if (this._seenPlugins.has(n))
  16797. throw new Error(`[PluginService]: duplicated plugin name for "${n}". Maybe a plugin that dependents on "${n} has already registered it. In that case please register "${n}" before the that plugin.`);
  16798. this._seenPlugins.add(t.pluginName);
  16799. }
  16800. _scheduleInitPlugin() {
  16801. this._flushTimer === void 0 && (this._flushTimer = setTimeout(
  16802. () => {
  16803. this._pluginHolderForUniver.started || this._pluginHolderForUniver.start(), this._flushPlugins(), this._clearFlushTimer();
  16804. },
  16805. HE
  16806. ));
  16807. }
  16808. _clearFlushTimer() {
  16809. this._flushTimer && (clearTimeout(this._flushTimer), this._flushTimer = void 0);
  16810. }
  16811. _flushPlugins() {
  16812. this._pluginHolderForUniver.flush();
  16813. for (const [t, e] of this._pluginHoldersForTypes)
  16814. e.started && e.flush();
  16815. }
  16816. };
  16817. ns = pl([
  16818. Gr(0, ot(Ot))
  16819. ], ns);
  16820. let rs = class extends nt {
  16821. constructor(e, n, r, s, i) {
  16822. super();
  16823. C(this, "_started", !1);
  16824. C(this, "_warnedAboutOnStartingDeprecation", !1);
  16825. /** Plugin constructors waiting to be initialized. */
  16826. C(this, "_pluginRegistry", new $E());
  16827. /** Stores initialized plugin instances. */
  16828. C(this, "_pluginStore", new FE());
  16829. /** Plugins instances as they are registered in batches. */
  16830. C(this, "_pluginsInBatches", []);
  16831. this._checkPluginRegistered = e, this._registerPlugin = n, this._logService = r, this._injector = s, this._lifecycleService = i, this.disposeWithMe(this._lifecycleService.lifecycle$.pipe(La(1)).subscribe((o) => {
  16832. this._pluginsInBatches.forEach((a) => this._runStage(a, o));
  16833. }));
  16834. }
  16835. get started() {
  16836. return this._started;
  16837. }
  16838. dispose() {
  16839. super.dispose(), this._pluginStore.forEachPlugin((e) => e.dispose()), this._pluginStore.removePlugins(), this._pluginRegistry.removePlugins(), this._pluginsInBatches.length = 0;
  16840. }
  16841. register(e, n) {
  16842. this._pluginRegistry.registerPlugin(e, n);
  16843. }
  16844. immediateInitPlugin(e) {
  16845. const n = this._initPlugin(e, void 0);
  16846. this._pluginsRunLifecycle([n]);
  16847. }
  16848. start() {
  16849. this._started || (this._started = !0, this.flush());
  16850. }
  16851. flush() {
  16852. if (!this._started)
  16853. return;
  16854. const e = this._pluginRegistry.getRegisterPlugins().map(({ plugin: n, options: r }) => this._initPlugin(n, r));
  16855. e.length && (this._pluginsRunLifecycle(e), this._pluginRegistry.removePlugins());
  16856. }
  16857. // eslint-disable-next-line ts/no-explicit-any
  16858. _initPlugin(e, n) {
  16859. const r = e[gl];
  16860. if (r) {
  16861. const i = () => {
  16862. const o = r.find((a) => !this._checkPluginRegistered(a));
  16863. return o ? (this._logService.debug(
  16864. "[PluginService]",
  16865. `Plugin "${e.pluginName}" depends on "${o.pluginName}" which is not registered. Univer will automatically register it with default configuration.`
  16866. ), this._registerPlugin(o, void 0), !0) : !1;
  16867. };
  16868. for (; i(); )
  16869. ;
  16870. }
  16871. const s = this._injector.createInstance(e, n);
  16872. return this._pluginStore.addPlugin(s), this._logService.debug("[PluginService]", `Plugin "${s.getPluginName()}" registered.`), s;
  16873. }
  16874. // Here we should be careful with the sequence of which plugin should run first. We should manually add a queue here.
  16875. // Because lately registered plugins may get executed first.
  16876. _pluginsRunLifecycle(e) {
  16877. hl(this._lifecycleService.stage).subscribe((n) => this._runStage(e, n)), this._pluginsInBatches.push(e);
  16878. }
  16879. _runStage(e, n) {
  16880. e.forEach((r) => {
  16881. switch (n) {
  16882. case Ve.Starting:
  16883. r.onStarting();
  16884. break;
  16885. case Ve.Ready:
  16886. r.onReady();
  16887. break;
  16888. case Ve.Rendered:
  16889. r.onRendered();
  16890. break;
  16891. case Ve.Steady:
  16892. r.onSteady();
  16893. break;
  16894. }
  16895. });
  16896. }
  16897. };
  16898. rs = pl([
  16899. Gr(2, Mt),
  16900. Gr(3, ot(Ot)),
  16901. Gr(4, ot(Ht))
  16902. ], rs);
  16903. var WE = Object.defineProperty, zE = Object.getOwnPropertyDescriptor, YE = (t, e, n, r) => {
  16904. for (var s = r > 1 ? void 0 : r ? zE(e, n) : e, i = t.length - 1, o; i >= 0; i--)
  16905. (o = t[i]) && (s = (r ? o(e, n, s) : o(s)) || s);
  16906. return r && s && WE(e, n, s), s;
  16907. }, Ia = (t, e) => (n, r) => e(n, r, t);
  16908. let ui = class extends nt {
  16909. constructor(t, e) {
  16910. super(), this._resourceManagerService = t, this._univerInstanceService = e, this._init();
  16911. }
  16912. _init() {
  16913. const t = (n) => {
  16914. n.businesses.forEach((r) => {
  16915. switch (r) {
  16916. case Fe.UNRECOGNIZED:
  16917. case Fe.UNIVER_UNKNOWN:
  16918. case Fe.UNIVER_SLIDE:
  16919. case Fe.UNIVER_DOC: {
  16920. this._univerInstanceService.getAllUnitsForType(Fe.UNIVER_DOC).forEach((s) => {
  16921. const o = (s.getSnapshot().resources || []).find((a) => a.name === n.pluginName);
  16922. if (o)
  16923. try {
  16924. const a = n.parseJson(o.data);
  16925. n.onLoad(s.getUnitId(), a);
  16926. } catch {
  16927. console.error(`Load Document{${s.getUnitId()}} Resources{${n.pluginName}} Data Error.`);
  16928. }
  16929. });
  16930. break;
  16931. }
  16932. case Fe.UNIVER_SHEET:
  16933. this._univerInstanceService.getAllUnitsForType(Fe.UNIVER_SHEET).forEach((s) => {
  16934. const o = (s.getSnapshot().resources || []).find((a) => a.name === n.pluginName);
  16935. if (o)
  16936. try {
  16937. const a = n.parseJson(o.data);
  16938. n.onLoad(s.getUnitId(), a);
  16939. } catch {
  16940. console.error(`Load Workbook{${s.getUnitId()}} Resources{${n.pluginName}} Data Error.`);
  16941. }
  16942. });
  16943. }
  16944. });
  16945. };
  16946. this._resourceManagerService.getAllResourceHooks().forEach((n) => t(n)), this.disposeWithMe(this._resourceManagerService.register$.subscribe((n) => t(n))), this.disposeWithMe(
  16947. this._univerInstanceService.getTypeOfUnitAdded$(Fe.UNIVER_SHEET).subscribe((n) => {
  16948. this._resourceManagerService.loadResources(n.getUnitId(), n.getSnapshot().resources);
  16949. })
  16950. ), this.disposeWithMe(
  16951. this._univerInstanceService.getTypeOfUnitAdded$(Fe.UNIVER_DOC).subscribe((n) => {
  16952. const r = n.getUnitId();
  16953. zd(r) || this._resourceManagerService.loadResources(n.getUnitId(), n.getSnapshot().resources);
  16954. })
  16955. ), this.disposeWithMe(
  16956. this._univerInstanceService.getTypeOfUnitDisposed$(Fe.UNIVER_SHEET).subscribe((n) => {
  16957. this._resourceManagerService.unloadResources(n.getUnitId());
  16958. })
  16959. ), this.disposeWithMe(
  16960. this._univerInstanceService.getTypeOfUnitDisposed$(Fe.UNIVER_DOC).subscribe((n) => {
  16961. this._resourceManagerService.unloadResources(n.getUnitId());
  16962. })
  16963. );
  16964. }
  16965. saveUnit(t) {
  16966. const e = this._univerInstanceService.getUnit(t);
  16967. if (!e)
  16968. return null;
  16969. const n = this._resourceManagerService.getResources(t, e.type), r = re.deepClone(e.getSnapshot());
  16970. return r.resources = n, r;
  16971. }
  16972. };
  16973. ui = YE([
  16974. Ia(0, ot(Bi)),
  16975. Ia(1, ot(_n))
  16976. ], ui);
  16977. const va = Ct("resource-loader-service");
  16978. class VE extends nt {
  16979. constructor() {
  16980. super(...arguments);
  16981. C(this, "_resourceMap", /* @__PURE__ */ new Map());
  16982. C(this, "_register$", new _t());
  16983. C(this, "register$", this._register$.asObservable());
  16984. }
  16985. getAllResourceHooks() {
  16986. return [...this._resourceMap.values()];
  16987. }
  16988. getResources(n, r) {
  16989. return r ? this.getResourcesByType(n, r) : this.getAllResourceHooks().map((o) => {
  16990. const a = o.toJson(n);
  16991. return {
  16992. name: o.pluginName,
  16993. data: a
  16994. };
  16995. });
  16996. }
  16997. getResourcesByType(n, r) {
  16998. return this.getAllResourceHooks().filter((o) => o.businesses.includes(r)).map((o) => {
  16999. const a = o.toJson(n);
  17000. return {
  17001. name: o.pluginName,
  17002. data: a
  17003. };
  17004. });
  17005. }
  17006. registerPluginResource(n) {
  17007. const r = n.pluginName;
  17008. if (this._resourceMap.has(r))
  17009. throw new Error(`the pluginName is registered {${r}}`);
  17010. return this._resourceMap.set(r, n), this._register$.next(n), Ze(() => this._resourceMap.delete(r));
  17011. }
  17012. disposePluginResource(n) {
  17013. this._resourceMap.delete(n);
  17014. }
  17015. loadResources(n, r) {
  17016. this.getAllResourceHooks().forEach((s) => {
  17017. var o;
  17018. const i = (o = r == null ? void 0 : r.find((a) => a.name === s.pluginName)) == null ? void 0 : o.data;
  17019. if (i)
  17020. try {
  17021. const a = s.parseJson(i);
  17022. s.onLoad(n, a);
  17023. } catch {
  17024. console.error("LoadResources Error!");
  17025. }
  17026. });
  17027. }
  17028. unloadResources(n) {
  17029. this.getAllResourceHooks().forEach((r) => {
  17030. r.onUnLoad(n);
  17031. });
  17032. }
  17033. dispose() {
  17034. this._register$.complete(), this._resourceMap.clear();
  17035. }
  17036. }
  17037. class ml extends nt {
  17038. constructor() {
  17039. super();
  17040. C(this, "_currentTheme");
  17041. C(this, "_currentTheme$", new lt({}));
  17042. C(this, "currentTheme$", this._currentTheme$.asObservable());
  17043. this.disposeWithMe(Ze(() => this._currentTheme$.complete()));
  17044. }
  17045. getCurrentTheme() {
  17046. if (!this._currentTheme)
  17047. throw new Error("[ThemeService]: current theme is not set!");
  17048. return this._currentTheme;
  17049. }
  17050. setTheme(n) {
  17051. this._currentTheme = n, this._currentTheme$.next(n);
  17052. }
  17053. }
  17054. class GE {
  17055. /**
  17056. * Create a Univer instance.
  17057. * @param config Configuration data for Univer
  17058. * @param parentInjector An optional parent injector of the Univer injector. For more information, see https://redi.wendell.fun/docs/hierarchy.
  17059. */
  17060. constructor(e = {}, n) {
  17061. C(this, "_startedTypes", /* @__PURE__ */ new Set());
  17062. C(this, "_injector");
  17063. C(this, "_disposingCallbacks", new Mi());
  17064. const r = this._injector = KE(n, e == null ? void 0 : e.override), { theme: s, locale: i, locales: o, logLevel: a } = e;
  17065. s && this._injector.get(ml).setTheme(s), o && this._injector.get(Vr).load(o), i && this._injector.get(Vr).setLocale(i), a && this._injector.get(Mt).setLogLevel(a), this._init(r);
  17066. }
  17067. get _univerInstanceService() {
  17068. return this._injector.get(_n);
  17069. }
  17070. get _pluginService() {
  17071. return this._injector.get(ns);
  17072. }
  17073. __getInjector() {
  17074. return this._injector;
  17075. }
  17076. /**
  17077. * Register a callback function which will be called when this Univer instance is disposing.
  17078. *
  17079. * @ignore
  17080. *
  17081. * @param callback The callback function.
  17082. * @returns To remove this callback function from this Univer instance's on disposing list.
  17083. */
  17084. onDispose(e) {
  17085. const n = this._disposingCallbacks.add(Ze(e));
  17086. return Ze(() => n.dispose(!0));
  17087. }
  17088. dispose() {
  17089. this._disposingCallbacks.dispose(), this._injector.dispose();
  17090. }
  17091. setLocale(e) {
  17092. this._injector.get(Vr).setLocale(e);
  17093. }
  17094. createUnit(e, n) {
  17095. return this._univerInstanceService.createUnit(e, n);
  17096. }
  17097. /**
  17098. * Create a univer sheet instance with internal dependency injection.
  17099. *
  17100. * @deprecated use `createUnit` instead
  17101. */
  17102. createUniverSheet(e) {
  17103. return this._injector.get(Mt).warn("[Univer]: Univer.createUniverSheet is deprecated, use createUnit instead"), this._univerInstanceService.createUnit(Fe.UNIVER_SHEET, e);
  17104. }
  17105. /**
  17106. * @deprecated use `createUnit` instead
  17107. */
  17108. createUniverDoc(e) {
  17109. return this._injector.get(Mt).warn("[Univer]: Univer.createUniverDoc is deprecated, use createUnit instead"), this._univerInstanceService.createUnit(Fe.UNIVER_DOC, e);
  17110. }
  17111. /**
  17112. * @deprecated use `createUnit` instead
  17113. */
  17114. createUniverSlide(e) {
  17115. return this._injector.get(Mt).warn("[Univer]: Univer.createUniverSlide is deprecated, use createUnit instead"), this._univerInstanceService.createUnit(Fe.UNIVER_SLIDE, e);
  17116. }
  17117. _init(e) {
  17118. this._univerInstanceService.registerCtorForType(Fe.UNIVER_SHEET, ts), this._univerInstanceService.registerCtorForType(Fe.UNIVER_DOC, jt), this._univerInstanceService.registerCtorForType(Fe.UNIVER_SLIDE, cl);
  17119. const n = e.get(_n);
  17120. n.__setCreateHandler(
  17121. (r, s, i, o) => {
  17122. if (!this._startedTypes.has(r)) {
  17123. this._pluginService.startPluginForType(r), this._startedTypes.add(r);
  17124. const u = e.createInstance(i, s);
  17125. return n.__addUnit(u, o), this._tryProgressToReady(), u;
  17126. }
  17127. const a = e.createInstance(i, s);
  17128. return n.__addUnit(a, o), a;
  17129. }
  17130. );
  17131. }
  17132. _tryProgressToReady() {
  17133. this._injector.get(Ht).stage < Ve.Ready && (this._injector.get(Ht).stage = Ve.Ready);
  17134. }
  17135. /** Register a plugin into univer. */
  17136. registerPlugin(e, n) {
  17137. this._pluginService.registerPlugin(e, n);
  17138. }
  17139. }
  17140. function KE(t, e) {
  17141. const n = kE([
  17142. [NE],
  17143. [Vr],
  17144. [ml],
  17145. [Ht],
  17146. [ns],
  17147. [rr],
  17148. // abstract services
  17149. [_n, { useClass: ni }],
  17150. [UE, { useClass: PE }],
  17151. [Mt, { useClass: Bf, lazy: !0 }],
  17152. [Pt, { useClass: Ys }],
  17153. [cn, { useClass: ri, lazy: !0 }],
  17154. [SE, { useClass: AE }],
  17155. [fs, { useClass: Ff }],
  17156. [Bi, { useClass: VE, lazy: !0 }],
  17157. [va, { useClass: ui, lazy: !0 }],
  17158. [bE, { useClass: oi, lazy: !0 }],
  17159. [LE, { useClass: ai, lazy: !0 }]
  17160. ], e), r = t ? t.createChild(n) : new Ot(n);
  17161. return Mf(r, [
  17162. [rr],
  17163. [va]
  17164. ]), r;
  17165. }
  17166. var XE = Object.defineProperty, JE = Object.getOwnPropertyDescriptor, ZE = (t, e, n, r) => {
  17167. for (var s = r > 1 ? void 0 : r ? JE(e, n) : e, i = t.length - 1, o; i >= 0; i--)
  17168. (o = t[i]) && (s = (r ? o(e, n, s) : o(s)) || s);
  17169. return r && s && XE(e, n, s), s;
  17170. }, QE = (t, e) => (n, r) => e(n, r, t);
  17171. let ss = class extends Fi {
  17172. constructor(t, e) {
  17173. super(), this._blob = t, this._injector = e;
  17174. }
  17175. /**
  17176. * Returns a copy of this blob.
  17177. * @returns a new blob by copying the current blob
  17178. * @example
  17179. * ```ts
  17180. * const blob = univerAPI.newBlob(blob);
  17181. * const newBlob = blob.copyBlob();
  17182. * console.log(newBlob);
  17183. * ```
  17184. */
  17185. copyBlob() {
  17186. return this._injector.createInstance(ss, this._blob);
  17187. }
  17188. /**
  17189. * Return the data inside this object as a blob converted to the specified content type.
  17190. * @param contentType the content type refer to https://developer.mozilla.org/en-US/docs/Web/HTTP/MIME_types/Common_types
  17191. * @returns a new blob by converting the current blob to the specified content type
  17192. * @example
  17193. * ```ts
  17194. * const blob = univerAPI.newBlob(blob);
  17195. * const newBlob = blob.getBlob();
  17196. * ```
  17197. */
  17198. getAs(t) {
  17199. const e = this.copyBlob();
  17200. return e.setContentType(t), e;
  17201. }
  17202. getDataAsString(t) {
  17203. return this._blob === null ? Promise.resolve("") : t === void 0 ? this._blob.text() : new Promise((e, n) => {
  17204. this._blob.arrayBuffer().then((r) => {
  17205. const s = new TextDecoder(t).decode(r);
  17206. e(s);
  17207. }).catch((r) => {
  17208. n(new Error(`Failed to read Blob as ArrayBuffer: ${r.message}`));
  17209. });
  17210. });
  17211. }
  17212. /**
  17213. * Gets the data stored in this blob.
  17214. * @returns the blob content as a byte array
  17215. * @example
  17216. * ```ts
  17217. * const blob = univerAPI.newBlob(blob);
  17218. * const newBlob = blob.getBytes();
  17219. * console.log(newBlob);
  17220. * ```
  17221. */
  17222. getBytes() {
  17223. return this._blob ? this._blob.arrayBuffer().then((t) => new Uint8Array(t)) : Promise.reject(new Error("Blob is undefined or null."));
  17224. }
  17225. /**
  17226. * Sets the data stored in this blob.
  17227. * @param bytes a byte array
  17228. * @returns the blob object
  17229. * @example
  17230. * ```ts
  17231. * const blob = univerAPI.newBlob();
  17232. * const bytes = new Uint8Array(10);
  17233. * blob.setBytes(bytes);
  17234. * ```
  17235. */
  17236. setBytes(t) {
  17237. return this._blob = new Blob([t]), this;
  17238. }
  17239. setDataFromString(t, e) {
  17240. const n = e != null ? e : "text/plain", r = new Blob([t], { type: n });
  17241. return this._blob = r, this;
  17242. }
  17243. /**
  17244. * Gets the content type of the data stored in this blob.
  17245. * @returns the content type
  17246. * @example
  17247. * ```ts
  17248. * const blob = univerAPI.newBlob(blob);
  17249. * const newBlob = blob.getContentType();
  17250. * console.log(newBlob);
  17251. * ```
  17252. */
  17253. getContentType() {
  17254. var t;
  17255. return (t = this._blob) == null ? void 0 : t.type;
  17256. }
  17257. /**
  17258. * Sets the content type of the data stored in this blob.
  17259. * @param contentType the content type refer to https://developer.mozilla.org/en-US/docs/Web/HTTP/MIME_types/Common_types
  17260. * @returns the blob object
  17261. * @example
  17262. * ```ts
  17263. * const blob = univerAPI.newBlob(blob);
  17264. * const newBlob = blob.setContentType('text/plain');
  17265. * console.log(newBlob);
  17266. * ```
  17267. */
  17268. setContentType(t) {
  17269. var e;
  17270. return this._blob = (e = this._blob) == null ? void 0 : e.slice(0, this._blob.size, t), this;
  17271. }
  17272. };
  17273. ss = ZE([
  17274. QE(1, ot(Ot))
  17275. ], ss);
  17276. var qE = Object.defineProperty, e0 = Object.getOwnPropertyDescriptor, t0 = (t, e, n, r) => {
  17277. for (var s = r > 1 ? void 0 : r ? e0(e, n) : e, i = t.length - 1, o; i >= 0; i--)
  17278. (o = t[i]) && (s = (r ? o(e, n, s) : o(s)) || s);
  17279. return r && s && qE(e, n, s), s;
  17280. }, n0 = (t, e) => (n, r) => e(n, r, t);
  17281. let li = class extends al {
  17282. constructor(t, e) {
  17283. super(e), this.doc = t;
  17284. }
  17285. };
  17286. li = t0([
  17287. n0(1, ot(Ot))
  17288. ], li);
  17289. var _l = /* @__PURE__ */ ((t) => (t[t.INFO = 0] = "INFO", t[t.STOP = 1] = "STOP", t[t.WARNING = 2] = "WARNING", t))(_l || {}), El = /* @__PURE__ */ ((t) => (t.BETWEEN = "between", t.EQUAL = "equal", t.GREATER_THAN = "greaterThan", t.GREATER_THAN_OR_EQUAL = "greaterThanOrEqual", t.LESS_THAN = "lessThan", t.LESS_THAN_OR_EQUAL = "lessThanOrEqual", t.NOT_BETWEEN = "notBetween", t.NOT_EQUAL = "notEqual", t))(El || {}), Cl = /* @__PURE__ */ ((t) => (t[t.TEXT = 0] = "TEXT", t[t.ARROW = 1] = "ARROW", t[t.CUSTOM = 2] = "CUSTOM", t))(Cl || {}), Rl = /* @__PURE__ */ ((t) => (t.VALID = "valid", t.INVALID = "invalid", t.VALIDATING = "validating", t))(Rl || {}), Il = /* @__PURE__ */ ((t) => (t.CUSTOM = "custom", t.LIST = "list", t.LIST_MULTIPLE = "listMultiple", t.NONE = "none", t.TEXT_LENGTH = "textLength", t.DATE = "date", t.TIME = "time", t.WHOLE = "whole", t.DECIMAL = "decimal", t.CHECKBOX = "checkbox", t.ANY = "any", t))(Il || {});
  17290. const bn = class bn {
  17291. static get() {
  17292. if (this._instance)
  17293. return this._instance;
  17294. const e = new bn();
  17295. return this._instance = e, e;
  17296. }
  17297. static extend(e) {
  17298. Object.getOwnPropertyNames(e.prototype).forEach((n) => {
  17299. n !== "constructor" && (this.prototype[n] = e.prototype[n]);
  17300. }), Object.getOwnPropertyNames(e).forEach((n) => {
  17301. n !== "prototype" && n !== "name" && n !== "length" && (this[n] = e[n]);
  17302. });
  17303. }
  17304. constructor() {
  17305. for (const e in bn.prototype)
  17306. this[e] = bn.prototype[e];
  17307. }
  17308. /**
  17309. * Defines different types of Univer instances
  17310. */
  17311. get UniverInstanceType() {
  17312. return Fe;
  17313. }
  17314. /**
  17315. * Represents different stages in the lifecycle
  17316. */
  17317. get LifecycleStages() {
  17318. return Ve;
  17319. }
  17320. /**
  17321. * Different types of data validation
  17322. */
  17323. get DataValidationType() {
  17324. return Il;
  17325. }
  17326. /**
  17327. * Different error display styles
  17328. */
  17329. get DataValidationErrorStyle() {
  17330. return _l;
  17331. }
  17332. /**
  17333. * Different validation rendering modes
  17334. */
  17335. get DataValidationRenderMode() {
  17336. return Cl;
  17337. }
  17338. /**
  17339. * Different validation operators
  17340. */
  17341. get DataValidationOperator() {
  17342. return El;
  17343. }
  17344. /**
  17345. * Different validation states
  17346. */
  17347. get DataValidationStatus() {
  17348. return Rl;
  17349. }
  17350. /**
  17351. * Different types of commands
  17352. */
  17353. get CommandType() {
  17354. return ar;
  17355. }
  17356. /**
  17357. * Different baseline offsets for text baseline positioning
  17358. */
  17359. get BaselineOffset() {
  17360. return Bt;
  17361. }
  17362. /**
  17363. * Boolean number representations
  17364. */
  17365. get BooleanNumber() {
  17366. return we;
  17367. }
  17368. /**
  17369. * Different horizontal text alignment options
  17370. */
  17371. get HorizontalAlign() {
  17372. return Xt;
  17373. }
  17374. /**
  17375. * Different text decoration styles
  17376. */
  17377. get TextDecoration() {
  17378. return Nu;
  17379. }
  17380. /**
  17381. * Different text direction options
  17382. */
  17383. get TextDirection() {
  17384. return er;
  17385. }
  17386. /**
  17387. * Different vertical text alignment options
  17388. */
  17389. get VerticalAlign() {
  17390. return hn;
  17391. }
  17392. /**
  17393. * Different border types
  17394. */
  17395. get BorderType() {
  17396. return Eu;
  17397. }
  17398. /**
  17399. * Different border style types
  17400. */
  17401. get BorderStyleTypes() {
  17402. return Xe;
  17403. }
  17404. /**
  17405. * Auto fill series types
  17406. */
  17407. get AutoFillSeries() {
  17408. return _u;
  17409. }
  17410. /**
  17411. * Color types
  17412. */
  17413. get ColorType() {
  17414. return vt;
  17415. }
  17416. /**
  17417. * Common hide types
  17418. */
  17419. get CommonHideTypes() {
  17420. return Cu;
  17421. }
  17422. /**
  17423. * Copy paste types
  17424. */
  17425. get CopyPasteType() {
  17426. return Ru;
  17427. }
  17428. /**
  17429. * Delete direction types
  17430. */
  17431. get DeleteDirection() {
  17432. return Iu;
  17433. }
  17434. /**
  17435. * Developer metadata visibility types
  17436. */
  17437. get DeveloperMetadataVisibility() {
  17438. return vu;
  17439. }
  17440. /**
  17441. * Dimension types
  17442. */
  17443. get Dimension() {
  17444. return yu;
  17445. }
  17446. /**
  17447. * Direction types
  17448. */
  17449. get Direction() {
  17450. return wu;
  17451. }
  17452. /**
  17453. * Interpolation point types
  17454. */
  17455. get InterpolationPointType() {
  17456. return Ou;
  17457. }
  17458. /**
  17459. * Locale types
  17460. */
  17461. get LocaleType() {
  17462. return ur;
  17463. }
  17464. /**
  17465. * Mention types
  17466. */
  17467. get MentionType() {
  17468. return Zr;
  17469. }
  17470. /**
  17471. * Protection types
  17472. */
  17473. get ProtectionType() {
  17474. return bu;
  17475. }
  17476. /**
  17477. * Relative date types
  17478. */
  17479. get RelativeDate() {
  17480. return Su;
  17481. }
  17482. /**
  17483. * Sheet types
  17484. */
  17485. get SheetTypes() {
  17486. return Au;
  17487. }
  17488. /**
  17489. * Theme color types
  17490. */
  17491. get ThemeColorType() {
  17492. return ft;
  17493. }
  17494. };
  17495. C(bn, "_instance");
  17496. let ci = bn;
  17497. const Sn = class Sn {
  17498. static get() {
  17499. if (this._instance)
  17500. return this._instance;
  17501. const e = new Sn();
  17502. return this._instance = e, e;
  17503. }
  17504. static extend(e) {
  17505. Object.getOwnPropertyNames(e.prototype).forEach((n) => {
  17506. n !== "constructor" && (this.prototype[n] = e.prototype[n]);
  17507. }), Object.getOwnPropertyNames(e).forEach((n) => {
  17508. n !== "prototype" && n !== "name" && n !== "length" && (this[n] = e[n]);
  17509. });
  17510. }
  17511. constructor() {
  17512. for (const e in Sn.prototype)
  17513. this[e] = Sn.prototype[e];
  17514. }
  17515. /**
  17516. * Event fired when a document is created
  17517. * @see {@link IDocCreatedParam}
  17518. * @example
  17519. * ```ts
  17520. * univerAPI.addEvent(univerAPI.event.DocCreated, (params) => {
  17521. * const { unitId, type, doc, unit } = params;
  17522. * console.log('doc created', params);
  17523. * });
  17524. * ```
  17525. */
  17526. get DocCreated() {
  17527. return "DocCreated";
  17528. }
  17529. /**
  17530. * Event fired when a document is disposed
  17531. * @see {@link IDocDisposedEvent}
  17532. * @example
  17533. * ```ts
  17534. * univerAPI.addEvent(univerAPI.event.DocDisposed, (params) => {
  17535. * const { unitId, unitType, snapshot } = params;
  17536. * console.log('doc disposed', params);
  17537. * });
  17538. * ```
  17539. */
  17540. get DocDisposed() {
  17541. return "DocDisposed";
  17542. }
  17543. /**
  17544. * Event fired when life cycle is changed
  17545. * @see {@link ILifeCycleChangedEvent}
  17546. * @example
  17547. * ```ts
  17548. * univerAPI.addEvent(univerAPI.event.LifeCycleChanged, (params) => {
  17549. * const { stage } = params;
  17550. * console.log('life cycle changed', params);
  17551. * });
  17552. * ```
  17553. */
  17554. get LifeCycleChanged() {
  17555. return "LifeCycleChanged";
  17556. }
  17557. /**
  17558. * Event fired when a redo command is executed
  17559. * @see {@link ICommandEvent}
  17560. * @example
  17561. * ```ts
  17562. * univerAPI.addEvent(univerAPI.event.Redo, (event) => {
  17563. * const { params, id, type } = event;
  17564. * console.log('command executed', event);
  17565. * });
  17566. * ```
  17567. */
  17568. get Redo() {
  17569. return "Redo";
  17570. }
  17571. /**
  17572. * Event fired when an undo command is executed
  17573. * @see {@link ICommandEvent}
  17574. * @example
  17575. * ```ts
  17576. * univerAPI.addEvent(univerAPI.event.Undo, (event) => {
  17577. * const { params, id, type } = event;
  17578. * console.log('command executed', event);
  17579. * });
  17580. * ```
  17581. */
  17582. get Undo() {
  17583. return "Undo";
  17584. }
  17585. /**
  17586. * Event fired before a redo command is executed
  17587. * @see {@link ICommandEvent}
  17588. * @example
  17589. * ```ts
  17590. * univerAPI.addEvent(univerAPI.event.BeforeRedo, (event) => {
  17591. * const { params, id, type } = event;
  17592. * console.log('command executed', event);
  17593. * });
  17594. * ```
  17595. */
  17596. get BeforeRedo() {
  17597. return "BeforeRedo";
  17598. }
  17599. /**
  17600. * Event fired before an undo command is executed
  17601. * @see {@link ICommandEvent}
  17602. * @example
  17603. * ```ts
  17604. * univerAPI.addEvent(univerAPI.event.BeforeUndo, (event) => {
  17605. * const { params, id, type } = event;
  17606. * console.log('command executed', event);
  17607. * });
  17608. * ```
  17609. */
  17610. get BeforeUndo() {
  17611. return "BeforeUndo";
  17612. }
  17613. /**
  17614. * Event fired when a command is executed
  17615. * @see {@link ICommandEvent}
  17616. * @example
  17617. * ```ts
  17618. * univerAPI.addEvent(univerAPI.event.CommandExecuted, (event) => {
  17619. * const { params, id, type } = event;
  17620. * console.log('command executed', event);
  17621. * });
  17622. * ```
  17623. */
  17624. get CommandExecuted() {
  17625. return "CommandExecuted";
  17626. }
  17627. /**
  17628. * Event fired before a command is executed
  17629. * @see {@link ICommandEvent}
  17630. * @example
  17631. * ```ts
  17632. * univerAPI.addEvent(univerAPI.event.BeforeCommandExecute, (event) => {
  17633. * const { params, id, type } = event;
  17634. * console.log('command executed', event);
  17635. * });
  17636. * ```
  17637. */
  17638. get BeforeCommandExecute() {
  17639. return "BeforeCommandExecute";
  17640. }
  17641. };
  17642. C(Sn, "_instance");
  17643. let hi = Sn;
  17644. var r0 = Object.defineProperty, s0 = Object.getOwnPropertyDescriptor, i0 = (t, e, n, r) => {
  17645. for (var s = r > 1 ? void 0 : r ? s0(e, n) : e, i = t.length - 1, o; i >= 0; i--)
  17646. (o = t[i]) && (s = (r ? o(e, n, s) : o(s)) || s);
  17647. return r && s && r0(e, n, s), s;
  17648. }, ya = (t, e) => (n, r) => e(n, r, t);
  17649. let di = class extends Fi {
  17650. constructor(t, e) {
  17651. super(), this._injector = t, this._lifecycleService = e;
  17652. }
  17653. /**
  17654. * @deprecated use `univerAPI.addEvent(univerAPI.Event.LifecycleChanged)` as instead
  17655. */
  17656. onStarting(t) {
  17657. return Ze(this._lifecycleService.lifecycle$.pipe(Kt((e) => e === Ve.Starting)).subscribe(t));
  17658. }
  17659. /**
  17660. * @deprecated use `univerAPI.addEvent(univerAPI.Event.LifecycleChanged)` as instead
  17661. */
  17662. onReady(t) {
  17663. return Ze(this._lifecycleService.lifecycle$.pipe(Kt((e) => e === Ve.Ready)).subscribe(t));
  17664. }
  17665. /**
  17666. * @deprecated use `univerAPI.addEvent(univerAPI.Event.LifecycleChanged, () => {})` as instead
  17667. */
  17668. onRendered(t) {
  17669. return Ze(this._lifecycleService.lifecycle$.pipe(Kt((e) => e === Ve.Rendered)).subscribe(t));
  17670. }
  17671. /**
  17672. * @deprecated use `univerAPI.addEvent(univerAPI.Event.LifecycleChanged, () => {})` as instead
  17673. */
  17674. onSteady(t) {
  17675. return Ze(this._lifecycleService.lifecycle$.pipe(Kt((e) => e === Ve.Steady)).subscribe(t));
  17676. }
  17677. /**
  17678. * @deprecated use `univerAPI.addEvent(univerAPI.Event.BeforeUndo, () => {})` as instead
  17679. */
  17680. onBeforeUndo(t) {
  17681. return this._injector.get(Pt).beforeCommandExecuted((n) => {
  17682. if (n.id === Nn.id) {
  17683. const s = this._injector.get(cn).pitchTopUndoElement();
  17684. s && t(s);
  17685. }
  17686. });
  17687. }
  17688. /**
  17689. * @deprecated use `univerAPI.addEvent(univerAPI.Event.Undo, () => {})` as instead
  17690. */
  17691. onUndo(t) {
  17692. return this._injector.get(Pt).onCommandExecuted((n) => {
  17693. if (n.id === Nn.id) {
  17694. const s = this._injector.get(cn).pitchTopUndoElement();
  17695. s && t(s);
  17696. }
  17697. });
  17698. }
  17699. /**
  17700. * @deprecated use `univerAPI.addEvent(univerAPI.Event.BeforeRedo, () => {})` as instead
  17701. */
  17702. onBeforeRedo(t) {
  17703. return this._injector.get(Pt).beforeCommandExecuted((n) => {
  17704. if (n.id === Tn.id) {
  17705. const s = this._injector.get(cn).pitchTopRedoElement();
  17706. s && t(s);
  17707. }
  17708. });
  17709. }
  17710. /**
  17711. * @deprecated use `univerAPI.addEvent(univerAPI.Event.Redo, () => {})` as instead
  17712. */
  17713. onRedo(t) {
  17714. return this._injector.get(Pt).onCommandExecuted((n) => {
  17715. if (n.id === Tn.id) {
  17716. const s = this._injector.get(cn).pitchTopRedoElement();
  17717. s && t(s);
  17718. }
  17719. });
  17720. }
  17721. };
  17722. di = i0([
  17723. ya(0, ot(Ot)),
  17724. ya(1, ot(Ht))
  17725. ], di);
  17726. var o0 = Object.defineProperty, a0 = Object.getOwnPropertyDescriptor, u0 = (t, e, n, r) => {
  17727. for (var s = r > 1 ? void 0 : r ? a0(e, n) : e, i = t.length - 1, o; i >= 0; i--)
  17728. (o = t[i]) && (s = (r ? o(e, n, s) : o(s)) || s);
  17729. return r && s && o0(e, n, s), s;
  17730. }, wa = (t, e) => (n, r) => e(n, r, t);
  17731. let fi = class extends Fi {
  17732. constructor(t, e) {
  17733. super(), this._injector = t, this._userManagerService = e;
  17734. }
  17735. /**
  17736. * Get current user info.
  17737. * @returns {IUser} Current user info.
  17738. * @example
  17739. * ```typescript
  17740. * univerAPI.getUserManager().getCurrentUser();
  17741. * ```
  17742. */
  17743. getCurrentUser() {
  17744. return this._userManagerService.getCurrentUser();
  17745. }
  17746. };
  17747. fi = u0([
  17748. wa(0, ot(Ot)),
  17749. wa(1, ot(rr))
  17750. ], fi);
  17751. const is = class is {
  17752. static get() {
  17753. if (this._instance)
  17754. return this._instance;
  17755. const e = new is();
  17756. return this._instance = e, e;
  17757. }
  17758. static extend(e) {
  17759. Object.getOwnPropertyNames(e.prototype).forEach((n) => {
  17760. n !== "constructor" && (this.prototype[n] = e.prototype[n]);
  17761. }), Object.getOwnPropertyNames(e).forEach((n) => {
  17762. n !== "prototype" && n !== "name" && n !== "length" && (this[n] = e[n]);
  17763. });
  17764. }
  17765. /**
  17766. * Rectangle utils, including range operations likes merge, subtract, split
  17767. */
  17768. get rectangle() {
  17769. return en;
  17770. }
  17771. /**
  17772. * Number format utils, including parse and strigify about date, price, etc
  17773. */
  17774. get numfmt() {
  17775. return Op;
  17776. }
  17777. /**
  17778. * common tools
  17779. */
  17780. get tools() {
  17781. return re;
  17782. }
  17783. };
  17784. C(is, "_instance");
  17785. let gi = is;
  17786. var l0 = Object.defineProperty, c0 = Object.getOwnPropertyDescriptor, h0 = (t, e, n, r) => {
  17787. for (var s = r > 1 ? void 0 : r ? c0(e, n) : e, i = t.length - 1, o; i >= 0; i--)
  17788. (o = t[i]) && (s = (r ? o(e, n, s) : o(s)) || s);
  17789. return r && s && l0(e, n, s), s;
  17790. }, Mr = (t, e) => (n, r) => e(n, r, t);
  17791. let pi = class extends al {
  17792. constructor(e, n, r, s) {
  17793. super(e);
  17794. C(this, "_eventRegistry", /* @__PURE__ */ new Map());
  17795. this._injector = e, this._commandService = n, this._univerInstanceService = r, this._lifecycleService = s, this.disposeWithMe(
  17796. this._lifecycleService.lifecycle$.subscribe((i) => {
  17797. this.fireEvent(this.Event.LifeCycleChanged, { stage: i });
  17798. })
  17799. ), this.disposeWithMe(
  17800. this._commandService.beforeCommandExecuted((i) => {
  17801. if (!this._eventRegistry.get(this.Event.BeforeRedo) && !this._eventRegistry.get(this.Event.BeforeUndo) && !this._eventRegistry.get(this.Event.BeforeCommandExecute))
  17802. return;
  17803. const { id: o, type: a, params: u } = i, l = { id: o, type: a, params: u };
  17804. switch (i.id) {
  17805. case Tn.id:
  17806. this.fireEvent(this.Event.BeforeRedo, l);
  17807. break;
  17808. case Nn.id:
  17809. this.fireEvent(this.Event.BeforeUndo, l);
  17810. break;
  17811. default:
  17812. this.fireEvent(this.Event.BeforeCommandExecute, l);
  17813. break;
  17814. }
  17815. if (l.cancel)
  17816. throw new xf();
  17817. })
  17818. ), this.disposeWithMe(
  17819. this._commandService.onCommandExecuted((i) => {
  17820. if (!this._eventRegistry.get(this.Event.Redo) && !this._eventRegistry.get(this.Event.Undo) && !this._eventRegistry.get(this.Event.CommandExecuted))
  17821. return;
  17822. const { id: o, type: a, params: u } = i, l = { id: o, type: a, params: u };
  17823. switch (i.id) {
  17824. case Tn.id:
  17825. this.fireEvent(this.Event.Redo, l);
  17826. break;
  17827. case Nn.id:
  17828. this.fireEvent(this.Event.Undo, l);
  17829. break;
  17830. default:
  17831. this.fireEvent(this.Event.CommandExecuted, l);
  17832. break;
  17833. }
  17834. })
  17835. ), this._initUnitEvent(this._injector), this._injector.onDispose(() => {
  17836. this.dispose();
  17837. });
  17838. }
  17839. /**
  17840. * Create an FUniver instance, if the injector is not provided, it will create a new Univer instance.
  17841. * @static
  17842. * @param {Univer | Injector} wrapped - The Univer instance or injector instance.
  17843. * @returns {FUniver} - The FUniver instance.
  17844. */
  17845. static newAPI(e) {
  17846. return (e instanceof GE ? e.__getInjector() : e).createInstance(pi);
  17847. }
  17848. _ensureEventRegistry(e) {
  17849. return this._eventRegistry.has(e) || this._eventRegistry.set(e, new $i()), this._eventRegistry.get(e);
  17850. }
  17851. _initUnitEvent(e) {
  17852. const n = e.get(_n);
  17853. this.disposeWithMe(
  17854. n.unitDisposed$.subscribe((r) => {
  17855. this._eventRegistry.get(this.Event.DocDisposed) && r.type === Fe.UNIVER_DOC && this.fireEvent(
  17856. this.Event.DocDisposed,
  17857. {
  17858. unitId: r.getUnitId(),
  17859. unitType: r.type,
  17860. snapshot: r.getSnapshot()
  17861. }
  17862. );
  17863. })
  17864. ), this.disposeWithMe(
  17865. n.unitAdded$.subscribe((r) => {
  17866. if (this._eventRegistry.get(this.Event.DocCreated) && r.type === Fe.UNIVER_DOC) {
  17867. const s = r, i = e.createInstance(li, s);
  17868. this.fireEvent(
  17869. this.Event.DocCreated,
  17870. {
  17871. unitId: r.getUnitId(),
  17872. type: r.type,
  17873. doc: i,
  17874. unit: i
  17875. }
  17876. );
  17877. }
  17878. })
  17879. );
  17880. }
  17881. _eventListend(e) {
  17882. return this._eventRegistry.get(e);
  17883. }
  17884. /**
  17885. * Dispose the UniverSheet by the `unitId`. The UniverSheet would be unload from the application.
  17886. * @param unitId The unit id of the UniverSheet.
  17887. * @returns Whether the Univer instance is disposed successfully.
  17888. */
  17889. disposeUnit(e) {
  17890. return this._univerInstanceService.disposeUnit(e);
  17891. }
  17892. /**
  17893. * Get the current lifecycle stage.
  17894. * @returns {LifecycleStages} - The current lifecycle stage.
  17895. */
  17896. getCurrentLifecycleStage() {
  17897. return this._injector.get(Ht).stage;
  17898. }
  17899. /**
  17900. * Undo an editing on the currently focused document.
  17901. * @returns {Promise<boolean>} undo result
  17902. */
  17903. undo() {
  17904. return this._commandService.executeCommand(Nn.id);
  17905. }
  17906. /**
  17907. * Redo an editing on the currently focused document.
  17908. * @returns {Promise<boolean>} redo result
  17909. */
  17910. redo() {
  17911. return this._commandService.executeCommand(Tn.id);
  17912. }
  17913. /**
  17914. * Register a callback that will be triggered before invoking a command.
  17915. * @deprecated use `addEvent(univerAPI.event.BeforeCommandExecute, () => {})` instead.
  17916. * @param {CommandListener} callback The callback.
  17917. * @returns {IDisposable} The disposable instance.
  17918. */
  17919. onBeforeCommandExecute(e) {
  17920. return this._commandService.beforeCommandExecuted((n, r) => {
  17921. e(n, r);
  17922. });
  17923. }
  17924. /**
  17925. * Register a callback that will be triggered when a command is invoked.
  17926. * @deprecated use `addEvent(univerAPI.event.CommandExecuted, () => {})` instead.
  17927. * @param {CommandListener} callback The callback.
  17928. * @returns {IDisposable} The disposable instance.
  17929. */
  17930. onCommandExecuted(e) {
  17931. return this._commandService.onCommandExecuted((n, r) => {
  17932. e(n, r);
  17933. });
  17934. }
  17935. /**
  17936. * Execute a command with the given id and parameters.
  17937. * @param id Identifier of the command.
  17938. * @param params Parameters of this execution.
  17939. * @param options Options of this execution.
  17940. * @returns The result of the execution. It is a boolean value by default which indicates the command is executed.
  17941. */
  17942. executeCommand(e, n, r) {
  17943. return this._commandService.executeCommand(e, n, r);
  17944. }
  17945. /**
  17946. * Execute a command with the given id and parameters synchronously.
  17947. * @param id Identifier of the command.
  17948. * @param params Parameters of this execution.
  17949. * @param options Options of this execution.
  17950. * @returns The result of the execution. It is a boolean value by default which indicates the command is executed.
  17951. */
  17952. syncExecuteCommand(e, n, r) {
  17953. return this._commandService.syncExecuteCommand(e, n, r);
  17954. }
  17955. /**
  17956. * Get hooks.
  17957. * @deprecated use `addEvent` instead.
  17958. * @returns {FHooks} FHooks instance
  17959. */
  17960. getHooks() {
  17961. return this._injector.createInstance(di);
  17962. }
  17963. get Enum() {
  17964. return ci.get();
  17965. }
  17966. get Event() {
  17967. return hi.get();
  17968. }
  17969. get Util() {
  17970. return gi.get();
  17971. }
  17972. /**
  17973. * Add an event listener
  17974. * @param event key of event
  17975. * @param callback callback when event triggered
  17976. * @returns {Disposable} The Disposable instance, for remove the listener
  17977. * @example
  17978. * ```ts
  17979. * univerAPI.addEvent(univerAPI.event.UnitCreated, (params) => {
  17980. * console.log('unit created', params);
  17981. * });
  17982. * ```
  17983. */
  17984. addEvent(e, n) {
  17985. return this._ensureEventRegistry(e).add(n), Ze(() => this._ensureEventRegistry(e).delete(n));
  17986. }
  17987. /**
  17988. * Fire an event, used in internal only.
  17989. * @param event {string} key of event
  17990. * @param params {any} params of event
  17991. * @returns {boolean} should cancel
  17992. * @example
  17993. * ```ts
  17994. * this.fireEvent(univerAPI.event.UnitCreated, params);
  17995. * ```
  17996. */
  17997. fireEvent(e, n) {
  17998. var r;
  17999. return (r = this._eventRegistry.get(e)) == null || r.getData().forEach((s) => {
  18000. s(n);
  18001. }), n.cancel;
  18002. }
  18003. /**
  18004. * Get the callback map corresponding to the event
  18005. * @param event
  18006. * @returns {number} The number of callbacks
  18007. */
  18008. hasEventCallback(e) {
  18009. var r, s;
  18010. return ((s = (r = this._eventRegistry.get(e)) == null ? void 0 : r.getData().length) != null ? s : 0) > 0;
  18011. }
  18012. getUserManager() {
  18013. return this._injector.createInstance(fi);
  18014. }
  18015. /**
  18016. * Create a new blob.
  18017. * @returns {FBlob} The new blob instance
  18018. * @example
  18019. * ```ts
  18020. * const blob = univerApi.newBlob();
  18021. * ```
  18022. */
  18023. newBlob() {
  18024. return this._injector.createInstance(ss);
  18025. }
  18026. /**
  18027. * Create a new color.
  18028. * @returns {ColorBuilder} The new color instance
  18029. * @example
  18030. * ```ts
  18031. * const color = univerApi.newColor();
  18032. * ```
  18033. */
  18034. newColor() {
  18035. return new gs();
  18036. }
  18037. /**
  18038. * Create a new rich text.
  18039. * @param data
  18040. * @returns {RichTextBuilder} The new rich text instance
  18041. * @example
  18042. * ```ts
  18043. * const richText = univerApi.newRichText();
  18044. * ```
  18045. */
  18046. newRichText(e) {
  18047. return gn.create(e);
  18048. }
  18049. /**
  18050. * Create a new rich text value.
  18051. * @param data - The rich text data
  18052. * @returns {RichTextValue} The new rich text value instance
  18053. * @example
  18054. * ```ts
  18055. * const richTextValue = univerApi.newRichTextValue();
  18056. * ```
  18057. */
  18058. newRichTextValue(e) {
  18059. return Zt.create(e);
  18060. }
  18061. /**
  18062. * Create a new paragraph style.
  18063. * @param style - The paragraph style
  18064. * @returns {ParagraphStyleBuilder} The new paragraph style instance
  18065. * @example
  18066. * ```ts
  18067. * const paragraphStyle = univerApi.newParagraphStyle();
  18068. * ```
  18069. */
  18070. newParagraphStyle(e) {
  18071. return nr.create(e);
  18072. }
  18073. /**
  18074. * Create a new paragraph style value.
  18075. * @param style - The paragraph style
  18076. * @returns {ParagraphStyleValue} The new paragraph style value instance
  18077. * @example
  18078. * ```ts
  18079. * const paragraphStyleValue = univerApi.newParagraphStyleValue();
  18080. * ```
  18081. */
  18082. newParagraphStyleValue(e) {
  18083. return hr.create(e);
  18084. }
  18085. /**
  18086. * Create a new text style.
  18087. * @param style - The text style
  18088. * @returns {TextStyleBuilder} The new text style instance
  18089. * @example
  18090. * ```ts
  18091. * const textStyle = univerApi.newTextStyle();
  18092. * ```
  18093. */
  18094. newTextStyle(e) {
  18095. return Qt.create(e);
  18096. }
  18097. /**
  18098. * Create a new text style value.
  18099. * @param style - The text style
  18100. * @returns {TextStyleValue} The new text style value instance
  18101. * @example
  18102. * ```ts
  18103. * const textStyleValue = univerApi.newTextStyleValue();
  18104. * ```
  18105. */
  18106. newTextStyleValue(e) {
  18107. return cr.create(e);
  18108. }
  18109. newTextDecoration(e) {
  18110. return new Jt(e);
  18111. }
  18112. };
  18113. pi = h0([
  18114. Mr(0, ot(Ot)),
  18115. Mr(1, Pt),
  18116. Mr(2, _n),
  18117. Mr(3, ot(Ht))
  18118. ], pi);
  18119. function d0(t) {
  18120. return /^-?\d+(\.\d+)?$/.test(t);
  18121. }
  18122. function bR(t) {
  18123. return d0(t) ? Number(t) <= Number.MAX_SAFE_INTEGER : !1;
  18124. }
  18125. function SR(t) {
  18126. const e = new MessageChannel();
  18127. let n = !1;
  18128. const r = () => {
  18129. n || t();
  18130. };
  18131. return e.port1.onmessage = r, e.port2.postMessage(null), () => {
  18132. n = !0, e.port1.close(), e.port2.close();
  18133. };
  18134. }
  18135. function AR(t, e) {
  18136. return e.forEach((n) => t.add(n)), t;
  18137. }
  18138. function NR(t, e, n, r) {
  18139. var c;
  18140. if (e === "")
  18141. return t;
  18142. const s = {
  18143. id: "mock-id",
  18144. body: t,
  18145. documentStyle: {}
  18146. }, i = new jt(s), o = e.length;
  18147. let a;
  18148. for (; (a = (r ? i.getBody().dataStream : i.getBody().dataStream.toLowerCase()).indexOf(e)) >= 0; ) {
  18149. const l = new Ke(), h = tn.getInstance();
  18150. if (a > 0 && l.retain(a), n.length > 0) {
  18151. const d = i.sliceBody(a, a + o), f = {
  18152. dataStream: n
  18153. };
  18154. if (Array.isArray(d == null ? void 0 : d.textRuns) && d.textRuns.length && (f.textRuns = [{
  18155. ...d.textRuns[0],
  18156. st: 0,
  18157. ed: n.length
  18158. }]), (c = d == null ? void 0 : d.customRanges) != null && c.length) {
  18159. const E = d.customRanges[0];
  18160. f.customRanges = [{
  18161. ...E,
  18162. startIndex: 0,
  18163. endIndex: n.length - 1
  18164. }];
  18165. }
  18166. l.insert(n.length, f);
  18167. }
  18168. l.delete(o), i.apply(h.editOp(l.serialize()));
  18169. }
  18170. const u = i.getBody();
  18171. return i.dispose(), u;
  18172. }
  18173. const TR = "__default_document_sub_component_id20231101__";
  18174. class f0 {
  18175. constructor() {
  18176. /**
  18177. * An WorkBookObserver can set this property to true to prevent subsequent observers of being notified
  18178. */
  18179. C(this, "skipNextObservers", !1);
  18180. /**
  18181. * This will be populated with the return value of the last function that was executed.
  18182. * If it is the first function in the callback chain it will be the event data.
  18183. */
  18184. C(this, "lastReturnValue");
  18185. C(this, "isStopPropagation", !1);
  18186. }
  18187. stopPropagation() {
  18188. this.isStopPropagation = !0;
  18189. }
  18190. }
  18191. class MR extends _t {
  18192. constructor() {
  18193. super(...arguments);
  18194. C(this, "_sortedObservers", []);
  18195. }
  18196. /** @deprecated Use `subscribeEvent` instead. */
  18197. subscribe() {
  18198. throw new Error("[EventSubject]: please use `subscribeEvent` instead of `subscribe` method for `EventSubject`.");
  18199. }
  18200. /** @deprecated Use `emitEvent` instead. */
  18201. next() {
  18202. throw new Error("[EventSubject]: please use `emitEvent` instead of `next` method for `EventSubject`.");
  18203. }
  18204. unsubscribe() {
  18205. super.unsubscribe(), this._sortedObservers.length = 0;
  18206. }
  18207. complete() {
  18208. super.complete(), this._sortedObservers.length = 0;
  18209. }
  18210. subscribeEvent(n) {
  18211. let r;
  18212. typeof n == "function" ? r = { next: ([i, o]) => n(i, o) } : r = n;
  18213. const s = super.subscribe(r);
  18214. return this._sortedObservers.push(r), this._sortedObservers.sort((i, o) => {
  18215. var a, u;
  18216. return ((a = i.priority) != null ? a : 0) - ((u = o.priority) != null ? u : 0);
  18217. }), s.add(() => this._sortedObservers = this._sortedObservers.filter((i) => i !== r)), s;
  18218. }
  18219. clearObservers() {
  18220. this._sortedObservers.forEach((n) => {
  18221. var r;
  18222. return (r = n.complete) == null ? void 0 : r.call(n);
  18223. }), this._sortedObservers.length = 0;
  18224. }
  18225. emitEvent(n) {
  18226. var r;
  18227. if (!this.closed) {
  18228. const s = new f0();
  18229. s.lastReturnValue = n;
  18230. for (const i of this._sortedObservers) {
  18231. const o = (r = i.next) == null ? void 0 : r.call(i, [n, s]);
  18232. if (s.lastReturnValue = o, s.skipNextObservers)
  18233. return {
  18234. handled: !0,
  18235. lastReturnValue: s.lastReturnValue,
  18236. stopPropagation: s.isStopPropagation
  18237. };
  18238. }
  18239. return {
  18240. handled: this._sortedObservers.length > 0,
  18241. lastReturnValue: s.lastReturnValue,
  18242. stopPropagation: s.isStopPropagation
  18243. };
  18244. }
  18245. throw new Error("[EventSubject]: cannot emit event on a closed subject.");
  18246. }
  18247. }
  18248. function DR(t) {
  18249. return new sr((e) => {
  18250. const n = t.subscribeEvent((r) => {
  18251. e.next(r);
  18252. });
  18253. return () => n.unsubscribe();
  18254. });
  18255. }
  18256. const xR = Ct("ILocalStorageService");
  18257. function LR(t) {
  18258. return !(t.length === 0 || t.length > 31 || t.startsWith("'") || t.endsWith("'") || /[:\\\/\?\*\[\]]/.test(t));
  18259. }
  18260. function UR(t) {
  18261. return new Promise((e) => setTimeout(e, t));
  18262. }
  18263. function PR(t = 1) {
  18264. return new Promise((e) => {
  18265. let n = 0;
  18266. const r = () => {
  18267. n++, n >= t ? e() : requestAnimationFrame(r);
  18268. };
  18269. requestAnimationFrame(r);
  18270. });
  18271. }
  18272. var vl = /* @__PURE__ */ ((t) => (t.URL = "URL", t.UUID = "UUID", t.BASE64 = "BASE64", t))(vl || {}), g0 = /* @__PURE__ */ ((t) => (t.SUCCUSS = "0", t.ERROR_EXCEED_SIZE = "1", t.ERROR_IMAGE_TYPE = "2", t.ERROR_UPLOAD_COUNT_LIMIT = "3", t.ERROR_IMAGE = "4", t))(g0 || {});
  18273. const Oa = Ct("core.image-io.service");
  18274. class kR {
  18275. constructor(e, n = 100) {
  18276. C(this, "_imageCacheMap");
  18277. this._injector = e, this._imageCacheMap = new Qr(n);
  18278. }
  18279. _getImageCacheKey(e, n) {
  18280. return `${e}-${n}`;
  18281. }
  18282. getImage(e, n, r, s) {
  18283. const i = this._getImageCacheKey(e, n);
  18284. let o = this._imageCacheMap.get(i);
  18285. return o || ((async () => {
  18286. o = new Image();
  18287. const a = this._injector.has(Oa) ? this._injector.get(Oa) : null;
  18288. if (e === vl.UUID)
  18289. try {
  18290. o.src = await (a == null ? void 0 : a.getImage(n)) || "";
  18291. } catch (u) {
  18292. console.error(u);
  18293. }
  18294. else
  18295. o.src = n;
  18296. o.onload = () => {
  18297. r == null || r();
  18298. }, o.onerror = () => {
  18299. s == null || s();
  18300. }, this._imageCacheMap.set(i, o);
  18301. })(), null);
  18302. }
  18303. }
  18304. const FR = ["script", "style", "meta", "comment", "link"];
  18305. var p0 = /* @__PURE__ */ ((t) => (t[t.DISABLED = 0] = "DISABLED", t[t.FULL_ALPHA = 1] = "FULL_ALPHA", t[t.FULL_HANGUL = 2] = "FULL_HANGUL", t[t.FULL_KATAKANA = 3] = "FULL_KATAKANA", t[t.HALF_ALPHA = 4] = "HALF_ALPHA", t[t.HALF_HANGUL = 5] = "HALF_HANGUL", t[t.HALF_KATAKANA = 6] = "HALF_KATAKANA", t[t.HIRAGANA = 7] = "HIRAGANA", t[t.NO_CONTROL = 8] = "NO_CONTROL", t[t.OFF = 9] = "OFF", t[t.ON = 10] = "ON", t))(p0 || {});
  18306. const ba = [
  18307. Int8Array,
  18308. Uint8Array,
  18309. Uint8ClampedArray,
  18310. Int16Array,
  18311. Uint16Array,
  18312. Int32Array,
  18313. Uint32Array,
  18314. Float32Array,
  18315. Float64Array
  18316. ], Ls = 1, jn = 8;
  18317. class ji {
  18318. /**
  18319. * Creates an index from raw `ArrayBuffer` data.
  18320. * @param {ArrayBuffer} data
  18321. */
  18322. static from(e) {
  18323. if (!(e instanceof ArrayBuffer))
  18324. throw new Error("Data must be an instance of ArrayBuffer.");
  18325. const [n, r] = new Uint8Array(e, 0, 2);
  18326. if (n !== 219)
  18327. throw new Error("Data does not appear to be in a KDBush format.");
  18328. const s = r >> 4;
  18329. if (s !== Ls)
  18330. throw new Error(`Got v${s} data when expected v${Ls}.`);
  18331. const i = ba[r & 15];
  18332. if (!i)
  18333. throw new Error("Unrecognized array type.");
  18334. const [o] = new Uint16Array(e, 2, 1), [a] = new Uint32Array(e, 4, 1);
  18335. return new ji(a, o, i, e);
  18336. }
  18337. /**
  18338. * Creates an index that will hold a given number of items.
  18339. * @param {number} numItems
  18340. * @param {number} [nodeSize=64] Size of the KD-tree node (64 by default).
  18341. * @param {TypedArrayConstructor} [ArrayType=Float64Array] The array type used for coordinates storage (`Float64Array` by default).
  18342. * @param {ArrayBuffer} [data] (For internal use only)
  18343. */
  18344. constructor(e, n = 64, r = Float64Array, s) {
  18345. if (isNaN(e) || e < 0) throw new Error(`Unpexpected numItems value: ${e}.`);
  18346. this.numItems = +e, this.nodeSize = Math.min(Math.max(+n, 2), 65535), this.ArrayType = r, this.IndexArrayType = e < 65536 ? Uint16Array : Uint32Array;
  18347. const i = ba.indexOf(this.ArrayType), o = e * 2 * this.ArrayType.BYTES_PER_ELEMENT, a = e * this.IndexArrayType.BYTES_PER_ELEMENT, u = (8 - a % 8) % 8;
  18348. if (i < 0)
  18349. throw new Error(`Unexpected typed array class: ${r}.`);
  18350. s && s instanceof ArrayBuffer ? (this.data = s, this.ids = new this.IndexArrayType(this.data, jn, e), this.coords = new this.ArrayType(this.data, jn + a + u, e * 2), this._pos = e * 2, this._finished = !0) : (this.data = new ArrayBuffer(jn + o + a + u), this.ids = new this.IndexArrayType(this.data, jn, e), this.coords = new this.ArrayType(this.data, jn + a + u, e * 2), this._pos = 0, this._finished = !1, new Uint8Array(this.data, 0, 2).set([219, (Ls << 4) + i]), new Uint16Array(this.data, 2, 1)[0] = n, new Uint32Array(this.data, 4, 1)[0] = e);
  18351. }
  18352. /**
  18353. * Add a point to the index.
  18354. * @param {number} x
  18355. * @param {number} y
  18356. * @returns {number} An incremental index associated with the added item (starting from `0`).
  18357. */
  18358. add(e, n) {
  18359. const r = this._pos >> 1;
  18360. return this.ids[r] = r, this.coords[this._pos++] = e, this.coords[this._pos++] = n, r;
  18361. }
  18362. /**
  18363. * Perform indexing of the added points.
  18364. */
  18365. finish() {
  18366. const e = this._pos >> 1;
  18367. if (e !== this.numItems)
  18368. throw new Error(`Added ${e} items when expected ${this.numItems}.`);
  18369. return mi(this.ids, this.coords, this.nodeSize, 0, this.numItems - 1, 0), this._finished = !0, this;
  18370. }
  18371. /**
  18372. * Search the index for items within a given bounding box.
  18373. * @param {number} minX
  18374. * @param {number} minY
  18375. * @param {number} maxX
  18376. * @param {number} maxY
  18377. * @returns {number[]} An array of indices correponding to the found items.
  18378. */
  18379. range(e, n, r, s) {
  18380. if (!this._finished) throw new Error("Data not yet indexed - call index.finish().");
  18381. const { ids: i, coords: o, nodeSize: a } = this, u = [0, i.length - 1, 0], c = [];
  18382. for (; u.length; ) {
  18383. const l = u.pop() || 0, h = u.pop() || 0, d = u.pop() || 0;
  18384. if (h - d <= a) {
  18385. for (let O = d; O <= h; O++) {
  18386. const U = o[2 * O], ne = o[2 * O + 1];
  18387. U >= e && U <= r && ne >= n && ne <= s && c.push(i[O]);
  18388. }
  18389. continue;
  18390. }
  18391. const f = d + h >> 1, E = o[2 * f], R = o[2 * f + 1];
  18392. E >= e && E <= r && R >= n && R <= s && c.push(i[f]), (l === 0 ? e <= E : n <= R) && (u.push(d), u.push(f - 1), u.push(1 - l)), (l === 0 ? r >= E : s >= R) && (u.push(f + 1), u.push(h), u.push(1 - l));
  18393. }
  18394. return c;
  18395. }
  18396. /**
  18397. * Search the index for items within a given radius.
  18398. * @param {number} qx
  18399. * @param {number} qy
  18400. * @param {number} r Query radius.
  18401. * @returns {number[]} An array of indices correponding to the found items.
  18402. */
  18403. within(e, n, r) {
  18404. if (!this._finished) throw new Error("Data not yet indexed - call index.finish().");
  18405. const { ids: s, coords: i, nodeSize: o } = this, a = [0, s.length - 1, 0], u = [], c = r * r;
  18406. for (; a.length; ) {
  18407. const l = a.pop() || 0, h = a.pop() || 0, d = a.pop() || 0;
  18408. if (h - d <= o) {
  18409. for (let O = d; O <= h; O++)
  18410. Sa(i[2 * O], i[2 * O + 1], e, n) <= c && u.push(s[O]);
  18411. continue;
  18412. }
  18413. const f = d + h >> 1, E = i[2 * f], R = i[2 * f + 1];
  18414. Sa(E, R, e, n) <= c && u.push(s[f]), (l === 0 ? e - r <= E : n - r <= R) && (a.push(d), a.push(f - 1), a.push(1 - l)), (l === 0 ? e + r >= E : n + r >= R) && (a.push(f + 1), a.push(h), a.push(1 - l));
  18415. }
  18416. return u;
  18417. }
  18418. }
  18419. function mi(t, e, n, r, s, i) {
  18420. if (s - r <= n) return;
  18421. const o = r + s >> 1;
  18422. yl(t, e, o, r, s, i), mi(t, e, n, r, o - 1, 1 - i), mi(t, e, n, o + 1, s, 1 - i);
  18423. }
  18424. function yl(t, e, n, r, s, i) {
  18425. for (; s > r; ) {
  18426. if (s - r > 600) {
  18427. const c = s - r + 1, l = n - r + 1, h = Math.log(c), d = 0.5 * Math.exp(2 * h / 3), f = 0.5 * Math.sqrt(h * d * (c - d) / c) * (l - c / 2 < 0 ? -1 : 1), E = Math.max(r, Math.floor(n - l * d / c + f)), R = Math.min(s, Math.floor(n + (c - l) * d / c + f));
  18428. yl(t, e, n, E, R, i);
  18429. }
  18430. const o = e[2 * n + i];
  18431. let a = r, u = s;
  18432. for (Hn(t, e, r, n), e[2 * s + i] > o && Hn(t, e, r, s); a < u; ) {
  18433. for (Hn(t, e, a, u), a++, u--; e[2 * a + i] < o; ) a++;
  18434. for (; e[2 * u + i] > o; ) u--;
  18435. }
  18436. e[2 * r + i] === o ? Hn(t, e, r, u) : (u++, Hn(t, e, u, s)), u <= n && (r = u + 1), n <= u && (s = u - 1);
  18437. }
  18438. }
  18439. function Hn(t, e, n, r) {
  18440. Us(t, n, r), Us(e, 2 * n, 2 * r), Us(e, 2 * n + 1, 2 * r + 1);
  18441. }
  18442. function Us(t, e, n) {
  18443. const r = t[e];
  18444. t[e] = t[n], t[n] = r;
  18445. }
  18446. function Sa(t, e, n, r) {
  18447. const s = t - n, i = e - r;
  18448. return s * s + i * i;
  18449. }
  18450. function wl(t, e, n = 0, r = t.length - 1, s = m0) {
  18451. for (; r > n; ) {
  18452. if (r - n > 600) {
  18453. const u = r - n + 1, c = e - n + 1, l = Math.log(u), h = 0.5 * Math.exp(2 * l / 3), d = 0.5 * Math.sqrt(l * h * (u - h) / u) * (c - u / 2 < 0 ? -1 : 1), f = Math.max(n, Math.floor(e - c * h / u + d)), E = Math.min(r, Math.floor(e + (u - c) * h / u + d));
  18454. wl(t, e, f, E, s);
  18455. }
  18456. const i = t[e];
  18457. let o = n, a = r;
  18458. for (Wn(t, n, e), s(t[r], i) > 0 && Wn(t, n, r); o < a; ) {
  18459. for (Wn(t, o, a), o++, a--; s(t[o], i) < 0; ) o++;
  18460. for (; s(t[a], i) > 0; ) a--;
  18461. }
  18462. s(t[n], i) === 0 ? Wn(t, n, a) : (a++, Wn(t, a, r)), a <= e && (n = a + 1), e <= a && (r = a - 1);
  18463. }
  18464. }
  18465. function Wn(t, e, n) {
  18466. const r = t[e];
  18467. t[e] = t[n], t[n] = r;
  18468. }
  18469. function m0(t, e) {
  18470. return t < e ? -1 : t > e ? 1 : 0;
  18471. }
  18472. class Aa {
  18473. constructor(e = 9) {
  18474. this._maxEntries = Math.max(4, e), this._minEntries = Math.max(2, Math.ceil(this._maxEntries * 0.4)), this.clear();
  18475. }
  18476. all() {
  18477. return this._all(this.data, []);
  18478. }
  18479. search(e) {
  18480. let n = this.data;
  18481. const r = [];
  18482. if (!xr(e, n)) return r;
  18483. const s = this.toBBox, i = [];
  18484. for (; n; ) {
  18485. for (let o = 0; o < n.children.length; o++) {
  18486. const a = n.children[o], u = n.leaf ? s(a) : a;
  18487. xr(e, u) && (n.leaf ? r.push(a) : ks(e, u) ? this._all(a, r) : i.push(a));
  18488. }
  18489. n = i.pop();
  18490. }
  18491. return r;
  18492. }
  18493. collides(e) {
  18494. let n = this.data;
  18495. if (!xr(e, n)) return !1;
  18496. const r = [];
  18497. for (; n; ) {
  18498. for (let s = 0; s < n.children.length; s++) {
  18499. const i = n.children[s], o = n.leaf ? this.toBBox(i) : i;
  18500. if (xr(e, o)) {
  18501. if (n.leaf || ks(e, o)) return !0;
  18502. r.push(i);
  18503. }
  18504. }
  18505. n = r.pop();
  18506. }
  18507. return !1;
  18508. }
  18509. load(e) {
  18510. if (!(e && e.length)) return this;
  18511. if (e.length < this._minEntries) {
  18512. for (let r = 0; r < e.length; r++)
  18513. this.insert(e[r]);
  18514. return this;
  18515. }
  18516. let n = this._build(e.slice(), 0, e.length - 1, 0);
  18517. if (!this.data.children.length)
  18518. this.data = n;
  18519. else if (this.data.height === n.height)
  18520. this._splitRoot(this.data, n);
  18521. else {
  18522. if (this.data.height < n.height) {
  18523. const r = this.data;
  18524. this.data = n, n = r;
  18525. }
  18526. this._insert(n, this.data.height - n.height - 1, !0);
  18527. }
  18528. return this;
  18529. }
  18530. insert(e) {
  18531. return e && this._insert(e, this.data.height - 1), this;
  18532. }
  18533. clear() {
  18534. return this.data = yn([]), this;
  18535. }
  18536. remove(e, n) {
  18537. if (!e) return this;
  18538. let r = this.data;
  18539. const s = this.toBBox(e), i = [], o = [];
  18540. let a, u, c;
  18541. for (; r || i.length; ) {
  18542. if (r || (r = i.pop(), u = i[i.length - 1], a = o.pop(), c = !0), r.leaf) {
  18543. const l = _0(e, r.children, n);
  18544. if (l !== -1)
  18545. return r.children.splice(l, 1), i.push(r), this._condense(i), this;
  18546. }
  18547. !c && !r.leaf && ks(r, s) ? (i.push(r), o.push(a), a = 0, u = r, r = r.children[0]) : u ? (a++, r = u.children[a], c = !1) : r = null;
  18548. }
  18549. return this;
  18550. }
  18551. toBBox(e) {
  18552. return e;
  18553. }
  18554. compareMinX(e, n) {
  18555. return e.minX - n.minX;
  18556. }
  18557. compareMinY(e, n) {
  18558. return e.minY - n.minY;
  18559. }
  18560. toJSON() {
  18561. return this.data;
  18562. }
  18563. fromJSON(e) {
  18564. return this.data = e, this;
  18565. }
  18566. _all(e, n) {
  18567. const r = [];
  18568. for (; e; )
  18569. e.leaf ? n.push(...e.children) : r.push(...e.children), e = r.pop();
  18570. return n;
  18571. }
  18572. _build(e, n, r, s) {
  18573. const i = r - n + 1;
  18574. let o = this._maxEntries, a;
  18575. if (i <= o)
  18576. return a = yn(e.slice(n, r + 1)), vn(a, this.toBBox), a;
  18577. s || (s = Math.ceil(Math.log(i) / Math.log(o)), o = Math.ceil(i / Math.pow(o, s - 1))), a = yn([]), a.leaf = !1, a.height = s;
  18578. const u = Math.ceil(i / o), c = u * Math.ceil(Math.sqrt(o));
  18579. Na(e, n, r, c, this.compareMinX);
  18580. for (let l = n; l <= r; l += c) {
  18581. const h = Math.min(l + c - 1, r);
  18582. Na(e, l, h, u, this.compareMinY);
  18583. for (let d = l; d <= h; d += u) {
  18584. const f = Math.min(d + u - 1, h);
  18585. a.children.push(this._build(e, d, f, s - 1));
  18586. }
  18587. }
  18588. return vn(a, this.toBBox), a;
  18589. }
  18590. _chooseSubtree(e, n, r, s) {
  18591. for (; s.push(n), !(n.leaf || s.length - 1 === r); ) {
  18592. let i = 1 / 0, o = 1 / 0, a;
  18593. for (let u = 0; u < n.children.length; u++) {
  18594. const c = n.children[u], l = Ps(c), h = R0(e, c) - l;
  18595. h < o ? (o = h, i = l < i ? l : i, a = c) : h === o && l < i && (i = l, a = c);
  18596. }
  18597. n = a || n.children[0];
  18598. }
  18599. return n;
  18600. }
  18601. _insert(e, n, r) {
  18602. const s = r ? e : this.toBBox(e), i = [], o = this._chooseSubtree(s, this.data, n, i);
  18603. for (o.children.push(e), Xn(o, s); n >= 0 && i[n].children.length > this._maxEntries; )
  18604. this._split(i, n), n--;
  18605. this._adjustParentBBoxes(s, i, n);
  18606. }
  18607. // split overflowed node into two
  18608. _split(e, n) {
  18609. const r = e[n], s = r.children.length, i = this._minEntries;
  18610. this._chooseSplitAxis(r, i, s);
  18611. const o = this._chooseSplitIndex(r, i, s), a = yn(r.children.splice(o, r.children.length - o));
  18612. a.height = r.height, a.leaf = r.leaf, vn(r, this.toBBox), vn(a, this.toBBox), n ? e[n - 1].children.push(a) : this._splitRoot(r, a);
  18613. }
  18614. _splitRoot(e, n) {
  18615. this.data = yn([e, n]), this.data.height = e.height + 1, this.data.leaf = !1, vn(this.data, this.toBBox);
  18616. }
  18617. _chooseSplitIndex(e, n, r) {
  18618. let s, i = 1 / 0, o = 1 / 0;
  18619. for (let a = n; a <= r - n; a++) {
  18620. const u = Kn(e, 0, a, this.toBBox), c = Kn(e, a, r, this.toBBox), l = I0(u, c), h = Ps(u) + Ps(c);
  18621. l < i ? (i = l, s = a, o = h < o ? h : o) : l === i && h < o && (o = h, s = a);
  18622. }
  18623. return s || r - n;
  18624. }
  18625. // sorts node children by the best axis for split
  18626. _chooseSplitAxis(e, n, r) {
  18627. const s = e.leaf ? this.compareMinX : E0, i = e.leaf ? this.compareMinY : C0, o = this._allDistMargin(e, n, r, s), a = this._allDistMargin(e, n, r, i);
  18628. o < a && e.children.sort(s);
  18629. }
  18630. // total margin of all possible split distributions where each node is at least m full
  18631. _allDistMargin(e, n, r, s) {
  18632. e.children.sort(s);
  18633. const i = this.toBBox, o = Kn(e, 0, n, i), a = Kn(e, r - n, r, i);
  18634. let u = Dr(o) + Dr(a);
  18635. for (let c = n; c < r - n; c++) {
  18636. const l = e.children[c];
  18637. Xn(o, e.leaf ? i(l) : l), u += Dr(o);
  18638. }
  18639. for (let c = r - n - 1; c >= n; c--) {
  18640. const l = e.children[c];
  18641. Xn(a, e.leaf ? i(l) : l), u += Dr(a);
  18642. }
  18643. return u;
  18644. }
  18645. _adjustParentBBoxes(e, n, r) {
  18646. for (let s = r; s >= 0; s--)
  18647. Xn(n[s], e);
  18648. }
  18649. _condense(e) {
  18650. for (let n = e.length - 1, r; n >= 0; n--)
  18651. e[n].children.length === 0 ? n > 0 ? (r = e[n - 1].children, r.splice(r.indexOf(e[n]), 1)) : this.clear() : vn(e[n], this.toBBox);
  18652. }
  18653. }
  18654. function _0(t, e, n) {
  18655. if (!n) return e.indexOf(t);
  18656. for (let r = 0; r < e.length; r++)
  18657. if (n(t, e[r])) return r;
  18658. return -1;
  18659. }
  18660. function vn(t, e) {
  18661. Kn(t, 0, t.children.length, e, t);
  18662. }
  18663. function Kn(t, e, n, r, s) {
  18664. s || (s = yn(null)), s.minX = 1 / 0, s.minY = 1 / 0, s.maxX = -1 / 0, s.maxY = -1 / 0;
  18665. for (let i = e; i < n; i++) {
  18666. const o = t.children[i];
  18667. Xn(s, t.leaf ? r(o) : o);
  18668. }
  18669. return s;
  18670. }
  18671. function Xn(t, e) {
  18672. return t.minX = Math.min(t.minX, e.minX), t.minY = Math.min(t.minY, e.minY), t.maxX = Math.max(t.maxX, e.maxX), t.maxY = Math.max(t.maxY, e.maxY), t;
  18673. }
  18674. function E0(t, e) {
  18675. return t.minX - e.minX;
  18676. }
  18677. function C0(t, e) {
  18678. return t.minY - e.minY;
  18679. }
  18680. function Ps(t) {
  18681. return (t.maxX - t.minX) * (t.maxY - t.minY);
  18682. }
  18683. function Dr(t) {
  18684. return t.maxX - t.minX + (t.maxY - t.minY);
  18685. }
  18686. function R0(t, e) {
  18687. return (Math.max(e.maxX, t.maxX) - Math.min(e.minX, t.minX)) * (Math.max(e.maxY, t.maxY) - Math.min(e.minY, t.minY));
  18688. }
  18689. function I0(t, e) {
  18690. const n = Math.max(t.minX, e.minX), r = Math.max(t.minY, e.minY), s = Math.min(t.maxX, e.maxX), i = Math.min(t.maxY, e.maxY);
  18691. return Math.max(0, s - n) * Math.max(0, i - r);
  18692. }
  18693. function ks(t, e) {
  18694. return t.minX <= e.minX && t.minY <= e.minY && e.maxX <= t.maxX && e.maxY <= t.maxY;
  18695. }
  18696. function xr(t, e) {
  18697. return e.minX <= t.maxX && e.minY <= t.maxY && e.maxX >= t.minX && e.maxY >= t.minY;
  18698. }
  18699. function yn(t) {
  18700. return {
  18701. children: t,
  18702. height: 1,
  18703. leaf: !0,
  18704. minX: 1 / 0,
  18705. minY: 1 / 0,
  18706. maxX: -1 / 0,
  18707. maxY: -1 / 0
  18708. };
  18709. }
  18710. function Na(t, e, n, r, s) {
  18711. const i = [e, n];
  18712. for (; i.length; ) {
  18713. if (n = i.pop(), e = i.pop(), n - e <= r) continue;
  18714. const o = e + Math.ceil((n - e) / r / 2) * r;
  18715. wl(t, o, e, n, s), i.push(e, o, o, n);
  18716. }
  18717. }
  18718. class $R {
  18719. constructor(e = !1) {
  18720. C(this, "_tree", /* @__PURE__ */ new Map());
  18721. // unitId -> subUnitId -> row -> column -> ids
  18722. C(this, "_oneCellCache", /* @__PURE__ */ new Map());
  18723. C(this, "_kdTree", /* @__PURE__ */ new Map());
  18724. this._enableOneCellCache = e;
  18725. }
  18726. dispose() {
  18727. this.clear();
  18728. }
  18729. getTree(e, n) {
  18730. return this._tree.has(e) || this._tree.set(e, /* @__PURE__ */ new Map()), this._tree.get(e).has(n) || this._tree.get(e).set(n, new Aa()), this._tree.get(e).get(n);
  18731. }
  18732. _getOneCellCache(e, n, r, s) {
  18733. return this._oneCellCache.has(e) || this._oneCellCache.set(e, /* @__PURE__ */ new Map()), this._oneCellCache.get(e).has(n) || this._oneCellCache.get(e).set(n, /* @__PURE__ */ new Map()), this._oneCellCache.get(e).get(n).has(r) || this._oneCellCache.get(e).get(n).set(r, /* @__PURE__ */ new Map()), this._oneCellCache.get(e).get(n).get(r).has(s) || this._oneCellCache.get(e).get(n).get(r).set(s, /* @__PURE__ */ new Set()), this._oneCellCache.get(e).get(n).get(r).get(s);
  18734. }
  18735. _removeOneCellCache(e, n, r, s, i) {
  18736. const o = this._oneCellCache.get(e);
  18737. if (!o) return;
  18738. const a = o.get(n);
  18739. if (!a) return;
  18740. const u = a.get(r);
  18741. if (!u) return;
  18742. const c = u.get(s);
  18743. c && c.delete(i);
  18744. }
  18745. _removeCellCacheByRange(e) {
  18746. const { unitId: n, sheetId: r, range: s, id: i } = e, o = this._oneCellCache.get(n);
  18747. if (!o) return;
  18748. const a = o.get(r);
  18749. if (!a) return;
  18750. const { startRow: u, startColumn: c, endRow: l, endColumn: h } = s;
  18751. for (let d = u; d <= l; d++) {
  18752. const f = a.get(d);
  18753. if (f)
  18754. for (let E = c; E <= h; E++) {
  18755. const R = f.get(E);
  18756. R && R.delete(i);
  18757. }
  18758. }
  18759. }
  18760. _insertOneCellCache(e, n, r, s, i) {
  18761. this._getOneCellCache(e, n, r, s).add(i);
  18762. }
  18763. _getRdTreeItems(e) {
  18764. const n = [];
  18765. for (const [r, s] of e)
  18766. for (const [i, o] of s)
  18767. n.push({
  18768. x: i,
  18769. y: r,
  18770. ids: o
  18771. });
  18772. return n;
  18773. }
  18774. _searchByOneCellCache(e) {
  18775. var E;
  18776. const { unitId: n, sheetId: r, range: s } = e, { startRow: i, startColumn: o, endRow: a, endColumn: u } = s, c = (E = this._kdTree.get(n)) == null ? void 0 : E.get(r);
  18777. if (!c)
  18778. return [];
  18779. const { tree: l, items: h } = c, d = l.range(o, i, u, a), f = [];
  18780. for (const R of d) {
  18781. const O = h[R];
  18782. f.push(...Array.from(O.ids));
  18783. }
  18784. return f;
  18785. }
  18786. /**
  18787. * Open the kd-tree search state.
  18788. * The kd-tree is used to search for data in a single cell.
  18789. */
  18790. openKdTree() {
  18791. var e;
  18792. for (const [n, r] of this._oneCellCache) {
  18793. this._kdTree.has(n) || this._kdTree.set(n, /* @__PURE__ */ new Map());
  18794. for (const [s, i] of r) {
  18795. const o = this._getRdTreeItems(i), a = new ji(o.length);
  18796. (e = this._kdTree.get(n)) == null || e.set(s, {
  18797. tree: a,
  18798. items: o
  18799. });
  18800. for (const u of o)
  18801. a.add(u.x, u.y);
  18802. a.finish();
  18803. }
  18804. }
  18805. }
  18806. closeKdTree() {
  18807. var e;
  18808. for (const [n, r] of this._oneCellCache)
  18809. for (const [s, i] of r)
  18810. (e = this._kdTree.get(n)) == null || e.set(s, void 0);
  18811. }
  18812. insert(e) {
  18813. const { unitId: n, sheetId: r, range: s, id: i } = e;
  18814. if (!n || n.length === 0)
  18815. return;
  18816. let { startRow: o, endRow: a, startColumn: u, endColumn: c } = s;
  18817. if (this._enableOneCellCache && o === a && u === c) {
  18818. this._insertOneCellCache(n, r, o, u, i);
  18819. return;
  18820. }
  18821. const l = this.getTree(n, r);
  18822. Number.isNaN(o) && (o = 0), Number.isNaN(u) && (u = 0), Number.isNaN(a) && (a = Number.POSITIVE_INFINITY), Number.isNaN(c) && (c = Number.POSITIVE_INFINITY), l.insert({
  18823. minX: u,
  18824. minY: o,
  18825. maxX: c,
  18826. maxY: a,
  18827. id: i
  18828. });
  18829. }
  18830. bulkInsert(e) {
  18831. for (const n of e)
  18832. this.insert(n);
  18833. }
  18834. *searchGenerator(e) {
  18835. var a;
  18836. const { unitId: n, sheetId: r, range: s } = e;
  18837. if (this._enableOneCellCache) {
  18838. const u = this._searchByOneCellCache(e);
  18839. for (const c of u)
  18840. yield c;
  18841. }
  18842. const i = (a = this._tree.get(n)) == null ? void 0 : a.get(r);
  18843. if (!i)
  18844. return;
  18845. const o = i.search({
  18846. minX: s.startColumn,
  18847. minY: s.startRow,
  18848. maxX: s.endColumn,
  18849. maxY: s.endRow
  18850. });
  18851. for (const u of o)
  18852. yield u.id;
  18853. }
  18854. bulkSearch(e, n) {
  18855. const r = /* @__PURE__ */ new Set();
  18856. for (const s of e)
  18857. for (const i of this.searchGenerator(s))
  18858. (n == null ? void 0 : n.has(i)) !== !0 && r.add(i);
  18859. return r;
  18860. }
  18861. removeById(e, n) {
  18862. var r, s;
  18863. n ? ((r = this._tree.get(e)) == null || r.delete(n), (s = this._oneCellCache.get(e)) == null || s.delete(n)) : (this._tree.delete(e), this._oneCellCache.delete(e));
  18864. }
  18865. _removeRTreeItem(e) {
  18866. const { unitId: n, sheetId: r, range: s, id: i } = e, o = this.getTree(n, r), a = o.search({
  18867. minX: s.startColumn,
  18868. minY: s.startRow,
  18869. maxX: s.endColumn,
  18870. maxY: s.endRow
  18871. });
  18872. for (let u = 0; u < a.length; u++)
  18873. a[u].id === i && o.remove(a[u]);
  18874. }
  18875. remove(e) {
  18876. const { unitId: n, sheetId: r, range: s, id: i } = e, { startRow: o, startColumn: a, endRow: u, endColumn: c } = s;
  18877. this._enableOneCellCache ? o === u && a === c ? this._removeOneCellCache(n, r, s.startRow, s.startColumn, i) : (this._removeCellCacheByRange(e), this._removeRTreeItem(e)) : this._removeRTreeItem(e);
  18878. }
  18879. bulkRemove(e) {
  18880. for (const n of e)
  18881. this.remove(n);
  18882. }
  18883. clear() {
  18884. this._tree.clear(), this._oneCellCache.clear();
  18885. }
  18886. toJSON() {
  18887. const e = {};
  18888. return this._tree.forEach((n, r) => {
  18889. e[r] = {}, n.forEach((s, i) => {
  18890. e[r][i] = s.toJSON();
  18891. });
  18892. }), e;
  18893. }
  18894. fromJSON(e) {
  18895. this._tree.clear();
  18896. for (const n in e) {
  18897. this._tree.set(n, /* @__PURE__ */ new Map());
  18898. for (const r in e[n]) {
  18899. const s = new Aa();
  18900. s.fromJSON(e[n][r]), this._tree.get(n).set(r, s);
  18901. }
  18902. }
  18903. }
  18904. }
  18905. Hl();
  18906. export {
  18907. YC as ABCToNumber,
  18908. P0 as AUTO_HEIGHT_FOR_MERGED_CELLS,
  18909. tt as AbsoluteRefType,
  18910. Bn as ActionIterator,
  18911. lm as AlignTypeH,
  18912. cm as AlignTypeV,
  18913. fm as ArrangeTypeEnum,
  18914. qf as ArrowsAndMarkersShapes,
  18915. iR as AsyncInterceptorManager,
  18916. oi as AuthzIoLocalService,
  18917. _u as AutoFillSeries,
  18918. Bt as BaselineOffset,
  18919. Qf as BasicShapes,
  18920. Hp as BlockType,
  18921. we as BooleanNumber,
  18922. Xe as BorderStyleTypes,
  18923. Eu as BorderType,
  18924. st as BuildTextUtils,
  18925. ms as BulletAlignment,
  18926. xo as COLORS,
  18927. xf as CanceledError,
  18928. zn as CellModeEnum,
  18929. dn as CellValueType,
  18930. Ln as Color,
  18931. gs as ColorBuilder,
  18932. Nt as ColorKit,
  18933. vt as ColorType,
  18934. Yp as ColumnSeparatorType,
  18935. Ys as CommandService,
  18936. ar as CommandType,
  18937. Cu as CommonHideTypes,
  18938. AE as ConfigService,
  18939. Ff as ContextService,
  18940. Ru as CopyPasteType,
  18941. wo as CustomCommandExecutionError,
  18942. An as CustomDecorationType,
  18943. mn as CustomRangeType,
  18944. $C as DEFAULT_CELL,
  18945. tl as DEFAULT_DOC,
  18946. TR as DEFAULT_DOCUMENT_SUB_COMPONENT_ID,
  18947. Wd as DEFAULT_EMPTY_DOCUMENT_VALUE,
  18948. kC as DEFAULT_RANGE,
  18949. PC as DEFAULT_RANGE_ARRAY,
  18950. FC as DEFAULT_SELECTION,
  18951. Ap as DEFAULT_SLIDE,
  18952. gt as DEFAULT_STYLES,
  18953. G_ as DEFAULT_WORKSHEET_COLUMN_COUNT,
  18954. cR as DEFAULT_WORKSHEET_COLUMN_COUNT_KEY,
  18955. Z_ as DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT,
  18956. gR as DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT_KEY,
  18957. X_ as DEFAULT_WORKSHEET_COLUMN_WIDTH,
  18958. dR as DEFAULT_WORKSHEET_COLUMN_WIDTH_KEY,
  18959. V_ as DEFAULT_WORKSHEET_ROW_COUNT,
  18960. lR as DEFAULT_WORKSHEET_ROW_COUNT_KEY,
  18961. K_ as DEFAULT_WORKSHEET_ROW_HEIGHT,
  18962. hR as DEFAULT_WORKSHEET_ROW_HEIGHT_KEY,
  18963. J_ as DEFAULT_WORKSHEET_ROW_TITLE_WIDTH,
  18964. fR as DEFAULT_WORKSHEET_ROW_TITLE_WIDTH_KEY,
  18965. iu as DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY,
  18966. su as DOCS_NORMAL_EDITOR_UNIT_ID_KEY,
  18967. Hd as DOCS_ZEN_EDITOR_UNIT_ID_KEY,
  18968. Ag as DOC_RANGE_TYPE,
  18969. Qp as DashStyleType,
  18970. O_ as DataStreamTreeNodeType,
  18971. ln as DataStreamTreeTokenType,
  18972. _l as DataValidationErrorStyle,
  18973. p0 as DataValidationImeMode,
  18974. El as DataValidationOperator,
  18975. Cl as DataValidationRenderMode,
  18976. Rl as DataValidationStatus,
  18977. Il as DataValidationType,
  18978. Iu as DeleteDirection,
  18979. OR as DependentOn,
  18980. Bf as DesktopLogService,
  18981. vu as DeveloperMetadataVisibility,
  18982. yu as Dimension,
  18983. wu as Direction,
  18984. nt as Disposable,
  18985. Mi as DisposableCollection,
  18986. Bp as DocStyleType,
  18987. jt as DocumentDataModel,
  18988. ku as DocumentFlavor,
  18989. gm as DrawingTypeEnum,
  18990. oE as EDITOR_ACTIVATED,
  18991. Np as EXTENSION_NAMES,
  18992. NE as ErrorService,
  18993. f0 as EventState,
  18994. MR as EventSubject,
  18995. Fi as FBase,
  18996. al as FBaseInitialable,
  18997. ss as FBlob,
  18998. ci as FEnum,
  18999. hi as FEventName,
  19000. di as FHooks,
  19001. yR as FOCUSING_COMMON_DRAWINGS,
  19002. Nr as FOCUSING_DOC,
  19003. _R as FOCUSING_EDITOR_BUT_HIDDEN,
  19004. ER as FOCUSING_EDITOR_INPUT_FORMULA,
  19005. RR as FOCUSING_EDITOR_STANDALONE,
  19006. aE as FOCUSING_FX_BAR_EDITOR,
  19007. IR as FOCUSING_PANEL_EDITOR,
  19008. Gn as FOCUSING_SHEET,
  19009. Tr as FOCUSING_SLIDE,
  19010. Ar as FOCUSING_UNIT,
  19011. CR as FOCUSING_UNIVER_EDITOR,
  19012. vR as FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE,
  19013. wR as FORMULA_EDITOR_ACTIVATED,
  19014. pi as FUniver,
  19015. gi as FUtil,
  19016. jp as FollowNumberWithType,
  19017. Vs as FontItalic,
  19018. Yn as FontStyleType,
  19019. Gs as FontWeight,
  19020. Wp as GridType,
  19021. pg as HLSColor,
  19022. Xt as HorizontalAlign,
  19023. bE as IAuthzIoService,
  19024. Pt as ICommandService,
  19025. SE as IConfigService,
  19026. fs as IContextService,
  19027. Oa as IImageIoService,
  19028. xR as ILocalStorageService,
  19029. Mt as ILogService,
  19030. LE as IMentionIOService,
  19031. UE as IPermissionService,
  19032. va as IResourceLoaderService,
  19033. Bi as IResourceManagerService,
  19034. U0 as IS_ROW_STYLE_PRECEDE_COLUMN_STYLE,
  19035. cn as IUndoRedoService,
  19036. _n as IUniverInstanceService,
  19037. kR as ImageCacheMap,
  19038. vl as ImageSourceType,
  19039. g0 as ImageUploadStatusType,
  19040. ot as Inject,
  19041. Ot as Injector,
  19042. Vn as InterceptorEffectEnum,
  19043. rR as InterceptorManager,
  19044. Ou as InterpolationPointType,
  19045. JC as JSON1,
  19046. tn as JSONX,
  19047. Cr as LRUHelper,
  19048. Qr as LRUMap,
  19049. Ht as LifecycleService,
  19050. Ve as LifecycleStages,
  19051. Te as ListGlyphType,
  19052. ri as LocalUndoRedoService,
  19053. Vr as LocaleService,
  19054. ur as LocaleType,
  19055. $f as LogLevel,
  19056. $t as LookUp,
  19057. mr as MOVE_BUFFER_VALUE,
  19058. tf as Many,
  19059. lr as MemoryCursor,
  19060. ai as MentionIOLocalService,
  19061. Zr as MentionType,
  19062. Jp as NamedStyleType,
  19063. Yf as NilCommand,
  19064. um as NumberUnitType,
  19065. kt as ObjectMatrix,
  19066. om as ObjectRelativeFromH,
  19067. am as ObjectRelativeFromV,
  19068. nf as Optional,
  19069. eg as OtherShapes,
  19070. Es as PRESET_LIST_TYPE,
  19071. pm as PageElementType,
  19072. dm as PageOrientType,
  19073. Fu as PageType,
  19074. Gp as ParagraphElementType,
  19075. nr as ParagraphStyleBuilder,
  19076. hr as ParagraphStyleValue,
  19077. PE as PermissionService,
  19078. fl as PermissionStatus,
  19079. Ra as Plugin,
  19080. ns as PluginService,
  19081. Xp as PositionedObjectLayoutType,
  19082. Ft as PresetListType,
  19083. bu as ProtectionType,
  19084. Ge as Quantity,
  19085. Nm as QuickListType,
  19086. ZC as QuickListTypeMap,
  19087. Sg as RANGE_DIRECTION,
  19088. De as RANGE_TYPE,
  19089. Aa as RBush,
  19090. Z0 as RCDisposable,
  19091. cC as RGBA_PAREN,
  19092. lC as RGB_PAREN,
  19093. Zf as ROTATE_BUFFER_VALUE,
  19094. $R as RTree,
  19095. tr as Range,
  19096. en as Rectangle,
  19097. vf as RediConsumer,
  19098. ds as RediContext,
  19099. at as RediError,
  19100. gu as RediProvider,
  19101. Tn as RedoCommand,
  19102. RE as RedoCommandId,
  19103. zC as RefAlias,
  19104. $i as Registry,
  19105. ul as RegistryAsMap,
  19106. Su as RelativeDate,
  19107. mm as RelativeSlideLink,
  19108. VE as ResourceManagerService,
  19109. Ks as RgbColor,
  19110. gn as RichTextBuilder,
  19111. Zt as RichTextValue,
  19112. J0 as RxDisposable,
  19113. BC as SHEET_EDITOR_UNITS,
  19114. zp as SectionType,
  19115. Zd as Self,
  19116. Au as SheetTypes,
  19117. eE as SheetViewModel,
  19118. Jd as SkipSelf,
  19119. el as SliceBodyType,
  19120. cl as SlideDataModel,
  19121. Zp as SpacingRule,
  19122. tg as SpecialShapes,
  19123. k_ as Styles,
  19124. gg as THEME_COLORS,
  19125. qp as TabStopAlignment,
  19126. tm as TableAlignmentType,
  19127. nm as TableLayoutType,
  19128. sm as TableRowHeightRule,
  19129. em as TableSizeType,
  19130. rm as TableTextWrapType,
  19131. Nu as TextDecoration,
  19132. Jt as TextDecorationBuilder,
  19133. er as TextDirection,
  19134. Vp as TextDirectionType,
  19135. Qt as TextStyleBuilder,
  19136. cr as TextStyleValue,
  19137. Ke as TextX,
  19138. ce as TextXActionType,
  19139. Xs as ThemeColor,
  19140. ft as ThemeColorType,
  19141. Di as ThemeColors,
  19142. ml as ThemeService,
  19143. re as Tools,
  19144. Nn as UndoCommand,
  19145. IE as UndoCommandId,
  19146. Ui as UnitModel,
  19147. GE as Univer,
  19148. ni as UniverInstanceService,
  19149. Fe as UniverInstanceType,
  19150. Pe as UpdateDocsAttributeType,
  19151. rr as UserManagerService,
  19152. hn as VerticalAlign,
  19153. im as VerticalAlignmentType,
  19154. H0 as WithDependency,
  19155. of as WithNew,
  19156. ts as Workbook,
  19157. es as Worksheet,
  19158. xn as WrapStrategy,
  19159. Kp as WrapTextType,
  19160. B_ as addLinkToDocumentModel,
  19161. tC as afterInitApply,
  19162. eC as afterTime,
  19163. UR as awaitTime,
  19164. Jf as binSearchFirstGreaterThanTarget,
  19165. nC as binarySearchArray,
  19166. q0 as bufferDebounceTime,
  19167. AC as cellToRange,
  19168. hm as characterSpacingControlType,
  19169. NC as checkForSubstrings,
  19170. iC as checkIfMove,
  19171. TC as checkParagraphHasBullet,
  19172. MC as checkParagraphHasIndent,
  19173. fp as checkParagraphHasIndentByStyle,
  19174. sC as codeToBlob,
  19175. ha as composeBody,
  19176. x_ as composeInterceptors,
  19177. Mo as composeStyles,
  19178. LC as concatMatrixArray,
  19179. j0 as connectDependencies,
  19180. B0 as connectInjector,
  19181. uC as convertBodyToHtml,
  19182. Ng as convertCellToRange,
  19183. Do as covertTextRunToHtml,
  19184. sR as createAsyncInterceptorKey,
  19185. ii as createDefaultUser,
  19186. Sr as createDocumentModelWithStyle,
  19187. Ct as createIdentifier,
  19188. nR as createInterceptorKey,
  19189. k0 as createInternalEditorID,
  19190. Qo as createRowColIter,
  19191. rn as dayjs,
  19192. S0 as debounce,
  19193. T0 as dedupe,
  19194. Lu as deepCompare,
  19195. PR as delayAnimationFrame,
  19196. pp as deleteContent,
  19197. tE as extractPureTextFromCell,
  19198. $0 as forwardRef,
  19199. Gf as fromCallback,
  19200. DR as fromEventSubject,
  19201. X0 as fromObservable,
  19202. qt as generateRandomId,
  19203. b0 as get,
  19204. fn as getArrayLength,
  19205. Dt as getBodySlice,
  19206. Os as getBodySliceHtml,
  19207. OC as getBorderStyleType,
  19208. EC as getCellInfoInMergeData,
  19209. gC as getCellValueType,
  19210. Lt as getColorStyle,
  19211. jm as getCustomBlockSlice,
  19212. Wm as getCustomDecorationSlice,
  19213. Hm as getCustomRangeSlice,
  19214. bC as getDocsUpdateBody,
  19215. HC as getIntersectRange,
  19216. pR as getOriginCellValue,
  19217. Bm as getParagraphsSlice,
  19218. oC as getReverseDirection,
  19219. QC as getSectionBreakSlice,
  19220. $m as getTableSlice,
  19221. ei as getTextRunSlice,
  19222. mR as getWorksheetUID,
  19223. D0 as groupBy,
  19224. wC as handleStyleToString,
  19225. xC as hashAlgorithm,
  19226. Li as horizontalLineSegmentsSubtraction,
  19227. Vo as insertMatrixArray,
  19228. gp as insertTextToContent,
  19229. co as isAsyncDependencyItem,
  19230. ys as isAsyncHook,
  19231. hC as isBlackColor,
  19232. L0 as isBooleanString,
  19233. IC as isCellCoverable,
  19234. mC as isCellV,
  19235. ao as isClassDependencyItem,
  19236. ou as isCtor,
  19237. go as isDisposable,
  19238. Tg as isEmptyCell,
  19239. uo as isFactoryDependencyItem,
  19240. yC as isFormulaId,
  19241. vC as isFormulaString,
  19242. fC as isICellData,
  19243. zd as isInternalEditorID,
  19244. aC as isNodeEnv,
  19245. j_ as isNotNullOrUndefined,
  19246. pC as isNullCell,
  19247. d0 as isNumeric,
  19248. aR as isRangesEqual,
  19249. DC as isRealNum,
  19250. bR as isSafeNumeric,
  19251. Mg as isSameStyleTextRun,
  19252. uR as isUnitRangesEqual,
  19253. SC as isValidRange,
  19254. lo as isValueDependencyItem,
  19255. dC as isWhiteColor,
  19256. x0 as makeArray,
  19257. RC as makeCellRangeToRangeData,
  19258. CC as makeCellToSelection,
  19259. eR as makeCustomRangeStream,
  19260. nu as merge,
  19261. kE as mergeOverrideWithDependencies,
  19262. AR as mergeSets,
  19263. A0 as mergeWith,
  19264. Q_ as mergeWorksheetSnapshotWithDefault,
  19265. oR as mixinClass,
  19266. Ko as moveMatrixArray,
  19267. jC as moveRangeByOffset,
  19268. LR as nameCharacterCheck,
  19269. qC as normalizeBody,
  19270. _s as normalizeTextRuns,
  19271. VC as numberToABC,
  19272. GC as numberToListABC,
  19273. Op as numfmt,
  19274. WC as queryObjectMatrix,
  19275. K0 as registerDependencies,
  19276. cs as remove,
  19277. $p as repeatStringNumTimes,
  19278. NR as replaceInDocumentBody,
  19279. SR as requestImmediateMacroTask,
  19280. M0 as rotate,
  19281. rC as searchArray,
  19282. Xf as searchInOrderedArray,
  19283. _C as selectionToArray,
  19284. Uf as sequence,
  19285. Lf as sequenceAsync,
  19286. mu as sequenceExecute,
  19287. Q0 as sequenceExecuteAsync,
  19288. N0 as set,
  19289. F0 as setDependencies,
  19290. Df as shallowEqual,
  19291. FR as skipParseTagNames,
  19292. UC as sliceMatrixArray,
  19293. KC as sortRules,
  19294. XC as sortRulesByDesc,
  19295. ps as sortRulesFactory,
  19296. Go as spliceArray,
  19297. Uu as splitIntoGrid,
  19298. Kf as takeAfter,
  19299. ru as textDiff,
  19300. tR as throttle,
  19301. Ze as toDisposable,
  19302. Mf as touchDependencies,
  19303. Km as updateAttributeByDelete,
  19304. Xm as updateAttributeByInsert,
  19305. W0 as useDependency,
  19306. V0 as useDependencyContext,
  19307. G0 as useDependencyContextValue,
  19308. Tf as useDependencyValue,
  19309. Af as useInjector,
  19310. z0 as useObservable,
  19311. Y0 as useUpdateBinder
  19312. };