1(e=>{"function"==typeof define&&define.amd?define("auth",e):e()})(function(){var a={template:"#create-post-date-field",components:{datePicker:{template:'<div class="ts-form-group" ref="calendar"><input type="hidden" ref="input"></div>',props:{field:Object,parent:Object},data(){return{picker:null}},mounted(){this.picker=new Pikaday({field:this.$refs.input,container:this.$refs.calendar,bound:!1,firstDay:1,keyboardInput:!1,defaultDate:this.parent.date,onSelect:e=>{this.parent.date=e,this.parent.onSave()},selectDayFn:e=>this.parent.date&&this.parent.date.toDateString()===e.toDateString()})},unmounted(){setTimeout(()=>this.picker.destroy(),200)},methods:{reset(){this.parent.date=null,this.picker.draw()}}}},props:{field:Object,index:{type:Number,default:0}},data(){return{date:this.field.value.date,time:this.field.value.time,displayValue:""}},created(){"string"==typeof this.date&&(this.date=new Date(this.date+"T00:00:00"),this.displayValue=this.getDisplayValue())},methods:{saveValue(){this.field.value.date=this.isFilled()?Voxel.helpers.dateFormatYmd(this.date):null,this.displayValue=this.getDisplayValue()},onSave(){this.saveValue(),this.$refs.formGroup.blur()},onClear(){this.$refs.picker.reset()},isFilled(){return this.date&&isFinite(this.date)},getDisplayValue(){return this.date?Voxel.helpers.dateFormat(this.date):""},validate(e){var t,i;this.$root.shouldValidate()&&(t=[],i=!!this.field.props.enable_timepicker,i=!("object"==typeof e&&e.date&&(!i||e.time)),this.$root.shouldValidateRequired()&&this.field.required&&i&&t.push(this.$root.get_error("required")),this.field.validation.errors=t)}},watch:{"field.value.date"(){this.validate(this.field.value)},"field.value.time"(){this.validate(this.field.value)}}};let s={template:"#create-post-term-list",props:["terms","parent-term","previous-list","list-key"],data(){return{taxonomyField:Voxel.helpers.getParent(this,"taxonomy-field"),perPage:50,page:1}},methods:{selectTerm(e){e.children&&e.children.length?(this.taxonomyField.slide_from="right",this.taxonomyField.active_list="terms_"+e.id):this.taxonomyField.selectTerm(e)},goBack(){this.taxonomyField.slide_from="left",this.taxonomyField.active_list=this.previousList},afterEnter(e,t){setTimeout(()=>e.closest(".min-scroll").scrollTop=this.taxonomyField.scrollPosition[t]||0,100)},beforeLeave(e,t){this.taxonomyField.scrollPosition[t]=e.closest(".min-scroll").scrollTop}},computed:{termsWithChildren(){return this.terms.filter(e=>e.children&&e.children.length)}}};var r={template:"#create-post-taxonomy-field",name:"taxonomy-field",props:{field:Object,index:{type:Number,default:0}},data(){return{value:{},terms:this.field.props.terms,active_list:"toplevel",slide_from:"right",search:"",displayValue:"",scrollPosition:{},termCount:0}},created(){this.value=this.field.props.selected,this.displayValue=this._getDisplayValue();let i=(t,e)=>{this.termCount++,t.parentRef=e,t.children&&t.children.forEach(e=>i(e,t))};this.terms.forEach(e=>i(e,null))},methods:{saveValue(){this.field.value=this.isFilled()?Object.keys(this.value):null,this.displayValue=this._getDisplayValue()},onSave(){this.saveValue(),this.$refs.formGroup.$refs.popup.$emit("blur")},onClear(){this.value={},this.search="",this.$refs.searchInput?.focus()},isFilled(){return Object.keys(this.value).length},_getDisplayValue(){return this._getLeafTermSlugs(this.value).map(e=>this.value[e].label).join(", ")},deselectChildren(e){e.children&&e.children.forEach(e=>{delete this.value[e.slug],this.deselectChildren(e)})},_getLeafTermSlugs(e){var t=Object.keys(e);if(0===t.length)return[];let i={},a=new Set(t);return t.forEach(e=>{i[e]=!1}),t.forEach(t=>{t=e[t];if(t){let e=t.parentRef;for(;e;)a.has(e.slug)&&(i[e.slug]=!0),e=e.parentRef}}),t.filter(e=>!i[e])},_countLeafTermsWithValue(e){return this._getLeafTermSlugs(e).length},_countLeafTerms(){return this._countLeafTermsWithValue(this.value)},selectTerm(t){if(this.value[t.slug]){delete this.value[t.slug],this.deselectChildren(t);let e=t.parentRef;for(;e;)e.children.some(e=>!!this.value[e.slug])||delete this.value[e.slug],e=e.parentRef}else{this.field.props.multiple||Object.keys(this.value).forEach(e
1=>delete this.value[e]);let e=(this.value[t.slug]=t).parentRef;for(;e;)e=(this.value[e.slug]=e).parentRef;this.field.props.multiple||"inline"===this.field.props.display_as||this.onSave()}"inline"===this.field.props.display_as&&this.saveValue()},validate(e){var t,i,a,s,r;this.$root.shouldValidate()&&(t=[],a=0===(i=this._countLeafTerms()),s=this.field.props.min,r=this.field.props.max,this.$root.shouldValidateRequired()&&this.field.required&&a&&t.push(this.$root.get_error("required")),a||(s&&i<s&&t.push(this.$root.replace_vars(this.$root.get_error("taxonomy:min"),{"@min":s})),r&&r<i&&t.push(this.$root.replace_vars(this.$root.get_error("taxonomy:max"),{"@max":r}))),this.field.validation.errors=t)}},computed:{searchResults(){if(!this.search.trim().length)return!1;let a=[],s=this.search.trim().toLowerCase(),r=Voxel.helpers.stripDiacritics(s),o=e=>{var t=e.label.toLowerCase();if((-1!==t.indexOf(s)||-1!==Voxel.helpers.stripDiacritics(t).indexOf(r))&&(a.push(e),100<=a.length))return-1;if(e.children)for(var i of e.children)if(-1===o(i))return-1};for(var e of this.terms)if(-1===o(e))break;return a}},watch:{"field.value"(){this.validate(this.field.value)}}},o={template:"#create-post-file-field",props:{field:Object,mediaTarget:[Object,String],index:{type:Number,default:null},sortable:{type:Boolean,default:!0},showLibrary:{type:Boolean,default:!0},previewImages:{type:Boolean,default:!0}},data(){return{accepts:"",dragActive:!1,reordering:!1}},created(){null===this.field.value&&(this.field.value=[]),this.field.props.allowedTypes&&(this.accepts=Object.values(this.field.props.allowedTypes).join(", ")),this.$watch(()=>this.field.value,()=>{this.validate(this.field.value)},{deep:!0})},mounted(){jQuery(this.$refs.input).on("change",e=>{for(var t=0;t<e.target.files.length;t++){var i=e.target.files[t];this.pushFile(i)}this.$refs.input.value="",this.$emit("files-added")})},unmounted(){setTimeout(()=>{Object.values(this.field.value).forEach(e=>{"new_upload"===e.source&&URL.revokeObjectURL(e.preview)})},10)},methods:{getStyle(e){return e.type.startsWith("image/")&&this.previewImages?`background-image: url('${e.preview}');`:""},pushFile(t){1===this.field.props.maxCount&&(this.field.value=[]);var e={source:"new_upload",name:t.name,type:t.type,size:t.size,preview:URL.createObjectURL(t),item:t,_id:Voxel.helpers.randomId(8)},i=(void 0===window._vx_file_upload_cache&&(window._vx_file_upload_cache=[]),window._vx_file_upload_cache.find(e=>e.item.name===t.name&&e.item.type===t.type&&e.item.size===t.size&&e.item.lastModified===t.lastModified));i?this.field.value.push(i):(this.field.value.push(e),window._vx_file_upload_cache.unshift(e))},onDrop(e){this.dragActive=!1,e.dataTransfer.items?[...e.dataTransfer.items].forEach(e=>{"file"===e.kind&&this.pushFile(e.getAsFile())}):[...e.dataTransfer.files].forEach(e=>{this.pushFile(e)}),this.$emit("files-added")},onMediaPopupSave(e){1===this.field.props.maxCount&&(this.field.value=[]);var t={};this.field.value.forEach(e=>{"existing"===e.source&&(t[e.id]=!0),"new_upload"===e.source&&(t[e._id]=!0)}),Object.values(e).forEach(e=>{"existing"!==e.source||t[e.id]||this.field.value.push(e),"new_upload"!==e.source||t[e._id]||this.field.value.push(e)}),this.$emit("files-added")},onSubmit(t,i,e=null){var a;a=Array.isArray(e)&&e.length?`files[${this.field.id}::row-${e.join(".")}][]`:`files[${this.field.id}][]`,t[this.field.key]=[],this.field.value.forEach(e=>{"new_upload"===e.source?(i.append(a,e.item),t[this.field.key].push("uploaded_file")):"existing"===e.source&&t[this.field.key].push(e.id)})},validate(e){if(this.$root.shouldValidate()){let t=[];var s=!(Array.isArray(e)&&1<=e.length),r=this.field.props.maxCount;let i=this.field.props.maxSize,a=this.field.props.allowedTypes;this.$root.shouldValidateRequired()&&this.field.required&&s&&t.push(this.$root.get_error("required")),s||(r&&e.length>r&&t.push(this.$root.replace_vars(this.$root.get_error("file:max"),{"@max":r})),i&&e.forEach(e=>{"new_upload"===e.source&&e.size>1e3*i&&t.push(this.$root.replace_vars(this.$root.get_error("file:size"),{"@filename":e.name,"@limit_kb":i,"@limit_mb":i/1e3}))}
1),Array.isArray(a)&&a.length&&e.forEach(e=>{a.includes(e.type)||t.push(this.$root.replace_vars(this.$root.get_error("file:type"),{"@filename":e.name,"@filetype":e.type}))})),this.field.validation.errors=t}}}},l={template:"#create-post-select-field",props:{field:Object,index:{type:Number,default:0}},data(){let t={};return this.field.props.choices.forEach(e=>t[e.value]=e),{value:this.field.value,choiceMap:t}},created(){null===this.field.value||this.choiceMap[this.field.value]||(this.field.value=null,this.value=null),null===this.value&&this.field.required&&(this.value=this.field.props.choices[0]?.value,this.saveValue()),this.$watch(()=>this.field.value,()=>this.validate(this.field.value))},methods:{saveValue(){this.field.value=this.isFilled()?this.value:null},isFilled(){return null!==this.value&&this.choiceMap[this.value]},validate(e){var t;this.$root.shouldValidate()&&(t=[],e=!("string"==typeof e&&1<=e.trim().length),this.$root.shouldValidateRequired()&&this.field.required&&e&&t.push(this.$root.get_error("required")),this.field.validation.errors=t)}}},n={template:"#create-post-multiselect-field",props:{field:Object,index:{type:Number,default:0}},data(){let t={};return this.field.props.choices.forEach(e=>t[e.value]=e),{value:this.field.props.selected,choiceMap:t,displayValue:"",search:""}},created(){this.$watch(()=>this.field.value,()=>this.validate(this.field.value)),this.displayValue=this._getDisplayValue()},methods:{selectChoice(e){this.value[e.value]?delete this.value[e.value]:this.value[e.value]=e,"inline"===this.field.props.display_as&&this.saveValue()},saveValue(){this.field.value=this.isFilled()?Object.keys(this.value):null,this.displayValue=this._getDisplayValue()},isFilled(){return Object.keys(this.value).length},_getDisplayValue(){return Object.values(this.value).sort((e,t)=>e.order-t.order).map(e=>e.label).join(", ")},onSave(){this.saveValue(),this.$refs.formGroup.$refs.popup.$emit("blur")},onClear(){this.value={},this.search="",this.$refs.searchInput?.focus()},validate(e){var t;this.$root.shouldValidate()&&(t=[],e=!(Array.isArray(e)&&e.length),this.$root.shouldValidateRequired()&&this.field.required&&e&&t.push(this.$root.get_error("required")),this.field.validation.errors=t)}},computed:{searchResults(){if(!this.search.trim().length)return!1;var e,t=[],i=this.search.trim().toLowerCase(),a=Voxel.helpers.stripDiacritics(i);for(e of this.field.props.choices){var s=e.label.toLowerCase();if((-1!==s.indexOf(i)||-1!==Voxel.helpers.stripDiacritics(s).indexOf(a))&&(t.push(e),100<=t.length))break}return t}}};function e(a){let s={},r=new Set;return Object.values(a).forEach(i=>{i.conditions&&i.key&&i.conditions.forEach(e=>{e.forEach(e=>{var t;e.source&&(t=e.source.split(".")[0])&&a[t]&&(e=i.key+`�${t}�`+e.source,((e,t,i)=>{if(t===i)return 1;let a=[i];for(var s=new Set;a.length;){var r=a.pop();if(r===t)return 1;s.has(r)||(s.add(r),(r=e[r])&&r.forEach(e=>a.push(e)))}})(s,i.key,t)?(r.add(e),console.warn(`[Voxel] Skipping circular field condition: "${i.key}" depends on "${t}".`)):(s[i.key]||(s[i.key]=[]),s[i.key].includes(t)||s[i.key].push(t)))})})}),r}var c={created(){this._conditionEvalDepth=0},methods:{setupConditions(i){let l=e(i);Object.values(i).forEach(o=>{o.conditions&&o.conditions.forEach(e=>{e.forEach(a=>{var e=(a.source||"").split("."),t=e[0];let s=e[1]||null,r=i[t];e=o.key?o.key+`�${t}�`+a.source:null;if(!r||e&&l.has(e))a._passes=!1;else{let e=r.value;null!==s&&(e=e?e[s]:null),this.evaluateCondition(a,e,o,r),this.$watch(()=>{var e={_passes:this.conditionsPass(r)};return null!==s?e.value=r.value?r.value[s]:null:e.value=r.value,e},(e,t)=>{let i=r.value;null!==s&&(i=i?i[s]:null),this.evaluateCondition(a,i,o,r)},{deep:!0})}})})})},evaluateCondition(e,t,i,a){if(!(50<this._conditionEvalDepth)){var s=Voxel.conditionHandlers[e.type];if(s){this._conditionEvalDepth++;try{var r=this.conditionsPass(a)&&s(e,t,i,a);e._passes!==r&&(e._passes=r)}finally{this._conditionEvalDepth--}}}},conditionsPass(e){if("create-post"===this.$root.widget&&"ui-step"!==e.type){var t=this.$root.fields[e.step];if(t&&!this.conditionsPass(t))return!1}if(!e.conditions)return!0;let i=!1;
1return e.conditions.forEach(e=>{if(e.length){let t=!0;e.forEach(e=>{e._passes||(t=!1)}),t&&(i=!0)}}),"hide"===e.conditions_behavior?!i:i}}};window.Voxel.conditionHandlers={"text:equals":(e,t)=>t===e.value,"text:not_equals":(e,t)=>t!==e.value,"text:empty":(e,t)=>!t?.trim()?.length,"text:not_empty":(e,t)=>!!t?.trim()?.length,"text:contains":(e,t)=>t?.match(new RegExp(e.value,"i")),"taxonomy:contains":(e,t)=>Array.isArray(t)&&t.includes(e.value),"taxonomy:not_contains":(e,t)=>!(Array.isArray(t)&&t.includes(e.value)),"taxonomy:empty":(e,t)=>!Array.isArray(t)||!t.length,"taxonomy:not_empty":(e,t)=>Array.isArray(t)&&t.length,"switcher:checked":(e,t)=>!!t,"switcher:unchecked":(e,t)=>!t,"number:empty":(e,t)=>isNaN(parseFloat(t)),"number:equals":(e,t)=>parseFloat(t)===parseFloat(e.value),"number:gt":(e,t)=>parseFloat(t)>parseFloat(e.value),"number:gte":(e,t)=>parseFloat(t)>=parseFloat(e.value),"number:lt":(e,t)=>parseFloat(t)<parseFloat(e.value),"number:lte":(e,t)=>parseFloat(t)<=parseFloat(e.value),"number:not_empty":(e,t)=>!isNaN(parseFloat(t)),"number:not_equals":(e,t)=>parseFloat(t)!==parseFloat(e.value),"file:empty":(e,t)=>!Array.isArray(t)||!t.length,"file:not_empty":(e,t)=>Array.isArray(t)&&t.length,"date:empty":(e,t)=>!isFinite(new Date(t.date+" "+(t.time||"00:00:00"))),"date:gt":(e,t)=>{t=new Date(t.date+" "+(t.time||"00:00:00")),e=new Date(e.value);return!(!isFinite(t)||!isFinite(e))&&e<t},"date:lt":(e,t)=>{t=new Date(t.date+" "+(t.time||"00:00:00")),e=new Date(e.value);return!(!isFinite(t)||!isFinite(e))&&t<e},"date:not_empty":(e,t)=>isFinite(new Date(t.date+" "+(t.time||"00:00:00")))},window.render_auth=()=>{Array.from(document.querySelectorAll(".ts-auth")).forEach(e=>{var t,i;e.__vue_app__||(i=e,(t=Vue.createApp({el:i,mixins:[Voxel.mixins.base],data(){return{widget:"auth",pending:!1,resendCodePending:!1,screen:null,config:null,login:{username:null,password:null,remember:!0},recovery:{email:null,code:null,password:null,confirm_password:null},register:{terms_agreed:!1},update:{password:{current:null,new:null,confirm_new:null,successful:!1},email:{new:null,code:null,state:"send_code"}},privacy:{export_data:{pending:!1},delete_account:{pending:!1,password:"",code:""}},twofa:{qr_code:null,verify_code:"",disable_password:"",backup_codes:[]},login2fa:{user_id:null,session_token:null,code:"",use_backup:!1,trust_device:!1},confirmation_code:null,activePopup:null,activeRole:null}},created(){this.config=JSON.parse(this.$options.el.dataset.config),this.screen=this.config.screen,this.activeRole=this.config.registration.default_role?this.config.registration.roles[this.config.registration.default_role]:Object.values(this.config.registration.roles)[0],Object.values(this.config.registration.roles).forEach(e=>{this.setupConditions(e.fields)});var e=Voxel.getSearchParam("err");e&&this.config.errors[e]&&(Voxel.alert(this.config.errors[e].message,"error"),Voxel.deleteSearchParam("err")),i.classList.remove("hidden")},methods:{submitLogin(){this.recaptcha("vx_login",e=>{this.pending=!0,jQuery.post({url:Voxel_Config.ajax_url+"&action=auth.login",data:{username:this.login.username,password:this.login.password,remember:this.login.remember,redirect_to:this.config.redirectUrl,_wpnonce:this.config.nonce,_recaptcha:e}}).always(e=>{this.pending=!1,e.success?e.requires_2fa?(this.login2fa.user_id=e.user_id,this.login2fa.session_token=e.session_token,this.login2fa.code="",this.login2fa.use_backup=!1,this.screen="login_2fa_verify"):e.confirmed?"{REDIRECT_URL}"===e.redirect_to?window.location.replace(this.config.redirectUrl):window.location.replace(e.redirect_to.replace("{REDIRECT_URL}",encodeURIComponent(this.config.redirectUrl))):this.screen="login_confirm_account":Voxel.alert(e.message||Voxel_Config.l10n.ajaxError,"error")})})},submitRecover(){this.recaptcha("vx_recover",e=>{this.pending=!0,jQuery.post({url:Voxel_Config.ajax_url+"&action=auth.recover",data:{email:this.recovery.email,_wpnonce:this.config.nonce,_recaptcha:e}}).always(e=>{this.pending=!1,e.success?this.screen="recover_confirm":Voxel.alert(e.message||Voxel_Config.l10n.ajaxError,"error")})})},submitRecoverConfirm(){this.recaptcha("vx_recover_confirm",e=>{this.pending=!0,jQuery.post({url:Voxel_Config.ajax_url+"&action=auth.recover_confirm",data:{email:this.recovery.email,code:this.recovery.code,_wpnonce:this.config.nonce,_recaptcha:e}}).always(e=>{this.pending=!1,e.success?this.screen="recover_set_password":Voxel.alert(e.message||Voxel_Config.l10n.ajaxError,"error")})})},submitNewPassword(){this.recaptcha("vx_recover_set_password",e=>{this.pending=!0,jQuery.post({url:Voxel_Config.ajax_url+"&action=auth.recover_set_password",data:{email:this.recovery.email,code:this.recovery.code,password:this.recovery.password,confirm_password:this.recovery.confirm_password,_wpnonce:this.config.nonce,_recaptcha:e}}).always(e=>{this.pending=!1,e.success?(this.screen="login",this.login.username=this.recovery.email,this.recovery.email=null,this.recovery.code=null,this.recovery.password=null,this.recovery.confirm_password=null,this.$refs.loginPassword?.focus()):Voxel.alert(e.message||Voxel_Config.l10n.ajaxError,"error")})})},submitRegister(i={}){this.pending||(this.pending=!0,this.recaptcha("vx_register",e=>{var t=this.getRegisterFormData(this.activeRole),e=(t.append("username",this.register_username||""),t.append("email",this.register_email||""),t.append("password",this.register_password||""),t.append("terms_agreed",this.register.terms_agreed?"yes":""),t.append("_wpnonce",this.config.nonce),t.append("_recaptcha",e||""),t.append("role",this.activeRole.key),t.append("redirect_to",this.config.redirectUrl),Voxel.getSearchParam("plan"));e&&t.append("plan",e),"function"==typeof i.onFormData&&i.onFormData(t),jQuery.post({url:Voxel_Config.ajax_url+"&action=auth.register",data:t,contentType:!1,processData:!1}).always(e=>{e.success?e.verification_required?(this.pending=!1,this.screen="confirm_account"):this._handleRegisterRedirect(e):(this.pending=!1,Voxel.alert(e.message||Voxel_Config.l10n.ajaxError,"error"))})}))},submitConfirmRegistration(){this.submitRegister({onFormData:e=>e.append("_confirmation_code",this.confirmation_code)})},_handleRegisterRedirect(e){"{REDIRECT_URL}"===e.redirect_to?window.location.replace(this.config.redirectUrl):window.location.replace(e.redirect_to.replace("{REDIRECT_URL}",encodeURIComponent(this.config.redirectUrl)))},registerResendConfirmationCode(){this.recaptcha("vx_resend_confirmation_code",e=>{this.resendCodePending=!0,jQuery.post({url:Voxel_Config.ajax_url+"&action=auth.register.resend_confirmation_code",data:{username:this.register_username,email:this.register_email,_wpnonce:this.config.nonce,_recaptcha:e}}).always(e=>{this.resendCodePending=!1,e.success?Voxel.alert(e.message,"info"):Voxel.alert(e.message||Voxel_Config.l10n.ajaxError,"error")})})},submitUpdatePassword(){this.recaptcha("vx_update_password",e=>{this.pending=!0,jQuery.post({url:Voxel_Config.ajax_url+"&action=auth.update_password",data:{current:this.update.password.current,new:this.update.password.new,c
1onfirm_new:this.update.password.confirm_new,_wpnonce:this.config.nonce,_recaptcha:e}}).always(e=>{this.pending=!1,e.success?this.update.password.successful=!0:Voxel.alert(e.message||Voxel_Config.l10n.ajaxError,"error")})})},submitUpdateEmail(){this.recaptcha("vx_update_email",e=>{this.pending=!0,jQuery.post({url:Voxel_Config.ajax_url+"&action=auth.update_email",data:{new:this.update.email.new,code:this.update.email.code,state:this.update.email.state,_wpnonce:this.config.nonce,_recaptcha:e}}).always(e=>{this.pending=!1,e.success?this.update.email.state=e.state:Voxel.alert(e.message||Voxel_Config.l10n.ajaxError,"error")})})},requestPersonalData(){this.recaptcha("vx_request_personal_data",e=>{this.privacy.export_data.pending=!0,jQuery.post({url:Voxel_Config.ajax_url+"&action=auth.request_personal_data",data:{_wpnonce:this.config.nonce,_recaptcha:e}}).always(e=>{this.privacy.export_data.pending=!1,e.success?Voxel.alert(e.message,"success"):Voxel.alert(e.message||Voxel_Config.l10n.ajaxError,"error")})})},deleteAccountPermanently(t=!1){this.recaptcha(t?"vx_delete_account_permanently":"vx_delete_account",e=>{this.privacy.delete_account.pending=!0,jQuery.post({url:Voxel_Config.ajax_url+"&action=auth.delete_account_permanently",data:{password:this.privacy.delete_account.password,_wpnonce:this.config.nonce,_recaptcha:e,confirmation_code:this.privacy.delete_account.code,confirmed:t?"yes":""}}).always(e=>{this.privacy.delete_account.pending=!1,e.success?t?location.reload():(this.privacy.delete_account.code=e.confirmation_code,this.screen="security_delete_account_confirm"):Voxel.alert(e.message||Voxel_Config.l10n.ajaxError,"error")})})},recaptcha(e,t){this.config.recaptcha.enabled?grecaptcha.ready(()=>{grecaptcha.execute(this.config.recaptcha.key,{action:e}).then(e=>t(e))}):t(null)},canRegister(){return Object.keys(this.config.registration.roles).length},getRegisterFormData(e){var i=new FormData,a={};return Object.values(e.fields).forEach(t=>{"auth"!==t.source&&this.conditionsPass(t)&&("file"===t.type||"image"===t.type||"profile-avatar"===t.type?(a[t.key]=[],t.value.forEach(e=>{"new_upload"===e.source&&(i.append(`files[${t.id}][]`,e.item),a[t.key].push("uploaded_file"))})):null!==t.value&&(a[t.key]=t.value))}),i.append("postdata",JSON.stringify(a)),i},shouldValidate(e){return!1},setup2fa(){this.pending=!0,jQuery.post({url:Voxel_Config.ajax_url+"&action=auth.2fa_setup",data:{_wpnonce:this.config.nonce}}).always(e=>{this.pending=!1,e.success?(this.twofa.qr_code=e.qr_code,this.twofa.verify_code="",this.screen="security_2fa_setup"):Voxel.alert(e.message||Voxel_Config.l10n.ajaxError,"error")})},submit2faSetup(){this.pending=!0,jQuery.post({url:Voxel_Config.ajax_url+"&action=auth.2fa_enable",data:{code:this.twofa.verify_code,_wpnonce:this.config.nonce}}).always(e=>{this.pending=!1,e.success?(this.twofa.backup_codes=e.backup_codes,this.config.twofa.enabled=!0,this.config.twofa.backup_codes_count=e.backup_codes.length,this.screen="security_2fa_backup_codes",Voxel.alert(this.config.l10n.twofa_enabled,"success")):Voxel.alert(e.message||Voxel_Config.l10n.ajaxError,"error")})},disable2fa(){Voxel.prompt(this.config.l10n.twofa_disable_confirm,"warning",[{label:Voxel_Config.l10n.yes,onClick:()=>{this.pending=!0,jQuery.post({url:Voxel_Config.ajax_url+"&action=auth.2fa_disable",data:{password:this.twofa.disable_password,_wpnonce:this.config.nonce}}).always(e=>{this.pending=!1,e.success?(this.config.twofa.enabled=!1,this.config.twofa.backup_codes_count=0,this.twofa.disable_password="",this.screen="security",Voxel.alert(this.config.l10n.twofa_disabled,"success")):Voxel.alert(e.message||Voxel_Config.l10n.ajaxError,"error")})}},{label:Voxel_Config.l10n.no,onClick:()=>{}}],7500)},regenerateBackupCodes(){Voxel.prompt(this.config.l10n.twofa_regenerate_backups_confirm,"warning",[{label:Voxel_Config.l10n.yes,onClick:()=>{this.pending=!0,jQuery.post({url:Voxel_Config.ajax_url+"&action=auth.2fa_regenerate_backups",data:{_wpnonce:this.config.nonce}}).always(e=>{this.pending=!1,e.success?(this.twofa.backup_codes=e.backup_codes,this.config.twofa.backup_codes_count=e.backup_codes.length,this.screen="security_2fa_backup_codes",Voxel.alert(this.config.l10n.twofa_backups_generated,"success")):Voxel.alert(e.message||Voxel_Config.l10n.ajaxError,"error")})}},{label:Voxel_Config.l10n.no,onClick:()=>{}}],7500)},removeAllTrustedDevices(){Voxel.prompt(this.config.l10n.twofa_remove_trusted_devices_confirm,"warning",[{label:Voxel_Config.l10n.yes,onClick:()=>{this.pending=!0,jQuery.post({url:Voxel_Config.ajax_url+"&action=auth.2fa_remove_trusted_devices",data:{_wpnonce:this.config.nonce}}).always(e=>{this.pending=!1,e.success?(this.config.twofa.trusted_devices_count=0,Voxel.alert(this.config.l10n.twofa_trusted_devices_removed,"success")):Voxel.alert(e.message||Voxel_Config.l10n.ajaxError,"error")})}},{label:Voxel_Config.l10n.no,onClick:()=>{}}],7500)},submit2faVerification(){this.pending=!0,jQuery.post({url:Voxel_Config.ajax_url+"&action=auth.verify_2fa",data:{user_id:this.login2fa.user_id,session_token:this.login2fa.session_token,code:this.login2fa.code,use_backup:this.login2fa.use_backup?"yes":"no",trust_device:this.login2fa.trust_device?"yes":"no",remember:this.login.remember?"yes":"no",redirect_to:this.config.redirectUrl,_wpnonce:this.config.nonce}}).always(e=>{this.pending=!1,e.success?"{REDIRECT_URL}"===e.redirect_to?window.location.replace(this.config.redirectUrl):window.location.replace(e.redirect_to.replace("{REDIRECT_URL}",encodeURIComponent(this.config.redirectUrl))):Voxel.alert(e.message||Voxel_Config.l10n.ajaxError,"error")})},copyBackupCodes(){var e=this.twofa.backup_codes.join("\n");Voxel.copy(e)}},watch:{screen(e){"security_2fa_setup"!==e||this.twofa.qr_code||this.setup2fa()},confirmation_code(e){e&&5===e.length&&!this.pending&&this.submitConfirmRegistration()}},computed:{register_username(){return this.activeRole?.fields["voxel:auth-username"]?.value||null},register_email(){return this.activeRole?.fields["voxel:auth-email"].value},register_password(){return this.activeRole?.fields["voxel:auth-password"].value}}})).mixin(c),t.component("form-popup",Voxel.components.popup),t.component("form-group",Voxel.components.formGroup),a.template="#auth-date-field",t.component("date-field",a),r.template="#auth-taxonomy-field",t.component("taxonomy-field",r),s.template="#auth-term-list",t.component("term-list",s),o.template="#auth-file-field",t.component("file-field",o),l.template="#auth-select-field",t.component("select-field",l),n.template="#auth-multiselect-field",t.component("multiselect-field",n),t.mount(e))})},window.render_auth(),jQuery(document).on("voxel:markup-update",window.render_auth)});
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.