1import{_ as E}from"./CBPBhA67.js";import{_ as I}from"./B6kSMQXm.js";import{_ as U,ax as z,r as v,o as F,e as t,a as s,b as o,i as g,w,f as u,t as d,g as a,s as b,x as M,F as y,l as f,q as H,h as P}from"./Doh7wyz3.js";import{u as T}from"./CFknkkSm.js";import"./CST-3RD9.js";import"./BTeyGgDR.js";const $={class:"menu-form-container flex"},j={class:"left-section w-1/2 pr-4"},D={class:"mb-4"},q={key:0,class:"text-red mt-1"},Q=["disabled"],A={key:0},G={key:1},J={key:0,class:"mt-2"},K={class:"list-disc pl-5"},O=["onClick"],W={key:1,class:"text-red mt-2"},X={class:"right-section w-1/2 pl-4"},Y={class:"mb-2"},Z={key:0,class:"text-gray-500 mt-1"},ee=["onClick"],te={key:0,class:"text-center py-2"},se={key:1,class:"flex items-center justify-center text-gray-500"},ne={__name:"[id]",setup(oe){const L=z(),e=T(),m=L.params.id,p=v(""),c=v(""),C=v(null),_=v(!1);F(async()=>{await e.fetchMenu(m),p.value=e.menu.name||""});const S=async()=>{await e.updateMenu(m,{name:p.value})},R=async i=>{e.menuLinks.some(n=>n.title===i.title)||(await e.addMenuLink(m,i.id),c.value="",e.searchResults=[],_.value=!1)},B=async i=>{await e.removeMenuLink(m,i)},N=i=>{const n=i.target,x=n.scrollHeight-n.scrollTop,h=n.clientHeight+50;x<=h&&e.nextPageUrl&&!e.isLoadingMore&&k()},k=()=>{e.loadMoreSearchResults(c.value)},V=()=>{_.value=!0,e.searchContents(c.value)};return(i,n)=>{const x=E,h=I;return s(),t("div",$,[o("div",j,[g(h,{class:"p-6"},{default:w(()=>{var r;return[o("title",null,"Edit Menu - "+d((r=a(e).menu)==null?void 0:r.name),1),g(x,{title:"Edit Menu"}),o("div",D,[b(o("input",{id:"menu-name","onUpdate:modelValue":n[0]||(n[0]=l=>p.value=l),type:"text",class:"form-input",placeholder:"Enter menu name",style:{width:"100%","max-width":"400px"}},null,512),[[M,p.value]]),a(e).errors.name?(s(),t("div",q,[(s(!0),t(y,null,f(a(e).errors.name,l=>(s(),t("span",{key:l},d(l),1))),128))])):u("",!0),o("button",{class:"btn mt-2 px-7 bg-new-blue",disabled:a(e).isLoading,onClick:H(S,["prevent"])},[a(e).isLoading?(s(),t("span",G,"Saving...")):(s(),t("span",A,"Edit name"))],8,Q)]),a(e).menuLinks.length>0?(s(),t("div",J,[n[3]||(n[3]=o("div",{class:"mb-1",style:{"font-size":"0.95rem","font-weight":"normal"}},"Current Menu Links:",-1)),o("ul",K,[(s(!0),t(y,null,f(a(e).menuLinks,l=>(s(),t("li",{key:l.id,class:"flex items-center justify-between mb-1"},[o("span",null,d(l.title),1),o("button",{class:"ml-2 text-red-500 hover:underline",onClick:ae=>B(l.id)},"Remove",8,O)]))),128))])])):u("",!0),a(e).errors.general?(s(),t("div",W,[(s(!0),t(y,null,f(a(e).errors.general,l=>(s(),t("span",{key:l},d(l),1))),128))])):u("",!0)]}),_:1})]),o("div",X,[g(h,{class:"p-6"},{default:w(()=>[n[5]||(n[5]=o("div",{class:"mb-2",style:{"font-weight":"normal","font-size":"1rem"}},"Menu Links",-1)),o("div",Y,[b(o("input",{"onUpdate:modelValue":n[1]||(n[1]=r=>c.value=r),onInput:V,onFocus:n[2]||(n[2]=r=>_.value=!0),type:"text",class:"form-input",placeholder:"Search for content to add as menu link...",style:{width:"100%","max-width":"400px"}},null,544),[[M,c.value]]),a(e).isSearching?(s(),t("div",Z,"Searching...")):u("",!0),_.value&&a(e).searchResults.length>0?(s(),t("div",{key:1,class:"border bg-admin-panel rounded shadow-sm mt-1",style:{"max-height":"200px","overflow-y":"auto"},onScroll:N,ref_key:"searchResultsBox",ref:C},[(s(!0),t(y,null,f(a(e).searchResults,r=>(s(),t("div",{key:r.id,class:"px-3 py-2 border-bottom cursor-pointer hover:bg-gray-100",onClick:l=>R(r)},[o("span",null,d(r.title),1)],8,ee))),128)),a(e).nextPageUrl?(s(),t("div",te,[a(e).isLoadingMore?(s(),t("span",se,n[4]||(n[4]=[o("svg",{class:"animate-spin h-5 w-5 mr-2 text-blue-500",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},[o("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"}),o("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v8z"})],-1),P(" Loading... ")]))):(s(),t("span",{key:0,class:"text-blue-500 cursor-pointer",onClick:k},"Load More"))])):u("",!0)],544)):u("",!0)])]),_:1,__:[5]})])])}}},me=U(ne,[["__scopeId","data-v-c2fd005b"]]);export{me as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.