PluginProbe
WCPOS – Point of Sale (POS) plugin for WooCommerce / 1.10.17
WCPOS – Point of Sale (POS) plugin for WooCommerce v1.10.17
1.10.18 1.10.17 1.10.16 1.10.15 1.10.13 1.10.14 1.10.12 1.10.11 1.10.10 1.10.9 1.10.8 untagged-3d9b7ccddc54df87c672 1.10.7 1.10.6 1.10.5 1.10.3 1.10.4 1.10.2 1.10.1 1.10.0 1.9.17 1.9.15 1.9.16 1.9.14 1.9.13 All 162 releases
woocommerce-pos / assets / js / settings.js

settings.js in WCPOS – Point of Sale (POS) plugin for WooCommerce 1.10.17, at assets/js/settings.js

7 lines 409.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 (function(e,t,n,r,i,a){var o=Object.create,s=Object.defineProperty,c=Object.getOwnPropertyDescriptor,l=Object.getOwnPropertyNames,u=Object.getPrototypeOf,d=Object.prototype.hasOwnProperty,f=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),p=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=l(t),a=0,o=i.length,u;a<o;a++)u=i[a],!d.call(e,u)&&u!==n&&s(e,u,{get:(e=>t[e]).bind(null,u),enumerable:!(r=c(t,u))||r.enumerable});return e},m=(e,t,n)=>(n=e==null?{}:o(u(e)),p(t||!e||!e.__esModule||!d.call(e,`default`)?s(n,`default`,{value:e,enumerable:!0}):n,e));let h=m(e,1);e=m(e),n=m(n),i=m(i);var g=f((e=>{var t=globalThis.React,n=Symbol.for(`react.element`),r=Symbol.for(`react.fragment`),i=Object.prototype.hasOwnProperty,a=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function s(e,t,r){var s,c={},l=null,u=null;for(s in r!==void 0&&(l=``+r),t.key!==void 0&&(l=``+t.key),t.ref!==void 0&&(u=t.ref),t)i.call(t,s)&&!o.hasOwnProperty(s)&&(c[s]=t[s]);if(e&&e.defaultProps)for(s in t=e.defaultProps,t)c[s]===void 0&&(c[s]=t[s]);return{$$typeof:n,type:e,key:l,ref:u,props:c,_owner:a.current}}e.Fragment=r,e.jsx=s,e.jsxs=s})),_=f(((e,t)=>{t.exports=g()}))(),v=h.createContext(void 0),y=e=>{let t=h.useContext(v);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},b=({client:e,children:t})=>(h.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,_.jsx)(v.Provider,{value:e,children:t})),x={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},S=new class{#e=x;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function C(e){setTimeout(e,0)}var w=typeof window>`u`||`Deno`in globalThis;function T(){}function E(e,t){return typeof e==`function`?e(t):e}function D(e){return typeof e==`number`&&e>=0&&e!==1/0}function O(e,t){return Math.max(e+(t||0)-Date.now(),0)}function k(e,t){return typeof e==`function`?e(t):e}function A(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==M(o,t.options))return!1}else if(!P(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function j(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(N(t.options.mutationKey)!==N(a))return!1}else if(!P(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function M(e,t){return(t?.queryKeyHashFn||N)(e)}function N(e){return JSON.stringify(e,(e,t)=>L(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function P(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(Array.isArray(e)&&Array.isArray(t)){for(let n=0;n<t.length;n++)if(!P(e[n],t[n]))return!1;return!0}let n=Object.keys(t);for(let r of n)if(!P(e[r],t[r]))return!1;return!0}return!1}var F=Object.prototype.hasOwnProperty;function ee(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=te(e)&&te(t);if(!r&&!(L(e)&&L(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:F.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=ee(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function I(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function te(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function L(e){if(!R(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!R(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function R(e){return Object.prototype.toString.call(e)===`[object Object]`}function ne(e){return new Promise(t=>{S.setTimeout(t,e)})}function re(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:ee(e,t)}function ie(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function ae(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var oe=Symbol();function se(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===oe?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function ce(e,t){return typeof e==`function`?e(...t):!!e}function le(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var ue=()=>w,de=()=>ue(),fe=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},pe=new class extends fe{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},me=C;function he(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=me,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var z=he(),ge=new class extends fe{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function _e(e){return Math.min(1e3*2**e,3e4)}function ve(e){return(e??`online`)!==`online`||ge.isOnline()}var ye=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function be(e){let t=!1,n=0,r,i=`pending`,a,o,s=new Promise((e,t)=>{a=e,o=t});s.catch(T);let c=()=>i!==`pending`,l=t=>{if(!c()){let n=new ye(t);h(n),e.onCancel?.(n)}},u=()=>{t=!0},d=()=>{t=!1},f=()=>pe.isFocused()&&(e.networkMode===`always`||ge.isOnline())&&e.canRun(),p=()=>ve(e.networkMode)&&e.canRun(),m=e=>{c()||(r?.(),i=`resolved`,a(e))},h=e=>{c()||(r?.(),i=`rejected`,o(e))},g=()=>new Promise(t=>{r=e=>{(c()||f())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,c()||e.onContinue?.()}),_=()=>{if(c())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(m).catch(r=>{if(c())return;let i=e.retry??(de()?0:3),a=e.retryDelay??_e,o=typeof a==`function`?a(n,r):a,s=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!s){h(r);return}n++,e.onFail?.(n,r),ne(o).then(()=>f()?void 0:g()).then(()=>{t?h(r):_()})})};return{promise:s,status:()=>i,cancel:l,continue:()=>(r?.(),s),cancelRetry:u,continueRetry:d,canStart:p,start:()=>(p()?_():g().then(_),s)}}var xe=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),D(this.gcTime)&&(this.#e=S.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(de()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(S.clearTimeout(this.#e),this.#e=void 0)}};function Se(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{le(e,()=>t.signal,()=>n=!0)},u=se(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?ae:ie;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?we:Ce,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:Ce(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.fetchFn=t.options.persister?()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):l}}}function Ce(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function we(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var Te=class extends xe{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=Oe(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=Oe(this.options);e.data!==void 0&&(this.setState(De(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=re(this.state.data,e,this.options);return this.#c({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#c({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(T).catch(T):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>k(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===oe||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>k(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!O(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){let t=this.observers.indexOf(e);t!==-1&&(this.observers.splice(t,1),this.observers.length||(this.#a&&(this.#s||this.state.fetchStatus===`paused`&&this.state.status===`pending`?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#c({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=se(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?Se(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:`fetch`,meta:a.fetchOptions?.meta});let o=this.#a=be({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof ye&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#c({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#c({type:`pause`})},onContinue:()=>{this.#c({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await o.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof ye){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#c({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.#a===o&&(this.#a=void 0),this.scheduleGc()}}#c(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...Ee(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...De(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),z.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function Ee(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:ve(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function De(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Oe(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var ke=class extends fe{#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p=new Set;constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),je(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Me(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Me(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof k(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!I(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Ne(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||k(this.options.enabled,this.#t)!==k(t.enabled,this.#t)||k(this.options.staleTime,this.#t)!==k(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||k(this.options.enabled,this.#t)!==k(t.enabled,this.#t)||i!==this.#f)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return I(this.getCurrentResult(),n)||(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),Reflect.get(e,n))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t),r=()=>{},i,a=new Promise(e=>{i=e,r=this.#e.getQueryCache().subscribe(i=>{i.type===`updated`&&i.query.queryHash===n.queryHash&&n.state.data!==void 0&&(r(),e(this.createResult(n,t)))})});return Promise.race([n.fetch().then(()=>{let e=this.createResult(n,t);return i?.(e),e}).finally(()=>{r()}),a])}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#m(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(T)),t}#h(e){return!de()&&k(this.options.enabled,this.#t)!==!1&&D(e)}#g(){this.#b();let e=k(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=O(this.#r.dataUpdatedAt,e)+1;this.#u=S.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#f=e,this.#f!==0&&this.#h(this.#f)&&(this.#d=S.setInterval(()=>{(this.options.refetchIntervalInBackground||pe.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(S.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(S.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&je(e,t),o=i&&Ne(e,n,t,r);(a||o)&&(l={...l,...Ee(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,e!==void 0&&(m=`success`,d=re(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h){if(i&&d===a?.data&&t.select===this.#s)d=this.#c;else try{this.#s=t.select,d=t.select(d),d=re(i?.data,d,t),this.#c=d,this.#o=null}catch(e){this.#o=e}}else d===void 0&&(this.#o=null);this.#o&&(f=this.#o,d=this.#c,p=Date.now(),m=`error`,u=!1);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0;return{status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:Pe(e,t),refetch:this.refetch,isEnabled:k(t.enabled,e)!==!1}}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#l=this.#t),I(t,e))return;this.#r=t;let n=(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#p.size)return!0;let r=new Set(n??this.#p);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})();z.batch(()=>{n&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}};function Ae(e,t){return k(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||k(t.retryOnMount,e)!==!1)}function je(e,t){return Ae(e,t)||e.state.data!==void 0&&Me(e,t,t.refetchOnMount)}function Me(e,t,n){if(k(t.enabled,e)!==!1&&k(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&Pe(e,t)}return!1}function Ne(e,t,n,r){return(e!==t||k(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&Pe(e,n)}function Pe(e,t){return k(t.enabled,e)!==!1&&e.isStaleByTime(k(t.staleTime,e))}var Fe=class extends xe{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||Ie(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??(this.state.status===`pending`?this.execute(this.state.variables):Promise.resolve())}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey},r=this.#r=be({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)}),i=this.state.status===`pending`,a=!r.canStart();try{if(i)t();else{this.#i({type:`pending`,variables:e,isPaused:a}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:a})}let o=await r.start();return await this.#n.config.onSuccess?.(o,e,this.state.context,this,n),await this.options.onSuccess?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(o,null,e,this.state.context,n),this.#i({type:`success`,data:o}),o}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#r===r&&(this.#r=void 0),this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),z.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Ie(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Le=class extends fe{#e;#t;#n;constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}build(e,t,n){let r=new Fe({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=Re(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=Re(e);if(typeof t==`string`){let n=this.#t.get(t);if(n){if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=Re(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}return!0}runNext(e){let t=Re(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){z.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>j(t,e))}findAll(e={}){return this.getAll().filter(t=>j(e,t))}notify(e){z.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return z.batch(()=>Promise.all(e.map(e=>e.continue().catch(T))))}};function Re(e){return e.options.scope?.id}var ze=class extends fe{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),I(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&N(t.mutationKey)!==N(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onSubscribe(){this.listeners.size===1&&this.#n&&(this.#n.addObserver(this),this.#i())}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??Ie();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){z.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},Be=class extends fe{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??M(r,t),a=this.get(i);return a||(a=new Te({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){z.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>A(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>A(e,t)):t}notify(e){z.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){z.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){z.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Ve=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Be,this.#t=e.mutationCache||new Le,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=pe.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=ge.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(k(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=E(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return z.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;z.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return z.batch(()=>{let r=n.findAll(e),i=new Set(r);return r.forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,predicate:e=>i.has(e)},t)})}cancelQueries(e,t={}){let n={revert:!0,...t},r=z.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(T).catch(T)}invalidateQueries(e,t={}){return z.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=z.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(T)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(T)}async query(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t),r=n.isStaleByTime(k(t.staleTime,n))?await n.fetch(t):n.state.data,i=t.select;return i?i(r):r}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(k(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(T).catch(T)}infiniteQuery(e){return e._type=`infinite`,this.query(e)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(T).catch(T)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return ge.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(N(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{P(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(N(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{P(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=M(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===oe&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},He=h.createContext(!1),Ue=()=>h.useContext(He);He.Provider;function We(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Ge=h.createContext(We()),Ke=()=>h.useContext(Ge),qe=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?ce(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},Je=e=>{h.useEffect(()=>{e.clearReset()},[e])},Ye=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||ce(n,[e.error,r])),Xe=(e,t)=>t.state.data===void 0,Ze=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},Qe=(e,t)=>e?.suspense&&t.isPending,$e=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function et(e,t,n){let r=Ue(),i=Ke(),a=y(n),o=a.defaultQueryOptions(e),s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,Ze(o),qe(o,i,s),Je(i);let[l]=h.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),d=!r&&c;if(h.useSyncExternalStore(h.useCallback(e=>{let t=d?l.subscribe(z.batchCalls(e)):T;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),h.useEffect(()=>{l.setOptions(o)},[o,l]),Qe(o,u))throw $e(o,l,i);if(Ye({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return o.notifyOnChangeProps?u:l.trackResult(u)}function tt(e,t){return et(e,ke,t)}function nt(e,t){return et({...e,enabled:!0,suspense:!0,throwOnError:Xe,placeholderData:void 0},ke,t)}function rt(e,t){let n=y(t),[r]=h.useState(()=>new ze(n,e));h.useEffect(()=>{r.setOptions(e)},[r,e]);let i=h.useSyncExternalStore(h.useCallback(e=>r.subscribe(z.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=h.useCallback((...e)=>{r.mutate(e[0],e[1]).catch(T)},[r]);if(i.error&&ce(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}var it=function(){return null},at=h.useLayoutEffect;function ot(e){return e[e.length-1]}function st(e,t){return typeof e==`function`?e(t):e}var ct=Object.prototype.hasOwnProperty,lt=Object.prototype.propertyIsEnumerable;function ut(e){for(let t in e)if(ct.call(e,t))return!0;return!1}var dt=()=>Object.create(null),ft=(e,t)=>pt(e,t,dt);function pt(e,t,n=()=>({}),r=0){if(e===t)return e;if(r>500)return t;let i=t,a=_t(e)&&_t(i);if(!a&&!(ht(e)&&ht(i)))return i;let o=a?e:mt(e);if(!o)return i;let s=a?i:mt(i);if(!s)return i;let c=o.length,l=s.length,u=a?Array(l):n(),d=0;for(let t=0;t<l;t++){let o=a?t:s[t],l=e[o],f=i[o];if(l===f){u[o]=l,(a?t<c:ct.call(e,o))&&d++;continue}if(l===null||f===null||typeof l!=`object`||typeof f!=`object`){u[o]=f;continue}let p=pt(l,f,n,r+1);u[o]=p,p===l&&d++}return c===l&&d===c?e:u}function mt(e){let t=Object.keys(e);if(t.length!==Object.getOwnPropertyNames(e).length)return!1;let n=Object.getOwnPropertySymbols(e);if(n.length===0)return t;for(let r of n){if(!lt.call(e,r))return!1;t.push(r)}return t}function ht(e){if(!gt(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!gt(n)||!n.hasOwnProperty(`isPrototypeOf`))}function gt(e){return Object.prototype.toString.call(e)===`[object Object]`}function _t(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function vt(e,t,n){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=0,i=e.length;r<i;r++)if(!vt(e[r],t[r],n))return!1;return!0}if(ht(e)&&ht(t)){let r=n?.ignoreUndefined??!0;if(n?.partial){for(let i in t)if((!r||t[i]!==void 0)&&!vt(e[i],t[i],n))return!1;return!0}let i=0;if(!r)i=Object.keys(e).length;else for(let t in e)e[t]!==void 0&&i++;let a=0;for(let o in t)if((!r||t[o]!==void 0)&&(a++,a>i||!vt(e[o],t[o],n)))return!1;return i===a}return!1}var yt=/[\x00-\x1f\x7f"<>`{}]/g;function bt(e){return e.replace(yt,e=>`%`+e.charCodeAt(0).toString(16).toUpperCase().padStart(2,`0`))}function xt(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,e=>{try{return decodeURI(e)}catch{return e}})}return bt(t)}var St=[`http:`,`https:`,`mailto:`,`tel:`];function Ct(e){if(e[0]!==`/`&&e.includes(`:`))return/^[\x00-\x20]*([a-z][a-z\d+.\t\n\r-]*:)/i.exec(e)?.[1]?.replace(/[\t\n\r]/g,``).toLowerCase()}var wt=/^[\x00-\x20]*[\\/][\t\n\r]*[\\/]/;function Tt(e,t){if(!e)return!1;if(wt.test(e))return!0;let n=Ct(e);return n?!t.has(n):!1}function Et(e){if(!e)return e;let t=e;if(/[%\\\x00-\x1f\x7f]/.test(e)){let n=/%25|%5C/gi,r=0,i;for(t=``;(i=n.exec(e))!==null;)t+=xt(e.slice(r,i.index))+i[0],r=n.lastIndex;t+=xt(r?e.slice(r):e)}return t}function Dt(e){return/[\s\u0080-\uFFFF]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function Ot(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function kt(){throw Error(`Invariant failed`)}function At(e){return jt(e.filter(e=>e!==void 0).join(`/`))}function jt(e){return e.replace(/\/{2,}/g,`/`)}function Mt(e){return e===`/`?e:e.replace(/^\/+/,``)}function Nt(e){let t=e.length;return t>1&&e[t-1]===`/`?e.replace(/\/+$/,``):e}function Pt(e){return Nt(Mt(e))}function Ft(e,t){return e?.endsWith(`/`)&&e!==`/`&&e!==`${t}/`?e.slice(0,-1):e}function It({base:e,to:t,trailingSlash:n=`never`,cache:r}){if(t.includes(`//`)&&(t=jt(t)),t.startsWith(`/`))return t.length===1||n===`preserve`?t:n===`always`?t.endsWith(`/`)?t:`${t}/`:t.endsWith(`/`)?t.slice(0,-1):t;let i=t===`.`,a;if(r){a=i?e:e+`\0`+t;let n=r.get(a);if(n)return n}let o;if(i)o=e.split(`/`);else{for(e.includes(`//`)&&(e=jt(e)),o=e.split(`/`);o.length>1&&ot(o)===``;)o.pop();let n=t.split(`/`);for(let e=0,t=n.length;e<t;e++){let r=n[e];r===``?e?e===t-1&&o.push(r):o=[r]:r===`..`?o.length>1?o.pop():o=[``]:r===`.`||o.push(r)}}o.length>1&&(ot(o)===``?n===`never`&&o.pop():n===`always`&&o.push(``));let s=o.join(`/`),c=(i?jt(s):s)||`/`;return a&&r&&r.set(a,c),c}function Lt(e){let t=new Map(e.map(e=>[encodeURIComponent(e),e])),n=new RegExp([...t.keys()].join(`|`).replace(/[.*()]/g,`\\$&`),`g`);return e=>e.replace(n,e=>t.get(e)??e)}function Rt(e){return e==null||e===``}function zt(e,t,n){if(typeof t!=`string`)return``+(t??void 0);let r=e===`_splat`;if(r&&(!t||/^[a-zA-Z0-9\-._~!/]*$/.test(t)))return t;let i=encodeURIComponent(t);return r&&(i=i.replaceAll(`%2F`,`/`)),n?n(i):i}function Bt(e,t,n,r,i){let a=e.endsWith(`/`)?`/`:``,o=``;for(let e of t){if(typeof e==`string`){o+=e;continue}let[t,s,c,l]=e,u=t===2,d=u&&l!==void 0?l+a:l,f=n[s];if(t!==3||f!=null){if(i&&(i[s]=f,u&&(i[`*`]=f)),u&&Rt(f)){if(c===`/`&&!d)continue;f=``}o+=c+zt(s,f,r)+(d||``)}}return o+a||`/`}function Vt(e){return e?.isNotFound===!0}function Ht(){try{return sessionStorage}catch{return}}var Ut=`tsr-scroll-restoration-v1_3`,Wt=Ht();function Gt(){try{return JSON.parse(Wt?.getItem(`tsr-scroll-restoration-v1_3`)||`{}`)}catch{return{}}}function Kt(){try{Wt?.setItem(Ut,JSON.stringify(qt))}catch{}}var qt=Gt(),Jt=`data-scroll-restoration-id`,Yt=e=>e.state.__TSR_key||e.href;function Xt(e){let t=e.getAttribute(Jt);if(t)return`[${Jt}="${t}"]`;let n=``,r=e,i;for(;i=r.parentNode;){let e=1,t=r;for(;t=t.previousElementSibling;)e++;let a=`${r.localName}:nth-child(${e})`;n=n?`${a} > ${n}`:a,r=i}return n}var Zt=!1,Qt=`window`;function $t(e){try{return typeof e==`function`?e():document.querySelector(e)}catch{}}function en(e){let t=new Set;for(let n of e){if(n===Qt)continue;let e=$t(n);e&&t.add(e)}return t}function tn(e,t){let n=t??e.options.scrollRestoration,r=e._scroll;n&&(r.restoring=!0);let i=e.options.getScrollRestorationKey||Yt,a=new Set,o=e=>{let t=qt[e]||={};for(let e of a)e===document?t[Qt]={scrollX,scrollY}:e.isConnected&&(t[Xt(e)]={scrollX:e.scrollLeft,scrollY:e.scrollTop})};n&&!r.restoration&&(r.restoration=!0,Zt=!1,history.scrollRestoration=`manual`,document.addEventListener(`scroll`,e=>{Zt||a.add(e.target)},!0),e.subscribe(`onBeforeLoad`,e=>{e.fromLocation&&o(i(e.fromLocation)),a.clear()}),addEventListener(`pagehide`,()=>{o(i(e.stores.resolvedLocation.get()??e.stores.location.get())),Kt()})),!r.reset&&(r.reset=!0,e.subscribe(`onRendered`,t=>{let n=e.options.scrollRestorationBehavior,o=e.options.scrollToTopSelectors,s=r.next,c=r.hash,l;if(a.clear(),r.next=!0,r.hash=!1,typeof e.options.scrollRestoration==`function`&&!e.options.scrollRestoration({location:e.latestLocation}))return;let u=i(t.toLocation),d=t.fromLocation&&i(t.fromLocation);if(r.restoring&&d&&d!==u){let e=qt[d];if(e){let t=qt[u];for(let n in e){if(n===Qt){if(s)continue}else{let e=$t(n);if(!e||s&&o&&(l??=en(o),l.has(e)))continue}t||=qt[u]={},t[n]??=e[n]}}}Zt=!0;try{let e=t.toLocation.hash,i=t.toLocation.state.__hashScrollIntoViewOptions??!0,a=!1;if(s){!e&&o&&(l??=en(o));let t=e&&i&&c,s=r.restoring?qt[u]:void 0;if(s)for(let e in s){let{scrollX:r,scrollY:i}=s[e];if(e===Qt){if(t)continue;scrollTo({top:i,left:r,behavior:n}),a=!0}else{let t=$t(e);t&&(t.scrollLeft=r,t.scrollTop=i,l?.delete(t))}}if(!e){let e={top:0,left:0,behavior:n};if(a||scrollTo(e),l)for(let t of l)t.scrollTo(e)}}!a&&e&&i&&document.getElementById(e)?.scrollIntoView(i)}finally{Zt=!1}}))}function nn(e,t=String){let n;for(let r in e){let i=e[r];i!==void 0&&(n||=new URLSearchParams).set(r,t(i))}return n?n.toString():``}function rn(e){return e?e===`false`?!1:e===`true`?!0:e*0==0&&+e+``===e?+e:e:``}function an(e){let t=new URLSearchParams(e),n=Object.create(null);for(let[e,r]of t.entries()){let t=n[e];t==null?n[e]=rn(r):Array.isArray(t)?t.push(rn(r)):n[e]=[t,rn(r)]}return n}var on=/^(?:\s|["[{\d-]|fa|nu|tr)/,sn=ln(JSON.parse),cn=un(JSON.stringify,JSON.parse);function ln(e){let t=e===JSON.parse;return n=>{n[0]===`?`&&(n=n.substring(1));let r=an(n);for(let n in r){let i=r[n];if(typeof i==`string`){if(t&&!on.test(i))continue;try{r[n]=e(i)}catch{}}}return r}}function un(e,t){let n=t===JSON.parse;function r(r){if(r&&typeof r==`object`)try{return e(r)}catch{}else if(t&&typeof r==`string`){if(n&&!on.test(r))return r;try{return t(r),e(r)}catch{}}return r}return e=>{let t=nn(e,r);return t?`?${t}`:``}}var dn=`__root__`;function fn(e){e.statusCode=e.statusCode||e.code||307;let t=new Headers(e.headers);e.href&&t.get(`Location`)===null&&t.set(`Location`,e.href);let n=new Response(null,{status:e.statusCode,headers:t});if(n.options=e,e.throw)throw n;return n}function pn(e){return e instanceof Response&&!!e.options}function mn(e){let t=new Map,n,r;return{get(e){let n=t.get(e);if(n)return n.visited=!0,n.value},set(i,a){let o=t.get(i);if(o){o.value=a;return}if(t.size>=e){let e=n?.next().value;for(;!e||e.visited;)e?e.visited=!1:n=t.values(),e=n.next().value;e===r&&(n=void 0),t.delete(e.key)}let s={key:i,value:a,visited:!1};r=s,t.set(i,s)},clear(){t.clear(),n=void 0,r=void 0}}}var hn=4,gn=5;function _n(e){let t=e.names;if(t)return t;let n=[];for(let t of e)typeof t!=`string`&&n.push(t[1]);return e.names=n}function vn(e,t,n){let r=e.substring(t,n);if(r.charCodeAt(0)===36)return r.length===1?[2,`_splat`,``,void 0]:[1,r.substring(1),``,``];let i=r.indexOf(`{`);if(i>=0){let a=r.indexOf(`}`,i),o=r.charCodeAt(i+1)===45,s=i+(o?3:2);if(a>=0&&r.charCodeAt(s-1)===36&&(!o||s<a)){let c=r.substring(s,a);return[o?3:c?1:2,c||`_splat`,r.substring(0,i),e.substring(t+a+1,c?n:e.length)]}}return r}function yn(e,t,n,r,i,a){let o=n,s=t.fullPath??t.from,c=t.options,l=s.length,u=s.endsWith(`/`)?l-1:l,d=c?.caseSensitive??e,f=c?.params?.parse??c?.parseParams,p,m=a?n-1:0;if(!r||s.includes(`$`)){p=a?.slice()??[];let e=ot(p);e&&typeof e!=`string`&&e[0]===2&&(p[p.length-1]=[e[0],e[1],e[2],e[3]===void 0?void 0:e[3]+s.substring(n-(s[n-2]===`/`?2:1),u)],m=l)}for(;o<l;){let e=o,t=s.indexOf(`/`,e),n=t===-1?l:t,a=vn(s,e,n);o=n+1;let c;if(typeof a==`string`){if(!r)continue;let e=a,t;d?t=r.static??=new Map:(e=a.toLowerCase(),t=r.staticInsensitive??=new Map);let n=t.get(e);if(n)c=n;else{let n=xn(r);c=n,t.set(e,n)}}else{let t=a[0],h=a[2],g=a[3]??``;if(t===2&&(n=l,o=n+1),p&&m<n&&(m<e-1&&p.push(s.substring(m,e-1)),a[2]=`/`+h,t===2&&a[3]!==void 0&&u<l&&(a[3]=g.slice(0,-1)),p.push(a),m=n),!r)continue;let _=d&&!!(h||g);d||(h=h.toLowerCase(),g=g.toLowerCase());let v=t===1?r.dynamic??=[]:t===3?r.optional??=[]:r.wildcard??=[],y=t!==2&&!f&&v.find(e=>!e.parse&&e.caseSensitive===_&&e.prefix===h&&e.suffix===g);if(y)c=y;else{let e=xn(r,t,_,h,g);c=e,v.push(e),v.length===2&&i?.push(v)}}r=c}p&&m<u&&p.push(s.substring(m,u));let h=p?.slice();if(!r)return h;if(f&&t.children&&!t.isRoot&&t.id&&t.id.charCodeAt(t.id.lastIndexOf(`/`)+1)===95){let e=xn(r,gn);(r.pathless??=[]).push(e),r=e}let g=(t.path||!t.children)&&!t.isRoot;if(g&&u<l){let e=xn(r,hn);r.index=e,r=e}return r.parse=f??null,r.priority=c?.params?.priority??0,r.route||(r.data=h,g&&(r.route=t)),[r,o,h]}function bn(e,t){if(e.parse&&!t.parse)return-1;if(!e.parse&&t.parse)return 1;if(e.parse&&t.parse&&(e.priority||t.priority))return t.priority-e.priority;if(e.prefix&&t.prefix&&e.prefix!==t.prefix){if(e.prefix.startsWith(t.prefix))return-1;if(t.prefix.startsWith(e.prefix))return 1}if(e.suffix&&t.suffix&&e.suffix!==t.suffix){if(e.suffix.endsWith(t.suffix))return-1;if(t.suffix.endsWith(e.suffix))return 1}return e.prefix&&!t.prefix?-1:!e.prefix&&t.prefix?1:e.suffix&&!t.suffix?-1:!e.suffix&&t.suffix?1:e.caseSensitive&&!t.caseSensitive?-1:!e.caseSensitive&&t.caseSensitive?1:0}function xn(e,t=0,n,r,i){return{kind:t,depth:e?e.depth+1:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,data:void 0,parent:e,parse:null,priority:0,caseSensitive:n,prefix:r,suffix:i}}function Sn(e,t){let n=xn(),r=[];function i(e,t,n,a){let[o,s,c]=yn(!1,e,t,n,r,a);if(e.children)for(let t of e.children)i(t,s,o,c)}for(let t of e)i(t,1,n);for(let e of r)e.sort(bn);t.masksTree=n,t.flatCache=mn(1e3)}function Cn(e,t){e||=`/`;let n=t.flatCache.get(e);if(n!==void 0)return n;let r=Dn(e,t.masksTree);return t.flatCache.set(e,r),r}function wn(e,t,n,r,i){e||=`/`,r||=`/`;let a=t?`case\0${e}`:e,o=i.singleCache.get(a);return o||(o=xn(),yn(t,{from:e},1,o),i.singleCache.set(a,o)),Dn(r,o,n)}function Tn(e,t,n=!1){let r=n?e:`nofuzz\0${e}`,i=t.matchCache.get(r);if(i!==void 0)return i;e||=`/`;let a;try{a=Dn(e,t.segmentTree,n)}catch(e){if(e instanceof URIError)a=null;else throw e}return a&&(a.branch=kn(a.route)),t.matchCache.set(r,a),a}function En(e,t=!1){let n=xn(),r=[],i={},a={},o=0;function s(e,n,c,l){if(e.init(o),e.id in i&&kt(),i[e.id]=e,o!==0&&e.path){let t=Nt(e.fullPath);(!a[t]||e.fullPath.endsWith(`/`))&&(a[t]=e)}o++;let[u,d,f]=yn(t,e,n,c,r,l);if(e._interpolation=f,e.children)for(let t of e.children)s(t,d,u,f)}s(e,1,n);for(let e of r)e.sort(bn);return{processedTree:{segmentTree:n,singleCache:mn(1e3),matchCache:mn(1e3),flatCache:null,masksTree:null},routesById:i,routesByPath:a}}function Dn(e,t,n=!1){let r=e.split(`/`),i=jn(e,r,t,n);if(!i)return null;let[a]=On(e,r,i);return{route:i.node.route,rawParams:a}}function On(e,t,n){let r=An(n.node),i=n.node.data&&_n(n.node.data),a=Object.create(null),o=n.extract?.part??0,s=n.extract?.node??0,c=n.extract?.path??0,l=n.extract?.param??0;for(;s<r.length;o++,s++,c++){let u=r[s];if(u.kind===hn)break;if(u.kind===gn){o--,c--;continue}let d=t[o],f=c;if(d&&(c+=d.length),u.kind===1||u.kind===3){let e=i[l++];if(u.kind===3&&n.skipped&1<<s){o--,c=f-1;continue}let t=u.suffix||u.prefix?d.substring(u.prefix.length,d.length-u.suffix.length):d;(t||u.kind===1)&&(a[e]=decodeURIComponent(t))}else if(u.kind===2){let t=u,n=e.substring(f+t.prefix.length,e.length-t.suffix.length),r=decodeURIComponent(n);a[`*`]=r,a._splat=r;break}}return n.rawParams&&Object.assign(a,n.rawParams),[a,{part:o,node:s,path:c,param:l}]}function kn(e){let t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function An(e){let t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function jn(e,t,n,r){if(e===`/`&&n.index)return{node:n.index,skipped:0};let i=!ot(t),a=i&&e!==`/`,o=t.length-+!!i,s=[{node:n,index:1,skipped:0,statics:0,dynamics:0,optionals:0}],c=null,l=null;for(;s.length;){let n=s.pop(),{node:i,index:u,skipped:d,statics:f,dynamics:p,optionals:m}=n,{extract:h,rawParams:g}=n;if(i.kind===2&&i.route&&!Fn(l,n))continue;if(i.parse){if(!Pn(e,t,n))continue;g=n.rawParams,h=n.extract}r&&i.route&&i.kind!==hn&&Fn(c,n)&&(c=n);let _=u===o;if(_&&(i.route&&(!a||i.kind===hn||i.kind===2)&&Fn(l,n)&&(l=n),!i.optional&&!i.wildcard&&!i.index&&!i.pathless))continue;let v=_?void 0:t[u],y;if(_&&i.index){let n={node:i.index,index:u,skipped:d,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g},r=!0;if(i.index.parse&&(Pn(e,t,n)||(r=!1)),r){if(!p&&!m&&!d&&Nn(f,o))return n;Fn(l,n)&&(l=n)}}if(i.wildcard)for(let e=i.wildcard.length-1;e>=0;e--){let n=i.wildcard[e],{prefix:r,suffix:a}=n;if(!r||!_&&(n.caseSensitive?v:y??=v.toLowerCase()).startsWith(r)){if(a){if(_)continue;let e=t.slice(u).join(`/`),i=e.slice(-a.length);if((n.caseSensitive?i:i.toLowerCase())!==a||e.length-a.length<r.length)continue}s.push({node:n,index:o,skipped:d,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g})}}if(i.optional){let e=d|1<<i.depth+1;for(let t=i.optional.length-1;t>=0;t--){let n=i.optional[t];s.push({node:n,index:u,skipped:e,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g})}if(!_)for(let e=i.optional.length-1;e>=0;e--){let t=i.optional[e],{prefix:n,suffix:r}=t;if(n||r){let e=t.caseSensitive?v:y??=v.toLowerCase();if(n&&!e.startsWith(n)||r&&e.indexOf(r,e.length-r.length)<n.length)continue}s.push({node:t,index:u+1,skipped:d,statics:f,dynamics:p,optionals:m+Mn(o,u),extract:h,rawParams:g})}}if(!_&&i.dynamic&&v)for(let e=i.dynamic.length-1;e>=0;e--){let t=i.dynamic[e],{prefix:n,suffix:r}=t;if(n||r){let e=t.caseSensitive?v:y??=v.toLowerCase();if(n&&!e.startsWith(n)||r&&e.indexOf(r,e.length-r.length)<n.length)continue}s.push({node:t,index:u+1,skipped:d,statics:f,dynamics:p+Mn(o,u),optionals:m,extract:h,rawParams:g})}if(!_&&i.staticInsensitive){let e=i.staticInsensitive.get(y??=v.toLowerCase());e&&s.push({node:e,index:u+1,skipped:d,statics:f+Mn(o,u),dynamics:p,optionals:m,extract:h,rawParams:g})}if(!_&&i.static){let e=i.static.get(v);e&&s.push({node:e,index:u+1,skipped:d,statics:f+Mn(o,u),dynamics:p,optionals:m,extract:h,rawParams:g})}if(i.pathless)for(let e=i.pathless.length-1;e>=0;e--){let t=i.pathless[e];s.push({node:t,index:u,skipped:d,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g})}}if(l)return l;if(r&&c){let n=c.index;for(let e=0;e<c.index;e++)n+=t[e].length;let r=n===e.length?`/`:e.slice(n);return c.rawParams??=Object.create(null),c.rawParams[`**`]=decodeURIComponent(r),c}return null}function Mn(e,t){return 2**(e-t-1)}function Nn(e,t){return e===2**(t-1)-1}function Pn(e,t,n){let r,i;try{[r,i]=On(e,t,n)}catch{return null}if(n.rawParams=r,n.extract=i,!n.node.parse)return!0;try{if(n.node.parse(r)===!1)return null}catch{}return!0}function Fn(e,t){return!e||t.statics>e.statics||t.statics===e.statics&&(t.dynamics>e.dynamics||t.dynamics===e.dynamics&&(t.optionals>e.optionals||t.optionals===e.optionals&&((t.node.kind===hn)>(e.node.kind===hn)||t.node.kind===hn==(e.node.kind===hn)&&t.node.depth>e.node.depth)))}function In(e){return{input:({url:t})=>{for(let n of e)t=Rn(n,t);return t},output:({url:t})=>{for(let n=e.length-1;n>=0;n--)t=zn(e[n],t);return t}}}function Ln(e){let t=Pt(e.basepath),n=`/${t}`,r=e.caseSensitive?n:n.toLowerCase(),i=`${r}/`;return{input:({url:t})=>{let a=e.caseSensitive?t.pathname:t.pathname.toLowerCase();return a===r?t.pathname=`/`:a.startsWith(i)&&(t.pathname=t.pathname.slice(n.length)),t},output:({url:e})=>(e.pathname=At([`/`,t,e.pathname]),e)}}function Rn(e,t){let n=e?.input?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}function zn(e,t){let n=e?.output?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}function Bn(e,t){let{createMutableStore:n,createReadonlyStore:r,batch:i}=t,a=new Map,o=n(`idle`),s=n(e),c=n(void 0),l=n([]),u=r(()=>l.get().map(e=>a.get(e).get())),d=r(()=>({status:o.get(),isLoading:o.get()===`pending`,matches:u.get(),location:s.get(),resolvedLocation:c.get()}));function f(e){let t=a.get(e);return t||(t=n(void 0),a.set(e,t)),t}let p={status:o,location:s,resolvedLocation:c,ids:l,matches:u,byRoute:a,__store:d,getMatchStore:f,setMatches:m};function m(e){let t=l.get(),n=e.map(e=>e.routeId);i(()=>{Ot(t,n)||l.set(n);for(let e of t)n.includes(e)||a.get(e).set(()=>void 0);for(let t of e){let e=f(t.routeId);e.get()!==t&&e.set(t)}})}return p}var Vn=`__TSR_index`,Hn=`popstate`,Un=`beforeunload`,Wn=/^[\x00-\x20]*(?:[\\/][\t\n\r]*){2,}/;function Gn(e){let t=Wn.exec(e);return t?`/`+e.slice(t[0].length):e}function Kn(e){return/[\x00-\x1f\x7f]/.test(e)&&(e=e.replace(/[\x00-\x1f\x7f]/g,e=>`
2 \r`.includes(e)?``:encodeURIComponent(e))),Gn(e)}function qn(e){let t=e.getLocation(),n=new Set,r=r=>{t=e.getLocation(),n.forEach(e=>e({location:t,action:r}))},i=n=>{e.notifyOnIndexChange??!0?r(n):t=e.getLocation()},a=async({task:n,navigateOpts:r,...i})=>{if(r?.ignoreBlocker??!1){n();return}let a=e.getBlockers?.()??[],o=i.type===`PUSH`||i.type===`REPLACE`;if(typeof document<`u`&&a.length&&o)for(let n of a){let r=Zn(i.path,i.state);if(await n.blockerFn({currentLocation:t,nextLocation:r,action:i.type})){e.onBlocked?.();return}}n()};return{get location(){return t},get length(){return e.getLength()},subscribers:n,subscribe:e=>(n.add(e),()=>{n.delete(e)}),push:(n,i,o)=>{let s=t.state[Vn];i=Jn(s+1,i),a({task:()=>{e.pushState(n,i),r({type:`PUSH`})},navigateOpts:o,type:`PUSH`,path:n,state:i})},replace:(n,i,o)=>{let s=t.state[Vn];i=Jn(s,i),a({task:()=>{e.replaceState(n,i),r({type:`REPLACE`})},navigateOpts:o,type:`REPLACE`,path:n,state:i})},go:(t,n)=>{a({task:()=>{e.go(t,n?.ignoreBlocker??!1),i({type:`GO`,index:t})},navigateOpts:n,type:`GO`})},back:t=>{a({task:()=>{e.back(t?.ignoreBlocker??!1),i({type:`BACK`})},navigateOpts:t,type:`BACK`})},forward:t=>{a({task:()=>{e.forward(t?.ignoreBlocker??!1),i({type:`FORWARD`})},navigateOpts:t,type:`FORWARD`})},canGoBack:()=>t.state[Vn]!==0,createHref:t=>e.createHref(t),block:t=>{if(!e.setBlockers)return()=>{};let n=e.getBlockers?.()??[];return e.setBlockers([...n,t]),()=>{let n=e.getBlockers?.()??[];e.setBlockers?.(n.filter(e=>e!==t))}},flush:()=>e.flush?.(),destroy:()=>e.destroy?.(),notify:r,_getBlockers:()=>e.getBlockers?.()??[]}}function Jn(e,t){let n=Qn();return{...t,key:n,__TSR_key:n,[Vn]:e}}function Yn(e){let t=e?.window??(typeof document<`u`?window:void 0),n=t.history.pushState,r=t.history.replaceState,i=[],a=()=>i,o=e=>i=e,s=t=>Kn(e?.createHref?e.createHref(t):t),c=e?.parseLocation??(()=>Zn(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){let e=Qn();t.history.replaceState({[Vn]:0,key:e,__TSR_key:e},``)}let l=c(),u,d=!1,f=!1,p=!1,m=!1,h=()=>l,g,_=()=>{g&&(S._ignoreSubscribers=!0,(g[2]?t.history.pushState:t.history.replaceState)(g[1],``,g[0]),S._ignoreSubscribers=!1,g=void 0,u=void 0)},v=(t,n,r)=>{let i=e?.createHref?s(n):void 0,a=!!g;a||(u=l),l=Zn(n,r),g=[i??l.href,r,g?.[2]||t],a||queueMicrotask(()=>_())},y=e=>{l=c(),S.notify({type:e})},b=async()=>{if(m=!1,f){f=!1;return}let e=c(),n=e.state[Vn]-l.state[Vn],r=n===1,i=n===-1,o=!r&&!i||d;d=!1;let s=o?`GO`:i?`BACK`:`FORWARD`,u=o?{type:`GO`,index:n}:{type:i?`BACK`:`FORWARD`};if(p)p=!1;else{let r=a();if(typeof document<`u`&&r.length){for(let i of r)if(await i.blockerFn({currentLocation:l,nextLocation:e,action:s})){f=!0,t.history.go(-n),S.notify(u);return}}}l=c(),S.notify(u)},x=e=>{if(m){m=!1;return}let t=!1,n=a();if(typeof document<`u`&&n.length)for(let e of n){let n=e.enableBeforeUnload??!0;if(n===!0){t=!0;break}if(typeof n==`function`&&n()===!0){t=!0;break}}if(t)return e.preventDefault(),e.returnValue=``},S=qn({getLocation:h,getLength:()=>t.history.length,pushState:(e,t)=>v(!0,e,t),replaceState:(e,t)=>v(!1,e,t),back:e=>(e&&(p=!0,m=!0),t.history.back()),forward:e=>{e&&(p=!0,m=!0),t.history.forward()},go:(e,n)=>{d=!0,n&&(p=!0,m=!0),t.history.go(e)},createHref:e=>s(e),flush:_,destroy:()=>{t.history.pushState=n,t.history.replaceState=r,t.removeEventListener(Un,x,{capture:!0}),t.removeEventListener(Hn,b)},onBlocked:()=>{u&&l!==u&&(l=u)},getBlockers:a,setBlockers:o,notifyOnIndexChange:!1});return S._ignoreNextBeforeUnload=e=>{m=!1;try{e=new URL(e,t.document.baseURI).href,m=/^https?:/.test(e)&&(!e.includes(`#`)||e.split(`#`)[0]!==t.location.href.split(`#`)[0])}catch{}},t.addEventListener(Un,x,{capture:!0}),t.addEventListener(Hn,b),t.history.pushState=function(...e){let r=n.apply(t.history,e);return S._ignoreSubscribers||y(`PUSH`),r},t.history.replaceState=function(...e){let n=r.apply(t.history,e);return S._ignoreSubscribers||y(`REPLACE`),n},S}function Xn(e){let t=e?.window??(typeof document<`u`?window:void 0);return Yn({window:t,parseLocation:()=>{let e=t.location.hash.split(`#`).slice(1),n=e[0]??`/`,r=t.location.search,i=e.slice(1);return Zn(`${n}${r}${i.length===0?``:`#${i.join(`#`)}`}`,t.history.state)},createHref:e=>`${t.location.pathname}${t.location.search}#${e}`})}function Zn(e,t){let n=Kn(e),r=n.indexOf(`#`),i=n.indexOf(`?`);if(!t){let e=Qn();t={[Vn]:0,key:e,__TSR_key:e}}return{href:n,pathname:n.substring(0,r>0?i>0?Math.min(r,i):r:i>0?i:n.length),hash:r>-1?n.substring(r):``,search:i>-1?n.slice(i,r===-1?void 0:r):``,state:t}}function Qn(){return(Math.random()+1).toString(36).substring(7)}function $n(e,t){return e.protocol!==`http:`&&e.protocol!==`https:`||e.origin!==t||!!e.username||!!e.password}function er(e){return e.pathname+e.search+e.hash}function tr(e){return e.options.loader||e.options.beforeLoad||e.lazyFn||e.options.component?.preload||e.options.pendingComponent?.preload}function nr(e,t){return{fromLocation:t,toLocation:e,pathChanged:t?.pathname!==e.pathname,hrefChanged:t?.href!==e.href,hashChanged:t?.hash!==e.hash}}function rr({key:e,__TSR_key:t,__TSR_index:n,__hashScrollIntoViewOptions:r,...i}){return i}function ir(e){return e.findIndex(e=>e.status===`error`||e.status===`notFound`||e._notFound)+1}function ar(e,t,n,r,i,a){r&&(t=t.slice(0,r)),i&&(n=n.slice(0,i));for(let r of t){if(a&&e._tx!==a)return;n.some(e=>e.routeId===r.routeId)||e.routesById[r.routeId].options.onLeave?.(r)}for(let r of n){if(a&&e._tx!==a)return;e.routesById[r.routeId].options[t.some(e=>e.routeId===r.routeId)?`onStay`:`onEnter`]?.(r)}}var or=class{constructor(e,t){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this._scroll={next:!0},this.subscribers=new Set,this._cache=new Map,this._committed=[],this.startTransition=async e=>(e(),!1),this.update=e=>{let t=this.options,n=this.basepath??t?.basepath??`/`,r=this.basepath===void 0,i=t?.rewrite;if(this.options={...t,...e},this.isServer=this.options.isServer??!1??typeof document>`u`,this.staticLocations=new WeakMap,this.protocolAllowlist=new Set(this.options.protocolAllowlist),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.history=this.options.history?this.options.history:Yn()),this.origin=this.options.origin,this.origin||=window?.origin&&window.origin!==`null`?window.origin:`http://localhost`,this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree){this.routeTree=this.options.routeTree;let e;e=this.buildRouteTree(),this.setRoutes(e)}if(!this.stores&&this.latestLocation){let e=this.getStoreConfig(this);this.batch=e.batch,this.stores=Bn(this.latestLocation,e),tn(this)}let a=this.options.basepath??`/`,o=this.options.rewrite;if(r||n!==a||i!==o){this.basepath=a;let e=[],t=Pt(a);t&&t!==`/`&&e.push(Ln({basepath:a})),o&&e.push(o),this.rewrite=e.length===0?void 0:e.length===1?e[0]:In(e),this.history&&this.updateLatestLocation(),this.stores&&this.stores.location.set(this.latestLocation)}},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{let e=En(this.routeTree,this.options.caseSensitive);return this.options.routeMasks&&Sn(this.options.routeMasks,e.processedTree),{...e,resolvePathCache:mn(1e3)}},this.subscribe=(e,t)=>{let n={eventType:e,fn:t};return this.subscribers.add(n),()=>{this.subscribers.delete(n)}},this.emit=e=>{for(let t of this.subscribers)if(t.eventType===e.type)try{t.fn(e)}catch(e){console.error(e)}},this.parseLocation=(e,t)=>{let n=({pathname:e,search:n,hash:r,href:i,state:a})=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(e)){let i=this.options.parseSearch(n),o=this.options.stringifySearch(i);return{href:e+o+r,publicHref:e+o+r,pathname:Et(e),external:!1,searchStr:o,search:ft(t?.search,i),hash:Et(r.slice(1)),state:pt(t?.state,a)}}let o=new URL(i,this.origin),s=Rn(this.rewrite,o),c=this.options.parseSearch(s.search),l=this.options.stringifySearch(c);return s.search=l,{href:s.href.replace(s.origin,``),publicHref:i,pathname:Et(Gn(s.pathname)),external:!!this.rewrite&&$n(s,this.origin),searchStr:l,search:ft(t?.search,c),hash:Et(s.hash.slice(1)),state:pt(t?.state,a)}},r=n(e),{__tempLocation:i,__tempKey:a}=r.state;if(i&&(!a||a===this.tempLocationKey)){let e=n(i);return e.state.key=r.state.key,e.state.__TSR_key=r.state.__TSR_key,delete e.state.__tempLocation,{...e,maskedLocation:r}}return r},this.resolvePathWithBase=(e,t)=>It({base:e,to:t,trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(e,t,n)=>typeof e==`string`?this.matchRoutesInternal({pathname:e,search:t},n):this.matchRoutesInternal(e,t),this.getMatchedRoutes=e=>{let t=Object.create(null),n=Tn(Nt(e),this.processedTree,!0);return n&&Object.assign(t,n.rawParams),[n?.branch||[this.routesById.__root__],t,n?.route]},this.buildLocation=e=>{{let t=this.staticLocations.get(e);if(t)return t}let t=!1,n=(n={})=>{if(n.href){let e=Zn(n.href,{});n={...n,to:Rn(this.rewrite,new URL(e.pathname,this.origin)).pathname,search:this.options.parseSearch(e.search),hash:e.hash.slice(1)}}let r=n._fromLocation||this._pendingLocation||this.latestLocation,i,a=()=>(t=!0,r),o=()=>(t=!0,i??=this.matchRoutesLightweight(r)),s=n.to?`${n.to}`:`.`,c=this.resolvePathWithBase(s[0]===`/`?``:n.unsafeRelative===`path`?a().pathname:n.from??o()[1],s),l=this.routesByPath[Nt(c)],u=c.includes(`$`),d;if(l)d=l._branch??=kn(l);else if(u)d=[];else{let[e,t,n]=this.getMatchedRoutes(c);d=e,this.options.notFoundRoute&&(!n||n.path!==`/`&&t[`**`])&&(d=[...d,this.options.notFoundRoute])}let f=u?l?._interpolation??yn(!1,{fullPath:c},0):void 0,p;for(let e of d){let t=e.options.params?.stringify??e.options.stringifyParams;if(t){let e=o()[3];if(p??=dr(n.params,e),!ut(p))break;p===e&&(p=Object.assign(dt(),p));try{Object.assign(p,t(p))}catch{}}}p??=dr(n.params,fr(n.params,f)?o()[3]:pr);let m=e.leaveParams?c:Gn(Et(f?Bt(c,f,p,this.pathParamsDecoder):c)),h=mr(d,e._includeValidateSearch),g=()=>{let t=o()[2];if(e._includeValidateSearch&&this.options.search?.strict){let e={};d.forEach(n=>{if(n.options.validateSearch)try{Object.assign(e,ur(n.options.validateSearch,{...e,...t}))}catch{}}),t=e}return t},_=h.length?hr(h,g(),n):n.search===!0?g():typeof n.search==`function`?n.search(g()):n.search||pr,v=this.options.stringifySearch(_),y=n.hash===!0?a().hash:typeof n.hash==`function`?n.hash(a().hash):n.hash||void 0,b=y?`#${y}`:``,x=n.state?n.state===!0?a().state:typeof n.state==`function`?n.state(a().state):n.state:pr,S=`${m}${v}${b}`,C,w,T=!1;if(this.rewrite){let e=new URL(S,this.origin),t=e.origin,n=zn(this.rewrite,e);C=er(e),$n(n,t)?(w=n.href,T=!0):w=Gn(er(n))}else C=Dt(S),w=C;return{publicHref:w,href:C,pathname:m,search:_,searchStr:v,state:x,hash:y??``,external:T,unmaskOnReload:n.unmaskOnReload}},r=n(e);if(e.mask)r.maskedLocation=n({from:e.from,...e.mask});else if(this.options.routeMasks){let t=Cn(r.pathname,this.processedTree);if(t){let i=Object.assign(dt(),t.rawParams),{from:a,params:o,...s}=t.route,c=dr(o,i);r.maskedLocation=n({from:e.from,...s,params:c})}}return!t&&e._fromLocation&&!r.maskedLocation&&this.staticLocations.set(e,r),r},this.commitLocation=async({viewTransition:e,ignoreBlocker:t,...n})=>{let r=n.maskedLocation??n;if(r.external)return sr(this,r.publicHref,{replace:n.replace,ignoreBlocker:t});let i,a=Nt(this.latestLocation.href)===Nt(n.href)&&vt(rr(n.state),rr(this.latestLocation.state)),o=this._commitPromise,s,c=new Promise(e=>{s=e});if(c.resolve=()=>{s(),o?.resolve()},this._commitPromise=c,a)this.load();else{let{maskedLocation:r,hashScrollIntoView:a,...o}=n;r&&(o={...r,state:{...r.state,__tempKey:void 0,__tempLocation:{...o,search:o.searchStr,state:{...o.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(o.unmaskOnReload??this.options.unmaskOnReload??!1)&&(o.state.__tempKey=this.tempLocationKey)),o.state={...o.state,__hashScrollIntoViewOptions:a??this.options.defaultHashScrollIntoView??!0},this.shouldViewTransition=e,i=n.replace?`REPLACE`:`PUSH`,this.history[i===`REPLACE`?`replace`:`push`](o.publicHref,o.state,{ignoreBlocker:t}),this.history.subscribers.size||this.load({action:{type:i}})}return this._scroll.next=n.resetScroll??!0,this._commitPromise},this.buildAndCommitLocation=({replace:e,resetScroll:t,hashScrollIntoView:n,viewTransition:r,ignoreBlocker:i,...a}={})=>{let o=this.buildLocation({...a,_includeValidateSearch:!0});this._pendingLocation=o;let s=this.commitLocation({...o,viewTransition:r,replace:e,resetScroll:t,hashScrollIntoView:n,ignoreBlocker:i});return queueMicrotask(()=>{this._pendingLocation===o&&(this._pendingLocation=void 0)}),s},this.navigate=async({to:e,reloadDocument:t,href:n,publicHref:r,...i})=>{let a=n?Ct(n):void 0;if(a||t){if(e!==void 0||!n){let t=this.buildLocation({to:e,...i}),a=t.maskedLocation??t;n??=a.publicHref,r??=a.publicHref}let t=!a&&r?r:n;return sr(this,t,i)}return this.buildAndCommitLocation({...i,href:n,to:e,_isNavigate:!0})},this.load=async e=>{this.updateLatestLocation(),e?.action&&(this._scroll.hash=e.action.type===`PUSH`||e.action.type===`REPLACE`),await ai(this,e)},this.startViewTransition=e=>{let t=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,t&&typeof document.startViewTransition==`function`){let n;if(typeof t==`object`&&window.CSS?.supports?.(`selector(:active-view-transition-type(a))`)){let r=this.latestLocation,i=this.stores.resolvedLocation.get(),a=typeof t.types==`function`?t.types(nr(r,i)):t.types;if(a===!1)return e();n={update:e,types:a}}else n=e;return document.startViewTransition(n).updateCallbackDone}return e()},this.invalidate=e=>{let t=this._committed,n=e?.filter,r=this._preloads,i=new Set([...t,...this._cache.values(),...[...r?.values()??[]].flat(),...this._tx?.[3]??[]].filter(e=>!n||n(e)).map(e=>e.id)),a=[];for(let[e,t]of r??[])t.some(e=>i.has(e.id))&&(r.delete(e),a.push(e));let o=t=>{if(i.has(t.id)){let n=this.routesById[t.routeId],r={...t,invalid:!0,...(e?.forcePending||t.status===`error`||t.status===`notFound`)&&tr(n)?{status:`pending`,error:void 0}:void 0};return t._flight=void 0,r}return t};this._committed=t.map(o);for(let[t,n]of this._cache)i.has(t)&&(n.invalid=!0,e?.forcePending&&(n.status=`pending`));for(let e of i)this._flights?.delete(e);for(let e of a)e.abort();return this.shouldViewTransition=!1,this.load({sync:e?.sync})},this.resolveRedirect=e=>{let t=e.options,n=e.headers.get(`Location`)||t.href;if(!n){let e=this.buildLocation(t);n=(e.maskedLocation??e).publicHref||`/`}let r;if(wt.test(n)||(r=Ct(n))&&!this.protocolAllowlist.has(r))throw Error(`Redirect blocked: unsafe protocol`);if(r===`http:`||r===`https:`){let e=new URL(n);e.pathname.startsWith(`//`)?n=e.href:$n(e,this.origin)||(n=er(e),r=void 0)}return r&&(t.reloadDocument=!0),t.href=n,e.headers.set(`Location`,n),e},this.clearCache=e=>{let t=this._cache,n=this._preloads,r=e?.filter,i=[],a=[];for(let[e,n]of t)(!r||r(n))&&(a.push(e),i.push(n));let o=[];for(let[e,t]of n??[])(!r||t.some(r))&&(o.push(e),i.push(...t));for(let e of a)t.delete(e);for(let e of o)n.delete(e);for(let e of i){let t=e._flight;e._flight=void 0,t&&!--t[2]&&(this._flights?.get(e.id)===t&&this._flights.delete(e.id),o.push(t[1]))}for(let e of o)e.abort()},this.loadRouteChunk=br,this.preloadRoute=e=>oi(this,e),this.matchRoute=(e,t)=>{let n={...e,to:e.to?this.resolvePathWithBase(e.from||``,e.to):void 0,params:e.params||{},leaveParams:!0},r=this.buildLocation(n),i=this.stores.status.get()===`pending`;if(t?.pending&&!i)return!1;let a=t?.pending??!i?this.latestLocation:this.stores.resolvedLocation.get()||this.stores.location.get(),o=wn(r.pathname,t?.caseSensitive??!1,t?.fuzzy??!1,a.pathname,this.processedTree);return!o||e.params&&!vt(o.rawParams,e.params,{partial:!0})?!1:t?.includeSearch??!0?vt(a.search,r.search,{partial:!0})?o.rawParams:!1:o.rawParams},this.getStoreConfig=t,e.pathParamsAllowedCharacters?.length&&(this.pathParamsDecoder=Lt(e.pathParamsAllowedCharacters)),this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...e,caseSensitive:e.caseSensitive??!1,notFoundMode:e.notFoundMode??`fuzzy`,stringifySearch:e.stringifySearch??cn,parseSearch:e.parseSearch??sn,protocolAllowlist:e.protocolAllowlist??St}),self.__TSR_ROUTER__=this}isShell(){return!!this.options.isShell}get state(){return this.stores.__store.get()}setRoutes(e){Object.assign(this,e),this.lightweightCache=new WeakMap,this.staticLocations=new WeakMap;let t=this.options.notFoundRoute;t&&(t.init(99999999999),this.routesById[t.id]!==t&&(t._interpolation=yn(!1,t,0)),this.routesById[t.id]=t)}matchRoutesInternal(e,t){let[n,r,i]=this.getMatchedRoutes(e.pathname),a=n,o=!1;(i?i.path!==`/`&&r[`**`]:Nt(e.pathname))&&(this.options.notFoundRoute?a=[...a,this.options.notFoundRoute]:o=!0);let s=o?gr(this.options.notFoundMode,a):void 0,c=Array(a.length),l=this._committed,u=(e,t)=>{let n=l[t];return n?.routeId===e.id?n:e===this.options.notFoundRoute?l.find(t=>t.routeId===e.id):void 0},d;for(let n=0;n<a.length;n++){let i=a[n],o=c[n-1],l,f,p;{let n=o?.search??e.search,r=o?._strictSearch??void 0;try{let e=ur(i.options.validateSearch,{...n})??void 0;l={...n,...e},f={...r,...e}}catch(e){let r=e;if(e instanceof cr||(r=new cr(e.message,{cause:e})),t?.throwOnError)throw r;l=n,f={},p=r}}let m=``,h=``;try{m=i.options.loaderDeps?.({search:l})??``,h=m&&JSON.stringify(m)||``}catch(e){if(t?.throwOnError)throw e;p??=e}let g=dt(),_=i._interpolation?Bt(i.fullPath,i._interpolation,r,this.pathParamsDecoder,g):i.fullPath,v=i.id+_+h,y=u(i,n),b=this._cache.get(v)??(y?.id===v?y:void 0);d=b?._strictParams??Object.assign(g,d);let x;if(!b)try{_r(i,d)}catch(e){if(x=Vt(e)||pn(e)?e:new lr(e.message,{cause:e}),t?.throwOnError)throw x}let S=y?`stay`:`enter`,C;if(b)C={...b,cause:S,search:ft(y?y.search:b.search,l),_strictSearch:f,searchError:p};else{let e=tr(i)?`pending`:`success`;C={id:v,ssr:i.options.ssr,index:n,routeId:i.id,params:y?.params??d,_strictParams:d,pathname:_,updatedAt:Date.now(),search:y?ft(y.search,l):l,_strictSearch:f,searchError:p,status:e,isFetching:!1,error:void 0,paramsError:x,context:{},abortController:t?._controller??new AbortController,cause:S,loaderDeps:y?pt(y.loaderDeps,m):m,invalid:!1,preload:!1,staticData:i.options.staticData||{},fullPath:i.fullPath}}let w=s===i.id;C._notFound&&!w&&(C.error=void 0),C._notFound=w,c[n]=C}for(let e=0;e<c.length;e++){let n=c[e];n.params=n.cause===`stay`?ft(n.params,d):d,t?._controller&&(n.context={})}return c}matchRoutesLightweight(e){let t=ot(this.stores.ids.get()),n=t?this.stores.byRoute.get(t).get():void 0,r=n?.id,i=this.lightweightCache.get(e);if(i&&i[0]===r)return i[1];let[a,o]=this.getMatchedRoutes(e.pathname),s=ot(a),c={...e.search};for(let e of a)try{Object.assign(c,ur(e.options.validateSearch,c))}catch{}let l=n&&n.routeId===s.id&&n.pathname===e.pathname,u;if(l)u=n.params;else{let e=o;for(let t of a)try{_r(t,e)}catch{}u=e}let d=[a,s.fullPath,c,u];return this.lightweightCache.set(e,[r,d]),d}};async function sr(e,t,{replace:n,ignoreBlocker:r}){if(!Tt(t,e.protocolAllowlist)){if(!r){let t=e.history._getBlockers();for(let r of t)if(r?.blockerFn&&await r.blockerFn({currentLocation:e.history.location,nextLocation:e.history.location,action:n?`REPLACE`:`PUSH`}))return}e.history._ignoreNextBeforeUnload?.(t),n?window.location.replace(t):window.location.href=t}}var cr=class extends Error{},lr=class extends Error{};function ur(e,t){if(e==null)return{};if(`~standard`in e){let n=e[`~standard`].validate(t);if(n instanceof Promise)throw new cr(`Async validation not supported`);if(n.issues)throw new cr(JSON.stringify(n.issues,void 0,2),{cause:n});return n.value}return`parse`in e?e.parse(t):typeof e==`function`?e(t):{}}function dr(e,t){if(e===void 0||e===!0)return t;let n=Object.create(null);return e===!1||e===null?n:typeof e==`function`?(Object.assign(n,t),Object.assign(n,e(n))):Object.assign(n,t,e)}function fr(e,t){return typeof e==`function`?!0:!t||e===!1||e===null?!1:e===void 0||e===!0||t.some(t=>typeof t!=`string`&&!ct.call(e,t[1]))}var pr=Object.freeze({});function mr(e,t){let n=[];for(let r=0;r<e.length;r++){let i=e[r].options;`search`in i?i.search?.middlewares&&n.push(...i.search.middlewares):(i.preSearchFilters||i.postSearchFilters)&&n.push(({search:e,next:t})=>{let n=t(i.preSearchFilters?i.preSearchFilters.reduce((e,t)=>t(e),e):e);return i.postSearchFilters?i.postSearchFilters.reduce((e,t)=>t(e),n):n});let a=i.validateSearch;t&&a&&n.push(({search:e,next:t,meta:n})=>{let r=t(e);try{let e=ur(a,r);if(n&&e)for(let t in e)t in r||(n.defaulted||=new Map).set(t,e[t]);return{...r,...e}}catch{}return r})}return n}function hr(e,t,n){let r=(t,i,a)=>{if(t>=e.length){if(!n.search)return{};if(n.search===!0)return i;let e=st(n.search,i);return a&&(a.explicit=e),e}return e[t]({search:i,next:(e,n)=>{if(n){let n=a||{};return{search:r(t+1,e,n),meta:n}}return r(t+1,e,a)},meta:a})};return r(0,t)}function gr(e,t){if(e!==`root`){let e;for(let n=t.length-1;n>=0;n--){let r=t[n];if(r.options.notFoundComponent)return r.id;e||=r.children&&r.id}if(e)return e}return dn}function _r(e,t){let n=e.options.params?.parse??e.options.parseParams;n&&Object.assign(t,n(t))}function vr(e,t){return e.options[t]?.preload?.()}function yr(e,t){let n=vr(e,`component`),r=vr(e,`pendingComponent`);return t&&(r?r=r.then(t):t()),n&&r?Promise.all([n,r]).then(()=>{}):n??r}function br(e,t,n){let r=()=>t===!1?void 0:t?vr(e,t):yr(e,n),i=e._lazy;if(i)return i===!0?r():i.then(r);if(!e.lazyFn)return r();let a=e.lazyFn().then(t=>{{let{id:n,...r}=t.options;Object.assign(e.options,r),e._lazy=!0}},t=>{throw e._lazy=void 0,t});return e._lazy=a,a.then(r)}function xr(e){let t=e.findIndex(e=>e.status!==`success`||e._notFound)+1;return t&&t<e.length?e.slice(0,t):e}var Sr=0,Cr=1,wr=2,B=3,Tr=[4];function Er(e){return typeof e[0]==`number`}function Dr(e,t){return t.aborted?Promise.race([Promise.reject(t),e]):new Promise((n,r)=>{let i=()=>r(t);t.addEventListener(`abort`,i,{once:!0}),Promise.resolve(e).then(n,r).then(()=>t.removeEventListener(`abort`,i))})}function Or(e,t){return e.routesById[t.routeId]}function kr(e,t,n){return pn(e)?[B,e]:Vt(e)?(e.routeId||=n,[wr,e]):t?(typeof e?.then==`function`&&(e=Error(`A Promise was thrown`,{cause:e})),[Cr,e]):[Sr,e]}function Ar(e,t){let n=kr(t,!0,e.id);if(n[0]!==Cr)return n;try{e.options.onError?.(n[1])}catch(t){n=kr(t,!0,e.id)}return n}function jr(e,t,n,r,i){return i[0].signal.aborted?Tr:Kr(e,t,n,Ar(n,r),i)}async function Mr(e,t,n,r,i,a){let[o,s]=t,c=n[0].signal,l=!!n[3];for(let i=n[6]??0;i<r;i++){let r=s[i],u=Or(e,r);r.abortController=n[0];let d=s[i-1]?.context??e.options.context??{},f={params:r.params,location:o,navigate:t=>e.navigate({...t,_fromLocation:o}),buildLocation:e.buildLocation,cause:l?`preload`:r.cause,abortController:n[0],preload:l,matches:s,routeId:u.id};try{let e=r._ctx||=u.options.context?u.options.context({...f,deps:r.loaderDeps,context:d})||{}:void 0;r.context={...d,...e}}catch(a){return Pr(e,r),[i,jr(e,t,u,a,n)]}if(c.aborted)return[i,Tr];let p=r.paramsError??r.searchError;if(p!==void 0)return Pr(e,r),[i,jr(e,t,u,p,n)];let m=u.options.beforeLoad;if(!m)continue;let h=r.status;i>=a&&(r.status=`pending`,n[7]?.());try{Ir(e,r,`beforeLoad`,n[0]);let a=m({...f,search:r.search,context:r.context,...e.options.additionalContext}),o=await(typeof a?.then==`function`?Dr(a,c):a);if(c.aborted)return[i,Tr];let s=Kr(e,t,u,kr(o,!1,u.id),n);if(s[0]!==Sr)return Pr(e,r),[i,s];r.context={...r.context,...o}}catch(a){return Pr(e,r),[i,jr(e,t,u,a,n)]}finally{r.status=h,Ir(e,r,!1,n[0])}}i()}function Nr(e,t,n){if(!(!n||--n[2])){if(e._flights?.get(t.id)===n){let n=e._tx;if(n&&!n[0].signal.aborted&&!n[3].includes(t)&&n[3].some(e=>e.id===t.id)&&n[3].some(e=>e.isFetching===`beforeLoad`))return;e._flights.delete(t.id)}return n[1]}}function Pr(e,t){let n=t._flight;t._flight=void 0,Nr(e,t,n)?.abort()}function V(e,t,n,r){let i=[];for(let a of t)if(!n?.includes(a)){let t=a._flight;if(a._flight=void 0,r&&t?.[2]===1&&e._flights?.get(a.id)===t&&n?.some(e=>e.id===a.id))t[2]=0;else{let n=Nr(e,a,t);n&&i.push(n)}}for(let e of i)e.abort()}function Fr(e){for(let t of e){let e=t._flight;e&&e[2]++}}function Ir(e,t,n,r){if(t.isFetching=n,r&&e._tx?.[0]!==r)return;let i=e.stores.byRoute.get(t.routeId),a=i?.get();a?.id===t.id&&i.set({...a,isFetching:n})}function Lr(e,t,n,r,i,a,o){let s=t[0];return{params:n.params,location:s,navigate:t=>e.navigate({...t,_fromLocation:s}),cause:o?`preload`:n.cause,abortController:i,preload:o,deps:n.loaderDeps,parentMatchPromise:a,context:n.context,route:r,...e.options.additionalContext}}async function Rr(e,t,n,r,i,a,o){let s=o[0],c=s.signal;if(c.aborted)return Tr;if(!i)return[Sr,void 0];let l=n._flight;Ir(e,n,`loader`,s);try{if(!l){let s=new AbortController;l=[Promise.resolve().then(()=>i(Lr(e,t,n,r,s,a,!!o[3]))).then(e=>kr(e,!1,r.id),e=>kr(e,!0,r.id)).then(t=>(t[0]!==Sr&&e._flights?.get(n.id)===l&&(e._flights.delete(n.id),l[2]||s.abort()),t[0]===Cr&&l[2]?Ar(r,t[1]):t)),s,1],(e._flights??=new Map).set(n.id,l)}return n._flight=l,n.abortController=l[1],Kr(e,t,r,await Dr(l[0],c),o)}catch(t){if(t!==c||!c.aborted)throw t;return Pr(e,n),Tr}finally{Ir(e,n,!1,s)}}function zr(e,t,n){t[0]!==B&&(e.status=`success`,e.error=void 0,t[0]===Sr?(e.loaderData=t[1],e.invalid=!1,e.updatedAt=Date.now(),e.preload=n):e.invalid=!0)}function Br(e,t,n){let r=e._cache.get(t.id);if(r!==n||e._committed.some(e=>e.id===t.id&&e._flight===t._flight))return;let i={...t,_notFound:void 0,context:{}};i._flight&&i._flight[2]++,e._cache.set(t.id,i),r&&Pr(e,r)}function Vr(e,t){return t[0]===Cr||t[0]===wr?{...e,status:t[0]===Cr?`error`:`notFound`,error:t[1],_flight:void 0}:e}function Hr(e,t,n,r,i,a,o){let s=t[1][n],c=Or(e,s),l=!!a[3],u=e._cache.get(s.id),d,f=!1,p;try{if(s.status===`success`&&(d=c.options.shouldReload,typeof d==`function`&&(d=d(Lr(e,t,s,c,a[0],i,l))),a[0].signal.aborted&&(p=Tr)),!p){if(s.status!==`success`)f=!0;else{let t=l||s.preload?c.options.preloadStaleTime??e.options.defaultPreloadStaleTime??3e4:c.options.staleTime??e.options.defaultStaleTime??0;f=!!(s.invalid||d||d===void 0&&Date.now()-s.updatedAt>=t&&(a[5]||s.cause===`enter`||a[2].some(e=>e.routeId===s.routeId&&e.id!==s.id)))}}}catch(n){s.invalid=!0,Pr(e,s),p=jr(e,t,c,n,a)}let m=c.options.loader,h=typeof m==`function`,g=h?m:m?.handler,_=!l||c.options.preload!==!1,v=_&&m?e._flights?.get(s.id):void 0;v===s._flight||p?v=void 0:v&&!f&&!l&&d===void 0?f=!0:f||(v=void 0);let y=!(!m||!f||s.status!==`success`||l||a[4]||((h?void 0:m.staleReloadMode)??e.options.defaultStaleReloadMode)===`blocking`),b=f&&_,x=b&&!y&&(s.status!==`success`||!!m),S=n>=o?a[7]:void 0,C=c.lazyFn&&c._lazy!==!0?S:void 0;if(b&&!m&&(s.invalid=!1,s.updatedAt=Date.now()),v&&v[2]++,x){let t=s._flight;s._flight=v,Nr(e,s,t)?.abort(),n>=o&&(s.status=`pending`),S?.()}b||(s.isFetching=!1);let w=!p&&x?Rr(e,t,s,c,g,i,a).then(t=>(zr(s,t,l),t[0]===Sr&&(m&&!a[0].signal.aborted&&Br(e,s,u),n>=o&&(s.status=`pending`)),t)):Promise.resolve(p??[Sr,s.loaderData]),T=(async()=>{try{let e=br(c,void 0,C);e&&await Dr(e,a[0].signal)}catch(r){if(!t[1].some((e,t)=>t<=n&&(e.status===`error`||e.status===`notFound`||e._notFound)))return[n,jr(e,t,c,r,a)]}let r=await w;x&&r[0]===Sr&&s.status===`pending`&&!a[0].signal.aborted&&(s.status=`success`,S?.())})();if(r.push([n,w,T]),!y)return w.then(e=>Vr(s,e));let E={...s,status:`pending`,preload:!1,_flight:v};s.invalid=!1,s.isFetching=`loader`;let D=Rr(e,t,E,c,g,i,a).then(e=>(s.isFetching=!1,zr(E,e,!1),e));return(t[2]??=[]).push([n,D,T,E]),D.then(e=>Vr(E,e))}async function Ur(e,t,n,r,i=0){let a=n?.[1][1],o=a?.routeId?t.findIndex(e=>e.routeId===a.routeId):n?.[0]??t.length-1;o<0&&(o=0);for(let n=o;n>=0;n--){let i=Or(e,t[n]);try{let e=br(i,!1);e&&await Dr(e,r)}catch(e){if(e===r&&r.aborted)throw e}if(i.options.notFoundComponent)return n}return a?.routeId?o:i}function Wr(e,t){t[2]&&=(V(e,t[2].map(e=>e[3])),void 0)}async function Gr(e,t,n,r){let i;try{await Promise.all(e.map(e=>e[1].then(async t=>{let a=e[0];if(!(r&&a>=await r)){if(t[0]>=B)throw[a,t];!i&&t[0]!==Sr&&(i=[a,t],await Promise.all((n??[]).map(e=>{if(!(e[0]<=a))return e[1].then(t=>{if(t[0]===B)throw[e[0],t]})})))}})))}catch(e){return e}return t??i}function Kr(e,t,n,r,i,a){for(;r[0]===B;){let o=r[1],s=o.options;try{if((s.href||o.headers.has(`Location`))&&(e.resolveRedirect(o),s.reloadDocument)||(s.reloadDocument?i[3]:i[1]>=20))return r;let n=e.buildLocation({...s,_fromLocation:t[0],_includeValidateSearch:!0}),a=n.maskedLocation??n;if(a.external){let t=o.clone();return t.options={...s},t.headers.set(`Location`,a.publicHref),e.resolveRedirect(t),i[3]?[B,t]:[B,t,a]}return[B,o,n]}catch(e){r=a?[Cr,e]:Ar(n,e),a=!0}}return r}async function qr(e,t,n,r,i,a){let o=t[1],s=await i,c=!1,l=o.findIndex(e=>e._notFound),u=t=>t[1][0]===wr?Ur(e,o,t,r.signal):t[0],d=l<0?o.length:l;if((s?.[1][0]??0)>=B)d=0;else if(s){d=s[2]??=await u(s);for(let e of n){if(e[0]>=d)break;let t=await e[1];if(t[0]!==Sr&&t[0]<B&&!(`loaderData`in o[e[0]])){s=[e[0],t],d=s[2]=await u(s);break}}}for(let e of n){if(e[0]>=d)break;let t=await e[2];if(t){s=t;break}}if((s?.[1][0]??0)>=B){let n=s[1];if(n[0]!==B||n[1].options.reloadDocument||n[2])return Wr(e,t),n;c=!0,s=[0,[Cr,Error(`Too many redirects`)]]}let f=s?s[2]??await u(s):l;if(f>=0){let i=s?.[1],l=i?.[0],u=o[f],d=i?.[1],p=()=>{i&&(u._notFound=void 0,l===Cr?u.status=`error`:(d.routeId=u.routeId,u.routeId===e.routeTree.id?(u.status=`success`,u._notFound=!0):u.status=`notFound`),u.error=d,u.isFetching=!1)};p(),i||a?.();let m=Or(e,u);try{await Dr(i?Promise.resolve().then(()=>br(m,l===Cr?`errorComponent`:`notFoundComponent`)):Promise.all([br(m),br(m,`notFoundComponent`)]),r.signal)}catch(n){if(n===r.signal&&r.signal.aborted)return Wr(e,t),Tr}i?c&&(r.abort(),await Promise.all([...n.map(e=>e[1]),...n.map(e=>e[2]),...(t[2]??[]).map(e=>e[1])]),Wr(e,t),V(e,o),p()):u.status=`success`}return t}async function Jr(e,t,n,r=0,i=t[1].length){let a=t[1];for(let t=r;t<i;t++){let r=a[t],i=Or(e,r).options;if(i.head||i.scripts)try{let t={ssr:e.options.ssr,matches:a,match:r,params:r.params,loaderData:r.loaderData},[o,s]=await Dr(Promise.all([i.head?.(t),i.scripts?.(t)]),n);r.meta=o?.meta,r.links=o?.links,r.headScripts=o?.scripts,r.styles=o?.styles,r.scripts=s}catch(e){if(e===n&&n.aborted)break;console.error(e)}if(r.status!==`success`||r._notFound)break}return t}async function Yr(e,t,n,r){let i=[t,n],a=r[0].signal,o;try{let t=e.stores.matches.get(),s=n.findIndex(e=>e._notFound);if(e.options.notFoundMode!==`root`&&s>=0){let t=await Ur(e,n,void 0,a,s);n[s]._notFound=void 0,n[t]._notFound=!0,s=t}let c=s<0?n.length:s+1,l=0;for(;l<c&&l!==s;){let e=n[l],i=r[2][l],a=t[l];if(i?.id!==e.id||i.status!==`success`||e.preload||a?.id!==e.id||a.status!==`success`||(l++,i._notFound||a._notFound))break}let u=[],d=r[6]??0,f=d?Promise.resolve(n[d-1]):void 0,p=()=>{for(let t=d;t<c&&!a.aborted;t++)f=Hr(e,i,t,u,f,r,l)},m=await Mr(e,i,r,c,p,l);if(m){if(r[4]=!0,c=m[0],m[1][0]===wr){let t=await Ur(e,n,m,a);m[2]=t,c=Math.min(c,t+1)}else m[1][0]>=B&&(c=0);p()}if(!a.aborted&&!r[3]){let t=[];for(let[n,r]of e._flights??[])r[2]||(e._flights.delete(n),t.push(r[1]));for(let e of t)e.abort()}let h=qr(e,i,u,r[0],Gr(u,m,i[2]),r[7]);i[2]?.length&&(i[3]=Gr(i[2],void 0,void 0,h.then(e=>Er(e)?0:xr(n).length,()=>0))),o=await h}catch(t){if(Wr(e,i),t===a&&a.aborted)return Tr;throw t}return Er(o)?o:Jr(e,o,a,r[6]===n.length?r[6]:0)}function Xr(e,t){if(e._tx!==t)return;let n=t[3],r=e.stores.matches.get(),i=e._pending;for(let a=0;a<n.length;a++){let o=n[a],s=o.status===`success`&&!o._notFound,c=r[a]?.id===o.id&&r[a]?.status===`pending`;if(s&&!c)continue;let l=Or(e,o),u=s||o.invalid?0:l.options.pendingMs??e.options.defaultPendingMs,d=l.options.pendingComponent??e.options.defaultPendingComponent;if(!d||typeof u!=`number`||u===1/0){i&&(i[0]=t,i[2]=0,i[4]=!0);return}let f=l.options.pendingMinMs??e.options.defaultPendingMinMs??0,p=!1;if(i?.[1]===o.id?(p=i[0]!==t,i[0]=t):(clearTimeout(i?.[3]),e._pending=i=void 0),i||(e._pending=i=[t,o.id,c?Date.now()+f:t[4]+u,void 0,c||void 0,d]),i[4]&&!p&&i[5]===d)return;if(i[5]=d,!i[4]){clearTimeout(i[3]);let n=i[2]-Date.now();if(n>0){i[3]=setTimeout(()=>Xr(e,t),n);return}i[2]=0}let m=n.map(e=>({...e,_flight:void 0}));m[a].status=`pending`;let h=i[4]=e.startTransition(()=>e.stores.setMatches(m),m).then(t=>(t&&e._pending===i&&i[4]===h&&!i[2]&&(i[2]=Date.now()+f),t));return}}function Zr(e,t){let n=e._pending;(e._tx===t||!e._tx?.[3].some(e=>e.id===n?.[1]))&&(clearTimeout(n?.[3]),e._pending=void 0)}async function Qr(e,t){let n=e._pending;if(!n)return;clearTimeout(n[3]);let r=n[2]-Date.now();if(!n[4]||r<=0||!xr(t[3]).some(e=>e.id===n[1]))return;let i;try{await Dr(new Promise(e=>{i=setTimeout(e,r)}),t[0].signal)}catch{}clearTimeout(i)}function $r(e,t){e._committed=t,e.stores.setMatches(t)}function ei(e,t,n,r){let i=e._committed,a=e._lifecycleEnd,o=e._cache;for(let e of n)e.preload=!1,r&&(e._assetEnd=void 0);let s=xr(n).length,c=new Map;{let t=Date.now(),r=new Set;for(let e=0;e<n.length;e++){let t=n[e];(e<s||t.status===`success`)&&r.add(t.id)}for(let n of[...i,...o.values()]){if(n.status!==`success`||r.has(n.id))continue;let i=Or(e,n);!i.options.loader||t-n.updatedAt>=(n.preload?i.options.preloadGcTime??e.options.defaultPreloadGcTime??3e5:i.options.gcTime??e.options.defaultGcTime??3e5)||c.set(n.id,o.get(n.id)===n?n:{...n,_flight:void 0,isFetching:!1,context:{}})}}t[3]=[],e._cache=c;let l=e._lifecycleEnd=ir(n);$r(e,n),V(e,[...o.values(),...i].filter(e=>e._flight&&c.get(e.id)!==e),n),ar(e,i,n,a,l,t)}async function ti(e,t){let n=e._tx;for(;n&&n!==t;)t=n,await n[5],n=e._tx}function ni(e,t,n){let r=n[1].options,i=n[2];if(!i)return e.navigate({...r,replace:!0,ignoreBlocker:!0});if(r.reloadDocument)return e.navigate({href:(i.maskedLocation??i).publicHref,reloadDocument:!0,replace:!0,ignoreBlocker:!0});i._redirects=t[1]+1,e._pendingLocation=i;let a=e.commitLocation({...i,viewTransition:r.viewTransition,replace:!0,resetScroll:r.resetScroll,hashScrollIntoView:r.hashScrollIntoView,ignoreBlocker:!0});return queueMicrotask(()=>{e._pendingLocation===i&&(e._pendingLocation=void 0)}),a}async function ri(e,t,n,r,i){let a=n.map(e=>({...e}));Fr(a);for(let t of r)Pr(e,a[t[0]]),a[t[0]]=t[3];let o=[t[2],a],s;try{s=await qr(e,o,r,t[0],i)}catch(t){throw V(e,a),t}if(Er(s)){V(e,a),s[0]===B&&e._tx===t&&e._committed===n&&await ni(e,t,s);return}if(await Jr(e,s,t[0].signal),e._tx!==t||e._committed!==n){V(e,a);return}for(let t of a){let n=e._cache.get(t.id);n?._flight&&n._flight===t._flight&&(e._cache.delete(t.id),Pr(e,n))}$r(e,a),V(e,n,a)}async function ii(e,t,n,r,i,a){let o=await Yr(e,t[2],t[3],[t[0],t[1],e._committed,void 0,i,n,a,r]);if(Er(o)){let n=o[0]===B&&e._tx===t;if((!n||o[1].options.reloadDocument)&&Zr(e,t),V(e,t[3]),t[3]=[],!n)return;if(e._tx!==t){Zr(e,t);return}await ni(e,t,o);return}let s=o[1];if(e._tx===t&&await Qr(e,t),e._tx!==t){Zr(e,t),V(e,s),Wr(e,o);return}let c=t[2],l=nr(c,e.stores.resolvedLocation.get()),u=o[2];await e.startViewTransition(async()=>{if(e._tx===t&&await Qr(e,t),e._tx!==t){Zr(e,t),V(e,s),Wr(e,o);return}let n=await e.startTransition(()=>{Zr(e,t),ei(e,t,s,a),e._tx===t&&(e.emit({type:`onLoad`,...l}),e._tx===t&&e.emit({type:`onBeforeRouteMount`,...l}))},s);if(e._tx!==t){Wr(e,o);return}u?.length&&ri(e,t,s,u,o[3]).catch(console.error),e.batch(()=>{e.stores.resolvedLocation.set(c),e.stores.status.set(`idle`),e._tx===t&&e.emit({type:`onResolved`,...l}),n&&e._tx===t&&e.emit({type:`onRendered`,...l})}),e._tx===t&&(e._commitPromise?.resolve(),e._commitPromise=void 0)})}async function ai(e,t){let n=e._tx,r=e.stores.resolvedLocation.get(),i=r??e.stores.location.get(),a=e.latestLocation,o=e._pendingLocation,s=o?.href===a.href?o._redirects??0:0,c=e._handoff,l=c?.[0](),u=new AbortController,d=e._preflight;if(e._preflight=u,l||c?.[1](),d?.abort(),!u.signal.aborted){let t=nr(a,r);e.emit({type:`onBeforeNavigate`,...t}),u.signal.aborted||e.emit({type:`onBeforeLoad`,...t})}if(u.signal.aborted){await ti(e,n);return}let f=i.href===a.href,p=u,m=e.matchRoutes(a,{_controller:u});Fr(m);let h=l?c[1](m):void 0;if(h?p=l:l?.abort(),u.signal.aborted){V(e,m),await ti(e,n);return}e._preflight=void 0;let g,_=()=>ii(e,y,f,()=>Xr(e,y),t?.sync,h),v=t?.sync?new Promise(e=>g=e):Promise.resolve().then(_),y=[p,s,a,m,Date.now(),v.then(()=>ti(e,y))];if(e._tx=y,n){for(let t of e.stores.matches.get()){if(e._tx!==y)break;t.isFetching&&Ir(e,t,!1)}n[0].abort(),V(e,n[3],y[3],!0)}if(e._tx!==y){V(e,y[3]),y[3]=[],g?.(),await ti(e,y);return}e.batch(()=>{e.stores.status.set(`pending`),e.stores.location.set(a)}),(h||!e._committed.length&&m[0]?.status!==`success`&&!m.some(e=>e._notFound))&&Xr(e,y),g?.(_()),await y[5]}async function oi(e,t){let n=e.buildLocation(t);for(let t=0;;t++){let r=e._committed,i=new AbortController,a,o,s;try{try{a=e.matchRoutes(n,{_controller:i}),Fr(a),o=(e._preloads??=new Map).set(i,a),s=await Yr(e,n,a,[i,t,r,!0])}finally{o&&(o=o.delete(i),V(e,a)),i.abort()}if(!Er(s))return s[1];if(!o||s.length<3)return;n=s[2]}catch(e){Vt(e)||console.error(e);return}}}var si=`Error preloading route! ☝️`,ci=class{get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}constructor(e){if(this.init=e=>{this.originalIndex=e,this._branch=void 0;let t=this.options,n=!t?.path&&!t?.id;this.parentRoute=this.options.getParentRoute?.(),n?this._path=dn:this.parentRoute||kt();let r=n?dn:t?.path;r&&r!==`/`&&(r=Mt(r));let i=t?.id||r,a=n?dn:jt((this.parentRoute.id===`__root__`?``:this.parentRoute.id)+`/`+(i??``));r===`__root__`&&(r=`/`);let o=a===`__root__`?`/`:r===void 0?this.parentRoute.fullPath:jt(this.parentRoute.fullPath+`/`+r);this._path=r,this._id=a,this._fullPath=o,this._to=Nt(o)},this.addChildren=e=>this._addFileChildren(e),this._addFileChildren=e=>(Array.isArray(e)&&(this.children=e),typeof e==`object`&&e&&(this.children=Object.values(e)),this),this._addFileTypes=()=>this,this.updateLoader=e=>(Object.assign(this.options,e),this),this.update=e=>(Object.assign(this.options,e),this),this.lazy=e=>(this.lazyFn=e,this),this.redirect=e=>fn({from:this.fullPath,...e}),this.options=e||{},this.isRoot=!e?.getParentRoute,e?.id&&e?.path)throw Error(`Route cannot have both an 'id' and a 'path' option.`)}},li=class extends ci{constructor(e){super(e)}},ui=class extends h.Component{constructor(...e){super(...e),this.state={error:0},this.reset=()=>{this.setState({error:0})}}static getDerivedStateFromProps(e,t){let n=e.getResetKey();return t.error&&t.resetKey!==n?{resetKey:n,error:0}:{resetKey:n}}static getDerivedStateFromError(e){return{error:[e]}}componentDidCatch(e,t){this.props.onCatch?.(e,t)}render(){let e=this.state.error;return e?h.createElement(this.props.errorComponent??di,{error:e[0],reset:this.reset}):this.props.children}};function di({error:e}){let[t,n]=h.useState(!1);return(0,_.jsxs)(`div`,{style:{padding:`.5rem`,maxWidth:`100%`},children:[(0,_.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`.5rem`},children:[(0,_.jsx)(`strong`,{style:{fontSize:`1rem`},children:`Something went wrong!`}),(0,_.jsx)(`button`,{style:{appearance:`none`,fontSize:`.6em`,border:`1px solid currentColor`,padding:`.1rem .2rem`,fontWeight:`bold`,borderRadius:`.25rem`},onClick:()=>n(e=>!e),children:t?`Hide Error`:`Show Error`})]}),(0,_.jsx)(`div`,{style:{height:`.25rem`}}),t?(0,_.jsx)(`div`,{children:(0,_.jsx)(`pre`,{style:{fontSize:`.7em`,border:`1px solid red`,borderRadius:`.25rem`,padding:`.3rem`,color:`red`,overflow:`auto`},children:e?.message?(0,_.jsx)(`code`,{children:e.message}):null})}):null]})}var fi=()=>!0,pi=()=>!1;function mi({children:e,fallback:t=null}){return(0,_.jsx)(h.default.Fragment,{children:hi()?e:t})}function hi(){return h.default.useSyncExternalStore(gi,fi,pi)}function gi(){return()=>{}}var _i=h.createContext(null);function vi(e){return h.useContext(_i)}var yi=h.createContext(void 0),bi=h.createContext(void 0);function xi({update:e,notify:t,unwatched:n}){return{link:r,unlink:i,propagate:a,checkDirty:o,shallowPropagate:s};function r(e,t,n){let r=t.depsTail;if(r!==void 0&&r.dep===e)return;let i=r===void 0?t.deps:r.nextDep;if(i!==void 0&&i.dep===e){i.version=n,t.depsTail=i;return}let a=e.subsTail;if(a!==void 0&&a.version===n&&a.sub===t)return;let o=t.depsTail=e.subsTail={version:n,dep:e,sub:t,prevDep:r,nextDep:i,prevSub:a,nextSub:void 0};i!==void 0&&(i.prevDep=o),r===void 0?t.deps=o:r.nextDep=o,a===void 0?e.subs=o:a.nextSub=o}function i(e,t=e.sub){let r=e.dep,i=e.prevDep,a=e.nextDep,o=e.nextSub,s=e.prevSub;return a===void 0?t.depsTail=i:a.prevDep=i,i===void 0?t.deps=a:i.nextDep=a,o===void 0?r.subsTail=s:o.prevSub=s,s===void 0?(r.subs=o)===void 0&&n(r):s.nextSub=o,a}function a(e){let n=e.nextSub,r;top:do{let i=e.sub,a=i.flags;if(a&60?a&12?a&4?!(a&48)&&c(e,i)?(i.flags=a|40,a&=1):a=0:i.flags=a&-9|32:a=0:i.flags=a|32,a&2&&t(i),a&1){let t=i.subs;if(t!==void 0){let i=(e=t).nextSub;i!==void 0&&(r={value:n,prev:r},n=i);continue}}if((e=n)!==void 0){n=e.nextSub;continue}for(;r!==void 0;)if(e=r.value,r=r.prev,e!==void 0){n=e.nextSub;continue top}break}while(1)}function o(t,n){let r,i=0,a=!1;top:do{let o=t.dep,c=o.flags;if(n.flags&16)a=!0;else if((c&17)==17){if(e(o)){let e=o.subs;e.nextSub!==void 0&&s(e),a=!0}}else if((c&33)==33){(t.nextSub!==void 0||t.prevSub!==void 0)&&(r={value:t,prev:r}),t=o.deps,n=o,++i;continue}if(!a){let e=t.nextDep;if(e!==void 0){t=e;continue}}for(;i--;){let i=n.subs,o=i.nextSub!==void 0;if(o?(t=r.value,r=r.prev):t=i,a){if(e(n)){o&&s(i),n=t.sub;continue}a=!1}else n.flags&=-33;n=t.sub;let c=t.nextDep;if(c!==void 0){t=c;continue top}}return a}while(1)}function s(e){do{let n=e.sub,r=n.flags;(r&48)==32&&(n.flags=r|16,(r&6)==2&&t(n))}while((e=e.nextSub)!==void 0)}function c(e,t){let n=t.depsTail;for(;n!==void 0;){if(n===e)return!0;n=n.prevDep}return!1}}function Si(e,t,n){let r=typeof e==`object`,i=r?e:void 0;return{next:(r?e.next:e)?.bind(i),error:(r?e.error:t)?.bind(i),complete:(r?e.complete:n)?.bind(i)}}var Ci=[],wi=0,{link:Ti,unlink:Ei,propagate:Di,checkDirty:Oi,shallowPropagate:ki}=xi({update(e){return e._update()},notify(e){Ci[ji++]=e,e.flags&=-3},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=17,Fi(e))}}),Ai=0,ji=0,Mi,Ni=0;function Pi(e){try{++Ni,e()}finally{--Ni||Ii()}}function Fi(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=Ei(n,e)}function Ii(){if(!(Ni>0)){for(;Ai<ji;){let e=Ci[Ai];Ci[Ai++]=void 0,e.notify()}Ai=0,ji=0}}function Li(e,t){let n=typeof e==`function`,r=e,i={_snapshot:n?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:+!n,get(){return Mi!==void 0&&Ti(i,Mi,wi),i._snapshot},subscribe(e){let t=Si(e),n={current:!1},r=Ri(()=>{i.get(),n.current?t.next?.(i._snapshot):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=Mi,o=t?.compare??Object.is;if(n)Mi=i,++wi,i.depsTail=void 0;else if(e===void 0)return!1;n&&(i.flags=5);try{let t=i._snapshot,a=typeof e==`function`?e(t):e===void 0&&n?r(t):e;return t===void 0||!o(t,a)?(i._snapshot=a,!0):!1}finally{Mi=a,n&&(i.flags&=-5),Fi(i)}}};return n?(i.flags=17,i.get=function(){let e=i.flags;if(e&16||e&32&&Oi(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&ki(e)}}else e&32&&(i.flags=e&-33);return Mi!==void 0&&Ti(i,Mi,wi),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(Di(e),ki(e),Ii())}},i}function Ri(e){let t=()=>{let t=Mi;Mi=n,++wi,n.depsTail=void 0,n.flags=6;try{return e()}finally{Mi=t,n.flags&=-5,Fi(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:6,notify(){let e=this.flags;e&16||e&32&&Oi(this.deps,this)?t():this.flags=2},stop(){this.flags=0,this.depsTail=void 0,Fi(this)}};return t(),n}var zi=f((e=>{var t=globalThis.React;function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),Bi=f(((e,t)=>{t.exports=zi()})),Vi=f((e=>{var t=globalThis.React,n=Bi();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),Hi=f(((e,t)=>{t.exports=Vi()}))();function Ui(e,t){return e===t}function Wi(e,t=e=>e,n){let r=n?.compare??Ui,i=(0,h.useCallback)(t=>{let{unsubscribe:n}=e.subscribe(t);return n},[e]),a=(0,h.useCallback)(()=>e.get(),[e]);return(0,Hi.useSyncExternalStoreWithSelector)(i,a,a,t,r)}var Gi={};function Ki(e,t){let n=h.useRef();return r=>{let i=e?.select?e.select(r):r;return e?.structuralSharing??t.options.defaultStructuralSharing?n.current=pt(n.current,i):i}}function qi(e){let t=vi(),n=h.useContext(e.from?bi:yi),r=e.from??n,i=t.stores.getMatchStore(r),a=Ki(e,t),o=Wi(i,e=>e?a(e):Gi);if(o!==Gi)return o;(e.shouldThrow??!0)&&kt()}function Ji(e){return qi({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function Yi(e){let{select:t,...n}=e;return qi({...n,select:e=>t?t(e.loaderDeps):e.loaderDeps})}function Xi(e){return qi({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{let n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}function Zi(e){return qi({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function Qi(e){let t=vi();return h.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}function $i(e){return qi({...e,select:t=>e.select?e.select(t.context):t.context})}function ea(...e){let t=h.useRef(e),n=t.current;return e.forEach((e,t)=>{vt(n[t],e,{ignoreUndefined:!1})||(n[t]=e)}),t.current}function ta(e,t){e.preloadRoute(t).catch(e=>{console.warn(e),console.warn(si)})}var na={compare:(e,t)=>e[0]===t[0]&&e[1]===t[1]};function ra(e,t){let n=typeof e==`string`&&Ct(e);if(n)return t.has(n)?e:null}function ia(e,t,n,r,i){let a=Ft(e.pathname,r),o=Ft(t.pathname,r);return(n?.exact?a!==o:!a.startsWith(o)||a.length!==o.length&&a[o.length]!==`/`)||(n?.includeSearch??!0)&&!vt(e.search,t.search,{partial:!n?.exact,ignoreUndefined:!n?.explicitUndefined})?!1:!n?.includeHash||i&&e.hash===t.hash}function aa(e,t,n){let r=vi(),i=h.useRef(null),a=h.useCallback(e=>{if(i.current=e,typeof t==`function`)return t(e);t&&(t.current=e)},[t]),{activeOptions:o,to:s,preload:c,preloadDelay:l,hashScrollIntoView:u,replace:d,startTransition:f,resetScroll:p,viewTransition:m,ignoreBlocker:g,disabled:_,target:v,onClick:y,onBlur:b,onFocus:x,onMouseEnter:S,onMouseLeave:C,onTouchStart:w}=e,T=hi(),[E,D,O]=ea(e.search,e.params,o),[k,A]=h.useMemo(()=>[e,{...e}],[r,e.from,e._fromLocation,e.hash,e.to,E,D,e.state,e.mask,e.unsafeRelative]),j=h.useCallback(e=>{let t=ra(s,r.protocolAllowlist);if(t!==void 0)return[t??void 0];k._fromLocation||(A._fromLocation=e);let n=r.buildLocation(A),i=ma(n,r,_);return[i,!_&&(!i||Ct(i))?void 0:ia(e,n,O,r.basepath,T)]},[O,_,T,k,A,r,s]),[M,N]=Wi(r.stores.location,j,na),P=N===void 0?M:void 0,F=_||M===void 0,ee=h.useRef(!1),I=e.reloadDocument||P||F?!1:c??r.options.defaultPreload,te=l??r.options.defaultPreloadDelay??0,L=h.useCallback(e=>{let t=e?.isIntersecting;if(!(t??I===`intent`)){t===!1&&fa(i);return}if(!te){ta(r,k);return}da.has(i)||da.set(i,setTimeout(()=>{da.delete(i),ta(r,k)},te))},[r,k,i,I,te]);h.useEffect(()=>{I===`render`&&!ee.current&&(ee.current=!0,ta(r,k));let e;return I===`viewport`&&i.current&&typeof IntersectionObserver==`function`&&(e=new IntersectionObserver(e=>L(e.pop()),{rootMargin:`100px`}),e.observe(i.current)),()=>{e?.disconnect(),fa(i)}},[r,k,I,L,i]);let R=la(e,n);if(R.ref=t?a:i,P)return R.href=P,R;let ne=e=>{let t=v??e.currentTarget.getAttribute(`target`);!F&&!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)&&!e.defaultPrevented&&(!t||t===`_self`)&&e.button===0&&(e.preventDefault(),r.navigate({...k,replace:d,resetScroll:p,hashScrollIntoView:u,startTransition:f,viewTransition:m,ignoreBlocker:g}))},re=()=>{I===`intent`&&ta(r,k)},ie=()=>{I===`intent`&&fa(i)};return R.onClick=pa(y,ne),R.onBlur=pa(b,ie),R.onFocus=pa(x,L),R.onMouseEnter=pa(S,L),R.onMouseLeave=pa(C,ie),R.onTouchStart=pa(w,re),ua(R,e,N,M,F,n)}var oa={},sa={className:`active`},ca=new Set([`to`,`params`,`search`,`hash`,`state`,`mask`,`from`,`unsafeRelative`,`_fromLocation`,`reloadDocument`,`preload`,`preloadDelay`,`preloadIntentProximity`,`hashScrollIntoView`,`replace`,`startTransition`,`resetScroll`,`viewTransition`,`ignoreBlocker`,`activeProps`,`inactiveProps`,`activeOptions`,`_asChild`]);function la(e,t){let n={};for(let r in e)ca.has(r)||r===`type`&&t!==void 0||r===`disabled`&&t===`a`||(n[r]=e[r]);return n}function ua(e,t,n,r,i,a){let{activeProps:o,inactiveProps:s,className:c,style:l,target:u}=t,d=st(n?o:s,{})??(n?sa:oa);Object.assign(e,d),e.href=r,a!==`a`&&(e.disabled=i),e.target=u;let f=d.style;(l||f)&&(e.style=l&&f?{...l,...f}:l||f);let p=d.className;return(c||p)&&(e.className=c?p?`${c} ${p}`:c:p),i&&(e.role=`link`,e[`aria-disabled`]=!0),n&&(e[`data-status`]=`active`,e[`aria-current`]=`page`),e}var da=new WeakMap,fa=e=>{clearTimeout(da.get(e)),da.delete(e)},pa=(e,t)=>e?n=>n.defaultPrevented||(e(n),n.defaultPrevented||t(n)):t;function ma(e,t,n){if(n)return;let r=e.maskedLocation??e,i=r.external?r.publicHref:t.history.createHref(r.publicHref)||`/`;if(!r.external&&i===r.publicHref||!Tt(i,t.protocolAllowlist))return i}var ha=h.memo(h.forwardRef((e,t)=>{let n=e._asChild||`a`,r=aa(e,t,n),i=typeof e.children==`function`?e.children({isActive:r[`data-status`]===`active`}):e.children;return h.createElement(n,r,i)}),ga);function ga(e,t){let n=0;for(let r in t)if(n++,e[r]!==t[r]&&(!ca.has(r)||!vt(e[r],t[r],{ignoreUndefined:!1})))return!1;for(let t in e)n--;return n===0}var _a=class extends ci{constructor(e){super(e),this.useMatch=e=>qi({...e,from:this.id}),this.useRouteContext=e=>$i({...e,from:this.id}),this.useSearch=e=>Zi({...e,from:this.id}),this.useParams=e=>Xi({...e,from:this.id}),this.useLoaderDeps=e=>Yi({...e,from:this.id}),this.useLoaderData=e=>Ji({...e,from:this.id}),this.useNavigate=()=>Qi({from:this.fullPath}),this.Link=h.default.forwardRef((e,t)=>(0,_.jsx)(ha,{ref:t,from:this.fullPath,...e}))}};function va(e){return new _a(e)}var ya=class extends li{constructor(e){super(e),this.useMatch=e=>qi({...e,from:this.id}),this.useRouteContext=e=>$i({...e,from:this.id}),this.useSearch=e=>Zi({...e,from:this.id}),this.useParams=e=>Xi({...e,from:this.id}),this.useLoaderDeps=e=>Yi({...e,from:this.id}),this.useLoaderData=e=>Ji({...e,from:this.id}),this.useNavigate=()=>Qi({from:this.fullPath}),this.Link=h.default.forwardRef((e,t)=>(0,_.jsx)(ha,{ref:t,from:this.fullPath,...e}))}};function ba(e){return new ya(e)}function xa(e){let t=vi(),n=`not-found-${Wi(t.stores.location,e=>e.pathname)}-${Wi(t.stores.status)}`;return(0,_.jsx)(ui,{getResetKey:()=>n,onCatch:(t,n)=>{if(Vt(t))e.onCatch?.(t,n);else throw t},errorComponent:({error:t})=>{if(Vt(t))return e.fallback?.(t);throw t},children:e.children})}function Sa(){return(0,_.jsx)(`p`,{children:`Not Found`})}function Ca(e){return(0,_.jsx)(_.Fragment,{children:e.children})}function wa(e,t,n){return t.options.notFoundComponent?(0,_.jsx)(t.options.notFoundComponent,{...n}):e.options.defaultNotFoundComponent?(0,_.jsx)(e.options.defaultNotFoundComponent,{...n}):(0,_.jsx)(Sa,{})}function Ta(e,t){let n=t?.options.pendingComponent??e.options.defaultPendingComponent;return n?(0,_.jsx)(n,{}):null}var Ea=(e,t)=>e[0]===t[0]&&e[1]===t[1],Da=(e,t,n)=>!t.isRoot||t.options.shellComponent||t.options.wrapInSuspense||n===!1||n===`data-only`||!e.ssr,Oa=h.memo(function({routeId:e}){let t=vi();return(0,_.jsx)(ka,{router:t,match:Wi(t.stores.getMatchStore(e))})});function ka({router:e,match:t}){let n=e.routesById[t.routeId],r=Ta(e,n),i=n.options.errorComponent??e.options.defaultErrorComponent,a=n.options.onCatch??e.options.defaultOnCatch,o=n.isRoot?n.options.notFoundComponent??e.options.notFoundRoute?.options.component:n.options.notFoundComponent,s=t.ssr===!1||t.ssr===`data-only`,c=Da(e,n,t.ssr)&&(n.options.wrapInSuspense??r??(n.options.errorComponent?.preload||s))?h.Suspense:Ca,l=i?ui:Ca,u=o?xa:Ca;return(0,_.jsxs)(n.isRoot?n.options.shellComponent??Ca:Ca,{children:[(0,_.jsx)(yi.Provider,{value:t.routeId,children:(0,_.jsx)(c,{fallback:r,children:(0,_.jsx)(l,{getResetKey:()=>t,errorComponent:i,onCatch:(e,n)=>{if(Vt(e))throw e.routeId??=t.routeId,e;a?.(e,n)},children:(0,_.jsx)(u,{fallback:e=>{if(e.routeId??=t.routeId,e.routeId!==t.routeId)throw e;return h.createElement(o,e)},children:s?(0,_.jsx)(mi,{fallback:r,children:(0,_.jsx)(Aa,{match:t})}):(0,_.jsx)(Aa,{match:t})})})})}),null]})}var Aa=h.memo(function({match:e}){let t=vi(),n=e.routeId,r=t.routesById[n],i=h.useMemo(()=>{let i=(r.options.remountDeps??t.options.defaultRemountDeps)?.({routeId:n,loaderDeps:e.loaderDeps,params:e._strictParams,search:e._strictSearch});return i?JSON.stringify(i):void 0},[n,e.loaderDeps,e._strictParams,e._strictSearch,r.options.remountDeps,t.options.defaultRemountDeps]),a=h.useMemo(()=>{let e=r.options.component??t.options.defaultComponent;return e?(0,_.jsx)(e,{},i):(0,_.jsx)(ja,{})},[i,r.options.component,t.options.defaultComponent]);if(e.status===`pending`){if(t.ssr&&!Da(t,r,e.ssr))return a;if(t._tx)throw t._tx[5];return Ta(t,r)}if(e.status===`notFound`)return wa(t,r,e.error);if(e.status===`error`)throw e.error;return a}),ja=h.memo(function(){let e=vi(),t=h.useContext(yi),n,r,i;{let a=e.stores.getMatchStore(t);[n,r]=Wi(a,e=>[!!e._notFound,e.error],{compare:Ea}),i=Wi(e.stores.ids,e=>e[e.indexOf(t)+1])}if(n)return wa(e,e.routesById[t],r);if(!i)return null;let a=(0,_.jsx)(Oa,{routeId:i});return t===`__root__`?(0,_.jsx)(h.Suspense,{fallback:Ta(e),children:a}):a});function Ma(e,t){let n=e[1];e.length=0,n?.(t)}function Na({t:e}){let t=vi(),n=t._rendered??=[];return t.startTransition=(r,i)=>new Promise(a=>{Ma(n,!1),n.push(i,a),e(t),h.startTransition(r)}),at(()=>{let e=t.history.subscribe(t.load);t.updateLatestLocation();let r=t.latestLocation,i=t.buildLocation({to:r.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});if(Nt(r.publicHref)!==Nt(i.publicHref))return t.commitLocation({...i,replace:!0,ignoreBlocker:!0}),e;let a=t.stores.resolvedLocation.get();return a?.href===r.href&&a.state.__TSR_key===r.state.__TSR_key?n.push(t.stores.matches.get(),e=>{e&&t.emit({type:`onRendered`,...nr(a,a)})}):t._tx||t.load({sync:!0}).catch(console.error),e},[t,t.history]),null}function Pa(){let e=vi(),t=e.routesById[dn],n=Ta(e,t),r=e.ssr?Ca:h.Suspense,i=(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(Na,{t:h.useState()[1]}),(0,_.jsx)(r,{fallback:n,children:(0,_.jsx)(Fa,{})})]});return e.options.InnerWrap?(0,_.jsx)(e.options.InnerWrap,{children:i}):i}function Fa(){let e=vi(),t=e._rendered,n=Wi(e.stores.matches,e=>t[0]??e),r=n[0],i=r?.routeId;at(()=>{t[0]===n&&Ma(t,!0)},[t,n]);let a=i?(0,_.jsx)(Oa,{routeId:i}):null;return(0,_.jsx)(yi.Provider,{value:i,children:e.options.disableGlobalCatchBoundary?a:(0,_.jsx)(ui,{getResetKey:()=>r,onCatch:void 0,children:a})})}function Ia(){let e=vi();return h.useCallback(t=>{let{pending:n,caseSensitive:r,fuzzy:i,includeSearch:a,...o}=t;return e.matchRoute(o,{pending:n,caseSensitive:r,fuzzy:i,includeSearch:a})},[e,Wi(e.stores.location,e=>e.href),Wi(e.stores.resolvedLocation,e=>e?.href),Wi(e.stores.status)])}var La=e=>({createMutableStore:Li,createReadonlyStore:Li,batch:Pi}),Ra=e=>new za(e),za=class extends or{constructor(e){super(e,La)}};function Ba({router:e,children:t,...n}){ut(n)&&e.update({...e.options,...n,context:{...e.options.context,...n.context}});let r=(0,_.jsx)(_i.Provider,{value:e,children:t});return e.options.Wrap?(0,_.jsx)(e.options.Wrap,{children:r}):r}function Va({router:e,...t}){return(0,_.jsx)(Ba,{router:e,...t,children:(0,_.jsx)(Pa,{})})}function Ha(e){let t=vi();return Wi(t.stores.location,Ki(e,t))}var Ua=(0,h.createContext)(null),Wa={didCatch:!1,error:null},Ga=class extends h.Component{constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=Wa}static getDerivedStateFromError(e){return{didCatch:!0,error:e}}resetErrorBoundary(...e){let{didCatch:t}=this.state;t&&(this.props.onReset?.({args:e,reason:`imperative-api`}),this.setState(Wa))}componentDidCatch(e,t){this.props.onError?.(e,t)}componentDidUpdate(e,t){let{didCatch:n}=this.state,{resetKeys:r}=this.props;n&&t.didCatch&&Ka(e.resetKeys,r)&&(this.props.onReset?.({next:r,prev:e.resetKeys,reason:`keys`}),this.setState(Wa))}render(){let{children:e,fallbackRender:t,FallbackComponent:n,fallback:r}=this.props,{didCatch:i,error:a}=this.state,o=e;if(i){let e={error:a,resetErrorBoundary:this.resetErrorBoundary};if(typeof t==`function`)o=t(e);else if(n)o=(0,h.createElement)(n,e);else if(r!==void 0)o=r;else throw a}return(0,h.createElement)(Ua.Provider,{value:{didCatch:i,error:a,resetErrorBoundary:this.resetErrorBoundary}},o)}};function Ka(e=[],t=[]){return e.length!==t.length||e.some((e,n)=>!Object.is(e,t[n]))}var H=m(f(((e,t)=>{(function(){"use strict";var e={}.hasOwnProperty;function n(){for(var e=``,t=0;t<arguments.length;t++){var n=arguments[t];n&&(e=i(e,r(n)))}return e}function r(t){if(typeof t==`string`||typeof t==`number`)return t;if(typeof t!=`object`)return``;if(Array.isArray(t))return n.apply(null,t);if(t.toString!==Object.prototype.toString&&!t.toString.toString().includes(`[native code]`))return t.toString();var r=``;for(var a in t)e.call(t,a)&&t[a]&&(r=i(r,a));return r}function i(e,t){return t?e?e+` `+t:e+t:e}t!==void 0&&t.exports?(n.default=n,t.exports=n):typeof define==`function`&&typeof define.amd==`object`&&define.amd?define(`classnames`,[],function(){return n}):window.classNames=n})()}))()),qa={primary:`wcpos:bg-wp-admin-theme-color wcpos:text-white wcpos:hover:bg-wp-admin-theme-color-darker-10 wcpos:focus:ring-wp-admin-theme-color`,secondary:`wcpos:bg-white wcpos:text-gray-700 wcpos:border wcpos:border-gray-300 wcpos:hover:bg-gray-50 wcpos:focus:ring-wp-admin-theme-color`,destructive:`wcpos:bg-red-600 wcpos:text-white wcpos:hover:bg-red-700 wcpos:focus:ring-red-500`,outline:`wcpos:bg-transparent wcpos:text-wp-admin-theme-color wcpos:border wcpos:border-wp-admin-theme-color wcpos:hover:bg-wp-admin-theme-color-lightest wcpos:focus:ring-wp-admin-theme-color`,ghost:`wcpos:bg-transparent wcpos:text-gray-700 wcpos:hover:bg-gray-100 wcpos:focus:ring-wp-admin-theme-color`,"ghost-destructive":`wcpos:bg-transparent wcpos:text-red-600 wcpos:hover:bg-red-50 wcpos:focus:ring-red-500`,text:`wcpos:bg-transparent wcpos:text-wp-admin-theme-color wcpos:hover:underline wcpos:focus:ring-wp-admin-theme-color`};function Ja(e){return e===`danger`?`destructive`:e}function U({variant:e=`secondary`,loading:t=!1,disabled:n,className:r,children:i,type:a=`button`,...o}){let s=n||t,c=Ja(e);return(0,_.jsxs)(`button`,{type:a,disabled:s,className:(0,H.default)(`wcpos:inline-flex wcpos:items-center wcpos:justify-center wcpos:rounded-md wcpos:text-sm wcpos:font-medium wcpos:transition-colors wcpos:duration-150`,`wcpos:focus:outline-none wcpos:focus:ring-2 wcpos:focus:ring-offset-2`,c===`text`?`wcpos:px-0 wcpos:py-0`:`wcpos:px-3 wcpos:py-1.5`,qa[c],s?`wcpos:opacity-50 wcpos:cursor-not-allowed`:`wcpos:cursor-pointer`,r),...o,children:[t&&(0,_.jsxs)(`svg`,{"aria-hidden":`true`,focusable:`false`,className:`wcpos:mr-2 wcpos:h-4 wcpos:w-4 wcpos:animate-spin`,xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,children:[(0,_.jsx)(`circle`,{className:`wcpos:opacity-25`,cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,strokeWidth:`4`}),(0,_.jsx)(`path`,{className:`wcpos:opacity-75`,fill:`currentColor`,d:`M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z`})]}),i]})}function Ya({checked:t,onChange:n,label:r,description:i,disabled:a,className:o,labelClassName:s,"aria-label":c}){let l=e.useId(),u=r?`${l}-label`:void 0,d=i?`${l}-description`:void 0,f=e.useCallback(()=>{a||n(!t)},[t,a,n]);return(0,_.jsxs)(`div`,{className:(0,H.default)(`wcpos:flex wcpos:items-center wcpos:gap-3`,o),children:[(0,_.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":t,"aria-label":r?void 0:c,"aria-labelledby":u,"aria-describedby":d,disabled:a,onClick:f,className:(0,H.default)(`wcpos:relative wcpos:inline-flex wcpos:items-center wcpos:h-5 wcpos:w-9 wcpos:shrink-0 wcpos:rounded-full wcpos:border-2 wcpos:border-transparent wcpos:p-0 wcpos:m-0 wcpos:align-middle wcpos:transition-colors wcpos:duration-200 wcpos:ease-in-out wcpos:focus:outline-none wcpos:focus:ring-2 wcpos:focus:ring-wp-admin-theme-color wcpos:focus:ring-offset-2`,t?`wcpos:bg-wp-admin-theme-color`:`wcpos:bg-gray-200`,a?`wcpos:opacity-50 wcpos:cursor-not-allowed`:`wcpos:cursor-pointer`),children:(0,_.jsx)(`span`,{className:(0,H.default)(`wcpos:pointer-events-none wcpos:block wcpos:h-4 wcpos:w-4 wcpos:transform wcpos:rounded-full wcpos:bg-white wcpos:shadow wcpos:ring-0 wcpos:transition wcpos:duration-200 wcpos:ease-in-out`,t?`wcpos:translate-x-4`:`wcpos:translate-x-0`)})}),r&&(0,_.jsxs)(`div`,{onClick:f,children:[(0,_.jsx)(`label`,{id:u,className:(0,H.default)(a?`wcpos:cursor-not-allowed`:`wcpos:cursor-pointer`,s??`wcpos:text-sm wcpos:font-medium wcpos:text-gray-900`),children:r}),i&&(0,_.jsx)(`p`,{id:d,className:`wcpos:text-sm wcpos:text-gray-500`,children:i})]})]})}function Xa({label:t,className:n,id:r,disabled:i,indeterminate:a,...o}){let s=e.useId(),c=r||s,l=e.useRef(null);return e.useEffect(()=>{l.current&&(l.current.indeterminate=!!a&&!o.checked)},[a,o.checked]),(0,_.jsxs)(`div`,{className:(0,H.default)(`wcpos:flex wcpos:items-center wcpos:gap-2`,n),children:[(0,_.jsx)(`input`,{ref:l,id:c,type:`checkbox`,className:(0,H.default)(`wcpos:h-4 wcpos:w-4 wcpos:rounded wcpos:border-gray-300 wcpos:text-wp-admin-theme-color wcpos:focus:ring-wp-admin-theme-color`,i?`wcpos:opacity-50 wcpos:cursor-not-allowed`:`wcpos:cursor-pointer`),disabled:i,...o}),t&&(0,_.jsx)(`label`,{htmlFor:c,className:(0,H.default)(`wcpos:text-sm wcpos:text-gray-700`,i?`wcpos:opacity-50 wcpos:cursor-not-allowed`:`wcpos:cursor-pointer`),children:t})]})}var W=e.forwardRef(({error:e,className:t,type:n=`text`,...r},i)=>(0,_.jsx)(`input`,{ref:i,type:n,"aria-invalid":e||void 0,className:(0,H.default)(`wcpos:block wcpos:w-full wcpos:rounded-md wcpos:border wcpos:px-2.5 wcpos:py-1.5 wcpos:text-sm wcpos:shadow-xs`,`wcpos:transition-colors wcpos:duration-150`,`wcpos:focus:outline-none wcpos:focus:ring-2 wcpos:focus:ring-offset-0`,e?`wcpos:border-red-300 wcpos:focus:border-red-500 wcpos:focus:ring-red-500`:`wcpos:border-gray-300 wcpos:focus:border-wp-admin-theme-color wcpos:focus:ring-wp-admin-theme-color`,r.disabled&&`wcpos:bg-gray-50 wcpos:text-gray-500 wcpos:cursor-not-allowed`,t),...r}));W.displayName=`TextInput`;var Za=e.forwardRef(({error:e,className:t,...n},r)=>(0,_.jsx)(`textarea`,{ref:r,"aria-invalid":e||void 0,className:(0,H.default)(`wcpos:block wcpos:w-full wcpos:rounded-md wcpos:border wcpos:px-2.5 wcpos:py-1.5 wcpos:text-sm wcpos:shadow-xs`,`wcpos:transition-colors wcpos:duration-150`,`wcpos:focus:outline-none wcpos:focus:ring-2 wcpos:focus:ring-offset-0`,e?`wcpos:border-red-300 wcpos:focus:border-red-500 wcpos:focus:ring-red-500`:`wcpos:border-gray-300 wcpos:focus:border-wp-admin-theme-color wcpos:focus:ring-wp-admin-theme-color`,n.disabled&&`wcpos:bg-gray-50 wcpos:text-gray-500 wcpos:cursor-not-allowed`,t),...n}));Za.displayName=`TextArea`;function G({value:e,options:t,onChange:n,placeholder:r,disabled:i,className:a,inline:o,...s}){return(0,_.jsxs)(`select`,{value:String(e),onChange:e=>{let r=t.find(t=>String(t.value)===e.target.value);r&&n(r)},disabled:i,className:(0,H.default)(o?`wcpos:inline-block`:`wcpos:block wcpos:w-full`,`wcpos:rounded-md wcpos:border wcpos:border-gray-300 wcpos:bg-white wcpos:px-2.5 wcpos:py-1.5 wcpos:text-sm wcpos:shadow-xs`,`wcpos:focus:outline-none wcpos:focus:ring-2 wcpos:focus:ring-wp-admin-theme-color wcpos:focus:border-wp-admin-theme-color`,i&&`wcpos:bg-gray-50 wcpos:text-gray-500 wcpos:cursor-not-allowed`,a),...s,children:[r&&(0,_.jsx)(`option`,{value:``,disabled:!0,children:r}),t.map(e=>(0,_.jsx)(`option`,{value:String(e.value),disabled:!!e.disabled,children:e.label},String(e.value)))]})}var Qa=`wcpos:flex wcpos:w-full wcpos:items-center wcpos:justify-between wcpos:gap-2 wcpos:rounded-md wcpos:border wcpos:border-gray-300 wcpos:bg-white wcpos:px-2.5 wcpos:py-1.5 wcpos:text-left wcpos:text-sm wcpos:shadow-xs wcpos:focus:outline-none wcpos:focus:ring-2 wcpos:focus:ring-wp-admin-theme-color wcpos:focus:border-wp-admin-theme-color`,$a=`wcpos:bg-gray-50 wcpos:text-gray-500 wcpos:cursor-not-allowed`;function eo(e){return e.toLowerCase()}function to({countries:t,value:r,onChange:i,placeholder:a,searchPlaceholder:o,noResultsLabel:s,clearable:c=!1,clearLabel:l,disabled:u,className:d,id:f,"aria-label":p}){let m=e.useRef(null),h=e.useRef(null),g=e.useRef(null),v=e.useRef(null),[y,b]=e.useState(!1),[x,S]=e.useState(``),[C,w]=e.useState(0),[T,E]=e.useState({top:0,left:0,width:0}),D=e.useId(),O=e.useMemo(()=>Object.entries(t).map(([e,t])=>({value:e,label:t})).sort((e,t)=>e.label.localeCompare(t.label)),[t]),k=e.useMemo(()=>{let e=eo(x.trim());return e?O.filter(t=>eo(t.label).includes(e)||eo(t.value).includes(e)):O},[O,x]),A=e.useMemo(()=>c?[{value:``,label:l??`—`,isClear:!0},...k]:k,[c,l,k]),j=r?t[r]:``,M=e.useCallback(()=>{if(!m.current)return;let e=m.current.getBoundingClientRect();E({top:e.bottom+4,left:e.left,width:e.width})},[]),N=e.useCallback(()=>{b(!1),S(``)},[]),P=e.useCallback(()=>{if(u)return;b(!0);let e=r?Math.max(0,A.findIndex(e=>!e.isClear&&e.value===r)):+!!c;w(Math.min(e,Math.max(0,A.length-1)))},[c,u,A,r]),F=e.useCallback(e=>{i(e),N(),m.current?.focus()},[N,i]);e.useLayoutEffect(()=>{if(!y)return;M();let e=requestAnimationFrame(()=>g.current?.focus());return()=>cancelAnimationFrame(e)},[y,M]),e.useEffect(()=>{if(!y)return;let e=e=>{let t=e.target;m.current?.contains(t)||h.current?.contains(t)||N()};return document.addEventListener(`mousedown`,e),window.addEventListener(`scroll`,M,!0),window.addEventListener(`resize`,M),()=>{document.removeEventListener(`mousedown`,e),window.removeEventListener(`scroll`,M,!0),window.removeEventListener(`resize`,M)}},[y,N,M]),e.useEffect(()=>{y&&w(e=>A.length===0?0:e>=A.length?A.length-1:e)},[y,A]),e.useEffect(()=>{y&&v.current&&v.current.querySelector(`[data-index="${C}"]`)?.scrollIntoView?.({block:`nearest`})},[y,C]);let ee=e=>{u||(e.key===`ArrowDown`||e.key===`ArrowUp`||e.key===`Enter`||e.key===` `)&&(e.preventDefault(),P())},I=e=>{switch(e.key){case`ArrowDown`:e.preventDefault(),w(e=>A.length===0?0:(e+1)%A.length);break;case`ArrowUp`:e.preventDefault(),w(e=>A.length===0?0:(e-1+A.length)%A.length);break;case`Home`:e.preventDefault(),w(0);break;case`End`:e.preventDefault(),w(Math.max(0,A.length-1));break;case`Enter`:e.preventDefault(),A[C]&&F(A[C].value);break;case`Escape`:e.preventDefault(),N(),m.current?.focus();break;case`Tab`:N()}},te=A.length>0?`${D}-option-${C}`:void 0;return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(`button`,{ref:m,id:f,type:`button`,role:`combobox`,"aria-haspopup":`listbox`,"aria-expanded":y,"aria-controls":y?D:void 0,"aria-label":p,disabled:u,onClick:()=>y?N():P(),onKeyDown:ee,className:(0,H.default)(Qa,u&&$a,d),children:[(0,_.jsx)(`span`,{className:(0,H.default)(`wcpos:truncate`,!j&&`wcpos:text-gray-500`),children:j||a||``}),(0,_.jsx)(`svg`,{"aria-hidden":`true`,className:`wcpos:h-4 wcpos:w-4 wcpos:text-gray-400 wcpos:shrink-0`,viewBox:`0 0 20 20`,fill:`currentColor`,children:(0,_.jsx)(`path`,{fillRule:`evenodd`,d:`M5.23 7.21a.75.75 0 011.06.02L10 11.06l3.71-3.83a.75.75 0 011.08 1.04l-4.24 4.38a.75.75 0 01-1.08 0L5.21 8.27a.75.75 0 01.02-1.06z`,clipRule:`evenodd`})})]}),y&&n.createPortal((0,_.jsxs)(`div`,{ref:h,className:`wcpos:fixed wcpos:z-[99999] wcpos:rounded-md wcpos:border wcpos:border-gray-200 wcpos:bg-white wcpos:shadow-lg`,style:{top:T.top,left:T.left,width:T.width},children:[(0,_.jsx)(`div`,{className:`wcpos:p-2 wcpos:border-b wcpos:border-gray-100`,children:(0,_.jsx)(`input`,{ref:g,type:`text`,role:`searchbox`,"aria-autocomplete":`list`,"aria-controls":D,"aria-activedescendant":te,value:x,onChange:e=>S(e.target.value),onKeyDown:I,placeholder:o,className:`wcpos:block wcpos:w-full wcpos:rounded wcpos:border wcpos:border-gray-300 wcpos:bg-white wcpos:px-2 wcpos:py-1 wcpos:text-sm wcpos:focus:outline-none wcpos:focus:ring-2 wcpos:focus:ring-wp-admin-theme-color wcpos:focus:border-wp-admin-theme-color`})}),(0,_.jsxs)(`ul`,{ref:v,id:D,role:`listbox`,"aria-label":p,className:`wcpos:m-0 wcpos:max-h-60 wcpos:list-none wcpos:overflow-auto wcpos:p-1`,children:[A.map((e,t)=>{let n=t===C,i=e.isClear?r===``:e.value===r;return(0,_.jsx)(`li`,{id:`${D}-option-${t}`,"data-index":t,role:`option`,"aria-selected":i,onMouseDown:e=>e.preventDefault(),onMouseEnter:()=>w(t),onClick:()=>F(e.value),className:(0,H.default)(`wcpos:flex wcpos:cursor-pointer wcpos:items-center wcpos:gap-2 wcpos:rounded wcpos:px-2 wcpos:py-1 wcpos:text-sm`,e.isClear?`wcpos:text-gray-500`:`wcpos:justify-between wcpos:text-gray-700`,n&&`wcpos:bg-gray-100`,i&&(e.isClear?`wcpos:font-medium wcpos:text-gray-700`:`wcpos:font-medium`)),children:e.isClear?(0,_.jsx)(`span`,{className:`wcpos:truncate`,children:e.label}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(`span`,{className:`wcpos:truncate`,children:e.label}),(0,_.jsx)(`span`,{className:`wcpos:text-xs wcpos:text-gray-400`,children:e.value})]})},e.isClear?`__clear__`:e.value)}),k.length===0&&(0,_.jsx)(`li`,{role:`presentation`,className:`wcpos:px-2 wcpos:py-2 wcpos:text-sm wcpos:text-gray-500`,children:s??`No results`})]})]}),document.body)]})}var no=`wcpos:relative wcpos:flex wcpos:w-full wcpos:items-center wcpos:rounded-md wcpos:border wcpos:border-gray-300 wcpos:bg-white wcpos:text-sm wcpos:shadow-xs wcpos:transition-colors wcpos:duration-150 wcpos:focus-within:border-wp-admin-theme-color wcpos:focus-within:ring-2 wcpos:focus-within:ring-wp-admin-theme-color`,ro=`wcpos:bg-gray-50 wcpos:text-gray-500 wcpos:cursor-not-allowed`,io=`wcpos:block wcpos:w-full wcpos:flex-1 wcpos:border-0 wcpos:bg-transparent wcpos:px-2.5 wcpos:py-1.5 wcpos:pr-0 wcpos:text-inherit wcpos:focus:outline-none wcpos:focus:ring-0`,ao=`wcpos:flex wcpos:h-full wcpos:items-center wcpos:px-1.5 wcpos:text-gray-400 wcpos:hover:text-gray-600 wcpos:focus:outline-none wcpos:disabled:cursor-not-allowed wcpos:disabled:hover:text-gray-400`;function oo(e){return e.toLowerCase()}function so(e,t,n){let r=t.find(t=>t.value===e);return r?r.label:n?e:``}function co({value:t,options:r,onChange:i,allowCustomValue:a=!1,createLabel:o,onQuery:s,placeholder:c,noResultsLabel:l,loading:u=!1,loadingLabel:d,disabled:f,className:p,id:m,"aria-label":h,"aria-labelledby":g}){let v=e.useRef(null),y=e.useRef(null),b=e.useRef(null),x=e.useRef(null),[S,C]=e.useState(!1),[w,T]=e.useState(()=>so(t,r,a)),[E,D]=e.useState(-1),[O,k]=e.useState({top:0,left:0,width:0}),A=e.useId(),j=s!==void 0;e.useEffect(()=>{S||T(so(t,r,a))},[t,r,S,a]);let M=e.useMemo(()=>{let e=w.trim(),t=oo(e),n=!j&&S&&t?r.filter(e=>oo(e.label).includes(t)||oo(e.value).includes(t)):r.slice();return S&&a&&o&&e&&(r.some(e=>oo(e.label)===t||oo(e.value)===t)||n.push({value:e,label:o(e),isCreate:!0})),n},[a,o,w,S,r,j]),N=e.useCallback(()=>{if(!v.current)return;let e=v.current.getBoundingClientRect();k({top:e.bottom+4,left:e.left,width:e.width})},[]),P=e.useCallback(()=>{C(!1)},[]),F=e.useCallback(()=>{f||(C(!0),D(-1))},[f]),ee=e.useCallback(e=>{let t=e.isCreate?e.value:e.label;T(t),P(),i(e.value)},[P,i]),I=e.useCallback(()=>{let e=w.trim(),n=r.find(t=>oo(t.label)===oo(e));if(n){T(n.label),P(),n.value!==t&&i(n.value);return}if(a){T(e),P(),e!==t&&i(e);return}T(so(t,r,a)),P()},[a,P,w,i,r,t]),te=e.useRef(I);e.useEffect(()=>{te.current=I},[I]),e.useLayoutEffect(()=>{S&&N()},[S,N]),e.useEffect(()=>{if(!S)return;let e=e=>{let t=e.target;v.current?.contains(t)||b.current?.contains(t)||te.current()};return document.addEventListener(`mousedown`,e),window.addEventListener(`scroll`,N,!0),window.addEventListener(`resize`,N),()=>{document.removeEventListener(`mousedown`,e),window.removeEventListener(`scroll`,N,!0),window.removeEventListener(`resize`,N)}},[S,N]),e.useEffect(()=>{S&&D(e=>M.length===0?-1:e>=M.length?M.length-1:e)},[S,M]),e.useEffect(()=>{S&&x.current&&x.current.querySelector(`[data-index="${E}"]`)?.scrollIntoView?.({block:`nearest`})},[S,E]);let L=e=>{let t=e.target.value;T(t),S||C(!0),D(t.trim()===``?-1:0),s?.(t)},R=()=>{if(f)return;C(!0);let e=y.current;e&&requestAnimationFrame(()=>e.select())},ne=e=>{let t=e.relatedTarget;t&&(v.current?.contains(t)||b.current?.contains(t))||te.current()},re=e=>{if(!f)switch(e.key){case`ArrowDown`:if(e.preventDefault(),!S){F();return}D(e=>M.length===0?-1:e===-1?0:(e+1)%M.length);break;case`ArrowUp`:if(e.preventDefault(),!S){F();return}D(e=>M.length===0?-1:e===-1?M.length-1:(e-1+M.length)%M.length);break;case`Home`:S&&M.length>0&&(e.preventDefault(),D(0));break;case`End`:S&&M.length>0&&(e.preventDefault(),D(M.length-1));break;case`Enter`:if(S&&E>=0&&M[E]){e.preventDefault(),ee(M[E]);return}e.preventDefault(),I();break;case`Escape`:S&&(e.preventDefault(),T(so(t,r,a)),P());break;case`Tab`:S&&I()}},ie=e=>{e.preventDefault(),!f&&(S?P():(F(),y.current?.focus()))},ae=S&&E>=0&&M.length>0?`${A}-option-${E}`:void 0;return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(`div`,{ref:v,className:(0,H.default)(no,f&&ro,p),children:[(0,_.jsx)(`input`,{ref:y,id:m,type:`text`,role:`combobox`,"aria-haspopup":`listbox`,"aria-expanded":S,"aria-controls":S?A:void 0,"aria-autocomplete":`list`,"aria-activedescendant":ae,"aria-label":h,"aria-labelledby":g,autoComplete:`off`,"data-1p-ignore":!0,"data-lpignore":`true`,disabled:f,value:w,placeholder:c,onChange:L,onFocus:R,onBlur:ne,onKeyDown:re,className:io}),(0,_.jsx)(`button`,{type:`button`,tabIndex:-1,"aria-hidden":`true`,disabled:f,onMouseDown:ie,className:ao,children:(0,_.jsx)(`svg`,{className:`wcpos:h-4 wcpos:w-4`,viewBox:`0 0 20 20`,fill:`currentColor`,"aria-hidden":`true`,children:(0,_.jsx)(`path`,{fillRule:`evenodd`,d:`M5.23 7.21a.75.75 0 011.06.02L10 11.06l3.71-3.83a.75.75 0 011.08 1.04l-4.24 4.38a.75.75 0 01-1.08 0L5.21 8.27a.75.75 0 01.02-1.06z`,clipRule:`evenodd`})})})]}),S&&n.createPortal((0,_.jsx)(`div`,{ref:b,className:`wcpos:fixed wcpos:z-[99999] wcpos:rounded-md wcpos:border wcpos:border-gray-200 wcpos:bg-white wcpos:shadow-lg`,style:{top:O.top,left:O.left,width:O.width},children:(0,_.jsx)(`ul`,{ref:x,id:A,role:`listbox`,"aria-label":h,className:`wcpos:m-0 wcpos:max-h-60 wcpos:list-none wcpos:overflow-auto wcpos:p-1`,children:u?(0,_.jsx)(`li`,{role:`presentation`,className:`wcpos:px-2 wcpos:py-2 wcpos:text-sm wcpos:text-gray-500`,children:d??`Loading…`}):M.length===0?(0,_.jsx)(`li`,{role:`presentation`,className:`wcpos:px-2 wcpos:py-2 wcpos:text-sm wcpos:text-gray-500`,children:l??`No results`}):M.map((e,n)=>{let r=n===E,i=!e.isCreate&&e.value===t;return(0,_.jsx)(`li`,{id:`${A}-option-${n}`,"data-index":n,role:`option`,"aria-selected":i,onMouseDown:e=>e.preventDefault(),onMouseEnter:()=>D(n),onClick:()=>ee(e),className:(0,H.default)(`wcpos:flex wcpos:cursor-pointer wcpos:items-center wcpos:rounded wcpos:px-2 wcpos:py-1 wcpos:text-sm`,e.isCreate?`wcpos:text-wp-admin-theme-color`:`wcpos:text-gray-700`,r&&`wcpos:bg-gray-100`,i&&`wcpos:font-medium`),children:(0,_.jsx)(`span`,{className:`wcpos:truncate`,children:e.label})},e.isCreate?`__create__-${A}`:e.value)})})}),document.body)]})}function lo({open:t,onClose:n,title:r,"aria-label":i,description:a,children:o,className:s}){let c=e.useId(),l=e.useId();return e.useEffect(()=>{if(!t)return;let e=e=>{e.key===`Escape`&&n(!1)};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e)}},[t,n]),t?(0,_.jsxs)(`div`,{className:`wcpos:relative wcpos:z-50`,children:[(0,_.jsx)(`div`,{className:`wcpos:fixed wcpos:inset-0 wcpos:bg-black/30`,"aria-hidden":`true`}),(0,_.jsx)(`div`,{className:`wcpos:fixed wcpos:inset-0 wcpos:flex wcpos:items-center wcpos:justify-center wcpos:p-4`,onClick:()=>n(!1),children:(0,_.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":r?c:void 0,"aria-label":r?void 0:i,"aria-describedby":a?l:void 0,onClick:e=>e.stopPropagation(),className:(0,H.default)(`wcpos:mx-auto wcpos:max-w-lg wcpos:w-full wcpos:rounded-lg wcpos:bg-white wcpos:p-6 wcpos:shadow-xl`,s),children:[r&&(0,_.jsx)(`h2`,{id:c,className:`wcpos:text-lg wcpos:font-semibold wcpos:text-gray-900 wcpos:mb-2`,children:r}),a&&(0,_.jsx)(`p`,{id:l,className:`wcpos:text-sm wcpos:text-gray-500 wcpos:mb-4`,children:a}),o]})})]}):null}function uo({text:t,children:r,className:i}){let a=e.useRef(null),[o,s]=e.useState(!1),[c,l]=e.useState({top:0,left:0}),u=e.useId(),d=e.useCallback(()=>{if(!a.current)return;let e=a.current.getBoundingClientRect();l({top:e.top-4,left:e.left+e.width/2})},[]),f=e.useCallback(()=>{d(),s(!0)},[d]),p=e.useCallback(()=>s(!1),[]);return e.useEffect(()=>{if(o)return window.addEventListener(`scroll`,d,!0),window.addEventListener(`resize`,d),()=>{window.removeEventListener(`scroll`,d,!0),window.removeEventListener(`resize`,d)}},[o,d]),(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(`span`,{ref:a,className:(0,H.default)(`wcpos:inline-flex`,i),onMouseEnter:f,onMouseLeave:p,onFocus:f,onBlur:p,"aria-describedby":o?u:void 0,tabIndex:0,children:r}),o&&n.createPortal((0,_.jsx)(`span`,{id:u,role:`tooltip`,className:`wcpos:fixed wcpos:z-[99999] wcpos:whitespace-nowrap wcpos:rounded wcpos:bg-gray-900 wcpos:px-2 wcpos:py-1 wcpos:text-xs wcpos:text-white wcpos:shadow-lg wcpos:pointer-events-none wcpos:-translate-x-1/2 wcpos:-translate-y-full`,style:{top:c.top,left:c.left},children:t}),document.body)]})}var fo=e.createContext(null);function po({trigger:t,children:r,align:i=`end`,offset:a=4,className:o,label:s}){let c=e.useRef(null),l=e.useRef(null),[u,d]=e.useState(!1),[f,p]=e.useState({top:0,left:0}),m=e.useId(),h=e.useCallback(()=>{if(!c.current)return;let e=c.current.getBoundingClientRect(),t=l.current?.offsetWidth??0,n=i===`end`?e.right-t:e.left;p({top:e.bottom+a,left:n})},[i,a]),g=e.useCallback(()=>d(!1),[]),v=e.useCallback(()=>{d(e=>!e)},[]);e.useLayoutEffect(()=>{u&&h()},[u,h]),e.useEffect(()=>{if(!u)return;let e=e=>{let t=e.target;c.current?.contains(t)||l.current?.contains(t)||g()},t=e=>{e.key===`Escape`&&(g(),c.current?.focus())};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),window.addEventListener(`scroll`,h,!0),window.addEventListener(`resize`,h),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t),window.removeEventListener(`scroll`,h,!0),window.removeEventListener(`resize`,h)}},[u,g,h]);let y=e.useMemo(()=>({close:g}),[g]);return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(`span`,{ref:c,className:(0,H.default)(`wcpos:inline-flex`,o),onClick:v,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),v())},role:`button`,tabIndex:0,"aria-haspopup":`menu`,"aria-expanded":u,"aria-controls":u?m:void 0,children:t}),u&&n.createPortal((0,_.jsx)(`div`,{ref:l,id:m,role:`menu`,"aria-label":s,className:`wcpos:fixed wcpos:z-[99999] wcpos:min-w-[180px] wcpos:rounded-md wcpos:border wcpos:border-gray-200 wcpos:bg-white wcpos:py-1 wcpos:shadow-lg`,style:{top:f.top,left:f.left},children:(0,_.jsx)(fo.Provider,{value:y,children:r})}),document.body)]})}function mo({children:t,onSelect:n,href:r,disabled:i,target:a,rel:o,destructive:s}){let c=e.useContext(fo),l=(0,H.default)(`wcpos:flex wcpos:w-full wcpos:items-center wcpos:px-3 wcpos:py-1.5 wcpos:text-sm wcpos:text-left wcpos:no-underline wcpos:bg-transparent wcpos:border-0 wcpos:cursor-pointer wcpos:focus:outline-none`,s?`wcpos:text-red-600 wcpos:hover:bg-red-50 wcpos:focus:bg-red-50`:`wcpos:text-gray-700 wcpos:hover:bg-gray-100 wcpos:focus:bg-gray-100`,i&&`wcpos:opacity-50 wcpos:cursor-not-allowed wcpos:hover:bg-transparent`),u=e=>{if(i){e.preventDefault();return}n?.(),c?.close()};return r?(0,_.jsx)(`a`,{href:i?void 0:r,target:a,rel:o,role:`menuitem`,className:l,"aria-disabled":i,onClick:u,children:t}):(0,_.jsx)(`button`,{type:`button`,role:`menuitem`,className:l,disabled:i,onClick:u,children:t})}po.Item=mo;function ho({active:e=!1,className:t,children:n,...r}){return(0,_.jsx)(`div`,{className:(0,H.default)(`wcpos:bg-white wcpos:border wcpos:rounded-lg wcpos:overflow-hidden wcpos:flex wcpos:flex-col`,e?`wcpos:border-wp-admin-theme-color wcpos:ring-1 wcpos:ring-wp-admin-theme-color`:`wcpos:border-gray-200`,t),...r,children:n})}function go({noPadding:e=!1,className:t,children:n,...r}){return(0,_.jsx)(`div`,{className:(0,H.default)(`wcpos:flex-1`,!e&&`wcpos:p-4`,t),...r,children:n})}function _o({className:e,children:t,...n}){return(0,_.jsx)(`div`,{className:(0,H.default)(`wcpos:border-t wcpos:border-gray-200 wcpos:bg-gray-50 wcpos:px-4 wcpos:py-2.5`,e),...n,children:t})}ho.Body=go,ho.Footer=_o;var vo={info:`wcpos:bg-blue-50 wcpos:border-blue-200 wcpos:text-blue-800 wcpos:border-l-blue-500`,warning:`wcpos:bg-yellow-50 wcpos:border-yellow-200 wcpos:text-yellow-800 wcpos:border-l-yellow-500`,error:`wcpos:bg-red-50 wcpos:border-red-200 wcpos:text-red-800 wcpos:border-l-red-500`,success:`wcpos:bg-green-50 wcpos:border-green-200 wcpos:text-green-800 wcpos:border-l-green-500`};function yo(){return(0,_.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,className:`wcpos:h-4 wcpos:w-4`,"aria-hidden":`true`,children:(0,_.jsx)(`path`,{fillRule:`evenodd`,d:`M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z`,clipRule:`evenodd`})})}function bo({status:e=`info`,children:t,onRemove:n,isDismissible:r=!0,className:i,dismissLabel:a=`Dismiss`}){return(0,_.jsxs)(`div`,{className:(0,H.default)(`wcpos:flex wcpos:items-start wcpos:gap-2 wcpos:rounded-md wcpos:border wcpos:border-l-4 wcpos:px-3 wcpos:py-2.5 wcpos:text-sm`,vo[e],i),children:[(0,_.jsx)(`div`,{className:`wcpos:flex-1`,children:t}),r&&n&&(0,_.jsx)(`button`,{type:`button`,"aria-label":a,onClick:n,className:`wcpos:shrink-0 wcpos:bg-transparent wcpos:border-0 wcpos:cursor-pointer wcpos:p-0.5 wcpos:rounded wcpos:hover:bg-black/5`,children:(0,_.jsx)(yo,{})})]})}var xo={info:`wcpos:bg-blue-50 wcpos:border-blue-200 wcpos:text-blue-800 wcpos:border-l-blue-500`,success:`wcpos:bg-green-50 wcpos:border-green-200 wcpos:text-green-800 wcpos:border-l-green-500`,warning:`wcpos:bg-yellow-50 wcpos:border-yellow-200 wcpos:text-yellow-800 wcpos:border-l-yellow-500`,error:`wcpos:bg-red-50 wcpos:border-red-200 wcpos:text-red-800 wcpos:border-l-red-500`},So={info:`i`,success:`✓`,warning:`!`,error:`!`};function Co({status:e=`info`,title:t,icon:n,children:r,className:i}){let a=n===void 0?So[e]:n;return(0,_.jsxs)(`div`,{className:(0,H.default)(`wcpos:flex wcpos:items-start wcpos:gap-2.5 wcpos:rounded-md wcpos:border wcpos:border-l-4 wcpos:px-3 wcpos:py-2.5 wcpos:text-sm`,xo[e],i),children:[a!==null&&(0,_.jsx)(`span`,{className:`wcpos:inline-flex wcpos:items-center wcpos:justify-center wcpos:flex-shrink-0 wcpos:font-bold wcpos:leading-none wcpos:mt-0.5`,"aria-hidden":`true`,children:a}),(0,_.jsxs)(`div`,{className:`wcpos:flex-1 wcpos:min-w-0`,children:[t&&(0,_.jsx)(`div`,{className:`wcpos:font-semibold wcpos:mb-0.5`,children:t}),(0,_.jsx)(`div`,{children:r})]})]})}function K({className:e,width:t,height:n,style:r,...i}){return(0,_.jsx)(`div`,{className:(0,H.default)(`wcpos:animate-pulse wcpos:rounded wcpos:bg-gray-200`,e),style:{width:t,height:n,...r},...i})}function q({label:e,htmlFor:t,description:n,children:r,className:i}){return(0,_.jsxs)(`div`,{className:(0,H.default)(`wcpos:flex wcpos:flex-col wcpos:sm:flex-row wcpos:sm:items-start wcpos:gap-1 wcpos:sm:gap-3 wcpos:py-2.5`,i),children:[e&&(0,_.jsx)(`div`,{className:`wcpos:sm:w-[30%] wcpos:sm:max-w-[200px] wcpos:shrink-0 wcpos:sm:pt-0.5`,children:(0,_.jsx)(`label`,{htmlFor:t,className:`wcpos:text-sm wcpos:font-medium wcpos:text-gray-700`,children:e})}),(0,_.jsxs)(`div`,{className:`wcpos:flex-1 wcpos:min-w-0`,children:[r,n&&(0,_.jsx)(`p`,{className:`wcpos:mt-1 wcpos:text-xs wcpos:text-gray-500`,children:n})]})]})}function wo({title:e,description:t,headerRight:n,divider:r,children:i,className:a}){let o=!!(e||t),s=n!=null&&n!==!1,c=o||s;return(0,_.jsxs)(`div`,{className:(0,H.default)(r?`wcpos:border-b wcpos:border-gray-200 wcpos:pb-6 wcpos:pt-4`:`wcpos:pb-4 wcpos:mb-4`,a),children:[c&&(0,_.jsxs)(`div`,{className:(0,H.default)(`wcpos:mb-3`,s&&(0,H.default)(`wcpos:flex wcpos:items-center`,o?`wcpos:justify-between`:`wcpos:justify-end`)),children:[o&&(0,_.jsxs)(`div`,{children:[e&&(0,_.jsx)(`h3`,{className:`wcpos:text-base wcpos:font-semibold wcpos:text-gray-900 wcpos:m-0`,children:e}),t&&(0,_.jsx)(`p`,{className:(0,H.default)(`wcpos:text-sm wcpos:text-gray-500`,e&&`wcpos:mt-1`),children:t})]}),s&&(0,_.jsx)(`div`,{className:`wcpos:flex-shrink-0`,children:n})]}),(0,_.jsx)(`div`,{children:i})]})}function To({items:t,value:n,onChange:r,className:i,...a}){let o=e.useRef(null),s=e.useRef(new Map),[c,l]=e.useState(null),u=e.useCallback(()=>{let e=o.current,t=s.current.get(n);if(!e||!t){l(null);return}let r=e.getBoundingClientRect(),i=t.getBoundingClientRect();l({left:i.left-r.left,width:i.width})},[n]);e.useLayoutEffect(()=>{u()},[u,t]),e.useEffect(()=>{let e=o.current;if(!e||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(()=>u());return t.observe(e),()=>t.disconnect()},[u]);let d=e=>t=>{t?s.current.set(e,t):s.current.delete(e)};return(0,_.jsxs)(`div`,{ref:o,className:(0,H.default)(`wcpos:relative wcpos:inline-flex wcpos:items-center wcpos:gap-1 wcpos:rounded-full wcpos:bg-gray-100 wcpos:p-1`,i),...a,children:[c&&(0,_.jsx)(`div`,{"data-testid":`filter-tabs-indicator`,"aria-hidden":`true`,className:`wcpos:absolute wcpos:top-1 wcpos:bottom-1 wcpos:rounded-full wcpos:bg-wp-admin-theme-color wcpos:transition-all wcpos:duration-200 wcpos:ease-out`,style:{transform:`translateX(${c.left-4}px)`,width:c.width}}),t.map(e=>{let t=n===e.key;return(0,_.jsx)(`button`,{ref:d(e.key),type:`button`,disabled:e.disabled,"aria-pressed":t,onClick:()=>r(e.key),className:(0,H.default)(`wcpos:relative wcpos:z-10 wcpos:px-3 wcpos:py-1 wcpos:rounded-full wcpos:text-sm wcpos:font-medium wcpos:transition-colors wcpos:bg-transparent wcpos:border-0`,e.disabled?`wcpos:cursor-not-allowed wcpos:opacity-50`:`wcpos:cursor-pointer`,t?`wcpos:text-white`:`wcpos:text-gray-600 wcpos:hover:text-gray-900`),children:e.label},e.key)})]})}var Eo={neutral:`wcpos:bg-gray-100 wcpos:text-gray-700`,info:`wcpos:bg-blue-50 wcpos:text-blue-700`,success:`wcpos:bg-green-50 wcpos:text-green-700`,warning:`wcpos:bg-amber-50 wcpos:text-amber-700`,error:`wcpos:bg-red-50 wcpos:text-red-700`,critical:`wcpos:bg-red-100 wcpos:text-red-800`,debug:`wcpos:bg-gray-100 wcpos:text-gray-600`,brand:`wcpos:bg-wp-admin-theme-color wcpos:text-white wcpos:uppercase wcpos:font-semibold wcpos:tracking-wide`},Do={sm:`wcpos:text-xs wcpos:px-2 wcpos:py-0.5`,xs:`wcpos:text-[10px] wcpos:px-1.5 wcpos:py-0.5`},Oo={pill:`wcpos:rounded-full`,round:`wcpos:rounded-full wcpos:min-w-5 wcpos:justify-center`};function J({variant:e=`neutral`,shape:t=`pill`,size:n=`sm`,icon:r,className:i,children:a,...o}){return(0,_.jsxs)(`span`,{className:(0,H.default)(`wcpos:inline-flex wcpos:items-center wcpos:gap-1 wcpos:font-medium wcpos:leading-none wcpos:shrink-0`,Eo[e],Do[n],Oo[t],i),...o,children:[r,a]})}var ko={sm:`wcpos:w-8 wcpos:h-8 wcpos:text-xs`,md:`wcpos:w-10 wcpos:h-10 wcpos:text-sm`,lg:`wcpos:w-12 wcpos:h-12 wcpos:text-base`},Ao={sm:`wcpos:w-2.5 wcpos:h-2.5`,md:`wcpos:w-3 wcpos:h-3`,lg:`wcpos:w-3.5 wcpos:h-3.5`},jo={none:`wcpos:ring-1 wcpos:ring-gray-200`,brand:`wcpos:ring-2 wcpos:ring-wp-admin-theme-color`};function Mo(e){let t=(e||``).trim();if(!t)return`?`;let n=t.split(/\s+/);return n.length===1?n[0].charAt(0).toUpperCase():(n[0].charAt(0)+n[n.length-1].charAt(0)).toUpperCase()}function No({name:t,src:n,size:r=`md`,ring:i=`none`,status:a=`none`,statusLabel:o,className:s}){let[c,l]=e.useState(!1),u=!!n&&!c,d=t.trim()||`Avatar`;return e.useEffect(()=>{l(!1)},[n]),(0,_.jsxs)(`span`,{className:(0,H.default)(`wcpos:relative wcpos:inline-flex wcpos:shrink-0`,s),children:[(0,_.jsx)(`span`,{className:(0,H.default)(`wcpos:inline-flex wcpos:items-center wcpos:justify-center`,`wcpos:rounded-full wcpos:overflow-hidden wcpos:select-none`,`wcpos:bg-gray-100 wcpos:text-gray-700 wcpos:font-semibold`,ko[r],jo[i]),role:u?void 0:`img`,"aria-label":u?void 0:d,children:u?(0,_.jsx)(`img`,{src:n,alt:t,className:`wcpos:w-full wcpos:h-full wcpos:object-cover`,onError:()=>l(!0)}):(0,_.jsx)(`span`,{"aria-hidden":`true`,children:Mo(t)})}),a===`active`&&(0,_.jsx)(`span`,{className:(0,H.default)(`wcpos:absolute wcpos:-bottom-0.5 wcpos:-right-0.5`,`wcpos:rounded-full wcpos:bg-green-500 wcpos:ring-2 wcpos:ring-white`,Ao[r]),role:`status`,"aria-label":o||`Active now`,title:o||`Active now`})]})}var Po={saving:`wcpos:bg-gray-900 wcpos:text-white`,success:`wcpos:bg-green-600 wcpos:text-white`,error:`wcpos:bg-red-600 wcpos:text-white`,info:`wcpos:bg-gray-700 wcpos:text-white`};function Fo({message:t,status:n=`saving`,onRemove:r,timeout:i=!0}){let[a,o]=e.useState(!1);return e.useEffect(()=>{if(!t)return;let e=requestAnimationFrame(()=>o(!0));return()=>cancelAnimationFrame(e)},[t]),e.useEffect(()=>{if(!t||n===`saving`||!i)return;let e=setTimeout(()=>{o(!1),setTimeout(()=>r?.(),300)},2e3);return()=>clearTimeout(e)},[t,n,r,i]),t?(0,_.jsx)(`div`,{className:(0,H.default)(`wcpos:w-full wcpos:px-4 wcpos:py-2 wcpos:text-sm wcpos:text-center wcpos:transition-all wcpos:duration-300 wcpos:ease-out`,Po[n],a?`wcpos:translate-y-0 wcpos:opacity-100`:`wcpos:-translate-y-full wcpos:opacity-0`),children:t}):null}var Io=e.createContext(null),Lo=0;function Ro(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?crypto.randomUUID():(Lo+=1,`snackbar-${Date.now()}-${Lo}`)}function zo({children:t,boundsElement:n}){let[r,i]=e.useState([]),a=e.useRef(null),[o,s]=e.useState(null);e.useEffect(()=>{let e=a.current;if(!e)return;let t=n??e,r=()=>{let e=t.getBoundingClientRect();s({left:e.left,width:e.width})};r();let i=typeof ResizeObserver<`u`?new ResizeObserver(r):null;return i?.observe(t),window.addEventListener(`resize`,r),()=>{i?.disconnect(),window.removeEventListener(`resize`,r)}},[n]);let c=e.useCallback(e=>{let t=e.id??Ro();i([{...e,id:t}])},[]),l=e.useCallback(e=>{i(t=>t.filter(t=>t.id!==e))},[]),u=o?{left:o.left,width:o.width}:{left:0,right:0};return(0,_.jsx)(Io.Provider,{value:{addSnackbar:c},children:(0,_.jsxs)(`div`,{ref:a,className:`wcpos:relative wcpos:flex-1 wcpos:flex wcpos:flex-col`,children:[(0,_.jsx)(`div`,{className:`wcpos:fixed wcpos:top-[var(--wp-admin--admin-bar--height,32px)] wcpos:z-50 wcpos:overflow-hidden`,style:u,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,children:r.map(e=>(0,_.jsx)(Fo,{...e,onRemove:()=>{try{e.onRemove?.()}finally{l(e.id)}}},e.id))}),t]})})}function Bo(){let t=e.useContext(Io);if(!t)throw Error(`useSnackbar must be called within SnackbarProvider`);return t}function Vo({className:e,tableClassName:t,children:n,...r}){return(0,_.jsx)(`div`,{className:(0,H.default)(`wcpos:overflow-x-auto wcpos:rounded-md wcpos:border wcpos:border-gray-200`,e),...r,children:(0,_.jsx)(`table`,{className:(0,H.default)(`wcpos:w-full wcpos:text-sm`,t),children:n})})}function Ho({className:e,children:t,...n}){return(0,_.jsx)(`thead`,{className:e,...n,children:t})}function Uo({className:e,children:t,...n}){return(0,_.jsx)(`tbody`,{className:e,...n,children:t})}var Wo=e.forwardRef(function({className:e,children:t,...n},r){return(0,_.jsx)(`tr`,{ref:r,className:(0,H.default)(`wcpos:bg-gray-50 wcpos:text-left wcpos:text-xs wcpos:uppercase wcpos:tracking-wide wcpos:text-gray-500`,e),...n,children:t})}),Go=e.forwardRef(function({className:e,children:t,...n},r){return(0,_.jsx)(`tr`,{ref:r,className:(0,H.default)(`wcpos:border-t wcpos:border-gray-100`,e),...n,children:t})}),Y=e.forwardRef(function({className:e,children:t,...n},r){return(0,_.jsx)(`th`,{ref:r,className:(0,H.default)(`wcpos:px-3 wcpos:py-2 wcpos:font-medium`,e),...n,children:t})}),X=e.forwardRef(function({className:e,children:t,...n},r){return(0,_.jsx)(`td`,{ref:r,className:(0,H.default)(`wcpos:px-3 wcpos:py-2 wcpos:align-middle`,e),...n,children:t})});Vo.Header=Ho,Vo.HeaderRow=Wo,Vo.Body=Uo,Vo.Row=Go,Vo.Head=Y,Vo.Cell=X;var Ko=[{value:`eu_vat`,label:`EU VAT`},{value:`gb_vat`,label:`GB VAT`},{value:`au_abn`,label:`AU ABN`},{value:`br_cpf`,label:`BR CPF`},{value:`br_cnpj`,label:`BR CNPJ`},{value:`in_gst`,label:`IN GSTIN`},{value:`it_cf`,label:`IT Codice Fiscale`},{value:`it_piva`,label:`IT Partita IVA`},{value:`es_nif`,label:`ES NIF`},{value:`ar_cuit`,label:`AR CUIT`},{value:`sa_vat`,label:`SA VAT`},{value:`ca_gst_hst`,label:`CA GST/HST`},{value:`us_ein`,label:`US EIN`},{value:`de_ust_id`,label:`DE USt-IdNr.`},{value:`de_steuernummer`,label:`DE Steuernummer`},{value:`de_hrb`,label:`DE HRB`},{value:`nl_kvk`,label:`NL KVK`},{value:`fr_siret`,label:`FR SIRET`},{value:`fr_siren`,label:`FR SIREN`},{value:`gb_company`,label:`GB Company number`},{value:`ch_uid`,label:`CH UID`},{value:`other`,label:`Other`}],qo={eu_vat:`DE123456789`,gb_vat:`GB123456789`,au_abn:`12345678901`,br_cpf:`123.456.789-09`,br_cnpj:`12.345.678/0001-95`,in_gst:`22AAAAA0000A1Z5`,it_cf:`RSSMRA80A01H501U`,it_piva:`12345678901`,es_nif:`B12345674`,ar_cuit:`20-12345678-3`,sa_vat:`300123456700003`,ca_gst_hst:`123456789RT0001`,us_ein:`12-3456789`,de_ust_id:`DE123456789`,de_steuernummer:`12/345/67890`,de_hrb:`HRB 12345`,nl_kvk:`12345678`,fr_siret:`12345678901234`,fr_siren:`123456789`,gb_company:`12345678`,ch_uid:`CHE-123.456.789`},Jo={AR:`ar_cuit`,AU:`au_abn`,BR:`br_cnpj`,CA:`ca_gst_hst`,CH:`ch_uid`,DE:`de_ust_id`,ES:`es_nif`,FR:`fr_siret`,GB:`gb_vat`,IN:`in_gst`,IT:`it_piva`,NL:`nl_kvk`,SA:`sa_vat`,US:`us_ein`},Yo={ar_cuit:`AR`,au_abn:`AU`,br_cpf:`BR`,br_cnpj:`BR`,ca_gst_hst:`CA`,ch_uid:`CH`,de_hrb:`DE`,de_steuernummer:`DE`,de_ust_id:`DE`,es_nif:`ES`,fr_siren:`FR`,fr_siret:`FR`,gb_company:`GB`,gb_vat:`GB`,in_gst:`IN`,it_cf:`IT`,it_piva:`IT`,nl_kvk:`NL`,sa_vat:`SA`,us_ein:`US`},Xo=new Set(`AT.BE.BG.CY.CZ.DE.DK.EE.ES.FI.FR.GR.HR.HU.IE.IT.LT.LU.LV.MT.NL.PL.PT.RO.SE.SI.SK`.split(`.`));function Zo(e){if(!e)return`other`;let t=e.toUpperCase();return Jo[t]?Jo[t]:Xo.has(t)?`eu_vat`:`other`}function Qo(e,t){if(e===`eu_vat`){let e=t?.toUpperCase();if(e&&Xo.has(e))return e;let n=window?.wcpos?.settings?.storeCountry?.toUpperCase();return n&&Xo.has(n)?n:void 0}return Yo[e]}function $o(e,t){return qo[e]??t}var es=e=>{let t={type:e.type||`other`,value:e.value||``};return e.country&&(t.country=e.country),e.label&&(t.label=e.label),t},ts=(e,t)=>{if(typeof t.country==`string`&&t.country)return{...t,type:Zo(t.country)};if(typeof t.type==`string`){let n=Qo(t.type,e.country);if(n)return{...t,country:n};if(t.type===`eu_vat`)return{...t,country:void 0}}return t},ns=0,rs=()=>`tax-id-row-${++ns}`;function is({taxId:t,labels:n,onChangeField:r,onRemove:i}){let[a,o]=e.useState(t.value),[s,c]=e.useState(t.label??``),l=window?.wcpos?.settings?.countries??{};return e.useEffect(()=>{o(t.value)},[t.value]),e.useEffect(()=>{c(t.label??``)},[t.label]),(0,_.jsxs)(Go,{children:[(0,_.jsx)(X,{children:(0,_.jsx)(G,{"aria-label":n.type,value:t.type,options:Ko,onChange:({value:e})=>r({type:String(e)})})}),(0,_.jsx)(X,{children:(0,_.jsx)(W,{"aria-label":n.value,placeholder:$o(t.type,n.value),value:a,onChange:e=>o(e.target.value),onBlur:()=>{let e=a.trim();e!==t.value&&r({value:e})}})}),(0,_.jsx)(X,{children:(0,_.jsx)(to,{"aria-label":n.country,countries:l,value:t.country??``,onChange:e=>r({country:e}),placeholder:n.countryPlaceholder??n.country,searchPlaceholder:n.countrySearchPlaceholder,noResultsLabel:n.countryNoResults,clearable:!0,clearLabel:n.countryClear})}),(0,_.jsx)(X,{children:(0,_.jsx)(W,{"aria-label":n.label,placeholder:n.label,value:s,onChange:e=>c(e.target.value),onBlur:()=>{let e=s.trim();e!==(t.label??``)&&r({label:e})}})}),(0,_.jsx)(X,{className:`wcpos:text-right`,children:(0,_.jsx)(U,{variant:`ghost-destructive`,onMouseDown:e=>e.preventDefault(),onClick:i,children:n.remove})})]})}var as=e.forwardRef(function({value:t,onChange:n,labels:r},i){let a=e.useMemo(()=>Array.isArray(t)?t.map(es):[],[t]),[o,s]=e.useState(()=>a.map(()=>rs())),[c,l]=e.useState(null);e.useEffect(()=>{s(e=>{if(e.length===a.length)return e;if(e.length<a.length){let t=Array.from({length:a.length-e.length},()=>rs());return[...e,...t]}return e.slice(0,a.length)})},[a.length]);let u=e.useCallback((e,t)=>{if(e>=a.length&&c){let e=ts(c.taxId,t),r=es({...c.taxId,...e});if(t.value&&r.value){s(e=>[...e,c.id]),l(null),n([...a,r]);return}l({id:c.id,taxId:r});return}n(a.map((n,r)=>{if(r!==e)return n;let i=ts(n,t);return es({...n,...i})}))},[c,n,a]),d=e.useCallback(e=>{if(e>=a.length){l(null);return}s(t=>t.filter((t,n)=>n!==e)),n(a.filter((t,n)=>n!==e))},[n,a]),f=e.useCallback(()=>{l(e=>{if(e)return e;let t=window?.wcpos?.settings?.storeCountry,n={type:Zo(t),value:``};return t&&(n.country=t),{id:rs(),taxId:n}})},[]);e.useImperativeHandle(i,()=>({addRow:f}),[f]);let p=e.useMemo(()=>{let e=a.map((e,t)=>({id:o[t]??`tax-id-row-fallback-${t}`,taxId:e}));return c&&e.push({id:c.id,taxId:c.taxId}),e},[a,o,c]);return p.length===0?(0,_.jsxs)(`div`,{className:`wcpos:space-y-3`,children:[(0,_.jsx)(`p`,{className:`wcpos:rounded-md wcpos:border wcpos:border-dashed wcpos:border-gray-300 wcpos:bg-gray-50 wcpos:px-3 wcpos:py-4 wcpos:text-center wcpos:text-sm wcpos:text-gray-500`,children:r.empty}),(0,_.jsx)(U,{variant:`outline`,onClick:f,children:r.add})]}):(0,_.jsxs)(`div`,{className:`wcpos:space-y-3`,children:[(0,_.jsxs)(Vo,{children:[(0,_.jsx)(Ho,{children:(0,_.jsxs)(Wo,{children:[(0,_.jsx)(Y,{style:{width:`11rem`},children:r.type}),(0,_.jsx)(Y,{children:r.value}),(0,_.jsx)(Y,{style:{width:`12rem`},children:r.country}),(0,_.jsx)(Y,{children:r.label}),(0,_.jsx)(Y,{className:`wcpos:text-right`,style:{width:`1%`},children:(0,_.jsx)(`span`,{className:`wcpos:sr-only`,children:r.remove})})]})}),(0,_.jsx)(Uo,{children:p.map((e,t)=>(0,_.jsx)(is,{taxId:e.taxId,labels:r,onChangeField:e=>u(t,e),onRemove:()=>d(t)},e.id))})]}),(0,_.jsx)(U,{variant:`outline`,onClick:f,children:r.add})]})}),Z=e=>typeof e==`string`,os=()=>{let e,t,n=new Promise((n,r)=>{e=n,t=r});return n.resolve=e,n.reject=t,n},ss=e=>e==null?``:String(e),cs=(e,t,n)=>{e.forEach(e=>{t[e]&&(n[e]=t[e])})},ls=/###/g,us=e=>e&&e.includes(`###`)?e.replace(ls,`.`):e,ds=e=>!e||Z(e),fs=(e,t,n)=>{let r=Z(t)?t.split(`.`):t,i=0;for(;i<r.length-1;){if(ds(e))return{};let t=us(r[i]);!e[t]&&n&&(e[t]=new n),e=Object.prototype.hasOwnProperty.call(e,t)?e[t]:{},++i}return ds(e)?{}:{obj:e,k:us(r[i])}},ps=(e,t,n)=>{let{obj:r,k:i}=fs(e,t,Object);if(r!==void 0||t.length===1){r[i]=n;return}let a=t[t.length-1],o=t.slice(0,t.length-1),s=fs(e,o,Object);for(;s.obj===void 0&&o.length;)a=`${o[o.length-1]}.${a}`,o=o.slice(0,o.length-1),s=fs(e,o,Object),s?.obj&&s.obj[`${s.k}.${a}`]!==void 0&&(s.obj=void 0);s.obj[`${s.k}.${a}`]=n},ms=(e,t,n,r)=>{let{obj:i,k:a}=fs(e,t,Object);i[a]=i[a]||[],i[a].push(n)},hs=(e,t)=>{let{obj:n,k:r}=fs(e,t);if(n&&Object.prototype.hasOwnProperty.call(n,r))return n[r]},gs=(e,t,n)=>{let r=hs(e,n);return r===void 0?hs(t,n):r},_s=(e,t,n)=>{for(let r in t)r!==`__proto__`&&r!==`constructor`&&(Object.prototype.hasOwnProperty.call(e,r)?Z(e[r])||e[r]instanceof String||Z(t[r])||t[r]instanceof String?n&&(e[r]=t[r]):_s(e[r],t[r],n):e[r]=t[r]);return e},vs=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,`\\$&`),ys={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`,"/":`&#x2F;`},bs=e=>Z(e)?e.replace(/[&<>"'\/]/g,e=>ys[e]):e,xs=class{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){let t=this.regExpMap.get(e);if(t!==void 0)return t;let n=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,n),this.regExpQueue.push(e),n}},Ss=[` `,`,`,`?`,`!`,`;`],Cs=new xs(20),ws=(e,t,n)=>{t||=``,n||=``;let r=Ss.filter(e=>!t.includes(e)&&!n.includes(e));if(r.length===0)return!0;let i=Cs.getRegExp(`(${r.map(e=>e===`?`?`\\?`:e).join(`|`)})`),a=!i.test(e);if(!a){let t=e.indexOf(n);t>0&&!i.test(e.substring(0,t))&&(a=!0)}return a},Ts=(e,t,n=`.`)=>{if(!e)return;if(e[t])return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0;let r=t.split(n),i=e;for(let e=0;e<r.length;){if(!i||typeof i!=`object`)return;let t,a=``;for(let o=e;o<r.length;++o)if(o!==e&&(a+=n),a+=r[o],t=i[a],t!==void 0){if([`string`,`number`,`boolean`].includes(typeof t)&&o<r.length-1)continue;e+=o-e+1;break}i=t}return i},Es=e=>e?.replace(/_/g,`-`),Ds={type:`logger`,log(e){this.output(`log`,e)},warn(e){this.output(`warn`,e)},error(e){this.output(`error`,e)},output(e,t){console?.[e]?.apply?.(console,t)}},Os=new class e{constructor(e,t={}){this.init(e,t)}init(e,t={}){this.prefix=t.prefix||`i18next:`,this.logger=e||Ds,this.options=t,this.debug=t.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,t,n,r){return r&&!this.debug?null:(e=e.map(e=>Z(e)?e.replace(/[\r\n\x00-\x1F\x7F]/g,` `):e),Z(e[0])&&(e[0]=`${n}${this.prefix} ${e[0]}`),this.logger[t](e))}create(t){return new e(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t||=this.options,t.prefix=t.prefix||this.prefix,new e(this.logger,t)}},ks=class{constructor(){this.observers={}}on(e,t){return e.split(` `).forEach(e=>{this.observers[e]||(this.observers[e]=new Map);let n=this.observers[e].get(t)||0;this.observers[e].set(t,n+1)}),this}off(e,t){if(this.observers[e]){if(!t){delete this.observers[e];return}this.observers[e].delete(t)}}once(e,t){let n=(...r)=>{t(...r),this.off(e,n)};return this.on(e,n),this}emit(e,...t){this.observers[e]&&Array.from(this.observers[e].entries()).forEach(([e,n])=>{for(let r=0;r<n;r++)e(...t)}),this.observers[`*`]&&Array.from(this.observers[`*`].entries()).forEach(([n,r])=>{for(let i=0;i<r;i++)n(e,...t)})}},As=class extends ks{constructor(e,t={ns:[`translation`],defaultNS:`translation`}){super(),this.data=e||{},this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator=`.`),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.includes(e)||this.options.ns.push(e)}removeNamespaces(e){let t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}getResource(e,t,n,r={}){let i=r.keySeparator===void 0?this.options.keySeparator:r.keySeparator,a=r.ignoreJSONStructure===void 0?this.options.ignoreJSONStructure:r.ignoreJSONStructure,o;e.includes(`.`)?o=e.split(`.`):(o=[e,t],n&&(Array.isArray(n)?o.push(...n):Z(n)&&i?o.push(...n.split(i)):o.push(n)));let s=hs(this.data,o);return!s&&!t&&!n&&e.includes(`.`)&&(e=o[0],t=o[1],n=o.slice(2).join(`.`)),s||!a||!Z(n)?s:Ts(this.data?.[e]?.[t],n,i)}addResource(e,t,n,r,i={silent:!1}){let a=i.keySeparator===void 0?this.options.keySeparator:i.keySeparator,o=[e,t];n&&(o=o.concat(a?n.split(a):n)),e.includes(`.`)&&(o=e.split(`.`),r=t,t=o[1]),this.addNamespaces(t),ps(this.data,o,r),i.silent||this.emit(`added`,e,t,n,r)}addResources(e,t,n,r={silent:!1}){for(let r in n)(Z(n[r])||Array.isArray(n[r]))&&this.addResource(e,t,r,n[r],{silent:!0});r.silent||this.emit(`added`,e,t,n)}addResourceBundle(e,t,n,r,i,a={silent:!1,skipCopy:!1}){let o=[e,t];e.includes(`.`)&&(o=e.split(`.`),r=n,n=t,t=o[1]),this.addNamespaces(t);let s=hs(this.data,o)||{};a.skipCopy||(n=JSON.parse(JSON.stringify(n))),r?_s(s,n,i):s={...s,...n},ps(this.data,o,s),a.silent||this.emit(`added`,e,t,n)}removeResourceBundle(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit(`removed`,e,t)}hasResourceBundle(e,t){return this.getResource(e,t)!==void 0}getResourceBundle(e,t){return t||=this.options.defaultNS,this.getResource(e,t)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){let t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find(e=>t[e]&&Object.keys(t[e]).length>0)}toJSON(){return this.data}},js={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,r,i){return e.forEach(e=>{t=this.processors[e]?.process(t,n,r,i)??t}),t}},Ms=Symbol(`i18next/PATH_KEY`);function Ns(){let e=[],t=Object.create(null),n;return t.get=(r,i)=>(n?.revoke?.(),i===Ms?e:(e.push(i),n=Proxy.revocable(r,t),n.proxy)),Proxy.revocable(Object.create(null),t).proxy}function Ps(e,t){let{[Ms]:n}=e(Ns()),r=t?.keySeparator??`.`,i=t?.nsSeparator??`:`,a=t?.enableSelector===`strict`;if(n.length>1&&i){let e=t?.ns,o=a?Array.isArray(e)?e:e?[e]:null:Array.isArray(e)?e:null;if(o&&(a?o:o.length>1?o.slice(1):[]).includes(n[0]))return`${n[0]}${i}${n.slice(1).join(r)}`}return n.join(r)}var Fs=e=>!Z(e)&&typeof e!=`boolean`&&typeof e!=`number`,Is=class e extends ks{constructor(e,t={}){super(),cs([`resourceStore`,`languageUtils`,`pluralResolver`,`interpolator`,`backendConnector`,`i18nFormat`,`utils`],e,this),this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator=`.`),this.logger=Os.create(`translator`),this.checkedLoadedFor={}}changeLanguage(e){e&&(this.language=e)}exists(e,t={interpolation:{}}){let n={...t};if(e==null)return!1;let r=this.resolve(e,n);if(r?.res===void 0)return!1;let i=Fs(r.res);return!(n.returnObjects===!1&&i)}extractFromKey(e,t){let n=t.nsSeparator===void 0?this.options.nsSeparator:t.nsSeparator;n===void 0&&(n=`:`);let r=t.keySeparator===void 0?this.options.keySeparator:t.keySeparator,i=t.ns||this.options.defaultNS||[],a=n&&e.includes(n),o=!this.options.userDefinedKeySeparator&&!t.keySeparator&&!this.options.userDefinedNsSeparator&&!t.nsSeparator&&!ws(e,n,r);if(a&&!o){let t=e.match(this.interpolator.nestingRegexp);if(t&&t.length>0)return{key:e,namespaces:Z(i)?[i]:i};let a=e.split(n);(n!==r||n===r&&this.options.ns.includes(a[0]))&&(i=a.shift()),e=a.join(r)}return{key:e,namespaces:Z(i)?[i]:i}}translate(t,n,r){let i=typeof n==`object`?{...n}:n;if(typeof i!=`object`&&this.options.overloadTranslationOptionHandler&&(i=this.options.overloadTranslationOptionHandler(arguments)),typeof i==`object`&&(i={...i}),i||={},t==null)return``;typeof t==`function`&&(t=Ps(t,{...this.options,...i})),Array.isArray(t)||(t=[String(t)]),t=t.map(e=>typeof e==`function`?Ps(e,{...this.options,...i}):String(e));let a=i.returnDetails===void 0?this.options.returnDetails:i.returnDetails,o=i.keySeparator===void 0?this.options.keySeparator:i.keySeparator,{key:s,namespaces:c}=this.extractFromKey(t[t.length-1],i),l=c[c.length-1],u=i.nsSeparator===void 0?this.options.nsSeparator:i.nsSeparator;u===void 0&&(u=`:`);let d=i.lng||this.language,f=i.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(d?.toLowerCase()===`cimode`)return f?a?{res:`${l}${u}${s}`,usedKey:s,exactUsedKey:s,usedLng:d,usedNS:l,usedParams:this.getUsedParamsDetails(i)}:`${l}${u}${s}`:a?{res:s,usedKey:s,exactUsedKey:s,usedLng:d,usedNS:l,usedParams:this.getUsedParamsDetails(i)}:s;let p=this.resolve(t,i),m=p?.res,h=p?.usedKey||s,g=p?.exactUsedKey||s,_=[`[object Number]`,`[object Function]`,`[object RegExp]`],v=i.joinArrays===void 0?this.options.joinArrays:i.joinArrays,y=!this.i18nFormat||this.i18nFormat.handleAsObject,b=i.count!==void 0&&!Z(i.count),x=e.hasDefaultValue(i),S=b?this.pluralResolver.getSuffix(d,i.count,i):``,C=i.ordinal&&b?this.pluralResolver.getSuffix(d,i.count,{ordinal:!1}):``,w=b&&!i.ordinal&&i.count===0,T=w&&i[`defaultValue${this.options.pluralSeparator}zero`]||i[`defaultValue${S}`]||i[`defaultValue${C}`]||i.defaultValue,E=m;y&&!m&&x&&(E=T);let D=Fs(E),O=Object.prototype.toString.apply(E);if(y&&E&&D&&!_.includes(O)&&!(Z(v)&&Array.isArray(E))){if(!i.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn(`accessing an object - but returnObjects options is not enabled!`);let e=this.options.returnedObjectHandler?this.options.returnedObjectHandler(h,E,{...i,ns:c}):`key '${s} (${this.language})' returned an object instead of string.`;return a?(p.res=e,p.usedParams=this.getUsedParamsDetails(i),p):e}if(o){let e=Array.isArray(E),t=e?[]:{},n=e?g:h;for(let e in E)if(Object.prototype.hasOwnProperty.call(E,e)){let r=`${n}${o}${e}`;t[e]=x&&!m?this.translate(r,{...i,defaultValue:Fs(T)?T[e]:void 0,joinArrays:!1,ns:c}):this.translate(r,{...i,joinArrays:!1,ns:c}),t[e]===r&&(t[e]=E[e])}m=t}}else if(y&&Z(v)&&Array.isArray(m))m=m.join(v),m&&=this.extendTranslation(m,t,i,r);else{let e=!1,n=!1;!this.isValidLookup(m)&&x&&(e=!0,m=T),this.isValidLookup(m)||(n=!0,m=s);let a=(i.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&n?void 0:m,c=x&&T!==m&&this.options.updateMissing;if(n||e||c){if(this.logger.log(c?`updateKey`:`missingKey`,d,l,b&&!c?`${s}${this.pluralResolver.getSuffix(d,i.count,i)}`:s,c?T:m),o){let e=this.resolve(s,{...i,keySeparator:!1});e&&e.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 e=[],t=this.languageUtils.getFallbackCodes(this.options.fallbackLng,i.lng||this.language);if(this.options.saveMissingTo===`fallback`&&t&&t[0])for(let n=0;n<t.length;n++)e.push(t[n]);else this.options.saveMissingTo===`all`?e=this.languageUtils.toResolveHierarchy(i.lng||this.language):e.push(i.lng||this.language);let n=(e,t,n)=>{let r=x&&n!==m?n:a;this.options.missingKeyHandler?this.options.missingKeyHandler(e,l,t,r,c,i):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(e,l,t,r,c,i),this.emit(`missingKey`,e,l,t,m)};this.options.saveMissing&&(this.options.saveMissingPlurals&&b?e.forEach(e=>{let t=this.pluralResolver.getSuffixes(e,i);w&&i[`defaultValue${this.options.pluralSeparator}zero`]&&!t.includes(`${this.options.pluralSeparator}zero`)&&t.push(`${this.options.pluralSeparator}zero`),t.forEach(t=>{n([e],s+t,i[`defaultValue${t}`]||T)})}):n(e,s,T))}m=this.extendTranslation(m,t,i,p,r),n&&m===s&&this.options.appendNamespaceToMissingKey&&(m=`${l}${u}${s}`),(n||e)&&this.options.parseMissingKeyHandler&&(m=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}${u}${s}`:s,e?m:void 0,i))}return a?(p.res=m,p.usedParams=this.getUsedParamsDetails(i),p):m}extendTranslation(e,t,n,r,i){if(this.i18nFormat?.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...n},n.lng||this.language||r.usedLng,r.usedNS,r.usedKey,{resolved:r});else if(!n.skipInterpolation){n.interpolation&&this.interpolator.init({...n,interpolation:{...this.options.interpolation,...n.interpolation}});let a=Z(e)&&(n?.interpolation?.skipOnVariables===void 0?this.options.interpolation.skipOnVariables:n.interpolation.skipOnVariables),o;if(a){let t=e.match(this.interpolator.nestingRegexp);o=t&&t.length}let s=n.replace&&!Z(n.replace)?n.replace:n;if(this.options.interpolation.defaultVariables&&(s={...this.options.interpolation.defaultVariables,...s}),e=this.interpolator.interpolate(e,s,n.lng||this.language||r.usedLng,n),a){let t=e.match(this.interpolator.nestingRegexp),r=t&&t.length;o<r&&(n.nest=!1)}!n.lng&&r&&r.res&&(n.lng=this.language||r.usedLng),n.nest!==!1&&(e=this.interpolator.nest(e,(...e)=>i?.[0]===e[0]&&!n.context?(this.logger.warn(`It seems you are nesting recursively key: ${e[0]} in key: ${t[0]}`),null):this.translate(...e,t),n)),n.interpolation&&this.interpolator.reset()}let a=n.postProcess||this.options.postProcess,o=Z(a)?[a]:a;return e!=null&&o?.length&&n.applyPostProcessor!==!1&&(e=js.handle(o,e,t,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...r,usedParams:this.getUsedParamsDetails(n)},...n}:n,this)),e}resolve(e,t={}){let n,r,i,a,o;return Z(e)&&(e=[e]),Array.isArray(e)&&(e=e.map(e=>typeof e==`function`?Ps(e,{...this.options,...t}):e)),e.forEach(e=>{if(this.isValidLookup(n))return;let s=this.extractFromKey(e,t),c=s.key;r=c;let l=s.namespaces;this.options.fallbackNS&&(l=l.concat(this.options.fallbackNS));let u=t.count!==void 0&&!Z(t.count),d=u&&!t.ordinal&&t.count===0,f=t.context!==void 0&&(Z(t.context)||typeof t.context==`number`)&&t.context!==``,p=t.lngs?t.lngs:this.languageUtils.toResolveHierarchy(t.lng||this.language,t.fallbackLng);l.forEach(e=>{this.isValidLookup(n)||(o=e,!this.checkedLoadedFor[`${p[0]}-${e}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(o)&&(this.checkedLoadedFor[`${p[0]}-${e}`]=!0,this.logger.warn(`key "${r}" for languages "${p.join(`, `)}" won't get resolved as namespace "${o}" 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!!!`)),p.forEach(r=>{if(this.isValidLookup(n))return;a=r;let o=[c];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(o,c,r,e,t);else{let e;u&&(e=this.pluralResolver.getSuffix(r,t.count,t));let n=`${this.options.pluralSeparator}zero`,i=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(u&&(t.ordinal&&e.startsWith(i)&&o.push(c+e.replace(i,this.options.pluralSeparator)),o.push(c+e),d&&o.push(c+n)),f){let r=`${c}${this.options.contextSeparator||`_`}${t.context}`;o.push(r),u&&(t.ordinal&&e.startsWith(i)&&o.push(r+e.replace(i,this.options.pluralSeparator)),o.push(r+e),d&&o.push(r+n))}}let s;for(;s=o.pop();)this.isValidLookup(n)||(i=s,n=this.getResource(r,e,s,t))}))})}),{res:n,usedKey:r,exactUsedKey:i,usedLng:a,usedNS:o}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e===``)}getResource(e,t,n,r={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(e,t,n,r):this.resourceStore.getResource(e,t,n,r)}getUsedParamsDetails(e={}){let t=[`defaultValue`,`ordinal`,`context`,`replace`,`lng`,`lngs`,`fallbackLng`,`ns`,`keySeparator`,`nsSeparator`,`returnObjects`,`returnDetails`,`joinArrays`,`postProcess`,`interpolation`],n=e.replace&&!Z(e.replace),r=n?e.replace:e;if(n&&e.count!==void 0&&(r={...r,count:e.count}),this.options.interpolation.defaultVariables&&(r={...this.options.interpolation.defaultVariables,...r}),!n){r={...r};for(let e of t)delete r[e]}return r}static hasDefaultValue(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&t.startsWith(`defaultValue`)&&e[t]!==void 0)return!0;return!1}},Ls=class{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Os.create(`languageUtils`),this.resolveHierarchyCache={}}clearCache(){this.resolveHierarchyCache={}}getScriptPartFromCode(e){if(e=Es(e),!e||!e.includes(`-`))return null;let t=e.split(`-`);return t.length===2||(t.pop(),t[t.length-1].toLowerCase()===`x`)?null:this.formatLanguageCode(t.join(`-`))}getLanguagePartFromCode(e){if(e=Es(e),!e||!e.includes(`-`))return e;let t=e.split(`-`);return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(Z(e)&&e.includes(`-`)){let t;try{t=Intl.getCanonicalLocales(e)[0]}catch{}return t&&this.options.lowerCaseLng&&(t=t.toLowerCase()),t||(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.includes(e)}getBestMatchFromCodes(e){if(!e)return null;let t;return e.forEach(e=>{if(t)return;let n=this.formatLanguageCode(e);(!this.options.supportedLngs||this.isSupportedCode(n))&&(t=n)}),!t&&this.options.supportedLngs&&e.forEach(e=>{if(t)return;let n=this.getScriptPartFromCode(e);if(this.isSupportedCode(n))return t=n;let r=this.getLanguagePartFromCode(e);if(this.isSupportedCode(r))return t=r;t=this.options.supportedLngs.find(e=>e===r?!0:!e.includes(`-`)&&!r.includes(`-`)?!1:!!(e.includes(`-`)&&!r.includes(`-`)&&e.slice(0,e.indexOf(`-`))===r||e.startsWith(r)&&r.length>1))}),t||=this.getFallbackCodes(this.options.fallbackLng)[0],t}getFallbackCodes(e,t){if(!e)return[];if(typeof e==`function`&&(e=e(t)),Z(e)&&(e=[e]),Array.isArray(e))return e;if(!t)return e.default||[];let n=e[t];return n||=e[this.getScriptPartFromCode(t)],n||=e[this.formatLanguageCode(t)],n||=e[this.getLanguagePartFromCode(t)],n||=e.default,n||[]}toResolveHierarchy(e,t){let n=this.options.fallbackLng,r=Array.isArray(n)?n.join(`|`):n;r!==this._cachedFallbackLng&&(this.resolveHierarchyCache={},this._cachedFallbackLng=r);let i=t===void 0||t===!1||Z(t),a=t===void 0&&typeof this.options.fallbackLng==`function`,o=Z(e)&&i&&!a,s=null;if(o){let n;n=t===void 0?`undefined`:t===!1?`boolean:false`:`string:${t}`,s=`${e.length}:${e}|${n}`}if(s!==null){let e=this.resolveHierarchyCache[s];if(e!==void 0)return e.slice()}let c=this.getFallbackCodes((t===!1?[]:t)||this.options.fallbackLng||[],e),l=[],u=e=>{e&&(this.isSupportedCode(e)?l.push(e):this.logger.warn(`rejecting language code not found in supportedLngs: ${e}`))};return Z(e)&&(e.includes(`-`)||e.includes(`_`))?(this.options.load!==`languageOnly`&&u(this.formatLanguageCode(e)),this.options.load!==`languageOnly`&&this.options.load!==`currentOnly`&&u(this.getScriptPartFromCode(e)),this.options.load!==`currentOnly`&&u(this.getLanguagePartFromCode(e))):Z(e)&&u(this.formatLanguageCode(e)),c.forEach(e=>{l.includes(e)||u(this.formatLanguageCode(e))}),s===null?l:(this.resolveHierarchyCache[s]=l,l.slice())}},Rs={zero:0,one:1,two:2,few:3,many:4,other:5},zs={select:e=>e===1?`one`:`other`,resolvedOptions:()=>({pluralCategories:[`one`,`other`]})},Bs=class{constructor(e,t={}){this.languageUtils=e,this.options=t,this.logger=Os.create(`pluralResolver`),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(e,t={}){let n=Es(e===`dev`?`en`:e),r=t.ordinal?`ordinal`:`cardinal`,i=JSON.stringify({cleanedCode:n,type:r});if(i in this.pluralRulesCache)return this.pluralRulesCache[i];let a;try{a=new Intl.PluralRules(n,{type:r})}catch{if(typeof Intl>`u`)return this.logger.error(`No Intl support, please use an Intl polyfill!`),zs;if(!e.match(/-|_/))return zs;let n=this.languageUtils.getLanguagePartFromCode(e);a=this.getRule(n,t)}return this.pluralRulesCache[i]=a,a}needsPlural(e,t={}){let n=this.getRule(e,t);return n||=this.getRule(`dev`,t),n?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(e,t,n={}){return this.getSuffixes(e,n).map(e=>`${t}${e}`)}getSuffixes(e,t={}){let n=this.getRule(e,t);return n||=this.getRule(`dev`,t),n?n.resolvedOptions().pluralCategories.sort((e,t)=>Rs[e]-Rs[t]).map(e=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:``}${e}`):[]}getSuffix(e,t,n={}){let r=this.getRule(e,n);return r?`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:``}${r.select(t)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix(`dev`,t,n))}},Vs=(e,t,n,r=`.`,i=!0)=>{let a=gs(e,t,n);return!a&&i&&Z(n)&&(a=Ts(e,n,r),a===void 0&&(a=Ts(t,n,r))),a},Hs=e=>e.replace(/\$/g,`$$$$`),Us=class{constructor(e={}){this.logger=Os.create(`interpolator`),this.options=e,this.format=e?.interpolation?.format||(e=>e),this.init(e)}init(e={}){e.interpolation||={escapeValue:!0};let{escape:t,escapeValue:n,useRawValueToEscape:r,prefix:i,prefixEscaped:a,suffix:o,suffixEscaped:s,formatSeparator:c,unescapeSuffix:l,unescapePrefix:u,nestingPrefix:d,nestingPrefixEscaped:f,nestingSuffix:p,nestingSuffixEscaped:m,nestingOptionsSeparator:h,maxReplaces:g,alwaysFormat:_}=e.interpolation;this.escape=t===void 0?bs:t,this.escapeValue=n===void 0||n,this.useRawValueToEscape=r!==void 0&&r,this.prefix=i?vs(i):a||`{{`,this.suffix=o?vs(o):s||`}}`,this.formatSeparator=c||`,`,this.unescapePrefix=l?``:u?vs(u):`-`,this.unescapeSuffix=this.unescapePrefix?``:l?vs(l):``,this.nestingPrefix=d?vs(d):f||vs(`$t(`),this.nestingSuffix=p?vs(p):m||vs(`)`),this.nestingOptionsSeparator=h||`,`,this.maxReplaces=g||1e3,this.alwaysFormat=_!==void 0&&_,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){let e=(e,t)=>e?.source===t?(e.lastIndex=0,e):new RegExp(t,`g`);this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(e,t,n,r){let i,a,o,s=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},c=e=>{if(!e.includes(this.formatSeparator)){let i=Vs(t,s,e,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(i,void 0,n,{...r,...t,interpolationkey:e}):i}let i=e.split(this.formatSeparator),a=i.shift().trim(),o=i.join(this.formatSeparator).trim();return this.format(Vs(t,s,a,this.options.keySeparator,this.options.ignoreJSONStructure),o,n,{...r,...t,interpolationkey:a})};this.resetRegExp(),!this.escapeValue&&typeof e==`string`&&/\$t\([^)]*\{[^}]*\{\{/.test(e)&&this.logger.warn(`nesting options string contains interpolated variables with escapeValue: false — if any of those values are attacker-controlled they can inject additional nesting options (e.g. redirect lng/ns). Sanitise untrusted input before passing it to t(), or keep escapeValue: true.`);let l=r?.missingInterpolationHandler||this.options.missingInterpolationHandler,u=r?.interpolation?.skipOnVariables===void 0?this.options.interpolation.skipOnVariables:r.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:e=>e},{regex:this.regexp,safeValue:e=>this.escapeValue?this.escape(e):e}].forEach(t=>{for(o=0;i=t.regex.exec(e);){let n=i[1].trim();if(a=c(n),a===void 0){if(typeof l==`function`){let t=l(e,i,r);a=Z(t)?t:``}else if(r&&Object.prototype.hasOwnProperty.call(r,n))a=``;else if(u){a=i[0];continue}else this.logger.warn(`missed to pass in variable ${n} for interpolating ${e}`),a=``}else!Z(a)&&!this.useRawValueToEscape&&(a=ss(a));let s=t.safeValue(a);if(e=e.replace(i[0],Hs(s)),u?(t.regex.lastIndex+=s.length,t.regex.lastIndex-=i[0].length):t.regex.lastIndex=0,o++,o>=this.maxReplaces)break}}),e}nest(e,t,n={}){let r,i,a,o=(e,t)=>{let n=this.nestingOptionsSeparator;if(!e.includes(n))return e;let r=e.split(RegExp(`${vs(n)}[ ]*{`)),i=`{${r[1]}`;e=r[0],i=this.interpolate(i,a);let o=i.match(/'/g),s=i.match(/"/g);((o?.length??0)%2==0&&!s||(s?.length??0)%2!=0)&&(i=i.replace(/'/g,`"`));try{a=JSON.parse(i),t&&(a={...t,...a})}catch(t){return this.logger.warn(`failed parsing options string in nesting for key ${e}`,t),`${e}${n}${i}`}return a.defaultValue&&a.defaultValue.includes(this.prefix)&&delete a.defaultValue,e};for(;r=this.nestingRegexp.exec(e);){let s=[];a={...n},a=a.replace&&!Z(a.replace)?a.replace:a,a.applyPostProcessor=!1,delete a.defaultValue;let c=/{.*}/s.test(r[1])?r[1].lastIndexOf(`}`)+1:r[1].indexOf(this.formatSeparator);if(c!==-1&&(s=r[1].slice(c).split(this.formatSeparator).map(e=>e.trim()).filter(Boolean),r[1]=r[1].slice(0,c)),i=t(o.call(this,r[1].trim(),a),a),i&&r[0]===e&&!Z(i))return i;Z(i)||(i=ss(i)),i||=(this.logger.warn(`missed to resolve ${r[1]} for nesting ${e}`),``),s.length&&(i=s.reduce((e,t)=>this.format(e,t,n.lng,{...n,interpolationkey:r[1].trim()}),i.trim())),e=e.replace(r[0],Hs(ss(i))),this.regexp.lastIndex=0}return e}},Ws=e=>{let t=e.toLowerCase().trim(),n={};if(e.includes(`(`)){let r=e.split(`(`);t=r[0].toLowerCase().trim();let i=r[1].slice(0,-1);t===`currency`&&!i.includes(`:`)?n.currency||=i.trim():t===`relativetime`&&!i.includes(`:`)?n.range||=i.trim():i.split(`;`).forEach(e=>{if(e){let[t,...r]=e.split(`:`),i=r.join(`:`).trim().replace(/^'+|'+$/g,``),a=t.trim();n[a]||(n[a]=i),i===`false`&&(n[a]=!1),i===`true`&&(n[a]=!0),isNaN(i)||(n[a]=parseInt(i,10))}})}return{formatName:t,formatOptions:n}},Gs=e=>{let t={};return(n,r,i)=>{let a=i;i&&i.interpolationkey&&i.formatParams&&i.formatParams[i.interpolationkey]&&i[i.interpolationkey]&&(a={...a,[i.interpolationkey]:void 0});let o=r+JSON.stringify(a),s=t[o];return s||(s=e(Es(r),i),t[o]=s),s(n)}},Ks=e=>(t,n,r)=>e(Es(n),r)(t),qs=class{constructor(e={}){this.logger=Os.create(`formatter`),this.options=e,this.init(e)}init(e,t={interpolation:{}}){this.formatSeparator=t.interpolation.formatSeparator||`,`;let n=t.cacheInBuiltFormats?Gs:Ks;this.formats={number:n((e,t)=>{let n=new Intl.NumberFormat(e,{...t});return e=>n.format(e)}),currency:n((e,t)=>{let n=new Intl.NumberFormat(e,{...t,style:`currency`});return e=>n.format(e)}),datetime:n((e,t)=>{let n=new Intl.DateTimeFormat(e,{...t});return e=>n.format(e)}),relativetime:n((e,t)=>{let n=new Intl.RelativeTimeFormat(e,{...t});return e=>n.format(e,t.range||`day`)}),list:n((e,t)=>{let n=new Intl.ListFormat(e,{...t});return e=>n.format(e)})}}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=Gs(t)}format(e,t,n,r={}){if(!t||e==null)return e;let i=t.split(this.formatSeparator),a=[];for(let e=0;e<i.length;e++){let t=i[e];for(;t.indexOf(`(`)>-1&&!t.includes(`)`)&&e+1<i.length;)t=`${t}${this.formatSeparator}${i[++e]}`;a.push(t)}return a.reduce((e,t)=>{let{formatName:i,formatOptions:a}=Ws(t);if(this.formats[i]){let t=e;try{let o=r?.formatParams?.[r.interpolationkey]||{},s=o.locale||o.lng||r.locale||r.lng||n;t=this.formats[i](e,s,{...a,...r,...o})}catch(e){this.logger.warn(e)}return t}return this.logger.warn(`there was no format function for ${i}`),e},e)}},Js=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)},Ys=class extends ks{constructor(e,t,n,r={}){super(),this.backend=e,this.store=t,this.services=n,this.languageUtils=n.languageUtils,this.options=r,this.logger=Os.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=[],this.backend?.init?.(n,r.backend,r)}queueLoad(e,t,n,r){let i={},a={},o={},s={};return e.forEach(e=>{let r=!0;t.forEach(t=>{let o=`${e}|${t}`;!n.reload&&this.store.hasResourceBundle(e,t)?this.state[o]=2:this.state[o]<0||(this.state[o]===1?a[o]===void 0&&(a[o]=!0):(this.state[o]=1,r=!1,a[o]===void 0&&(a[o]=!0),i[o]===void 0&&(i[o]=!0),s[t]===void 0&&(s[t]=!0)))}),r||(o[e]=!0)}),(Object.keys(i).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:r}),{toLoad:Object.keys(i),pending:Object.keys(a),toLoadLanguages:Object.keys(o),toLoadNamespaces:Object.keys(s)}}loaded(e,t,n){let r=e.split(`|`),i=r[0],a=r[1];t&&this.emit(`failedLoading`,i,a,t),!t&&n&&this.store.addResourceBundle(i,a,n,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2,t&&n&&(this.state[e]=0);let o={};this.queue.forEach(n=>{ms(n.loaded,[i],a),Js(n,e),t&&n.errors.push(t),n.pendingCount===0&&!n.done&&(Object.keys(n.loaded).forEach(e=>{o[e]||(o[e]={});let t=n.loaded[e];t.length&&t.forEach(t=>{o[e][t]===void 0&&(o[e][t]=!0)})}),n.done=!0,n.errors.length?n.callback(n.errors):n.callback())}),this.emit(`loaded`,o),this.queue=this.queue.filter(e=>!e.done)}read(e,t,n,r=0,i=this.retryTimeout,a){if(!e.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:t,fcName:n,tried:r,wait:i,callback:a});return}this.readingCalls++;let o=(o,s)=>{if(this.readingCalls--,this.waitingReads.length>0){let e=this.waitingReads.shift();this.read(e.lng,e.ns,e.fcName,e.tried,e.wait,e.callback)}if(o&&s&&r<this.maxRetries){setTimeout(()=>{this.read(e,t,n,r+1,i*2,a)},i);return}a(o,s)},s=this.backend[n].bind(this.backend);if(s.length===2){try{let n=s(e,t);n&&typeof n.then==`function`?n.then(e=>o(null,e)).catch(o):o(null,n)}catch(e){o(e)}return}return s(e,t,o)}prepareLoading(e,t,n={},r){if(!this.backend)return this.logger.warn(`No backend was added via i18next.use. Will not load resources.`),r&&r();Z(e)&&(e=this.languageUtils.toResolveHierarchy(e)),Z(t)&&(t=[t]);let i=this.queueLoad(e,t,n,r);if(!i.toLoad.length)return i.pending.length||r(),null;i.toLoad.forEach(e=>{this.loadOne(e)})}load(e,t,n){this.prepareLoading(e,t,{},n)}reload(e,t,n){this.prepareLoading(e,t,{reload:!0},n)}loadOne(e,t=``){let n=e.split(`|`),r=n[0],i=n[1];this.read(r,i,`read`,void 0,void 0,(n,a)=>{n&&this.logger.warn(`${t}loading namespace ${i} for language ${r} failed`,n),!n&&a&&this.logger.log(`${t}loaded namespace ${i} for language ${r}`,a),this.loaded(e,n,a)})}saveMissing(e,t,n,r,i,a={},o=()=>{}){if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(t)){this.logger.warn(`did not save key "${n}" as the namespace "${t}" 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(n!=null&&n!==``){if(this.backend?.create){let s={...a,isUpdate:i},c=this.backend.create.bind(this.backend);if(c.length<6)try{let i;i=c.length===5?c(e,t,n,r,s):c(e,t,n,r),i&&typeof i.then==`function`?i.then(e=>o(null,e)).catch(o):o(null,i)}catch(e){o(e)}else c(e,t,n,r,o,s)}e&&e[0]&&this.store.addResource(e[0],t,n,r)}}},Xs=()=>({debug:!1,initAsync:!0,ns:[`translation`],defaultNS:[`translation`],fallbackLng:[`dev`],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:`all`,preload:!1,keySeparator:`.`,nsSeparator:`:`,pluralSeparator:`_`,contextSeparator:`_`,enableSelector:!1,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:e=>{let t={};if(typeof e[1]==`object`&&(t=e[1]),Z(e[1])&&(t.defaultValue=e[1]),Z(e[2])&&(t.tDescription=e[2]),typeof e[2]==`object`||typeof e[3]==`object`){let n=e[3]||e[2];Object.keys(n).forEach(e=>{t[e]=n[e]})}return t},interpolation:{escapeValue:!0,prefix:`{{`,suffix:`}}`,formatSeparator:`,`,unescapePrefix:`-`,nestingPrefix:`$t(`,nestingSuffix:`)`,nestingOptionsSeparator:`,`,maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),Zs=e=>(Z(e.ns)&&(e.ns=[e.ns]),Z(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),Z(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&!e.supportedLngs.includes(`cimode`)&&(e.supportedLngs=e.supportedLngs.concat([`cimode`])),e),Qs=()=>{},$s=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(t=>{typeof e[t]==`function`&&(e[t]=e[t].bind(e))})},Q=class e extends ks{constructor(e={},t){if(super(),this.options=Zs(e),this.services={},this.logger=Os,this.modules={external:[]},$s(this),t&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,t),this;setTimeout(()=>{this.init(e,t)},0)}}init(e={},t){this.isInitializing=!0,typeof e==`function`&&(t=e,e={}),e.defaultNS==null&&e.ns&&(Z(e.ns)?e.defaultNS=e.ns:e.ns.includes(`translation`)||(e.defaultNS=e.ns[0]));let n=Xs();this.options={...n,...this.options,...Zs(e)},this.options.interpolation={...n.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=n.overloadTranslationOptionHandler);let r=e=>e?typeof e==`function`?new e:e:null;if(!this.options.isClone){this.modules.logger?Os.init(r(this.modules.logger),this.options):Os.init(null,this.options);let e;e=this.modules.formatter?this.modules.formatter:qs;let t=new Ls(this.options);this.store=new As(this.options.resources,this.options);let n=this.services;n.logger=Os,n.resourceStore=this.store,n.languageUtils=t,n.pluralResolver=new Bs(t,{prepend:this.options.pluralSeparator}),e&&(n.formatter=r(e),n.formatter.init&&n.formatter.init(n,this.options),this.options.interpolation.format=n.formatter.format.bind(n.formatter)),n.interpolator=new Us(this.options),n.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},n.backendConnector=new Ys(r(this.modules.backend),n.resourceStore,n,this.options),n.backendConnector.on(`*`,(e,...t)=>{this.emit(e,...t)}),this.modules.languageDetector&&(n.languageDetector=r(this.modules.languageDetector),n.languageDetector.init&&n.languageDetector.init(n,this.options.detection,this.options)),this.modules.i18nFormat&&(n.i18nFormat=r(this.modules.i18nFormat),n.i18nFormat.init&&n.i18nFormat.init(this)),this.translator=new Is(this.services,this.options),this.translator.on(`*`,(e,...t)=>{this.emit(e,...t)}),this.modules.external.forEach(e=>{e.init&&e.init(this)})}if(this.format=this.options.interpolation.format,t||=Qs,this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){let e=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);e.length>0&&e[0]!==`dev`&&(this.options.lng=e[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(e=>{this[e]=(...t)=>this.store[e](...t)}),[`addResource`,`addResources`,`addResourceBundle`,`removeResourceBundle`].forEach(e=>{this[e]=(...t)=>(this.store[e](...t),this)});let i=os(),a=()=>{let e=(e,n)=>{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(`initialized`,this.options),i.resolve(n),t(e,n)};if((this.languages||this.isLanguageChangingTo)&&!this.isInitialized)return e(null,this.t.bind(this));this.changeLanguage(this.options.lng,e)};return this.options.resources||!this.options.initAsync?a():setTimeout(a,0),i}loadResources(e,t=Qs){let n=t,r=Z(e)?e:this.language;if(typeof e==`function`&&(n=e),!this.options.resources||this.options.partialBundledLanguages){if(r?.toLowerCase()===`cimode`&&(!this.options.preload||this.options.preload.length===0))return n();let e=[],t=t=>{t&&t!==`cimode`&&this.services.languageUtils.toResolveHierarchy(t).forEach(t=>{t!==`cimode`&&(e.includes(t)||e.push(t))})};r?t(r):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(e=>t(e)),this.options.preload?.forEach?.(e=>t(e)),this.services.backendConnector.load(e,this.options.ns,e=>{!e&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),n(e)})}else n(null)}reloadResources(e,t,n){let r=os();return typeof e==`function`&&(n=e,e=void 0),typeof t==`function`&&(n=t,t=void 0),e||=this.languages,t||=this.options.ns,n||=Qs,this.services.backendConnector.reload(e,t,e=>{r.resolve(),n(e)}),r}use(e){if(!e)throw Error(`You are passing an undefined module! Please check the object you are passing to i18next.use()`);if(!e.type)throw 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`&&js.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`].includes(e)){for(let e=0;e<this.languages.length;e++){let t=this.languages[e];if(![`cimode`,`dev`].includes(t)&&this.store.hasLanguageSomeTranslations(t)){this.resolvedLanguage=t;break}}!this.resolvedLanguage&&!this.languages.includes(e)&&this.store.hasLanguageSomeTranslations(e)&&(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,t){this.isLanguageChangingTo=e;let n=os();this.emit(`languageChanging`,e);let r=e=>{this.language=e,this.languages=this.services.languageUtils.toResolveHierarchy(e),this.resolvedLanguage=void 0,this.setResolvedLanguage(e)},i=(i,a)=>{a?this.isLanguageChangingTo===e&&(r(a),this.translator.changeLanguage(a),this.isLanguageChangingTo=void 0,this.emit(`languageChanged`,a),this.logger.log(`languageChanged`,a)):this.isLanguageChangingTo=void 0,n.resolve((...e)=>this.t(...e)),t&&t(i,(...e)=>this.t(...e))},a=t=>{!e&&!t&&this.services.languageDetector&&(t=[]);let n=Z(t)?t:t&&t[0],a=this.store.hasLanguageSomeTranslations(n)?n:this.services.languageUtils.getBestMatchFromCodes(Z(t)?[t]:t);a&&(this.language||r(a),this.translator.language||this.translator.changeLanguage(a),this.services.languageDetector?.cacheUserLanguage?.(a)),this.loadResources(a,e=>{i(e,a)})};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),n}getFixedT(e,t,n,r){let i=r?.scopeNs,a=(e,t,...r)=>{let o;o=typeof t==`object`?{...t}:this.options.overloadTranslationOptionHandler([e,t].concat(r)),o.lng=o.lng||a.lng,o.lngs=o.lngs||a.lngs;let s=o.ns!==void 0&&o.ns!==null;o.ns=o.ns||a.ns,o.keyPrefix!==``&&(o.keyPrefix=o.keyPrefix||n||a.keyPrefix);let c={...this.options,...o};Array.isArray(i)&&!s&&(c.ns=i),typeof o.keyPrefix==`function`&&(o.keyPrefix=Ps(o.keyPrefix,c));let l=this.options.keySeparator||`.`,u;return o.keyPrefix&&Array.isArray(e)?u=e.map(e=>(typeof e==`function`&&(e=Ps(e,c)),`${o.keyPrefix}${l}${e}`)):(typeof e==`function`&&(e=Ps(e,c)),u=o.keyPrefix?`${o.keyPrefix}${l}${e}`:e),this.t(u,o)};return Z(e)?a.lng=e:a.lngs=e,a.ns=t,a.keyPrefix=n,a}t(...e){return this.translator?.translate(...e)}exists(...e){return this.translator?.exists(...e)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e,t={}){if(!this.isInitialized)return this.logger.warn(`hasLoadedNamespace: i18next was not initialized`,this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn(`hasLoadedNamespace: i18n.languages were undefined or empty`,this.languages),!1;let n=t.lng||this.resolvedLanguage||this.languages[0],r=this.options?this.options.fallbackLng:!1,i=this.languages[this.languages.length-1];if(n.toLowerCase()===`cimode`)return!0;let a=(e,t)=>{let n=this.services.backendConnector.state[`${e}|${t}`];return n===-1||n===0||n===2};if(t.precheck){let e=t.precheck(this,a);if(e!==void 0)return e}return!!(this.hasResourceBundle(n,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||a(n,e)&&(!r||a(i,e)))}loadNamespaces(e,t){let n=os();return this.options.ns?(Z(e)&&(e=[e]),e.forEach(e=>{this.options.ns.includes(e)||this.options.ns.push(e)}),this.loadResources(e=>{n.resolve(),t&&t(e)}),n):(t&&t(),Promise.resolve())}loadLanguages(e,t){let n=os();Z(e)&&(e=[e]);let r=this.options.preload||[],i=e.filter(e=>!r.includes(e)&&this.services.languageUtils.isSupportedCode(e));return i.length?(this.options.preload=r.concat(i),this.loadResources(e=>{n.resolve(),t&&t(e)}),n):(t&&t(),Promise.resolve())}dir(e){if(e||=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language),!e)return`rtl`;try{let t=new Intl.Locale(e);if(t&&t.getTextInfo){let e=t.getTextInfo();if(e&&e.direction)return e.direction}}catch{}let t=`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`.split(`.`),n=this.services?.languageUtils||new Ls(Xs());return e.toLowerCase().indexOf(`-latn`)>1?`ltr`:t.includes(n.getLanguagePartFromCode(e))||e.toLowerCase().indexOf(`-arab`)>1?`rtl`:`ltr`}static createInstance(t={},n){let r=new e(t,n);return r.createInstance=e.createInstance,r}cloneInstance(t={},n=Qs){let r=t.forkResourceStore;r&&delete t.forkResourceStore;let i={...this.options,...t,isClone:!0},a=new e(i);if((t.debug!==void 0||t.prefix!==void 0)&&(a.logger=a.logger.clone(t)),[`store`,`services`,`language`].forEach(e=>{a[e]=this[e]}),a.services={...this.services},a.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},r&&(a.store=new As(Object.keys(this.store.data).reduce((e,t)=>(e[t]={...this.store.data[t]},e[t]=Object.keys(e[t]).reduce((n,r)=>(n[r]={...e[t][r]},n),e[t]),e),{}),i),a.services.resourceStore=a.store),t.interpolation){let e={...Xs().interpolation,...this.options.interpolation,...t.interpolation},n={...i,interpolation:e};a.services.interpolator=new Us(n)}return a.translator=new Is(a.services,i),a.translator.on(`*`,(e,...t)=>{a.emit(e,...t)}),a.init(i,n),a.translator.options=i,a.translator.backendConnector.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},a}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}.createInstance();Q.createInstance,Q.dir,Q.init,Q.loadResources,Q.reloadResources,Q.use,Q.changeLanguage,Q.getFixedT,Q.t,Q.exists,Q.setDefaultNamespace,Q.hasLoadedNamespace,Q.loadNamespaces,Q.loadLanguages;function ec(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function tc(e){"@babel/helpers - typeof";return tc=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},tc(e)}function nc(e,t){if(tc(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(tc(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function rc(e){var t=nc(e,`string`);return tc(t)==`symbol`?t:t+``}function ic(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,rc(r.key),r)}}function ac(e,t,n){return t&&ic(e.prototype,t),n&&ic(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}var oc=[],sc=oc.forEach,cc=oc.slice,lc=[`__proto__`,`constructor`,`prototype`];function uc(e){return sc.call(cc.call(arguments,1),function(t){if(t)for(var n=0,r=Object.keys(t);n<r.length;n++){var i=r[n];lc.indexOf(i)>-1||e[i]===void 0&&(e[i]=t[i])}}),e}function dc(e){return e?typeof e==`function`?new e:e:null}function fc(){return{handleEmptyResourcesAsFailed:!0,cacheHitMode:`none`,retryOnFailure:!1}}function pc(e,t,n,r){var i=e.read.bind(e);if(i.length===2){try{var a=i(t,n);a&&typeof a.then==`function`?a.then(function(e){return r(null,e)}).catch(r):r(null,a)}catch(e){r(e)}return}i(t,n,r)}var mc=function(){function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};ec(this,e),this.backends=[],this.type=`backend`,this.allOptions=r,this.init(t,n)}return ac(e,[{key:`init`,value:function(e){var t=this,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=e,this.options=uc(n,this.options||{},fc()),this.allOptions=r,this.options.backends&&this.options.backends.length>1&&(this.allOptions.saveMissing||this.allOptions.updateMissing)&&this.services&&this.services.logger&&this.services.logger.warn(`i18next-chained-backend: Using multiple backends in combination with saveMissing/updateMissing is not recommended, as it may trigger based on stale data.`),this.options.backends&&this.options.backends.forEach(function(n,i){t.backends[i]=t.backends[i]||dc(n),t.backends[i].init(e,t.options.backendOptions&&t.options.backendOptions[i]||{},r)}),this.services&&this.options.reloadInterval&&setInterval(function(){return t.reload()},this.options.reloadInterval)}},{key:`read`,value:function(e,t,n){var r=this,i=this.backends.length,a=function(s){if(s>=i)return n(Error(`non of the backend loaded data`),r.options.retryOnFailure);var c=s===i-1,l=r.options.handleEmptyResourcesAsFailed&&!c?0:-1,u=r.backends[s];u.read?pc(u,e,t,function(i,c,d){if(!i&&c&&Object.keys(c).length>l){if(n(null,c,s),o(s-1,c),u.save&&r.options.cacheHitMode&&[`refresh`,`refreshAndUpdateStore`].indexOf(r.options.cacheHitMode)>-1){if(d&&r.options.refreshExpirationTime&&d+r.options.refreshExpirationTime>Date.now())return;var f=r.backends[s+1];f&&f.read&&pc(f,e,t,function(n,i){n||i&&(Object.keys(i).length<=l||(o(s,i),r.options.cacheHitMode===`refreshAndUpdateStore`&&r.services&&r.services.resourceStore&&r.services.resourceStore.addResourceBundle(e,t,i)))})}}else a(s+1)}):a(s+1)},o=function(n,i){if(!(n<0)){var a=r.backends[n];a.save&&a.save(e,t,i),o(n-1,i)}};a(0)}},{key:`create`,value:function(e,t,n,r){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:function(){},a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{};this.backends.forEach(function(o){if(o.create){var s=o.create.bind(o);if(s.length<6){try{var c=s.length===5?s(e,t,n,r,a):s(e,t,n,r);c&&typeof c.then==`function`?c.then(function(e){return i(null,e)}).catch(i):i(null,c)}catch(e){i(e)}return}s(e,t,n,r,i,a)}})}},{key:`reload`,value:function(){var e=this,t=this.services,n=t.backendConnector,r=t.languageUtils,i=t.logger,a=n.language;if(!(a&&a.toLowerCase()===`cimode`)){var o=[],s=function(e){r.toResolveHierarchy(e).forEach(function(e){o.indexOf(e)<0&&o.push(e)})};s(a),this.allOptions.preload&&this.allOptions.preload.forEach(function(e){return s(e)}),o.forEach(function(t){e.allOptions.ns.forEach(function(e){n.read(t,e,`read`,null,null,function(r,a){r&&i.warn(`loading namespace ${e} for language ${t} failed`,r),!r&&a&&i.log(`loaded namespace ${e} for language ${t}`,a),n.loaded(`${t}|${e}`,r,a)})})})}}}])}();mc.type=`backend`;var hc=[];hc.forEach,hc.slice;var gc=[`__proto__`,`constructor`,`prototype`];function _c(e){return!(typeof e!=`string`||e.length===0||e.length>128||gc.indexOf(e)>-1||e.indexOf(`..`)>-1||e.indexOf(`\\`)>-1||/[?#%:\s]/.test(e)||/[\x00-\x1F\x7F]/.test(e))}function vc(e){return!(!_c(e)||e.indexOf(`/`)>-1||e.indexOf(`@`)>-1)}function yc(e){return!(!_c(e)||e.indexOf(`//`)>-1)}var bc={lng:vc,ns:yc};function xc(e){return typeof e==`string`?e.replace(/[\r\n\x00-\x1F\x7F]/g,` `):e}function Sc(e){if(typeof e!=`string`||e.length===0)return e;try{let t=new URL(e);return t.username||t.password?(t.username=``,t.password=``,t.toString()):e}catch{return e.replace(/(\/\/)[^/@\s]+@/g,`$1`)}}function Cc(){return typeof XMLHttpRequest==`function`||typeof XMLHttpRequest==`object`}function wc(e){return!!e&&typeof e.then==`function`}function Tc(e){return wc(e)?e:Promise.resolve(e)}var Ec=/\{\{(.+?)\}\}/g;function Dc(e,t){let n=!1,r=e.replace(Ec,(e,r)=>{let i=r.trim();if(gc.indexOf(i)>-1)return e;let a=t[i];if(a==null)return e;let o=bc[i]||vc,s=String(a).split(`+`);for(let t of s)if(!o(t))return n=!0,e;return s.join(`+`)});return n?null:r}var Oc=typeof globalThis<`u`?globalThis:typeof global<`u`?global:typeof window<`u`?window:void 0,kc;typeof fetch==`function`?kc=fetch:Oc&&typeof Oc.fetch==`function`&&(kc=Oc.fetch);var Ac=Cc()&&Oc?Oc.XMLHttpRequest:void 0,jc=typeof ActiveXObject==`function`&&Oc?Oc.ActiveXObject:void 0,Mc=[`__proto__`,`constructor`,`prototype`],Nc=(e,t)=>{if(t&&typeof t==`object`){let n=``;for(let e of Object.keys(t))Mc.indexOf(e)>-1||(n+=`&`+encodeURIComponent(e)+`=`+encodeURIComponent(t[e]));if(!n)return e;e=e+(e.indexOf(`?`)===-1?`?`:`&`)+n.slice(1)}return e},Pc=(e,t,n,r)=>{let i=e=>{if(!e.ok)return n(e.statusText||`Error`,{status:e.status});e.text().then(t=>{n(null,{status:e.status,data:t})}).catch(n)};if(r){let a=r(e,t);if(a instanceof Promise){a.then(i).catch(n);return}}typeof fetch==`function`?fetch(e,t).then(i).catch(n):kc(e,t).then(i).catch(n)},Fc=(e,t,n,r)=>{e.queryStringParams&&(t=Nc(t,e.queryStringParams));let i={...typeof e.customHeaders==`function`?e.customHeaders():e.customHeaders};typeof window>`u`&&typeof global<`u`&&global.process!==void 0&&global.process.versions&&global.process.versions.node&&(i[`User-Agent`]=`i18next-http-backend (node/${global.process.version}; ${global.process.platform} ${global.process.arch})`),n&&(i[`Content-Type`]=`application/json`);let a=typeof e.requestOptions==`function`?e.requestOptions(n):e.requestOptions,o={method:n?`POST`:`GET`,body:n?e.stringify(n):void 0,headers:i,...e._omitFetchOptions?{}:a},s=typeof e.alternateFetch==`function`&&e.alternateFetch.length>=1?e.alternateFetch:void 0;try{Pc(t,o,r,s)}catch(n){if(!a||Object.keys(a).length===0||!n.message||n.message.indexOf(`not implemented`)<0)return r(n);try{Object.keys(a).forEach(e=>{delete o[e]}),Pc(t,o,r,s),e._omitFetchOptions=!0}catch(e){r(e)}}},Ic=(e,t,n,r)=>{n&&typeof n==`object`&&(n=Nc(``,n).slice(1)),e.queryStringParams&&(t=Nc(t,e.queryStringParams));try{let i=Ac?new Ac:new jc(`MSXML2.XMLHTTP.3.0`);i.open(n?`POST`:`GET`,t,1),e.crossDomain||i.setRequestHeader(`X-Requested-With`,`XMLHttpRequest`),i.withCredentials=!!e.withCredentials,n&&i.setRequestHeader(`Content-Type`,`application/x-www-form-urlencoded`),i.overrideMimeType&&i.overrideMimeType(`application/json`);let a=e.customHeaders;if(a=typeof a==`function`?a():a,a)for(let e of Object.keys(a))Mc.indexOf(e)>-1||i.setRequestHeader(e,a[e]);i.onreadystatechange=()=>{i.readyState>3&&r(i.status>=400?i.statusText:null,{status:i.status,data:i.responseText})},i.send(n)}catch(e){console&&console.log(e)}},Lc=(e,t,n,r)=>{if(typeof n==`function`&&(r=n,n=void 0),r||=(()=>{}),kc&&t.indexOf(`file:`)!==0)return Fc(e,t,n,r);if(Cc()||typeof ActiveXObject==`function`)return Ic(e,t,n,r);r(Error(`No fetch and no xhr implementation found!`))},Rc=()=>({loadPath:`/locales/{{lng}}/{{ns}}.json`,addPath:`/locales/add/{{lng}}/{{ns}}`,parse:e=>JSON.parse(e),stringify:JSON.stringify,parsePayload:(e,t,n)=>({[t]:n||``}),parseLoadPayload:(e,t)=>void 0,request:Lc,reloadInterval:typeof window<`u`?!1:36e5,customHeaders:{},queryStringParams:{},crossDomain:!1,withCredentials:!1,overrideMimeType:!1,requestOptions:{mode:`cors`,credentials:`same-origin`,cache:`default`}}),zc=class{constructor(e,t={},n={}){this.services=e,this.options=t,this.allOptions=n,this.type=`backend`,this.init(e,t,n)}init(e,t={},n={}){if(this.services=e,this.options={...Rc(),...this.options||{},...t},this.allOptions=n,this.services&&this.options.reloadInterval){let e=setInterval(()=>this.reload(),this.options.reloadInterval);typeof e==`object`&&typeof e.unref==`function`&&e.unref()}}readMulti(e,t,n){this._readAny(e,e,t,t,n)}read(e,t,n){this._readAny([e],e,[t],t,n)}_readAny(e,t,n,r,i){let a=this.options.loadPath;typeof this.options.loadPath==`function`&&(a=this.options.loadPath(e,n)),a=Tc(a),a.then(a=>{if(!a)return i(null,{});let o=Dc(a,{lng:e.join(`+`),ns:n.join(`+`)});if(o==null){let t=e.map(xc).join(`, `),r=n.map(xc).join(`, `);return i(Error(`i18next-http-backend: unsafe lng/ns value — refusing to build request URL for languages=[`+t+`] namespaces=[`+r+`]`),!1)}this.loadUrl(o,i,t,r)})}loadUrl(e,t,n,r){let i=typeof n==`string`?[n]:n,a=typeof r==`string`?[r]:r,o=this.options.parseLoadPayload(i,a),s=xc(Sc(e));this.options.request(this.options,e,o,(e,i)=>{if(i&&(i.status>=500&&i.status<600||!i.status))return t(`failed loading `+s+`; status code: `+i.status,!0);if(i&&i.status>=400&&i.status<500)return t(`failed loading `+s+`; status code: `+i.status,!1);if(!i&&e&&e.message){let n=e.message.toLowerCase();if([`failed`,`fetch`,`network`,`load`].find(e=>n.indexOf(e)>-1))return t(`failed loading `+s+`: `+xc(e.message),!0)}if(e)return t(e,!1);let a,o;try{a=typeof i.data==`string`?this.options.parse(i.data,n,r):i.data}catch{o=`failed parsing `+s+` to json`}if(o)return t(o,!1);t(null,a)})}create(e,t,n,r,i){if(!this.options.addPath)return;typeof e==`string`&&(e=[e]);let a=this.options.parsePayload(t,n,r),o=0,s=[],c=[];e.forEach(n=>{let r=this.options.addPath;typeof this.options.addPath==`function`&&(r=this.options.addPath(n,t));let l=Dc(r,{lng:n,ns:t});if(l==null){o+=1,i&&o===e.length&&i(s,c);return}this.options.request(this.options,l,a,(t,n)=>{o+=1,s.push(t),c.push(n),o===e.length&&typeof i==`function`&&i(s,c)})})}reload(){let{backendConnector:e,languageUtils:t,logger:n}=this.services,r=e.language;if(r&&r.toLowerCase()===`cimode`)return;let i=[],a=e=>{t.toResolveHierarchy(e).forEach(e=>{i.indexOf(e)<0&&i.push(e)})};a(r),this.allOptions.preload&&this.allOptions.preload.forEach(e=>a(e)),i.forEach(t=>{this.allOptions.ns.forEach(r=>{e.read(t,r,`read`,null,null,(i,a)=>{i&&n.warn(`loading namespace ${r} for language ${t} failed`,i),!i&&a&&n.log(`loaded namespace ${r} for language ${t}`,a),e.loaded(`${t}|${r}`,i,a)})})})}};zc.type=`backend`;function Bc(e,t,n){return(t=rc(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Vc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Hc(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Vc(Object(n),!0).forEach(function(t){Bc(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Vc(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Uc=function(){function e(t){ec(this,e),this.store=t.store}return ac(e,[{key:`setItem`,value:function(e,t){if(this.store)try{this.store.setItem(e,t)}catch{}}},{key:`getItem`,value:function(e,t){if(this.store)try{return this.store.getItem(e,t)}catch{}}}])}();function Wc(){var e=null;try{e=window.localStorage}catch(e){typeof window<`u`&&console.log(`Failed to load local storage.`,e)}return{prefix:`i18next_res_`,expirationTime:6048e5,defaultVersion:void 0,getVersion:void 0,versions:{},store:e}}var Gc=function(){function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};ec(this,e),this.init(t,n),this.type=`backend`}return ac(e,[{key:`init`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.services=e,this.options=Hc(Hc(Hc({},Wc()),this.options),t),this.storage=new Uc(this.options)}},{key:`read`,value:function(e,t,n){var r=Date.now();if(!this.storage.store)return n(null,null);var i=this.storage.getItem(`${this.options.prefix}${e}-${t}`);if(i)try{i=JSON.parse(i)}catch{i=null}if(i&&tc(i)===`object`){var a=this.getVersion(e,t);if(i.i18nStamp&&i.i18nStamp+this.options.expirationTime>r&&a===i.i18nVersion){var o=i.i18nStamp;return delete i.i18nVersion,delete i.i18nStamp,n(null,i,o)}}return n(null,null)}},{key:`save`,value:function(e,t,n){if(this.storage.store){var r=Hc(Hc({},n),{},{i18nStamp:Date.now()}),i=this.getVersion(e,t);i&&(r.i18nVersion=i),this.storage.setItem(`${this.options.prefix}${e}-${t}`,JSON.stringify(r))}}},{key:`getVersion`,value:function(e,t){var n=this.options,r=n.getVersion,i=n.versions,a=n.defaultVersion,o=Object.prototype.hasOwnProperty.call(i,e)?i[e]:void 0;return r?.(e,t)||o||a}}])}();Gc.type=`backend`;var Kc={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,"!doctype":!0,"!DOCTYPE":!0},qc=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?("[^"]*"|'[^']*')/g;function Jc(e){let t={type:`tag`,name:``,voidElement:!1,attrs:{},children:[]},n=e.match(/<\/?([^\s]+?)[/\s>]/);if(n&&(t.name=n[1],(Kc[n[1]]||e.charAt(e.length-2)===`/`)&&(t.voidElement=!0),t.name.startsWith(`!--`))){let t=e.indexOf(`-->`);return{type:`comment`,comment:t===-1?``:e.slice(4,t)}}let r=new RegExp(qc),i=null;for(;i=r.exec(e),i!==null;)if(i[0].trim()){if(i[1]){let e=i[1].trim(),n=[e,null],a=e.indexOf(`=`);a>-1&&(n=[e.slice(0,a),e.slice(a+1)]),t.attrs[n[0]]=n[1],r.lastIndex--}else i[2]&&(t.attrs[i[2]]=i[3].trim().substring(1,i[3].length-1))}return t}var Yc=/<!--[\s\S]*?-->|<[a-zA-Z0-9\-!/](?:"[^"]*"|'[^']*'|[^'">])*>/g,Xc=/<\/?([^\s]+?)[/\s>]/,Zc=/^\s*$/,Qc=/^(script|style)$/i,$c=`\0`,el=Object.create(null);function tl(e){e.forEach(function(e){if(e.type===`text`){e.content=e.content.split($c).join(`<`);return}if(e.type===`comment`){e.comment=e.comment.split($c).join(`<`);return}for(let t in e.attrs){let n=e.attrs[t];typeof n==`string`&&n.indexOf($c)>-1&&(e.attrs[t]=n.split($c).join(`<`))}e.children.length&&tl(e.children)})}function nl(e,t){let n=t&&t.components||el,r=t&&t.allowedTags,i=!1;if(r){let t=typeof r==`function`?r:function(e){return r.indexOf(e)>-1},n=``,a=0;Yc.lastIndex=0;let o;for(;o=Yc.exec(e);){let r=o[0];n+=e.slice(a,o.index);let s=r.match(Xc);r.startsWith(`<!--`)||s&&t(s[1])?(n+=r,a=o.index+r.length):(i=!0,n+=$c,a=o.index+1,Yc.lastIndex=a)}e=n+e.slice(a)}let a=[],o=[],s,c=-1,l=!1,u=0,d;if(e.indexOf(`<`)!==0){let t=e.indexOf(`<`);a.push({type:`text`,content:t===-1?e:e.substring(0,t)})}let f=[],p;for(;p=Yc.exec(e);)f.push(p);return f.forEach(function(e,t){let n=e[0];if(!n||n.startsWith(`<!--`))return;let r=0,i=0,a=-1,o=null;for(let e=0;e<n.length;e++){let t=n.charAt(e);o?t===o&&(o=null):t===`"`||t===`'`?o=t:t===`<`?(r++,r===2&&(a=e)):t===`>`&&i++}let s=a>-1&&/[a-zA-Z0-9\-!/]/.test(n.charAt(a+1));if(r>i&&s){let e=n.substring(0,a),r=n.substring(e.length);f[t][0]=r,f[t].index+=e.length}}),f.forEach(function(t,r){let i=t[0];if(!i)return;let p=t.index;if(p<u)return;if(l){if(i!==`</`+s.name+`>`)return;l=!1}let m=i.charAt(1)!==`/`,h=i.startsWith(`<!--`),g=p+i.length,_=e.charAt(g),v=f[r+1],y;if(_===`<`&&v){let t=e.substring(g,v.index);y=t.split(`<`).length>t.split(`>`).length}let b;if(h){let t=Jc(i);if(c<0)return a.push(t),a;b=o[c],b.children.push(t);let n=e.slice(g,v?v.index:void 0);return n.length>0&&b.children.push({type:`text`,content:n}),a}if(m){c++,s=Jc(i),s.type===`tag`&&n[s.name]&&(s.type=`component`,l=!0);let t=!1;if(!l&&!s.voidElement&&Qc.test(s.name)){t=!0,d||=e.toLowerCase();let n=d.indexOf(`</`+s.name.toLowerCase()+`>`,g),r=n===-1?e.length:n,i=e.slice(g,r);i&&s.children.push({type:`text`,content:i}),u=r}!s.voidElement&&!l&&!t&&_&&_!==`<`&&s.children.push({type:`text`,content:e.slice(g,v?v.index:void 0)}),c===0&&a.push(s),b=o[c-1],b&&b.children.push(s),o[c]=s}if((!m||s.voidElement)&&(c>-1&&(s.voidElement||s.name===i.slice(2,-1))&&(c--,s=c===-1?a:o[c]),!l&&(_!==`<`||y)&&_)){b=c===-1?a:o[c].children;let t=v?v.index:-1,n=e.slice(g,t===-1?void 0:t);Zc.test(n)&&(n=` `),(t>-1&&c+b.length>=0||n!==` `)&&b.push({type:`text`,content:n})}}),i&&tl(a),a}function rl(e){let t=[];for(let n in e)e[n]===null?t.push(n):t.push(n+`="`+String(e[n]).replace(/"/g,`&quot;`)+`"`);return t.length?` `+t.join(` `):``}function il(e,t){switch(t.type){case`text`:return e+t.content;case`tag`:{let n=t.voidElement&&t.name.toLowerCase()!==`!doctype`?`/>`:`>`;return e+=`<`+t.name+(t.attrs?rl(t.attrs):``)+n,t.voidElement?e:e+t.children.reduce(il,``)+`</`+t.name+`>`}case`comment`:return e+=`<!--`+t.comment+`-->`,e}}function al(e){return e.reduce(function(e,t){return e+il(``,t)},``)}var ol={parse:nl,stringify:al},sl=(e,t,n,r)=>{let i=[n,{code:t,...r||{}}];if(e?.services?.logger?.forward)return e.services.logger.forward(i,`warn`,`react-i18next::`,!0);ul(i[0])&&(i[0]=`react-i18next:: ${i[0]}`),e?.services?.logger?.warn?e.services.logger.warn(...i):console?.warn&&console.warn(...i)},cl={},ll=(e,t,n,r)=>{ul(n)&&cl[n]||(ul(n)&&(cl[n]=new Date),sl(e,t,n,r))},ul=e=>typeof e==`string`,dl=e=>typeof e==`object`&&!!e,fl=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,pl={"&amp;":`&`,"&#38;":`&`,"&lt;":`<`,"&#60;":`<`,"&gt;":`>`,"&#62;":`>`,"&apos;":`'`,"&#39;":`'`,"&quot;":`"`,"&#34;":`"`,"&nbsp;":` `,"&#160;":` `,"&copy;":`©`,"&#169;":`©`,"&reg;":`®`,"&#174;":`®`,"&hellip;":`…`,"&#8230;":`…`,"&#x2F;":`/`,"&#47;":`/`},ml=e=>pl[e],hl=e=>e.replace(fl,ml),gl={bindI18n:`languageChanged`,bindI18nStore:``,transEmptyNodeValue:``,transSupportBasicHtmlNodes:!0,transWrapTextNodes:``,transKeepBasicHtmlNodesFor:[`br`,`strong`,`i`,`p`],useSuspense:!0,unescape:hl,transDefaultProps:void 0},_l=(e={})=>{gl={...gl,...e}},vl=()=>gl,yl,bl=e=>{yl=e},xl=()=>yl,Sl=(e,t)=>{if(!e)return!1;let n=e.props?.children??e.children;return t?n.length>0:!!n},Cl=e=>{if(!e)return[];let t=e.props?.children??e.children;return e.props?.i18nIsDynamicList?Tl(t):t},wl=t=>Array.isArray(t)&&t.every(e.isValidElement),Tl=e=>Array.isArray(e)?e:[e],El=(e,t)=>{let n={...t};return n.props={...t.props,...e.props},n},Dl=t=>{let n={};if(!t)return n;let r=t=>{Tl(t).forEach(t=>{ul(t)||(Sl(t)?r(Cl(t)):dl(t)&&!(0,e.isValidElement)(t)&&Object.assign(n,t))})};return r(t),n},Ol=(t,n,r,i)=>{if(!t)return``;let a=``,o=Tl(t),s=n?.transSupportBasicHtmlNodes?n.transKeepBasicHtmlNodesFor??[]:[];return o.forEach((t,o)=>{if(ul(t)){a+=`${t}`;return}if((0,e.isValidElement)(t)){let{props:e,type:c}=t,l=Object.keys(e).length,u=s.indexOf(c)>-1,d=e.children;if(!d&&u&&!l){a+=`<${c}/>`;return}if(!d&&(!u||l)||e.i18nIsDynamicList){a+=`<${o}></${o}>`;return}if(u&&l<=1){let e=ul(d)?d:Ol(d,n,r,i);a+=`<${c}>${e}</${c}>`;return}let f=Ol(d,n,r,i);a+=`<${o}>${f}</${o}>`;return}if(t===null){sl(r,`TRANS_NULL_VALUE`,`Passed in a null value as child`,{i18nKey:i});return}if(dl(t)){let{format:e,...n}=t,o=Object.keys(n);if(o.length===1){let t=e?`${o[0]}, ${e}`:o[0];a+=`{{${t}}}`;return}sl(r,`TRANS_INVALID_OBJ`,`Invalid child - Object should only have keys {{ value, format }} (format is optional).`,{i18nKey:i,child:t});return}sl(r,`TRANS_INVALID_VAR`,`Passed in a variable like {number} - pass variables for interpolation as full objects like {{number}}.`,{i18nKey:i,child:t})}),a},kl=(t,n,r,i,a,o,s)=>{if(r===``)return[];let c=a.transKeepBasicHtmlNodesFor||[],l=r&&new RegExp(c.map(e=>`<${e}`).join(`|`)).test(r);if(!t&&!n&&!l&&!s)return[r];let u=n??{},d=t=>{Tl(t).forEach(t=>{ul(t)||(Sl(t)?d(Cl(t)):dl(t)&&!(0,e.isValidElement)(t)&&Object.assign(u,t))})};d(t);let f=Object.keys(u),p=ol.parse(`<0>${r}</0>`,{allowedTags:e=>/^\d+$/.test(e)||c.indexOf(e)>-1||f.indexOf(e)>-1}),m={...u,...o},h=(e,t,n)=>{let r=Cl(e),i=_(r,t.children,n);return wl(r)&&i.length===0||e.props?.i18nIsDynamicList?r:i},g=(t,n,r,i,a)=>{t.dummy?(t.children=n,r.push((0,e.cloneElement)(t,{key:i},a?void 0:n))):r.push(...e.Children.map([t],t=>{if(t.type===e.Fragment||t.props?.i18nIsDynamicList!==void 0){let r={key:i};return t&&t.props&&Object.keys(t.props).forEach(e=>{e!==`children`&&e!==`i18nIsDynamicList`&&(r[e]=t.props[e])}),(0,e.createElement)(t.type,r,a?null:n)}let r={key:i};return t&&t.props&&Object.keys(t.props).forEach(e=>{e!==`ref`&&e!==`children`&&(r[e]=t.props[e])}),(0,e.cloneElement)(t,r,a?null:n)}))},_=(t,r,o)=>{let u=Tl(t),d=Tl(r),f={};return d.reduce((t,r,d)=>{let p=r.children?.[0]?.content&&i.services.interpolator.interpolate(r.children[0].content,m,i.language);if(r.type===`tag`){let v=u[parseInt(r.name,10)];!v&&n&&(v=n[r.name]),o.length===1&&!v&&(v=o[0][r.name]),v||={};let y={...r.attrs};s&&Object.keys(y).forEach(e=>{let t=y[e];ul(t)&&(y[e]=hl(t))});let b=Object.keys(y).length===0?v:El({props:y},v),x=(0,e.isValidElement)(b),S=x&&Sl(r,!0)&&!r.voidElement,C=l&&dl(b)&&b.dummy&&!x,w=dl(n)&&Object.hasOwnProperty.call(n,r.name);if(ul(b)){let e=i.services.interpolator.interpolate(b,m,i.language);t.push(e)}else if(Sl(b)||S){let e=h(b,r,o);g(b,e,t,d)}else if(C){let e=_(u,r.children,o);g(b,e,t,d)}else if(Number.isNaN(parseFloat(r.name))){if(w){let e=h(b,r,o);g(b,e,t,d,r.voidElement)}else if(a.transSupportBasicHtmlNodes&&c.indexOf(r.name)>-1){if(r.voidElement)t.push((0,e.createElement)(r.name,{key:`${r.name}-${d}`}));else{let n=f[r.name]||0;f[r.name]=n+1;let i,a=0;for(let t=0;t<u.length;t+=1){let o=u[t];if((0,e.isValidElement)(o)&&o.type===r.name){if(a===n){i=o;break}a+=1}}let s=i?Tl(Cl(i)):u,c=_(s,r.children,o);t.push((0,e.createElement)(r.name,{key:`${r.name}-${d}`},c))}}else if(r.voidElement)t.push(`<${r.name} />`);else{let e=_(u,r.children,o);t.push(`<${r.name}>${e}</${r.name}>`)}}else if(dl(b)&&!x){let e=r.children[0]?p:null;e&&t.push(e)}else g(b,p,t,d,r.children.length!==1||!p)}else if(r.type===`text`){let n=a.transWrapTextNodes,o=typeof a.unescape==`function`?a.unescape:vl().unescape,c=s?o(i.services.interpolator.interpolate(r.content,m,i.language)):i.services.interpolator.interpolate(r.content,m,i.language);n?t.push((0,e.createElement)(n,{key:`${r.name}-${d}`},c)):t.push(c)}return t},[])};return Cl(_([{dummy:!0,children:t||[]}],p,Tl(t||[]))[0])},Al=(t,n,r)=>{let i=t.key||n,a=(0,e.cloneElement)(t,{key:i});if(!a.props||!a.props.children||r.indexOf(`${n}/>`)<0&&r.indexOf(`${n} />`)<0)return a;function o(){return(0,e.createElement)(e.Fragment,null,a)}return(0,e.createElement)(o,{key:i})},jl=(e,t)=>e.map((e,n)=>Al(e,n,t)),Ml=(e,t)=>{let n={};return Object.keys(e).forEach(r=>{Object.assign(n,{[r]:Al(e[r],r,t)})}),n},Nl=(e,t,n,r)=>e?Array.isArray(e)?jl(e,t):dl(e)?Ml(e,t):(ll(n,`TRANS_INVALID_COMPONENTS`,`<Trans /> "components" prop expects an object or array`,{i18nKey:r}),null):null,Pl=e=>!dl(e)||Array.isArray(e)?!1:Object.keys(e).reduce((e,t)=>e&&Number.isNaN(Number.parseFloat(t)),!0);function Fl({children:t,count:n,parent:r,i18nKey:i,context:a,tOptions:o={},values:s,defaults:c,components:l,ns:u,i18n:d,t:f,shouldUnescape:p,...m}){let h=d||xl();if(!h)return ll(h,`NO_I18NEXT_INSTANCE`,`Trans: You need to pass in an i18next instance using initReactI18next or by passing it via props or context. In monorepo setups, make sure there is only one instance of react-i18next.`,{i18nKey:i}),t;let g=f||h.t.bind(h)||(e=>e),_={...vl(),...h.options?.react},v=u||g.ns||h.options?.defaultNS;v=ul(v)?[v]:v||[`translation`];let{transDefaultProps:y}=_,b=y?.tOptions?{...y.tOptions,...o}:o,x=p??y?.shouldUnescape,S=y?.values?{...y.values,...s}:s,C=y?.components?{...y.components,...l}:l,w=Ol(t,_,h,i),T=c||b?.defaultValue||w||_.transEmptyNodeValue||(typeof i==`function`?Ps(i):i),{hashTransKey:E}=_,D=i||(E?E(w||T):w||T);s=h.options?.interpolation?.defaultVariables?S&&Object.keys(S).length>0?{...S,...h.options.interpolation.defaultVariables}:{...h.options.interpolation.defaultVariables}:S;let O=Dl(t);O&&typeof O.count==`number`&&n===void 0&&(n=O.count);let k=s||n!==void 0&&!h.options?.interpolation?.alwaysFormat||!t?b.interpolation:{interpolation:{...b.interpolation,prefix:`#$?`,suffix:`?$#`}},A={...b,context:a||b.context,count:n,...s,...k,defaultValue:T,ns:v},j=D?g(D,A):T;j===D&&T&&(j=T);let M=Nl(C,j,h,i),N=M||t,P=null;Pl(M)&&(P=M,N=t);let F=kl(N,P,j,h,_,A,x),ee=r??_.defaultTransParent;return ee?(0,e.createElement)(ee,m,F):F}var Il={type:`3rdParty`,init(e){_l(e.options.react),bl(e)}},Ll=(0,e.createContext)();function Rl({children:t,count:n,parent:r,i18nKey:i,context:a,tOptions:o={},values:s,defaults:c,components:l,ns:u,i18n:d,t:f,shouldUnescape:p,...m}){let{i18n:h,defaultNS:g}=(0,e.useContext)(Ll)||{},_=d||h||xl(),v=f||_?.t.bind(_);return Fl({children:t,count:n,parent:r,i18nKey:i,context:a,tOptions:o,values:s,defaults:c,components:l,ns:u||v?.ns||g||_?.options?.defaultNS,i18n:_,t:f,shouldUnescape:p,...m})}var zl={af:{name:`Afrikaans`,nativeName:`Afrikaans`,code:`af`,locale:`af`},ak:{name:`Akan`,nativeName:`Akan`,code:`ak`,locale:`ak`},sq:{name:`Albanian`,nativeName:`Shqip`,code:`sq`,locale:`sq`},arq:{name:`Algerian Arabic`,nativeName:`الدارجة الجزايرية`,code:`arq`,locale:`ar_DZ`},am:{name:`Amharic`,nativeName:`አማርኛ`,code:`am`,locale:`am`},ar:{name:`Arabic`,nativeName:`العربية`,code:`ar`,locale:`ar`},hy:{name:`Armenian`,nativeName:`Հայերեն`,code:`hy`,locale:`hy`},frp:{name:`Arpitan`,nativeName:`Arpitan`,code:`frp`,locale:`frp`},as:{name:`Assamese`,nativeName:`অসমীয়া`,code:`as`,locale:`as`},az:{name:`Azerbaijani`,nativeName:`Azərbaycan dili`,code:`az`,locale:`az`},ba:{name:`Bashkir`,nativeName:`башҡорт теле`,code:`ba`,locale:`ba`},eu:{name:`Basque`,nativeName:`Euskara`,code:`eu`,locale:`eu`},be:{name:`Belarusian`,nativeName:`Беларуская мова`,code:`be`,locale:`be`,alternatives:[`bel`]},bn:{name:`Bengali`,nativeName:`বাংলা`,code:`bn`,locale:`bn_BD`},bs:{name:`Bosnian`,nativeName:`Bosanski`,code:`bs`,locale:`bs_BA`},br:{name:`Breton`,nativeName:`Brezhoneg`,code:`br`,locale:`br`,alternatives:[`bre`]},bg:{name:`Bulgarian`,nativeName:`Български`,code:`bg`,locale:`bg_BG`},ca:{name:`Catalan`,nativeName:`Català`,code:`ca`,locale:`ca_ES`},ceb:{name:`Cebuano`,nativeName:`Cebuano`,code:`ceb`,locale:`ceb`},"zh-cn":{name:`Chinese (China)`,nativeName:`简体中文`,code:`zh-cn`,locale:`zh_CN`},"zh-hk":{name:`Chinese (Hong Kong)`,nativeName:`繁體中文(香港)`,code:`zh-hk`,locale:`zh_HK`},"zh-tw":{name:`Chinese (Taiwan)`,nativeName:`繁體中文(台灣)`,code:`zh-tw`,locale:`zh_TW`},co:{name:`Corsican`,nativeName:`Corsu`,code:`co`,locale:`co`},hr:{name:`Croatian`,nativeName:`Hrvatski`,code:`hr`,locale:`hr`},cs:{name:`Czech`,nativeName:`Čeština`,code:`cs`,locale:`cs_CZ`},da:{name:`Danish`,nativeName:`Dansk`,code:`da`,locale:`da_DK`},dv:{name:`Divehi`,nativeName:`ދިވެހި`,code:`dv`,locale:`dv`},nl:{name:`Dutch`,nativeName:`Nederlands`,code:`nl`,locale:`nl_NL`},"nl-be":{name:`Dutch (Belgium)`,nativeName:`Nederlands (België)`,code:`nl-be`,locale:`nl_BE`},"en-au":{name:`English (Australia)`,nativeName:`English (Australia)`,code:`en-au`,locale:`en_AU`},"en-ca":{name:`English (Canada)`,nativeName:`English (Canada)`,code:`en-ca`,locale:`en_CA`},"en-nz":{name:`English (New Zealand)`,nativeName:`English (New Zealand)`,code:`en-nz`,locale:`en_NZ`},"en-za":{name:`English (South Africa)`,nativeName:`English (South Africa)`,code:`en-za`,locale:`en_ZA`},"en-gb":{name:`English (UK)`,nativeName:`English (UK)`,code:`en-gb`,locale:`en_GB`},en:{name:`English (US)`,nativeName:`English (US)`,code:`en`,locale:`en_US`},eo:{name:`Esperanto`,nativeName:`Esperanto`,code:`eo`,locale:`eo`},et:{name:`Estonian`,nativeName:`Eesti`,code:`et`,locale:`et`},fo:{name:`Faroese`,nativeName:`Føroyskt`,code:`fo`,locale:`fo`},fi:{name:`Finnish`,nativeName:`Suomi`,code:`fi`,locale:`fi`},"fr-be":{name:`French (Belgium)`,nativeName:`Français (Belgique)`,code:`fr-be`,locale:`fr_BE`},"fr-ca":{name:`French (Canada)`,nativeName:`Français (Canada)`,code:`fr-ca`,locale:`fr_CA`},fr:{name:`French`,nativeName:`Français`,code:`fr`,locale:`fr_FR`},fy:{name:`Frisian`,nativeName:`Frysk`,code:`fy`,locale:`fy`},fur:{name:`Friulian`,nativeName:`Friulian`,code:`fur`,locale:`fur`},ff:{name:`Fulah`,nativeName:`Pulaar`,code:`ff`,locale:`ff`,alternatives:[`fuc`]},gl:{name:`Galician`,nativeName:`Galego`,code:`gl`,locale:`gl_ES`},ka:{name:`Georgian`,nativeName:`ქართული`,code:`ka`,locale:`ka_GE`},de:{name:`German`,nativeName:`Deutsch`,code:`de`,locale:`de_DE`},"de-ch":{name:`German (Switzerland)`,nativeName:`Deutsch (Schweiz)`,code:`de-ch`,locale:`de_CH`},el:{name:`Greek`,nativeName:`Ελληνικά`,code:`el`,locale:`el`},kl:{name:`Greenlandic`,nativeName:`Kalaallisut`,code:`kl`,locale:`kl`,alternatives:[`kal`]},gu:{name:`Gujarati`,nativeName:`ગુજરાતી`,code:`gu`,locale:`gu`},haw:{name:`Hawaiian`,nativeName:`ʻŌlelo Hawaiʻi`,code:`haw`,locale:`haw`},he:{name:`Hebrew`,nativeName:`עברית`,code:`he`,locale:`he_IL`},hi:{name:`Hindi`,nativeName:`हिन्दी`,code:`hi`,locale:`hi_IN`},hu:{name:`Hungarian`,nativeName:`Magyar`,code:`hu`,locale:`hu_HU`},is:{name:`Icelandic`,nativeName:`Íslenska`,code:`is`,locale:`is_IS`},ido:{name:`Ido`,nativeName:`Ido`,code:`ido`,locale:`ido`},id:{name:`Indonesian`,nativeName:`Bahasa Indonesia`,code:`id`,locale:`id_ID`},ga:{name:`Irish`,nativeName:`Gaeilge`,code:`ga`,locale:`ga`},it:{name:`Italian`,nativeName:`Italiano`,code:`it`,locale:`it_IT`},ja:{name:`Japanese`,nativeName:`日本語`,code:`ja`,locale:`ja`},jv:{name:`Javanese`,nativeName:`Basa Jawa`,code:`jv`,locale:`jv`},kab:{name:`Kabyle`,nativeName:`Taqbaylit`,code:`kab`,locale:`kab`},kn:{name:`Kannada`,nativeName:`ಕನ್ನಡ`,code:`kn`,locale:`kn`},kk:{name:`Kazakh`,nativeName:`Қазақ тілі`,code:`kk`,locale:`kk`},km:{name:`Khmer`,nativeName:`ភាសាខ្មែរ`,code:`km`,locale:`km`},rw:{name:`Kinyarwanda`,nativeName:`Ikinyarwanda`,code:`rw`,locale:`rw`,alternatives:[`kin`]},ky:{name:`Kirghiz`,nativeName:`кыргыз тили`,code:`ky`,locale:`ky`},ko:{name:`Korean`,nativeName:`한국어`,code:`ko`,locale:`ko_KR`},ckb:{name:`Kurdish (Sorani)`,nativeName:`کوردی`,code:`ckb`,locale:`ckb`},lo:{name:`Lao`,nativeName:`ພາສາລາວ`,code:`lo`,locale:`lo`},lv:{name:`Latvian`,nativeName:`Latviešu valoda`,code:`lv`,locale:`lv`},li:{name:`Limburgish`,nativeName:`Limburgs`,code:`li`,locale:`li`},ln:{name:`Lingala`,nativeName:`Ngala`,code:`ln`,locale:`ln`,alternatives:[`lin`]},lt:{name:`Lithuanian`,nativeName:`Lietuvių kalba`,code:`lt`,locale:`lt_LT`},lb:{name:`Luxembourgish`,nativeName:`Lëtzebuergesch`,code:`lb`,locale:`lb`},mk:{name:`Macedonian`,nativeName:`Македонски јазик`,code:`mk`,locale:`mk_MK`},mg:{name:`Malagasy`,nativeName:`Malagasy`,code:`mg`,locale:`mg`},ms:{name:`Malay`,nativeName:`Bahasa Melayu`,code:`ms`,locale:`ms_MY`},ml:{name:`Malayalam`,nativeName:`മലയാളം`,code:`ml`,locale:`ml_IN`},mi:{name:`Maori`,nativeName:`Te Reo Māori`,code:`mi`,locale:`mi`,alternatives:[`mri`]},mr:{name:`Marathi`,nativeName:`मराठी`,code:`mr`,locale:`mr`},mn:{name:`Mongolian`,nativeName:`Монгол`,code:`mn`,locale:`mn`},me:{name:`Montenegrin`,nativeName:`Crnogorski`,code:`me`,locale:`crn`},ary:{name:`Moroccan Arabic`,nativeName:`العربية المغربية`,code:`ary`,locale:`ary`},my:{name:`Myanmar (Burmese)`,nativeName:`ဗမာစာ`,code:`my`,locale:`my_MM`},ne:{name:`Nepali`,nativeName:`नेपाली`,code:`ne`,locale:`ne_NP`},nb:{name:`Norwegian Bokmål`,nativeName:`Norsk bokmål`,code:`nb`,locale:`nb_NO`},nn:{name:`Norwegian Nynorsk`,nativeName:`Norsk nynorsk`,code:`nn`,locale:`nn_NO`},oc:{name:`Occitan`,nativeName:`Occitan`,code:`oc`,locale:`oc`,alternatives:[`oci`]},ps:{name:`Pashto`,nativeName:`پښتو`,code:`ps`,locale:`ps`},fa:{name:`Persian`,nativeName:`فارسی`,code:`fa`,locale:`fa_IR`},"fa-af":{name:`Persian (Afghanistan)`,nativeName:`فارسی (افغانستان)`,code:`fa-af`,locale:`fa_AF`},pl:{name:`Polish`,nativeName:`Polski`,code:`pl`,locale:`pl_PL`},"pt-br":{name:`Portuguese (Brazil)`,nativeName:`Português do Brasil`,code:`pt-br`,locale:`pt_BR`},pt:{name:`Portuguese (Portugal)`,nativeName:`Português`,code:`pt`,locale:`pt_PT`},pa:{name:`Punjabi`,nativeName:`ਪੰਜਾਬੀ`,code:`pa`,locale:`pa_IN`},ro:{name:`Romanian`,nativeName:`Română`,code:`ro`,locale:`ro_RO`},rm:{name:`Romansh`,nativeName:`Rumantsch`,code:`rm`,locale:`rm`,alternatives:[`roh`]},ru:{name:`Russian`,nativeName:`Русский`,code:`ru`,locale:`ru_RU`},rue:{name:`Rusyn`,nativeName:`Русиньскый`,code:`rue`,locale:`rue`},sah:{name:`Sakha`,nativeName:`Сахалыы`,code:`sah`,locale:`sah`},sa:{name:`Sanskrit`,nativeName:`संस्कृत`,code:`sa`,locale:`sa_IN`},sc:{name:`Sardinian`,nativeName:`Sardu`,code:`sc`,locale:`sc`,alternatives:[`srd`]},gd:{name:`Scottish Gaelic`,nativeName:`Gàidhlig`,code:`gd`,locale:`gd`},sr:{name:`Serbian`,nativeName:`Српски`,code:`sr`,locale:`sr_RS`},szl:{name:`Silesian`,nativeName:`Ślōnskŏ gŏdka`,code:`szl`,locale:`szl`},sd:{name:`Sindhi`,nativeName:`سنڌي`,code:`sd`,locale:`sd`,alternatives:[`snd`]},si:{name:`Sinhala`,nativeName:`සිංහල`,code:`si`,locale:`si_LK`},sk:{name:`Slovak`,nativeName:`Slovenčina`,code:`sk`,locale:`sk_SK`},sl:{name:`Slovenian`,nativeName:`Slovenščina`,code:`sl`,locale:`sl_SI`},so:{name:`Somali`,nativeName:`Afsoomaali`,code:`so`,locale:`so`},"es-ar":{name:`Spanish (Argentina)`,nativeName:`Español de Argentina`,code:`es-ar`,locale:`es_AR`},"es-cl":{name:`Spanish (Chile)`,nativeName:`Español de Chile`,code:`es-cl`,locale:`es_CL`},"es-co":{name:`Spanish (Colombia)`,nativeName:`Español de Colombia`,code:`es-co`,locale:`es_CO`},"es-mx":{name:`Spanish (Mexico)`,nativeName:`Español de México`,code:`es-mx`,locale:`es_MX`},"es-pe":{name:`Spanish (Peru)`,nativeName:`Español de Perú`,code:`es-pe`,locale:`es_PE`},"es-pr":{name:`Spanish (Puerto Rico)`,nativeName:`Español de Puerto Rico`,code:`es-pr`,locale:`es_PR`},es:{name:`Spanish (Spain)`,nativeName:`Español`,code:`es`,locale:`es_ES`},"es-ve":{name:`Spanish (Venezuela)`,nativeName:`Español de Venezuela`,code:`es-ve`,locale:`es_VE`},su:{name:`Sundanese`,nativeName:`Basa Sunda`,code:`su`,locale:`su`},sw:{name:`Swahili`,nativeName:`Kiswahili`,code:`sw`,locale:`sw`},sv:{name:`Swedish`,nativeName:`Svenska`,code:`sv`,locale:`sv_SE`},gsw:{name:`Swiss German`,native:`Schwyzerdütsch`,code:`gsw`,locale:`gsw`},tl:{name:`Tagalog`,nativeName:`Tagalog`,code:`tl`,locale:`tl`},tg:{name:`Tajik`,nativeName:`Тоҷикӣ`,code:`tg`,locale:`tg`},tzm:{name:`Tamazight (Central Atlas)`,nativeName:`ⵜⴰⵎⴰⵣⵉⵖⵜ`,code:`tzm`,locale:`tzm`},ta:{name:`Tamil`,nativeName:`தமிழ்`,code:`ta`,locale:`ta_IN`},"ta-lk":{name:`Tamil (Sri Lanka)`,nativeName:`தமிழ்`,code:`ta-lk`,locale:`ta_LK`},tt:{name:`Tatar`,nativeName:`Татар теле`,code:`tt`,locale:`tt`},te:{name:`Telugu`,nativeName:`తెలుగు`,code:`te`,locale:`te`},th:{name:`Thai`,nativeName:`ไทย`,code:`th`,locale:`th`},bo:{name:`Tibetan`,nativeName:`བོད་སྐད`,code:`bo`,locale:`bo`},ti:{name:`Tigrinya`,nativeName:`ትግርኛ`,code:`ti`,locale:`ti`,alternatives:[`tir`]},tr:{name:`Turkish`,nativeName:`Türkçe`,code:`tr`,locale:`tr_TR`},tk:{name:`Turkmen`,nativeName:`Türkmençe`,code:`tk`,locale:`tk`,alternatives:[`tuk`]},twd:{name:`Tweants`,nativeName:`Twents`,code:`twd`,locale:`twd`},uk:{name:`Ukrainian`,nativeName:`Українська`,code:`uk`,locale:`uk`},ur:{name:`Urdu`,nativeName:`اردو`,code:`ur`,locale:`ur`},uz:{name:`Uzbek`,nativeName:`O‘zbekcha`,code:`uz`,locale:`uz`},vi:{name:`Vietnamese`,nativeName:`Tiếng Việt`,code:`vi`,locale:`vi`},wa:{name:`Walloon`,nativeName:`Walon`,code:`wa`,locale:`wa`},cy:{name:`Welsh`,nativeName:`Cymraeg`,code:`cy`,locale:`cy`},yo:{name:`Yoruba`,nativeName:`Yorùbá`,code:`yo`,locale:`yo`,alternatives:[`yor`]}};function Bl(){let e=document.documentElement.getAttribute(`lang`)||`en`;return(zl[e.toLowerCase()]||zl[e.split(`-`)[0]]||zl.en)?.locale||`en_US`}function Vl(){return window.wcpos?.translationVersion||`0.1.0`}function Hl({namespace:t,project:n,resources:r}){let i=Q.createInstance(),a=Bl(),o=Vl(),s={lng:a,fallbackLng:`en`,ns:[t],defaultNS:t,keySeparator:!1,nsSeparator:!1,interpolation:{escapeValue:!1,prefix:`{`,suffix:`}`},backend:{backends:[Gc,zc],backendOptions:[{prefix:`wcpos_i18n_`,expirationTime:6048e5,defaultVersion:o},{loadPath:(e,t)=>`https://cdn.jsdelivr.net/gh/wcpos/translations@${o}/translations/js/${e[0]}/${n}/${t[0]}.json`}]}};return r&&(s.resources=r,s.partialBundledLanguages=!0),{i18n:i,i18nPromise:i.use(mc).use(Il).init(s).then(()=>i),t:i.t.bind(i),Trans:n=>(0,e.createElement)(Rl,{...n,i18n:i,ns:t})}}var{i18n:Ul,i18nPromise:Wl,t:$,Trans:Gl}=Hl({namespace:`wp-admin-settings`,project:`woocommerce-pos`,resources:{en:{"wp-admin-settings":{"cloudflare.title":`Your store is behind Cloudflare`,"cloudflare.body":`Cloudflare's security checks (Bot Fight Mode, Under Attack Mode and WAF challenges) can stop the WCPOS app from reaching your store's REST API. If the app reports "This store's hosting setup is blocking the app" (HOST121) or opens a security-check window, the fix is in your Cloudflare dashboard: a WAF Skip rule for /wp-json/, or turning off Bot Fight Mode, which no rule can bypass.`,"cloudflare.plugin_note":`The Cloudflare WordPress plugin does not manage these rules. They live in the Cloudflare dashboard.`,"cloudflare.docs_link":`How to add the rule`,"common.access":`Access`,"common.account":`Account`,"common.all":`All`,"common.cancel":`Cancel`,"common.checkout":`Checkout`,"common.cloud_print":`Cloud Print`,"common.created":`Created`,"common.default":`Default`,"common.description":`Description`,"common.dismiss":`Dismiss`,"common.documentation":`Documentation`,"common.enabled":`Enabled`,"common.expires":`Expires`,"common.extensions":`Extensions`,"common.faq":`Frequently Asked Questions`,"common.gateway":`Gateway`,"common.general":`General`,"common.guest":`Guest`,"common.license":`License`,"common.loading":`Loading…`,"common.logs":`Logs`,"common.next":`Next`,"common.no_results":`No results`,"common.previous":`Previous`,"extensions.refresh":`Refresh`,"extensions.refreshing":`Refreshing...`,"extensions.refresh_failed":`Could not refresh extensions. Please try again.`,"extensions.search_placeholder":`Search extensions...`,"logs.source":`Source`,"common.pos_settings":`POS settings`,"common.save":`Save`,"common.settings":`Settings`,"common.woocommerce_settings":`WooCommerce settings`,"common.something_went_wrong":`Something went wrong`,"common.title":`Title`,"common.tools":`Tools`,"common.upgrade_to_pro":`Upgrade to WCPOS Pro`,"common.remove":`Remove`,"common.back":`Back`,"common.continue":`Continue`,"common.done":`Done`,"settings.force_ssl":`Force SSL`,"settings.force_ssl_tip":`Force POS to send server requests over HTTPS (recommended)`,"settings.pos_only_products":`Enable POS only products`,"settings.pos_only_products_tip":`Adds online and POS visibility settings to product admin`,"settings.decimal_quantities":`Enable decimal quantities`,"settings.decimal_quantities_tip":`Allows items to have decimal values in the quantity field, eg: 0.25`,"settings.generate_username":`Automatically generate username from customer email`,"settings.default_customer":`Default POS customer`,"settings.default_customer_tip":`The default customer for POS orders, eg: Guest`,"settings.use_cashier_account":`Use cashier account`,"settings.barcode_field":`Barcode Field`,"settings.barcode_field_tip":`Product meta field to be used as barcode, eg: _global_unique_id (GTIN), _sku or _barcode`,"settings.barcode_field_create":`Create "{value}"`,"settings.barcode_field_no_results":`No barcode fields match`,"settings.store_details_section_title":`Store details`,"settings.store_details_section_description":`Information about your physical store, used on POS receipts and invoices. Leave a field blank to inherit the WooCommerce default shown as a placeholder.`,"settings.store_details_upgrade_callout_title":`Unlock per-store settings`,"settings.store_details_upgrade_to_pro":`Upgrade to Pro to set up one or more stores, each with their own receipt template, pricing, tax rates, and authorized users.`,"settings.store_name":`Store name`,"settings.store_phone":`Phone`,"settings.store_email":`Email`,"settings.refund_returns_policy":`Refund & Returns Policy`,"settings.refund_returns_policy_tip":`Brief statement that will appear on POS receipts.`,"settings.store_tax_ids_section_title":`Store tax IDs`,"settings.store_tax_ids_section_description":`Tax or business-register IDs to print on fiscal receipt and invoice templates.`,"settings.store_tax_ids":`Store tax IDs`,"settings.store_tax_ids_tip":`Add one or more tax or business-register IDs (VAT, EIN, ABN, etc.) to print on fiscal receipt and invoice templates.`,"settings.store_tax_ids_callout_title":`What are store tax IDs?`,"settings.store_tax_ids_learn_more":`Learn more`,"settings.store_tax_ids_add":`Add tax ID`,"settings.store_tax_ids_type":`Type`,"settings.store_tax_ids_value":`Value`,"settings.store_tax_ids_country":`Country`,"settings.store_tax_ids_country_placeholder":`Select country`,"settings.store_tax_ids_country_search":`Search countries`,"settings.store_tax_ids_country_none":`No country`,"settings.store_tax_ids_country_no_results":`No countries match`,"settings.store_tax_ids_label":`Custom label`,"settings.store_tax_ids_remove":`Remove`,"settings.store_tax_ids_empty":`No additional store tax IDs configured.`,"settings.products_section_title":`Products`,"settings.customers_section_title":`Customers`,"settings.privacy_section_title":`Privacy`,"settings.advanced_section_title":`Advanced`,"settings.restore_stock_on_delete":`Restore stock on order delete`,"settings.restore_stock_on_delete_tip":`Automatically restore product stock when POS orders are trashed or deleted`,"settings.storefront_receipt_enabled":`Let customers download receipts`,"settings.storefront_receipt_enabled_tip":`Adds a Receipt button to My Account > Orders on your online store so customers can download their order receipt as a PDF, rendered with your WCPOS receipt template.`,"settings.storefront_receipt_template":`Receipt template for customers`,"settings.storefront_receipt_template_tip":`Which receipt template customers get when downloading from My Account.`,"settings.storefront_receipt_template_active":`Use active receipt template`,"settings.storefront_receipt_template_unavailable":`Unavailable template ({value})`,"settings.need_help":`Need help?`,"settings.allow_anonymous_usage_data_v2":`Allow anonymous usage data and error reports`,"settings.allow_anonymous_usage_data_tip_v3":`Help us find bugs and make WCPOS better by sharing anonymous information about your setup, how you use the plugin, and what goes wrong — in the app or on your server.`,"settings.privacy_learn_more":`Learn what's collected`,"settings.privacy_modal_title":`Help us make WCPOS better`,"settings.privacy_modal_intro":`If you're happy to, WCPOS can send us some anonymous information about how the plugin is being used. It really helps us decide what to build next.`,"settings.privacy_modal_includes":`Here's what that includes:`,"settings.privacy_modal_setup_label":`Your setup`,"settings.privacy_modal_setup_desc":`things like your PHP and WooCommerce versions, your country, and your currency, so we know what environments to support.`,"settings.privacy_modal_store_label":`Your store size`,"settings.privacy_modal_store_desc":`roughly how many products, orders, and POS users you have, so we understand the kinds of stores using WCPOS.`,"settings.privacy_modal_usage_label":`How you use WCPOS`,"settings.privacy_modal_usage_desc":`which screens you open and which features you turn on, so we can focus on what people actually use.`,"settings.privacy_modal_exclusions":`We never look at customer details, order contents, prices, your site address, or anything that could identify you or your customers. You can change your mind any time.`,"settings.privacy_modal_close":`Got it`,"checkout.order_status":`Order Status`,"checkout.prevent_overselling":`Prevent overselling`,"checkout.prevent_overselling_tip":`Reject orders at checkout when quantities exceed available stock.`,"checkout.admin_emails":`Admin emails`,"checkout.admin_emails_tip":`WooCommerce admin notification emails for POS orders`,"checkout.customer_emails":`Customer emails`,"checkout.customer_emails_tip":`WooCommerce customer notification emails for POS orders`,"checkout.cashier_emails":`Cashier emails`,"checkout.cashier_emails_tip":`Send new order notification to the cashier who processed the POS order`,"checkout.email_new_order":`New order`,"checkout.email_cancelled_order":`Cancelled order`,"checkout.email_failed_order":`Failed order`,"checkout.email_on_hold_order":`Order on hold`,"checkout.email_processing_order":`Processing order`,"checkout.email_completed_order":`Completed order`,"checkout.email_refunded_order":`Refunded order`,"checkout.gateways":`Gateways`,"checkout.gateways_description":`Installed gateways are listed below. Drag and drop gateways to control their display order at the Point of Sale. Payment Gateways enabled here will be available at the Point of Sale.`,"checkout.gateway_id":`Gateway ID`,"checkout.enable_pro_gateways":`To enable all WooCommerce gateways please enable the Pro plugin.`,"checkout.gateway_settings_pos_only":`This will change the settings for the POS only. If you would like to change gateway settings for online and POS, please visit the <link>WooCommerce Settings</link>.`,"access.default_roles_warning":`By default, access to the POS is limited to Administrator, Shop Manager and Cashier roles. It is recommended that you <strong>do not change</strong> the default settings unless you are fully aware of the consequences.`,"access.visit_documentation":`For more information please visit the <link>documentation</link>.`,"access.tasks_title":`What this role can do`,"access.task_use_pos":`Use the POS`,"access.task_manage_settings":`Manage POS settings`,"access.task_edit_products":`Create & edit products`,"access.task_delete_products":`Delete products`,"access.task_edit_coupons":`Create & edit coupons`,"access.task_delete_coupons":`Delete coupons`,"access.task_manage_orders":`Manage orders`,"access.task_manage_customers":`Manage customers`,"access.task_manage_categories":`Manage categories & tags`,"access.task_partial":`partly granted`,"access.advanced_title":`Advanced`,"access.advanced_subtitle":`individual capabilities`,"access.advanced_intro":`Each task above is a set of these capabilities. Change them individually only if you know what you are doing.`,"sessions.sessions":`Sessions`,"sessions.manage_description":`Manage active user sessions. You can view all logged-in users, see their devices, and terminate sessions if needed.`,"sessions.all_users":`All Users`,"sessions.my_sessions":`My Sessions`,"sessions.loading":`Loading sessions...`,"sessions.active_sessions":`Active Sessions`,"sessions.active_users":`Active Users`,"sessions.no_active_sessions":`No active sessions found`,"sessions.current_session":`Current Session`,"sessions.terminate":`Terminate`,"sessions.logout_all":`Logout All`,"sessions.logout_other_devices":`Logout Other Devices`,"sessions.session_terminated":`Session terminated successfully`,"sessions.sessions_terminated":`Sessions terminated successfully`,"sessions.failed_terminate_session":`Failed to terminate session`,"sessions.failed_terminate_sessions":`Failed to terminate sessions`,"sessions.confirm_terminate_session":`Are you sure you want to terminate this session?`,"sessions.confirm_logout_other_devices":`Are you sure you want to logout from all other devices?`,"sessions.confirm_logout_all_devices":`Are you sure you want to logout from all devices?`,"sessions.session_count_one":`{count} session`,"sessions.session_count_other":`{count} sessions`,"sessions.just_now":`Just now`,"sessions.minutes_ago":`{minutes} minutes ago`,"sessions.hours_ago":`{hours} hours ago`,"sessions.days_ago":`{days} days ago`,"sessions.ip":`IP`,"sessions.user_agent":`User Agent`,"sessions.ios_application":`iOS Application`,"sessions.android_application":`Android Application`,"sessions.desktop_application":`Desktop Application`,"sessions.web_application":`Web Application`,"sessions.you":`You`,"sessions.active_now":`Active now`,"sessions.filter_users":`Filter users`,"sessions.no_users_match":`No users match your filter`,"sessions.no_other_users":`No other users with active sessions`,"sessions.select_user":`Select a user to view their active sessions`,"sessions.current_device":`Current device`,"sessions.created":`Created`,"sessions.last_active":`Last active`,"sessions.expires":`Expires`,"sessions.confirm_terminate_current":`This will sign you out of the current device. Continue?`,"sessions.cancel":`Cancel`,"sessions.confirm":`Confirm`,"sessions.terminate_session_title":`Terminate session?`,"sessions.terminate_all_title":`Terminate all sessions?`,"sessions.terminate_other_title":`Terminate other sessions?`,"license.support_development":`Unlock extra features and support ongoing development by upgrading to WCPOS Pro.`,"license.existing_license_prefix":`Already have a Pro license? Follow the`,"license.existing_license_link":`installation instructions`,"license.existing_license_suffix":`to download and install the Pro plugin. Once installed, you can safely remove the free version.`,"license.thank_you":`Thank You!`,"license.activated":`License <code>{number}</code> has been activated.`,"license.ongoing_support":`Your support helps fund the ongoing development of WCPOS.`,"license.deactivate":`Deactivate`,"license.license_key":`License Key`,"license.activate":`Activate`,"logs.copied":`Copied`,"logs.copy":`Copy`,"logs.copy_failed":`Copy failed`,"logs.entries_count_one":`{count} entry`,"logs.entries_count_other":`{count} entries`,"logs.errors":`Errors`,"logs.fatal_errors_detected":`Fatal errors detected`,"logs.no_entries":`No log entries found.`,"logs.today":`Today`,"logs.view_in_wc":`view in WooCommerce logs`,"logs.warnings":`Warnings`,"logs.yesterday":`Yesterday`,"tax_ids.section_title":`Tax IDs`,"tax_ids.section_intro":`WCPOS adds a tax-ID custom field to your customers and copies it onto orders at checkout. Different plugins use different names for that field — WCPOS detects what you have installed and writes to the right one automatically.`,"tax_ids.learn_more":`Learn more`,"tax_ids.banner_auto_detected":`Auto-detected`,"tax_ids.banner_no_plugin":`No plugin detected`,"tax_ids.banner_is_installed":`is installed.`,"tax_ids.banner_detected_explainer":`WCPOS will save VAT-shaped tax IDs to the field this plugin reads. No action needed from you.`,"tax_ids.banner_overrides_active_one":`You also have {count} custom override set below — that takes priority over the plugin's default.`,"tax_ids.banner_overrides_active_other":`You also have {count} custom overrides set below — they take priority over the plugin's default.`,"tax_ids.banner_no_plugin_title":`WCPOS will save tax IDs using its built-in defaults.`,"tax_ids.banner_no_plugin_explainer":`If you have a plugin that uses a different field name, you can set a custom override below.`,"tax_ids.advanced_title":`Advanced: use a different field name`,"tax_ids.advanced_subtitle":`(only if your plugin uses a custom key)`,"tax_ids.advanced_intro":`The "Source" column shows how the field name was chosen for each tax-ID type. Type a key in the "Override" column to use a custom field instead.`,"tax_ids.advanced_override_count_one":`{count} override active`,"tax_ids.advanced_override_count_other":`{count} overrides active`,"tax_ids.col_type":`Type`,"tax_ids.col_field":`Field name in use`,"tax_ids.col_source":`Source`,"tax_ids.col_override":`Override`,"tax_ids.write_map_use_default":`(leave blank to use default)`,"tax_ids.source_plugin":`Plugin`,"tax_ids.source_built_in":`Built-in`,"tax_ids.source_custom":`Custom`,"tax_ids.legend_plugin":`from a detected plugin`,"tax_ids.legend_built_in":`WCPOS default`,"tax_ids.legend_custom":`your override`,"cloud_print.save_failed":`Save failed.`,"cloud_print.saving":`Saving…`,"cloud_print.saved":`Saved`,"cloud_print.intro_title":`What is cloud printing?`,"cloud_print.intro_p1":`Cloud printing lets your store send a receipt to a printer over the internet — the printer fetches each job itself, so it doesn't need to be connected to the POS device.`,"cloud_print.intro_p2":`Use it when a receipt printer is on a different network from the till, or when you want orders to print automatically. For example:`,"cloud_print.intro_li1":`send every order straight to the kitchen printer, or`,"cloud_print.intro_li2":`print a packing slip for every online sale.`,"cloud_print.intro_p3":`Cashiers can also print to a cloud printer manually from the POS.`,"cloud_print.printers":`Your cloud printers`,"cloud_print.printers_description":`Printers that fetch jobs from this store.`,"cloud_print.no_printers":`No cloud printers yet.`,"cloud_print.add_a_printer":`+ Add a printer`,"cloud_print.auto_print":`Auto-print rules`,"cloud_print.status_connected":`Connected`,"cloud_print.status_waiting":`Waiting for printer`,"cloud_print.status_offline":`Offline`,"cloud_print.status_linked":`Linked`,"cloud_print.status_online":`Online`,"cloud_print.status_unknown":`Unknown`,"cloud_print.format":`Print format`,"cloud_print.format_pdf":`PDF (recommended)`,"cloud_print.format_raw":`ESC/POS RAW — thermal templates only`,"cloud_print.token_missing":`This printer was created, but no setup token was returned. Remove and re-add it to get one.`,"cloud_print.test_sent":`Sent a test print to {name}.`,"cloud_print.test_unavailable":`Test print isn't available for this printer yet.`,"cloud_print.test_failed":`Test print failed.`,"cloud_print.never":`never`,"cloud_print.printer_name":`Printer name`,"cloud_print.printer_menu":`Printer actions`,"cloud_print.menu_setup":`Setup & token`,"cloud_print.menu_remove":`Remove printer`,"cloud_print.last_check_in":`Last check-in`,"cloud_print.printer_id":`Printer ID`,"cloud_print.printer_id_tooltip":`The printer's address in its setup URL. Created automatically and can't be changed — to rename, edit the name above; to change the ID, remove and re-add the printer.`,"cloud_print.test_print":`Test print`,"cloud_print.remove_title":`Remove printer?`,"cloud_print.remove_body":`This printer will stop receiving jobs. You can add it again later.`,"cloud_print.choice_star_desc":`Star printer with CloudPRNT built in (mC-Print, TSP143IV…)`,"cloud_print.choice_epson_desc":`Epson TM printer with Server Direct Print support`,"cloud_print.choice_printnode_desc":`Use a regular USB / network thermal printer through a PrintNode account`,"cloud_print.copy":`Copy`,"cloud_print.copied":`Copied to clipboard`,"cloud_print.create_failed":`Couldn't create the printer. Please try again.`,"cloud_print.connect_title":`Connect your printer`,"cloud_print.add_title":`Add a cloud printer`,"cloud_print.step_provider_q":`What kind of printer are you connecting?`,"cloud_print.printer_name_ph":`e.g. Kitchen printer`,"cloud_print.printer_name_help":`A friendly name so you can recognise it later. The technical ID is created for you.`,"cloud_print.printnode_api_key":`PrintNode API key`,"cloud_print.printnode_api_key_ph":`Paste your PrintNode account API key`,"cloud_print.printnode_printer_id":`PrintNode printer ID`,"cloud_print.printnode_note":`Install the small PrintNode client on a computer next to the printer, then paste your account's API key. We'll list that account's printers next.`,"cloud_print.printnode_fetch":`Fetch my printers`,"cloud_print.printnode_pick_printer":`Choose a printer`,"cloud_print.printnode_pick_placeholder":`Select a printer…`,"cloud_print.printnode_no_printers":`No printers found on this PrintNode account.`,"cloud_print.printnode_fetch_failed":`Couldn't list your PrintNode printers. Check the API key and that the desktop client is running.`,"cloud_print.created":`Printer created`,"cloud_print.poll_url_lost":`The full address (with its secret token) was shown only once when this printer was created and can't be displayed again. To get a new one, remove and re-add the printer.`,"cloud_print.poll_url_once_intro":`Copy this address into your printer's setup screen. It contains a secret token and is shown in full only once.`,"cloud_print.poll_url":`Poll URL`,"cloud_print.poll_url_help":`paste into the printer's "server URL"`,"cloud_print.linked":`Linked to PrintNode`,"cloud_print.printnode_delivery":`No URLs or tokens to copy — PrintNode handles delivery.`,"cloud_print.star_online_delivery":`No URLs or tokens to copy — Star Online handles delivery.`,"cloud_print.scope_every":`every order`,"cloud_print.scope_pos":`every in-store (POS) order`,"cloud_print.scope_online":`every online order`,"cloud_print.scope_store":`orders for {name}`,"cloud_print.scope_store_unknown":`Unknown store (#{id})`,"cloud_print.rules_tip":`This is optional — leave it empty to print receipts only manually from the POS.`,"cloud_print.rules_subline_pre":`Each rule prints the chosen template automatically when an order matches. Templates come from `,"cloud_print.templates_link":`POS › Templates`,"cloud_print.rules_subline_post":`. More than one rule can run for the same order.`,"cloud_print.no_rules":`No rules yet.`,"cloud_print.rule_print":`Automatically print`,"cloud_print.rule_scope_label":`Which orders to print`,"cloud_print.rule_to":`to`,"cloud_print.rule_printer_label":`Printer`,"cloud_print.rule_using":`using the`,"cloud_print.rule_template_label":`Receipt template`,"cloud_print.rule_template_suffix":`template,`,"cloud_print.rule_copies_one":`{count} copy`,"cloud_print.rule_copies_other":`{count} copies`,"cloud_print.rule_copies_label":`Number of copies`,"cloud_print.rule_trigger_join":`,`,"cloud_print.rule_trigger_label":`When to print`,"cloud_print.trigger_paid":`once it's paid`,"cloud_print.trigger_created":`as soon as it's created`,"cloud_print.rule_copies_suffix":`.`,"cloud_print.add_rule":`+ Add rule`}}}});function Kl(e){return(0,_.jsx)(bo,{dismissLabel:$(`common.dismiss`),...e})}function ql({error:e,resetErrorBoundary:t}){let n=(0,r.get)(e,`message`,`Unknown error`);return(0,_.jsx)(`div`,{className:`wcpos:p-4`,children:(0,_.jsx)(Kl,{status:`error`,onRemove:t,children:(0,_.jsxs)(`p`,{children:[$(`common.something_went_wrong`),`: `,(0,_.jsx)(`code`,{children:n})]})})})}var Jl=e.createContext({notice:null,setNotice:()=>{}});function Yl({children:t}){let[n,r]=e.useState(null);return(0,_.jsx)(Jl.Provider,{value:{notice:n,setNotice:r},children:t})}var Xl=()=>e.useContext(Jl);function Zl(){return window?.wcpos?.posthog}function Ql(e,t={}){Zl()?.capture?.(e,t)}function $l(e){let t=Zl();if(t){if(e===`allowed`){t.opt_in_capturing?.();return}t.opt_out_capturing?.(),t.reset?.()}}function eu(e){Ql(`upgrade_cta_viewed`,{placement:e})}function tu(e,t){Ql(`pro_link_clicked`,{placement:e,destination:t})}function nu(e){e&&Ql(`settings_section_viewed`,{section:e})}function ru(){Ql(`license_activate_attempted`)}function iu(e){Ql(`license_activate_succeeded`,e?{license_tier:e}:{})}function au(e){if(e instanceof TypeError)return`network`;let t=typeof e==`string`?e:e instanceof Error?e.message:typeof e==`object`&&e?e.error??e.message??``:``,n=(typeof t==`string`?t:``).toLowerCase();return n.includes(`network`)||n.includes(`fetch`)||n.includes(`failed to fetch`)?`network`:n.includes(`expired`)?`expired`:n.includes(`invalid`)?`invalid_key`:`server_error`}function ou(e){Ql(`license_activate_failed`,{reason:au(e)})}var su=new Ve({defaultOptions:{queries:{staleTime:6e5}}});typeof window<`u`&&(window.wcpos=window.wcpos||{},window.wcpos.queryClient=su);var cu=e=>(0,_.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 448 512`,...e,children:(0,_.jsx)(`path`,{d:`M96 0C43 0 0 43 0 96V416c0 53 43 96 96 96H384h32c17.7 0 32-14.3 32-32s-14.3-32-32-32V384c17.7 0 32-14.3 32-32V32c0-17.7-14.3-32-32-32H384 96zm0 384H352v64H96c-17.7 0-32-14.3-32-32s14.3-32 32-32zm32-240c0-8.8 7.2-16 16-16H336c8.8 0 16 7.2 16 16s-7.2 16-16 16H144c-8.8 0-16-7.2-16-16zm16 48H336c8.8 0 16 7.2 16 16s-7.2 16-16 16H144c-8.8 0-16-7.2-16-16s7.2-16 16-16z`})}),lu=e=>(0,_.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 512 512`,...e,children:(0,_.jsx)(`path`,{d:`M256 31.1c-141.4 0-255.1 93.13-255.1 208c0 49.63 21.35 94.98 56.97 130.7c-12.5 50.38-54.27 95.27-54.77 95.77c-2.25 2.25-2.875 5.734-1.5 8.734c1.249 3 4.021 4.766 7.271 4.766c66.25 0 115.1-31.76 140.6-51.39c32.63 12.25 69.02 19.39 107.4 19.39c141.4 0 255.1-93.13 255.1-208S397.4 31.1 256 31.1zM249.1 352C235.4 352 224 340.6 224 326S235.4 300 249.1 300c14.63 0 26 11.38 26 26S264.6 352 249.1 352zM307.7 235.4l-38.33 23.13v1.652c0 10.74-9.168 19.83-20 19.83c-10.83 0-20-9.088-20-19.83V246.1c0-6.609 3.332-13.22 10-17.35l47.5-28.09C292.7 198.2 296 192.4 296 185.8c0-9.914-8.334-18.17-18.33-18.17H234.3c-10 0-18.33 8.26-18.33 18.17c0 10.74-9.166 19.83-20 19.83S176 196.6 176 185.8C176 153.6 201.8 128 234.3 128h43.33C310.2 128 336 153.6 336 185.8C336 205.7 325.2 224.7 307.7 235.4z`})}),uu=e=>(0,_.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 512 512`,...e,children:(0,_.jsx)(`path`,{d:`M48 64C21.5 64 0 85.5 0 112c0 15.1 7.1 29.3 19.2 38.4L236.8 313.6c11.4 8.5 27 8.5 38.4 0L492.8 150.4c12.1-9.1 19.2-23.3 19.2-38.4c0-26.5-21.5-48-48-48H48zM0 176V384c0 35.3 28.7 64 64 64H448c35.3 0 64-28.7 64-64V176L294.4 339.2c-22.8 17.1-54 17.1-76.8 0L0 176z`})});function du(){return(0,_.jsxs)(`footer`,{className:`wcpos:border-t wcpos:border-gray-200 wcpos:shrink-0 wcpos:px-6 wcpos:py-2 wcpos:flex wcpos:flex-col wcpos:sm:flex-row wcpos:flex-wrap wcpos:items-start wcpos:gap-x-4 wcpos:gap-y-2 wcpos:text-xs`,children:[(0,_.jsx)(`span`,{className:`wcpos:font-semibold wcpos:text-gray-500`,children:$(`settings.need_help`)}),(0,_.jsxs)(`div`,{className:`wcpos:flex wcpos:flex-col wcpos:md:flex-row wcpos:gap-1 wcpos:lg:gap-4`,children:[(0,_.jsxs)(`a`,{href:`https://docs.wcpos.com`,target:`_blank`,rel:`noreferrer`,className:`wcpos:flex wcpos:items-center wcpos:gap-1 wcpos:text-gray-500 hover:wcpos:text-gray-900 wcpos:no-underline`,children:[(0,_.jsx)(`span`,{className:`wcpos:h-3.5 wcpos:w-3.5`,children:(0,_.jsx)(cu,{fill:`#6b7280`})}),$(`common.documentation`),(0,_.jsx)(`span`,{className:`wcpos:sr-only`,children:` (opens in new tab)`})]}),(0,_.jsxs)(`a`,{href:`https://faq.wcpos.com`,target:`_blank`,rel:`noreferrer`,className:`wcpos:flex wcpos:items-center wcpos:gap-1 wcpos:text-gray-500 hover:wcpos:text-gray-900 wcpos:no-underline`,children:[(0,_.jsx)(`span`,{className:`wcpos:h-3.5 wcpos:w-3.5`,children:(0,_.jsx)(lu,{fill:`#6b7280`})}),$(`common.faq`),(0,_.jsx)(`span`,{className:`wcpos:sr-only`,children:` (opens in new tab)`})]})]}),(0,_.jsxs)(`div`,{className:`wcpos:flex wcpos:flex-col wcpos:md:flex-row wcpos:gap-1 wcpos:lg:gap-4`,children:[(0,_.jsxs)(`a`,{href:`mailto:support@wcpos.com`,target:`_blank`,rel:`noreferrer`,className:`wcpos:flex wcpos:items-center wcpos:gap-1 wcpos:text-gray-500 hover:wcpos:text-gray-900 wcpos:no-underline`,children:[(0,_.jsx)(`span`,{className:`wcpos:h-3.5 wcpos:w-3.5`,children:(0,_.jsx)(uu,{fill:`#6b7280`})}),`support@wcpos.com`]}),(0,_.jsx)(`a`,{href:`https://wcpos.com/discord`,target:`_blank`,rel:`noreferrer`,className:`wcpos:no-underline`,children:(0,_.jsx)(`img`,{src:`https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fdiscord.com%2Fapi%2Finvites%2FGCEeEVpEvX%3Fwith_counts%3Dtrue&query=%24.approximate_presence_count&logo=discord&logoColor=white&label=users%20online&color=7c3aed&style=flat-square`,alt:`Discord`,className:`wcpos:h-4`,loading:`lazy`,width:`100`,height:`16`})})]})]})}function fu({heading:e,children:t}){return(0,_.jsxs)(`div`,{className:`wcpos:mb-4`,children:[(0,_.jsx)(`h3`,{className:`wcpos:px-4 wcpos:mb-1 wcpos:text-xs wcpos:font-semibold wcpos:uppercase wcpos:tracking-wider wcpos:text-gray-400`,children:e}),(0,_.jsx)(`nav`,{children:t})]})}function pu({to:e,label:t,badge:n,onClick:r}){let i=Ia()({to:e});return(0,_.jsxs)(ha,{to:e,onClick:r,"data-testid":`settings-nav-${e.replace(/^\//,``)}`,className:(0,H.default)(`wcpos:flex wcpos:items-center wcpos:justify-between wcpos:px-4 wcpos:py-2 wcpos:text-sm wcpos:no-underline wcpos:border-l-3 wcpos:transition-colors wcpos:hover:bg-gray-100 wcpos:focus-visible:outline-none wcpos:focus-visible:bg-gray-100`,i?`wcpos:border-wp-admin-theme-color wcpos:bg-wp-admin-theme-color-lightest wcpos:text-gray-900 wcpos:font-semibold`:`wcpos:border-transparent wcpos:text-gray-600 wcpos:hover:text-gray-900 wcpos:hover:bg-gray-50`),children:[t,(()=>{if(n==null)return null;if(typeof n==`number`)return n<=0?null:(0,_.jsx)(J,{variant:`brand`,shape:`round`,size:`xs`,children:n});let{error:e=0,warning:t=0}=n;return e<=0&&t<=0?null:(0,_.jsxs)(`span`,{className:`wcpos:inline-flex wcpos:items-center wcpos:gap-1`,children:[e>0&&(0,_.jsx)(J,{variant:`critical`,shape:`round`,size:`xs`,children:e}),t>0&&(0,_.jsx)(J,{variant:`warning`,shape:`round`,size:`xs`,children:t})]})})()]})}var mu=e=>(0,_.jsxs)(`svg`,{fill:`#000`,xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 1260 1260`,...e,children:[(0,_.jsx)(`path`,{fill:`#323A46`,d:`M0,90 q0,-90 90,-90 l1080,0 q90,0 90,90 l0,810 q0,90 -90,90 l-810,0 L0,1260 Z`}),(0,_.jsxs)(`g`,{children:[(0,_.jsxs)(`g`,{fill:`#CD2C24`,children:[(0,_.jsx)(`path`,{d:`M0,90 q0,-90 90,-90 l90,0 l0,270 a90,90 0 1,1 -180,0 Z`}),(0,_.jsx)(`path`,{d:`M360,0 l180,0 l0,270 a90,90 0 1,1 -180,0 Z`}),(0,_.jsx)(`path`,{d:`M720,0 l180,0 l0,270 a90,90 0 1,1 -180,0 Z`}),(0,_.jsx)(`path`,{d:`M1080,0 l90,0 q90,0 90,90 l0,180 a90,90 0 1,1 -180,0 Z`})]}),(0,_.jsxs)(`g`,{fill:`#F5E5C0`,children:[(0,_.jsx)(`path`,{d:`M180,0 l180,0 l0,270 a90,90 0 1,1 -180,0 Z`}),(0,_.jsx)(`path`,{d:`M540,0 l180,0 l0,270 a90,90 0 1,1 -180,0 Z`}),(0,_.jsx)(`path`,{d:`M900,0 l180,0 l0,270 a90,90 0 1,1 -180,0 Z`})]})]}),(0,_.jsxs)(`svg`,{viewBox:`0 0 1200 400`,width:`1060px`,x:`100px`,y:`50px`,stroke:`#FFF`,strokeWidth:60,strokeLinecap:`round`,fill:`#FFF`,fillOpacity:0,...e,children:[(0,_.jsx)(`path`,{d:` M30,480 l0,-450 m0,150 a150,150 0 1,0 300,0 a150,150 0 1,0 -300,0 `}),(0,_.jsx)(`path`,{d:` M600,30 m-150,150 a150,150 0 1,0 300,0 a150,150 0 1,0 -300,0 `}),(0,_.jsx)(`path`,{d:` M1170,70 c-25,-15 -75,-40 -150,-40 q-150,0 -150,75 t150,75 t150,75 t-150,75 c-75,0 -125,-25 -150,-40 `})]})]}),hu=window?.wcpos?.settings?.updateExtensionsCount??null,gu=new Set;function _u(){for(let e of gu)e()}function vu(e){return gu.add(e),()=>gu.delete(e)}function yu(){return hu}function bu(){return(0,e.useSyncExternalStore)(vu,yu)}function xu(e){hu=e,_u()}var Su=window?.wcpos?.settings?.unreadLogCounts??{error:0,warning:0},Cu=new Set;function wu(){for(let e of Cu)e()}function Tu(e){return Cu.add(e),()=>Cu.delete(e)}function Eu(){return Su}function Du(){return(0,e.useSyncExternalStore)(Tu,Eu)}async function Ou(){let e={...Su};Su={error:0,warning:0},wu();try{await(0,i.default)({path:`wcpos/v1/logs/mark-read?wcpos=1`,method:`POST`})}catch{Su=e,wu()}}var ku=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e))},o=t=e(r,i,a);return a},Au=(e=>e?ku(e):ku),ju=e=>e;function Mu(e,t=ju){let n=h.default.useSyncExternalStore(e.subscribe,h.default.useCallback(()=>t(e.getState()),[e,t]),h.default.useCallback(()=>t(e.getInitialState()),[e,t]));return h.default.useDebugValue(n),n}var Nu=Au((e,t)=>({pages:[],fields:[],modifications:[],components:{},registerPage:t=>{e(e=>e.pages.some(e=>e.id===t.id)?(console.warn(`[wcpos] Page "${t.id}" is already registered.`),e):{pages:[...e.pages,{priority:10,...t}]})},registerField:t=>{e(e=>{let n=`${t.page}:${t.section||``}:${t.id}`;return e.fields.some(e=>`${e.page}:${e.section||``}:${e.id}`===n)?(console.warn(`[wcpos] Field "${n}" is already registered.`),e):{fields:[...e.fields,{priority:10,...t}]}})},modifyField:t=>{e(e=>({modifications:[...e.modifications,t]}))},getPages:e=>{let{pages:n}=t();return(e?n.filter(t=>t.group===e):n).sort((e,t)=>(e.priority??10)-(t.priority??10))},getFields:(e,n)=>{let{fields:r}=t();return r.filter(t=>t.page===e&&(n===void 0||t.section===n)).sort((e,t)=>(e.priority??10)-(t.priority??10))},getModifications:(e,n)=>{let{modifications:r}=t();return r.filter(t=>t.page===e&&t.id===n).reduce((e,t)=>({...e,...t.props}),{})},registerComponent:(t,n)=>{e(e=>({components:{...e.components,[t]:n}}))},getComponent:e=>t().components[e]}));typeof window<`u`&&(window.wcpos=window.wcpos||{},window.wcpos.settings={...window.wcpos.settings,registerPage:Nu.getState().registerPage,registerField:Nu.getState().registerField,modifyField:Nu.getState().modifyField,registerComponent:Nu.getState().registerComponent,getComponent:Nu.getState().getComponent});function Pu(t){let n=Mu(Nu,e=>e.pages);return(0,e.useMemo)(()=>(t?n.filter(e=>e.group===t):[...n]).sort((e,t)=>(e.priority??10)-(t.priority??10)),[n,t])}function Fu({isOpen:e,onNavItemClick:t}){let n=Pu(`tools`),r=Pu(`account`),i=bu(),a=Du();return(0,_.jsxs)(`aside`,{className:[`wcpos:w-56 wcpos:shrink-0 wcpos:border-r wcpos:border-gray-200 wcpos:bg-gray-50 wcpos:flex wcpos:flex-col wcpos:transition-[margin] wcpos:duration-300 wcpos:ease-in-out`,`wcpos:lg:ml-0`,e?`wcpos:ml-0`:`wcpos:-ml-56`].join(` `),children:[(0,_.jsxs)(`div`,{className:`wcpos:flex wcpos:items-center wcpos:gap-3 wcpos:px-4 wcpos:border-b wcpos:border-gray-200 wcpos:h-12`,children:[(0,_.jsx)(`div`,{className:`wcpos:w-8`,children:(0,_.jsx)(mu,{})}),(0,_.jsx)(`span`,{className:`wcpos:text-lg wcpos:font-semibold wcpos:text-gray-900`,children:`WCPOS`})]}),(0,_.jsxs)(`div`,{className:`wcpos:flex-1 wcpos:overflow-y-auto wcpos:py-2`,children:[(0,_.jsxs)(fu,{heading:$(`common.settings`),children:[(0,_.jsx)(pu,{to:`/general`,label:$(`common.general`),onClick:t}),(0,_.jsx)(pu,{to:`/checkout`,label:$(`common.checkout`),onClick:t}),(0,_.jsx)(pu,{to:`/cloud-print`,label:$(`common.cloud_print`,`Cloud Print`),onClick:t}),(0,_.jsx)(pu,{to:`/access`,label:$(`common.access`),onClick:t}),(0,_.jsx)(pu,{to:`/sessions`,label:$(`sessions.sessions`),onClick:t}),(0,_.jsx)(pu,{to:`/extensions`,label:$(`common.extensions`,`Extensions`),badge:i??void 0,onClick:t})]}),(0,_.jsxs)(fu,{heading:$(`common.tools`,`Tools`),children:[(0,_.jsx)(pu,{to:`/logs`,label:$(`common.logs`,`Logs`),badge:a,onClick:t}),n.map(e=>(0,_.jsx)(pu,{to:`/${e.id}`,label:e.label,onClick:t},e.id))]}),(0,_.jsxs)(fu,{heading:$(`common.account`,`Account`),children:[(0,_.jsx)(pu,{to:`/license`,label:$(`common.license`),onClick:t}),r.map(e=>(0,_.jsx)(pu,{to:`/${e.id}`,label:e.label,onClick:t},e.id))]})]})]})}function Iu({rows:e=5}){return(0,_.jsx)(`div`,{className:`wcpos:pb-4 wcpos:mb-4`,role:`status`,"aria-label":$(`common.loading`),children:(0,_.jsx)(`div`,{className:`wcpos:space-y-0`,children:Array.from({length:e}).map((e,t)=>(0,_.jsxs)(`div`,{className:`wcpos:flex wcpos:flex-col wcpos:sm:flex-row wcpos:sm:items-center wcpos:gap-1 wcpos:sm:gap-3 wcpos:py-2.5`,children:[t%2==0&&(0,_.jsx)(`div`,{className:`wcpos:sm:w-[30%] wcpos:sm:max-w-[200px] wcpos:shrink-0`,children:(0,_.jsx)(K,{className:`wcpos:h-4`,width:`${60+t*17%40}%`})}),(0,_.jsx)(`div`,{className:`wcpos:flex-1 wcpos:min-w-0`,children:(0,_.jsx)(K,{className:`wcpos:h-5`,width:t%2==0?`200px`:`${40+t*23%30}%`})})]},t))})})}function Lu({cards:e=4}){return(0,_.jsxs)(`div`,{role:`status`,"aria-label":$(`common.loading`),children:[(0,_.jsx)(`div`,{className:`wcpos:mb-4`,children:(0,_.jsx)(K,{className:`wcpos:h-9 wcpos:w-full wcpos:rounded-md`})}),(0,_.jsx)(`div`,{className:`wcpos:flex wcpos:gap-2 wcpos:mb-6`,children:Array.from({length:3}).map((e,t)=>(0,_.jsx)(K,{className:`wcpos:h-7 wcpos:rounded-full`,width:`${60+t*20}px`},t))}),(0,_.jsx)(`div`,{className:`wcpos:grid wcpos:grid-cols-1 wcpos:sm:grid-cols-2 wcpos:gap-4`,children:Array.from({length:e}).map((e,t)=>(0,_.jsxs)(`div`,{className:`wcpos:border wcpos:border-gray-200 wcpos:rounded-lg wcpos:p-4 wcpos:space-y-3`,children:[(0,_.jsxs)(`div`,{className:`wcpos:flex wcpos:items-center wcpos:gap-3`,children:[(0,_.jsx)(K,{className:`wcpos:h-10 wcpos:w-10 wcpos:rounded-lg wcpos:shrink-0`}),(0,_.jsxs)(`div`,{className:`wcpos:flex-1 wcpos:space-y-2`,children:[(0,_.jsx)(K,{className:`wcpos:h-4`,width:`60%`}),(0,_.jsx)(K,{className:`wcpos:h-3`,width:`40%`})]})]}),(0,_.jsx)(K,{className:`wcpos:h-3`,width:`90%`}),(0,_.jsx)(K,{className:`wcpos:h-3`,width:`70%`})]},t))})]})}function Ru({rows:e=8}){return(0,_.jsxs)(`div`,{role:`status`,"aria-label":$(`common.loading`),children:[(0,_.jsx)(`div`,{className:`wcpos:flex wcpos:gap-2 wcpos:mb-4`,children:Array.from({length:3}).map((e,t)=>(0,_.jsx)(K,{className:`wcpos:h-7 wcpos:rounded-full`,width:`${50+t*15}px`},t))}),(0,_.jsx)(`div`,{className:`wcpos:space-y-1`,children:Array.from({length:e}).map((e,t)=>(0,_.jsxs)(`div`,{className:`wcpos:flex wcpos:items-center wcpos:gap-3 wcpos:border wcpos:border-gray-200 wcpos:rounded-md wcpos:px-3 wcpos:py-2`,children:[(0,_.jsx)(K,{className:`wcpos:h-5 wcpos:rounded wcpos:shrink-0`,width:`55px`}),(0,_.jsx)(K,{className:`wcpos:h-3 wcpos:shrink-0`,width:`130px`}),(0,_.jsx)(K,{className:`wcpos:h-3 wcpos:flex-1`,width:`${50+t*19%40}%`})]},t))})]})}function zu(){return(0,_.jsxs)(`div`,{role:`status`,"aria-label":$(`common.loading`),children:[(0,_.jsx)(`div`,{className:`wcpos:p-4`,children:(0,_.jsx)(K,{className:`wcpos:h-10 wcpos:w-full wcpos:rounded-md`})}),(0,_.jsxs)(`div`,{className:`wcpos:sm:grid wcpos:sm:grid-cols-3 wcpos:sm:gap-4 wcpos:p-4 wcpos:pt-0`,children:[(0,_.jsx)(`div`,{children:(0,_.jsx)(`div`,{className:`wcpos:space-y-1`,children:Array.from({length:5}).map((e,t)=>(0,_.jsx)(K,{className:`wcpos:h-9 wcpos:rounded`},t))})}),(0,_.jsxs)(`div`,{children:[(0,_.jsx)(K,{className:`wcpos:h-5 wcpos:mb-3`,width:`80px`}),(0,_.jsx)(`div`,{className:`wcpos:space-y-2`,children:Array.from({length:6}).map((e,t)=>(0,_.jsxs)(`div`,{className:`wcpos:flex wcpos:items-center wcpos:gap-2`,children:[(0,_.jsx)(K,{className:`wcpos:h-4 wcpos:w-4 wcpos:rounded wcpos:shrink-0`}),(0,_.jsx)(K,{className:`wcpos:h-3`,width:`${60+t*17%30}%`})]},t))})]})]})]})}function Bu(){return(0,_.jsxs)(`div`,{className:`wcpos:p-4`,role:`status`,"aria-label":$(`common.loading`),children:[(0,_.jsx)(K,{className:`wcpos:h-10 wcpos:w-full wcpos:rounded-md wcpos:mb-3`}),(0,_.jsxs)(`div`,{className:`wcpos:grid wcpos:grid-cols-[minmax(0,18rem)_1fr] wcpos:gap-4`,children:[(0,_.jsxs)(`div`,{className:`wcpos:space-y-2 wcpos:border-r wcpos:border-gray-200 wcpos:pr-4`,children:[(0,_.jsx)(K,{className:`wcpos:h-8 wcpos:w-full wcpos:rounded-md`}),Array.from({length:4}).map((e,t)=>(0,_.jsxs)(`div`,{className:`wcpos:flex wcpos:items-center wcpos:gap-3 wcpos:px-3 wcpos:py-2`,children:[(0,_.jsx)(K,{className:`wcpos:h-10 wcpos:w-10 wcpos:shrink-0 wcpos:rounded-full`}),(0,_.jsxs)(`div`,{className:`wcpos:flex-1 wcpos:space-y-1`,children:[(0,_.jsx)(K,{className:`wcpos:h-4`,width:`60%`}),(0,_.jsx)(K,{className:`wcpos:h-3`,width:`40%`})]}),(0,_.jsx)(K,{className:`wcpos:h-5 wcpos:w-6 wcpos:rounded-full`})]},t))]}),(0,_.jsxs)(`div`,{className:`wcpos:space-y-3`,children:[(0,_.jsxs)(`div`,{className:`wcpos:flex wcpos:items-center wcpos:gap-3 wcpos:border-b wcpos:border-gray-200 wcpos:pb-3`,children:[(0,_.jsx)(K,{className:`wcpos:h-12 wcpos:w-12 wcpos:shrink-0 wcpos:rounded-full`}),(0,_.jsxs)(`div`,{className:`wcpos:flex-1 wcpos:space-y-1`,children:[(0,_.jsx)(K,{className:`wcpos:h-5`,width:`40%`}),(0,_.jsx)(K,{className:`wcpos:h-3`,width:`30%`})]}),(0,_.jsx)(K,{className:`wcpos:h-8 wcpos:rounded`,width:`120px`})]}),Array.from({length:3}).map((e,t)=>(0,_.jsxs)(`div`,{className:`wcpos:flex wcpos:items-start wcpos:gap-3 wcpos:rounded-md wcpos:border wcpos:border-gray-200 wcpos:p-3`,children:[(0,_.jsx)(K,{className:`wcpos:h-10 wcpos:w-10 wcpos:shrink-0 wcpos:rounded-md`}),(0,_.jsxs)(`div`,{className:`wcpos:flex-1 wcpos:space-y-1`,children:[(0,_.jsx)(K,{className:`wcpos:h-4`,width:`50%`}),(0,_.jsx)(K,{className:`wcpos:h-3`,width:`70%`}),(0,_.jsx)(K,{className:`wcpos:h-8 wcpos:rounded wcpos:mt-2`,width:`100%`})]}),(0,_.jsx)(K,{className:`wcpos:h-7 wcpos:rounded`,width:`80px`})]},t))]})]})]})}function Vu(){return(0,_.jsxs)(`div`,{className:`wcpos:px-4 wcpos:py-5 wcpos:sm:grid wcpos:sm:grid-cols-3 wcpos:sm:gap-4`,role:`status`,"aria-label":$(`common.loading`),children:[(0,_.jsx)(`div`,{className:`wcpos:flex wcpos:sm:justify-end`,children:(0,_.jsx)(K,{className:`wcpos:h-4`,width:`90px`})}),(0,_.jsx)(`div`,{children:(0,_.jsx)(K,{className:`wcpos:h-9 wcpos:w-full wcpos:rounded-md`})}),(0,_.jsx)(`div`,{children:(0,_.jsx)(K,{className:`wcpos:h-9 wcpos:rounded`,width:`90px`})})]})}var Hu={"/general":`common.general`,"/checkout":`common.checkout`,"/cloud-print":`common.cloud_print`,"/access":`common.access`,"/sessions":`sessions.sessions`,"/extensions":`common.extensions`,"/logs":`common.logs`,"/license":`common.license`},Uu={"/general":(0,_.jsx)(Iu,{rows:5}),"/checkout":(0,_.jsx)(Iu,{rows:4}),"/cloud-print":(0,_.jsx)(Iu,{rows:4}),"/access":(0,_.jsx)(zu,{}),"/sessions":(0,_.jsx)(Bu,{}),"/extensions":(0,_.jsx)(Lu,{cards:4}),"/logs":(0,_.jsx)(Ru,{rows:8}),"/license":(0,_.jsx)(Vu,{})};function Wu(){let{notice:t,setNotice:n}=Xl(),[r,i]=e.useState(!1),a=Ha(),o=$(Hu[a.pathname]||`common.settings`);return(0,_.jsxs)(`div`,{className:`wcpos:flex-1 wcpos:flex wcpos:bg-white`,children:[(0,_.jsx)(Fu,{isOpen:r,onNavItemClick:()=>i(!1)}),(0,_.jsxs)(`div`,{className:`wcpos:flex-1 wcpos:flex wcpos:flex-col wcpos:min-w-0`,children:[(0,_.jsxs)(`div`,{className:`wcpos:flex wcpos:items-center wcpos:px-6 wcpos:border-b wcpos:border-gray-200 wcpos:shrink-0 wcpos:h-12`,children:[(0,_.jsx)(`button`,{type:`button`,"aria-label":`Open main menu`,"aria-expanded":r,onClick:()=>i(e=>!e),className:`wcpos:lg:hidden wcpos:p-2 wcpos:mr-2 wcpos:rounded-md wcpos:text-gray-600 hover:wcpos:bg-gray-100`,children:(0,_.jsx)(`svg`,{className:`wcpos:h-5 wcpos:w-5`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,children:(0,_.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M4 6h16M4 12h16M4 18h16`})})}),(0,_.jsx)(`h1`,{className:`wcpos:text-lg wcpos:font-semibold wcpos:text-gray-900 wcpos:m-0`,children:o})]}),(0,_.jsxs)(`main`,{className:`wcpos:flex-1 wcpos:px-6 wcpos:py-6`,children:[t&&(0,_.jsx)(`div`,{className:`wcpos:mb-4`,children:(0,_.jsx)(Kl,{status:t.type,onRemove:()=>n(null),children:t.message})}),(0,_.jsx)(Ga,{FallbackComponent:ql,children:(0,_.jsx)(e.Suspense,{fallback:Uu[a.pathname]||(0,_.jsx)(Iu,{}),children:(0,_.jsx)(ja,{})})})]}),(0,_.jsx)(du,{})]})]})}var Gu=[{id:`use_pos`,labelKey:`access.task_use_pos`,capabilities:[`access_woocommerce_pos`]},{id:`manage_settings`,labelKey:`access.task_manage_settings`,capabilities:[`manage_woocommerce_pos`]},{id:`edit_products`,labelKey:`access.task_edit_products`,capabilities:[`edit_product`,`edit_products`,`edit_others_products`,`edit_private_products`,`edit_published_products`,`publish_products`,`read_private_products`]},{id:`delete_products`,labelKey:`access.task_delete_products`,capabilities:[`delete_product`,`delete_products`,`delete_others_products`,`delete_private_products`,`delete_published_products`]},{id:`edit_coupons`,labelKey:`access.task_edit_coupons`,capabilities:[`edit_shop_coupons`,`edit_others_shop_coupons`,`edit_private_shop_coupons`,`edit_published_shop_coupons`,`publish_shop_coupons`,`read_private_shop_coupons`]},{id:`delete_coupons`,labelKey:`access.task_delete_coupons`,capabilities:[`delete_shop_coupons`,`delete_others_shop_coupons`,`delete_private_shop_coupons`,`delete_published_shop_coupons`]},{id:`manage_orders`,labelKey:`access.task_manage_orders`,capabilities:[`read_private_shop_orders`,`publish_shop_orders`,`edit_shop_orders`,`edit_others_shop_orders`]},{id:`manage_customers`,labelKey:`access.task_manage_customers`,capabilities:[`edit_users`,`list_users`],alternatives:[[`create_customers`,`promote_users`]]},{id:`manage_categories`,labelKey:`access.task_manage_categories`,capabilities:[`manage_product_terms`]}];function Ku(e){let t={};return Object.entries(e||{}).forEach(([e,n])=>{Object.keys(n||{}).forEach(n=>{t[n]=e})}),t}function qu(e){let t=Ku(e);return Gu.filter(e=>e.capabilities.every(e=>e in t)&&(e.alternatives||[]).every(e=>e.some(e=>e in t))).map(n=>{let r=[...n.capabilities];(n.alternatives||[]).forEach(e=>{let n=e.find(e=>e in t);n&&r.push(n)});let i=r.filter(e=>e in t).map(e=>({group:t[e],name:e})),a=i.filter(({group:t,name:n})=>e[t][n]).length;return{task:n,members:i,allGranted:i.length>0&&a===i.length,partiallyGranted:a>0&&a<i.length}}).filter(({members:e})=>e.length>0)}function Ju(e,t){return e.reduce((e,{group:n,name:r})=>(e[n]||(e[n]={}),e[n][r]=t,e),{})}function Yu(e){return(0,_.jsx)(co,{loadingLabel:$(`common.loading`),noResultsLabel:$(`common.no_results`),...e})}var Xu=e=>{let t=y(),{addSnackbar:n}=Bo(),{setNotice:a}=Xl(),o=`wcpos/v1/settings/${e}?wcpos=1`,{data:s}=nt({queryKey:[e],queryFn:async()=>{let e=await(0,i.default)({path:o,method:`GET`}).catch(e=>(console.error(e),e));return e?.code&&e?.message&&a({type:`error`,message:e?.message}),e}});return{data:s,mutate:rt({mutationFn:async e=>await(0,i.default)({path:o,method:`POST`,data:e}),onMutate:async i=>{a(null),n({message:`Saving`,id:e,status:`saving`}),await t.cancelQueries({queryKey:[e]});let o=t.getQueryData([e]);return t.setQueryData([e],e=>(0,r.merge)((0,r.cloneDeep)(e),i)),{previousSettings:o}},onSettled:(i,o,s,c)=>{let l=(0,r.get)(o,`message`);return l?(a({type:`error`,message:l}),n({message:l,id:e,status:`error`}),t.setQueryData([e],c?.previousSettings)):(n({message:`Saved`,id:e,status:`success`}),t.setQueryData([e],i))}}).mutate}},Zu={wcpos:`WCPOS`,wc:`WooCommerce`,wp:`WordPress`};function Qu(){let{data:t,mutate:n}=Xu(`access`),[i,a]=e.useState(`administrator`),[o,s]=e.useState(!1),c=(0,r.get)(t,[i,`capabilities`],null),l=e.useMemo(()=>c?qu(c):[],[c]),u=e.useCallback((e,t)=>{n({[i]:{capabilities:Ju(e,t)}})},[n,i]);return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(`div`,{className:`wcpos:p-4`,children:(0,_.jsxs)(Kl,{status:`info`,isDismissible:!1,children:[(0,_.jsx)(Gl,{i18nKey:`access.default_roles_warning`,components:{strong:(0,_.jsx)(`strong`,{})}}),`\xA0`,(0,_.jsx)(Gl,{i18nKey:`access.visit_documentation`,components:{link:(0,_.jsx)(`a`,{href:`https://docs.wcpos.com/pos-access`,target:`_blank`,rel:`noreferrer`})}})]})}),(0,_.jsxs)(`div`,{className:`wcpos:sm:grid wcpos:sm:grid-cols-3 wcpos:sm:gap-4 wcpos:p-4 wcpos:pt-0`,children:[(0,_.jsx)(`div`,{className:``,children:(0,_.jsx)(`ul`,{children:(0,r.map)(t,(e,t)=>(0,_.jsx)(`li`,{"data-testid":`access-role-${t}`,className:(0,H.default)(`wcpos:p-4 wcpos:mb-1 wcpos:rounded wcpos:font-medium wcpos:text-sm wcpos:hover:bg-gray-100 wcpos:cursor-pointer`,t===i&&`wcpos:bg-wp-admin-theme-color-lightest wcpos:hover:bg-wp-admin-theme-color-lightest`),onClick:()=>{a(t)},children:e.name},t))})}),c&&(0,_.jsxs)(`div`,{className:`wcpos:sm:col-span-2`,children:[(0,_.jsx)(`h2`,{className:`wcpos:text-base wcpos:mb-2`,children:$(`access.tasks_title`)}),(0,_.jsx)(`div`,{"data-testid":`access-task-groups`,children:l.map(({task:e,members:t,allGranted:n,partiallyGranted:r})=>(0,_.jsxs)(`div`,{className:`wcpos:flex wcpos:items-center wcpos:gap-2 wcpos:py-1`,children:[(0,_.jsx)(Xa,{"data-testid":`access-task-${e.id}`,label:$(e.labelKey),checked:n,indeterminate:r,onChange:()=>{u(t,!n)}}),r&&(0,_.jsx)(`span`,{className:`wcpos:text-xs wcpos:text-gray-500`,children:$(`access.task_partial`)})]},e.id))}),(0,_.jsxs)(`details`,{open:o,"data-testid":`access-advanced`,className:`wcpos:mt-4 wcpos:border wcpos:border-gray-200 wcpos:rounded`,children:[(0,_.jsx)(`summary`,{"data-testid":`access-advanced-summary`,className:(0,H.default)(`wcpos:px-3 wcpos:py-2 wcpos:text-sm wcpos:cursor-pointer wcpos:list-none`,`wcpos:flex wcpos:justify-between wcpos:items-center`,`wcpos:hover:bg-gray-50`),onClick:e=>{e.preventDefault(),s(e=>!e)},children:(0,_.jsxs)(`span`,{children:[(0,_.jsx)(`strong`,{children:$(`access.advanced_title`)}),` `,(0,_.jsx)(`span`,{className:`wcpos:text-xs wcpos:text-gray-500`,children:$(`access.advanced_subtitle`)})]})}),o&&(0,_.jsxs)(`div`,{className:`wcpos:border-t wcpos:border-gray-200 wcpos:px-3 wcpos:py-3`,children:[(0,_.jsx)(`p`,{className:`wcpos:text-xs wcpos:text-gray-500 wcpos:mb-3`,children:$(`access.advanced_intro`)}),(0,r.map)(c,(e,t)=>(0,_.jsxs)(`div`,{className:`wcpos:mb-3 wcpos:last:mb-0`,children:[(0,_.jsx)(`h3`,{className:`wcpos:text-sm wcpos:font-medium`,"data-testid":`access-capability-group-${t}`,children:Zu[t]||t}),(0,_.jsx)(`div`,{children:(0,r.map)(e,(e,r)=>(0,_.jsx)(Xa,{label:r,checked:e,disabled:i===`administrator`&&r===`read`,onChange:e=>{n({[i]:{capabilities:{[t]:{[r]:e.target.checked}}}})}},r))})]},t))]})]})]})]})]})}function $u(e){if(Array.isArray(e))return e}function ed(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function td(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function nd(e,t){if(e){if(typeof e==`string`)return td(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?td(e,t):void 0}}function rd(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
3 In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function id(e,t){return $u(e)||ed(e,t)||nd(e,t)||rd()}var ad=f((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.bind=void 0;function t(e,t){var n=t.type,r=t.listener,i=t.options;return e.addEventListener(n,r,i),function(){e.removeEventListener(n,r,i)}}e.bind=t})),od=f((e=>{var t=e&&e.__assign||function(){return t=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},t.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0}),e.bindAll=void 0;var n=ad();function r(e){if(e!==void 0)return typeof e==`boolean`?{capture:e}:e}function i(e,n){return n==null?e:t(t({},e),{options:t(t({},r(n)),r(e.options))})}function a(e,t,r){var a=t.map(function(t){var a=i(t,r);return(0,n.bind)(e,a)});return function(){a.forEach(function(e){return e()})}}e.bindAll=a})),sd=f((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.bindAll=e.bind=void 0;var t=ad();Object.defineProperty(e,"bind",{enumerable:!0,get:function(){return t.bind}});var n=od();Object.defineProperty(e,"bindAll",{enumerable:!0,get:function(){return n.bindAll}})}))(),cd=`data-pdnd-honey-pot`;function ld(e){return e instanceof Element&&e.hasAttribute(`data-pdnd-honey-pot`)}function ud(e){var t=id(document.elementsFromPoint(e.x,e.y),2),n=t[0],r=t[1];return n?ld(n)?r??null:n:null}var dd=2147483647,fd={inset:`unset`,border:`none`,padding:0,margin:0,overflow:`visible`,color:`inherit`,background:`transparent`,width:`auto`,height:`auto`};function pd(e){var t=null;return function(){if(!t){for(var n=arguments.length,r=Array(n),i=0;i<n;i++)r[i]=arguments[i];t={result:e.apply(this,r)}}return t.result}}var md=pd(function(){return typeof HTMLElement<`u`&&typeof HTMLElement.prototype.showPopover==`function`});function hd(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function gd(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?hd(Object(n),!0).forEach(function(t){Bc(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):hd(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var _d=2,vd=_d/2;function yd(e){return{x:Math.floor(e.x),y:Math.floor(e.y)}}function bd(e){return{x:e.x-vd,y:e.y-vd}}function xd(e){return{x:Math.max(e.x,0),y:Math.max(e.y,0)}}function Sd(e){return{x:Math.min(e.x,window.innerWidth-_d),y:Math.min(e.y,window.innerHeight-_d)}}function Cd(e){var t=e.client,n=Sd(xd(bd(yd(t))));return DOMRect.fromRect({x:n.x,y:n.y,width:_d,height:_d})}function wd(e){var t=e.clientRect;return{left:`${t.left}px`,top:`${t.top}px`,width:`${t.width}px`,height:`${t.height}px`}}function Td(e){var t=e.client,n=e.clientRect;return t.x>=n.x&&t.x<=n.x+n.width&&t.y>=n.y&&t.y<=n.y+n.height}function Ed(e){var t=e.initial,n=document.createElement(`div`);n.setAttribute(cd,`true`),md()&&n.setAttribute(`popover`,`manual`);var r=Cd({client:t});Object.assign(n.style,gd(gd({position:`fixed`},md()?fd:{zIndex:dd}),{},{backgroundColor:`transparent`,padding:0,margin:0,boxSizing:`border-box`,pointerEvents:`auto`},wd({clientRect:r}))),document.body.appendChild(n),md()&&n.showPopover();var i=(0,sd.bind)(window,{type:`pointermove`,listener:function(e){r=Cd({client:{x:e.clientX,y:e.clientY}}),Object.assign(n.style,wd({clientRect:r}))},options:{capture:!0}});return function(e){var t=e.current;if(i(),Td({client:t,clientRect:r})){n.remove();return}function a(){o(),n.remove()}var o=(0,sd.bindAll)(window,[{type:`pointerdown`,listener:a},{type:`pointermove`,listener:a},{type:`focusin`,listener:a},{type:`focusout`,listener:a},{type:`dragstart`,listener:a},{type:`dragenter`,listener:a},{type:`dragover`,listener:a}],{capture:!0})}}function Dd(){var e=null;function t(){return e=null,(0,sd.bind)(window,{type:`pointermove`,listener:function(t){e={x:t.clientX,y:t.clientY}},options:{capture:!0}})}function n(){var t=null;return function(n){var r=n.eventName,i=n.payload;if(r===`onDragStart`){var a=i.location.initial.input;t=Ed({initial:e??{x:a.clientX,y:a.clientY}})}if(r===`onDrop`){var o,s=i.location.current.input;(o=t)==null||o({current:{x:s.clientX,y:s.clientY}}),t=null,e=null}}}return{bindEvents:t,getOnPostDispatch:n}}function Od(e){if(Array.isArray(e))return td(e)}function kd(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function Ad(){throw TypeError(`Invalid attempt to spread non-iterable instance.
4 In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function jd(e){return Od(e)||kd(e)||nd(e)||Ad()}var Md=pd(function(){return navigator.userAgent.includes(`Firefox`)}),Nd=pd(function(){var e=navigator.userAgent;return e.includes(`AppleWebKit`)&&!e.includes(`Chrome`)});function Pd(e){return`nodeName`in e}function Fd(e){return Pd(e)&&e.ownerDocument!==document}var Id={isLeavingWindow:Symbol(`leaving`),isEnteringWindow:Symbol(`entering`)};(function(){if(typeof window>`u`||!Nd())return;function e(){return{enterCount:0,isOverWindow:!1}}var t=e();function n(){t=e()}(0,sd.bindAll)(window,[{type:`dragstart`,listener:function(){t.enterCount=0,t.isOverWindow=!0}},{type:`drop`,listener:n},{type:`dragend`,listener:n},{type:`dragenter`,listener:function(e){!t.isOverWindow&&t.enterCount===0&&(e[Id.isEnteringWindow]=!0),t.isOverWindow=!0,t.enterCount++}},{type:`dragleave`,listener:function(e){t.enterCount--,t.isOverWindow&&t.enterCount===0&&(e[Id.isLeavingWindow]=!0,t.isOverWindow=!1)}}],{capture:!0})})();function Ld(e){var t=e.dragLeave;return Nd()?t.hasOwnProperty(Id.isLeavingWindow):!1}function Rd(e){var t=e.dragLeave,n=t.type,r=t.relatedTarget;return n===`dragleave`?Nd()?Ld({dragLeave:t}):r==null?!0:Md()?Fd(r):r instanceof HTMLIFrameElement:!1}function zd(e){var t=e.onDragEnd;return[{type:`pointermove`,listener:function(){var e=0;return function(){if(e<20){e++;return}t()}}()},{type:`pointerdown`,listener:t}]}function Bd(e){return{altKey:e.altKey,button:e.button,buttons:e.buttons,ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey,clientX:e.clientX,clientY:e.clientY,pageX:e.pageX,pageY:e.pageY}}var Vd=function(e){var t=[],n=null,r=function(){for(var r=arguments.length,i=Array(r),a=0;a<r;a++)i[a]=arguments[a];t=i,!n&&(n=requestAnimationFrame(function(){n=null,e.apply(void 0,t)}))};return r.cancel=function(){n&&=(cancelAnimationFrame(n),null)},r}(function(e){return e()}),Hd=function(){var e=null;function t(t){e={frameId:requestAnimationFrame(function(){e=null,t()}),fn:t}}function n(){e&&=(cancelAnimationFrame(e.frameId),e.fn(),null)}return{schedule:t,flush:n}}();function Ud(e){var t=e.source,n=e.initial,r=e.dispatchEvent,i={dropTargets:[]};function a(e){r(e),i={dropTargets:e.payload.location.current.dropTargets}}return{start:function(e){var r=e.nativeSetDragImage,o={current:n,previous:i,initial:n};a({eventName:`onGenerateDragPreview`,payload:{source:t,location:o,nativeSetDragImage:r}}),Hd.schedule(function(){a({eventName:`onDragStart`,payload:{source:t,location:o}})})},dragUpdate:function(e){var r=e.current;Hd.flush(),Vd.cancel(),a({eventName:`onDropTargetChange`,payload:{source:t,location:{initial:n,previous:i,current:r}}})},drag:function(e){var r=e.current;Vd(function(){Hd.flush(),a({eventName:`onDrag`,payload:{source:t,location:{initial:n,previous:i,current:r}}})})},drop:function(e){var r=e.current,o=e.updatedSourcePayload;Hd.flush(),Vd.cancel(),a({eventName:`onDrop`,payload:{source:o??t,location:{current:r,previous:i,initial:n}}})}}}var Wd={isActive:!1};function Gd(){return!Wd.isActive}function Kd(e){return e.dataTransfer?e.dataTransfer.setDragImage.bind(e.dataTransfer):null}function qd(e){var t=e.current,n=e.next;if(t.length!==n.length)return!0;for(var r=0;r<t.length;r++)if(t[r].element!==n[r].element)return!0;return!1}function Jd(e){var t=e.event,n=e.dragType,r=e.getDropTargetsOver,i=e.dispatchEvent;if(!Gd())return;var a=Xd({event:t,dragType:n,getDropTargetsOver:r});Wd.isActive=!0;var o={current:a};Yd({event:t,current:a.dropTargets});var s=Ud({source:n.payload,dispatchEvent:i,initial:a});function c(e){var t=qd({current:o.current.dropTargets,next:e.dropTargets});o.current=e,t&&s.dragUpdate({current:o.current})}function l(e){var t=Bd(e),i=r({target:ld(e.target)?ud({x:t.clientX,y:t.clientY}):e.target,input:t,source:n.payload,current:o.current.dropTargets});i.length&&(e.preventDefault(),Yd({event:e,current:i})),c({dropTargets:i,input:t})}function u(){o.current.dropTargets.length&&c({dropTargets:[],input:o.current.input}),s.drop({current:o.current,updatedSourcePayload:null}),d()}function d(){Wd.isActive=!1,f()}var f=(0,sd.bindAll)(window,[{type:`dragover`,listener:function(e){l(e),s.drag({current:o.current})}},{type:`dragenter`,listener:l},{type:`dragleave`,listener:function(e){Rd({dragLeave:e})&&(c({input:o.current.input,dropTargets:[]}),n.startedFrom===`external`&&u())}},{type:`drop`,listener:function(e){if(o.current={dropTargets:o.current.dropTargets,input:Bd(e)},!o.current.dropTargets.length){u();return}e.preventDefault(),Yd({event:e,current:o.current.dropTargets}),s.drop({current:o.current,updatedSourcePayload:n.type===`external`?n.getDropPayload(e):null}),d()}},{type:`dragend`,listener:function(e){o.current={dropTargets:o.current.dropTargets,input:Bd(e)},u()}}].concat(jd(zd({onDragEnd:u}))),{capture:!0});s.start({nativeSetDragImage:Kd(t)})}function Yd(e){var t=e.event,n=e.current[0]?.dropEffect;n!=null&&t.dataTransfer&&(t.dataTransfer.dropEffect=n)}function Xd(e){var t=e.event,n=e.dragType,r=e.getDropTargetsOver,i=Bd(t);return n.startedFrom===`external`?{input:i,dropTargets:[]}:{input:i,dropTargets:r({input:i,source:n.payload,target:t.target,current:[]})}}var Zd={canStart:Gd,start:Jd},Qd=new Map;function $d(e){var t=e.typeKey,n=e.mount,r=Qd.get(t);if(r)return r.usageCount++,r;var i={typeKey:t,unmount:n(),usageCount:1};return Qd.set(t,i),i}function ef(e){var t=$d(e);return function(){t.usageCount--,!(t.usageCount>0)&&(t.unmount(),Qd.delete(e.typeKey))}}function tf(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(){t.forEach(function(e){return e()})}}function nf(e,t){var n=t.attribute,r=t.value;return e.setAttribute(n,r),function(){return e.removeAttribute(n)}}function rf(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function af(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?rf(Object(n),!0).forEach(function(t){Bc(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):rf(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function of(e,t){var n=typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(!n){if(Array.isArray(e)||(n=sf(e))||t&&e&&typeof e.length==`number`){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw TypeError(`Invalid attempt to iterate non-iterable instance.
5 In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||n.return==null||n.return()}finally{if(s)throw a}}}}function sf(e,t){if(e){if(typeof e==`string`)return cf(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?cf(e,t):void 0}}function cf(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function lf(e){return e.slice(0).reverse()}function uf(e){var t=e.typeKey,n=e.defaultDropEffect,r=new WeakMap,i=`data-drop-target-for-${t}`,a=`[${i}]`;function o(e){return r.set(e.element,e),function(){return r.delete(e.element)}}function s(e){return pd(tf(nf(e.element,{attribute:i,value:`true`}),o(e)))}function c(e){var t=e.source,i=e.target,o=e.input,s=e.result,l=s===void 0?[]:s;if(i==null)return l;if(!(i instanceof Element))return i instanceof Node?c({source:t,target:i.parentElement,input:o,result:l}):l;var u=i.closest(a);if(u==null)return l;var d=r.get(u);if(d==null)return l;var f={input:o,source:t,element:d.element};if(d.canDrop&&!d.canDrop(f))return c({source:t,target:d.element.parentElement,input:o,result:l});var p=d.getData?.call(d,f)??{},m=d.getDropEffect?.call(d,f)??n,h={data:p,element:d.element,dropEffect:m,isActiveDueToStickiness:!1};return c({source:t,target:d.element.parentElement,input:o,result:[].concat(jd(l),[h])})}function l(e){var t=e.eventName,n=e.payload,i=of(n.location.current.dropTargets),a;try{for(i.s();!(a=i.n()).done;){var o,s=a.value,c=r.get(s.element),l=af(af({},n),{},{self:s});c==null||(o=c[t])==null||o.call(c,l)}}catch(e){i.e(e)}finally{i.f()}}var u={onGenerateDragPreview:l,onDrag:l,onDragStart:l,onDrop:l,onDropTargetChange:function(e){var t=e.payload,n=new Set(t.location.current.dropTargets.map(function(e){return e.element})),i=new Set,a=of(t.location.previous.dropTargets),o;try{for(a.s();!(o=a.n()).done;){var s,c=o.value;i.add(c.element);var l=r.get(c.element),u=n.has(c.element),d=af(af({},t),{},{self:c});if(l==null||(s=l.onDropTargetChange)==null||s.call(l,d),!u){var f;l==null||(f=l.onDragLeave)==null||f.call(l,d)}}}catch(e){a.e(e)}finally{a.f()}var p=of(t.location.current.dropTargets),m;try{for(p.s();!(m=p.n()).done;){var h,g,_=m.value;if(!i.has(_.element)){var v=af(af({},t),{},{self:_}),y=r.get(_.element);y==null||(h=y.onDropTargetChange)==null||h.call(y,v),y==null||(g=y.onDragEnter)==null||g.call(y,v)}}}catch(e){p.e(e)}finally{p.f()}}};function d(e){u[e.eventName](e)}function f(e){var t=e.source,n=e.target,i=e.input,a=e.current,o=c({source:t,target:n,input:i});if(o.length>=a.length)return o;for(var s=lf(a),l=lf(o),u=[],d=0;d<s.length;d++){var f,p=s[d],m=l[d];if(m!=null){u.push(m);continue}var h=u[d-1],g=s[d-1];if(h?.element!==g?.element)break;var _=r.get(p.element);if(!_)break;var v={input:i,source:t,element:_.element};if(_.canDrop&&!_.canDrop(v)||!((f=_.getIsSticky)!=null&&f.call(_,v)))break;u.push(af(af({},p),{},{isActiveDueToStickiness:!0}))}return lf(u)}return{dropTargetForConsumers:s,getIsOver:f,dispatchEvent:d}}function df(e,t){var n=typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(!n){if(Array.isArray(e)||(n=ff(e))||t&&e&&typeof e.length==`number`){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw TypeError(`Invalid attempt to iterate non-iterable instance.
6 In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||n.return==null||n.return()}finally{if(s)throw a}}}}function ff(e,t){if(e){if(typeof e==`string`)return pf(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?pf(e,t):void 0}}function pf(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function mf(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function hf(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?mf(Object(n),!0).forEach(function(t){Bc(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):mf(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function gf(){var e=new Set,t=null;function n(e){t&&(!e.canMonitor||e.canMonitor(t.canMonitorArgs))&&t.active.add(e)}function r(r){var i=hf({},r);e.add(i),n(i);function a(){e.delete(i),t&&t.active.delete(i)}return pd(a)}function i(r){var i=r.eventName,a=r.payload;if(i===`onGenerateDragPreview`){t={canMonitorArgs:{initial:a.location.initial,source:a.source},active:new Set};var o=df(e),s;try{for(o.s();!(s=o.n()).done;){var c=s.value;n(c)}}catch(e){o.e(e)}finally{o.f()}}if(t){for(var l=Array.from(t.active),u=0,d=l;u<d.length;u++){var f=d[u];if(t.active.has(f)){var p;(p=f[i])==null||p.call(f,a)}}i===`onDrop`&&(t.active.clear(),t=null)}}return{dispatchEvent:i,monitorForConsumers:r}}function _f(e){var t=e.typeKey,n=e.mount,r=e.dispatchEventToSource,i=e.onPostDispatch,a=e.defaultDropEffect,o=gf(),s=uf({typeKey:t,defaultDropEffect:a});function c(e){r?.(e),s.dispatchEvent(e),o.dispatchEvent(e),i?.(e)}function l(e){var t=e.event,n=e.dragType;Zd.start({event:t,dragType:n,getDropTargetsOver:s.getIsOver,dispatchEvent:c})}function u(){function e(){return n({canStart:Zd.canStart,start:l})}return ef({typeKey:t,mount:e})}return{registerUsage:u,dropTarget:s.dropTargetForConsumers,monitor:o.monitorForConsumers}}var vf=pd(function(){return navigator.userAgent.toLocaleLowerCase().includes(`android`)}),yf=`pdnd:android-fallback`,bf=`text/plain`,xf=`application/vnd.pdnd`,Sf=new WeakMap;function Cf(e){return Sf.set(e.element,e),function(){Sf.delete(e.element)}}var wf=Dd(),Tf=_f({typeKey:`element`,defaultDropEffect:`move`,mount:function(e){return tf(wf.bindEvents(),(0,sd.bind)(document,{type:`dragstart`,listener:function(t){if(e.canStart(t)&&!t.defaultPrevented&&t.dataTransfer){var n=t.target;if(n instanceof HTMLElement){var r=Sf.get(n);if(r){var i=Bd(t),a={element:r.element,dragHandle:r.dragHandle??null,input:i};if(r.canDrag&&!r.canDrag(a)){t.preventDefault();return}if(r.dragHandle){var o=ud({x:i.clientX,y:i.clientY});if(!r.dragHandle.contains(o)){t.preventDefault();return}}var s=r.getInitialDataForExternal?.call(r,a)??null;if(s)for(var c=0,l=Object.entries(s);c<l.length;c++){var u=id(l[c],2),d=u[0],f=u[1];t.dataTransfer.setData(d,f??``)}vf()&&!t.dataTransfer.types.includes(`text/plain`)&&!t.dataTransfer.types.includes(`text/uri-list`)&&t.dataTransfer.setData(bf,yf),t.dataTransfer.setData(xf,``);var p={type:`element`,payload:{element:r.element,dragHandle:r.dragHandle??null,data:r.getInitialData?.call(r,a)??{}},startedFrom:`internal`};e.start({event:t,dragType:p})}}}}}))},dispatchEventToSource:function(e){var t,n,r=e.eventName,i=e.payload;(t=Sf.get(i.source.element))==null||(n=t[r])==null||n.call(t,i)},onPostDispatch:wf.getOnPostDispatch()}),Ef=Tf.dropTarget,Df=Tf.monitor;function Of(e){return pd(tf(Tf.registerUsage(),Cf(e),nf(e.element,{attribute:`draggable`,value:`true`})))}function kf(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Af(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?kf(Object(n),!0).forEach(function(t){Bc(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):kf(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var jf={top:function(e,t){return Math.abs(t.y-e.top)},right:function(e,t){return Math.abs(e.right-t.x)},bottom:function(e,t){return Math.abs(e.bottom-t.y)},left:function(e,t){return Math.abs(t.x-e.left)}};function Mf(e,t){var n=t.element,r=t.input,i=t.allowedEdges,a={x:r.clientX,y:r.clientY},o=n.getBoundingClientRect(),s=i.map(function(e){return{edge:e,value:jf[e](o,a)}}).sort(function(e,t){return e.value-t.value})[0]?.edge??null;return Af(Af({},e),{},Bc({},Pf,s))}function Nf(e){return e[Pf]??null}var Pf=Symbol(`closestEdge`);function Ff(e){var t=e.list,n=e.startIndex,r=e.finishIndex;if(n===-1||r===-1)return Array.from(t);var i=Array.from(t),a=id(i.splice(n,1),1)[0];return i.splice(r,0,a),i}function If(e){var t=e.startIndex,n=e.closestEdgeOfTarget,r=e.indexOfTarget,i=e.axis;if(t===-1||r===-1||t===r)return t;if(n==null)return r;var a=i===`vertical`&&n===`bottom`||i===`horizontal`&&n===`right`;return t<r?a?r:r-1:a?r+1:r}function Lf(e){var t=e.list,n=e.startIndex,r=e.closestEdgeOfTarget,i=e.indexOfTarget,a=e.axis;return Ff({list:t,startIndex:n,finishIndex:If({closestEdgeOfTarget:r,startIndex:n,indexOfTarget:i,axis:a})})}function Rf({gateway:t,mutate:n,closeModal:r}){let[i,a]=e.useState(t.title),[o,s]=e.useState(t.description),c=e.useRef(),l=()=>{n({gateways:{[t.id]:{title:i,description:o}}}),r()},u=e.useCallback(e=>{let t=e.target.value,n=e.target.id;n===`title`&&a(t),n===`description`&&s(t)},[]);return(0,_.jsxs)(lo,{open:!0,onClose:()=>r(),title:t.title,className:`wcpos:max-w-md`,children:[(0,_.jsx)(Kl,{status:`info`,isDismissible:!1,children:(0,_.jsx)(Gl,{i18nKey:`checkout.gateway_settings_pos_only`,components:{link:(0,_.jsx)(`a`,{href:`admin.php?page=wc-settings&tab=checkout`,target:`_blank`,rel:`noreferrer`})}})}),(0,_.jsxs)(`div`,{className:`wcpos:py-2`,children:[(0,_.jsx)(`label`,{htmlFor:`title`,className:`wcpos:block wcpos:mb-1 wcpos:font-medium wcpos:text-sm`,children:$(`common.title`)}),(0,_.jsx)(`input`,{ref:c,id:`title`,name:`title`,type:`text`,value:i,onChange:u,className:`wcpos:w-full wcpos:p-2 wcpos:rounded wcpos:border wcpos:border-gray-300 wcpos:focus:border-wp-admin-theme-color`})]}),(0,_.jsxs)(`div`,{className:`wcpos:py-2`,children:[(0,_.jsx)(`label`,{htmlFor:`description`,className:`wcpos:block wcpos:mb-1 wcpos:font-medium wcpos:text-sm`,children:$(`common.description`)}),(0,_.jsx)(`textarea`,{id:`description`,name:`description`,value:o,onChange:u,className:`wcpos:w-full wcpos:h-20 wcpos:p-2 wcpos:rounded wcpos:border wcpos:border-gray-300 wcpos:focus:border-wp-admin-theme-color`})]}),(0,_.jsxs)(`div`,{className:`wcpos:text-right wcpos:pt-4 wcpos:flex wcpos:justify-end wcpos:gap-2`,children:[(0,_.jsx)(U,{onClick:r,children:$(`common.cancel`)}),(0,_.jsx)(U,{variant:`primary`,onClick:l,children:$(`common.save`)})]})]})}function zf({selectedStatus:t,onChange:n,disabled:r}){let i=window?.wcpos?.settings?.order_statuses??{},a=e.useMemo(()=>Object.entries(i).map(([e,t])=>({value:e,label:t})),[i]);return(0,_.jsx)(G,{options:a||[],value:t,onChange:({value:e})=>{n(String(e))},disabled:r})}var Bf=e=>(0,_.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,...e,children:(0,_.jsx)(`path`,{d:`M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2zm-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z`})}),Vf=e=>(0,_.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,...e,children:(0,_.jsx)(`path`,{d:`M12 4a2 2 0 110 4 2 2 0 010-4zm0 6a2 2 0 110 4 2 2 0 010-4zm0 6a2 2 0 110 4 2 2 0 010-4z`})});function Hf({item:t,index:n,data:r,mutate:i,proEnabled:a,onEditGateway:o}){let s=e.useRef(null),c=e.useRef(null),[l,u]=e.useState(!1),[d,f]=e.useState(null);return e.useEffect(()=>{let e=s.current,r=c.current;if(!e||!r)return;let i=Of({element:e,dragHandle:r,getInitialData:()=>({id:t.id,index:n}),onDragStart:()=>u(!0),onDrop:()=>u(!1)}),a=Ef({element:e,getData:({input:e,element:r})=>Mf({id:t.id,index:n},{element:r,input:e,allowedEdges:[`top`,`bottom`]}),onDragEnter:({self:e})=>f(Nf(e.data)),onDrag:({self:e})=>f(Nf(e.data)),onDragLeave:()=>f(null),onDrop:()=>f(null)});return()=>{i(),a()}},[t.id,n]),(0,_.jsxs)(Go,{ref:s,className:(0,H.default)(`wcpos:relative`,l&&`wcpos:opacity-50`,n%2!=0&&`wcpos:bg-gray-50`),children:[d&&(0,_.jsx)(X,{colSpan:7,className:(0,H.default)(`wcpos:absolute wcpos:left-0 wcpos:right-0 wcpos:h-0.5 wcpos:bg-wp-admin-theme-color wcpos:p-0`,d===`top`?`wcpos:top-0`:`wcpos:bottom-0`)}),(0,_.jsx)(X,{ref:c,className:`wcpos:pl-3 wcpos:pr-1 wcpos:whitespace-nowrap wcpos:cursor-grab wcpos:w-8`,children:(0,_.jsx)(Bf,{className:`wcpos:w-5 wcpos:h-5 wcpos:text-gray-400 wcpos:fill-current`})}),(0,_.jsx)(X,{className:`wcpos:whitespace-nowrap wcpos:text-center`,children:(0,_.jsx)(`input`,{type:`radio`,value:t.id,checked:r?.default_gateway===t.id,disabled:!t.enabled,className:``,onChange:()=>{i({default_gateway:t.id})}})}),(0,_.jsx)(X,{className:`wcpos:text-ellipsis wcpos:overflow-hidden wcpos:whitespace-nowrap`,children:(0,_.jsx)(`strong`,{children:t.title})}),(0,_.jsx)(X,{className:`wcpos:whitespace-nowrap`,children:t.id}),(0,_.jsx)(X,{className:`wcpos:whitespace-nowrap wcpos:text-center`,children:(0,_.jsx)(Ya,{"aria-label":t.title,checked:t.enabled,onChange:()=>{i({gateways:{[t.id]:{enabled:!t.enabled}}})},disabled:!a&&![`pos_cash`,`pos_card`].includes(t.id)})}),(0,_.jsx)(X,{className:`wcpos:whitespace-nowrap`,children:(0,_.jsx)(zf,{selectedStatus:t.order_status||`wc-completed`,onChange:e=>{i({gateways:{[t.id]:{order_status:e}}})},disabled:!a&&![`pos_cash`,`pos_card`].includes(t.id)})}),(0,_.jsx)(X,{className:`wcpos:whitespace-nowrap wcpos:text-right`,children:(0,_.jsxs)(po,{label:t.title,trigger:(0,_.jsx)(`span`,{className:(0,H.default)(`wcpos:inline-flex wcpos:items-center wcpos:justify-center wcpos:rounded-md wcpos:border wcpos:border-gray-300 wcpos:bg-white wcpos:px-2 wcpos:py-1.5 wcpos:text-gray-700 wcpos:hover:bg-gray-50`,!a&&![`pos_cash`,`pos_card`].includes(t.id)&&`wcpos:opacity-50 wcpos:cursor-not-allowed wcpos:pointer-events-none`),"aria-label":$(`common.settings`),children:(0,_.jsx)(Vf,{className:`wcpos:w-4 wcpos:h-4 wcpos:fill-current`})}),children:[(0,_.jsx)(mo,{onSelect:()=>o(t),disabled:!a&&![`pos_cash`,`pos_card`].includes(t.id),children:$(`common.pos_settings`)}),![`pos_cash`,`pos_card`].includes(t.id)&&(0,_.jsx)(mo,{href:`admin.php?page=wc-settings&tab=checkout&section=${t.id}`,children:$(`common.woocommerce_settings`)})]})})]})}function Uf(){let{data:t,mutate:n}=Xu(`payment-gateways`),[i,a]=e.useState(!1),[o,s]=e.useState(null),c=t?.pro_enabled,l=(0,r.sortBy)(t?.gateways,[`order`,`id`]);e.useEffect(()=>Df({onDrop:({source:e,location:t})=>{let i=t.current.dropTargets[0];if(!i)return;let a=e.data.index,o=i.data.index,s=Nf(i.data),c=Lf({list:l,startIndex:a,indexOfTarget:o,closestEdgeOfTarget:s,axis:`vertical`}).map((e,t)=>({...e,order:t}));n({gateways:(0,r.keyBy)(c,`id`)})}}),[l,n]),e.useEffect(()=>{c||eu(`checkout_gateways`)},[c]);let u=e.useCallback(e=>{s(e),a(!0)},[]);return(0,_.jsxs)(_.Fragment,{children:[c?``:(0,_.jsx)(`div`,{className:`wcpos:pb-5`,children:(0,_.jsxs)(Kl,{status:`info`,isDismissible:!1,children:[$(`checkout.enable_pro_gateways`),` `,(0,_.jsx)(`a`,{href:`https://wcpos.com/pro`,onClick:()=>tu(`checkout_gateways`,`https://wcpos.com/pro`),children:$(`common.upgrade_to_pro`)}),`.`]})}),(0,_.jsxs)(Vo,{children:[(0,_.jsx)(Ho,{children:(0,_.jsxs)(Wo,{children:[(0,_.jsx)(Y,{scope:`col`}),(0,_.jsx)(Y,{scope:`col`,className:`wcpos:text-center`,"data-testid":`gateways-th-default`,children:$(`common.default`)}),(0,_.jsx)(Y,{scope:`col`,"data-testid":`gateways-th-gateway`,children:$(`common.gateway`)}),(0,_.jsx)(Y,{scope:`col`,children:$(`checkout.gateway_id`)}),(0,_.jsx)(Y,{scope:`col`,className:`wcpos:text-center`,"data-testid":`gateways-th-enabled`,children:$(`common.enabled`)}),(0,_.jsx)(Y,{scope:`col`,children:$(`checkout.order_status`)}),(0,_.jsx)(Y,{scope:`col`})]})}),(0,_.jsx)(Uo,{children:l.map((e,r)=>(0,_.jsx)(Hf,{item:e,index:r,data:t,mutate:n,proEnabled:!!c,onEditGateway:u},e.id))})]}),i&&o&&(0,_.jsx)(Rf,{gateway:o,mutate:n,closeModal:()=>a(!1)})]})}function Wf({children:e,tip:t}){return(0,_.jsxs)(`div`,{className:`wcpos:flex wcpos:items-center wcpos:gap-2`,children:[e,t&&(0,_.jsx)(uo,{text:t,children:(0,_.jsx)(`span`,{className:`wcpos:inline-flex wcpos:text-gray-300`,children:(0,_.jsx)(lu,{className:`wcpos:h-4 wcpos:w-4`,fill:`currentColor`})})})]})}var Gf=[{key:`new_order`,label:`checkout.email_new_order`},{key:`cancelled_order`,label:`checkout.email_cancelled_order`},{key:`failed_order`,label:`checkout.email_failed_order`}],Kf=[{key:`customer_on_hold_order`,label:`checkout.email_on_hold_order`},{key:`customer_processing_order`,label:`checkout.email_processing_order`},{key:`customer_completed_order`,label:`checkout.email_completed_order`},{key:`customer_refunded_order`,label:`checkout.email_refunded_order`},{key:`customer_failed_order`,label:`checkout.email_failed_order`}],qf=[{key:`new_order`,label:`checkout.email_new_order`}];function Jf({settingsKey:e,label:t,tip:n,emailTypes:r,data:i,mutate:a}){let o=i?.[e],s=o?.enabled??!1;return(0,_.jsxs)(q,{children:[(0,_.jsx)(Wf,{tip:n,children:(0,_.jsx)(Ya,{checked:s,onChange:t=>{a({[e]:{enabled:t}})},label:t})}),s&&(0,_.jsx)(`div`,{className:`wcpos:ml-12 wcpos:mt-2 wcpos:flex wcpos:flex-col wcpos:gap-2`,children:r.map(({key:t,label:n})=>(0,_.jsx)(Xa,{checked:o?.[t]??!0,onChange:n=>{a({[e]:{[t]:n.target.checked}})},label:$(n)},t))})]})}function Yf(){let{data:t,mutate:n}=Xu(`checkout`);return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(wo,{children:[(0,_.jsx)(q,{children:(0,_.jsx)(Wf,{tip:$(`checkout.prevent_overselling_tip`),children:(0,_.jsx)(Ya,{checked:!!t?.prevent_overselling,onChange:e=>{n({prevent_overselling:e})},label:$(`checkout.prevent_overselling`)})})}),(0,_.jsx)(Jf,{settingsKey:`admin_emails`,label:$(`checkout.admin_emails`),tip:$(`checkout.admin_emails_tip`),emailTypes:Gf,data:t,mutate:n}),(0,_.jsx)(Jf,{settingsKey:`customer_emails`,label:$(`checkout.customer_emails`),tip:$(`checkout.customer_emails_tip`),emailTypes:Kf,data:t,mutate:n}),(0,_.jsx)(Jf,{settingsKey:`cashier_emails`,label:$(`checkout.cashier_emails`),tip:$(`checkout.cashier_emails_tip`),emailTypes:qf,data:t,mutate:n})]}),(0,_.jsxs)(`div`,{className:`wcpos:px-4 wcpos:pb-5`,children:[(0,_.jsx)(`h2`,{className:`wcpos:text-base`,children:$(`checkout.gateways`)}),(0,_.jsx)(`p`,{children:$(`checkout.gateways_description`)}),(0,_.jsx)(Ga,{FallbackComponent:ql,children:(0,_.jsx)(e.Suspense,{fallback:(0,_.jsx)(Ru,{rows:3}),children:(0,_.jsx)(Uf,{})})})]})]})}var Xf={printnode:{label:`PrintNode`,badge:{mark:`PN`,className:`wcpos:bg-teal-600 wcpos:text-white`},isPolling:!1,pollEndpoint:null,templateEngines:`all`},"star-online":{label:`Star Online`,badge:{mark:`☆`,className:`wcpos:bg-indigo-600 wcpos:text-white`},isPolling:!1,pollEndpoint:null,templateEngines:`thermal`},"star-cloudprnt":{label:`Star CloudPRNT`,badge:{mark:`★`,className:`wcpos:bg-blue-500 wcpos:text-white`},isPolling:!0,pollEndpoint:`cloudprnt`,templateEngines:`thermal`},"epson-sdp":{label:`Epson Server Direct Print`,badge:{mark:`E`,className:`wcpos:bg-blue-900 wcpos:text-white`},isPolling:!0,pollEndpoint:`epson-sdp`,templateEngines:`thermal`}};function Zf(e,t){return Xf[t].templateEngines===`all`?e:e.filter(e=>e.engine===Xf[t].templateEngines)}var Qf=[`printnode`,`star-online`,`star-cloudprnt`,`epson-sdp`];function $f(e){switch(e){case`star-online`:return $(`cloud_print.choice_star_online_desc`,`A Star printer linked to your stario.online account. Examples: mC-Print3, TSP143IV, mC-Label3.`);case`star-cloudprnt`:return $(`cloud_print.choice_star_desc`,`Star printer with CloudPRNT built in (mC-Print, TSP143IV…)`);case`epson-sdp`:return $(`cloud_print.choice_epson_desc`,`Epson TM printer with Server Direct Print support`);default:return $(`cloud_print.choice_printnode_desc`,`Use a regular USB / network thermal printer through a PrintNode account`)}}function ep(e){switch(e){case`printnode`:return $(`cloud_print.best_printnode`,`Best if you have an ordinary USB or network receipt printer (not a cloud printer) and can run the small PrintNode app on a computer at the store.`);case`star-online`:return $(`cloud_print.best_star_online`,`Best if you have a Star printer and a stario.online account — Star's cloud handles delivery for you.`);case`star-cloudprnt`:return $(`cloud_print.best_star_direct`,`Best if you have a Star printer and want a free connection with no third-party account — the printer talks to your store directly.`);default:return $(`cloud_print.best_epson`,`Best if you have an Epson "intelligent" TM printer (TM-T88VI/VII, TM-m30III, TM-i series).`)}}function tp(){return window.wpApiSettings?.root||`${window.location.origin}/wp-json/`}function np(e,t,n,r){let i=Xf[e].pollEndpoint,a=`${encodeURIComponent(t)}/${n}`;if(r)return`${r.replace(/\/$/,``)}/${a}/${i}`;let o=`${tp()}wcpos/v1/print-jobs/${i}/${a}`;return`${o}${o.includes(`?`)?`&`:`?`}wcpos=1`}function rp(e,t,n,r){return np(e,t,encodeURIComponent(n),r)}function ip(e,t,n){return np(e,t,`••••`,n)}function ap({label:t,help:n,value:r,copyValue:i,valueTestId:a,copyTestId:o}){let[s,c]=e.useState(!1),l=e.useCallback(()=>{i&&(navigator.clipboard?.writeText(i),c(!0),window.setTimeout(()=>c(!1),1500))},[i]);return(0,_.jsxs)(`div`,{className:`wcpos:flex wcpos:flex-col wcpos:gap-1`,children:[(0,_.jsxs)(`div`,{className:`wcpos:flex wcpos:items-baseline wcpos:gap-1`,children:[(0,_.jsx)(`span`,{className:`wcpos:text-sm wcpos:font-medium wcpos:text-gray-900`,children:t}),n&&(0,_.jsxs)(`span`,{className:`wcpos:text-xs wcpos:text-gray-500`,children:[`— `,n]})]}),(0,_.jsxs)(`div`,{className:`wcpos:flex wcpos:items-center wcpos:gap-2`,children:[(0,_.jsx)(`code`,{"data-testid":a,className:`wcpos:min-w-0 wcpos:flex-1 wcpos:overflow-x-auto wcpos:whitespace-nowrap wcpos:rounded wcpos:bg-gray-100 wcpos:px-2 wcpos:py-1 wcpos:text-xs wcpos:text-gray-900`,children:r}),i&&(0,_.jsx)(U,{variant:`outline`,onClick:l,"data-testid":o,"aria-label":$(`cloud_print.copy`,`Copy`),children:s?$(`cloud_print.copied`,`Copied to clipboard`):$(`cloud_print.copy`,`Copy`)})]})]})}function op(){return(0,_.jsx)(`p`,{className:`wcpos:text-xs`,"data-testid":`wizard-relay-docs-note`,children:(0,_.jsxs)(`a`,{href:`https://docs.wcpos.com/receipts/cloud-printing`,target:`_blank`,rel:`noopener noreferrer`,className:`wcpos:inline-flex wcpos:items-center wcpos:gap-1`,children:[(0,_.jsx)(`span`,{className:`wcpos:h-3.5 wcpos:w-3.5`,children:(0,_.jsx)(cu,{fill:`currentColor`})}),$(`cloud_print.relay_docs_note`,`For more information on why we're using a relay server.`),(0,_.jsx)(`span`,{className:`wcpos:sr-only`,children:` (opens in new tab)`})]})})}function sp({url:e,copyable:t}){return(0,_.jsxs)(`details`,{className:`wcpos:mt-1`,"data-testid":`wizard-direct-disclosure`,children:[(0,_.jsx)(`summary`,{className:`wcpos:cursor-pointer wcpos:text-xs wcpos:text-gray-500`,children:$(`cloud_print.advanced_direct`,`Advanced: connect directly to this site (no relay)`)}),(0,_.jsxs)(`div`,{className:`wcpos:mt-2 wcpos:flex wcpos:flex-col wcpos:gap-2`,children:[(0,_.jsx)(`p`,{className:`wcpos:text-xs wcpos:text-gray-500`,children:$(`cloud_print.direct_url_help`,`The relay exists because many printers can't connect to modern hosting. Only connect directly if you'd rather not route print jobs through a relay — some printers can't reach this site and will stay stuck on "Waiting for printer".`)}),(0,_.jsx)(ap,{label:$(`cloud_print.direct_url`,`Direct URL`),value:e,copyValue:t?e:void 0,valueTestId:`wizard-direct-url`,copyTestId:`wizard-copy-direct-url`})]})]})}function cp({open:t,mode:n,setupPrinter:r,onClose:i,onCreate:a,fetchPrintNodePrinters:o,fetchStarDevices:s,relay:c}){let[l,u]=e.useState(0),[d,f]=e.useState(null),[p,m]=e.useState(``),[h,g]=e.useState(``),[v,y]=e.useState(``),[b,x]=e.useState(``),[S,C]=e.useState(!1),[w,T]=e.useState(null),[E,D]=e.useState(null),[O,k]=e.useState(null),[A,j]=e.useState(!1),[M,N]=e.useState(null),[P,F]=e.useState(null),[ee,I]=e.useState(!1),[te,L]=e.useState(null),R=e.useCallback(()=>{g(``),y(``),x(``),C(!1),T(null),D(null),k(null),j(!1),N(null),F(null),I(!1),L(null)},[]),ne=e.useRef(d);e.useEffect(()=>{if(!t){ne.current=d;return}ne.current!==d&&(R(),ne.current=d)},[t,d,R]);let re=async()=>{if(o){j(!0),N(null);try{let e=await o(h.trim());k(e),y(t=>e.some(e=>String(e.id)===t)?t:``),e.length===0&&N($(`cloud_print.printnode_no_printers`,`No printers found on this PrintNode account.`))}catch{k(null),N($(`cloud_print.printnode_fetch_failed`,`Couldn't list your PrintNode printers. Check the API key and that the desktop client is running.`))}finally{j(!1)}}},ie=async()=>{if(s){I(!0),L(null);try{let e=await s(b.trim(),h.trim());F(e),y(t=>e.some(e=>e.id===t)?t:``),e.length===0&&L($(`cloud_print.star_online_no_devices`,`No devices found in this Star Online group.`))}catch{F(null),L($(`cloud_print.star_online_fetch_failed`,`Couldn't list your Star Online devices. Check the CloudPRNT URL and API key.`))}finally{I(!1)}}},[ae,oe]=e.useState(!1);if(t!==ae&&(oe(t),t&&(n===`setup`&&r?(f(r.provider),u(2)):(f(null),u(0)),m(``),R())),!t)return null;let se=d===`printnode`,ce=d===`star-online`,le=p.trim(),ue=le!==``&&(!se||h.trim()!==``&&v.trim()!==``)&&(!ce||h.trim()!==``&&b.trim()!==``&&v.trim()!==``),de=async()=>{if(!d)return;let e={name:le,provider:d};se&&(e.printnode_api_key=h.trim(),e.printnode_printer_id=Number(v.trim())),ce&&(e.star_api_key=h.trim(),e.star_cloudprnt_url=b.trim(),e.star_device_id=v.trim()),C(!0),T(null);try{let t=await a(e);D(t),u(2)}catch{T($(`cloud_print.create_failed`,`Couldn't create the printer. Please try again.`))}finally{C(!1)}},fe=l===2?$(`cloud_print.connect_title`,`Connect your printer`):$(`cloud_print.add_title`,`Add a cloud printer`),pe=n===`setup`?r??null:E?.printer??null,me=n===`setup`&&r?r.provider:d,he=me?Xf[me].isPolling:!1;return(0,_.jsx)(lo,{open:t,onClose:()=>i(),title:fe,className:`wcpos:max-w-xl`,children:(0,_.jsxs)(`div`,{className:`wcpos:flex wcpos:flex-col wcpos:gap-4`,children:[w&&(0,_.jsx)(bo,{status:`error`,isDismissible:!1,children:(0,_.jsx)(`span`,{"data-testid":`wizard-error`,children:w})}),l===0&&(0,_.jsxs)(`div`,{className:`wcpos:flex wcpos:flex-col wcpos:gap-2`,children:[(0,_.jsx)(`p`,{className:`wcpos:text-sm wcpos:text-gray-700`,children:$(`cloud_print.step_provider_q`,`What kind of printer are you connecting?`)}),Qf.map(e=>{let t=Xf[e],n=d===e;return(0,_.jsxs)(`button`,{type:`button`,"data-testid":`provider-choice-${e}`,"aria-pressed":n,onClick:()=>f(e),className:`wcpos:flex wcpos:items-start wcpos:gap-3 wcpos:rounded-md wcpos:border wcpos:p-3 wcpos:text-left wcpos:transition-colors `+(n?`wcpos:border-wp-admin-theme-color wcpos:bg-wp-admin-theme-color-lightest`:`wcpos:border-gray-300 wcpos:hover:bg-gray-50`),children:[(0,_.jsx)(`span`,{className:t.badge.className+` wcpos:flex wcpos:size-8 wcpos:shrink-0 wcpos:items-center wcpos:justify-center wcpos:rounded wcpos:text-sm wcpos:font-semibold`,"aria-hidden":`true`,children:t.badge.mark}),(0,_.jsxs)(`span`,{className:`wcpos:min-w-0`,children:[(0,_.jsx)(`span`,{className:`wcpos:block wcpos:text-sm wcpos:font-semibold wcpos:text-gray-900`,children:t.label}),(0,_.jsx)(`span`,{className:`wcpos:block wcpos:text-xs wcpos:text-gray-500`,children:$f(e)}),(0,_.jsx)(`span`,{className:`wcpos:mt-1 wcpos:block wcpos:text-xs wcpos:text-gray-600`,children:ep(e)})]})]},e)})]}),l===1&&(0,_.jsxs)(`div`,{className:`wcpos:flex wcpos:flex-col wcpos:gap-3`,children:[(0,_.jsxs)(`label`,{className:`wcpos:flex wcpos:flex-col wcpos:gap-1`,children:[(0,_.jsx)(`span`,{className:`wcpos:text-sm wcpos:font-medium wcpos:text-gray-900`,children:$(`cloud_print.printer_name`,`Printer name`)}),(0,_.jsx)(W,{"data-testid":`wizard-name-input`,value:p,placeholder:$(`cloud_print.printer_name_ph`,`e.g. Kitchen printer`),onChange:e=>m(e.target.value)}),(0,_.jsx)(`span`,{className:`wcpos:text-xs wcpos:text-gray-500`,children:$(`cloud_print.printer_name_help`,`A friendly name so you can recognise it later. The technical ID is created for you.`)})]}),se&&(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(`label`,{className:`wcpos:flex wcpos:flex-col wcpos:gap-1`,children:[(0,_.jsx)(`span`,{className:`wcpos:text-sm wcpos:font-medium wcpos:text-gray-900`,children:$(`cloud_print.printnode_api_key`,`PrintNode API key`)}),(0,_.jsx)(W,{"data-testid":`wizard-printnode-api-key`,value:h,placeholder:$(`cloud_print.printnode_api_key_ph`,`Paste your PrintNode account API key`),onChange:e=>g(e.target.value)}),o&&(0,_.jsxs)(`div`,{className:`wcpos:flex wcpos:flex-col wcpos:gap-1 wcpos:pt-1`,children:[(0,_.jsx)(U,{variant:`outline`,"data-testid":`wizard-printnode-fetch`,disabled:h.trim()===``||A,loading:A,onClick:re,children:$(`cloud_print.printnode_fetch`,`Fetch my printers`)}),M&&(0,_.jsx)(`span`,{"data-testid":`wizard-printnode-fetch-error`,className:`wcpos:text-xs wcpos:text-red-600`,children:M})]})]}),O&&O.length>0&&(0,_.jsxs)(`label`,{className:`wcpos:flex wcpos:flex-col wcpos:gap-1`,children:[(0,_.jsx)(`span`,{className:`wcpos:text-sm wcpos:font-medium wcpos:text-gray-900`,children:$(`cloud_print.printnode_pick_printer`,`Choose a printer`)}),(0,_.jsxs)(`select`,{"data-testid":`wizard-printnode-printer-select`,value:v,onChange:e=>y(e.target.value),className:`wcpos:rounded wcpos:border wcpos:border-gray-300 wcpos:px-2 wcpos:py-1 wcpos:text-sm`,children:[(0,_.jsx)(`option`,{value:``,children:$(`cloud_print.printnode_pick_placeholder`,`Select a printer…`)}),O.map(e=>(0,_.jsxs)(`option`,{value:String(e.id),children:[e.name,` (`,e.state,`)`]},e.id))]})]}),(0,_.jsxs)(`label`,{className:`wcpos:flex wcpos:flex-col wcpos:gap-1`,children:[(0,_.jsx)(`span`,{className:`wcpos:text-sm wcpos:font-medium wcpos:text-gray-900`,children:$(`cloud_print.printnode_printer_id`,`PrintNode printer ID`)}),(0,_.jsx)(W,{"data-testid":`wizard-printnode-printer-id`,type:`number`,value:v,onChange:e=>y(e.target.value)})]}),(0,_.jsx)(bo,{status:`info`,isDismissible:!1,children:$(`cloud_print.printnode_note`,`Install the small PrintNode client on a computer next to the printer, then paste your account's API key. We'll list that account's printers next.`)})]}),ce&&(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(`label`,{className:`wcpos:flex wcpos:flex-col wcpos:gap-1`,children:[(0,_.jsx)(`span`,{className:`wcpos:text-sm wcpos:font-medium wcpos:text-gray-900`,children:$(`cloud_print.star_cloudprnt_url`,`CloudPRNT URL`)}),(0,_.jsx)(W,{"data-testid":`wizard-star-cloudprnt-url`,value:b,placeholder:`https://eu-device.stario.online/cloudprnt/your-group`,onChange:e=>x(e.target.value)})]}),(0,_.jsxs)(`label`,{className:`wcpos:flex wcpos:flex-col wcpos:gap-1`,children:[(0,_.jsx)(`span`,{className:`wcpos:text-sm wcpos:font-medium wcpos:text-gray-900`,children:$(`cloud_print.star_api_key`,`Star Online API key`)}),(0,_.jsx)(W,{"data-testid":`wizard-star-api-key`,value:h,placeholder:$(`cloud_print.star_api_key_ph`,`Paste your Star-Api-Key`),onChange:e=>g(e.target.value)}),s&&(0,_.jsxs)(`div`,{className:`wcpos:flex wcpos:flex-col wcpos:gap-1 wcpos:pt-1`,children:[(0,_.jsx)(U,{variant:`outline`,"data-testid":`wizard-star-fetch`,disabled:h.trim()===``||b.trim()===``||ee,loading:ee,onClick:ie,children:$(`cloud_print.star_fetch`,`Fetch my devices`)}),te&&(0,_.jsx)(`span`,{"data-testid":`wizard-star-fetch-error`,className:`wcpos:text-xs wcpos:text-red-600`,children:te})]})]}),P&&P.length>0&&(0,_.jsxs)(`label`,{className:`wcpos:flex wcpos:flex-col wcpos:gap-1`,children:[(0,_.jsx)(`span`,{className:`wcpos:text-sm wcpos:font-medium wcpos:text-gray-900`,children:$(`cloud_print.star_pick_device`,`Choose a device`)}),(0,_.jsxs)(`select`,{"data-testid":`wizard-star-device-select`,value:v,onChange:e=>y(e.target.value),className:`wcpos:rounded wcpos:border wcpos:border-gray-300 wcpos:px-2 wcpos:py-1 wcpos:text-sm`,children:[(0,_.jsx)(`option`,{value:``,children:$(`cloud_print.star_pick_placeholder`,`Select a device…`)}),P.map(e=>(0,_.jsxs)(`option`,{value:e.id,children:[e.name,` (`,e.state,`)`]},e.id))]})]}),(0,_.jsxs)(`label`,{className:`wcpos:flex wcpos:flex-col wcpos:gap-1`,children:[(0,_.jsx)(`span`,{className:`wcpos:text-sm wcpos:font-medium wcpos:text-gray-900`,children:$(`cloud_print.star_device_id`,`AccessIdentifier`)}),(0,_.jsx)(W,{"data-testid":`wizard-star-device-id`,value:v,onChange:e=>y(e.target.value)})]})]})]}),l===2&&me&&(0,_.jsx)(`div`,{className:`wcpos:flex wcpos:flex-col wcpos:gap-3`,children:he?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(`div`,{children:(0,_.jsx)(J,{variant:`success`,icon:`✓`,children:$(`cloud_print.created`,`Printer created`)})}),n===`setup`?(0,_.jsx)(bo,{status:`info`,isDismissible:!1,children:$(`cloud_print.poll_url_lost`,`The full address (with its secret token) was shown only once when this printer was created and can't be displayed again. To get a new one, remove and re-add the printer.`)}):(0,_.jsx)(`p`,{className:`wcpos:text-sm wcpos:text-gray-700`,children:$(`cloud_print.poll_url_once_intro`,`Copy this address into your printer's setup screen. It contains a secret token and is shown in full only once.`)}),(()=>{let e=pe;if(!e)return null;let t=c?.enabled&&c.printer_base_url?c.printer_base_url:void 0;if(n===`setup`)return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(ap,{label:$(`cloud_print.poll_url`,`Poll URL`),help:$(`cloud_print.poll_url_help`,`paste into the printer's "server URL"`),value:ip(me,e.id,t),valueTestId:`wizard-poll-url`,copyTestId:`wizard-copy-url`}),t&&(0,_.jsx)(op,{}),t&&(0,_.jsx)(sp,{url:ip(me,e.id),copyable:!1})]});let r=E?.token??``;if(!r)return(0,_.jsx)(bo,{status:`warning`,isDismissible:!1,children:$(`cloud_print.token_missing`,`This printer was created, but no setup token was returned. Remove and re-add it to get one.`)});let i=rp(me,e.id,r,t);return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(ap,{label:$(`cloud_print.poll_url`,`Poll URL`),help:$(`cloud_print.poll_url_help`,`paste into the printer's "server URL"`),value:i,copyValue:i,valueTestId:`wizard-poll-url`,copyTestId:`wizard-copy-url`}),t&&(0,_.jsx)(op,{}),t&&(0,_.jsx)(sp,{url:rp(me,e.id,r),copyable:!0})]})})()]}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(`div`,{children:(0,_.jsx)(J,{variant:`success`,icon:`✓`,children:$(`cloud_print.linked_provider`,`Linked to {provider}`,{provider:Xf[me].label})})}),(0,_.jsx)(`p`,{className:`wcpos:text-sm wcpos:text-gray-700`,children:me===`star-online`?$(`cloud_print.star_online_delivery`,`No URLs or tokens to copy — Star Online handles delivery.`):$(`cloud_print.printnode_delivery`,`No URLs or tokens to copy — PrintNode handles delivery.`)})]})}),(0,_.jsxs)(`div`,{className:`wcpos:flex wcpos:justify-end wcpos:gap-2 wcpos:pt-2`,children:[l===1&&(0,_.jsx)(U,{variant:`secondary`,"data-testid":`wizard-back`,onClick:()=>u(0),children:$(`common.back`,`Back`)}),l===0&&(0,_.jsx)(U,{variant:`primary`,"data-testid":`wizard-continue`,disabled:!d,onClick:()=>u(1),children:$(`common.continue`,`Continue`)}),l===1&&(0,_.jsx)(U,{variant:`primary`,"data-testid":`wizard-continue`,disabled:!ue,loading:S,onClick:de,children:$(`common.continue`,`Continue`)}),l===2&&(0,_.jsx)(U,{variant:`primary`,"data-testid":`wizard-done`,onClick:()=>i(),children:$(`common.done`,`Done`)})]})]})})}function lp(e){return e.store_id&&e.store_id>0?`store:${e.store_id}`:e.scope}function up(e,t){let n=[{value:`every`,label:$(`cloud_print.scope_every`,`every order`)},{value:`pos`,label:$(`cloud_print.scope_pos`,`every in-store (POS) order`)},{value:`online`,label:$(`cloud_print.scope_online`,`every online order`)}],r=e.map(e=>({value:`store:${e.id}`,label:$(`cloud_print.scope_store`,`orders for {name}`,{name:e.name})}));return t.store_id&&t.store_id>0&&!e.some(e=>e.id===t.store_id)&&r.push({value:`store:${t.store_id}`,label:$(`cloud_print.scope_store_unknown`,`Unknown store (#{id})`,{id:t.store_id}),disabled:!0}),[...n,...r]}function dp(e,t){let n=e.map(({value:e,label:t})=>({value:e,label:t}));return n.some(e=>e.value===t)?n:[{value:t,label:t===``?$(`cloud_print.rule_template_none`,`Choose a template…`):$(`cloud_print.rule_template_unsupported`,`Unsupported template (#{id})`,{id:t}),disabled:!0},...n]}function fp(e){if(e.startsWith(`store:`)){let t=Number.parseInt(e.slice(6),10);return{store_id:Number.isFinite(t)?t:0,scope:`every`}}return{store_id:0,scope:e}}var pp=`edit.php?post_type=wcpos_template`;function mp(e,t){return e.find(e=>String(e.value)===String(t))?.label.length??0}function hp(e,t){return{width:`calc(${Math.max(mp(e,t),1)}ch + 3.5rem)`}}function gp({printers:e,assignments:t,templateOptions:n,storeOptions:r=[],onChange:i}){let a=e.map(e=>({value:e.id,label:e.name})),o=Array.from({length:5},(e,t)=>{let n=t+1;return{value:n,label:$(`cloud_print.rule_copies`,{count:n})}}),s=[{value:`paid`,label:$(`cloud_print.trigger_paid`,`once it's paid`)},{value:`created`,label:$(`cloud_print.trigger_created`,`as soon as it's created`)}],c=t=>e.find(e=>e.id===t)?.provider??`printnode`,l=e=>Zf(n,c(e)),u=(e,n)=>{i(t.map((t,r)=>r===e?{...t,...n}:t))},d=(e,t)=>{let n=l(t);return n.some(t=>t.value===e.template_id)?{printer_id:t}:{printer_id:t,template_id:n[0]?.value??``}},f=()=>{let n=e[0];if(!n)return;let r=l(n.id);i([...t,{printer_id:n.id,store_id:0,scope:`every`,template_id:r[0]?.value??``,copies:1,trigger:`paid`}])},p=e=>i(t.filter((t,n)=>n!==e));return(0,_.jsxs)(`div`,{className:`wcpos:mt-4 wcpos:flex wcpos:flex-col wcpos:gap-3`,children:[(0,_.jsxs)(Co,{status:`info`,children:[`💡`,` `,$(`cloud_print.rules_tip`,`This is optional — leave it empty to print receipts only manually from the POS.`)]}),(0,_.jsxs)(`p`,{className:`wcpos:text-sm wcpos:text-gray-500`,children:[$(`cloud_print.rules_subline_pre`,`Each rule prints the chosen template automatically when an order matches. Templates come from `),(0,_.jsx)(`a`,{href:pp,target:`_blank`,rel:`noreferrer`,children:$(`cloud_print.templates_link`,`POS › Templates`)}),$(`cloud_print.rules_subline_post`,`. More than one rule can run for the same order.`)]}),t.length===0?(0,_.jsx)(`p`,{"data-testid":`rules-empty`,className:`wcpos:text-sm wcpos:text-gray-500`,children:$(`cloud_print.no_rules`,`No rules yet.`)}):(0,_.jsx)(`div`,{className:`wcpos:flex wcpos:flex-col wcpos:gap-2`,children:t.map((e,t)=>{let n=up(r,e),i=lp(e);return(0,_.jsxs)(`div`,{"data-testid":`rule-${t}`,className:`wcpos:flex wcpos:flex-wrap wcpos:items-center wcpos:gap-x-1.5 wcpos:gap-y-1 wcpos:text-sm`,children:[(0,_.jsx)(`span`,{children:$(`cloud_print.rule_print`,`Automatically print`)}),(0,_.jsx)(G,{inline:!0,"data-testid":`rule-scope-${t}`,"aria-label":$(`cloud_print.rule_scope_label`,`Which orders to print`),className:`wcpos:max-w-full`,style:hp(n,i),value:i,options:n,onChange:({value:e})=>u(t,fp(String(e)))}),(0,_.jsx)(`span`,{children:$(`cloud_print.rule_to`,`to`)}),(0,_.jsx)(G,{inline:!0,"data-testid":`rule-printer-${t}`,"aria-label":$(`cloud_print.rule_printer_label`,`Printer`),className:`wcpos:max-w-full`,style:hp(a,e.printer_id),value:e.printer_id,options:a,onChange:({value:n})=>u(t,d(e,String(n)))}),(0,_.jsx)(`span`,{children:$(`cloud_print.rule_using`,`using the`)}),(0,_.jsx)(G,{inline:!0,"data-testid":`rule-template-${t}`,"aria-label":$(`cloud_print.rule_template_label`,`Receipt template`),className:`wcpos:max-w-full`,style:hp(dp(l(e.printer_id),e.template_id),e.template_id),value:e.template_id,options:dp(l(e.printer_id),e.template_id),onChange:({value:e})=>u(t,{template_id:String(e)})}),(0,_.jsx)(`span`,{children:$(`cloud_print.rule_template_suffix`,`template,`)}),(0,_.jsx)(G,{inline:!0,"data-testid":`rule-copies-${t}`,"aria-label":$(`cloud_print.rule_copies_label`,`Number of copies`),className:`wcpos:max-w-full`,style:hp(o,e.copies??1),value:e.copies??1,options:o,onChange:({value:e})=>u(t,{copies:Number(e)})}),(0,_.jsx)(`span`,{children:$(`cloud_print.rule_trigger_join`,`,`)}),(0,_.jsx)(G,{inline:!0,"data-testid":`rule-trigger-${t}`,"aria-label":$(`cloud_print.rule_trigger_label`,`When to print`),className:`wcpos:max-w-full`,style:hp(s,e.trigger??`paid`),value:e.trigger??`paid`,options:s,onChange:({value:e})=>u(t,{trigger:e===`created`?`created`:`paid`})}),(0,_.jsx)(`span`,{children:$(`cloud_print.rule_copies_suffix`,`.`)}),(0,_.jsx)(U,{variant:`ghost-destructive`,"data-testid":`rule-remove-${t}`,className:`wcpos:ml-1`,onClick:()=>p(t),children:$(`common.remove`,`Remove`)})]},t)})}),(0,_.jsx)(`div`,{children:(0,_.jsx)(U,{variant:`outline`,"data-testid":`rules-add`,disabled:e.length===0,onClick:f,children:$(`cloud_print.add_rule`,`+ Add rule`)})})]})}async function _p(e,t=i.default){return(await t({path:`wcpos/v1/printnode/printers?wcpos=1`,method:`POST`,data:{api_key:e}})).printers??[]}async function vp(e,t,n=i.default){return(await n({path:`wcpos/v1/star-online/devices?wcpos=1`,method:`POST`,data:{cloudprnt_url:e,api_key:t}})).devices??[]}var yp=`wcpos/v1/templates?wcpos=1&type=receipt`;function bp(e=!1){let{data:t}=nt({queryKey:[`templates`,`receipt`],queryFn:()=>(0,i.default)({path:yp,method:`GET`})});return t.filter(t=>t.status===`publish`||t.is_active===!0||e&&t.is_virtual===!0).map(e=>({value:String(e.id),label:e.title,engine:e.engine}))}function xp(){let{data:t}=tt({queryKey:[`templates`,`receipt`],queryFn:()=>(0,i.default)({path:yp,method:`GET`})});return(0,e.useMemo)(()=>new Map((Array.isArray(t)?t:[]).map(e=>[String(e.id),e.title])),[t])}var Sp=`wcpos/v1/print-jobs/queue`,Cp=`print-queue`,wp=20,Tp=3e4,Ep=600,Dp={pending:{label:()=>$(`cloud_print.queue_status_waiting`,`Waiting`),variant:`warning`},claimed:{label:()=>$(`cloud_print.queue_status_printing`,`Printing`),variant:`info`},printed:{label:()=>$(`cloud_print.queue_status_printed`,`Printed`),variant:`success`},failed:{label:()=>$(`cloud_print.queue_status_failed`,`Failed`),variant:`error`},cancelled:{label:()=>$(`cloud_print.queue_status_cancelled`,`Cancelled`),variant:`neutral`}};function Op(e){if(!e||e.startsWith(`0000`))return null;let t=new Date(`${e.replace(` `,`T`)}Z`);return Number.isNaN(t.getTime())?null:t}function kp(e){let t=Math.max(0,Math.round((Date.now()-e.getTime())/1e3)),n=new Intl.RelativeTimeFormat(void 0,{numeric:`auto`});return t<60?n.format(-t,`second`):t<3600?n.format(-Math.round(t/60),`minute`):t<86400?n.format(-Math.round(t/3600),`hour`):n.format(-Math.round(t/86400),`day`)}function Ap(e){let t=Op(e);return t?kp(t):`—`}function jp(e){return e.polling===!1||e.pending===0?!1:e.last_seen===0||Date.now()/1e3-e.last_seen>Ep}function Mp(){let t=y(),n=xp(),[r,a]=e.useState(``),[o,s]=e.useState(``),[c,l]=e.useState(1),[u,d]=e.useState(new Set),{data:f}=tt({queryKey:[Cp,r,o,c],queryFn:()=>(0,i.default)({path:`${Sp}?wcpos=1&per_page=${wp}&page=${c}${r?`&printer_id=${encodeURIComponent(r)}`:``}${o?`&status=${encodeURIComponent(o)}`:``}`,method:`GET`}),refetchInterval:Tp}),{addSnackbar:p}=Bo(),m=()=>{d(new Set),t.invalidateQueries({queryKey:[Cp]})},h=()=>{p({message:$(`cloud_print.queue_action_failed`,`That didn't work — the queue is unchanged. Try again.`),status:`error`})},g=rt({mutationFn:e=>(0,i.default)({path:`${Sp}/cancel?wcpos=1`,method:`POST`,data:e}),onSuccess:m,onError:h}),v=rt({mutationFn:e=>(0,i.default)({path:`${Sp}/delete?wcpos=1`,method:`POST`,data:{ids:e}}),onSuccess:m,onError:h}),b=rt({mutationFn:e=>(0,i.default)({path:`wcpos/v1/print-jobs/${e}/reprint?wcpos=1`,method:`POST`}),onSuccess:m,onError:(e,n)=>{let r=e,i=r.data?.retried_to;if(r.code!==`wcpos_print_job_already_retried`||!i){h();return}d(new Set),t.setQueriesData({queryKey:[Cp]},e=>{if(!e)return e;let t=e.jobs.some(e=>e.id===n&&!e.retried_to);return{...e,jobs:e.jobs.map(e=>e.id===n?{...e,retried_to:i}:e),summary:{...e.summary,counts:{...e.summary.counts,failed_unresolved:Math.max(0,(e.summary.counts.failed_unresolved??e.summary.counts.failed??0)-+!!t)}}}}),t.invalidateQueries({queryKey:[Cp]}),p({message:$(`cloud_print.queue_retried_as`,`Retried as #{id}`,{id:String(i)}),status:`success`})}}),x=f?.total;if(e.useEffect(()=>{if(typeof x!=`number`)return;let e=Math.max(1,Math.ceil(x/wp));c>e&&l(e)},[x,c]),!f||!Array.isArray(f.jobs)||!f.summary)return null;let{jobs:S,total:C,summary:w}=f,T=new Map(w.printers.map(e=>[e.printer_id,e.name])),E=w.printers.filter(jp),D=w.counts,O=Object.values(D).some(e=>e>0)||C>0,k=S.map(e=>e.id),A=k.length>0&&k.every(e=>u.has(e)),j=()=>{d(A?new Set:new Set(k))},M=e=>{let t=new Set(u);t.has(e)?t.delete(e):t.add(e),d(t)},N=S.filter(e=>u.has(e.id)&&(e.status===`pending`||e.status===`claimed`)).map(e=>e.id),P=Math.max(1,Math.ceil(C/wp)),F=(D.pending??0)+(D.claimed??0)+(D.failed_unresolved??D.failed??0),ee=[{label:$(`cloud_print.queue_status_active`,`Needs attention ({count})`,{count:String(F)}),value:`active`},{label:$(`cloud_print.queue_all_statuses`,`All statuses`),value:``},...[`pending`,`claimed`,`failed`,`printed`,`cancelled`].map(e=>({label:`${Dp[e].label()} (${D[e]??0})`,value:e}))],I=[{label:$(`cloud_print.queue_all_printers`,`All printers`),value:``},...w.printers.map(e=>({label:e.name,value:e.printer_id}))];return(0,_.jsxs)(wo,{title:$(`cloud_print.queue_title`,`Print queue`),description:$(`cloud_print.queue_description`,`Jobs across every status, including printed and cancelled.`),children:[E.map(e=>(0,_.jsx)(bo,{status:`warning`,isDismissible:!1,children:(0,_.jsxs)(`div`,{className:`wcpos:flex wcpos:items-center wcpos:gap-3 wcpos:flex-wrap`,"data-testid":`queue-stale-${e.printer_id}`,children:[(0,_.jsx)(`span`,{children:e.last_seen===0?$(`cloud_print.queue_stale_never`,`{printer} has never fetched a job. {count} receipts are waiting — check the printer is on and its Server URL is set.`,{printer:e.name,count:String(e.pending)}):$(`cloud_print.queue_stale`,`{printer} last fetched jobs {ago}. {count} receipts are waiting — check the printer is on and connected.`,{printer:e.name,ago:kp(new Date(e.last_seen*1e3)),count:String(e.pending)})}),(0,_.jsx)(U,{variant:`ghost-destructive`,"data-testid":`queue-cancel-all-${e.printer_id}`,onClick:()=>g.mutate({printer_id:e.printer_id}),disabled:g.isPending,children:$(`cloud_print.queue_cancel_all`,`Cancel all {count}`,{count:String(e.pending)})})]})},e.printer_id)),O?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(`div`,{className:`wcpos:flex wcpos:items-center wcpos:gap-2 wcpos:flex-wrap wcpos:mb-3`,children:[(0,_.jsx)(G,{id:`wcpos-queue-printer-filter`,inline:!0,className:`wcpos:w-44 wcpos:max-w-full`,"aria-label":$(`cloud_print.queue_filter_printer`,`Filter by printer`),options:I,value:r,onChange:e=>{a(String(e.value)),l(1),d(new Set)}}),(0,_.jsx)(G,{id:`wcpos-queue-status-filter`,inline:!0,className:`wcpos:w-52 wcpos:max-w-full`,"aria-label":$(`cloud_print.queue_filter_status`,`Filter by status`),options:ee,value:o,onChange:e=>{s(String(e.value)),l(1),d(new Set)}}),(0,_.jsx)(`div`,{className:`wcpos:flex-1`}),N.length>0&&(0,_.jsx)(U,{variant:`ghost-destructive`,"data-testid":`queue-cancel-selected`,onClick:()=>g.mutate({ids:N}),disabled:g.isPending,children:$(`cloud_print.queue_cancel_selected`,`Cancel selected ({count})`,{count:String(N.length)})}),u.size>0&&(0,_.jsx)(U,{variant:`ghost-destructive`,"data-testid":`queue-delete-selected`,onClick:()=>v.mutate(Array.from(u)),disabled:v.isPending,children:$(`cloud_print.queue_delete_selected`,`Delete selected ({count})`,{count:String(u.size)})})]}),S.length===0?(0,_.jsx)(`p`,{className:`wcpos:text-sm wcpos:text-gray-500`,"data-testid":`queue-no-matches`,children:$(`cloud_print.queue_no_matches`,`No jobs match this filter.`)}):(0,_.jsx)(`div`,{className:`wcpos:overflow-x-auto`,children:(0,_.jsxs)(Vo,{"data-testid":`queue-table`,className:`wcpos:min-w-[52rem]`,children:[(0,_.jsx)(Ho,{children:(0,_.jsxs)(Wo,{children:[(0,_.jsx)(Y,{className:`wcpos:w-8`,children:(0,_.jsx)(`input`,{type:`checkbox`,checked:A,onChange:j,"aria-label":$(`cloud_print.queue_select_all`,`Select all on this page`),"data-testid":`queue-select-all`})}),(0,_.jsx)(Y,{className:`wcpos:w-28`,children:$(`cloud_print.queue_col_order`,`Order`)}),(0,_.jsx)(Y,{children:$(`cloud_print.queue_col_printer`,`Printer`)}),(0,_.jsx)(Y,{children:$(`cloud_print.queue_col_template`,`Template`)}),(0,_.jsx)(Y,{className:`wcpos:w-28`,children:$(`cloud_print.queue_col_status`,`Status`)}),(0,_.jsx)(Y,{children:$(`cloud_print.queue_col_detail`,`Detail`)}),(0,_.jsx)(Y,{className:`wcpos:w-32`,children:$(`cloud_print.queue_col_created`,`Created`)}),(0,_.jsx)(Y,{className:`wcpos:w-24`})]})}),(0,_.jsx)(Uo,{children:S.map(e=>{let t=Dp[e.status]??Dp.pending,r=Ap(e.created_gmt),i=e.terminal_at?kp(new Date(e.terminal_at*1e3)):``;return(0,_.jsxs)(Go,{"data-testid":`queue-row-${e.id}`,children:[(0,_.jsx)(X,{children:(0,_.jsx)(`input`,{type:`checkbox`,checked:u.has(e.id),onChange:()=>M(e.id),"aria-label":$(`cloud_print.queue_select_job`,`Select job {id}`,{id:String(e.id)})})}),(0,_.jsx)(X,{children:e.order_edit_url?(0,_.jsxs)(`a`,{href:e.order_edit_url,target:`_blank`,rel:`noopener noreferrer`,children:[`#`,e.order_number??e.order_id]}):(0,_.jsx)(`span`,{className:`wcpos:text-gray-500`,children:$(`cloud_print.queue_no_order`,`Job {id}`,{id:String(e.id)})})}),(0,_.jsx)(X,{children:T.get(e.printer_id)??e.printer_id}),(0,_.jsx)(X,{className:`wcpos:text-gray-600`,children:n.get(e.template_id)??(e.template_id||`—`)}),(0,_.jsx)(X,{children:(0,_.jsx)(J,{variant:t.variant,shape:`pill`,size:`sm`,children:t.label()})}),(0,_.jsx)(X,{className:`wcpos:text-gray-600`,children:e.status===`failed`&&e.unconfirmed?(0,_.jsx)(`span`,{className:`wcpos:text-red-700`,"data-testid":`queue-error-${e.id}`,children:e.retried_to?$(`cloud_print.queue_unconfirmed_retried`,`The printer never confirmed this job.`):$(`cloud_print.queue_unconfirmed`,`The printer never confirmed this job. It was not re-sent automatically, which could print it twice — retry it if it did not print.`)}):e.status===`failed`&&e.error?(0,_.jsx)(`span`,{className:`wcpos:text-red-700`,"data-testid":`queue-error-${e.id}`,children:e.error}):e.status===`printed`&&i?$(`cloud_print.queue_printed_ago`,`Printed {ago}`,{ago:i}):`—`}),(0,_.jsx)(X,{className:`wcpos:tabular-nums wcpos:text-gray-600`,children:r}),(0,_.jsxs)(X,{className:`wcpos:text-right`,children:[(e.status===`pending`||e.status===`claimed`)&&(0,_.jsx)(U,{variant:`ghost-destructive`,onClick:()=>g.mutate({ids:[e.id]}),disabled:g.isPending,"data-testid":`queue-cancel-${e.id}`,children:$(`cloud_print.queue_cancel`,`Cancel`)}),e.status===`failed`&&e.retried_to?$(`cloud_print.queue_retried_as`,`Retried as #{id}`,{id:String(e.retried_to)}):e.status===`failed`?(0,_.jsx)(U,{variant:`text`,onClick:()=>b.mutate(e.id),disabled:b.isPending,"data-testid":`queue-retry-${e.id}`,children:$(`cloud_print.queue_retry`,`Retry`)}):null,(0,_.jsx)(U,{variant:`text`,onClick:()=>v.mutate([e.id]),disabled:v.isPending,"data-testid":`queue-delete-${e.id}`,"aria-label":$(`cloud_print.queue_delete_job`,`Delete job {id}`,{id:String(e.id)}),children:$(`cloud_print.queue_delete`,`Delete`)})]})]},e.id)})})]})}),P>1&&(0,_.jsxs)(`div`,{className:`wcpos:flex wcpos:items-center wcpos:justify-end wcpos:gap-3 wcpos:text-sm wcpos:text-gray-600`,children:[(0,_.jsx)(`span`,{"data-testid":`queue-page-info`,children:$(`cloud_print.queue_page_info`,`{from}–{to} of {total}`,{from:String((c-1)*wp+1),to:String(Math.min(c*wp,C)),total:String(C)})}),(0,_.jsx)(U,{variant:`outline`,onClick:()=>l(e=>Math.max(1,e-1)),disabled:c<=1,"aria-label":$(`common.previous`,`Previous`),children:`‹`}),(0,_.jsx)(U,{variant:`outline`,onClick:()=>l(e=>Math.min(P,e+1)),disabled:c>=P,"aria-label":$(`common.next`,`Next`),children:`›`})]})]}):(0,_.jsx)(`p`,{className:`wcpos:text-sm wcpos:text-gray-500`,"data-testid":`queue-empty`,children:$(`cloud_print.queue_empty`,`No print jobs yet.`)})]})}var Np=`wcpos/v1/settings/cloud-print?wcpos=1`,Pp=3e4;function Fp(e,t){if(!t)switch(e){case`online`:return{variant:`success`,label:$(`cloud_print.status_online`,`Online`)};case`offline`:return{variant:`error`,label:$(`cloud_print.status_offline`,`Offline`)};default:return{variant:`info`,label:$(`cloud_print.status_unknown`,`Unknown`)}}switch(e){case`connected`:return{variant:`success`,label:$(`cloud_print.status_connected`,`Connected`)};case`waiting`:return{variant:`warning`,label:$(`cloud_print.status_waiting`,`Waiting for printer`)};case`blocked`:return{variant:`error`,label:$(`cloud_print.status_blocked`,`Blocked`)};default:return{variant:`error`,label:$(`cloud_print.status_offline`,`Offline`)}}}async function Ip(){return await(0,i.default)({path:Np,method:`GET`})}var Lp=new Set,Rp,zp=!1;async function Bp(){if(!zp){zp=!0;try{let e=await Ip();Lp.forEach(t=>t(e))}catch{}finally{zp=!1}}}function Vp(e){return Lp.add(e),Rp===void 0&&(Rp=window.setInterval(()=>{Bp()},Pp)),()=>{Lp.delete(e),Lp.size===0&&Rp!==void 0&&(window.clearInterval(Rp),Rp=void 0)}}function Hp(t){let[n,r]=e.useState({status:t.status,statusDetail:t.status_detail}),[i,a]=e.useState({status:t.status,statusDetail:t.status_detail});if(t.status!==i.status||t.status_detail!==i.statusDetail){let e={status:t.status,statusDetail:t.status_detail};a(e),r(e)}return e.useEffect(()=>Vp(e=>{let n=e.printers.find(e=>e.id===t.id);r({status:n?.status,statusDetail:n?.status_detail})}),[t.id]),n}function Up({printer:e}){let t=Xf[e.provider],{status:n}=Hp(e),r=Fp(n,t.isPolling);return(0,_.jsx)(J,{variant:r.variant,shape:`pill`,size:`sm`,"data-testid":`printer-card-status-${e.id}`,children:r.label})}function Wp({label:e,testId:t}){return(0,_.jsx)(`span`,{className:`wcpos:inline-flex wcpos:items-center wcpos:justify-center wcpos:w-7 wcpos:h-7 wcpos:rounded-md wcpos:text-gray-500 wcpos:hover:bg-gray-100 wcpos:hover:text-gray-700 wcpos:cursor-pointer`,"data-testid":t,"aria-label":e,children:(0,_.jsx)(Vf,{className:`wcpos:w-4 wcpos:h-4 wcpos:fill-current`})})}function Gp({open:e,title:t,description:n,confirmLabel:r,cancelLabel:i,isSubmitting:a=!1,onConfirm:o,onClose:s}){return(0,_.jsx)(lo,{open:e,onClose:s,title:t,description:n,children:(0,_.jsxs)(`div`,{className:`wcpos:mt-4 wcpos:flex wcpos:justify-end wcpos:gap-2`,children:[(0,_.jsx)(U,{variant:`secondary`,onClick:()=>{s(!1)},disabled:a,children:i||$(`sessions.cancel`)}),(0,_.jsx)(U,{variant:`destructive`,onClick:o,disabled:a,children:r||$(`sessions.confirm`)})]})})}function Kp(e){return e&&/^http-5/.test(e)?$(`cloud_print.blocked_site_error`,`WCPOS Cloud Print reached your site, but the site responded with a server error. Check your site health and error logs.`):$(`cloud_print.blocked_security`,`A security service (like Cloudflare or a firewall plugin) is blocking WCPOS Cloud Print, so receipts can't reach this printer. Allowlist the relay to restore printing — see wcpos.com/cloudprint.`)}function qp(){return[{value:`pdf`,label:$(`cloud_print.format_pdf`,`PDF (recommended)`)},{value:`raw`,label:$(`cloud_print.format_raw`,`ESC/POS RAW — thermal templates only`)}]}var Jp=[[`year`,31536e3],[`month`,2592e3],[`day`,86400],[`hour`,3600],[`minute`,60],[`second`,1]];function Yp(e,t){let n=Math.round(e-Date.now()/1e3),r=t?t.replace(/_/g,`-`):void 0,i;try{i=new Intl.RelativeTimeFormat(r,{numeric:`auto`})}catch{i=new Intl.RelativeTimeFormat(void 0,{numeric:`auto`})}let a=Math.abs(n);for(let[e,t]of Jp)if(a>=t||e===`second`){let r=Math.round(n/t);return i.format(r,e)}return i.format(0,`second`)}function Xp(e){if(!e)return``;try{let t=new URL(e).pathname.match(/\/cloudprnt\/([^/]+)/);return t?decodeURIComponent(t[1]):``}catch{return``}}function Zp({printer:t,onRename:n,onRemove:r,onOpenSetup:a,onUpdate:o}){let{addSnackbar:s}=Bo(),c=Xf[t.provider],{status:l,statusDetail:u}=Hp(t),d=t.provider===`printnode`,f=t.provider===`star-online`,p=t.printnode_format??`pdf`,[m,h]=e.useState(t.name),[g,v]=e.useState(!1),[y,b]=e.useState(!1),x=e.useRef(t.name),[S,C]=e.useState(t.name);t.name!==S&&(C(t.name),h(t.name)),e.useEffect(()=>{x.current=t.name},[t.name]);let w=e.useCallback(()=>{let e=m.trim();if(!e){h(t.name);return}e!==t.name&&e!==x.current&&(x.current=e,n(t.id,e))},[m,n,t.id,t.name]),T=e.useCallback(async()=>{v(!0);try{await(0,i.default)({path:`wcpos/v1/print-jobs/test?wcpos=1`,method:`POST`,data:{printer_id:t.id}}),s({message:$(`cloud_print.test_sent`,`Sent a test print to {name}.`,{name:t.name}),status:`success`})}catch(e){let t=typeof e==`object`&&e&&`message`in e&&typeof e.message==`string`?e.message:$(`cloud_print.test_failed`,`Test print failed.`);s({message:t,status:`error`})}finally{v(!1)}},[s,t.id,t.name]),E=t.last_seen==null?$(`cloud_print.never`,`never`):Yp(t.last_seen,Ul.language||void 0);return(0,_.jsxs)(ho,{"data-testid":`printer-card-${t.id}`,children:[(0,_.jsxs)(ho.Body,{className:`wcpos:relative`,children:[(0,_.jsxs)(`div`,{className:`wcpos:flex wcpos:items-start wcpos:gap-3`,children:[(0,_.jsx)(`span`,{className:c.badge.className+` wcpos:flex wcpos:size-8 wcpos:shrink-0 wcpos:items-center wcpos:justify-center wcpos:rounded wcpos:text-sm wcpos:font-semibold`,"aria-hidden":`true`,children:c.badge.mark}),(0,_.jsxs)(`div`,{className:`wcpos:min-w-0 wcpos:flex-1`,children:[(0,_.jsx)(`input`,{type:`text`,"data-testid":`printer-card-name-${t.id}`,value:m,onChange:e=>h(e.target.value),onBlur:w,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),e.target.blur(),w())},"aria-label":$(`cloud_print.printer_name`,`Printer name`),className:`wcpos:w-full wcpos:rounded wcpos:border wcpos:border-transparent wcpos:bg-transparent wcpos:px-1 wcpos:py-0.5 wcpos:pr-8 wcpos:text-sm wcpos:font-semibold wcpos:text-gray-900 wcpos:hover:border-gray-300 wcpos:focus:border-wp-admin-theme-color wcpos:focus:bg-white wcpos:focus:outline-none`}),(0,_.jsx)(`div`,{className:`wcpos:px-1 wcpos:text-xs wcpos:text-gray-500`,children:c.label})]}),(0,_.jsxs)(po,{align:`end`,label:$(`cloud_print.printer_menu`,`Printer actions`),className:`wcpos:absolute wcpos:top-2 wcpos:right-2`,trigger:(0,_.jsx)(Wp,{label:$(`cloud_print.printer_menu`,`Printer actions`),testId:`printer-card-menu-${t.id}`}),children:[(0,_.jsx)(mo,{onSelect:()=>a(t),children:$(`cloud_print.menu_setup`,`Setup & token`)}),(0,_.jsx)(mo,{destructive:!0,onSelect:()=>b(!0),children:$(`cloud_print.menu_remove`,`Remove printer`)})]})]}),(0,_.jsx)(`div`,{className:`wcpos:mt-2`,children:(0,_.jsx)(Up,{printer:t})}),l===`blocked`&&(0,_.jsx)(`p`,{"data-testid":`printer-card-blocked-${t.id}`,className:`wcpos:mt-2 wcpos:rounded wcpos:bg-red-50 wcpos:px-2 wcpos:py-1 wcpos:text-xs wcpos:text-red-700`,children:Kp(u)}),(0,_.jsxs)(`dl`,{className:`wcpos:mt-3 wcpos:grid wcpos:grid-cols-[auto_1fr] wcpos:gap-x-3 wcpos:gap-y-1 wcpos:text-xs`,children:[(0,_.jsx)(`dt`,{className:`wcpos:text-gray-500`,children:$(`cloud_print.last_check_in`,`Last check-in`)}),(0,_.jsx)(`dd`,{className:`wcpos:text-gray-900`,"data-testid":`printer-card-last-seen-${t.id}`,children:E}),(0,_.jsx)(`dt`,{className:`wcpos:text-gray-500`,children:$(`cloud_print.printer_id`,`Printer ID`)}),(0,_.jsxs)(`dd`,{className:`wcpos:flex wcpos:items-center wcpos:gap-1 wcpos:text-gray-900`,children:[(0,_.jsx)(`code`,{className:`wcpos:rounded wcpos:bg-gray-100 wcpos:px-1 wcpos:py-0.5`,children:t.id}),(0,_.jsx)(uo,{text:$(`cloud_print.printer_id_tooltip`,`The printer's address in its setup URL. Created automatically and can't be changed — to rename, edit the name above; to change the ID, remove and re-add the printer.`),children:(0,_.jsx)(`span`,{"data-testid":`printer-card-id-info-${t.id}`,className:`wcpos:cursor-help wcpos:text-gray-400`,"aria-label":$(`cloud_print.printer_id`,`Printer ID`),children:`ⓘ`})})]}),f&&(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(`dt`,{className:`wcpos:text-gray-500`,children:$(`cloud_print.star_device`,`Device`)}),(0,_.jsx)(`dd`,{className:`wcpos:text-gray-900`,"data-testid":`printer-card-star-device-${t.id}`,children:t.star_client_type||Xf[`star-online`].label}),(0,_.jsx)(`dt`,{className:`wcpos:text-gray-500`,children:$(`cloud_print.star_group`,`Group`)}),(0,_.jsx)(`dd`,{className:`wcpos:text-gray-900`,"data-testid":`printer-card-star-group-${t.id}`,children:Xp(t.star_cloudprnt_url)||`—`}),(0,_.jsx)(`dt`,{className:`wcpos:text-gray-500`,children:$(`cloud_print.star_device_id`,`AccessIdentifier`)}),(0,_.jsx)(`dd`,{className:`wcpos:text-gray-900`,"data-testid":`printer-card-star-device-id-${t.id}`,children:(0,_.jsx)(`code`,{className:`wcpos:rounded wcpos:bg-gray-100 wcpos:px-1 wcpos:py-0.5`,children:t.star_device_id})})]}),d&&(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(`dt`,{className:`wcpos:text-gray-500`,children:$(`cloud_print.format`,`Print format`)}),(0,_.jsx)(`dd`,{className:`wcpos:text-gray-900`,children:(0,_.jsx)(G,{"data-testid":`printer-card-format-${t.id}`,"aria-label":$(`cloud_print.format`,`Print format`),className:`wcpos:w-auto`,value:p,options:qp(),onChange:({value:e})=>o(t.id,{printnode_format:e})})})]})]})]}),(0,_.jsx)(ho.Footer,{className:`wcpos:flex wcpos:justify-end`,children:(0,_.jsx)(U,{variant:`outline`,loading:g,disabled:g,onClick:T,"data-testid":`printer-card-test-${t.id}`,children:$(`cloud_print.test_print`,`Test print`)})}),(0,_.jsx)(Gp,{open:y,title:$(`cloud_print.remove_title`,`Remove printer?`),description:$(`cloud_print.remove_body`,`This printer will stop receiving jobs. You can add it again later.`),confirmLabel:$(`common.remove`,`Remove`),cancelLabel:$(`common.cancel`,`Cancel`),onConfirm:()=>{b(!1),r(t)},onClose:()=>b(!1)})]})}function Qp({children:e,className:t=``,...n}){return(0,_.jsx)(`div`,{className:`wcpos:grid wcpos:grid-cols-[repeat(auto-fill,minmax(min(100%,340px),1fr))] wcpos:gap-4 ${t}`,...n,children:e})}var $p=`wcpos/v1/settings/cloud-print?wcpos=1`;function em(){let e=y(),{data:t}=nt({queryKey:[`cloud-print`],queryFn:()=>(0,i.default)({path:$p,method:`GET`})});return{settings:t,save:rt({mutationFn:e=>(0,i.default)({path:$p,method:`POST`,data:e}),onSuccess:t=>e.setQueryData([`cloud-print`],e=>({printers:t.printers,assignments:t.assignments,relay:t.relay??e?.relay}))}).mutateAsync}}var tm=`wcpos/v1/print-jobs/relay/register?wcpos=1`;function nm(){let e=y();return{register:rt({mutationFn:()=>(0,i.default)({path:tm,method:`POST`}),onSuccess:t=>e.setQueryData([`cloud-print`],e=>e&&{...e,relay:t})})}}function rm(e){return e instanceof Error||typeof e==`object`&&e&&`message`in e&&typeof e.message==`string`?e.message:$(`cloud_print.save_failed`,`Save failed.`)}var im=`cloud-print-save`;function am(){let{settings:t,save:n}=em(),{register:r}=nm(),i=bp(),a=window.wcpos?.settings?.cloudPrintStoreOptions,o=Array.isArray(a)?a:[],{addSnackbar:s}=Bo(),[c,l]=e.useState(t),[u,d]=e.useState({open:!1,mode:`add`,printer:null}),f=e.useRef(c),p=e.useRef(t),m=e.useRef(0),h=e.useRef(Promise.resolve()),g=e.useRef(0),v=e.useCallback(e=>{f.current=e,l(e)},[]);e.useEffect(()=>{m.current===0&&(p.current=t,v(t))},[v,t]);let y=e.useCallback(async e=>{let t=g.current+1;g.current=t,m.current+=1,v(e),s({id:im,message:$(`cloud_print.saving`,`Saving…`),status:`saving`});let r=h.current.catch(()=>void 0).then(async()=>await n(e));h.current=r.then(()=>void 0,()=>void 0);try{let e=await r,n={printers:e.printers,assignments:e.assignments};return p.current=n,t===g.current&&v(n),s({id:im,message:$(`cloud_print.saved`,`Saved`),status:`success`}),e}catch(e){let n=rm(e);throw t===g.current&&v(p.current),s({id:im,message:n,status:`error`}),e}finally{--m.current}},[s,v,n]),b=e.useCallback(async e=>{let t=f.current,n=new Set(t.printers.map(e=>e.id)),r={id:``,name:e.name,provider:e.provider,store_id:0,...e.provider===`printnode`?{printnode_api_key:e.printnode_api_key,printnode_printer_id:e.printnode_printer_id,printnode_format:`pdf`}:{},...e.provider===`star-online`?{star_api_key:e.star_api_key,star_cloudprnt_url:e.star_cloudprnt_url,star_device_id:e.star_device_id}:{}},i=await y({...t,printers:[...t.printers,r]}),a=i.printers.find(e=>!n.has(e.id))??i.printers[i.printers.length-1];return{printer:a,token:i.generated?.[a.id]}},[y]),x=e.useCallback((e,t)=>{let n=f.current;y({...n,printers:n.printers.map(n=>n.id===e?{...n,name:t}:n)}).catch(()=>void 0)},[y]),S=e.useCallback((e,t)=>{let n=f.current;y({...n,printers:n.printers.map(n=>n.id===e?{...n,...t}:n)}).catch(()=>void 0)},[y]),C=e.useCallback(e=>{let t=f.current;y({...t,printers:t.printers.filter(t=>t.id!==e.id),assignments:t.assignments.filter(t=>t.printer_id!==e.id)}).catch(()=>void 0)},[y]),w=e.useCallback(e=>{let t=f.current;y({...t,assignments:e}).catch(()=>void 0)},[y]),T=t.relay,E=e.useRef(!1);return e.useEffect(()=>{T&&!T.enabled&&T.available!==!1&&(E.current||(E.current=!0,r.mutate(void 0,{onError:()=>void 0})))},[T,r]),(0,_.jsxs)(`div`,{className:`wcpos:flex wcpos:flex-col wcpos:gap-6 wcpos:px-4 wcpos:pb-5`,children:[(0,_.jsxs)(Co,{status:`info`,title:$(`cloud_print.intro_title`,`What is cloud printing?`),children:[(0,_.jsx)(`p`,{children:$(`cloud_print.intro_p1`,`Cloud printing lets your store send a receipt to a printer over the internet — the printer fetches each job itself, so it doesn't need to be connected to the POS device.`)}),(0,_.jsx)(`p`,{className:`wcpos:mt-2`,children:$(`cloud_print.intro_p2`,`Use it when a receipt printer is on a different network from the till, or when you want orders to print automatically. For example:`)}),(0,_.jsxs)(`ul`,{className:`wcpos:mt-1 wcpos:list-disc wcpos:pl-5`,children:[(0,_.jsx)(`li`,{children:$(`cloud_print.intro_li1`,`send every order straight to the kitchen printer, or`)}),(0,_.jsx)(`li`,{children:$(`cloud_print.intro_li2`,`print a packing slip for every online sale.`)})]}),(0,_.jsxs)(`p`,{className:`wcpos:mt-2`,children:[$(`cloud_print.intro_p3`,`Cashiers can also print to a cloud printer manually from the POS.`),` `,(0,_.jsxs)(`a`,{href:`https://docs.wcpos.com/receipts/cloud-printing`,target:`_blank`,rel:`noopener noreferrer`,className:`wcpos:inline-flex wcpos:items-center wcpos:gap-1`,children:[(0,_.jsx)(`span`,{className:`wcpos:h-3.5 wcpos:w-3.5`,children:(0,_.jsx)(cu,{fill:`currentColor`})}),$(`cloud_print.learn_more`,`Learn more`),(0,_.jsx)(`span`,{className:`wcpos:sr-only`,children:` (opens in new tab)`})]})]})]}),(0,_.jsxs)(wo,{title:$(`cloud_print.printers`,`Your cloud printers`),description:$(`cloud_print.printers_description`,`Printers that print jobs from this store.`),children:[c.printers.length===0?(0,_.jsx)(`p`,{"data-testid":`cloud-print-empty`,className:`wcpos:text-sm wcpos:text-gray-500`,children:$(`cloud_print.no_printers`,`No cloud printers yet.`)}):(0,_.jsx)(Qp,{"data-testid":`cloud-print-list`,children:c.printers.map(e=>(0,_.jsx)(Zp,{printer:e,onRename:x,onRemove:C,onUpdate:S,onOpenSetup:e=>d({open:!0,mode:`setup`,printer:e})},e.id))}),(0,_.jsx)(`div`,{className:`wcpos:mt-4`,children:(0,_.jsx)(U,{variant:`outline`,"data-testid":`cloud-print-add`,onClick:()=>d({open:!0,mode:`add`,printer:null}),children:$(`cloud_print.add_a_printer`,`+ Add a printer`)})})]}),(0,_.jsx)(wo,{title:$(`cloud_print.auto_print`,`Auto-print rules`),children:(0,_.jsx)(gp,{printers:c.printers,assignments:c.assignments,templateOptions:i,storeOptions:o,onChange:w})}),(0,_.jsx)(Mp,{}),(0,_.jsx)(cp,{open:u.open,mode:u.mode,setupPrinter:u.printer,onClose:()=>d(e=>({...e,open:!1})),onCreate:b,fetchPrintNodePrinters:_p,fetchStarDevices:vp,relay:T})]})}function om(){return(0,_.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:1.5,className:`wcpos:w-12 wcpos:h-12 wcpos:text-gray-400`,children:(0,_.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M14.25 6.087c0-.355.186-.676.401-.959.221-.29.349-.634.349-1.003 0-1.036-1.007-1.875-2.25-1.875s-2.25.84-2.25 1.875c0 .369.128.713.349 1.003.215.283.401.604.401.959V6.75m-1.5 0H5.625c-.621 0-1.125.504-1.125 1.125v3.026a2.999 2.999 0 010 5.198v2.776c0 .621.504 1.125 1.125 1.125h3.026a2.999 2.999 0 015.198 0h2.776c.621 0 1.125-.504 1.125-1.125v-3.026a2.999 2.999 0 010-5.198V7.875c0-.621-.504-1.125-1.125-1.125h-3.026`})})}function sm(e){try{let t=new URL(e).hostname.toLowerCase();return t===`github.com`||t===`www.github.com`}catch{return!1}}function cm(e,t){try{let n=new URL(e),r=n.hostname.toLowerCase();if(r!==`github.com`&&r!==`www.github.com`)return null;let[i,a]=n.pathname.replace(/^\/+|\/+$/g,``).split(`/`);return!i||!a?null:`https://github.com/${i}/${a}/releases/tag/v${encodeURIComponent(t)}`}catch{return null}}function lm({extension:e}){let{homepage:t,installed_version:n,latest_version:r,status:i}=e;if((i===`update_available`||e.has_update)&&n){let e=cm(t,n),i=cm(t,r);return(0,_.jsxs)(`span`,{className:`wcpos:text-xs wcpos:text-gray-400`,children:[e?(0,_.jsxs)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,className:`hover:wcpos:text-gray-600 wcpos:transition-colors`,children:[`v`,n]}):(0,_.jsxs)(_.Fragment,{children:[`v`,n]}),` → `,i?(0,_.jsxs)(`a`,{href:i,target:`_blank`,rel:`noopener noreferrer`,className:`wcpos:text-yellow-700 hover:wcpos:text-yellow-800 wcpos:transition-colors`,children:[`v`,r]}):(0,_.jsxs)(`span`,{className:`wcpos:text-yellow-700`,children:[`v`,r]})]})}let a=n||r,o=cm(t,a);return(0,_.jsx)(`span`,{className:`wcpos:text-xs wcpos:text-gray-400`,children:o?(0,_.jsxs)(`a`,{href:o,target:`_blank`,rel:`noopener noreferrer`,className:`hover:wcpos:text-gray-600 wcpos:transition-colors`,children:[`v`,a]}):(0,_.jsxs)(_.Fragment,{children:[`v`,a]})})}function um({status:e}){switch(e){case`active`:return(0,_.jsx)(J,{variant:`success`,icon:(0,_.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,className:`wcpos:h-3 wcpos:w-3`,"aria-hidden":`true`,focusable:`false`,children:(0,_.jsx)(`path`,{fillRule:`evenodd`,d:`M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z`,clipRule:`evenodd`})}),children:$(`extensions.active`,`Active`)});case`update_available`:return(0,_.jsx)(J,{variant:`warning`,children:$(`extensions.update_available`,`Update available`)});case`inactive`:return(0,_.jsx)(J,{variant:`neutral`,children:$(`extensions.inactive`,`Inactive`)});default:return null}}function dm({extension:e}){return e.status===`not_installed`?(0,_.jsx)(`div`,{className:`wcpos:flex wcpos:items-center wcpos:justify-end`,children:(0,_.jsx)(uo,{text:$(`extensions.requires_pro`,`Requires Pro to install`),children:(0,_.jsx)(`span`,{children:(0,_.jsx)(`button`,{type:`button`,disabled:!0,className:`wcpos:inline-flex wcpos:items-center wcpos:rounded-md wcpos:border wcpos:border-gray-300 wcpos:bg-white wcpos:px-3 wcpos:py-1.5 wcpos:text-xs wcpos:font-medium wcpos:text-gray-700 disabled:wcpos:opacity-60 disabled:wcpos:cursor-not-allowed`,children:$(`extensions.install`,`Install`)})})})}):null}function fm(){return window.wcpos?.settings?.getComponent?.(`extensions.action`)??null}function pm(e){let t=fm();return t?(0,_.jsx)(t,{extension:e}):e.status===`not_installed`?(0,_.jsx)(dm,{extension:e}):null}function mm({extension:e}){let t=(e.category||``).trim(),n=t?t.charAt(0).toUpperCase()+t.slice(1):null,r=pm(e),i=!!e.settings_url&&e.status!==`not_installed`,a=!!e.homepage&&sm(e.homepage),o=i||a;return(0,_.jsxs)(ho,{children:[(0,_.jsxs)(ho.Body,{className:`wcpos:relative wcpos:flex wcpos:gap-4`,children:[o&&(0,_.jsxs)(po,{label:e.name,className:`wcpos:absolute wcpos:top-2 wcpos:right-2`,trigger:(0,_.jsx)(Wp,{label:$(`extensions.more_actions`,`More actions`)}),children:[i&&(0,_.jsx)(mo,{href:e.settings_url,children:$(`extensions.settings`,`Settings`)}),a&&(0,_.jsx)(mo,{href:e.homepage,target:`_blank`,rel:`noopener noreferrer`,children:$(`extensions.view_on_github`,`View on GitHub`)})]}),(0,_.jsx)(`div`,{className:`wcpos:shrink-0 wcpos:flex wcpos:items-start`,children:e.icon?(0,_.jsx)(`img`,{src:e.icon,alt:e.name,className:`wcpos:w-12 wcpos:h-12 wcpos:rounded`}):(0,_.jsx)(om,{})}),(0,_.jsxs)(`div`,{className:`wcpos:flex-1 wcpos:min-w-0`,children:[(0,_.jsx)(`h3`,{className:(0,H.default)(`wcpos:text-sm wcpos:font-semibold wcpos:text-gray-900`,o&&`wcpos:pr-8`),children:e.name}),(0,_.jsxs)(`div`,{className:`wcpos:flex wcpos:flex-wrap wcpos:items-center wcpos:gap-x-1.5 wcpos:gap-y-1 wcpos:mt-1`,children:[(0,_.jsx)(um,{status:e.status}),(0,_.jsx)(lm,{extension:e}),n&&(0,_.jsxs)(`span`,{className:`wcpos:inline-flex wcpos:items-center wcpos:gap-1.5 wcpos:whitespace-nowrap`,children:[(0,_.jsx)(`span`,{className:`wcpos:w-0.5 wcpos:h-0.5 wcpos:rounded-full wcpos:bg-gray-300`}),(0,_.jsx)(`span`,{className:`wcpos:text-xs wcpos:text-gray-500`,children:n})]})]}),(0,_.jsx)(`p`,{className:`wcpos:mt-2 wcpos:text-sm wcpos:text-gray-500`,children:e.description})]})]}),r!=null&&(0,_.jsx)(ho.Footer,{children:r})]})}function hm(){let[t,n]=e.useState(``),[r,a]=e.useState(`all`),[o,s]=e.useState(!1),[c,l]=e.useState(!1),u=y(),{data:d=[]}=nt({queryKey:[`extensions`],queryFn:()=>(0,i.default)({path:`wcpos/v1/extensions?wcpos=1`,method:`GET`})}),f=!!window?.wcpos?.settings?.getComponent?.(`extensions.action`),p=async()=>{s(!0);try{let e=await(0,i.default)({path:`wcpos/v1/extensions?wcpos=1&force=1`,method:`GET`});if(e.length===0)throw Error(`Extension refresh returned no data`);u.setQueryData([`extensions`],e),l(!1)}catch{l(!0)}finally{s(!1)}};e.useEffect(()=>{let e=d.filter(e=>e.status===`update_available`).length;xu(e)},[d]),e.useEffect(()=>{f||eu(`extensions_screen`)},[f]);let m=e.useMemo(()=>{let e=new Set(d.map(e=>e.category||`other`));return[`all`,...Array.from(e).sort()]},[d]),h=e.useMemo(()=>d.filter(e=>{let n=r===`all`||(e.category||`other`)===r,i=t.toLowerCase(),a=!t||e.name.toLowerCase().includes(i)||(e.description||``).toLowerCase().includes(i)||(e.tags||[]).some(e=>e.toLowerCase().includes(i));return n&&a}),[d,r,t]);return(0,_.jsxs)(`div`,{children:[c&&(0,_.jsx)(Kl,{status:`error`,isDismissible:!1,className:`wcpos:mb-4`,children:$(`extensions.refresh_failed`,`Could not refresh extensions. Please try again.`)}),!f&&(0,_.jsxs)(Kl,{status:`info`,isDismissible:!1,className:`wcpos:mb-4`,children:[$(`extensions.upgrade_to_pro`,`Upgrade to Pro to install and manage extensions.`),` `,(0,_.jsx)(`a`,{href:`https://wcpos.com/pro`,onClick:()=>tu(`extensions_screen`,`https://wcpos.com/pro`),children:$(`common.upgrade_to_pro`)}),`.`]}),(0,_.jsxs)(`div`,{className:`wcpos:mb-4 wcpos:flex wcpos:items-center wcpos:gap-3`,children:[(0,_.jsx)(`input`,{type:`text`,placeholder:$(`extensions.search_placeholder`,`Search extensions...`),value:t,onChange:e=>n(e.target.value),className:`wcpos:block wcpos:min-w-0 wcpos:flex-1 wcpos:rounded-md wcpos:border wcpos:border-gray-300 wcpos:px-3 wcpos:py-2 wcpos:text-sm focus:wcpos:outline-none focus:wcpos:ring-2 focus:wcpos:ring-wp-admin-theme-color`}),(0,_.jsx)(U,{variant:`secondary`,loading:o,onClick:p,children:o?$(`extensions.refreshing`,`Refreshing...`):$(`extensions.refresh`,`Refresh`)})]}),(0,_.jsx)(To,{className:`wcpos:mb-6`,items:m.map(e=>({key:e,label:e===`all`?$(`common.all`,`All`):e.charAt(0).toUpperCase()+e.slice(1)})),value:r,onChange:a}),h.length===0?(0,_.jsx)(`p`,{className:`wcpos:text-sm wcpos:text-gray-500`,children:$(`extensions.no_results`,`No extensions found.`)}):(0,_.jsx)(Qp,{children:h.map(e=>(0,_.jsx)(mm,{extension:e},e.slug))})]})}var{i18n:gm,i18nPromise:_m,t:vm,Trans:ym}=Hl({namespace:`wp-admin-consent`,project:`woocommerce-pos`,resources:{en:{"wp-admin-consent":{"consent.modal_title":`Help us make WCPOS better`,"consent.modal_intro_v2":`WCPOS gets better when we can see what's working and what's breaking. If you're happy to, it can send us anonymous usage data and error reports — that's how we find bugs, fix them faster, and decide what to build next.`,"consent.callout_title":`Help us make WCPOS better`,"consent.callout_body_v2":`Can WCPOS send anonymous usage data and error reports so we can fix bugs and improve the product? No personal or customer data is ever included. You can change this any time in POS > Settings > General.`,"consent.allow":`Allow`,"consent.deny":`No thanks`,"consent.learn_more":`Learn what's collected`,"consent.dismiss":`Dismiss`,"consent.dismiss_notice":`Dismiss this notice.`,"consent.save_error":`We couldn't save your choice. Please try again.`,"consent.modal_includes":`Here's what that includes:`,"consent.modal_setup_label":`Your setup`,"consent.modal_setup_desc":`things like your PHP and WooCommerce versions, your country, and your currency, so we know which environments to support and test.`,"consent.modal_store_label":`Your store size`,"consent.modal_store_desc":`roughly how many products, orders, and POS users you have, so we understand the kinds of stores using WCPOS.`,"consent.modal_usage_label":`How you use WCPOS`,"consent.modal_usage_desc":`which screens you open and which features you turn on, so we build what people actually use.`,"consent.modal_errors_label":`When something breaks`,"consent.modal_errors_desc_v2":`what went wrong, in the app or in the WCPOS plugin on your server — the error and the versions involved — so we can spot bugs and ship fixes before you need to write in.`,"consent.modal_exclusions":`We never see customer details, order contents, prices, your site address, or anything that could identify you or your customers. You can change your mind any time.`}}}});function bm(e,t,n){let r=e?.[t];return typeof r==`string`&&r!==``?r:vm(n)}function xm({open:e,onClose:t,copy:n}){return(0,_.jsxs)(lo,{open:e,onClose:t,title:bm(n,`title`,`consent.modal_title`),children:[(0,_.jsx)(`p`,{className:`wcpos:text-sm wcpos:text-gray-700 wcpos:mb-3`,children:bm(n,`body`,`consent.modal_intro_v2`)}),(0,_.jsx)(`p`,{className:`wcpos:text-sm wcpos:text-gray-700 wcpos:mb-2`,children:bm(n,`fields_intro`,`consent.modal_includes`)}),(0,_.jsxs)(`ul`,{className:`wcpos:text-sm wcpos:text-gray-700 wcpos:mb-4 wcpos:pl-4 wcpos:list-disc wcpos:space-y-2`,children:[(0,_.jsxs)(`li`,{children:[(0,_.jsx)(`strong`,{children:vm(`consent.modal_setup_label`)}),` — `,vm(`consent.modal_setup_desc`)]}),(0,_.jsxs)(`li`,{children:[(0,_.jsx)(`strong`,{children:vm(`consent.modal_store_label`)}),` — `,vm(`consent.modal_store_desc`)]}),(0,_.jsxs)(`li`,{children:[(0,_.jsx)(`strong`,{children:vm(`consent.modal_usage_label`)}),` — `,vm(`consent.modal_usage_desc`)]}),(0,_.jsxs)(`li`,{children:[(0,_.jsx)(`strong`,{children:vm(`consent.modal_errors_label`)}),` — `,vm(`consent.modal_errors_desc_v2`)]})]}),(0,_.jsx)(`p`,{className:`wcpos:text-sm wcpos:text-gray-500 wcpos:mb-4`,children:bm(n,`privacy_note`,`consent.modal_exclusions`)}),(0,_.jsx)(`div`,{className:`wcpos:flex wcpos:justify-end`,children:(0,_.jsx)(U,{onClick:t,children:vm(`consent.dismiss`)})})]})}function Sm({selected:t,onSelect:n}){let r=e.useMemo(()=>(window?.wcpos?.settings?.barcodes??[]).map(e=>({value:e,label:e})),[]);return(0,_.jsx)(Yu,{value:t,options:r,onChange:e=>n(e||null),allowCustomValue:!0,createLabel:e=>$(`settings.barcode_field_create`,{value:e}),noResultsLabel:$(`settings.barcode_field_no_results`),"aria-label":$(`settings.barcode_field`)})}var Cm=`https://docs.wcpos.com/support/troubleshooting/cloudflare`;function wm(){let e=window.wcpos?.settings?.environment?.cloudflare;return e?.proxied===!0?(0,_.jsx)(`div`,{"data-testid":`cloudflare-callout`,className:`wcpos:mb-4`,children:(0,_.jsxs)(Co,{status:`info`,title:$(`cloudflare.title`,`Your store is behind Cloudflare`),children:[(0,_.jsx)(`p`,{children:$(`cloudflare.body`,`Cloudflare's security checks (Bot Fight Mode, Under Attack Mode and WAF challenges) can stop the WCPOS app from reaching your store's REST API. If the app reports "This store's hosting setup is blocking the app" (HOST121) or opens a security-check window, the fix is in your Cloudflare dashboard: a WAF Skip rule for /wp-json/, or turning off Bot Fight Mode, which no rule can bypass.`)}),e.plugin_active===!0&&(0,_.jsx)(`p`,{children:$(`cloudflare.plugin_note`,`The Cloudflare WordPress plugin does not manage these rules. They live in the Cloudflare dashboard.`)}),(0,_.jsx)(`a`,{href:Cm,target:`_blank`,rel:`noreferrer`,className:`wcpos:text-wp-admin-theme-color wcpos:underline`,children:$(`cloudflare.docs_link`,`How to add the rule`)})]})}):null}var Tm=`https://wcpos.com/pro`,Em=`general_store_details`,Dm=`https://docs.wcpos.com/settings/wp-admin/store-tax-ids`;function Om({data:t,mutate:n,storeDefaults:i}){return e.useEffect(()=>{eu(Em)},[]),(0,_.jsxs)(wo,{title:$(`settings.store_details_section_title`),description:$(`settings.store_details_section_description`),divider:!0,children:[(0,_.jsxs)(Co,{status:`info`,title:$(`settings.store_details_upgrade_callout_title`),className:`wcpos:mt-4`,children:[(0,_.jsx)(`p`,{className:`wcpos:m-0`,children:$(`settings.store_details_upgrade_to_pro`)}),(0,_.jsx)(`p`,{className:`wcpos:mt-2 wcpos:mb-0`,children:(0,_.jsx)(`a`,{href:Tm,target:`_blank`,rel:`noreferrer noopener`,onClick:()=>tu(Em,Tm),children:$(`common.upgrade_to_pro`)})})]}),(0,_.jsx)(q,{label:$(`settings.store_name`),children:(0,_.jsx)(W,{value:(0,r.isString)(t?.store_name)?t.store_name:``,placeholder:i.store_name,onChange:e=>n({store_name:e.target.value})})}),(0,_.jsx)(q,{label:$(`settings.store_phone`),children:(0,_.jsx)(W,{value:(0,r.isString)(t?.store_phone)?t.store_phone:``,placeholder:i.store_phone,onChange:e=>n({store_phone:e.target.value})})}),(0,_.jsx)(q,{label:$(`settings.store_email`),children:(0,_.jsx)(W,{type:`email`,value:(0,r.isString)(t?.store_email)?t.store_email:``,placeholder:i.store_email,onChange:e=>n({store_email:e.target.value})})}),(0,_.jsx)(q,{label:$(`settings.refund_returns_policy`),description:$(`settings.refund_returns_policy_tip`),children:(0,_.jsx)(Za,{rows:4,value:(0,r.isString)(t?.policies_and_conditions)?t.policies_and_conditions:``,placeholder:i.policies_and_conditions,onChange:e=>n({policies_and_conditions:e.target.value})})}),(0,_.jsxs)(`div`,{className:`wcpos:mt-4`,children:[(0,_.jsx)(`h4`,{className:`wcpos:text-sm wcpos:font-semibold wcpos:text-gray-900 wcpos:m-0 wcpos:mb-1`,children:$(`settings.store_tax_ids_section_title`)}),(0,_.jsxs)(`p`,{className:`wcpos:text-sm wcpos:text-gray-500 wcpos:mb-3`,children:[$(`settings.store_tax_ids_section_description`),` `,(0,_.jsx)(`a`,{href:Dm,target:`_blank`,rel:`noreferrer noopener`,className:`wcpos:text-wp-admin-theme-color wcpos:underline`,children:$(`settings.store_tax_ids_learn_more`)})]}),(0,_.jsx)(as,{value:Array.isArray(t?.store_tax_ids)?t.store_tax_ids:null,onChange:e=>{n({store_tax_ids:e})},labels:{add:$(`settings.store_tax_ids_add`),type:$(`settings.store_tax_ids_type`),value:$(`settings.store_tax_ids_value`),country:$(`settings.store_tax_ids_country`),countryPlaceholder:$(`settings.store_tax_ids_country_placeholder`),countrySearchPlaceholder:$(`settings.store_tax_ids_country_search`),countryNoResults:$(`settings.store_tax_ids_country_no_results`),countryClear:$(`settings.store_tax_ids_country_none`),label:$(`settings.store_tax_ids_label`),remove:$(`settings.store_tax_ids_remove`),empty:$(`settings.store_tax_ids_empty`)}})]})]})}function km({value:t,onChange:n}){let r=bp(!0),i=t!==``&&!r.some(e=>e.value===t),a=e.useMemo(()=>[{value:``,label:$(`settings.storefront_receipt_template_active`)},...i?[{value:t,label:$(`settings.storefront_receipt_template_unavailable`,{value:t}),disabled:!0}]:[],...r.map(({value:e,label:t})=>({value:e,label:t}))],[i,r,t]);return(0,_.jsx)(G,{value:t,options:a,onChange:({value:e})=>n(String(e)),"aria-label":$(`settings.storefront_receipt_template`)})}function Am({enabled:t,template:n,onChange:r}){return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(q,{children:(0,_.jsx)(Wf,{tip:$(`settings.storefront_receipt_enabled_tip`),children:(0,_.jsx)(Ya,{checked:t,onChange:e=>r({storefront_receipt_enabled:e}),label:$(`settings.storefront_receipt_enabled`)})})}),t&&(0,_.jsx)(q,{label:$(`settings.storefront_receipt_template`),children:(0,_.jsx)(Wf,{tip:$(`settings.storefront_receipt_template_tip`),children:(0,_.jsx)(e.Suspense,{fallback:(0,_.jsx)(K,{className:`wcpos:h-9 wcpos:w-full wcpos:rounded-md`}),children:(0,_.jsx)(km,{value:n,onChange:e=>r({storefront_receipt_template:e})})})})})]})}var jm={eu_vat:`EU VAT`,gb_vat:`GB VAT`,sa_vat:`SA VAT`,au_abn:`AU ABN`,br_cpf:`BR CPF`,br_cnpj:`BR CNPJ`,in_gst:`IN GSTIN`,it_cf:`IT Codice Fiscale`,it_piva:`IT Partita IVA`,es_nif:`ES NIF`,ar_cuit:`AR CUIT`,ca_gst_hst:`CA GST/HST`,us_ein:`US EIN`,other:`Other`},Mm={wc_eu_vat_number:`WooCommerce EU VAT Number`,aelia_eu_vat:`Aelia EU VAT Assistant`,wpfactory_eu_vat:`WPFactory EU/UK VAT Manager`,germanized:`WooCommerce Germanized`,br_market:`Brazilian Market on WooCommerce`,es_nif:`NIF/CIF Spain for WooCommerce`},Nm=`https://docs.wcpos.com/settings/wp-admin/customer-tax-ids`;function Pm(e,t,n,r){return t&&t!==``?`override`:n&&n!==r?`plugin`:`default`}function Fm(e,t,n){return e&&e!==``?e:t||n}function Im({source:e}){let t={plugin:`wcpos:bg-green-50 wcpos:text-green-800 wcpos:border-green-200`,default:`wcpos:bg-gray-100 wcpos:text-gray-700 wcpos:border-gray-200`,override:`wcpos:bg-amber-50 wcpos:text-amber-800 wcpos:border-amber-200`},n={plugin:$(`tax_ids.source_plugin`),default:$(`tax_ids.source_built_in`),override:$(`tax_ids.source_custom`)};return(0,_.jsx)(`span`,{className:(0,H.default)(`wcpos:inline-flex wcpos:items-center wcpos:px-2 wcpos:py-0.5 wcpos:rounded wcpos:text-[11px] wcpos:font-medium wcpos:uppercase wcpos:tracking-wide wcpos:border`,t[e]),children:n[e]})}function Lm(){return(0,_.jsx)(`a`,{href:Nm,target:`_blank`,rel:`noreferrer noopener`,className:`wcpos:text-wp-admin-theme-color wcpos:underline`,children:$(`tax_ids.learn_more`)})}function Rm({plugins:e,overrideCount:t}){let n=e.length>0,r=e.map(e=>Mm[e]??e);return(0,_.jsx)(`div`,{className:(0,H.default)(`wcpos:p-3 wcpos:rounded wcpos:mb-3 wcpos:border-l-[3px]`,n?`wcpos:bg-blue-50 wcpos:border-l-wp-admin-theme-color`:`wcpos:bg-gray-50 wcpos:border-l-gray-400`),children:(0,_.jsxs)(`div`,{className:`wcpos:flex wcpos:items-start wcpos:gap-2`,children:[(0,_.jsx)(`span`,{className:(0,H.default)(`wcpos:inline-flex wcpos:items-center wcpos:px-2 wcpos:py-0.5 wcpos:rounded wcpos:text-[11px] wcpos:font-medium wcpos:uppercase wcpos:tracking-wide wcpos:border wcpos:mt-0.5 wcpos:flex-shrink-0`,n?`wcpos:bg-green-50 wcpos:text-green-800 wcpos:border-green-200`:`wcpos:bg-gray-100 wcpos:text-gray-700 wcpos:border-gray-200`),children:n?`✓ ${$(`tax_ids.banner_auto_detected`)}`:$(`tax_ids.banner_no_plugin`)}),(0,_.jsx)(`div`,{className:`wcpos:flex-1 wcpos:text-sm`,children:n?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(`div`,{className:`wcpos:font-medium`,children:[r.join(`, `),` `,(0,_.jsx)(`span`,{className:`wcpos:font-normal`,children:$(`tax_ids.banner_is_installed`)})]}),(0,_.jsxs)(`div`,{className:`wcpos:text-xs wcpos:text-gray-600 wcpos:mt-1`,children:[$(`tax_ids.banner_detected_explainer`),t>0&&(0,_.jsxs)(_.Fragment,{children:[` `,$(`tax_ids.banner_overrides_active`,{count:t})]})]})]}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(`div`,{className:`wcpos:font-medium`,children:$(`tax_ids.banner_no_plugin_title`)}),(0,_.jsx)(`div`,{className:`wcpos:text-xs wcpos:text-gray-600 wcpos:mt-1`,children:$(`tax_ids.banner_no_plugin_explainer`)})]})})]})})}function zm({type:e,composed:t,defaultKey:n,override:r,suggestions:i,onCommit:a}){let o=Fm(r,t,n),s=Pm(e,r,t,n);return(0,_.jsxs)(Go,{className:(0,H.default)(s===`override`&&`wcpos:bg-amber-50/40`),children:[(0,_.jsx)(X,{className:`wcpos:font-medium wcpos:text-gray-900`,children:jm[e]??e}),(0,_.jsx)(X,{className:`wcpos:font-mono wcpos:text-xs wcpos:text-gray-600`,children:o}),(0,_.jsx)(X,{children:(0,_.jsx)(Im,{source:s})}),(0,_.jsx)(X,{children:(0,_.jsx)(Yu,{value:r??``,options:i,onChange:t=>a(e,t.trim(),n),allowCustomValue:!0,placeholder:$(`tax_ids.write_map_use_default`),className:`wcpos:font-mono wcpos:text-xs`,"aria-label":`${jm[e]??e} ${$(`tax_ids.col_override`)}`})})]})}function Bm(){let{data:t,mutate:n}=Xu(`tax_ids`),r=t?.write_map??{},{data:a}=nt({queryKey:[`tax_ids_detection`],queryFn:async()=>(0,i.default)({path:`wcpos/v1/settings/tax_ids/detection?wcpos=1`,method:`GET`})}),o=Object.keys(r).filter(e=>r[e]).length,s=e.useCallback((e,t,i)=>{if(t===(r[e]??``))return;let a={...r};t===``?delete a[e]:a[e]=t,n({write_map:a})},[n,r]),c=e.useMemo(()=>{let e=new Set;return Object.values(a.default_write_map).forEach(t=>t&&e.add(t)),Object.values(a.composed_write_map).forEach(t=>t&&e.add(t)),Array.from(e).sort().map(e=>({value:e,label:e}))},[a.composed_write_map,a.default_write_map]);return(0,_.jsxs)(`div`,{className:`wcpos:mt-4`,children:[(0,_.jsx)(`h4`,{className:`wcpos:text-sm wcpos:font-semibold wcpos:text-gray-900 wcpos:m-0 wcpos:mb-1`,children:$(`tax_ids.section_title`)}),(0,_.jsxs)(`p`,{className:`wcpos:text-sm wcpos:text-gray-500 wcpos:mb-3`,children:[$(`tax_ids.section_intro`),` `,(0,_.jsx)(Lm,{})]}),(0,_.jsx)(Rm,{plugins:a.plugins,overrideCount:o}),(0,_.jsxs)(`details`,{className:`wcpos:border wcpos:border-gray-200 wcpos:rounded`,children:[(0,_.jsxs)(`summary`,{className:(0,H.default)(`wcpos:px-3 wcpos:py-2 wcpos:text-sm wcpos:cursor-pointer wcpos:list-none`,`wcpos:flex wcpos:justify-between wcpos:items-center`,`wcpos:hover:bg-gray-50`),children:[(0,_.jsxs)(`span`,{children:[(0,_.jsx)(`strong`,{children:$(`tax_ids.advanced_title`)}),` `,(0,_.jsx)(`span`,{className:`wcpos:text-xs wcpos:text-gray-500`,children:$(`tax_ids.advanced_subtitle`)})]}),o>0&&(0,_.jsx)(`span`,{className:`wcpos:text-xs wcpos:text-gray-500`,children:$(`tax_ids.advanced_override_count`,{count:o})})]}),(0,_.jsxs)(`div`,{className:`wcpos:border-t wcpos:border-gray-200 wcpos:px-3 wcpos:py-3`,children:[(0,_.jsx)(`p`,{className:`wcpos:text-xs wcpos:text-gray-500 wcpos:mb-3`,children:$(`tax_ids.advanced_intro`)}),(0,_.jsxs)(Vo,{children:[(0,_.jsx)(Ho,{children:(0,_.jsxs)(Wo,{children:[(0,_.jsx)(Y,{children:$(`tax_ids.col_type`)}),(0,_.jsx)(Y,{children:$(`tax_ids.col_field`)}),(0,_.jsx)(Y,{children:$(`tax_ids.col_source`)}),(0,_.jsx)(Y,{children:$(`tax_ids.col_override`)})]})}),(0,_.jsx)(Uo,{children:a.types.map(e=>(0,_.jsx)(zm,{type:e,composed:a.composed_write_map[e]??``,defaultKey:a.default_write_map[e]??``,override:r[e],suggestions:c,onCommit:s},e))})]}),(0,_.jsxs)(`div`,{className:`wcpos:mt-3 wcpos:text-xs wcpos:text-gray-500 wcpos:flex wcpos:flex-wrap wcpos:gap-x-3 wcpos:gap-y-1 wcpos:items-center`,children:[(0,_.jsxs)(`span`,{className:`wcpos:flex wcpos:items-center wcpos:gap-1.5`,children:[(0,_.jsx)(Im,{source:`plugin`}),` `,$(`tax_ids.legend_plugin`)]}),(0,_.jsxs)(`span`,{className:`wcpos:flex wcpos:items-center wcpos:gap-1.5`,children:[(0,_.jsx)(Im,{source:`default`}),` `,$(`tax_ids.legend_built_in`)]}),(0,_.jsxs)(`span`,{className:`wcpos:flex wcpos:items-center wcpos:gap-1.5`,children:[(0,_.jsx)(Im,{source:`override`}),` `,$(`tax_ids.legend_custom`)]})]})]})]})]})}function Vm({disabled:t=!1,selected:n,onSelect:r}){let a=e.useMemo(()=>({id:0,name:$(`common.guest`)}),[]),{setNotice:o}=Xl(),[s,c]=e.useState(``),{data:l,isFetching:u}=tt({queryKey:[`users`,s],queryFn:async()=>{let e=await(0,i.default)({path:`wp/v2/users?search=${encodeURIComponent(s)}`,method:`GET`}).catch(e=>(console.error(e),e));return e?.code&&e?.message&&o({type:`error`,message:e?.message}),Array.isArray(e)?(e.unshift(a),e):[]},placeholderData:[a]}),d=e.useMemo(()=>(l||[]).map(e=>({value:String(e.id),label:e.name})),[l]);return(0,_.jsx)(Yu,{value:String(n||0),options:d,onChange:e=>r(e?Number(e):0),onQuery:c,loading:u,disabled:t})}function Hm(e){if(typeof e==`boolean`)return e;if(typeof e==`string`){let t=e.trim().toLowerCase();return t!==``&&t!==`false`&&t!==`0`}return!!e}function Um(){return window?.wcpos?.settings?.getComponent?.(`general.store_details_block`)||null}function Wm(){let{data:t,mutate:n}=Xu(`general`),[i,a]=e.useState(!1),o=!!t&&!(t?.code&&t?.message),s={store_name:``,store_phone:``,store_email:``,policies_and_conditions:``,...t?.store_defaults??{}},c=e.useMemo(()=>Um()??Om,[]);return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(c,{data:t,mutate:n,storeDefaults:s}),(0,_.jsxs)(wo,{title:$(`settings.products_section_title`),divider:!0,children:[(0,_.jsx)(q,{children:(0,_.jsx)(Wf,{tip:$(`settings.pos_only_products_tip`),children:(0,_.jsx)(Ya,{checked:!!t?.pos_only_products,onChange:e=>{n({pos_only_products:e})},label:$(`settings.pos_only_products`)})})}),(0,_.jsx)(q,{children:(0,_.jsx)(Wf,{tip:$(`settings.decimal_quantities_tip`),children:(0,_.jsx)(Ya,{checked:!!t?.decimal_qty,onChange:e=>{n({decimal_qty:e})},label:$(`settings.decimal_quantities`)})})}),(0,_.jsx)(q,{children:(0,_.jsx)(Wf,{tip:$(`settings.restore_stock_on_delete_tip`),children:(0,_.jsx)(Ya,{checked:!!t?.restore_stock_on_delete,onChange:e=>{n({restore_stock_on_delete:e})},label:$(`settings.restore_stock_on_delete`)})})}),(0,_.jsx)(q,{label:$(`settings.barcode_field`),children:(0,_.jsx)(Wf,{tip:$(`settings.barcode_field_tip`),children:(0,_.jsx)(e.Suspense,{fallback:(0,_.jsx)(K,{className:`wcpos:h-9 wcpos:w-full wcpos:rounded-md`}),children:(0,_.jsx)(Sm,{selected:(0,r.isString)(t?.barcode_field)&&t?.barcode_field||``,onSelect:e=>{n({barcode_field:e||`_global_unique_id`})}})})})})]}),(0,_.jsxs)(wo,{title:$(`settings.customers_section_title`),divider:!0,children:[(0,_.jsx)(q,{children:(0,_.jsx)(Ya,{checked:!!t?.generate_username,onChange:e=>{n({generate_username:e})},label:$(`settings.generate_username`)})}),(0,_.jsxs)(q,{label:$(`settings.default_customer`),children:[(0,_.jsx)(Wf,{tip:$(`settings.default_customer_tip`),children:(0,_.jsx)(e.Suspense,{fallback:(0,_.jsx)(K,{className:`wcpos:h-9 wcpos:w-full wcpos:rounded-md`}),children:(0,_.jsx)(Vm,{disabled:!!t?.default_customer_is_cashier,selected:(0,r.isNumber)(t?.default_customer)&&t?.default_customer||0,onSelect:e=>{n({default_customer:e})}})})}),(0,_.jsx)(`div`,{className:`wcpos:mt-2`,children:(0,_.jsx)(Xa,{label:$(`settings.use_cashier_account`),checked:!!t?.default_customer_is_cashier,onChange:e=>{n({default_customer_is_cashier:e.target.checked})}})})]}),(0,_.jsx)(Am,{enabled:!!t?.storefront_receipt_enabled,template:(0,r.isString)(t?.storefront_receipt_template)?t?.storefront_receipt_template:``,onChange:e=>{n(e)}}),(0,_.jsx)(e.Suspense,{fallback:(0,_.jsx)(K,{className:`wcpos:h-32 wcpos:w-full wcpos:rounded-md wcpos:mt-4`}),children:(0,_.jsx)(Bm,{})})]}),(0,_.jsxs)(wo,{title:$(`settings.privacy_section_title`),divider:!0,children:[(0,_.jsx)(q,{children:(0,_.jsx)(Wf,{children:(0,_.jsx)(Ya,{checked:t?.tracking_consent===`allowed`,onChange:e=>{let t=e?`allowed`:`denied`;$l(t),n({tracking_consent:t})},label:$(`settings.allow_anonymous_usage_data_v2`)})})}),(0,_.jsxs)(`p`,{className:`wcpos:text-sm wcpos:text-gray-500`,children:[$(`settings.allow_anonymous_usage_data_tip_v3`),` `,(0,_.jsx)(`button`,{type:`button`,onClick:()=>a(!0),className:`wcpos:underline wcpos:text-wp-admin-theme-color wcpos:cursor-pointer wcpos:bg-transparent wcpos:border-0 wcpos:p-0`,children:$(`settings.privacy_learn_more`)})]})]}),(0,_.jsx)(wo,{title:$(`settings.advanced_section_title`),divider:!0,children:(0,_.jsx)(q,{children:(0,_.jsx)(Wf,{tip:$(`settings.force_ssl_tip`),children:(0,_.jsx)(Ya,{checked:!o||Hm(t?.force_ssl),disabled:!o,onChange:e=>{n({force_ssl:e})},label:$(`settings.force_ssl`)})})})}),(0,_.jsx)(xm,{open:i,onClose:()=>a(!1)})]})}function Gm(){return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(wm,{}),(0,_.jsx)(e.Suspense,{fallback:(0,_.jsx)(Iu,{rows:5}),children:(0,_.jsx)(Wm,{})})]})}var Km=(e,t=20,n=`...`)=>{if(e.length<=t)return e;n||=`...`;let r=t-n.length,i=Math.ceil(r/2),a=Math.floor(r/2);return e.substr(0,i)+n+e.substr(e.length-a)};function qm(){let{data:t,mutate:n}=Xu(`license`),{setNotice:i}=Xl(),[o,s]=e.useState(t?.key),c=e=>s(e.target.value),l=async(e=!1)=>{e||ru();let c=window.wcpos?.settings,l=e||!c?{}:{...c.anon_id?{anon_id:c.anon_id}:{},...c.site_uuid?{site_uuid:c.site_uuid}:{}},u=(0,a.addQueryArgs)(`https://wcpos.com`,{"wc-api":`am-software-api`,request:e?`deactivation`:`activation`,instance:t?.instance,api_key:o,product_id:t?.product_id,platform:t?.platform,version:t?.version,timestamp:Date.now(),...l}),d=await fetch(u,{method:`GET`,credentials:`omit`}).then(e=>e.json()).catch(t=>(e||ou(t),i({type:`error`,message:t.message}),null));if(d){if(!d.success)e||ou(d),i({type:`error`,message:d.error});else{if(e)s(``);else{iu((0,r.isString)(d?.license_tier)?d.license_tier:void 0);let e=(0,r.get)(window,`confetti`);e&&e()}n({key:e?``:o,activated:!!d.activated})}}};return e.useEffect(()=>{t?.instance||(eu(`license_screen_card`),eu(`license_screen_link`))},[t?.instance]),t?.instance?t.activated?(0,_.jsxs)(`div`,{className:`wcpos:px-4 wcpos:py-5 wcpos:sm:grid wcpos:sm:grid-cols-3 wcpos:sm:gap-4 wcpos:sm:px-6 wcpos:items-center`,children:[(0,_.jsx)(`div`,{className:`wcpos:sm:text-right wcpos:text-8xl`,children:`🎉`}),(0,_.jsxs)(`div`,{className:`wcpos:col-span-2`,children:[(0,_.jsx)(`h3`,{children:$(`license.thank_you`)}),(0,_.jsx)(`p`,{children:(0,_.jsx)(Gl,{i18nKey:`license.activated`,components:{code:(0,_.jsx)(`code`,{})},values:{number:Km((0,r.isString)(t?.key)?t?.key:``)}})}),(0,_.jsx)(`p`,{children:$(`license.ongoing_support`)}),(0,_.jsx)(U,{variant:`primary`,onClick:()=>l(!0),children:$(`license.deactivate`)})]})]}):(0,_.jsxs)(`div`,{className:`wcpos:px-4 wcpos:py-5 wcpos:sm:grid wcpos:sm:grid-cols-3 wcpos:sm:gap-4`,children:[(0,_.jsx)(`div`,{className:`wcpos:flex wcpos:sm:justify-end`,children:(0,_.jsx)(Wf,{children:$(`license.license_key`)})}),(0,_.jsx)(`div`,{children:(0,_.jsx)(`input`,{type:`text`,name:`license-key`,id:`license-key`,className:`wcpos:mt-1 wcpos:focus:ring-indigo-500 wcpos:focus:border-wp-admin-theme-color wcpos:block wcpos:w-full wcpos:shadow-xs wcpos:sm:text-sm wcpos:border-gray-300 wcpos:rounded-md`,onChange:(0,r.throttle)(c,100)})}),(0,_.jsx)(`div`,{children:(0,_.jsx)(U,{variant:`primary`,disabled:!o,onClick:()=>l(),children:$(`license.activate`)})})]}):(0,_.jsxs)(`div`,{className:`wcpos:flex wcpos:flex-col wcpos:items-center wcpos:gap-6 wcpos:px-4 wcpos:py-8 wcpos:max-w-md wcpos:mx-auto`,children:[(0,_.jsx)(`a`,{href:`https://wcpos.com/pro`,onClick:()=>tu(`license_screen_card`,`https://wcpos.com/pro`),children:(0,_.jsx)(`img`,{src:`https://wcpos.com/images/wcpos-pro.png`,alt:`WCPOS Pro`,width:80,height:80})}),(0,_.jsxs)(`div`,{className:`wcpos:text-center`,children:[(0,_.jsx)(`p`,{className:`wcpos:text-gray-600 wcpos:mb-3`,children:$(`license.support_development`)}),(0,_.jsxs)(`a`,{href:`https://wcpos.com/pro`,"data-testid":`license-upgrade-cta`,className:`wcpos:inline-block wcpos:font-medium wcpos:text-[color:var(--wp-admin-theme-color)] hover:wcpos:underline`,onClick:()=>tu(`license_screen_link`,`https://wcpos.com/pro`),children:[$(`common.upgrade_to_pro`),` →`]})]}),(0,_.jsxs)(Kl,{status:`info`,isDismissible:!1,className:`wcpos:w-full`,children:[$(`license.existing_license_prefix`),` `,(0,_.jsx)(`a`,{href:`https://docs.wcpos.com/getting-started/pro-license#installation`,target:`_blank`,rel:`noopener noreferrer`,className:`wcpos:font-medium wcpos:underline`,children:$(`license.existing_license_link`)}),` `,$(`license.existing_license_suffix`)]})]})}function Jm(e,t={}){let n=new Date(e);return Number.isNaN(n.getTime())?e:new Intl.DateTimeFormat(t.locale,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,timeZone:t.timeZone}).format(n)}function Ym(e,t={}){let n=[`[${Jm(e.timestamp,t)}] ${e.level.toUpperCase()}`,e.message];return e.context&&e.context.trim()!==``&&(n.push(``),n.push(`Context:`),n.push(e.context)),n.join(`
7 `)}function Xm(e,t){return new Intl.DateTimeFormat(`en-CA`,{year:`numeric`,month:`2-digit`,day:`2-digit`,timeZone:t}).format(e)}function Zm(e){let[t,n,r]=e.split(`-`).map(Number);return Xm(new Date(Date.UTC(t,n-1,r)-864e5),`UTC`)}function Qm(e,t,n={}){if(e.length===0)return[];let{timeZone:r}=n,i=Xm(new Date(t),r),a=Zm(i),o=[],s=null;for(let t of e){let e=new Date(t.timestamp),n;if(Number.isNaN(e.getTime()))n=t.timestamp;else{let t=Xm(e,r);n=t===i?`today`:t===a?`yesterday`:t}(!s||s.label!==n)&&(s={label:n,entries:[]},o.push(s)),s.entries.push(t)}return o}function $m(e,t,n){return(0,a.addQueryArgs)(`wcpos/v1/logs`,{wcpos:1,_wcpos_envelope:1,per_page:50,page:e,...t===`all`?{}:{level:t},source:n})}function eh(e){return typeof e==`object`&&!!e&&`data`in e&&`_wcpos`in e}function th(e){return eh(e)?{...e.data,_totalPages:e._wcpos?.total_pages??1}:{...e,_totalPages:1}}function nh(t,n){let[r,i]=e.useState(t);return e.useEffect(()=>{let e=()=>i(Date.now()),t=window.setTimeout(e,0),r=window.setInterval(e,n);return()=>{window.clearTimeout(t),window.clearInterval(r)}},[n]),r}var rh=`all`,ih={emergency:`wcpos:bg-red-600`,alert:`wcpos:bg-red-600`,critical:`wcpos:bg-red-500`,error:`wcpos:bg-red-400`,warning:`wcpos:bg-amber-400`,notice:`wcpos:bg-blue-400`,info:`wcpos:bg-blue-400`,debug:`wcpos:bg-gray-400`},ah={emergency:`wcpos:text-red-800`,alert:`wcpos:text-red-800`,critical:`wcpos:text-red-700`,error:`wcpos:text-red-700`,warning:`wcpos:text-amber-700`,notice:`wcpos:text-blue-700`,info:`wcpos:text-blue-700`,debug:`wcpos:text-gray-700`},oh={emergency:`hover:wcpos:bg-red-50`,alert:`hover:wcpos:bg-red-50`,critical:`hover:wcpos:bg-red-50`,error:`hover:wcpos:bg-red-50`,warning:`hover:wcpos:bg-amber-50`,notice:`hover:wcpos:bg-blue-50`,info:`hover:wcpos:bg-blue-50`,debug:`hover:wcpos:bg-gray-50`},sh={emergency:`critical`,alert:`critical`,critical:`critical`,error:`error`,warning:`warning`,notice:`info`,info:`info`,debug:`debug`};function ch(e){return ih[e]?e:`debug`}function lh(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hourCycle:`h23`})}function uh(e){return e===`today`?$(`logs.today`,`Today`):e===`yesterday`?$(`logs.yesterday`,`Yesterday`):e}async function dh(e){if(typeof navigator<`u`&&navigator.clipboard&&window.isSecureContext)try{return await navigator.clipboard.writeText(e),!0}catch{}if(typeof document>`u`)return!1;let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.position=`fixed`,t.style.left=`-9999px`,t.style.top=`0`,document.body.appendChild(t);let n=document.activeElement;t.focus(),t.select();let r=!1;try{r=document.execCommand(`copy`)}catch{r=!1}return document.body.removeChild(t),n?.focus?.(),r}function fh({payload:t}){let[n,r]=e.useState(`idle`),i=async()=>{let e=await dh(t);r(e?`copied`:`failed`),setTimeout(()=>r(`idle`),1500)},a=n===`copied`?$(`logs.copied`,`Copied`):n===`failed`?$(`logs.copy_failed`,`Copy failed`):$(`logs.copy`,`Copy`);return(0,_.jsx)(U,{variant:`secondary`,onClick:i,children:a})}function ph({entry:t,isExpanded:n,onToggle:r,sourceName:i}){let a=ch(t.level),o=e.useMemo(()=>Ym(t),[t]);return(0,_.jsxs)(`div`,{className:`wcpos:border-b wcpos:border-gray-100 wcpos:last:border-b-0`,children:[(0,_.jsxs)(`button`,{type:`button`,"aria-expanded":n,onClick:r,className:`wcpos:grid wcpos:grid-cols-[78px_1fr_14px] wcpos:items-center wcpos:gap-3 wcpos:w-full wcpos:text-left wcpos:bg-transparent wcpos:border-0 wcpos:py-2 wcpos:pr-2 wcpos:pl-4 wcpos:cursor-pointer wcpos:relative ${oh[a]}`,children:[(0,_.jsx)(`span`,{"aria-hidden":`true`,className:`wcpos:absolute wcpos:left-0 wcpos:top-0 wcpos:bottom-0 wcpos:w-1 ${ih[a]}`}),(0,_.jsx)(`span`,{className:`wcpos:text-xs wcpos:font-mono wcpos:text-gray-500`,children:lh(t.timestamp)}),(0,_.jsx)(`span`,{className:`wcpos:text-sm wcpos:break-words ${ah[a]}`,children:t.message}),(0,_.jsx)(`span`,{"aria-hidden":`true`,className:`wcpos:text-gray-400 wcpos:transition-transform ${n?`wcpos:rotate-90`:``}`,children:`›`})]}),n&&(0,_.jsxs)(`div`,{className:`wcpos:px-4 wcpos:pb-3`,children:[(0,_.jsxs)(`div`,{className:`wcpos:flex wcpos:items-center wcpos:justify-between wcpos:bg-gray-50 wcpos:rounded-t-md wcpos:px-3 wcpos:py-2 wcpos:gap-2`,children:[(0,_.jsxs)(`div`,{className:`wcpos:flex wcpos:items-center wcpos:gap-2 wcpos:flex-wrap`,children:[(0,_.jsx)(J,{variant:sh[a],children:t.level.toUpperCase()}),(0,_.jsx)(J,{variant:`neutral`,children:i}),(0,_.jsx)(J,{variant:`neutral`,children:Jm(t.timestamp)})]}),(0,_.jsx)(fh,{payload:o})]}),(0,_.jsx)(Za,{readOnly:!0,value:o,onFocus:e=>e.currentTarget.select(),className:`wcpos:bg-gray-900 wcpos:text-gray-100 wcpos:font-mono wcpos:text-xs wcpos:rounded-b-md wcpos:rounded-t-none wcpos:border-gray-900 wcpos:min-h-[160px]`})]})]})}function mh(){let[t,n]=e.useState(`all`),[r,a]=e.useState(rh),[o,s]=e.useState(null),[c,l]=e.useState(1),{data:u,dataUpdatedAt:d}=nt({queryKey:[`logs`,t,r,c],queryFn:()=>(0,i.default)({path:$m(c,t,r),method:`GET`}).then(th)}),f=u?.entries??[],p=u?.sources??[],m=e.useMemo(()=>{let e=new Map;return p.forEach(t=>e.set(t.source,t)),e},[p]),h=u?._totalPages??1;e.useEffect(()=>{Ou()},[]);let[g,v]=e.useState(u);u!==g&&(v(u),s(null));let y=nh(d,6e4),b=e.useMemo(()=>Qm(f,y),[f,y]),x=[{key:`all`,label:$(`common.all`,`All`)},{key:`error`,label:$(`logs.errors`,`Errors`)},{key:`warning`,label:$(`logs.warnings`,`Warnings`)}];return(0,_.jsxs)(`div`,{children:[u?.has_fatal_errors&&(0,_.jsxs)(Kl,{status:`warning`,isDismissible:!1,className:`wcpos:mb-4`,children:[$(`logs.fatal_errors_detected`,`Fatal errors detected`),` — `,(0,_.jsx)(`a`,{href:u.fatal_errors_url,target:`_blank`,rel:`noopener noreferrer`,children:$(`logs.view_in_wc`,`view in WooCommerce logs`)})]}),(0,_.jsxs)(`div`,{className:`wcpos:mb-4 wcpos:flex wcpos:flex-wrap wcpos:items-center wcpos:gap-3`,children:[(0,_.jsx)(To,{items:x,value:t,onChange:e=>{n(e),l(1),s(null)}}),p.length>1&&(0,_.jsxs)(`div`,{className:`wcpos:flex wcpos:items-center wcpos:gap-2`,children:[(0,_.jsx)(`label`,{htmlFor:`wcpos-log-source-select`,className:`wcpos:text-sm wcpos:text-gray-600`,children:$(`logs.source`,`Source`)}),(0,_.jsx)(G,{id:`wcpos-log-source-select`,value:r,onChange:e=>{a(String(e.value)),l(1),s(null)},options:[{value:rh,label:$(`common.all`,`All`)},...p.map(e=>({value:e.source,label:e.name}))]})]})]}),f.length===0?(0,_.jsx)(`p`,{className:`wcpos:text-sm wcpos:text-gray-500`,children:$(`logs.no_entries`,`No log entries found.`)}):(0,_.jsx)(`div`,{className:`wcpos:space-y-4`,children:b.map(e=>(0,_.jsxs)(`div`,{className:`wcpos:border wcpos:border-gray-200 wcpos:rounded-md wcpos:overflow-hidden`,children:[(0,_.jsxs)(`div`,{className:`wcpos:flex wcpos:items-center wcpos:justify-between wcpos:bg-gray-50 wcpos:px-4 wcpos:py-2 wcpos:border-b wcpos:border-gray-200`,children:[(0,_.jsx)(`span`,{className:`wcpos:text-sm wcpos:font-semibold wcpos:text-gray-700`,children:uh(e.label)}),(0,_.jsx)(J,{variant:`neutral`,size:`xs`,children:$(`logs.entries_count`,{count:e.entries.length})})]}),(0,_.jsx)(`div`,{children:e.entries.map((t,n)=>{let r=`${e.label}-${t.timestamp}-${n}`,i=t.source||`woocommerce-pos`,a=m.get(i)?.name??`WCPOS`;return(0,_.jsx)(ph,{entry:t,isExpanded:o===r,onToggle:()=>s(o===r?null:r),sourceName:a},r)})})]},e.label))}),h>1&&(0,_.jsxs)(`div`,{className:`wcpos:flex wcpos:items-center wcpos:justify-center wcpos:gap-2 wcpos:mt-4`,children:[(0,_.jsx)(`button`,{onClick:()=>{l(e=>Math.max(1,e-1)),s(null)},disabled:c<=1,className:`wcpos:px-3 wcpos:py-1 wcpos:rounded wcpos:text-sm wcpos:border wcpos:border-gray-300 disabled:wcpos:opacity-50`,children:$(`common.previous`,`Previous`)}),(0,_.jsxs)(`span`,{className:`wcpos:text-sm wcpos:text-gray-600`,children:[c,` / `,h]}),(0,_.jsx)(`button`,{onClick:()=>{l(e=>Math.min(h,e+1)),s(null)},disabled:c>=h,className:`wcpos:px-3 wcpos:py-1 wcpos:rounded wcpos:text-sm wcpos:border wcpos:border-gray-300 disabled:wcpos:opacity-50`,children:$(`common.next`,`Next`)})]})]})}var hh={smartphone:e=>(0,_.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,...e,children:(0,_.jsx)(`path`,{d:`M17 1.01 7 1c-1.1 0-2 .9-2 2v18c0 1.1.9 2 2 2h10c1.1 0 2-.9 2-2V3c0-1.1-.9-1.99-2-1.99zM17 19H7V5h10v14z`})}),tablet:e=>(0,_.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,...e,children:(0,_.jsx)(`path`,{d:`M21 4H3c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h18c1.1 0 1.99-.9 1.99-2L23 6c0-1.1-.9-2-2-2zm-2 14H5V6h14v12z`})}),laptop:e=>(0,_.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,...e,children:(0,_.jsx)(`path`,{d:`M20 18c1.1 0 1.99-.9 1.99-2L22 6c0-1.11-.9-2-2-2H4c-1.11 0-2 .89-2 2v10c0 1.1.89 2 2 2H0v2h24v-2h-4zM4 6h16v10H4V6z`})}),web:e=>(0,_.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,...e,children:(0,_.jsx)(`path`,{d:`M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM18.92 8h-2.95a15.65 15.65 0 0 0-1.38-3.56A8.03 8.03 0 0 1 18.92 8zM12 4.04c.83 1.2 1.48 2.53 1.91 3.96h-3.82c.43-1.43 1.08-2.76 1.91-3.96zM4.26 14C4.1 13.36 4 12.69 4 12s.1-1.36.26-2h3.38c-.08.66-.14 1.32-.14 2s.06 1.34.14 2H4.26zm.82 2h2.95c.32 1.25.78 2.45 1.38 3.56A7.99 7.99 0 0 1 5.08 16zm2.95-8H5.08a7.99 7.99 0 0 1 4.33-3.56A15.65 15.65 0 0 0 8.03 8zM12 19.96c-.83-1.2-1.48-2.53-1.91-3.96h3.82c-.43 1.43-1.08 2.76-1.91 3.96zM14.34 14H9.66c-.09-.66-.16-1.32-.16-2s.07-1.35.16-2h4.68c.09.65.16 1.32.16 2s-.07 1.34-.16 2zm.25 5.56c.6-1.11 1.06-2.31 1.38-3.56h2.95a8.03 8.03 0 0 1-4.33 3.56zM16.36 14c.08-.66.14-1.32.14-2s-.06-1.34-.14-2h3.38c.16.64.26 1.31.26 2s-.1 1.36-.26 2h-3.38z`})})};function gh({app_type:e,device_type:t}){switch(e){case`ios_app`:case`android_app`:return t===`mobile`?`smartphone`:`tablet`;case`electron_app`:return`laptop`;default:return t===`mobile`?`smartphone`:t===`tablet`?`tablet`:`web`}}function _h({deviceInfo:e,className:t}){let n=hh[gh(e)];return(0,_.jsx)(n,{className:(0,H.default)(`wcpos:fill-current`,t),"aria-hidden":`true`,focusable:`false`})}function vh(e){switch(e){case`ios_app`:return $(`sessions.ios_application`);case`android_app`:return $(`sessions.android_application`);case`electron_app`:return $(`sessions.desktop_application`);default:return $(`sessions.web_application`)}}function yh(e){try{return new Date(e*1e3).toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}catch{return`N/A`}}function bh(e){let t=Math.floor(Date.now()/1e3)-e;return t<60?$(`sessions.just_now`):t<3600?$(`sessions.minutes_ago`,{minutes:Math.floor(t/60)}):t<86400?$(`sessions.hours_ago`,{hours:Math.floor(t/3600)}):$(`sessions.days_ago`,{days:Math.floor(t/86400)})}function xh({session:e,onDelete:t,isDeleting:n}){return(0,_.jsx)(`div`,{className:(0,H.default)(`wcpos:rounded-md wcpos:border wcpos:bg-white wcpos:p-3 wcpos:transition-colors`,e.is_current?`wcpos:border-wp-admin-theme-color wcpos:ring-1 wcpos:ring-wp-admin-theme-color/30`:`wcpos:border-gray-200 hover:wcpos:border-gray-300`),children:(0,_.jsxs)(`div`,{className:`wcpos:flex wcpos:items-start wcpos:gap-3`,children:[(0,_.jsx)(`div`,{className:(0,H.default)(`wcpos:shrink-0 wcpos:flex wcpos:h-10 wcpos:w-10 wcpos:items-center wcpos:justify-center wcpos:rounded-md`,e.is_current?`wcpos:bg-wp-admin-theme-color-lightest wcpos:text-wp-admin-theme-color`:`wcpos:bg-gray-100 wcpos:text-gray-500`),children:(0,_.jsx)(_h,{deviceInfo:e.device_info,className:`wcpos:h-5 wcpos:w-5`})}),(0,_.jsxs)(`div`,{className:`wcpos:min-w-0 wcpos:flex-1`,children:[(0,_.jsxs)(`div`,{className:`wcpos:flex wcpos:items-start wcpos:justify-between wcpos:gap-2`,children:[(0,_.jsxs)(`div`,{className:`wcpos:min-w-0 wcpos:flex-1`,children:[(0,_.jsxs)(`div`,{className:`wcpos:flex wcpos:items-center wcpos:gap-2`,children:[(0,_.jsxs)(`h4`,{className:`wcpos:text-sm wcpos:font-semibold wcpos:text-gray-900 wcpos:leading-tight wcpos:truncate`,children:[vh(e.device_info.app_type),e.device_info.browser_version&&(0,_.jsx)(`span`,{className:`wcpos:ml-1 wcpos:text-xs wcpos:font-normal wcpos:text-gray-500`,children:e.device_info.browser_version})]}),e.is_current&&(0,_.jsx)(J,{variant:`brand`,size:`xs`,shape:`pill`,children:$(`sessions.current_device`)})]}),(0,_.jsxs)(`p`,{className:`wcpos:mt-0.5 wcpos:text-xs wcpos:text-gray-600 wcpos:truncate`,children:[e.device_info.browser,` · `,e.device_info.os]})]}),(0,_.jsx)(U,{variant:`ghost-destructive`,onClick:t,disabled:n,className:`wcpos:shrink-0 wcpos:px-2 wcpos:py-1 wcpos:text-xs`,children:$(`sessions.terminate`)})]}),(0,_.jsxs)(`div`,{className:`wcpos:mt-2 wcpos:grid wcpos:grid-cols-2 wcpos:gap-x-4 wcpos:gap-y-1 wcpos:rounded wcpos:bg-gray-50 wcpos:px-2 wcpos:py-1.5 wcpos:text-xs`,children:[(0,_.jsxs)(`div`,{className:`wcpos:flex wcpos:justify-between wcpos:gap-2`,children:[(0,_.jsx)(`span`,{className:`wcpos:text-gray-500`,children:$(`sessions.last_active`)}),(0,_.jsx)(`span`,{className:`wcpos:text-gray-900`,children:bh(e.last_active)})]}),(0,_.jsxs)(`div`,{className:`wcpos:flex wcpos:justify-between wcpos:gap-2`,children:[(0,_.jsx)(`span`,{className:`wcpos:text-gray-500`,children:$(`sessions.ip`)}),(0,_.jsx)(`span`,{className:`wcpos:text-gray-900`,children:e.ip_address||`N/A`})]}),(0,_.jsxs)(`div`,{className:`wcpos:flex wcpos:justify-between wcpos:gap-2`,children:[(0,_.jsx)(`span`,{className:`wcpos:text-gray-500`,children:$(`sessions.created`)}),(0,_.jsx)(`span`,{className:`wcpos:text-gray-900`,children:yh(e.created)})]}),(0,_.jsxs)(`div`,{className:`wcpos:flex wcpos:justify-between wcpos:gap-2`,children:[(0,_.jsx)(`span`,{className:`wcpos:text-gray-500`,children:$(`sessions.expires`)}),(0,_.jsx)(`span`,{className:`wcpos:text-gray-900`,children:yh(e.expires)})]})]}),e.user_agent&&(0,_.jsxs)(`details`,{className:`wcpos:mt-2 wcpos:group`,children:[(0,_.jsxs)(`summary`,{className:`wcpos:flex wcpos:cursor-pointer wcpos:select-none wcpos:items-center wcpos:gap-1 wcpos:text-[11px] wcpos:text-gray-500 hover:wcpos:text-gray-700`,children:[(0,_.jsx)(`span`,{className:`wcpos:text-[8px] wcpos:transition-transform group-open:wcpos:rotate-90`,children:`▶`}),$(`sessions.user_agent`)]}),(0,_.jsx)(`div`,{className:`wcpos:mt-1 wcpos:rounded wcpos:border wcpos:border-gray-200 wcpos:bg-gray-50 wcpos:p-1.5`,children:(0,_.jsx)(`p`,{className:`wcpos:break-all wcpos:font-mono wcpos:text-[10px] wcpos:leading-tight wcpos:text-gray-700`,children:e.user_agent})})]})]})]})})}function Sh({user:t,isYou:n,isActiveNow:r,isDeleting:i,onDeleteSession:a,onDeleteAll:o}){let s=t.sessions.some(e=>e.is_current),c=e.useMemo(()=>[...t.sessions].sort((e,t)=>e.is_current&&!t.is_current?-1:!e.is_current&&t.is_current?1:t.last_active-e.last_active),[t.sessions]);return(0,_.jsxs)(`div`,{className:`wcpos:flex wcpos:h-full wcpos:flex-col`,children:[(0,_.jsxs)(`div`,{className:`wcpos:mb-3 wcpos:flex wcpos:items-center wcpos:gap-3 wcpos:border-b wcpos:border-gray-200 wcpos:pb-3`,children:[(0,_.jsx)(No,{name:t.display_name,src:t.avatar_url,size:`lg`,status:r?`active`:`none`,statusLabel:$(`sessions.active_now`)}),(0,_.jsxs)(`div`,{className:`wcpos:min-w-0 wcpos:flex-1`,children:[(0,_.jsxs)(`div`,{className:`wcpos:flex wcpos:items-center wcpos:gap-2`,children:[(0,_.jsx)(`h3`,{className:`wcpos:truncate wcpos:text-base wcpos:font-semibold wcpos:text-gray-900`,children:t.display_name}),n&&(0,_.jsx)(J,{variant:`brand`,size:`xs`,shape:`pill`,children:$(`sessions.you`)}),r&&(0,_.jsx)(J,{variant:`success`,size:`xs`,shape:`pill`,children:$(`sessions.active_now`)})]}),(0,_.jsxs)(`p`,{className:`wcpos:truncate wcpos:text-xs wcpos:text-gray-600`,children:[`@`,t.username,` · `,$(`sessions.session_count`,{count:t.session_count})]})]}),(0,_.jsxs)(`div`,{className:`wcpos:flex wcpos:shrink-0 wcpos:gap-2`,children:[s&&t.sessions.length>1&&(0,_.jsx)(U,{variant:`outline`,onClick:()=>o(!0),disabled:i,className:`wcpos:text-xs`,children:$(`sessions.logout_other_devices`)}),t.sessions.length>0&&(0,_.jsx)(U,{variant:`destructive`,onClick:()=>o(!1),disabled:i,className:`wcpos:text-xs`,children:$(`sessions.logout_all`)})]})]}),(0,_.jsx)(`div`,{className:`wcpos:flex-1 wcpos:space-y-2 wcpos:overflow-y-auto`,children:c.map(e=>(0,_.jsx)(xh,{session:e,onDelete:()=>a(e.jti),isDeleting:i},e.jti))})]})}function Ch({user:e,isSelected:t,isYou:n,isActiveNow:r,onSelect:i}){return(0,_.jsxs)(`button`,{type:`button`,onClick:i,"aria-pressed":t,className:(0,H.default)(`wcpos:flex wcpos:w-full wcpos:items-center wcpos:gap-3 wcpos:rounded-md wcpos:border wcpos:px-3 wcpos:py-2 wcpos:text-left wcpos:transition-colors`,t?`wcpos:border-wp-admin-theme-color wcpos:bg-wp-admin-theme-color-lightest`:`wcpos:border-transparent wcpos:bg-white hover:wcpos:border-gray-200 hover:wcpos:bg-gray-50`),children:[(0,_.jsx)(No,{name:e.display_name,src:e.avatar_url,size:`md`,status:r?`active`:`none`,statusLabel:$(`sessions.active_now`)}),(0,_.jsxs)(`div`,{className:`wcpos:min-w-0 wcpos:flex-1`,children:[(0,_.jsxs)(`div`,{className:`wcpos:flex wcpos:items-center wcpos:gap-1.5`,children:[(0,_.jsx)(`span`,{className:`wcpos:truncate wcpos:text-sm wcpos:font-medium wcpos:text-gray-900`,children:e.display_name}),n&&(0,_.jsx)(J,{variant:`brand`,size:`xs`,shape:`pill`,children:$(`sessions.you`)})]}),(0,_.jsx)(`div`,{className:`wcpos:flex wcpos:items-center wcpos:gap-1 wcpos:text-xs wcpos:text-gray-600`,children:(0,_.jsxs)(`span`,{className:`wcpos:truncate`,children:[`@`,e.username]})})]}),(0,_.jsx)(J,{variant:`neutral`,size:`xs`,shape:`round`,children:e.session_count})]})}var wh=e=>(0,_.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,...e,children:(0,_.jsx)(`path`,{d:`M15.5 14h-.79l-.28-.27a6.471 6.471 0 0 0 1.48-5.34c-.47-2.78-2.79-5-5.59-5.34a6.505 6.505 0 0 0-7.27 7.27c.34 2.8 2.56 5.12 5.34 5.59a6.471 6.471 0 0 0 5.34-1.48l.27.28v.79l4.25 4.25c.41.41 1.08.41 1.49 0 .41-.41.41-1.08 0-1.49L15.5 14zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z`})});function Th({users:t,selectedUserId:n,currentUserId:r,nowSeconds:i,activeNowThresholdSeconds:a,onSelect:o}){let[s,c]=e.useState(``),l=e.useMemo(()=>{let e=s.trim().toLowerCase();return e?t.filter(t=>t.display_name.toLowerCase().includes(e)||t.username.toLowerCase().includes(e)):t},[t,s]);return(0,_.jsxs)(`div`,{className:`wcpos:flex wcpos:h-full wcpos:flex-col`,children:[(0,_.jsxs)(`div`,{className:`wcpos:relative wcpos:mb-2`,children:[(0,_.jsx)(wh,{className:`wcpos:pointer-events-none wcpos:absolute wcpos:left-2 wcpos:top-1/2 wcpos:h-4 wcpos:w-4 wcpos:-translate-y-1/2 wcpos:fill-current wcpos:text-gray-400`,"aria-hidden":`true`,focusable:`false`}),(0,_.jsx)(W,{value:s,onChange:e=>c(e.target.value),placeholder:$(`sessions.filter_users`),"aria-label":$(`sessions.filter_users`),className:`wcpos:pl-8`})]}),(0,_.jsx)(`div`,{className:`wcpos:flex-1 wcpos:overflow-y-auto wcpos:space-y-1 wcpos:pr-1`,children:l.length===0?(0,_.jsx)(`div`,{className:`wcpos:py-6 wcpos:text-center wcpos:text-xs wcpos:text-gray-500`,children:s.trim()?$(`sessions.no_users_match`):$(`sessions.no_other_users`)}):l.map(e=>{let t=i-e.last_active<=a;return(0,_.jsx)(Ch,{user:e,isSelected:e.user_id===n,isYou:r!==null&&e.user_id===r,isActiveNow:t,onSelect:()=>o(e.user_id)},e.user_id)})})]})}var Eh=300;function Dh(){let e=window?.wcpos?.settings?.currentUserId;return typeof e==`number`&&e>0?e:null}function Oh(e,t){return[...e].sort((e,n)=>{if(t!==null){if(e.user_id===t)return-1;if(n.user_id===t)return 1}return n.last_active-e.last_active})}function kh(){let t=y(),{setNotice:n}=Xl(),r=e.useMemo(()=>Dh(),[]),{data:a,dataUpdatedAt:o}=nt({queryKey:[`sessions`,`all`],queryFn:async()=>await(0,i.default)({path:`/wcpos/v1/auth/users/sessions?wcpos=1`,method:`GET`})}),s=e.useMemo(()=>Oh(a?.users??[],r),[a?.users,r]),[c,l]=e.useState(null),[u,d]=e.useState(null),f=null;s.length>0&&(f=c!==null&&s.some(e=>e.user_id===c)?c:r!==null&&s.some(e=>e.user_id===r)?r:s[0].user_id),c!==null&&c!==f&&l(f);let p=e.useMemo(()=>s.find(e=>e.user_id===f)||null,[s,f]),m=rt({mutationFn:async({userId:e,jti:t})=>(0,i.default)({path:`/wcpos/v1/auth/sessions/${t}?user_id=${e}&wcpos=1`,method:`DELETE`}),onSuccess:()=>{t.invalidateQueries({queryKey:[`sessions`]}),n({type:`success`,message:$(`sessions.session_terminated`)})},onError:e=>{n({type:`error`,message:e?.message||$(`sessions.failed_terminate_session`)})}}),h=rt({mutationFn:async({userId:e,exceptCurrent:t})=>{let n=new URLSearchParams({user_id:e.toString(),wcpos:`1`});return t&&n.append(`except_current`,`true`),(0,i.default)({path:`/wcpos/v1/auth/sessions?${n.toString()}`,method:`DELETE`})},onSuccess:()=>{t.invalidateQueries({queryKey:[`sessions`]}),n({type:`success`,message:$(`sessions.sessions_terminated`)})},onError:e=>{n({type:`error`,message:e?.message||$(`sessions.failed_terminate_sessions`)})}}),g=m.isPending||h.isPending,v=()=>{u&&(u.kind===`session`?m.mutate({userId:u.userId,jti:u.jti},{onSettled:()=>d(null)}):h.mutate({userId:u.userId,exceptCurrent:u.exceptCurrent},{onSettled:()=>d(null)}))},b=Math.floor(nh(o,3e4)/1e3),x=p!==null&&b-p.last_active<=Eh,S=e.useMemo(()=>u?u.kind===`session`?{title:$(`sessions.terminate_session_title`),description:u.isCurrent?$(`sessions.confirm_terminate_current`):$(`sessions.confirm_terminate_session`),confirmLabel:$(`sessions.terminate`)}:{title:u.exceptCurrent?$(`sessions.terminate_other_title`):$(`sessions.terminate_all_title`),description:u.exceptCurrent?$(`sessions.confirm_logout_other_devices`):$(`sessions.confirm_logout_all_devices`),confirmLabel:u.exceptCurrent?$(`sessions.logout_other_devices`):$(`sessions.logout_all`)}:null,[u]);return(0,_.jsxs)(`div`,{className:`wcpos:p-4`,children:[(0,_.jsx)(`div`,{className:`wcpos:mb-3`,"data-testid":`sessions-manage-description`,children:(0,_.jsx)(Kl,{status:`info`,isDismissible:!1,children:$(`sessions.manage_description`)})}),s.length===0?(0,_.jsx)(Kl,{status:`info`,children:$(`sessions.no_active_sessions`)}):(0,_.jsxs)(`div`,{className:`wcpos:grid wcpos:grid-cols-[minmax(0,18rem)_1fr] wcpos:gap-4 wcpos:min-h-[32rem]`,children:[(0,_.jsx)(`aside`,{className:`wcpos:border-r wcpos:border-gray-200 wcpos:pr-4`,children:(0,_.jsx)(Th,{users:s,selectedUserId:f,currentUserId:r,nowSeconds:b,activeNowThresholdSeconds:Eh,onSelect:l})}),(0,_.jsx)(`section`,{children:p?(0,_.jsx)(Sh,{user:p,isYou:r!==null&&p.user_id===r,isActiveNow:x,isDeleting:g,onDeleteSession:e=>{let t=p.sessions.find(t=>t.jti===e);d({kind:`session`,userId:p.user_id,jti:e,isCurrent:!!t?.is_current})},onDeleteAll:e=>d({kind:`all`,userId:p.user_id,exceptCurrent:e})}):(0,_.jsx)(`div`,{className:`wcpos:flex wcpos:h-full wcpos:items-center wcpos:justify-center wcpos:text-sm wcpos:text-gray-500`,children:$(`sessions.select_user`)})})]}),u&&S&&(0,_.jsx)(Gp,{open:!!u,title:S.title,description:S.description,confirmLabel:S.confirmLabel,isSubmitting:g,onConfirm:v,onClose:()=>{g||d(null)}})]})}function Ah(){return(0,_.jsx)(e.Suspense,{fallback:(0,_.jsx)(Bu,{}),children:(0,_.jsx)(kh,{})})}var jh=ba({component:Wu}),Mh=va({getParentRoute:()=>jh,path:`/`,beforeLoad:()=>{throw fn({to:`/general`})}}),Nh=e=>()=>{su.prefetchQuery({queryKey:[e],queryFn:()=>(0,i.default)({path:`wcpos/v1/settings/${e}?wcpos=1`,method:`GET`}),retry:1})},Ph=va({getParentRoute:()=>jh,path:`/general`,loader:()=>{Nh(`general`)(),Nh(`tax_ids`)()},component:Gm}),Fh=va({getParentRoute:()=>jh,path:`/checkout`,loader:Nh(`checkout`),component:Yf}),Ih=va({getParentRoute:()=>jh,path:`/cloud-print`,loader:Nh(`cloud-print`),component:am}),Lh=va({getParentRoute:()=>jh,path:`/access`,loader:Nh(`access`),component:Qu}),Rh=va({getParentRoute:()=>jh,path:`/sessions`,component:Ah}),zh=va({getParentRoute:()=>jh,path:`/extensions`,loader:()=>{su.prefetchQuery({queryKey:[`extensions`],queryFn:()=>(0,i.default)({path:`wcpos/v1/extensions?wcpos=1`,method:`GET`}),retry:1})},component:hm}),Bh=va({getParentRoute:()=>jh,path:`/logs`,component:mh}),Vh=va({getParentRoute:()=>jh,path:`/license`,loader:Nh(`license`),component:qm}),Hh=Ra({routeTree:jh.addChildren([Mh,Ph,Fh,Ih,Lh,Rh,zh,Bh,Vh]),basepath:`/`,history:Xn()});function Uh(){return(0,_.jsx)(Ga,{FallbackComponent:ql,children:(0,_.jsxs)(b,{client:su,children:[(0,_.jsx)(Yl,{children:(0,_.jsx)(zo,{children:(0,_.jsx)(Va,{router:Hh})})}),(0,_.jsx)(it,{initialIsOpen:!1})]})})}var Wh=null;Hh.subscribe(`onResolved`,({toLocation:e})=>{let t=e.pathname.replace(/^\/+/,``);t!==Wh&&(Wh=t,nu(t))});var Gh=document.getElementById(`woocommerce-pos-settings`);Gh&&(0,t.createRoot)(Gh).render((0,_.jsx)(Uh,{}))})(globalThis.React,globalThis.ReactDOM,globalThis.ReactDOM,globalThis.lodash,globalThis.wp.apiFetch,globalThis.wp.url);