PageSourceSearch

https://barebeauty.sa/build/assets/app-shared-CKDgHUBD.js

js barebeauty.sa collected 2026-09-24 14:27:27 UTC 143,357 bytes, 1 lines download raw bytes

1var Nn=Object.defineProperty,On=Object.defineProperties;var Fn=Object.getOwnPropertyDescriptors;var kt=Object.getOwnPropertySymbols;var Pn=Object.prototype.hasOwnProperty,Mn=Object.prototype.propertyIsEnumerable;var xt=(t,e,n)=>e in t?Nn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,_=(t,e)=>{for(var n in e||(e={}))Pn.call(e,n)&&xt(t,n,e[n]);if(kt)for(var n of kt(e))Mn.call(e,n)&&xt(t,n,e[n]);return t},X=(t,e)=>On(t,Fn(e));import{t as ge,T as Dn,M as Ge,G as jn,a as _t,S as Wn,b as Un,c as Bn,B as Lt,d as Rt}from"./ui-BChMl1ia.js";import{e as se,u as be,j as Y,r as u,f as G,h as ae,P as Vn,R as lt,L as $t}from"./vendor-DviMR2vF.js";import{L as ln,f as un}from"./utils-nrJLb57x.js";const qe=()=>{var t,e;return window.isDemo||((e=(t=window.page)==null?void 0:t.props)==null?void 0:e.is_demo)||!1},yt="This action is disabled in demo mode. You can only create new data, not modify existing demo data.",Hn=se.put,Kn=se.delete,zn=se.patch;se.put=function(t,e,n){if(qe()){ge.error(yt,{duration:5e3});return}return Hn.call(this,t,e,n)};se.delete=function(t,e){if(qe()){ge.error(yt,{duration:5e3});return}return Kn.call(this,t,e)};se.patch=function(t,e,n){if(qe()){ge.error(yt,{duration:5e3});return}return zn.call(this,t,e,n)};const Et={success:(t,e)=>ge.success(t,_({duration:5e3},e)),error:(t,e)=>ge.error(t,_({duration:6e3},e)),loading:(t,e)=>{if(!(qe()&&(t.includes("Delet")||t.includes("Updat")||t.includes("Reset")||t.includes("Modif")||t.includes("Activ")||t.includes("Deactiv"))))return ge.loading(t,e)}},qn=((...t)=>ge(...t)),Le=new Proxy(qn,{get(t,e){if(typeof e=="string"&&e in Et)return Et[e];const n=ge[e];return n!==void 0?n:t[e]}}),Pr=()=>{const{i18n:t}=be(),e=t.dir()==="rtl"?"top-left":"top-right";return Y.jsx(Dn,{position:e,duration:5e3,richColors:!0,closeButton:!0},t.language)},Q={logoDark:"/images/logos/logo-dark.png",logoLight:"/images/logos/logo-light.png",favicon:"/images/logos/favicon.ico",appIcon:"/images/logos/icon-192x192.png",titleText:"Watily App",footerText:"Watily Platform",themeColor:"green",customColor:"#10b981",sidebarVariant:"inset",sidebarStyle:"plain",layoutDirection:"left",themeMode:"light"},At=t=>{if(t){const e=n=>{var s;return n?n.startsWith("http")||typeof window=="undefined"?n:"".concat(((s=window.appSettings)==null?void 0:s.baseUrl)||window.location.origin).concat(n):""};return{logoDark:t.logoDark&&t.logoDark!==""?e(t.logoDark):Q.logoDark||"",logoLight:t.logoLight&&t.logoLight!==""?e(t.logoLight):Q.logoLight||"",favicon:t.favicon&&t.favicon!==""?e(t.favicon):Q.favicon||"",appIcon:t.appIcon&&t.appIcon!==""?e(t.appIcon):Q.appIcon||"",titleText:t.titleText||Q.titleText,footerText:t.footerText||Q.footerText,themeColor:t.themeColor||Q.themeColor,customColor:t.customColor||Q.customColor,sidebarVariant:t.sidebarVariant||Q.sidebarVariant,sidebarStyle:t.sidebarStyle||Q.sidebarStyle,layoutDirection:t.layoutDirection||Q.layoutDirection,themeMode:t.themeMode||Q.themeMode}}if(typeof localStorage=="undefined")return Q;try{const e=localStorage.getItem("brandSettings");return e?JSON.parse(e):Q}catch(e){return Q}},fn=u.createContext(void 0);function Mr({children:t,globalSettings:e,user:n}){const s=()=>typeof window!="undefined"&&(window.location.pathname.includes("/login")||window.location.pathname.includes("/register")||window.location.pathname.includes("/password")||window.location.pathname.includes("/auth/")||window.location.pathname==="/"||window.location.pathname.includes("/public/"))?e:(n==null?void 0:n.type)==="company"&&(n!=null&&n.globalSettings)||n!=null&&n.globalSettings?n.globalSettings:e,[r,o]=u.useState(()=>{const i=s();return At(i)});u.useEffect(()=>{const i=s();if(i!=null&&i.themeMode&&typeof window!="undefined"){const c=window.matchMedia("(prefers-color-scheme: dark)").matches;console.log("Mount - themeMode:",i.themeMode,"systemDark:",c);const l=i.themeMode==="dark"||i.themeMode==="system"&&c;document.documentElement.classList.toggle("dark",l),document.body.classList.toggle("dark",l)}},[]),u.useEffect(()=>{const i=s(),c=At(i);if(o(c),i!=null&&i.themeMode&&typeof window!="undefined"){const l=window.matchMedia("(prefers-color-scheme: dark)").matches;i.themeMode==="dark"||i.themeMode==="system"&&l?(document.documentElement.classList.add("dark"),document.body.classList.add("dark")):(document.documentElement.classList.remove("dark"),document.body.classList.remove("dark"))}},[e,n]);const a=i=>{o(c=>_(_({},c),i))};return Y.jsx(fn.Provider,{value:X(_({},r),{updateBrandSettings:a}),children:t})}function Je(){const t=u.useContext(fn);if(t===void 0)throw new Error("useBrand must be used within a BrandProvi
1der");return t}const dn=u.createContext(void 0),Dr=({children:t})=>{const[e,n]=u.useState("left");u.useEffect(()=>{const r=localStorage.getItem("layoutPosition");(r==="left"||r==="right")&&n(r)},[]);const s=r=>{n(r),localStorage.setItem("layoutPosition",r)};return Y.jsx(dn.Provider,{value:{position:e,updatePosition:s},children:t})},Jn=()=>{const t=u.useContext(dn);if(!t)throw new Error("useLayout must be used within LayoutProvider");return t},hn=u.createContext(void 0),Ze={variant:"inset",collapsible:"icon",style:"plain"},Yn=()=>{if(typeof localStorage=="undefined")return Ze;try{const t=localStorage.getItem("sidebarSettings");return t?JSON.parse(t):Ze}catch(t){return Ze}},jr=({children:t})=>{const[e,n]=u.useState(Yn()),s=a=>{n(i=>{const c=X(_({},i),{variant:a});return localStorage.setItem("sidebarSettings",JSON.stringify(c)),c})},r=a=>{n(i=>{const c=X(_({},i),{collapsible:a});return localStorage.setItem("sidebarSettings",JSON.stringify(c)),c})},o=a=>{n(i=>{const c=X(_({},i),{style:a});return localStorage.setItem("sidebarSettings",JSON.stringify(c)),c})};return u.useEffect(()=>{const a=i=>{if(i.key==="sidebarSettings")try{const c=JSON.parse(i.newValue||"");n(c)}catch(c){console.error("Failed to parse sidebar settings",c)}};return window.addEventListener("storage",a),()=>window.removeEventListener("storage",a)},[]),Y.jsx(hn.Provider,{value:{variant:e.variant,collapsible:e.collapsible,style:e.style,updateVariant:s,updateCollapsible:r,updateStyle:o},children:t})},Xn=()=>{const t=u.useContext(hn);if(!t)throw new Error("useSidebarSettings must be used within SidebarProvider");return t},de={appearance:"light",themeColor:"green",customColor:"#10b981"},Gn={blue:"#3b82f6",green:"#10b981",purple:"#8b5cf6",orange:"#f97316",red:"#ef4444"},Zn=(t,e,n=365)=>{if(typeof document=="undefined")return;const s=n*24*60*60;document.cookie="".concat(t,"=").concat(e,";path=/;max-age=").concat(s,";SameSite=Lax")},pe=t=>{if(typeof document=="undefined")return;const{appearance:e,themeColor:n,customColor:s}=t,r=e==="dark";document.documentElement.classList.toggle("dark",r),document.body.classList.toggle("dark",r);const o=n==="custom"?s:Gn[n];document.documentElement.style.setProperty("--theme-color",o),document.documentElement.style.setProperty("--primary",o),document.documentElement.style.setProperty("--chart-1",o);const a=r?Qn(o,10):es(o,10);document.documentElement.style.setProperty("--theme-color-hover",a);const i="theme-color-updating";document.documentElement.classList.add(i),setTimeout(()=>{document.documentElement.classList.remove(i)},10)},Qn=(t,e)=>{let n=parseInt(t.substring(1,3),16),s=parseInt(t.substring(3,5),16),r=parseInt(t.substring(5,7),16);return n=Math.min(255,Math.floor(n*(1+e/100))),s=Math.min(255,Math.floor(s*(1+e/100))),r=Math.min(255,Math.floor(r*(1+e/100))),"#".concat(n.toString(16).padStart(2,"0")).concat(s.toString(16).padStart(2,"0")).concat(r.toString(16).padStart(2,"0"))},es=(t,e)=>{let n=parseInt(t.substring(1,3),16),s=parseInt(t.substring(3,5),16),r=parseInt(t.substring(5,7),16);return n=Math.max(0,Math.floor(n*(1-e/100))),s=Math.max(0,Math.floor(s*(1-e/100))),r=Math.max(0,Math.floor(r*(1-e/100))),"#".concat(n.toString(16).padStart(2,"0")).concat(s.toString(16).padStart(2,"0")).concat(r.toString(16).padStart(2,"0"))},gn=()=>typeof window=="undefined"?null:window.matchMedia("(prefers-color-scheme: dark)"),pn=()=>{const t=We();pe(t)},We=t=>{if(typeof localStorage=="undefined")return t?{appearance:t.themeMode==="system"?"light":t.themeMode||"light",themeColor:t.themeColor||de.themeColor,customColor:t.customColor||de.customColor}:de;try{const e=localStorage.getItem("themeSettings");if(e){const n=JSON.parse(e);return X(_({},n),{appearance:n.appearance==="system"?"light":n.appearance||"light"})}return t?{appearance:t.themeMode==="system"?"light":t.themeMode||"light",themeColor:t.themeColor||de.themeColor,customColor:t.customColor||de.customColor}:de}catch(e){return de}};function Wr(t){var n;const e=We(t);pe(e),(n=gn())==null||n.addEventListener("change",pn)}function mn(){const[t,e]=u.useState(de),n=u.useCallback(a=>{e(i=>{const c=X(_({},i),{appearance:a});return localStorage.setItem("themeSettings",JSON.stringify(c)),Zn("appearance",a),pe(c),c})},[]),s=u.useCallback(a=>{e(i=>{const c=X(_({},i),{themeColor:a});return localStorage.setItem("themeSettings",JSON.stringify(c)),pe(c),c})},[]),r=u.useCallback((a,i=!1)=>{e(c=>{const l=_(X(_({},c),{customColor:a}),i&&{themeColor:"custom"});return localStorage.setItem("themeSettings",JSON.stringify(l)),pe(l),l})},[]);u.useEffect(()=>{const a=We();return e(a),pe(a),()=>{var i;return(i=gn())==null?void 0:i.removeEventListener("change",pn)}},[]);const o=a=>{const i=We(a);e(i),pe(i)};return{appearance:t.appearance,themeColor:t.themeColor,customColor:t.customColor,updateAppearance:n,updateThemeColor:s,updateCustomColor:r,initializeWithBrandSettings:o}}const V=t=>typeof t=="string",xe=()=>{let t,e;const n=new Promise((s,r)=>{t=s,e=r});return n.resolve=t,n.reject=e,n},Tt=t=>t==null?"":""+t,ts=(t,e,n)=>{t.forEach(s=>{e[s]&&(n[s]=e[s])})},ns=/###/g,It=t=>t&&t.indexOf("###")>-1?t.replace(ns,"."):t,Nt=t=>!t||V(t),Re=(t,e,n)=>{const s=V(e)?e.split("."):e;let r=0;for(;r<s.length-1;){if(Nt(t))return{};const o=It(s[r]);!t[o]&&n&&(t[o]=new n),Object.prototype.hasOwnProperty.call(t,o)?t=t[o]:t={},++r}return Nt(t)?{}:{obj:t,k:It(s[r])}},Ot=(t,e,n)=>{const{obj:s,k:r}=Re(t,e,Object);if(s!==void 0||e.length===1){s[r]=n;return}let o=e[e.length-1],a=e.slice(0,e.length-1),i=Re(t,a,Object);for(;i.obj===void 0&&a.length;)o="".concat(a[a.length-1],".").concat(o),a=a.slice(0,a.length-1),i=Re(t,a,Object),i!=null&&i.obj&&typeof i.obj["".concat(i.k,".").concat(o)]!="undefined"&&(i.obj=void 0);i.obj["".concat(i.k,".").concat(o)]=n},ss=(t,e,n,s)=>{const{obj:r,k:o}=Re(t,e,Object);r[o]=r[o]||[],r[o].push(n)},Ue=(t,e)=>{const{obj:n,k:s}=Re(t,e);if(n&&Object.prototype.hasOwnProperty.call(n,s))return n[s]},rs=(t,e,n)=>{const s=Ue(t,n);return s!==void 0?s:Ue(e,n)},yn=(t,e,n)=>{for(const s in e)s!=="__proto__"&&s!=="constructor"&&(s in t?V(t[s])||t[s]instanceof String||V(e[s])||e[s]instanceof String?n&&(t[s]=e[s]):yn(t[s],e[s],n):t[s]=e[s]);return t},ye=t=>t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var os={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};const is=t=>V(t)?t.replace(/[&<>
1"'\/]/g,e=>os[e]):t;class as{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){const n=this.regExpMap.get(e);if(n!==void 0)return n;const s=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,s),this.regExpQueue.push(e),s}}const cs=[" ",",","?","!",";"],ls=new as(20),us=(t,e,n)=>{e=e||"",n=n||"";const s=cs.filter(a=>e.indexOf(a)<0&&n.indexOf(a)<0);if(s.length===0)return!0;const r=ls.getRegExp("(".concat(s.map(a=>a==="?"?"\\?":a).join("|"),")"));let o=!r.test(t);if(!o){const a=t.indexOf(n);a>0&&!r.test(t.substring(0,a))&&(o=!0)}return o},ut=(t,e,n=".")=>{if(!t)return;if(t[e])return Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0;const s=e.split(n);let r=t;for(let o=0;o<s.length;){if(!r||typeof r!="object")return;let a,i="";for(let c=o;c<s.length;++c)if(c!==o&&(i+=n),i+=s[c],a=r[i],a!==void 0){if(["string","number","boolean"].indexOf(typeof a)>-1&&c<s.length-1)continue;o+=c-o+1;break}r=a}return r},Ee=t=>t==null?void 0:t.replace("_","-"),fs={type:"logger",log(t){this.output("log",t)},warn(t){this.output("warn",t)},error(t){this.output("error",t)},output(t,e){var n,s;(s=(n=console==null?void 0:console[t])==null?void 0:n.apply)==null||s.call(n,console,e)}};class Be{constructor(e,n={}){this.init(e,n)}init(e,n={}){this.prefix=n.prefix||"i18next:",this.logger=e||fs,this.options=n,this.debug=n.debug}log(...e){return this.forward(e,"log","",!0)}warn(...e){return this.forward(e,"warn","",!0)}error(...e){return this.forward(e,"error","")}deprecate(...e){return this.forward(e,"warn","WARNING DEPRECATED: ",!0)}forward(e,n,s,r){return r&&!this.debug?null:(V(e[0])&&(e[0]="".concat(s).concat(this.prefix," ").concat(e[0])),this.logger[n](e))}create(e){return new Be(this.logger,_({prefix:"".concat(this.prefix,":").concat(e,":")},this.options))}clone(e){return e=e||this.options,e.prefix=e.prefix||this.prefix,new Be(this.logger,e)}}var ne=new Be;class Ye{constructor(){this.observers={}}on(e,n){return e.split(" ").forEach(s=>{this.observers[s]||(this.observers[s]=new Map);const r=this.observers[s].get(n)||0;this.observers[s].set(n,r+1)}),this}off(e,n){if(this.observers[e]){if(!n){delete this.observers[e];return}this.observers[e].delete(n)}}emit(e,...n){this.observers[e]&&Array.from(this.observers[e].entries()).forEach(([r,o])=>{for(let a=0;a<o;a++)r(...n)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([r,o])=>{for(let a=0;a<o;a++)r.apply(r,[e,...n])})}}class Ft extends Ye{constructor(e,n={ns:["translation"],defaultNS:"translation"}){super(),this.data=e||{},this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}removeNamespaces(e){const n=this.options.ns.indexOf(e);n>-1&&this.options.ns.splice(n,1)}getResource(e,n,s,r={}){var l,d;const o=r.keySeparator!==void 0?r.keySeparator:this.options.keySeparator,a=r.ignoreJSONStructure!==void 0?r.ignoreJSONStructure:this.options.ignoreJSONStructure;let i;e.indexOf(".")>-1?i=e.split("."):(i=[e,n],s&&(Array.isArray(s)?i.push(...s):V(s)&&o?i.push(...s.split(o)):i.push(s)));const c=Ue(this.data,i);return!c&&!n&&!s&&e.indexOf(".")>-1&&(e=i[0],n=i[1],s=i.slice(2).join(".")),c||!a||!V(s)?c:ut((d=(l=this.data)==null?void 0:l[e])==null?void 0:d[n],s,o)}
1addResource(e,n,s,r,o={silent:!1}){const a=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator;let i=[e,n];s&&(i=i.concat(a?s.split(a):s)),e.indexOf(".")>-1&&(i=e.split("."),r=n,n=i[1]),this.addNamespaces(n),Ot(this.data,i,r),o.silent||this.emit("added",e,n,s,r)}addResources(e,n,s,r={silent:!1}){for(const o in s)(V(s[o])||Array.isArray(s[o]))&&this.addResource(e,n,o,s[o],{silent:!0});r.silent||this.emit("added",e,n,s)}addResourceBundle(e,n,s,r,o,a={silent:!1,skipCopy:!1}){let i=[e,n];e.indexOf(".")>-1&&(i=e.split("."),r=s,s=n,n=i[1]),this.addNamespaces(n);let c=Ue(this.data,i)||{};a.skipCopy||(s=JSON.parse(JSON.stringify(s))),r?yn(c,s,o):c=_(_({},c),s),Ot(this.data,i,c),a.silent||this.emit("added",e,n,s)}removeResourceBundle(e,n){this.hasResourceBundle(e,n)&&delete this.data[e][n],this.removeNamespaces(n),this.emit("removed",e,n)}hasResourceBundle(e,n){return this.getResource(e,n)!==void 0}getResourceBundle(e,n){return n||(n=this.options.defaultNS),this.getResource(e,n)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const n=this.getDataByLanguage(e);return!!(n&&Object.keys(n)||[]).find(r=>n[r]&&Object.keys(n[r]).length>0)}toJSON(){return this.data}}var wn={processors:{},addPostProcessor(t){this.processors[t.name]=t},handle(t,e,n,s,r){return t.forEach(o=>{var a,i;e=(i=(a=this.processors[o])==null?void 0:a.process(e,n,s,r))!=null?i:e}),e}};const bn=Symbol("i18next/PATH_KEY");function ds(){const t=[],e=Object.create(null);let n;return e.get=(s,r)=>{var o;return(o=n==null?void 0:n.revoke)==null||o.call(n),r===bn?t:(t.push(r),n=Proxy.revocable(s,e),n.proxy)},Proxy.revocable(Object.create(null),e).proxy}function ft(t,e){var s;const{[bn]:n}=t(ds());return n.join((s=e==null?void 0:e.keySeparator)!=null?s:".")}const Pt={},Qe=t=>!V(t)&&typeof t!="boolean"&&typeof t!="number";class Ve extends Ye{constructor(e,n={}){super(),ts(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","
1i18nFormat","utils"],e,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=ne.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e,n={interpolation:{}}){const s=_({},n);if(e==null)return!1;const r=this.resolve(e,s);if((r==null?void 0:r.res)===void 0)return!1;const o=Qe(r.res);return!(s.returnObjects===!1&&o)}extractFromKey(e,n){let s=n.nsSeparator!==void 0?n.nsSeparator:this.options.nsSeparator;s===void 0&&(s=":");const r=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let o=n.ns||this.options.defaultNS||[];const a=s&&e.indexOf(s)>-1,i=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!us(e,s,r);if(a&&!i){const c=e.match(this.interpolator.nestingRegexp);if(c&&c.length>0)return{key:e,namespaces:V(o)?[o]:o};const l=e.split(s);(s!==r||s===r&&this.options.ns.indexOf(l[0])>-1)&&(o=l.shift()),e=l.join(r)}return{key:e,namespaces:V(o)?[o]:o}}translate(e,n,s){let r=typeof n=="object"?_({},n):n;if(typeof r!="object"&&this.options.overloadTranslationOptionHandler&&(r=this.options.overloadTranslationOptionHandler(arguments)),typeof r=="object"&&(r=_({},r)),r||(r={}),e==null)return"";typeof e=="function"&&(e=ft(e,_(_({},this.options),r))),Array.isArray(e)||(e=[String(e)]);const o=r.returnDetails!==void 0?r.returnDetails:this.options.returnDetails,a=r.keySeparator!==void 0?r.keySeparator:this.options.keySeparator,{key:i,namespaces:c}=this.extractFromKey(e[e.length-1],r),l=c[c.length-1];let d=r.nsSeparator!==void 0?r.nsSeparator:this.options.nsSeparator;d===void 0&&(d=":");const f=r.lng||this.language,v=r.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if((f==null?void 0:f.toLowerCase())==="cimode")return v?o?{res:"".concat(l).concat(d).concat(i),usedKey:i,exactUsedKey:i,usedLng:f,usedNS:l,usedParams:this.getUsedParamsDetails(r)}:"".concat(l).concat(d).concat(i):o?{res:i,usedKey:i,exactUsedKey:i,usedLng:f,usedNS:l,usedParams:this.getUsedParamsDetails(r)}:i;const m=this.resolve(e,r);let p=m==null?void 0:m.res;const L=(m==null?void 0:m.usedKey)||i,k=(m==null?void 0:m.exactUsedKey)||i,P=["[object Number]","[object Function]","[object RegExp]"],D=r.joinArrays!==void 0?r.joinArrays:this.options.joinArrays,S=!this.i18nFormat||this.i18nFormat.handleAsObject,x=r.count!==void 0&&!V(r.count),A=Ve.hasDefaultValue(r),O=x?this.pluralResolver.getSuffix(f,r.count,r):"",j=r.ordinal&&x?this.pluralResolver.getSuffix(f,r.count,{ordinal:!1}):"",B=x&&!r.ordinal&&r.count===0,h=B&&r["defaultValue".concat(this.options.pluralSeparator,"zero")]||r["defaultValue".concat(O)]||r["defaultValue".concat(j)]||r.defaultValue;let g=p;S&&!p&&A&&(g=h);const T=Qe(g),y=Object.prototype.toString.apply(g);if(S&&g&&T&&P.indexOf(y)<0&&!(V(D)&&Array.isArray(g))){if(!r.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const b=this.options.returnedObjectHandler?this.options.returnedObjectHandler(L,g,X(_({},r),{ns:c})):"key '".concat(i," (").concat(this.language,")' returned an object instead of string.");return o?(m.res=b,m.usedParams=this.getUsedParamsDetails(r),m):b}if(a){const b=Array.isArray(g),w=b?[]:{},E=b?k:L;for(const I in g)if(Object.prototype.hasOwnProperty.call(g,I)){const C="".concat(E).concat(a).concat(I
1);A&&!p?w[I]=this.translate(C,X(_({},r),{defaultValue:Qe(h)?h[I]:void 0,joinArrays:!1,ns:c})):w[I]=this.translate(C,X(_({},r),{joinArrays:!1,ns:c})),w[I]===C&&(w[I]=g[I])}p=w}}else if(S&&V(D)&&Array.isArray(p))p=p.join(D),p&&(p=this.extendTranslation(p,e,r,s));else{let b=!1,w=!1;!this.isValidLookup(p)&&A&&(b=!0,p=h),this.isValidLookup(p)||(w=!0,p=i);const I=(r.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&w?void 0:p,C=A&&h!==p&&this.options.updateMissing;if(w||b||C){if(this.logger.log(C?"updateKey":"missingKey",f,l,i,C?h:p),a){const F=this.resolve(i,X(_({},r),{keySeparator:!1}));F&&F.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let W=[];const R=this.languageUtils.getFallbackCodes(this.options.fallbackLng,r.lng||this.language);if(this.options.saveMissingTo==="fallback"&&R&&R[0])for(let F=0;F<R.length;F++)W.push(R[F]);else this.options.saveMissingTo==="all"?W=this.languageUtils.toResolveHierarchy(r.lng||this.language):W.push(r.lng||this.language);const U=(F,M,N)=>{var K;const H=A&&N!==p?N:I;this.options.missingKeyHandler?this.options.missingKeyHandler(F,l,M,H,C,r):(K=this.backendConnector)!=null&&K.saveMissing&&this.backendConnector.saveMissing(F,l,M,H,C,r),this.emit("missingKey",F,l,M,p)};this.options.saveMissing&&(this.options.saveMissingPlurals&&x?W.forEach(F=>{const M=this.pluralResolver.getSuffixes(F,r);B&&r["defaultValue".concat(this.options.pluralSeparator,"zero")]&&M.indexOf("".concat(this.options.pluralSeparator,"zero"))<0&&M.push("".concat(this.options.pluralSeparator,"zero")),M.forEach(N=>{U([F],i+N,r["defaultValue".concat(N)]||h)})}):U(W,i,h))}p=this.extendTranslation(p,e,r,m,s),w&&p===i&&this.options.appendNamespaceToMissingKey&&(p="".concat(l).concat(d).concat(i)),(w||b)&&this.options.parseMissingKeyHandler&&(p=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?"".concat(l).concat(d).concat(i):i,b?p:void 0,r))}return o?(m.res=p,m.usedParams=this.getUsedParamsDetails(r),m):p}extendTranslation(e,n,s,r,o){var c,l;if((c=this.i18nFormat)!=null&&c.parse)e=this.i18nFormat.parse(e,_(_({},this.options.interpolation.defaultVariables),s),s.lng||this.language||r.usedLng,r.usedNS,r.usedKey,{resolved:r});else if(!s.skipInterpolation){s.interpolation&&this.interpolator.init(X(_({},s),{interpolation:_(_({},this.options.interpolation),s.interpolation)}));const d=V(e)&&(((l=s==null?void 0:s.interpolation)==null?void 0:l.skipOnVariables)!==void 0?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let f;if(d){const m=e.match(this.interpolator.nestingRegexp);f=m&&m.length}let v=s.replace&&!V(s.replace)?s.replace:s;if(this.options.interpolation.defaultVariables&&(v=_(_({},this.options.interpolation.defaultVariables),v)),e=this.interpolator.interpolate(e,v,s.lng||this.language||r.usedLng,s),d){const m=e.match(this.interpolator.nestingRegexp),p=m&&m.length;f<p&&(s.nest=!1)}!s.lng&&r&&r.res&&(s.lng=this.language||r.usedLng),s.nest!==!1&&(e=this.interpolator.nest(e,(...m)=>(o==null?void 0:o[0])===m[0]&&!s.context?(this.logger.warn("It seems you are nesting recursively key: ".concat(m[0]," in key: ").concat(n[0])),null):this.translate(...m,n),s)),s.interpolation&&this.interpolator.reset()}const a=s.postProcess||this.options.postProcess,i=V(a)?[a]:a;return e!=null&&(i!=null&&i.length)&&s.applyPostProcessor!==!1&&(e=wn.handle(i,e,n,this.options&&this.options.postProcessPassResolved?_({i18nResolved:X(_({},r),{usedParams:this.getUsedParamsDetails(s)})},s):s,this)),e}resolve(e,n={}){let s,r,o,a,i;return V(e)&&(e=[e]),e.forEach(c=>{if(this.isValidLookup(s))return;const l=this.extractFromKey(c,n),d=l.key;r=d;let f=l.namespaces;this.options.fallbackNS&&(f=f.concat(this.options.fallbackNS));const v=n.count!==void 0&&!V(n.count),m=v&&!n.ordinal&&n.count===0,p=n.context!==void 0&&(V(n.context)||typeof n.context=="number")&&n.context!=="",L=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);f.forEach(k=>{var P,D;this.isValidLookup(s)||(i=k,!Pt["".concat(L[0],"-").concat(k)]&&((P=this.utils)!=null&&P.hasLoadedNamespace)&&!((D=this.utils)!=null&&D.hasLoadedNamespace(i))&&(Pt["".concat(L[0],"-").concat(k)]=!0,this.logger.warn('key "'.concat(r,'" for languages "').concat(L.join(", "),'" won\'t get resolved as namespace "').concat(i,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),L.forEac
1h(S=>{var O;if(this.isValidLookup(s))return;a=S;const x=[d];if((O=this.i18nFormat)!=null&&O.addLookupKeys)this.i18nFormat.addLookupKeys(x,d,S,k,n);else{let j;v&&(j=this.pluralResolver.getSuffix(S,n.count,n));const B="".concat(this.options.pluralSeparator,"zero"),h="".concat(this.options.pluralSeparator,"ordinal").concat(this.options.pluralSeparator);if(v&&(n.ordinal&&j.indexOf(h)===0&&x.push(d+j.replace(h,this.options.pluralSeparator)),x.push(d+j),m&&x.push(d+B)),p){const g="".concat(d).concat(this.options.contextSeparator||"_").concat(n.context);x.push(g),v&&(n.ordinal&&j.indexOf(h)===0&&x.push(g+j.replace(h,this.options.pluralSeparator)),x.push(g+j),m&&x.push(g+B))}}let A;for(;A=x.pop();)this.isValidLookup(s)||(o=A,s=this.getResource(S,k,A,n))}))})}),{res:s,usedKey:r,exactUsedKey:o,usedLng:a,usedNS:i}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e==="")}getResource(e,n,s,r={}){var o;return(o=this.i18nFormat)!=null&&o.getResource?this.i18nFormat.getResource(e,n,s,r):this.resourceStore.getResource(e,n,s,r)}getUsedParamsDetails(e={}){const n=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],s=e.replace&&!V(e.replace);let r=s?e.replace:e;if(s&&typeof e.count!="undefined"&&(r.count=e.count),this.options.interpolation.defaultVariables&&(r=_(_({},this.options.interpolation.defaultVariables),r)),!s){r=_({},r);for(const o of n)delete r[o]}return r}static hasDefaultValue(e){const n="defaultValue";for(const s in e)if(Object.prototype.hasOwnProperty.call(e,s)&&n===s.substring(0,n.length)&&e[s]!==void 0)return!0;return!1}}class Mt{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=ne.create("languageUtils")}getScriptPartFromCode(e){if(e=Ee(e),!e||e.indexOf("-")<0)return null;const n=e.split("-");return n.length===2||(n.pop(),n[n.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(n.join("-"))}getLanguagePartFromCode(e){if(e=Ee(e),!e||e.indexOf("-")<0)return e;const n=e.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(e){if(V(e)&&e.indexOf("-")>-1){let n;try{n=Intl.getCanonicalLocales(e)[0]}catch(s){}return n&&this.options.lowerCaseLng&&(n=n.toLowerCase()),n||(this.options.lowerCaseLng?e.toLowerCase():e)}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let n;return e.forEach(s=>{if(n)return;const r=this.formatLanguageCode(s);(!this.options.supportedLngs||this.isSupportedCode(r))&&(n=r)}),!n&&this.options.supportedLngs&&e.forEach(s=>{if(n)return;const r=this.getScriptPartFromCode(s);if(this.isSupportedCode(r))return n=r;const o=this.getLanguagePartFromCode(s);if(this.isSupportedCode(o))return n=o;n=this.options.supportedLngs.find(a=>{if(a===o)return a;if(!(a.indexOf("-")<0&&o.indexOf("-")<0)&&(a.indexOf("-")>0&&o.indexOf("-")<0&&a.substring(0,a.indexOf("-"))===o||a.indexOf(o)===0&&o.length>1))return a})}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(e,n){if(!e)return[];if(typeof e=="function"&&(e=e(n)),V(e)&&(e=[e]),Array.isArray(e))return e;if(!n)return e.default||[];let s=e[n];return s||(s=e[this.getScriptPartFromCode(n)]),s||(s=e[this.formatLanguageCode(n)]),s||(s=e[this.getLanguagePartFromCode(n)]),s||(s=e.default),s||[]}toResolveHierarchy(e,n){const s=this.getFallbackCodes((n===!1?[]:n)||this.options.fallbackLng||[],e),r=[],o=a=>{a&&(this.isSupportedCode(a)?r.push(a):this.logger.warn("rejecting language code not found in supportedLngs: ".concat(a)))};return V(e)&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&o(this.formatLanguageCode(e)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&o(this.getScriptPartFromCode(e)),this.options.load!=="currentOnly"&&o(this.getLanguagePartFromCode(e))):V(e)&&o(this.formatLanguageCode(e)),s.forEac
1h(a=>{r.indexOf(a)<0&&o(this.formatLanguageCode(a))}),r}}const Dt={zero:0,one:1,two:2,few:3,many:4,other:5},jt={select:t=>t===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class hs{constructor(e,n={}){this.languageUtils=e,this.options=n,this.logger=ne.create("pluralResolver"),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(e,n={}){const s=Ee(e==="dev"?"en":e),r=n.ordinal?"ordinal":"cardinal",o=JSON.stringify({cleanedCode:s,type:r});if(o in this.pluralRulesCache)return this.pluralRulesCache[o];let a;try{a=new Intl.PluralRules(s,{type:r})}catch(i){if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),jt;if(!e.match(/-|_/))return jt;const c=this.languageUtils.getLanguagePartFromCode(e);a=this.getRule(c,n)}return this.pluralRulesCache[o]=a,a}needsPlural(e,n={}){let s=this.getRule(e,n);return s||(s=this.getRule("dev",n)),(s==null?void 0:s.resolvedOptions().pluralCategories.length)>1}getPluralFormsOfKey(e,n,s={}){return this.getSuffixes(e,s).map(r=>"".concat(n).concat(r))}getSuffixes(e,n={}){let s=this.getRule(e,n);return s||(s=this.getRule("dev",n)),s?s.resolvedOptions().pluralCategories.sort((r,o)=>Dt[r]-Dt[o]).map(r=>"".concat(this.options.prepend).concat(n.ordinal?"ordinal".concat(this.options.prepend):"").concat(r)):[]}getSuffix(e,n,s={}){const r=this.getRule(e,s);return r?"".concat(this.options.prepend).concat(s.ordinal?"ordinal".concat(this.options.prepend):"").concat(r.select(n)):(this.logger.warn("no plural rule found for: ".concat(e)),this.getSuffix("dev",n,s))}}const Wt=(t,e,n,s=".",r=!0)=>{let o=rs(t,e,n);return!o&&r&&V(n)&&(o=ut(t,n,s),o===void 0&&(o=ut(e,n,s))),o},et=t=>t.replace(/\$/g,"$$$$");class Ut{constructor(e={}){var n;this.logger=ne.create("interpolator"),this.options=e,this.format=((n=e==null?void 0:e.interpolation)==null?void 0:n.format)||(s=>s),this.init(e)}init(e={}){e.interpolation||(e.interpolation={escapeValue:!0});const{escape:n,escapeValue:s,useRawValueToEscape:r,prefix:o,prefixEscaped:a,suffix:i,suffixEscaped:c,formatSeparator:l,unescapeSuffix:d,unescapePrefix:f,nestingPrefix:v,nestingPrefixEscaped:m,nestingSuffix:p,nestingSuffixEscaped:L,nestingOptionsSeparator:k,maxReplaces:P,alwaysFormat:D}=e.interpolation;this.escape=n!==void 0?n:is,this.escapeValue=s!==void 0?s:!0,this.useRawValueToEscape=r!==void 0?r:!1,this.prefix=o?ye(o):a||"{{",this.suffix=i?ye(i):c||"}}",this.formatSeparator=l||",",this.unescapePrefix=d?"":f||"-",this.unescapeSuffix=this.unescapePrefix?"":d||"",this.nestingPrefix=v?ye(v):m||ye("$t("),this.nestingSuffix=p?ye(p):L||ye(")"),this.nestingOptionsSeparator=k||",",this.maxReplaces=P||1e3,this.alwaysFormat=D!==void 0?D:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=(n,s)=>(n==null?void 0:n.source)===s?(n.lastIndex=0,n):new RegExp(s,"g");this.regexp=e(this.regexp,"".concat(this.prefix,"(.+?)").concat(this.suffix)),this.regexpUnescape=e(this.regexpUnescape,"".concat(this.prefix).concat(this.unescapePrefix,"(.+?)").concat(this.unescapeSuffix).concat(this.suffix)),this.nestingRegexp=e(this.nestingRegexp,"".concat(this.nestingPrefix,"((?:[^()\"']+|\"[^\"]*\"|'[^']*'|\\((?:[^()]|\"[^\"]*\"|'[^']*')*\\))*?)").concat(this.nestingSuffix))}interpolate(e,n,s,r){var m;let o,a,i;const c=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},l=p=>{if(p.indexOf(this.formatSeparator)<0){const D=Wt(n,c,p,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(D,void 0,s,X(_(_({},r),n),{interpolationkey:p})):D}const L=p.split(this.formatSeparator),k=L.shift().trim(),P=L.join(this.formatSeparator).trim();return this.format(Wt(n,c,k,this.options.keySeparator,this.options.ignoreJSONStructure),P,s,X(_(_({},r),n),{interpolationkey:k}))};this.resetRegExp();const d=(r==null?void 0:r.missingInterpolationHandler)||this.options.missingInterpolationHandler,f=((m=r==null?void 0:r.interpolation)==null?void 0:m.skipOnVariables)!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:p=>et(p)},{regex:this.regexp,safeValue:p=>this.escapeValue?et(this.escape(p)):et(p)}
1].forEach(p=>{for(i=0;o=p.regex.exec(e);){const L=o[1].trim();if(a=l(L),a===void 0)if(typeof d=="function"){const P=d(e,o,r);a=V(P)?P:""}else if(r&&Object.prototype.hasOwnProperty.call(r,L))a="";else if(f){a=o[0];continue}else this.logger.warn("missed to pass in variable ".concat(L," for interpolating ").concat(e)),a="";else!V(a)&&!this.useRawValueToEscape&&(a=Tt(a));const k=p.safeValue(a);if(e=e.replace(o[0],k),f?(p.regex.lastIndex+=a.length,p.regex.lastIndex-=o[0].length):p.regex.lastIndex=0,i++,i>=this.maxReplaces)break}}),e}nest(e,n,s={}){let r,o,a;const i=(c,l)=>{var L;const d=this.nestingOptionsSeparator;if(c.indexOf(d)<0)return c;const f=c.split(new RegExp("".concat(d,"[ ]*{")));let v="{".concat(f[1]);c=f[0],v=this.interpolate(v,a);const m=v.match(/'/g),p=v.match(/"/g);(((L=m==null?void 0:m.length)!=null?L:0)%2===0&&!p||p.length%2!==0)&&(v=v.replace(/'/g,'"'));try{a=JSON.parse(v),l&&(a=_(_({},l),a))}catch(k){return this.logger.warn("failed parsing options string in nesting for key ".concat(c),k),"".concat(c).concat(d).concat(v)}return a.defaultValue&&a.defaultValue.indexOf(this.prefix)>-1&&delete a.defaultValue,c};for(;r=this.nestingRegexp.exec(e);){let c=[];a=_({},s),a=a.replace&&!V(a.replace)?a.replace:a,a.applyPostProcessor=!1,delete a.defaultValue;const l=/{.*}/.test(r[1])?r[1].lastIndexOf("}")+1:r[1].indexOf(this.formatSeparator);if(l!==-1&&(c=r[1].slice(l).split(this.formatSeparator).map(d=>d.trim()).filter(Boolean),r[1]=r[1].slice(0,l)),o=n(i.call(this,r[1].trim(),a),a),o&&r[0]===e&&!V(o))return o;V(o)||(o=Tt(o)),o||(this.logger.warn("missed to resolve ".concat(r[1]," for nesting ").concat(e)),o=""),c.length&&(o=c.reduce((d,f)=>this.format(d,f,s.lng,X(_({},s),{interpolationkey:r[1].trim()})),o.trim())),e=e.replace(r[0],o),this.regexp.lastIndex=0}return e}}const gs=t=>{let e=t.toLowerCase().trim();const n={};if(t.indexOf("(")>-1){const s=t.split("(");e=s[0].toLowerCase().trim();const r=s[1].substring(0,s[1].length-1);e==="currency"&&r.indexOf(":")<0?n.currency||(n.currency=r.trim()):e==="relativetime"&&r.indexOf(":")<0?n.range||(n.range=r.trim()):r.split(";").forEach(a=>{if(a){const[i,...c]=a.split(":"),l=c.join(":").trim().replace(/^'+|'+$/g,""),d=i.trim();n[d]||(n[d]=l),l==="false"&&(n[d]=!1),l==="true"&&(n[d]=!0),isNaN(l)||(n[d]=parseInt(l,10))}})}return{formatName:e,formatOptions:n}},Bt=t=>{const e={};return(n,s,r)=>{let o=r;r&&r.interpolationkey&&r.formatParams&&r.formatParams[r.interpolationkey]&&r[r.interpolationkey]&&(o=X(_({},o),{[r.interpolationkey]:void 0}));const a=s+JSON.stringify(o);let i=e[a];return i||(i=t(Ee(s),r),e[a]=i),i(n)}},ps=t=>(e,n,s)=>t(Ee(n),s)(e);class ms{constructor(e={}){this.logger=ne.create("formatter"),this.options=e,this.init(e)}init(e,n={interpolation:{}}){this.formatSeparator=n.interpolation.formatSeparator||",";const s=n.cacheInBuiltFormats?Bt:ps;this.formats={number:s((r,o)=>{const a=new Intl.NumberFormat(r,_({},o));return i=>a.format(i)}),currency:s((r,o)=>{const a=new Intl.NumberFormat(r,X(_({},o),{style:"currency"}));return i=>a.format(i)}),datetime:s((r,o)=>{const a=new Intl.DateTimeFormat(r,_({},o));return i=>a.format(i)}),relativetime:s((r,o)=>{const a=new Intl.RelativeTimeFormat(r,_({},o));return i=>a.format(i,o.range||"day")}),list:s((r,o)=>{const a=new Intl.ListFormat(r,_({},o));return i=>a.format(i)})}}add(e,n){this.formats[e.toLowerCase().trim()]=n}addCached(e,n){this.formats[e.toLowerCase().trim()]=Bt(n)}format(e,n,s,r={}){const o=n.split(this.formatSeparator);if(o.length>1&&o[0].indexOf("(")>1&&o[0].indexOf(")")<0&&o.find(i=>i.indexOf(")")>-1)){const i=o.findIndex(c=>c.indexOf(")")>-1);o[0]=[o[0],...o.splice(1,i)].join(this.formatSeparator)}return o.reduce((i,c)=>{var f;const{formatName:l,formatOptions:d}=gs(c);if(this.formats[l]){let v=i;try{const m=((f=r==null?void 0:r.formatParams)==null?void 0:f[r.interpolationkey])||{},p=m.locale||m.lng||r.locale||r.lng||s;v=this.formats[l](i,p,_(_(_({},d),r),m))}catch(m){this.logger.warn(m)}return v}else this.logger.warn("there was no format function for ".concat(l));return i},e)}}const ys=(t,e)=>{t.pending[e]!==void 0&&(delete t.pending[e],t.pendingCount--)};class ws extends Ye{constructor(e,n,s,r={}){var o,a;super(),this.backend=e,this.store=n,this.services=s,this.languageUtils=s.languageUtils,this.options=r,this.logger=ne.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=r.maxParallelReads||10,this.readingCalls=0,this.maxRetries=r.maxRetries>=0?r.maxRetries:5,this.retryTimeout=r.retryTimeout>=1?r.retryTimeout:350,this.state={},this.queue=[],(a=(o=this.backend)==null?void 0:o.init)==null||a.call(o,s,r.backend,r)}queueLoad(e,n,s,r){const o={},a={},i={},c={};return e.forEach(l=>{let d=!0;
1n.forEach(f=>{const v="".concat(l,"|").concat(f);!s.reload&&this.store.hasResourceBundle(l,f)?this.state[v]=2:this.state[v]<0||(this.state[v]===1?a[v]===void 0&&(a[v]=!0):(this.state[v]=1,d=!1,a[v]===void 0&&(a[v]=!0),o[v]===void 0&&(o[v]=!0),c[f]===void 0&&(c[f]=!0)))}),d||(i[l]=!0)}),(Object.keys(o).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:r}),{toLoad:Object.keys(o),pending:Object.keys(a),toLoadLanguages:Object.keys(i),toLoadNamespaces:Object.keys(c)}}loaded(e,n,s){const r=e.split("|"),o=r[0],a=r[1];n&&this.emit("failedLoading",o,a,n),!n&&s&&this.store.addResourceBundle(o,a,s,void 0,void 0,{skipCopy:!0}),this.state[e]=n?-1:2,n&&s&&(this.state[e]=0);const i={};this.queue.forEach(c=>{ss(c.loaded,[o],a),ys(c,e),n&&c.errors.push(n),c.pendingCount===0&&!c.done&&(Object.keys(c.loaded).forEach(l=>{i[l]||(i[l]={});const d=c.loaded[l];d.length&&d.forEach(f=>{i[l][f]===void 0&&(i[l][f]=!0)})}),c.done=!0,c.errors.length?c.callback(c.errors):c.callback())}),this.emit("loaded",i),this.queue=this.queue.filter(c=>!c.done)}read(e,n,s,r=0,o=this.retryTimeout,a){if(!e.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:n,fcName:s,tried:r,wait:o,callback:a});return}this.readingCalls++;const i=(l,d)=>{if(this.readingCalls--,this.waitingReads.length>0){const f=this.waitingReads.shift();this.read(f.lng,f.ns,f.fcName,f.tried,f.wait,f.callback)}if(l&&d&&r<this.maxRetries){setTimeout(()=>{this.read.call(this,e,n,s,r+1,o*2,a)},o);return}a(l,d)},c=this.backend[s].bind(this.backend);if(c.length===2){try{const l=c(e,n);l&&typeof l.then=="function"?l.then(d=>i(null,d)).catch(i):i(null,l)}catch(l){i(l)}return}return c(e,n,i)}prepareLoading(e,n,s={},r){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),r&&r();V(e)&&(e=this.languageUtils.toResolveHierarchy(e)),V(n)&&(n=[n]);const o=this.queueLoad(e,n,s,r);if(!o.toLoad.length)return o.pending.length||r(),null;o.toLoad.forEach(a=>{this.loadOne(a)})}load(e,n,s){this.prepareLoading(e,n,{},s)}reload(e,n,s){this.prepareLoading(e,n,{reload:!0},s)}loadOne(e,n=""){const s=e.split("|"),r=s[0],o=s[1];this.read(r,o,"read",void 0,void 0,(a,i)=>{a&&this.logger.warn("".concat(n,"loading namespace ").concat(o," for language ").concat(r," failed"),a),!a&&i&&this.logger.log("".concat(n,"loaded namespace ").concat(o," for language ").concat(r),i),this.loaded(e,a,i)})}saveMissing(e,n,s,r,o,a={},i=()=>{}){var c,l,d,f,v;if((l=(c=this.services)==null?void 0:c.utils)!=null&&l.hasLoadedNamespace&&!((f=(d=this.services)==null?void 0:d.utils)!=null&&f.hasLoadedNamespace(n))){this.logger.warn('did not save key "'.concat(s,'" as the namespace "').concat(n,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(s==null||s==="")){if((v=this.backend)!=null&&v.create){const m=X(_({},a),{isUpdate:o}),p=this.backend.create.bind(this.backend);if(p.length<6)try{let L;p.length===5?L=p(e,n,s,r,m):L=p(e,n,s,r),L&&typeof L.then=="function"?L.then(k=>i(null,k)).catch(i):i(null,L)}catch(L){i(L)}else p(e,n,s,r,i,m)}!e||!e[0]||this.store.addResource(e[0],n,s,r)}}}const tt=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:t=>{let e={};if(typeof t[1]=="object"&&(e=t[1]),V(t[1])&&(e.defaultValue=t[1]),V(t[2])&&(e.tDescription=t[2]),typeof t[2]=="object"||typeof t[3]=="object"){const n=t[3]||t[2];
1Object.keys(n).forEach(s=>{e[s]=n[s]})}return e},interpolation:{escapeValue:!0,format:t=>t,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),Vt=t=>{var e,n;return V(t.ns)&&(t.ns=[t.ns]),V(t.fallbackLng)&&(t.fallbackLng=[t.fallbackLng]),V(t.fallbackNS)&&(t.fallbackNS=[t.fallbackNS]),((n=(e=t.supportedLngs)==null?void 0:e.indexOf)==null?void 0:n.call(e,"cimode"))<0&&(t.supportedLngs=t.supportedLngs.concat(["cimode"])),typeof t.initImmediate=="boolean"&&(t.initAsync=t.initImmediate),t},Oe=()=>{},bs=t=>{Object.getOwnPropertyNames(Object.getPrototypeOf(t)).forEach(n=>{typeof t[n]=="function"&&(t[n]=t[n].bind(t))})};class $e extends Ye{constructor(e={},n){if(super(),this.options=Vt(e),this.services={},this.logger=ne,this.modules={external:[]},bs(this),n&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,n),this;setTimeout(()=>{this.init(e,n)},0)}}init(e={},n){this.isInitializing=!0,typeof e=="function"&&(n=e,e={}),e.defaultNS==null&&e.ns&&(V(e.ns)?e.defaultNS=e.ns:e.ns.indexOf("translation")<0&&(e.defaultNS=e.ns[0]));const s=tt();this.options=_(_(_({},s),this.options),Vt(e)),this.options.interpolation=_(_({},s.interpolation),this.options.interpolation),e.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=e.keySeparator),e.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=e.nsSeparator),typeof this.options.overloadTranslationOptionHandler!="function"&&(this.options.overloadTranslationOptionHandler=s.overloadTranslationOptionHandler),this.options.debug===!0&&typeof console!="undefined"&&console.warn("i18next is maintained with support from locize.com — consider powering your project with managed localization (AI, CDN, integrations): https://locize.com");const r=l=>l?typeof l=="function"?new l:l:null;if(!this.options.isClone){this.modules.logger?ne.init(r(this.modules.logger),this.options):ne.init(null,this.options);let l;this.modules.formatter?l=this.modules.formatter:l=ms;const d=new Mt(this.options);this.store=new Ft(this.options.resources,this.options);const f=this.services;f.logger=ne,f.resourceStore=this.store,f.languageUtils=d,f.pluralResolver=new hs(d,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),this.options.interpolation.format&&this.options.interpolation.format!==s.interpolation.format&&this.logger.deprecate("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"),l&&(!this.options.interpolation.format||this.options.interpolation.format===s.interpolation.format)&&(f.formatter=r(l),f.formatter.init&&f.formatter.init(f,this.options),this.options.interpolation.format=f.formatter.format.bind(f.formatter)),f.interpolator=new Ut(this.options),f.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},f.backendConnector=new ws(r(this.modules.backend),f.resourceStore,f,this.options),f.backendConnector.on("*",(m,...p)=>{this.emit(m,...p)}),this.modules.languageDetector&&(f.languageDetector=r(this.modules.languageDetector),f.languageDetector.init&&f.languageDetector.init(f,this.options.detection,this.options)),this.modules.i18nFormat&&(f.i18nFormat=r(this.modules.i18nFormat),f.i18nFormat.init&&f.i18nFormat.init(this)),this.translator=new Ve(this.services,this.options),this.translator.on("*",(m,...p)=>{this.emit(m,...p)}),this.modules.external.forEach(m=>{m.init&&m.init(this)})}if(this.format=this.options.interpolation.format,n||(n=Oe),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const l=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);l.length>0&&l[0]!=="dev"&&(this.options.lng=l[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(l=>{this[l]=(...d)=>this.store[l](...d)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(l=>{this[l]=(...d)=>(this.store[l](...d),this)});const i=xe(),c=()=>{const l=(d,f)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit
1("initialized",this.options),i.resolve(f),n(d,f)};if(this.languages&&!this.isInitialized)return l(null,this.t.bind(this));this.changeLanguage(this.options.lng,l)};return this.options.resources||!this.options.initAsync?c():setTimeout(c,0),i}loadResources(e,n=Oe){var o,a;let s=n;const r=V(e)?e:this.language;if(typeof e=="function"&&(s=e),!this.options.resources||this.options.partialBundledLanguages){if((r==null?void 0:r.toLowerCase())==="cimode"&&(!this.options.preload||this.options.preload.length===0))return s();const i=[],c=l=>{if(!l||l==="cimode")return;this.services.languageUtils.toResolveHierarchy(l).forEach(f=>{f!=="cimode"&&i.indexOf(f)<0&&i.push(f)})};r?c(r):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(d=>c(d)),(a=(o=this.options.preload)==null?void 0:o.forEach)==null||a.call(o,l=>c(l)),this.services.backendConnector.load(i,this.options.ns,l=>{!l&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),s(l)})}else s(null)}reloadResources(e,n,s){const r=xe();return typeof e=="function"&&(s=e,e=void 0),typeof n=="function"&&(s=n,n=void 0),e||(e=this.languages),n||(n=this.options.ns),s||(s=Oe),this.services.backendConnector.reload(e,n,o=>{r.resolve(),s(o)}),r}use(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return e.type==="backend"&&(this.modules.backend=e),(e.type==="logger"||e.log&&e.warn&&e.error)&&(this.modules.logger=e),e.type==="languageDetector"&&(this.modules.languageDetector=e),e.type==="i18nFormat"&&(this.modules.i18nFormat=e),e.type==="postProcessor"&&wn.addPostProcessor(e),e.type==="formatter"&&(this.modules.formatter=e),e.type==="3rdParty"&&this.modules.external.push(e),this}setResolvedLanguage(e){if(!(!e||!this.languages)&&!(["cimode","dev"].indexOf(e)>-1)){for(let n=0;n<this.languages.length;n++){const s=this.languages[n];if(!(["cimode","dev"].indexOf(s)>-1)&&this.store.hasLanguageSomeTranslations(s)){this.resolvedLanguage=s;break}}!this.resolvedLanguage&&this.languages.indexOf(e)<0&&this.store.hasLanguageSomeTranslations(e)&&(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,n){this.isLanguageChangingTo=e;const s=xe();this.emit("languageChanging",e);const r=i=>{this.language=i,this.languages=this.services.languageUtils.toResolveHierarchy(i),this.resolvedLanguage=void 0,this.setResolvedLanguage(i)},o=(i,c)=>{c?this.isLanguageChangingTo===e&&(r(c),this.translator.changeLanguage(c),this.isLanguageChangingTo=void 0,this.emit("languageChanged",c),this.logger.log("languageChanged",c)):this.isLanguageChangingTo=void 0,s.resolve((...l)=>this.t(...l)),n&&n(i,(...l)=>this.t(...l))},a=i=>{var d,f;!e&&!i&&this.services.languageDetector&&(i=[]);const c=V(i)?i:i&&i[0],l=this.store.hasLanguageSomeTranslations(c)?c:this.services.languageUtils.getBestMatchFromCodes(V(i)?[i]:i);l&&(this.language||r(l),this.translator.language||this.translator.changeLanguage(l),(f=(d=this.services.languageDetector)==null?void 0:d.cacheUserLanguage)==null||f.call(d,l)),this.loadResources(l,v=>{o(v,l)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?a(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(a):this.services.languageDetector.detect(a):a(e),s}getFixedT(e,n,s){const r=(o,a,...i)=>{let c;typeof a!="object"?c=this.options.overloadTranslationOptionHandler([o,a].concat(i)):c=_({},a),c.lng=c.lng||r.lng,c.lngs=c.lngs||r.lngs,c.ns=c.ns||r.ns,c.keyPrefix!==""&&(c.keyPrefix=c.keyPrefix||s||r.keyPrefix);const l=this.options.keySeparator||".";let d;return c.keyPrefix&&Array.isArray(o)?d=o.map(f=>(typeof f=="function"&&(f=ft(f,_(_({},this.options),a))),"".concat(c.keyPrefix).concat(l).concat(f))):(typeof o=="function"&&(o=ft(o,_(_({},this.options),a))),d=c.keyPrefix?"".concat(c.keyPrefix).concat(l).concat(o):o),this.t(d,c)};return V(e)?r.lng=e:r.lngs=e,r.ns=n,r.keyPrefix=s,r}t(...e){var n;return(n=this.translator)==null?void 0:n.translate(...e)}exists(...e){var n;return(n=this.translator)==null?void 0:n.exists(...e)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e,n={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;
1if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const s=n.lng||this.resolvedLanguage||this.languages[0],r=this.options?this.options.fallbackLng:!1,o=this.languages[this.languages.length-1];if(s.toLowerCase()==="cimode")return!0;const a=(i,c)=>{const l=this.services.backendConnector.state["".concat(i,"|").concat(c)];return l===-1||l===0||l===2};if(n.precheck){const i=n.precheck(this,a);if(i!==void 0)return i}return!!(this.hasResourceBundle(s,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||a(s,e)&&(!r||a(o,e)))}loadNamespaces(e,n){const s=xe();return this.options.ns?(V(e)&&(e=[e]),e.forEach(r=>{this.options.ns.indexOf(r)<0&&this.options.ns.push(r)}),this.loadResources(r=>{s.resolve(),n&&n(r)}),s):(n&&n(),Promise.resolve())}loadLanguages(e,n){const s=xe();V(e)&&(e=[e]);const r=this.options.preload||[],o=e.filter(a=>r.indexOf(a)<0&&this.services.languageUtils.isSupportedCode(a));return o.length?(this.options.preload=r.concat(o),this.loadResources(a=>{s.resolve(),n&&n(a)}),s):(n&&n(),Promise.resolve())}dir(e){var r,o;if(e||(e=this.resolvedLanguage||(((r=this.languages)==null?void 0:r.length)>0?this.languages[0]:this.language)),!e)return"rtl";try{const a=new Intl.Locale(e);if(a&&a.getTextInfo){const i=a.getTextInfo();if(i&&i.direction)return i.direction}}catch(a){}const n=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],s=((o=this.services)==null?void 0:o.languageUtils)||new Mt(tt());return e.toLowerCase().indexOf("-latn")>1?"ltr":n.indexOf(s.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(e={},n){const s=new $e(e,n);return s.createInstance=$e.createInstance,s}cloneInstance(e={},n=Oe){const s=e.forkResourceStore;s&&delete e.forkResourceStore;const r=X(_(_({},this.options),e),{isClone:!0}),o=new $e(r);if((e.debug!==void 0||e.prefix!==void 0)&&(o.logger=o.logger.clone(e)),["store","services","language"].forEach(i=>{o[i]=this[i]}),o.services=_({},this.services),o.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},s){const i=Object.keys(this.store.data).reduce((c,l)=>(c[l]=_({},this.store.data[l]),c[l]=Object.keys(c[l]).reduce((d,f)=>(d[f]=_({},c[l][f]),d),c[l]),c),{});o.store=new Ft(i,r),o.services.resourceStore=o.store}if(e.interpolation){const i=tt(),c=_(_(_({},i.interpolation),this.options.interpolation),e.interpolation),l=X(_({},r),{interpolation:c});o.services.interpolator=new Ut(l)}return o.translator=new Ve(o.services,r),o.translator.on("*",(i,...c)=>{o.emit(i,...c)}),o.init(r,n),o.translator.options=r,o.translator.backendConnector.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},o}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const ee=$e.createInstance();ee.createInstance;ee.dir;ee.init;ee.loadResources;ee.reloadResources;ee.use;ee.changeLanguage;ee.getFixedT;ee.t;ee.exists;ee.setDefaultNamespace;ee.hasLoadedNamespace;ee.loadNamespaces;ee.loadLanguages;G.defaults.headers.common["X-Requested-With"]="XMLHttpRequest";G.defaults.withXSRFToken=!0;G.interceptors.request.use(t=>(t.headers["X-Requested-With"]="XMLHttpRequest",t));G.interceptors.response.use(t=>t,async t=>{var o,a,i,c,l,d,f,v,m,p;const e=t.config||{},n=((o=t.config)==null?void 0:o.url)||"",s=((i=(a=t.config)==null?void 0:a.method)==null?void 0:i.toLowerCase())||"get",r=((l=(c=t.config)==null?void 0:c.headers)==null?void 0:l["X-Inertia-Prefetch"])||((f=(d=t.config)==null?void 0:d.headers)==null?void 0:f["x-inertia-prefetch"])||((m=(v=t.config)==null?void 0:v.headers)==null?void 0:m["X-Inertia"])==="true";if(((p=t.response)==null?void 0:p.status)===419&&!["get","head","options"].includes(s)&&!String(n).includes("/sanctum/csrf-cookie")&&!e.__csrfRetried)try{return e.__csrfRetried=!0,await G.get("/sanctum/csrf-cookie",{headers:{"X-Requested-With":"XMLHttpRequest"}}),G(e)}catch(L){return Promise.reject(L)}if(!t.response&&t.code){const L=t.code||"",k=t.message||"";if(s==="get"&&(L==="ERR_NETWORK"||L==="ERR_TOO_MANY_REDIRECTS"||k.includes("Network Error")||k.includes("redirect")))return Promise.reject(X(_({},t),{__isPrefetchError:!0,__isNetworkError:!0}))}if(t.response&&(t.response.status===409||t.response.status===403)){const L=n&&(n.includes("/blog")||n.includes("/newsletter-subscribers")||n.includes("/leads")||n.includes("/shipping")||n.includes("/analytics")||n.includes("/watily-app"));if(r||s==="get"&&L)return Promise.reject(X(_({},t),{__isPrefetchError:!0}))}return Promise.reject(t)});G.interceptors.response.use(t=>t,t=>{var e,n,s;return((e=t.response)==null?void 0:e.status)===403&&((s=(n=t.response)==null?void 0:n.data)!=null&&s.demo_mode)&&Le.error(t.response.data.message||"This action is disabled in demo mode."),Promise.reject(t)});let ue="",fe=0,Ht=!1;function Ur(){var e;if(Ht)return;Ht=!0;const t=window.page;(e=t==null?void 0:t.props)!=null&&e.flash&&Fe(t.props.flash),se.on("success",n=>{const s=n.detail.page.props.flash;s&&setTimeout(()=>{Fe(s)},150)}),se.on("finish",n=>{var r;const s=window.page;(r=s==null?void 0:s.props)!=null&&r.flash&&setTimeout(()=>{Fe(s.props.flash)},150)}),se.on("finish",n=>{var r;const s=window.page;(r=s==null?void 0:s.props)!=null&&r.flash&&setTimeout(()=>{Fe(s.props.flash)},150)})}function Fe(t){if(!t)return;const e=Date.now();if(t.success){const n=t.success;(n!==ue||e-fe>2e3)&&(Le.success(n,{duration:4e3}),ue=n,fe=e)}if(t.error){const n=t.error;(n!==ue||e-fe>2e3)&&(Le.error(n,{duration:5e3}),ue=n,fe=e)}if(t.warning){const n=t.warning;(n!==ue||e-fe>2e3)&&(Le.error(n,{duration:5e3}),ue=n,fe=e)}if(t.info){const n=t.info;(n!==ue||e-fe>2e3)&&(Le(n,{duration:4e3}),ue=n,fe=e)}}function Br(t){var r,o,a,i;const n=(()=>{var f;const c=t.base_url||t.image_url||null,l=typeof window!="undefined"?window.location.origin:"http://localhost";let d=c||l||"http://localhost";return typeof window!="undefined"&&((f=window.location)==null?void 0:f.protocol)==="https:"&&d.startsWith("http://")&&(d=d.replace(/^http:\/\//,"https://")),d.replace(/\/$/,"")})(),s={decimalFormat:t.decimalFormat||"2",defaultCurrency:t.defaultCurrency||"USD",decimalSeparator:t.decimalSeparator||".",thousandsSeparator:t.thousandsSeparator||",",floatNumber:t.floatNumber!=="0",currencySymbolSpace:t.currencySymbolSpace==="1",currencySymbolPosition:t.currencySymbolPosition||"before",currencySymbol:t.currencySymbol||"$",currencyCode:t.currencyCode||"USD",currencyName:t.currencyNname||"US Dollar"};
1window.appSettings={get:(c,l=null)=>{var d;return(d=t[c])!=null?d:l},baseUrl:n,dateFormat:(r=t.dateFormat)!=null?r:"yyyy-MM-dd",timeFormat:(o=t.timeFormat)!=null?o:"HH:mm",timezone:(a=t.defaultTimezone)!=null?a:"UTC",language:(i=t.defaultLanguage)!=null?i:"en",emailVerification:t.emailVerification===!0||t.emailVerification==="true",currencySettings:s,formatCurrency:(c,l={showSymbol:!0,showCode:!1})=>{var d;try{let f=typeof c=="string"?parseFloat(c):c;const v=parseInt(s.decimalFormat);s.floatNumber||(f=Math.floor(f));const m=f.toFixed(v).split(".");s.thousandsSeparator!=="none"&&(m[0]=m[0].replace(/\B(?=(\d{3})+(?!\d))/g,s.thousandsSeparator));let p=m.join(s.decimalSeparator);if(l.showSymbol){const L=s.currencySymbolSpace?" ":"";if(s.currencyCode==="SAR"){let k=!1;if(typeof document!="undefined"){const S=(document.documentElement.lang||"").trim().toLowerCase();if(S.length>0)k=S.startsWith("ar");else{const x=((d=t.defaultLanguage)!=null?d:"en").toString().toLowerCase();k=x==="ar"||x.startsWith("ar")}}const P=k?"ريال":"SR";p="".concat(p).concat(" ").concat(P)}else s.currencySymbolPosition==="before"?p="".concat(s.currencySymbol).concat(L).concat(p):p="".concat(p).concat(L).concat(s.currencySymbol)}return l.showCode&&(p="".concat(p," ").concat(s.currencyCode)),p}catch(f){return c.toString()}},formatDateTime:(c,l=!0)=>{var d,f;if(!c)return null;try{let v=function(L,k){const P=["January","February","March","April","May","June","July","August","September","October","November","December"],D=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],S=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],x=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];return L.replace(/[a-zA-Z]/g,A=>{switch(A){case"D":return x[k.getDay()];case"l":return S[k.getDay()];case"M":return D[k.getMonth()];case"F":return P[k.getMonth()];case"j":return k.getDate().toString();case"d":return String(k.getDate()).padStart(2,"0");case"Y":return k.getFullYear().toString();case"y":return k.getFullYear().toString().slice(-2);case"m":return String(k.getMonth()+1).padStart(2,"0");case"n":return(k.getMonth()+1).toString();case"G":return String(k.getHours());case"H":return String(k.getHours()).padStart(2,"0");case"g":return String(k.getHours()%12||12);case"h":return String(k.getHours()%12||12).padStart(2,"0");case"i":return String(k.getMinutes()).padStart(2,"0");case"s":return String(k.getSeconds()).padStart(2,"0");case"a":return k.getHours()>=12?"pm":"am";case"A":return k.getHours()>=12?"PM":"AM";default:return A}})};const m=typeof c=="string"?new Date(c):c;let p=(d=t.dateFormat)!=null?d:"D, M j, Y";if(l){const L=(f=t.timeFormat)!=null?f:"H:i";p="".concat(p," ").concat(L)}return v(p,m)}catch(v){return c.toString()}}}}const dt='input[type="number"]:not([lang])';function Kt(t){t.querySelectorAll(dt).forEach(e=>e.setAttribute("lang","en"))}function Vr(){typeof document=="undefined"||typeof MutationObserver=="undefined"||(Kt(document),new MutationObserver(t=>{var e;for(const n of t){if(n.type==="attributes"){const s=n.target;(e=s.matches)!=null&&e.call(s,dt)&&s.setAttribute("lang","en");continue}n.addedNodes.forEach(s=>{if(s.nodeType!==1)return;const r=s;r.matches(dt)&&r.setAttribute("lang","en"),Kt(r)})}}).observe(document.documentElement,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["type"]}))}function Hr(t,e){let n=null;return function(...s){const r=()=>{n=null,t(...s)};n!==null&&clearTimeout(n),n=setTimeout(r,e)}}function Kr(){if("IntersectionObserver"in window){const t=new IntersectionObserver(e=>{e.forEach(n=>{if(n.isIntersecting){const s=n.target;s.dataset.src&&(s.src=s.dataset.src,s.removeAttribute("data-src"),t.unobserve(s))}})});document.querySelectorAll("img[data-src]").forEach(e=>{t.observe(e)})}else document.querySelectorAll("img[data-src]").forEach(t=>{const e=t;e.dataset.src&&(e.src=e.dataset.src,e.removeAttribute("data-src"))})}function zr(t=!1){if(t&&"PerformanceObserver"in window)try{const e=new PerformanceObserver(n=>{n.getEntries().forEach(s=>{console.log("[Performance] ".concat(s.name,": ").concat(s.startTime.toFixed(0),"ms"))})});e.observe({type:"largest-contentful-paint",buffered:!0}),e.observe({type:"first-input",buffered:!0}),e.observe({type:"layout-shift",buffered:!0})}catch(e){console.warn("Performance monitoring not fully supported",e)}}const Ss="https://watily.com/index.php?route=api/watily-analytics",zt="wa_signup_sent",vs=/^[A-Za-z0-9]{22,40}$/;let qt=!1;function Jt(t){try{const e=document.cookie.match(new RegExp("(?:^|; )"+t+"=([^;]*)"));return e?decodeURIComponent(e[1]):""}catch(e){return""}}function Cs(t){return t?"".concat(zt,":").concat(t):zt}function ks(t){try{const e=Cs(t);if(localStorage.getItem(e))return;let n=null;try{n=JSON.parse(Jt("wa_attr")||"null")}catch(o){n=null}(n===null||typeof n!="object")&&(n=null);const s={event_type:"signup",referrer:document.referrer||"",utm:{source:(n==null?void 0:n.src)||"unknown",medium:(n==null?void 0:n.med)||"",campaign:(n==null?void 0:n.cmp)||""},event_data:{path:window.location.pathname,lang:(document.documentElement.lang||"ar").slice(0,2),attr:n,account_id:t||null}},r=Jt("wa_vid");vs.test(r)&&(s.visitor_id=r),fetch(Ss,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s),keepalive:!0}
1).catch(()=>{}),localStorage.setItem(e,"1")}catch(e){}}function Yt(t){try{const e=t==null?void 0:t.signupEvent;if(!e)return;ks(e.account_id?Number(e.account_id):null)}catch(e){}}function qr(){var t;qt||(qt=!0,Yt((t=window.page)==null?void 0:t.props),se.on("success",e=>{Yt(e.detail.page.props)}))}function xs(){const t=typeof window!="undefined"?window.Ziggy:void 0,e=typeof globalThis!="undefined"?globalThis.Ziggy:void 0;return t||e||(typeof Ziggy!="undefined"?Ziggy:void 0)}function _s(){const t=xs();return typeof window!="undefined"&&!window.Ziggy&&t&&(window.Ziggy=t),t}const Jr=(t,e=[])=>e.includes(t),Yr=(t,e)=>t.includes(e),Ls=15*1e3,Rs=120*1e3,$s=2,Es=1800*1e3,ht={alerts:new Set,chat:new Set,teamchat:new Set,support:new Set},Ae=new Set;let Xt=!1,Pe=null,nt=null,st=null,rt=0,we=!0,Sn=Date.now(),He=!1;const As=()=>{try{if(typeof route=="function")return route("api.signals.index")}catch(t){}return"/api/signals"};function Gt(t){we!==t&&(we=t,Ae.forEach(e=>{try{e(we)}catch(n){}}))}async function Ke(){var t,e,n,s;try{const r={Accept:"application/json"};st&&(r["If-None-Match"]=st);const o=await G.get(As(),{headers:r,validateStatus:c=>c===304||c>=200&&c<300});rt=0,Gt(!0);const a=(n=(t=o.headers)==null?void 0:t.etag)!=null?n:(e=o.headers)==null?void 0:e.ETag;if(a&&(st=a),o.status===304)return;const i=(s=o.data)==null?void 0:s.v;if(!i)return;
1nt&&Object.keys(i).forEach(c=>{var l;nt[c]!==i[c]&&((l=ht[c])==null||l.forEach(d=>{try{d()}catch(f){}}))}),nt=i}catch(r){rt+=1,rt>=$s&&Gt(!1)}}function Ts(){return document.visibilityState==="visible"?Ls:Rs}function ze(){if(Pe!==null&&(window.clearTimeout(Pe),Pe=null),Date.now()-Sn>=Es){He=!0;return}Pe=window.setTimeout(async()=>{await Ke(),ze()},Ts())}function Me(){const t=He;Sn=Date.now(),t&&(He=!1,Ke().finally(()=>ze()))}function wt(){Xt||(Xt=!0,Ke().finally(()=>ze()),document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="visible"){const t=He;Me(),t||Ke()}ze()}),document.addEventListener("pointerdown",Me,{passive:!0}),document.addEventListener("keydown",Me),window.addEventListener("focus",Me))}function Is(t,e){const n=u.useRef(e);n.current=e,u.useEffect(()=>{wt();const s=()=>n.current();return ht[t].add(s),()=>{ht[t].delete(s)}},[t])}function Xr(){const[t,e]=u.useState(we);return u.useEffect(()=>{wt(),e(we);const n=s=>e(s);return Ae.add(n),()=>{Ae.delete(n)}},[]),t}function Ns(t){return wt(),t(we),Ae.add(t),()=>{Ae.delete(t)}}const Os=300,Fs=30,Ps=t=>t==="orders"||t==="newsletter"||t==="support"||t==="reviews"||t==="loyalty"||t==="coupon_wallet",Ms=[{key:"orders",matcher:/^\/orders(?:\/|$)/},{key:"invoice_pro",matcher:/^\/(?:admin\/invoice-pro|invoice-pro)(?:\/|$)/},{key:"watily_hub",matcher:/^\/(?:whatsapp|chat|invitations|campaign-settings|watily-notify|watily-greeting)(?:\/|$)/},{key:"newsletter",matcher:/^\/newsletter-subscribers(?:\/|$)/},{key:"support",matcher:/^\/support-tickets(?:\/|$)/},{key:"reviews",matcher:/^\/(?:reviews|surveys)(?:\/|$)/},{key:"bookings",matcher:/^\/bookings(?:\/|$)/},{key:"leads",matcher:/^\/leads(?:\/|$)/},{key:"surveys",matcher:/^\/(?:reviews|surveys)(?:\/|$)/},{key:"company_support",matcher:/^\/company-support(?:\/|$)/},{key:"loyalty",matcher:/^\/loyalty(?:\/|$)/},{key:"coupon_wallet",matcher:/^\/coupon-wallet(?:\/|$)/},{key:"game_hub_bookings",matcher:/^\/game-hub\/bookings(?:\/|$)/}],Ds=t=>{const[e]=(t||"").split("?");return e||"/"},ot=(t,e)=>{try{if(typeof route=="function")return route(t)}catch(n){}return e};function Gr(t,e){const n=ae(),s=u.useMemo(()=>Ds(n.url||"/"),[n.url]),[r,o]=u.useState({}),[a,i]=u.useState(60),c=u.useRef(!1),l=u.useRef(""),d=u.useRef(null),f=u.useRef(!1),v=u.useRef(null),m=u.useRef(null),p=u.useCallback(async()=>{if(!c.current){c.current=!0;try{const S=(await G.get(ot("api.sidebar-alerts.index","/api/sidebar-alerts"),{headers:{Accept:"application/json"}})).data;o(S.alerts||{}),typeof S.pollIntervalSeconds=="number"&&S.pollIntervalSeconds>0&&i(S.pollIntervalSeconds)}catch(D){}finally{c.current=!1}}},[]),L=u.useCallback(async()=>{var D,S,x,A;if(!f.current){f.current=!0;try{const O={Accept:"application/json"};v.current&&(O["If-None-Match"]=v.current);const j=await G.get(ot("api.sidebar-alerts.pulse","/api/sidebar-alerts/pulse"),{headers:O,validateStatus:g=>g===304||g>=200&&g<300}),B=(x=(D=j.headers)==null?void 0:D.etag)!=null?x:(S=j.headers)==null?void 0:S.ETag;if(B&&(v.current=B),j.status===304)return;const h=(A=j.data.signature)!=null?A:null;if(d.current===null){d.current=h;return}h!==null&&h!==d.current&&(d.current=h,p())}catch(O){}finally{f.current=!1}}},[p]),k=u.useCallback(async D=>{if(!Array.isArray(D)||D.length===0)return;const S=Array.from(new Set(D)),x=S.some(A=>Ps(A));o(A=>{const O=_({},A);for(const j of S){const B=O[j];B&&(O[j]=X(_({},B),{count:0,isActive:!1}))}return O});try{await G.post(ot("api.sidebar-alerts.mark-seen","/api/sidebar-alerts/mark-seen"),{keys:S,context:x&&t?{store_id:t}:void 0},{headers:{Accept:"application/json"}})}catch(A){}},[t]);Is("alerts",p),u.useEffect(()=>{const D=Ns(S=>{S?m.current!==null&&(window.clearInterval(m.current),m.current=null):m.current===null&&(L(),m.current=window.setInterval(()=>{L()},Fs*1e3))});return()=>{D(),m.current!==null&&(window.clearInterval(m.current),m.current=null)}},[L]),u.useEffect(()=>{p();const D=window.setInterval(()=>{p()},Os*1e3),S=()=>{document.hidden||p()};return document.addEventListener("visibilitychange",S),()=>{window.clearInterval(D),document.removeEventListener("visibilitychange",S)}},[p]),u.useEffect(()=>{if(e||!s||l.current===s)return;const D=Ms.filter(({matcher:S})=>S.test(s)).map(({key:S})=>S);D.length!==0&&(l.current=s,k(D))},[e,k,s]);const P=u.useMemo(()=>{const D={};return Object.values(r).forEach(S=>
1{!S||!S.isActive||S.count<=0||!Array.isArray(S.navIds)||S.navIds.forEach(x=>{const A=D[x];if(!A){D[x]={count:S.count,isActive:!0,color:S.color};return}D[x]={count:A.count+S.count,isActive:!0,color:A.color==="orange"||S.color==="orange"?"orange":A.color==="red"||S.color==="red"?"red":"green"}})}),D},[r]);return{alerts:r,alertsByNavId:P,pollIntervalSeconds:a,refreshAlerts:p,markAlertsSeen:k}}async function _e(t,e,n,s){return(await G.request(_({method:t,url:e,data:n},s))).data}const he={get:(t,e)=>_e("get",t,void 0,e),post:(t,e,n)=>_e("post",t,e,n),put:(t,e,n)=>_e("put",t,e,n),patch:(t,e,n)=>_e("patch",t,e,n),delete:(t,e)=>_e("delete",t,void 0,e)};function vn(t){if(!t.startsWith("http"))return null;try{const e=new URL(t);if(!e.pathname.startsWith("/storage/"))return null;const n=(()=>{try{return new URL(bt()).host}catch(r){return""}})();return!new Set([n,typeof window!="undefined"?window.location.host:""].filter(Boolean)).has(e.host)&&!e.host.endsWith("watily.com")?null:e.pathname}catch(e){return null}}function Zr(t,e){if(!t||typeof t!="string"||t==="null"||t==="undefined")return"";if(t.startsWith("data:")||t.startsWith("blob:"))return t;if(t.startsWith("http")){const r=vn(t);if(!r)return t;t=r}const n=bt();if(e&&(e.maxWidth||e.maxHeight)){const r=Cn(t);if(r){const o=new URLSearchParams({path:r});return e.maxWidth&&o.set("w",String(Math.round(e.maxWidth))),e.maxHeight&&o.set("h",String(Math.round(e.maxHeight))),"".concat(n,"/img/resize?").concat(o.toString())}}const s=t.startsWith("/images/")||t.startsWith("/favicon")||t.startsWith("/storage/")?t:t.startsWith("/")?"/storage".concat(t):"/storage/".concat(t);return"".concat(n).concat(s)}function Qr(t,e=[480,768,1280,1920]){if(!t||typeof t!="string"||t.startsWith("data:")||t.startsWith("blob:"))return"";if(t.startsWith("http")){const r=vn(t);if(!r)return"";t=r}const n=Cn(t);if(!n)return"";const s=bt();return e.map(r=>{const o=new URLSearchParams({path:n,w:String(r)});return"".concat(s,"/img/resize?").concat(o.toString()," ").concat(r,"w")}).join(", ")}function eo(t,e){return!e||!e.startsWith("video/")?!1:!/\.(jpe?g|png|webp|gif)(\?|$)/i.test(t||"")}function bt(){var r,o;if(typeof window=="undefined")return"";const t=window.__page||window.page,e=(r=t==null?void 0:t.props)==null?void 0:r.baseUrl;if(e&&typeof e=="string")return e.replace(/\/$/,"");const n=window.appSettings;if(n!=null&&n.baseUrl)return n.baseUrl.replace(/\/$/,"");const s=(o=t==null?void 0:t.props)==null?void 0:o.globalSettings;return s!=null&&s.base_url?String(s.base_url).replace(/\/$/,""):window.location.origin}function Cn(t){return t.startsWith("http")||t.startsWith("data:")||t.startsWith("blob:")||t.startsWith("/images/")||t.startsWith("/favicon")?"":t.startsWith("/storage/")?t.replace(/^\/storage\/?/,""):t.startsWith("/")?t.replace(/^\//,""):t}function to(){const{auth:t}=ae().props,e=u.useMemo(()=>(t==null?void 0:t.permissions)||[],[t==null?void 0:t.permissions]),n=u.useMemo(()=>(t==null?void 0:t.roles)||[],[t==null?void 0:t.roles]),s=u.useMemo(()=>t==null?void 0:t.user,[t==null?void 0:t.user]),r=u.useMemo(()=>(s==null?void 0:s.type)==="superadmin"||(s==null?void 0:s.type)==="super admin",[s==null?void 0:s.type]),o=m=>r?!0:e.includes(m);return{permissions:e,roles:n,user:s,isSuperAdmin:r,hasPermission:o,hasAnyPermission:m=>r?!0:m.some(p=>e.includes(p)),hasAllPermissions:m=>r?!0:m.every(p=>e.includes(p)),hasRole:m=>n.includes(m),hasAnyRole:m=>m.some(p=>n.includes(p)),canPerformCrudOperation:(m,p)=>{const L="".concat(p,"-").concat(m);return o(L)},canAccessModule:m=>o("manage-".concat(m))||o("view-".concat(m)),filterActionsByPermissions:m=>m.filter(p=>p.requiredPermission?o(p.requiredPermission):!0)}}const it="--wt-bottom-bar",js=1024;let De=0;function no(t=!0){const e=u.useRef(null);return u.useLayoutEffect(()=>{if(!t)return;const n=e.current;if(!n)return;De+=1;const s=document.documentElement,r=window.matchMedia("(max-width: ".concat(js-1,"px)")),o=()=>{r.matches?s.style.setProperty(it,"".concat(Math.ceil(n.getBoundingClientRect().height),"px")):s.style.removeProperty(it)};o();const a=new ResizeObserver(o);return a.observe(n),r.addEventListener("change",o),()=>{a.disconnect(),r.removeEventListener("change",o),De=Math.max(0,De-1),De===0&&s.style.removeProperty(it)}},[t]),e}const so=(t=0)=>"calc(var(--wt-bottom-bar, 0px) + env(safe-area-inset-bottom, 0px) + ".concat(t,"rem)");function Ws(t){return!(t==="0"||t===0||t===!1||t==="false")}function Us(){var e;const t=ae().props;return Ws((e=t==null?void 0:t.globalSettings)==null?void 0:e.notificationSoundEnabled)}const Bs="data:audio/wav;base64,UklGRiQAAABXQVZFZm10IBAAAAABAAEAgD4AAAB9AAACABAAZGF0YQAAAAA=";let re=null;function ro(){if(!re)try{const t=new Audio(Bs);t.setAttribute("playsinline","true"),t.play().catch(()=>{}),re=t}catch(t){}}function oo(){var T;const{i18n:t}=be(),e=(T=t.language)!=null&&T.startsWith("ar")?"ar-SA":"en-US",n=typeof window!="undefined"?window.SpeechRecognition||window.webkitSpeechRecognition:null,s=!!n,[r,o]=u.useState(!1),[a,i]=u.useState(""),[c,l]=u.useState(""),[d,f]=u.useState(!1),[v,m]=u.useState(1),p=u.useRef(null),L=u.useRef([]),k=u.useRef(null),P=u.useRef(0),D=u.useCallback(()=>{var y;try{(y=p.current)==null||y.stop()}catch(b){}o(!1)},[]),S=u.useCallback(()=>
1{if(s)try{const y=new n;y.continuous=!1,y.interimResults=!0,y.lang=e,y.onresult=b=>{let w="",E="";for(let I=b.resultIndex;I<b.results.length;I++){const C=b.results[I];C.isFinal?E+=C[0].transcript:w+=C[0].transcript}w&&i(w),E&&(l(E),i(""))},y.onerror=()=>{o(!1)},y.onend=()=>{o(!1)},p.current=y,i(""),o(!0),y.start()}catch(y){o(!1)}},[n,e,s]);u.useEffect(()=>()=>{var y;try{(y=p.current)==null||y.stop()}catch(b){}p.current=null},[]);const x=u.useCallback((y,b)=>{if(!b.length)return;const w=y.slice(0,2).toLowerCase();return b.find(E=>E.lang===y)||b.find(E=>{var I;return(I=E.lang)==null?void 0:I.toLowerCase().startsWith(w)})||void 0},[]),A=u.useCallback((y,b,w)=>{if(b!==void 0&&b!==P.current||typeof window=="undefined"||!("speechSynthesis"in window)||!y)return;const E=window.speechSynthesis;let I=!1;const C=()=>{if(!I){I=!0;try{E.cancel();const U=new SpeechSynthesisUtterance(y),F=w?w==="ar"?"ar-SA":"en-US":e,M=x(F,L.current);M&&(U.voice=M),U.lang=F;let N;U.onstart=()=>{f(!0),m(0);const K=Math.max(1200,y.length*65),z=Date.now();N=window.setInterval(()=>{m(Math.min(1,(Date.now()-z)/K))},80)};const H=()=>{N&&window.clearInterval(N),f(!1),m(1)};U.onend=H,U.onerror=H,E.speak(U)}catch(U){f(!1)}}},W=E.getVoices();if(W.length){L.current=W,C();return}const R=()=>{L.current=E.getVoices(),E.removeEventListener("voiceschanged",R),C()};E.addEventListener("voiceschanged",R),window.setTimeout(()=>{E.removeEventListener("voiceschanged",R),L.current.length||(L.current=E.getVoices()),C()},300)},[e,x]),O=u.useCallback(()=>{f(!1),m(1);const y=k.current;if(y){try{y.pause(),y.currentTime=0,y!==re&&(y.src="")}catch(b){}k.current=null}},[]),j=u.useCallback(async(y,b)=>{var E;if(!y)return;const w=++P.current;O(),typeof window!="undefined"&&"speechSynthesis"in window&&window.speechSynthesis.cancel();try{const I=b!=null?b:(E=t.language)!=null&&E.startsWith("ar")?"ar":"en",C=await he.post(route("carla.speak"),{text:y,locale:I});if(w!==P.current)return;if(!(C!=null&&C.ok)||!C.audio_base64){A(y,w,b);return}const W="data:".concat(C.mime||"audio/wav",";base64,").concat(C.audio_base64),R=re!=null?re:new Audio;R.src=W,R.setAttribute("playsinline","true"),k.current=R,R.onpause=()=>f(!1),R.onplay=()=>{f(!0),m(0)},R.ontimeupdate=()=>{R.duration>0&&Number.isFinite(R.duration)&&m(Math.min(1,R.currentTime/R.duration))},R.onended=()=>{f(!1),m(1),k.current=null},R.onerror=()=>{f(!1),k.current=null,A(y,w,b)},await R.play(),w!==P.current&&(R.pause(),R.src="",f(!1))}catch(I){A(y,w,b)}},[t.language,A,O]),B=u.useCallback(async y=>{const b=++P.current;O();try{const w=re!=null?re:new Audio;w.src="".concat(route("carla.greeting-audio"),"?locale=").concat(y),w.setAttribute("playsinline","true"),k.current=w,w.onplay=()=>f(!0),w.onended=()=>{f(!1),k.current=null},await w.play(),b!==P.current&&(w.pause(),f(!1))}catch(w){}},[O]),h=u.useCallback(()=>{P.current++,O(),typeof window!="undefined"&&"speechSynthesis"in window&&window.speechSynthesis.cancel(),f(!1)},[O]);return u.useEffect(()=>O,[O]),{supported:s,canSpeak:typeof window!="undefined",listening:r,interimText:a,finalText:c,start:S,stop:D,speak:j,speakGreeting:B,cancel:h,speaking:d,progress:v}}function io(){const{t,i18n:e}=be(),[n,s]=u.useState(null),[r,o]=u.useState(null),[a,i]=u.useState(null),[c,l]=u.useState([]),[d,f]=u.useState(null),[v,m]=u.useState("company"),[p,L]=u.useState(""),[k,P]=u.useState(!1),[D,S]=u.useState(!1),[x,A]=u.useState(null),[O,j]=u.useState({kind:null,blocks:[]}),B=u.useCallback(async()=>{var W,R,U,F,M;if(!D)try{const N=await he.get(route("carla.bootstrap"));s((W=N.settings)!=null?W:null),o((R=N.profile)!=null?R:null),m((U=N.scope)!=null?U:"company"),L((F=N.greeting)!=null?F:""),f((M=N.credits)!=null?M:null),S(!0)}catch(N){A("bootstrap_failed")}},[D]),h=u.useCallback(async()=>{var W,R,U,F,M;try{const N=await he.get(route("carla.bootstrap"));s((W=N.settings)!=null?W:null),o((R=N.profile)!=null?R:null),m((U=N.scope)!=null?U:"company"),L((F=N.greeting)!=null?F:""),f((M=N.credits)!=null?M:null)}catch(N){A("bootstrap_failed")}},[]),g=u.useCallback(async()=>{try{const W=await he.get(route("carla.conversations"));l(W.conversations||[])}catch(W){A("conversations_failed")}},[]),T=u.useCallback(async W=>{try{const R=await he.get(route("carla.conversations.show",{conversation:W}));i({id:R.conversation.id,title:R.conversation.title,messages:R.messages||[]})}catch(R){A("open_conversation_failed")}},[]),y=u.useCallback(async W=>{try{await he.delete(route("carla.conversations.destroy",{conversation:W})),l(R=>R.filter(U=>U.id!==W)),i(R=>(R==null?void 0:R.id)===W?null:R)}catch(R){A("delete_conversation_failed")}},[]),b=u.useCallback(()=>{i(null)},[]),w=u.useCallback(async W=>{var R;try{const U=await he.post(route("carla.profile"),W);o((R=U.profile)!=null?R:null)}catch(U){A("update_profile_failed")}},[]),E=u.useCallback(async(W,R,U,F)=>{var M,N;try{const H=await he.post(route("carla.message"),{conversation_id:(M=a==null?void 0:a.id)!=null?M:void 0,text:W,locale:R});return i(K=>{var $;const z=(($=K==null?void 0:K.messages)!=null?$:[]).filter(J=>J.id!==U);return{id:H.conversation.id,title:H.conversation.title,messages:[...z,H.user_message,H.reply]}}),f((N=H.credits)!=null?N:null),H.reply}catch(H){A("send_failed");const K={id:"error-".concat(Date.now()),role:"assistant",content:t("The assistant is temporarily unavailable, please try again shortly"),created_at:new Date().toISOString()};return i(z=>{var $,J,q;return{id:($=z==null?void 0:z.id)!=null?$:null,title:(J=z==null?void 0:z.title)!=null?J:null,messages:[...((q=z==null?void 0:z.messages)!=null?q:[]).filter(Z=>Z.id!==U),F,K]}}),null}},[a,t]),I=u.useCallback(async(W,R,U,F)=>{var K,z,$,J;if(typeof fetch=="undefined"||typeof ReadableStream=="undefined")return E(W,R,U,F);const M=new AbortController;let N=!1;const H=setTimeout(()=>{N||M.abort()},4e3);try{const q=(z=(K=document.querySelector('meta[name="csrf-token"]'))==null?void 0:K.content)!=null?z:"",Z=await fetch(route("carla.message.stream"),{method:"POST",signal:M.signal,headers:{"Content-Type":"application/json",Accept:"text/event-stream","X-CSRF-TOKEN":q,"X-Requested-With":"XMLHttpRequest"},body:JSON.stringify({conversation_id:($=a==null?void 0:a.id)!=null?$:void 0,text:W,locale:R})});if(!Z.ok||!Z.body)throw new Error("stream_not_ok");const te=Z.body.getReader(),In=new TextDecoder;let ve="",St=null,ce=null;for(;;){const{value:Ce,done:Xe}=await te.read();if(Xe)break;N=!0,clearTimeout(H),ve+=In.decode(Ce,{stream:!0});let me;for(;(me=ve.indexOf("\n\n"))!==-1;){const Te=ve.slice(0,me);ve=ve.slice(me+2);const vt=Te.split("\n").find(le=>le.startsWith("event:")),Ct=Te.split("\n").find(le=>le.startsWith("data:"));if(!vt||!Ct)continue;const Ie=vt.slice(6).trim();let Ne={};try{Ne=JSON.parse(Ct.slice(5).trim())}catch(le){continue}if(Ie==="blocks")j(le=>{var ke;return X(_({},le),{blocks:(ke=Ne.blocks)!=null?ke:[]})});else if(Ie==="status")j(le=>{var ke;return X(_({},le),{kind:(ke=Ne.kind)!=null?ke:null})});else if(Ie==="done")ce=Ne,St=ce.reply;else if(Ie==="error")throw new Error("stream_error_event")}}if(!ce)throw new Error("stream_no_final_event");return i(Ce=>{var me;const Xe=((me=Ce==null?void 0:Ce.messages)!=null?me:[]).filter(Te=>Te.id!==U);return{id:ce.conversation.id,title:ce.conversation.title,messages:[...Xe,ce.user_message,ce.reply]}}),f((J=ce.credits)!=null?J:null),St}catch(q){return E(W,R,U,F)}finally{clearTimeout(H),j({kind:null,blocks:[]})}},[a,E]),C=u.useCallback(async(W,R)=>{var H;const U=W.trim();if(!U||k)return null;const F=R!=null?R:(H=e.language)!=null&&H.startsWith("ar")?"ar":"en";P(!0),A(null);const M="temp-".concat(Date.now()),N={id:M,role:"user",content:U,created_at:new Date().toISOString()};i(K=>{var z,$,J;return{id:(z=K==null?void 0:K.id)!=null?z:null,title:($=K==null?void 0:K.title)!=null?$:null,messages:[...(J=K==null?void 0:K.messages)!=null?J:[],N]}});try{return await I(U,F,M,N)}finally{P(!1)}},[k,e.language,I]);return{settings:n,profile:r,conversation:a,conversations:c,credits:d,scope:v,greeting:p,sending:k,error:x,streamStatus:O,load:B,reload:h,loadConversations:g,openConversation:T,deleteConversation:y,startNewConversation:b,updateProfile:w,send:C}}const Vs=1500,Hs=1e4,Zt="watily_bg_alert_notif_permission_asked_v1",Ks="/media/notification-sound",zs=[{matcher:/^\/whatsapp\/chat(?:\/|$|\?)/,keys:new Set(["watily_hub"])},{matcher:/^\/chat(?:\/|$|\?)/,keys:new Set(["watily_hub"])},{matcher:/^\/game-hub\/menu-orders(?:\/|$|\?)/,keys:new Set(["game_hub"])}],qs="watily_bg_alert_baseline_v1",kn=t=>"".concat(qs,":").concat(String(t!=null?t:"anon")),Js=t=>{try{const e=sessionStorage.getItem(kn(t));if(!e)return null;const n=JSON.parse(e);return!n||typeof n.total!="number"||typeof n.perKey!="object"?null:{total:n.total,perKey:n.perKey||{}}}catch(e){return null}},Qt=(t,e,n)=>{try{sessionStorage.setItem(kn(t),JSON.stringify({total:e,perKey:n}))}catch(s){}},xn=()=>
1{if(typeof document=="undefined")return!1;const t=(document.documentElement.getAttribute("lang")||"").toLowerCase();return t?t.startsWith("ar"):document.documentElement.getAttribute("dir")==="rtl"},Ys=t=>xn()?"🔔 (".concat(t,") تنبيه جديد"):"🔔 (".concat(t,") New Alert").concat(t===1?"":"s"),Xs=t=>{const e=xn();return t==="order"?e?{title:"طلب جديد",body:"وصلك طلب جديد في لوحة التحكم"}:{title:"New order",body:"You have a new order in your dashboard"}:t==="chat"?e?{title:"رسالة واتساب جديدة",body:"وصلتك رسالة واتساب جديدة"}:{title:"New WhatsApp message",body:"You have a new WhatsApp message"}:t==="team"?e?{title:"رسالة من الفريق",body:"وصلتك رسالة جديدة في الشات الداخلي"}:{title:"Team message",body:"You have a new internal team message"}:e?{title:"تنبيه جديد",body:"في تحديث جديد بلوحة التحكم"}:{title:"New alert",body:"There is a new update in your dashboard"}},Gs=(t,e)=>{const n=zs.find(({matcher:s})=>s.test(t));return n?e.length===0?!0:e.every(s=>n.keys.has(s)):!1},Zs=new Set(["orders","bookings","game_hub","game_hub_bookings"]),Qs=new Set(["watily_hub","team_chat"]),er=t=>t==="team_chat"?"team":Zs.has(t)?"order":Qs.has(t)?"chat":"generic";function ao(t,e=0){const n=ae(),s=Us(),r=u.useRef(s);r.current=s;const o=u.useRef(null),a=u.useRef({}),i=u.useRef(null),c=u.useRef(null),l=u.useRef(null),d=u.useRef(new Map),f=u.useRef(0),v=u.useRef(!1),m=u.useRef(null),p=u.useRef(!1),L=u.useRef(!1),k=u.useRef("generic"),P=u.useCallback(()=>{if(typeof Audio=="undefined")return null;if(!m.current)try{const y=new Audio(Ks);y.preload="auto",y.volume=.6,m.current=y}catch(y){return null}return m.current},[]),D=u.useCallback(()=>{try{const y=window.AudioContext||window.webkitAudioContext;if(!y)return;const b=new y,w=b.createOscillator(),E=b.createGain();w.type="sine",w.frequency.value=880,E.gain.setValueAtTime(1e-4,b.currentTime),E.gain.exponentialRampToValueAtTime(.15,b.currentTime+.02),E.gain.exponentialRampToValueAtTime(1e-4,b.currentTime+.35),w.connect(E),E.connect(b.destination),w.start(),w.stop(b.currentTime+.4),w.onended=()=>{b.close().catch(()=>{})}}catch(y){}},[]),S=u.useCallback(()=>{const y=P();if(!y){D();return}try{y.currentTime=0}catch(w){}const b=y.play();b&&typeof b.then=="function"?b.then(()=>{p.current=!0}).catch(()=>{v.current=!0}):p.current=!0},[P,D]),x=u.useCallback((y,b)=>{if(Gs(y,b)||!r.current)return;const w=Date.now();w-f.current<Hs||(f.current=w,S())},[S]);u.useEffect(()=>{const y=()=>{v.current&&(v.current=!1,S())},b=["click","keydown","touchstart"];return b.forEach(w=>document.addEventListener(w,y,{passive:!0})),()=>{b.forEach(w=>document.removeEventListener(w,y))}},[S]),u.useEffect(()=>{if(typeof Notification=="undefined")return;const y=()=>{if(L.current||Notification.permission!=="default")return;let w=!1;try{w=localStorage.getItem(Zt)==="1"}catch(E){}if(!w){L.current=!0;try{localStorage.setItem(Zt,"1")}catch(E){}Notification.requestPermission().catch(()=>{})}},b=["click","keydown","touchstart"];return b.forEach(w=>document.addEventListener(w,y,{passive:!0})),()=>{b.forEach(w=>document.removeEventListener(w,y))}},[]);const A=u.useCallback(()=>{c.current!==null&&(window.clearInterval(c.current),c.current=null),i.current!==null&&(document.title=i.current,i.current=null)},[]),O=u.useCallback(y=>{i.current===null&&(i.current=document.title);const b=i.current,w=Ys(y);let E=!1;c.current!==null&&window.clearInterval(c.current),document.title=w,E=!0,c.current=window.setInterval(()=>{E=!E,document.title=E?w:b},Vs)},[]),j=u.useCallback(()=>Array.from(document.querySelectorAll("link[rel*='icon']")),[]),B=u.useCallback(y=>new Promise(b=>{try{const w=new Image;w.crossOrigin="anonymous",w.onload=()=>{try{const I=document.createElement("canvas");I.width=64,I.height=64;const C=I.getContext("2d");if(!C){b(null);return}C.clearRect(0,0,64,64),C.drawImage(w,0,0,64,64);const W=64*.22,R=64-W-2,U=64-W-2;C.beginPath(),C.arc(R,U,W+3,0,Math.PI*2),C.fillStyle="#ffffff",C.fill(),C.beginPath(),C.arc(R,U,W,0,Math.PI*2),C.fillStyle="#f97316",C.fill(),b(I.toDataURL("image/png"))}catch(E){b(null)}},w.onerror=()=>b(null),w.src=y}catch(w){b(null)}}),[]),h=u.useCallback(()=>{const y=l.current;y&&(y.forEach((b,w)=>{w.href=b}),l.current=null)},[]),g=u.useCallback(async()=>
1{if(l.current)return;const y=j();if(y.length===0)return;const b=new Map;y.forEach(w=>b.set(w,w.href)),l.current=b,await Promise.all(y.map(async w=>{const E=w.href;let I=d.current.get(E);if(!I){const C=await B(E);if(!C)return;I=C,d.current.set(E,I)}l.current&&l.current.has(w)&&(w.href=I)}))},[B,j]),T=u.useCallback(y=>{if(typeof Notification!="undefined"&&Notification.permission==="granted")try{const{title:b,body:w}=Xs(y),E=new Notification(b,{body:w,icon:"/favicon.ico",tag:"watily-bg-alert"});E.onclick=()=>{window.focus(),E.close()}}catch(b){}},[]);u.useEffect(()=>{const y=()=>{document.hidden||(A(),h())};return document.addEventListener("visibilitychange",y),()=>{document.removeEventListener("visibilitychange",y)}},[A,h]),u.useEffect(()=>{var R,U,F;const y=(n.url||"/").split("?")[0]||"/",b=(F=(U=(R=n.props)==null?void 0:R.auth)==null?void 0:U.user)==null?void 0:F.id,w=t||{},E={};let I=0;Object.values(w).forEach(M=>{!M||!M.isActive||!(M.count>0)||(E[M.key]=M.count,I+=M.count)});const C=I+(e>0?e:0),W=Object.keys(w).length>0;if(o.current===null){const M=Js(b);if(M)o.current=M.total,a.current=M.perKey;else{if(!W)return;o.current=C,a.current=E,Qt(b,C,E);return}}if(W){if(C>o.current){const M=C-o.current;let N=null,H=0;Object.entries(E).forEach(([$,J])=>{const q=a.current[$]||0,Z=J-q;Z>H&&(H=Z,N=$)});const K=N?er(N):e>0?"chat":"generic";k.current=K;const z=Object.entries(E).filter(([$,J])=>J>(a.current[$]||0)).map(([$])=>$);typeof document!="undefined"&&document.hidden?(O(M),g(),x(y,z),T(K)):x(y,z)}o.current=C,a.current=E,Qt(b,C,E)}},[t,e,n.url,x,T,g,O]),u.useEffect(()=>()=>{if(A(),h(),m.current){try{m.current.pause()}catch(y){}m.current=null}},[A,h])}function co(){const{favicon:t,appIcon:e}=Je();u.useEffect(()=>{const n=(t||e||Q.favicon||"").trim();if(!n)return;const s=n.startsWith("http")?n:n.startsWith("/storage/")||n.startsWith("/")?"".concat(window.location.origin).concat(n):n,r=document.querySelectorAll("link[rel*='icon']");if(r.length)r.forEach(o=>{o.href=s});else{const o=document.createElement("link");o.rel="icon",o.href=s,document.head.appendChild(o)}},[t,e])}function lo(){const{titleText:t}=Je();u.useEffect(()=>{const n=document.title.split(" - ");n.length>1?document.title="".concat(n[0]," - ").concat(t):document.title=t},[t])}function uo(){const{themeColor:t,customColor:e,themeMode:n}=Je(),{updateAppearance:s,updateThemeColor:r,updateCustomColor:o}=mn();u.useEffect(()=>{n&&s(n)},[n,s]),u.useEffect(()=>{t&&r(t)},[t,r]),u.useEffect(()=>{e&&t==="custom"&&o(e)},[e,t,o])}function oe(t){if(typeof t=="string"&&t.length>0&&t!=="cimode")return t;if(typeof document!="undefined"){const e=(document.documentElement.lang||"").trim();if(e.length>0)return e}return"en"}function ie(t){const e=oe(t);return{symbol:e==="ar"||e.startsWith("ar")?"ريال":"SR",position:"after"}}function tr(t,e){return t==="SAR"?ie(oe()).symbol:e}function fo(t,e){var m,p;!e&&typeof window!="undefined"&&((p=(m=window.page)==null?void 0:m.props)!=null&&p.storeCurrency)&&(e=window.page.props.storeCurrency);const n=e||{code:"SAR",symbol:"SAR",name:"Saudi Riyal",position:"after",decimals:2,decimal_separator:".",thousands_separator:","},s=oe(),r=X(_({},n),{symbol:tr(n.code,n.symbol)}),o=r.code==="SAR"?ie(s).position:r.position,a=typeof t=="string"?parseFloat(t):t;if(isNaN(a)||typeof a!="number"){const L=parseInt(String(r.decimals||2)),k="0".concat(r.decimal_separator).concat("0".repeat(L));if(r.code==="SAR"){const{symbol:P}=ie(s);return"".concat(k," ").concat(P)}return o==="after"?"".concat(k," ").concat(r.symbol):"".concat(r.symbol," ").concat(k)}const i=parseInt(String(r.decimals||2)),c=isNaN(i)||i<0?2:i,d=a.toFixed(c).split(".");r.thousands_separator&&(d[0]=d[0].replace(/\B(?=(\d{3})+(?!\d))/g,r.thousands_separator));const f=d.join(r.decimal_separator);return o==="after"?"".concat(f," ").concat(r.symbol):"".concat(r.symbol," ").concat(f)}function ho(t,e={},n=[]){const{defaultCurrency:s="SAR",decimalFormat:r="2",decimalSeparator:o=".",thousandsSeparator:a=",",currencySymbolPosition:i="before",currencySymbolSpace:c=!1,floatNumber:l=!0}=e,d=typeof t=="string"?parseFloat(t):t;if(isNaN(d)||typeof d!="number"){if(s==="SAR"){const{symbol:h}=ie(oe());return"0.00 ".concat(h)}const j=n.find(h=>
1h.code===s),B=(j==null?void 0:j.symbol)||(s==="SAR"?ie(oe()).symbol:"$");return i==="after"?"0.00 ".concat(B):"".concat(B,"0.00")}const f=n.find(j=>j.code===s);let v=(f==null?void 0:f.symbol)||(s==="SAR"?ie(oe()).symbol:"$"),m=i,p=c;if(s==="SAR"){const j=ie(oe());v=j.symbol,m=j.position,p=!0}const L=l===!1||l==="0"?Math.floor(d):d,k=parseInt(String(r||"2")),P=isNaN(k)||k<0?2:k,S=L.toFixed(P).split(".");a&&a!=="none"&&(S[0]=S[0].replace(/\B(?=(\d{3})+(?!\d))/g,a));const x=S.join(o),A=p===!0||p==="1"?" ":"";return m==="after"?"".concat(x).concat(A).concat(v):"".concat(v).concat(A).concat(x)}function nr(t){const e=oe(t);return e==="ar"||e.startsWith("ar")?"ريال":"SR"}function sr(t,e=2,n){const s=typeof t=="string"?parseFloat(t):t,r=Number.isNaN(s)?"0":s.toFixed(e),o=nr(n);return"".concat(r," ").concat(o)}function go(t,e,n){const s=typeof t=="number"?t:parseFloat(String(t));return Number.isNaN(s)?String(t):sr(s,2,n)}function rr(t,e,n){return t==="SAR"?ie(n).symbol:e}function or(){const{props:t}=ae(),{i18n:e}=be(),n=t.storeCurrency||{code:"SAR",symbol:"SR",name:"Saudi Riyal",position:"after",decimals:2,decimal_separator:".",thousands_separator:","},s=oe(e.language),r=rr(n.code,n.symbol,s),o=n.code==="SAR"?ie(s).position:n.position;return X(_({},n),{symbol:r,position:o})}function po(){const t=or();return e=>{const n=typeof e=="string"?parseFloat(e):e,s=t.position;if(isNaN(n)||typeof n!="number"){const l=parseInt(String(t.decimals||2)),d="0".concat(t.decimal_separator).concat("0".repeat(l));return s==="after"?"".concat(d," ").concat(t.symbol):"".concat(t.symbol," ").concat(d)}const r=parseInt(String(t.decimals||2)),o=isNaN(r)||r<0?2:r,i=n.toFixed(o).split(".");t.thousands_separator&&(i[0]=i[0].replace(/\B(?=(\d{3})+(?!\d))/g,t.thousands_separator));const c=i.join(t.decimal_separator);return s==="after"?"".concat(c," ").concat(t.symbol):"".concat(t.symbol," ").concat(c)}}function mo(t,e,n){const s=n.startsWith("ar"),r=(t!=null?t:"").trim(),o=(e!=null?e:"").trim();return s?o||r:r||o}function yo(t){var n,s;const e="".concat((n=t.name)!=null?n:""," ").concat((s=t.name_ar)!=null?s:"").toLowerCase();return e.includes("lost")||e.includes("خسارة")}function ir(t,e="yyyy-MM-dd HH:mm"){if(!t)return"-";try{const n=typeof t=="string"?ln(t):t;return un(n,e)}catch(n){return console.error("Error formatting date:",n),"-"}}function wo(t){return ir(t,"yyyy-MM-dd")}function bo(t){if(!t)return"-";try{const e=typeof t=="string"?ln(t):t,s=Math.floor((new Date().getTime()-e.getTime())/1e3),r=un(e,"MMM d, yyyy");let o="";if(s<60)o="just now";else{const a=Math.floor(s/60);if(a<60)o="".concat(a," minute").concat(a>1?"s":""," ago");else{const i=Math.floor(a/60);if(i<24)o="".concat(i," hour").concat(i>1?"s":""," ago");else{const c=Math.floor(i/24);if(c<30)o="".concat(c," day").concat(c>1?"s":""," ago");else{const l=Math.floor(c/30);if(l<12)o="".concat(l," month").concat(l>1?"s":""," ago");else{const d=Math.floor(l/12);o="".concat(d," year").concat(d>1?"s":""," ago")}}}}}return"".concat(r," (since ").concat(o,")")}catch(e){return console.error("Error formatting date with relative time:",e),"-"}}function So(t){switch(t){case"WhatsApp":return Y.jsx(Un,{className:"h-3 w-3"});case"Support":return Y.jsx(_t,{className:"h-3 w-3"});case"Store":return Y.jsx(Wn,{className:"h-3 w-3"});case"Website":return Y.jsx(Ge,{className:"h-3 w-3"});case"Campaign":return Y.jsx(Ge,{className:"h-3 w-3"});case"Form":return Y.jsx(_t,{className:"h-3 w-3"});case"Referral":case"Referrals":return Y.jsx(jn,{className:"h-3 w-3"});default:return Y.jsx(Ge,{className:"h-3 w-3"})}}function vo(t){switch(t){case"WhatsApp":return"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-300";case"Support":return"bg-orange-100 text-orange-800 dark:bg-orange-900 dark:text-orange-300";case"Manual":return"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-300";case"Website":return"bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-300";case"Campaign":return"bg-pink-100 text-pink-800 dark:bg-pink-900 dark:text-pink-300";case"Store":return"bg-indigo-100 text-indigo-800 dark:bg-indigo-900 dark:text-indigo-300";
1case"Form":return"bg-cyan-100 text-cyan-800 dark:bg-cyan-900 dark:text-cyan-300";case"Referral":case"Referrals":return"bg-violet-100 text-violet-800 dark:bg-violet-900 dark:text-violet-300";default:return"bg-gray-100 text-gray-800 dark:bg-gray-900 dark:text-gray-300"}}const ar=5*1024*1024,cr=3,lr=3;function ur(){return Math.random().toString(36).slice(2)+Date.now().toString(36)}async function at(t,e,n,s){let r;for(let o=0;o<lr;o++){try{const a=await fetch(t,{method:"POST",body:e,headers:n,credentials:"same-origin",signal:s});if(a.ok||a.status===422||a.status===403||a.status===413)return a;r=new Error("HTTP ".concat(a.status))}catch(a){if(s!=null&&s.aborted)throw a;r=a}await new Promise(a=>setTimeout(a,500*Math.pow(2,o)))}throw r!=null?r:new Error("Upload chunk failed")}function Co(t){const{csrfToken:e,folderId:n,collection:s,chunkSize:r=ar,maxConcurrentChunks:o=cr}=t,[a,i]=u.useState([]),[c,l]=u.useState(!1),d=u.useRef(null),f=u.useRef([]),v=u.useCallback((S,x)=>{var O;f.current=f.current.map(j=>j.id===S?_(_({},j),x):j),i([...f.current]);const A=f.current.find(j=>j.id===S);A&&((O=t.onFileProgress)==null||O.call(t,A))},[t]),m=u.useCallback(S=>{const x=Array.from(S).map(A=>({id:ur(),file:A,status:"queued",progress:0,uploadedBytes:0}));f.current=[...f.current,...x],i([...f.current])},[]),p=u.useCallback(S=>{f.current=f.current.filter(x=>x.id!==S),i([...f.current])},[]),L=u.useCallback(()=>{f.current=[],i([]),l(!1)},[]),k=u.useCallback(async()=>{var S;(S=d.current)==null||S.abort();for(const x of f.current)if(x.uploadId&&(x.status==="uploading"||x.status==="queued"))try{const A=new FormData;A.append("upload_id",x.uploadId),A.append("_token",e),await fetch("/api/file-manager/upload/abort",{method:"POST",body:A,credentials:"same-origin",headers:{"X-CSRF-TOKEN":e,Accept:"application/json"}})}catch(A){}f.current=f.current.map(x=>x.status==="uploading"||x.status==="queued"?X(_({},x),{status:"aborted"}):x),i([...f.current]),l(!1)},[e]),P=u.useCallback(async(S,x)=>{var W;const A=Math.max(1,Math.ceil(S.file.size/r));v(S.id,{status:"uploading",progress:0,uploadedBytes:0});const O=new FormData;O.append("file_name",S.file.name),O.append("mime_type",S.file.type||"application/octet-stream"),O.append("total_size",String(S.file.size)),O.append("total_chunks",String(A)),n!=null&&O.append("folder_id",String(n)),s&&O.append("collection",s),O.append("_token",e);const j=await at("/api/file-manager/upload/init",O,{"X-CSRF-TOKEN":e,Accept:"application/json"},x);if(!j.ok){const R=await j.json().catch(()=>({}));throw new Error(R.message||"Failed to start upload")}const{upload_id:B}=await j.json();v(S.id,{uploadId:B});const h=Array.from({length:A},(R,U)=>U);let g=0;const T=async R=>{for(;R.length;){if(x.aborted)return;const U=R.shift(),F=U*r,M=Math.min(F+r,S.file.size),N=S.file.slice(F,M),H=new FormData;H.append("upload_id",B),H.append("index",String(U)),H.append("chunk",N,"chunk-".concat(U)),H.append("_token",e);const K=await at("/api/file-manager/upload/chunk",H,{"X-CSRF-TOKEN":e,Accept:"application/json"},x);if(!K.ok){const $=await K.json().catch(()=>({}));throw new Error($.message||"Chunk ".concat(U," failed"))}g+=M-F;const z=Math.min(99,Math.round(g/S.file.size*100));v(S.id,{progress:z,uploadedBytes:g})}},y=[...h],b=Array.from({length:Math.min(o,A)},()=>T(y));if(await Promise.all(b),x.aborted)return;const w=new FormData;w.append("upload_id",B),w.append("_token",e);const E=await at("/api/file-manager/upload/finalize",w,{"X-CSRF-TOKEN":e,Accept:"application/json"},x);if(!E.ok){const R=await E.json().catch(()=>({}));throw new Error(R.message||"Failed to finalize upload")}const I=await E.json();v(S.id,{status:"completed",progress:100,result:I.data});const C=f.current.find(R=>R.id===S.id);C&&((W=t.onFileComplete)==null||W.call(t,C))},[r,e,n,s,o,v,t]),D=u.useCallback(async()=>{var x,A;if(c||f.current.length===0)return;l(!0),d.current=new AbortController;const S=d.current.signal;for(const O of f.current){if(S.aborted)break;if(O.status!=="completed")try{await P(O,S)}catch(j){const B=j instanceof Error?j.message:"Upload failed";v(O.id,{status:"error",error:B});const h=f.current.find(g=>g.id===O.id);h&&((x=t.onFileError)==null||x.call(t,h))}}l(!1),S.aborted||(A=t.onAllComplete)==null||A.call(t,f.current)},[c,P,v,t]);return{files:a,isRunning:c,addFiles:m,removeFile:p,start:D,abort:k,reset:L}}function ko(){var e,n;const t=document.head.querySelector('meta[name="csrf-token"]');return t?t.content:typeof window!="undefined"&&((n=(e=window.page)==null?void 0:e.props)!=null&&n.csrf_token)?window.page.props.csrf_token:null}const fr=()=>{if(typeof window!="undefined")try{const t=new URLSearchParams(window.location.search),e=t.get("lang")||t.get("language");if(!e)return;if(e==="en")return"en";if(e==="ar"||e.startsWith("ar"))return"ar";if(e==="pt"||e.startsWith("pt"))return"pt"}catch(t){}},en=()=>{var e;if(typeof document=="undefined"||!((e=document.documentElement)!=null&&e.lang))return;const t=document.documentElement.lang.toLowerCase();if(t==="en"||t.startsWith("en-"))return"en";if(t==="ar"||t.startsWith("ar"))return"ar";if(t==="pt"||t.startsWith("pt"))return"pt"},dr=()=>{if(typeof window=="undefined")return!1;if(window.location.pathname.startsWith("/store/"))return!0;try{return new URLSearchParams(window.location.search).has("builder_preview")}catch(t){return!1}},tn=t=>{if(!(!t||typeof t!="string")){if(t==="ar"||t.startsWith("ar"))return"ar";if(t==="en"||t.startsWith("en"))return"en";if(t==="pt"||t.startsWith("pt"))return"pt"}},nn=t=>{var n;const e=t==null?void 0:t.language;if(typeof e=="string"&&e.length>0)return e;if(typeof window!="undefined"){const s=(n=window.i18next)==null?void 0:n.language;if(typeof s=="string"&&s.length>0)return s}},hr=t=>{const e=fr();if(e)return e;const n=typeof window!="undefined"?window.__themeBuilderPreviewLang:void 0;if(n==="ar"||n==="en"||n==="pt")return n;if(dr()){const a=en();if(a)return a;const i=tn(nn(t));return i||"ar"}const r=tn(nn(t));if(r)return r;const o=en();return o||"en"};function xo(t){const e=String(t!=null?t:"").trim();if(!e)return"ltr";const n=/[\u0600-\u06FF\u0750-\u077F\u08A0-\u08FF\uFB50-\uFDFF\uFE70-\uFEFF]/.test(e),s=/[A-Za-z]/.test(e);
1if(s&&!n)return"ltr";if(n&&!s)return"rtl";if(n&&s){const r=e.search(/[\u0600-\u06FF]/),o=e.search(/[A-Za-z]/);return r===-1?"ltr":o===-1||r<o?"rtl":"ltr"}return"ltr"}const je=(t,e)=>{if(!t||Array.isArray(t))return"";const n=hr(e),s=n==="ar",r=(o,a)=>{const i=typeof o=="string"?o:o!=null?String(o):"",c=typeof a=="string"?a:a!=null?String(a):"";return i.trim()!==""?i:c.trim()!==""?c:""};if(typeof t=="object"&&t!==null){if("value"in t){if(t=t.value,!t)return"";if(typeof t=="object"&&t!==null&&("en"in t||"ar"in t||"pt"in t))return n==="pt"?r(t.pt,r(t.en,t.ar)):s?r(t.ar,t.en):r(t.en,t.ar)}if("en"in t||"ar"in t||"pt"in t){if(n==="pt")return r(t.pt,r(t.en,t.ar));const o=s?t.ar:t.en,a=s?t.en:t.ar;return r(o,a)}if(typeof t=="object")return console.warn("getTranslatedText received unexpected object structure:",t),""}return typeof t=="string"?t:t!=null?String(t):""},_o=()=>{const{i18n:t}=be();return e=>je(e,t)};function Lo(t,e){typeof window!="undefined"&&window.__triggerPixelEvent&&window.__triggerPixelEvent(t,e)}const sn="site_visit_session",gr=720*60*60,gt="site_visit_tracking_disabled_until",pr=300*1e3;function _n(){if(typeof document=="undefined")return"";const t=document.cookie.match(new RegExp("(?:^|; )".concat(sn,"=([^;]*)"))),e=t?decodeURIComponent(t[1]):"";if(e&&e.length>=16)return e;const n="sv_"+crypto.randomUUID().replace(/-/g,"");return document.cookie="".concat(sn,"=").concat(n,"; path=/; max-age=").concat(gr,"; SameSite=Lax"),n}function Ro(){return _n()}function Se(t,e={}){var d;if(wr())return;const n=typeof window!="undefined"?window.location.origin:"",s=window.location.pathname||"",r=mr(s),o=e.storeSlug||r,a=yr(n,r,o),i={event_type:t,url:e.url||(typeof window!="undefined"?window.location.href:""),route_name:e.routeName,user_id:e.userId,product_id:e.productId,quantity:e.quantity,element_type:e.elementType,element_id:e.elementId,element_text:e.elementText,metadata:e.metadata,store_slug:o},c={"Content-Type":"application/json","X-Requested-With":"XMLHttpRequest",Accept:"application/json","X-Session-Id":_n()},l=typeof document!="undefined"?(d=document.querySelector('meta[name="csrf-token"]'))==null?void 0:d.getAttribute("content"):null;l&&(c["X-CSRF-TOKEN"]=l),Sr(a,c,i)}function mr(t){const e=t.match(/^\/store\/([^/]+)/);return e?e[1]:void 0}function yr(t,e,n){if(!t)return[];const s=[],r=a=>{a&&(s.includes(a)||s.push(a))},o=n||e;return e?(r("".concat(t,"/store/").concat(e,"/api/track")),r("".concat(t,"/api/track")),o&&o!==e&&r("".concat(t,"/store/").concat(o,"/api/track")),s):(r("".concat(t,"/api/track")),o&&r("".concat(t,"/store/").concat(o,"/api/track")),s)}function wr(){if(typeof window=="undefined")return!1;try{const t=Number(sessionStorage.getItem(gt)||"0");return t?Date.now()>=t?(sessionStorage.removeItem(gt),!1):!0:!1}catch(t){return!1}}function br(){if(typeof window!="undefined")try{sessionStorage.setItem(gt,String(Date.now()+pr))}catch(t){}}async function Sr(t,e,n){if(!t.length)return;let s=!1;for(const r of t)try{const o=await fetch(r,{method:"POST",headers:e,body:JSON.stringify(n),credentials:"same-origin"});if(o.ok)return;if(o.status===404||o.status===405||o.status===419){s=!0;continue}return}catch(o){}s&&br()}function $o(t,e){Se("product_view",{storeSlug:t,productId:e})}function Eo(t,e,n=1){Se("add_to_cart",{storeSlug:t,productId:e,quantity:n})}function Ao(t){Se("page_view",{storeSlug:t})}function To(t,e={}){Se("begin_checkout",{storeSlug:t,metadata:e})}function Io(t,e={}){Se("payment_attempt",{storeSlug:t,metadata:e})}function No(t,e={}){Se("purchase",{storeSlug:t,metadata:e})}function vr(){const t=navigator.userAgent;return/iPhone|iPad|iPod|Android/i.test(t)||/Macintosh/.test(t)&&navigator.maxTouchPoints>1}function Cr(t,e=!0){if(!t)return{};const n={};return t.businessName&&(n.name=t.businessName),t.email&&(n.email=t.email),e&&t.phoneCode&&t.phoneNumber&&(n.phone={code:t.phoneCode,number:t.phoneNumber}),t.website&&(n.website=t.website),t.timezone&&(n.timezone=t.timezone),Object.keys(n).length?{business:n}:{}}function Oo({metaAppId:t,embeddedSignupConfigId:e,oauthEnabled:n,coexistenceEnabled:s=!0,storeId:r,companyId:o,prefill:a,completeUrl:i="/whatsapp/official-embedded-signup/complete",completeHeaders:c,onEvent:l,getAttemptId:d,onSuccess:f,onError:v,redirectStartUrl:m,awaitAttemptId:p}){const[L,k]=u.useState(!1),[P,D]=u.useState(!1),S=u.useRef({}),x=u.useRef(l);x.current=l;const A=n&&!!t&&!!e,O=!!m&&vr();u.useEffect(()=>{if(!A)return;if(O){k(!0);return}const B=h=>{var g,T,y,b,w,E,I;
1if(/^https:\/\/([a-z0-9-]+\.)*facebook\.com$/.test(h.origin))try{const C=typeof h.data=="string"?JSON.parse(h.data):h.data;if((C==null?void 0:C.type)!=="WA_EMBEDDED_SIGNUP")return;(y=x.current)==null||y.call(x,String((g=C==null?void 0:C.event)!=null?g:"unknown"),(T=C==null?void 0:C.data)!=null?T:void 0),(C==null?void 0:C.event)==="FINISH_WHATSAPP_BUSINESS_APP_ONBOARDING"&&(S.current.coexistence=!0,(b=C==null?void 0:C.data)!=null&&b.waba_id&&(S.current.waba_id=C.data.waba_id),(w=C==null?void 0:C.data)!=null&&w.phone_number_id&&(S.current.phone_number_id=C.data.phone_number_id)),C!=null&&C.data&&(S.current=X(_({},S.current),{phone_number_id:(E=C.data.phone_number_id)!=null?E:S.current.phone_number_id,waba_id:(I=C.data.waba_id)!=null?I:S.current.waba_id}))}catch(C){}};if(window.addEventListener("message",B),window.fbAsyncInit=function(){var h;(h=window.FB)==null||h.init({appId:t,autoLogAppEvents:!0,xfbml:!0,version:"v22.0"}),k(!0)},document.getElementById("facebook-jssdk"))window.FB&&k(!0);else{const h=document.createElement("script");h.id="facebook-jssdk",h.src="https://connect.facebook.net/en_US/sdk.js",h.async=!0,h.defer=!0,document.body.appendChild(h)}return()=>window.removeEventListener("message",B)},[A,t,O]);const j=u.useCallback(async B=>{var T,y,b,w;const h=(T=B==null?void 0:B.coexistence)!=null?T:s;if(O){if(!m)return;S.current={},(y=x.current)==null||y.call(x,"launched",{coexistence:h,redirect:!0}),D(!0);const E=p?await Promise.race([p(),new Promise(C=>setTimeout(()=>C(null),1500))]):(b=d==null?void 0:d())!=null?b:null,I=new URLSearchParams;h&&I.set("coexistence","1"),r&&I.set("store_id",String(r)),o&&I.set("company_id",String(o)),E&&I.set("attempt_id",String(E)),window.location.assign("".concat(m,"?").concat(I.toString()));return}if(!window.FB||!e)return;S.current={},(w=x.current)==null||w.call(x,"launched",{coexistence:h});const g=Cr(a,!h);window.FB.login(E=>{var U,F,M;const I=(U=E==null?void 0:E.authResponse)==null?void 0:U.code;if(!I){(F=x.current)==null||F.call(x,"fb_cancelled"),v==null||v("Authorization was cancelled or failed.");return}const{phone_number_id:C,waba_id:W,coexistence:R}=S.current;if(!W){v==null||v("Could not read the WhatsApp number from Meta. Please retry.");return}if(!C&&!R){v==null||v("Could not read the WhatsApp number from Meta. Please retry.");return}(M=x.current)==null||M.call(x,"session_received",{waba_id:W,phone_number_id:C,coexistence:!!R}),D(!0),G.post(i,_(_(_({code:I,phone_number_id:C!=null?C:"",waba_id:W,coexistence:!!R},r?{store_id:r}:{}),o?{company_id:o}:{}),d!=null&&d()?{attempt_id:d()}:{}),c?{headers:c}:void 0).then(N=>{var H,K,z;(H=x.current)==null||H.call(x,"completed",{coexistence:!!R}),f==null||f({coexistence:!!R,billing:(K=N.data)==null?void 0:K.billing,warnings:(z=N.data)==null?void 0:z.warnings})}).catch(N=>{var H,K,z,$,J;(z=x.current)==null||z.call(x,"failed",{error:((K=(H=N==null?void 0:N.response)==null?void 0:H.data)==null?void 0:K.error)||"Connection failed"}),v==null||v(((J=($=N==null?void 0:N.response)==null?void 0:$.data)==null?void 0:J.error)||"Connection failed")}).finally(()=>D(!1))},{config_id:e,response_type:"code",override_default_response_type:!0,extras:h?{setup:g,featureType:"whatsapp_business_app_onboarding",sessionInfoVersion:"3"}:{setup:g}})},[p,s,o,c,i,e,d,v,f,a,m,r,O]);return{sdkReady:L,busy:P,canLaunch:A,launch:j,coexistenceEnabled:s,usesRedirect:O}}function Fo({url:t,headers:e,extra:n}){const s=u.useRef(null),r=u.useRef(n);r.current=n;const o=u.useRef(null),a=u.useCallback((l,d)=>{var m;const f={event:l,payload:d!=null?d:null};if(l==="launched")s.current=null,Object.assign(f,(m=r.current)!=null?m:{});else if(s.current)f.attempt_id=s.current;else return;const v=G.post(t,f,e?{headers:e}:void 0).then(p=>{var k,P;
1const L=(P=(k=p.data)==null?void 0:k.id)!=null?P:null;return l==="launched"&&(s.current=L),L}).catch(()=>null);l==="launched"&&(o.current=v)},[t,e]),i=u.useCallback(()=>s.current,[]),c=u.useCallback(()=>{var l;return(l=o.current)!=null?l:Promise.resolve(s.current)},[]);return{onEvent:a,getAttemptId:i,awaitAttemptId:c}}function Po(t){const e=t?new Date(t).getTime():null,[n,s]=u.useState(()=>Date.now());if(u.useEffect(()=>{if(!e)return;const l=setInterval(()=>s(Date.now()),1e3);return()=>clearInterval(l)},[e]),!e)return{active:!1,hours:0,minutes:0,seconds:0,label:""};const r=e-n;if(r<=0)return{active:!1,hours:0,minutes:0,seconds:0,label:""};const o=Math.floor(r/1e3),a=Math.floor(o/3600),i=Math.floor(o%3600/60),c=o%60;return{active:!0,hours:a,minutes:i,seconds:c,label:"".concat(a,"h ").concat(i,"m")}}const pt={colors:{primary:"#4f46e5",secondary:"#f97316",accent:"#06b6d4"},store:{name:"Home Accessories",logo:"/images/logos/logo-light.png",favicon:"/storage/media/favicon.ico",description:"Quality home decor and accessories for every room",contactEmail:"[email protected]",contactPhone:"+1 234 567 8900",address:"123 Main Street, New York, NY 10001",socialLinks:{facebook:"https://facebook.com/homeaccessories",twitter:"https://twitter.com/homeaccessories",instagram:"https://instagram.com/homeaccessories",pinterest:"https://pinterest.com/homeaccessories"}},header:{showTopBar:!0,showLanguageSwitcher:!0,showCurrencySwitcher:!1,menuItems:[{name:"Home",href:"/"},{name:"Shop",href:"/shop"},{name:"Categories",href:"/categories",children:[{name:"Living Room",href:"/category/living-room"},{name:"Bedroom",href:"/category/bedroom"},{name:"Kitchen",href:"/category/kitchen"},{name:"Bathroom",href:"/category/bathroom"}]},{name:"New Arrivals",href:"/new-arrivals"},{name:"Sale",href:"/sale"},{name:"Contact",href:"/contact"}]},footer:{showNewsletter:!0,columns:[{title:"About Us",links:[{name:"Our Story",href:"/about"},{name:"Blog",href:"/blog"},{name:"Careers",href:"/careers"}]},{title:"Customer Service",links:[{name:"Contact Us",href:"/contact"},{name:"FAQs",href:"/faq"},{name:"Shipping & Returns",href:"/shipping"}]},{title:"Quick Links",links:[{name:"My Account",href:"/account"},{name:"Track Order",href:"/track-order"},{name:"Wishlist",href:"/wishlist"}]}],copyrightText:"© {year} Home Accessories. All rights reserved."},homepage:{heroSection:{title:"Transform Your Space",subtitle:"Discover our collection of beautiful home accessories to elevate your living space.",buttonText:"Shop Now",buttonLink:"/shop",image:"/storage/media/hero-image.jpg"},featuredCategories:!0,featuredProducts:!0,testimonials:!0,newsletter:!0}};function rn(t){if(!t||typeof t!="object")return!1;const e=Object.getPrototypeOf(t);return e===Object.prototype||e===null}function Ln(t,e){if(e===void 0)return t;if(Array.isArray(t)||Array.isArray(e))return e!==void 0?e:t;if(rn(t)&&rn(e)){const n=_({},t);for(const[s,r]of Object.entries(e)){const o=t[s];r!==void 0&&(n[s]=Ln(o,r))}return n}return e}const Rn=u.createContext({storeContent:pt,baseStoreContent:pt,draftStoreContent:null,setDraftStoreContent:()=>{},getLatestThemeV2:()=>null,isLoading:!1}),Mo=()=>u.useContext(Rn);function Do({children:t,initialContent:e,storeId:n}){const[s,r]=u.useState(e||pt),[o,a]=u.useState(null),[i,c]=u.useState(!e),l=u.useRef(null);u.useEffect(()=>{e&&Object.keys(e).length>0&&(r(e),c(!1))},[e]);const d=u.useMemo(()=>!o||typeof o!="object"?s:Ln(s,o),[s,o]),f=u.useCallback(m=>{m&&typeof m=="object"&&m.theme_v2!=null&&(l.current=m.theme_v2),a(m)},[]),v=u.useCallback(()=>{var m,p;return(p=(m=l.current)!=null?m:d==null?void 0:d.theme_v2)!=null?p:null},[d==null?void 0:d.theme_v2]);return u.useEffect(()=>{d!=null&&d.theme_v2&&l.current===null&&(l.current=d.theme_v2)},[d==null?void 0:d.theme_v2]),Y.jsx(Rn.Provider,{value:{storeContent:d,baseStoreContent:s,draftStoreContent:o,setDraftStoreContent:f,getLatestThemeV2:v,isLoading:i},children:t})}function jo(t){var n;const e=String((n=t==null?void 0:t.theme)!=null?n:"").trim();return e==="marble-ceramic"||e==="cleaning_services"||e==="cleaning_pro"}const mt=t=>{const e=t.trim().replace(/^["']|["']$/g,"");return e?e.startsWith("ar")?"ar":e==="en"||e.startsWith("en")?"en":null:null};function kr(){if(typeof document=="undefined")return null;const t=document.cookie||"";for(const e of["i18nextLng","store_i18nextLng"]){const n=t.match(new RegExp("(?:^|; )".concat(e,"=([^;]+)")));if(n!=null&&n[1])try{const s=decodeURIComponent(n[1].trim()),r=mt(s);if(r)return r}catch(s){const r=mt(n[1].trim());if(r)return r}}return null}function xr(){var r,o;
1if(typeof window=="undefined")return null;const e=(r=window.i18next)==null?void 0:r.language;if(e&&typeof e=="string")return e.startsWith("ar")?"ar":"en";const n=kr();if(n)return n;try{const a=(localStorage.getItem("i18nextLng")||localStorage.getItem("store_lang")||"").trim().replace(/^["']|["']$/g,""),i=mt(a);if(i)return i}catch(a){}const s=(((o=document.documentElement)==null?void 0:o.lang)||"").trim().toLowerCase();if(s.startsWith("ar"))return"ar";if(s.startsWith("en"))return"en";try{const a=new URLSearchParams(window.location.search),i=a.get("lang")||a.get("language");if(i)return String(i).toLowerCase().startsWith("ar")?"ar":"en"}catch(a){}return null}function on(){var e;const t=xr();return t||(typeof document!="undefined"&&(((e=document.documentElement)==null?void 0:e.lang)||"").trim().toLowerCase().startsWith("ar")?"ar":"en")}function Wo(t,e){if(typeof t!="string"||!t)return t;const n=typeof window!="undefined"?window.location.origin:"https://store.local";try{const s=new URL(t,n);return Object.entries(e).forEach(([r,o])=>{o==null||o===""||s.searchParams.set(r,String(o))}),"".concat(s.pathname).concat(s.search).concat(s.hash)}catch(s){return t}}function Uo(t,e={},n,s){var j,B;e=(h=>h&&typeof h=="object"&&!Array.isArray(h)?_({},h):{})(e);const o=_s(),a=o==null?void 0:o.routes,i=h=>!!(a&&typeof a=="object"&&h in a),c=h=>{try{return decodeURIComponent(h)}catch(g){return h}},l=h=>c(String(h||"")).trim().toLowerCase().replace(/[_\s]+/g,"-").replace(/-+/g,"-"),d=h=>{if(typeof h!="string"||h.trim()==="")return"";try{const T=(h.startsWith("http://")||h.startsWith("https://")?new URL(h):new URL(h,typeof window!="undefined"?window.location.origin:"https://example.com")).pathname||"",y=T.match(/\/page\/([^/?#]+)/i);if(y!=null&&y[1])return l(y[1]);const b=T.split("/").filter(Boolean);return l(b[b.length-1]||"")}catch(g){const T=h.split("?")[0].split("#")[0],y=T.match(/\/page\/([^/?#]+)/i);if(y!=null&&y[1])return l(y[1]);const b=T.split("/").filter(Boolean);return l(b[b.length-1]||"")}},f=()=>{var y,b;if(typeof window=="undefined")return{};const h=window;if((y=h.page)!=null&&y.props&&typeof h.page.props=="object")return h.page.props;if((b=h.__INITIAL_PAGE__)!=null&&b.props&&typeof h.__INITIAL_PAGE__.props=="object")return h.__INITIAL_PAGE__.props;const g=document.getElementById("app"),T=g==null?void 0:g.getAttribute("data-page");if(!T)return{};try{const w=JSON.parse(T);return w!=null&&w.props&&typeof w.props=="object"?w.props:{}}catch(w){return{}}},v=h=>{var E,I;if(typeof window=="undefined")return!1;const g=l(h);if(!g)return!1;const T=f();return(Array.isArray(T.customPages)?T.customPages:[]).some(C=>{const W=l(String((C==null?void 0:C.slug)||"")),R=d(C==null?void 0:C.href);return W===g||R===g})?!0:(Array.isArray((I=(E=T.storeContent)==null?void 0:E.theme_v2)==null?void 0:I.pages)?T.storeContent.theme_v2.pages:[]).some(C=>l(String((C==null?void 0:C.slug)||""))===g)},m=h=>{const g=l(h);return{home:"home",index:"home",products:"products",menu:"products",categories:"products",wishlist:"wishlist",cart:"cart",profile:"my-profile","my-profile":"my-profile",orders:"my-orders","my-orders":"my-orders",account:"my-profile",settings:"my-profile",contact:"contact","contact-us":"contact",about:"about","about-us":"about",catalog:"catalog",blog:"blog",news:"blog"}[g]||null},p=(h,g)=>{if(!h.endsWith(".page"))return{routeName:h,params:g};const T=typeof(g==null?void 0:g.slug)=="string"?g.slug:"";if(!T)return{routeName:h,params:g};const y=l(T);if(!new Set(["products","menu","categories"]).has(y)&&v(T))return{routeName:h,params:g};const w=m(T);if(!w)return{routeName:h,params:g};const E=h.slice(0,-4),I="".concat(E).concat(w);if(!a||i(I)){const C=_({},g);return delete C.slug,{routeName:I,params:C}}return{routeName:h,params:g}},L=h=>{if(typeof h!="string"&&typeof h!="number")return"";const g=c(String(h).trim());return!g||/^\{?storeslug\}?$/i.test(g)||g.includes("{")||g.includes("}")?"":g},k=h=>{const g={"store.otp.login":"custom.otp.login","store.otp.send":"custom.otp.send","store.otp.verify":"custom.otp.verify","store.otp.complete":"custom.otp.complete","store.auth.otp":"custom.otp.login","store.auth.otp.send":"custom.otp.send","store.auth.otp.verify":"custom.otp.verify","store.auth.otp.complete":"custom.otp.complete","store.order":"custom.order-detail","store.order-detail":"custom.order-detail"};return g[h]?g[h]:h.startsWith("store.")?h.replace(/^store\./,"custom."):null},P=/(\{storeSlug\}|%7BstoreSlug%7D)/i,D=(h,g)=>{const T=typeof(g==null?void 0:g.slug)=="string"?c(g.slug):"",y=typeof(g==null?void 0:g.orderNumber)=="string"?c(g.orderNumber):"",b={"store.home":"/","
1store.products":"/products","store.cart":"/cart","store.wishlist":"/wishlist","store.my-profile":"/my-profile","store.my-orders":"/my-orders","store.login":"/login","store.register":"/register","store.auth.otp":"/auth/otp","store.otp.login":"/auth/otp","store.otp.send":"/auth/otp/send","store.otp.verify":"/auth/otp/verify","store.otp.complete":"/auth/otp/complete","store.contact":"/contact","store.services":"/services","store.about":"/about","store.distributors":"/distributors","store.wholesale":"/wholesale","store.step_by_step":"/step-by-step","store.catalog":"/catalog","store.blog":"/blog","store.checkout":"/checkout","store.checkout.express":"/checkout/express","store.order.place":"/order/place","store.loyalty.summary":"/loyalty/summary","store.loyalty.redeem":"/loyalty/redeem","store.bookings.index":"/book","store.bookings.checkout":"/book/checkout","store.bookings.pay":"/book/checkout/pay","store.my-bookings":"/my-bookings","store.clinic.triage":"/api/clinic/triage","store.clinic.pulse":"/api/clinic/pulse","store.clinic.next-slots":"/api/clinic/next-slots"},w=typeof(g==null?void 0:g.service)=="string"?c(g.service):"";return h==="store.bookings.availability"&&w?"/book/availability/".concat(encodeURIComponent(w)):(h==="store.bookings.show"||h==="store.bookings.book")&&w?"/book/".concat(encodeURIComponent(w)):h==="store.my-bookings.show"&&(g!=null&&g.booking)?"/my-bookings/".concat(g.booking):h==="store.my-bookings.cancel"&&(g!=null&&g.booking)?"/my-bookings/".concat(g.booking,"/cancel"):h==="store.page"&&T?"/page/".concat(encodeURIComponent(T)):h==="store.blog.show"&&T?"/blog/post/".concat(encodeURIComponent(T)):(h==="store.order"||h==="store.order-detail")&&y?"/order/".concat(encodeURIComponent(y)):b[h]||"/"},S=(h,g)=>{const T=typeof(g==null?void 0:g.slug)=="string"?c(g.slug):"",y=typeof(g==null?void 0:g.orderNumber)=="string"?c(g.orderNumber):"",b={"custom.home":"/","custom.products":"/products","custom.cart":"/cart","custom.wishlist":"/wishlist","custom.my-profile":"/my-profile","custom.my-orders":"/my-orders","custom.login":"/login","custom.register":"/register","custom.otp.login":"/auth/otp","custom.otp.send":"/auth/otp/send","custom.otp.verify":"/auth/otp/verify","custom.otp.complete":"/auth/otp/complete","custom.contact":"/contact","custom.about":"/about","custom.catalog":"/catalog","custom.blog":"/blog","custom.checkout":"/checkout","custom.checkout.express":"/checkout/express","custom.order.place":"/order/place","custom.loyalty.summary":"/loyalty/summary","custom.loyalty.redeem":"/loyalty/redeem","custom.bookings.index":"/book","custom.bookings.checkout":"/book/checkout","custom.bookings.pay":"/book/checkout/pay","custom.my-bookings":"/my-bookings"},w=typeof(g==null?void 0:g.service)=="string"?c(g.service):"";return h==="custom.bookings.availability"&&w?"/book/availability/".concat(encodeURIComponent(w)):(h==="custom.bookings.show"||h==="custom.bookings.book")&&w?"/book/".concat(encodeURIComponent(w)):h==="custom.my-bookings.show"&&(g!=null&&g.booking)?"/my-bookings/".concat(g.booking):h==="custom.my-bookings.cancel"&&(g!=null&&g.booking)?"/my-bookings/".concat(g.booking,"/cancel"):h==="custom.page"&&T?"/page/".concat(encodeURIComponent(T)):h==="custom.blog.show"&&T?"/blog/post/".concat(encodeURIComponent(T)):h==="custom.order-detail"&&y?"/order/".concat(encodeURIComponent(y)):b[h]||"/"},x=(h,g)=>{var E,I;const T=D(h,g),y=f(),b=L(g==null?void 0:g.storeSlug)||L(s)||L(n==null?void 0:n.slug)||L((E=y==null?void 0:y.store)==null?void 0:E.slug)||L(y==null?void 0:y.storeSlug)||L((I=y==null?void 0:y.resolved_store)==null?void 0:I.slug);if(!b)return T;const w=encodeURIComponent(b);return T==="/"?"/store/".concat(w):"/store/".concat(w).concat(T)},A={"store.otp.login":"store.auth.otp","store.otp.send":"store.auth.otp.send","store.otp.verify":"store.auth.otp.verify","store.otp.complete":"store.auth.otp.complete","store.order-detail":"store.order","store.product.show":"store.product"},O=typeof window!="undefined"?window.location.pathname:"";{const h=p(t,e||{});t=h.routeName,e=h.params}if(A[t]){const h=A[t];i(h)&&(t=h)}if(t.startsWith("custom.")){const h=t.replace(/^custom\./,"store.");
1i(h)&&(t=h)}if(t.startsWith("store.")&&a&&!i(t)){const h=k(t);if(h&&i(h)){t=h;const g=_({},e);delete g.storeSlug,e=g}}if(t.startsWith("store.")){const h=f();let g=L(e.storeSlug)||L(s)||L(n==null?void 0:n.slug)||L((j=h==null?void 0:h.store)==null?void 0:j.slug)||L(h==null?void 0:h.storeSlug)||L((B=h==null?void 0:h.resolved_store)==null?void 0:B.slug);if(!g&&typeof window!="undefined"&&O.startsWith("/store/")){const T=O.split("/").filter(Boolean);T[0]==="store"&&T[1]&&(g=L(T[1]))}if(g)e=X(_({},e),{storeSlug:g});else{const T=k(t);if(T&&i(T)){t=T;const y=_({},e);delete y.storeSlug,e=y}}}try{const h=Vn(t,e,!1);let g=typeof h=="string"?h:String(h);t.startsWith("store.")&&P.test(g)&&(g=x(t,e));const T=typeof window!="undefined"?on():null;if(T&&!g.startsWith("tel:")&&!g.startsWith("mailto:")&&!g.includes("?lang=")&&!g.includes("&lang=")){const y=g.includes("?")?"&":"?";g="".concat(g).concat(y,"lang=").concat(T)}return g}catch(h){let g="/";t.startsWith("store.")?g=x(t,e):t.startsWith("custom.")&&(g=S(t,e));const T=typeof window!="undefined"?on():null;if(T&&!g.includes("?lang=")&&!g.includes("&lang=")){const y=g.includes("?")?"&":"?";g="".concat(g).concat(y,"lang=").concat(T)}return g}}const $n=u.createContext(void 0),Bo=({children:t,storeId:e,isLoggedIn:n,disableApiSync:s=!1})=>{var K,z;const{props:r}=ae(),o=r.cartItems||[],a=r.cartCount||o.length||0,i=r.cartSummary||{subtotal:0,discount:0,shipping:0,tax:0,total:0},[c,l]=u.useState(o),[d,f]=u.useState(a),[v,m]=u.useState(i.total||0),[p,L]=u.useState(i),[k,P]=u.useState(!1),[D,S]=u.useState(null),x=u.useRef(!1),A=String((r==null?void 0:r.theme)||"").toLowerCase(),O=((K=r==null?void 0:r.storeContent)==null?void 0:K.theme_v2)||{},j=String((O==null?void 0:O.site_type)||"").toLowerCase(),B=Array.isArray((z=O==null?void 0:O.sections)==null?void 0:z.home)?O.sections.home:[],h=B.some($=>["categories","featured_products","trending_products","delivery_features"].includes(String(($==null?void 0:$.type)||""))),g=B.some($=>["services","contact_form","how_it_works","gallery","design_story","beauty_about","text_block","image_text"].includes(String(($==null?void 0:$.type)||""))),T=A==="contracting"||(j!==""?j!=="store":g&&!h),y=typeof window!="undefined"&&new URLSearchParams(window.location.search).has("builder_preview"),b=s||y||T,w=()=>{try{const $=localStorage.getItem("cart_".concat(e));return $?JSON.parse($):[]}catch($){return[]}},E=()=>{S(null)},I=$=>{const J=Number($);return Number.isFinite(J)?J:0},C=$=>{if(!$||typeof $!="object")return"";const J=[$.image,$.thumbnail,$.cover_image,$.featured_image];for(const q of J)if(typeof q=="string"&&q.trim())return q.trim();if(Array.isArray($.images)&&$.images.length>0){const q=$.images[0];if(typeof q=="string"&&q.trim())return q.trim();if(q&&typeof q=="object"){const Z=[q.url,q.path,q.image];for(const te of Z)if(typeof te=="string"&&te.trim())return te.trim()}}return""},W=($,J)=>{var q;return{productId:Number(($==null?void 0:$.id)||0),name:String(($==null?void 0:$.name)||($==null?void 0:$.title)||""),price:I((q=$==null?void 0:$.sale_price)!=null?q:$==null?void 0:$.price),image:C($),quantity:J}},R=async()=>{if(b){l([]),f(0),m(0),L({subtotal:0,discount:0,shipping:0,tax:0,total:0}),S(null);return}try{const $=localStorage.getItem("store_lang")||localStorage.getItem("i18nextLng")||"en",J=$==="ar"||$.startsWith("ar")?"ar":"en",q=await G.get(route("api.cart.index"),{params:{store_id:e,lang:J}}),Z=q.data.items||[],te=q.data.count||Z.length||0;l(Z),f(te),m(q.data.total||0),L({subtotal:q.data.subtotal||0,discount:q.data.discount||0,shipping:q.data.shipping||0,tax:q.data.tax||0,total:q.data.total||0}),setTimeout(()=>{f(te)},0)}catch($){l([]),f(0),m(0)}},U=async($,J,q=1)=>{if(!n){window.dispatchEvent(new CustomEvent("store:open-login-sheet",{detail:{}}));return}const Z=W($,q);if(b){S(Z);return}P(!0);try{await G.post(route("api.cart.add"),{store_id:e,product_id:$.id,quantity:q,variants:J}),S(Z),await R()}catch(te){}finally{P(!1)}},F=async($,J)=>{var q,Z;if(!b){P(!0);try{await G.put(route("api.cart.update",{id:$}),{quantity:parseInt(String(J),10),store_id:parseInt(String(e),10)}),await R()}catch(te){throw console.error("Error updating cart quantity:",te),(Z=(q=te.response)==null?void 0:q.data)!=null&&Z.message?new Error(te.response.data.message):te}finally{P(!1)}}},M=async $=>{if(!b){P(!0);try{await G.delete(route("api.cart.remove",{id:$}),{params:{store_id:e}}),await R()}catch(J){}finally{P(!1)}}},N=async()=>{try{localStorage.removeItem("cart_".concat(e))}catch($){}if(l([]),f(0),m(0),L({subtotal:0,discount:0,shipping:0,tax:0,total:0}),S(null),!b)try{await G.post(route("api.cart.clear"),{store_id:e})}catch($){}},H=async()=>
1{if(!n||b)return;const $=w();if($.length!==0)try{await G.post(route("api.cart.sync"),{store_id:e,items:$.map(J=>({product_id:J.product_id,quantity:J.quantity,variants:J.variants}))}),localStorage.removeItem("cart_".concat(e)),await R()}catch(J){}};return u.useEffect(()=>{if(b){x.current=!0,l([]),f(0),m(0),L({subtotal:0,discount:0,shipping:0,tax:0,total:0}),S(null);return}const $=()=>{x.current||(x.current=!0,R(),n&&H())};x.current=!1,"requestIdleCallback"in window?requestIdleCallback($,{timeout:2e3}):setTimeout($,500)},[e,n,b]),Y.jsx($n.Provider,{value:{items:c,count:d,total:v,summary:p,loading:k,lastAddedItem:D,addToCart:U,updateQuantity:F,removeItem:M,syncCart:H,refreshCart:R,clearCart:N,clearLastAdded:E},children:t})};function Vo(){const t=u.useContext($n);return t||{items:[],count:0,total:0,summary:{subtotal:0,discount:0,shipping:0,tax:0,total:0},loading:!1,lastAddedItem:null,addToCart:async()=>{},updateQuantity:async()=>{},removeItem:async()=>{},syncCart:async()=>{},refreshCart:async()=>{},clearCart:async()=>{},clearLastAdded:()=>{}}}const En=u.createContext(void 0),an="selected_branch",_r=t=>"selected_branch_".concat(t),ct=t=>"selected_branch_".concat(t),cn=(t,e)=>{typeof document!="undefined"&&(document.cookie="".concat(_r(t),"=; path=/; max-age=0"),e===null?document.cookie="".concat(an,"=; path=/; max-age=0"):document.cookie="".concat(an,"=").concat(t,":").concat(e,"; path=/; max-age=31536000; samesite=lax"))},Ho=({children:t,storeId:e,branchMode:n="off",branches:s=[],selectedBranchId:r=null})=>{const o=u.useMemo(()=>new Set((s||[]).map(k=>Number(k.id))),[s]),a=()=>{if(r&&o.has(Number(r)))return Number(r);if(typeof window!="undefined"){const k=Number(localStorage.getItem(ct(e))||"");if(k&&o.has(k))return k}return n==="branch_first"&&s.length===1?Number(s[0].id):null},[i,c]=u.useState(a),[l,d]=u.useState(0),f=lt.useCallback(()=>(d(k=>k+1),()=>d(k=>Math.max(0,k-1))),[]);u.useEffect(()=>{if(n!=="branch_first"){delete G.defaults.headers.common["X-Branch-Id"];return}if(i){G.defaults.headers.common["X-Branch-Id"]=String(i);try{localStorage.setItem(ct(e),String(i))}catch(k){}cn(e,i)}else delete G.defaults.headers.common["X-Branch-Id"]},[i,n,e]);const v=k=>{o.has(Number(k))&&c(Number(k))},m=()=>{c(null);try{localStorage.removeItem(ct(e))}catch(k){}cn(e,null),delete G.defaults.headers.common["X-Branch-Id"]},p=u.useMemo(()=>i&&(s||[]).find(k=>Number(k.id)===Number(i))||null,[i,s]),L={branchMode:n,branches:s||[],selectedBranchId:i,selectedBranch:p,needsSelection:n==="branch_first"&&(s||[]).length>0&&!i,setBranch:v,clearBranch:m,hasHeaderButton:l>0,registerHeaderButton:f};return Y.jsx(En.Provider,{value:L,children:t})};function Ko(){const t=u.useContext(En);return t||{branchMode:"off",branches:[],selectedBranchId:null,selectedBranch:null,needsSelection:!1,setBranch:()=>{},clearBranch:()=>{},hasHeaderButton:!1,registerHeaderButton:()=>()=>{}}}const An=u.createContext(void 0),zo=()=>{const t=u.useContext(An);if(!t)throw new Error("useWishlist must be used within a WishlistProvider");return t},qo=({children:t,disableApiSync:e=!1})=>{var I,C,W,R,U;const{props:n}=ae(),s=n.wishlistItems||[],r=(C=(I=typeof n.wishlistCount=="number"?n.wishlistCount:null)!=null?I:s.length)!=null?C:0,[o,a]=u.useState(s),[i,c]=u.useState(r),[l,d]=u.useState(!1),f=u.useRef(!1),v=u.useRef(0),m=3e4,p=(W=n.store)==null?void 0:W.id,L=String((n==null?void 0:n.theme)||"").toLowerCase(),k=L==="coffee",P=((R=n==null?void 0:n.storeContent)==null?void 0:R.theme_v2)||{},D=String((P==null?void 0:P.site_type)||"").toLowerCase(),S=Array.isArray((U=P==null?void 0:P.sections)==null?void 0:U.home)?P.sections.home:[],x=S.some(F=>["categories","featured_products","trending_products","delivery_features"].includes(String((F==null?void 0:F.type)||""))),A=S.some(F=>["services","contact_form","how_it_works","gallery","design_story","beauty_about","text_block","image_text"].includes(String((F==null?void 0:F.type)||""))),O=L==="contracting"||(D!==""?D!=="store":A&&!x),j=typeof window!="undefined"&&new URLSearchParams(window.location.search).has("builder_preview"),B=e||j||O,h=p?"wishlist_503_cooldown_until_".concat(p):"",g=async()=>
1{if(!p||B){a([]);return}const F=typeof window!="undefined"&&h?Number(sessionStorage.getItem(h)||0):0,M=Math.max(v.current,F);if(!(Date.now()<M))try{d(!0);const N=localStorage.getItem("store_lang")||localStorage.getItem("i18nextLng")||"en",H=N==="ar"||N.startsWith("ar")?"ar":"en",K=await fetch(route("api.wishlist.index")+"?store_id=".concat(p,"&lang=").concat(H));if(!K.ok){if(K.status===503){const $=Date.now()+m;v.current=$,typeof window!="undefined"&&h&&sessionStorage.setItem(h,String($))}console.error("Wishlist API error:",K.status,K.statusText);return}v.current=0,typeof window!="undefined"&&h&&sessionStorage.removeItem(h);const z=await K.json();z&&Array.isArray(z.items)?a(z.items):(console.error("Invalid wishlist data format:",z),a([]))}catch(N){console.error("Error fetching wishlist:",N)}finally{d(!1)}};u.useEffect(()=>{if(B){f.current=!0,a([]);return}if(k){f.current=!0;return}if(f.current=!1,s.length>0&&!f.current){f.current=!0;const F=()=>{g()};"requestIdleCallback"in window?requestIdleCallback(F,{timeout:3e3}):setTimeout(F,1e3)}else f.current||(f.current=!0,"requestIdleCallback"in window?requestIdleCallback(()=>g(),{timeout:2e3}):setTimeout(()=>g(),800))},[p,B,k]),u.useEffect(()=>{c(o.length)},[o]);const E={items:o,count:i,isInWishlist:F=>o.some(M=>M.product_id===F),addToWishlist:async F=>{var M;if(!(!p||B)){d(!0);try{(await fetch(route("api.wishlist.add"),{method:"POST",headers:{"Content-Type":"application/json","X-CSRF-TOKEN":((M=document.querySelector('meta[name="csrf-token"]'))==null?void 0:M.getAttribute("content"))||""},body:JSON.stringify({store_id:p,product_id:F})})).ok&&await g()}catch(N){console.error("Error adding to wishlist:",N)}finally{d(!1)}}},removeFromWishlist:async F=>{var N;if(!p||B)return;const M=o.find(H=>H.product_id===F);if(M){d(!0);try{(await fetch(route("api.wishlist.remove",{id:M.id})+"?store_id=".concat(p),{method:"DELETE",headers:{"X-CSRF-TOKEN":((N=document.querySelector('meta[name="csrf-token"]'))==null?void 0:N.getAttribute("content"))||""}})).ok&&await g()}catch(H){console.error("Error removing from wishlist:",H)}finally{d(!1)}}},toggleWishlist:async F=>{var M;if(!(!p||B)){d(!0);try{(await fetch(route("api.wishlist.toggle"),{method:"POST",headers:{"Content-Type":"application/json","X-CSRF-TOKEN":((M=document.querySelector('meta[name="csrf-token"]'))==null?void 0:M.getAttribute("content"))||""},body:JSON.stringify({store_id:p,product_id:F})})).ok&&await g()}catch(N){console.error("Error toggling wishlist:",N)}finally{d(!1)}}},loading:l};return Y.jsx(An.Provider,{value:E,children:t})};function Jo(){var n;const{props:t}=ae(),e=(n=t.store)==null?void 0:n.favicon;return u.useEffect(()=>{var i;if(!e||typeof e!="string"||e.trim()==="")return;const s=t.base_url||((i=t.globalSettings)==null?void 0:i.base_url)||window.location.origin;let r=e.startsWith("http")?e:e.startsWith("/storage/")||e.startsWith("/")?"".concat(s).concat(e):e;const o=r.includes("?")?"&":"?";r+="".concat(o,"t=").concat(Date.now());const a=setTimeout(()=>{document.querySelectorAll('link[rel*="icon"]').forEach(f=>f.remove());const l=document.createElement("link");l.rel="icon",l.type="image/x-icon",l.href=r,document.head.appendChild(l);const d=document.createElement("link");d.rel="shortcut icon",d.href=r,document.head.appendChild(d),setTimeout(()=>{d.parentNode&&d.parentNode.removeChild(d)},50)},100);return()=>clearTimeout(a)},[e]),e}function Yo(t,e){const n=u.useRef();u.useEffect(()=>{n.current=t},[t]),u.useEffect(()=>{function s(){var r;(r=n.current)==null||r.call(n)}if(e!==null){const r=setInterval(s,e);return()=>clearInterval(r)}},[e])}function Xo(t){const[e,n]=u.useState(null),s=u.useRef(null),r=u.useCallback(()=>{if(!t){n(null);return}G.get("/whatsapp/api/instances/".concat(t,"/service-allowance")).then(a=>{var i,c;n((i=a.data)!=null&&i.success&&(c=a.data.data)!=null?c:null)}).catch(()=>n(null))},[t]),o=u.useCallback((a=5e3)=>{s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{s.current=null,r()},a)},[r]);return u.useEffect(()=>(r(),()=>{s.current&&clearTimeout(s.current)}),[r]),{data:e,refresh:r,scheduleRefresh:o}}function Go(){return u.useCallback(e=>{const n=e.trim().split(" ");if(n.length===0)return"";if(n.length===1)return n[0].charAt(0).toUpperCase();const s=n[0].charAt(0),r=n[n.length-1].charAt(0);return"".concat(s).concat(r).toUpperCase()},[])}const Zo={status:(t={},e="bg-gray-100 text-gray-800")=>n=>{if(n==null)return Y.jsx("span",{children:"-"});if(typeof n=="boolean")return Y.jsx(Lt,{className:Rt("capitalize",n?"bg-green-100 text-green-800":"bg-red-100 text-red-800"),children:n?"Active":"Inactive"});const s=t[n]||e;return Y.jsx(Lt,{className:Rt("capitalize",s),children:n})},image:(t="h-16 w-20 rounded-md object-cover shadow-sm",e="https://placehold.co/200x150?text=Image+Not+Found")=>(n,s)=>{if(!n)return Y.jsx("div",{className:"text-center text-gray-400",children:"No image"});const r=typeof n=="string"&&n.startsWith("http")?n:"/storage/".concat(n);return Y.jsx("div",{className:"flex justify-center",children:Y.jsx("img",{src:r,alt:"Image",className:t,onError:o=>{o.currentTarget.src=e}})})},price:(t="USD",e="en-US")=>n=>{if(n==null)return Y.jsx("span",{children:"-"});const s=typeof n=="string"?parseFloat(n):n;return Y.jsx("span",{className:"text-sm font-medium",children:s.toLocaleStr
1ing(e,{style:"currency",currency:t})})},date:(t=!1)=>e=>{if(!e)return Y.jsx("span",{children:"-"});try{if(typeof window!="undefined"&&window.appSettings){const r=window.appSettings.formatDateTime(e,!1);return Y.jsx("span",{className:"text-sm",children:r})}const n=new Date(e),s=t?{dateStyle:"medium",timeStyle:"short"}:{dateStyle:"medium"};return Y.jsx("span",{className:"text-sm",children:n.toLocaleDateString("en-US",s)})}catch(n){return Y.jsx("span",{className:"text-sm",children:e})}},boolean:()=>t=>Y.jsx("span",{children:t?"Yes":"No"}),relation:t=>(e,n)=>n?n&&n[t]?Y.jsx("span",{children:n[t]}):Y.jsx("span",{children:"-"}):Y.jsx("span",{children:"-"}),link:(t,e="text-blue-600 hover:underline",n=!1)=>(s,r)=>{if(!s)return Y.jsx("span",{children:"-"});const o=typeof t=="function"?t(r):t.replace(":id",r.id);return Y.jsx($t,{href:o,className:e,target:n?"_blank":void 0,children:s})},button:(t,e,n="px-2 py-1 text-xs bg-blue-500 text-white rounded hover:bg-blue-600",s=!1)=>(r,o)=>{const a=typeof e=="function"?e(o):e.replace(":id",o.id);return Y.jsx($t,{href:a,className:n,target:s?"_blank":void 0,children:t})},switch:(t,e=!1)=>(n,s)=>{const r=()=>{!e&&t&&t(s.id,!n)};return lt.createElement("div",{className:"flex items-center justify-center"},[lt.createElement(Bn,{key:"switch",checked:!!n,onCheckedChange:r,disabled:e})])}},Qo=(t,e)=>ee.isInitialized?ee.t(t,e):typeof t=="string"?t:String(t);function Lr(){var e,n;const{auth:t}=ae().props;return{permissions:(t==null?void 0:t.permissions)||[],roles:(t==null?void 0:t.roles)||[],isSuperAdmin:((e=t==null?void 0:t.user)==null?void 0:e.type)==="superadmin"||((n=t==null?void 0:t.user)==null?void 0:n.type)==="super admin"}}const Rr=(t,e)=>t.isSuperAdmin||t.permissions.includes(e);function ei(t){return Rr(Lr(),t)}function ti(){const{appearance:t,themeColor:e}=mn(),{position:n}=Jn(),{variant:s,collapsible:r,style:o}=Xn(),[a,i]=u.useState({appearance:t,themeColor:e,position:n,variant:s,collapsible:r,style:o});return u.useEffect(()=>{const c=setTimeout(()=>{i({appearance:t,themeColor:e,position:n,variant:s,collapsible:r,style:o})},300);return()=>clearTimeout(c)},[t,e,n,s,r,o]),a}function ni(){const{logoLight:t,logoDark:e,favicon:n,updateBrandSettings:s}=Je();return{logoLight:t,logoDark:e,favicon:n,updateLogos:o=>{s(o)}}}const $r={draft:"Draft",under_review:"Under Review",approved:"Approved",signed:"Signed",in_manufacturing:"In Manufacturing",ready_for_delivery:"Ready for Delivery",delivering:"Delivering",closed:"Closed",cancelled:"Cancelled"};function si(t,e){const n=$r[t];return n?e(n):t||"—"}function ri(t){switch(t){case"cancelled":return"destructive";case"draft":return"outline";case"under_review":case"in_manufacturing":case"delivering":return"secondary";default:return"default"}}function Er(t,e,n=new Date().getFullYear()){return t&&t.trim().length>0?t.replace("{year}",n.toString()).replace("{store_name}",e):"© ".concat(n," ").concat(e,". All rights reserved.")}function oi(t,e,n="Store",s){const{i18n:r}=be(),o=new Date().getFullYear(),a=je(t==null?void 0:t.copyright_text,r)||s||null,i=je(e,r),c=je(n,r)||"Store",l=i!=null&&i.trim()?i:c;return Er(a,l,o)}function ii(t=.1){const[e,n]=u.useState(!1),s=u.useRef(null);return u.useEffect(()=>{const r=new IntersectionObserver(([o])=>{o.isIntersecting&&(n(!0),r.unobserve(o.target))},{threshold:t});return s.current&&r.observe(s.current),()=>r.disconnect()},[t]),{ref:s,isVisible:e}}const Ar={"baby-kids":"colore"},ai=t=>t&&(Ar[t]||t),Tr='\n<svg xmlns="http://www.w3.org/2000/svg" width="600" height="600" viewBox="0 0 600 600">\n  <rect width="600" height="600" rx="48" fill="#F3F4F6"/>\n  <g fill="none" stroke="#9CA3AF" stroke-width="18" stroke-linecap="round" stroke-linejoin="round">\n    <rect x="160" y="190" width="280" height="220" rx="24"/>\n    <circle cx="240" cy="265" r="22"/>\n    <path d="M190 360l70-70 70 70 50-50 80 80"/>\n  </g>\n</svg>\n'.trim();function ci(){return"data:image/svg+xml;charset=utf-8,".concat(encodeURIComponent(Tr))}function li(t,e){if(e!=="baby-kids"&&e!=="colore")return String(t!=null?t:"").trim();const n=String(t!=null?t:"").replace(/\s+/g," ").trim();
1return!n||/^تشكيلات\s*2026$/i.test(n)||/^collections\s*2026$/i.test(n)?"":n}function ui(t,e){var n,s,r;return!!((r=(s=(n=t==null?void 0:t.disableInventoryManagement)!=null?n:e==null?void 0:e.disable_inventory_management)!=null?s:e==null?void 0:e.disableInventoryManagement)!=null&&r)}function fi(t,e){var n;return t!=null&&t.is_active?e?!0:Number((n=t==null?void 0:t.stock)!=null?n:0)>0:!1}function Tn(t){return t.replace(/_/g," ").replace(/\+/g," + ").replace(/\b\w/g,e=>e.toUpperCase()).replace(/\s+/g," ").trim()}function di(t,e){if(t==="ar")return e.t("theme_field.ar",{defaultValue:"Arabic"});if(t==="en")return e.t("theme_field.en",{defaultValue:"English"});const n=Tn(t);return e.t("theme_field.".concat(t),{defaultValue:n})}function hi(t,e){const n=Tn(t);return e.t("theme_section.".concat(t),{defaultValue:n})}export{or as $,Mo as A,Ws as B,si as C,ri as D,wo as E,Yo as F,pt as G,oi as H,ai as I,ho as J,Bo as K,Vo as L,ci as M,zo as N,Jo as O,ui as P,fi as Q,Eo as R,Do as S,Gn as T,hr as U,Ko as V,qo as W,To as X,fo as Y,Io as Z,No as _,Yr as a,$o as a0,xo as a1,Qr as a2,Is as a3,so as a4,ie as a5,Go as a6,Qo as a7,Zo as a8,Se as a9,Ur as aA,qr as aB,Dr as aC,jr as aD,Mr as aE,Pr as aF,Ns as aG,Xo as aH,Gr as aI,he as aJ,Xr as aK,ro as aL,io as aM,oo as aN,ao as aO,jo as aP,Wo as aQ,Ao as aR,Ho as aS,ti as aa,ni as ab,At as ac,Jn as ad,Xn as ae,hi as af,di as ag,ko as ah,Co as ai,Po as aj,go as ak,So as al,vo as am,yo as an,ii as ao,Hr as ap,lo as aq,uo as ar,li as as,nr as at,_s as au,zr as av,Kr as aw,Wr as ax,Vr as ay,Br as az,mo as b,bo as c,_o as d,Lo as e,sr as f,Ro as g,Jr as h,ee as i,je as j,Zr as k,Fo as l,Oo as m,no as n,Uo as o,on as p,to as q,Je as r,co as s,Le as t,po as u,mn as v,ir as w,eo as x,Us as y,ei as z};

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.