const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/AdminLayoutRoute-C0zEWHIS.js","assets/index-4KwZO5Jq.js","assets/index-4WrNoKTp.js","assets/index-CNHXYmSP.js","assets/index-Dot2qOO2.js","assets/DashboardRoute-CsBHb-0G.js","assets/ForbiddenRoute-DzAkFWyF.js","assets/RbacLayoutRoute-D4LSK8JY.js","assets/rbacAdminTheme-p-Xpb2Mf.js","assets/RbacRolesRoute-DeUeTzgP.js","assets/RbacPermissionsRoute-CDPcgUdH.js","assets/RbacMembersRoute-g0X_GCqo.js","assets/LoginRoute-Bi7628aN.js","assets/LoginRoute-DznSLwQF.js","assets/AccountRoute-J4AR9dBa.js","assets/ListRoute-tsOSySGE.js","assets/index-4MAVvZ4U.js","assets/index-DIi9V9Ag.js","assets/AdminPublishRow-C6Gcb5l_.js","assets/CreateRoute-Cg9nLp0s.js","assets/index-BmGPiKmH.js","assets/index-D1uo_8A5.js","assets/index-xpPPPlec.js","assets/index-p8899CLC.js","assets/EditRoute-CioIuFdG.js","assets/ListRoute-DXalgo6r.js","assets/CreateRoute-CXdZ9OWz.js","assets/index-BAq36zrp.js","assets/index-B7duaS_R.js","assets/EditRoute-B0irqUJb.js","assets/ListRoute-FYCjsMH4.js","assets/index-mWh5EjUd.js","assets/index-CmcjK9Q1.js","assets/index-BAaW8V8o.js","assets/CategoryRoute-CjEmgNFo.js","assets/DetailRoute-2wJzg08C.js","assets/index-RY7oOwqm.js","assets/ListRoute-BXK-lxKl.js","assets/CreateRoute-DqLnkhJC.js","assets/index-CJ9l_cyx.js","assets/EditRoute-DJaJHVL8.js","assets/ListRoute-DG3qb5v2.js","assets/CreateRoute-D4lpSbxk.js","assets/index-UzYSyh5u.js","assets/EditRoute-PUxL_K-L.js","assets/ListRoute-B8OMGh0W.js","assets/CategoryRoute-zDzuW-7M.js","assets/DetailRoute-D0zM4C2y.js"])))=>i.map(i=>d[i]); var px=Object.defineProperty;var mx=(e,t,r)=>t in e?px(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var hr=(e,t,r)=>mx(e,typeof t!="symbol"?t+"":t,r);function um(e,t){for(var r=0;rn[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))n(s);new MutationObserver(s=>{for(const a of s)if(a.type==="childList")for(const i of a.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&n(i)}).observe(document,{childList:!0,subtree:!0});function r(s){const a={};return s.integrity&&(a.integrity=s.integrity),s.referrerPolicy&&(a.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?a.credentials="include":s.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function n(s){if(s.ep)return;s.ep=!0;const a=r(s);fetch(s.href,a)}})();var Ft=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ii(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function gx(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var r=function n(){return this instanceof n?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(n){var s=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,s.get?s:{enumerable:!0,get:function(){return e[n]}})}),r}var dm={exports:{}},Jo={},fm={exports:{}},ie={};/** * @license React * react.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var oi=Symbol.for("react.element"),vx=Symbol.for("react.portal"),yx=Symbol.for("react.fragment"),xx=Symbol.for("react.strict_mode"),wx=Symbol.for("react.profiler"),bx=Symbol.for("react.provider"),_x=Symbol.for("react.context"),Sx=Symbol.for("react.forward_ref"),Ex=Symbol.for("react.suspense"),kx=Symbol.for("react.memo"),jx=Symbol.for("react.lazy"),pf=Symbol.iterator;function Cx(e){return e===null||typeof e!="object"?null:(e=pf&&e[pf]||e["@@iterator"],typeof e=="function"?e:null)}var hm={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},pm=Object.assign,mm={};function Us(e,t,r){this.props=e,this.context=t,this.refs=mm,this.updater=r||hm}Us.prototype.isReactComponent={};Us.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Us.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function gm(){}gm.prototype=Us.prototype;function Fu(e,t,r){this.props=e,this.context=t,this.refs=mm,this.updater=r||hm}var Uu=Fu.prototype=new gm;Uu.constructor=Fu;pm(Uu,Us.prototype);Uu.isPureReactComponent=!0;var mf=Array.isArray,vm=Object.prototype.hasOwnProperty,Bu={current:null},ym={key:!0,ref:!0,__self:!0,__source:!0};function xm(e,t,r){var n,s={},a=null,i=null;if(t!=null)for(n in t.ref!==void 0&&(i=t.ref),t.key!==void 0&&(a=""+t.key),t)vm.call(t,n)&&!ym.hasOwnProperty(n)&&(s[n]=t[n]);var o=arguments.length-2;if(o===1)s.children=r;else if(1>>1,re=P[te];if(0>>1;tes(Ne,W))_es(Q,Ne)?(P[te]=Q,P[_e]=W,te=_e):(P[te]=Ne,P[fe]=W,te=fe);else if(_es(Q,W))P[te]=Q,P[_e]=W,te=_e;else break e}}return H}function s(P,H){var W=P.sortIndex-H.sortIndex;return W!==0?W:P.id-H.id}if(typeof performance=="object"&&typeof performance.now=="function"){var a=performance;e.unstable_now=function(){return a.now()}}else{var i=Date,o=i.now();e.unstable_now=function(){return i.now()-o}}var l=[],u=[],d=1,f=null,h=3,m=!1,x=!1,v=!1,_=typeof setTimeout=="function"?setTimeout:null,y=typeof clearTimeout=="function"?clearTimeout:null,g=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w(P){for(var H=r(u);H!==null;){if(H.callback===null)n(u);else if(H.startTime<=P)n(u),H.sortIndex=H.expirationTime,t(l,H);else break;H=r(u)}}function E(P){if(v=!1,w(P),!x)if(r(l)!==null)x=!0,J(C);else{var H=r(u);H!==null&&ge(E,H.startTime-P)}}function C(P,H){x=!1,v&&(v=!1,y(k),k=-1),m=!0;var W=h;try{for(w(H),f=r(l);f!==null&&(!(f.expirationTime>H)||P&&!z());){var te=f.callback;if(typeof te=="function"){f.callback=null,h=f.priorityLevel;var re=te(f.expirationTime<=H);H=e.unstable_now(),typeof re=="function"?f.callback=re:f===r(l)&&n(l),w(H)}else n(l);f=r(l)}if(f!==null)var ue=!0;else{var fe=r(u);fe!==null&&ge(E,fe.startTime-H),ue=!1}return ue}finally{f=null,h=W,m=!1}}var R=!1,b=null,k=-1,A=5,N=-1;function z(){return!(e.unstable_now()-NP||125te?(P.sortIndex=W,t(u,P),r(l)===null&&P===r(u)&&(v?(y(k),k=-1):v=!0,ge(E,W-te))):(P.sortIndex=re,t(l,P),x||m||(x=!0,J(C))),P},e.unstable_shouldYield=z,e.unstable_wrapCallback=function(P){var H=h;return function(){var W=h;h=H;try{return P.apply(this,arguments)}finally{h=W}}}})(Em);Sm.exports=Em;var $x=Sm.exports;/** * @license React * react-dom.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var Mx=p,Pt=$x;function I(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,r=1;r"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),jc=Object.prototype.hasOwnProperty,Fx=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,vf={},yf={};function Ux(e){return jc.call(yf,e)?!0:jc.call(vf,e)?!1:Fx.test(e)?yf[e]=!0:(vf[e]=!0,!1)}function Bx(e,t,r,n){if(r!==null&&r.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return n?!1:r!==null?!r.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function Vx(e,t,r,n){if(t===null||typeof t>"u"||Bx(e,t,r,n))return!0;if(n)return!1;if(r!==null)switch(r.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function mt(e,t,r,n,s,a,i){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=n,this.attributeNamespace=s,this.mustUseProperty=r,this.propertyName=e,this.type=t,this.sanitizeURL=a,this.removeEmptyString=i}var st={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){st[e]=new mt(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];st[t]=new mt(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){st[e]=new mt(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){st[e]=new mt(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){st[e]=new mt(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){st[e]=new mt(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){st[e]=new mt(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){st[e]=new mt(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){st[e]=new mt(e,5,!1,e.toLowerCase(),null,!1,!1)});var Wu=/[\-:]([a-z])/g;function qu(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(Wu,qu);st[t]=new mt(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Wu,qu);st[t]=new mt(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Wu,qu);st[t]=new mt(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){st[e]=new mt(e,1,!1,e.toLowerCase(),null,!1,!1)});st.xlinkHref=new mt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){st[e]=new mt(e,1,!1,e.toLowerCase(),null,!0,!0)});function Gu(e,t,r,n){var s=st.hasOwnProperty(t)?st[t]:null;(s!==null?s.type!==0:n||!(2o||s[i]!==a[o]){var l=` `+s[i].replace(" at new "," at ");return e.displayName&&l.includes("")&&(l=l.replace("",e.displayName)),l}while(1<=i&&0<=o);break}}}finally{Ol=!1,Error.prepareStackTrace=r}return(e=e?e.displayName||e.name:"")?ya(e):""}function Hx(e){switch(e.tag){case 5:return ya(e.type);case 16:return ya("Lazy");case 13:return ya("Suspense");case 19:return ya("SuspenseList");case 0:case 2:case 15:return e=Al(e.type,!1),e;case 11:return e=Al(e.type.render,!1),e;case 1:return e=Al(e.type,!0),e;default:return""}}function Tc(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case ds:return"Fragment";case us:return"Portal";case Cc:return"Profiler";case Ku:return"StrictMode";case Nc:return"Suspense";case Pc:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Cm:return(e.displayName||"Context")+".Consumer";case jm:return(e._context.displayName||"Context")+".Provider";case Qu:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Yu:return t=e.displayName||null,t!==null?t:Tc(e.type)||"Memo";case Fr:t=e._payload,e=e._init;try{return Tc(e(t))}catch{}}return null}function Wx(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Tc(t);case 8:return t===Ku?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function sn(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Pm(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function qx(e){var t=Pm(e)?"checked":"value",r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),n=""+e[t];if(!e.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var s=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(i){n=""+i,a.call(this,i)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(i){n=""+i},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Ei(e){e._valueTracker||(e._valueTracker=qx(e))}function Tm(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),n="";return e&&(n=Pm(e)?e.checked?"true":"false":e.value),e=n,e!==r?(t.setValue(e),!0):!1}function go(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Rc(e,t){var r=t.checked;return $e({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??e._wrapperState.initialChecked})}function wf(e,t){var r=t.defaultValue==null?"":t.defaultValue,n=t.checked!=null?t.checked:t.defaultChecked;r=sn(t.value!=null?t.value:r),e._wrapperState={initialChecked:n,initialValue:r,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Rm(e,t){t=t.checked,t!=null&&Gu(e,"checked",t,!1)}function Oc(e,t){Rm(e,t);var r=sn(t.value),n=t.type;if(r!=null)n==="number"?(r===0&&e.value===""||e.value!=r)&&(e.value=""+r):e.value!==""+r&&(e.value=""+r);else if(n==="submit"||n==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Ac(e,t.type,r):t.hasOwnProperty("defaultValue")&&Ac(e,t.type,sn(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function bf(e,t,r){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var n=t.type;if(!(n!=="submit"&&n!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,r||t===e.value||(e.value=t),e.defaultValue=t}r=e.name,r!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,r!==""&&(e.name=r)}function Ac(e,t,r){(t!=="number"||go(e.ownerDocument)!==e)&&(r==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+r&&(e.defaultValue=""+r))}var xa=Array.isArray;function Ss(e,t,r,n){if(e=e.options,t){t={};for(var s=0;s"+t.valueOf().toString()+"",t=ki.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function $a(e,t){if(t){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=t;return}}e.textContent=t}var ka={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Gx=["Webkit","ms","Moz","O"];Object.keys(ka).forEach(function(e){Gx.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),ka[t]=ka[e]})});function Im(e,t,r){return t==null||typeof t=="boolean"||t===""?"":r||typeof t!="number"||t===0||ka.hasOwnProperty(e)&&ka[e]?(""+t).trim():t+"px"}function Lm(e,t){e=e.style;for(var r in t)if(t.hasOwnProperty(r)){var n=r.indexOf("--")===0,s=Im(r,t[r],n);r==="float"&&(r="cssFloat"),n?e.setProperty(r,s):e[r]=s}}var Kx=$e({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Lc(e,t){if(t){if(Kx[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(I(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(I(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(I(61))}if(t.style!=null&&typeof t.style!="object")throw Error(I(62))}}function Dc(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var $c=null;function Ju(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Mc=null,Es=null,ks=null;function Ef(e){if(e=ui(e)){if(typeof Mc!="function")throw Error(I(280));var t=e.stateNode;t&&(t=rl(t),Mc(e.stateNode,e.type,t))}}function Dm(e){Es?ks?ks.push(e):ks=[e]:Es=e}function $m(){if(Es){var e=Es,t=ks;if(ks=Es=null,Ef(e),t)for(e=0;e>>=0,e===0?32:31-(aw(e)/iw|0)|0}var ji=64,Ci=4194304;function wa(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function wo(e,t){var r=e.pendingLanes;if(r===0)return 0;var n=0,s=e.suspendedLanes,a=e.pingedLanes,i=r&268435455;if(i!==0){var o=i&~s;o!==0?n=wa(o):(a&=i,a!==0&&(n=wa(a)))}else i=r&~s,i!==0?n=wa(i):a!==0&&(n=wa(a));if(n===0)return 0;if(t!==0&&t!==n&&!(t&s)&&(s=n&-n,a=t&-t,s>=a||s===16&&(a&4194240)!==0))return t;if(n&4&&(n|=r&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=n;0r;r++)t.push(e);return t}function li(e,t,r){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Xt(t),e[t]=r}function uw(e,t){var r=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var n=e.eventTimes;for(e=e.expirationTimes;0=Ca),Af=" ",zf=!1;function sg(e,t){switch(e){case"keyup":return $w.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ag(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var fs=!1;function Fw(e,t){switch(e){case"compositionend":return ag(t);case"keypress":return t.which!==32?null:(zf=!0,Af);case"textInput":return e=t.data,e===Af&&zf?null:e;default:return null}}function Uw(e,t){if(fs)return e==="compositionend"||!ad&&sg(e,t)?(e=rg(),to=rd=qr=null,fs=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:r,offset:t-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=$f(r)}}function cg(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?cg(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function ug(){for(var e=window,t=go();t instanceof e.HTMLIFrameElement;){try{var r=typeof t.contentWindow.location.href=="string"}catch{r=!1}if(r)e=t.contentWindow;else break;t=go(e.document)}return t}function id(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function Yw(e){var t=ug(),r=e.focusedElem,n=e.selectionRange;if(t!==r&&r&&r.ownerDocument&&cg(r.ownerDocument.documentElement,r)){if(n!==null&&id(r)){if(t=n.start,e=n.end,e===void 0&&(e=t),"selectionStart"in r)r.selectionStart=t,r.selectionEnd=Math.min(e,r.value.length);else if(e=(t=r.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var s=r.textContent.length,a=Math.min(n.start,s);n=n.end===void 0?a:Math.min(n.end,s),!e.extend&&a>n&&(s=n,n=a,a=s),s=Mf(r,a);var i=Mf(r,n);s&&i&&(e.rangeCount!==1||e.anchorNode!==s.node||e.anchorOffset!==s.offset||e.focusNode!==i.node||e.focusOffset!==i.offset)&&(t=t.createRange(),t.setStart(s.node,s.offset),e.removeAllRanges(),a>n?(e.addRange(t),e.extend(i.node,i.offset)):(t.setEnd(i.node,i.offset),e.addRange(t)))}}for(t=[],e=r;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r=document.documentMode,hs=null,Wc=null,Pa=null,qc=!1;function Ff(e,t,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;qc||hs==null||hs!==go(n)||(n=hs,"selectionStart"in n&&id(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),Pa&&Ha(Pa,n)||(Pa=n,n=So(Wc,"onSelect"),0gs||(e.current=Xc[gs],Xc[gs]=null,gs--)}function Ce(e,t){gs++,Xc[gs]=e.current,e.current=t}var an={},ut=ln(an),wt=ln(!1),zn=an;function zs(e,t){var r=e.type.contextTypes;if(!r)return an;var n=e.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===t)return n.__reactInternalMemoizedMaskedChildContext;var s={},a;for(a in r)s[a]=t[a];return n&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=s),s}function bt(e){return e=e.childContextTypes,e!=null}function ko(){Re(wt),Re(ut)}function Gf(e,t,r){if(ut.current!==an)throw Error(I(168));Ce(ut,t),Ce(wt,r)}function xg(e,t,r){var n=e.stateNode;if(t=t.childContextTypes,typeof n.getChildContext!="function")return r;n=n.getChildContext();for(var s in n)if(!(s in t))throw Error(I(108,Wx(e)||"Unknown",s));return $e({},r,n)}function jo(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||an,zn=ut.current,Ce(ut,e),Ce(wt,wt.current),!0}function Kf(e,t,r){var n=e.stateNode;if(!n)throw Error(I(169));r?(e=xg(e,t,zn),n.__reactInternalMemoizedMergedChildContext=e,Re(wt),Re(ut),Ce(ut,e)):Re(wt),Ce(wt,r)}var vr=null,nl=!1,Gl=!1;function wg(e){vr===null?vr=[e]:vr.push(e)}function l1(e){nl=!0,wg(e)}function cn(){if(!Gl&&vr!==null){Gl=!0;var e=0,t=xe;try{var r=vr;for(xe=1;e>=i,s-=i,xr=1<<32-Xt(t)+s|r<k?(A=b,b=null):A=b.sibling;var N=h(y,b,w[k],E);if(N===null){b===null&&(b=A);break}e&&b&&N.alternate===null&&t(y,b),g=a(N,g,k),R===null?C=N:R.sibling=N,R=N,b=A}if(k===w.length)return r(y,b),Ae&&xn(y,k),C;if(b===null){for(;kk?(A=b,b=null):A=b.sibling;var z=h(y,b,N.value,E);if(z===null){b===null&&(b=A);break}e&&b&&z.alternate===null&&t(y,b),g=a(z,g,k),R===null?C=z:R.sibling=z,R=z,b=A}if(N.done)return r(y,b),Ae&&xn(y,k),C;if(b===null){for(;!N.done;k++,N=w.next())N=f(y,N.value,E),N!==null&&(g=a(N,g,k),R===null?C=N:R.sibling=N,R=N);return Ae&&xn(y,k),C}for(b=n(y,b);!N.done;k++,N=w.next())N=m(b,y,k,N.value,E),N!==null&&(e&&N.alternate!==null&&b.delete(N.key===null?k:N.key),g=a(N,g,k),R===null?C=N:R.sibling=N,R=N);return e&&b.forEach(function(L){return t(y,L)}),Ae&&xn(y,k),C}function _(y,g,w,E){if(typeof w=="object"&&w!==null&&w.type===ds&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case Si:e:{for(var C=w.key,R=g;R!==null;){if(R.key===C){if(C=w.type,C===ds){if(R.tag===7){r(y,R.sibling),g=s(R,w.props.children),g.return=y,y=g;break e}}else if(R.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===Fr&&Jf(C)===R.type){r(y,R.sibling),g=s(R,w.props),g.ref=oa(y,R,w),g.return=y,y=g;break e}r(y,R);break}else t(y,R);R=R.sibling}w.type===ds?(g=An(w.props.children,y.mode,E,w.key),g.return=y,y=g):(E=co(w.type,w.key,w.props,null,y.mode,E),E.ref=oa(y,g,w),E.return=y,y=E)}return i(y);case us:e:{for(R=w.key;g!==null;){if(g.key===R)if(g.tag===4&&g.stateNode.containerInfo===w.containerInfo&&g.stateNode.implementation===w.implementation){r(y,g.sibling),g=s(g,w.children||[]),g.return=y,y=g;break e}else{r(y,g);break}else t(y,g);g=g.sibling}g=tc(w,y.mode,E),g.return=y,y=g}return i(y);case Fr:return R=w._init,_(y,g,R(w._payload),E)}if(xa(w))return x(y,g,w,E);if(ra(w))return v(y,g,w,E);zi(y,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,g!==null&&g.tag===6?(r(y,g.sibling),g=s(g,w),g.return=y,y=g):(r(y,g),g=ec(w,y.mode,E),g.return=y,y=g),i(y)):r(y,g)}return _}var Ls=Eg(!0),kg=Eg(!1),Po=ln(null),To=null,xs=null,ud=null;function dd(){ud=xs=To=null}function fd(e){var t=Po.current;Re(Po),e._currentValue=t}function tu(e,t,r){for(;e!==null;){var n=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,n!==null&&(n.childLanes|=t)):n!==null&&(n.childLanes&t)!==t&&(n.childLanes|=t),e===r)break;e=e.return}}function Cs(e,t){To=e,ud=xs=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(xt=!0),e.firstContext=null)}function Ut(e){var t=e._currentValue;if(ud!==e)if(e={context:e,memoizedValue:t,next:null},xs===null){if(To===null)throw Error(I(308));xs=e,To.dependencies={lanes:0,firstContext:e}}else xs=xs.next=e;return t}var Cn=null;function hd(e){Cn===null?Cn=[e]:Cn.push(e)}function jg(e,t,r,n){var s=t.interleaved;return s===null?(r.next=r,hd(t)):(r.next=s.next,s.next=r),t.interleaved=r,kr(e,n)}function kr(e,t){e.lanes|=t;var r=e.alternate;for(r!==null&&(r.lanes|=t),r=e,e=e.return;e!==null;)e.childLanes|=t,r=e.alternate,r!==null&&(r.childLanes|=t),r=e,e=e.return;return r.tag===3?r.stateNode:null}var Ur=!1;function pd(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Cg(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function br(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Zr(e,t,r){var n=e.updateQueue;if(n===null)return null;if(n=n.shared,de&2){var s=n.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),n.pending=t,kr(e,r)}return s=n.interleaved,s===null?(t.next=t,hd(n)):(t.next=s.next,s.next=t),n.interleaved=t,kr(e,r)}function no(e,t,r){if(t=t.updateQueue,t!==null&&(t=t.shared,(r&4194240)!==0)){var n=t.lanes;n&=e.pendingLanes,r|=n,t.lanes=r,Zu(e,r)}}function Xf(e,t){var r=e.updateQueue,n=e.alternate;if(n!==null&&(n=n.updateQueue,r===n)){var s=null,a=null;if(r=r.firstBaseUpdate,r!==null){do{var i={eventTime:r.eventTime,lane:r.lane,tag:r.tag,payload:r.payload,callback:r.callback,next:null};a===null?s=a=i:a=a.next=i,r=r.next}while(r!==null);a===null?s=a=t:a=a.next=t}else s=a=t;r={baseState:n.baseState,firstBaseUpdate:s,lastBaseUpdate:a,shared:n.shared,effects:n.effects},e.updateQueue=r;return}e=r.lastBaseUpdate,e===null?r.firstBaseUpdate=t:e.next=t,r.lastBaseUpdate=t}function Ro(e,t,r,n){var s=e.updateQueue;Ur=!1;var a=s.firstBaseUpdate,i=s.lastBaseUpdate,o=s.shared.pending;if(o!==null){s.shared.pending=null;var l=o,u=l.next;l.next=null,i===null?a=u:i.next=u,i=l;var d=e.alternate;d!==null&&(d=d.updateQueue,o=d.lastBaseUpdate,o!==i&&(o===null?d.firstBaseUpdate=u:o.next=u,d.lastBaseUpdate=l))}if(a!==null){var f=s.baseState;i=0,d=u=l=null,o=a;do{var h=o.lane,m=o.eventTime;if((n&h)===h){d!==null&&(d=d.next={eventTime:m,lane:0,tag:o.tag,payload:o.payload,callback:o.callback,next:null});e:{var x=e,v=o;switch(h=t,m=r,v.tag){case 1:if(x=v.payload,typeof x=="function"){f=x.call(m,f,h);break e}f=x;break e;case 3:x.flags=x.flags&-65537|128;case 0:if(x=v.payload,h=typeof x=="function"?x.call(m,f,h):x,h==null)break e;f=$e({},f,h);break e;case 2:Ur=!0}}o.callback!==null&&o.lane!==0&&(e.flags|=64,h=s.effects,h===null?s.effects=[o]:h.push(o))}else m={eventTime:m,lane:h,tag:o.tag,payload:o.payload,callback:o.callback,next:null},d===null?(u=d=m,l=f):d=d.next=m,i|=h;if(o=o.next,o===null){if(o=s.shared.pending,o===null)break;h=o,o=h.next,h.next=null,s.lastBaseUpdate=h,s.shared.pending=null}}while(!0);if(d===null&&(l=f),s.baseState=l,s.firstBaseUpdate=u,s.lastBaseUpdate=d,t=s.shared.interleaved,t!==null){s=t;do i|=s.lane,s=s.next;while(s!==t)}else a===null&&(s.shared.lanes=0);Dn|=i,e.lanes=i,e.memoizedState=f}}function Zf(e,t,r){if(e=t.effects,t.effects=null,e!==null)for(t=0;tr?r:4,e(!0);var n=Ql.transition;Ql.transition={};try{e(!1),t()}finally{xe=r,Ql.transition=n}}function Hg(){return Bt().memoizedState}function f1(e,t,r){var n=tn(e);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},Wg(e))qg(t,r);else if(r=jg(e,t,r,n),r!==null){var s=ht();Zt(r,e,n,s),Gg(r,t,n)}}function h1(e,t,r){var n=tn(e),s={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(Wg(e))qg(t,s);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var i=t.lastRenderedState,o=a(i,r);if(s.hasEagerState=!0,s.eagerState=o,tr(o,i)){var l=t.interleaved;l===null?(s.next=s,hd(t)):(s.next=l.next,l.next=s),t.interleaved=s;return}}catch{}finally{}r=jg(e,t,s,n),r!==null&&(s=ht(),Zt(r,e,n,s),Gg(r,t,n))}}function Wg(e){var t=e.alternate;return e===De||t!==null&&t===De}function qg(e,t){Ta=Ao=!0;var r=e.pending;r===null?t.next=t:(t.next=r.next,r.next=t),e.pending=t}function Gg(e,t,r){if(r&4194240){var n=t.lanes;n&=e.pendingLanes,r|=n,t.lanes=r,Zu(e,r)}}var zo={readContext:Ut,useCallback:at,useContext:at,useEffect:at,useImperativeHandle:at,useInsertionEffect:at,useLayoutEffect:at,useMemo:at,useReducer:at,useRef:at,useState:at,useDebugValue:at,useDeferredValue:at,useTransition:at,useMutableSource:at,useSyncExternalStore:at,useId:at,unstable_isNewReconciler:!1},p1={readContext:Ut,useCallback:function(e,t){return ar().memoizedState=[e,t===void 0?null:t],e},useContext:Ut,useEffect:th,useImperativeHandle:function(e,t,r){return r=r!=null?r.concat([e]):null,ao(4194308,4,Mg.bind(null,t,e),r)},useLayoutEffect:function(e,t){return ao(4194308,4,e,t)},useInsertionEffect:function(e,t){return ao(4,2,e,t)},useMemo:function(e,t){var r=ar();return t=t===void 0?null:t,e=e(),r.memoizedState=[e,t],e},useReducer:function(e,t,r){var n=ar();return t=r!==void 0?r(t):t,n.memoizedState=n.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},n.queue=e,e=e.dispatch=f1.bind(null,De,e),[n.memoizedState,e]},useRef:function(e){var t=ar();return e={current:e},t.memoizedState=e},useState:eh,useDebugValue:_d,useDeferredValue:function(e){return ar().memoizedState=e},useTransition:function(){var e=eh(!1),t=e[0];return e=d1.bind(null,e[1]),ar().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,r){var n=De,s=ar();if(Ae){if(r===void 0)throw Error(I(407));r=r()}else{if(r=t(),et===null)throw Error(I(349));Ln&30||Rg(n,t,r)}s.memoizedState=r;var a={value:r,getSnapshot:t};return s.queue=a,th(Ag.bind(null,n,a,e),[e]),n.flags|=2048,Xa(9,Og.bind(null,n,a,r,t),void 0,null),r},useId:function(){var e=ar(),t=et.identifierPrefix;if(Ae){var r=wr,n=xr;r=(n&~(1<<32-Xt(n)-1)).toString(32)+r,t=":"+t+"R"+r,r=Ya++,0<\/script>",e=e.removeChild(e.firstChild)):typeof n.is=="string"?e=i.createElement(r,{is:n.is}):(e=i.createElement(r),r==="select"&&(i=e,n.multiple?i.multiple=!0:n.size&&(i.size=n.size))):e=i.createElementNS(e,r),e[ir]=t,e[Ga]=n,nv(e,t,!1,!1),t.stateNode=e;e:{switch(i=Dc(r,n),r){case"dialog":Pe("cancel",e),Pe("close",e),s=n;break;case"iframe":case"object":case"embed":Pe("load",e),s=n;break;case"video":case"audio":for(s=0;sMs&&(t.flags|=128,n=!0,la(a,!1),t.lanes=4194304)}else{if(!n)if(e=Oo(i),e!==null){if(t.flags|=128,n=!0,r=e.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),la(a,!0),a.tail===null&&a.tailMode==="hidden"&&!i.alternate&&!Ae)return it(t),null}else 2*Ve()-a.renderingStartTime>Ms&&r!==1073741824&&(t.flags|=128,n=!0,la(a,!1),t.lanes=4194304);a.isBackwards?(i.sibling=t.child,t.child=i):(r=a.last,r!==null?r.sibling=i:t.child=i,a.last=i)}return a.tail!==null?(t=a.tail,a.rendering=t,a.tail=t.sibling,a.renderingStartTime=Ve(),t.sibling=null,r=Le.current,Ce(Le,n?r&1|2:r&1),t):(it(t),null);case 22:case 23:return Nd(),n=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==n&&(t.flags|=8192),n&&t.mode&1?kt&1073741824&&(it(t),t.subtreeFlags&6&&(t.flags|=8192)):it(t),null;case 24:return null;case 25:return null}throw Error(I(156,t.tag))}function _1(e,t){switch(ld(t),t.tag){case 1:return bt(t.type)&&ko(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ds(),Re(wt),Re(ut),vd(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return gd(t),null;case 13:if(Re(Le),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(I(340));Is()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Re(Le),null;case 4:return Ds(),null;case 10:return fd(t.type._context),null;case 22:case 23:return Nd(),null;case 24:return null;default:return null}}var Li=!1,ct=!1,S1=typeof WeakSet=="function"?WeakSet:Set,M=null;function ws(e,t){var r=e.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){Ue(e,t,n)}else r.current=null}function uu(e,t,r){try{r()}catch(n){Ue(e,t,n)}}var fh=!1;function E1(e,t){if(Gc=bo,e=ug(),id(e)){if("selectionStart"in e)var r={start:e.selectionStart,end:e.selectionEnd};else e:{r=(r=e.ownerDocument)&&r.defaultView||window;var n=r.getSelection&&r.getSelection();if(n&&n.rangeCount!==0){r=n.anchorNode;var s=n.anchorOffset,a=n.focusNode;n=n.focusOffset;try{r.nodeType,a.nodeType}catch{r=null;break e}var i=0,o=-1,l=-1,u=0,d=0,f=e,h=null;t:for(;;){for(var m;f!==r||s!==0&&f.nodeType!==3||(o=i+s),f!==a||n!==0&&f.nodeType!==3||(l=i+n),f.nodeType===3&&(i+=f.nodeValue.length),(m=f.firstChild)!==null;)h=f,f=m;for(;;){if(f===e)break t;if(h===r&&++u===s&&(o=i),h===a&&++d===n&&(l=i),(m=f.nextSibling)!==null)break;f=h,h=f.parentNode}f=m}r=o===-1||l===-1?null:{start:o,end:l}}else r=null}r=r||{start:0,end:0}}else r=null;for(Kc={focusedElem:e,selectionRange:r},bo=!1,M=t;M!==null;)if(t=M,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,M=e;else for(;M!==null;){t=M;try{var x=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(x!==null){var v=x.memoizedProps,_=x.memoizedState,y=t.stateNode,g=y.getSnapshotBeforeUpdate(t.elementType===t.type?v:qt(t.type,v),_);y.__reactInternalSnapshotBeforeUpdate=g}break;case 3:var w=t.stateNode.containerInfo;w.nodeType===1?w.textContent="":w.nodeType===9&&w.documentElement&&w.removeChild(w.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(I(163))}}catch(E){Ue(t,t.return,E)}if(e=t.sibling,e!==null){e.return=t.return,M=e;break}M=t.return}return x=fh,fh=!1,x}function Ra(e,t,r){var n=t.updateQueue;if(n=n!==null?n.lastEffect:null,n!==null){var s=n=n.next;do{if((s.tag&e)===e){var a=s.destroy;s.destroy=void 0,a!==void 0&&uu(t,r,a)}s=s.next}while(s!==n)}}function il(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var r=t=t.next;do{if((r.tag&e)===e){var n=r.create;r.destroy=n()}r=r.next}while(r!==t)}}function du(e){var t=e.ref;if(t!==null){var r=e.stateNode;switch(e.tag){case 5:e=r;break;default:e=r}typeof t=="function"?t(e):t.current=e}}function iv(e){var t=e.alternate;t!==null&&(e.alternate=null,iv(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[ir],delete t[Ga],delete t[Jc],delete t[i1],delete t[o1])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function ov(e){return e.tag===5||e.tag===3||e.tag===4}function hh(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||ov(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function fu(e,t,r){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?r.nodeType===8?r.parentNode.insertBefore(e,t):r.insertBefore(e,t):(r.nodeType===8?(t=r.parentNode,t.insertBefore(e,r)):(t=r,t.appendChild(e)),r=r._reactRootContainer,r!=null||t.onclick!==null||(t.onclick=Eo));else if(n!==4&&(e=e.child,e!==null))for(fu(e,t,r),e=e.sibling;e!==null;)fu(e,t,r),e=e.sibling}function hu(e,t,r){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?r.insertBefore(e,t):r.appendChild(e);else if(n!==4&&(e=e.child,e!==null))for(hu(e,t,r),e=e.sibling;e!==null;)hu(e,t,r),e=e.sibling}var rt=null,Gt=!1;function Or(e,t,r){for(r=r.child;r!==null;)lv(e,t,r),r=r.sibling}function lv(e,t,r){if(lr&&typeof lr.onCommitFiberUnmount=="function")try{lr.onCommitFiberUnmount(Xo,r)}catch{}switch(r.tag){case 5:ct||ws(r,t);case 6:var n=rt,s=Gt;rt=null,Or(e,t,r),rt=n,Gt=s,rt!==null&&(Gt?(e=rt,r=r.stateNode,e.nodeType===8?e.parentNode.removeChild(r):e.removeChild(r)):rt.removeChild(r.stateNode));break;case 18:rt!==null&&(Gt?(e=rt,r=r.stateNode,e.nodeType===8?ql(e.parentNode,r):e.nodeType===1&&ql(e,r),Ba(e)):ql(rt,r.stateNode));break;case 4:n=rt,s=Gt,rt=r.stateNode.containerInfo,Gt=!0,Or(e,t,r),rt=n,Gt=s;break;case 0:case 11:case 14:case 15:if(!ct&&(n=r.updateQueue,n!==null&&(n=n.lastEffect,n!==null))){s=n=n.next;do{var a=s,i=a.destroy;a=a.tag,i!==void 0&&(a&2||a&4)&&uu(r,t,i),s=s.next}while(s!==n)}Or(e,t,r);break;case 1:if(!ct&&(ws(r,t),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(o){Ue(r,t,o)}Or(e,t,r);break;case 21:Or(e,t,r);break;case 22:r.mode&1?(ct=(n=ct)||r.memoizedState!==null,Or(e,t,r),ct=n):Or(e,t,r);break;default:Or(e,t,r)}}function ph(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var r=e.stateNode;r===null&&(r=e.stateNode=new S1),t.forEach(function(n){var s=A1.bind(null,e,n);r.has(n)||(r.add(n),n.then(s,s))})}}function Vt(e,t){var r=t.deletions;if(r!==null)for(var n=0;ns&&(s=i),n&=~a}if(n=s,n=Ve()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*j1(n/1960))-n,10e?16:e,Gr===null)var n=!1;else{if(e=Gr,Gr=null,Do=0,de&6)throw Error(I(331));var s=de;for(de|=4,M=e.current;M!==null;){var a=M,i=a.child;if(M.flags&16){var o=a.deletions;if(o!==null){for(var l=0;lVe()-jd?On(e,0):kd|=r),_t(e,t)}function gv(e,t){t===0&&(e.mode&1?(t=Ci,Ci<<=1,!(Ci&130023424)&&(Ci=4194304)):t=1);var r=ht();e=kr(e,t),e!==null&&(li(e,t,r),_t(e,r))}function O1(e){var t=e.memoizedState,r=0;t!==null&&(r=t.retryLane),gv(e,r)}function A1(e,t){var r=0;switch(e.tag){case 13:var n=e.stateNode,s=e.memoizedState;s!==null&&(r=s.retryLane);break;case 19:n=e.stateNode;break;default:throw Error(I(314))}n!==null&&n.delete(t),gv(e,r)}var vv;vv=function(e,t,r){if(e!==null)if(e.memoizedProps!==t.pendingProps||wt.current)xt=!0;else{if(!(e.lanes&r)&&!(t.flags&128))return xt=!1,w1(e,t,r);xt=!!(e.flags&131072)}else xt=!1,Ae&&t.flags&1048576&&bg(t,No,t.index);switch(t.lanes=0,t.tag){case 2:var n=t.type;io(e,t),e=t.pendingProps;var s=zs(t,ut.current);Cs(t,r),s=xd(null,t,n,e,s,r);var a=wd();return t.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,bt(n)?(a=!0,jo(t)):a=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,pd(t),s.updater=al,t.stateNode=s,s._reactInternals=t,nu(t,n,e,r),t=iu(null,t,n,!0,a,r)):(t.tag=0,Ae&&a&&od(t),ft(null,t,s,r),t=t.child),t;case 16:n=t.elementType;e:{switch(io(e,t),e=t.pendingProps,s=n._init,n=s(n._payload),t.type=n,s=t.tag=I1(n),e=qt(n,e),s){case 0:t=au(null,t,n,e,r);break e;case 1:t=ch(null,t,n,e,r);break e;case 11:t=oh(null,t,n,e,r);break e;case 14:t=lh(null,t,n,qt(n.type,e),r);break e}throw Error(I(306,n,""))}return t;case 0:return n=t.type,s=t.pendingProps,s=t.elementType===n?s:qt(n,s),au(e,t,n,s,r);case 1:return n=t.type,s=t.pendingProps,s=t.elementType===n?s:qt(n,s),ch(e,t,n,s,r);case 3:e:{if(ev(t),e===null)throw Error(I(387));n=t.pendingProps,a=t.memoizedState,s=a.element,Cg(e,t),Ro(t,n,null,r);var i=t.memoizedState;if(n=i.element,a.isDehydrated)if(a={element:n,isDehydrated:!1,cache:i.cache,pendingSuspenseBoundaries:i.pendingSuspenseBoundaries,transitions:i.transitions},t.updateQueue.baseState=a,t.memoizedState=a,t.flags&256){s=$s(Error(I(423)),t),t=uh(e,t,n,r,s);break e}else if(n!==s){s=$s(Error(I(424)),t),t=uh(e,t,n,r,s);break e}else for(Ct=Xr(t.stateNode.containerInfo.firstChild),Nt=t,Ae=!0,Yt=null,r=kg(t,null,n,r),t.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(Is(),n===s){t=jr(e,t,r);break e}ft(e,t,n,r)}t=t.child}return t;case 5:return Ng(t),e===null&&eu(t),n=t.type,s=t.pendingProps,a=e!==null?e.memoizedProps:null,i=s.children,Qc(n,s)?i=null:a!==null&&Qc(n,a)&&(t.flags|=32),Zg(e,t),ft(e,t,i,r),t.child;case 6:return e===null&&eu(t),null;case 13:return tv(e,t,r);case 4:return md(t,t.stateNode.containerInfo),n=t.pendingProps,e===null?t.child=Ls(t,null,n,r):ft(e,t,n,r),t.child;case 11:return n=t.type,s=t.pendingProps,s=t.elementType===n?s:qt(n,s),oh(e,t,n,s,r);case 7:return ft(e,t,t.pendingProps,r),t.child;case 8:return ft(e,t,t.pendingProps.children,r),t.child;case 12:return ft(e,t,t.pendingProps.children,r),t.child;case 10:e:{if(n=t.type._context,s=t.pendingProps,a=t.memoizedProps,i=s.value,Ce(Po,n._currentValue),n._currentValue=i,a!==null)if(tr(a.value,i)){if(a.children===s.children&&!wt.current){t=jr(e,t,r);break e}}else for(a=t.child,a!==null&&(a.return=t);a!==null;){var o=a.dependencies;if(o!==null){i=a.child;for(var l=o.firstContext;l!==null;){if(l.context===n){if(a.tag===1){l=br(-1,r&-r),l.tag=2;var u=a.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?l.next=l:(l.next=d.next,d.next=l),u.pending=l}}a.lanes|=r,l=a.alternate,l!==null&&(l.lanes|=r),tu(a.return,r,t),o.lanes|=r;break}l=l.next}}else if(a.tag===10)i=a.type===t.type?null:a.child;else if(a.tag===18){if(i=a.return,i===null)throw Error(I(341));i.lanes|=r,o=i.alternate,o!==null&&(o.lanes|=r),tu(i,r,t),i=a.sibling}else i=a.child;if(i!==null)i.return=a;else for(i=a;i!==null;){if(i===t){i=null;break}if(a=i.sibling,a!==null){a.return=i.return,i=a;break}i=i.return}a=i}ft(e,t,s.children,r),t=t.child}return t;case 9:return s=t.type,n=t.pendingProps.children,Cs(t,r),s=Ut(s),n=n(s),t.flags|=1,ft(e,t,n,r),t.child;case 14:return n=t.type,s=qt(n,t.pendingProps),s=qt(n.type,s),lh(e,t,n,s,r);case 15:return Jg(e,t,t.type,t.pendingProps,r);case 17:return n=t.type,s=t.pendingProps,s=t.elementType===n?s:qt(n,s),io(e,t),t.tag=1,bt(n)?(e=!0,jo(t)):e=!1,Cs(t,r),Kg(t,n,s),nu(t,n,s,r),iu(null,t,n,!0,e,r);case 19:return rv(e,t,r);case 22:return Xg(e,t,r)}throw Error(I(156,t.tag))};function yv(e,t){return Wm(e,t)}function z1(e,t,r,n){this.tag=e,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function $t(e,t,r,n){return new z1(e,t,r,n)}function Td(e){return e=e.prototype,!(!e||!e.isReactComponent)}function I1(e){if(typeof e=="function")return Td(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Qu)return 11;if(e===Yu)return 14}return 2}function rn(e,t){var r=e.alternate;return r===null?(r=$t(e.tag,t,e.key,e.mode),r.elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=t,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=e.flags&14680064,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,t=e.dependencies,r.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r}function co(e,t,r,n,s,a){var i=2;if(n=e,typeof e=="function")Td(e)&&(i=1);else if(typeof e=="string")i=5;else e:switch(e){case ds:return An(r.children,s,a,t);case Ku:i=8,s|=8;break;case Cc:return e=$t(12,r,t,s|2),e.elementType=Cc,e.lanes=a,e;case Nc:return e=$t(13,r,t,s),e.elementType=Nc,e.lanes=a,e;case Pc:return e=$t(19,r,t,s),e.elementType=Pc,e.lanes=a,e;case Nm:return ll(r,s,a,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case jm:i=10;break e;case Cm:i=9;break e;case Qu:i=11;break e;case Yu:i=14;break e;case Fr:i=16,n=null;break e}throw Error(I(130,e==null?e:typeof e,""))}return t=$t(i,r,t,s),t.elementType=e,t.type=n,t.lanes=a,t}function An(e,t,r,n){return e=$t(7,e,n,t),e.lanes=r,e}function ll(e,t,r,n){return e=$t(22,e,n,t),e.elementType=Nm,e.lanes=r,e.stateNode={isHidden:!1},e}function ec(e,t,r){return e=$t(6,e,null,t),e.lanes=r,e}function tc(e,t,r){return t=$t(4,e.children!==null?e.children:[],e.key,t),t.lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function L1(e,t,r,n,s){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Il(0),this.expirationTimes=Il(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Il(0),this.identifierPrefix=n,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function Rd(e,t,r,n,s,a,i,o,l){return e=new L1(e,t,r,o,l),t===1?(t=1,a===!0&&(t|=8)):t=0,a=$t(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},pd(a),e}function D1(e,t,r){var n=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(_v)}catch(e){console.error(e)}}_v(),_m.exports=Tt;var Hs=_m.exports;const Sv=ii(Hs),B1=um({__proto__:null,default:Sv},[Hs]);var Ev,_h=Hs;Ev=_h.createRoot,_h.hydrateRoot;/** * @remix-run/router v1.23.1 * * Copyright (c) Remix Software Inc. * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */function Oe(){return Oe=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u")throw new Error(t)}function Mn(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function H1(){return Math.random().toString(36).substr(2,8)}function Eh(e,t){return{usr:e.state,key:e.key,idx:t}}function ei(e,t,r,n){return r===void 0&&(r=null),Oe({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?un(t):t,{state:r,key:t&&t.key||n||H1()})}function Fn(e){let{pathname:t="/",search:r="",hash:n=""}=e;return r&&r!=="?"&&(t+=r.charAt(0)==="?"?r:"?"+r),n&&n!=="#"&&(t+=n.charAt(0)==="#"?n:"#"+n),t}function un(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substr(r),e=e.substr(0,r));let n=e.indexOf("?");n>=0&&(t.search=e.substr(n),e=e.substr(0,n)),e&&(t.pathname=e)}return t}function W1(e,t,r,n){n===void 0&&(n={});let{window:s=document.defaultView,v5Compat:a=!1}=n,i=s.history,o=qe.Pop,l=null,u=d();u==null&&(u=0,i.replaceState(Oe({},i.state,{idx:u}),""));function d(){return(i.state||{idx:null}).idx}function f(){o=qe.Pop;let _=d(),y=_==null?null:_-u;u=_,l&&l({action:o,location:v.location,delta:y})}function h(_,y){o=qe.Push;let g=ei(v.location,_,y);u=d()+1;let w=Eh(g,u),E=v.createHref(g);try{i.pushState(w,"",E)}catch(C){if(C instanceof DOMException&&C.name==="DataCloneError")throw C;s.location.assign(E)}a&&l&&l({action:o,location:v.location,delta:1})}function m(_,y){o=qe.Replace;let g=ei(v.location,_,y);u=d();let w=Eh(g,u),E=v.createHref(g);i.replaceState(w,"",E),a&&l&&l({action:o,location:v.location,delta:0})}function x(_){let y=s.location.origin!=="null"?s.location.origin:s.location.href,g=typeof _=="string"?_:Fn(_);return g=g.replace(/ $/,"%20"),ae(y,"No window.location.(origin|href) available to create URL for href: "+g),new URL(g,y)}let v={get action(){return o},get location(){return e(s,i)},listen(_){if(l)throw new Error("A history only accepts one active listener");return s.addEventListener(Sh,f),l=_,()=>{s.removeEventListener(Sh,f),l=null}},createHref(_){return t(s,_)},createURL:x,encodeLocation(_){let y=x(_);return{pathname:y.pathname,search:y.search,hash:y.hash}},push:h,replace:m,go(_){return i.go(_)}};return v}var ve;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(ve||(ve={}));const q1=new Set(["lazy","caseSensitive","path","id","index","children"]);function G1(e){return e.index===!0}function Fo(e,t,r,n){return r===void 0&&(r=[]),n===void 0&&(n={}),e.map((s,a)=>{let i=[...r,String(a)],o=typeof s.id=="string"?s.id:i.join("-");if(ae(s.index!==!0||!s.children,"Cannot specify children on an index route"),ae(!n[o],'Found a route id collision on id "'+o+`". Route id's must be globally unique within Data Router usages`),G1(s)){let l=Oe({},s,t(s),{id:o});return n[o]=l,l}else{let l=Oe({},s,t(s),{id:o,children:void 0});return n[o]=l,s.children&&(l.children=Fo(s.children,t,i,n)),l}})}function Sn(e,t,r){return r===void 0&&(r="/"),uo(e,t,r,!1)}function uo(e,t,r,n){let s=typeof t=="string"?un(t):t,a=Ws(s.pathname||"/",r);if(a==null)return null;let i=kv(e);Q1(i);let o=null;for(let l=0;o==null&&l{let l={relativePath:o===void 0?a.path||"":o,caseSensitive:a.caseSensitive===!0,childrenIndex:i,route:a};l.relativePath.startsWith("/")&&(ae(l.relativePath.startsWith(n),'Absolute route path "'+l.relativePath+'" nested under path '+('"'+n+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),l.relativePath=l.relativePath.slice(n.length));let u=_r([n,l.relativePath]),d=r.concat(l);a.children&&a.children.length>0&&(ae(a.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),kv(a.children,t,d,u)),!(a.path==null&&!a.index)&&t.push({path:u,score:rb(u,a.index),routesMeta:d})};return e.forEach((a,i)=>{var o;if(a.path===""||!((o=a.path)!=null&&o.includes("?")))s(a,i);else for(let l of jv(a.path))s(a,i,l)}),t}function jv(e){let t=e.split("/");if(t.length===0)return[];let[r,...n]=t,s=r.endsWith("?"),a=r.replace(/\?$/,"");if(n.length===0)return s?[a,""]:[a];let i=jv(n.join("/")),o=[];return o.push(...i.map(l=>l===""?a:[a,l].join("/"))),s&&o.push(...i),o.map(l=>e.startsWith("/")&&l===""?"/":l)}function Q1(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:nb(t.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}const Y1=/^:[\w-]+$/,J1=3,X1=2,Z1=1,eb=10,tb=-2,kh=e=>e==="*";function rb(e,t){let r=e.split("/"),n=r.length;return r.some(kh)&&(n+=tb),t&&(n+=X1),r.filter(s=>!kh(s)).reduce((s,a)=>s+(Y1.test(a)?J1:a===""?Z1:eb),n)}function nb(e,t){return e.length===t.length&&e.slice(0,-1).every((n,s)=>n===t[s])?e[e.length-1]-t[t.length-1]:0}function sb(e,t,r){r===void 0&&(r=!1);let{routesMeta:n}=e,s={},a="/",i=[];for(let o=0;o{let{paramName:h,isOptional:m}=d;if(h==="*"){let v=o[f]||"";i=a.slice(0,a.length-v.length).replace(/(.)\/+$/,"$1")}const x=o[f];return m&&!x?u[h]=void 0:u[h]=(x||"").replace(/%2F/g,"/"),u},{}),pathname:a,pathnameBase:i,pattern:e}}function ab(e,t,r){t===void 0&&(t=!1),r===void 0&&(r=!0),Mn(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let n=[],s="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(i,o,l)=>(n.push({paramName:o,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(n.push({paramName:"*"}),s+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?s+="\\/*$":e!==""&&e!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,t?void 0:"i"),n]}function ib(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Mn(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function Ws(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,n=e.charAt(r);return n&&n!=="/"?null:e.slice(r)||"/"}const ob=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,lb=e=>ob.test(e);function cb(e,t){t===void 0&&(t="/");let{pathname:r,search:n="",hash:s=""}=typeof e=="string"?un(e):e,a;if(r)if(lb(r))a=r;else{if(r.includes("//")){let i=r;r=r.replace(/\/\/+/g,"/"),Mn(!1,"Pathnames cannot have embedded double slashes - normalizing "+(i+" -> "+r))}r.startsWith("/")?a=Ch(r.substring(1),"/"):a=Ch(r,t)}else a=t;return{pathname:a,search:db(n),hash:fb(s)}}function Ch(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(s=>{s===".."?r.length>1&&r.pop():s!=="."&&r.push(s)}),r.length>1?r.join("/"):"/"}function rc(e,t,r,n){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(n)+"]. Please separate it out to the ")+("`to."+r+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function Cv(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function hl(e,t){let r=Cv(e);return t?r.map((n,s)=>s===r.length-1?n.pathname:n.pathnameBase):r.map(n=>n.pathnameBase)}function pl(e,t,r,n){n===void 0&&(n=!1);let s;typeof e=="string"?s=un(e):(s=Oe({},e),ae(!s.pathname||!s.pathname.includes("?"),rc("?","pathname","search",s)),ae(!s.pathname||!s.pathname.includes("#"),rc("#","pathname","hash",s)),ae(!s.search||!s.search.includes("#"),rc("#","search","hash",s)));let a=e===""||s.pathname==="",i=a?"/":s.pathname,o;if(i==null)o=r;else{let f=t.length-1;if(!n&&i.startsWith("..")){let h=i.split("/");for(;h[0]==="..";)h.shift(),f-=1;s.pathname=h.join("/")}o=f>=0?t[f]:"/"}let l=cb(s,o),u=i&&i!=="/"&&i.endsWith("/"),d=(a||i===".")&&r.endsWith("/");return!l.pathname.endsWith("/")&&(u||d)&&(l.pathname+="/"),l}const _r=e=>e.join("/").replace(/\/\/+/g,"/"),ub=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),db=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,fb=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;class Uo{constructor(t,r,n,s){s===void 0&&(s=!1),this.status=t,this.statusText=r||"",this.internal=s,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}}function ti(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const Nv=["post","put","patch","delete"],hb=new Set(Nv),pb=["get",...Nv],mb=new Set(pb),gb=new Set([301,302,303,307,308]),vb=new Set([307,308]),nc={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},yb={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},ua={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},Id=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,xb=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),Pv="remix-router-transitions";function wb(e){const t=e.window?e.window:typeof window<"u"?window:void 0,r=typeof t<"u"&&typeof t.document<"u"&&typeof t.document.createElement<"u",n=!r;ae(e.routes.length>0,"You must provide a non-empty routes array to createRouter");let s;if(e.mapRouteProperties)s=e.mapRouteProperties;else if(e.detectErrorBoundary){let S=e.detectErrorBoundary;s=j=>({hasErrorBoundary:S(j)})}else s=xb;let a={},i=Fo(e.routes,s,void 0,a),o,l=e.basename||"/",u=e.dataStrategy||Eb,d=e.patchRoutesOnNavigation,f=Oe({v7_fetcherPersist:!1,v7_normalizeFormMethod:!1,v7_partialHydration:!1,v7_prependBasename:!1,v7_relativeSplatPath:!1,v7_skipActionErrorRevalidation:!1},e.future),h=null,m=new Set,x=null,v=null,_=null,y=e.hydrationData!=null,g=Sn(i,e.history.location,l),w=!1,E=null;if(g==null&&!d){let S=vt(404,{pathname:e.history.location.pathname}),{matches:j,route:T}=$h(i);g=j,E={[T.id]:S}}g&&!e.hydrationData&&yi(g,i,e.history.location.pathname).active&&(g=null);let C;if(g)if(g.some(S=>S.route.lazy))C=!1;else if(!g.some(S=>S.route.loader))C=!0;else if(f.v7_partialHydration){let S=e.hydrationData?e.hydrationData.loaderData:null,j=e.hydrationData?e.hydrationData.errors:null;if(j){let T=g.findIndex(O=>j[O.route.id]!==void 0);C=g.slice(0,T+1).every(O=>!xu(O.route,S,j))}else C=g.every(T=>!xu(T.route,S,j))}else C=e.hydrationData!=null;else if(C=!1,g=[],f.v7_partialHydration){let S=yi(null,i,e.history.location.pathname);S.active&&S.matches&&(w=!0,g=S.matches)}let R,b={historyAction:e.history.action,location:e.history.location,matches:g,initialized:C,navigation:nc,restoreScrollPosition:e.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||E,fetchers:new Map,blockers:new Map},k=qe.Pop,A=!1,N,z=!1,L=new Map,G=null,$=!1,ee=!1,J=[],ge=new Set,P=new Map,H=0,W=-1,te=new Map,re=new Set,ue=new Map,fe=new Map,Ne=new Set,_e=new Map,Q=new Map,pe;function Qe(){if(h=e.history.listen(S=>{let{action:j,location:T,delta:O}=S;if(pe){pe(),pe=void 0;return}Mn(Q.size===0||O!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let D=uf({currentLocation:b.location,nextLocation:T,historyAction:j});if(D&&O!=null){let Y=new Promise(X=>{pe=X});e.history.go(O*-1),vi(D,{state:"blocked",location:T,proceed(){vi(D,{state:"proceeding",proceed:void 0,reset:void 0,location:T}),Y.then(()=>e.history.go(O))},reset(){let X=new Map(b.blockers);X.set(D,ua),ze({blockers:X})}});return}return fn(j,T)}),r){$b(t,L);let S=()=>Mb(t,L);t.addEventListener("pagehide",S),G=()=>t.removeEventListener("pagehide",S)}return b.initialized||fn(qe.Pop,b.location,{initialHydration:!0}),R}function dt(){h&&h(),G&&G(),m.clear(),N&&N.abort(),b.fetchers.forEach((S,j)=>gi(j)),b.blockers.forEach((S,j)=>cf(j))}function St(S){return m.add(S),()=>m.delete(S)}function ze(S,j){j===void 0&&(j={}),b=Oe({},b,S);let T=[],O=[];f.v7_fetcherPersist&&b.fetchers.forEach((D,Y)=>{D.state==="idle"&&(Ne.has(Y)?O.push(Y):T.push(Y))}),Ne.forEach(D=>{!b.fetchers.has(D)&&!P.has(D)&&O.push(D)}),[...m].forEach(D=>D(b,{deletedFetchers:O,viewTransitionOpts:j.viewTransitionOpts,flushSync:j.flushSync===!0})),f.v7_fetcherPersist?(T.forEach(D=>b.fetchers.delete(D)),O.forEach(D=>gi(D))):O.forEach(D=>Ne.delete(D))}function gt(S,j,T){var O,D;let{flushSync:Y}=T===void 0?{}:T,X=b.actionData!=null&&b.navigation.formMethod!=null&&Kt(b.navigation.formMethod)&&b.navigation.state==="loading"&&((O=S.state)==null?void 0:O._isRedirect)!==!0,V;j.actionData?Object.keys(j.actionData).length>0?V=j.actionData:V=null:X?V=b.actionData:V=null;let q=j.loaderData?Lh(b.loaderData,j.loaderData,j.matches||[],j.errors):b.loaderData,F=b.blockers;F.size>0&&(F=new Map(F),F.forEach((le,tt)=>F.set(tt,ua)));let K=A===!0||b.navigation.formMethod!=null&&Kt(b.navigation.formMethod)&&((D=S.state)==null?void 0:D._isRedirect)!==!0;o&&(i=o,o=void 0),$||k===qe.Pop||(k===qe.Push?e.history.push(S,S.state):k===qe.Replace&&e.history.replace(S,S.state));let Z;if(k===qe.Pop){let le=L.get(b.location.pathname);le&&le.has(S.pathname)?Z={currentLocation:b.location,nextLocation:S}:L.has(S.pathname)&&(Z={currentLocation:S,nextLocation:b.location})}else if(z){let le=L.get(b.location.pathname);le?le.add(S.pathname):(le=new Set([S.pathname]),L.set(b.location.pathname,le)),Z={currentLocation:b.location,nextLocation:S}}ze(Oe({},j,{actionData:V,loaderData:q,historyAction:k,location:S,initialized:!0,navigation:nc,revalidation:"idle",restoreScrollPosition:ff(S,j.matches||b.matches),preventScrollReset:K,blockers:F}),{viewTransitionOpts:Z,flushSync:Y===!0}),k=qe.Pop,A=!1,z=!1,$=!1,ee=!1,J=[]}async function Pr(S,j){if(typeof S=="number"){e.history.go(S);return}let T=yu(b.location,b.matches,l,f.v7_prependBasename,S,f.v7_relativeSplatPath,j==null?void 0:j.fromRouteId,j==null?void 0:j.relative),{path:O,submission:D,error:Y}=Nh(f.v7_normalizeFormMethod,!1,T,j),X=b.location,V=ei(b.location,O,j&&j.state);V=Oe({},V,e.history.encodeLocation(V));let q=j&&j.replace!=null?j.replace:void 0,F=qe.Push;q===!0?F=qe.Replace:q===!1||D!=null&&Kt(D.formMethod)&&D.formAction===b.location.pathname+b.location.search&&(F=qe.Replace);let K=j&&"preventScrollReset"in j?j.preventScrollReset===!0:void 0,Z=(j&&j.flushSync)===!0,le=uf({currentLocation:X,nextLocation:V,historyAction:F});if(le){vi(le,{state:"blocked",location:V,proceed(){vi(le,{state:"proceeding",proceed:void 0,reset:void 0,location:V}),Pr(S,j)},reset(){let tt=new Map(b.blockers);tt.set(le,ua),ze({blockers:tt})}});return}return await fn(F,V,{submission:D,pendingError:Y,preventScrollReset:K,replace:j&&j.replace,enableViewTransition:j&&j.viewTransition,flushSync:Z})}function Kn(){if(jl(),ze({revalidation:"loading"}),b.navigation.state!=="submitting"){if(b.navigation.state==="idle"){fn(b.historyAction,b.location,{startUninterruptedRevalidation:!0});return}fn(k||b.historyAction,b.navigation.location,{overrideNavigation:b.navigation,enableViewTransition:z===!0})}}async function fn(S,j,T){N&&N.abort(),N=null,k=S,$=(T&&T.startUninterruptedRevalidation)===!0,ux(b.location,b.matches),A=(T&&T.preventScrollReset)===!0,z=(T&&T.enableViewTransition)===!0;let O=o||i,D=T&&T.overrideNavigation,Y=T!=null&&T.initialHydration&&b.matches&&b.matches.length>0&&!w?b.matches:Sn(O,j,l),X=(T&&T.flushSync)===!0;if(Y&&b.initialized&&!ee&&Tb(b.location,j)&&!(T&&T.submission&&Kt(T.submission.formMethod))){gt(j,{matches:Y},{flushSync:X});return}let V=yi(Y,O,j.pathname);if(V.active&&V.matches&&(Y=V.matches),!Y){let{error:ke,notFoundMatches:me,route:Me}=Cl(j.pathname);gt(j,{matches:me,loaderData:{},errors:{[Me.id]:ke}},{flushSync:X});return}N=new AbortController;let q=Zn(e.history,j,N.signal,T&&T.submission),F;if(T&&T.pendingError)F=[En(Y).route.id,{type:ve.error,error:T.pendingError}];else if(T&&T.submission&&Kt(T.submission.formMethod)){let ke=await tx(q,j,T.submission,Y,V.active,{replace:T.replace,flushSync:X});if(ke.shortCircuited)return;if(ke.pendingActionResult){let[me,Me]=ke.pendingActionResult;if(jt(Me)&&ti(Me.error)&&Me.error.status===404){N=null,gt(j,{matches:ke.matches,loaderData:{},errors:{[me]:Me.error}});return}}Y=ke.matches||Y,F=ke.pendingActionResult,D=sc(j,T.submission),X=!1,V.active=!1,q=Zn(e.history,q.url,q.signal)}let{shortCircuited:K,matches:Z,loaderData:le,errors:tt}=await rx(q,j,Y,V.active,D,T&&T.submission,T&&T.fetcherSubmission,T&&T.replace,T&&T.initialHydration===!0,X,F);K||(N=null,gt(j,Oe({matches:Z||Y},Dh(F),{loaderData:le,errors:tt})))}async function tx(S,j,T,O,D,Y){Y===void 0&&(Y={}),jl();let X=Lb(j,T);if(ze({navigation:X},{flushSync:Y.flushSync===!0}),D){let F=await xi(O,j.pathname,S.signal);if(F.type==="aborted")return{shortCircuited:!0};if(F.type==="error"){let K=En(F.partialMatches).route.id;return{matches:F.partialMatches,pendingActionResult:[K,{type:ve.error,error:F.error}]}}else if(F.matches)O=F.matches;else{let{notFoundMatches:K,error:Z,route:le}=Cl(j.pathname);return{matches:K,pendingActionResult:[le.id,{type:ve.error,error:Z}]}}}let V,q=_a(O,j);if(!q.route.action&&!q.route.lazy)V={type:ve.error,error:vt(405,{method:S.method,pathname:j.pathname,routeId:q.route.id})};else if(V=(await Xs("action",b,S,[q],O,null))[q.route.id],S.signal.aborted)return{shortCircuited:!0};if(Pn(V)){let F;return Y&&Y.replace!=null?F=Y.replace:F=Ah(V.response.headers.get("Location"),new URL(S.url),l)===b.location.pathname+b.location.search,await hn(S,V,!0,{submission:T,replace:F}),{shortCircuited:!0}}if(Kr(V))throw vt(400,{type:"defer-action"});if(jt(V)){let F=En(O,q.route.id);return(Y&&Y.replace)!==!0&&(k=qe.Push),{matches:O,pendingActionResult:[F.route.id,V]}}return{matches:O,pendingActionResult:[q.route.id,V]}}async function rx(S,j,T,O,D,Y,X,V,q,F,K){let Z=D||sc(j,Y),le=Y||X||Fh(Z),tt=!$&&(!f.v7_partialHydration||!q);if(O){if(tt){let Fe=rf(K);ze(Oe({navigation:Z},Fe!==void 0?{actionData:Fe}:{}),{flushSync:F})}let he=await xi(T,j.pathname,S.signal);if(he.type==="aborted")return{shortCircuited:!0};if(he.type==="error"){let Fe=En(he.partialMatches).route.id;return{matches:he.partialMatches,loaderData:{},errors:{[Fe]:he.error}}}else if(he.matches)T=he.matches;else{let{error:Fe,notFoundMatches:Yn,route:ta}=Cl(j.pathname);return{matches:Yn,loaderData:{},errors:{[ta.id]:Fe}}}}let ke=o||i,[me,Me]=Th(e.history,b,T,le,j,f.v7_partialHydration&&q===!0,f.v7_skipActionErrorRevalidation,ee,J,ge,Ne,ue,re,ke,l,K);if(Nl(he=>!(T&&T.some(Fe=>Fe.route.id===he))||me&&me.some(Fe=>Fe.route.id===he)),W=++H,me.length===0&&Me.length===0){let he=of();return gt(j,Oe({matches:T,loaderData:{},errors:K&&jt(K[1])?{[K[0]]:K[1].error}:null},Dh(K),he?{fetchers:new Map(b.fetchers)}:{}),{flushSync:F}),{shortCircuited:!0}}if(tt){let he={};if(!O){he.navigation=Z;let Fe=rf(K);Fe!==void 0&&(he.actionData=Fe)}Me.length>0&&(he.fetchers=nx(Me)),ze(he,{flushSync:F})}Me.forEach(he=>{Rr(he.key),he.controller&&P.set(he.key,he.controller)});let Qn=()=>Me.forEach(he=>Rr(he.key));N&&N.signal.addEventListener("abort",Qn);let{loaderResults:Zs,fetcherResults:fr}=await nf(b,T,me,Me,S);if(S.signal.aborted)return{shortCircuited:!0};N&&N.signal.removeEventListener("abort",Qn),Me.forEach(he=>P.delete(he.key));let nr=Mi(Zs);if(nr)return await hn(S,nr.result,!0,{replace:V}),{shortCircuited:!0};if(nr=Mi(fr),nr)return re.add(nr.key),await hn(S,nr.result,!0,{replace:V}),{shortCircuited:!0};let{loaderData:Pl,errors:ea}=Ih(b,T,Zs,K,Me,fr,_e);_e.forEach((he,Fe)=>{he.subscribe(Yn=>{(Yn||he.done)&&_e.delete(Fe)})}),f.v7_partialHydration&&q&&b.errors&&(ea=Oe({},b.errors,ea));let pn=of(),wi=lf(W),bi=pn||wi||Me.length>0;return Oe({matches:T,loaderData:Pl,errors:ea},bi?{fetchers:new Map(b.fetchers)}:{})}function rf(S){if(S&&!jt(S[1]))return{[S[0]]:S[1].data};if(b.actionData)return Object.keys(b.actionData).length===0?null:b.actionData}function nx(S){return S.forEach(j=>{let T=b.fetchers.get(j.key),O=da(void 0,T?T.data:void 0);b.fetchers.set(j.key,O)}),new Map(b.fetchers)}function sx(S,j,T,O){if(n)throw new Error("router.fetch() was called during the server render, but it shouldn't be. You are likely calling a useFetcher() method in the body of your component. Try moving it to a useEffect or a callback.");Rr(S);let D=(O&&O.flushSync)===!0,Y=o||i,X=yu(b.location,b.matches,l,f.v7_prependBasename,T,f.v7_relativeSplatPath,j,O==null?void 0:O.relative),V=Sn(Y,X,l),q=yi(V,Y,X);if(q.active&&q.matches&&(V=q.matches),!V){dr(S,j,vt(404,{pathname:X}),{flushSync:D});return}let{path:F,submission:K,error:Z}=Nh(f.v7_normalizeFormMethod,!0,X,O);if(Z){dr(S,j,Z,{flushSync:D});return}let le=_a(V,F),tt=(O&&O.preventScrollReset)===!0;if(K&&Kt(K.formMethod)){ax(S,j,F,le,V,q.active,D,tt,K);return}ue.set(S,{routeId:j,path:F}),ix(S,j,F,le,V,q.active,D,tt,K)}async function ax(S,j,T,O,D,Y,X,V,q){jl(),ue.delete(S);function F(We){if(!We.route.action&&!We.route.lazy){let Jn=vt(405,{method:q.formMethod,pathname:T,routeId:j});return dr(S,j,Jn,{flushSync:X}),!0}return!1}if(!Y&&F(O))return;let K=b.fetchers.get(S);Tr(S,Db(q,K),{flushSync:X});let Z=new AbortController,le=Zn(e.history,T,Z.signal,q);if(Y){let We=await xi(D,new URL(le.url).pathname,le.signal,S);if(We.type==="aborted")return;if(We.type==="error"){dr(S,j,We.error,{flushSync:X});return}else if(We.matches){if(D=We.matches,O=_a(D,T),F(O))return}else{dr(S,j,vt(404,{pathname:T}),{flushSync:X});return}}P.set(S,Z);let tt=H,me=(await Xs("action",b,le,[O],D,S))[O.route.id];if(le.signal.aborted){P.get(S)===Z&&P.delete(S);return}if(f.v7_fetcherPersist&&Ne.has(S)){if(Pn(me)||jt(me)){Tr(S,Dr(void 0));return}}else{if(Pn(me))if(P.delete(S),W>tt){Tr(S,Dr(void 0));return}else return re.add(S),Tr(S,da(q)),hn(le,me,!1,{fetcherSubmission:q,preventScrollReset:V});if(jt(me)){dr(S,j,me.error);return}}if(Kr(me))throw vt(400,{type:"defer-action"});let Me=b.navigation.location||b.location,Qn=Zn(e.history,Me,Z.signal),Zs=o||i,fr=b.navigation.state!=="idle"?Sn(Zs,b.navigation.location,l):b.matches;ae(fr,"Didn't find any matches after fetcher action");let nr=++H;te.set(S,nr);let Pl=da(q,me.data);b.fetchers.set(S,Pl);let[ea,pn]=Th(e.history,b,fr,q,Me,!1,f.v7_skipActionErrorRevalidation,ee,J,ge,Ne,ue,re,Zs,l,[O.route.id,me]);pn.filter(We=>We.key!==S).forEach(We=>{let Jn=We.key,hf=b.fetchers.get(Jn),hx=da(void 0,hf?hf.data:void 0);b.fetchers.set(Jn,hx),Rr(Jn),We.controller&&P.set(Jn,We.controller)}),ze({fetchers:new Map(b.fetchers)});let wi=()=>pn.forEach(We=>Rr(We.key));Z.signal.addEventListener("abort",wi);let{loaderResults:bi,fetcherResults:he}=await nf(b,fr,ea,pn,Qn);if(Z.signal.aborted)return;Z.signal.removeEventListener("abort",wi),te.delete(S),P.delete(S),pn.forEach(We=>P.delete(We.key));let Fe=Mi(bi);if(Fe)return hn(Qn,Fe.result,!1,{preventScrollReset:V});if(Fe=Mi(he),Fe)return re.add(Fe.key),hn(Qn,Fe.result,!1,{preventScrollReset:V});let{loaderData:Yn,errors:ta}=Ih(b,fr,bi,void 0,pn,he,_e);if(b.fetchers.has(S)){let We=Dr(me.data);b.fetchers.set(S,We)}lf(nr),b.navigation.state==="loading"&&nr>W?(ae(k,"Expected pending action"),N&&N.abort(),gt(b.navigation.location,{matches:fr,loaderData:Yn,errors:ta,fetchers:new Map(b.fetchers)})):(ze({errors:ta,loaderData:Lh(b.loaderData,Yn,fr,ta),fetchers:new Map(b.fetchers)}),ee=!1)}async function ix(S,j,T,O,D,Y,X,V,q){let F=b.fetchers.get(S);Tr(S,da(q,F?F.data:void 0),{flushSync:X});let K=new AbortController,Z=Zn(e.history,T,K.signal);if(Y){let me=await xi(D,new URL(Z.url).pathname,Z.signal,S);if(me.type==="aborted")return;if(me.type==="error"){dr(S,j,me.error,{flushSync:X});return}else if(me.matches)D=me.matches,O=_a(D,T);else{dr(S,j,vt(404,{pathname:T}),{flushSync:X});return}}P.set(S,K);let le=H,ke=(await Xs("loader",b,Z,[O],D,S))[O.route.id];if(Kr(ke)&&(ke=await Ld(ke,Z.signal,!0)||ke),P.get(S)===K&&P.delete(S),!Z.signal.aborted){if(Ne.has(S)){Tr(S,Dr(void 0));return}if(Pn(ke))if(W>le){Tr(S,Dr(void 0));return}else{re.add(S),await hn(Z,ke,!1,{preventScrollReset:V});return}if(jt(ke)){dr(S,j,ke.error);return}ae(!Kr(ke),"Unhandled fetcher deferred data"),Tr(S,Dr(ke.data))}}async function hn(S,j,T,O){let{submission:D,fetcherSubmission:Y,preventScrollReset:X,replace:V}=O===void 0?{}:O;j.response.headers.has("X-Remix-Revalidate")&&(ee=!0);let q=j.response.headers.get("Location");ae(q,"Expected a Location header on the redirect Response"),q=Ah(q,new URL(S.url),l);let F=ei(b.location,q,{_isRedirect:!0});if(r){let me=!1;if(j.response.headers.has("X-Remix-Reload-Document"))me=!0;else if(Id.test(q)){const Me=e.history.createURL(q);me=Me.origin!==t.location.origin||Ws(Me.pathname,l)==null}if(me){V?t.location.replace(q):t.location.assign(q);return}}N=null;let K=V===!0||j.response.headers.has("X-Remix-Replace")?qe.Replace:qe.Push,{formMethod:Z,formAction:le,formEncType:tt}=b.navigation;!D&&!Y&&Z&&le&&tt&&(D=Fh(b.navigation));let ke=D||Y;if(vb.has(j.response.status)&&ke&&Kt(ke.formMethod))await fn(K,F,{submission:Oe({},ke,{formAction:q}),preventScrollReset:X||A,enableViewTransition:T?z:void 0});else{let me=sc(F,D);await fn(K,F,{overrideNavigation:me,fetcherSubmission:Y,preventScrollReset:X||A,enableViewTransition:T?z:void 0})}}async function Xs(S,j,T,O,D,Y){let X,V={};try{X=await kb(u,S,j,T,O,D,Y,a,s)}catch(q){return O.forEach(F=>{V[F.route.id]={type:ve.error,error:q}}),V}for(let[q,F]of Object.entries(X))if(Rb(F)){let K=F.result;V[q]={type:ve.redirect,response:Nb(K,T,q,D,l,f.v7_relativeSplatPath)}}else V[q]=await Cb(F);return V}async function nf(S,j,T,O,D){let Y=S.matches,X=Xs("loader",S,D,T,j,null),V=Promise.all(O.map(async K=>{if(K.matches&&K.match&&K.controller){let le=(await Xs("loader",S,Zn(e.history,K.path,K.controller.signal),[K.match],K.matches,K.key))[K.match.route.id];return{[K.key]:le}}else return Promise.resolve({[K.key]:{type:ve.error,error:vt(404,{pathname:K.path})}})})),q=await X,F=(await V).reduce((K,Z)=>Object.assign(K,Z),{});return await Promise.all([zb(j,q,D.signal,Y,S.loaderData),Ib(j,F,O)]),{loaderResults:q,fetcherResults:F}}function jl(){ee=!0,J.push(...Nl()),ue.forEach((S,j)=>{P.has(j)&&ge.add(j),Rr(j)})}function Tr(S,j,T){T===void 0&&(T={}),b.fetchers.set(S,j),ze({fetchers:new Map(b.fetchers)},{flushSync:(T&&T.flushSync)===!0})}function dr(S,j,T,O){O===void 0&&(O={});let D=En(b.matches,j);gi(S),ze({errors:{[D.route.id]:T},fetchers:new Map(b.fetchers)},{flushSync:(O&&O.flushSync)===!0})}function sf(S){return fe.set(S,(fe.get(S)||0)+1),Ne.has(S)&&Ne.delete(S),b.fetchers.get(S)||yb}function gi(S){let j=b.fetchers.get(S);P.has(S)&&!(j&&j.state==="loading"&&te.has(S))&&Rr(S),ue.delete(S),te.delete(S),re.delete(S),f.v7_fetcherPersist&&Ne.delete(S),ge.delete(S),b.fetchers.delete(S)}function ox(S){let j=(fe.get(S)||0)-1;j<=0?(fe.delete(S),Ne.add(S),f.v7_fetcherPersist||gi(S)):fe.set(S,j),ze({fetchers:new Map(b.fetchers)})}function Rr(S){let j=P.get(S);j&&(j.abort(),P.delete(S))}function af(S){for(let j of S){let T=sf(j),O=Dr(T.data);b.fetchers.set(j,O)}}function of(){let S=[],j=!1;for(let T of re){let O=b.fetchers.get(T);ae(O,"Expected fetcher: "+T),O.state==="loading"&&(re.delete(T),S.push(T),j=!0)}return af(S),j}function lf(S){let j=[];for(let[T,O]of te)if(O0}function lx(S,j){let T=b.blockers.get(S)||ua;return Q.get(S)!==j&&Q.set(S,j),T}function cf(S){b.blockers.delete(S),Q.delete(S)}function vi(S,j){let T=b.blockers.get(S)||ua;ae(T.state==="unblocked"&&j.state==="blocked"||T.state==="blocked"&&j.state==="blocked"||T.state==="blocked"&&j.state==="proceeding"||T.state==="blocked"&&j.state==="unblocked"||T.state==="proceeding"&&j.state==="unblocked","Invalid blocker state transition: "+T.state+" -> "+j.state);let O=new Map(b.blockers);O.set(S,j),ze({blockers:O})}function uf(S){let{currentLocation:j,nextLocation:T,historyAction:O}=S;if(Q.size===0)return;Q.size>1&&Mn(!1,"A router only supports one blocker at a time");let D=Array.from(Q.entries()),[Y,X]=D[D.length-1],V=b.blockers.get(Y);if(!(V&&V.state==="proceeding")&&X({currentLocation:j,nextLocation:T,historyAction:O}))return Y}function Cl(S){let j=vt(404,{pathname:S}),T=o||i,{matches:O,route:D}=$h(T);return Nl(),{notFoundMatches:O,route:D,error:j}}function Nl(S){let j=[];return _e.forEach((T,O)=>{(!S||S(O))&&(T.cancel(),j.push(O),_e.delete(O))}),j}function cx(S,j,T){if(x=S,_=j,v=T||null,!y&&b.navigation===nc){y=!0;let O=ff(b.location,b.matches);O!=null&&ze({restoreScrollPosition:O})}return()=>{x=null,_=null,v=null}}function df(S,j){return v&&v(S,j.map(O=>K1(O,b.loaderData)))||S.key}function ux(S,j){if(x&&_){let T=df(S,j);x[T]=_()}}function ff(S,j){if(x){let T=df(S,j),O=x[T];if(typeof O=="number")return O}return null}function yi(S,j,T){if(d)if(S){if(Object.keys(S[0].params).length>0)return{active:!0,matches:uo(j,T,l,!0)}}else return{active:!0,matches:uo(j,T,l,!0)||[]};return{active:!1,matches:null}}async function xi(S,j,T,O){if(!d)return{type:"success",matches:S};let D=S;for(;;){let Y=o==null,X=o||i,V=a;try{await d({signal:T,path:j,matches:D,fetcherKey:O,patch:(K,Z)=>{T.aborted||Oh(K,Z,X,V,s)}})}catch(K){return{type:"error",error:K,partialMatches:D}}finally{Y&&!T.aborted&&(i=[...i])}if(T.aborted)return{type:"aborted"};let q=Sn(X,j,l);if(q)return{type:"success",matches:q};let F=uo(X,j,l,!0);if(!F||D.length===F.length&&D.every((K,Z)=>K.route.id===F[Z].route.id))return{type:"success",matches:null};D=F}}function dx(S){a={},o=Fo(S,s,void 0,a)}function fx(S,j){let T=o==null;Oh(S,j,o||i,a,s),T&&(i=[...i],ze({}))}return R={get basename(){return l},get future(){return f},get state(){return b},get routes(){return i},get window(){return t},initialize:Qe,subscribe:St,enableScrollRestoration:cx,navigate:Pr,fetch:sx,revalidate:Kn,createHref:S=>e.history.createHref(S),encodeLocation:S=>e.history.encodeLocation(S),getFetcher:sf,deleteFetcher:ox,dispose:dt,getBlocker:lx,deleteBlocker:cf,patchRoutes:fx,_internalFetchControllers:P,_internalActiveDeferreds:_e,_internalSetRoutes:dx},R}function bb(e){return e!=null&&("formData"in e&&e.formData!=null||"body"in e&&e.body!==void 0)}function yu(e,t,r,n,s,a,i,o){let l,u;if(i){l=[];for(let f of t)if(l.push(f),f.route.id===i){u=f;break}}else l=t,u=t[t.length-1];let d=pl(s||".",hl(l,a),Ws(e.pathname,r)||e.pathname,o==="path");if(s==null&&(d.search=e.search,d.hash=e.hash),(s==null||s===""||s===".")&&u){let f=Dd(d.search);if(u.route.index&&!f)d.search=d.search?d.search.replace(/^\?/,"?index&"):"?index";else if(!u.route.index&&f){let h=new URLSearchParams(d.search),m=h.getAll("index");h.delete("index"),m.filter(v=>v).forEach(v=>h.append("index",v));let x=h.toString();d.search=x?"?"+x:""}}return n&&r!=="/"&&(d.pathname=d.pathname==="/"?r:_r([r,d.pathname])),Fn(d)}function Nh(e,t,r,n){if(!n||!bb(n))return{path:r};if(n.formMethod&&!Ab(n.formMethod))return{path:r,error:vt(405,{method:n.formMethod})};let s=()=>({path:r,error:vt(400,{type:"invalid-body"})}),a=n.formMethod||"get",i=e?a.toUpperCase():a.toLowerCase(),o=Ov(r);if(n.body!==void 0){if(n.formEncType==="text/plain"){if(!Kt(i))return s();let h=typeof n.body=="string"?n.body:n.body instanceof FormData||n.body instanceof URLSearchParams?Array.from(n.body.entries()).reduce((m,x)=>{let[v,_]=x;return""+m+v+"="+_+` `},""):String(n.body);return{path:r,submission:{formMethod:i,formAction:o,formEncType:n.formEncType,formData:void 0,json:void 0,text:h}}}else if(n.formEncType==="application/json"){if(!Kt(i))return s();try{let h=typeof n.body=="string"?JSON.parse(n.body):n.body;return{path:r,submission:{formMethod:i,formAction:o,formEncType:n.formEncType,formData:void 0,json:h,text:void 0}}}catch{return s()}}}ae(typeof FormData=="function","FormData is not available in this environment");let l,u;if(n.formData)l=wu(n.formData),u=n.formData;else if(n.body instanceof FormData)l=wu(n.body),u=n.body;else if(n.body instanceof URLSearchParams)l=n.body,u=zh(l);else if(n.body==null)l=new URLSearchParams,u=new FormData;else try{l=new URLSearchParams(n.body),u=zh(l)}catch{return s()}let d={formMethod:i,formAction:o,formEncType:n&&n.formEncType||"application/x-www-form-urlencoded",formData:u,json:void 0,text:void 0};if(Kt(d.formMethod))return{path:r,submission:d};let f=un(r);return t&&f.search&&Dd(f.search)&&l.append("index",""),f.search="?"+l,{path:Fn(f),submission:d}}function Ph(e,t,r){r===void 0&&(r=!1);let n=e.findIndex(s=>s.route.id===t);return n>=0?e.slice(0,r?n+1:n):e}function Th(e,t,r,n,s,a,i,o,l,u,d,f,h,m,x,v){let _=v?jt(v[1])?v[1].error:v[1].data:void 0,y=e.createURL(t.location),g=e.createURL(s),w=r;a&&t.errors?w=Ph(r,Object.keys(t.errors)[0],!0):v&&jt(v[1])&&(w=Ph(r,v[0]));let E=v?v[1].statusCode:void 0,C=i&&E&&E>=400,R=w.filter((k,A)=>{let{route:N}=k;if(N.lazy)return!0;if(N.loader==null)return!1;if(a)return xu(N,t.loaderData,t.errors);if(_b(t.loaderData,t.matches[A],k)||l.some(G=>G===k.route.id))return!0;let z=t.matches[A],L=k;return Rh(k,Oe({currentUrl:y,currentParams:z.params,nextUrl:g,nextParams:L.params},n,{actionResult:_,actionStatus:E,defaultShouldRevalidate:C?!1:o||y.pathname+y.search===g.pathname+g.search||y.search!==g.search||Tv(z,L)}))}),b=[];return f.forEach((k,A)=>{if(a||!r.some($=>$.route.id===k.routeId)||d.has(A))return;let N=Sn(m,k.path,x);if(!N){b.push({key:A,routeId:k.routeId,path:k.path,matches:null,match:null,controller:null});return}let z=t.fetchers.get(A),L=_a(N,k.path),G=!1;h.has(A)?G=!1:u.has(A)?(u.delete(A),G=!0):z&&z.state!=="idle"&&z.data===void 0?G=o:G=Rh(L,Oe({currentUrl:y,currentParams:t.matches[t.matches.length-1].params,nextUrl:g,nextParams:r[r.length-1].params},n,{actionResult:_,actionStatus:E,defaultShouldRevalidate:C?!1:o})),G&&b.push({key:A,routeId:k.routeId,path:k.path,matches:N,match:L,controller:new AbortController})}),[R,b]}function xu(e,t,r){if(e.lazy)return!0;if(!e.loader)return!1;let n=t!=null&&t[e.id]!==void 0,s=r!=null&&r[e.id]!==void 0;return!n&&s?!1:typeof e.loader=="function"&&e.loader.hydrate===!0?!0:!n&&!s}function _b(e,t,r){let n=!t||r.route.id!==t.route.id,s=e[r.route.id]===void 0;return n||s}function Tv(e,t){let r=e.route.path;return e.pathname!==t.pathname||r!=null&&r.endsWith("*")&&e.params["*"]!==t.params["*"]}function Rh(e,t){if(e.route.shouldRevalidate){let r=e.route.shouldRevalidate(t);if(typeof r=="boolean")return r}return t.defaultShouldRevalidate}function Oh(e,t,r,n,s){var a;let i;if(e){let u=n[e];ae(u,"No route found to patch children into: routeId = "+e),u.children||(u.children=[]),i=u.children}else i=r;let o=t.filter(u=>!i.some(d=>Rv(u,d))),l=Fo(o,s,[e||"_","patch",String(((a=i)==null?void 0:a.length)||"0")],n);i.push(...l)}function Rv(e,t){return"id"in e&&"id"in t&&e.id===t.id?!0:e.index===t.index&&e.path===t.path&&e.caseSensitive===t.caseSensitive?(!e.children||e.children.length===0)&&(!t.children||t.children.length===0)?!0:e.children.every((r,n)=>{var s;return(s=t.children)==null?void 0:s.some(a=>Rv(r,a))}):!1}async function Sb(e,t,r){if(!e.lazy)return;let n=await e.lazy();if(!e.lazy)return;let s=r[e.id];ae(s,"No route found in manifest");let a={};for(let i in n){let l=s[i]!==void 0&&i!=="hasErrorBoundary";Mn(!l,'Route "'+s.id+'" has a static property "'+i+'" defined but its lazy function is also returning a value for this property. '+('The lazy route property "'+i+'" will be ignored.')),!l&&!q1.has(i)&&(a[i]=n[i])}Object.assign(s,a),Object.assign(s,Oe({},t(s),{lazy:void 0}))}async function Eb(e){let{matches:t}=e,r=t.filter(s=>s.shouldLoad);return(await Promise.all(r.map(s=>s.resolve()))).reduce((s,a,i)=>Object.assign(s,{[r[i].route.id]:a}),{})}async function kb(e,t,r,n,s,a,i,o,l,u){let d=a.map(m=>m.route.lazy?Sb(m.route,l,o):void 0),f=a.map((m,x)=>{let v=d[x],_=s.some(g=>g.route.id===m.route.id);return Oe({},m,{shouldLoad:_,resolve:async g=>(g&&n.method==="GET"&&(m.route.lazy||m.route.loader)&&(_=!0),_?jb(t,n,m,v,g,u):Promise.resolve({type:ve.data,result:void 0}))})}),h=await e({matches:f,request:n,params:a[0].params,fetcherKey:i,context:u});try{await Promise.all(d)}catch{}return h}async function jb(e,t,r,n,s,a){let i,o,l=u=>{let d,f=new Promise((x,v)=>d=v);o=()=>d(),t.signal.addEventListener("abort",o);let h=x=>typeof u!="function"?Promise.reject(new Error("You cannot call the handler for a route which defines a boolean "+('"'+e+'" [routeId: '+r.route.id+"]"))):u({request:t,params:r.params,context:a},...x!==void 0?[x]:[]),m=(async()=>{try{return{type:"data",result:await(s?s(v=>h(v)):h())}}catch(x){return{type:"error",result:x}}})();return Promise.race([m,f])};try{let u=r.route[e];if(n)if(u){let d,[f]=await Promise.all([l(u).catch(h=>{d=h}),n]);if(d!==void 0)throw d;i=f}else if(await n,u=r.route[e],u)i=await l(u);else if(e==="action"){let d=new URL(t.url),f=d.pathname+d.search;throw vt(405,{method:t.method,pathname:f,routeId:r.route.id})}else return{type:ve.data,result:void 0};else if(u)i=await l(u);else{let d=new URL(t.url),f=d.pathname+d.search;throw vt(404,{pathname:f})}ae(i.result!==void 0,"You defined "+(e==="action"?"an action":"a loader")+" for route "+('"'+r.route.id+"\" but didn't return anything from your `"+e+"` ")+"function. Please return a value or `null`.")}catch(u){return{type:ve.error,result:u}}finally{o&&t.signal.removeEventListener("abort",o)}return i}async function Cb(e){let{result:t,type:r}=e;if(Av(t)){let f;try{let h=t.headers.get("Content-Type");h&&/\bapplication\/json\b/.test(h)?t.body==null?f=null:f=await t.json():f=await t.text()}catch(h){return{type:ve.error,error:h}}return r===ve.error?{type:ve.error,error:new Uo(t.status,t.statusText,f),statusCode:t.status,headers:t.headers}:{type:ve.data,data:f,statusCode:t.status,headers:t.headers}}if(r===ve.error){if(Mh(t)){var n,s;if(t.data instanceof Error){var a,i;return{type:ve.error,error:t.data,statusCode:(a=t.init)==null?void 0:a.status,headers:(i=t.init)!=null&&i.headers?new Headers(t.init.headers):void 0}}return{type:ve.error,error:new Uo(((n=t.init)==null?void 0:n.status)||500,void 0,t.data),statusCode:ti(t)?t.status:void 0,headers:(s=t.init)!=null&&s.headers?new Headers(t.init.headers):void 0}}return{type:ve.error,error:t,statusCode:ti(t)?t.status:void 0}}if(Ob(t)){var o,l;return{type:ve.deferred,deferredData:t,statusCode:(o=t.init)==null?void 0:o.status,headers:((l=t.init)==null?void 0:l.headers)&&new Headers(t.init.headers)}}if(Mh(t)){var u,d;return{type:ve.data,data:t.data,statusCode:(u=t.init)==null?void 0:u.status,headers:(d=t.init)!=null&&d.headers?new Headers(t.init.headers):void 0}}return{type:ve.data,data:t}}function Nb(e,t,r,n,s,a){let i=e.headers.get("Location");if(ae(i,"Redirects returned/thrown from loaders/actions must have a Location header"),!Id.test(i)){let o=n.slice(0,n.findIndex(l=>l.route.id===r)+1);i=yu(new URL(t.url),o,s,!0,i,a),e.headers.set("Location",i)}return e}function Ah(e,t,r){if(Id.test(e)){let n=e,s=n.startsWith("//")?new URL(t.protocol+n):new URL(n),a=Ws(s.pathname,r)!=null;if(s.origin===t.origin&&a)return s.pathname+s.search+s.hash}return e}function Zn(e,t,r,n){let s=e.createURL(Ov(t)).toString(),a={signal:r};if(n&&Kt(n.formMethod)){let{formMethod:i,formEncType:o}=n;a.method=i.toUpperCase(),o==="application/json"?(a.headers=new Headers({"Content-Type":o}),a.body=JSON.stringify(n.json)):o==="text/plain"?a.body=n.text:o==="application/x-www-form-urlencoded"&&n.formData?a.body=wu(n.formData):a.body=n.formData}return new Request(s,a)}function wu(e){let t=new URLSearchParams;for(let[r,n]of e.entries())t.append(r,typeof n=="string"?n:n.name);return t}function zh(e){let t=new FormData;for(let[r,n]of e.entries())t.append(r,n);return t}function Pb(e,t,r,n,s){let a={},i=null,o,l=!1,u={},d=r&&jt(r[1])?r[1].error:void 0;return e.forEach(f=>{if(!(f.route.id in t))return;let h=f.route.id,m=t[h];if(ae(!Pn(m),"Cannot handle redirect results in processLoaderData"),jt(m)){let x=m.error;d!==void 0&&(x=d,d=void 0),i=i||{};{let v=En(e,h);i[v.route.id]==null&&(i[v.route.id]=x)}a[h]=void 0,l||(l=!0,o=ti(m.error)?m.error.status:500),m.headers&&(u[h]=m.headers)}else Kr(m)?(n.set(h,m.deferredData),a[h]=m.deferredData.data,m.statusCode!=null&&m.statusCode!==200&&!l&&(o=m.statusCode),m.headers&&(u[h]=m.headers)):(a[h]=m.data,m.statusCode&&m.statusCode!==200&&!l&&(o=m.statusCode),m.headers&&(u[h]=m.headers))}),d!==void 0&&r&&(i={[r[0]]:d},a[r[0]]=void 0),{loaderData:a,errors:i,statusCode:o||200,loaderHeaders:u}}function Ih(e,t,r,n,s,a,i){let{loaderData:o,errors:l}=Pb(t,r,n,i);return s.forEach(u=>{let{key:d,match:f,controller:h}=u,m=a[d];if(ae(m,"Did not find corresponding fetcher result"),!(h&&h.signal.aborted))if(jt(m)){let x=En(e.matches,f==null?void 0:f.route.id);l&&l[x.route.id]||(l=Oe({},l,{[x.route.id]:m.error})),e.fetchers.delete(d)}else if(Pn(m))ae(!1,"Unhandled fetcher revalidation redirect");else if(Kr(m))ae(!1,"Unhandled fetcher deferred data");else{let x=Dr(m.data);e.fetchers.set(d,x)}}),{loaderData:o,errors:l}}function Lh(e,t,r,n){let s=Oe({},t);for(let a of r){let i=a.route.id;if(t.hasOwnProperty(i)?t[i]!==void 0&&(s[i]=t[i]):e[i]!==void 0&&a.route.loader&&(s[i]=e[i]),n&&n.hasOwnProperty(i))break}return s}function Dh(e){return e?jt(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function En(e,t){return(t?e.slice(0,e.findIndex(n=>n.route.id===t)+1):[...e]).reverse().find(n=>n.route.hasErrorBoundary===!0)||e[0]}function $h(e){let t=e.length===1?e[0]:e.find(r=>r.index||!r.path||r.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:t}],route:t}}function vt(e,t){let{pathname:r,routeId:n,method:s,type:a,message:i}=t===void 0?{}:t,o="Unknown Server Error",l="Unknown @remix-run/router error";return e===400?(o="Bad Request",s&&r&&n?l="You made a "+s+' request to "'+r+'" but '+('did not provide a `loader` for route "'+n+'", ')+"so there is no way to handle the request.":a==="defer-action"?l="defer() is not supported in actions":a==="invalid-body"&&(l="Unable to encode submission body")):e===403?(o="Forbidden",l='Route "'+n+'" does not match URL "'+r+'"'):e===404?(o="Not Found",l='No route matches URL "'+r+'"'):e===405&&(o="Method Not Allowed",s&&r&&n?l="You made a "+s.toUpperCase()+' request to "'+r+'" but '+('did not provide an `action` for route "'+n+'", ')+"so there is no way to handle the request.":s&&(l='Invalid request method "'+s.toUpperCase()+'"')),new Uo(e||500,o,new Error(l),!0)}function Mi(e){let t=Object.entries(e);for(let r=t.length-1;r>=0;r--){let[n,s]=t[r];if(Pn(s))return{key:n,result:s}}}function Ov(e){let t=typeof e=="string"?un(e):e;return Fn(Oe({},t,{hash:""}))}function Tb(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===""?t.hash!=="":e.hash===t.hash?!0:t.hash!==""}function Rb(e){return Av(e.result)&&gb.has(e.result.status)}function Kr(e){return e.type===ve.deferred}function jt(e){return e.type===ve.error}function Pn(e){return(e&&e.type)===ve.redirect}function Mh(e){return typeof e=="object"&&e!=null&&"type"in e&&"data"in e&&"init"in e&&e.type==="DataWithResponseInit"}function Ob(e){let t=e;return t&&typeof t=="object"&&typeof t.data=="object"&&typeof t.subscribe=="function"&&typeof t.cancel=="function"&&typeof t.resolveData=="function"}function Av(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.headers=="object"&&typeof e.body<"u"}function Ab(e){return mb.has(e.toLowerCase())}function Kt(e){return hb.has(e.toLowerCase())}async function zb(e,t,r,n,s){let a=Object.entries(t);for(let i=0;i(h==null?void 0:h.route.id)===o);if(!u)continue;let d=n.find(h=>h.route.id===u.route.id),f=d!=null&&!Tv(d,u)&&(s&&s[u.route.id])!==void 0;Kr(l)&&f&&await Ld(l,r,!1).then(h=>{h&&(t[o]=h)})}}async function Ib(e,t,r){for(let n=0;n(u==null?void 0:u.route.id)===a)&&Kr(o)&&(ae(i,"Expected an AbortController for revalidating fetcher deferred result"),await Ld(o,i.signal,!0).then(u=>{u&&(t[s]=u)}))}}async function Ld(e,t,r){if(r===void 0&&(r=!1),!await e.deferredData.resolveData(t)){if(r)try{return{type:ve.data,data:e.deferredData.unwrappedData}}catch(s){return{type:ve.error,error:s}}return{type:ve.data,data:e.deferredData.data}}}function Dd(e){return new URLSearchParams(e).getAll("index").some(t=>t==="")}function _a(e,t){let r=typeof t=="string"?un(t).search:t.search;if(e[e.length-1].route.index&&Dd(r||""))return e[e.length-1];let n=Cv(e);return n[n.length-1]}function Fh(e){let{formMethod:t,formAction:r,formEncType:n,text:s,formData:a,json:i}=e;if(!(!t||!r||!n)){if(s!=null)return{formMethod:t,formAction:r,formEncType:n,formData:void 0,json:void 0,text:s};if(a!=null)return{formMethod:t,formAction:r,formEncType:n,formData:a,json:void 0,text:void 0};if(i!==void 0)return{formMethod:t,formAction:r,formEncType:n,formData:void 0,json:i,text:void 0}}}function sc(e,t){return t?{state:"loading",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}:{state:"loading",location:e,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function Lb(e,t){return{state:"submitting",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}}function da(e,t){return e?{state:"loading",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function Db(e,t){return{state:"submitting",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t?t.data:void 0}}function Dr(e){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function $b(e,t){try{let r=e.sessionStorage.getItem(Pv);if(r){let n=JSON.parse(r);for(let[s,a]of Object.entries(n||{}))a&&Array.isArray(a)&&t.set(s,new Set(a||[]))}}catch{}}function Mb(e,t){if(t.size>0){let r={};for(let[n,s]of t)r[n]=[...s];try{e.sessionStorage.setItem(Pv,JSON.stringify(r))}catch(n){Mn(!1,"Failed to save applied view transitions in sessionStorage ("+n+").")}}}/** * React Router v6.30.2 * * Copyright (c) Remix Software Inc. * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */function Bo(){return Bo=Object.assign?Object.assign.bind():function(e){for(var t=1;t{o.current=!0}),p.useCallback(function(u,d){if(d===void 0&&(d={}),!o.current)return;if(typeof u=="number"){n.go(u);return}let f=pl(u,JSON.parse(i),a,d.relative==="path");e==null&&t!=="/"&&(f.pathname=f.pathname==="/"?t:_r([t,f.pathname])),(d.replace?n.replace:n.push)(f,d.state,d)},[t,n,i,a,e])}const Bb=p.createContext(null);function Vb(e){let t=p.useContext(ur).outlet;return t&&p.createElement(Bb.Provider,{value:e},t)}function Dv(){let{matches:e}=p.useContext(ur),t=e[e.length-1];return t?t.params:{}}function $v(e,t){let{relative:r}=t===void 0?{}:t,{future:n}=p.useContext(dn),{matches:s}=p.useContext(ur),{pathname:a}=Hn(),i=JSON.stringify(hl(s,n.v7_relativeSplatPath));return p.useMemo(()=>pl(e,JSON.parse(i),a,r==="path"),[e,i,a,r])}function Hb(e,t,r,n){qs()||ae(!1);let{navigator:s}=p.useContext(dn),{matches:a}=p.useContext(ur),i=a[a.length-1],o=i?i.params:{};i&&i.pathname;let l=i?i.pathnameBase:"/";i&&i.route;let u=Hn(),d;d=u;let f=d.pathname||"/",h=f;if(l!=="/"){let v=l.replace(/^\//,"").split("/");h="/"+f.replace(/^\//,"").split("/").slice(v.length).join("/")}let m=Sn(e,{pathname:h});return Qb(m&&m.map(v=>Object.assign({},v,{params:Object.assign({},o,v.params),pathname:_r([l,s.encodeLocation?s.encodeLocation(v.pathname).pathname:v.pathname]),pathnameBase:v.pathnameBase==="/"?l:_r([l,s.encodeLocation?s.encodeLocation(v.pathnameBase).pathname:v.pathnameBase])})),a,r,n)}function Wb(){let e=Bv(),t=ti(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,s={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return p.createElement(p.Fragment,null,p.createElement("h2",null,"Unexpected Application Error!"),p.createElement("h3",{style:{fontStyle:"italic"}},t),r?p.createElement("pre",{style:s},r):null,null)}const qb=p.createElement(Wb,null);class Gb extends p.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,r){return r.location!==t.location||r.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:r.error,location:r.location,revalidation:t.revalidation||r.revalidation}}componentDidCatch(t,r){console.error("React Router caught the following error during render",t,r)}render(){return this.state.error!==void 0?p.createElement(ur.Provider,{value:this.props.routeContext},p.createElement(Iv.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function Kb(e){let{routeContext:t,match:r,children:n}=e,s=p.useContext(ml);return s&&s.static&&s.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=r.route.id),p.createElement(ur.Provider,{value:t},n)}function Qb(e,t,r,n){var s;if(t===void 0&&(t=[]),r===void 0&&(r=null),n===void 0&&(n=null),e==null){var a;if(!r)return null;if(r.errors)e=r.matches;else if((a=n)!=null&&a.v7_partialHydration&&t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let i=e,o=(s=r)==null?void 0:s.errors;if(o!=null){let d=i.findIndex(f=>f.route.id&&(o==null?void 0:o[f.route.id])!==void 0);d>=0||ae(!1),i=i.slice(0,Math.min(i.length,d+1))}let l=!1,u=-1;if(r&&n&&n.v7_partialHydration)for(let d=0;d=0?i=i.slice(0,u+1):i=[i[0]];break}}}return i.reduceRight((d,f,h)=>{let m,x=!1,v=null,_=null;r&&(m=o&&f.route.id?o[f.route.id]:void 0,v=f.route.errorElement||qb,l&&(u<0&&h===0?(e_("route-fallback"),x=!0,_=null):u===h&&(x=!0,_=f.route.hydrateFallbackElement||null)));let y=t.concat(i.slice(0,h+1)),g=()=>{let w;return m?w=v:x?w=_:f.route.Component?w=p.createElement(f.route.Component,null):f.route.element?w=f.route.element:w=d,p.createElement(Kb,{match:f,routeContext:{outlet:d,matches:y,isDataRoute:r!=null},children:w})};return r&&(f.route.ErrorBoundary||f.route.errorElement||h===0)?p.createElement(Gb,{location:r.location,revalidation:r.revalidation,component:v,error:m,children:g(),routeContext:{outlet:null,matches:y,isDataRoute:!0}}):g()},null)}var Mv=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(Mv||{}),Fv=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(Fv||{});function Yb(e){let t=p.useContext(ml);return t||ae(!1),t}function Jb(e){let t=p.useContext(zv);return t||ae(!1),t}function Xb(e){let t=p.useContext(ur);return t||ae(!1),t}function Uv(e){let t=Xb(),r=t.matches[t.matches.length-1];return r.route.id||ae(!1),r.route.id}function Bv(){var e;let t=p.useContext(Iv),r=Jb(),n=Uv();return t!==void 0?t:(e=r.errors)==null?void 0:e[n]}function Zb(){let{router:e}=Yb(Mv.UseNavigateStable),t=Uv(Fv.UseNavigateStable),r=p.useRef(!1);return Lv(()=>{r.current=!0}),p.useCallback(function(s,a){a===void 0&&(a={}),r.current&&(typeof s=="number"?e.navigate(s):e.navigate(s,Bo({fromRouteId:t},a)))},[e,t])}const Uh={};function e_(e,t,r){Uh[e]||(Uh[e]=!0)}function t_(e,t){e==null||e.v7_startTransition,(e==null?void 0:e.v7_relativeSplatPath)===void 0&&(!t||t.v7_relativeSplatPath),t&&(t.v7_fetcherPersist,t.v7_normalizeFormMethod,t.v7_partialHydration,t.v7_skipActionErrorRevalidation)}function Y3(e){let{to:t,replace:r,state:n,relative:s}=e;qs()||ae(!1);let{future:a,static:i}=p.useContext(dn),{matches:o}=p.useContext(ur),{pathname:l}=Hn(),u=Md(),d=pl(t,hl(o,a.v7_relativeSplatPath),l,s==="path"),f=JSON.stringify(d);return p.useEffect(()=>u(JSON.parse(f),{replace:r,state:n,relative:s}),[u,f,s,r,n]),null}function r_(e){return Vb(e.context)}function n_(e){let{basename:t="/",children:r=null,location:n,navigationType:s=qe.Pop,navigator:a,static:i=!1,future:o}=e;qs()&&ae(!1);let l=t.replace(/^\/*/,"/"),u=p.useMemo(()=>({basename:l,navigator:a,static:i,future:Bo({v7_relativeSplatPath:!1},o)}),[l,o,a,i]);typeof n=="string"&&(n=un(n));let{pathname:d="/",search:f="",hash:h="",state:m=null,key:x="default"}=n,v=p.useMemo(()=>{let _=Ws(d,l);return _==null?null:{location:{pathname:_,search:f,hash:h,state:m,key:x},navigationType:s}},[l,d,f,h,m,x,s]);return v==null?null:p.createElement(dn.Provider,{value:u},p.createElement($d.Provider,{children:r,value:v}))}new Promise(()=>{});function s_(e){let t={hasErrorBoundary:e.ErrorBoundary!=null||e.errorElement!=null};return e.Component&&Object.assign(t,{element:p.createElement(e.Component),Component:void 0}),e.HydrateFallback&&Object.assign(t,{hydrateFallbackElement:p.createElement(e.HydrateFallback),HydrateFallback:void 0}),e.ErrorBoundary&&Object.assign(t,{errorElement:p.createElement(e.ErrorBoundary),ErrorBoundary:void 0}),t}/** * React Router DOM v6.30.2 * * Copyright (c) Remix Software Inc. * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */function ri(){return ri=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&(r[s]=e[s]);return r}function i_(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function o_(e,t){return e.button===0&&(!t||t==="_self")&&!i_(e)}function bu(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,r)=>{let n=e[r];return t.concat(Array.isArray(n)?n.map(s=>[r,s]):[[r,n]])},[]))}function l_(e,t){let r=bu(e);return t&&t.forEach((n,s)=>{r.has(s)||t.getAll(s).forEach(a=>{r.append(s,a)})}),r}const c_=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],u_="6";try{window.__reactRouterVersion=u_}catch{}function d_(e,t){return wb({basename:void 0,future:ri({},void 0,{v7_prependBasename:!0}),history:V1({window:void 0}),hydrationData:f_(),routes:e,mapRouteProperties:s_,dataStrategy:void 0,patchRoutesOnNavigation:void 0,window:void 0}).initialize()}function f_(){var e;let t=(e=window)==null?void 0:e.__staticRouterHydrationData;return t&&t.errors&&(t=ri({},t,{errors:h_(t.errors)})),t}function h_(e){if(!e)return null;let t=Object.entries(e),r={};for(let[n,s]of t)if(s&&s.__type==="RouteErrorResponse")r[n]=new Uo(s.status,s.statusText,s.data,s.internal===!0);else if(s&&s.__type==="Error"){if(s.__subType){let a=window[s.__subType];if(typeof a=="function")try{let i=new a(s.message);i.stack="",r[n]=i}catch{}}if(r[n]==null){let a=new Error(s.message);a.stack="",r[n]=a}}else r[n]=s;return r}const p_=p.createContext({isTransitioning:!1}),m_=p.createContext(new Map),g_="startTransition",Bh=Hu[g_],v_="flushSync",Vh=B1[v_];function y_(e){Bh?Bh(e):e()}function fa(e){Vh?Vh(e):e()}let x_=class{constructor(){this.status="pending",this.promise=new Promise((t,r)=>{this.resolve=n=>{this.status==="pending"&&(this.status="resolved",t(n))},this.reject=n=>{this.status==="pending"&&(this.status="rejected",r(n))}})}};function w_(e){let{fallbackElement:t,router:r,future:n}=e,[s,a]=p.useState(r.state),[i,o]=p.useState(),[l,u]=p.useState({isTransitioning:!1}),[d,f]=p.useState(),[h,m]=p.useState(),[x,v]=p.useState(),_=p.useRef(new Map),{v7_startTransition:y}=n||{},g=p.useCallback(k=>{y?y_(k):k()},[y]),w=p.useCallback((k,A)=>{let{deletedFetchers:N,flushSync:z,viewTransitionOpts:L}=A;k.fetchers.forEach(($,ee)=>{$.data!==void 0&&_.current.set(ee,$.data)}),N.forEach($=>_.current.delete($));let G=r.window==null||r.window.document==null||typeof r.window.document.startViewTransition!="function";if(!L||G){z?fa(()=>a(k)):g(()=>a(k));return}if(z){fa(()=>{h&&(d&&d.resolve(),h.skipTransition()),u({isTransitioning:!0,flushSync:!0,currentLocation:L.currentLocation,nextLocation:L.nextLocation})});let $=r.window.document.startViewTransition(()=>{fa(()=>a(k))});$.finished.finally(()=>{fa(()=>{f(void 0),m(void 0),o(void 0),u({isTransitioning:!1})})}),fa(()=>m($));return}h?(d&&d.resolve(),h.skipTransition(),v({state:k,currentLocation:L.currentLocation,nextLocation:L.nextLocation})):(o(k),u({isTransitioning:!0,flushSync:!1,currentLocation:L.currentLocation,nextLocation:L.nextLocation}))},[r.window,h,d,_,g]);p.useLayoutEffect(()=>r.subscribe(w),[r,w]),p.useEffect(()=>{l.isTransitioning&&!l.flushSync&&f(new x_)},[l]),p.useEffect(()=>{if(d&&i&&r.window){let k=i,A=d.promise,N=r.window.document.startViewTransition(async()=>{g(()=>a(k)),await A});N.finished.finally(()=>{f(void 0),m(void 0),o(void 0),u({isTransitioning:!1})}),m(N)}},[g,i,d,r.window]),p.useEffect(()=>{d&&i&&s.location.key===i.location.key&&d.resolve()},[d,h,s.location,i]),p.useEffect(()=>{!l.isTransitioning&&x&&(o(x.state),u({isTransitioning:!0,flushSync:!1,currentLocation:x.currentLocation,nextLocation:x.nextLocation}),v(void 0))},[l.isTransitioning,x]),p.useEffect(()=>{},[]);let E=p.useMemo(()=>({createHref:r.createHref,encodeLocation:r.encodeLocation,go:k=>r.navigate(k),push:(k,A,N)=>r.navigate(k,{state:A,preventScrollReset:N==null?void 0:N.preventScrollReset}),replace:(k,A,N)=>r.navigate(k,{replace:!0,state:A,preventScrollReset:N==null?void 0:N.preventScrollReset})}),[r]),C=r.basename||"/",R=p.useMemo(()=>({router:r,navigator:E,static:!1,basename:C}),[r,E,C]),b=p.useMemo(()=>({v7_relativeSplatPath:r.future.v7_relativeSplatPath}),[r.future.v7_relativeSplatPath]);return p.useEffect(()=>t_(n,r.future),[n,r.future]),p.createElement(p.Fragment,null,p.createElement(ml.Provider,{value:R},p.createElement(zv.Provider,{value:s},p.createElement(m_.Provider,{value:_.current},p.createElement(p_.Provider,{value:l},p.createElement(n_,{basename:C,location:s.location,navigationType:s.historyAction,navigator:E,future:b},s.initialized||r.future.v7_partialHydration?p.createElement(b_,{routes:r.routes,future:r.future,state:s}):t))))),null)}const b_=p.memo(__);function __(e){let{routes:t,future:r,state:n}=e;return Hb(t,void 0,n,r)}const S_=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",E_=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Te=p.forwardRef(function(t,r){let{onClick:n,relative:s,reloadDocument:a,replace:i,state:o,target:l,to:u,preventScrollReset:d,viewTransition:f}=t,h=a_(t,c_),{basename:m}=p.useContext(dn),x,v=!1;if(typeof u=="string"&&E_.test(u)&&(x=u,S_))try{let w=new URL(window.location.href),E=u.startsWith("//")?new URL(w.protocol+u):new URL(u),C=Ws(E.pathname,m);E.origin===w.origin&&C!=null?u=C+E.search+E.hash:v=!0}catch{}let _=Fb(u,{relative:s}),y=k_(u,{replace:i,state:o,target:l,preventScrollReset:d,relative:s,viewTransition:f});function g(w){n&&n(w),w.defaultPrevented||y(w)}return p.createElement("a",ri({},h,{href:x||_,onClick:v||a?n:g,ref:r,target:l}))});var Hh;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Hh||(Hh={}));var Wh;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(Wh||(Wh={}));function k_(e,t){let{target:r,replace:n,state:s,preventScrollReset:a,relative:i,viewTransition:o}=t===void 0?{}:t,l=Md(),u=Hn(),d=$v(e,{relative:i});return p.useCallback(f=>{if(o_(f,r)){f.preventDefault();let h=n!==void 0?n:Fn(u)===Fn(d);l(e,{replace:h,state:s,preventScrollReset:a,relative:i,viewTransition:o})}},[u,l,d,n,s,r,e,a,i,o])}function Fd(e){let t=p.useRef(bu(e)),r=p.useRef(!1),n=Hn(),s=p.useMemo(()=>l_(n.search,r.current?null:t.current),[n.search]),a=Md(),i=p.useCallback((o,l)=>{const u=bu(typeof o=="function"?o(s):o);r.current=!0,a("?"+u,l)},[a,s]);return[s,i]}var j_=typeof Element<"u",C_=typeof Map=="function",N_=typeof Set=="function",P_=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function fo(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;var r,n,s;if(Array.isArray(e)){if(r=e.length,r!=t.length)return!1;for(n=r;n--!==0;)if(!fo(e[n],t[n]))return!1;return!0}var a;if(C_&&e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(a=e.entries();!(n=a.next()).done;)if(!t.has(n.value[0]))return!1;for(a=e.entries();!(n=a.next()).done;)if(!fo(n.value[1],t.get(n.value[0])))return!1;return!0}if(N_&&e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(a=e.entries();!(n=a.next()).done;)if(!t.has(n.value[0]))return!1;return!0}if(P_&&ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if(r=e.length,r!=t.length)return!1;for(n=r;n--!==0;)if(e[n]!==t[n])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf&&typeof e.valueOf=="function"&&typeof t.valueOf=="function")return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString&&typeof e.toString=="function"&&typeof t.toString=="function")return e.toString()===t.toString();if(s=Object.keys(e),r=s.length,r!==Object.keys(t).length)return!1;for(n=r;n--!==0;)if(!Object.prototype.hasOwnProperty.call(t,s[n]))return!1;if(j_&&e instanceof Element)return!1;for(n=r;n--!==0;)if(!((s[n]==="_owner"||s[n]==="__v"||s[n]==="__o")&&e.$$typeof)&&!fo(e[s[n]],t[s[n]]))return!1;return!0}return e!==e&&t!==t}var T_=function(t,r){try{return fo(t,r)}catch(n){if((n.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw n}};const R_=ii(T_);var O_=function(e,t,r,n,s,a,i,o){if(!e){var l;if(t===void 0)l=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var u=[r,n,s,a,i,o],d=0;l=new Error(t.replace(/%s/g,function(){return u[d++]})),l.name="Invariant Violation"}throw l.framesToPop=1,l}},A_=O_;const qh=ii(A_);var z_=function(t,r,n,s){var a=n?n.call(s,t,r):void 0;if(a!==void 0)return!!a;if(t===r)return!0;if(typeof t!="object"||!t||typeof r!="object"||!r)return!1;var i=Object.keys(t),o=Object.keys(r);if(i.length!==o.length)return!1;for(var l=Object.prototype.hasOwnProperty.bind(r),u=0;u(e.BASE="base",e.BODY="body",e.HEAD="head",e.HTML="html",e.LINK="link",e.META="meta",e.NOSCRIPT="noscript",e.SCRIPT="script",e.STYLE="style",e.TITLE="title",e.FRAGMENT="Symbol(react.fragment)",e))(Vv||{}),ac={link:{rel:["amphtml","canonical","alternate"]},script:{type:["application/ld+json"]},meta:{charset:"",name:["generator","robots","description"],property:["og:type","og:title","og:url","og:image","og:image:alt","og:description","twitter:url","twitter:title","twitter:description","twitter:image","twitter:image:alt","twitter:card","twitter:site"]}},Gh=Object.values(Vv),Ud={accesskey:"accessKey",charset:"charSet",class:"className",contenteditable:"contentEditable",contextmenu:"contextMenu","http-equiv":"httpEquiv",itemprop:"itemProp",tabindex:"tabIndex"},L_=Object.entries(Ud).reduce((e,[t,r])=>(e[r]=t,e),{}),Jt="data-rh",Ps={DEFAULT_TITLE:"defaultTitle",DEFER:"defer",ENCODE_SPECIAL_CHARACTERS:"encodeSpecialCharacters",ON_CHANGE_CLIENT_STATE:"onChangeClientState",TITLE_TEMPLATE:"titleTemplate",PRIORITIZE_SEO_TAGS:"prioritizeSeoTags"},Ts=(e,t)=>{for(let r=e.length-1;r>=0;r-=1){const n=e[r];if(Object.prototype.hasOwnProperty.call(n,t))return n[t]}return null},D_=e=>{let t=Ts(e,"title");const r=Ts(e,Ps.TITLE_TEMPLATE);if(Array.isArray(t)&&(t=t.join("")),r&&t)return r.replace(/%s/g,()=>t);const n=Ts(e,Ps.DEFAULT_TITLE);return t||n||void 0},$_=e=>Ts(e,Ps.ON_CHANGE_CLIENT_STATE)||(()=>{}),ic=(e,t)=>t.filter(r=>typeof r[e]<"u").map(r=>r[e]).reduce((r,n)=>({...r,...n}),{}),M_=(e,t)=>t.filter(r=>typeof r.base<"u").map(r=>r.base).reverse().reduce((r,n)=>{if(!r.length){const s=Object.keys(n);for(let a=0;aconsole&&typeof console.warn=="function"&&console.warn(e),ha=(e,t,r)=>{const n={};return r.filter(s=>Array.isArray(s[e])?!0:(typeof s[e]<"u"&&F_(`Helmet: ${e} should be of type "Array". Instead found type "${typeof s[e]}"`),!1)).map(s=>s[e]).reverse().reduce((s,a)=>{const i={};a.filter(l=>{let u;const d=Object.keys(l);for(let h=0;hs.push(l));const o=Object.keys(i);for(let l=0;l{if(Array.isArray(e)&&e.length){for(let r=0;r({baseTag:M_(["href"],e),bodyAttributes:ic("bodyAttributes",e),defer:Ts(e,Ps.DEFER),encode:Ts(e,Ps.ENCODE_SPECIAL_CHARACTERS),htmlAttributes:ic("htmlAttributes",e),linkTags:ha("link",["rel","href"],e),metaTags:ha("meta",["name","charset","http-equiv","property","itemprop"],e),noscriptTags:ha("noscript",["innerHTML"],e),onChangeClientState:$_(e),scriptTags:ha("script",["src","innerHTML"],e),styleTags:ha("style",["cssText"],e),title:D_(e),titleAttributes:ic("titleAttributes",e),prioritizeSeoTags:U_(e,Ps.PRIORITIZE_SEO_TAGS)}),Hv=e=>Array.isArray(e)?e.join(""):e,V_=(e,t)=>{const r=Object.keys(e);for(let n=0;nArray.isArray(e)?e.reduce((r,n)=>(V_(n,t)?r.priority.push(n):r.default.push(n),r),{priority:[],default:[]}):{default:e,priority:[]},Kh=(e,t)=>({...e,[t]:void 0}),H_=["noscript","script","style"],_u=(e,t=!0)=>t===!1?String(e):String(e).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'"),Wv=e=>Object.keys(e).reduce((t,r)=>{const n=typeof e[r]<"u"?`${r}="${e[r]}"`:`${r}`;return t?`${t} ${n}`:n},""),W_=(e,t,r,n)=>{const s=Wv(r),a=Hv(t);return s?`<${e} ${Jt}="true" ${s}>${_u(a,n)}`:`<${e} ${Jt}="true">${_u(a,n)}`},q_=(e,t,r=!0)=>t.reduce((n,s)=>{const a=s,i=Object.keys(a).filter(u=>!(u==="innerHTML"||u==="cssText")).reduce((u,d)=>{const f=typeof a[d]>"u"?d:`${d}="${_u(a[d],r)}"`;return u?`${u} ${f}`:f},""),o=a.innerHTML||a.cssText||"",l=H_.indexOf(e)===-1;return`${n}<${e} ${Jt}="true" ${i}${l?"/>":`>${o}`}`},""),qv=(e,t={})=>Object.keys(e).reduce((r,n)=>{const s=Ud[n];return r[s||n]=e[n],r},t),G_=(e,t,r)=>{const n={key:t,[Jt]:!0},s=qv(r,n);return[He.createElement("title",s,t)]},ho=(e,t)=>t.map((r,n)=>{const s={key:n,[Jt]:!0};return Object.keys(r).forEach(a=>{const o=Ud[a]||a;if(o==="innerHTML"||o==="cssText"){const l=r.innerHTML||r.cssText;s.dangerouslySetInnerHTML={__html:l}}else s[o]=r[a]}),He.createElement(e,s)}),At=(e,t,r=!0)=>{switch(e){case"title":return{toComponent:()=>G_(e,t.title,t.titleAttributes),toString:()=>W_(e,t.title,t.titleAttributes,r)};case"bodyAttributes":case"htmlAttributes":return{toComponent:()=>qv(t),toString:()=>Wv(t)};default:return{toComponent:()=>ho(e,t),toString:()=>q_(e,t,r)}}},K_=({metaTags:e,linkTags:t,scriptTags:r,encode:n})=>{const s=oc(e,ac.meta),a=oc(t,ac.link),i=oc(r,ac.script);return{priorityMethods:{toComponent:()=>[...ho("meta",s.priority),...ho("link",a.priority),...ho("script",i.priority)],toString:()=>`${At("meta",s.priority,n)} ${At("link",a.priority,n)} ${At("script",i.priority,n)}`},metaTags:s.default,linkTags:a.default,scriptTags:i.default}},Q_=e=>{const{baseTag:t,bodyAttributes:r,encode:n=!0,htmlAttributes:s,noscriptTags:a,styleTags:i,title:o="",titleAttributes:l,prioritizeSeoTags:u}=e;let{linkTags:d,metaTags:f,scriptTags:h}=e,m={toComponent:()=>{},toString:()=>""};return u&&({priorityMethods:m,linkTags:d,metaTags:f,scriptTags:h}=K_(e)),{priority:m,base:At("base",t,n),bodyAttributes:At("bodyAttributes",r,n),htmlAttributes:At("htmlAttributes",s,n),link:At("link",d,n),meta:At("meta",f,n),noscript:At("noscript",a,n),script:At("script",h,n),style:At("style",i,n),title:At("title",{title:o,titleAttributes:l},n)}},Su=Q_,Fi=[],Gv=!!(typeof window<"u"&&window.document&&window.document.createElement),Eu=class{constructor(e,t){hr(this,"instances",[]);hr(this,"canUseDOM",Gv);hr(this,"context");hr(this,"value",{setHelmet:e=>{this.context.helmet=e},helmetInstances:{get:()=>this.canUseDOM?Fi:this.instances,add:e=>{(this.canUseDOM?Fi:this.instances).push(e)},remove:e=>{const t=(this.canUseDOM?Fi:this.instances).indexOf(e);(this.canUseDOM?Fi:this.instances).splice(t,1)}}});this.context=e,this.canUseDOM=t||!1,t||(e.helmet=Su({baseTag:[],bodyAttributes:{},htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],scriptTags:[],styleTags:[],title:"",titleAttributes:{}}))}},Y_={},Kv=He.createContext(Y_),Rn,Qv=(Rn=class extends p.Component{constructor(r){super(r);hr(this,"helmetData");this.helmetData=new Eu(this.props.context||{},Rn.canUseDOM)}render(){return He.createElement(Kv.Provider,{value:this.helmetData.value},this.props.children)}},hr(Rn,"canUseDOM",Gv),Rn),es=(e,t)=>{const r=document.head||document.querySelector("head"),n=r.querySelectorAll(`${e}[${Jt}]`),s=[].slice.call(n),a=[];let i;return t&&t.length&&t.forEach(o=>{const l=document.createElement(e);for(const u in o)if(Object.prototype.hasOwnProperty.call(o,u))if(u==="innerHTML")l.innerHTML=o.innerHTML;else if(u==="cssText")l.styleSheet?l.styleSheet.cssText=o.cssText:l.appendChild(document.createTextNode(o.cssText));else{const d=u,f=typeof o[d]>"u"?"":o[d];l.setAttribute(u,f)}l.setAttribute(Jt,"true"),s.some((u,d)=>(i=d,l.isEqualNode(u)))?s.splice(i,1):a.push(l)}),s.forEach(o=>{var l;return(l=o.parentNode)==null?void 0:l.removeChild(o)}),a.forEach(o=>r.appendChild(o)),{oldTags:s,newTags:a}},ku=(e,t)=>{const r=document.getElementsByTagName(e)[0];if(!r)return;const n=r.getAttribute(Jt),s=n?n.split(","):[],a=[...s],i=Object.keys(t);for(const o of i){const l=t[o]||"";r.getAttribute(o)!==l&&r.setAttribute(o,l),s.indexOf(o)===-1&&s.push(o);const u=a.indexOf(o);u!==-1&&a.splice(u,1)}for(let o=a.length-1;o>=0;o-=1)r.removeAttribute(a[o]);s.length===a.length?r.removeAttribute(Jt):r.getAttribute(Jt)!==i.join(",")&&r.setAttribute(Jt,i.join(","))},J_=(e,t)=>{typeof e<"u"&&document.title!==e&&(document.title=Hv(e)),ku("title",t)},Qh=(e,t)=>{const{baseTag:r,bodyAttributes:n,htmlAttributes:s,linkTags:a,metaTags:i,noscriptTags:o,onChangeClientState:l,scriptTags:u,styleTags:d,title:f,titleAttributes:h}=e;ku("body",n),ku("html",s),J_(f,h);const m={baseTag:es("base",r),linkTags:es("link",a),metaTags:es("meta",i),noscriptTags:es("noscript",o),scriptTags:es("script",u),styleTags:es("style",d)},x={},v={};Object.keys(m).forEach(_=>{const{newTags:y,oldTags:g}=m[_];y.length&&(x[_]=y),g.length&&(v[_]=m[_].oldTags)}),t&&t(),l(e,x,v)},pa=null,X_=e=>{pa&&cancelAnimationFrame(pa),e.defer?pa=requestAnimationFrame(()=>{Qh(e,()=>{pa=null})}):(Qh(e),pa=null)},Z_=X_,Yh=class extends p.Component{constructor(){super(...arguments);hr(this,"rendered",!1)}shouldComponentUpdate(t){return!I_(t,this.props)}componentDidUpdate(){this.emitChange()}componentWillUnmount(){const{helmetInstances:t}=this.props.context;t.remove(this),this.emitChange()}emitChange(){const{helmetInstances:t,setHelmet:r}=this.props.context;let n=null;const s=B_(t.get().map(a=>{const i={...a.props};return delete i.context,i}));Qv.canUseDOM?Z_(s):Su&&(n=Su(s)),r(n)}init(){if(this.rendered)return;this.rendered=!0;const{helmetInstances:t}=this.props.context;t.add(this),this.emitChange()}render(){return this.init(),null}},kc,e2=(kc=class extends p.Component{shouldComponentUpdate(e){return!R_(Kh(this.props,"helmetData"),Kh(e,"helmetData"))}mapNestedChildrenToProps(e,t){if(!t)return null;switch(e.type){case"script":case"noscript":return{innerHTML:t};case"style":return{cssText:t};default:throw new Error(`<${e.type} /> elements are self-closing and can not contain children. Refer to our API for more information.`)}}flattenArrayTypeChildren(e,t,r,n){return{...t,[e.type]:[...t[e.type]||[],{...r,...this.mapNestedChildrenToProps(e,n)}]}}mapObjectTypeChildren(e,t,r,n){switch(e.type){case"title":return{...t,[e.type]:n,titleAttributes:{...r}};case"body":return{...t,bodyAttributes:{...r}};case"html":return{...t,htmlAttributes:{...r}};default:return{...t,[e.type]:{...r}}}}mapArrayTypeChildrenToProps(e,t){let r={...t};return Object.keys(e).forEach(n=>{r={...r,[n]:e[n]}}),r}warnOnInvalidChildren(e,t){return qh(Gh.some(r=>e.type===r),typeof e.type=="function"?"You may be attempting to nest components within each other, which is not allowed. Refer to our API for more information.":`Only elements types ${Gh.join(", ")} are allowed. Helmet does not support rendering <${e.type}> elements. Refer to our API for more information.`),qh(!t||typeof t=="string"||Array.isArray(t)&&!t.some(r=>typeof r!="string"),`Helmet expects a string as a child of <${e.type}>. Did you forget to wrap your children in braces? ( <${e.type}>{\`\`} ) Refer to our API for more information.`),!0}mapChildrenToProps(e,t){let r={};return He.Children.forEach(e,n=>{if(!n||!n.props)return;const{children:s,...a}=n.props,i=Object.keys(a).reduce((l,u)=>(l[L_[u]||u]=a[u],l),{});let{type:o}=n;switch(typeof o=="symbol"?o=o.toString():this.warnOnInvalidChildren(n,s),o){case"Symbol(react.fragment)":t=this.mapChildrenToProps(s,t);break;case"link":case"meta":case"noscript":case"script":case"style":r=this.flattenArrayTypeChildren(n,r,i,s);break;default:t=this.mapObjectTypeChildren(n,t,i,s);break}}),this.mapArrayTypeChildrenToProps(r,t)}render(){const{children:e,...t}=this.props;let r={...t},{helmetData:n}=t;if(e&&(r=this.mapChildrenToProps(e,r)),n&&!(n instanceof Eu)){const s=n;n=new Eu(s.context,!0),delete r.helmetData}return n?He.createElement(Yh,{...r,context:n.value}):He.createElement(Kv.Consumer,null,s=>He.createElement(Yh,{...r,context:s}))}},hr(kc,"defaultProps",{defer:!0,encodeSpecialCharacters:!0,prioritizeSeoTags:!1}),kc);function t2(e,t){const r={...e};for(const[n,s]of Object.entries(t))s!=null&&s!==""&&(r[n]=s);return r}function lc(e,t){const r=e.user.user_metadata||{},n=(t==null?void 0:t.user_metadata)||{},s=t2(r,n);return{id:e.user.id,email:e.user.email||null,nickname:(t==null?void 0:t.full_name)||s.full_name,avatar_url:(t==null?void 0:t.avatar_url)||s.avatar_url,phone:t==null?void 0:t.phone,role:t==null?void 0:t.role,metadata:s}}function r2(e,t){const r=(t==null?void 0:t.profileTable)===void 0?"profiles":t.profileTable,[n,s]=p.useState(null),[a,i]=p.useState(null),o=p.useRef(null),l=p.useRef(0),[u,d]=p.useState(!0),[f,h]=p.useState(!1),[m,x]=p.useState(!1),[v,_]=p.useState(null),y=p.useCallback(async(R,b)=>{if(b!==l.current)return;if(!(R!=null&&R.user)){o.current=null,s(null),i(null);return}i(R);let k=null;try{if(r===!1){o.current=R.user.id,s(lc(R,null));return}const{data:A,error:N}=await e.from(r).select("*").eq("id",R.user.id).maybeSingle();N&&console.warn("Error fetching profile:",N.message),k=A}catch(A){console.warn("Error fetching profile:",A)}b===l.current&&(o.current=R.user.id,s(lc(R,k)))},[r,e]),g=p.useCallback(async(R,b)=>{const k=b??++l.current;if(k===l.current){R==="identity-change"&&(h(!0),x(!1)),R==="background"&&x(!0);try{_(null);const{data:{session:A}}=await e.auth.getSession();await y(A,k)}catch(A){const N=A instanceof Error?A.message:"Error checking session";console.error("Error checking session:",A),k===l.current&&(_(N),o.current=null,s(null),i(null))}finally{k===l.current&&(d(!1),h(!1),x(!1))}}},[y,e]);p.useEffect(()=>{g("initial");const{data:{subscription:R}}=e.auth.onAuthStateChange((b,k)=>{var A;if(b==="SIGNED_OUT"){l.current+=1,o.current=null,d(!1),h(!1),x(!1),s(null),i(null);return}if(b==="SIGNED_IN"||b==="TOKEN_REFRESHED"){const N=((A=k==null?void 0:k.user)==null?void 0:A.id)??null,z=N!==null&&N===o.current?"background":"identity-change",L=++l.current;setTimeout(()=>{g(z,L)},0)}});return()=>{l.current+=1,R.unsubscribe()}},[g,e]);const w=p.useCallback(async()=>{try{const{error:R}=await e.auth.signOut();if(R)throw R;return l.current+=1,o.current=null,d(!1),h(!1),x(!1),s(null),i(null),_(null),{success:!0}}catch(R){const b=R instanceof Error?R.message:"Sign out failed";return _(b),{success:!1,error:b}}},[e]),E=p.useCallback(async()=>{const R=++l.current;try{x(!0),_(null);const{data:{session:b}}=await e.auth.getSession();if(R!==l.current)return{success:!1,error:"Authentication state changed"};if(!(b!=null&&b.user))return o.current=null,s(null),i(null),{success:!1,error:"No active session"};let k=null;if(r!==!1){const A=await e.from(r).select("*").eq("id",b.user.id).maybeSingle();k=A.data,A.error&&console.warn("Error fetching profile:",A.error.message)}return R!==l.current?{success:!1,error:"Authentication state changed"}:(o.current=b.user.id,i(b),s(lc(b,k)),{success:!0,user:k})}catch(b){const k=b instanceof Error?b.message:"Failed to refresh user";return R===l.current&&_(k),{success:!1,error:k}}finally{R===l.current&&(d(!1),h(!1),x(!1))}},[r,e]),C=(n==null?void 0:n.role)==="admin";return{user:n,session:a,loading:u||f,initializing:u,refreshing:m,error:v,isAdmin:C,signOut:w,refreshUser:E}}const Jh=Symbol.for("wxz-web-builder-react-components/supabase-auth-context"),Xh=globalThis,Yv=Xh[Jh]??(Xh[Jh]=p.createContext(null));function Jv({supabase:e,children:t,profileTable:r}){const n=r2(e,{profileTable:r});return c.jsx(Yv.Provider,{value:n,children:t})}function Gs(){const e=p.useContext(Yv);if(!e)throw new Error("useAuthContext must be used within AuthProvider");return e}function n2(e,t,r,n){const s=(n==null?void 0:n.defaultCacheControl)||"3600",a=!1,[i,o]=p.useState({loading:!1,error:null,progress:0,url:null}),[l,u]=p.useState({loading:!1,error:null,files:[]}),[d,f]=p.useState({loading:!1,error:null,data:null}),h=p.useCallback(async(N,z,L)=>{o({loading:!0,error:null,progress:0,url:null});try{const G=await r.resolveFile(z,L==null?void 0:L.contentType),{data:$,error:ee}=await e.storage.from(t).upload(N,G,{cacheControl:(L==null?void 0:L.cacheControl)||s,contentType:L==null?void 0:L.contentType,upsert:(L==null?void 0:L.upsert)??a});if(ee)throw ee;const{data:{publicUrl:J}}=e.storage.from(t).getPublicUrl(N);return o({loading:!1,error:null,progress:100,url:J}),{success:!0,path:$.path,url:J}}catch(G){const $=G instanceof Error?G.message:"上传失败";return o({loading:!1,error:$,progress:0,url:null}),{success:!1,error:$}}},[r,t,s,a,e]),m=p.useCallback(async(N,z,L)=>{o({loading:!0,error:null,progress:0,url:null});try{const G=await r.resolveFile(L),{data:$,error:ee}=await e.storage.from(t).uploadToSignedUrl(N,z,G);if(ee)throw ee;const{data:{publicUrl:J}}=e.storage.from(t).getPublicUrl(N);return o({loading:!1,error:null,progress:100,url:J}),{success:!0,path:$.path,url:J}}catch(G){const $=G instanceof Error?G.message:"上传到签名 URL 失败";return o({loading:!1,error:$,progress:0,url:null}),{success:!1,error:$}}},[r,t,e]),x=p.useCallback(N=>{const{data:{publicUrl:z}}=e.storage.from(t).getPublicUrl(N);return z},[t,e]),v=p.useCallback(async(N,z=3600)=>{try{const{data:L,error:G}=await e.storage.from(t).createSignedUrl(N,z);if(G)throw G;return{success:!0,url:L.signedUrl}}catch(L){return{success:!1,error:L instanceof Error?L.message:"获取签名 URL 失败"}}},[t,e]),_=p.useCallback(async(N,z=3600)=>{try{const{data:L,error:G}=await e.storage.from(t).createSignedUrls(N,z);if(G)throw G;return{success:!0,urls:L}}catch(L){return{success:!1,error:L instanceof Error?L.message:"批量获取签名 URL 失败"}}},[t,e]),y=p.useCallback(async N=>{try{const{data:z,error:L}=await e.storage.from(t).createSignedUploadUrl(N);if(L)throw L;return{success:!0,signedUrl:z.signedUrl,token:z.token}}catch(z){return{success:!1,error:z instanceof Error?z.message:"创建上传签名 URL 失败"}}},[t,e]),g=p.useCallback(async N=>{f({loading:!0,error:null,data:null});try{const z=await r.downloadFile(e,t,N);return f({loading:!1,error:null,data:z.data}),{success:!0,data:z.data}}catch(z){const L=z instanceof Error?z.message:"下载失败";return f({loading:!1,error:L,data:null}),{success:!1,error:L}}},[r,t,e]),w=p.useCallback(async N=>{try{const{data:z,error:L}=await e.storage.from(t).remove(N);if(L)throw L;return{success:!0,data:z}}catch(z){return{success:!1,error:z instanceof Error?z.message:"删除失败"}}},[t,e]),E=p.useCallback(async(N,z)=>{u({loading:!0,error:null,files:[]});try{const{data:L,error:G}=await e.storage.from(t).list(N,{limit:(z==null?void 0:z.limit)||100,offset:(z==null?void 0:z.offset)||0,sortBy:z==null?void 0:z.sortBy});if(G)throw G;return u({loading:!1,error:null,files:L}),{success:!0,files:L}}catch(L){const G=L instanceof Error?L.message:"获取文件列表失败";return u({loading:!1,error:G,files:[]}),{success:!1,error:G}}},[t,e]),C=p.useCallback(async(N,z)=>{try{const{data:L,error:G}=await e.storage.from(t).move(N,z);if(G)throw G;return{success:!0,data:L}}catch(L){return{success:!1,error:L instanceof Error?L.message:"移动文件失败"}}},[t,e]),R=p.useCallback(async(N,z)=>{try{const{data:L,error:G}=await e.storage.from(t).copy(N,z);if(G)throw G;return{success:!0,data:L}}catch(L){return{success:!1,error:L instanceof Error?L.message:"复制文件失败"}}},[t,e]),b=p.useCallback(()=>{o({loading:!1,error:null,progress:0,url:null})},[]),k=p.useCallback(()=>{u({loading:!1,error:null,files:[]})},[]),A=p.useCallback(()=>{f({loading:!1,error:null,data:null})},[]);return p.useMemo(()=>({uploadState:i,listState:l,downloadState:d,upload:h,uploadToSignedUrl:m,createUploadSignedUrl:y,getPublicUrl:x,getSignedUrl:v,createSignedUrls:_,download:g,remove:w,list:E,move:C,copy:R,resetUpload:b,resetList:k,resetDownload:A}),[R,_,y,g,d,x,v,E,l,C,w,A,k,b,h,i,m])}const s2={resolveFile:e=>e,downloadFile:async(e,t,r)=>{const{data:n,error:s}=await e.storage.from(t).download(r);if(s)throw s;return{data:n}}};function a2(e,t,r){const n=n2(e,t,s2,r),s=p.useCallback(async(a,i)=>{try{const o=e.storage.from(t),{data:l,error:u}=await o.download(a);if(u)throw u;if(!l)throw new Error("文件不存在,无法更新元数据");const{data:d,error:f}=await o.update(a,l,{upsert:!0,metadata:i,...l.type?{contentType:l.type}:{}});if(f)throw f;return{success:!0,data:d}}catch(o){return{success:!1,error:o instanceof Error?o.message:"更新元数据失败"}}},[t,e]);return p.useMemo(()=>({...n,updateMetadata:s}),[n,s])}function i2(e,t){const{returnUrl:r,navigate:n}=t,[s,a]=p.useState({loading:!1,error:null,otpSent:!1}),i=p.useRef(!0);p.useEffect(()=>(i.current=!0,()=>{i.current=!1}),[]);const o=l=>{i.current&&a(l)};return{...s,sendOTP:async(l,u)=>{o({loading:!0,error:null,otpSent:!1});try{const d=r?{emailRedirectTo:r}:void 0,{error:f}=await e.auth.signInWithOtp(u==="email"?{email:l,options:d}:{phone:l});if(f)throw f;return o({loading:!1,error:null,otpSent:!0}),{success:!0}}catch(d){const f=d instanceof Error?d.message:"Failed to send OTP";return o({loading:!1,error:f,otpSent:!1}),{success:!1,error:f}}},verifyOTP:async(l,u,d)=>{o(f=>({...f,loading:!0,error:null}));try{const{data:f,error:h}=await e.auth.verifyOtp(d==="email"?{email:l,token:u,type:"email"}:{phone:l,token:u,type:"sms"});if(h)throw h;return o({loading:!1,error:null,otpSent:!0}),i.current&&r&&n&&n(r),{success:!0,data:f}}catch(f){const h=f instanceof Error?f.message:"Failed to verify OTP";return o(m=>({...m,loading:!1,error:h})),{success:!1,error:h}}},signInWithPassword:async(l,u)=>{o(d=>({...d,loading:!0,error:null}));try{const{data:d,error:f}=await e.auth.signInWithPassword({email:l,password:u});if(f)throw f;return o({loading:!1,error:null,otpSent:!1}),i.current&&r&&n&&n(r),{success:!0,data:d}}catch(d){const f=d instanceof Error?d.message:"Failed to sign in";return o(h=>({...h,loading:!1,error:f})),{success:!1,error:f}}},signUp:async(l,u)=>{o(d=>({...d,loading:!0,error:null}));try{const{data:d,error:f}=await e.auth.signUp({email:l,password:u,options:{emailRedirectTo:r}});if(f)throw f;return o({loading:!1,error:null,otpSent:!1}),{success:!0,data:d}}catch(d){const f=d instanceof Error?d.message:"Failed to sign up";return o(h=>({...h,loading:!1,error:f})),{success:!1,error:f}}},signInWithOAuth:async l=>{o(u=>({...u,loading:!0,error:null}));try{const{data:u,error:d}=await e.auth.signInWithOAuth({provider:l,options:{redirectTo:r}});if(d)throw d;return o({loading:!1,error:null,otpSent:!1}),{success:!0,data:u}}catch(u){const d=u instanceof Error?u.message:"Failed to sign in with OAuth";return o(f=>({...f,loading:!1,error:d})),{success:!1,error:d}}},setLoading:l=>{o(u=>({...u,loading:l}))},setError:l=>{o(u=>({...u,error:l}))},reset:()=>{o({loading:!1,error:null,otpSent:!1})}}}function o2(e,t){return i2(e,{returnUrl:t,navigate:void 0})}var l2=Object.defineProperty,c2=(e,t,r)=>t in e?l2(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Sa=(e,t,r)=>c2(e,typeof t!="symbol"?t+"":t,r);const Zh="RBAC_LIGHTWEIGHT_CONFIG_INVALID";let Tn=class extends Error{constructor(t){super(t.message),Sa(this,"status"),Sa(this,"code"),Sa(this,"requestId"),Sa(this,"recommend"),this.name="RbacApiError",this.status=t.status??0,this.code=t.code??null,this.requestId=t.requestId??null,this.recommend=t.recommend??null}},Bd=class extends Error{constructor(t=Zh){super(t),Sa(this,"code",Zh),this.name="RbacConfigurationError"}};function ep(e){return e instanceof Error?e:new Error(String(e))}const u2=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;function Xv(e){return u2.test(e)}function eN(e,t){if(!Xv(e))throw new Bd(`${t} must be a valid UUID`)}function tp(e){var t;if(e.length!==1||((t=e[0])==null?void 0:t.path)!=="root"||!Xv(e[0].id))throw new Bd;return{...e[0],path:"root"}}function rp(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch{return e}}function d2(e,t){const r=[],n=new Map,s=(a,i)=>{const o=n.get(a);if(o===void 0){n.set(a,r.length),r.push([a,i]);return}r[o]=[a,i]};for(const a of e.split("&")){if(!a)continue;const i=a.indexOf("="),o=i===-1?a:a.slice(0,i),l=i===-1?"":a.slice(i+1);s(rp(o),rp(l))}for(const[a,i]of Object.entries(t))i!==void 0&&s(a,String(i));return r.map(([a,i])=>`${encodeURIComponent(a)}=${encodeURIComponent(i)}`).join("&")}function f2(e,t){const r=e.indexOf("?"),n=r===-1?e:e.slice(0,r),s=r===-1?"":e.slice(r+1),a=d2(s,t);return a?`${n}?${a}`:n}function ts(e,t={}){return f2(e,{is_deleted:"false",...t})}const h2="RBAC_FETCH_UNAVAILABLE";function p2(){const e=globalThis.fetch;if(typeof e!="function")throw new Error(`${h2}: 当前运行时没有全局 fetch(小程序即属于此类环境)。请改用 wxz-web-builder-react-components/supabase-rbac-taro 的 RbacProvider,或向 RbacProvider / createSupabaseRbacClient 传入 transport。`);return e}function m2(e){return async({url:t,method:r,headers:n,body:s})=>{const a=await(e??p2())(t,{method:r,headers:n,body:s}),i=await a.json().catch(()=>null);return{status:a.status,ok:a.ok,body:i}}}const g2="content-type";function v2(e,t){const r={};let n=!1;for(const[s,a]of Object.entries(e??{}))s.toLowerCase()===g2&&(n=!0),r[s]=a;return n||(r["Content-Type"]="application/json"),r.Authorization=`Bearer ${t}`,r}function Wn(e){return typeof e=="object"&&e!==null}function Se(e){return typeof e=="string"&&e.length>0?e:null}function Zv(e){if(!Wn(e))return null;const t=Se(e.id),r=Se(e.name);return!t||!r?null:{id:t,name:r,label:Se(e.label)??r,is_system:e.is_system===!0,is_default:e.is_default===!0}}function ju(e){if(!Wn(e))return null;const t=Se(e.id),r=Se(e.resource),n=Se(e.action);return!t||!r||!n?null:{id:t,resource:r,action:n,description:Se(e.description)}}function y2(e){if(!Wn(e))return null;const t=Se(e.user_id),r=Se(e.role_id);return!t||!r?null:{user_id:t,role_id:r,org_id:Se(e.org_id)}}function x2(e){if(!Wn(e))return null;const t=Se(e.id),r=Se(e.path);return!t||!r?null:{id:t,name:Se(e.name)??"根组织",path:r}}function w2(e){if(!Wn(e))return null;const t=Se(e.id);return t?{id:t,full_name:Se(e.full_name),email:Se(e.email),phone:Se(e.phone)}:null}function rs(e,t){return Array.isArray(e)?e.flatMap(r=>{const n=t(r);return n?[n]:[]}):[]}function b2(e,t){if(!Wn(e)||!e.error)return null;const r=typeof e.status=="number"?e.status:t;return new Tn({message:Se(e.message)??Se(e.error)??`RBAC API ${r}`,status:r,code:Se(e.code)??Se(e.error),requestId:Se(e.requestId),recommend:Se(e.recommend)})}const np="RBAC_BASE_URL_MISSING";function _2(e){const t=e.trim().replace(/\/+$/,"");if(!t)throw new Error(`${np}: RBAC 需要一个绝对的 Supabase base URL。收到的是空值,通常是把未注入的构建期环境变量直接当 baseUrl 使用、被空串兜底导致。请改传绝对 URL 常量。`);const r=/^https?:\/\/([^/?#\s]+)(?:\/[^?#\s]*)?$/i.exec(t);if(!r||r[1].includes("@"))throw new Error(`${np}: RBAC baseUrl 必须是宿主从环境变量读取的、无凭证、查询参数和锚点的 HTTP(S) 绝对 Supabase URL。`);return t.endsWith("/rbac/v1")?t:`${t}/rbac/v1`}function sp(e){const t=Zv(e);if(!t)throw new Tn({message:"Invalid RBAC role response"});return t}function S2(e){const t=ju(e);if(!t)throw new Tn({message:"Invalid RBAC permission response"});return t}function E2(e){const t=_2(e.baseUrl),r=e.transport??m2(e.fetch),n=new Map,s=async(h,m)=>{const{data:{session:x}}=await e.supabase.auth.getSession();if(!x)throw new Tn({message:"请先登录",status:401,code:"unauthorized"});const v=await r({url:`${t}${h}`,method:(m==null?void 0:m.method)??"GET",headers:v2(m==null?void 0:m.headers,x.access_token),body:m==null?void 0:m.body}),_=b2(v.body,v.status);if(_)throw _;if(!v.ok){const y=Wn(v.body)?v.body:null;throw new Tn({message:Se(y==null?void 0:y.message)??`RBAC API ${v.status}`,status:v.status,code:Se(y==null?void 0:y.code),requestId:Se(y==null?void 0:y.requestId),recommend:Se(y==null?void 0:y.recommend)})}return v.body},a=h=>{h?n.delete(h):n.clear()},i=async(h=1,m=20)=>rs(await s(ts("/roles",{pageNum:h,pageSize:m})),Zv),o=async h=>sp(await s(ts(`/roles/${encodeURIComponent(h)}`))),l=async h=>rs(await s(ts(`/roles/${encodeURIComponent(h)}/permissions`)),ju),u=async(h=1,m=100)=>rs(await s(ts("/permissions",{pageNum:h,pageSize:m})),ju),d=async(h,m=1,x=500)=>rs(await s(ts("/user-roles",{user_id:h,pageNum:m,pageSize:x})),y2),f=async()=>rs(await s(ts("/org-units")),x2);return{request:s,listRoles:i,getRole:o,async createRole(h){const m=sp(await s("/roles",{method:"POST",body:JSON.stringify({name:h.name,label:h.label,is_default:h.is_default??!1,is_system:!1})}));return a(),m},async updateRole(h,m){await s(`/roles/${encodeURIComponent(h)}`,{method:"PUT",body:JSON.stringify(m)}),a()},async deleteRole(h){await s(`/roles/${encodeURIComponent(h)}`,{method:"DELETE"}),a()},getRolePermissions:l,async setRolePermissions(h,m){await s(`/roles/${encodeURIComponent(h)}/permissions`,{method:"PUT",body:JSON.stringify({permission_ids:m})}),a()},listPermissions:u,async createPermission(h){const m=S2(await s("/permissions",{method:"POST",body:JSON.stringify(h)}));return a(),m},async deletePermission(h){await s(`/permissions/${encodeURIComponent(h)}`,{method:"DELETE"}),a()},listUserRoles:d,async assignUserRole(h){await s("/user-roles",{method:"POST",body:JSON.stringify(h)}),a(h.user_id)},async revokeUserRole(h){await s("/user-roles",{method:"DELETE",body:JSON.stringify(h)}),a(h.user_id)},listOrgUnits:f,getOrganizationAccess:async(h,m)=>{const[x,v]=await Promise.all([d(h),f()]),_=x.filter($=>$.user_id===h),y=[...new Set(_.map($=>$.role_id))],g=await Promise.all(y.map($=>o($))),w=new Map(g.map($=>[$.id,$])),E=_.some($=>{const ee=w.get($.role_id);return $.org_id===null&&(ee==null?void 0:ee.is_system)===!0}),C=new Set(_.flatMap($=>$.org_id?[$.org_id]:[])),R=v.filter($=>E||C.has($.id));if(m&&!R.some($=>$.id===m))throw new Tn({message:"organization out of scope",status:403,code:"permission_denied"});const b=m?R.find($=>$.id===m)??null:R[0]??null,k=_.filter($=>$.org_id===null||$.org_id===(b==null?void 0:b.id)),A=new Map(v.map($=>[$.id,$.name])),N=k.flatMap($=>{const ee=w.get($.role_id);return ee?[{...ee,org_id:$.org_id,org_name:$.org_id?A.get($.org_id)??null:null}]:[]}),z=[...new Set(N.map($=>$.id))],L=await Promise.all(z.map($=>l($))),G=new Map;for(const $ of L)for(const ee of $)G.set(`${ee.resource}:${ee.action}`,{resource:ee.resource,action:ee.action});return{currentOrg:b,orgs:R,roles:N,permissions:[...G.values()]}},getRootOrg:async()=>tp(await f()),async listProfiles(){const{data:h,error:m}=await e.supabase.from("profiles").select("id, full_name, email, phone").eq("is_deleted",!1);if(m)throw m;return rs(h,w2)},getCurrentAccess:async h=>{let m=h;if(!m){const{data:{user:_},error:y}=await e.supabase.auth.getUser();if(y)throw y;m=_==null?void 0:_.id}if(!m)throw new Tn({message:"请先登录",status:401,code:"unauthorized"});const x=n.get(m);if(x)return x;const v=(async()=>{const _=(await d(m)).filter(N=>N.user_id===m),y=[...new Set(_.map(N=>N.role_id))],[g,w,E]=await Promise.all([Promise.all(y.map(N=>o(N))),Promise.all(y.map(N=>l(N))),f()]),C=tp(E),R=new Map(g.map(N=>[N.id,N])),b=new Map(E.map(N=>[N.id,N.name])),k=_.flatMap(N=>{const z=R.get(N.role_id);return z?[{...z,org_id:N.org_id,org_name:N.org_id?b.get(N.org_id)??null:null}]:[]}),A=new Map;for(const N of w)for(const z of N)A.set(`${z.resource}:${z.action}`,{resource:z.resource,action:z.action});return{roles:k,permissions:[...A.values()],rootOrg:C}})();return n.set(m,v),v.catch(()=>{n.get(m)===v&&n.delete(m)}),v},clearAccessCache:a}}function ap(e){const t=()=>Promise.reject(e);return{request:t,listRoles:t,getRole:t,createRole:t,updateRole:t,deleteRole:t,getRolePermissions:t,setRolePermissions:t,listPermissions:t,createPermission:t,deletePermission:t,listUserRoles:t,assignUserRole:t,revokeUserRole:t,listOrgUnits:t,getOrganizationAccess:t,getRootOrg:t,listProfiles:t,getCurrentAccess:t,clearAccessCache:()=>{}}}function Cu(e,t){return e.roles.some(r=>r.name===t)}function k2(e,t,r){return e.permissions.some(n=>n.resource===t&&n.action===r)}function tN(e){return e.roles.some(t=>t.is_system)}function rN(e){if(e instanceof Bd)return e.code;const t=e instanceof Error?e.message:String(e??"");return t.includes("permission_denied")?"无权执行此操作":t.includes("organization out of scope")?"超出组织管辖范围":t.includes("invalid_state")?"当前状态不允许此操作":t.includes("not_found")?"数据不存在或无权访问":t||"操作失败"}const mn={navigation:{title:"管理后台",roles:"角色管理",permissions:"权限管理",members:"成员管理"},common:{loading:"加载中...",loadFailed:"加载失败",retry:"重试",cancel:"取消",save:"保存",saving:"保存中...",create:"创建",edit:"编辑",delete:"删除",close:"关闭",confirm:"确认",required:"请填写必填项",empty:"暂无数据"},guard:{checking:"正在检查管理权限...",denied:"你没有访问管理后台的权限",error:"权限检查失败,请重试"},roles:{title:"角色管理",description:"管理业务角色并配置角色拥有的权限",createButton:"新建角色",createTitle:"新建角色",editTitle:"编辑角色",nameLabel:"角色标识",namePlaceholder:"英文标识,如 editor",labelLabel:"显示名称",labelPlaceholder:"如 编辑",systemBadge:"系统",defaultBadge:"默认",empty:"暂无角色",limitReached:"当前万小智最多支持 10 个业务角色",createSuccess:"角色已创建",updateSuccess:"角色已更新",deleteSuccess:"角色已删除",deleteTitle:"删除角色",deleteDescription:"删除角色会影响已分配成员及其权限,确定继续吗?",systemRoleProtected:"系统角色不可删除",configurePermissions:"配置权限",permissionsTitle:"配置角色权限",permissionsEmpty:"暂无可配置权限",permissionsSelected:"已选择 {selected} / {total} 项权限",permissionsSearchLabel:"搜索权限",permissionsSearchPlaceholder:"搜索业务名称或权限操作",permissionsNoResults:"未找到匹配的业务或操作",permissionsVisibleSelectionHint:"全选只影响当前搜索结果",permissionsSelectAll:"全选",permissionsNoChanges:"权限未发生变化",permissionsAdded:"本次将新增 {added} 项权限",permissionsRemoved:"本次将取消 {removed} 项权限",permissionsChanged:"本次将新增 {added} 项、取消 {removed} 项权限",permissionsSave:"保存更改",permissionsDiscardChanges:"存在未保存的权限修改,确定放弃吗?",permissionsSaved:"角色权限已保存"},permissions:{title:"权限管理",description:"管理与已部署 RLS 资源和操作一致的权限目录",createButton:"新建权限",createTitle:"新建权限",resourceLabel:"资源",resourcePlaceholder:"如 bookings",actionLabel:"操作",actionPlaceholder:"如 read",descriptionLabel:"描述",descriptionPlaceholder:"权限用途说明",empty:"暂无权限",createSuccess:"权限已创建",deleteSuccess:"权限已删除",deleteTitle:"删除权限",deleteDescription:"删除权限可能影响现有角色授权,确定继续吗?"},members:{title:"成员管理",description:"为成员分配一个业务角色",assignButton:"分配角色",assignTitle:"分配成员角色",userLabel:"用户",userPlaceholder:"请选择用户",roleLabel:"角色",rolePlaceholder:"请选择业务角色",userId:"用户 ID",email:"邮箱",phone:"手机",role:"角色",actions:"操作",empty:"暂无成员角色分配",unassigned:"未分配角色",assignSuccess:"角色已分配",revokeSuccess:"角色已撤销",revokeAction:"撤销",revokeTitle:"撤销成员角色",revokeDescription:"确定撤销该成员的业务角色吗?",systemRoleProtected:"系统角色不可撤销",rootOrgInvalid:"唯一根组织配置无效,无法分配角色"}};function j2(e){return e?{navigation:{...mn.navigation,...e.navigation},common:{...mn.common,...e.common},guard:{...mn.guard,...e.guard},roles:{...mn.roles,...e.roles},permissions:{...mn.permissions,...e.permissions},members:{...mn.members,...e.members}}:mn}const ip=Symbol.for("wxz-web-builder-react-components/supabase-rbac-context"),op=globalThis,Vd=op[ip]??(op[ip]=p.createContext(null)),C2={},ey="RBAC_PROVIDER_MISSING",N2="RBAC_PROVIDER_CONFIG_INVALID";function ty({children:e,client:t,supabase:r,baseUrl:n,transport:s,messages:a,notifier:i=C2}){const{user:o,loading:l}=Gs(),{client:u,configError:d}=p.useMemo(()=>{if(t)return{client:t,configError:null};if(!r||!n){const g=new Error(`${N2}: RbacProvider 需要 client,或同时提供 supabase 与非空的 baseUrl。当前 supabase=${r?"ok":"missing"}、baseUrl=${n?"ok":"empty"}。`);return{client:ap(g),configError:g}}try{return{client:E2({supabase:r,baseUrl:n,transport:s}),configError:null}}catch(g){const w=ep(g);return{client:ap(w),configError:w}}},[n,t,r,s]),f=p.useMemo(()=>j2(a),[a]),[h,m]=p.useState(0),[x,v]=p.useState({status:"auth-loading",access:null,error:null}),_=p.useCallback(()=>{o!=null&&o.id&&u.clearAccessCache(o.id),m(g=>g+1)},[u,o==null?void 0:o.id]);p.useEffect(()=>{let g=!1;return d?(v({status:"error",access:null,error:d}),()=>{g=!0}):l?(v({status:"auth-loading",access:null,error:null}),()=>{g=!0}):o!=null&&o.id?(v({status:"loading",access:null,error:null}),u.getCurrentAccess(o.id).then(w=>{g||v({status:"ready",access:w,error:null})}).catch(w=>{g||v({status:"error",access:null,error:ep(w)})}),()=>{g=!0}):(u.clearAccessCache(),v({status:"unauthenticated",access:null,error:null}),()=>{g=!0})},[l,u,d,h,o==null?void 0:o.id]);const y=p.useMemo(()=>({client:u,userId:(o==null?void 0:o.id)??null,accessState:x,messages:f,notifier:i,refreshAccess:_}),[x,u,f,i,_,o==null?void 0:o.id]);return c.jsx(Vd.Provider,{value:y,children:e})}function nN(){const e=p.useContext(Vd);if(!e)throw new Error(`${ey}: useRbacContext must be used within RbacProvider`);return e}function P2(){return p.useContext(Vd)}function ry(){const e=P2(),t=p.useMemo(()=>({status:"error",access:null,error:new Error(`${ey}: useRbacAccess 需要在 RbacProvider 内使用。请在 app 根组件无条件挂载 RbacProvider。`)}),[]);return e?{...e.accessState,retry:e.refreshAccess}:{...t,retry:()=>{}}}function T2(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}Array(12).fill(0);let Nu=1;class R2{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{const r=this.subscribers.indexOf(t);this.subscribers.splice(r,1)}),this.publish=t=>{this.subscribers.forEach(r=>r(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var r;const{message:n,...s}=t,a=typeof(t==null?void 0:t.id)=="number"||((r=t.id)==null?void 0:r.length)>0?t.id:Nu++,i=this.toasts.find(l=>l.id===a),o=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(a)&&this.dismissedToasts.delete(a),i?this.toasts=this.toasts.map(l=>l.id===a?(this.publish({...l,...t,id:a,title:n}),{...l,...t,id:a,dismissible:o,title:n}):l):this.addToast({title:n,...s,dismissible:o,id:a}),a},this.dismiss=t=>(t?(this.dismissedToasts.add(t),requestAnimationFrame(()=>this.subscribers.forEach(r=>r({id:t,dismiss:!0})))):this.toasts.forEach(r=>{this.subscribers.forEach(n=>n({id:r.id,dismiss:!0}))}),t),this.message=(t,r)=>this.create({...r,message:t}),this.error=(t,r)=>this.create({...r,message:t,type:"error"}),this.success=(t,r)=>this.create({...r,type:"success",message:t}),this.info=(t,r)=>this.create({...r,type:"info",message:t}),this.warning=(t,r)=>this.create({...r,type:"warning",message:t}),this.loading=(t,r)=>this.create({...r,type:"loading",message:t}),this.promise=(t,r)=>{if(!r)return;let n;r.loading!==void 0&&(n=this.create({...r,promise:t,type:"loading",message:r.loading,description:typeof r.description!="function"?r.description:void 0}));const s=Promise.resolve(t instanceof Function?t():t);let a=n!==void 0,i;const o=s.then(async u=>{if(i=["resolve",u],He.isValidElement(u))a=!1,this.create({id:n,type:"default",message:u});else if(A2(u)&&!u.ok){a=!1;const f=typeof r.error=="function"?await r.error(`HTTP error! status: ${u.status}`):r.error,h=typeof r.description=="function"?await r.description(`HTTP error! status: ${u.status}`):r.description,x=typeof f=="object"&&!He.isValidElement(f)?f:{message:f};this.create({id:n,type:"error",description:h,...x})}else if(u instanceof Error){a=!1;const f=typeof r.error=="function"?await r.error(u):r.error,h=typeof r.description=="function"?await r.description(u):r.description,x=typeof f=="object"&&!He.isValidElement(f)?f:{message:f};this.create({id:n,type:"error",description:h,...x})}else if(r.success!==void 0){a=!1;const f=typeof r.success=="function"?await r.success(u):r.success,h=typeof r.description=="function"?await r.description(u):r.description,x=typeof f=="object"&&!He.isValidElement(f)?f:{message:f};this.create({id:n,type:"success",description:h,...x})}}).catch(async u=>{if(i=["reject",u],r.error!==void 0){a=!1;const d=typeof r.error=="function"?await r.error(u):r.error,f=typeof r.description=="function"?await r.description(u):r.description,m=typeof d=="object"&&!He.isValidElement(d)?d:{message:d};this.create({id:n,type:"error",description:f,...m})}}).finally(()=>{a&&(this.dismiss(n),n=void 0),r.finally==null||r.finally.call(r)}),l=()=>new Promise((u,d)=>o.then(()=>i[0]==="reject"?d(i[1]):u(i[1])).catch(d));return typeof n!="string"&&typeof n!="number"?{unwrap:l}:Object.assign(n,{unwrap:l})},this.custom=(t,r)=>{const n=(r==null?void 0:r.id)||Nu++;return this.create({jsx:t(n),id:n,...r}),n},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const zt=new R2,O2=(e,t)=>{const r=(t==null?void 0:t.id)||Nu++;return zt.addToast({title:e,...t,id:r}),r},A2=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",z2=O2,I2=()=>zt.toasts,L2=()=>zt.getActiveToasts(),Be=Object.assign(z2,{success:zt.success,info:zt.info,warning:zt.warning,error:zt.error,custom:zt.custom,message:zt.message,promise:zt.promise,dismiss:zt.dismiss,loading:zt.loading},{getHistory:I2,getToasts:L2});T2("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");const D2="modulepreload",$2=function(e){return"/"+e},lp={},ce=function(t,r,n){let s=Promise.resolve();if(r&&r.length>0){document.getElementsByTagName("link");const i=document.querySelector("meta[property=csp-nonce]"),o=(i==null?void 0:i.nonce)||(i==null?void 0:i.getAttribute("nonce"));s=Promise.allSettled(r.map(l=>{if(l=$2(l),l in lp)return;lp[l]=!0;const u=l.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${d}`))return;const f=document.createElement("link");if(f.rel=u?"stylesheet":D2,u||(f.as="script"),f.crossOrigin="",f.href=l,o&&f.setAttribute("nonce",o),document.head.appendChild(f),u)return new Promise((h,m)=>{f.addEventListener("load",h),f.addEventListener("error",()=>m(new Error(`Unable to preload CSS for ${l}`)))})}))}function a(i){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=i,window.dispatchEvent(o),!o.defaultPrevented)throw i}return s.then(i=>{for(const o of i||[])o.status==="rejected"&&a(o.reason);return t().catch(a)})},M2=e=>{let t;return e?t=e:typeof fetch>"u"?t=(...r)=>ce(async()=>{const{default:n}=await Promise.resolve().then(()=>Ks);return{default:n}},void 0).then(({default:n})=>n(...r)):t=fetch,(...r)=>t(...r)};class Hd extends Error{constructor(t,r="FunctionsError",n){super(t),this.name=r,this.context=n}}class F2 extends Hd{constructor(t){super("Failed to send a request to the Edge Function","FunctionsFetchError",t)}}class U2 extends Hd{constructor(t){super("Relay Error invoking the Edge Function","FunctionsRelayError",t)}}class B2 extends Hd{constructor(t){super("Edge Function returned a non-2xx status code","FunctionsHttpError",t)}}var Pu;(function(e){e.Any="any",e.ApNortheast1="ap-northeast-1",e.ApNortheast2="ap-northeast-2",e.ApSouth1="ap-south-1",e.ApSoutheast1="ap-southeast-1",e.ApSoutheast2="ap-southeast-2",e.CaCentral1="ca-central-1",e.EuCentral1="eu-central-1",e.EuWest1="eu-west-1",e.EuWest2="eu-west-2",e.EuWest3="eu-west-3",e.SaEast1="sa-east-1",e.UsEast1="us-east-1",e.UsWest1="us-west-1",e.UsWest2="us-west-2"})(Pu||(Pu={}));var V2=function(e,t,r,n){function s(a){return a instanceof r?a:new r(function(i){i(a)})}return new(r||(r=Promise))(function(a,i){function o(d){try{u(n.next(d))}catch(f){i(f)}}function l(d){try{u(n.throw(d))}catch(f){i(f)}}function u(d){d.done?a(d.value):s(d.value).then(o,l)}u((n=n.apply(e,t||[])).next())})};class H2{constructor(t,{headers:r={},customFetch:n,region:s=Pu.Any}={}){this.url=t,this.headers=r,this.region=s,this.fetch=M2(n)}setAuth(t){this.headers.Authorization=`Bearer ${t}`}invoke(t,r={}){var n;return V2(this,void 0,void 0,function*(){try{const{headers:s,method:a,body:i}=r;let o={},{region:l}=r;l||(l=this.region),l&&l!=="any"&&(o["x-region"]=l);let u;i&&(s&&!Object.prototype.hasOwnProperty.call(s,"Content-Type")||!s)&&(typeof Blob<"u"&&i instanceof Blob||i instanceof ArrayBuffer?(o["Content-Type"]="application/octet-stream",u=i):typeof i=="string"?(o["Content-Type"]="text/plain",u=i):typeof FormData<"u"&&i instanceof FormData?u=i:(o["Content-Type"]="application/json",u=JSON.stringify(i)));const d=yield this.fetch(`${this.url}/${t}`,{method:a||"POST",headers:Object.assign(Object.assign(Object.assign({},o),this.headers),s),body:u}).catch(x=>{throw new F2(x)}),f=d.headers.get("x-relay-error");if(f&&f==="true")throw new U2(d);if(!d.ok)throw new B2(d);let h=((n=d.headers.get("Content-Type"))!==null&&n!==void 0?n:"text/plain").split(";")[0].trim(),m;return h==="application/json"?m=yield d.json():h==="application/octet-stream"?m=yield d.blob():h==="text/event-stream"?m=d:h==="multipart/form-data"?m=yield d.formData():m=yield d.text(),{data:m,error:null}}catch(s){return{data:null,error:s}}})}}var Dt={},Wd={},gl={},fi={},vl={},yl={},W2=function(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("unable to locate global object")},Fs=W2();const q2=Fs.fetch,ny=Fs.fetch.bind(Fs),sy=Fs.Headers,G2=Fs.Request,K2=Fs.Response,Ks=Object.freeze(Object.defineProperty({__proto__:null,Headers:sy,Request:G2,Response:K2,default:ny,fetch:q2},Symbol.toStringTag,{value:"Module"})),Q2=gx(Ks);var qd={};Object.defineProperty(qd,"__esModule",{value:!0});class Y2 extends Error{constructor(t){super(t.message),this.name="PostgrestError",this.details=t.details,this.hint=t.hint,this.code=t.code}}qd.default=Y2;var ay=Ft&&Ft.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(yl,"__esModule",{value:!0});const J2=ay(Q2),X2=ay(qd);let Z2=class{constructor(t){this.shouldThrowOnError=!1,this.method=t.method,this.url=t.url,this.headers=t.headers,this.schema=t.schema,this.body=t.body,this.shouldThrowOnError=t.shouldThrowOnError,this.signal=t.signal,this.isMaybeSingle=t.isMaybeSingle,t.fetch?this.fetch=t.fetch:typeof fetch>"u"?this.fetch=J2.default:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}then(t,r){this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers["Accept-Profile"]=this.schema:this.headers["Content-Profile"]=this.schema),this.method!=="GET"&&this.method!=="HEAD"&&(this.headers["Content-Type"]="application/json");const n=this.fetch;let s=n(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async a=>{var i,o,l;let u=null,d=null,f=null,h=a.status,m=a.statusText;if(a.ok){if(this.method!=="HEAD"){const y=await a.text();y===""||(this.headers.Accept==="text/csv"||this.headers.Accept&&this.headers.Accept.includes("application/vnd.pgrst.plan+text")?d=y:d=JSON.parse(y))}const v=(i=this.headers.Prefer)===null||i===void 0?void 0:i.match(/count=(exact|planned|estimated)/),_=(o=a.headers.get("content-range"))===null||o===void 0?void 0:o.split("/");v&&_&&_.length>1&&(f=parseInt(_[1])),this.isMaybeSingle&&this.method==="GET"&&Array.isArray(d)&&(d.length>1?(u={code:"PGRST116",details:`Results contain ${d.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},d=null,f=null,h=406,m="Not Acceptable"):d.length===1?d=d[0]:d=null)}else{const v=await a.text();try{u=JSON.parse(v),Array.isArray(u)&&a.status===404&&(d=[],u=null,h=200,m="OK")}catch{a.status===404&&v===""?(h=204,m="No Content"):u={message:v}}if(u&&this.isMaybeSingle&&(!((l=u==null?void 0:u.details)===null||l===void 0)&&l.includes("0 rows"))&&(u=null,h=200,m="OK"),u&&this.shouldThrowOnError)throw new X2.default(u)}return{error:u,data:d,count:f,status:h,statusText:m}});return this.shouldThrowOnError||(s=s.catch(a=>{var i,o,l;return{error:{message:`${(i=a==null?void 0:a.name)!==null&&i!==void 0?i:"FetchError"}: ${a==null?void 0:a.message}`,details:`${(o=a==null?void 0:a.stack)!==null&&o!==void 0?o:""}`,hint:"",code:`${(l=a==null?void 0:a.code)!==null&&l!==void 0?l:""}`},data:null,count:null,status:0,statusText:""}})),s.then(t,r)}};yl.default=Z2;var eS=Ft&&Ft.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(vl,"__esModule",{value:!0});const tS=eS(yl);let rS=class extends tS.default{select(t){let r=!1;const n=(t??"*").split("").map(s=>/\s/.test(s)&&!r?"":(s==='"'&&(r=!r),s)).join("");return this.url.searchParams.set("select",n),this.headers.Prefer&&(this.headers.Prefer+=","),this.headers.Prefer+="return=representation",this}order(t,{ascending:r=!0,nullsFirst:n,foreignTable:s,referencedTable:a=s}={}){const i=a?`${a}.order`:"order",o=this.url.searchParams.get(i);return this.url.searchParams.set(i,`${o?`${o},`:""}${t}.${r?"asc":"desc"}${n===void 0?"":n?".nullsfirst":".nullslast"}`),this}limit(t,{foreignTable:r,referencedTable:n=r}={}){const s=typeof n>"u"?"limit":`${n}.limit`;return this.url.searchParams.set(s,`${t}`),this}range(t,r,{foreignTable:n,referencedTable:s=n}={}){const a=typeof s>"u"?"offset":`${s}.offset`,i=typeof s>"u"?"limit":`${s}.limit`;return this.url.searchParams.set(a,`${t}`),this.url.searchParams.set(i,`${r-t+1}`),this}abortSignal(t){return this.signal=t,this}single(){return this.headers.Accept="application/vnd.pgrst.object+json",this}maybeSingle(){return this.method==="GET"?this.headers.Accept="application/json":this.headers.Accept="application/vnd.pgrst.object+json",this.isMaybeSingle=!0,this}csv(){return this.headers.Accept="text/csv",this}geojson(){return this.headers.Accept="application/geo+json",this}explain({analyze:t=!1,verbose:r=!1,settings:n=!1,buffers:s=!1,wal:a=!1,format:i="text"}={}){var o;const l=[t?"analyze":null,r?"verbose":null,n?"settings":null,s?"buffers":null,a?"wal":null].filter(Boolean).join("|"),u=(o=this.headers.Accept)!==null&&o!==void 0?o:"application/json";return this.headers.Accept=`application/vnd.pgrst.plan+${i}; for="${u}"; options=${l};`,i==="json"?this:this}rollback(){var t;return((t=this.headers.Prefer)!==null&&t!==void 0?t:"").trim().length>0?this.headers.Prefer+=",tx=rollback":this.headers.Prefer="tx=rollback",this}returns(){return this}};vl.default=rS;var nS=Ft&&Ft.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(fi,"__esModule",{value:!0});const sS=nS(vl);let aS=class extends sS.default{eq(t,r){return this.url.searchParams.append(t,`eq.${r}`),this}neq(t,r){return this.url.searchParams.append(t,`neq.${r}`),this}gt(t,r){return this.url.searchParams.append(t,`gt.${r}`),this}gte(t,r){return this.url.searchParams.append(t,`gte.${r}`),this}lt(t,r){return this.url.searchParams.append(t,`lt.${r}`),this}lte(t,r){return this.url.searchParams.append(t,`lte.${r}`),this}like(t,r){return this.url.searchParams.append(t,`like.${r}`),this}likeAllOf(t,r){return this.url.searchParams.append(t,`like(all).{${r.join(",")}}`),this}likeAnyOf(t,r){return this.url.searchParams.append(t,`like(any).{${r.join(",")}}`),this}ilike(t,r){return this.url.searchParams.append(t,`ilike.${r}`),this}ilikeAllOf(t,r){return this.url.searchParams.append(t,`ilike(all).{${r.join(",")}}`),this}ilikeAnyOf(t,r){return this.url.searchParams.append(t,`ilike(any).{${r.join(",")}}`),this}is(t,r){return this.url.searchParams.append(t,`is.${r}`),this}in(t,r){const n=Array.from(new Set(r)).map(s=>typeof s=="string"&&new RegExp("[,()]").test(s)?`"${s}"`:`${s}`).join(",");return this.url.searchParams.append(t,`in.(${n})`),this}contains(t,r){return typeof r=="string"?this.url.searchParams.append(t,`cs.${r}`):Array.isArray(r)?this.url.searchParams.append(t,`cs.{${r.join(",")}}`):this.url.searchParams.append(t,`cs.${JSON.stringify(r)}`),this}containedBy(t,r){return typeof r=="string"?this.url.searchParams.append(t,`cd.${r}`):Array.isArray(r)?this.url.searchParams.append(t,`cd.{${r.join(",")}}`):this.url.searchParams.append(t,`cd.${JSON.stringify(r)}`),this}rangeGt(t,r){return this.url.searchParams.append(t,`sr.${r}`),this}rangeGte(t,r){return this.url.searchParams.append(t,`nxl.${r}`),this}rangeLt(t,r){return this.url.searchParams.append(t,`sl.${r}`),this}rangeLte(t,r){return this.url.searchParams.append(t,`nxr.${r}`),this}rangeAdjacent(t,r){return this.url.searchParams.append(t,`adj.${r}`),this}overlaps(t,r){return typeof r=="string"?this.url.searchParams.append(t,`ov.${r}`):this.url.searchParams.append(t,`ov.{${r.join(",")}}`),this}textSearch(t,r,{config:n,type:s}={}){let a="";s==="plain"?a="pl":s==="phrase"?a="ph":s==="websearch"&&(a="w");const i=n===void 0?"":`(${n})`;return this.url.searchParams.append(t,`${a}fts${i}.${r}`),this}match(t){return Object.entries(t).forEach(([r,n])=>{this.url.searchParams.append(r,`eq.${n}`)}),this}not(t,r,n){return this.url.searchParams.append(t,`not.${r}.${n}`),this}or(t,{foreignTable:r,referencedTable:n=r}={}){const s=n?`${n}.or`:"or";return this.url.searchParams.append(s,`(${t})`),this}filter(t,r,n){return this.url.searchParams.append(t,`${r}.${n}`),this}};fi.default=aS;var iS=Ft&&Ft.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(gl,"__esModule",{value:!0});const ma=iS(fi);let oS=class{constructor(t,{headers:r={},schema:n,fetch:s}){this.url=t,this.headers=r,this.schema=n,this.fetch=s}select(t,{head:r=!1,count:n}={}){const s=r?"HEAD":"GET";let a=!1;const i=(t??"*").split("").map(o=>/\s/.test(o)&&!a?"":(o==='"'&&(a=!a),o)).join("");return this.url.searchParams.set("select",i),n&&(this.headers.Prefer=`count=${n}`),new ma.default({method:s,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch,allowEmpty:!1})}insert(t,{count:r,defaultToNull:n=!0}={}){const s="POST",a=[];if(this.headers.Prefer&&a.push(this.headers.Prefer),r&&a.push(`count=${r}`),n||a.push("missing=default"),this.headers.Prefer=a.join(","),Array.isArray(t)){const i=t.reduce((o,l)=>o.concat(Object.keys(l)),[]);if(i.length>0){const o=[...new Set(i)].map(l=>`"${l}"`);this.url.searchParams.set("columns",o.join(","))}}return new ma.default({method:s,url:this.url,headers:this.headers,schema:this.schema,body:t,fetch:this.fetch,allowEmpty:!1})}upsert(t,{onConflict:r,ignoreDuplicates:n=!1,count:s,defaultToNull:a=!0}={}){const i="POST",o=[`resolution=${n?"ignore":"merge"}-duplicates`];if(r!==void 0&&this.url.searchParams.set("on_conflict",r),this.headers.Prefer&&o.push(this.headers.Prefer),s&&o.push(`count=${s}`),a||o.push("missing=default"),this.headers.Prefer=o.join(","),Array.isArray(t)){const l=t.reduce((u,d)=>u.concat(Object.keys(d)),[]);if(l.length>0){const u=[...new Set(l)].map(d=>`"${d}"`);this.url.searchParams.set("columns",u.join(","))}}return new ma.default({method:i,url:this.url,headers:this.headers,schema:this.schema,body:t,fetch:this.fetch,allowEmpty:!1})}update(t,{count:r}={}){const n="PATCH",s=[];return this.headers.Prefer&&s.push(this.headers.Prefer),r&&s.push(`count=${r}`),this.headers.Prefer=s.join(","),new ma.default({method:n,url:this.url,headers:this.headers,schema:this.schema,body:t,fetch:this.fetch,allowEmpty:!1})}delete({count:t}={}){const r="DELETE",n=[];return t&&n.push(`count=${t}`),this.headers.Prefer&&n.unshift(this.headers.Prefer),this.headers.Prefer=n.join(","),new ma.default({method:r,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch,allowEmpty:!1})}};gl.default=oS;var xl={},wl={};Object.defineProperty(wl,"__esModule",{value:!0});wl.version=void 0;wl.version="0.0.0-automated";Object.defineProperty(xl,"__esModule",{value:!0});xl.DEFAULT_HEADERS=void 0;const lS=wl;xl.DEFAULT_HEADERS={"X-Client-Info":`postgrest-js/${lS.version}`};var iy=Ft&&Ft.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Wd,"__esModule",{value:!0});const cS=iy(gl),uS=iy(fi),dS=xl;let fS=class oy{constructor(t,{headers:r={},schema:n,fetch:s}={}){this.url=t,this.headers=Object.assign(Object.assign({},dS.DEFAULT_HEADERS),r),this.schemaName=n,this.fetch=s}from(t){const r=new URL(`${this.url}/${t}`);return new cS.default(r,{headers:Object.assign({},this.headers),schema:this.schemaName,fetch:this.fetch})}schema(t){return new oy(this.url,{headers:this.headers,schema:t,fetch:this.fetch})}rpc(t,r={},{head:n=!1,get:s=!1,count:a}={}){let i;const o=new URL(`${this.url}/rpc/${t}`);let l;n||s?(i=n?"HEAD":"GET",Object.entries(r).filter(([d,f])=>f!==void 0).map(([d,f])=>[d,Array.isArray(f)?`{${f.join(",")}}`:`${f}`]).forEach(([d,f])=>{o.searchParams.append(d,f)})):(i="POST",l=r);const u=Object.assign({},this.headers);return a&&(u.Prefer=`count=${a}`),new uS.default({method:i,url:o,headers:u,schema:this.schemaName,body:l,fetch:this.fetch,allowEmpty:!1})}};Wd.default=fS;var hi=Ft&&Ft.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Dt,"__esModule",{value:!0});Dt.PostgrestBuilder=Dt.PostgrestTransformBuilder=Dt.PostgrestFilterBuilder=Dt.PostgrestQueryBuilder=Dt.PostgrestClient=void 0;const ly=hi(Wd);Dt.PostgrestClient=ly.default;const cy=hi(gl);Dt.PostgrestQueryBuilder=cy.default;const uy=hi(fi);Dt.PostgrestFilterBuilder=uy.default;const dy=hi(vl);Dt.PostgrestTransformBuilder=dy.default;const fy=hi(yl);Dt.PostgrestBuilder=fy.default;var hS=Dt.default={PostgrestClient:ly.default,PostgrestQueryBuilder:cy.default,PostgrestFilterBuilder:uy.default,PostgrestTransformBuilder:dy.default,PostgrestBuilder:fy.default};const{PostgrestClient:pS,PostgrestQueryBuilder:lN,PostgrestFilterBuilder:cN,PostgrestTransformBuilder:uN,PostgrestBuilder:dN}=hS,mS="2.10.2",gS={"X-Client-Info":`realtime-js/${mS}`},vS="1.0.0",hy=1e4,yS=1e3;var Rs;(function(e){e[e.connecting=0]="connecting",e[e.open=1]="open",e[e.closing=2]="closing",e[e.closed=3]="closed"})(Rs||(Rs={}));var Et;(function(e){e.closed="closed",e.errored="errored",e.joined="joined",e.joining="joining",e.leaving="leaving"})(Et||(Et={}));var Qt;(function(e){e.close="phx_close",e.error="phx_error",e.join="phx_join",e.reply="phx_reply",e.leave="phx_leave",e.access_token="access_token"})(Qt||(Qt={}));var Tu;(function(e){e.websocket="websocket"})(Tu||(Tu={}));var kn;(function(e){e.Connecting="connecting",e.Open="open",e.Closing="closing",e.Closed="closed"})(kn||(kn={}));class xS{constructor(){this.HEADER_LENGTH=1}decode(t,r){return t.constructor===ArrayBuffer?r(this._binaryDecode(t)):r(typeof t=="string"?JSON.parse(t):{})}_binaryDecode(t){const r=new DataView(t),n=new TextDecoder;return this._decodeBroadcast(t,r,n)}_decodeBroadcast(t,r,n){const s=r.getUint8(1),a=r.getUint8(2);let i=this.HEADER_LENGTH+2;const o=n.decode(t.slice(i,i+s));i=i+s;const l=n.decode(t.slice(i,i+a));i=i+a;const u=JSON.parse(n.decode(t.slice(i,t.byteLength)));return{ref:null,topic:o,event:l,payload:u}}}class py{constructor(t,r){this.callback=t,this.timerCalc=r,this.timer=void 0,this.tries=0,this.callback=t,this.timerCalc=r}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}}var je;(function(e){e.abstime="abstime",e.bool="bool",e.date="date",e.daterange="daterange",e.float4="float4",e.float8="float8",e.int2="int2",e.int4="int4",e.int4range="int4range",e.int8="int8",e.int8range="int8range",e.json="json",e.jsonb="jsonb",e.money="money",e.numeric="numeric",e.oid="oid",e.reltime="reltime",e.text="text",e.time="time",e.timestamp="timestamp",e.timestamptz="timestamptz",e.timetz="timetz",e.tsrange="tsrange",e.tstzrange="tstzrange"})(je||(je={}));const cp=(e,t,r={})=>{var n;const s=(n=r.skipTypes)!==null&&n!==void 0?n:[];return Object.keys(t).reduce((a,i)=>(a[i]=wS(i,e,t,s),a),{})},wS=(e,t,r,n)=>{const s=t.find(o=>o.name===e),a=s==null?void 0:s.type,i=r[e];return a&&!n.includes(a)?my(a,i):Ru(i)},my=(e,t)=>{if(e.charAt(0)==="_"){const r=e.slice(1,e.length);return ES(t,r)}switch(e){case je.bool:return bS(t);case je.float4:case je.float8:case je.int2:case je.int4:case je.int8:case je.numeric:case je.oid:return _S(t);case je.json:case je.jsonb:return SS(t);case je.timestamp:return kS(t);case je.abstime:case je.date:case je.daterange:case je.int4range:case je.int8range:case je.money:case je.reltime:case je.text:case je.time:case je.timestamptz:case je.timetz:case je.tsrange:case je.tstzrange:return Ru(t);default:return Ru(t)}},Ru=e=>e,bS=e=>{switch(e){case"t":return!0;case"f":return!1;default:return e}},_S=e=>{if(typeof e=="string"){const t=parseFloat(e);if(!Number.isNaN(t))return t}return e},SS=e=>{if(typeof e=="string")try{return JSON.parse(e)}catch(t){return console.log(`JSON parse error: ${t}`),e}return e},ES=(e,t)=>{if(typeof e!="string")return e;const r=e.length-1,n=e[r];if(e[0]==="{"&&n==="}"){let a;const i=e.slice(1,r);try{a=JSON.parse("["+i+"]")}catch{a=i?i.split(","):[]}return a.map(o=>my(t,o))}return e},kS=e=>typeof e=="string"?e.replace(" ","T"):e,gy=e=>{let t=e;return t=t.replace(/^ws/i,"http"),t=t.replace(/(\/socket\/websocket|\/socket|\/websocket)\/?$/i,""),t.replace(/\/+$/,"")};class cc{constructor(t,r,n={},s=hy){this.channel=t,this.event=r,this.payload=n,this.timeout=s,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHooks=[],this.refEvent=null}resend(t){this.timeout=t,this._cancelRefEvent(),this.ref="",this.refEvent=null,this.receivedResp=null,this.sent=!1,this.send()}send(){this._hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload,ref:this.ref,join_ref:this.channel._joinRef()}))}updatePayload(t){this.payload=Object.assign(Object.assign({},this.payload),t)}receive(t,r){var n;return this._hasReceived(t)&&r((n=this.receivedResp)===null||n===void 0?void 0:n.response),this.recHooks.push({status:t,callback:r}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);const t=r=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=r,this._matchReceive(r)};this.channel._on(this.refEvent,{},t),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}trigger(t,r){this.refEvent&&this.channel._trigger(this.refEvent,{status:t,response:r})}destroy(){this._cancelRefEvent(),this._cancelTimeout()}_cancelRefEvent(){this.refEvent&&this.channel._off(this.refEvent,{})}_cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}_matchReceive({status:t,response:r}){this.recHooks.filter(n=>n.status===t).forEach(n=>n.callback(r))}_hasReceived(t){return this.receivedResp&&this.receivedResp.status===t}}var up;(function(e){e.SYNC="sync",e.JOIN="join",e.LEAVE="leave"})(up||(up={}));class za{constructor(t,r){this.channel=t,this.state={},this.pendingDiffs=[],this.joinRef=null,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};const n=(r==null?void 0:r.events)||{state:"presence_state",diff:"presence_diff"};this.channel._on(n.state,{},s=>{const{onJoin:a,onLeave:i,onSync:o}=this.caller;this.joinRef=this.channel._joinRef(),this.state=za.syncState(this.state,s,a,i),this.pendingDiffs.forEach(l=>{this.state=za.syncDiff(this.state,l,a,i)}),this.pendingDiffs=[],o()}),this.channel._on(n.diff,{},s=>{const{onJoin:a,onLeave:i,onSync:o}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(s):(this.state=za.syncDiff(this.state,s,a,i),o())}),this.onJoin((s,a,i)=>{this.channel._trigger("presence",{event:"join",key:s,currentPresences:a,newPresences:i})}),this.onLeave((s,a,i)=>{this.channel._trigger("presence",{event:"leave",key:s,currentPresences:a,leftPresences:i})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(t,r,n,s){const a=this.cloneDeep(t),i=this.transformState(r),o={},l={};return this.map(a,(u,d)=>{i[u]||(l[u]=d)}),this.map(i,(u,d)=>{const f=a[u];if(f){const h=d.map(_=>_.presence_ref),m=f.map(_=>_.presence_ref),x=d.filter(_=>m.indexOf(_.presence_ref)<0),v=f.filter(_=>h.indexOf(_.presence_ref)<0);x.length>0&&(o[u]=x),v.length>0&&(l[u]=v)}else o[u]=d}),this.syncDiff(a,{joins:o,leaves:l},n,s)}static syncDiff(t,r,n,s){const{joins:a,leaves:i}={joins:this.transformState(r.joins),leaves:this.transformState(r.leaves)};return n||(n=()=>{}),s||(s=()=>{}),this.map(a,(o,l)=>{var u;const d=(u=t[o])!==null&&u!==void 0?u:[];if(t[o]=this.cloneDeep(l),d.length>0){const f=t[o].map(m=>m.presence_ref),h=d.filter(m=>f.indexOf(m.presence_ref)<0);t[o].unshift(...h)}n(o,d,l)}),this.map(i,(o,l)=>{let u=t[o];if(!u)return;const d=l.map(f=>f.presence_ref);u=u.filter(f=>d.indexOf(f.presence_ref)<0),t[o]=u,s(o,u,l),u.length===0&&delete t[o]}),t}static map(t,r){return Object.getOwnPropertyNames(t).map(n=>r(n,t[n]))}static transformState(t){return t=this.cloneDeep(t),Object.getOwnPropertyNames(t).reduce((r,n)=>{const s=t[n];return"metas"in s?r[n]=s.metas.map(a=>(a.presence_ref=a.phx_ref,delete a.phx_ref,delete a.phx_ref_prev,a)):r[n]=s,r},{})}static cloneDeep(t){return JSON.parse(JSON.stringify(t))}onJoin(t){this.caller.onJoin=t}onLeave(t){this.caller.onLeave=t}onSync(t){this.caller.onSync=t}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel._joinRef()}}var dp;(function(e){e.ALL="*",e.INSERT="INSERT",e.UPDATE="UPDATE",e.DELETE="DELETE"})(dp||(dp={}));var fp;(function(e){e.BROADCAST="broadcast",e.PRESENCE="presence",e.POSTGRES_CHANGES="postgres_changes"})(fp||(fp={}));var hp;(function(e){e.SUBSCRIBED="SUBSCRIBED",e.TIMED_OUT="TIMED_OUT",e.CLOSED="CLOSED",e.CHANNEL_ERROR="CHANNEL_ERROR"})(hp||(hp={}));class Gd{constructor(t,r={config:{}},n){this.topic=t,this.params=r,this.socket=n,this.bindings={},this.state=Et.closed,this.joinedOnce=!1,this.pushBuffer=[],this.subTopic=t.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:""},private:!1},r.config),this.timeout=this.socket.timeout,this.joinPush=new cc(this,Qt.join,this.params,this.timeout),this.rejoinTimer=new py(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=Et.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(s=>s.send()),this.pushBuffer=[]}),this._onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=Et.closed,this.socket._remove(this)}),this._onError(s=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,s),this.state=Et.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=Et.errored,this.rejoinTimer.scheduleTimeout())}),this._on(Qt.reply,{},(s,a)=>{this._trigger(this._replyEventName(a),s)}),this.presence=new za(this),this.broadcastEndpointURL=gy(this.socket.endPoint)+"/api/broadcast"}subscribe(t,r=this.timeout){var n,s;if(this.socket.isConnected()||this.socket.connect(),this.joinedOnce)throw"tried to subscribe multiple times. 'subscribe' can only be called a single time per channel instance";{const{config:{broadcast:a,presence:i,private:o}}=this.params;this._onError(d=>t&&t("CHANNEL_ERROR",d)),this._onClose(()=>t&&t("CLOSED"));const l={},u={broadcast:a,presence:i,postgres_changes:(s=(n=this.bindings.postgres_changes)===null||n===void 0?void 0:n.map(d=>d.filter))!==null&&s!==void 0?s:[],private:o};this.socket.accessToken&&(l.access_token=this.socket.accessToken),this.updateJoinPayload(Object.assign({config:u},l)),this.joinedOnce=!0,this._rejoin(r),this.joinPush.receive("ok",({postgres_changes:d})=>{var f;if(this.socket.accessToken&&this.socket.setAuth(this.socket.accessToken),d===void 0){t&&t("SUBSCRIBED");return}else{const h=this.bindings.postgres_changes,m=(f=h==null?void 0:h.length)!==null&&f!==void 0?f:0,x=[];for(let v=0;v{t&&t("CHANNEL_ERROR",new Error(JSON.stringify(Object.values(d).join(", ")||"error")))}).receive("timeout",()=>{t&&t("TIMED_OUT")})}return this}presenceState(){return this.presence.state}async track(t,r={}){return await this.send({type:"presence",event:"track",payload:t},r.timeout||this.timeout)}async untrack(t={}){return await this.send({type:"presence",event:"untrack"},t)}on(t,r,n){return this._on(t,r,n)}async send(t,r={}){var n,s;if(!this._canPush()&&t.type==="broadcast"){const{event:a,payload:i}=t,o={method:"POST",headers:{Authorization:this.socket.accessToken?`Bearer ${this.socket.accessToken}`:"",apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"},body:JSON.stringify({messages:[{topic:this.subTopic,event:a,payload:i}]})};try{const l=await this._fetchWithTimeout(this.broadcastEndpointURL,o,(n=r.timeout)!==null&&n!==void 0?n:this.timeout);return await((s=l.body)===null||s===void 0?void 0:s.cancel()),l.ok?"ok":"error"}catch(l){return l.name==="AbortError"?"timed out":"error"}}else return new Promise(a=>{var i,o,l;const u=this._push(t.type,t,r.timeout||this.timeout);t.type==="broadcast"&&!(!((l=(o=(i=this.params)===null||i===void 0?void 0:i.config)===null||o===void 0?void 0:o.broadcast)===null||l===void 0)&&l.ack)&&a("ok"),u.receive("ok",()=>a("ok")),u.receive("error",()=>a("error")),u.receive("timeout",()=>a("timed out"))})}updateJoinPayload(t){this.joinPush.updatePayload(t)}unsubscribe(t=this.timeout){this.state=Et.leaving;const r=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(Qt.close,"leave",this._joinRef())};return this.rejoinTimer.reset(),this.joinPush.destroy(),new Promise(n=>{const s=new cc(this,Qt.leave,{},t);s.receive("ok",()=>{r(),n("ok")}).receive("timeout",()=>{r(),n("timed out")}).receive("error",()=>{n("error")}),s.send(),this._canPush()||s.trigger("ok",{})})}async _fetchWithTimeout(t,r,n){const s=new AbortController,a=setTimeout(()=>s.abort(),n),i=await this.socket.fetch(t,Object.assign(Object.assign({},r),{signal:s.signal}));return clearTimeout(a),i}_push(t,r,n=this.timeout){if(!this.joinedOnce)throw`tried to push '${t}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let s=new cc(this,t,r,n);return this._canPush()?s.send():(s.startTimeout(),this.pushBuffer.push(s)),s}_onMessage(t,r,n){return r}_isMember(t){return this.topic===t}_joinRef(){return this.joinPush.ref}_trigger(t,r,n){var s,a;const i=t.toLocaleLowerCase(),{close:o,error:l,leave:u,join:d}=Qt;if(n&&[o,l,u,d].indexOf(i)>=0&&n!==this._joinRef())return;let h=this._onMessage(i,r,n);if(r&&!h)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(i)?(s=this.bindings.postgres_changes)===null||s===void 0||s.filter(m=>{var x,v,_;return((x=m.filter)===null||x===void 0?void 0:x.event)==="*"||((_=(v=m.filter)===null||v===void 0?void 0:v.event)===null||_===void 0?void 0:_.toLocaleLowerCase())===i}).map(m=>m.callback(h,n)):(a=this.bindings[i])===null||a===void 0||a.filter(m=>{var x,v,_,y,g,w;if(["broadcast","presence","postgres_changes"].includes(i))if("id"in m){const E=m.id,C=(x=m.filter)===null||x===void 0?void 0:x.event;return E&&((v=r.ids)===null||v===void 0?void 0:v.includes(E))&&(C==="*"||(C==null?void 0:C.toLocaleLowerCase())===((_=r.data)===null||_===void 0?void 0:_.type.toLocaleLowerCase()))}else{const E=(g=(y=m==null?void 0:m.filter)===null||y===void 0?void 0:y.event)===null||g===void 0?void 0:g.toLocaleLowerCase();return E==="*"||E===((w=r==null?void 0:r.event)===null||w===void 0?void 0:w.toLocaleLowerCase())}else return m.type.toLocaleLowerCase()===i}).map(m=>{if(typeof h=="object"&&"ids"in h){const x=h.data,{schema:v,table:_,commit_timestamp:y,type:g,errors:w}=x;h=Object.assign(Object.assign({},{schema:v,table:_,commit_timestamp:y,eventType:g,new:{},old:{},errors:w}),this._getPayloadRecords(x))}m.callback(h,n)})}_isClosed(){return this.state===Et.closed}_isJoined(){return this.state===Et.joined}_isJoining(){return this.state===Et.joining}_isLeaving(){return this.state===Et.leaving}_replyEventName(t){return`chan_reply_${t}`}_on(t,r,n){const s=t.toLocaleLowerCase(),a={type:s,filter:r,callback:n};return this.bindings[s]?this.bindings[s].push(a):this.bindings[s]=[a],this}_off(t,r){const n=t.toLocaleLowerCase();return this.bindings[n]=this.bindings[n].filter(s=>{var a;return!(((a=s.type)===null||a===void 0?void 0:a.toLocaleLowerCase())===n&&Gd.isEqual(s.filter,r))}),this}static isEqual(t,r){if(Object.keys(t).length!==Object.keys(r).length)return!1;for(const n in t)if(t[n]!==r[n])return!1;return!0}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(t){this._on(Qt.close,{},t)}_onError(t){this._on(Qt.error,{},r=>t(r))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(t=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=Et.joining,this.joinPush.resend(t))}_getPayloadRecords(t){const r={new:{},old:{}};return(t.type==="INSERT"||t.type==="UPDATE")&&(r.new=cp(t.columns,t.record)),(t.type==="UPDATE"||t.type==="DELETE")&&(r.old=cp(t.columns,t.old_record)),r}}const jS=()=>{},CS=typeof WebSocket<"u";class NS{constructor(t,r){var n;this.accessToken=null,this.apiKey=null,this.channels=[],this.endPoint="",this.httpEndpoint="",this.headers=gS,this.params={},this.timeout=hy,this.heartbeatIntervalMs=3e4,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.ref=0,this.logger=jS,this.conn=null,this.sendBuffer=[],this.serializer=new xS,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this._resolveFetch=a=>{let i;return a?i=a:typeof fetch>"u"?i=(...o)=>ce(async()=>{const{default:l}=await Promise.resolve().then(()=>Ks);return{default:l}},void 0).then(({default:l})=>l(...o)):i=fetch,(...o)=>i(...o)},this.endPoint=`${t}/${Tu.websocket}`,this.httpEndpoint=gy(t),r!=null&&r.transport?this.transport=r.transport:this.transport=null,r!=null&&r.params&&(this.params=r.params),r!=null&&r.headers&&(this.headers=Object.assign(Object.assign({},this.headers),r.headers)),r!=null&&r.timeout&&(this.timeout=r.timeout),r!=null&&r.logger&&(this.logger=r.logger),r!=null&&r.heartbeatIntervalMs&&(this.heartbeatIntervalMs=r.heartbeatIntervalMs);const s=(n=r==null?void 0:r.params)===null||n===void 0?void 0:n.apikey;s&&(this.accessToken=s,this.apiKey=s),this.reconnectAfterMs=r!=null&&r.reconnectAfterMs?r.reconnectAfterMs:a=>[1e3,2e3,5e3,1e4][a-1]||1e4,this.encode=r!=null&&r.encode?r.encode:(a,i)=>i(JSON.stringify(a)),this.decode=r!=null&&r.decode?r.decode:this.serializer.decode.bind(this.serializer),this.reconnectTimer=new py(async()=>{this.disconnect(),this.connect()},this.reconnectAfterMs),this.fetch=this._resolveFetch(r==null?void 0:r.fetch)}connect(){if(!this.conn){if(this.transport){this.conn=new this.transport(this._endPointURL(),void 0,{headers:this.headers});return}if(CS){this.conn=new WebSocket(this._endPointURL()),this.setupConnection();return}this.conn=new PS(this._endPointURL(),void 0,{close:()=>{this.conn=null}}),ce(async()=>{const{default:t}=await import("./browser-BjdDG0_U.js").then(r=>r.b);return{default:t}},[]).then(({default:t})=>{this.conn=new t(this._endPointURL(),void 0,{headers:this.headers}),this.setupConnection()})}}disconnect(t,r){this.conn&&(this.conn.onclose=function(){},t?this.conn.close(t,r??""):this.conn.close(),this.conn=null,this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.reconnectTimer.reset())}getChannels(){return this.channels}async removeChannel(t){const r=await t.unsubscribe();return this.channels.length===0&&this.disconnect(),r}async removeAllChannels(){const t=await Promise.all(this.channels.map(r=>r.unsubscribe()));return this.disconnect(),t}log(t,r,n){this.logger(t,r,n)}connectionState(){switch(this.conn&&this.conn.readyState){case Rs.connecting:return kn.Connecting;case Rs.open:return kn.Open;case Rs.closing:return kn.Closing;default:return kn.Closed}}isConnected(){return this.connectionState()===kn.Open}channel(t,r={config:{}}){const n=new Gd(`realtime:${t}`,r,this);return this.channels.push(n),n}push(t){const{topic:r,event:n,payload:s,ref:a}=t,i=()=>{this.encode(t,o=>{var l;(l=this.conn)===null||l===void 0||l.send(o)})};this.log("push",`${r} ${n} (${a})`,s),this.isConnected()?i():this.sendBuffer.push(i)}setAuth(t){this.accessToken=t,this.channels.forEach(r=>{t&&r.updateJoinPayload({access_token:t}),r.joinedOnce&&r._isJoined()&&r._push(Qt.access_token,{access_token:t})})}_makeRef(){let t=this.ref+1;return t===this.ref?this.ref=0:this.ref=t,this.ref.toString()}_leaveOpenTopic(t){let r=this.channels.find(n=>n.topic===t&&(n._isJoined()||n._isJoining()));r&&(this.log("transport",`leaving duplicate topic "${t}"`),r.unsubscribe())}_remove(t){this.channels=this.channels.filter(r=>r._joinRef()!==t._joinRef())}setupConnection(){this.conn&&(this.conn.binaryType="arraybuffer",this.conn.onopen=()=>this._onConnOpen(),this.conn.onerror=t=>this._onConnError(t),this.conn.onmessage=t=>this._onConnMessage(t),this.conn.onclose=t=>this._onConnClose(t))}_endPointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:vS}))}_onConnMessage(t){this.decode(t.data,r=>{let{topic:n,event:s,payload:a,ref:i}=r;(i&&i===this.pendingHeartbeatRef||s===(a==null?void 0:a.type))&&(this.pendingHeartbeatRef=null),this.log("receive",`${a.status||""} ${n} ${s} ${i&&"("+i+")"||""}`,a),this.channels.filter(o=>o._isMember(n)).forEach(o=>o._trigger(s,a,i)),this.stateChangeCallbacks.message.forEach(o=>o(r))})}_onConnOpen(){this.log("transport",`connected to ${this._endPointURL()}`),this._flushSendBuffer(),this.reconnectTimer.reset(),this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval(()=>this._sendHeartbeat(),this.heartbeatIntervalMs),this.stateChangeCallbacks.open.forEach(t=>t())}_onConnClose(t){this.log("transport","close",t),this._triggerChanError(),this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.reconnectTimer.scheduleTimeout(),this.stateChangeCallbacks.close.forEach(r=>r(t))}_onConnError(t){this.log("transport",t.message),this._triggerChanError(),this.stateChangeCallbacks.error.forEach(r=>r(t))}_triggerChanError(){this.channels.forEach(t=>t._trigger(Qt.error))}_appendParams(t,r){if(Object.keys(r).length===0)return t;const n=t.match(/\?/)?"&":"?",s=new URLSearchParams(r);return`${t}${n}${s}`}_flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(t=>t()),this.sendBuffer=[])}_sendHeartbeat(){var t;if(this.isConnected()){if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection"),(t=this.conn)===null||t===void 0||t.close(yS,"hearbeat timeout");return}this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef}),this.setAuth(this.accessToken)}}}class PS{constructor(t,r,n){this.binaryType="arraybuffer",this.onclose=()=>{},this.onerror=()=>{},this.onmessage=()=>{},this.onopen=()=>{},this.readyState=Rs.connecting,this.send=()=>{},this.url=null,this.url=t,this.close=n.close}}class Kd extends Error{constructor(t){super(t),this.__isStorageError=!0,this.name="StorageError"}}function ot(e){return typeof e=="object"&&e!==null&&"__isStorageError"in e}class TS extends Kd{constructor(t,r){super(t),this.name="StorageApiError",this.status=r}toJSON(){return{name:this.name,message:this.message,status:this.status}}}class pp extends Kd{constructor(t,r){super(t),this.name="StorageUnknownError",this.originalError=r}}var RS=function(e,t,r,n){function s(a){return a instanceof r?a:new r(function(i){i(a)})}return new(r||(r=Promise))(function(a,i){function o(d){try{u(n.next(d))}catch(f){i(f)}}function l(d){try{u(n.throw(d))}catch(f){i(f)}}function u(d){d.done?a(d.value):s(d.value).then(o,l)}u((n=n.apply(e,t||[])).next())})};const vy=e=>{let t;return e?t=e:typeof fetch>"u"?t=(...r)=>ce(async()=>{const{default:n}=await Promise.resolve().then(()=>Ks);return{default:n}},void 0).then(({default:n})=>n(...r)):t=fetch,(...r)=>t(...r)},OS=()=>RS(void 0,void 0,void 0,function*(){return typeof Response>"u"?(yield ce(()=>Promise.resolve().then(()=>Ks),void 0)).Response:Response});var Qs=function(e,t,r,n){function s(a){return a instanceof r?a:new r(function(i){i(a)})}return new(r||(r=Promise))(function(a,i){function o(d){try{u(n.next(d))}catch(f){i(f)}}function l(d){try{u(n.throw(d))}catch(f){i(f)}}function u(d){d.done?a(d.value):s(d.value).then(o,l)}u((n=n.apply(e,t||[])).next())})};const uc=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),AS=(e,t)=>Qs(void 0,void 0,void 0,function*(){const r=yield OS();e instanceof r?e.json().then(n=>{t(new TS(uc(n),e.status||500))}).catch(n=>{t(new pp(uc(n),n))}):t(new pp(uc(e),e))}),zS=(e,t,r,n)=>{const s={method:e,headers:(t==null?void 0:t.headers)||{}};return e==="GET"?s:(s.headers=Object.assign({"Content-Type":"application/json"},t==null?void 0:t.headers),s.body=JSON.stringify(n),Object.assign(Object.assign({},s),r))};function bl(e,t,r,n,s,a){return Qs(this,void 0,void 0,function*(){return new Promise((i,o)=>{e(r,zS(t,n,s,a)).then(l=>{if(!l.ok)throw l;return n!=null&&n.noResolveJson?l:l.json()}).then(l=>i(l)).catch(l=>AS(l,o))})})}function Ou(e,t,r,n){return Qs(this,void 0,void 0,function*(){return bl(e,"GET",t,r,n)})}function Br(e,t,r,n,s){return Qs(this,void 0,void 0,function*(){return bl(e,"POST",t,n,s,r)})}function IS(e,t,r,n,s){return Qs(this,void 0,void 0,function*(){return bl(e,"PUT",t,n,s,r)})}function yy(e,t,r,n,s){return Qs(this,void 0,void 0,function*(){return bl(e,"DELETE",t,n,s,r)})}var Ot=function(e,t,r,n){function s(a){return a instanceof r?a:new r(function(i){i(a)})}return new(r||(r=Promise))(function(a,i){function o(d){try{u(n.next(d))}catch(f){i(f)}}function l(d){try{u(n.throw(d))}catch(f){i(f)}}function u(d){d.done?a(d.value):s(d.value).then(o,l)}u((n=n.apply(e,t||[])).next())})};const LS={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},mp={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};class DS{constructor(t,r={},n,s){this.url=t,this.headers=r,this.bucketId=n,this.fetch=vy(s)}uploadOrUpdate(t,r,n,s){return Ot(this,void 0,void 0,function*(){try{let a;const i=Object.assign(Object.assign({},mp),s),o=Object.assign(Object.assign({},this.headers),t==="POST"&&{"x-upsert":String(i.upsert)});typeof Blob<"u"&&n instanceof Blob?(a=new FormData,a.append("cacheControl",i.cacheControl),a.append("",n)):typeof FormData<"u"&&n instanceof FormData?(a=n,a.append("cacheControl",i.cacheControl)):(a=n,o["cache-control"]=`max-age=${i.cacheControl}`,o["content-type"]=i.contentType);const l=this._removeEmptyFolders(r),u=this._getFinalPath(l),d=yield this.fetch(`${this.url}/object/${u}`,Object.assign({method:t,body:a,headers:o},i!=null&&i.duplex?{duplex:i.duplex}:{})),f=yield d.json();return d.ok?{data:{path:l,id:f.Id,fullPath:f.Key},error:null}:{data:null,error:f}}catch(a){if(ot(a))return{data:null,error:a};throw a}})}upload(t,r,n){return Ot(this,void 0,void 0,function*(){return this.uploadOrUpdate("POST",t,r,n)})}uploadToSignedUrl(t,r,n,s){return Ot(this,void 0,void 0,function*(){const a=this._removeEmptyFolders(t),i=this._getFinalPath(a),o=new URL(this.url+`/object/upload/sign/${i}`);o.searchParams.set("token",r);try{let l;const u=Object.assign({upsert:mp.upsert},s),d=Object.assign(Object.assign({},this.headers),{"x-upsert":String(u.upsert)});typeof Blob<"u"&&n instanceof Blob?(l=new FormData,l.append("cacheControl",u.cacheControl),l.append("",n)):typeof FormData<"u"&&n instanceof FormData?(l=n,l.append("cacheControl",u.cacheControl)):(l=n,d["cache-control"]=`max-age=${u.cacheControl}`,d["content-type"]=u.contentType);const f=yield this.fetch(o.toString(),{method:"PUT",body:l,headers:d}),h=yield f.json();return f.ok?{data:{path:a,fullPath:h.Key},error:null}:{data:null,error:h}}catch(l){if(ot(l))return{data:null,error:l};throw l}})}createSignedUploadUrl(t,r){return Ot(this,void 0,void 0,function*(){try{let n=this._getFinalPath(t);const s=Object.assign({},this.headers);r!=null&&r.upsert&&(s["x-upsert"]="true");const a=yield Br(this.fetch,`${this.url}/object/upload/sign/${n}`,{},{headers:s}),i=new URL(this.url+a.url),o=i.searchParams.get("token");if(!o)throw new Kd("No token returned by API");return{data:{signedUrl:i.toString(),path:t,token:o},error:null}}catch(n){if(ot(n))return{data:null,error:n};throw n}})}update(t,r,n){return Ot(this,void 0,void 0,function*(){return this.uploadOrUpdate("PUT",t,r,n)})}move(t,r,n){return Ot(this,void 0,void 0,function*(){try{return{data:yield Br(this.fetch,`${this.url}/object/move`,{bucketId:this.bucketId,sourceKey:t,destinationKey:r,destinationBucket:n==null?void 0:n.destinationBucket},{headers:this.headers}),error:null}}catch(s){if(ot(s))return{data:null,error:s};throw s}})}copy(t,r,n){return Ot(this,void 0,void 0,function*(){try{return{data:{path:(yield Br(this.fetch,`${this.url}/object/copy`,{bucketId:this.bucketId,sourceKey:t,destinationKey:r,destinationBucket:n==null?void 0:n.destinationBucket},{headers:this.headers})).Key},error:null}}catch(s){if(ot(s))return{data:null,error:s};throw s}})}createSignedUrl(t,r,n){return Ot(this,void 0,void 0,function*(){try{let s=this._getFinalPath(t),a=yield Br(this.fetch,`${this.url}/object/sign/${s}`,Object.assign({expiresIn:r},n!=null&&n.transform?{transform:n.transform}:{}),{headers:this.headers});const i=n!=null&&n.download?`&download=${n.download===!0?"":n.download}`:"";return a={signedUrl:encodeURI(`${this.url}${a.signedURL}${i}`)},{data:a,error:null}}catch(s){if(ot(s))return{data:null,error:s};throw s}})}createSignedUrls(t,r,n){return Ot(this,void 0,void 0,function*(){try{const s=yield Br(this.fetch,`${this.url}/object/sign/${this.bucketId}`,{expiresIn:r,paths:t},{headers:this.headers}),a=n!=null&&n.download?`&download=${n.download===!0?"":n.download}`:"";return{data:s.map(i=>Object.assign(Object.assign({},i),{signedUrl:i.signedURL?encodeURI(`${this.url}${i.signedURL}${a}`):null})),error:null}}catch(s){if(ot(s))return{data:null,error:s};throw s}})}download(t,r){return Ot(this,void 0,void 0,function*(){const s=typeof(r==null?void 0:r.transform)<"u"?"render/image/authenticated":"object",a=this.transformOptsToQueryString((r==null?void 0:r.transform)||{}),i=a?`?${a}`:"";try{const o=this._getFinalPath(t);return{data:yield(yield Ou(this.fetch,`${this.url}/${s}/${o}${i}`,{headers:this.headers,noResolveJson:!0})).blob(),error:null}}catch(o){if(ot(o))return{data:null,error:o};throw o}})}getPublicUrl(t,r){const n=this._getFinalPath(t),s=[],a=r!=null&&r.download?`download=${r.download===!0?"":r.download}`:"";a!==""&&s.push(a);const o=typeof(r==null?void 0:r.transform)<"u"?"render/image":"object",l=this.transformOptsToQueryString((r==null?void 0:r.transform)||{});l!==""&&s.push(l);let u=s.join("&");return u!==""&&(u=`?${u}`),{data:{publicUrl:encodeURI(`${this.url}/${o}/public/${n}${u}`)}}}remove(t){return Ot(this,void 0,void 0,function*(){try{return{data:yield yy(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:t},{headers:this.headers}),error:null}}catch(r){if(ot(r))return{data:null,error:r};throw r}})}list(t,r,n){return Ot(this,void 0,void 0,function*(){try{const s=Object.assign(Object.assign(Object.assign({},LS),r),{prefix:t||""});return{data:yield Br(this.fetch,`${this.url}/object/list/${this.bucketId}`,s,{headers:this.headers},n),error:null}}catch(s){if(ot(s))return{data:null,error:s};throw s}})}_getFinalPath(t){return`${this.bucketId}/${t}`}_removeEmptyFolders(t){return t.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(t){const r=[];return t.width&&r.push(`width=${t.width}`),t.height&&r.push(`height=${t.height}`),t.resize&&r.push(`resize=${t.resize}`),t.format&&r.push(`format=${t.format}`),t.quality&&r.push(`quality=${t.quality}`),r.join("&")}}const $S="2.6.0",MS={"X-Client-Info":`storage-js/${$S}`};var ns=function(e,t,r,n){function s(a){return a instanceof r?a:new r(function(i){i(a)})}return new(r||(r=Promise))(function(a,i){function o(d){try{u(n.next(d))}catch(f){i(f)}}function l(d){try{u(n.throw(d))}catch(f){i(f)}}function u(d){d.done?a(d.value):s(d.value).then(o,l)}u((n=n.apply(e,t||[])).next())})};class FS{constructor(t,r={},n){this.url=t,this.headers=Object.assign(Object.assign({},MS),r),this.fetch=vy(n)}listBuckets(){return ns(this,void 0,void 0,function*(){try{return{data:yield Ou(this.fetch,`${this.url}/bucket`,{headers:this.headers}),error:null}}catch(t){if(ot(t))return{data:null,error:t};throw t}})}getBucket(t){return ns(this,void 0,void 0,function*(){try{return{data:yield Ou(this.fetch,`${this.url}/bucket/${t}`,{headers:this.headers}),error:null}}catch(r){if(ot(r))return{data:null,error:r};throw r}})}createBucket(t,r={public:!1}){return ns(this,void 0,void 0,function*(){try{return{data:yield Br(this.fetch,`${this.url}/bucket`,{id:t,name:t,public:r.public,file_size_limit:r.fileSizeLimit,allowed_mime_types:r.allowedMimeTypes},{headers:this.headers}),error:null}}catch(n){if(ot(n))return{data:null,error:n};throw n}})}updateBucket(t,r){return ns(this,void 0,void 0,function*(){try{return{data:yield IS(this.fetch,`${this.url}/bucket/${t}`,{id:t,name:t,public:r.public,file_size_limit:r.fileSizeLimit,allowed_mime_types:r.allowedMimeTypes},{headers:this.headers}),error:null}}catch(n){if(ot(n))return{data:null,error:n};throw n}})}emptyBucket(t){return ns(this,void 0,void 0,function*(){try{return{data:yield Br(this.fetch,`${this.url}/bucket/${t}/empty`,{},{headers:this.headers}),error:null}}catch(r){if(ot(r))return{data:null,error:r};throw r}})}deleteBucket(t){return ns(this,void 0,void 0,function*(){try{return{data:yield yy(this.fetch,`${this.url}/bucket/${t}`,{},{headers:this.headers}),error:null}}catch(r){if(ot(r))return{data:null,error:r};throw r}})}}class US extends FS{constructor(t,r={},n){super(t,r,n)}from(t){return new DS(this.url,this.headers,t,this.fetch)}}const BS="2.44.4";let Ea="";typeof Deno<"u"?Ea="deno":typeof document<"u"?Ea="web":typeof navigator<"u"&&navigator.product==="ReactNative"?Ea="react-native":Ea="node";const VS={"X-Client-Info":`supabase-js-${Ea}/${BS}`},HS={headers:VS},WS={schema:"public"},qS={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},GS={};var KS=function(e,t,r,n){function s(a){return a instanceof r?a:new r(function(i){i(a)})}return new(r||(r=Promise))(function(a,i){function o(d){try{u(n.next(d))}catch(f){i(f)}}function l(d){try{u(n.throw(d))}catch(f){i(f)}}function u(d){d.done?a(d.value):s(d.value).then(o,l)}u((n=n.apply(e,t||[])).next())})};const QS=e=>{let t;return e?t=e:typeof fetch>"u"?t=ny:t=fetch,(...r)=>t(...r)},YS=()=>typeof Headers>"u"?sy:Headers,JS=(e,t,r)=>{const n=QS(r),s=YS();return(a,i)=>KS(void 0,void 0,void 0,function*(){var o;const l=(o=yield t())!==null&&o!==void 0?o:e;let u=new s(i==null?void 0:i.headers);return u.has("apikey")||u.set("apikey",e),u.has("Authorization")||u.set("Authorization",`Bearer ${l}`),n(a,Object.assign(Object.assign({},i),{headers:u}))})};function XS(e){return e.replace(/\/$/,"")}function ZS(e,t){const{db:r,auth:n,realtime:s,global:a}=e,{db:i,auth:o,realtime:l,global:u}=t;return{db:Object.assign(Object.assign({},i),r),auth:Object.assign(Object.assign({},o),n),realtime:Object.assign(Object.assign({},l),s),global:Object.assign(Object.assign({},u),a)}}const xy="2.64.4",eE="http://localhost:9999",tE="supabase.auth.token",rE={"X-Client-Info":`gotrue-js/${xy}`},gp=10,Au="X-Supabase-Api-Version",wy={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}};function nE(e){return Math.round(Date.now()/1e3)+e}function sE(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){const t=Math.random()*16|0;return(e=="x"?t:t&3|8).toString(16)})}const Wt=()=>typeof document<"u",gn={tested:!1,writable:!1},Ia=()=>{if(!Wt())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(gn.tested)return gn.writable;const e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),gn.tested=!0,gn.writable=!0}catch{gn.tested=!0,gn.writable=!1}return gn.writable};function dc(e){const t={},r=new URL(e);if(r.hash&&r.hash[0]==="#")try{new URLSearchParams(r.hash.substring(1)).forEach((s,a)=>{t[a]=s})}catch{}return r.searchParams.forEach((n,s)=>{t[s]=n}),t}const by=e=>{let t;return e?t=e:typeof fetch>"u"?t=(...r)=>ce(async()=>{const{default:n}=await Promise.resolve().then(()=>Ks);return{default:n}},void 0).then(({default:n})=>n(...r)):t=fetch,(...r)=>t(...r)},aE=e=>typeof e=="object"&&e!==null&&"status"in e&&"ok"in e&&"json"in e&&typeof e.json=="function",_y=async(e,t,r)=>{await e.setItem(t,JSON.stringify(r))},Ui=async(e,t)=>{const r=await e.getItem(t);if(!r)return null;try{return JSON.parse(r)}catch{return r}},fc=async(e,t)=>{await e.removeItem(t)};function iE(e){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";let r="",n,s,a,i,o,l,u,d=0;for(e=e.replace("-","+").replace("_","/");d>4,s=(o&15)<<4|l>>2,a=(l&3)<<6|u,r=r+String.fromCharCode(n),l!=64&&s!=0&&(r=r+String.fromCharCode(s)),u!=64&&a!=0&&(r=r+String.fromCharCode(a));return r}class _l{constructor(){this.promise=new _l.promiseConstructor((t,r)=>{this.resolve=t,this.reject=r})}}_l.promiseConstructor=Promise;function vp(e){const t=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}=?$|[a-z0-9_-]{2}(==)?$)$/i,r=e.split(".");if(r.length!==3)throw new Error("JWT is not valid: not a JWT structure");if(!t.test(r[1]))throw new Error("JWT is not valid: payload is not in base64url format");const n=r[1];return JSON.parse(iE(n))}async function oE(e){return await new Promise(t=>{setTimeout(()=>t(null),e)})}function lE(e,t){return new Promise((n,s)=>{(async()=>{for(let a=0;a<1/0;a++)try{const i=await e(a);if(!t(a,null,i)){n(i);return}}catch(i){if(!t(a,i)){s(i);return}}})()})}function cE(e){return("0"+e.toString(16)).substr(-2)}function uE(){const t=new Uint32Array(56);if(typeof crypto>"u"){const r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",n=r.length;let s="";for(let a=0;a<56;a++)s+=r.charAt(Math.floor(Math.random()*n));return s}return crypto.getRandomValues(t),Array.from(t,cE).join("")}async function dE(e){const r=new TextEncoder().encode(e),n=await crypto.subtle.digest("SHA-256",r),s=new Uint8Array(n);return Array.from(s).map(a=>String.fromCharCode(a)).join("")}function fE(e){return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function hE(e){if(!(typeof crypto<"u"&&typeof crypto.subtle<"u"&&typeof TextEncoder<"u"))return console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),e;const r=await dE(e);return fE(r)}async function ss(e,t,r=!1){const n=uE();let s=n;r&&(s+="/PASSWORD_RECOVERY"),await _y(e,`${t}-code-verifier`,s);const a=await hE(n);return[a,n===a?"plain":"s256"]}const pE=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function mE(e){const t=e.headers.get(Au);if(!t||!t.match(pE))return null;try{return new Date(`${t}T00:00:00.0Z`)}catch{return null}}class Qd extends Error{constructor(t,r,n){super(t),this.__isAuthError=!0,this.name="AuthError",this.status=r,this.code=n}}function se(e){return typeof e=="object"&&e!==null&&"__isAuthError"in e}class gE extends Qd{constructor(t,r,n){super(t,r,n),this.name="AuthApiError",this.status=r,this.code=n}}function vE(e){return se(e)&&e.name==="AuthApiError"}class Sy extends Qd{constructor(t,r){super(t),this.name="AuthUnknownError",this.originalError=r}}class qn extends Qd{constructor(t,r,n,s){super(t,n,s),this.name=r,this.status=n}}class vn extends qn{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}class hc extends qn{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class Bi extends qn{constructor(t){super(t,"AuthInvalidCredentialsError",400,void 0)}}class Vi extends qn{constructor(t,r=null){super(t,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=r}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class yp extends qn{constructor(t,r=null){super(t,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=r}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class zu extends qn{constructor(t,r){super(t,"AuthRetryableFetchError",r,void 0)}}function pc(e){return se(e)&&e.name==="AuthRetryableFetchError"}class xp extends qn{constructor(t,r,n){super(t,"AuthWeakPasswordError",r,"weak_password"),this.reasons=n}}var yE=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(e);se.msg||e.message||e.error_description||e.error||JSON.stringify(e),xE=[502,503,504];async function wp(e){var t;if(!aE(e))throw new zu(bn(e),0);if(xE.includes(e.status))throw new zu(bn(e),e.status);let r;try{r=await e.json()}catch(a){throw new Sy(bn(a),a)}let n;const s=mE(e);if(s&&s.getTime()>=wy["2024-01-01"].timestamp&&typeof r=="object"&&r&&typeof r.code=="string"?n=r.code:typeof r=="object"&&r&&typeof r.error_code=="string"&&(n=r.error_code),n){if(n==="weak_password")throw new xp(bn(r),e.status,((t=r.weak_password)===null||t===void 0?void 0:t.reasons)||[])}else if(typeof r=="object"&&r&&typeof r.weak_password=="object"&&r.weak_password&&Array.isArray(r.weak_password.reasons)&&r.weak_password.reasons.length&&r.weak_password.reasons.reduce((a,i)=>a&&typeof i=="string",!0))throw new xp(bn(r),e.status,r.weak_password.reasons);throw new gE(bn(r),e.status||500,n)}const wE=(e,t,r,n)=>{const s={method:e,headers:(t==null?void 0:t.headers)||{}};return e==="GET"?s:(s.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},t==null?void 0:t.headers),s.body=JSON.stringify(n),Object.assign(Object.assign({},s),r))};async function oe(e,t,r,n){var s;const a=Object.assign({},n==null?void 0:n.headers);a[Au]||(a[Au]=wy["2024-01-01"].name),n!=null&&n.jwt&&(a.Authorization=`Bearer ${n.jwt}`);const i=(s=n==null?void 0:n.query)!==null&&s!==void 0?s:{};n!=null&&n.redirectTo&&(i.redirect_to=n.redirectTo);const o=Object.keys(i).length?"?"+new URLSearchParams(i).toString():"",l=await bE(e,t,r+o,{headers:a,noResolveJson:n==null?void 0:n.noResolveJson},{},n==null?void 0:n.body);return n!=null&&n.xform?n==null?void 0:n.xform(l):{data:Object.assign({},l),error:null}}async function bE(e,t,r,n,s,a){const i=wE(t,n,s,a);let o;try{o=await e(r,Object.assign({},i))}catch(l){throw console.error(l),new zu(bn(l),0)}if(o.ok||await wp(o),n!=null&&n.noResolveJson)return o;try{return await o.json()}catch(l){await wp(l)}}function $r(e){var t;let r=null;kE(e)&&(r=Object.assign({},e),e.expires_at||(r.expires_at=nE(e.expires_in)));const n=(t=e.user)!==null&&t!==void 0?t:e;return{data:{session:r,user:n},error:null}}function bp(e){const t=$r(e);return!t.error&&e.weak_password&&typeof e.weak_password=="object"&&Array.isArray(e.weak_password.reasons)&&e.weak_password.reasons.length&&e.weak_password.message&&typeof e.weak_password.message=="string"&&e.weak_password.reasons.reduce((r,n)=>r&&typeof n=="string",!0)&&(t.data.weak_password=e.weak_password),t}function Wr(e){var t;return{data:{user:(t=e.user)!==null&&t!==void 0?t:e},error:null}}function _E(e){return{data:e,error:null}}function SE(e){const{action_link:t,email_otp:r,hashed_token:n,redirect_to:s,verification_type:a}=e,i=yE(e,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),o={action_link:t,email_otp:r,hashed_token:n,redirect_to:s,verification_type:a},l=Object.assign({},i);return{data:{properties:o,user:l},error:null}}function EE(e){return e}function kE(e){return e.access_token&&e.refresh_token&&e.expires_in}var jE=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(e);s0&&(m.forEach(x=>{const v=parseInt(x.split(";")[0].split("=")[1].substring(0,1)),_=JSON.parse(x.split(";")[1].split("=")[1]);u[`${_}Page`]=v}),u.total=parseInt(h)),{data:Object.assign(Object.assign({},f),u),error:null}}catch(u){if(se(u))return{data:{users:[]},error:u};throw u}}async getUserById(t){try{return await oe(this.fetch,"GET",`${this.url}/admin/users/${t}`,{headers:this.headers,xform:Wr})}catch(r){if(se(r))return{data:{user:null},error:r};throw r}}async updateUserById(t,r){try{return await oe(this.fetch,"PUT",`${this.url}/admin/users/${t}`,{body:r,headers:this.headers,xform:Wr})}catch(n){if(se(n))return{data:{user:null},error:n};throw n}}async deleteUser(t,r=!1){try{return await oe(this.fetch,"DELETE",`${this.url}/admin/users/${t}`,{headers:this.headers,body:{should_soft_delete:r},xform:Wr})}catch(n){if(se(n))return{data:{user:null},error:n};throw n}}async _listFactors(t){try{const{data:r,error:n}=await oe(this.fetch,"GET",`${this.url}/admin/users/${t.userId}/factors`,{headers:this.headers,xform:s=>({data:{factors:s},error:null})});return{data:r,error:n}}catch(r){if(se(r))return{data:null,error:r};throw r}}async _deleteFactor(t){try{return{data:await oe(this.fetch,"DELETE",`${this.url}/admin/users/${t.userId}/factors/${t.id}`,{headers:this.headers}),error:null}}catch(r){if(se(r))return{data:null,error:r};throw r}}}const NE={getItem:e=>Ia()?globalThis.localStorage.getItem(e):null,setItem:(e,t)=>{Ia()&&globalThis.localStorage.setItem(e,t)},removeItem:e=>{Ia()&&globalThis.localStorage.removeItem(e)}};function _p(e={}){return{getItem:t=>e[t]||null,setItem:(t,r)=>{e[t]=r},removeItem:t=>{delete e[t]}}}function PE(){if(typeof globalThis!="object")try{Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch{typeof self<"u"&&(self.globalThis=self)}}const as={debug:!!(globalThis&&Ia()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class Ey extends Error{constructor(t){super(t),this.isAcquireTimeout=!0}}class TE extends Ey{}async function RE(e,t,r){as.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",e,t);const n=new globalThis.AbortController;return t>0&&setTimeout(()=>{n.abort(),as.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",e)},t),await globalThis.navigator.locks.request(e,t===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:n.signal},async s=>{if(s){as.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",e,s.name);try{return await r()}finally{as.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",e,s.name)}}else{if(t===0)throw as.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",e),new TE(`Acquiring an exclusive Navigator LockManager lock "${e}" immediately failed`);if(as.debug)try{const a=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(a,null," "))}catch(a){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",a)}return console.warn("@supabase/gotrue-js: Navigator LockManager returned a null lock when using #request without ifAvailable set to true, it appears this browser is not following the LockManager spec https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request"),await r()}})}PE();const OE={url:eE,storageKey:tE,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:rE,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1},ga=30*1e3,Sp=3;async function Ep(e,t,r){return await r()}class ni{constructor(t){var r,n;this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log,this.instanceID=ni.nextInstanceID,ni.nextInstanceID+=1,this.instanceID>0&&Wt()&&console.warn("Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.");const s=Object.assign(Object.assign({},OE),t);if(this.logDebugMessages=!!s.debug,typeof s.debug=="function"&&(this.logger=s.debug),this.persistSession=s.persistSession,this.storageKey=s.storageKey,this.autoRefreshToken=s.autoRefreshToken,this.admin=new CE({url:s.url,headers:s.headers,fetch:s.fetch}),this.url=s.url,this.headers=s.headers,this.fetch=by(s.fetch),this.lock=s.lock||Ep,this.detectSessionInUrl=s.detectSessionInUrl,this.flowType=s.flowType,this.hasCustomAuthorizationHeader=s.hasCustomAuthorizationHeader,s.lock?this.lock=s.lock:Wt()&&(!((r=globalThis==null?void 0:globalThis.navigator)===null||r===void 0)&&r.locks)?this.lock=RE:this.lock=Ep,this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this)},this.persistSession?s.storage?this.storage=s.storage:Ia()?this.storage=NE:(this.memoryStorage={},this.storage=_p(this.memoryStorage)):(this.memoryStorage={},this.storage=_p(this.memoryStorage)),Wt()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(a){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",a)}(n=this.broadcastChannel)===null||n===void 0||n.addEventListener("message",async a=>{this._debug("received broadcast notification from other tab or client",a),await this._notifyAllSubscribers(a.data.event,a.data.session,!1)})}this.initialize()}_debug(...t){return this.logDebugMessages&&this.logger(`GoTrueClient@${this.instanceID} (${xy}) ${new Date().toISOString()}`,...t),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>await this._acquireLock(-1,async()=>await this._initialize()))(),await this.initializePromise)}async _initialize(){try{const t=Wt()?await this._isPKCEFlow():!1;if(this._debug("#_initialize()","begin","is PKCE flow",t),t||this.detectSessionInUrl&&this._isImplicitGrantFlow()){const{data:r,error:n}=await this._getSessionFromURL(t);if(n)return this._debug("#_initialize()","error detecting session from URL",n),(n==null?void 0:n.message)==="Identity is already linked"||(n==null?void 0:n.message)==="Identity is already linked to another user"?{error:n}:(await this._removeSession(),{error:n});const{session:s,redirectType:a}=r;return this._debug("#_initialize()","detected session in URL",s,"redirect type",a),await this._saveSession(s),setTimeout(async()=>{a==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",s):await this._notifyAllSubscribers("SIGNED_IN",s)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(t){return se(t)?{error:t}:{error:new Sy("Unexpected error during initialization",t)}}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(t){var r,n,s;try{const a=await oe(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(n=(r=t==null?void 0:t.options)===null||r===void 0?void 0:r.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:(s=t==null?void 0:t.options)===null||s===void 0?void 0:s.captchaToken}},xform:$r}),{data:i,error:o}=a;if(o||!i)return{data:{user:null,session:null},error:o};const l=i.session,u=i.user;return i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers("SIGNED_IN",l)),{data:{user:u,session:l},error:null}}catch(a){if(se(a))return{data:{user:null,session:null},error:a};throw a}}async signUp(t){var r,n,s;try{let a;if("email"in t){const{email:d,password:f,options:h}=t;let m=null,x=null;this.flowType==="pkce"&&([m,x]=await ss(this.storage,this.storageKey)),a=await oe(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:h==null?void 0:h.emailRedirectTo,body:{email:d,password:f,data:(r=h==null?void 0:h.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:h==null?void 0:h.captchaToken},code_challenge:m,code_challenge_method:x},xform:$r})}else if("phone"in t){const{phone:d,password:f,options:h}=t;a=await oe(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:d,password:f,data:(n=h==null?void 0:h.data)!==null&&n!==void 0?n:{},channel:(s=h==null?void 0:h.channel)!==null&&s!==void 0?s:"sms",gotrue_meta_security:{captcha_token:h==null?void 0:h.captchaToken}},xform:$r})}else throw new Bi("You must provide either an email or phone number and a password");const{data:i,error:o}=a;if(o||!i)return{data:{user:null,session:null},error:o};const l=i.session,u=i.user;return i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers("SIGNED_IN",l)),{data:{user:u,session:l},error:null}}catch(a){if(se(a))return{data:{user:null,session:null},error:a};throw a}}async signInWithPassword(t){try{let r;if("email"in t){const{email:a,password:i,options:o}=t;r=await oe(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:a,password:i,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken}},xform:bp})}else if("phone"in t){const{phone:a,password:i,options:o}=t;r=await oe(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:a,password:i,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken}},xform:bp})}else throw new Bi("You must provide either an email or phone number and a password");const{data:n,error:s}=r;return s?{data:{user:null,session:null},error:s}:!n||!n.session||!n.user?{data:{user:null,session:null},error:new hc}:(n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers("SIGNED_IN",n.session)),{data:Object.assign({user:n.user,session:n.session},n.weak_password?{weakPassword:n.weak_password}:null),error:s})}catch(r){if(se(r))return{data:{user:null,session:null},error:r};throw r}}async signInWithOAuth(t){var r,n,s,a;return await this._handleProviderSignIn(t.provider,{redirectTo:(r=t.options)===null||r===void 0?void 0:r.redirectTo,scopes:(n=t.options)===null||n===void 0?void 0:n.scopes,queryParams:(s=t.options)===null||s===void 0?void 0:s.queryParams,skipBrowserRedirect:(a=t.options)===null||a===void 0?void 0:a.skipBrowserRedirect})}async exchangeCodeForSession(t){return await this.initializePromise,this._acquireLock(-1,async()=>this._exchangeCodeForSession(t))}async _exchangeCodeForSession(t){const r=await Ui(this.storage,`${this.storageKey}-code-verifier`),[n,s]=(r??"").split("/"),{data:a,error:i}=await oe(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:t,code_verifier:n},xform:$r});return await fc(this.storage,`${this.storageKey}-code-verifier`),i?{data:{user:null,session:null,redirectType:null},error:i}:!a||!a.session||!a.user?{data:{user:null,session:null,redirectType:null},error:new hc}:(a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",a.session)),{data:Object.assign(Object.assign({},a),{redirectType:s??null}),error:i})}async signInWithIdToken(t){try{const{options:r,provider:n,token:s,access_token:a,nonce:i}=t,o=await oe(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:n,id_token:s,access_token:a,nonce:i,gotrue_meta_security:{captcha_token:r==null?void 0:r.captchaToken}},xform:$r}),{data:l,error:u}=o;return u?{data:{user:null,session:null},error:u}:!l||!l.session||!l.user?{data:{user:null,session:null},error:new hc}:(l.session&&(await this._saveSession(l.session),await this._notifyAllSubscribers("SIGNED_IN",l.session)),{data:l,error:u})}catch(r){if(se(r))return{data:{user:null,session:null},error:r};throw r}}async signInWithOtp(t){var r,n,s,a,i;try{if("email"in t){const{email:o,options:l}=t;let u=null,d=null;this.flowType==="pkce"&&([u,d]=await ss(this.storage,this.storageKey));const{error:f}=await oe(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:o,data:(r=l==null?void 0:l.data)!==null&&r!==void 0?r:{},create_user:(n=l==null?void 0:l.shouldCreateUser)!==null&&n!==void 0?n:!0,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken},code_challenge:u,code_challenge_method:d},redirectTo:l==null?void 0:l.emailRedirectTo});return{data:{user:null,session:null},error:f}}if("phone"in t){const{phone:o,options:l}=t,{data:u,error:d}=await oe(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:o,data:(s=l==null?void 0:l.data)!==null&&s!==void 0?s:{},create_user:(a=l==null?void 0:l.shouldCreateUser)!==null&&a!==void 0?a:!0,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken},channel:(i=l==null?void 0:l.channel)!==null&&i!==void 0?i:"sms"}});return{data:{user:null,session:null,messageId:u==null?void 0:u.message_id},error:d}}throw new Bi("You must provide either an email or phone number.")}catch(o){if(se(o))return{data:{user:null,session:null},error:o};throw o}}async verifyOtp(t){var r,n;try{let s,a;"options"in t&&(s=(r=t.options)===null||r===void 0?void 0:r.redirectTo,a=(n=t.options)===null||n===void 0?void 0:n.captchaToken);const{data:i,error:o}=await oe(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},t),{gotrue_meta_security:{captcha_token:a}}),redirectTo:s,xform:$r});if(o)throw o;if(!i)throw new Error("An error occurred on token verification.");const l=i.session,u=i.user;return l!=null&&l.access_token&&(await this._saveSession(l),await this._notifyAllSubscribers(t.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",l)),{data:{user:u,session:l},error:null}}catch(s){if(se(s))return{data:{user:null,session:null},error:s};throw s}}async signInWithSSO(t){var r,n,s;try{let a=null,i=null;return this.flowType==="pkce"&&([a,i]=await ss(this.storage,this.storageKey)),await oe(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in t?{provider_id:t.providerId}:null),"domain"in t?{domain:t.domain}:null),{redirect_to:(n=(r=t.options)===null||r===void 0?void 0:r.redirectTo)!==null&&n!==void 0?n:void 0}),!((s=t==null?void 0:t.options)===null||s===void 0)&&s.captchaToken?{gotrue_meta_security:{captcha_token:t.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:a,code_challenge_method:i}),headers:this.headers,xform:_E})}catch(a){if(se(a))return{data:null,error:a};throw a}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async t=>{const{data:{session:r},error:n}=t;if(n)throw n;if(!r)throw new vn;const{error:s}=await oe(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:r.access_token});return{data:{user:null,session:null},error:s}})}catch(t){if(se(t))return{data:{user:null,session:null},error:t};throw t}}async resend(t){try{const r=`${this.url}/resend`;if("email"in t){const{email:n,type:s,options:a}=t,{error:i}=await oe(this.fetch,"POST",r,{headers:this.headers,body:{email:n,type:s,gotrue_meta_security:{captcha_token:a==null?void 0:a.captchaToken}},redirectTo:a==null?void 0:a.emailRedirectTo});return{data:{user:null,session:null},error:i}}else if("phone"in t){const{phone:n,type:s,options:a}=t,{data:i,error:o}=await oe(this.fetch,"POST",r,{headers:this.headers,body:{phone:n,type:s,gotrue_meta_security:{captcha_token:a==null?void 0:a.captchaToken}}});return{data:{user:null,session:null,messageId:i==null?void 0:i.message_id},error:o}}throw new Bi("You must provide either an email or phone number and a type")}catch(r){if(se(r))return{data:{user:null,session:null},error:r};throw r}}async getSession(){return await this.initializePromise,await this._acquireLock(-1,async()=>this._useSession(async r=>r))}async _acquireLock(t,r){this._debug("#_acquireLock","begin",t);try{if(this.lockAcquired){const n=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),s=(async()=>(await n,await r()))();return this.pendingInLock.push((async()=>{try{await s}catch{}})()),s}return await this.lock(`lock:${this.storageKey}`,t,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const n=r();for(this.pendingInLock.push((async()=>{try{await n}catch{}})()),await n;this.pendingInLock.length;){const s=[...this.pendingInLock];await Promise.all(s),this.pendingInLock.splice(0,s.length)}return await n}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(t){this._debug("#_useSession","begin");try{const r=await this.__loadSession();return await t(r)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let t=null;const r=await Ui(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",r),r!==null&&(this._isValidSession(r)?t=r:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!t)return{data:{session:null},error:null};const n=t.expires_at?t.expires_at<=Date.now()/1e3:!1;if(this._debug("#__loadSession()",`session has${n?"":" not"} expired`,"expires_at",t.expires_at),!n){if(this.storage.isServer){let i=this.suppressGetSessionWarning;t=new Proxy(t,{get:(l,u,d)=>(!i&&u==="user"&&(console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and many not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),i=!0,this.suppressGetSessionWarning=!0),Reflect.get(l,u,d))})}return{data:{session:t},error:null}}const{session:s,error:a}=await this._callRefreshToken(t.refresh_token);return a?{data:{session:null},error:a}:{data:{session:s},error:null}}finally{this._debug("#__loadSession()","end")}}async getUser(t){return t?await this._getUser(t):(await this.initializePromise,await this._acquireLock(-1,async()=>await this._getUser()))}async _getUser(t){try{return t?await oe(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:t,xform:Wr}):await this._useSession(async r=>{var n,s,a;const{data:i,error:o}=r;if(o)throw o;return!(!((n=i.session)===null||n===void 0)&&n.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new vn}:await oe(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(a=(s=i.session)===null||s===void 0?void 0:s.access_token)!==null&&a!==void 0?a:void 0,xform:Wr})})}catch(r){if(se(r))return{data:{user:null},error:r};throw r}}async updateUser(t,r={}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._updateUser(t,r))}async _updateUser(t,r={}){try{return await this._useSession(async n=>{const{data:s,error:a}=n;if(a)throw a;if(!s.session)throw new vn;const i=s.session;let o=null,l=null;this.flowType==="pkce"&&t.email!=null&&([o,l]=await ss(this.storage,this.storageKey));const{data:u,error:d}=await oe(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:r==null?void 0:r.emailRedirectTo,body:Object.assign(Object.assign({},t),{code_challenge:o,code_challenge_method:l}),jwt:i.access_token,xform:Wr});if(d)throw d;return i.user=u.user,await this._saveSession(i),await this._notifyAllSubscribers("USER_UPDATED",i),{data:{user:i.user},error:null}})}catch(n){if(se(n))return{data:{user:null},error:n};throw n}}_decodeJWT(t){return vp(t)}async setSession(t){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._setSession(t))}async _setSession(t){try{if(!t.access_token||!t.refresh_token)throw new vn;const r=Date.now()/1e3;let n=r,s=!0,a=null;const i=vp(t.access_token);if(i.exp&&(n=i.exp,s=n<=r),s){const{session:o,error:l}=await this._callRefreshToken(t.refresh_token);if(l)return{data:{user:null,session:null},error:l};if(!o)return{data:{user:null,session:null},error:null};a=o}else{const{data:o,error:l}=await this._getUser(t.access_token);if(l)throw l;a={access_token:t.access_token,refresh_token:t.refresh_token,user:o.user,token_type:"bearer",expires_in:n-r,expires_at:n},await this._saveSession(a),await this._notifyAllSubscribers("SIGNED_IN",a)}return{data:{user:a.user,session:a},error:null}}catch(r){if(se(r))return{data:{session:null,user:null},error:r};throw r}}async refreshSession(t){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._refreshSession(t))}async _refreshSession(t){try{return await this._useSession(async r=>{var n;if(!t){const{data:i,error:o}=r;if(o)throw o;t=(n=i.session)!==null&&n!==void 0?n:void 0}if(!(t!=null&&t.refresh_token))throw new vn;const{session:s,error:a}=await this._callRefreshToken(t.refresh_token);return a?{data:{user:null,session:null},error:a}:s?{data:{user:s.user,session:s},error:null}:{data:{user:null,session:null},error:null}})}catch(r){if(se(r))return{data:{user:null,session:null},error:r};throw r}}async _getSessionFromURL(t){try{if(!Wt())throw new Vi("No browser detected.");if(this.flowType==="implicit"&&!this._isImplicitGrantFlow())throw new Vi("Not a valid implicit grant flow url.");if(this.flowType=="pkce"&&!t)throw new yp("Not a valid PKCE flow url.");const r=dc(window.location.href);if(t){if(!r.code)throw new yp("No code detected.");const{data:g,error:w}=await this._exchangeCodeForSession(r.code);if(w)throw w;const E=new URL(window.location.href);return E.searchParams.delete("code"),window.history.replaceState(window.history.state,"",E.toString()),{data:{session:g.session,redirectType:null},error:null}}if(r.error||r.error_description||r.error_code)throw new Vi(r.error_description||"Error in URL with unspecified error_description",{error:r.error||"unspecified_error",code:r.error_code||"unspecified_code"});const{provider_token:n,provider_refresh_token:s,access_token:a,refresh_token:i,expires_in:o,expires_at:l,token_type:u}=r;if(!a||!o||!i||!u)throw new Vi("No session defined in URL");const d=Math.round(Date.now()/1e3),f=parseInt(o);let h=d+f;l&&(h=parseInt(l));const m=h-d;m*1e3<=ga&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${m}s, should have been closer to ${f}s`);const x=h-f;d-x>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",x,h,d):d-x<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clok for skew",x,h,d);const{data:v,error:_}=await this._getUser(a);if(_)throw _;const y={provider_token:n,provider_refresh_token:s,access_token:a,expires_in:f,expires_at:h,refresh_token:i,token_type:u,user:v.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),{data:{session:y,redirectType:r.type},error:null}}catch(r){if(se(r))return{data:{session:null,redirectType:null},error:r};throw r}}_isImplicitGrantFlow(){const t=dc(window.location.href);return!!(Wt()&&(t.access_token||t.error_description))}async _isPKCEFlow(){const t=dc(window.location.href),r=await Ui(this.storage,`${this.storageKey}-code-verifier`);return!!(t.code&&r)}async signOut(t={scope:"global"}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._signOut(t))}async _signOut({scope:t}={scope:"global"}){return await this._useSession(async r=>{var n;const{data:s,error:a}=r;if(a)return{error:a};const i=(n=s.session)===null||n===void 0?void 0:n.access_token;if(i){const{error:o}=await this.admin.signOut(i,t);if(o&&!(vE(o)&&(o.status===404||o.status===401||o.status===403)))return{error:o}}return t!=="others"&&(await this._removeSession(),await fc(this.storage,`${this.storageKey}-code-verifier`),await this._notifyAllSubscribers("SIGNED_OUT",null)),{error:null}})}onAuthStateChange(t){const r=sE(),n={id:r,callback:t,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",r),this.stateChangeEmitters.delete(r)}};return this._debug("#onAuthStateChange()","registered callback with id",r),this.stateChangeEmitters.set(r,n),(async()=>(await this.initializePromise,await this._acquireLock(-1,async()=>{this._emitInitialSession(r)})))(),{data:{subscription:n}}}async _emitInitialSession(t){return await this._useSession(async r=>{var n,s;try{const{data:{session:a},error:i}=r;if(i)throw i;await((n=this.stateChangeEmitters.get(t))===null||n===void 0?void 0:n.callback("INITIAL_SESSION",a)),this._debug("INITIAL_SESSION","callback id",t,"session",a)}catch(a){await((s=this.stateChangeEmitters.get(t))===null||s===void 0?void 0:s.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",t,"error",a),console.error(a)}})}async resetPasswordForEmail(t,r={}){let n=null,s=null;this.flowType==="pkce"&&([n,s]=await ss(this.storage,this.storageKey,!0));try{return await oe(this.fetch,"POST",`${this.url}/recover`,{body:{email:t,code_challenge:n,code_challenge_method:s,gotrue_meta_security:{captcha_token:r.captchaToken}},headers:this.headers,redirectTo:r.redirectTo})}catch(a){if(se(a))return{data:null,error:a};throw a}}async getUserIdentities(){var t;try{const{data:r,error:n}=await this.getUser();if(n)throw n;return{data:{identities:(t=r.user.identities)!==null&&t!==void 0?t:[]},error:null}}catch(r){if(se(r))return{data:null,error:r};throw r}}async linkIdentity(t){var r;try{const{data:n,error:s}=await this._useSession(async a=>{var i,o,l,u,d;const{data:f,error:h}=a;if(h)throw h;const m=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,t.provider,{redirectTo:(i=t.options)===null||i===void 0?void 0:i.redirectTo,scopes:(o=t.options)===null||o===void 0?void 0:o.scopes,queryParams:(l=t.options)===null||l===void 0?void 0:l.queryParams,skipBrowserRedirect:!0});return await oe(this.fetch,"GET",m,{headers:this.headers,jwt:(d=(u=f.session)===null||u===void 0?void 0:u.access_token)!==null&&d!==void 0?d:void 0})});if(s)throw s;return Wt()&&!(!((r=t.options)===null||r===void 0)&&r.skipBrowserRedirect)&&window.location.assign(n==null?void 0:n.url),{data:{provider:t.provider,url:n==null?void 0:n.url},error:null}}catch(n){if(se(n))return{data:{provider:t.provider,url:null},error:n};throw n}}async unlinkIdentity(t){try{return await this._useSession(async r=>{var n,s;const{data:a,error:i}=r;if(i)throw i;return await oe(this.fetch,"DELETE",`${this.url}/user/identities/${t.identity_id}`,{headers:this.headers,jwt:(s=(n=a.session)===null||n===void 0?void 0:n.access_token)!==null&&s!==void 0?s:void 0})})}catch(r){if(se(r))return{data:null,error:r};throw r}}async _refreshAccessToken(t){const r=`#_refreshAccessToken(${t.substring(0,5)}...)`;this._debug(r,"begin");try{const n=Date.now();return await lE(async s=>(s>0&&await oE(200*Math.pow(2,s-1)),this._debug(r,"refreshing attempt",s),await oe(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:t},headers:this.headers,xform:$r})),(s,a)=>{const i=200*Math.pow(2,s);return a&&pc(a)&&Date.now()+i-n{try{await o.callback(t,r)}catch(l){a.push(l)}});if(await Promise.all(i),a.length>0){for(let o=0;othis._autoRefreshTokenTick(),ga);this.autoRefreshTicker=t,t&&typeof t=="object"&&typeof t.unref=="function"?t.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(t),setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const t=this.autoRefreshTicker;this.autoRefreshTicker=null,t&&clearInterval(t)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async _autoRefreshTokenTick(){this._debug("#_autoRefreshTokenTick()","begin");try{await this._acquireLock(0,async()=>{try{const t=Date.now();try{return await this._useSession(async r=>{const{data:{session:n}}=r;if(!n||!n.refresh_token||!n.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const s=Math.floor((n.expires_at*1e3-t)/ga);this._debug("#_autoRefreshTokenTick()",`access token expires in ${s} ticks, a tick lasts ${ga}ms, refresh threshold is ${Sp} ticks`),s<=Sp&&await this._callRefreshToken(n.refresh_token)})}catch(r){console.error("Auto refresh tick failed with error. This is likely a transient error.",r)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(t){if(t.isAcquireTimeout||t instanceof Ey)this._debug("auto refresh token tick lock not available");else throw t}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!Wt()||!(window!=null&&window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>await this._onVisibilityChanged(!1),window==null||window.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(t){console.error("_handleVisibilityChange",t)}}async _onVisibilityChanged(t){const r=`#_onVisibilityChanged(${t})`;this._debug(r,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),t||(await this.initializePromise,await this._acquireLock(-1,async()=>{if(document.visibilityState!=="visible"){this._debug(r,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");return}await this._recoverAndRefresh()}))):document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(t,r,n){const s=[`provider=${encodeURIComponent(r)}`];if(n!=null&&n.redirectTo&&s.push(`redirect_to=${encodeURIComponent(n.redirectTo)}`),n!=null&&n.scopes&&s.push(`scopes=${encodeURIComponent(n.scopes)}`),this.flowType==="pkce"){const[a,i]=await ss(this.storage,this.storageKey),o=new URLSearchParams({code_challenge:`${encodeURIComponent(a)}`,code_challenge_method:`${encodeURIComponent(i)}`});s.push(o.toString())}if(n!=null&&n.queryParams){const a=new URLSearchParams(n.queryParams);s.push(a.toString())}return n!=null&&n.skipBrowserRedirect&&s.push(`skip_http_redirect=${n.skipBrowserRedirect}`),`${t}?${s.join("&")}`}async _unenroll(t){try{return await this._useSession(async r=>{var n;const{data:s,error:a}=r;return a?{data:null,error:a}:await oe(this.fetch,"DELETE",`${this.url}/factors/${t.factorId}`,{headers:this.headers,jwt:(n=s==null?void 0:s.session)===null||n===void 0?void 0:n.access_token})})}catch(r){if(se(r))return{data:null,error:r};throw r}}async _enroll(t){try{return await this._useSession(async r=>{var n,s;const{data:a,error:i}=r;if(i)return{data:null,error:i};const{data:o,error:l}=await oe(this.fetch,"POST",`${this.url}/factors`,{body:{friendly_name:t.friendlyName,factor_type:t.factorType,issuer:t.issuer},headers:this.headers,jwt:(n=a==null?void 0:a.session)===null||n===void 0?void 0:n.access_token});return l?{data:null,error:l}:(!((s=o==null?void 0:o.totp)===null||s===void 0)&&s.qr_code&&(o.totp.qr_code=`data:image/svg+xml;utf-8,${o.totp.qr_code}`),{data:o,error:null})})}catch(r){if(se(r))return{data:null,error:r};throw r}}async _verify(t){return this._acquireLock(-1,async()=>{try{return await this._useSession(async r=>{var n;const{data:s,error:a}=r;if(a)return{data:null,error:a};const{data:i,error:o}=await oe(this.fetch,"POST",`${this.url}/factors/${t.factorId}/verify`,{body:{code:t.code,challenge_id:t.challengeId},headers:this.headers,jwt:(n=s==null?void 0:s.session)===null||n===void 0?void 0:n.access_token});return o?{data:null,error:o}:(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+i.expires_in},i)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",i),{data:i,error:o})})}catch(r){if(se(r))return{data:null,error:r};throw r}})}async _challenge(t){return this._acquireLock(-1,async()=>{try{return await this._useSession(async r=>{var n;const{data:s,error:a}=r;return a?{data:null,error:a}:await oe(this.fetch,"POST",`${this.url}/factors/${t.factorId}/challenge`,{headers:this.headers,jwt:(n=s==null?void 0:s.session)===null||n===void 0?void 0:n.access_token})})}catch(r){if(se(r))return{data:null,error:r};throw r}})}async _challengeAndVerify(t){const{data:r,error:n}=await this._challenge({factorId:t.factorId});return n?{data:null,error:n}:await this._verify({factorId:t.factorId,challengeId:r.id,code:t.code})}async _listFactors(){const{data:{user:t},error:r}=await this.getUser();if(r)return{data:null,error:r};const n=(t==null?void 0:t.factors)||[],s=n.filter(a=>a.factor_type==="totp"&&a.status==="verified");return{data:{all:n,totp:s},error:null}}async _getAuthenticatorAssuranceLevel(){return this._acquireLock(-1,async()=>await this._useSession(async t=>{var r,n;const{data:{session:s},error:a}=t;if(a)return{data:null,error:a};if(!s)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const i=this._decodeJWT(s.access_token);let o=null;i.aal&&(o=i.aal);let l=o;((n=(r=s.user.factors)===null||r===void 0?void 0:r.filter(f=>f.status==="verified"))!==null&&n!==void 0?n:[]).length>0&&(l="aal2");const d=i.amr||[];return{data:{currentLevel:o,nextLevel:l,currentAuthenticationMethods:d},error:null}}))}}ni.nextInstanceID=0;const AE=ni;class zE extends AE{constructor(t){super(t)}}var IE=function(e,t,r,n){function s(a){return a instanceof r?a:new r(function(i){i(a)})}return new(r||(r=Promise))(function(a,i){function o(d){try{u(n.next(d))}catch(f){i(f)}}function l(d){try{u(n.throw(d))}catch(f){i(f)}}function u(d){d.done?a(d.value):s(d.value).then(o,l)}u((n=n.apply(e,t||[])).next())})};class LE{constructor(t,r,n){var s,a,i;if(this.supabaseUrl=t,this.supabaseKey=r,!t)throw new Error("supabaseUrl is required.");if(!r)throw new Error("supabaseKey is required.");const o=XS(t);this.realtimeUrl=`${o}/realtime/v1`.replace(/^http/i,"ws"),this.authUrl=`${o}/auth/v1`,this.storageUrl=`${o}/storage/v1`,this.functionsUrl=`${o}/functions/v1`;const l=`sb-${new URL(this.authUrl).hostname.split(".")[0]}-auth-token`,u={db:WS,realtime:GS,auth:Object.assign(Object.assign({},qS),{storageKey:l}),global:HS},d=ZS(n??{},u);this.storageKey=(s=d.auth.storageKey)!==null&&s!==void 0?s:"",this.headers=(a=d.global.headers)!==null&&a!==void 0?a:{},this.auth=this._initSupabaseAuthClient((i=d.auth)!==null&&i!==void 0?i:{},this.headers,d.global.fetch),this.fetch=JS(r,this._getAccessToken.bind(this),d.global.fetch),this.realtime=this._initRealtimeClient(Object.assign({headers:this.headers},d.realtime)),this.rest=new pS(`${o}/rest/v1`,{headers:this.headers,schema:d.db.schema,fetch:this.fetch}),this._listenForAuthEvents()}get functions(){return new H2(this.functionsUrl,{headers:this.headers,customFetch:this.fetch})}get storage(){return new US(this.storageUrl,this.headers,this.fetch)}from(t){return this.rest.from(t)}schema(t){return this.rest.schema(t)}rpc(t,r={},n={}){return this.rest.rpc(t,r,n)}channel(t,r={config:{}}){return this.realtime.channel(t,r)}getChannels(){return this.realtime.getChannels()}removeChannel(t){return this.realtime.removeChannel(t)}removeAllChannels(){return this.realtime.removeAllChannels()}_getAccessToken(){var t,r;return IE(this,void 0,void 0,function*(){const{data:n}=yield this.auth.getSession();return(r=(t=n.session)===null||t===void 0?void 0:t.access_token)!==null&&r!==void 0?r:null})}_initSupabaseAuthClient({autoRefreshToken:t,persistSession:r,detectSessionInUrl:n,storage:s,storageKey:a,flowType:i,debug:o},l,u){var d;const f={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new zE({url:this.authUrl,headers:Object.assign(Object.assign({},f),l),storageKey:a,autoRefreshToken:t,persistSession:r,detectSessionInUrl:n,storage:s,flowType:i,debug:o,fetch:u,hasCustomAuthorizationHeader:(d="Authorization"in this.headers)!==null&&d!==void 0?d:!1})}_initRealtimeClient(t){return new NS(this.realtimeUrl,Object.assign(Object.assign({},t),{params:Object.assign({apikey:this.supabaseKey},t==null?void 0:t.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((r,n)=>{this._handleTokenChanged(r,"CLIENT",n==null?void 0:n.access_token)})}_handleTokenChanged(t,r,n){(t==="TOKEN_REFRESHED"||t==="SIGNED_IN")&&this.changedAccessToken!==n?(this.realtime.setAuth(n??null),this.changedAccessToken=n):t==="SIGNED_OUT"&&(this.realtime.setAuth(this.supabaseKey),r=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}}const DE=(e,t,r)=>new LE(e,t,r),Yd="https://baas-api.wanwang.xin/supabase/proxy/WS20261008145034000001",$E="eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJyb2xlIjoiYW5vbiIsImlzcyI6InBvbGFyZGIiLCJpYXQiOjE3ODQ2MTc1NjcsImV4cCI6MjA5OTk3NzU2N30.eqsdLjP4vgCBoFJs6GZDwv8XNEq1ul_QBj-Is5qUN_s",Ke=DE(Yd,$E,{auth:{autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0}});var ky={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},kp=He.createContext&&He.createContext(ky),ME=["attr","size","title"];function FE(e,t){if(e==null)return{};var r=UE(e,t),n,s;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(s=0;s=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function UE(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function Vo(){return Vo=Object.assign?Object.assign.bind():function(e){for(var t=1;tHe.createElement(t.tag,Ho({key:r},t.attr),jy(t.child)))}function Ee(e){return t=>He.createElement(WE,Vo({attr:Ho({},e.attr)},t),jy(e.child))}function WE(e){var t=r=>{var{attr:n,size:s,title:a}=e,i=FE(e,ME),o=s||r.size||"1em",l;return r.className&&(l=r.className),e.className&&(l=(l?l+" ":"")+e.className),He.createElement("svg",Vo({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},r.attr,n,i,{className:l,style:Ho(Ho({color:e.color||r.color},r.style),e.style),height:o,width:o,xmlns:"http://www.w3.org/2000/svg"}),a&&He.createElement("title",null,a),e.children)};return kp!==void 0?He.createElement(kp.Consumer,null,r=>t(r)):t(ky)}function qE(e){return Ee({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M407 177.6c7.6-24-13.4-46.8-37.4-41.7-22 4.8-28.8-28.1-7.1-32.8 50.1-10.9 92.3 37.1 76.5 84.8-6.8 21.2-38.8 10.8-32-10.3zM214.8 446.7C108.5 446.7 0 395.3 0 310.4c0-44.3 28-95.4 76.3-143.7C176 67 279.5 65.8 249.9 161c-4 13.1 12.3 5.7 12.3 6 79.5-33.6 140.5-16.8 114 51.4-3.7 9.4 1.1 10.9 8.3 13.1 135.7 42.3 34.8 215.2-169.7 215.2zm143.7-146.3c-5.4-55.7-78.5-94-163.4-85.7-84.8 8.6-148.8 60.3-143.4 116s78.5 94 163.4 85.7c84.8-8.6 148.8-60.3 143.4-116zM347.9 35.1c-25.9 5.6-16.8 43.7 8.3 38.3 72.3-15.2 134.8 52.8 111.7 124-7.4 24.2 29.1 37 37.4 12 31.9-99.8-55.1-195.9-157.4-174.3zm-78.5 311c-17.1 38.8-66.8 60-109.1 46.3-40.8-13.1-58-53.4-40.3-89.7 17.7-35.4 63.1-55.4 103.4-45.1 42 10.8 63.1 50.2 46 88.5zm-86.3-30c-12.9-5.4-30 .3-38 12.9-8.3 12.9-4.3 28 8.6 34 13.1 6 30.8.3 39.1-12.9 8-13.1 3.7-28.3-9.7-34zm32.6-13.4c-5.1-1.7-11.4.6-14.3 5.4-2.9 5.1-1.4 10.6 3.7 12.9 5.1 2 11.7-.3 14.6-5.4 2.8-5.2 1.1-10.9-4-12.9z"},child:[]}]})(e)}function GE(e){return Ee({attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M385.2 167.6c6.4 0 12.6.3 18.8 1.1C387.4 90.3 303.3 32 207.7 32 100.5 32 13 104.8 13 197.4c0 53.4 29.3 97.5 77.9 131.6l-19.3 58.6 68-34.1c24.4 4.8 43.8 9.7 68.2 9.7 6.2 0 12.1-.3 18.3-.8-4-12.9-6.2-26.6-6.2-40.8-.1-84.9 72.9-154 165.3-154zm-104.5-52.9c14.5 0 24.2 9.7 24.2 24.4 0 14.5-9.7 24.2-24.2 24.2-14.8 0-29.3-9.7-29.3-24.2.1-14.7 14.6-24.4 29.3-24.4zm-136.4 48.6c-14.5 0-29.3-9.7-29.3-24.2 0-14.8 14.8-24.4 29.3-24.4 14.8 0 24.4 9.7 24.4 24.4 0 14.6-9.6 24.2-24.4 24.2zM563 319.4c0-77.9-77.9-141.3-165.4-141.3-92.7 0-165.4 63.4-165.4 141.3S305 460.7 397.6 460.7c19.3 0 38.9-5.1 58.6-9.9l53.4 29.3-14.8-48.6C534 402.1 563 363.2 563 319.4zm-219.1-24.5c-9.7 0-19.3-9.7-19.3-19.6 0-9.7 9.7-19.3 19.3-19.3 14.8 0 24.4 9.7 24.4 19.3 0 10-9.7 19.6-24.4 19.6zm107.1 0c-9.7 0-19.3-9.7-19.3-19.6 0-9.7 9.7-19.3 19.3-19.3 14.5 0 24.4 9.7 24.4 19.3.1 10-9.9 19.6-24.4 19.6z"},child:[]}]})(e)}function Cp(e){return Ee({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M257.5 445.1l-22.2 22.2c-9.4 9.4-24.6 9.4-33.9 0L7 273c-9.4-9.4-9.4-24.6 0-33.9L201.4 44.7c9.4-9.4 24.6-9.4 33.9 0l22.2 22.2c9.5 9.5 9.3 25-.4 34.3L136.6 216H424c13.3 0 24 10.7 24 24v32c0 13.3-10.7 24-24 24H136.6l120.5 114.8c9.8 9.3 10 24.8.4 34.3z"},child:[]}]})(e)}function KE(e){return Ee({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M190.5 66.9l22.2-22.2c9.4-9.4 24.6-9.4 33.9 0L441 239c9.4 9.4 9.4 24.6 0 33.9L246.6 467.3c-9.4 9.4-24.6 9.4-33.9 0l-22.2-22.2c-9.5-9.5-9.3-25 .4-34.3L311.4 296H24c-13.3 0-24-10.7-24-24v-32c0-13.3 10.7-24 24-24h287.4L190.9 101.2c-9.8-9.3-10-24.8-.4-34.3z"},child:[]}]})(e)}function QE(e){return Ee({attr:{viewBox:"0 0 384 512"},child:[{tag:"path",attr:{d:"M97.12 362.63c-8.69-8.69-4.16-6.24-25.12-11.85-9.51-2.55-17.87-7.45-25.43-13.32L1.2 448.7c-4.39 10.77 3.81 22.47 15.43 22.03l52.69-2.01L105.56 507c8 8.44 22.04 5.81 26.43-4.96l52.05-127.62c-10.84 6.04-22.87 9.58-35.31 9.58-19.5 0-37.82-7.59-51.61-21.37zM382.8 448.7l-45.37-111.24c-7.56 5.88-15.92 10.77-25.43 13.32-21.07 5.64-16.45 3.18-25.12 11.85-13.79 13.78-32.12 21.37-51.62 21.37-12.44 0-24.47-3.55-35.31-9.58L252 502.04c4.39 10.77 18.44 13.4 26.43 4.96l36.25-38.28 52.69 2.01c11.62.44 19.82-11.27 15.43-22.03zM263 340c15.28-15.55 17.03-14.21 38.79-20.14 13.89-3.79 24.75-14.84 28.47-28.98 7.48-28.4 5.54-24.97 25.95-45.75 10.17-10.35 14.14-25.44 10.42-39.58-7.47-28.38-7.48-24.42 0-52.83 3.72-14.14-.25-29.23-10.42-39.58-20.41-20.78-18.47-17.36-25.95-45.75-3.72-14.14-14.58-25.19-28.47-28.98-27.88-7.61-24.52-5.62-44.95-26.41-10.17-10.35-25-14.4-38.89-10.61-27.87 7.6-23.98 7.61-51.9 0-13.89-3.79-28.72.25-38.89 10.61-20.41 20.78-17.05 18.8-44.94 26.41-13.89 3.79-24.75 14.84-28.47 28.98-7.47 28.39-5.54 24.97-25.95 45.75-10.17 10.35-14.15 25.44-10.42 39.58 7.47 28.36 7.48 24.4 0 52.82-3.72 14.14.25 29.23 10.42 39.59 20.41 20.78 18.47 17.35 25.95 45.75 3.72 14.14 14.58 25.19 28.47 28.98C104.6 325.96 106.27 325 121 340c13.23 13.47 33.84 15.88 49.74 5.82a39.676 39.676 0 0 1 42.53 0c15.89 10.06 36.5 7.65 49.73-5.82zM97.66 175.96c0-53.03 42.24-96.02 94.34-96.02s94.34 42.99 94.34 96.02-42.24 96.02-94.34 96.02-94.34-42.99-94.34-96.02z"},child:[]}]})(e)}function YE(e){return Ee({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M16 132h416c8.837 0 16-7.163 16-16V76c0-8.837-7.163-16-16-16H16C7.163 60 0 67.163 0 76v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16z"},child:[]}]})(e)}function Cy(e){return Ee({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M0 464c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V192H0v272zm320-196c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v40c0 6.6-5.4 12-12 12h-40c-6.6 0-12-5.4-12-12v-40zm0 128c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v40c0 6.6-5.4 12-12 12h-40c-6.6 0-12-5.4-12-12v-40zM192 268c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v40c0 6.6-5.4 12-12 12h-40c-6.6 0-12-5.4-12-12v-40zm0 128c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v40c0 6.6-5.4 12-12 12h-40c-6.6 0-12-5.4-12-12v-40zM64 268c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v40c0 6.6-5.4 12-12 12H76c-6.6 0-12-5.4-12-12v-40zm0 128c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v40c0 6.6-5.4 12-12 12H76c-6.6 0-12-5.4-12-12v-40zM400 64h-48V16c0-8.8-7.2-16-16-16h-32c-8.8 0-16 7.2-16 16v48H160V16c0-8.8-7.2-16-16-16h-32c-8.8 0-16 7.2-16 16v48H48C21.5 64 0 85.5 0 112v48h448v-48c0-26.5-21.5-48-48-48z"},child:[]}]})(e)}function fN(e){return Ee({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M207.029 381.476L12.686 187.132c-9.373-9.373-9.373-24.569 0-33.941l22.667-22.667c9.357-9.357 24.522-9.375 33.901-.04L224 284.505l154.745-154.021c9.379-9.335 24.544-9.317 33.901.04l22.667 22.667c9.373 9.373 9.373 24.569 0 33.941L240.971 381.476c-9.373 9.372-24.569 9.372-33.942 0z"},child:[]}]})(e)}function JE(e){return Ee({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256,8C119,8,8,119,8,256S119,504,256,504,504,393,504,256,393,8,256,8Zm92.49,313h0l-20,25a16,16,0,0,1-22.49,2.5h0l-67-49.72a40,40,0,0,1-15-31.23V112a16,16,0,0,1,16-16h32a16,16,0,0,1,16,16V256l58,42.5A16,16,0,0,1,348.49,321Z"},child:[]}]})(e)}function hN(e){return Ee({attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M537.6 226.6c4.1-10.7 6.4-22.4 6.4-34.6 0-53-43-96-96-96-19.7 0-38.1 6-53.3 16.2C367 64.2 315.3 32 256 32c-88.4 0-160 71.6-160 160 0 2.7.1 5.4.2 8.1C40.2 219.8 0 273.2 0 336c0 79.5 64.5 144 144 144h368c70.7 0 128-57.3 128-128 0-61.9-44-113.6-102.4-125.4zm-132.9 88.7L299.3 420.7c-6.2 6.2-16.4 6.2-22.6 0L171.3 315.3c-10.1-10.1-2.9-27.3 11.3-27.3H248V176c0-8.8 7.2-16 16-16h48c8.8 0 16 7.2 16 16v112h65.4c14.2 0 21.4 17.2 11.3 27.3z"},child:[]}]})(e)}function pN(e){return Ee({attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M537.6 226.6c4.1-10.7 6.4-22.4 6.4-34.6 0-53-43-96-96-96-19.7 0-38.1 6-53.3 16.2C367 64.2 315.3 32 256 32c-88.4 0-160 71.6-160 160 0 2.7.1 5.4.2 8.1C40.2 219.8 0 273.2 0 336c0 79.5 64.5 144 144 144h368c70.7 0 128-57.3 128-128 0-61.9-44-113.6-102.4-125.4zM393.4 288H328v112c0 8.8-7.2 16-16 16h-48c-8.8 0-16-7.2-16-16V288h-65.4c-14.3 0-21.4-17.2-11.3-27.3l105.4-105.4c6.2-6.2 16.4-6.2 22.6 0l105.4 105.4c10.1 10.1 2.9 27.3-11.3 27.3z"},child:[]}]})(e)}function Np(e){return Ee({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M0 405.3V448c0 35.3 86 64 192 64s192-28.7 192-64v-42.7C342.7 434.4 267.2 448 192 448S41.3 434.4 0 405.3zM320 128c106 0 192-28.7 192-64S426 0 320 0 128 28.7 128 64s86 64 192 64zM0 300.4V352c0 35.3 86 64 192 64s192-28.7 192-64v-51.6c-41.3 34-116.9 51.6-192 51.6S41.3 334.4 0 300.4zm416 11c57.3-11.1 96-31.7 96-55.4v-42.7c-23.2 16.4-57.3 27.6-96 34.5v63.6zM192 160C86 160 0 195.8 0 240s86 80 192 80 192-35.8 192-80-86-80-192-80zm219.3 56.3c60-10.8 100.7-32 100.7-56.3v-42.7c-35.5 25.1-96.5 38.6-160.7 41.8 29.5 14.3 51.2 33.5 60 57.2z"},child:[]}]})(e)}function Ny(e){return Ee({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M502.3 190.8c3.9-3.1 9.7-.2 9.7 4.7V400c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V195.6c0-5 5.7-7.8 9.7-4.7 22.4 17.4 52.1 39.5 154.1 113.6 21.1 15.4 56.7 47.8 92.2 47.6 35.7.3 72-32.8 92.3-47.6 102-74.1 131.6-96.3 154-113.7zM256 320c23.2.4 56.6-29.2 73.4-41.4 132.7-96.3 142.8-104.7 173.4-128.7 5.8-4.5 9.2-11.5 9.2-18.9v-19c0-26.5-21.5-48-48-48H48C21.5 64 0 85.5 0 112v19c0 7.4 3.4 14.3 9.2 18.9 30.6 23.9 40.7 32.4 173.4 128.7 16.8 12.2 50.2 41.8 73.4 41.4z"},child:[]}]})(e)}function mN(e){return Ee({attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M569.517 440.013C587.975 472.007 564.806 512 527.94 512H48.054c-36.937 0-59.999-40.055-41.577-71.987L246.423 23.985c18.467-32.009 64.72-31.951 83.154 0l239.94 416.028zM288 354c-25.405 0-46 20.595-46 46s20.595 46 46 46 46-20.595 46-46-20.595-46-46-46zm-43.673-165.346l7.418 136c.347 6.364 5.609 11.346 11.982 11.346h48.546c6.373 0 11.635-4.982 11.982-11.346l7.418-136c.375-6.874-5.098-12.654-11.982-12.654h-63.383c-6.884 0-12.356 5.78-11.981 12.654z"},child:[]}]})(e)}function Py(e){return Ee({attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M572.52 241.4C518.29 135.59 410.93 64 288 64S57.68 135.64 3.48 241.41a32.35 32.35 0 0 0 0 29.19C57.71 376.41 165.07 448 288 448s230.32-71.64 284.52-177.41a32.35 32.35 0 0 0 0-29.19zM288 400a144 144 0 1 1 144-144 143.93 143.93 0 0 1-144 144zm0-240a95.31 95.31 0 0 0-25.31 3.79 47.85 47.85 0 0 1-66.9 66.9A95.78 95.78 0 1 0 288 160z"},child:[]}]})(e)}function Ty(e){return Ee({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M32 448c0 17.7 14.3 32 32 32h160V320H32v128zm256 32h160c17.7 0 32-14.3 32-32V320H288v160zm192-320h-42.1c6.2-12.1 10.1-25.5 10.1-40 0-48.5-39.5-88-88-88-41.6 0-68.5 21.3-103 68.3-34.5-47-61.4-68.3-103-68.3-48.5 0-88 39.5-88 88 0 14.5 3.8 27.9 10.1 40H32c-17.7 0-32 14.3-32 32v80c0 8.8 7.2 16 16 16h480c8.8 0 16-7.2 16-16v-80c0-17.7-14.3-32-32-32zm-326.1 0c-22.1 0-40-17.9-40-40s17.9-40 40-40c19.9 0 34.6 3.3 86.1 80h-86.1zm206.1 0h-86.1c51.4-76.5 65.7-80 86.1-80 22.1 0 40 17.9 40 40s-17.9 40-40 40z"},child:[]}]})(e)}function XE(e){return Ee({attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M571.31 193.94l-22.63-22.63c-6.25-6.25-16.38-6.25-22.63 0l-11.31 11.31-28.9-28.9c5.63-21.31.36-44.9-16.35-61.61l-45.25-45.25c-62.48-62.48-163.79-62.48-226.28 0l90.51 45.25v18.75c0 16.97 6.74 33.25 18.75 45.25l49.14 49.14c16.71 16.71 40.3 21.98 61.61 16.35l28.9 28.9-11.31 11.31c-6.25 6.25-6.25 16.38 0 22.63l22.63 22.63c6.25 6.25 16.38 6.25 22.63 0l90.51-90.51c6.23-6.24 6.23-16.37-.02-22.62zm-286.72-15.2c-3.7-3.7-6.84-7.79-9.85-11.95L19.64 404.96c-25.57 23.88-26.26 64.19-1.53 88.93s65.05 24.05 88.93-1.53l238.13-255.07c-3.96-2.91-7.9-5.87-11.44-9.41l-49.14-49.14z"},child:[]}]})(e)}function gN(e){return Ee({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 8C119.043 8 8 119.083 8 256c0 136.997 111.043 248 248 248s248-111.003 248-248C504 119.083 392.957 8 256 8zm0 110c23.196 0 42 18.804 42 42s-18.804 42-42 42-42-18.804-42-42 18.804-42 42-42zm56 254c0 6.627-5.373 12-12 12h-88c-6.627 0-12-5.373-12-12v-24c0-6.627 5.373-12 12-12h12v-64h-12c-6.627 0-12-5.373-12-12v-24c0-6.627 5.373-12 12-12h64c6.627 0 12 5.373 12 12v100h12c6.627 0 12 5.373 12 12v24z"},child:[]}]})(e)}function vN(e){return Ee({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M290.74 93.24l128.02 128.02-277.99 277.99-114.14 12.6C11.35 513.54-1.56 500.62.14 485.34l12.7-114.22 277.9-277.88zm207.2-19.06l-60.11-60.11c-18.75-18.75-49.16-18.75-67.91 0l-56.55 56.55 128.02 128.02 56.55-56.55c18.75-18.76 18.75-49.16 0-67.91z"},child:[]}]})(e)}function Ry(e){return Ee({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M493.4 24.6l-104-24c-11.3-2.6-22.9 3.3-27.5 13.9l-48 112c-4.2 9.8-1.4 21.3 6.9 28l60.6 49.6c-36 76.7-98.9 140.5-177.2 177.2l-49.6-60.6c-6.8-8.3-18.2-11.1-28-6.9l-112 48C3.9 366.5-2 378.1.6 389.4l24 104C27.1 504.2 36.7 512 48 512c256.1 0 464-207.5 464-464 0-11.2-7.7-20.9-18.6-23.4z"},child:[]}]})(e)}function ZE(e){return Ee({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M505 442.7L405.3 343c-4.5-4.5-10.6-7-17-7H372c27.6-35.3 44-79.7 44-128C416 93.1 322.9 0 208 0S0 93.1 0 208s93.1 208 208 208c48.3 0 92.7-16.4 128-44v16.3c0 6.4 2.5 12.5 7 17l99.7 99.7c9.4 9.4 24.6 9.4 33.9 0l28.3-28.3c9.4-9.4 9.4-24.6.1-34zM208 336c-70.7 0-128-57.2-128-128 0-70.7 57.2-128 128-128 70.7 0 128 57.2 128 128 0 70.7-57.2 128-128 128z"},child:[]}]})(e)}function ek(e){return Ee({attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M528.12 301.319l47.273-208C578.806 78.301 567.391 64 551.99 64H159.208l-9.166-44.81C147.758 8.021 137.93 0 126.529 0H24C10.745 0 0 10.745 0 24v16c0 13.255 10.745 24 24 24h69.883l70.248 343.435C147.325 417.1 136 435.222 136 456c0 30.928 25.072 56 56 56s56-25.072 56-56c0-15.674-6.447-29.835-16.824-40h209.647C430.447 426.165 424 440.326 424 456c0 30.928 25.072 56 56 56s56-25.072 56-56c0-22.172-12.888-41.332-31.579-50.405l5.517-24.276c3.413-15.018-8.002-29.319-23.403-29.319H218.117l-6.545-32h293.145c11.206 0 20.92-7.754 23.403-18.681z"},child:[]}]})(e)}function Pp(e){return Ee({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M497 273L329 441c-15 15-41 4.5-41-17v-96H152c-13.3 0-24-10.7-24-24v-96c0-13.3 10.7-24 24-24h136V88c0-21.4 25.9-32 41-17l168 168c9.3 9.4 9.3 24.6 0 34zM192 436v-40c0-6.6-5.4-12-12-12H96c-17.7 0-32-14.3-32-32V160c0-17.7 14.3-32 32-32h84c6.6 0 12-5.4 12-12V76c0-6.6-5.4-12-12-12H96c-53 0-96 43-96 96v192c0 53 43 96 96 96h84c6.6 0 12-5.4 12-12z"},child:[]}]})(e)}function tk(e){return Ee({attr:{viewBox:"0 0 352 512"},child:[{tag:"path",attr:{d:"M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"},child:[]}]})(e)}function yN(e){return Ee({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M32 464a48 48 0 0 0 48 48h288a48 48 0 0 0 48-48V128H32zm272-256a16 16 0 0 1 32 0v224a16 16 0 0 1-32 0zm-96 0a16 16 0 0 1 32 0v224a16 16 0 0 1-32 0zm-96 0a16 16 0 0 1 32 0v224a16 16 0 0 1-32 0zM432 32H312l-9.4-18.7A24 24 0 0 0 281.1 0H166.8a23.72 23.72 0 0 0-21.4 13.3L136 32H16A16 16 0 0 0 0 48v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16V48a16 16 0 0 0-16-16z"},child:[]}]})(e)}function xN(e){return Ee({attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M622.3 271.1l-115.2-45c-4.1-1.6-12.6-3.7-22.2 0l-115.2 45c-10.7 4.2-17.7 14-17.7 24.9 0 111.6 68.7 188.8 132.9 213.9 9.6 3.7 18 1.6 22.2 0C558.4 489.9 640 420.5 640 296c0-10.9-7-20.7-17.7-24.9zM496 462.4V273.3l95.5 37.3c-5.6 87.1-60.9 135.4-95.5 151.8zM224 256c70.7 0 128-57.3 128-128S294.7 0 224 0 96 57.3 96 128s57.3 128 128 128zm96 40c0-2.5.8-4.8 1.1-7.2-2.5-.1-4.9-.8-7.5-.8h-16.7c-22.2 10.2-46.9 16-72.9 16s-50.6-5.8-72.9-16h-16.7C60.2 288 0 348.2 0 422.4V464c0 26.5 21.5 48 48 48h352c6.8 0 13.3-1.5 19.2-4-54-42.9-99.2-116.7-99.2-212z"},child:[]}]})(e)}function Wo(e){return Ee({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M224 256c70.7 0 128-57.3 128-128S294.7 0 224 0 96 57.3 96 128s57.3 128 128 128zm89.6 32h-16.7c-22.2 10.2-46.9 16-72.9 16s-50.6-5.8-72.9-16h-16.7C60.2 288 0 348.2 0 422.4V464c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48v-41.6c0-74.2-60.2-134.4-134.4-134.4z"},child:[]}]})(e)}function nn(e,t,{checkForDefaultPrevented:r=!0}={}){return function(s){if(e==null||e(s),r===!1||!s.defaultPrevented)return t==null?void 0:t(s)}}function Tp(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Oy(...e){return t=>{let r=!1;const n=e.map(s=>{const a=Tp(s,t);return!r&&typeof a=="function"&&(r=!0),a});if(r)return()=>{for(let s=0;s{const{children:i,...o}=a,l=p.useMemo(()=>o,Object.values(o));return c.jsx(r.Provider,{value:l,children:i})};n.displayName=e+"Provider";function s(a){const i=p.useContext(r);if(i)return i;if(t!==void 0)return t;throw new Error(`\`${a}\` must be used within \`${e}\``)}return[n,s]}function nk(e,t=[]){let r=[];function n(a,i){const o=p.createContext(i),l=r.length;r=[...r,i];const u=f=>{var y;const{scope:h,children:m,...x}=f,v=((y=h==null?void 0:h[e])==null?void 0:y[l])||o,_=p.useMemo(()=>x,Object.values(x));return c.jsx(v.Provider,{value:_,children:m})};u.displayName=a+"Provider";function d(f,h){var v;const m=((v=h==null?void 0:h[e])==null?void 0:v[l])||o,x=p.useContext(m);if(x)return x;if(i!==void 0)return i;throw new Error(`\`${f}\` must be used within \`${a}\``)}return[u,d]}const s=()=>{const a=r.map(i=>p.createContext(i));return function(o){const l=(o==null?void 0:o[e])||a;return p.useMemo(()=>({[`__scope${e}`]:{...o,[e]:l}}),[o,l])}};return s.scopeName=e,[n,sk(s,...t)]}function sk(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(a){const i=n.reduce((o,{useScope:l,scopeName:u})=>{const f=l(a)[`__scope${u}`];return{...o,...f}},{});return p.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return r.scopeName=t.scopeName,r}var si=globalThis!=null&&globalThis.document?p.useLayoutEffect:()=>{},ak=Hu[" useId ".trim().toString()]||(()=>{}),ik=0;function mc(e){const[t,r]=p.useState(ak());return si(()=>{r(n=>n??String(ik++))},[e]),e||(t?`radix-${t}`:"")}var ok=Hu[" useInsertionEffect ".trim().toString()]||si;function lk({prop:e,defaultProp:t,onChange:r=()=>{},caller:n}){const[s,a,i]=ck({defaultProp:t,onChange:r}),o=e!==void 0,l=o?e:s;{const d=p.useRef(e!==void 0);p.useEffect(()=>{const f=d.current;f!==o&&console.warn(`${n} is changing from ${f?"controlled":"uncontrolled"} to ${o?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),d.current=o},[o,n])}const u=p.useCallback(d=>{var f;if(o){const h=uk(d)?d(e):d;h!==e&&((f=i.current)==null||f.call(i,h))}else a(d)},[o,e,a,i]);return[l,u]}function ck({defaultProp:e,onChange:t}){const[r,n]=p.useState(e),s=p.useRef(r),a=p.useRef(t);return ok(()=>{a.current=t},[t]),p.useEffect(()=>{var i;s.current!==r&&((i=a.current)==null||i.call(a,r),s.current=r)},[r,s]),[r,n,a]}function uk(e){return typeof e=="function"}function Ay(e){const t=dk(e),r=p.forwardRef((n,s)=>{const{children:a,...i}=n,o=p.Children.toArray(a),l=o.find(hk);if(l){const u=l.props.children,d=o.map(f=>f===l?p.Children.count(u)>1?p.Children.only(null):p.isValidElement(u)?u.props.children:null:f);return c.jsx(t,{...i,ref:s,children:p.isValidElement(u)?p.cloneElement(u,void 0,d):null})}return c.jsx(t,{...i,ref:s,children:a})});return r.displayName=`${e}.Slot`,r}function dk(e){const t=p.forwardRef((r,n)=>{const{children:s,...a}=r;if(p.isValidElement(s)){const i=mk(s),o=pk(a,s.props);return s.type!==p.Fragment&&(o.ref=n?Oy(n,i):i),p.cloneElement(s,o)}return p.Children.count(s)>1?p.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var fk=Symbol("radix.slottable");function hk(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===fk}function pk(e,t){const r={...t};for(const n in t){const s=e[n],a=t[n];/^on[A-Z]/.test(n)?s&&a?r[n]=(...o)=>{const l=a(...o);return s(...o),l}:s&&(r[n]=s):n==="style"?r[n]={...s,...a}:n==="className"&&(r[n]=[s,a].filter(Boolean).join(" "))}return{...e,...r}}function mk(e){var n,s;let t=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var gk=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Nr=gk.reduce((e,t)=>{const r=Ay(`Primitive.${t}`),n=p.forwardRef((s,a)=>{const{asChild:i,...o}=s,l=i?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),c.jsx(l,{...o,ref:a})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function vk(e,t){e&&Hs.flushSync(()=>e.dispatchEvent(t))}function ai(e){const t=p.useRef(e);return p.useEffect(()=>{t.current=e}),p.useMemo(()=>(...r)=>{var n;return(n=t.current)==null?void 0:n.call(t,...r)},[])}function yk(e,t=globalThis==null?void 0:globalThis.document){const r=ai(e);p.useEffect(()=>{const n=s=>{s.key==="Escape"&&r(s)};return t.addEventListener("keydown",n,{capture:!0}),()=>t.removeEventListener("keydown",n,{capture:!0})},[r,t])}var xk="DismissableLayer",Iu="dismissableLayer.update",wk="dismissableLayer.pointerDownOutside",bk="dismissableLayer.focusOutside",Rp,zy=p.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Iy=p.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:s,onFocusOutside:a,onInteractOutside:i,onDismiss:o,...l}=e,u=p.useContext(zy),[d,f]=p.useState(null),h=(d==null?void 0:d.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,m]=p.useState({}),x=Gn(t,b=>f(b)),v=Array.from(u.layers),[_]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),y=v.indexOf(_),g=d?v.indexOf(d):-1,w=u.layersWithOutsidePointerEventsDisabled.size>0,E=g>=y,C=Ek(b=>{const k=b.target,A=[...u.branches].some(N=>N.contains(k));!E||A||(s==null||s(b),i==null||i(b),b.defaultPrevented||o==null||o())},h),R=kk(b=>{const k=b.target;[...u.branches].some(N=>N.contains(k))||(a==null||a(b),i==null||i(b),b.defaultPrevented||o==null||o())},h);return yk(b=>{g===u.layers.size-1&&(n==null||n(b),!b.defaultPrevented&&o&&(b.preventDefault(),o()))},h),p.useEffect(()=>{if(d)return r&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(Rp=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),Op(),()=>{r&&u.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=Rp)}},[d,h,r,u]),p.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),Op())},[d,u]),p.useEffect(()=>{const b=()=>m({});return document.addEventListener(Iu,b),()=>document.removeEventListener(Iu,b)},[]),c.jsx(Nr.div,{...l,ref:x,style:{pointerEvents:w?E?"auto":"none":void 0,...e.style},onFocusCapture:nn(e.onFocusCapture,R.onFocusCapture),onBlurCapture:nn(e.onBlurCapture,R.onBlurCapture),onPointerDownCapture:nn(e.onPointerDownCapture,C.onPointerDownCapture)})});Iy.displayName=xk;var _k="DismissableLayerBranch",Sk=p.forwardRef((e,t)=>{const r=p.useContext(zy),n=p.useRef(null),s=Gn(t,n);return p.useEffect(()=>{const a=n.current;if(a)return r.branches.add(a),()=>{r.branches.delete(a)}},[r.branches]),c.jsx(Nr.div,{...e,ref:s})});Sk.displayName=_k;function Ek(e,t=globalThis==null?void 0:globalThis.document){const r=ai(e),n=p.useRef(!1),s=p.useRef(()=>{});return p.useEffect(()=>{const a=o=>{if(o.target&&!n.current){let l=function(){Ly(wk,r,u,{discrete:!0})};const u={originalEvent:o};o.pointerType==="touch"?(t.removeEventListener("click",s.current),s.current=l,t.addEventListener("click",s.current,{once:!0})):l()}else t.removeEventListener("click",s.current);n.current=!1},i=window.setTimeout(()=>{t.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",a),t.removeEventListener("click",s.current)}},[t,r]),{onPointerDownCapture:()=>n.current=!0}}function kk(e,t=globalThis==null?void 0:globalThis.document){const r=ai(e),n=p.useRef(!1);return p.useEffect(()=>{const s=a=>{a.target&&!n.current&&Ly(bk,r,{originalEvent:a},{discrete:!1})};return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function Op(){const e=new CustomEvent(Iu);document.dispatchEvent(e)}function Ly(e,t,r,{discrete:n}){const s=r.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&s.addEventListener(e,t,{once:!0}),n?vk(s,a):s.dispatchEvent(a)}var gc="focusScope.autoFocusOnMount",vc="focusScope.autoFocusOnUnmount",Ap={bubbles:!1,cancelable:!0},jk="FocusScope",Dy=p.forwardRef((e,t)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:s,onUnmountAutoFocus:a,...i}=e,[o,l]=p.useState(null),u=ai(s),d=ai(a),f=p.useRef(null),h=Gn(t,v=>l(v)),m=p.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;p.useEffect(()=>{if(n){let v=function(w){if(m.paused||!o)return;const E=w.target;o.contains(E)?f.current=E:Mr(f.current,{select:!0})},_=function(w){if(m.paused||!o)return;const E=w.relatedTarget;E!==null&&(o.contains(E)||Mr(f.current,{select:!0}))},y=function(w){if(document.activeElement===document.body)for(const C of w)C.removedNodes.length>0&&Mr(o)};document.addEventListener("focusin",v),document.addEventListener("focusout",_);const g=new MutationObserver(y);return o&&g.observe(o,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",v),document.removeEventListener("focusout",_),g.disconnect()}}},[n,o,m.paused]),p.useEffect(()=>{if(o){Ip.add(m);const v=document.activeElement;if(!o.contains(v)){const y=new CustomEvent(gc,Ap);o.addEventListener(gc,u),o.dispatchEvent(y),y.defaultPrevented||(Ck(Ok($y(o)),{select:!0}),document.activeElement===v&&Mr(o))}return()=>{o.removeEventListener(gc,u),setTimeout(()=>{const y=new CustomEvent(vc,Ap);o.addEventListener(vc,d),o.dispatchEvent(y),y.defaultPrevented||Mr(v??document.body,{select:!0}),o.removeEventListener(vc,d),Ip.remove(m)},0)}}},[o,u,d,m]);const x=p.useCallback(v=>{if(!r&&!n||m.paused)return;const _=v.key==="Tab"&&!v.altKey&&!v.ctrlKey&&!v.metaKey,y=document.activeElement;if(_&&y){const g=v.currentTarget,[w,E]=Nk(g);w&&E?!v.shiftKey&&y===E?(v.preventDefault(),r&&Mr(w,{select:!0})):v.shiftKey&&y===w&&(v.preventDefault(),r&&Mr(E,{select:!0})):y===g&&v.preventDefault()}},[r,n,m.paused]);return c.jsx(Nr.div,{tabIndex:-1,...i,ref:h,onKeyDown:x})});Dy.displayName=jk;function Ck(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if(Mr(n,{select:t}),document.activeElement!==r)return}function Nk(e){const t=$y(e),r=zp(t,e),n=zp(t.reverse(),e);return[r,n]}function $y(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const s=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||s?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function zp(e,t){for(const r of e)if(!Pk(r,{upTo:t}))return r}function Pk(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function Tk(e){return e instanceof HTMLInputElement&&"select"in e}function Mr(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&Tk(e)&&t&&e.select()}}var Ip=Rk();function Rk(){let e=[];return{add(t){const r=e[0];t!==r&&(r==null||r.pause()),e=Lp(e,t),e.unshift(t)},remove(t){var r;e=Lp(e,t),(r=e[0])==null||r.resume()}}}function Lp(e,t){const r=[...e],n=r.indexOf(t);return n!==-1&&r.splice(n,1),r}function Ok(e){return e.filter(t=>t.tagName!=="A")}var Ak="Portal",My=p.forwardRef((e,t)=>{var o;const{container:r,...n}=e,[s,a]=p.useState(!1);si(()=>a(!0),[]);const i=r||s&&((o=globalThis==null?void 0:globalThis.document)==null?void 0:o.body);return i?Sv.createPortal(c.jsx(Nr.div,{...n,ref:t}),i):null});My.displayName=Ak;function zk(e,t){return p.useReducer((r,n)=>t[r][n]??r,e)}var Sl=e=>{const{present:t,children:r}=e,n=Ik(t),s=typeof r=="function"?r({present:n.isPresent}):p.Children.only(r),a=Gn(n.ref,Lk(s));return typeof r=="function"||n.isPresent?p.cloneElement(s,{ref:a}):null};Sl.displayName="Presence";function Ik(e){const[t,r]=p.useState(),n=p.useRef(null),s=p.useRef(e),a=p.useRef("none"),i=e?"mounted":"unmounted",[o,l]=zk(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return p.useEffect(()=>{const u=Hi(n.current);a.current=o==="mounted"?u:"none"},[o]),si(()=>{const u=n.current,d=s.current;if(d!==e){const h=a.current,m=Hi(u);e?l("MOUNT"):m==="none"||(u==null?void 0:u.display)==="none"?l("UNMOUNT"):l(d&&h!==m?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,l]),si(()=>{if(t){let u;const d=t.ownerDocument.defaultView??window,f=m=>{const v=Hi(n.current).includes(CSS.escape(m.animationName));if(m.target===t&&v&&(l("ANIMATION_END"),!s.current)){const _=t.style.animationFillMode;t.style.animationFillMode="forwards",u=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=_)})}},h=m=>{m.target===t&&(a.current=Hi(n.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{d.clearTimeout(u),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(o),ref:p.useCallback(u=>{n.current=u?getComputedStyle(u):null,r(u)},[])}}function Hi(e){return(e==null?void 0:e.animationName)||"none"}function Lk(e){var n,s;let t=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var yc=0;function Dk(){p.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Dp()),document.body.insertAdjacentElement("beforeend",e[1]??Dp()),yc++,()=>{yc===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),yc--}},[])}function Dp(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var or=function(){return or=Object.assign||function(t){for(var r,n=1,s=arguments.length;n"u")return e4;var t=t4(e),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,n-r+t[2]-t[0])}},n4=Vy(),Os="data-scroll-locked",s4=function(e,t,r,n){var s=e.left,a=e.top,i=e.right,o=e.gap;return r===void 0&&(r="margin"),` .`.concat(Mk,` { overflow: hidden `).concat(n,`; padding-right: `).concat(o,"px ").concat(n,`; } body[`).concat(Os,`] { overflow: hidden `).concat(n,`; overscroll-behavior: contain; `).concat([t&&"position: relative ".concat(n,";"),r==="margin"&&` padding-left: `.concat(s,`px; padding-top: `).concat(a,`px; padding-right: `).concat(i,`px; margin-left:0; margin-top:0; margin-right: `).concat(o,"px ").concat(n,`; `),r==="padding"&&"padding-right: ".concat(o,"px ").concat(n,";")].filter(Boolean).join(""),` } .`).concat(po,` { right: `).concat(o,"px ").concat(n,`; } .`).concat(mo,` { margin-right: `).concat(o,"px ").concat(n,`; } .`).concat(po," .").concat(po,` { right: 0 `).concat(n,`; } .`).concat(mo," .").concat(mo,` { margin-right: 0 `).concat(n,`; } body[`).concat(Os,`] { `).concat(Fk,": ").concat(o,`px; } `)},Mp=function(){var e=parseInt(document.body.getAttribute(Os)||"0",10);return isFinite(e)?e:0},a4=function(){p.useEffect(function(){return document.body.setAttribute(Os,(Mp()+1).toString()),function(){var e=Mp()-1;e<=0?document.body.removeAttribute(Os):document.body.setAttribute(Os,e.toString())}},[])},i4=function(e){var t=e.noRelative,r=e.noImportant,n=e.gapMode,s=n===void 0?"margin":n;a4();var a=p.useMemo(function(){return r4(s)},[s]);return p.createElement(n4,{styles:s4(a,!t,s,r?"":"!important")})},Lu=!1;if(typeof window<"u")try{var Wi=Object.defineProperty({},"passive",{get:function(){return Lu=!0,!0}});window.addEventListener("test",Wi,Wi),window.removeEventListener("test",Wi,Wi)}catch{Lu=!1}var is=Lu?{passive:!1}:!1,o4=function(e){return e.tagName==="TEXTAREA"},Hy=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!o4(e)&&r[t]==="visible")},l4=function(e){return Hy(e,"overflowY")},c4=function(e){return Hy(e,"overflowX")},Fp=function(e,t){var r=t.ownerDocument,n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var s=Wy(e,n);if(s){var a=qy(e,n),i=a[1],o=a[2];if(i>o)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},u4=function(e){var t=e.scrollTop,r=e.scrollHeight,n=e.clientHeight;return[t,r,n]},d4=function(e){var t=e.scrollLeft,r=e.scrollWidth,n=e.clientWidth;return[t,r,n]},Wy=function(e,t){return e==="v"?l4(t):c4(t)},qy=function(e,t){return e==="v"?u4(t):d4(t)},f4=function(e,t){return e==="h"&&t==="rtl"?-1:1},h4=function(e,t,r,n,s){var a=f4(e,window.getComputedStyle(t).direction),i=a*n,o=r.target,l=t.contains(o),u=!1,d=i>0,f=0,h=0;do{if(!o)break;var m=qy(e,o),x=m[0],v=m[1],_=m[2],y=v-_-a*x;(x||y)&&Wy(e,o)&&(f+=y,h+=x);var g=o.parentNode;o=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!l&&o!==document.body||l&&(t.contains(o)||t===o));return(d&&Math.abs(f)<1||!d&&Math.abs(h)<1)&&(u=!0),u},qi=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Up=function(e){return[e.deltaX,e.deltaY]},Bp=function(e){return e&&"current"in e?e.current:e},p4=function(e,t){return e[0]===t[0]&&e[1]===t[1]},m4=function(e){return` .block-interactivity-`.concat(e,` {pointer-events: none;} .allow-interactivity-`).concat(e,` {pointer-events: all;} `)},g4=0,os=[];function v4(e){var t=p.useRef([]),r=p.useRef([0,0]),n=p.useRef(),s=p.useState(g4++)[0],a=p.useState(Vy)[0],i=p.useRef(e);p.useEffect(function(){i.current=e},[e]),p.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var v=$k([e.lockRef.current],(e.shards||[]).map(Bp),!0).filter(Boolean);return v.forEach(function(_){return _.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),v.forEach(function(_){return _.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var o=p.useCallback(function(v,_){if("touches"in v&&v.touches.length===2||v.type==="wheel"&&v.ctrlKey)return!i.current.allowPinchZoom;var y=qi(v),g=r.current,w="deltaX"in v?v.deltaX:g[0]-y[0],E="deltaY"in v?v.deltaY:g[1]-y[1],C,R=v.target,b=Math.abs(w)>Math.abs(E)?"h":"v";if("touches"in v&&b==="h"&&R.type==="range")return!1;var k=window.getSelection(),A=k&&k.anchorNode,N=A?A===R||A.contains(R):!1;if(N)return!1;var z=Fp(b,R);if(!z)return!0;if(z?C=b:(C=b==="v"?"h":"v",z=Fp(b,R)),!z)return!1;if(!n.current&&"changedTouches"in v&&(w||E)&&(n.current=C),!C)return!0;var L=n.current||C;return h4(L,_,v,L==="h"?w:E)},[]),l=p.useCallback(function(v){var _=v;if(!(!os.length||os[os.length-1]!==a)){var y="deltaY"in _?Up(_):qi(_),g=t.current.filter(function(C){return C.name===_.type&&(C.target===_.target||_.target===C.shadowParent)&&p4(C.delta,y)})[0];if(g&&g.should){_.cancelable&&_.preventDefault();return}if(!g){var w=(i.current.shards||[]).map(Bp).filter(Boolean).filter(function(C){return C.contains(_.target)}),E=w.length>0?o(_,w[0]):!i.current.noIsolation;E&&_.cancelable&&_.preventDefault()}}},[]),u=p.useCallback(function(v,_,y,g){var w={name:v,delta:_,target:y,should:g,shadowParent:y4(y)};t.current.push(w),setTimeout(function(){t.current=t.current.filter(function(E){return E!==w})},1)},[]),d=p.useCallback(function(v){r.current=qi(v),n.current=void 0},[]),f=p.useCallback(function(v){u(v.type,Up(v),v.target,o(v,e.lockRef.current))},[]),h=p.useCallback(function(v){u(v.type,qi(v),v.target,o(v,e.lockRef.current))},[]);p.useEffect(function(){return os.push(a),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:h}),document.addEventListener("wheel",l,is),document.addEventListener("touchmove",l,is),document.addEventListener("touchstart",d,is),function(){os=os.filter(function(v){return v!==a}),document.removeEventListener("wheel",l,is),document.removeEventListener("touchmove",l,is),document.removeEventListener("touchstart",d,is)}},[]);var m=e.removeScrollBar,x=e.inert;return p.createElement(p.Fragment,null,x?p.createElement(a,{styles:m4(s)}):null,m?p.createElement(i4,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function y4(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const x4=Gk(By,v4);var Gy=p.forwardRef(function(e,t){return p.createElement(El,or({},e,{ref:t,sideCar:x4}))});Gy.classNames=El.classNames;var w4=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},ls=new WeakMap,Gi=new WeakMap,Ki={},_c=0,Ky=function(e){return e&&(e.host||Ky(e.parentNode))},b4=function(e,t){return t.map(function(r){if(e.contains(r))return r;var n=Ky(r);return n&&e.contains(n)?n:(console.error("aria-hidden",r,"in not contained inside",e,". Doing nothing"),null)}).filter(function(r){return!!r})},_4=function(e,t,r,n){var s=b4(t,Array.isArray(e)?e:[e]);Ki[r]||(Ki[r]=new WeakMap);var a=Ki[r],i=[],o=new Set,l=new Set(s),u=function(f){!f||o.has(f)||(o.add(f),u(f.parentNode))};s.forEach(u);var d=function(f){!f||l.has(f)||Array.prototype.forEach.call(f.children,function(h){if(o.has(h))d(h);else try{var m=h.getAttribute(n),x=m!==null&&m!=="false",v=(ls.get(h)||0)+1,_=(a.get(h)||0)+1;ls.set(h,v),a.set(h,_),i.push(h),v===1&&x&&Gi.set(h,!0),_===1&&h.setAttribute(r,"true"),x||h.setAttribute(n,"true")}catch(y){console.error("aria-hidden: cannot operate on ",h,y)}})};return d(t),o.clear(),_c++,function(){i.forEach(function(f){var h=ls.get(f)-1,m=a.get(f)-1;ls.set(f,h),a.set(f,m),h||(Gi.has(f)||f.removeAttribute(n),Gi.delete(f)),m||f.removeAttribute(r)}),_c--,_c||(ls=new WeakMap,ls=new WeakMap,Gi=new WeakMap,Ki={})}},S4=function(e,t,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),s=w4(e);return s?(n.push.apply(n,Array.from(s.querySelectorAll("[aria-live], script"))),_4(n,s,r,"aria-hidden")):function(){return null}},kl="Dialog",[Qy]=nk(kl),[E4,rr]=Qy(kl),Yy=e=>{const{__scopeDialog:t,children:r,open:n,defaultOpen:s,onOpenChange:a,modal:i=!0}=e,o=p.useRef(null),l=p.useRef(null),[u,d]=lk({prop:n,defaultProp:s??!1,onChange:a,caller:kl});return c.jsx(E4,{scope:t,triggerRef:o,contentRef:l,contentId:mc(),titleId:mc(),descriptionId:mc(),open:u,onOpenChange:d,onOpenToggle:p.useCallback(()=>d(f=>!f),[d]),modal:i,children:r})};Yy.displayName=kl;var Jy="DialogTrigger",k4=p.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=rr(Jy,r),a=Gn(t,s.triggerRef);return c.jsx(Nr.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":Zd(s.open),...n,ref:a,onClick:nn(e.onClick,s.onOpenToggle)})});k4.displayName=Jy;var Jd="DialogPortal",[j4,Xy]=Qy(Jd,{forceMount:void 0}),Zy=e=>{const{__scopeDialog:t,forceMount:r,children:n,container:s}=e,a=rr(Jd,t);return c.jsx(j4,{scope:t,forceMount:r,children:p.Children.map(n,i=>c.jsx(Sl,{present:r||a.open,children:c.jsx(My,{asChild:!0,container:s,children:i})}))})};Zy.displayName=Jd;var qo="DialogOverlay",e0=p.forwardRef((e,t)=>{const r=Xy(qo,e.__scopeDialog),{forceMount:n=r.forceMount,...s}=e,a=rr(qo,e.__scopeDialog);return a.modal?c.jsx(Sl,{present:n||a.open,children:c.jsx(N4,{...s,ref:t})}):null});e0.displayName=qo;var C4=Ay("DialogOverlay.RemoveScroll"),N4=p.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=rr(qo,r);return c.jsx(Gy,{as:C4,allowPinchZoom:!0,shards:[s.contentRef],children:c.jsx(Nr.div,{"data-state":Zd(s.open),...n,ref:t,style:{pointerEvents:"auto",...n.style}})})}),Un="DialogContent",t0=p.forwardRef((e,t)=>{const r=Xy(Un,e.__scopeDialog),{forceMount:n=r.forceMount,...s}=e,a=rr(Un,e.__scopeDialog);return c.jsx(Sl,{present:n||a.open,children:a.modal?c.jsx(P4,{...s,ref:t}):c.jsx(T4,{...s,ref:t})})});t0.displayName=Un;var P4=p.forwardRef((e,t)=>{const r=rr(Un,e.__scopeDialog),n=p.useRef(null),s=Gn(t,r.contentRef,n);return p.useEffect(()=>{const a=n.current;if(a)return S4(a)},[]),c.jsx(r0,{...e,ref:s,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:nn(e.onCloseAutoFocus,a=>{var i;a.preventDefault(),(i=r.triggerRef.current)==null||i.focus()}),onPointerDownOutside:nn(e.onPointerDownOutside,a=>{const i=a.detail.originalEvent,o=i.button===0&&i.ctrlKey===!0;(i.button===2||o)&&a.preventDefault()}),onFocusOutside:nn(e.onFocusOutside,a=>a.preventDefault())})}),T4=p.forwardRef((e,t)=>{const r=rr(Un,e.__scopeDialog),n=p.useRef(!1),s=p.useRef(!1);return c.jsx(r0,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{var i,o;(i=e.onCloseAutoFocus)==null||i.call(e,a),a.defaultPrevented||(n.current||(o=r.triggerRef.current)==null||o.focus(),a.preventDefault()),n.current=!1,s.current=!1},onInteractOutside:a=>{var l,u;(l=e.onInteractOutside)==null||l.call(e,a),a.defaultPrevented||(n.current=!0,a.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const i=a.target;((u=r.triggerRef.current)==null?void 0:u.contains(i))&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&s.current&&a.preventDefault()}})}),r0=p.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:s,onCloseAutoFocus:a,...i}=e,o=rr(Un,r),l=p.useRef(null),u=Gn(t,l);return Dk(),c.jsxs(c.Fragment,{children:[c.jsx(Dy,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:s,onUnmountAutoFocus:a,children:c.jsx(Iy,{role:"dialog",id:o.contentId,"aria-describedby":o.descriptionId,"aria-labelledby":o.titleId,"data-state":Zd(o.open),...i,ref:u,onDismiss:()=>o.onOpenChange(!1)})}),c.jsxs(c.Fragment,{children:[c.jsx(R4,{titleId:o.titleId}),c.jsx(A4,{contentRef:l,descriptionId:o.descriptionId})]})]})}),Xd="DialogTitle",n0=p.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=rr(Xd,r);return c.jsx(Nr.h2,{id:s.titleId,...n,ref:t})});n0.displayName=Xd;var s0="DialogDescription",a0=p.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=rr(s0,r);return c.jsx(Nr.p,{id:s.descriptionId,...n,ref:t})});a0.displayName=s0;var i0="DialogClose",o0=p.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=rr(i0,r);return c.jsx(Nr.button,{type:"button",...n,ref:t,onClick:nn(e.onClick,()=>s.onOpenChange(!1))})});o0.displayName=i0;function Zd(e){return e?"open":"closed"}var l0="DialogTitleWarning",[wN,c0]=rk(l0,{contentName:Un,titleName:Xd,docsSlug:"dialog"}),R4=({titleId:e})=>{const t=c0(l0),r=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users. If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component. For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return p.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},O4="DialogDescriptionWarning",A4=({contentRef:e,descriptionId:t})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${c0(O4).contentName}}.`;return p.useEffect(()=>{var a;const s=(a=e.current)==null?void 0:a.getAttribute("aria-describedby");t&&s&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},z4=Yy,I4=Zy,u0=e0,d0=t0,f0=n0,h0=a0,L4=o0;/** * @license lucide-react v0.555.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const D4=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),$4=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,r,n)=>n?n.toUpperCase():r.toLowerCase()),Vp=e=>{const t=$4(e);return t.charAt(0).toUpperCase()+t.slice(1)},p0=(...e)=>e.filter((t,r,n)=>!!t&&t.trim()!==""&&n.indexOf(t)===r).join(" ").trim(),M4=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};/** * @license lucide-react v0.555.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */var F4={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** * @license lucide-react v0.555.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const U4=p.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:s="",children:a,iconNode:i,...o},l)=>p.createElement("svg",{ref:l,...F4,width:t,height:t,stroke:e,strokeWidth:n?Number(r)*24/Number(t):r,className:p0("lucide",s),...!a&&!M4(o)&&{"aria-hidden":"true"},...o},[...i.map(([u,d])=>p.createElement(u,d)),...Array.isArray(a)?a:[a]]));/** * @license lucide-react v0.555.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const B4=(e,t)=>{const r=p.forwardRef(({className:n,...s},a)=>p.createElement(U4,{ref:a,iconNode:t,className:p0(`lucide-${D4(Vp(e))}`,`lucide-${e}`,n),...s}));return r.displayName=Vp(e),r};/** * @license lucide-react v0.555.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const V4=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],H4=B4("x",V4);function m0(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t{const r=new Array(e.length+t.length);for(let n=0;n({classGroupId:e,validator:t}),g0=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),Go="-",Hp=[],K4="arbitrary..",Q4=e=>{const t=J4(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return Y4(i);const o=i.split(Go),l=o[0]===""&&o.length>1?1:0;return v0(o,l,t)},getConflictingClassGroupIds:(i,o)=>{if(o){const l=n[i],u=r[i];return l?u?q4(u,l):l:u||Hp}return r[i]||Hp}}},v0=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const s=e[t],a=r.nextPart.get(s);if(a){const u=v0(e,t+1,a);if(u)return u}const i=r.validators;if(i===null)return;const o=t===0?e.join(Go):e.slice(t).join(Go),l=i.length;for(let u=0;ue.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),r=t.indexOf(":"),n=t.slice(0,r);return n?K4+n:void 0})(),J4=e=>{const{theme:t,classGroups:r}=e;return X4(r,t)},X4=(e,t)=>{const r=g0();for(const n in e){const s=e[n];ef(s,r,n,t)}return r},ef=(e,t,r,n)=>{const s=e.length;for(let a=0;a{if(typeof e=="string"){ej(e,t,r);return}if(typeof e=="function"){tj(e,t,r,n);return}rj(e,t,r,n)},ej=(e,t,r)=>{const n=e===""?t:y0(t,e);n.classGroupId=r},tj=(e,t,r,n)=>{if(nj(e)){ef(e(n),t,r,n);return}t.validators===null&&(t.validators=[]),t.validators.push(G4(r,e))},rj=(e,t,r,n)=>{const s=Object.entries(e),a=s.length;for(let i=0;i{let r=e;const n=t.split(Go),s=n.length;for(let a=0;a"isThemeGetter"in e&&e.isThemeGetter===!0,sj=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),n=Object.create(null);const s=(a,i)=>{r[a]=i,t++,t>e&&(t=0,n=r,r=Object.create(null))};return{get(a){let i=r[a];if(i!==void 0)return i;if((i=n[a])!==void 0)return s(a,i),i},set(a,i){a in r?r[a]=i:s(a,i)}}},Du="!",Wp=":",aj=[],qp=(e,t,r,n,s)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:n,isExternal:s}),ij=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=s=>{const a=[];let i=0,o=0,l=0,u;const d=s.length;for(let v=0;vl?u-l:void 0;return qp(a,m,h,x)};if(t){const s=t+Wp,a=n;n=i=>i.startsWith(s)?a(i.slice(s.length)):qp(aj,!1,i,void 0,!0)}if(r){const s=n;n=a=>r({className:a,parseClassName:s})}return n},oj=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((r,n)=>{t.set(r,1e6+n)}),r=>{const n=[];let s=[];for(let a=0;a0&&(s.sort(),n.push(...s),s=[]),n.push(i)):s.push(i)}return s.length>0&&(s.sort(),n.push(...s)),n}},lj=e=>({cache:sj(e.cacheSize),parseClassName:ij(e),sortModifiers:oj(e),...Q4(e)}),cj=/\s+/,uj=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:s,sortModifiers:a}=t,i=[],o=e.trim().split(cj);let l="";for(let u=o.length-1;u>=0;u-=1){const d=o[u],{isExternal:f,modifiers:h,hasImportantModifier:m,baseClassName:x,maybePostfixModifierPosition:v}=r(d);if(f){l=d+(l.length>0?" "+l:l);continue}let _=!!v,y=n(_?x.substring(0,v):x);if(!y){if(!_){l=d+(l.length>0?" "+l:l);continue}if(y=n(x),!y){l=d+(l.length>0?" "+l:l);continue}_=!1}const g=h.length===0?"":h.length===1?h[0]:a(h).join(":"),w=m?g+Du:g,E=w+y;if(i.indexOf(E)>-1)continue;i.push(E);const C=s(y,_);for(let R=0;R0?" "+l:l)}return l},dj=(...e)=>{let t=0,r,n,s="";for(;t{if(typeof e=="string")return e;let t,r="";for(let n=0;n{let r,n,s,a;const i=l=>{const u=t.reduce((d,f)=>f(d),e());return r=lj(u),n=r.cache.get,s=r.cache.set,a=o,o(l)},o=l=>{const u=n(l);if(u)return u;const d=uj(l,r);return s(l,d),d};return a=i,(...l)=>a(dj(...l))},hj=[],Ye=e=>{const t=r=>r[e]||hj;return t.isThemeGetter=!0,t},w0=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,b0=/^\((?:(\w[\w-]*):)?(.+)\)$/i,pj=/^\d+\/\d+$/,mj=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,gj=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,vj=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,yj=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,xj=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,cs=e=>pj.test(e),ne=e=>!!e&&!Number.isNaN(Number(e)),Ar=e=>!!e&&Number.isInteger(Number(e)),Sc=e=>e.endsWith("%")&&ne(e.slice(0,-1)),pr=e=>mj.test(e),wj=()=>!0,bj=e=>gj.test(e)&&!vj.test(e),_0=()=>!1,_j=e=>yj.test(e),Sj=e=>xj.test(e),Ej=e=>!U(e)&&!B(e),kj=e=>Ys(e,k0,_0),U=e=>w0.test(e),yn=e=>Ys(e,j0,bj),Ec=e=>Ys(e,Tj,ne),Gp=e=>Ys(e,S0,_0),jj=e=>Ys(e,E0,Sj),Qi=e=>Ys(e,C0,_j),B=e=>b0.test(e),va=e=>Js(e,j0),Cj=e=>Js(e,Rj),Kp=e=>Js(e,S0),Nj=e=>Js(e,k0),Pj=e=>Js(e,E0),Yi=e=>Js(e,C0,!0),Ys=(e,t,r)=>{const n=w0.exec(e);return n?n[1]?t(n[1]):r(n[2]):!1},Js=(e,t,r=!1)=>{const n=b0.exec(e);return n?n[1]?t(n[1]):r:!1},S0=e=>e==="position"||e==="percentage",E0=e=>e==="image"||e==="url",k0=e=>e==="length"||e==="size"||e==="bg-size",j0=e=>e==="length",Tj=e=>e==="number",Rj=e=>e==="family-name",C0=e=>e==="shadow",Oj=()=>{const e=Ye("color"),t=Ye("font"),r=Ye("text"),n=Ye("font-weight"),s=Ye("tracking"),a=Ye("leading"),i=Ye("breakpoint"),o=Ye("container"),l=Ye("spacing"),u=Ye("radius"),d=Ye("shadow"),f=Ye("inset-shadow"),h=Ye("text-shadow"),m=Ye("drop-shadow"),x=Ye("blur"),v=Ye("perspective"),_=Ye("aspect"),y=Ye("ease"),g=Ye("animate"),w=()=>["auto","avoid","all","avoid-page","page","left","right","column"],E=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],C=()=>[...E(),B,U],R=()=>["auto","hidden","clip","visible","scroll"],b=()=>["auto","contain","none"],k=()=>[B,U,l],A=()=>[cs,"full","auto",...k()],N=()=>[Ar,"none","subgrid",B,U],z=()=>["auto",{span:["full",Ar,B,U]},Ar,B,U],L=()=>[Ar,"auto",B,U],G=()=>["auto","min","max","fr",B,U],$=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],ee=()=>["start","end","center","stretch","center-safe","end-safe"],J=()=>["auto",...k()],ge=()=>[cs,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...k()],P=()=>[e,B,U],H=()=>[...E(),Kp,Gp,{position:[B,U]}],W=()=>["no-repeat",{repeat:["","x","y","space","round"]}],te=()=>["auto","cover","contain",Nj,kj,{size:[B,U]}],re=()=>[Sc,va,yn],ue=()=>["","none","full",u,B,U],fe=()=>["",ne,va,yn],Ne=()=>["solid","dashed","dotted","double"],_e=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Q=()=>[ne,Sc,Kp,Gp],pe=()=>["","none",x,B,U],Qe=()=>["none",ne,B,U],dt=()=>["none",ne,B,U],St=()=>[ne,B,U],ze=()=>[cs,"full",...k()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[pr],breakpoint:[pr],color:[wj],container:[pr],"drop-shadow":[pr],ease:["in","out","in-out"],font:[Ej],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[pr],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[pr],shadow:[pr],spacing:["px",ne],text:[pr],"text-shadow":[pr],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",cs,U,B,_]}],container:["container"],columns:[{columns:[ne,U,B,o]}],"break-after":[{"break-after":w()}],"break-before":[{"break-before":w()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:C()}],overflow:[{overflow:R()}],"overflow-x":[{"overflow-x":R()}],"overflow-y":[{"overflow-y":R()}],overscroll:[{overscroll:b()}],"overscroll-x":[{"overscroll-x":b()}],"overscroll-y":[{"overscroll-y":b()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:A()}],"inset-x":[{"inset-x":A()}],"inset-y":[{"inset-y":A()}],start:[{start:A()}],end:[{end:A()}],top:[{top:A()}],right:[{right:A()}],bottom:[{bottom:A()}],left:[{left:A()}],visibility:["visible","invisible","collapse"],z:[{z:[Ar,"auto",B,U]}],basis:[{basis:[cs,"full","auto",o,...k()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[ne,cs,"auto","initial","none",U]}],grow:[{grow:["",ne,B,U]}],shrink:[{shrink:["",ne,B,U]}],order:[{order:[Ar,"first","last","none",B,U]}],"grid-cols":[{"grid-cols":N()}],"col-start-end":[{col:z()}],"col-start":[{"col-start":L()}],"col-end":[{"col-end":L()}],"grid-rows":[{"grid-rows":N()}],"row-start-end":[{row:z()}],"row-start":[{"row-start":L()}],"row-end":[{"row-end":L()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":G()}],"auto-rows":[{"auto-rows":G()}],gap:[{gap:k()}],"gap-x":[{"gap-x":k()}],"gap-y":[{"gap-y":k()}],"justify-content":[{justify:[...$(),"normal"]}],"justify-items":[{"justify-items":[...ee(),"normal"]}],"justify-self":[{"justify-self":["auto",...ee()]}],"align-content":[{content:["normal",...$()]}],"align-items":[{items:[...ee(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...ee(),{baseline:["","last"]}]}],"place-content":[{"place-content":$()}],"place-items":[{"place-items":[...ee(),"baseline"]}],"place-self":[{"place-self":["auto",...ee()]}],p:[{p:k()}],px:[{px:k()}],py:[{py:k()}],ps:[{ps:k()}],pe:[{pe:k()}],pt:[{pt:k()}],pr:[{pr:k()}],pb:[{pb:k()}],pl:[{pl:k()}],m:[{m:J()}],mx:[{mx:J()}],my:[{my:J()}],ms:[{ms:J()}],me:[{me:J()}],mt:[{mt:J()}],mr:[{mr:J()}],mb:[{mb:J()}],ml:[{ml:J()}],"space-x":[{"space-x":k()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":k()}],"space-y-reverse":["space-y-reverse"],size:[{size:ge()}],w:[{w:[o,"screen",...ge()]}],"min-w":[{"min-w":[o,"screen","none",...ge()]}],"max-w":[{"max-w":[o,"screen","none","prose",{screen:[i]},...ge()]}],h:[{h:["screen","lh",...ge()]}],"min-h":[{"min-h":["screen","lh","none",...ge()]}],"max-h":[{"max-h":["screen","lh",...ge()]}],"font-size":[{text:["base",r,va,yn]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,B,Ec]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Sc,U]}],"font-family":[{font:[Cj,U,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[s,B,U]}],"line-clamp":[{"line-clamp":[ne,"none",B,Ec]}],leading:[{leading:[a,...k()]}],"list-image":[{"list-image":["none",B,U]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",B,U]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:P()}],"text-color":[{text:P()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Ne(),"wavy"]}],"text-decoration-thickness":[{decoration:[ne,"from-font","auto",B,yn]}],"text-decoration-color":[{decoration:P()}],"underline-offset":[{"underline-offset":[ne,"auto",B,U]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:k()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",B,U]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",B,U]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:H()}],"bg-repeat":[{bg:W()}],"bg-size":[{bg:te()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Ar,B,U],radial:["",B,U],conic:[Ar,B,U]},Pj,jj]}],"bg-color":[{bg:P()}],"gradient-from-pos":[{from:re()}],"gradient-via-pos":[{via:re()}],"gradient-to-pos":[{to:re()}],"gradient-from":[{from:P()}],"gradient-via":[{via:P()}],"gradient-to":[{to:P()}],rounded:[{rounded:ue()}],"rounded-s":[{"rounded-s":ue()}],"rounded-e":[{"rounded-e":ue()}],"rounded-t":[{"rounded-t":ue()}],"rounded-r":[{"rounded-r":ue()}],"rounded-b":[{"rounded-b":ue()}],"rounded-l":[{"rounded-l":ue()}],"rounded-ss":[{"rounded-ss":ue()}],"rounded-se":[{"rounded-se":ue()}],"rounded-ee":[{"rounded-ee":ue()}],"rounded-es":[{"rounded-es":ue()}],"rounded-tl":[{"rounded-tl":ue()}],"rounded-tr":[{"rounded-tr":ue()}],"rounded-br":[{"rounded-br":ue()}],"rounded-bl":[{"rounded-bl":ue()}],"border-w":[{border:fe()}],"border-w-x":[{"border-x":fe()}],"border-w-y":[{"border-y":fe()}],"border-w-s":[{"border-s":fe()}],"border-w-e":[{"border-e":fe()}],"border-w-t":[{"border-t":fe()}],"border-w-r":[{"border-r":fe()}],"border-w-b":[{"border-b":fe()}],"border-w-l":[{"border-l":fe()}],"divide-x":[{"divide-x":fe()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":fe()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...Ne(),"hidden","none"]}],"divide-style":[{divide:[...Ne(),"hidden","none"]}],"border-color":[{border:P()}],"border-color-x":[{"border-x":P()}],"border-color-y":[{"border-y":P()}],"border-color-s":[{"border-s":P()}],"border-color-e":[{"border-e":P()}],"border-color-t":[{"border-t":P()}],"border-color-r":[{"border-r":P()}],"border-color-b":[{"border-b":P()}],"border-color-l":[{"border-l":P()}],"divide-color":[{divide:P()}],"outline-style":[{outline:[...Ne(),"none","hidden"]}],"outline-offset":[{"outline-offset":[ne,B,U]}],"outline-w":[{outline:["",ne,va,yn]}],"outline-color":[{outline:P()}],shadow:[{shadow:["","none",d,Yi,Qi]}],"shadow-color":[{shadow:P()}],"inset-shadow":[{"inset-shadow":["none",f,Yi,Qi]}],"inset-shadow-color":[{"inset-shadow":P()}],"ring-w":[{ring:fe()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:P()}],"ring-offset-w":[{"ring-offset":[ne,yn]}],"ring-offset-color":[{"ring-offset":P()}],"inset-ring-w":[{"inset-ring":fe()}],"inset-ring-color":[{"inset-ring":P()}],"text-shadow":[{"text-shadow":["none",h,Yi,Qi]}],"text-shadow-color":[{"text-shadow":P()}],opacity:[{opacity:[ne,B,U]}],"mix-blend":[{"mix-blend":[..._e(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":_e()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[ne]}],"mask-image-linear-from-pos":[{"mask-linear-from":Q()}],"mask-image-linear-to-pos":[{"mask-linear-to":Q()}],"mask-image-linear-from-color":[{"mask-linear-from":P()}],"mask-image-linear-to-color":[{"mask-linear-to":P()}],"mask-image-t-from-pos":[{"mask-t-from":Q()}],"mask-image-t-to-pos":[{"mask-t-to":Q()}],"mask-image-t-from-color":[{"mask-t-from":P()}],"mask-image-t-to-color":[{"mask-t-to":P()}],"mask-image-r-from-pos":[{"mask-r-from":Q()}],"mask-image-r-to-pos":[{"mask-r-to":Q()}],"mask-image-r-from-color":[{"mask-r-from":P()}],"mask-image-r-to-color":[{"mask-r-to":P()}],"mask-image-b-from-pos":[{"mask-b-from":Q()}],"mask-image-b-to-pos":[{"mask-b-to":Q()}],"mask-image-b-from-color":[{"mask-b-from":P()}],"mask-image-b-to-color":[{"mask-b-to":P()}],"mask-image-l-from-pos":[{"mask-l-from":Q()}],"mask-image-l-to-pos":[{"mask-l-to":Q()}],"mask-image-l-from-color":[{"mask-l-from":P()}],"mask-image-l-to-color":[{"mask-l-to":P()}],"mask-image-x-from-pos":[{"mask-x-from":Q()}],"mask-image-x-to-pos":[{"mask-x-to":Q()}],"mask-image-x-from-color":[{"mask-x-from":P()}],"mask-image-x-to-color":[{"mask-x-to":P()}],"mask-image-y-from-pos":[{"mask-y-from":Q()}],"mask-image-y-to-pos":[{"mask-y-to":Q()}],"mask-image-y-from-color":[{"mask-y-from":P()}],"mask-image-y-to-color":[{"mask-y-to":P()}],"mask-image-radial":[{"mask-radial":[B,U]}],"mask-image-radial-from-pos":[{"mask-radial-from":Q()}],"mask-image-radial-to-pos":[{"mask-radial-to":Q()}],"mask-image-radial-from-color":[{"mask-radial-from":P()}],"mask-image-radial-to-color":[{"mask-radial-to":P()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":E()}],"mask-image-conic-pos":[{"mask-conic":[ne]}],"mask-image-conic-from-pos":[{"mask-conic-from":Q()}],"mask-image-conic-to-pos":[{"mask-conic-to":Q()}],"mask-image-conic-from-color":[{"mask-conic-from":P()}],"mask-image-conic-to-color":[{"mask-conic-to":P()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:H()}],"mask-repeat":[{mask:W()}],"mask-size":[{mask:te()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",B,U]}],filter:[{filter:["","none",B,U]}],blur:[{blur:pe()}],brightness:[{brightness:[ne,B,U]}],contrast:[{contrast:[ne,B,U]}],"drop-shadow":[{"drop-shadow":["","none",m,Yi,Qi]}],"drop-shadow-color":[{"drop-shadow":P()}],grayscale:[{grayscale:["",ne,B,U]}],"hue-rotate":[{"hue-rotate":[ne,B,U]}],invert:[{invert:["",ne,B,U]}],saturate:[{saturate:[ne,B,U]}],sepia:[{sepia:["",ne,B,U]}],"backdrop-filter":[{"backdrop-filter":["","none",B,U]}],"backdrop-blur":[{"backdrop-blur":pe()}],"backdrop-brightness":[{"backdrop-brightness":[ne,B,U]}],"backdrop-contrast":[{"backdrop-contrast":[ne,B,U]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ne,B,U]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ne,B,U]}],"backdrop-invert":[{"backdrop-invert":["",ne,B,U]}],"backdrop-opacity":[{"backdrop-opacity":[ne,B,U]}],"backdrop-saturate":[{"backdrop-saturate":[ne,B,U]}],"backdrop-sepia":[{"backdrop-sepia":["",ne,B,U]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":k()}],"border-spacing-x":[{"border-spacing-x":k()}],"border-spacing-y":[{"border-spacing-y":k()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",B,U]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ne,"initial",B,U]}],ease:[{ease:["linear","initial",y,B,U]}],delay:[{delay:[ne,B,U]}],animate:[{animate:["none",g,B,U]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[v,B,U]}],"perspective-origin":[{"perspective-origin":C()}],rotate:[{rotate:Qe()}],"rotate-x":[{"rotate-x":Qe()}],"rotate-y":[{"rotate-y":Qe()}],"rotate-z":[{"rotate-z":Qe()}],scale:[{scale:dt()}],"scale-x":[{"scale-x":dt()}],"scale-y":[{"scale-y":dt()}],"scale-z":[{"scale-z":dt()}],"scale-3d":["scale-3d"],skew:[{skew:St()}],"skew-x":[{"skew-x":St()}],"skew-y":[{"skew-y":St()}],transform:[{transform:[B,U,"","none","gpu","cpu"]}],"transform-origin":[{origin:C()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ze()}],"translate-x":[{"translate-x":ze()}],"translate-y":[{"translate-y":ze()}],"translate-z":[{"translate-z":ze()}],"translate-none":["translate-none"],accent:[{accent:P()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:P()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",B,U]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":k()}],"scroll-mx":[{"scroll-mx":k()}],"scroll-my":[{"scroll-my":k()}],"scroll-ms":[{"scroll-ms":k()}],"scroll-me":[{"scroll-me":k()}],"scroll-mt":[{"scroll-mt":k()}],"scroll-mr":[{"scroll-mr":k()}],"scroll-mb":[{"scroll-mb":k()}],"scroll-ml":[{"scroll-ml":k()}],"scroll-p":[{"scroll-p":k()}],"scroll-px":[{"scroll-px":k()}],"scroll-py":[{"scroll-py":k()}],"scroll-ps":[{"scroll-ps":k()}],"scroll-pe":[{"scroll-pe":k()}],"scroll-pt":[{"scroll-pt":k()}],"scroll-pr":[{"scroll-pr":k()}],"scroll-pb":[{"scroll-pb":k()}],"scroll-pl":[{"scroll-pl":k()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",B,U]}],fill:[{fill:["none",...P()]}],"stroke-w":[{stroke:[ne,va,yn,Ec]}],stroke:[{stroke:["none",...P()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},Aj=fj(Oj);function pi(...e){return Aj(W4(e))}const zj=z4,Ij=I4,N0=p.forwardRef(({className:e,...t},r)=>c.jsx(u0,{ref:r,className:pi("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));N0.displayName=u0.displayName;const P0=p.forwardRef(({className:e,children:t,...r},n)=>c.jsxs(Ij,{children:[c.jsx(N0,{}),c.jsxs(d0,{ref:n,className:pi("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...r,children:[t,c.jsxs(L4,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[c.jsx(H4,{className:"h-4 w-4"}),c.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));P0.displayName=d0.displayName;const T0=({className:e,...t})=>c.jsx("div",{className:pi("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});T0.displayName="DialogHeader";const R0=p.forwardRef(({className:e,...t},r)=>c.jsx(f0,{ref:r,className:pi("text-lg font-semibold leading-none tracking-tight",e),...t}));R0.displayName=f0.displayName;const O0=p.forwardRef(({className:e,...t},r)=>c.jsx(h0,{ref:r,className:pi("text-sm text-muted-foreground",e),...t}));O0.displayName=h0.displayName;const A0=({isOpen:e,onClose:t,onLogin:r})=>{const{sendOTP:n,verifyOTP:s,loading:a,error:i}=o2(Ke),[o,l]=p.useState(""),[u,d]=p.useState(""),[f,h]=p.useState("email"),[m,x]=p.useState(0),[v,_]=p.useState(""),[y,g]=p.useState("");p.useEffect(()=>{if(m>0){const R=setTimeout(()=>x(m-1),1e3);return()=>clearTimeout(R)}},[m]),p.useEffect(()=>{e||(l(""),d(""),h("email"),_(""),g(""),x(0))},[e]);const w=R=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(R),E=async()=>{if(_(""),!o.trim()){_("请输入邮箱");return}if(!w(o)){_("请输入有效的邮箱地址");return}try{await n(o,"email"),h("otp"),x(20)}catch{_("发送验证码失败,请稍后重试")}},C=async()=>{if(g(""),!u.trim()){g("请输入验证码");return}if(u.length!==6){g("验证码为6位数字");return}try{await s(o,u,"email"),r==null||r(o),t()}catch{g("验证码错误,请重新输入")}};return c.jsx(zj,{open:e,onOpenChange:t,children:c.jsxs(P0,{className:"bg-cream border-line max-w-md",children:[c.jsxs(T0,{children:[c.jsx(R0,{className:"font-serif text-2xl text-ink",children:"登录账户"}),c.jsx(O0,{className:"text-ink-muted",children:"使用邮箱登录,提交留言与互动"})]}),c.jsxs("div",{className:"space-y-4 pt-4",children:[f==="email"?c.jsxs(c.Fragment,{children:[c.jsxs("div",{children:[c.jsx("input",{type:"email",placeholder:"请输入邮箱",value:o,onChange:R=>{l(R.target.value),_("")},className:`w-full bg-cream-wheat border rounded-card px-4 py-3 text-ink placeholder:text-ink-muted focus:outline-none focus:border-brand focus:shadow-focus-ring transition-all duration-200 ${v?"border-danger":"border-line"}`}),v&&c.jsx("p",{className:"mt-1.5 text-sm text-danger",children:v})]}),c.jsx("button",{onClick:E,disabled:a||!o.trim(),className:"w-full bg-copper text-white font-medium py-3 rounded-card hover:bg-copper-dark hover:shadow-cta-glow transition-all duration-250 disabled:opacity-60 disabled:cursor-not-allowed",children:a?"发送中...":"获取验证码"})]}):c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"text-sm text-ink-muted",children:["验证码已发送至 ",c.jsx("span",{className:"text-ink font-medium",children:o})]}),c.jsxs("div",{children:[c.jsx("input",{type:"text",placeholder:"请输入6位验证码",value:u,onChange:R=>{const b=R.target.value.replace(/\D/g,"").slice(0,6);d(b),g("")},maxLength:6,className:`w-full bg-cream-wheat border rounded-card px-4 py-3 text-ink placeholder:text-ink-muted focus:outline-none focus:border-brand focus:shadow-focus-ring transition-all duration-200 text-center text-lg tracking-widest ${y?"border-danger":"border-line"}`}),y&&c.jsx("p",{className:"mt-1.5 text-sm text-danger",children:y})]}),c.jsx("button",{onClick:C,disabled:a||u.length!==6,className:"w-full bg-copper text-white font-medium py-3 rounded-card hover:bg-copper-dark hover:shadow-cta-glow transition-all duration-250 disabled:opacity-60 disabled:cursor-not-allowed",children:a?"验证中...":"登录"}),c.jsxs("div",{className:"flex items-center justify-between text-sm",children:[c.jsx("button",{onClick:()=>{h("email"),d(""),g("")},className:"text-ink-muted hover:text-ink transition-colors",children:"更换邮箱"}),c.jsx("button",{onClick:E,disabled:m>0||a,className:"text-copper hover:text-copper-dark transition-colors disabled:text-ink-muted disabled:cursor-not-allowed",children:m>0?`${m}s 后重发`:"重新发送"})]})]}),(i||v||y)&&c.jsx("p",{className:"text-sm text-danger text-center",children:i})]})]})})},Qp=[{label:"首页",path:"/"},{label:"产品中心",path:"/products"},{label:"文章资讯",path:"/articles"},{label:"品牌故事",path:"/brand-story"},{label:"客户案例",path:"/cases"},{label:"新闻中心",path:"/news"},{label:"联系我们",path:"/contact"}];function Lj(){const e=Hn(),{user:t,signOut:r}=Gs(),[n,s]=p.useState(!1),[a,i]=p.useState(!1),[o,l]=p.useState(!1);p.useEffect(()=>{const d=()=>{s(window.scrollY>20)};return window.addEventListener("scroll",d,{passive:!0}),()=>window.removeEventListener("scroll",d)},[]);const u=()=>{var d;return t?t.nickname||((d=t.email)==null?void 0:d.split("@")[0])||"用户":""};return c.jsxs(c.Fragment,{children:[c.jsx("header",{"data-wxz-sa-part":"public-shell-header",className:`fixed top-0 left-0 right-0 z-50 transition-all duration-300 ${n?"bg-cream border-b border-line":"bg-transparent"}`,children:c.jsxs("div",{className:"max-w-[1200px] mx-auto px-5 md:px-[60px] h-20 flex items-center justify-between",children:[c.jsx(Te,{to:"/",className:"font-serif text-2xl font-bold text-brand-deep hover:text-copper transition-colors duration-250",children:"吨吨家水杯"}),c.jsx("nav",{className:"hidden md:flex items-center gap-10",children:Qp.map(d=>{const f=e.pathname===d.path;return c.jsxs(Te,{to:d.path,className:"relative text-base py-1 group",style:{color:n||!f?"inherit":"#F5F1E8"},children:[c.jsx("span",{className:`transition-colors duration-250 ${f?"text-copper":n?"text-ink":"text-cream-warm"} group-hover:text-copper`,children:d.label}),c.jsx("span",{className:`absolute bottom-0 left-0 h-[2px] bg-copper transition-all duration-250 ease-out ${f?"w-full":"w-0 group-hover:w-full"}`,style:{transformOrigin:"center"}})]},d.path)})}),c.jsx("div",{className:"hidden md:flex items-center gap-4",children:t?c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("span",{className:"text-sm text-ink",children:u()}),c.jsxs("button",{onClick:()=>r(),className:"inline-flex items-center gap-2 px-4 py-2 rounded-full border border-line text-ink-muted hover:border-copper hover:text-copper transition-all duration-250",children:[c.jsx(Pp,{className:"text-xs"}),c.jsx("span",{className:"text-sm",children:"退出"})]})]}):c.jsxs("button",{onClick:()=>l(!0),className:"inline-flex items-center gap-2 px-5 py-2 rounded-full border-2 border-brand text-brand hover:bg-brand hover:text-cream-warm transition-all duration-250",children:[c.jsx(Wo,{className:"text-sm"}),c.jsx("span",{className:"text-sm",children:"登录"})]})}),c.jsx("button",{className:"md:hidden p-2",onClick:()=>i(!0),"aria-label":"打开菜单","aria-controls":"site-mobile-navigation",children:c.jsx(YE,{className:`text-2xl ${n?"text-ink":"text-cream-warm"}`})})]})}),a&&c.jsxs("div",{id:"site-mobile-navigation",className:"fixed inset-0 z-[60] bg-cream md:hidden",children:[c.jsxs("div",{className:"flex items-center justify-between h-20 px-5 border-b border-line",children:[c.jsx("span",{className:"font-serif text-2xl font-bold text-brand-deep",children:"吨吨家水杯"}),c.jsx("button",{onClick:()=>i(!1),className:"p-2","aria-label":"关闭菜单",children:c.jsx(tk,{className:"text-2xl text-ink"})})]}),c.jsxs("nav",{className:"flex flex-col items-center pt-16 gap-8",children:[Qp.map((d,f)=>{const h=e.pathname===d.path;return c.jsx(Te,{to:d.path,onClick:()=>i(!1),className:`font-serif text-[20px] transition-colors duration-250 ${h?"text-copper":"text-ink"}`,style:{animationDelay:`${f*80}ms`},children:d.label},d.path)}),t?c.jsxs("div",{className:"flex flex-col items-center gap-4 mt-8",children:[c.jsx("span",{className:"text-ink",children:u()}),c.jsxs("button",{onClick:()=>{r(),i(!1)},className:"inline-flex items-center gap-2 px-6 py-3 rounded-full border border-line text-ink-muted",children:[c.jsx(Pp,{className:"text-sm"}),c.jsx("span",{children:"退出登录"})]})]}):c.jsxs("button",{onClick:()=>{i(!1),l(!0)},className:"mt-8 inline-flex items-center gap-2 px-6 py-3 rounded-full border-2 border-brand text-brand",children:[c.jsx(Wo,{className:"text-base"}),c.jsx("span",{children:"登录"})]})]})]}),c.jsx(A0,{isOpen:o,onClose:()=>l(!1)})]})}function Dj(){return c.jsx("footer",{"data-wxz-sa-part":"public-shell-footer",className:"bg-brand-deep text-ink-warm",children:c.jsxs("div",{className:"max-w-[1200px] mx-auto px-6 py-16",children:[c.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-10",children:[c.jsxs("div",{children:[c.jsx("h3",{className:"font-serif text-2xl font-semibold mb-4",children:"吨吨家水杯"}),c.jsx("p",{className:"text-sm leading-relaxed opacity-80",children:"以匠心工艺打造每一只水杯,让品质生活从一杯开始。我们专注于设计美学与品质工艺的结合,为注重生活品质的你提供温润安心的饮水体验。"})]}),c.jsxs("div",{children:[c.jsx("h4",{className:"font-serif text-lg font-semibold mb-4",children:"快速导航"}),c.jsxs("ul",{className:"space-y-3",children:[c.jsx("li",{children:c.jsxs(Te,{to:"/",className:"text-sm hover:text-copper transition-colors duration-250 relative group",children:["首页",c.jsx("span",{className:"absolute left-0 bottom-0 w-0 h-0.5 bg-copper transition-all duration-250 group-hover:w-full"})]})}),c.jsx("li",{children:c.jsxs(Te,{to:"/products",className:"text-sm hover:text-copper transition-colors duration-250 relative group",children:["产品中心",c.jsx("span",{className:"absolute left-0 bottom-0 w-0 h-0.5 bg-copper transition-all duration-250 group-hover:w-full"})]})}),c.jsx("li",{children:c.jsxs(Te,{to:"/articles",className:"text-sm hover:text-copper transition-colors duration-250 relative group",children:["文章资讯",c.jsx("span",{className:"absolute left-0 bottom-0 w-0 h-0.5 bg-copper transition-all duration-250 group-hover:w-full"})]})}),c.jsx("li",{children:c.jsxs(Te,{to:"/brand-story",className:"text-sm hover:text-copper transition-colors duration-250 relative group",children:["品牌故事",c.jsx("span",{className:"absolute left-0 bottom-0 w-0 h-0.5 bg-copper transition-all duration-250 group-hover:w-full"})]})}),c.jsx("li",{children:c.jsxs(Te,{to:"/cases",className:"text-sm hover:text-copper transition-colors duration-250 relative group",children:["客户案例",c.jsx("span",{className:"absolute left-0 bottom-0 w-0 h-0.5 bg-copper transition-all duration-250 group-hover:w-full"})]})}),c.jsx("li",{children:c.jsxs(Te,{to:"/news",className:"text-sm hover:text-copper transition-colors duration-250 relative group",children:["新闻中心",c.jsx("span",{className:"absolute left-0 bottom-0 w-0 h-0.5 bg-copper transition-all duration-250 group-hover:w-full"})]})}),c.jsx("li",{children:c.jsxs(Te,{to:"/contact",className:"text-sm hover:text-copper transition-colors duration-250 relative group",children:["联系我们",c.jsx("span",{className:"absolute left-0 bottom-0 w-0 h-0.5 bg-copper transition-all duration-250 group-hover:w-full"})]})})]})]}),c.jsxs("div",{children:[c.jsx("h4",{className:"font-serif text-lg font-semibold mb-4",children:"联系方式"}),c.jsxs("ul",{className:"space-y-4",children:[c.jsxs("li",{className:"flex items-center gap-3",children:[c.jsx(Ry,{className:"text-brand-light flex-shrink-0"}),c.jsx("span",{className:"text-sm",children:"400-888-9999"})]}),c.jsxs("li",{className:"flex items-center gap-3",children:[c.jsx(Ny,{className:"text-brand-light flex-shrink-0"}),c.jsx("span",{className:"text-sm",children:"service@dundunjia.com"})]}),c.jsx("li",{className:"text-sm opacity-70 mt-2",children:"工作时间:周一至周五 9:00-18:00"})]})]}),c.jsxs("div",{children:[c.jsx("h4",{className:"font-serif text-lg font-semibold mb-4",children:"关注我们"}),c.jsxs("div",{className:"flex gap-4",children:[c.jsx("a",{href:"#",className:"w-10 h-10 rounded-full border border-brand-light flex items-center justify-center hover:bg-copper hover:border-copper transition-all duration-250","aria-label":"微信",children:c.jsx(GE,{className:"text-lg"})}),c.jsx("a",{href:"#",className:"w-10 h-10 rounded-full border border-brand-light flex items-center justify-center hover:bg-copper hover:border-copper transition-all duration-250","aria-label":"微博",children:c.jsx(qE,{className:"text-lg"})})]})]})]}),c.jsx("div",{className:"border-t border-[rgba(245,241,232,0.15)] mt-12 pt-6",children:c.jsx("p",{className:"text-xs opacity-60 text-center",children:"© 2026 吨吨家水杯 版权所有"})})]})})}function $j(){return c.jsxs("div",{"data-wxz-sa-part":"public-shell",className:"flex flex-col min-h-screen",children:[c.jsx(Lj,{}),c.jsx("main",{className:"flex-1",children:c.jsx(r_,{})}),c.jsx(Dj,{})]})}function Mj(){return c.jsx($j,{})}const er=e=>{const{title:t,description:r,keywords:n,noindex:s=!1}=e,a=Array.isArray(n)?n.join(", "):n;return c.jsxs(e2,{defer:!1,children:[c.jsx("title",{children:t}),c.jsx("meta",{name:"description",content:r}),!!(n!=null&&n.length)&&c.jsx("meta",{name:"keywords",content:a}),c.jsx("meta",{name:"robots",content:s?"noindex, nofollow":"index, follow"}),c.jsx("meta",{property:"og:title",content:t}),c.jsx("meta",{property:"og:description",content:r})]})},Fj=()=>c.jsxs("section",{className:"relative h-screen w-full overflow-hidden",children:[c.jsx("div",{className:"absolute inset-0 bg-cover bg-center",style:{backgroundImage:"url('https://baas-api.wanwang.xin/toc/image/preview/morning-light-teal-cup-wooden-table-steam.jpg?w=1920&h=1080&q=80')"},children:c.jsx("div",{className:"absolute inset-0 bg-gradient-to-b from-brand-deep/55 to-transparent"})}),c.jsxs("div",{className:"relative z-10 flex h-full flex-col items-center justify-center px-4 text-center",children:[c.jsx("h1",{className:"font-serif text-[36px] font-semibold leading-tight text-ink-warm md:text-[64px]",children:"品质生活,从一杯开始"}),c.jsx("p",{className:"mt-4 text-[18px] text-ink-warm/90",children:"以匠心工艺打造每一只水杯"}),c.jsx(Te,{to:"/products",className:"mt-8 inline-flex items-center rounded-full bg-copper px-8 py-3 text-[18px] font-medium text-white transition-all duration-250 ease-out hover:bg-copper-dark hover:shadow-cta-glow active:scale-98",children:"探索产品"})]}),c.jsx("div",{className:"absolute bottom-8 left-1/2 -translate-x-1/2 animate-float",children:c.jsx("div",{className:"h-8 w-[2px] bg-ink-warm/60"})})]}),Ie=({children:e,className:t="",delay:r=0})=>{const[n,s]=p.useState(!1),a=p.useRef(null);p.useEffect(()=>{const o=new IntersectionObserver(([l])=>{l.isIntersecting&&(s(!0),o.unobserve(l.target))},{threshold:.2});return a.current&&o.observe(a.current),()=>{a.current&&o.unobserve(a.current)}},[]);const i=r>0?`${r*80}ms`:"0ms";return c.jsx("div",{ref:a,className:`${t} ${n?"animate-fade-up":"opacity-0 translate-y-[30px]"}`,style:{animationDelay:i},children:e})},Uj=[{value:1e4,suffix:"+",label:"服务用户"},{value:5,suffix:"年",label:"品质保证"},{value:30,suffix:"+",label:"设计奖项"}],z0=[{id:"1",name:"合作伙伴A",logo:"https://baas-api.wanwang.xin/toc/image/preview/partner-logo-a-minimal.jpg?w=160&h=80&q=80"},{id:"2",name:"合作伙伴B",logo:"https://baas-api.wanwang.xin/toc/image/preview/partner-logo-b-modern.jpg?w=160&h=80&q=80"},{id:"3",name:"合作伙伴C",logo:"https://baas-api.wanwang.xin/toc/image/preview/partner-logo-c-clean.jpg?w=160&h=80&q=80"},{id:"4",name:"合作伙伴D",logo:"https://baas-api.wanwang.xin/toc/image/preview/partner-logo-d-simple.jpg?w=160&h=80&q=80"},{id:"5",name:"合作伙伴E",logo:"https://baas-api.wanwang.xin/toc/image/preview/partner-logo-e-brand.jpg?w=160&h=80&q=80"},{id:"6",name:"合作伙伴F",logo:"https://baas-api.wanwang.xin/toc/image/preview/partner-logo-f-corporate.jpg?w=160&h=80&q=80"}],I0=[{id:"1",userName:"李女士",avatar:"https://baas-api.wanwang.xin/toc/image/preview/user-avatar-woman-smile.jpg?w=96&h=96&q=80",content:"用了三个月,保温效果依然很好,每天上班都带着。材质安心,设计也很符合我的审美。",scene:"办公室",image:"https://baas-api.wanwang.xin/toc/image/preview/office-desk-cup-morning-light.jpg?w=600&h=400&q=80"},{id:"2",userName:"张先生",avatar:"https://baas-api.wanwang.xin/toc/image/preview/user-avatar-man-casual.jpg?w=96&h=96&q=80",content:"户外运动必备,轻盈又耐用。一键开盖设计很贴心,骑行时单手就能操作。",scene:"户外",image:"https://baas-api.wanwang.xin/toc/image/preview/outdoor-hiking-water-bottle-trail.jpg?w=600&h=400&q=80"},{id:"3",userName:"王女士",avatar:"https://baas-api.wanwang.xin/toc/image/preview/user-avatar-woman-warm.jpg?w=96&h=96&q=80",content:"给全家买的套装,每人一个颜色,温馨又实用。孩子很喜欢,每天主动喝水了。",scene:"家居",image:"https://baas-api.wanwang.xin/toc/image/preview/home-family-cups-kitchen.jpg?w=600&h=400&q=80"}],Bj=[{year:"2021",title:"品牌创立",description:"吨吨家水杯正式成立,致力于将饮水日常升华为生活美学"},{year:"2022",title:"首款产品发布",description:"匠心系列保温杯上市,获得市场广泛好评"},{year:"2023",title:"产品线扩展",description:"推出运动系列与家居系列,覆盖更多使用场景"},{year:"2024",title:"获得设计奖项",description:"荣获多项产品设计奖项,品牌影响力持续提升"},{year:"2025",title:"服务万用户",description:"累计服务超过10000位用户,建立良好口碑"},{year:"2026",title:"持续创新",description:"探索更多材质与工艺,为用户带来更优质的饮水体验"}],Vj=[{id:"1",name:"陈设计",role:"首席设计师",avatar:"https://baas-api.wanwang.xin/toc/image/preview/team-designer-portrait.jpg?w=400&h=400&q=80",bio:"十年产品设计经验,专注于生活美学领域"},{id:"2",name:"李工艺",role:"工艺总监",avatar:"https://baas-api.wanwang.xin/toc/image/preview/team-craft-director.jpg?w=400&h=400&q=80",bio:"深耕材质工艺研究,确保每一只水杯的品质"},{id:"3",name:"王品质",role:"品质负责人",avatar:"https://baas-api.wanwang.xin/toc/image/preview/team-quality-manager.jpg?w=400&h=400&q=80",bio:"严格把控每一道质检环节,守护用户安心"}],Hj=({target:e})=>{const[t,r]=p.useState(0),n=p.useRef(null),s=p.useRef(!1);return p.useEffect(()=>{const a=new IntersectionObserver(([i])=>{if(i.isIntersecting&&!s.current){s.current=!0;const o=1200,l=performance.now(),u=d=>{const f=d-l,h=Math.min(f/o,1),m=1-Math.pow(1-h,3),x=Math.floor(m*e);r(x),h<1?requestAnimationFrame(u):r(e)};requestAnimationFrame(u)}},{threshold:.5});return n.current&&a.observe(n.current),()=>{n.current&&a.unobserve(n.current)}},[e]),c.jsx("span",{ref:n,children:t})};function Wj(){return c.jsx("section",{className:"bg-cream-wheat py-section",children:c.jsxs("div",{className:"mx-auto max-w-[1200px] px-5 md:px-8 lg:px-10",children:[c.jsx(Ie,{children:c.jsx("div",{className:"mb-16 grid grid-cols-1 gap-8 md:grid-cols-3",children:Uj.map((e,t)=>c.jsxs("div",{className:"text-center",children:[c.jsxs("div",{className:"font-serif text-5xl text-copper md:text-[56px]",children:[c.jsx(Hj,{target:e.value}),c.jsx("span",{className:"ml-1 font-sans text-base",children:e.suffix})]}),c.jsx("p",{className:"mt-2 text-sm text-ink-muted",children:e.label})]},t))})}),c.jsx(Ie,{delay:1,children:c.jsx("div",{className:"grid grid-cols-2 gap-6 md:grid-cols-3 lg:grid-cols-6",children:z0.map(e=>c.jsx("div",{className:"flex items-center justify-center transition-opacity duration-300 ease-out hover:opacity-100",children:c.jsx("img",{src:e.logo,alt:e.name,className:"h-12 w-full object-contain opacity-55 transition-opacity duration-300 ease-out"})},e.id))})})]})})}function L0(e){return{...e,features:JSON.parse(e.features||"[]")}}async function D0(){const{data:e,error:t}=await Ke.from("products").select("*").eq("is_deleted",!1).order("created_at",{ascending:!1});if(t)throw t;return(e||[]).map(L0)}async function qj(e){const{data:t,error:r}=await Ke.from("products").select("*").eq("series",e).eq("is_deleted",!1).order("created_at",{ascending:!1});if(r)throw r;return(t||[]).map(L0)}const Gj=[{key:"business",name:"商务系列",subtitle:"职场精英的温润陪伴"},{key:"sports",name:"运动系列",subtitle:"活力随行的轻盈伴侣"},{key:"home",name:"家居系列",subtitle:"家庭生活的温馨点缀"}];function Kj(){const[e,t]=p.useState([]),[r,n]=p.useState(!0);p.useEffect(()=>{s()},[]);const s=async()=>{try{const i=await D0();t(i)}catch{Be.error("加载产品失败")}finally{n(!1)}},a=Gj.map(i=>{const o=e.find(l=>l.series===i.key);return{...i,product:o}}).filter(i=>i.product!==void 0);return r?c.jsx("section",{className:"py-section bg-cream",children:c.jsx("div",{className:"max-w-6xl mx-auto px-5 md:px-10 text-center text-ink-muted",children:"加载中..."})}):c.jsx("section",{className:"py-section bg-cream",children:c.jsxs("div",{className:"max-w-6xl mx-auto px-5 md:px-10",children:[c.jsxs("div",{className:"text-center mb-16 space-y-3",children:[c.jsx("h2",{className:"font-serif text-4xl md:text-5xl text-ink",children:"精选系列"}),c.jsx("p",{className:"text-base text-ink-muted",children:"为不同场景精心打造"})]}),c.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8",children:a.map(({key:i,name:o,subtitle:l,product:u},d)=>c.jsx(Ie,{delay:d,children:c.jsxs(Te,{to:`/products?series=${i}`,className:"group block rounded-card bg-cream border border-line overflow-hidden transition-all duration-300 hover:-translate-y-1.5 hover:shadow-card-hover",children:[c.jsx("div",{className:"aspect-[4/5] overflow-hidden",children:c.jsx("img",{src:u.image,alt:o,className:"w-full h-full object-cover transition-transform duration-400 group-hover:scale-103"})}),c.jsxs("div",{className:"p-6 space-y-2",children:[c.jsx("h3",{className:"font-serif text-2xl text-ink",children:o}),c.jsx("p",{className:"text-sm text-ink-muted",children:l})]})]})},i))})]})})}const $0=({item:e,variant:t="light"})=>{const r=t==="dark";return c.jsx("div",{className:`rounded-card p-6 transition-all duration-300 ${r?"bg-[rgba(245,241,232,0.06)] text-ink-warm":"bg-cream border border-line text-ink"}`,children:c.jsxs("div",{className:"flex items-start gap-4",children:[c.jsx("img",{src:e.avatar,alt:e.userName,className:"w-12 h-12 rounded-full object-cover flex-shrink-0"}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[c.jsx("span",{className:`text-lg font-medium ${r?"text-ink-warm":"text-ink"}`,children:e.userName}),c.jsx("span",{className:"text-copper text-2xl leading-none font-serif",children:'"'})]}),c.jsx("p",{className:`text-sm leading-relaxed mb-3 ${r?"text-ink-warm/90":"text-ink-muted"}`,children:e.content}),c.jsx("span",{className:`inline-block px-3 py-1 rounded-full text-xs ${r?"bg-copper-light/20 text-copper-light":"bg-copper-light/40 text-copper-dark"}`,children:e.scene})]})]})})},Qj=()=>{const e=I0.slice(0,3);return c.jsx("section",{className:"py-section bg-brand-deep",children:c.jsxs("div",{className:"max-w-[1200px] mx-auto px-5 md:px-6 lg:px-8",children:[c.jsx(Ie,{children:c.jsx("h2",{className:"font-serif text-4xl md:text-5xl text-ink-warm text-center mb-12",children:"用户心声"})}),c.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6 mb-12",children:e.map((t,r)=>c.jsx(Ie,{delay:r,children:c.jsx($0,{item:t,variant:"dark"})},t.id))}),c.jsx(Ie,{delay:3,children:c.jsx("div",{className:"flex justify-center",children:c.jsx(Te,{to:"/cases",className:"inline-block px-8 py-3 rounded-full border-2 border-copper text-copper hover:bg-copper hover:text-white transition-all duration-250 font-medium",children:"查看更多案例"})})})]})})};async function Yj(e){const{data:t,error:r}=await Ke.from("contact_forms").insert(e).select().single();if(r)throw r;return t}function M0({title:e,subtitle:t,compact:r}){const[n]=Fd(),s=n.get("product"),[a,i]=p.useState({name:"",phone:"",email:"",content:s||""}),[o,l]=p.useState({}),[u,d]=p.useState(!1),[f,h]=p.useState(!1),m=()=>{const _={};return a.name.trim()||(_.name="请输入姓名"),a.phone.trim()?/^1\d{10}$/.test(a.phone)||(_.phone="请输入有效的11位手机号"):_.phone="请输入电话",a.content.trim()||(_.content="请输入咨询内容"),l(_),Object.keys(_).length===0},x=async _=>{if(_.preventDefault(),!!m()){h(!0);try{await Yj({name:a.name,phone:a.phone,email:a.email||null,content:a.content}),d(!0),Be.success("提交成功,我们将尽快与您联系"),setTimeout(()=>{d(!1),i({name:"",phone:"",email:"",content:""})},3e3)}catch{Be.error("提交失败,请稍后重试")}finally{h(!1)}}},v=(_,y)=>{i(g=>({...g,[_]:y})),o[_]&&l(g=>{const w={...g};return delete w[_],w})};return u?c.jsx("div",{className:"bg-brand-light/10 text-ink-warm px-6 py-4 rounded-card animate-fade-in",children:c.jsx("p",{className:"text-sm font-medium",children:"提交成功,我们将尽快与您联系"})}):c.jsxs("form",{onSubmit:x,className:`space-y-5 ${r?"":"max-w-xl mx-auto"}`,children:[(e||t)&&c.jsxs("div",{className:"text-center mb-8",children:[e&&c.jsx("h2",{className:"font-serif text-3xl md:text-4xl text-ink mb-3 tracking-wide",children:e}),t&&c.jsx("p",{className:"text-ink-muted text-base",children:t})]}),c.jsxs("div",{children:[c.jsx("input",{type:"text",placeholder:"姓名 *",value:a.name,onChange:_=>v("name",_.target.value),className:`w-full bg-cream border rounded-card px-4 py-3 text-ink placeholder:text-ink-muted focus:outline-none focus:border-brand focus:shadow-focus-ring transition-all duration-200 ${o.name?"border-danger":"border-line"}`}),o.name&&c.jsx("p",{className:"mt-1.5 text-sm text-danger",children:o.name})]}),c.jsxs("div",{children:[c.jsx("input",{type:"tel",placeholder:"电话 *",value:a.phone,onChange:_=>v("phone",_.target.value),className:`w-full bg-cream border rounded-card px-4 py-3 text-ink placeholder:text-ink-muted focus:outline-none focus:border-brand focus:shadow-focus-ring transition-all duration-200 ${o.phone?"border-danger":"border-line"}`}),o.phone&&c.jsx("p",{className:"mt-1.5 text-sm text-danger",children:o.phone})]}),c.jsx("div",{children:c.jsx("input",{type:"email",placeholder:"邮箱(选填)",value:a.email,onChange:_=>v("email",_.target.value),className:"w-full bg-cream border border-line rounded-card px-4 py-3 text-ink placeholder:text-ink-muted focus:outline-none focus:border-brand focus:shadow-focus-ring transition-all duration-200"})}),c.jsxs("div",{children:[c.jsx("textarea",{placeholder:"咨询内容 *",rows:4,value:a.content,onChange:_=>v("content",_.target.value),className:`w-full bg-cream border rounded-card px-4 py-3 text-ink placeholder:text-ink-muted focus:outline-none focus:border-brand focus:shadow-focus-ring transition-all duration-200 resize-none ${o.content?"border-danger":"border-line"}`}),o.content&&c.jsx("p",{className:"mt-1.5 text-sm text-danger",children:o.content})]}),c.jsx("button",{type:"submit",disabled:f,className:"w-full bg-copper text-white font-medium py-3 rounded-card hover:bg-copper-dark hover:shadow-cta-glow transition-all duration-250 active:scale-[0.98] disabled:opacity-60 disabled:cursor-not-allowed",children:f?"提交中...":"立即咨询"})]})}const F0=["canvas","surface","surfaceMuted","foreground","foregroundMuted","brand","brandForeground","border","focusRing","danger","dangerForeground","success","warning","radiusSm","radiusMd","radiusLg","fontSans","shadowCard"],Jj=["canvas","surface","foreground","brand","brandForeground","border","focusRing","danger"],zr=Object.freeze({canvas:{required:!0},surface:{required:!0},surfaceMuted:{required:!1,deriveFrom:["surface","foreground"]},foreground:{required:!0},foregroundMuted:{required:!1,deriveFrom:["foreground","canvas"]},brand:{required:!0},brandForeground:{required:!0},border:{required:!0},focusRing:{required:!0},danger:{required:!0},dangerForeground:{required:!1,fallback:"#ffffff"},success:{required:!1,fallback:"#15803d"},warning:{required:!1,fallback:"#a16207"},radiusSm:{required:!1,fallback:"0.375rem"},radiusMd:{required:!1,fallback:"0.625rem"},radiusLg:{required:!1,fallback:"0.875rem"},fontSans:{required:!1,fallback:"inherit"},shadowCard:{required:!1,fallback:"0 12px 30px rgb(15 23 42 / 8%)"}}),Xj=Object.freeze({navigation:"sidebar",auth:"centered",density:"comfortable",contentWidth:"wide",list:"table",editor:"sections"});function Zj(e,t={}){const{identity:r,...n}=t,s=t.identity?{...e.identity,...t.identity}:e.identity;if(!s.applicationName)throw new Error("SITE_ADMIN_PRESENTATION_INVALID: identity requires applicationName");const a=new Set([...Object.keys(e.resources??{}),...Object.keys(t.resources??{})]),i=Object.fromEntries([...a].map(o=>{var l,u;return[o,{...(l=e.resources)==null?void 0:l[o],...(u=t.resources)==null?void 0:u[o]}]}));return{...e,...n,experienceContractVersion:1,semanticDomContractVersion:1,tokens:{...e.tokens,...t.tokens},recipes:{...e.recipes,...t.recipes},resources:i,identity:s}}function tf(...e){return e.filter(Boolean).join(" ")||void 0}function Ir(e,t,r){var n,s,a;return tf((n=e.classNames)==null?void 0:n[r],(a=(s=e.components)==null?void 0:s[t])==null?void 0:a[r])}function _s(e,t){if(!e)return t;if(!t)return e;const r=new Set([...Object.keys(e),...Object.keys(t)]);return Object.fromEntries([...r].map(n=>[n,tf(e[n],t[n])]))}function eC(e,t){if(!e)return t;if(!t)return e;const r=new Set([...Object.keys(e),...Object.keys(t)]);return Object.fromEntries([...r].map(n=>[n,_s(e[n],t[n])]))}function tC(e,t){return e?t?{layout:_s(e.layout,t.layout),roles:_s(e.roles,t.roles),permissions:_s(e.permissions,t.permissions),members:_s(e.members,t.members)}:e:t}function U0(e,t){return{classNames:_s(e==null?void 0:e.classNames,t==null?void 0:t.classNames),components:eC(e==null?void 0:e.components,t==null?void 0:t.components),rbac:tC(e==null?void 0:e.rbac,t==null?void 0:t.rbac)}}const rC={classNames:{root:"wxz-sa-screen",header:"wxz-sa-header",headingGroup:"wxz-sa-heading-group",title:"wxz-sa-title",description:"wxz-sa-description",toolbar:"wxz-sa-toolbar",primaryButton:"wxz-sa-button wxz-sa-button--primary",secondaryButton:"wxz-sa-button wxz-sa-button--secondary",dangerButton:"wxz-sa-button wxz-sa-button--danger",iconButton:"wxz-sa-button wxz-sa-button--icon",searchForm:"wxz-sa-search",input:"wxz-sa-control",textarea:"wxz-sa-control wxz-sa-textarea",select:"wxz-sa-control wxz-sa-select",checkbox:"wxz-sa-checkbox",form:"wxz-sa-form",field:"wxz-sa-field",label:"wxz-sa-label",list:"wxz-sa-list",item:"wxz-sa-item",itemTitle:"wxz-sa-item-title",itemMeta:"wxz-sa-item-meta",actions:"wxz-sa-actions",status:"wxz-sa-status",error:"wxz-sa-error",empty:"wxz-sa-empty",pagination:"wxz-sa-pagination",sidebar:"wxz-sa-sidebar",navigation:"wxz-sa-navigation",navigationItem:"wxz-sa-navigation-item",navigationItemActive:"wxz-sa-navigation-item--active",main:"wxz-sa-main",richText:"wxz-sa-rich-text",editorToolbar:"wxz-sa-editor-toolbar",dialogOverlay:"wxz-sa-dialog-overlay",dialogContent:"wxz-sa-dialog-content"},components:{login:{root:"wxz-sa-login",form:"wxz-sa-login-card",title:"wxz-sa-login-title",description:"wxz-sa-login-description",input:"wxz-sa-login-control",label:"wxz-sa-login-label",primaryButton:"wxz-sa-login-primary-action",secondaryButton:"wxz-sa-login-secondary-action",error:"wxz-sa-login-error"},account:{root:"wxz-sa-account"},adminShell:{root:"wxz-sa-shell",sidebar:"wxz-sa-shell-sidebar",title:"wxz-sa-shell-title",main:"wxz-sa-shell-main"},dashboard:{root:"wxz-sa-dashboard",list:"wxz-sa-dashboard-grid",item:"wxz-sa-dashboard-card",itemTitle:"wxz-sa-dashboard-card-title",description:"wxz-sa-dashboard-card-description"},collectionList:{root:"wxz-sa-collection-list"},collectionEditor:{root:"wxz-sa-collection-editor"},workflowList:{root:"wxz-sa-workflow-list"},workflowDetail:{root:"wxz-sa-workflow-detail"},publicCollectionList:{root:"wxz-sa-public-page wxz-sa-public-list-page",list:"wxz-sa-public-grid",item:"wxz-sa-public-card",image:"wxz-sa-public-card-image",itemTitle:"wxz-sa-public-card-title",itemMeta:"wxz-sa-public-card-meta",description:"wxz-sa-public-card-summary"},publicCollectionDetail:{root:"wxz-sa-public-page wxz-sa-public-detail-page",article:"wxz-sa-public-detail",image:"wxz-sa-public-detail-image",itemMeta:"wxz-sa-public-detail-meta",description:"wxz-sa-public-detail-summary",richText:"wxz-sa-public-rich-text"},publicForm:{root:"wxz-sa-public-form-section",form:"wxz-sa-public-form",description:"wxz-sa-public-form-description",status:"wxz-sa-public-form-feedback wxz-sa-public-form-feedback--success",error:"wxz-sa-public-form-feedback wxz-sa-public-form-feedback--error"},productCategoryFilter:{root:"wxz-sa-public-filter",navigation:"wxz-sa-public-filter-list",navigationItem:"wxz-sa-public-filter-item",navigationItemActive:"wxz-sa-public-filter-item--active",image:"wxz-sa-public-filter-image",description:"wxz-sa-public-filter-description"},publicAuthNav:{navigation:"wxz-sa-public-auth-nav",navigationItem:"wxz-sa-public-auth-link",primaryButton:"wxz-sa-public-auth-button"},commerceProductDetail:{root:"wxz-sa-public-page wxz-sa-commerce-detail-page",article:"wxz-sa-commerce-detail",image:"wxz-sa-commerce-detail-image",description:"wxz-sa-commerce-detail-summary",label:"wxz-sa-commerce-sku-field",select:"wxz-sa-commerce-sku-select",actions:"wxz-sa-commerce-actions",primaryButton:"wxz-sa-commerce-primary-action",secondaryButton:"wxz-sa-commerce-secondary-action",status:"wxz-sa-commerce-message",richText:"wxz-sa-public-rich-text",list:"wxz-sa-commerce-reviews",item:"wxz-sa-commerce-review",itemTitle:"wxz-sa-commerce-reviews-title",itemMeta:"wxz-sa-commerce-review-rating"},rbacShell:{root:"wxz-sa-rbac-shell"},rbacRoles:{root:"wxz-sa-rbac-screen",title:"wxz-sa-rbac-screen-heading"},rbacPermissions:{root:"wxz-sa-rbac-screen",title:"wxz-sa-rbac-screen-heading"},rbacMembers:{root:"wxz-sa-rbac-screen",title:"wxz-sa-rbac-screen-heading"}},rbac:{layout:{root:"wxz-sa-rbac-layout",sidebar:"wxz-sa-rbac-sidebar",sidebarInner:"wxz-sa-rbac-sidebar-inner",sidebarHeader:"wxz-sa-rbac-sidebar-header",sidebarTitle:"wxz-sa-rbac-sidebar-title",navigation:"wxz-sa-rbac-navigation",navigationItem:"wxz-sa-rbac-navigation-item",navigationItemActive:"wxz-sa-rbac-navigation-item--active",navigationItemInactive:"wxz-sa-rbac-navigation-item--inactive",main:"wxz-sa-rbac-main"},roles:{root:"wxz-sa-rbac-page",header:"wxz-sa-rbac-header",headingGroup:"wxz-sa-heading-group",title:"wxz-sa-rbac-title",description:"wxz-sa-description",primaryButton:"wxz-sa-button wxz-sa-button--primary",notice:"wxz-sa-status",panel:"wxz-sa-panel",form:"wxz-sa-form",formGrid:"wxz-sa-form-grid",field:"wxz-sa-field",label:"wxz-sa-label",input:"wxz-sa-control",formActions:"wxz-sa-actions",secondaryButton:"wxz-sa-button wxz-sa-button--secondary",status:"wxz-sa-status",error:"wxz-sa-error",empty:"wxz-sa-empty",list:"wxz-sa-rbac-list",item:"wxz-sa-rbac-item",itemMain:"wxz-sa-rbac-item-main",itemTitleRow:"wxz-sa-rbac-title-row",roleLabel:"wxz-sa-rbac-role-label",roleName:"wxz-sa-rbac-role-name",badge:"wxz-sa-badge",systemBadge:"wxz-sa-badge--neutral",defaultBadge:"wxz-sa-badge--success",actions:"wxz-sa-actions",iconButton:"wxz-sa-button wxz-sa-button--secondary",dangerButton:"wxz-sa-button--danger",dialogOverlay:"wxz-sa-dialog-overlay",dialogContent:"wxz-sa-dialog-content",dialogTitle:"wxz-sa-dialog-title",dialogDescription:"wxz-sa-description",permissionSummary:"wxz-sa-rbac-permission-summary",permissionToolbar:"wxz-sa-rbac-permission-toolbar",permissionSearch:"wxz-sa-rbac-permission-search",permissionFilterHint:"wxz-sa-rbac-permission-filter-hint",permissionList:"wxz-sa-rbac-permission-list",permissionGroupList:"wxz-sa-rbac-permission-groups",permissionGroup:"wxz-sa-rbac-permission-group",permissionGroupHeader:"wxz-sa-rbac-permission-group-header",permissionGroupTitleRow:"wxz-sa-rbac-permission-group-title-row",permissionGroupTitle:"wxz-sa-rbac-permission-group-title",permissionResourceKey:"wxz-sa-rbac-permission-key",permissionGroupDescription:"wxz-sa-rbac-permission-group-description",permissionGroupSelection:"wxz-sa-rbac-permission-group-selection",permissionActionList:"wxz-sa-rbac-permission-actions",permissionItem:"wxz-sa-rbac-permission-option",permissionAction:"wxz-sa-rbac-permission-action",permissionLabel:"wxz-sa-rbac-permission-label",permissionActionLabel:"wxz-sa-rbac-permission-action-label",permissionActionKey:"wxz-sa-rbac-permission-key",permissionDescription:"wxz-sa-description",permissionChangeSummary:"wxz-sa-rbac-permission-change-summary",checkbox:"wxz-sa-checkbox",dialogActions:"wxz-sa-actions wxz-sa-rbac-permission-dialog-actions"},permissions:{root:"wxz-sa-rbac-page",header:"wxz-sa-rbac-header",headingGroup:"wxz-sa-heading-group",title:"wxz-sa-rbac-title",description:"wxz-sa-description",primaryButton:"wxz-sa-button wxz-sa-button--primary",panel:"wxz-sa-panel",form:"wxz-sa-form",formGrid:"wxz-sa-form-grid",field:"wxz-sa-field",label:"wxz-sa-label",input:"wxz-sa-control",formActions:"wxz-sa-actions",secondaryButton:"wxz-sa-button wxz-sa-button--secondary",status:"wxz-sa-status",error:"wxz-sa-error",empty:"wxz-sa-empty",list:"wxz-sa-rbac-list",groupList:"wxz-sa-rbac-group-list",group:"wxz-sa-rbac-group",groupHeader:"wxz-sa-rbac-catalog-group-header",groupTitle:"wxz-sa-rbac-group-title",groupResource:"wxz-sa-rbac-catalog-group-resource",groupDescription:"wxz-sa-rbac-catalog-group-description",item:"wxz-sa-rbac-item",permissionMain:"wxz-sa-rbac-item-main wxz-sa-rbac-catalog-item-main",resourceLabel:"wxz-sa-rbac-catalog-resource-label",resource:"wxz-sa-rbac-resource",separator:"wxz-sa-rbac-separator",actionLabel:"wxz-sa-rbac-catalog-action-label",action:"wxz-sa-rbac-action",permissionDescription:"wxz-sa-description",actions:"wxz-sa-actions",iconButton:"wxz-sa-button wxz-sa-button--secondary",dangerButton:"wxz-sa-button--danger",dialogOverlay:"wxz-sa-dialog-overlay",dialogContent:"wxz-sa-dialog-content",dialogTitle:"wxz-sa-dialog-title",dialogDescription:"wxz-sa-description",dialogActions:"wxz-sa-actions"},members:{root:"wxz-sa-rbac-page",header:"wxz-sa-rbac-header",headingGroup:"wxz-sa-heading-group",title:"wxz-sa-rbac-title",description:"wxz-sa-description",primaryButton:"wxz-sa-button wxz-sa-button--primary",panel:"wxz-sa-panel",form:"wxz-sa-form",formGrid:"wxz-sa-form-grid",field:"wxz-sa-field",label:"wxz-sa-label",select:"wxz-sa-control wxz-sa-select",formActions:"wxz-sa-actions",secondaryButton:"wxz-sa-button wxz-sa-button--secondary",status:"wxz-sa-status",error:"wxz-sa-error",empty:"wxz-sa-empty",tableWrapper:"wxz-sa-table-wrapper",table:"wxz-sa-table",tableHead:"wxz-sa-table-head",tableHeaderRow:"wxz-sa-table-row",tableHeaderCell:"wxz-sa-table-header-cell",tableBody:"wxz-sa-table-body",tableRow:"wxz-sa-table-row",tableCell:"wxz-sa-table-cell",userId:"wxz-sa-table-id",mutedText:"wxz-sa-muted",badge:"wxz-sa-badge",systemBadge:"wxz-sa-badge--neutral",businessBadge:"wxz-sa-badge--success",actions:"wxz-sa-actions",iconButton:"wxz-sa-button wxz-sa-button--secondary",dangerButton:"wxz-sa-button--danger",dialogOverlay:"wxz-sa-dialog-overlay",dialogContent:"wxz-sa-dialog-content",dialogTitle:"wxz-sa-dialog-title",dialogDescription:"wxz-sa-description",dialogActions:"wxz-sa-actions"}}},nC=Object.freeze({canvas:"--wxz-sa-canvas",surface:"--wxz-sa-surface",surfaceMuted:"--wxz-sa-surface-muted",foreground:"--wxz-sa-foreground",foregroundMuted:"--wxz-sa-foreground-muted",brand:"--wxz-sa-brand",brandForeground:"--wxz-sa-brand-foreground",border:"--wxz-sa-border",focusRing:"--wxz-sa-focus-ring",danger:"--wxz-sa-danger",dangerForeground:"--wxz-sa-danger-foreground",success:"--wxz-sa-success",warning:"--wxz-sa-warning",radiusSm:"--wxz-sa-radius-sm",radiusMd:"--wxz-sa-radius-md",radiusLg:"--wxz-sa-radius-lg",fontSans:"--wxz-sa-font-sans",shadowCard:"--wxz-sa-shadow-card"});function Yp(e,t){if(typeof t!="string"||!t.trim()||/[;{}<>]/.test(t))throw new Error(`SITE_ADMIN_PRESENTATION_INVALID: unsafe ${e}`)}function sC(e){for(const s of Jj)Yp(s,e==null?void 0:e[s]);const t=e.surfaceMuted??`color-mix(in srgb, ${e.surface} 94%, ${e.foreground})`,r=e.foregroundMuted??`color-mix(in srgb, ${e.foreground} 62%, ${e.canvas})`,n={...e,surfaceMuted:t,foregroundMuted:r,dangerForeground:e.dangerForeground??zr.dangerForeground.fallback,success:e.success??zr.success.fallback,warning:e.warning??zr.warning.fallback,radiusSm:e.radiusSm??zr.radiusSm.fallback,radiusMd:e.radiusMd??zr.radiusMd.fallback,radiusLg:e.radiusLg??zr.radiusLg.fallback,fontSans:e.fontSans??zr.fontSans.fallback,shadowCard:e.shadowCard??zr.shadowCard.fallback};for(const s of F0)Yp(s,n[s]);return Object.freeze(n)}const Jp=Object.freeze({navigation:["sidebar","topbar","compact"],auth:["centered","brand-panel","split"],density:["comfortable","compact"],contentWidth:["contained","wide","fluid"],list:["table","cards"],editor:["single-column","sections","split-preview"]});function aC(e){for(const t of Object.keys(Jp))if(!Jp[t].includes(e[t]))throw new Error(`SITE_ADMIN_PRESENTATION_INVALID: unsupported ${t} recipe`)}const iC=new Set(["editorial","media","records","transactional","operations"]);function oC(e){const t={};for(const[r,n]of Object.entries(e??{})){if(!/^[A-Za-z][A-Za-z0-9_-]*$/.test(r))throw new Error("SITE_ADMIN_PRESENTATION_INVALID: unsafe resource key");if(!iC.has(n.archetype))throw new Error("SITE_ADMIN_PRESENTATION_INVALID: unsupported resource archetype");if(n.list&&!["table","cards"].includes(n.list))throw new Error("SITE_ADMIN_PRESENTATION_INVALID: unsupported resource list recipe");if(n.density&&!["comfortable","compact"].includes(n.density))throw new Error("SITE_ADMIN_PRESENTATION_INVALID: unsupported resource density");if(n.editorMode&&!["auto","page","drawer","dialog"].includes(n.editorMode))throw new Error("SITE_ADMIN_PRESENTATION_INVALID: unsupported resource editor mode");t[r]=Object.freeze({...n})}return Object.freeze(t)}function lC(e){var t,r,n;const s=(t=e.applicationName)==null?void 0:t.trim(),a=(r=e.adminLabel)==null?void 0:r.trim(),i=(n=e.logoText)==null?void 0:n.trim();if(!s||s.length>80||a!==void 0&&(!a||a.length>24)||i!==void 0&&(!i||i.length>4))throw new Error("SITE_ADMIN_PRESENTATION_INVALID: unsafe identity");return Object.freeze({applicationName:s,...a?{adminLabel:a}:{},...i?{logoText:i}:{}})}function cC(e){return[`wxz-sa-navigation-${e.navigation}`,`wxz-sa-auth-${e.auth}`,`wxz-sa-density-${e.density}`,`wxz-sa-content-${e.contentWidth}`,`wxz-sa-list-${e.list}`,`wxz-sa-editor-${e.editor}`].join(" ")}function uC(e){const t=(e==null?void 0:e.scopeClassName)??"wxz-sa-presentation";if(!/^[A-Za-z_][A-Za-z0-9_-]*$/.test(t))throw new Error("SITE_ADMIN_PRESENTATION_INVALID: unsafe scopeClassName");const r=sC(e==null?void 0:e.tokens),n=oC(e.resources),s=lC(e.identity),a=Object.freeze({...Xj,...e.recipes});return aC(a),Object.freeze({version:1,experienceContractVersion:1,semanticDomContractVersion:1,tokens:r,recipes:a,resources:n,identity:s,scopeClassName:t})}function dC(e){return U0(rC,{classNames:{root:tf(e.scopeClassName,cC(e.recipes))}})}function fC(e){const t=F0.map(n=>` ${nC[n]}: ${e.tokens[n]};`).join(` `),r=[" --wxz-sa-surface-raised: var(--wxz-sa-surface);"," --wxz-sa-surface-sunken: color-mix(in srgb, var(--wxz-sa-canvas) 94%, var(--wxz-sa-foreground));"," --wxz-sa-surface-hover: color-mix(in srgb, var(--wxz-sa-surface) 94%, var(--wxz-sa-foreground));"," --wxz-sa-foreground-subtle: color-mix(in srgb, var(--wxz-sa-foreground) 48%, var(--wxz-sa-canvas));"," --wxz-sa-border-strong: color-mix(in srgb, var(--wxz-sa-border) 68%, var(--wxz-sa-foreground));"," --wxz-sa-input-background: var(--wxz-sa-surface);"," --wxz-sa-input-border: var(--wxz-sa-border);"," --wxz-sa-brand-active: color-mix(in srgb, var(--wxz-sa-brand) 76%, #000);"," --wxz-sa-shadow-sm: 0 1px 2px color-mix(in srgb, var(--wxz-sa-foreground) 8%, transparent);"," --wxz-sa-shadow-md: var(--wxz-sa-shadow-card);"," --wxz-sa-shadow-overlay: 0 24px 80px color-mix(in srgb, var(--wxz-sa-foreground) 22%, transparent);"," --wxz-sa-control-height: 42px;"," --wxz-sa-space-unit: 4px;"," --wxz-sa-motion-fast: 140ms;"," --wxz-sa-motion-standard: 200ms;"].join(` `);return`.${e.scopeClassName} { ${t} ${r} }`}const Xp=Object.freeze({version:1,hostMode:"website-with-admin",memberEntry:"none",adminEntry:"direct-only",authenticatedAdminEntry:"none"});function B0(e){if(!((e==null?void 0:e.version)===1&&["website-with-admin","admin-only"].includes(e.hostMode)&&["header","contextual","none"].includes(e.memberEntry)&&["header","contextual","direct-only","root"].includes(e.adminEntry)&&["account-menu","header","none"].includes(e.authenticatedAdminEntry??"none")&&(e.hostMode==="admin-only"?e.memberEntry==="none"&&e.adminEntry==="root"&&(e.authenticatedAdminEntry??"none")==="none":e.adminEntry!=="root")))throw new Error("SITE_ADMIN_ENTRY_POLICY_INVALID")}function hC(e){return B0(e),e}const Ht="SITE_ADMIN_CONFIG_INVALID",pC="SITE_ADMIN_PROVIDER_MISSING",V0="SITE_ADMIN_ROUTE_PARAM_INVALID",mC="SITE_ADMIN_ZERO_ROW_WRITE",gC=new Set(["base","cms","catalog","cms_catalog","commerce","cms_commerce","fanke"]),vC=new Set(["assets","case","faq","forms","lead","seo","service","simple_booking","team","testimonial"]),yC=new Set(["inventory_procurement"]),xC=new Set(["text","textarea","richtext","number","boolean","datetime","select"]);function Lr(e){return typeof e=="string"&&e.trim().length>0}function $u(e){return new Set(e).size!==e.length}function wC(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;const t=e;if(!Lr(t.key)||!Lr(t.label)||!Lr(t.table)||!Lr(t.resource)||!Array.isArray(t.fields)||!t.fields.length||!Array.isArray(t.listColumns)||!t.listColumns.length||!t.listColumns.every(Lr)||$u(t.listColumns)||t.searchColumn!==void 0&&!Lr(t.searchColumn))return!1;const r=new Set;for(const n of t.fields){if(!n||typeof n!="object"||!Lr(n.key)||!Lr(n.label)||!xC.has(n.type)||r.has(n.key))return!1;r.add(n.key)}return t.listColumns.every(n=>n==="id"||r.has(n))}function bC(e){return H0(e),e}function H0(e){var t,r;if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`${Ht}: config must be an object`);const n=e;if(n.version!==1||!n.profile||!gC.has(n.profile))throw new Error(`${Ht}: unsupported version or profile`);if(n.databaseRpcContractVersion!==void 0&&![1,2,3].includes(n.databaseRpcContractVersion))throw new Error(`${Ht}: invalid database RPC contract`);if(n.modules!==void 0&&(!n.modules||typeof n.modules!="object"||Array.isArray(n.modules)||Object.entries(n.modules).some(([a,i])=>!vC.has(a)||typeof i!="boolean")))throw new Error(`${Ht}: invalid module selection`);if(n.migration&&(n.migration.sourcePlatform!=="fanke"||!((t=n.migration.contractDigest)!=null&&t.trim())))throw new Error(`${Ht}: invalid migration contract`);if(n.profile==="fanke"&&((r=n.migration)==null?void 0:r.sourcePlatform)!=="fanke")throw new Error(`${Ht}: fanke requires a migration contract`);if(n.profile!=="fanke"&&n.migration!==void 0)throw new Error(`${Ht}: migration requires the fanke profile`);if(n.configDigest!==void 0&&!/^sha256:[0-9a-f]{64}$/.test(n.configDigest))throw new Error(`${Ht}: invalid config digest`);if(n.bespoke!==void 0&&(!Array.isArray(n.bespoke)||n.bespoke.some(a=>typeof a!="string"||!yC.has(a))||$u(n.bespoke)))throw new Error(`${Ht}: invalid bespoke selection`);const s=Array.isArray(n.bespoke)&&n.bespoke.includes("inventory_procurement");if(s&&!["single_per_product","per_purchase_order"].includes(n.inventorySupplierMode??"")||!s&&n.inventorySupplierMode!==void 0)throw new Error(`${Ht}: invalid inventory supplier mode`);if(n.managedEntities!==void 0&&(!Array.isArray(n.managedEntities)||n.managedEntities.some(a=>!wC(a))||$u(n.managedEntities.map(a=>a.key))))throw new Error(`${Ht}: invalid managed entities`)}function bN(e,t){var r,n,s;return t==="base"?!0:t==="cms"?["cms","cms_catalog","cms_commerce"].includes(e.profile):t==="catalog"?["catalog","cms_catalog","commerce","cms_commerce"].includes(e.profile):t==="commerce"?["commerce","cms_commerce"].includes(e.profile):t==="fanke"?((r=e.migration)==null?void 0:r.sourcePlatform)==="fanke":t==="inventory_procurement"?((n=e.bespoke)==null?void 0:n.includes("inventory_procurement"))??!1:!!((s=e.modules)!=null&&s[t])}var _C=Object.defineProperty,SC=(e,t,r)=>t in e?_C(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Zp=(e,t,r)=>SC(e,typeof t!="symbol"?t+"":t,r);class yr extends Error{constructor(t,r,n){super(`${t}: ${r}`),Zp(this,"code"),Zp(this,"cause"),this.name="SiteAdminError",this.code=t,this.cause=n}}function mi(e,t="SITE_ADMIN_REQUEST_FAILED"){if(e instanceof yr)return e;if(e instanceof Error)return new yr(t,e.message,e);if(e&&typeof e=="object"){const n=e,s=[n.message,n.error_description,n.details,n.hint,n.code].filter(a=>typeof a=="string"&&!!a.trim()).map(a=>a.trim());if(s.length)return new yr(t,[...new Set(s)].join(" · "),e);try{const a=JSON.stringify(e);if(a&&a!=="{}")return new yr(t,a,e)}catch{}return new yr(t,"请求失败,请稍后重试",e)}const r=String(e??"").trim()||"请求失败,请稍后重试";return new yr(t,r,e)}function W0(e){const t=mi(e),r=`${t.code} ${t.message}`.toUpperCase();return r.includes("AUTH_REQUIRED")||r.includes("AUTHENTICATION REQUIRED")||r.includes("JWT EXPIRED")?"登录状态已失效,请重新登录":r.includes("FORBIDDEN")||r.includes("PERMISSION_DENIED")||r.includes("PERMISSION DENIED")||r.includes("ORGANIZATION MISMATCH")?"没有权限执行此操作":r.includes("INVENTORY_INSUFFICIENT")?"库存不足,无法完成出库":r.includes("PURCHASE_RECEIPT_EXCEEDS_ORDERED")?"收货数量不能超过采购单剩余待收数量":r.includes("PURCHASE_ORDER_ALREADY_RECEIVED")||r.includes("PURCHASE_ORDER_CANNOT_CANCEL")?"该采购单已有收货记录,不能取消":r.includes("PURCHASE_ORDER_NOT_DRAFT")?"只有草稿采购单可以修改":r.includes("PURCHASE_ORDER_NOT_RECEIVABLE")?"当前采购单状态不能收货":r.includes("INVALID_APPOINTMENT_INPUT")?"请填写有效的预约信息,并选择未来的预约时间":r.includes("SITE_ADMIN_APPOINTMENT_TRANSITION_INVALID")?"当前预约状态不允许执行此操作":r.includes("COMMERCE_ORDER_PAYMENT_REQUIRED")?"订单尚未确认收款,不能继续交付":r.includes("COMMERCE_ORDER_PAYMENT_STATE_INVALID")?"当前订单状态不能确认收款":r.includes("COMMERCE_ORDER_FULFILLMENT_STATE_INVALID")?"当前订单状态不能完成交付":r.includes("SITE_ADMIN_PUBLIC_SLUG_REQUIRED")?"发布前请填写 Slug":r.includes("SITE_ADMIN_DUPLICATE_PRODUCT_SKU_CODE")||r.includes("SKU_CODE_DUPLICATE")?"同一商品的规格编码不能重复":r.includes("INVENTORY_RULES_NOT_CONFIGURED")||r.includes("SITE_ADMIN_CONFIGURATION")?"业务配置尚未完成,请联系管理员":r.includes("SUPPLIER_REQUIRED")||r.includes("SUPPLIER_NOT_FOUND")||r.includes("SUPPLIER_MISMATCH")?"请选择有效的供应商后重试":r.includes("INVALID")||r.includes("REQUIRED")||r.includes("NOT_FOUND")?"提交内容不完整或已失效,请检查后重试":r.includes("NETWORK")||r.includes("FETCH")?"网络连接异常,请稍后重试":"操作失败,请稍后重试"}function EC(e,t="recordId"){if(!e||!/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,127}$/.test(e))throw new yr(V0,`${t} is invalid`);return e}function _N(e,t="routeParam"){const r=Array.from(e??"").some(n=>{const s=n.codePointAt(0)??0;return s<=31||s===127});if(!e||e.length>256||/[\\/?#]/u.test(e)||r)throw new yr(V0,`${t} is invalid`);return e}function Ko(e){throw new yr(mC,"mutation returned no row")}function em(e,t="/"){const r=n=>n.startsWith("/")&&!n.startsWith("//")&&!n.includes("\\")&&!/[\r\n]/.test(n)&&!/^[a-z][a-z0-9+.-]*:/i.test(n);return e&&r(e)?e:r(t)?t:"/"}function SN(e,t,r="/login"){const n=em(e,r),s=em(t,"/"),a=n.indexOf("#"),i=a===-1?n:n.slice(0,a),o=a===-1?"":n.slice(a),l=i.indexOf("?"),u=l===-1?i:i.slice(0,l),d=new URLSearchParams(l===-1?"":i.slice(l+1));return d.set("returnTo",s),`${u}?${d.toString()}${o}`}function lt(e,t,r){const n=e==null?void 0:e(t),s=n?Object.fromEntries(Object.entries(n).filter(([a])=>a==="className"||a==="style"||a.startsWith("data-")||a.startsWith("aria-"))):void 0;return{...s,...r,className:ye(s==null?void 0:s.className,r==null?void 0:r.className),style:kC(s==null?void 0:s.style,r==null?void 0:r.style)}}function mr(e,t){return typeof e=="function"?e(t):e??{}}function ye(...e){return e.filter(Boolean).join(" ")||void 0}function kC(e,t){return e||t?{...e,...t}:void 0}function EN(e,...t){const r={...e};for(const n of t)if(n)for(const s of Object.keys(n)){const a=n[s];a!==void 0&&(r[s]=a)}return r}function tm(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function Qo(e,...t){const r={...e};for(const n of t)if(n)for(const[s,a]of Object.entries(n))a!==void 0&&(r[s]=tm(a)&&tm(r[s])?Qo(r[s],a):a);return r}function q0(e,t){return r=>{e==null||e(r),r.defaultPrevented||t(r)}}const jC={common:{loading:"加载中…",empty:"暂无数据",loadFailed:"加载失败",retry:"重试",save:"保存",saving:"保存中…",create:"新建",edit:"编辑",view:"查看",delete:"删除",publish:"发布",withdraw:"撤回",cancel:"取消",confirm:"确认",confirmDelete:"确认删除这条记录?",search:"搜索",previousPage:"上一页",nextPage:"下一页",forbidden:"没有权限访问此页面",notFound:"未找到记录",configurationError:"管理后台配置错误",pagination:"分页导航",formatError:W0},auth:{loginTitle:"登录 / 注册",loginDescription:"使用邮箱验证码登录",phoneLoginDescription:"使用手机号验证码登录",emailLabel:"邮箱",emailPlaceholder:"name@example.com",phoneLabel:"手机号",phonePlaceholder:"+8613800138000",sendCode:"发送验证码",verifyCode:"验证并登录",codeLabel:"验证码",signOut:"退出登录",account:"我的账户",admin:"管理后台"},admin:{title:"管理后台",navigationLabel:"后台菜单",dashboardTitle:"后台概览",dashboardDescription:"管理站点内容、成员与业务数据",rbac:"角色与权限"},collection:{untitled:"未命名记录",listTitle:e=>`${e}管理`,createTitle:e=>`新建${e}`,editTitle:e=>`编辑${e}`,createDescription:e=>`填写${e}信息,完成后保存。`,editDescription:e=>`修改${e}信息,保存后立即生效。`,discardChanges:"当前修改尚未保存,确定放弃吗?",closeEditor:"关闭编辑器",publishRequiredIndicator:"发布必填",requiredField:(e,t)=>t==="publish"?`发布前请填写${e}`:`请填写${e}`,saveSuccess:"保存成功",deleteSuccess:"删除成功",publishSuccess:"发布成功",withdrawSuccess:"撤回成功",total:e=>`共 ${e} 条`,columnLabel:e=>({name:"名称",title:"标题",summary:"摘要",status:"状态",display_order:"排序",created_at:"创建时间",updated_at:"更新时间"})[e]??"信息",statusLabel:e=>({draft:"草稿",published:"已发布",archived:"已归档"})[e]??(e||"-")},ai:{expand:"AI 扩写",generating:"生成中…",previewTitle:"AI 扩写预览",accept:"采用",discard:"放弃"},assets:{title:"资源库",upload:"上传",uploading:"上传中…",clearImage:"清除图片",addImage:"添加图片",uploadSuccess:"上传成功",formatError:e=>e.message.includes("SITE_ADMIN_FORBIDDEN")?"没有权限上传资源":e.message.includes("SITE_ADMIN_UPLOAD_SERVICE_MISSING")?"上传服务未配置":e.message.includes("SITE_ADMIN_UPLOAD_TOO_LARGE")?"文件大小超过限制":e.message.includes("SITE_ADMIN_UPLOAD_TYPE_NOT_ALLOWED")?"不支持该文件类型":"资源操作失败,请重试"},seo:{title:"SEO 设置",siteName:"站点名称",titleTemplate:"标题模板",defaultDescription:"默认描述",defaultOgImage:"默认分享图",robotsDefault:"Robots 默认策略",save:"保存",saving:"保存中…",saveSuccess:"保存成功",formatError:e=>e.message.includes("SITE_ADMIN_FORBIDDEN")?"没有权限修改 SEO 设置":"SEO 设置操作失败,请重试"},inventory:{productLabel:"库存商品",supplierLabel:"供应商",purchaseOrderLabel:"采购单",receiptLabel:"收货单",outboundOrderLabel:"出库单",balanceLabel:"即时库存",ledgerLabel:"库存流水",defaultUnit:"件",productCreated:"商品创建成功",productUpdated:"商品修改成功",supplierCreated:"供应商创建成功",supplierUpdated:"供应商修改成功",fixedSupplier:"固定供应商",chooseFixedSupplier:"选择固定供应商",createProduct:"新建商品",saveProduct:"保存修改",createSupplier:"新建供应商",saveSupplier:"保存修改",cancelEdit:"取消编辑",edit:"编辑",createPurchaseOrder:"新建采购单",purchaseOrderDetail:"采购单详情",cancelPurchaseOrderConfirm:"确认取消该采购单?",purchaseOrderActionSuccess:"采购单操作成功",confirmPurchaseOrder:"确认采购单",cancelPurchaseOrder:"取消采购单",receiptLegend:"本次收货",remainingQuantity:(e,t)=>`${e}(剩余 ${t})`,confirmReceipt:"确认本次收货",cancelUnreceivedPurchaseOrder:"取消未收货采购单",supplier:"供应商",chooseSupplier:"选择供应商",expectedDate:"预计到货日期",remark:"备注",product:"商品",chooseProduct:"选择商品",purchaseQuantity:"采购数量",purchaseUnitCost:"采购单价",addItem:"添加明细",removeItem:"删除明细",saveDraft:"保存草稿",receiptTitle:"收货单",receiptSummary:(e,t)=>`共 ${e} 张生效收货单,${t} 条明细;生效后不可编辑或删除。`,sourcePurchaseOrder:"来源采购单:",receiptLineSeparator:" · 收货 ",outboundSuccess:"出库成功",outboundTitle:"出库单",outboundDescription:"成功即生效并扣减库存,库存不足时整单回滚。",inStockProduct:"有库存商品",chooseInStockProduct:"选择有库存商品",availableQuantity:(e,t)=>`${e}(可用 ${t})`,outboundQuantity:"出库数量",outboundRemark:"用途备注",outboundSubmitting:"出库处理中…",confirmOutbound:"确认出库",emptyRemark:"未填写",outboundLineSeparator:" · 出库 ",statusDraft:"草稿",statusConfirmed:"已确认",statusPartiallyReceived:"部分收货",statusFullyReceived:"全部收货",statusCancelled:"已取消",productFieldLabel:e=>({sku:"商品编码",name:"商品名称",unit:"计量单位"})[e]??"商品字段",supplierFieldLabel:e=>({code:"供应商编码",name:"供应商名称",contact_name:"联系人",contact_phone:"联系电话"})[e]??"供应商字段",purchaseItemFieldLabel:(e,t)=>`${e} ${t==="quantity"?"采购数量":"采购单价"}`,columnLabel:e=>({name:"名称",sku:"商品编码",unit:"计量单位",is_active:"是否启用",code:"编码",contact_name:"联系人",number:"单号",status:"状态",expected_date:"预计到货日期",created_at:"创建时间",product_id:"商品",quantity:"库存数量",updated_at:"更新时间",direction:"变动方向",quantity_delta:"变动数量",balance_after:"变动后库存"})[e]??"库存字段"},commerce:{productLabel:"商品",productCategoryLabel:"商品分类",productNameField:"商品名称",slugField:"Slug",categoryIdField:"商品分类",summaryField:"摘要",productDetailField:"商品详情",currencyField:"币种",fulfillmentTypeField:"交付类型",digitalFulfillment:"数字内容",physicalFulfillment:"实物配送",featuredField:"推荐",sortOrderField:"排序",imageUrlsField:"图片 URL(每行一个)",keywordsField:"关键词(每行一个)",skuJsonField:"SKU JSON",categoryNameField:"分类名称",parentCategoryIdField:"父分类 ID",sku:"规格",noSku:"暂无可选规格",skuStock:e=>`库存 ${e}`,addedToCart:"已加入购物车",addingToCart:"添加中…",addToCart:"加入购物车",viewCart:"查看购物车",favorited:"已收藏",favoriting:"收藏中…",favorite:"收藏",reviewsTitle:"商品评价",reviewRating:e=>`${e} 星`,cartTitle:"购物车",quantityLabel:e=>`${e} 数量`,removeFromCart:"移除",mixedCurrencies:"购物车包含不同币种,请调整后分别结算。",mixedOrganizations:"购物车商品与收货地址不属于同一组织。",totalLabel:"合计:",checkout:"去结算",checkoutTitle:"确认订单",orderCreated:"订单创建成功",emptyCart:"购物车为空,请先添加商品。",emptyAddresses:"请先添加收货地址。",orderRemark:"订单备注",submittingOrder:"提交中…",submitOrder:"提交订单",ordersTitle:"我的订单",viewOrder:"查看订单",cancelOrder:"取消订单",confirmReceipt:"确认收货",confirmDigitalDelivery:"确认数字内容已交付",digitalCheckoutNotice:"数字内容无需填写收货地址,订单提交后可在“我的订单”中查看。",reviewSubmitted:"评价已提交,审核通过后展示",rating:"评分",ratingOption:e=>`${e} 星`,reviewContent:"评价内容",submittingReview:"提交中…",submitReview:"提交评价",defaultAddressLabel:"默认",deleteAddressConfirm:e=>`确认删除“${e}”地址?`,addressesTitle:"收货地址",editAddress:"编辑",deleteAddress:"删除",setDefaultAddress:"设为默认",saveAddress:"保存地址",addAddress:"新增地址",cancelAddressEdit:"取消编辑",favoritesTitle:"我的收藏",processing:"处理中…",removeFavorite:"取消收藏",addressFieldLabel:e=>({label:"地址标签",recipient_name:"收件人",phone:"联系电话",province:"省份",city:"城市",district:"区县",detail_address:"详细地址"})[e]??"地址字段",orderStatus:e=>({pending:"待处理",paid:"待发货",shipped:"已发货",completed:"已完成",cancelled:"已取消"})[e]??"未知订单状态",paymentStatus:e=>({unpaid:"未支付",pending:"支付中",paid:"已支付",refunded:"已退款",failed:"支付失败"})[e]??"未知支付状态",columnLabel:e=>({name:"名称",status:"状态",currency:"币种",sort_order:"排序",updated_at:"更新时间",slug:"访问路径",level:"层级"})[e]??"商品字段"}};function CC(e){return Qo(jC,e)}const Mu=p.forwardRef(function({className:e,...t},r){return c.jsx("button",{...t,ref:r,className:ye("wxz-sa-primitive-button",e)})}),kN=p.forwardRef(function({className:e,...t},r){return c.jsx("input",{...t,ref:r,className:ye("wxz-sa-primitive-input",e)})});p.forwardRef(function({className:e,...t},r){return c.jsx("textarea",{...t,ref:r,className:ye("wxz-sa-primitive-textarea",e)})});p.forwardRef(function({className:e,...t},r){return c.jsx("select",{...t,ref:r,className:ye("wxz-sa-primitive-select",e)})});p.forwardRef(function({className:e,type:t="checkbox",...r},n){return c.jsx("input",{...r,ref:n,type:t,className:ye("wxz-sa-primitive-checkbox",e)})});const jN=p.forwardRef(function({className:e,...t},r){return c.jsx("form",{...t,ref:r,className:ye("wxz-sa-primitive-form",e)})});p.forwardRef(function({className:e,...t},r){return c.jsx("section",{...t,ref:r,className:ye("wxz-sa-primitive-surface",e)})});p.forwardRef(function({className:e,...t},r){return c.jsx("table",{...t,ref:r,className:ye("wxz-sa-primitive-table",e)})});const NC=p.forwardRef(function({className:e,role:t="dialog",...r},n){return c.jsx("div",{...r,ref:n,role:t,className:ye("wxz-sa-primitive-dialog",e)})}),CN=p.forwardRef(function({className:e,role:t="tablist",...r},n){return c.jsx("div",{...r,ref:n,role:t,className:ye("wxz-sa-primitive-tabs",e)})}),NN=p.forwardRef(function({className:e,...t},r){return c.jsx("aside",{...t,ref:r,className:ye("wxz-sa-primitive-sheet",e)})});p.forwardRef(function({className:e,...t},r){return c.jsx("div",{...t,ref:r,className:ye("wxz-sa-primitive-dropdown",e)})});function PC({message:e,cancelLabel:t,confirmLabel:r,themeClassName:n,messageProps:s,onResolve:a}){const i=p.useId(),o=p.useId(),l=p.useRef(null),u=p.useRef(null),d=p.useRef(null);p.useEffect(()=>{var m;d.current=document.activeElement instanceof HTMLElement?document.activeElement:null,(m=u.current)==null||m.focus();const x=v=>{var _,y,g;if(v.key==="Escape"){v.preventDefault(),a(!1);return}if(v.key!=="Tab")return;const w=Array.from(((_=l.current)==null?void 0:_.querySelectorAll('button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])'))??[]);if(w.length===0){v.preventDefault();return}const E=w[0],C=w[w.length-1];v.shiftKey&&(document.activeElement===E||!((y=l.current)!=null&&y.contains(document.activeElement)))?(v.preventDefault(),C==null||C.focus()):!v.shiftKey&&(document.activeElement===C||!((g=l.current)!=null&&g.contains(document.activeElement)))&&(v.preventDefault(),E==null||E.focus())};return document.addEventListener("keydown",x),()=>{var v;document.removeEventListener("keydown",x),(v=d.current)==null||v.focus()}},[a]);const f=m=>{m.target===m.currentTarget&&a(!1)},h=c.jsx("div",{className:ye("wxz-sa-screen",n,"wxz-sa-dialog-overlay"),"data-site-admin-screen":"confirm-dialog","data-wxz-sa-screen":"confirm-dialog","data-wxz-sa-state":"ready",onMouseDown:f,children:c.jsxs(NC,{"aria-describedby":o,"aria-labelledby":i,"aria-modal":"true",className:"wxz-sa-dialog-content wxz-sa-confirm-dialog",ref:l,role:"alertdialog",children:[c.jsx("h2",{className:"wxz-sa-dialog-title",id:i,children:r}),c.jsx("p",{...s,className:ye("wxz-sa-confirm-dialog-message",s==null?void 0:s.className),id:o,children:e}),c.jsxs("div",{className:"wxz-sa-actions wxz-sa-confirm-dialog-actions",children:[c.jsx(Mu,{className:"wxz-sa-button wxz-sa-button--secondary",onClick:()=>a(!1),ref:u,type:"button",children:t}),c.jsx(Mu,{className:"wxz-sa-button wxz-sa-button--danger",onClick:()=>a(!0),type:"button",children:r})]})]})});return typeof document<"u"?Hs.createPortal(h,document.body):h}function TC({notification:e,resolveElementProps:t,onDismiss:r}){p.useEffect(()=>{const i=globalThis.setTimeout(()=>r(e.id),e.kind==="error"?8e3:4800);return()=>globalThis.clearTimeout(i)},[e.id,e.kind,r]);const n=lt(t,{component:"NotificationViewport",slot:"item",value:e},void 0),s=lt(t,{component:"NotificationViewport",slot:"message",value:e.message},void 0),a=lt(t,{component:"NotificationViewport",slot:"dismissButton",value:e.kind},void 0);return c.jsxs("div",{...n,className:ye("wxz-sa-notification",`wxz-sa-notification--${e.kind}`,n.className),"data-wxz-sa-part":"notification","data-wxz-sa-state":e.kind,role:e.kind==="error"?"alert":"status",children:[c.jsx("span",{...s,className:ye("wxz-sa-notification-message",s.className),children:e.message}),c.jsx("button",{...a,"aria-label":a["aria-label"]??"关闭通知",className:ye("wxz-sa-notification-dismiss",a.className),onClick:q0(a.onClick,()=>r(e.id)),type:"button",children:c.jsx("span",{"aria-hidden":"true",children:"×"})})]})}function RC({notifications:e,resolveElementProps:t,themeClassName:r,onDismiss:n}){if(e.length===0)return null;const s=lt(t,{component:"NotificationViewport",slot:"root",value:e},void 0),a=c.jsx("div",{...s,"aria-label":s["aria-label"]??"操作结果",className:ye("wxz-sa-screen",r,"wxz-sa-notification-viewport",s.className),"data-wxz-sa-part":"notification-viewport",children:e.map(i=>c.jsx(TC,{notification:i,onDismiss:n,resolveElementProps:t},i.id))});return typeof document<"u"?Hs.createPortal(a,document.body):a}const rm=Symbol.for("wxz-web-builder-react-components/supabase-site-admin-context"),nm=globalThis,G0=nm[rm]??(nm[rm]=p.createContext(null)),OC={},AC={version:1,profile:"base"};function zC(e){let t;try{t=new URL(e)}catch{throw new Error("SITE_ADMIN_SUPABASE_URL_INVALID")}if(t.protocol!=="http:"&&t.protocol!=="https:"||t.username||t.password||t.search||t.hash||typeof globalThis.location<"u"&&t.origin===globalThis.location.origin)throw new Error("SITE_ADMIN_SUPABASE_URL_INVALID")}function IC(e,t){return{now:()=>new Date,randomUUID:()=>{const r=globalThis.crypto;return r&&"randomUUID"in r?r.randomUUID():`site-admin-${Date.now()}-${Math.random().toString(36).slice(2)}`},confirm:e,notifier:t}}function LC({children:e,supabase:t,baseUrl:r,config:n,dataSources:s=OC,services:a,messages:i,theme:o,presentation:l,presentationStyleNonce:u,entryPolicy:d=Xp,resolveElementProps:f,locale:h="zh-CN",timeZone:m="Asia/Shanghai",currency:x="CNY",rbacMessages:v,rbacNotifier:_,runtimeMode:y="standalone"}){var g,w;const E=p.useRef(null),C=p.useRef(0),[R,b]=p.useState(null),[k,A]=p.useState([]),N=p.useCallback(Q=>{A(pe=>pe.filter(Qe=>Qe.id!==Q))},[]),z=p.useCallback((Q,pe)=>{if(!pe.trim())return;const Qe={id:++C.current,kind:Q,message:pe};A(dt=>[...dt.slice(-2),Qe])},[]),L=p.useMemo(()=>({success:Q=>z("success",Q),error:Q=>z("error",Q)}),[z]),G=p.useCallback(Q=>{const pe=E.current;E.current=null,b(null),pe==null||pe(Q)},[]),$=p.useCallback(Q=>{var pe;return(pe=E.current)==null||pe.call(E,!1),new Promise(Qe=>{E.current=Qe,b(Q)})},[]);p.useEffect(()=>()=>{var Q;(Q=E.current)==null||Q.call(E,!1),E.current=null},[]);const{config:ee,entryPolicy:J,configError:ge}=p.useMemo(()=>{try{return H0(n),B0(d),zC(r),{config:n,entryPolicy:d,configError:null}}catch(Q){return{config:AC,entryPolicy:Xp,configError:mi(Q,"SITE_ADMIN_PROVIDER_CONFIG_INVALID")}}},[r,n,d]),P=ge?"":r,H=p.useMemo(()=>{const Q=IC($,L),pe=Qo(Q,a),Qe=pe.upload,dt=pe.ai,St=pe.forms;return{...pe,now:pe.now??Q.now,randomUUID:pe.randomUUID??Q.randomUUID,confirm:pe.confirm??Q.confirm,upload:Qe&&typeof Qe.upload=="function"?Qe:void 0,ai:dt&&typeof dt.expand=="function"?dt:void 0,forms:St&&typeof St.websiteId=="string"&&typeof St.baseUrl=="string"?St:void 0}},[L,$,a]),W=p.useMemo(()=>Qo(H.notifier??{},_),[_,H.notifier]),te=p.useMemo(()=>CC(i),[i]),re=p.useMemo(()=>l?U0(dC(l),o):o??{},[l,o]),ue=p.useMemo(()=>l?fC(l):null,[l]),fe=p.useMemo(()=>({supabase:t,supabaseUrl:P,config:ee,configError:ge,dataSources:s,services:H,messages:te,theme:re,presentation:l??null,entryPolicy:J,resolveElementProps:f,locale:h,timeZone:m,currency:x}),[P,ee,ge,x,s,J,h,te,H,t,l,f,re,m]),Ne=lt(f,{component:"ConfirmDialog",slot:"message",value:R},void 0),_e=c.jsxs(G0.Provider,{value:fe,children:[ue?c.jsx("style",{"data-site-admin-presentation":l==null?void 0:l.version,nonce:u,children:ue}):null,e,c.jsx(RC,{notifications:k,onDismiss:N,resolveElementProps:f,themeClassName:(g=re.classNames)==null?void 0:g.root}),R!==null&&!(a!=null&&a.confirm)?c.jsx(PC,{cancelLabel:te.common.cancel,confirmLabel:te.common.confirm??"确认",message:R,messageProps:Ne,onResolve:G,themeClassName:(w=re.classNames)==null?void 0:w.root}):null]});return y==="reuse-host"?_e:c.jsx(Jv,{supabase:t,profileTable:!1,children:c.jsx(ty,{supabase:t,baseUrl:P,messages:v,notifier:W,children:_e})})}function K0(){const e=p.useContext(G0);if(!e)throw new Error(`${pC}: useSiteAdmin must be used within SiteAdminProvider`);return e}function Q0(e){const t=Array.isArray(e)?e[0]:e;if(!t||typeof t!="object"||Array.isArray(t))return Ko();const r=t;return typeof r.id!="string"||!r.id?Ko():r}function Yo(e){if(e)throw mi(e)}function Ji(e){(e==null?void 0:e.code)==="PGRST116"&&Ko(),Yo(e)}function _n(e,t){return t&&e&&typeof e=="object"&&"abortSignal"in e&&typeof e.abortSignal=="function"?e.abortSignal(t):e}function sm(e,t,r){const n=r?{...e.insertDefaults??{}}:{};for(const s of e.mutableFields)Object.prototype.hasOwnProperty.call(t,s)&&(n[s]=t[s]);return r&&typeof t._org_id=="string"&&t._org_id&&(n.org_id=t._org_id),n}function DC(e,t){var r;const{supabase:n,services:s}=e,a=((r=t.primaryKey)==null?void 0:r.column)??"id",i=d=>{var f;if(((f=t.primaryKey)==null?void 0:f.type)==="integer"){const h=typeof d=="number"?d:typeof d=="string"&&/^-?(0|[1-9][0-9]*)$/.test(d)?Number(d):NaN;if(!Number.isSafeInteger(h))throw new Error("SITE_ADMIN_ADOPTION_PRIMARY_KEY_INVALID");return h}return EC(d)},o=d=>{if(!t.primaryKey)return Q0(d);const f=Array.isArray(d)?d[0]:d;return!f||typeof f!="object"?Ko():{...f,id:String(i(f[a]))}},l=async(d,f,h)=>{const m=await _n(n.rpc(d,f),h.signal);return Ji(m.error),o(m.data)},u=(d,f,h)=>typeof d=="string"?l(d,{p_id:f},h):l(d.name,{[d.argument]:f},h);return{async list(d){const f=Math.max(1,Math.trunc(d.page)),h=Math.min(100,Math.max(1,Math.trunc(d.pageSize)));let m=n.from(t.table).select(t.select,{count:"exact"});for(const[_,y]of Object.entries(t.listFilters??{}))m=m.eq(_,y);d.search.trim()&&t.searchColumn&&(m=m.ilike(t.searchColumn,`%${d.search.trim()}%`));for(const _ of t.orderBy??[{column:"updated_at",ascending:!1}])m=m.order(_.column,{ascending:_.ascending??!0});const x=(f-1)*h,v=await _n(m.range(x,x+h-1),d.signal);return Yo(v.error),{rows:(v.data??[]).map(_=>o(_)),total:v.count??0}},async get(d,f){const h=i(d);let m=n.from(t.table).select(t.select).eq(a,h);for(const[v,_]of Object.entries(t.listFilters??{}))m=m.eq(v,_);const x=await _n(m.maybeSingle(),f);return Yo(x.error),x.data?o(x.data):null},async create(d,f){const h=sm(t,d,!0);if(t.saveRpc)return l(t.saveRpc.name,{[t.saveRpc.argument]:h},f);if(!t.directInsert)throw new Error(`SITE_ADMIN_MUTATION_UNAVAILABLE: ${t.key}.create`);const m=await _n(n.from(t.table).insert(h).select(t.select).single(),f.signal);return Ji(m.error),o(m.data)},async update(d,f,h){const m=i(d),x=sm(t,f,!1);if(t.saveRpc)return l(t.saveRpc.name,{[t.saveRpc.argument]:{...x,[a]:m}},h);if(!t.directUpdate)throw new Error(`SITE_ADMIN_MUTATION_UNAVAILABLE: ${t.key}.update`);let v=n.from(t.table).update(x).eq(a,m);for(const[y,g]of Object.entries(t.listFilters??{}))v=v.eq(y,g);const _=await _n(v.select(t.select).single(),h.signal);return Ji(_.error),o(_.data)},async softDelete(d,f){const h=i(d);if(t.deleteRpc)return u(t.deleteRpc,h,f);if(!t.directUpdate)throw new Error(`SITE_ADMIN_MUTATION_UNAVAILABLE: ${t.key}.delete`);let m=n.from(t.table).update({is_deleted:!0,delete_time:s.now().toISOString(),updated_at:s.now().toISOString()}).eq(a,h).eq("is_deleted",!1);for(const[v,_]of Object.entries(t.listFilters??{}))v!=="is_deleted"&&(m=m.eq(v,_));const x=await _n(m.select(t.select).single(),f.signal);return Ji(x.error),o(x.data)},publish:t.publishRpc?(d,f)=>u(t.publishRpc,i(d),f):void 0,withdraw:t.withdrawRpc?(d,f)=>u(t.withdrawRpc,i(d),f):void 0}}async function $C(e,t){var r;const n=Math.max(1,Math.trunc(t.page??1)),s=Math.min(100,Math.max(1,Math.trunc(t.pageSize??24)));let a=e.supabase.from(t.table).select(t.select).eq("is_deleted",!1);for(const[u,d]of Object.entries({...t.filters,...t.publishedFilters===!1?{}:t.publishedFilters??{status:"published"}}))u!=="is_deleted"&&(a=a.eq(u,d));(r=t.search)!=null&&r.trim()&&t.searchColumn&&(a=a.ilike(t.searchColumn,`%${t.search.trim()}%`));const i=t.orderBy??"display_order";if(typeof i=="string")a=a.order(i);else for(const u of i)a=a.order(u.column,{ascending:u.ascending??!0});const o=(n-1)*s,l=await _n(a.range(o,o+s-1),t.signal);return Yo(l.error),(l.data??[]).map(u=>Q0(u))}const La=p.forwardRef(function({status:e,error:t,onRetry:r,retryButtonProps:n,className:s,children:a,...i},o){var l,u,d,f,h;const{messages:m,theme:x,resolveElementProps:v}=K0(),_=e==="loading"?m.common.loading:e==="empty"?m.common.empty:e==="forbidden"?m.common.forbidden:e==="not-found"?m.common.notFound:t?((u=(l=m.common).formatError)==null?void 0:u.call(l,t))??W0(t):m.common.loadFailed,y=lt(v,{component:"ScreenState",slot:"root",value:e},i),g=lt(v,{component:"ScreenState",slot:"retryButton",value:m.common.retry},n);return c.jsxs("div",{...y,ref:o,className:ye(e==="error"?(d=x.classNames)==null?void 0:d.error:(f=x.classNames)==null?void 0:f.status,s,y.className),"data-site-admin-state":e,"data-wxz-sa-state":e,"data-wxz-sa-part":"state",role:e==="error"?"alert":"status","aria-live":e==="error"?"assertive":"polite",children:[a??_,r&&e==="error"?c.jsx(Mu,{...g,type:"button",className:ye((h=x.classNames)==null?void 0:h.secondaryButton,g.className),onClick:q0(g.onClick,r),children:m.common.retry}):null]})});function MC(e,t){return{...t,...e.filters,...e.publishedFilters===!1?{}:e.publishedFilters??{status:"published"},is_deleted:!1}}const FC=p.forwardRef(function({spec:e,slotProps:t={},stateProps:r,renderItem:n,pageSize:s=24,dataSource:a,as:i="main",composition:o="page",title:l=e.title,headingLevel:u,className:d,...f},h){var m,x;const v=K0(),_=(x=(m=v.dataSources)==null?void 0:m.publicCollections)==null?void 0:x[e.key],y=(a==null?void 0:a.list)??(_==null?void 0:_.list),g=Dv(),w=JSON.stringify(Object.entries(e.routeFilters??{}).reduce((J,[ge,P])=>{var H;const W=(H=g[ge])==null?void 0:H.trim();return W&&(J[P]=W),J},{})),E=p.useMemo(()=>JSON.parse(w),[w]),[C,R]=p.useState([]),[b,k]=p.useState("loading"),[A,N]=p.useState(null);p.useEffect(()=>{const J=new AbortController;return R([]),k("loading"),N(null),(y?y({spec:e,page:1,pageSize:s,filters:E,signal:J.signal}):$C(v,{table:e.table,select:e.select,orderBy:e.orderBy,filters:MC(e,E),publishedFilters:!1,pageSize:s})).then(ge=>{J.signal.aborted||(R([...ge]),k(ge.length?"ready":"empty"))}).catch(ge=>{J.signal.aborted||(N(mi(ge)),k("error"))}),()=>J.abort()},[v,y,s,E,e]);const z=lt(v.resolveElementProps,{component:"PublicCollectionListScreen",slot:"root",value:e.key},f),L=lt(v.resolveElementProps,{component:"PublicCollectionListScreen",slot:"title",value:e.title},mr(t.title,{rows:C})),G=lt(v.resolveElementProps,{component:"PublicCollectionListScreen",slot:"list",value:e.key},mr(t.list,{rows:C})),$=u??(o==="page"?"h1":"h2"),ee=o==="page"?"h2":"h3";return c.jsxs(i,{...z,ref:h,className:ye(Ir(v.theme,"publicCollectionList","root"),d,z.className),"data-site-admin-screen":`${e.key}-public-list`,"data-wxz-sa-screen":"public-collection-list","data-wxz-sa-resource":e.key,"data-site-admin-composition":o,"data-state":b,"data-wxz-sa-state":b,"aria-busy":b==="loading",children:[l!==null?c.jsx($,{...L,className:ye(Ir(v.theme,"publicCollectionList","title"),L.className),children:l}):null,b==="loading"?c.jsx(La,{...r,status:"loading"}):null,b==="empty"?c.jsx(La,{...r,status:"empty"}):null,b==="error"?c.jsx(La,{...r,status:"error",error:A}):null,b==="ready"?c.jsx("div",{...G,className:ye(Ir(v.theme,"publicCollectionList","list"),G.className),children:C.map((J,ge)=>{var P,H;if(n)return n(J,ge);const W={record:J,index:ge},te=lt(v.resolveElementProps,{component:"PublicCollectionListScreen",slot:"item",value:J},mr(t.item,W)),re=String(J[e.titleField]??""),ue=lt(v.resolveElementProps,{component:"PublicCollectionListScreen",slot:"itemTitle",value:re},mr(t.itemTitle,W)),fe=e.summaryField?String(J[e.summaryField]??""):"",Ne=lt(v.resolveElementProps,{component:"PublicCollectionListScreen",slot:"summary",value:fe},mr(t.summary,W)),_e=(P=e.detailPath)==null?void 0:P.call(e,J),Q=_e?lt(v.resolveElementProps,{component:"PublicCollectionListScreen",slot:"detailLink",value:_e},mr(t.detailLink,{...W,href:_e})):{},pe=String(((H=e.getImageSource)==null?void 0:H.call(e,J))??(e.imageField?J[e.imageField]:"")??"").trim(),Qe=String(J[e.imageAltField??e.titleField]??""),dt=lt(v.resolveElementProps,{component:"PublicCollectionListScreen",slot:"image",value:pe},mr(t.image,{...W,src:pe,alt:Qe})),St=mr(t.meta,W),ze=(e.metaFields??[]).flatMap(gt=>{const Pr=e.formatMetaValue?e.formatMetaValue(J[gt],gt,J):J[gt],Kn=String(Pr??"").trim();return Kn?[{field:gt,value:Kn}]:[]});return p.createElement("article",{...te,key:J.id,className:ye(Ir(v.theme,"publicCollectionList","item"),te.className)},pe?c.jsx("img",{src:pe,alt:Qe,loading:"lazy",...dt,className:ye(Ir(v.theme,"publicCollectionList","image"),dt.className)}):null,c.jsx(ee,{...ue,className:ye(Ir(v.theme,"publicCollectionList","itemTitle"),ue.className),children:_e?c.jsx(Te,{...Q,to:_e,children:String(J[e.titleField]??"")}):String(J[e.titleField]??"")}),ze.length?c.jsx("div",{...St,className:ye(Ir(v.theme,"publicCollectionList","itemMeta"),St.className),children:ze.map(({field:gt,value:Pr})=>{const Kn=lt(v.resolveElementProps,{component:"PublicCollectionListScreen",slot:"metaItem",value:Pr},mr(t.metaItem,{...W,field:gt,value:Pr}));return p.createElement("span",{...Kn,key:gt},Pr)})}):null,e.summaryField?c.jsx("p",{...Ne,className:ye(Ir(v.theme,"publicCollectionList","description"),Ne.className),children:fe}):null)})}):null]})}),UC=FC;function Y0(e){var t,r;const n=(t=e.publicSpec)==null?void 0:t.slugField,s=e.spec.fields.map(a=>{if(!e.spec.publishRpc||!n||a.key!==n)return a;const i=new Set(a.requiredFor??[]);return i.add("publish"),Object.freeze({...a,requiredFor:Object.freeze([...i])})});return Object.freeze({key:e.spec.key,label:e.label,description:e.description,resource:e.spec.key,fields:Object.freeze(s),createDefaults:e.spec.insertDefaults,listColumns:e.listColumns,columnLabels:e.columnLabels,listImageField:e.listImageField,listSummaryField:e.listSummaryField,formatListValue:e.formatListValue,createPath:e.createPath,editPath:e.editPath,publicPath:(r=e.publicSpec)==null?void 0:r.detailPath,dataSource:a=>DC(a,e.spec)})}const am=Object.freeze([{key:"title",label:"标题",type:"text",required:!0},{key:"slug",label:"Slug",type:"text",description:"用于公开页地址,建议使用简短英文或拼音。"},{key:"category_id",label:"文章分类",type:"text",description:"选择文章归属的分类。"},{key:"summary",label:"摘要",type:"textarea",description:"用于文章列表和搜索摘要。"},{key:"content",label:"正文",type:"richtext"},{key:"featured_image_url",label:"封面图片",type:"image",accept:"image/*"},{key:"seo_title",label:"SEO 标题",type:"text"},{key:"seo_description",label:"SEO 描述",type:"textarea"},{key:"is_pin",label:"置顶",type:"boolean"},{key:"display_order",label:"排序",type:"number",description:"数值越小越靠前。"}]),J0=Object.freeze({key:"post",title:"文章",table:"posts",select:"id,category_id,title,slug,summary,content,featured_image_url,seo_title,seo_description,published_at,display_order,is_pin,status,is_deleted",titleField:"title",summaryField:"summary",contentField:"content",slugField:"slug",imageField:"featured_image_url",listPath:"/articles",routeFilters:{categoryId:"category_id"},detailPath:e=>`/articles/${String(e.slug)}`,orderBy:[{column:"is_pin",ascending:!1},{column:"display_order"},{column:"published_at",ascending:!1}]}),PN=Y0({label:"文章",listColumns:["title","status","updated_at"],columnLabels:{status:"状态",updated_at:"更新时间"},listImageField:"featured_image_url",listSummaryField:"summary",createPath:"/admin/posts/new",editPath:e=>`/admin/posts/${e.id}`,spec:{key:"post",table:"posts",select:"id,org_id,category_id,author_id,title,slug,summary,content,featured_image_url,seo_title,seo_description,status,is_pin,display_order,visit_count,published_at,is_deleted,delete_time,created_at,updated_at",fields:am,searchColumn:"title",listFilters:{is_deleted:!1},orderBy:[{column:"updated_at",ascending:!1}],mutableFields:am.map(e=>e.key),insertDefaults:{status:"draft"},directInsert:!0,directUpdate:!0,deleteRpc:"soft_delete_post",publishRpc:"publish_post",withdrawRpc:"publish_post_withdraw"},publicSpec:J0});function X0(e,t={}){return p.forwardRef((r,n)=>c.jsx(UC,{...t,...r,ref:n,spec:e}))}const BC=X0(J0,{as:"section",composition:"section"}),im=Object.freeze([{key:"title",label:"标题",type:"text",required:!0},{key:"slug",label:"Slug",type:"text",description:"用于公开页地址,建议使用简短英文或拼音。"},{key:"category_id",label:"产品分类",type:"text",description:"选择产品归属的分类。"},{key:"summary",label:"摘要",type:"textarea",description:"用于产品列表和搜索摘要。"},{key:"content",label:"正文",type:"richtext"},{key:"featured_image_url",label:"封面图片",type:"image",accept:"image/*"},{key:"seo_title",label:"SEO 标题",type:"text"},{key:"seo_description",label:"SEO 描述",type:"textarea"},{key:"is_pin",label:"置顶",type:"boolean"},{key:"display_order",label:"排序",type:"number",description:"数值越小越靠前。"}]),Z0=Object.freeze({key:"product",title:"产品",table:"products",select:"id,title,slug,summary,content,featured_image_url,seo_title,seo_description,status,is_pin,display_order,published_at,is_deleted",titleField:"title",summaryField:"summary",contentField:"content",slugField:"slug",imageField:"featured_image_url",routeFilters:{categoryId:"category_id"},listPath:"/products",detailPath:e=>`/products/${String(e.slug)}`,orderBy:[{column:"is_pin",ascending:!1},{column:"display_order"},{column:"published_at",ascending:!1}]}),TN=Y0({label:"展示产品",listColumns:["title","category","status","display_order"],columnLabels:{category:"产品分类",status:"状态",display_order:"排序"},listImageField:"featured_image_url",listSummaryField:"summary",formatListValue:(e,t,r)=>{if(e!=="category")return;const n=r.category;return!n||typeof n!="object"||Array.isArray(n)?"未分类":String(n.name??"未分类")},createPath:"/admin/products/new",editPath:e=>`/admin/products/${e.id}`,spec:{key:"product",table:"products",select:"id,org_id,owner_id,category_id,title,slug,summary,content,featured_image_url,seo_title,seo_description,status,is_pin,display_order,visit_count,published_at,is_deleted,created_at,updated_at,category:product_categories(name)",fields:im,searchColumn:"title",listFilters:{is_deleted:!1},orderBy:[{column:"display_order"}],mutableFields:im.map(e=>e.key),insertDefaults:{status:"draft"},directInsert:!0,directUpdate:!0,deleteRpc:"soft_delete_showcase_product",publishRpc:"publish_showcase_product"},publicSpec:Z0}),VC=X0(Z0,{as:"section",composition:"section"});function om(){return c.jsxs(c.Fragment,{children:[c.jsx(er,{title:"首页 - 吨吨家水杯",description:"吨吨家水杯品牌官网,以匠心工艺打造每一只水杯,为不同场景精心打造高品质水杯产品。",keywords:"水杯,保温杯,品牌,品质生活,家居"}),c.jsx(Fj,{}),c.jsx("section",{className:"py-section",children:c.jsx(Wj,{})}),c.jsx("section",{className:"py-section",children:c.jsx(Kj,{})}),c.jsx("section",{className:"py-section bg-[#F1EBE0]",children:c.jsxs("div",{className:"max-w-[1200px] mx-auto px-6 lg:px-8",children:[c.jsx(VC,{"data-component-id":"home-products",title:"精选产品",headingLevel:"h2",pageSize:6}),c.jsx("div",{className:"text-center mt-8",children:c.jsx(Te,{to:"/products",className:"inline-block px-8 py-3 rounded-full border-2 border-brand text-brand hover:bg-brand hover:text-cream-warm transition-all duration-250",children:"查看全部产品"})})]})}),c.jsx("section",{className:"py-section",children:c.jsxs("div",{className:"max-w-[1200px] mx-auto px-6 lg:px-8",children:[c.jsx(BC,{"data-component-id":"home-articles",title:"最新资讯",headingLevel:"h2",pageSize:3}),c.jsx("div",{className:"text-center mt-8",children:c.jsx(Te,{to:"/articles",className:"inline-block text-[#C4703F] font-medium hover:underline transition-all duration-250",children:"查看全部文章"})})]})}),c.jsx("section",{className:"py-section",children:c.jsx(Qj,{})}),c.jsx("section",{className:"py-section",children:c.jsx(Ie,{children:c.jsx("div",{className:"max-w-[1200px] mx-auto px-6 lg:px-8",children:c.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-[55%_45%] gap-10 lg:gap-16 items-center",children:[c.jsx("div",{className:"order-2 md:order-1",children:c.jsx("img",{src:"https://baas-api.wanwang.xin/toc/image/preview/craftsman-polishing-cup-workshop.jpg?w=800&h=600&q=80",alt:"Craftsman polishing cup in workshop",className:"w-full h-auto rounded-xl"})}),c.jsxs("div",{className:"order-1 md:order-2",children:[c.jsx("span",{className:"inline-block text-sm tracking-widest uppercase text-[#2E5A4C] mb-4",children:"品牌理念"}),c.jsx("h2",{className:"font-serif text-3xl lg:text-4xl text-[#26302B] mb-6 leading-tight",children:"每一度温暖,都值得被认真对待"}),c.jsx("p",{className:"text-base text-[#6B7770] leading-relaxed mb-4",children:"我们相信,一只好的水杯不仅是容器,更是每天握在手里的生活仪式感。从材质选择到工艺打磨,每一步都倾注匠心。"}),c.jsx("p",{className:"text-base text-[#6B7770] leading-relaxed mb-8",children:"茶绿与暖铜的温润配色,源自杯中茶汤与温水的意象,传递天然安心与匠人手作的温度。"}),c.jsx(Te,{to:"/brand-story",className:"inline-block text-[#C4703F] font-medium hover:underline transition-all duration-250",children:"了解更多"})]})]})})})}),c.jsx("section",{className:"py-section bg-[#F1EBE0]",children:c.jsx(Ie,{children:c.jsxs("div",{className:"max-w-[640px] mx-auto px-6 text-center",children:[c.jsx("h2",{className:"font-serif text-4xl text-[#26302B] mb-4",children:"联系我们"}),c.jsx("p",{className:"text-base text-[#6B7770] mb-10",children:"期待与你的交流"}),c.jsx(M0,{compact:!0})]})})})]})}async function HC(e){const{data:t,error:r}=await Ke.rpc("create_order",{_org_id:e.org_id,p_product_id:e.product_id,p_quantity:e.quantity});if(r)throw r;return t}const WC=({product:e})=>{const{user:t}=Gs(),r=ry(),[n,s]=p.useState(!1),a=r.status==="ready",i=a&&Cu(r.access,"distributor"),o=a&&Cu(r.access,"vip_member"),l=a&&k2(r.access,"order","create"),u=()=>i&&e.distributor_price?`¥${e.distributor_price} (经销商价)`:o&&e.vip_price?`¥${e.vip_price} (会员价)`:e.price_range,d=async()=>{if(!t||!a){Be.error("请先登录");return}if(!l){Be.error("您没有下单权限");return}if(!e.distributor_price){Be.error("该产品未设置经销商价格");return}s(!0);try{await HC({org_id:r.access.rootOrg.id,product_id:e.id,quantity:1}),Be.success("下单成功")}catch{Be.error("下单失败,请稍后重试")}finally{s(!1)}};return c.jsxs("div",{className:"group rounded-card bg-cream border border-line overflow-hidden transition-all duration-300 hover:-translate-y-1.5 hover:shadow-card-hover",children:[c.jsx("div",{className:"aspect-[4/5] overflow-hidden",children:c.jsx("img",{src:e.image,alt:e.name,className:"w-full h-full object-cover transition-transform duration-400 group-hover:scale-103"})}),c.jsxs("div",{className:"p-5 space-y-3",children:[c.jsx("h3",{className:"font-serif text-xl text-ink",children:e.name}),c.jsx("p",{className:"text-sm text-ink-muted leading-relaxed",children:e.description}),c.jsx("p",{className:"font-serif text-copper text-base",children:u()}),c.jsxs("div",{className:"flex flex-wrap gap-2",children:[i&&l&&e.distributor_price?c.jsxs("button",{onClick:d,disabled:n,className:"inline-flex items-center gap-2 px-4 py-2 bg-brand text-white rounded-full text-sm font-medium transition-all duration-250 hover:bg-brand-deep disabled:opacity-60",children:[c.jsx(ek,{className:"text-xs"}),c.jsx("span",{children:n?"下单中...":"立即下单"})]}):c.jsx(Te,{to:`/contact?product=${encodeURIComponent(e.name)}`,className:"inline-flex items-center justify-center px-5 py-2.5 border-2 border-brand text-brand rounded-full text-sm font-medium transition-all duration-250 hover:bg-brand hover:text-white hover:shadow-cta-glow",children:"立即咨询"}),o&&c.jsxs(Te,{to:"/points",className:"inline-flex items-center gap-2 px-4 py-2.5 border-2 border-copper text-copper rounded-full text-sm font-medium transition-all duration-250 hover:bg-copper hover:text-white",children:[c.jsx(Ty,{className:"text-xs"}),c.jsx("span",{children:"积分兑换"})]})]})]})]})},qC=[{value:"",label:"全部"},{value:"business",label:"商务系列"},{value:"sports",label:"运动系列"},{value:"home",label:"家居系列"}];function GC(){const[e,t]=Fd(),r=e.get("series")||"",[n,s]=p.useState([]),[a,i]=p.useState(!0);p.useEffect(()=>{o()},[r]);const o=async()=>{i(!0);try{const l=r?await qj(r):await D0();s(l)}catch{Be.error("加载产品失败")}finally{i(!1)}};return c.jsxs(c.Fragment,{children:[c.jsx(er,{title:"产品中心 - 吨吨家水杯",description:"吨吨家水杯全系列产品展示,涵盖商务系列、运动系列、家居系列,为不同场景精心打造。",keywords:"水杯,保温杯,运动水壶,玻璃杯,产品"}),c.jsx("section",{className:"bg-cream-wheat py-section",children:c.jsxs("div",{className:"max-w-content mx-auto px-6 text-center",children:[c.jsx("h1",{className:"font-serif text-[40px] text-ink mb-3",children:"产品中心"}),c.jsx("p",{className:"text-ink-muted text-lg",children:"为每一个场景,精心准备"})]})}),c.jsx("section",{className:"sticky top-0 z-10 bg-cream-wheat border-b border-line",children:c.jsx("div",{className:"max-w-content mx-auto px-6 py-4",children:c.jsx("div",{className:"flex flex-wrap gap-3 justify-center",children:qC.map(l=>{const u=l.value===r;return c.jsx("button",{onClick:()=>{l.value?t({series:l.value}):t({})},className:`px-5 py-2 rounded-full text-sm font-medium transition-all duration-250 ${u?"bg-brand text-white":"border border-line text-ink-muted hover:border-brand hover:text-brand"}`,children:l.label},l.value)})})})}),c.jsx("section",{className:"py-section bg-cream-wheat",children:c.jsx("div",{className:"max-w-content mx-auto px-6",children:a?c.jsx("div",{className:"text-center py-12 text-ink-muted",children:"加载中..."}):n.length===0?c.jsx("div",{className:"text-center py-12 text-ink-muted",children:"暂无产品"}):c.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8",children:n.map((l,u)=>c.jsx(Ie,{delay:u,children:c.jsx(WC,{product:l})},l.id))})})})]})}function KC(){return c.jsxs("div",{className:"min-h-screen",children:[c.jsx(er,{title:"品牌故事 - 吨吨家水杯",description:"了解吨吨家水杯的品牌理念、工艺介绍、团队故事,感受匠心工艺与品质追求。",keywords:"品牌故事,匠心工艺,团队,水杯品牌"}),c.jsxs("section",{className:"bg-cream-wheat py-20 text-center",children:[c.jsx("h1",{className:"font-serif text-5xl text-brand-deep mb-4",children:"品牌故事"}),c.jsx("p",{className:"text-lg text-gray-600",children:"品质生活,从一杯开始"})]}),c.jsx("section",{className:"py-20 bg-white",children:c.jsx("div",{className:"max-w-6xl mx-auto px-6",children:c.jsx(Ie,{children:c.jsxs("div",{className:"grid md:grid-cols-2 gap-12 items-center",children:[c.jsx("div",{className:"order-2 md:order-1",children:c.jsx("img",{src:"https://baas-api.wanwang.xin/toc/image/preview/brand-origin-story-workshop.jpg?w=800&h=600&q=80",alt:"品牌起源",className:"rounded-xl w-full h-auto object-cover"})}),c.jsxs("div",{className:"order-1 md:order-2",children:[c.jsx("h2",{className:"font-serif text-3xl text-brand-deep mb-6",children:"品牌起源"}),c.jsx("p",{className:"text-gray-700 leading-relaxed mb-4",children:"吨吨家水杯创立于对品质生活的追求。我们相信,每一天的饮水体验都值得被认真对待。"}),c.jsx("p",{className:"text-gray-700 leading-relaxed",children:"从最初的灵感到第一只产品的诞生,我们始终坚持选用食品级材质,以匠心工艺打造每一只水杯,让温暖陪伴你的每一天。"})]})]})})})}),c.jsx("section",{className:"py-20 bg-brand-deep",children:c.jsxs("div",{className:"max-w-6xl mx-auto px-6",children:[c.jsx("h2",{className:"font-serif text-4xl text-ink-warm text-center mb-16",children:"匠心工艺"}),c.jsxs("div",{className:"grid md:grid-cols-3 gap-8 relative",children:[c.jsxs("div",{className:"relative",children:[c.jsxs("div",{className:"flex flex-col items-center text-center",children:[c.jsx("span",{className:"font-serif text-5xl text-copper mb-4",children:"01"}),c.jsx(XE,{className:"text-copper text-4xl mb-4"}),c.jsx("h3",{className:"text-ink-warm text-xl font-semibold mb-3",children:"材质选择"}),c.jsx("p",{className:"text-ink-warm-light text-sm leading-relaxed",children:"严选食品级316不锈钢、高硼硅玻璃等安全材质,从源头保障饮水健康"})]}),c.jsx("div",{className:"hidden md:block absolute top-1/2 right-0 w-px h-px border-r border-copper opacity-30 transform translate-x-1/2"})]}),c.jsxs("div",{className:"relative",children:[c.jsxs("div",{className:"flex flex-col items-center text-center",children:[c.jsx("span",{className:"font-serif text-5xl text-copper mb-4",children:"02"}),c.jsx(ZE,{className:"text-copper text-4xl mb-4"}),c.jsx("h3",{className:"text-ink-warm text-xl font-semibold mb-3",children:"生产工艺"}),c.jsx("p",{className:"text-ink-warm-light text-sm leading-relaxed",children:"精密制造工艺结合传统匠人技艺,每一道工序都经过严格把控"})]}),c.jsx("div",{className:"hidden md:block absolute top-1/2 right-0 w-px h-px border-r border-copper opacity-30 transform translate-x-1/2"})]}),c.jsx("div",{className:"relative",children:c.jsxs("div",{className:"flex flex-col items-center text-center",children:[c.jsx("span",{className:"font-serif text-5xl text-copper mb-4",children:"03"}),c.jsx(QE,{className:"text-copper text-4xl mb-4"}),c.jsx("h3",{className:"text-ink-warm text-xl font-semibold mb-3",children:"质检流程"}),c.jsx("p",{className:"text-ink-warm-light text-sm leading-relaxed",children:"多重质检环节确保每只水杯符合标准,让用户用得安心放心"})]})})]})]})}),c.jsx("section",{className:"py-20 bg-cream",children:c.jsxs("div",{className:"max-w-6xl mx-auto px-6",children:[c.jsx("h2",{className:"font-serif text-4xl text-brand-deep text-center mb-16",children:"我们的团队"}),c.jsx("div",{className:"grid md:grid-cols-3 gap-8",children:Vj.map(e=>c.jsx(Ie,{children:c.jsxs("div",{className:"bg-white rounded-xl overflow-hidden shadow-sm hover:shadow-md transition-shadow duration-300",children:[c.jsx("div",{className:"aspect-square overflow-hidden",children:c.jsx("img",{src:e.avatar,alt:e.name,className:"w-full h-full object-cover grayscale hover:grayscale-0 transition-all duration-300 rounded-t-xl"})}),c.jsxs("div",{className:"p-6",children:[c.jsx("h3",{className:"font-serif text-xl text-brand-deep mb-1",children:e.name}),c.jsx("p",{className:"text-copper text-sm mb-3",children:e.role}),c.jsx("p",{className:"text-gray-600 text-sm leading-relaxed",children:e.bio})]})]})},e.id))})]})}),c.jsx("section",{className:"py-20 bg-cream-wheat",children:c.jsxs("div",{className:"max-w-4xl mx-auto px-6",children:[c.jsx("h2",{className:"font-serif text-4xl text-brand-deep text-center mb-16",children:"发展历程"}),c.jsxs("div",{className:"relative",children:[c.jsx("div",{className:"absolute left-1/2 transform -translate-x-1/2 w-0.5 h-full bg-brand"}),Bj.map((e,t)=>c.jsx(Ie,{children:c.jsxs("div",{className:`relative flex items-center mb-12 ${t%2===0?"md:flex-row":"md:flex-row-reverse"}`,children:[c.jsx("div",{className:"absolute left-1/2 transform -translate-x-1/2 w-4 h-4 rounded-full bg-copper z-10"}),c.jsxs("div",{className:`md:w-5/12 ${t%2===0?"md:pr-12 md:text-right":"md:pl-12 md:text-left"}`,children:[c.jsx("h3",{className:"font-serif text-2xl text-brand-deep mb-2",children:e.year}),c.jsx("h4",{className:"text-lg font-semibold text-gray-800 mb-2",children:e.title}),c.jsx("p",{className:"text-gray-600 text-sm leading-relaxed",children:e.description})]}),c.jsx("div",{className:"md:w-5/12"})]})},e.year))]})]})}),c.jsxs("section",{className:"py-20 bg-white text-center",children:[c.jsx("h2",{className:"font-serif text-4xl text-brand-deep mb-8",children:"与我们同行"}),c.jsx(Te,{to:"/contact",className:"inline-block bg-copper text-white px-8 py-3 rounded-full font-medium hover:bg-opacity-90 transition-colors duration-300",children:"联系我们"})]})]})}const QC=()=>c.jsxs("div",{className:"min-h-screen",children:[c.jsx(er,{title:"客户案例 - 吨吨家水杯",description:"查看吨吨家水杯用户的真实评价与使用场景,了解合作伙伴与媒体报道。",keywords:"客户案例,用户评价,合作伙伴,水杯评价"}),c.jsxs("section",{className:"bg-cream-wheat py-20 text-center",children:[c.jsx("h1",{className:"font-serif text-[40px] text-ink mb-3",children:"客户案例"}),c.jsx("p",{className:"text-ink-muted text-lg",children:"听听他们怎么说"})]}),c.jsx("section",{className:"bg-cream py-20",children:c.jsxs("div",{className:"max-w-[1200px] mx-auto px-5 md:px-8 lg:px-10",children:[c.jsx(Ie,{children:c.jsx("h2",{className:"font-serif text-[32px] text-ink mb-12 text-center",children:"用户心声"})}),c.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:I0.map((e,t)=>c.jsx(Ie,{delay:t,children:c.jsx($0,{item:e,variant:"light"})},e.id))})]})}),c.jsx("section",{className:"bg-cream-wheat py-20",children:c.jsxs("div",{className:"max-w-[1200px] mx-auto px-5 md:px-8 lg:px-10",children:[c.jsx(Ie,{children:c.jsx("h2",{className:"font-serif text-[32px] text-ink mb-12 text-center",children:"合作伙伴"})}),c.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-5 gap-8 items-center justify-items-center",children:z0.map((e,t)=>c.jsx(Ie,{delay:t,children:c.jsx("div",{className:"flex justify-center",children:c.jsx("img",{src:e.logo,alt:e.name,className:"h-16 object-contain opacity-55 transition-opacity duration-300 hover:opacity-100 grayscale hover:grayscale-0"})})},e.id))})]})}),c.jsx("section",{className:"bg-cream py-20",children:c.jsxs("div",{className:"max-w-[1200px] mx-auto px-5 md:px-8 lg:px-10",children:[c.jsx(Ie,{children:c.jsx("h2",{className:"font-serif text-[32px] text-ink mb-12 text-center",children:"使用场景"})}),c.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[c.jsx(Ie,{delay:0,children:c.jsxs("div",{className:"relative aspect-[16/10] rounded-card overflow-hidden group cursor-pointer",children:[c.jsx("img",{src:"https://baas-api.wanwang.xin/toc/image/preview/office-scene-cup-desk.jpg?w=600&h=375&q=80",alt:"办公室场景",className:"w-full h-full object-cover transition-transform duration-400 group-hover:scale-105"}),c.jsx("div",{className:"absolute inset-0 bg-brand-deep/0 group-hover:bg-brand-deep/30 transition-colors duration-300 flex items-end justify-center pb-6",children:c.jsx("span",{className:"text-ink-warm font-serif text-xl opacity-0 group-hover:opacity-100 transition-opacity duration-300",children:"办公室"})})]})}),c.jsx(Ie,{delay:1,children:c.jsxs("div",{className:"relative aspect-[16/10] rounded-card overflow-hidden group cursor-pointer",children:[c.jsx("img",{src:"https://baas-api.wanwang.xin/toc/image/preview/outdoor-scene-water-bottle-nature.jpg?w=600&h=375&q=80",alt:"户外场景",className:"w-full h-full object-cover transition-transform duration-400 group-hover:scale-105"}),c.jsx("div",{className:"absolute inset-0 bg-brand-deep/0 group-hover:bg-brand-deep/30 transition-colors duration-300 flex items-end justify-center pb-6",children:c.jsx("span",{className:"text-ink-warm font-serif text-xl opacity-0 group-hover:opacity-100 transition-opacity duration-300",children:"户外"})})]})}),c.jsx(Ie,{delay:2,children:c.jsxs("div",{className:"relative aspect-[16/10] rounded-card overflow-hidden group cursor-pointer",children:[c.jsx("img",{src:"https://baas-api.wanwang.xin/toc/image/preview/home-scene-cup-kitchen.jpg?w=600&h=375&q=80",alt:"家居场景",className:"w-full h-full object-cover transition-transform duration-400 group-hover:scale-105"}),c.jsx("div",{className:"absolute inset-0 bg-brand-deep/0 group-hover:bg-brand-deep/30 transition-colors duration-300 flex items-end justify-center pb-6",children:c.jsx("span",{className:"text-ink-warm font-serif text-xl opacity-0 group-hover:opacity-100 transition-opacity duration-300",children:"家居"})})]})})]})]})}),c.jsx("section",{className:"bg-brand-deep py-20 text-center",children:c.jsx("div",{className:"max-w-[1200px] mx-auto px-5 md:px-8 lg:px-10",children:c.jsxs(Ie,{children:[c.jsx("h2",{className:"font-serif text-[32px] text-ink-warm mb-8",children:"成为我们的用户"}),c.jsx(Te,{to:"/contact",className:"inline-block bg-copper text-white px-8 py-3 rounded-full text-lg font-medium hover:bg-copper-dark transition-all duration-250 hover:shadow-[0_4px_16px_rgba(196,112,63,0.35)] active:scale-[0.98]",children:"联系我们"})]})})})]});async function YC(){const{data:e,error:t}=await Ke.from("messages_public").select("*").order("created_at",{ascending:!1});if(t)throw t;return(e||[]).map(r=>({id:r.id,user_id:r.user_id,content:r.content,status:r.status,is_deleted:r.is_deleted,created_at:r.created_at,updated_at:r.updated_at,profiles:r.profile_full_name||r.profile_avatar_url?{full_name:r.profile_full_name,avatar_url:r.profile_avatar_url}:null}))}async function JC(e){const{data:{user:t}}=await Ke.auth.getUser();if(!t)throw new Error("User must be logged in to create a message");const{data:r,error:n}=await Ke.from("messages").insert({...e,user_id:t.id}).select().single();if(n)throw n;return r}function XC(){const{user:e,loading:t}=Gs(),[r,n]=p.useState(!1),[s,a]=p.useState(!1),[i,o]=p.useState(""),[l,u]=p.useState([]),[d,f]=p.useState(!0),[h,m]=p.useState(!1);p.useEffect(()=>{x()},[]);const x=async()=>{f(!0);try{const g=await YC();u(g)}catch{Be.error("加载留言失败")}finally{f(!1)}},v=async()=>{if(i.trim()&&e){m(!0);try{await JC({content:i}),o(""),a(!1),Be.success("留言提交成功,审核通过后将展示"),x()}catch{Be.error("留言提交失败,请稍后重试")}finally{m(!1)}}},_=()=>{var g;return e?e.nickname||((g=e.email)==null?void 0:g.split("@")[0])||"用户":""},y=()=>e?e.avatar_url||"https://baas-api.wanwang.xin/toc/image/preview/default-user-avatar.jpg?w=96&h=96&q=80":"";return c.jsxs(c.Fragment,{children:[c.jsx(er,{title:"联系我们 - 吨吨家水杯",description:"联系吨吨家水杯,提交咨询表单或留言,我们期待与你的交流。",keywords:"联系我们,咨询,留言,客服"}),c.jsxs("div",{className:"min-h-screen bg-cream",children:[c.jsx("section",{className:"bg-cream-wheat py-20",children:c.jsxs("div",{className:"max-w-6xl mx-auto px-6 text-center",children:[c.jsx("h1",{className:"font-serif text-[40px] text-ink mb-4 tracking-wide",children:"联系我们"}),c.jsx("p",{className:"text-ink-muted text-lg",children:"期待与你的交流"})]})}),c.jsx("section",{className:"py-20 bg-cream",children:c.jsx("div",{className:"max-w-6xl mx-auto px-6",children:c.jsxs("div",{className:"flex flex-col lg:flex-row gap-12",children:[c.jsx("div",{className:"lg:w-[60%]",children:c.jsx(M0,{title:"咨询表单",compact:!1})}),c.jsx("div",{className:"lg:w-[40%]",children:c.jsxs("div",{className:"bg-cream border border-line rounded-card p-8 space-y-6",children:[c.jsxs("div",{className:"flex items-start gap-4",children:[c.jsx(Ry,{className:"text-brand text-xl mt-1 flex-shrink-0"}),c.jsxs("div",{children:[c.jsx("p",{className:"text-sm text-ink-muted mb-1",children:"客服电话"}),c.jsx("p",{className:"text-ink font-medium",children:"400-888-9999"})]})]}),c.jsxs("div",{className:"flex items-start gap-4",children:[c.jsx(Ny,{className:"text-brand text-xl mt-1 flex-shrink-0"}),c.jsxs("div",{children:[c.jsx("p",{className:"text-sm text-ink-muted mb-1",children:"邮箱"}),c.jsx("p",{className:"text-ink font-medium",children:"service@dundunjia.com"})]})]}),c.jsxs("div",{className:"flex items-start gap-4",children:[c.jsx(JE,{className:"text-brand text-xl mt-1 flex-shrink-0"}),c.jsxs("div",{children:[c.jsx("p",{className:"text-sm text-ink-muted mb-1",children:"工作时间"}),c.jsx("p",{className:"text-ink font-medium",children:"周一至周五 9:00-18:00"})]})]})]})})]})})}),c.jsx("section",{className:"bg-cream-wheat py-20",children:c.jsx("div",{className:"max-w-4xl mx-auto px-6",children:c.jsxs(Ie,{children:[c.jsx("h2",{className:"font-serif text-3xl text-ink mb-8 text-center",children:"用户留言"}),c.jsx("div",{className:"mb-8",children:t?c.jsx("div",{className:"text-ink-muted text-center py-4",children:"加载中..."}):e?c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("img",{src:y(),alt:_(),className:"w-10 h-10 rounded-full object-cover"}),c.jsx("span",{className:"text-ink font-medium",children:_()})]}),s?null:c.jsx("button",{onClick:()=>a(!0),className:"inline-flex items-center gap-2 bg-copper text-white px-5 py-2 rounded-full hover:bg-copper-dark transition-all duration-250 text-sm",children:c.jsx("span",{children:"写留言"})})]}),s&&c.jsxs("div",{className:"bg-cream border border-line rounded-card p-6 space-y-4",children:[c.jsx("textarea",{placeholder:"写下你的留言...",value:i,onChange:g=>o(g.target.value),rows:4,className:"w-full bg-cream-wheat border border-line rounded-card px-4 py-3 text-ink placeholder:text-ink-muted focus:outline-none focus:border-brand focus:shadow-focus-ring resize-none"}),c.jsxs("div",{className:"flex gap-3",children:[c.jsx("button",{onClick:v,disabled:!i.trim()||h,className:"bg-copper text-white px-6 py-2 rounded-full hover:bg-copper-dark transition-all duration-250 disabled:opacity-60 disabled:cursor-not-allowed",children:h?"提交中...":"提交留言"}),c.jsx("button",{onClick:()=>{a(!1),o("")},className:"border border-line text-ink-muted px-6 py-2 rounded-full hover:bg-cream-wheat transition-all duration-250",children:"取消"})]})]})]}):c.jsxs("button",{onClick:()=>n(!0),className:"inline-flex items-center gap-2 bg-copper text-white px-6 py-3 rounded-full hover:bg-copper-dark transition-all duration-250",children:[c.jsx(Wo,{className:"text-sm"}),c.jsx("span",{children:"登录后留言"})]})}),c.jsx("div",{className:"space-y-4",children:d?c.jsx("div",{className:"text-ink-muted text-center py-8",children:"加载留言中..."}):l.length===0?c.jsx("div",{className:"text-ink-muted text-center py-8",children:"暂无留言,成为第一个留言的人吧"}):l.map(g=>{var w,E,C;return c.jsx("div",{className:"bg-cream border border-line rounded-card p-6",children:c.jsxs("div",{className:"flex gap-4",children:[c.jsx("img",{src:((w=g.profiles)==null?void 0:w.avatar_url)||"https://baas-api.wanwang.xin/toc/image/preview/default-user-avatar.jpg?w=96&h=96&q=80",alt:((E=g.profiles)==null?void 0:E.full_name)||"用户",className:"w-12 h-12 rounded-full object-cover flex-shrink-0"}),c.jsxs("div",{className:"flex-1",children:[c.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[c.jsx("span",{className:"text-ink font-medium",children:((C=g.profiles)==null?void 0:C.full_name)||"用户"}),c.jsx("span",{className:"text-ink-muted text-sm",children:new Date(g.created_at).toLocaleDateString("zh-CN")})]}),c.jsx("p",{className:"text-ink leading-relaxed",children:g.content})]})]})},g.id)})})]})})})]}),c.jsx(A0,{isOpen:r,onClose:()=>n(!1)})]})}async function ZC(){const{data:e,error:t}=await Ke.from("points").select("*").eq("is_deleted",!1).maybeSingle();if(t)throw t;return e}async function e3(e,t){const{data:r,error:n}=await Ke.rpc("redeem_points",{p_user_id:e,p_amount:t});if(n)throw n;return r}function t3(){const{user:e}=Gs(),t=ry(),[r,n]=p.useState(0),[s,a]=p.useState(!0),[i,o]=p.useState(!1),[l,u]=p.useState(""),f=t.status==="ready"&&Cu(t.access,"vip_member");p.useEffect(()=>{e&&h()},[e]);const h=async()=>{a(!0);try{const x=await ZC();n((x==null?void 0:x.points)||0)}catch{Be.error("加载积分失败")}finally{a(!1)}},m=async()=>{const x=parseInt(l);if(!x||x<=0){Be.error("请输入有效的兑换数量");return}if(x>r){Be.error("积分不足");return}if(!e){Be.error("请先登录");return}o(!0);try{await e3(e.id,x),Be.success("兑换成功"),u(""),h()}catch{Be.error("兑换失败,请稍后重试")}finally{o(!1)}};return e?f?c.jsxs(c.Fragment,{children:[c.jsx(er,{title:"积分中心 - 吨吨家水杯",description:"VIP 会员积分兑换中心",keywords:"积分,兑换,VIP,会员"}),c.jsxs("div",{className:"min-h-screen bg-cream",children:[c.jsx("section",{className:"bg-cream-wheat py-section",children:c.jsxs("div",{className:"max-w-4xl mx-auto px-6 text-center",children:[c.jsx("h1",{className:"font-serif text-[40px] text-ink mb-4",children:"积分中心"}),c.jsx("p",{className:"text-ink-muted text-lg",children:"VIP 会员专属积分兑换"})]})}),c.jsx("section",{className:"py-16 bg-cream",children:c.jsx("div",{className:"max-w-4xl mx-auto px-6",children:c.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:[c.jsxs("div",{className:"bg-cream border border-line rounded-card p-8 text-center",children:[c.jsx(Np,{className:"text-5xl text-copper mx-auto mb-4"}),c.jsx("p",{className:"text-ink-muted text-sm mb-2",children:"当前积分"}),s?c.jsx("p",{className:"text-3xl font-serif text-ink",children:"加载中..."}):c.jsx("p",{className:"text-5xl font-serif text-copper",children:r})]}),c.jsxs("div",{className:"bg-cream border border-line rounded-card p-8",children:[c.jsxs("h2",{className:"font-serif text-2xl text-ink mb-6 flex items-center gap-3",children:[c.jsx(Ty,{className:"text-copper"}),"积分兑换"]}),c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm text-ink-muted mb-2",children:"兑换数量"}),c.jsx("input",{type:"number",value:l,onChange:x=>u(x.target.value),placeholder:"请输入兑换数量",min:"1",max:r,className:"w-full bg-cream-wheat border border-line rounded-card px-4 py-3 text-ink placeholder:text-ink-muted focus:outline-none focus:border-brand focus:shadow-focus-ring transition-all duration-200"})]}),c.jsx("button",{onClick:m,disabled:i||!l,className:"w-full bg-copper text-white font-medium py-3 rounded-card hover:bg-copper-dark hover:shadow-cta-glow transition-all duration-250 disabled:opacity-60 disabled:cursor-not-allowed",children:i?"兑换中...":"立即兑换"}),c.jsxs("p",{className:"text-sm text-ink-muted text-center",children:["可用积分:",r]})]})]})]})})})]})]}):c.jsxs(c.Fragment,{children:[c.jsx(er,{title:"积分中心 - 吨吨家水杯",description:"VIP 会员积分兑换中心",keywords:"积分,兑换,VIP,会员"}),c.jsx("div",{className:"min-h-screen bg-cream flex items-center justify-center",children:c.jsxs("div",{className:"text-center max-w-md mx-auto px-6",children:[c.jsx(Np,{className:"text-6xl text-copper mx-auto mb-6"}),c.jsx("h1",{className:"font-serif text-3xl text-ink mb-4",children:"积分中心"}),c.jsx("p",{className:"text-ink-muted",children:"积分兑换功能仅对 VIP 会员开放。如需成为 VIP 会员,请联系我们。"})]})})]}):c.jsxs(c.Fragment,{children:[c.jsx(er,{title:"积分中心 - 吨吨家水杯",description:"VIP 会员积分兑换中心",keywords:"积分,兑换,VIP,会员"}),c.jsx("div",{className:"min-h-screen bg-cream flex items-center justify-center",children:c.jsx("div",{className:"text-center",children:c.jsx("p",{className:"text-ink-muted text-lg mb-4",children:"请先登录查看积分"})})})]})}async function r3(){const{data:e,error:t}=await Ke.from("articles").select("*").eq("status","published").eq("is_deleted",!1).order("published_at",{ascending:!1});if(t)throw t;return e||[]}async function n3(e){if(!e)return null;const{data:t,error:r}=await Ke.from("articles").select("*").eq("slug",e).eq("status","published").eq("is_deleted",!1).maybeSingle();if(r)throw r;return t}async function s3(e){if(!e)return[];const{data:t,error:r}=await Ke.from("articles").select("*").eq("category",e).eq("status","published").eq("is_deleted",!1).order("published_at",{ascending:!1});if(r)throw r;return t||[]}const a3=[{value:"",label:"全部"},{value:"brand_news",label:"品牌动态"},{value:"industry",label:"行业资讯"},{value:"product_knowledge",label:"产品知识"}],i3={brand_news:"品牌动态",industry:"行业资讯",product_knowledge:"产品知识"};function o3(e){return e?new Date(e).toLocaleDateString("zh-CN",{year:"numeric",month:"long",day:"numeric"}):""}function l3(){const[e,t]=Fd(),r=e.get("category")||"",[n,s]=p.useState([]),[a,i]=p.useState(!0);p.useEffect(()=>{o()},[r]);const o=async()=>{i(!0);try{const l=r?await s3(r):await r3();s(l)}catch{Be.error("加载文章失败")}finally{i(!1)}};return c.jsxs(c.Fragment,{children:[c.jsx(er,{title:"新闻中心 - 吨吨家水杯",description:"了解吨吨家水杯的品牌动态、行业资讯和产品知识,探索品质生活从这里开始。",keywords:"新闻,品牌动态,行业资讯,产品知识,水杯"}),c.jsx("section",{className:"bg-cream-wheat py-section",children:c.jsxs("div",{className:"max-w-6xl mx-auto px-6 text-center",children:[c.jsx("h1",{className:"font-serif text-[40px] text-ink mb-3 tracking-wide",children:"新闻中心"}),c.jsx("p",{className:"text-ink-muted text-lg",children:"品牌动态、行业资讯与产品知识分享"})]})}),c.jsx("section",{className:"sticky top-0 z-10 bg-cream-wheat border-b border-line",children:c.jsx("div",{className:"max-w-6xl mx-auto px-6 py-4",children:c.jsx("div",{className:"flex flex-wrap gap-3 justify-center",children:a3.map(l=>{const u=l.value===r;return c.jsx("button",{onClick:()=>{l.value?t({category:l.value}):t({})},className:`px-5 py-2 rounded-full text-sm font-medium transition-all duration-250 ${u?"bg-brand text-white":"border border-line text-ink-muted hover:border-brand hover:text-brand"}`,children:l.label},l.value)})})})}),c.jsx("section",{className:"py-section bg-cream",children:c.jsx("div",{className:"max-w-6xl mx-auto px-6",children:a?c.jsx("div",{className:"text-center py-12 text-ink-muted",children:"加载中..."}):n.length===0?c.jsx("div",{className:"text-center py-12 text-ink-muted",children:"暂无文章"}):c.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8",children:n.map((l,u)=>c.jsx(Ie,{delay:u,children:c.jsxs(Te,{to:`/news/${l.slug}`,className:"group block rounded-card bg-cream border border-line overflow-hidden transition-all duration-300 hover:-translate-y-1.5 hover:shadow-card-hover",children:[l.cover_image&&c.jsx("div",{className:"aspect-[16/9] overflow-hidden",children:c.jsx("img",{src:l.cover_image,alt:l.title,className:"w-full h-full object-cover transition-transform duration-400 group-hover:scale-103"})}),c.jsxs("div",{className:"p-5 space-y-3",children:[l.category&&c.jsx("span",{className:"inline-block text-xs px-3 py-1 rounded-full bg-copper-light/30 text-copper font-medium",children:i3[l.category]||l.category}),c.jsx("h3",{className:"font-serif text-xl text-ink leading-snug group-hover:text-copper transition-colors duration-250",children:l.title}),l.excerpt&&c.jsx("p",{className:"text-sm text-ink-muted leading-relaxed line-clamp-2",children:l.excerpt}),c.jsxs("div",{className:"flex items-center justify-between text-xs text-ink-muted pt-2",children:[c.jsxs("div",{className:"flex items-center gap-3",children:[l.published_at&&c.jsxs("span",{className:"flex items-center gap-1",children:[c.jsx(Cy,{className:"text-[10px]"}),o3(l.published_at)]}),l.view_count!=null&&l.view_count>0&&c.jsxs("span",{className:"flex items-center gap-1",children:[c.jsx(Py,{className:"text-[10px]"}),l.view_count]})]}),c.jsxs("span",{className:"flex items-center gap-1 text-copper opacity-0 group-hover:opacity-100 transition-opacity duration-250",children:["阅读 ",c.jsx(KE,{className:"text-[10px]"})]})]})]})]})},l.id))})})})]})}const lm={brand_news:"品牌动态",industry:"行业资讯",product_knowledge:"产品知识"};function c3(e){return e?new Date(e).toLocaleDateString("zh-CN",{year:"numeric",month:"long",day:"numeric"}):""}function u3(){const{slug:e}=Dv(),[t,r]=p.useState(null),[n,s]=p.useState(!0),[a,i]=p.useState(!1);p.useEffect(()=>{if(!e){i(!0),s(!1);return}o()},[e]);const o=async()=>{s(!0);try{const l=await n3(e);l?r(l):i(!0)}catch{Be.error("加载文章失败"),i(!0)}finally{s(!1)}};return n?c.jsx("div",{className:"min-h-screen bg-cream flex items-center justify-center",children:c.jsx("p",{className:"text-ink-muted",children:"加载中..."})}):a||!t?c.jsxs(c.Fragment,{children:[c.jsx(er,{title:"文章未找到 - 吨吨家水杯",description:"文章不存在或已被删除",keywords:"新闻"}),c.jsx("div",{className:"min-h-screen bg-cream flex items-center justify-center",children:c.jsxs("div",{className:"text-center",children:[c.jsx("h1",{className:"font-serif text-3xl text-ink mb-4",children:"文章未找到"}),c.jsx("p",{className:"text-ink-muted mb-6",children:"该文章不存在或已被删除"}),c.jsxs(Te,{to:"/news",className:"inline-flex items-center gap-2 text-copper hover:text-copper-dark transition-colors",children:[c.jsx(Cp,{className:"text-sm"}),"返回新闻中心"]})]})})]}):c.jsxs(c.Fragment,{children:[c.jsx(er,{title:`${t.title} - 吨吨家水杯`,description:t.excerpt||t.title,keywords:`新闻,${t.category&&lm[t.category]||""},${t.title}`}),c.jsxs("article",{className:"min-h-screen bg-cream",children:[c.jsx("section",{className:"bg-cream-wheat pt-28 pb-12",children:c.jsxs("div",{className:"max-w-3xl mx-auto px-6",children:[c.jsxs(Te,{to:"/news",className:"inline-flex items-center gap-2 text-ink-muted hover:text-copper transition-colors mb-8 text-sm",children:[c.jsx(Cp,{className:"text-xs"}),"返回新闻中心"]}),t.category&&c.jsx("span",{className:"inline-block text-xs px-3 py-1 rounded-full bg-copper-light/30 text-copper font-medium mb-4",children:lm[t.category]||t.category}),c.jsx("h1",{className:"font-serif text-3xl md:text-4xl text-ink leading-snug mb-6",children:t.title}),c.jsxs("div",{className:"flex items-center gap-4 text-sm text-ink-muted",children:[t.published_at&&c.jsxs("span",{className:"flex items-center gap-1.5",children:[c.jsx(Cy,{className:"text-xs"}),c3(t.published_at)]}),t.author&&c.jsxs("span",{className:"flex items-center gap-1.5",children:[c.jsx(Wo,{className:"text-xs"}),t.author]}),t.view_count!=null&&t.view_count>0&&c.jsxs("span",{className:"flex items-center gap-1.5",children:[c.jsx(Py,{className:"text-xs"}),t.view_count," 次阅读"]})]})]})}),t.cover_image&&c.jsx("section",{className:"max-w-4xl mx-auto px-6 -mt-4",children:c.jsx("div",{className:"rounded-card overflow-hidden shadow-card",children:c.jsx("img",{src:t.cover_image,alt:t.title,className:"w-full aspect-[16/9] object-cover"})})}),c.jsxs("section",{className:"max-w-3xl mx-auto px-6 py-12",children:[t.excerpt&&c.jsx("div",{className:"mb-8 p-6 bg-cream-wheat rounded-card border-l-4 border-copper",children:c.jsx("p",{className:"text-ink leading-relaxed italic",children:t.excerpt})}),c.jsx("div",{className:"article-content text-ink",style:{lineHeight:"1.9"},dangerouslySetInnerHTML:{__html:t.content||""}})]}),c.jsx("section",{className:"bg-cream-wheat py-12",children:c.jsxs("div",{className:"max-w-3xl mx-auto px-6 text-center",children:[c.jsx("p",{className:"text-ink-muted mb-6",children:"想了解更多产品信息?"}),c.jsx(Te,{to:"/products",className:"inline-flex items-center gap-2 bg-copper text-white px-8 py-3 rounded-full hover:bg-copper-dark hover:shadow-cta-glow transition-all duration-250",children:"探索产品"})]})})]})]})}function we(){const e=mi(Bv(),"SITE_ADMIN_ROUTE_FAILED");return c.jsx(La,{status:"error",error:e,"data-route-state":"error"})}function be(){return c.jsx(La,{status:"loading","data-route-state":"loading"})}const d3=p.lazy(()=>ce(()=>import("./AdminLayoutRoute-C0zEWHIS.js"),__vite__mapDeps([0,1,2,3,4]))),f3=p.lazy(()=>ce(()=>import("./DashboardRoute-CsBHb-0G.js"),__vite__mapDeps([5,1,2,3,4]))),h3=p.lazy(()=>ce(()=>import("./ForbiddenRoute-DzAkFWyF.js"),__vite__mapDeps([6,2,1,3,4]))),p3=p.lazy(()=>ce(()=>import("./RbacLayoutRoute-D4LSK8JY.js"),__vite__mapDeps([7,1,8,2,3,4]))),m3=p.lazy(()=>ce(()=>import("./RbacRolesRoute-DeUeTzgP.js"),__vite__mapDeps([9,1,8,2,3,4]))),g3=p.lazy(()=>ce(()=>import("./RbacPermissionsRoute-CDPcgUdH.js"),__vite__mapDeps([10,1,8,2,3,4]))),v3=p.lazy(()=>ce(()=>import("./RbacMembersRoute-g0X_GCqo.js"),__vite__mapDeps([11,1,8,2,3,4]))),y3=p.lazy(()=>ce(()=>import("./LoginRoute-Bi7628aN.js"),__vite__mapDeps([12,3]))),x3=p.lazy(()=>ce(()=>import("./LoginRoute-DznSLwQF.js"),__vite__mapDeps([13,3]))),w3=p.lazy(()=>ce(()=>import("./AccountRoute-J4AR9dBa.js"),__vite__mapDeps([14,3]))),b3=p.lazy(()=>ce(()=>import("./ListRoute-tsOSySGE.js"),__vite__mapDeps([15,1,16,17,18]))),_3=p.lazy(()=>ce(()=>import("./CreateRoute-Cg9nLp0s.js"),__vite__mapDeps([19,1,20,21,17,22,4,23]))),S3=p.lazy(()=>ce(()=>import("./EditRoute-CioIuFdG.js"),__vite__mapDeps([24,1,20,21,17,22,4,23]))),E3=p.lazy(()=>ce(()=>import("./ListRoute-DXalgo6r.js"),__vite__mapDeps([25,1,23,16,17]))),k3=p.lazy(()=>ce(()=>import("./CreateRoute-CXdZ9OWz.js"),__vite__mapDeps([26,1,27,23,28,21,17,22,4]))),j3=p.lazy(()=>ce(()=>import("./EditRoute-B0irqUJb.js"),__vite__mapDeps([29,1,27,23,28,21,17,22,4]))),C3=p.lazy(()=>ce(()=>import("./ListRoute-FYCjsMH4.js"),__vite__mapDeps([30,31,32,33,23]))),N3=p.lazy(()=>ce(()=>import("./CategoryRoute-CjEmgNFo.js"),__vite__mapDeps([34,31,32,33,23]))),P3=p.lazy(()=>ce(()=>import("./DetailRoute-2wJzg08C.js"),__vite__mapDeps([35,36,22]))),T3=p.lazy(()=>ce(()=>import("./ListRoute-BXK-lxKl.js"),__vite__mapDeps([37,1,16,17,18]))),R3=p.lazy(()=>ce(()=>import("./CreateRoute-DqLnkhJC.js"),__vite__mapDeps([38,1,39,21,17,22,4,32]))),O3=p.lazy(()=>ce(()=>import("./EditRoute-DJaJHVL8.js"),__vite__mapDeps([40,1,39,21,17,22,4,32]))),A3=p.lazy(()=>ce(()=>import("./ListRoute-DG3qb5v2.js"),__vite__mapDeps([41,1,32,16,17]))),z3=p.lazy(()=>ce(()=>import("./CreateRoute-D4lpSbxk.js"),__vite__mapDeps([42,1,43,32,28,21,17,22,4]))),I3=p.lazy(()=>ce(()=>import("./EditRoute-PUxL_K-L.js"),__vite__mapDeps([44,1,43,32,28,21,17,22,4]))),L3=p.lazy(()=>ce(()=>import("./ListRoute-B8OMGh0W.js"),__vite__mapDeps([45,31,32]))),D3=p.lazy(()=>ce(()=>import("./CategoryRoute-zDzuW-7M.js"),__vite__mapDeps([46,31,32]))),$3=p.lazy(()=>ce(()=>import("./DetailRoute-D0zM4C2y.js"),__vite__mapDeps([47,36,22]))),M3=[{path:"/admin",element:c.jsx(p.Suspense,{fallback:c.jsx(be,{}),children:c.jsx(d3,{})}),errorElement:c.jsx(we,{}),children:[{index:!0,element:c.jsx(p.Suspense,{fallback:c.jsx(be,{}),children:c.jsx(f3,{})}),errorElement:c.jsx(we,{})},{path:"rbac",element:c.jsx(p.Suspense,{fallback:c.jsx(be,{}),children:c.jsx(p3,{})}),errorElement:c.jsx(we,{}),children:[{path:"roles",element:c.jsx(p.Suspense,{fallback:c.jsx(be,{}),children:c.jsx(m3,{})}),errorElement:c.jsx(we,{})},{path:"permission",element:c.jsx(p.Suspense,{fallback:c.jsx(be,{}),children:c.jsx(g3,{})}),errorElement:c.jsx(we,{})},{path:"members",element:c.jsx(p.Suspense,{fallback:c.jsx(be,{}),children:c.jsx(v3,{})}),errorElement:c.jsx(we,{})}]},{path:"posts",element:c.jsx(p.Suspense,{fallback:c.jsx(be,{}),children:c.jsx(b3,{})}),errorElement:c.jsx(we,{})},{path:"posts/new",element:c.jsx(p.Suspense,{fallback:c.jsx(be,{}),children:c.jsx(_3,{})}),errorElement:c.jsx(we,{})},{path:"posts/:recordId",element:c.jsx(p.Suspense,{fallback:c.jsx(be,{}),children:c.jsx(S3,{})}),errorElement:c.jsx(we,{})},{path:"post_categories",element:c.jsx(p.Suspense,{fallback:c.jsx(be,{}),children:c.jsx(E3,{})}),errorElement:c.jsx(we,{})},{path:"post_categories/new",element:c.jsx(p.Suspense,{fallback:c.jsx(be,{}),children:c.jsx(k3,{})}),errorElement:c.jsx(we,{})},{path:"post_categories/:recordId",element:c.jsx(p.Suspense,{fallback:c.jsx(be,{}),children:c.jsx(j3,{})}),errorElement:c.jsx(we,{})},{path:"products",element:c.jsx(p.Suspense,{fallback:c.jsx(be,{}),children:c.jsx(T3,{})}),errorElement:c.jsx(we,{})},{path:"products/new",element:c.jsx(p.Suspense,{fallback:c.jsx(be,{}),children:c.jsx(R3,{})}),errorElement:c.jsx(we,{})},{path:"products/:recordId",element:c.jsx(p.Suspense,{fallback:c.jsx(be,{}),children:c.jsx(O3,{})}),errorElement:c.jsx(we,{})},{path:"product_categories",element:c.jsx(p.Suspense,{fallback:c.jsx(be,{}),children:c.jsx(A3,{})}),errorElement:c.jsx(we,{})},{path:"product_categories/new",element:c.jsx(p.Suspense,{fallback:c.jsx(be,{}),children:c.jsx(z3,{})}),errorElement:c.jsx(we,{})},{path:"product_categories/:recordId",element:c.jsx(p.Suspense,{fallback:c.jsx(be,{}),children:c.jsx(I3,{})}),errorElement:c.jsx(we,{})}]},{path:"/admin/forbidden",element:c.jsx(p.Suspense,{fallback:c.jsx(be,{}),children:c.jsx(h3,{})}),errorElement:c.jsx(we,{})},{path:"/login",element:c.jsx(p.Suspense,{fallback:c.jsx(be,{}),children:c.jsx(y3,{})}),errorElement:c.jsx(we,{})},{path:"/admin/login",element:c.jsx(p.Suspense,{fallback:c.jsx(be,{}),children:c.jsx(x3,{})}),errorElement:c.jsx(we,{})},{element:c.jsx(Mj,{}),children:[{path:"account",element:c.jsx(p.Suspense,{fallback:c.jsx(be,{}),children:c.jsx(w3,{})}),errorElement:c.jsx(we,{})},{path:"articles",element:c.jsx(p.Suspense,{fallback:c.jsx(be,{}),children:c.jsx(C3,{})}),errorElement:c.jsx(we,{})},{path:"articles/category/:categoryId",element:c.jsx(p.Suspense,{fallback:c.jsx(be,{}),children:c.jsx(N3,{})}),errorElement:c.jsx(we,{})},{path:"articles/:slug",element:c.jsx(p.Suspense,{fallback:c.jsx(be,{}),children:c.jsx(P3,{})}),errorElement:c.jsx(we,{})},{path:"products",element:c.jsx(p.Suspense,{fallback:c.jsx(be,{}),children:c.jsx(L3,{})}),errorElement:c.jsx(we,{})},{path:"products/category/:categoryId",element:c.jsx(p.Suspense,{fallback:c.jsx(be,{}),children:c.jsx(D3,{})}),errorElement:c.jsx(we,{})},{path:"products/:slug",element:c.jsx(p.Suspense,{fallback:c.jsx(be,{}),children:c.jsx($3,{})}),errorElement:c.jsx(we,{})},{path:"/",element:c.jsx(om,{})},{path:"/products",element:c.jsx(GC,{})},{path:"/brand-story",element:c.jsx(KC,{})},{path:"/cases",element:c.jsx(QC,{})},{path:"/news",element:c.jsx(l3,{})},{path:"/news/:slug",element:c.jsx(u3,{})},{path:"/contact",element:c.jsx(XC,{})},{path:"/points",element:c.jsx(t3,{})},{path:"*",element:c.jsx(om,{})}]}],F3=bC({configDigest:"sha256:2331eea004f0f513044a90aff63ee1ffb6e92e6c52cf6ffd8f9bebf1527c8083",databaseRpcContractVersion:3,modules:{assets:!1,case:!1,faq:!1,forms:!1,lead:!1,seo:!1,service:!1,simple_booking:!1,team:!1,testimonial:!1},profile:"cms_catalog",version:1}),U3=hC({adminEntry:"direct-only",authenticatedAdminEntry:"none",hostMode:"website-with-admin",memberEntry:"none",version:1}),B3={experienceContractVersion:1,identity:{adminLabel:"管理后台",applicationName:"吨吨家水杯品牌官网",logoText:"吨吨"},recipes:{auth:"centered",contentWidth:"wide",density:"comfortable",editor:"sections",list:"table",navigation:"sidebar"},resources:{post:{archetype:"editorial",editorMode:"page"},post_category:{archetype:"records",editorMode:"dialog"},product:{archetype:"media",editorMode:"drawer",list:"cards"},product_category:{archetype:"records",editorMode:"dialog"}},scopeClassName:"wxz-host-site-admin",semanticDomContractVersion:1,tokens:{border:"hsl(var(--border))",brand:"hsl(var(--primary))",brandForeground:"hsl(var(--primary-foreground))",canvas:"hsl(var(--background))",danger:"hsl(var(--destructive))",dangerForeground:"hsl(var(--destructive-foreground))",focusRing:"hsl(var(--ring))",fontSans:"inherit",foreground:"hsl(var(--foreground))",foregroundMuted:"hsl(var(--muted-foreground))",radiusLg:"calc(var(--radius) + 4px)",radiusMd:"var(--radius)",radiusSm:"calc(var(--radius) - 2px)",shadowCard:"0 12px 30px rgb(15 23 42 / 8%)",success:"#167647",surface:"hsl(var(--card))",surfaceMuted:"hsl(var(--muted))",warning:"#9a6700"}},cm={},V3={},H3=uC(Zj(B3,{...cm,resources:{...cm.resources,...V3}}));function W3({children:e}){const{upload:t}=a2(Ke,"images",{defaultCacheControl:"3600"}),r=p.useMemo(()=>({allowedMimeTypes:["image/jpeg","image/png","image/webp"],maxBytes:10*1024*1024,async upload({file:s,idempotencyKey:a}){const i=s.name.replace(/[^a-zA-Z0-9._-]/g,"_"),o=await t(`site-admin/${a}-${i}`,s,{contentType:s.type});if(!o.success||!o.url)throw new Error(o.error||"图片上传失败");return{url:o.url,objectKey:o.path}}}),[t]),n=p.useMemo(()=>({upload:r}),[r]);return c.jsx(LC,{supabase:Ke,baseUrl:Yd,config:F3,presentation:H3,entryPolicy:U3,services:n,runtimeMode:"reuse-host",children:e})}const ex=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;async function q3(e){if(!ex.test(e))return null;const{data:t,error:r}=await Ke.from("user_verifications").select("*").eq("user_id",e).eq("is_deleted",!1).maybeSingle();if(r)throw r;return t}async function RN(){const{data:e,error:t}=await Ke.from("user_verifications").select("user_id").eq("is_verified",!0).eq("is_deleted",!1);if(t)throw t;return(e||[]).map(r=>r.user_id)}async function G3(e){if(!ex.test(e))return null;const{data:t,error:r}=await Ke.from("user_verifications").upsert({user_id:e,is_verified:!0},{onConflict:"user_id"}).select().single();if(r)throw r;return t}function K3({children:e}){const{user:t}=Gs(),r=p.useRef(new Set);return p.useEffect(()=>{if(!(t!=null&&t.id)||r.current.has(t.id))return;(async()=>{try{const s=await q3(t.id);s!=null&&s.is_verified||await G3(t.id),r.current.add(t.id)}catch{}})()},[t==null?void 0:t.id]),c.jsx(c.Fragment,{children:e})}Ev(document.getElementById("root")).render(c.jsx(p.StrictMode,{children:c.jsx(Qv,{children:c.jsx(Jv,{supabase:Ke,children:c.jsx(ty,{supabase:Ke,baseUrl:Yd,notifier:{success:e=>Be.success(e),error:e=>Be.error(e)},children:c.jsx(K3,{children:c.jsx(W3,{children:c.jsx(w_,{router:d_(M3)})})})})})})}));export{jC as $,NN as A,i2 as B,jN as C,CN as D,q0 as E,mN as F,kN as G,SN as H,ep as I,nN as J,PN as K,Te as L,bN as M,Y3 as N,r_ as O,er as P,ry as Q,La as R,Y0 as S,J0 as T,TN as U,hN as V,pN as W,vN as X,yN as Y,Ke as Z,BC as _,xN as a,EN as a0,W0 as a1,mi as a2,Dv as a3,NC as a4,EC as a5,yr as a6,VC as a7,$C as a8,Z0 as a9,_N as aa,MC as ab,He as ac,Sv as ad,ii as ae,gN as b,fN as c,Hs as d,Bd as e,eN as f,RN as g,B4 as h,K0 as i,c as j,ye as k,rN as l,Ir as m,_s as n,tN as o,mr as p,k2 as q,p as r,mn as s,Gs as t,Hn as u,Mu as v,Md as w,Fd as x,lt as y,em as z};