| 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),t=m(t),i=m(i);var g=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(){}},_=new class extends g{#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`}},v={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},y=new class{#e=v;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 b(e){setTimeout(e,0)}var x=typeof window>`u`||`Deno`in globalThis;function S(){}function C(e,t){return typeof e==`function`?e(t):e}function w(e){return typeof e==`number`&&e>=0&&e!==1/0}function T(e,t){return Math.max(e+(t||0)-Date.now(),0)}function E(e,t){return typeof e==`function`?e(t):e}function D(e,t){return typeof e==`function`?e(t):e}function O(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==A(o,t.options))return!1}else if(!M(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 k(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(j(t.options.mutationKey)!==j(a))return!1}else if(!M(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function A(e,t){return(t?.queryKeyHashFn||j)(e)}function j(e){return JSON.stringify(e,(e,t)=>ne(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function M(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(!M(e[n],t[n]))return!1;return!0}let n=Object.keys(t);for(let r of n)if(!M(e[r],t[r]))return!1;return!0}return!1}var N=Object.prototype.hasOwnProperty;function ee(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=P(e)&&P(t);if(!r&&!(ne(e)&&ne(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:N.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 te(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 P(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function ne(e){if(!re(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!re(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function re(e){return Object.prototype.toString.call(e)===`[object Object]`}function ie(e){return new Promise(t=>{y.setTimeout(t,e)})}function ae(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:ee(e,t)}function oe(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function se(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var F=Symbol();function ce(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===F?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function le(e,t){return typeof e==`function`?e(...t):!!e}function ue(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 de=(()=>{let e=()=>x;return{isServer(){return e()},setIsServer(t){e=t}}})();function fe(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}var pe=b;function me(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=pe,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 I=me(),he=new class extends g{#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 ge(e){return Math.min(1e3*2**e,3e4)}function _e(e){return(e??`online`)!==`online`||he.isOnline()}var ve=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function ye(e){let t=!1,n=0,r,i=fe(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new ve(t);f(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>_.isFocused()&&(e.networkMode===`always`||he.isOnline())&&e.canRun(),u=()=>_e(e.networkMode)&&e.canRun(),d=e=>{a()||(r?.(),i.resolve(e))},f=e=>{a()||(r?.(),i.reject(e))},p=()=>new Promise(t=>{r=e=>{(a()||l())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,a()||e.onContinue?.()}),m=()=>{if(a())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(d).catch(r=>{if(a())return;let i=e.retry??(de.isServer()?0:3),o=e.retryDelay??ge,s=typeof o==`function`?o(n,r):o,c=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!c){f(r);return}n++,e.onFail?.(n,r),ie(s).then(()=>l()?void 0:p()).then(()=>{t?f(r):m()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r?.(),i),cancelRetry:s,continueRetry:c,canStart:u,start:()=>(u()?m():p().then(m),i)}}var be=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),w(this.gcTime)&&(this.#e=y.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(de.isServer()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(y.clearTimeout(this.#e),this.#e=void 0)}};function xe(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=>{ue(e,()=>t.signal,()=>n=!0)},u=ce(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?se:oe;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?Ce:Se,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:Se(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 Se(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 Ce(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var we=class extends be{#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=De(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=De(this.options);e.data!==void 0&&(this.setState(Ee(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=ae(this.state.data,e,this.options);return this.#l({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#l({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(S).catch(S):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=>D(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===F||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>E(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:!T(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){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#a&&(this.#s||this.#c()?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}#c(){return this.state.fetchStatus===`paused`&&this.state.status===`pending`}invalidate(){this.state.isInvalidated||this.#l({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=ce(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`?xe(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#l({type:`fetch`,meta:a.fetchOptions?.meta}),this.#a=ye({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof ve&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#l({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#l({type:`pause`})},onContinue:()=>{this.#l({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#a.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 ve){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#l({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#l(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,...Te(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...Ee(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),I.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function Te(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:_e(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function Ee(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function De(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 Oe=class extends g{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=fe(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Ae(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return je(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return je(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 D(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&&!te(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Me(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||D(this.options.enabled,this.#t)!==D(t.enabled,this.#t)||E(this.options.staleTime,this.#t)!==E(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||D(this.options.enabled,this.#t)!==D(t.enabled,this.#t)||i!==this.#p)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return Pe(this,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),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.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);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(S)),t}#g(){this.#b();let e=E(this.options.staleTime,this.#t);if(de.isServer()||this.#r.isStale||!w(e))return;let t=T(this.#r.dataUpdatedAt,e)+1;this.#d=y.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.#p=e,!(de.isServer()||D(this.options.enabled,this.#t)===!1||!w(this.#p)||this.#p===0)&&(this.#f=y.setInterval(()=>{(this.options.refetchIntervalInBackground||_.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(y.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(y.clearInterval(this.#f),this.#f=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&&Ae(e,t),o=i&&Me(e,n,t,r);(a||o)&&(l={...l,...Te(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.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(m=`success`,d=ae(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h)if(i&&d===a?.data&&t.select===this.#c)d=this.#l;else try{this.#c=t.select,d=t.select(d),d=ae(i?.data,d,t),this.#l=d,this.#s=null}catch(e){this.#s=e}this.#s&&(f=this.#s,d=this.#l,p=Date.now(),m=`error`);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0,x={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:Ne(e,t),refetch:this.refetch,promise:this.#o,isEnabled:D(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=x.data!==void 0,r=x.status===`error`&&!t,i=e=>{r?e.reject(x.error):t&&e.resolve(x.data)},a=()=>{let e=this.#o=x.promise=fe();i(e)},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||x.data!==o.value)&&a();break;case`rejected`:(!r||x.error!==o.reason)&&a()}}return x}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!te(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);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)})})()}))}#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()}#C(e){I.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function ke(e,t){return D(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||D(t.retryOnMount,e)!==!1)}function Ae(e,t){return ke(e,t)||e.state.data!==void 0&&je(e,t,t.refetchOnMount)}function je(e,t,n){if(D(t.enabled,e)!==!1&&E(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&Ne(e,t)}return!1}function Me(e,t,n,r){return(e!==t||D(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&Ne(e,n)}function Ne(e,t){return D(t.enabled,e)!==!1&&e.isStaleByTime(E(t.staleTime,e))}function Pe(e,t){return!te(e.getCurrentResult(),t)}var Fe=class extends be{#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.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=ye({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)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),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:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}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.#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),I.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 g{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;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(){I.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=>k(t,e))}findAll(e={}){return this.getAll().filter(t=>k(e,t))}notify(e){I.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return I.batch(()=>Promise.all(e.map(e=>e.continue().catch(S))))}};function Re(e){return e.options.scope?.id}var ze=class extends g{#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),te(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&j(t.mutationKey)!==j(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}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){I.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 g{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??A(r,t),a=this.get(i);return a||(a=new we({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(){I.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=>O(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>O(e,t)):t}notify(e){I.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){I.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){I.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=_.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=he.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(E(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=C(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return I.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;I.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return I.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=I.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(S).catch(S)}invalidateQueries(e,t={}){return I.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=I.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(S)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(S)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(E(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(S).catch(S)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(S).catch(S)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return he.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(j(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{M(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(j(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{M(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||=A(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===F&&(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=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})),L=f(((e,t)=>{t.exports=He()}))(),Ue=h.createContext(void 0),We=e=>{let t=h.useContext(Ue);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},Ge=({client:e,children:t})=>(h.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,L.jsx)(Ue.Provider,{value:e,children:t})),Ke=h.createContext(!1),qe=()=>h.useContext(Ke);Ke.Provider;function Je(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Ye=h.createContext(Je()),Xe=()=>h.useContext(Ye),Ze=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?le(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},Qe=e=>{h.useEffect(()=>{e.clearReset()},[e])},$e=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||le(n,[e.error,r])),et=(e,t)=>t.state.data===void 0,tt=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))}},nt=(e,t)=>e.isLoading&&e.isFetching&&!t,rt=(e,t)=>e?.suspense&&t.isPending,it=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function at(e,t,n){let r=qe(),i=Xe(),a=We(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,tt(o),Ze(o,i,s),Qe(i);let l=!a.getQueryCache().get(o.queryHash),[u]=h.useState(()=>new t(a,o)),d=u.getOptimisticResult(o),f=!r&&c;if(h.useSyncExternalStore(h.useCallback(e=>{let t=f?u.subscribe(I.batchCalls(e)):S;return u.updateResult(),t},[u,f]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),h.useEffect(()=>{u.setOptions(o)},[o,u]),rt(o,d))throw it(o,u,i);if($e({result:d,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw d.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,d),o.experimental_prefetchInRender&&!de.isServer()&&nt(d,r)&&(l?it(o,u,i):s?.promise)?.catch(S).finally(()=>{u.updateResult()}),o.notifyOnChangeProps?d:u.trackResult(d)}function ot(e,t){return at(e,Oe,t)}function st(e,t){return at({...e,enabled:!0,suspense:!0,throwOnError:et,placeholderData:void 0},Oe,t)}function ct(e,t){let n=We(t),[r]=h.useState(()=>new ze(n,e));h.useEffect(()=>{r.setOptions(e)},[r,e]);let i=h.useSyncExternalStore(h.useCallback(e=>r.subscribe(I.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=h.useCallback((e,t)=>{r.mutate(e,t).catch(S)},[r]);if(i.error&&le(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}var lt=function(){return null},ut=typeof window<`u`?h.useLayoutEffect:h.useEffect;function dt(e){let t=h.useRef({value:e,prev:null}),n=t.current.value;return e!==n&&(t.current={value:e,prev:n}),t.current.prev}function ft(e,t,n={},r={}){h.useEffect(()=>{if(!e.current||r.disabled||typeof IntersectionObserver!=`function`)return;let i=new IntersectionObserver(([e])=>{t(e)},n);return i.observe(e.current),()=>{i.disconnect()}},[t,n,r.disabled,e])}function pt(e){let t=h.useRef(null);return h.useImperativeHandle(e,()=>t.current,[]),t}function mt(e){return e[e.length-1]}function ht(e){return typeof e==`function`}function gt(e,t){return ht(e)?e(t):e}var _t=Object.prototype.hasOwnProperty,vt=Object.prototype.propertyIsEnumerable;function yt(e){for(let t in e)if(_t.call(e,t))return!0;return!1}var bt=()=>Object.create(null),xt=(e,t)=>St(e,t,bt);function St(e,t,n=()=>({}),r=0){if(e===t)return e;if(r>500)return t;let i=t,a=Et(e)&&Et(i);if(!a&&!(wt(e)&&wt(i)))return i;let o=a?e:Ct(e);if(!o)return i;let s=a?i:Ct(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:_t.call(e,o))&&d++;continue}if(l===null||f===null||typeof l!=`object`||typeof f!=`object`){u[o]=f;continue}let p=St(l,f,n,r+1);u[o]=p,p===l&&d++}return c===l&&d===c?e:u}function Ct(e){let t=Object.getOwnPropertyNames(e);for(let n of t)if(!vt.call(e,n))return!1;let n=Object.getOwnPropertySymbols(e);if(n.length===0)return t;let r=t;for(let t of n){if(!vt.call(e,t))return!1;r.push(t)}return r}function wt(e){if(!Tt(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!Tt(n)||!n.hasOwnProperty(`isPrototypeOf`))}function Tt(e){return Object.prototype.toString.call(e)===`[object Object]`}function Et(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Dt(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(!Dt(e[r],t[r],n))return!1;return!0}if(wt(e)&&wt(t)){let r=n?.ignoreUndefined??!0;if(n?.partial){for(let i in t)if((!r||t[i]!==void 0)&&!Dt(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||!Dt(e[o],t[o],n)))return!1;return i===a}return!1}function Ot(e){let t,n,r=new Promise((e,r)=>{t=e,n=r});return r.status=`pending`,r.resolve=n=>{r.status=`resolved`,r.value=n,t(n),e?.(n)},r.reject=e=>{r.status=`rejected`,n(e)},r}function kt(e){return!!(e&&typeof e==`object`&&typeof e.then==`function`)}var At=/[\x00-\x1f\x7f"<>`{}]/g;function jt(e){return e.replace(At,e=>`%`+e.charCodeAt(0).toString(16).toUpperCase().padStart(2,`0`))}function Mt(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 jt(t)}var Nt=[`http:`,`https:`,`mailto:`,`tel:`];function Pt(e,t){if(!e)return!1;try{let n=new URL(e);return!t.has(n.protocol)}catch{return!1}}function Ft(e){if(!e||!/[%\\\x00-\x1f\x7f]/.test(e)&&!e.startsWith(`//`))return{path:e,handledProtocolRelativeURL:!1};let t=/%25|%5C/gi,n=0,r=``,i;for(;(i=t.exec(e))!==null;)r+=Mt(e.slice(n,i.index))+i[0],n=t.lastIndex;r+=Mt(n?e.slice(n):e);let a=!1;return r.startsWith(`//`)&&(a=!0,r=`/`+r.replace(/^\/+/,``)),{path:r,handledProtocolRelativeURL:a}}function It(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function Lt(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 Rt(){throw Error(`Invariant failed`)}function zt(e){let t=new Map,n,r,i=e=>{e.next&&(e.prev?(e.prev.next=e.next,e.next.prev=e.prev,e.next=void 0,r&&(r.next=e,e.prev=r)):(e.next.prev=void 0,n=e.next,e.next=void 0,r&&(e.prev=r,r.next=e)),r=e)};return{get(e){let n=t.get(e);if(n)return i(n),n.value},set(a,o){if(t.size>=e&&n){let e=n;t.delete(e.key),e.next&&(n=e.next,e.next.prev=void 0),e===r&&(r=void 0)}let s=t.get(a);if(s)s.value=o,i(s);else{let e={key:a,value:o,prev:r};r&&(r.next=e),r=e,n||=e,t.set(a,e)}},clear(){t.clear(),n=void 0,r=void 0}}}var Bt=4,Vt=5;function Ht(e){let t=e.indexOf(`{`);if(t===-1)return null;let n=e.indexOf(`}`,t);return n===-1||t+1>=e.length?null:[t,n]}function Ut(e,t,n=new Uint16Array(6)){let r=e.indexOf(`/`,t),i=r===-1?e.length:r,a=e.substring(t,i);if(!a||!a.includes(`$`))return n[0]=0,n[1]=t,n[2]=t,n[3]=i,n[4]=i,n[5]=i,n;if(a===`$`){let r=e.length;return n[0]=2,n[1]=t,n[2]=t,n[3]=r,n[4]=r,n[5]=r,n}if(a.charCodeAt(0)===36)return n[0]=1,n[1]=t,n[2]=t+1,n[3]=i,n[4]=i,n[5]=i,n;let o=Ht(a);if(o){let[r,s]=o,c=a.charCodeAt(r+1);if(c===45){if(r+2<a.length&&a.charCodeAt(r+2)===36){let e=r+3,a=s;if(e<a)return n[0]=3,n[1]=t+r,n[2]=t+e,n[3]=t+a,n[4]=t+s+1,n[5]=i,n}}else if(c===36){let a=r+1,o=r+2;return o===s?(n[0]=2,n[1]=t+r,n[2]=t+a,n[3]=t+o,n[4]=t+s+1,n[5]=e.length,n):(n[0]=1,n[1]=t+r,n[2]=t+o,n[3]=t+s,n[4]=t+s+1,n[5]=i,n)}}return n[0]=0,n[1]=t,n[2]=t,n[3]=i,n[4]=i,n[5]=i,n}function Wt(e,t,n,r,i,a,o){o?.(n);let s=r;{let r=n.fullPath??n.from,o=r.length,c=n.options?.caseSensitive??e,l=n.options?.params?.parse??n.options?.parseParams;for(;s<o;){let e=Ut(r,s,t),o,u=s,d=e[5];switch(s=d+1,a++,e[0]){case 0:{let t=r.substring(e[2],e[3]);if(c){let e=i.static?.get(t);if(e)o=e;else{i.static??=new Map;let e=qt(n.fullPath??n.from);e.parent=i,e.depth=a,o=e,i.static.set(t,e)}}else{let e=t.toLowerCase(),r=i.staticInsensitive?.get(e);if(r)o=r;else{i.staticInsensitive??=new Map;let t=qt(n.fullPath??n.from);t.parent=i,t.depth=a,o=t,i.staticInsensitive.set(e,t)}}break}case 1:{let t=r.substring(u,e[1]),s=r.substring(e[4],d),f=c&&!!(t||s),p=t?f?t:t.toLowerCase():void 0,m=s?f?s:s.toLowerCase():void 0,h=!l&&i.dynamic?.find(e=>!e.parse&&e.caseSensitive===f&&e.prefix===p&&e.suffix===m);if(h)o=h;else{let e=Jt(1,n.fullPath??n.from,f,p,m);o=e,e.depth=a,e.parent=i,i.dynamic??=[],i.dynamic.push(e)}break}case 3:{let t=r.substring(u,e[1]),s=r.substring(e[4],d),f=c&&!!(t||s),p=t?f?t:t.toLowerCase():void 0,m=s?f?s:s.toLowerCase():void 0,h=!l&&i.optional?.find(e=>!e.parse&&e.caseSensitive===f&&e.prefix===p&&e.suffix===m);if(h)o=h;else{let e=Jt(3,n.fullPath??n.from,f,p,m);o=e,e.parent=i,e.depth=a,i.optional??=[],i.optional.push(e)}break}case 2:{let t=r.substring(u,e[1]),s=r.substring(e[4],d),l=c&&!!(t||s),f=t?l?t:t.toLowerCase():void 0,p=s?l?s:s.toLowerCase():void 0,m=Jt(2,n.fullPath??n.from,l,f,p);o=m,m.parent=i,m.depth=a,i.wildcard??=[],i.wildcard.push(m)}}i=o}if(l&&n.children&&!n.isRoot&&n.id&&n.id.charCodeAt(n.id.lastIndexOf(`/`)+1)===95){let e=qt(n.fullPath??n.from);e.kind=Vt,e.parent=i,a++,e.depth=a,i.pathless??=[],i.pathless.push(e),i=e}let u=(n.path||!n.children)&&!n.isRoot;if(u&&r.endsWith(`/`)){let e=qt(n.fullPath??n.from);e.kind=Bt,e.parent=i,a++,e.depth=a,i.index=e,i=e}i.parse=l??null,i.priority=n.options?.params?.priority??0,u&&!i.route&&(i.route=n,i.fullPath=n.fullPath??n.from)}if(n.children)for(let r of n.children)Wt(e,t,r,s,i,a,o)}function Gt(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 Kt(e){if(e.pathless)for(let t of e.pathless)Kt(t);if(e.static)for(let t of e.static.values())Kt(t);if(e.staticInsensitive)for(let t of e.staticInsensitive.values())Kt(t);if(e.dynamic?.length){e.dynamic.sort(Gt);for(let t of e.dynamic)Kt(t)}if(e.optional?.length){e.optional.sort(Gt);for(let t of e.optional)Kt(t)}if(e.wildcard?.length){e.wildcard.sort(Gt);for(let t of e.wildcard)Kt(t)}}function qt(e){return{kind:0,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:e,parent:null,parse:null,priority:0}}function Jt(e,t,n,r,i){return{kind:e,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:t,parent:null,parse:null,priority:0,caseSensitive:n,prefix:r,suffix:i}}function Yt(e,t){let n=qt(`/`),r=new Uint16Array(6);for(let t of e)Wt(!1,r,t,1,n,0);Kt(n),t.masksTree=n,t.flatCache=zt(1e3)}function Xt(e,t){e||=`/`;let n=t.flatCache.get(e);if(n)return n;let r=tn(e,t.masksTree);return t.flatCache.set(e,r),r}function Zt(e,t,n,r,i){e||=`/`,r||=`/`;let a=t?`case\0${e}`:e,o=i.singleCache.get(a);return o||(o=qt(`/`),Wt(t,new Uint16Array(6),{from:e},1,o,0),i.singleCache.set(a,o)),tn(r,o,n)}function Qt(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=tn(e,t.segmentTree,n)}catch(e){if(e instanceof URIError)a=null;else throw e}return a&&(a.branch=rn(a.route)),t.matchCache.set(r,a),a}function $t(e){return e===`/`?e:e.replace(/\/{1,}$/,``)}function en(e,t=!1,n){let r=qt(e.fullPath),i=new Uint16Array(6),a={},o={},s=0;return Wt(t,i,e,1,r,0,e=>{if(n?.(e,s),e.id in a&&Rt(),a[e.id]=e,s!==0&&e.path){let t=$t(e.fullPath);(!o[t]||e.fullPath.endsWith(`/`))&&(o[t]=e)}s++}),Kt(r),{processedTree:{segmentTree:r,singleCache:zt(1e3),matchCache:zt(1e3),flatCache:null,masksTree:null},routesById:a,routesByPath:o}}function tn(e,t,n=!1){let r=e.split(`/`),i=on(e,r,t,n);if(!i)return null;let[a]=nn(e,r,i);return{route:i.node.route,rawParams:a}}function nn(e,t,n){let r=an(n.node),i=null,a=Object.create(null),o=n.extract?.part??0,s=n.extract?.node??0,c=n.extract?.path??0,l=n.extract?.segment??0;for(;s<r.length;o++,s++,c++,l++){let u=r[s];if(u.kind===Bt)break;if(u.kind===Vt){l--,o--,c--;continue}let d=t[o],f=c;if(d&&(c+=d.length),u.kind===1){i??=n.node.fullPath.split(`/`);let e=i[l],t=u.prefix?.length??0;if(e.charCodeAt(t)===123){let n=u.suffix?.length??0,r=e.substring(t+2,e.length-n-1),i=d.substring(t,d.length-n);a[r]=decodeURIComponent(i)}else{let t=e.substring(1);a[t]=decodeURIComponent(d)}}else if(u.kind===3){if(n.skipped&1<<s){o--,c=f-1;continue}i??=n.node.fullPath.split(`/`);let e=i[l],t=u.prefix?.length??0,r=u.suffix?.length??0,p=e.substring(t+3,e.length-r-1),m=u.suffix||u.prefix?d.substring(t,d.length-r):d;m&&(a[p]=decodeURIComponent(m))}else if(u.kind===2){let t=u,n=e.substring(f+(t.prefix?.length??0),e.length-(t.suffix?.length??0)),r=decodeURIComponent(n);a[`*`]=r,a._splat=r;break}}return n.rawParams&&Object.assign(a,n.rawParams),[a,{part:o,node:s,path:c,segment:l}]}function rn(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 on(e,t,n,r){if(e===`/`&&n.index)return{node:n.index,skipped:0};let i=!mt(t),a=i&&e!==`/`,o=t.length-+!!i,s=[{node:n,index:1,skipped:0,depth:1,statics:0,dynamics:0,optionals:0}],c=null,l=null;for(;s.length;){let n=s.pop(),{node:i,index:u,skipped:d,depth:f,statics:p,dynamics:m,optionals:h}=n,{extract:g,rawParams:_}=n;if(i.kind===2&&i.route&&!un(l,n))continue;if(i.parse){if(!ln(e,t,n))continue;_=n.rawParams,g=n.extract}r&&i.route&&i.kind!==Bt&&un(c,n)&&(c=n);let v=u===o;if(v&&(i.route&&(!a||i.kind===Bt||i.kind===2)&&un(l,n)&&(l=n),!i.optional&&!i.wildcard&&!i.index&&!i.pathless))continue;let y=v?void 0:t[u],b;if(v&&i.index){let n={node:i.index,index:u,skipped:d,depth:f+1,statics:p,dynamics:m,optionals:h,extract:g,rawParams:_},r=!0;if(i.index.parse&&(ln(e,t,n)||(r=!1)),r){if(!m&&!h&&!d&&cn(p,o))return n;un(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&&(v||!(n.caseSensitive?y:b??=y.toLowerCase()).startsWith(r)))){if(a){if(v)continue;let e=t.slice(u).join(`/`).slice(-a.length);if((n.caseSensitive?e:e.toLowerCase())!==a)continue}s.push({node:n,index:o,skipped:d,depth:f+1,statics:p,dynamics:m,optionals:h,extract:g,rawParams:_})}}if(i.optional){let e=d|1<<f,t=f+1;for(let n=i.optional.length-1;n>=0;n--){let r=i.optional[n];s.push({node:r,index:u,skipped:e,depth:t,statics:p,dynamics:m,optionals:h,extract:g,rawParams:_})}if(!v)for(let e=i.optional.length-1;e>=0;e--){let n=i.optional[e],{prefix:r,suffix:a}=n;if(r||a){let e=n.caseSensitive?y:b??=y.toLowerCase();if(r&&!e.startsWith(r)||a&&!e.endsWith(a))continue}s.push({node:n,index:u+1,skipped:d,depth:t,statics:p,dynamics:m,optionals:h+sn(o,u),extract:g,rawParams:_})}}if(!v&&i.dynamic&&y)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?y:b??=y.toLowerCase();if(n&&!e.startsWith(n)||r&&!e.endsWith(r))continue}s.push({node:t,index:u+1,skipped:d,depth:f+1,statics:p,dynamics:m+sn(o,u),optionals:h,extract:g,rawParams:_})}if(!v&&i.staticInsensitive){let e=i.staticInsensitive.get(b??=y.toLowerCase());e&&s.push({node:e,index:u+1,skipped:d,depth:f+1,statics:p+sn(o,u),dynamics:m,optionals:h,extract:g,rawParams:_})}if(!v&&i.static){let e=i.static.get(y);e&&s.push({node:e,index:u+1,skipped:d,depth:f+1,statics:p+sn(o,u),dynamics:m,optionals:h,extract:g,rawParams:_})}if(i.pathless){let e=f+1;for(let t=i.pathless.length-1;t>=0;t--){let n=i.pathless[t];s.push({node:n,index:u,skipped:d,depth:e,statics:p,dynamics:m,optionals:h,extract:g,rawParams:_})}}}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 sn(e,t){return 2**(e-t-1)}function cn(e,t){return e===2**(t-1)-1}function ln(e,t,n){let r,i;try{[r,i]=nn(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 un(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===Bt)>(e.node.kind===Bt)||t.node.kind===Bt==(e.node.kind===Bt)&&t.depth>e.depth)))}function dn(e){return fn(e.filter(e=>e!==void 0).join(`/`))}function fn(e){return e.replace(/\/{2,}/g,`/`)}function pn(e){return e===`/`?e:e.replace(/^\/{1,}/,``)}function mn(e){let t=e.length;return t>1&&e[t-1]===`/`?e.replace(/\/{1,}$/,``):e}function hn(e){return mn(pn(e))}function gn(e,t){return e?.endsWith(`/`)&&e!==`/`&&e!==`${t}/`?e.slice(0,-1):e}function _n(e,t,n){return gn(e,n)===gn(t,n)}function vn({base:e,to:t,trailingSlash:n=`never`,cache:r}){let i=t.startsWith(`/`),a=!i&&t===`.`,o;if(r){o=i?t:a?e:e+`\0`+t;let n=r.get(o);if(n)return n}let s;if(a)s=e.split(`/`);else if(i)s=t.split(`/`);else{for(s=e.split(`/`);s.length>1&&mt(s)===``;)s.pop();let n=t.split(`/`);for(let e=0,t=n.length;e<t;e++){let r=n[e];r===``?e?e===t-1&&s.push(r):s=[r]:r===`..`?s.pop():r===`.`||s.push(r)}}s.length>1&&(mt(s)===``?n===`never`&&s.pop():n===`always`&&s.push(``));let c=fn(s.join(`/`))||`/`;return o&&r&&r.set(o,c),c}function yn(e){let t=new Map(e.map(e=>[encodeURIComponent(e),e])),n=Array.from(t.keys()).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`),r=new RegExp(n,`g`);return e=>e.replace(r,e=>t.get(e)??e)}function bn(e,t,n){let r=t[e];return typeof r==`string`?e===`_splat`?/^[a-zA-Z0-9\-._~!/]*$/.test(r)?r:r.split(`/`).map(e=>Sn(e,n)).join(`/`):Sn(r,n):r}function xn({path:e,params:t,decoder:n,...r}){let i=!1,a=Object.create(null);if(!e||e===`/`)return{interpolatedPath:`/`,usedParams:a,isMissingParams:i};if(!e.includes(`$`))return{interpolatedPath:e,usedParams:a,isMissingParams:i};let o=e.length,s=0,c,l=``;for(;s<o;){let r=s;c=Ut(e,r,c);let o=c[5];if(s=o+1,r===o)continue;let u=c[0];if(u===0){l+=`/`+e.substring(r,o);continue}if(u===2){let s=t._splat;a._splat=s,a[`*`]=s;let u=e.substring(r,c[1]),d=e.substring(c[4],o);if(!s){i=!0,(u||d)&&(l+=`/`+u+d);continue}let f=bn(`_splat`,t,n);l+=`/`+u+f+d;continue}if(u===1){let s=e.substring(c[2],c[3]);!i&&!(s in t)&&(i=!0),a[s]=t[s];let u=e.substring(r,c[1]),d=e.substring(c[4],o),f=bn(s,t,n)??`undefined`;l+=`/`+u+f+d;continue}if(u===3){let i=e.substring(c[2],c[3]),s=t[i];if(s==null)continue;a[i]=s;let u=e.substring(r,c[1]),d=e.substring(c[4],o),f=bn(i,t,n)??``;l+=`/`+u+f+d;continue}}return e.endsWith(`/`)&&(l+=`/`),{usedParams:a,interpolatedPath:l||`/`,isMissingParams:i}}function Sn(e,t){let n=encodeURIComponent(e);return t?.(n)??n}function R(e){return e?.isNotFound===!0}function Cn(){try{return sessionStorage}catch{return}}var wn=`tsr-scroll-restoration-v1_3`,Tn=Cn();function En(){try{return JSON.parse(Tn?.getItem(`tsr-scroll-restoration-v1_3`)||`{}`)}catch{return{}}}function Dn(){try{Tn?.setItem(wn,JSON.stringify(On))}catch{}}var On=En(),kn=`data-scroll-restoration-id`,An=e=>e.state.__TSR_key||e.href;function jn(e){let t=e.getAttribute(kn);if(t)return`[${kn}="${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 Mn=!1,Nn=`window`;function Pn(e){try{return typeof e==`function`?e():document.querySelector(e)}catch{}}function Fn(e){let t=new Set;for(let n of e){if(n===Nn)continue;let e=Pn(n);e&&t.add(e)}return t}function In(e,t){let n=t??e.options.scrollRestoration,r=e._scroll;n&&(r.restoring=!0);let i=e.options.getScrollRestorationKey||An,a=new Set,o=e=>{let t=On[e]||={};for(let e of a)e===document?t[Nn]={scrollX,scrollY}:e.isConnected&&(t[jn(e)]={scrollX:e.scrollLeft,scrollY:e.scrollTop})};n&&!r.restoration&&(r.restoration=!0,Mn=!1,history.scrollRestoration=`manual`,document.addEventListener(`scroll`,e=>{Mn||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())),Dn()})),!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=On[d];if(e){let t=On[u];for(let n in e){if(n===Nn){if(s)continue}else{let e=Pn(n);if(!e||s&&o&&(l??=Fn(o),l.has(e)))continue}t||=On[u]={},t[n]??=e[n]}}}Mn=!0;try{let e=t.toLocation.hash,i=t.toLocation.state.__hashScrollIntoViewOptions??!0,a=!1;if(s){!e&&o&&(l??=Fn(o));let t=e&&i&&c,s=r.restoring?On[u]:void 0;if(s)for(let e in s){let{scrollX:r,scrollY:i}=s[e];if(e===Nn){if(t)continue;scrollTo({top:i,left:r,behavior:n}),a=!0}else{let t=Pn(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{Mn=!1}}))}function Ln(e,t=String){let n=new URLSearchParams;for(let r in e){let i=e[r];i!==void 0&&n.set(r,t(i))}return n.toString()}function Rn(e){return e?e===`false`?!1:e===`true`?!0:e*0==0&&+e+``===e?+e:e:``}function zn(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 Bn=Hn(JSON.parse),Vn=Un(JSON.stringify,JSON.parse);function Hn(e){return t=>{t[0]===`?`&&(t=t.substring(1));let n=zn(t);for(let t in n){let r=n[t];if(typeof r==`string`)try{n[t]=e(r)}catch{}}return n}}function Un(e,t){let n=typeof t==`function`;function r(r){if(typeof r==`object`&&r)try{return e(r)}catch{}else if(n&&typeof r==`string`)try{return t(r),e(r)}catch{}return r}return e=>{let t=Ln(e,r);return t?`?${t}`:``}}var Wn=`__root__`;function Gn(e){if(e.statusCode=e.statusCode||e.code||307,!e._builtLocation&&!e.reloadDocument&&typeof e.href==`string`)try{new URL(e.href),e.reloadDocument=!0}catch{}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 z(e){return e instanceof Response&&!!e.options}function Kn(e){return{input:({url:t})=>{for(let n of e)t=Jn(n,t);return t},output:({url:t})=>{for(let n=e.length-1;n>=0;n--)t=Yn(e[n],t);return t}}}function qn(e){let t=hn(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=dn([`/`,t,e.pathname]),e)}}function Jn(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 Yn(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 Xn(e,t){let{createMutableStore:n,createReadonlyStore:r,batch:i,init:a}=t,o=new Map,s=new Map,c=new Map,l=n(e.status),u=n(e.loadedAt),d=n(e.isLoading),f=n(e.isTransitioning),p=n(e.location),m=n(e.resolvedLocation),h=n(e.statusCode),g=n(e.redirect),_=n([]),v=n([]),y=n([]),b=r(()=>Zn(o,_.get())),x=r(()=>Zn(s,v.get())),S=r(()=>Zn(c,y.get())),C=r(()=>_.get()[0]),w=r(()=>_.get().some(e=>o.get(e)?.get().status===`pending`)),T=r(()=>({locationHref:p.get().href,resolvedLocationHref:m.get()?.href,status:l.get()})),E=r(()=>({status:l.get(),loadedAt:u.get(),isLoading:d.get(),isTransitioning:f.get(),matches:b.get(),location:p.get(),resolvedLocation:m.get(),statusCode:h.get(),redirect:g.get()})),D=zt(64);function O(e){let t=D.get(e);return t||(t=r(()=>{let t=_.get();for(let n of t){let t=o.get(n);if(t&&t.routeId===e)return t.get()}}),D.set(e,t)),t}let k={status:l,loadedAt:u,isLoading:d,isTransitioning:f,location:p,resolvedLocation:m,statusCode:h,redirect:g,matchesId:_,pendingIds:v,cachedIds:y,matches:b,pendingMatches:x,cachedMatches:S,firstId:C,hasPending:w,matchRouteDeps:T,matchStores:o,pendingMatchStores:s,cachedMatchStores:c,__store:E,getRouteMatchStore:O,setMatches:A,setPending:j,setCached:M};A(e.matches),a?.(k);function A(e){Qn(e,o,_,n,i)}function j(e){Qn(e,s,v,n,i)}function M(e){Qn(e,c,y,n,i)}return k}function Zn(e,t){let n=[];for(let r of t){let t=e.get(r);t&&n.push(t.get())}return n}function Qn(e,t,n,r,i){let a=e.map(e=>e.id),o=new Set(a);i(()=>{for(let e of t.keys())o.has(e)||t.delete(e);for(let n of e){let e=t.get(n.id);if(!e){let e=r(n);e.routeId=n.routeId,t.set(n.id,e);continue}e.routeId=n.routeId,e.get()!==n&&e.set(n)}Lt(n.get(),a)||n.set(a)})}var $n=e=>{if(!e.rendered)return e.rendered=!0,e.onReady?.()},er=e=>e.stores.matchesId.get().some(t=>e.stores.matchStores.get(t)?.get()._forcePending),tr=(e,t)=>!!(e.preload&&!e.router.stores.matchStores.has(t)),nr=(e,t,n=!0)=>{let r={...e.router.options.context??{}},i=n?t:t-1;for(let t=0;t<=i;t++){let n=e.matches[t];if(!n)continue;let i=e.router.getMatch(n.id);i&&Object.assign(r,i.__routeContext,i.__beforeLoadContext)}return r},rr=(e,t)=>{if(!e.matches.length)return;let n=t.routeId,r=e.matches.findIndex(t=>t.routeId===e.router.routeTree.id),i=r>=0?r:0,a=n?e.matches.findIndex(e=>e.routeId===n):e.firstBadMatchIndex??e.matches.length-1;a<0&&(a=i);for(let t=a;t>=0;t--){let n=e.matches[t];if(e.router.looseRoutesById[n.routeId].options.notFoundComponent)return t}return n?a:i},ir=(e,t,n)=>{if(!(!z(n)&&!R(n)))throw z(n)&&n.redirectHandled&&!n.options.reloadDocument?n:(t&&(t._nonReactive.beforeLoadPromise?.resolve(),t._nonReactive.loaderPromise?.resolve(),t._nonReactive.beforeLoadPromise=void 0,t._nonReactive.loaderPromise=void 0,t._nonReactive.error=n,e.updateMatch(t.id,r=>({...r,status:z(n)?`redirected`:R(n)?`notFound`:r.status===`pending`?`success`:r.status,context:nr(e,t.index),isFetching:!1,error:n})),R(n)&&!n.routeId&&(n.routeId=t.routeId),t._nonReactive.loadPromise?.resolve()),z(n)&&(e.rendered=!0,n.options._fromLocation=e.location,n.redirectHandled=!0,n=e.router.resolveRedirect(n)),n)},ar=(e,t)=>{let n=e.router.getMatch(t);return!!(!n||n._nonReactive.dehydrated)},or=(e,t,n)=>{let r=nr(e,n);e.updateMatch(t,e=>({...e,context:r}))},sr=(e,t,n)=>{let{id:r,routeId:i}=e.matches[t],a=e.router.looseRoutesById[i];if(n instanceof Promise)throw n;e.firstBadMatchIndex??=t,ir(e,e.router.getMatch(r),n);try{a.options.onError?.(n)}catch(t){n=t,ir(e,e.router.getMatch(r),n)}e.updateMatch(r,e=>(e._nonReactive.beforeLoadPromise?.resolve(),e._nonReactive.beforeLoadPromise=void 0,e._nonReactive.loadPromise?.resolve(),{...e,error:n,status:`error`,isFetching:!1,updatedAt:Date.now(),abortController:new AbortController})),!e.preload&&!z(n)&&!R(n)&&(e.serialError??=n)},cr=(e,t,n,r)=>{if(r._nonReactive.pendingTimeout!==void 0)return;let i=n.options.pendingMs??e.router.options.defaultPendingMs;if(e.onReady&&!tr(e,t)&&(n.options.loader||n.options.beforeLoad||yr(n))&&typeof i==`number`&&i!==1/0&&(n.options.pendingComponent??e.router.options?.defaultPendingComponent)){let t=setTimeout(()=>{$n(e)},i);r._nonReactive.pendingTimeout=t}},lr=(e,t,n)=>{let r=e.router.getMatch(t);if(!r._nonReactive.beforeLoadPromise&&!r._nonReactive.loaderPromise)return;cr(e,t,n,r);let i=()=>{let n=e.router.getMatch(t);n.preload&&(n.status===`redirected`||n.status===`notFound`)&&ir(e,n,n.error)};return r._nonReactive.beforeLoadPromise?r._nonReactive.beforeLoadPromise.then(i):i()},ur=(e,t,n,r)=>{let i=e.router.getMatch(t),a=i._nonReactive.loadPromise;i._nonReactive.loadPromise=Ot(()=>{a?.resolve(),a=void 0});let{paramsError:o,searchError:s}=i;o&&sr(e,n,o),s&&sr(e,n,s),cr(e,t,r,i);let c=new AbortController,l=!1,u=()=>{l||(l=!0,e.updateMatch(t,e=>({...e,isFetching:`beforeLoad`,fetchCount:e.fetchCount+1,abortController:c})))},d=()=>{i._nonReactive.beforeLoadPromise?.resolve(),i._nonReactive.beforeLoadPromise=void 0,e.updateMatch(t,e=>({...e,isFetching:!1}))};if(!r.options.beforeLoad){e.router.batch(()=>{u(),d()});return}i._nonReactive.beforeLoadPromise=Ot();let f={...nr(e,n,!1),...i.__routeContext},{search:p,params:m,cause:h}=i,g=tr(e,t),_={search:p,abortController:c,params:m,preload:g,context:f,location:e.location,navigate:t=>e.router.navigate({...t,_fromLocation:e.location}),buildLocation:e.router.buildLocation,cause:g?`preload`:h,matches:e.matches,routeId:r.id,...e.router.options.additionalContext},v=r=>{if(r===void 0){e.router.batch(()=>{u(),d()});return}(z(r)||R(r))&&(u(),sr(e,n,r)),e.router.batch(()=>{u(),e.updateMatch(t,e=>({...e,__beforeLoadContext:r})),d()})},y;try{if(y=r.options.beforeLoad(_),kt(y))return u(),y.catch(t=>{sr(e,n,t)}).then(v)}catch(t){u(),sr(e,n,t)}v(y)},dr=(e,t)=>{let{id:n,routeId:r}=e.matches[t],i=e.router.looseRoutesById[r],a=()=>s(),o=()=>ur(e,n,t,i),s=()=>{if(ar(e,n))return;let t=lr(e,n,i);return kt(t)?t.then(o):o()};return a()},fr=(e,t,n)=>{let r=e.router.getMatch(t);if(!r||!n.options.head&&!n.options.scripts&&!n.options.headers)return;let i={ssr:e.router.options.ssr,matches:e.matches,match:r,params:r.params,loaderData:r.loaderData};return Promise.all([n.options.head?.(i),n.options.scripts?.(i),n.options.headers?.(i)]).then(([e,t,n])=>({meta:e?.meta,links:e?.links,headScripts:e?.scripts,headers:n,scripts:t,styles:e?.styles}))},pr=(e,t,n,r,i)=>{let a=t[r-1],{params:o,loaderDeps:s,abortController:c,cause:l}=e.router.getMatch(n),u=nr(e,r),d=tr(e,n);return{params:o,deps:s,preload:!!d,parentMatchPromise:a,abortController:c,context:u,location:e.location,navigate:t=>e.router.navigate({...t,_fromLocation:e.location}),cause:d?`preload`:l,route:i,...e.router.options.additionalContext}},mr=async(e,t,n,r,i)=>{try{let a=e.router.getMatch(n);try{vr(i);let o=i.options.loader,s=typeof o==`function`?o:o?.handler,c=s?.(pr(e,t,n,r,i)),l=!!s&&kt(c);if((l||i._lazyPromise||i._componentsPromise||i.options.head||i.options.scripts||i.options.headers||a._nonReactive.minPendingPromise)&&e.updateMatch(n,e=>({...e,isFetching:`loader`})),s){let t=l?await c:c;ir(e,e.router.getMatch(n),t),t!==void 0&&e.updateMatch(n,e=>({...e,loaderData:t}))}i._lazyPromise&&await i._lazyPromise;let u=a._nonReactive.minPendingPromise;u&&await u,i._componentsPromise&&await i._componentsPromise,e.updateMatch(n,t=>({...t,error:void 0,context:nr(e,r),status:`success`,isFetching:!1,updatedAt:Date.now()}))}catch(t){let o=t;if(o?.name===`AbortError`){if(a.abortController.signal.aborted){a._nonReactive.loaderPromise?.resolve(),a._nonReactive.loaderPromise=void 0;return}e.updateMatch(n,t=>({...t,status:t.status===`pending`?`success`:t.status,isFetching:!1,context:nr(e,r)}));return}let s=a._nonReactive.minPendingPromise;s&&await s,R(t)&&await i.options.notFoundComponent?.preload?.(),ir(e,e.router.getMatch(n),t);try{i.options.onError?.(t)}catch(t){o=t,ir(e,e.router.getMatch(n),t)}!z(o)&&!R(o)&&await vr(i,[`errorComponent`]),e.updateMatch(n,t=>({...t,error:o,context:nr(e,r),status:`error`,isFetching:!1}))}}catch(t){let r=e.router.getMatch(n);r&&(r._nonReactive.loaderPromise=void 0),ir(e,r,t)}},hr=async(e,t,n)=>{async function r(r,a,c,l,d){let f=Date.now()-a.updatedAt,p=r?d.options.preloadStaleTime??e.router.options.defaultPreloadStaleTime??3e4:d.options.staleTime??e.router.options.defaultStaleTime??0,m=d.options.shouldReload,h=typeof m==`function`?m(pr(e,t,i,n,d)):m,{status:g,invalid:_}=l,v=f>=p&&(!!e.forceStaleReload||l.cause===`enter`||c!==void 0&&c!==l.id);o=g===`success`&&(_||(h??v)),r&&d.options.preload===!1||(o&&!e.sync&&u?(s=!0,(async()=>{try{await mr(e,t,i,n,d);let r=e.router.getMatch(i);r._nonReactive.loaderPromise?.resolve(),r._nonReactive.loadPromise?.resolve(),r._nonReactive.loaderPromise=void 0,r._nonReactive.loadPromise=void 0}catch(t){z(t)&&await e.router.navigate(t.options)}})()):g!==`success`||o?await mr(e,t,i,n,d):or(e,i,n))}let{id:i,routeId:a}=e.matches[n],o=!1,s=!1,c=e.router.looseRoutesById[a],l=c.options.loader,u=((typeof l==`function`?void 0:l?.staleReloadMode)??e.router.options.defaultStaleReloadMode)!==`blocking`;if(ar(e,i)){if(!e.router.getMatch(i))return e.matches[n];or(e,i,n)}else{let t=e.router.getMatch(i),o=e.router.stores.matchesId.get()[n],s=(o&&e.router.stores.matchStores.get(o)||null)?.routeId===a?o:e.router.stores.matches.get().find(e=>e.routeId===a)?.id,l=tr(e,i);if(t._nonReactive.loaderPromise){if(t.status===`success`&&!e.sync&&!t.preload&&u)return t;await t._nonReactive.loaderPromise;let n=e.router.getMatch(i),a=n._nonReactive.error||n.error;a&&ir(e,n,a),n.status===`pending`&&await r(l,t,s,n,c)}else{let n=l&&!e.router.stores.matchStores.has(i),a=e.router.getMatch(i);a._nonReactive.loaderPromise=Ot(),n!==a.preload&&e.updateMatch(i,e=>({...e,preload:n})),await r(l,t,s,a,c)}}let d=e.router.getMatch(i);s||(d._nonReactive.loaderPromise?.resolve(),d._nonReactive.loadPromise?.resolve(),d._nonReactive.loadPromise=void 0),clearTimeout(d._nonReactive.pendingTimeout),d._nonReactive.pendingTimeout=void 0,s||(d._nonReactive.loaderPromise=void 0),d._nonReactive.dehydrated=void 0;let f=s?d.isFetching:!1;return f!==d.isFetching||d.invalid!==!1?(e.updateMatch(i,e=>({...e,isFetching:f,invalid:!1})),e.router.getMatch(i)):d};async function gr(e){let t=e,n=[];er(t.router)&&$n(t);let r;for(let e=0;e<t.matches.length;e++){try{let n=dr(t,e);kt(n)&&await n}catch(e){if(z(e))throw e;if(R(e))r=e;else if(!t.preload)throw e;break}if(t.serialError||t.firstBadMatchIndex!=null)break}let i=t.firstBadMatchIndex??t.matches.length,a=r&&!t.preload?rr(t,r):void 0,o=r&&t.preload?0:a===void 0?i:Math.min(a+1,i),s,c;for(let e=0;e<o;e++)n.push(hr(t,n,e));try{await Promise.all(n)}catch{let e=await Promise.allSettled(n);for(let t of e){if(t.status!==`rejected`)continue;let e=t.reason;if(z(e))throw e;R(e)?s??=e:c??=e}if(c!==void 0)throw c}let l=s??(r&&!t.preload?r:void 0),u=t.firstBadMatchIndex===void 0?t.matches.length-1:t.firstBadMatchIndex;if(!l&&r&&t.preload)return t.matches;if(l){let e=rr(t,l);e===void 0&&Rt();let n=t.matches[e],r=t.router.looseRoutesById[n.routeId],i=t.router.options?.defaultNotFoundComponent;!r.options.notFoundComponent&&i&&(r.options.notFoundComponent=i),l.routeId=n.routeId;let a=n.routeId===t.router.routeTree.id;t.updateMatch(n.id,e=>({...e,...a?{status:`success`,globalNotFound:!0,error:void 0}:{status:`notFound`,error:l},isFetching:!1})),u=e,await vr(r,[`notFoundComponent`])}else if(!t.preload){let e=t.matches[0];e.globalNotFound||t.router.getMatch(e.id)?.globalNotFound&&t.updateMatch(e.id,e=>({...e,globalNotFound:!1,error:void 0}))}if(t.serialError&&t.firstBadMatchIndex!==void 0){let e=t.router.looseRoutesById[t.matches[t.firstBadMatchIndex].routeId];await vr(e,[`errorComponent`])}for(let e=0;e<=u;e++){let{id:n,routeId:r}=t.matches[e],i=t.router.looseRoutesById[r];try{let e=fr(t,n,i);if(e){let r=await e;t.updateMatch(n,e=>({...e,...r}))}}catch(e){console.error(`Error executing head for route ${r}:`,e)}}let d=$n(t);if(kt(d)&&await d,l)throw l;if(t.serialError&&!t.preload&&!t.onReady)throw t.serialError;return t.matches}function _r(e,t){let n=t.map(t=>e.options[t]?.preload?.()).filter(Boolean);if(n.length!==0)return Promise.all(n)}function vr(e,t=br){!e._lazyLoaded&&e._lazyPromise===void 0&&(e.lazyFn?e._lazyPromise=e.lazyFn().then(t=>{let{id:n,...r}=t.options;Object.assign(e.options,r),e._lazyLoaded=!0,e._lazyPromise=void 0}):e._lazyLoaded=!0);let n=()=>e._componentsLoaded?void 0:t===br?(()=>{if(e._componentsPromise===void 0){let t=_r(e,br);t?e._componentsPromise=t.then(()=>{e._componentsLoaded=!0,e._componentsPromise=void 0}):e._componentsLoaded=!0}return e._componentsPromise})():_r(e,t);return e._lazyPromise?e._lazyPromise.then(n):n()}function yr(e){for(let t of br)if(e.options[t]?.preload)return!0;return!1}var br=[`component`,`errorComponent`,`pendingComponent`,`notFoundComponent`],xr=`__TSR_index`,Sr=`popstate`,Cr=`beforeunload`;function wr(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=kr(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[xr];i=Tr(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[xr];i=Tr(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),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[xr]!==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}}function Tr(e,t){t||={};let n=Ar();return{...t,key:n,__TSR_key:n,[xr]:e}}function Er(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=e?.createHref??(e=>e),c=e?.parseLocation??(()=>kr(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){let e=Ar();t.history.replaceState({[xr]:0,key:e,__TSR_key:e},``)}let l=c(),u,d=!1,f=!1,p=!1,m=!1,h=()=>l,g,_,v=()=>{g&&(C._ignoreSubscribers=!0,(g.isPush?t.history.pushState:t.history.replaceState)(g.state,``,g.href),C._ignoreSubscribers=!1,g=void 0,_=void 0,u=void 0)},y=(e,t,n)=>{let r=s(t);_||(u=l),l=kr(t,n),g={href:r,state:n,isPush:g?.isPush||e===`push`},_||=Promise.resolve().then(()=>v())},b=e=>{l=c(),C.notify({type:e})},x=async()=>{if(f){f=!1;return}let e=c(),n=e.state[xr]-l.state[xr],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 n=a();if(typeof document<`u`&&n.length){for(let r of n)if(await r.blockerFn({currentLocation:l,nextLocation:e,action:s})){f=!0,t.history.go(1),C.notify(u);return}}}l=c(),C.notify(u)},S=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=``},C=wr({getLocation:h,getLength:()=>t.history.length,pushState:(e,t)=>y(`push`,e,t),replaceState:(e,t)=>y(`replace`,e,t),back:e=>(e&&(p=!0),m=!0,t.history.back()),forward:e=>{e&&(p=!0),m=!0,t.history.forward()},go:e=>{d=!0,t.history.go(e)},createHref:e=>s(e),flush:v,destroy:()=>{t.history.pushState=n,t.history.replaceState=r,t.removeEventListener(Cr,S,{capture:!0}),t.removeEventListener(Sr,x)},onBlocked:()=>{u&&l!==u&&(l=u)},getBlockers:a,setBlockers:o,notifyOnIndexChange:!1});return t.addEventListener(Cr,S,{capture:!0}),t.addEventListener(Sr,x),t.history.pushState=function(...e){let r=n.apply(t.history,e);return C._ignoreSubscribers||b(`PUSH`),r},t.history.replaceState=function(...e){let n=r.apply(t.history,e);return C._ignoreSubscribers||b(`REPLACE`),n},C}function Dr(e){let t=e?.window??(typeof document<`u`?window:void 0);return Er({window:t,parseLocation:()=>{let e=t.location.hash.split(`#`).slice(1),n=e[0]??`/`,r=t.location.search,i=e.slice(1);return kr(`${n}${r}${i.length===0?``:`#${i.join(`#`)}`}`,t.history.state)},createHref:e=>`${t.location.pathname}${t.location.search}#${e}`})}function Or(e){let t=e.replace(/[\x00-\x1f\x7f]/g,``);return t.startsWith(`//`)&&(t=`/`+t.replace(/^\/+/,``)),t}function kr(e,t){let n=Or(e),r=n.indexOf(`#`),i=n.indexOf(`?`),a=Ar();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||{[xr]:0,key:a,__TSR_key:a}}}function Ar(){return(Math.random()+1).toString(36).substring(7)}function jr(e,t){let n=t,r=e;return{fromLocation:n,toLocation:r,pathChanged:n?.pathname!==r.pathname,hrefChanged:n?.href!==r.href,hashChanged:n?.hash!==r.hash}}var Mr=class{constructor(e,t){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this._scroll={next:!0},this.shouldViewTransition=void 0,this.isViewTransitionTypesSupported=void 0,this.subscribers=new Set,this.routeBranchCache=new WeakMap,this.lightweightCache=new WeakMap,this.startTransition=e=>e(),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??typeof document>`u`,this.protocolAllowlist=new Set(this.options.protocolAllowlist),this.options.pathParamsAllowedCharacters&&(this.pathParamsDecoder=yn(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.history=this.options.history?this.options.history:Er()),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;this.resolvePathCache=zt(1e3),e=this.buildRouteTree(),this.setRoutes(e)}if(!this.stores&&this.latestLocation){let e=this.getStoreConfig(this);this.batch=e.batch,this.stores=Xn(Fr(this.latestLocation),e),In(this)}let a=!1,o=this.options.basepath??`/`,s=this.options.rewrite;if(r||n!==o||i!==s){this.basepath=o;let e=[],t=hn(o);t&&t!==`/`&&e.push(qn({basepath:o})),s&&e.push(s),this.rewrite=e.length===0?void 0:e.length===1?e[0]:Kn(e),this.history&&this.updateLatestLocation(),a=!0}a&&this.stores&&this.stores.location.set(this.latestLocation),typeof window<`u`&&`CSS`in window&&typeof window.CSS?.supports==`function`&&(this.isViewTransitionTypesSupported=window.CSS.supports(`selector(:active-view-transition-type(a))`))},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{let e=en(this.routeTree,this.options.caseSensitive,(e,t)=>{e.init({originalIndex:t})});return this.options.routeMasks&&Yt(this.options.routeMasks,e.processedTree),e},this.subscribe=(e,t)=>{let n={eventType:e,fn:t};return this.subscribers.add(n),()=>{this.subscribers.delete(n)}},this.emit=e=>{this.subscribers.forEach(t=>{t.eventType===e.type&&t.fn(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:Ft(e).path,external:!1,searchStr:o,search:xt(t?.search,i),hash:Ft(r.slice(1)).path,state:St(t?.state,a)}}let o=new URL(i,this.origin),s=Jn(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:Ft(s.pathname).path,external:!!this.rewrite&&s.origin!==this.origin,searchStr:l,search:xt(t?.search,c),hash:Ft(s.hash.slice(1)).path,state:St(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)=>vn({base:e,to:t.includes(`//`)?fn(t):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=>Lr({pathname:e,routesById:this.routesById,processedTree:this.processedTree}),this.cancelMatch=e=>{let t=this.getMatch(e);t&&(t.abortController.abort(),clearTimeout(t._nonReactive.pendingTimeout),t._nonReactive.pendingTimeout=void 0)},this.cancelMatches=()=>{this.stores.pendingIds.get().forEach(e=>{this.cancelMatch(e)}),this.stores.matchesId.get().forEach(e=>{if(this.stores.pendingMatchStores.has(e))return;let t=this.stores.matchStores.get(e)?.get();t&&(t.status===`pending`||t.isFetching===`loader`)&&this.cancelMatch(e)})},this.buildLocation=e=>{let t=(t={})=>{let n=t._fromLocation||this.pendingBuiltLocation||this.latestLocation,r=this.matchRoutesLightweight(n);t.from;let i=t.unsafeRelative===`path`?n.pathname:t.from??r.fullPath,a=t.to?`${t.to}`:void 0,o=r.search,s=Object.assign(Object.create(null),r.params),c=a?.charCodeAt(0)===47?`/`:this.resolvePathWithBase(i,`.`),l=a?this.resolvePathWithBase(c,a):c,u=t.params===!1||t.params===null?Object.create(null):(t.params??!0)===!0?s:Object.assign(s,gt(t.params,s)),d=this.routesByPath[mn(l)],f;if(d)f=this.getRouteBranch(d);else if(l.includes(`$`))f=[];else{let e=this.getMatchedRoutes(l);f=e.matchedRoutes,this.options.notFoundRoute&&(!e.foundRoute||e.foundRoute.path!==`/`&&e.routeParams[`**`])&&(f=[...f,this.options.notFoundRoute])}if(f.length&&yt(u))for(let e of f){let t=e.options.params?.stringify??e.options.stringifyParams;if(t)try{Object.assign(u,t(u))}catch{}}let p=e.leaveParams?l:Ft(xn({path:l,params:u,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath).path,m=o;if(e._includeValidateSearch&&this.options.search?.strict){let e={};f.forEach(t=>{if(t.options.validateSearch)try{Object.assign(e,Ir(t.options.validateSearch,{...e,...m}))}catch{}}),m=e}m=Rr({search:m,dest:t,destRoutes:f,_includeValidateSearch:e._includeValidateSearch}),m=xt(o,m);let h=this.options.stringifySearch(m),g=t.hash===!0?n.hash:t.hash?gt(t.hash,n.hash):void 0,_=g?`#${g}`:``,v=t.state===!0?n.state:t.state?gt(t.state,n.state):{};v=St(n.state,v);let y=`${p}${h}${_}`,b,x,S=!1;if(this.rewrite){let e=new URL(y,this.origin),t=Yn(this.rewrite,e);b=e.href.replace(e.origin,``),t.origin===this.origin?x=t.pathname+t.search+t.hash:(x=t.href,S=!0)}else b=It(y),x=b;return{publicHref:x,href:b,pathname:p,search:m,searchStr:h,state:v,hash:g??``,external:S,unmaskOnReload:t.unmaskOnReload}},n=(n={},r)=>{let i=t(n),a=r?t(r):void 0;if(!a){let n=Object.create(null);if(this.options.routeMasks){let o=Xt(i.pathname,this.processedTree);if(o){Object.assign(n,o.rawParams);let{from:i,params:s,...c}=o.route,l=s===!1||s===null?Object.create(null):(s??!0)===!0?n:Object.assign(n,gt(s,n));r={from:e.from,...c,params:l},a=t(r)}}}return a&&(i.maskedLocation=a),i};return e.mask?n(e,{from:e.from,...e.mask}):n(e)},this.commitLocation=async({viewTransition:e,ignoreBlocker:t,...n})=>{let r,i=()=>{let e=[`key`,`__TSR_key`,`__TSR_index`,`__hashScrollIntoViewOptions`];e.forEach(e=>{n.state[e]=this.latestLocation.state[e]});let t=Dt(n.state,this.latestLocation.state);return e.forEach(e=>{delete n.state[e]}),t},a=mn(this.latestLocation.href)===mn(n.href),o=this.commitLocationPromise;if(this.commitLocationPromise=Ot(()=>{o?.resolve(),o=void 0}),a&&i())this.load();else{let{maskedLocation:i,hashScrollIntoView:a,...o}=n;i&&(o={...i,state:{...i.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.__hashScrollIntoViewOptions=a??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=e,r=n.replace?`REPLACE`:`PUSH`,this.history[r===`REPLACE`?`replace`:`push`](o.publicHref,o.state,{ignoreBlocker:t})}return this._scroll.next=n.resetScroll??!0,this.history.subscribers.size||this.load(r?{action:{type:r}}:void 0),this.commitLocationPromise},this.buildAndCommitLocation=({replace:e,resetScroll:t,hashScrollIntoView:n,viewTransition:r,ignoreBlocker:i,href:a,...o}={})=>{if(a){let t=this.history.location.state.__TSR_index,n=kr(a,{__TSR_index:e?t:t+1}),r=new URL(n.pathname,this.origin);o.to=Jn(this.rewrite,r).pathname,o.search=this.options.parseSearch(n.search),o.hash=n.hash.slice(1)}let s=this.buildLocation({...o,_includeValidateSearch:!0});this.pendingBuiltLocation=s;let c=this.commitLocation({...s,viewTransition:r,replace:e,resetScroll:t,hashScrollIntoView:n,ignoreBlocker:i});return queueMicrotask(()=>{this.pendingBuiltLocation===s&&(this.pendingBuiltLocation=void 0)}),c},this.navigate=async({to:e,reloadDocument:t,href:n,publicHref:r,...i})=>{let a=!1;if(n)try{new URL(`${n}`),a=!0}catch{}if(a&&!t&&(t=!0),t){if(e!==void 0||!n){let t=this.buildLocation({to:e,...i});n??=t.publicHref,r??=t.publicHref}let t=!a&&r?r:n;if(Pt(t,this.protocolAllowlist))return;if(!i.ignoreBlocker){let e=this.history.getBlockers?.()??[];for(let t of e)if(t?.blockerFn&&await t.blockerFn({currentLocation:this.latestLocation,nextLocation:this.latestLocation,action:`PUSH`}))return}i.replace?window.location.replace(t):window.location.href=t;return}return this.buildAndCommitLocation({...i,href:n,to:e,_isNavigate:!0})},this.beforeLoad=()=>{this.cancelMatches(),this.updateLatestLocation();let e=this.matchRoutes(this.latestLocation),t=this.stores.cachedMatches.get().filter(t=>!e.some(e=>e.id===t.id));this.batch(()=>{this.stores.status.set(`pending`),this.stores.statusCode.set(200),this.stores.isLoading.set(!0),this.stores.location.set(this.latestLocation),this.stores.setPending(e),this.stores.setCached(t)})},this.load=async e=>{let t=e?.action?.type,n,r,i,a=this.stores.resolvedLocation.get()??this.stores.location.get();for(i=new Promise(o=>{this.startTransition(async()=>{try{this.beforeLoad(),t&&(this._scroll.hash=t===`PUSH`||t===`REPLACE`);let n=this.latestLocation,r=jr(n,this.stores.resolvedLocation.get());this.stores.redirect.get()||this.emit({type:`onBeforeNavigate`,...r}),this.emit({type:`onBeforeLoad`,...r}),await gr({router:this,sync:e?.sync,forceStaleReload:a.href===n.href,matches:this.stores.pendingMatches.get(),location:n,updateMatch:this.updateMatch,onReady:async()=>{this.startTransition(()=>{this.startViewTransition(async()=>{let e=null,t=null,n=null,r=null;this.batch(()=>{let i=this.stores.pendingMatches.get(),a=i.length,o=this.stores.matches.get();e=a?o.filter(e=>!this.stores.pendingMatchStores.has(e.id)):null;let s=new Set;for(let e of this.stores.pendingMatchStores.values())e.routeId&&s.add(e.routeId);let c=new Set;for(let e of this.stores.matchStores.values())e.routeId&&c.add(e.routeId);t=a?o.filter(e=>!s.has(e.routeId)):null,n=a?i.filter(e=>!c.has(e.routeId)):null,r=a?i.filter(e=>c.has(e.routeId)):o,this.stores.isLoading.set(!1),this.stores.loadedAt.set(Date.now()),a&&(this.stores.setMatches(i),this.stores.setPending([]),this.stores.setCached([...this.stores.cachedMatches.get(),...e.filter(e=>e.status!==`error`&&e.status!==`notFound`&&e.status!==`redirected`)]),this.clearExpiredCache())});for(let[e,i]of[[t,`onLeave`],[n,`onEnter`],[r,`onStay`]])if(e)for(let t of e)this.looseRoutesById[t.routeId].options[i]?.(t)})})}})}catch(e){z(e)?(n=e,this.navigate({...n.options,replace:!0,ignoreBlocker:!0})):R(e)&&(r=e);let t=n?n.status:r?404:this.stores.matches.get().some(e=>e.status===`error`)?500:200;this.batch(()=>{this.stores.statusCode.set(t),this.stores.redirect.set(n)})}this.latestLoadPromise===i&&(this.commitLocationPromise?.resolve(),this.latestLoadPromise=void 0,this.commitLocationPromise=void 0),o()})}),this.latestLoadPromise=i,await i;this.latestLoadPromise&&i!==this.latestLoadPromise;)await this.latestLoadPromise;let o;this.hasNotFoundMatch()?o=404:this.stores.matches.get().some(e=>e.status===`error`)&&(o=500),o!==void 0&&this.stores.statusCode.set(o)},this.startViewTransition=e=>{let t=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,t&&typeof document<`u`&&`startViewTransition`in document&&typeof document.startViewTransition==`function`){let n;if(typeof t==`object`&&this.isViewTransitionTypesSupported){let r=this.latestLocation,i=this.stores.resolvedLocation.get(),a=typeof t.types==`function`?t.types(jr(r,i)):t.types;if(a===!1){e();return}n={update:e,types:a}}else n=e;document.startViewTransition(n)}else e()},this.updateMatch=(e,t)=>{this.startTransition(()=>{let n=this.stores.pendingMatchStores.get(e);if(n){n.set(t);return}let r=this.stores.matchStores.get(e);if(r){r.set(t);return}let i=this.stores.cachedMatchStores.get(e);if(i){let n=t(i.get());n.status===`redirected`?this.stores.cachedMatchStores.delete(e)&&this.stores.cachedIds.set(t=>t.filter(t=>t!==e)):i.set(n)}})},this.getMatch=e=>this.stores.cachedMatchStores.get(e)?.get()??this.stores.pendingMatchStores.get(e)?.get()??this.stores.matchStores.get(e)?.get(),this.invalidate=e=>{let t=t=>e?.filter?.(t)??!0?{...t,invalid:!0,...e?.forcePending||t.status===`error`||t.status===`notFound`?{status:`pending`,error:void 0}:void 0}:t;return this.batch(()=>{this.stores.setMatches(this.stores.matches.get().map(t)),this.stores.setCached(this.stores.cachedMatches.get().map(t)),this.stores.setPending(this.stores.pendingMatches.get().map(t))}),this.shouldViewTransition=!1,this.load({sync:e?.sync})},this.getParsedLocationHref=e=>e.publicHref||`/`,this.resolveRedirect=e=>{let t=e.headers.get(`Location`);if(!e.options.href||e.options._builtLocation){let t=e.options._builtLocation??this.buildLocation(e.options),n=this.getParsedLocationHref(t);e.options.href=n,e.headers.set(`Location`,n)}else if(t)try{let n=new URL(t);if(this.origin&&n.origin===this.origin){let t=n.pathname+n.search+n.hash;e.options.href=t,e.headers.set(`Location`,t)}}catch{}if(e.options.href&&!e.options._builtLocation&&Pt(e.options.href,this.protocolAllowlist))throw Error(`Redirect blocked: unsafe protocol`);return e.headers.get(`Location`)||e.headers.set(`Location`,e.options.href),e},this.clearCache=e=>{let t=e?.filter;t===void 0?this.stores.setCached([]):this.stores.setCached(this.stores.cachedMatches.get().filter(e=>!t(e)))},this.clearExpiredCache=()=>{let e=Date.now();this.clearCache({filter:t=>{let n=this.looseRoutesById[t.routeId];if(!n.options.loader)return!0;let r=(t.preload?n.options.preloadGcTime??this.options.defaultPreloadGcTime:n.options.gcTime??this.options.defaultGcTime)??3e5;return t.status===`error`||e-t.updatedAt>=r}})},this.loadRouteChunk=vr,this.preloadRoute=async e=>{let t=e._builtLocation??this.buildLocation(e),n=this.matchRoutes(t,{throwOnError:!0,preload:!0,dest:e}),r=new Set([...this.stores.matchesId.get(),...this.stores.pendingIds.get()]),i=new Set([...r,...this.stores.cachedIds.get()]),a=n.filter(e=>!i.has(e.id));if(a.length){let e=this.stores.cachedMatches.get();this.stores.setCached([...e,...a])}try{return n=await gr({router:this,matches:n,location:t,preload:!0,updateMatch:(e,t)=>{r.has(e)?n=n.map(n=>n.id===e?t(n):n):this.updateMatch(e,t)}}),n}catch(e){if(z(e))return e.options.reloadDocument?void 0:await this.preloadRoute({...e.options,_fromLocation:t});R(e)||console.error(e);return}},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);if(t?.pending&&this.stores.status.get()!==`pending`)return!1;let i=(t?.pending===void 0?!this.stores.isLoading.get():t.pending)?this.latestLocation:this.stores.resolvedLocation.get()||this.stores.location.get(),a=Zt(r.pathname,t?.caseSensitive??!1,t?.fuzzy??!1,i.pathname,this.processedTree);return!a||e.params&&!Dt(a.rawParams,e.params,{partial:!0})?!1:t?.includeSearch??!0?Dt(i.search,r.search,{partial:!0})?a.rawParams:!1:a.rawParams},this.hasNotFoundMatch=()=>this.stores.matches.get().some(e=>e.status===`notFound`||e.globalNotFound),this.getStoreConfig=t,this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...e,caseSensitive:e.caseSensitive??!1,notFoundMode:e.notFoundMode??`fuzzy`,stringifySearch:e.stringifySearch??Vn,parseSearch:e.parseSearch??Bn,protocolAllowlist:e.protocolAllowlist??Nt}),typeof document<`u`&&(self.__TSR_ROUTER__=this)}isShell(){return!!this.options.isShell}isPrerendering(){return!!this.options.isPrerendering}get state(){return this.stores.__store.get()}setRoutes({routesById:e,routesByPath:t,processedTree:n}){this.routesById=e,this.routesByPath=t,this.processedTree=n;let r=this.options.notFoundRoute;r&&(r.init({originalIndex:99999999999}),this.routesById[r.id]=r)}getRouteBranch(e){let t=this.routeBranchCache.get(e);return t||(t=rn(e),this.routeBranchCache.set(e,t)),t}get looseRoutesById(){return this.routesById}getParentContext(e){return e?.id?e.context??this.options.context??void 0:this.options.context??void 0}matchRoutesInternal(e,t){let n=this.getMatchedRoutes(e.pathname),{foundRoute:r,routeParams:i}=n,{matchedRoutes:a}=n,o=!1;(r?r.path!==`/`&&i[`**`]:mn(e.pathname))&&(this.options.notFoundRoute?a=[...a,this.options.notFoundRoute]:o=!0);let s=o?Br(this.options.notFoundMode,a):void 0,c=Array(a.length),l=new Map;for(let e of this.stores.matchStores.values())e.routeId&&l.set(e.routeId,e.get());for(let n=0;n<a.length;n++){let r=a[n],o=c[n-1],u,d,f;{let n=o?.search??e.search,i=o?._strictSearch??void 0;try{let e=Ir(r.options.validateSearch,{...n})??void 0;u={...n,...e},d={...i,...e},f=void 0}catch(e){let r=e;if(e instanceof Nr||(r=new Nr(e.message,{cause:e})),t?.throwOnError)throw r;u=n,d={},f=r}}let p=r.options.loaderDeps?.({search:u})??``,m=p?JSON.stringify(p):``,{interpolatedPath:h,usedParams:g}=xn({path:r.fullPath,params:i,decoder:this.pathParamsDecoder,server:this.isServer}),_=r.id+h+m,v=this.getMatch(_),y=l.get(r.id),b=v?._strictParams??g,x;if(!v)try{Vr(r,b)}catch(e){if(x=R(e)||z(e)?e:new Pr(e.message,{cause:e}),t?.throwOnError)throw x}Object.assign(i,b);let S=y?`stay`:`enter`,C;if(v)C={...v,cause:S,params:y?.params??i,_strictParams:b,search:xt(y?y.search:v.search,u),_strictSearch:d};else{let e=r.options.loader||r.options.beforeLoad||r.lazyFn||yr(r)?`pending`:`success`;C={id:_,ssr:r.options.ssr,index:n,routeId:r.id,params:y?.params??i,_strictParams:b,pathname:h,updatedAt:Date.now(),search:y?xt(y.search,u):u,_strictSearch:d,searchError:void 0,status:e,isFetching:!1,error:void 0,paramsError:x,__routeContext:void 0,_nonReactive:{loadPromise:Ot()},__beforeLoadContext:void 0,context:{},abortController:new AbortController,fetchCount:0,cause:S,loaderDeps:y?St(y.loaderDeps,p):p,invalid:!1,preload:!1,links:void 0,scripts:void 0,headScripts:void 0,meta:void 0,staticData:r.options.staticData||{},fullPath:r.fullPath}}t?.preload||(C.globalNotFound=s===r.id),C.searchError=f;let w=this.getParentContext(o);C.context={...w,...C.__routeContext,...C.__beforeLoadContext},c[n]=C}for(let t=0;t<c.length;t++){let n=c[t],r=this.looseRoutesById[n.routeId],a=this.getMatch(n.id),o=l.get(n.routeId);if(n.params=o?xt(o.params,i):i,!a){let i=c[t-1],a=this.getParentContext(i);if(r.options.context){let t={deps:n.loaderDeps,params:n.params,context:a??{},location:e,navigate:t=>this.navigate({...t,_fromLocation:e}),buildLocation:this.buildLocation,cause:n.cause,abortController:n.abortController,preload:!!n.preload,matches:c,routeId:r.id};n.__routeContext=r.options.context(t)??void 0}n.context={...a,...n.__routeContext,...n.__beforeLoadContext}}}return c}matchRoutesLightweight(e){let t=mt(this.stores.matchesId.get()),n=this.lightweightCache.get(e);if(n&&n[0]===t)return n[1];let{matchedRoutes:r,routeParams:i}=this.getMatchedRoutes(e.pathname),a=mt(r),o={...e.search};for(let e of r)try{Object.assign(o,Ir(e.options.validateSearch,o))}catch{}let s=t&&this.stores.matchStores.get(t)?.get(),c=s&&s.routeId===a.id&&s.pathname===e.pathname,l;if(c)l=s.params;else{let e=Object.assign(Object.create(null),i);for(let t of r)try{Vr(t,e)}catch{}l=e}let u={matchedRoutes:r,fullPath:a.fullPath,search:o,params:l};return this.lightweightCache.set(e,[t,u]),u}},Nr=class extends Error{},Pr=class extends Error{};function Fr(e){return{loadedAt:0,isLoading:!1,isTransitioning:!1,status:`idle`,resolvedLocation:void 0,location:e,matches:[],statusCode:200}}function Ir(e,t){if(e==null)return{};if(`~standard`in e){let n=e[`~standard`].validate(t);if(n instanceof Promise)throw new Nr(`Async validation not supported`);if(n.issues)throw new Nr(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 Lr({pathname:e,routesById:t,processedTree:n}){let r=Object.create(null),i=mn(e),a,o=Qt(i,n,!0);return o&&(a=o.route,Object.assign(r,o.rawParams)),{matchedRoutes:o?.branch||[t.__root__],routeParams:r,foundRoute:a}}function Rr({search:e,dest:t,destRoutes:n,_includeValidateSearch:r}){return zr(n)(e,t,r??!1)}function zr(e){let t,n,r=[];for(let t of e){let e=t.options;`search`in e?e.search?.middlewares&&r.push(...e.search.middlewares):(e.preSearchFilters||e.postSearchFilters)&&r.push(({search:t,next:n})=>{let r=n(e.preSearchFilters?e.preSearchFilters.reduce((e,t)=>t(e),t):t);return e.postSearchFilters?e.postSearchFilters.reduce((e,t)=>t(e),r):r});let i=e.validateSearch;i&&r.push(({search:e,next:t,meta:r})=>{let a=t(e);if(n)try{let e=Ir(i,a);if(r&&e)for(let t in e)t in a||(r.defaulted||=new Map).set(t,e[t]);return{...a,...e}}catch{}return a})}let i=(e,n,a)=>{if(e>=r.length){if(!t.search)return{};if(t.search===!0)return n;let e=gt(t.search,n);return a&&(a.explicit=e),e}return r[e]({search:n,next:(t,n)=>{if(n){let n=a||{};return{search:i(e+1,t,n),meta:n}}return i(e+1,t,a)},meta:a})};return function(e,r,a){return t=r,n=a,i(0,e)}}function Br(e,t){if(e!==`root`)for(let e=t.length-1;e>=0;e--){let n=t[e];if(n.children)return n.id}return Wn}function Vr(e,t){let n=e.options.params?.parse??e.options.parseParams;if(n){let e=n(t);if(e===!1)throw Error(`Route params.parse returned false for a matched route`);Object.assign(t,e)}}var Hr=`Error preloading route! ☝️`,Ur=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.originalIndex;let t=this.options,n=!t?.path&&!t?.id;this.parentRoute=this.options.getParentRoute?.(),n?this._path=Wn:this.parentRoute||Rt();let r=n?Wn:t?.path;r&&r!==`/`&&(r=pn(r));let i=t?.id||r,a=n?Wn:dn([this.parentRoute.id===`__root__`?``:this.parentRoute.id,i]);r===`__root__`&&(r=`/`),a!==`__root__`&&(a=dn([`/`,a]));let o=a===`__root__`?`/`:dn([this.parentRoute.fullPath,r]);this._path=r,this._id=a,this._fullPath=o,this._to=mn(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=>Gn({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.`)}},Wr=class extends Ur{constructor(e){super(e)}};function Gr(e){let t=e.errorComponent??qr;return(0,L.jsx)(Kr,{getResetKey:e.getResetKey,onCatch:e.onCatch,children:({error:n,reset:r})=>n?h.createElement(t,{error:n,reset:r}):e.children})}var Kr=class extends h.Component{constructor(...e){super(...e),this.state={error:null}}static getDerivedStateFromProps(e,t){let n=e.getResetKey();return t.error&&t.resetKey!==n?{resetKey:n,error:null}:{resetKey:n}}static getDerivedStateFromError(e){return{error:e}}reset(){this.setState({error:null})}componentDidCatch(e,t){this.props.onCatch&&this.props.onCatch(e,t)}render(){return this.props.children({error:this.state.error,reset:()=>{this.reset()}})}};function qr({error:e}){let[t,n]=h.useState(!1);return(0,L.jsxs)(`div`,{style:{padding:`.5rem`,maxWidth:`100%`},children:[(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`.5rem`},children:[(0,L.jsx)(`strong`,{style:{fontSize:`1rem`},children:`Something went wrong!`}),(0,L.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,L.jsx)(`div`,{style:{height:`.25rem`}}),t?(0,L.jsx)(`div`,{children:(0,L.jsx)(`pre`,{style:{fontSize:`.7em`,border:`1px solid red`,borderRadius:`.25rem`,padding:`.3rem`,color:`red`,overflow:`auto`},children:e.message?(0,L.jsx)(`code`,{children:e.message}):null})}):null]})}function Jr({children:e,fallback:t=null}){return Yr()?(0,L.jsx)(h.default.Fragment,{children:e}):(0,L.jsx)(h.default.Fragment,{children:t})}function Yr(){return h.default.useSyncExternalStore(Xr,()=>!0,()=>!1)}function Xr(){return()=>{}}var Zr=h.createContext(null);function B(e){return h.useContext(Zr)}var Qr=h.createContext(void 0),$r=h.createContext(void 0),V=(e=>(e[e.None=0]=`None`,e[e.Mutable=1]=`Mutable`,e[e.Watching=2]=`Watching`,e[e.RecursedCheck=4]=`RecursedCheck`,e[e.Recursed=8]=`Recursed`,e[e.Dirty=16]=`Dirty`,e[e.Pending=32]=`Pending`,e))(V||{});function ei({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(!0)}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(!0)}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 ti(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 ni=[],ri=0,{link:ii,unlink:ai,propagate:oi,checkDirty:si,shallowPropagate:ci}=ei({update(e){return e._update()},notify(e){ni[ui++]=e,e.flags&=~V.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=V.Mutable|V.Dirty,mi(e))}}),li=0,ui=0,di,fi=0;function pi(e){try{++fi,e()}finally{--fi||hi()}}function mi(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=ai(n,e)}function hi(){if(!(fi>0)){for(;li<ui;){let e=ni[li];ni[li++]=void 0,e.notify()}li=0,ui=0}}function gi(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?V.None:V.Mutable,get(){return di!==void 0&&ii(i,di,ri),i._snapshot},subscribe(e){let t=ti(e),n={current:!1},r=_i(()=>{i.get(),n.current?t.next?.(i._snapshot):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=di,o=t?.compare??Object.is;if(n)di=i,++ri,i.depsTail=void 0;else if(e===void 0)return!1;n&&(i.flags=V.Mutable|V.RecursedCheck);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{di=a,n&&(i.flags&=~V.RecursedCheck),mi(i)}}};return n?(i.flags=V.Mutable|V.Dirty,i.get=function(){let e=i.flags;if(e&V.Dirty||e&V.Pending&&si(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&ci(e)}}else e&V.Pending&&(i.flags=e&~V.Pending);return di!==void 0&&ii(i,di,ri),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(oi(e),ci(e),hi())}},i}function _i(e){let t=()=>{let t=di;di=n,++ri,n.depsTail=void 0,n.flags=V.Watching|V.RecursedCheck;try{return e()}finally{di=t,n.flags&=~V.RecursedCheck,mi(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:V.Watching|V.RecursedCheck,notify(){let e=this.flags;e&V.Dirty||e&V.Pending&&si(this.deps,this)?t():this.flags=V.Watching},stop(){this.flags=V.None,this.depsTail=void 0,mi(this)}};return t(),n}var vi=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})),yi=f(((e,t)=>{t.exports=vi()})),bi=f((e=>{var t=globalThis.React,n=yi();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}})),xi=f(((e,t)=>{t.exports=bi()}))();function Si(e,t){return e===t}function H(e,t,n=Si){let r=(0,h.useCallback)(t=>{if(!e)return()=>{};let{unsubscribe:n}=e.subscribe(t);return n},[e]),i=(0,h.useCallback)(()=>e?.get(),[e]);return(0,xi.useSyncExternalStoreWithSelector)(r,i,i,t,n)}var Ci={get(){},subscribe(){return{unsubscribe(){}}}};function wi(e,t){let n=h.useRef();return r=>{let i=e?.select?e.select(r):r;return e?.structuralSharing??t.options.defaultStructuralSharing?n.current=St(n.current,i):i}}function Ti(e){let t=B(),n=h.useContext(e.from?$r:Qr),r=e.from?t.stores.getRouteMatchStore(e.from):t.stores.matchStores.get(n),i=wi(e,t),a=H(r??Ci,e=>e?i(e):Ci);if(a!==Ci)return a;(e.shouldThrow??!0)&&Rt()}function Ei(e){return Ti({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function Di(e){let{select:t,...n}=e;return Ti({...n,select:e=>t?t(e.loaderDeps):e.loaderDeps})}function Oi(e){return Ti({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 ki(e){return Ti({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function Ai(e){let t=B();return h.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}function ji(e){return Ti({...e,select:t=>e.select?e.select(t.context):t.context})}function Mi(e,n){let r=B(),i=pt(n),{activeProps:a,inactiveProps:o,activeOptions:s,to:c,preload:l,preloadDelay:u,preloadIntentProximity:d,hashScrollIntoView:f,replace:p,startTransition:m,resetScroll:g,viewTransition:_,children:v,target:y,disabled:b,style:x,className:S,onClick:C,onBlur:w,onFocus:T,onMouseEnter:E,onMouseLeave:D,onTouchStart:O,ignoreBlocker:k,params:A,search:j,hash:M,state:N,mask:ee,reloadDocument:te,unsafeRelative:P,from:ne,_fromLocation:re,...ie}=e,ae=Yr(),oe=h.useMemo(()=>e,[r,e.from,e._fromLocation,e.hash,e.to,e.search,e.params,e.state,e.mask,e.unsafeRelative]),se=H(r.stores.location,e=>e,(e,t)=>e.href===t.href),F=h.useMemo(()=>{let e={_fromLocation:se,...oe};return r.buildLocation(e)},[r,se,oe]),ce=F.maskedLocation?F.maskedLocation.publicHref:F.publicHref,le=F.maskedLocation?F.maskedLocation.external:F.external,ue=h.useMemo(()=>Vi(ce,le,r.history,b),[b,le,ce,r.history]),de=h.useMemo(()=>{if(ue?.external)return Pt(ue.href,r.protocolAllowlist)?void 0:ue.href;if(!Hi(c)&&typeof c==`string`&&c.indexOf(`:`)!==-1)try{return new URL(c),Pt(c,r.protocolAllowlist)?void 0:c}catch{}},[c,ue,r.protocolAllowlist]),fe=h.useMemo(()=>{if(de)return!1;if(s?.exact){if(!_n(se.pathname,F.pathname,r.basepath))return!1}else{let e=gn(se.pathname,r.basepath),t=gn(F.pathname,r.basepath);if(!(e.startsWith(t)&&(e.length===t.length||e[t.length]===`/`)))return!1}return(s?.includeSearch??!0)&&!Dt(se.search,F.search,{partial:!s?.exact,ignoreUndefined:!s?.explicitUndefined})?!1:!s?.includeHash||ae&&se.hash===F.hash},[s?.exact,s?.explicitUndefined,s?.includeHash,s?.includeSearch,se,de,ae,F.hash,F.pathname,F.search,r.basepath]),pe=fe?gt(a,{})??Pi:Ni,me=fe?Ni:gt(o,{})??Ni,I=[S,pe.className,me.className].filter(Boolean).join(` `),he=(x||pe.style||me.style)&&{...x,...pe.style,...me.style},[ge,_e]=h.useState(!1),ve=h.useRef(!1),ye=e.reloadDocument||de?!1:l??r.options.defaultPreload,be=u??r.options.defaultPreloadDelay??0,xe=h.useCallback(()=>{r.preloadRoute({...oe,_builtLocation:F}).catch(e=>{console.warn(e),console.warn(Hr)})},[r,oe,F]);ft(i,h.useCallback(e=>{e?.isIntersecting&&xe()},[xe]),zi,{disabled:!!b||ye!==`viewport`}),h.useEffect(()=>{ve.current||!b&&ye===`render`&&(xe(),ve.current=!0)},[b,xe,ye]);let Se=e=>{let n=e.currentTarget.getAttribute(`target`),i=y===void 0?n:y;if(!b&&!Wi(e)&&!e.defaultPrevented&&(!i||i===`_self`)&&e.button===0){e.preventDefault(),(0,t.flushSync)(()=>{_e(!0)});let n=r.subscribe(`onResolved`,()=>{n(),_e(!1)});r.navigate({...oe,replace:p,resetScroll:g,hashScrollIntoView:f,startTransition:m,viewTransition:_,ignoreBlocker:k})}};if(de)return{...ie,ref:i,href:de,...v&&{children:v},...y&&{target:y},...b&&{disabled:b},...x&&{style:x},...S&&{className:S},...C&&{onClick:C},...w&&{onBlur:w},...T&&{onFocus:T},...E&&{onMouseEnter:E},...D&&{onMouseLeave:D},...O&&{onTouchStart:O}};let Ce=e=>{if(b||ye!==`intent`)return;if(!be){xe();return}let t=e.currentTarget;if(Ri.has(t))return;let n=setTimeout(()=>{Ri.delete(t),xe()},be);Ri.set(t,n)},we=e=>{b||ye!==`intent`||xe()},Te=e=>{if(b||!ye||!be)return;let t=e.currentTarget,n=Ri.get(t);n&&(clearTimeout(n),Ri.delete(t))};return{...ie,...pe,...me,href:ue?.href,ref:i,onClick:Bi([C,Se]),onBlur:Bi([w,Te]),onFocus:Bi([T,Ce]),onMouseEnter:Bi([E,Ce]),onMouseLeave:Bi([D,Te]),onTouchStart:Bi([O,we]),disabled:!!b,target:y,...he&&{style:he},...I&&{className:I},...b&&Fi,...fe&&Ii,...ae&&ge&&Li}}var Ni={},Pi={className:`active`},Fi={role:`link`,"aria-disabled":!0},Ii={"data-status":`active`,"aria-current":`page`},Li={"data-transitioning":`transitioning`},Ri=new WeakMap,zi={rootMargin:`100px`},Bi=e=>t=>{for(let n of e)if(n){if(t.defaultPrevented)return;n(t)}};function Vi(e,t,n,r){if(!r)return t?{href:e,external:!0}:{href:n.createHref(e)||`/`,external:!1}}function Hi(e){if(typeof e!=`string`)return!1;let t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var Ui=h.forwardRef((e,t)=>{let{_asChild:n,...r}=e,{type:i,...a}=Mi(r,t),o=typeof r.children==`function`?r.children({isActive:a[`data-status`]===`active`}):r.children;if(!n){let{disabled:e,...t}=a;return h.createElement(`a`,t,o)}return h.createElement(n,a,o)});function Wi(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}var Gi=class extends Ur{constructor(e){super(e),this.useMatch=e=>Ti({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>ji({...e,from:this.id}),this.useSearch=e=>ki({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>Oi({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>Di({...e,from:this.id}),this.useLoaderData=e=>Ei({...e,from:this.id}),this.useNavigate=()=>Ai({from:this.fullPath}),this.Link=h.default.forwardRef((e,t)=>(0,L.jsx)(Ui,{ref:t,from:this.fullPath,...e}))}};function Ki(e){return new Gi(e)}var qi=class extends Wr{constructor(e){super(e),this.useMatch=e=>Ti({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>ji({...e,from:this.id}),this.useSearch=e=>ki({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>Oi({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>Di({...e,from:this.id}),this.useLoaderData=e=>Ei({...e,from:this.id}),this.useNavigate=()=>Ai({from:this.fullPath}),this.Link=h.default.forwardRef((e,t)=>(0,L.jsx)(Ui,{ref:t,from:this.fullPath,...e}))}};function Ji(e){return new qi(e)}function Yi(e){let t=B(),n=`not-found-${H(t.stores.location,e=>e.pathname)}-${H(t.stores.status,e=>e)}`;return(0,L.jsx)(Gr,{getResetKey:()=>n,onCatch:(t,n)=>{if(R(t))e.onCatch?.(t,n);else throw t},errorComponent:({error:t})=>{if(R(t))return e.fallback?.(t);throw t},children:e.children})}function Xi(){return(0,L.jsx)(`p`,{children:`Not Found`})}function Zi(e){return(0,L.jsx)(L.Fragment,{children:e.children})}function Qi(e,t,n){return t.options.notFoundComponent?(0,L.jsx)(t.options.notFoundComponent,{...n}):e.options.defaultNotFoundComponent?(0,L.jsx)(e.options.defaultNotFoundComponent,{...n}):(0,L.jsx)(Xi,{})}var $i=(e,t)=>e.routeId===t.routeId&&e._displayPending===t._displayPending,ea=(e,t)=>e[0]===t[0]&&e[1]===t[1],ta=h.memo(function({matchId:e}){let t=B(),n=t.stores.matchStores.get(e);n||Rt();let r=H(t.stores.loadedAt,e=>e),i=H(n,e=>e,$i);return(0,L.jsx)(na,{router:t,matchId:e,resetKey:r,matchState:h.useMemo(()=>{let e=i.routeId,n=t.routesById[e].parentRoute?.id;return{routeId:e,ssr:i.ssr,_displayPending:i._displayPending,parentRouteId:n}},[i._displayPending,i.routeId,i.ssr,t.routesById])})});function na({router:e,matchId:t,resetKey:n,matchState:r}){let i=e.routesById[r.routeId],a=i.options.pendingComponent??e.options.defaultPendingComponent,o=a?(0,L.jsx)(a,{}):null,s=i.options.errorComponent??e.options.defaultErrorComponent,c=i.options.onCatch??e.options.defaultOnCatch,l=i.isRoot?i.options.notFoundComponent??e.options.notFoundRoute?.options.component:i.options.notFoundComponent,u=r.ssr===!1||r.ssr===`data-only`,d=(!i.isRoot||i.options.wrapInSuspense||u)&&(i.options.wrapInSuspense??a??(i.options.errorComponent?.preload||u))?h.Suspense:Zi,f=s?Gr:Zi,p=l?Yi:Zi;return(0,L.jsxs)(i.isRoot?i.options.shellComponent??Zi:Zi,{children:[(0,L.jsx)(Qr.Provider,{value:t,children:(0,L.jsx)(d,{fallback:o,children:(0,L.jsx)(f,{getResetKey:()=>n,errorComponent:s||qr,onCatch:(e,t)=>{if(R(e))throw e.routeId??=r.routeId,e;c?.(e,t)},children:(0,L.jsx)(p,{fallback:e=>{if(e.routeId??=r.routeId,!l||e.routeId&&e.routeId!==r.routeId||!e.routeId&&!i.isRoot)throw e;return h.createElement(l,e)},children:u||r._displayPending?(0,L.jsx)(Jr,{fallback:o,children:(0,L.jsx)(ia,{matchId:t})}):(0,L.jsx)(ia,{matchId:t})})})})}),r.parentRouteId===`__root__`?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(ra,{}),(e.options.scrollRestoration,null)]}):null]})}function ra(){let e=B(),t=h.useRef();return ut(()=>{let n=e.stores.resolvedLocation.get(),r=t.current;n&&(!r||r.href!==n.href)&&e.emit({type:`onRendered`,...jr(e.stores.location.get(),r??n)}),t.current=n},[H(e.stores.resolvedLocation,e=>e?.state.__TSR_key),e]),null}var ia=h.memo(function({matchId:e}){let t=B(),n=(e,n)=>t.getMatch(e.id)?._nonReactive[n]??e._nonReactive[n],r=t.stores.matchStores.get(e);r||Rt();let i=H(r,e=>e),a=i.routeId,o=t.routesById[a],s=h.useMemo(()=>{let e=(t.routesById[a].options.remountDeps??t.options.defaultRemountDeps)?.({routeId:a,loaderDeps:i.loaderDeps,params:i._strictParams,search:i._strictSearch});return e?JSON.stringify(e):void 0},[a,i.loaderDeps,i._strictParams,i._strictSearch,t.options.defaultRemountDeps,t.routesById]),c=h.useMemo(()=>{let e=o.options.component??t.options.defaultComponent;return e?(0,L.jsx)(e,{},s):(0,L.jsx)(aa,{})},[s,o.options.component,t.options.defaultComponent]);if(i._displayPending)throw n(i,`displayPendingPromise`);if(i._forcePending)throw n(i,`minPendingPromise`);if(i.status===`pending`){let e=o.options.pendingMinMs??t.options.defaultPendingMinMs;if(e){let n=t.getMatch(i.id);if(n&&!n._nonReactive.minPendingPromise){let t=Ot();n._nonReactive.minPendingPromise=t,setTimeout(()=>{t.resolve(),n._nonReactive.minPendingPromise=void 0},e)}}throw n(i,`loadPromise`)}if(i.status===`notFound`)return R(i.error)||Rt(),Qi(t,o,i.error);if(i.status===`redirected`)throw z(i.error)||Rt(),n(i,`loadPromise`);if(i.status===`error`)throw i.error;return c}),aa=h.memo(function(){let e=B(),t=h.useContext(Qr),n,r=!1,i;{let a=t?e.stores.matchStores.get(t):void 0;[n,r]=H(a,e=>[e?.routeId,e?.globalNotFound??!1],ea),i=H(e.stores.matchesId,e=>e[e.findIndex(e=>e===t)+1])}let a=n?e.routesById[n]:void 0,o=e.options.defaultPendingComponent?(0,L.jsx)(e.options.defaultPendingComponent,{}):null;if(r)return a||Rt(),Qi(e,a,void 0);if(!i)return null;let s=(0,L.jsx)(ta,{matchId:i});return n===`__root__`?(0,L.jsx)(h.Suspense,{fallback:o,children:s}):s});function oa(){let e=B(),t=h.useRef({router:e,mounted:!1}),[n,r]=h.useState(!1),i=H(e.stores.isLoading,e=>e),a=H(e.stores.hasPending,e=>e),o=dt(i),s=i||n||a,c=dt(s),l=i||a,u=dt(l);return e.startTransition=e=>{r(!0),h.startTransition(()=>{e(),r(!1)})},h.useEffect(()=>{let t=e.history.subscribe(e.load),n=e.buildLocation({to:e.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return mn(e.latestLocation.publicHref)!==mn(n.publicHref)&&e.commitLocation({...n,replace:!0}),()=>{t()}},[e,e.history]),ut(()=>{typeof window<`u`&&e.ssr||t.current.router===e&&t.current.mounted||(t.current={router:e,mounted:!0},(async()=>{try{await e.load()}catch(e){console.error(e)}})())},[e]),ut(()=>{o&&!i&&e.emit({type:`onLoad`,...jr(e.stores.location.get(),e.stores.resolvedLocation.get())})},[o,e,i]),ut(()=>{u&&!l&&e.emit({type:`onBeforeRouteMount`,...jr(e.stores.location.get(),e.stores.resolvedLocation.get())})},[l,u,e]),ut(()=>{if(c&&!s){let t=jr(e.stores.location.get(),e.stores.resolvedLocation.get());e.emit({type:`onResolved`,...t}),pi(()=>{e.stores.status.set(`idle`),e.stores.resolvedLocation.set(e.stores.location.get())})}},[s,c,e]),null}function sa(){let e=B(),t=e.routesById.__root__.options.pendingComponent??e.options.defaultPendingComponent,n=t?(0,L.jsx)(t,{}):null,r=(0,L.jsxs)(typeof document<`u`&&e.ssr?Zi:h.Suspense,{fallback:n,children:[(0,L.jsx)(oa,{}),(0,L.jsx)(ca,{})]});return e.options.InnerWrap?(0,L.jsx)(e.options.InnerWrap,{children:r}):r}function ca(){let e=B(),t=H(e.stores.firstId,e=>e),n=H(e.stores.loadedAt,e=>e),r=t?(0,L.jsx)(ta,{matchId:t}):null;return(0,L.jsx)(Qr.Provider,{value:t,children:e.options.disableGlobalCatchBoundary?r:(0,L.jsx)(Gr,{getResetKey:()=>n,errorComponent:qr,onCatch:void 0,children:r})})}function la(){let e=B();return H(e.stores.matchRouteDeps,e=>e),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])}var ua=e=>({createMutableStore:gi,createReadonlyStore:gi,batch:pi}),da=e=>new fa(e),fa=class extends Mr{constructor(e){super(e,ua)}};function pa({router:e,children:t,...n}){yt(n)&&e.update({...e.options,...n,context:{...e.options.context,...n.context}});let r=(0,L.jsx)(Zr.Provider,{value:e,children:t});return e.options.Wrap?(0,L.jsx)(e.options.Wrap,{children:r}):r}function ma({router:e,...t}){return(0,L.jsx)(pa,{router:e,...t,children:(0,L.jsx)(sa,{})})}function ha(e){let t=B();return H(t.stores.location,wi(e,t))}var ga=(0,h.createContext)(null),_a={didCatch:!1,error:null},va=class extends h.Component{constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=_a}static getDerivedStateFromError(e){return{didCatch:!0,error:e}}resetErrorBoundary(...e){let{error:t}=this.state;t!==null&&(this.props.onReset?.({args:e,reason:`imperative-api`}),this.setState(_a))}componentDidCatch(e,t){this.props.onError?.(e,t)}componentDidUpdate(e,t){let{didCatch:n}=this.state,{resetKeys:r}=this.props;n&&t.error!==null&&ya(e.resetKeys,r)&&(this.props.onReset?.({next:r,prev:e.resetKeys,reason:`keys`}),this.setState(_a))}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)(ga.Provider,{value:{didCatch:i,error:a,resetErrorBoundary:this.resetErrorBoundary}},o)}};function ya(e=[],t=[]){return e.length!==t.length||e.some((e,n)=>!Object.is(e,t[n]))}var U=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})()}))()),ba={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 xa(e){return e===`danger`?`destructive`:e}function W({variant:e=`secondary`,loading:t=!1,disabled:n,className:r,children:i,type:a=`button`,...o}){let s=n||t,c=xa(e);return(0,L.jsxs)(`button`,{type:a,disabled:s,className:(0,U.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`,ba[c],s?`wcpos:opacity-50 wcpos:cursor-not-allowed`:`wcpos:cursor-pointer`,r),...o,children:[t&&(0,L.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,L.jsx)(`circle`,{className:`wcpos:opacity-25`,cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,strokeWidth:`4`}),(0,L.jsx)(`path`,{className:`wcpos:opacity-75`,fill:`currentColor`,d:`M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z`})]}),i]})}function Sa({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,L.jsxs)(`div`,{className:(0,U.default)(`wcpos:flex wcpos:items-center wcpos:gap-3`,o),children:[(0,L.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,U.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,L.jsx)(`span`,{className:(0,U.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,L.jsxs)(`div`,{onClick:f,children:[(0,L.jsx)(`label`,{id:u,className:(0,U.default)(a?`wcpos:cursor-not-allowed`:`wcpos:cursor-pointer`,s??`wcpos:text-sm wcpos:font-medium wcpos:text-gray-900`),children:r}),i&&(0,L.jsx)(`p`,{id:d,className:`wcpos:text-sm wcpos:text-gray-500`,children:i})]})]})}function Ca({label:t,className:n,id:r,disabled:i,...a}){let o=e.useId(),s=r||o;return(0,L.jsxs)(`div`,{className:(0,U.default)(`wcpos:flex wcpos:items-center wcpos:gap-2`,n),children:[(0,L.jsx)(`input`,{id:s,type:`checkbox`,className:(0,U.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,...a}),t&&(0,L.jsx)(`label`,{htmlFor:s,className:(0,U.default)(`wcpos:text-sm wcpos:text-gray-700`,i?`wcpos:opacity-50 wcpos:cursor-not-allowed`:`wcpos:cursor-pointer`),children:t})]})}var G=e.forwardRef(({error:e,className:t,type:n=`text`,...r},i)=>(0,L.jsx)(`input`,{ref:i,type:n,"aria-invalid":e||void 0,className:(0,U.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}));G.displayName=`TextInput`;var wa=e.forwardRef(({error:e,className:t,...n},r)=>(0,L.jsx)(`textarea`,{ref:r,"aria-invalid":e||void 0,className:(0,U.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}));wa.displayName=`TextArea`;function Ta({value:e,options:t,onChange:n,placeholder:r,disabled:i,className:a,inline:o,...s}){return(0,L.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,U.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,L.jsx)(`option`,{value:``,disabled:!0,children:r}),t.map(e=>(0,L.jsx)(`option`,{value:String(e.value),disabled:!!e.disabled,children:e.label},String(e.value)))]})}var Ea=`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`,Da=`wcpos:bg-gray-50 wcpos:text-gray-500 wcpos:cursor-not-allowed`;function Oa(e){return e.toLowerCase()}function ka({countries:n,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),_=e.useRef(null),[v,y]=e.useState(!1),[b,x]=e.useState(``),[S,C]=e.useState(0),[w,T]=e.useState({top:0,left:0,width:0}),E=e.useId(),D=e.useMemo(()=>Object.entries(n).map(([e,t])=>({value:e,label:t})).sort((e,t)=>e.label.localeCompare(t.label)),[n]),O=e.useMemo(()=>{let e=Oa(b.trim());return e?D.filter(t=>Oa(t.label).includes(e)||Oa(t.value).includes(e)):D},[D,b]),k=e.useMemo(()=>c?[{value:``,label:l??`—`,isClear:!0},...O]:O,[c,l,O]),A=r?n[r]:``,j=e.useCallback(()=>{if(!m.current)return;let e=m.current.getBoundingClientRect();T({top:e.bottom+4,left:e.left,width:e.width})},[]),M=e.useCallback(()=>{y(!1),x(``)},[]),N=e.useCallback(()=>{if(u)return;y(!0);let e=r?Math.max(0,k.findIndex(e=>!e.isClear&&e.value===r)):+!!c;C(Math.min(e,Math.max(0,k.length-1)))},[c,u,k,r]),ee=e.useCallback(e=>{i(e),M(),m.current?.focus()},[M,i]);e.useLayoutEffect(()=>{if(!v)return;j();let e=requestAnimationFrame(()=>g.current?.focus());return()=>cancelAnimationFrame(e)},[v,j]),e.useEffect(()=>{if(!v)return;let e=e=>{let t=e.target;m.current?.contains(t)||h.current?.contains(t)||M()};return document.addEventListener(`mousedown`,e),window.addEventListener(`scroll`,j,!0),window.addEventListener(`resize`,j),()=>{document.removeEventListener(`mousedown`,e),window.removeEventListener(`scroll`,j,!0),window.removeEventListener(`resize`,j)}},[v,M,j]),e.useEffect(()=>{v&&C(e=>k.length===0?0:e>=k.length?k.length-1:e)},[v,k]),e.useEffect(()=>{!v||!_.current||_.current.querySelector(`[data-index="${S}"]`)?.scrollIntoView?.({block:`nearest`})},[v,S]);let te=e=>{u||(e.key===`ArrowDown`||e.key===`ArrowUp`||e.key===`Enter`||e.key===` `)&&(e.preventDefault(),N())},P=e=>{switch(e.key){case`ArrowDown`:e.preventDefault(),C(e=>k.length===0?0:(e+1)%k.length);break;case`ArrowUp`:e.preventDefault(),C(e=>k.length===0?0:(e-1+k.length)%k.length);break;case`Home`:e.preventDefault(),C(0);break;case`End`:e.preventDefault(),C(Math.max(0,k.length-1));break;case`Enter`:e.preventDefault(),k[S]&&ee(k[S].value);break;case`Escape`:e.preventDefault(),M(),m.current?.focus();break;case`Tab`:M()}},ne=k.length>0?`${E}-option-${S}`:void 0;return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`button`,{ref:m,id:f,type:`button`,role:`combobox`,"aria-haspopup":`listbox`,"aria-expanded":v,"aria-controls":v?E:void 0,"aria-label":p,disabled:u,onClick:()=>v?M():N(),onKeyDown:te,className:(0,U.default)(Ea,u&&Da,d),children:[(0,L.jsx)(`span`,{className:(0,U.default)(`wcpos:truncate`,!A&&`wcpos:text-gray-500`),children:A||a||``}),(0,L.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,L.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`})})]}),v&&t.createPortal((0,L.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:w.top,left:w.left,width:w.width},children:[(0,L.jsx)(`div`,{className:`wcpos:p-2 wcpos:border-b wcpos:border-gray-100`,children:(0,L.jsx)(`input`,{ref:g,type:`text`,role:`searchbox`,"aria-autocomplete":`list`,"aria-controls":E,"aria-activedescendant":ne,value:b,onChange:e=>x(e.target.value),onKeyDown:P,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,L.jsxs)(`ul`,{ref:_,id:E,role:`listbox`,"aria-label":p,className:`wcpos:m-0 wcpos:max-h-60 wcpos:list-none wcpos:overflow-auto wcpos:p-1`,children:[k.map((e,t)=>{let n=t===S,i=e.isClear?r===``:e.value===r;return(0,L.jsx)(`li`,{id:`${E}-option-${t}`,"data-index":t,role:`option`,"aria-selected":i,onMouseDown:e=>e.preventDefault(),onMouseEnter:()=>C(t),onClick:()=>ee(e.value),className:(0,U.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,L.jsx)(`span`,{className:`wcpos:truncate`,children:e.label}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`span`,{className:`wcpos:truncate`,children:e.label}),(0,L.jsx)(`span`,{className:`wcpos:text-xs wcpos:text-gray-400`,children:e.value})]})},e.isClear?`__clear__`:e.value)}),O.length===0&&(0,L.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 Aa=`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`,ja=`wcpos:bg-gray-50 wcpos:text-gray-500 wcpos:cursor-not-allowed`,Ma=`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`,Na=`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 Pa(e){return e.toLowerCase()}function Fa(e,t,n){let r=t.find(t=>t.value===e);return r?r.label:n?e:``}function Ia({value:n,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 _=e.useRef(null),v=e.useRef(null),y=e.useRef(null),b=e.useRef(null),[x,S]=e.useState(!1),[C,w]=e.useState(()=>Fa(n,r,a)),[T,E]=e.useState(-1),[D,O]=e.useState({top:0,left:0,width:0}),k=e.useId(),A=s!==void 0;e.useEffect(()=>{x||w(Fa(n,r,a))},[n,r,x,a]);let j=e.useMemo(()=>{let e=C.trim(),t=Pa(e),n=!A&&x&&t?r.filter(e=>Pa(e.label).includes(t)||Pa(e.value).includes(t)):r.slice();return x&&a&&o&&e&&(r.some(e=>Pa(e.label)===t||Pa(e.value)===t)||n.push({value:e,label:o(e),isCreate:!0})),n},[a,o,C,x,r,A]),M=e.useCallback(()=>{if(!_.current)return;let e=_.current.getBoundingClientRect();O({top:e.bottom+4,left:e.left,width:e.width})},[]),N=e.useCallback(()=>{S(!1)},[]),ee=e.useCallback(()=>{f||(S(!0),E(-1))},[f]),te=e.useCallback(e=>{let t=e.isCreate?e.value:e.label;w(t),N(),i(e.value)},[N,i]),P=e.useCallback(()=>{let e=C.trim(),t=r.find(t=>Pa(t.label)===Pa(e));if(t){w(t.label),N(),t.value!==n&&i(t.value);return}if(a){w(e),N(),e!==n&&i(e);return}w(Fa(n,r,a)),N()},[a,N,C,i,r,n]),ne=e.useRef(P);e.useEffect(()=>{ne.current=P},[P]),e.useLayoutEffect(()=>{x&&M()},[x,M]),e.useEffect(()=>{if(!x)return;let e=e=>{let t=e.target;_.current?.contains(t)||y.current?.contains(t)||ne.current()};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)}},[x,M]),e.useEffect(()=>{x&&E(e=>j.length===0?-1:e>=j.length?j.length-1:e)},[x,j]),e.useEffect(()=>{!x||!b.current||b.current.querySelector(`[data-index="${T}"]`)?.scrollIntoView?.({block:`nearest`})},[x,T]);let re=e=>{let t=e.target.value;w(t),x||S(!0),E(t.trim()===``?-1:0),s?.(t)},ie=()=>{if(f)return;S(!0);let e=v.current;e&&requestAnimationFrame(()=>e.select())},ae=e=>{let t=e.relatedTarget;t&&(_.current?.contains(t)||y.current?.contains(t))||ne.current()},oe=e=>{if(!f)switch(e.key){case`ArrowDown`:if(e.preventDefault(),!x){ee();return}E(e=>j.length===0?-1:e===-1?0:(e+1)%j.length);break;case`ArrowUp`:if(e.preventDefault(),!x){ee();return}E(e=>j.length===0?-1:e===-1?j.length-1:(e-1+j.length)%j.length);break;case`Home`:x&&j.length>0&&(e.preventDefault(),E(0));break;case`End`:x&&j.length>0&&(e.preventDefault(),E(j.length-1));break;case`Enter`:if(x&&T>=0&&j[T]){e.preventDefault(),te(j[T]);return}e.preventDefault(),P();break;case`Escape`:x&&(e.preventDefault(),w(Fa(n,r,a)),N());break;case`Tab`:x&&P()}},se=e=>{e.preventDefault(),!f&&(x?N():(ee(),v.current?.focus()))},F=x&&T>=0&&j.length>0?`${k}-option-${T}`:void 0;return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{ref:_,className:(0,U.default)(Aa,f&&ja,p),children:[(0,L.jsx)(`input`,{ref:v,id:m,type:`text`,role:`combobox`,"aria-haspopup":`listbox`,"aria-expanded":x,"aria-controls":x?k:void 0,"aria-autocomplete":`list`,"aria-activedescendant":F,"aria-label":h,"aria-labelledby":g,autoComplete:`off`,"data-1p-ignore":!0,"data-lpignore":`true`,disabled:f,value:C,placeholder:c,onChange:re,onFocus:ie,onBlur:ae,onKeyDown:oe,className:Ma}),(0,L.jsx)(`button`,{type:`button`,tabIndex:-1,"aria-hidden":`true`,disabled:f,onMouseDown:se,className:Na,children:(0,L.jsx)(`svg`,{className:`wcpos:h-4 wcpos:w-4`,viewBox:`0 0 20 20`,fill:`currentColor`,"aria-hidden":`true`,children:(0,L.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`})})})]}),x&&t.createPortal((0,L.jsx)(`div`,{ref:y,className:`wcpos:fixed wcpos:z-[99999] wcpos:rounded-md wcpos:border wcpos:border-gray-200 wcpos:bg-white wcpos:shadow-lg`,style:{top:D.top,left:D.left,width:D.width},children:(0,L.jsx)(`ul`,{ref:b,id:k,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,L.jsx)(`li`,{role:`presentation`,className:`wcpos:px-2 wcpos:py-2 wcpos:text-sm wcpos:text-gray-500`,children:d??`Loading…`}):j.length===0?(0,L.jsx)(`li`,{role:`presentation`,className:`wcpos:px-2 wcpos:py-2 wcpos:text-sm wcpos:text-gray-500`,children:l??`No results`}):j.map((e,t)=>{let r=t===T,i=!e.isCreate&&e.value===n;return(0,L.jsx)(`li`,{id:`${k}-option-${t}`,"data-index":t,role:`option`,"aria-selected":i,onMouseDown:e=>e.preventDefault(),onMouseEnter:()=>E(t),onClick:()=>te(e),className:(0,U.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,L.jsx)(`span`,{className:`wcpos:truncate`,children:e.label})},e.isCreate?`__create__-${k}`:e.value)})})}),document.body)]})}function La({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,L.jsxs)(`div`,{className:`wcpos:relative wcpos:z-50`,children:[(0,L.jsx)(`div`,{className:`wcpos:fixed wcpos:inset-0 wcpos:bg-black/30`,"aria-hidden":`true`}),(0,L.jsx)(`div`,{className:`wcpos:fixed wcpos:inset-0 wcpos:flex wcpos:items-center wcpos:justify-center wcpos:p-4`,onClick:()=>n(!1),children:(0,L.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,U.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,L.jsx)(`h2`,{id:c,className:`wcpos:text-lg wcpos:font-semibold wcpos:text-gray-900 wcpos:mb-2`,children:r}),a&&(0,L.jsx)(`p`,{id:l,className:`wcpos:text-sm wcpos:text-gray-500 wcpos:mb-4`,children:a}),o]})})]}):null}function Ra({text:n,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,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`span`,{ref:a,className:(0,U.default)(`wcpos:inline-flex`,i),onMouseEnter:f,onMouseLeave:p,onFocus:f,onBlur:p,"aria-describedby":o?u:void 0,tabIndex:0,children:r}),o&&t.createPortal((0,L.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:n}),document.body)]})}var za=e.createContext(null);function Ba({trigger:n,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),[]),_=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 v=e.useMemo(()=>({close:g}),[g]);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`span`,{ref:c,className:(0,U.default)(`wcpos:inline-flex`,o),onClick:_,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),_())},role:`button`,tabIndex:0,"aria-haspopup":`menu`,"aria-expanded":u,"aria-controls":u?m:void 0,children:n}),u&&t.createPortal((0,L.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,L.jsx)(za.Provider,{value:v,children:r})}),document.body)]})}function Va({children:t,onSelect:n,href:r,disabled:i,target:a,rel:o,destructive:s}){let c=e.useContext(za),l=(0,U.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,L.jsx)(`a`,{href:i?void 0:r,target:a,rel:o,role:`menuitem`,className:l,"aria-disabled":i,onClick:u,children:t}):(0,L.jsx)(`button`,{type:`button`,role:`menuitem`,className:l,disabled:i,onClick:u,children:t})}Ba.Item=Va;function Ha({active:e=!1,className:t,children:n,...r}){return(0,L.jsx)(`div`,{className:(0,U.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 Ua({noPadding:e=!1,className:t,children:n,...r}){return(0,L.jsx)(`div`,{className:(0,U.default)(`wcpos:flex-1`,!e&&`wcpos:p-4`,t),...r,children:n})}function Wa({className:e,children:t,...n}){return(0,L.jsx)(`div`,{className:(0,U.default)(`wcpos:border-t wcpos:border-gray-200 wcpos:bg-gray-50 wcpos:px-4 wcpos:py-2.5`,e),...n,children:t})}Ha.Body=Ua,Ha.Footer=Wa;var Ga={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 Ka(){return(0,L.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,L.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 qa({status:e=`info`,children:t,onRemove:n,isDismissible:r=!0,className:i,dismissLabel:a=`Dismiss`}){return(0,L.jsxs)(`div`,{className:(0,U.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`,Ga[e],i),children:[(0,L.jsx)(`div`,{className:`wcpos:flex-1`,children:t}),r&&n&&(0,L.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,L.jsx)(Ka,{})})]})}var Ja={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`},Ya={info:`i`,success:`✓`,warning:`!`,error:`!`};function Xa({status:e=`info`,title:t,icon:n,children:r,className:i}){let a=n===void 0?Ya[e]:n;return(0,L.jsxs)(`div`,{className:(0,U.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`,Ja[e],i),children:[a!==null&&(0,L.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,L.jsxs)(`div`,{className:`wcpos:flex-1 wcpos:min-w-0`,children:[t&&(0,L.jsx)(`div`,{className:`wcpos:font-semibold wcpos:mb-0.5`,children:t}),(0,L.jsx)(`div`,{children:r})]})]})}function K({className:e,width:t,height:n,style:r,...i}){return(0,L.jsx)(`div`,{className:(0,U.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,L.jsxs)(`div`,{className:(0,U.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,L.jsx)(`div`,{className:`wcpos:sm:w-[30%] wcpos:sm:max-w-[200px] wcpos:shrink-0 wcpos:sm:pt-0.5`,children:(0,L.jsx)(`label`,{htmlFor:t,className:`wcpos:text-sm wcpos:font-medium wcpos:text-gray-700`,children:e})}),(0,L.jsxs)(`div`,{className:`wcpos:flex-1 wcpos:min-w-0`,children:[r,n&&(0,L.jsx)(`p`,{className:`wcpos:mt-1 wcpos:text-xs wcpos:text-gray-500`,children:n})]})]})}function Za({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,L.jsxs)(`div`,{className:(0,U.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,L.jsxs)(`div`,{className:(0,U.default)(`wcpos:mb-3`,s&&(0,U.default)(`wcpos:flex wcpos:items-center`,o?`wcpos:justify-between`:`wcpos:justify-end`)),children:[o&&(0,L.jsxs)(`div`,{children:[e&&(0,L.jsx)(`h3`,{className:`wcpos:text-base wcpos:font-semibold wcpos:text-gray-900 wcpos:m-0`,children:e}),t&&(0,L.jsx)(`p`,{className:(0,U.default)(`wcpos:text-sm wcpos:text-gray-500`,e&&`wcpos:mt-1`),children:t})]}),s&&(0,L.jsx)(`div`,{className:`wcpos:flex-shrink-0`,children:n})]}),(0,L.jsx)(`div`,{children:i})]})}function Qa({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,L.jsxs)(`div`,{ref:o,className:(0,U.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,L.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,L.jsx)(`button`,{ref:d(e.key),type:`button`,disabled:e.disabled,"aria-pressed":t,onClick:()=>r(e.key),className:(0,U.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 $a={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`},eo={sm:`wcpos:text-xs wcpos:px-2 wcpos:py-0.5`,xs:`wcpos:text-[10px] wcpos:px-1.5 wcpos:py-0.5`},to={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,L.jsxs)(`span`,{className:(0,U.default)(`wcpos:inline-flex wcpos:items-center wcpos:gap-1 wcpos:font-medium wcpos:leading-none wcpos:shrink-0`,$a[e],eo[n],to[t],i),...o,children:[r,a]})}var no={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`},ro={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`},io={none:`wcpos:ring-1 wcpos:ring-gray-200`,brand:`wcpos:ring-2 wcpos:ring-wp-admin-theme-color`};function ao(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 oo({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,L.jsxs)(`span`,{className:(0,U.default)(`wcpos:relative wcpos:inline-flex wcpos:shrink-0`,s),children:[(0,L.jsx)(`span`,{className:(0,U.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`,no[r],io[i]),role:u?void 0:`img`,"aria-label":u?void 0:d,children:u?(0,L.jsx)(`img`,{src:n,alt:t,className:`wcpos:w-full wcpos:h-full wcpos:object-cover`,onError:()=>l(!0)}):(0,L.jsx)(`span`,{"aria-hidden":`true`,children:ao(t)})}),a===`active`&&(0,L.jsx)(`span`,{className:(0,U.default)(`wcpos:absolute wcpos:-bottom-0.5 wcpos:-right-0.5`,`wcpos:rounded-full wcpos:bg-green-500 wcpos:ring-2 wcpos:ring-white`,ro[r]),role:`status`,"aria-label":o||`Active now`,title:o||`Active now`})]})}var so={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 co({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,L.jsx)(`div`,{className:(0,U.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`,so[n],a?`wcpos:translate-y-0 wcpos:opacity-100`:`wcpos:-translate-y-full wcpos:opacity-0`),children:t}):null}var lo=e.createContext(null),uo=0;function fo(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?crypto.randomUUID():(uo+=1,`snackbar-${Date.now()}-${uo}`)}function po({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??fo();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,L.jsx)(lo.Provider,{value:{addSnackbar:c},children:(0,L.jsxs)(`div`,{ref:a,className:`wcpos:relative wcpos:flex-1 wcpos:flex wcpos:flex-col`,children:[(0,L.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,L.jsx)(co,{...e,onRemove:()=>{try{e.onRemove?.()}finally{l(e.id)}}},e.id))}),t]})})}function mo(){let t=e.useContext(lo);if(!t)throw Error(`useSnackbar must be called within SnackbarProvider`);return t}function ho({className:e,tableClassName:t,children:n,...r}){return(0,L.jsx)(`div`,{className:(0,U.default)(`wcpos:overflow-x-auto wcpos:rounded-md wcpos:border wcpos:border-gray-200`,e),...r,children:(0,L.jsx)(`table`,{className:(0,U.default)(`wcpos:w-full wcpos:text-sm`,t),children:n})})}function go({className:e,children:t,...n}){return(0,L.jsx)(`thead`,{className:e,...n,children:t})}function _o({className:e,children:t,...n}){return(0,L.jsx)(`tbody`,{className:e,...n,children:t})}var vo=e.forwardRef(function({className:e,children:t,...n},r){return(0,L.jsx)(`tr`,{ref:r,className:(0,U.default)(`wcpos:bg-gray-50 wcpos:text-left wcpos:text-xs wcpos:uppercase wcpos:tracking-wide wcpos:text-gray-500`,e),...n,children:t})}),yo=e.forwardRef(function({className:e,children:t,...n},r){return(0,L.jsx)(`tr`,{ref:r,className:(0,U.default)(`wcpos:border-t wcpos:border-gray-100`,e),...n,children:t})}),Y=e.forwardRef(function({className:e,children:t,...n},r){return(0,L.jsx)(`th`,{ref:r,className:(0,U.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,L.jsx)(`td`,{ref:r,className:(0,U.default)(`wcpos:px-3 wcpos:py-2 wcpos:align-middle`,e),...n,children:t})});ho.Header=go,ho.HeaderRow=vo,ho.Body=_o,ho.Row=yo,ho.Head=Y,ho.Cell=X;var bo=[{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`}],xo={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`},So={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`},Co={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`},wo=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 To(e){if(!e)return`other`;let t=e.toUpperCase();return So[t]?So[t]:wo.has(t)?`eu_vat`:`other`}function Eo(e,t){if(e===`eu_vat`){let e=t?.toUpperCase();if(e&&wo.has(e))return e;let n=window?.wcpos?.settings?.storeCountry?.toUpperCase();return n&&wo.has(n)?n:void 0}return Co[e]}function Do(e,t){return xo[e]??t}var Oo=e=>{let t={type:e.type||`other`,value:e.value||``};return e.country&&(t.country=e.country),e.label&&(t.label=e.label),t},ko=(e,t)=>{if(typeof t.country==`string`&&t.country)return{...t,type:To(t.country)};if(typeof t.type==`string`){let n=Eo(t.type,e.country);if(n)return{...t,country:n};if(t.type===`eu_vat`)return{...t,country:void 0}}return t},Ao=0,jo=()=>`tax-id-row-${++Ao}`;function Mo({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,L.jsxs)(yo,{children:[(0,L.jsx)(X,{children:(0,L.jsx)(Ta,{"aria-label":n.type,value:t.type,options:bo,onChange:({value:e})=>r({type:String(e)})})}),(0,L.jsx)(X,{children:(0,L.jsx)(G,{"aria-label":n.value,placeholder:Do(t.type,n.value),value:a,onChange:e=>o(e.target.value),onBlur:()=>{let e=a.trim();e!==t.value&&r({value:e})}})}),(0,L.jsx)(X,{children:(0,L.jsx)(ka,{"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,L.jsx)(X,{children:(0,L.jsx)(G,{"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,L.jsx)(X,{className:`wcpos:text-right`,children:(0,L.jsx)(W,{variant:`ghost-destructive`,onMouseDown:e=>e.preventDefault(),onClick:i,children:n.remove})})]})}var No=e.forwardRef(function({value:t,onChange:n,labels:r},i){let a=e.useMemo(()=>Array.isArray(t)?t.map(Oo):[],[t]),[o,s]=e.useState(()=>a.map(()=>jo())),[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},()=>jo());return[...e,...t]}return e.slice(0,a.length)})},[a.length]);let u=e.useCallback((e,t)=>{if(e>=a.length&&c){let e=ko(c.taxId,t),r=Oo({...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=ko(n,t);return Oo({...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:To(t),value:``};return t&&(n.country=t),{id:jo(),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,L.jsxs)(`div`,{className:`wcpos:space-y-3`,children:[(0,L.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,L.jsx)(W,{variant:`outline`,onClick:f,children:r.add})]}):(0,L.jsxs)(`div`,{className:`wcpos:space-y-3`,children:[(0,L.jsxs)(ho,{children:[(0,L.jsx)(go,{children:(0,L.jsxs)(vo,{children:[(0,L.jsx)(Y,{style:{width:`11rem`},children:r.type}),(0,L.jsx)(Y,{children:r.value}),(0,L.jsx)(Y,{style:{width:`12rem`},children:r.country}),(0,L.jsx)(Y,{children:r.label}),(0,L.jsx)(Y,{className:`wcpos:text-right`,style:{width:`1%`},children:(0,L.jsx)(`span`,{className:`wcpos:sr-only`,children:r.remove})})]})}),(0,L.jsx)(_o,{children:p.map((e,t)=>(0,L.jsx)(Mo,{taxId:e.taxId,labels:r,onChangeField:e=>u(t,e),onRemove:()=>d(t)},e.id))})]}),(0,L.jsx)(W,{variant:`outline`,onClick:f,children:r.add})]})}),Z=e=>typeof e==`string`,Po=()=>{let e,t,n=new Promise((n,r)=>{e=n,t=r});return n.resolve=e,n.reject=t,n},Fo=e=>e==null?``:String(e),Io=(e,t,n)=>{e.forEach(e=>{t[e]&&(n[e]=t[e])})},Lo=/###/g,Ro=e=>e&&e.includes(`###`)?e.replace(Lo,`.`):e,zo=e=>!e||Z(e),Bo=(e,t,n)=>{let r=Z(t)?t.split(`.`):t,i=0;for(;i<r.length-1;){if(zo(e))return{};let t=Ro(r[i]);!e[t]&&n&&(e[t]=new n),e=Object.prototype.hasOwnProperty.call(e,t)?e[t]:{},++i}return zo(e)?{}:{obj:e,k:Ro(r[i])}},Vo=(e,t,n)=>{let{obj:r,k:i}=Bo(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=Bo(e,o,Object);for(;s.obj===void 0&&o.length;)a=`${o[o.length-1]}.${a}`,o=o.slice(0,o.length-1),s=Bo(e,o,Object),s?.obj&&s.obj[`${s.k}.${a}`]!==void 0&&(s.obj=void 0);s.obj[`${s.k}.${a}`]=n},Ho=(e,t,n,r)=>{let{obj:i,k:a}=Bo(e,t,Object);i[a]=i[a]||[],i[a].push(n)},Uo=(e,t)=>{let{obj:n,k:r}=Bo(e,t);if(n&&Object.prototype.hasOwnProperty.call(n,r))return n[r]},Wo=(e,t,n)=>{let r=Uo(e,n);return r===void 0?Uo(t,n):r},Go=(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]):Go(e[r],t[r],n):e[r]=t[r]);return e},Ko=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,`\\$&`),qo={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`,"/":`/`},Jo=e=>Z(e)?e.replace(/[&<>"'\/]/g,e=>qo[e]):e,Yo=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}},Xo=[` `,`,`,`?`,`!`,`;`],Zo=new Yo(20),Qo=(e,t,n)=>{t||=``,n||=``;let r=Xo.filter(e=>!t.includes(e)&&!n.includes(e));if(r.length===0)return!0;let i=Zo.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},$o=(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,`-`),ts={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)}},ns=new class e{constructor(e,t={}){this.init(e,t)}init(e,t={}){this.prefix=t.prefix||`i18next:`,this.logger=e||ts,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)}},rs=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)})}},is=class extends rs{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=Uo(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:$o(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),Vo(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=Uo(this.data,o)||{};a.skipCopy||(n=JSON.parse(JSON.stringify(n))),r?Go(s,n,i):s={...s,...n},Vo(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}},as={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}},os=Symbol(`i18next/PATH_KEY`);function ss(){let e=[],t=Object.create(null),n;return t.get=(r,i)=>(n?.revoke?.(),i===os?e:(e.push(i),n=Proxy.revocable(r,t),n.proxy)),Proxy.revocable(Object.create(null),t).proxy}function cs(e,t){let{[os]:n}=e(ss()),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 ls=e=>!Z(e)&&typeof e!=`boolean`&&typeof e!=`number`,us=class e extends rs{constructor(e,t={}){super(),Io([`resourceStore`,`languageUtils`,`pluralResolver`,`interpolator`,`backendConnector`,`i18nFormat`,`utils`],e,this),this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator=`.`),this.logger=ns.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=ls(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&&!Qo(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=cs(t,{...this.options,...i})),Array.isArray(t)||(t=[String(t)]),t=t.map(e=>typeof e==`function`?cs(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=ls(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:ls(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=as.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`?cs(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}},ds=class{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=ns.create(`languageUtils`)}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.getFallbackCodes((t===!1?[]:t)||this.options.fallbackLng||[],e),r=[],i=e=>{e&&(this.isSupportedCode(e)?r.push(e):this.logger.warn(`rejecting language code not found in supportedLngs: ${e}`))};return Z(e)&&(e.includes(`-`)||e.includes(`_`))?(this.options.load!==`languageOnly`&&i(this.formatLanguageCode(e)),this.options.load!==`languageOnly`&&this.options.load!==`currentOnly`&&i(this.getScriptPartFromCode(e)),this.options.load!==`currentOnly`&&i(this.getLanguagePartFromCode(e))):Z(e)&&i(this.formatLanguageCode(e)),n.forEach(e=>{r.includes(e)||i(this.formatLanguageCode(e))}),r}},fs={zero:0,one:1,two:2,few:3,many:4,other:5},ps={select:e=>e===1?`one`:`other`,resolvedOptions:()=>({pluralCategories:[`one`,`other`]})},ms=class{constructor(e,t={}){this.languageUtils=e,this.options=t,this.logger=ns.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!`),ps;if(!e.match(/-|_/))return ps;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)=>fs[e]-fs[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))}},hs=(e,t,n,r=`.`,i=!0)=>{let a=Wo(e,t,n);return!a&&i&&Z(n)&&(a=$o(e,n,r),a===void 0&&(a=$o(t,n,r))),a},gs=e=>e.replace(/\$/g,`$$$$`),_s=class{constructor(e={}){this.logger=ns.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?Jo:t,this.escapeValue=n===void 0||n,this.useRawValueToEscape=r!==void 0&&r,this.prefix=i?Ko(i):a||`{{`,this.suffix=o?Ko(o):s||`}}`,this.formatSeparator=c||`,`,this.unescapePrefix=l?``:u?Ko(u):`-`,this.unescapeSuffix=this.unescapePrefix?``:l?Ko(l):``,this.nestingPrefix=d?Ko(d):f||Ko(`$t(`),this.nestingSuffix=p?Ko(p):m||Ko(`)`),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=hs(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(hs(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=Fo(a));let s=t.safeValue(a);if(e=e.replace(i[0],gs(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(`${Ko(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=Fo(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],i),this.regexp.lastIndex=0}return e}},vs=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}},ys=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)}},bs=e=>(t,n,r)=>e(es(n),r)(t),xs=class{constructor(e={}){this.logger=ns.create(`formatter`),this.options=e,this.init(e)}init(e,t={interpolation:{}}){this.formatSeparator=t.interpolation.formatSeparator||`,`;let n=t.cacheInBuiltFormats?ys:bs;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()]=ys(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}=vs(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)}},Ss=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)},Cs=class extends rs{constructor(e,t,n,r={}){super(),this.backend=e,this.store=t,this.services=n,this.languageUtils=n.languageUtils,this.options=r,this.logger=ns.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=>{Ho(n.loaded,[i],a),Ss(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)}}},ws=()=>({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}),Ts=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),Es=()=>{},Ds=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(t=>{typeof e[t]==`function`&&(e[t]=e[t].bind(e))})},Q=class e extends rs{constructor(e={},t){if(super(),this.options=Ts(e),this.services={},this.logger=ns,this.modules={external:[]},Ds(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=ws();this.options={...n,...this.options,...Ts(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?ns.init(r(this.modules.logger),this.options):ns.init(null,this.options);let e;e=this.modules.formatter?this.modules.formatter:xs;let t=new ds(this.options);this.store=new is(this.options.resources,this.options);let n=this.services;n.logger=ns,n.resourceStore=this.store,n.languageUtils=t,n.pluralResolver=new ms(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 _s(this.options),n.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},n.backendConnector=new Cs(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 us(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||=Es,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=Po(),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=Es){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=Po();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||=Es,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`&&as.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=Po();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=cs(o.keyPrefix,c));let l=this.options.keySeparator||`.`,u;return o.keyPrefix&&Array.isArray(e)?u=e.map(e=>(typeof e==`function`&&(e=cs(e,c)),`${o.keyPrefix}${l}${e}`)):(typeof e==`function`&&(e=cs(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=Po();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=Po();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 ds(ws());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=Es){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 is(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={...ws().interpolation,...this.options.interpolation,...t.interpolation},n={...i,interpolation:e};a.services.interpolator=new _s(n)}return a.translator=new us(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 Os(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function ks(e){"@babel/helpers - typeof";return ks=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},ks(e)}function As(e,t){if(ks(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(ks(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function js(e){var t=As(e,`string`);return ks(t)==`symbol`?t:t+``}function Ms(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,js(r.key),r)}}function Ns(e,t,n){return t&&Ms(e.prototype,t),n&&Ms(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}var Ps=[],Fs=Ps.forEach,Is=Ps.slice,Ls=[`__proto__`,`constructor`,`prototype`];function Rs(e){return Fs.call(Is.call(arguments,1),function(t){if(t)for(var n=0,r=Object.keys(t);n<r.length;n++){var i=r[n];Ls.indexOf(i)>-1||e[i]===void 0&&(e[i]=t[i])}}),e}function zs(e){return e?typeof e==`function`?new e:e:null}function Bs(){return{handleEmptyResourcesAsFailed:!0,cacheHitMode:`none`,retryOnFailure:!1}}function Vs(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 Hs=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]:{};Os(this,e),this.backends=[],this.type=`backend`,this.allOptions=r,this.init(t,n)}return Ns(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=Rs(n,this.options||{},Bs()),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]||zs(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?Vs(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&&Vs(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)})})})}}}])}();Hs.type=`backend`;var Us=[];Us.forEach,Us.slice;var Ws=[`__proto__`,`constructor`,`prototype`];function Gs(e){return!(typeof e!=`string`||e.length===0||e.length>128||Ws.indexOf(e)>-1||e.indexOf(`..`)>-1||e.indexOf(`\\`)>-1||/[?#%\s]/.test(e)||/[\x00-\x1F\x7F]/.test(e))}function Ks(e){return!(!Gs(e)||e.indexOf(`/`)>-1||e.indexOf(`@`)>-1)}function qs(e){return Gs(e)}var Js={lng:Ks,ns:qs};function Ys(e){return typeof e==`string`?e.replace(/[\r\n\x00-\x1F\x7F]/g,` `):e}function Xs(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 Zs(){return typeof XMLHttpRequest==`function`||typeof XMLHttpRequest==`object`}function Qs(e){return!!e&&typeof e.then==`function`}function $s(e){return Qs(e)?e:Promise.resolve(e)}var ec=/\{\{(.+?)\}\}/g;function tc(e,t){let n=!1,r=e.replace(ec,(e,r)=>{let i=r.trim();if(Ws.indexOf(i)>-1)return e;let a=t[i];if(a==null)return e;let o=Js[i]||Ks,s=String(a).split(`+`);for(let t of s)if(!o(t))return n=!0,e;return s.join(`+`)});return n?null:r}var nc=typeof globalThis<`u`?globalThis:typeof global<`u`?global:typeof window<`u`?window:void 0,rc;typeof fetch==`function`?rc=fetch:nc&&typeof nc.fetch==`function`&&(rc=nc.fetch);var ic=Zs()&&nc?nc.XMLHttpRequest:void 0,ac=typeof ActiveXObject==`function`&&nc?nc.ActiveXObject:void 0,oc=[`__proto__`,`constructor`,`prototype`],sc=(e,t)=>{if(t&&typeof t==`object`){let n=``;for(let e of Object.keys(t))oc.indexOf(e)>-1||(n+=`&`+encodeURIComponent(e)+`=`+encodeURIComponent(t[e]));if(!n)return e;e=e+(e.indexOf(`?`)===-1?`?`:`&`)+n.slice(1)}return e},cc=(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):rc(e,t).then(i).catch(n)},lc=(e,t,n,r)=>{e.queryStringParams&&(t=sc(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{cc(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]}),cc(t,o,r,s),e._omitFetchOptions=!0}catch(e){r(e)}}},uc=(e,t,n,r)=>{n&&typeof n==`object`&&(n=sc(``,n).slice(1)),e.queryStringParams&&(t=sc(t,e.queryStringParams));try{let i=ic?new ic:new ac(`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))oc.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)}},dc=(e,t,n,r)=>{if(typeof n==`function`&&(r=n,n=void 0),r||=(()=>{}),rc&&t.indexOf(`file:`)!==0)return lc(e,t,n,r);if(Zs()||typeof ActiveXObject==`function`)return uc(e,t,n,r);r(Error(`No fetch and no xhr implementation found!`))},fc=()=>({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:dc,reloadInterval:typeof window<`u`?!1:36e5,customHeaders:{},queryStringParams:{},crossDomain:!1,withCredentials:!1,overrideMimeType:!1,requestOptions:{mode:`cors`,credentials:`same-origin`,cache:`default`}}),pc=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={...fc(),...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=$s(a),a.then(a=>{if(!a)return i(null,{});let o=tc(a,{lng:e.join(`+`),ns:n.join(`+`)});if(o==null){let t=e.map(Ys).join(`, `),r=n.map(Ys).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=Ys(Xs(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+`: `+Ys(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=tc(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)})})})}};pc.type=`backend`;function mc(e,t,n){return(t=js(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function hc(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 gc(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?hc(Object(n),!0).forEach(function(t){mc(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):hc(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var _c=function(){function e(t){Os(this,e),this.store=t.store}return Ns(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 vc(){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 yc=function(){function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Os(this,e),this.init(t,n),this.type=`backend`}return Ns(e,[{key:`init`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.services=e,this.options=gc(gc(gc({},vc()),this.options),t),this.storage=new _c(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&&ks(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=gc(gc({},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}}])}();yc.type=`backend`;var bc={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},xc=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?("[^"]*"|'[^']*')/g;function Sc(e){let t={type:`tag`,name:``,voidElement:!1,attrs:{},children:[]},n=e.match(/<\/?([^\s]+?)[/\s>]/);if(n&&(t.name=n[1],(bc[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(xc),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 Cc=/<!--[\s\S]*?-->|<[a-zA-Z0-9\-!/](?:"[^"]*"|'[^']*'|[^'">])*>/g,wc=/<\/?([^\s]+?)[/\s>]/,Tc=/^\s*$/,Ec=/^(script|style)$/i,Dc=`\0`,Oc=Object.create(null);function kc(e){e.forEach(function(e){if(e.type===`text`){e.content=e.content.split(Dc).join(`<`);return}if(e.type===`comment`){e.comment=e.comment.split(Dc).join(`<`);return}for(let t in e.attrs){let n=e.attrs[t];typeof n==`string`&&n.indexOf(Dc)>-1&&(e.attrs[t]=n.split(Dc).join(`<`))}e.children.length&&kc(e.children)})}function Ac(e,t){let n=t&&t.components||Oc,r=t&&t.allowedTags,i=!1;if(r){let t=typeof r==`function`?r:function(e){return r.indexOf(e)>-1},n=``,a=0;Cc.lastIndex=0;let o;for(;o=Cc.exec(e);){let r=o[0];n+=e.slice(a,o.index);let s=r.match(wc);r.startsWith(`<!--`)||s&&t(s[1])?(n+=r,a=o.index+r.length):(i=!0,n+=Dc,a=o.index+1,Cc.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=Cc.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=Sc(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=Sc(i),s.type===`tag`&&n[s.name]&&(s.type=`component`,l=!0);let t=!1;if(!l&&!s.voidElement&&Ec.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);Tc.test(n)&&(n=` `),(t>-1&&c+b.length>=0||n!==` `)&&b.push({type:`text`,content:n})}}),i&&kc(a),a}function jc(e){let t=[];for(let n in e)e[n]===null?t.push(n):t.push(n+`="`+String(e[n]).replace(/"/g,`"`)+`"`);return t.length?` `+t.join(` `):``}function Mc(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?jc(t.attrs):``)+n,t.voidElement?e:e+t.children.reduce(Mc,``)+`</`+t.name+`>`}case`comment`:return e+=`<!--`+t.comment+`-->`,e}}function Nc(e){return e.reduce(function(e,t){return e+Mc(``,t)},``)}var Pc={parse:Ac,stringify:Nc},Fc=(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);Rc(i[0])&&(i[0]=`react-i18next:: ${i[0]}`),e?.services?.logger?.warn?e.services.logger.warn(...i):console?.warn&&console.warn(...i)},Ic={},Lc=(e,t,n,r)=>{Rc(n)&&Ic[n]||(Rc(n)&&(Ic[n]=new Date),Fc(e,t,n,r))},Rc=e=>typeof e==`string`,zc=e=>typeof e==`object`&&!!e,Bc=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,Vc={"&":`&`,"&":`&`,"<":`<`,"<":`<`,">":`>`,">":`>`,"'":`'`,"'":`'`,""":`"`,""":`"`," ":` `," ":` `,"©":`©`,"©":`©`,"®":`®`,"®":`®`,"…":`…`,"…":`…`,"/":`/`,"/":`/`},Hc=e=>Vc[e],Uc=e=>e.replace(Bc,Hc),Wc={bindI18n:`languageChanged`,bindI18nStore:``,transEmptyNodeValue:``,transSupportBasicHtmlNodes:!0,transWrapTextNodes:``,transKeepBasicHtmlNodesFor:[`br`,`strong`,`i`,`p`],useSuspense:!0,unescape:Uc,transDefaultProps:void 0},Gc=(e={})=>{Wc={...Wc,...e}},Kc=()=>Wc,qc,Jc=e=>{qc=e},Yc=()=>qc,Xc=(e,t)=>{if(!e)return!1;let n=e.props?.children??e.children;return t?n.length>0:!!n},Zc=e=>{if(!e)return[];let t=e.props?.children??e.children;return e.props?.i18nIsDynamicList?$c(t):t},Qc=t=>Array.isArray(t)&&t.every(e.isValidElement),$c=e=>Array.isArray(e)?e:[e],el=(e,t)=>{let n={...t};return n.props={...t.props,...e.props},n},tl=t=>{let n={};if(!t)return n;let r=t=>{$c(t).forEach(t=>{Rc(t)||(Xc(t)?r(Zc(t)):zc(t)&&!(0,e.isValidElement)(t)&&Object.assign(n,t))})};return r(t),n},nl=(t,n,r,i)=>{if(!t)return``;let a=``,o=$c(t),s=n?.transSupportBasicHtmlNodes?n.transKeepBasicHtmlNodesFor??[]:[];return o.forEach((t,o)=>{if(Rc(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=Rc(d)?d:nl(d,n,r,i);a+=`<${c}>${e}</${c}>`;return}let f=nl(d,n,r,i);a+=`<${o}>${f}</${o}>`;return}if(t===null){Fc(r,`TRANS_NULL_VALUE`,`Passed in a null value as child`,{i18nKey:i});return}if(zc(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}Fc(r,`TRANS_INVALID_OBJ`,`Invalid child - Object should only have keys {{ value, format }} (format is optional).`,{i18nKey:i,child:t});return}Fc(r,`TRANS_INVALID_VAR`,`Passed in a variable like {number} - pass variables for interpolation as full objects like {{number}}.`,{i18nKey:i,child:t})}),a},rl=(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=>{$c(t).forEach(t=>{Rc(t)||(Xc(t)?d(Zc(t)):zc(t)&&!(0,e.isValidElement)(t)&&Object.assign(u,t))})};d(t);let f=Object.keys(u),p=Pc.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=Zc(e),i=_(r,t.children,n);return Qc(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=$c(t),d=$c(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];Rc(t)&&(y[e]=Uc(t))});let b=Object.keys(y).length===0?v:el({props:y},v),x=(0,e.isValidElement)(b),S=x&&Xc(r,!0)&&!r.voidElement,C=l&&zc(b)&&b.dummy&&!x,w=zc(n)&&Object.hasOwnProperty.call(n,r.name);if(Rc(b)){let e=i.services.interpolator.interpolate(b,m,i.language);t.push(e)}else if(Xc(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?$c(Zc(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(zc(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:Kc().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 Zc(_([{dummy:!0,children:t||[]}],p,$c(t||[]))[0])},il=(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})},al=(e,t)=>e.map((e,n)=>il(e,n,t)),ol=(e,t)=>{let n={};return Object.keys(e).forEach(r=>{Object.assign(n,{[r]:il(e[r],r,t)})}),n},sl=(e,t,n,r)=>e?Array.isArray(e)?al(e,t):zc(e)?ol(e,t):(Lc(n,`TRANS_INVALID_COMPONENTS`,`<Trans /> "components" prop expects an object or array`,{i18nKey:r}),null):null,cl=e=>!zc(e)||Array.isArray(e)?!1:Object.keys(e).reduce((e,t)=>e&&Number.isNaN(Number.parseFloat(t)),!0);function ll({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||Yc();if(!h)return Lc(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),_={...Kc(),...h.options?.react},v=u||g.ns||h.options?.defaultNS;v=Rc(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=nl(t,_,h,i),T=c||b?.defaultValue||w||_.transEmptyNodeValue||(typeof i==`function`?cs(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=tl(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=sl(C,j,h,i),N=M||t,ee=null;cl(M)&&(ee=M,N=t);let te=rl(N,ee,j,h,_,A,x),P=r??_.defaultTransParent;return P?(0,e.createElement)(P,m,te):te}var ul={type:`3rdParty`,init(e){Gc(e.options.react),Jc(e)}},dl=(0,e.createContext)();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{i18n:h,defaultNS:g}=(0,e.useContext)(dl)||{},_=d||h||Yc(),v=f||_?.t.bind(_);return ll({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 pl={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 ml(){let e=document.documentElement.getAttribute(`lang`)||`en`;return(pl[e.toLowerCase()]||pl[e.split(`-`)[0]]||pl.en)?.locale||`en_US`}function hl(){return window.wcpos?.translationVersion||`0.1.0`}function gl({namespace:t,project:n,resources:r}){let i=Q.createInstance(),a=ml(),o=hl(),s={lng:a,fallbackLng:`en`,ns:[t],defaultNS:t,keySeparator:!1,nsSeparator:!1,interpolation:{escapeValue:!1,prefix:`{`,suffix:`}`},backend:{backends:[yc,pc],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(Hs).use(ul).init(s).then(()=>i),t:i.t.bind(i),Trans:n=>(0,e.createElement)(fl,{...n,i18n:i,ns:t})}}var{i18n:_l,i18nPromise:vl,t:$,Trans:yl}=gl({namespace:`wp-admin-settings`,project:`woocommerce-pos`,resources:{en:{"wp-admin-settings":{"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: _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":`Allow anonymous usage data`,"settings.allow_anonymous_usage_data_tip":`Help us make WCPOS better by sharing some anonymous information about your setup and how you use the plugin.`,"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.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>.`,"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.add_rule":`+ Add rule`}}}});function bl(e){return(0,L.jsx)(qa,{dismissLabel:$(`common.dismiss`),...e})}function xl({error:e,resetErrorBoundary:t}){let n=(0,r.get)(e,`message`,`Unknown error`);return(0,L.jsx)(`div`,{className:`wcpos:p-4`,children:(0,L.jsx)(bl,{status:`error`,onRemove:t,children:(0,L.jsxs)(`p`,{children:[$(`common.something_went_wrong`),`: `,(0,L.jsx)(`code`,{children:n})]})})})}var Sl=e.createContext({notice:null,setNotice:()=>{}});function Cl({children:t}){let[n,r]=e.useState(null);return(0,L.jsx)(Sl.Provider,{value:{notice:n,setNotice:r},children:t})}var wl=()=>e.useContext(Sl),Tl=new Ve({defaultOptions:{queries:{staleTime:6e5}}});typeof window<`u`&&(window.wcpos=window.wcpos||{},window.wcpos.queryClient=Tl);var El=e=>(0,L.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 448 512`,...e,children:(0,L.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`})}),Dl=e=>(0,L.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 512 512`,...e,children:(0,L.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`})}),Ol=e=>(0,L.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 512 512`,...e,children:(0,L.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 kl(){return(0,L.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,L.jsx)(`span`,{className:`wcpos:font-semibold wcpos:text-gray-500`,children:$(`settings.need_help`)}),(0,L.jsxs)(`div`,{className:`wcpos:flex wcpos:flex-col wcpos:md:flex-row wcpos:gap-1 wcpos:lg:gap-4`,children:[(0,L.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,L.jsx)(`span`,{className:`wcpos:h-3.5 wcpos:w-3.5`,children:(0,L.jsx)(El,{fill:`#6b7280`})}),$(`common.documentation`),(0,L.jsx)(`span`,{className:`wcpos:sr-only`,children:` (opens in new tab)`})]}),(0,L.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,L.jsx)(`span`,{className:`wcpos:h-3.5 wcpos:w-3.5`,children:(0,L.jsx)(Dl,{fill:`#6b7280`})}),$(`common.faq`),(0,L.jsx)(`span`,{className:`wcpos:sr-only`,children:` (opens in new tab)`})]})]}),(0,L.jsxs)(`div`,{className:`wcpos:flex wcpos:flex-col wcpos:md:flex-row wcpos:gap-1 wcpos:lg:gap-4`,children:[(0,L.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,L.jsx)(`span`,{className:`wcpos:h-3.5 wcpos:w-3.5`,children:(0,L.jsx)(Ol,{fill:`#6b7280`})}),`support@wcpos.com`]}),(0,L.jsx)(`a`,{href:`https://wcpos.com/discord`,target:`_blank`,rel:`noreferrer`,className:`wcpos:no-underline`,children:(0,L.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 Al({heading:e,children:t}){return(0,L.jsxs)(`div`,{className:`wcpos:mb-4`,children:[(0,L.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,L.jsx)(`nav`,{children:t})]})}function jl({to:e,label:t,badge:n,onClick:r}){let i=la()({to:e});return(0,L.jsxs)(Ui,{to:e,onClick:r,"data-testid":`settings-nav-${e.replace(/^\//,``)}`,className:(0,U.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,L.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,L.jsxs)(`span`,{className:`wcpos:inline-flex wcpos:items-center wcpos:gap-1`,children:[e>0&&(0,L.jsx)(J,{variant:`critical`,shape:`round`,size:`xs`,children:e}),t>0&&(0,L.jsx)(J,{variant:`warning`,shape:`round`,size:`xs`,children:t})]})})()]})}var Ml=e=>(0,L.jsxs)(`svg`,{fill:`#000`,xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 1260 1260`,...e,children:[(0,L.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,L.jsxs)(`g`,{children:[(0,L.jsxs)(`g`,{fill:`#CD2C24`,children:[(0,L.jsx)(`path`,{d:`M0,90 q0,-90 90,-90 l90,0 l0,270 a90,90 0 1,1 -180,0 Z`}),(0,L.jsx)(`path`,{d:`M360,0 l180,0 l0,270 a90,90 0 1,1 -180,0 Z`}),(0,L.jsx)(`path`,{d:`M720,0 l180,0 l0,270 a90,90 0 1,1 -180,0 Z`}),(0,L.jsx)(`path`,{d:`M1080,0 l90,0 q90,0 90,90 l0,180 a90,90 0 1,1 -180,0 Z`})]}),(0,L.jsxs)(`g`,{fill:`#F5E5C0`,children:[(0,L.jsx)(`path`,{d:`M180,0 l180,0 l0,270 a90,90 0 1,1 -180,0 Z`}),(0,L.jsx)(`path`,{d:`M540,0 l180,0 l0,270 a90,90 0 1,1 -180,0 Z`}),(0,L.jsx)(`path`,{d:`M900,0 l180,0 l0,270 a90,90 0 1,1 -180,0 Z`})]})]}),(0,L.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,L.jsx)(`path`,{d:` M30,480 l0,-450 m0,150 a150,150 0 1,0 300,0 a150,150 0 1,0 -300,0 `}),(0,L.jsx)(`path`,{d:` M600,30 m-150,150 a150,150 0 1,0 300,0 a150,150 0 1,0 -300,0 `}),(0,L.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 `})]})]}),Nl=window?.wcpos?.settings?.updateExtensionsCount??null,Pl=new Set;function Fl(){for(let e of Pl)e()}function Il(e){return Pl.add(e),()=>Pl.delete(e)}function Ll(){return Nl}function Rl(){return(0,e.useSyncExternalStore)(Il,Ll)}function zl(e){Nl=e,Fl()}var Bl=window?.wcpos?.settings?.unreadLogCounts??{error:0,warning:0},Vl=new Set;function Hl(){for(let e of Vl)e()}function Ul(e){return Vl.add(e),()=>Vl.delete(e)}function Wl(){return Bl}function Gl(){return(0,e.useSyncExternalStore)(Ul,Wl)}async function Kl(){let e={...Bl};Bl={error:0,warning:0},Hl();try{await(0,i.default)({path:`wcpos/v1/logs/mark-read?wcpos=1`,method:`POST`})}catch{Bl=e,Hl()}}var ql=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},Jl=(e=>e?ql(e):ql),Yl=e=>e;function Xl(e,t=Yl){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 Zl=Jl((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:Zl.getState().registerPage,registerField:Zl.getState().registerField,modifyField:Zl.getState().modifyField,registerComponent:Zl.getState().registerComponent,getComponent:Zl.getState().getComponent});function Ql(t){let n=Xl(Zl,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 $l({isOpen:e,onNavItemClick:t}){let n=Ql(`tools`),r=Ql(`account`),i=Rl(),a=Gl();return(0,L.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,L.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,L.jsx)(`div`,{className:`wcpos:w-8`,children:(0,L.jsx)(Ml,{})}),(0,L.jsx)(`span`,{className:`wcpos:text-lg wcpos:font-semibold wcpos:text-gray-900`,children:`WCPOS`})]}),(0,L.jsxs)(`div`,{className:`wcpos:flex-1 wcpos:overflow-y-auto wcpos:py-2`,children:[(0,L.jsxs)(Al,{heading:$(`common.settings`),children:[(0,L.jsx)(jl,{to:`/general`,label:$(`common.general`),onClick:t}),(0,L.jsx)(jl,{to:`/checkout`,label:$(`common.checkout`),onClick:t}),(0,L.jsx)(jl,{to:`/cloud-print`,label:$(`common.cloud_print`,`Cloud Print`),onClick:t}),(0,L.jsx)(jl,{to:`/access`,label:$(`common.access`),onClick:t}),(0,L.jsx)(jl,{to:`/sessions`,label:$(`sessions.sessions`),onClick:t}),(0,L.jsx)(jl,{to:`/extensions`,label:$(`common.extensions`,`Extensions`),badge:i??void 0,onClick:t})]}),(0,L.jsxs)(Al,{heading:$(`common.tools`,`Tools`),children:[(0,L.jsx)(jl,{to:`/logs`,label:$(`common.logs`,`Logs`),badge:a,onClick:t}),n.map(e=>(0,L.jsx)(jl,{to:`/${e.id}`,label:e.label,onClick:t},e.id))]}),(0,L.jsxs)(Al,{heading:$(`common.account`,`Account`),children:[(0,L.jsx)(jl,{to:`/license`,label:$(`common.license`),onClick:t}),r.map(e=>(0,L.jsx)(jl,{to:`/${e.id}`,label:e.label,onClick:t},e.id))]})]})]})}function eu({rows:e=5}){return(0,L.jsx)(`div`,{className:`wcpos:pb-4 wcpos:mb-4`,role:`status`,"aria-label":$(`common.loading`),children:(0,L.jsx)(`div`,{className:`wcpos:space-y-0`,children:Array.from({length:e}).map((e,t)=>(0,L.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,L.jsx)(`div`,{className:`wcpos:sm:w-[30%] wcpos:sm:max-w-[200px] wcpos:shrink-0`,children:(0,L.jsx)(K,{className:`wcpos:h-4`,width:`${60+t*17%40}%`})}),(0,L.jsx)(`div`,{className:`wcpos:flex-1 wcpos:min-w-0`,children:(0,L.jsx)(K,{className:`wcpos:h-5`,width:t%2==0?`200px`:`${40+t*23%30}%`})})]},t))})})}function tu({cards:e=4}){return(0,L.jsxs)(`div`,{role:`status`,"aria-label":$(`common.loading`),children:[(0,L.jsx)(`div`,{className:`wcpos:mb-4`,children:(0,L.jsx)(K,{className:`wcpos:h-9 wcpos:w-full wcpos:rounded-md`})}),(0,L.jsx)(`div`,{className:`wcpos:flex wcpos:gap-2 wcpos:mb-6`,children:Array.from({length:3}).map((e,t)=>(0,L.jsx)(K,{className:`wcpos:h-7 wcpos:rounded-full`,width:`${60+t*20}px`},t))}),(0,L.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,L.jsxs)(`div`,{className:`wcpos:border wcpos:border-gray-200 wcpos:rounded-lg wcpos:p-4 wcpos:space-y-3`,children:[(0,L.jsxs)(`div`,{className:`wcpos:flex wcpos:items-center wcpos:gap-3`,children:[(0,L.jsx)(K,{className:`wcpos:h-10 wcpos:w-10 wcpos:rounded-lg wcpos:shrink-0`}),(0,L.jsxs)(`div`,{className:`wcpos:flex-1 wcpos:space-y-2`,children:[(0,L.jsx)(K,{className:`wcpos:h-4`,width:`60%`}),(0,L.jsx)(K,{className:`wcpos:h-3`,width:`40%`})]})]}),(0,L.jsx)(K,{className:`wcpos:h-3`,width:`90%`}),(0,L.jsx)(K,{className:`wcpos:h-3`,width:`70%`})]},t))})]})}function nu({rows:e=8}){return(0,L.jsxs)(`div`,{role:`status`,"aria-label":$(`common.loading`),children:[(0,L.jsx)(`div`,{className:`wcpos:flex wcpos:gap-2 wcpos:mb-4`,children:Array.from({length:3}).map((e,t)=>(0,L.jsx)(K,{className:`wcpos:h-7 wcpos:rounded-full`,width:`${50+t*15}px`},t))}),(0,L.jsx)(`div`,{className:`wcpos:space-y-1`,children:Array.from({length:e}).map((e,t)=>(0,L.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,L.jsx)(K,{className:`wcpos:h-5 wcpos:rounded wcpos:shrink-0`,width:`55px`}),(0,L.jsx)(K,{className:`wcpos:h-3 wcpos:shrink-0`,width:`130px`}),(0,L.jsx)(K,{className:`wcpos:h-3 wcpos:flex-1`,width:`${50+t*19%40}%`})]},t))})]})}function ru(){return(0,L.jsxs)(`div`,{role:`status`,"aria-label":$(`common.loading`),children:[(0,L.jsx)(`div`,{className:`wcpos:p-4`,children:(0,L.jsx)(K,{className:`wcpos:h-10 wcpos:w-full wcpos:rounded-md`})}),(0,L.jsxs)(`div`,{className:`wcpos:sm:grid wcpos:sm:grid-cols-3 wcpos:sm:gap-4 wcpos:p-4 wcpos:pt-0`,children:[(0,L.jsx)(`div`,{children:(0,L.jsx)(`div`,{className:`wcpos:space-y-1`,children:Array.from({length:5}).map((e,t)=>(0,L.jsx)(K,{className:`wcpos:h-9 wcpos:rounded`},t))})}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(K,{className:`wcpos:h-5 wcpos:mb-3`,width:`80px`}),(0,L.jsx)(`div`,{className:`wcpos:space-y-2`,children:Array.from({length:6}).map((e,t)=>(0,L.jsxs)(`div`,{className:`wcpos:flex wcpos:items-center wcpos:gap-2`,children:[(0,L.jsx)(K,{className:`wcpos:h-4 wcpos:w-4 wcpos:rounded wcpos:shrink-0`}),(0,L.jsx)(K,{className:`wcpos:h-3`,width:`${60+t*17%30}%`})]},t))})]})]})]})}function iu(){return(0,L.jsxs)(`div`,{className:`wcpos:p-4`,role:`status`,"aria-label":$(`common.loading`),children:[(0,L.jsx)(K,{className:`wcpos:h-10 wcpos:w-full wcpos:rounded-md wcpos:mb-3`}),(0,L.jsxs)(`div`,{className:`wcpos:grid wcpos:grid-cols-[minmax(0,18rem)_1fr] wcpos:gap-4`,children:[(0,L.jsxs)(`div`,{className:`wcpos:space-y-2 wcpos:border-r wcpos:border-gray-200 wcpos:pr-4`,children:[(0,L.jsx)(K,{className:`wcpos:h-8 wcpos:w-full wcpos:rounded-md`}),Array.from({length:4}).map((e,t)=>(0,L.jsxs)(`div`,{className:`wcpos:flex wcpos:items-center wcpos:gap-3 wcpos:px-3 wcpos:py-2`,children:[(0,L.jsx)(K,{className:`wcpos:h-10 wcpos:w-10 wcpos:shrink-0 wcpos:rounded-full`}),(0,L.jsxs)(`div`,{className:`wcpos:flex-1 wcpos:space-y-1`,children:[(0,L.jsx)(K,{className:`wcpos:h-4`,width:`60%`}),(0,L.jsx)(K,{className:`wcpos:h-3`,width:`40%`})]}),(0,L.jsx)(K,{className:`wcpos:h-5 wcpos:w-6 wcpos:rounded-full`})]},t))]}),(0,L.jsxs)(`div`,{className:`wcpos:space-y-3`,children:[(0,L.jsxs)(`div`,{className:`wcpos:flex wcpos:items-center wcpos:gap-3 wcpos:border-b wcpos:border-gray-200 wcpos:pb-3`,children:[(0,L.jsx)(K,{className:`wcpos:h-12 wcpos:w-12 wcpos:shrink-0 wcpos:rounded-full`}),(0,L.jsxs)(`div`,{className:`wcpos:flex-1 wcpos:space-y-1`,children:[(0,L.jsx)(K,{className:`wcpos:h-5`,width:`40%`}),(0,L.jsx)(K,{className:`wcpos:h-3`,width:`30%`})]}),(0,L.jsx)(K,{className:`wcpos:h-8 wcpos:rounded`,width:`120px`})]}),Array.from({length:3}).map((e,t)=>(0,L.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,L.jsx)(K,{className:`wcpos:h-10 wcpos:w-10 wcpos:shrink-0 wcpos:rounded-md`}),(0,L.jsxs)(`div`,{className:`wcpos:flex-1 wcpos:space-y-1`,children:[(0,L.jsx)(K,{className:`wcpos:h-4`,width:`50%`}),(0,L.jsx)(K,{className:`wcpos:h-3`,width:`70%`}),(0,L.jsx)(K,{className:`wcpos:h-8 wcpos:rounded wcpos:mt-2`,width:`100%`})]}),(0,L.jsx)(K,{className:`wcpos:h-7 wcpos:rounded`,width:`80px`})]},t))]})]})]})}function au(){return(0,L.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,L.jsx)(`div`,{className:`wcpos:flex wcpos:sm:justify-end`,children:(0,L.jsx)(K,{className:`wcpos:h-4`,width:`90px`})}),(0,L.jsx)(`div`,{children:(0,L.jsx)(K,{className:`wcpos:h-9 wcpos:w-full wcpos:rounded-md`})}),(0,L.jsx)(`div`,{children:(0,L.jsx)(K,{className:`wcpos:h-9 wcpos:rounded`,width:`90px`})})]})}var ou={"/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`},su={"/general":(0,L.jsx)(eu,{rows:5}),"/checkout":(0,L.jsx)(eu,{rows:4}),"/cloud-print":(0,L.jsx)(eu,{rows:4}),"/access":(0,L.jsx)(ru,{}),"/sessions":(0,L.jsx)(iu,{}),"/extensions":(0,L.jsx)(tu,{cards:4}),"/logs":(0,L.jsx)(nu,{rows:8}),"/license":(0,L.jsx)(au,{})};function cu(){let{notice:t,setNotice:n}=wl(),[r,i]=e.useState(!1),a=ha(),o=$(ou[a.pathname]||`common.settings`);return(0,L.jsxs)(`div`,{className:`wcpos:flex-1 wcpos:flex wcpos:bg-white`,children:[(0,L.jsx)($l,{isOpen:r,onNavItemClick:()=>i(!1)}),(0,L.jsxs)(`div`,{className:`wcpos:flex-1 wcpos:flex wcpos:flex-col wcpos:min-w-0`,children:[(0,L.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,L.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,L.jsx)(`svg`,{className:`wcpos:h-5 wcpos:w-5`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,children:(0,L.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M4 6h16M4 12h16M4 18h16`})})}),(0,L.jsx)(`h1`,{className:`wcpos:text-lg wcpos:font-semibold wcpos:text-gray-900 wcpos:m-0`,children:o})]}),(0,L.jsxs)(`main`,{className:`wcpos:flex-1 wcpos:px-6 wcpos:py-6`,children:[t&&(0,L.jsx)(`div`,{className:`wcpos:mb-4`,children:(0,L.jsx)(bl,{status:t.type,onRemove:()=>n(null),children:t.message})}),(0,L.jsx)(va,{FallbackComponent:xl,children:(0,L.jsx)(e.Suspense,{fallback:su[a.pathname]||(0,L.jsx)(eu,{}),children:(0,L.jsx)(aa,{})})})]}),(0,L.jsx)(kl,{})]})]})}function lu(e){return(0,L.jsx)(Ia,{loadingLabel:$(`common.loading`),noResultsLabel:$(`common.no_results`),...e})}var uu=e=>{let t=We(),{addSnackbar:n}=mo(),{setNotice:a}=wl(),o=`wcpos/v1/settings/${e}?wcpos=1`,{data:s}=st({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:ct({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}};function du(){let{data:t,mutate:n}=uu(`access`),[i,a]=e.useState(`administrator`),o=(0,r.get)(t,[i,`capabilities`],null);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`div`,{className:`wcpos:p-4`,children:(0,L.jsxs)(bl,{status:`info`,isDismissible:!1,children:[(0,L.jsx)(yl,{i18nKey:`access.default_roles_warning`,components:{strong:(0,L.jsx)(`strong`,{})}}),`\xA0`,(0,L.jsx)(yl,{i18nKey:`access.visit_documentation`,components:{link:(0,L.jsx)(`a`,{href:`https://docs.wcpos.com/pos-access`,target:`_blank`,rel:`noreferrer`})}})]})}),(0,L.jsxs)(`div`,{className:`wcpos:sm:grid wcpos:sm:grid-cols-3 wcpos:sm:gap-4 wcpos:p-4 wcpos:pt-0`,children:[(0,L.jsx)(`div`,{className:``,children:(0,L.jsx)(`ul`,{children:(0,r.map)(t,(e,t)=>(0,L.jsx)(`li`,{"data-testid":`access-role-${t}`,className:(0,U.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))})}),(0,L.jsx)(`div`,{className:``,children:o&&(0,r.map)(o,(e,t)=>(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`h2`,{className:`wcpos:text-base`,"data-testid":`access-capability-group-${t}`,children:{wcpos:`WCPOS`,wc:`WooCommerce`,wp:`WordPress`}[t]}),(0,L.jsx)(`div`,{children:(0,r.map)(e,(e,r)=>(0,L.jsx)(Ca,{label:r,checked:e,disabled:i===`administrator`&&r===`read`,onChange:e=>{n({[i]:{capabilities:{[t]:{[r]:e.target.checked}}}})}},r))})]},t))})]})]})}function fu(e){if(Array.isArray(e))return e}function pu(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 mu(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 hu(e,t){if(e){if(typeof e==`string`)return mu(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)?mu(e,t):void 0}}function gu(){throw TypeError(`Invalid attempt to destructure 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 wd(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 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 Ed(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 Dd(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Ed(Object(n),!0).forEach(function(t){mc(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ed(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Od(){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=Dd({},r);e.add(i),n(i);function a(){e.delete(i),t&&t.active.delete(i)}return Eu(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=Cd(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 kd(e){var t=e.typeKey,n=e.mount,r=e.dispatchEventToSource,i=e.onPostDispatch,a=e.defaultDropEffect,o=Od(),s=Sd({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;ud.start({event:t,dragType:n,getDropTargetsOver:s.getIsOver,dispatchEvent:c})}function u(){function e(){return n({canStart:ud.canStart,start:l})}return pd({typeKey:t,mount:e})}return{registerUsage:u,dropTarget:s.dropTargetForConsumers,monitor:o.monitorForConsumers}}var Ad=Eu(function(){return navigator.userAgent.toLocaleLowerCase().includes(`android`)}),jd=`pdnd:android-fallback`,Md=`text/plain`,Nd=`application/vnd.pdnd`,Pd=new WeakMap;function Fd(e){return Pd.set(e.element,e),function(){Pd.delete(e.element)}}var Id=Bu(),Ld=kd({typeKey:`element`,defaultDropEffect:`move`,mount:function(e){return md(Id.bindEvents(),(0,bu.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=Pd.get(n);if(r){var i=$u(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=Cu({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=_u(l[c],2),d=u[0],f=u[1];t.dataTransfer.setData(d,f??``)}Ad()&&!t.dataTransfer.types.includes(`text/plain`)&&!t.dataTransfer.types.includes(`text/uri-list`)&&t.dataTransfer.setData(Md,jd),t.dataTransfer.setData(Nd,``);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=Pd.get(i.source.element))==null||(n=t[r])==null||n.call(t,i)},onPostDispatch:Id.getOnPostDispatch()}),Rd=Ld.dropTarget,zd=Ld.monitor;function Bd(e){return Eu(md(Ld.registerUsage(),Fd(e),hd(e.element,{attribute:`draggable`,value:`true`})))}function Vd(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 Hd(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Vd(Object(n),!0).forEach(function(t){mc(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Vd(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Ud={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)}},Wd=Symbol(`closestEdge`);function Gd(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:Ud[e](o,a)}}).sort(function(e,t){return e.value-t.value})[0]?.edge??null;return Hd(Hd({},e),{},mc({},Wd,s))}function Kd(e){return e[Wd]??null}function qd(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=_u(i.splice(n,1),1)[0];return i.splice(r,0,a),i}function Jd(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 Yd(e){var t=e.list,n=e.startIndex,r=e.closestEdgeOfTarget,i=e.indexOfTarget,a=e.axis;return qd({list:t,startIndex:n,finishIndex:Jd({closestEdgeOfTarget:r,startIndex:n,indexOfTarget:i,axis:a})})}function Xd({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,L.jsxs)(La,{open:!0,onClose:()=>r(),title:t.title,className:`wcpos:max-w-md`,children:[(0,L.jsx)(bl,{status:`info`,isDismissible:!1,children:(0,L.jsx)(yl,{i18nKey:`checkout.gateway_settings_pos_only`,components:{link:(0,L.jsx)(`a`,{href:`admin.php?page=wc-settings&tab=checkout`,target:`_blank`,rel:`noreferrer`})}})}),(0,L.jsxs)(`div`,{className:`wcpos:py-2`,children:[(0,L.jsx)(`label`,{htmlFor:`title`,className:`wcpos:block wcpos:mb-1 wcpos:font-medium wcpos:text-sm`,children:$(`common.title`)}),(0,L.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,L.jsxs)(`div`,{className:`wcpos:py-2`,children:[(0,L.jsx)(`label`,{htmlFor:`description`,className:`wcpos:block wcpos:mb-1 wcpos:font-medium wcpos:text-sm`,children:$(`common.description`)}),(0,L.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,L.jsxs)(`div`,{className:`wcpos:text-right wcpos:pt-4 wcpos:flex wcpos:justify-end wcpos:gap-2`,children:[(0,L.jsx)(W,{onClick:r,children:$(`common.cancel`)}),(0,L.jsx)(W,{variant:`primary`,onClick:l,children:$(`common.save`)})]})]})}function Zd({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,L.jsx)(Ta,{options:a||[],value:t,onChange:({value:e})=>{n(String(e))},disabled:r})}var Qd=e=>(0,L.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,...e,children:(0,L.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`})}),$d=e=>(0,L.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,...e,children:(0,L.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 ef(){return window?.wcpos?.posthog}function tf(e,t={}){ef()?.capture?.(e,t)}function nf(e){tf(`upgrade_cta_viewed`,{placement:e})}function rf(e,t){tf(`pro_link_clicked`,{placement:e,destination:t})}function af(){tf(`license_activate_attempted`)}function of(e){tf(`license_activate_succeeded`,e?{license_tier:e}:{})}function sf(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 cf(e){tf(`license_activate_failed`,{reason:sf(e)})}function lf({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=Bd({element:e,dragHandle:r,getInitialData:()=>({id:t.id,index:n}),onDragStart:()=>u(!0),onDrop:()=>u(!1)}),a=Rd({element:e,getData:({input:e,element:r})=>Gd({id:t.id,index:n},{element:r,input:e,allowedEdges:[`top`,`bottom`]}),onDragEnter:({self:e})=>f(Kd(e.data)),onDrag:({self:e})=>f(Kd(e.data)),onDragLeave:()=>f(null),onDrop:()=>f(null)});return()=>{i(),a()}},[t.id,n]),(0,L.jsxs)(yo,{ref:s,className:(0,U.default)(`wcpos:relative`,l&&`wcpos:opacity-50`,n%2!=0&&`wcpos:bg-gray-50`),children:[d&&(0,L.jsx)(X,{colSpan:7,className:(0,U.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,L.jsx)(X,{ref:c,className:`wcpos:pl-3 wcpos:pr-1 wcpos:whitespace-nowrap wcpos:cursor-grab wcpos:w-8`,children:(0,L.jsx)(Qd,{className:`wcpos:w-5 wcpos:h-5 wcpos:text-gray-400 wcpos:fill-current`})}),(0,L.jsx)(X,{className:`wcpos:whitespace-nowrap wcpos:text-center`,children:(0,L.jsx)(`input`,{type:`radio`,value:t.id,checked:r?.default_gateway===t.id,disabled:!t.enabled,className:``,onChange:()=>{i({default_gateway:t.id})}})}),(0,L.jsx)(X,{className:`wcpos:text-ellipsis wcpos:overflow-hidden wcpos:whitespace-nowrap`,children:(0,L.jsx)(`strong`,{children:t.title})}),(0,L.jsx)(X,{className:`wcpos:whitespace-nowrap`,children:t.id}),(0,L.jsx)(X,{className:`wcpos:whitespace-nowrap wcpos:text-center`,children:(0,L.jsx)(Sa,{"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,L.jsx)(X,{className:`wcpos:whitespace-nowrap`,children:(0,L.jsx)(Zd,{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,L.jsx)(X,{className:`wcpos:whitespace-nowrap wcpos:text-right`,children:(0,L.jsxs)(Ba,{label:t.title,trigger:(0,L.jsx)(`span`,{className:(0,U.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,L.jsx)($d,{className:`wcpos:w-4 wcpos:h-4 wcpos:fill-current`})}),children:[(0,L.jsx)(Va,{onSelect:()=>o(t),disabled:!a&&![`pos_cash`,`pos_card`].includes(t.id),children:$(`common.pos_settings`)}),![`pos_cash`,`pos_card`].includes(t.id)&&(0,L.jsx)(Va,{href:`admin.php?page=wc-settings&tab=checkout§ion=${t.id}`,children:$(`common.woocommerce_settings`)})]})})]})}function uf(){let{data:t,mutate:n}=uu(`payment-gateways`),[i,a]=e.useState(!1),o=e.useRef(null),s=t?.pro_enabled,c=(0,r.sortBy)(t?.gateways,[`order`,`id`]);e.useEffect(()=>zd({onDrop:({source:e,location:t})=>{let i=t.current.dropTargets[0];if(!i)return;let a=e.data.index,o=i.data.index,s=Kd(i.data),l=Yd({list:c,startIndex:a,indexOfTarget:o,closestEdgeOfTarget:s,axis:`vertical`}).map((e,t)=>({...e,order:t}));n({gateways:(0,r.keyBy)(l,`id`)})}}),[c,n]),e.useEffect(()=>{s||nf(`checkout_gateways`)},[s]);let l=e.useCallback(e=>{o.current=e,a(!0)},[]);return(0,L.jsxs)(L.Fragment,{children:[s?``:(0,L.jsx)(`div`,{className:`wcpos:pb-5`,children:(0,L.jsxs)(bl,{status:`info`,isDismissible:!1,children:[$(`checkout.enable_pro_gateways`),` `,(0,L.jsx)(`a`,{href:`https://wcpos.com/pro`,onClick:()=>rf(`checkout_gateways`,`https://wcpos.com/pro`),children:$(`common.upgrade_to_pro`)}),`.`]})}),(0,L.jsxs)(ho,{children:[(0,L.jsx)(go,{children:(0,L.jsxs)(vo,{children:[(0,L.jsx)(Y,{scope:`col`}),(0,L.jsx)(Y,{scope:`col`,className:`wcpos:text-center`,"data-testid":`gateways-th-default`,children:$(`common.default`)}),(0,L.jsx)(Y,{scope:`col`,"data-testid":`gateways-th-gateway`,children:$(`common.gateway`)}),(0,L.jsx)(Y,{scope:`col`,children:$(`checkout.gateway_id`)}),(0,L.jsx)(Y,{scope:`col`,className:`wcpos:text-center`,"data-testid":`gateways-th-enabled`,children:$(`common.enabled`)}),(0,L.jsx)(Y,{scope:`col`,children:$(`checkout.order_status`)}),(0,L.jsx)(Y,{scope:`col`})]})}),(0,L.jsx)(_o,{children:c.map((e,r)=>(0,L.jsx)(lf,{item:e,index:r,data:t,mutate:n,proEnabled:!!s,onEditGateway:l},e.id))})]}),i&&o.current&&(0,L.jsx)(Xd,{gateway:o.current,mutate:n,closeModal:()=>a(!1)})]})}function df({children:e,tip:t}){return(0,L.jsxs)(`div`,{className:`wcpos:flex wcpos:items-center wcpos:gap-2`,children:[e,t&&(0,L.jsx)(Ra,{text:t,children:(0,L.jsx)(`span`,{className:`wcpos:inline-flex wcpos:text-gray-300`,children:(0,L.jsx)(Dl,{className:`wcpos:h-4 wcpos:w-4`,fill:`currentColor`})})})]})}var ff=[{key:`new_order`,label:`checkout.email_new_order`},{key:`cancelled_order`,label:`checkout.email_cancelled_order`},{key:`failed_order`,label:`checkout.email_failed_order`}],pf=[{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`}],mf=[{key:`new_order`,label:`checkout.email_new_order`}];function hf({settingsKey:e,label:t,tip:n,emailTypes:r,data:i,mutate:a}){let o=i?.[e],s=o?.enabled??!1;return(0,L.jsxs)(q,{children:[(0,L.jsx)(df,{tip:n,children:(0,L.jsx)(Sa,{checked:s,onChange:t=>{a({[e]:{enabled:t}})},label:t})}),s&&(0,L.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,L.jsx)(Ca,{checked:o?.[t]??!0,onChange:n=>{a({[e]:{[t]:n.target.checked}})},label:$(n)},t))})]})}function gf(){let{data:t,mutate:n}=uu(`checkout`);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(Za,{children:[(0,L.jsx)(hf,{settingsKey:`admin_emails`,label:$(`checkout.admin_emails`),tip:$(`checkout.admin_emails_tip`),emailTypes:ff,data:t,mutate:n}),(0,L.jsx)(hf,{settingsKey:`customer_emails`,label:$(`checkout.customer_emails`),tip:$(`checkout.customer_emails_tip`),emailTypes:pf,data:t,mutate:n}),(0,L.jsx)(hf,{settingsKey:`cashier_emails`,label:$(`checkout.cashier_emails`),tip:$(`checkout.cashier_emails_tip`),emailTypes:mf,data:t,mutate:n})]}),(0,L.jsxs)(`div`,{className:`wcpos:px-4 wcpos:pb-5`,children:[(0,L.jsx)(`h2`,{className:`wcpos:text-base`,children:$(`checkout.gateways`)}),(0,L.jsx)(`p`,{children:$(`checkout.gateways_description`)}),(0,L.jsx)(va,{FallbackComponent:xl,children:(0,L.jsx)(e.Suspense,{fallback:(0,L.jsx)(nu,{rows:3}),children:(0,L.jsx)(uf,{})})})]})]})}var _f={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 vf(e,t){return _f[t].templateEngines===`all`?e:e.filter(e=>e.engine===_f[t].templateEngines)}var yf=[`printnode`,`star-online`,`star-cloudprnt`,`epson-sdp`];function bf(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 xf(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 Sf(){return window.wpApiSettings?.root||`${window.location.origin}/wp-json/`}function Cf(e,t,n,r){let i=_f[e].pollEndpoint,a=`${encodeURIComponent(t)}/${n}`;if(r)return`${r.replace(/\/$/,``)}/${a}/${i}`;let o=`${Sf()}wcpos/v1/print-jobs/${i}/${a}`;return`${o}${o.includes(`?`)?`&`:`?`}wcpos=1`}function wf(e,t,n,r){return Cf(e,t,encodeURIComponent(n),r)}function Tf(e,t,n){return Cf(e,t,`••••`,n)}function Ef({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,L.jsxs)(`div`,{className:`wcpos:flex wcpos:flex-col wcpos:gap-1`,children:[(0,L.jsxs)(`div`,{className:`wcpos:flex wcpos:items-baseline wcpos:gap-1`,children:[(0,L.jsx)(`span`,{className:`wcpos:text-sm wcpos:font-medium wcpos:text-gray-900`,children:t}),n&&(0,L.jsxs)(`span`,{className:`wcpos:text-xs wcpos:text-gray-500`,children:[`— `,n]})]}),(0,L.jsxs)(`div`,{className:`wcpos:flex wcpos:items-center wcpos:gap-2`,children:[(0,L.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,L.jsx)(W,{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 Df(){return(0,L.jsx)(`p`,{className:`wcpos:text-xs`,"data-testid":`wizard-relay-docs-note`,children:(0,L.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,L.jsx)(`span`,{className:`wcpos:h-3.5 wcpos:w-3.5`,children:(0,L.jsx)(El,{fill:`currentColor`})}),$(`cloud_print.relay_docs_note`,`For more information on why we're using a relay server.`),(0,L.jsx)(`span`,{className:`wcpos:sr-only`,children:` (opens in new tab)`})]})})}function Of({url:e,copyable:t}){return(0,L.jsxs)(`details`,{className:`wcpos:mt-1`,"data-testid":`wizard-direct-disclosure`,children:[(0,L.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,L.jsxs)(`div`,{className:`wcpos:mt-2 wcpos:flex wcpos:flex-col wcpos:gap-2`,children:[(0,L.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,L.jsx)(Ef,{label:$(`cloud_print.direct_url`,`Direct URL`),value:e,copyValue:t?e:void 0,valueTestId:`wizard-direct-url`,copyTestId:`wizard-copy-direct-url`})]})]})}function kf({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]=e.useState(``),[y,b]=e.useState(``),[x,S]=e.useState(!1),[C,w]=e.useState(null),[T,E]=e.useState(null),[D,O]=e.useState(null),[k,A]=e.useState(!1),[j,M]=e.useState(null),[N,ee]=e.useState(null),[te,P]=e.useState(!1),[ne,re]=e.useState(null),ie=e.useCallback(()=>{g(``),v(``),b(``),S(!1),w(null),E(null),O(null),A(!1),M(null),ee(null),P(!1),re(null)},[]),ae=e.useRef(d);e.useEffect(()=>{if(!t){ae.current=d;return}ae.current!==d&&(ie(),ae.current=d)},[t,d,ie]);let oe=async()=>{if(o){A(!0),M(null);try{let e=await o(h.trim());O(e),v(t=>e.some(e=>String(e.id)===t)?t:``),e.length===0&&M($(`cloud_print.printnode_no_printers`,`No printers found on this PrintNode account.`))}catch{O(null),M($(`cloud_print.printnode_fetch_failed`,`Couldn't list your PrintNode printers. Check the API key and that the desktop client is running.`))}finally{A(!1)}}},se=async()=>{if(s){P(!0),re(null);try{let e=await s(y.trim(),h.trim());ee(e),v(t=>e.some(e=>e.id===t)?t:``),e.length===0&&re($(`cloud_print.star_online_no_devices`,`No devices found in this Star Online group.`))}catch{ee(null),re($(`cloud_print.star_online_fetch_failed`,`Couldn't list your Star Online devices. Check the CloudPRNT URL and API key.`))}finally{P(!1)}}},F=e.useRef(!1);if(e.useEffect(()=>{t&&!F.current&&(n===`setup`&&r?(f(r.provider),u(2)):(f(null),u(0)),m(``),ie()),F.current=t},[t,n,ie,r]),!t)return null;let ce=d===`printnode`,le=d===`star-online`,ue=p.trim(),de=ue!==``&&(!ce||h.trim()!==``&&_.trim()!==``)&&(!le||h.trim()!==``&&y.trim()!==``&&_.trim()!==``),fe=async()=>{if(!d)return;let e={name:ue,provider:d};ce&&(e.printnode_api_key=h.trim(),e.printnode_printer_id=Number(_.trim())),le&&(e.star_api_key=h.trim(),e.star_cloudprnt_url=y.trim(),e.star_device_id=_.trim()),S(!0),w(null);try{let t=await a(e);E(t),u(2)}catch{w($(`cloud_print.create_failed`,`Couldn't create the printer. Please try again.`))}finally{S(!1)}},pe=l===2?$(`cloud_print.connect_title`,`Connect your printer`):$(`cloud_print.add_title`,`Add a cloud printer`),me=n===`setup`?r??null:T?.printer??null,I=n===`setup`&&r?r.provider:d,he=I?_f[I].isPolling:!1;return(0,L.jsx)(La,{open:t,onClose:()=>i(),title:pe,className:`wcpos:max-w-xl`,children:(0,L.jsxs)(`div`,{className:`wcpos:flex wcpos:flex-col wcpos:gap-4`,children:[C&&(0,L.jsx)(qa,{status:`error`,isDismissible:!1,children:(0,L.jsx)(`span`,{"data-testid":`wizard-error`,children:C})}),l===0&&(0,L.jsxs)(`div`,{className:`wcpos:flex wcpos:flex-col wcpos:gap-2`,children:[(0,L.jsx)(`p`,{className:`wcpos:text-sm wcpos:text-gray-700`,children:$(`cloud_print.step_provider_q`,`What kind of printer are you connecting?`)}),yf.map(e=>{let t=_f[e],n=d===e;return(0,L.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,L.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,L.jsxs)(`span`,{className:`wcpos:min-w-0`,children:[(0,L.jsx)(`span`,{className:`wcpos:block wcpos:text-sm wcpos:font-semibold wcpos:text-gray-900`,children:t.label}),(0,L.jsx)(`span`,{className:`wcpos:block wcpos:text-xs wcpos:text-gray-500`,children:bf(e)}),(0,L.jsx)(`span`,{className:`wcpos:mt-1 wcpos:block wcpos:text-xs wcpos:text-gray-600`,children:xf(e)})]})]},e)})]}),l===1&&(0,L.jsxs)(`div`,{className:`wcpos:flex wcpos:flex-col wcpos:gap-3`,children:[(0,L.jsxs)(`label`,{className:`wcpos:flex wcpos:flex-col wcpos:gap-1`,children:[(0,L.jsx)(`span`,{className:`wcpos:text-sm wcpos:font-medium wcpos:text-gray-900`,children:$(`cloud_print.printer_name`,`Printer name`)}),(0,L.jsx)(G,{"data-testid":`wizard-name-input`,value:p,placeholder:$(`cloud_print.printer_name_ph`,`e.g. Kitchen printer`),onChange:e=>m(e.target.value)}),(0,L.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.`)})]}),ce&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`label`,{className:`wcpos:flex wcpos:flex-col wcpos:gap-1`,children:[(0,L.jsx)(`span`,{className:`wcpos:text-sm wcpos:font-medium wcpos:text-gray-900`,children:$(`cloud_print.printnode_api_key`,`PrintNode API key`)}),(0,L.jsx)(G,{"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,L.jsxs)(`div`,{className:`wcpos:flex wcpos:flex-col wcpos:gap-1 wcpos:pt-1`,children:[(0,L.jsx)(W,{variant:`outline`,"data-testid":`wizard-printnode-fetch`,disabled:h.trim()===``||k,loading:k,onClick:oe,children:$(`cloud_print.printnode_fetch`,`Fetch my printers`)}),j&&(0,L.jsx)(`span`,{"data-testid":`wizard-printnode-fetch-error`,className:`wcpos:text-xs wcpos:text-red-600`,children:j})]})]}),D&&D.length>0&&(0,L.jsxs)(`label`,{className:`wcpos:flex wcpos:flex-col wcpos:gap-1`,children:[(0,L.jsx)(`span`,{className:`wcpos:text-sm wcpos:font-medium wcpos:text-gray-900`,children:$(`cloud_print.printnode_pick_printer`,`Choose a printer`)}),(0,L.jsxs)(`select`,{"data-testid":`wizard-printnode-printer-select`,value:_,onChange:e=>v(e.target.value),className:`wcpos:rounded wcpos:border wcpos:border-gray-300 wcpos:px-2 wcpos:py-1 wcpos:text-sm`,children:[(0,L.jsx)(`option`,{value:``,children:$(`cloud_print.printnode_pick_placeholder`,`Select a printer…`)}),D.map(e=>(0,L.jsxs)(`option`,{value:String(e.id),children:[e.name,` (`,e.state,`)`]},e.id))]})]}),(0,L.jsxs)(`label`,{className:`wcpos:flex wcpos:flex-col wcpos:gap-1`,children:[(0,L.jsx)(`span`,{className:`wcpos:text-sm wcpos:font-medium wcpos:text-gray-900`,children:$(`cloud_print.printnode_printer_id`,`PrintNode printer ID`)}),(0,L.jsx)(G,{"data-testid":`wizard-printnode-printer-id`,type:`number`,value:_,onChange:e=>v(e.target.value)})]}),(0,L.jsx)(qa,{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.`)})]}),le&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`label`,{className:`wcpos:flex wcpos:flex-col wcpos:gap-1`,children:[(0,L.jsx)(`span`,{className:`wcpos:text-sm wcpos:font-medium wcpos:text-gray-900`,children:$(`cloud_print.star_cloudprnt_url`,`CloudPRNT URL`)}),(0,L.jsx)(G,{"data-testid":`wizard-star-cloudprnt-url`,value:y,placeholder:`https://eu-device.stario.online/cloudprnt/your-group`,onChange:e=>b(e.target.value)})]}),(0,L.jsxs)(`label`,{className:`wcpos:flex wcpos:flex-col wcpos:gap-1`,children:[(0,L.jsx)(`span`,{className:`wcpos:text-sm wcpos:font-medium wcpos:text-gray-900`,children:$(`cloud_print.star_api_key`,`Star Online API key`)}),(0,L.jsx)(G,{"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,L.jsxs)(`div`,{className:`wcpos:flex wcpos:flex-col wcpos:gap-1 wcpos:pt-1`,children:[(0,L.jsx)(W,{variant:`outline`,"data-testid":`wizard-star-fetch`,disabled:h.trim()===``||y.trim()===``||te,loading:te,onClick:se,children:$(`cloud_print.star_fetch`,`Fetch my devices`)}),ne&&(0,L.jsx)(`span`,{"data-testid":`wizard-star-fetch-error`,className:`wcpos:text-xs wcpos:text-red-600`,children:ne})]})]}),N&&N.length>0&&(0,L.jsxs)(`label`,{className:`wcpos:flex wcpos:flex-col wcpos:gap-1`,children:[(0,L.jsx)(`span`,{className:`wcpos:text-sm wcpos:font-medium wcpos:text-gray-900`,children:$(`cloud_print.star_pick_device`,`Choose a device`)}),(0,L.jsxs)(`select`,{"data-testid":`wizard-star-device-select`,value:_,onChange:e=>v(e.target.value),className:`wcpos:rounded wcpos:border wcpos:border-gray-300 wcpos:px-2 wcpos:py-1 wcpos:text-sm`,children:[(0,L.jsx)(`option`,{value:``,children:$(`cloud_print.star_pick_placeholder`,`Select a device…`)}),N.map(e=>(0,L.jsxs)(`option`,{value:e.id,children:[e.name,` (`,e.state,`)`]},e.id))]})]}),(0,L.jsxs)(`label`,{className:`wcpos:flex wcpos:flex-col wcpos:gap-1`,children:[(0,L.jsx)(`span`,{className:`wcpos:text-sm wcpos:font-medium wcpos:text-gray-900`,children:$(`cloud_print.star_device_id`,`AccessIdentifier`)}),(0,L.jsx)(G,{"data-testid":`wizard-star-device-id`,value:_,onChange:e=>v(e.target.value)})]})]})]}),l===2&&I&&(0,L.jsx)(`div`,{className:`wcpos:flex wcpos:flex-col wcpos:gap-3`,children:he?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`div`,{children:(0,L.jsx)(J,{variant:`success`,icon:`✓`,children:$(`cloud_print.created`,`Printer created`)})}),n===`setup`?(0,L.jsx)(qa,{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,L.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=me;if(!e)return null;let t=c?.enabled&&c.printer_base_url?c.printer_base_url:void 0;if(n===`setup`)return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Ef,{label:$(`cloud_print.poll_url`,`Poll URL`),help:$(`cloud_print.poll_url_help`,`paste into the printer's "server URL"`),value:Tf(I,e.id,t),valueTestId:`wizard-poll-url`,copyTestId:`wizard-copy-url`}),t&&(0,L.jsx)(Df,{}),t&&(0,L.jsx)(Of,{url:Tf(I,e.id),copyable:!1})]});let r=T?.token??``;if(!r)return(0,L.jsx)(qa,{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=wf(I,e.id,r,t);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Ef,{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,L.jsx)(Df,{}),t&&(0,L.jsx)(Of,{url:wf(I,e.id,r),copyable:!0})]})})()]}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`div`,{children:(0,L.jsx)(J,{variant:`success`,icon:`✓`,children:$(`cloud_print.linked_provider`,`Linked to {provider}`,{provider:_f[I].label})})}),(0,L.jsx)(`p`,{className:`wcpos:text-sm wcpos:text-gray-700`,children:I===`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,L.jsxs)(`div`,{className:`wcpos:flex wcpos:justify-end wcpos:gap-2 wcpos:pt-2`,children:[l===1&&(0,L.jsx)(W,{variant:`secondary`,"data-testid":`wizard-back`,onClick:()=>u(0),children:$(`common.back`,`Back`)}),l===0&&(0,L.jsx)(W,{variant:`primary`,"data-testid":`wizard-continue`,disabled:!d,onClick:()=>u(1),children:$(`common.continue`,`Continue`)}),l===1&&(0,L.jsx)(W,{variant:`primary`,"data-testid":`wizard-continue`,disabled:!de,loading:x,onClick:fe,children:$(`common.continue`,`Continue`)}),l===2&&(0,L.jsx)(W,{variant:`primary`,"data-testid":`wizard-done`,onClick:()=>i(),children:$(`common.done`,`Done`)})]})]})})}function Af(e){return e.store_id&&e.store_id>0?`store:${e.store_id}`:e.scope}function jf(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 Mf(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 Nf=`edit.php?post_type=wcpos_template`;function Pf(e,t){return e.find(e=>String(e.value)===String(t))?.label.length??0}function Ff(e,t){return{width:`calc(${Math.max(Pf(e,t),1)}ch + 3.5rem)`}}function If({printers:e,assignments:t,templateOptions:n,storeOptions:r=[],onChange:i}){let a=e.map(e=>({value:e.id,label:e.name})),o=t=>e.find(e=>e.id===t)?.provider??`printnode`,s=e=>vf(n,o(e)),c=(e,n)=>{i(t.map((t,r)=>r===e?{...t,...n}:t))},l=()=>{let n=e[0];if(!n)return;let r=s(n.id);i([...t,{printer_id:n.id,store_id:0,scope:`every`,template_id:r[0]?.value??``}])},u=e=>i(t.filter((t,n)=>n!==e));return(0,L.jsxs)(`div`,{className:`wcpos:mt-4 wcpos:flex wcpos:flex-col wcpos:gap-3`,children:[(0,L.jsxs)(Xa,{status:`info`,children:[`💡`,` `,$(`cloud_print.rules_tip`,`This is optional — leave it empty to print receipts only manually from the POS.`)]}),(0,L.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,L.jsx)(`a`,{href:Nf,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,L.jsx)(`p`,{"data-testid":`rules-empty`,className:`wcpos:text-sm wcpos:text-gray-500`,children:$(`cloud_print.no_rules`,`No rules yet.`)}):(0,L.jsx)(`div`,{className:`wcpos:flex wcpos:flex-col wcpos:gap-2`,children:t.map((e,t)=>{let n=jf(r,e),i=Af(e);return(0,L.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,L.jsx)(`span`,{children:$(`cloud_print.rule_print`,`Automatically print`)}),(0,L.jsx)(Ta,{inline:!0,"data-testid":`rule-scope-${t}`,"aria-label":$(`cloud_print.rule_scope_label`,`Which orders to print`),className:`wcpos:max-w-full`,style:Ff(n,i),value:i,options:n,onChange:({value:e})=>c(t,Mf(String(e)))}),(0,L.jsx)(`span`,{children:$(`cloud_print.rule_to`,`to`)}),(0,L.jsx)(Ta,{inline:!0,"data-testid":`rule-printer-${t}`,"aria-label":$(`cloud_print.rule_printer_label`,`Printer`),className:`wcpos:max-w-full`,style:Ff(a,e.printer_id),value:e.printer_id,options:a,onChange:({value:e})=>c(t,{printer_id:String(e)})}),(0,L.jsx)(`span`,{children:$(`cloud_print.rule_using`,`using the`)}),(0,L.jsx)(Ta,{inline:!0,"data-testid":`rule-template-${t}`,"aria-label":$(`cloud_print.rule_template_label`,`Receipt template`),className:`wcpos:max-w-full`,style:Ff(s(e.printer_id),e.template_id),value:e.template_id,options:s(e.printer_id),onChange:({value:e})=>c(t,{template_id:String(e)})}),(0,L.jsx)(`span`,{children:$(`cloud_print.rule_template_suffix`,`template.`)}),(0,L.jsx)(W,{variant:`ghost-destructive`,"data-testid":`rule-remove-${t}`,className:`wcpos:ml-1`,onClick:()=>u(t),children:$(`common.remove`,`Remove`)})]},t)})}),(0,L.jsx)(`div`,{children:(0,L.jsx)(W,{variant:`outline`,"data-testid":`rules-add`,disabled:e.length===0,onClick:l,children:$(`cloud_print.add_rule`,`+ Add rule`)})})]})}async function Lf(e,t=i.default){return(await t({path:`wcpos/v1/printnode/printers?wcpos=1`,method:`POST`,data:{api_key:e}})).printers??[]}async function Rf(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 zf=`wcpos/v1/print-jobs/queue`,Bf=`print-queue`,Vf=20,Hf=3e4,Uf=600,Wf={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 Gf(e){if(!e||e.startsWith(`0000`))return null;let t=new Date(`${e.replace(` `,`T`)}Z`);return Number.isNaN(t.getTime())?null:t}function Kf(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 qf(e){let t=Gf(e);return t?Kf(t):`—`}function Jf(e){return e.polling===!1||e.pending===0?!1:e.last_seen===0||Date.now()/1e3-e.last_seen>Uf}function Yf(){let t=We(),[n,r]=e.useState(``),[a,o]=e.useState(`active`),[s,c]=e.useState(1),[l,u]=e.useState(new Set),{data:d}=ot({queryKey:[Bf,n,a,s],queryFn:()=>(0,i.default)({path:`${zf}?wcpos=1&per_page=${Vf}&page=${s}${n?`&printer_id=${encodeURIComponent(n)}`:``}${a?`&status=${encodeURIComponent(a)}`:``}`,method:`GET`}),refetchInterval:Hf}),{addSnackbar:f}=mo(),p=()=>{u(new Set),t.invalidateQueries({queryKey:[Bf]})},m=()=>{f({message:$(`cloud_print.queue_action_failed`,`That didn't work — the queue is unchanged. Try again.`),status:`error`})},h=ct({mutationFn:e=>(0,i.default)({path:`${zf}/cancel?wcpos=1`,method:`POST`,data:e}),onSuccess:p,onError:m}),g=ct({mutationFn:e=>(0,i.default)({path:`wcpos/v1/print-jobs/${e}/reprint?wcpos=1`,method:`POST`}),onSuccess:p,onError:m}),_=d?.total;if(e.useEffect(()=>{if(typeof _!=`number`)return;let e=Math.max(1,Math.ceil(_/Vf));s>e&&c(e)},[_,s]),!d||!Array.isArray(d.jobs)||!d.summary)return null;let{jobs:v,total:y,summary:b}=d,x=new Map(b.printers.map(e=>[e.printer_id,e.name])),S=b.printers.filter(Jf),C=b.counts,w=Object.values(C).some(e=>e>0)||y>0,T=v.map(e=>e.id),E=T.length>0&&T.every(e=>l.has(e)),D=()=>{u(E?new Set:new Set(T))},O=e=>{let t=new Set(l);t.has(e)?t.delete(e):t.add(e),u(t)},k=v.filter(e=>l.has(e.id)&&(e.status===`pending`||e.status===`claimed`)).map(e=>e.id),A=Math.max(1,Math.ceil(y/Vf)),j=(C.pending??0)+(C.claimed??0)+(C.failed??0),M=[{label:$(`cloud_print.queue_status_active`,`Needs attention ({count})`,{count:String(j)}),value:`active`},{label:$(`cloud_print.queue_all_statuses`,`All statuses`),value:``},...[`pending`,`claimed`,`failed`,`printed`,`cancelled`].map(e=>({label:`${Wf[e].label()} (${C[e]??0})`,value:e}))],N=[{label:$(`cloud_print.queue_all_printers`,`All printers`),value:``},...b.printers.map(e=>({label:e.name,value:e.printer_id}))];return(0,L.jsxs)(Za,{title:$(`cloud_print.queue_title`,`Print queue`),description:$(`cloud_print.queue_description`,`Jobs waiting to be fetched by your printers.`),children:[S.map(e=>(0,L.jsx)(qa,{status:`warning`,isDismissible:!1,children:(0,L.jsxs)(`div`,{className:`wcpos:flex wcpos:items-center wcpos:gap-3 wcpos:flex-wrap`,"data-testid":`queue-stale-${e.printer_id}`,children:[(0,L.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:Kf(new Date(e.last_seen*1e3)),count:String(e.pending)})}),(0,L.jsx)(W,{variant:`ghost-destructive`,"data-testid":`queue-cancel-all-${e.printer_id}`,onClick:()=>h.mutate({printer_id:e.printer_id}),disabled:h.isPending,children:$(`cloud_print.queue_cancel_all`,`Cancel all {count}`,{count:String(e.pending)})})]})},e.printer_id)),w?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:`wcpos:flex wcpos:items-center wcpos:gap-2 wcpos:flex-wrap`,children:[(0,L.jsx)(Ta,{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:N,value:n,onChange:e=>{r(String(e.value)),c(1),u(new Set)}}),(0,L.jsx)(Ta,{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:M,value:a,onChange:e=>{o(String(e.value)),c(1),u(new Set)}}),(0,L.jsx)(`div`,{className:`wcpos:flex-1`}),k.length>0&&(0,L.jsx)(W,{variant:`ghost-destructive`,"data-testid":`queue-cancel-selected`,onClick:()=>h.mutate({ids:k}),disabled:h.isPending,children:$(`cloud_print.queue_cancel_selected`,`Cancel selected ({count})`,{count:String(k.length)})})]}),v.length===0?(0,L.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,L.jsx)(`div`,{className:`wcpos:overflow-x-auto`,children:(0,L.jsxs)(ho,{"data-testid":`queue-table`,className:`wcpos:min-w-[36rem]`,children:[(0,L.jsx)(go,{children:(0,L.jsxs)(vo,{children:[(0,L.jsx)(Y,{className:`wcpos:w-8`,children:(0,L.jsx)(`input`,{type:`checkbox`,checked:E,onChange:D,"aria-label":$(`cloud_print.queue_select_all`,`Select all on this page`),"data-testid":`queue-select-all`})}),(0,L.jsx)(Y,{className:`wcpos:w-28`,children:$(`cloud_print.queue_col_order`,`Order`)}),(0,L.jsx)(Y,{children:$(`cloud_print.queue_col_printer`,`Printer`)}),(0,L.jsx)(Y,{className:`wcpos:w-28`,children:$(`cloud_print.queue_col_status`,`Status`)}),(0,L.jsx)(Y,{className:`wcpos:w-32`,children:$(`cloud_print.queue_col_waiting`,`Waiting`)}),(0,L.jsx)(Y,{className:`wcpos:w-24`})]})}),(0,L.jsx)(_o,{children:v.map(e=>{let t=Wf[e.status]??Wf.pending,n=e.status===`pending`||e.status===`claimed`?qf(e.created_gmt):`—`;return(0,L.jsxs)(yo,{"data-testid":`queue-row-${e.id}`,children:[(0,L.jsx)(X,{children:(0,L.jsx)(`input`,{type:`checkbox`,checked:l.has(e.id),onChange:()=>O(e.id),"aria-label":$(`cloud_print.queue_select_job`,`Select job {id}`,{id:String(e.id)})})}),(0,L.jsx)(X,{children:e.order_edit_url?(0,L.jsxs)(`a`,{href:e.order_edit_url,target:`_blank`,rel:`noopener noreferrer`,children:[`#`,e.order_number??e.order_id]}):(0,L.jsx)(`span`,{className:`wcpos:text-gray-500`,children:$(`cloud_print.queue_no_order`,`Job {id}`,{id:String(e.id)})})}),(0,L.jsx)(X,{children:x.get(e.printer_id)??e.printer_id}),(0,L.jsx)(X,{children:(0,L.jsx)(J,{variant:t.variant,shape:`pill`,size:`sm`,children:t.label()})}),(0,L.jsx)(X,{className:`wcpos:tabular-nums wcpos:text-gray-600`,children:n}),(0,L.jsxs)(X,{className:`wcpos:text-right`,children:[(e.status===`pending`||e.status===`claimed`)&&(0,L.jsx)(W,{variant:`ghost-destructive`,onClick:()=>h.mutate({ids:[e.id]}),disabled:h.isPending,"data-testid":`queue-cancel-${e.id}`,children:$(`cloud_print.queue_cancel`,`Cancel`)}),e.status===`failed`&&(0,L.jsx)(W,{variant:`text`,onClick:()=>g.mutate(e.id),disabled:g.isPending,"data-testid":`queue-retry-${e.id}`,children:$(`cloud_print.queue_retry`,`Retry`)})]})]},e.id)})})]})}),A>1&&(0,L.jsxs)(`div`,{className:`wcpos:flex wcpos:items-center wcpos:justify-end wcpos:gap-3 wcpos:text-sm wcpos:text-gray-600`,children:[(0,L.jsx)(`span`,{"data-testid":`queue-page-info`,children:$(`cloud_print.queue_page_info`,`{from}–{to} of {total}`,{from:String((s-1)*Vf+1),to:String(Math.min(s*Vf,y)),total:String(y)})}),(0,L.jsx)(W,{variant:`outline`,onClick:()=>c(e=>Math.max(1,e-1)),disabled:s<=1,"aria-label":$(`common.previous`,`Previous`),children:`‹`}),(0,L.jsx)(W,{variant:`outline`,onClick:()=>c(e=>Math.min(A,e+1)),disabled:s>=A,"aria-label":$(`common.next`,`Next`),children:`›`})]})]}):(0,L.jsx)(`p`,{className:`wcpos:text-sm wcpos:text-gray-500`,"data-testid":`queue-empty`,children:$(`cloud_print.queue_empty`,`No print jobs yet.`)})]})}var Xf=`wcpos/v1/settings/cloud-print?wcpos=1`,Zf=3e4;function Qf(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 $f(){return await(0,i.default)({path:Xf,method:`GET`})}var ep=new Set,tp,np=!1;async function rp(){if(!np){np=!0;try{let e=await $f();ep.forEach(t=>t(e))}catch{}finally{np=!1}}}function ip(e){return ep.add(e),tp===void 0&&(tp=window.setInterval(()=>{rp()},Zf)),()=>{ep.delete(e),ep.size===0&&tp!==void 0&&(window.clearInterval(tp),tp=void 0)}}function ap(t){let[n,r]=e.useState({status:t.status,statusDetail:t.status_detail});return e.useEffect(()=>(r({status:t.status,statusDetail:t.status_detail}),ip(e=>{let n=e.printers.find(e=>e.id===t.id);r({status:n?.status,statusDetail:n?.status_detail})})),[t.id,t.status,t.status_detail]),n}function op({printer:e}){let t=_f[e.provider],{status:n}=ap(e),r=Qf(n,t.isPolling);return(0,L.jsx)(J,{variant:r.variant,shape:`pill`,size:`sm`,"data-testid":`printer-card-status-${e.id}`,children:r.label})}function sp({label:e,testId:t}){return(0,L.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,L.jsx)($d,{className:`wcpos:w-4 wcpos:h-4 wcpos:fill-current`})})}function cp({open:e,title:t,description:n,confirmLabel:r,cancelLabel:i,isSubmitting:a=!1,onConfirm:o,onClose:s}){return(0,L.jsx)(La,{open:e,onClose:s,title:t,description:n,children:(0,L.jsxs)(`div`,{className:`wcpos:mt-4 wcpos:flex wcpos:justify-end wcpos:gap-2`,children:[(0,L.jsx)(W,{variant:`secondary`,onClick:()=>{s(!1)},disabled:a,children:i||$(`sessions.cancel`)}),(0,L.jsx)(W,{variant:`destructive`,onClick:o,disabled:a,children:r||$(`sessions.confirm`)})]})})}function lp(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 up(){return[{value:`pdf`,label:$(`cloud_print.format_pdf`,`PDF (recommended)`)},{value:`raw`,label:$(`cloud_print.format_raw`,`ESC/POS RAW — thermal templates only`)}]}var dp=[[`year`,31536e3],[`month`,2592e3],[`day`,86400],[`hour`,3600],[`minute`,60],[`second`,1]];function fp(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 dp)if(a>=t||e===`second`){let r=Math.round(n/t);return i.format(r,e)}return i.format(0,`second`)}function pp(e){if(!e)return``;try{let t=new URL(e).pathname.match(/\/cloudprnt\/([^/]+)/);return t?decodeURIComponent(t[1]):``}catch{return``}}function mp({printer:t,onRename:n,onRemove:r,onOpenSetup:a,onUpdate:o}){let{addSnackbar:s}=mo(),c=_f[t.provider],{status:l,statusDetail:u}=ap(t),d=t.provider===`printnode`,f=t.provider===`star-online`,p=t.printnode_format??`pdf`,[m,h]=e.useState(t.name),[g,_]=e.useState(!1),[v,y]=e.useState(!1),b=e.useRef(t.name);e.useEffect(()=>{h(t.name),b.current=t.name},[t.name]);let x=e.useCallback(()=>{let e=m.trim();if(!e){h(t.name);return}e!==t.name&&e!==b.current&&(b.current=e,n(t.id,e))},[m,n,t.id,t.name]),S=e.useCallback(async()=>{_(!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{_(!1)}},[s,t.id,t.name]),C=t.last_seen==null?$(`cloud_print.never`,`never`):fp(t.last_seen,_l.language||void 0);return(0,L.jsxs)(Ha,{"data-testid":`printer-card-${t.id}`,children:[(0,L.jsxs)(Ha.Body,{className:`wcpos:relative`,children:[(0,L.jsxs)(`div`,{className:`wcpos:flex wcpos:items-start wcpos:gap-3`,children:[(0,L.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,L.jsxs)(`div`,{className:`wcpos:min-w-0 wcpos:flex-1`,children:[(0,L.jsx)(`input`,{type:`text`,"data-testid":`printer-card-name-${t.id}`,value:m,onChange:e=>h(e.target.value),onBlur:x,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),e.target.blur(),x())},"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,L.jsx)(`div`,{className:`wcpos:px-1 wcpos:text-xs wcpos:text-gray-500`,children:c.label})]}),(0,L.jsxs)(Ba,{align:`end`,label:$(`cloud_print.printer_menu`,`Printer actions`),className:`wcpos:absolute wcpos:top-2 wcpos:right-2`,trigger:(0,L.jsx)(sp,{label:$(`cloud_print.printer_menu`,`Printer actions`),testId:`printer-card-menu-${t.id}`}),children:[(0,L.jsx)(Va,{onSelect:()=>a(t),children:$(`cloud_print.menu_setup`,`Setup & token`)}),(0,L.jsx)(Va,{destructive:!0,onSelect:()=>y(!0),children:$(`cloud_print.menu_remove`,`Remove printer`)})]})]}),(0,L.jsx)(`div`,{className:`wcpos:mt-2`,children:(0,L.jsx)(op,{printer:t})}),l===`blocked`&&(0,L.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:lp(u)}),(0,L.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,L.jsx)(`dt`,{className:`wcpos:text-gray-500`,children:$(`cloud_print.last_check_in`,`Last check-in`)}),(0,L.jsx)(`dd`,{className:`wcpos:text-gray-900`,"data-testid":`printer-card-last-seen-${t.id}`,children:C}),(0,L.jsx)(`dt`,{className:`wcpos:text-gray-500`,children:$(`cloud_print.printer_id`,`Printer ID`)}),(0,L.jsxs)(`dd`,{className:`wcpos:flex wcpos:items-center wcpos:gap-1 wcpos:text-gray-900`,children:[(0,L.jsx)(`code`,{className:`wcpos:rounded wcpos:bg-gray-100 wcpos:px-1 wcpos:py-0.5`,children:t.id}),(0,L.jsx)(Ra,{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,L.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,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`dt`,{className:`wcpos:text-gray-500`,children:$(`cloud_print.star_device`,`Device`)}),(0,L.jsx)(`dd`,{className:`wcpos:text-gray-900`,"data-testid":`printer-card-star-device-${t.id}`,children:t.star_client_type||_f[`star-online`].label}),(0,L.jsx)(`dt`,{className:`wcpos:text-gray-500`,children:$(`cloud_print.star_group`,`Group`)}),(0,L.jsx)(`dd`,{className:`wcpos:text-gray-900`,"data-testid":`printer-card-star-group-${t.id}`,children:pp(t.star_cloudprnt_url)||`—`}),(0,L.jsx)(`dt`,{className:`wcpos:text-gray-500`,children:$(`cloud_print.star_device_id`,`AccessIdentifier`)}),(0,L.jsx)(`dd`,{className:`wcpos:text-gray-900`,"data-testid":`printer-card-star-device-id-${t.id}`,children:(0,L.jsx)(`code`,{className:`wcpos:rounded wcpos:bg-gray-100 wcpos:px-1 wcpos:py-0.5`,children:t.star_device_id})})]}),d&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`dt`,{className:`wcpos:text-gray-500`,children:$(`cloud_print.format`,`Print format`)}),(0,L.jsx)(`dd`,{className:`wcpos:text-gray-900`,children:(0,L.jsx)(Ta,{"data-testid":`printer-card-format-${t.id}`,"aria-label":$(`cloud_print.format`,`Print format`),className:`wcpos:w-auto`,value:p,options:up(),onChange:({value:e})=>o(t.id,{printnode_format:e})})})]})]})]}),(0,L.jsx)(Ha.Footer,{className:`wcpos:flex wcpos:justify-end`,children:(0,L.jsx)(W,{variant:`outline`,loading:g,disabled:g,onClick:S,"data-testid":`printer-card-test-${t.id}`,children:$(`cloud_print.test_print`,`Test print`)})}),(0,L.jsx)(cp,{open:v,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:()=>{y(!1),r(t)},onClose:()=>y(!1)})]})}function hp({children:e,className:t=``,...n}){return(0,L.jsx)(`div`,{className:`wcpos:grid wcpos:grid-cols-[repeat(auto-fill,minmax(min(100%,340px),1fr))] wcpos:gap-4 ${t}`,...n,children:e})}var gp=`wcpos/v1/settings/cloud-print?wcpos=1`;function _p(){let e=We(),{data:t}=st({queryKey:[`cloud-print`],queryFn:()=>(0,i.default)({path:gp,method:`GET`})});return{settings:t,save:ct({mutationFn:e=>(0,i.default)({path:gp,method:`POST`,data:e}),onSuccess:t=>e.setQueryData([`cloud-print`],e=>({printers:t.printers,assignments:t.assignments,relay:t.relay??e?.relay}))}).mutateAsync}}var vp=`wcpos/v1/print-jobs/relay/register?wcpos=1`;function yp(){let e=We();return{register:ct({mutationFn:()=>(0,i.default)({path:vp,method:`POST`}),onSuccess:t=>e.setQueryData([`cloud-print`],e=>e&&{...e,relay:t})})}}var bp=`wcpos/v1/templates?wcpos=1&type=receipt`;function xp(e=!1){let{data:t}=st({queryKey:[`templates`,`receipt`],queryFn:()=>(0,i.default)({path:bp,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 Sp(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 Cp=`cloud-print-save`;function wp(){let{settings:t,save:n}=_p(),{register:r}=yp(),i=xp(),a=window.wcpos?.settings?.cloudPrintStoreOptions,o=Array.isArray(a)?a:[],{addSnackbar:s}=mo(),[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),_=e.useCallback(e=>{f.current=e,l(e)},[]);e.useEffect(()=>{m.current===0&&(p.current=t,_(t))},[_,t]);let v=e.useCallback(async e=>{let t=g.current+1;g.current=t,m.current+=1,_(e),s({id:Cp,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&&_(n),s({id:Cp,message:$(`cloud_print.saved`,`Saved`),status:`success`}),e}catch(e){let n=Sp(e);throw t===g.current&&_(p.current),s({id:Cp,message:n,status:`error`}),e}finally{--m.current}},[s,_,n]),y=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 v({...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]}},[v]),b=e.useCallback((e,t)=>{let n=f.current;v({...n,printers:n.printers.map(n=>n.id===e?{...n,name:t}:n)}).catch(()=>void 0)},[v]),x=e.useCallback((e,t)=>{let n=f.current;v({...n,printers:n.printers.map(n=>n.id===e?{...n,...t}:n)}).catch(()=>void 0)},[v]),S=e.useCallback(e=>{let t=f.current;v({...t,printers:t.printers.filter(t=>t.id!==e.id),assignments:t.assignments.filter(t=>t.printer_id!==e.id)}).catch(()=>void 0)},[v]),C=e.useCallback(e=>{let t=f.current;v({...t,assignments:e}).catch(()=>void 0)},[v]),w=t.relay,T=e.useRef(!1);return e.useEffect(()=>{!w||w.enabled||w.available===!1||T.current||(T.current=!0,r.mutate(void 0,{onError:()=>void 0}))},[w,r]),(0,L.jsxs)(`div`,{className:`wcpos:flex wcpos:flex-col wcpos:gap-6 wcpos:px-4 wcpos:pb-5`,children:[(0,L.jsxs)(Xa,{status:`info`,title:$(`cloud_print.intro_title`,`What is cloud printing?`),children:[(0,L.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,L.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,L.jsxs)(`ul`,{className:`wcpos:mt-1 wcpos:list-disc wcpos:pl-5`,children:[(0,L.jsx)(`li`,{children:$(`cloud_print.intro_li1`,`send every order straight to the kitchen printer, or`)}),(0,L.jsx)(`li`,{children:$(`cloud_print.intro_li2`,`print a packing slip for every online sale.`)})]}),(0,L.jsxs)(`p`,{className:`wcpos:mt-2`,children:[$(`cloud_print.intro_p3`,`Cashiers can also print to a cloud printer manually from the POS.`),` `,(0,L.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,L.jsx)(`span`,{className:`wcpos:h-3.5 wcpos:w-3.5`,children:(0,L.jsx)(El,{fill:`currentColor`})}),$(`cloud_print.learn_more`,`Learn more`),(0,L.jsx)(`span`,{className:`wcpos:sr-only`,children:` (opens in new tab)`})]})]})]}),(0,L.jsxs)(Za,{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,L.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,L.jsx)(hp,{"data-testid":`cloud-print-list`,children:c.printers.map(e=>(0,L.jsx)(mp,{printer:e,onRename:b,onRemove:S,onUpdate:x,onOpenSetup:e=>d({open:!0,mode:`setup`,printer:e})},e.id))}),(0,L.jsx)(`div`,{className:`wcpos:mt-4`,children:(0,L.jsx)(W,{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,L.jsx)(Za,{title:$(`cloud_print.auto_print`,`Auto-print rules`),children:(0,L.jsx)(If,{printers:c.printers,assignments:c.assignments,templateOptions:i,storeOptions:o,onChange:C})}),(0,L.jsx)(Yf,{}),(0,L.jsx)(kf,{open:u.open,mode:u.mode,setupPrinter:u.printer,onClose:()=>d(e=>({...e,open:!1})),onCreate:y,fetchPrintNodePrinters:Lf,fetchStarDevices:Rf,relay:w})]})}function Tp(){return(0,L.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,L.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 Ep(e){try{let t=new URL(e).hostname.toLowerCase();return t===`github.com`||t===`www.github.com`}catch{return!1}}function Dp(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 Op({extension:e}){let{homepage:t,installed_version:n,latest_version:r,status:i}=e;if((i===`update_available`||e.has_update)&&n){let e=Dp(t,n),i=Dp(t,r);return(0,L.jsxs)(`span`,{className:`wcpos:text-xs wcpos:text-gray-400`,children:[e?(0,L.jsxs)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,className:`hover:wcpos:text-gray-600 wcpos:transition-colors`,children:[`v`,n]}):(0,L.jsxs)(L.Fragment,{children:[`v`,n]}),` → `,i?(0,L.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,L.jsxs)(`span`,{className:`wcpos:text-yellow-700`,children:[`v`,r]})]})}let a=n||r,o=Dp(t,a);return(0,L.jsx)(`span`,{className:`wcpos:text-xs wcpos:text-gray-400`,children:o?(0,L.jsxs)(`a`,{href:o,target:`_blank`,rel:`noopener noreferrer`,className:`hover:wcpos:text-gray-600 wcpos:transition-colors`,children:[`v`,a]}):(0,L.jsxs)(L.Fragment,{children:[`v`,a]})})}function kp({status:e}){switch(e){case`active`:return(0,L.jsx)(J,{variant:`success`,icon:(0,L.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,L.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,L.jsx)(J,{variant:`warning`,children:$(`extensions.update_available`,`Update available`)});case`inactive`:return(0,L.jsx)(J,{variant:`neutral`,children:$(`extensions.inactive`,`Inactive`)});default:return null}}function Ap({extension:e}){return e.status===`not_installed`?(0,L.jsx)(`div`,{className:`wcpos:flex wcpos:items-center wcpos:justify-end`,children:(0,L.jsx)(Ra,{text:$(`extensions.requires_pro`,`Requires Pro to install`),children:(0,L.jsx)(`span`,{children:(0,L.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 jp(){return window.wcpos?.settings?.getComponent?.(`extensions.action`)??null}function Mp(e){let t=jp();return t?(0,L.jsx)(t,{extension:e}):e.status===`not_installed`?(0,L.jsx)(Ap,{extension:e}):null}function Np({extension:e}){let t=(e.category||``).trim(),n=t?t.charAt(0).toUpperCase()+t.slice(1):null,r=Mp(e),i=!!e.settings_url&&e.status!==`not_installed`,a=!!e.homepage&&Ep(e.homepage),o=i||a;return(0,L.jsxs)(Ha,{children:[(0,L.jsxs)(Ha.Body,{className:`wcpos:relative wcpos:flex wcpos:gap-4`,children:[o&&(0,L.jsxs)(Ba,{label:e.name,className:`wcpos:absolute wcpos:top-2 wcpos:right-2`,trigger:(0,L.jsx)(sp,{label:$(`extensions.more_actions`,`More actions`)}),children:[i&&(0,L.jsx)(Va,{href:e.settings_url,children:$(`extensions.settings`,`Settings`)}),a&&(0,L.jsx)(Va,{href:e.homepage,target:`_blank`,rel:`noopener noreferrer`,children:$(`extensions.view_on_github`,`View on GitHub`)})]}),(0,L.jsx)(`div`,{className:`wcpos:shrink-0 wcpos:flex wcpos:items-start`,children:e.icon?(0,L.jsx)(`img`,{src:e.icon,alt:e.name,className:`wcpos:w-12 wcpos:h-12 wcpos:rounded`}):(0,L.jsx)(Tp,{})}),(0,L.jsxs)(`div`,{className:`wcpos:flex-1 wcpos:min-w-0`,children:[(0,L.jsx)(`h3`,{className:(0,U.default)(`wcpos:text-sm wcpos:font-semibold wcpos:text-gray-900`,o&&`wcpos:pr-8`),children:e.name}),(0,L.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,L.jsx)(kp,{status:e.status}),(0,L.jsx)(Op,{extension:e}),n&&(0,L.jsxs)(`span`,{className:`wcpos:inline-flex wcpos:items-center wcpos:gap-1.5 wcpos:whitespace-nowrap`,children:[(0,L.jsx)(`span`,{className:`wcpos:w-0.5 wcpos:h-0.5 wcpos:rounded-full wcpos:bg-gray-300`}),(0,L.jsx)(`span`,{className:`wcpos:text-xs wcpos:text-gray-500`,children:n})]})]}),(0,L.jsx)(`p`,{className:`wcpos:mt-2 wcpos:text-sm wcpos:text-gray-500`,children:e.description})]})]}),r!=null&&(0,L.jsx)(Ha.Footer,{children:r})]})}function Pp(){let[t,n]=e.useState(``),[r,a]=e.useState(`all`),[o,s]=e.useState(!1),[c,l]=e.useState(!1),u=We(),{data:d=[]}=st({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;zl(e)},[d]),e.useEffect(()=>{f||nf(`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,L.jsxs)(`div`,{children:[c&&(0,L.jsx)(bl,{status:`error`,isDismissible:!1,className:`wcpos:mb-4`,children:$(`extensions.refresh_failed`,`Could not refresh extensions. Please try again.`)}),!f&&(0,L.jsxs)(bl,{status:`info`,isDismissible:!1,className:`wcpos:mb-4`,children:[$(`extensions.upgrade_to_pro`,`Upgrade to Pro to install and manage extensions.`),` `,(0,L.jsx)(`a`,{href:`https://wcpos.com/pro`,onClick:()=>rf(`extensions_screen`,`https://wcpos.com/pro`),children:$(`common.upgrade_to_pro`)}),`.`]}),(0,L.jsxs)(`div`,{className:`wcpos:mb-4 wcpos:flex wcpos:items-center wcpos:gap-3`,children:[(0,L.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,L.jsx)(W,{variant:`secondary`,loading:o,onClick:p,children:o?$(`extensions.refreshing`,`Refreshing...`):$(`extensions.refresh`,`Refresh`)})]}),(0,L.jsx)(Qa,{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,L.jsx)(`p`,{className:`wcpos:text-sm wcpos:text-gray-500`,children:$(`extensions.no_results`,`No extensions found.`)}):(0,L.jsx)(hp,{children:h.map(e=>(0,L.jsx)(Np,{extension:e},e.slug))})]})}var{i18n:Fp,i18nPromise:Ip,t:Lp,Trans:Rp}=gl({namespace:`wp-admin-consent`,project:`woocommerce-pos`,resources:{en:{"wp-admin-consent":{"consent.modal_title":`Help us make WCPOS better`,"consent.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.`,"consent.callout_title":`Help us make WCPOS better`,"consent.callout_body":`Can WCPOS collect anonymous usage data to help improve the product? No personal or customer data is collected. 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 what environments to support.`,"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 can focus on what people actually use.`,"consent.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.`}}}});function zp(e,t,n){let r=e?.[t];return typeof r==`string`&&r!==``?r:Lp(n)}function Bp({open:e,onClose:t,copy:n}){return(0,L.jsxs)(La,{open:e,onClose:t,title:zp(n,`title`,`consent.modal_title`),children:[(0,L.jsx)(`p`,{className:`wcpos:text-sm wcpos:text-gray-700 wcpos:mb-3`,children:zp(n,`body`,`consent.modal_intro`)}),(0,L.jsx)(`p`,{className:`wcpos:text-sm wcpos:text-gray-700 wcpos:mb-2`,children:zp(n,`fields_intro`,`consent.modal_includes`)}),(0,L.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,L.jsxs)(`li`,{children:[(0,L.jsx)(`strong`,{children:Lp(`consent.modal_setup_label`)}),` — `,Lp(`consent.modal_setup_desc`)]}),(0,L.jsxs)(`li`,{children:[(0,L.jsx)(`strong`,{children:Lp(`consent.modal_store_label`)}),` — `,Lp(`consent.modal_store_desc`)]}),(0,L.jsxs)(`li`,{children:[(0,L.jsx)(`strong`,{children:Lp(`consent.modal_usage_label`)}),` — `,Lp(`consent.modal_usage_desc`)]})]}),(0,L.jsx)(`p`,{className:`wcpos:text-sm wcpos:text-gray-500 wcpos:mb-4`,children:zp(n,`privacy_note`,`consent.modal_exclusions`)}),(0,L.jsx)(`div`,{className:`wcpos:flex wcpos:justify-end`,children:(0,L.jsx)(W,{onClick:t,children:Lp(`consent.dismiss`)})})]})}function Vp({selected:t,onSelect:n}){let r=e.useMemo(()=>(window?.wcpos?.settings?.barcodes??[]).map(e=>({value:e,label:e})),[]);return(0,L.jsx)(lu,{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 Hp=`https://wcpos.com/pro`,Up=`general_store_details`,Wp=`https://docs.wcpos.com/settings/wp-admin/store-tax-ids`;function Gp({data:t,mutate:n,storeDefaults:i}){return e.useEffect(()=>{nf(Up)},[]),(0,L.jsxs)(Za,{title:$(`settings.store_details_section_title`),description:$(`settings.store_details_section_description`),divider:!0,children:[(0,L.jsxs)(Xa,{status:`info`,title:$(`settings.store_details_upgrade_callout_title`),className:`wcpos:mt-4`,children:[(0,L.jsx)(`p`,{className:`wcpos:m-0`,children:$(`settings.store_details_upgrade_to_pro`)}),(0,L.jsx)(`p`,{className:`wcpos:mt-2 wcpos:mb-0`,children:(0,L.jsx)(`a`,{href:Hp,target:`_blank`,rel:`noreferrer noopener`,onClick:()=>rf(Up,Hp),children:$(`common.upgrade_to_pro`)})})]}),(0,L.jsx)(q,{label:$(`settings.store_name`),children:(0,L.jsx)(G,{value:(0,r.isString)(t?.store_name)?t.store_name:``,placeholder:i.store_name,onChange:e=>n({store_name:e.target.value})})}),(0,L.jsx)(q,{label:$(`settings.store_phone`),children:(0,L.jsx)(G,{value:(0,r.isString)(t?.store_phone)?t.store_phone:``,placeholder:i.store_phone,onChange:e=>n({store_phone:e.target.value})})}),(0,L.jsx)(q,{label:$(`settings.store_email`),children:(0,L.jsx)(G,{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,L.jsx)(q,{label:$(`settings.refund_returns_policy`),description:$(`settings.refund_returns_policy_tip`),children:(0,L.jsx)(wa,{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,L.jsxs)(`div`,{className:`wcpos:mt-4`,children:[(0,L.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,L.jsxs)(`p`,{className:`wcpos:text-sm wcpos:text-gray-500 wcpos:mb-3`,children:[$(`settings.store_tax_ids_section_description`),` `,(0,L.jsx)(`a`,{href:Wp,target:`_blank`,rel:`noreferrer noopener`,className:`wcpos:text-wp-admin-theme-color wcpos:underline`,children:$(`settings.store_tax_ids_learn_more`)})]}),(0,L.jsx)(No,{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 Kp({value:t,onChange:n}){let r=xp(!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,L.jsx)(Ta,{value:t,options:a,onChange:({value:e})=>n(String(e)),"aria-label":$(`settings.storefront_receipt_template`)})}function qp({enabled:t,template:n,onChange:r}){return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(q,{children:(0,L.jsx)(df,{tip:$(`settings.storefront_receipt_enabled_tip`),children:(0,L.jsx)(Sa,{checked:t,onChange:e=>r({storefront_receipt_enabled:e}),label:$(`settings.storefront_receipt_enabled`)})})}),t&&(0,L.jsx)(q,{label:$(`settings.storefront_receipt_template`),children:(0,L.jsx)(df,{tip:$(`settings.storefront_receipt_template_tip`),children:(0,L.jsx)(e.Suspense,{fallback:(0,L.jsx)(K,{className:`wcpos:h-9 wcpos:w-full wcpos:rounded-md`}),children:(0,L.jsx)(Kp,{value:n,onChange:e=>r({storefront_receipt_template:e})})})})})]})}var Jp={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`},Yp={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`},Xp=`https://docs.wcpos.com/settings/wp-admin/customer-tax-ids`;function Zp(e,t,n,r){return t&&t!==``?`override`:n&&n!==r?`plugin`:`default`}function Qp(e,t,n){return e&&e!==``?e:t||n}function $p({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,L.jsx)(`span`,{className:(0,U.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 em(){return(0,L.jsx)(`a`,{href:Xp,target:`_blank`,rel:`noreferrer noopener`,className:`wcpos:text-wp-admin-theme-color wcpos:underline`,children:$(`tax_ids.learn_more`)})}function tm({plugins:e,overrideCount:t}){let n=e.length>0,r=e.map(e=>Yp[e]??e);return(0,L.jsx)(`div`,{className:(0,U.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,L.jsxs)(`div`,{className:`wcpos:flex wcpos:items-start wcpos:gap-2`,children:[(0,L.jsx)(`span`,{className:(0,U.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,L.jsx)(`div`,{className:`wcpos:flex-1 wcpos:text-sm`,children:n?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:`wcpos:font-medium`,children:[r.join(`, `),` `,(0,L.jsx)(`span`,{className:`wcpos:font-normal`,children:$(`tax_ids.banner_is_installed`)})]}),(0,L.jsxs)(`div`,{className:`wcpos:text-xs wcpos:text-gray-600 wcpos:mt-1`,children:[$(`tax_ids.banner_detected_explainer`),t>0&&(0,L.jsxs)(L.Fragment,{children:[` `,$(`tax_ids.banner_overrides_active`,{count:t})]})]})]}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`div`,{className:`wcpos:font-medium`,children:$(`tax_ids.banner_no_plugin_title`)}),(0,L.jsx)(`div`,{className:`wcpos:text-xs wcpos:text-gray-600 wcpos:mt-1`,children:$(`tax_ids.banner_no_plugin_explainer`)})]})})]})})}function nm({type:e,composed:t,defaultKey:n,override:r,suggestions:i,onCommit:a}){let o=Qp(r,t,n),s=Zp(e,r,t,n);return(0,L.jsxs)(yo,{className:(0,U.default)(s===`override`&&`wcpos:bg-amber-50/40`),children:[(0,L.jsx)(X,{className:`wcpos:font-medium wcpos:text-gray-900`,children:Jp[e]??e}),(0,L.jsx)(X,{className:`wcpos:font-mono wcpos:text-xs wcpos:text-gray-600`,children:o}),(0,L.jsx)(X,{children:(0,L.jsx)($p,{source:s})}),(0,L.jsx)(X,{children:(0,L.jsx)(lu,{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":`${Jp[e]??e} ${$(`tax_ids.col_override`)}`})})]})}function rm(){let{data:t,mutate:n}=uu(`tax_ids`),r=t?.write_map??{},{data:a}=st({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,L.jsxs)(`div`,{className:`wcpos:mt-4`,children:[(0,L.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,L.jsxs)(`p`,{className:`wcpos:text-sm wcpos:text-gray-500 wcpos:mb-3`,children:[$(`tax_ids.section_intro`),` `,(0,L.jsx)(em,{})]}),(0,L.jsx)(tm,{plugins:a.plugins,overrideCount:o}),(0,L.jsxs)(`details`,{className:`wcpos:border wcpos:border-gray-200 wcpos:rounded`,children:[(0,L.jsxs)(`summary`,{className:(0,U.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,L.jsxs)(`span`,{children:[(0,L.jsx)(`strong`,{children:$(`tax_ids.advanced_title`)}),` `,(0,L.jsx)(`span`,{className:`wcpos:text-xs wcpos:text-gray-500`,children:$(`tax_ids.advanced_subtitle`)})]}),o>0&&(0,L.jsx)(`span`,{className:`wcpos:text-xs wcpos:text-gray-500`,children:$(`tax_ids.advanced_override_count`,{count:o})})]}),(0,L.jsxs)(`div`,{className:`wcpos:border-t wcpos:border-gray-200 wcpos:px-3 wcpos:py-3`,children:[(0,L.jsx)(`p`,{className:`wcpos:text-xs wcpos:text-gray-500 wcpos:mb-3`,children:$(`tax_ids.advanced_intro`)}),(0,L.jsxs)(ho,{children:[(0,L.jsx)(go,{children:(0,L.jsxs)(vo,{children:[(0,L.jsx)(Y,{children:$(`tax_ids.col_type`)}),(0,L.jsx)(Y,{children:$(`tax_ids.col_field`)}),(0,L.jsx)(Y,{children:$(`tax_ids.col_source`)}),(0,L.jsx)(Y,{children:$(`tax_ids.col_override`)})]})}),(0,L.jsx)(_o,{children:a.types.map(e=>(0,L.jsx)(nm,{type:e,composed:a.composed_write_map[e]??``,defaultKey:a.default_write_map[e]??``,override:r[e],suggestions:c,onCommit:s},e))})]}),(0,L.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,L.jsxs)(`span`,{className:`wcpos:flex wcpos:items-center wcpos:gap-1.5`,children:[(0,L.jsx)($p,{source:`plugin`}),` `,$(`tax_ids.legend_plugin`)]}),(0,L.jsxs)(`span`,{className:`wcpos:flex wcpos:items-center wcpos:gap-1.5`,children:[(0,L.jsx)($p,{source:`default`}),` `,$(`tax_ids.legend_built_in`)]}),(0,L.jsxs)(`span`,{className:`wcpos:flex wcpos:items-center wcpos:gap-1.5`,children:[(0,L.jsx)($p,{source:`override`}),` `,$(`tax_ids.legend_custom`)]})]})]})]})]})}function im({disabled:t=!1,selected:n,onSelect:r}){let a=e.useMemo(()=>({id:0,name:$(`common.guest`)}),[]),{setNotice:o}=wl(),[s,c]=e.useState(``),{data:l,isFetching:u}=ot({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,L.jsx)(lu,{value:String(n||0),options:d,onChange:e=>r(e?Number(e):0),onQuery:c,loading:u,disabled:t})}function am(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 om(){return window?.wcpos?.settings?.getComponent?.(`general.store_details_block`)||null}function sm(){let{data:t,mutate:n}=uu(`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=om()??Gp;return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(c,{data:t,mutate:n,storeDefaults:s}),(0,L.jsxs)(Za,{title:$(`settings.products_section_title`),divider:!0,children:[(0,L.jsx)(q,{children:(0,L.jsx)(df,{tip:$(`settings.pos_only_products_tip`),children:(0,L.jsx)(Sa,{checked:!!t?.pos_only_products,onChange:e=>{n({pos_only_products:e})},label:$(`settings.pos_only_products`)})})}),(0,L.jsx)(q,{children:(0,L.jsx)(df,{tip:$(`settings.decimal_quantities_tip`),children:(0,L.jsx)(Sa,{checked:!!t?.decimal_qty,onChange:e=>{n({decimal_qty:e})},label:$(`settings.decimal_quantities`)})})}),(0,L.jsx)(q,{children:(0,L.jsx)(df,{tip:$(`settings.restore_stock_on_delete_tip`),children:(0,L.jsx)(Sa,{checked:!!t?.restore_stock_on_delete,onChange:e=>{n({restore_stock_on_delete:e})},label:$(`settings.restore_stock_on_delete`)})})}),(0,L.jsx)(q,{label:$(`settings.barcode_field`),children:(0,L.jsx)(df,{tip:$(`settings.barcode_field_tip`),children:(0,L.jsx)(e.Suspense,{fallback:(0,L.jsx)(K,{className:`wcpos:h-9 wcpos:w-full wcpos:rounded-md`}),children:(0,L.jsx)(Vp,{selected:(0,r.isString)(t?.barcode_field)&&t?.barcode_field||``,onSelect:e=>{n({barcode_field:e||`_sku`})}})})})})]}),(0,L.jsxs)(Za,{title:$(`settings.customers_section_title`),divider:!0,children:[(0,L.jsx)(q,{children:(0,L.jsx)(Sa,{checked:!!t?.generate_username,onChange:e=>{n({generate_username:e})},label:$(`settings.generate_username`)})}),(0,L.jsxs)(q,{label:$(`settings.default_customer`),children:[(0,L.jsx)(df,{tip:$(`settings.default_customer_tip`),children:(0,L.jsx)(e.Suspense,{fallback:(0,L.jsx)(K,{className:`wcpos:h-9 wcpos:w-full wcpos:rounded-md`}),children:(0,L.jsx)(im,{disabled:!!t?.default_customer_is_cashier,selected:(0,r.isNumber)(t?.default_customer)&&t?.default_customer||0,onSelect:e=>{n({default_customer:e})}})})}),(0,L.jsx)(`div`,{className:`wcpos:mt-2`,children:(0,L.jsx)(Ca,{label:$(`settings.use_cashier_account`),checked:!!t?.default_customer_is_cashier,onChange:e=>{n({default_customer_is_cashier:e.target.checked})}})})]}),(0,L.jsx)(qp,{enabled:!!t?.storefront_receipt_enabled,template:(0,r.isString)(t?.storefront_receipt_template)?t?.storefront_receipt_template:``,onChange:e=>{n(e)}}),(0,L.jsx)(e.Suspense,{fallback:(0,L.jsx)(K,{className:`wcpos:h-32 wcpos:w-full wcpos:rounded-md wcpos:mt-4`}),children:(0,L.jsx)(rm,{})})]}),(0,L.jsxs)(Za,{title:$(`settings.privacy_section_title`),divider:!0,children:[(0,L.jsx)(q,{children:(0,L.jsx)(df,{children:(0,L.jsx)(Sa,{checked:t?.tracking_consent===`allowed`,onChange:e=>{n({tracking_consent:e?`allowed`:`denied`})},label:$(`settings.allow_anonymous_usage_data`)})})}),(0,L.jsxs)(`p`,{className:`wcpos:text-sm wcpos:text-gray-500`,children:[$(`settings.allow_anonymous_usage_data_tip`),` `,(0,L.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,L.jsx)(Za,{title:$(`settings.advanced_section_title`),divider:!0,children:(0,L.jsx)(q,{children:(0,L.jsx)(df,{tip:$(`settings.force_ssl_tip`),children:(0,L.jsx)(Sa,{checked:!o||am(t?.force_ssl),disabled:!o,onChange:e=>{n({force_ssl:e})},label:$(`settings.force_ssl`)})})})}),(0,L.jsx)(Bp,{open:i,onClose:()=>a(!1)})]})}var cm=(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 lm(){let{data:t,mutate:n}=uu(`license`),{setNotice:i}=wl(),[o,s]=e.useState(t?.key),c=e=>s(e.target.value),l=async(e=!1)=>{e||af();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||cf(t),i({type:`error`,message:t.message}),null));if(d)if(!d.success)e||cf(d),i({type:`error`,message:d.error});else{if(e)s(``);else{of((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||(nf(`license_screen_card`),nf(`license_screen_link`))},[t?.instance]),t?.instance?t.activated?(0,L.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,L.jsx)(`div`,{className:`wcpos:sm:text-right wcpos:text-8xl`,children:`🎉`}),(0,L.jsxs)(`div`,{className:`wcpos:col-span-2`,children:[(0,L.jsx)(`h3`,{children:$(`license.thank_you`)}),(0,L.jsx)(`p`,{children:(0,L.jsx)(yl,{i18nKey:`license.activated`,components:{code:(0,L.jsx)(`code`,{})},values:{number:cm((0,r.isString)(t?.key)?t?.key:``)}})}),(0,L.jsx)(`p`,{children:$(`license.ongoing_support`)}),(0,L.jsx)(W,{variant:`primary`,onClick:()=>l(!0),children:$(`license.deactivate`)})]})]}):(0,L.jsxs)(`div`,{className:`wcpos:px-4 wcpos:py-5 wcpos:sm:grid wcpos:sm:grid-cols-3 wcpos:sm:gap-4`,children:[(0,L.jsx)(`div`,{className:`wcpos:flex wcpos:sm:justify-end`,children:(0,L.jsx)(df,{children:$(`license.license_key`)})}),(0,L.jsx)(`div`,{children:(0,L.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,L.jsx)(`div`,{children:(0,L.jsx)(W,{variant:`primary`,disabled:!o,onClick:()=>l(),children:$(`license.activate`)})})]}):(0,L.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,L.jsx)(`a`,{href:`https://wcpos.com/pro`,onClick:()=>rf(`license_screen_card`,`https://wcpos.com/pro`),children:(0,L.jsx)(`img`,{src:`https://wcpos.com/images/wcpos-pro.png`,alt:`WCPOS Pro`,width:80,height:80})}),(0,L.jsxs)(`div`,{className:`wcpos:text-center`,children:[(0,L.jsx)(`p`,{className:`wcpos:text-gray-600 wcpos:mb-3`,children:$(`license.support_development`)}),(0,L.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:()=>rf(`license_screen_link`,`https://wcpos.com/pro`),children:[$(`common.upgrade_to_pro`),` →`]})]}),(0,L.jsxs)(bl,{status:`info`,isDismissible:!1,className:`wcpos:w-full`,children:[$(`license.existing_license_prefix`),` `,(0,L.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 um(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 dm(e,t={}){let n=[`[${um(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(` |