import{q as u,r as a,y as l}from"./app-04760a94.js";import{h as o}from"./moment-e3df16af.js";const{route:i}=window;function b(e){const{auth:t}=u().props;return(t==null?void 0:t.selected_role)==="Super Admin"?!0:typeof e!="string"?!1:(t==null?void 0:t.permissions).includes(e)}function g(e){let t=e;const{auth:r}=u().props;if((r==null?void 0:r.selected_role)==="Super Admin")return!0;if(!Array.isArray(e))return!1;let n=r==null?void 0:r.permissions;return t.some(s=>n.includes(s))}function x(...e){return e.filter(Boolean).join(" ")}function c(e){return i().current(e)}function f(e){let t;return Object.entries(e).forEach(r=>{let n=r[1].find(s=>s.children&&s.children.some(m=>c(m.active_route)));t=typeof n<"u"?n:void 0}),t}function y(e){return e?"Yes":"No"}function h(e,t){let r=f(e);return typeof r<"u"&&r.active_route===t}function v(e,t){const{auth:{time_format:r}}=u().props;return t?o(e,t).format(r):o(e).format(r)}function k(e,t){const{auth:{date_format:r,date_separator:n}}=u().props;let s=r.replace(/%/g,n);return t?o(e,t).format(s):o(e).format(s)}function w(){const{auth:{date_format:e,date_separator:t}}=u().props;return e.replace(/%/g,t)}function _(e){const{auth:{time_duration_format:t}}=u().props,r=o.duration(e);return t==="H[h] m[m] s[s]"&&r.minutes()===0&&r.seconds()===0?r.hours()+"h":t==="H[h] m[m] s[s]"&&r.hours()===0&&r.seconds()===0?r.minutes()+"m":t==="H[h] m[m] s[s]"&&r.hours()===0?r.minutes()+"m "+r.seconds()+"s":t==="H[h] m[m] s[s]"&&r.hours()===0&&r.minutes()===0?r.seconds()+"s":t==="H[h] m[m] s[s]"&&r.seconds()===0?r.hours()+"h "+r.minutes()+"m":o.utc(o.duration(e,"seconds").as("milliseconds")).format(t)}const C=()=>{const e=a.useRef(!0);return a.useEffect(()=>{e.current=!1},[]),e.current},E=(e,t={})=>{Object.keys(t).length>0?l.get(i(i().current(),t),e,{preserveState:!0,replace:!0}):l.get(i(i().current()),e,{preserveState:!0,replace:!0})},A=e=>{let t={};return Object.entries(e).forEach(r=>{r[1].length>0&&(t[r[0]]=r[1])}),t};function P(e){if(navigator.clipboard&&window.isSecureContext)return navigator.clipboard.writeText(e);{let t=document.createElement("textarea");return t.value=e,t.style.position="fixed",t.style.left="-999999px",t.style.top="-999999px",document.body.appendChild(t),t.focus(),t.select(),new Promise((r,n)=>{document.execCommand("copy")?r():n(),t.remove()})}}function O(e){const t=e.replace(/([A-Z])/g," $1");return t.charAt(0).toUpperCase()+t.slice(1)}function j(e){if(e==="assigned")return a.createElement("span",{className:"bg-blue-100 text-blue-800 text-sm font-medium me-2 px-2.5 py-0.5 rounded dark:bg-blue-900 dark:text-blue-300"},e);if(e==="in repair")return a.createElement("span",{className:"bg-green-100 text-green-800 text-sm font-medium me-2 px-2.5 py-0.5 rounded dark:bg-green-900 dark:text-green-300"},e);if(e==="end of life")return a.createElement("span",{className:"bg-red-100 text-red-800 text-sm font-medium me-2 px-2.5 py-0.5 rounded dark:bg-red-900 dark:text-red-300"},e);if(e==="unassigned")return a.createElement("span",{className:"bg-yellow-100 text-yellow-800 text-sm font-medium me-2 px-2.5 py-0.5 rounded dark:bg-yellow-900 dark:text-yellow-300"},e)}function N(e){return Math.round(e*100)/100}function D(){return[{label:"10",value:"10"},{label:"20",value:"20"},{label:"50",value:"50"},{label:"100",value:"100"},{label:"150",value:"150"},{label:"200",value:"200"},{label:"500",value:"500"}]}export{y as P,g as a,_ as b,x as c,h as d,C as e,k as f,A as g,w as h,c as i,O as j,v as k,P as l,N as m,j as n,D as p,i as r,E as s,b as u};
