1import{aq as p,ar as u,as as T,f as c,an as w}from"./chunkReloadRecoveryC4XyrbqR.js";import{D as m,a1 as E}from"./vue-runtimeBcw72k-n.js";async function C(s="Are you sure you want to do this?",e={title:"Confirm",okTitle:"OK",cancelTitle:"Cancel",okVariant:"danger",hideHeaderClose:!1},n=!1){return await x("msgBoxConfirm").show(s,e,n)}const h=50;function _(s,e){try{const n=window,t=n.__KINDREDLY_TOASTS__||(n.__KINDREDLY_TOASTS__=[]);t.push({message:s,type:e,at:Date.now()}),t.length>h&&t.splice(0,t.length-h)}catch{}}function v(s,e={}){(e==null?void 0:e.variant)=="danger"&&(e.variant="error");const n=(e==null?void 0:e.variant)||"success";if(typeof window<"u"&&window.__PLAYWRIGHT_TEST__){_(s,n);return}p(s,{...e,type:n})}function x(s){const e=m();if(!e)return;if(e.refs[s])return e.refs[s];let n=e.parent;for(;n;){if(n.refs[s])return n.refs[s];n=n.parent}}function P(s){const e=document.getElementById(s);if(e!==null){let n=!1;e!=null&&e.classList.contains("show")&&(n=!0),e!=null&&e.classList.contains("closing")&&(n=!1),n&&e.dispatchEvent(new Event("bv-toggle"))}}function B(){const s=document.querySelectorAll(".modal.show");for(const e of s)e.dispatchEvent(new Event("bv-toggle"))}function Y(s){const e=document.getElementById(s);if(e!==null){let n=!1;e!=null&&e.classList.contains("show")&&(n=!0),e!=null&&e.classList.contains("closing")&&(n=!1),n||e.dispatchEvent(new Event("bv-toggle"))}}const f=T.admin.token,b=6*60*60*1e3,i=E({token:null,sessionExpired:!1,sessionExpiredMessage:null});let l=null;function I(s){var e;if(!s)return null;try{const n=s.split(".")[1];if(!n)return null;const t=atob(n.replace(/-/g,"+").replace(/_/g,"/")),o=(e=JSON.parse(t))==null?void 0:e.exp;return typeof o=="number"?o*1e3:null}catch{return null}}async function $(){return i.token||(i.token=await u.persistentGetString(f)),c("isLoggedIn",i.token),!!i.token}function q(){return!!i.token}async function S(){return i.token||(i.token=await u.persistentGetString(f)),i.token}function L(s){u.persistentSetString(f,s),i.token=s}function M(){return u.persistentClear(f),i.token=null}function y(s){i.sessionExpired||(M(),i.sessionExpired=!0,i.sessionExpiredMessage=s,v(s,{variant:"danger"}))}function R(){return l||(l=(async()=>{var e;const s=await S();if(s)try{const n=await fetch(`${w}/admin/refresh`,{method:"POST",headers:{"Content-Type":"application/json",authorization:`Bearer ${s}`}});if(n.status===401||n.status===403){y("Your admin session has expired. Please sign in again.");return}const t=await n.json().catch(()=>null),o=(e=t==null?void 0:t.results)==null?void 0:e.token;n.ok&&(t!=null&&t.success)&&o&&L(o)}catch(n){c("Admin token refresh failed",n)}})().finally(()=>{l=null}),l)}async function G(s,e=null,n={}){const t={"Content-Type":"application/json"},o=await S();o&&(t.authorization=`Bearer ${o}`),c("Sending request to",s,"with data",e,"and options",n);const k=e?JSON.stringify(e):null,r=await fetch(`${w}${s}`,{method:(n==null?void 0:n.method)||"POST",headers:t,body:k}),g=await r.text();let a=null;try{a=g?JSON.parse(g):null}catch{a=null}if(c("Response from",s,"with data ",a),r.status===401||r.status===403)return y("Your admin session has expired. Please sign in again."),{success:!1,message:"Your admin session has expired. Please sign in again."};if(r.ok&&(a!=null&&a.success)){const d=I(o);return d!==null&&d-Date.now()<b&&R(),{success:!0,result:a.results}}else return{success:!1,message:(a==null?void 0:a.message)||`Request failed (${r.status})`}}const H=i;export{Y as a,v as b,P as c,H as d,C as e,L as f,B as g,q as i,M as l,$ as r,G as s};
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.