(function (){
'use strict';
var cfg=window.PIPChatbot||{};
function renderMarkdown(text){
return text
.replace(/&/g, '&amp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/\*\*(.*?)\*\*/g, '<strong>$1</strong>')
.replace(/\[([^\]]+)\]\((https?:\/\/[^)]+)\)/g, '<a href="$2">$1</a>')
.replace(/((?:^[ \t]*[-*][ \t]+.+\n?)+)/gm, function (block){
var items=block.trim().split('\n').map(function (line){
return '<li>' + line.replace(/^[ \t]*[-*][ \t]+/, '') + '</li>';
}).join('');
return '<ul>' + items + '</ul>';
})
.replace(/\n{2,}/g, '</p><p>')
.replace(/\n/g, '<br>')
.replace(/^/, '<p>').replace(/$/, '</p>');
}
var timeoutMs=(cfg.sessionTimeout||30) * 60 * 1000;
var lastActive=parseInt(sessionStorage.getItem('pip_chat_time')||'0', 10);
if(lastActive&&Date.now() - lastActive > timeoutMs){
['pip_session_id','pip_lead_id','pip_lead_name','pip_lead_email',
'pip_messages','pip_chat_time','pip_auto_opened'].forEach(function (k){
sessionStorage.removeItem(k);
});
}
var sessionId=sessionStorage.getItem('pip_session_id');
if(!sessionId){
sessionId='pip_' + Math.random().toString(36).substr(2, 9) + '_' + Date.now().toString(36);
sessionStorage.setItem('pip_session_id', sessionId);
}
var savedMessages=JSON.parse(sessionStorage.getItem('pip_messages')||'[]');
var state={
open:           false,
leadCaptured:   !!sessionStorage.getItem('pip_lead_id')||cfg.leadMode==='off',
leadId:         sessionStorage.getItem('pip_lead_id')||null,
leadName:       sessionStorage.getItem('pip_lead_name')||'',
leadEmail:      sessionStorage.getItem('pip_lead_email')||'',
skipped:        false,
messages:       savedMessages,
pendingMessage: null,
loading:        false,
initialized:    false,
};
var iconChat='<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M20 2H4a2 2 0 0 0-2 2v18l4-4h14a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2zm0 14H6l-2 2V4h16v12z"/></svg>';
var iconClose='<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/></svg>';
var iconSend='';
var el={};
function build(){
if(cfg.primaryColor){
document.documentElement.style.setProperty('--pip-primary', cfg.primaryColor);
}
var wrapper=document.createElement('div');
wrapper.id='pip-chatbot-wrapper';
var toggle=document.createElement('button');
toggle.id='pip-chatbot-toggle';
toggle.setAttribute('aria-label', 'Open PIP chat');
toggle.setAttribute('aria-expanded', 'false');
toggle.innerHTML='<span class="pip-icon-open">' + iconChat + '</span>'
+ '<span class="pip-icon-close">' + iconClose + '</span>'
+ '<span id="pip-chatbot-badge" style="display:none" aria-label="1 unread message">1</span>';
var win=document.createElement('div');
win.id='pip-chatbot-window';
win.setAttribute('aria-label', 'PIP chat window');
win.style.display='none';
var logoHtml;
if(cfg.logoUrl){
logoHtml='<img id="pip-chatbot-header-logo" src="' + cfg.logoUrl + '" alt="' + (cfg.botName||'PIP') + '">';
}else{
logoHtml='<div id="pip-chatbot-header-logo pip-no-logo" aria-hidden="true">P</div>';
}
win.innerHTML =
'<div id="pip-chatbot-header">'
+   logoHtml
+   '<div id="pip-chatbot-header-info">'
+     '<div id="pip-chatbot-header-name">' + esc(cfg.botName||'PIP Assistant') + '</div>'
+     '<div id="pip-chatbot-header-status">Online</div>'
+   '</div>'
+   '<button id="pip-chatbot-header-close" aria-label="Close chat">' + iconClose + '</button>'
+ '</div>'
+ '<div id="pip-chatbot-messages" role="log" aria-live="polite"></div>'
+ '<div id="pip-chatbot-lead-form" style="display:none">'
+   '<p>Could I grab your name and email to get started?</p>'
+   '<input id="pip-lead-name"  class="pip-lead-input" type="text"  placeholder="Your name"  autocomplete="given-name">'
+   '<input id="pip-lead-email" class="pip-lead-input" type="email" placeholder="Your email" autocomplete="email">'
+   '<div id="pip-lead-error" class="pip-lead-error"></div>'
+   '<div class="pip-lead-buttons">'
+     '<button id="pip-lead-submit" class="pip-btn-primary">Start Chatting</button>'
+     '<button id="pip-lead-skip"   class="pip-btn-skip"    style="display:none">Skip</button>'
+   '</div>'
+ '</div>'
+ '<div id="pip-chatbot-input-area" style="display:none">'
+   '<textarea id="pip-chatbot-input" placeholder="Type a message…" rows="1" aria-label="Message input"></textarea>'
+   '<button id="pip-chatbot-send" aria-label="Send message">' + iconSend + '</button>'
+ '</div>'
+ (cfg.teamsEnabled
? '<div id="pip-chatbot-human" style="display:none">'
+   '<button id="pip-human-btn">Talk to a Human</button>'
+ '</div>'
+ '<div id="pip-chatbot-handoff-form" style="display:none">'
+   '<p>Please provide some details before I connect you.</p>'
+   '<input id="pip-handoff-name"  class="pip-lead-input" type="text"  placeholder="Your name">'
+   '<input id="pip-handoff-email" class="pip-lead-input" type="email" placeholder="Email address">'
+   '<input id="pip-handoff-phone" class="pip-lead-input" type="tel"   placeholder="Or phone number">'
+   '<div id="pip-handoff-error" class="pip-lead-error"></div>'
+   '<div class="pip-lead-buttons">'
+     '<button id="pip-handoff-submit" class="pip-btn-primary">Connect Me</button>'
+     '<button id="pip-handoff-cancel" class="pip-btn-skip">Cancel</button>'
+   '</div>'
+ '</div>'
: '');
wrapper.appendChild(toggle);
wrapper.appendChild(win);
document.body.appendChild(wrapper);
el.toggle=toggle;
el.badge=document.getElementById('pip-chatbot-badge');
el.window=win;
el.messages=document.getElementById('pip-chatbot-messages');
el.leadForm=document.getElementById('pip-chatbot-lead-form');
el.leadName=document.getElementById('pip-lead-name');
el.leadEmail=document.getElementById('pip-lead-email');
el.leadError=document.getElementById('pip-lead-error');
el.leadSubmit=document.getElementById('pip-lead-submit');
el.leadSkip=document.getElementById('pip-lead-skip');
el.inputArea=document.getElementById('pip-chatbot-input-area');
el.input=document.getElementById('pip-chatbot-input');
el.send=document.getElementById('pip-chatbot-send');
el.close=document.getElementById('pip-chatbot-header-close');
el.humanBar=document.getElementById('pip-chatbot-human');
el.humanBtn=document.getElementById('pip-human-btn');
el.handoffForm=document.getElementById('pip-chatbot-handoff-form');
el.handoffSubmit=document.getElementById('pip-handoff-submit');
el.handoffCancel=document.getElementById('pip-handoff-cancel');
el.handoffError=document.getElementById('pip-handoff-error');
if(cfg.leadMode==='skip'){
el.leadSkip.style.display='';
}}
function bindEvents(){
el.toggle.addEventListener('click', function (){
state.open ? closeChat():openChat();
});
el.close.addEventListener('click', closeChat);
el.leadSubmit.addEventListener('click', submitLead);
el.leadSkip.addEventListener('click',   skipLead);
el.leadEmail.addEventListener('keydown', function (e){
if(e.key==='Enter'){ submitLead(); }});
el.leadName.addEventListener('keydown', function (e){
if(e.key==='Enter'){ el.leadEmail.focus(); }});
el.send.addEventListener('click', handleSend);
if(el.humanBtn){ el.humanBtn.addEventListener('click',      handleHumanHandoff); }
if(el.handoffSubmit){ el.handoffSubmit.addEventListener('click', submitHandoffForm); }
if(el.handoffCancel){ el.handoffCancel.addEventListener('click', cancelHandoffForm); }
el.input.addEventListener('keydown', function (e){
if(e.key==='Enter'&&!e.shiftKey){
e.preventDefault();
handleSend();
}});
el.input.addEventListener('input', autoResizeInput);
document.addEventListener('keydown', function (e){
if(e.key==='Escape'&&state.open){ closeChat(); }});
}
function openChat(){
state.open=true;
el.toggle.classList.add('pip-is-open');
el.toggle.setAttribute('aria-expanded', 'true');
el.window.style.display='flex';
el.window.classList.add('pip-window-open');
el.badge.style.display='none';
if(!state.initialized){
state.initialized=true;
showWelcome();
}
setTimeout(function (){
if(state.leadCaptured){
el.input.focus();
}else{
el.leadName.focus();
}}, 100);
}
function closeChat(){
state.open=false;
el.toggle.classList.remove('pip-is-open');
el.toggle.setAttribute('aria-expanded', 'false');
el.window.style.display='none';
el.window.classList.remove('pip-window-open');
}
function showWelcome(){
if(state.messages.length > 0){
state.messages.forEach(function (msg){
renderMessage(msg.content, msg.role);
});
showInputArea();
return;
}
var msg=state.proactive ? getProactiveMessage():(cfg.welcomeMessage||"G'day! How can PIP help you today?");
addMessage(msg, 'bot');
if(state.leadCaptured){
showInputArea();
}else{
el.leadForm.style.display='';
}}
function submitLead(){
var name=el.leadName.value.trim();
var email=el.leadEmail.value.trim();
clearLeadError();
if(!name){
showLeadError('Please enter your name.');
el.leadName.classList.add('pip-error');
el.leadName.focus();
return;
}
if(!email||!isValidEmail(email)){
showLeadError('Please enter a valid email address.');
el.leadEmail.classList.add('pip-error');
el.leadEmail.focus();
return;
}
el.leadSubmit.disabled=true;
el.leadSubmit.textContent='Saving…';
var pending=el.input.value.trim()||state.pendingMessage||'';
fetch(cfg.apiBase + 'lead', {
method:  'POST',
headers: {
'Content-Type': 'application/json',
'X-PIP-Nonce':  cfg.nonce,
},
body: JSON.stringify({
name:            name,
email:           email,
initial_message: pending,
session_id:      sessionId,
}),
})
.then(function (r){ return r.json(); })
.then(function (data){
if(data.error){
showLeadError(data.error);
el.leadSubmit.disabled=false;
el.leadSubmit.textContent='Start Chatting';
return;
}
state.leadCaptured=true;
state.leadId=data.lead_id;
state.leadName=name;
state.leadEmail=email;
sessionStorage.setItem('pip_lead_id',    data.lead_id);
sessionStorage.setItem('pip_lead_name',  name);
sessionStorage.setItem('pip_lead_email', email);
el.leadForm.style.display='none';
addMessage('Thanks ' + esc(name) + '! How can I help you today?', 'bot');
showInputArea();
if(pending){
el.input.value='';
sendMessage(pending);
}})
.catch(function (){
showLeadError('Something went wrong. Please try again.');
el.leadSubmit.disabled=false;
el.leadSubmit.textContent='Start Chatting';
});
}
function skipLead(){
state.leadCaptured=true;
state.skipped=true;
el.leadForm.style.display='none';
showInputArea();
el.input.focus();
}
function showLeadError(msg){
el.leadError.textContent=msg;
el.leadError.classList.add('pip-visible');
}
function clearLeadError(){
el.leadError.classList.remove('pip-visible');
el.leadName.classList.remove('pip-error');
el.leadEmail.classList.remove('pip-error');
}
function showInputArea(){
el.inputArea.style.display='';
if(el.humanBar){ el.humanBar.style.display=''; }
el.input.focus();
}
function handleHumanHandoff(){
if(el.humanBtn.disabled){ return; }
if(state.leadId){
fireHandoff(state.leadName, state.leadEmail, '');
return;
}
el.humanBar.style.display='none';
el.inputArea.style.display='none';
el.handoffForm.style.display='';
document.getElementById('pip-handoff-name').focus();
}
function submitHandoffForm(){
var name=document.getElementById('pip-handoff-name').value.trim();
var email=document.getElementById('pip-handoff-email').value.trim();
var phone=document.getElementById('pip-handoff-phone').value.trim();
el.handoffError.textContent='';
el.handoffError.classList.remove('pip-visible');
if(!name){
el.handoffError.textContent='Please enter your name.';
el.handoffError.classList.add('pip-visible');
document.getElementById('pip-handoff-name').focus();
return;
}
if(!email&&!phone){
el.handoffError.textContent='Please enter an email address or phone number.';
el.handoffError.classList.add('pip-visible');
return;
}
if(email&&!isValidEmail(email)){
el.handoffError.textContent='Please enter a valid email address.';
el.handoffError.classList.add('pip-visible');
return;
}
el.handoffSubmit.disabled=true;
el.handoffSubmit.textContent='Connecting\u2026';
fetch(cfg.apiBase + 'lead', {
method:  'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
name:            name,
email:           email,
phone:           phone,
initial_message: 'Requested human handoff',
session_id:      sessionId,
}),
})
.then(function (r){ return r.json(); })
.then(function (data){
if(data.lead_id){
state.leadId=data.lead_id;
state.leadName=name;
state.leadEmail=email;
sessionStorage.setItem('pip_lead_id',    data.lead_id);
sessionStorage.setItem('pip_lead_name',  name);
sessionStorage.setItem('pip_lead_email', email);
}
return fireHandoff(name, email, phone);
})
.catch(function (){
el.handoffSubmit.disabled=false;
el.handoffSubmit.textContent='Connect Me';
el.handoffError.textContent='Something went wrong. Please try again.';
el.handoffError.classList.add('pip-visible');
});
}
function cancelHandoffForm(){
el.handoffForm.style.display='none';
el.inputArea.style.display='';
el.humanBar.style.display='';
}
function fireHandoff(name, email, phone){
el.humanBtn&&(el.humanBtn.disabled=true);
var history=state.messages.map(function (m){
return { role: m.role==='bot' ? 'assistant':'user', content: m.content };});
return fetch(cfg.apiBase + 'handoff', {
method:  'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
session_id: sessionId,
lead_name:  name||state.leadName||'',
lead_email: email||state.leadEmail||'',
lead_phone: phone||'',
history:    history,
}),
})
.then(function (r){ return r.json(); })
.then(function (){
el.handoffForm&&(el.handoffForm.style.display='none');
el.humanBar&&(el.humanBar.style.display='none');
el.inputArea.style.display='';
addMessage(
"No worries" + (name ? ", " + esc(name):"") + "! I\u2019ve notified our team with your details "
+ "and someone will be in touch shortly. Feel free to keep chatting in the meantime or "
+ "[send us a message](https://pip.com.au/contact-pip/).",
'bot'
);
});
}
function handleSend(){
var text=el.input.value.trim();
if(!text||state.loading){ return; }
if(!state.leadCaptured){
state.pendingMessage=text;
el.leadForm.style.display='';
el.leadName.focus();
return;
}
el.input.value='';
resetInputHeight();
sendMessage(text);
}
function sendMessage(text){
addMessage(text, 'user');
state.loading=true;
el.send.disabled=true;
showTyping();
var history=state.messages.slice(0, -1).map(function (m){
return { role: m.role==='bot' ? 'assistant':'user', content: m.content };});
while (history.length > 0&&history[0].role==='assistant'){
history.shift();
}
fetch(cfg.apiBase + 'message', {
method:  'POST',
headers: {
'Content-Type': 'application/json',
'X-PIP-Nonce':  cfg.nonce,
},
body: JSON.stringify({
message:    text,
history:    history,
lead_id:    state.leadId ? parseInt(state.leadId, 10):null,
session_id: sessionId,
skipped:    state.skipped,
}),
})
.then(function (r){ return r.json(); })
.then(function (data){
hideTyping();
state.loading=false;
el.send.disabled=false;
if(data.reply){
addMessage(data.reply, 'bot');
}else{
console.error('PIP Chatbot API error:', data);
addMessage("Sorry, I'm having trouble right now. Please try again or [contact PIP](https://pip.com.au/contact-pip/).", 'bot');
}
el.input.focus();
})
.catch(function (){
hideTyping();
state.loading=false;
el.send.disabled=false;
addMessage("I lost connection there. Please check your internet and try again.", 'bot');
});
}
function addMessage(content, role){
state.messages.push({ role: role, content: content });
sessionStorage.setItem('pip_messages', JSON.stringify(state.messages));
sessionStorage.setItem('pip_chat_time', Date.now().toString());
renderMessage(content, role);
}
function renderMessage(content, role){
var wrap=document.createElement('div');
wrap.className='pip-msg pip-msg-' + role;
var avatar=document.createElement('div');
avatar.className='pip-msg-avatar';
avatar.textContent=role==='bot' ? 'P':'You';
avatar.setAttribute('aria-hidden', 'true');
var bubble=document.createElement('div');
bubble.className='pip-msg-bubble';
if(role==='bot'){
bubble.innerHTML=renderMarkdown(content);
}else{
bubble.textContent=content;
}
var time=document.createElement('div');
time.className='pip-msg-time';
time.textContent=formatTime(new Date());
var inner=document.createElement('div');
inner.style.maxWidth='100%';
inner.appendChild(bubble);
inner.appendChild(time);
wrap.appendChild(avatar);
wrap.appendChild(inner);
el.messages.appendChild(wrap);
scrollBottom();
}
function showTyping(){
var div=document.createElement('div');
div.id='pip-chatbot-typing';
div.innerHTML =
'<div class="pip-typing-avatar" aria-hidden="true">P</div>'
+ '<div class="pip-typing-bubble">'
+   '<div class="pip-dot"></div><div class="pip-dot"></div><div class="pip-dot"></div>'
+ '</div>';
el.messages.appendChild(div);
scrollBottom();
}
function hideTyping(){
var t=document.getElementById('pip-chatbot-typing');
if(t){ t.remove(); }}
function scrollBottom(){
el.messages.scrollTop=el.messages.scrollHeight;
}
function autoResizeInput(){
el.input.style.height='auto';
el.input.style.height=Math.min(el.input.scrollHeight, 100) + 'px';
}
function resetInputHeight(){
el.input.style.height='38px';
}
function formatTime(d){
return d.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
}
function isValidEmail(e){
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e);
}
function esc(str){
var d=document.createElement('div');
d.textContent=str;
return d.innerHTML;
}
function getProactiveMessage(){
var path=window.location.pathname.toLowerCase();
if(/nbn|internet|broadband/.test(path))      return "G\u2019day! Looking for a fast, reliable internet connection? I can help you find the right NBN plan.";
if(/managed-it|msp|it-support|helpdesk/.test(path)) return "Need reliable IT support for your business? I can walk you through what PIP\u2019s managed IT service covers.";
if(/medical|health/.test(path))               return "Looking for IT solutions tailored to your medical practice? I\u2019d love to help point you in the right direction.";
if(/ai|artificial-intelligence/.test(path))   return "Curious about AI for your business? PIP can help you get started \u2014 ask me anything!";
if(/cloud/.test(path))                        return "Exploring cloud solutions? I can help match you with the right setup for your business.";
if(/proxmox/.test(path))                      return "Interested in Proxmox infrastructure? I can connect you with our team to discuss your options.";
if(/contact/.test(path))                      return "G\u2019day! Got a question for PIP? I\u2019m here to help right now.";
return cfg.proactiveMessage||"G\u2019day! Can I help you find the right internet or IT solution today?";
}
function schedulePopup(){
var delay=typeof cfg.popupDelay==='number' ? cfg.popupDelay:5000;
if(delay < 0){ return; }
setTimeout(function (){
el.toggle.classList.add('pip-animate-in');
if(!state.initialized&&!sessionStorage.getItem('pip_auto_opened')){
sessionStorage.setItem('pip_auto_opened', '1');
state.proactive=true;
openChat();
}else{
el.badge.style.display='';
}}, delay);
}
function init(){
if(document.readyState==='loading'){
document.addEventListener('DOMContentLoaded', init);
return;
}
build();
bindEvents();
schedulePopup();
}
init();
})();
(()=>{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})();