index.cjs 176 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765
  1. Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
  2. //#region \0rolldown/runtime.js
  3. var __create = Object.create;
  4. var __defProp = Object.defineProperty;
  5. var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
  6. var __getOwnPropNames = Object.getOwnPropertyNames;
  7. var __getProtoOf = Object.getPrototypeOf;
  8. var __hasOwnProp = Object.prototype.hasOwnProperty;
  9. var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
  10. var __copyProps = (to, from, except, desc) => {
  11. if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
  12. key = keys[i];
  13. if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
  14. get: ((k) => from[k]).bind(null, key),
  15. enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
  16. });
  17. }
  18. return to;
  19. };
  20. var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
  21. value: mod,
  22. enumerable: true
  23. }) : target, mod));
  24. //#endregion
  25. let _vue_devtools_shared = require("@vue/devtools-shared");
  26. let perfect_debounce = require("perfect-debounce");
  27. let hookable = require("hookable");
  28. let birpc = require("birpc");
  29. //#region src/compat/index.ts
  30. function onLegacyDevToolsPluginApiAvailable(cb) {
  31. if (_vue_devtools_shared.target.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__) {
  32. cb();
  33. return;
  34. }
  35. Object.defineProperty(_vue_devtools_shared.target, "__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__", {
  36. set(value) {
  37. if (value) cb();
  38. },
  39. configurable: true
  40. });
  41. }
  42. //#endregion
  43. //#region src/core/component/utils/index.ts
  44. function getComponentTypeName(options) {
  45. if (typeof options === "function") return options.displayName || options.name || options.__VUE_DEVTOOLS_COMPONENT_GUSSED_NAME__ || "";
  46. const name = options.name || options._componentTag || options.__VUE_DEVTOOLS_COMPONENT_GUSSED_NAME__ || options.__name;
  47. if (name === "index" && options.__file?.endsWith("index.vue")) return "";
  48. return name;
  49. }
  50. function getComponentFileName(options) {
  51. const file = options.__file;
  52. if (file) return (0, _vue_devtools_shared.classify)((0, _vue_devtools_shared.basename)(file, ".vue"));
  53. }
  54. function getComponentName(options) {
  55. const name = options.displayName || options.name || options._componentTag;
  56. if (name) return name;
  57. return getComponentFileName(options);
  58. }
  59. function saveComponentGussedName(instance, name) {
  60. instance.type.__VUE_DEVTOOLS_COMPONENT_GUSSED_NAME__ = name;
  61. return name;
  62. }
  63. function getAppRecord(instance) {
  64. if (instance.__VUE_DEVTOOLS_NEXT_APP_RECORD__) return instance.__VUE_DEVTOOLS_NEXT_APP_RECORD__;
  65. else if (instance.root) return instance.appContext.app.__VUE_DEVTOOLS_NEXT_APP_RECORD__;
  66. }
  67. async function getComponentId(options) {
  68. const { app, uid, instance } = options;
  69. try {
  70. if (instance.__VUE_DEVTOOLS_NEXT_UID__) return instance.__VUE_DEVTOOLS_NEXT_UID__;
  71. const appRecord = await getAppRecord(app);
  72. if (!appRecord) return null;
  73. const isRoot = appRecord.rootInstance === instance;
  74. return `${appRecord.id}:${isRoot ? "root" : uid}`;
  75. } catch (e) {}
  76. }
  77. function isFragment(instance) {
  78. const subTreeType = instance.subTree?.type;
  79. const appRecord = getAppRecord(instance);
  80. if (appRecord) return appRecord?.types?.Fragment === subTreeType;
  81. return false;
  82. }
  83. function isBeingDestroyed(instance) {
  84. return instance._isBeingDestroyed || instance.isUnmounted;
  85. }
  86. /**
  87. * Get the appropriate display name for an instance.
  88. *
  89. * @param {Vue} instance
  90. * @return {string}
  91. */
  92. function getInstanceName(instance) {
  93. const name = getComponentTypeName(instance?.type || {});
  94. if (name) return name;
  95. if (instance?.root === instance) return "Root";
  96. for (const key in instance.parent?.type?.components) if (instance.parent.type.components[key] === instance?.type) return saveComponentGussedName(instance, key);
  97. for (const key in instance.appContext?.components) if (instance.appContext.components[key] === instance?.type) return saveComponentGussedName(instance, key);
  98. const fileName = getComponentFileName(instance?.type || {});
  99. if (fileName) return fileName;
  100. return "Anonymous Component";
  101. }
  102. /**
  103. * Returns a devtools unique id for instance.
  104. * @param {Vue} instance
  105. */
  106. function getUniqueComponentId(instance) {
  107. return `${instance?.appContext?.app?.__VUE_DEVTOOLS_NEXT_APP_RECORD_ID__ ?? 0}:${instance === instance?.root ? "root" : instance.uid}`;
  108. }
  109. function getRenderKey(value) {
  110. if (value == null) return "";
  111. if (typeof value === "number") return value;
  112. else if (typeof value === "string") return `'${value}'`;
  113. else if (Array.isArray(value)) return "Array";
  114. else return "Object";
  115. }
  116. function returnError(cb) {
  117. try {
  118. return cb();
  119. } catch (e) {
  120. return e;
  121. }
  122. }
  123. function getComponentInstance(appRecord, instanceId) {
  124. instanceId = instanceId || `${appRecord.id}:root`;
  125. return appRecord.instanceMap.get(instanceId) || appRecord.instanceMap.get(":root");
  126. }
  127. function ensurePropertyExists(obj, key, skipObjCheck = false) {
  128. return skipObjCheck ? key in obj : typeof obj === "object" && obj !== null ? key in obj : false;
  129. }
  130. //#endregion
  131. //#region src/core/component/state/bounding-rect.ts
  132. function createRect() {
  133. const rect = {
  134. top: 0,
  135. bottom: 0,
  136. left: 0,
  137. right: 0,
  138. get width() {
  139. return rect.right - rect.left;
  140. },
  141. get height() {
  142. return rect.bottom - rect.top;
  143. }
  144. };
  145. return rect;
  146. }
  147. let range;
  148. function getTextRect(node) {
  149. if (!range) range = document.createRange();
  150. range.selectNode(node);
  151. return range.getBoundingClientRect();
  152. }
  153. function getFragmentRect(vnode) {
  154. const rect = createRect();
  155. if (!vnode.children) return rect;
  156. for (let i = 0, l = vnode.children.length; i < l; i++) {
  157. const childVnode = vnode.children[i];
  158. let childRect;
  159. if (childVnode.component) childRect = getComponentBoundingRect(childVnode.component);
  160. else if (childVnode.el) {
  161. const el = childVnode.el;
  162. if (el.nodeType === 1 || el.getBoundingClientRect) childRect = el.getBoundingClientRect();
  163. else if (el.nodeType === 3 && el.data.trim()) childRect = getTextRect(el);
  164. }
  165. if (childRect) mergeRects(rect, childRect);
  166. }
  167. return rect;
  168. }
  169. function mergeRects(a, b) {
  170. if (!a.top || b.top < a.top) a.top = b.top;
  171. if (!a.bottom || b.bottom > a.bottom) a.bottom = b.bottom;
  172. if (!a.left || b.left < a.left) a.left = b.left;
  173. if (!a.right || b.right > a.right) a.right = b.right;
  174. return a;
  175. }
  176. const DEFAULT_RECT = {
  177. top: 0,
  178. left: 0,
  179. right: 0,
  180. bottom: 0,
  181. width: 0,
  182. height: 0
  183. };
  184. function getComponentBoundingRect(instance) {
  185. const el = instance.subTree.el;
  186. if (typeof window === "undefined") return DEFAULT_RECT;
  187. if (isFragment(instance)) return getFragmentRect(instance.subTree);
  188. else if (el?.nodeType === 1) return el?.getBoundingClientRect();
  189. else if (instance.subTree.component) return getComponentBoundingRect(instance.subTree.component);
  190. else return DEFAULT_RECT;
  191. }
  192. //#endregion
  193. //#region src/core/component/tree/el.ts
  194. function getRootElementsFromComponentInstance(instance) {
  195. if (isFragment(instance)) return getFragmentRootElements(instance.subTree);
  196. if (!instance.subTree) return [];
  197. return [instance.subTree.el];
  198. }
  199. function getFragmentRootElements(vnode) {
  200. if (!vnode.children) return [];
  201. const list = [];
  202. vnode.children.forEach((childVnode) => {
  203. if (childVnode.component) list.push(...getRootElementsFromComponentInstance(childVnode.component));
  204. else if (childVnode?.el) list.push(childVnode.el);
  205. });
  206. return list;
  207. }
  208. //#endregion
  209. //#region src/core/component-highlighter/index.ts
  210. const CONTAINER_ELEMENT_ID = "__vue-devtools-component-inspector__";
  211. const CARD_ELEMENT_ID = "__vue-devtools-component-inspector__card__";
  212. const COMPONENT_NAME_ELEMENT_ID = "__vue-devtools-component-inspector__name__";
  213. const INDICATOR_ELEMENT_ID = "__vue-devtools-component-inspector__indicator__";
  214. const containerStyles = {
  215. display: "block",
  216. zIndex: 2147483640,
  217. position: "fixed",
  218. backgroundColor: "#42b88325",
  219. border: "1px solid #42b88350",
  220. borderRadius: "5px",
  221. transition: "all 0.1s ease-in",
  222. pointerEvents: "none"
  223. };
  224. const cardStyles = {
  225. fontFamily: "Arial, Helvetica, sans-serif",
  226. padding: "5px 8px",
  227. borderRadius: "4px",
  228. textAlign: "left",
  229. position: "absolute",
  230. left: 0,
  231. color: "#e9e9e9",
  232. fontSize: "14px",
  233. fontWeight: 600,
  234. lineHeight: "24px",
  235. backgroundColor: "#42b883",
  236. boxShadow: "0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1)"
  237. };
  238. const indicatorStyles = {
  239. display: "inline-block",
  240. fontWeight: 400,
  241. fontStyle: "normal",
  242. fontSize: "12px",
  243. opacity: .7
  244. };
  245. function getContainerElement() {
  246. return document.getElementById(CONTAINER_ELEMENT_ID);
  247. }
  248. function getCardElement() {
  249. return document.getElementById(CARD_ELEMENT_ID);
  250. }
  251. function getIndicatorElement() {
  252. return document.getElementById(INDICATOR_ELEMENT_ID);
  253. }
  254. function getNameElement() {
  255. return document.getElementById(COMPONENT_NAME_ELEMENT_ID);
  256. }
  257. function getStyles(bounds) {
  258. return {
  259. left: `${Math.round(bounds.left * 100) / 100}px`,
  260. top: `${Math.round(bounds.top * 100) / 100}px`,
  261. width: `${Math.round(bounds.width * 100) / 100}px`,
  262. height: `${Math.round(bounds.height * 100) / 100}px`
  263. };
  264. }
  265. function create(options) {
  266. const containerEl = document.createElement("div");
  267. containerEl.id = options.elementId ?? CONTAINER_ELEMENT_ID;
  268. Object.assign(containerEl.style, {
  269. ...containerStyles,
  270. ...getStyles(options.bounds),
  271. ...options.style
  272. });
  273. const cardEl = document.createElement("span");
  274. cardEl.id = CARD_ELEMENT_ID;
  275. Object.assign(cardEl.style, {
  276. ...cardStyles,
  277. top: options.bounds.top < 35 ? 0 : "-35px"
  278. });
  279. const nameEl = document.createElement("span");
  280. nameEl.id = COMPONENT_NAME_ELEMENT_ID;
  281. nameEl.innerHTML = `&lt;${options.name}&gt;&nbsp;&nbsp;`;
  282. const indicatorEl = document.createElement("i");
  283. indicatorEl.id = INDICATOR_ELEMENT_ID;
  284. indicatorEl.innerHTML = `${Math.round(options.bounds.width * 100) / 100} x ${Math.round(options.bounds.height * 100) / 100}`;
  285. Object.assign(indicatorEl.style, indicatorStyles);
  286. cardEl.appendChild(nameEl);
  287. cardEl.appendChild(indicatorEl);
  288. containerEl.appendChild(cardEl);
  289. document.body.appendChild(containerEl);
  290. return containerEl;
  291. }
  292. function update(options) {
  293. const containerEl = getContainerElement();
  294. const cardEl = getCardElement();
  295. const nameEl = getNameElement();
  296. const indicatorEl = getIndicatorElement();
  297. if (containerEl) {
  298. Object.assign(containerEl.style, {
  299. ...containerStyles,
  300. ...getStyles(options.bounds)
  301. });
  302. Object.assign(cardEl.style, { top: options.bounds.top < 35 ? 0 : "-35px" });
  303. nameEl.innerHTML = `&lt;${options.name}&gt;&nbsp;&nbsp;`;
  304. indicatorEl.innerHTML = `${Math.round(options.bounds.width * 100) / 100} x ${Math.round(options.bounds.height * 100) / 100}`;
  305. }
  306. }
  307. function highlight(instance) {
  308. const bounds = getComponentBoundingRect(instance);
  309. if (!bounds.width && !bounds.height) return;
  310. const name = getInstanceName(instance);
  311. getContainerElement() ? update({
  312. bounds,
  313. name
  314. }) : create({
  315. bounds,
  316. name
  317. });
  318. }
  319. function unhighlight() {
  320. const el = getContainerElement();
  321. if (el) el.style.display = "none";
  322. }
  323. let inspectInstance = null;
  324. function inspectFn(e) {
  325. const target = e.target;
  326. if (target) {
  327. const instance = target.__vueParentComponent;
  328. if (instance) {
  329. inspectInstance = instance;
  330. if (instance.vnode.el) {
  331. const bounds = getComponentBoundingRect(instance);
  332. const name = getInstanceName(instance);
  333. getContainerElement() ? update({
  334. bounds,
  335. name
  336. }) : create({
  337. bounds,
  338. name
  339. });
  340. }
  341. }
  342. }
  343. }
  344. function selectComponentFn(e, cb) {
  345. e.preventDefault();
  346. e.stopPropagation();
  347. if (inspectInstance) cb(getUniqueComponentId(inspectInstance));
  348. }
  349. let inspectComponentHighLighterSelectFn = null;
  350. function cancelInspectComponentHighLighter() {
  351. unhighlight();
  352. window.removeEventListener("mouseover", inspectFn);
  353. window.removeEventListener("click", inspectComponentHighLighterSelectFn, true);
  354. inspectComponentHighLighterSelectFn = null;
  355. }
  356. function inspectComponentHighLighter() {
  357. window.addEventListener("mouseover", inspectFn);
  358. return new Promise((resolve) => {
  359. function onSelect(e) {
  360. e.preventDefault();
  361. e.stopPropagation();
  362. selectComponentFn(e, (id) => {
  363. window.removeEventListener("click", onSelect, true);
  364. inspectComponentHighLighterSelectFn = null;
  365. window.removeEventListener("mouseover", inspectFn);
  366. const el = getContainerElement();
  367. if (el) el.style.display = "none";
  368. resolve(JSON.stringify({ id }));
  369. });
  370. }
  371. inspectComponentHighLighterSelectFn = onSelect;
  372. window.addEventListener("click", onSelect, true);
  373. });
  374. }
  375. function scrollToComponent(options) {
  376. const instance = getComponentInstance(activeAppRecord.value, options.id);
  377. if (instance) {
  378. const [el] = getRootElementsFromComponentInstance(instance);
  379. if (typeof el.scrollIntoView === "function") el.scrollIntoView({ behavior: "smooth" });
  380. else {
  381. const bounds = getComponentBoundingRect(instance);
  382. const scrollTarget = document.createElement("div");
  383. const styles = {
  384. ...getStyles(bounds),
  385. position: "absolute"
  386. };
  387. Object.assign(scrollTarget.style, styles);
  388. document.body.appendChild(scrollTarget);
  389. scrollTarget.scrollIntoView({ behavior: "smooth" });
  390. setTimeout(() => {
  391. document.body.removeChild(scrollTarget);
  392. }, 2e3);
  393. }
  394. setTimeout(() => {
  395. const bounds = getComponentBoundingRect(instance);
  396. if (bounds.width || bounds.height) {
  397. const name = getInstanceName(instance);
  398. const el = getContainerElement();
  399. el ? update({
  400. ...options,
  401. name,
  402. bounds
  403. }) : create({
  404. ...options,
  405. name,
  406. bounds
  407. });
  408. setTimeout(() => {
  409. if (el) el.style.display = "none";
  410. }, 1500);
  411. }
  412. }, 1200);
  413. }
  414. }
  415. //#endregion
  416. //#region src/core/component-inspector/index.ts
  417. _vue_devtools_shared.target.__VUE_DEVTOOLS_COMPONENT_INSPECTOR_ENABLED__ ??= true;
  418. function toggleComponentInspectorEnabled(enabled) {
  419. _vue_devtools_shared.target.__VUE_DEVTOOLS_COMPONENT_INSPECTOR_ENABLED__ = enabled;
  420. }
  421. function waitForInspectorInit(cb) {
  422. let total = 0;
  423. const timer = setInterval(() => {
  424. if (_vue_devtools_shared.target.__VUE_INSPECTOR__) {
  425. clearInterval(timer);
  426. total += 30;
  427. cb();
  428. }
  429. if (total >= 5e3) clearInterval(timer);
  430. }, 30);
  431. }
  432. function setupInspector() {
  433. const inspector = _vue_devtools_shared.target.__VUE_INSPECTOR__;
  434. const _openInEditor = inspector.openInEditor;
  435. inspector.openInEditor = async (...params) => {
  436. inspector.disable();
  437. _openInEditor(...params);
  438. };
  439. }
  440. function getComponentInspector() {
  441. return new Promise((resolve) => {
  442. function setup() {
  443. setupInspector();
  444. resolve(_vue_devtools_shared.target.__VUE_INSPECTOR__);
  445. }
  446. if (!_vue_devtools_shared.target.__VUE_INSPECTOR__) waitForInspectorInit(() => {
  447. setup();
  448. });
  449. else setup();
  450. });
  451. }
  452. //#endregion
  453. //#region src/shared/stub-vue.ts
  454. /**
  455. * To prevent include a **HUGE** vue package in the final bundle of chrome ext / electron
  456. * we stub the necessary vue module.
  457. * This implementation is based on the 1c3327a0fa5983aa9078e3f7bb2330f572435425 commit
  458. */
  459. /**
  460. * @from [@vue/reactivity](https://github.com/vuejs/core/blob/1c3327a0fa5983aa9078e3f7bb2330f572435425/packages/reactivity/src/constants.ts#L17-L23)
  461. */
  462. let ReactiveFlags = /* @__PURE__ */ function(ReactiveFlags) {
  463. ReactiveFlags["SKIP"] = "__v_skip";
  464. ReactiveFlags["IS_REACTIVE"] = "__v_isReactive";
  465. ReactiveFlags["IS_READONLY"] = "__v_isReadonly";
  466. ReactiveFlags["IS_SHALLOW"] = "__v_isShallow";
  467. ReactiveFlags["RAW"] = "__v_raw";
  468. return ReactiveFlags;
  469. }({});
  470. /**
  471. * @from [@vue/reactivity](https://github.com/vuejs/core/blob/1c3327a0fa5983aa9078e3f7bb2330f572435425/packages/reactivity/src/reactive.ts#L330-L332)
  472. */
  473. function isReadonly(value) {
  474. return !!(value && value[ReactiveFlags.IS_READONLY]);
  475. }
  476. /**
  477. * @from [@vue/reactivity](https://github.com/vuejs/core/blob/1c3327a0fa5983aa9078e3f7bb2330f572435425/packages/reactivity/src/reactive.ts#L312-L317)
  478. */
  479. function isReactive$1(value) {
  480. if (isReadonly(value)) return isReactive$1(value[ReactiveFlags.RAW]);
  481. return !!(value && value[ReactiveFlags.IS_REACTIVE]);
  482. }
  483. function isRef$1(r) {
  484. return !!(r && r.__v_isRef === true);
  485. }
  486. /**
  487. * @from [@vue/reactivity](https://github.com/vuejs/core/blob/1c3327a0fa5983aa9078e3f7bb2330f572435425/packages/reactivity/src/reactive.ts#L372-L375)
  488. */
  489. function toRaw$1(observed) {
  490. const raw = observed && observed[ReactiveFlags.RAW];
  491. return raw ? toRaw$1(raw) : observed;
  492. }
  493. //#endregion
  494. //#region src/core/component/state/editor.ts
  495. var StateEditor = class {
  496. constructor() {
  497. this.refEditor = new RefStateEditor();
  498. }
  499. set(object, path, value, cb) {
  500. const sections = Array.isArray(path) ? path : path.split(".");
  501. while (sections.length > 1) {
  502. const section = sections.shift();
  503. if (object instanceof Map) object = object.get(section);
  504. else if (object instanceof Set) object = Array.from(object.values())[section];
  505. else object = object[section];
  506. if (this.refEditor.isRef(object)) object = this.refEditor.get(object);
  507. }
  508. const field = sections[0];
  509. const item = this.refEditor.get(object)[field];
  510. if (cb) cb(object, field, value);
  511. else if (this.refEditor.isRef(item)) this.refEditor.set(item, value);
  512. else object[field] = value;
  513. }
  514. get(object, path) {
  515. const sections = Array.isArray(path) ? path : path.split(".");
  516. for (let i = 0; i < sections.length; i++) {
  517. if (object instanceof Map) object = object.get(sections[i]);
  518. else object = object[sections[i]];
  519. if (this.refEditor.isRef(object)) object = this.refEditor.get(object);
  520. if (!object) return void 0;
  521. }
  522. return object;
  523. }
  524. has(object, path, parent = false) {
  525. if (typeof object === "undefined") return false;
  526. const sections = Array.isArray(path) ? path.slice() : path.split(".");
  527. const size = !parent ? 1 : 2;
  528. while (object && sections.length > size) {
  529. const section = sections.shift();
  530. object = object[section];
  531. if (this.refEditor.isRef(object)) object = this.refEditor.get(object);
  532. }
  533. return object != null && Object.prototype.hasOwnProperty.call(object, sections[0]);
  534. }
  535. createDefaultSetCallback(state) {
  536. return (object, field, value) => {
  537. if (state.remove || state.newKey) if (Array.isArray(object)) object.splice(field, 1);
  538. else if (toRaw$1(object) instanceof Map) object.delete(field);
  539. else if (toRaw$1(object) instanceof Set) object.delete(Array.from(object.values())[field]);
  540. else Reflect.deleteProperty(object, field);
  541. if (!state.remove) {
  542. const target = object[state.newKey || field];
  543. if (this.refEditor.isRef(target)) this.refEditor.set(target, value);
  544. else if (toRaw$1(object) instanceof Map) object.set(state.newKey || field, value);
  545. else if (toRaw$1(object) instanceof Set) object.add(value);
  546. else object[state.newKey || field] = value;
  547. }
  548. };
  549. }
  550. };
  551. var RefStateEditor = class {
  552. set(ref, value) {
  553. if (isRef$1(ref)) ref.value = value;
  554. else {
  555. if (ref instanceof Set && Array.isArray(value)) {
  556. ref.clear();
  557. value.forEach((v) => ref.add(v));
  558. return;
  559. }
  560. const currentKeys = Object.keys(value);
  561. if (ref instanceof Map) {
  562. const previousKeysSet = new Set(ref.keys());
  563. currentKeys.forEach((key) => {
  564. ref.set(key, Reflect.get(value, key));
  565. previousKeysSet.delete(key);
  566. });
  567. previousKeysSet.forEach((key) => ref.delete(key));
  568. return;
  569. }
  570. const previousKeysSet = new Set(Object.keys(ref));
  571. currentKeys.forEach((key) => {
  572. Reflect.set(ref, key, Reflect.get(value, key));
  573. previousKeysSet.delete(key);
  574. });
  575. previousKeysSet.forEach((key) => Reflect.deleteProperty(ref, key));
  576. }
  577. }
  578. get(ref) {
  579. return isRef$1(ref) ? ref.value : ref;
  580. }
  581. isRef(ref) {
  582. return isRef$1(ref) || isReactive$1(ref);
  583. }
  584. };
  585. async function editComponentState(payload, stateEditor) {
  586. const { path, nodeId, state, type } = payload;
  587. const instance = getComponentInstance(activeAppRecord.value, nodeId);
  588. if (!instance) return;
  589. const targetPath = path.slice();
  590. let target;
  591. if (Object.keys(instance.props).includes(path[0])) target = instance.props;
  592. else if (instance.devtoolsRawSetupState && Object.keys(instance.devtoolsRawSetupState).includes(path[0])) target = instance.devtoolsRawSetupState;
  593. else if (instance.data && Object.keys(instance.data).includes(path[0])) target = instance.data;
  594. else target = instance.proxy;
  595. if (target && targetPath) {
  596. if (state.type === "object" && type === "reactive") {}
  597. stateEditor.set(target, targetPath, state.value, stateEditor.createDefaultSetCallback(state));
  598. }
  599. }
  600. const stateEditor = new StateEditor();
  601. async function editState(payload) {
  602. editComponentState(payload, stateEditor);
  603. }
  604. //#endregion
  605. //#region src/core/timeline/storage.ts
  606. const TIMELINE_LAYERS_STATE_STORAGE_ID = "__VUE_DEVTOOLS_KIT_TIMELINE_LAYERS_STATE__";
  607. function addTimelineLayersStateToStorage(state) {
  608. if (!_vue_devtools_shared.isBrowser || typeof localStorage === "undefined" || localStorage === null) return;
  609. localStorage.setItem(TIMELINE_LAYERS_STATE_STORAGE_ID, JSON.stringify(state));
  610. }
  611. function getTimelineLayersStateFromStorage() {
  612. if (typeof window === "undefined" || !_vue_devtools_shared.isBrowser || typeof localStorage === "undefined" || localStorage === null) return {
  613. recordingState: false,
  614. mouseEventEnabled: false,
  615. keyboardEventEnabled: false,
  616. componentEventEnabled: false,
  617. performanceEventEnabled: false,
  618. selected: ""
  619. };
  620. const state = typeof localStorage.getItem !== "undefined" ? localStorage.getItem(TIMELINE_LAYERS_STATE_STORAGE_ID) : null;
  621. return state ? JSON.parse(state) : {
  622. recordingState: false,
  623. mouseEventEnabled: false,
  624. keyboardEventEnabled: false,
  625. componentEventEnabled: false,
  626. performanceEventEnabled: false,
  627. selected: ""
  628. };
  629. }
  630. //#endregion
  631. //#region src/ctx/timeline.ts
  632. _vue_devtools_shared.target.__VUE_DEVTOOLS_KIT_TIMELINE_LAYERS ??= [];
  633. const devtoolsTimelineLayers = new Proxy(_vue_devtools_shared.target.__VUE_DEVTOOLS_KIT_TIMELINE_LAYERS, { get(target, prop, receiver) {
  634. return Reflect.get(target, prop, receiver);
  635. } });
  636. function addTimelineLayer(options, descriptor) {
  637. devtoolsState.timelineLayersState[descriptor.id] = false;
  638. devtoolsTimelineLayers.push({
  639. ...options,
  640. descriptorId: descriptor.id,
  641. appRecord: getAppRecord(descriptor.app)
  642. });
  643. }
  644. function updateTimelineLayersState(state) {
  645. const updatedState = {
  646. ...devtoolsState.timelineLayersState,
  647. ...state
  648. };
  649. addTimelineLayersStateToStorage(updatedState);
  650. updateDevToolsState({ timelineLayersState: updatedState });
  651. }
  652. //#endregion
  653. //#region src/ctx/inspector.ts
  654. _vue_devtools_shared.target.__VUE_DEVTOOLS_KIT_INSPECTOR__ ??= [];
  655. const devtoolsInspector = new Proxy(_vue_devtools_shared.target.__VUE_DEVTOOLS_KIT_INSPECTOR__, { get(target, prop, receiver) {
  656. return Reflect.get(target, prop, receiver);
  657. } });
  658. const callInspectorUpdatedHook = (0, perfect_debounce.debounce)(() => {
  659. devtoolsContext.hooks.callHook(DevToolsMessagingHookKeys.SEND_INSPECTOR_TO_CLIENT, getActiveInspectors());
  660. });
  661. function addInspector(inspector, descriptor) {
  662. devtoolsInspector.push({
  663. options: inspector,
  664. descriptor,
  665. treeFilterPlaceholder: inspector.treeFilterPlaceholder ?? "Search tree...",
  666. stateFilterPlaceholder: inspector.stateFilterPlaceholder ?? "Search state...",
  667. treeFilter: "",
  668. selectedNodeId: "",
  669. appRecord: getAppRecord(descriptor.app)
  670. });
  671. callInspectorUpdatedHook();
  672. }
  673. function getActiveInspectors() {
  674. return devtoolsInspector.filter((inspector) => inspector.descriptor.app === activeAppRecord.value.app).filter((inspector) => inspector.descriptor.id !== "components").map((inspector) => {
  675. const descriptor = inspector.descriptor;
  676. const options = inspector.options;
  677. return {
  678. id: options.id,
  679. label: options.label,
  680. logo: descriptor.logo,
  681. icon: `custom-ic-baseline-${options?.icon?.replace(/_/g, "-")}`,
  682. packageName: descriptor.packageName,
  683. homepage: descriptor.homepage,
  684. pluginId: descriptor.id
  685. };
  686. });
  687. }
  688. function getInspectorInfo(id) {
  689. const inspector = getInspector(id, activeAppRecord.value.app);
  690. if (!inspector) return;
  691. const descriptor = inspector.descriptor;
  692. const options = inspector.options;
  693. const timelineLayers = devtoolsTimelineLayers.filter((layer) => layer.descriptorId === descriptor.id).map((item) => ({
  694. id: item.id,
  695. label: item.label,
  696. color: item.color
  697. }));
  698. return {
  699. id: options.id,
  700. label: options.label,
  701. logo: descriptor.logo,
  702. packageName: descriptor.packageName,
  703. homepage: descriptor.homepage,
  704. timelineLayers,
  705. treeFilterPlaceholder: inspector.treeFilterPlaceholder,
  706. stateFilterPlaceholder: inspector.stateFilterPlaceholder
  707. };
  708. }
  709. function getInspector(id, app) {
  710. return devtoolsInspector.find((inspector) => inspector.options.id === id && (app ? inspector.descriptor.app === app : true));
  711. }
  712. function getInspectorActions(id) {
  713. return getInspector(id)?.options.actions;
  714. }
  715. function getInspectorNodeActions(id) {
  716. return getInspector(id)?.options.nodeActions;
  717. }
  718. //#endregion
  719. //#region src/ctx/hook.ts
  720. let DevToolsV6PluginAPIHookKeys = /* @__PURE__ */ function(DevToolsV6PluginAPIHookKeys) {
  721. DevToolsV6PluginAPIHookKeys["VISIT_COMPONENT_TREE"] = "visitComponentTree";
  722. DevToolsV6PluginAPIHookKeys["INSPECT_COMPONENT"] = "inspectComponent";
  723. DevToolsV6PluginAPIHookKeys["EDIT_COMPONENT_STATE"] = "editComponentState";
  724. DevToolsV6PluginAPIHookKeys["GET_INSPECTOR_TREE"] = "getInspectorTree";
  725. DevToolsV6PluginAPIHookKeys["GET_INSPECTOR_STATE"] = "getInspectorState";
  726. DevToolsV6PluginAPIHookKeys["EDIT_INSPECTOR_STATE"] = "editInspectorState";
  727. DevToolsV6PluginAPIHookKeys["INSPECT_TIMELINE_EVENT"] = "inspectTimelineEvent";
  728. DevToolsV6PluginAPIHookKeys["TIMELINE_CLEARED"] = "timelineCleared";
  729. DevToolsV6PluginAPIHookKeys["SET_PLUGIN_SETTINGS"] = "setPluginSettings";
  730. return DevToolsV6PluginAPIHookKeys;
  731. }({});
  732. let DevToolsContextHookKeys = /* @__PURE__ */ function(DevToolsContextHookKeys) {
  733. DevToolsContextHookKeys["ADD_INSPECTOR"] = "addInspector";
  734. DevToolsContextHookKeys["SEND_INSPECTOR_TREE"] = "sendInspectorTree";
  735. DevToolsContextHookKeys["SEND_INSPECTOR_STATE"] = "sendInspectorState";
  736. DevToolsContextHookKeys["CUSTOM_INSPECTOR_SELECT_NODE"] = "customInspectorSelectNode";
  737. DevToolsContextHookKeys["TIMELINE_LAYER_ADDED"] = "timelineLayerAdded";
  738. DevToolsContextHookKeys["TIMELINE_EVENT_ADDED"] = "timelineEventAdded";
  739. DevToolsContextHookKeys["GET_COMPONENT_INSTANCES"] = "getComponentInstances";
  740. DevToolsContextHookKeys["GET_COMPONENT_BOUNDS"] = "getComponentBounds";
  741. DevToolsContextHookKeys["GET_COMPONENT_NAME"] = "getComponentName";
  742. DevToolsContextHookKeys["COMPONENT_HIGHLIGHT"] = "componentHighlight";
  743. DevToolsContextHookKeys["COMPONENT_UNHIGHLIGHT"] = "componentUnhighlight";
  744. return DevToolsContextHookKeys;
  745. }({});
  746. let DevToolsMessagingHookKeys = /* @__PURE__ */ function(DevToolsMessagingHookKeys) {
  747. DevToolsMessagingHookKeys["SEND_INSPECTOR_TREE_TO_CLIENT"] = "sendInspectorTreeToClient";
  748. DevToolsMessagingHookKeys["SEND_INSPECTOR_STATE_TO_CLIENT"] = "sendInspectorStateToClient";
  749. DevToolsMessagingHookKeys["SEND_TIMELINE_EVENT_TO_CLIENT"] = "sendTimelineEventToClient";
  750. DevToolsMessagingHookKeys["SEND_INSPECTOR_TO_CLIENT"] = "sendInspectorToClient";
  751. DevToolsMessagingHookKeys["SEND_ACTIVE_APP_UNMOUNTED_TO_CLIENT"] = "sendActiveAppUpdatedToClient";
  752. DevToolsMessagingHookKeys["DEVTOOLS_STATE_UPDATED"] = "devtoolsStateUpdated";
  753. DevToolsMessagingHookKeys["DEVTOOLS_CONNECTED_UPDATED"] = "devtoolsConnectedUpdated";
  754. DevToolsMessagingHookKeys["ROUTER_INFO_UPDATED"] = "routerInfoUpdated";
  755. return DevToolsMessagingHookKeys;
  756. }({});
  757. function createDevToolsCtxHooks() {
  758. const hooks = (0, hookable.createHooks)();
  759. hooks.hook(DevToolsContextHookKeys.ADD_INSPECTOR, ({ inspector, plugin }) => {
  760. addInspector(inspector, plugin.descriptor);
  761. });
  762. const debounceSendInspectorTree = (0, perfect_debounce.debounce)(async ({ inspectorId, plugin }) => {
  763. if (!inspectorId || !plugin?.descriptor?.app || devtoolsState.highPerfModeEnabled) return;
  764. const inspector = getInspector(inspectorId, plugin.descriptor.app);
  765. const _payload = {
  766. app: plugin.descriptor.app,
  767. inspectorId,
  768. filter: inspector?.treeFilter || "",
  769. rootNodes: []
  770. };
  771. await new Promise((resolve) => {
  772. hooks.callHookWith(async (callbacks) => {
  773. await Promise.all(callbacks.map((cb) => cb(_payload)));
  774. resolve();
  775. }, DevToolsV6PluginAPIHookKeys.GET_INSPECTOR_TREE);
  776. });
  777. hooks.callHookWith(async (callbacks) => {
  778. await Promise.all(callbacks.map((cb) => cb({
  779. inspectorId,
  780. rootNodes: _payload.rootNodes
  781. })));
  782. }, DevToolsMessagingHookKeys.SEND_INSPECTOR_TREE_TO_CLIENT);
  783. }, 120);
  784. hooks.hook(DevToolsContextHookKeys.SEND_INSPECTOR_TREE, debounceSendInspectorTree);
  785. const debounceSendInspectorState = (0, perfect_debounce.debounce)(async ({ inspectorId, plugin }) => {
  786. if (!inspectorId || !plugin?.descriptor?.app || devtoolsState.highPerfModeEnabled) return;
  787. const inspector = getInspector(inspectorId, plugin.descriptor.app);
  788. const _payload = {
  789. app: plugin.descriptor.app,
  790. inspectorId,
  791. nodeId: inspector?.selectedNodeId || "",
  792. state: null
  793. };
  794. const ctx = { currentTab: `custom-inspector:${inspectorId}` };
  795. if (_payload.nodeId) await new Promise((resolve) => {
  796. hooks.callHookWith(async (callbacks) => {
  797. await Promise.all(callbacks.map((cb) => cb(_payload, ctx)));
  798. resolve();
  799. }, DevToolsV6PluginAPIHookKeys.GET_INSPECTOR_STATE);
  800. });
  801. hooks.callHookWith(async (callbacks) => {
  802. await Promise.all(callbacks.map((cb) => cb({
  803. inspectorId,
  804. nodeId: _payload.nodeId,
  805. state: _payload.state
  806. })));
  807. }, DevToolsMessagingHookKeys.SEND_INSPECTOR_STATE_TO_CLIENT);
  808. }, 120);
  809. hooks.hook(DevToolsContextHookKeys.SEND_INSPECTOR_STATE, debounceSendInspectorState);
  810. hooks.hook(DevToolsContextHookKeys.CUSTOM_INSPECTOR_SELECT_NODE, ({ inspectorId, nodeId, plugin }) => {
  811. const inspector = getInspector(inspectorId, plugin.descriptor.app);
  812. if (!inspector) return;
  813. inspector.selectedNodeId = nodeId;
  814. });
  815. hooks.hook(DevToolsContextHookKeys.TIMELINE_LAYER_ADDED, ({ options, plugin }) => {
  816. addTimelineLayer(options, plugin.descriptor);
  817. });
  818. hooks.hook(DevToolsContextHookKeys.TIMELINE_EVENT_ADDED, ({ options, plugin }) => {
  819. if (devtoolsState.highPerfModeEnabled || !devtoolsState.timelineLayersState?.[plugin.descriptor.id] && ![
  820. "performance",
  821. "component-event",
  822. "keyboard",
  823. "mouse"
  824. ].includes(options.layerId)) return;
  825. hooks.callHookWith(async (callbacks) => {
  826. await Promise.all(callbacks.map((cb) => cb(options)));
  827. }, DevToolsMessagingHookKeys.SEND_TIMELINE_EVENT_TO_CLIENT);
  828. });
  829. hooks.hook(DevToolsContextHookKeys.GET_COMPONENT_INSTANCES, async ({ app }) => {
  830. const appRecord = app.__VUE_DEVTOOLS_NEXT_APP_RECORD__;
  831. if (!appRecord) return null;
  832. const appId = appRecord.id.toString();
  833. return [...appRecord.instanceMap].filter(([key]) => key.split(":")[0] === appId).map(([, instance]) => instance);
  834. });
  835. hooks.hook(DevToolsContextHookKeys.GET_COMPONENT_BOUNDS, async ({ instance }) => {
  836. return getComponentBoundingRect(instance);
  837. });
  838. hooks.hook(DevToolsContextHookKeys.GET_COMPONENT_NAME, ({ instance }) => {
  839. return getInstanceName(instance);
  840. });
  841. hooks.hook(DevToolsContextHookKeys.COMPONENT_HIGHLIGHT, ({ uid }) => {
  842. const instance = activeAppRecord.value.instanceMap.get(uid);
  843. if (instance) highlight(instance);
  844. });
  845. hooks.hook(DevToolsContextHookKeys.COMPONENT_UNHIGHLIGHT, () => {
  846. unhighlight();
  847. });
  848. return hooks;
  849. }
  850. //#endregion
  851. //#region src/ctx/state.ts
  852. _vue_devtools_shared.target.__VUE_DEVTOOLS_KIT_APP_RECORDS__ ??= [];
  853. _vue_devtools_shared.target.__VUE_DEVTOOLS_KIT_ACTIVE_APP_RECORD__ ??= {};
  854. _vue_devtools_shared.target.__VUE_DEVTOOLS_KIT_ACTIVE_APP_RECORD_ID__ ??= "";
  855. _vue_devtools_shared.target.__VUE_DEVTOOLS_KIT_CUSTOM_TABS__ ??= [];
  856. _vue_devtools_shared.target.__VUE_DEVTOOLS_KIT_CUSTOM_COMMANDS__ ??= [];
  857. const STATE_KEY = "__VUE_DEVTOOLS_KIT_GLOBAL_STATE__";
  858. function initStateFactory() {
  859. return {
  860. connected: false,
  861. clientConnected: false,
  862. vitePluginDetected: true,
  863. appRecords: [],
  864. activeAppRecordId: "",
  865. tabs: [],
  866. commands: [],
  867. highPerfModeEnabled: true,
  868. devtoolsClientDetected: {},
  869. perfUniqueGroupId: 0,
  870. timelineLayersState: getTimelineLayersStateFromStorage()
  871. };
  872. }
  873. _vue_devtools_shared.target[STATE_KEY] ??= initStateFactory();
  874. const callStateUpdatedHook = (0, perfect_debounce.debounce)((state) => {
  875. devtoolsContext.hooks.callHook(DevToolsMessagingHookKeys.DEVTOOLS_STATE_UPDATED, { state });
  876. });
  877. const callConnectedUpdatedHook = (0, perfect_debounce.debounce)((state, oldState) => {
  878. devtoolsContext.hooks.callHook(DevToolsMessagingHookKeys.DEVTOOLS_CONNECTED_UPDATED, {
  879. state,
  880. oldState
  881. });
  882. });
  883. const devtoolsAppRecords = new Proxy(_vue_devtools_shared.target.__VUE_DEVTOOLS_KIT_APP_RECORDS__, { get(_target, prop, receiver) {
  884. if (prop === "value") return _vue_devtools_shared.target.__VUE_DEVTOOLS_KIT_APP_RECORDS__;
  885. return _vue_devtools_shared.target.__VUE_DEVTOOLS_KIT_APP_RECORDS__[prop];
  886. } });
  887. const addDevToolsAppRecord = (app) => {
  888. _vue_devtools_shared.target.__VUE_DEVTOOLS_KIT_APP_RECORDS__ = [..._vue_devtools_shared.target.__VUE_DEVTOOLS_KIT_APP_RECORDS__, app];
  889. };
  890. const removeDevToolsAppRecord = (app) => {
  891. _vue_devtools_shared.target.__VUE_DEVTOOLS_KIT_APP_RECORDS__ = devtoolsAppRecords.value.filter((record) => record.app !== app);
  892. };
  893. const activeAppRecord = new Proxy(_vue_devtools_shared.target.__VUE_DEVTOOLS_KIT_ACTIVE_APP_RECORD__, { get(_target, prop, receiver) {
  894. if (prop === "value") return _vue_devtools_shared.target.__VUE_DEVTOOLS_KIT_ACTIVE_APP_RECORD__;
  895. else if (prop === "id") return _vue_devtools_shared.target.__VUE_DEVTOOLS_KIT_ACTIVE_APP_RECORD_ID__;
  896. return _vue_devtools_shared.target.__VUE_DEVTOOLS_KIT_ACTIVE_APP_RECORD__[prop];
  897. } });
  898. function updateAllStates() {
  899. callStateUpdatedHook({
  900. ..._vue_devtools_shared.target[STATE_KEY],
  901. appRecords: devtoolsAppRecords.value,
  902. activeAppRecordId: activeAppRecord.id,
  903. tabs: _vue_devtools_shared.target.__VUE_DEVTOOLS_KIT_CUSTOM_TABS__,
  904. commands: _vue_devtools_shared.target.__VUE_DEVTOOLS_KIT_CUSTOM_COMMANDS__
  905. });
  906. }
  907. function setActiveAppRecord(app) {
  908. _vue_devtools_shared.target.__VUE_DEVTOOLS_KIT_ACTIVE_APP_RECORD__ = app;
  909. updateAllStates();
  910. }
  911. function setActiveAppRecordId(id) {
  912. _vue_devtools_shared.target.__VUE_DEVTOOLS_KIT_ACTIVE_APP_RECORD_ID__ = id;
  913. updateAllStates();
  914. }
  915. const devtoolsState = new Proxy(_vue_devtools_shared.target[STATE_KEY], {
  916. get(target, property) {
  917. if (property === "appRecords") return devtoolsAppRecords;
  918. else if (property === "activeAppRecordId") return activeAppRecord.id;
  919. else if (property === "tabs") return _vue_devtools_shared.target.__VUE_DEVTOOLS_KIT_CUSTOM_TABS__;
  920. else if (property === "commands") return _vue_devtools_shared.target.__VUE_DEVTOOLS_KIT_CUSTOM_COMMANDS__;
  921. return _vue_devtools_shared.target[STATE_KEY][property];
  922. },
  923. deleteProperty(target, property) {
  924. delete target[property];
  925. return true;
  926. },
  927. set(target, property, value) {
  928. target[property] = value;
  929. _vue_devtools_shared.target[STATE_KEY][property] = value;
  930. return true;
  931. }
  932. });
  933. function resetDevToolsState() {
  934. Object.assign(_vue_devtools_shared.target[STATE_KEY], initStateFactory());
  935. }
  936. function updateDevToolsState(state) {
  937. const oldState = {
  938. ..._vue_devtools_shared.target[STATE_KEY],
  939. appRecords: devtoolsAppRecords.value,
  940. activeAppRecordId: activeAppRecord.id
  941. };
  942. if (oldState.connected !== state.connected && state.connected || oldState.clientConnected !== state.clientConnected && state.clientConnected) callConnectedUpdatedHook(_vue_devtools_shared.target[STATE_KEY], oldState);
  943. Object.assign(_vue_devtools_shared.target[STATE_KEY], state);
  944. updateAllStates();
  945. }
  946. function onDevToolsConnected(fn) {
  947. return new Promise((resolve) => {
  948. if (devtoolsState.connected) {
  949. fn();
  950. resolve();
  951. }
  952. devtoolsContext.hooks.hook(DevToolsMessagingHookKeys.DEVTOOLS_CONNECTED_UPDATED, ({ state }) => {
  953. if (state.connected) {
  954. fn();
  955. resolve();
  956. }
  957. });
  958. });
  959. }
  960. const resolveIcon = (icon) => {
  961. if (!icon) return;
  962. if (icon.startsWith("baseline-")) return `custom-ic-${icon}`;
  963. if (icon.startsWith("i-") || (0, _vue_devtools_shared.isUrlString)(icon)) return icon;
  964. return `custom-ic-baseline-${icon}`;
  965. };
  966. function addCustomTab(tab) {
  967. const tabs = _vue_devtools_shared.target.__VUE_DEVTOOLS_KIT_CUSTOM_TABS__;
  968. if (tabs.some((t) => t.name === tab.name)) return;
  969. tabs.push({
  970. ...tab,
  971. icon: resolveIcon(tab.icon)
  972. });
  973. updateAllStates();
  974. }
  975. function addCustomCommand(action) {
  976. const commands = _vue_devtools_shared.target.__VUE_DEVTOOLS_KIT_CUSTOM_COMMANDS__;
  977. if (commands.some((t) => t.id === action.id)) return;
  978. commands.push({
  979. ...action,
  980. icon: resolveIcon(action.icon),
  981. children: action.children ? action.children.map((child) => ({
  982. ...child,
  983. icon: resolveIcon(child.icon)
  984. })) : void 0
  985. });
  986. updateAllStates();
  987. }
  988. function removeCustomCommand(actionId) {
  989. const commands = _vue_devtools_shared.target.__VUE_DEVTOOLS_KIT_CUSTOM_COMMANDS__;
  990. const index = commands.findIndex((t) => t.id === actionId);
  991. if (index === -1) return;
  992. commands.splice(index, 1);
  993. updateAllStates();
  994. }
  995. function toggleClientConnected(state) {
  996. updateDevToolsState({ clientConnected: state });
  997. }
  998. //#endregion
  999. //#region src/core/open-in-editor/index.ts
  1000. function setOpenInEditorBaseUrl(url) {
  1001. _vue_devtools_shared.target.__VUE_DEVTOOLS_OPEN_IN_EDITOR_BASE_URL__ = url;
  1002. }
  1003. function openInEditor(options = {}) {
  1004. const { file, host, baseUrl = window.location.origin, line = 0, column = 0 } = options;
  1005. if (file) {
  1006. if (host === "chrome-extension") {
  1007. const fileName = file.replace(/\\/g, "\\\\");
  1008. const _baseUrl = window.VUE_DEVTOOLS_CONFIG?.openInEditorHost ?? "/";
  1009. fetch(`${_baseUrl}__open-in-editor?file=${encodeURI(file)}`).then((response) => {
  1010. if (!response.ok) {
  1011. const msg = `Opening component ${fileName} failed`;
  1012. console.log(`%c${msg}`, "color:red");
  1013. }
  1014. });
  1015. } else if (devtoolsState.vitePluginDetected) {
  1016. const _baseUrl = _vue_devtools_shared.target.__VUE_DEVTOOLS_OPEN_IN_EDITOR_BASE_URL__ ?? baseUrl;
  1017. _vue_devtools_shared.target.__VUE_INSPECTOR__.openInEditor(_baseUrl, file, line, column);
  1018. }
  1019. }
  1020. }
  1021. //#endregion
  1022. //#region src/ctx/plugin.ts
  1023. _vue_devtools_shared.target.__VUE_DEVTOOLS_KIT_PLUGIN_BUFFER__ ??= [];
  1024. const devtoolsPluginBuffer = new Proxy(_vue_devtools_shared.target.__VUE_DEVTOOLS_KIT_PLUGIN_BUFFER__, { get(target, prop, receiver) {
  1025. return Reflect.get(target, prop, receiver);
  1026. } });
  1027. function addDevToolsPluginToBuffer(pluginDescriptor, setupFn) {
  1028. devtoolsPluginBuffer.push([pluginDescriptor, setupFn]);
  1029. }
  1030. //#endregion
  1031. //#region src/core/plugin/plugin-settings.ts
  1032. function _getSettings(settings) {
  1033. const _settings = {};
  1034. Object.keys(settings).forEach((key) => {
  1035. _settings[key] = settings[key].defaultValue;
  1036. });
  1037. return _settings;
  1038. }
  1039. function getPluginLocalKey(pluginId) {
  1040. return `__VUE_DEVTOOLS_NEXT_PLUGIN_SETTINGS__${pluginId}__`;
  1041. }
  1042. function getPluginSettingsOptions(pluginId) {
  1043. return (devtoolsPluginBuffer.find((item) => item[0].id === pluginId && !!item[0]?.settings)?.[0] ?? null)?.settings ?? null;
  1044. }
  1045. function getPluginSettings(pluginId, fallbackValue) {
  1046. const localKey = getPluginLocalKey(pluginId);
  1047. if (localKey) {
  1048. const localSettings = localStorage.getItem(localKey);
  1049. if (localSettings) return JSON.parse(localSettings);
  1050. }
  1051. if (pluginId) return _getSettings((devtoolsPluginBuffer.find((item) => item[0].id === pluginId)?.[0] ?? null)?.settings ?? {});
  1052. return _getSettings(fallbackValue);
  1053. }
  1054. function initPluginSettings(pluginId, settings) {
  1055. const localKey = getPluginLocalKey(pluginId);
  1056. if (!localStorage.getItem(localKey)) localStorage.setItem(localKey, JSON.stringify(_getSettings(settings)));
  1057. }
  1058. function setPluginSettings(pluginId, key, value) {
  1059. const localKey = getPluginLocalKey(pluginId);
  1060. const localSettings = localStorage.getItem(localKey);
  1061. const parsedLocalSettings = JSON.parse(localSettings || "{}");
  1062. const updated = {
  1063. ...parsedLocalSettings,
  1064. [key]: value
  1065. };
  1066. localStorage.setItem(localKey, JSON.stringify(updated));
  1067. devtoolsContext.hooks.callHookWith((callbacks) => {
  1068. callbacks.forEach((cb) => cb({
  1069. pluginId,
  1070. key,
  1071. oldValue: parsedLocalSettings[key],
  1072. newValue: value,
  1073. settings: updated
  1074. }));
  1075. }, DevToolsV6PluginAPIHookKeys.SET_PLUGIN_SETTINGS);
  1076. }
  1077. //#endregion
  1078. //#region src/types/hook.ts
  1079. let DevToolsHooks = /* @__PURE__ */ function(DevToolsHooks) {
  1080. DevToolsHooks["APP_INIT"] = "app:init";
  1081. DevToolsHooks["APP_UNMOUNT"] = "app:unmount";
  1082. DevToolsHooks["COMPONENT_UPDATED"] = "component:updated";
  1083. DevToolsHooks["COMPONENT_ADDED"] = "component:added";
  1084. DevToolsHooks["COMPONENT_REMOVED"] = "component:removed";
  1085. DevToolsHooks["COMPONENT_EMIT"] = "component:emit";
  1086. DevToolsHooks["PERFORMANCE_START"] = "perf:start";
  1087. DevToolsHooks["PERFORMANCE_END"] = "perf:end";
  1088. DevToolsHooks["ADD_ROUTE"] = "router:add-route";
  1089. DevToolsHooks["REMOVE_ROUTE"] = "router:remove-route";
  1090. DevToolsHooks["RENDER_TRACKED"] = "render:tracked";
  1091. DevToolsHooks["RENDER_TRIGGERED"] = "render:triggered";
  1092. DevToolsHooks["APP_CONNECTED"] = "app:connected";
  1093. DevToolsHooks["SETUP_DEVTOOLS_PLUGIN"] = "devtools-plugin:setup";
  1094. return DevToolsHooks;
  1095. }({});
  1096. //#endregion
  1097. //#region src/hook/index.ts
  1098. const devtoolsHooks = _vue_devtools_shared.target.__VUE_DEVTOOLS_HOOK ??= (0, hookable.createHooks)();
  1099. const on = {
  1100. vueAppInit(fn) {
  1101. devtoolsHooks.hook(DevToolsHooks.APP_INIT, fn);
  1102. },
  1103. vueAppUnmount(fn) {
  1104. devtoolsHooks.hook(DevToolsHooks.APP_UNMOUNT, fn);
  1105. },
  1106. vueAppConnected(fn) {
  1107. devtoolsHooks.hook(DevToolsHooks.APP_CONNECTED, fn);
  1108. },
  1109. componentAdded(fn) {
  1110. return devtoolsHooks.hook(DevToolsHooks.COMPONENT_ADDED, fn);
  1111. },
  1112. componentEmit(fn) {
  1113. return devtoolsHooks.hook(DevToolsHooks.COMPONENT_EMIT, fn);
  1114. },
  1115. componentUpdated(fn) {
  1116. return devtoolsHooks.hook(DevToolsHooks.COMPONENT_UPDATED, fn);
  1117. },
  1118. componentRemoved(fn) {
  1119. return devtoolsHooks.hook(DevToolsHooks.COMPONENT_REMOVED, fn);
  1120. },
  1121. setupDevtoolsPlugin(fn) {
  1122. devtoolsHooks.hook(DevToolsHooks.SETUP_DEVTOOLS_PLUGIN, fn);
  1123. },
  1124. perfStart(fn) {
  1125. return devtoolsHooks.hook(DevToolsHooks.PERFORMANCE_START, fn);
  1126. },
  1127. perfEnd(fn) {
  1128. return devtoolsHooks.hook(DevToolsHooks.PERFORMANCE_END, fn);
  1129. }
  1130. };
  1131. function createDevToolsHook() {
  1132. return {
  1133. id: "vue-devtools-next",
  1134. devtoolsVersion: "7.0",
  1135. enabled: false,
  1136. appRecords: [],
  1137. apps: [],
  1138. events: /* @__PURE__ */ new Map(),
  1139. on(event, fn) {
  1140. if (!this.events.has(event)) this.events.set(event, []);
  1141. this.events.get(event)?.push(fn);
  1142. return () => this.off(event, fn);
  1143. },
  1144. once(event, fn) {
  1145. const onceFn = (...args) => {
  1146. this.off(event, onceFn);
  1147. fn(...args);
  1148. };
  1149. this.on(event, onceFn);
  1150. return [event, onceFn];
  1151. },
  1152. off(event, fn) {
  1153. if (this.events.has(event)) {
  1154. const eventCallbacks = this.events.get(event);
  1155. const index = eventCallbacks.indexOf(fn);
  1156. if (index !== -1) eventCallbacks.splice(index, 1);
  1157. }
  1158. },
  1159. emit(event, ...payload) {
  1160. if (this.events.has(event)) this.events.get(event).forEach((fn) => fn(...payload));
  1161. }
  1162. };
  1163. }
  1164. function subscribeDevToolsHook(hook) {
  1165. hook.on(DevToolsHooks.APP_INIT, (app, version, types) => {
  1166. if (app?._instance?.type?.devtools?.hide) return;
  1167. devtoolsHooks.callHook(DevToolsHooks.APP_INIT, app, version, types);
  1168. });
  1169. hook.on(DevToolsHooks.APP_UNMOUNT, (app) => {
  1170. devtoolsHooks.callHook(DevToolsHooks.APP_UNMOUNT, app);
  1171. });
  1172. hook.on(DevToolsHooks.COMPONENT_ADDED, async (app, uid, parentUid, component) => {
  1173. if (app?._instance?.type?.devtools?.hide || devtoolsState.highPerfModeEnabled) return;
  1174. if (!app || typeof uid !== "number" && !uid || !component) return;
  1175. devtoolsHooks.callHook(DevToolsHooks.COMPONENT_ADDED, app, uid, parentUid, component);
  1176. });
  1177. hook.on(DevToolsHooks.COMPONENT_UPDATED, (app, uid, parentUid, component) => {
  1178. if (!app || typeof uid !== "number" && !uid || !component || devtoolsState.highPerfModeEnabled) return;
  1179. devtoolsHooks.callHook(DevToolsHooks.COMPONENT_UPDATED, app, uid, parentUid, component);
  1180. });
  1181. hook.on(DevToolsHooks.COMPONENT_REMOVED, async (app, uid, parentUid, component) => {
  1182. if (!app || typeof uid !== "number" && !uid || !component || devtoolsState.highPerfModeEnabled) return;
  1183. devtoolsHooks.callHook(DevToolsHooks.COMPONENT_REMOVED, app, uid, parentUid, component);
  1184. });
  1185. hook.on(DevToolsHooks.COMPONENT_EMIT, async (app, instance, event, params) => {
  1186. if (!app || !instance || devtoolsState.highPerfModeEnabled) return;
  1187. devtoolsHooks.callHook(DevToolsHooks.COMPONENT_EMIT, app, instance, event, params);
  1188. });
  1189. hook.on(DevToolsHooks.PERFORMANCE_START, (app, uid, vm, type, time) => {
  1190. if (!app || devtoolsState.highPerfModeEnabled) return;
  1191. devtoolsHooks.callHook(DevToolsHooks.PERFORMANCE_START, app, uid, vm, type, time);
  1192. });
  1193. hook.on(DevToolsHooks.PERFORMANCE_END, (app, uid, vm, type, time) => {
  1194. if (!app || devtoolsState.highPerfModeEnabled) return;
  1195. devtoolsHooks.callHook(DevToolsHooks.PERFORMANCE_END, app, uid, vm, type, time);
  1196. });
  1197. hook.on(DevToolsHooks.SETUP_DEVTOOLS_PLUGIN, (pluginDescriptor, setupFn, options) => {
  1198. if (options?.target === "legacy") return;
  1199. devtoolsHooks.callHook(DevToolsHooks.SETUP_DEVTOOLS_PLUGIN, pluginDescriptor, setupFn);
  1200. });
  1201. }
  1202. const hook = {
  1203. on,
  1204. setupDevToolsPlugin(pluginDescriptor, setupFn) {
  1205. return devtoolsHooks.callHook(DevToolsHooks.SETUP_DEVTOOLS_PLUGIN, pluginDescriptor, setupFn);
  1206. }
  1207. };
  1208. //#endregion
  1209. //#region src/api/v6/index.ts
  1210. var DevToolsV6PluginAPI = class {
  1211. constructor({ plugin, ctx }) {
  1212. this.hooks = ctx.hooks;
  1213. this.plugin = plugin;
  1214. }
  1215. get on() {
  1216. return {
  1217. visitComponentTree: (handler) => {
  1218. this.hooks.hook(DevToolsV6PluginAPIHookKeys.VISIT_COMPONENT_TREE, handler);
  1219. },
  1220. inspectComponent: (handler) => {
  1221. this.hooks.hook(DevToolsV6PluginAPIHookKeys.INSPECT_COMPONENT, handler);
  1222. },
  1223. editComponentState: (handler) => {
  1224. this.hooks.hook(DevToolsV6PluginAPIHookKeys.EDIT_COMPONENT_STATE, handler);
  1225. },
  1226. getInspectorTree: (handler) => {
  1227. this.hooks.hook(DevToolsV6PluginAPIHookKeys.GET_INSPECTOR_TREE, handler);
  1228. },
  1229. getInspectorState: (handler) => {
  1230. this.hooks.hook(DevToolsV6PluginAPIHookKeys.GET_INSPECTOR_STATE, handler);
  1231. },
  1232. editInspectorState: (handler) => {
  1233. this.hooks.hook(DevToolsV6PluginAPIHookKeys.EDIT_INSPECTOR_STATE, handler);
  1234. },
  1235. inspectTimelineEvent: (handler) => {
  1236. this.hooks.hook(DevToolsV6PluginAPIHookKeys.INSPECT_TIMELINE_EVENT, handler);
  1237. },
  1238. timelineCleared: (handler) => {
  1239. this.hooks.hook(DevToolsV6PluginAPIHookKeys.TIMELINE_CLEARED, handler);
  1240. },
  1241. setPluginSettings: (handler) => {
  1242. this.hooks.hook(DevToolsV6PluginAPIHookKeys.SET_PLUGIN_SETTINGS, handler);
  1243. }
  1244. };
  1245. }
  1246. notifyComponentUpdate(instance) {
  1247. if (devtoolsState.highPerfModeEnabled) return;
  1248. const inspector = getActiveInspectors().find((i) => i.packageName === this.plugin.descriptor.packageName);
  1249. if (inspector?.id) {
  1250. if (instance) {
  1251. const args = [
  1252. instance.appContext.app,
  1253. instance.uid,
  1254. instance.parent?.uid,
  1255. instance
  1256. ];
  1257. devtoolsHooks.callHook(DevToolsHooks.COMPONENT_UPDATED, ...args);
  1258. } else devtoolsHooks.callHook(DevToolsHooks.COMPONENT_UPDATED);
  1259. this.hooks.callHook(DevToolsContextHookKeys.SEND_INSPECTOR_STATE, {
  1260. inspectorId: inspector.id,
  1261. plugin: this.plugin
  1262. });
  1263. }
  1264. }
  1265. addInspector(options) {
  1266. this.hooks.callHook(DevToolsContextHookKeys.ADD_INSPECTOR, {
  1267. inspector: options,
  1268. plugin: this.plugin
  1269. });
  1270. if (this.plugin.descriptor.settings) initPluginSettings(options.id, this.plugin.descriptor.settings);
  1271. }
  1272. sendInspectorTree(inspectorId) {
  1273. if (devtoolsState.highPerfModeEnabled) return;
  1274. this.hooks.callHook(DevToolsContextHookKeys.SEND_INSPECTOR_TREE, {
  1275. inspectorId,
  1276. plugin: this.plugin
  1277. });
  1278. }
  1279. sendInspectorState(inspectorId) {
  1280. if (devtoolsState.highPerfModeEnabled) return;
  1281. this.hooks.callHook(DevToolsContextHookKeys.SEND_INSPECTOR_STATE, {
  1282. inspectorId,
  1283. plugin: this.plugin
  1284. });
  1285. }
  1286. selectInspectorNode(inspectorId, nodeId) {
  1287. this.hooks.callHook(DevToolsContextHookKeys.CUSTOM_INSPECTOR_SELECT_NODE, {
  1288. inspectorId,
  1289. nodeId,
  1290. plugin: this.plugin
  1291. });
  1292. }
  1293. visitComponentTree(payload) {
  1294. return this.hooks.callHook(DevToolsV6PluginAPIHookKeys.VISIT_COMPONENT_TREE, payload);
  1295. }
  1296. now() {
  1297. if (devtoolsState.highPerfModeEnabled) return 0;
  1298. return Date.now();
  1299. }
  1300. addTimelineLayer(options) {
  1301. this.hooks.callHook(DevToolsContextHookKeys.TIMELINE_LAYER_ADDED, {
  1302. options,
  1303. plugin: this.plugin
  1304. });
  1305. }
  1306. addTimelineEvent(options) {
  1307. if (devtoolsState.highPerfModeEnabled) return;
  1308. this.hooks.callHook(DevToolsContextHookKeys.TIMELINE_EVENT_ADDED, {
  1309. options,
  1310. plugin: this.plugin
  1311. });
  1312. }
  1313. getSettings(pluginId) {
  1314. return getPluginSettings(pluginId ?? this.plugin.descriptor.id, this.plugin.descriptor.settings);
  1315. }
  1316. getComponentInstances(app) {
  1317. return this.hooks.callHook(DevToolsContextHookKeys.GET_COMPONENT_INSTANCES, { app });
  1318. }
  1319. getComponentBounds(instance) {
  1320. return this.hooks.callHook(DevToolsContextHookKeys.GET_COMPONENT_BOUNDS, { instance });
  1321. }
  1322. getComponentName(instance) {
  1323. return this.hooks.callHook(DevToolsContextHookKeys.GET_COMPONENT_NAME, { instance });
  1324. }
  1325. highlightElement(instance) {
  1326. const uid = instance.__VUE_DEVTOOLS_NEXT_UID__;
  1327. return this.hooks.callHook(DevToolsContextHookKeys.COMPONENT_HIGHLIGHT, { uid });
  1328. }
  1329. unhighlightElement() {
  1330. return this.hooks.callHook(DevToolsContextHookKeys.COMPONENT_UNHIGHLIGHT);
  1331. }
  1332. };
  1333. //#endregion
  1334. //#region src/api/index.ts
  1335. const DevToolsPluginAPI = DevToolsV6PluginAPI;
  1336. //#endregion
  1337. //#region src/core/component/state/constants.ts
  1338. const vueBuiltins = new Set([
  1339. "nextTick",
  1340. "defineComponent",
  1341. "defineAsyncComponent",
  1342. "defineCustomElement",
  1343. "ref",
  1344. "computed",
  1345. "reactive",
  1346. "readonly",
  1347. "watchEffect",
  1348. "watchPostEffect",
  1349. "watchSyncEffect",
  1350. "watch",
  1351. "isRef",
  1352. "unref",
  1353. "toRef",
  1354. "toRefs",
  1355. "isProxy",
  1356. "isReactive",
  1357. "isReadonly",
  1358. "shallowRef",
  1359. "triggerRef",
  1360. "customRef",
  1361. "shallowReactive",
  1362. "shallowReadonly",
  1363. "toRaw",
  1364. "markRaw",
  1365. "effectScope",
  1366. "getCurrentScope",
  1367. "onScopeDispose",
  1368. "onMounted",
  1369. "onUpdated",
  1370. "onUnmounted",
  1371. "onBeforeMount",
  1372. "onBeforeUpdate",
  1373. "onBeforeUnmount",
  1374. "onErrorCaptured",
  1375. "onRenderTracked",
  1376. "onRenderTriggered",
  1377. "onActivated",
  1378. "onDeactivated",
  1379. "onServerPrefetch",
  1380. "provide",
  1381. "inject",
  1382. "h",
  1383. "mergeProps",
  1384. "cloneVNode",
  1385. "isVNode",
  1386. "resolveComponent",
  1387. "resolveDirective",
  1388. "withDirectives",
  1389. "withModifiers"
  1390. ]);
  1391. const symbolRE = /^\[native Symbol Symbol\((.*)\)\]$/;
  1392. const rawTypeRE = /^\[object (\w+)\]$/;
  1393. const specialTypeRE = /^\[native (\w+) (.*?)(<>(([\s\S])*))?\]$/;
  1394. const fnTypeRE = /^(?:function|class) (\w+)/;
  1395. const MAX_STRING_SIZE = 1e4;
  1396. const MAX_ARRAY_SIZE = 5e3;
  1397. const UNDEFINED = "__vue_devtool_undefined__";
  1398. const INFINITY = "__vue_devtool_infinity__";
  1399. const NEGATIVE_INFINITY = "__vue_devtool_negative_infinity__";
  1400. const NAN = "__vue_devtool_nan__";
  1401. const ESC = {
  1402. "<": "&lt;",
  1403. ">": "&gt;",
  1404. "\"": "&quot;",
  1405. "&": "&amp;"
  1406. };
  1407. //#endregion
  1408. //#region src/core/component/state/is.ts
  1409. function isVueInstance(value) {
  1410. if (!ensurePropertyExists(value, "_")) return false;
  1411. if (!isPlainObject(value._)) return false;
  1412. return Object.keys(value._).includes("vnode");
  1413. }
  1414. function isPlainObject(obj) {
  1415. return Object.prototype.toString.call(obj) === "[object Object]";
  1416. }
  1417. function isPrimitive$1(data) {
  1418. if (data == null) return true;
  1419. const type = typeof data;
  1420. return type === "string" || type === "number" || type === "boolean";
  1421. }
  1422. function isRef(raw) {
  1423. return !!raw.__v_isRef;
  1424. }
  1425. function isComputed(raw) {
  1426. return isRef(raw) && !!raw.effect;
  1427. }
  1428. function isReactive(raw) {
  1429. return !!raw.__v_isReactive;
  1430. }
  1431. function isReadOnly(raw) {
  1432. return !!raw.__v_isReadonly;
  1433. }
  1434. //#endregion
  1435. //#region src/core/component/state/util.ts
  1436. const tokenMap = {
  1437. [UNDEFINED]: "undefined",
  1438. [NAN]: "NaN",
  1439. [INFINITY]: "Infinity",
  1440. [NEGATIVE_INFINITY]: "-Infinity"
  1441. };
  1442. const reversedTokenMap = Object.entries(tokenMap).reduce((acc, [key, value]) => {
  1443. acc[value] = key;
  1444. return acc;
  1445. }, {});
  1446. function internalStateTokenToString(value) {
  1447. if (value === null) return "null";
  1448. return typeof value === "string" && tokenMap[value] || false;
  1449. }
  1450. function replaceTokenToString(value) {
  1451. const replaceRegex = new RegExp(`"(${Object.keys(tokenMap).join("|")})"`, "g");
  1452. return value.replace(replaceRegex, (_, g1) => tokenMap[g1]);
  1453. }
  1454. function replaceStringToToken(value) {
  1455. const literalValue = reversedTokenMap[value.trim()];
  1456. if (literalValue) return `"${literalValue}"`;
  1457. const replaceRegex = new RegExp(`:\\s*(${Object.keys(reversedTokenMap).join("|")})`, "g");
  1458. return value.replace(replaceRegex, (_, g1) => `:"${reversedTokenMap[g1]}"`);
  1459. }
  1460. /**
  1461. * Convert prop type constructor to string.
  1462. */
  1463. function getPropType(type) {
  1464. if (Array.isArray(type)) return type.map((t) => getPropType(t)).join(" or ");
  1465. if (type == null) return "null";
  1466. const match = type.toString().match(fnTypeRE);
  1467. return typeof type === "function" ? match && match[1] || "any" : "any";
  1468. }
  1469. /**
  1470. * Sanitize data to be posted to the other side.
  1471. * Since the message posted is sent with structured clone,
  1472. * we need to filter out any types that might cause an error.
  1473. */
  1474. function sanitize(data) {
  1475. if (!isPrimitive$1(data) && !Array.isArray(data) && !isPlainObject(data)) return Object.prototype.toString.call(data);
  1476. else return data;
  1477. }
  1478. function getSetupStateType(raw) {
  1479. try {
  1480. return {
  1481. ref: isRef(raw),
  1482. computed: isComputed(raw),
  1483. reactive: isReactive(raw),
  1484. readonly: isReadOnly(raw)
  1485. };
  1486. } catch {
  1487. return {
  1488. ref: false,
  1489. computed: false,
  1490. reactive: false,
  1491. readonly: false
  1492. };
  1493. }
  1494. }
  1495. function toRaw(value) {
  1496. if (value?.__v_raw) return value.__v_raw;
  1497. return value;
  1498. }
  1499. function escape(s) {
  1500. return s.replace(/[<>"&]/g, (s) => {
  1501. return ESC[s] || s;
  1502. });
  1503. }
  1504. //#endregion
  1505. //#region src/core/component/state/process.ts
  1506. function mergeOptions(to, from, instance) {
  1507. if (typeof from === "function") from = from.options;
  1508. if (!from) return to;
  1509. const { mixins, extends: extendsOptions } = from;
  1510. extendsOptions && mergeOptions(to, extendsOptions, instance);
  1511. mixins && mixins.forEach((m) => mergeOptions(to, m, instance));
  1512. for (const key of ["computed", "inject"]) if (Object.prototype.hasOwnProperty.call(from, key)) {
  1513. to[key] ??= {};
  1514. Object.assign(to[key], from[key]);
  1515. }
  1516. return to;
  1517. }
  1518. function resolveMergedOptions(instance) {
  1519. const raw = instance?.type;
  1520. if (!raw) return {};
  1521. const { mixins, extends: extendsOptions } = raw;
  1522. const globalMixins = instance.appContext.mixins;
  1523. if (!globalMixins.length && !mixins && !extendsOptions) return raw;
  1524. const options = {};
  1525. globalMixins.forEach((m) => mergeOptions(options, m, instance));
  1526. mergeOptions(options, raw, instance);
  1527. return options;
  1528. }
  1529. /**
  1530. * Process the props of an instance.
  1531. * Make sure return a plain object because window.postMessage()
  1532. * will throw an Error if the passed object contains Functions.
  1533. *
  1534. */
  1535. function processProps(instance) {
  1536. const props = [];
  1537. const propDefinitions = instance?.type?.props;
  1538. for (const key in instance?.props) {
  1539. const propDefinition = propDefinitions ? propDefinitions[key] : null;
  1540. const camelizeKey = (0, _vue_devtools_shared.camelize)(key);
  1541. props.push({
  1542. type: "props",
  1543. key: camelizeKey,
  1544. value: returnError(() => instance.props[key]),
  1545. editable: true,
  1546. meta: propDefinition ? {
  1547. type: propDefinition.type ? getPropType(propDefinition.type) : "any",
  1548. required: !!propDefinition.required,
  1549. ...propDefinition.default ? { default: propDefinition.default.toString() } : {}
  1550. } : { type: "invalid" }
  1551. });
  1552. }
  1553. return props;
  1554. }
  1555. /**
  1556. * Process state, filtering out props and "clean" the result
  1557. * with a JSON dance. This removes functions which can cause
  1558. * errors during structured clone used by window.postMessage.
  1559. *
  1560. */
  1561. function processState(instance) {
  1562. const type = instance.type;
  1563. const props = type?.props;
  1564. const getters = type.vuex && type.vuex.getters;
  1565. const computedDefs = type.computed;
  1566. const data = {
  1567. ...instance.data,
  1568. ...instance.renderContext
  1569. };
  1570. return Object.keys(data).filter((key) => !(props && key in props) && !(getters && key in getters) && !(computedDefs && key in computedDefs)).map((key) => ({
  1571. key,
  1572. type: "data",
  1573. value: returnError(() => data[key]),
  1574. editable: true
  1575. }));
  1576. }
  1577. function getStateTypeAndName(info) {
  1578. const stateType = info.computed ? "computed" : info.ref ? "ref" : info.reactive ? "reactive" : null;
  1579. return {
  1580. stateType,
  1581. stateTypeName: stateType ? `${stateType.charAt(0).toUpperCase()}${stateType.slice(1)}` : null
  1582. };
  1583. }
  1584. function processSetupState(instance) {
  1585. const raw = instance.devtoolsRawSetupState || {};
  1586. return Object.keys(instance.setupState).filter((key) => !vueBuiltins.has(key) && key.split(/(?=[A-Z])/)[0] !== "use").map((key) => {
  1587. const value = returnError(() => toRaw(instance.setupState[key]));
  1588. const accessError = value instanceof Error;
  1589. const rawData = raw[key];
  1590. let result;
  1591. let isOtherType = accessError || typeof value === "function" || ensurePropertyExists(value, "render") && typeof value.render === "function" || ensurePropertyExists(value, "__asyncLoader") && typeof value.__asyncLoader === "function" || typeof value === "object" && value && ("setup" in value || "props" in value) || /^v[A-Z]/.test(key);
  1592. if (rawData && !accessError) {
  1593. const info = getSetupStateType(rawData);
  1594. const { stateType, stateTypeName } = getStateTypeAndName(info);
  1595. const isState = info.ref || info.computed || info.reactive;
  1596. const raw = ensurePropertyExists(rawData, "effect") ? rawData.effect?.raw?.toString() || rawData.effect?.fn?.toString() : null;
  1597. if (stateType) isOtherType = false;
  1598. result = {
  1599. ...stateType ? {
  1600. stateType,
  1601. stateTypeName
  1602. } : {},
  1603. ...raw ? { raw } : {},
  1604. editable: isState && !info.readonly
  1605. };
  1606. }
  1607. return {
  1608. key,
  1609. value,
  1610. type: isOtherType ? "setup (other)" : "setup",
  1611. ...result
  1612. };
  1613. });
  1614. }
  1615. /**
  1616. * Process the computed properties of an instance.
  1617. */
  1618. function processComputed(instance, mergedType) {
  1619. const type = mergedType;
  1620. const computed = [];
  1621. const defs = type.computed || {};
  1622. for (const key in defs) {
  1623. const def = defs[key];
  1624. const type = typeof def === "function" && def.vuex ? "vuex bindings" : "computed";
  1625. computed.push({
  1626. type,
  1627. key,
  1628. value: returnError(() => instance?.proxy?.[key]),
  1629. editable: typeof def.set === "function"
  1630. });
  1631. }
  1632. return computed;
  1633. }
  1634. function processAttrs(instance) {
  1635. return Object.keys(instance.attrs).map((key) => ({
  1636. type: "attrs",
  1637. key,
  1638. value: returnError(() => instance.attrs[key])
  1639. }));
  1640. }
  1641. function processProvide(instance) {
  1642. return Reflect.ownKeys(instance.provides).map((key) => ({
  1643. type: "provided",
  1644. key: key.toString(),
  1645. value: returnError(() => instance.provides[key])
  1646. }));
  1647. }
  1648. function processInject(instance, mergedType) {
  1649. if (!mergedType?.inject) return [];
  1650. let keys = [];
  1651. let defaultValue;
  1652. if (Array.isArray(mergedType.inject)) keys = mergedType.inject.map((key) => ({
  1653. key,
  1654. originalKey: key
  1655. }));
  1656. else keys = Reflect.ownKeys(mergedType.inject).map((key) => {
  1657. const value = mergedType.inject[key];
  1658. let originalKey;
  1659. if (typeof value === "string" || typeof value === "symbol") originalKey = value;
  1660. else {
  1661. originalKey = value.from;
  1662. defaultValue = value.default;
  1663. }
  1664. return {
  1665. key,
  1666. originalKey
  1667. };
  1668. });
  1669. return keys.map(({ key, originalKey }) => ({
  1670. type: "injected",
  1671. key: originalKey && key !== originalKey ? `${originalKey.toString()} ➞ ${key.toString()}` : key.toString(),
  1672. value: returnError(() => instance.ctx.hasOwnProperty(key) ? instance.ctx[key] : instance.provides.hasOwnProperty(originalKey) ? instance.provides[originalKey] : defaultValue)
  1673. }));
  1674. }
  1675. function processRefs(instance) {
  1676. return Object.keys(instance.refs).map((key) => ({
  1677. type: "template refs",
  1678. key,
  1679. value: returnError(() => instance.refs[key])
  1680. }));
  1681. }
  1682. const vnodeEvents = new Set([
  1683. "vnode-before-mount",
  1684. "vnode-mounted",
  1685. "vnode-before-update",
  1686. "vnode-updated",
  1687. "vnode-before-unmount",
  1688. "vnode-unmounted"
  1689. ]);
  1690. function processEventListeners(instance) {
  1691. const emitsDefinition = instance.type.emits;
  1692. const declaredEmits = Array.isArray(emitsDefinition) ? emitsDefinition : Object.keys(emitsDefinition ?? {});
  1693. const keys = Object.keys(instance?.vnode?.props ?? {});
  1694. const result = [];
  1695. for (const key of keys) {
  1696. const [prefix, ...eventNameParts] = key.split(/(?=[A-Z])/);
  1697. if (prefix === "on") {
  1698. const eventName = eventNameParts.join("-").toLowerCase();
  1699. const isBuiltIn = vnodeEvents.has(eventName);
  1700. const isDeclared = declaredEmits.includes(eventName) || declaredEmits.includes((0, _vue_devtools_shared.camelize)(eventName));
  1701. const text = isBuiltIn ? "✅ Built-in" : isDeclared ? "✅ Declared" : "⚠️ Not declared";
  1702. result.push({
  1703. type: "event listeners",
  1704. key: eventName,
  1705. value: { _custom: {
  1706. displayText: text,
  1707. key: text,
  1708. value: text,
  1709. tooltipText: isBuiltIn ? `The event <code>${escape(eventName)}</code> is part of Vue and doesn't need to be declared by the component` : !isDeclared ? `The event <code>${escape(eventName)}</code> is not declared in the <code>emits</code> option. It will leak into the component's attributes (<code>$attrs</code>).` : null
  1710. } }
  1711. });
  1712. }
  1713. }
  1714. return result;
  1715. }
  1716. function processInstanceState(instance) {
  1717. const mergedType = resolveMergedOptions(instance);
  1718. return processProps(instance).concat(processState(instance), processSetupState(instance), processComputed(instance, mergedType), processAttrs(instance), processProvide(instance), processInject(instance, mergedType), processRefs(instance), processEventListeners(instance));
  1719. }
  1720. //#endregion
  1721. //#region src/core/component/state/index.ts
  1722. function getInstanceState(params) {
  1723. const instance = getComponentInstance(activeAppRecord.value, params.instanceId);
  1724. return {
  1725. id: getUniqueComponentId(instance),
  1726. name: getInstanceName(instance),
  1727. file: instance?.type?.__file,
  1728. state: processInstanceState(instance),
  1729. instance
  1730. };
  1731. }
  1732. //#endregion
  1733. //#region src/core/component/tree/filter.ts
  1734. var ComponentFilter = class {
  1735. constructor(filter) {
  1736. this.filter = filter || "";
  1737. }
  1738. /**
  1739. * Check if an instance is qualified.
  1740. *
  1741. * @param {Vue|Vnode} instance
  1742. * @return {boolean}
  1743. */
  1744. isQualified(instance) {
  1745. const name = getInstanceName(instance);
  1746. return (0, _vue_devtools_shared.classify)(name).toLowerCase().includes(this.filter) || (0, _vue_devtools_shared.kebabize)(name).toLowerCase().includes(this.filter);
  1747. }
  1748. };
  1749. function createComponentFilter(filterText) {
  1750. return new ComponentFilter(filterText);
  1751. }
  1752. //#endregion
  1753. //#region src/core/component/tree/walker.ts
  1754. var ComponentWalker = class {
  1755. constructor(options) {
  1756. this.captureIds = /* @__PURE__ */ new Map();
  1757. const { filterText = "", maxDepth, recursively, api } = options;
  1758. this.componentFilter = createComponentFilter(filterText);
  1759. this.maxDepth = maxDepth;
  1760. this.recursively = recursively;
  1761. this.api = api;
  1762. }
  1763. getComponentTree(instance) {
  1764. this.captureIds = /* @__PURE__ */ new Map();
  1765. return this.findQualifiedChildren(instance, 0);
  1766. }
  1767. getComponentParents(instance) {
  1768. this.captureIds = /* @__PURE__ */ new Map();
  1769. const parents = [];
  1770. this.captureId(instance);
  1771. let parent = instance;
  1772. while (parent = parent.parent) {
  1773. this.captureId(parent);
  1774. parents.push(parent);
  1775. }
  1776. return parents;
  1777. }
  1778. captureId(instance) {
  1779. if (!instance) return null;
  1780. const id = instance.__VUE_DEVTOOLS_NEXT_UID__ != null ? instance.__VUE_DEVTOOLS_NEXT_UID__ : getUniqueComponentId(instance);
  1781. instance.__VUE_DEVTOOLS_NEXT_UID__ = id;
  1782. if (this.captureIds.has(id)) return null;
  1783. else this.captureIds.set(id, void 0);
  1784. this.mark(instance);
  1785. return id;
  1786. }
  1787. /**
  1788. * Capture the meta information of an instance. (recursive)
  1789. *
  1790. * @param {Vue} instance
  1791. * @return {object}
  1792. */
  1793. async capture(instance, depth) {
  1794. if (!instance) return null;
  1795. const id = this.captureId(instance);
  1796. const name = getInstanceName(instance);
  1797. const children = this.getInternalInstanceChildren(instance.subTree).filter((child) => !isBeingDestroyed(child));
  1798. const parents = this.getComponentParents(instance) || [];
  1799. const inactive = !!instance.isDeactivated || parents.some((parent) => parent.isDeactivated);
  1800. const treeNode = {
  1801. uid: instance.uid,
  1802. id,
  1803. name,
  1804. renderKey: getRenderKey(instance.vnode ? instance.vnode.key : null),
  1805. inactive,
  1806. children: [],
  1807. hasChildren: !!children.length,
  1808. isFragment: isFragment(instance),
  1809. tags: typeof instance.type !== "function" ? [] : [{
  1810. label: "functional",
  1811. textColor: 5592405,
  1812. backgroundColor: 15658734
  1813. }],
  1814. autoOpen: this.recursively,
  1815. file: instance.type.__file || ""
  1816. };
  1817. if (depth < this.maxDepth || instance.type.__isKeepAlive || parents.some((parent) => parent.type.__isKeepAlive)) treeNode.children = await Promise.all(children.map((child) => this.capture(child, depth + 1)).filter(Boolean));
  1818. if (this.isKeepAlive(instance)) {
  1819. const cachedComponents = this.getKeepAliveCachedInstances(instance);
  1820. const childrenIds = children.map((child) => child.__VUE_DEVTOOLS_NEXT_UID__);
  1821. for (const cachedChild of cachedComponents) if (!childrenIds.includes(cachedChild.__VUE_DEVTOOLS_NEXT_UID__)) {
  1822. const node = await this.capture({
  1823. ...cachedChild,
  1824. isDeactivated: true
  1825. }, depth + 1);
  1826. if (node) treeNode.children.push(node);
  1827. }
  1828. }
  1829. const firstElement = getRootElementsFromComponentInstance(instance)[0];
  1830. if (firstElement?.parentElement) {
  1831. const parentInstance = instance.parent;
  1832. const parentRootElements = parentInstance ? getRootElementsFromComponentInstance(parentInstance) : [];
  1833. let el = firstElement;
  1834. const indexList = [];
  1835. do {
  1836. indexList.push(Array.from(el.parentElement.childNodes).indexOf(el));
  1837. el = el.parentElement;
  1838. } while (el.parentElement && parentRootElements.length && !parentRootElements.includes(el));
  1839. treeNode.domOrder = indexList.reverse();
  1840. } else treeNode.domOrder = [-1];
  1841. if (instance.suspense?.suspenseKey) {
  1842. treeNode.tags.push({
  1843. label: instance.suspense.suspenseKey,
  1844. backgroundColor: 14979812,
  1845. textColor: 16777215
  1846. });
  1847. this.mark(instance, true);
  1848. }
  1849. this.api.visitComponentTree({
  1850. treeNode,
  1851. componentInstance: instance,
  1852. app: instance.appContext.app,
  1853. filter: this.componentFilter.filter
  1854. });
  1855. return treeNode;
  1856. }
  1857. /**
  1858. * Find qualified children from a single instance.
  1859. * If the instance itself is qualified, just return itself.
  1860. * This is ok because [].concat works in both cases.
  1861. *
  1862. * @param {Vue|Vnode} instance
  1863. * @return {Vue|Array}
  1864. */
  1865. async findQualifiedChildren(instance, depth) {
  1866. if (this.componentFilter.isQualified(instance) && !instance.type.devtools?.hide) return [await this.capture(instance, depth)];
  1867. else if (instance.subTree) {
  1868. const list = this.isKeepAlive(instance) ? this.getKeepAliveCachedInstances(instance) : this.getInternalInstanceChildren(instance.subTree);
  1869. return this.findQualifiedChildrenFromList(list, depth);
  1870. } else return [];
  1871. }
  1872. /**
  1873. * Iterate through an array of instances and flatten it into
  1874. * an array of qualified instances. This is a depth-first
  1875. * traversal - e.g. if an instance is not matched, we will
  1876. * recursively go deeper until a qualified child is found.
  1877. *
  1878. * @param {Array} instances
  1879. * @return {Array}
  1880. */
  1881. async findQualifiedChildrenFromList(instances, depth) {
  1882. instances = instances.filter((child) => !isBeingDestroyed(child) && !child.type.devtools?.hide);
  1883. if (!this.componentFilter.filter) return Promise.all(instances.map((child) => this.capture(child, depth)));
  1884. else return Array.prototype.concat.apply([], await Promise.all(instances.map((i) => this.findQualifiedChildren(i, depth))));
  1885. }
  1886. /**
  1887. * Get children from a component instance.
  1888. */
  1889. getInternalInstanceChildren(subTree, suspense = null) {
  1890. const list = [];
  1891. if (subTree) {
  1892. if (subTree.component) !suspense ? list.push(subTree.component) : list.push({
  1893. ...subTree.component,
  1894. suspense
  1895. });
  1896. else if (subTree.suspense) {
  1897. const suspenseKey = !subTree.suspense.isInFallback ? "suspense default" : "suspense fallback";
  1898. list.push(...this.getInternalInstanceChildren(subTree.suspense.activeBranch, {
  1899. ...subTree.suspense,
  1900. suspenseKey
  1901. }));
  1902. } else if (Array.isArray(subTree.children)) subTree.children.forEach((childSubTree) => {
  1903. if (childSubTree.component) !suspense ? list.push(childSubTree.component) : list.push({
  1904. ...childSubTree.component,
  1905. suspense
  1906. });
  1907. else list.push(...this.getInternalInstanceChildren(childSubTree, suspense));
  1908. });
  1909. }
  1910. return list.filter((child) => !isBeingDestroyed(child) && !child.type.devtools?.hide);
  1911. }
  1912. /**
  1913. * Mark an instance as captured and store it in the instance map.
  1914. *
  1915. * @param {Vue} instance
  1916. */
  1917. mark(instance, force = false) {
  1918. const instanceMap = getAppRecord(instance).instanceMap;
  1919. if (force || !instanceMap.has(instance.__VUE_DEVTOOLS_NEXT_UID__)) {
  1920. instanceMap.set(instance.__VUE_DEVTOOLS_NEXT_UID__, instance);
  1921. activeAppRecord.value.instanceMap = instanceMap;
  1922. }
  1923. }
  1924. isKeepAlive(instance) {
  1925. return instance.type.__isKeepAlive && instance.__v_cache;
  1926. }
  1927. getKeepAliveCachedInstances(instance) {
  1928. return Array.from(instance.__v_cache.values()).map((vnode) => vnode.component).filter(Boolean);
  1929. }
  1930. };
  1931. //#endregion
  1932. //#region src/core/timeline/perf.ts
  1933. const markEndQueue = /* @__PURE__ */ new Map();
  1934. const PERFORMANCE_EVENT_LAYER_ID = "performance";
  1935. async function performanceMarkStart(api, app, uid, vm, type, time) {
  1936. const appRecord = await getAppRecord(app);
  1937. if (!appRecord) return;
  1938. const componentName = getInstanceName(vm) || "Unknown Component";
  1939. const groupId = devtoolsState.perfUniqueGroupId++;
  1940. const groupKey = `${uid}-${type}`;
  1941. appRecord.perfGroupIds.set(groupKey, {
  1942. groupId,
  1943. time
  1944. });
  1945. await api.addTimelineEvent({
  1946. layerId: PERFORMANCE_EVENT_LAYER_ID,
  1947. event: {
  1948. time: Date.now(),
  1949. data: {
  1950. component: componentName,
  1951. type,
  1952. measure: "start"
  1953. },
  1954. title: componentName,
  1955. subtitle: type,
  1956. groupId
  1957. }
  1958. });
  1959. if (markEndQueue.has(groupKey)) {
  1960. const { app, uid, instance, type, time } = markEndQueue.get(groupKey);
  1961. markEndQueue.delete(groupKey);
  1962. await performanceMarkEnd(api, app, uid, instance, type, time);
  1963. }
  1964. }
  1965. function performanceMarkEnd(api, app, uid, vm, type, time) {
  1966. const appRecord = getAppRecord(app);
  1967. if (!appRecord) return;
  1968. const componentName = getInstanceName(vm) || "Unknown Component";
  1969. const groupKey = `${uid}-${type}`;
  1970. const groupInfo = appRecord.perfGroupIds.get(groupKey);
  1971. if (groupInfo) {
  1972. const groupId = groupInfo.groupId;
  1973. const duration = time - groupInfo.time;
  1974. api.addTimelineEvent({
  1975. layerId: PERFORMANCE_EVENT_LAYER_ID,
  1976. event: {
  1977. time: Date.now(),
  1978. data: {
  1979. component: componentName,
  1980. type,
  1981. measure: "end",
  1982. duration: { _custom: {
  1983. type: "Duration",
  1984. value: duration,
  1985. display: `${duration} ms`
  1986. } }
  1987. },
  1988. title: componentName,
  1989. subtitle: type,
  1990. groupId
  1991. }
  1992. });
  1993. } else markEndQueue.set(groupKey, {
  1994. app,
  1995. uid,
  1996. instance: vm,
  1997. type,
  1998. time
  1999. });
  2000. }
  2001. //#endregion
  2002. //#region src/core/timeline/index.ts
  2003. const COMPONENT_EVENT_LAYER_ID = "component-event";
  2004. function setupBuiltinTimelineLayers(api) {
  2005. if (!_vue_devtools_shared.isBrowser) return;
  2006. api.addTimelineLayer({
  2007. id: "mouse",
  2008. label: "Mouse",
  2009. color: 10768815
  2010. });
  2011. [
  2012. "mousedown",
  2013. "mouseup",
  2014. "click",
  2015. "dblclick"
  2016. ].forEach((eventType) => {
  2017. if (!devtoolsState.timelineLayersState.recordingState || !devtoolsState.timelineLayersState.mouseEventEnabled) return;
  2018. window.addEventListener(eventType, async (event) => {
  2019. await api.addTimelineEvent({
  2020. layerId: "mouse",
  2021. event: {
  2022. time: Date.now(),
  2023. data: {
  2024. type: eventType,
  2025. x: event.clientX,
  2026. y: event.clientY
  2027. },
  2028. title: eventType
  2029. }
  2030. });
  2031. }, {
  2032. capture: true,
  2033. passive: true
  2034. });
  2035. });
  2036. api.addTimelineLayer({
  2037. id: "keyboard",
  2038. label: "Keyboard",
  2039. color: 8475055
  2040. });
  2041. [
  2042. "keyup",
  2043. "keydown",
  2044. "keypress"
  2045. ].forEach((eventType) => {
  2046. window.addEventListener(eventType, async (event) => {
  2047. if (!devtoolsState.timelineLayersState.recordingState || !devtoolsState.timelineLayersState.keyboardEventEnabled) return;
  2048. await api.addTimelineEvent({
  2049. layerId: "keyboard",
  2050. event: {
  2051. time: Date.now(),
  2052. data: {
  2053. type: eventType,
  2054. key: event.key,
  2055. ctrlKey: event.ctrlKey,
  2056. shiftKey: event.shiftKey,
  2057. altKey: event.altKey,
  2058. metaKey: event.metaKey
  2059. },
  2060. title: event.key
  2061. }
  2062. });
  2063. }, {
  2064. capture: true,
  2065. passive: true
  2066. });
  2067. });
  2068. api.addTimelineLayer({
  2069. id: COMPONENT_EVENT_LAYER_ID,
  2070. label: "Component events",
  2071. color: 5226637
  2072. });
  2073. hook.on.componentEmit(async (app, instance, event, params) => {
  2074. if (!devtoolsState.timelineLayersState.recordingState || !devtoolsState.timelineLayersState.componentEventEnabled) return;
  2075. const appRecord = await getAppRecord(app);
  2076. if (!appRecord) return;
  2077. const componentId = `${appRecord.id}:${instance.uid}`;
  2078. const componentName = getInstanceName(instance) || "Unknown Component";
  2079. api.addTimelineEvent({
  2080. layerId: COMPONENT_EVENT_LAYER_ID,
  2081. event: {
  2082. time: Date.now(),
  2083. data: {
  2084. component: { _custom: {
  2085. type: "component-definition",
  2086. display: componentName
  2087. } },
  2088. event,
  2089. params
  2090. },
  2091. title: event,
  2092. subtitle: `by ${componentName}`,
  2093. meta: { componentId }
  2094. }
  2095. });
  2096. });
  2097. api.addTimelineLayer({
  2098. id: "performance",
  2099. label: PERFORMANCE_EVENT_LAYER_ID,
  2100. color: 4307050
  2101. });
  2102. hook.on.perfStart((app, uid, vm, type, time) => {
  2103. if (!devtoolsState.timelineLayersState.recordingState || !devtoolsState.timelineLayersState.performanceEventEnabled) return;
  2104. performanceMarkStart(api, app, uid, vm, type, time);
  2105. });
  2106. hook.on.perfEnd((app, uid, vm, type, time) => {
  2107. if (!devtoolsState.timelineLayersState.recordingState || !devtoolsState.timelineLayersState.performanceEventEnabled) return;
  2108. performanceMarkEnd(api, app, uid, vm, type, time);
  2109. });
  2110. }
  2111. //#endregion
  2112. //#region src/core/vm/index.ts
  2113. const MAX_$VM = 10;
  2114. const $vmQueue = [];
  2115. function exposeInstanceToWindow(componentInstance) {
  2116. if (typeof window === "undefined") return;
  2117. const win = window;
  2118. if (!componentInstance) return;
  2119. win.$vm = componentInstance;
  2120. if ($vmQueue[0] !== componentInstance) {
  2121. if ($vmQueue.length >= MAX_$VM) $vmQueue.pop();
  2122. for (let i = $vmQueue.length; i > 0; i--) win[`$vm${i}`] = $vmQueue[i] = $vmQueue[i - 1];
  2123. win.$vm0 = $vmQueue[0] = componentInstance;
  2124. }
  2125. }
  2126. //#endregion
  2127. //#region src/core/plugin/components.ts
  2128. const INSPECTOR_ID = "components";
  2129. function createComponentsDevToolsPlugin(app) {
  2130. const descriptor = {
  2131. id: INSPECTOR_ID,
  2132. label: "Components",
  2133. app
  2134. };
  2135. const setupFn = (api) => {
  2136. api.addInspector({
  2137. id: INSPECTOR_ID,
  2138. label: "Components",
  2139. treeFilterPlaceholder: "Search components"
  2140. });
  2141. setupBuiltinTimelineLayers(api);
  2142. api.on.getInspectorTree(async (payload) => {
  2143. if (payload.app === app && payload.inspectorId === INSPECTOR_ID) {
  2144. const instance = getComponentInstance(activeAppRecord.value, payload.instanceId);
  2145. if (instance) payload.rootNodes = await new ComponentWalker({
  2146. filterText: payload.filter,
  2147. maxDepth: 100,
  2148. recursively: false,
  2149. api
  2150. }).getComponentTree(instance);
  2151. }
  2152. });
  2153. api.on.getInspectorState(async (payload) => {
  2154. if (payload.app === app && payload.inspectorId === INSPECTOR_ID) {
  2155. const result = getInstanceState({ instanceId: payload.nodeId });
  2156. const componentInstance = result.instance;
  2157. const _payload = {
  2158. componentInstance,
  2159. app: result.instance?.appContext.app,
  2160. instanceData: result
  2161. };
  2162. devtoolsContext.hooks.callHookWith((callbacks) => {
  2163. callbacks.forEach((cb) => cb(_payload));
  2164. }, DevToolsV6PluginAPIHookKeys.INSPECT_COMPONENT);
  2165. payload.state = result;
  2166. exposeInstanceToWindow(componentInstance);
  2167. }
  2168. });
  2169. api.on.editInspectorState(async (payload) => {
  2170. if (payload.app === app && payload.inspectorId === INSPECTOR_ID) {
  2171. editState(payload);
  2172. await api.sendInspectorState("components");
  2173. }
  2174. });
  2175. const debounceSendInspectorTree = (0, perfect_debounce.debounce)(() => {
  2176. api.sendInspectorTree(INSPECTOR_ID);
  2177. }, 120);
  2178. const debounceSendInspectorState = (0, perfect_debounce.debounce)(() => {
  2179. api.sendInspectorState(INSPECTOR_ID);
  2180. }, 120);
  2181. hook.on.componentAdded(async (app, uid, parentUid, component) => {
  2182. if (devtoolsState.highPerfModeEnabled) return;
  2183. if (app?._instance?.type?.devtools?.hide) return;
  2184. if (!app || typeof uid !== "number" && !uid || !component) return;
  2185. const id = await getComponentId({
  2186. app,
  2187. uid,
  2188. instance: component
  2189. });
  2190. const appRecord = await getAppRecord(app);
  2191. if (component) {
  2192. if (component.__VUE_DEVTOOLS_NEXT_UID__ == null) component.__VUE_DEVTOOLS_NEXT_UID__ = id;
  2193. if (!appRecord?.instanceMap.has(id)) {
  2194. appRecord?.instanceMap.set(id, component);
  2195. if (activeAppRecord.value.id === appRecord?.id) activeAppRecord.value.instanceMap = appRecord.instanceMap;
  2196. }
  2197. }
  2198. if (!appRecord) return;
  2199. debounceSendInspectorTree();
  2200. });
  2201. hook.on.componentUpdated(async (app, uid, parentUid, component) => {
  2202. if (devtoolsState.highPerfModeEnabled) return;
  2203. if (app?._instance?.type?.devtools?.hide) return;
  2204. if (!app || typeof uid !== "number" && !uid || !component) return;
  2205. const id = await getComponentId({
  2206. app,
  2207. uid,
  2208. instance: component
  2209. });
  2210. const appRecord = await getAppRecord(app);
  2211. if (component) {
  2212. if (component.__VUE_DEVTOOLS_NEXT_UID__ == null) component.__VUE_DEVTOOLS_NEXT_UID__ = id;
  2213. if (!appRecord?.instanceMap.has(id)) {
  2214. appRecord?.instanceMap.set(id, component);
  2215. if (activeAppRecord.value.id === appRecord?.id) activeAppRecord.value.instanceMap = appRecord.instanceMap;
  2216. }
  2217. }
  2218. if (!appRecord) return;
  2219. debounceSendInspectorTree();
  2220. debounceSendInspectorState();
  2221. });
  2222. hook.on.componentRemoved(async (app, uid, parentUid, component) => {
  2223. if (devtoolsState.highPerfModeEnabled) return;
  2224. if (app?._instance?.type?.devtools?.hide) return;
  2225. if (!app || typeof uid !== "number" && !uid || !component) return;
  2226. const appRecord = await getAppRecord(app);
  2227. if (!appRecord) return;
  2228. const id = await getComponentId({
  2229. app,
  2230. uid,
  2231. instance: component
  2232. });
  2233. appRecord?.instanceMap.delete(id);
  2234. if (activeAppRecord.value.id === appRecord?.id) activeAppRecord.value.instanceMap = appRecord.instanceMap;
  2235. debounceSendInspectorTree();
  2236. });
  2237. };
  2238. return [descriptor, setupFn];
  2239. }
  2240. //#endregion
  2241. //#region src/core/plugin/index.ts
  2242. _vue_devtools_shared.target.__VUE_DEVTOOLS_KIT__REGISTERED_PLUGIN_APPS__ ??= /* @__PURE__ */ new Set();
  2243. function setupDevToolsPlugin(pluginDescriptor, setupFn) {
  2244. return hook.setupDevToolsPlugin(pluginDescriptor, setupFn);
  2245. }
  2246. function callDevToolsPluginSetupFn(plugin, app) {
  2247. const [pluginDescriptor, setupFn] = plugin;
  2248. if (pluginDescriptor.app !== app) return;
  2249. const api = new DevToolsPluginAPI({
  2250. plugin: {
  2251. setupFn,
  2252. descriptor: pluginDescriptor
  2253. },
  2254. ctx: devtoolsContext
  2255. });
  2256. if (pluginDescriptor.packageName === "vuex") api.on.editInspectorState((payload) => {
  2257. api.sendInspectorState(payload.inspectorId);
  2258. });
  2259. setupFn(api);
  2260. }
  2261. function removeRegisteredPluginApp(app) {
  2262. _vue_devtools_shared.target.__VUE_DEVTOOLS_KIT__REGISTERED_PLUGIN_APPS__.delete(app);
  2263. }
  2264. function registerDevToolsPlugin(app, options) {
  2265. if (_vue_devtools_shared.target.__VUE_DEVTOOLS_KIT__REGISTERED_PLUGIN_APPS__.has(app)) return;
  2266. if (devtoolsState.highPerfModeEnabled && !options?.inspectingComponent) return;
  2267. _vue_devtools_shared.target.__VUE_DEVTOOLS_KIT__REGISTERED_PLUGIN_APPS__.add(app);
  2268. devtoolsPluginBuffer.forEach((plugin) => {
  2269. callDevToolsPluginSetupFn(plugin, app);
  2270. });
  2271. }
  2272. //#endregion
  2273. //#region src/ctx/router.ts
  2274. const ROUTER_KEY = "__VUE_DEVTOOLS_ROUTER__";
  2275. const ROUTER_INFO_KEY = "__VUE_DEVTOOLS_ROUTER_INFO__";
  2276. _vue_devtools_shared.target[ROUTER_INFO_KEY] ??= {
  2277. currentRoute: null,
  2278. routes: []
  2279. };
  2280. _vue_devtools_shared.target[ROUTER_KEY] ??= {};
  2281. const devtoolsRouterInfo = new Proxy(_vue_devtools_shared.target[ROUTER_INFO_KEY], { get(target, property) {
  2282. return _vue_devtools_shared.target[ROUTER_INFO_KEY][property];
  2283. } });
  2284. const devtoolsRouter = new Proxy(_vue_devtools_shared.target[ROUTER_KEY], { get(target, property) {
  2285. if (property === "value") return _vue_devtools_shared.target[ROUTER_KEY];
  2286. } });
  2287. //#endregion
  2288. //#region src/core/router/index.ts
  2289. function getRoutes(router) {
  2290. const routesMap = /* @__PURE__ */ new Map();
  2291. return (router?.getRoutes() || []).filter((i) => !routesMap.has(i.path) && routesMap.set(i.path, 1));
  2292. }
  2293. function filterRoutes(routes) {
  2294. return routes.map((item) => {
  2295. let { path, name, children, meta } = item;
  2296. if (children?.length) children = filterRoutes(children);
  2297. return {
  2298. path,
  2299. name,
  2300. children,
  2301. meta
  2302. };
  2303. });
  2304. }
  2305. function filterCurrentRoute(route) {
  2306. if (route) {
  2307. const { fullPath, hash, href, path, name, matched, params, query } = route;
  2308. return {
  2309. fullPath,
  2310. hash,
  2311. href,
  2312. path,
  2313. name,
  2314. params,
  2315. query,
  2316. matched: filterRoutes(matched)
  2317. };
  2318. }
  2319. return route;
  2320. }
  2321. function normalizeRouterInfo(appRecord, activeAppRecord) {
  2322. function init() {
  2323. const router = appRecord.app?.config.globalProperties.$router;
  2324. const currentRoute = filterCurrentRoute(router?.currentRoute.value);
  2325. const routes = filterRoutes(getRoutes(router));
  2326. const c = console.warn;
  2327. console.warn = () => {};
  2328. _vue_devtools_shared.target[ROUTER_INFO_KEY] = {
  2329. currentRoute: currentRoute ? (0, _vue_devtools_shared.deepClone)(currentRoute) : {},
  2330. routes: (0, _vue_devtools_shared.deepClone)(routes)
  2331. };
  2332. _vue_devtools_shared.target[ROUTER_KEY] = router;
  2333. console.warn = c;
  2334. }
  2335. init();
  2336. hook.on.componentUpdated((0, perfect_debounce.debounce)(() => {
  2337. if (activeAppRecord.value?.app !== appRecord.app) return;
  2338. init();
  2339. if (devtoolsState.highPerfModeEnabled) return;
  2340. devtoolsContext.hooks.callHook(DevToolsMessagingHookKeys.ROUTER_INFO_UPDATED, { state: _vue_devtools_shared.target[ROUTER_INFO_KEY] });
  2341. }, 200));
  2342. }
  2343. //#endregion
  2344. //#region src/ctx/api.ts
  2345. function createDevToolsApi(hooks) {
  2346. return {
  2347. async getInspectorTree(payload) {
  2348. const _payload = {
  2349. ...payload,
  2350. app: activeAppRecord.value.app,
  2351. rootNodes: []
  2352. };
  2353. await new Promise((resolve) => {
  2354. hooks.callHookWith(async (callbacks) => {
  2355. await Promise.all(callbacks.map((cb) => cb(_payload)));
  2356. resolve();
  2357. }, DevToolsV6PluginAPIHookKeys.GET_INSPECTOR_TREE);
  2358. });
  2359. return _payload.rootNodes;
  2360. },
  2361. async getInspectorState(payload) {
  2362. const _payload = {
  2363. ...payload,
  2364. app: activeAppRecord.value.app,
  2365. state: null
  2366. };
  2367. const ctx = { currentTab: `custom-inspector:${payload.inspectorId}` };
  2368. await new Promise((resolve) => {
  2369. hooks.callHookWith(async (callbacks) => {
  2370. await Promise.all(callbacks.map((cb) => cb(_payload, ctx)));
  2371. resolve();
  2372. }, DevToolsV6PluginAPIHookKeys.GET_INSPECTOR_STATE);
  2373. });
  2374. return _payload.state;
  2375. },
  2376. editInspectorState(payload) {
  2377. const stateEditor = new StateEditor();
  2378. const _payload = {
  2379. ...payload,
  2380. app: activeAppRecord.value.app,
  2381. set: (obj, path = payload.path, value = payload.state.value, cb) => {
  2382. stateEditor.set(obj, path, value, cb || stateEditor.createDefaultSetCallback(payload.state));
  2383. }
  2384. };
  2385. hooks.callHookWith((callbacks) => {
  2386. callbacks.forEach((cb) => cb(_payload));
  2387. }, DevToolsV6PluginAPIHookKeys.EDIT_INSPECTOR_STATE);
  2388. },
  2389. sendInspectorState(inspectorId) {
  2390. const inspector = getInspector(inspectorId);
  2391. hooks.callHook(DevToolsContextHookKeys.SEND_INSPECTOR_STATE, {
  2392. inspectorId,
  2393. plugin: {
  2394. descriptor: inspector.descriptor,
  2395. setupFn: () => ({})
  2396. }
  2397. });
  2398. },
  2399. inspectComponentInspector() {
  2400. return inspectComponentHighLighter();
  2401. },
  2402. cancelInspectComponentInspector() {
  2403. return cancelInspectComponentHighLighter();
  2404. },
  2405. getComponentRenderCode(id) {
  2406. const instance = getComponentInstance(activeAppRecord.value, id);
  2407. if (instance) return !(typeof instance?.type === "function") ? instance.render.toString() : instance.type.toString();
  2408. },
  2409. scrollToComponent(id) {
  2410. return scrollToComponent({ id });
  2411. },
  2412. openInEditor,
  2413. getVueInspector: getComponentInspector,
  2414. toggleApp(id, options) {
  2415. const appRecord = devtoolsAppRecords.value.find((record) => record.id === id);
  2416. if (appRecord) {
  2417. setActiveAppRecordId(id);
  2418. setActiveAppRecord(appRecord);
  2419. normalizeRouterInfo(appRecord, activeAppRecord);
  2420. callInspectorUpdatedHook();
  2421. registerDevToolsPlugin(appRecord.app, options);
  2422. }
  2423. },
  2424. inspectDOM(instanceId) {
  2425. const instance = getComponentInstance(activeAppRecord.value, instanceId);
  2426. if (instance) {
  2427. const [el] = getRootElementsFromComponentInstance(instance);
  2428. if (el) _vue_devtools_shared.target.__VUE_DEVTOOLS_INSPECT_DOM_TARGET__ = el;
  2429. }
  2430. },
  2431. updatePluginSettings(pluginId, key, value) {
  2432. setPluginSettings(pluginId, key, value);
  2433. },
  2434. getPluginSettings(pluginId) {
  2435. return {
  2436. options: getPluginSettingsOptions(pluginId),
  2437. values: getPluginSettings(pluginId)
  2438. };
  2439. }
  2440. };
  2441. }
  2442. //#endregion
  2443. //#region src/ctx/env.ts
  2444. _vue_devtools_shared.target.__VUE_DEVTOOLS_ENV__ ??= { vitePluginDetected: false };
  2445. function getDevToolsEnv() {
  2446. return _vue_devtools_shared.target.__VUE_DEVTOOLS_ENV__;
  2447. }
  2448. function setDevToolsEnv(env) {
  2449. _vue_devtools_shared.target.__VUE_DEVTOOLS_ENV__ = {
  2450. ..._vue_devtools_shared.target.__VUE_DEVTOOLS_ENV__,
  2451. ...env
  2452. };
  2453. }
  2454. //#endregion
  2455. //#region src/ctx/index.ts
  2456. const hooks = createDevToolsCtxHooks();
  2457. _vue_devtools_shared.target.__VUE_DEVTOOLS_KIT_CONTEXT__ ??= {
  2458. hooks,
  2459. get state() {
  2460. return {
  2461. ...devtoolsState,
  2462. activeAppRecordId: activeAppRecord.id,
  2463. activeAppRecord: activeAppRecord.value,
  2464. appRecords: devtoolsAppRecords.value
  2465. };
  2466. },
  2467. api: createDevToolsApi(hooks)
  2468. };
  2469. const devtoolsContext = _vue_devtools_shared.target.__VUE_DEVTOOLS_KIT_CONTEXT__;
  2470. //#endregion
  2471. //#region ../../node_modules/.pnpm/speakingurl@14.0.1/node_modules/speakingurl/lib/speakingurl.js
  2472. var require_speakingurl$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
  2473. (function(root) {
  2474. "use strict";
  2475. /**
  2476. * charMap
  2477. * @type {Object}
  2478. */
  2479. var charMap = {
  2480. "À": "A",
  2481. "Á": "A",
  2482. "Â": "A",
  2483. "Ã": "A",
  2484. "Ä": "Ae",
  2485. "Å": "A",
  2486. "Æ": "AE",
  2487. "Ç": "C",
  2488. "È": "E",
  2489. "É": "E",
  2490. "Ê": "E",
  2491. "Ë": "E",
  2492. "Ì": "I",
  2493. "Í": "I",
  2494. "Î": "I",
  2495. "Ï": "I",
  2496. "Ð": "D",
  2497. "Ñ": "N",
  2498. "Ò": "O",
  2499. "Ó": "O",
  2500. "Ô": "O",
  2501. "Õ": "O",
  2502. "Ö": "Oe",
  2503. "Ő": "O",
  2504. "Ø": "O",
  2505. "Ù": "U",
  2506. "Ú": "U",
  2507. "Û": "U",
  2508. "Ü": "Ue",
  2509. "Ű": "U",
  2510. "Ý": "Y",
  2511. "Þ": "TH",
  2512. "ß": "ss",
  2513. "à": "a",
  2514. "á": "a",
  2515. "â": "a",
  2516. "ã": "a",
  2517. "ä": "ae",
  2518. "å": "a",
  2519. "æ": "ae",
  2520. "ç": "c",
  2521. "è": "e",
  2522. "é": "e",
  2523. "ê": "e",
  2524. "ë": "e",
  2525. "ì": "i",
  2526. "í": "i",
  2527. "î": "i",
  2528. "ï": "i",
  2529. "ð": "d",
  2530. "ñ": "n",
  2531. "ò": "o",
  2532. "ó": "o",
  2533. "ô": "o",
  2534. "õ": "o",
  2535. "ö": "oe",
  2536. "ő": "o",
  2537. "ø": "o",
  2538. "ù": "u",
  2539. "ú": "u",
  2540. "û": "u",
  2541. "ü": "ue",
  2542. "ű": "u",
  2543. "ý": "y",
  2544. "þ": "th",
  2545. "ÿ": "y",
  2546. "ẞ": "SS",
  2547. "ا": "a",
  2548. "أ": "a",
  2549. "إ": "i",
  2550. "آ": "aa",
  2551. "ؤ": "u",
  2552. "ئ": "e",
  2553. "ء": "a",
  2554. "ب": "b",
  2555. "ت": "t",
  2556. "ث": "th",
  2557. "ج": "j",
  2558. "ح": "h",
  2559. "خ": "kh",
  2560. "د": "d",
  2561. "ذ": "th",
  2562. "ر": "r",
  2563. "ز": "z",
  2564. "س": "s",
  2565. "ش": "sh",
  2566. "ص": "s",
  2567. "ض": "dh",
  2568. "ط": "t",
  2569. "ظ": "z",
  2570. "ع": "a",
  2571. "غ": "gh",
  2572. "ف": "f",
  2573. "ق": "q",
  2574. "ك": "k",
  2575. "ل": "l",
  2576. "م": "m",
  2577. "ن": "n",
  2578. "ه": "h",
  2579. "و": "w",
  2580. "ي": "y",
  2581. "ى": "a",
  2582. "ة": "h",
  2583. "ﻻ": "la",
  2584. "ﻷ": "laa",
  2585. "ﻹ": "lai",
  2586. "ﻵ": "laa",
  2587. "گ": "g",
  2588. "چ": "ch",
  2589. "پ": "p",
  2590. "ژ": "zh",
  2591. "ک": "k",
  2592. "ی": "y",
  2593. "َ": "a",
  2594. "ً": "an",
  2595. "ِ": "e",
  2596. "ٍ": "en",
  2597. "ُ": "u",
  2598. "ٌ": "on",
  2599. "ْ": "",
  2600. "٠": "0",
  2601. "١": "1",
  2602. "٢": "2",
  2603. "٣": "3",
  2604. "٤": "4",
  2605. "٥": "5",
  2606. "٦": "6",
  2607. "٧": "7",
  2608. "٨": "8",
  2609. "٩": "9",
  2610. "۰": "0",
  2611. "۱": "1",
  2612. "۲": "2",
  2613. "۳": "3",
  2614. "۴": "4",
  2615. "۵": "5",
  2616. "۶": "6",
  2617. "۷": "7",
  2618. "۸": "8",
  2619. "۹": "9",
  2620. "က": "k",
  2621. "ခ": "kh",
  2622. "ဂ": "g",
  2623. "ဃ": "ga",
  2624. "င": "ng",
  2625. "စ": "s",
  2626. "ဆ": "sa",
  2627. "ဇ": "z",
  2628. "စျ": "za",
  2629. "ည": "ny",
  2630. "ဋ": "t",
  2631. "ဌ": "ta",
  2632. "ဍ": "d",
  2633. "ဎ": "da",
  2634. "ဏ": "na",
  2635. "တ": "t",
  2636. "ထ": "ta",
  2637. "ဒ": "d",
  2638. "ဓ": "da",
  2639. "န": "n",
  2640. "ပ": "p",
  2641. "ဖ": "pa",
  2642. "ဗ": "b",
  2643. "ဘ": "ba",
  2644. "မ": "m",
  2645. "ယ": "y",
  2646. "ရ": "ya",
  2647. "လ": "l",
  2648. "ဝ": "w",
  2649. "သ": "th",
  2650. "ဟ": "h",
  2651. "ဠ": "la",
  2652. "အ": "a",
  2653. "ြ": "y",
  2654. "ျ": "ya",
  2655. "ွ": "w",
  2656. "ြွ": "yw",
  2657. "ျွ": "ywa",
  2658. "ှ": "h",
  2659. "ဧ": "e",
  2660. "၏": "-e",
  2661. "ဣ": "i",
  2662. "ဤ": "-i",
  2663. "ဉ": "u",
  2664. "ဦ": "-u",
  2665. "ဩ": "aw",
  2666. "သြော": "aw",
  2667. "ဪ": "aw",
  2668. "၀": "0",
  2669. "၁": "1",
  2670. "၂": "2",
  2671. "၃": "3",
  2672. "၄": "4",
  2673. "၅": "5",
  2674. "၆": "6",
  2675. "၇": "7",
  2676. "၈": "8",
  2677. "၉": "9",
  2678. "္": "",
  2679. "့": "",
  2680. "း": "",
  2681. "č": "c",
  2682. "ď": "d",
  2683. "ě": "e",
  2684. "ň": "n",
  2685. "ř": "r",
  2686. "š": "s",
  2687. "ť": "t",
  2688. "ů": "u",
  2689. "ž": "z",
  2690. "Č": "C",
  2691. "Ď": "D",
  2692. "Ě": "E",
  2693. "Ň": "N",
  2694. "Ř": "R",
  2695. "Š": "S",
  2696. "Ť": "T",
  2697. "Ů": "U",
  2698. "Ž": "Z",
  2699. "ހ": "h",
  2700. "ށ": "sh",
  2701. "ނ": "n",
  2702. "ރ": "r",
  2703. "ބ": "b",
  2704. "ޅ": "lh",
  2705. "ކ": "k",
  2706. "އ": "a",
  2707. "ވ": "v",
  2708. "މ": "m",
  2709. "ފ": "f",
  2710. "ދ": "dh",
  2711. "ތ": "th",
  2712. "ލ": "l",
  2713. "ގ": "g",
  2714. "ޏ": "gn",
  2715. "ސ": "s",
  2716. "ޑ": "d",
  2717. "ޒ": "z",
  2718. "ޓ": "t",
  2719. "ޔ": "y",
  2720. "ޕ": "p",
  2721. "ޖ": "j",
  2722. "ޗ": "ch",
  2723. "ޘ": "tt",
  2724. "ޙ": "hh",
  2725. "ޚ": "kh",
  2726. "ޛ": "th",
  2727. "ޜ": "z",
  2728. "ޝ": "sh",
  2729. "ޞ": "s",
  2730. "ޟ": "d",
  2731. "ޠ": "t",
  2732. "ޡ": "z",
  2733. "ޢ": "a",
  2734. "ޣ": "gh",
  2735. "ޤ": "q",
  2736. "ޥ": "w",
  2737. "ަ": "a",
  2738. "ާ": "aa",
  2739. "ި": "i",
  2740. "ީ": "ee",
  2741. "ު": "u",
  2742. "ޫ": "oo",
  2743. "ެ": "e",
  2744. "ޭ": "ey",
  2745. "ޮ": "o",
  2746. "ޯ": "oa",
  2747. "ް": "",
  2748. "ა": "a",
  2749. "ბ": "b",
  2750. "გ": "g",
  2751. "დ": "d",
  2752. "ე": "e",
  2753. "ვ": "v",
  2754. "ზ": "z",
  2755. "თ": "t",
  2756. "ი": "i",
  2757. "კ": "k",
  2758. "ლ": "l",
  2759. "მ": "m",
  2760. "ნ": "n",
  2761. "ო": "o",
  2762. "პ": "p",
  2763. "ჟ": "zh",
  2764. "რ": "r",
  2765. "ს": "s",
  2766. "ტ": "t",
  2767. "უ": "u",
  2768. "ფ": "p",
  2769. "ქ": "k",
  2770. "ღ": "gh",
  2771. "ყ": "q",
  2772. "შ": "sh",
  2773. "ჩ": "ch",
  2774. "ც": "ts",
  2775. "ძ": "dz",
  2776. "წ": "ts",
  2777. "ჭ": "ch",
  2778. "ხ": "kh",
  2779. "ჯ": "j",
  2780. "ჰ": "h",
  2781. "α": "a",
  2782. "β": "v",
  2783. "γ": "g",
  2784. "δ": "d",
  2785. "ε": "e",
  2786. "ζ": "z",
  2787. "η": "i",
  2788. "θ": "th",
  2789. "ι": "i",
  2790. "κ": "k",
  2791. "λ": "l",
  2792. "μ": "m",
  2793. "ν": "n",
  2794. "ξ": "ks",
  2795. "ο": "o",
  2796. "π": "p",
  2797. "ρ": "r",
  2798. "σ": "s",
  2799. "τ": "t",
  2800. "υ": "y",
  2801. "φ": "f",
  2802. "χ": "x",
  2803. "ψ": "ps",
  2804. "ω": "o",
  2805. "ά": "a",
  2806. "έ": "e",
  2807. "ί": "i",
  2808. "ό": "o",
  2809. "ύ": "y",
  2810. "ή": "i",
  2811. "ώ": "o",
  2812. "ς": "s",
  2813. "ϊ": "i",
  2814. "ΰ": "y",
  2815. "ϋ": "y",
  2816. "ΐ": "i",
  2817. "Α": "A",
  2818. "Β": "B",
  2819. "Γ": "G",
  2820. "Δ": "D",
  2821. "Ε": "E",
  2822. "Ζ": "Z",
  2823. "Η": "I",
  2824. "Θ": "TH",
  2825. "Ι": "I",
  2826. "Κ": "K",
  2827. "Λ": "L",
  2828. "Μ": "M",
  2829. "Ν": "N",
  2830. "Ξ": "KS",
  2831. "Ο": "O",
  2832. "Π": "P",
  2833. "Ρ": "R",
  2834. "Σ": "S",
  2835. "Τ": "T",
  2836. "Υ": "Y",
  2837. "Φ": "F",
  2838. "Χ": "X",
  2839. "Ψ": "PS",
  2840. "Ω": "O",
  2841. "Ά": "A",
  2842. "Έ": "E",
  2843. "Ί": "I",
  2844. "Ό": "O",
  2845. "Ύ": "Y",
  2846. "Ή": "I",
  2847. "Ώ": "O",
  2848. "Ϊ": "I",
  2849. "Ϋ": "Y",
  2850. "ā": "a",
  2851. "ē": "e",
  2852. "ģ": "g",
  2853. "ī": "i",
  2854. "ķ": "k",
  2855. "ļ": "l",
  2856. "ņ": "n",
  2857. "ū": "u",
  2858. "Ā": "A",
  2859. "Ē": "E",
  2860. "Ģ": "G",
  2861. "Ī": "I",
  2862. "Ķ": "k",
  2863. "Ļ": "L",
  2864. "Ņ": "N",
  2865. "Ū": "U",
  2866. "Ќ": "Kj",
  2867. "ќ": "kj",
  2868. "Љ": "Lj",
  2869. "љ": "lj",
  2870. "Њ": "Nj",
  2871. "њ": "nj",
  2872. "Тс": "Ts",
  2873. "тс": "ts",
  2874. "ą": "a",
  2875. "ć": "c",
  2876. "ę": "e",
  2877. "ł": "l",
  2878. "ń": "n",
  2879. "ś": "s",
  2880. "ź": "z",
  2881. "ż": "z",
  2882. "Ą": "A",
  2883. "Ć": "C",
  2884. "Ę": "E",
  2885. "Ł": "L",
  2886. "Ń": "N",
  2887. "Ś": "S",
  2888. "Ź": "Z",
  2889. "Ż": "Z",
  2890. "Є": "Ye",
  2891. "І": "I",
  2892. "Ї": "Yi",
  2893. "Ґ": "G",
  2894. "є": "ye",
  2895. "і": "i",
  2896. "ї": "yi",
  2897. "ґ": "g",
  2898. "ă": "a",
  2899. "Ă": "A",
  2900. "ș": "s",
  2901. "Ș": "S",
  2902. "ț": "t",
  2903. "Ț": "T",
  2904. "ţ": "t",
  2905. "Ţ": "T",
  2906. "а": "a",
  2907. "б": "b",
  2908. "в": "v",
  2909. "г": "g",
  2910. "д": "d",
  2911. "е": "e",
  2912. "ё": "yo",
  2913. "ж": "zh",
  2914. "з": "z",
  2915. "и": "i",
  2916. "й": "i",
  2917. "к": "k",
  2918. "л": "l",
  2919. "м": "m",
  2920. "н": "n",
  2921. "о": "o",
  2922. "п": "p",
  2923. "р": "r",
  2924. "с": "s",
  2925. "т": "t",
  2926. "у": "u",
  2927. "ф": "f",
  2928. "х": "kh",
  2929. "ц": "c",
  2930. "ч": "ch",
  2931. "ш": "sh",
  2932. "щ": "sh",
  2933. "ъ": "",
  2934. "ы": "y",
  2935. "ь": "",
  2936. "э": "e",
  2937. "ю": "yu",
  2938. "я": "ya",
  2939. "А": "A",
  2940. "Б": "B",
  2941. "В": "V",
  2942. "Г": "G",
  2943. "Д": "D",
  2944. "Е": "E",
  2945. "Ё": "Yo",
  2946. "Ж": "Zh",
  2947. "З": "Z",
  2948. "И": "I",
  2949. "Й": "I",
  2950. "К": "K",
  2951. "Л": "L",
  2952. "М": "M",
  2953. "Н": "N",
  2954. "О": "O",
  2955. "П": "P",
  2956. "Р": "R",
  2957. "С": "S",
  2958. "Т": "T",
  2959. "У": "U",
  2960. "Ф": "F",
  2961. "Х": "Kh",
  2962. "Ц": "C",
  2963. "Ч": "Ch",
  2964. "Ш": "Sh",
  2965. "Щ": "Sh",
  2966. "Ъ": "",
  2967. "Ы": "Y",
  2968. "Ь": "",
  2969. "Э": "E",
  2970. "Ю": "Yu",
  2971. "Я": "Ya",
  2972. "ђ": "dj",
  2973. "ј": "j",
  2974. "ћ": "c",
  2975. "џ": "dz",
  2976. "Ђ": "Dj",
  2977. "Ј": "j",
  2978. "Ћ": "C",
  2979. "Џ": "Dz",
  2980. "ľ": "l",
  2981. "ĺ": "l",
  2982. "ŕ": "r",
  2983. "Ľ": "L",
  2984. "Ĺ": "L",
  2985. "Ŕ": "R",
  2986. "ş": "s",
  2987. "Ş": "S",
  2988. "ı": "i",
  2989. "İ": "I",
  2990. "ğ": "g",
  2991. "Ğ": "G",
  2992. "ả": "a",
  2993. "Ả": "A",
  2994. "ẳ": "a",
  2995. "Ẳ": "A",
  2996. "ẩ": "a",
  2997. "Ẩ": "A",
  2998. "đ": "d",
  2999. "Đ": "D",
  3000. "ẹ": "e",
  3001. "Ẹ": "E",
  3002. "ẽ": "e",
  3003. "Ẽ": "E",
  3004. "ẻ": "e",
  3005. "Ẻ": "E",
  3006. "ế": "e",
  3007. "Ế": "E",
  3008. "ề": "e",
  3009. "Ề": "E",
  3010. "ệ": "e",
  3011. "Ệ": "E",
  3012. "ễ": "e",
  3013. "Ễ": "E",
  3014. "ể": "e",
  3015. "Ể": "E",
  3016. "ỏ": "o",
  3017. "ọ": "o",
  3018. "Ọ": "o",
  3019. "ố": "o",
  3020. "Ố": "O",
  3021. "ồ": "o",
  3022. "Ồ": "O",
  3023. "ổ": "o",
  3024. "Ổ": "O",
  3025. "ộ": "o",
  3026. "Ộ": "O",
  3027. "ỗ": "o",
  3028. "Ỗ": "O",
  3029. "ơ": "o",
  3030. "Ơ": "O",
  3031. "ớ": "o",
  3032. "Ớ": "O",
  3033. "ờ": "o",
  3034. "Ờ": "O",
  3035. "ợ": "o",
  3036. "Ợ": "O",
  3037. "ỡ": "o",
  3038. "Ỡ": "O",
  3039. "Ở": "o",
  3040. "ở": "o",
  3041. "ị": "i",
  3042. "Ị": "I",
  3043. "ĩ": "i",
  3044. "Ĩ": "I",
  3045. "ỉ": "i",
  3046. "Ỉ": "i",
  3047. "ủ": "u",
  3048. "Ủ": "U",
  3049. "ụ": "u",
  3050. "Ụ": "U",
  3051. "ũ": "u",
  3052. "Ũ": "U",
  3053. "ư": "u",
  3054. "Ư": "U",
  3055. "ứ": "u",
  3056. "Ứ": "U",
  3057. "ừ": "u",
  3058. "Ừ": "U",
  3059. "ự": "u",
  3060. "Ự": "U",
  3061. "ữ": "u",
  3062. "Ữ": "U",
  3063. "ử": "u",
  3064. "Ử": "ư",
  3065. "ỷ": "y",
  3066. "Ỷ": "y",
  3067. "ỳ": "y",
  3068. "Ỳ": "Y",
  3069. "ỵ": "y",
  3070. "Ỵ": "Y",
  3071. "ỹ": "y",
  3072. "Ỹ": "Y",
  3073. "ạ": "a",
  3074. "Ạ": "A",
  3075. "ấ": "a",
  3076. "Ấ": "A",
  3077. "ầ": "a",
  3078. "Ầ": "A",
  3079. "ậ": "a",
  3080. "Ậ": "A",
  3081. "ẫ": "a",
  3082. "Ẫ": "A",
  3083. "ắ": "a",
  3084. "Ắ": "A",
  3085. "ằ": "a",
  3086. "Ằ": "A",
  3087. "ặ": "a",
  3088. "Ặ": "A",
  3089. "ẵ": "a",
  3090. "Ẵ": "A",
  3091. "⓪": "0",
  3092. "①": "1",
  3093. "②": "2",
  3094. "③": "3",
  3095. "④": "4",
  3096. "⑤": "5",
  3097. "⑥": "6",
  3098. "⑦": "7",
  3099. "⑧": "8",
  3100. "⑨": "9",
  3101. "⑩": "10",
  3102. "⑪": "11",
  3103. "⑫": "12",
  3104. "⑬": "13",
  3105. "⑭": "14",
  3106. "⑮": "15",
  3107. "⑯": "16",
  3108. "⑰": "17",
  3109. "⑱": "18",
  3110. "⑲": "18",
  3111. "⑳": "18",
  3112. "⓵": "1",
  3113. "⓶": "2",
  3114. "⓷": "3",
  3115. "⓸": "4",
  3116. "⓹": "5",
  3117. "⓺": "6",
  3118. "⓻": "7",
  3119. "⓼": "8",
  3120. "⓽": "9",
  3121. "⓾": "10",
  3122. "⓿": "0",
  3123. "⓫": "11",
  3124. "⓬": "12",
  3125. "⓭": "13",
  3126. "⓮": "14",
  3127. "⓯": "15",
  3128. "⓰": "16",
  3129. "⓱": "17",
  3130. "⓲": "18",
  3131. "⓳": "19",
  3132. "⓴": "20",
  3133. "Ⓐ": "A",
  3134. "Ⓑ": "B",
  3135. "Ⓒ": "C",
  3136. "Ⓓ": "D",
  3137. "Ⓔ": "E",
  3138. "Ⓕ": "F",
  3139. "Ⓖ": "G",
  3140. "Ⓗ": "H",
  3141. "Ⓘ": "I",
  3142. "Ⓙ": "J",
  3143. "Ⓚ": "K",
  3144. "Ⓛ": "L",
  3145. "Ⓜ": "M",
  3146. "Ⓝ": "N",
  3147. "Ⓞ": "O",
  3148. "Ⓟ": "P",
  3149. "Ⓠ": "Q",
  3150. "Ⓡ": "R",
  3151. "Ⓢ": "S",
  3152. "Ⓣ": "T",
  3153. "Ⓤ": "U",
  3154. "Ⓥ": "V",
  3155. "Ⓦ": "W",
  3156. "Ⓧ": "X",
  3157. "Ⓨ": "Y",
  3158. "Ⓩ": "Z",
  3159. "ⓐ": "a",
  3160. "ⓑ": "b",
  3161. "ⓒ": "c",
  3162. "ⓓ": "d",
  3163. "ⓔ": "e",
  3164. "ⓕ": "f",
  3165. "ⓖ": "g",
  3166. "ⓗ": "h",
  3167. "ⓘ": "i",
  3168. "ⓙ": "j",
  3169. "ⓚ": "k",
  3170. "ⓛ": "l",
  3171. "ⓜ": "m",
  3172. "ⓝ": "n",
  3173. "ⓞ": "o",
  3174. "ⓟ": "p",
  3175. "ⓠ": "q",
  3176. "ⓡ": "r",
  3177. "ⓢ": "s",
  3178. "ⓣ": "t",
  3179. "ⓤ": "u",
  3180. "ⓦ": "v",
  3181. "ⓥ": "w",
  3182. "ⓧ": "x",
  3183. "ⓨ": "y",
  3184. "ⓩ": "z",
  3185. "“": "\"",
  3186. "”": "\"",
  3187. "‘": "'",
  3188. "’": "'",
  3189. "∂": "d",
  3190. "ƒ": "f",
  3191. "™": "(TM)",
  3192. "©": "(C)",
  3193. "œ": "oe",
  3194. "Œ": "OE",
  3195. "®": "(R)",
  3196. "†": "+",
  3197. "℠": "(SM)",
  3198. "…": "...",
  3199. "˚": "o",
  3200. "º": "o",
  3201. "ª": "a",
  3202. "•": "*",
  3203. "၊": ",",
  3204. "။": ".",
  3205. "$": "USD",
  3206. "€": "EUR",
  3207. "₢": "BRN",
  3208. "₣": "FRF",
  3209. "£": "GBP",
  3210. "₤": "ITL",
  3211. "₦": "NGN",
  3212. "₧": "ESP",
  3213. "₩": "KRW",
  3214. "₪": "ILS",
  3215. "₫": "VND",
  3216. "₭": "LAK",
  3217. "₮": "MNT",
  3218. "₯": "GRD",
  3219. "₱": "ARS",
  3220. "₲": "PYG",
  3221. "₳": "ARA",
  3222. "₴": "UAH",
  3223. "₵": "GHS",
  3224. "¢": "cent",
  3225. "¥": "CNY",
  3226. "元": "CNY",
  3227. "円": "YEN",
  3228. "﷼": "IRR",
  3229. "₠": "EWE",
  3230. "฿": "THB",
  3231. "₨": "INR",
  3232. "₹": "INR",
  3233. "₰": "PF",
  3234. "₺": "TRY",
  3235. "؋": "AFN",
  3236. "₼": "AZN",
  3237. "лв": "BGN",
  3238. "៛": "KHR",
  3239. "₡": "CRC",
  3240. "₸": "KZT",
  3241. "ден": "MKD",
  3242. "zł": "PLN",
  3243. "₽": "RUB",
  3244. "₾": "GEL"
  3245. };
  3246. /**
  3247. * special look ahead character array
  3248. * These characters form with consonants to become 'single'/consonant combo
  3249. * @type [Array]
  3250. */
  3251. var lookAheadCharArray = ["်", "ް"];
  3252. /**
  3253. * diatricMap for languages where transliteration changes entirely as more diatrics are added
  3254. * @type {Object}
  3255. */
  3256. var diatricMap = {
  3257. "ာ": "a",
  3258. "ါ": "a",
  3259. "ေ": "e",
  3260. "ဲ": "e",
  3261. "ိ": "i",
  3262. "ီ": "i",
  3263. "ို": "o",
  3264. "ု": "u",
  3265. "ူ": "u",
  3266. "ေါင်": "aung",
  3267. "ော": "aw",
  3268. "ော်": "aw",
  3269. "ေါ": "aw",
  3270. "ေါ်": "aw",
  3271. "်": "်",
  3272. "က်": "et",
  3273. "ိုက်": "aik",
  3274. "ောက်": "auk",
  3275. "င်": "in",
  3276. "ိုင်": "aing",
  3277. "ောင်": "aung",
  3278. "စ်": "it",
  3279. "ည်": "i",
  3280. "တ်": "at",
  3281. "ိတ်": "eik",
  3282. "ုတ်": "ok",
  3283. "ွတ်": "ut",
  3284. "ေတ်": "it",
  3285. "ဒ်": "d",
  3286. "ိုဒ်": "ok",
  3287. "ုဒ်": "ait",
  3288. "န်": "an",
  3289. "ာန်": "an",
  3290. "ိန်": "ein",
  3291. "ုန်": "on",
  3292. "ွန်": "un",
  3293. "ပ်": "at",
  3294. "ိပ်": "eik",
  3295. "ုပ်": "ok",
  3296. "ွပ်": "ut",
  3297. "န်ုပ်": "nub",
  3298. "မ်": "an",
  3299. "ိမ်": "ein",
  3300. "ုမ်": "on",
  3301. "ွမ်": "un",
  3302. "ယ်": "e",
  3303. "ိုလ်": "ol",
  3304. "ဉ်": "in",
  3305. "ံ": "an",
  3306. "ိံ": "ein",
  3307. "ုံ": "on",
  3308. "ައް": "ah",
  3309. "ަށް": "ah"
  3310. };
  3311. /**
  3312. * langCharMap language specific characters translations
  3313. * @type {Object}
  3314. */
  3315. var langCharMap = {
  3316. "en": {},
  3317. "az": {
  3318. "ç": "c",
  3319. "ə": "e",
  3320. "ğ": "g",
  3321. "ı": "i",
  3322. "ö": "o",
  3323. "ş": "s",
  3324. "ü": "u",
  3325. "Ç": "C",
  3326. "Ə": "E",
  3327. "Ğ": "G",
  3328. "İ": "I",
  3329. "Ö": "O",
  3330. "Ş": "S",
  3331. "Ü": "U"
  3332. },
  3333. "cs": {
  3334. "č": "c",
  3335. "ď": "d",
  3336. "ě": "e",
  3337. "ň": "n",
  3338. "ř": "r",
  3339. "š": "s",
  3340. "ť": "t",
  3341. "ů": "u",
  3342. "ž": "z",
  3343. "Č": "C",
  3344. "Ď": "D",
  3345. "Ě": "E",
  3346. "Ň": "N",
  3347. "Ř": "R",
  3348. "Š": "S",
  3349. "Ť": "T",
  3350. "Ů": "U",
  3351. "Ž": "Z"
  3352. },
  3353. "fi": {
  3354. "ä": "a",
  3355. "Ä": "A",
  3356. "ö": "o",
  3357. "Ö": "O"
  3358. },
  3359. "hu": {
  3360. "ä": "a",
  3361. "Ä": "A",
  3362. "ö": "o",
  3363. "Ö": "O",
  3364. "ü": "u",
  3365. "Ü": "U",
  3366. "ű": "u",
  3367. "Ű": "U"
  3368. },
  3369. "lt": {
  3370. "ą": "a",
  3371. "č": "c",
  3372. "ę": "e",
  3373. "ė": "e",
  3374. "į": "i",
  3375. "š": "s",
  3376. "ų": "u",
  3377. "ū": "u",
  3378. "ž": "z",
  3379. "Ą": "A",
  3380. "Č": "C",
  3381. "Ę": "E",
  3382. "Ė": "E",
  3383. "Į": "I",
  3384. "Š": "S",
  3385. "Ų": "U",
  3386. "Ū": "U"
  3387. },
  3388. "lv": {
  3389. "ā": "a",
  3390. "č": "c",
  3391. "ē": "e",
  3392. "ģ": "g",
  3393. "ī": "i",
  3394. "ķ": "k",
  3395. "ļ": "l",
  3396. "ņ": "n",
  3397. "š": "s",
  3398. "ū": "u",
  3399. "ž": "z",
  3400. "Ā": "A",
  3401. "Č": "C",
  3402. "Ē": "E",
  3403. "Ģ": "G",
  3404. "Ī": "i",
  3405. "Ķ": "k",
  3406. "Ļ": "L",
  3407. "Ņ": "N",
  3408. "Š": "S",
  3409. "Ū": "u",
  3410. "Ž": "Z"
  3411. },
  3412. "pl": {
  3413. "ą": "a",
  3414. "ć": "c",
  3415. "ę": "e",
  3416. "ł": "l",
  3417. "ń": "n",
  3418. "ó": "o",
  3419. "ś": "s",
  3420. "ź": "z",
  3421. "ż": "z",
  3422. "Ą": "A",
  3423. "Ć": "C",
  3424. "Ę": "e",
  3425. "Ł": "L",
  3426. "Ń": "N",
  3427. "Ó": "O",
  3428. "Ś": "S",
  3429. "Ź": "Z",
  3430. "Ż": "Z"
  3431. },
  3432. "sv": {
  3433. "ä": "a",
  3434. "Ä": "A",
  3435. "ö": "o",
  3436. "Ö": "O"
  3437. },
  3438. "sk": {
  3439. "ä": "a",
  3440. "Ä": "A"
  3441. },
  3442. "sr": {
  3443. "љ": "lj",
  3444. "њ": "nj",
  3445. "Љ": "Lj",
  3446. "Њ": "Nj",
  3447. "đ": "dj",
  3448. "Đ": "Dj"
  3449. },
  3450. "tr": {
  3451. "Ü": "U",
  3452. "Ö": "O",
  3453. "ü": "u",
  3454. "ö": "o"
  3455. }
  3456. };
  3457. /**
  3458. * symbolMap language specific symbol translations
  3459. * translations must be transliterated already
  3460. * @type {Object}
  3461. */
  3462. var symbolMap = {
  3463. "ar": {
  3464. "∆": "delta",
  3465. "∞": "la-nihaya",
  3466. "♥": "hob",
  3467. "&": "wa",
  3468. "|": "aw",
  3469. "<": "aqal-men",
  3470. ">": "akbar-men",
  3471. "∑": "majmou",
  3472. "¤": "omla"
  3473. },
  3474. "az": {},
  3475. "ca": {
  3476. "∆": "delta",
  3477. "∞": "infinit",
  3478. "♥": "amor",
  3479. "&": "i",
  3480. "|": "o",
  3481. "<": "menys que",
  3482. ">": "mes que",
  3483. "∑": "suma dels",
  3484. "¤": "moneda"
  3485. },
  3486. "cs": {
  3487. "∆": "delta",
  3488. "∞": "nekonecno",
  3489. "♥": "laska",
  3490. "&": "a",
  3491. "|": "nebo",
  3492. "<": "mensi nez",
  3493. ">": "vetsi nez",
  3494. "∑": "soucet",
  3495. "¤": "mena"
  3496. },
  3497. "de": {
  3498. "∆": "delta",
  3499. "∞": "unendlich",
  3500. "♥": "Liebe",
  3501. "&": "und",
  3502. "|": "oder",
  3503. "<": "kleiner als",
  3504. ">": "groesser als",
  3505. "∑": "Summe von",
  3506. "¤": "Waehrung"
  3507. },
  3508. "dv": {
  3509. "∆": "delta",
  3510. "∞": "kolunulaa",
  3511. "♥": "loabi",
  3512. "&": "aai",
  3513. "|": "noonee",
  3514. "<": "ah vure kuda",
  3515. ">": "ah vure bodu",
  3516. "∑": "jumula",
  3517. "¤": "faisaa"
  3518. },
  3519. "en": {
  3520. "∆": "delta",
  3521. "∞": "infinity",
  3522. "♥": "love",
  3523. "&": "and",
  3524. "|": "or",
  3525. "<": "less than",
  3526. ">": "greater than",
  3527. "∑": "sum",
  3528. "¤": "currency"
  3529. },
  3530. "es": {
  3531. "∆": "delta",
  3532. "∞": "infinito",
  3533. "♥": "amor",
  3534. "&": "y",
  3535. "|": "u",
  3536. "<": "menos que",
  3537. ">": "mas que",
  3538. "∑": "suma de los",
  3539. "¤": "moneda"
  3540. },
  3541. "fa": {
  3542. "∆": "delta",
  3543. "∞": "bi-nahayat",
  3544. "♥": "eshgh",
  3545. "&": "va",
  3546. "|": "ya",
  3547. "<": "kamtar-az",
  3548. ">": "bishtar-az",
  3549. "∑": "majmooe",
  3550. "¤": "vahed"
  3551. },
  3552. "fi": {
  3553. "∆": "delta",
  3554. "∞": "aarettomyys",
  3555. "♥": "rakkaus",
  3556. "&": "ja",
  3557. "|": "tai",
  3558. "<": "pienempi kuin",
  3559. ">": "suurempi kuin",
  3560. "∑": "summa",
  3561. "¤": "valuutta"
  3562. },
  3563. "fr": {
  3564. "∆": "delta",
  3565. "∞": "infiniment",
  3566. "♥": "Amour",
  3567. "&": "et",
  3568. "|": "ou",
  3569. "<": "moins que",
  3570. ">": "superieure a",
  3571. "∑": "somme des",
  3572. "¤": "monnaie"
  3573. },
  3574. "ge": {
  3575. "∆": "delta",
  3576. "∞": "usasruloba",
  3577. "♥": "siqvaruli",
  3578. "&": "da",
  3579. "|": "an",
  3580. "<": "naklebi",
  3581. ">": "meti",
  3582. "∑": "jami",
  3583. "¤": "valuta"
  3584. },
  3585. "gr": {},
  3586. "hu": {
  3587. "∆": "delta",
  3588. "∞": "vegtelen",
  3589. "♥": "szerelem",
  3590. "&": "es",
  3591. "|": "vagy",
  3592. "<": "kisebb mint",
  3593. ">": "nagyobb mint",
  3594. "∑": "szumma",
  3595. "¤": "penznem"
  3596. },
  3597. "it": {
  3598. "∆": "delta",
  3599. "∞": "infinito",
  3600. "♥": "amore",
  3601. "&": "e",
  3602. "|": "o",
  3603. "<": "minore di",
  3604. ">": "maggiore di",
  3605. "∑": "somma",
  3606. "¤": "moneta"
  3607. },
  3608. "lt": {
  3609. "∆": "delta",
  3610. "∞": "begalybe",
  3611. "♥": "meile",
  3612. "&": "ir",
  3613. "|": "ar",
  3614. "<": "maziau nei",
  3615. ">": "daugiau nei",
  3616. "∑": "suma",
  3617. "¤": "valiuta"
  3618. },
  3619. "lv": {
  3620. "∆": "delta",
  3621. "∞": "bezgaliba",
  3622. "♥": "milestiba",
  3623. "&": "un",
  3624. "|": "vai",
  3625. "<": "mazak neka",
  3626. ">": "lielaks neka",
  3627. "∑": "summa",
  3628. "¤": "valuta"
  3629. },
  3630. "my": {
  3631. "∆": "kwahkhyaet",
  3632. "∞": "asaonasme",
  3633. "♥": "akhyait",
  3634. "&": "nhin",
  3635. "|": "tho",
  3636. "<": "ngethaw",
  3637. ">": "kyithaw",
  3638. "∑": "paungld",
  3639. "¤": "ngwekye"
  3640. },
  3641. "mk": {},
  3642. "nl": {
  3643. "∆": "delta",
  3644. "∞": "oneindig",
  3645. "♥": "liefde",
  3646. "&": "en",
  3647. "|": "of",
  3648. "<": "kleiner dan",
  3649. ">": "groter dan",
  3650. "∑": "som",
  3651. "¤": "valuta"
  3652. },
  3653. "pl": {
  3654. "∆": "delta",
  3655. "∞": "nieskonczonosc",
  3656. "♥": "milosc",
  3657. "&": "i",
  3658. "|": "lub",
  3659. "<": "mniejsze niz",
  3660. ">": "wieksze niz",
  3661. "∑": "suma",
  3662. "¤": "waluta"
  3663. },
  3664. "pt": {
  3665. "∆": "delta",
  3666. "∞": "infinito",
  3667. "♥": "amor",
  3668. "&": "e",
  3669. "|": "ou",
  3670. "<": "menor que",
  3671. ">": "maior que",
  3672. "∑": "soma",
  3673. "¤": "moeda"
  3674. },
  3675. "ro": {
  3676. "∆": "delta",
  3677. "∞": "infinit",
  3678. "♥": "dragoste",
  3679. "&": "si",
  3680. "|": "sau",
  3681. "<": "mai mic ca",
  3682. ">": "mai mare ca",
  3683. "∑": "suma",
  3684. "¤": "valuta"
  3685. },
  3686. "ru": {
  3687. "∆": "delta",
  3688. "∞": "beskonechno",
  3689. "♥": "lubov",
  3690. "&": "i",
  3691. "|": "ili",
  3692. "<": "menshe",
  3693. ">": "bolshe",
  3694. "∑": "summa",
  3695. "¤": "valjuta"
  3696. },
  3697. "sk": {
  3698. "∆": "delta",
  3699. "∞": "nekonecno",
  3700. "♥": "laska",
  3701. "&": "a",
  3702. "|": "alebo",
  3703. "<": "menej ako",
  3704. ">": "viac ako",
  3705. "∑": "sucet",
  3706. "¤": "mena"
  3707. },
  3708. "sr": {},
  3709. "tr": {
  3710. "∆": "delta",
  3711. "∞": "sonsuzluk",
  3712. "♥": "ask",
  3713. "&": "ve",
  3714. "|": "veya",
  3715. "<": "kucuktur",
  3716. ">": "buyuktur",
  3717. "∑": "toplam",
  3718. "¤": "para birimi"
  3719. },
  3720. "uk": {
  3721. "∆": "delta",
  3722. "∞": "bezkinechnist",
  3723. "♥": "lubov",
  3724. "&": "i",
  3725. "|": "abo",
  3726. "<": "menshe",
  3727. ">": "bilshe",
  3728. "∑": "suma",
  3729. "¤": "valjuta"
  3730. },
  3731. "vn": {
  3732. "∆": "delta",
  3733. "∞": "vo cuc",
  3734. "♥": "yeu",
  3735. "&": "va",
  3736. "|": "hoac",
  3737. "<": "nho hon",
  3738. ">": "lon hon",
  3739. "∑": "tong",
  3740. "¤": "tien te"
  3741. }
  3742. };
  3743. var uricChars = [
  3744. ";",
  3745. "?",
  3746. ":",
  3747. "@",
  3748. "&",
  3749. "=",
  3750. "+",
  3751. "$",
  3752. ",",
  3753. "/"
  3754. ].join("");
  3755. var uricNoSlashChars = [
  3756. ";",
  3757. "?",
  3758. ":",
  3759. "@",
  3760. "&",
  3761. "=",
  3762. "+",
  3763. "$",
  3764. ","
  3765. ].join("");
  3766. var markChars = [
  3767. ".",
  3768. "!",
  3769. "~",
  3770. "*",
  3771. "'",
  3772. "(",
  3773. ")"
  3774. ].join("");
  3775. /**
  3776. * getSlug
  3777. * @param {string} input input string
  3778. * @param {object|string} opts config object or separator string/char
  3779. * @api public
  3780. * @return {string} sluggified string
  3781. */
  3782. var getSlug = function getSlug(input, opts) {
  3783. var separator = "-";
  3784. var result = "";
  3785. var diatricString = "";
  3786. var convertSymbols = true;
  3787. var customReplacements = {};
  3788. var maintainCase;
  3789. var titleCase;
  3790. var truncate;
  3791. var uricFlag;
  3792. var uricNoSlashFlag;
  3793. var markFlag;
  3794. var symbol;
  3795. var langChar;
  3796. var lucky;
  3797. var i;
  3798. var ch;
  3799. var l;
  3800. var lastCharWasSymbol;
  3801. var lastCharWasDiatric;
  3802. var allowedChars = "";
  3803. if (typeof input !== "string") return "";
  3804. if (typeof opts === "string") separator = opts;
  3805. symbol = symbolMap.en;
  3806. langChar = langCharMap.en;
  3807. if (typeof opts === "object") {
  3808. maintainCase = opts.maintainCase || false;
  3809. customReplacements = opts.custom && typeof opts.custom === "object" ? opts.custom : customReplacements;
  3810. truncate = +opts.truncate > 1 && opts.truncate || false;
  3811. uricFlag = opts.uric || false;
  3812. uricNoSlashFlag = opts.uricNoSlash || false;
  3813. markFlag = opts.mark || false;
  3814. convertSymbols = opts.symbols === false || opts.lang === false ? false : true;
  3815. separator = opts.separator || separator;
  3816. if (uricFlag) allowedChars += uricChars;
  3817. if (uricNoSlashFlag) allowedChars += uricNoSlashChars;
  3818. if (markFlag) allowedChars += markChars;
  3819. symbol = opts.lang && symbolMap[opts.lang] && convertSymbols ? symbolMap[opts.lang] : convertSymbols ? symbolMap.en : {};
  3820. langChar = opts.lang && langCharMap[opts.lang] ? langCharMap[opts.lang] : opts.lang === false || opts.lang === true ? {} : langCharMap.en;
  3821. if (opts.titleCase && typeof opts.titleCase.length === "number" && Array.prototype.toString.call(opts.titleCase)) {
  3822. opts.titleCase.forEach(function(v) {
  3823. customReplacements[v + ""] = v + "";
  3824. });
  3825. titleCase = true;
  3826. } else titleCase = !!opts.titleCase;
  3827. if (opts.custom && typeof opts.custom.length === "number" && Array.prototype.toString.call(opts.custom)) opts.custom.forEach(function(v) {
  3828. customReplacements[v + ""] = v + "";
  3829. });
  3830. Object.keys(customReplacements).forEach(function(v) {
  3831. var r;
  3832. if (v.length > 1) r = new RegExp("\\b" + escapeChars(v) + "\\b", "gi");
  3833. else r = new RegExp(escapeChars(v), "gi");
  3834. input = input.replace(r, customReplacements[v]);
  3835. });
  3836. for (ch in customReplacements) allowedChars += ch;
  3837. }
  3838. allowedChars += separator;
  3839. allowedChars = escapeChars(allowedChars);
  3840. input = input.replace(/(^\s+|\s+$)/g, "");
  3841. lastCharWasSymbol = false;
  3842. lastCharWasDiatric = false;
  3843. for (i = 0, l = input.length; i < l; i++) {
  3844. ch = input[i];
  3845. if (isReplacedCustomChar(ch, customReplacements)) lastCharWasSymbol = false;
  3846. else if (langChar[ch]) {
  3847. ch = lastCharWasSymbol && langChar[ch].match(/[A-Za-z0-9]/) ? " " + langChar[ch] : langChar[ch];
  3848. lastCharWasSymbol = false;
  3849. } else if (ch in charMap) {
  3850. if (i + 1 < l && lookAheadCharArray.indexOf(input[i + 1]) >= 0) {
  3851. diatricString += ch;
  3852. ch = "";
  3853. } else if (lastCharWasDiatric === true) {
  3854. ch = diatricMap[diatricString] + charMap[ch];
  3855. diatricString = "";
  3856. } else ch = lastCharWasSymbol && charMap[ch].match(/[A-Za-z0-9]/) ? " " + charMap[ch] : charMap[ch];
  3857. lastCharWasSymbol = false;
  3858. lastCharWasDiatric = false;
  3859. } else if (ch in diatricMap) {
  3860. diatricString += ch;
  3861. ch = "";
  3862. if (i === l - 1) ch = diatricMap[diatricString];
  3863. lastCharWasDiatric = true;
  3864. } else if (symbol[ch] && !(uricFlag && uricChars.indexOf(ch) !== -1) && !(uricNoSlashFlag && uricNoSlashChars.indexOf(ch) !== -1)) {
  3865. ch = lastCharWasSymbol || result.substr(-1).match(/[A-Za-z0-9]/) ? separator + symbol[ch] : symbol[ch];
  3866. ch += input[i + 1] !== void 0 && input[i + 1].match(/[A-Za-z0-9]/) ? separator : "";
  3867. lastCharWasSymbol = true;
  3868. } else {
  3869. if (lastCharWasDiatric === true) {
  3870. ch = diatricMap[diatricString] + ch;
  3871. diatricString = "";
  3872. lastCharWasDiatric = false;
  3873. } else if (lastCharWasSymbol && (/[A-Za-z0-9]/.test(ch) || result.substr(-1).match(/A-Za-z0-9]/))) ch = " " + ch;
  3874. lastCharWasSymbol = false;
  3875. }
  3876. result += ch.replace(new RegExp("[^\\w\\s" + allowedChars + "_-]", "g"), separator);
  3877. }
  3878. if (titleCase) result = result.replace(/(\w)(\S*)/g, function(_, i, r) {
  3879. var j = i.toUpperCase() + (r !== null ? r : "");
  3880. return Object.keys(customReplacements).indexOf(j.toLowerCase()) < 0 ? j : j.toLowerCase();
  3881. });
  3882. result = result.replace(/\s+/g, separator).replace(new RegExp("\\" + separator + "+", "g"), separator).replace(new RegExp("(^\\" + separator + "+|\\" + separator + "+$)", "g"), "");
  3883. if (truncate && result.length > truncate) {
  3884. lucky = result.charAt(truncate) === separator;
  3885. result = result.slice(0, truncate);
  3886. if (!lucky) result = result.slice(0, result.lastIndexOf(separator));
  3887. }
  3888. if (!maintainCase && !titleCase) result = result.toLowerCase();
  3889. return result;
  3890. };
  3891. /**
  3892. * createSlug curried(opts)(input)
  3893. * @param {object|string} opts config object or input string
  3894. * @return {Function} function getSlugWithConfig()
  3895. **/
  3896. var createSlug = function createSlug(opts) {
  3897. /**
  3898. * getSlugWithConfig
  3899. * @param {string} input string
  3900. * @return {string} slug string
  3901. */
  3902. return function getSlugWithConfig(input) {
  3903. return getSlug(input, opts);
  3904. };
  3905. };
  3906. /**
  3907. * escape Chars
  3908. * @param {string} input string
  3909. */
  3910. var escapeChars = function escapeChars(input) {
  3911. return input.replace(/[-\\^$*+?.()|[\]{}\/]/g, "\\$&");
  3912. };
  3913. /**
  3914. * check if the char is an already converted char from custom list
  3915. * @param {char} ch character to check
  3916. * @param {object} customReplacements custom translation map
  3917. */
  3918. var isReplacedCustomChar = function(ch, customReplacements) {
  3919. for (var c in customReplacements) if (customReplacements[c] === ch) return true;
  3920. };
  3921. if (typeof module !== "undefined" && module.exports) {
  3922. module.exports = getSlug;
  3923. module.exports.createSlug = createSlug;
  3924. } else if (typeof define !== "undefined" && define.amd) define([], function() {
  3925. return getSlug;
  3926. });
  3927. else try {
  3928. if (root.getSlug || root.createSlug) throw "speakingurl: globals exists /(getSlug|createSlug)/";
  3929. else {
  3930. root.getSlug = getSlug;
  3931. root.createSlug = createSlug;
  3932. }
  3933. } catch (e) {}
  3934. })(exports);
  3935. }));
  3936. //#endregion
  3937. //#region src/core/app/index.ts
  3938. var import_speakingurl = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
  3939. module.exports = require_speakingurl$1();
  3940. })))(), 1);
  3941. const appRecordInfo = _vue_devtools_shared.target.__VUE_DEVTOOLS_NEXT_APP_RECORD_INFO__ ??= {
  3942. id: 0,
  3943. appIds: /* @__PURE__ */ new Set()
  3944. };
  3945. function getAppRecordName(app, fallbackName) {
  3946. return app?._component?.name || `App ${fallbackName}`;
  3947. }
  3948. function getAppRootInstance(app) {
  3949. if (app._instance) return app._instance;
  3950. else if (app._container?._vnode?.component) return app._container?._vnode?.component;
  3951. }
  3952. function removeAppRecordId(app) {
  3953. const id = app.__VUE_DEVTOOLS_NEXT_APP_RECORD_ID__;
  3954. if (id != null) {
  3955. appRecordInfo.appIds.delete(id);
  3956. appRecordInfo.id--;
  3957. }
  3958. }
  3959. function getAppRecordId(app, defaultId) {
  3960. if (app.__VUE_DEVTOOLS_NEXT_APP_RECORD_ID__ != null) return app.__VUE_DEVTOOLS_NEXT_APP_RECORD_ID__;
  3961. let id = defaultId ?? (appRecordInfo.id++).toString();
  3962. if (defaultId && appRecordInfo.appIds.has(id)) {
  3963. let count = 1;
  3964. while (appRecordInfo.appIds.has(`${defaultId}_${count}`)) count++;
  3965. id = `${defaultId}_${count}`;
  3966. }
  3967. appRecordInfo.appIds.add(id);
  3968. app.__VUE_DEVTOOLS_NEXT_APP_RECORD_ID__ = id;
  3969. return id;
  3970. }
  3971. function createAppRecord(app, types) {
  3972. const rootInstance = getAppRootInstance(app);
  3973. if (rootInstance) {
  3974. appRecordInfo.id++;
  3975. const name = getAppRecordName(app, appRecordInfo.id.toString());
  3976. const id = getAppRecordId(app, (0, import_speakingurl.default)(name));
  3977. const [el] = getRootElementsFromComponentInstance(rootInstance);
  3978. const record = {
  3979. id,
  3980. name,
  3981. types,
  3982. instanceMap: /* @__PURE__ */ new Map(),
  3983. perfGroupIds: /* @__PURE__ */ new Map(),
  3984. rootInstance,
  3985. iframe: _vue_devtools_shared.isBrowser && document !== el?.ownerDocument ? el?.ownerDocument?.location?.pathname : void 0
  3986. };
  3987. app.__VUE_DEVTOOLS_NEXT_APP_RECORD__ = record;
  3988. const rootId = `${record.id}:root`;
  3989. record.instanceMap.set(rootId, record.rootInstance);
  3990. record.rootInstance.__VUE_DEVTOOLS_NEXT_UID__ = rootId;
  3991. return record;
  3992. } else return {};
  3993. }
  3994. //#endregion
  3995. //#region src/core/iframe/index.ts
  3996. function detectIframeApp(target, inIframe = false) {
  3997. if (inIframe) {
  3998. function sendEventToParent(cb) {
  3999. try {
  4000. const hook = window.parent.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  4001. if (hook) cb(hook);
  4002. } catch (e) {}
  4003. }
  4004. const hook = {
  4005. id: "vue-devtools-next",
  4006. devtoolsVersion: "7.0",
  4007. on: (event, cb) => {
  4008. sendEventToParent((hook) => {
  4009. hook.on(event, cb);
  4010. });
  4011. },
  4012. once: (event, cb) => {
  4013. sendEventToParent((hook) => {
  4014. hook.once(event, cb);
  4015. });
  4016. },
  4017. off: (event, cb) => {
  4018. sendEventToParent((hook) => {
  4019. hook.off(event, cb);
  4020. });
  4021. },
  4022. emit: (event, ...payload) => {
  4023. sendEventToParent((hook) => {
  4024. hook.emit(event, ...payload);
  4025. });
  4026. }
  4027. };
  4028. Object.defineProperty(target, "__VUE_DEVTOOLS_GLOBAL_HOOK__", {
  4029. get() {
  4030. return hook;
  4031. },
  4032. configurable: true
  4033. });
  4034. }
  4035. function injectVueHookToIframe(iframe) {
  4036. if (iframe.__vdevtools__injected) return;
  4037. try {
  4038. iframe.__vdevtools__injected = true;
  4039. const inject = () => {
  4040. try {
  4041. iframe.contentWindow.__VUE_DEVTOOLS_IFRAME__ = iframe;
  4042. const script = iframe.contentDocument.createElement("script");
  4043. script.textContent = `;(${detectIframeApp.toString()})(window, true)`;
  4044. iframe.contentDocument.documentElement.appendChild(script);
  4045. script.parentNode.removeChild(script);
  4046. } catch (e) {}
  4047. };
  4048. inject();
  4049. iframe.addEventListener("load", () => inject());
  4050. } catch (e) {}
  4051. }
  4052. function injectVueHookToIframes() {
  4053. if (typeof window === "undefined") return;
  4054. const iframes = Array.from(document.querySelectorAll("iframe:not([data-vue-devtools-ignore])"));
  4055. for (const iframe of iframes) injectVueHookToIframe(iframe);
  4056. }
  4057. injectVueHookToIframes();
  4058. let iframeAppChecks = 0;
  4059. const iframeAppCheckTimer = setInterval(() => {
  4060. injectVueHookToIframes();
  4061. iframeAppChecks++;
  4062. if (iframeAppChecks >= 5) clearInterval(iframeAppCheckTimer);
  4063. }, 1e3);
  4064. }
  4065. //#endregion
  4066. //#region src/core/index.ts
  4067. function initDevTools() {
  4068. detectIframeApp(_vue_devtools_shared.target);
  4069. updateDevToolsState({ vitePluginDetected: getDevToolsEnv().vitePluginDetected });
  4070. const isDevToolsNext = _vue_devtools_shared.target.__VUE_DEVTOOLS_GLOBAL_HOOK__?.id === "vue-devtools-next";
  4071. if (_vue_devtools_shared.target.__VUE_DEVTOOLS_GLOBAL_HOOK__ && isDevToolsNext) return;
  4072. const _devtoolsHook = createDevToolsHook();
  4073. if (_vue_devtools_shared.target.__VUE_DEVTOOLS_HOOK_REPLAY__) try {
  4074. _vue_devtools_shared.target.__VUE_DEVTOOLS_HOOK_REPLAY__.forEach((cb) => cb(_devtoolsHook));
  4075. _vue_devtools_shared.target.__VUE_DEVTOOLS_HOOK_REPLAY__ = [];
  4076. } catch (e) {
  4077. console.error("[vue-devtools] Error during hook replay", e);
  4078. }
  4079. _devtoolsHook.once("init", (Vue) => {
  4080. _vue_devtools_shared.target.__VUE_DEVTOOLS_VUE2_APP_DETECTED__ = true;
  4081. console.log("%c[_____Vue DevTools v7 log_____]", "color: red; font-bold: 600; font-size: 16px;");
  4082. console.log("%cVue DevTools v7 detected in your Vue2 project. v7 only supports Vue3 and will not work.", "font-bold: 500; font-size: 14px;");
  4083. const legacyChromeUrl = "https://chromewebstore.google.com/detail/vuejs-devtools/iaajmlceplecbljialhhkmedjlpdblhp";
  4084. const legacyFirefoxUrl = "https://addons.mozilla.org/firefox/addon/vue-js-devtools-v6-legacy";
  4085. console.log(`%cThe legacy version of chrome extension that supports both Vue 2 and Vue 3 has been moved to %c ${legacyChromeUrl}`, "font-size: 14px;", "text-decoration: underline; cursor: pointer;font-size: 14px;");
  4086. console.log(`%cThe legacy version of firefox extension that supports both Vue 2 and Vue 3 has been moved to %c ${legacyFirefoxUrl}`, "font-size: 14px;", "text-decoration: underline; cursor: pointer;font-size: 14px;");
  4087. console.log("%cPlease install and enable only the legacy version for your Vue2 app.", "font-bold: 500; font-size: 14px;");
  4088. console.log("%c[_____Vue DevTools v7 log_____]", "color: red; font-bold: 600; font-size: 16px;");
  4089. });
  4090. hook.on.setupDevtoolsPlugin((pluginDescriptor, setupFn) => {
  4091. addDevToolsPluginToBuffer(pluginDescriptor, setupFn);
  4092. const { app } = activeAppRecord ?? {};
  4093. if (pluginDescriptor.settings) initPluginSettings(pluginDescriptor.id, pluginDescriptor.settings);
  4094. if (!app) return;
  4095. callDevToolsPluginSetupFn([pluginDescriptor, setupFn], app);
  4096. });
  4097. onLegacyDevToolsPluginApiAvailable(() => {
  4098. devtoolsPluginBuffer.filter(([item]) => item.id !== "components").forEach(([pluginDescriptor, setupFn]) => {
  4099. _devtoolsHook.emit(DevToolsHooks.SETUP_DEVTOOLS_PLUGIN, pluginDescriptor, setupFn, { target: "legacy" });
  4100. });
  4101. });
  4102. hook.on.vueAppInit(async (app, version, types) => {
  4103. const normalizedAppRecord = {
  4104. ...createAppRecord(app, types),
  4105. app,
  4106. version
  4107. };
  4108. addDevToolsAppRecord(normalizedAppRecord);
  4109. if (devtoolsAppRecords.value.length === 1) {
  4110. setActiveAppRecord(normalizedAppRecord);
  4111. setActiveAppRecordId(normalizedAppRecord.id);
  4112. normalizeRouterInfo(normalizedAppRecord, activeAppRecord);
  4113. registerDevToolsPlugin(normalizedAppRecord.app);
  4114. }
  4115. setupDevToolsPlugin(...createComponentsDevToolsPlugin(normalizedAppRecord.app));
  4116. updateDevToolsState({ connected: true });
  4117. _devtoolsHook.apps.push(app);
  4118. });
  4119. hook.on.vueAppUnmount(async (app) => {
  4120. const activeRecords = devtoolsAppRecords.value.filter((appRecord) => appRecord.app !== app);
  4121. if (activeRecords.length === 0) updateDevToolsState({ connected: false });
  4122. removeDevToolsAppRecord(app);
  4123. removeAppRecordId(app);
  4124. if (activeAppRecord.value.app === app) {
  4125. setActiveAppRecord(activeRecords[0]);
  4126. devtoolsContext.hooks.callHook(DevToolsMessagingHookKeys.SEND_ACTIVE_APP_UNMOUNTED_TO_CLIENT);
  4127. }
  4128. _vue_devtools_shared.target.__VUE_DEVTOOLS_GLOBAL_HOOK__.apps.splice(_vue_devtools_shared.target.__VUE_DEVTOOLS_GLOBAL_HOOK__.apps.indexOf(app), 1);
  4129. removeRegisteredPluginApp(app);
  4130. });
  4131. subscribeDevToolsHook(_devtoolsHook);
  4132. if (!_vue_devtools_shared.target.__VUE_DEVTOOLS_GLOBAL_HOOK__) Object.defineProperty(_vue_devtools_shared.target, "__VUE_DEVTOOLS_GLOBAL_HOOK__", {
  4133. get() {
  4134. return _devtoolsHook;
  4135. },
  4136. configurable: true
  4137. });
  4138. else if (!_vue_devtools_shared.isNuxtApp) Object.assign(__VUE_DEVTOOLS_GLOBAL_HOOK__, _devtoolsHook);
  4139. }
  4140. function onDevToolsClientConnected(fn) {
  4141. return new Promise((resolve) => {
  4142. if (devtoolsState.connected && devtoolsState.clientConnected) {
  4143. fn();
  4144. resolve();
  4145. return;
  4146. }
  4147. devtoolsContext.hooks.hook(DevToolsMessagingHookKeys.DEVTOOLS_CONNECTED_UPDATED, ({ state }) => {
  4148. if (state.connected && state.clientConnected) {
  4149. fn();
  4150. resolve();
  4151. }
  4152. });
  4153. });
  4154. }
  4155. //#endregion
  4156. //#region src/core/high-perf-mode/index.ts
  4157. function toggleHighPerfMode(state) {
  4158. devtoolsState.highPerfModeEnabled = state ?? !devtoolsState.highPerfModeEnabled;
  4159. if (!state && activeAppRecord.value) registerDevToolsPlugin(activeAppRecord.value.app);
  4160. }
  4161. //#endregion
  4162. //#region src/core/component/state/reviver.ts
  4163. function reviveSet(val) {
  4164. const result = /* @__PURE__ */ new Set();
  4165. const list = val._custom.value;
  4166. for (let i = 0; i < list.length; i++) {
  4167. const value = list[i];
  4168. result.add(revive(value));
  4169. }
  4170. return result;
  4171. }
  4172. function reviveMap(val) {
  4173. const result = /* @__PURE__ */ new Map();
  4174. const list = val._custom.value;
  4175. for (let i = 0; i < list.length; i++) {
  4176. const { key, value } = list[i];
  4177. result.set(key, revive(value));
  4178. }
  4179. return result;
  4180. }
  4181. function revive(val) {
  4182. if (val === "__vue_devtool_undefined__") return;
  4183. else if (val === "__vue_devtool_infinity__") return Number.POSITIVE_INFINITY;
  4184. else if (val === "__vue_devtool_negative_infinity__") return Number.NEGATIVE_INFINITY;
  4185. else if (val === "__vue_devtool_nan__") return NaN;
  4186. else if (val && val._custom) {
  4187. const { _custom: custom } = val;
  4188. if (custom.type === "component") return activeAppRecord.value.instanceMap.get(custom.id);
  4189. else if (custom.type === "map") return reviveMap(val);
  4190. else if (custom.type === "set") return reviveSet(val);
  4191. else if (custom.type === "bigint") return BigInt(custom.value);
  4192. else return revive(custom.value);
  4193. } else if (symbolRE.test(val)) {
  4194. const [, string] = symbolRE.exec(val);
  4195. return Symbol.for(string);
  4196. } else if (specialTypeRE.test(val)) {
  4197. const [, type, string, , details] = specialTypeRE.exec(val);
  4198. const result = new _vue_devtools_shared.target[type](string);
  4199. if (type === "Error" && details) result.stack = details;
  4200. return result;
  4201. } else return val;
  4202. }
  4203. function reviver(key, value) {
  4204. return revive(value);
  4205. }
  4206. //#endregion
  4207. //#region src/core/component/state/format.ts
  4208. function getInspectorStateValueType(value, raw = true) {
  4209. const type = typeof value;
  4210. if (value == null || value === "__vue_devtool_undefined__" || value === "undefined") return "null";
  4211. else if (type === "boolean" || type === "number" || value === "__vue_devtool_infinity__" || value === "__vue_devtool_negative_infinity__" || value === "__vue_devtool_nan__") return "literal";
  4212. else if (value?._custom) if (raw || value._custom.display != null || value._custom.displayText != null) return "custom";
  4213. else return getInspectorStateValueType(value._custom.value);
  4214. else if (typeof value === "string") {
  4215. const typeMatch = specialTypeRE.exec(value);
  4216. if (typeMatch) {
  4217. const [, type] = typeMatch;
  4218. return `native ${type}`;
  4219. } else return "string";
  4220. } else if (Array.isArray(value) || value?._isArray) return "array";
  4221. else if (isPlainObject(value)) return "plain-object";
  4222. else return "unknown";
  4223. }
  4224. function formatInspectorStateValue(value, quotes = false, options) {
  4225. const { customClass } = options ?? {};
  4226. let result;
  4227. const type = getInspectorStateValueType(value, false);
  4228. if (type !== "custom" && value?._custom) value = value._custom.value;
  4229. if (result = internalStateTokenToString(value)) return result;
  4230. else if (type === "custom") return value._custom.value?._custom && formatInspectorStateValue(value._custom.value, quotes, options) || value._custom.displayText || value._custom.display;
  4231. else if (type === "array") return `Array[${value.length}]`;
  4232. else if (type === "plain-object") return `Object${Object.keys(value).length ? "" : " (empty)"}`;
  4233. else if (type?.includes("native")) return escape(specialTypeRE.exec(value)?.[2]);
  4234. else if (typeof value === "string") {
  4235. const typeMatch = value.match(rawTypeRE);
  4236. if (typeMatch) value = escapeString(typeMatch[1]);
  4237. else if (quotes) value = `<span>"</span>${customClass?.string ? `<span class=${customClass.string}>${escapeString(value)}</span>` : escapeString(value)}<span>"</span>`;
  4238. else value = customClass?.string ? `<span class="${customClass?.string ?? ""}">${escapeString(value)}</span>` : escapeString(value);
  4239. }
  4240. return value;
  4241. }
  4242. function escapeString(value) {
  4243. return escape(value).replace(/ /g, "&nbsp;").replace(/\n/g, "<span>\\n</span>");
  4244. }
  4245. function getRaw(value) {
  4246. let customType;
  4247. const isCustom = getInspectorStateValueType(value) === "custom";
  4248. let inherit = {};
  4249. if (isCustom) {
  4250. const data = value;
  4251. const customValue = data._custom?.value;
  4252. const currentCustomType = data._custom?.type;
  4253. const nestedCustom = typeof customValue === "object" && customValue !== null && "_custom" in customValue ? getRaw(customValue) : {
  4254. inherit: void 0,
  4255. value: void 0,
  4256. customType: void 0
  4257. };
  4258. inherit = nestedCustom.inherit || data._custom?.fields || {};
  4259. value = nestedCustom.value || customValue;
  4260. customType = nestedCustom.customType || currentCustomType;
  4261. }
  4262. if (value && value._isArray) value = value.items;
  4263. return {
  4264. value,
  4265. inherit,
  4266. customType
  4267. };
  4268. }
  4269. function toEdit(value, customType) {
  4270. if (customType === "bigint") return value;
  4271. if (customType === "date") return value;
  4272. return replaceTokenToString(JSON.stringify(value));
  4273. }
  4274. function toSubmit(value, customType) {
  4275. if (customType === "bigint") return BigInt(value);
  4276. if (customType === "date") return new Date(value);
  4277. return JSON.parse(replaceStringToToken(value), reviver);
  4278. }
  4279. //#endregion
  4280. //#region src/core/devtools-client/detected.ts
  4281. function updateDevToolsClientDetected(params) {
  4282. devtoolsState.devtoolsClientDetected = {
  4283. ...devtoolsState.devtoolsClientDetected,
  4284. ...params
  4285. };
  4286. toggleHighPerfMode(!Object.values(devtoolsState.devtoolsClientDetected).some(Boolean));
  4287. }
  4288. _vue_devtools_shared.target.__VUE_DEVTOOLS_UPDATE_CLIENT_DETECTED__ ??= updateDevToolsClientDetected;
  4289. //#endregion
  4290. //#region ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/double-indexed-kv.js
  4291. var DoubleIndexedKV = class {
  4292. constructor() {
  4293. this.keyToValue = /* @__PURE__ */ new Map();
  4294. this.valueToKey = /* @__PURE__ */ new Map();
  4295. }
  4296. set(key, value) {
  4297. this.keyToValue.set(key, value);
  4298. this.valueToKey.set(value, key);
  4299. }
  4300. getByKey(key) {
  4301. return this.keyToValue.get(key);
  4302. }
  4303. getByValue(value) {
  4304. return this.valueToKey.get(value);
  4305. }
  4306. clear() {
  4307. this.keyToValue.clear();
  4308. this.valueToKey.clear();
  4309. }
  4310. };
  4311. //#endregion
  4312. //#region ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/registry.js
  4313. var Registry = class {
  4314. constructor(generateIdentifier) {
  4315. this.generateIdentifier = generateIdentifier;
  4316. this.kv = new DoubleIndexedKV();
  4317. }
  4318. register(value, identifier) {
  4319. if (this.kv.getByValue(value)) return;
  4320. if (!identifier) identifier = this.generateIdentifier(value);
  4321. this.kv.set(identifier, value);
  4322. }
  4323. clear() {
  4324. this.kv.clear();
  4325. }
  4326. getIdentifier(value) {
  4327. return this.kv.getByValue(value);
  4328. }
  4329. getValue(identifier) {
  4330. return this.kv.getByKey(identifier);
  4331. }
  4332. };
  4333. //#endregion
  4334. //#region ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/class-registry.js
  4335. var ClassRegistry = class extends Registry {
  4336. constructor() {
  4337. super((c) => c.name);
  4338. this.classToAllowedProps = /* @__PURE__ */ new Map();
  4339. }
  4340. register(value, options) {
  4341. if (typeof options === "object") {
  4342. if (options.allowProps) this.classToAllowedProps.set(value, options.allowProps);
  4343. super.register(value, options.identifier);
  4344. } else super.register(value, options);
  4345. }
  4346. getAllowedProps(value) {
  4347. return this.classToAllowedProps.get(value);
  4348. }
  4349. };
  4350. //#endregion
  4351. //#region ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/util.js
  4352. function valuesOfObj(record) {
  4353. if ("values" in Object) return Object.values(record);
  4354. const values = [];
  4355. for (const key in record) if (record.hasOwnProperty(key)) values.push(record[key]);
  4356. return values;
  4357. }
  4358. function find(record, predicate) {
  4359. const values = valuesOfObj(record);
  4360. if ("find" in values) return values.find(predicate);
  4361. const valuesNotNever = values;
  4362. for (let i = 0; i < valuesNotNever.length; i++) {
  4363. const value = valuesNotNever[i];
  4364. if (predicate(value)) return value;
  4365. }
  4366. }
  4367. function forEach(record, run) {
  4368. Object.entries(record).forEach(([key, value]) => run(value, key));
  4369. }
  4370. function includes(arr, value) {
  4371. return arr.indexOf(value) !== -1;
  4372. }
  4373. function findArr(record, predicate) {
  4374. for (let i = 0; i < record.length; i++) {
  4375. const value = record[i];
  4376. if (predicate(value)) return value;
  4377. }
  4378. }
  4379. //#endregion
  4380. //#region ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/custom-transformer-registry.js
  4381. var CustomTransformerRegistry = class {
  4382. constructor() {
  4383. this.transfomers = {};
  4384. }
  4385. register(transformer) {
  4386. this.transfomers[transformer.name] = transformer;
  4387. }
  4388. findApplicable(v) {
  4389. return find(this.transfomers, (transformer) => transformer.isApplicable(v));
  4390. }
  4391. findByName(name) {
  4392. return this.transfomers[name];
  4393. }
  4394. };
  4395. //#endregion
  4396. //#region ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/is.js
  4397. const getType$1 = (payload) => Object.prototype.toString.call(payload).slice(8, -1);
  4398. const isUndefined$1 = (payload) => typeof payload === "undefined";
  4399. const isNull$1 = (payload) => payload === null;
  4400. const isPlainObject$2 = (payload) => {
  4401. if (typeof payload !== "object" || payload === null) return false;
  4402. if (payload === Object.prototype) return false;
  4403. if (Object.getPrototypeOf(payload) === null) return true;
  4404. return Object.getPrototypeOf(payload) === Object.prototype;
  4405. };
  4406. const isEmptyObject = (payload) => isPlainObject$2(payload) && Object.keys(payload).length === 0;
  4407. const isArray$2 = (payload) => Array.isArray(payload);
  4408. const isString = (payload) => typeof payload === "string";
  4409. const isNumber = (payload) => typeof payload === "number" && !isNaN(payload);
  4410. const isBoolean = (payload) => typeof payload === "boolean";
  4411. const isRegExp = (payload) => payload instanceof RegExp;
  4412. const isMap = (payload) => payload instanceof Map;
  4413. const isSet = (payload) => payload instanceof Set;
  4414. const isSymbol = (payload) => getType$1(payload) === "Symbol";
  4415. const isDate = (payload) => payload instanceof Date && !isNaN(payload.valueOf());
  4416. const isError = (payload) => payload instanceof Error;
  4417. const isNaNValue = (payload) => typeof payload === "number" && isNaN(payload);
  4418. const isPrimitive = (payload) => isBoolean(payload) || isNull$1(payload) || isUndefined$1(payload) || isNumber(payload) || isString(payload) || isSymbol(payload);
  4419. const isBigint = (payload) => typeof payload === "bigint";
  4420. const isInfinite = (payload) => payload === Infinity || payload === -Infinity;
  4421. const isTypedArray = (payload) => ArrayBuffer.isView(payload) && !(payload instanceof DataView);
  4422. const isURL = (payload) => payload instanceof URL;
  4423. //#endregion
  4424. //#region ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/pathstringifier.js
  4425. const escapeKey = (key) => key.replace(/\./g, "\\.");
  4426. const stringifyPath = (path) => path.map(String).map(escapeKey).join(".");
  4427. const parsePath = (string) => {
  4428. const result = [];
  4429. let segment = "";
  4430. for (let i = 0; i < string.length; i++) {
  4431. let char = string.charAt(i);
  4432. if (char === "\\" && string.charAt(i + 1) === ".") {
  4433. segment += ".";
  4434. i++;
  4435. continue;
  4436. }
  4437. if (char === ".") {
  4438. result.push(segment);
  4439. segment = "";
  4440. continue;
  4441. }
  4442. segment += char;
  4443. }
  4444. const lastSegment = segment;
  4445. result.push(lastSegment);
  4446. return result;
  4447. };
  4448. //#endregion
  4449. //#region ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/transformer.js
  4450. function simpleTransformation(isApplicable, annotation, transform, untransform) {
  4451. return {
  4452. isApplicable,
  4453. annotation,
  4454. transform,
  4455. untransform
  4456. };
  4457. }
  4458. const simpleRules = [
  4459. simpleTransformation(isUndefined$1, "undefined", () => null, () => void 0),
  4460. simpleTransformation(isBigint, "bigint", (v) => v.toString(), (v) => {
  4461. if (typeof BigInt !== "undefined") return BigInt(v);
  4462. console.error("Please add a BigInt polyfill.");
  4463. return v;
  4464. }),
  4465. simpleTransformation(isDate, "Date", (v) => v.toISOString(), (v) => new Date(v)),
  4466. simpleTransformation(isError, "Error", (v, superJson) => {
  4467. const baseError = {
  4468. name: v.name,
  4469. message: v.message
  4470. };
  4471. superJson.allowedErrorProps.forEach((prop) => {
  4472. baseError[prop] = v[prop];
  4473. });
  4474. return baseError;
  4475. }, (v, superJson) => {
  4476. const e = new Error(v.message);
  4477. e.name = v.name;
  4478. e.stack = v.stack;
  4479. superJson.allowedErrorProps.forEach((prop) => {
  4480. e[prop] = v[prop];
  4481. });
  4482. return e;
  4483. }),
  4484. simpleTransformation(isRegExp, "regexp", (v) => "" + v, (regex) => {
  4485. const body = regex.slice(1, regex.lastIndexOf("/"));
  4486. const flags = regex.slice(regex.lastIndexOf("/") + 1);
  4487. return new RegExp(body, flags);
  4488. }),
  4489. simpleTransformation(isSet, "set", (v) => [...v.values()], (v) => new Set(v)),
  4490. simpleTransformation(isMap, "map", (v) => [...v.entries()], (v) => new Map(v)),
  4491. simpleTransformation((v) => isNaNValue(v) || isInfinite(v), "number", (v) => {
  4492. if (isNaNValue(v)) return "NaN";
  4493. if (v > 0) return "Infinity";
  4494. else return "-Infinity";
  4495. }, Number),
  4496. simpleTransformation((v) => v === 0 && 1 / v === -Infinity, "number", () => {
  4497. return "-0";
  4498. }, Number),
  4499. simpleTransformation(isURL, "URL", (v) => v.toString(), (v) => new URL(v))
  4500. ];
  4501. function compositeTransformation(isApplicable, annotation, transform, untransform) {
  4502. return {
  4503. isApplicable,
  4504. annotation,
  4505. transform,
  4506. untransform
  4507. };
  4508. }
  4509. const symbolRule = compositeTransformation((s, superJson) => {
  4510. if (isSymbol(s)) return !!superJson.symbolRegistry.getIdentifier(s);
  4511. return false;
  4512. }, (s, superJson) => {
  4513. return ["symbol", superJson.symbolRegistry.getIdentifier(s)];
  4514. }, (v) => v.description, (_, a, superJson) => {
  4515. const value = superJson.symbolRegistry.getValue(a[1]);
  4516. if (!value) throw new Error("Trying to deserialize unknown symbol");
  4517. return value;
  4518. });
  4519. const constructorToName = [
  4520. Int8Array,
  4521. Uint8Array,
  4522. Int16Array,
  4523. Uint16Array,
  4524. Int32Array,
  4525. Uint32Array,
  4526. Float32Array,
  4527. Float64Array,
  4528. Uint8ClampedArray
  4529. ].reduce((obj, ctor) => {
  4530. obj[ctor.name] = ctor;
  4531. return obj;
  4532. }, {});
  4533. const typedArrayRule = compositeTransformation(isTypedArray, (v) => ["typed-array", v.constructor.name], (v) => [...v], (v, a) => {
  4534. const ctor = constructorToName[a[1]];
  4535. if (!ctor) throw new Error("Trying to deserialize unknown typed array");
  4536. return new ctor(v);
  4537. });
  4538. function isInstanceOfRegisteredClass(potentialClass, superJson) {
  4539. if (potentialClass?.constructor) return !!superJson.classRegistry.getIdentifier(potentialClass.constructor);
  4540. return false;
  4541. }
  4542. const classRule = compositeTransformation(isInstanceOfRegisteredClass, (clazz, superJson) => {
  4543. return ["class", superJson.classRegistry.getIdentifier(clazz.constructor)];
  4544. }, (clazz, superJson) => {
  4545. const allowedProps = superJson.classRegistry.getAllowedProps(clazz.constructor);
  4546. if (!allowedProps) return { ...clazz };
  4547. const result = {};
  4548. allowedProps.forEach((prop) => {
  4549. result[prop] = clazz[prop];
  4550. });
  4551. return result;
  4552. }, (v, a, superJson) => {
  4553. const clazz = superJson.classRegistry.getValue(a[1]);
  4554. if (!clazz) throw new Error(`Trying to deserialize unknown class '${a[1]}' - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564`);
  4555. return Object.assign(Object.create(clazz.prototype), v);
  4556. });
  4557. const customRule = compositeTransformation((value, superJson) => {
  4558. return !!superJson.customTransformerRegistry.findApplicable(value);
  4559. }, (value, superJson) => {
  4560. return ["custom", superJson.customTransformerRegistry.findApplicable(value).name];
  4561. }, (value, superJson) => {
  4562. return superJson.customTransformerRegistry.findApplicable(value).serialize(value);
  4563. }, (v, a, superJson) => {
  4564. const transformer = superJson.customTransformerRegistry.findByName(a[1]);
  4565. if (!transformer) throw new Error("Trying to deserialize unknown custom value");
  4566. return transformer.deserialize(v);
  4567. });
  4568. const compositeRules = [
  4569. classRule,
  4570. symbolRule,
  4571. customRule,
  4572. typedArrayRule
  4573. ];
  4574. const transformValue = (value, superJson) => {
  4575. const applicableCompositeRule = findArr(compositeRules, (rule) => rule.isApplicable(value, superJson));
  4576. if (applicableCompositeRule) return {
  4577. value: applicableCompositeRule.transform(value, superJson),
  4578. type: applicableCompositeRule.annotation(value, superJson)
  4579. };
  4580. const applicableSimpleRule = findArr(simpleRules, (rule) => rule.isApplicable(value, superJson));
  4581. if (applicableSimpleRule) return {
  4582. value: applicableSimpleRule.transform(value, superJson),
  4583. type: applicableSimpleRule.annotation
  4584. };
  4585. };
  4586. const simpleRulesByAnnotation = {};
  4587. simpleRules.forEach((rule) => {
  4588. simpleRulesByAnnotation[rule.annotation] = rule;
  4589. });
  4590. const untransformValue = (json, type, superJson) => {
  4591. if (isArray$2(type)) switch (type[0]) {
  4592. case "symbol": return symbolRule.untransform(json, type, superJson);
  4593. case "class": return classRule.untransform(json, type, superJson);
  4594. case "custom": return customRule.untransform(json, type, superJson);
  4595. case "typed-array": return typedArrayRule.untransform(json, type, superJson);
  4596. default: throw new Error("Unknown transformation: " + type);
  4597. }
  4598. else {
  4599. const transformation = simpleRulesByAnnotation[type];
  4600. if (!transformation) throw new Error("Unknown transformation: " + type);
  4601. return transformation.untransform(json, superJson);
  4602. }
  4603. };
  4604. //#endregion
  4605. //#region ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/accessDeep.js
  4606. const getNthKey = (value, n) => {
  4607. if (n > value.size) throw new Error("index out of bounds");
  4608. const keys = value.keys();
  4609. while (n > 0) {
  4610. keys.next();
  4611. n--;
  4612. }
  4613. return keys.next().value;
  4614. };
  4615. function validatePath(path) {
  4616. if (includes(path, "__proto__")) throw new Error("__proto__ is not allowed as a property");
  4617. if (includes(path, "prototype")) throw new Error("prototype is not allowed as a property");
  4618. if (includes(path, "constructor")) throw new Error("constructor is not allowed as a property");
  4619. }
  4620. const getDeep = (object, path) => {
  4621. validatePath(path);
  4622. for (let i = 0; i < path.length; i++) {
  4623. const key = path[i];
  4624. if (isSet(object)) object = getNthKey(object, +key);
  4625. else if (isMap(object)) {
  4626. const row = +key;
  4627. const type = +path[++i] === 0 ? "key" : "value";
  4628. const keyOfRow = getNthKey(object, row);
  4629. switch (type) {
  4630. case "key":
  4631. object = keyOfRow;
  4632. break;
  4633. case "value":
  4634. object = object.get(keyOfRow);
  4635. break;
  4636. }
  4637. } else object = object[key];
  4638. }
  4639. return object;
  4640. };
  4641. const setDeep = (object, path, mapper) => {
  4642. validatePath(path);
  4643. if (path.length === 0) return mapper(object);
  4644. let parent = object;
  4645. for (let i = 0; i < path.length - 1; i++) {
  4646. const key = path[i];
  4647. if (isArray$2(parent)) {
  4648. const index = +key;
  4649. parent = parent[index];
  4650. } else if (isPlainObject$2(parent)) parent = parent[key];
  4651. else if (isSet(parent)) {
  4652. const row = +key;
  4653. parent = getNthKey(parent, row);
  4654. } else if (isMap(parent)) {
  4655. if (i === path.length - 2) break;
  4656. const row = +key;
  4657. const type = +path[++i] === 0 ? "key" : "value";
  4658. const keyOfRow = getNthKey(parent, row);
  4659. switch (type) {
  4660. case "key":
  4661. parent = keyOfRow;
  4662. break;
  4663. case "value":
  4664. parent = parent.get(keyOfRow);
  4665. break;
  4666. }
  4667. }
  4668. }
  4669. const lastKey = path[path.length - 1];
  4670. if (isArray$2(parent)) parent[+lastKey] = mapper(parent[+lastKey]);
  4671. else if (isPlainObject$2(parent)) parent[lastKey] = mapper(parent[lastKey]);
  4672. if (isSet(parent)) {
  4673. const oldValue = getNthKey(parent, +lastKey);
  4674. const newValue = mapper(oldValue);
  4675. if (oldValue !== newValue) {
  4676. parent.delete(oldValue);
  4677. parent.add(newValue);
  4678. }
  4679. }
  4680. if (isMap(parent)) {
  4681. const row = +path[path.length - 2];
  4682. const keyToRow = getNthKey(parent, row);
  4683. switch (+lastKey === 0 ? "key" : "value") {
  4684. case "key": {
  4685. const newKey = mapper(keyToRow);
  4686. parent.set(newKey, parent.get(keyToRow));
  4687. if (newKey !== keyToRow) parent.delete(keyToRow);
  4688. break;
  4689. }
  4690. case "value":
  4691. parent.set(keyToRow, mapper(parent.get(keyToRow)));
  4692. break;
  4693. }
  4694. }
  4695. return object;
  4696. };
  4697. //#endregion
  4698. //#region ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/plainer.js
  4699. function traverse(tree, walker, origin = []) {
  4700. if (!tree) return;
  4701. if (!isArray$2(tree)) {
  4702. forEach(tree, (subtree, key) => traverse(subtree, walker, [...origin, ...parsePath(key)]));
  4703. return;
  4704. }
  4705. const [nodeValue, children] = tree;
  4706. if (children) forEach(children, (child, key) => {
  4707. traverse(child, walker, [...origin, ...parsePath(key)]);
  4708. });
  4709. walker(nodeValue, origin);
  4710. }
  4711. function applyValueAnnotations(plain, annotations, superJson) {
  4712. traverse(annotations, (type, path) => {
  4713. plain = setDeep(plain, path, (v) => untransformValue(v, type, superJson));
  4714. });
  4715. return plain;
  4716. }
  4717. function applyReferentialEqualityAnnotations(plain, annotations) {
  4718. function apply(identicalPaths, path) {
  4719. const object = getDeep(plain, parsePath(path));
  4720. identicalPaths.map(parsePath).forEach((identicalObjectPath) => {
  4721. plain = setDeep(plain, identicalObjectPath, () => object);
  4722. });
  4723. }
  4724. if (isArray$2(annotations)) {
  4725. const [root, other] = annotations;
  4726. root.forEach((identicalPath) => {
  4727. plain = setDeep(plain, parsePath(identicalPath), () => plain);
  4728. });
  4729. if (other) forEach(other, apply);
  4730. } else forEach(annotations, apply);
  4731. return plain;
  4732. }
  4733. const isDeep = (object, superJson) => isPlainObject$2(object) || isArray$2(object) || isMap(object) || isSet(object) || isInstanceOfRegisteredClass(object, superJson);
  4734. function addIdentity(object, path, identities) {
  4735. const existingSet = identities.get(object);
  4736. if (existingSet) existingSet.push(path);
  4737. else identities.set(object, [path]);
  4738. }
  4739. function generateReferentialEqualityAnnotations(identitites, dedupe) {
  4740. const result = {};
  4741. let rootEqualityPaths = void 0;
  4742. identitites.forEach((paths) => {
  4743. if (paths.length <= 1) return;
  4744. if (!dedupe) paths = paths.map((path) => path.map(String)).sort((a, b) => a.length - b.length);
  4745. const [representativePath, ...identicalPaths] = paths;
  4746. if (representativePath.length === 0) rootEqualityPaths = identicalPaths.map(stringifyPath);
  4747. else result[stringifyPath(representativePath)] = identicalPaths.map(stringifyPath);
  4748. });
  4749. if (rootEqualityPaths) if (isEmptyObject(result)) return [rootEqualityPaths];
  4750. else return [rootEqualityPaths, result];
  4751. else return isEmptyObject(result) ? void 0 : result;
  4752. }
  4753. const walker = (object, identities, superJson, dedupe, path = [], objectsInThisPath = [], seenObjects = /* @__PURE__ */ new Map()) => {
  4754. const primitive = isPrimitive(object);
  4755. if (!primitive) {
  4756. addIdentity(object, path, identities);
  4757. const seen = seenObjects.get(object);
  4758. if (seen) return dedupe ? { transformedValue: null } : seen;
  4759. }
  4760. if (!isDeep(object, superJson)) {
  4761. const transformed = transformValue(object, superJson);
  4762. const result = transformed ? {
  4763. transformedValue: transformed.value,
  4764. annotations: [transformed.type]
  4765. } : { transformedValue: object };
  4766. if (!primitive) seenObjects.set(object, result);
  4767. return result;
  4768. }
  4769. if (includes(objectsInThisPath, object)) return { transformedValue: null };
  4770. const transformationResult = transformValue(object, superJson);
  4771. const transformed = transformationResult?.value ?? object;
  4772. const transformedValue = isArray$2(transformed) ? [] : {};
  4773. const innerAnnotations = {};
  4774. forEach(transformed, (value, index) => {
  4775. if (index === "__proto__" || index === "constructor" || index === "prototype") throw new Error(`Detected property ${index}. This is a prototype pollution risk, please remove it from your object.`);
  4776. const recursiveResult = walker(value, identities, superJson, dedupe, [...path, index], [...objectsInThisPath, object], seenObjects);
  4777. transformedValue[index] = recursiveResult.transformedValue;
  4778. if (isArray$2(recursiveResult.annotations)) innerAnnotations[index] = recursiveResult.annotations;
  4779. else if (isPlainObject$2(recursiveResult.annotations)) forEach(recursiveResult.annotations, (tree, key) => {
  4780. innerAnnotations[escapeKey(index) + "." + key] = tree;
  4781. });
  4782. });
  4783. const result = isEmptyObject(innerAnnotations) ? {
  4784. transformedValue,
  4785. annotations: !!transformationResult ? [transformationResult.type] : void 0
  4786. } : {
  4787. transformedValue,
  4788. annotations: !!transformationResult ? [transformationResult.type, innerAnnotations] : innerAnnotations
  4789. };
  4790. if (!primitive) seenObjects.set(object, result);
  4791. return result;
  4792. };
  4793. //#endregion
  4794. //#region ../../node_modules/.pnpm/is-what@4.1.16/node_modules/is-what/dist/index.js
  4795. function getType(payload) {
  4796. return Object.prototype.toString.call(payload).slice(8, -1);
  4797. }
  4798. function isArray$1(payload) {
  4799. return getType(payload) === "Array";
  4800. }
  4801. function isPlainObject$1(payload) {
  4802. if (getType(payload) !== "Object") return false;
  4803. const prototype = Object.getPrototypeOf(payload);
  4804. return !!prototype && prototype.constructor === Object && prototype === Object.prototype;
  4805. }
  4806. function isNull(payload) {
  4807. return getType(payload) === "Null";
  4808. }
  4809. function isOneOf(a, b, c, d, e) {
  4810. return (value) => a(value) || b(value) || !!c && c(value) || !!d && d(value) || !!e && e(value);
  4811. }
  4812. function isUndefined(payload) {
  4813. return getType(payload) === "Undefined";
  4814. }
  4815. isOneOf(isNull, isUndefined);
  4816. //#endregion
  4817. //#region ../../node_modules/.pnpm/copy-anything@3.0.5/node_modules/copy-anything/dist/index.js
  4818. function assignProp(carry, key, newVal, originalObject, includeNonenumerable) {
  4819. const propType = {}.propertyIsEnumerable.call(originalObject, key) ? "enumerable" : "nonenumerable";
  4820. if (propType === "enumerable") carry[key] = newVal;
  4821. if (includeNonenumerable && propType === "nonenumerable") Object.defineProperty(carry, key, {
  4822. value: newVal,
  4823. enumerable: false,
  4824. writable: true,
  4825. configurable: true
  4826. });
  4827. }
  4828. function copy(target, options = {}) {
  4829. if (isArray$1(target)) return target.map((item) => copy(item, options));
  4830. if (!isPlainObject$1(target)) return target;
  4831. const props = Object.getOwnPropertyNames(target);
  4832. const symbols = Object.getOwnPropertySymbols(target);
  4833. return [...props, ...symbols].reduce((carry, key) => {
  4834. if (isArray$1(options.props) && !options.props.includes(key)) return carry;
  4835. const val = target[key];
  4836. assignProp(carry, key, copy(val, options), target, options.nonenumerable);
  4837. return carry;
  4838. }, {});
  4839. }
  4840. //#endregion
  4841. //#region ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/index.js
  4842. var SuperJSON = class {
  4843. /**
  4844. * @param dedupeReferentialEqualities If true, SuperJSON will make sure only one instance of referentially equal objects are serialized and the rest are replaced with `null`.
  4845. */
  4846. constructor({ dedupe = false } = {}) {
  4847. this.classRegistry = new ClassRegistry();
  4848. this.symbolRegistry = new Registry((s) => s.description ?? "");
  4849. this.customTransformerRegistry = new CustomTransformerRegistry();
  4850. this.allowedErrorProps = [];
  4851. this.dedupe = dedupe;
  4852. }
  4853. serialize(object) {
  4854. const identities = /* @__PURE__ */ new Map();
  4855. const output = walker(object, identities, this, this.dedupe);
  4856. const res = { json: output.transformedValue };
  4857. if (output.annotations) res.meta = {
  4858. ...res.meta,
  4859. values: output.annotations
  4860. };
  4861. const equalityAnnotations = generateReferentialEqualityAnnotations(identities, this.dedupe);
  4862. if (equalityAnnotations) res.meta = {
  4863. ...res.meta,
  4864. referentialEqualities: equalityAnnotations
  4865. };
  4866. return res;
  4867. }
  4868. deserialize(payload) {
  4869. const { json, meta } = payload;
  4870. let result = copy(json);
  4871. if (meta?.values) result = applyValueAnnotations(result, meta.values, this);
  4872. if (meta?.referentialEqualities) result = applyReferentialEqualityAnnotations(result, meta.referentialEqualities);
  4873. return result;
  4874. }
  4875. stringify(object) {
  4876. return JSON.stringify(this.serialize(object));
  4877. }
  4878. parse(string) {
  4879. return this.deserialize(JSON.parse(string));
  4880. }
  4881. registerClass(v, options) {
  4882. this.classRegistry.register(v, options);
  4883. }
  4884. registerSymbol(v, identifier) {
  4885. this.symbolRegistry.register(v, identifier);
  4886. }
  4887. registerCustom(transformer, name) {
  4888. this.customTransformerRegistry.register({
  4889. name,
  4890. ...transformer
  4891. });
  4892. }
  4893. allowErrorProps(...props) {
  4894. this.allowedErrorProps.push(...props);
  4895. }
  4896. };
  4897. SuperJSON.defaultInstance = new SuperJSON();
  4898. SuperJSON.serialize = SuperJSON.defaultInstance.serialize.bind(SuperJSON.defaultInstance);
  4899. SuperJSON.deserialize = SuperJSON.defaultInstance.deserialize.bind(SuperJSON.defaultInstance);
  4900. SuperJSON.stringify = SuperJSON.defaultInstance.stringify.bind(SuperJSON.defaultInstance);
  4901. SuperJSON.parse = SuperJSON.defaultInstance.parse.bind(SuperJSON.defaultInstance);
  4902. SuperJSON.registerClass = SuperJSON.defaultInstance.registerClass.bind(SuperJSON.defaultInstance);
  4903. SuperJSON.registerSymbol = SuperJSON.defaultInstance.registerSymbol.bind(SuperJSON.defaultInstance);
  4904. SuperJSON.registerCustom = SuperJSON.defaultInstance.registerCustom.bind(SuperJSON.defaultInstance);
  4905. SuperJSON.allowErrorProps = SuperJSON.defaultInstance.allowErrorProps.bind(SuperJSON.defaultInstance);
  4906. SuperJSON.serialize;
  4907. SuperJSON.deserialize;
  4908. SuperJSON.stringify;
  4909. SuperJSON.parse;
  4910. SuperJSON.registerClass;
  4911. SuperJSON.registerCustom;
  4912. SuperJSON.registerSymbol;
  4913. SuperJSON.allowErrorProps;
  4914. //#endregion
  4915. //#region src/messaging/presets/broadcast-channel/context.ts
  4916. const __DEVTOOLS_KIT_BROADCAST_MESSAGING_EVENT_KEY = "__devtools-kit-broadcast-messaging-event-key__";
  4917. //#endregion
  4918. //#region src/messaging/presets/broadcast-channel/index.ts
  4919. const BROADCAST_CHANNEL_NAME = "__devtools-kit:broadcast-channel__";
  4920. function createBroadcastChannel() {
  4921. const channel = new BroadcastChannel(BROADCAST_CHANNEL_NAME);
  4922. return {
  4923. post: (data) => {
  4924. channel.postMessage(SuperJSON.stringify({
  4925. event: __DEVTOOLS_KIT_BROADCAST_MESSAGING_EVENT_KEY,
  4926. data
  4927. }));
  4928. },
  4929. on: (handler) => {
  4930. channel.onmessage = (event) => {
  4931. const parsed = SuperJSON.parse(event.data);
  4932. if (parsed.event === "__devtools-kit-broadcast-messaging-event-key__") handler(parsed.data);
  4933. };
  4934. }
  4935. };
  4936. }
  4937. //#endregion
  4938. //#region src/messaging/presets/electron/context.ts
  4939. const __ELECTRON_CLIENT_CONTEXT__ = "electron:client-context";
  4940. const __ELECTRON_RPOXY_CONTEXT__ = "electron:proxy-context";
  4941. const __ELECTRON_SERVER_CONTEXT__ = "electron:server-context";
  4942. const __DEVTOOLS_KIT_ELECTRON_MESSAGING_EVENT_KEY__ = {
  4943. CLIENT_TO_PROXY: "client->proxy",
  4944. PROXY_TO_CLIENT: "proxy->client",
  4945. PROXY_TO_SERVER: "proxy->server",
  4946. SERVER_TO_PROXY: "server->proxy"
  4947. };
  4948. function getElectronClientContext() {
  4949. return _vue_devtools_shared.target[__ELECTRON_CLIENT_CONTEXT__];
  4950. }
  4951. function setElectronClientContext(context) {
  4952. _vue_devtools_shared.target[__ELECTRON_CLIENT_CONTEXT__] = context;
  4953. }
  4954. function getElectronProxyContext() {
  4955. return _vue_devtools_shared.target[__ELECTRON_RPOXY_CONTEXT__];
  4956. }
  4957. function setElectronProxyContext(context) {
  4958. _vue_devtools_shared.target[__ELECTRON_RPOXY_CONTEXT__] = context;
  4959. }
  4960. function getElectronServerContext() {
  4961. return _vue_devtools_shared.target[__ELECTRON_SERVER_CONTEXT__];
  4962. }
  4963. function setElectronServerContext(context) {
  4964. _vue_devtools_shared.target[__ELECTRON_SERVER_CONTEXT__] = context;
  4965. }
  4966. //#endregion
  4967. //#region src/messaging/presets/electron/client.ts
  4968. function createElectronClientChannel() {
  4969. const socket = getElectronClientContext();
  4970. return {
  4971. post: (data) => {
  4972. socket.emit(__DEVTOOLS_KIT_ELECTRON_MESSAGING_EVENT_KEY__.CLIENT_TO_PROXY, SuperJSON.stringify(data));
  4973. },
  4974. on: (handler) => {
  4975. socket.on(__DEVTOOLS_KIT_ELECTRON_MESSAGING_EVENT_KEY__.PROXY_TO_CLIENT, (e) => {
  4976. handler(SuperJSON.parse(e));
  4977. });
  4978. }
  4979. };
  4980. }
  4981. //#endregion
  4982. //#region src/messaging/presets/electron/proxy.ts
  4983. function createElectronProxyChannel() {
  4984. const socket = getElectronProxyContext();
  4985. return {
  4986. post: (data) => {},
  4987. on: (handler) => {
  4988. socket.on(__DEVTOOLS_KIT_ELECTRON_MESSAGING_EVENT_KEY__.SERVER_TO_PROXY, (data) => {
  4989. socket.broadcast.emit(__DEVTOOLS_KIT_ELECTRON_MESSAGING_EVENT_KEY__.PROXY_TO_CLIENT, data);
  4990. });
  4991. socket.on(__DEVTOOLS_KIT_ELECTRON_MESSAGING_EVENT_KEY__.CLIENT_TO_PROXY, (data) => {
  4992. socket.broadcast.emit(__DEVTOOLS_KIT_ELECTRON_MESSAGING_EVENT_KEY__.PROXY_TO_SERVER, data);
  4993. });
  4994. }
  4995. };
  4996. }
  4997. //#endregion
  4998. //#region src/messaging/presets/electron/server.ts
  4999. function createElectronServerChannel() {
  5000. const socket = getElectronServerContext();
  5001. return {
  5002. post: (data) => {
  5003. socket.emit(__DEVTOOLS_KIT_ELECTRON_MESSAGING_EVENT_KEY__.SERVER_TO_PROXY, SuperJSON.stringify(data));
  5004. },
  5005. on: (handler) => {
  5006. socket.on(__DEVTOOLS_KIT_ELECTRON_MESSAGING_EVENT_KEY__.PROXY_TO_SERVER, (data) => {
  5007. handler(SuperJSON.parse(data));
  5008. });
  5009. }
  5010. };
  5011. }
  5012. //#endregion
  5013. //#region src/messaging/presets/extension/context.ts
  5014. const __EXTENSION_CLIENT_CONTEXT__ = "electron:client-context";
  5015. const __DEVTOOLS_KIT_EXTENSION_MESSAGING_EVENT_KEY__ = {
  5016. CLIENT_TO_PROXY: "client->proxy",
  5017. PROXY_TO_CLIENT: "proxy->client",
  5018. PROXY_TO_SERVER: "proxy->server",
  5019. SERVER_TO_PROXY: "server->proxy"
  5020. };
  5021. function getExtensionClientContext() {
  5022. return _vue_devtools_shared.target[__EXTENSION_CLIENT_CONTEXT__];
  5023. }
  5024. function setExtensionClientContext(context) {
  5025. _vue_devtools_shared.target[__EXTENSION_CLIENT_CONTEXT__] = context;
  5026. }
  5027. //#endregion
  5028. //#region src/messaging/presets/extension/client.ts
  5029. function createExtensionClientChannel() {
  5030. let disconnected = false;
  5031. let port = null;
  5032. let reconnectTimer = null;
  5033. let onMessageHandler = null;
  5034. function connect() {
  5035. try {
  5036. clearTimeout(reconnectTimer);
  5037. port = chrome.runtime.connect({ name: `${chrome.devtools.inspectedWindow.tabId}` });
  5038. setExtensionClientContext(port);
  5039. disconnected = false;
  5040. port?.onMessage.addListener(onMessageHandler);
  5041. port.onDisconnect.addListener(() => {
  5042. disconnected = true;
  5043. port?.onMessage.removeListener(onMessageHandler);
  5044. reconnectTimer = setTimeout(connect, 1e3);
  5045. });
  5046. } catch (e) {
  5047. disconnected = true;
  5048. }
  5049. }
  5050. connect();
  5051. return {
  5052. post: (data) => {
  5053. if (disconnected) return;
  5054. port?.postMessage(SuperJSON.stringify(data));
  5055. },
  5056. on: (handler) => {
  5057. onMessageHandler = (data) => {
  5058. if (disconnected) return;
  5059. handler(SuperJSON.parse(data));
  5060. };
  5061. port?.onMessage.addListener(onMessageHandler);
  5062. }
  5063. };
  5064. }
  5065. //#endregion
  5066. //#region src/messaging/presets/extension/proxy.ts
  5067. function createExtensionProxyChannel() {
  5068. const port = chrome.runtime.connect({ name: "content-script" });
  5069. function sendMessageToUserApp(payload) {
  5070. window.postMessage({
  5071. source: __DEVTOOLS_KIT_EXTENSION_MESSAGING_EVENT_KEY__.PROXY_TO_SERVER,
  5072. payload
  5073. }, "*");
  5074. }
  5075. function sendMessageToDevToolsClient(e) {
  5076. if (e.data && e.data.source === __DEVTOOLS_KIT_EXTENSION_MESSAGING_EVENT_KEY__.SERVER_TO_PROXY) try {
  5077. port.postMessage(e.data.payload);
  5078. } catch (e) {}
  5079. }
  5080. port.onMessage.addListener(sendMessageToUserApp);
  5081. window.addEventListener("message", sendMessageToDevToolsClient);
  5082. port.onDisconnect.addListener(() => {
  5083. window.removeEventListener("message", sendMessageToDevToolsClient);
  5084. sendMessageToUserApp(SuperJSON.stringify({ event: "shutdown" }));
  5085. });
  5086. sendMessageToUserApp(SuperJSON.stringify({ event: "init" }));
  5087. return {
  5088. post: (data) => {},
  5089. on: (handler) => {}
  5090. };
  5091. }
  5092. //#endregion
  5093. //#region src/messaging/presets/extension/server.ts
  5094. function createExtensionServerChannel() {
  5095. return {
  5096. post: (data) => {
  5097. window.postMessage({
  5098. source: __DEVTOOLS_KIT_EXTENSION_MESSAGING_EVENT_KEY__.SERVER_TO_PROXY,
  5099. payload: SuperJSON.stringify(data)
  5100. }, "*");
  5101. },
  5102. on: (handler) => {
  5103. const listener = (event) => {
  5104. if (event.data.source === __DEVTOOLS_KIT_EXTENSION_MESSAGING_EVENT_KEY__.PROXY_TO_SERVER && event.data.payload) handler(SuperJSON.parse(event.data.payload));
  5105. };
  5106. window.addEventListener("message", listener);
  5107. return () => {
  5108. window.removeEventListener("message", listener);
  5109. };
  5110. }
  5111. };
  5112. }
  5113. //#endregion
  5114. //#region src/messaging/presets/iframe/context.ts
  5115. const __DEVTOOLS_KIT_IFRAME_MESSAGING_EVENT_KEY = "__devtools-kit-iframe-messaging-event-key__";
  5116. const __IFRAME_SERVER_CONTEXT__ = "iframe:server-context";
  5117. function getIframeServerContext() {
  5118. return _vue_devtools_shared.target[__IFRAME_SERVER_CONTEXT__];
  5119. }
  5120. function setIframeServerContext(context) {
  5121. _vue_devtools_shared.target[__IFRAME_SERVER_CONTEXT__] = context;
  5122. }
  5123. //#endregion
  5124. //#region src/messaging/presets/iframe/client.ts
  5125. function createIframeClientChannel() {
  5126. if (!_vue_devtools_shared.isBrowser) return {
  5127. post: (data) => {},
  5128. on: (handler) => {}
  5129. };
  5130. return {
  5131. post: (data) => window.parent.postMessage(SuperJSON.stringify({
  5132. event: __DEVTOOLS_KIT_IFRAME_MESSAGING_EVENT_KEY,
  5133. data
  5134. }), "*"),
  5135. on: (handler) => window.addEventListener("message", (event) => {
  5136. try {
  5137. const parsed = SuperJSON.parse(event.data);
  5138. if (event.source === window.parent && parsed.event === "__devtools-kit-iframe-messaging-event-key__") handler(parsed.data);
  5139. } catch (e) {}
  5140. })
  5141. };
  5142. }
  5143. //#endregion
  5144. //#region src/messaging/presets/iframe/server.ts
  5145. function createIframeServerChannel() {
  5146. if (!_vue_devtools_shared.isBrowser) return {
  5147. post: (data) => {},
  5148. on: (handler) => {}
  5149. };
  5150. return {
  5151. post: (data) => {
  5152. getIframeServerContext()?.contentWindow?.postMessage(SuperJSON.stringify({
  5153. event: __DEVTOOLS_KIT_IFRAME_MESSAGING_EVENT_KEY,
  5154. data
  5155. }), "*");
  5156. },
  5157. on: (handler) => {
  5158. window.addEventListener("message", (event) => {
  5159. const iframe = getIframeServerContext();
  5160. try {
  5161. const parsed = SuperJSON.parse(event.data);
  5162. if (event.source === iframe?.contentWindow && parsed.event === "__devtools-kit-iframe-messaging-event-key__") handler(parsed.data);
  5163. } catch (e) {}
  5164. });
  5165. }
  5166. };
  5167. }
  5168. //#endregion
  5169. //#region src/messaging/presets/vite/context.ts
  5170. const __DEVTOOLS_KIT_VITE_MESSAGING_EVENT_KEY = "__devtools-kit-vite-messaging-event-key__";
  5171. const __VITE_CLIENT_CONTEXT__ = "vite:client-context";
  5172. const __VITE_SERVER_CONTEXT__ = "vite:server-context";
  5173. function getViteClientContext() {
  5174. return _vue_devtools_shared.target[__VITE_CLIENT_CONTEXT__];
  5175. }
  5176. function setViteClientContext(context) {
  5177. _vue_devtools_shared.target[__VITE_CLIENT_CONTEXT__] = context;
  5178. }
  5179. function getViteServerContext() {
  5180. return _vue_devtools_shared.target[__VITE_SERVER_CONTEXT__];
  5181. }
  5182. function setViteServerContext(context) {
  5183. _vue_devtools_shared.target[__VITE_SERVER_CONTEXT__] = context;
  5184. }
  5185. //#endregion
  5186. //#region src/messaging/presets/vite/client.ts
  5187. function createViteClientChannel() {
  5188. const client = getViteClientContext();
  5189. return {
  5190. post: (data) => {
  5191. client?.send(__DEVTOOLS_KIT_VITE_MESSAGING_EVENT_KEY, SuperJSON.stringify(data));
  5192. },
  5193. on: (handler) => {
  5194. client?.on(__DEVTOOLS_KIT_VITE_MESSAGING_EVENT_KEY, (event) => {
  5195. handler(SuperJSON.parse(event));
  5196. });
  5197. }
  5198. };
  5199. }
  5200. //#endregion
  5201. //#region src/messaging/presets/vite/server.ts
  5202. function createViteServerChannel() {
  5203. const viteServer = getViteServerContext();
  5204. const ws = viteServer.hot ?? viteServer.ws;
  5205. return {
  5206. post: (data) => ws?.send(__DEVTOOLS_KIT_VITE_MESSAGING_EVENT_KEY, SuperJSON.stringify(data)),
  5207. on: (handler) => ws?.on(__DEVTOOLS_KIT_VITE_MESSAGING_EVENT_KEY, (event) => {
  5208. handler(SuperJSON.parse(event));
  5209. })
  5210. };
  5211. }
  5212. //#endregion
  5213. //#region src/messaging/index.ts
  5214. _vue_devtools_shared.target.__VUE_DEVTOOLS_KIT_MESSAGE_CHANNELS__ ??= [];
  5215. _vue_devtools_shared.target.__VUE_DEVTOOLS_KIT_RPC_CLIENT__ ??= null;
  5216. _vue_devtools_shared.target.__VUE_DEVTOOLS_KIT_RPC_SERVER__ ??= null;
  5217. _vue_devtools_shared.target.__VUE_DEVTOOLS_KIT_VITE_RPC_CLIENT__ ??= null;
  5218. _vue_devtools_shared.target.__VUE_DEVTOOLS_KIT_VITE_RPC_SERVER__ ??= null;
  5219. _vue_devtools_shared.target.__VUE_DEVTOOLS_KIT_BROADCAST_RPC_SERVER__ ??= null;
  5220. function setRpcClientToGlobal(rpc) {
  5221. _vue_devtools_shared.target.__VUE_DEVTOOLS_KIT_RPC_CLIENT__ = rpc;
  5222. }
  5223. function setRpcServerToGlobal(rpc) {
  5224. _vue_devtools_shared.target.__VUE_DEVTOOLS_KIT_RPC_SERVER__ = rpc;
  5225. }
  5226. function getRpcClient() {
  5227. return _vue_devtools_shared.target.__VUE_DEVTOOLS_KIT_RPC_CLIENT__;
  5228. }
  5229. function getRpcServer() {
  5230. return _vue_devtools_shared.target.__VUE_DEVTOOLS_KIT_RPC_SERVER__;
  5231. }
  5232. function setViteRpcClientToGlobal(rpc) {
  5233. _vue_devtools_shared.target.__VUE_DEVTOOLS_KIT_VITE_RPC_CLIENT__ = rpc;
  5234. }
  5235. function setViteRpcServerToGlobal(rpc) {
  5236. _vue_devtools_shared.target.__VUE_DEVTOOLS_KIT_VITE_RPC_SERVER__ = rpc;
  5237. }
  5238. function getViteRpcClient() {
  5239. return _vue_devtools_shared.target.__VUE_DEVTOOLS_KIT_VITE_RPC_CLIENT__;
  5240. }
  5241. function getViteRpcServer() {
  5242. return _vue_devtools_shared.target.__VUE_DEVTOOLS_KIT_VITE_RPC_SERVER__;
  5243. }
  5244. function getChannel(preset, host = "client") {
  5245. const channel = {
  5246. iframe: {
  5247. client: createIframeClientChannel,
  5248. server: createIframeServerChannel
  5249. }[host],
  5250. electron: {
  5251. client: createElectronClientChannel,
  5252. proxy: createElectronProxyChannel,
  5253. server: createElectronServerChannel
  5254. }[host],
  5255. vite: {
  5256. client: createViteClientChannel,
  5257. server: createViteServerChannel
  5258. }[host],
  5259. broadcast: {
  5260. client: createBroadcastChannel,
  5261. server: createBroadcastChannel
  5262. }[host],
  5263. extension: {
  5264. client: createExtensionClientChannel,
  5265. proxy: createExtensionProxyChannel,
  5266. server: createExtensionServerChannel
  5267. }[host]
  5268. }[preset];
  5269. return channel();
  5270. }
  5271. function createRpcClient(functions, options = {}) {
  5272. const { channel: _channel, options: _options, preset } = options;
  5273. const channel = preset ? getChannel(preset) : _channel;
  5274. const rpc = (0, birpc.createBirpc)(functions, {
  5275. ..._options,
  5276. ...channel,
  5277. timeout: -1
  5278. });
  5279. if (preset === "vite") {
  5280. setViteRpcClientToGlobal(rpc);
  5281. return;
  5282. }
  5283. setRpcClientToGlobal(rpc);
  5284. return rpc;
  5285. }
  5286. function createRpcServer(functions, options = {}) {
  5287. const { channel: _channel, options: _options, preset } = options;
  5288. const channel = preset ? getChannel(preset, "server") : _channel;
  5289. const rpcServer = getRpcServer();
  5290. if (!rpcServer) {
  5291. const group = (0, birpc.createBirpcGroup)(functions, [channel], {
  5292. ..._options,
  5293. timeout: -1
  5294. });
  5295. if (preset === "vite") {
  5296. setViteRpcServerToGlobal(group);
  5297. return;
  5298. }
  5299. setRpcServerToGlobal(group);
  5300. } else rpcServer.updateChannels((channels) => {
  5301. channels.push(channel);
  5302. });
  5303. }
  5304. function createRpcProxy(options = {}) {
  5305. const { channel: _channel, options: _options, preset } = options;
  5306. const channel = preset ? getChannel(preset, "proxy") : _channel;
  5307. return (0, birpc.createBirpc)({}, {
  5308. ..._options,
  5309. ...channel,
  5310. timeout: -1
  5311. });
  5312. }
  5313. //#endregion
  5314. //#region src/core/component/state/custom.ts
  5315. function getFunctionDetails(func) {
  5316. let string = "";
  5317. let matches = null;
  5318. try {
  5319. string = Function.prototype.toString.call(func);
  5320. matches = String.prototype.match.call(string, /\([\s\S]*?\)/);
  5321. } catch (e) {}
  5322. const match = matches && matches[0];
  5323. const args = typeof match === "string" ? match : "(?)";
  5324. return { _custom: {
  5325. type: "function",
  5326. displayText: `<span style="opacity:.8;margin-right:5px;">function</span> <span style="white-space:nowrap;">${escape(typeof func.name === "string" ? func.name : "")}${args}</span>`,
  5327. tooltipText: string.trim() ? `<pre>${escape(string)}</pre>` : null
  5328. } };
  5329. }
  5330. function getBigIntDetails(val) {
  5331. const stringifiedBigInt = BigInt.prototype.toString.call(val);
  5332. return { _custom: {
  5333. type: "bigint",
  5334. displayText: `BigInt(${stringifiedBigInt})`,
  5335. value: stringifiedBigInt
  5336. } };
  5337. }
  5338. function getDateDetails(val) {
  5339. const date = new Date(val.getTime());
  5340. date.setMinutes(date.getMinutes() - date.getTimezoneOffset());
  5341. return { _custom: {
  5342. type: "date",
  5343. displayText: Date.prototype.toString.call(val),
  5344. value: date.toISOString().slice(0, -1)
  5345. } };
  5346. }
  5347. function getMapDetails(val) {
  5348. return { _custom: {
  5349. type: "map",
  5350. displayText: "Map",
  5351. value: Object.fromEntries(val),
  5352. readOnly: true,
  5353. fields: { abstract: true }
  5354. } };
  5355. }
  5356. function getSetDetails(val) {
  5357. const list = Array.from(val);
  5358. return { _custom: {
  5359. type: "set",
  5360. displayText: `Set[${list.length}]`,
  5361. value: list,
  5362. readOnly: true
  5363. } };
  5364. }
  5365. function getCaughtGetters(store) {
  5366. const getters = {};
  5367. const origGetters = store.getters || {};
  5368. const keys = Object.keys(origGetters);
  5369. for (let i = 0; i < keys.length; i++) {
  5370. const key = keys[i];
  5371. Object.defineProperty(getters, key, {
  5372. enumerable: true,
  5373. get: () => {
  5374. try {
  5375. return origGetters[key];
  5376. } catch (e) {
  5377. return e;
  5378. }
  5379. }
  5380. });
  5381. }
  5382. return getters;
  5383. }
  5384. function reduceStateList(list) {
  5385. if (!list.length) return void 0;
  5386. return list.reduce((map, item) => {
  5387. const key = item.type || "data";
  5388. const obj = map[key] = map[key] || {};
  5389. obj[item.key] = item.value;
  5390. return map;
  5391. }, {});
  5392. }
  5393. function namedNodeMapToObject(map) {
  5394. const result = {};
  5395. const l = map.length;
  5396. for (let i = 0; i < l; i++) {
  5397. const node = map.item(i);
  5398. result[node.name] = node.value;
  5399. }
  5400. return result;
  5401. }
  5402. function getStoreDetails(store) {
  5403. return { _custom: {
  5404. type: "store",
  5405. displayText: "Store",
  5406. value: {
  5407. state: store.state,
  5408. getters: getCaughtGetters(store)
  5409. },
  5410. fields: { abstract: true }
  5411. } };
  5412. }
  5413. function getRouterDetails(router) {
  5414. return { _custom: {
  5415. type: "router",
  5416. displayText: "VueRouter",
  5417. value: {
  5418. options: router.options,
  5419. currentRoute: router.currentRoute
  5420. },
  5421. fields: { abstract: true }
  5422. } };
  5423. }
  5424. function getInstanceDetails(instance) {
  5425. if (instance._) instance = instance._;
  5426. const state = processInstanceState(instance);
  5427. return { _custom: {
  5428. type: "component",
  5429. id: instance.__VUE_DEVTOOLS_NEXT_UID__,
  5430. displayText: getInstanceName(instance),
  5431. tooltipText: "Component instance",
  5432. value: reduceStateList(state),
  5433. fields: { abstract: true }
  5434. } };
  5435. }
  5436. function getComponentDefinitionDetails(definition) {
  5437. let display = getComponentName(definition);
  5438. if (display) {
  5439. if (definition.name && definition.__file) display += ` <span>(${definition.__file})</span>`;
  5440. } else display = "<i>Unknown Component</i>";
  5441. return { _custom: {
  5442. type: "component-definition",
  5443. displayText: display,
  5444. tooltipText: "Component definition",
  5445. ...definition.__file ? { file: definition.__file } : {}
  5446. } };
  5447. }
  5448. function getHTMLElementDetails(value) {
  5449. try {
  5450. return { _custom: {
  5451. type: "HTMLElement",
  5452. displayText: `<span class="opacity-30">&lt;</span><span class="text-blue-500">${value.tagName.toLowerCase()}</span><span class="opacity-30">&gt;</span>`,
  5453. value: namedNodeMapToObject(value.attributes)
  5454. } };
  5455. } catch (e) {
  5456. return { _custom: {
  5457. type: "HTMLElement",
  5458. displayText: `<span class="text-blue-500">${String(value)}</span>`
  5459. } };
  5460. }
  5461. }
  5462. /**
  5463. * - ObjectRefImpl, toRef({ foo: 'foo' }, 'foo'), `_value` is the actual value, (since 3.5.0)
  5464. * - GetterRefImpl, toRef(() => state.foo), `_value` is the actual value, (since 3.5.0)
  5465. * - RefImpl, ref('foo') / computed(() => 'foo'), `_value` is the actual value
  5466. */
  5467. function tryGetRefValue(ref) {
  5468. if (ensurePropertyExists(ref, "_value", true)) return ref._value;
  5469. if (ensurePropertyExists(ref, "value", true)) return ref.value;
  5470. }
  5471. function getObjectDetails(object) {
  5472. const info = getSetupStateType(object);
  5473. if (info.ref || info.computed || info.reactive) {
  5474. const stateTypeName = info.computed ? "Computed" : info.ref ? "Ref" : info.reactive ? "Reactive" : null;
  5475. const value = toRaw(info.reactive ? object : tryGetRefValue(object));
  5476. const raw = ensurePropertyExists(object, "effect") ? object.effect?.raw?.toString() || object.effect?.fn?.toString() : null;
  5477. return { _custom: {
  5478. type: stateTypeName?.toLowerCase(),
  5479. stateTypeName,
  5480. value,
  5481. ...raw ? { tooltipText: `<pre>${escape(raw)}</pre>` } : {}
  5482. } };
  5483. }
  5484. if (ensurePropertyExists(object, "__asyncLoader") && typeof object.__asyncLoader === "function") return { _custom: {
  5485. type: "component-definition",
  5486. display: "Async component definition"
  5487. } };
  5488. }
  5489. //#endregion
  5490. //#region src/core/component/state/replacer.ts
  5491. function stringifyReplacer(key, _value, depth, seenInstance) {
  5492. if (key === "compilerOptions") return;
  5493. const val = this[key];
  5494. const type = typeof val;
  5495. if (Array.isArray(val)) {
  5496. const l = val.length;
  5497. if (l > 5e3) return {
  5498. _isArray: true,
  5499. length: l,
  5500. items: val.slice(0, MAX_ARRAY_SIZE)
  5501. };
  5502. return val;
  5503. } else if (typeof val === "string") if (val.length > 1e4) return `${val.substring(0, MAX_STRING_SIZE)}... (${val.length} total length)`;
  5504. else return val;
  5505. else if (type === "undefined") return UNDEFINED;
  5506. else if (val === Number.POSITIVE_INFINITY) return INFINITY;
  5507. else if (val === Number.NEGATIVE_INFINITY) return NEGATIVE_INFINITY;
  5508. else if (typeof val === "function") return getFunctionDetails(val);
  5509. else if (type === "symbol") return `[native Symbol ${Symbol.prototype.toString.call(val)}]`;
  5510. else if (typeof val === "bigint") return getBigIntDetails(val);
  5511. else if (val !== null && typeof val === "object") {
  5512. const proto = Object.prototype.toString.call(val);
  5513. if (proto === "[object Map]") return getMapDetails(val);
  5514. else if (proto === "[object Set]") return getSetDetails(val);
  5515. else if (proto === "[object RegExp]") return `[native RegExp ${RegExp.prototype.toString.call(val)}]`;
  5516. else if (proto === "[object Date]") return getDateDetails(val);
  5517. else if (proto === "[object Error]") return `[native Error ${val.message}<>${val.stack}]`;
  5518. else if (ensurePropertyExists(val, "state", true) && ensurePropertyExists(val, "_vm", true)) return getStoreDetails(val);
  5519. else if (val.constructor && val.constructor.name === "VueRouter") return getRouterDetails(val);
  5520. else if (isVueInstance(val)) {
  5521. const componentVal = getInstanceDetails(val);
  5522. const parentInstanceDepth = seenInstance?.get(val);
  5523. if (parentInstanceDepth && parentInstanceDepth < depth) return `[[CircularRef]] <${componentVal._custom.displayText}>`;
  5524. seenInstance?.set(val, depth);
  5525. return componentVal;
  5526. } else if (ensurePropertyExists(val, "render", true) && typeof val.render === "function") return getComponentDefinitionDetails(val);
  5527. else if (val.constructor && val.constructor.name === "VNode") return `[native VNode <${val.tag}>]`;
  5528. else if (typeof HTMLElement !== "undefined" && val instanceof HTMLElement) return getHTMLElementDetails(val);
  5529. else if (val.constructor?.name === "Store" && "_wrappedGetters" in val) return "[object Store]";
  5530. else if (ensurePropertyExists(val, "currentRoute", true)) return "[object Router]";
  5531. const customDetails = getObjectDetails(val);
  5532. if (customDetails != null) return customDetails;
  5533. } else if (Number.isNaN(val)) return NAN;
  5534. return sanitize(val);
  5535. }
  5536. //#endregion
  5537. //#region src/shared/transfer.ts
  5538. const MAX_SERIALIZED_SIZE = 2 * 1024 * 1024;
  5539. function isObject(_data, proto) {
  5540. return proto === "[object Object]";
  5541. }
  5542. function isArray(_data, proto) {
  5543. return proto === "[object Array]";
  5544. }
  5545. function isVueReactiveLinkNode(node) {
  5546. const constructorName = node?.constructor?.name;
  5547. return constructorName === "Dep" && "activeLink" in node || constructorName === "Link" && "dep" in node;
  5548. }
  5549. /**
  5550. * This function is used to serialize object with handling circular references.
  5551. *
  5552. * ```ts
  5553. * const obj = { a: 1, b: { c: 2 }, d: obj }
  5554. * const result = stringifyCircularAutoChunks(obj) // call `encode` inside
  5555. * console.log(result) // [{"a":1,"b":2,"d":0},1,{"c":4},2]
  5556. * ```
  5557. *
  5558. * Each object is stored in a list and the index is used to reference the object.
  5559. * With seen map, we can check if the object is already stored in the list to avoid circular references.
  5560. *
  5561. * Note: here we have a special case for Vue instance.
  5562. * We check if a vue instance includes itself in its properties and skip it
  5563. * by using `seenVueInstance` and `depth` to avoid infinite loop.
  5564. */
  5565. function encode(data, replacer, list, seen, depth = 0, seenVueInstance = /* @__PURE__ */ new Map()) {
  5566. let stored;
  5567. let key;
  5568. let value;
  5569. let i;
  5570. let l;
  5571. const seenIndex = seen.get(data);
  5572. if (seenIndex != null) return seenIndex;
  5573. const index = list.length;
  5574. const proto = Object.prototype.toString.call(data);
  5575. if (isObject(data, proto)) {
  5576. if (isVueReactiveLinkNode(data)) return index;
  5577. stored = {};
  5578. seen.set(data, index);
  5579. list.push(stored);
  5580. const keys = Object.keys(data);
  5581. for (i = 0, l = keys.length; i < l; i++) {
  5582. key = keys[i];
  5583. if (key === "compilerOptions") return index;
  5584. value = data[key];
  5585. const isVm = value != null && isObject(value, Object.prototype.toString.call(data)) && isVueInstance(value);
  5586. try {
  5587. if (replacer) value = replacer.call(data, key, value, depth, seenVueInstance);
  5588. } catch (e) {
  5589. value = e;
  5590. }
  5591. stored[key] = encode(value, replacer, list, seen, depth + 1, seenVueInstance);
  5592. if (isVm) seenVueInstance.delete(value);
  5593. }
  5594. } else if (isArray(data, proto)) {
  5595. stored = [];
  5596. seen.set(data, index);
  5597. list.push(stored);
  5598. for (i = 0, l = data.length; i < l; i++) {
  5599. try {
  5600. value = data[i];
  5601. if (replacer) value = replacer.call(data, i, value, depth, seenVueInstance);
  5602. } catch (e) {
  5603. value = e;
  5604. }
  5605. stored[i] = encode(value, replacer, list, seen, depth + 1, seenVueInstance);
  5606. }
  5607. } else list.push(data);
  5608. return index;
  5609. }
  5610. function decode(list, reviver = null) {
  5611. let i = list.length;
  5612. let j, k, data, key, value, proto;
  5613. while (i--) {
  5614. data = list[i];
  5615. proto = Object.prototype.toString.call(data);
  5616. if (proto === "[object Object]") {
  5617. const keys = Object.keys(data);
  5618. for (j = 0, k = keys.length; j < k; j++) {
  5619. key = keys[j];
  5620. value = list[data[key]];
  5621. if (reviver) value = reviver.call(data, key, value);
  5622. data[key] = value;
  5623. }
  5624. } else if (proto === "[object Array]") for (j = 0, k = data.length; j < k; j++) {
  5625. value = list[data[j]];
  5626. if (reviver) value = reviver.call(data, j, value);
  5627. data[j] = value;
  5628. }
  5629. }
  5630. }
  5631. function stringifyCircularAutoChunks(data, replacer = null, space = null) {
  5632. let result;
  5633. try {
  5634. result = arguments.length === 1 ? JSON.stringify(data) : JSON.stringify(data, (k, v) => replacer?.(k, v)?.call(this), space);
  5635. } catch (e) {
  5636. result = stringifyStrictCircularAutoChunks(data, replacer, space);
  5637. }
  5638. if (result.length > MAX_SERIALIZED_SIZE) {
  5639. const chunkCount = Math.ceil(result.length / MAX_SERIALIZED_SIZE);
  5640. const chunks = [];
  5641. for (let i = 0; i < chunkCount; i++) chunks.push(result.slice(i * MAX_SERIALIZED_SIZE, (i + 1) * MAX_SERIALIZED_SIZE));
  5642. return chunks;
  5643. }
  5644. return result;
  5645. }
  5646. function stringifyStrictCircularAutoChunks(data, replacer = null, space = null) {
  5647. const list = [];
  5648. encode(data, replacer, list, /* @__PURE__ */ new Map());
  5649. return space ? ` ${JSON.stringify(list, null, space)}` : ` ${JSON.stringify(list)}`;
  5650. }
  5651. function parseCircularAutoChunks(data, reviver = null) {
  5652. if (Array.isArray(data)) data = data.join("");
  5653. if (!/^\s/.test(data)) return arguments.length === 1 ? JSON.parse(data) : JSON.parse(data, reviver);
  5654. else {
  5655. const list = JSON.parse(data);
  5656. decode(list, reviver);
  5657. return list[0];
  5658. }
  5659. }
  5660. //#endregion
  5661. //#region src/shared/util.ts
  5662. function stringify(data) {
  5663. return stringifyCircularAutoChunks(data, stringifyReplacer);
  5664. }
  5665. function parse(data, revive = false) {
  5666. if (data == void 0) return {};
  5667. return revive ? parseCircularAutoChunks(data, reviver) : parseCircularAutoChunks(data);
  5668. }
  5669. //#endregion
  5670. //#region src/index.ts
  5671. const devtools = {
  5672. hook,
  5673. init: () => {
  5674. initDevTools();
  5675. },
  5676. get ctx() {
  5677. return devtoolsContext;
  5678. },
  5679. get api() {
  5680. return devtoolsContext.api;
  5681. }
  5682. };
  5683. //#endregion
  5684. exports.DevToolsContextHookKeys = DevToolsContextHookKeys;
  5685. exports.DevToolsMessagingHookKeys = DevToolsMessagingHookKeys;
  5686. exports.DevToolsV6PluginAPIHookKeys = DevToolsV6PluginAPIHookKeys;
  5687. exports.INFINITY = INFINITY;
  5688. exports.NAN = NAN;
  5689. exports.NEGATIVE_INFINITY = NEGATIVE_INFINITY;
  5690. exports.ROUTER_INFO_KEY = ROUTER_INFO_KEY;
  5691. exports.ROUTER_KEY = ROUTER_KEY;
  5692. exports.UNDEFINED = UNDEFINED;
  5693. exports.activeAppRecord = activeAppRecord;
  5694. exports.addCustomCommand = addCustomCommand;
  5695. exports.addCustomTab = addCustomTab;
  5696. exports.addDevToolsAppRecord = addDevToolsAppRecord;
  5697. exports.addDevToolsPluginToBuffer = addDevToolsPluginToBuffer;
  5698. exports.addInspector = addInspector;
  5699. exports.callConnectedUpdatedHook = callConnectedUpdatedHook;
  5700. exports.callDevToolsPluginSetupFn = callDevToolsPluginSetupFn;
  5701. exports.callInspectorUpdatedHook = callInspectorUpdatedHook;
  5702. exports.callStateUpdatedHook = callStateUpdatedHook;
  5703. exports.createComponentsDevToolsPlugin = createComponentsDevToolsPlugin;
  5704. exports.createDevToolsApi = createDevToolsApi;
  5705. exports.createDevToolsCtxHooks = createDevToolsCtxHooks;
  5706. exports.createRpcClient = createRpcClient;
  5707. exports.createRpcProxy = createRpcProxy;
  5708. exports.createRpcServer = createRpcServer;
  5709. exports.devtools = devtools;
  5710. exports.devtoolsAppRecords = devtoolsAppRecords;
  5711. exports.devtoolsContext = devtoolsContext;
  5712. exports.devtoolsInspector = devtoolsInspector;
  5713. exports.devtoolsPluginBuffer = devtoolsPluginBuffer;
  5714. exports.devtoolsRouter = devtoolsRouter;
  5715. exports.devtoolsRouterInfo = devtoolsRouterInfo;
  5716. exports.devtoolsState = devtoolsState;
  5717. exports.escape = escape;
  5718. exports.formatInspectorStateValue = formatInspectorStateValue;
  5719. exports.getActiveInspectors = getActiveInspectors;
  5720. exports.getDevToolsEnv = getDevToolsEnv;
  5721. exports.getExtensionClientContext = getExtensionClientContext;
  5722. exports.getInspector = getInspector;
  5723. exports.getInspectorActions = getInspectorActions;
  5724. exports.getInspectorInfo = getInspectorInfo;
  5725. exports.getInspectorNodeActions = getInspectorNodeActions;
  5726. exports.getInspectorStateValueType = getInspectorStateValueType;
  5727. exports.getRaw = getRaw;
  5728. exports.getRpcClient = getRpcClient;
  5729. exports.getRpcServer = getRpcServer;
  5730. exports.getViteRpcClient = getViteRpcClient;
  5731. exports.getViteRpcServer = getViteRpcServer;
  5732. exports.initDevTools = initDevTools;
  5733. exports.isPlainObject = isPlainObject;
  5734. exports.onDevToolsClientConnected = onDevToolsClientConnected;
  5735. exports.onDevToolsConnected = onDevToolsConnected;
  5736. exports.parse = parse;
  5737. exports.registerDevToolsPlugin = registerDevToolsPlugin;
  5738. exports.removeCustomCommand = removeCustomCommand;
  5739. exports.removeDevToolsAppRecord = removeDevToolsAppRecord;
  5740. exports.removeRegisteredPluginApp = removeRegisteredPluginApp;
  5741. exports.resetDevToolsState = resetDevToolsState;
  5742. exports.setActiveAppRecord = setActiveAppRecord;
  5743. exports.setActiveAppRecordId = setActiveAppRecordId;
  5744. exports.setDevToolsEnv = setDevToolsEnv;
  5745. exports.setElectronClientContext = setElectronClientContext;
  5746. exports.setElectronProxyContext = setElectronProxyContext;
  5747. exports.setElectronServerContext = setElectronServerContext;
  5748. exports.setExtensionClientContext = setExtensionClientContext;
  5749. exports.setIframeServerContext = setIframeServerContext;
  5750. exports.setOpenInEditorBaseUrl = setOpenInEditorBaseUrl;
  5751. exports.setRpcServerToGlobal = setRpcServerToGlobal;
  5752. exports.setViteClientContext = setViteClientContext;
  5753. exports.setViteRpcClientToGlobal = setViteRpcClientToGlobal;
  5754. exports.setViteRpcServerToGlobal = setViteRpcServerToGlobal;
  5755. exports.setViteServerContext = setViteServerContext;
  5756. exports.setupDevToolsPlugin = setupDevToolsPlugin;
  5757. exports.stringify = stringify;
  5758. exports.toEdit = toEdit;
  5759. exports.toSubmit = toSubmit;
  5760. exports.toggleClientConnected = toggleClientConnected;
  5761. exports.toggleComponentInspectorEnabled = toggleComponentInspectorEnabled;
  5762. exports.toggleHighPerfMode = toggleHighPerfMode;
  5763. exports.updateDevToolsClientDetected = updateDevToolsClientDetected;
  5764. exports.updateDevToolsState = updateDevToolsState;
  5765. exports.updateTimelineLayersState = updateTimelineLayersState;