jQuery(document).ready(function($){
window.xooEl=window.xooEl||{};
function objectifyForm($form){
var form=$form instanceof jQuery ? $form[0]:$form;
var formData=new FormData(form);
var result={};
formData.forEach(function(value, name){
if(value instanceof File) return;
if(result.hasOwnProperty(name)){
if(!Array.isArray(result[name])){
result[name]=[result[name]];
}
result[name].push(value);
}else{
result[name]=value;
}});
return result;
}
function parse_notice(message, type){
type=(typeof type!=='undefined') ? type:'error';
return xoo_el_localize.html.notice[ type ].replace('%s', message);
}
var classReferral={
'xoo-el-login-tgr': 'login',
'xoo-el-reg-tgr': 'register',
}
function getReferral(className){
return classReferral[className] ? classReferral[className]:'';
}
function getFormsTrigger($container){
$container=$container||'';
var isSingle=false;
if($container.length&&$container.find('.xoo-el-section[data-section="single"]').length){
isSingle=true;
}
var formsTrigger={
'xoo-el-sing-tgr': 'single',
'xoo-el-login-tgr': isSingle ? 'single':'login',
'xoo-el-reg-tgr': isSingle ? 'single':'register',
'xoo-el-lostpw-tgr': 'lostpw',
'xoo-el-resetpw-tgr': 'resetpw',
'xoo-el-forcereg-tgr': 'register',
'xoo-el-forcelogin-tgr': 'login',
}
return formsTrigger;
}
class Container{
constructor($container){
this.$container=$container;
this.$tabs=$container.find('ul.xoo-el-tabs').length ? $container.find('ul.xoo-el-tabs'):null;
this.display=$container.hasClass('xoo-el-form-inline') ? 'inline':'popup';
this.formRetries=0;
if(this.$container.attr('data-active')){
this.toggleForm(this.$container.attr('data-active'));
}
this.createFormsTriggerHTML();
this.eventHandlers();
}
createFormsTriggerHTML(){
var HTML='<div style="display: none!important;">';
$.each(getFormsTrigger(this.$container), function(triggerClass, type){
HTML +='<span class="'+triggerClass+'"></span>';
})
HTML +='</div>';
this.$container.append(HTML);
}
eventHandlers(){
this.$container.on('submit', '.xoo-el-action-form', this.submitForm.bind(this)) ;
this.$container.on('click', '.xoo-el-edit-em', this.emailFieldEditClick.bind(this));
$(document.body).on('xoo_el_form_submitted', this.singleFormProcess.bind(this));
this.formTriggerEvent();
}
emailFieldEditClick(e){
this.toggleForm('single');
this.$container.find('input[name="xoo-el-sing-user"]').val($(e.currentTarget).siblings('input').val()).focus().trigger('keyup');
}
formTriggerEvent(){
var container=this,
formsTrigger=getFormsTrigger(container.$container);
$.each(formsTrigger, function(triggerClass, formType){
$(container.$container).on('click', '.' + triggerClass, function(e){
e.preventDefault();
e.stopImmediatePropagation();
container.toggleForm(formType, getReferral(triggerClass));
})
});
}
toggleForm(formType, referral){
referral=referral||'';
this.$container.attr('data-active', formType);
var $section=this.$container.find('.xoo-el-section[data-section="'+formType+'"]'),
activeClass='xoo-el-active';
if($section.length){
var $sectionForm=$section.find('form');
this.$container.find('.xoo-el-section').removeClass(activeClass);
$section.addClass(activeClass);
$section.find('.xoo-el-notice').html('').hide();
$section.find('.xoo-el-action-form').show();
if($sectionForm.length&&referral&&$sectionForm.find('input[name="_xoo_el_referral"]').length){
$sectionForm.find('input[name="_xoo_el_referral"]').val(referral);
}}
if(this.$tabs){
this.$tabs.find('li').removeClass(activeClass);
if(this.$tabs.find('li[data-tab="'+formType+'"]').length){
this.$tabs.find('li[data-tab="'+formType+'"]').addClass(activeClass);
}}
$(document.body).trigger('xoo_el_form_toggled', [ formType, this, referral ]);
this.$container.triggerHandler('xoo_el_form_toggled', [ formType, this, referral ]);
}
submitForm(e){
e.preventDefault();
var $form=$(e.currentTarget),
$button=$form.find('button[type="submit"]'),
$section=$form.parents('.xoo-el-section'),
buttonTxt=$button.text(),
$notice=$section.find('.xoo-el-notice'),
formType=$section.attr('data-section'),
container=this;
$notice.html('');
$button.html(xoo_el_localize.html.spinner).addClass('xoo-el-processing');
var form_data=new FormData($form[0]);
form_data.append('action', 'xoo_el_form_action');
form_data.append('display', container.display);
$.ajax({
url: xoo_el_localize.adminurl,
type: 'POST',
processData: false,
contentType: false,
cache: false,
enctype: 'multipart/form-data',
data: form_data,
complete: function(xhr, status){
$button.removeClass('xoo-el-processing').html(buttonTxt);
if(( status!=='success'||!xhr.responseJSON||xhr.responseJSON.error===undefined) ){
if(container.formRetries < 2){
$form.submit();
container.formRetries++;
return;
}
if(xoo_el_localize.errorLog==='yes'){
$notice.html(parse_notice("We could not process your request, please check console or try again later.", 'error') ).show();
}
else if(status!=='error'){
location.reload();
}}
},
success: function(response){
container.formRetries=0;
if(response.error===undefined){
console.log(response);
return;
}
if(response.notice){
$notice.html(response.notice).show();
if(container.display==='inline'){
$('html, body').animate({ scrollTop: $notice.offset().top - 100}, 500);
}}
if(response.error===0){
if(response.redirect){
setTimeout(function(){
window.location=response.redirect;
}, xoo_el_localize.redirectDelay);
}else{
$form.hide();
}
$form.trigger('reset');
if(formType==='resetpw'&&xoo_el_localize.resetPwPattern==='link'){
$form.add('.xoo-el-resetpw-hnotice').remove();
}}
$(document.body).trigger('xoo_el_form_submitted', [ response, $form, container ]);
$form.triggerHandler('xoo_el_form_submitted', [ response, $form, container ]);
}}).
fail(function(jqXHR, textStatus, errorThrown){
if(container.formRetries < 2) return;
$('body, .xoo-el-popup-notice').addClass('xoo-el-popup-notice-active');
var iframe=$('.xoo-el-notice-wrap iframe').get(0);
iframe.contentWindow.document.open();
iframe.contentWindow.document.write(jqXHR.responseText);
iframe.contentWindow.document.close();
var iframeDocument=iframe.contentWindow.document;
var style=iframeDocument.createElement("style");
style.textContent=$('.xoo-el-notice-iframestyle').text();
iframeDocument.head.appendChild(style);
})
}
singleFormProcess(e, response, $form, container){
if(this!==container) return;
if(response.field){
var $field=this.$container.find(response.field);
if($field.length){
this.toggleForm($field.closest('.xoo-el-section').attr('data-section'));
$field.closest('form').show();
$field.val(response.fieldValue);
$field.closest('.xoo-el-section').find('.xoo-el-notice').html(response.notice).show();
var $fieldCont=$field.closest('.xoo-aff-group');
if(!$fieldCont.find('.xoo-el-edit-em').length){
$fieldCont.addClass('xoo-el-block-edit');
$(xoo_el_localize.html.editField).insertAfter($field);
}}
}}
}
class Popup{
constructor($popup){
this.$popup=$popup;
this.eventHandlers();
}
eventHandlers(){
if(!xoo_el_localize.preventClosing){
this.$popup.on('click', '.xoo-el-close, .xoo-el-modal, .xoo-el-opac', this.closeOnClick.bind(this));
$(document.body).on('xoo_el_popup_toggled.xooEscEvent', this.onPopupToggled.bind(this));
}
$(document.body).on('xoo_el_form_submitted', this.onFormSubmitSuccess.bind(this));
this.$popup.on('click', '.xoo-el-action-btn', this.setScrollBarOnSubmit.bind(this));
$(window).on('hashchange load', this.openViaHash.bind(this));
this.triggerPopupOnClick();
if(xoo_el_localize.checkout&&xoo_el_localize.checkout.loginEnabled==='yes'){
$('body').on('click', '.wc-block-checkout__login-prompt, .wc-block-must-login-prompt', this.checkoutPageLinkClick.bind(this));
}}
onPopupToggled(e, type){
if($('body').hasClass('xoo-el-popup-active')){
$(document).on('keydown.xooEscClose', this.closeOnEscPress.bind(this));
}else{
$(document).off('keydown.xooEscClose');
}}
closeOnEscPress(e){
if(event.key==="Escape"||event.keyCode===27){
popup.toggle('hide');
}}
checkoutPageLinkClick(e){
e.preventDefault();
$(e.currentTarget).attr('data-redirect', xoo_el_localize.checkout.loginRedirect).addClass('xoo-el-login-tgr').trigger('click');
}
triggerPopupOnClick(){
$.each(getFormsTrigger(this.$popup), function(triggerClass, formType){
$(document.body).on('click', '.' + triggerClass, function(e){
if($(this).parents('.xoo-el-form-container').length) return true;
e.preventDefault();
e.stopImmediatePropagation();
popup.toggle('show');
if($(this).attr('data-redirect') ){
popup.$popup.find('input[name="xoo_el_redirect"]').val($(this).attr('data-redirect'));
}
popup.$popup.find('.'+triggerClass).trigger('click');
return false;
})
})
}
toggle(type){
var $els=this.$popup.add('body'),
activeClass='xoo-el-popup-active';
if(type==='show'){
$els.addClass(activeClass);
}
else if(type==='hide'){
$els.removeClass(activeClass);
}else{
$els.toggleClass(activeClass);
}
$(document.body).trigger('xoo_el_popup_toggled', [ type ]);
}
closeOnClick(e){
var elClassList=e.target.classList;
if(elClassList.contains('xoo-el-close')||elClassList.contains('xoo-el-modal')||elClassList.contains('xoo-el-opac')){
this.toggle('hide');
}}
setScrollbarPosition(position){
this.$popup.find('.xoo-el-srcont').scrollTop=position||0;
}
onFormSubmitSuccess(e, response, $form, container){
this.setScrollbarPosition();
}
setScrollBarOnSubmit(e){
var invalid_els=$(e.currentTarget).closest('form').find('input:invalid');
if(invalid_els.length===0) return;
this.setScrollbarPosition(invalid_els.filter(":first").closest('.xoo-aff-group').position().top);
}
openViaHash(){
var hash=$(location).attr('hash');
if(hash==='#login'||hash==='#register'){
this.toggle('show');
var uri=window.location.toString(),
clean_uri=uri.substring(0, uri.indexOf("#"));
window.history.replaceState({},
document.title, clean_uri
);
}
if(hash==='#login'){
this.$popup.find('.xoo-el-login-tgr').trigger('click');
}
else if(hash==='#register'){
this.$popup.find('.xoo-el-reg-tgr').trigger('click');
}}
}
class Form{
constructor($form){
this.$form=$form;
}
eventHandlers(){
}}
var popup=null;
if($('.xoo-el-container').length){
popup=new Popup($('.xoo-el-container'));
}
if(xoo_el_localize.isLoggedIn==="no"&&xoo_el_localize.autoOpenPopup==='yes'&&localStorage.getItem("xoo_el_popup_opened")!=="yes"){
if(xoo_el_localize.autoOpenPopupOnce==="yes"){
localStorage.setItem("xoo_el_popup_opened", "yes");
}
setTimeout(function(){
popup.toggle('show');
}, xoo_el_localize.aoDelay);
}
$('.xoo-el-form-container').each(function(key, el){
new Container($(el));
})
if($('form.xoo-el-form-resetpw').length&&xoo_el_localize.resetPwPattern==="link"){
if($('.xoo-el-form-inline').length){
$([document.documentElement, document.body]).animate({
scrollTop: $(".xoo-el-form-inline").offset().top
}, 500);
}else{
if(popup){
popup.toggle('show');
}}
}
if($('body.woocommerce-checkout').length&&$('.xoo-el-form-inline').length&&$('a.showlogin').length){
var $inlineForm=$('.xoo-el-form-inline');
$inlineForm.hide();
$(document.body).on('click', 'a.showlogin', function(){
$inlineForm.slideToggle();
$inlineForm.find('.xoo-el-login-tgr').trigger('click');
});
}
if(popup&&xoo_el_localize.loginClass&&$('.'+xoo_el_localize.loginClass).length){
$('body:not(.logged-in) .'+xoo_el_localize.loginClass).on('click', function(e){
e.preventDefault();
e.stopImmediatePropagation();
popup.toggle('show');
popup.$popup.find('.xoo-el-login-tgr').trigger('click');
});
}
if(popup&&xoo_el_localize.registerClass&&$('.'+xoo_el_localize.registerClass).length){
$('body:not(.logged-in) .'+xoo_el_localize.registerClass).on('click', function(e){
e.preventDefault();
e.stopImmediatePropagation();
popup.toggle('show');
popup.$popup.find('.xoo-el-reg-tgr').trigger('click');
});
}
$('.xoo-el-notice-close').on('click', function(){
$('body, .xoo-el-popup-notice').removeClass('xoo-el-popup-notice-active');
})
class CodeFormHandler{
constructor($codeForm){
const existing=CodeFormHandler.instances.get($codeForm[0]);
if(existing) return existing;
this.$codeForm=$codeForm;
this.codeFormID=this.$codeForm.data('code');
this.$parentForm=this.$codeForm.data('parentform') ? $(this.$codeForm.siblings(this.$codeForm.data('parentform')).get(0)):$();
this.CodePasted=false;
this.resendData={};
this.$noticeCont=this.$codeForm.find('.xoo-el-code-notice');
this.$submitBtn=this.$codeForm.find('.xoo-el-code-submit-btn');
this.submitBtnTxt=this.$submitBtn.html();
this.$inputs=this.$codeForm.find('.xoo-el-code-input');
this.$resendLink=this.$codeForm.find('.xoo-el-code-resend-link');
this.noticeTimout=this.resendTimer=false;
this.parentFormValues={}
this.codesent=false;
this.$container=this.$codeForm.closest('.xoo-el-form-container');
this.events();
CodeFormHandler.instances.set($codeForm[0], this);
}
events(){
this.$resendLink.on('click', { _thisObj: this }, this.resendCode);
this.$codeForm.find('.xoo-el-code-no-change').on('click', { _thisObj: this }, this.changeParentInput);
this.$codeForm.on('submit', { _thisObj: this }, this.onSubmit);
this.$inputs.on('paste', { _thisObj: this }, this.onCodeInputPaste);
this.$inputs.on('input', { _thisObj: this }, this.onCodeInputChange);
this.$inputs.on('keydown ', { _thisObj: this }, this.beforeCodeInputChange);
this.$container.on('xoo_el_form_toggled', this.onParentFormToggled.bind(this))
}
onParentFormToggled(e, formType, containerObj, referral){
let _thisObj=this;
if(_thisObj.codesent){
_thisObj.$parentForm.hide();
_thisObj.$codeForm.show();
}}
onCodeInputPaste(event){
var _thisObj=event.data._thisObj,
_this=$(this);
_thisObj.CodePasted=true;
setTimeout(function(){
var inputVal=_this.val().trim(),
inputValLength=inputVal.length;
_thisObj.$inputs.val('');
for (var i=0; i < inputValLength; ++i){
var chr=inputVal.charAt(i),
$Codeinput=$(_thisObj.$inputs.get(i));
if($Codeinput.length){
$Codeinput.val(chr);
}
if(i===(inputValLength - 1)){
$Codeinput.focus();
}}
if(inputValLength===_thisObj.$inputs.length){
_thisObj.$codeForm.trigger('submit');
}
_thisObj.CodePasted=false;
}, 10)
}
onCodeInputChange(event){
var _thisObj=event.data._thisObj,
inputVal=$(this).val(),
inputValLength=inputVal.length;
if(inputValLength > 1&&!_thisObj.CodePasted){
$(this).trigger('paste');
return;
}
if(_thisObj.CodePasted||_thisObj.processing){
return;
}
_thisObj.processing=true;
var $nextInput=$(this).next('input.xoo-el-code-input'),
$prevInput=$(this).prev('input.xoo-el-code-input');
if(inputValLength&&$nextInput.length!==0){
$nextInput.focus();
}
_thisObj.processing=false;
}
beforeCodeInputChange(event){
var _thisObj=event.data._thisObj,
inputVal=$(this).val(),
inputValLength=inputVal.length;
var $nextInput=$(this).next('input.xoo-el-code-input'),
$prevInput=$(this).prev('input.xoo-el-code-input');
if(inputVal.length&&event.keyCode!=8&&event.keyCode!==13){
if($nextInput.length&&!$nextInput.val()){
$nextInput.focus();
}else{
$(this).val('');
}}
if(!inputValLength&&event.keyCode==8&&$prevInput.length!==0){
$prevInput.focus();
}}
onSubmit(event){
event.preventDefault();
var _thisObj=event.data._thisObj;
if(!_thisObj.validateInputs()||!_thisObj.getCodeValue().length) return false;
_thisObj.$submitBtn.html(xoo_el_localize.html.spinner).addClass('xoo-el-processing');
_thisObj.verifyCode();
}
changeParentInput(event){
var _thisObj=event.data._thisObj;
_thisObj.codesent=false;
_thisObj.$codeForm.hide();
_thisObj.$parentForm.show();
_thisObj.$inputs.val('');
}
resendCode(event){
event.preventDefault();
var _thisObj=event.data._thisObj;
_thisObj.startResendTimer();
var form_data={
action: 'xoo_el_resend_code',
'parentFormData': objectifyForm(_thisObj.$parentForm),
}
form_data=Object.assign({}, form_data, _thisObj.resendData);
_thisObj.$resendLink.addClass('xoo-el-processing');
$.ajax({
url: xoo_el_localize.adminurl,
type: 'POST',
data: form_data,
success: function(response){
_thisObj.$resendLink.trigger('xoo_el_code_resent', [ response, _thisObj ]);
_thisObj.$resendLink.removeClass('xoo-el-processing');
if(response.notice){
_thisObj.showNotice(response.notice);
}},
complete: function(){
}});
}
validateInputs(){
var passedValidation=true;
this.$inputs.each(function(index, input){
var $input=$(input);
if($input.val().trim()===''){
$input.focus();
passedValidation=false;
return false;
}});
return passedValidation;
}
onSuccess(response){
this.$codeForm.removeAttr('data-processing');
this.codesent=false;
this.$codeForm.hide();
this.$inputs.val('');
if(this.$parentForm.length){
if(response.notice){
this.$parentForm.closest('.xoo-el-section').find('.xoo-el-notice').html(response.notice).show();
}
this.$parentForm.show();
}}
startResendTimer(){
var _thisObj=this,
$cont=this.$codeForm.find('.xoo-el-code-resend'),
$resendLink=$cont.find('.xoo-el-code-resend-link'),
$timer=$cont.find('.xoo-el-code-resend-timer'),
resendTime=parseInt(xoo_el_localize.resend_wait);
if(resendTime===0) return;
$resendLink.addClass('xoo-el-disabled');
clearInterval(this.resendTimer);
this.resendTimer=setInterval(function(){
$timer.html('('+resendTime+')');
if(resendTime <=0){
clearInterval(_thisObj.resendTimer);
$resendLink.removeClass('xoo-el-disabled');
$timer.html('');
}
resendTime--;
},1000)
}
showNotice(notice){
var _thisObj=this;
clearTimeout(this.noticeTimout);
this.$noticeCont.html(notice).show();
this.noticeTimout=setTimeout(function(){
_thisObj.$noticeCont.hide();
},4000)
}
onCodeSent(response){
var _thisObj=this;
if(response.error) return;
_thisObj.codesent=true;
_thisObj.$codeForm.show();
if(response.code_txt){
_thisObj.$codeForm.find('.xoo-el-code-no-txt').html(response.code_txt);
}
setTimeout(function(){
_thisObj.$inputs.first().trigger('click');
_thisObj.$inputs.first().focus();
_thisObj.$inputs.first().attr('autofocus', true);
}, 500)
_thisObj.startResendTimer();
_thisObj.parentFormValues=_thisObj.$parentForm.serialize();
_thisObj.$codeForm.attr('data-processing','yes');
_thisObj.$parentForm.hide();
}
verifyCode(data){
var _thisObj=this;
var form_data=$.extend({
'code': _thisObj.getCodeValue(),
'action': 'xoo_el_code_form_submit',
'xoo_el_code_ajax': _thisObj.codeFormID,
'parentFormData': objectifyForm(_thisObj.$parentForm)
}, data);
$.ajax({
url: xoo_el_localize.adminurl,
type: 'POST',
data: form_data,
success: function(response){
_thisObj.$submitBtn.removeClass('xoo-el-processing').html(_thisObj.submitBtnTxt);
if(response.notice){
_thisObj.showNotice(response.notice);
}
if(response.error===0){
_thisObj.onSuccess(response);
_thisObj.$codeForm.trigger('xoo_el_on_code_success', [response]);
}}
});
}
validateFormSubmit(){
if(this.validateInputs()&&this.getCodeValue().length){
this.$submitBtn.html(xoo_el_localize.html.spinner).addClass('xoo-el-processing');
return true;
}}
getCodeValue(){
var code='';
this.$inputs.each(function(index, input){
code +=$(input).val();
});
return code;
}}
CodeFormHandler.instances=new WeakMap();
$('.xoo-el-code-form').each(function(index, codeForm){
new CodeFormHandler($(codeForm));
});
window.xooEl.CodeFormHandler=CodeFormHandler;
if(xoo_el_localize.resetPwPattern==="code"){
class lostPasswordFormHandler{
constructor($form){
this.$form=$form;
this.$section=this.$form.closest('.xoo-el-section');
this.$resetPwSection=this.$section.siblings('[data-section="resetpw"]');
this.$resetPwForm=this.$resetPwSection.find('.xoo-el-form-resetpw');
this.$container=this.$section.closest('.xoo-el-form-container');
this.codeFormHandler=new CodeFormHandler($form.siblings('.xoo-el-code-form'));
this.events();
}
events(){
this.$form.on('xoo_el_form_submitted', this.onFormSubmit.bind(this));
this.$resetPwForm.on('xoo_el_form_submitted', this.onResetPWFormSubmit.bind(this));
this.codeFormHandler.$codeForm.on('xoo_el_on_code_success', this.onCodeVerificationSuccess.bind(this));
this.$container.on('xoo_el_form_toggled', this.onLostPasswordFormToggle.bind(this));
}
onFormSubmit(e, response, $form, container){
let _thisObj=this;
_thisObj.codeFormHandler.onCodeSent(response);
_thisObj.$resetPwSection.removeAttr('data-verified','yes');
}
onResetPWFormSubmit(e, response, $form, containerObj){
let _thisObj=this;
_thisObj.$resetPwSection.removeAttr('data-verified','yes');
if(response.error){
_thisObj.$section.find('.xoo-el-notice').html(response.notice).show();
if(response.error_code==='code_reset'){
containerObj.toggleForm('lostpw');
}}else{
containerObj.toggleForm('login');
this.$container.find('.xoo-el-section[data-section="login"]').find('.xoo-el-notice').html(response.notice).show();
}}
onCodeVerificationSuccess(e, response){
let _thisObj=this;
_thisObj.$container.find('.xoo-el-resetpw-tgr').trigger('click');
_thisObj.$resetPwSection.attr('data-verified','yes');
}
onLostPasswordFormToggle(e, formType, containerObj, referral){
let _thisObj=this;
if(formType!=='lostpw') return;
if(_thisObj.$resetPwSection.attr('data-verified')==="yes"){
containerObj.toggleForm('resetpw');
}}
}
$('form.xoo-el-form-lostpw').each(function(index, el){
new lostPasswordFormHandler($(el));
})
}});
(()=>{var t={507:(t,e,r)=>{"use strict";r.d(e,{A:()=>A});var n=function(t){return"string"!=typeof t||""===t?(console.error("The namespace must be a non-empty string."),!1):!!/^[a-zA-Z][a-zA-Z0-9_.\-\/]*$/.test(t)||(console.error("The namespace can only contain numbers, letters, dashes, periods, underscores and slashes."),!1)};var i=function(t){return"string"!=typeof t||""===t?(console.error("The hook name must be a non-empty string."),!1):/^__/.test(t)?(console.error("The hook name cannot begin with `__`."),!1):!!/^[a-zA-Z][a-zA-Z0-9_.-]*$/.test(t)||(console.error("The hook name can only contain numbers, letters, dashes, periods and underscores."),!1)};var o=function(t,e){return function(r,o,s,c=10){const l=t[e];if(!i(r))return;if(!n(o))return;if("function"!=typeof s)return void console.error("The hook callback must be a function.");if("number"!=typeof c)return void console.error("If specified, the hook priority must be a number.");const a={callback:s,priority:c,namespace:o};if(l[r]){const t=l[r].handlers;let e;for(e=t.length;e>0&&!(c>=t[e-1].priority);e--);e===t.length?t[e]=a:t.splice(e,0,a),l.__current.forEach((t=>{t.name===r&&t.currentIndex>=e&&t.currentIndex++}))}else l[r]={handlers:[a],runs:0};"hookAdded"!==r&&t.doAction("hookAdded",r,o,s,c)}};var s=function(t,e,r=!1){return function(o,s){const c=t[e];if(!i(o))return;if(!r&&!n(s))return;if(!c[o])return 0;let l=0;if(r)l=c[o].handlers.length,c[o]={runs:c[o].runs,handlers:[]};else{const t=c[o].handlers;for(let e=t.length-1;e>=0;e--)t[e].namespace===s&&(t.splice(e,1),l++,c.__current.forEach((t=>{t.name===o&&t.currentIndex>=e&&t.currentIndex--})))}return"hookRemoved"!==o&&t.doAction("hookRemoved",o,s),l}};var c=function(t,e){return function(r,n){const i=t[e];return void 0!==n?r in i&&i[r].handlers.some((t=>t.namespace===n)):r in i}};var l=function(t,e,r,n){return function(i,...o){const s=t[e];s[i]||(s[i]={handlers:[],runs:0}),s[i].runs++;const c=s[i].handlers;if(!c||!c.length)return r?o[0]:void 0;const l={name:i,currentIndex:0};return(n?async function(){try{s.__current.add(l);let t=r?o[0]:void 0;for(;l.currentIndex<c.length;){const e=c[l.currentIndex];t=await e.callback.apply(null,o),r&&(o[0]=t),l.currentIndex++}return r?t:void 0}finally{s.__current.delete(l)}}:function(){try{s.__current.add(l);let t=r?o[0]:void 0;for(;l.currentIndex<c.length;){t=c[l.currentIndex].callback.apply(null,o),r&&(o[0]=t),l.currentIndex++}return r?t:void 0}finally{s.__current.delete(l)}})()}};var a=function(t,e){return function(){const r=t[e],n=Array.from(r.__current);return n.at(-1)?.name??null}};var d=function(t,e){return function(r){const n=t[e];return void 0===r?n.__current.size>0:Array.from(n.__current).some((t=>t.name===r))}};var u=function(t,e){return function(r){const n=t[e];if(i(r))return n[r]&&n[r].runs?n[r].runs:0}};class h{actions;filters;addAction;addFilter;removeAction;removeFilter;hasAction;hasFilter;removeAllActions;removeAllFilters;doAction;doActionAsync;applyFilters;applyFiltersAsync;currentAction;currentFilter;doingAction;doingFilter;didAction;didFilter;constructor(){this.actions=Object.create(null),this.actions.__current=new Set,this.filters=Object.create(null),this.filters.__current=new Set,this.addAction=o(this,"actions"),this.addFilter=o(this,"filters"),this.removeAction=s(this,"actions"),this.removeFilter=s(this,"filters"),this.hasAction=c(this,"actions"),this.hasFilter=c(this,"filters"),this.removeAllActions=s(this,"actions",!0),this.removeAllFilters=s(this,"filters",!0),this.doAction=l(this,"actions",!1,!1),this.doActionAsync=l(this,"actions",!1,!0),this.applyFilters=l(this,"filters",!0,!1),this.applyFiltersAsync=l(this,"filters",!0,!0),this.currentAction=a(this,"actions"),this.currentFilter=a(this,"filters"),this.doingAction=d(this,"actions"),this.doingFilter=d(this,"filters"),this.didAction=u(this,"actions"),this.didFilter=u(this,"filters")}}var A=function(){return new h}},8770:()=>{}},e={};function r(n){var i=e[n];if(void 0!==i)return i.exports;var o=e[n]={exports:{}};return t[n](o,o.exports,r),o.exports}r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};(()=>{"use strict";r.r(n),r.d(n,{actions:()=>x,addAction:()=>s,addFilter:()=>c,applyFilters:()=>m,applyFiltersAsync:()=>v,createHooks:()=>t.A,currentAction:()=>y,currentFilter:()=>F,defaultHooks:()=>o,didAction:()=>b,didFilter:()=>k,doAction:()=>f,doActionAsync:()=>p,doingAction:()=>_,doingFilter:()=>g,filters:()=>w,hasAction:()=>d,hasFilter:()=>u,removeAction:()=>l,removeAllActions:()=>h,removeAllFilters:()=>A,removeFilter:()=>a});var t=r(507),e=r(8770),i={};for(const t in e)["default","actions","addAction","addFilter","applyFilters","applyFiltersAsync","createHooks","currentAction","currentFilter","defaultHooks","didAction","didFilter","doAction","doActionAsync","doingAction","doingFilter","filters","hasAction","hasFilter","removeAction","removeAllActions","removeAllFilters","removeFilter"].indexOf(t)<0&&(i[t]=()=>e[t]);r.d(n,i);const o=(0,t.A)(),{addAction:s,addFilter:c,removeAction:l,removeFilter:a,hasAction:d,hasFilter:u,removeAllActions:h,removeAllFilters:A,doAction:f,doActionAsync:p,applyFilters:m,applyFiltersAsync:v,currentAction:y,currentFilter:F,doingAction:_,doingFilter:g,didAction:b,didFilter:k,actions:x,filters:w}=o})(),(window.wp=window.wp||{}).hooks=n})();
(()=>{"use strict";var t={d:(n,e)=>{for(var r in e)t.o(e,r)&&!t.o(n,r)&&Object.defineProperty(n,r,{enumerable:!0,get:e[r]})},o:(t,n)=>Object.prototype.hasOwnProperty.call(t,n),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},n={};t.r(n),t.d(n,{__:()=>F,_n:()=>L,_nx:()=>D,_x:()=>w,createI18n:()=>h,defaultI18n:()=>b,getLocaleData:()=>g,hasTranslation:()=>O,isRTL:()=>P,resetLocaleData:()=>x,setLocaleData:()=>v,sprintf:()=>l,subscribe:()=>m});var e,r,a,i,o=/%(((\d+)\$)|(\(([$_a-zA-Z][$_a-zA-Z0-9]*)\)))?[ +0#-]*\d*(\.(\d+|\*))?(ll|[lhqL])?([cduxXefgsp%])/g;function l(t,...n){return function(t,...n){var e=0;return Array.isArray(n[0])&&(n=n[0]),t.replace(o,(function(){var t,r,a,i,o;return t=arguments[3],r=arguments[5],"%"===(i=arguments[9])?"%":("*"===(a=arguments[7])&&(a=n[e],e++),void 0===r?(void 0===t&&(t=e+1),e++,o=n[t-1]):n[0]&&"object"==typeof n[0]&&n[0].hasOwnProperty(r)&&(o=n[0][r]),"f"===i?o=parseFloat(o)||0:"d"===i&&(o=parseInt(o)||0),void 0!==a&&("f"===i?o=o.toFixed(a):"s"===i&&(o=o.substr(0,a))),null!=o?o:"")}))}(t,...n)}e={"(":9,"!":8,"*":7,"/":7,"%":7,"+":6,"-":6,"<":5,"<=":5,">":5,">=":5,"==":4,"!=":4,"&&":3,"||":2,"?":1,"?:":1},r=["(","?"],a={")":["("],":":["?","?:"]},i=/<=|>=|==|!=|&&|\|\||\?:|\(|!|\*|\/|%|\+|-|<|>|\?|\)|:/;var s={"!":function(t){return!t},"*":function(t,n){return t*n},"/":function(t,n){return t/n},"%":function(t,n){return t%n},"+":function(t,n){return t+n},"-":function(t,n){return t-n},"<":function(t,n){return t<n},"<=":function(t,n){return t<=n},">":function(t,n){return t>n},">=":function(t,n){return t>=n},"==":function(t,n){return t===n},"!=":function(t,n){return t!==n},"&&":function(t,n){return t&&n},"||":function(t,n){return t||n},"?:":function(t,n,e){if(t)throw n;return e}};function u(t){var n=function(t){for(var n,o,l,s,u=[],d=[];n=t.match(i);){for(o=n[0],(l=t.substr(0,n.index).trim())&&u.push(l);s=d.pop();){if(a[o]){if(a[o][0]===s){o=a[o][1]||o;break}}else if(r.indexOf(s)>=0||e[s]<e[o]){d.push(s);break}u.push(s)}a[o]||d.push(o),t=t.substr(n.index+o.length)}return(t=t.trim())&&u.push(t),u.concat(d.reverse())}(t);return function(t){return function(t,n){var e,r,a,i,o,l,u=[];for(e=0;e<t.length;e++){if(o=t[e],i=s[o]){for(r=i.length,a=Array(r);r--;)a[r]=u.pop();try{l=i.apply(null,a)}catch(t){return t}}else l=n.hasOwnProperty(o)?n[o]:+o;u.push(l)}return u[0]}(n,t)}}var d={contextDelimiter:"",onMissingKey:null};function c(t,n){var e;for(e in this.data=t,this.pluralForms={},this.options={},d)this.options[e]=void 0!==n&&e in n?n[e]:d[e]}c.prototype.getPluralForm=function(t,n){var e,r,a,i=this.pluralForms[t];return i||("function"!=typeof(a=(e=this.data[t][""])["Plural-Forms"]||e["plural-forms"]||e.plural_forms)&&(r=function(t){var n,e,r;for(n=t.split(";"),e=0;e<n.length;e++)if(0===(r=n[e].trim()).indexOf("plural="))return r.substr(7)}(e["Plural-Forms"]||e["plural-forms"]||e.plural_forms),a=function(t){var n=u(t);return function(t){return+n({n:t})}}(r)),i=this.pluralForms[t]=a),i(n)},c.prototype.dcnpgettext=function(t,n,e,r,a){var i,o,l;return i=void 0===a?0:this.getPluralForm(t,a),o=e,n&&(o=n+this.options.contextDelimiter+e),(l=this.data[t][o])&&l[i]?l[i]:(this.options.onMissingKey&&this.options.onMissingKey(e,t),0===i?e:r)};const p={plural_forms:t=>1===t?0:1},f=/^i18n\.(n?gettext|has_translation)(_|$)/,h=(t,n,e)=>{const r=new c({}),a=new Set,i=()=>{a.forEach((t=>t()))},o=(t,n="default")=>{r.data[n]={...r.data[n],...t},r.data[n][""]={...p,...r.data[n]?.[""]},delete r.pluralForms[n]},l=(t,n)=>{o(t,n),i()},s=(t="default",n,e,a,i)=>(r.data[t]||o(void 0,t),r.dcnpgettext(t,n,e,a,i)),u=t=>t||"default",d=(t,n,r)=>{let a=s(r,n,t);return e?(a=e.applyFilters("i18n.gettext_with_context",a,t,n,r),e.applyFilters("i18n.gettext_with_context_"+u(r),a,t,n,r)):a};if(t&&l(t,n),e){const t=t=>{f.test(t)&&i()};e.addAction("hookAdded","core/i18n",t),e.addAction("hookRemoved","core/i18n",t)}return{getLocaleData:(t="default")=>r.data[t],setLocaleData:l,addLocaleData:(t,n="default")=>{r.data[n]={...r.data[n],...t,"":{...p,...r.data[n]?.[""],...t?.[""]}},delete r.pluralForms[n],i()},resetLocaleData:(t,n)=>{r.data={},r.pluralForms={},l(t,n)},subscribe:t=>(a.add(t),()=>a.delete(t)),__:(t,n)=>{let r=s(n,void 0,t);return e?(r=e.applyFilters("i18n.gettext",r,t,n),e.applyFilters("i18n.gettext_"+u(n),r,t,n)):r},_x:d,_n:(t,n,r,a)=>{let i=s(a,void 0,t,n,r);return e?(i=e.applyFilters("i18n.ngettext",i,t,n,r,a),e.applyFilters("i18n.ngettext_"+u(a),i,t,n,r,a)):i},_nx:(t,n,r,a,i)=>{let o=s(i,a,t,n,r);return e?(o=e.applyFilters("i18n.ngettext_with_context",o,t,n,r,a,i),e.applyFilters("i18n.ngettext_with_context_"+u(i),o,t,n,r,a,i)):o},isRTL:()=>"rtl"===d("ltr","text direction"),hasTranslation:(t,n,a)=>{const i=n?n+""+t:t;let o=!!r.data?.[a??"default"]?.[i];return e&&(o=e.applyFilters("i18n.has_translation",o,t,n,a),o=e.applyFilters("i18n.has_translation_"+u(a),o,t,n,a)),o}}},_=window.wp.hooks,y=h(void 0,void 0,_.defaultHooks);var b=y;const g=y.getLocaleData.bind(y),v=y.setLocaleData.bind(y),x=y.resetLocaleData.bind(y),m=y.subscribe.bind(y),F=y.__.bind(y),w=y._x.bind(y),L=y._n.bind(y),D=y._nx.bind(y),P=y.isRTL.bind(y),O=y.hasTranslation.bind(y);(window.wp=window.wp||{}).i18n=n})();