PageSourceSearch

https://www.paranzabahamas.com/_nuxt/DzgX6YKb.js

js paranzabahamas.com collected 2026-10-08 20:19:32 UTC 343,151 bytes, 34 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./R1pSGarf.js","./C0-ObpPw.js","./Dbck8wS-.js","./Db2INZ8s.js","./g6Pe-GcS.js","./entry.DceknLk7.css","./DdlIcqBd.js","./B7wULUb7.js","./Dct_KJQB.js","./BD1vwDbI.js","./B84NlKPb.js","./VoixMedia.CfZt9KvM.css","./c75eq9WP.js","./D0yXgV6l.js","./DSGfSu3X.js","./Cep_f-g5.js","./B1vQfGIS.js","./B0F3qtjA.js","./BuBnjZQQ.js","./Du5Hzm5p.js","./zBsGsvEz.js","./Be9lfnVF.js","./BaahFP-Z.js","./3ga4_BCd.js","./CsTa2v5O.js","./D3cle-cX.js","./C-KwH-Wp.js","./DeWPRm8k.js","./AdministrationChrome.BkT3Wt25.css","./BCG-QFm9.js","./D-eqjcTu.js","./nd_XaKmo.js","./TextAreaInput.DF4MMSOG.css","./vue-multiselect.B5exX717.css","./YsoLYA_Z.js","./HvLC7SRa.js","./BJygSnwv.js","./DXEzYd3s.js","./BSjT9jLE.js","./Translate.CeXtUD95.css","./0w2kIG-I.js","./Bg4o2jQg.js","./B-oqqURL.js","./D8tWI3a8.js","./Y_PPizXI.js","./C0duSUat.js","./B34BujDK.js","./CSNEyELR.js","./Bzib70nc.js","./BS0Hk2-S.js","./useMediaManagerInjections.9ZQHIuZO.css","./vjTSGKTt.js","./CT1npWFg.js","./C7wVCAV3.js","./Bwcpf2wS.js","./DP9vVWr-.js","./HCgHWgFM.js","./DpEu6QPk.js","./BP1NuPPQ.js","./useDraggable.ISMXbuIA.css","./VoixTable.BQSP0o1y.css","./Cw10QwIE.js","./BTHey6BN.js","./EiBQb1iQ.js","./WysiwygEditor.DAMmcWAQ.css","./DMADZucn.js","./Bx1UdBN7.js","./JdNChNxf.js","./CLl55fXj.js","./Editor.CzaTAR_r.css","./tcgpm9iK.js","./DQB-BwnF.js","./CG1K1mPb.js","./B3dBiMBL.js","./Editor.DyQpwaz1.css","./BEiuURPm.js","./Editor.BpaI5rPp.css","./C4LHjBzN.js","./Editor.CkpiAsGl.css","./BOvsuBf2.js","./Editor.e5a_d2g8.css","./Cu3LCRB1.js","./Editor.BrKXQZVA.css","./C-6fpRs1.js","./DjRMqvUG.js","./Editor.D-Pi1XU4.css","./Bd2za2Iw.js","./CIJRsord.js","./BSKnD9WB.js","./DlH4dmoe.js","./Editor.CG600J7y.css","./DX_Ze6nC.js","./Bf0SV2xR.js","./Bql5vTWA.js","./CxJYGfdt.js","./BgL9HCVW.js","./DsV704Ac.js","./CGgD-l7n.js","./CoP4L1Z1.js","./CCRYpa1v.js","./yJvzLjmX.js","./C4DL7S0g.js","./D_S87WtP.js","./JRXbdKpi.js","./CpAcgmnH.js","./PageNavigationElements.B5wo5eUM.css","./B2yH2K1W.js","./Dqhp0rFF.js","./CCHjiDyj.js","./BRRjjyFL.js","./D8VimYFM.js","./DlF5TF1O.js","./EpbhEQDJ.js","./CcfgYqHS.js","./JSU7MQGC.js","./BHWDdjA0.js","./C8RvvILk.js","./BmncUh0D.js","./CP9F0n-J.js","./D4kCUfve.js"])))=>i.map(i=>d[i]);
2import{$ as _e,O as Tt,au as Le,a8 as bn,H as It,S as Se,U as Oe,R as qe,t as Ze,E as tt,dl as hn,X as Vt,T as yt,Y as to,aD as ge,ay as Yt,_ as Je,P as Ke,dm as yn,av as Ut,N as wn,M as Kt,bt as Jt,bb as kn,bu as _n,aA as no,b8 as oo,dn as $n,dp as io}from"./Dbck8wS-.js";import{w as we,o as ze,c as Rt,i as o,e as s,f as e,t as C,g as _,U as ce,N as ue,_ as $e,Z as Pt,P as le,Q as fe,S as Ee,r as $,d as h,j as k,q as ee,M as je,R as Qt,u as N,v as se,E as xt,n as nt,m as Ie,k as pe,L as ht,V as vt,a2 as xe,a3 as Sn,B as Cn,s as Gt,a6 as bt,O as Et,p as Ht,I as so,a4 as Pn,l as At,A as En,a7 as ao,a9 as lo,af as ro,T as Ot,J as ln,a8 as Zt,ai as uo,K as co}from"./Db2INZ8s.js";import{_ as rn}from"./BaahFP-Z.js";import{_ as pt,S as zt}from"./Cep_f-g5.js";import{_ as Tn}from"./3ga4_BCd.js";import{A as In,V as ct}from"./CsTa2v5O.js";import{_ as po,a as Mt}from"./BCG-QFm9.js";import{A as An}from"./D-eqjcTu.js";import{D as Ue,L as vo,T as mo}from"./nd_XaKmo.js";import{useLayoutStore as wt}from"./YsoLYA_Z.js";import{i as go,g as xo,x as fo,y as dn}from"./B7wULUb7.js";import{u as ft}from"./HvLC7SRa.js";import{d as Wt}from"./BJygSnwv.js";import{u as en,g as Vn,a as Xt,A as bo,b as Rn,f as Ln}from"./DXEzYd3s.js";import{u as ho}from"./0w2kIG-I.js";import{u as Mn}from"./Du5Hzm5p.js";import{u as Lt}from"./zBsGsvEz.js";import{u as Dn}from"./D8tWI3a8.js";import{_ as yo}from"./D3cle-cX.js";import{u as wo}from"./B0F3qtjA.js";import{_ as Fn}from"./Y_PPizXI.js";import{L as jt}from"./vjTSGKTt.js";import{d as ko,b as jn,c as On,u as _o,g as un}from"./CT1npWFg.js";import{u as tn,a as $o}from"./C7wVCAV3.js";import{u as zn}from"./B84NlKPb.js";import{e as So,f as Co,l as Po,h as Eo}from"./Bwcpf2wS.js";import{_ as To}from"./DP9vVWr-.js";import{V as Io}from"./DpEu6QPk.js";import{S as Un}from"./DSGfSu3X.js";import{u as Ao}from"./B1vQfGIS.js";import{a as Vo}from"./Cw10QwIE.js";import{usePresenceStore as Ro}from"./DeWPRm8k.js";import{u as Lo}from"./DMADZucn.js";import{c as Mo}from"./JdNChNxf.js";import{S as cn,f as Do,a as Fo,s as jo}from"./BuBnjZQQ.js";import{q as pn}from"./CLl55fXj.js";const Oo=25,zo={.4:"blue",.6:"cyan",.7:"lime",.8:"yellow",1:"red"};function Uo(t){const n=t.getContext("2d");if(!n)throw new Error("createHeatmap: 2d context unavailable");let i=[],r=1,u=null,c=0,a=null;function p(b,f){const l=document.createElement("canvas"),w=l.getContext("2d"),x=b+f;l.width=l.height=x*2,w.shadowOffsetX=w.shadowOffsetY=x*2,w.shadowBlur=f,w.shadowColor="black",w.beginPath(),w.arc(-x,-x,b,0,Math.PI*2,!0),w.closePath(),w.fill(),u=l,c=x}function v(b){const f=document.createElement("canvas"),l=f.getContext("2d"),w=l.createLinearGradient(0,0,0,256);f.width=1,f.height=256;for(const x in b)w.addColorStop(Number(x),b[x]);l.fillStyle=w,l.fillRect(0,0,1,256),a=l.getImageData(0,0,1,256).data}function d(b,f){for(let l=0,w=b.length;l<w;l+=4){const x=b[l+3]*4;x&&(b[l]=f[x],b[l+1]=f[x+1],b[l+2]=f[x+2])}}const m={data(b){return i=b,m},max(b){return r=b,m}
2,radius(b,f=15){return p(b,f),m},gradient(b){return v(b),m},clear(){return n.clearRect(0,0,t.width,t.height),m},draw(b=.05){u||p(Oo,15),a||v(zo),n.clearRect(0,0,t.width,t.height);for(const l of i)n.globalAlpha=Math.min(Math.max(l[2]/r,b),1),n.drawImage(u,l[0]-c,l[1]-c);const f=n.getImageData(0,0,t.width,t.height);return d(f.data,a),n.putImageData(f,0,0),m}};return m}const qo={class:"bg-white rounded-lg shadow-xl w-[95vw] max-w-7xl h-[92vh] flex flex-col overflow-hidden"},No={class:"flex items-center justify-between px-6 py-4 border-b border-gray-200"},Bo={class:"flex items-center gap-4"},Go={key:0,class:"text-xs text-gray-500"},Ho={class:"flex items-center gap-3"},Wo={class:"flex items-center gap-1 text-xs text-gray-500 mr-4"},Xo={class:"tabular-nums whitespace-nowrap text-right"},Yo={class:"flex items-center gap-1 text-xs text-gray-500"},Ko=["value"],Jo={class:"flex items-center gap-1 text-xs text-gray-500"},Qo=["value"],Zo=["value"],ei={key:0,class:"h-full flex items-center justify-center"},ti={key:1,class:"h-full flex flex-col items-center justify-center text-center py-20 px-8"},ni={class:"text-sm text-gray-500 max-w-md"},oi=["src","width","height"],ii={key:3,class:"absolute top-20 left-1/2 -translate-x-1/2 bg-white bg-opacity-95 rounded px-3 py-1 text-xs text-gray-500 shadow z-10"},si={__name:"AnalyticsHeatmapModal",props:{pagePath:{type:String,required:!0}},setup(t){const n=t,i=/\/$/,r=Tt(),u=$([]),c=$(!1),a=$(""),p=$(null);let v=null;const d=$(null),m=$(null),b=$(0),f=$("-30d"),l=[{label:"Last 7 days",value:"-7d"},{label:"Last 30 days",value:"-30d"},{label:"Last 90 days",value:"-90d"}],w=$("click"),x=[{label:"Clicks",value:"click"},{label:"Rageclicks",value:"rageclick"},{label:"Dead clicks",value:"deadclick"},{label:"Mouse moves",value:"mousemove"},{label:"Scroll depth",value:"scrolldepth"}],L=h(()=>w.value==="scrolldepth"),j=h(()=>{switch(w.value){case"click":return"click points";case"rageclick":return"rageclick points";case"deadclick":return"dead click points";case"mousemove":return"mouse move points";case"scrolldepth":return"scroll buckets";default:return"points"}}),R=[{label:"320 px (mobile)",value:320},{label:"375 px (mobile)",value:375},{label:"425 px (mobile)",value:425},{label:"768 px (tablet)",value:768},{label:"1024 px (laptop)",value:1024},{label:"1440 px (desktop)",value:1440},{label:"1920 px (desktop)",value:1920}],M=$(1440),I=$(.9),F=h(()=>{const E=M.value,g=I.value;return{min:Math.max(0,Math.round(E*g)),max:Math.round(E*(2-g))}}),V=h(()=>{const E=String(r.public?.voix?.heatmapIframeOrigin??"");if(E)return E.replace(i,"");const g=String(r.public?.voixDomain??"");return g?`https://${g}`:""}),H=h(()=>!V.value||!n.pagePath?"":`${V.value}${n.pagePath}`);async function P(){c.value=!0,a.value="";try{const g=(await _e("/api/_voix/analytics/heatmap",{method:"POST",body:{pathname:n.pagePath,date_from:f.value,viewport_width_min:F.value.min,viewport_width_max:F.value.max,type:w.value}}))?.results||[];u.value=g}catch{a.value="We couldn't load a heatmap for this page right now. This usually means we haven't collected enough data yet, or the page URL doesn't match a tracked URL. Please try again later.",u.value=[]}finally{c.value=!1}}const Q=h(()=>{if(!u.value.length)return 2e3;const E=Math.max(...u.value.map(g=>Number(g.pointer_y)||0));return Math.max(2e3,Math.ceil(E)+500)}),X=h(()=>!b.value||!M.value?1:Math.min(1,b.value/M.value));function ne(){const E=p.value;if(!E)return;const g=M.value,y=Q.value;if(E.width!==g&&(E.width=g),E.height!==y&&(E.height=y),L.value){G(E);return}v||(v=Uo(E));const A=v,J=w.value==="mousemove"?15:30;if(A.radius(J,Math.round(J*.83)),A.gradient({.25:"rgb(0, 0, 255)",.55:"rgb(0, 255, 0)",.85:"yellow",1:"red"}),!u.value.length){A.clear().draw(0);return}const D=M.value,U=u.value.map(T=>[Math.round((T.pointer_relative_x??0)*D),Math.round(Number(T.pointer_y)||0),Number(T.count)||1]).filter(T=>T[0]>=0&&T[1]>=0),O=U.reduce((T,K)=>Math.max(T,K[2]),0);A.data(U).max(O||1).draw(.05)}function G(E){v=null;const g=E.getContext("2d");if(!g||(g.clearRect(0,0,E.width,E.height),!u.value.length))return;const y=u.value.map(U=>({y:Math.round(Number(U.scroll_depth_bucket??U.pointer_y)||0),count:Number(U.cumulative_count??U.count)||0})).filter(U=>U.y>=0&&U.count>0).sort((U,O)=>U.y-O.y);if(!y.length)return;const A=y[0]?.count??1,J=E.width,D=E.height;for(let U=0;U<y.length;U++){const O=y[U],T=y[U+1],K=Math.min(D,O.y),B=T?Math.min(D,T.y):D;if(B<=K)continue;const S=A?O.count/A:0;g.fillStyle=`rgba(59, 130, 246, ${.15+S*.45})`,g.fillRect(0,K,J,B-K)}}function z(E){const g=m.value;g&&(E.preventDefault(),g.scrollBy({top:E.deltaY,left:E.deltaX,behavior:"auto"}))}const Y=h(()=>u.value.length>0);function ie(){requestAnimationFrame(ne)}we(u,ie),we([f,M,I,w],()=>{P()});let W=null;return ze(()=>{P(),m.value&&typeof ResizeObserver<"u"&&(W=new ResizeObserver(E=>{const g=E[0];g&&(b.value=g.contentRect.width)}),W.observe(m.value))}),Rt(()=>{W?.disconnect(),W=null,v=null}),we([M,Q,w],()=>{v=null,ie()}),we(X,ie),(E,g)=>(o(),s("div",qo,[e("div",No,[e("div",Bo,[g[4]||(g[4]=e("h2",{class:"text-lg font-semibold text-gray-900"}," Page Heatmap ",-1)),Y.value?(o(),s("span",Go,C(u.value.length)+" "+C(j.value),1)):_("",!0)]),e("div",Ho,[e("label",Wo,[g[5]||(g[5]=e("span",{class:"inline-flex items-center gap-1"},[ce(" Viewport Accuracy "),e("span",{class:"relative inline-flex items-center justify-center w-3.5 h-3.5 rounded-full border border-gray-400 text-[10px] text-gray-500 cursor-help group",tabindex:"0","aria-label":"What is Viewport Accuracy?"},[ce(" ? "),e("span",{class:"pointer-events-none absolute top-full left-1/2 -translate-x-1/2 mt-1 w-64 bg-gray-900 text-white text-xs rounded-md px-2 py-1.5 shadow-lg op
2acity-0 group-hover:opacity-100 group-focus:opacity-100 transition-opacity z-20 normal-case font-normal leading-snug"}," Filters heatmap data to sessions whose viewport width is close to the selected Screen Width. Higher percent = stricter match (narrower range); lower percent = looser match (wider range). ")])],-1)),ue(e("input",{"onUpdate:modelValue":g[0]||(g[0]=y=>I.value=y),type:"range",min:"0.1",max:"1",step:"0.05",class:"w-24"},null,512),[[$e,I.value,void 0,{number:!0}]]),e("span",Xo,C(Math.round(I.value*100))+"% ("+C(F.value.min)+"–"+C(F.value.max)+"px) ",1)]),e("label",Yo,[g[6]||(g[6]=ce(" Screen Width ",-1)),ue(e("select",{"onUpdate:modelValue":g[1]||(g[1]=y=>M.value=y),class:"border border-gray-300 rounded-md px-2 py-1 text-xs text-black"},[(o(),s(le,null,fe(R,y=>e("option",{key:y.value,value:y.value},C(y.label),9,Ko)),64))],512),[[Pt,M.value,void 0,{number:!0}]])]),e("label",Jo,[g[7]||(g[7]=ce(" Heatmap Type ",-1)),ue(e("select",{"onUpdate:modelValue":g[2]||(g[2]=y=>w.value=y),class:"border border-gray-300 rounded-md px-2 py-1 text-xs text-black"},[(o(),s(le,null,fe(x,y=>e("option",{key:y.value,value:y.value},C(y.label),9,Qo)),64))],512),[[Pt,w.value]])]),ue(e("select",{"onUpdate:modelValue":g[3]||(g[3]=y=>f.value=y),class:"border border-gray-300 rounded-md px-2 py-1 text-xs"},[(o(),s(le,null,fe(l,y=>e("option",{key:y.value,value:y.value},C(y.label),9,Zo)),64))],512),[[Pt,f.value]])])]),e("div",{ref_key:"bodyRef",ref:m,class:"flex-1 overflow-y-auto overflow-x-hidden bg-gray-100"},[c.value?(o(),s("div",ei,[...g[8]||(g[8]=[e("div",{class:"text-sm text-gray-400"}," Loading heatmap data... ",-1)])])):a.value?(o(),s("div",ti,[g[9]||(g[9]=e("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-12 w-12 text-gray-300 mb-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5",d:"M12 9v2m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})],-1)),e("p",ni,C(a.value),1)])):(o(),s("div",{key:2,class:"relative overflow-hidden mx-auto",style:Ee({width:`${M.value*X.value}px`,height:`${Q.value*X.value}px`})},[e("div",{class:"absolute top-0 left-0 origin-top-left bg-white",style:Ee({width:`${M.value}px`,height:`${Q.value}px`,transform:`scale(${X.value})`})},[H.value?(o(),s("iframe",{key:0,ref_key:"iframeRef",ref:d,src:H.value,width:M.value,height:Q.value,scrolling:"no",class:"block border-0 pointer-events-none",style:Ee({width:`${M.value}px`,height:`${Q.value}px`}),onLoad:ie},null,44,oi)):_("",!0),e("canvas",{ref_key:"heatmapCanvasRef",ref:p,class:"absolute inset-0 pointer-events-none",style:Ee({width:`${M.value}px`,height:`${Q.value}px`})},null,4),e("div",{class:"absolute inset-0",style:Ee({width:`${M.value}px`,height:`${Q.value}px`}),onWheel:z},null,36)],4)],4)),!c.value&&!a.value&&!Y.value?(o(),s("div",ii," No click data for this page in the selected range. ")):_("",!0)],512)]))}};async function ai(t,n,i){return await _e("/api/admin/voix/exports/authenticate",{method:"POST",body:{env:t,email:n,password:i}})}async function li(t){return await _e("/api/admin/voix/exports/authenticate",{method:"POST",body:{env:t,health_check:!0}})}async function ri(t,n="",i=1){const r=new URLSearchParams({env:t,search:n||"",page:i.toString()});return await _e(`/api/admin/voix/exports/pages?${r.toString()}`)}async function di(t){return await _e(`/api/admin/voix/exports/releases?env=${t}`)}async function ui(t){return await _e("/api/admin/voix/exports",{method:"POST",body:t})}async function ci(t){return await _e(`/api/admin/voix/exports/history?page_id=${t}`)}async function pi(t){return await _e(`/api/admin/voix/exports/last?page_id=${t}`)}const vi={class:"border-t border-gray-200 pt-2 mt-3"},mi={key:0,class:"mt-2"},gi={key:0,class:"text-xs text-gray-400"},xi={key:1,class:"text-xs text-gray-400"},fi={key:2,class:"space-y-1 max-h-32 overflow-y-auto"},bi={class:"flex items-center space-x-2"},hi={class:"text-2xs opacity-70"},yi={class:"text-2xs"},wi={__name:"ExportHistory",props:{pageId:{type:Number,required:!0}},setup(t){const n=t,i=$([]),r=$(!1),u=$(!1);async function c(){if(n.pageId){r.value=!0;try{i.value=await ci(n.pageId)??[]}catch{i.value=[]}finally{r.value=!1}}}function a(p){const v=Date.now()-new Date(p).getTime(),d=Math.floor(v/6e4);if(d<60)return`${d}m ago`;const m=Math.floor(d/60);return m<24?`${m}h ago`:`${Math.floor(m/24)}d ago`}return we(()=>n.pageId,c,{immediate:!0}),(p,v)=>{const d=Le;return o(),s("div",vi,[e("button",{class:"flex items-center justify-between w-full text-2xs font-semibold uppercase text-gray-500 hover:text-voix-admin-600 transition-colors",onClick:v[0]||(v[0]=m=>u.value=!u.value)},[e("span",null,"Export History ("+C(i.value.length)+")",1),k(d,{name:u.value?"heroicons:chevron-up":"heroicons:chevron-down",size:"14"},null,8,["name"])]),u.value?(o(),s("div",mi,[r.value?(o(),s("div",gi," Loading... ")):i.value.length===0?(o(),s("div",xi," No exports yet ")):(o(),s("div",fi,[(o(!0),s(le,null,fe(i.value,m=>(o(),s("div",{key:m.id,class:ee(["flex items-center justify-between text-xs px-2 py-1 rounded",{"bg-green-50 text-green-700":m.status==="success","bg-red-50 text-red-700":m.status==="failed"}])},[e("span",null,C(m.target_environment)+" "+C(m.target_page_id?`#${m.target_page_id}`:""),1),e("div",bi,[e("span",hi,C(m.mode),1),e("span",yi,C(a(m.created_at)),1),k(d,{name:m.status==="success"?"heroicons:check-circle":"heroicons:x-circle",size:"14"},null,8,["name"])])],2))),128))]))])):_("",!0)])}}},ki={key:0,class:"mt-2 text-xs text-gray-400 py-2"},_i={key:1,class:"mt-2 text-xs text-gray-400 py-2"},$i={key:2,class:"mt-2 max-h-[250px] overflow-y-auto border border-gray-200 rounded"},Si={class:"flex flex-col divide-y divide-slate-200"},Ci=["onClick"],Pi={class:"font-medium"},Ei={class:"text-gray-400 ml-1"},Ti={key:3,class:"mt-2 flex items-center justify-between text-xs text-gray-500"},Ii=["disabled"],Ai=["disabled"],Vi={key:4,class:"mt-2 text-xs text-voix-admin-600 bg-voix-admin-50 px-3 py-1.5 rounded"},Ri={__name:"RemotePageSelect",props:{envKey:{type:String,required:!0}},emits:["select"],setup(t,{emit:n}){const i=t,r=n,u=$(""),c=$([]),a=$(null),p=$(!1),v=$(1),d=$(1);async function m(w=1){if(i.envKey){p.value=!0;try{const x=await ri(i.envKey,u.value||"",w);x?.data?(c.value=x.data,v.value=x.current_page??w,d.value=x.last_page??1):c.value=Array.isArray(x)?x:[]}catch{c.value=[]}finally{p.value=!1}}}const b=bn(()=>{v.value=1,m(1)},500);we(u,()=>{b()}),we(()=>i.envKey,()=>{c.value=[],a.value=null,u.value="",v.value=1,m(1)}),ze(()=>{m(1)});function f(w){a.value=w,r("select",w)}function l(w){m(w)}return(w,x)=>{const L=Le;return o(),s("div",null,[k(pt,{id:"remote-page-search",modelValue:u.value,"onUpdate:modelValue":x[0]||(x[0]=j=>u.value=j),placeholder:"Search by page name...",label:"Search for a page",autocomplete:"off","aria-autocomplete":"none"},null,8,["modelValue"]),p.value?(o(),s("div",ki," Loading pages... ")):c.value.length===0?(o(),s("div",_i," No pages found ")):(o(),s("div",$i,[e("ul",Si,[(o(!0),s(le,null,fe(c.value,
2j=>(o(),s("li",{key:j.id,class:ee(["text-xs text-gray-600 hover:bg-slate-100 py-2 px-3 cursor-pointer flex items-center justify-between",{"bg-voix-admin-50 text-voix-admin-600":a.value?.id===j.id}]),onClick:R=>f(j)},[e("div",null,[e("span",Pi,C(j.title),1),e("span",Ei,C(j.path),1)])],10,Ci))),128))])])),d.value>1?(o(),s("div",Ti,[e("button",{class:"px-2 py-1 rounded hover:bg-gray-100 disabled:opacity-30 cursor-pointer",disabled:v.value<=1,onClick:x[1]||(x[1]=j=>l(v.value-1))},[k(L,{name:"heroicons:chevron-left",size:"14"})],8,Ii),e("span",null,"Page "+C(v.value)+" of "+C(d.value),1),e("button",{class:"px-2 py-1 rounded hover:bg-gray-100 disabled:opacity-30 cursor-pointer",disabled:v.value>=d.value,onClick:x[2]||(x[2]=j=>l(v.value+1))},[k(L,{name:"heroicons:chevron-right",size:"14"})],8,Ai)])):_("",!0),a.value?(o(),s("div",Vi,[x[3]||(x[3]=ce(" Selected: ",-1)),e("strong",null,C(a.value.title),1),ce(" ("+C(a.value.path)+") ",1)])):_("",!0)])}}},Li={key:0},Mi={class:"fixed top-0 bottom-0 right-0 left-[80px] z-40 flex items-center justify-center"},Di={class:"flex justify-between items-center border-b border-voix-admin-500 mb-3 pb-1"},Fi={key:0,class:"flex items-center space-x-1 mb-3 p-2 bg-amber-50 text-amber-700 text-xs rounded"},ji={key:1},Oi={class:"space-y-2"},zi=["onClick"],Ui={class:"w-full"},qi={class:"flex items-center justify-between"},Ni={class:"flex items-center space-x-3"},Bi={class:"font-medium"},Gi={key:0,class:"text-2xs text-gray-400"},Hi={key:0,class:"text-2xs text-amber-500 mt-1 text-left pl-[22px]"},Wi={key:1,class:"text-2xs text-red-400 mt-1 text-left pl-[22px]"},Xi={key:2},Yi={class:"flex items-center space-x-2 text-sm text-voix-admin-500 mb-3"},Ki={key:0,class:"flex items-center space-x-1 mb-3 p-2 bg-amber-50 text-amber-700 text-xs rounded"},Ji={class:"space-y-3"},Qi={class:"mt-4 flex justify-between"},Zi=["disabled"],es={key:3},ts={class:"flex items-center space-x-2 text-voix-admin-500 text-sm mb-3"},ns={class:"flex flex-col space-y-1"},os={class:"p-2 rounded bg-voix-admin-50 text-voix-admin-600 group-hover:bg-emerald-200 group-hover:text-emerald-800 group-hover:translate-x-0.5 transform-all duration-500"},is={key:0,class:"ml-10"},ss={class:"p-2 rounded bg-voix-admin-50 text-voix-admin-600 group-hover:bg-emerald-200 group-hover:text-emerald-800 group-hover:translate-x-0.5 transform-all duration-500"},as={key:1,class:"ml-10"},ls={class:"mt-4 flex justify-between"},rs=["disabled"],ds={key:4},us={class:"flex items-center space-x-2 text-voix-admin-500 text-sm mb-3"},cs={class:"flex flex-col space-y-1"},ps={class:"p-2 rounded bg-voix-admin-50 text-voix-admin-600 group-hover:bg-emerald-200 group-hover:text-emerald-800 group-hover:translate-x-0.5 transform-all duration-500"},vs={class:"p-2 rounded bg-voix-admin-50 text-voix-admin-600 group-hover:bg-emerald-200 group-hover:text-emerald-800 group-hover:translate-x-0.5 transform-all duration-500"},ms={class:"p-2 rounded bg-voix-admin-50 text-voix-admin-600 group-hover:bg-emerald-200 group-hover:text-emerald-800 group-hover:translate-x-0.5 transform-all duration-500"},gs={key:0,class:"mt-3"},xs={key:1,class:"mt-3"},fs={key:0,class:"text-xs text-gray-400 p-2"},bs={key:1,class:"bg-voix-admin-50 text-voix-admin-600 p-4 rounded text-sm text-center"},hs={class:"flex flex-col space-y-1 max-h-[200px] overflow-y-auto"},ys=["onClick"],ws={class:"text-sm font-bold"},ks={class:"capitalize"},_s={class:"mt-4 flex justify-between"},$s=["disabled"],Ss={key:5},Cs={class:"flex items-center space-x-2 text-sm text-voix-admin-500 mb-3"},Ps={class:"p-3 bg-gray-50 rounded-lg text-xs space-y-2"},Es={class:"flex justify-between"},Ts={class:"font-medium"},Is={class:"flex justify-between"},As={class:"font-medium"},Vs={class:"flex justify-between"},Rs={class:"font-medium"},Ls={class:"flex justify-between"},Ms={class:"font-medium"},Ds={key:0,class:"mt-3"},Fs={key:1,class:"mt-3 p-2 bg-amber-50 text-amber-700 text-xs rounded"},js={key:2,class:"mt-2 p-2 bg-red-50 text-red-700 text-xs rounded"},Os={class:"mt-4 flex justify-between"},zs=["disabled"],Us={__name:"ExportPageModal",props:{show:{type:Boolean,required:!0}},emits:["close","exported"],setup(t,{emit:n}){const i=n,{$voix:r}=It(),u=Oe(),c=Se(),a=$(1),p=$(!1),v=h(()=>r?.options?.environments??{}),d=h(()=>Object.keys(v.value)),m=$(""),b=xt({}),f=$(""),l=$(""),w=$(!1),x=$(null),L=$(null),j=$(!0),R=$(""),M=$(null),I=$("live"),F=$(""),V=$([]),H=$(null),P=$(""),Q=$(!1),X=h(()=>P.value?V.value.filter(B=>(B.label||"").toLowerCase().includes(P.value.toLowerCase())):V.value),ne=$("replace"),G=$(!1),z=$(null),Y=$(!1);ze(async()=>
2{for(const B of d.value){b[B]={reachable:!1,version:null,error:"Checking..."};try{b[B]=await li(B)}catch{b[B]={reachable:!1,version:null,error:"Unreachable"}}}if(c.currentPage?.id)try{z.value=await pi(c.currentPage.id),z.value&&(Y.value=!0)}catch{}}),we(m,()=>{a.value=1,w.value=!1,f.value="",l.value="",x.value=null});function ie(B){U(B)||(m.value=B,nt(()=>{a.value=2}))}async function W(){p.value=!0;try{const B=await ai(m.value,f.value,l.value);B.authenticated?(w.value=!0,L.value=B.version,x.value=B.version_warning,a.value=3):u.add(B.error||"Authentication failed","error")}catch{u.add(`Failed to authenticate with ${J(m.value)}`,"error")}finally{p.value=!1}}async function E(){a.value=4,p.value=!0;try{const B=await di(m.value);V.value=B?.data??B??[]}catch{V.value=[]}finally{p.value=!1}}function g(){a.value=5}async function y(){if(c.currentPage?.id){p.value=!0;try{const B={env:m.value,source_page_id:c.currentPage.id,mode:ne.value,new_page:j.value,release_mode:I.value};j.value?B.new_page_path=R.value:B.target_page_id=M.value?.id,I.value==="new"?(B.release_label=F.value,B.release_status="unscheduled"):I.value==="existing"&&H.value&&(B.target_release_id=H.value.id);const S=await ui(B);S.success?(u.add(`Exported ${S.elements_count} elements to ${J(m.value)}`,"msg"),i("exported"),A()):u.add(S.error||"Export failed","error")}catch(B){B?.data?.error==="token_expired"?(u.add("Session expired. Please re-authenticate.","error"),a.value=2,w.value=!1):u.add(B?.message||"Export failed","error")}finally{p.value=!1}}}function A(){a.value=1,m.value="",w.value=!1,f.value="",l.value="",j.value=!0,M.value=null,I.value="live",ne.value="replace",Q.value=!1,G.value=!1,i("close")}function J(B){return v.value[B]?.label??B}function D(B){const S=b[B];return!S||S.error==="Checking..."?"bg-gray-300 animate-pulse":S.reachable?"bg-green-500":"bg-red-500"}function U(B){const S=b[B];return!S||S.error==="Checking..."?!0:!S.reachable}const O=h(()=>c.currentPage?.elements?.length??0),T=h(()=>I.value==="live"&&ne.value==="replace"&&!j.value),K=h(()=>!(p.value||T.value&&!G.value||I.value==="live"&&!Q.value&&!j.value));return(B,S)=>{const ae=Le;return t.show?(o(),s("div",Li,[S[42]||(S[42]=e("div",{class:"fixed top-0 bottom-0 right-0 left-[80px] z-40 bg-voix-admin-200 opacity-50"},null,-1)),e("div",Mi,[e("div",{class:"relative bg-white rounded-lg p-6 w-[500px] text-sm",onClick:S[18]||(S[18]=je(()=>{},["stop"]))},[e("div",Di,[S[19]||(S[19]=e("div",{class:"uppercase font-bold text-voix-admin-600 text-sm"}," Export Page ",-1)),e("button",{class:"text-gray-400 hover:text-gray-600 cursor-pointer absolute top-1 right-1",onClick:A},[k(ae,{name:"heroicons:x-mark-20-solid",size:"24",class:"text-voix-admin-500"})])]),a.value===1?(o(),s("p",Fi,[k(ae,{name:"heroicons:exclamation-triangle",size:"18",class:"text-amber-400 shrink-0"}),S[20]||(S[20]=e("span",null,"Unsaved changes will not be exported. Please save before exporting.",-1))])):_("",!0),a.value===1?(o(),s("div",ji,[e("div",Oi,[(o(!0),s(le,null,fe(d.value,re=>(o(),s("button",{key:re,class:ee(["w-full flex items-center justify-between p-3 rounded-lg border transition-colors duration-150",{"border-voix-admin-300 bg-voix-admin-50":m.value===re,"border-gray-200 hover:border-voix-admin-200 hover:bg-gray-50":m.value!==re,"cursor-pointer":!U(re)}]),onClick:Me=>ie(re)},[e("div",Ui,[e("div",qi,[e("div",Ni,[e("span",{class:ee(["w-2.5 h-2.5 rounded-full shrink-0",D(re)])},null,2),e("span",Bi,C(J(re)),1)]),b[re]?.version?(o(),s("span",Gi," v"+C(b[re].version),1)):_("",!0)]),b[re]?.warning?(o(),s("p",Hi,C(b[re].warning),1)):b[re]?.error&&b[re]?.error!=="Checking..."?(o(),s("p",Wi,C(b[re].error),1)):_("",!0)])],10,zi))),128))])])):_("",!0),a.value===2?(o(),s("div",Xi,[e("p",Yi,[k(ae,{name:"heroicons:lock-closed",size:"16",class:"shrink-0"}),e("span",null,"Authenticate with "+C(J(m.value)),1)]),x.value?(o(),s("div",Ki,[k(ae,{name:"heroicons:exclamation-triangle",size:"18",class:"text-amber-400 shrink-0"}),e("span",null,C(x.value),1)])):_("",!0),e("div",Ji,[e("div",null,[S[21]||(S[21]=e("label",{class:"block text-2xs font-semibold uppercase opacity-70 text-gray-600 mb-1"},"Email",-1)),ue(e("input",{"onUpdate:modelValue":S[0]||(S[0]=re=>f.value=re),type:"email",class:"w-full border border-gray-300 rounded px-3 py-2",placeholder:"[email protected]"},null,512),[[$e,f.value]])]),e("div",null,[S[22]||(S[22]=e("label",{class:"block text-2xs font-semibold uppercase opacity-70 text-gray-600 mb-1"},"Password",-1)),ue(e("input",{"onUpdate:modelValue":S[1]||(S[1]=re=>l.value=re),type:"password",class:"w-full border border-gray-300 rounded px-3 py-2",onKeyup:Qt(W,["enter"])},null,544),[[$e,l.value]])])]),e("div",Qi,[e("button",{class:"flex items-center space-x-1 text-xs text-gray-500 hover:text-gray-700 cursor-pointer",onClick:S[2]||(S[2]=re=>a.value=1)},[k(ae,{name:"heroicons:chevron-left",size:"14"}),S[23]||(S[23]=e("span",null,"Back",-1))]),e("button",{class:"px-4 py-2 rounded font-medium text-white bg-voix-admin-600 hover:bg-voix-admin-700 disabled:opacity-50",disabled:!f.value||!l.value||p.value,onClick:W},C(p.value?"Authenticating...":"Authenticate"),9,Zi)])])):_("",!0),a.value===3?(o(),s("div",es,[e("div",ts,[k(ae,{name:"heroicons:document",size:"16",class:"shrink-0"}),e("span",null,"Select target page on "+C(J(m.value)),1)]),e("div",ns,[e("button",{class:ee(["flex items-center space-x-3 p-2 rounded-lg hover:bg-voix-admin-50 group cursor-pointer",{"bg-voix-admin-50":j.value}]),onClick:S[3]||(S[3]=re=>j.value=!0)},[e("div",os,[k(ae,{name:"heroicons:document-plus",size:"16"})]),S[24]||(S[24]=e("div",{class:"text-sm font-medium text-gray-600 group-hover:text-gray-700"}," Create new page ",-1))],2),j.value?(o(),s("div",is,[k(pt,{id:"export-page-path",modelValue:R.value,"onUpdate:modelValue":S[4]||(S[4]=re=>R.value=re),placeholder:"/page-path",label:"Page Path"},null,8,["modelValue"])])):_("",!0),e("button",{class:ee(["flex items-center space-x-3 p-2 rounded-lg hover:bg-voix-admin-50 group cursor-pointer",{"bg-voix-admin-50":!j.value}]),onClick:S[5]||(S[5]=re=>j.value=!1)},[e("div",ss,[k(ae,{name:"heroicons:document-magnifying-glass",size:"16"}
2)]),S[25]||(S[25]=e("div",{class:"text-sm font-medium text-gray-600 group-hover:text-gray-700"}," Export to existing page ",-1))],2),j.value?_("",!0):(o(),s("div",as,[k(Ri,{"env-key":m.value,onSelect:S[6]||(S[6]=re=>M.value=re)},null,8,["env-key"])]))]),e("div",ls,[e("button",{class:"flex items-center space-x-1 text-xs text-gray-500 hover:text-gray-700 cursor-pointer",onClick:S[7]||(S[7]=re=>a.value=2)},[k(ae,{name:"heroicons:chevron-left",size:"14"}),S[26]||(S[26]=e("span",null,"Back",-1))]),e("button",{class:"px-4 py-2 rounded font-medium text-white bg-voix-admin-600 hover:bg-voix-admin-700 disabled:opacity-50",disabled:!j.value&&!M.value||j.value&&!R.value,onClick:E}," Next ",8,rs)])])):_("",!0),a.value===4?(o(),s("div",ds,[e("div",us,[k(ae,{name:"heroicons:rectangle-stack",size:"16",class:"shrink-0"}),e("span",null,"Select release target on "+C(J(m.value)),1)]),e("div",cs,[e("button",{class:ee(["flex items-center space-x-3 p-2 rounded-lg hover:bg-voix-admin-50 group",{"bg-voix-admin-50":I.value==="live"}]),onClick:S[8]||(S[8]=re=>I.value="live")},[e("div",ps,[k(ae,{name:"heroicons:bolt",size:"16"})]),S[27]||(S[27]=e("div",{class:"text-sm font-medium text-gray-600 group-hover:text-gray-700"}," Live (publish immediately) ",-1))],2),e("button",{class:ee(["flex items-center space-x-3 p-2 rounded-lg hover:bg-voix-admin-50 group",{"bg-voix-admin-50":I.value==="new"}]),onClick:S[9]||(S[9]=re=>I.value="new")},[e("div",vs,[k(ae,{name:"heroicons:sparkles",size:"16"})]),S[28]||(S[28]=e("div",{class:"text-sm font-medium text-gray-600 group-hover:text-gray-700"}," New release ",-1))],2),e("button",{class:ee(["flex items-center space-x-3 p-2 rounded-lg hover:bg-voix-admin-50 group",{"bg-voix-admin-50":I.value==="existing"}]),onClick:S[10]||(S[10]=re=>I.value="existing")},[e("div",ms,[k(ae,{name:"heroicons:rectangle-stack",size:"16"})]),S[29]||(S[29]=e("div",{class:"text-sm font-medium text-gray-600 group-hover:text-gray-700"}," Existing release ",-1))],2)]),I.value==="new"?(o(),s("div",gs,[k(pt,{id:"export-release-name",modelValue:F.value,"onUpdate:modelValue":S[11]||(S[11]=re=>F.value=re),"focus-on-show":!0,placeholder:"Release name",label:"Release Name"},null,8,["modelValue"])])):_("",!0),I.value==="existing"?(o(),s("div",xs,[p.value?(o(),s("div",fs," Loading releases... ")):V.value.length===0?(o(),s("div",bs," No unpublished releases found ")):(o(),s(le,{key:2},[k(pt,{id:"export-release-filter",modelValue:P.value,"onUpdate:modelValue":S[12]||(S[12]=re=>P.value=re),"focus-on-show":!0,placeholder:"Filter by name",class:"mb-2"},null,8,["modelValue"]),e("div",hs,[(o(!0),s(le,null,fe(X.value,re=>(o(),s("button",{key:re.id,class:ee(["relative w-full py-2 px-3 text-left text-xs rounded transition-colors duration-150",{"bg-voix-admin-50 text-voix-admin-600":H.value?.id===re.id,"bg-gray-100 text-gray-600 hover:bg-gray-200":H.value?.id!==re.id}]),onClick:Me=>H.value=re},[e("div",ws,C(re.label),1),e("div",ks,[S[30]||(S[30]=e("span",{class:"opacity-70"},"Status:",-1)),ce(" "+C(re.status),1)])],10,ys))),128))])],64))])):_("",!0),e("div",_s,[e("button",{class:"flex items-center space-x-1 text-xs text-gray-500 hover:text-gray-700 cursor-pointer",onClick:S[13]||(S[13]=re=>a.value=3)},[k(ae,{name:"heroicons:chevron-left",size:"14"}),S[31]||(S[31]=e("span",null,"Back",-1))]),e("button",{class:"px-4 py-2 rounded font-medium text-white bg-voix-admin-600 hover:bg-voix-admin-700 disabled:opacity-50",disabled:I.value==="new"&&!F.value||I.value==="existing"&&!H.value,onClick:g}," Next ",8,$s)])])):_("",!0),a.value===5?(o(),s("div",Ss,[e("p",Cs,[k(ae,{name:"heroicons:check-circle",size:"16",class:"shrink-0"}),S[32]||(S[32]=e("span",null,"Confirm export",-1))]),e("div",Ps,[e("div",Es,[S[33]||(S[33]=e("span",{class:"text-gray-500"},"Target:",-1)),e("span",Ts,C(J(m.value)),1)]),e("div",Is,[S[34]||(S[34]=e("span",{class:"text-gray-500"},"Page:",-1)),e("span",As,C(j.value?`New: ${R.value}`:M.value?.title),1)]),e("div",Vs,[S[35]||(S[35]=e("span",{class:"text-gray-500"},"Release:",-1)),e("span",Rs,C(I.value==="live"?"Live":I.value==="new"?`New: ${F.value}`:H.value?.label),1)]),e("div",Ls,[S[36]||(S[36]=e("span",{class:"text-gray-500"},"Elements:",-1)),e("span",Ms,C(O.value),1)])]),j.value?_("",!0):(o(),s("div",Ds,[S[38]||(S[38]=e("label",{class:"block text-2xs font-semibold uppercase opacity-70 text-gray-600 mb-1"}," Export Mode ",-1)),ue(e("select",{"onUpdate:modelValue":S[14]||(S[14]=re=>ne.value=re),class:"w-full border border-gray-300 rounded px-3 py-2 text-sm"},[...S[37]||(S[37]=[e("option",{value:"replace"}," Replace all elements (removes existing) ",-1),e("option",{value:"append"}," Append elements (keeps existing) ",-1)])],512),[[Pt,ne.value]])])),I.value==="live"&&!j.value?(o(),s("div",Fs,[e("button",{class:"flex items-center space-x-2 cursor-pointer",onClick:S[15]||(S[15]=re=>Q.value=!Q.value)},[k(rn,{selected:Q.value},null,8,["selected"]),S[39]||(S[39]=e("span",null,"I confirm this will affect the live environment immediately.",-1))])])):_("",!0),T.value&&Q.value?(o(),s("div",js,[e("button",{class:"flex items-center space-x-2 cursor-pointer",onClick:S[16]||(S[16]=re=>G.value=!G.value)},[k(rn,{selected:G.value},null,8,["selected"]),S[40]||(S[40]=e("span",null,[ce("I understand this will "),e("strong",null,"replace all existing elements"),ce(" on the live page.")],-1))])])):_("",!0),e("div",Os,[e("button",{class:"flex items-center space-x-1 text-xs text-gray-500 hover:text-gray-700 cursor-pointer",onClick:S[17]||(S[17]=re=>a.value=4)},[k(ae,{name:"heroicons:chevron-left",size:"14"}),S[41]||(S[41]=e("span",null,"Back",-1))]),e("button",{class:"px-4 py-2 rounded font-medium text-white bg-voix-admin-600 hover:bg-voix-admin-700 disabled:opacity-50",disabled:!K.value,onClick:y},C(p.value?"Exporting...":"Export"),9,zs)])])):_("",!0),N(c).currentPage?.id?(o(),se(wi,{key:6,"page-id":N(c).currentPage.id},null,8,["page-id"])):_("",!0)])])])):_("",!0)}}},qs={class:"flex-1 flex flex-col justify-between"},Ns={class:"space-y-2"},Bs={key:0},Gs={key:1},Hs={key:1},Ws={class:"space-y-4"},Xs={__name:"CookbookRecipeMaker",emits:["new","select","close"],setup(t,{emit:n}){const i=n,r=wt(),u=qe(),c=Se(),a=$(""),p=$(""),v=$(c.currentPage.layout||""),d=h(()=>`{
3  "name": "${a.value}",
4  "description": "${p.value}",
5  "layout": "${v.value}",
6  "recipe": ${JSON.stringify(u.makingRecipeElement)}
7}`),{copy:m,copied:b,isSupported:f}=go({source:d}),l=h(()=>{const w=[];
7return Object.keys(r.layouts).forEach(x=>{w.push({label:r.layouts[x].label,value:x,key:x})}),w});return(w,x)=>{const L=Ie("AdministrationAlert"),j=Le;return o(),se(In,{title:"Build Recipe"},{default:pe(()=>[e("div",qs,[e("div",null,[k(L,{type:"info",class:"mt-4 text-sm"},{default:pe(()=>[...x[6]||(x[6]=[e("span",{class:"font-bold"},"Info:",-1),ce(" Ensure that the cookbook is turned on in the nuxt.config.ts file in your Voix section. Then following the instructions below to create a new recipe. ",-1)])]),_:1}),k(po,{title:"Recipe Settings"},{default:pe(()=>[k(Mt,{label:"Name",description:"What is the name of the recipe?"},{default:pe(()=>[ue(e("input",{"onUpdate:modelValue":x[0]||(x[0]=R=>a.value=R),class:"w-full border border-gray-300 rounded-md px-3 py-2"},null,512),[[$e,a.value]])]),_:1}),k(Mt,{label:"Description",description:"Describe this recipe so that users can understand what it's for."},{default:pe(()=>[ue(e("textarea",{"onUpdate:modelValue":x[1]||(x[1]=R=>p.value=R),class:"w-full border border-gray-300 rounded-md px-3 py-2"},null,512),[[$e,p.value]])]),_:1}),k(Mt,{label:"Layout",description:"Choose the layout that you want to display with this recipe. Note that this is only for presentation purposes unless it's a new page. Whereever the user copies the recipe it will use the layout of that page."},{default:pe(()=>[k(Ue,{id:"text-field-font",modelValue:v.value,"onUpdate:modelValue":x[2]||(x[2]=R=>v.value=R),options:l.value,label:"Layout",placeholder:"Select a layout"},null,8,["modelValue","options"])]),_:1}),k(Mt,{label:"The Recipe",description:"Copy the recipe from here and paste it into a file in <span class='bg-gray-100 py-0.5 px-2 rounded font-mono'>/recipes</span> in your project."},{default:pe(()=>[e("div",Ns,[e("div",null,[N(f)?(o(),s("button",{key:0,class:"flex space-x-1 bg-voix-admin-600 text-voix-admin-50 px-3 py-2 rounded",onClick:x[3]||(x[3]=R=>N(m)(d.value))},[k(j,{name:"heroicons:clipboard-document",size:"20"}),N(b)?(o(),s("span",Gs,"Copied!")):(o(),s("span",Bs,"Copy Recipe to Clipboard"))])):(o(),s("p",Hs," Your browser does not support Clipboard API "))]),e("div",null,[ue(e("textarea",{"onUpdate:modelValue":x[4]||(x[4]=R=>d.value=R),class:"w-full min-h-48 border border-gray-300 rounded-md px-3 py-2 text-mono"},null,512),[[$e,d.value]])])])]),_:1})]),_:1})]),e("div",Ws,[k(An,null,{default:pe(()=>[k(Tn,{type:"primary",onClick:x[5]||(x[5]=R=>i("close"))},{default:pe(()=>[...x[7]||(x[7]=[ce(" Done ",-1)])]),_:1})]),_:1})])])]),_:1})}}};function Pb(t,n){const i=Se(),r=yt(),u=i.findElement(t),c=r.getSlice(n.component);if(c?.slots&&c?.slots.length&&u){const{extractionElements:a,extractionIndex:p}=Ys(u),v=Ks(u.element,n);if(a!==null&&p!==null&&!v){const d=a.splice(p,1);n.elements||(n.elements=[]),n.elements.splice(0,0,d[0])}}}function Ys(t){const i=Se().currentPage;if(t.parentElement===null){const r=i.elements,u=r.indexOf(t.element);return{extractionElements:r,extractionIndex:u}}if(t.parentElement&&t.parentElement.elements){const r=t.parentElement.elements,u=r.indexOf(t.element);return{extractionElements:r,extractionIndex:u}}return{extractionElements:null,extractionIndex:null}}function Ks(t,n){return t.id===n.id}function qn(t){return t.elements.map(n=>(Object.hasOwn(n,"model_query")&&n.model_query!==null&&(n.type="query"),n)),t}async function Js(t){const n=Se();if(Vt(),!n.isSaving)try{n.setIsSaving(!0);let i=JSON.parse(JSON.stringify(n.currentPage));i=qn(i);const{setReleaseData:r}=ho(),u=qe();let c=u.releaseId,a="";c!=null&&c!==""&&(c!==i.current_release.id&&c!==i.draft_release?.id&&(c=""),(t.saveMode.value==="queue-new-release"||t.saveMode.value==="publish")&&(a=c,c=""));const p=r(t,{id:i.id,title:i.title,path:i.path,fields:i.fields,layout:i.layout,elements:i.elements,tags:i.tags,active_segments:u.pageSegments.map(b=>({id:b.id})),release_date:"",release_label:"",release_id:c??"",release_status:"unscheduled",release_detach_from_id:a,review:i.review,reviewed_at:i.reviewed_at,review_status:i.review_status,reviewed_by:{id:i.reviewed_by?.id,name:i.reviewed_by?.name}});n.setCurrentState("currentlySelectedElements",[]);const{updateCurrentPage:v}=ft(),d=await v(p);if(d.current_release?.id){const b=tt("voix-release-preview");b.value=d.current_release.id}Ze({name:"voix-studio-en",query:{editing:i.path}});const m=["queue-new-release","queue-existing-release"];c!=null&&c!==""&&m.includes(t.saveMode.value)?u.setReleaseId(t.releaseId.value):(n.currentPage?.draft_release?.id||t.saveMode.value==="publish")&&u.unsetReleaseId(),i.path&&hn().sendPageSaved(i.path),n.setIsSaving(!1),t.endSave(t.close)}catch(i){console.error("Error saving page",{error:i}),n.setIsSaving(!1),t.endSave(t.close)}}async function Qs(t){const n=Se();try{const i=qe();let r=JSON.parse(JSON.stringify(n.currentPage));r=qn(r),r.release_status="draft";const u=Object.assign({},r,{active_segments:i.pageSegments.map(d=>({id:d.id}))});n.setCurrentState("currentlySelectedElements",[]);const{updateCurrentPage:c}=ft(),a=await c(u);Ze({name:"voix-studio-en",query:{editing:r.path}});const v=a.draft_release?.id;if(v){const d=tt("voix-release-preview");d.value=v,i.setReleaseId(v)}else i.unsetReleaseId();r.path&&hn().sendPageSaved(r.path),n.setIsSaving(!1),t.endSave(t.close)}catch(i){console.error("Error saving page",{error:i}),n.setIsSaving(!1),t.endSave(t.close)}}const Zs={class:"h-full flex flex-col bg-white bg-linear-to-br from-voix-admin-50/20 to-voix-admin-500/0"},ea={class:"shrink-0 px-4 py-3.5 flex items-center gap-3 bg-white border-b border-voix-admin-100/70"},ta={key:1,class:"w-8 h-8 rounded-md bg-linear-to-br from-white to-voix-admin-200/80 ring-1 ring-voix-admin-200/60 text-voix-admin-700 flex items-center justify-center shrink-0"},na={class:"flex-1 min-w-0"},oa={class:"flex items-center gap-2"},ia={class:"text-[15px] font-semibold text-voix-admin-900 tracking-tight leading-tight truncate"},sa={key:0,class:"font-mono text-[11px] text-voix-admin-400 leading-tight truncate"},aa=["title"],la={class:"flex-1 overflow-y-auto min-h-0"},ra={key:0,class:"shrink-0 border-t border-voix-admin-200/60 bg-white bg-gradient-to-b from-voix-admin-50/60 to-voix-admin-100/70"},ot={__name:"SlideoutPanel",props:{icon:{type:String,required:!0},title:{type:String,required:!0},subtitle:{type:String,required:!1,default:""},dotColor:{type:[String,null],required:!1,default:null},canAdd:{type:Boolean,required:!1,default:!1},addLabel:{type:String,required:!1,default:"Add"},showBack:{type:Boolean,required:!1,default:!1},showClose:{type:Boolean,required:!1,default:!0}},emits:["close","add","back"],setup(t,{emit:n}){const i=t,r=n,u=h(()=>
7i.dotColor==="red"?"bg-red-500":i.dotColor==="amber"?"bg-amber-500":i.dotColor==="emerald"?"bg-emerald-500":"");return(c,a)=>{const p=Le;return o(),s("div",Zs,[e("div",ea,[t.showBack?(o(),s("button",{key:0,class:"w-8 h-8 rounded-md flex items-center justify-center text-voix-admin-500 hover:bg-white/80 hover:text-voix-admin-900 transition-colors cursor-pointer",title:"Back",onClick:a[0]||(a[0]=v=>r("back"))},[k(p,{name:"heroicons:arrow-left",size:"16"})])):(o(),s("div",ta,[k(p,{name:i.icon,size:"16"},null,8,["name"])])),e("div",na,[e("div",oa,[e("h2",ia,C(i.title),1),u.value?(o(),s("span",{key:0,class:ee(["w-1.5 h-1.5 rounded-full shrink-0",u.value])},null,2)):_("",!0)]),i.subtitle?(o(),s("div",sa,C(i.subtitle),1)):_("",!0)]),i.canAdd?(o(),s("button",{key:2,class:"w-7 h-7 rounded-md flex items-center justify-center text-voix-admin-500 hover:bg-white/80 hover:text-voix-admin-900 transition-colors cursor-pointer",title:i.addLabel,onClick:a[1]||(a[1]=v=>r("add"))},[k(p,{name:"heroicons:plus",size:"15"})],8,aa)):_("",!0),i.showClose?(o(),s("button",{key:3,class:"w-7 h-7 rounded-md flex items-center justify-center text-voix-admin-400 hover:bg-white/80 hover:text-voix-admin-900 transition-colors cursor-pointer",title:"Close",onClick:a[2]||(a[2]=v=>r("close"))},[k(p,{name:"heroicons:x-mark",size:"14"})])):_("",!0)]),e("div",la,[ht(c.$slots,"default")]),c.$slots.footer?(o(),s("div",ra,[ht(c.$slots,"footer")])):_("",!0)])}}},da={class:"px-4 pt-4 pb-3"},ua={class:"relative inline-block pb-1.5"},ca={class:"text-[11px] tracking-[0.14em] uppercase font-bold text-voix-admin-900"},Ve={__name:"SlideoutSection",props:{label:{type:String,required:!0}},setup(t){return(n,i)=>(o(),s("div",da,[e("div",ua,[e("h3",ca,C(t.label),1),i[0]||(i[0]=e("span",{class:"absolute left-0 bottom-0 w-5 h-0.5 bg-voix-admin-800 rounded-full"},null,-1))])]))}},pa=8,va=5e4;function ma(t,n){const i=[];for(let r=0;r<t.length;r+=n)i.push(t.slice(r,r+n));return i}const ga={class:"relative w-full md:w-[480px] bg-white rounded-xl shadow-2xl border border-voix-admin-200 overflow-hidden flex flex-col max-h-[90vh]"},xa={class:"flex items-center gap-3 px-5 py-4 border-b border-voix-admin-100 shrink-0"},fa={class:"w-7 h-7 rounded-md bg-voix-admin-100 text-voix-admin-700 flex items-center justify-center"},ba={class:"px-5 py-4 overflow-y-auto flex-1"},ha={class:"relative inline-block pb-1.5 mb-3"},ya={class:"text-[11px] tracking-[0.14em] uppercase font-bold text-voix-admin-900"},wa={key:0,class:"space-y-3"},ka={class:"grid grid-cols-2 gap-3"},_a={key:1,class:"space-y-2 py-1"},$a={class:"flex items-baseline justify-between gap-3"},Sa={class:"text-[12px] text-voix-admin-600"},Ca={key:0,class:"shrink-0 font-mono text-[11px] tabular-nums text-voix-admin-400"},Pa={class:"h-1 w-full overflow-hidden rounded-full bg-voix-admin-100"},Ea={key:0,class:"text-[12px] text-amber-600 leading-relaxed pt-1"},Ta={key:0,class:"flex items-center justify-end gap-2 px-5 py-3 border-t border-voix-admin-100 bg-voix-admin-50/80 backdrop-blur shrink-0"},Ia=["disabled"],Aa={key:1,class:"flex items-center justify-end gap-2 px-5 py-3 border-t border-voix-admin-100 bg-voix-admin-50/80 backdrop-blur shrink-0"},Va={__name:"TranslateInPlace",props:{page:{type:null,required:!0}},emits:["close"],setup(t,{emit:n}){const i=t,r=n,{$voix:u}=It(),c=Se(),a=Oe(),p=["text","textarea","wysiwyg","link"];function v(W,E){if(E==="link"){const y=W?.link?.text;return typeof y=="string"?y:void 0}const g=W?.[E];return typeof g=="string"?g:void 0}const d=h(()=>u.options.languages??[]),m=h(()=>d.value.map(W=>({label:W.name,value:W.name,key:W.code}))),b=h(()=>d.value[0]),f=h(()=>d.value.find(W=>W.code===i.page.language_code)??b.value),l=$({language:b.value?.name??"",language_code:b.value?.code??""}),w=$({language:f.value?.name??"",language_code:f.value?.code??""});function x(W){return d.value.find(E=>E.code&&E.code!==W)}if(l.value.language_code&&l.value.language_code===w.value.language_code){const W=x(l.value.language_code);W&&(w.value={language:W.name,language_code:W.code})}const L=h(()=>m.value.filter(W=>W.key!==w.value.language_code)),j=h(()=>m.value.filter(W=>W.key!==l.value.language_code));we(()=>l.value.language,W=>{const E=d.value.find(g=>g.name===W);
7if(l.value.language_code=E?.code??"",l.value.language_code&&l.value.language_code===w.value.language_code){const g=x(l.value.language_code);g&&(w.value={language:g.name,language_code:g.code})}}),we(()=>w.value.language,W=>{const E=d.value.find(g=>g.name===W);w.value.language_code=E?.code??""});const R=h(()=>!!l.value.language_code&&!!w.value.language_code&&l.value.language_code!==w.value.language_code),M=$(!1),I=$(!1),F=$(!1);let V=null;const H=$({done:0,total:0}),P=h(()=>H.value.total?Math.round(H.value.done/H.value.total*100):0);function Q(W,E=[]){if(!W)return E;for(const g of W)g.type==="slice"&&g.enabled!==!1&&E.push(g),"elements"in g&&Array.isArray(g.elements)&&Q(g.elements,E);return E}function X(){const W=[];let E=1;const g=Q(c.currentPage?.elements);for(const y of g)if(y.fields)for(const A of y.fields)if(p.includes(A.type)){const J=v(A,A.type);typeof J=="string"&&J.trim().length>0&&W.push({id:E++,type:A.type,value:J,sliceId:String(y.id),fieldName:A.name})}else A.type==="collection"&&Array.isArray(A.collection)&&A.collection.forEach((J,D)=>{if(Array.isArray(J.fields)){for(const U of J.fields)if(p.includes(U.type)){const O=v(U,U.type);typeof O=="string"&&O.trim().length>0&&W.push({id:E++,type:U.type,value:O,sliceId:String(y.id),fieldName:A.name,collectionIndex:D,subFieldName:U.name})}}});return W}function ne(W,E){const g=new Map;for(const A of E)g.set(A.id,A.value);const y=new Map;for(const A of W){const J=g.get(A.id);if(typeof J!="string"||J.length===0)continue;if(A.collectionIndex===void 0){if(A.type==="link"){const S=c.findElement(A.sliceId)?.element?.fields?.find(ae=>ae.name===A.fieldName)?.link??{};c.updateField(A.sliceId,A.fieldName,{...S,text:J})}else c.updateField(A.sliceId,A.fieldName,J);continue}const D=`${A.sliceId}::${A.fieldName}`;if(!y.has(D)){const B=(c.currentPage?.elements?Q(c.currentPage.elements).find(ae=>String(ae.id)===A.sliceId):void 0)?.fields?.find(ae=>ae.name===A.fieldName),S=Array.isArray(B?.collection)?JSON.parse(JSON.stringify(B.collection)):[];y.set(D,{sliceId:A.sliceId,fieldName:A.fieldName,collection:S})}const O=y.get(D).collection[A.collectionIndex];if(!O||!Array.isArray(O.fields))continue;const T=O.fields.find(K=>K.name===A.subFieldName);T&&(A.type==="link"?T.link={...T.link??{},text:J}:T[A.type]=J)}for(const A of y.values())c.updateField(A.sliceId,A.fieldName,A.collection)}async function G(){if(M.value||!R.value)return;const W=X();if(W.length===0){a.add("Nothing to translate on this page.","msg",4e3),r("close");return}M.value=!0,I.value=!1,F.value=!1,H.value={done:0,total:W.length},V=new AbortController;const E=ma(W,pa),g=[];try{for(const y of E){const A={source_language:l.value.language,language:w.value.language,fields:y.map(D=>({id:D.id,value:D.value}))},J=setTimeout(()=>V?.abort(),va);try{const D=await _e("/api/admin/voix/ai/pages/translate-fields",{method:"POST",body:A,signal:V.signal});g.push(...D.fields??[]),H.value={done:H.value.done+y.length,total:W.length}}finally{clearTimeout(J)}}ne(W,g),a.add(`Translated ${W.length} field${W.length===1?"":"s"} into ${w.value.language}. Review and save.`,"msg",5e3),r("close")}catch(y){if(g.length>0&&ne(W,g),I.value){const J=g.length;a.add(J>0?`Translation cancelled. ${J} field${J===1?"":"s"} already translated were kept — review and save.`:"Translation cancelled.","msg",5e3),r("close");return}console.error("[translate-in-place] failed",y);const A=y?.name==="AbortError"||y?.cause?.name==="AbortError"||typeof y?.message=="string"&&y.message.toLowerCase().includes("abort");a.add(A?"Translation timed out on a batch. Some fields may not be translated — try again.":"Translation failed. Please try again.","error",5e3)}finally{M.value=!1,F.value=!1,H.value={done:0,total:0},V=null}}function z(){if(M.value){F.value=!0;return}r("close")}function Y(){I.value=!0,V?.abort()}function ie(){F.value=!1}return(W,E)=>{const g=Le;return o(),se(ct,{show:!0,"can-close":!M.value,onClose:z},{default:pe(()=>[e("div",ga,[e("div",xa,[e("div",fa,[k(g,{name:"heroicons:language-20-solid",size:"15"})]),E[2]||(E[2]=e("div",{class:"flex-1 min-w-0"},[e("h3",{class:"text-[15px] font-semibold text-voix-admin-900 tracking-tight leading-tight"}," Translate this page "),e("div",{class:"font-mono text-[11px] text-voix-admin-400 leading-tight mt-0.5 truncate"}," pages/translate → in place ")],-1)),e("button",{type:"button",class:"w-7 h-7 rounded-md flex items-center justify-center text-voix-admin-400 hover:bg-voix-admin-100 hover:text-voix-admin-900 cursor-pointer",onClick:z},[k(g,{name:"heroicons:x-mark-20-solid",size:"14"})])]),e("div",ba,[e("div",ha,[e("h4",ya,C(M.value?"Status":"Languages"),1),E[3]||(E[3]=e("span",{class:"absolute left-0 bottom-0 w-5 h-0.5 bg-voix-admin-800 rounded-full"},null,-1))]),M.value?(o(),s("div",_a,[e("div",$a,[e("p",Sa," Translating from "+C(l.value.language)+" into "+C(w.value.language)+"… ",1),H.value.total?(o(),s("span",Ca,C(H.value.done)+"/"+C(H.value.total),1)):_("",!0)]),e("div",Pa,[e("div",{class:"h-full rounded-full bg-voix-admin-500 transition-[width] duration-300 ease-out",style:Ee({width:`${P.value}%`})},null,4)]),F.value?(o(),s("p",Ea," Stop translating? Fields already translated will be kept, the rest will be left as-is. ")):_("",!0)])):(o(),s("div",wa,[E[4]||(E[4]=e("p",{class:"text-[12px] text-voix-admin-600 leading-relaxed"}," Every text, textarea, and rich-text field on this page will be translated and updated in place. Your changes are staged — save the release when you're happy. ",-1)),e("div",ka,[k(Ue,{id:"translate-in-place-source",modelValue:l.value.language,"onUpdate:modelValue":E[0]||(E[0]=y=>l.value.language=y),label:"From",options:L.value,placeholder:"Source language"},null,8,["modelValue","options"]),k(Ue,{id:"translate-in-place-target",modelValue:w.value.language,"onUpdate:modelValue":E[1]||(E[1]=y=>w.value.language=y),label:"To",options:j.value,placeholder:"Target language"},null,8,["modelValue","options"])])]))]),M.value?F.value?(o(),s("div",Aa,[e("button",{type:"button",class:"h-9 px-4 roun
7ded-md text-[13px] font-medium text-voix-admin-700 hover:bg-voix-admin-100 cursor-pointer",onClick:ie}," Keep translating "),e("button",{type:"button",class:"h-9 px-4 rounded-md border border-rose-300 text-rose-700 hover:bg-rose-50 hover:border-rose-500 text-[13px] font-semibold cursor-pointer",onClick:Y}," Stop translating ")])):_("",!0):(o(),s("div",Ta,[e("button",{type:"button",class:"h-9 px-4 rounded-md text-[13px] font-medium text-voix-admin-700 hover:bg-voix-admin-100 cursor-pointer",onClick:z}," Cancel "),e("button",{type:"button",disabled:!R.value,class:"h-9 px-4 rounded-md bg-voix-admin-800 hover:bg-voix-admin-900 text-white text-[13px] font-medium shadow-sm inline-flex items-center gap-1.5 cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-voix-admin-800",onClick:G},[k(g,{name:"heroicons:language-20-solid",size:"14"}),E[5]||(E[5]=ce(" Translate page ",-1))],8,Ia)]))])]),_:1},8,["can-close"])}}},Ra={class:"px-4 pb-4 space-y-3"},La={class:"text-[11px] text-voix-admin-400"},Ma=["disabled"],Da={class:"px-4 pb-4 space-y-2"},Fa={key:0,class:"px-4 py-6 flex items-center gap-2 text-[12px] text-voix-admin-500"},ja={class:"divide-y divide-voix-admin-100"},Oa={class:"flex items-baseline justify-between gap-2 mb-1.5"},za={class:"flex items-baseline gap-2 min-w-0"},Ua={class:"font-mono text-[10px] text-voix-admin-400 shrink-0"},qa={class:"text-[13px] font-medium text-voix-admin-900 truncate"},Na={class:"font-mono text-[10px] text-voix-admin-400 shrink-0"},Ba=["onUpdate:modelValue","disabled"],Ga={key:0,class:"px-4 py-6 flex items-center gap-2 text-[12px] text-voix-admin-500"},Ha={key:1,class:"px-4 py-6 text-center text-[12px] text-voix-admin-500"},Wa={key:2,class:"divide-y divide-voix-admin-100"},Xa={class:"text-[12px] font-medium text-voix-admin-900 leading-snug"},Ya=["onUpdate:modelValue","disabled"],Ka={key:3,class:"px-4 py-4 text-[12px] text-voix-admin-600 flex items-center gap-2"},Ja={class:"px-4 py-3 flex items-center justify-between gap-2"},Qa=["disabled"],Za={class:"flex items-center gap-2"},el=["disabled"],tl=["disabled"],nl={class:"relative z-[200000]"},ol={__name:"PageAi",emits:["close"],setup(t,{emit:n}){const i=n,r=Se(),u=yt(),c=qe(),a=Oe(),p=["text","textarea","wysiwyg","link"];function v(g){return g.maxItems?Math.max(1,Math.floor(g.maxItems/2)):g.minItems?g.minItems:5}const d=$(1),m=$(""),b=$([]),f=$([]),l=$(!1),w=$(!1),x=$(!1),L=$(null);function j(g,y=[]){if(!g)return y;for(const A of g)A.type==="slice"&&A.enabled!==!1&&y.push(A),"elements"in A&&Array.isArray(A.elements)&&j(A.elements,y);return y}function R(g){const y=u.slices[g];if(!y?.fields)return[];const A=[...p,"collection"];return Object.entries(y.fields).filter(([,J])=>A.includes(J.type)).map(([J,D])=>{if(D.type==="collection"){const U=Object.entries(D.fields||{}).filter(([,O])=>p.includes(O.type)).map(([O,T])=>({name:O,label:T.label,type:T.type,...T.description?{description:T.description}:{}}));return{name:J,label:D.label,type:"collection",...D.description?{description:D.description}:{},...D.maxItems?{maxItems:D.maxItems}:{},count:v(D),fields:U}}return{name:J,label:D.label,type:D.type,...D.description?{description:D.description}:{}}})}function M(){return r.currentPage?.elements?j(r.currentPage.elements).map(y=>{const A=u.slices[y.component],J=R(y.component);return{id:String(y.id),component:y.component,label:A?.name?.label??y.label??y.component,description:"",fieldCount:J.length}}).filter(y=>y.fieldCount>0):[]}const I=h(()=>m.value.trim().length>=10),F=h(()=>b.value.every(g=>g.description.trim().length>0));async function V(){if(I.value){if(b.value=M(),b.value.length===0){a.add("No fillable slices on this page","error",4e3);return}d.value=2,await H()}}async function H(){if(!l.value){l.value=!0;try{const g={subject:m.value,slices:b.value.map(A=>({id:A.id,component:A.component,label:A.label,fields:R(A.component)}))},y=await _e("/api/admin/voix/ai/pages/wizard/prefill-descriptions",{method:"POST",body:g});for(const A of y.descriptions??[]){const J=b.value.find(D=>D.id===A.id);J&&(J.description=A.description)}}catch(g){console.error("Prefill failed",g),a.add("Could not prefill descriptions. You can still fill them manually.","error",4e3)}finally{l.value=!1}}}async function P(){F.value&&(d.value=3,f.value.length===0&&await Q())}async function Q(){if(!w.value){w.value=!0;try{const g=await _e("/api/admin/voix/ai/pages/wizard/clarifying-questions",{method:"POST",body:{subject:m.value,slices:b.value.map(y=>
7({id:y.id,component:y.component,label:y.label,description:y.description}))}});f.value=(g.questions??[]).map((y,A)=>({id:`q-${A}`,question:y,answer:""}))}catch(g){console.error("Question generation failed",g),a.add("Could not generate clarifying questions. Proceeding without them.","error",4e3),f.value=[]}finally{w.value=!1}}}function X(g){const y=f.value.filter(J=>J.answer.trim().length>0).map(J=>`Q: ${J.question}
8A: ${J.answer.trim()}`).join(`
9
10`),A=[`Page subject: ${m.value.trim()}`,`This section: ${g.trim()}`];return y&&A.push(`Additional context:
11${y}`),A.join(`
12
13`)}async function ne(){if(x.value)return;x.value=!0,L.value={done:0,total:b.value.length};const g=[];try{for(const y of b.value){const A=R(y.component);if(A.length===0){L.value={done:L.value.done+1,total:b.value.length};continue}const J=A.filter(D=>D.type==="collection");try{const D=await _e("/api/admin/voix/ai/pages/slices/contents",{method:"POST",body:{description:X(y.description),fields:A}});G(y,D.assignments??[]);const U=[];Y(y,D.collections,U);const O=u.slices[y.component];for(const T of J){const K=D.collections?.find(S=>z(O,S.name)===T.name);if(!K||!Array.isArray(K.items)||K.items.length===0){g.push({sliceLabel:y.label,kind:"missing-collection",detail:T.label||T.name});continue}const B=T.count??0;B>0&&K.items.length<B&&g.push({sliceLabel:y.label,kind:"short-collection",detail:`${T.label||T.name} (got ${K.items.length} of ${B})`})}for(const T of U)g.push({sliceLabel:y.label,kind:"unknown-collection",detail:`LLM returned "${T}" — no matching collection field`})}catch(D){console.error(`[page-ai] Failed to generate ${y.label}`,D),g.push({sliceLabel:y.label,kind:"failed",detail:D?.message||"request failed"})}L.value={done:L.value.done+1,total:b.value.length}}if(g.length===0)a.add("AI copy generated — review and save to commit.","msg",5e3);else{const y=g.slice(0,3).map(D=>`${D.sliceLabel}: ${D.detail}`).join("; "),A=g.length>3?` (+${g.length-3} more — see console)`:"",J=g.length===1?"issue":"issues";
13a.add(`AI copy generated with ${g.length} ${J}: ${y}${A}`,"warning",1e4),console.warn("[page-ai] generation issues",g)}i("close")}finally{x.value=!1,L.value=null}}function G(g,y){const A=u.slices[g.component],J=r.findElement(g.id)?.element;if(J)for(const D of y){const U=A?.fields?.[D.name];U&&c.setupSliceFields(J,{...U,name:D.name}),r.enableField(g.id,D.name),D.link_text||D.link_url?r.updateField(g.id,D.name,{text:D.link_text||"",href:D.link_url||"",url:D.link_url||""}):D.value!==null&&D.value!==void 0&&r.updateField(g.id,D.name,D.value)}}function z(g,y){const A=g?.fields;if(!A)return null;if(A[y]?.type==="collection")return y;const J=y.trim().toLowerCase();for(const[D,U]of Object.entries(A))if(U.type==="collection"&&(D.toLowerCase()===J||U.label?.toLowerCase()===J))return D;return null}function Y(g,y,A){if(!y?.length)return;const J=u.slices[g.component],D=r.findElement(g.id)?.element;if(!D)return;const{buildItemFromAssignments:U}=Dn();for(const O of y){const T=z(J,O.name);if(!T){console.warn("[page-ai] Unknown collection in LLM response:",O.name),A.push(O.name);continue}T!==O.name&&console.warn(`[page-ai] LLM returned "${O.name}", resolved to field key "${T}"`);const K=J.fields[T];c.setupSliceFields(D,{...K,name:T}),r.enableField(g.id,T);const B=D.fields?.find(Me=>Me.name===T),S=Array.isArray(B?.collection)?B.collection:[],ae=K.maxItems?Math.max(0,K.maxItems-S.length):O.items.length,re=O.items.slice(0,ae).map(Me=>U(K,Me.fields||[]));re.length!==0&&r.updateField(g.id,T,[...S,...re])}}const ie=h(()=>d.value===1?"Step 1 of 3 — subject":d.value===2?`Step 2 of 3 — ${b.value.length} section${b.value.length===1?"":"s"}`:"Step 3 of 3 — clarifying questions"),W=$(!1);function E(){r.currentPage&&(W.value=!0)}return(g,y)=>{const A=Le;return o(),s(le,null,[k(ot,{icon:"heroicons:sparkles",title:"AI Copy",subtitle:ie.value,"show-back":d.value>1,onClose:y[2]||(y[2]=J=>i("close")),onBack:y[3]||(y[3]=J=>d.value=d.value-1)},{footer:pe(()=>[e("div",Ja,[e("button",{class:"h-8 px-3 rounded-md text-[12px] font-medium text-voix-admin-600 bg-transparent hover:bg-voix-admin-100 hover:text-voix-admin-800 transition-colors cursor-pointer disabled:opacity-50",disabled:x.value,onClick:y[1]||(y[1]=J=>i("close"))}," Cancel ",8,Qa),e("div",Za,[d.value===2?(o(),s("button",{key:0,class:"h-8 px-3 rounded-md text-[12px] font-semibold text-white bg-voix-admin-800 hover:bg-voix-admin-900 transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed",disabled:!F.value||l.value,onClick:P}," Next → ",8,el)):d.value===3?(o(),s("button",{key:1,class:"h-8 px-3 rounded-md text-[12px] font-semibold text-white bg-voix-admin-800 hover:bg-voix-admin-900 transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed inline-flex items-center gap-1.5",disabled:x.value||w.value,onClick:ne},[x.value?(o(),se(A,{key:1,name:"heroicons:arrow-path",size:"13",class:"animate-spin"})):(o(),se(A,{key:0,name:"heroicons:sparkles",size:"13"})),e("span",null,C(x.value?"Generating…":"Generate copy"),1)],8,tl)):_("",!0)])])]),default:pe(()=>[d.value===1?(o(),s(le,{key:0},[k(Ve,{label:"What's this page about?"}),e("div",Ra,[y[6]||(y[6]=e("p",{class:"text-[12px] text-voix-admin-600 leading-relaxed"}," Describe the subject, audience, and goal of this page. The more specific you are, the better AI can tailor the copy across every slice. ",-1)),ue(e("textarea",{"onUpdate:modelValue":y[0]||(y[0]=J=>m.value=J),rows:"8",class:"w-full px-3 py-2.5 text-[13px] text-voix-admin-900 bg-white border border-voix-admin-200 rounded-md focus:outline-none focus:ring-2 focus:ring-voix-admin-300 focus:border-voix-admin-400 placeholder:text-voix-admin-400 leading-relaxed",placeholder:"E.g. A landing page for small-business accountants launching a new tax-prep workflow product. Tone: confident, plain-spoken, slightly irreverent."},null,512),[[$e,m.value]]),e("div",La,C(m.value.trim().length)+" characters · min 10 ",1),e("button",{type:"button",class:"inline-flex items-center gap-1.5 h-8 px-3 rounded-md text-[12px] font-semibold text-white bg-voix-admin-800 hover:bg-voix-admin-900 transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed",disabled:!I.value,onClick:V},[k(A,{name:"heroicons:sparkles",size:"13"}
13),y[5]||(y[5]=ce(" Fill Slices with AI ",-1))],8,Ma)]),k(Ve,{label:"Translation"}),e("div",Da,[y[8]||(y[8]=e("p",{class:"text-[12px] text-voix-admin-600 leading-relaxed"}," Translate everything on this page into another language with AI. ",-1)),e("button",{type:"button",class:"inline-flex items-center gap-1.5 h-8 px-3 rounded-md text-[12px] font-semibold text-white bg-voix-admin-800 hover:bg-voix-admin-900 transition-colors cursor-pointer",onClick:E},[k(A,{name:"heroicons:language-20-solid",size:"13"}),y[7]||(y[7]=ce(" Translate with AI ",-1))])])],64)):d.value===2?(o(),s(le,{key:1},[k(Ve,{label:"What goes in each section?"}),y[10]||(y[10]=e("div",{class:"px-4 pb-2 text-[12px] text-voix-admin-600 leading-relaxed"}," We've pre-filled each section based on its structure. Tweak to match your intent. ",-1)),l.value?(o(),s("div",Fa,[k(A,{name:"heroicons:sparkles",size:"14",class:"animate-pulse"}),y[9]||(y[9]=e("span",null,"Pre-filling descriptions…",-1))])):_("",!0),e("div",ja,[(o(!0),s(le,null,fe(b.value,(J,D)=>(o(),s("div",{key:J.id,class:"px-4 py-3"},[e("div",Oa,[e("div",za,[e("span",Ua,C(String(D+1).padStart(2,"0")),1),e("div",qa,C(J.label),1)]),e("span",Na,C(J.fieldCount)+" field"+C(J.fieldCount===1?"":"s"),1)]),ue(e("textarea",{"onUpdate:modelValue":U=>J.description=U,rows:"3",disabled:l.value,class:"w-full px-3 py-2 text-[12px] text-voix-admin-900 bg-white border border-voix-admin-200 rounded-md focus:outline-none focus:ring-2 focus:ring-voix-admin-300 focus:border-voix-admin-400 placeholder:text-voix-admin-400 leading-relaxed disabled:opacity-60",placeholder:"Describe what this section should say…"},null,8,Ba),[[$e,J.description]])]))),128))])],64)):(o(),s(le,{key:2},[k(Ve,{label:"A few more things"}),y[12]||(y[12]=e("div",{class:"px-4 pb-2 text-[12px] text-voix-admin-600 leading-relaxed"}," Answer what you can — blanks are fine. We'll use your answers to sharpen the copy. ",-1)),w.value?(o(),s("div",Ga,[k(A,{name:"heroicons:sparkles",size:"14",class:"animate-pulse"}),y[11]||(y[11]=e("span",null,"Thinking of good questions…",-1))])):f.value.length===0?(o(),s("div",Ha," No clarifying questions — you're ready to generate. ")):(o(),s("div",Wa,[(o(!0),s(le,null,fe(f.value,J=>(o(),s("div",{key:J.id,class:"px-4 py-3 space-y-2"},[e("div",Xa,C(J.question),1),ue(e("textarea",{"onUpdate:modelValue":D=>J.answer=D,rows:"2",disabled:x.value,class:"w-full px-3 py-2 text-[12px] text-voix-admin-900 bg-white border border-voix-admin-200 rounded-md focus:outline-none focus:ring-2 focus:ring-voix-admin-300 focus:border-voix-admin-400 placeholder:text-voix-admin-400 leading-relaxed disabled:opacity-60",placeholder:"Your answer (optional)…"},null,8,Ya),[[$e,J.answer]])]))),128))])),L.value?(o(),s("div",Ka,[k(A,{name:"heroicons:sparkles",size:"14",class:"animate-pulse text-voix-admin-700"}),e("span",null,"Generating copy… "+C(L.value.done)+" / "+C(L.value.total),1)])):_("",!0)],64))]),_:1},8,["subtitle","show-back"]),(o(),se(vt,{to:"#voix-admin-root"},[e("div",nl,[W.value&&N(r).currentPage?(o(),se(Va,{key:0,page:N(r).currentPage,onClose:y[4]||(y[4]=J=>W.value=!1)},null,8,["page"])):_("",!0)])]))],64)}}},qt=to("analyticsEventsStore",{state:()=>({events:{paginatorInfo:{},data:[]},event:{},pageTrackings:{data:[]}}),actions:{setEvents(t){this.events=t},setEvent(t){this.event=t},setPageTrackings(t){this.pageTrackings={data:t}}}});async function il(t){return await _e(`/api/admin/voix/pages/${t}/campaigns`)}async function sl(t,n){const i=Oe();return await _e(`/api/admin/voix/pages/${t}/campaigns`,{method:"POST",body:{campaign_id:n}}).then(u=>(i.add("Campaign assigned","msg"),u)).catch(()=>{throw new Error("Unable to assign campaign")})}async function al(t,n){const i=Oe();await _e(`/api/admin/voix/pages/${t}/campaigns/${n}`,{method:"DELETE"}).then(()=>{i.add("Campaign removed","msg")}).catch(()=>{throw new Error("Unable to remove campaign")})}async function ll(t){return await _e(`/api/admin/voix/analytics-element-tracking?element_id=${t}`)}async function rl(t){const n=Oe();return await _e("/api/admin/voix/analytics-element-tracking",{method:"POST",body:t}).then(r=>(n.add("Tracking assigned","msg"),r)).catch(()=>{throw new Error("Unable to assign tracking")})}async function dl(t,n){const i=Oe();return await _e(`/api/admin/voix/analytics-element-tracking/${t}`,{method:"PUT",body:n}).then(u=>(i.add("Tracking updated","msg"),u)).catch(()=>{throw new Error("Unable to update tracking")})}async function ul(t){const n=Oe();await _e(`/api/admin/voix/analytics-element-tracking/${t}`,{method:"DELETE"}).then(()=>{n.add("Tracking removed","msg")}).catch(()=>{throw new Error("Unable to remove tracking")})}const cl={class:"group w-full px-4 py-3 flex items-start gap-3 hover:bg-voix-admin-50/70 transition-colors"},pl={class:"w-8 h-8 rounded-md bg-gradient-to-br from-white to-voix-admin-100 ring-1 ring-voix-admin-200/50 text-voix-admin-500 flex items-center justify-center shrink-0"},vl={class:"flex-1 min-w-0"},ml={class:"text-[13px] font-medium text-voix-admin-900 truncate"},gl={key:0,class:"mt-0.5 font-mono text-[11px] text-voix-admin-500 truncate"},xl={class:"flex items-center gap-1 shrink-0 pt-0.5"},fl={__name:"PageAnalyticsCampaignRow",props:{campaign:{type:Object,required:!0}},emits:["remove"],setup(t,{emit:n}){const i=n;return(r,u)=>{const c=Le;return o(),s("div",cl,[e("div",pl,[k(c,{name:"heroicons:megaphone",size:"13"})]),e("div",vl,[e("div",ml,C(t.campaign.name),1),t.campaign.slug?(o(),s("div",gl,C(t.campaign.slug),1)):_("",!0)]),e("div",xl,[u[1]||(u[1]=e("span",{class:"inline-flex items-center px-2 py-0.5 rounded-full bg-emerald-50 text-emerald-700 text-[10px] font-medium ring-1 ring-emerald-200/70"}," Active ",-1)),e("button",{class:"w-6 h-6 rounded flex items-center justify-center text-voix-admin-400 hover:text-red-600 opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer",title:"Remove",onClick:u[0]||(u[0]=a=>i("remove",t.campaign))},[k(c,{name:"heroicons:trash",size:"13"})])])])}}},bl={key:0,class:"px-4 py-3 border-b border-voix-admin-100/70 bg-voix-admin-50/40"},hl={key:0,class:"flex items-center gap-2"},yl={class:"flex-1"},wl=["disabled"],kl={key:1,class:"flex items-center justify-between gap-2"},_l={key:1,class:"divide-y divide-voix-admin-100/70"},$l={key:2,class:"px-4 py-6 flex flex-col items-start gap-2"},Sl={class:"text-[12px] text-voix-admin-500 italic"},Cl={__name:"PageAnalyticsCampaigns",props:{adding:{type:Boolean,required:!0}},emits:["doneAdding"],setup(t,{emit:n}){const i=t,r=n,u=Se(),c=en(),a=$(""),p=h(()=>c.pageCampaigns.data||[]),v=h(()=>new Set(p.value.map(x=>x.id))),d=h(()=>(c.campaigns.data||[]).length>0),m=h(()=>{const x=(c.campaigns.data||[]).filter(L=>!v.value.has(L.id)).map(L=>({key:String(L.id),value:String(L.id),label:L.name}));return x.length>0&&x.unshift({key:"none",value:"",label:"None"}),x});async function b(){if(!u.currentPage?.id)return;const x=await il(u.currentPage.id),L=Array.isArray(x)?x:x?.data??[];c.setPageCampaigns(L)}ze(async()=>{await Vn({filter:"",orderBy:[],first:100,page:1}),await b()}),we(()=>i.adding,x=>{x||(a.value="")}
13);async function f(){!a.value||!u.currentPage?.id||(await sl(u.currentPage.id,Number(a.value)),await b(),a.value="",r("doneAdding"))}function l(){a.value="",r("doneAdding")}async function w(x){u.currentPage?.id&&(await al(u.currentPage.id,x.id),await b())}return(x,L)=>{const j=Le,R=yo;return o(),s(le,null,[t.adding?(o(),s("div",bl,[m.value.length>1?(o(),s("div",hl,[e("div",yl,[k(Ue,{id:"campaign-select",modelValue:a.value,"onUpdate:modelValue":L[0]||(L[0]=M=>a.value=M),placeholder:"Select Campaign",options:m.value},null,8,["modelValue","options"])]),e("button",{class:"h-8 px-3 rounded-md text-[12px] font-medium bg-voix-admin-800 text-white hover:bg-voix-admin-900 disabled:opacity-50 disabled:cursor-not-allowed transition-colors cursor-pointer",disabled:!a.value,onClick:f}," Add ",8,wl),e("button",{class:"h-8 px-2 rounded-md text-[12px] font-medium text-voix-admin-600 hover:bg-voix-admin-100 transition-colors cursor-pointer",onClick:l}," Cancel ")])):(o(),s("div",kl,[L[2]||(L[2]=e("span",{class:"text-[12px] text-voix-admin-500"}," No campaigns created yet. ",-1)),k(R,{to:"/voix/analytics-campaigns",class:"h-8 px-3 rounded-md text-[12px] font-medium bg-voix-admin-800 text-white hover:bg-voix-admin-900 transition-colors inline-flex items-center gap-1.5 cursor-pointer"},{default:pe(()=>[k(j,{name:"heroicons:arrow-top-right-on-square",size:"12"}),L[1]||(L[1]=ce(" Manage Campaigns ",-1))]),_:1})]))])):_("",!0),p.value.length?(o(),s("div",_l,[(o(!0),s(le,null,fe(p.value,M=>(o(),se(fl,{key:M.id,campaign:M,onRemove:w},null,8,["campaign"]))),128))])):t.adding?_("",!0):(o(),s("div",$l,[e("div",Sl,C(d.value?"No campaign assigned yet.":"No campaigns created yet."),1),d.value?_("",!0):(o(),se(R,{key:0,to:"/voix/analytics-campaigns",class:"h-8 px-3 rounded-md text-[12px] font-medium bg-voix-admin-800 text-white hover:bg-voix-admin-900 transition-colors inline-flex items-center gap-1.5 cursor-pointer"},{default:pe(()=>[k(j,{name:"heroicons:arrow-top-right-on-square",size:"12"}),L[3]||(L[3]=ce(" Manage Campaigns ",-1))]),_:1}))]))],64)}}};function Pl(t){t&&qt().setEvents(t)}async function Nn(t){const n=qe();n.isLoading=!0;const i=new URLSearchParams(t).toString(),r=await _e(`/api/admin/voix/analytics-events?${i.toString()}`);return Pl(r),n.isLoading=!1,r}async function El(t){return await _e(`/api/admin/voix/pages/${t}/layout-tracking`)}async function Tl(t){const n=Oe();return await _e("/api/admin/voix/analytics-layout-element-tracking",{method:"POST",body:t}).then(r=>(n.add("Layout tracking assigned","msg"),r)).catch(()=>{throw new Error("Unable to assign layout tracking")})}async function Il(t,n){const i=Oe();return await _e(`/api/admin/voix/analytics-layout-element-tracking/${t}`,{method:"PUT",body:n}).then(u=>(i.add("Layout tracking updated","msg"),u)).catch(()=>{throw new Error("Unable to update layout tracking")})}async function Al(t){const n=Oe();await _e(`/api/admin/voix/analytics-layout-element-tracking/${t}`,{method:"DELETE"}).then(()=>{n.add("Layout tracking removed","msg")}).catch(()=>{throw new Error("Unable to remove layout tracking")})}const Vl={class:"group w-full px-4 py-3 flex items-start gap-3 hover:bg-voix-admin-50/70 transition-colors"},Rl={class:"w-8 h-8 rounded-md bg-gradient-to-br from-white to-voix-admin-100 ring-1 ring-voix-admin-200/50 text-voix-admin-500 flex items-center justify-center shrink-0"},Ll={class:"flex-1 min-w-0"},Ml={class:"text-[13px] font-medium text-voix-admin-900 truncate"},Dl={class:"mt-0.5 font-mono text-[11px] text-voix-admin-500 truncate"},Fl={class:"w-[140px] shrink-0"},jl={__name:"PageAnalyticsEventRow",props:{hookKey:{type:String,required:!0},hookLabel:{type:String,required:!0},assignedEventName:{type:[String,null],required:!0},options:{type:Array,required:!0},modelValue:{type:String,required:!0}},emits:["update:modelValue"],setup(t,{emit:n}){const i=n;return(r,u)=>{const c=Le;return o(),s("div",Vl,[e("div",Rl,[k(c,{name:"heroicons:cursor-arrow-ripple",size:"13"})]),e("div",Ll,[e("div",Ml,C(t.assignedEventName||t.hookLabel),1),e("div",Dl,C(t.hookKey),1)]),e("div",Fl,[k(Ue,{id:`event-select-${t.hookKey}`,"model-value":t.modelValue,placeholder:"No event",options:t.options,"onUpdate:modelValue":u[0]||(u[0]=a=>i("update:modelValue",a))}
13,null,8,["id","model-value","options"])])])}}},Ol={key:0,class:"px-4 py-6 text-[12px] text-voix-admin-500 italic"},zl={key:1,class:"divide-y divide-voix-admin-100/70"},Ul={__name:"PageAnalyticsEvents",setup(t){const n=Se(),i=wt(),r=qt(),u=h(()=>{const l=n.currentPage?.layout;return l&&i.layouts[l]||null}),c=h(()=>u.value?.hooks||[]),a=h(()=>r.pageTrackings.data||[]),p=h(()=>(r.events.data||[]).filter(l=>l.is_active)),v=h(()=>[{key:"none",value:"",label:"None"},...p.value.map(l=>({key:String(l.id),value:String(l.id),label:l.name}))]);function d(l){return a.value.find(w=>w.layout_element_key===l)}function m(l){const w=d(l);return w?.event_id?String(w.event_id):""}function b(l){const w=d(l);return w?.event_id?p.value.find(L=>L.id===w.event_id)?.name??w.event_name??null:null}ze(async()=>{if(await Nn({filter:"",orderBy:[],first:100,page:1}),n.currentPage?.id){const l=await El(n.currentPage.id),w=Array.isArray(l)?l:l?.data??[];r.setPageTrackings(w)}});async function f(l,w){if(!n.currentPage?.id)return;const x=d(l),L=a.value;if(!w||w===""){x?.id&&(await Al(x.id),r.setPageTrackings(L.filter(R=>R.id!==x.id)));return}const j={page_id:n.currentPage.id,layout_element_key:l,event_id:Number(w)};if(x?.id){const R=await Il(x.id,j),M=L.map(I=>I.id===x.id?R:I);r.setPageTrackings(M)}else{const R=await Tl(j);r.setPageTrackings([...L,R])}}return(l,w)=>c.value.length?(o(),s("div",zl,[(o(!0),s(le,null,fe(c.value,x=>(o(),se(jl,{key:x.key,"hook-key":x.key,"hook-label":x.label,"assigned-event-name":b(x.key),options:v.value,"model-value":m(x.key),"onUpdate:modelValue":L=>f(x.key,L)},null,8,["hook-key","hook-label","assigned-event-name","options","model-value","onUpdate:modelValue"]))),128))])):(o(),s("div",Ol," This layout has no trackable hooks declared. "))}},ql={class:"px-4 py-3 flex items-center justify-end"},Nl={__name:"PageAnalytics",emits:["close"],setup(t,{emit:n}){const i=n,r=Se(),u=wt(),c=en(),a=qt(),p=$(!1),v=h(()=>c.pageCampaigns.data?.length??0),d=h(()=>{const f=r.currentPage?.layout;return f?u.layouts[f]?.hooks?.length??0:0}),m=h(()=>a.pageTrackings.data?.length??0),b=h(()=>{const f=v.value,l=d.value>0?m.value:0,w=`${f} campaign${f===1?"":"s"}`,x=`${l} event${l===1?"":"s"}`;return`${w} · ${x}`});return(f,l)=>(o(),se(ot,{icon:"heroicons:chart-bar",title:"Analytics",subtitle:b.value,"can-add":!p.value,"add-label":"Add campaign",onAdd:l[2]||(l[2]=w=>p.value=!0),onClose:l[3]||(l[3]=w=>i("close"))},{footer:pe(()=>[e("div",ql,[e("button",{class:"h-8 px-3 rounded-md text-[12px] font-medium text-voix-admin-700 hover:bg-voix-admin-100 transition-colors cursor-pointer",onClick:l[1]||(l[1]=w=>i("close"))}," Done ")])]),default:pe(()=>[k(Ve,{label:"Campaigns"}),k(Cl,{adding:p.value,onDoneAdding:l[0]||(l[0]=w=>p.value=!1)},null,8,["adding"]),k(Ve,{label:"Events"}),k(Ul)]),_:1},8,["subtitle","can-add"]))}},Bl=xe(async()=>ge(()=>import("./R1pSGarf.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69]),import.meta.url)),Gl=xe(async()=>ge(()=>import("./tcgpm9iK.js"),__vite__mapDeps([70,3,12,13,2,4,5,14,15,16,17,18,19,20,71,72,22,23,24,25,26,27,28,29,30,31,21,32,33,34,7,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,10,50,1,6,8,9,11,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68]),import.meta.url)),Hl=xe(async()=>ge(()=>import("./B3dBiMBL.js"),__vite__mapDeps([73,3,12,13,2,4,5,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,7,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,10,50,1,6,8,9,11,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,74]),import.meta.url)),Wl=xe(async()=>ge(()=>import("./BEiuURPm.js"),__vite__mapDeps([75,12,3,13,2,4,5,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,7,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,10,50,1,6,8,9,11,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,76]),import.meta.url)),Xl=xe(async()=>ge(()=>import("./C4LHjBzN.js"),__vite__mapDeps([77,12,3,13,2,4,5,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,7,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,10,50,1,6,8,9,11,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,78]),import.meta.url)),Yl=xe(async()=>ge(()=>import("./BOvsuBf2.js"),__vite__mapDeps([79,12,3,13,2,4,5,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,7,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,10,50,1,6,8,9,11,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,80]),import.meta.url)),Kl=xe(async()=>ge(()=>import("./Cu3LCRB1.js"),__vite__mapDeps([81,12,3,13,2,4,5,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,7,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,10,50,1,6,8,9,11,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,82]),import.meta.url)),Jl=xe(async()=>ge(()=>import("./C-6fpRs1.js"),__vite__mapDeps([83,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,84,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,85]),import.meta.url)),Ql=xe(async()=>ge(()=>import("./Bd2za2Iw.js"),__vite__mapDeps([86,61,2,3,4,5,24,25,26,27,20,28,34,62,63,7,31,15,21,16,32,33,45,46,47,48,49,10,50,8,14,64,12,13,17,18,19,22,23,29,30,35,36,37,38,39,40,41,42,43,44,1,6,9,11,51,52,53,54,55,56,57,58,59,60,65,66,67,68]),import.meta.url)),Zl=xe(async()=>ge(()=>import("./CIJRsord.js"),__vite__mapDeps([87,3,12,13,2,4,5,14,15,16,17,18,19,20,22,23,24,25,26,27,28,29,30,31,21,32,33,34,7,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,10,50,1,6,8,9,11,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68]),import.meta.url)),er=xe(async()=>ge(()=>import("./BSKnD9WB.js"),__vite__mapDeps([88,61,2,3,4,5,24,25,26,27,20,28,34,62,63,7,31,15,21,16,32,33,45,46,47,48,49,10,50,8,14,64,12,13,17,18,19,22,23,29,30,35,36,37,38,39,40,41,42,43,44,1,6,9,11,51,52,53,54,55,56,57,58,59,60,65,66,67,68]),import.meta.url)),tr=xe(async()=>ge(()=>import("./DlH4dmoe.js"),__vite__mapDeps([89,3,12,13,2,4,5,14,15,16,17,18,19,20,45,46,47,48,49,10,7,50,1,6,8,9,11,31,21,32,33,22,23,24,25,26,27,28,29,30,34,35,36,37,38,39,40,41,42,43,44,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,90]),import.meta.url)),nr=xe(async()=>ge(()=>import("./DX_Ze6nC.js"),__vite__mapDeps([91,2,3,4,5,14,15,16,61,24,25,26,27,20,28,34,62,63,7,31,21,32,33,45,46,47,48,49,10,50,8,64,12,13,17,18,19,22,23,29,30,35,36,37,38,39,40,41,42,43,44,1,6,9,11,51,52,53,54,55,56,57,58,59,60,65,66,67,68]),import.meta.url)),or=xe(async()=>ge(()=>import("./Bf0SV2xR.js"),__vite__mapDeps([92,2,3,4,5,31,15,21,16,32,33,12,13,14,17,18,19,20,22,23,24,25,26,27,28,29,30,34,7,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,10,50,1,6,8,9,11,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68]),import.meta.url)),ir=xe(async()=>ge(()=>import("./Bql5vTWA.js"),__vite__mapDeps([93,14,15,3,2,4,5,16,12,13,17,18,19,20,22,23,24,25,26,27,28,29,30,31,21,32,33,34,7,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,10,50,1,6,8,9,11,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68]),import.meta.url)),sr=xe(async()=>ge(()=>import("./CxJYGfdt.js"),__vite__mapDeps([94,31,2,3,4,5,15,21,16,32,33,14,54,12,13,37,38,24,25,26,27,20,28,39,17,18,19,95,22,23,29,30,34,7,35,36,40,41,42,43,44,45,46,47,48,49,10,50,1,6,8,9,11,51,52,53,55,56,57,58,59,60,61,62,63,64,65,66,67,68]),import.meta.url)),ar=xe(async()=>ge(()=>import("./DsV704Ac.js"),__vite__mapDeps([96,15,3,2,4,5,12,13,14,16,17,18,19,20,97,22,23,24,25,26,27,28,29,30,31,21,32,33,34,7,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,10,50,1,6,8,9,11,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68]),import.meta.url)),lr=xe(async()=>ge(()=>import("./CoP4L1Z1.js"),__vite__mapDeps([98,12,3,13,2,4,5,14,15,16,17,18,19,20,22,23,24,25,26,27,28,29,30,31,21,32,33,34,7,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,10,50,1,6,8,9,11,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68]),import.meta.url)),rr=xe(async()=>ge(()=>import("./CCRYpa1v.js"),__vite__mapDeps([99,2,3,4,5,31,15,21,16,32,33,58,59,12,13,14,45,46,47,48,49,10,7,50,17,18,19,20,22,23,24,25,26,27,28,29,30,34,35,36,37,38,39,40,41,42,43,44,1,6,8,9,11,51,52,53,54,55,56,57,60,61,62,63,64,65,66,67,68]),import.meta.url)),dr=xe(async()=>ge(()=>import("./yJvzLjmX.js"),__vite__mapDeps([100,2,3,4,5,58,59,24,25,26,27,20,28,12,43,17,18,19,22,15,23,29,30,31,21,16,32,33,34,7,35,36,37,38,39,40,41,42,44,45,46,47,48,49,10,50,1,6,8,9,11,51,52,53,54,55,56,57,60,14,61,62,63,64,65,66,67,68]),import.meta.url)),ur=xe(async()=>ge(()=>import("./C4DL7S0g.js"),__vite__mapDeps([101,31,2,3,4,5,15,21,16,32,33,12,13,14,37,38,24,25,26,27,20,28,39,17,18,19,95,22,23,29,30,34,7,35,36,40,41,42,43,44,45,46,47,48,49,10,50,1,6,8,9,11,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68]),import.meta.url)),cr=xe(async()=>ge(()=>import("./D_S87WtP.js"),__vite__mapDeps([102,3,12,13,2,4,5,14,15,16,17,18,19,20,22,23,24,25,26,27,28,29,30,31,21,32,33,34,7,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,10,50,1,6,8,9,11,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68]),import.meta.url)),pr={events:Bl,eventorder:Gl,eventlist:Hl,venues:Wl,restaurants:Xl,animations:Yl,specialcategories:Kl,blogpost:Jl,text:Ql,number:Zl,textarea:er,media:tr,wysiwyg:nr,select:or,checkbox:ir,link:sr,datetime:ar,color:lr,files:rr,collection:dr,event:ur,form:cr},Nt={__name:"GlobalField",props:{element:{type:Object,required:!1},isPageField:{type:Boolean,required:!1,default:!1},fieldData:{type:Object,default:null,required:!1},fieldConfiguration:{type:Object,required:!0}},setup(t){const n=t,i=h(()=>pr[n.fieldConfiguration.type]);return(r,u)=>(o(),s(le,null,[ht(r.$slots,"field"),i.value?(o(),se(Sn(i.value),{key:0,element:t.element,"is-page-field":t.isPageField,"field-configuration":t.fieldConfiguration,"field-data":t.fieldData},null,8,["element","is-page-field","field-configuration","field-data"])):_("",!0)],64))}},vr={class:"px-4 pb-3"},mr={class:"inline-flex items-center px-2 py-1 rounded bg-voix-admin-100 text-voix-admin-700 text-[11px] font-mono"},gr={class:"px-4 pb-4"},xr={__name:"PageFieldsEdit",props:{pageField:{type:Object,required:!0}},emits:["back","close"],setup(t,{emit:n}){const i=t,r=n,{$voix:u}=It(),c=Se(),a=i.pageField,p=$(i.pageField.name),v=h(()=>c.currentPage.fields.find(l=>l.id===i.pageField.id)),d=h(()=>{const l=u.options.pageFields[v.value?.name??""]??{};return l.name=p.value,l}),m=h(()=>d.value?.label??v.value?.name??"page field");function b(){r("back")}function f(){c.updatePageField(a.id,a.name,a),r("back")}return(l,w)=>
13(o(),se(ot,{icon:"heroicons:hashtag",title:"Edit Page Field",subtitle:m.value,"show-back":"",onBack:f,onClose:w[0]||(w[0]=x=>r("close"))},{footer:pe(()=>[e("div",{class:"px-4 py-3 flex items-center justify-end gap-2"},[e("button",{class:"h-8 px-3 rounded-md text-[12px] font-medium text-voix-admin-700 hover:bg-voix-admin-100 transition-colors cursor-pointer",onClick:f}," Cancel "),e("button",{class:"h-8 px-3 rounded-md text-[12px] font-medium bg-voix-admin-900 text-white hover:bg-voix-admin-800 transition-colors cursor-pointer",onClick:b}," Done ")])]),default:pe(()=>[k(Ve,{label:"Field"}),e("div",vr,[e("span",mr,C(v.value.name),1)]),k(Ve,{label:"Value"}),e("div",gr,[v.value?(o(),se(Nt,{key:0,"field-data":v.value,"field-configuration":d.value,"is-page-field":!0},null,8,["field-data","field-configuration"])):_("",!0)])]),_:1},8,["subtitle"]))}},fr={class:"w-8 h-8 rounded-md bg-gradient-to-br from-white to-voix-admin-100 ring-1 ring-voix-admin-200/50 text-voix-admin-500 flex items-center justify-center shrink-0"},br={class:"flex-1 min-w-0"},hr={class:"flex items-baseline gap-2"},yr={class:"text-[13px] font-medium text-voix-admin-900 truncate"},wr={class:"font-mono text-[10px] text-voix-admin-400 uppercase tracking-wider shrink-0"},kr={key:0,class:"mt-1.5 flex items-center gap-2 min-w-0"},_r=["src"],$r={class:"font-mono text-[11px] text-voix-admin-500 truncate"},Sr={key:1,class:"mt-1.5 flex items-center gap-2 min-w-0"},Cr={class:"font-mono text-[11px] text-voix-admin-500 truncate"},Pr={key:3,class:"mt-1 text-[11px] italic text-voix-admin-300 leading-snug"},Er={class:"flex items-center gap-1 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity pt-0.5"},Tr={__name:"PageFieldsRow",props:{field:{type:Object,required:!0},fieldConfiguration:{type:Object,required:!0}},emits:["select","remove"],setup(t,{emit:n}){const i=t,r=n,{localValue:u}=wo({fieldData:i.field,fieldConfiguration:i.fieldConfiguration,isPageField:!0,element:void 0}),c={text:"heroicons:bars-3-bottom-left",textarea:"heroicons:bars-3-bottom-left",media:"heroicons:photo",files:"heroicons:paper-clip",wysiwyg:"heroicons:document-text",collection:"heroicons:rectangle-stack",datetime:"heroicons:calendar",date:"heroicons:calendar",event:"heroicons:calendar-days",number:"heroicons:hashtag",checkbox:"heroicons:check-circle",select:"heroicons:chevron-up-down",color:"heroicons:swatch",link:"heroicons:link",form:"heroicons:envelope"},a=h(()=>(i.fieldConfiguration?.type??i.field.type??"text").toLowerCase()),p=h(()=>i.fieldConfiguration?.label??i.field.name),v=h(()=>c[a.value]??"heroicons:squares-2x2"),d=/<[^>]*>/g,m=/\s+/g;function b(x){return x.replace(d," ").replace(m," ").trim()}function f(x,L=80){return x.length<=L?x:`${x.slice(0,L).trim()}…`}function l(x){if(!x)return"";try{const j=new URL(x).pathname.split("/").filter(Boolean).pop()??x;return decodeURIComponent(j)}catch{return x.split("/").filter(Boolean).pop()??x}}const w=h(()=>{const x=u.value;switch(a.value){case"media":case"files":{const j=(Array.isArray(x)?x:[])[0];return j?.url?{kind:"media",mediaUrl:j.url,mediaName:j.title||j.name||l(j.url)}:{kind:"empty"}}case"collection":{const L=Array.isArray(x)?x:[];if(L.length===0)return{kind:"empty"};const j=[];for(const I of L)if(!(!I||typeof I!="object")){for(const F of Object.values(I)){if(typeof F=="string"&&F.trim()){j.push(F.trim());break}if(typeof F=="number"){j.push(String(F));break}}if(j.length>=3)break}const R=`${L.length} item${L.length===1?"":"s"}`,M=j.length>0?`${R} · ${j.join(", ")}`:R;return{kind:"collection",text:f(M,80)}}case"wysiwyg":return typeof x!="string"||!x.trim()?{kind:"empty"}:{kind:"text",text:f(b(x),80)};case"checkbox":return typeof x=="boolean"?{kind:"text",text:x?"Checked":"Unchecked"}:x==null?{kind:"text",text:"Unchecked"}:{kind:"text",text:x?"Checked":"Unchecked"};case"datetime":case"date":return typeof x!="string"||!x.trim()?{kind:"empty"}:{kind:"text",text:x.replace("T"," ").slice(0,16)};case"color":return typeof x!="string"||!x.trim()?{kind:"empty"}:{kind:"color",colorValue:x,text:x};case"link":{if(x&&typeof x=="object"){const L=x,j=L.label||L.href||L.url;return j?{kind:"text",text:f(String(j),80)}:{kind:"empty"}}
13return typeof x=="string"&&x.trim()?{kind:"text",text:f(x,80)}:{kind:"empty"}}default:return x==null?{kind:"empty"}:typeof x=="string"?x.trim()?{kind:"text",text:f(x,80)}:{kind:"empty"}:typeof x=="number"||typeof x=="boolean"?{kind:"text",text:String(x)}:{kind:"empty"}}});return(x,L)=>{const j=Le;return o(),s("button",{class:"group w-full px-4 py-3 flex items-start gap-3 hover:bg-voix-admin-50/70 text-left cursor-pointer transition-colors",onClick:L[1]||(L[1]=R=>r("select",t.field))},[e("div",fr,[k(j,{name:v.value,size:"13"},null,8,["name"])]),e("div",br,[e("div",hr,[e("div",yr,C(p.value),1),e("span",wr,C(a.value),1)]),w.value.kind==="media"?(o(),s("div",kr,[e("img",{src:w.value.mediaUrl,alt:"",class:"w-6 h-6 rounded object-cover ring-1 ring-voix-admin-200/60 shrink-0",loading:"lazy",width:"24",height:"24"},null,8,_r),e("span",$r,C(w.value.mediaName),1)])):w.value.kind==="color"?(o(),s("div",Sr,[e("span",{class:"w-4 h-4 rounded ring-1 ring-voix-admin-200/60 shrink-0",style:Ee({backgroundColor:w.value.colorValue})},null,4),e("span",Cr,C(w.value.text),1)])):w.value.kind==="text"||w.value.kind==="collection"?(o(),s("div",{key:2,class:ee(["mt-1 text-[12px] text-voix-admin-500 leading-snug line-clamp-1",w.value.kind==="collection"?"font-mono text-[11px]":""])},C(w.value.text),3)):(o(),s("div",Pr," No value set "))]),e("div",Er,[e("span",{class:"w-6 h-6 rounded flex items-center justify-center text-voix-admin-500 hover:text-red-600",title:"Delete",onClick:L[0]||(L[0]=je(R=>r("remove",t.field),["stop"]))},[k(j,{name:"heroicons:trash",size:"13"})]),k(j,{name:"heroicons:chevron-right",size:"12",class:"text-voix-admin-400"})])])}}},Ir={key:0,class:"px-4 py-10 text-center"},Ar={key:1,class:"divide-y divide-voix-admin-100/70"},Vr={class:"px-4 py-3 flex items-center justify-between"},Rr={__name:"PageFieldsIndex",emits:["new","select","close"],setup(t,{emit:n}){const i=n,r=Se(),u=h(()=>r.currentPage.fields||[]),{$voix:c}=It(),a=h(()=>c.options.pageFields),p=h(()=>u.value.filter(b=>a.value[b.name])),v=h(()=>{const b=p.value.length;return`${b} field${b===1?"":"s"}`});function d(b){return a.value[b.name]??{type:b.type,default:null}}function m(b){r.removePageField(b.id)}return(b,f)=>(o(),se(ot,{icon:"heroicons:hashtag",title:"Page Fields",subtitle:v.value,"can-add":"","add-label":"Add page field",onAdd:f[3]||(f[3]=l=>i("new")),onClose:f[4]||(f[4]=l=>i("close"))},{footer:pe(()=>[e("div",Vr,[f[6]||(f[6]=e("span",{class:"text-[11px] text-voix-admin-500"}," Remember to save the page. ",-1)),e("button",{class:"h-8 px-3 rounded-md text-[12px] font-medium text-voix-admin-700 hover:bg-voix-admin-100 transition-colors cursor-pointer",onClick:f[2]||(f[2]=l=>i("close"))}," Done ")])]),default:pe(()=>[k(Ve,{label:"Custom Fields"}),p.value.length===0?(o(),s("div",Ir,[f[5]||(f[5]=e("div",{class:"text-[12px] text-voix-admin-500"}," No page fields yet. ",-1)),e("button",{class:"mt-2 text-[12px] text-voix-admin-700 hover:text-voix-admin-900 font-medium cursor-pointer",onClick:f[0]||(f[0]=l=>i("new"))}," + Add the first page field ")])):(o(),s("div",Ar,[(o(!0),s(le,null,fe(p.value,l=>(o(),se(Tr,{key:l.id,field:l,"field-configuration":d(l),onSelect:f[1]||(f[1]=w=>i("select",w)),onRemove:m},null,8,["field","field-configuration"]))),128))]))]),_:1},8,["subtitle"]))}},Lr={class:"px-4 pb-4"},Mr={key:0,class:"px-3 py-2 rounded-md bg-voix-admin-50 border border-voix-admin-100 text-[12px] text-voix-admin-600"},Dr={class:"px-4 pb-4"},Fr={class:"px-4 py-3 flex items-center justify-end gap-2"},jr=["disabled"],Or={__name:"PageFieldsNew",emits:["back","close"],setup(t,{emit:n}){const i=n,{$voix:r}=It(),u=qe(),c=Se(),a=$(""),p=h(()=>{const l=r.options.pageFields,x=Object.keys(l).filter(L=>!c.currentPage.fields.some(j=>j.name===L)).map(L=>({key:L,value:L,label:l[L].label}));return l[a.value]&&x.push({key:a.value,value:a.value,label:l[a.value].label}),x}),v=h(()=>r.options.pageFields[a.value]),d=$(null),m=h(()=>c.currentPage.fields.find(l=>l.id===d.value));we(a,()=>{d.value&&c.removePageField(d);const l=r.options.pageFields[a.value];if(!l)return;l.name=a.value;const w=u.createNewField(l);c.addPageField(w),d.value=w.id});function b(){i("back")}function f(){d.value&&c.removePageField(d.value),i("back")}return(l,w)=>
13(o(),se(ot,{icon:"heroicons:hashtag",title:"New Page Field",subtitle:"Back to page fields","show-back":"",onBack:f,onClose:w[1]||(w[1]=x=>i("close"))},{footer:pe(()=>[e("div",Fr,[e("button",{class:"h-8 px-3 rounded-md text-[12px] font-medium text-voix-admin-700 hover:bg-voix-admin-100 transition-colors cursor-pointer",onClick:f}," Cancel "),e("button",{class:ee(["h-8 px-3 rounded-md text-[12px] font-medium bg-voix-admin-900 text-white hover:bg-voix-admin-800 transition-colors cursor-pointer",{"opacity-40 cursor-not-allowed":!m.value}]),disabled:!m.value,onClick:b}," Done ",10,jr)])]),default:pe(()=>[m.value?(o(),s(le,{key:1},[k(Ve,{label:"Value"}),e("div",Dr,[v.value?(o(),se(Nt,{key:0,"field-data":m.value,"field-configuration":v.value,"is-page-field":!0},null,8,["field-data","field-configuration"])):_("",!0)])],64)):(o(),s(le,{key:0},[k(Ve,{label:"Field Type"}),e("div",Lr,[p.value.length<1?(o(),s("div",Mr," There are no more fields available to add to this page. ")):(o(),se(Ue,{key:1,id:"field-select",modelValue:a.value,"onUpdate:modelValue":w[0]||(w[0]=x=>a.value=x),placeholder:"Select a field",options:p.value},null,8,["modelValue","options"]))])],64))]),_:1}))}},zr={class:"h-full"},Ur={__name:"PageFields",emits:["close"],setup(t,{emit:n}){const i=n,r=$(!1),u=$(null);function c(v){u.value=v}function a(){u.value=null}function p(){r.value=!1}return(v,d)=>(o(),s("div",zr,[r.value?(o(),se(Or,{key:0,onBack:p,onClose:d[0]||(d[0]=m=>i("close"))})):u.value?(o(),se(xr,{key:1,"page-field":u.value,onBack:a,onClose:d[1]||(d[1]=m=>i("close"))},null,8,["page-field"])):(o(),se(Rr,{key:2,onNew:d[2]||(d[2]=m=>r.value=!0),onClose:d[3]||(d[3]=m=>i("close")),onSelect:c}))]))}},qr={key:0,class:"pt-2 space-y-2"},Nr=["disabled"],Br={key:0,class:"text-[11px] text-voix-admin-500"},Gr={key:1,class:"text-[11px] text-red-600",role:"alert"},Bn={__name:"StructuredDataGenerateButton",props:{pageId:{type:[String,Number],required:!0}},emits:["generated"],setup(t,{emit:n}){const i=t,r=n,{aiContent:u}=Lt(),{checkUserPermissions:c}=Yt(),a=Xt(),p=$(!1),v=$(!1),d=$(""),m=$("");ze(async()=>{p.value=await c("Pages.bulkSeoFix")});async function b(){d.value="",m.value="",v.value=!0;try{const f=await a.dispatchAndPoll({action:"generate_structured_data",page_ids:[Number(i.pageId)]}),l=a.batchId.value;if(!l||f.failed_jobs>0){d.value="Structured data generation failed. Try again.";return}const x=(await _e(`/api/admin/voix/structured-data-suggestions/${l}`)).suggestions?.[0]??null;if(!x||x.status!=="ready"||!x.content){d.value=x?.failure_reason||"No structured data was generated for this page.";return}m.value=x.source==="draft"?"Generated from the saved draft version (not yet published).":x.source==="unpublished"?"Generated from the latest unpublished version.":"Generated from the live published content.",r("generated",x.content)}catch(f){if(f?.status===403){d.value="You do not have permission to generate structured data.";return}d.value=f?.data?.message||f?.message||"Structured data generation failed."}finally{v.value=!1}}return(f,l)=>{const w=Le;return p.value&&N(u)?(o(),s("div",qr,[e("button",{type:"button","data-testid":"generate-structured-data",class:"w-full h-8 rounded-md bg-voix-admin-800 hover:bg-voix-admin-900 text-white text-[12px] font-medium inline-flex items-center justify-center gap-1.5 cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-voix-admin-800",disabled:v.value,onClick:b},[v.value?(o(),se(jt,{key:0,class:"w-3.5 h-3.5 text-white"})):(o(),se(w,{key:1,name:"heroicons:sparkles-20-solid",size:"13"})),ce(" "+C(v.value?"Generating from page…":"Generate with AI"),1)],8,Nr),l[0]||(l[0]=e("p",{class:"text-[11px] text-voix-admin-400 leading-relaxed"}," AI drafts JSON-LD from the page's most recently saved content — draft first, then unpublished version, then live. Nothing is saved until you save the tag. ",-1)),m.value?(o(),s("p",Br,C(m.value),1)):_("",!0),d.value?(o(),s("p",Gr,C(d.value),1)):_("",!0)])):_("",!0)}}},Hr={class:"px-4 pb-3 space-y-2"},Wr=["value"],Xr={key:0,class:"text-[12px] text-voix-admin-600 leading-relaxed"},Yr={class:"px-4 pb-3 space-y-1"},Kr={class:"px-4 pb-3"},Jr={class:"px-4 pb-3"},Qr={class:"px-4 pb-3"},Zr={class:"px-4 pb-4 space-y-2"},ed=["placeholder"],td=["disabled"],Bt="delete head tag",nd={__name:"PageHeadTagEdit",props:{headTag:{type:Object,required:!0}},emits:["back","close"],setup(t,{emit:n}){const i=t,r=n,u=zn(),c=$({id:i.headTag.id,type:i.headTag.type,content:i.headTag.content,is_partytown:i.headTag.is_partytown,position:i.headTag.position}),a=$([]),{availableTags:p}=tn(),v=Se(),{fetchCurrentPage:d,fetchCurrentPageSeoAudit:m}=ft(),b=h(()=>new Set(p.filter(Y=>
13Y.key!=="meta").map(Y=>Y.key))),f=$(!1);we(()=>c.value.type,Y=>{Y!==""&&!b.value.has(Y)&&(f.value=!0)},{immediate:!0});const l=h({get:()=>f.value?"meta":c.value.type,set:Y=>{if(Y==="meta"){f.value=!0,c.value.type="";return}f.value=!1,c.value.type=Y}}),w=h(()=>f.value?p.find(Y=>Y.key==="meta"):p.find(Y=>Y.key===c.value.type)),x=["og:image","twitter:image","msapplication-TileImage","apple-touch-icon"],L=h(()=>x.includes(c.value.type));function j(Y){switch(Y){case"twitter:image":return{width:1200,height:675};case"msapplication-TileImage":return{width:310,height:310};case"apple-touch-icon":return{width:180,height:180};default:return{width:1200,height:630}}}const R=h(()=>({default:j(c.value.type)})),M=$(!0),I=$(null);ze(async()=>{if(x.includes(i.headTag.type)&&i.headTag.content){const Y=j(i.headTag.type);a.value=[{breakpoint:"default",provider:"",url:i.headTag.content,width:Y.width,height:Y.height,title:"",modifiers:{}}]}setTimeout(()=>{M.value=!1},0),await nt(),I.value?.focus()});function F(Y){if(!Y.url||!Y.provider)return"";const ie=j(c.value.type),W={w:ie.width,h:ie.height};return u(Y.url,W,{provider:Y.provider})}we(a,Y=>{if(!M.value&&Y&&Y.length>0){const ie=Y[0];ie?.url&&ie?.provider&&(c.value.content=F(ie))}},{deep:!0});async function V(){v.currentPage&&(await d(xt({path:v.currentPage.path})),v.shareBroadcast("setCurrentPage",{page:v.currentPage}))}async function H(){await jn({id:c.value.id,type:c.value.type,page_id:v.currentPage.id,content:c.value.content,is_partytown:c.value.is_partytown,position:c.value.position}).then(async()=>{await m(v.currentPage.id),await V(),X()})}Cn(()=>{(c.value.type==="script"||c.value.type==="externalScript")&&(c.value.is_partytown=!0)});const P=$(""),Q=h(()=>P.value===Bt);function X(){r("back")}function ne(){X()}async function G(){Q.value&&await ko({id:c.value.id}).then(async()=>{await m(v.currentPage.id),await V(),X()})}const z=h(()=>`Editing ${w.value?.label??c.value.type??"head tag"}`);return(Y,ie)=>(o(),se(ot,{icon:"heroicons:code-bracket",title:"Edit Head Tag",subtitle:z.value,"show-back":"",onBack:X,onClose:ie[7]||(ie[7]=W=>r("close"))},{footer:pe(()=>[e("div",{class:"px-4 py-3 flex items-center justify-end gap-2"},[e("button",{class:"h-8 px-3 rounded-md text-[12px] font-medium text-voix-admin-700 hover:bg-voix-admin-100 transition-colors cursor-pointer",onClick:ne}," Cancel "),e("button",{class:"h-8 px-3 rounded-md text-[12px] font-medium bg-voix-admin-900 text-white hover:bg-voix-admin-800 transition-colors cursor-pointer",onClick:H}," Save ")])]),default:pe(()=>[k(Ve,{label:"Tag Type"}),e("div",Hr,[ue(e("select",{"onUpdate:modelValue":ie[0]||(ie[0]=W=>l.value=W),class:"w-full h-9 border border-voix-admin-200 rounded-md px-3 text-[13px] text-voix-admin-900 bg-white focus:outline-none focus:ring-2 focus:ring-voix-admin-400/40 focus:border-voix-admin-400"},[(o(!0),s(le,null,fe(N(p),W=>(o(),s("option",{key:W.key,value:W.key},C(W.label),9,Wr))),128))],512),[[Pt,l.value]]),w.value?(o(),s("p",Xr,C(w.value.description),1)):_("",!0)]),f.value?(o(),s(le,{key:0},[k(Ve,{label:"Meta Name"}),e("div",Yr,[ue(e("input",{"onUpdate:modelValue":ie[1]||(ie[1]=W=>c.value.type=W),type:"text",placeholder:"google-site-verification",class:"w-full h-9 border border-voix-admin-200 rounded-md px-3 text-[13px] text-voix-admin-900 font-mono bg-white focus:outline-none focus:ring-2 focus:ring-voix-admin-400/40 focus:border-voix-admin-400"},null,512),[[$e,c.value.type]]),ie[8]||(ie[8]=e("p",{class:"text-[12px] text-voix-admin-600 leading-relaxed"},[ce(" Becomes the "),e("span",{class:"font-mono"},"name="),ce(" attribute on the "),e("span",{class:"font-mono"},"<meta>"),ce(" tag. ")],-1))])],64)):_("",!0),L.value?(o(),s(le,{key:1},[k(Ve,{label:"Image"}),e("div",Kr,[k(Fn,{modelValue:a.value,"onUpdate:modelValue":ie[2]||(ie[2]=W=>a.value=W),breakpoints:R.value,class:ee({"h-[36px]":!a.value.length})},null,8,["modelValue","breakpoints","class"])])],64)):_("",!0),k(Ve,{label:"Content"}),e("div",Jr,[ue(e("textarea",{ref_key:"contentTextarea",ref:I,"onUpdate:modelValue":ie[3]||(ie[3]=W=>c.value.content=W),class:"w-full min-h-[160px] border border-voix-admin-200 rounded-md px-3 py-2 text-[13px] text-voix-admin-900 font-mono bg-white focus:outline-none focus:ring-2 focus:ring-voix-admin-400/40 focu
13s:border-voix-admin-400"},null,512),[[$e,c.value.content]]),c.value.type==="structuredDataMarkup"&&N(v).currentPage?(o(),se(Bn,{key:0,"page-id":N(v).currentPage.id,onGenerated:ie[4]||(ie[4]=W=>c.value.content=W)},null,8,["page-id"])):_("",!0)]),k(Ve,{label:"Position"}),e("div",Qr,[k(Ue,{id:"tag-position",modelValue:c.value.position,"onUpdate:modelValue":ie[5]||(ie[5]=W=>c.value.position=W),options:[{label:"Head",value:"head",key:"head"},{label:"Body Open",value:"bodyOpen",key:"bodyOpen"},{label:"Body Close",value:"bodyClose",key:"bodyClose"}]},null,8,["modelValue"])]),k(Ve,{label:"Danger Zone"}),e("div",Zr,[e("p",{class:"text-[12px] text-voix-admin-600 leading-relaxed"},[ie[9]||(ie[9]=ce(" Type ",-1)),e("span",{class:"font-mono text-voix-admin-900"},C(Bt)),ie[10]||(ie[10]=ce(" to confirm deletion. ",-1))]),ue(e("input",{"onUpdate:modelValue":ie[6]||(ie[6]=W=>P.value=W),type:"text",class:"w-full h-9 border border-voix-admin-200 rounded-md px-3 text-[13px] text-voix-admin-900 font-mono bg-white focus:outline-none focus:ring-2 focus:ring-red-400/40 focus:border-red-400",placeholder:`Type '${Bt}' to confirm`},null,8,ed),[[$e,P.value]]),e("button",{class:ee(["w-full h-9 rounded-md text-[12px] font-medium border transition-colors",Q.value?"bg-red-600 text-white border-red-600 hover:bg-red-700 cursor-pointer":"bg-white text-voix-admin-400 border-voix-admin-200 cursor-not-allowed"]),disabled:!Q.value,onClick:G}," Delete head tag ",10,td)])]),_:1},8,["subtitle"]))}},od={class:"px-4 pb-3 space-y-2"},id=["value"],sd={key:0,class:"text-[12px] text-voix-admin-600 leading-relaxed"},ad={class:"px-4 pb-3 space-y-1"},ld={class:"px-4 pb-3"},rd={class:"px-4 pb-3"},dd={class:"px-4 pb-4"},ud={__name:"PageHeadTagNew",props:{pageId:{type:String,required:!0},prefillType:{type:String,default:null}},emits:["back","close"],setup(t,{emit:n}){const i=t,r=n,u=zn(),{availableTags:c}=tn(),a=Se(),{fetchCurrentPage:p,fetchCurrentPageSeoAudit:v}=ft(),d=$({type:i.prefillType??"",content:"",is_partytown:!1,position:"head"}),m=$(null);ze(async()=>{await nt(),m.value?.focus()});const b=$([]),f=h(()=>new Set(c.filter(P=>P.key!=="meta").map(P=>P.key))),l=$(!1);we(()=>d.value.type,P=>{P!==""&&!f.value.has(P)&&(l.value=!0)},{immediate:!0});const w=h({get:()=>l.value?"meta":d.value.type,set:P=>{if(P==="meta"){l.value=!0,d.value.type="";return}l.value=!1,d.value.type=P}}),x=h(()=>l.value?c.find(P=>P.key==="meta"):c.find(P=>P.key===d.value.type)),L=["og:image","twitter:image","msapplication-TileImage","apple-touch-icon"],j=h(()=>L.includes(d.value.type));function R(P){switch(P){case"twitter:image":return{width:1200,height:675};case"msapplication-TileImage":return{width:310,height:310};case"apple-touch-icon":return{width:180,height:180};default:return{width:1200,height:630}}}const M=h(()=>({default:R(d.value.type)}));function I(P){if(!P.url)return"";const Q=R(d.value.type),X={w:Q.width,h:Q.height};return u(P.url,X,{provider:P.provider})}we(b,P=>{if(P&&P.length>0){const Q=P[0];Q?.url&&(d.value.content=I(Q))}},{deep:!0}),Cn(()=>{(d.value.type==="script"||d.value.type==="externalScript")&&(d.value.is_partytown=!0)});async function F(){try{a.currentPage&&(await p(xt({path:a.currentPage.path})),a.shareBroadcast("setCurrentPage",{page:a.currentPage}))}catch(P){console.error("Error refreshing page:",P)}}async function V(){try{await On({page_id:i.pageId,type:d.value.type,content:d.value.content,is_partytown:d.value.is_partytown,position:d.value.position}),await v(i.pageId)}catch(P){console.error("Error creating head tag:",P)}await F(),r("back")}function H(){r("back")}return(P,Q)=>(o(),se(ot,{icon:"heroicons:code-bracket",title:"New Head Tag",subtitle:"Back to head tags","show-back":"",onBack:H,onClose:Q[6]||(Q[6]=X=>r("close"))},{footer:pe(()=>[e("div",{class:"px-4 py-3 flex items-center justify-end gap-2"},[e("button",{class:"h-8 px-3 rounded-md text-[12px] font-medium text-voix-admin-700 hover:bg-voix-admin-100 transition-colors cursor-pointer",onClick:H}," Cancel "),e("button",{class:"h-8 px-3 rounded-md text-[12px] font-medium bg-voix-admin-900 text-white hover:bg-voix-admin-800 transition-colors cursor-pointer",onClick:V}," Create ")])]),default:pe(()=>[k(Ve,{label:"Tag Type"}),e("div",od,[ue(e("select",{"onUpdate:modelValue":Q[0]||(Q[0]=X=>w.value=X),class:"w-full h-9 border border-voix-admin-200 rounded-md px-3 text-[13px] text-voix-admin-900 bg-white focus:outline-none focus:ring-2 focus:ring-voix-admin-400/40 focu
13s:border-voix-admin-400"},[Q[7]||(Q[7]=e("option",{value:"",disabled:""}," Choose a tag type… ",-1)),(o(!0),s(le,null,fe(N(c),X=>(o(),s("option",{key:X.key,value:X.key},C(X.label),9,id))),128))],512),[[Pt,w.value]]),x.value?(o(),s("p",sd,C(x.value.description),1)):_("",!0)]),l.value?(o(),s(le,{key:0},[k(Ve,{label:"Meta Name"}),e("div",ad,[ue(e("input",{"onUpdate:modelValue":Q[1]||(Q[1]=X=>d.value.type=X),type:"text",placeholder:"google-site-verification",class:"w-full h-9 border border-voix-admin-200 rounded-md px-3 text-[13px] text-voix-admin-900 font-mono bg-white focus:outline-none focus:ring-2 focus:ring-voix-admin-400/40 focus:border-voix-admin-400"},null,512),[[$e,d.value.type]]),Q[8]||(Q[8]=e("p",{class:"text-[12px] text-voix-admin-600 leading-relaxed"},[ce(" Becomes the "),e("span",{class:"font-mono"},"name="),ce(" attribute on the "),e("span",{class:"font-mono"},"<meta>"),ce(" tag. ")],-1))])],64)):_("",!0),j.value?(o(),s(le,{key:1},[k(Ve,{label:"Image"}),e("div",ld,[k(Fn,{modelValue:b.value,"onUpdate:modelValue":Q[2]||(Q[2]=X=>b.value=X),breakpoints:M.value,class:ee({"h-[36px]":!b.value.length})},null,8,["modelValue","breakpoints","class"])])],64)):_("",!0),k(Ve,{label:"Content"}),e("div",rd,[ue(e("textarea",{ref_key:"contentTextarea",ref:m,"onUpdate:modelValue":Q[3]||(Q[3]=X=>d.value.content=X),"data-testid":"head-tag-content",class:"w-full min-h-[160px] border border-voix-admin-200 rounded-md px-3 py-2 text-[13px] text-voix-admin-900 font-mono bg-white focus:outline-none focus:ring-2 focus:ring-voix-admin-400/40 focus:border-voix-admin-400"},null,512),[[$e,d.value.content]]),d.value.type==="structuredDataMarkup"?(o(),se(Bn,{key:0,"page-id":i.pageId,onGenerated:Q[4]||(Q[4]=X=>d.value.content=X)},null,8,["page-id"])):_("",!0)]),k(Ve,{label:"Position"}),e("div",dd,[k(Ue,{id:"tag-position",modelValue:d.value.position,"onUpdate:modelValue":Q[5]||(Q[5]=X=>d.value.position=X),options:[{label:"Head",value:"head",key:"head"},{label:"Body Open",value:"bodyOpen",key:"bodyOpen"},{label:"Body Close",value:"bodyClose",key:"bodyClose"}]},null,8,["modelValue"])])]),_:1}))}},cd={class:"divide-y divide-voix-admin-100/70 border-b border-voix-admin-100/70"},pd={key:0,class:"w-full px-4 py-2.5 flex items-center gap-3 text-left"},vd={class:"flex-1 min-w-0"},md={class:"font-mono text-[11px] text-voix-admin-400 truncate"},gd={class:"flex-1 min-w-0"},xd={class:"font-mono text-[11px] text-voix-admin-400 truncate"},fd={class:"flex-1 min-w-0"},bd={class:"font-mono text-[11px] text-voix-admin-400 truncate"},hd={class:"flex-1 min-w-0"},yd={class:"font-mono text-[11px] text-voix-admin-400 truncate"},wd={class:"flex-1 min-w-0"},kd={class:"font-mono text-[11px] text-voix-admin-400 truncate"},_d={key:1,class:"border-b border-voix-admin-100/70"},$d={key:0,class:"px-4 py-3"},Sd=["disabled"],Cd={key:0,class:"mt-2 text-[11px] tone-error",role:"alert"},Pd={key:1,class:"mt-2 text-[11px] tone-error",role:"alert"},Ed={key:1,class:"px-4 py-3 space-y-3"},Td={class:"flex items-center gap-2 mb-1"},Id={class:"flex items-center gap-2 cursor-pointer select-none"},Ad=["onUpdate:modelValue"],Vd={class:"text-[10px] uppercase tracking-wider font-medium text-voix-admin-500"},Rd=["onClick"],Ld={class:"rounded border border-voix-admin-100 bg-voix-admin-50 px-2.5 py-1.5 mb-1.5"},Md=["onUpdate:modelValue","disabled","aria-label"],Dd={key:0,class:"mt-1 text-[11px] tone-warn"},Fd={key:0},jd={class:"flex items-center gap-2 mb-1 cursor-pointer select-none"},Od={class:"rounded border border-voix-admin-100 bg-voix-admin-50 px-2.5 py-1.5 mb-1.5"},zd={class:"font-mono text-[11px] text-voix-admin-600 whitespace-pre-wrap break-words max-h-32 overflow-y-auto"},Ud={class:"flex items-center justify-between mb-0.5"},qd=["title"],Nd=["disabled"],Bd={key:0,class:"mt-1 text-[11px] tone-warn",role:"alert"},Gd={class:"mt-1 text-[11px] text-voix-admin-400"},Hd={class:"rounded border border-voix-admin-100 bg-voix-admin-50 px-2.5 py-2.5 flex items-center gap-2"},Wd={key:1,class:"text-[11px] tone-warn",role:"alert"},Xd={key:2,class:"text-[11px] tone-error",role:"alert"},Yd={class:"flex items-center gap-2 pt-1"},Kd={class:"text-[11px] text-voix-admin-500"},Jd=["disabled"],Qd=["disabled","title"],Zd={key:2,class:"px-4 py-10 text-center"},eu={key:3,class:"divide-y divide-voix-admin-100/70"},tu=["onClick"],nu={class:"px-1.5 py-0.5 rounded bg-gradient-to-br from-voix-admin-50 to-voix-admin-100 ring-1 ring-voix-admin-200/40 text-voix-admin-600 text-[10px] font-medium uppercase tracking-wider shrink-0"},ou={class:"flex-1 min-w-0"},iu={class:"text-[13px] text-voix-admin-900 truncate"},su={class:"text-[11px] text-voix-admin-400 truncate"},au={class:"px-4 py-3 flex items-center justify-end"},vn=240,lu={__name:"PageHeadTagsIndex",props:{pageId:{type:[String,Number],required:!0},seo:{type:Object,required:!1}},emits:["new","select","close"],async setup(t,{emit:n}){let i,r;const u=t,c=n,a=_o(),p=Se(),{fetchCurrentPageSeoAudit:v}=ft(),{aiContent:d}=Lt(),{describeHeadTag:m}=$o(),{availableTags:b}=tn(),f=new Map(b.map(te=>
13[te.key,te.label])),l=$(null),w=h(()=>l.value??u.seo),x=h(()=>{const te=p.currentPage?.path;return!te||te==="/"||!te.endsWith("/")?null:{status:"warning",message:"Page path has a trailing slash. Trailing slashes can cause duplicate-content issues — remove it."}}),L=h(()=>{const te=w.value;return x.value?!0:!!te&&te.status!=="ok"}),j=h(()=>{const te=w.value?.status??"ok";return te==="error"?"error":te==="warning"||x.value?"warning":"ok"}),R=h(()=>L.value?w.value??null:null);function M(te){return te==="error"?"tone-error":te==="warning"?"tone-warn":"tone-ok"}function I(te){return te==="error"?"Error":te==="warning"?"Warning":"OK"}const F=h(()=>j.value==="error"?"red":j.value==="warning"?"amber":null);ze(async()=>{const te=await v(u.pageId);te&&(l.value=te)});const V=$(1),H=$(""),P=$(""),Q=$(""),X=$(100),ne=h(()=>H.value&&P.value?[JSON.stringify({column:H.value.toUpperCase(),order:P.value.toUpperCase()})]:[]),G={field:"page_id",op:"=",value:u.pageId,clause:"where"},z=h(()=>{if(Q.value){const te=JSON.parse(Q.value);return te.push(G),JSON.stringify(te)}return JSON.stringify([G])});[i,r]=Gt(()=>un({filter:z.value,orderBy:ne.value,first:X.value,page:V.value})),await i,r();const{checkUserPermissions:Y}=Yt(),ie=([i,r]=Gt(()=>Y("Pages.bulkSeoFix")),i=await i,r(),i),W=h(()=>a.headTags?.data??[]),E=h(()=>W.value.find(te=>(te.type??"").toLowerCase()==="structureddatamarkup")),g=Oe(),y=Xt(),A=Xt();function J(te){return te==="draft"?"Generated from the saved draft version (not yet published).":te==="unpublished"?"Generated from the latest unpublished version.":"Generated from the live published content."}const D=$(null),U=$(null),O=$(!1),T=$(!1),K=$(!1),B=$(!1),S=$(""),ae=$(""),re=h(()=>!!D.value||!!U.value),Me=[{key:"title",label:"Title",mono:!1},{key:"description",label:"Description",mono:!1},{key:"robots",label:"Robots",mono:!0}],He=$([]),We=$(!1),Ce=$("");we(D,te=>{He.value=te?Me.map(Z=>({key:Z.key,label:Z.label,mono:Z.mono,current:te.current[Z.key],original:(te.suggested[Z.key]??"").toString(),value:(te.suggested[Z.key]??"").toString(),selected:!0})).filter(Z=>Z.original.trim().length>0):[]}),we(U,te=>{Ce.value=te?.content??"",We.value=!!te});const de=h(()=>{if(!We.value||!Ce.value.trim())return"";try{return JSON.parse(Ce.value),""}
13catch(te){return`Not valid JSON — ${te?.message??"check the syntax"}`}}),Ne=h(()=>He.value.filter(te=>te.selected&&te.value.trim())),Re=h(()=>He.value.some(te=>te.selected&&!te.value.trim())),kt=h(()=>We.value&&!!Ce.value.trim()),it=h(()=>Ne.value.length+(kt.value?1:0)),et=h(()=>it.value>0&&!Re.value&&!de.value);function mt(te,Z){te.style.height="auto",te.style.height=`${Math.min(te.scrollHeight,Z)}px`}const st={mounted:(te,Z)=>mt(te,Z.value??vn),updated:(te,Z)=>mt(te,Z.value??vn)};async function Xe(){const te=await v(u.pageId);te&&(l.value=te);const Z=new URLSearchParams({filter:z.value,orderBy:ne.value,first:X.value,page:V.value}).toString(),Fe=await _e(`/api/admin/voix/head-tags?${Z}`);Fe&&a.setHeadTags(Fe)}async function at(){const te=await y.dispatchAndPoll({action:"fix_seo",page_ids:[Number(u.pageId)]}),Z=y.batchId.value;if(!Z||te.failed_jobs>0)throw new Error("AI SEO fix failed for this page. Try again.");const me=(await _e(`/api/admin/voix/seo-suggestions/${Z}`)).suggestions?.[0]??null;if(!me)throw new Error("No suggestion was generated for this page.");if(me.status!=="ready")throw new Error(me.failure_reason||"AI SEO fix failed for this page.");D.value=me}async function ve(){T.value=!0;try{const te=await A.dispatchAndPoll({action:"generate_structured_data",page_ids:[Number(u.pageId)]}),Z=A.batchId.value;if(!Z||te.failed_jobs>0)throw new Error("Structured data generation failed. Try again.");const me=(await _e(`/api/admin/voix/structured-data-suggestions/${Z}`)).suggestions?.[0]??null;if(!me||me.status!=="ready"||!me.content)throw new Error(me?.failure_reason||"No structured data was generated for this page.");K.value||(U.value={content:me.content,source:me.source??"published"})}finally{T.value=!1}}function be(te,Z){return te?.status===403?"You do not have permission to run AI SEO fix.":te?.data?.message||te?.message||Z}async function Ae(){S.value="",ae.value="",D.value=null,U.value=null,K.value=!1,O.value=!0;try{const[te,Z]=await Promise.allSettled([at(),ve()]);te.status==="rejected"&&(S.value=be(te.reason,"AI SEO fix failed.")),Z.status==="rejected"&&!K.value&&(
13ae.value=be(Z.reason,"Structured data generation failed."))}finally{O.value=!1}}const he=$(!1);function ke(){Ce.value&&navigator.clipboard?.writeText(Ce.value).then(()=>{he.value=!0,setTimeout(()=>he.value=!1,1200)})}async function De(){const te=Ce.value.trim();if(!te)return;const Z=E.value;Z?await jn({id:Z.id,type:"structuredDataMarkup",page_id:u.pageId,content:te,is_partytown:Z.is_partytown??!1,position:Z.position??"head"}):await On({page_id:u.pageId,type:"structuredDataMarkup",content:te,is_partytown:!1,position:"head"})}async function Pe(){if(!(!et.value||T.value)){B.value=!0,S.value="";try{if(D.value){const Z=Object.fromEntries(Ne.value.map(me=>[me.key,me.value.trim()])),Fe=Object.keys(Z).length>0;await _e(`/api/admin/voix/seo-suggestions/${D.value.id}/${Fe?"approve":"reject"}`,Fe?{method:"POST",body:{apply:Z}}:{method:"POST"})}kt.value&&await De();const te=it.value;D.value=null,U.value=null,ae.value="",g.add(`Applied ${te} SEO suggestion${te===1?"":"s"}`,"info"),await Xe()}catch(te){S.value=te?.data?.message||te?.message||"Failed to apply suggestion."}finally{B.value=!1}}}async function gt(){if(re.value){K.value=!0,B.value=!0,S.value="";try{D.value&&await _e(`/api/admin/voix/seo-suggestions/${D.value.id}/reject`,{method:"POST"}),D.value=null,U.value=null,ae.value=""}catch(te){S.value=te?.data?.message||te?.message||"Failed to reject suggestion."}finally{B.value=!1}}}we([Q,V,H,P,X],async()=>await un({filter:z.value,orderBy:ne.value,first:X.value,page:V.value}));const lt=h(()=>{const te=W.value.length,Z=w.value;let Fe=[Z?.title,Z?.description,Z?.robots,Z?.structured_data].filter(Qe=>Qe&&Qe.status!=="ok").length;x.value&&(Fe+=1);const me=`${te} meta tag${te===1?"":"s"}`;return Fe>0?`${me} · ${Fe} issue${Fe===1?"":"s"}`:me});function rt(te){return m(te.type??"").element}function Ye(te){return(te.content??"").toString()}function Be(te){const Z=te.type??"";return f.get(Z)??m(Z).detail}function _t(te){const Z=W.value.find(Fe=>(Fe.type??"").toLowerCase()===te.toLowerCase());Z?c("select",Z):c("new",{type:te})}return(te,Z)=>{const Fe=Le;return o(),se(ot,{icon:"heroicons:code-bracket",title:"Head Tags",subtitle:lt.value,"dot-color":F.value,"can-add":"","add-label":"Add head tag",onAdd:Z[8]||(Z[8]=me=>c("new")),onClose:Z[9]||(Z[9]=me=>c("close"))},{footer:pe(()=>[e("div",au,[e("button",{class:"h-8 px-3 rounded-md text-[12px] font-medium text-voix-admin-700 hover:bg-voix-admin-100 transition-colors cursor-pointer",onClick:Z[7]||(Z[7]=me=>c("close"))}," Done ")])]),default:pe(()=>[L.value?(o(),s(le,{key:0},[k(Ve,{label:"SEO Status"}),e("div",cd,[x.value?(o(),s("div",pd,[Z[11]||(Z[11]=e("span",{class:"w-1.5 h-1.5 rounded-full shrink-0 bg-amber-500"},null,-1)),e("div",vd,[Z[10]||(Z[10]=e("div",{class:"text-[13px] font-medium text-voix-admin-900"}," Path ",-1)),e("div",md,C(x.value.message),1)]),Z[12]||(Z[12]=e("span",{class:"text-[11px] font-medium tone-warn"}," Warning ",-1))])):_("",!0),R.value?.title?(o(),s("button",{key:1,type:"button",class:"w-full px-4 py-2.5 flex items-center gap-3 text-left hover:bg-white/70 cursor-pointer",onClick:Z[0]||(Z[0]=me=>_t("title"))},[e("span",{class:ee(["w-1.5 h-1.5 rounded-full shrink-0",{"bg-emerald-500":R.value.title.status==="ok","bg-amber-500":R.value.title.status==="warning","bg-red-500":R.value.title.status==="error"}])},null,2),e("div",gd,[Z[13]||(Z[13]=e("div",{class:"text-[13px] font-medium text-voix-admin-900"}," Title ",-1)),e("div",xd,C(R.value.title.status==="ok"?"OK":R.value.title.message),1)]),e("span",{class:ee(["text-[11px] font-medium",M(R.value.title.status)])},C(I(R.value.title.status)),3)])):_("",!0),R.value?.description?(o(),s("button",{key:2,type:"button",class:"w-full px-4 py-2.5 flex items-center gap-3 text-left hover:bg-white/70 cursor-pointer",onClick:Z[1]||(Z[1]=me=>_t("description"))},[e("span",{class:ee(["w-1.5 h-1.5 rounded-full shrink-0",{"bg-emerald-500":R.value.description.status==="ok","bg-amber-500":R.value.description.status==="warning","bg-red-500":R.value.description.status==="error"}])},null,2),e("div",fd,[Z[14]||(Z[14]=e("div",{class:"text-[13px] font-medium text-voix-admin-900"}," Description ",-1)),e("div",bd,C(R.value.description.status==="ok"?"OK":R.value.description.message),1)]),e("span",{class:ee(["text-[11px] font-medium",M(R.value.description.status)])},C(I(R.value.description.status)),3)])):_("",!0),R.value?.robots?(o(),s("button",{key:3,type:"button",class:"w-full px-4 py-2.5 flex items-center gap-3 text-left hover:bg-white/70 cursor-pointer",onClick:Z[2]||(Z[2]=me=>_t("robots"))},[e("span",{class:ee(["w-1.5 h-1.5 rounded-full shrink-0",{"bg-emerald-500":R.value.robots.status==="ok","bg-amber-500":R.value.robots.status==="warning","bg-red-500":R.value.robots.status==="error"}])},null,2),e("div",hd,[Z[15]||(Z[15]=e("div",{class:"text-[13px] font-medium text-voix-admin-900"}," Robots ",-1)),e("div",yd,C(R.value.robots.status==="ok"?"OK":R.value.robots.message),1)]),e("span",{class:ee(["text-[11px] font-medium",M(R.value.robots.status)])},C(I(R.value.robots.status)),3)])):_("",!0),R.value?.structured_data?(o(),s("button",{key:4,type:"button",class:"w-full px-4 py-2.5 flex items-center gap-3 text-left hover:bg-white/70 cursor-pointer",onClick:Z[3]||(Z[3]=me=>_t("structuredDataMarkup"))},[e("span",{class:ee(["w-1.5 h-1.5 rounded-full shrink-0",{"bg-emerald-500":R.value.structured_data.status==="ok","bg-amber-500":R.value.structured_data.status==="warning","bg-red-500":R.value.structured_data.status==="error"}])},null,2),e("div",wd,[Z[16]||(Z[16]=e("div",{class:"text-[13px] font-medium text-voix-admin-900"}," Structured Data ",-1)),e("div",kd,C(R.value.structured_data.status==="ok"?"OK":R.value.structured_data.message),1)]),e("span",{class:ee(["text-[11px] font-medium",M(R.value.structured_data.status)])},C(I(R.value.structured_data.status)),3)])):_("",!0)])],64)):_("",!0),N(ie)&&N(d)?(o(),s("div",_d,[re.value?(o(),s("div",Ed,[Z[25]||(Z[25]=e("p",{class:"text-[11px] text-voix-admin-400 leading-relaxed"}," Untick anything you'd rather leave alone. Suggested wording is editable. ",-1)),(o(!0),s(le,null,fe(He.value,me=>(o(),s("div",{key:me.key},[e("div",Td,[e("label",Id,[ue(e("input",{"onUpdate:modelValue":Qe=>me.selected=Qe,type:"checkbox",class:"suggest-check"},null,8,Ad),[[bt,me.selected]]),e("span",Vd,C(me.label),1)]),me.value!==me.original?(o(),s("button",{key:0,t
13ype:"button",class:"ml-auto text-[10px] font-medium text-voix-admin-500 hover:text-voix-admin-800 cursor-pointer",onClick:Qe=>me.value=me.original}," Revert edit ",8,Rd)):_("",!0)]),e("div",Ld,[Z[18]||(Z[18]=e("div",{class:"text-[10px] uppercase tracking-wide text-voix-admin-400 mb-0.5"}," Current ",-1)),e("div",{class:ee(["text-[12px] text-voix-admin-600 break-words",{"font-mono text-[11px]":me.mono}])},C(me.current||"—"),3)]),e("div",{class:ee(["suggest-card rounded px-2.5 py-1.5",{"opacity-45":!me.selected}])},[Z[19]||(Z[19]=e("div",{class:"suggest-label text-[10px] uppercase tracking-wide mb-0.5"}," Suggested ",-1)),ue(e("textarea",{"onUpdate:modelValue":Qe=>me.value=Qe,rows:"1",disabled:!me.selected,"aria-label":`Suggested ${me.label.toLowerCase()}`,class:ee(["suggest-input w-full text-[12px] break-words",{"font-mono text-[11px]":me.mono}])},null,10,Md),[[$e,me.value],[st]])],2),me.selected&&!me.value.trim()?(o(),s("p",Dd," Can't apply an empty "+C(me.label.toLowerCase())+" — add wording or untick it. ",1)):_("",!0)]))),128)),U.value||T.value?(o(),s("div",Fd,[U.value?(o(),s(le,{key:0},[e("label",jd,[ue(e("input",{"onUpdate:modelValue":Z[4]||(Z[4]=me=>We.value=me),type:"checkbox",class:"suggest-check"},null,512),[[bt,We.value]]),Z[20]||(Z[20]=e("span",{class:"text-[10px] uppercase tracking-wider font-medium text-voix-admin-500"}," Structured Data ",-1))]),e("div",Od,[Z[21]||(Z[21]=e("div",{class:"text-[10px] uppercase tracking-wide text-voix-admin-400 mb-0.5"}," Current ",-1)),e("div",zd,C(E.value?.content||"—"),1)]),e("div",{class:ee(["suggest-card rounded px-2.5 py-1.5",{"opacity-45":!We.value}])},[e("div",Ud,[Z[22]||(Z[22]=e("div",{class:"suggest-label text-[10px] uppercase tracking-wide"}," Suggested ",-1)),e("button",{type:"button",class:"copy-btn w-6 h-6 rounded flex items-center justify-center cursor-pointer",title:he.value?"Copied":"Copy structured data",onClick:ke},[k(Fe,{name:he.value?"heroicons:check-20-solid":"heroicons:clipboard-document-20-solid",size:"13"},null,8,["name"])],8,qd)]),ue(e("textarea",{"onUpdate:modelValue":Z[5]||(Z[5]=me=>Ce.value=me),rows:"4",disabled:!We.value,"aria-label":"Suggested structured data",class:"suggest-input w-full font-mono text-[11px] break-words"},null,8,Nd),[[$e,Ce.value],[st,192]])],2),de.value?(o(),s("p",Bd,C(de.value),1)):_("",!0),e("p",Gd,C(J(U.value.source)),1)],64)):(o(),s(le,{key:1},[Z[24]||(Z[24]=e("div",{class:"text-[10px] uppercase tracking-wider font-medium text-voix-admin-500 mb-1"}," Structured Data ",-1)),e("div",Hd,[k(jt,{class:"w-3 h-3 text-voix-admin-500"}),Z[23]||(Z[23]=e("span",{class:"text-[11px] text-voix-admin-500"},"Generating structured data from the page…",-1))])],64))])):_("",!0),ae.value?(o(),s("p",Wd,C(ae.value),1)):_("",!0),S.value?(o(),s("p",Xd,C(S.value),1)):_("",!0),e("div",Yd,[e("span",Kd,C(it.value)+" of "+C(He.value.length+(U.value?1:0))+" selected ",1),e("button",{type:"button",class:"ml-auto h-8 px-3 rounded-md text-[12px] font-medium text-voix-admin-700 border border-voix-admin-300 hover:bg-voix-admin-50 cursor-pointer disabled:opacity-50",disabled:B.value,onClick:gt}," Reject ",8,Jd),e("button",{type:"button",class:"h-8 px-3 rounded-md bg-voix-admin-600 hover:bg-voix-admin-700 text-white text-[12px] font-medium inline-flex items-center gap-1.5 cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed",disabled:B.value||T.value||!et.value,title:T.value?"Waiting for structured data to finish generating":void 0,onClick:Pe},[B.value||T.value?(o(),se(jt,{key:0,class:"w-3 h-3 text-white"})):_("",!0),ce(" "+C(B.value?"Applying…":"Approve & apply"),1)],8,Qd)])])):(o(),s("div",$d,[e("button",{type:"button",class:"w-full h-8 rounded-md bg-voix-admin-800 hover:bg-voix-admin-900 text-white text-[12px] font-medium inline-flex items-center justify-center gap-1.5 cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-voix-admin-800",disabled:O.value,onClick:Ae},[O.value?(o(),se(jt,{key:0,class:"w-3.5 h-3.5 text-white"})):(o(),se(Fe,{key:1,name:"heroicons:sparkles-20-solid",size:"13"})),ce(" "+C(O.value?"Generating suggestions…":"Fix SEO with AI"),1)],8,Sd),Z[17]||(Z[17]=e("p",{class:"mt-2 text-[11px] text-voix-admin-400 leading-relaxed"}," AI drafts a title, meta description, robots tag, and structured data from this page's content. Nothing is saved until you approve. ",-1)),S.value?(o(),s("p",Cd,C(S.value),1)):_("",!0),ae.value?(o(),s("p",Pd,C(ae.value),1)):_("",!0)]))])):_("",!0),k(Ve,{label:"Tags"}),W.value.length===0?(o(),s("div",Zd,[Z[26]||(Z[26]=e("div",{class:"text-[12px] text-voix-admin-500"}," No head tags yet. ",-1)),e("button",{class:"mt-2 text-[12px] text-voix-admin-700 hover:text-voix-admin-900 font-medium cursor-pointer",onClick:Z[6]||(Z[6]=me=>c("new"))}," + Add the first head tag ")])):(o(),s("div",eu,[(o(!0),s(le,null,fe(W.value,me=>
13(o(),s("button",{key:me.id,class:"group w-full px-4 py-2.5 flex items-center gap-3 hover:bg-white/70 text-left cursor-pointer",onClick:Qe=>c("select",me)},[e("span",nu,C(rt(me)),1),e("div",ou,[e("div",iu,C(Ye(me)||"—"),1),e("div",su,C(Be(me)),1)]),k(Fe,{name:"heroicons:chevron-right",size:"12",class:"text-voix-admin-400 opacity-0 group-hover:opacity-100 transition-opacity shrink-0"})],8,tu))),128))]))]),_:1},8,["subtitle","dot-color"])}}},ru=Je(lu,[["__scopeId","data-v-9c4db4a0"]]),du={class:"h-full"},uu={__name:"PageHeadTags",props:{page:{type:Object,required:!0}},emits:["close"],setup(t,{emit:n}){const i=t,r=n,u=$(!1),c=$(null),a=$(null);function p(b){a.value=b}function v(){a.value=null}function d(b){c.value=b?.type??null,u.value=!0}function m(){u.value=!1,c.value=null}return(b,f)=>(o(),s("div",du,[!a.value&&!u.value?(o(),se(ru,{key:0,"page-id":i.page.id,seo:i.page.seo,onClose:f[0]||(f[0]=l=>r("close")),onNew:d,onSelect:p},null,8,["page-id","seo"])):_("",!0),a.value?(o(),se(nd,{key:1,"head-tag":a.value,onBack:v,onClose:f[1]||(f[1]=l=>r("close"))},null,8,["head-tag"])):_("",!0),u.value?(o(),se(ud,{key:2,"page-id":i.page.id,"prefill-type":c.value,onBack:m,onClose:f[2]||(f[2]=l=>r("close"))},null,8,["page-id","prefill-type"])):_("",!0)]))}},cu={class:"px-4 pb-4"},pu={key:0,class:"px-3 py-3 flex items-start gap-3 rounded-md border border-voix-admin-200 bg-voix-admin-50/40"},vu={class:"w-8 h-8 rounded-md bg-white border border-voix-admin-100 flex items-center justify-center shrink-0 text-lg"},mu={class:"flex-1 min-w-0"},gu={class:"flex items-baseline gap-2"},xu={class:"text-[13px] font-medium text-voix-admin-900 truncate"},fu={class:"font-mono text-[10px] text-voix-admin-400 uppercase tracking-wider shrink-0"},bu={class:"mt-0.5 font-mono text-[11px] text-voix-admin-400 truncate"},hu={key:1,class:"space-y-3"},yu={class:"flex items-center justify-end gap-2"},wu=["disabled"],ku=["disabled"],_u={key:2,class:"text-[12px] text-voix-admin-500"},$u={class:"px-4 pb-4 grid grid-cols-2 gap-3"},Su={class:"px-4 pt-4 pb-3 flex items-end justify-between gap-3"},Cu={key:0,class:"px-4 pb-3"},Pu={class:"relative"},Eu={key:0,class:"mt-2 text-[11px] text-voix-admin-400"},Tu={key:1,class:"mt-2 text-[11px] text-voix-admin-400"},Iu={key:2,class:"mt-2 border border-voix-admin-100 rounded-md divide-y divide-voix-admin-100 overflow-hidden max-h-56 overflow-y-auto"},Au=["onClick"],Vu={class:"w-6 h-6 rounded bg-voix-admin-50 border border-voix-admin-100 flex items-center justify-center text-[12px] shrink-0"},Ru={class:"flex-1 min-w-0"},Lu={class:"text-[12px] text-voix-admin-900 truncate"},Mu={class:"font-mono text-[10px] text-voix-admin-400 truncate"},Du={class:"font-mono text-[10px] text-voix-admin-400 uppercase tracking-wider shrink-0"},Fu={key:1,class:"px-4 py-10 text-center"},ju={key:2,class:"divide-y divide-voix-admin-100"},Ou={class:"w-8 h-8 rounded-md bg-voix-admin-50 border border-voix-admin-100 flex items-center justify-center shrink-0 text-lg"},zu={class:"flex-1 min-w-0"},Uu={class:"flex items-baseline gap-2"},qu={class:"text-[13px] font-medium text-voix-admin-900 truncate"},Nu={class:"font-mono text-[10px] text-voix-admin-400 uppercase tracking-wider shrink-0"},Bu={class:"mt-0.5 font-mono text-[11px] text-voix-admin-400 truncate"},Gu={class:"mt-2 flex items-center gap-1.5 flex-wrap"},Hu=["href"],Wu=["href"],Xu=["disabled","onClick"],Yu={key:0,class:"px-1.5 py-0.5 rounded-full bg-emerald-100 text-emerald-600 text-[10px] font-medium shrink-0 mt-0.5"},Ku={key:1,class:"px-1.5 py-0.5 rounded-full bg-voix-admin-100 text-voix-admin-500 text-[10px] font-medium shrink-0 mt-0.5"},Ju={class:"px-4 py-3 flex items-center justify-end"},Qu={class:"relative z-[200000]"},Zu={__name:"PageLocalizations",emits:["close"],setup(t,{emit:n}){const i=n,r=Se(),{$voix:u}=It(),c=Oe(),a=h(()=>r.currentPage?.localizations??[]),p=h(()=>u.options.languages??[]),v=$(!1);function d(){if(!Tt().public.voixAIContentGeneratorEnabled){m();return}v.value=!0}function m(){r.currentPage&&Ze({name:"voix-settings-pages-translate-en",query:{slug:r.currentPage.path}})}const b=h(()=>{const E=a.value.length;return`${E} language${E===1?"":"s"}`});function f(E){return p.value.find(y=>y.code===E)?.name??E}function l(E){return p.value.find(y=>y.code===E)?.icon??"🌐"}const w=$(!1),x=$(""),L=$(!1);we(w,E=>
13{if(E){const g=r.currentPage?.language_code,y=p.value.find(A=>A.code===g);x.value=y?.name??""}});const j=h(()=>p.value.map(E=>({label:E.name,value:E.name,key:E.code})));async function R(){if(!r.currentPage)return;const E=p.value.find(g=>g.name===x.value);if(!E||E.code===r.currentPage.language_code){w.value=!1;return}L.value=!0;try{await Co(r.currentPage.id,E.code),r.currentPage&&(r.currentPage.language_code=E.code),c.add(`Language changed to ${E.name}.`,"msg",4e3),w.value=!1}catch(g){console.error("[update language] failed",g),c.add("Failed to update language.","error",4e3)}finally{L.value=!1}}const M=$(!1),I=$(""),F=$([]),V=$(!1),H=$(null),P=bn(async()=>{const E=I.value.trim();if(!E){F.value=[];return}V.value=!0;try{const g=await So(E,10),y=new Set([r.currentPage?.id,...(r.currentPage?.localizations??[]).map(A=>A.id)].filter(Boolean));F.value=(g?.data??[]).filter(A=>!y.has(A.id))}catch(g){console.error("[search pages] failed",g),F.value=[]}finally{V.value=!1}},300);we(I,()=>{P()});function Q(){M.value=!0,I.value="",F.value=[]}function X(){M.value=!1,I.value="",F.value=[]}async function ne(E){if(!(!r.currentPage||H.value)){H.value=E.id;try{const y=(await Po(r.currentPage.id,E.id))?.linked_localization??{id:E.id,path:E.path,title:E.title,language_code:E.language_code,auto_localize:!!E.auto_localize};if(r.currentPage){const A=r.currentPage.localizations??[];r.currentPage.localizations=[...A,y]}c.add(`Linked ${y.title??y.path}.`,"msg",4e3),X()}catch(g){console.error("[link localization] failed",g),c.add("Failed to link page.","error",4e3)}finally{H.value=null}}}const G=$(null),z=$(null);let Y=null;function ie(E){if(z.value===E){W(E);return}z.value=E,Y&&clearTimeout(Y),Y=setTimeout(()=>{z.value=null},3e3)}async function W(E){if(r.currentPage){z.value=null,Y&&(clearTimeout(Y),Y=null),G.value=E;try{await Eo(r.currentPage.id,E),r.currentPage?.localizations&&(r.currentPage.localizations=r.currentPage.localizations.filter(g=>g.id!==E)),c.add("Localization unlinked.","msg",4e3)}catch(g){console.error("[unlink localization] failed",g),c.add("Failed to unlink localization.","error",4e3)}finally{G.value=null}}}return(E,g)=>{const y=Le;return o(),s(le,null,[k(ot,{icon:"heroicons:globe-alt",title:"Locale",subtitle:b.value,onClose:g[6]||(g[6]=A=>i("close"))},{footer:pe(()=>[e("div",Ju,[e("button",{class:"h-8 px-3 rounded-md text-[12px] font-medium text-voix-admin-700 hover:bg-voix-admin-100 transition-colors cursor-pointer",onClick:g[5]||(g[5]=A=>i("close"))}," Done ")])]),default:pe(()=>[k(Ve,{label:"Current language"}),e("div",cu,[N(r).currentPage?.language_code&&!w.value?(o(),s("div",pu,[e("div",vu,C(l(N(r).currentPage.language_code)),1),e("div",mu,[e("div",gu,[e("div",xu,C(f(N(r).currentPage.language_code)),1),e("span",fu,C(N(r).currentPage.language_code),1)]),e("div",bu,C(N(r).currentPage.path),1)]),e("button",{type:"button",class:"text-[11px] text-voix-admin-600 hover:text-voix-admin-900 font-medium shrink-0 cursor-pointer",onClick:g[0]||(g[0]=A=>w.value=!0)}," Edit ")])):w.value?(o(),s("div",hu,[k(Ue,{id:"page-current-language",modelValue:x.value,"onUpdate:modelValue":g[1]||(g[1]=A=>x.value=A),label:"Language",options:j.value,placeholder:"Select a language",disabled:L.value},null,8,["modelValue","options","disabled"]),e("div",yu,[e("button",{type:"button",class:"h-7 px-3 rounded-md text-[12px] font-medium text-voix-admin-700 hover:bg-voix-admin-100 cursor-pointer disabled:opacity-50",disabled:L.value,onClick:g[2]||(g[2]=A=>w.value=!1)}," Cancel ",8,wu),e("button",{type:"button",class:"h-7 px-3 rounded-md bg-voix-admin-800 hover:bg-voix-admin-900 text-white text-[12px] font-medium cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed",disabled:L.value||!x.value,onClick:R},C(L.value?"Saving…":"Save"),9,ku)])])):(o(),s("div",_u," No language set on this page. "))]),k(Ve,{label:"Add a localization"}),e("div",$u,[e("button",{type:"button",class:"group text-left p-3 rounded-md border border-voix-admin-200 hover:border-voix-admin-400 hover:bg-voix-admin-50 transition-all cursor-pointer",onClick:d},[k(y,{name:"heroicons:sparkles-20-solid",size:"16",class:"text-voix-admin-500 mb-1.5"}),g[8]||(g[8]=e("h3",{class:"text-[12px] font-semibold text-voix-admin-900 mb-0.5"}," AI Assisted ",-1)),g[9]||(g[9]=e("p",{class:"text-[11px] text-voix-admin-500 leading-relaxed"}," Let AI translate this page automatically. ",-1))]),e("button",{type:"button",class:"group text-left p-3 rounded-md border border-voix-admin-200 hover:border-voix-admin-400 hover:bg-voix-admin-50 transition-all cursor-pointer",onClick:m},[k(y,{name:"heroicons:pencil-square-20-solid",size:"16",class:"text-voix-admin-500 mb-1.5"}),g[10]||(g[10]=e("h3",{class:"text-[12px] font-semibold text-voix-admin-900 mb-0.5"}
13," Manual ",-1)),g[11]||(g[11]=e("p",{class:"text-[11px] text-voix-admin-500 leading-relaxed"}," Set it up yourself and translate as you go. ",-1))])]),e("div",Su,[g[12]||(g[12]=e("div",{class:"relative inline-block pb-1.5"},[e("h3",{class:"text-[11px] tracking-[0.14em] uppercase font-bold text-voix-admin-900"}," Other languages "),e("span",{class:"absolute left-0 bottom-0 w-5 h-0.5 bg-voix-admin-800 rounded-full"})],-1)),e("button",{type:"button",class:"inline-flex items-center gap-1 h-6 px-2 rounded border border-voix-admin-200 text-voix-admin-700 hover:bg-voix-admin-100 hover:border-voix-admin-300 hover:text-voix-admin-900 text-[10.5px] font-medium leading-none transition-colors cursor-pointer shrink-0",onClick:g[3]||(g[3]=A=>M.value?X():Q())},[k(y,{name:M.value?"heroicons:x-mark-20-solid":"heroicons:link-20-solid",size:"11"},null,8,["name"]),ce(" "+C(M.value?"Cancel":"Link existing"),1)])]),M.value?(o(),s("div",Cu,[e("div",Pu,[ue(e("input",{"onUpdate:modelValue":g[4]||(g[4]=A=>I.value=A),type:"text",placeholder:"Search for a page by title…",class:"w-full h-8 px-3 rounded-md border border-voix-admin-200 text-[12px] text-voix-admin-900 placeholder:text-voix-admin-400 focus:outline-none focus:border-voix-admin-400"},null,512),[[$e,I.value]])]),V.value?(o(),s("div",Eu," Searching… ")):I.value&&F.value.length===0?(o(),s("div",Tu," No matching pages. ")):F.value.length>0?(o(),s("ul",Iu,[(o(!0),s(le,null,fe(F.value,A=>(o(),s("li",{key:A.id,class:ee(["px-3 py-2 flex items-center gap-2 hover:bg-voix-admin-50 cursor-pointer",H.value===A.id?"opacity-50":""]),onClick:J=>ne(A)},[e("div",Vu,C(l(A.language_code)),1),e("div",Ru,[e("div",Lu,C(A.title||A.path),1),e("div",Mu,C(A.path),1)]),e("span",Du,C(A.language_code),1)],10,Au))),128))])):_("",!0)])):_("",!0),a.value.length===0&&!M.value?(o(),s("div",Fu,[...g[13]||(g[13]=[e("div",{class:"text-[12px] text-voix-admin-500"}," No localizations for this page. ",-1)])])):(o(),s("div",ju,[(o(!0),s(le,null,fe(a.value,A=>(o(),s("div",{key:A.id,class:"group px-4 py-3 flex items-start gap-3 hover:bg-voix-admin-50/60"},[e("div",Ou,C(l(A.language_code)),1),e("div",zu,[e("div",Uu,[e("div",qu,C(f(A.language_code)),1),e("span",Nu,C(A.language_code),1)]),e("div",Bu,C(A.path),1),e("div",Gu,[e("a",{href:A.path,target:"_blank",class:"inline-flex items-center gap-1 h-6 px-2 rounded border border-voix-admin-200 text-voix-admin-700 hover:bg-voix-admin-100 hover:border-voix-admin-300 hover:text-voix-admin-900 text-[10.5px] font-medium leading-none transition-colors"},[k(y,{name:"heroicons:eye-20-solid",size:"11"}),g[14]||(g[14]=ce(" Preview ",-1))],8,Hu),e("a",{href:`/voix/studio?editing=${A.path}`,class:"inline-flex items-center gap-1 h-6 px-2 rounded border border-voix-admin-200 text-voix-admin-700 hover:bg-voix-admin-100 hover:border-voix-admin-300 hover:text-voix-admin-900 text-[10.5px] font-medium leading-none transition-colors"},[k(y,{name:"heroicons:pencil-square-20-solid",size:"11"}),g[15]||(g[15]=ce(" Customize ",-1))],8,Wu),e("button",{type:"button",class:ee(["inline-flex items-center gap-1 h-6 px-2 rounded border text-[10.5px] font-medium leading-none transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed",z.value===A.id?"border-red-300 bg-red-50 text-red-700 hover:bg-red-100 hover:border-red-400":"border-voix-admin-200 text-voix-admin-700 hover:bg-red-50 hover:border-red-300 hover:text-red-700"]),disabled:G.value===A.id,onClick:J=>ie(A.id)},[k(y,{name:"heroicons:link-slash-20-solid",size:"11"}),G.value===A.id?(o(),s(le,{key:0},[ce(" Unlinking… ")],64)):z.value===A.id?(o(),s(le,{key:1},[ce(" Confirm? ")],64)):(o(),s(le,{key:2},[ce(" Unlink ")],64))],10,Xu)])]),A.auto_localize?(o(),s("span",Yu," Generative ")):(o(),s("span",Ku," Custom "))]))),128))])),k(Ve,{label:"Auto-localize"}),g[16]||(g[16]=e("div",{class:"px-4 pb-4 text-[12px] text-voix-admin-600 leading-relaxed"}," Generative languages auto-sync when the English version changes. Custom languages are manually managed and won't be overwritten. ",-1))]),_:1},8,["subtitle"]),(o(),se(vt,{to:"#voix-admin-root"},[e("div",Qu,[v.value&&N(r).currentPage?(o(),se(bo,{key:0,page:N(r).currentPage,"initial-step":2,onClose:g[7]||(g[7]=A=>v.value=!1)},null,8,["page"])):_("",!0)])]))],64)}}},ec={class:"flex-1 flex flex-col justify-between"},tc={class:"border-b border-gray-300 py-2 col-span-2 flex items-center"},nc=["onUpdate:modelValue"],oc={class:"border-b border-gray-300 p-2 col-span-1 flex items-center"},ic=["onUpdate:modelValue"],sc={class:"border-b border-gray-300 py-2 col-span-1 space-x-1 flex justify-end"},ac=["onClick"],lc={key:1,class:"mt-8 text-sm text-center text-gray-500 py-4 px-8 bg-voix-admin-50 rounded text-voix-admin-600"},rc={class:"space-y-4"},dc={__name:"PageXPIndex",emits:["new","select","close"],setup(t,{emit:n}){const i=n,r=Se(),u=h(()=>r.currentPage.tags||["space","martians"]);function c(){r.currentPage.tags.push({name:"",point:1})}function a(p){r.removeXPTag(p)}return(p,v)=>{const d=Ie("AdministrationAlert");return o(),se(In,{title:"Manage Page Experience Tags",links:[{label:"Add New XP Tag",emit:"new"}],permissions:["Pages"],onNew:c},{default:pe(()=>[e("div",ec,[e("div",null,[u.value.length>
130?(o(),s(le,{key:0},[v[1]||(v[1]=e("div",{class:"grid grid-cols-4 text-sm mt-2"},[e("div",{class:"border-b border-gray-300 py-2 col-span-2 flex items-center"}," Tag Name "),e("div",{class:"border-b border-gray-300 p-2 col-span-1 flex items-center"}," Point Value "),e("div",{class:"border-b border-gray-300 py-2 col-span-1 space-x-1 flex justify-end"},"   ")],-1)),(o(!0),s(le,null,fe(u.value,m=>(o(),s("div",{key:m,class:"grid grid-cols-4 text-sm"},[e("div",tc,[ue(e("input",{"onUpdate:modelValue":b=>m.name=b,placeholder:"Tag Name",type:"text",class:"border border-gray-200 rounded-sm p-2 w-full text-sm"},null,8,nc),[[$e,m.name]])]),e("div",oc,[ue(e("input",{"onUpdate:modelValue":b=>m.point=b,placeholder:"Point Value",type:"text",class:"border border-gray-200 rounded-sm p-2 w-full text-sm"},null,8,ic),[[$e,m.point]])]),e("div",sc,[e("button",{class:"py-2 px-3 text-xs bg-voix-admin-600 text-voix-admin-50 rounded-sm",onClick:b=>a(m)}," Delete ",8,ac)])]))),128))],64)):(o(),s("div",lc,[v[2]||(v[2]=e("div",null,"No XP tags have been added to this page.",-1)),e("div",null,[e("button",{class:"mt-4 bg-voix-admin-500 font-medium text-voix-admin-50 rounded px-4 py-2",onClick:c}," Add XP Tag ")])]))]),e("div",rc,[k(d,{type:"warning",class:"text-sm"},{default:pe(()=>[...v[3]||(v[3]=[e("span",{class:"font-bold"},"Warning:",-1),ce(' By clicking "Done" you have not saved these changes. Be sure to save your changes using the save button to the left. ',-1)])]),_:1}),k(An,null,{default:pe(()=>[k(Tn,{type:"primary",onClick:v[0]||(v[0]=m=>i("close"))},{default:pe(()=>[...v[4]||(v[4]=[ce(" Done ",-1)])]),_:1})]),_:1})])])]),_:1})}}},uc={__name:"PageXPEditor",emits:["close"],setup(t,{emit:n}){const i=n,r=$(null);function u(c){r.value=c}return(c,a)=>(o(),s("div",null,[k(dc,{onClose:a[0]||(a[0]=p=>i("close")),onSelect:u})]))}},mn="voix-add-slice-live-preview";function Gn(){const t=tt(mn,{default:()=>!0}),n=Ke(mn,()=>t.value!==!1);return we(n,i=>{t.value=i}),{livePreviewEnabled:n}}const cc=2;function pc(t,n){if(n.length===0)return!0;const i=(t.tags||[]).map(r=>r.toLowerCase());return n.every(r=>i.some(u=>u.includes(r)))}function Hn(t,n,i,r,u){if(!t?.length||i>cc)return[];const c=[];for(const a of t){const p=a.tag?.toLowerCase().trim();if(!p||!a.label)continue;const v=[...r,p],d=[...u,a.label],m=n.filter(b=>pc(b.slice,v));m.length!==0&&c.push({key:v.join("/"),label:a.label,path:d,tags:v,count:m.reduce((b,f)=>b+(f.tiles??1),0),children:Hn(a.children,m,i+1,v,d)})}return c}function vc(t,n){return Hn(t,n,1,[],[])}function mc(t,n){if(n.length===0)return null;let i=null;const r=u=>{for(const c of u)c.tags.every(a=>n.includes(a))&&((!i||c.tags.length>i.tags.length)&&(i=c),r(c.children))};return r(t),i}const gc=["src","alt"],xc={key:1,class:"absolute inset-0 bg-voix-admin-50 flex items-center justify-center"},Wn={__name:"SlicePreviewImage",props:{slice:{type:Object,required:!0},template:{type:String,default:null},alt:{type:String,default:""},fit:{type:String,default:"cover"}},setup(t){const n=t,i=/\.[^./\\]+$/,r=/[^a-z0-9]+/g,u=/^-+|-+$/g,p=Tt().public.voix.options.slicesPreviewDir;function v(j){return j.toLowerCase().replace(r,"-").replace(u,"")}const d=h(()=>{const j=n.slice?.preview;if(!j)return[];const R=[];if(n.template){const M=v(n.template);if(M){const I=j.match(i)?.[0]||"",F=I?j.slice(0,-I.length):j;R.push(`${F}--${M}${I}`)}}return R.push(j),R}),m=$(0),b=$(!1),f=$(!1),l=h(()=>{const j=d.value[m.value];return j?`${p}/${j}`:""}),w=h(()=>d.value.length>0);we(d,()=>{m.value=0,b.value=!1,f.value=!1},{immediate:!0,deep:!0});function x(){b.value=!0}function L(){if(m.value<d.value.length-1){m.value+=1,b.value=!1;return}f.value=!0}return(j,R)=>(o(),s(le,null,[w.value&&!f.value?ue((o(),s("img",{key:l.value,src:l.value,alt:n.alt,class:ee(["absolute inset-0 w-full h-full",n.fit==="contain"?"object-contain":"object-cover"]),onLoad:x,onError:L},null,42,gc)),[[Et,b.value]]):_("",!0),!w.value||f.value||!b.value?(o(),s("div",xc,[...R[0]||(R[0]=[e("div",{class:"font-mono text-[10px] text-voix-admin-300 uppercase tracking-wider"}," No preview ",-1)])])):_("",!0)],64))}},fc=["data-slice-component","data-slice-template"],bc={class:"aspect-[4/3] relative overflow-hidden"},hc={key:0,class:"absolute top-2 right-2 w-5 h-5 rounded-full bg-voix-admin-800 text-white flex items-center justify-center shadow"},yc={class:"px-3 pt-2 pb-2.5 bg-white border-t border-voix-admin-100"},wc={class:"flex items-center gap-1.5 min-w-0"},kc={class:"text-[13px] font-semibold text-voix-admin-900 truncate"},_c={key:0,class:"shrink-0 rounded-full border border-voix-admin-200 text-voix-admin-500 px-1.5 py-px text-[9px] uppercase tracking-wider"},$c={key:0,class:"text-[11px] leading-snug text-voix-admin-500 mt-1 line-clamp-2"},Sc={class:"font-mono text-[11px] text-voix-admin-400 mt-1 truncate"}
13,Cc={__name:"SlicePreviewTile",props:{slice:{type:Object,required:!0},selected:{type:Boolean,default:!1},componentName:{type:String,required:!0},template:{type:String,default:null},title:{type:String,required:!0},meta:{type:String,required:!0},blank:{type:Boolean,default:!1}},setup(t){const n=t,i=h(()=>n.slice?.description||"");return(r,u)=>(o(),s("button",{class:ee(["group text-left rounded-lg overflow-hidden bg-white border border-voix-admin-100 p-0 cursor-pointer transition-all hover:shadow-[0_4px_12px_-4px_rgba(0,0,0,0.15)] hover:ring-1 hover:ring-voix-admin-300",{"ring-2 ring-voix-admin-800":n.selected}]),"data-testid":"voix-slice-preview-tile","data-slice-component":n.componentName,"data-slice-template":n.template||""},[e("div",bc,[k(Wn,{slice:n.slice,template:n.template,alt:`${n.title} preview`},null,8,["slice","template","alt"]),n.selected?(o(),s("div",hc,[...u[0]||(u[0]=[e("svg",{viewBox:"0 0 24 24",fill:"none",class:"w-3 h-3",stroke:"currentColor","stroke-width":"3"},[e("path",{d:"M5 13l4 4L19 7","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])])):_("",!0)]),e("div",yc,[e("div",wc,[e("div",kc,C(n.title),1),n.blank?(o(),s("span",_c," Blank ")):_("",!0)]),i.value?(o(),s("div",$c,C(i.value),1)):_("",!0),e("div",Sc,C(n.meta),1)])],10,fc))}},Pc={class:"h-full flex flex-col overflow-hidden"},Ec={class:"shrink-0 relative bg-white border-b border-voix-admin-100 focus-within:border-voix-admin-500 transition-colors"},Tc={class:"flex-1 relative min-h-0 flex"},Ic={key:0,class:"shrink-0 w-44 h-full overflow-y-auto border-r border-voix-admin-200/60 bg-voix-admin-100/50 py-4 px-2","data-testid":"voix-slice-browse-tree"}
13,Ac=["aria-pressed"],Vc={key:0,class:"absolute left-0 top-1/2 -translate-y-1/2 w-0.5 h-4 rounded-full bg-voix-admin-600"},Rc={class:"mt-1 space-y-0.5"},Lc=["data-branch","aria-pressed","onClick"],Mc={key:0,class:"absolute left-0 top-1/2 -translate-y-1/2 w-0.5 h-4 rounded-full bg-voix-admin-600"},Dc={class:"truncate"},Fc={class:"shrink-0 font-mono text-[10px] text-voix-admin-400"},jc={key:0,class:"space-y-0.5 pb-0.5","data-testid":"voix-slice-browse-children"},Oc=["data-branch","aria-pressed","onClick"],zc={key:0,class:"absolute left-3 top-1/2 -translate-y-1/2 w-0.5 h-3.5 rounded-full bg-voix-admin-600"},Uc={class:"truncate"},qc={class:"shrink-0 font-mono text-[10px] text-voix-admin-400"},Nc={class:"flex-1 min-w-0 h-full overflow-y-auto px-5 py-5"},Bc={class:"flex items-center justify-between gap-3 mb-4"},Gc={class:"font-mono text-[11px] text-voix-admin-400"},Hc={class:"flex items-center gap-1.5 shrink-0 cursor-pointer text-[11px] text-voix-admin-500 hover:text-voix-admin-900 transition-colors select-none",title:"Render the real slice in the preview below, instead of its captured image"},Wc={key:0,class:"flex flex-wrap items-center gap-1 mb-5","data-testid":"voix-slice-tag-filter"},Xc=["onClick"],Yc={class:"relative"},Kc={class:"mb-6"},Jc={class:"grid grid-cols-3 gap-3"},Qc={class:"relative inline-block pb-1.5 mb-3"},Zc={class:"text-[11px] tracking-[0.14em] uppercase font-bold text-voix-admin-900"},ep={class:"grid grid-cols-3 gap-3"},tp={key:0,class:"py-12 text-center"},np={class:"text-[13px] text-voix-admin-500"},ut="tag:",op=12,ip={__name:"AddSliceOptions",props:{parentSlice:{type:Object,default:null},allowedElements:{type:Array,default:()=>[]},selected:{type:[Object,String],default:null}},emits:["deselect","select","selectGroupSlice"],setup(t,{emit:n}){const i=t,r=n,u=/[-_\s]+/,c=/\s+/;function a(O){return O?O.split(u).filter(Boolean).map(T=>T.charAt(0).toUpperCase()+T.slice(1)).join(" "):""}const p=yt(),v=Se(),d=$(""),m=$(null),{livePreviewEnabled:b}=Gn();ze(async()=>{await nt(),m.value?.focus()});const f=h(()=>i.selected);function l(O,T){return[T.name?.label,T.name?.group,O,T.description,(T.tags||[]).join(" ")].filter(Boolean).join(" ").toLowerCase()}const w=h(()=>{const O=d.value.trim().toLowerCase().split(c).filter(Boolean);return{tags:O.filter(T=>T.startsWith(ut)).map(T=>T.slice(ut.length)).filter(Boolean),text:O.filter(T=>!T.startsWith(ut)).join(" ")}});function x(O){const{tags:T}=w.value;if(T.length===0)return!0;const K=(O.tags||[]).map(B=>B.toLowerCase());return T.every(B=>K.some(S=>S.includes(B)))}const L=h(()=>{const O=p.slices,T=i.allowedElements.length>0?Object.entries(O).reduce((K,[B,S])=>((i.allowedElements.includes(S.name.label)||i.allowedElements.includes(B))&&(K[B]=S),K),{}):O;return Object.entries(T).filter(K=>{if(K[1]?.deprecated)return!1;const B=K[1].name.layouts;return B?B?.includes(v.currentPage.layout)||B.includes("*"):!1})});function j(O){return(Object.hasOwn(O.name,"group")?O.name.group?.toLowerCase().trim():"global")||"global"}function R(O,T){const K=yn(T),B=K[0]?.label??null,S=T.name?.label||O;return K.length<2?[{key:O,component:O,slice:T,template:B,title:S,meta:O,blank:!1}]:[...K.map(ae=>({key:`${O}::${ae.label}`,component:O,slice:T,template:ae.label,title:ae.label,meta:S,blank:!1})),{key:`${O}::`,component:O,slice:T,template:null,title:S,meta:O,blank:!0}]}const M=h(()=>{const O={},{text:T}=w.value;return L.value.forEach(([K,B])=>{if(!x(B))return;const S=!T||l(K,B).includes(T),ae=R(K,B).filter(Me=>S||Me.title.toLowerCase().includes(T));if(ae.length===0)return;const re=j(B);Object.hasOwn(O,re)||(O[re]=[]),O[re].push(...ae)}),O}),I=h(()=>Object.values(M.value).reduce((O,T)=>O+T.length,0)),F=h(()=>{if(d.value)return`Matching "${d.value}"`;const O=I.value+1;return`${O} option${O===1?"":"s"} available`});function V(){r("selectGroupSlice")}function H(O){const T=f.value;return!T||T==="group"?!1:T.component===O.component&&T.template===O.template}function P(O){if(H(O)){r("deselect");return}r("select",{component:O.component,template:O.template})}const X=Tt().public.voix,ne=h(()=>vc(X.options?.sliceBrowse,L.value.map(([O,T])=>
13({slice:T,tiles:R(O,T).length})))),G=h(()=>{const O=new Set,T=K=>{K.forEach(B=>{B.tags.forEach(S=>O.add(S)),T(B.children)})};return T(ne.value),O}),z=h(()=>mc(ne.value,w.value.tags)),Y=h(()=>ne.value.find(O=>O.tags[0]===z.value?.tags[0])??null);function ie(O){return z.value?.key===O.key}function W(O){const K=d.value.trim().toLowerCase().split(c).filter(Boolean).filter(S=>S.startsWith(ut)?!G.value.has(S.slice(ut.length)):!0),B=ie(O)?O.tags.slice(0,-1):O.tags;d.value=[...K,...B.map(S=>`${ut}${S}`)].join(" ")}function E(){const O=d.value.trim().toLowerCase().split(c).filter(Boolean);d.value=O.filter(T=>!T.startsWith(ut)||!G.value.has(T.slice(ut.length))).join(" ")}const g=h(()=>{const O=new Map;return L.value.forEach(([,T])=>{(T.tags||[]).forEach(K=>{const B=K.toLowerCase();if(!B||O.has(B))return;[...G.value].some(ae=>B.includes(ae))||O.set(B,K)})}),[...O.entries()].sort(([T],[K])=>T.localeCompare(K)).map(([T,K])=>({key:T,label:K}))}),y=$(!1),A=h(()=>y.value?g.value:g.value.slice(0,op));function J(O){return w.value.tags.includes(O)}function D(O){const T=`${ut}${O.toLowerCase()}`,K=d.value.trim().toLowerCase().split(c).filter(Boolean),B=K.includes(T)?K.filter(S=>S!==T):[...K,T];d.value=B.join(" ")}const U=h(()=>!!f.value);return Ht("selectSlice",P),Ht("selectedSlice",f),(O,T)=>(o(),s("div",Pc,[e("div",Ec,[T[5]||(T[5]=e("svg",{viewBox:"0 0 24 24",fill:"none",class:"w-4 h-4 absolute left-5 top-1/2 -translate-y-1/2 text-voix-admin-400 pointer-events-none",stroke:"currentColor","stroke-width":"2"},[e("circle",{cx:"11",cy:"11",r:"7"}),e("path",{d:"M21 21l-4.3-4.3","stroke-linecap":"round"})],-1)),ue(e("input",{id:"addSliceFilter",ref_key:"filterInput",ref:m,"onUpdate:modelValue":T[0]||(T[0]=K=>d.value=K),type:"text",placeholder:"Search name, description, tags — or tag:stats",class:"w-full h-14 pl-12 pr-5 bg-transparent border-0 outline-none text-sm text-voix-admin-900 placeholder:text-voix-admin-400"},null,512),[[$e,d.value]])]),e("div",Tc,[ne.value.length?(o(),s("aside",Ic,[T[7]||(T[7]=e("div",{class:"px-2.5 mb-2 text-[10px] tracking-[0.14em] uppercase font-bold text-voix-admin-400"}," Browse ",-1)),e("button",{class:ee(["w-full h-8 px-2.5 rounded-md flex items-center justify-between gap-2 text-[12px] text-left transition-colors cursor-pointer relative",z.value?"text-voix-admin-600 hover:bg-voix-admin-200/40 hover:text-voix-admin-700":"bg-white shadow-sm text-voix-admin-700 font-medium"]),"data-testid":"voix-slice-browse-all","aria-pressed":!z.value,onClick:E},[z.value?_("",!0):(o(),s("span",Vc)),T[6]||(T[6]=e("span",{class:"truncate"},"All slices",-1))],10,Ac),e("div",Rc,[(o(!0),s(le,null,fe(ne.value,K=>(o(),s(le,{key:K.key},[e("button",{class:ee(["w-full h-8 px-2.5 rounded-md flex items-center justify-between gap-2 text-[12px] text-left transition-colors cursor-pointer relative",ie(K)?"bg-white shadow-sm text-voix-admin-700 font-medium":"text-voix-admin-600 hover:bg-voix-admin-200/40 hover:text-voix-admin-700"]),"data-branch":K.key,"aria-pressed":ie(K),onClick:B=>W(K)},[ie(K)?(o(),s("span",Mc)):_("",!0),e("span",Dc,C(K.label),1),e("span",Fc,C(K.count),1)],10,Lc),Y.value?.key===K.key&&K.children.length?(o(),s("div",jc,[(o(!0),s(le,null,fe(K.children,B=>(o(),s("button",{key:B.key,class:ee(["w-full h-7 pl-6 pr-2.5 rounded-md flex items-center justify-between gap-2 text-[12px] text-left transition-colors cursor-pointer relative",ie(B)?"bg-white shadow-sm text-voix-admin-700 font-medium":"text-voix-admin-600 hover:bg-voix-admin-200/40 hover:text-voix-admin-700"]),"data-branch":B.key,"aria-pressed":ie(B),onClick:S=>W(B)},[ie(B)?(o(),s("span",zc)):_("",!0),e("span",Uc,C(B.label),1),e("span",qc,C(B.count),1)],10,Oc))),128))])):_("",!0)],64))),128))])])):_("",!0),e("div",Nc,[e("div",Bc,[e("div",Gc,C(F.value),1),e("label",Hc,[ue(e("input",{"onUpdate:modelValue":T[1]||(T[1]=K=>so(b)?b.value=K:null),type:"checkbox",class:"w-3 h-3 accent-voix-admin-800 cursor-pointer","data-testid":"voix-slice-live-preview-toggle"},null,512),[[bt,N(b)]]),T[8]||(T[8]=ce(" Live preview ",-1))])]),g.value.length?(o(),s("div",Wc,[(o(!0),s(le,null,fe(A.value,K=>(o(),s("button",{key:K.key,class:ee(["border rounded-full px-2.5 py-1 text-[11px] cursor-pointer transition-colors",J(K.key)?"bg-voix-admin-800 border-voix-admin-800 text-white":"bg-white border-voix-admin-200 text-voix-admin-600 hover:border-voix-admin-400 hover:text-voix-admin-900"]),onClick:B=>D(K.key)},C(K.label),11,Xc))),128)),g.value.length>A.value.length||y.value?(o(),s("button",{key:0,class:"text-[11px] text-voix-admin-500 hover:text-voix-admin-900 px-1.5 py-1 cursor-pointer transition-colors",onClick:T[2]||(T[2]=K=>y.value=!y.value)},C(y.value?"Show fewer":`+${g.value.length-A.value.length} more`),1)):_("",!0)])):_("",!0),e("div",Yc,[e("div",{class:ee(["transition-opacity duration-200",{"opacity-40 pointer-events-none select-none":U.value}]),"data-testid":"voix-slice-grid"},[e("div",Kc,[T[10]||(T[10]=e("div",{class:"relative inline-block pb-1.5 mb-3"},[e("h3",{class:"text-[11px] tracking-[0.14em] uppercase font-bold text-voix-admin-900"}," System "),e("span",{class:"absolute left-0 bottom-0 w-5 h-0.5 bg-voix-admin-800 rounded-full"})],-1)),e("div",Jc,[e("button",{class:ee(["group text-left rounded-lg overflow-hidden border-2 border-dashed border-voix-admin-200 bg-voix-admin-50/40 hover:border-voix-admin-300 hover:bg-white transition-all p-0 cursor-pointer",{"ring-2 ring-voix-admin-800 border-solid border-voix-admin-800":f.value==="group"}]),onClick:V},[...T[9]||(T[9]=[Pn('<div class="aspect-[4/3] flex items-center justify-center"><div class="w-10 h-10 rounded-md bg-white ring-1 ring-voix-admin-200 flex items-center justify-center text-voix-admin-700 group-hover:ring-voix-admin-300"><svg viewBox="0 0 24 24" fill="none" class="w-5 h-5" stroke="currentColor" stroke-width="1.8"><path d="M12 5v14M5 12h14" stroke-linecap="round"></path></svg></div></div><div class="px-3 pt-2 pb-2.5 bg-white border-t border-voix-admin-100"><div class="text-[13px] font-semibold text-voix-admin-900"> New Group Slice </div><div class="font-mono text-[11px] text-voix-admin-400 mt-0.5"> container · nestable </div></div>',2)])],2)])]),(o(!0),s(le,null,fe(M.value,(K,B)=>(o(),s("div",{key:B,class:"mb-6"},[e("div",Qc,[e("h3",Zc,C(a(B.toString())),1),T[11]||(T[11]=e("span",{class:"absolute left-0 bottom-0 w-5 h-0.5 bg-voix-admin-800 rounded-full"},null,-1))]),e("div",ep,[(o(!0),s(le,null,fe(K,S=>(o(),se(Cc,{key:S.key,slice:S.slice,"component-name":S.component,template:S.template,title:S.title,meta:S.meta,blank:S.blank,selected:H(S),onClick:ae=>P(S)},null,8,["slice","component-name","template","title","meta","blank","selected","onClick"]))),128))])]))),128)),Object.keys(M.value).length===0?(o(),s("div",tp,[e("div",np,' No slices match "'+C(d.value)+'". ',1),e("button",{class:"mt-2 text-[12px] text-voix-admin-700 hover:text-voix-admin-900 font-medium cursor-pointer",onClick:T[3]||(T[3]=K=>d.value="")}," Clear filter ")])):_("",!0)],2),U.value?(o(),s("button",{key:0,t
13ype:"button",class:"absolute inset-0 z-10 w-full cursor-pointer",title:"Back to browsing","aria-label":"Clear the selection and go back to browsing","data-testid":"voix-slice-grid-deselect",onClick:T[4]||(T[4]=K=>r("deselect"))})):_("",!0)])])])]))}},sp={key:0,class:"h-full overflow-y-auto p-4 space-y-3","data-testid":"voix-slice-facts"},ap={key:0,class:"text-[12px] text-voix-admin-600 leading-snug"},lp={class:"space-y-2 text-[12px]"},rp={class:"text-voix-admin-900"},dp={class:"flex flex-wrap gap-1"},up={key:0},cp={class:"flex flex-wrap gap-1"},pp={class:"text-voix-admin-500 mb-0.5 truncate"},vp={class:"flex flex-wrap gap-1"},mp={__name:"SliceFacts",props:{slice:{type:Object,default:null}},setup(t){const n=t,i=/[-_\s]+/,r=/variant|style|theme/i;function u(v){return v?v.split(i).filter(Boolean).map(d=>d.charAt(0).toUpperCase()+d.slice(1)).join(" "):""}function c(v){if(v===null||typeof v>"u")return"";if(typeof v=="string"||typeof v=="number")return String(v);const d=v,m=d.label??d.text??d.name??d.title??d.value;return typeof m=="string"||typeof m=="number"?String(m):""}const a=h(()=>{const v=n.slice?.fields||{};return Object.entries(v).filter(([d,m])=>m?.type==="select"&&(r.test(d)||r.test(m.label||""))).map(([d,m])=>({key:d,label:m.label||u(d),options:Object.values(m.options||{}).map(c).filter(Boolean)})).filter(d=>d.options.length>0)}),p=h(()=>n.slice?.name?.layouts||[]);return(v,d)=>n.slice?(o(),s("div",sp,[n.slice.description?(o(),s("p",ap,C(n.slice.description),1)):_("",!0),e("dl",lp,[e("div",null,[d[0]||(d[0]=e("dt",{class:"text-voix-admin-500 mb-0.5"}," Group ",-1)),e("dd",rp,C(n.slice.name?.group||"Global"),1)]),e("div",null,[d[1]||(d[1]=e("dt",{class:"text-voix-admin-500 mb-0.5"}," Layouts ",-1)),e("dd",dp,[(o(!0),s(le,null,fe(p.value,m=>(o(),s("span",{key:m,class:"bg-voix-admin-100 text-voix-admin-700 rounded-full px-2 py-0.5 text-[10px] font-medium"},C(m==="*"?"All":m),1))),128))])]),n.slice.tags?.length?(o(),s("div",up,[d[2]||(d[2]=e("dt",{class:"text-voix-admin-500 mb-0.5"}," Tags ",-1)),e("dd",cp,[(o(!0),s(le,null,fe(n.slice.tags,m=>(o(),s("span",{key:m,class:"bg-white border border-voix-admin-200 text-voix-admin-600 rounded-full px-2 py-0.5 text-[10px]"},C(m),1))),128))])])):_("",!0),(o(!0),s(le,null,fe(a.value,m=>(o(),s("div",{key:m.key},[e("dt",pp,C(m.label),1),e("dd",vp,[(o(!0),s(le,null,fe(m.options,b=>(o(),s("span",{key:b,class:"bg-white border border-voix-admin-200 text-voix-admin-600 rounded-full px-2 py-0.5 text-[10px]"},C(b),1))),128))])]))),128))])])):_("",!0)}},gp={class:"absolute inset-0 overflow-hidden"},xp={key:0,class:"absolute inset-0 bg-voix-admin-50 flex items-center justify-center p-6","data-testid":"voix-slice-live-preview-note"},fp={class:"text-center"},bp={class:"text-[12px] text-voix-admin-800 leading-snug whitespace-pre-line"},hp=["src","data-live-src"],yp={key:0,class:"absolute bottom-2 right-2 rounded-full bg-voix-admin-900/80 text-white px-2 py-0.5 text-[9px] uppercase tracking-wider pointer-events-none"},gn=1280,wp=300,kp={__name:"SliceLivePreview",props:{component:{type:String,default:null},template:{type:String,default:null},layout:{type:String,default:""},previewNote:{type:String,default:null},active:{type:Boolean,default:!1}},setup(t){const n=t,i=$(null),r=$(0),u=$(0),c=h(()=>{if(!n.active||!n.component||!n.layout||n.previewNote)return"";const V=new URLSearchParams({layout:n.layout,template:n.template||""});return`/voix/slice-preview/${n.component}?${V.toString()}`}),a=$(""),p=$(""),v=h(()=>!!c.value&&p.value===c.value),d=h(()=>r.value?r.value/gn:0),m=h(()=>d.value?u.value/d.value:0),b=$(0),f=h(()=>b.value||m.value),l=h(()=>f.value*d.value);let w=null;function x(){w&&(clearTimeout(w),w=null)}we(c,V=>{x(),!(!V||V===a.value)&&(w=setTimeout(()=>{a.value=V,w=null},wp))},{immediate:!0});const L=$(null);let j=null;function R(){j?.disconnect(),j=null}function M(){R();const V=L.value?.contentDocument;if(!V?.documentElement)return;const H=V.documentElement,P=()=>{b.value=Math.max(H.scrollHeight,V.body?.scrollHeight??0)};P(),j=new ResizeObserver(P),j.observe(H),V.body&&j.observe(V.body)}function I(){p.value=a.value,M()}we(a,()=>{b.value=0,R(),i.value&&(i.value.scrollTop=0)});let F=null;return ze(()=>{i.value&&(F=new ResizeObserver(([V])=>{!V||V.contentRect.width===0||(r.value=V.contentRect.width,u.value=V.contentRect.height)}),F.observe(i.value))}),Rt(()=>{x(),R(),F?.disconnect(),F=null}),(V,H)=>(o(),s("div",gp,[e("div",{ref_key:"wrapper",ref:i,class:"absolute inset-0 overflow-y-auto overflow-x-hidden",style:{"scrollbar-gutter":"stable"},"data-testid":"voix-slice-live-preview-scroll"},[n.previewNote&&n.active?(o(),s("div",xp,[e("div",fp,[H[0]||(H[0]=e("div",{class:"text-[10px] uppercase tracking-wider text-voix-admin-500 mb-1.5"}," No preview available ",-1)),e("div",bp,C(n.previewNote),1)])])):(o(),s("div",{key:1,class:"relative w-full",style:Ee({height:`${l.value}px`})},[a.value?ue((o(),s("iframe",{key:0,ref_key:"frame",ref:L,src:a.value,title:"Live slice preview",scrolling:"no",class:"absolute top-0 left-0 border-0 bg-white",style:Ee({width:`${gn}px`,height:`${f.value}px`,transform:`scale(${d.value})`,transformOrigin:"top left"}),"data-testid":"voix-slice-live-preview","data-live-src":a.value,onLoad:I},null,44,hp)),[[Et,v.value]]):_("",!0)],4))],512),v.value?(o(),s("div",yp," Live ")):_("",!0)]))}}
13,_p=At({components:{AddSliceOptions:ip,SliceFacts:mp,SliceLivePreview:kp,SlicePreviewImage:Wn,SlideoutPanel:ot},props:{addTo:{type:[String,Number],default:null},theSlot:{type:Object,default:()=>({name:"default",allowedElements:[]})}},emits:["close"],setup(t,n){const i=Se(),r=yt(),u=qe(),{livePreviewEnabled:c}=Gn(),a=$(!1),p=$(null),v=h(()=>{const X=p.value;if(!X)return null;if(X==="group")return"New Group Slice";const G=r.slices?.[X.component]?.name?.label||X.component;return X.template?`${G} — ${X.template}`:G}),d=h(()=>{const X=r.slices||{},ne=t.theSlot.allowedElements||[],G=i.currentPage?.layout;return Object.entries(X).filter(([z,Y])=>{if(Y?.deprecated)return!1;const ie=Y?.name?.layouts;return!(!ie||!ie.includes(G)&&!ie.includes("*")||ne.length>0&&!ne.includes(Y?.name?.label)&&!ne.includes(z))}).length}),m=()=>{a.value=!1,p.value=null,n.emit("close")},b=X=>{p.value=X},f=()=>{p.value="group"},l=()=>{p.value=null},w=()=>{const X=p.value;if(!X)return;const ne=t.addTo?t.addTo.toString():null;if(X==="group"){const z={id:Ut(),label:"Group",enabled:!0,hydration_mode:"load",xp_status:"approved",type:"group",elements:[],properties:{dom_id:"",settings:[{breakpoint:"default",padding:{},margin:{},contain:!0}]},administration:{gui:{el:null},permissions:[]}};i.addElement(z,ne),m();return}const G=r.buildSliceDataFromSliceConfig(X.component,t.theSlot.name,X.template);G&&(i.addElement(G,ne),m())},x=()=>{m()},L=h(()=>{const X=p.value;return X&&X!=="group"?X.component:null}),j=h(()=>{const X=L.value;return X?r.slices[X]??null:null}),R=h(()=>yn(j.value)),M=h(()=>{const X=p.value;return!X||X==="group"?null:X.template??R.value[0]?.label??null}),I=h(()=>R.value.findIndex(X=>X.label===M.value)),F=h(()=>R.value.length>1),V=h(()=>!!j.value?.previewNote),H=h(()=>!V.value&&c.value&&M.value!==null),P=h(()=>L.value!==null),Q=X=>{const ne=R.value,G=L.value;if(!G||ne.length<2)return;const z=(I.value+X+ne.length)%ne.length;p.value={component:G,template:ne[z].label}};return{showSliceSelector:a,selectedSlice:p,selectedSliceLabel:v,availableCount:d,adminStore:u,theSlotName:h(()=>t.theSlot.name),selectGroupSlice:f,selectSlice:b,deselectSlice:l,addSliceToCurrentPage:w,requestCancel:x,close:m,currentPageLayout:h(()=>i.currentPage?.layout||""),selectedComponent:L,selectedConfig:j,selectedTemplates:R,previewTemplate:M,templateIndex:I,hasTemplatePager:F,showsLivePreview:H,showsPreviewNote:V,previewOpen:P,stepTemplate:Q}}}),$p={class:"relative text-xs"},Sp={key:0,class:"h-full flex flex-col"},Cp={class:"flex-1 min-h-0 flex border-b border-voix-admin-200/60"},Pp={class:"relative flex-1 min-w-0 bg-voix-admin-50"},Ep={class:"shrink-0 w-[240px] min-h-0 border-l border-voix-admin-200/60 bg-white"},Tp={class:"shrink-0 h-11 px-4 flex items-center justify-between gap-3"},Ip={class:"text-[12px] text-voix-admin-600 truncate"},Ap={class:"font-medium text-voix-admin-900"},Vp={class:"flex items-center gap-1 shrink-0"},Rp={class:"font-mono text-[11px] text-voix-admin-500 tabular-nums px-1"},Lp={class:"px-4 py-3 flex items-center justify-between gap-3 border-t border-voix-admin-200/40"},Mp={class:"flex items-center gap-2 font-mono text-[11px] text-voix-admin-400 min-w-0"},Dp={class:"truncate"},Fp={class:"text-voix-admin-900 font-medium"},jp={class:"flex items-center gap-2 shrink-0"},Op=["disabled"];function zp(t,n,i,r,u,c){const a=Ie("AddSliceOptions"),p=Ie("SliceLivePreview"),v=Ie("SlicePreviewImage"),d=Ie("SliceFacts"),m=Ie("SlideoutPanel");return o(),s("div",$p,[e("div",{onClick:n[0]||(n[0]=b=>t.showSliceSelector=!t.showSliceSelector)},[ht(t.$slots,"default")]),(o(),se(vt,{to:"#voix-admin-root"},[e("div",{class:ee(["voix-slideout fixed z-[100000] top-0 left-0 ml-[352px] w-[820px] h-screen shadow-xl border-r border-voix-admin-200/60 duration-300 bg-white",{"opacity-0 pointer-events-none":!t.showSliceSelector,"opacity-100 pointer-events-auto":t.showSliceSelector,"-translate-x-[900px]":t.adminStore.isReviewMode}])},[t.showSliceSelector?(o(),se(m,{key:0,icon:"heroicons:squares-plus",title:"Add Slice",subtitle:`slot: ${t.theSlotName} · ${t.availableCount} available`,onClose:t.close},{footer:pe(()=>[e("div",{class:"overflow-hidden transition-[height] duration-300 ease-out",style:Ee({height:t.previewOpen?"min(404px, 45vh)":"0px"}),"data-testid":"voix-add-slice-preview"},[t.selectedConfig?(o(),s("div",Sp,[e("div",Cp,[e("div",Pp,[t.showsLivePreview||t.showsPreviewNote?(o(),se(p,{key:0,component:t.
13selectedComponent,template:t.previewTemplate,layout:t.currentPageLayout,"preview-note":t.selectedConfig.previewNote||null,active:t.previewOpen},null,8,["component","template","layout","preview-note","active"])):(o(),se(v,{key:1,slice:t.selectedConfig,template:t.previewTemplate,fit:"contain",alt:`${t.selectedSliceLabel} preview`},null,8,["slice","template","alt"]))]),e("div",Ep,[k(d,{slice:t.selectedConfig},null,8,["slice"])])]),e("div",Tp,[e("div",Ip,[e("span",Ap,C(t.selectedConfig.name?.label),1),t.previewTemplate?(o(),s(le,{key:0},[n[6]||(n[6]=e("span",{class:"text-voix-admin-300 mx-1.5"},"/",-1)),ce(C(t.previewTemplate),1)],64)):_("",!0)]),e("div",Vp,[t.hasTemplatePager?(o(),s(le,{key:0},[e("button",{class:"w-7 h-7 rounded-md flex items-center justify-center text-voix-admin-500 hover:bg-white hover:text-voix-admin-900 cursor-pointer transition-colors",title:"Previous template","data-testid":"voix-add-slice-prev-template",onClick:n[1]||(n[1]=b=>t.stepTemplate(-1))},[...n[7]||(n[7]=[e("svg",{viewBox:"0 0 24 24",fill:"none",class:"w-4 h-4",stroke:"currentColor","stroke-width":"2"},[e("path",{d:"M15 19l-7-7 7-7","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])]),e("div",Rp,C(t.templateIndex+1)+" / "+C(t.selectedTemplates.length),1),e("button",{class:"w-7 h-7 rounded-md flex items-center justify-center text-voix-admin-500 hover:bg-white hover:text-voix-admin-900 cursor-pointer transition-colors",title:"Next template","data-testid":"voix-add-slice-next-template",onClick:n[2]||(n[2]=b=>t.stepTemplate(1))},[...n[8]||(n[8]=[e("svg",{viewBox:"0 0 24 24",fill:"none",class:"w-4 h-4",stroke:"currentColor","stroke-width":"2"},[e("path",{d:"M9 5l7 7-7 7","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])]),n[9]||(n[9]=e("div",{class:"w-px h-4 bg-voix-admin-200 mx-1.5"},null,-1))],64)):_("",!0),e("button",{class:"h-7 px-2.5 rounded-md text-[12px] font-medium text-voix-admin-500 hover:bg-white hover:text-voix-admin-900 cursor-pointer transition-colors",title:"Clear the selection and go back to browsing","data-testid":"voix-add-slice-deselect",onClick:n[3]||(n[3]=(...b)=>t.deselectSlice&&t.deselectSlice(...b))}," Deselect ")])])])):_("",!0)],4),e("div",Lp,[e("div",Mp,[t.selectedSliceLabel?(o(),s(le,{key:0},[n[11]||(n[11]=e("span",{class:"w-1.5 h-1.5 rounded-full bg-voix-admin-800 shrink-0"},null,-1)),e("span",Dp,[n[10]||(n[10]=ce(" Selected: ",-1)),e("span",Fp,C(t.selectedSliceLabel),1)])],64)):(o(),s(le,{key:1},[n[12]||(n[12]=e("span",{class:"w-1.5 h-1.5 rounded-full bg-voix-admin-200 shrink-0"},null,-1)),n[13]||(n[13]=e("span",null,"Pick a slice to add",-1))],64))]),e("div",jp,[e("button",{class:"h-8 px-3 rounded-md text-[13px] font-medium text-voix-admin-500 hover:bg-white/80 hover:text-voix-admin-900 cursor-pointer transition-colors",onClick:n[4]||(n[4]=(...b)=>t.requestCancel&&t.requestCancel(...b))}," Cancel "),e("button",{class:"h-8 px-4 rounded-md text-[13px] font-semibold text-white bg-voix-admin-800 hover:opacity-90 cursor-pointer transition-opacity inline-flex items-center gap-1.5 disabled:opacity-40 disabled:cursor-not-allowed","data-testid":"voix-add-slice-confirm",disabled:!t.selectedSlice,onClick:n[5]||(n[5]=(...b)=>t.addSliceToCurrentPage&&t.addSliceToCurrentPage(...b))},[...n[14]||(n[14]=[ce(" Add Slice ",-1),e("svg",{viewBox:"0 0 24 24",fill:"none",class:"w-3.5 h-3.5",stroke:"currentColor","stroke-width":"2"},[e("path",{d:"M5 12h14M13 5l7 7-7 7","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])],8,Op)])])]),default:pe(()=>[k(a,{"allowed-elements":t.theSlot.allowedElements,selected:t.selectedSlice,onDeselect:t.deselectSlice,onSelect:t.selectSlice,onSelectGroupSlice:t.selectGroupSlice},null,8,["allowed-elements","selected","onDeselect","onSelect","onSelectGroupSlice"])]),_:1},8,["subtitle","onClose"])):_("",!0)],2)]))])}const Up=Je(_p,[["render",zp]]),qp={class:"relative"},Np=["onClick","onContextmenu"],Bp={class:"flex-1 truncate"},Gp={class:"mt-2 relative"},Hp={key:1,class:"absolute z-50 top-full left-0 mt-1 w-full bg-white border border-gray-200 rounded shadow-lg py-1"},Wp=["onClick"],Xp={class:"truncate"},Yp={__name:"PageNavigationSegments",setup(t){const n=qe(),i=Rn(),{segmentation:r}=Lt(),u=$(!1);ze(async()=>{r.value&&await Ln({filter:"",orderBy:[],first:100,page:1})});const c=h(()=>{const R=i.segments?.data||[],M=n.pageSegments.map(I=>I.id);return R.filter(I=>!M.includes(I.id))});function a(R){n.activeSegment!==null&&n.activeSegment.key===R.key?n.clearActiveSegment():n.setActiveSegment(R)}function p(){n.clearActiveSegment()}function v(R){n.addPageSegment(R),u.value=!1}const d=$(null),m=$(0),b=$(0),f=$(!1);function l(R,M){R.preventDefault(),d.value=M,m.value=R.clientX,b.value=R.clientY,f.value=!0}function w(){f.value=!1,d.value=null}function x(){n.clearActiveSegment(),w()}function L(){d.value!==null&&Ze({name:"voix-settings-segments-edit-en",params:{id:d.value.id}}),w()}function j(){d.value!==null&&n.removePageSegment(d.value.key),w()}return(R,M)=>(o(),s("div",qp,[e("button",{class:ee(["flex items-center space-x-2 w-full py-1.5 px-2 rounded transition-colors duration-200 text-left",{"bg-teal-100 text-teal-800":N(n).activeSegment===null,"hover:bg-gray-200":N(n).activeSegment!==null}]),onClick:p},[...M[1]||(M[1]=[e("span",{class:"inline-block w-2.5 h-2.5 rounded-full bg-gray-400 flex-shrink-0"},null,-1),e("span",{class:"flex-1 truncate"},"Default",-1)])],2),(o(!0),s(le,null,fe(N(n).pageSegments,I=>(o(),s("button",{key:I.key,class:ee(["flex items-center space-x-2 w-full py-1.5 px-2 rounded transition-colors duration-200 text-left",{"bg-teal-100 text-teal-800":N(n).activeSegment!==null&&N(n).activeSegment.key===I.key,"hover:bg-gray-200":N(n).activeSegment===null||N(n).activeSegment.key!==I.key}]),onClick:F=>a(I),onContextmenu:F=>l(F,I)},[e("span",{class:"inline-block w-2.5 h-2.5 rounded-full flex-shrink-0",style:Ee({backgroundColor:I.color})},null,4),e("span",Bp,C(I.label),1)],42,Np))),128)),e("div",Gp,[c.value.length>0?(o(),s("button",{key:0,class:"flex items-center space-x-1 w-full py-1 px-2 rounded text-gray-400 hover:text-gray-600 hover:bg-gray-200 transition-colors duration-200",onClick:M[0]||(M[0]=I=>u.value=!u.value)},[...M[2]||(M[2]=[e("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"w-4 h-4"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 4.5v15m7.5-7.5h-15"})],-1),e("span",null,"Add Segment",-1)])])):_("",!0),u.value?(o(),s("div",Hp,[(o(!0),s(le,null,fe(c.value,I=>(o(),s("button",{key:I.key,class:"flex items-center space-x-2 w-full py-1.5 px-3 hover:bg-gray-100 text-left",onClick:F=>v(I)},[e("span",{class:"inline-block w-2.5 h-2.5 rounded-full flex-shrink-0",style:Ee({backgroundColor:I.color})},null,4),e("span",Xp,C(I.label),1)],8,Wp))),128))])):_("",!0)]),(o(),se(vt,{to:"#voix-admin-root"},[f.value?(o(),s("div",{key:0,class:"fixed inset-0 z-[9999]",onClick:w},[e("div",{class:"absolute bg-white border border-gray-200 rounded shadow-lg py-1 text-xs min-w-[200px]",style:Ee({left:`${m.value}px`,top:`${b.value}px`})},[e("button",{class:"w-full text-left px-3 py-1.5 hover:bg-gray-100",onClick:je(x,["stop"])}," Stop viewing segment "),e("button",{class:"w-full text-left px-3 py-1.5 hover:bg-gray-100",onClick:je(L,["stop"])}," Manage Segment Settings "),M[3]||(M[3]=e("hr",{class:"my-1"},null,-1)),e("button",{class:"w-full text-left px-3 py-1.5 hover:bg-red-50 text-red-600",onClick:je(j,["stop"])}," Remove segment overrides entirely ")],4)])):_("",!0)]))]))}};async function Kp(t){const n=qe();n.isLoading=!0;try{return await _e(`/api/admin/voix/pages/${t}/release-history`,{method:"GET"})}finally{n.isLoading=!1}}async function Jp(t,n,i){const r=qe(),u=Oe();r.isLoading=!0;try{const c=await _e(`/api/admin/voix/pages/${t}/release-history/${n}/re-release`,{method:"POST",body:i});return u.add("Version Restored","msg"),c}catch(c){const p=c?.data?.message??"Unable to restore version";throw u.add(p,"error"),c}finally{r.isLoading=!1}}const Qp={class:"flex flex-col h-screen"},Zp={class:"shrink-0 px-5 pt-5 pb-4 border-b border-gray-100"},ev={class:"flex items-center justify-between mb-4"},tv={class:"flex items-center gap-2.5"},nv={class:"bg-gray-100 text-gray-500 text-[11px] font-semibold px-2 py-0.5 rounded-xl"},ov={class:"relative"},iv={class:"flex-1 min-h-0 overflow-y-auto py-2"},sv={key:0,class:"flex items-center justify-center py-12"},av={key:1,class:"px-5 py-12 text-center text-gray-400 text-xs"},lv={key:2,class:"relative"},rv=["onClick"],dv={class:"relative shrink-0 ml-[30px] mr-2.5"},uv={key:0,class:"absolute -bottom-0.5 -right-1.5 bg-gray-700 text-white text-[7px] font-bold w-3.5 h-3.5 rounded-full flex items-center justify-center border border-white"},cv={class:"flex-1 min-w-0"},pv={key:0,class:"flex items-center gap-1.5 mb-1.5"},vv={key:0,class:"inline-flex items-center gap-1 text-[11px] font-semibold uppercase tracking-wider px-2 py-0.5 rounded bg-green-50 text-green-600"},mv={key:1,class:"inline-flex items-center gap-1 text-[11px] font-semibold uppercase tracking-wider px-2 py-0.5 rounded bg-indigo-50 text-indigo-600"},gv={class:"text-sm font-semibold text-gray-900 truncate leading-snug mb-0.5"},xv={class:"flex items-center gap-1 flex-wrap text-[11px] text-gray-400"},fv=["onClick"],bv=["onClick"],hv={class:"bg-white rounded-lg shadow-lg w-[640px] max-h-[80vh] overflow-hidden flex"},yv={class:"w-64 shrink-0 bg-gray-50 p-8 pt-14 flex flex-col justify-center"},wv={key:0,class:"mt-6 pt-4 border-t border-gray-200"},kv={class:"text-xs font-medium text-gray-700"},_v={class:"text-2xs text-gray-400 mt-0.5"},$v={class:"flex-1 p-8 flex flex-col justify-between"},Sv={class:"space-y-5"},Cv={class:"space-y-2.5"},Pv={class:"flex items-center gap-2.5 text-xs text-gray-600 cursor-pointer"},Ev={class:"flex items-center gap-2.5 text-xs text-gray-600 cursor-pointer"},Tv={class:"flex items-center gap-2.5 text-xs text-gray-600 cursor-pointer"},Iv={class:"flex items-center gap-2.5 text-xs text-gray-600 cursor-pointer"},Av={class:"flex justify-end gap-2 pt-6"},Vv=["disabled"],Rv=["disabled"],Lv={__name:"PageReleaseHistory",emits:["close"],setup(t,{emit:n}){const i=n,r=qe(),u=Se(),{fetchCurrentPage:c}=ft(),a=$([]),p=$(!1),v=$(null),d=$(""),m=$(!1),b=$(!1),f=$(""),l=xt({elements:!0,layout:!0,slug:!1,meta:!1}),w=h(()=>
13{if(!d.value.trim())return a.value;const E=d.value.toLowerCase();return a.value.filter(g=>g.label?.toLowerCase().includes(E))}),x=h(()=>a.value.length>0?a.value[0]?.id??null:null),L=new Map;function j(E,g){g?L.set(String(E),g.$el??g):L.delete(String(E))}function R(){const E=r.releaseId;if(E===null)return;L.get(String(E))?.scrollIntoView({behavior:"smooth",block:"center"})}ze(async()=>{await ne(),M(),await nt(),R()}),we(()=>r.pendingRestoreReleaseId,E=>{E&&a.value.length>0&&M()});function M(){const E=r.pendingRestoreReleaseId;if(!E)return;const g=a.value.find(y=>String(y.id)===String(E));g&&Y(g),r.clearRestoreReleaseRequest()}const I=["#6366f1","#ec4899","#f59e0b","#10b981","#ef4444","#8b5cf6","#06b6d4","#f97316","#84cc16","#14b8a6"];function F(E){return E.split(" ").map(g=>g[0]).join("").toUpperCase().slice(0,2)}function V(E){let g=0;for(let y=0;y<E.length;y++)g=E.charCodeAt(y)+((g<<5)-g);return I[Math.abs(g)%I.length]??I[0]}function H(E){const g=V(E);return`color: ${g}; background: ${g}14;`}function P(E){return E.id===x.value}function Q(E){return r.releaseId!==null&&String(E.id)===String(r.releaseId)}function X(){r.unsetReleaseId(),window.location.reload()}async function ne(){if(u.currentPage){p.value=!0;try{const E=await Kp(u.currentPage.id);a.value=E?.data??[]}catch(E){console.error("Failed to load release history:",E),a.value=[]}finally{p.value=!1}}}function G(E){v.value=E}function z(E){r.setReleaseId(String(E.id)),u.currentPage&&c({path:u.currentPage.path}),i("close")}async function Y(E){u.currentPage&&(v.value=E,f.value=`Restored from: ${E.label}`,l.elements=!0,l.layout=!0,l.slug=!1,l.meta=!1,m.value=!0)}async function ie(){if(!u.currentPage||!v.value)return;const E=[];if(l.elements&&E.push("elements"),l.layout&&E.push("layout"),l.slug&&E.push("slug"),l.meta&&E.push("meta"),E.length!==0){b.value=!0;try{if(await Jp(u.currentPage.id,v.value.id,{label:f.value,restore_options:E}),m.value=!1,v.value=null,r.releaseId!==null){r.unsetReleaseId(),window.location.reload();return}c({path:u.currentPage.path}),await ne()}catch(g){console.error("Restore failed:",g)}finally{b.value=!1}}}function W(E){return E?new Date(E).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"}):""}return(E,g)=>(o(),s("div",Qp,[e("div",Zp,[e("div",ev,[e("div",tv,[g[10]||(g[10]=e("span",{class:"text-[15px] font-semibold text-gray-900 tracking-tight"},"Release History",-1)),e("span",nv,C(w.value.length)+" releases ",1)]),e("button",{class:"w-7 h-7 flex items-center justify-center rounded-md hover:bg-gray-100 transition-colors duration-150",onClick:g[0]||(g[0]=y=>i("close"))},[...g[11]||(g[11]=[e("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"2",stroke:"currentColor",class:"w-4 h-4 text-gray-400"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"})],-1)])])]),e("div",ov,[g[13]||(g[13]=e("svg",{class:"absolute left-2.5 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400 pointer-events-none",fill:"none",viewBox:"0 0 24 24","stroke-width":"2",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})],-1)),ue(e("input",{"onUpdate:modelValue":g[1]||(g[1]=y=>d.value=y),type:"text",placeholder:"Search releases...",class:"w-full h-[34px] pl-8 pr-8 text-[13px] bg-gray-50 border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-voix-admin-500/10 focus:border-voix-admin-500 transition-all duration-150"},null,512),[[$e,d.value]]),d.value?(o(),s("button",{key:0,class:"absolute right-2 top-1/2 -translate-y-1/2 w-5 h-5 flex items-center justify-center rounded-full hover:bg-gray-200 transition-colors duration-150 cursor-pointer",onClick:g[2]||(g[2]=y=>d.value="")},[...g[12]||(g[12]=[e("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"2",stroke:"currentColor",class:"w-3 h-3 text-gray-400"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"})],-1)])])):_("",!0)])]),e("div",iv,[p.value?(o(),s("div",sv,[...g[14]||(g[14]=[e("div",{class:"animate-spin rounded-full h-5 w-5 border-b-2 border-voix-admin-500"},null,-1)])])):w.value.length===0?(o(),s("div",av,C(d.value?"No releases match your search.":"No published releases found."),1)):(o(),s("div",lv,[(o(!0),s(le,null,fe(w.value,y=>(o(),s("div",{key:y.id,ref_for:!0,ref:A=>
13j(y.id,A),class:ee(["release-card group",{"status-live":P(y),"status-previewing":Q(y),"is-selected":v.value?.id===y.id}]),onClick:A=>G(y)},[g[18]||(g[18]=e("div",{class:"timeline-segment"},null,-1)),e("div",{class:ee(["timeline-dot",{"dot-live":P(y),"dot-previewing":Q(y),"dot-selected":v.value?.id===y.id}])},null,2),e("div",dv,[e("div",{class:"w-5 h-5 rounded-full flex items-center justify-center text-[9px] font-semibold text-white shrink-0",style:Ee({background:y.contributors?.[0]?V(y.contributors[0].name):"#9ca3af"})},C(y.contributors?.[0]?F(y.contributors[0].name):"?"),5),y.contributors&&y.contributors.length>1?(o(),s("div",uv," +"+C(y.contributors.length-1),1)):_("",!0)]),e("div",cv,[P(y)||Q(y)?(o(),s("div",pv,[P(y)?(o(),s("span",vv,[...g[15]||(g[15]=[e("span",{class:"live-dot"},null,-1),ce(" Live ",-1)])])):_("",!0),Q(y)?(o(),s("span",mv,[...g[16]||(g[16]=[e("span",{class:"previewing-dot"},null,-1),ce(" Previewing ",-1)])])):_("",!0)])):_("",!0),e("div",gv,C(y.label||"Untitled Release"),1),e("div",xv,[y.contributors?.length?(o(),s(le,{key:0},[(o(!0),s(le,null,fe(y.contributors,A=>(o(),s("span",{key:A.id,class:"font-medium px-1.5 py-px rounded",style:Ee(H(A.name))},C(A.name),5))),128)),g[17]||(g[17]=e("span",null,"·",-1))],64)):_("",!0),e("span",null,C(W(y.released_at)),1)])]),e("div",{class:ee(["card-actions",{"is-visible":v.value?.id===y.id}])},[P(y)&&N(r).releaseId?(o(),s("button",{key:0,class:"action-btn action-resume",onClick:je(X,["stop"])}," Resume Current ")):_("",!0),P(y)?_("",!0):(o(),s("button",{key:1,class:"action-btn",onClick:je(A=>z(y),["stop"])}," Preview ",8,fv)),P(y)?_("",!0):(o(),s("button",{key:2,class:"action-btn action-restore",onClick:je(A=>Y(y),["stop"])}," Restore ",8,bv))],2)],10,rv))),128))]))]),(o(),se(vt,{to:"#voix-admin-root"},[m.value?(o(),se(ct,{key:0,"z-class":"z-[100001]",show:m.value,"can-close":!0,onClose:g[9]||(g[9]=y=>m.value=!1)},{default:pe(()=>[e("div",hv,[e("div",yv,[g[20]||(g[20]=e("div",{class:"flex items-center gap-2 mb-2"},[e("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"w-5 h-5 text-voix-admin-500 shrink-0"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0l3.181 3.183a8.25 8.25 0 0013.803-3.7M4.031 9.865a8.25 8.25 0 0113.803-3.7l3.181 3.182M2.985 19.644l3.181-3.182"})]),e("h3",{class:"text-base font-semibold text-gray-900"}," Restore Version ")],-1)),g[21]||(g[21]=e("p",{class:"text-xs text-gray-400 leading-relaxed"}," Restore will immediately save & publish live from previous version. The current version will remain in the history. ",-1)),v.value?(o(),s("div",wv,[g[19]||(g[19]=e("div",{class:"text-2xs uppercase tracking-wider text-gray-400 font-medium mb-1"}," Restoring from ",-1)),e("div",kv,C(v.value.label||"Untitled"),1),e("div",_v,C(W(v.value.released_at)),1)])):_("",!0)]),e("div",$v,[e("div",Sv,[e("div",null,[g[22]||(g[22]=e("label",{class:"block text-xs font-medium text-gray-500 mb-1"},"Release Label",-1)),ue(e("input",{"onUpdate:modelValue":g[3]||(g[3]=y=>f.value=y),type:"text",class:"w-full px-3 py-2 text-xs border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-voix-admin-500/10 focus:border-voix-admin-500 transition-all"},null,512),[[$e,f.value]])]),e("div",null,[g[27]||(g[27]=e("label",{class:"block text-xs font-medium text-gray-500 mb-3"},"What to restore",-1)),e("div",Cv,[e("label",Pv,[ue(e("input",{"onUpdate:modelValue":g[4]||(g[4]=y=>l.elements=y),type:"checkbox",class:"rounded border-gray-300 text-voix-admin-500 focus:ring-voix-admin-500"},null,512),[[bt,l.elements]]),g[23]||(g[23]=e("span",null,"Page Elements & Fields",-1))]),e("label",Ev,[ue(e("input",{"onUpdate:modelValue":g[5]||(g[5]=y=>l.layout=y),type:"checkbox",class:"rounded border-gray-300 text-voix-admin-500 focus:ring-voix-admin-500"},null,512),[[bt,l.layout]]),g[24]||(g[24]=e("span",null,"Layout",-1))]),e("label",Tv,[ue(e("input",{"onUpdate:modelValue":g[6]||(g[6]=y=>l.slug=y),type:"checkbox",class:"rounded border-gray-300 text-voix-admin-500 focus:ring-voix-admin-500"},null,512),[[bt,l.slug]]),g[25]||(g[25]=e("span",null,"Page Path",-1))]),e("label",Iv,[ue(e("input",{"onUpdate:modelValue":g[7]||(g[7]=y=>l.meta=y),type:"checkbox",class:"rounded border-gray-300 text-voix-admin-500 focus:ring-voix-admin-500"},null,512),[[bt,l.meta]]),g[26]||(g[26]=e("span",null,"Title & Meta",-1))])])])]),e("div",Av,[e("button",{class:"text-sm bg-gray-100 text-gray-600 hover:bg-gray-200 px-4 py-2 rounded transition-colors",disabled:b.value,onClick:g[8]||(g[8]=y=>m.value=!1)}," Cancel ",8,Vv),e("button",{class:"text-sm bg-voix-admin-600 text-white px-4 py-2 rounded hover:bg-voix-admin-700 disabled:opacity-50 transition-colors",disabled:b.value||!l.elements&&!l.layout&&!l.slug&&!l.meta,onClick:ie},C(b.value?"Restoring...":"Restore"),9,Rv)])])])]),_:1},8,["show"])):_("",!0)]))]))}},Mv=Je(Lv,[["__scopeId","data-v-4ea0c3d9"]]),Dv={class:"bg-white"},Fv={class:"bg-voix-admin-50/20 backdrop-blur w-[280px] h-full text-voix-admin-700 text-xs flex flex-col justify-between border-r border-voix-admin-200/60"},jv={key:0,class:"w-full overflow-y-auto"},Ov={class:"relative z-10"},zv={class:"px-4 pt-4 pb-4 border-b border-voix-admin-100"},Uv=["disabled"],qv=["title"],Nv=["disabled"],Bv={key:0,class:"mt-1 flex items-start gap-1.5 text-[10px] leading-snug text-amber-600"},Gv={key:1,class:"mt-3"},Hv={class:"mt-4 flex items-start gap-5"},Wv={class:"relative w-4 h-4 flex items-center justify-center"},Xv={key:0,class:"absolute -top-0.5 -right-1 w-1.5 h-1.5 rounded-full bg-red-500"},Yv={key:1,class:"absolute -top-0.5 -right-1 w-1.5 h-1.5 rounded-full bg-amber-500"},Kv={class:"w-4 h-4 flex items-center justify-center"},Jv={class:"w-4 h-4 flex items-center justify-center"}
13,Qv={class:"w-4 h-4 flex items-center justify-center"},Zv={class:"w-4 h-4 flex items-center justify-center"},em={class:"px-4 py-3 space-y-2 border-b border-voix-admin-100"},tm={class:"ml-auto text-[11px] text-voix-admin-400 group-hover:text-voix-admin-700 transition-colors"},nm={key:2,class:"pt-1"},om={key:1,class:"text-voix-admin-500 text-[11px] font-normal py-2"},im={class:"relative px-4 pt-5 pb-28"},sm={class:"relative"},am={class:"flex items-center justify-between mb-3"},lm={class:"relative z-10 px-4 pt-2 pb-3 space-y-2 border-t border-voix-admin-200/60 bg-voix-admin-50/80 backdrop-blur"},rm={key:1,class:"flex flex-col justify-center items-center p-4 w-full h-screen"},dm={__name:"PageNavigation",emits:["showPathWarning","showExportModal"],async setup(t,{emit:n}){let i,r;const u=n,c=xe(()=>ge(()=>import("./JRXbdKpi.js"),__vite__mapDeps([103,2,3,4,5,15,54,38,104,58,59,27,22,23,24,25,26,20,28,29,30,31,21,16,32,33,34,7,35,36,37,39,40,41,42,19,43,17,18,44,45,46,47,48,49,10,50,1,6,8,9,11,51,52,53,55,56,57,60,14,61,62,63,64,65,66,67,68,105]),import.meta.url)),{hasAnalyticsPermission:a}=Mn(),{aiContent:p,segmentation:v}=Lt(),d=qe(),m=Vt(),b=wt(),f=Se(),l=Rn(),w=wn(),x=Kt(),{getCurrentPage:L}=ft(),{checkUserPermissions:j}=Yt(),R=([i,r]=Gt(()=>j("Reviews.Manage")),i=await i,r(),i);function M(){D(),w.push({name:"voix-settings-pages-en"})}const I=h({get:()=>f.currentPage?.layout,set:Ce=>{f.updateLayout(Ce)}}),F=h(()=>{const Ce=[];return Object.keys(b.layouts).forEach(de=>{Ce.push({label:b.layouts[de]?.label,value:de,key:de})}),Ce}),V=$(!1),H=$(!1),P=$(!1),Q=$(!1),X=$(!1),ne=$(!1),G=$(!1);we(()=>d.pendingRestoreReleaseId,Ce=>{Ce&&(G.value=!0)}),ze(async()=>{x.query.openHeadTags==="true"&&(V.value=!0),v.value&&!l.segments?.data?.length&&await Ln({filter:"",orderBy:[],first:100,page:1})});const z=h(()=>m?.currentUser?.id.toString()===f.currentPage?.draft_release?.user_id?.toString());function Y(){const Ce=f.currentPage?.draft_release?.id;Ce&&Wt({id:Ce}).then(()=>{d.unsetReleaseId(),f.currentPage&&L(xt({path:f.currentPage.path}))})}const ie=h(()=>f.currentPage?.draft_release?"Save Draft":f.currentPage?.current_release?.status!=="published"?"Save Release":"Save Page"),W=h(()=>{const Ce=f.currentPage?.review_status;return Ce==="approved"?"Approved":Ce==="declined"?"Declined":"Not reviewed"}),E=h(()=>d.pageSegments?.length||0),g=$(!1),y=h(()=>d.makingRecipeElement!==null);function A(){d.makingRecipeElement=null}const J=h(()=>!!m?.currentUser?.all_permissions.find(de=>de.name.toLowerCase()==="pages.*"||de.name.toLowerCase()==="pages.edit.*"||de.name.toLowerCase()===`pages.edit.${f.currentPage?.id}`));function D(){V.value=!1,H.value=!1,P.value=!1,Q.value=!1,X.value=!1,ne.value=!1,G.value=!1}function U(){H.value=!1,P.value=!1,X.value=!1,Q.value=!1,ne.value=!1,V.value=!V.value}function O(){V.value=!1,P.value=!1,ne.value=!1,H.value=!H.value}function T(){V.value=!1,X.value=!1,Q.value=!1,H.value=!1,ne.value=!1,P.value=!P.value}function K(){V.value=!1,P.value=!1,Q.value=!1,ne.value=!1,X.value=!X.value}function B(){V.value=!1,P.value=!1,Q.value=!1,X.value=!1,H.value=!1,ne.value=!ne.value}const S=$(),ae=$(),re=h(()=>J.value?"cursor-text hover:bg-voix-admin-100/70 focus-within:bg-white focus-within:ring-1 focus-within:ring-voix-admin-500/30":"");function Me(Ce){J.value&&Ce?.focus()}xo(ae,"beforeinput",()=>{u("showPathWarning")});const He=h(()=>{const Ce=f.currentPage?.path;return!Ce||Ce==="/"?!1:Ce.endsWith("/")});function We(){d.unselectAll()}return(Ce,de)=>{const Ne=Le;return o(),s("div",Dv,[e("div",Fv,[N(f).currentPage?(o(),s("div",jv,[e("div",{class:"absolute inset-0",onClick:We}),(o(),se(vt,{to:"#voix-admin-root"},[e("div",{class:ee(["voix-slideout fixed z-[100000] top-0 left-0 ml-[352px] w-[480px] h-screen shadow-xl border-r border-voix-admin-200/60 duration-300",{"opacity-0 pointer-events-none":!V.value,"opacity-100 pointer-events-auto":V.value,"-translate-x-[520px]":N(d).isReviewMode}])},[V.value?(o(),se(uu,{key:0,page:N(f).currentPage,onClose:de[0]||(de[0]=Re=>V.value=!1)},null,8,["page"])):_("",!0)],2),e("div",{class:ee(["voix-slideout fixed z-[100000] top-0 left-0 ml-[352px] w-[480px] h-screen shadow-xl border-r border-voix-admin-200/60 duration-300",{"opacity-0 pointer-events-none":!H.value,"opacity-100 pointer-events-auto":H.value,"-translate-x-[520px]":N(d).isReviewM
13ode}])},[H.value?(o(),se(Nl,{key:0,onClose:de[1]||(de[1]=Re=>H.value=!1)})):_("",!0)],2),e("div",{class:ee(["voix-slideout fixed z-[100000] top-0 left-0 ml-[352px] w-[480px] h-screen shadow-xl border-r border-voix-admin-200/60 duration-300",{"opacity-0 pointer-events-none":!P.value,"opacity-100 pointer-events-auto":P.value,"-translate-x-[520px]":N(d).isReviewMode}])},[P.value?(o(),se(Ur,{key:0,onClose:de[2]||(de[2]=Re=>P.value=!1)})):_("",!0)],2),e("div",{class:ee(["voix-slideout fixed z-[100000] top-0 left-0 bg-white ml-[352px] w-[50vw] max-w-xl shadow-xl overflow-y-scroll max-h-screen duration-300",{"opacity-0 pointer-events-none":!Q.value,"opacity-100 pointer-events-auto":Q.value,"-translate-x-[560px]":N(d).isReviewMode}])},[Q.value?(o(),se(uc,{key:0,onClose:de[3]||(de[3]=Re=>Q.value=!1)})):_("",!0)],2),e("div",{class:ee(["voix-slideout fixed z-[100000] top-0 left-0 ml-[352px] w-[480px] h-screen shadow-xl border-r border-voix-admin-200/60 duration-300",{"opacity-0 pointer-events-none":!X.value,"opacity-100 pointer-events-auto":X.value,"-translate-x-[520px]":N(d).isReviewMode}])},[X.value?(o(),se(Zu,{key:0,onClose:de[4]||(de[4]=Re=>X.value=!1)})):_("",!0)],2),e("div",{class:ee(["voix-slideout fixed z-[100000] top-0 left-0 ml-[352px] w-[520px] h-screen shadow-xl border-r border-voix-admin-200/60 duration-300",{"opacity-0 pointer-events-none":!ne.value,"opacity-100 pointer-events-auto":ne.value,"-translate-x-[520px]":N(d).isReviewMode}])},[ne.value&&N(p)?(o(),se(ol,{key:0,onClose:de[5]||(de[5]=Re=>ne.value=!1)})):_("",!0)],2),e("div",{class:ee(["fixed z-[100000] top-0 left-0 bg-white ml-[352px] w-[calc(100vw-432px)] h-screen shadow-xl overflow-y-scroll max-h-screen duration-300",{"opacity-0 pointer-events-none":!y.value,"opacity-100 pointer-events-auto":y.value,"-translate-x-[560px]":N(d).isReviewMode}])},[y.value?(o(),se(Xs,{key:0,onClose:A})):_("",!0)],2),e("div",{class:ee(["fixed z-[100000] bottom-0 left-0 bg-white ml-[352px] w-[520px] shadow-xl max-h-screen duration-300",{"opacity-0 pointer-events-none":!G.value,"opacity-100 pointer-events-auto":G.value,"-translate-x-[560px]":N(d).isReviewMode}])},[G.value?(o(),se(Mv,{key:0,onClose:de[6]||(de[6]=Re=>G.value=!1)})):_("",!0)],2)])),e("div",{class:"z-10 relative cursor-pointer"},[e("button",{class:"group h-10 px-4 w-full flex items-center gap-2 text-voix-admin-500 bg-transparent border-b border-voix-admin-200/60 hover:bg-voix-admin-100/50 transition-colors duration-200 cursor-pointer",onClick:M},[...de[16]||(de[16]=[e("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"w-3.5 h-3.5 group-hover:-translate-x-1 duration-200 transform group-hover:text-voix-admin-700"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6.75 15.75L3 12m0 0l3.75-3.75M3 12h18"})],-1),e("span",{class:"uppercase font-semibold tracking-[0.12em] text-[10px] group-hover:text-voix-admin-700 duration-200 transform"}," Back to pages ",-1)])])]),e("div",Ov,[e("div",zv,[de[23]||(de[23]=e("div",{class:"text-[9px] uppercase tracking-[0.14em] font-semibold text-voix-admin-400"}," Editing page ",-1)),e("div",{class:ee(["group mt-1 -mx-1.5 px-1.5 py-0.5 rounded-md flex items-center gap-1.5 transition-colors",re.value]),onClick:de[8]||(de[8]=Re=>Me(S.value))},[ue(e("input",{ref_key:"pageTitleInput",ref:S,"onUpdate:modelValue":de[7]||(de[7]=Re=>N(f).currentPage.title=Re),type:"text",placeholder:"Page Label","aria-label":"Page title",class:"flex-1 min-w-0 text-[17px] font-semibold text-voix-admin-900 tracking-tight leading-snug bg-transparent border-0 p-0 focus:outline-none placeholder:text-voix-admin-300 disabled:opacity-60",disabled:!J.value},null,8,Uv),[[$e,N(f).currentPage.title]]),J.value?(o(),se(Ne,{key:0,name:"heroicons:pencil-square",size:"12",class:"flex-none cursor-pointer text-voix-admin-400 transition-colors group-hover:text-voix-admin-600"})):_("",!0)],2),e("div",{class:ee(["group -mx-1.5 px-1.5 py-0.5 rounded-md flex items-center gap-1.5 transition-colors",re.value]),title:J.value?"Click to edit the page path":void 0,onClick:de[10]||(de[10]=Re=>Me(ae.value))}
13,[ue(e("input",{ref_key:"pagePathInput",ref:ae,"onUpdate:modelValue":de[9]||(de[9]=Re=>N(f).currentPage.path=Re),type:"text",placeholder:"/page-path","aria-label":"Page path",class:"flex-1 min-w-0 font-mono text-[11px] text-voix-admin-500 bg-transparent border-0 p-0 focus:outline-none focus:text-voix-admin-800 placeholder:text-voix-admin-300 disabled:opacity-60",disabled:!J.value},null,8,Nv),[[$e,N(f).currentPage.path]]),J.value?(o(),se(Ne,{key:0,name:"heroicons:pencil-square",size:"12",class:"flex-none cursor-pointer text-voix-admin-400 transition-colors group-hover:text-voix-admin-600"})):_("",!0)],10,qv),He.value?(o(),s("div",Bv,[k(Ne,{name:"heroicons:exclamation-triangle",size:"12",class:"mt-px shrink-0"}),de[17]||(de[17]=e("span",null,"Page paths shouldn't end with a trailing slash — it can cause duplicate-content issues.",-1))])):_("",!0),J.value?(o(),s("div",Gv,[k(Ue,{id:"page-layout",modelValue:I.value,"onUpdate:modelValue":de[11]||(de[11]=Re=>I.value=Re),options:F.value,placeholder:"Default layout"},null,8,["modelValue","options"])])):_("",!0),e("div",Hv,[e("button",{class:"group flex flex-col items-center gap-1 text-voix-admin-500 hover:text-voix-admin-900 transition-colors",onClick:U},[e("div",Wv,[k(Ne,{name:"heroicons:code-bracket",size:"16"}),N(f).currentPage?.seo?.status==="error"?(o(),s("span",Xv)):N(f).currentPage?.seo?.status==="warning"||He.value?(o(),s("span",Yv)):_("",!0)]),de[18]||(de[18]=e("div",{class:"text-[9px] uppercase tracking-wider font-medium leading-none"}," Head ",-1))]),e("button",{class:"flex flex-col items-center gap-1 text-voix-admin-500 hover:text-voix-admin-900 transition-colors",onClick:T},[e("div",Kv,[k(Ne,{name:"heroicons:hashtag",size:"16"})]),de[19]||(de[19]=e("div",{class:"text-[9px] uppercase tracking-wider font-medium leading-none"}," Fields ",-1))]),N(a)?(o(),s("button",{key:0,class:"flex flex-col items-center gap-1 text-voix-admin-500 hover:text-voix-admin-900 transition-colors",onClick:O},[e("div",Jv,[k(Ne,{name:"heroicons:chart-bar",size:"16"})]),de[20]||(de[20]=e("div",{class:"text-[9px] uppercase tracking-wider font-medium leading-none"}," Stats ",-1))])):_("",!0),e("button",{class:"flex flex-col items-center gap-1 text-voix-admin-500 hover:text-voix-admin-900 transition-colors",onClick:K},[e("div",Qv,[k(Ne,{name:"heroicons:globe-alt",size:"16"})]),de[21]||(de[21]=e("div",{class:"text-[9px] uppercase tracking-wider font-medium leading-none"}," Locale ",-1))]),N(p)?(o(),s("button",{key:1,class:"flex flex-col items-center gap-1 text-voix-admin-500 hover:text-voix-admin-900 transition-colors",onClick:B},[e("div",Zv,[k(Ne,{name:"heroicons:sparkles",size:"16"})]),de[22]||(de[22]=e("div",{class:"text-[9px] uppercase tracking-wider font-medium leading-none"}," AI ",-1))])):_("",!0)])]),e("div",em,[N(R)?(o(),s("button",{key:0,class:"group w-full flex items-center gap-2 text-xs text-voix-admin-600 hover:text-voix-admin-900 transition-colors",onClick:de[12]||(de[12]=Re=>N(d).isReviewMode=!N(d).isReviewMode)},[e("span",{class:ee(["w-1.5 h-1.5 rounded-full flex-shrink-0",{"bg-green-500":N(f).currentPage?.review_status==="approved","bg-red-500":N(f).currentPage?.review_status==="declined","bg-voix-admin-300":!N(f).currentPage?.review_status||N(f).currentPage?.review_status!=="approved"&&N(f).currentPage?.review_status!=="declined"}])},null,2),e("span",null,C(W.value),1),de[24]||(de[24]=e("span",{class:"ml-auto text-[11px] text-voix-admin-400 group-hover:text-voix-admin-700 transition-colors"}," Review → ",-1))])):_("",!0),N(v)?(o(),s("button",{key:1,class:"group w-full flex items-center gap-2 text-xs text-voix-admin-600 hover:text-voix-admin-900 transition-colors",onClick:de[13]||(de[13]=Re=>g.value=!g.value)},[k(Ne,{name:"heroicons:user-group",size:"12",class:"text-voix-admin-400 flex-shrink-0"}),e("span",null,C(E.value)+" active segment"+C(E.value===1?"":"s"),1),e("span",tm,C(g.value?"Hide ↓":"Manage →"),1)])):_("",!0),g.value&&N(v)?(o(),s("div",nm,[(N(l).segments?.data?.length??0)>0?(o(),se(Yp,{key:0})):(o(),s("div",om," No segments configured. Create segments to target content to specific groups of visitors. "))])):_("",!0)]),e("div",im,[e("div",{class:"absolute inset-0",onClick:We}),e("div",sm,[e("div",am,[de[26]||(de[26]=e("h2",{class:"relative text-[11px] tracking-[0.14em] uppercase font-bold text-voix-admin-900 pb-1.5"},[ce(" Page Elements "),e("span",{class:"absolute left-0 bottom-0 w-5 h-0.5 bg-voix-admin-800 rounded-full"})],-1)),k(Up,{to:N(f).currentPage.elements,class:ee({"opacity-50 pointer-events-none select-none":!J.value})},{default:pe(()=>[...de[25]||(de[25]=[e("button",{class:"group inline-flex items-center gap-1 text-[11px] text-voix-admin-400 hover:text-voix-admin-700 transition-colors"},[e("span",null,"Add slice"),e("span",{"aria-hidden":"true"},"→")],-1)])]),_:1},8,["to","class"])]),k(N(c),{elements:N(f).currentPage.elements},null,8,["elements"])])])])])):_("",!0),e("div",lm,[N(f).currentPage?(o(),s("button",{key:0,class:"flex items-center gap-1.5 text-[11px] text-voix-admin-500 hover:text-voix-admin-800 transition-colors cursor-pointer",onClick:de[14]||(de[14]=Re=>G.value=!G.value)},[k(Ne,{name:"heroicons:clock",size:"12"}),de[27]||(de[27]=e("span",null,"Release history",-1))])):_("",!0),N(f).currentPage?(o(),se(To,{key:1,"is-drafter":z.value,"draft
13-release":N(f).currentPage.draft_release,release:N(f).currentPage.current_release,label:ie.value,size:"md",onSave:N(Js),onSaveDraft:N(Qs),onDeleteDraft:Y,onExportPage:de[15]||(de[15]=Re=>u("showExportModal"))},null,8,["is-drafter","draft-release","release","label","onSave","onSaveDraft"])):_("",!0)]),N(f).currentPage?_("",!0):(o(),s("div",rm,[...de[28]||(de[28]=[e("div",{class:"p-4 rounded-lg text-voix-admin-400 border-dashed border-2 border-voix-admin-200 text-center text-[10px] uppercase font-semibold tracking-wider"}," Loading the page ",-1)])]))])])}}};async function um(t){return await _e("/api/admin/voix/models")}async function cm(t,n){const i=new URLSearchParams(Object.assign({},n)).toString(),u=`${t.startsWith("/")||t.startsWith("http")?t:`/api/admin/voix/${t}`}?${i.toString()}`;return await _e(u)}const pm={class:"flex flex-col space-y-1"},vm=["onClick"],mm={class:"text-gray-600 group-hover:text-voix-admin-500 font-medium text-sm"},gm={class:"py-2 text-sm border-b border-gray-200 mb-2"},xm={class:""},fm={class:"mt-4 grid grid-cols-2 divide-y divide-gray-100 gap-x-3"},bm={class:"flex space-x-4 items-center font-medium"},hm={class:"flex items-center justify-between py-2"},ym={__name:"DataModelSelector",props:{slice:{type:null,required:!0}},emits:["applySelection","cancelSelection"],setup(t){const n=t,i=/_/g,r=$({data:[]});um().then(ne=>{r.value=Array.isArray(ne)?{data:ne}:ne});const u=$(!1),c=$(null),a=h(()=>c.value?u.value?"selectData":"mapData":"selectModel"),p=$([]),v=$([]),d=$(1),m=$(""),b=$(""),f=$(""),l=$([]),w=$(!1);function x(){c.value=null,u.value=!1,p.value=[],v.value=[],d.value=1,m.value="",b.value="",f.value="",l.value=[],w.value=!1}const L=h(()=>{const ne=[{label:`Select a ${c.value?.label} field`,value:"",key:"null"}];return c.value&&c.value.fields.forEach(G=>{ne.push({label:G.name,value:G.name,key:G.name})}),ne});function j(ne){l.value.push(ne)}const R=h(()=>l.value.length>0),M=h(()=>{const ne=[];return c.value&&c.value.queries?.index&&c.value.fields.forEach(G=>{G.hidden||ne.push({field:G.name,label:G.name.replace(i," "),visible:!0,sortable:!0,searchable:!0})}),ne}),I=h(()=>{let ne="";return c.value&&c.value.queries?.index&&(ne=c.value.queries.index),ne}),F=h(()=>m.value&&b.value?[{column:m.value.toUpperCase(),order:b.value.toUpperCase()}]:[]);we([u,f,F,d],()=>{cm(I.value,{filter:f.value,orderBy:F.value,first:10,page:d.value}).then(ne=>{const G=ne;v.value=Array.isArray(G)?{data:G}:G??{data:[]}})});const V=yt(),H=h(()=>n.slice?.component?V.slices[n.slice.component]:null);function P(ne,G,z){const Y=p.value.find(ie=>ie.element_field===ne.name);if(!z&&Y){p.value.splice(p.value.indexOf(Y),1);return}if(Y){Y.model_field=z,Y.value_type=ne.type;return}Y||p.value.push({model_field:z,value_type:ne.type,element_field:G})}const Q=h(()=>{if(w.value)return f.value;if(R.value){const ne=[],G=[];return l.value.forEach(z=>{G.push(z)}),ne.push({field:"id",op:"",value:G,clause:"whereIn"}),JSON.stringify(ne)}return""}),X=h(()=>({model:c.value?.model||"",query:{filters:Q.value,order_by:JSON.stringify(F.value)},map:p.value}));return(ne,G)=>(o(),s("div",null,[a.value==="selectModel"?(o(),s(le,{key:0},[G[11]||(G[11]=e("div",{class:"text-sm border-b border-gray-200 mb-2"},[e("div",{class:"font-medium text-voix-admin-500"}," Select a Model "),e("div",null," These are databases in your system that you can map data to on the page. Select the database you want to utilize. ")],-1)),e("ul",pm,[(o(!0),s(le,null,fe(r.value.data,(z,Y)=>(o(),s("li",{key:Y},[e("button",{class:"group py-3 px-4 bg-gray-100 hover:bg-voix-admin-50 rounded w-full text-left",onClick:ie=>c.value=z},[e("span",mm,C(z.label),1)],8,vm)]))),128))])],64)):_("",!0),a.value==="mapData"?(o(),s(le,{key:1},[e("div",gm,[G[14]||(G[14]=e("div",{class:"font-medium text-voix-admin-500"}," Map your fields ",-1)),e("div",xm,[G[12]||(G[12]=ce(" The left column represents the fields in your ",-1)),e("strong",null,C(c.value?.label),1),G[13]||(G[13]=ce(". The right are fields in the slice you currently have selected. ",-1))])]),e("div",fm,[(o(!0),s(le,null,fe(H.value?.fields,(z,Y)=>
13(o(),s(le,{key:Y},[e("div",null,[k(Ue,{id:`field-select-${Y}`,options:L.value,onInput:ie=>P(z,Y,ie)},null,8,["id","options","onInput"])]),e("div",bm,[G[15]||(G[15]=e("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"w-4 h-4"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M17.25 8.25L21 12m0 0l-3.75 3.75M21 12H3"})],-1)),e("span",null,C(z.label),1)])],64))),128))])],64)):_("",!0),a.value==="selectData"?(o(),s(le,{key:2},[G[17]||(G[17]=e("div",{class:"py-2 text-sm border-b border-gray-200 mb-2"},[e("div",{class:"font-medium text-voix-admin-500"}," Select your data "),e("div",{class:""}," You can select in three modes: One record at a time, all that you can see, and all that you can filter. ")],-1)),e("div",{class:"-ml-2 -mr-2 -mt-2 -mb-4 bg-gray-100 hover:bg-voix-admin-50"},[e("button",{class:"flex items-center space-x-1.5 p-2",onClick:x},[...G[16]||(G[16]=[e("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"w-5 h-5"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6.75 15.75L3 12m0 0l3.75-3.75M3 12h18"})],-1),e("span",null,"Select a Different Data Model",-1)])])]),k(Io,{items:v.value.data,"onUpdate:items":G[0]||(G[0]=z=>v.value.data=z),page:d.value,"onUpdate:page":G[1]||(G[1]=z=>d.value=z),"sort-column":m.value,"onUpdate:sortColumn":G[2]||(G[2]=z=>m.value=z),"sort-direction":b.value,"onUpdate:sortDirection":G[3]||(G[3]=z=>b.value=z),filters:f.value,"onUpdate:filters":G[4]||(G[4]=z=>f.value=z),"selected-items":l.value,"onUpdate:selectedItems":G[5]||(G[5]=z=>l.value=z),"is-globally-selected":w.value,"onUpdate:isGloballySelected":G[6]||(G[6]=z=>w.value=z),"interaction-mode":"select","can-globally-select-items":!0,columns:M.value,onAddSelectedItem:j},null,8,["items","page","sort-column","sort-direction","filters","selected-items","is-globally-selected","columns"])],64)):_("",!0),e("div",hm,[e("div",null,[a.value==="mapData"?(o(),s("button",{key:0,class:"py-2 px-4 bg-voix-admin-500 hover:bg-voix-admin-500 text-white rounded",onClick:G[7]||(G[7]=z=>u.value=!0)}," Done Mapping ")):_("",!0),w.value&&a.value==="selectData"?(o(),s("button",{key:1,class:"py-2 px-4 bg-voix-admin-500 hover:bg-voix-admin-500 text-white rounded",onClick:G[8]||(G[8]=z=>ne.$emit("applySelection",X.value))}," Apply Filter ")):_("",!0),R.value&&!w.value&&a.value==="selectData"?(o(),s("button",{key:2,class:"py-2 px-4 bg-voix-admin-500 hover:bg-voix-admin-500 text-white rounded",onClick:G[9]||(G[9]=z=>ne.$emit("applySelection",X.value))}," Apply Selection ")):_("",!0)]),e("button",{class:"py-2 px-4 bg-gray-100 hover:bg-red-100 text-gray-500 hover:text-red-600 rounded",onClick:G[10]||(G[10]=z=>ne.$emit("cancelSelection"))}," Cancel Selection ")])]))}},wm={key:0,class:"shrink-0 px-4 py-3.5 flex items-center gap-3 bg-white border-b border-voix-admin-100/70"},km={class:"w-8 h-8 rounded-md bg-linear-to-br from-white to-voix-admin-200/80 ring-1 ring-voix-admin-200/60 text-voix-admin-700 flex items-center justify-center shrink-0"},_m={class:"flex-1 min-w-0"},$m={class:"text-[15px] font-semibold text-voix-admin-900 tracking-tight leading-tight truncate"},Sm={key:0,class:"font-mono text-[11px] text-voix-admin-400 leading-tight truncate"},Cm={class:"flex-1 overflow-y-auto min-h-0"},Pm={class:"shrink-0 border-t border-voix-admin-200/60 bg-white bg-gradient-to-b from-voix-admin-50/60 to-voix-admin-100/70 px-4 py-3 flex items-center gap-2"},Em=["value"],Tm=["value"],Xn=Object.assign({inheritAttrs:!1},{__name:"PropertiesPopupPanel",props:{icon:{type:String,required:!1,default:"heroicons:hashtag"},title:{type:String,required:!1,default:""},subtitle:{type:String,required:!1,default:""}},emits:["close"],setup(t){const n=qe(),i=En("mediaManagerDisplayMode","sidebar"),r=$(!1);return Ht("fullscreen",r),(u,c)=>{const a=Le;return o(),se(vt,{to:"#voix-admin-root"},[e("div",{class:ee({"absolute z-40 flex justify-center items-center":N(i)==="modal"})},[e("div",{class:ee(["duration-200 ease-out bg-white max-h-[90vh] flex flex-col bg-linear-to-br from-voix-admin-50/20 to-voix-admin-500/0 overflow-hidden",[{"fixed z-40 -top-4 right-0 mr-[335px] min-w-[300px] rounded-md shadow-2xl":N(i)==="sidebar","w-fit max-w-[700px]":N(i)==="sidebar"&&!r.value,"shadow-2xl w-[300px] h-[500px]":N(i)==="modal","opacity-0 pointer-events-none":N(i)==="sidebar"&&N(n).isReviewM
13ode,"fixed z-40 inset-0":r.value},u.$attrs.class]])},[t.title?(o(),s("div",wm,[e("div",km,[k(a,{name:t.icon,size:"16"},null,8,["name"])]),e("div",_m,[e("h2",$m,C(t.title),1),t.subtitle?(o(),s("div",Sm,C(t.subtitle),1)):_("",!0)]),e("button",{class:"w-7 h-7 rounded-md flex items-center justify-center text-voix-admin-400 hover:bg-white/80 hover:text-voix-admin-900 transition-colors cursor-pointer",title:"Close",onClick:c[0]||(c[0]=p=>u.$emit("close"))},[k(a,{size:"14",name:"heroicons:x-mark"})])])):_("",!0),e("div",Cm,[ht(u.$slots,"default")]),e("div",Pm,[N(n).pageSegments.length>0?(o(),s("select",{key:0,class:"h-8 border border-voix-admin-200 rounded-md pl-2 pr-7 text-[12px] text-voix-admin-700 bg-white focus:outline-none focus:ring-2 focus:ring-voix-admin-300",value:N(n).activeSegment?.key||"",onChange:c[1]||(c[1]=p=>N(n).setActiveSegment(p.target.value===""?null:N(n).pageSegments.find(v=>v.key===p.target.value)||null))},[c[3]||(c[3]=e("option",{value:""}," Default ",-1)),(o(!0),s(le,null,fe(N(n).pageSegments,p=>(o(),s("option",{key:p.key,value:p.key},C(p.label),9,Tm))),128))],40,Em)):_("",!0),e("button",{class:"ml-auto h-8 px-3 rounded-md text-[12px] font-medium bg-voix-admin-900 text-white hover:bg-voix-admin-800 transition-colors cursor-pointer",onClick:c[2]||(c[2]=p=>u.$emit("close"))}," Done ")])],2)],2)])}}}),Im=["onClick"],xn={__name:"Palette",props:lo({where:{type:String,required:!0},variant:{type:String,required:!1,default:"default"}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(t){const n=t,i=/^#?(?:[a-f0-9]{3}|[a-f0-9]{4}|[a-f0-9]{6}|[a-f0-9]{8})$/i,r=/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/,u=ao(t,"modelValue"),c=wt(),a=Se(),p=h(()=>!c.layouts||!a.currentPage?null:c.layouts[a.currentPage?.layout]),v=h(()=>p.value?.colorPalette?p.value.colors?.[n.where]?.palette&&Object.keys(p.value.colorPalette).length:!1);function d(l){if(m(l)){u.value=l;return}u.value=b(l)}function m(l){return i.test(l)}function b(l){const w=document.createElement("div");w.style.color=l,document.body.appendChild(w);const x=window.getComputedStyle(w).color;document.body.removeChild(w);const L=x.match(r);if(!L)throw new Error("Invalid color name");const j=Number.parseInt(L[1]).toString(16).padStart(2,"0"),R=Number.parseInt(L[2]).toString(16).padStart(2,"0"),M=Number.parseInt(L[3]).toString(16).padStart(2,"0");return`#${j}${R}${M}`}const f=h(()=>p.value?.colorPalette?Object.entries(p.value.colorPalette).reduce((l,[w,x])=>(x[n.where]&&(l[w]=x),l),{}):{});return(l,w)=>v.value&&p.value?(o(),s("ul",{key:0,class:ee(["flex flex-wrap",n.variant==="inline"?"justify-end gap-1.5":""])},[(o(!0),s(le,null,fe(f.value,(x,L)=>(o(),s("li",{key:L,class:ee(n.variant==="inline"?"":"mr-3 mt-3")},[e("button",{class:ee(n.variant==="inline"?"w-4 h-4 rounded-sm ring-1 ring-voix-admin-200/70 hover:ring-voix-admin-400 transition-all":"w-5 h-5 rounded border border-neutral-300"),style:Ee({backgroundColor:L}),onClick:j=>d(L)},null,14,Im)],2))),128))],2)):_("",!0)}},Am={class:"flex items-center space-x-2"},Vm={class:"relative h-4 flex-1 flex items-center"},Rm=["id","value","disabled","min","max","step"],Lm={key:0,class:"rounded-sm bg-gray-200 text-voix-admin-500 py-0.5 px-2 text-2xs font-bold w-10 text-center"},Mm={__name:"RangeInput",props:{id:{type:String,required:!0},modelValue:{type:Number,default:0},min:{type:Number,default:0},max:{type:Number,default:100},step:{type:Number,default:1},label:{type:String,default:null},disabled:{type:Boolean,default:!1},border:{type:Boolean,default:!0},showValue:{type:Boolean,default:!0}},emits:["update:modelValue"],setup(t,{emit:n}){const i=t,r=n,u=$(i.modelValue??0);function c(v){const d=typeof v=="string"?Number.parseFloat(v):v;r("update:modelValue",d)}we(()=>i.modelValue,v=>{u.value=v??0},{immediate:!0});const a=$(null),p=h(()=>((u.value??0)-i.min)/(i.max-i.min)*100);return(v,d)=>(o(),s("div",{class:ee({"opacity-50":i.disabled})},[i.label?(o(),se(zt,{key:0},{default:pe(()=>[ce(C(i.label),1)]),_:1})):_("",!0),e("div",Am,[e("div",Vm,[e("input",{id:i.id,ref_key:"input",ref:a,value:u.value,type:"range",class:"range-input relative z-10 w-full h-2 rounded-full appearance-none cursor-pointer",disabled:i.disabled,min:i.min,max:i.max,step:i.step,style:Ee({background:`linear-gradient(to right, var(--color-voix-admin-400) ${p.value}%, rgb(229 231 235) ${p.value}%)`}),onInput:d[0]||(d[0]=m=>u.value=Number(m.target.value)),onChange:d[1]||(d[1]=m=>c(m.target.value))},null,44,Rm)]),t.showValue?(o(),s("div",Lm,C(u.value),1)):_("",!0)])],2))}},Dm=Je(Mm,[["__scopeId","data-v-4a50f7ee"]]),Fm={key:1,class:"group px-4 py-2.5 flex items-center gap-3 hover:bg-voix-admin-50/60 transition-colors"},jm={key:0,class:"absolute top-1/2 left-0 right-0 h-[2px] bg-red-500 -translate-y-1/2 rotate-45 pointer-events-none"},Om={class:"min-w-0 shrink-0"},zm={class:"text-[12px] text-voix-admin-900 leading-tight"},Um={class:"font-mono text-[10px] text-voix-admin-400 leading-tight truncate"},qm={class:"flex-1 flex items-center justify-end min-w-0"},Nm={key:2,class:"relative flex space-x-2"},Bm={key:0,class:"w-full border-b-4 border-red-600 rotate-45 -translate-y-3.5 pointer-events-none"},Gm={class:"flex space-x-2"},Hm={class:"flex flex-col justify-between"},St=300,Ct=150,Wm={__name:"ColorSelect",props:{modelValue:{type:[String,null],required:!0},label:{type:String,required:!0},where:{type:String,required:!0},variant:{type:String,required:!1,default:"default"}},emits:["update:modelValue"],setup(t,{emit:n}){const i=t,r=n,u=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,c=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,a=wt(),p=Se(),v=h(()=>!a.layouts||!p.currentPage?null:a.layouts[p.currentPage?.layout]),d=h(()=>{const D=v.value?.colors,U=D?.[i.where];return U&&Object.hasOwn(U,"picker")?D?.[i.where].picker:!0}),m=h(()=>v.value?.colorPalette?v.value?.colors?.[i.where]?.palette&&Object.keys(v.value?.colorPalette).length>0:!1),b=$(null),f=$(null),l=xt({isDragging:!1,colorPosition:{x:0,y:0},colorValue:"#ffffff",opacity:1}),w=h({get:()=>i.modelValue?i.modelValue:"",set(D){r("update:modelValue",D)}});function x(){if(!b.value||!f.value)return;f.value.clearRect(0,0,St,Ct);const D=f.value.createLinearGradient(0,0,St,0);D.addColorStop(0,"red"),D.addColorStop(1/7,"orange"),D.addColorStop(2/7,"yellow"),D.addColorStop(3/7,"green"),D.addColorStop(4/7,"cyan"),D.addColorStop(5/7,"blue"),D.addColorStop(6/7,"magenta"),D.addColorStop(1,"red"),f.value.fillStyle=D,f.value.fillRect(0,0,St,Ct);const U=f.value.createLinearGradient(0,0,0,Ct);U.addColorStop(0,"rgba(255, 255, 255, 1)"),U.addColorStop(.05,"rgba(255, 255, 255, 1)"),U.addColorStop(1/3,"rgba(255, 255, 255, 0)"),U.addColorStop(2/3,"rgba(0, 0, 0, 0)"),U.addColorStop(.95,"rgba(0, 0, 0, 1)"),U.addColorStop(1,"rgba(0, 0, 0, 1)"),f.value.fillStyle=U,f.value.fillRect(0,0,St,Ct)}function L(D,U,O=!0,T=!0){if(l.colorPosition.x=D+15,l.colorPosition.y=U+15,!f.value)return;const K=f.value.getImageData(D,U,1,1).data;T&&(l.opacity===1?l.colorValue=I(K[0],K[1],K[2]):l.colorValue=`rgba(${K[0]}, ${K[1]}, ${K[2]}, ${l.opacity})`),O&&T&&r("update:modelValue",l.colorValue)}function j(D){l.isDragging=!0,L(D.offsetX,D.offsetY)}function R(D){l.isDragging&&L(D.offsetX,D.offsetY)}function M(){l.isDragging=!1}function I(D,U,O){return`#${[D,U,O].map(T=>{const K=T.toString(16);return K.length===1?`0${K}`:K}).join("")}`}function F(D){D=D.replace(u,(O,T,K,B)=>T+T+K+K+B+B);const U=c.exec(D);return U?{r:Number.parseInt(U[1],16),g:Number.parseInt(U[2],16),b:Number.parseInt(U[3],16)}:null}function V(){const D=F(l.colorValue);if(!(!D||!f.value))for(let U=0;U<Ct;U++)for(let O=0;O<St;O++){const T=f.value.getImageData(O,U,1,1).data;if(T[0]===D.r&&T[1]===D.g&&T[2]===D.b){l.colorPosition.x=O,l.colorPosition.y=U;return}}}function H(){if(w.value.includes("rgba")){const D=w.value.split("rgba(")[1].split(")")[0].split(", ")[3];l.opacity=Number(D)}else l.opacity=1}ze(()=>{b.value&&(f.value=b.value.getContext("2d"),x()),i.modelValue&&(w.value=i.modelValue),H()});const P=h(()=>({left:`${l.colorPosition.x}px`,top:`${l.colorPosition.y}px`,position:"absolute",width:"20px",height:"20px",borderRadius:"50%",border:"2px s
13olid white",backgroundColor:l.colorValue,transform:"translate(-50%, -50%)"})),Q=$(!1),X=$(""),{x:ne,y:G}=fo(),z=xt({x:0,y:0});function Y(){z.x=ne.value-300,z.y=G.value,H(),i.modelValue&&(X.value=i.modelValue,l.colorValue=i.modelValue),Q.value=!0,A(w.value)}function ie(){r("update:modelValue",l.colorValue),Q.value=!1}function W(){r("update:modelValue",X.value),l.colorValue=X.value,Q.value=!1}const E=Oe();function g(){"EyeDropper"in window?new window.EyeDropper().open().then(U=>{r("update:modelValue",U.sRGBHex)}).catch(()=>{}):E.add("EyeDropper API is not supported in your browser","error")}function y(D,U){return Math.sqrt((D.r-U.r)**2+(D.g-U.g)**2+(D.b-U.b)**2)}function A(D){if(!f.value||!D)return;const U=F(D);if(!U)return;let O=1/0,T={x:0,y:0};const K=2;for(let B=0;B<Ct;B+=K)for(let S=0;S<St;S+=K){const ae=f.value.getImageData(S,B,1,1).data,re={r:ae[0],g:ae[1],b:ae[2]},Me=y(U,re);if(Me<O&&(O=Me,T={x:S,y:B},Me<1))return L(T.x,T.y,!1,!1),T}return L(T.x,T.y,!1,!1),T}function J(D){const U=D.target.value;if(U==="1"){if(l.colorValue.includes("rgb")){const O=l.colorValue.split("rgba(")[1].split(")")[0].split(", ");l.colorValue=I(Number(O[0]),Number(O[1]),Number(O[2]))}}else if(l.colorValue.includes("#")){const O=F(l.colorValue);if(!O)return;l.colorValue=`rgba(${O.r}, ${O.g}, ${O.b}, ${U})`}else if(l.colorValue.includes("rgb")){const O=l.colorValue.split("rgba(")[1].split(")")[0].split(", ");l.colorValue=`rgba(${O[0]}, ${O[1]}, ${O[2]}, ${U})`}r("update:modelValue",l.colorValue)}return we(w,D=>{Q.value&&!l.isDragging&&(l.colorValue=D,A(D))}),(D,U)=>{const O=Le;return m.value||d.value?(o(),s("section",{key:0,class:ee((i.variant==="row",""))},[i.label&&i.variant==="default"?(o(),se(zt,{key:0},{default:pe(()=>[ce(C(i.label),1)]),_:1})):_("",!0),i.variant==="row"?(o(),s("div",Fm,[e("button",{class:ee(["relative w-6 h-6 rounded-md overflow-hidden cursor-pointer shrink-0 ring-1 ring-voix-admin-200/60 hover:ring-voix-admin-300 transition-all",{"ring-2 ring-offset-2 ring-offset-white ring-voix-admin-800 hover:ring-voix-admin-800":!!i.modelValue}]),onClick:Y},[e("div",{class:"w-full h-full pointer-events-none",style:Ee({backgroundColor:i.modelValue||"#ffffff"})},null,4),i.modelValue?_("",!0):(o(),s("div",jm))],2),e("div",Om,[e("div",zm,C(i.label||"Color"),1),e("div",Um,C(i.modelValue||"not set"),1),i.modelValue?(o(),s("button",{key:0,class:"mt-1 text-[10px] text-voix-admin-400 hover:text-voix-admin-700 uppercase tracking-wider transition-colors cursor-pointer leading-none",onClick:U[0]||(U[0]=T=>r("update:modelValue",""))}," Clear ")):_("",!0)]),e("div",qm,[m.value?(o(),se(xn,{key:0,modelValue:w.value,"onUpdate:modelValue":U[1]||(U[1]=T=>w.value=T),where:t.where,variant:"inline"},null,8,["modelValue","where"])):_("",!0)])])):(o(),s("div",Nm,[e("button",{class:"relative w-6 h-6 rounded-full overflow-hidden",onClick:Y},[e("div",{class:"w-6 h-6 rounded-full border border-gray-300 pointer-events-none",style:Ee({backgroundColor:i.modelValue??void 0})},null,4),i.modelValue?_("",!0):(o(),s("div",Bm))]),e("button",{class:"rounded-lg uppercase bg-gray-100 text-gray-400 text-xs font-bold px-2",onClick:U[2]||(U[2]=T=>r("update:modelValue",""))}," Clear ")])),m.value&&i.variant==="default"?(o(),se(xn,{key:3,modelValue:w.value,"onUpdate:modelValue":U[3]||(U[3]=T=>w.value=T),where:t.where},null,8,["modelValue","where"])):_("",!0),(o(),se(vt,{to:"#voix-admin-root"},[ue(e("div",{class:"color-picker text-xs",style:Ee({top:`${z.y+10}px`,left:`${z.x}px`})},[e("div",Gm,[e("div",null,[e("canvas",{ref_key:"canvas",ref:b,onMousedown:j,onMousemove:R,onMouseup:M},null,544),e("div",{class:"indicator",style:Ee(P.value)},null,4),k(pt,{id:"color-picker-hex-value",modelValue:w.value,"onUpdate:modelValue":U[4]||(U[4]=T=>w.value=T),label:"",onInput:V},null,8,["modelValue"]),k(zt,{class:"mt-2"},{default:pe(()=>[...U[6]||(U[6]=[ce(" Opacity ",-1)])]),_:1}),k(Dm,{id:"color-picker-opacity",modelValue:l.opacity,"onUpdate:modelValue":U[5]||(U[5]=T=>l.opacity=T),min:0,max:1,step:.01,onInput:J},null,8,["modelValue"])]),e("div",Hm,[e("div",{class:"space-y-2"},[e("button",{class:"bg-voix-admin-200 text-voix-admin-600 transition-all duration-100 p-3 py-2 rounded-sm w-full",onClick:ie}," Apply "),e("button",{class:"bg-voix-admin-200 text-voix-admin-600 transition-all duration-100 p-3 py-2 rounded-sm w-full",onClick:W}," Cancel ")]),e("button",{class:"p-2.5 px-2 rounded flex items-center justify-center text-xs w-full bg-gray-200 text-gray-500",onClick:g},[k(O,{name:"mdi:eyedropper",size:"16"})])])])],4),[[Et,Q.value]])]))],2)):_("",!0)}}},fn=Je(Wm,[["__scopeId","data-v-5a002ef7"]]),Xm={class:"border-y border-voix-admin-100 divide-y divide-voix-admin-100 bg-white"},nn={__name:"ColorProperties",props:{settings:{type:null,required:!0}},emits:["update"],setup(t,{emit:n}){const i=t,r=n;function u(p){r("update",{...i.settings,...p})}const c=h({get:()=>i.settings.backgroundColor?i.settings.backgroundColor:"",set(p){u({backgroundColor:p})}}),a=h({get:()=>i.settings.color?i.settings.color:"",set(p){u({color:p})}});return(p,v)=>(o(),s("div",null,[v[2]||(v[2]=e("div",{class:"px-4 pt-3 pb-2"},[e("div",{class:"text-[11px] tracking-[0.14em] uppercase font-bold text-voix-admin-900"}," Color ")],-1)),e("div",Xm,[k(fn,{id:"group-background-color-select",modelValue:c.value,"onUpdate:modelValue":v[0]||(v[0]=d=>
13c.value=d),label:"Background",where:"background",variant:"row"},null,8,["modelValue"]),k(fn,{id:"group-text-color-select",modelValue:a.value,"onUpdate:modelValue":v[1]||(v[1]=d=>a.value=d),label:"Text",where:"foreground",variant:"row"},null,8,["modelValue"])])]))}},Ym=At({components:{SectionLabel:zt},inheritAttrs:!1,props:{modelValue:{type:null,required:!0},placeholder:{type:String,default:""},id:{type:String,required:!0},label:{type:String,default:null},disabled:{type:Boolean,default:!1},border:{type:Boolean,default:!0}},setup(t,{emit:n,slots:i}){return{localValue:Ao(t,n),props:t,slots:i}}}),Km={class:"mb-1"},Jm=["id","placeholder","disabled"];function Qm(t,n,i,r,u,c){const a=Ie("SectionLabel");return o(),s("div",{class:ee({"opacity-50":t.props.disabled})},[t.props.label?(o(),se(a,{key:0},{default:pe(()=>[ce(C(t.props.label),1)]),_:1})):_("",!0),e("div",{class:ee(["relative flex items-center pt-1 text-gray-400",{" border border-transparent border-b-gray-200 hover:border-gray-100":t.props.border}])},[e("div",Km,[ht(t.$slots,"default")]),ue(e("input",ro({id:t.props.id,"onUpdate:modelValue":n[0]||(n[0]=p=>t.localValue=p),type:"number",class:["pt-1 pb-1.5 text-xs w-full h-full text-gray-500 bg-transparent placeholder-gray-300 border-b-2 border-transparent focus:border-b-gray-500 focus:outline-0",{"-ml-3 pl-5":t.slots.default,"pl-2":!t.slots.default}],placeholder:t.placeholder,disabled:t.props.disabled},t.$attrs),null,16,Jm),[[$e,t.localValue]])],2)],2)}const Zm=Je(Ym,[["render",Qm]]);function e0(){return{groupDisplayModeOptions:[{label:"Block",value:"block",key:"block"},{label:"Flex",value:"flex",key:"flex"},{label:"Grid",value:"grid",key:"grid"},{label:"Inline",value:"inline",key:"inline"},{label:"Inline Block",value:"inline-block",key:"inline-block"},{label:"Inline Flex",value:"inline-flex",key:"inline-flex"},{label:"Inline Grid",value:"inline-grid",key:"inline-grid"}],flexWrapOptions:[{label:"No Wrap",value:"nowrap",key:"nowrap"},{label:"Wrap",value:"wrap",key:"wrap"},{label:"Wrap Reverse",value:"wrap-reverse",key:"wrap-reverse"}],flexDirectionOptions:[{label:"Row",value:"row",key:"row"},{label:"Row Reverse",value:"row-reverse",key:"row-reverse"},{label:"Column",value:"column",key:"column"},{label:"Column Reverse",value:"column-reverse",key:"column-reverse"}],flexJustifyOptions:[{label:"Start",value:"flex-start",key:"flex-start"},{label:"End",value:"flex-end",key:"flex-end"},{label:"Center",value:"center",key:"center"},{label:"Space Between",value:"space-between",key:"space-between"},{label:"Space Around",value:"space-around",key:"space-around"},{label:"Space Evenly",value:"space-evenly",key:"space-evenly"},{label:"Stretch",value:"stretch",key:"stretch"}],flexAlignOptions:[{label:"Start",value:"flex-start",key:"flex-start"},{label:"End",value:"flex-end",key:"flex-end"},{label:"Center",value:"center",key:"center"},{label:"Baseline",value:"baseline",key:"baseline"},{label:"Stretch",value:"stretch",key:"stretch"}]}}const t0={class:"px-4 pt-3 pb-4"},n0={class:"flex justify-between space-x-4"},o0={key:0},i0={key:0,class:"mt-4"},s0={class:"mt-3 grid grid-cols-4 gap-4"},a0={key:1,class:"mt-4"},l0={class:"mt-3 grid grid-cols-2 gap-4"},r0={class:"mt-4 grid grid-cols-2 gap-4"},Yn={__name:"DisplayModeProperties",props:{settings:{type:null,required:!0}},emits:["update"],setup(t,{emit:n}){const i=t,r=n;function u(V){r("update",{...i.settings,...V})}const{groupDisplayModeOptions:c,flexWrapOptions:a,flexDirectionOptions:p,flexJustifyOptions:v,flexAlignOptions:d}=e0(),m=h({get:()=>i.settings.displayMode==="grid"||i.settings.displayMode==="inline-grid"?i.settings.grid?i.settings.grid:{}:{},set(V){V.columns=V.columns?V.columns:i.settings.grid?.columns||3,u({grid:V})}}),b=h({get:()=>m.value?.columns||3,set(V){m.value={...m.value,columns:V}}}),f=h({get:()=>{const V=m.value?.unifiedGap;return V===void 0?!0:typeof V=="string"?V==="1"||V==="true":!!V},set(V){m.value={...m.value,unifiedGap:V}}}),l=h({get:()=>m.value?.gap?m.value.gap:0,set(V){m.value={...m.value,gap:V}}}),w=h({get:()=>m.value?.gapX?m.value.gapX:0,set(V){m.value={...m.value,gapX:V}}}),x=h({get:()=>m.value?.gapY?m.value.gapY:0,set(V){m.value={...m.value,gapY:V}}}),L=h({get:()=>i.settings.displayMode?i.settings.displayMode:"",set(V){let H={displayMode:V};V==="grid"||V==="inline-grid"?H={...H,grid:{columns:3,gap:10,gapX:0,gapY:0,unifiedGap:!0}}:V==="flex"&&(H={...H,flex:{direction:"row",wrap:"nowrap",justify:"flex-start",align:"stretch"}}),u(H)}}),j=h({get:()=>i.settings.displayMode==="flex"?i.settings.flex?i.settings.flex:{}:{},set(V){u({flex:V})}}),R=h({get:()=>j.value?.direction?j.value.direction:"row",set(V){j.value={...j.value,direction:V}}}),M=h({get:()=>j.value?.wrap?j.value.wrap:"norap",set(V){j.value={...j.value,wrap:V}
13}}),I=h({get:()=>j.value?.justify?j.value.justify:"norap",set(V){j.value={...j.value,justify:V}}}),F=h({get:()=>j.value?.align?j.value.align:"norap",set(V){j.value={...j.value,align:V}}});return(V,H)=>(o(),s("div",t0,[H[10]||(H[10]=e("div",{class:"text-[11px] tracking-[0.14em] uppercase font-bold text-voix-admin-900 mb-3"}," Display ",-1)),e("div",n0,[k(Ue,{id:"display-mode",modelValue:L.value,"onUpdate:modelValue":H[0]||(H[0]=P=>L.value=P),options:N(c),placeholder:"Select a Display Mode",label:"Display Mode",class:"w-full"},null,8,["modelValue","options"]),t.settings.displayMode==="grid"?(o(),s("div",o0,[m.value?(o(),se(Zm,{key:0,id:"group-columns",modelValue:b.value,"onUpdate:modelValue":H[1]||(H[1]=P=>b.value=P),min:"1",step:"1",label:"Columns"},null,8,["modelValue"])):_("",!0)])):_("",!0)]),"displayMode"in t.settings&&"grid"in t.settings&&m.value&&(t.settings.displayMode==="grid"||t.settings.displayMode==="inline-grid")?(o(),s("div",i0,[e("div",s0,[k(pt,{id:"group-gap",modelValue:l.value,"onUpdate:modelValue":H[2]||(H[2]=P=>l.value=P),label:"Gap",disabled:!f.value},null,8,["modelValue","disabled"]),k(pt,{id:"group-gap-x",modelValue:w.value,"onUpdate:modelValue":H[3]||(H[3]=P=>w.value=P),label:"Gap X",disabled:f.value},null,8,["modelValue","disabled"]),k(pt,{id:"group-gap-y",modelValue:x.value,"onUpdate:modelValue":H[4]||(H[4]=P=>x.value=P),label:"Gap Y",disabled:f.value},null,8,["modelValue","disabled"]),k(Un,{modelValue:f.value,"onUpdate:modelValue":H[5]||(H[5]=P=>f.value=P),label:"Unified"},null,8,["modelValue"])])])):_("",!0),t.settings.displayMode==="flex"||t.settings.displayMode==="inline-flex"?(o(),s("div",a0,[e("div",l0,[k(Ue,{id:"flex-direction",modelValue:R.value,"onUpdate:modelValue":H[6]||(H[6]=P=>R.value=P),options:N(p),label:"Flex Direction",class:"w-full"},null,8,["modelValue","options"]),k(Ue,{id:"flex-wrap",modelValue:M.value,"onUpdate:modelValue":H[7]||(H[7]=P=>M.value=P),options:N(a),label:"Flex Wrap",class:"w-full"},null,8,["modelValue","options"])]),e("div",r0,[k(Ue,{id:"flex-justify",modelValue:I.value,"onUpdate:modelValue":H[8]||(H[8]=P=>I.value=P),options:N(v),label:"Flex Justification",class:"w-full"},null,8,["modelValue","options"]),k(Ue,{id:"flex-align",modelValue:F.value,"onUpdate:modelValue":H[9]||(H[9]=P=>F.value=P),options:N(d),label:"Flex Alignment",class:"w-full"},null,8,["modelValue","options"])])])):_("",!0)]))}},d0={class:"px-4 pt-3 pb-2 flex items-center justify-between"},u0={class:"border-y border-voix-admin-100 divide-y divide-voix-admin-100 bg-white"},c0={class:"px-4 py-2.5 flex items-center gap-3"},p0=["value"],v0={class:"px-4 py-2.5 flex items-center gap-3"},m0={class:"flex-1 min-w-0"},g0={class:"flex items-center justify-between"},x0={class:"font-mono text-[10px] text-voix-admin-500"},f0={class:"relative h-4 flex items-center mt-1.5"},b0=["value"],h0={__name:"LayerProperties",props:{settings:{type:null,required:!0}},emits:["update"],setup(t,{emit:n}){const i=t,r=n;function u(f){r("update",{...i.settings,...f})}const c=h({get:()=>typeof i.settings.opacity<"u"?Math.round(i.settings.opacity*100):100,set(f){const l=f/100;u({opacity:l===1?void 0:l})}}),a=h({get:()=>i.settings.zIndex??0,set(f){const l=typeof f=="string"?Number.parseInt(f,10):f;u({zIndex:Number.isNaN(l)?0:l})}}),p=h(()=>typeof i.settings.opacity<"u"&&i.settings.opacity!==1||typeof i.settings.zIndex<"u"&&i.settings.zIndex!==0);function v(){u({opacity:void 0,zIndex:void 0})}function d(f){const l=f.target;a.value=l.value}function m(f){const l=f.target;c.value=Number(l.value)}const b=h(()=>`${c.value}%`);return(f,l)=>(o(),s("div",null,[e("div",d0,[l[0]||(l[0]=e("div",{class:"text-[11px] tracking-[0.14em] uppercase font-bold text-voix-admin-900"}," Layer ",-1)),p.value?(o(),s("button",{key:0,class:"text-[10px] text-voix-admin-400 hover:text-voix-admin-700 uppercase tracking-wider transition-colors cursor-pointer",onClick:v}," Reset ")):_("",!0)]),e("div",u0,[e("div",c0,[l[1]||(l[1]=e("div",{class:"flex-1 min-w-0"},[e("div",{class:"text-[12px] text-voix-admin-900 leading-tight"}," Z-index "),e("div",{class:"font-mono text-[10px] text-voix-admin-400 leading-tight"}," stacking order ")],-1)),e("input",{id:"z-index",type:"number",value:a.value,class:"w-14 h-7 rounded-md border border-voix-admin-200 bg-white font-mono text-[12px] text-voix-admin-900 text-center focus:border-voix-admin-800 focus:outline-none focus:ring-1 focus:ring-voix-admin-800",onInput:d},null,40,p0)]),e("div",v0,[e("div",m0,[e("div",g0,[l[2]||(l[2]=e("div",{class:"text-[12px] text-voix-admin-900 leading-tight"}," Opacity ",-1)),e("span",x0,C(c.value)+"%",1)]),e("div",f0,[e("input",{id:"opacity",type:"range",value:c.value,min:"0",max:"100",step:"1",class:"voix-opacity-slider relative z-10 w-full h-1 rounded-full appearance-none cursor-pointer",style:Ee({background:`linear-gradient(to right, var(--color-voix-admin-800) ${b.value}, var(--color-voix-admin-100) ${b.value})`}),onInput:m},null,44,b0)])])])])]))}},on=Je(h0,[["__scopeId","data-v-3042e5d0"]]),y0={class:"flex items-center justify-center gap-1.5"},w0={class:"flex flex-col items-center gap-1.5"},k0={class:"rounded border border-voix-admin-300/60 p-1.5 flex flex-col items-center gap-1"},_0={class:"flex items-center gap-1"},Dt="w-12 h-5 rounded border border-voix-admin-200 bg-white text-[10px] font-mono text-voix-admin-700 text-center focus:border-voix-admin-800 focus:outline-none focus:ring-1 focus:ring-voix-admin-800 placeholder:text-voix-admin-300",Ft="w-12 h-5 rounded bg-voix-admin-100 text-[10px] font-mono text-voix-admin-700 text-center border-0 focus:bg-white focus:outline-none focus:ring-1 focus:ring-voix-admin-800 placeholder:text-voix-admin-400",$0={__name:"MarginPaddingInput",props:{padding:{type:null,required:!0},margin:{type:null,required:!0}},emits:["update:padding","update:margin"],setup(t,{emit:n}){const i=t,r=n,u=Se(),c=Ke("currentlyManagingMarginsAndPadding",()=>!1),a=$(!1),p=$(!1);
13function v(I){p.value=I,I===!0?(c.value=I,u.setCurrentState("currentlyManagingMarginsAndPadding",I)):a.value||(c.value=I,u.setCurrentState("currentlyManagingMarginsAndPadding",I))}function d(I){a.value=I,I===!0?(c.value=I,u.setCurrentState("currentlyManagingMarginsAndPadding",I)):p.value||(c.value=I,u.setCurrentState("currentlyManagingMarginsAndPadding",I))}const m=dn(i,"padding",r),b=h({get:()=>m.value.top?.toString()??"",set(I){m.value={...m.value,top:I}}}),f=h({get:()=>m.value.right?.toString()??"",set(I){m.value={...m.value,right:I}}}),l=h({get:()=>m.value.bottom?.toString()??"",set(I){m.value={...m.value,bottom:I}}}),w=h({get:()=>m.value.left?.toString()??"",set(I){m.value={...m.value,left:I}}}),x=dn(i,"margin",r),L=h({get:()=>x.value.top?.toString()??"",set(I){x.value={...x.value,top:I}}}),j=h({get:()=>x.value.right?.toString()??"",set(I){x.value={...x.value,right:I}}}),R=h({get:()=>x.value.bottom?.toString()??"",set(I){x.value={...x.value,bottom:I}}}),M=h({get:()=>x.value.left?.toString()??"",set(I){x.value={...x.value,left:I}}});return(I,F)=>(o(),s("div",{class:"rounded-md bg-voix-admin-50 p-4 ring-1 ring-voix-admin-200/60",onMouseenter:F[24]||(F[24]=V=>v(!0)),onMouseleave:F[25]||(F[25]=V=>v(!1))},[e("div",y0,[ue(e("input",{"onUpdate:modelValue":F[0]||(F[0]=V=>M.value=V),type:"text",placeholder:"0",class:ee([Dt,"w-10"]),onFocusin:F[1]||(F[1]=V=>d(!0)),onFocusout:F[2]||(F[2]=V=>d(!1))},null,544),[[$e,M.value]]),e("div",w0,[ue(e("input",{"onUpdate:modelValue":F[3]||(F[3]=V=>L.value=V),type:"text",placeholder:"0",class:ee(Dt),onFocusin:F[4]||(F[4]=V=>d(!0)),onFocusout:F[5]||(F[5]=V=>d(!1))},null,544),[[$e,L.value]]),e("div",k0,[ue(e("input",{"onUpdate:modelValue":F[6]||(F[6]=V=>b.value=V),type:"text",placeholder:"0",class:ee(Ft),onFocusin:F[7]||(F[7]=V=>d(!0)),onFocusout:F[8]||(F[8]=V=>d(!1))},null,544),[[$e,b.value]]),e("div",_0,[ue(e("input",{"onUpdate:modelValue":F[9]||(F[9]=V=>w.value=V),type:"text",placeholder:"0",class:ee([Ft,"w-10"]),onFocusin:F[10]||(F[10]=V=>d(!0)),onFocusout:F[11]||(F[11]=V=>d(!1))},null,544),[[$e,w.value]]),F[26]||(F[26]=e("div",{class:"w-10 h-10 rounded bg-voix-admin-800 text-white text-[9px] font-mono flex items-center justify-center shrink-0"}," slice ",-1)),ue(e("input",{"onUpdate:modelValue":F[12]||(F[12]=V=>f.value=V),type:"text",placeholder:"0",class:ee([Ft,"w-10"]),onFocusin:F[13]||(F[13]=V=>d(!0)),onFocusout:F[14]||(F[14]=V=>d(!1))},null,544),[[$e,f.value]])]),ue(e("input",{"onUpdate:modelValue":F[15]||(F[15]=V=>l.value=V),type:"text",placeholder:"0",class:ee(Ft),onFocusin:F[16]||(F[16]=V=>d(!0)),onFocusout:F[17]||(F[17]=V=>d(!1))},null,544),[[$e,l.value]])]),ue(e("input",{"onUpdate:modelValue":F[18]||(F[18]=V=>R.value=V),type:"text",placeholder:"0",class:ee(Dt),onFocusin:F[19]||(F[19]=V=>d(!0)),onFocusout:F[20]||(F[20]=V=>d(!1))},null,544),[[$e,R.value]])]),ue(e("input",{"onUpdate:modelValue":F[21]||(F[21]=V=>j.value=V),type:"text",placeholder:"0",class:ee([Dt,"w-10"]),onFocusin:F[22]||(F[22]=V=>d(!0)),onFocusout:F[23]||(F[23]=V=>d(!1))},null,544),[[$e,j.value]])]),F[27]||(F[27]=Pn('<div class="mt-3 grid grid-cols-2 gap-2 text-[10px]"><div class="flex items-center gap-1.5"><span class="w-2.5 h-2.5 rounded-sm border border-voix-admin-200 bg-white"></span><span class="text-voix-admin-500 uppercase tracking-wider">margin</span></div><div class="flex items-center gap-1.5"><span class="w-2.5 h-2.5 rounded-sm bg-voix-admin-100"></span><span class="text-voix-admin-500 uppercase tracking-wider">padding</span></div></div>',1))],32))}},S0={class:"px-4 pt-3 pb-4"},C0={class:"flex items-center justify-between mb-2"},sn={__name:"SpacingProperties",props:{settings:{type:null,required:!0}},emits:["update"],setup(t,{emit:n}){const i=t,r=n;function u(d){r("update",{...i.settings,...d})}const c=h({get:()=>i.settings.margin?i.settings.margin:{top:"",right:"",bottom:"",left:""},set(d){u({margin:d})}}),a=h({get:()=>i.settings.padding?i.settings.padding:{top:"",right:"",bottom:"",left:""},set(d){u({padding:d})}}),p=h(()=>!!c.value.top||!!c.value.right||!!c.value.bottom||!!c.value.left||!!a.value.top||!!a.value.right||!!a.value.bottom||!!a.value.left);function v(){u({margin:{top:"",right:"",bottom:"",left:""},padding:{top:"",right:"",bottom:"",left:""}})}return(d,m)=>(o(),s("div",S0,[e("div",C0,[m[2]||(m[2]=e("div",{class:"text-[11px] tracking-[0.14em] uppercase font-bold text-voix-admin-900"}," Spacing ",-1)),p.value?(o(),s("button",{key:0,class:"text-[10px] text-voix-admin-400 hover:text-voix-admin-700 uppercase tracking-wider transition-colors cursor-pointer",onClick:v}," Reset ")):_("",!0)]),k($0,{padding:a.value,"onUpdate:padding":m[0]||(m[0]=b=>a.value=b),margin:c.value,"onUpdate:margin":m[1]||(m[1]=b=>c.value=b)},null,8,["padding","margin"])]))}},P0={class:"px-4 pt-3 pb-3"},E0={class:"flex items-center justify-between mb-2"},T0={class:"font-mono text-[10px] text-voix-admin-400"},I0={class:"flex items-center rounded-md bg-voix-admin-50 p-0.5 ring-1 ring-voix-admin-200/60"}
13,A0=["onClick"],V0={key:0,class:"absolute top-1 right-1 w-1 h-1 rounded-full bg-voix-admin-800"},R0={key:0,class:"px-4 pb-3"},L0={key:1,class:"px-4 pb-4"},an={__name:"BreakpointProperties",props:{settings:{type:Array,required:!1}},emits:["update:settings"],setup(t,{emit:n}){const i=t,r=n,u=h({get:()=>i.settings,set:M=>r("update:settings",M)}),c=Jt(),a=h(()=>c.breakpoints),p=$("default"),v=h(()=>i.settings?.find(M=>M.breakpoint===p.value));function d(M){return!!i.settings?.find(I=>I.breakpoint===M)}function m(M){const I=u.value?[...u.value]:[];I.push({breakpoint:M,padding:{},margin:{}}),r("update:settings",I)}function b(M){if(M){const I=u.value?[...u.value]:[],F=I.findIndex(V=>V.breakpoint===M.breakpoint);I.splice(F,1),r("update:settings",I)}}function f(M){p.value=M}i.settings?.find(M=>M.breakpoint==="default")||m("default"),p.value="default";const l=h(()=>{const M=a.value.find(I=>I.name===p.value);return M?`${M.minWidth}px · ${M.name}`:""}),w=Ke("currentIframeViewers",()=>[]),x=h(()=>w.value[0]),L=h(()=>{if(x.value)return kn(x.value.width)}),j=h(()=>x.value?_n(x.value.width):[]);function R(){if(!j.value.length)return;const I=[...j.value].reverse().find(F=>d(F.name));I&&(p.value=I.name)}return we(L,()=>{R()}),ze(()=>{R()}),(M,I)=>{const F=Le;return o(),s("div",null,[e("div",P0,[e("div",E0,[I[2]||(I[2]=e("div",{class:"text-[11px] tracking-[0.14em] uppercase font-bold text-voix-admin-900"}," Breakpoint ",-1)),e("span",T0,C(l.value),1)]),e("div",I0,[(o(!0),s(le,null,fe(a.value,V=>(o(),s("button",{key:V.name,type:"button",class:ee(["relative flex-1 h-7 rounded text-[11px] font-medium transition-colors cursor-pointer",p.value===V.name?"bg-voix-admin-800 text-white shadow-sm":d(V.name)?"text-voix-admin-800 hover:bg-white":"text-voix-admin-500 hover:text-voix-admin-800 hover:bg-white"]),onClick:H=>f(V.name)},[ce(C(V.name)+" ",1),d(V.name)&&p.value!==V.name?(o(),s("span",V0)):_("",!0)],10,A0))),128))])]),v.value?(o(),s(le,{key:0},[v.value.breakpoint!=="default"?(o(),s("div",R0,[e("button",{class:"h-7 px-2.5 rounded-md flex items-center justify-center gap-1.5 w-full text-[11px] font-medium text-voix-admin-500 bg-voix-admin-50 hover:bg-voix-admin-100 hover:text-voix-admin-900 transition-colors cursor-pointer",onClick:I[0]||(I[0]=V=>b(v.value))},[k(F,{name:"heroicons:x-mark",size:"12"}),ce(" Remove "+C(v.value.breakpoint)+" breakpoint ",1)])])):_("",!0),ht(M.$slots,"default",{breakpoint:v.value})],64)):(o(),s("div",L0,[e("button",{class:"h-8 px-3 rounded-md flex items-center justify-center gap-1.5 w-full text-[11px] font-medium text-voix-admin-700 bg-voix-admin-50 hover:bg-voix-admin-100 hover:text-voix-admin-900 transition-colors cursor-pointer border border-dashed border-voix-admin-200",onClick:I[1]||(I[1]=V=>m(p.value))},[k(F,{name:"heroicons:plus",size:"12"}),ce(" Customize for "+C(p.value),1)])]))])}}},M0={__name:"GroupProperties",props:{elementId:{type:[String,Number],required:!0},groupSettings:{type:Array,required:!1}},emits:["update:groupSettings"],setup(t,{emit:n}){const i=t,r=n,u=h({get:()=>i.groupSettings,set:a=>r("update:groupSettings",a)});function c(a,p){const v=u.value?[...u.value]:[],d=v.findIndex(b=>b.breakpoint===a.breakpoint);v[d]=p,Se().updateElementSettings(i.elementId,v)}return(a,p)=>(o(),se(an,{settings:u.value,"onUpdate:settings":p[0]||(p[0]=v=>u.value=v)},{default:pe(v=>[k(nn,{settings:v.breakpoint,onUpdate:d=>c(v.breakpoint,d)},null,8,["settings","onUpdate"]),k(Yn,{settings:v.breakpoint,onUpdate:d=>c(v.breakpoint,d)},null,8,["settings","onUpdate"]),k(sn,{settings:v.breakpoint,onUpdate:d=>c(v.breakpoint,d)},null,8,["settings","onUpdate"]),k(on,{settings:v.breakpoint,onUpdate:d=>c(v.breakpoint,d)},null,8,["settings","onUpdate"])]),_:1},8,["settings"]))}},D0={__name:"QueryProperties",props:{querySettings:{type:Array,required:!1}},emits:["update:querySettings"],setup(t,{emit:n}){const i=t,r=n,u=h({get:()=>i.querySettings,set:a=>r("update:querySettings",a)});function c(a,p){const v=u.value?u.value:[],d=v.findIndex(m=>m.breakpoint===a.breakpoint);v[d]=p,r("update:querySettings",v)}return(a,p)=>(o(),se(an,{settings:u.value,"onUpdate:settings":p[0]||(p[0]=v=>u.value=v)},{default:pe(v=>[k(nn,{settings:v.breakpoint,onUpdate:d=>c(v.breakpoint,d)},null,8,["settings","onUpdate"]),k(Yn,{settings:v.breakpoint,onUpdate:d=>c(v.breakpoint,d)},null,8,["settings","onUpdate"]),k(sn,{settings:v.breakpoint,onUpdate:d=>c(v.breakpoint,d)},null,8,["settings","onUpdate"]),k(on,{settings:v.breakpoint,onUpdate:d=>c(v.breakpoint,d)},null,8,["settings","onUpdate"])]),_:1},8,["settings"]))}},F0={__name:"SliceProperties",props:{elementId:{type:[String,Number],required:!0},sliceSettings:{type:Array,required:!1}},setup(t){const n=t;function i(c){Se().updateElementSettings(n.elementId.toString(),c)}const r=h({get:()=>n.sliceSettings,set:c=>{c&&i(c)}});function u(c,a){const p=r.value?[...r.value]:[],v=p.findIndex(d=>d.breakpoint===c.breakpoint);p[v]=a,i(p)}return(c,a)=>(o(),se(an,{settings:r.value,"onUpdate:settings":a[0]||(a[0]=p=>r.value=p)},{default:pe(p=>[k(nn,{settings:p.breakpoint,onUpdate:v=>u(p.breakpoint,v)},null,8,["settings","onUpdate"]),k(sn,{settings:p.breakpoint,onUpdate:v=>u(p.breakpoint,v)},null,8,["settings","onUpdate"]),k(on,{settings:p.breakpoint,onUpdate:v=>u(p.breakpoint,v)},null,8,["settings","onUpdate"])]),_:1},8,["settings"]))}},j0={key:0,class:"space-y-4"},O0={__name:"GlobalFieldGroup",props:{element:{type:Object,required:!0},group:{type:Object,default:null}},setup(t){const n=t;function i(r,u){return n.element&&u.type?n.element.fields?.find(a=>a.name===r):null}return(r,u)=>Object.keys(t.group).length>0?(o(),s("div",j0,[(o(!0),s(le,null,fe(t.group,(c,a)=>
13(o(),se(Nt,{key:a,element:t.element,"field-data":i(a,c),"field-configuration":c},null,8,["element","field-data","field-configuration"]))),128))])):_("",!0)}},z0={class:"truncate select-none text-xs"},U0={__name:"PageNavigationFieldGroup",props:{slice:{type:Object,required:!0},group:{type:Object,required:!0}},emits:["selectElement"],setup(t){const n=t,i=qe();function r(){const a=Object.assign({},n.group);Object.keys(a).forEach(p=>{const v=a[p];a[p]=Object.assign({},v,{name:p})}),i.toggleSelectGroup(n.slice,a)}const u=h(()=>i.selectedFieldSlice&&i.selectedFieldSlice===n.slice&&i.selectedGroup&&i.selectedGroup===n.group),c=h(()=>Object.values(n.group)[0].group);return(a,p)=>{const v=Le;return o(),s("div",null,[e("button",{class:"w-full outline-none",onClick:je(r,["left","exact","stop"])},[e("div",{class:ee(["w-full flex space-x-1 items-center py-2.5 px-4 transition-colors duration-200",[{"bg-voix-admin-200 text-voix-admin-950":u.value,"text-voix-admin-500 hover:text-voix-admin-950":!u.value}]])},[k(v,{name:"heroicons:rectangle-group-20-solid",size:"16"}),e("div",z0,C(c.value),1)],2)])])}}},q0={text:xe(async()=>ge(()=>import("./Bd2za2Iw.js"),__vite__mapDeps([86,61,2,3,4,5,24,25,26,27,20,28,34,62,63,7,31,15,21,16,32,33,45,46,47,48,49,10,50,8,14,64,12,13,17,18,19,22,23,29,30,35,36,37,38,39,40,41,42,43,44,1,6,9,11,51,52,53,54,55,56,57,58,59,60,65,66,67,68]),import.meta.url)),number:xe(async()=>ge(()=>import("./CIJRsord.js"),__vite__mapDeps([87,3,12,13,2,4,5,14,15,16,17,18,19,20,22,23,24,25,26,27,28,29,30,31,21,32,33,34,7,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,10,50,1,6,8,9,11,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68]),import.meta.url)),textarea:xe(async()=>ge(()=>import("./BSKnD9WB.js"),__vite__mapDeps([88,61,2,3,4,5,24,25,26,27,20,28,34,62,63,7,31,15,21,16,32,33,45,46,47,48,49,10,50,8,14,64,12,13,17,18,19,22,23,29,30,35,36,37,38,39,40,41,42,43,44,1,6,9,11,51,52,53,54,55,56,57,58,59,60,65,66,67,68]),import.meta.url)),media:xe(async()=>ge(()=>import("./DlH4dmoe.js"),__vite__mapDeps([89,3,12,13,2,4,5,14,15,16,17,18,19,20,45,46,47,48,49,10,7,50,1,6,8,9,11,31,21,32,33,22,23,24,25,26,27,28,29,30,34,35,36,37,38,39,40,41,42,43,44,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,90]),import.meta.url)),wysiwyg:xe(async()=>ge(()=>import("./DX_Ze6nC.js"),__vite__mapDeps([91,2,3,4,5,14,15,16,61,24,25,26,27,20,28,34,62,63,7,31,21,32,33,45,46,47,48,49,10,50,8,64,12,13,17,18,19,22,23,29,30,35,36,37,38,39,40,41,42,43,44,1,6,9,11,51,52,53,54,55,56,57,58,59,60,65,66,67,68]),import.meta.url)),select:xe(async()=>ge(()=>import("./Bf0SV2xR.js"),__vite__mapDeps([92,2,3,4,5,31,15,21,16,32,33,12,13,14,17,18,19,20,22,23,24,25,26,27,28,29,30,34,7,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,10,50,1,6,8,9,11,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68]),import.meta.url)),checkbox:xe(async()=>ge(()=>import("./Bql5vTWA.js"),__vite__mapDeps([93,14,15,3,2,4,5,16,12,13,17,18,19,20,22,23,24,25,26,27,28,29,30,31,21,32,33,34,7,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,10,50,1,6,8,9,11,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68]),import.meta.url)),link:xe(async()=>ge(()=>import("./CxJYGfdt.js"),__vite__mapDeps([94,31,2,3,4,5,15,21,16,32,33,14,54,12,13,37,38,24,25,26,27,20,28,39,17,18,19,95,22,23,29,30,34,7,35,36,40,41,42,43,44,45,46,47,48,49,10,50,1,6,8,9,11,51,52,53,55,56,57,58,59,60,61,62,63,64,65,66,67,68]),import.meta.url)),datetime:xe(async()=>ge(()=>import("./DsV704Ac.js"),__vite__mapDeps([96,15,3,2,4,5,12,13,14,16,17,18,19,20,97,22,23,24,25,26,27,28,29,30,31,21,32,33,34,7,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,10,50,1,6,8,9,11,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68]),import.meta.url)),color:xe(async()=>ge(()=>import("./CoP4L1Z1.js"),__vite__mapDeps([98,12,3,13,2,4,5,14,15,16,17,18,19,20,22,23,24,25,26,27,28,29,30,31,21,32,33,34,7,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,10,50,1,6,8,9,11,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68]),import.meta.url)),files:xe(async()=>ge(()=>import("./CCRYpa1v.js"),__vite__mapDeps([99,2,3,4,5,31,15,21,16,32,33,58,59,12,13,14,45,46,47,48,49,10,7,50,17,18,19,20,22,23,24,25,26,27,28,29,30,34,35,36,37,38,39,40,41,42,43,44,1,6,8,9,11,51,52,53,54,55,56,57,60,61,62,63,64,65,66,67,68]),import.meta.url)),collection:xe(async()=>ge(()=>import("./yJvzLjmX.js"),__vite__mapDeps([100,2,3,4,5,58,59,24,25,26,27,20,28,12,43,17,18,19,22,15,23,29,30,31,21,16,32,33,34,7,35,36,37,38,39,40,41,42,44,45,46,47,48,49,10,50,1,6,8,9,11,51,52,53,54,55,56,57,60,14,61,62,63,64,65,66,67,68]),import.meta.url)),event:xe(async()=>ge(()=>import("./C4DL7S0g.js"),__vite__mapDeps([101,31,2,3,4,5,15,21,16,32,33,12,13,14,37,38,24,25,26,27,20,28,39,17,18,19,95,22,23,29,30,34,7,35,36,40,41,42,43,44,45,46,47,48,49,10,50,1,6,8,9,11,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68]),import.meta.url)),form:xe(async()=>ge(()=>import("./D_S87WtP.js"),__vite__mapDeps([102,3,12,13,2,4,5,14,15,16,17,18,19,20,22,23,24,25,26,27,28,29,30,31,21,32,33,34,7,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,10,50,1,6,8,9,11,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68]),import.meta.url))},N0={text:xe(async()=>ge(()=>import("./B2yH2K1W.js"),__vite__mapDeps([106,2,3,4,5]),import.meta.url)),number:xe(async()=>ge(()=>import("./Dqhp0rFF.js"),__vite__mapDeps([107,2,3,4,5]),import.meta.url)),textarea:xe(async()=>ge(()=>import("./CCHjiDyj.js"),__vite__mapDeps([108,2,3,4,5]),import.meta.url)),media:xe(async()=>ge(()=>import("./BRRjjyFL.js"),__vite__mapDeps([109,2,3,4,5]),import.meta.url)),wysiwyg:xe(async()=>ge(()=>import("./D8VimYFM.js"),__vite__mapDeps([110,2,3,4,5]),import.meta.url)),select:xe(async()=>ge(()=>import("./DlF5TF1O.js"),__vite__mapDeps([111,2,3,4,5]),import.meta.url)),checkbox:xe(async()=>ge(()=>import("./EpbhEQDJ.js"),__vite__mapDeps([112,2,3,4,5]),import.meta.url)),link:xe(async()=>ge(()=>import("./CcfgYqHS.js"),__vite__mapDeps([113,2,3,4,5]),import.meta.url)),datetime:xe(async()=>ge(()=>import("./JSU7MQGC.js"),__vite__mapDeps([114,2,3,4,5]),import.meta.url)),color:xe(async()=>ge(()=>import("./BHWDdjA0.js"),__vite__mapDeps([115,2,3,4,5]),import.meta.url)),files:xe(async()=>ge(()=>import("./C8RvvILk.js"),__vite__mapDeps([116,2,3,4,5]),import.meta.url)),collection:xe(async()=>ge(()=>import("./BmncUh0D.js"),__vite__mapDeps([117,2,3,4,5]),import.meta.url)),event:xe(async()=>ge(()=>import("./CP9F0n-J.js"),__vite__mapDeps([118,2,3,4,5]),import.meta.url)),form:xe(async()=>ge(()=>import("./D4kCUfve.js"),__vite__mapDeps([119,2,3,4,5]),import.meta.url))};function B0(){const n=Tt()?.public?.voix?.options?.fieldTypes??[],i={},r={};for(const u of n){const c=u.name;u.builtIn||(i[c]=xe(async()=>ge(()=>import(`@/fields/${c}/Editor.vue`),[],import.meta.url)),r[c]=xe(async()=>ge(()=>import(`@/fields/${c}/Icon.vue`),[],import.meta.url)))}return{editors:{...q0,...i},icons:{...N0,...r}}}const G0={class:"-ml-0.5 mr-1.5 flex-none"},Kn={__name:"FieldIcon",props:{type:{type:String,required:!0}},setup(t){const n=t,{icons:i}=B0(),r=h(()=>i[n.type]);return(u,c)=>(o(),s("div",G0,[r.value?(o(),se(Sn(r.value),{key:0,class:"w-4 h-4"})):_("",!0)]))}},H0=["src","alt"],W0={key:0,class:"absolute bottom-full left-1/2 -translate-x-1/2 mb-1 bg-voix-admin-800 text-white text-[10px] rounded px-1.5 py-0.5 whitespace-nowrap z-50 shadow-lg pointer-events-none"},X0={__name:"UserPresenceAvatar",props:{user:{type:Object,required:!0},size:{type:String,required:!1,default:"md"},showTooltip:{type:Boolean,required:!1,default:!0}},setup(t){const n=t,i=/\s+/,r=$(!1),u=h(()=>n.size==="sm"?"w-4 h-4 text-[6px]":"w-4 h-4 text-[8px]"),c=h(()=>!!n.user.profilePicture);function a(v){const d=v.trim().split(i),m=d[0],b=d.at(-1);if(d.length>=2&&m&&b){const f=m.charAt(0),l=b.charAt(0);return(f+l).toUpperCase()}return v.slice(0,2).toUpperCase()}function p(v){const d=(v||"#4f46e5").replace("#","");if(d.length!==6)return"#ffffff";const m=l=>Number.parseInt(d.slice(l,l+2),16)/255,b=l=>l<=.03928?l/12.92:((l+.055)/1.055)**2.4;return .2126*b(m(0))+.7152*b(m(2))+.0722*b(m(4))>.5?"#0f172a":"#ffffff"}return(v,d)=>(o(),s("div",{class:"relative inline-flex",onMouseenter:d[0]||(d[0]=m=>r.value=!0),onMouseleave:d[1]||(d[1]=m=>r.value=!1)},[e("div",{class:ee(["rounded-full flex items-center justify-center font-medium border border-white shadow-sm flex-shrink-0 overflow-hidden",u.value]),style:Ee({backgroundColor:n.user.color||"#4f46e5"})},[c.value?(o(),s("img",{key:0,src:n.user.profilePicture,alt:n.user.n
13ame,class:"w-full h-full object-cover"},null,8,H0)):(o(),s("span",{key:1,style:Ee({color:p(n.user.color)})},C(a(n.user.name)),5))],6),k(Ot,{"enter-active-class":"transition duration-150 ease-out","enter-from-class":"opacity-0 translate-y-1","enter-to-class":"opacity-100 translate-y-0","leave-active-class":"transition duration-100 ease-in","leave-from-class":"opacity-100 translate-y-0","leave-to-class":"opacity-0 translate-y-1"},{default:pe(()=>[t.showTooltip&&r.value?(o(),s("div",W0,C(n.user.name),1)):_("",!0)]),_:1})],32))}},Y0=At({components:{FieldIcon:Kn,UserPresenceAvatar:X0},props:{slice:{type:Object,required:!0},fieldName:{type:String,required:!0},fieldData:{type:Object,default:{}},fieldConfiguration:{type:Object,required:!0}},emits:["selectElement"],setup(t){const n=qe(),i=Ro(),r=p=>{const v=Object.assign({},p,{name:t.fieldName});n.toggleSelectField(t.slice,v)},u=h(()=>n.selectedFieldSlice&&n.selectedFieldSlice===t.slice&&n.selectedField&&n.selectedField.label===t.fieldConfiguration.label),c=h(()=>{if(n.pageSegments.length===0||!t.fieldData?.segmentedValues)return[];const p=new Set;if(Array.isArray(t.fieldData.segmentedValues))for(const v of t.fieldData.segmentedValues)p.add(v.segment_key);return n.pageSegments.filter(v=>p.has(v.key))}),a=h(()=>{const p=`${t.slice.id}:${t.fieldName}`;for(const v of i.otherUsers)if(v.selectedFieldPath===p)return v});return{adminStore:n,props:t,selectField:r,fieldIsSelected:u,otherUserSelectingField:a,fieldSegmentDots:c}}}),K0=["data-testid"],J0={class:"flex items-center flex-1 min-w-0"},Q0={class:"truncate select-none text-xs"},Z0={key:0,class:"flex items-center ml-1.5 space-x-0.5"},eg=["title"];function tg(t,n,i,r,u,c){const a=Ie("FieldIcon"),p=Ie("UserPresenceAvatar");return o(),s("div",null,[e("button",{class:"w-full outline-none","data-testid":`page-navigation-field-button-${t.props.fieldConfiguration.type}`,onClick:n[0]||(n[0]=je(v=>t.selectField(t.props.fieldConfiguration),["left","exact","stop"]))},[e("div",{class:ee(["w-full flex items-center justify-between py-2.5 px-4 transition-colors duration-200",[{"bg-voix-admin-200 text-voix-admin-950":t.fieldIsSelected,"text-voix-admin-500 hover:text-voix-admin-950":!t.fieldIsSelected}]])},[e("div",J0,[k(a,{type:t.props.fieldConfiguration.type},null,8,["type"]),e("div",Q0,C(t.props.fieldConfiguration.label),1),t.fieldSegmentDots.length>0?(o(),s("div",Z0,[(o(!0),s(le,null,fe(t.fieldSegmentDots,v=>(o(),s("span",{key:v.key,class:"inline-block w-1.5 h-1.5 rounded-full shrink-0",style:Ee({backgroundColor:v.color}),title:v.label},null,12,eg))),128))])):_("",!0)]),t.otherUserSelectingField?(o(),se(p,{key:0,user:t.otherUserSelectingField,size:"sm",class:"ml-2 flex-shrink-0"},null,8,["user"])):_("",!0)],2)],8,K0)])}const ng=Je(Y0,[["render",tg]]),og=["aria-expanded"],ig={class:"flex items-center shrink-0"},sg=["title"],ag={class:"p-4 space-y-4"},lg={key:0,class:"rounded-md border border-voix-admin-200 bg-voix-admin-50 px-3 py-2 text-[11px] text-voix-admin-600"},rg={key:1,class:"text-[11px] text-voix-admin-400"},dg={key:0,class:"text-[11px] text-voix-admin-400"},ug=["data-testid"],cg={class:"px-3 pt-2.5 pb-2 border-b border-voix-admin-100"},pg={class:"text-[12px] font-semibold text-voix-admin-800"},vg={class:"mt-0.5 text-[11px] leading-relaxed text-voix-admin-400"},mg={class:"px-3 py-3 space-y-3"},gg={key:0,class:"mt-1 flex items-center gap-1 rounded bg-amber-50 px-2 py-1 text-[11px] text-amber-700"},xg={__name:"SliceEventTrackingField",props:{element:{type:null,required:!0}},setup(t){const n=t,i=qe(),r=Lo(),u=Oe(),{hasAnalyticsPermission:c}=Mn(),a=qt(),p=en(),v=h(()=>Mo(r.get(Fo,!1))===!0),d=h(()=>n.element?.type==="slice"&&c&&v.value),m=h(()=>{const z=Number(n.element?.id);return Number.isInteger(z)&&z>0?z:null}),b=$(!1),f=$(!1),l=$(!1),w=$(null),x=$([]);function L(z){return Do(x.value,z)}function j(z){const Y=L(z)?.event_id;return Y?(a.events.data||[]).find(ie=>ie.id===Y)??null:null}function R(z){const Y=j(z);return!!Y&&!Y.is_active}const M=h(()=>cn.map(z=>{const Y=L(z.key);return Y?.event_name?`${z.shortLabel}: ${Y.event_name}`:null}).filter(z=>z!==null).join(" · ")),I=h(()=>[{label:"None",value:"",key:"event-none"},...(a.events.data||[]).filter(z=>z.is_active).map(z=>({label:z.name,value:z.id,key:`event-${z.id}`}))]),F=h(()=>I.value.length>1),V=h(()=>[{label:"None",value:"",key:"campaign-none"},...(p.campaigns.data||[]).map(z=>({label:z.name,value:z.id,key:`campaign-${z.id}`}))]);function H(){const z=ln(n.element);z.element_trackings=[...ln(x.value)]}async function P(){if(!(!m.value||l.value)){f.value=!0;try{const[,,z]=await Promise.all([Nn({filter:"",orderBy:[],first:100,page:1}),Vn({filter:"",orderBy:[],first:100,page:1}),ll(m.value)]);x.value=Array.isArray(z)?z:z?.data||[],H(),l.value=!0}catch{x.value=[]}finally{f.value=!1}}}ze(async()=>{await r.ensureLoaded(),d.value&&await P()}),we(d,z=>{z?P():b.value=!1});function Q(){if(b.value){b.value=!1;return}i.unselectField(),i.unselectGroup(),b.value=!0}we(()=>[i.selectedField?.name,Object.keys(i.selectedGroup).length],([z,Y])=>{(z||Y>0)&&(b.value=!1)});async function X(z,Y){if(!m.value||w.value)return;w.value=z;const ie=L(z),W={element_id:m.value,field_key:jo(z),...Y};try{if(!Y.event_id&&!Y.campaign_id)ie?.id&&(await ul(ie.id),x.value=x.value.filter(E=>E.id!==ie.id));else if(ie?.id){const E=await dl(ie.id,W),g=x.value.findIndex(y=>y.id===ie.id);g>=0&&(x.value[g]=E)}else{const E=await rl(W);x.value.push(E)}H()}catch(E){u.add(E instanceof Error?E.message:"Unable to save event tracking","error")}finally{w.value=null}}async function ne(z,Y){await X(z,{event_id:Y?Number(Y):null,campaign_id:L(z)?.campaign_id??null})}async function G(z,Y){await X(z,{event_id:L(z)?.event_id??null,campaign_id:Y?Number(Y):null})}return(z,Y)=>{const ie=Le;
13return d.value?(o(),s(le,{key:0},[e("button",{class:"w-full outline-none","data-testid":"slice-event-tracking-button","aria-expanded":b.value,onClick:je(Q,["left","exact","stop"])},[e("div",{class:ee(["w-full flex items-center justify-between py-2.5 px-4 transition-colors duration-200",b.value?"bg-voix-admin-200 text-voix-admin-950":"text-voix-admin-500 hover:text-voix-admin-950"])},[e("div",ig,[k(Kn,{type:"event"}),Y[1]||(Y[1]=e("div",{class:"select-none text-xs whitespace-nowrap"}," Engagement Tracking ",-1))]),M.value?(o(),s("div",{key:0,class:"ml-3 flex-1 min-w-0 truncate text-right text-[11px] text-voix-admin-400",title:M.value,"data-testid":"slice-event-tracking-summary"},C(M.value),9,sg)):_("",!0)],2)],8,og),b.value?(o(),se(Xn,{key:0,icon:"heroicons:bolt",title:"Engagement Tracking",subtitle:t.element.component||"slice",class:"min-w-[420px] text-xs text-gray-500 mt-8",onClose:Y[0]||(Y[0]=W=>b.value=!1)},{default:pe(()=>[e("div",ag,[Y[4]||(Y[4]=e("p",{class:"text-[11px] leading-relaxed text-voix-admin-400"}," Fire analytics events when visitors engage with this slice. Each trigger has its own event, so one slice can report both impressions and clicks. ",-1)),m.value?f.value?(o(),s("div",rg," Loading events and campaigns… ")):(o(),s(le,{key:2},[F.value?_("",!0):(o(),s("p",dg," No active events yet. Create one under Analytics ▸ Events. ")),(o(!0),s(le,null,fe(N(cn),W=>(o(),s("section",{key:W.key,class:"rounded-md border border-voix-admin-200 bg-white","data-testid":`slice-event-tracking-${W.key}`},[e("header",cg,[e("h3",pg,C(W.label),1),e("p",vg,C(W.description),1)]),e("div",mg,[e("div",null,[k(Ue,{id:`slice-event-tracking-event-${W.key}`,label:"Event",placeholder:"","model-value":L(W.key)?.event_id??"",options:I.value,disabled:w.value!==null,"onUpdate:modelValue":E=>ne(W.key,E)},null,8,["id","model-value","options","disabled","onUpdate:modelValue"]),R(W.key)?(o(),s("div",gg,[k(ie,{name:"heroicons:exclamation-triangle",size:"12"}),Y[2]||(Y[2]=ce(" Selected event is expired or inactive ",-1))])):_("",!0)]),k(Ue,{id:`slice-event-tracking-campaign-${W.key}`,label:"Campaign",placeholder:"","model-value":L(W.key)?.campaign_id??"",options:V.value,disabled:w.value!==null,"onUpdate:modelValue":E=>G(W.key,E)},null,8,["id","model-value","options","disabled","onUpdate:modelValue"])])],8,ug))),128)),Y[3]||(Y[3]=e("p",{class:"text-[11px] text-voix-admin-400"}," A campaign assigned to the page always wins over the ones chosen here. ",-1))],64)):(o(),s("div",lg," Save the page first. Event tracking attaches to the saved slice. "))])]),_:1},8,["subtitle"])):_("",!0)],64)):_("",!0)}}},fg={key:0},bg={class:"border-y border-voix-admin-100 divide-y divide-voix-admin-100 bg-white"},hg={key:0,class:"p-3"},yg={__name:"FieldPropertyEditors",props:{element:{type:Object,required:!0}},emits:["showContentWizard"],setup(t,{emit:n}){const i=t,r=n,u=Tt(),c=yt(),a=h(()=>i.element.component?c.slices[i.element.component]:void 0);function p(b){if(i&&i.element&&i.element.type==="slice"&&i.element.fields&&b.name)return i.element.fields[b.name]}function v(){r("showContentWizard")}const d=[];function m(b){const f={},l=a.value?.fields??{};for(const[w,x]of Object.entries(l))x.group===b&&(f[w]=x);return d.push(b),f}return(b,f)=>{const l=Le;return t.element&&t.element.type==="slice"&&a.value&&a.value.fields?(o(),s("div",fg,[e("div",bg,[(o(!0),s(le,null,fe(a.value.fields,(w,x)=>(o(),s(le,{key:x},[w.group&&!d.includes(w.group)?(o(),se(U0,{key:0,slice:i.element,group:m(w.group)},null,8,["slice","group"])):!w.group&&w?(o(),se(ng,{key:1,slice:i.element,"field-name":x.toString(),"field-data":p(w),"field-configuration":w},null,8,["slice","field-name","field-data","field-configuration"])):_("",!0)],64))),128)),k(xg,{element:i.element},null,8,["element"])]),N(u).public.voixAIContentGeneratorEnabled?(o(),s("div",hg,[e("button",{class:"px-3 py-2.5 rounded-md flex items-center justify-center gap-2 text-xs font-medium w-full bg-voix-admin-800 text-white hover:bg-voix-admin-900 transition-colors cursor-pointer",onClick:v},[k(l,{name:"heroicons:sparkles",size:"14"}),f[0]||(f[0]=ce(" Fill with Content ",-1))])])):_("",!0)])):_("",!0)}}},wg=/&/g,kg=/</g,_g=/>/g,$g=At({components:{TextAreaInput:mo,TextInput:pt,DropdownSelect:Ue,FieldPropertyEditors:yg,GroupProperties:M0,QueryProperties:D0,SliceProperties:F0,GlobalField:Nt,GlobalFieldGroup:O0,PropertiesPopupPanel:Xn,DataModelSelector:ym,SwitchInput:Un,LoadingAnimation:vo,SlideoutSection:Ve,VoixModal:ct,WysiwygEditor:Vo},setup(){const t=qe(),n=Se(),i=no(),r=Ke("currentlySelectedElements",()=>[]),u=h(()=>
13{if(r.value.length===1){const ve=r.value[0];if(ve?.id){const be=n.findElement(ve.id);if(be)return be.element}}return null}),c=h(()=>{if(r.value.length===1){const ve=r.value[0];if(ve?.id){const be=n.findElement(ve.id);if(be)return be.parentElement}}return null}),a=()=>{r.value=[]},p=()=>{t.unselectField(),t.unselectGroup()},v=$(!1),d=ve=>{u.value&&(n.updateSliceModelQuery(u.value,ve),v.value=!1)},m=()=>{v.value=!1},b=$(!1),f=$(!1),l=()=>{u.value&&(t.scrollToElement=u.value)},w=()=>{u.value&&n.duplicateElement(u.value.id)},x=()=>{u.value&&(n.deleteElement(u.value.id),a())},L=h(()=>{let ve="";return u.value&&(ve=`
14        <div class="grid grid-cols-2">
15          <span>Component: </span><span class="font-voix-mono">${u.value.component}</span>
16          <span>Type: </span><span class="font-voix-mono">${u.value.type}</span>
17          <span>ID: </span><span class="font-voix-mono">${u.value.id}</span>
18        </div>
19        `),ve}),j=h(()=>{const ve=[{name:"Load",description:"Load will load the component server side and then rehydrate the component on the client-side as soon as it can.",uses:["Interactive slices (Javascript) that need to be ready right away","Pages with less resources being used"]},{name:"Idle  (Default)",description:"Load will load the component server side and then rehydrate the component on the client-side once everything has been downloaded.",uses:["Interactive slices (Javascript) that can wait 1 - 2 seconds before they are ready to be interactive"]},{name:"Visible",description:"Renders the slice server side, then hydrates it when it scrolls into view. Image and video content below the fold does not load until the slice is scrolled into view — text content stays fully crawlable.",uses:["Interactive slices (Javascript) that can wait to be interactive until the user scrolls to it.","Media-heavy slices below the fold — images and videos only download when scrolled into view.","Still visible by crawlers (text content; media is withheld until scroll)."]},{name:"On Mouse Over",description:"Renders the slice server side, then hydrates it the first time the user mouses over it.",uses:["Interactive slices (Javascript) that only need to work once the user engages with them (menus, hover cards, carousels)."]},{name:"SSR Only",description:'The slice will only be built on the serverside and isnt interactive on the client side. <span class="italic">(<span class="font-bold">Note:</span> SSR will only work outside of the editor.)</span>',uses:["A non-interactive slice that is only used to display data, links, content, or other non-interactive elements."]},{name:"Client Only",description:"The slice is only viewable on the client side and is not rendered on the server side.",uses:["Requires a browser to render the slice.","Requires a user session to render the slice.","Crawling robots may not be able to see this content."]},{name:"Client Only When Visible",description:"Nothing is rendered on the server. Below the fold, the entire slice content — markup, images, and videos — does not load until the slice scrolls near the viewport.",uses:["Heavy slices below the fold where nothing should load (or run) until the user gets there.","Session or personalized content that requires the browser anyway.","Crawling robots will not see this content."]}];let be=`
20        <div class="grid grid-cols-12 gap-y-8 max-w-[1000px]">
21          <div class="col-span-2 font-bold text-stone-400">Mode</div>
22          <div class="col-span-5 font-bold text-stone-400 pl-4">Description</div>
23          <div class="col-span-5 font-bold text-stone-400 pl-4">Use Cases</div>
24  
25        `;return ve.map(Ae=>(be+=`
26                <div class="col-span-2 font-bold text-voix-admin-50">
27                  <div>${Ae.name}</div>
28                </div>
29                <div class="col-span-5 pl-4">${Ae.description}</div>
30                <div class="col-span-5 ">
31                  <ul class="list-disc pl-4">`,Ae.uses.map(he=>(be+=`<li>${he}</li>`,he)),be+=` </ul>
32                </div>
33              `,Ae)),be+="</div>",be}),R=h(()=>Object.keys(t.selectedField).length>0||Object.keys(t.selectedGroup).length>0),M=Ke("voixDebug",()=>!1),I=$(!1);we(I,ve=>{ve&&u.value?M.value=u.value:M.value=!1}),we(M,ve=>{I.value=!!ve});const F=h(()=>u.value?.properties?.contain),V=h(()=>u.value?.properties?.dom_id);we([F,V],()=>{u.value?.id&&n.updateProperties(u.value.id,u.value.properties)});const H=Ke("voix-inspector-tab",()=>"content"),P=h(()=>{switch(u.value?.type){case"slice":return"heroicons:squares-2x2";case"group":return"heroicons:rectangle-group";case"query":return"heroicons:circle-stack";default:return"heroicons:cube"}}),Q=h(()=>{const ve=u.value?.type;return ve?ve.charAt(0).toUpperCase()+ve.slice(1):""}),X=h(()=>u.value?.type==="slice"&&u.value.component||""),ne=h(()=>u.value?.type==="slice"?["content","style","advanced"]:["style","advanced"]);we(ne,ve=>{!ve.includes(H.value)&&ve[0]&&(H.value=ve[0])},{immediate:!0});const G=oo(),z=yt(),Y=tt("voix-slice-preview-slice"),ie=u.value?.component?z.slices[u.value.component]:void 0;function W(){u.value&&typeof ie?.name<"u"&&(Y.value=ie.name.label,G.push({name:"voix-slicer-slices-en"}))}const E=tt("voix-show-containers-in-editor"),g=h({get:()=>E.value===!0,set:ve=>{E.value=ve}}
33),y=Oe(),A=$(!1),J=$("choose"),D=$("generate"),U=$(!1),O=$(""),T=$(""),K=$({}),B=2e4,S=h(()=>{if(!u.value?.component)return[];const ve=z.slices[u.value.component];return Object.entries(ve?.fields||{}).filter(([be,Ae])=>Ae.type==="collection").map(([be,Ae])=>({name:be,label:Ae.label||be,maxItems:Ae.maxItems}))});function ae(){A.value=!0,J.value="choose",O.value="",T.value="",K.value={},U.value=!1}function re(){A.value=!1}function Me(){J.value==="counts"?J.value=D.value:J.value="choose"}function He(){for(const ve of S.value)K.value[ve.name]??=ve.maxItems?Math.max(1,Math.floor(ve.maxItems/2)):5}function We(){if(S.value.length===0){Xe();return}He(),D.value="generate",J.value="counts"}function Ce(){if(S.value.length===0){at();return}He(),D.value="fill",J.value="counts"}function de(){D.value==="generate"?Xe():at()}function Ne(ve){if(!ve)return[];const be=he=>he.replace(wg,"&amp;").replace(kg,"&lt;").replace(_g,"&gt;"),Ae=[];for(const he of ve)if(he?.type){if(he.type==="text"||he.type==="textarea"){const ke=he[he.type];typeof ke=="string"&&ke.trim()&&Ae.push(`<p>${be(ke)}</p>`)}else if(he.type==="wysiwyg"){const ke=he.wysiwyg;typeof ke=="string"&&ke.trim()&&Ae.push(ke)}else if(he.type==="link"){const ke=he.link;if(ke&&(ke.text||ke.url)){const De=be(ke.url||"#"),Pe=be(ke.text||ke.url||"");Ae.push(`<p><a href="${De}">${Pe}</a></p>`)}}else if(he.type==="collection"){const ke=he.collection;if(Array.isArray(ke))for(const De of ke)Ae.push(...Ne(De?.fields))}}return Ae}function Re(ve){const be=n.currentPage?.elements;if(!be)return"";const Ae=[],he=ve!=null?String(ve):null;function ke(De){for(const Pe of De)Pe.type==="slice"&&Pe.enabled!==!1&&(he===null||String(Pe.id)!==he)&&Ae.push(...Ne(Pe.fields)),"elements"in Pe&&Array.isArray(Pe.elements)&&ke(Pe.elements)}return ke(be),Ae.join(`
34`)}function kt(){(!T.value||T.value.trim()==="")&&(T.value=Re(u.value?.id)),J.value="fill"}function it(){T.value=Re(u.value?.id)}function et(ve=!1,be){if(!u.value?.component)return[];const Ae=z.slices[u.value.component],he=["text","textarea","wysiwyg","link"],ke=ve?[...he,"collection"]:he;return Object.entries(Ae?.fields||{}).filter(([De,Pe])=>ke.includes(Pe.type)).map(([De,Pe])=>{if(Pe.type==="collection"){const gt=Object.entries(Pe.fields||{}).filter(([Ye,Be])=>he.includes(Be.type)).map(([Ye,Be])=>({name:Ye,label:Be.label,type:Be.type,...Be.description?{description:Be.description}:{}})),lt=be?.[De],rt=lt!=null&&Pe.maxItems?Math.min(lt,Pe.maxItems):lt;return{name:De,label:Pe.label,type:"collection",...Pe.maxItems?{maxItems:Pe.maxItems}:{},...Pe.description?{description:Pe.description}:{},...rt!=null?{count:rt}:{},fields:gt}}return{name:De,label:Pe.label,type:Pe.type,...Pe.description?{description:Pe.description}:{}}})}function mt(ve){if(!u.value?.id||!ve)return;const be=u.value.id.toString(),Ae=u.value.component?z.slices[u.value.component]:void 0;for(const he of ve){const ke=Ae?.fields?.[he.name];ke&&t.setupSliceFields(u.value,{...ke,name:he.name}),n.enableField(be,he.name),he.link_text||he.link_url?n.updateField(be,he.name,{text:he.link_text||"",href:he.link_url||"",url:he.link_url||""}):he.value!==null&&n.updateField(be,he.name,he.value)}}function st(ve){if(!u.value?.id||!ve?.length)return;const be=u.value.id.toString(),Ae=u.value.component?z.slices[u.value.component]:void 0,{buildItemFromAssignments:he}=Dn();for(const ke of ve){const De=Ae?.fields?.[ke.name];if(!De||De.type!=="collection"){console.warn("[ai-fill] Unknown collection in LLM response:",ke.name);continue}t.setupSliceFields(u.value,{...De,name:ke.name}),n.enableField(be,ke.name);const Pe=u.value.fields?.find(Ye=>
34Ye.name===ke.name),gt=Array.isArray(Pe?.collection)?Pe.collection:[],lt=De.maxItems?Math.max(0,De.maxItems-gt.length):ke.items.length,rt=ke.items.slice(0,lt).map(Ye=>he(De,Ye.fields||[]));rt.length!==0&&n.updateField(be,ke.name,[...gt,...rt])}}function Xe(){if(!u.value?.component)return;const ve=et(!0,K.value);if(ve.length===0){y.add("This slice has no fillable fields.","warning",5e3),A.value=!1;return}U.value=!0,_e("/api/admin/voix/ai/pages/slices/contents",{method:"POST",body:{description:O.value,fields:ve}}).then(be=>{U.value=!1,A.value=!1,mt(be.assignments),st(be.collections)}).catch(be=>{U.value=!1,y.add("Failed to generate content","error",5e3),console.error("Error generating content:",be)})}function at(){if(!u.value?.component)return;const ve=et(!0,K.value);if(ve.length===0){y.add("This slice has no fillable fields.","warning",5e3),A.value=!1;return}U.value=!0,_e("/api/admin/voix/ai/pages/slices/fill",{method:"POST",body:{content:T.value,fields:ve}}).then(be=>{U.value=!1,A.value=!1,mt(be.assignments),st(be.collections)}).catch(be=>{U.value=!1,y.add("Failed to distribute content","error",5e3),console.error("Error filling slice:",be)})}return{adminStore:t,pageStore:n,route:i,currentlySelectedElements:r,element:u,parentElement:c,requestClosePanel:a,unselectFieldOrGroup:p,showModelData:v,applyDataModelSelection:d,cancelDataModelSelection:m,findElement:l,duplicateElement:w,deleteElement:x,debug:I,elementDiagnostics:L,loadingModeHelp:j,hasSelectedGroupOfFieldsOrField:R,showSliceXPTags:b,showSliceXPConditions:f,sliceFromLabelAndGroup:ie,openInSlicer:W,showContainersInEditor:g,showContentWizard:A,wizardStep:J,countsAction:D,isProcessing:U,prompt:O,fillContent:T,collectionCounts:K,sliceCollectionFields:S,MAX_FILL_LENGTH:B,openContentWizard:ae,closeContentWizard:re,wizardBack:Me,onGenerateSubmit:We,onFillSubmit:Ce,submitFromCounts:de,onFillChosen:kt,resetFillToPageCopy:it,generate:Xe,fill:at,activeTab:H,elementIcon:P,elementTypeLabel:Q,elementSubtitle:X,availableTabs:ne}}}),Sg={key:0,class:"fixed z-40 right-0 top-0 bottom-0 flex flex-col w-[340px] bg-white bg-linear-to-br from-voix-admin-50/20 to-voix-admin-500/0 border-l border-voix-admin-200/60 shadow-2xl text-xs text-voix-admin-700"},Cg={class:"shrink-0 px-4 py-3.5 flex items-center gap-3 bg-white border-b border-voix-admin-100/70"},Pg={class:"w-8 h-8 rounded-md bg-linear-to-br from-white to-voix-admin-200/80 ring-1 ring-voix-admin-200/60 text-voix-admin-700 flex items-center justify-center shrink-0"},Eg={class:"flex-1 min-w-0"},Tg={class:"flex items-center gap-2"},Ig={class:"text-[15px] font-semibold text-voix-admin-900 tracking-tight leading-tight truncate"},Ag={key:0,class:"text-[9px] font-semibold tracking-[0.12em] uppercase px-1.5 py-0.5 rounded bg-voix-admin-100 text-voix-admin-700 shrink-0"},Vg={key:0,class:"font-mono text-[11px] text-voix-admin-400 leading-tight truncate"},Rg={class:"shrink-0 flex items-center gap-5 px-4 bg-white border-b border-voix-admin-100/70"},Lg=["onClick"],Mg={key:0,class:"absolute left-0 right-0 -bottom-px h-0.5 bg-voix-admin-800 rounded-full"},Dg={class:"flex-1 overflow-y-auto min-h-0"},Fg={class:"px-4 pb-4"},jg={class:"px-4 pb-6 flex flex-col gap-3"},Og={class:"px-4 pb-4 space-y-2"},zg={class:"flex space-x-3"},Ug={class:"w-1/2 flex items-end"},qg={class:"text-voix-admin-500 hover:text-voix-admin-900 pb-1.5 pl-1"},Ng={class:"w-1/2 flex items-end"},Bg={key:0,class:"px-4 pt-2 pb-2"},Gg={key:1,class:"px-4 pb-6"},Hg={class:"p-4"},Wg={class:"p-4"},Xg={class:"shrink-0 border-t border-voix-admin-200/60 bg-white bg-gradient-to-b from-voix-admin-50/60 to-voix-admin-100/70 px-4 py-2.5 flex items-center justify-between"},Yg={class:"flex items-center gap-1"},Kg={class:"w-7 h-7 rounded-md flex items-center justify-center text-voix-admin-500 hover:bg-white/80 hover:text-voix-admin-900 transition-colors cursor-pointer"},Jg={class:"bg-white rounded-lg shadow-lg max-w-4xl w-[56rem] overflow-hidden relative"},Qg={key:1,class:"flex flex-col items-center justify-center py-20 px-8"},Zg={class:"text-sm text-gray-400 mt-2"},ex={key:2,class:"p-8"},tx={class:"grid grid-cols-2 gap-4"},nx={key:3,class:"flex flex-col min-h-[340px]"},ox={class:"flex items-center gap-3 px-5 py-4 border-b border-voix-admin-100 shrink-0"},ix={class:"w-7 h-7 rounded-md bg-voix-admin-100 text-voix-admin-700 flex items-center justify-center shrink-0"},sx={class:"px-5 py-4 flex-1"},ax={class:"flex items-center justify-end gap-2 px-5 py-3 border-t border-voix-admin-100 bg-voix-admin-50/80 backdrop-blur shrink-0"},lx=["disabled"],rx={key:4,class:"flex flex-col min-h-[340px]"},dx={class:"divide-y divide-voix-admin-100 flex-1"},ux={class:"font-mono text-[10px] text-voix-admin-400 shrink-0 w-5"},cx={class:"flex-1 min-w-0"},px=["for"],vx={key:0,class:"font-mono text-[10px] text-voix-admin-400 mt-0.5"},mx=["id","onUpdate:modelValue","max"],gx={class:"px-4 py-3 flex items-center justify-end gap-2 border-t border-voix-admin-100"}
34,xx=["disabled"],fx={key:5,class:"flex flex-col min-h-[340px]"},bx={class:"flex items-center gap-3 px-5 py-4 border-b border-voix-admin-100 shrink-0"},hx={class:"w-7 h-7 rounded-md bg-voix-admin-100 text-voix-admin-700 flex items-center justify-center shrink-0"},yx={class:"px-5 py-4 flex-1 space-y-2"},wx={class:"flex items-center justify-between"},kx={class:"border border-gray-200 rounded max-h-[320px] overflow-y-auto"},_x={key:0,class:"text-xs text-red-500"},$x={class:"flex items-center justify-end gap-2 px-5 py-3 border-t border-voix-admin-100 bg-voix-admin-50/80 backdrop-blur shrink-0"},Sx=["disabled"];function Cx(t,n,i,r,u,c){const a=Le,p=Ie("FieldPropertyEditors"),v=Ie("GroupProperties"),d=Ie("SliceProperties"),m=Ie("QueryProperties"),b=Ie("SwitchInput"),f=Ie("TextInput"),l=Ie("DropdownSelect"),w=Ie("DataModelSelector"),x=Ie("PropertiesPopupPanel"),L=Ie("GlobalField"),j=Ie("GlobalFieldGroup"),R=Ie("LoadingAnimation"),M=Ie("TextAreaInput"),I=Ie("SlideoutSection"),F=Ie("WysiwygEditor"),V=Ie("VoixModal"),H=Zt("voix-popper");return t.currentlySelectedElements.length===1||t.adminStore.selectedField.label?(o(),s("div",Sg,[t.currentlySelectedElements.length===1&&t.element?(o(),s(le,{key:0},[e("div",Cg,[e("div",Pg,[k(a,{name:t.elementIcon,size:"16"},null,8,["name"])]),e("div",Eg,[e("div",Tg,[e("h2",Ig,C(t.element.label||"Untitled"),1),t.elementTypeLabel?(o(),s("span",Ag,C(t.elementTypeLabel),1)):_("",!0)]),t.elementSubtitle?(o(),s("div",Vg,C(t.elementSubtitle),1)):_("",!0)]),e("button",{class:"w-7 h-7 rounded-md flex items-center justify-center text-voix-admin-400 hover:bg-white/80 hover:text-voix-admin-900 transition-colors cursor-pointer",title:"Close",onClick:n[0]||(n[0]=(...P)=>t.requestClosePanel&&t.requestClosePanel(...P))},[k(a,{size:"14",name:"heroicons:x-mark"})])]),e("div",Rg,[(o(!0),s(le,null,fe(t.availableTabs,P=>(o(),s("button",{key:P,class:ee(["relative py-2.5 text-[12px] font-medium capitalize transition-colors cursor-pointer",t.activeTab===P?"text-voix-admin-900":"text-voix-admin-500 hover:text-voix-admin-800"]),onClick:Q=>t.activeTab=P},[ce(C(P)+" ",1),t.activeTab===P?(o(),s("span",Mg)):_("",!0)],10,Lg))),128))]),e("div",Dg,[ue(e("div",null,[n[33]||(n[33]=e("div",{class:"px-4 pt-4 pb-2"},[e("div",{class:"relative inline-block pb-1.5"},[e("h3",{class:"text-[11px] tracking-[0.14em] uppercase font-bold text-voix-admin-900"}," Fields "),e("span",{class:"absolute left-0 bottom-0 w-5 h-0.5 bg-voix-admin-800 rounded-full"})])],-1)),e("div",Fg,[(o(),se(p,{key:t.element.id,element:t.element,onShowContentWizard:t.openContentWizard},null,8,["element","onShowContentWizard"]))])],512),[[Et,t.activeTab==="content"&&t.element.type==="slice"]]),ue(e("div",null,[t.element.type==="group"?(o(),se(v,{key:0,"group-settings":t.element.properties.settings,"onUpdate:groupSettings":n[1]||(n[1]=P=>t.element.properties.settings=P),"element-id":t.element.id},null,8,["group-settings","element-id"])):_("",!0),t.element.type==="slice"?(o(),se(d,{key:1,"slice-settings":t.element.properties.settings,"onUpdate:sliceSettings":n[2]||(n[2]=P=>t.element.properties.settings=P),"element-id":t.element.id}
34,null,8,["slice-settings","element-id"])):_("",!0),t.element.type==="query"?(o(),se(m,{key:2,"query-settings":t.element.properties.settings,"onUpdate:querySettings":n[3]||(n[3]=P=>t.element.properties.settings=P)},null,8,["query-settings"])):_("",!0),t.element.type==="group"?(o(),s(le,{key:3},[n[34]||(n[34]=e("div",{class:"px-4 pt-2 pb-2"},[e("div",{class:"relative inline-block pb-1.5"},[e("h3",{class:"text-[11px] tracking-[0.14em] uppercase font-bold text-voix-admin-900"}," Container "),e("span",{class:"absolute left-0 bottom-0 w-5 h-0.5 bg-voix-admin-800 rounded-full"})])],-1)),e("div",jg,[k(b,{modelValue:t.element.properties.contain,"onUpdate:modelValue":n[4]||(n[4]=P=>t.element.properties.contain=P),label:"Contain"},null,8,["modelValue"]),k(b,{modelValue:t.showContainersInEditor,"onUpdate:modelValue":n[5]||(n[5]=P=>t.showContainersInEditor=P),label:"Show container bounds"},null,8,["modelValue"])])],64)):_("",!0)],512),[[Et,t.activeTab==="style"]]),ue(e("div",null,[n[37]||(n[37]=e("div",{class:"px-4 pt-4 pb-2"},[e("div",{class:"relative inline-block pb-1.5"},[e("h3",{class:"text-[11px] tracking-[0.14em] uppercase font-bold text-voix-admin-900"}," General "),e("span",{class:"absolute left-0 bottom-0 w-5 h-0.5 bg-voix-admin-800 rounded-full"})])],-1)),e("div",Og,[k(f,{id:"element-id",modelValue:t.element.properties.dom_id,"onUpdate:modelValue":n[6]||(n[6]=P=>t.element.properties.dom_id=P),placeholder:"Element ID",label:"DOM Id"},{default:pe(()=>[...n[35]||(n[35]=[e("svg",{class:"w-4 h-4 -ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M7 20l4-16m2 16l4-16M6 9h14M4 15h14"})],-1)])]),_:1},8,["modelValue"]),e("div",zg,[e("div",Ug,[k(l,{id:"hydration-mode",modelValue:t.element.hydration_mode,"onUpdate:modelValue":n[7]||(n[7]=P=>t.element.hydration_mode=P),label:"Loading Mode",disabled:t.parentElement?.type==="slice"||t.parentElement?.type==="query"||t.parentElement?.type==="group",options:[{label:"Load",value:"load",key:"load"},{label:"Idle",value:"idle",key:"idle"},{label:"Visible",value:"visible",key:"visible"},{label:"On Mouse Over",value:"mouseover",key:"mouseover"},{label:"SSR Only",value:"never",key:"never"},{label:"Client Only",value:"client-only",key:"clientOnly"},{label:"Client Only When Visible",value:"client-only-when-visible",key:"clientOnlyWhenVisible"}],placeholder:"Select a Loading Mode",class:"flex-1 disabled:opacity-50 disabled:cursor-not-allowed"},null,8,["modelValue","disabled"]),ue((o(),s("button",qg,[k(a,{size:"16",name:"heroicons:information-circle"})])),[[H,t.loadingModeHelp,"bottom",{right:!0}]])]),e("div",Ng,[k(l,{id:"enabled",modelValue:t.element.enabled,"onUpdate:modelValue":n[8]||(n[8]=P=>t.element.enabled=P),label:"Render Mode",options:[{label:"Enabled",value:!0,key:"enabled"},{label:"Disabled",value:!1,key:"disabled"}],placeholder:"Select a Render Mode",class:"flex-1",onInput:n[9]||(n[9]=P=>t.pageStore.toggleElement(t.element.id,P))},null,8,["modelValue"])])]),k(f,{id:"element-name",modelValue:t.element.label,"onUpdate:modelValue":n[10]||(n[10]=P=>t.element.label=P),placeholder:"Provide a Label",label:t.element.type==="slice"?"Slice Label":t.element.type==="group"?"Group Label":"Label"},null,8,["modelValue","label"])]),t.element.type==="slice"||t.element.type==="query"?(o(),s("div",Bg,[...n[36]||(n[36]=[e("div",{class:"relative inline-block pb-1.5"},[e("h3",{class:"text-[11px] tracking-[0.14em] uppercase font-bold text-voix-admin-900"}," Data Models "),e("span",{class:"absolute left-0 bottom-0 w-5 h-0.5 bg-voix-admin-800 rounded-full"})],-1)])])):_("",!0),t.element.type==="slice"||t.element.type==="query"?(o(),s("div",Gg,[e("button",{class:ee(["h-8 px-2.5 rounded-md flex items-center justify-center w-full transition-colors duration-200 text-[12px] font-medium",{"bg-white border border-voix-admin-200/70 text-voix-admin-700 hover:bg-voix-admin-800 hover:text-white hover:border-voix-admin-800":!t.showModelData,"bg-voix-admin-800 text-white border border-voix-admin-800":t.showModelData}]),onClick:n[11]||(n[11]=P=>t.showModelData=!t.showModelData)},C(t.element.type==="query"?"Manage Data Model":"Enable Data Model"),3)])):_("",!0)],512),[[Et,t.activeTab==="advanced"]])]),t.showModelData&&(t.element.type==="slice"||t.element.type==="query")?(o(),se(x,{key:0,icon:"heroicons:circle-stack",title:"Data Model",subtitle:t.element.component||t.element.label||"",class:"min-w-[400px] max-w-[600px] text-xs text-gray-500 bottom-0 top-auto",onClose:t.cancelDataModelSelection},{default:pe(()=>[e("div",Hg,[k(w,{slice:t.element,onApplySelection:t.applyDataModelSelection,onCancelSelection:t.cancelDataModelSelection},null,8,["slice","onApplySelection","onCancelSelection"])])]),_:1},8,["subtitle","onClose"])):_("",!0)],64)):_("",!0),t.hasSelectedGroupOfFieldsOrField?(o(),se(x,{key:t.adminStore.selectedField.label,icon:t.adminStore.selectedField.label?"heroicons:hashtag":"heroicons:rectangle-group",title:t.adminStore.selectedField.label||"Fields",subtitle:t.adminStore.selectedField.type||(Object.keys(t.adminStore.selectedGroup).length>0?`${Object.keys(t.adminStore.selectedGroup).length} fields`:""),class:"min-w-[400px] text-xs text-gray-500 mt-8",onClose:t.unselectFieldOrGroup},{default:pe(()=>[e("div",Wg,[k(L,{element:t.adminStore.selectedFieldSlice,"field-data":t.adminStore.selectedFieldData,"field-configuration":t.adminStore.selectedField},null,8,["element","field-data","field-configuration"]),k(j,{element:t.adminStore.selectedFieldSlice,group:t.adminStore.selectedGroup},null,8,["element","group"])])]),_:1},8,["icon","title","subtitle","onClose"])):_("",!0),e("div",Xg,[e("button",{class:"h-7 px-3 rounded-md text-voix-admin-500 hover:bg-white/80 hover:text-voix-admin-900 transition-colors text-[11px] font-medium cursor-pointer",onClick:n[12]||(n[12]=(...P)=>t.requestClosePanel&&t.requestClosePanel(...P))}," Close "),e("div",Yg,[t.sliceFromLabelAndGroup&&t.sliceFromLabelAndGroup.name.layouts?ue((o(),s("button",{key:0,class:"w-7 h-7 rounded-md flex items-center justify-center text-voix-admin-500 hover:bg-white/80 hover:text-voix-admin-900 transition-colors cursor-pointer",onClick:n[13]||(n[13]=(...P)=>t.openInSlicer&&t.openInSlicer(...P))},[k(a,{size:"14",name:"fluent-emoji-high-contrast:pizza"})])),[[H,"<span class='text-xs'>Open in Slicer</span>","#app",{top:!0}]]):_("",!0),ue((o(),s("button",{class:"w-7 h-7 rounded-md flex items-center justify-center text-voix-admin-500 hover:bg-white/80 hover:text-voix-admin-900 transition-colors cursor-pointer",onClick:n[14]||(n[14]=(...P)=>t.findElement&&t.findElement(...P))},[...n[38]||(n[38]=[e("svg",{class:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},[e("circle",{cx:"12",cy:"12",r:"2",stroke:"currentColor","stroke-width":"2"}),e("circle",{cx:"12",cy:"12",r:"6",stroke:"currentColor","stroke-width":"2"}),e("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"2"})],-1)])])),[[H,"<span class='text-xs'>Find Element</span>","#app",{top:!0}]]),ue((o(),s("button",{class:"w-7 h-7 rounded-md flex items-center justify-center text-voix-admin-500 hover:bg-white/80 hover:text-voix-admin-900 transition-colors cursor-pointer",onClick:n[15]||(n[15]=(...P)=>t.duplicateElement&&t.duplicateElement(...P))},[k(a,{size:"14",name:"heroicons:document-duplicate"})])),[[H,"<span class='text-xs'>Duplicate Element</span>","#app",{top:!0}]]),ue((o(),s("button",Kg,[k(a,{size:"14",name:"heroicons:information-circle"})])),[[H,t.elementDiagnostics,"#app",{top:!0}]]),ue((o(),s("button",{class:"w-7 h-7 rounded-md flex items-center justify-center text-voix-admin-400 hover:bg-red-50 hover:text-red-600 transition-colors cursor-pointer","data-testid":"voix-delete-element",onClick:n[16]||(n[16]=(...P)=>t.deleteElement&&t.deleteElement(...P))},[k(a,{size:"14",name:"heroicons:trash"})])),[[H,"<span class='text-xs'>Delete Element</span>","#app",{top:!0}]])])]),(o(),se(vt,{to:"#voix-admin-root"},[k(V,{class:"z-[99]",show:t.showContentWizard,"can-close":!0},{default:pe(()=>[e("div",Jg,[t.wizardStep==="counts"&&!t.isProcessing?(o(),s("button",{key:0,class:"absolute top-4 left-4 z-10 text-gray-400 hover:text-gray-600 transition-colors",onClick:n[17]||(n[17]=(...P)=>t.wizardBack&&t.wizardBack(...P))},[k(a,{name:"heroicons:arrow-left",size:"20"})])):_("",!0),t.isProcessing?(o(),s("div",Qg,[k(R,{class:"h-40 w-72"}),e("p",Zg,C(t.wizardStep==="fill"?"Distributing content...":"Generating content..."),1)])):t.wizardStep==="choose"?(o(),s("div",ex,[n[43]||(n[43]=e("h2",{class:"text-lg font-semibold text-gray-900 mb-1"}," Fill with Content ",-1)),n[44]||(n[44]=e("p",{class:"text-sm text-gray-400 mb-8"}," Choose how you'd like to populate this slice's fields. ",-1)),e("div",tx,[e("button",{class:"group text-left p-6 rounded-lg border border-gray-200 hover:border-voix-admin-400 hover:bg-voix-admin-50 transition-all",onClick:n[18]||(n[18]=P=>t.wizardStep="generate")},[k(a,{name:"heroicons:sparkles",size:"24",class:"text-voix-admin-500 mb-3"}),n[39]||(n[39]=e("h3",{class:"text-sm font-medium text-gray-900 mb-1"}," Generate with AI ",-1)),n[40]||(n[40]=e("p",{class:"text-xs text-gray-400 leading-relaxed"}," Describe what you want and AI will create content for each field. ",-1))]),e("button",{class:"group text-left p-6 rounded-lg border border-gray-200 hover:border-voix-admin-400 hover:bg-voix-admin-50 transition-all",onClick:n[19]||(n[19]=(...P)=>t.onFillChosen&&t.onFillChosen(...P))},[k(a,{name:"heroicons:clipboard-document-list",size:"24",class:"text-voix-admin-500 mb-3"}),n[41]||(n[41]=e("h3",{class:"text-sm font-medium text-gray-900 mb-1"}," Fill from Copy ",-1)),n[42]||(n[42]=e("p",{class:"text-xs text-gray-400 leading-relaxed"}," Pre-loaded with this page's existing copy — edit or replace, and AI will distribute it across the fields. ",-1))])])])):t.wizardStep==="generate"?(o(),s("div",nx,[e("div",ox,[e("button",{type:"button",class:"w-7 h-7 rounded-md flex items-center justify-center text-voix-admin-400 hover:bg-voix-admin-100 hover:text-voix-admin-900 cursor-pointer shrink-0",onClick:n[20]||(n[20]=(...P)=>t.wizardBack&&t.wizardBack(...P))},[k(a,{name:"heroicons:arrow-left-20-solid",size:"14"})]),e("div",ix,[k(a,{name:"heroicons:sparkles",size:"15"})]),n[45]||(n[45]=e("div",{class:"flex-1 min-w-0"},[e("h3",{class:"text-[15px] font-semibold text-voix-admin-900 tracking-tight leading-tight"}," Generate with AI "),e("div",{class:"text-[11px] text-voix-admin-400 leading-tight mt-0.5"}," Describe the content you want — AI will generate text for each field based on the field labels and types. ")],-1)),e("button",{type:"button",class:"w-7 h-7 rounded-md flex items-center justify-center text-voix-admin-400 hover:bg-voix-admin-100 hover:text-voix-admin-900 cursor-pointer shrink-0",onClick:n[21]||(n[21]=(...P)=>t.closeContentWizard&&t.closeContentWizard(...P))},[k(a,{name:"heroicons:x-mark-20-solid",size:"14"})])]),e("div",sx,[k(M,{id:"content-prompt",modelValue:t.prompt,"onUpdate:modelValue":n[22]||(n[22]=P=>t.prompt=P),placeholder:"Describe the content you want to generate...",label:"Prompt",class:"w-full"},null,8,["modelValue"])]),e("div",ax,[e("button",{type:"button",class:"h-9 px-4 roun
34ded-md text-[13px] font-medium text-voix-admin-700 hover:bg-voix-admin-100 cursor-pointer",onClick:n[23]||(n[23]=(...P)=>t.closeContentWizard&&t.closeContentWizard(...P))}," Cancel "),e("button",{type:"button",disabled:t.prompt.length<5,class:"h-9 px-4 rounded-md bg-voix-admin-800 hover:bg-voix-admin-900 text-white text-[13px] font-medium shadow-sm cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-voix-admin-800",onClick:n[24]||(n[24]=(...P)=>t.onGenerateSubmit&&t.onGenerateSubmit(...P))},C(t.sliceCollectionFields.length>0?"Next":"Generate"),9,lx)])])):t.wizardStep==="counts"?(o(),s("div",rx,[k(I,{label:"How many items per collection?"}),n[46]||(n[46]=e("div",{class:"px-4 pb-2 text-[12px] text-voix-admin-600 leading-relaxed"}," This slice has repeating fields. Choose how many items AI should generate for each one. ",-1)),e("div",dx,[(o(!0),s(le,null,fe(t.sliceCollectionFields,(P,Q)=>(o(),s("div",{key:P.name,class:"px-4 py-3 flex items-center gap-4"},[e("span",ux,C(String(Q+1).padStart(2,"0")),1),e("div",cx,[e("label",{for:`count-${P.name}`,class:"block text-[13px] font-medium text-voix-admin-900 truncate"},C(P.label),9,px),P.maxItems?(o(),s("p",vx," Max "+C(P.maxItems),1)):_("",!0)]),ue(e("input",{id:`count-${P.name}`,"onUpdate:modelValue":X=>t.collectionCounts[P.name]=X,type:"number",min:"1",max:P.maxItems??50,class:"w-20 px-3 py-2 text-[13px] text-voix-admin-900 bg-white border border-voix-admin-200 rounded-md focus:outline-none focus:ring-2 focus:ring-voix-admin-300 focus:border-voix-admin-400 text-right"},null,8,mx),[[$e,t.collectionCounts[P.name],void 0,{number:!0}]])]))),128))]),e("div",gx,[e("button",{class:"h-8 px-3 rounded-md text-[12px] font-medium text-voix-admin-700 hover:bg-voix-admin-100 transition-colors cursor-pointer",onClick:n[25]||(n[25]=(...P)=>t.closeContentWizard&&t.closeContentWizard(...P))}," Cancel "),e("button",{class:"h-8 px-3 rounded-md text-[12px] font-semibold text-white bg-voix-admin-800 hover:bg-voix-admin-900 transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed",disabled:t.sliceCollectionFields.some(P=>!t.collectionCounts[P.name]||(t.collectionCounts[P.name]??0)<1),onClick:n[26]||(n[26]=(...P)=>t.submitFromCounts&&t.submitFromCounts(...P))},C(t.countsAction==="fill"?"Fill Fields":"Generate"),9,xx)])])):t.wizardStep==="fill"?(o(),s("div",fx,[e("div",bx,[e("button",{type:"button",class:"w-7 h-7 rounded-md flex items-center justify-center text-voix-admin-400 hover:bg-voix-admin-100 hover:text-voix-admin-900 cursor-pointer shrink-0",onClick:n[27]||(n[27]=(...P)=>t.wizardBack&&t.wizardBack(...P))},[k(a,{name:"heroicons:arrow-left-20-solid",size:"14"})]),e("div",hx,[k(a,{name:"heroicons:clipboard-document-list-20-solid",size:"15"})]),n[47]||(n[47]=e("div",{class:"flex-1 min-w-0"},[e("h3",{class:"text-[15px] font-semibold text-voix-admin-900 tracking-tight leading-tight"}," Fill from Copy "),e("div",{class:"text-[11px] text-voix-admin-400 leading-tight mt-0.5"}," Paste your raw content — AI will distribute it across this slice's fields based on the content structure. ")],-1)),e("button",{type:"button",class:"w-7 h-7 rounded-md flex items-center justify-center text-voix-admin-400 hover:bg-voix-admin-100 hover:text-voix-admin-900 cursor-pointer shrink-0",onClick:n[28]||(n[28]=(...P)=>t.closeContentWizard&&t.closeContentWizard(...P))},[k(a,{name:"heroicons:x-mark-20-solid",size:"14"})])]),e("div",yx,[e("div",wx,[n[49]||(n[49]=e("label",{class:"block text-xs font-medium text-gray-500"},"Content",-1)),e("button",{type:"button",class:"inline-flex items-center gap-1 text-[11px] text-voix-admin-600 hover:text-voix-admin-900 cursor-pointer",title:"Replace with current page copy",onClick:n[29]||(n[29]=(...P)=>t.resetFillToPageCopy&&t.resetFillToPageCopy(...P))},[k(a,{name:"heroicons:arrow-path",size:"11"}),n[48]||(n[48]=ce(" Use page copy ",-1))])]),e("div",kx,[k(F,{modelValue:t.fillContent,"onUpdate:modelValue":n[30]||(n[30]=P=>t.fillContent=P)},null,8,["modelValue"])]),t.fillContent.length>t.MAX_FILL_LENGTH?(o(),s("p",_x," Content exceeds "+C(t.MAX_FILL_LENGTH.toLocaleStr
34ing())+" character limit ",1)):_("",!0)]),e("div",$x,[e("button",{type:"button",class:"h-9 px-4 rounded-md text-[13px] font-medium text-voix-admin-700 hover:bg-voix-admin-100 cursor-pointer",onClick:n[31]||(n[31]=(...P)=>t.closeContentWizard&&t.closeContentWizard(...P))}," Cancel "),e("button",{type:"button",disabled:t.fillContent.length<5||t.fillContent.length>t.MAX_FILL_LENGTH,class:"h-9 px-4 rounded-md bg-voix-admin-800 hover:bg-voix-admin-900 text-white text-[13px] font-medium shadow-sm cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-voix-admin-800",onClick:n[32]||(n[32]=(...P)=>t.onFillSubmit&&t.onFillSubmit(...P))},C(t.sliceCollectionFields.length>0?"Next →":"Fill Fields"),9,Sx)])])):_("",!0)])]),_:1},8,["show"])]))])):_("",!0)}const Px=Je($g,[["render",Cx]]),Ex={class:"relative flex-none flex items-end gap-2.5 h-12 px-4 pb-2 bg-white/30 border-b border-voix-admin-200/50 opacity-50 saturate-[.2] transition-all duration-200 hover:opacity-100 hover:saturate-100 hover:bg-white/65"},Tx={class:"flex flex-col justify-end gap-[3px] mr-3 pb-px select-none"},Ix={class:"text-[9px] leading-none font-mono text-voix-admin-400/70"},Ax=["aria-label","onClick"],Vx={key:0,class:"font-mono text-[9px] font-semibold tracking-wide"},Rx={key:1,class:"w-[3px] h-[3px] rounded-full bg-current"},Lx={key:2,class:"absolute inset-x-0 -bottom-2 h-[2px] rounded-full bg-voix-admin-500"},Mx=24,Dx={__name:"StudioViewportRibbon",props:{viewers:{type:Array,required:!0},activeGuid:{type:[String,null],required:!0}
34,isReviewMode:{type:Boolean,required:!0}},emits:["jump","add","clear"],setup(t,{emit:n}){const i=t,r=n;function u(p){return Math.max(17,Math.min(160,Math.round(p/Mx)))}function c(p){return u(p)>=36}function a(p){return{width:`${u(p)}px`,...p>=1920?{borderRadius:"7px / 11px"}:{}}}return(p,v)=>{const d=Le,m=Zt("voix-popper");return o(),s("div",Ex,[e("div",Tx,[v[2]||(v[2]=e("span",{class:"text-[10px] leading-none font-semibold tracking-[0.13em] uppercase font-mono text-voix-admin-400"},"Viewports",-1)),e("span",Ix,C(i.viewers.length)+" open",1)]),(o(!0),s(le,null,fe(i.viewers,b=>ue((o(),s("button",{key:b.guid,"aria-label":`${b.width}px viewport`,class:ee(["relative flex-none h-[30px] flex items-center justify-center border-[1.4px] rounded transition-all duration-150",b.guid===i.activeGuid?"border-voix-admin-700 text-voix-admin-700 bg-white":"border-voix-admin-300 text-voix-admin-400 bg-white/40 hover:bg-white hover:border-voix-admin-600 hover:text-voix-admin-600 hover:shadow-sm"]),style:Ee(a(b.width)),onClick:f=>r("jump",b.guid)},[c(b.width)?(o(),s("span",Vx,C(b.width),1)):(o(),s("span",Rx)),b.guid===i.activeGuid?(o(),s("span",Lx)):_("",!0)],14,Ax)),[[m,`<span class='text-xs'>${b.width}px — jump to viewport</span>`,"#app",{bottom:!0}
34]])),128)),i.isReviewMode?_("",!0):ue((o(),s("button",{key:0,"aria-label":"Add viewport",class:"flex-none h-[30px] w-[34px] flex items-center justify-center border-[1.4px] border-dashed rounded border-voix-admin-300 text-voix-admin-400 hover:border-solid hover:border-voix-admin-500 hover:text-voix-admin-500 hover:bg-white transition-all duration-150",onClick:v[0]||(v[0]=b=>r("add"))},[k(d,{name:"heroicons:plus",size:"14"})])),[[m,"<span class='text-xs'>Add viewport</span>","#app",{bottom:!0}]]),i.isReviewMode?_("",!0):ue((o(),s("button",{key:1,class:"flex-none ml-auto inline-flex items-center gap-1 h-[30px] px-2 rounded text-[10px] font-semibold tracking-wider uppercase text-voix-admin-400 hover:text-voix-admin-600 hover:bg-white transition-colors",onClick:v[1]||(v[1]=b=>r("clear"))},[k(d,{name:"heroicons:arrow-uturn-left",size:"11"}),v[3]||(v[3]=e("span",null,"Clear",-1))])),[[m,"<span class='text-xs'>Reset to a single md (768px) viewport</span>","#app",{bottom:!0}]])])}}},Fx={class:"flex-none flex items-center justify-between h-12 px-4 border-b border-black/[0.06]"},jx={class:"text-sm font-semibold text-voix-admin-900"},Ox={class:"ml-1 font-normal tabular-nums text-voix-admin-400"},zx={key:0,class:"flex flex-col items-center justify-center py-12 text-center text-voix-admin-400"},Ux={class:"flex items-baseline justify-between gap-3 mb-1.5"},qx={class:"text-sm font-semibold text-voix-admin-900"},Nx={class:"text-[11px] font-mono text-voix-admin-400"},Bx={class:"text-sm leading-relaxed text-voix-admin-700"},Gx={class:"flex-none p-4 border-t border-black/[0.06]"},Hx={class:"relative mb-3"},Wx=["disabled"],Xx={class:"mb-4 space-y-1.5 rounded-md border border-black/[0.06] bg-voix-admin-50 px-3 py-2.5"},Yx={class:"flex items-center justify-between"},Kx={class:"text-sm text-voix-admin-800"},Jx={class:"flex items-center justify-between"},Qx={class:"text-[11px] font-mono text-voix-admin-700"},Zx={class:"flex items-center justify-between"},ef={class:"flex items-center gap-2.5"},tf={__name:"AnnotationDrawer",props:{visible:{type:Boolean,required:!0},annotation:{type:null,required:!0},breakpoint:{type:String,required:!0}},emits:["close","resolved","mouseEnter","mouseLeave"],setup(t,{emit:n}){const i=t,r=n,u=Se(),c=Vt(),a=$(""),p=$();we(()=>i.visible,f=>{f&&p.value&&nt(()=>{p.value?.scrollTo(0,p.value.scrollHeight)})});function v(){if(!a.value.trim()||!i.annotation)return;const f={uuid:Ut(),text:a.value.trim(),created_at:new Date().toISOString(),created_by:c.currentUser?.name||"Unknown"};u.addAnnotationComment(i.breakpoint,i.annotation.uuid,f),a.value=""}function d(){i.annotation&&(u.updateAnnotation(i.breakpoint,i.annotation.uuid,{resolved:!i.annotation.resolved}),i.annotation.resolved||r("resolved",i.annotation))}function m(){i.annotation&&confirm("Are you sure you want to delete this annotation?")&&(u.deleteAnnotation(i.breakpoint,i.annotation.uuid),r("close"))}function b(f){const l=new Date(f);return new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(l)}return(f,l)=>(o(),s(le,null,[k(Ot,{name:"drawer"},{default:pe(()=>[t.visible&&t.annotation?(o(),s("div",{key:0,class:"annotation-drawer fixed right-0 top-[50px] bottom-0 z-[1000] flex w-96 flex-col bg-white border-l border-black/[0.08]",onWheel:l[3]||(l[3]=je(()=>{},["stop"])),onMouseenter:l[4]||(l[4]=w=>r("mouseEnter")),onMouseleave:l[5]||(l[5]=w=>r("mouseLeave"))},[e("div",Fx,[e("h3",jx,[l[7]||(l[7]=ce(" Comments ",-1)),e("span",Ox,C(t.annotation.comments.length),1)]),e("button",{class:"-mr-1 p-1.5 rounded-md text-voix-admin-400 transition-colors hover:bg-voix-admin-50 hover:text-voix-admin-700","aria-label":"Close comments",onClick:l[0]||(l[0]=w=>r("close"))},[...l[8]||(l[8]=[e("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"w-4 h-4"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"})],-1)])])]),e("div",{ref_key:"drawerContent",ref:p,class:"flex-1 min-h-0 overflow-y-auto px-4 py-4",onWheel:l[1]||(l[1]=je(()=>{},["stop"]))},[t.annotation.comments.length===0?(o(),s("div",zx,[...l[9]||(l[9]=[e("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"w-8 h-8 mb-3 opacity-60"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M7.5 8.25h9m-9 3H12m-9.75 1.51c0 1.6 1.123 2.994 2.707 3.227 1.129.166 2.27.293 3.423.379.35.
34026.67.21.865.501L12 21l2.755-4.133a1.14 1.14 0 01.865-.501 48.172 48.172 0 003.423-.379c1.584-.233 2.707-1.626 2.707-3.228V6.741c0-1.602-1.123-2.995-2.707-3.228A48.394 48.394 0 0012 3c-2.392 0-4.744.175-7.043.513C3.373 3.746 2.25 5.14 2.25 6.741v6.018z"})],-1),e("p",{class:"text-sm"}," No comments yet ",-1),e("p",{class:"mt-1 text-xs text-voix-admin-300"}," Add the first one below. ",-1)])])):_("",!0),(o(!0),s(le,null,fe(t.annotation.comments,w=>(o(),s("div",{key:w.uuid,class:"mb-2.5 rounded-md border border-black/[0.06] bg-voix-admin-50 px-3 py-2.5"},[e("div",Ux,[e("span",qx,C(w.created_by),1),e("span",Nx,C(b(w.created_at)),1)]),e("div",Bx,C(w.text),1)]))),128))],544),e("div",Gx,[e("div",Hx,[ue(e("textarea",{"onUpdate:modelValue":l[2]||(l[2]=w=>a.value=w),placeholder:"Add a comment…",class:"w-full min-h-[88px] resize-none rounded-md border border-black/10 bg-white px-3 py-2.5 pr-12 text-sm text-voix-admin-900 placeholder:text-voix-admin-400 focus:border-voix-admin-500 focus:outline-none focus:ring-2 focus:ring-voix-admin-500/10",onKeyup:Qt(v,["enter"])},null,544),[[$e,a.value]]),e("button",{class:"absolute right-2.5 bottom-2.5 inline-flex items-center justify-center w-8 h-8 rounded-md bg-voix-admin-500 text-white transition-colors hover:bg-voix-admin-600 disabled:cursor-not-allowed disabled:opacity-40",disabled:!a.value.trim(),"aria-label":"Send comment",onClick:v},[...l[10]||(l[10]=[e("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"w-4 h-4 translate-x-px -translate-y-px"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 12L3.269 3.126A59.768 59.768 0 0121.485 12 59.77 59.77 0 013.27 20.876L5.999 12zm0 0h7.5"})],-1)])],8,Wx)]),e("dl",Xx,[e("div",Yx,[l[11]||(l[11]=e("dt",{class:"text-[11px] font-semibold uppercase tracking-[0.04em] text-voix-admin-400"}," Created by ",-1)),e("dd",Kx,C(t.annotation.created_by),1)]),e("div",Jx,[l[12]||(l[12]=e("dt",{class:"text-[11px] font-semibold uppercase tracking-[0.04em] text-voix-admin-400"}," Created ",-1)),e("dd",Qx,C(b(t.annotation.created_at)),1)]),e("div",Zx,[l[14]||(l[14]=e("dt",{class:"text-[11px] font-semibold uppercase tracking-[0.04em] text-voix-admin-400"}," Status ",-1)),e("dd",null,[e("span",{class:ee(["inline-flex items-center gap-1.5 h-[22px] px-2 rounded-full text-[11px] font-semibold tracking-[0.005em]",t.annotation.resolved?"bg-emerald-50 text-emerald-700":"bg-amber-50 text-amber-700"])},[l[13]||(l[13]=e("span",{class:"w-1.5 h-1.5 rounded-full bg-current opacity-80"},null,-1)),ce(" "+C(t.annotation.resolved?"Resolved":"Open"),1)],2)])])]),e("div",ef,[e("button",{class:ee(["flex-1 h-9 px-3 rounded-md text-sm font-semibold border transition-colors",t.annotation.resolved?"border-voix-admin-300 text-voix-admin-600 hover:bg-voix-admin-50 hover:border-voix-admin-400":"border-transparent bg-voix-admin-500 text-white shadow-sm hover:bg-voix-admin-600"]),onClick:d},C(t.annotation.resolved?"Reopen":"Mark as Done"),3),e("button",{class:"h-9 px-3.5 rounded-md text-sm font-semibold border border-rose-300 text-rose-700 transition-colors hover:bg-rose-50 hover:border-rose-500",onClick:m}," Delete ")])])],32)):_("",!0)]),_:1}),k(Ot,{name:"overlay"},{default:pe(()=>[t.visible?(o(),s("div",{key:0,class:"drawer-overlay fixed left-0 right-0 top-[50px] bottom-0 z-[999] bg-voix-admin-900/20",onClick:l[6]||(l[6]=w=>r("close"))})):_("",!0)]),_:1})],64))}},nf=Je(tf,[["__scopeId","data-v-dce638a8"]]),of=["onClick"],sf={__name:"AnnotationTimeline",props:{breakpoint:{type:String,required:!0},viewerGuid:{type:String,required:!0},iframeHeight:{type:Number,required:!0},scrollTop:{type:Number,required:!0},scrollHeight:{type:Number,required:!0},clientHeight:{type:Number,required:!0}},emits:["annotationCreated","annotationClicked"],setup(t,{emit:n}){const i=t,r=n,u=Se(),c=Vt(),a=$(),p=h(()=>u.currentPage?.review?.annotations?.[i.breakpoint]?u.currentPage.review.annotations[i.breakpoint]:[]),v=h(()=>{if(!p.value.length||!i.scrollHeight)return[];const b=i.scrollTop,f=i.scrollTop+i.clientHeight;return p.value.map(l=>{const x=(l.y-b)/i.clientHeight*100;return{...l,timelinePosition:x,isVisible:l.y>=b&&l.y<=f}}).filter(l=>l.isVisible)});function d(b){if(!a.value)return;const f=a.value.getBoundingClientRect(),w=(b.clientY-f.top)/f.height*100,x=i.scrollTop+w/100*i.clientHeight,L={uuid:Ut(),resolved:!1,y:x,comments:[],created_at:new Date().toISOString(),created_by:c.currentUser?.name||"Unknown"};u.addAnnotation(i.breakpoint,L),r("annotationCreated",L)}function m(b){r("annotationClicked",b)}return(b,f)=>
34(o(),s("div",{ref_key:"timelineRef",ref:a,class:"absolute left-[-30px] top-0 bottom-0 w-32 cursor-pointer z-10 group",onClick:d},[f[1]||(f[1]=e("div",{class:"absolute left-3 top-0 bottom-0 w-0.5 bg-gradient-to-b from-transparent via-neutral-500 to-transparent opacity-50 group-hover:opacity-100 duration-300"},null,-1)),k(uo,{name:"annotation"},{default:pe(()=>[(o(!0),s(le,null,fe(v.value,l=>(o(),s("div",{key:l.uuid,class:"absolute left-3 transform -translate-y-1/2 z-2",style:Ee({top:`${l.timelinePosition}%`}),onClick:je(w=>m(l),["stop"])},[e("div",{class:ee(["annotation-dot relative -translate-x-1/3 cursor-pointer transition-all duration-200 w-2.5 h-2.5 rounded-full bg-voix-admin-500",{resolved:l.resolved,"has-comments":l.comments.length>0}])},[...f[0]||(f[0]=[e("div",{class:"pulse-ring"},null,-1)])],2)],12,of))),128))]),_:1}),i.scrollHeight>i.clientHeight?(o(),s("div",{key:0,class:"scroll-indicator",style:Ee({top:`${i.scrollTop/i.scrollHeight*100}%`,height:`${i.clientHeight/i.scrollHeight*100}%`})},null,4)):_("",!0)],512))}},af=Je(sf,[["__scopeId","data-v-10876438"]]),lf=At({props:{viewerWidth:{type:Number,required:!0}},emits:["resize"],setup(t){const n=Jt(),i=h(()=>kn(t.viewerWidth)),r=h(()=>_n(t.viewerWidth)),u=h(()=>n.getAllBreakpoints.filter(c=>c.name!=="default"));return{currentBreakpoint:i,applicableBreakpoints:r,breakpoints:u}}}),rf={key:0,class:"flex justify-center items-start"},df=["onClick"],uf=["innerHTML"],cf={class:"block mt-1 text-[8px] uppercase text-voix-admin-500"};function pf(t,n,i,r,u,c){return t.currentBreakpoint?(o(),s("div",rf,[e("div",{class:ee(["px-2 border-voix-admin-500 text-voix-admin-500",{"border-b-2 ":t.currentBreakpoint.name==="default","opacity-50":t.currentBreakpoint.name!=="default"}])},[e("button",{onClick:n[0]||(n[0]=a=>t.$emit("resize",380))},[...n[1]||(n[1]=[e("svg",{class:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 18h.01M8 21h8a2 2 0 002-2V5a2 2 0 00-2-2H8a2 2 0 00-2 2v14a2 2 0 002 2z"})],-1),e("span",{class:"block mt-1 text-[8px] uppercase text-voix-admin-500"},"ALL",-1)])])],2),(o(!0),s(le,null,fe(t.breakpoints,(a,p)=>(o(),s("div",{key:p,class:ee(["px-2 text-voix-admin-500 border-b-2",{"voix-admin-border":a.name===t.currentBreakpoint.name,"opacity-50 border-transparent":a.name!==t.currentBreakpoint.name}])},[e("button",{onClick:v=>t.$emit("resize",a.minWidth)},[e("div",{innerHTML:a.icon},null,8,uf),e("span",cf,C(a.name),1)],8,df)],2))),128))])):_("",!0)}const vf=Je(lf,[["render",pf]]),mf=At({components:{VoixViewerBreakpointSelector:vf,AnnotationTimeline:af,AnnotationDrawer:nf},props:{viewer:{type:Object,required:!0},scale:{type:Number,required:!0}},emits:["remove","closeAndReopenIframe","annotationDrawerMouseEnter","annotationDrawerMouseLeave"],setup(t,{emit:n}){const i=Se(),r=qe(),u=$n(),c=$(null),a=Ke("currentIframeViewers",()=>[]),p=$(0),v=$(0),d=$(!1),m=$(!1),b=380,f=2400,l=400,w=2e3,x=$(!1),L=tt("voix-page-viewer-resize"),j=i.currentPath.toString(),R=S=>S.replace(/\/+$/,"")||"/",M=$(!1),I=$(null),F=$("default"),V=$(0),H=$(0),P=$(0);let Q=null,X=null;const ne=h(()=>{if(j){const S=pn.parseUrl(j);S.query["voix-sync"]=u.currentAdminId,S.query["voix-viewer"]=t.viewer.guid,S.query["cache-buster"]=Ut(),S.query["show-grid"]=x.value?"true":"false";let ae=S.url;return ae[0]==="/"&&(ae=S.url.slice(1)),`/${ae}?${pn.stringify(S.query)}`}return null}),G=$(null);ze(()=>{window.addEventListener("mouseup",ie),window.addEventListener("mousemove",W)}),Rt(()=>{window.removeEventListener("mouseup",ie),window.removeEventListener("mousemove",W),clearInterval(G.value),X&&Q&&(X.removeEventListener("scroll",Q),X.removeEventListener("resize",Q),X=null,Q=null)});function z(S){t.viewer.width=S,L.value=S.toString()}function Y(S,ae){d.value=!0,m.value=ae==="vertical",p.value=S.clientX,v.value=S.clientY}function ie(){d.value=!1,m.value=!1,L.value=t.viewer.width.toString()}function W(S){if(d.value)if(m.value){const ae=S.clientY-v.value;if(c.value){const re=c.value.offsetHeight+ae;re>=l&&re<=w&&(c.value.style.height=`${re}px`)}v.value=S.clientY}else t.viewer.width+=S.clientX-p.value,t.viewer.width<b&&(t.viewer.width=b),t.viewer.width>f&&(t.viewer.width=f),p.value=S.clientX}const E=S=>{const ae=S.target;ae&&Number.parseInt(ae.value)>380&&(t.viewer.width=Number.parseInt(ae.value),ae.blur())};function g(){L.value=null,t.viewer.width=Math.floor(window.innerWidth-96-360)}const y=h(()=>r.scrollToElement?r.scrollToElement?.properties?.dom_id?r.scrollToElement?.properties?.dom_id:`voix-${r.scrollToElement.type}-${r.scrollToElement.id}`:null),A=Oe();we(y,S=>{if(S&&c.value&&y.value){const ae=c.value.contentDocument?.getElementById(y.value);ae?(ae.scrollIntoView(),setTimeout(()=>{r.scrollToElement=null},1e3)):A.add("Could not find this slice. This is probably due to it the slice having multiple divs","warning")}});function J(){G.value&&clearInterval(G.value),G.value=setInterval(()=>{const S=c.value?.contentWindow?.location.pathname;(S===void 0||R(S)!==R(j))&&n("closeAndReopenIframe")},1e3),O()}const D=wt(),U=h(()=>
34{if(i.currentPage?.layout){const S=i.currentPage.layout;if(D.layouts[S]&&D.layouts[S].grid)return!0}return!1});we(()=>c.value,S=>{if(S&&r.isReviewMode){const ae=a.value.findIndex(re=>re.guid===t.viewer.guid);if(ae!==-1){const re=[380,768,1280],Me=["sm","md","default"];re[ae]&&(z(re[ae]),F.value=Me[ae]??"default")}}});function O(){if(!c.value?.contentWindow)return;X&&Q&&(X.removeEventListener("scroll",Q),X.removeEventListener("resize",Q));const S=c.value.contentWindow,ae=S.document,re=()=>{ae.documentElement&&(V.value=ae.documentElement.scrollTop||ae.body.scrollTop,H.value=ae.documentElement.scrollHeight||ae.body.scrollHeight,P.value=ae.documentElement.clientHeight||ae.body.clientHeight)};re(),S.addEventListener("scroll",re),S.addEventListener("resize",re),X=S,Q=re}function T(S){I.value=S,M.value=!0,i.currentPage&&(i.currentPage.review_status="declined",i.currentPage.review?i.currentPage.review.status="declined":i.currentPage.review={status:"declined"})}function K(S){I.value=S,M.value=!0,c.value?.contentWindow&&c.value.contentWindow.scrollTo({top:S.y-P.value/2,behavior:"smooth"})}function B(S,ae){F.value=ae,I.value=S,M.value=!0,c.value?.contentWindow&&c.value.contentWindow.scrollTo({top:S.y-P.value/2,behavior:"smooth"})}return{emit:n,props:t,theIframe:c,iframeLoaded:J,isResizing:d,pageStore:i,pagePath:ne,startResize:Y,stopResize:ie,resizeToBreakpoint:z,openAnnotationFromCycle:B,setWi
34dth:E,resetViewerWidth:g,showGridOverlay:x,layoutHasGrid:U,adminStore:r,showAnnotationDrawer:M,selectedAnnotation:I,currentBreakpoint:F,handleAnnotationCreated:T,handleAnnotationClicked:K,iframeScrollTop:V,iframeScrollHeight:H,iframeClientHeight:P}}}),gf={class:"flex justify-center items-start"},xf={class:"relative flex flex-col justify-center items-center"},ff={class:"absolute bottom-0 left-0 -mb-12 flex items-center"},bf=["value"],hf=["disabled","title"],yf={class:"flex space-x-2"},wf={class:"absolute top-0 right-0 mt-3 flex items-center"},kf={key:1,class:"flex"},_f=["data-voix-viewer","src"];function $f(t,n,i,r,u,c){const a=Le,p=Ie("VoixViewerBreakpointSelector"),v=Ie("AnnotationTimeline"),d=Ie("AnnotationDrawer");return o(),s("div",{style:Ee({transform:`scale(${t.props.scale})`,width:`${t.props.viewer.width*t.props.scale}px`})},[e("div",gf,[e("div",xf,[e("div",ff,[e("input",{type:"text",value:t.props.viewer.width,class:"inline w-24 items-center px-3 pr-6 py-0.5 rounded-full text-sm font-medium bg-voix-admin-50 text-voix-admin-600 border-0",onKeyup:n[0]||(n[0]=Qt((...m)=>t.setWidth&&t.setWidth(...m),["enter"]))},null,40,bf),n[12]||(n[12]=e("span",{class:"absolute right-0 top-0 mr-2 mt-0.5 text-voix-admin-300 text-sm font-medium"},"px",-1))]),e("button",{class:ee(["absolute top-0 left-0 mb-0",{"opacity-30":!t.layoutHasGrid}]),disabled:!t.layoutHasGrid,title:t.layoutHasGrid?"Show Grid Overlay":"This layout has no grid configuration",onClick:n[1]||(n[1]=m=>t.showGridOverlay=!t.showGridOverlay)},[k(a,{name:"heroicons:view-columns",size:"24",class:ee(["text-voix-admin-500",{"opacity-50":!t.showGridOverlay}])},null,8,["class"]),n[13]||(n[13]=e("span",{class:"block mt-1 text-[10px] font-semibold tracking-wider uppercase text-voix-admin-500"}," Grid ",-1))],10,hf),e("div",yf,[k(p,{class:"text-voix-admin-300 mb-1","viewer-width":t.props.viewer.width,onResize:t.resizeToBreakpoint},null,8,["viewer-width","onResize"])]),e("div",wf,[e("button",{onClick:n[2]||(n[2]=m=>t.$emit("remove"))},[k(a,{name:"heroicons:x-mark-20-solid",size:"24",class:"text-voix-admin-500"})])]),e("div",{class:"relative",style:Ee({width:`${t.props.viewer.width}px`})},[n[16]||(n[16]=e("div",{class:"absolute z-0 inset-0 opacity-40 shadow-gray-500 shadow-2xl/25"},null,-1)),t.adminStore.isReviewMode&&t.theIframe?(o(),se(v,{key:0,breakpoint:t.currentBreakpoint,"viewer-guid":t.props.viewer.guid,"iframe-height":800,"scroll-top":t.iframeScrollTop,"scroll-height":t.iframeScrollHeight,"client-height":t.iframeClientHeight,onAnnotationCreated:t.handleAnnotationCreated,onAnnotationClicked:t.handleAnnotationClicked},null,8,["breakpoint","viewer-guid","scroll-top","scroll-height","client-height","onAnnotationCreated","onAnnotationClicked"])):_("",!0),t.pagePath?(o(),s("div",kf,[e("iframe",{ref:"theIframe","data-testid":"voix-studio-iframe","data-voix-viewer":t.props.viewer.guid,src:t.pagePath,width:"100%",class:"relative z-10 bg-white h-[80vh] max-h-[calc(100vh-200px)]",onLoad:n[3]||(n[3]=(...m)=>t.iframeLoaded&&t.iframeLoaded(...m))},null,40,_f),e("div",{class:ee(["absolute z-10 inset-0",{"pointer-events-none":!t.isResizing}])},null,2),e("div",{class:"relative z-20 -mr-6 flex items-center justify-center w-6 bg-voix-admin-100/80 border-l border-voix-admin-200/60 rounded-r-xl cursor-ew-resize",onMousedown:n[4]||(n[4]=je(m=>t.startResize(m,"horizontal"),["stop","prevent"])),onMouseup:n[5]||(n[5]=je((...m)=>t.stopResize&&t.stopResize(...m),["stop","prevent"])),onDblclick:n[6]||(n[6]=je((...m)=>t.resetViewerWidth&&t.resetViewerWidth(...m),["stop","prevent"]))},[...n[14]||(n[14]=[e("svg",{class:"w-4 h-4 transform rotate-90 text-voix-admin-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 6h16M4 10h16M4 14h16M4 18h16"})],-1)])],32),e("div",{class:"absolute z-20 bottom-[-1px] left-0 right-0 h-6 bg-voix-admin-100/80 border-t border-voix-admin-200/60 cursor-ns-resize flex items-center justify-center",onMousedown:n[7]||(n[7]=je(m=>t.startResize(m,"vertical"),["stop","prevent"])),onMouseup:n[8]||(n[8]=je((...m)=>t.stopResize&&t.stopResize(...m),["stop","prevent"]))},[...n[15]||(n[15]=[e("svg",{class:"w-4 h-4 text-voix-admin-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 6h16M4 10
34h16M4 14h16M4 18h16"})],-1)])],32)])):_("",!0)],4)])]),k(d,{visible:t.showAnnotationDrawer,annotation:t.selectedAnnotation,breakpoint:t.currentBreakpoint,onClose:n[9]||(n[9]=m=>t.showAnnotationDrawer=!1),onMouseEnter:n[10]||(n[10]=m=>t.emit("annotationDrawerMouseEnter")),onMouseLeave:n[11]||(n[11]=m=>t.emit("annotationDrawerMouseLeave"))},null,8,["visible","annotation","breakpoint"])],4)}const Sf=Je(mf,[["render",$f]]);function Cf(){const t=Se(),n=Kt(),i=r=>{if(n.name==="voix-studio-en"&&t.currentPageIsDirty)return r.preventDefault(),r.returnValue="You have some unsaved changes. Are you sure you want to leave?",r.returnValue};ze(()=>{n.name==="voix-studio-en"&&window.addEventListener("beforeunload",i)}),Rt(()=>{window.removeEventListener("beforeunload",i)})}const Pf=/[xy]/g;function Ef(){const t=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(Pf,r=>{const u=Math.random()*16|0;return(r==="x"?u:u&3|8).toString(16)}),n=()=>typeof window>"u"?!1:window.parent!==window;return{guid:t,isInIframe:n,isTopLevelWindow:n}}function Tf(){const t=Se(),n=$n();function i(){const u=t.currentPath||t.currentPage?.path||"/";let c=new URL(u,window.location.origin);return c.origin!==window.location.origin&&(c=new URL("/",window.location.origin)),c.searchParams.set("voix-sync",String(n.currentAdminId)),`${c.pathname}${c.search}`}function r(){typeof window>"u"||window.open(i(),"_blank","noopener,noreferrer")}return{openInNewTab:r}}const If={class:"relative overflow-hidden flex h-screen"},Af={class:"relative flex-1 min-w-0 flex flex-col h-screen"},Vf={key:0,class:"absolute inset-x-0 top-0 h-[2px] bg-voix-admin-800 pointer-events-none"},Rf={class:"flex items-center gap-2 min-w-0"},Lf={class:"truncate text-xs text-voix-admin-700 font-medium font-mono"},Mf=["disabled"],Df={key:0,class:"absolute bottom-4 left-4 z-20 inline-flex items-center gap-2 px-3 h-8 rounded-full bg-voix-admin-900/90 backdrop-blur text-white text-[11px] font-medium shadow-lg"},Ff={class:"bg-white rounded p-4 md:w-[500px] text-base"},jf={class:"mt-4 flex justify-end space-x-3 text-sm"},Of={class:"bg-white rounded p-4 md:w-[500px] text-base"},zf={class:"font-bold text-voix-admin-500"},Uf={class:"mt-4 flex justify-end space-x-3 text-sm"},qf={class:"bg-white rounded p-4 md:w-[500px] text-base"},Nf={class:"mt-4 flex justify-end space-x-3 text-sm"},Bf={__name:"studio",props:{currentScale:{type:Number,required:!0}},setup(t){const n=t,i=Ef(),{openInNewTab:r}=Tf(),u=Kt(),c=wn(),a=qe(),p=Se(),v=Vt(),{fetchCurrentPage:d}=ft(),{analytics:m}=Lt(),b=Ke("editModeViewerWidth",()=>1024),f=tt("voix-page-viewer-resize"),l=Ke("annotationCycleIndex",()=>-1),w=v.currentUser,x=typeof window<"u",L=Ke("showHeatmap",()=>!1),j=h(()=>p.currentPage?.path??""),R=Ke("currentIframeViewers",()=>[]),M=$(null),I=u.query,F=tt("voix-studio-viewports",{default:()=>[],maxAge:3600*24*365});function V(oe){return oe.filter(q=>Number.isFinite(q)&&q>=320&&q<=5120).slice(0,12).map(q=>({width:q,guid:i.guid()}))}Cf();const H=typeof I.editing=="string"&&typeof I.review=="string";if(I.editing&&typeof I.editing=="string"&&ie(I.editing,void 0),R.value.length===0){const oe=V(F.value??[]);oe.length>0?R.value=oe:x?R.value=[{width:Math.floor(window.innerWidth-96-360),guid:i.guid()}]:T({notify:!1})}const P=$(!1),Q=$(!1),X=$(void 0),ne=$(void 0),G=$({display:!1,disabled:!1}),z=$(!1),Y=$(null);En("currentPageQuery",Y);function ie(oe,q){d(xt({path:oe})).then(ye=>{if(Y.value=ye,ye?.status!==200&&(P.value=!0),ye?.page?.auto_localize===!0){X.value=oe,ne.value=q,Q.value=!0;return}Ze({name:"voix-studio-en",query:{editing:oe,review:void 0}})})}async function W(){const oe=p.currentPage;if(oe?.id)try{await _e(`/api/admin/voix/ai/pages/${oe.id}/auto-localize/disable`,{method:"PATCH"}),oe.auto_localize=!1}catch(q){console.error("Failed to disable auto-localize",q),Q.value=!1;return}Q.value=!1,Ze({name:"voix-studio-en",query:{editing:X.value,review:ne.value?"true":void 0}})}function E(){Q.value=!1}const g=h(()=>a.releaseId!==null),y=h(()=>p.currentPage?.draft_release?.id),A=h(()=>{const oe=typeof y.value<"u",q=oe&&!g.value,ye=oe&&g.value&&a.releaseId!==y.value;return q&&!a.isLoading||ye&&!a.isLoading}),J=h(()=>p.currentPage?.draft_release?.user_name),D=h(()=>w?.id.toString()===p.currentPage?.draft_release?.user_id?.toString());
34function U(){y.value&&(a.setReleaseId(y.value),p.currentPage&&ie(p.currentPage.path,void 0))}function O(){const oe=p.currentPage?.draft_release?.id;oe&&Wt({id:oe}).then(()=>{a.unsetReleaseId(),p.currentPage&&ie(p.currentPage.path,void 0)})}function T({notify:oe=!0}={}){R.value.push({width:1024,guid:i.guid()}),oe&&Oe().add("Viewport added","msg"),nt(()=>{M.value&&M.value.scrollTo({left:M.value.scrollWidth,behavior:"smooth"})})}function K(oe){R.value.length>1&&R.value.splice(oe,1)}const B=$(null);let S=0;function ae(){const oe=M.value;if(!oe)return;const q=oe.scrollLeft+oe.clientWidth/2;let ye=null,Ge=Number.POSITIVE_INFINITY;oe.querySelectorAll("[data-viewer-guid]").forEach(Te=>{const dt=Math.abs(Te.offsetLeft+Te.offsetWidth/2-q);dt<Ge&&(Ge=dt,ye=Te.dataset.viewerGuid??null)}),B.value=ye}function re(){S||(S=requestAnimationFrame(()=>{S=0,ae()}))}we(R,()=>nt(ae),{deep:!0});function Me(oe){const q=M.value;if(!q)return;const ye=q.querySelector(`[data-viewer-guid="${oe}"]`);ye&&q.scrollTo({left:ye.offsetLeft+ye.offsetWidth/2-q.clientWidth/2,behavior:"smooth"})}let He;we(R,()=>{a.isReviewMode||(clearTimeout(He),He=setTimeout(()=>{a.isReviewMode||(F.value=R.value.map(oe=>oe.width))},250))},{deep:!0});function We(){const oe=Jt().getAllBreakpoints.find(q=>q.name==="md");R.value=[{width:oe?.minWidth??768,guid:i.guid()}],Oe().add("Viewports cleared","msg"),nt(()=>M.value?.scrollTo({left:0,behavior:"smooth"}))}function Ce(oe){T(),K(oe)}const de=io(),Ne=h(()=>de.currentAlert==="unsaved-draft");function Re(){de.clearAlert()}function kt(){const oe=tt("voix-release-preview");oe.value=null;const q=JSON.parse(JSON.stringify(de.to.value)),ye=p.currentPage?.draft_release?.id;ye&&Wt({id:ye}).then(()=>{Ze(q)})}const it=Ke("currentlySelectedElements",()=>[]),et=Ke("cyclingAnnotation"),mt=$({}),st=$(!1),Xe=$(!1),at=$(!1),ve=$({x:0,y:0}),be=tt("voix-studio-zoom-hint-dismissed",{default:()=>!1}),Ae=h(()=>!be.value&&a.currentScale===1),he=$(!1);function ke(){st.value=!0}function De(){st.value=!1,Xe.value=!1}function Pe(oe){(oe.button===0||oe.button===1)&&(Xe.value=!0,ve.value={x:oe.clientX,y:oe.clientY})}function gt(oe){if(Xe.value&&M.value){const q=ve.value.x-oe.clientX,ye=ve.value.y-oe.clientY;M.value.scrollLeft+=q,M.value.scrollTop+=ye,ve.value={x:oe.clientX,y:oe.clientY},setTimeout(()=>{at.value=!0},100)}else at.value=!1}function lt(){Xe.value=!1}function rt(oe){if(he.value)return;const q=oe.target;if(q.closest(".annotation-drawer")||q.closest(".annotation-dot")||q.closest(".annotation-timeline")||q.closest(".drawer-content"))return;const Ge=oe.ctrlKey||oe.metaKey;!st.value||!Ge||(oe.preventDefault(),oe.deltaY<0?(a.currentScale+=.1,a.currentScale>1&&(a.currentScale=1)):(a.currentScale-=.1,a.currentScale<.2&&(a.currentScale=.2)))}const Ye=h(()=>{if(!p.currentPage?.review?.annotations)return 0;let oe=0;for(const q in p.currentPage.review.annotations)oe+=p.currentPage.review.annotations[q].length;return oe}),Be=h(()=>{if(!p.currentPage?.review?.annotations)return 0;let oe=0;for(const q in p.currentPage.review.annotations)oe+=p.currentPage.review.annotations[q].filter(ye=>!ye.resolved).length;return oe});function _t(){const oe=[];if(!p.currentPage?.review?.annotations)return oe;const q={};a.isReviewMode&&R.value.length>=3?(q.sm=R.value[0]?.guid,q.md=R.value[1]?.guid,q.default=R.value[2]?.guid):R.value.length>0&&(q.default=R.value[0]?.guid,q.sm=R.value[0]?.guid,q.md=R.value[0]?.guid);for(const ye in p.currentPage.review.annotations)for(const Ge of p.currentPage.review.annotations[ye])oe.push({annotation:Ge,breakpoint:ye,viewerGuid:q[ye]});return oe.sort((ye,Ge)=>{const Te=new Date(ye.annotation.created_at).getTime(),dt=new Date(Ge.annotation.created_at).getTime();return Te-dt}),oe}function te(){const oe=_t();oe.length!==0&&(l.value=(l.value+1)%oe.length,et.value=oe[l.value]??null)}function Z(){a.currentScale=1}function Fe(oe){(oe.metaKey||oe.ctrlKey)&&oe.key==="0"&&(oe.preventDefault(),Z())}ze(()=>{window.addEventListener("keydown",Fe),nt(ae)}),co(()=>{window.removeEventListener("keydown",Fe),S&&cancelAnimationFrame(S)});async function me(){try{if(!p.currentPage?.id)throw new Error("No page ID found");p.currentPage&&(p.currentPage.review_status="approved",a.isReviewM
34ode=!1)}catch(oe){console.error("Error updating review status:",oe),Oe().add("Failed to update review status. Please try again.","error")}}function Qe(oe){a.isReviewMode=oe}function Jn(){a.isReviewMode&&(a.isReviewMode=!1)}we(()=>a.isReviewMode,oe=>{const q={...u.query};if(oe){q.review="true";const ye=R.value[0];R.value.length===1&&ye&&(b.value=ye.width,f.value=ye.width.toString()),R.value=[{width:380,guid:i.guid()},{width:768,guid:i.guid()},{width:1280,guid:i.guid()}]}else{delete q.review;const ye=V(F.value??[]);R.value=ye.length>0?ye:[{width:b.value,guid:i.guid()}],f.value=b.value.toString()}c.replace({query:q})}),we(et,(oe,q)=>{if(oe&&oe!==q&&oe.viewerGuid){const ye=mt.value[oe.viewerGuid];if(ye){const Ge=document.querySelector(`[data-viewer-guid="${oe.viewerGuid}"]`);if(Ge&&M.value){const Te=Ge.getBoundingClientRect(),dt=M.value.getBoundingClientRect(),$t=M.value.scrollLeft+Te.left-dt.left-100;M.value.scrollTo({left:$t,behavior:"smooth"})}setTimeout(()=>{et.value===oe&&(ye.openAnnotationFromCycle(oe.annotation,oe.breakpoint),et.value=null)},300)}}}),ze(()=>{if(p.setUpBroadcastReceiversIfNecessary(),H){const oe=we(()=>p.currentPage?.id,q=>{q&&(oe(),a.isReviewMode=!0)},{immediate:!0})}}),Rt(()=>{de.clearAlert(),a.unselectAll()});function Qn(){a.unselectAll()}function Zn(){he.value=!0}function eo(){he.value=!1}return(oe,q)=>{const ye=Le,Ge=Zt("voix-popper");return o(),s("div",If,[e("div",{class:ee(["flex-none overflow-hidden transition-[width] duration-200 ease-out",N(a).isReviewMode?"w-0":"w-[280px]"])},[x&&N(p).currentPage?(o(),se(dm,{key:0,class:"h-full",onShowPathWarning:q[0]||(q[0]=Te=>G.value.display=!0),onShowExportModal:q[1]||(q[1]=Te=>z.value=!0)})):_("",!0)],2),e("div",Af,[e("div",{class:ee(["relative flex-none flex items-center gap-3 h-11 px-4 backdrop-blur border-b transition-colors",[N(a).isReviewMode?"bg-voix-admin-100/65 border-voix-admin-300/55":"bg-voix-admin-50/90 border-voix-admin-200/60",N(p).currentPageIsDirty?"!border-amber-300/50":""]]),style:Ee(N(p).currentPageIsDirty?"background-image: linear-gradient(to top, rgba(245,158,11,0.08), transparent 70%);":void 0)},[N(a).isReviewMode?(o(),s("div",Vf)):_("",!0),e("div",Rf,[q[17]||(q[17]=e("span",{class:"text-[10px] font-semibold tracking-wider uppercase text-voix-admin-400 flex-none"}," Editing ",-1)),e("span",Lf,C(N(p).currentPage?.path||"/"),1)]),q[24]||(q[24]=e("span",{class:"flex-none w-px h-4 bg-voix-admin-200/60"},null,-1)),e("div",{class:ee(["flex-none inline-flex items-center h-7 p-[2px] rounded-lg border",N(a).isReviewMode?"bg-voix-admin-200/50 border-voix-admin-300/50":"bg-voix-admin-100/70 border-voix-admin-200/60"])},[e("button",{class:ee(["inline-flex items-center gap-1 px-2.5 h-full text-[11px] font-semibold rounded-md transition-colors",N(a).isReviewMode?"text-voix-admin-500 hover:text-voix-admin-700":"bg-white text-voix-admin-900 shadow-sm ring-1 ring-voix-admin-200/50"]),onClick:q[2]||(q[2]=Te=>Qe(!1))},[k(ye,{name:"heroicons:pencil-square",size:"12"}),q[18]||(q[18]=e("span",null,"Edit",-1))],2),e("button",{class:ee(["inline-flex items-center gap-1 px-2.5 h-full text-[11px] font-semibold rounded-md transition-colors relative",N(a).isReviewMode?"bg-voix-admin-800 text-voix-admin-50 shadow-sm":"text-voix-admin-500 hover:text-voix-admin-700"]),onClick:q[3]||(q[3]=Te=>Qe(!0))},[k(ye,{name:"heroicons:eye",size:"12"}),q[19]||(q[19]=e("span",null,"Review",-1)),Ye.value>0?(o(),s("span",{key:0,class:ee(["absolute -top-1 -right-1 flex items-center justify-center min-w-[16px] h-[16px] px-1 text-[9px] font-bold text-white rounded-full",Be.value>0?"bg-red-500":"bg-green-500"])},C(Be.value>0?Be.value:Ye.value),3)):_("",!0)],2)],2),N(p).currentPage?.path?ue((o(),s("button",{key:1,class:ee(["flex-none inline-flex items-center gap-1 px-2.5 h-7 rounded-md border text-[11px] font-semibold transition-colors",N(a).isReviewMode?"bg-voix-admin-200/50 border-voix-admin-300/50 text-voix-admin-600 hover:bg-white hover:text-voix-admin-900":"bg-white/70 border-voix-admin-200/60 text-voix-admin-600 hover:bg-white hover:text-voix-admin-900"]),onClick:q[4]||(q[4]=(...Te)=>N(r)&&N(r)(...Te))},[k(ye,{name:"heroicons:arrow-top-right-on-square",size:"12"}
34),q[20]||(q[20]=e("span",null,"View page",-1))],2)),[[Ge,"<span class='text-xs'>Open the live page in a new tab, synced with this studio session</span>","#app",{top:!0}]]):_("",!0),q[25]||(q[25]=e("div",{class:"flex-1"},null,-1)),N(p).currentPageIsDirty?(o(),s("button",{key:2,class:"flex-none inline-flex items-center gap-1.5 px-3 h-7 rounded-md border border-amber-300 bg-amber-50 text-[11px] font-bold text-amber-900 hover:bg-amber-100 transition-colors",onClick:Jn},[...q[21]||(q[21]=[e("span",{class:"w-1.5 h-1.5 rounded-full bg-amber-500 ring-[3px] ring-amber-500/20"},null,-1),e("span",null,"Save changes",-1)])])):_("",!0),N(a).isReviewMode&&Ye.value>0?ue((o(),s("button",{key:3,class:"flex-none inline-flex items-center gap-1.5 px-3 h-7 rounded-md border border-voix-admin-200/70 bg-white text-[11px] font-semibold text-voix-admin-700 hover:bg-voix-admin-50 transition-colors",onClick:te},[e("span",{class:ee(["w-1.5 h-1.5 rounded-full",Be.value>0?"bg-red-500 ring-[3px] ring-red-500/15":"bg-green-500"])},null,2),k(ye,{name:"heroicons:chat-bubble-left-right",size:"12"}),e("span",null,C(Be.value)+" / "+C(Ye.value)+" unresolved",1)])),[[Ge,`Click to cycle through annotations — ${Be.value} unresolved / ${Ye.value} total`,"#app",{top:!0}]]):_("",!0),N(a).isReviewMode?ue((o(),s("button",{key:4,class:ee(["flex-none inline-flex items-center gap-1.5 px-3 h-7 rounded-md text-[11px] font-bold text-white bg-voix-admin-800 hover:bg-voix-admin-900 transition-colors",{"opacity-45 cursor-not-allowed hover:bg-voix-admin-800":Be.value>0}]),disabled:Be.value>0,onClick:me},[k(ye,{name:"heroicons:hand-thumb-up",size:"12"}),q[22]||(q[22]=e("span",null,"Looks Great",-1))],10,Mf)),[[Ge,"<span class='text-xs'>Approve Page — all annotations must be resolved</span>","#app",{top:!0}]]):_("",!0),!N(a).isReviewMode&&N(m)?(o(),s("button",{key:5,class:"flex-none inline-flex items-center gap-1.5 px-2.5 h-7 rounded-md bg-white border border-voix-admin-200/70 text-[11px] font-semibold text-voix-admin-600 hover:bg-voix-admin-500 hover:text-white hover:border-voix-admin-500 transition-colors",onClick:q[5]||(q[5]=Te=>L.value=!N(L))},[k(ye,{name:"heroicons:fire",size:"12"}),q[23]||(q[23]=e("span",null,"Heatmap",-1))])):_("",!0),ue((o(),s("button",{class:"flex-none inline-flex items-center justify-center w-7 h-7 rounded-md bg-white border border-voix-admin-200/70 text-voix-admin-500 hover:bg-voix-admin-100 hover:text-voix-admin-900 transition-colors",onClick:Z},[k(ye,{name:"heroicons:magnifying-glass-minus",size:"12"})])),[[Ge,"<span class='text-xs'>Zoom: ⌘/Ctrl + scroll · Reset (⌘0)</span>","#app",{top:!0}]])],6),x&&N(p).currentPage?(o(),se(Dx,{key:0,viewers:N(R),"active-guid":B.value,"is-review-mode":N(a).isReviewMode,onJump:Me,onAdd:q[6]||(q[6]=Te=>T()),onClear:We},null,8,["viewers","active-guid","is-review-mode"])):_("",!0),x&&N(p).currentPage?(o(),s("div",{key:1,ref_key:"containerRef",ref:M,class:ee(["relative z-0 flex-1 flex items-center overflow-x-scroll overflow-y-hidden space-x-24 pl-12 transform-gpu duration-300",[N(it).length>0?"pr-[388px]":"pr-12",{"cursor-grab":!Xe.value,"cursor-grabbing":Xe.value}]]),onScrollPassive:re,onMouseenter:ke,onMouseleave:De,onWheel:rt,onMousedown:Pe,onMousemove:gt,onMouseup:lt},[e("div",{class:"absolute inset-0",onClick:Qn}),(o(!0),s(le,null,fe(N(R),(Te,dt)=>(o(),se(Sf,{ref_for:!0,ref:$t=>{$t&&(mt.value[Te.guid]=$t)},key:Te.guid,viewer:Te,scale:n.currentScale,"data-viewer-guid":Te.guid,class:ee(["relative z-0 select-none",{"pointer-events-none":Xe.value&&at.value,"pointer-events-auto":!Xe.value}]),onRemove:$t=>K(dt),onCloseAndReopenIframe:$t=>Ce(dt),onAnnotationDrawerMouseEnter:Zn,onAnnotationDrawerMouseLeave:eo},null,8,["viewer","scale","data-viewer-guid","class","onRemove","onCloseAndReopenIframe"]))),128)),e("button",{class:"pointer-events-auto rounded-xl bg-white border border-dashed border-voix-admin-300/80 w-32 h-32 flex-none flex flex-col gap-2 justify-center items-center relative z-10 text-voix-admin-500 hover:border-voix-admin-500 hover:text-voix-admin-700 hover:bg-voix-admin-50 transition-colors",onClick:q[7]||(q[7]=je(Te=>T(),["stop"]))},[...q[26]||(q[26]=[e("svg",{class:"w-12 h-12",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 9v3m0 0v3m0-3h3m-3 0H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z"})],-1),e("span",{class:"text-[10px] font-semibold tracking-wider up
34percase"},"Add viewport",-1)])])],34)):_("",!0),k(Ot,{"enter-active-class":"transition-opacity duration-300","enter-from-class":"opacity-0","leave-active-class":"transition-opacity duration-200","leave-to-class":"opacity-0"},{default:pe(()=>[Ae.value?(o(),s("div",Df,[k(ye,{name:"heroicons:magnifying-glass-plus",size:"14"}),q[27]||(q[27]=e("span",null,[ce("Hold "),e("kbd",{class:"px-1 py-px rounded bg-white/20 font-semibold"},"⌘"),ce("/"),e("kbd",{class:"px-1 py-px rounded bg-white/20 font-semibold"},"Ctrl"),ce(" + scroll to zoom")],-1)),e("button",{class:"ml-1 -mr-1 inline-flex items-center justify-center w-5 h-5 rounded-full hover:bg-white/20 transition-colors","aria-label":"Dismiss zoom hint",onClick:q[8]||(q[8]=je(Te=>be.value=!0,["stop"]))},[k(ye,{name:"heroicons:x-mark",size:"12"})])])):_("",!0)]),_:1})]),N(it).length>0?(o(),se(Px,{id:"voix-property-inspector",key:N(it)[0]?.id,class:"transform duration-200 ease-out"})):_("",!0),k(ct,{show:P.value,"can-close":!1},{default:pe(()=>[e("div",Ff,[q[28]||(q[28]=e("div",{class:"uppercase font-bold text-voix-admin-600 text-base border-b border-voix-admin-500 mb-3 pb-1"}," Page Not Found ",-1)),q[29]||(q[29]=e("div",{class:"text-voix-admin-500 text-sm"}," It seems the page you are trying to edit has been redirected, archived, or may be located in an existing release. ",-1)),e("div",jf,[e("button",{class:"p-2 px-4 rounded bg-voix-admin-200 text-voix-admin-600",onClick:q[9]||(q[9]=Te=>N(Ze)({name:"voix-settings-pages-en"}))}," Back to Pages "),e("button",{class:"p-2 px-4 rounded bg-voix-admin-200 text-voix-admin-600",onClick:q[10]||(q[10]=Te=>N(Ze)({name:"voix-settings-releases-en"}))}," View Releases ")])])]),_:1},8,["show"]),k(ct,{show:A.value,"can-close":!1},{default:pe(()=>[e("div",Of,[e("div",null,[q[30]||(q[30]=ce(" There is currently a draft for this page being edited by the user: ",-1)),e("span",zf,C(J.value),1),q[31]||(q[31]=ce(". You will need them to save or discard their draft to continue. ",-1))]),e("div",Uf,[D.value?(o(),s("button",{key:0,class:"p-2 px-4 rounded bg-gray-200 text-gray-800",onClick:U}," Edit Draft ")):_("",!0),D.value?(o(),s("button",{key:1,class:"p-2 px-4 rounded bg-red-200 text-red-800",onClick:O}," Delete the Draft ")):_("",!0),D.value?_("",!0):(o(),s("button",{key:2,class:"p-2 px-4 rounded bg-gray-200 text-gray-800",onClick:U}," View Only ")),D.value?_("",!0):(o(),s("button",{key:3,class:"p-2 px-4 rounded bg-gray-200 text-gray-800",onClick:q[11]||(q[11]=Te=>N(Ze)({name:"voix-settings-pages-en"}))}," Back to Pages "))])])]),_:1},8,["show"]),k(ct,{show:Ne.value,"can-close":!1},{default:pe(()=>[e("div",{class:"bg-white rounded p-4 md:w-[500px] text-base"},[q[32]||(q[32]=e("div",{class:"uppercase font-bold text-voix-admin-600 text-base border-b border-voix-admin-500 mb-3 pb-1"}," Uncommitted Draft ",-1)),q[33]||(q[33]=e("div",{class:"text-voix-admin-500 text-sm"}," You have an uncommitted draft for this page. You can either go back and save or you can discard your changes. ",-1)),e("div",{class:"mt-4 flex justify-end space-x-3 text-sm"},[e("button",{class:"p-2 px-4 rounded bg-voix-admin-200 text-voix-admin-600",onClick:Re}," Go Back & Save "),e("button",{class:"p-2 px-4 rounded bg-red-200 text-red-800",onClick:kt}," Delete changes ")])])]),_:1},8,["show"]),k(ct,{show:Q.value,"can-close":!1},{default:pe(()=>[e("div",{class:"bg-white rounded p-4 md:w-[500px] text-base"},[q[34]||(q[34]=e("div",{class:"uppercase font-bold text-voix-admin-600 text-base border-b border-voix-admin-500 mb-3 pb-1"}," Auto-Localized Page ",-1)),q[35]||(q[35]=e("div",{class:"text-voix-admin-500 text-sm"}," This page is automatically re-localized when the primary page is published. Editing this page will disable auto-localization, and you will take manual ownership of this translation. ",-1)),e("div",{class:"mt-4 flex justify-end space-x-3 text-sm"},[e("button",{class:"p-2 px-4 rounded bg-voix-admin-200 text-voix-admin-600",onClick:E}," Cancel "),e("button",{class:"p-2 px-4 rounded bg-voix-admin-600 text-voix-admin-300",onClick:W}," Continue Editing ")])])]),_:1},8,["show"]),k(ct,{show:G.value.display&&!G.value.disabled,"can-close":!1},{default:pe(()=>[e("div",qf,[q[36]||(q[36]=e("div",{class:"uppercase font-bold text-voix-admin-600 text-base border-b border-voix-admin-500 mb-3 pb-1"}," Page Path ",-1)),q[37]||(q[37]=e("div",{class:"text-voix-admin-500 text-sm"},[ce(" Changing the page path could impact SEO and effect any in-bound links to this page. Would you prefer to create a copy of this page with the new path and keep the current page as is? "),e("br"),e("br"),e("strong",null,"Important:"),ce(' Clicking "Yes, Create a Copy" will not save any recent changes to this page. ')],-1)),e("div",Nf,[e("button",{class:"p-2 px-4 roun
34ded bg-voix-admin-200 text-voix-admin-600",onClick:q[12]||(q[12]=Te=>N(Ze)({name:"voix-settings-pages-copy-en",query:{slug:N(p).currentPage.path}}))}," Yes, Create a Copy "),e("button",{class:"p-2 px-4 rounded bg-voix-admin-600 text-voix-admin-300",onClick:q[13]||(q[13]=Te=>{G.value.display=!1,G.value.disabled=!0})}," No, I Understand ")])])]),_:1},8,["show"]),N(L)&&N(m)?(o(),se(ct,{key:1,show:N(L),"can-close":!0,"slide-fade":!1,onClose:q[14]||(q[14]=Te=>L.value=!1)},{default:pe(()=>[k(si,{"page-path":j.value},null,8,["page-path"])]),_:1},8,["show"])):_("",!0),z.value?(o(),se(Us,{key:2,show:z.value,onClose:q[15]||(q[15]=Te=>z.value=!1),onExported:q[16]||(q[16]=Te=>z.value=!1)},null,8,["show"])):_("",!0)])}}},Eb=Object.freeze(Object.defineProperty({__proto__:null,default:Bf},Symbol.toStringTag,{value:"Module"}));export{Up as A,fn as C,Dm as R,X0 as _,qt as a,ll as b,dl as c,rl as d,Nn as g,Pb as m,ul as r,Eb as s,B0 as u};

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.