@nuxt/devtools 1.3.14 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/dist/chunks/module-main.mjs +6 -6
  2. package/dist/chunks/vscode.mjs +2 -2
  3. package/dist/chunks/vue-devtools.mjs +1 -1
  4. package/dist/client/200.html +21 -21
  5. package/dist/client/404.html +21 -21
  6. package/dist/client/_nuxt/{DoQHeYxB.js → 32IlS-eL.js} +3 -3
  7. package/dist/client/_nuxt/{DVZAdofw.js → 6ngNN4Yp.js} +1 -1
  8. package/dist/client/_nuxt/{BHBvn5Xs.js → 7oK7PdYH.js} +1 -1
  9. package/dist/client/_nuxt/{zLQhdF7m.js → B1veJI6T.js} +1 -1
  10. package/dist/client/_nuxt/{BMUgLter.js → B3uNdhXb.js} +1 -1
  11. package/dist/client/_nuxt/{D8XE2BC8.js → BECRlsCL.js} +1 -1
  12. package/dist/client/_nuxt/{D4Ks82zD.js → BHh_UM9T.js} +1 -1
  13. package/dist/client/_nuxt/{zjxoDR5L.js → BI3hykgO.js} +1 -1
  14. package/dist/client/_nuxt/{BWPbreBU.js → BKeomq25.js} +1 -1
  15. package/dist/client/_nuxt/{rLudNEh9.js → BKukfVLl.js} +1 -1
  16. package/dist/client/_nuxt/BMbUeBqv.js +1 -1
  17. package/dist/client/_nuxt/{BcJweaq3.js → BMmGYe_n.js} +1 -1
  18. package/dist/client/_nuxt/{CLVHkiJk.js → BOV_C5BD.js} +1 -1
  19. package/dist/client/_nuxt/{CjFkCrIW.js → BiRcA7Ly.js} +1 -1
  20. package/dist/client/_nuxt/{Di9lD2rK.js → BiWf_U1D.js} +1 -1
  21. package/dist/client/_nuxt/{B-wfK0SS.js → BkwfBuTq.js} +1 -1
  22. package/dist/client/_nuxt/{DN0HCnq5.js → BopA0WYG.js} +1 -1
  23. package/dist/client/_nuxt/{z0xAc3RC.js → BsEGx9wN.js} +1 -1
  24. package/dist/client/_nuxt/{BZZpaKJQ.js → Bu2gNcUf.js} +1 -1
  25. package/dist/client/_nuxt/{C4OO6w_e.js → ByTwm2ax.js} +1 -1
  26. package/dist/client/_nuxt/{awWHqjli.js → C1fpCDlE.js} +1 -1
  27. package/dist/client/_nuxt/{Bl8OBrwH.js → C2HmjCtb.js} +1 -1
  28. package/dist/client/_nuxt/C8RrL2-P.js +1 -1
  29. package/dist/client/_nuxt/{BF_UD7ZT.js → C9bF3W-8.js} +1 -1
  30. package/dist/client/_nuxt/{DYx1ZwvQ.js → CCJYS4Qc.js} +1 -1
  31. package/dist/client/_nuxt/{ewAh1ZiX.js → CCXTpRMt.js} +1 -1
  32. package/dist/client/_nuxt/{BrzmMRQX.js → CCfUy938.js} +2 -2
  33. package/dist/client/_nuxt/{CVW-sDYN.js → CEL3Rl_8.js} +1 -1
  34. package/dist/client/_nuxt/{BZvh3yot.js → CIvuwNIv.js} +1 -1
  35. package/dist/client/_nuxt/{DwVKZd3-.js → CNzQK24q.js} +1 -1
  36. package/dist/client/_nuxt/{yFeWtr-M.js → CO7Eo6nF.js} +1 -1
  37. package/dist/client/_nuxt/CTKqK4eG.js +1 -1
  38. package/dist/client/_nuxt/{B2TuRHFi.js → CUZJ8tqD.js} +1 -1
  39. package/dist/client/_nuxt/{CsgBhI1g.js → C_n3_iyW.js} +1 -1
  40. package/dist/client/_nuxt/C_tLznPO.js +43 -0
  41. package/dist/client/_nuxt/CbViG2Xw.js +1 -1
  42. package/dist/client/_nuxt/{CxLTb5RC.js → CoNBQO3e.js} +1 -1
  43. package/dist/client/_nuxt/D4C_EO1O.js +9 -0
  44. package/dist/client/_nuxt/{CPWqrNrA.js → D4FLysGE.js} +1 -1
  45. package/dist/client/_nuxt/{Bi99gj7u.js → D4V9JMY9.js} +1 -1
  46. package/dist/client/_nuxt/{CA5wVMK1.js → D5Dg5B9b.js} +1 -1
  47. package/dist/client/_nuxt/{BEKXAodE.js → D86udNSS.js} +1 -1
  48. package/dist/client/_nuxt/{gXK6hV6W.js → DAg81ukK.js} +1 -1
  49. package/dist/client/_nuxt/{CcKfWHXB.js → DDDCUP5E.js} +1 -1
  50. package/dist/client/_nuxt/DDMtKJxh.js +1 -1
  51. package/dist/client/_nuxt/{Cb_ad2sg.js → DHZqFavZ.js} +1 -1
  52. package/dist/client/_nuxt/{JMx2uAI6.js → DHsLiygU.js} +1 -1
  53. package/dist/client/_nuxt/{Dv0NFAnW.js → DJg41Obz.js} +1 -1
  54. package/dist/client/_nuxt/DJn5wykB.js +1 -0
  55. package/dist/client/_nuxt/{BkmSFWMo.js → DMjsYTya.js} +1 -1
  56. package/dist/client/_nuxt/{CWyKSuRn.js → DajZvwFy.js} +1 -1
  57. package/dist/client/_nuxt/Di-fSNio.js +1 -0
  58. package/dist/client/_nuxt/{D-a-w6CR.js → DiyNht5f.js} +1 -1
  59. package/dist/client/_nuxt/{CE84j0J9.js → Dm9RYIcI.js} +1 -1
  60. package/dist/client/_nuxt/{VNvxalkE.js → DockxStG.js} +1 -1
  61. package/dist/client/_nuxt/DpYuRYxj.js +1 -1
  62. package/dist/client/_nuxt/{DwdKwQHN.js → DqpvVAaa.js} +1 -1
  63. package/dist/client/_nuxt/{DKlNNSWk.js → DrswlxM3.js} +1 -1
  64. package/dist/client/_nuxt/{viHXAOJs.js → DtfHoqTV.js} +1 -1
  65. package/dist/client/_nuxt/{CPr4CZHz.js → J0gvLlTF.js} +1 -1
  66. package/dist/client/_nuxt/{CyS6YlEb.js → L3q7etZW.js} +1 -1
  67. package/dist/client/_nuxt/{BO314c-_.js → QxrU7fRC.js} +1 -1
  68. package/dist/client/_nuxt/{CmbkPMjd.js → RBAD4-dW.js} +1 -1
  69. package/dist/client/_nuxt/{CyvuMq07.js → T8d8zkkH.js} +1 -1
  70. package/dist/client/_nuxt/{2tJW9cKr.js → U0su7k1z.js} +1 -1
  71. package/dist/client/_nuxt/{CfVBzxeB.js → UI0GwUC_.js} +1 -1
  72. package/dist/client/_nuxt/{Cic6Ln_D.js → YWCqik9X.js} +1 -1
  73. package/dist/client/_nuxt/builds/latest.json +1 -1
  74. package/dist/client/_nuxt/builds/meta/1766755b-b307-4775-82c4-edb6a4a7e185.json +1 -0
  75. package/dist/client/_nuxt/{entry.Gpl6Gx6M.css → entry.eFSfOpqI.css} +1 -1
  76. package/dist/client/_nuxt/error-404.HYsbWGh9.css +1 -0
  77. package/dist/client/_nuxt/error-500.BwPFg8q2.css +1 -0
  78. package/dist/client/_nuxt/{CnW1WPg6.js → nhLZZe93.js} +1 -1
  79. package/dist/client/index.html +21 -21
  80. package/dist/module.d.mts +1 -1
  81. package/dist/module.d.ts +1 -1
  82. package/dist/module.json +2 -2
  83. package/dist/runtime/function-metrics-helpers.d.ts +1 -1
  84. package/dist/runtime/{function-metrics-helpers.mjs → function-metrics-helpers.js} +1 -1
  85. package/dist/runtime/plugins/{devtools.client.mjs → devtools.client.js} +2 -2
  86. package/dist/runtime/plugins/view/FrameBox.vue +5 -49
  87. package/dist/runtime/plugins/view/Main.vue +1 -147
  88. package/dist/runtime/plugins/view/client.d.ts +1 -1
  89. package/dist/runtime/plugins/view/{client.mjs → client.js} +2 -2
  90. package/dist/runtime/plugins/view/state.d.ts +1 -1
  91. package/dist/runtime/plugins/view/{state.mjs → state.js} +1 -1
  92. package/dist/runtime/settings.d.ts +1 -1
  93. package/dist/runtime/shared/hooks.d.ts +1 -1
  94. package/dist/runtime/use-nuxt-devtools.d.ts +1 -1
  95. package/package.json +18 -18
  96. package/dist/client/_nuxt/Cvo3JE8Q.js +0 -1
  97. package/dist/client/_nuxt/W2Tyz6z1.js +0 -9
  98. package/dist/client/_nuxt/builds/meta/a69820c2-31c2-48f6-8161-842a62467079.json +0 -1
  99. package/dist/client/_nuxt/ciodjZaS.js +0 -43
  100. package/dist/client/_nuxt/error-404.Bssqox27.css +0 -1
  101. package/dist/client/_nuxt/error-500.D3oXMFZl.css +0 -1
  102. package/dist/client/_nuxt/pl_4MfI2.js +0 -1
  103. /package/dist/runtime/nitro/{inline.mjs → inline.js} +0 -0
  104. /package/dist/runtime/plugins/{devtools.server.mjs → devtools.server.js} +0 -0
  105. /package/dist/runtime/plugins/view/{utils.mjs → utils.js} +0 -0
  106. /package/dist/runtime/{settings.mjs → settings.js} +0 -0
  107. /package/dist/runtime/shared/{hooks.mjs → hooks.js} +0 -0
  108. /package/dist/runtime/{use-nuxt-devtools.mjs → use-nuxt-devtools.js} +0 -0
  109. /package/dist/runtime/vue-devtools/{overlay.d.mts → overlay.d.ts} +0 -0
  110. /package/dist/runtime/vue-devtools/{overlay.mjs → overlay.js} +0 -0
@@ -1,9 +0,0 @@
1
- import{d as ye,r as A,bH as Re,o as i,m as b,k as c,G as B,h as $,f as e,bI as ie,t as U,p as O,v as Q,a9 as Qe,aa as Xe,F as L,n as G,a6 as Ee,bz as he,w as De,by as je,bx as Ye,bJ as Ze,bK as et,aC as tt,bL as ot,ao as nt,ab as st,am as at,aA as ve,a as D,ac as rt,ak as Ve,aD as lt,b2 as it,bM as ut,e as ct,a2 as Ie,j as S,l as Z,i as m,I as ee,ay as dt,V as pt,_ as Ue,X as ft,A as Oe,an as mt,bN as vt,ah as ht,U as yt,bO as _t,at as gt}from"./ciodjZaS.js";import{_ as bt}from"./D4Ks82zD.js";import{_ as Ne}from"./Bi99gj7u.js";import{_ as kt}from"./CjFkCrIW.js";import{_ as Le}from"./BHBvn5Xs.js";import{_ as wt}from"./DN0HCnq5.js";import{_ as Ct}from"./B-wfK0SS.js";import{_ as xt}from"./BZvh3yot.js";import{C as xe,S as Ae}from"./BcJws1i5.js";import{e as St}from"./BMUgLter.js";import{_ as Tt}from"./DwdKwQHN.js";import{_ as $t}from"./DKlNNSWk.js";import"./BWPbreBU.js";import"./yFeWtr-M.js";import"./zLQhdF7m.js";const re=/^[\u0009\u0020-\u007E\u0080-\u00FF]+$/;function Rt(t,a){if(typeof t!="string")throw new TypeError("argument str must be a string");const n={},y=(a||{}).decode||jt;let v=0;for(;v<t.length;){const d=t.indexOf("=",v);if(d===-1)break;let h=t.indexOf(";",v);if(h===-1)h=t.length;else if(h<d){v=t.lastIndexOf(";",d-1)+1;continue}const _=t.slice(v,d).trim();if(n[_]===void 0){let u=t.slice(d+1,h).trim();u.codePointAt(0)===34&&(u=u.slice(1,-1)),n[_]=Dt(u,y)}v=h+1}return n}function Se(t,a,n){const o=n||{},y=o.encode||Vt;if(typeof y!="function")throw new TypeError("option encode is invalid");if(!re.test(t))throw new TypeError("argument name is invalid");const v=y(a);if(v&&!re.test(v))throw new TypeError("argument val is invalid");let d=t+"="+v;if(o.maxAge!==void 0&&o.maxAge!==null){const h=o.maxAge-0;if(Number.isNaN(h)||!Number.isFinite(h))throw new TypeError("option maxAge is invalid");d+="; Max-Age="+Math.floor(h)}if(o.domain){if(!re.test(o.domain))throw new TypeError("option domain is invalid");d+="; Domain="+o.domain}if(o.path){if(!re.test(o.path))throw new TypeError("option path is invalid");d+="; Path="+o.path}if(o.expires){if(!Et(o.expires)||Number.isNaN(o.expires.valueOf()))throw new TypeError("option expires is invalid");d+="; Expires="+o.expires.toUTCString()}if(o.httpOnly&&(d+="; HttpOnly"),o.secure&&(d+="; Secure"),o.priority)switch(typeof o.priority=="string"?o.priority.toLowerCase():o.priority){case"low":{d+="; Priority=Low";break}case"medium":{d+="; Priority=Medium";break}case"high":{d+="; Priority=High";break}default:throw new TypeError("option priority is invalid")}if(o.sameSite)switch(typeof o.sameSite=="string"?o.sameSite.toLowerCase():o.sameSite){case!0:{d+="; SameSite=Strict";break}case"lax":{d+="; SameSite=Lax";break}case"strict":{d+="; SameSite=Strict";break}case"none":{d+="; SameSite=None";break}default:throw new TypeError("option sameSite is invalid")}return o.partitioned&&(d+="; Partitioned"),d}function Et(t){return Object.prototype.toString.call(t)==="[object Date]"||t instanceof Date}function Dt(t,a){try{return a(t)}catch{return t}}function jt(t){return t.includes("%")?decodeURIComponent(t):t}function Vt(t){return encodeURIComponent(t)}const It=c("div",{"x-divider":""},null,-1),Pe=ye({__name:"ServerRouteListItem",props:{item:{},index:{default:0}},setup(t){const a=A(!0),n=Re();return(o,y)=>{const v=Ee,d=Ne,h=Pe;return i(),b("div",null,[c("button",{flex:"~ gap-2","w-full":"","items-start":"","items-center":"","hover-bg-active":"",px2:"",py1:"",class:B([{"bg-active":e(n)===o.item.filepath}]),style:Qe({paddingLeft:`calc(0.5rem + ${o.index*1.5}em)`}),onClick:y[0]||(y[0]=_=>{a.value=!e(a),n.value=o.item.filepath})},[c("div",{class:B({"w-12":!o.item.routes}),"flex-none":"","text-left":""},[o.item.type==="collection"?(i(),$(v,{key:0,icon:"carbon:chevron-right","mb0.5":"","transform-rotate":e(a)?90:0,transition:""},null,8,["transform-rotate"])):(i(),$(d,{key:1,class:B(("getRequestMethodClass"in o?o.getRequestMethodClass:e(ie))(o.item.method||"*")),textContent:U((o.item.method||"*").toUpperCase())},null,8,["class","textContent"]))],2),c("span",{class:B({"flex items-center":o.item.routes}),"text-sm":"","font-mono":""},[o.item.type==="collection"?(i(),$(v,{key:0,title:`${o.item.routes?.length} routes`,icon:"carbon:folder",mr1:""},null,8,["title"])):O("",!0),Q(" "+U(o.item.route),1)],2)],6),It,e(a)?Xe(o.$slots,"default",{key:0},()=>[(i(!0),b(L,null,G(o.item.routes,_=>(i(),$(h,{key:_.filepath,item:_,index:o.index+1},null,8,["item","index"]))),128))]):O("",!0)])}}});function q(t){if(typeof t!="object")return t;var a,n,o=Object.prototype.toString.call(t);if(o==="[object Object]"){if(t.constructor!==Object&&typeof t.constructor=="function"){n=new t.constructor;for(a in t)t.hasOwnProperty(a)&&n[a]!==t[a]&&(n[a]=q(t[a]))}else{n={};for(a in t)a==="__proto__"?Object.defineProperty(n,a,{value:q(t[a]),configurable:!0,enumerable:!0,writable:!0}):n[a]=q(t[a])}return n}if(o==="[object Array]"){for(a=t.length,n=Array(a);a--;)n[a]=q(t[a]);return n}return o==="[object Set]"?(n=new Set,t.forEach(function(y){n.add(q(y))}),n):o==="[object Map]"?(n=new Map,t.forEach(function(y,v){n.set(q(v),q(y))}),n):o==="[object Date]"?new Date(+t):o==="[object RegExp]"?(n=new RegExp(t.source,t.flags),n.lastIndex=t.lastIndex,n):o==="[object DataView]"?new t.constructor(q(t.buffer)):o==="[object ArrayBuffer]"?t.slice(0):o.slice(-6)==="Array]"?new t.constructor(t):t}const Ut={path:"/",watch:!0,decode:t=>Ze(decodeURIComponent(t)),encode:t=>encodeURIComponent(typeof t=="string"?t:JSON.stringify(t))},le=window.cookieStore;function Ot(t,a){const n={...Ut,...a},o=Te(n)||{};let y;n.maxAge!==void 0?y=n.maxAge*1e3:n.expires&&(y=n.expires.getTime()-Date.now());const v=y!==void 0&&y<=0,d=q(v?void 0:o[t]??n.default?.()),h=y&&!v?At(d,y,n.watch&&n.watch!=="shallow"):A(d);{let _=null;try{!le&&typeof BroadcastChannel<"u"&&(_=new BroadcastChannel(`nuxt:cookies:${t}`))}catch{}const u=()=>{n.readonly||et(h.value,o[t])||(Lt(t,h.value,n),o[t]=q(h.value),_?.postMessage({value:n.encode(h.value)}))},j=P=>{const x=P.refresh?Te(n)?.[t]:n.decode(P.value);I=!0,h.value=x,o[t]=q(x),tt(()=>{I=!1})};let I=!1;const F=!!je();if(F&&he(()=>{I=!0,u(),_?.close()}),le){const P=x=>{const w=x.changed.find(N=>N.name===t);w&&j({value:w.value})};le.addEventListener("change",P),F&&he(()=>le.removeEventListener("change",P))}else _&&(_.onmessage=({data:P})=>j(P));n.watch?De(h,()=>{I||u()},{deep:n.watch!=="shallow"}):u()}return h}function Te(t={}){return Rt(document.cookie,t)}function Nt(t,a,n={}){return a==null?Se(t,a,{...n,maxAge:-1}):Se(t,a,n)}function Lt(t,a,n={}){document.cookie=Nt(t,a,n)}const $e=2147483647;function At(t,a,n){let o,y,v=0;const d=n?A(t):{value:t};return je()&&he(()=>{y?.(),clearTimeout(o)}),Ye((h,_)=>{n&&(y=De(d,_));function u(){v=0,clearTimeout(o);const j=a-v,I=j<$e?j:$e;o=setTimeout(()=>{if(v+=I,v<a)return u();d.value=void 0,_()},I)}return{get(){return h(),d.value},set(j){u(),d.value=j,_()}}})}const Pt={"h-full":"","w-full":"",flex:"~ col"},qt={flex:"~ col gap-2","flex-none":"",p4:"","n-navbar-glass":""},Mt={flex:"~ gap2 items-center"},Bt={relative:"","w-full":""},Ft={absolute:"","right-2":"","top-1.5":"",flex:"~ gap-1"},Ht={flex:"~ gap2 wrap","w-full":"","items-center":"",px4:"",pb2:"","text-center":"","text-sm":"",border:"b base"},zt={class:"hidden md:block"},Gt=c("div",{"flex-auto":""},null,-1),Jt=c("div",{"text-xs":"",op50:""}," Send from ",-1),Wt=c("option",{value:"app"}," App ",-1),Kt=c("option",{value:"devtools"}," DevTools ",-1),Qt={key:0,border:"b base","items-center":"",px4:"",py2:"",grid:"~ cols-[max-content_1fr] gap-2"},Xt={"text-right":"","font-mono":""},Yt={key:1,border:"b base",p4:"",flex:"~ col gap-4","font-mono":""},Zt={flex:"~ gap-4"},eo={flex:"~ gap2","mb--2":"","items-center":"",op50:""},to=c("div",{"w-5":"","x-divider":""},null,-1),oo=c("div",{"flex-none":""}," Default Inputs ",-1),no=c("div",{"x-divider":""},null,-1),so={key:2},ao={key:3,border:"b base",relative:"","n-code-block":""},ro={flex:"~ wrap","w-full":""},lo=["onClick"],io=c("div",{border:"b base","flex-auto":""},null,-1),uo={border:"b base",flex:"~ gap2","items-center":"",px4:"",py2:""},co=c("div",null,"Response",-1),po={key:1,"text-xs":"",op50:""},fo=c("div",{"flex-auto":""},null,-1),mo=c("div",{op50:""}," Request finished in ",-1),vo={key:0,"flex-auto":"","overflow-auto":""},ho={border:"~ base","h-full":"","w-full":"",rounded:""},yo=["data"],_o={key:2,"flex-auto":"","overflow-auto":"",p4:""},go={border:"~ base",rounded:""},bo=["src"],ko={key:1,controls:"",rounded:""},wo=["src"],Co=ye({__name:"ServerRouteDetails",props:{route:{}},emits:["open-default-input"],setup(t,{emit:a}){const n=t,o=a,[y,v]=ot(),d=nt(),h=st(),_=at(),u=ve({contentType:"text/plain",data:"",statusCode:200,error:void 0,fetchTime:0}),j=D(()=>u.contentType.includes("application/json")?"json":u.contentType.includes("text/html")?"html":u.contentType.includes("text/css")?"css":u.contentType.includes("text/javascript")?"javascript":u.contentType.includes("image")||u.contentType.includes("video")?"media":u.contentType.includes("text/xml")||u.contentType.includes("application/xml")?"xml":u.contentType.includes("application/pdf")?"pdf":"text"),I=D(()=>{if(j.value==="json")return JSON.stringify(u.data,null,2);if(j.value==="media"||j.value==="pdf"){const s=new Blob([u.data],{type:u.contentType});return URL.createObjectURL(s)}return u.data}),F=A(!1),P=A(!1),x=rt(),w=D(()=>n.route.route?.split(/((?:\*\*)?:\w+)/g)),N=D(()=>w.value?.filter(s=>s.startsWith(":")||s.startsWith("**:"))||[]),g=A(n.route.method||"GET"),R=A({}),k=ve({query:[{active:!0,key:"",value:"",type:"string"}],body:[{active:!0,key:"",value:"",type:"string"}],headers:[{active:!0,key:"Content-Type",value:"application/json",type:"string"}]}),V=A({}),{inputDefaults:C,sendFrom:H}=Ve("serverRoutes"),J=D(()=>_?.value?.app?.$fetch?H.value:"devtools"),ue=["GET","POST","PUT","PATCH","DELETE","HEAD"],ce=["PATCH","POST","PUT","DELETE"],te=D(()=>ce.includes(g.value.toUpperCase())),p=A(),oe=["input","json"],W=A(oe[0]),ne=D({get:()=>k[p.value],set:s=>{k[p.value]=s}}),_e=D(()=>({...K(C.value.query),...K(k.query)})),ge=D(()=>({...K(C.value.headers),...K(k.headers)})),de=D(()=>te.value?W.value==="json"?{...K(C.value.body),...V.value}:{...K(C.value.body),...K(k.body)}:void 0),qe=D(()=>{let s=window?.location.origin;return s.charAt(s.length-1)==="/"&&(s=s.slice(0,-1)),s}),se=D(()=>{let s=new URLSearchParams(_e.value).toString();s&&(s=`?${s}`);const l=(w.value?.map(E=>(E.startsWith(":")||E.startsWith("**:"))&&R.value[E]||E).join("")||"")+s;let f=h.value?.app.baseURL||"";return(f==="./"||f===".")&&(f=""),f.endsWith("/")&&(f=f.slice(0,-1)),f+l}),be=D(()=>qe.value+se.value);function K(s){const l=Object.fromEntries(s.filter(({active:f,key:E,value:T})=>f&&E&&T!==void 0).map(({key:f,value:E})=>[f,E]));return Object.entries(l).length?l:void 0}async function ke(){P.value=!0,F.value=!0;const s=Date.now(),l=J.value==="app"?_.value.app.$fetch:$fetch;pt("server-routes:fetch",{method:g.value,sendFrom:J.value});try{u.data=await l(be.value,{method:g.value.toUpperCase(),headers:ge.value,query:_e.value,body:de.value,onResponse({response:f}){u.contentType=(f.headers.get("content-type")||"").toString().toLowerCase().trim(),u.statusCode=f.status,u.error=void 0},onResponseError(f){u.error=f.response._data,u.data=f.response._data}})}catch{}F.value=!1,u.fetchTime=Date.now()-s}const we=D(()=>{const s=[],l=[],f=Object.entries(ge.value).filter(([T,M])=>T&&M&&!(T==="Content-Type"&&M==="application/json")).map(([T,M])=>` '${T}': '${M}'`).join(`,
2
- `);g.value.toUpperCase()!=="GET"&&l.push(`method: '${g.value.toUpperCase()}'`),f&&l.push(`headers: {
3
- ${f}
4
- }`),de.value&&l.push(`body: ${JSON.stringify(de.value,null,2)}`);const E=l.length?`, {
5
- ${l.join(`,
6
- `).split(`
7
- `).map(T=>` ${T}`).join(`
8
- `)}
9
- }`:"";return s.push({name:"useFetch",lang:"javascript",docs:xe.nuxt.useFetch,code:`const { data, pending, error, refresh } = useFetch('${se.value}'${E})`}),s.push({name:"$fetch",lang:"javascript",docs:xe.nuxt.$fetch,code:`await $fetch('${se.value}'${E})`}),s}),X=A(Be()),z=ve({key:"",value:""}),Me=D(()=>{const s=[];return N.value.length&&s.push({name:"Params",slug:"params",length:N.value.length}),s.push({name:"Query",slug:"query",length:k.query.length}),te.value&&s.push({name:"Body",slug:"body",length:k.body.length}),s.push({name:"Headers",slug:"headers",length:k.headers.length}),s.push({name:"Cookies",slug:"cookies",length:X.value.length}),s.push({name:"Snippets",slug:"snippet"}),s});function Be(){return document.cookie.split("; ").map(s=>{const[l,f]=s.split("=");return{key:l,value:f}}).filter(s=>s.key)}function pe(s,l){if(!s)return;const f=X.value.find(T=>T.key===s),E=Ot(s);f!==void 0?l===void 0&&(X.value=X.value.filter(T=>T.key!==s)):(X.value.push({key:s,value:l}),z.key="",z.value=""),E.value=l}lt(()=>{W.value==="json"&&typeof V.value=="string"&&(V.value=JSON.parse(V.value))});const fe=it("nuxt-devtools:server-routes:inputs",()=>[],{window:window.parent});ut([k,p],()=>{const s=fe.value?.find(l=>l.path===n.route.filepath);if(s){p.value||(p.value=s.tab),s.tab!==p.value&&(s.tab=p.value);const{body:l,query:f,headers:E,params:T}=s.inputs;Object.assign(k,{body:l,query:f,headers:E}),R.value=T}else{const l={path:n.route.filepath,tab:N.value.length?"params":"query",inputs:{...k,...N.value.length?{params:R.value}:{}}};fe.value.push(l),p.value||(p.value=l.tab)}},{immediate:!0,deep:!0,debounce:500});function Fe(){fe.value=[],k.body=[],k.query=[],k.headers=[],R.value={},p.value=N.value.length?"params":"query"}const He=ct();return(s,l)=>{const f=Ue,E=kt,T=ft,M=Ee,Ce=Le,ze=wt,Ge=Oe,Je=mt,me=Ne,We=Ct,Ke=xt,ae=Ie("tooltip");return i(),b("div",Pt,[c("div",qt,[c("div",Mt,[s.route.method?(i(),$(f,{key:0,class:B(["n-badge-base n-sm",("getRequestMethodClass"in s?s.getRequestMethodClass:e(ie))(e(g))]),"pointer-events-none":"","font-mono":"",tabindex:"-1"},{default:S(()=>[Q(U(e(g).toUpperCase()),1)]),_:1},8,["class"])):(i(),$(E,{key:1,modelValue:e(g),"onUpdate:modelValue":l[0]||(l[0]=r=>Z(g)?g.value=r:null),class:B(["n-badge-base n-sm",("getRequestMethodClass"in s?s.getRequestMethodClass:e(ie))(e(g))])},{default:S(()=>[(i(),b(L,null,G(ue,r=>c("option",{key:r,class:B(("getRequestMethodClass"in s?s.getRequestMethodClass:e(ie))(r))},U(r.toUpperCase()),3)),64))]),_:1},8,["modelValue","class"])),c("div",Bt,[m(T,{"model-value":e(se),readonly:"","flex-auto":"","font-mono":"",p:"x5 y2",n:"sm"},null,8,["model-value"]),c("div",Ft,[ee(m(f,{title:"Copy URL",n:"xs blue",icon:"carbon:copy",border:!1,onClick:l[1]||(l[1]=r=>e(He)(e(be),"server-route-url"))},null,512),[[ae,"Copy URL"]]),ee(m(f,{title:"Open in Editor",icon:"carbon-launch",n:"xs blue",border:!1,onClick:l[2]||(l[2]=r=>e(x)(s.route.filepath))},null,512),[[ae,"Open in Editor"]])])]),m(f,{"h-full":"",n:"primary solid",onClick:ke},{default:S(()=>[m(M,{icon:"carbon:send"})]),_:1})])]),c("div",Ht,[(i(!0),b(L,null,G(e(Me),r=>ee((i(),$(f,{key:r.slug,class:B(e(p)===r.slug?"text-primary n-primary":"border-transparent shadow-none"),onClick:Y=>p.value=r.slug},{default:S(()=>[m(M,{icon:("ServerRouteTabIcons"in s?s.ServerRouteTabIcons:e(Ae))[r.slug]},null,8,["icon"]),c("div",zt,[Q(U(r.name)+" "+U(r?.length?`(${r.length})`:"")+" ",1),c("span",null,U(e(C)[r.slug]?.length?`(${e(C)[r.slug].length})`:""),1)])]),_:2},1032,["class","onClick"])),[[ae,r.name]])),128)),Gt,Jt,m(E,{modelValue:e(J),"onUpdate:modelValue":l[3]||(l[3]=r=>Z(J)?J.value=r:null),class:"n-xs",disabled:!e(_)?.app?.$fetch},{default:S(()=>[Wt,Kt]),_:1},8,["modelValue","disabled"]),ee(m(f,{n:"orange",class:"p-3",icon:"i-carbon-clean",onClick:Fe},null,512),[[ae,"Clear Inputs Saved Cache"]])]),e(p)==="params"?(i(),b("div",Qt,[(i(!0),b(L,null,G(e(N),r=>(i(),b(L,{key:r},[c("div",Xt,U(r),1),m(T,{modelValue:e(R)[r],"onUpdate:modelValue":Y=>e(R)[r]=Y,placeholder:r,"flex-1":""},null,8,["modelValue","onUpdate:modelValue","placeholder"])],64))),128))])):O("",!0),e(p)==="cookies"?(i(),b("div",Yt,[(i(!0),b(L,null,G(e(X),r=>(i(),b("div",{key:r.key,flex:"~ gap-4 items-center"},[m(T,{placeholder:"Key...","model-value":r.key,disabled:"","op-70":""},null,8,["model-value"]),m(T,{placeholder:"Value...","model-value":r.value,"flex-1":"",n:"primary",onInput:Y=>pe(r.key,Y.target?.value)},null,8,["model-value","onInput"]),m(f,{title:"Delete",n:"red",onClick:Y=>pe(r.key,void 0)},{default:S(()=>[m(M,{icon:"i-carbon-trash-can"})]),_:2},1032,["onClick"])]))),128)),c("div",Zt,[m(T,{modelValue:e(z).key,"onUpdate:modelValue":l[4]||(l[4]=r=>e(z).key=r),placeholder:"Key",n:"primary","flex-1":""},null,8,["modelValue"]),m(T,{modelValue:e(z).value,"onUpdate:modelValue":l[5]||(l[5]=r=>e(z).value=r),placeholder:"Value",n:"primary","flex-1":""},null,8,["modelValue"]),m(f,{title:"Add",n:"primary",onClick:l[6]||(l[6]=r=>pe(e(z).key,e(z).value))},{default:S(()=>[m(M,{icon:"i-carbon-save"})]),_:1})])])):O("",!0),m(e(y),null,{default:S(()=>[m(Ce,{modelValue:e(ne),"onUpdate:modelValue":l[9]||(l[9]=r=>Z(ne)?ne.value=r:null),default:{active:!0,type:"string"},"max-h-xs":"","of-auto":""},{default:S(()=>[e(C)[e(p)]?.length?(i(),b(L,{key:0},[c("div",eo,[to,oo,m(f,{icon:"i-carbon-edit",border:!1,onClick:l[7]||(l[7]=r=>o("open-default-input"))}),no]),m(Ce,{modelValue:e(C)[e(p)],"onUpdate:modelValue":l[8]||(l[8]=r=>e(C)[e(p)]=r),disabled:"",p0:""},null,8,["modelValue"])],64)):O("",!0)]),_:1},8,["modelValue"])]),_:1}),e(p)==="snippet"?(i(),b("div",so,[e(we).length?(i(),$(ze,{key:0,"code-snippets":e(we)},null,8,["code-snippets"])):O("",!0)])):e(ne)?(i(),b("div",ao,[e(p)==="body"?(i(),b(L,{key:0},[c("div",ro,[(i(),b(L,null,G(oe,r=>c("button",{key:r,px4:"",py2:"",border:"r base",hover:"bg-active",class:B({"border-b":r!==e(W)}),onClick:Y=>W.value=r},[c("div",{class:B({op30:r!==e(W)}),"font-mono":""},U(r),3)],10,lo)),64)),io]),e(W)==="input"?(i(),$(e(v),{key:0})):e(W)==="json"?(i(),$(e(St),dt({key:1,modelValue:e(V),"onUpdate:modelValue":l[10]||(l[10]=r=>Z(V)?V.value=r:null),class:[e(d)==="dark"?"jse-theme-dark":"light","json-editor-vue of-auto text-sm outline-none"]},s.$attrs,{mode:"text","navigation-bar":!1,indentation:2,"tab-size":2}),null,16,["modelValue","class"])):O("",!0)],64)):(i(),$(e(v),{key:1}))])):O("",!0),e(P)?e(F)?(i(),$(Je,{key:5,"z-10":"","flex-auto":"","backdrop-blur":""},{default:S(()=>[Q(" Fetching... ")]),_:1})):(i(),b(L,{key:6},[c("div",uo,[co,e(u).error?(i(),$(me,{key:0,n:"red"},{default:S(()=>[Q(" Error ")]),_:1})):O("",!0),m(me,{n:e(u).error?"orange":"green",textContent:U(e(u).statusCode)},null,8,["n","textContent"]),e(u).contentType?(i(),b("code",po,U(e(u).contentType),1)):O("",!0),e(u).contentType==="application/json"?(i(),$(We,{key:2,getter:()=>({input:e(I)})},null,8,["getter"])):O("",!0),fo,mo,m(me,{n:"green"},{default:S(()=>[Q(U(e(u).fetchTime)+" ms ",1)]),_:1})]),e(j)==="pdf"?(i(),b("div",vo,[c("div",ho,[c("object",{data:e(I),type:"application/pdf","flex-auto":"",width:"100%",height:"100%",rounded:""},null,8,yo)])])):e(j)!=="media"?(i(),$(Ke,{key:1,"flex-auto":"","overflow-auto":"","py-2":"",code:e(I),lang:e(j)},null,8,["code","lang"])):(i(),b("div",_o,[c("div",go,[e(u).contentType.includes("image")?(i(),b("img",{key:0,rounded:"",src:e(I)},null,8,bo)):(i(),b("video",ko,[c("source",{src:e(I),type:"video/mp4"},null,8,wo)]))])]))],64)):(i(),$(Ge,{key:4},{default:S(()=>[m(f,{n:"primary",onClick:ke},{default:S(()=>[m(M,{icon:"carbon:send"}),Q(" Send request ")]),_:1})]),_:1}))])}}}),xo={flex:"~ gap1","text-sm":""},So={key:0,op50:""},To={op50:""},$o=c("span",{op75:""},"Select a route to start",-1),Ro=c("div",{p4:"",border:"b base"},[c("span",{"text-lg":""},"Default Inputs"),c("br"),c("span",{"text-white":"",op50:""},"Merged as default for every request in DevTools")],-1),Ho=ye({__name:"server-routes",setup(t){const a=A(!1),n=vt(),o=Re(),{selectedRoute:y,view:v,inputDefaults:d}=Ve("serverRoutes"),h=D(()=>{!o.value&&y.value&&(o.value=y.value.filepath);const x=n.value?.find(w=>w.filepath===o.value);return o.value!==y.value?.filepath&&x&&(y.value=x),x}),_=A(""),u=D(()=>new ht(n.value||[],{keys:["method","route"],shouldSort:!0})),j=D(()=>n.value?_.value?u.value.search(_.value).map(w=>w.item):n.value:[]),I=D(()=>{const x=[],w=(g,R)=>{g.routes=g.routes||[],g.routes.push(R)},N=(g,R)=>{const k=R?R.routes?.find(C=>C.route===g):x.find(C=>C.route===g);if(k)return k;const V={route:g,filepath:g.replace(/\W/g,"-").toLowerCase(),type:"collection",routes:[]};return R?w(R,V):x.push(V),V};return j.value.forEach(g=>{let R,k;const V=g.filepath.split("/"),C=V.slice(V.indexOf("server")+1);if(g.type==="runtime"){C[0]="runtime";const H=V.indexOf("dist");H!==-1&&(R=V[H-1],R&&C.splice(1,0,R))}C.length>0&&C[C.length-1].includes(".")&&C.pop(),C.forEach(H=>{k=N(H,k)}),k?w(k,g):x.push(g)}),x});function F(){v.value=v.value==="tree"?"list":"tree"}function P(x){return x.charAt(0).toUpperCase()+x.slice(1)}return(x,w)=>{const N=Ue,g=bt,R=Pe,k=Co,V=gt,C=Oe,H=yt,J=Le,ue=Tt,ce=$t,te=Ie("tooltip");return i(),b(L,null,[m(H,{"storage-key":"tab-server-routes"},{left:S(()=>[m(g,{search:e(_),"onUpdate:search":w[1]||(w[1]=p=>Z(_)?_.value=p:null),pb2:""},{actions:S(()=>[ee(m(N,{"text-lg":"",icon:e(v)==="list"?"i-carbon-list":"i-carbon-tree-view-alt",title:"Toggle view",border:!1,onClick:F},null,8,["icon"]),[[te,"Toggle View"]]),ee(m(N,{"text-lg":"",icon:"i-carbon-cics-sit-overrides",title:"Default Inputs",border:!1,onClick:w[0]||(w[0]=p=>a.value=!e(a))},null,512),[[te,"Default Inputs"]])]),default:S(()=>[c("div",xo,[e(_)?(i(),b("span",So,U(e(j).length)+" matched · ",1)):O("",!0),c("span",To,U(e(n)?.length)+" routes in total",1)])]),_:1},8,["search"]),(i(!0),b(L,null,G(e(v)==="tree"?e(I):e(j),p=>(i(),$(R,{key:p.filepath,item:p},null,8,["item"]))),128))]),right:S(()=>[(i(),$(_t,{max:10},[e(h)?(i(),$(k,{key:e(h).filepath,route:e(h),onOpenDefaultInput:w[2]||(w[2]=p=>a.value=!0)},null,8,["route"])):O("",!0)],1024)),e(h)?O("",!0):(i(),$(C,{key:0},{default:S(()=>[m(V,{px6:"",py2:""},{default:S(()=>[$o]),_:1})]),_:1}))]),_:1}),m(ce,{modelValue:e(a),"onUpdate:modelValue":w[3]||(w[3]=p=>Z(a)?a.value=p:null),"auto-close":"","max-w-xl":"","min-w-xl":"",onClose:w[4]||(w[4]=p=>a.value=!1)},{default:S(()=>[c("div",null,[Ro,(i(!0),b(L,null,G(Object.keys(e(d)),p=>(i(),$(ue,{key:p,text:`${P(p)} ${e(d)[p].length?`(${e(d)[p].length})`:""}`,padding:!1,icon:("ServerRouteTabIcons"in x?x.ServerRouteTabIcons:e(Ae))[p]},{default:S(()=>[m(J,{modelValue:e(d)[p],"onUpdate:modelValue":oe=>e(d)[p]=oe,py0:"",default:{active:!0,type:"string"}},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["text","icon"]))),128))])]),_:1},8,["modelValue"])],64)}}});export{Ho as default};
@@ -1 +0,0 @@
1
- {"id":"a69820c2-31c2-48f6-8161-842a62467079","timestamp":1724173134315,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}