import{_ as S}from"./duration-display.vue-ntmie59a.js";import{a6 as T,a7 as F,Q as V}from"./howhlbef.js";import{k as $,b as H,l as w,R as u,U as h,V as o,a7 as l,Z as p,F as y,ac as B,a6 as m,Y as D,u as k,a1 as _,N as C,a0 as f,X as N}from"./vendor/json-editor-vue-gplv2x2n.js";import{_ as P}from"./nsection-block-k1t09ceo.js";import{_ as E}from"./help-fab.vue-fg8ssgz8.js";import"./vendor/unocss-fbcdcfn2.js";import"./vendor/shiki-enrzjv18.js";import"./nicon-title.vue-eldi1nlv.js";const O={"w-full":""},j={border:"b base"},L={"select-none":"","ws-nowrap":"",p1:"","text-right":"","font-bold":""},Y={colspan:"2",p1:"",pl5:"","text-left":"","font-bold":""},z={"ws-nowrap":"",p1:"","text-center":"","font-bold":""},A={"ws-nowrap":"",p1:"","text-center":"","font-bold":""},R={"ws-nowrap":"",p1:"","text-right":"","font-bold":""},U={"w-0":"","ws-nowrap":"","text-center":"","text-sm":"",op25:""},Q={"text-sm":""},X={"ws-nowrap":""},Z={"text-sm":""},q={"w-0":"","text-center":"","text-sm":""},G={"w-0":"","text-center":"","text-sm":""},J={"w-0":"","text-right":"","text-sm":""},K=$({__name:"HooksTable",props:{hooks:{}},setup(x){const a=x,r=H("duration"),n=H("asc"),c={duration:(e,t)=>(t.duration??Number.POSITIVE_INFINITY)-(e.duration??Number.POSITIVE_INFINITY),name:(e,t)=>e.name.localeCompare(t.name),listener:(e,t)=>t.listeners-e.listeners,start:(e,t)=>t.start-e.start,executions:(e,t)=>t.executions.length-e.executions.length},g=w(()=>a.hooks.map(e=>e.start).sort((e,t)=>e-t)),b=w(()=>{const e=c[r.value],t=[...a.hooks].sort(e);return n.value==="desc"&&t.reverse(),t});function d(e){const t=e.split(":");return t.length===1?"":`${t[0]}:`}function v(e){const t=e.split(":");return t.length===1?e:t.slice(1).join(":")}function i(e){r.value===e?n.value=n.value==="asc"?"desc":"asc":r.value=e}return(e,t)=>{const I=S;return u(),h("table",O,[o("thead",j,[o("tr",null,[o("th",L,[o("button",{onClick:t[0]||(t[0]=s=>i("start"))},[t[5]||(t[5]=l(" Order ")),o("div",{"ml--1":"","text-xs":"",class:p([r.value==="start"?"op50":"op0",n.value==="asc"?"carbon-arrow-down":"carbon-arrow-up"])},null,2)])]),o("th",Y,[o("button",{onClick:t[1]||(t[1]=s=>i("name"))},[t[6]||(t[6]=l(" Hook name ")),o("div",{"ml--1":"","text-xs":"",class:p([r.value==="name"?"op50":"op0",n.value==="asc"?"carbon-arrow-down":"carbon-arrow-up"])},null,2)])]),o("th",z,[o("button",{onClick:t[2]||(t[2]=s=>i("listener"))},[t[7]||(t[7]=l(" Listeners ")),o("div",{"ml--1":"","text-xs":"",class:p([r.value==="listener"?"op50":"op0",n.value==="asc"?"carbon-arrow-down":"carbon-arrow-up"])},null,2)])]),o("th",A,[o("button",{onClick:t[3]||(t[3]=s=>i("executions"))},[t[8]||(t[8]=l(" Executions ")),o("div",{"ml--1":"","text-xs":"",class:p([r.value==="executions"?"op50":"op0",n.value==="asc"?"carbon-arrow-down":"carbon-arrow-up"])},null,2)])]),o("th",R,[o("button",{onClick:t[4]||(t[4]=s=>i("duration"))},[t[9]||(t[9]=l(" Duration ")),o("div",{"ml--1":"","text-xs":"",class:p([r.value==="duration"?"op50":"op0",n.value==="asc"?"carbon-arrow-down":"carbon-arrow-up"])},null,2)])])])]),o("tbody",null,[(u(!0),h(y,null,B(b.value,s=>(u(),h("tr",{key:s.name,border:"b dashed transparent hover:base"},[o("td",U,m(g.value.indexOf(s.start)),1),o("td",{"w-0":"","ws-nowrap":"","text-right":"",style:D({color:("getHashColorFromString"in e?e.getHashColorFromString:k(T))(d(s.name))})},[o("code",Q,m(d(s.name)),1)],4),o("td",X,[o("code",Z,m(v(s.name)),1)]),o("td",q,m(s.listeners),1),o("td",G,m(s.executions.length+1),1),o("td",J,[_(I,{duration:s.duration},null,8,["duration"])])]))),128))])])}}}),M={class:"markdown-body"},W={__name:"hooks",setup(x,{expose:a}){return a({frontmatter:{}}),(n,c)=>(u(),h("div",M,c[0]||(c[0]=[o("h1",null,"Hooks",-1),o("p",null,[l("Hooks are an advanced API which can be used for module development or other advanced use cases. The hooking API can be used to expand almost every aspect of Nuxt. Under the hood it is powered by "),o("a",{href:"https://github.com/unjs/hookable",target:"_blank",rel:"noopener"},"unjs/hookable"),l(".")],-1),o("p",null,[o("a",{href:"https://nuxt.com/docs/guide/going-further/hooks",target:"_blank",rel:"noopener"},"Learn more about hooks"),l(".")],-1)])))}},it=$({__name:"hooks",setup(x){const a=F(),r=V(),n=w(()=>r.value?.metrics.clientHooks());return(c,g)=>{const b=K,d=P,v=W,i=E;return u(),h(y,null,[o("div",null,[n.value?.length?(u(),C(d,{key:0,icon:"carbon-ibm-cloud-direct-link-1-dedicated-hosting",text:"Client Hooks",description:`Total hooks: ${n.value.length}`,padding:"pl4 pr6"},{default:f(()=>[_(b,{hooks:n.value},null,8,["hooks"])]),_:1},8,["description"])):N("",!0),k(a)?.length?(u(),C(d,{key:1,icon:"carbon-ibm-cloud-direct-link-2-dedicated",text:"Server Hooks",description:`Total hooks: ${k(a)?.length}`,padding:"pl4 pr6"},{default:f(()=>[_(b,{hooks:k(a)},null,8,["hooks"])]),_:1},8,["description"])):N("",!0)]),_(i,null,{default:f(()=>[_(v)]),_:1})],64)}}});export{it as default};
