(()=>{var e={n:t=>{var n=t&&t.__esModule?()=>t.default:()=>t;return e.d(n,{a:n}),n},d:(t,n)=>{for(var o in n)e.o(n,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:n[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)},t={};(()=>{"use strict";const t=window.ReactJSXRuntime,n=window.wp.element,o=window.wp.i18n,r=window.nab.data,a=window.nab.utils,i=window.wp.apiFetch;var l=e.n(i);const s=window.wp.date,c=window.wp.url,u=e=>!!e.url?.includes("/wp-json/")||!!e.url?.includes("rest_route")||!!Object.keys(e).includes("rest_route"),m=window.wp.components;Object.assign(e=>(0,t.jsx)(m.BaseControl,{__nextHasNoMarginBottom:!0,...e}),m.BaseControl),Object.assign(e=>(0,t.jsx)(m.CheckboxControl,{__nextHasNoMarginBottom:!0,...e}),m.CheckboxControl),Object.assign(e=>(0,t.jsx)(m.FormTokenField,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,...e}),m.FormTokenField),Object.assign(e=>(0,t.jsx)(m.RangeControl,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,...e}),m.RangeControl),Object.assign(e=>(0,t.jsx)(m.TextControl,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,...e}),m.TextControl),Object.assign(e=>(0,t.jsx)(m.TextareaControl,{__nextHasNoMarginBottom:!0,...e}),m.TextareaControl),Object.assign(e=>(0,t.jsx)(m.ToggleControl,{__nextHasNoMarginBottom:!0,...e}),m.ToggleControl),Object.assign(e=>(0,t.jsx)(m.__experimentalToggleGroupControl,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,...e}),m.__experimentalToggleGroupControl);const d=window.nab.components,p=({experiment:e,alternative:n})=>{const[r,a]=x(e,n),[i,l]=g();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(m.Button,{className:"page-title-action",onClick:()=>l(!0),style:{height:"auto"},children:(0,o._x)("Duplicate Control Menu","command","nelio-ab-testing")}),(0,t.jsx)(d.ConfirmationDialog,{title:(0,o._x)("Duplicate Control Menu?","title","nelio-ab-testing"),text:(0,o._x)("This will overwrite the items in your menu variant using those included in the control menu. Are you sure you want to continue?","user","nelio-ab-testing"),confirmLabel:r?(0,o._x)("Duplicating…","text (widgets)","nelio-ab-testing"):(0,o._x)("Duplicate","command","nelio-ab-testing"),isConfirmEnabled:!r,isCancelEnabled:!r,isOpen:i,onCancel:()=>l(!1),onConfirm:a})]})},g=()=>(0,r.usePageAttribute)("menus/isConfirmationDialogForMenuDuplicationVisible",!1),x=(e,t)=>{const[n,o]=(0,r.usePageAttribute)("menus/isDuplicatingMenu",!1);return[n,()=>{n||(o(!0),(e=>{const{url:t,path:n}=e,o=(0,s.format)("YmjHi").substring(0,11)+"0";return l()({...e,...t&&{url:u(e)?(0,c.addQueryArgs)(t,{nabts:o}):t},...n&&{path:(0,c.addQueryArgs)(n,{nabts:o})},parse:!0})})({path:(0,c.addQueryArgs)("/nab/v1/menu/duplicate-control",{experiment:e,alternative:t}),method:"PUT"}).finally(()=>{window.location.reload()}))}]};var b;window.nab={...(b=window,b&&"object"==typeof b&&"nab"in b?window.nab:{}),initAlternativeEdition:function(e){!function(){const e=document.querySelector("#wpbody-content .wrap .wp-heading-inline");e&&(e.textContent=(0,o._x)("Menu Variant","text","nelio-ab-testing"))}(),Array.from(document.querySelectorAll("#message.updated.notice")).forEach(e=>{const t=(0,o._x)("<strong>Menu variant</strong> has been updated.","text","nelio-ab-testing");e.innerHTML=`<p>${t}</p>`}),Array.from(document.querySelectorAll(".wrap > .page-title-action")).forEach(e=>e.remove()),Array.from(document.querySelectorAll(".wrap > .nav-tab-wrapper")).forEach(e=>e.remove()),Array.from(document.querySelectorAll(".wrap > .manage-menus")).forEach(e=>e.remove()),Array.from(document.querySelectorAll("#menu-name, .menu-name-label")).forEach(e=>e.style.display="none"),Array.from(document.querySelectorAll("#nav-menu-footer .delete-action")).forEach(e=>e.remove()),Array.from(document.querySelectorAll(".menu-settings")).forEach(e=>e.remove()),function(e){const r=document.querySelector("#wpbody-content .wrap .wp-heading-inline"),i=document.createElement("span");var l,s;l=(0,t.jsx)(p,{experiment:e.experiment,alternative:e.alternative}),(s=i)&&(n.createRoot?(0,n.createRoot)(s).render(l):(0,n.render)(l,s));const c=document.createElement("a");c.className="page-title-action",c.textContent=(0,o._x)("Back to Test","command","nelio-ab-testing"),c.setAttribute("href",e.links.experimentUrl),r&&((0,a.appendSibling)(c,r),(0,a.appendSibling)(i,r))}(e)}}})();var n=nab="undefined"==typeof nab?{}:nab;for(var o in t)n[o]=t[o];t.__esModule&&Object.defineProperty(n,"__esModule",{value:!0})})();