import{_ as S}from"./alICnoxW.js";import{d as $,r as H,a as g,o as d,m as b,k as o,v as i,D as m,f as n,F as y,n as T,t as _,a7 as F,aJ as B,i as h,aK as D,ak as V,h as C,j as w,p as N}from"./zEcrVex8.js";import{_ as P}from"./CtHtR2Xl.js";import{_ as j}from"./tPM_oRvF.js";import"./anMKTYBY.js";const E={"w-full":""},O={border:"b base"},L={"select-none":"","ws-nowrap":"",p1:"","text-right":"","font-bold":""},z={colspan:"2",p1:"",pl5:"","text-left":"","font-bold":""},A={"ws-nowrap":"",p1:"","text-center":"","font-bold":""},Y={"ws-nowrap":"",p1:"","text-center":"","font-bold":""},J={"ws-nowrap":"",p1:"","text-right":"","font-bold":""},K={"w-0":"","ws-nowrap":"","text-center":"","text-sm":"",op25:""},R={"text-sm":""},U={"ws-nowrap":""},q={"text-sm":""},G={"w-0":"","text-center":"","text-sm":""},M={"w-0":"","text-center":"","text-sm":""},Q={"w-0":"","text-right":"","text-sm":""},W=$({__name:"HooksTable",props:{hooks:{}},setup(x){const l=x,a=H("duration"),s=H("asc"),u={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},v=g(()=>l.hooks.map(e=>e.start).sort((e,t)=>e-t)),k=g(()=>{const e=u[a.value],t=[...l.hooks].sort(e);return s.value==="desc"&&t.reverse(),t});function p(e){const t=e.split(":");return t.length===1?"":`${t[0]}:`}function f(e){const t=e.split(":");return t.length===1?e:t.slice(1).join(":")}function c(e){a.value===e?s.value=s.value==="asc"?"desc":"asc":a.value=e}return(e,t)=>{const I=S;return d(),b("table",E,[o("thead",O,[o("tr",null,[o("th",L,[o("button",{onClick:t[0]||(t[0]=r=>c("start"))},[t[5]||(t[5]=i(" Order ")),o("div",{"ml--1":"","text-xs":"",class:m([n(a)==="start"?"op50":"op0",n(s)==="asc"?"carbon-arrow-down":"carbon-arrow-up"])},null,2)])]),o("th",z,[o("button",{onClick:t[1]||(t[1]=r=>c("name"))},[t[6]||(t[6]=i(" Hook name ")),o("div",{"ml--1":"","text-xs":"",class:m([n(a)==="name"?"op50":"op0",n(s)==="asc"?"carbon-arrow-down":"carbon-arrow-up"])},null,2)])]),o("th",A,[o("button",{onClick:t[2]||(t[2]=r=>c("listener"))},[t[7]||(t[7]=i(" Listeners ")),o("div",{"ml--1":"","text-xs":"",class:m([n(a)==="listener"?"op50":"op0",n(s)==="asc"?"carbon-arrow-down":"carbon-arrow-up"])},null,2)])]),o("th",Y,[o("button",{onClick:t[3]||(t[3]=r=>c("executions"))},[t[8]||(t[8]=i(" Executions ")),o("div",{"ml--1":"","text-xs":"",class:m([n(a)==="executions"?"op50":"op0",n(s)==="asc"?"carbon-arrow-down":"carbon-arrow-up"])},null,2)])]),o("th",J,[o("button",{onClick:t[4]||(t[4]=r=>c("duration"))},[t[9]||(t[9]=i(" Duration ")),o("div",{"ml--1":"","text-xs":"",class:m([n(a)==="duration"?"op50":"op0",n(s)==="asc"?"carbon-arrow-down":"carbon-arrow-up"])},null,2)])])])]),o("tbody",null,[(d(!0),b(y,null,T(n(k),r=>(d(),b("tr",{key:r.name,border:"b dashed transparent hover:base"},[o("td",K,_(n(v).indexOf(r.start)),1),o("td",{"w-0":"","ws-nowrap":"","text-right":"",style:F({color:("getHashColorFromString"in e?e.getHashColorFromString:n(B))(p(r.name))})},[o("code",R,_(p(r.name)),1)],4),o("td",U,[o("code",q,_(f(r.name)),1)]),o("td",G,_(r.listeners),1),o("td",M,_(r.executions.length+1),1),o("td",Q,[h(I,{duration:r.duration},null,8,["duration"])])]))),128))])])}}}),X={class:"markdown-body"},Z={__name:"hooks",setup(x,{expose:l}){return l({frontmatter:{}}),(s,u)=>(d(),b("div",X,u[0]||(u[0]=[o("h1",null,"Hooks",-1),o("p",null,[i("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"),i(".")],-1),o("p",null,[o("a",{href:"https://nuxt.com/docs/guide/going-further/hooks",target:"_blank",rel:"noopener"},"Learn more about hooks"),i(".")],-1)])))}},tt=Z,at=$({__name:"hooks",setup(x){const l=D(),a=V(),s=g(()=>a.value?.metrics.clientHooks());return(u,v)=>{const k=W,p=P,f=tt,c=j;return d(),b(y,null,[o("div",null,[n(s)?.length?(d(),C(p,{key:0,icon:"carbon-ibm-cloud-direct-link-1-dedicated-hosting",text:"Client Hooks",description:`Total hooks: ${n(s).length}`,padding:"pl4 pr6"},{default:w(()=>[h(k,{hooks:n(s)},null,8,["hooks"])]),_:1},8,["description"])):N("",!0),n(l)?.length?(d(),C(p,{key:1,icon:"carbon-ibm-cloud-direct-link-2-dedicated",text:"Server Hooks",description:`Total hooks: ${n(l)?.length}`,padding:"pl4 pr6"},{default:w(()=>[h(k,{hooks:n(l)},null,8,["hooks"])]),_:1},8,["description"])):N("",!0)]),h(c,null,{default:w(()=>[h(f)]),_:1})],64)}}});export{at as default};
