import{C as e,Ct as t,E as n,Mt as r,Qt as i,V as a,W as o,Y as s,Z as c,_ as l,c as u,dt as d,g as f,h as p,m,tn as h,v as g,w as _}from"./vendor/json-editor-vue-eojr4v24.js";import{M as v,j as y}from"./ready-dadbdj5i.js";import{C as b,b as x,h as S,w as C,x as w}from"./utils-jupbrzo6.js";import{a as T,l as E,o as D,r as O}from"./client-nwyjxodt.js";import{n as ee}from"./dev-auth-he0eye7r.js";import"./vendor/shiki-lqo1hg2n.js";import"./storage-options-nzog3hhp.js";import"./nuxt-link-bumooa9d.js";import{t as k}from"./_plugin-vue_export-helper-n58akrbk.js";import"./nicon-m1crov2l.js";import{t as A}from"./nbutton-gygn07c2.js";import"./ncard-ludmyw2u.js";import"./state-routes-jownks2o.js";import"./telemetry-c77tnag3.js";import"./npanel-grids-onrho735.js";import{t as j}from"./ntext-input-e8iut2en.js";import{d as M,u as N}from"#entry";import"./client-im47u3kz.js";import{t as P}from"./composables-b2ccklz4.js";import{t as F}from"./filepath-item-h3i1tz3s.js";import{t as te}from"./help-fab-oeo4c53s.js";import"./nicon-title-kbrt9te7.js";import{t as I}from"./nsection-block-ibsk9arc.js";import{t as L}from"./nbadge-f1bvtlf5.js";import"./nmarkdown-ciogo2e3.js";import{t as R}from"./launch-page-h3hu9uqw.js";var z={block:``,"cursor-pointer":``},B={p2:``},V=[`onSubmit`],H={flex:`~`,"items-center":``,p2:``,"text-sm":``,"font-mono":``},U={key:1},W=n({__name:`RoutePathItem`,props:{route:{}},emits:[`navigate`],setup(n,{emit:r}){let a=n,y=r,b=/(:\w+[?*]?(?:\(\))?)/,x=/\(\)$/,S=/\/+/g,C=t([]),w=m(()=>{let e=T(a.route.path);return C.value=Array.from({length:e.length}).fill(``),e});function T(e){return e.split(b).filter(Boolean).map(e=>e[0]===`:`?e.replace(x,`?`):e)}let E=m(()=>w.value.map((e,t)=>e[0]===`:`?C.value[t]:e).join(``).replace(S,`/`)),D=m(()=>a.route.path.includes(`:`));function O(){y(`navigate`,E.value)}return(t,r)=>{let a=j,m=A,y=c(`VDropdown`);return D.value?(o(),f(y,{key:1},{popper:d(({hide:t})=>[p(`div`,B,[p(`form`,{flex:`~ col`,onSubmit:v(()=>{O(),t()},[`prevent`])},[D.value?(o(),g(u,{key:0},[r[0]||=p(`div`,{px2:``,"text-sm":``,op50:``},` Fill params and navigate: `,-1),p(`div`,H,[(o(!0),g(u,null,s(w.value,(e,t)=>(o(),g(u,{key:t},[e[0]===`:`?(o(),f(a,{key:0,modelValue:C.value[t],"onUpdate:modelValue":e=>C.value[t]=e,"w-20":``,"n-sm":``,placeholder:e.slice(1)},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`])):(o(),g(`span`,U,h(e),1))],64))),128))])],64)):l(``,!0),_(m,{type:`submit`,block:``,n:`primary`},{default:d(()=>[...r[1]||=[e(` Navigate `,-1)]]),_:1})],40,V)])]),default:d(()=>[p(`code`,z,[(o(!0),g(u,null,s(w.value,(e,t)=>(o(),g(`span`,{key:t,class:i(e[0]===`:`?`text-gray border border-dashed rounded border-gray:50 px1`:``)},h(e[0]===`:`?e.slice(1):e),3))),128))])]),_:1})):(o(),g(`button`,{key:0,onClick:O},[p(`code`,null,h(n.route.path),1)]))}}}),G=Object.assign(W,{__name:`RoutePathItem`}),K={"max-w-full":``,"of-auto":``},q={"w-full":``},J={"w-20":``,"pr-1":``},Y={flex:``,"items-center":``,"justify-end":``},X={"text-sm":``},Z={flex:`inline gap3`,"items-center":``},Q={flex:`~ gap1`,pr2:``,op0:``,"group-hover:op100":``},ne=[`onClick`],re=[`onClick`],ie={"w-0":``,"ws-nowrap":``,"pr-1":``,"text-left":``,"text-sm":``,"font-mono":``,op50:``},ae={"w-0":``,"ws-nowrap":``,"pr-1":``,"text-center":``,"text-sm":``,"font-mono":``,op50:``},oe={"w-0":``,"ws-nowrap":``,"text-center":``,"text-sm":``,"font-mono":``},se={key:0},ce=[`onClick`],le=n({__name:`RoutesTable`,props:{pages:{},layouts:{},matched:{},matchedPending:{}},emits:[`navigate`],setup(e){let t=e,n=M(),a=b(),c=N(),d=m(()=>t.pages.toSorted((e,t)=>e.path.localeCompare(t.path)));function v(e){let r=t.layouts.find(t=>t.name===e);r&&n(r.file)}function y(e){if(typeof e==`string`)return a.value?.middleware.find(t=>t.name===e)?.path}return(t,a)=>{let m=L,b=G,x=F;return o(),g(`div`,K,[p(`table`,q,[a[4]||=p(`thead`,{border:`b base`},[p(`tr`,null,[p(`th`,{"text-left":``}),p(`th`,{"text-left":``},` Route Path `),p(`th`,{"text-left":``},` Name `),p(`th`,{"text-left":``},` Middleware `),p(`th`,null,` Layout `)])],-1),p(`tbody`,null,[(o(!0),g(u,null,s(d.value,s=>(o(),g(`tr`,{key:s.name,class:`group`,"h-7":``,border:`b dashed transparent hover:base`},[p(`td`,J,[p(`div`,Y,[e.matched.find(e=>e.name===s.name)?(o(),f(m,{key:0,n:`green`,title:`active`,textContent:`active`})):e.matchedPending.find(e=>e.name===s.name)?(o(),f(m,{key:1,n:`teal`,title:`next`,textContent:`next`})):l(``,!0)])]),p(`td`,X,[p(`div`,Z,[_(b,{route:s,class:i(e.matched.find(e=>e.name===s.name)?`text-primary`:e.matchedPending.find(e=>e.name===s.name)?`text-teal`:``),"ws-nowrap":``,onNavigate:a[0]||=e=>t.$emit(`navigate`,e)},null,8,[`route`,`class`]),p(`div`,Q,[s.file||s.meta?.file?(o(),g(`button`,{key:0,"text-sm":``,op40:``,hover:`op100 text-primary`,title:`Open in editor`,onClick:e=>r(n)(s.file||s.meta?.file)},[...a[2]||=[p(`div`,{"i-carbon-script-reference":``},null,-1)]],8,ne)):l(``,!0),s.file||s.meta?.file?(o(),g(`button`,{key:1,"text-sm":``,op40:``,hover:`op100 text-primary`,title:`Copy path`,onClick:e=>r(c)(s.file||s.meta?.file)},[...a[3]||=[p(`div`,{"i-carbon-copy":``},null,-1)]],8,re)):l(``,!0)])])]),p(`td`,ie,h(s.name),1),p(`td`,ae,[_(x,{filepath:y(s.meta.middleware),override:`${s.meta.middleware||`-`}`},null,8,[`filepath`,`override`])]),p(`td`,oe,[s.meta.layout===!1?(o(),g(`span`,se,`-`)):s.meta.layout?(o(),g(`button`,{key:1,onClick:e=>v(s.meta.layout)},h(s.meta.layout),9,ce)):(o(),g(`button`,{key:2,"text-sm":``,op15:``,onClick:a[1]||=e=>v(`default`)},` (default) `))])]))),128))])])])}}}),ue=Object.assign(le,{__name:`RoutesTable`}),de={},fe={class:`markdown-body`};function pe(t,n){return o(),g(`div`,fe,[...n[0]||=[p(`template`,null,[p(`div`,{class:`markdown-body`},[p(`h1`,null,`Pages`),p(`p`,null,[e(`Nuxt provides a file-based routing to create routes within your web application using Vue Router under the hood. Pages are Vue components and can have any valid extension that Nuxt supports (by default .vue, .js, .jsx, .mjs, .ts or .tsx). Nuxt will automatically create a route for every page in your `),p(`code`,{"v-pre":``},`~/pages/`),e(` directory.`)]),p(`p`,null,[p(`a`,{href:`https://nuxt.com/docs/getting-started/routing`,target:`_blank`,rel:`noopener`},`Learn more in the documentation`)]),p(`hr`),p(`h2`,null,`Middlewares`),p(`p`,null,`Nuxt provides a customizable route middleware framework that can be used throughout the application. This is ideal for extracting code that needs to run before navigating to a particular route.`),p(`p`,null,[p(`a`,{href:`https://nuxt.com/docs/guide/directory-structure/middleware`,target:`_blank`,rel:`noopener`},`Learn more in the documentation`)])])],-1)]])}var me=k(de,[[`render`,pe]]),he={key:0,"h-full":``,"of-auto":``},ge={border:`b base`,flex:`~ col gap1`,"n-navbar-glass":``,px4:``,py3:``},_e={"font-mono":``},$={key:1,op50:``},ve={key:0,"text-orange":``,op75:``},ye={key:1,op50:``},be={"min-h-14":``},xe={key:1,class:`py-4 text-center`},Se={"w-full":``},Ce={mr1:``},we=n({__name:`pages`,setup(n){P({icon:`carbon-tree-view-alt`,title:`Pages`,show:()=>{let e=O();return()=>!!e.value},order:1});let c=D(),v=T(),k=C(),A=b(),M=x(),N=w(),z=m(()=>A.value?.middleware||[]),B=t(``),V=t(0),H=m(()=>(z.value,B.value,M.value,V.value,c.value?.currentRoute?.value?.path));a(()=>{v.value&&(B.value=c.value?.currentRoute?.value?.path),c.value?.beforeEach(e=>{B.value=e.fullPath}),c.value?.afterEach(e=>{B.value=e.fullPath})});async function U(){B.value!==c.value?.currentRoute?.value?.path&&c.value.push(B.value||`/`)}let W=m(()=>c.value.resolve(B.value||`/`).matched);function G(e){c.value.push(e),B.value=e}let K=S(),q=m(()=>`./${K===4?`app/`:``}pages/index.vue`);return(t,n)=>{let a=j,m=ue,b=I,x=L,S=F,C=R,w=me,T=te;return o(),g(u,null,[r(k)?.pages&&r(c)?(o(),g(`div`,he,[p(`div`,ge,[p(`div`,null,[H.value===B.value?(o(),g(`span`,$,`Current route`)):(o(),g(u,{key:0},[n[1]||=p(`span`,{op50:``},`Navigate from `,-1),p(`span`,_e,h(H.value),1),n[2]||=p(`span`,{op50:``},` to `,-1)],64))]),_(a,{modelValue:B.value,"onUpdate:modelValue":n[0]||=e=>B.value=e,"font-mono":``,icon:`carbon-direction-right-01 scale-y--100`,class:i(H.value===B.value?``:W.value.length?`text-green`:`text-orange`),onKeydown:y(U,[`enter`])},null,8,[`modelValue`,`class`]),p(`div`,null,[H.value===B.value?(o(),g(`span`,ye,`Edit path above to navigate`)):(o(),g(u,{key:0},[n[3]||=p(`span`,null,[e(`Press `),p(`b`,{"font-bold":``},`Enter`),e(` to navigate`)],-1),W.value.length?l(``,!0):(o(),g(`span`,ve,` (no match)`))],64))])]),_(b,{icon:`carbon-tree-view`,text:`Matched Routes`,padding:!1},{default:d(()=>[p(`div`,be,[W.value.length?(o(),f(m,{key:0,pages:W.value,layouts:r(M)||[],matched:r(v).matched,"matched-pending":W.value,onNavigate:G},null,8,[`pages`,`layouts`,`matched`,`matched-pending`])):(o(),g(`div`,xe,[...n[4]||=[p(`span`,{op50:``},`No routes matched`,-1)]]))])]),_:1}),_(b,{icon:`carbon-tree-view-alt`,text:`All Routes`,description:`${r(N).length} routes registered in your application`,padding:`pr5`},{default:d(()=>[_(m,{pages:r(N),layouts:r(M)||[],matched:r(v).matched,"matched-pending":W.value,onNavigate:G},null,8,[`pages`,`layouts`,`matched`,`matched-pending`])]),_:1},8,[`description`]),z.value.length?(o(),f(b,{key:0,icon:`carbon:ibm-watson-studio`,text:`Middleware`,description:`${z.value.length} middleware registered in your application`,padding:`px13`},{default:d(()=>[p(`table`,Se,[n[5]||=p(`thead`,{border:`b base`,"h-7":``},[p(`tr`,null,[p(`th`,{"text-left":``},` Name `),p(`th`,{"text-left":``},` Path `)])],-1),(o(!0),g(u,null,s(z.value,e=>(o(),g(`tr`,{key:e.path,"h-7":``},[p(`td`,null,[p(`span`,Ce,h(e.name),1),e.global?(o(),f(x,{key:0,n:`green`,title:`Registered at runtime as a global component`,textContent:`global`})):l(``,!0)]),p(`td`,null,[_(S,{filepath:e.path},null,8,[`filepath`])])]))),128))])]),_:1},8,[`description`])):l(``,!0)])):(o(),f(C,{key:1,icon:`carbon-tree-view-alt`,name:`wizard-pages`,title:`Nuxt Routing`,description:`Create ${q.value} to enable routing`,actions:[{label:`Learn more`,src:`https://nuxt.com/docs/getting-started/routing`,attrs:{n:`primary`}},{label:`Enable Routing`,async handle(){return(`rpc`in t?t.rpc:r(E)).runWizard(await(`ensureDevAuthToken`in t?t.ensureDevAuthToken:r(ee))(),`enablePages`)}}]},null,8,[`description`,`actions`])),_(T,null,{default:d(()=>[_(w)]),_:1})],64)}}});export{we as default};