!function(e){function n(e,n){e.set(Object.assign({},_.clone(e()),{roles:n}))}function i(e){const n=e.setting().roles||"",i="hide"===e.setting().display_mode?"hide":"show",t=_.isArray(n)?"in":n,d=_.isArray(n)?n:[];e.rolesFieldset.toggle("in"===t);const o=e.modeFieldset.find(`input[type = radio][value = "${i}"]`),s=e.authFieldset.find(`input[type = radio][value = "${t}"]`);o.prop("checked",!0),s.prop("checked",!0),e.rolesFieldset.find("input[type=checkbox]").each((function(){this.checked=d.includes(this.value)}))}e.control.bind("add",(t=>{t.extended(e.Menus.MenuItemControl)&&t.deferred.embedded.done((()=>{!function(e){e.modeFieldset=e.container.find(".nav_menu_role_display_mode"),e.authFieldset=e.container.find(".nav_menu_role_authentication"),e.rolesFieldset=e.container.find(".nav_menu_roles"),i(e),e.setting.bind((()=>{i(e)})),e.modeFieldset.find("input").on("click",(function(){var n,i;n=e.setting,i=this.value,n.set(Object.assign({},_.clone(n()),{display_mode:i}))})),e.authFieldset.find("input").on("click",(function(){n(e.setting,this.value)})),e.rolesFieldset.find("input").on("click",(function(){const i=[];e.rolesFieldset.find(":checked").each((function(){i.push(this.value)})),n(e.setting,0===i.length?"in":i)}))}(t)}))}))}(wp.customize);