import{j as p,u as vt}from"./vendor-query-DxCcOIl8.js";import{r as _,a as Hl}from"./vendor-react-DO-R8FnS.js";import{b as Kl,u as Gl,L as ne}from"./vendor-router-DakTd-wc.js";import{c as ae,u as Jn,X as ps,b as zl,P as Yn,d as Jl,e as un,a as ze,f as Yl,S as Xl}from"./index-xPeCjpwp.js";/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ql=ae("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const jr=ae("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Zl=ae("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ec=ae("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Or=ae("Mail",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const tc=ae("MapPin",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const sc=ae("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const nc=ae("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Jt=ae("Phone",[["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Dr=ae("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const rc=ae("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ic=ae("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]),Xn=_.createContext({});function Qn(t){const e=_.useRef(null);return e.current===null&&(e.current=t()),e.current}const ac=typeof window<"u",Aa=ac?_.useLayoutEffect:_.useEffect,As=_.createContext(null);function Zn(t,e){t.indexOf(e)===-1&&t.push(e)}function ms(t,e){const s=t.indexOf(e);s>-1&&t.splice(s,1)}const be=(t,e,s)=>s>e?e:s<t?t:s;let Ps=()=>{},pt=()=>{};const De={},Pa=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t);function Ca(t){return typeof t=="object"&&t!==null}const Ra=t=>/^0[^.\s]+$/u.test(t);function ja(t){let e;return()=>(e===void 0&&(e=t()),e)}const ie=t=>t,oc=(t,e)=>s=>e(t(s)),Wt=(...t)=>t.reduce(oc),Dt=(t,e,s)=>{const n=e-t;return n===0?1:(s-t)/n};class er{constructor(){this.subscriptions=[]}add(e){return Zn(this.subscriptions,e),()=>ms(this.subscriptions,e)}notify(e,s,n){const r=this.subscriptions.length;if(r)if(r===1)this.subscriptions[0](e,s,n);else for(let i=0;i<r;i++){const a=this.subscriptions[i];a&&a(e,s,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const Q=t=>t*1e3,re=t=>t/1e3;function Oa(t,e){return e?t*(1e3/e):0}const Da=(t,e,s)=>(((1-3*s+3*e)*t+(3*s-6*e))*t+3*e)*t,lc=1e-7,cc=12;function uc(t,e,s,n,r){let i,a,o=0;do a=e+(s-e)/2,i=Da(a,n,r)-t,i>0?s=a:e=a;while(Math.abs(i)>lc&&++o<cc);return a}function Ht(t,e,s,n){if(t===e&&s===n)return ie;const r=i=>uc(i,0,1,t,s);return i=>i===0||i===1?i:Da(r(i),e,n)}const Ia=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,Na=t=>e=>1-t(1-e),Ma=Ht(.33,1.53,.69,.99),tr=Na(Ma),$a=Ia(tr),La=t=>t>=1?1:(t*=2)<1?.5*tr(t):.5*(2-Math.pow(2,-10*(t-1))),sr=t=>1-Math.sin(Math.acos(t)),Ba=Na(sr),Va=Ia(sr),hc=Ht(.42,0,1,1),dc=Ht(0,0,.58,1),Ua=Ht(.42,0,.58,1),fc=t=>Array.isArray(t)&&typeof t[0]!="number",Fa=t=>Array.isArray(t)&&typeof t[0]=="number",Ir={linear:ie,easeIn:hc,easeInOut:Ua,easeOut:dc,circIn:sr,circInOut:Va,circOut:Ba,backIn:tr,backInOut:$a,backOut:Ma,anticipate:La},pc=t=>typeof t=="string",Nr=t=>{if(Fa(t)){pt(t.length===4,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");const[e,s,n,r]=t;return Ht(e,s,n,r)}else if(pc(t))return pt(Ir[t]!==void 0,`Invalid easing type '${t}'`,"invalid-easing-type"),Ir[t];return t},Yt=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"],Mr={value:null,addProjectionMetrics:null};function mc(t,e){let s=new Set,n=new Set,r=!1,i=!1;const a=new WeakSet;let o={delta:0,timestamp:0,isProcessing:!1},l=0;function c(h){a.has(h)&&(u.schedule(h),t()),l++,h(o)}const u={schedule:(h,d=!1,f=!1)=>{const y=f&&r?s:n;return d&&a.add(h),y.add(h),h},cancel:h=>{n.delete(h),a.delete(h)},process:h=>{if(o=h,r){i=!0;return}r=!0;const d=s;s=n,n=d,s.forEach(c),e&&Mr.value&&Mr.value.frameloop[e].push(l),l=0,s.clear(),r=!1,i&&(i=!1,u.process(h))}};return u}const gc=40;function qa(t,e){let s=!1,n=!0;const r={delta:0,timestamp:0,isProcessing:!1},i=()=>s=!0,a=Yt.reduce((w,b)=>(w[b]=mc(i,e?b:void 0),w),{}),{setup:o,read:l,resolveKeyframes:c,preUpdate:u,update:h,preRender:d,render:f,postRender:m}=a,y=()=>{const w=De.useManualTiming,b=w?r.timestamp:performance.now();s=!1,w||(r.delta=n?1e3/60:Math.max(Math.min(b-r.timestamp,gc),1)),r.timestamp=b,r.isProcessing=!0,o.process(r),l.process(r),c.process(r),u.process(r),h.process(r),d.process(r),f.process(r),m.process(r),r.isProcessing=!1,s&&e&&(n=!1,t(y))},g=()=>{s=!0,n=!0,r.isProcessing||t(y)};return{schedule:Yt.reduce((w,b)=>{const S=a[b];return w[b]=(T,j=!1,E=!1)=>(s||g(),S.schedule(T,j,E)),w},{}),cancel:w=>{for(let b=0;b<Yt.length;b++)a[Yt[b]].cancel(w)},state:r,steps:a}}const{schedule:D,cancel:Ie,state:z,steps:Ms}=qa(typeof requestAnimationFrame<"u"?requestAnimationFrame:ie,!0);let as;function yc(){as=void 0}const Y={now:()=>(as===void 0&&Y.set(z.isProcessing||De.useManualTiming?z.timestamp:performance.now()),as),set:t=>{as=t,queueMicrotask(yc)}},Wa=t=>e=>typeof e=="string"&&e.startsWith(t),Ha=Wa("--"),vc=Wa("var(--"),nr=t=>vc(t)?wc.test(t.split("/*")[0].trim()):!1,wc=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function $r(t){return typeof t!="string"?!1:t.split("/*")[0].includes("var(--")}const wt={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},It={...wt,transform:t=>be(0,1,t)},Xt={...wt,default:1},kt=t=>Math.round(t*1e5)/1e5,rr=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function bc(t){return t==null}const xc=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,ir=(t,e)=>s=>!!(typeof s=="string"&&xc.test(s)&&s.startsWith(t)||e&&!bc(s)&&Object.prototype.hasOwnProperty.call(s,e)),Ka=(t,e,s)=>n=>{if(typeof n!="string")return n;const[r,i,a,o]=n.match(rr);return{[t]:parseFloat(r),[e]:parseFloat(i),[s]:parseFloat(a),alpha:o!==void 0?parseFloat(o):1}},_c=t=>be(0,255,t),$s={...wt,transform:t=>Math.round(_c(t))},He={test:ir("rgb","red"),parse:Ka("red","green","blue"),transform:({red:t,green:e,blue:s,alpha:n=1})=>"rgba("+$s.transform(t)+", "+$s.transform(e)+", "+$s.transform(s)+", "+kt(It.transform(n))+")"};function Sc(t){let e="",s="",n="",r="";return t.length>5?(e=t.substring(1,3),s=t.substring(3,5),n=t.substring(5,7),r=t.substring(7,9)):(e=t.substring(1,2),s=t.substring(2,3),n=t.substring(3,4),r=t.substring(4,5),e+=e,s+=s,n+=n,r+=r),{red:parseInt(e,16),green:parseInt(s,16),blue:parseInt(n,16),alpha:r?parseInt(r,16)/255:1}}const hn={test:ir("#"),parse:Sc,transform:He.transform},Kt=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),Ae=Kt("deg"),we=Kt("%"),k=Kt("px"),Tc=Kt("vh"),kc=Kt("vw"),Lr={...we,parse:t=>we.parse(t)/100,transform:t=>we.transform(t*100)},lt={test:ir("hsl","hue"),parse:Ka("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:s,alpha:n=1})=>"hsla("+Math.round(t)+", "+we.transform(kt(e))+", "+we.transform(kt(s))+", "+kt(It.transform(n))+")"},U={test:t=>He.test(t)||hn.test(t)||lt.test(t),parse:t=>He.test(t)?He.parse(t):lt.test(t)?lt.parse(t):hn.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?He.transform(t):lt.transform(t),getAnimatableNone:t=>{const e=U.parse(t);return e.alpha=0,U.transform(e)}},Ec=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function Ac(t){var e,s;return isNaN(t)&&typeof t=="string"&&(((e=t.match(rr))==null?void 0:e.length)||0)+(((s=t.match(Ec))==null?void 0:s.length)||0)>0}const Ga="number",za="color",Pc="var",Cc="var(",Br="${}",Rc=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function mt(t){const e=t.toString(),s=[],n={color:[],number:[],var:[]},r=[];let i=0;const o=e.replace(Rc,l=>(U.test(l)?(n.color.push(i),r.push(za),s.push(U.parse(l))):l.startsWith(Cc)?(n.var.push(i),r.push(Pc),s.push(l)):(n.number.push(i),r.push(Ga),s.push(parseFloat(l))),++i,Br)).split(Br);return{values:s,split:o,indexes:n,types:r}}function jc(t){return mt(t).values}function Ja({split:t,types:e}){const s=t.length;return n=>{let r="";for(let i=0;i<s;i++)if(r+=t[i],n[i]!==void 0){const a=e[i];a===Ga?r+=kt(n[i]):a===za?r+=U.transform(n[i]):r+=n[i]}return r}}function Oc(t){return Ja(mt(t))}const Dc=t=>typeof t=="number"?0:U.test(t)?U.getAnimatableNone(t):t,Ic=(t,e)=>typeof t=="number"?e!=null&&e.trim().endsWith("/")?t:0:Dc(t);function Nc(t){const e=mt(t);return Ja(e)(e.values.map((n,r)=>Ic(n,e.split[r])))}const fe={test:Ac,parse:jc,createTransformer:Oc,getAnimatableNone:Nc};function Ls(t,e,s){return s<0&&(s+=1),s>1&&(s-=1),s<1/6?t+(e-t)*6*s:s<1/2?e:s<2/3?t+(e-t)*(2/3-s)*6:t}function Mc({hue:t,saturation:e,lightness:s,alpha:n}){t/=360,e/=100,s/=100;let r=0,i=0,a=0;if(!e)r=i=a=s;else{const o=s<.5?s*(1+e):s+e-s*e,l=2*s-o;r=Ls(l,o,t+1/3),i=Ls(l,o,t),a=Ls(l,o,t-1/3)}return{red:Math.round(r*255),green:Math.round(i*255),blue:Math.round(a*255),alpha:n}}function gs(t,e){return s=>s>0?e:t}const N=(t,e,s)=>t+(e-t)*s,Bs=(t,e,s)=>{const n=t*t,r=s*(e*e-n)+n;return r<0?0:Math.sqrt(r)},$c=[hn,He,lt],Lc=t=>$c.find(e=>e.test(t));function Vr(t){const e=Lc(t);if(Ps(!!e,`'${t}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!e)return!1;let s=e.parse(t);return e===lt&&(s=Mc(s)),s}const Ur=(t,e)=>{const s=Vr(t),n=Vr(e);if(!s||!n)return gs(t,e);const r={...s};return i=>(r.red=Bs(s.red,n.red,i),r.green=Bs(s.green,n.green,i),r.blue=Bs(s.blue,n.blue,i),r.alpha=N(s.alpha,n.alpha,i),He.transform(r))},dn=new Set(["none","hidden"]);function Bc(t,e){return dn.has(t)?s=>s<=0?t:e:s=>s>=1?e:t}function Vc(t,e){return s=>N(t,e,s)}function ar(t){return typeof t=="number"?Vc:typeof t=="string"?nr(t)?gs:U.test(t)?Ur:qc:Array.isArray(t)?Ya:typeof t=="object"?U.test(t)?Ur:Uc:gs}function Ya(t,e){const s=[...t],n=s.length,r=t.map((i,a)=>ar(i)(i,e[a]));return i=>{for(let a=0;a<n;a++)s[a]=r[a](i);return s}}function Uc(t,e){const s={...t,...e},n={};for(const r in s)t[r]!==void 0&&e[r]!==void 0&&(n[r]=ar(t[r])(t[r],e[r]));return r=>{for(const i in n)s[i]=n[i](r);return s}}function Fc(t,e){const s=[],n={color:0,var:0,number:0};for(let r=0;r<e.values.length;r++){const i=e.types[r],a=t.indexes[i][n[i]],o=t.values[a]??0;s[r]=o,n[i]++}return s}const qc=(t,e)=>{const s=fe.createTransformer(e),n=mt(t),r=mt(e);return n.indexes.var.length===r.indexes.var.length&&n.indexes.color.length===r.indexes.color.length&&n.indexes.number.length>=r.indexes.number.length?dn.has(t)&&!r.values.length||dn.has(e)&&!n.values.length?Bc(t,e):Wt(Ya(Fc(n,r),r.values),s):(Ps(!0,`Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`,"complex-values-different"),gs(t,e))};function Xa(t,e,s){return typeof t=="number"&&typeof e=="number"&&typeof s=="number"?N(t,e,s):ar(t)(t,e)}const Wc=t=>{const e=({timestamp:s})=>t(s);return{start:(s=!0)=>D.update(e,s),stop:()=>Ie(e),now:()=>z.isProcessing?z.timestamp:Y.now()}},Qa=(t,e,s=10)=>{let n="";const r=Math.max(Math.round(e/s),2);for(let i=0;i<r;i++)n+=Math.round(t(i/(r-1))*1e4)/1e4+", ";return`linear(${n.substring(0,n.length-2)})`},ys=2e4;function or(t){let e=0;const s=50;let n=t.next(e);for(;!n.done&&e<ys;)e+=s,n=t.next(e);return e>=ys?1/0:e}function Hc(t,e=100,s){const n=s({...t,keyframes:[0,e]}),r=Math.min(or(n),ys);return{type:"keyframes",ease:i=>n.next(r*i).value/e,duration:re(r)}}const L={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1};function fn(t,e){return t*Math.sqrt(1-e*e)}const Kc=12;function Gc(t,e,s){let n=s;for(let r=1;r<Kc;r++)n=n-t(n)/e(n);return n}const Vs=.001;function zc({duration:t=L.duration,bounce:e=L.bounce,velocity:s=L.velocity,mass:n=L.mass}){let r,i;Ps(t<=Q(L.maxDuration),"Spring duration must be 10 seconds or less","spring-duration-limit");let a=1-e;a=be(L.minDamping,L.maxDamping,a),t=be(L.minDuration,L.maxDuration,re(t)),a<1?(r=c=>{const u=c*a,h=u*t,d=u-s,f=fn(c,a),m=Math.exp(-h);return Vs-d/f*m},i=c=>{const h=c*a*t,d=h*s+s,f=Math.pow(a,2)*Math.pow(c,2)*t,m=Math.exp(-h),y=fn(Math.pow(c,2),a);return(-r(c)+Vs>0?-1:1)*((d-f)*m)/y}):(r=c=>{const u=Math.exp(-c*t),h=(c-s)*t+1;return-Vs+u*h},i=c=>{const u=Math.exp(-c*t),h=(s-c)*(t*t);return u*h});const o=5/t,l=Gc(r,i,o);if(t=Q(t),isNaN(l))return{stiffness:L.stiffness,damping:L.damping,duration:t};{const c=Math.pow(l,2)*n;return{stiffness:c,damping:a*2*Math.sqrt(n*c),duration:t}}}const Jc=["duration","bounce"],Yc=["stiffness","damping","mass"];function Fr(t,e){return e.some(s=>t[s]!==void 0)}function Xc(t){let e={velocity:L.velocity,stiffness:L.stiffness,damping:L.damping,mass:L.mass,isResolvedFromDuration:!1,...t};if(!Fr(t,Yc)&&Fr(t,Jc))if(e.velocity=0,t.visualDuration){const s=t.visualDuration,n=2*Math.PI/(s*1.2),r=n*n,i=2*be(.05,1,1-(t.bounce||0))*Math.sqrt(r);e={...e,mass:L.mass,stiffness:r,damping:i}}else{const s=zc({...t,velocity:0});e={...e,...s,mass:L.mass},e.isResolvedFromDuration=!0}return e}function vs(t=L.visualDuration,e=L.bounce){const s=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:n,restDelta:r}=s;const i=s.keyframes[0],a=s.keyframes[s.keyframes.length-1],o={done:!1,value:i},{stiffness:l,damping:c,mass:u,duration:h,velocity:d,isResolvedFromDuration:f}=Xc({...s,velocity:-re(s.velocity||0)}),m=d||0,y=c/(2*Math.sqrt(l*u)),g=a-i,v=re(Math.sqrt(l/u)),x=Math.abs(g)<5;n||(n=x?L.restSpeed.granular:L.restSpeed.default),r||(r=x?L.restDelta.granular:L.restDelta.default);let w,b,S,T,j,E;if(y<1)S=fn(v,y),T=(m+y*v*g)/S,w=P=>{const M=Math.exp(-y*v*P);return a-M*(T*Math.sin(S*P)+g*Math.cos(S*P))},j=y*v*T+g*S,E=y*v*g-T*S,b=P=>Math.exp(-y*v*P)*(j*Math.sin(S*P)+E*Math.cos(S*P));else if(y===1){w=M=>a-Math.exp(-v*M)*(g+(m+v*g)*M);const P=m+v*g;b=M=>Math.exp(-v*M)*(v*P*M-m)}else{const P=v*Math.sqrt(y*y-1);w=pe=>{const _e=Math.exp(-y*v*pe),me=Math.min(P*pe,300);return a-_e*((m+y*v*g)*Math.sinh(me)+P*g*Math.cosh(me))/P};const M=(m+y*v*g)/P,W=y*v*M-g*P,xe=y*v*g-M*P;b=pe=>{const _e=Math.exp(-y*v*pe),me=Math.min(P*pe,300);return _e*(W*Math.sinh(me)+xe*Math.cosh(me))}}const O={calculatedDuration:f&&h||null,velocity:P=>Q(b(P)),next:P=>{if(!f&&y<1){const W=Math.exp(-y*v*P),xe=Math.sin(S*P),pe=Math.cos(S*P),_e=a-W*(T*xe+g*pe),me=Q(W*(j*xe+E*pe));return o.done=Math.abs(me)<=n&&Math.abs(a-_e)<=r,o.value=o.done?a:_e,o}const M=w(P);if(f)o.done=P>=h;else{const W=Q(b(P));o.done=Math.abs(W)<=n&&Math.abs(a-M)<=r}return o.value=o.done?a:M,o},toString:()=>{const P=Math.min(or(O),ys),M=Qa(W=>O.next(P*W).value,P,30);return P+"ms "+M},toTransition:()=>{}};return O}vs.applyToOptions=t=>{const e=Hc(t,100,vs);return t.ease=e.ease,t.duration=Q(e.duration),t.type="keyframes",t};const Qc=5;function Za(t,e,s){const n=Math.max(e-Qc,0);return Oa(s-t(n),e-n)}function pn({keyframes:t,velocity:e=0,power:s=.8,timeConstant:n=325,bounceDamping:r=10,bounceStiffness:i=500,modifyTarget:a,min:o,max:l,restDelta:c=.5,restSpeed:u}){const h=t[0],d={done:!1,value:h},f=E=>o!==void 0&&E<o||l!==void 0&&E>l,m=E=>o===void 0?l:l===void 0||Math.abs(o-E)<Math.abs(l-E)?o:l;let y=s*e;const g=h+y,v=a===void 0?g:a(g);v!==g&&(y=v-h);const x=E=>-y*Math.exp(-E/n),w=E=>v+x(E),b=E=>{const O=x(E),P=w(E);d.done=Math.abs(O)<=c,d.value=d.done?v:P};let S,T;const j=E=>{f(d.value)&&(S=E,T=vs({keyframes:[d.value,m(d.value)],velocity:Za(w,E,d.value),damping:r,stiffness:i,restDelta:c,restSpeed:u}))};return j(0),{calculatedDuration:null,next:E=>{let O=!1;return!T&&S===void 0&&(O=!0,b(E),j(E)),S!==void 0&&E>=S?T.next(E-S):(!O&&b(E),d)}}}function Zc(t,e,s){const n=[],r=s||De.mix||Xa,i=t.length-1;for(let a=0;a<i;a++){let o=r(t[a],t[a+1]);if(e){const l=Array.isArray(e)?e[a]||ie:e;o=Wt(l,o)}n.push(o)}return n}function eu(t,e,{clamp:s=!0,ease:n,mixer:r}={}){const i=t.length;if(pt(i===e.length,"Both input and output ranges must be the same length","range-length"),i===1)return()=>e[0];if(i===2&&e[0]===e[1])return()=>e[1];const a=t[0]===t[1];t[0]>t[i-1]&&(t=[...t].reverse(),e=[...e].reverse());const o=Zc(e,n,r),l=o.length,c=u=>{if(a&&u<t[0])return e[0];let h=0;if(l>1)for(;h<t.length-2&&!(u<t[h+1]);h++);const d=Dt(t[h],t[h+1],u);return o[h](d)};return s?u=>c(be(t[0],t[i-1],u)):c}function tu(t,e){const s=t[t.length-1];for(let n=1;n<=e;n++){const r=Dt(0,e,n);t.push(N(s,1,r))}}function su(t){const e=[0];return tu(e,t.length-1),e}function nu(t,e){return t.map(s=>s*e)}function ru(t,e){return t.map(()=>e||Ua).splice(0,t.length-1)}function Et({duration:t=300,keyframes:e,times:s,ease:n="easeInOut"}){const r=fc(n)?n.map(Nr):Nr(n),i={done:!1,value:e[0]},a=nu(s&&s.length===e.length?s:su(e),t),o=eu(a,e,{ease:Array.isArray(r)?r:ru(e,r)});return{calculatedDuration:t,next:l=>(i.value=o(l),i.done=l>=t,i)}}const iu=t=>t!==null;function Cs(t,{repeat:e,repeatType:s="loop"},n,r=1){const i=t.filter(iu),o=r<0||e&&s!=="loop"&&e%2===1?0:i.length-1;return!o||n===void 0?i[o]:n}const au={decay:pn,inertia:pn,tween:Et,keyframes:Et,spring:vs};function eo(t){typeof t.type=="string"&&(t.type=au[t.type])}class lr{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,s){return this.finished.then(e,s)}}const ou=t=>t/100;class ws extends lr{constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{var n,r;const{motionValue:s}=this.options;s&&s.updatedAt!==Y.now()&&this.tick(Y.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),(r=(n=this.options).onStop)==null||r.call(n))},this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){const{options:e}=this;eo(e);const{type:s=Et,repeat:n=0,repeatDelay:r=0,repeatType:i,velocity:a=0}=e;let{keyframes:o}=e;const l=s||Et;l!==Et&&typeof o[0]!="number"&&(this.mixKeyframes=Wt(ou,Xa(o[0],o[1])),o=[0,100]);const c=l({...e,keyframes:o});i==="mirror"&&(this.mirroredGenerator=l({...e,keyframes:[...o].reverse(),velocity:-a})),c.calculatedDuration===null&&(c.calculatedDuration=or(c));const{calculatedDuration:u}=c;this.calculatedDuration=u,this.resolvedDuration=u+r,this.totalDuration=this.resolvedDuration*(n+1)-r,this.generator=c}updateTime(e){const s=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=s}tick(e,s=!1){const{generator:n,totalDuration:r,mixKeyframes:i,mirroredGenerator:a,resolvedDuration:o,calculatedDuration:l}=this;if(this.startTime===null)return n.next(0);const{delay:c=0,keyframes:u,repeat:h,repeatType:d,repeatDelay:f,type:m,onUpdate:y,finalKeyframe:g}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-r/this.speed,this.startTime)),s?this.currentTime=e:this.updateTime(e);const v=this.currentTime-c*(this.playbackSpeed>=0?1:-1),x=this.playbackSpeed>=0?v<0:v>r;this.currentTime=Math.max(v,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=r);let w=this.currentTime,b=n;if(h){const E=Math.min(this.currentTime,r)/o;let O=Math.floor(E),P=E%1;!P&&E>=1&&(P=1),P===1&&O--,O=Math.min(O,h+1),!!(O%2)&&(d==="reverse"?(P=1-P,f&&(P-=f/o)):d==="mirror"&&(b=a)),w=be(0,1,P)*o}let S;x?(this.delayState.value=u[0],S=this.delayState):S=b.next(w),i&&!x&&(S.value=i(S.value));let{done:T}=S;!x&&l!==null&&(T=this.playbackSpeed>=0?this.currentTime>=r:this.currentTime<=0);const j=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&T);return j&&m!==pn&&(S.value=Cs(u,this.options,g,this.speed)),y&&y(S.value),j&&this.finish(),S}then(e,s){return this.finished.then(e,s)}get duration(){return re(this.calculatedDuration)}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+re(e)}get time(){return re(this.currentTime)}set time(e){e=Q(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state="paused",this.holdTime=e,this.tick(e))}getGeneratorVelocity(){const e=this.currentTime;if(e<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(e);const s=this.generator.next(e).value;return Za(n=>this.generator.next(n).value,e,s)}get speed(){return this.playbackSpeed}set speed(e){const s=this.playbackSpeed!==e;s&&this.driver&&this.updateTime(Y.now()),this.playbackSpeed=e,s&&this.driver&&(this.time=re(this.currentTime))}play(){var r,i;if(this.isStopped)return;const{driver:e=Wc,startTime:s}=this.options;this.driver||(this.driver=e(a=>this.tick(a))),(i=(r=this.options).onPlay)==null||i.call(r);const n=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=n):this.holdTime!==null?this.startTime=n-this.holdTime:this.startTime||(this.startTime=s??n),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(Y.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){var e,s;this.notifyFinished(),this.teardown(),this.state="finished",(s=(e=this.options).onComplete)==null||s.call(e)}cancel(){var e,s;this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),(s=(e=this.options).onCancel)==null||s.call(e)}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){var s;return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),(s=this.driver)==null||s.stop(),e.observe(this)}}function lu(t){for(let e=1;e<t.length;e++)t[e]??(t[e]=t[e-1])}const Ke=t=>t*180/Math.PI,mn=t=>{const e=Ke(Math.atan2(t[1],t[0]));return gn(e)},cu={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:mn,rotateZ:mn,skewX:t=>Ke(Math.atan(t[1])),skewY:t=>Ke(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},gn=t=>(t=t%360,t<0&&(t+=360),t),qr=mn,Wr=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),Hr=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),uu={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Wr,scaleY:Hr,scale:t=>(Wr(t)+Hr(t))/2,rotateX:t=>gn(Ke(Math.atan2(t[6],t[5]))),rotateY:t=>gn(Ke(Math.atan2(-t[2],t[0]))),rotateZ:qr,rotate:qr,skewX:t=>Ke(Math.atan(t[4])),skewY:t=>Ke(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function yn(t){return t.includes("scale")?1:0}function vn(t,e){if(!t||t==="none")return yn(e);const s=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let n,r;if(s)n=uu,r=s;else{const o=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);n=cu,r=o}if(!r)return yn(e);const i=n[e],a=r[1].split(",").map(du);return typeof i=="function"?i(a):a[i]}const hu=(t,e)=>{const{transform:s="none"}=getComputedStyle(t);return vn(s,e)};function du(t){return parseFloat(t.trim())}const bt=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],xt=new Set(bt),Kr=t=>t===wt||t===k,fu=new Set(["x","y","z"]),pu=bt.filter(t=>!fu.has(t));function mu(t){const e=[];return pu.forEach(s=>{const n=t.getValue(s);n!==void 0&&(e.push([s,n.get()]),n.set(s.startsWith("scale")?1:0))}),e}const Oe={width:({x:t},{paddingLeft:e="0",paddingRight:s="0",boxSizing:n})=>{const r=t.max-t.min;return n==="border-box"?r:r-parseFloat(e)-parseFloat(s)},height:({y:t},{paddingTop:e="0",paddingBottom:s="0",boxSizing:n})=>{const r=t.max-t.min;return n==="border-box"?r:r-parseFloat(e)-parseFloat(s)},top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:(t,{transform:e})=>vn(e,"x"),y:(t,{transform:e})=>vn(e,"y")};Oe.translateX=Oe.x;Oe.translateY=Oe.y;const Je=new Set;let wn=!1,bn=!1,xn=!1;function to(){if(bn){const t=Array.from(Je).filter(n=>n.needsMeasurement),e=new Set(t.map(n=>n.element)),s=new Map;e.forEach(n=>{const r=mu(n);r.length&&(s.set(n,r),n.render())}),t.forEach(n=>n.measureInitialState()),e.forEach(n=>{n.render();const r=s.get(n);r&&r.forEach(([i,a])=>{var o;(o=n.getValue(i))==null||o.set(a)})}),t.forEach(n=>n.measureEndState()),t.forEach(n=>{n.suspendedScrollY!==void 0&&window.scrollTo(0,n.suspendedScrollY)})}bn=!1,wn=!1,Je.forEach(t=>t.complete(xn)),Je.clear()}function so(){Je.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(bn=!0)})}function gu(){xn=!0,so(),to(),xn=!1}class cr{constructor(e,s,n,r,i,a=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=s,this.name=n,this.motionValue=r,this.element=i,this.isAsync=a}scheduleResolve(){this.state="scheduled",this.isAsync?(Je.add(this),wn||(wn=!0,D.read(so),D.resolveKeyframes(to))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:s,element:n,motionValue:r}=this;if(e[0]===null){const i=r==null?void 0:r.get(),a=e[e.length-1];if(i!==void 0)e[0]=i;else if(n&&s){const o=n.readValue(s,a);o!=null&&(e[0]=o)}e[0]===void 0&&(e[0]=a),r&&i===void 0&&r.set(e[0])}lu(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),Je.delete(this)}cancel(){this.state==="scheduled"&&(Je.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const yu=t=>t.startsWith("--");function no(t,e,s){yu(e)?t.style.setProperty(e,s):t.style[e]=s}const vu={};function ro(t,e){const s=ja(t);return()=>vu[e]??s()}const wu=ro(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),io=ro(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),St=([t,e,s,n])=>`cubic-bezier(${t}, ${e}, ${s}, ${n})`,Gr={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:St([0,.65,.55,1]),circOut:St([.55,0,1,.45]),backIn:St([.31,.01,.66,-.59]),backOut:St([.33,1.53,.69,.99])};function ao(t,e){if(t)return typeof t=="function"?io()?Qa(t,e):"ease-out":Fa(t)?St(t):Array.isArray(t)?t.map(s=>ao(s,e)||Gr.easeOut):Gr[t]}function bu(t,e,s,{delay:n=0,duration:r=300,repeat:i=0,repeatType:a="loop",ease:o="easeOut",times:l}={},c=void 0){const u={[e]:s};l&&(u.offset=l);const h=ao(o,r);Array.isArray(h)&&(u.easing=h);const d={delay:n,duration:r,easing:Array.isArray(h)?"linear":h,fill:"both",iterations:i+1,direction:a==="reverse"?"alternate":"normal"};return c&&(d.pseudoElement=c),t.animate(u,d)}function oo(t){return typeof t=="function"&&"applyToOptions"in t}function xu({type:t,...e}){return oo(t)&&io()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}class lo extends lr{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;const{element:s,name:n,keyframes:r,pseudoElement:i,allowFlatten:a=!1,finalKeyframe:o,onComplete:l}=e;this.isPseudoElement=!!i,this.allowFlatten=a,this.options=e,pt(typeof e.type!="string",`Mini animate() doesn't support "type" as a string.`,"mini-spring");const c=xu(e);this.animation=bu(s,n,r,c,i),c.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){const u=Cs(r,this.options,o,this.speed);this.updateMotionValue&&this.updateMotionValue(u),no(s,n,u),this.animation.cancel()}l==null||l(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){var e,s;(s=(e=this.animation).finish)==null||s.call(e)}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:e}=this;e==="idle"||e==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var s,n,r;const e=(s=this.options)==null?void 0:s.element;!this.isPseudoElement&&(e!=null&&e.isConnected)&&((r=(n=this.animation).commitStyles)==null||r.call(n))}get duration(){var s,n;const e=((n=(s=this.animation.effect)==null?void 0:s.getComputedTiming)==null?void 0:n.call(s).duration)||0;return re(Number(e))}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+re(e)}get time(){return re(Number(this.animation.currentTime)||0)}set time(e){const s=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Q(e),s&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,rangeStart:s,rangeEnd:n,observe:r}){var i;return this.allowFlatten&&((i=this.animation.effect)==null||i.updateTiming({easing:"linear"})),this.animation.onfinish=null,e&&wu()?(this.animation.timeline=e,s&&(this.animation.rangeStart=s),n&&(this.animation.rangeEnd=n),ie):r(this)}}const co={anticipate:La,backInOut:$a,circInOut:Va};function _u(t){return t in co}function Su(t){typeof t.ease=="string"&&_u(t.ease)&&(t.ease=co[t.ease])}const Us=10;class Tu extends lo{constructor(e){Su(e),eo(e),super(e),e.startTime!==void 0&&e.autoplay!==!1&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){const{motionValue:s,onUpdate:n,onComplete:r,element:i,...a}=this.options;if(!s)return;if(e!==void 0){s.set(e);return}const o=new ws({...a,autoplay:!1}),l=Math.max(Us,Y.now()-this.startTime),c=be(0,Us,l-Us),u=o.sample(l).value,{name:h}=this.options;i&&h&&no(i,h,u),s.setWithVelocity(o.sample(Math.max(0,l-c)).value,u,c),o.stop()}}const zr=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(fe.test(t)||t==="0")&&!t.startsWith("url("));function ku(t){const e=t[0];if(t.length===1)return!0;for(let s=0;s<t.length;s++)if(t[s]!==e)return!0}function Eu(t,e,s,n){const r=t[0];if(r===null)return!1;if(e==="display"||e==="visibility")return!0;const i=t[t.length-1],a=zr(r,e),o=zr(i,e);return Ps(a===o,`You are trying to animate ${e} from "${r}" to "${i}". "${a?i:r}" is not an animatable value.`,"value-not-animatable"),!a||!o?!1:ku(t)||(s==="spring"||oo(s))&&n}function _n(t){t.duration=0,t.type="keyframes"}const uo=new Set(["opacity","clipPath","filter","transform"]),Au=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function Pu(t){for(let e=0;e<t.length;e++)if(typeof t[e]=="string"&&Au.test(t[e]))return!0;return!1}const Cu=new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),Ru=ja(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function ju(t){var h;const{motionValue:e,name:s,repeatDelay:n,repeatType:r,damping:i,type:a,keyframes:o}=t;if(!(((h=e==null?void 0:e.owner)==null?void 0:h.current)instanceof HTMLElement))return!1;const{onUpdate:c,transformTemplate:u}=e.owner.getProps();return Ru()&&s&&(uo.has(s)||Cu.has(s)&&Pu(o))&&(s!=="transform"||!u)&&!c&&!n&&r!=="mirror"&&i!==0&&a!=="inertia"}const Ou=40;class Du extends lr{constructor({autoplay:e=!0,delay:s=0,type:n="keyframes",repeat:r=0,repeatDelay:i=0,repeatType:a="loop",keyframes:o,name:l,motionValue:c,element:u,...h}){var m;super(),this.stop=()=>{var y,g;this._animation&&(this._animation.stop(),(y=this.stopTimeline)==null||y.call(this)),(g=this.keyframeResolver)==null||g.cancel()},this.createdAt=Y.now();const d={autoplay:e,delay:s,type:n,repeat:r,repeatDelay:i,repeatType:a,name:l,motionValue:c,element:u,...h},f=(u==null?void 0:u.KeyframeResolver)||cr;this.keyframeResolver=new f(o,(y,g,v)=>this.onKeyframesResolved(y,g,d,!v),l,c,u),(m=this.keyframeResolver)==null||m.scheduleResolve()}onKeyframesResolved(e,s,n,r){var v,x;this.keyframeResolver=void 0;const{name:i,type:a,velocity:o,delay:l,isHandoff:c,onUpdate:u}=n;this.resolvedAt=Y.now();let h=!0;Eu(e,i,a,o)||(h=!1,(De.instantAnimations||!l)&&(u==null||u(Cs(e,n,s))),e[0]=e[e.length-1],_n(n),n.repeat=0);const f={startTime:r?this.resolvedAt?this.resolvedAt-this.createdAt>Ou?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:s,...n,keyframes:e},m=h&&!c&&ju(f),y=(x=(v=f.motionValue)==null?void 0:v.owner)==null?void 0:x.current;let g;if(m)try{g=new Tu({...f,element:y})}catch{g=new ws(f)}else g=new ws(f);g.finished.then(()=>{this.notifyFinished()}).catch(ie),this.pendingTimeline&&(this.stopTimeline=g.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=g}get finished(){return this._animation?this.animation.finished:this._finished}then(e,s){return this.finished.finally(e).then(()=>{})}get animation(){var e;return this._animation||((e=this.keyframeResolver)==null||e.resume(),gu()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){var e;this._animation&&this.animation.cancel(),(e=this.keyframeResolver)==null||e.cancel()}}function ho(t,e,s,n=0,r=1){const i=Array.from(t).sort((c,u)=>c.sortNodePosition(u)).indexOf(e),a=t.size,o=(a-1)*n;return typeof s=="function"?s(i,a):r===1?i*n:o-i*n}const Iu=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function Nu(t){const e=Iu.exec(t);if(!e)return[,];const[,s,n,r]=e;return[`--${s??n}`,r]}const Mu=4;function fo(t,e,s=1){pt(s<=Mu,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`,"max-css-var-depth");const[n,r]=Nu(t);if(!n)return;const i=window.getComputedStyle(e).getPropertyValue(n);if(i){const a=i.trim();return Pa(a)?parseFloat(a):a}return nr(r)?fo(r,e,s+1):r}const $u={type:"spring",stiffness:500,damping:25,restSpeed:10},Lu=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),Bu={type:"keyframes",duration:.8},Vu={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Uu=(t,{keyframes:e})=>e.length>2?Bu:xt.has(t)?t.startsWith("scale")?Lu(e[1]):$u:Vu;function po(t,e){if(t!=null&&t.inherit&&e){const{inherit:s,...n}=t;return{...e,...n}}return t}function ur(t,e){const s=(t==null?void 0:t[e])??(t==null?void 0:t.default)??t;return s!==t?po(s,t):s}const Fu=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);function qu(t){for(const e in t)if(!Fu.has(e))return!0;return!1}const hr=(t,e,s,n={},r,i)=>a=>{const o=ur(n,t)||{},l=o.delay||n.delay||0;let{elapsed:c=0}=n;c=c-Q(l);const u={keyframes:Array.isArray(s)?s:[null,s],ease:"easeOut",velocity:e.getVelocity(),...o,delay:-c,onUpdate:d=>{e.set(d),o.onUpdate&&o.onUpdate(d)},onComplete:()=>{a(),o.onComplete&&o.onComplete()},name:t,motionValue:e,element:i?void 0:r};qu(o)||Object.assign(u,Uu(t,u)),u.duration&&(u.duration=Q(u.duration)),u.repeatDelay&&(u.repeatDelay=Q(u.repeatDelay)),u.from!==void 0&&(u.keyframes[0]=u.from);let h=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(_n(u),u.delay===0&&(h=!0)),(De.instantAnimations||De.skipAnimations||r!=null&&r.shouldSkipAnimations)&&(h=!0,_n(u),u.delay=0),u.allowFlatten=!o.type&&!o.ease,h&&!i&&e.get()!==void 0){const d=Cs(u.keyframes,o);if(d!==void 0){D.update(()=>{u.onUpdate(d),u.onComplete()});return}}return o.isSync?new ws(u):new Du(u)};function Jr(t){const e=[{},{}];return t==null||t.values.forEach((s,n)=>{e[0][n]=s.get(),e[1][n]=s.getVelocity()}),e}function dr(t,e,s,n){if(typeof e=="function"){const[r,i]=Jr(n);e=e(s!==void 0?s:t.custom,r,i)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[r,i]=Jr(n);e=e(s!==void 0?s:t.custom,r,i)}return e}function Ye(t,e,s){const n=t.getProps();return dr(n,e,s!==void 0?s:n.custom,t)}const mo=new Set(["width","height","top","left","right","bottom",...bt]),Yr=30,Wu=t=>!isNaN(parseFloat(t));class Hu{constructor(e,s={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=n=>{var i;const r=Y.now();if(this.updatedAt!==r&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(n),this.current!==this.prev&&((i=this.events.change)==null||i.notify(this.current),this.dependents))for(const a of this.dependents)a.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=s.owner}setCurrent(e){this.current=e,this.updatedAt=Y.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=Wu(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,s){this.events[e]||(this.events[e]=new er);const n=this.events[e].add(s);return e==="change"?()=>{n(),D.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,s){this.passiveEffect=e,this.stopPassiveEffect=s}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,s,n){this.set(s),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,s=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,s&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){var e;(e=this.events.change)==null||e.notify(this.current)}addDependent(e){this.dependents||(this.dependents=new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=Y.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>Yr)return 0;const s=Math.min(this.updatedAt-this.prevUpdatedAt,Yr);return Oa(parseFloat(this.current)-parseFloat(this.prevFrameValue),s)}start(e){return this.stop(),new Promise(s=>{this.hasAnimated=!0,this.animation=e(s),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){var e,s;(e=this.dependents)==null||e.clear(),(s=this.events.destroy)==null||s.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function gt(t,e){return new Hu(t,e)}const Sn=t=>Array.isArray(t);function Ku(t,e,s){t.hasValue(e)?t.getValue(e).set(s):t.addValue(e,gt(s))}function Gu(t){return Sn(t)?t[t.length-1]||0:t}function zu(t,e){const s=Ye(t,e);let{transitionEnd:n={},transition:r={},...i}=s||{};i={...i,...n};for(const a in i){const o=Gu(i[a]);Ku(t,a,o)}}const J=t=>!!(t&&t.getVelocity);function Ju(t){return!!(J(t)&&t.add)}function Tn(t,e){const s=t.getValue("willChange");if(Ju(s))return s.add(e);if(!s&&De.WillChange){const n=new De.WillChange("auto");t.addValue("willChange",n),n.add(e)}}function fr(t){return t.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}const Yu="framerAppearId",go="data-"+fr(Yu);function yo(t){return t.props[go]}function Xu({protectedKeys:t,needsAnimating:e},s){const n=t.hasOwnProperty(s)&&e[s]!==!0;return e[s]=!1,n}function vo(t,e,{delay:s=0,transitionOverride:n,type:r}={}){let{transition:i,transitionEnd:a,...o}=e;const l=t.getDefaultTransition();i=i?po(i,l):l;const c=i==null?void 0:i.reduceMotion;n&&(i=n);const u=[],h=r&&t.animationState&&t.animationState.getState()[r];for(const d in o){const f=t.getValue(d,t.latestValues[d]??null),m=o[d];if(m===void 0||h&&Xu(h,d))continue;const y={delay:s,...ur(i||{},d)},g=f.get();if(g!==void 0&&!f.isAnimating()&&!Array.isArray(m)&&m===g&&!y.velocity){D.update(()=>f.set(m));continue}let v=!1;if(window.MotionHandoffAnimation){const b=yo(t);if(b){const S=window.MotionHandoffAnimation(b,d,D);S!==null&&(y.startTime=S,v=!0)}}Tn(t,d);const x=c??t.shouldReduceMotion;f.start(hr(d,f,m,x&&mo.has(d)?{type:!1}:y,t,v));const w=f.animation;w&&u.push(w)}if(a){const d=()=>D.update(()=>{a&&zu(t,a)});u.length?Promise.all(u).then(d):d()}return u}function kn(t,e,s={}){var l;const n=Ye(t,e,s.type==="exit"?(l=t.presenceContext)==null?void 0:l.custom:void 0);let{transition:r=t.getDefaultTransition()||{}}=n||{};s.transitionOverride&&(r=s.transitionOverride);const i=n?()=>Promise.all(vo(t,n,s)):()=>Promise.resolve(),a=t.variantChildren&&t.variantChildren.size?(c=0)=>{const{delayChildren:u=0,staggerChildren:h,staggerDirection:d}=r;return Qu(t,e,c,u,h,d,s)}:()=>Promise.resolve(),{when:o}=r;if(o){const[c,u]=o==="beforeChildren"?[i,a]:[a,i];return c().then(()=>u())}else return Promise.all([i(),a(s.delay)])}function Qu(t,e,s=0,n=0,r=0,i=1,a){const o=[];for(const l of t.variantChildren)l.notify("AnimationStart",e),o.push(kn(l,e,{...a,delay:s+(typeof n=="function"?0:n)+ho(t.variantChildren,l,n,r,i)}).then(()=>l.notify("AnimationComplete",e)));return Promise.all(o)}function Zu(t,e,s={}){t.notify("AnimationStart",e);let n;if(Array.isArray(e)){const r=e.map(i=>kn(t,i,s));n=Promise.all(r)}else if(typeof e=="string")n=kn(t,e,s);else{const r=typeof e=="function"?Ye(t,e,s.custom):e;n=Promise.all(vo(t,r,s))}return n.then(()=>{t.notify("AnimationComplete",e)})}const eh={test:t=>t==="auto",parse:t=>t},wo=t=>e=>e.test(t),bo=[wt,k,we,Ae,kc,Tc,eh],Xr=t=>bo.find(wo(t));function th(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||Ra(t):!0}const sh=new Set(["brightness","contrast","saturate","opacity"]);function nh(t){const[e,s]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[n]=s.match(rr)||[];if(!n)return t;const r=s.replace(n,"");let i=sh.has(e)?1:0;return n!==s&&(i*=100),e+"("+i+r+")"}const rh=/\b([a-z-]*)\(.*?\)/gu,En={...fe,getAnimatableNone:t=>{const e=t.match(rh);return e?e.map(nh).join(" "):t}},An={...fe,getAnimatableNone:t=>{const e=fe.parse(t);return fe.createTransformer(t)(e.map(n=>typeof n=="number"?0:typeof n=="object"?{...n,alpha:1}:n))}},Qr={...wt,transform:Math.round},ih={rotate:Ae,rotateX:Ae,rotateY:Ae,rotateZ:Ae,scale:Xt,scaleX:Xt,scaleY:Xt,scaleZ:Xt,skew:Ae,skewX:Ae,skewY:Ae,distance:k,translateX:k,translateY:k,translateZ:k,x:k,y:k,z:k,perspective:k,transformPerspective:k,opacity:It,originX:Lr,originY:Lr,originZ:k},pr={borderWidth:k,borderTopWidth:k,borderRightWidth:k,borderBottomWidth:k,borderLeftWidth:k,borderRadius:k,borderTopLeftRadius:k,borderTopRightRadius:k,borderBottomRightRadius:k,borderBottomLeftRadius:k,width:k,maxWidth:k,height:k,maxHeight:k,top:k,right:k,bottom:k,left:k,inset:k,insetBlock:k,insetBlockStart:k,insetBlockEnd:k,insetInline:k,insetInlineStart:k,insetInlineEnd:k,padding:k,paddingTop:k,paddingRight:k,paddingBottom:k,paddingLeft:k,paddingBlock:k,paddingBlockStart:k,paddingBlockEnd:k,paddingInline:k,paddingInlineStart:k,paddingInlineEnd:k,margin:k,marginTop:k,marginRight:k,marginBottom:k,marginLeft:k,marginBlock:k,marginBlockStart:k,marginBlockEnd:k,marginInline:k,marginInlineStart:k,marginInlineEnd:k,fontSize:k,backgroundPositionX:k,backgroundPositionY:k,...ih,zIndex:Qr,fillOpacity:It,strokeOpacity:It,numOctaves:Qr},ah={...pr,color:U,backgroundColor:U,outlineColor:U,fill:U,stroke:U,borderColor:U,borderTopColor:U,borderRightColor:U,borderBottomColor:U,borderLeftColor:U,filter:En,WebkitFilter:En,mask:An,WebkitMask:An},xo=t=>ah[t],oh=new Set([En,An]);function _o(t,e){let s=xo(t);return oh.has(s)||(s=fe),s.getAnimatableNone?s.getAnimatableNone(e):void 0}const lh=new Set(["auto","none","0"]);function ch(t,e,s){let n=0,r;for(;n<t.length&&!r;){const i=t[n];typeof i=="string"&&!lh.has(i)&&mt(i).values.length&&(r=t[n]),n++}if(r&&s)for(const i of e)t[i]=_o(s,r)}class uh extends cr{constructor(e,s,n,r,i){super(e,s,n,r,i,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:s,name:n}=this;if(!s||!s.current)return;super.readKeyframes();for(let u=0;u<e.length;u++){let h=e[u];if(typeof h=="string"&&(h=h.trim(),nr(h))){const d=fo(h,s.current);d!==void 0&&(e[u]=d),u===e.length-1&&(this.finalKeyframe=h)}}if(this.resolveNoneKeyframes(),!mo.has(n)||e.length!==2)return;const[r,i]=e,a=Xr(r),o=Xr(i),l=$r(r),c=$r(i);if(l!==c&&Oe[n]){this.needsMeasurement=!0;return}if(a!==o)if(Kr(a)&&Kr(o))for(let u=0;u<e.length;u++){const h=e[u];typeof h=="string"&&(e[u]=parseFloat(h))}else Oe[n]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:s}=this,n=[];for(let r=0;r<e.length;r++)(e[r]===null||th(e[r]))&&n.push(r);n.length&&ch(e,n,s)}measureInitialState(){const{element:e,unresolvedKeyframes:s,name:n}=this;if(!e||!e.current)return;n==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Oe[n](e.measureViewportBox(),window.getComputedStyle(e.current)),s[0]=this.measuredOrigin;const r=s[s.length-1];r!==void 0&&e.getValue(n,r).jump(r,!1)}measureEndState(){var o;const{element:e,name:s,unresolvedKeyframes:n}=this;if(!e||!e.current)return;const r=e.getValue(s);r&&r.jump(this.measuredOrigin,!1);const i=n.length-1,a=n[i];n[i]=Oe[s](e.measureViewportBox(),window.getComputedStyle(e.current)),a!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=a),(o=this.removedTransforms)!=null&&o.length&&this.removedTransforms.forEach(([l,c])=>{e.getValue(l).set(c)}),this.resolveNoneKeyframes()}}function So(t,e,s){if(t==null)return[];if(t instanceof EventTarget)return[t];if(typeof t=="string"){const r=document.querySelectorAll(t);return r?Array.from(r):[]}return Array.from(t).filter(n=>n!=null)}const To=(t,e)=>e&&typeof t=="number"?e.transform(t):t;function os(t){return Ca(t)&&"offsetHeight"in t&&!("ownerSVGElement"in t)}const{schedule:mr,cancel:Ry}=qa(queueMicrotask,!1),ue={x:!1,y:!1};function ko(){return ue.x||ue.y}function hh(t){return t==="x"||t==="y"?ue[t]?null:(ue[t]=!0,()=>{ue[t]=!1}):ue.x||ue.y?null:(ue.x=ue.y=!0,()=>{ue.x=ue.y=!1})}function Eo(t,e){const s=So(t),n=new AbortController,r={passive:!0,...e,signal:n.signal};return[s,r,()=>n.abort()]}function dh(t){return!(t.pointerType==="touch"||ko())}function fh(t,e,s={}){const[n,r,i]=Eo(t,s);return n.forEach(a=>{let o=!1,l=!1,c;const u=()=>{a.removeEventListener("pointerleave",m)},h=g=>{c&&(c(g),c=void 0),u()},d=g=>{o=!1,window.removeEventListener("pointerup",d),window.removeEventListener("pointercancel",d),l&&(l=!1,h(g))},f=()=>{o=!0,window.addEventListener("pointerup",d,r),window.addEventListener("pointercancel",d,r)},m=g=>{if(g.pointerType!=="touch"){if(o){l=!0;return}h(g)}},y=g=>{if(!dh(g))return;l=!1;const v=e(a,g);typeof v=="function"&&(c=v,a.addEventListener("pointerleave",m,r))};a.addEventListener("pointerenter",y,r),a.addEventListener("pointerdown",f,r)}),i}const Ao=(t,e)=>e?t===e?!0:Ao(t,e.parentElement):!1,gr=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1,ph=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function mh(t){return ph.has(t.tagName)||t.isContentEditable===!0}const gh=new Set(["INPUT","SELECT","TEXTAREA"]);function yh(t){return gh.has(t.tagName)||t.isContentEditable===!0}const ls=new WeakSet;function Zr(t){return e=>{e.key==="Enter"&&t(e)}}function Fs(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const vh=(t,e)=>{const s=t.currentTarget;if(!s)return;const n=Zr(()=>{if(ls.has(s))return;Fs(s,"down");const r=Zr(()=>{Fs(s,"up")}),i=()=>Fs(s,"cancel");s.addEventListener("keyup",r,e),s.addEventListener("blur",i,e)});s.addEventListener("keydown",n,e),s.addEventListener("blur",()=>s.removeEventListener("keydown",n),e)};function ei(t){return gr(t)&&!ko()}const ti=new WeakSet;function wh(t,e,s={}){const[n,r,i]=Eo(t,s),a=o=>{const l=o.currentTarget;if(!ei(o)||ti.has(o))return;ls.add(l),s.stopPropagation&&ti.add(o);const c=e(l,o),u=(f,m)=>{window.removeEventListener("pointerup",h),window.removeEventListener("pointercancel",d),ls.has(l)&&ls.delete(l),ei(f)&&typeof c=="function"&&c(f,{success:m})},h=f=>{u(f,l===window||l===document||s.useGlobalTarget||Ao(l,f.target))},d=f=>{u(f,!1)};window.addEventListener("pointerup",h,r),window.addEventListener("pointercancel",d,r)};return n.forEach(o=>{(s.useGlobalTarget?window:o).addEventListener("pointerdown",a,r),os(o)&&(o.addEventListener("focus",c=>vh(c,r)),!mh(o)&&!o.hasAttribute("tabindex")&&(o.tabIndex=0))}),i}function yr(t){return Ca(t)&&"ownerSVGElement"in t}const cs=new WeakMap;let Pe;const Po=(t,e,s)=>(n,r)=>r&&r[0]?r[0][t+"Size"]:yr(n)&&"getBBox"in n?n.getBBox()[e]:n[s],bh=Po("inline","width","offsetWidth"),xh=Po("block","height","offsetHeight");function _h({target:t,borderBoxSize:e}){var s;(s=cs.get(t))==null||s.forEach(n=>{n(t,{get width(){return bh(t,e)},get height(){return xh(t,e)}})})}function Sh(t){t.forEach(_h)}function Th(){typeof ResizeObserver>"u"||(Pe=new ResizeObserver(Sh))}function kh(t,e){Pe||Th();const s=So(t);return s.forEach(n=>{let r=cs.get(n);r||(r=new Set,cs.set(n,r)),r.add(e),Pe==null||Pe.observe(n)}),()=>{s.forEach(n=>{const r=cs.get(n);r==null||r.delete(e),r!=null&&r.size||Pe==null||Pe.unobserve(n)})}}const us=new Set;let ct;function Eh(){ct=()=>{const t={get width(){return window.innerWidth},get height(){return window.innerHeight}};us.forEach(e=>e(t))},window.addEventListener("resize",ct)}function Ah(t){return us.add(t),ct||Eh(),()=>{us.delete(t),!us.size&&typeof ct=="function"&&(window.removeEventListener("resize",ct),ct=void 0)}}function si(t,e){return typeof t=="function"?Ah(t):kh(t,e)}function Ph(t){return yr(t)&&t.tagName==="svg"}const Ch=[...bo,U,fe],Rh=t=>Ch.find(wo(t)),ni=()=>({translate:0,scale:1,origin:0,originPoint:0}),ut=()=>({x:ni(),y:ni()}),ri=()=>({min:0,max:0}),q=()=>({x:ri(),y:ri()}),jh=new WeakMap;function Rs(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}function Nt(t){return typeof t=="string"||Array.isArray(t)}const vr=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],wr=["initial",...vr];function js(t){return Rs(t.animate)||wr.some(e=>Nt(t[e]))}function Co(t){return!!(js(t)||t.variants)}function Oh(t,e,s){for(const n in e){const r=e[n],i=s[n];if(J(r))t.addValue(n,r);else if(J(i))t.addValue(n,gt(r,{owner:t}));else if(i!==r)if(t.hasValue(n)){const a=t.getValue(n);a.liveStyle===!0?a.jump(r):a.hasAnimated||a.set(r)}else{const a=t.getStaticValue(n);t.addValue(n,gt(a!==void 0?a:r,{owner:t}))}}for(const n in s)e[n]===void 0&&t.removeValue(n);return e}const Pn={current:null},Ro={current:!1},Dh=typeof window<"u";function Ih(){if(Ro.current=!0,!!Dh)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>Pn.current=t.matches;t.addEventListener("change",e),e()}else Pn.current=!1}const ii=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let bs={};function jo(t){bs=t}function Nh(){return bs}class Mh{scrapeMotionValuesFromProps(e,s,n){return{}}constructor({parent:e,props:s,presenceContext:n,reducedMotionConfig:r,skipAnimations:i,blockInitialAnimation:a,visualState:o},l={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=cr,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const f=Y.now();this.renderScheduledAt<f&&(this.renderScheduledAt=f,D.render(this.render,!1,!0))};const{latestValues:c,renderState:u}=o;this.latestValues=c,this.baseTarget={...c},this.initialValues=s.initial?{...c}:{},this.renderState=u,this.parent=e,this.props=s,this.presenceContext=n,this.depth=e?e.depth+1:0,this.reducedMotionConfig=r,this.skipAnimationsConfig=i,this.options=l,this.blockInitialAnimation=!!a,this.isControllingVariants=js(s),this.isVariantNode=Co(s),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:h,...d}=this.scrapeMotionValuesFromProps(s,{},this);for(const f in d){const m=d[f];c[f]!==void 0&&J(m)&&m.set(c[f])}}mount(e){var s,n;if(this.hasBeenMounted)for(const r in this.initialValues)(s=this.values.get(r))==null||s.jump(this.initialValues[r]),this.latestValues[r]=this.initialValues[r];this.current=e,jh.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((r,i)=>this.bindToMotionValue(i,r)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(Ro.current||Ih(),this.shouldReduceMotion=Pn.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,(n=this.parent)==null||n.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){var e;this.projection&&this.projection.unmount(),Ie(this.notifyUpdate),Ie(this.render),this.valueSubscriptions.forEach(s=>s()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),(e=this.parent)==null||e.removeChild(this);for(const s in this.events)this.events[s].clear();for(const s in this.features){const n=this.features[s];n&&(n.unmount(),n.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,s){if(this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)(),s.accelerate&&uo.has(e)&&this.current instanceof HTMLElement){const{factory:a,keyframes:o,times:l,ease:c,duration:u}=s.accelerate,h=new lo({element:this.current,name:e,keyframes:o,times:l,ease:c,duration:Q(u)}),d=a(h);this.valueSubscriptions.set(e,()=>{d(),h.cancel()});return}const n=xt.has(e);n&&this.onBindTransform&&this.onBindTransform();const r=s.on("change",a=>{this.latestValues[e]=a,this.props.onUpdate&&D.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let i;typeof window<"u"&&window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,e,s)),this.valueSubscriptions.set(e,()=>{r(),i&&i(),s.owner&&s.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in bs){const s=bs[e];if(!s)continue;const{isEnabled:n,Feature:r}=s;if(!this.features[e]&&r&&n(this.props)&&(this.features[e]=new r(this)),this.features[e]){const i=this.features[e];i.isMounted?i.update():(i.mount(),i.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):q()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,s){this.latestValues[e]=s}update(e,s){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=s;for(let n=0;n<ii.length;n++){const r=ii[n];this.propEventSubscriptions[r]&&(this.propEventSubscriptions[r](),delete this.propEventSubscriptions[r]);const i="on"+r,a=e[i];a&&(this.propEventSubscriptions[r]=this.on(r,a))}this.prevMotionValues=Oh(this,this.scrapeMotionValuesFromProps(e,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){const s=this.getClosestVariantNode();if(s)return s.variantChildren&&s.variantChildren.add(e),()=>s.variantChildren.delete(e)}addValue(e,s){const n=this.values.get(e);s!==n&&(n&&this.removeValue(e),this.bindToMotionValue(e,s),this.values.set(e,s),this.latestValues[e]=s.get())}removeValue(e){this.values.delete(e);const s=this.valueSubscriptions.get(e);s&&(s(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,s){if(this.props.values&&this.props.values[e])return this.props.values[e];let n=this.values.get(e);return n===void 0&&s!==void 0&&(n=gt(s===null?void 0:s,{owner:this}),this.addValue(e,n)),n}readValue(e,s){let n=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return n!=null&&(typeof n=="string"&&(Pa(n)||Ra(n))?n=parseFloat(n):!Rh(n)&&fe.test(s)&&(n=_o(e,s)),this.setBaseTarget(e,J(n)?n.get():n)),J(n)?n.get():n}setBaseTarget(e,s){this.baseTarget[e]=s}getBaseTarget(e){var i;const{initial:s}=this.props;let n;if(typeof s=="string"||typeof s=="object"){const a=dr(this.props,s,(i=this.presenceContext)==null?void 0:i.custom);a&&(n=a[e])}if(s&&n!==void 0)return n;const r=this.getBaseTargetFromProps(this.props,e);return r!==void 0&&!J(r)?r:this.initialValues[e]!==void 0&&n===void 0?void 0:this.baseTarget[e]}on(e,s){return this.events[e]||(this.events[e]=new er),this.events[e].add(s)}notify(e,...s){this.events[e]&&this.events[e].notify(...s)}scheduleRenderMicrotask(){mr.render(this.render)}}class Oo extends Mh{constructor(){super(...arguments),this.KeyframeResolver=uh}sortInstanceNodePosition(e,s){return e.compareDocumentPosition(s)&2?1:-1}getBaseTargetFromProps(e,s){const n=e.style;return n?n[s]:void 0}removeValueFromRenderState(e,{vars:s,style:n}){delete s[e],delete n[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;J(e)&&(this.childSubscription=e.on("change",s=>{this.current&&(this.current.textContent=`${s}`)}))}}class Me{constructor(e){this.isMounted=!1,this.node=e}update(){}}function Do({top:t,left:e,right:s,bottom:n}){return{x:{min:e,max:s},y:{min:t,max:n}}}function $h({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function Lh(t,e){if(!e)return t;const s=e({x:t.left,y:t.top}),n=e({x:t.right,y:t.bottom});return{top:s.y,left:s.x,bottom:n.y,right:n.x}}function qs(t){return t===void 0||t===1}function Cn({scale:t,scaleX:e,scaleY:s}){return!qs(t)||!qs(e)||!qs(s)}function Ue(t){return Cn(t)||Io(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function Io(t){return ai(t.x)||ai(t.y)}function ai(t){return t&&t!=="0%"}function xs(t,e,s){const n=t-s,r=e*n;return s+r}function oi(t,e,s,n,r){return r!==void 0&&(t=xs(t,r,n)),xs(t,s,n)+e}function Rn(t,e=0,s=1,n,r){t.min=oi(t.min,e,s,n,r),t.max=oi(t.max,e,s,n,r)}function No(t,{x:e,y:s}){Rn(t.x,e.translate,e.scale,e.originPoint),Rn(t.y,s.translate,s.scale,s.originPoint)}const li=.999999999999,ci=1.0000000000001;function Bh(t,e,s,n=!1){var o;const r=s.length;if(!r)return;e.x=e.y=1;let i,a;for(let l=0;l<r;l++){i=s[l],a=i.projectionDelta;const{visualElement:c}=i.options;c&&c.props.style&&c.props.style.display==="contents"||(n&&i.options.layoutScroll&&i.scroll&&i!==i.root&&(ve(t.x,-i.scroll.offset.x),ve(t.y,-i.scroll.offset.y)),a&&(e.x*=a.x.scale,e.y*=a.y.scale,No(t,a)),n&&Ue(i.latestValues)&&hs(t,i.latestValues,(o=i.layout)==null?void 0:o.layoutBox))}e.x<ci&&e.x>li&&(e.x=1),e.y<ci&&e.y>li&&(e.y=1)}function ve(t,e){t.min+=e,t.max+=e}function ui(t,e,s,n,r=.5){const i=N(t.min,t.max,r);Rn(t,e,s,i,n)}function hi(t,e){return typeof t=="string"?parseFloat(t)/100*(e.max-e.min):t}function hs(t,e,s){const n=s??t;ui(t.x,hi(e.x,n.x),e.scaleX,e.scale,e.originX),ui(t.y,hi(e.y,n.y),e.scaleY,e.scale,e.originY)}function Mo(t,e){return Do(Lh(t.getBoundingClientRect(),e))}function Vh(t,e,s){const n=Mo(t,s),{scroll:r}=e;return r&&(ve(n.x,r.offset.x),ve(n.y,r.offset.y)),n}const Uh={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},Fh=bt.length;function qh(t,e,s){let n="",r=!0;for(let i=0;i<Fh;i++){const a=bt[i],o=t[a];if(o===void 0)continue;let l=!0;if(typeof o=="number")l=o===(a.startsWith("scale")?1:0);else{const c=parseFloat(o);l=a.startsWith("scale")?c===1:c===0}if(!l||s){const c=To(o,pr[a]);if(!l){r=!1;const u=Uh[a]||a;n+=`${u}(${c}) `}s&&(e[a]=c)}}return n=n.trim(),s?n=s(e,r?"":n):r&&(n="none"),n}function br(t,e,s){const{style:n,vars:r,transformOrigin:i}=t;let a=!1,o=!1;for(const l in e){const c=e[l];if(xt.has(l)){a=!0;continue}else if(Ha(l)){r[l]=c;continue}else{const u=To(c,pr[l]);l.startsWith("origin")?(o=!0,i[l]=u):n[l]=u}}if(e.transform||(a||s?n.transform=qh(e,t.transform,s):n.transform&&(n.transform="none")),o){const{originX:l="50%",originY:c="50%",originZ:u=0}=i;n.transformOrigin=`${l} ${c} ${u}`}}function $o(t,{style:e,vars:s},n,r){const i=t.style;let a;for(a in e)i[a]=e[a];r==null||r.applyProjectionStyles(i,n);for(a in s)i.setProperty(a,s[a])}function di(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const _t={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(k.test(t))t=parseFloat(t);else return t;const s=di(t,e.target.x),n=di(t,e.target.y);return`${s}% ${n}%`}},Wh={correct:(t,{treeScale:e,projectionDelta:s})=>{const n=t,r=fe.parse(t);if(r.length>5)return n;const i=fe.createTransformer(t),a=typeof r[0]!="number"?1:0,o=s.x.scale*e.x,l=s.y.scale*e.y;r[0+a]/=o,r[1+a]/=l;const c=N(o,l,.5);return typeof r[2+a]=="number"&&(r[2+a]/=c),typeof r[3+a]=="number"&&(r[3+a]/=c),i(r)}},jn={borderRadius:{..._t,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:_t,borderTopRightRadius:_t,borderBottomLeftRadius:_t,borderBottomRightRadius:_t,boxShadow:Wh};function Lo(t,{layout:e,layoutId:s}){return xt.has(t)||t.startsWith("origin")||(e||s!==void 0)&&(!!jn[t]||t==="opacity")}function xr(t,e,s){var a;const n=t.style,r=e==null?void 0:e.style,i={};if(!n)return i;for(const o in n)(J(n[o])||r&&J(r[o])||Lo(o,t)||((a=s==null?void 0:s.getValue(o))==null?void 0:a.liveStyle)!==void 0)&&(i[o]=n[o]);return i}function Hh(t){return window.getComputedStyle(t)}class Kh extends Oo{constructor(){super(...arguments),this.type="html",this.renderInstance=$o}readValueFromInstance(e,s){var n;if(xt.has(s))return(n=this.projection)!=null&&n.isProjecting?yn(s):hu(e,s);{const r=Hh(e),i=(Ha(s)?r.getPropertyValue(s):r[s])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(e,{transformPagePoint:s}){return Mo(e,s)}build(e,s,n){br(e,s,n.transformTemplate)}scrapeMotionValuesFromProps(e,s,n){return xr(e,s,n)}}const Gh={offset:"stroke-dashoffset",array:"stroke-dasharray"},zh={offset:"strokeDashoffset",array:"strokeDasharray"};function Jh(t,e,s=1,n=0,r=!0){t.pathLength=1;const i=r?Gh:zh;t[i.offset]=`${-n}`,t[i.array]=`${e} ${s}`}const Yh=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function Bo(t,{attrX:e,attrY:s,attrScale:n,pathLength:r,pathSpacing:i=1,pathOffset:a=0,...o},l,c,u){if(br(t,o,c),l){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:h,style:d}=t;h.transform&&(d.transform=h.transform,delete h.transform),(d.transform||h.transformOrigin)&&(d.transformOrigin=h.transformOrigin??"50% 50%",delete h.transformOrigin),d.transform&&(d.transformBox=(u==null?void 0:u.transformBox)??"fill-box",delete h.transformBox);for(const f of Yh)h[f]!==void 0&&(d[f]=h[f],delete h[f]);e!==void 0&&(h.x=e),s!==void 0&&(h.y=s),n!==void 0&&(h.scale=n),r!==void 0&&Jh(h,r,i,a,!1)}const Vo=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),Uo=t=>typeof t=="string"&&t.toLowerCase()==="svg";function Xh(t,e,s,n){$o(t,e,void 0,n);for(const r in e.attrs)t.setAttribute(Vo.has(r)?r:fr(r),e.attrs[r])}function Fo(t,e,s){const n=xr(t,e,s);for(const r in t)if(J(t[r])||J(e[r])){const i=bt.indexOf(r)!==-1?"attr"+r.charAt(0).toUpperCase()+r.substring(1):r;n[i]=t[r]}return n}class Qh extends Oo{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=q}getBaseTargetFromProps(e,s){return e[s]}readValueFromInstance(e,s){if(xt.has(s)){const n=xo(s);return n&&n.default||0}return s=Vo.has(s)?s:fr(s),e.getAttribute(s)}scrapeMotionValuesFromProps(e,s,n){return Fo(e,s,n)}build(e,s,n){Bo(e,s,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(e,s,n,r){Xh(e,s,n,r)}mount(e){this.isSVGTag=Uo(e.tagName),super.mount(e)}}const Zh=wr.length;function qo(t){if(!t)return;if(!t.isControllingVariants){const s=t.parent?qo(t.parent)||{}:{};return t.props.initial!==void 0&&(s.initial=t.props.initial),s}const e={};for(let s=0;s<Zh;s++){const n=wr[s],r=t.props[n];(Nt(r)||r===!1)&&(e[n]=r)}return e}function Wo(t,e){if(!Array.isArray(e))return!1;const s=e.length;if(s!==t.length)return!1;for(let n=0;n<s;n++)if(e[n]!==t[n])return!1;return!0}const ed=[...vr].reverse(),td=vr.length;function sd(t){return e=>Promise.all(e.map(({animation:s,options:n})=>Zu(t,s,n)))}function nd(t){let e=sd(t),s=fi(),n=!0,r=!1;const i=c=>(u,h)=>{var f;const d=Ye(t,h,c==="exit"?(f=t.presenceContext)==null?void 0:f.custom:void 0);if(d){const{transition:m,transitionEnd:y,...g}=d;u={...u,...g,...y}}return u};function a(c){e=c(t)}function o(c){const{props:u}=t,h=qo(t.parent)||{},d=[],f=new Set;let m={},y=1/0;for(let v=0;v<td;v++){const x=ed[v],w=s[x],b=u[x]!==void 0?u[x]:h[x],S=Nt(b),T=x===c?w.isActive:null;T===!1&&(y=v);let j=b===h[x]&&b!==u[x]&&S;if(j&&(n||r)&&t.manuallyAnimateOnMount&&(j=!1),w.protectedKeys={...m},!w.isActive&&T===null||!b&&!w.prevProp||Rs(b)||typeof b=="boolean")continue;if(x==="exit"&&w.isActive&&T!==!0){w.prevResolvedValues&&(m={...m,...w.prevResolvedValues});continue}const E=rd(w.prevProp,b);let O=E||x===c&&w.isActive&&!j&&S||v>y&&S,P=!1;const M=Array.isArray(b)?b:[b];let W=M.reduce(i(x),{});T===!1&&(W={});const{prevResolvedValues:xe={}}=w,pe={...xe,...W},_e=H=>{O=!0,f.has(H)&&(P=!0,f.delete(H)),w.needsAnimating[H]=!0;const se=t.getValue(H);se&&(se.liveStyle=!1)};for(const H in pe){const se=W[H],$e=xe[H];if(m.hasOwnProperty(H))continue;let Xe=!1;Sn(se)&&Sn($e)?Xe=!Wo(se,$e):Xe=se!==$e,Xe?se!=null?_e(H):f.add(H):se!==void 0&&f.has(H)?_e(H):w.protectedKeys[H]=!0}w.prevProp=b,w.prevResolvedValues=W,w.isActive&&(m={...m,...W}),(n||r)&&t.blockInitialAnimation&&(O=!1);const me=j&&E;O&&(!me||P)&&d.push(...M.map(H=>{const se={type:x};if(typeof H=="string"&&(n||r)&&!me&&t.manuallyAnimateOnMount&&t.parent){const{parent:$e}=t,Xe=Ye($e,H);if($e.enteringChildren&&Xe){const{delayChildren:Wl}=Xe.transition||{};se.delay=ho($e.enteringChildren,t,Wl)}}return{animation:H,options:se}}))}if(f.size){const v={};if(typeof u.initial!="boolean"){const x=Ye(t,Array.isArray(u.initial)?u.initial[0]:u.initial);x&&x.transition&&(v.transition=x.transition)}f.forEach(x=>{const w=t.getBaseTarget(x),b=t.getValue(x);b&&(b.liveStyle=!0),v[x]=w??null}),d.push({animation:v})}let g=!!d.length;return n&&(u.initial===!1||u.initial===u.animate)&&!t.manuallyAnimateOnMount&&(g=!1),n=!1,r=!1,g?e(d):Promise.resolve()}function l(c,u){var d;if(s[c].isActive===u)return Promise.resolve();(d=t.variantChildren)==null||d.forEach(f=>{var m;return(m=f.animationState)==null?void 0:m.setActive(c,u)}),s[c].isActive=u;const h=o(c);for(const f in s)s[f].protectedKeys={};return h}return{animateChanges:o,setActive:l,setAnimateFunction:a,getState:()=>s,reset:()=>{s=fi(),r=!0}}}function rd(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!Wo(e,t):!1}function Le(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function fi(){return{animate:Le(!0),whileInView:Le(),whileHover:Le(),whileTap:Le(),whileDrag:Le(),whileFocus:Le(),exit:Le()}}function On(t,e){t.min=e.min,t.max=e.max}function oe(t,e){On(t.x,e.x),On(t.y,e.y)}function pi(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}const Ho=1e-4,id=1-Ho,ad=1+Ho,Ko=.01,od=0-Ko,ld=0+Ko;function X(t){return t.max-t.min}function cd(t,e,s){return Math.abs(t-e)<=s}function mi(t,e,s,n=.5){t.origin=n,t.originPoint=N(e.min,e.max,t.origin),t.scale=X(s)/X(e),t.translate=N(s.min,s.max,t.origin)-t.originPoint,(t.scale>=id&&t.scale<=ad||isNaN(t.scale))&&(t.scale=1),(t.translate>=od&&t.translate<=ld||isNaN(t.translate))&&(t.translate=0)}function At(t,e,s,n){mi(t.x,e.x,s.x,n?n.originX:void 0),mi(t.y,e.y,s.y,n?n.originY:void 0)}function gi(t,e,s,n=0){const r=n?N(s.min,s.max,n):s.min;t.min=r+e.min,t.max=t.min+X(e)}function ud(t,e,s,n){gi(t.x,e.x,s.x,n==null?void 0:n.x),gi(t.y,e.y,s.y,n==null?void 0:n.y)}function yi(t,e,s,n=0){const r=n?N(s.min,s.max,n):s.min;t.min=e.min-r,t.max=t.min+X(e)}function _s(t,e,s,n){yi(t.x,e.x,s.x,n==null?void 0:n.x),yi(t.y,e.y,s.y,n==null?void 0:n.y)}function vi(t,e,s,n,r){return t-=e,t=xs(t,1/s,n),r!==void 0&&(t=xs(t,1/r,n)),t}function hd(t,e=0,s=1,n=.5,r,i=t,a=t){if(we.test(e)&&(e=parseFloat(e),e=N(a.min,a.max,e/100)-a.min),typeof e!="number")return;let o=N(i.min,i.max,n);t===i&&(o-=e),t.min=vi(t.min,e,s,o,r),t.max=vi(t.max,e,s,o,r)}function wi(t,e,[s,n,r],i,a){hd(t,e[s],e[n],e[r],e.scale,i,a)}const dd=["x","scaleX","originX"],fd=["y","scaleY","originY"];function bi(t,e,s,n){wi(t.x,e,dd,s?s.x:void 0,n?n.x:void 0),wi(t.y,e,fd,s?s.y:void 0,n?n.y:void 0)}function xi(t){return t.translate===0&&t.scale===1}function Go(t){return xi(t.x)&&xi(t.y)}function _i(t,e){return t.min===e.min&&t.max===e.max}function pd(t,e){return _i(t.x,e.x)&&_i(t.y,e.y)}function Si(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function zo(t,e){return Si(t.x,e.x)&&Si(t.y,e.y)}function Ti(t){return X(t.x)/X(t.y)}function ki(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}function ye(t){return[t("x"),t("y")]}function md(t,e,s){let n="";const r=t.x.translate/e.x,i=t.y.translate/e.y,a=(s==null?void 0:s.z)||0;if((r||i||a)&&(n=`translate3d(${r}px, ${i}px, ${a}px) `),(e.x!==1||e.y!==1)&&(n+=`scale(${1/e.x}, ${1/e.y}) `),s){const{transformPerspective:c,rotate:u,rotateX:h,rotateY:d,skewX:f,skewY:m}=s;c&&(n=`perspective(${c}px) ${n}`),u&&(n+=`rotate(${u}deg) `),h&&(n+=`rotateX(${h}deg) `),d&&(n+=`rotateY(${d}deg) `),f&&(n+=`skewX(${f}deg) `),m&&(n+=`skewY(${m}deg) `)}const o=t.x.scale*e.x,l=t.y.scale*e.y;return(o!==1||l!==1)&&(n+=`scale(${o}, ${l})`),n||"none"}const Jo=["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"],gd=Jo.length,Ei=t=>typeof t=="string"?parseFloat(t):t,Ai=t=>typeof t=="number"||k.test(t);function yd(t,e,s,n,r,i){r?(t.opacity=N(0,s.opacity??1,vd(n)),t.opacityExit=N(e.opacity??1,0,wd(n))):i&&(t.opacity=N(e.opacity??1,s.opacity??1,n));for(let a=0;a<gd;a++){const o=Jo[a];let l=Pi(e,o),c=Pi(s,o);if(l===void 0&&c===void 0)continue;l||(l=0),c||(c=0),l===0||c===0||Ai(l)===Ai(c)?(t[o]=Math.max(N(Ei(l),Ei(c),n),0),(we.test(c)||we.test(l))&&(t[o]+="%")):t[o]=c}(e.rotate||s.rotate)&&(t.rotate=N(e.rotate||0,s.rotate||0,n))}function Pi(t,e){return t[e]!==void 0?t[e]:t.borderRadius}const vd=Yo(0,.5,Ba),wd=Yo(.5,.95,ie);function Yo(t,e,s){return n=>n<t?0:n>e?1:s(Dt(t,e,n))}function bd(t,e,s){const n=J(t)?t:gt(t);return n.start(hr("",n,e,s)),n.animation}function Mt(t,e,s,n={passive:!0}){return t.addEventListener(e,s,n),()=>t.removeEventListener(e,s)}const xd=(t,e)=>t.depth-e.depth;class _d{constructor(){this.children=[],this.isDirty=!1}add(e){Zn(this.children,e),this.isDirty=!0}remove(e){ms(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(xd),this.isDirty=!1,this.children.forEach(e)}}function Sd(t,e){const s=Y.now(),n=({timestamp:r})=>{const i=r-s;i>=e&&(Ie(n),t(i-e))};return D.setup(n,!0),()=>Ie(n)}function ds(t){return J(t)?t.get():t}class Td{constructor(){this.members=[]}add(e){Zn(this.members,e);for(let s=this.members.length-1;s>=0;s--){const n=this.members[s];if(n===e||n===this.lead||n===this.prevLead)continue;const r=n.instance;(!r||r.isConnected===!1)&&!n.snapshot&&(ms(this.members,n),n.unmount())}e.scheduleRender()}remove(e){if(ms(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const s=this.members[this.members.length-1];s&&this.promote(s)}}relegate(e){var s;for(let n=this.members.indexOf(e)-1;n>=0;n--){const r=this.members[n];if(r.isPresent!==!1&&((s=r.instance)==null?void 0:s.isConnected)!==!1)return this.promote(r),!0}return!1}promote(e,s){var r;const n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.updateSnapshot(),e.scheduleRender();const{layoutDependency:i}=n.options,{layoutDependency:a}=e.options;(i===void 0||i!==a)&&(e.resumeFrom=n,s&&(n.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),(r=e.root)!=null&&r.isUpdating&&(e.isLayoutDirty=!0)),e.options.crossfade===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(e=>{var s,n,r,i,a;(n=(s=e.options).onExitComplete)==null||n.call(s),(a=(r=e.resumingFrom)==null?void 0:(i=r.options).onExitComplete)==null||a.call(i)})}scheduleRender(){this.members.forEach(e=>e.instance&&e.scheduleRender(!1))}removeLeadSnapshot(){var e;(e=this.lead)!=null&&e.snapshot&&(this.lead.snapshot=void 0)}}const fs={hasAnimatedSinceResize:!0,hasEverUpdated:!1},Ws=["","X","Y","Z"],kd=1e3;let Ed=0;function Hs(t,e,s,n){const{latestValues:r}=e;r[t]&&(s[t]=r[t],e.setStaticValue(t,0),n&&(n[t]=0))}function Xo(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const s=yo(e);if(window.MotionHasOptimisedAnimation(s,"transform")){const{layout:r,layoutId:i}=t.options;window.MotionCancelOptimisedAnimation(s,"transform",D,!(r||i))}const{parent:n}=t;n&&!n.hasCheckedOptimisedAppear&&Xo(n)}function Qo({attachResizeListener:t,defaultParent:e,measureScroll:s,checkIsScrollRoot:n,resetTransform:r}){return class{constructor(a={},o=e==null?void 0:e()){this.id=Ed++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(Cd),this.nodes.forEach(Nd),this.nodes.forEach(Md),this.nodes.forEach(Rd)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=a,this.root=o?o.root||o:this,this.path=o?[...o.path,o]:[],this.parent=o,this.depth=o?o.depth+1:0;for(let l=0;l<this.path.length;l++)this.path[l].shouldResetTransform=!0;this.root===this&&(this.nodes=new _d)}addEventListener(a,o){return this.eventHandlers.has(a)||this.eventHandlers.set(a,new er),this.eventHandlers.get(a).add(o)}notifyListeners(a,...o){const l=this.eventHandlers.get(a);l&&l.notify(...o)}hasListeners(a){return this.eventHandlers.has(a)}mount(a){if(this.instance)return;this.isSVG=yr(a)&&!Ph(a),this.instance=a;const{layoutId:o,layout:l,visualElement:c}=this.options;if(c&&!c.current&&c.mount(a),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(l||o)&&(this.isLayoutDirty=!0),t){let u,h=0;const d=()=>this.root.updateBlockedByResize=!1;D.read(()=>{h=window.innerWidth}),t(a,()=>{const f=window.innerWidth;f!==h&&(h=f,this.root.updateBlockedByResize=!0,u&&u(),u=Sd(d,250),fs.hasAnimatedSinceResize&&(fs.hasAnimatedSinceResize=!1,this.nodes.forEach(ji)))})}o&&this.root.registerSharedNode(o,this),this.options.animate!==!1&&c&&(o||l)&&this.addEventListener("didUpdate",({delta:u,hasLayoutChanged:h,hasRelativeLayoutChanged:d,layout:f})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const m=this.options.transition||c.getDefaultTransition()||Ud,{onLayoutAnimationStart:y,onLayoutAnimationComplete:g}=c.getProps(),v=!this.targetLayout||!zo(this.targetLayout,f),x=!h&&d;if(this.options.layoutRoot||this.resumeFrom||x||h&&(v||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const w={...ur(m,"layout"),onPlay:y,onComplete:g};(c.shouldReduceMotion||this.options.layoutRoot)&&(w.delay=0,w.type=!1),this.startAnimation(w),this.setAnimationOrigin(u,x)}else h||ji(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=f})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const a=this.getStack();a&&a.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),Ie(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach($d),this.animationId++)}getTransformTemplate(){const{visualElement:a}=this.options;return a&&a.getProps().transformTemplate}willUpdate(a=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&Xo(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let u=0;u<this.path.length;u++){const h=this.path[u];h.shouldResetTransform=!0,(typeof h.latestValues.x=="string"||typeof h.latestValues.y=="string")&&(h.isLayoutDirty=!0),h.updateScroll("snapshot"),h.options.layoutRoot&&h.willUpdate(!1)}const{layoutId:o,layout:l}=this.options;if(o===void 0&&!l)return;const c=this.getTransformTemplate();this.prevTransformTemplateValue=c?c(this.latestValues,""):void 0,this.updateSnapshot(),a&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){const l=this.updateBlockedByResize;this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),l&&this.nodes.forEach(Od),this.nodes.forEach(Ci);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(Ri);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(Dd),this.nodes.forEach(Id),this.nodes.forEach(Ad),this.nodes.forEach(Pd)):this.nodes.forEach(Ri),this.clearAllSnapshots();const o=Y.now();z.delta=be(0,1e3/60,o-z.timestamp),z.timestamp=o,z.isProcessing=!0,Ms.update.process(z),Ms.preRender.process(z),Ms.render.process(z),z.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,mr.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(jd),this.sharedNodes.forEach(Ld)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,D.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){D.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!X(this.snapshot.measuredBox.x)&&!X(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let l=0;l<this.path.length;l++)this.path[l].updateScroll();const a=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected||(this.layoutCorrected=q()),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:o}=this.options;o&&o.notify("LayoutMeasure",this.layout.layoutBox,a?a.layoutBox:void 0)}updateScroll(a="measure"){let o=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===a&&(o=!1),o&&this.instance){const l=n(this.instance);this.scroll={animationId:this.root.animationId,phase:a,isRoot:l,offset:s(this.instance),wasRoot:this.scroll?this.scroll.isRoot:l}}}resetTransform(){if(!r)return;const a=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,o=this.projectionDelta&&!Go(this.projectionDelta),l=this.getTransformTemplate(),c=l?l(this.latestValues,""):void 0,u=c!==this.prevTransformTemplateValue;a&&this.instance&&(o||Ue(this.latestValues)||u)&&(r(this.instance,c),this.shouldResetTransform=!1,this.scheduleRender())}measure(a=!0){const o=this.measurePageBox();let l=this.removeElementScroll(o);return a&&(l=this.removeTransform(l)),Fd(l),{animationId:this.root.animationId,measuredBox:o,layoutBox:l,latestValues:{},source:this.id}}measurePageBox(){var c;const{visualElement:a}=this.options;if(!a)return q();const o=a.measureViewportBox();if(!(((c=this.scroll)==null?void 0:c.wasRoot)||this.path.some(qd))){const{scroll:u}=this.root;u&&(ve(o.x,u.offset.x),ve(o.y,u.offset.y))}return o}removeElementScroll(a){var l;const o=q();if(oe(o,a),(l=this.scroll)!=null&&l.wasRoot)return o;for(let c=0;c<this.path.length;c++){const u=this.path[c],{scroll:h,options:d}=u;u!==this.root&&h&&d.layoutScroll&&(h.wasRoot&&oe(o,a),ve(o.x,h.offset.x),ve(o.y,h.offset.y))}return o}applyTransform(a,o=!1,l){var u,h;const c=l||q();oe(c,a);for(let d=0;d<this.path.length;d++){const f=this.path[d];!o&&f.options.layoutScroll&&f.scroll&&f!==f.root&&(ve(c.x,-f.scroll.offset.x),ve(c.y,-f.scroll.offset.y)),Ue(f.latestValues)&&hs(c,f.latestValues,(u=f.layout)==null?void 0:u.layoutBox)}return Ue(this.latestValues)&&hs(c,this.latestValues,(h=this.layout)==null?void 0:h.layoutBox),c}removeTransform(a){var l;const o=q();oe(o,a);for(let c=0;c<this.path.length;c++){const u=this.path[c];if(!Ue(u.latestValues))continue;let h;u.instance&&(Cn(u.latestValues)&&u.updateSnapshot(),h=q(),oe(h,u.measurePageBox())),bi(o,u.latestValues,(l=u.snapshot)==null?void 0:l.layoutBox,h)}return Ue(this.latestValues)&&bi(o,this.latestValues),o}setTargetDelta(a){this.targetDelta=a,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(a){this.options={...this.options,...a,crossfade:a.crossfade!==void 0?a.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==z.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(a=!1){var f;const o=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=o.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=o.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=o.isSharedProjectionDirty);const l=!!this.resumingFrom||this!==o;if(!(a||l&&this.isSharedProjectionDirty||this.isProjectionDirty||(f=this.parent)!=null&&f.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:u,layoutId:h}=this.options;if(!this.layout||!(u||h))return;this.resolvedRelativeTargetAt=z.timestamp;const d=this.getClosestProjectingParent();d&&this.linkedParentVersion!==d.layoutVersion&&!d.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(this.options.layoutAnchor!==!1&&d&&d.layout?this.createRelativeTarget(d,this.layout.layoutBox,d.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=q(),this.targetWithTransforms=q()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),ud(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):oe(this.target,this.layout.layoutBox),No(this.target,this.targetDelta)):oe(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,this.options.layoutAnchor!==!1&&d&&!!d.resumingFrom==!!this.resumingFrom&&!d.options.layoutScroll&&d.target&&this.animationProgress!==1?this.createRelativeTarget(d,this.target,d.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||Cn(this.parent.latestValues)||Io(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(a,o,l){this.relativeParent=a,this.linkedParentVersion=a.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=q(),this.relativeTargetOrigin=q(),_s(this.relativeTargetOrigin,o,l,this.options.layoutAnchor||void 0),oe(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){var m;const a=this.getLead(),o=!!this.resumingFrom||this!==a;let l=!0;if((this.isProjectionDirty||(m=this.parent)!=null&&m.isProjectionDirty)&&(l=!1),o&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(l=!1),this.resolvedRelativeTargetAt===z.timestamp&&(l=!1),l)return;const{layout:c,layoutId:u}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(c||u))return;oe(this.layoutCorrected,this.layout.layoutBox);const h=this.treeScale.x,d=this.treeScale.y;Bh(this.layoutCorrected,this.treeScale,this.path,o),a.layout&&!a.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(a.target=a.layout.layoutBox,a.targetWithTransforms=q());const{target:f}=a;if(!f){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(pi(this.prevProjectionDelta.x,this.projectionDelta.x),pi(this.prevProjectionDelta.y,this.projectionDelta.y)),At(this.projectionDelta,this.layoutCorrected,f,this.latestValues),(this.treeScale.x!==h||this.treeScale.y!==d||!ki(this.projectionDelta.x,this.prevProjectionDelta.x)||!ki(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",f))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(a=!0){var o;if((o=this.options.visualElement)==null||o.scheduleRender(),a){const l=this.getStack();l&&l.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=ut(),this.projectionDelta=ut(),this.projectionDeltaWithTransform=ut()}setAnimationOrigin(a,o=!1){const l=this.snapshot,c=l?l.latestValues:{},u={...this.latestValues},h=ut();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!o;const d=q(),f=l?l.source:void 0,m=this.layout?this.layout.source:void 0,y=f!==m,g=this.getStack(),v=!g||g.members.length<=1,x=!!(y&&!v&&this.options.crossfade===!0&&!this.path.some(Vd));this.animationProgress=0;let w;this.mixTargetDelta=b=>{const S=b/1e3;Oi(h.x,a.x,S),Oi(h.y,a.y,S),this.setTargetDelta(h),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(_s(d,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),Bd(this.relativeTarget,this.relativeTargetOrigin,d,S),w&&pd(this.relativeTarget,w)&&(this.isProjectionDirty=!1),w||(w=q()),oe(w,this.relativeTarget)),y&&(this.animationValues=u,yd(u,c,this.latestValues,S,x,v)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=S},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(a){var o,l,c;this.notifyListeners("animationStart"),(o=this.currentAnimation)==null||o.stop(),(c=(l=this.resumingFrom)==null?void 0:l.currentAnimation)==null||c.stop(),this.pendingAnimation&&(Ie(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=D.update(()=>{fs.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=gt(0)),this.motionValue.jump(0,!1),this.currentAnimation=bd(this.motionValue,[0,1e3],{...a,velocity:0,isSync:!0,onUpdate:u=>{this.mixTargetDelta(u),a.onUpdate&&a.onUpdate(u)},onStop:()=>{},onComplete:()=>{a.onComplete&&a.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const a=this.getStack();a&&a.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(kd),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const a=this.getLead();let{targetWithTransforms:o,target:l,layout:c,latestValues:u}=a;if(!(!o||!l||!c)){if(this!==a&&this.layout&&c&&Zo(this.options.animationType,this.layout.layoutBox,c.layoutBox)){l=this.target||q();const h=X(this.layout.layoutBox.x);l.x.min=a.target.x.min,l.x.max=l.x.min+h;const d=X(this.layout.layoutBox.y);l.y.min=a.target.y.min,l.y.max=l.y.min+d}oe(o,l),hs(o,u),At(this.projectionDeltaWithTransform,this.layoutCorrected,o,u)}}registerSharedNode(a,o){this.sharedNodes.has(a)||this.sharedNodes.set(a,new Td),this.sharedNodes.get(a).add(o);const c=o.options.initialPromotionConfig;o.promote({transition:c?c.transition:void 0,preserveFollowOpacity:c&&c.shouldPreserveFollowOpacity?c.shouldPreserveFollowOpacity(o):void 0})}isLead(){const a=this.getStack();return a?a.lead===this:!0}getLead(){var o;const{layoutId:a}=this.options;return a?((o=this.getStack())==null?void 0:o.lead)||this:this}getPrevLead(){var o;const{layoutId:a}=this.options;return a?(o=this.getStack())==null?void 0:o.prevLead:void 0}getStack(){const{layoutId:a}=this.options;if(a)return this.root.sharedNodes.get(a)}promote({needsReset:a,transition:o,preserveFollowOpacity:l}={}){const c=this.getStack();c&&c.promote(this,l),a&&(this.projectionDelta=void 0,this.needsReset=!0),o&&this.setOptions({transition:o})}relegate(){const a=this.getStack();return a?a.relegate(this):!1}resetSkewAndRotation(){const{visualElement:a}=this.options;if(!a)return;let o=!1;const{latestValues:l}=a;if((l.z||l.rotate||l.rotateX||l.rotateY||l.rotateZ||l.skewX||l.skewY)&&(o=!0),!o)return;const c={};l.z&&Hs("z",a,c,this.animationValues);for(let u=0;u<Ws.length;u++)Hs(`rotate${Ws[u]}`,a,c,this.animationValues),Hs(`skew${Ws[u]}`,a,c,this.animationValues);a.render();for(const u in c)a.setStaticValue(u,c[u]),this.animationValues&&(this.animationValues[u]=c[u]);a.scheduleRender()}applyProjectionStyles(a,o){if(!this.instance||this.isSVG)return;if(!this.isVisible){a.visibility="hidden";return}const l=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,a.visibility="",a.opacity="",a.pointerEvents=ds(o==null?void 0:o.pointerEvents)||"",a.transform=l?l(this.latestValues,""):"none";return}const c=this.getLead();if(!this.projectionDelta||!this.layout||!c.target){this.options.layoutId&&(a.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,a.pointerEvents=ds(o==null?void 0:o.pointerEvents)||""),this.hasProjected&&!Ue(this.latestValues)&&(a.transform=l?l({},""):"none",this.hasProjected=!1);return}a.visibility="";const u=c.animationValues||c.latestValues;this.applyTransformsToTarget();let h=md(this.projectionDeltaWithTransform,this.treeScale,u);l&&(h=l(u,h)),a.transform=h;const{x:d,y:f}=this.projectionDelta;a.transformOrigin=`${d.origin*100}% ${f.origin*100}% 0`,c.animationValues?a.opacity=c===this?u.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:u.opacityExit:a.opacity=c===this?u.opacity!==void 0?u.opacity:"":u.opacityExit!==void 0?u.opacityExit:0;for(const m in jn){if(u[m]===void 0)continue;const{correct:y,applyTo:g,isCSSVariable:v}=jn[m],x=h==="none"?u[m]:y(u[m],c);if(g){const w=g.length;for(let b=0;b<w;b++)a[g[b]]=x}else v?this.options.visualElement.renderState.vars[m]=x:a[m]=x}this.options.layoutId&&(a.pointerEvents=c===this?ds(o==null?void 0:o.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(a=>{var o;return(o=a.currentAnimation)==null?void 0:o.stop()}),this.root.nodes.forEach(Ci),this.root.sharedNodes.clear()}}}function Ad(t){t.updateLayout()}function Pd(t){var s;const e=((s=t.resumeFrom)==null?void 0:s.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&e&&t.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:r}=t.layout,{animationType:i}=t.options,a=e.source!==t.layout.source;if(i==="size")ye(h=>{const d=a?e.measuredBox[h]:e.layoutBox[h],f=X(d);d.min=n[h].min,d.max=d.min+f});else if(i==="x"||i==="y"){const h=i==="x"?"y":"x";On(a?e.measuredBox[h]:e.layoutBox[h],n[h])}else Zo(i,e.layoutBox,n)&&ye(h=>{const d=a?e.measuredBox[h]:e.layoutBox[h],f=X(n[h]);d.max=d.min+f,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[h].max=t.relativeTarget[h].min+f)});const o=ut();At(o,n,e.layoutBox);const l=ut();a?At(l,t.applyTransform(r,!0),e.measuredBox):At(l,n,e.layoutBox);const c=!Go(o);let u=!1;if(!t.resumeFrom){const h=t.getClosestProjectingParent();if(h&&!h.resumeFrom){const{snapshot:d,layout:f}=h;if(d&&f){const m=t.options.layoutAnchor||void 0,y=q();_s(y,e.layoutBox,d.layoutBox,m);const g=q();_s(g,n,f.layoutBox,m),zo(y,g)||(u=!0),h.options.layoutRoot&&(t.relativeTarget=g,t.relativeTargetOrigin=y,t.relativeParent=h)}}}t.notifyListeners("didUpdate",{layout:n,snapshot:e,delta:l,layoutDelta:o,hasLayoutChanged:c,hasRelativeLayoutChanged:u})}else if(t.isLead()){const{onExitComplete:n}=t.options;n&&n()}t.options.transition=void 0}function Cd(t){t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function Rd(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function jd(t){t.clearSnapshot()}function Ci(t){t.clearMeasurements()}function Od(t){t.isLayoutDirty=!0,t.updateLayout()}function Ri(t){t.isLayoutDirty=!1}function Dd(t){t.isAnimationBlocked&&t.layout&&!t.isLayoutDirty&&(t.snapshot=t.layout,t.isLayoutDirty=!0)}function Id(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function ji(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function Nd(t){t.resolveTargetDelta()}function Md(t){t.calcProjection()}function $d(t){t.resetSkewAndRotation()}function Ld(t){t.removeLeadSnapshot()}function Oi(t,e,s){t.translate=N(e.translate,0,s),t.scale=N(e.scale,1,s),t.origin=e.origin,t.originPoint=e.originPoint}function Di(t,e,s,n){t.min=N(e.min,s.min,n),t.max=N(e.max,s.max,n)}function Bd(t,e,s,n){Di(t.x,e.x,s.x,n),Di(t.y,e.y,s.y,n)}function Vd(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const Ud={duration:.45,ease:[.4,0,.1,1]},Ii=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),Ni=Ii("applewebkit/")&&!Ii("chrome/")?Math.round:ie;function Mi(t){t.min=Ni(t.min),t.max=Ni(t.max)}function Fd(t){Mi(t.x),Mi(t.y)}function Zo(t,e,s){return t==="position"||t==="preserve-aspect"&&!cd(Ti(e),Ti(s),.2)}function qd(t){var e;return t!==t.root&&((e=t.scroll)==null?void 0:e.wasRoot)}const Wd=Qo({attachResizeListener:(t,e)=>Mt(t,"resize",e),measureScroll:()=>{var t,e;return{x:document.documentElement.scrollLeft||((t=document.body)==null?void 0:t.scrollLeft)||0,y:document.documentElement.scrollTop||((e=document.body)==null?void 0:e.scrollTop)||0}},checkIsScrollRoot:()=>!0}),Ks={current:void 0},el=Qo({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!Ks.current){const t=new Wd({});t.mount(window),t.setOptions({layoutScroll:!0}),Ks.current=t}return Ks.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),_r=_.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});function $i(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Hd(...t){return e=>{let s=!1;const n=t.map(r=>{const i=$i(r,e);return!s&&typeof i=="function"&&(s=!0),i});if(s)return()=>{for(let r=0;r<n.length;r++){const i=n[r];typeof i=="function"?i():$i(t[r],null)}}}}function Kd(...t){return _.useCallback(Hd(...t),t)}class Gd extends _.Component{getSnapshotBeforeUpdate(e){const s=this.props.childRef.current;if(os(s)&&e.isPresent&&!this.props.isPresent&&this.props.pop!==!1){const n=s.offsetParent,r=os(n)&&n.offsetWidth||0,i=os(n)&&n.offsetHeight||0,a=getComputedStyle(s),o=this.props.sizeRef.current;o.height=parseFloat(a.height),o.width=parseFloat(a.width),o.top=s.offsetTop,o.left=s.offsetLeft,o.right=r-o.width-o.left,o.bottom=i-o.height-o.top}return null}componentDidUpdate(){}render(){return this.props.children}}function zd({children:t,isPresent:e,anchorX:s,anchorY:n,root:r,pop:i}){var d;const a=_.useId(),o=_.useRef(null),l=_.useRef({width:0,height:0,top:0,left:0,right:0,bottom:0}),{nonce:c}=_.useContext(_r),u=((d=t.props)==null?void 0:d.ref)??(t==null?void 0:t.ref),h=Kd(o,u);return _.useInsertionEffect(()=>{const{width:f,height:m,top:y,left:g,right:v,bottom:x}=l.current;if(e||i===!1||!o.current||!f||!m)return;const w=s==="left"?`left: ${g}`:`right: ${v}`,b=n==="bottom"?`bottom: ${x}`:`top: ${y}`;o.current.dataset.motionPopId=a;const S=document.createElement("style");c&&(S.nonce=c);const T=r??document.head;return T.appendChild(S),S.sheet&&S.sheet.insertRule(`
          [data-motion-pop-id="${a}"] {
            position: absolute !important;
            width: ${f}px !important;
            height: ${m}px !important;
            ${w}px !important;
            ${b}px !important;
          }
        `),()=>{var j;(j=o.current)==null||j.removeAttribute("data-motion-pop-id"),T.contains(S)&&T.removeChild(S)}},[e]),p.jsx(Gd,{isPresent:e,childRef:o,sizeRef:l,pop:i,children:i===!1?t:_.cloneElement(t,{ref:h})})}const Jd=({children:t,initial:e,isPresent:s,onExitComplete:n,custom:r,presenceAffectsLayout:i,mode:a,anchorX:o,anchorY:l,root:c})=>{const u=Qn(Yd),h=_.useId();let d=!0,f=_.useMemo(()=>(d=!1,{id:h,initial:e,isPresent:s,custom:r,onExitComplete:m=>{u.set(m,!0);for(const y of u.values())if(!y)return;n&&n()},register:m=>(u.set(m,!1),()=>u.delete(m))}),[s,u,n]);return i&&d&&(f={...f}),_.useMemo(()=>{u.forEach((m,y)=>u.set(y,!1))},[s]),_.useEffect(()=>{!s&&!u.size&&n&&n()},[s]),t=p.jsx(zd,{pop:a==="popLayout",isPresent:s,anchorX:o,anchorY:l,root:c,children:t}),p.jsx(As.Provider,{value:f,children:t})};function Yd(){return new Map}function tl(t=!0){const e=_.useContext(As);if(e===null)return[!0,null];const{isPresent:s,onExitComplete:n,register:r}=e,i=_.useId();_.useEffect(()=>{if(t)return r(i)},[t]);const a=_.useCallback(()=>t&&n&&n(i),[i,n,t]);return!s&&n?[!1,a]:[!0]}const Qt=t=>t.key||"";function Li(t){const e=[];return _.Children.forEach(t,s=>{_.isValidElement(s)&&e.push(s)}),e}const Dn=({children:t,custom:e,initial:s=!0,onExitComplete:n,presenceAffectsLayout:r=!0,mode:i="sync",propagate:a=!1,anchorX:o="left",anchorY:l="top",root:c})=>{const[u,h]=tl(a),d=_.useMemo(()=>Li(t),[t]),f=a&&!u?[]:d.map(Qt),m=_.useRef(!0),y=_.useRef(d),g=Qn(()=>new Map),v=_.useRef(new Set),[x,w]=_.useState(d),[b,S]=_.useState(d);Aa(()=>{m.current=!1,y.current=d;for(let E=0;E<b.length;E++){const O=Qt(b[E]);f.includes(O)?(g.delete(O),v.current.delete(O)):g.get(O)!==!0&&g.set(O,!1)}},[b,f.length,f.join("-")]);const T=[];if(d!==x){let E=[...d];for(let O=0;O<b.length;O++){const P=b[O],M=Qt(P);f.includes(M)||(E.splice(O,0,P),T.push(P))}return i==="wait"&&T.length&&(E=T),S(Li(E)),w(d),null}const{forceRender:j}=_.useContext(Xn);return p.jsx(p.Fragment,{children:b.map(E=>{const O=Qt(E),P=a&&!u?!1:d===b||f.includes(O),M=()=>{if(v.current.has(O))return;if(g.has(O))v.current.add(O),g.set(O,!0);else return;let W=!0;g.forEach(xe=>{xe||(W=!1)}),W&&(j==null||j(),S(y.current),a&&(h==null||h()),n&&n())};return p.jsx(Jd,{isPresent:P,initial:!m.current||s?void 0:!1,custom:e,presenceAffectsLayout:r,mode:i,root:c,onExitComplete:P?void 0:M,anchorX:o,anchorY:l,children:E},O)})})},sl=_.createContext({strict:!1}),Bi={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let Vi=!1;function Xd(){if(Vi)return;const t={};for(const e in Bi)t[e]={isEnabled:s=>Bi[e].some(n=>!!s[n])};jo(t),Vi=!0}function nl(){return Xd(),Nh()}function Qd(t){const e=nl();for(const s in t)e[s]={...e[s],...t[s]};jo(e)}const Zd=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function Ss(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||Zd.has(t)}let rl=t=>!Ss(t);function ef(t){typeof t=="function"&&(rl=e=>e.startsWith("on")?!Ss(e):t(e))}try{ef(require("@emotion/is-prop-valid").default)}catch{}function tf(t,e,s){const n={};for(const r in t)r==="values"&&typeof t.values=="object"||J(t[r])||(rl(r)||s===!0&&Ss(r)||!e&&!Ss(r)||t.draggable&&r.startsWith("onDrag"))&&(n[r]=t[r]);return n}const Os=_.createContext({});function sf(t,e){if(js(t)){const{initial:s,animate:n}=t;return{initial:s===!1||Nt(s)?s:void 0,animate:Nt(n)?n:void 0}}return t.inherit!==!1?e:{}}function nf(t){const{initial:e,animate:s}=sf(t,_.useContext(Os));return _.useMemo(()=>({initial:e,animate:s}),[Ui(e),Ui(s)])}function Ui(t){return Array.isArray(t)?t.join(" "):t}const Sr=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function il(t,e,s){for(const n in e)!J(e[n])&&!Lo(n,s)&&(t[n]=e[n])}function rf({transformTemplate:t},e){return _.useMemo(()=>{const s=Sr();return br(s,e,t),Object.assign({},s.vars,s.style)},[e])}function af(t,e){const s=t.style||{},n={};return il(n,s,t),Object.assign(n,rf(t,e)),n}function of(t,e){const s={},n=af(t,e);return t.drag&&t.dragListener!==!1&&(s.draggable=!1,n.userSelect=n.WebkitUserSelect=n.WebkitTouchCallout="none",n.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(s.tabIndex=0),s.style=n,s}const al=()=>({...Sr(),attrs:{}});function lf(t,e,s,n){const r=_.useMemo(()=>{const i=al();return Bo(i,e,Uo(n),t.transformTemplate,t.style),{...i.attrs,style:{...i.style}}},[e]);if(t.style){const i={};il(i,t.style,t),r.style={...i,...r.style}}return r}const cf=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function Tr(t){return typeof t!="string"||t.includes("-")?!1:!!(cf.indexOf(t)>-1||/[A-Z]/u.test(t))}function uf(t,e,s,{latestValues:n},r,i=!1,a){const l=(a??Tr(t)?lf:of)(e,n,r,t),c=tf(e,typeof t=="string",i),u=t!==_.Fragment?{...c,...l,ref:s}:{},{children:h}=e,d=_.useMemo(()=>J(h)?h.get():h,[h]);return _.createElement(t,{...u,children:d})}function hf({scrapeMotionValuesFromProps:t,createRenderState:e},s,n,r){return{latestValues:df(s,n,r,t),renderState:e()}}function df(t,e,s,n){const r={},i=n(t,{});for(const d in i)r[d]=ds(i[d]);let{initial:a,animate:o}=t;const l=js(t),c=Co(t);e&&c&&!l&&t.inherit!==!1&&(a===void 0&&(a=e.initial),o===void 0&&(o=e.animate));let u=s?s.initial===!1:!1;u=u||a===!1;const h=u?o:a;if(h&&typeof h!="boolean"&&!Rs(h)){const d=Array.isArray(h)?h:[h];for(let f=0;f<d.length;f++){const m=dr(t,d[f]);if(m){const{transitionEnd:y,transition:g,...v}=m;for(const x in v){let w=v[x];if(Array.isArray(w)){const b=u?w.length-1:0;w=w[b]}w!==null&&(r[x]=w)}for(const x in y)r[x]=y[x]}}}return r}const ol=t=>(e,s)=>{const n=_.useContext(Os),r=_.useContext(As),i=()=>hf(t,e,n,r);return s?i():Qn(i)},ff=ol({scrapeMotionValuesFromProps:xr,createRenderState:Sr}),pf=ol({scrapeMotionValuesFromProps:Fo,createRenderState:al}),mf=Symbol.for("motionComponentSymbol");function gf(t,e,s){const n=_.useRef(s);_.useInsertionEffect(()=>{n.current=s});const r=_.useRef(null);return _.useCallback(i=>{var o;i&&((o=t.onMount)==null||o.call(t,i));const a=n.current;if(typeof a=="function")if(i){const l=a(i);typeof l=="function"&&(r.current=l)}else r.current?(r.current(),r.current=null):a(i);else a&&(a.current=i);e&&(i?e.mount(i):e.unmount())},[e])}const ll=_.createContext({});function rt(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function yf(t,e,s,n,r,i){var w,b;const{visualElement:a}=_.useContext(Os),o=_.useContext(sl),l=_.useContext(As),c=_.useContext(_r),u=c.reducedMotion,h=c.skipAnimations,d=_.useRef(null),f=_.useRef(!1);n=n||o.renderer,!d.current&&n&&(d.current=n(t,{visualState:e,parent:a,props:s,presenceContext:l,blockInitialAnimation:l?l.initial===!1:!1,reducedMotionConfig:u,skipAnimations:h,isSVG:i}),f.current&&d.current&&(d.current.manuallyAnimateOnMount=!0));const m=d.current,y=_.useContext(ll);m&&!m.projection&&r&&(m.type==="html"||m.type==="svg")&&vf(d.current,s,r,y);const g=_.useRef(!1);_.useInsertionEffect(()=>{m&&g.current&&m.update(s,l)});const v=s[go],x=_.useRef(!!v&&typeof window<"u"&&!((w=window.MotionHandoffIsComplete)!=null&&w.call(window,v))&&((b=window.MotionHasOptimisedAnimation)==null?void 0:b.call(window,v)));return Aa(()=>{f.current=!0,m&&(g.current=!0,window.MotionIsMounted=!0,m.updateFeatures(),m.scheduleRenderMicrotask(),x.current&&m.animationState&&m.animationState.animateChanges())}),_.useEffect(()=>{m&&(!x.current&&m.animationState&&m.animationState.animateChanges(),x.current&&(queueMicrotask(()=>{var S;(S=window.MotionHandoffMarkAsComplete)==null||S.call(window,v)}),x.current=!1),m.enteringChildren=void 0)}),m}function vf(t,e,s,n){const{layoutId:r,layout:i,drag:a,dragConstraints:o,layoutScroll:l,layoutRoot:c,layoutAnchor:u,layoutCrossfade:h}=e;t.projection=new s(t.latestValues,e["data-framer-portal-id"]?void 0:cl(t.parent)),t.projection.setOptions({layoutId:r,layout:i,alwaysMeasureLayout:!!a||o&&rt(o),visualElement:t,animationType:typeof i=="string"?i:"both",initialPromotionConfig:n,crossfade:h,layoutScroll:l,layoutRoot:c,layoutAnchor:u})}function cl(t){if(t)return t.options.allowProjection!==!1?t.projection:cl(t.parent)}function Gs(t,{forwardMotionProps:e=!1,type:s}={},n,r){n&&Qd(n);const i=s?s==="svg":Tr(t),a=i?pf:ff;function o(c,u){let h;const d={..._.useContext(_r),...c,layoutId:wf(c)},{isStatic:f}=d,m=nf(c),y=a(c,f);if(!f&&typeof window<"u"){bf();const g=xf(d);h=g.MeasureLayout,m.visualElement=yf(t,y,d,r,g.ProjectionNode,i)}return p.jsxs(Os.Provider,{value:m,children:[h&&m.visualElement?p.jsx(h,{visualElement:m.visualElement,...d}):null,uf(t,c,gf(y,m.visualElement,u),y,f,e,i)]})}o.displayName=`motion.${typeof t=="string"?t:`create(${t.displayName??t.name??""})`}`;const l=_.forwardRef(o);return l[mf]=t,l}function wf({layoutId:t}){const e=_.useContext(Xn).id;return e&&t!==void 0?e+"-"+t:t}function bf(t,e){_.useContext(sl).strict}function xf(t){const e=nl(),{drag:s,layout:n}=e;if(!s&&!n)return{};const r={...s,...n};return{MeasureLayout:s!=null&&s.isEnabled(t)||n!=null&&n.isEnabled(t)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function _f(t,e){if(typeof Proxy>"u")return Gs;const s=new Map,n=(i,a)=>Gs(i,a,t,e),r=(i,a)=>n(i,a);return new Proxy(r,{get:(i,a)=>a==="create"?n:(s.has(a)||s.set(a,Gs(a,void 0,t,e)),s.get(a))})}const Sf=(t,e)=>e.isSVG??Tr(t)?new Qh(e):new Kh(e,{allowProjection:t!==_.Fragment});class Tf extends Me{constructor(e){super(e),e.animationState||(e.animationState=nd(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();Rs(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:s}=this.node.prevProps||{};e!==s&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)==null||e.call(this)}}let kf=0;class Ef extends Me{constructor(){super(...arguments),this.id=kf++,this.isExitComplete=!1}update(){var i;if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:s}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===n)return;if(e&&n===!1){if(this.isExitComplete){const{initial:a,custom:o}=this.node.getProps();if(typeof a=="string"){const l=Ye(this.node,a,o);if(l){const{transition:c,transitionEnd:u,...h}=l;for(const d in h)(i=this.node.getValue(d))==null||i.jump(h[d])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive("exit",!1);this.isExitComplete=!1;return}const r=this.node.animationState.setActive("exit",!e);s&&!e&&r.then(()=>{this.isExitComplete=!0,s(this.id)})}mount(){const{register:e,onExitComplete:s}=this.node.presenceContext||{};s&&s(this.id),e&&(this.unmount=e(this.id))}unmount(){}}const Af={animation:{Feature:Tf},exit:{Feature:Ef}};function Gt(t){return{point:{x:t.pageX,y:t.pageY}}}const Pf=t=>e=>gr(e)&&t(e,Gt(e));function Pt(t,e,s,n){return Mt(t,e,Pf(s),n)}const ul=({current:t})=>t?t.ownerDocument.defaultView:null,Fi=(t,e)=>Math.abs(t-e);function Cf(t,e){const s=Fi(t.x,e.x),n=Fi(t.y,e.y);return Math.sqrt(s**2+n**2)}const qi=new Set(["auto","scroll"]);class hl{constructor(e,s,{transformPagePoint:n,contextWindow:r=window,dragSnapToOrigin:i=!1,distanceThreshold:a=3,element:o}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=f=>{this.handleScroll(f.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=Zt(this.lastRawMoveEventInfo,this.transformPagePoint));const f=zs(this.lastMoveEventInfo,this.history),m=this.startEvent!==null,y=Cf(f.offset,{x:0,y:0})>=this.distanceThreshold;if(!m&&!y)return;const{point:g}=f,{timestamp:v}=z;this.history.push({...g,timestamp:v});const{onStart:x,onMove:w}=this.handlers;m||(x&&x(this.lastMoveEvent,f),this.startEvent=this.lastMoveEvent),w&&w(this.lastMoveEvent,f)},this.handlePointerMove=(f,m)=>{this.lastMoveEvent=f,this.lastRawMoveEventInfo=m,this.lastMoveEventInfo=Zt(m,this.transformPagePoint),D.update(this.updatePoint,!0)},this.handlePointerUp=(f,m)=>{this.end();const{onEnd:y,onSessionEnd:g,resumeAnimation:v}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&v&&v(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const x=zs(f.type==="pointercancel"?this.lastMoveEventInfo:Zt(m,this.transformPagePoint),this.history);this.startEvent&&y&&y(f,x),g&&g(f,x)},!gr(e))return;this.dragSnapToOrigin=i,this.handlers=s,this.transformPagePoint=n,this.distanceThreshold=a,this.contextWindow=r||window;const l=Gt(e),c=Zt(l,this.transformPagePoint),{point:u}=c,{timestamp:h}=z;this.history=[{...u,timestamp:h}];const{onSessionStart:d}=s;d&&d(e,zs(c,this.history)),this.removeListeners=Wt(Pt(this.contextWindow,"pointermove",this.handlePointerMove),Pt(this.contextWindow,"pointerup",this.handlePointerUp),Pt(this.contextWindow,"pointercancel",this.handlePointerUp)),o&&this.startScrollTracking(o)}startScrollTracking(e){let s=e.parentElement;for(;s;){const n=getComputedStyle(s);(qi.has(n.overflowX)||qi.has(n.overflowY))&&this.scrollPositions.set(s,{x:s.scrollLeft,y:s.scrollTop}),s=s.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(e){const s=this.scrollPositions.get(e);if(!s)return;const n=e===window,r=n?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},i={x:r.x-s.x,y:r.y-s.y};i.x===0&&i.y===0||(n?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=i.x,this.lastMoveEventInfo.point.y+=i.y):this.history.length>0&&(this.history[0].x-=i.x,this.history[0].y-=i.y),this.scrollPositions.set(e,r),D.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),Ie(this.updatePoint)}}function Zt(t,e){return e?{point:e(t.point)}:t}function Wi(t,e){return{x:t.x-e.x,y:t.y-e.y}}function zs({point:t},e){return{point:t,delta:Wi(t,dl(e)),offset:Wi(t,Rf(e)),velocity:jf(e,.1)}}function Rf(t){return t[0]}function dl(t){return t[t.length-1]}function jf(t,e){if(t.length<2)return{x:0,y:0};let s=t.length-1,n=null;const r=dl(t);for(;s>=0&&(n=t[s],!(r.timestamp-n.timestamp>Q(e)));)s--;if(!n)return{x:0,y:0};n===t[0]&&t.length>2&&r.timestamp-n.timestamp>Q(e)*2&&(n=t[1]);const i=re(r.timestamp-n.timestamp);if(i===0)return{x:0,y:0};const a={x:(r.x-n.x)/i,y:(r.y-n.y)/i};return a.x===1/0&&(a.x=0),a.y===1/0&&(a.y=0),a}function Of(t,{min:e,max:s},n){return e!==void 0&&t<e?t=n?N(e,t,n.min):Math.max(t,e):s!==void 0&&t>s&&(t=n?N(s,t,n.max):Math.min(t,s)),t}function Hi(t,e,s){return{min:e!==void 0?t.min+e:void 0,max:s!==void 0?t.max+s-(t.max-t.min):void 0}}function Df(t,{top:e,left:s,bottom:n,right:r}){return{x:Hi(t.x,s,r),y:Hi(t.y,e,n)}}function Ki(t,e){let s=e.min-t.min,n=e.max-t.max;return e.max-e.min<t.max-t.min&&([s,n]=[n,s]),{min:s,max:n}}function If(t,e){return{x:Ki(t.x,e.x),y:Ki(t.y,e.y)}}function Nf(t,e){let s=.5;const n=X(t),r=X(e);return r>n?s=Dt(e.min,e.max-n,t.min):n>r&&(s=Dt(t.min,t.max-r,e.min)),be(0,1,s)}function Mf(t,e){const s={};return e.min!==void 0&&(s.min=e.min-t.min),e.max!==void 0&&(s.max=e.max-t.min),s}const In=.35;function $f(t=In){return t===!1?t=0:t===!0&&(t=In),{x:Gi(t,"left","right"),y:Gi(t,"top","bottom")}}function Gi(t,e,s){return{min:zi(t,e),max:zi(t,s)}}function zi(t,e){return typeof t=="number"?t:t[e]||0}const Lf=new WeakMap;class Bf{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=q(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:s=!1,distanceThreshold:n}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const i=h=>{s&&this.snapToCursor(Gt(h).point),this.stopAnimation()},a=(h,d)=>{const{drag:f,dragPropagation:m,onDragStart:y}=this.getProps();if(f&&!m&&(this.openDragLock&&this.openDragLock(),this.openDragLock=hh(f),!this.openDragLock))return;this.latestPointerEvent=h,this.latestPanInfo=d,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),ye(v=>{let x=this.getAxisMotionValue(v).get()||0;if(we.test(x)){const{projection:w}=this.visualElement;if(w&&w.layout){const b=w.layout.layoutBox[v];b&&(x=X(b)*(parseFloat(x)/100))}}this.originPoint[v]=x}),y&&D.update(()=>y(h,d),!1,!0),Tn(this.visualElement,"transform");const{animationState:g}=this.visualElement;g&&g.setActive("whileDrag",!0)},o=(h,d)=>{this.latestPointerEvent=h,this.latestPanInfo=d;const{dragPropagation:f,dragDirectionLock:m,onDirectionLock:y,onDrag:g}=this.getProps();if(!f&&!this.openDragLock)return;const{offset:v}=d;if(m&&this.currentDirection===null){this.currentDirection=Uf(v),this.currentDirection!==null&&y&&y(this.currentDirection);return}this.updateAxis("x",d.point,v),this.updateAxis("y",d.point,v),this.visualElement.render(),g&&D.update(()=>g(h,d),!1,!0)},l=(h,d)=>{this.latestPointerEvent=h,this.latestPanInfo=d,this.stop(h,d),this.latestPointerEvent=null,this.latestPanInfo=null},c=()=>{const{dragSnapToOrigin:h}=this.getProps();(h||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:u}=this.getProps();this.panSession=new hl(e,{onSessionStart:i,onStart:a,onMove:o,onSessionEnd:l,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,distanceThreshold:n,contextWindow:ul(this.visualElement),element:this.visualElement.current})}stop(e,s){const n=e||this.latestPointerEvent,r=s||this.latestPanInfo,i=this.isDragging;if(this.cancel(),!i||!r||!n)return;const{velocity:a}=r;this.startAnimation(a);const{onDragEnd:o}=this.getProps();o&&D.postRender(()=>o(n,r))}cancel(){this.isDragging=!1;const{projection:e,animationState:s}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:n}=this.getProps();!n&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),s&&s.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,s,n){const{drag:r}=this.getProps();if(!n||!es(e,r,this.currentDirection))return;const i=this.getAxisMotionValue(e);let a=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(a=Of(a,this.constraints[e],this.elastic[e])),i.set(a)}resolveConstraints(){var i;const{dragConstraints:e,dragElastic:s}=this.getProps(),n=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(i=this.visualElement.projection)==null?void 0:i.layout,r=this.constraints;e&&rt(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&n?this.constraints=Df(n.layoutBox,e):this.constraints=!1,this.elastic=$f(s),r!==this.constraints&&!rt(e)&&n&&this.constraints&&!this.hasMutatedConstraints&&ye(a=>{this.constraints!==!1&&this.getAxisMotionValue(a)&&(this.constraints[a]=Mf(n.layoutBox[a],this.constraints[a]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:s}=this.getProps();if(!e||!rt(e))return!1;const n=e.current;pt(n!==null,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.","drag-constraints-ref");const{projection:r}=this.visualElement;if(!r||!r.layout)return!1;const i=Vh(n,r.root,this.visualElement.getTransformPagePoint());let a=If(r.layout.layoutBox,i);if(s){const o=s($h(a));this.hasMutatedConstraints=!!o,o&&(a=Do(o))}return a}startAnimation(e){const{drag:s,dragMomentum:n,dragElastic:r,dragTransition:i,dragSnapToOrigin:a,onDragTransitionEnd:o}=this.getProps(),l=this.constraints||{},c=ye(u=>{if(!es(u,s,this.currentDirection))return;let h=l&&l[u]||{};(a===!0||a===u)&&(h={min:0,max:0});const d=r?200:1e6,f=r?40:1e7,m={type:"inertia",velocity:n?e[u]:0,bounceStiffness:d,bounceDamping:f,timeConstant:750,restDelta:1,restSpeed:10,...i,...h};return this.startAxisValueAnimation(u,m)});return Promise.all(c).then(o)}startAxisValueAnimation(e,s){const n=this.getAxisMotionValue(e);return Tn(this.visualElement,e),n.start(hr(e,n,0,s,this.visualElement,!1))}stopAnimation(){ye(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){const s=`_drag${e.toUpperCase()}`,n=this.visualElement.getProps(),r=n[s];return r||this.visualElement.getValue(e,(n.initial?n.initial[e]:void 0)||0)}snapToCursor(e){ye(s=>{const{drag:n}=this.getProps();if(!es(s,n,this.currentDirection))return;const{projection:r}=this.visualElement,i=this.getAxisMotionValue(s);if(r&&r.layout){const{min:a,max:o}=r.layout.layoutBox[s],l=i.get()||0;i.set(e[s]-N(a,o,.5)+l)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:s}=this.getProps(),{projection:n}=this.visualElement;if(!rt(s)||!n||!this.constraints)return;this.stopAnimation();const r={x:0,y:0};ye(a=>{const o=this.getAxisMotionValue(a);if(o&&this.constraints!==!1){const l=o.get();r[a]=Nf({min:l,max:l},this.constraints[a])}});const{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},""):"none",n.root&&n.root.updateScroll(),n.updateLayout(),this.constraints=!1,this.resolveConstraints(),ye(a=>{if(!es(a,e,null))return;const o=this.getAxisMotionValue(a),{min:l,max:c}=this.constraints[a];o.set(N(l,c,r[a]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;Lf.set(this.visualElement,this);const e=this.visualElement.current,s=Pt(e,"pointerdown",c=>{const{drag:u,dragListener:h=!0}=this.getProps(),d=c.target,f=d!==e&&yh(d);u&&h&&!f&&this.start(c)});let n;const r=()=>{const{dragConstraints:c}=this.getProps();rt(c)&&c.current&&(this.constraints=this.resolveRefConstraints(),n||(n=Vf(e,c.current,()=>this.scalePositionWithinConstraints())))},{projection:i}=this.visualElement,a=i.addEventListener("measure",r);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),D.read(r);const o=Mt(window,"resize",()=>this.scalePositionWithinConstraints()),l=i.addEventListener("didUpdate",({delta:c,hasLayoutChanged:u})=>{this.isDragging&&u&&(ye(h=>{const d=this.getAxisMotionValue(h);d&&(this.originPoint[h]+=c[h].translate,d.set(d.get()+c[h].translate))}),this.visualElement.render())});return()=>{o(),s(),a(),l&&l(),n&&n()}}getProps(){const e=this.visualElement.getProps(),{drag:s=!1,dragDirectionLock:n=!1,dragPropagation:r=!1,dragConstraints:i=!1,dragElastic:a=In,dragMomentum:o=!0}=e;return{...e,drag:s,dragDirectionLock:n,dragPropagation:r,dragConstraints:i,dragElastic:a,dragMomentum:o}}}function Ji(t){let e=!0;return()=>{if(e){e=!1;return}t()}}function Vf(t,e,s){const n=si(t,Ji(s)),r=si(e,Ji(s));return()=>{n(),r()}}function es(t,e,s){return(e===!0||e===t)&&(s===null||s===t)}function Uf(t,e=10){let s=null;return Math.abs(t.y)>e?s="y":Math.abs(t.x)>e&&(s="x"),s}class Ff extends Me{constructor(e){super(e),this.removeGroupControls=ie,this.removeListeners=ie,this.controls=new Bf(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||ie}update(){const{dragControls:e}=this.node.getProps(),{dragControls:s}=this.node.prevProps||{};e!==s&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}const Js=t=>(e,s)=>{t&&D.update(()=>t(e,s),!1,!0)};class qf extends Me{constructor(){super(...arguments),this.removePointerDownListener=ie}onPointerDown(e){this.session=new hl(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:ul(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:s,onPan:n,onPanEnd:r}=this.node.getProps();return{onSessionStart:Js(e),onStart:Js(s),onMove:Js(n),onEnd:(i,a)=>{delete this.session,r&&D.postRender(()=>r(i,a))}}}mount(){this.removePointerDownListener=Pt(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let Ys=!1;class Wf extends _.Component{componentDidMount(){const{visualElement:e,layoutGroup:s,switchLayoutGroup:n,layoutId:r}=this.props,{projection:i}=e;i&&(s.group&&s.group.add(i),n&&n.register&&r&&n.register(i),Ys&&i.root.didUpdate(),i.addEventListener("animationComplete",()=>{this.safeToRemove()}),i.setOptions({...i.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),fs.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:s,visualElement:n,drag:r,isPresent:i}=this.props,{projection:a}=n;return a&&(a.isPresent=i,e.layoutDependency!==s&&a.setOptions({...a.options,layoutDependency:s}),Ys=!0,r||e.layoutDependency!==s||s===void 0||e.isPresent!==i?a.willUpdate():this.safeToRemove(),e.isPresent!==i&&(i?a.promote():a.relegate()||D.postRender(()=>{const o=a.getStack();(!o||!o.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{visualElement:e,layoutAnchor:s}=this.props,{projection:n}=e;n&&(n.options.layoutAnchor=s,n.root.didUpdate(),mr.postRender(()=>{!n.currentAnimation&&n.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:s,switchLayoutGroup:n}=this.props,{projection:r}=e;Ys=!0,r&&(r.scheduleCheckAfterUnmount(),s&&s.group&&s.group.remove(r),n&&n.deregister&&n.deregister(r))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function fl(t){const[e,s]=tl(),n=_.useContext(Xn);return p.jsx(Wf,{...t,layoutGroup:n,switchLayoutGroup:_.useContext(ll),isPresent:e,safeToRemove:s})}const Hf={pan:{Feature:qf},drag:{Feature:Ff,ProjectionNode:el,MeasureLayout:fl}};function Yi(t,e,s){const{props:n}=t;t.animationState&&n.whileHover&&t.animationState.setActive("whileHover",s==="Start");const r="onHover"+s,i=n[r];i&&D.postRender(()=>i(e,Gt(e)))}class Kf extends Me{mount(){const{current:e}=this.node;e&&(this.unmount=fh(e,(s,n)=>(Yi(this.node,n,"Start"),r=>Yi(this.node,r,"End"))))}unmount(){}}class Gf extends Me{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Wt(Mt(this.node.current,"focus",()=>this.onFocus()),Mt(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function Xi(t,e,s){const{props:n}=t;if(t.current instanceof HTMLButtonElement&&t.current.disabled)return;t.animationState&&n.whileTap&&t.animationState.setActive("whileTap",s==="Start");const r="onTap"+(s==="End"?"":s),i=n[r];i&&D.postRender(()=>i(e,Gt(e)))}class zf extends Me{mount(){const{current:e}=this.node;if(!e)return;const{globalTapTarget:s,propagate:n}=this.node.props;this.unmount=wh(e,(r,i)=>(Xi(this.node,i,"Start"),(a,{success:o})=>Xi(this.node,a,o?"End":"Cancel")),{useGlobalTarget:s,stopPropagation:(n==null?void 0:n.tap)===!1})}unmount(){}}const Nn=new WeakMap,Xs=new WeakMap,Jf=t=>{const e=Nn.get(t.target);e&&e(t)},Yf=t=>{t.forEach(Jf)};function Xf({root:t,...e}){const s=t||document;Xs.has(s)||Xs.set(s,{});const n=Xs.get(s),r=JSON.stringify(e);return n[r]||(n[r]=new IntersectionObserver(Yf,{root:t,...e})),n[r]}function Qf(t,e,s){const n=Xf(e);return Nn.set(t,s),n.observe(t),()=>{Nn.delete(t),n.unobserve(t)}}const Zf={some:0,all:1};class ep extends Me{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){var l;(l=this.stopObserver)==null||l.call(this);const{viewport:e={}}=this.node.getProps(),{root:s,margin:n,amount:r="some",once:i}=e,a={root:s?s.current:void 0,rootMargin:n,threshold:typeof r=="number"?r:Zf[r]},o=c=>{const{isIntersecting:u}=c;if(this.isInView===u||(this.isInView=u,i&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:h,onViewportLeave:d}=this.node.getProps(),f=u?h:d;f&&f(c)};this.stopObserver=Qf(this.node.current,a,o)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:s}=this.node;["amount","margin","root"].some(tp(e,s))&&this.startObserver()}unmount(){var e;(e=this.stopObserver)==null||e.call(this),this.hasEnteredView=!1,this.isInView=!1}}function tp({viewport:t={}},{viewport:e={}}={}){return s=>t[s]!==e[s]}const sp={inView:{Feature:ep},tap:{Feature:zf},focus:{Feature:Gf},hover:{Feature:Kf}},np={layout:{ProjectionNode:el,MeasureLayout:fl}},rp={...Af,...sp,...Hf,...np},Ce=_f(rp,Sf),ip=[{slug:"claudia-hounslow",name:"Claudia Hounslow",title:"Director & Psychologist",ahpraNumber:"PSY0001527849",photo:"/images/team/claudia.jpg",inPerson:["Tuesday","Wednesday"],online:["Tuesday","Wednesday"],areas:["Individual","Coaching"],tags:["Executive Coaching","Neuropsychology","Women in Leadership","Anxiety","High Performers"],bio:`Claudia is a psychologist and the director of Contemporary Psychology. Her lifelong passion of delivering mental health education with a neuropsychological lens led to the creation of our amazing clinic. Claudia has worked as a psychologist for over 18 years and has studied extensively in human behaviour, personality, attachment, coaching, neuropsychology, business development and management. In addition to her training in psychology, Claudia has also obtained a master's degree in management and can provide further insight into organisational leadership, workplace dynamics, personality profiling, your interpersonal style, and provide leadership coaching.

Claudia is committed to the pursuit of knowledge and is energised by the complexity of the human mind. She believes individuals are shaped through experience, and uses the latest insights in to neuroplasticity to encourage her clients to create lasting behavioural change. Whether you are seeking a formal assessment, coaching or psychotherapy, you will benefit from her experienced and compassionate approach.
`,areasOfInterest:["Health Professionals Wellbeing","Coaching high performers","Neuropsychology","Women in leadership","Self sacrificing beliefs and schemas","Generalised Anxiety","Business owners & leaders training in mental health","Performance Anxiety","Executive Coaching","Relationship Conflict","Anger Management"],qualifications:[{degree:"Master of Management"}],isPsychologist:!0},{slug:"rivkah-bendet",name:"Rivkah Bendet",title:"Psychologist",ahpraNumber:"PSY0002616011",sameAs:["https://www.psychologytoday.com/au/counselling/rivkah-bendet-saint-kilda-vic/1698545","https://healthengine.com.au/psychologist/vic/st-kilda-east/ms-rivkah-bendet/p125162"],photo:"/images/team/rivkah.jpg",inPerson:["Tuesday","Wednesday","Thursday","Friday"],online:["Monday","Tuesday","Wednesday","Thursday","Friday"],areas:["Individual","Trauma","Assessment","TAC"],tags:["Anxiety","Trauma","Body Image","ADHD/ASD","Neuroaffirming"],bio:`Rivkah understands that mental health is a crucial aspect of a person's quality of life and day-to-day functioning. She is therefore passionate about providing her clients with the necessary support and guidance to help them achieve and maintain psychological well-being.

Through her Master's in Educational and Developmental Psychology at Monash University, Rivkah gained skills in counselling, administering assessments, and delivering relaxation exercises for clients. She has worked with people of all ages and with various presentations including anxiety, anger management, ADHD, ASD and more.

Rivkah's experience in working with many different people from diverse backgrounds has made her a well-rounded and compassionate psychologist, capable of understanding and addressing the unique needs of a wide range of individuals.

Rivkah employs a client-centred approach and utilises a variety of evidence-based therapies, including cognitive-behavioural therapy, acceptance and commitment therapy, schema therapy and motivational interviewing to assist clients in overcoming their challenges.

Rivkah believes that building a strong rapport with her clients is essential for achieving positive and powerful outcomes. Her clients describe her as warm, empathetic, dedicated, and easy to work with.`,areasOfInterest:["Relational conflict","Anxiety","Social anxiety & shyness","Self-esteem & confidence","Grief","Trauma","Life transitions","Body image and eating concerns","Assessments for Learning Disorders, ADHD & ASD","Neuroaffirming practice"],qualifications:[{degree:"Master of Educational and Developmental Psychology",institution:"Monash University"}],neurodivergenceSpecialist:!0,isPsychologist:!0},{slug:"lucy-adlard",name:"Lucy Adlard",title:"Psychologist",ahpraNumber:"PSY0002698522",sameAs:["https://www.psychologytoday.com/au/counselling/lucy-adlard-melbourne-vic/1461825","https://healthengine.com.au/psychologist/vic/st-kilda-east/ms-lucy-adlard/p128660"],photo:"/images/team/lucy.jpg",inPerson:["Tuesday","Wednesday","Thursday","Friday"],online:["Monday","Tuesday","Wednesday","Thursday","Friday"],areas:["Individual","Coaching","Workcover","TAC","Trauma","Couples"],tags:["Anxiety","Couples Therapy","Life Transitions","Emotional Regulation","Mood Disorders"],bio:`Clients often describe Lucy as warm and grounded, with a natural ability to bring energy and insight into each session. She's known for her respectful yet direct style, gently challenging stuck patterns and helping clients move toward meaningful change beyond the therapy room.

Her clinical interests include behaviour change and addictions, emotional regulation, anxiety (in all its forms), sleep, and mood and personality disorders. She also has further training in the Gottman Method (Level 2) and has a particular interest supporting clients working through relationship and attachment concerns, as well as working with couples.

Lucy adapts her therapeutic style to suit each individual, drawing from a range of evidence-based approaches including Cognitive Behavioural Therapy (CBT), Acceptance and Commitment Therapy (ACT), Schema Therapy, and Dialectical Behaviour Therapy (DBT).

Lucy takes a holistic, client-led approach to mental health and believes that therapy works best when clients feel genuinely safe, heard, and comfortable being themselves. She's passionate about creating the kind of space that feels supportive and relaxed, yet still fosters honesty, curiosity, and self-compassion.`,areasOfInterest:["Anxiety","Relationships and romantic attachments","Couples","Trauma","Life Transitions","Emotional Regulation / Anger Management","Social anxiety and self-esteem","Sleep","Interpersonal challenges","LGBTQIA+","Mood and personality disorders"],isPsychologist:!0},{slug:"avi-winner",name:"Avi Winner",title:"Psychologist",ahpraNumber:"PSY0002588644",sameAs:["https://www.psychologytoday.com/au/counselling/avrohom-winner-saint-kilda-vic/1693608","https://healthengine.com.au/psychologist/vic/st-kilda-east/mr-avi-winner/p140216"],photo:"/images/team/avi.jpg",inPerson:["Thursday","Friday"],online:["Thursday","Friday"],areas:["Individual","Assessment","TAC","Workcover","Trauma"],tags:["Neurodivergence","Executive Function","Anxiety & Depression","Life Transitions","Assessments"],bio:`Avi understands that every individual has unique goals and challenges, and he views supporting people on their journey toward well-being and personal fulfilment as both a calling and a privilege. He takes a client-led, strengths-based approach, helping clients pursue their goals, navigate challenges, gain self-understanding, and maximise their well-being and achievement.

Avi believes that the foundation of effective therapy lies in the relationship between client and psychologist. With warmth, empathy, and respect, he strives to create a safe and supportive environment where clients feel seen, valued, and understood.

With his diverse experience and easy ability to connect, Avi is well-suited to address a broad range of goals and challenges. (Some of) Avi's therapeutic interests include supporting neurodivergent individuals in professional and social settings, and life transitions such as parenthood, ageing, and grief. He also brings experience in psychological and diagnostic assessments, delivering thorough, accessible reports that aim to truly 'get' the individual and respond clearly to their questions.

Avi's journey into psychology followed a bachelor's degree in philosophy, where he explored questions around living a meaningful and fulfilling life. He then went on to complete a Master of Educational and Developmental Psychology at Monash University, and has conducted research in areas including ADHD and fatherhood.`,areasOfInterest:["Being neurodivergent in a neurotypical world","Executive functioning","Assertiveness and self-advocacy","Confidence and self-efficacy","Anxiety and depression","Life transitions","Ageing","Grief","Assessments and psychoeducational reports"],qualifications:[{degree:"Master of Educational and Developmental Psychology",institution:"Monash University"}],neurodivergenceSpecialist:!0,isPsychologist:!0},{slug:"david-bokan",name:"David Bokan",title:"Psychologist",ahpraNumber:"PSY0002821425",photo:"/images/team/david.jpg",inPerson:["Wednesday","Thursday","Friday"],online:["Wednesday","Thursday","Friday"],areas:["Individual","Assessment"],tags:["Anxiety","Emotional Regulation","Neurodivergence","Trauma-Informed","Men's Mental Health","Youth Mental Health"],bio:`David is committed to supporting and working collaboratively with clients through their unique mental health journey and offers a warm, empathetic, and non-judgemental space where individuals feel heard and respected, with approaches centred to each individual's own experiences and needs.

His clinical interests include anxiety, emotional regulation, neurodivergence, trauma-informed practice, men's mental health, and many more. He has worked with clients from diverse backgrounds, ages, and presentations in providing therapy as well as psychological assessments. David utilises a variety of best practice evidence-based treatments. These include Cognitive Behavioural Therapy (CBT), Dialectical Behavioural Therapy (DBT), Acceptance and Commitment Therapy (ACT) and mindfulness based interventions.

David is passionate about working with clients from diverse backgrounds and ensuring a safe and empowering therapeutic environment. He completed his Master's in Clinical Psychology at RMIT and is currently working toward his clinical endorsement.`,areasOfInterest:["Anxiety","Depression","Emotional Regulation","Neurodivergence and neuroaffirming practice","Trauma-informed practice","ADHD assessments","Men's mental health","Youth mental health","Life transitions","Grief and loss","CBT, DBT and ACT","Work and performance stress"],qualifications:[{degree:"Master of Clinical Psychology",institution:"RMIT University"}],neurodivergenceSpecialist:!0,personalInterests:"Outside of work, David enjoys sport (all kinds), reading and writing poetry, and watching movies with friends.",isPsychologist:!0},{slug:"bridget-kosmas",name:"Bridget Kosmas",title:"Provisional Psychologist",ahpraNumber:"PSY0002687048",sameAs:["https://healthengine.com.au/psychologist/vic/st-kilda-east/ms-bridget-kosmas/p156858"],photo:"/images/team/bridget.jpg",inPerson:["Tuesday","Wednesday"],online:["Tuesday","Wednesday"],areas:["Individual","Assessment"],tags:["Anxiety","Depression","Life Transitions","Trauma","Emotion Regulation"],bio:`Bridget is a Provisional Psychologist with a Master of Professional Psychology from La Trobe University. She is passionate about creating a safe, supportive and welcoming environment, where clients can explore their experiences and challenges without judgment. Bridget takes a collaborative approach to therapy, supporting clients to develop insight, clarify their goals, and move toward meaningful and lasting change.

Bridget's clinical interests include but are not limited to; anxiety, depression, workplace difficulties, life transitions, trauma and adjustment disorders, emotion regulation, stress management and self-esteem and identity concerns.

She takes a flexible and integrative approach to therapy sessions, tailoring interventions to each client's individual needs, whilst drawing from evidence-based frameworks including Cognitive Behavioural Therapy (CBT), Acceptance and Commitment Therapy (ACT) and Mindfulness-based approaches.

Using a warm and empathetic style, Bridget seeks to build a strong therapeutic relationship where clients feel heard, understood, and empowered. She is committed to providing an inclusive and affirming space, welcoming individuals from diverse backgrounds.`,areasOfInterest:["Anxiety and depression","Work-related concerns","Life transitions","Adjustment disorders","Trauma and attachment difficulties","Emotion regulation","Stress management","Self-esteem and resilience"],qualifications:[{degree:"Master of Professional Psychology",institution:"La Trobe University"}],personalInterests:"In her spare time, Bridget enjoys travelling, taking her dog out on new walks, eating out with friends, baking and watching crime shows.",isPsychologist:!0},{slug:"adam-boyle",name:"Adam Boyle",title:"Operations Manager",photo:"/images/team/adam.jpg",inPerson:[],online:[],areas:["Booking & Client Care"],tags:[],bio:`Adam is our Operations Manager and the backbone of our front of house. After completing a double degree in Criminology and Psychology and a Postgraduate Diploma in Psychology, Adam is currently pursuing his Master's in Forensic Psychology, driven by a deep interest in criminal processes and behaviour.

In his role, Adam oversees the day-to-day operations of the clinic, ensuring everything runs smoothly and efficiently behind the scenes so our psychologists can focus on what they do best.

Outside of work and study, he enjoys catching up with friends over a good meal or watching the footy.`,isPsychologist:!1},{slug:"nick-van-der-linden",name:"Nick van der Linden",title:"Business Development Manager",photo:"/images/team/nick.png",inPerson:[],online:[],areas:["Booking & Client Care"],tags:[],bio:`Nick is our Business Development Manager, bringing a strong commercial and scientific background to the team. After completing a double degree in Commerce and Science, Nick is currently completing his Honours year at Monash University, with plans to pursue a Master of Professional Psychology.

Nick is passionate about mental health and wellbeing, with a particular focus on supporting and advocating for young men's mental health, a cause he carries into both his academic and professional work.

Outside of the clinic, Nick is an avid sports fan who enjoys running, cooking, and a good movie.`,isPsychologist:!1},{slug:"jacqui-williams",name:"Jacqui Williams",title:"Client & Administrative Support",photo:"/images/team/jacqui.jpg",inPerson:[],online:[],areas:["Booking & Client Care"],tags:[],bio:"Jacqui is part of our client support team, assisting with bookings and client care.",isPsychologist:!1},{slug:"apryl-hamall",name:"Apryl Hamall",title:"Client & Administrative Support",photo:"/images/team/apryl.jpg",inPerson:[],online:[],areas:["Booking & Client Care"],tags:[],bio:"Apryl is part of our client support team, assisting with bookings and client care.",isPsychologist:!1},{slug:"maryann",name:"Maryann Scrivener",title:"Client & Administrative Support",photo:"/images/team/maryann.jpg",inPerson:[],online:[],areas:["Booking & Client Care"],tags:[],bio:"Maryann is a dedicated professional working full-time in psychology administration, bringing both experience and compassion to her role. She is passionate about helping clients connect with the most suitable support tailored to their individual needs, ensuring a seamless and positive experience throughout their journey. With strong organisational skills, attention to detail, and a client-focused approach, Maryann plays a key role in maintaining efficient processes while fostering a welcoming and supportive environment.",isPsychologist:!1},{slug:"joey-summers",name:"Joey Summers",title:"Client & Administrative Support",photo:"/images/team/joey.jpg",inPerson:[],online:[],areas:["Booking & Client Care"],tags:[],bio:"Joey is part of our client support team, assisting with bookings and client care.",isPsychologist:!1}],ap=[{question:"Do I need a GP referral to book?",answer:"No. You can book directly with us without a referral for any service, including ADHD and ASD assessments. If you want to access a Medicare rebate on therapy sessions, you will need a valid Mental Health Care Plan from your GP, but you can begin seeing a psychologist before you have one and arrange it at your next GP appointment. Our admin team can walk you through the options before you book so you know exactly what to expect."},{question:"Do you offer bulk billing?",answer:"We do not offer bulk billing. Session fees range from $165 to $300 depending on the clinician and appointment time. Registered psychologists charge $260.30 before 4pm and $270.45 at or after 4pm. Provisional psychologist Bridget Kosmas charges $165 before 4pm and $175 after. If you hold a valid Mental Health Care Plan from your GP, a Medicare rebate of $101.55 applies per therapy session, up to 10 sessions per calendar year. We process the rebate on the spot so you pay the gap only. ADHD and ASD assessment fees are self-funded and are not covered by Medicare."},{question:"What is a Mental Health Care Plan and how does it work?",answer:"A Mental Health Care Plan (MHCP) is a document prepared by your GP that enables Medicare rebates for psychology sessions. With a valid MHCP you receive a rebate of $101.55 per session for up to 10 sessions per calendar year. You book a longer GP appointment, your GP assesses your mental health needs and writes the plan, and then you bring it to your psychology appointment. We process the rebate directly, meaning you pay the gap on the day. A MHCP is not required to book and is not applicable to ADHD or ASD assessments."},{question:"What can I expect in my first session?",answer:"Your first session is largely about your psychologist understanding you. They will ask about what has brought you in, your background and history, your current circumstances, and what you are hoping to get from the process. It is also a chance for you to ask questions and get a sense of how your psychologist works. You do not need to prepare anything in advance. Most clients find that the first session feels more like a conversation than anything clinical. At the end of the session your psychologist will share their initial thoughts and discuss how they suggest you work together."},{question:"How do I find the right psychologist for me?",answer:"When you contact us, our admin team will speak with you to understand your needs, preferences, and goals before suggesting a match. We consider your presenting concerns, preferred appointment times, whether you want in-person or telehealth, and any preferences around the psychologist's experience or approach. After your first session we check in to make sure the match felt right. If it did not, we can arrange a different clinician within the team at no extra cost. Getting the fit right matters more than getting started quickly."},{question:"What is the difference between a psychologist and a psychiatrist?",answer:"Psychiatrists are medical doctors with specialist training in psychiatry. They can prescribe medication and manage complex or treatment-resistant presentations. Psychologists hold postgraduate qualifications, typically a master's or doctoral degree, in psychological assessment and therapy. They do not prescribe medication but provide evidence-based psychological treatment. Many clients work with both: a psychiatrist for medication management and a psychologist for therapy. If medication is appropriate following an ADHD assessment, we can refer you to a prescriber and continue to provide psychological support alongside that."},{question:"Do you offer telehealth sessions?",answer:"Yes. All of our psychologists offer telehealth appointments via a secure video platform. Telehealth sessions are available to clients anywhere in Australia. In-person appointments are available at our St Kilda clinic at G06-G07/22 St Kilda Road. Many clients use a combination of in-person and telehealth depending on the week. ADHD and ASD assessments require at least one in-person session for psychometric testing, though parts of the process can be completed online."},{question:"How long does a course of therapy typically take?",answer:"There is no fixed length. Some people come for a focused short-term piece of work, six to twelve sessions, while others engage in longer-term therapy over many months. It depends on what you are working on, how long the difficulty has been present, and what you want to achieve. Your psychologist will discuss this with you in the early sessions and revisit it as you progress. Under a Mental Health Care Plan you can access up to 10 rebated sessions per calendar year, after which you can continue at the standard fee or return to your GP to discuss your options."},{question:"What therapies do your psychologists use?",answer:"Our psychologists draw from a range of evidence-based approaches, tailoring the method to the person rather than applying a single framework to everyone. Approaches used across the team include Cognitive Behavioural Therapy (CBT), Acceptance and Commitment Therapy (ACT), Schema Therapy, Dialectical Behaviour Therapy (DBT), mindfulness-based approaches, and trauma-informed frameworks. For couples work, Lucy Adlard is Gottman Level 2 certified. For ADHD and ASD presentations, our psychologists take a neuroaffirming approach alongside structured psychometric assessment."},{question:"How do I know if I need an assessment?",answer:"An assessment may be worth considering if you are seeking clarity about whether you have ADHD or autism, have been told by a GP or psychiatrist that an assessment would be useful, or want a formal diagnostic report to access support at work, university, or through the NDIS. Assessment is not required before accessing therapy. If you are unsure whether an assessment is the right starting point, our admin team can help you think through this before you book. We can often guide you toward the most useful first step."},{question:"Why should I go to therapy?",answer:"You do not need to be in crisis to benefit from psychology. People seek support for many reasons: a specific episode of anxiety or low mood, longer-standing patterns they want to understand and change, relationship difficulties, a significant life transition, or simply a desire for more self-awareness. Therapy provides a structured, confidential space to work through what is getting in the way and build skills you can use outside of sessions. While we cannot guarantee specific outcomes, many clients find that it meaningfully improves their day-to-day functioning and quality of life."},{question:"I have tried therapy before and it did not help. Should I try again?",answer:"Previous unhelpful therapy experience is common and does not mean that psychological support cannot work for you. The most frequent reasons therapy does not help include a poor fit with the therapist, an approach that was not well-matched to the presenting concern, or timing that was not right. When you contact us, we encourage you to share what did and did not work previously. This helps us match you more carefully and approach the work in a way more likely to be useful. A different psychologist and a different approach can produce a very different result."},{question:"What does 'contemporary psychology' mean?",answer:"The name reflects our approach: grounded in current scientific evidence, responsive to the way people actually live, and open to integrating across different therapeutic frameworks rather than taking a rigid or dogmatic approach. Contemporary psychology as a discipline draws on neuroscience, cognitive science, social science, and clinical research to understand and support human wellbeing. We believe that effective psychological care should keep pace with that evidence and remain connected to the real circumstances of each client's life."}];var Qi=function(){return Qi=Object.assign||function(e){for(var s,n=1,r=arguments.length;n<r;n++){s=arguments[n];for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&(e[i]=s[i])}return e},Qi.apply(this,arguments)};function Ds(t,e){var s={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(s[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,n=Object.getOwnPropertySymbols(t);r<n.length;r++)e.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(t,n[r])&&(s[n[r]]=t[n[r]]);return s}function op(t,e,s,n){function r(i){return i instanceof s?i:new s(function(a){a(i)})}return new(s||(s=Promise))(function(i,a){function o(u){try{c(n.next(u))}catch(h){a(h)}}function l(u){try{c(n.throw(u))}catch(h){a(h)}}function c(u){u.done?i(u.value):r(u.value).then(o,l)}c((n=n.apply(t,e||[])).next())})}function Oy(t,e,s){if(s||arguments.length===2)for(var n=0,r=e.length,i;n<r;n++)(i||!(n in e))&&(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))}const lp=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);class kr extends Error{constructor(e,s="FunctionsError",n){super(e),this.name=s,this.context=n}}class cp extends kr{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class Zi extends kr{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class ea extends kr{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}var Mn;(function(t){t.Any="any",t.ApNortheast1="ap-northeast-1",t.ApNortheast2="ap-northeast-2",t.ApSouth1="ap-south-1",t.ApSoutheast1="ap-southeast-1",t.ApSoutheast2="ap-southeast-2",t.CaCentral1="ca-central-1",t.EuCentral1="eu-central-1",t.EuWest1="eu-west-1",t.EuWest2="eu-west-2",t.EuWest3="eu-west-3",t.SaEast1="sa-east-1",t.UsEast1="us-east-1",t.UsWest1="us-west-1",t.UsWest2="us-west-2"})(Mn||(Mn={}));class up{constructor(e,{headers:s={},customFetch:n,region:r=Mn.Any}={}){this.url=e,this.headers=s,this.region=r,this.fetch=lp(n)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return op(this,arguments,void 0,function*(s,n={}){var r;let i,a;try{const{headers:o,method:l,body:c,signal:u,timeout:h}=n;let d={},{region:f}=n;f||(f=this.region);const m=new URL(`${this.url}/${s}`);f&&f!=="any"&&(d["x-region"]=f,m.searchParams.set("forceFunctionRegion",f));let y;c&&(o&&!Object.prototype.hasOwnProperty.call(o,"Content-Type")||!o)?typeof Blob<"u"&&c instanceof Blob||c instanceof ArrayBuffer?(d["Content-Type"]="application/octet-stream",y=c):typeof c=="string"?(d["Content-Type"]="text/plain",y=c):typeof FormData<"u"&&c instanceof FormData?y=c:(d["Content-Type"]="application/json",y=JSON.stringify(c)):y=c;let g=u;h&&(a=new AbortController,i=setTimeout(()=>a.abort(),h),u?(g=a.signal,u.addEventListener("abort",()=>a.abort())):g=a.signal);const v=yield this.fetch(m.toString(),{method:l||"POST",headers:Object.assign(Object.assign(Object.assign({},d),this.headers),o),body:y,signal:g}).catch(S=>{throw new cp(S)}),x=v.headers.get("x-relay-error");if(x&&x==="true")throw new Zi(v);if(!v.ok)throw new ea(v);let w=((r=v.headers.get("Content-Type"))!==null&&r!==void 0?r:"text/plain").split(";")[0].trim(),b;return w==="application/json"?b=yield v.json():w==="application/octet-stream"||w==="application/pdf"?b=yield v.blob():w==="text/event-stream"?b=v:w==="multipart/form-data"?b=yield v.formData():b=yield v.text(),{data:b,error:null,response:v}}catch(o){return{data:null,error:o,response:o instanceof ea||o instanceof Zi?o.context:void 0}}finally{i&&clearTimeout(i)}})}}var hp=class extends Error{constructor(t){super(t.message),this.name="PostgrestError",this.details=t.details,this.hint=t.hint,this.code=t.code}},dp=class{constructor(t){var e,s;this.shouldThrowOnError=!1,this.method=t.method,this.url=t.url,this.headers=new Headers(t.headers),this.schema=t.schema,this.body=t.body,this.shouldThrowOnError=(e=t.shouldThrowOnError)!==null&&e!==void 0?e:!1,this.signal=t.signal,this.isMaybeSingle=(s=t.isMaybeSingle)!==null&&s!==void 0?s:!1,t.fetch?this.fetch=t.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(t,e){return this.headers=new Headers(this.headers),this.headers.set(t,e),this}then(t,e){var s=this;this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),this.method!=="GET"&&this.method!=="HEAD"&&this.headers.set("Content-Type","application/json");const n=this.fetch;let r=n(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async i=>{let a=null,o=null,l=null,c=i.status,u=i.statusText;if(i.ok){var h,d;if(s.method!=="HEAD"){var f;const v=await i.text();v===""||(s.headers.get("Accept")==="text/csv"||s.headers.get("Accept")&&(!((f=s.headers.get("Accept"))===null||f===void 0)&&f.includes("application/vnd.pgrst.plan+text"))?o=v:o=JSON.parse(v))}const y=(h=s.headers.get("Prefer"))===null||h===void 0?void 0:h.match(/count=(exact|planned|estimated)/),g=(d=i.headers.get("content-range"))===null||d===void 0?void 0:d.split("/");y&&g&&g.length>1&&(l=parseInt(g[1])),s.isMaybeSingle&&s.method==="GET"&&Array.isArray(o)&&(o.length>1?(a={code:"PGRST116",details:`Results contain ${o.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},o=null,l=null,c=406,u="Not Acceptable"):o.length===1?o=o[0]:o=null)}else{var m;const y=await i.text();try{a=JSON.parse(y),Array.isArray(a)&&i.status===404&&(o=[],a=null,c=200,u="OK")}catch{i.status===404&&y===""?(c=204,u="No Content"):a={message:y}}if(a&&s.isMaybeSingle&&(!(a==null||(m=a.details)===null||m===void 0)&&m.includes("0 rows"))&&(a=null,c=200,u="OK"),a&&s.shouldThrowOnError)throw new hp(a)}return{error:a,data:o,count:l,status:c,statusText:u}});return this.shouldThrowOnError||(r=r.catch(i=>{var a;let o="";const l=i==null?void 0:i.cause;if(l){var c,u,h,d;const m=(c=l==null?void 0:l.message)!==null&&c!==void 0?c:"",y=(u=l==null?void 0:l.code)!==null&&u!==void 0?u:"";o=`${(h=i==null?void 0:i.name)!==null&&h!==void 0?h:"FetchError"}: ${i==null?void 0:i.message}`,o+=`

Caused by: ${(d=l==null?void 0:l.name)!==null&&d!==void 0?d:"Error"}: ${m}`,y&&(o+=` (${y})`),l!=null&&l.stack&&(o+=`
${l.stack}`)}else{var f;o=(f=i==null?void 0:i.stack)!==null&&f!==void 0?f:""}return{error:{message:`${(a=i==null?void 0:i.name)!==null&&a!==void 0?a:"FetchError"}: ${i==null?void 0:i.message}`,details:o,hint:"",code:""},data:null,count:null,status:0,statusText:""}})),r.then(t,e)}returns(){return this}overrideTypes(){return this}},fp=class extends dp{select(t){let e=!1;const s=(t??"*").split("").map(n=>/\s/.test(n)&&!e?"":(n==='"'&&(e=!e),n)).join("");return this.url.searchParams.set("select",s),this.headers.append("Prefer","return=representation"),this}order(t,{ascending:e=!0,nullsFirst:s,foreignTable:n,referencedTable:r=n}={}){const i=r?`${r}.order`:"order",a=this.url.searchParams.get(i);return this.url.searchParams.set(i,`${a?`${a},`:""}${t}.${e?"asc":"desc"}${s===void 0?"":s?".nullsfirst":".nullslast"}`),this}limit(t,{foreignTable:e,referencedTable:s=e}={}){const n=typeof s>"u"?"limit":`${s}.limit`;return this.url.searchParams.set(n,`${t}`),this}range(t,e,{foreignTable:s,referencedTable:n=s}={}){const r=typeof n>"u"?"offset":`${n}.offset`,i=typeof n>"u"?"limit":`${n}.limit`;return this.url.searchParams.set(r,`${t}`),this.url.searchParams.set(i,`${e-t+1}`),this}abortSignal(t){return this.signal=t,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.method==="GET"?this.headers.set("Accept","application/json"):this.headers.set("Accept","application/vnd.pgrst.object+json"),this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:t=!1,verbose:e=!1,settings:s=!1,buffers:n=!1,wal:r=!1,format:i="text"}={}){var a;const o=[t?"analyze":null,e?"verbose":null,s?"settings":null,n?"buffers":null,r?"wal":null].filter(Boolean).join("|"),l=(a=this.headers.get("Accept"))!==null&&a!==void 0?a:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${i}; for="${l}"; options=${o};`),i==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(t){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${t}`),this}};const ta=new RegExp("[,()]");var it=class extends fp{eq(t,e){return this.url.searchParams.append(t,`eq.${e}`),this}neq(t,e){return this.url.searchParams.append(t,`neq.${e}`),this}gt(t,e){return this.url.searchParams.append(t,`gt.${e}`),this}gte(t,e){return this.url.searchParams.append(t,`gte.${e}`),this}lt(t,e){return this.url.searchParams.append(t,`lt.${e}`),this}lte(t,e){return this.url.searchParams.append(t,`lte.${e}`),this}like(t,e){return this.url.searchParams.append(t,`like.${e}`),this}likeAllOf(t,e){return this.url.searchParams.append(t,`like(all).{${e.join(",")}}`),this}likeAnyOf(t,e){return this.url.searchParams.append(t,`like(any).{${e.join(",")}}`),this}ilike(t,e){return this.url.searchParams.append(t,`ilike.${e}`),this}ilikeAllOf(t,e){return this.url.searchParams.append(t,`ilike(all).{${e.join(",")}}`),this}ilikeAnyOf(t,e){return this.url.searchParams.append(t,`ilike(any).{${e.join(",")}}`),this}regexMatch(t,e){return this.url.searchParams.append(t,`match.${e}`),this}regexIMatch(t,e){return this.url.searchParams.append(t,`imatch.${e}`),this}is(t,e){return this.url.searchParams.append(t,`is.${e}`),this}isDistinct(t,e){return this.url.searchParams.append(t,`isdistinct.${e}`),this}in(t,e){const s=Array.from(new Set(e)).map(n=>typeof n=="string"&&ta.test(n)?`"${n}"`:`${n}`).join(",");return this.url.searchParams.append(t,`in.(${s})`),this}notIn(t,e){const s=Array.from(new Set(e)).map(n=>typeof n=="string"&&ta.test(n)?`"${n}"`:`${n}`).join(",");return this.url.searchParams.append(t,`not.in.(${s})`),this}contains(t,e){return typeof e=="string"?this.url.searchParams.append(t,`cs.${e}`):Array.isArray(e)?this.url.searchParams.append(t,`cs.{${e.join(",")}}`):this.url.searchParams.append(t,`cs.${JSON.stringify(e)}`),this}containedBy(t,e){return typeof e=="string"?this.url.searchParams.append(t,`cd.${e}`):Array.isArray(e)?this.url.searchParams.append(t,`cd.{${e.join(",")}}`):this.url.searchParams.append(t,`cd.${JSON.stringify(e)}`),this}rangeGt(t,e){return this.url.searchParams.append(t,`sr.${e}`),this}rangeGte(t,e){return this.url.searchParams.append(t,`nxl.${e}`),this}rangeLt(t,e){return this.url.searchParams.append(t,`sl.${e}`),this}rangeLte(t,e){return this.url.searchParams.append(t,`nxr.${e}`),this}rangeAdjacent(t,e){return this.url.searchParams.append(t,`adj.${e}`),this}overlaps(t,e){return typeof e=="string"?this.url.searchParams.append(t,`ov.${e}`):this.url.searchParams.append(t,`ov.{${e.join(",")}}`),this}textSearch(t,e,{config:s,type:n}={}){let r="";n==="plain"?r="pl":n==="phrase"?r="ph":n==="websearch"&&(r="w");const i=s===void 0?"":`(${s})`;return this.url.searchParams.append(t,`${r}fts${i}.${e}`),this}match(t){return Object.entries(t).forEach(([e,s])=>{this.url.searchParams.append(e,`eq.${s}`)}),this}not(t,e,s){return this.url.searchParams.append(t,`not.${e}.${s}`),this}or(t,{foreignTable:e,referencedTable:s=e}={}){const n=s?`${s}.or`:"or";return this.url.searchParams.append(n,`(${t})`),this}filter(t,e,s){return this.url.searchParams.append(t,`${e}.${s}`),this}},pp=class{constructor(t,{headers:e={},schema:s,fetch:n}){this.url=t,this.headers=new Headers(e),this.schema=s,this.fetch=n}select(t,e){const{head:s=!1,count:n}=e??{},r=s?"HEAD":"GET";let i=!1;const a=(t??"*").split("").map(o=>/\s/.test(o)&&!i?"":(o==='"'&&(i=!i),o)).join("");return this.url.searchParams.set("select",a),n&&this.headers.append("Prefer",`count=${n}`),new it({method:r,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch})}insert(t,{count:e,defaultToNull:s=!0}={}){var n;const r="POST";if(e&&this.headers.append("Prefer",`count=${e}`),s||this.headers.append("Prefer","missing=default"),Array.isArray(t)){const i=t.reduce((a,o)=>a.concat(Object.keys(o)),[]);if(i.length>0){const a=[...new Set(i)].map(o=>`"${o}"`);this.url.searchParams.set("columns",a.join(","))}}return new it({method:r,url:this.url,headers:this.headers,schema:this.schema,body:t,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch})}upsert(t,{onConflict:e,ignoreDuplicates:s=!1,count:n,defaultToNull:r=!0}={}){var i;const a="POST";if(this.headers.append("Prefer",`resolution=${s?"ignore":"merge"}-duplicates`),e!==void 0&&this.url.searchParams.set("on_conflict",e),n&&this.headers.append("Prefer",`count=${n}`),r||this.headers.append("Prefer","missing=default"),Array.isArray(t)){const o=t.reduce((l,c)=>l.concat(Object.keys(c)),[]);if(o.length>0){const l=[...new Set(o)].map(c=>`"${c}"`);this.url.searchParams.set("columns",l.join(","))}}return new it({method:a,url:this.url,headers:this.headers,schema:this.schema,body:t,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch})}update(t,{count:e}={}){var s;const n="PATCH";return e&&this.headers.append("Prefer",`count=${e}`),new it({method:n,url:this.url,headers:this.headers,schema:this.schema,body:t,fetch:(s=this.fetch)!==null&&s!==void 0?s:fetch})}delete({count:t}={}){var e;const s="DELETE";return t&&this.headers.append("Prefer",`count=${t}`),new it({method:s,url:this.url,headers:this.headers,schema:this.schema,fetch:(e=this.fetch)!==null&&e!==void 0?e:fetch})}},mp=class pl{constructor(e,{headers:s={},schema:n,fetch:r}={}){this.url=e,this.headers=new Headers(s),this.schemaName=n,this.fetch=r}from(e){if(!e||typeof e!="string"||e.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");return new pp(new URL(`${this.url}/${e}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(e){return new pl(this.url,{headers:this.headers,schema:e,fetch:this.fetch})}rpc(e,s={},{head:n=!1,get:r=!1,count:i}={}){var a;let o;const l=new URL(`${this.url}/rpc/${e}`);let c;n||r?(o=n?"HEAD":"GET",Object.entries(s).filter(([h,d])=>d!==void 0).map(([h,d])=>[h,Array.isArray(d)?`{${d.join(",")}}`:`${d}`]).forEach(([h,d])=>{l.searchParams.append(h,d)})):(o="POST",c=s);const u=new Headers(this.headers);return i&&u.set("Prefer",`count=${i}`),new it({method:o,url:l,headers:u,schema:this.schemaName,body:c,fetch:(a=this.fetch)!==null&&a!==void 0?a:fetch})}};class gp{constructor(){}static detectEnvironment(){var e;if(typeof WebSocket<"u")return{type:"native",constructor:WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocket<"u")return{type:"native",constructor:globalThis.WebSocket};if(typeof global<"u"&&typeof global.WebSocket<"u")return{type:"native",constructor:global.WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocketPair<"u"&&typeof globalThis.WebSocket>"u")return{type:"cloudflare",error:"Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.",workaround:"Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime."};if(typeof globalThis<"u"&&globalThis.EdgeRuntime||typeof navigator<"u"&&(!((e=navigator.userAgent)===null||e===void 0)&&e.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};if(typeof process<"u"){const s=process.versions;if(s&&s.node){const n=s.node,r=parseInt(n.replace(/^v/,"").split(".")[0]);return r>=22?typeof globalThis.WebSocket<"u"?{type:"native",constructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${r} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${r} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option:
import ws from "ws"
new RealtimeClient(url, { transport: ws })`}}}return{type:"unsupported",error:"Unknown JavaScript runtime without WebSocket support.",workaround:"Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation."}}static getWebSocketConstructor(){const e=this.detectEnvironment();if(e.constructor)return e.constructor;let s=e.error||"WebSocket not supported in this environment.";throw e.workaround&&(s+=`

Suggested solution: ${e.workaround}`),new Error(s)}static createWebSocket(e,s){const n=this.getWebSocketConstructor();return new n(e,s)}static isWebSocketSupported(){try{const e=this.detectEnvironment();return e.type==="native"||e.type==="ws"}catch{return!1}}}const yp="2.88.0",vp=`realtime-js/${yp}`,ml="1.0.0",wp="2.0.0",sa=ml,$n=1e4,bp=1e3,xp=100;var Re;(function(t){t[t.connecting=0]="connecting",t[t.open=1]="open",t[t.closing=2]="closing",t[t.closed=3]="closed"})(Re||(Re={}));var F;(function(t){t.closed="closed",t.errored="errored",t.joined="joined",t.joining="joining",t.leaving="leaving"})(F||(F={}));var de;(function(t){t.close="phx_close",t.error="phx_error",t.join="phx_join",t.reply="phx_reply",t.leave="phx_leave",t.access_token="access_token"})(de||(de={}));var Ln;(function(t){t.websocket="websocket"})(Ln||(Ln={}));var qe;(function(t){t.Connecting="connecting",t.Open="open",t.Closing="closing",t.Closed="closed"})(qe||(qe={}));class _p{constructor(e){this.HEADER_LENGTH=1,this.USER_BROADCAST_PUSH_META_LENGTH=6,this.KINDS={userBroadcastPush:3,userBroadcast:4},this.BINARY_ENCODING=0,this.JSON_ENCODING=1,this.BROADCAST_EVENT="broadcast",this.allowedMetadataKeys=[],this.allowedMetadataKeys=e??[]}encode(e,s){if(e.event===this.BROADCAST_EVENT&&!(e.payload instanceof ArrayBuffer)&&typeof e.payload.event=="string")return s(this._binaryEncodeUserBroadcastPush(e));let n=[e.join_ref,e.ref,e.topic,e.event,e.payload];return s(JSON.stringify(n))}_binaryEncodeUserBroadcastPush(e){var s;return this._isArrayBuffer((s=e.payload)===null||s===void 0?void 0:s.payload)?this._encodeBinaryUserBroadcastPush(e):this._encodeJsonUserBroadcastPush(e)}_encodeBinaryUserBroadcastPush(e){var s,n;const r=(n=(s=e.payload)===null||s===void 0?void 0:s.payload)!==null&&n!==void 0?n:new ArrayBuffer(0);return this._encodeUserBroadcastPush(e,this.BINARY_ENCODING,r)}_encodeJsonUserBroadcastPush(e){var s,n;const r=(n=(s=e.payload)===null||s===void 0?void 0:s.payload)!==null&&n!==void 0?n:{},a=new TextEncoder().encode(JSON.stringify(r)).buffer;return this._encodeUserBroadcastPush(e,this.JSON_ENCODING,a)}_encodeUserBroadcastPush(e,s,n){var r,i;const a=e.topic,o=(r=e.ref)!==null&&r!==void 0?r:"",l=(i=e.join_ref)!==null&&i!==void 0?i:"",c=e.payload.event,u=this.allowedMetadataKeys?this._pick(e.payload,this.allowedMetadataKeys):{},h=Object.keys(u).length===0?"":JSON.stringify(u);if(l.length>255)throw new Error(`joinRef length ${l.length} exceeds maximum of 255`);if(o.length>255)throw new Error(`ref length ${o.length} exceeds maximum of 255`);if(a.length>255)throw new Error(`topic length ${a.length} exceeds maximum of 255`);if(c.length>255)throw new Error(`userEvent length ${c.length} exceeds maximum of 255`);if(h.length>255)throw new Error(`metadata length ${h.length} exceeds maximum of 255`);const d=this.USER_BROADCAST_PUSH_META_LENGTH+l.length+o.length+a.length+c.length+h.length,f=new ArrayBuffer(this.HEADER_LENGTH+d);let m=new DataView(f),y=0;m.setUint8(y++,this.KINDS.userBroadcastPush),m.setUint8(y++,l.length),m.setUint8(y++,o.length),m.setUint8(y++,a.length),m.setUint8(y++,c.length),m.setUint8(y++,h.length),m.setUint8(y++,s),Array.from(l,v=>m.setUint8(y++,v.charCodeAt(0))),Array.from(o,v=>m.setUint8(y++,v.charCodeAt(0))),Array.from(a,v=>m.setUint8(y++,v.charCodeAt(0))),Array.from(c,v=>m.setUint8(y++,v.charCodeAt(0))),Array.from(h,v=>m.setUint8(y++,v.charCodeAt(0)));var g=new Uint8Array(f.byteLength+n.byteLength);return g.set(new Uint8Array(f),0),g.set(new Uint8Array(n),f.byteLength),g.buffer}decode(e,s){if(this._isArrayBuffer(e)){let n=this._binaryDecode(e);return s(n)}if(typeof e=="string"){const n=JSON.parse(e),[r,i,a,o,l]=n;return s({join_ref:r,ref:i,topic:a,event:o,payload:l})}return s({})}_binaryDecode(e){const s=new DataView(e),n=s.getUint8(0),r=new TextDecoder;switch(n){case this.KINDS.userBroadcast:return this._decodeUserBroadcast(e,s,r)}}_decodeUserBroadcast(e,s,n){const r=s.getUint8(1),i=s.getUint8(2),a=s.getUint8(3),o=s.getUint8(4);let l=this.HEADER_LENGTH+4;const c=n.decode(e.slice(l,l+r));l=l+r;const u=n.decode(e.slice(l,l+i));l=l+i;const h=n.decode(e.slice(l,l+a));l=l+a;const d=e.slice(l,e.byteLength),f=o===this.JSON_ENCODING?JSON.parse(n.decode(d)):d,m={type:this.BROADCAST_EVENT,event:u,payload:f};return a>0&&(m.meta=JSON.parse(h)),{join_ref:null,ref:null,topic:c,event:this.BROADCAST_EVENT,payload:m}}_isArrayBuffer(e){var s;return e instanceof ArrayBuffer||((s=e==null?void 0:e.constructor)===null||s===void 0?void 0:s.name)==="ArrayBuffer"}_pick(e,s){return!e||typeof e!="object"?{}:Object.fromEntries(Object.entries(e).filter(([n])=>s.includes(n)))}}class gl{constructor(e,s){this.callback=e,this.timerCalc=s,this.timer=void 0,this.tries=0,this.callback=e,this.timerCalc=s}reset(){this.tries=0,clearTimeout(this.timer),this.timer=void 0}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}}var I;(function(t){t.abstime="abstime",t.bool="bool",t.date="date",t.daterange="daterange",t.float4="float4",t.float8="float8",t.int2="int2",t.int4="int4",t.int4range="int4range",t.int8="int8",t.int8range="int8range",t.json="json",t.jsonb="jsonb",t.money="money",t.numeric="numeric",t.oid="oid",t.reltime="reltime",t.text="text",t.time="time",t.timestamp="timestamp",t.timestamptz="timestamptz",t.timetz="timetz",t.tsrange="tsrange",t.tstzrange="tstzrange"})(I||(I={}));const na=(t,e,s={})=>{var n;const r=(n=s.skipTypes)!==null&&n!==void 0?n:[];return e?Object.keys(e).reduce((i,a)=>(i[a]=Sp(a,t,e,r),i),{}):{}},Sp=(t,e,s,n)=>{const r=e.find(o=>o.name===t),i=r==null?void 0:r.type,a=s[t];return i&&!n.includes(i)?yl(i,a):Bn(a)},yl=(t,e)=>{if(t.charAt(0)==="_"){const s=t.slice(1,t.length);return Ap(e,s)}switch(t){case I.bool:return Tp(e);case I.float4:case I.float8:case I.int2:case I.int4:case I.int8:case I.numeric:case I.oid:return kp(e);case I.json:case I.jsonb:return Ep(e);case I.timestamp:return Pp(e);case I.abstime:case I.date:case I.daterange:case I.int4range:case I.int8range:case I.money:case I.reltime:case I.text:case I.time:case I.timestamptz:case I.timetz:case I.tsrange:case I.tstzrange:return Bn(e);default:return Bn(e)}},Bn=t=>t,Tp=t=>{switch(t){case"t":return!0;case"f":return!1;default:return t}},kp=t=>{if(typeof t=="string"){const e=parseFloat(t);if(!Number.isNaN(e))return e}return t},Ep=t=>{if(typeof t=="string")try{return JSON.parse(t)}catch{return t}return t},Ap=(t,e)=>{if(typeof t!="string")return t;const s=t.length-1,n=t[s];if(t[0]==="{"&&n==="}"){let i;const a=t.slice(1,s);try{i=JSON.parse("["+a+"]")}catch{i=a?a.split(","):[]}return i.map(o=>yl(e,o))}return t},Pp=t=>typeof t=="string"?t.replace(" ","T"):t,vl=t=>{const e=new URL(t);return e.protocol=e.protocol.replace(/^ws/i,"http"),e.pathname=e.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),e.pathname===""||e.pathname==="/"?e.pathname="/api/broadcast":e.pathname=e.pathname+"/api/broadcast",e.href};class Qs{constructor(e,s,n={},r=$n){this.channel=e,this.event=s,this.payload=n,this.timeout=r,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHooks=[],this.refEvent=null}resend(e){this.timeout=e,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(e){this.payload=Object.assign(Object.assign({},this.payload),e)}receive(e,s){var n;return this._hasReceived(e)&&s((n=this.receivedResp)===null||n===void 0?void 0:n.response),this.recHooks.push({status:e,callback:s}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);const e=s=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=s,this._matchReceive(s)};this.channel._on(this.refEvent,{},e),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}trigger(e,s){this.refEvent&&this.channel._trigger(this.refEvent,{status:e,response:s})}destroy(){this._cancelRefEvent(),this._cancelTimeout()}_cancelRefEvent(){this.refEvent&&this.channel._off(this.refEvent,{})}_cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}_matchReceive({status:e,response:s}){this.recHooks.filter(n=>n.status===e).forEach(n=>n.callback(s))}_hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}}var ra;(function(t){t.SYNC="sync",t.JOIN="join",t.LEAVE="leave"})(ra||(ra={}));class Ct{constructor(e,s){this.channel=e,this.state={},this.pendingDiffs=[],this.joinRef=null,this.enabled=!1,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};const n=(s==null?void 0:s.events)||{state:"presence_state",diff:"presence_diff"};this.channel._on(n.state,{},r=>{const{onJoin:i,onLeave:a,onSync:o}=this.caller;this.joinRef=this.channel._joinRef(),this.state=Ct.syncState(this.state,r,i,a),this.pendingDiffs.forEach(l=>{this.state=Ct.syncDiff(this.state,l,i,a)}),this.pendingDiffs=[],o()}),this.channel._on(n.diff,{},r=>{const{onJoin:i,onLeave:a,onSync:o}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(r):(this.state=Ct.syncDiff(this.state,r,i,a),o())}),this.onJoin((r,i,a)=>{this.channel._trigger("presence",{event:"join",key:r,currentPresences:i,newPresences:a})}),this.onLeave((r,i,a)=>{this.channel._trigger("presence",{event:"leave",key:r,currentPresences:i,leftPresences:a})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(e,s,n,r){const i=this.cloneDeep(e),a=this.transformState(s),o={},l={};return this.map(i,(c,u)=>{a[c]||(l[c]=u)}),this.map(a,(c,u)=>{const h=i[c];if(h){const d=u.map(g=>g.presence_ref),f=h.map(g=>g.presence_ref),m=u.filter(g=>f.indexOf(g.presence_ref)<0),y=h.filter(g=>d.indexOf(g.presence_ref)<0);m.length>0&&(o[c]=m),y.length>0&&(l[c]=y)}else o[c]=u}),this.syncDiff(i,{joins:o,leaves:l},n,r)}static syncDiff(e,s,n,r){const{joins:i,leaves:a}={joins:this.transformState(s.joins),leaves:this.transformState(s.leaves)};return n||(n=()=>{}),r||(r=()=>{}),this.map(i,(o,l)=>{var c;const u=(c=e[o])!==null&&c!==void 0?c:[];if(e[o]=this.cloneDeep(l),u.length>0){const h=e[o].map(f=>f.presence_ref),d=u.filter(f=>h.indexOf(f.presence_ref)<0);e[o].unshift(...d)}n(o,u,l)}),this.map(a,(o,l)=>{let c=e[o];if(!c)return;const u=l.map(h=>h.presence_ref);c=c.filter(h=>u.indexOf(h.presence_ref)<0),e[o]=c,r(o,c,l),c.length===0&&delete e[o]}),e}static map(e,s){return Object.getOwnPropertyNames(e).map(n=>s(n,e[n]))}static transformState(e){return e=this.cloneDeep(e),Object.getOwnPropertyNames(e).reduce((s,n)=>{const r=e[n];return"metas"in r?s[n]=r.metas.map(i=>(i.presence_ref=i.phx_ref,delete i.phx_ref,delete i.phx_ref_prev,i)):s[n]=r,s},{})}static cloneDeep(e){return JSON.parse(JSON.stringify(e))}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel._joinRef()}}var ia;(function(t){t.ALL="*",t.INSERT="INSERT",t.UPDATE="UPDATE",t.DELETE="DELETE"})(ia||(ia={}));var Rt;(function(t){t.BROADCAST="broadcast",t.PRESENCE="presence",t.POSTGRES_CHANGES="postgres_changes",t.SYSTEM="system"})(Rt||(Rt={}));var Te;(function(t){t.SUBSCRIBED="SUBSCRIBED",t.TIMED_OUT="TIMED_OUT",t.CLOSED="CLOSED",t.CHANNEL_ERROR="CHANNEL_ERROR"})(Te||(Te={}));class ht{constructor(e,s={config:{}},n){var r,i;if(this.topic=e,this.params=s,this.socket=n,this.bindings={},this.state=F.closed,this.joinedOnce=!1,this.pushBuffer=[],this.subTopic=e.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},s.config),this.timeout=this.socket.timeout,this.joinPush=new Qs(this,de.join,this.params,this.timeout),this.rejoinTimer=new gl(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=F.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(a=>a.send()),this.pushBuffer=[]}),this._onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=F.closed,this.socket._remove(this)}),this._onError(a=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,a),this.state=F.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=F.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",a=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,a),this.state=F.errored,this.rejoinTimer.scheduleTimeout())}),this._on(de.reply,{},(a,o)=>{this._trigger(this._replyEventName(o),a)}),this.presence=new Ct(this),this.broadcastEndpointURL=vl(this.socket.endPoint),this.private=this.params.config.private||!1,!this.private&&(!((i=(r=this.params.config)===null||r===void 0?void 0:r.broadcast)===null||i===void 0)&&i.replay))throw`tried to use replay on public channel '${this.topic}'. It must be a private channel.`}subscribe(e,s=this.timeout){var n,r,i;if(this.socket.isConnected()||this.socket.connect(),this.state==F.closed){const{config:{broadcast:a,presence:o,private:l}}=this.params,c=(r=(n=this.bindings.postgres_changes)===null||n===void 0?void 0:n.map(f=>f.filter))!==null&&r!==void 0?r:[],u=!!this.bindings[Rt.PRESENCE]&&this.bindings[Rt.PRESENCE].length>0||((i=this.params.config.presence)===null||i===void 0?void 0:i.enabled)===!0,h={},d={broadcast:a,presence:Object.assign(Object.assign({},o),{enabled:u}),postgres_changes:c,private:l};this.socket.accessTokenValue&&(h.access_token=this.socket.accessTokenValue),this._onError(f=>e==null?void 0:e(Te.CHANNEL_ERROR,f)),this._onClose(()=>e==null?void 0:e(Te.CLOSED)),this.updateJoinPayload(Object.assign({config:d},h)),this.joinedOnce=!0,this._rejoin(s),this.joinPush.receive("ok",async({postgres_changes:f})=>{var m;if(this.socket._isManualToken()||this.socket.setAuth(),f===void 0){e==null||e(Te.SUBSCRIBED);return}else{const y=this.bindings.postgres_changes,g=(m=y==null?void 0:y.length)!==null&&m!==void 0?m:0,v=[];for(let x=0;x<g;x++){const w=y[x],{filter:{event:b,schema:S,table:T,filter:j}}=w,E=f&&f[x];if(E&&E.event===b&&ht.isFilterValueEqual(E.schema,S)&&ht.isFilterValueEqual(E.table,T)&&ht.isFilterValueEqual(E.filter,j))v.push(Object.assign(Object.assign({},w),{id:E.id}));else{this.unsubscribe(),this.state=F.errored,e==null||e(Te.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=v,e&&e(Te.SUBSCRIBED);return}}).receive("error",f=>{this.state=F.errored,e==null||e(Te.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(f).join(", ")||"error")))}).receive("timeout",()=>{e==null||e(Te.TIMED_OUT)})}return this}presenceState(){return this.presence.state}async track(e,s={}){return await this.send({type:"presence",event:"track",payload:e},s.timeout||this.timeout)}async untrack(e={}){return await this.send({type:"presence",event:"untrack"},e)}on(e,s,n){return this.state===F.joined&&e===Rt.PRESENCE&&(this.socket.log("channel",`resubscribe to ${this.topic} due to change in presence callbacks on joined channel`),this.unsubscribe().then(async()=>await this.subscribe())),this._on(e,s,n)}async httpSend(e,s,n={}){var r;if(s==null)return Promise.reject("Payload is required for httpSend()");const i={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(i.Authorization=`Bearer ${this.socket.accessTokenValue}`);const a={method:"POST",headers:i,body:JSON.stringify({messages:[{topic:this.subTopic,event:e,payload:s,private:this.private}]})},o=await this._fetchWithTimeout(this.broadcastEndpointURL,a,(r=n.timeout)!==null&&r!==void 0?r:this.timeout);if(o.status===202)return{success:!0};let l=o.statusText;try{const c=await o.json();l=c.error||c.message||l}catch{}return Promise.reject(new Error(l))}async send(e,s={}){var n,r;if(!this._canPush()&&e.type==="broadcast"){console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated in the future. Please use httpSend() explicitly for REST delivery.");const{event:i,payload:a}=e,o={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(o.Authorization=`Bearer ${this.socket.accessTokenValue}`);const l={method:"POST",headers:o,body:JSON.stringify({messages:[{topic:this.subTopic,event:i,payload:a,private:this.private}]})};try{const c=await this._fetchWithTimeout(this.broadcastEndpointURL,l,(n=s.timeout)!==null&&n!==void 0?n:this.timeout);return await((r=c.body)===null||r===void 0?void 0:r.cancel()),c.ok?"ok":"error"}catch(c){return c.name==="AbortError"?"timed out":"error"}}else return new Promise(i=>{var a,o,l;const c=this._push(e.type,e,s.timeout||this.timeout);e.type==="broadcast"&&!(!((l=(o=(a=this.params)===null||a===void 0?void 0:a.config)===null||o===void 0?void 0:o.broadcast)===null||l===void 0)&&l.ack)&&i("ok"),c.receive("ok",()=>i("ok")),c.receive("error",()=>i("error")),c.receive("timeout",()=>i("timed out"))})}updateJoinPayload(e){this.joinPush.updatePayload(e)}unsubscribe(e=this.timeout){this.state=F.leaving;const s=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(de.close,"leave",this._joinRef())};this.joinPush.destroy();let n=null;return new Promise(r=>{n=new Qs(this,de.leave,{},e),n.receive("ok",()=>{s(),r("ok")}).receive("timeout",()=>{s(),r("timed out")}).receive("error",()=>{r("error")}),n.send(),this._canPush()||n.trigger("ok",{})}).finally(()=>{n==null||n.destroy()})}teardown(){this.pushBuffer.forEach(e=>e.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=F.closed,this.bindings={}}async _fetchWithTimeout(e,s,n){const r=new AbortController,i=setTimeout(()=>r.abort(),n),a=await this.socket.fetch(e,Object.assign(Object.assign({},s),{signal:r.signal}));return clearTimeout(i),a}_push(e,s,n=this.timeout){if(!this.joinedOnce)throw`tried to push '${e}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let r=new Qs(this,e,s,n);return this._canPush()?r.send():this._addToPushBuffer(r),r}_addToPushBuffer(e){if(e.startTimeout(),this.pushBuffer.push(e),this.pushBuffer.length>xp){const s=this.pushBuffer.shift();s&&(s.destroy(),this.socket.log("channel",`discarded push due to buffer overflow: ${s.event}`,s.payload))}}_onMessage(e,s,n){return s}_isMember(e){return this.topic===e}_joinRef(){return this.joinPush.ref}_trigger(e,s,n){var r,i;const a=e.toLocaleLowerCase(),{close:o,error:l,leave:c,join:u}=de;if(n&&[o,l,c,u].indexOf(a)>=0&&n!==this._joinRef())return;let d=this._onMessage(a,s,n);if(s&&!d)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(a)?(r=this.bindings.postgres_changes)===null||r===void 0||r.filter(f=>{var m,y,g;return((m=f.filter)===null||m===void 0?void 0:m.event)==="*"||((g=(y=f.filter)===null||y===void 0?void 0:y.event)===null||g===void 0?void 0:g.toLocaleLowerCase())===a}).map(f=>f.callback(d,n)):(i=this.bindings[a])===null||i===void 0||i.filter(f=>{var m,y,g,v,x,w;if(["broadcast","presence","postgres_changes"].includes(a))if("id"in f){const b=f.id,S=(m=f.filter)===null||m===void 0?void 0:m.event;return b&&((y=s.ids)===null||y===void 0?void 0:y.includes(b))&&(S==="*"||(S==null?void 0:S.toLocaleLowerCase())===((g=s.data)===null||g===void 0?void 0:g.type.toLocaleLowerCase()))}else{const b=(x=(v=f==null?void 0:f.filter)===null||v===void 0?void 0:v.event)===null||x===void 0?void 0:x.toLocaleLowerCase();return b==="*"||b===((w=s==null?void 0:s.event)===null||w===void 0?void 0:w.toLocaleLowerCase())}else return f.type.toLocaleLowerCase()===a}).map(f=>{if(typeof d=="object"&&"ids"in d){const m=d.data,{schema:y,table:g,commit_timestamp:v,type:x,errors:w}=m;d=Object.assign(Object.assign({},{schema:y,table:g,commit_timestamp:v,eventType:x,new:{},old:{},errors:w}),this._getPayloadRecords(m))}f.callback(d,n)})}_isClosed(){return this.state===F.closed}_isJoined(){return this.state===F.joined}_isJoining(){return this.state===F.joining}_isLeaving(){return this.state===F.leaving}_replyEventName(e){return`chan_reply_${e}`}_on(e,s,n){const r=e.toLocaleLowerCase(),i={type:r,filter:s,callback:n};return this.bindings[r]?this.bindings[r].push(i):this.bindings[r]=[i],this}_off(e,s){const n=e.toLocaleLowerCase();return this.bindings[n]&&(this.bindings[n]=this.bindings[n].filter(r=>{var i;return!(((i=r.type)===null||i===void 0?void 0:i.toLocaleLowerCase())===n&&ht.isEqual(r.filter,s))})),this}static isEqual(e,s){if(Object.keys(e).length!==Object.keys(s).length)return!1;for(const n in e)if(e[n]!==s[n])return!1;return!0}static isFilterValueEqual(e,s){return(e??void 0)===(s??void 0)}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(e){this._on(de.close,{},e)}_onError(e){this._on(de.error,{},s=>e(s))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(e=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=F.joining,this.joinPush.resend(e))}_getPayloadRecords(e){const s={new:{},old:{}};return(e.type==="INSERT"||e.type==="UPDATE")&&(s.new=na(e.columns,e.record)),(e.type==="UPDATE"||e.type==="DELETE")&&(s.old=na(e.columns,e.old_record)),s}}const Zs=()=>{},ts={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},Cp=[1e3,2e3,5e3,1e4],Rp=1e4,jp=`
  addEventListener("message", (e) => {
    if (e.data.event === "start") {
      setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
    }
  });`;class Op{constructor(e,s){var n;if(this.accessTokenValue=null,this.apiKey=null,this._manuallySetToken=!1,this.channels=new Array,this.endPoint="",this.httpEndpoint="",this.headers={},this.params={},this.timeout=$n,this.transport=null,this.heartbeatIntervalMs=ts.HEARTBEAT_INTERVAL,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.heartbeatCallback=Zs,this.ref=0,this.reconnectTimer=null,this.vsn=sa,this.logger=Zs,this.conn=null,this.sendBuffer=[],this.serializer=new _p,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.accessToken=null,this._connectionState="disconnected",this._wasManualDisconnect=!1,this._authPromise=null,this._resolveFetch=r=>r?(...i)=>r(...i):(...i)=>fetch(...i),!(!((n=s==null?void 0:s.params)===null||n===void 0)&&n.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=s.params.apikey,this.endPoint=`${e}/${Ln.websocket}`,this.httpEndpoint=vl(e),this._initializeOptions(s),this._setupReconnectionTimer(),this.fetch=this._resolveFetch(s==null?void 0:s.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.conn!==null&&this.isConnected())){if(this._setConnectionState("connecting"),this.accessToken&&!this._authPromise&&this._setAuthSafely("connect"),this.transport)this.conn=new this.transport(this.endpointURL());else try{this.conn=gp.createWebSocket(this.endpointURL())}catch(e){this._setConnectionState("disconnected");const s=e.message;throw s.includes("Node.js")?new Error(`${s}

To use Realtime in Node.js, you need to provide a WebSocket implementation:

Option 1: Use Node.js 22+ which has native WebSocket support
Option 2: Install and provide the "ws" package:

  npm install ws

  import ws from "ws"
  const client = new RealtimeClient(url, {
    ...options,
    transport: ws
  })`):new Error(`WebSocket not available: ${s}`)}this._setupConnectionHandlers()}}endpointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:this.vsn}))}disconnect(e,s){if(!this.isDisconnecting())if(this._setConnectionState("disconnecting",!0),this.conn){const n=setTimeout(()=>{this._setConnectionState("disconnected")},100);this.conn.onclose=()=>{clearTimeout(n),this._setConnectionState("disconnected")},typeof this.conn.close=="function"&&(e?this.conn.close(e,s??""):this.conn.close()),this._teardownConnection()}else this._setConnectionState("disconnected")}getChannels(){return this.channels}async removeChannel(e){const s=await e.unsubscribe();return this.channels.length===0&&this.disconnect(),s}async removeAllChannels(){const e=await Promise.all(this.channels.map(s=>s.unsubscribe()));return this.channels=[],this.disconnect(),e}log(e,s,n){this.logger(e,s,n)}connectionState(){switch(this.conn&&this.conn.readyState){case Re.connecting:return qe.Connecting;case Re.open:return qe.Open;case Re.closing:return qe.Closing;default:return qe.Closed}}isConnected(){return this.connectionState()===qe.Open}isConnecting(){return this._connectionState==="connecting"}isDisconnecting(){return this._connectionState==="disconnecting"}channel(e,s={config:{}}){const n=`realtime:${e}`,r=this.getChannels().find(i=>i.topic===n);if(r)return r;{const i=new ht(`realtime:${e}`,s,this);return this.channels.push(i),i}}push(e){const{topic:s,event:n,payload:r,ref:i}=e,a=()=>{this.encode(e,o=>{var l;(l=this.conn)===null||l===void 0||l.send(o)})};this.log("push",`${s} ${n} (${i})`,r),this.isConnected()?a():this.sendBuffer.push(a)}async setAuth(e=null){this._authPromise=this._performAuth(e);try{await this._authPromise}finally{this._authPromise=null}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){var e;if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(s){this.log("error","error in heartbeat callback",s)}return}if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(s){this.log("error","error in heartbeat callback",s)}this._wasManualDisconnect=!1,(e=this.conn)===null||e===void 0||e.close(bp,"heartbeat timeout"),setTimeout(()=>{var s;this.isConnected()||(s=this.reconnectTimer)===null||s===void 0||s.scheduleTimeout()},ts.HEARTBEAT_TIMEOUT_FALLBACK);return}this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(s){this.log("error","error in heartbeat callback",s)}this._setAuthSafely("heartbeat")}onHeartbeat(e){this.heartbeatCallback=e}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}_makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}_leaveOpenTopic(e){let s=this.channels.find(n=>n.topic===e&&(n._isJoined()||n._isJoining()));s&&(this.log("transport",`leaving duplicate topic "${e}"`),s.unsubscribe())}_remove(e){this.channels=this.channels.filter(s=>s.topic!==e.topic)}_onConnMessage(e){this.decode(e.data,s=>{if(s.topic==="phoenix"&&s.event==="phx_reply")try{this.heartbeatCallback(s.payload.status==="ok"?"ok":"error")}catch(c){this.log("error","error in heartbeat callback",c)}s.ref&&s.ref===this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null);const{topic:n,event:r,payload:i,ref:a}=s,o=a?`(${a})`:"",l=i.status||"";this.log("receive",`${l} ${n} ${r} ${o}`.trim(),i),this.channels.filter(c=>c._isMember(n)).forEach(c=>c._trigger(r,i,a)),this._triggerStateCallbacks("message",s)})}_clearTimer(e){var s;e==="heartbeat"&&this.heartbeatTimer?(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0):e==="reconnect"&&((s=this.reconnectTimer)===null||s===void 0||s.reset())}_clearAllTimers(){this._clearTimer("heartbeat"),this._clearTimer("reconnect")}_setupConnectionHandlers(){this.conn&&("binaryType"in this.conn&&(this.conn.binaryType="arraybuffer"),this.conn.onopen=()=>this._onConnOpen(),this.conn.onerror=e=>this._onConnError(e),this.conn.onmessage=e=>this._onConnMessage(e),this.conn.onclose=e=>this._onConnClose(e),this.conn.readyState===Re.open&&this._onConnOpen())}_teardownConnection(){if(this.conn){if(this.conn.readyState===Re.open||this.conn.readyState===Re.connecting)try{this.conn.close()}catch(e){this.log("error","Error closing connection",e)}this.conn.onopen=null,this.conn.onerror=null,this.conn.onmessage=null,this.conn.onclose=null,this.conn=null}this._clearAllTimers(),this._terminateWorker(),this.channels.forEach(e=>e.teardown())}_onConnOpen(){this._setConnectionState("connected"),this.log("transport",`connected to ${this.endpointURL()}`),(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).then(()=>{this.flushSendBuffer()}).catch(s=>{this.log("error","error waiting for auth on connect",s),this.flushSendBuffer()}),this._clearTimer("reconnect"),this.worker?this.workerRef||this._startWorkerHeartbeat():this._startHeartbeat(),this._triggerStateCallbacks("open")}_startHeartbeat(){this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");const e=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(e),this.workerRef.onerror=s=>{this.log("worker","worker error",s.message),this._terminateWorker()},this.workerRef.onmessage=s=>{s.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_terminateWorker(){this.workerRef&&(this.log("worker","terminating worker"),this.workerRef.terminate(),this.workerRef=void 0)}_onConnClose(e){var s;this._setConnectionState("disconnected"),this.log("transport","close",e),this._triggerChanError(),this._clearTimer("heartbeat"),this._wasManualDisconnect||(s=this.reconnectTimer)===null||s===void 0||s.scheduleTimeout(),this._triggerStateCallbacks("close",e)}_onConnError(e){this._setConnectionState("disconnected"),this.log("transport",`${e}`),this._triggerChanError(),this._triggerStateCallbacks("error",e)}_triggerChanError(){this.channels.forEach(e=>e._trigger(de.error))}_appendParams(e,s){if(Object.keys(s).length===0)return e;const n=e.match(/\?/)?"&":"?",r=new URLSearchParams(s);return`${e}${n}${r}`}_workerObjectUrl(e){let s;if(e)s=e;else{const n=new Blob([jp],{type:"application/javascript"});s=URL.createObjectURL(n)}return s}_setConnectionState(e,s=!1){this._connectionState=e,e==="connecting"?this._wasManualDisconnect=!1:e==="disconnecting"&&(this._wasManualDisconnect=s)}async _performAuth(e=null){let s,n=!1;if(e)s=e,n=!0;else if(this.accessToken)try{s=await this.accessToken()}catch(r){this.log("error","Error fetching access token from callback",r),s=this.accessTokenValue}else s=this.accessTokenValue;n?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=s&&(this.accessTokenValue=s,this.channels.forEach(r=>{const i={access_token:s,version:vp};s&&r.updateJoinPayload(i),r.joinedOnce&&r._isJoined()&&r._push(de.access_token,{access_token:s})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(e="general"){this._isManualToken()||this.setAuth().catch(s=>{this.log("error",`Error setting auth in ${e}`,s)})}_triggerStateCallbacks(e,s){try{this.stateChangeCallbacks[e].forEach(n=>{try{n(s)}catch(r){this.log("error",`error in ${e} callback`,r)}})}catch(n){this.log("error",`error triggering ${e} callbacks`,n)}}_setupReconnectionTimer(){this.reconnectTimer=new gl(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},ts.RECONNECT_DELAY)},this.reconnectAfterMs)}_initializeOptions(e){var s,n,r,i,a,o,l,c,u,h,d,f;switch(this.transport=(s=e==null?void 0:e.transport)!==null&&s!==void 0?s:null,this.timeout=(n=e==null?void 0:e.timeout)!==null&&n!==void 0?n:$n,this.heartbeatIntervalMs=(r=e==null?void 0:e.heartbeatIntervalMs)!==null&&r!==void 0?r:ts.HEARTBEAT_INTERVAL,this.worker=(i=e==null?void 0:e.worker)!==null&&i!==void 0?i:!1,this.accessToken=(a=e==null?void 0:e.accessToken)!==null&&a!==void 0?a:null,this.heartbeatCallback=(o=e==null?void 0:e.heartbeatCallback)!==null&&o!==void 0?o:Zs,this.vsn=(l=e==null?void 0:e.vsn)!==null&&l!==void 0?l:sa,e!=null&&e.params&&(this.params=e.params),e!=null&&e.logger&&(this.logger=e.logger),(e!=null&&e.logLevel||e!=null&&e.log_level)&&(this.logLevel=e.logLevel||e.log_level,this.params=Object.assign(Object.assign({},this.params),{log_level:this.logLevel})),this.reconnectAfterMs=(c=e==null?void 0:e.reconnectAfterMs)!==null&&c!==void 0?c:m=>Cp[m-1]||Rp,this.vsn){case ml:this.encode=(u=e==null?void 0:e.encode)!==null&&u!==void 0?u:(m,y)=>y(JSON.stringify(m)),this.decode=(h=e==null?void 0:e.decode)!==null&&h!==void 0?h:(m,y)=>y(JSON.parse(m));break;case wp:this.encode=(d=e==null?void 0:e.encode)!==null&&d!==void 0?d:this.serializer.encode.bind(this.serializer),this.decode=(f=e==null?void 0:e.decode)!==null&&f!==void 0?f:this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${this.vsn}`)}if(this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=e==null?void 0:e.workerUrl}}}var $t=class extends Error{constructor(t,e){var s;super(t),this.name="IcebergError",this.status=e.status,this.icebergType=e.icebergType,this.icebergCode=e.icebergCode,this.details=e.details,this.isCommitStateUnknown=e.icebergType==="CommitStateUnknownException"||[500,502,504].includes(e.status)&&((s=e.icebergType)==null?void 0:s.includes("CommitState"))===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}};function Dp(t,e,s){const n=new URL(e,t);if(s)for(const[r,i]of Object.entries(s))i!==void 0&&n.searchParams.set(r,i);return n.toString()}async function Ip(t){return!t||t.type==="none"?{}:t.type==="bearer"?{Authorization:`Bearer ${t.token}`}:t.type==="header"?{[t.name]:t.value}:t.type==="custom"?await t.getHeaders():{}}function Np(t){const e=t.fetchImpl??globalThis.fetch;return{async request({method:s,path:n,query:r,body:i,headers:a}){const o=Dp(t.baseUrl,n,r),l=await Ip(t.auth),c=await e(o,{method:s,headers:{...i?{"Content-Type":"application/json"}:{},...l,...a},body:i?JSON.stringify(i):void 0}),u=await c.text(),h=(c.headers.get("content-type")||"").includes("application/json"),d=h&&u?JSON.parse(u):u;if(!c.ok){const f=h?d:void 0,m=f==null?void 0:f.error;throw new $t((m==null?void 0:m.message)??`Request failed with status ${c.status}`,{status:c.status,icebergType:m==null?void 0:m.type,icebergCode:m==null?void 0:m.code,details:f})}return{status:c.status,headers:c.headers,data:d}}}}function ss(t){return t.join("")}var Mp=class{constructor(t,e=""){this.client=t,this.prefix=e}async listNamespaces(t){const e=t?{parent:ss(t.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:e})).data.namespaces.map(n=>({namespace:n}))}async createNamespace(t,e){const s={namespace:t.namespace,properties:e==null?void 0:e.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:s})).data}async dropNamespace(t){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${ss(t.namespace)}`})}async loadNamespaceMetadata(t){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${ss(t.namespace)}`})).data.properties}}async namespaceExists(t){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${ss(t.namespace)}`}),!0}catch(e){if(e instanceof $t&&e.status===404)return!1;throw e}}async createNamespaceIfNotExists(t,e){try{return await this.createNamespace(t,e)}catch(s){if(s instanceof $t&&s.status===409)return;throw s}}};function Qe(t){return t.join("")}var $p=class{constructor(t,e="",s){this.client=t,this.prefix=e,this.accessDelegation=s}async listTables(t){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Qe(t.namespace)}/tables`})).data.identifiers}async createTable(t,e){const s={};return this.accessDelegation&&(s["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${Qe(t.namespace)}/tables`,body:e,headers:s})).data.metadata}async updateTable(t,e){const s=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${Qe(t.namespace)}/tables/${t.name}`,body:e});return{"metadata-location":s.data["metadata-location"],metadata:s.data.metadata}}async dropTable(t,e){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${Qe(t.namespace)}/tables/${t.name}`,query:{purgeRequested:String((e==null?void 0:e.purge)??!1)}})}async loadTable(t){const e={};return this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Qe(t.namespace)}/tables/${t.name}`,headers:e})).data.metadata}async tableExists(t){const e={};this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${Qe(t.namespace)}/tables/${t.name}`,headers:e}),!0}catch(s){if(s instanceof $t&&s.status===404)return!1;throw s}}async createTableIfNotExists(t,e){try{return await this.createTable(t,e)}catch(s){if(s instanceof $t&&s.status===409)return await this.loadTable({namespace:t.namespace,name:e.name});throw s}}},Lp=class{constructor(t){var n;let e="v1";t.catalogName&&(e+=`/${t.catalogName}`);const s=t.baseUrl.endsWith("/")?t.baseUrl:`${t.baseUrl}/`;this.client=Np({baseUrl:s,auth:t.auth,fetchImpl:t.fetch}),this.accessDelegation=(n=t.accessDelegation)==null?void 0:n.join(","),this.namespaceOps=new Mp(this.client,e),this.tableOps=new $p(this.client,e,this.accessDelegation)}async listNamespaces(t){return this.namespaceOps.listNamespaces(t)}async createNamespace(t,e){return this.namespaceOps.createNamespace(t,e)}async dropNamespace(t){await this.namespaceOps.dropNamespace(t)}async loadNamespaceMetadata(t){return this.namespaceOps.loadNamespaceMetadata(t)}async listTables(t){return this.tableOps.listTables(t)}async createTable(t,e){return this.tableOps.createTable(t,e)}async updateTable(t,e){return this.tableOps.updateTable(t,e)}async dropTable(t,e){await this.tableOps.dropTable(t,e)}async loadTable(t){return this.tableOps.loadTable(t)}async namespaceExists(t){return this.namespaceOps.namespaceExists(t)}async tableExists(t){return this.tableOps.tableExists(t)}async createNamespaceIfNotExists(t,e){return this.namespaceOps.createNamespaceIfNotExists(t,e)}async createTableIfNotExists(t,e){return this.tableOps.createTableIfNotExists(t,e)}},Is=class extends Error{constructor(t){super(t),this.__isStorageError=!0,this.name="StorageError"}};function $(t){return typeof t=="object"&&t!==null&&"__isStorageError"in t}var Bp=class extends Is{constructor(t,e,s){super(t),this.name="StorageApiError",this.status=e,this.statusCode=s}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},Vn=class extends Is{constructor(t,e){super(t),this.name="StorageUnknownError",this.originalError=e}};const Er=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),Vp=()=>Response,Un=t=>{if(Array.isArray(t))return t.map(s=>Un(s));if(typeof t=="function"||t!==Object(t))return t;const e={};return Object.entries(t).forEach(([s,n])=>{const r=s.replace(/([-_][a-z])/gi,i=>i.toUpperCase().replace(/[-_]/g,""));e[r]=Un(n)}),e},Up=t=>{if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},Fp=t=>!t||typeof t!="string"||t.length===0||t.length>100||t.trim()!==t||t.includes("/")||t.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(t);function Lt(t){"@babel/helpers - typeof";return Lt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Lt(t)}function qp(t,e){if(Lt(t)!="object"||!t)return t;var s=t[Symbol.toPrimitive];if(s!==void 0){var n=s.call(t,e||"default");if(Lt(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Wp(t){var e=qp(t,"string");return Lt(e)=="symbol"?e:e+""}function Hp(t,e,s){return(e=Wp(e))in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}function aa(t,e){var s=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),s.push.apply(s,n)}return s}function R(t){for(var e=1;e<arguments.length;e++){var s=arguments[e]!=null?arguments[e]:{};e%2?aa(Object(s),!0).forEach(function(n){Hp(t,n,s[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(s)):aa(Object(s)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(s,n))})}return t}const en=t=>{var e;return t.msg||t.message||t.error_description||(typeof t.error=="string"?t.error:(e=t.error)===null||e===void 0?void 0:e.message)||JSON.stringify(t)},Kp=async(t,e,s)=>{t instanceof await Vp()&&!(s!=null&&s.noResolveJson)?t.json().then(n=>{const r=t.status||500,i=(n==null?void 0:n.statusCode)||r+"";e(new Bp(en(n),r,i))}).catch(n=>{e(new Vn(en(n),n))}):e(new Vn(en(t),t))},Gp=(t,e,s,n)=>{const r={method:t,headers:(e==null?void 0:e.headers)||{}};return t==="GET"||!n?r:(Up(n)?(r.headers=R({"Content-Type":"application/json"},e==null?void 0:e.headers),r.body=JSON.stringify(n)):r.body=n,e!=null&&e.duplex&&(r.duplex=e.duplex),R(R({},r),s))};async function zt(t,e,s,n,r,i){return new Promise((a,o)=>{t(s,Gp(e,n,r,i)).then(l=>{if(!l.ok)throw l;return n!=null&&n.noResolveJson?l:l.json()}).then(l=>a(l)).catch(l=>Kp(l,o,n))})}async function Bt(t,e,s,n){return zt(t,"GET",e,s,n)}async function he(t,e,s,n,r){return zt(t,"POST",e,n,r,s)}async function Fn(t,e,s,n,r){return zt(t,"PUT",e,n,r,s)}async function zp(t,e,s,n){return zt(t,"HEAD",e,R(R({},s),{},{noResolveJson:!0}),n)}async function Ar(t,e,s,n,r){return zt(t,"DELETE",e,n,r,s)}var Jp=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e}then(t,e){return this.execute().then(t,e)}async execute(){var t=this;try{return{data:(await t.downloadFn()).body,error:null}}catch(e){if(t.shouldThrowOnError)throw e;if($(e))return{data:null,error:e};throw e}}};let wl;wl=Symbol.toStringTag;var Yp=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e,this[wl]="BlobDownloadBuilder",this.promise=null}asStream(){return new Jp(this.downloadFn,this.shouldThrowOnError)}then(t,e){return this.getPromise().then(t,e)}catch(t){return this.getPromise().catch(t)}finally(t){return this.getPromise().finally(t)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var t=this;try{return{data:await(await t.downloadFn()).blob(),error:null}}catch(e){if(t.shouldThrowOnError)throw e;if($(e))return{data:null,error:e};throw e}}};const Xp={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},oa={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var Qp=class{constructor(t,e={},s,n){this.shouldThrowOnError=!1,this.url=t,this.headers=e,this.bucketId=s,this.fetch=Er(n)}throwOnError(){return this.shouldThrowOnError=!0,this}async uploadOrUpdate(t,e,s,n){var r=this;try{let i;const a=R(R({},oa),n);let o=R(R({},r.headers),t==="POST"&&{"x-upsert":String(a.upsert)});const l=a.metadata;typeof Blob<"u"&&s instanceof Blob?(i=new FormData,i.append("cacheControl",a.cacheControl),l&&i.append("metadata",r.encodeMetadata(l)),i.append("",s)):typeof FormData<"u"&&s instanceof FormData?(i=s,i.has("cacheControl")||i.append("cacheControl",a.cacheControl),l&&!i.has("metadata")&&i.append("metadata",r.encodeMetadata(l))):(i=s,o["cache-control"]=`max-age=${a.cacheControl}`,o["content-type"]=a.contentType,l&&(o["x-metadata"]=r.toBase64(r.encodeMetadata(l))),(typeof ReadableStream<"u"&&i instanceof ReadableStream||i&&typeof i=="object"&&"pipe"in i&&typeof i.pipe=="function")&&!a.duplex&&(a.duplex="half")),n!=null&&n.headers&&(o=R(R({},o),n.headers));const c=r._removeEmptyFolders(e),u=r._getFinalPath(c),h=await(t=="PUT"?Fn:he)(r.fetch,`${r.url}/object/${u}`,i,R({headers:o},a!=null&&a.duplex?{duplex:a.duplex}:{}));return{data:{path:c,id:h.Id,fullPath:h.Key},error:null}}catch(i){if(r.shouldThrowOnError)throw i;if($(i))return{data:null,error:i};throw i}}async upload(t,e,s){return this.uploadOrUpdate("POST",t,e,s)}async uploadToSignedUrl(t,e,s,n){var r=this;const i=r._removeEmptyFolders(t),a=r._getFinalPath(i),o=new URL(r.url+`/object/upload/sign/${a}`);o.searchParams.set("token",e);try{let l;const c=R({upsert:oa.upsert},n),u=R(R({},r.headers),{"x-upsert":String(c.upsert)});return typeof Blob<"u"&&s instanceof Blob?(l=new FormData,l.append("cacheControl",c.cacheControl),l.append("",s)):typeof FormData<"u"&&s instanceof FormData?(l=s,l.append("cacheControl",c.cacheControl)):(l=s,u["cache-control"]=`max-age=${c.cacheControl}`,u["content-type"]=c.contentType),{data:{path:i,fullPath:(await Fn(r.fetch,o.toString(),l,{headers:u})).Key},error:null}}catch(l){if(r.shouldThrowOnError)throw l;if($(l))return{data:null,error:l};throw l}}async createSignedUploadUrl(t,e){var s=this;try{let n=s._getFinalPath(t);const r=R({},s.headers);e!=null&&e.upsert&&(r["x-upsert"]="true");const i=await he(s.fetch,`${s.url}/object/upload/sign/${n}`,{},{headers:r}),a=new URL(s.url+i.url),o=a.searchParams.get("token");if(!o)throw new Is("No token returned by API");return{data:{signedUrl:a.toString(),path:t,token:o},error:null}}catch(n){if(s.shouldThrowOnError)throw n;if($(n))return{data:null,error:n};throw n}}async update(t,e,s){return this.uploadOrUpdate("PUT",t,e,s)}async move(t,e,s){var n=this;try{return{data:await he(n.fetch,`${n.url}/object/move`,{bucketId:n.bucketId,sourceKey:t,destinationKey:e,destinationBucket:s==null?void 0:s.destinationBucket},{headers:n.headers}),error:null}}catch(r){if(n.shouldThrowOnError)throw r;if($(r))return{data:null,error:r};throw r}}async copy(t,e,s){var n=this;try{return{data:{path:(await he(n.fetch,`${n.url}/object/copy`,{bucketId:n.bucketId,sourceKey:t,destinationKey:e,destinationBucket:s==null?void 0:s.destinationBucket},{headers:n.headers})).Key},error:null}}catch(r){if(n.shouldThrowOnError)throw r;if($(r))return{data:null,error:r};throw r}}async createSignedUrl(t,e,s){var n=this;try{let r=n._getFinalPath(t),i=await he(n.fetch,`${n.url}/object/sign/${r}`,R({expiresIn:e},s!=null&&s.transform?{transform:s.transform}:{}),{headers:n.headers});const a=s!=null&&s.download?`&download=${s.download===!0?"":s.download}`:"";return i={signedUrl:encodeURI(`${n.url}${i.signedURL}${a}`)},{data:i,error:null}}catch(r){if(n.shouldThrowOnError)throw r;if($(r))return{data:null,error:r};throw r}}async createSignedUrls(t,e,s){var n=this;try{const r=await he(n.fetch,`${n.url}/object/sign/${n.bucketId}`,{expiresIn:e,paths:t},{headers:n.headers}),i=s!=null&&s.download?`&download=${s.download===!0?"":s.download}`:"";return{data:r.map(a=>R(R({},a),{},{signedUrl:a.signedURL?encodeURI(`${n.url}${a.signedURL}${i}`):null})),error:null}}catch(r){if(n.shouldThrowOnError)throw r;if($(r))return{data:null,error:r};throw r}}download(t,e){const s=typeof(e==null?void 0:e.transform)<"u"?"render/image/authenticated":"object",n=this.transformOptsToQueryString((e==null?void 0:e.transform)||{}),r=n?`?${n}`:"",i=this._getFinalPath(t),a=()=>Bt(this.fetch,`${this.url}/${s}/${i}${r}`,{headers:this.headers,noResolveJson:!0});return new Yp(a,this.shouldThrowOnError)}async info(t){var e=this;const s=e._getFinalPath(t);try{return{data:Un(await Bt(e.fetch,`${e.url}/object/info/${s}`,{headers:e.headers})),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if($(n))return{data:null,error:n};throw n}}async exists(t){var e=this;const s=e._getFinalPath(t);try{return await zp(e.fetch,`${e.url}/object/${s}`,{headers:e.headers}),{data:!0,error:null}}catch(n){if(e.shouldThrowOnError)throw n;if($(n)&&n instanceof Vn){const r=n.originalError;if([400,404].includes(r==null?void 0:r.status))return{data:!1,error:n}}throw n}}getPublicUrl(t,e){const s=this._getFinalPath(t),n=[],r=e!=null&&e.download?`download=${e.download===!0?"":e.download}`:"";r!==""&&n.push(r);const i=typeof(e==null?void 0:e.transform)<"u"?"render/image":"object",a=this.transformOptsToQueryString((e==null?void 0:e.transform)||{});a!==""&&n.push(a);let o=n.join("&");return o!==""&&(o=`?${o}`),{data:{publicUrl:encodeURI(`${this.url}/${i}/public/${s}${o}`)}}}async remove(t){var e=this;try{return{data:await Ar(e.fetch,`${e.url}/object/${e.bucketId}`,{prefixes:t},{headers:e.headers}),error:null}}catch(s){if(e.shouldThrowOnError)throw s;if($(s))return{data:null,error:s};throw s}}async list(t,e,s){var n=this;try{const r=R(R(R({},Xp),e),{},{prefix:t||""});return{data:await he(n.fetch,`${n.url}/object/list/${n.bucketId}`,r,{headers:n.headers},s),error:null}}catch(r){if(n.shouldThrowOnError)throw r;if($(r))return{data:null,error:r};throw r}}async listV2(t,e){var s=this;try{const n=R({},t);return{data:await he(s.fetch,`${s.url}/object/list-v2/${s.bucketId}`,n,{headers:s.headers},e),error:null}}catch(n){if(s.shouldThrowOnError)throw n;if($(n))return{data:null,error:n};throw n}}encodeMetadata(t){return JSON.stringify(t)}toBase64(t){return typeof Buffer<"u"?Buffer.from(t).toString("base64"):btoa(t)}_getFinalPath(t){return`${this.bucketId}/${t.replace(/^\/+/,"")}`}_removeEmptyFolders(t){return t.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(t){const e=[];return t.width&&e.push(`width=${t.width}`),t.height&&e.push(`height=${t.height}`),t.resize&&e.push(`resize=${t.resize}`),t.format&&e.push(`format=${t.format}`),t.quality&&e.push(`quality=${t.quality}`),e.join("&")}};const bl="2.88.0",xl={"X-Client-Info":`storage-js/${bl}`};var Zp=class{constructor(t,e={},s,n){this.shouldThrowOnError=!1;const r=new URL(t);n!=null&&n.useNewHostname&&/supabase\.(co|in|red)$/.test(r.hostname)&&!r.hostname.includes("storage.supabase.")&&(r.hostname=r.hostname.replace("supabase.","storage.supabase.")),this.url=r.href.replace(/\/$/,""),this.headers=R(R({},xl),e),this.fetch=Er(s)}throwOnError(){return this.shouldThrowOnError=!0,this}async listBuckets(t){var e=this;try{const s=e.listBucketOptionsToQueryString(t);return{data:await Bt(e.fetch,`${e.url}/bucket${s}`,{headers:e.headers}),error:null}}catch(s){if(e.shouldThrowOnError)throw s;if($(s))return{data:null,error:s};throw s}}async getBucket(t){var e=this;try{return{data:await Bt(e.fetch,`${e.url}/bucket/${t}`,{headers:e.headers}),error:null}}catch(s){if(e.shouldThrowOnError)throw s;if($(s))return{data:null,error:s};throw s}}async createBucket(t,e={public:!1}){var s=this;try{return{data:await he(s.fetch,`${s.url}/bucket`,{id:t,name:t,type:e.type,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes},{headers:s.headers}),error:null}}catch(n){if(s.shouldThrowOnError)throw n;if($(n))return{data:null,error:n};throw n}}async updateBucket(t,e){var s=this;try{return{data:await Fn(s.fetch,`${s.url}/bucket/${t}`,{id:t,name:t,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes},{headers:s.headers}),error:null}}catch(n){if(s.shouldThrowOnError)throw n;if($(n))return{data:null,error:n};throw n}}async emptyBucket(t){var e=this;try{return{data:await he(e.fetch,`${e.url}/bucket/${t}/empty`,{},{headers:e.headers}),error:null}}catch(s){if(e.shouldThrowOnError)throw s;if($(s))return{data:null,error:s};throw s}}async deleteBucket(t){var e=this;try{return{data:await Ar(e.fetch,`${e.url}/bucket/${t}`,{},{headers:e.headers}),error:null}}catch(s){if(e.shouldThrowOnError)throw s;if($(s))return{data:null,error:s};throw s}}listBucketOptionsToQueryString(t){const e={};return t&&("limit"in t&&(e.limit=String(t.limit)),"offset"in t&&(e.offset=String(t.offset)),t.search&&(e.search=t.search),t.sortColumn&&(e.sortColumn=t.sortColumn),t.sortOrder&&(e.sortOrder=t.sortOrder)),Object.keys(e).length>0?"?"+new URLSearchParams(e).toString():""}},em=class{constructor(t,e={},s){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=R(R({},xl),e),this.fetch=Er(s)}throwOnError(){return this.shouldThrowOnError=!0,this}async createBucket(t){var e=this;try{return{data:await he(e.fetch,`${e.url}/bucket`,{name:t},{headers:e.headers}),error:null}}catch(s){if(e.shouldThrowOnError)throw s;if($(s))return{data:null,error:s};throw s}}async listBuckets(t){var e=this;try{const s=new URLSearchParams;(t==null?void 0:t.limit)!==void 0&&s.set("limit",t.limit.toString()),(t==null?void 0:t.offset)!==void 0&&s.set("offset",t.offset.toString()),t!=null&&t.sortColumn&&s.set("sortColumn",t.sortColumn),t!=null&&t.sortOrder&&s.set("sortOrder",t.sortOrder),t!=null&&t.search&&s.set("search",t.search);const n=s.toString(),r=n?`${e.url}/bucket?${n}`:`${e.url}/bucket`;return{data:await Bt(e.fetch,r,{headers:e.headers}),error:null}}catch(s){if(e.shouldThrowOnError)throw s;if($(s))return{data:null,error:s};throw s}}async deleteBucket(t){var e=this;try{return{data:await Ar(e.fetch,`${e.url}/bucket/${t}`,{},{headers:e.headers}),error:null}}catch(s){if(e.shouldThrowOnError)throw s;if($(s))return{data:null,error:s};throw s}}from(t){var e=this;if(!Fp(t))throw new Is("Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines and should avoid the use of any other characters.");const s=new Lp({baseUrl:this.url,catalogName:t,auth:{type:"custom",getHeaders:async()=>e.headers},fetch:this.fetch}),n=this.shouldThrowOnError;return new Proxy(s,{get(r,i){const a=r[i];return typeof a!="function"?a:async(...o)=>{try{return{data:await a.apply(r,o),error:null}}catch(l){if(n)throw l;return{data:null,error:l}}}}})}};const Pr={"X-Client-Info":`storage-js/${bl}`,"Content-Type":"application/json"};var _l=class extends Error{constructor(t){super(t),this.__isStorageVectorsError=!0,this.name="StorageVectorsError"}};function ee(t){return typeof t=="object"&&t!==null&&"__isStorageVectorsError"in t}var tn=class extends _l{constructor(t,e,s){super(t),this.name="StorageVectorsApiError",this.status=e,this.statusCode=s}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},tm=class extends _l{constructor(t,e){super(t),this.name="StorageVectorsUnknownError",this.originalError=e}};const Cr=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),sm=t=>{if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},la=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),nm=async(t,e,s)=>{if(t&&typeof t=="object"&&"status"in t&&"ok"in t&&typeof t.status=="number"&&!(s!=null&&s.noResolveJson)){const n=t.status||500,r=t;if(typeof r.json=="function")r.json().then(i=>{const a=(i==null?void 0:i.statusCode)||(i==null?void 0:i.code)||n+"";e(new tn(la(i),n,a))}).catch(()=>{const i=n+"";e(new tn(r.statusText||`HTTP ${n} error`,n,i))});else{const i=n+"";e(new tn(r.statusText||`HTTP ${n} error`,n,i))}}else e(new tm(la(t),t))},rm=(t,e,s,n)=>{const r={method:t,headers:(e==null?void 0:e.headers)||{}};return n?(sm(n)?(r.headers=R({"Content-Type":"application/json"},e==null?void 0:e.headers),r.body=JSON.stringify(n)):r.body=n,R(R({},r),s)):r};async function im(t,e,s,n,r,i){return new Promise((a,o)=>{t(s,rm(e,n,r,i)).then(l=>{if(!l.ok)throw l;if(n!=null&&n.noResolveJson)return l;const c=l.headers.get("content-type");return!c||!c.includes("application/json")?{}:l.json()}).then(l=>a(l)).catch(l=>nm(l,o,n))})}async function te(t,e,s,n,r){return im(t,"POST",e,n,r,s)}var am=class{constructor(t,e={},s){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=R(R({},Pr),e),this.fetch=Cr(s)}throwOnError(){return this.shouldThrowOnError=!0,this}async createIndex(t){var e=this;try{return{data:await te(e.fetch,`${e.url}/CreateIndex`,t,{headers:e.headers})||{},error:null}}catch(s){if(e.shouldThrowOnError)throw s;if(ee(s))return{data:null,error:s};throw s}}async getIndex(t,e){var s=this;try{return{data:await te(s.fetch,`${s.url}/GetIndex`,{vectorBucketName:t,indexName:e},{headers:s.headers}),error:null}}catch(n){if(s.shouldThrowOnError)throw n;if(ee(n))return{data:null,error:n};throw n}}async listIndexes(t){var e=this;try{return{data:await te(e.fetch,`${e.url}/ListIndexes`,t,{headers:e.headers}),error:null}}catch(s){if(e.shouldThrowOnError)throw s;if(ee(s))return{data:null,error:s};throw s}}async deleteIndex(t,e){var s=this;try{return{data:await te(s.fetch,`${s.url}/DeleteIndex`,{vectorBucketName:t,indexName:e},{headers:s.headers})||{},error:null}}catch(n){if(s.shouldThrowOnError)throw n;if(ee(n))return{data:null,error:n};throw n}}},om=class{constructor(t,e={},s){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=R(R({},Pr),e),this.fetch=Cr(s)}throwOnError(){return this.shouldThrowOnError=!0,this}async putVectors(t){var e=this;try{if(t.vectors.length<1||t.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return{data:await te(e.fetch,`${e.url}/PutVectors`,t,{headers:e.headers})||{},error:null}}catch(s){if(e.shouldThrowOnError)throw s;if(ee(s))return{data:null,error:s};throw s}}async getVectors(t){var e=this;try{return{data:await te(e.fetch,`${e.url}/GetVectors`,t,{headers:e.headers}),error:null}}catch(s){if(e.shouldThrowOnError)throw s;if(ee(s))return{data:null,error:s};throw s}}async listVectors(t){var e=this;try{if(t.segmentCount!==void 0){if(t.segmentCount<1||t.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(t.segmentIndex!==void 0&&(t.segmentIndex<0||t.segmentIndex>=t.segmentCount))throw new Error(`segmentIndex must be between 0 and ${t.segmentCount-1}`)}return{data:await te(e.fetch,`${e.url}/ListVectors`,t,{headers:e.headers}),error:null}}catch(s){if(e.shouldThrowOnError)throw s;if(ee(s))return{data:null,error:s};throw s}}async queryVectors(t){var e=this;try{return{data:await te(e.fetch,`${e.url}/QueryVectors`,t,{headers:e.headers}),error:null}}catch(s){if(e.shouldThrowOnError)throw s;if(ee(s))return{data:null,error:s};throw s}}async deleteVectors(t){var e=this;try{if(t.keys.length<1||t.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return{data:await te(e.fetch,`${e.url}/DeleteVectors`,t,{headers:e.headers})||{},error:null}}catch(s){if(e.shouldThrowOnError)throw s;if(ee(s))return{data:null,error:s};throw s}}},lm=class{constructor(t,e={},s){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=R(R({},Pr),e),this.fetch=Cr(s)}throwOnError(){return this.shouldThrowOnError=!0,this}async createBucket(t){var e=this;try{return{data:await te(e.fetch,`${e.url}/CreateVectorBucket`,{vectorBucketName:t},{headers:e.headers})||{},error:null}}catch(s){if(e.shouldThrowOnError)throw s;if(ee(s))return{data:null,error:s};throw s}}async getBucket(t){var e=this;try{return{data:await te(e.fetch,`${e.url}/GetVectorBucket`,{vectorBucketName:t},{headers:e.headers}),error:null}}catch(s){if(e.shouldThrowOnError)throw s;if(ee(s))return{data:null,error:s};throw s}}async listBuckets(t={}){var e=this;try{return{data:await te(e.fetch,`${e.url}/ListVectorBuckets`,t,{headers:e.headers}),error:null}}catch(s){if(e.shouldThrowOnError)throw s;if(ee(s))return{data:null,error:s};throw s}}async deleteBucket(t){var e=this;try{return{data:await te(e.fetch,`${e.url}/DeleteVectorBucket`,{vectorBucketName:t},{headers:e.headers})||{},error:null}}catch(s){if(e.shouldThrowOnError)throw s;if(ee(s))return{data:null,error:s};throw s}}},cm=class extends lm{constructor(t,e={}){super(t,e.headers||{},e.fetch)}from(t){return new um(this.url,this.headers,t,this.fetch)}async createBucket(t){var e=()=>super.createBucket,s=this;return e().call(s,t)}async getBucket(t){var e=()=>super.getBucket,s=this;return e().call(s,t)}async listBuckets(t={}){var e=()=>super.listBuckets,s=this;return e().call(s,t)}async deleteBucket(t){var e=()=>super.deleteBucket,s=this;return e().call(s,t)}},um=class extends am{constructor(t,e,s,n){super(t,e,n),this.vectorBucketName=s}async createIndex(t){var e=()=>super.createIndex,s=this;return e().call(s,R(R({},t),{},{vectorBucketName:s.vectorBucketName}))}async listIndexes(t={}){var e=()=>super.listIndexes,s=this;return e().call(s,R(R({},t),{},{vectorBucketName:s.vectorBucketName}))}async getIndex(t){var e=()=>super.getIndex,s=this;return e().call(s,s.vectorBucketName,t)}async deleteIndex(t){var e=()=>super.deleteIndex,s=this;return e().call(s,s.vectorBucketName,t)}index(t){return new hm(this.url,this.headers,this.vectorBucketName,t,this.fetch)}},hm=class extends om{constructor(t,e,s,n,r){super(t,e,r),this.vectorBucketName=s,this.indexName=n}async putVectors(t){var e=()=>super.putVectors,s=this;return e().call(s,R(R({},t),{},{vectorBucketName:s.vectorBucketName,indexName:s.indexName}))}async getVectors(t){var e=()=>super.getVectors,s=this;return e().call(s,R(R({},t),{},{vectorBucketName:s.vectorBucketName,indexName:s.indexName}))}async listVectors(t={}){var e=()=>super.listVectors,s=this;return e().call(s,R(R({},t),{},{vectorBucketName:s.vectorBucketName,indexName:s.indexName}))}async queryVectors(t){var e=()=>super.queryVectors,s=this;return e().call(s,R(R({},t),{},{vectorBucketName:s.vectorBucketName,indexName:s.indexName}))}async deleteVectors(t){var e=()=>super.deleteVectors,s=this;return e().call(s,R(R({},t),{},{vectorBucketName:s.vectorBucketName,indexName:s.indexName}))}},dm=class extends Zp{constructor(t,e={},s,n){super(t,e,s,n)}from(t){return new Qp(this.url,this.headers,t,this.fetch)}get vectors(){return new cm(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new em(this.url+"/iceberg",this.headers,this.fetch)}};const Sl="2.88.0",at=30*1e3,qn=3,sn=qn*at,fm="http://localhost:9999",pm="supabase.auth.token",mm={"X-Client-Info":`gotrue-js/${Sl}`},Wn="X-Supabase-Api-Version",Tl={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},gm=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,ym=10*60*1e3;class Vt extends Error{constructor(e,s,n){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=s,this.code=n}}function A(t){return typeof t=="object"&&t!==null&&"__isAuthError"in t}class vm extends Vt{constructor(e,s,n){super(e,s,n),this.name="AuthApiError",this.status=s,this.code=n}}function wm(t){return A(t)&&t.name==="AuthApiError"}class We extends Vt{constructor(e,s){super(e),this.name="AuthUnknownError",this.originalError=s}}class ke extends Vt{constructor(e,s,n,r){super(e,n,r),this.name=s,this.status=n}}class Z extends ke{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function bm(t){return A(t)&&t.name==="AuthSessionMissingError"}class Ze extends ke{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class ns extends ke{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}}class rs extends ke{constructor(e,s=null){super(e,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=s}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}function xm(t){return A(t)&&t.name==="AuthImplicitGrantRedirectError"}class ca extends ke{constructor(e,s=null){super(e,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=s}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class _m extends ke{constructor(){super("PKCE code verifier not found in storage. This can happen if the auth flow was initiated in a different browser or device, or if the storage was cleared. For SSR frameworks (Next.js, SvelteKit, etc.), use @supabase/ssr on both the server and client to store the code verifier in cookies.","AuthPKCECodeVerifierMissingError",400,"pkce_code_verifier_not_found")}}class Hn extends ke{constructor(e,s){super(e,"AuthRetryableFetchError",s,void 0)}}function nn(t){return A(t)&&t.name==="AuthRetryableFetchError"}class ua extends ke{constructor(e,s,n){super(e,"AuthWeakPasswordError",s,"weak_password"),this.reasons=n}}class Kn extends ke{constructor(e){super(e,"AuthInvalidJwtError",400,"invalid_jwt")}}const Ts="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),ha=` 	
\r=`.split(""),Sm=(()=>{const t=new Array(128);for(let e=0;e<t.length;e+=1)t[e]=-1;for(let e=0;e<ha.length;e+=1)t[ha[e].charCodeAt(0)]=-2;for(let e=0;e<Ts.length;e+=1)t[Ts[e].charCodeAt(0)]=e;return t})();function da(t,e,s){if(t!==null)for(e.queue=e.queue<<8|t,e.queuedBits+=8;e.queuedBits>=6;){const n=e.queue>>e.queuedBits-6&63;s(Ts[n]),e.queuedBits-=6}else if(e.queuedBits>0)for(e.queue=e.queue<<6-e.queuedBits,e.queuedBits=6;e.queuedBits>=6;){const n=e.queue>>e.queuedBits-6&63;s(Ts[n]),e.queuedBits-=6}}function kl(t,e,s){const n=Sm[t];if(n>-1)for(e.queue=e.queue<<6|n,e.queuedBits+=6;e.queuedBits>=8;)s(e.queue>>e.queuedBits-8&255),e.queuedBits-=8;else{if(n===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(t)}"`)}}function fa(t){const e=[],s=a=>{e.push(String.fromCodePoint(a))},n={utf8seq:0,codepoint:0},r={queue:0,queuedBits:0},i=a=>{Em(a,n,s)};for(let a=0;a<t.length;a+=1)kl(t.charCodeAt(a),r,i);return e.join("")}function Tm(t,e){if(t<=127){e(t);return}else if(t<=2047){e(192|t>>6),e(128|t&63);return}else if(t<=65535){e(224|t>>12),e(128|t>>6&63),e(128|t&63);return}else if(t<=1114111){e(240|t>>18),e(128|t>>12&63),e(128|t>>6&63),e(128|t&63);return}throw new Error(`Unrecognized Unicode codepoint: ${t.toString(16)}`)}function km(t,e){for(let s=0;s<t.length;s+=1){let n=t.charCodeAt(s);if(n>55295&&n<=56319){const r=(n-55296)*1024&65535;n=(t.charCodeAt(s+1)-56320&65535|r)+65536,s+=1}Tm(n,e)}}function Em(t,e,s){if(e.utf8seq===0){if(t<=127){s(t);return}for(let n=1;n<6;n+=1)if(!(t>>7-n&1)){e.utf8seq=n;break}if(e.utf8seq===2)e.codepoint=t&31;else if(e.utf8seq===3)e.codepoint=t&15;else if(e.utf8seq===4)e.codepoint=t&7;else throw new Error("Invalid UTF-8 sequence");e.utf8seq-=1}else if(e.utf8seq>0){if(t<=127)throw new Error("Invalid UTF-8 sequence");e.codepoint=e.codepoint<<6|t&63,e.utf8seq-=1,e.utf8seq===0&&s(e.codepoint)}}function dt(t){const e=[],s={queue:0,queuedBits:0},n=r=>{e.push(r)};for(let r=0;r<t.length;r+=1)kl(t.charCodeAt(r),s,n);return new Uint8Array(e)}function Am(t){const e=[];return km(t,s=>e.push(s)),new Uint8Array(e)}function Ge(t){const e=[],s={queue:0,queuedBits:0},n=r=>{e.push(r)};return t.forEach(r=>da(r,s,n)),da(null,s,n),e.join("")}function Pm(t){return Math.round(Date.now()/1e3)+t}function Cm(){return Symbol("auth-callback")}const G=()=>typeof window<"u"&&typeof document<"u",Be={tested:!1,writable:!1},El=()=>{if(!G())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(Be.tested)return Be.writable;const t=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(t,t),globalThis.localStorage.removeItem(t),Be.tested=!0,Be.writable=!0}catch{Be.tested=!0,Be.writable=!1}return Be.writable};function Rm(t){const e={},s=new URL(t);if(s.hash&&s.hash[0]==="#")try{new URLSearchParams(s.hash.substring(1)).forEach((r,i)=>{e[i]=r})}catch{}return s.searchParams.forEach((n,r)=>{e[r]=n}),e}const Al=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),jm=t=>typeof t=="object"&&t!==null&&"status"in t&&"ok"in t&&"json"in t&&typeof t.json=="function",ot=async(t,e,s)=>{await t.setItem(e,JSON.stringify(s))},Ve=async(t,e)=>{const s=await t.getItem(e);if(!s)return null;try{return JSON.parse(s)}catch{return s}},K=async(t,e)=>{await t.removeItem(e)};class Ns{constructor(){this.promise=new Ns.promiseConstructor((e,s)=>{this.resolve=e,this.reject=s})}}Ns.promiseConstructor=Promise;function rn(t){const e=t.split(".");if(e.length!==3)throw new Kn("Invalid JWT structure");for(let n=0;n<e.length;n++)if(!gm.test(e[n]))throw new Kn("JWT not in base64url format");return{header:JSON.parse(fa(e[0])),payload:JSON.parse(fa(e[1])),signature:dt(e[2]),raw:{header:e[0],payload:e[1]}}}async function Om(t){return await new Promise(e=>{setTimeout(()=>e(null),t)})}function Dm(t,e){return new Promise((n,r)=>{(async()=>{for(let i=0;i<1/0;i++)try{const a=await t(i);if(!e(i,null,a)){n(a);return}}catch(a){if(!e(i,a)){r(a);return}}})()})}function Im(t){return("0"+t.toString(16)).substr(-2)}function Nm(){const e=new Uint32Array(56);if(typeof crypto>"u"){const s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",n=s.length;let r="";for(let i=0;i<56;i++)r+=s.charAt(Math.floor(Math.random()*n));return r}return crypto.getRandomValues(e),Array.from(e,Im).join("")}async function Mm(t){const s=new TextEncoder().encode(t),n=await crypto.subtle.digest("SHA-256",s),r=new Uint8Array(n);return Array.from(r).map(i=>String.fromCharCode(i)).join("")}async function $m(t){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."),t;const s=await Mm(t);return btoa(s).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function et(t,e,s=!1){const n=Nm();let r=n;s&&(r+="/PASSWORD_RECOVERY"),await ot(t,`${e}-code-verifier`,r);const i=await $m(n);return[i,n===i?"plain":"s256"]}const Lm=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function Bm(t){const e=t.headers.get(Wn);if(!e||!e.match(Lm))return null;try{return new Date(`${e}T00:00:00.0Z`)}catch{return null}}function Vm(t){if(!t)throw new Error("Missing exp claim");const e=Math.floor(Date.now()/1e3);if(t<=e)throw new Error("JWT has expired")}function Um(t){switch(t){case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"ES256":return{name:"ECDSA",namedCurve:"P-256",hash:{name:"SHA-256"}};default:throw new Error("Invalid alg claim")}}const Fm=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function tt(t){if(!Fm.test(t))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function an(){const t={};return new Proxy(t,{get:(e,s)=>{if(s==="__isUserNotAvailableProxy")return!0;if(typeof s=="symbol"){const n=s.toString();if(n==="Symbol(Symbol.toPrimitive)"||n==="Symbol(Symbol.toStringTag)"||n==="Symbol(util.inspect.custom)")return}throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${s}" property of the session object is not supported. Please use getUser() instead.`)},set:(e,s)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${s}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(e,s)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${s}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function qm(t,e){return new Proxy(t,{get:(s,n,r)=>{if(n==="__isInsecureUserWarningProxy")return!0;if(typeof n=="symbol"){const i=n.toString();if(i==="Symbol(Symbol.toPrimitive)"||i==="Symbol(Symbol.toStringTag)"||i==="Symbol(util.inspect.custom)"||i==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(s,n,r)}return!e.value&&typeof n=="string"&&(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 may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),e.value=!0),Reflect.get(s,n,r)}})}function pa(t){return JSON.parse(JSON.stringify(t))}const Fe=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),Wm=[502,503,504];async function ma(t){var e;if(!jm(t))throw new Hn(Fe(t),0);if(Wm.includes(t.status))throw new Hn(Fe(t),t.status);let s;try{s=await t.json()}catch(i){throw new We(Fe(i),i)}let n;const r=Bm(t);if(r&&r.getTime()>=Tl["2024-01-01"].timestamp&&typeof s=="object"&&s&&typeof s.code=="string"?n=s.code:typeof s=="object"&&s&&typeof s.error_code=="string"&&(n=s.error_code),n){if(n==="weak_password")throw new ua(Fe(s),t.status,((e=s.weak_password)===null||e===void 0?void 0:e.reasons)||[]);if(n==="session_not_found")throw new Z}else if(typeof s=="object"&&s&&typeof s.weak_password=="object"&&s.weak_password&&Array.isArray(s.weak_password.reasons)&&s.weak_password.reasons.length&&s.weak_password.reasons.reduce((i,a)=>i&&typeof a=="string",!0))throw new ua(Fe(s),t.status,s.weak_password.reasons);throw new vm(Fe(s),t.status||500,n)}const Hm=(t,e,s,n)=>{const r={method:t,headers:(e==null?void 0:e.headers)||{}};return t==="GET"?r:(r.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},e==null?void 0:e.headers),r.body=JSON.stringify(n),Object.assign(Object.assign({},r),s))};async function C(t,e,s,n){var r;const i=Object.assign({},n==null?void 0:n.headers);i[Wn]||(i[Wn]=Tl["2024-01-01"].name),n!=null&&n.jwt&&(i.Authorization=`Bearer ${n.jwt}`);const a=(r=n==null?void 0:n.query)!==null&&r!==void 0?r:{};n!=null&&n.redirectTo&&(a.redirect_to=n.redirectTo);const o=Object.keys(a).length?"?"+new URLSearchParams(a).toString():"",l=await Km(t,e,s+o,{headers:i,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 Km(t,e,s,n,r,i){const a=Hm(e,n,r,i);let o;try{o=await t(s,Object.assign({},a))}catch(l){throw console.error(l),new Hn(Fe(l),0)}if(o.ok||await ma(o),n!=null&&n.noResolveJson)return o;try{return await o.json()}catch(l){await ma(l)}}function le(t){var e;let s=null;Jm(t)&&(s=Object.assign({},t),t.expires_at||(s.expires_at=Pm(t.expires_in)));const n=(e=t.user)!==null&&e!==void 0?e:t;return{data:{session:s,user:n},error:null}}function ga(t){const e=le(t);return!e.error&&t.weak_password&&typeof t.weak_password=="object"&&Array.isArray(t.weak_password.reasons)&&t.weak_password.reasons.length&&t.weak_password.message&&typeof t.weak_password.message=="string"&&t.weak_password.reasons.reduce((s,n)=>s&&typeof n=="string",!0)&&(e.data.weak_password=t.weak_password),e}function je(t){var e;return{data:{user:(e=t.user)!==null&&e!==void 0?e:t},error:null}}function Gm(t){return{data:t,error:null}}function zm(t){const{action_link:e,email_otp:s,hashed_token:n,redirect_to:r,verification_type:i}=t,a=Ds(t,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),o={action_link:e,email_otp:s,hashed_token:n,redirect_to:r,verification_type:i},l=Object.assign({},a);return{data:{properties:o,user:l},error:null}}function ya(t){return t}function Jm(t){return t.access_token&&t.refresh_token&&t.expires_in}const on=["global","local","others"];class Ym{constructor({url:e="",headers:s={},fetch:n}){this.url=e,this.headers=s,this.fetch=Al(n),this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),updateClient:this._updateOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)}}async signOut(e,s=on[0]){if(on.indexOf(s)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${on.join(", ")}`);try{return await C(this.fetch,"POST",`${this.url}/logout?scope=${s}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(n){if(A(n))return{data:null,error:n};throw n}}async inviteUserByEmail(e,s={}){try{return await C(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:s.data},headers:this.headers,redirectTo:s.redirectTo,xform:je})}catch(n){if(A(n))return{data:{user:null},error:n};throw n}}async generateLink(e){try{const{options:s}=e,n=Ds(e,["options"]),r=Object.assign(Object.assign({},n),s);return"newEmail"in n&&(r.new_email=n==null?void 0:n.newEmail,delete r.newEmail),await C(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:r,headers:this.headers,xform:zm,redirectTo:s==null?void 0:s.redirectTo})}catch(s){if(A(s))return{data:{properties:null,user:null},error:s};throw s}}async createUser(e){try{return await C(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:je})}catch(s){if(A(s))return{data:{user:null},error:s};throw s}}async listUsers(e){var s,n,r,i,a,o,l;try{const c={nextPage:null,lastPage:0,total:0},u=await C(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(n=(s=e==null?void 0:e.page)===null||s===void 0?void 0:s.toString())!==null&&n!==void 0?n:"",per_page:(i=(r=e==null?void 0:e.perPage)===null||r===void 0?void 0:r.toString())!==null&&i!==void 0?i:""},xform:ya});if(u.error)throw u.error;const h=await u.json(),d=(a=u.headers.get("x-total-count"))!==null&&a!==void 0?a:0,f=(l=(o=u.headers.get("link"))===null||o===void 0?void 0:o.split(","))!==null&&l!==void 0?l:[];return f.length>0&&(f.forEach(m=>{const y=parseInt(m.split(";")[0].split("=")[1].substring(0,1)),g=JSON.parse(m.split(";")[1].split("=")[1]);c[`${g}Page`]=y}),c.total=parseInt(d)),{data:Object.assign(Object.assign({},h),c),error:null}}catch(c){if(A(c))return{data:{users:[]},error:c};throw c}}async getUserById(e){tt(e);try{return await C(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:je})}catch(s){if(A(s))return{data:{user:null},error:s};throw s}}async updateUserById(e,s){tt(e);try{return await C(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:s,headers:this.headers,xform:je})}catch(n){if(A(n))return{data:{user:null},error:n};throw n}}async deleteUser(e,s=!1){tt(e);try{return await C(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:s},xform:je})}catch(n){if(A(n))return{data:{user:null},error:n};throw n}}async _listFactors(e){tt(e.userId);try{const{data:s,error:n}=await C(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/factors`,{headers:this.headers,xform:r=>({data:{factors:r},error:null})});return{data:s,error:n}}catch(s){if(A(s))return{data:null,error:s};throw s}}async _deleteFactor(e){tt(e.userId),tt(e.id);try{return{data:await C(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(s){if(A(s))return{data:null,error:s};throw s}}async _listOAuthClients(e){var s,n,r,i,a,o,l;try{const c={nextPage:null,lastPage:0,total:0},u=await C(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(n=(s=e==null?void 0:e.page)===null||s===void 0?void 0:s.toString())!==null&&n!==void 0?n:"",per_page:(i=(r=e==null?void 0:e.perPage)===null||r===void 0?void 0:r.toString())!==null&&i!==void 0?i:""},xform:ya});if(u.error)throw u.error;const h=await u.json(),d=(a=u.headers.get("x-total-count"))!==null&&a!==void 0?a:0,f=(l=(o=u.headers.get("link"))===null||o===void 0?void 0:o.split(","))!==null&&l!==void 0?l:[];return f.length>0&&(f.forEach(m=>{const y=parseInt(m.split(";")[0].split("=")[1].substring(0,1)),g=JSON.parse(m.split(";")[1].split("=")[1]);c[`${g}Page`]=y}),c.total=parseInt(d)),{data:Object.assign(Object.assign({},h),c),error:null}}catch(c){if(A(c))return{data:{clients:[]},error:c};throw c}}async _createOAuthClient(e){try{return await C(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:e,headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(A(s))return{data:null,error:s};throw s}}async _getOAuthClient(e){try{return await C(this.fetch,"GET",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(A(s))return{data:null,error:s};throw s}}async _updateOAuthClient(e,s){try{return await C(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${e}`,{body:s,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(A(n))return{data:null,error:n};throw n}}async _deleteOAuthClient(e){try{return await C(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(s){if(A(s))return{data:null,error:s};throw s}}async _regenerateOAuthClientSecret(e){try{return await C(this.fetch,"POST",`${this.url}/admin/oauth/clients/${e}/regenerate_secret`,{headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(A(s))return{data:null,error:s};throw s}}}function va(t={}){return{getItem:e=>t[e]||null,setItem:(e,s)=>{t[e]=s},removeItem:e=>{delete t[e]}}}const st={debug:!!(globalThis&&El()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class Pl extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class Xm extends Pl{}async function Qm(t,e,s){st.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",t,e);const n=new globalThis.AbortController;return e>0&&setTimeout(()=>{n.abort(),st.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",t)},e),await Promise.resolve().then(()=>globalThis.navigator.locks.request(t,e===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:n.signal},async r=>{if(r){st.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",t,r.name);try{return await s()}finally{st.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",t,r.name)}}else{if(e===0)throw st.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",t),new Xm(`Acquiring an exclusive Navigator LockManager lock "${t}" immediately failed`);if(st.debug)try{const i=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(i,null,"  "))}catch(i){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",i)}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 s()}}))}function Zm(){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)}}function Cl(t){if(!/^0x[a-fA-F0-9]{40}$/.test(t))throw new Error(`@supabase/auth-js: Address "${t}" is invalid.`);return t.toLowerCase()}function eg(t){return parseInt(t,16)}function tg(t){const e=new TextEncoder().encode(t);return"0x"+Array.from(e,n=>n.toString(16).padStart(2,"0")).join("")}function sg(t){var e;const{chainId:s,domain:n,expirationTime:r,issuedAt:i=new Date,nonce:a,notBefore:o,requestId:l,resources:c,scheme:u,uri:h,version:d}=t;{if(!Number.isInteger(s))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${s}`);if(!n)throw new Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(a&&a.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${a}`);if(!h)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(d!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${d}`);if(!((e=t.statement)===null||e===void 0)&&e.includes(`
`))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${t.statement}`)}const f=Cl(t.address),m=u?`${u}://${n}`:n,y=t.statement?`${t.statement}
`:"",g=`${m} wants you to sign in with your Ethereum account:
${f}

${y}`;let v=`URI: ${h}
Version: ${d}
Chain ID: ${s}${a?`
Nonce: ${a}`:""}
Issued At: ${i.toISOString()}`;if(r&&(v+=`
Expiration Time: ${r.toISOString()}`),o&&(v+=`
Not Before: ${o.toISOString()}`),l&&(v+=`
Request ID: ${l}`),c){let x=`
Resources:`;for(const w of c){if(!w||typeof w!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${w}`);x+=`
- ${w}`}v+=x}return`${g}
${v}`}class V extends Error{constructor({message:e,code:s,cause:n,name:r}){var i;super(e,{cause:n}),this.__isWebAuthnError=!0,this.name=(i=r??(n instanceof Error?n.name:void 0))!==null&&i!==void 0?i:"Unknown Error",this.code=s}}class ks extends V{constructor(e,s){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:s,message:e}),this.name="WebAuthnUnknownError",this.originalError=s}}function ng({error:t,options:e}){var s,n,r;const{publicKey:i}=e;if(!i)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new V({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else if(t.name==="ConstraintError"){if(((s=i.authenticatorSelection)===null||s===void 0?void 0:s.requireResidentKey)===!0)return new V({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:t});if(e.mediation==="conditional"&&((n=i.authenticatorSelection)===null||n===void 0?void 0:n.userVerification)==="required")return new V({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:t});if(((r=i.authenticatorSelection)===null||r===void 0?void 0:r.userVerification)==="required")return new V({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:t})}else{if(t.name==="InvalidStateError")return new V({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:t});if(t.name==="NotAllowedError")return new V({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="NotSupportedError")return i.pubKeyCredParams.filter(o=>o.type==="public-key").length===0?new V({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:t}):new V({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:t});if(t.name==="SecurityError"){const a=window.location.hostname;if(Rl(a)){if(i.rp.id!==a)return new V({message:`The RP ID "${i.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new V({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="TypeError"){if(i.user.id.byteLength<1||i.user.id.byteLength>64)return new V({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:t})}else if(t.name==="UnknownError")return new V({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new V({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}function rg({error:t,options:e}){const{publicKey:s}=e;if(!s)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new V({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else{if(t.name==="NotAllowedError")return new V({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="SecurityError"){const n=window.location.hostname;if(Rl(n)){if(s.rpId!==n)return new V({message:`The RP ID "${s.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new V({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="UnknownError")return new V({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new V({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}class ig{createNewAbortSignal(){if(this.controller){const s=new Error("Cancelling existing WebAuthn API call for new one");s.name="AbortError",this.controller.abort(s)}const e=new AbortController;return this.controller=e,e.signal}cancelCeremony(){if(this.controller){const e=new Error("Manually cancelling existing WebAuthn API call");e.name="AbortError",this.controller.abort(e),this.controller=void 0}}}const ag=new ig;function og(t){if(!t)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(t);const{challenge:e,user:s,excludeCredentials:n}=t,r=Ds(t,["challenge","user","excludeCredentials"]),i=dt(e).buffer,a=Object.assign(Object.assign({},s),{id:dt(s.id).buffer}),o=Object.assign(Object.assign({},r),{challenge:i,user:a});if(n&&n.length>0){o.excludeCredentials=new Array(n.length);for(let l=0;l<n.length;l++){const c=n[l];o.excludeCredentials[l]=Object.assign(Object.assign({},c),{id:dt(c.id).buffer,type:c.type||"public-key",transports:c.transports})}}return o}function lg(t){if(!t)throw new Error("Credential request options are required");if(typeof PublicKeyCredential<"u"&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseRequestOptionsFromJSON=="function")return PublicKeyCredential.parseRequestOptionsFromJSON(t);const{challenge:e,allowCredentials:s}=t,n=Ds(t,["challenge","allowCredentials"]),r=dt(e).buffer,i=Object.assign(Object.assign({},n),{challenge:r});if(s&&s.length>0){i.allowCredentials=new Array(s.length);for(let a=0;a<s.length;a++){const o=s[a];i.allowCredentials[a]=Object.assign(Object.assign({},o),{id:dt(o.id).buffer,type:o.type||"public-key",transports:o.transports})}}return i}function cg(t){var e;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();const s=t;return{id:t.id,rawId:t.id,response:{attestationObject:Ge(new Uint8Array(t.response.attestationObject)),clientDataJSON:Ge(new Uint8Array(t.response.clientDataJSON))},type:"public-key",clientExtensionResults:t.getClientExtensionResults(),authenticatorAttachment:(e=s.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function ug(t){var e;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();const s=t,n=t.getClientExtensionResults(),r=t.response;return{id:t.id,rawId:t.id,response:{authenticatorData:Ge(new Uint8Array(r.authenticatorData)),clientDataJSON:Ge(new Uint8Array(r.clientDataJSON)),signature:Ge(new Uint8Array(r.signature)),userHandle:r.userHandle?Ge(new Uint8Array(r.userHandle)):void 0},type:"public-key",clientExtensionResults:n,authenticatorAttachment:(e=s.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function Rl(t){return t==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(t)}function wa(){var t,e;return!!(G()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&typeof((t=navigator==null?void 0:navigator.credentials)===null||t===void 0?void 0:t.create)=="function"&&typeof((e=navigator==null?void 0:navigator.credentials)===null||e===void 0?void 0:e.get)=="function")}async function hg(t){try{const e=await navigator.credentials.create(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new ks("Browser returned unexpected credential type",e)}:{data:null,error:new ks("Empty credential response",e)}}catch(e){return{data:null,error:ng({error:e,options:t})}}}async function dg(t){try{const e=await navigator.credentials.get(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new ks("Browser returned unexpected credential type",e)}:{data:null,error:new ks("Empty credential response",e)}}catch(e){return{data:null,error:rg({error:e,options:t})}}}const fg={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},pg={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function Es(...t){const e=r=>r!==null&&typeof r=="object"&&!Array.isArray(r),s=r=>r instanceof ArrayBuffer||ArrayBuffer.isView(r),n={};for(const r of t)if(r)for(const i in r){const a=r[i];if(a!==void 0)if(Array.isArray(a))n[i]=a;else if(s(a))n[i]=a;else if(e(a)){const o=n[i];e(o)?n[i]=Es(o,a):n[i]=Es(a)}else n[i]=a}return n}function mg(t,e){return Es(fg,t,e||{})}function gg(t,e){return Es(pg,t,e||{})}class yg{constructor(e){this.client=e,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(e){return this.client.mfa.enroll(Object.assign(Object.assign({},e),{factorType:"webauthn"}))}async _challenge({factorId:e,webauthn:s,friendlyName:n,signal:r},i){try{const{data:a,error:o}=await this.client.mfa.challenge({factorId:e,webauthn:s});if(!a)return{data:null,error:o};const l=r??ag.createNewAbortSignal();if(a.webauthn.type==="create"){const{user:c}=a.webauthn.credential_options.publicKey;c.name||(c.name=`${c.id}:${n}`),c.displayName||(c.displayName=c.name)}switch(a.webauthn.type){case"create":{const c=mg(a.webauthn.credential_options.publicKey,i==null?void 0:i.create),{data:u,error:h}=await hg({publicKey:c,signal:l});return u?{data:{factorId:e,challengeId:a.id,webauthn:{type:a.webauthn.type,credential_response:u}},error:null}:{data:null,error:h}}case"request":{const c=gg(a.webauthn.credential_options.publicKey,i==null?void 0:i.request),{data:u,error:h}=await dg(Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:c,signal:l}));return u?{data:{factorId:e,challengeId:a.id,webauthn:{type:a.webauthn.type,credential_response:u}},error:null}:{data:null,error:h}}}}catch(a){return A(a)?{data:null,error:a}:{data:null,error:new We("Unexpected error in challenge",a)}}}async _verify({challengeId:e,factorId:s,webauthn:n}){return this.client.mfa.verify({factorId:s,challengeId:e,webauthn:n})}async _authenticate({factorId:e,webauthn:{rpId:s=typeof window<"u"?window.location.hostname:void 0,rpOrigins:n=typeof window<"u"?[window.location.origin]:void 0,signal:r}={}},i){if(!s)return{data:null,error:new Vt("rpId is required for WebAuthn authentication")};try{if(!wa())return{data:null,error:new We("Browser does not support WebAuthn",null)};const{data:a,error:o}=await this.challenge({factorId:e,webauthn:{rpId:s,rpOrigins:n},signal:r},{request:i});if(!a)return{data:null,error:o};const{webauthn:l}=a;return this._verify({factorId:e,challengeId:a.challengeId,webauthn:{type:l.type,rpId:s,rpOrigins:n,credential_response:l.credential_response}})}catch(a){return A(a)?{data:null,error:a}:{data:null,error:new We("Unexpected error in authenticate",a)}}}async _register({friendlyName:e,webauthn:{rpId:s=typeof window<"u"?window.location.hostname:void 0,rpOrigins:n=typeof window<"u"?[window.location.origin]:void 0,signal:r}={}},i){if(!s)return{data:null,error:new Vt("rpId is required for WebAuthn registration")};try{if(!wa())return{data:null,error:new We("Browser does not support WebAuthn",null)};const{data:a,error:o}=await this._enroll({friendlyName:e});if(!a)return await this.client.mfa.listFactors().then(u=>{var h;return(h=u.data)===null||h===void 0?void 0:h.all.find(d=>d.factor_type==="webauthn"&&d.friendly_name===e&&d.status!=="unverified")}).then(u=>u?this.client.mfa.unenroll({factorId:u==null?void 0:u.id}):void 0),{data:null,error:o};const{data:l,error:c}=await this._challenge({factorId:a.id,friendlyName:a.friendly_name,webauthn:{rpId:s,rpOrigins:n},signal:r},{create:i});return l?this._verify({factorId:a.id,challengeId:l.challengeId,webauthn:{rpId:s,rpOrigins:n,type:l.webauthn.type,credential_response:l.webauthn.credential_response}}):{data:null,error:c}}catch(a){return A(a)?{data:null,error:a}:{data:null,error:new We("Unexpected error in register",a)}}}}Zm();const vg={url:fm,storageKey:pm,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:mm,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1};async function ba(t,e,s){return await s()}const nt={};class Ut{get jwks(){var e,s;return(s=(e=nt[this.storageKey])===null||e===void 0?void 0:e.jwks)!==null&&s!==void 0?s:{keys:[]}}set jwks(e){nt[this.storageKey]=Object.assign(Object.assign({},nt[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,s;return(s=(e=nt[this.storageKey])===null||e===void 0?void 0:e.cachedAt)!==null&&s!==void 0?s:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){nt[this.storageKey]=Object.assign(Object.assign({},nt[this.storageKey]),{cachedAt:e})}constructor(e){var s,n,r;this.userStorage=null,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;const i=Object.assign(Object.assign({},vg),e);if(this.storageKey=i.storageKey,this.instanceID=(s=Ut.nextInstanceID[this.storageKey])!==null&&s!==void 0?s:0,Ut.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!i.debug,typeof i.debug=="function"&&(this.logger=i.debug),this.instanceID>0&&G()){const a=`${this._logPrefix()} 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.`;console.warn(a),this.logDebugMessages&&console.trace(a)}if(this.persistSession=i.persistSession,this.autoRefreshToken=i.autoRefreshToken,this.admin=new Ym({url:i.url,headers:i.headers,fetch:i.fetch}),this.url=i.url,this.headers=i.headers,this.fetch=Al(i.fetch),this.lock=i.lock||ba,this.detectSessionInUrl=i.detectSessionInUrl,this.flowType=i.flowType,this.hasCustomAuthorizationHeader=i.hasCustomAuthorizationHeader,this.throwOnError=i.throwOnError,i.lock?this.lock=i.lock:this.persistSession&&G()&&(!((n=globalThis==null?void 0:globalThis.navigator)===null||n===void 0)&&n.locks)?this.lock=Qm:this.lock=ba,this.jwks||(this.jwks={keys:[]},this.jwks_cached_at=Number.MIN_SAFE_INTEGER),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),webauthn:new yg(this)},this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this),listGrants:this._listOAuthGrants.bind(this),revokeGrant:this._revokeOAuthGrant.bind(this)},this.persistSession?(i.storage?this.storage=i.storage:El()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=va(this.memoryStorage)),i.userStorage&&(this.userStorage=i.userStorage)):(this.memoryStorage={},this.storage=va(this.memoryStorage)),G()&&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)}(r=this.broadcastChannel)===null||r===void 0||r.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()}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(e){if(this.throwOnError&&e&&e.error)throw e.error;return e}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${Sl}) ${new Date().toISOString()}`}_debug(...e){return this.logDebugMessages&&this.logger(this._logPrefix(),...e),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(){var e;try{let s={},n="none";if(G()&&(s=Rm(window.location.href),this._isImplicitGrantCallback(s)?n="implicit":await this._isPKCECallback(s)&&(n="pkce")),G()&&this.detectSessionInUrl&&n!=="none"){const{data:r,error:i}=await this._getSessionFromURL(s,n);if(i){if(this._debug("#_initialize()","error detecting session from URL",i),xm(i)){const l=(e=i.details)===null||e===void 0?void 0:e.code;if(l==="identity_already_exists"||l==="identity_not_found"||l==="single_identity_not_deletable")return{error:i}}return await this._removeSession(),{error:i}}const{session:a,redirectType:o}=r;return this._debug("#_initialize()","detected session in URL",a,"redirect type",o),await this._saveSession(a),setTimeout(async()=>{o==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",a):await this._notifyAllSubscribers("SIGNED_IN",a)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(s){return A(s)?this._returnResult({error:s}):this._returnResult({error:new We("Unexpected error during initialization",s)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var s,n,r;try{const i=await C(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(n=(s=e==null?void 0:e.options)===null||s===void 0?void 0:s.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:(r=e==null?void 0:e.options)===null||r===void 0?void 0:r.captchaToken}},xform:le}),{data:a,error:o}=i;if(o||!a)return this._returnResult({data:{user:null,session:null},error:o});const l=a.session,c=a.user;return a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",l)),this._returnResult({data:{user:c,session:l},error:null})}catch(i){if(A(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signUp(e){var s,n,r;try{let i;if("email"in e){const{email:u,password:h,options:d}=e;let f=null,m=null;this.flowType==="pkce"&&([f,m]=await et(this.storage,this.storageKey)),i=await C(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:d==null?void 0:d.emailRedirectTo,body:{email:u,password:h,data:(s=d==null?void 0:d.data)!==null&&s!==void 0?s:{},gotrue_meta_security:{captcha_token:d==null?void 0:d.captchaToken},code_challenge:f,code_challenge_method:m},xform:le})}else if("phone"in e){const{phone:u,password:h,options:d}=e;i=await C(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:u,password:h,data:(n=d==null?void 0:d.data)!==null&&n!==void 0?n:{},channel:(r=d==null?void 0:d.channel)!==null&&r!==void 0?r:"sms",gotrue_meta_security:{captcha_token:d==null?void 0:d.captchaToken}},xform:le})}else throw new ns("You must provide either an email or phone number and a password");const{data:a,error:o}=i;if(o||!a)return await K(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:o});const l=a.session,c=a.user;return a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",l)),this._returnResult({data:{user:c,session:l},error:null})}catch(i){if(await K(this.storage,`${this.storageKey}-code-verifier`),A(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signInWithPassword(e){try{let s;if("email"in e){const{email:i,password:a,options:o}=e;s=await C(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:i,password:a,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken}},xform:ga})}else if("phone"in e){const{phone:i,password:a,options:o}=e;s=await C(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:i,password:a,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken}},xform:ga})}else throw new ns("You must provide either an email or phone number and a password");const{data:n,error:r}=s;if(r)return this._returnResult({data:{user:null,session:null},error:r});if(!n||!n.session||!n.user){const i=new Ze;return this._returnResult({data:{user:null,session:null},error:i})}return n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers("SIGNED_IN",n.session)),this._returnResult({data:Object.assign({user:n.user,session:n.session},n.weak_password?{weakPassword:n.weak_password}:null),error:r})}catch(s){if(A(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signInWithOAuth(e){var s,n,r,i;return await this._handleProviderSignIn(e.provider,{redirectTo:(s=e.options)===null||s===void 0?void 0:s.redirectTo,scopes:(n=e.options)===null||n===void 0?void 0:n.scopes,queryParams:(r=e.options)===null||r===void 0?void 0:r.queryParams,skipBrowserRedirect:(i=e.options)===null||i===void 0?void 0:i.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,this._acquireLock(-1,async()=>this._exchangeCodeForSession(e))}async signInWithWeb3(e){const{chain:s}=e;switch(s){case"ethereum":return await this.signInWithEthereum(e);case"solana":return await this.signInWithSolana(e);default:throw new Error(`@supabase/auth-js: Unsupported chain "${s}"`)}}async signInWithEthereum(e){var s,n,r,i,a,o,l,c,u,h,d;let f,m;if("message"in e)f=e.message,m=e.signature;else{const{chain:y,wallet:g,statement:v,options:x}=e;let w;if(G())if(typeof g=="object")w=g;else{const O=window;if("ethereum"in O&&typeof O.ethereum=="object"&&"request"in O.ethereum&&typeof O.ethereum.request=="function")w=O.ethereum;else throw new Error("@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'ethereum', wallet: resolvedUserWallet }) instead.")}else{if(typeof g!="object"||!(x!=null&&x.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");w=g}const b=new URL((s=x==null?void 0:x.url)!==null&&s!==void 0?s:window.location.href),S=await w.request({method:"eth_requestAccounts"}).then(O=>O).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!S||S.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const T=Cl(S[0]);let j=(n=x==null?void 0:x.signInWithEthereum)===null||n===void 0?void 0:n.chainId;if(!j){const O=await w.request({method:"eth_chainId"});j=eg(O)}const E={domain:b.host,address:T,statement:v,uri:b.href,version:"1",chainId:j,nonce:(r=x==null?void 0:x.signInWithEthereum)===null||r===void 0?void 0:r.nonce,issuedAt:(a=(i=x==null?void 0:x.signInWithEthereum)===null||i===void 0?void 0:i.issuedAt)!==null&&a!==void 0?a:new Date,expirationTime:(o=x==null?void 0:x.signInWithEthereum)===null||o===void 0?void 0:o.expirationTime,notBefore:(l=x==null?void 0:x.signInWithEthereum)===null||l===void 0?void 0:l.notBefore,requestId:(c=x==null?void 0:x.signInWithEthereum)===null||c===void 0?void 0:c.requestId,resources:(u=x==null?void 0:x.signInWithEthereum)===null||u===void 0?void 0:u.resources};f=sg(E),m=await w.request({method:"personal_sign",params:[tg(f),T]})}try{const{data:y,error:g}=await C(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:f,signature:m},!((h=e.options)===null||h===void 0)&&h.captchaToken?{gotrue_meta_security:{captcha_token:(d=e.options)===null||d===void 0?void 0:d.captchaToken}}:null),xform:le});if(g)throw g;if(!y||!y.session||!y.user){const v=new Ze;return this._returnResult({data:{user:null,session:null},error:v})}return y.session&&(await this._saveSession(y.session),await this._notifyAllSubscribers("SIGNED_IN",y.session)),this._returnResult({data:Object.assign({},y),error:g})}catch(y){if(A(y))return this._returnResult({data:{user:null,session:null},error:y});throw y}}async signInWithSolana(e){var s,n,r,i,a,o,l,c,u,h,d,f;let m,y;if("message"in e)m=e.message,y=e.signature;else{const{chain:g,wallet:v,statement:x,options:w}=e;let b;if(G())if(typeof v=="object")b=v;else{const T=window;if("solana"in T&&typeof T.solana=="object"&&("signIn"in T.solana&&typeof T.solana.signIn=="function"||"signMessage"in T.solana&&typeof T.solana.signMessage=="function"))b=T.solana;else throw new Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.")}else{if(typeof v!="object"||!(w!=null&&w.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");b=v}const S=new URL((s=w==null?void 0:w.url)!==null&&s!==void 0?s:window.location.href);if("signIn"in b&&b.signIn){const T=await b.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},w==null?void 0:w.signInWithSolana),{version:"1",domain:S.host,uri:S.href}),x?{statement:x}:null));let j;if(Array.isArray(T)&&T[0]&&typeof T[0]=="object")j=T[0];else if(T&&typeof T=="object"&&"signedMessage"in T&&"signature"in T)j=T;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in j&&"signature"in j&&(typeof j.signedMessage=="string"||j.signedMessage instanceof Uint8Array)&&j.signature instanceof Uint8Array)m=typeof j.signedMessage=="string"?j.signedMessage:new TextDecoder().decode(j.signedMessage),y=j.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in b)||typeof b.signMessage!="function"||!("publicKey"in b)||typeof b!="object"||!b.publicKey||!("toBase58"in b.publicKey)||typeof b.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");m=[`${S.host} wants you to sign in with your Solana account:`,b.publicKey.toBase58(),...x?["",x,""]:[""],"Version: 1",`URI: ${S.href}`,`Issued At: ${(r=(n=w==null?void 0:w.signInWithSolana)===null||n===void 0?void 0:n.issuedAt)!==null&&r!==void 0?r:new Date().toISOString()}`,...!((i=w==null?void 0:w.signInWithSolana)===null||i===void 0)&&i.notBefore?[`Not Before: ${w.signInWithSolana.notBefore}`]:[],...!((a=w==null?void 0:w.signInWithSolana)===null||a===void 0)&&a.expirationTime?[`Expiration Time: ${w.signInWithSolana.expirationTime}`]:[],...!((o=w==null?void 0:w.signInWithSolana)===null||o===void 0)&&o.chainId?[`Chain ID: ${w.signInWithSolana.chainId}`]:[],...!((l=w==null?void 0:w.signInWithSolana)===null||l===void 0)&&l.nonce?[`Nonce: ${w.signInWithSolana.nonce}`]:[],...!((c=w==null?void 0:w.signInWithSolana)===null||c===void 0)&&c.requestId?[`Request ID: ${w.signInWithSolana.requestId}`]:[],...!((h=(u=w==null?void 0:w.signInWithSolana)===null||u===void 0?void 0:u.resources)===null||h===void 0)&&h.length?["Resources",...w.signInWithSolana.resources.map(j=>`- ${j}`)]:[]].join(`
`);const T=await b.signMessage(new TextEncoder().encode(m),"utf8");if(!T||!(T instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");y=T}}try{const{data:g,error:v}=await C(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:m,signature:Ge(y)},!((d=e.options)===null||d===void 0)&&d.captchaToken?{gotrue_meta_security:{captcha_token:(f=e.options)===null||f===void 0?void 0:f.captchaToken}}:null),xform:le});if(v)throw v;if(!g||!g.session||!g.user){const x=new Ze;return this._returnResult({data:{user:null,session:null},error:x})}return g.session&&(await this._saveSession(g.session),await this._notifyAllSubscribers("SIGNED_IN",g.session)),this._returnResult({data:Object.assign({},g),error:v})}catch(g){if(A(g))return this._returnResult({data:{user:null,session:null},error:g});throw g}}async _exchangeCodeForSession(e){const s=await Ve(this.storage,`${this.storageKey}-code-verifier`),[n,r]=(s??"").split("/");try{if(!n&&this.flowType==="pkce")throw new _m;const{data:i,error:a}=await C(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:n},xform:le});if(await K(this.storage,`${this.storageKey}-code-verifier`),a)throw a;if(!i||!i.session||!i.user){const o=new Ze;return this._returnResult({data:{user:null,session:null,redirectType:null},error:o})}return i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers("SIGNED_IN",i.session)),this._returnResult({data:Object.assign(Object.assign({},i),{redirectType:r??null}),error:a})}catch(i){if(await K(this.storage,`${this.storageKey}-code-verifier`),A(i))return this._returnResult({data:{user:null,session:null,redirectType:null},error:i});throw i}}async signInWithIdToken(e){try{const{options:s,provider:n,token:r,access_token:i,nonce:a}=e,o=await C(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:n,id_token:r,access_token:i,nonce:a,gotrue_meta_security:{captcha_token:s==null?void 0:s.captchaToken}},xform:le}),{data:l,error:c}=o;if(c)return this._returnResult({data:{user:null,session:null},error:c});if(!l||!l.session||!l.user){const u=new Ze;return this._returnResult({data:{user:null,session:null},error:u})}return l.session&&(await this._saveSession(l.session),await this._notifyAllSubscribers("SIGNED_IN",l.session)),this._returnResult({data:l,error:c})}catch(s){if(A(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signInWithOtp(e){var s,n,r,i,a;try{if("email"in e){const{email:o,options:l}=e;let c=null,u=null;this.flowType==="pkce"&&([c,u]=await et(this.storage,this.storageKey));const{error:h}=await C(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:o,data:(s=l==null?void 0:l.data)!==null&&s!==void 0?s:{},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:c,code_challenge_method:u},redirectTo:l==null?void 0:l.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:h})}if("phone"in e){const{phone:o,options:l}=e,{data:c,error:u}=await C(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:o,data:(r=l==null?void 0:l.data)!==null&&r!==void 0?r:{},create_user:(i=l==null?void 0:l.shouldCreateUser)!==null&&i!==void 0?i:!0,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken},channel:(a=l==null?void 0:l.channel)!==null&&a!==void 0?a:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:c==null?void 0:c.message_id},error:u})}throw new ns("You must provide either an email or phone number.")}catch(o){if(await K(this.storage,`${this.storageKey}-code-verifier`),A(o))return this._returnResult({data:{user:null,session:null},error:o});throw o}}async verifyOtp(e){var s,n;try{let r,i;"options"in e&&(r=(s=e.options)===null||s===void 0?void 0:s.redirectTo,i=(n=e.options)===null||n===void 0?void 0:n.captchaToken);const{data:a,error:o}=await C(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:i}}),redirectTo:r,xform:le});if(o)throw o;if(!a)throw new Error("An error occurred on token verification.");const l=a.session,c=a.user;return l!=null&&l.access_token&&(await this._saveSession(l),await this._notifyAllSubscribers(e.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",l)),this._returnResult({data:{user:c,session:l},error:null})}catch(r){if(A(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithSSO(e){var s,n,r,i,a;try{let o=null,l=null;this.flowType==="pkce"&&([o,l]=await et(this.storage,this.storageKey));const c=await C(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in e?{provider_id:e.providerId}:null),"domain"in e?{domain:e.domain}:null),{redirect_to:(n=(s=e.options)===null||s===void 0?void 0:s.redirectTo)!==null&&n!==void 0?n:void 0}),!((r=e==null?void 0:e.options)===null||r===void 0)&&r.captchaToken?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:o,code_challenge_method:l}),headers:this.headers,xform:Gm});return!((i=c.data)===null||i===void 0)&&i.url&&G()&&!(!((a=e.options)===null||a===void 0)&&a.skipBrowserRedirect)&&window.location.assign(c.data.url),this._returnResult(c)}catch(o){if(await K(this.storage,`${this.storageKey}-code-verifier`),A(o))return this._returnResult({data:null,error:o});throw o}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async e=>{const{data:{session:s},error:n}=e;if(n)throw n;if(!s)throw new Z;const{error:r}=await C(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:s.access_token});return this._returnResult({data:{user:null,session:null},error:r})})}catch(e){if(A(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async resend(e){try{const s=`${this.url}/resend`;if("email"in e){const{email:n,type:r,options:i}=e,{error:a}=await C(this.fetch,"POST",s,{headers:this.headers,body:{email:n,type:r,gotrue_meta_security:{captcha_token:i==null?void 0:i.captchaToken}},redirectTo:i==null?void 0:i.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:a})}else if("phone"in e){const{phone:n,type:r,options:i}=e,{data:a,error:o}=await C(this.fetch,"POST",s,{headers:this.headers,body:{phone:n,type:r,gotrue_meta_security:{captcha_token:i==null?void 0:i.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:a==null?void 0:a.message_id},error:o})}throw new ns("You must provide either an email or phone number and a type")}catch(s){if(A(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async getSession(){return await this.initializePromise,await this._acquireLock(-1,async()=>this._useSession(async s=>s))}async _acquireLock(e,s){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){const n=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),r=(async()=>(await n,await s()))();return this.pendingInLock.push((async()=>{try{await r}catch{}})()),r}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const n=s();for(this.pendingInLock.push((async()=>{try{await n}catch{}})()),await n;this.pendingInLock.length;){const r=[...this.pendingInLock];await Promise.all(r),this.pendingInLock.splice(0,r.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(e){this._debug("#_useSession","begin");try{const s=await this.__loadSession();return await e(s)}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 e=null;const s=await Ve(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",s),s!==null&&(this._isValidSession(s)?e=s:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!e)return{data:{session:null},error:null};const n=e.expires_at?e.expires_at*1e3-Date.now()<sn:!1;if(this._debug("#__loadSession()",`session has${n?"":" not"} expired`,"expires_at",e.expires_at),!n){if(this.userStorage){const a=await Ve(this.userStorage,this.storageKey+"-user");a!=null&&a.user?e.user=a.user:e.user=an()}if(this.storage.isServer&&e.user&&!e.user.__isUserNotAvailableProxy){const a={value:this.suppressGetSessionWarning};e.user=qm(e.user,a),a.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:e},error:null}}const{data:r,error:i}=await this._callRefreshToken(e.refresh_token);return i?this._returnResult({data:{session:null},error:i}):this._returnResult({data:{session:r},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(e){if(e)return await this._getUser(e);await this.initializePromise;const s=await this._acquireLock(-1,async()=>await this._getUser());return s.data.user&&(this.suppressGetSessionWarning=!0),s}async _getUser(e){try{return e?await C(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:je}):await this._useSession(async s=>{var n,r,i;const{data:a,error:o}=s;if(o)throw o;return!(!((n=a.session)===null||n===void 0)&&n.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new Z}:await C(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(i=(r=a.session)===null||r===void 0?void 0:r.access_token)!==null&&i!==void 0?i:void 0,xform:je})})}catch(s){if(A(s))return bm(s)&&(await this._removeSession(),await K(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:s});throw s}}async updateUser(e,s={}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._updateUser(e,s))}async _updateUser(e,s={}){try{return await this._useSession(async n=>{const{data:r,error:i}=n;if(i)throw i;if(!r.session)throw new Z;const a=r.session;let o=null,l=null;this.flowType==="pkce"&&e.email!=null&&([o,l]=await et(this.storage,this.storageKey));const{data:c,error:u}=await C(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:s==null?void 0:s.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:o,code_challenge_method:l}),jwt:a.access_token,xform:je});if(u)throw u;return a.user=c.user,await this._saveSession(a),await this._notifyAllSubscribers("USER_UPDATED",a),this._returnResult({data:{user:a.user},error:null})})}catch(n){if(await K(this.storage,`${this.storageKey}-code-verifier`),A(n))return this._returnResult({data:{user:null},error:n});throw n}}async setSession(e){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._setSession(e))}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new Z;const s=Date.now()/1e3;let n=s,r=!0,i=null;const{payload:a}=rn(e.access_token);if(a.exp&&(n=a.exp,r=n<=s),r){const{data:o,error:l}=await this._callRefreshToken(e.refresh_token);if(l)return this._returnResult({data:{user:null,session:null},error:l});if(!o)return{data:{user:null,session:null},error:null};i=o}else{const{data:o,error:l}=await this._getUser(e.access_token);if(l)throw l;i={access_token:e.access_token,refresh_token:e.refresh_token,user:o.user,token_type:"bearer",expires_in:n-s,expires_at:n},await this._saveSession(i),await this._notifyAllSubscribers("SIGNED_IN",i)}return this._returnResult({data:{user:i.user,session:i},error:null})}catch(s){if(A(s))return this._returnResult({data:{session:null,user:null},error:s});throw s}}async refreshSession(e){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._refreshSession(e))}async _refreshSession(e){try{return await this._useSession(async s=>{var n;if(!e){const{data:a,error:o}=s;if(o)throw o;e=(n=a.session)!==null&&n!==void 0?n:void 0}if(!(e!=null&&e.refresh_token))throw new Z;const{data:r,error:i}=await this._callRefreshToken(e.refresh_token);return i?this._returnResult({data:{user:null,session:null},error:i}):r?this._returnResult({data:{user:r.user,session:r},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(s){if(A(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async _getSessionFromURL(e,s){try{if(!G())throw new rs("No browser detected.");if(e.error||e.error_description||e.error_code)throw new rs(e.error_description||"Error in URL with unspecified error_description",{error:e.error||"unspecified_error",code:e.error_code||"unspecified_code"});switch(s){case"implicit":if(this.flowType==="pkce")throw new ca("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new rs("Not a valid implicit grant flow url.");break;default:}if(s==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!e.code)throw new ca("No code detected.");const{data:x,error:w}=await this._exchangeCodeForSession(e.code);if(w)throw w;const b=new URL(window.location.href);return b.searchParams.delete("code"),window.history.replaceState(window.history.state,"",b.toString()),{data:{session:x.session,redirectType:null},error:null}}const{provider_token:n,provider_refresh_token:r,access_token:i,refresh_token:a,expires_in:o,expires_at:l,token_type:c}=e;if(!i||!o||!a||!c)throw new rs("No session defined in URL");const u=Math.round(Date.now()/1e3),h=parseInt(o);let d=u+h;l&&(d=parseInt(l));const f=d-u;f*1e3<=at&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${f}s, should have been closer to ${h}s`);const m=d-h;u-m>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",m,d,u):u-m<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",m,d,u);const{data:y,error:g}=await this._getUser(i);if(g)throw g;const v={provider_token:n,provider_refresh_token:r,access_token:i,expires_in:h,expires_at:d,refresh_token:a,token_type:c,user:y.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:v,redirectType:e.type},error:null})}catch(n){if(A(n))return this._returnResult({data:{session:null,redirectType:null},error:n});throw n}}_isImplicitGrantCallback(e){return typeof this.detectSessionInUrl=="function"?this.detectSessionInUrl(new URL(window.location.href),e):!!(e.access_token||e.error_description)}async _isPKCECallback(e){const s=await Ve(this.storage,`${this.storageKey}-code-verifier`);return!!(e.code&&s)}async signOut(e={scope:"global"}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._signOut(e))}async _signOut({scope:e}={scope:"global"}){return await this._useSession(async s=>{var n;const{data:r,error:i}=s;if(i)return this._returnResult({error:i});const a=(n=r.session)===null||n===void 0?void 0:n.access_token;if(a){const{error:o}=await this.admin.signOut(a,e);if(o&&!(wm(o)&&(o.status===404||o.status===401||o.status===403)))return this._returnResult({error:o})}return e!=="others"&&(await this._removeSession(),await K(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(e){const s=Cm(),n={id:s,callback:e,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",s),this.stateChangeEmitters.delete(s)}};return this._debug("#onAuthStateChange()","registered callback with id",s),this.stateChangeEmitters.set(s,n),(async()=>(await this.initializePromise,await this._acquireLock(-1,async()=>{this._emitInitialSession(s)})))(),{data:{subscription:n}}}async _emitInitialSession(e){return await this._useSession(async s=>{var n,r;try{const{data:{session:i},error:a}=s;if(a)throw a;await((n=this.stateChangeEmitters.get(e))===null||n===void 0?void 0:n.callback("INITIAL_SESSION",i)),this._debug("INITIAL_SESSION","callback id",e,"session",i)}catch(i){await((r=this.stateChangeEmitters.get(e))===null||r===void 0?void 0:r.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",i),console.error(i)}})}async resetPasswordForEmail(e,s={}){let n=null,r=null;this.flowType==="pkce"&&([n,r]=await et(this.storage,this.storageKey,!0));try{return await C(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:n,code_challenge_method:r,gotrue_meta_security:{captcha_token:s.captchaToken}},headers:this.headers,redirectTo:s.redirectTo})}catch(i){if(await K(this.storage,`${this.storageKey}-code-verifier`),A(i))return this._returnResult({data:null,error:i});throw i}}async getUserIdentities(){var e;try{const{data:s,error:n}=await this.getUser();if(n)throw n;return this._returnResult({data:{identities:(e=s.user.identities)!==null&&e!==void 0?e:[]},error:null})}catch(s){if(A(s))return this._returnResult({data:null,error:s});throw s}}async linkIdentity(e){return"token"in e?this.linkIdentityIdToken(e):this.linkIdentityOAuth(e)}async linkIdentityOAuth(e){var s;try{const{data:n,error:r}=await this._useSession(async i=>{var a,o,l,c,u;const{data:h,error:d}=i;if(d)throw d;const f=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:(a=e.options)===null||a===void 0?void 0:a.redirectTo,scopes:(o=e.options)===null||o===void 0?void 0:o.scopes,queryParams:(l=e.options)===null||l===void 0?void 0:l.queryParams,skipBrowserRedirect:!0});return await C(this.fetch,"GET",f,{headers:this.headers,jwt:(u=(c=h.session)===null||c===void 0?void 0:c.access_token)!==null&&u!==void 0?u:void 0})});if(r)throw r;return G()&&!(!((s=e.options)===null||s===void 0)&&s.skipBrowserRedirect)&&window.location.assign(n==null?void 0:n.url),this._returnResult({data:{provider:e.provider,url:n==null?void 0:n.url},error:null})}catch(n){if(A(n))return this._returnResult({data:{provider:e.provider,url:null},error:n});throw n}}async linkIdentityIdToken(e){return await this._useSession(async s=>{var n;try{const{error:r,data:{session:i}}=s;if(r)throw r;const{options:a,provider:o,token:l,access_token:c,nonce:u}=e,h=await C(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(n=i==null?void 0:i.access_token)!==null&&n!==void 0?n:void 0,body:{provider:o,id_token:l,access_token:c,nonce:u,link_identity:!0,gotrue_meta_security:{captcha_token:a==null?void 0:a.captchaToken}},xform:le}),{data:d,error:f}=h;return f?this._returnResult({data:{user:null,session:null},error:f}):!d||!d.session||!d.user?this._returnResult({data:{user:null,session:null},error:new Ze}):(d.session&&(await this._saveSession(d.session),await this._notifyAllSubscribers("USER_UPDATED",d.session)),this._returnResult({data:d,error:f}))}catch(r){if(await K(this.storage,`${this.storageKey}-code-verifier`),A(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}})}async unlinkIdentity(e){try{return await this._useSession(async s=>{var n,r;const{data:i,error:a}=s;if(a)throw a;return await C(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:(r=(n=i.session)===null||n===void 0?void 0:n.access_token)!==null&&r!==void 0?r:void 0})})}catch(s){if(A(s))return this._returnResult({data:null,error:s});throw s}}async _refreshAccessToken(e){const s=`#_refreshAccessToken(${e.substring(0,5)}...)`;this._debug(s,"begin");try{const n=Date.now();return await Dm(async r=>(r>0&&await Om(200*Math.pow(2,r-1)),this._debug(s,"refreshing attempt",r),await C(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:le})),(r,i)=>{const a=200*Math.pow(2,r);return i&&nn(i)&&Date.now()+a-n<at})}catch(n){if(this._debug(s,"error",n),A(n))return this._returnResult({data:{session:null,user:null},error:n});throw n}finally{this._debug(s,"end")}}_isValidSession(e){return typeof e=="object"&&e!==null&&"access_token"in e&&"refresh_token"in e&&"expires_at"in e}async _handleProviderSignIn(e,s){const n=await this._getUrlForProvider(`${this.url}/authorize`,e,{redirectTo:s.redirectTo,scopes:s.scopes,queryParams:s.queryParams});return this._debug("#_handleProviderSignIn()","provider",e,"options",s,"url",n),G()&&!s.skipBrowserRedirect&&window.location.assign(n),{data:{provider:e,url:n},error:null}}async _recoverAndRefresh(){var e,s;const n="#_recoverAndRefresh()";this._debug(n,"begin");try{const r=await Ve(this.storage,this.storageKey);if(r&&this.userStorage){let a=await Ve(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!a&&(a={user:r.user},await ot(this.userStorage,this.storageKey+"-user",a)),r.user=(e=a==null?void 0:a.user)!==null&&e!==void 0?e:an()}else if(r&&!r.user&&!r.user){const a=await Ve(this.storage,this.storageKey+"-user");a&&(a!=null&&a.user)?(r.user=a.user,await K(this.storage,this.storageKey+"-user"),await ot(this.storage,this.storageKey,r)):r.user=an()}if(this._debug(n,"session from storage",r),!this._isValidSession(r)){this._debug(n,"session is not valid"),r!==null&&await this._removeSession();return}const i=((s=r.expires_at)!==null&&s!==void 0?s:1/0)*1e3-Date.now()<sn;if(this._debug(n,`session has${i?"":" not"} expired with margin of ${sn}s`),i){if(this.autoRefreshToken&&r.refresh_token){const{error:a}=await this._callRefreshToken(r.refresh_token);a&&(console.error(a),nn(a)||(this._debug(n,"refresh failed with a non-retryable error, removing the session",a),await this._removeSession()))}}else if(r.user&&r.user.__isUserNotAvailableProxy===!0)try{const{data:a,error:o}=await this._getUser(r.access_token);!o&&(a!=null&&a.user)?(r.user=a.user,await this._saveSession(r),await this._notifyAllSubscribers("SIGNED_IN",r)):this._debug(n,"could not get user data, skipping SIGNED_IN notification")}catch(a){console.error("Error getting user data:",a),this._debug(n,"error getting user data, skipping SIGNED_IN notification",a)}else await this._notifyAllSubscribers("SIGNED_IN",r)}catch(r){this._debug(n,"error",r),console.error(r);return}finally{this._debug(n,"end")}}async _callRefreshToken(e){var s,n;if(!e)throw new Z;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const r=`#_callRefreshToken(${e.substring(0,5)}...)`;this._debug(r,"begin");try{this.refreshingDeferred=new Ns;const{data:i,error:a}=await this._refreshAccessToken(e);if(a)throw a;if(!i.session)throw new Z;await this._saveSession(i.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",i.session);const o={data:i.session,error:null};return this.refreshingDeferred.resolve(o),o}catch(i){if(this._debug(r,"error",i),A(i)){const a={data:null,error:i};return nn(i)||await this._removeSession(),(s=this.refreshingDeferred)===null||s===void 0||s.resolve(a),a}throw(n=this.refreshingDeferred)===null||n===void 0||n.reject(i),i}finally{this.refreshingDeferred=null,this._debug(r,"end")}}async _notifyAllSubscribers(e,s,n=!0){const r=`#_notifyAllSubscribers(${e})`;this._debug(r,"begin",s,`broadcast = ${n}`);try{this.broadcastChannel&&n&&this.broadcastChannel.postMessage({event:e,session:s});const i=[],a=Array.from(this.stateChangeEmitters.values()).map(async o=>{try{await o.callback(e,s)}catch(l){i.push(l)}});if(await Promise.all(a),i.length>0){for(let o=0;o<i.length;o+=1)console.error(i[o]);throw i[0]}}finally{this._debug(r,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),this.suppressGetSessionWarning=!0,await K(this.storage,`${this.storageKey}-code-verifier`);const s=Object.assign({},e),n=s.user&&s.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!n&&s.user&&await ot(this.userStorage,this.storageKey+"-user",{user:s.user});const r=Object.assign({},s);delete r.user;const i=pa(r);await ot(this.storage,this.storageKey,i)}else{const r=pa(s);await ot(this.storage,this.storageKey,r)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await K(this.storage,this.storageKey),await K(this.storage,this.storageKey+"-code-verifier"),await K(this.storage,this.storageKey+"-user"),this.userStorage&&await K(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&G()&&(window!=null&&window.removeEventListener)&&window.removeEventListener("visibilitychange",e)}catch(s){console.error("removing visibilitychange callback failed",s)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const e=setInterval(()=>this._autoRefreshTokenTick(),at);this.autoRefreshTicker=e,e&&typeof e=="object"&&typeof e.unref=="function"?e.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(e),setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e)}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 e=Date.now();try{return await this._useSession(async s=>{const{data:{session:n}}=s;if(!n||!n.refresh_token||!n.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const r=Math.floor((n.expires_at*1e3-e)/at);this._debug("#_autoRefreshTokenTick()",`access token expires in ${r} ticks, a tick lasts ${at}ms, refresh threshold is ${qn} ticks`),r<=qn&&await this._callRefreshToken(n.refresh_token)})}catch(s){console.error("Auto refresh tick failed with error. This is likely a transient error.",s)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(e){if(e.isAcquireTimeout||e instanceof Pl)this._debug("auto refresh token tick lock not available");else throw e}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!G()||!(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(e){console.error("_handleVisibilityChange",e)}}async _onVisibilityChanged(e){const s=`#_onVisibilityChanged(${e})`;this._debug(s,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),e||(await this.initializePromise,await this._acquireLock(-1,async()=>{if(document.visibilityState!=="visible"){this._debug(s,"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(e,s,n){const r=[`provider=${encodeURIComponent(s)}`];if(n!=null&&n.redirectTo&&r.push(`redirect_to=${encodeURIComponent(n.redirectTo)}`),n!=null&&n.scopes&&r.push(`scopes=${encodeURIComponent(n.scopes)}`),this.flowType==="pkce"){const[i,a]=await et(this.storage,this.storageKey),o=new URLSearchParams({code_challenge:`${encodeURIComponent(i)}`,code_challenge_method:`${encodeURIComponent(a)}`});r.push(o.toString())}if(n!=null&&n.queryParams){const i=new URLSearchParams(n.queryParams);r.push(i.toString())}return n!=null&&n.skipBrowserRedirect&&r.push(`skip_http_redirect=${n.skipBrowserRedirect}`),`${e}?${r.join("&")}`}async _unenroll(e){try{return await this._useSession(async s=>{var n;const{data:r,error:i}=s;return i?this._returnResult({data:null,error:i}):await C(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:(n=r==null?void 0:r.session)===null||n===void 0?void 0:n.access_token})})}catch(s){if(A(s))return this._returnResult({data:null,error:s});throw s}}async _enroll(e){try{return await this._useSession(async s=>{var n,r;const{data:i,error:a}=s;if(a)return this._returnResult({data:null,error:a});const o=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},e.factorType==="phone"?{phone:e.phone}:e.factorType==="totp"?{issuer:e.issuer}:{}),{data:l,error:c}=await C(this.fetch,"POST",`${this.url}/factors`,{body:o,headers:this.headers,jwt:(n=i==null?void 0:i.session)===null||n===void 0?void 0:n.access_token});return c?this._returnResult({data:null,error:c}):(e.factorType==="totp"&&l.type==="totp"&&(!((r=l==null?void 0:l.totp)===null||r===void 0)&&r.qr_code)&&(l.totp.qr_code=`data:image/svg+xml;utf-8,${l.totp.qr_code}`),this._returnResult({data:l,error:null}))})}catch(s){if(A(s))return this._returnResult({data:null,error:s});throw s}}async _verify(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async s=>{var n;const{data:r,error:i}=s;if(i)return this._returnResult({data:null,error:i});const a=Object.assign({challenge_id:e.challengeId},"webauthn"in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:e.webauthn.type==="create"?cg(e.webauthn.credential_response):ug(e.webauthn.credential_response)})}:{code:e.code}),{data:o,error:l}=await C(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:a,headers:this.headers,jwt:(n=r==null?void 0:r.session)===null||n===void 0?void 0:n.access_token});return l?this._returnResult({data:null,error:l}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+o.expires_in},o)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",o),this._returnResult({data:o,error:l}))})}catch(s){if(A(s))return this._returnResult({data:null,error:s});throw s}})}async _challenge(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async s=>{var n;const{data:r,error:i}=s;if(i)return this._returnResult({data:null,error:i});const a=await C(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:e,headers:this.headers,jwt:(n=r==null?void 0:r.session)===null||n===void 0?void 0:n.access_token});if(a.error)return a;const{data:o}=a;if(o.type!=="webauthn")return{data:o,error:null};switch(o.webauthn.type){case"create":return{data:Object.assign(Object.assign({},o),{webauthn:Object.assign(Object.assign({},o.webauthn),{credential_options:Object.assign(Object.assign({},o.webauthn.credential_options),{publicKey:og(o.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},o),{webauthn:Object.assign(Object.assign({},o.webauthn),{credential_options:Object.assign(Object.assign({},o.webauthn.credential_options),{publicKey:lg(o.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(s){if(A(s))return this._returnResult({data:null,error:s});throw s}})}async _challengeAndVerify(e){const{data:s,error:n}=await this._challenge({factorId:e.factorId});return n?this._returnResult({data:null,error:n}):await this._verify({factorId:e.factorId,challengeId:s.id,code:e.code})}async _listFactors(){var e;const{data:{user:s},error:n}=await this.getUser();if(n)return{data:null,error:n};const r={all:[],phone:[],totp:[],webauthn:[]};for(const i of(e=s==null?void 0:s.factors)!==null&&e!==void 0?e:[])r.all.push(i),i.status==="verified"&&r[i.factor_type].push(i);return{data:r,error:null}}async _getAuthenticatorAssuranceLevel(){var e,s;const{data:{session:n},error:r}=await this.getSession();if(r)return this._returnResult({data:null,error:r});if(!n)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:i}=rn(n.access_token);let a=null;i.aal&&(a=i.aal);let o=a;((s=(e=n.user.factors)===null||e===void 0?void 0:e.filter(u=>u.status==="verified"))!==null&&s!==void 0?s:[]).length>0&&(o="aal2");const c=i.amr||[];return{data:{currentLevel:a,nextLevel:o,currentAuthenticationMethods:c},error:null}}async _getAuthorizationDetails(e){try{return await this._useSession(async s=>{const{data:{session:n},error:r}=s;return r?this._returnResult({data:null,error:r}):n?await C(this.fetch,"GET",`${this.url}/oauth/authorizations/${e}`,{headers:this.headers,jwt:n.access_token,xform:i=>({data:i,error:null})}):this._returnResult({data:null,error:new Z})})}catch(s){if(A(s))return this._returnResult({data:null,error:s});throw s}}async _approveAuthorization(e,s){try{return await this._useSession(async n=>{const{data:{session:r},error:i}=n;if(i)return this._returnResult({data:null,error:i});if(!r)return this._returnResult({data:null,error:new Z});const a=await C(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:r.access_token,body:{action:"approve"},xform:o=>({data:o,error:null})});return a.data&&a.data.redirect_url&&G()&&!(s!=null&&s.skipBrowserRedirect)&&window.location.assign(a.data.redirect_url),a})}catch(n){if(A(n))return this._returnResult({data:null,error:n});throw n}}async _denyAuthorization(e,s){try{return await this._useSession(async n=>{const{data:{session:r},error:i}=n;if(i)return this._returnResult({data:null,error:i});if(!r)return this._returnResult({data:null,error:new Z});const a=await C(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:r.access_token,body:{action:"deny"},xform:o=>({data:o,error:null})});return a.data&&a.data.redirect_url&&G()&&!(s!=null&&s.skipBrowserRedirect)&&window.location.assign(a.data.redirect_url),a})}catch(n){if(A(n))return this._returnResult({data:null,error:n});throw n}}async _listOAuthGrants(){try{return await this._useSession(async e=>{const{data:{session:s},error:n}=e;return n?this._returnResult({data:null,error:n}):s?await C(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:s.access_token,xform:r=>({data:r,error:null})}):this._returnResult({data:null,error:new Z})})}catch(e){if(A(e))return this._returnResult({data:null,error:e});throw e}}async _revokeOAuthGrant(e){try{return await this._useSession(async s=>{const{data:{session:n},error:r}=s;return r?this._returnResult({data:null,error:r}):n?(await C(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:n.access_token,query:{client_id:e.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new Z})})}catch(s){if(A(s))return this._returnResult({data:null,error:s});throw s}}async fetchJwk(e,s={keys:[]}){let n=s.keys.find(o=>o.kid===e);if(n)return n;const r=Date.now();if(n=this.jwks.keys.find(o=>o.kid===e),n&&this.jwks_cached_at+ym>r)return n;const{data:i,error:a}=await C(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(a)throw a;return!i.keys||i.keys.length===0||(this.jwks=i,this.jwks_cached_at=r,n=i.keys.find(o=>o.kid===e),!n)?null:n}async getClaims(e,s={}){try{let n=e;if(!n){const{data:f,error:m}=await this.getSession();if(m||!f.session)return this._returnResult({data:null,error:m});n=f.session.access_token}const{header:r,payload:i,signature:a,raw:{header:o,payload:l}}=rn(n);s!=null&&s.allowExpired||Vm(i.exp);const c=!r.alg||r.alg.startsWith("HS")||!r.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(r.kid,s!=null&&s.keys?{keys:s.keys}:s==null?void 0:s.jwks);if(!c){const{error:f}=await this.getUser(n);if(f)throw f;return{data:{claims:i,header:r,signature:a},error:null}}const u=Um(r.alg),h=await crypto.subtle.importKey("jwk",c,u,!0,["verify"]);if(!await crypto.subtle.verify(u,h,a,Am(`${o}.${l}`)))throw new Kn("Invalid JWT signature");return{data:{claims:i,header:r,signature:a},error:null}}catch(n){if(A(n))return this._returnResult({data:null,error:n});throw n}}}Ut.nextInstanceID={};const wg=Ut,bg="2.88.0";let Tt="";typeof Deno<"u"?Tt="deno":typeof document<"u"?Tt="web":typeof navigator<"u"&&navigator.product==="ReactNative"?Tt="react-native":Tt="node";const xg={"X-Client-Info":`supabase-js-${Tt}/${bg}`},_g={headers:xg},Sg={schema:"public"},Tg={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},kg={};function Ft(t){"@babel/helpers - typeof";return Ft=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ft(t)}function Eg(t,e){if(Ft(t)!="object"||!t)return t;var s=t[Symbol.toPrimitive];if(s!==void 0){var n=s.call(t,e||"default");if(Ft(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Ag(t){var e=Eg(t,"string");return Ft(e)=="symbol"?e:e+""}function Pg(t,e,s){return(e=Ag(e))in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}function xa(t,e){var s=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),s.push.apply(s,n)}return s}function B(t){for(var e=1;e<arguments.length;e++){var s=arguments[e]!=null?arguments[e]:{};e%2?xa(Object(s),!0).forEach(function(n){Pg(t,n,s[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(s)):xa(Object(s)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(s,n))})}return t}const Cg=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),Rg=()=>Headers,jg=(t,e,s)=>{const n=Cg(s),r=Rg();return async(i,a)=>{var o;const l=(o=await e())!==null&&o!==void 0?o:t;let c=new r(a==null?void 0:a.headers);return c.has("apikey")||c.set("apikey",t),c.has("Authorization")||c.set("Authorization",`Bearer ${l}`),n(i,B(B({},a),{},{headers:c}))}};function Og(t){return t.endsWith("/")?t:t+"/"}function Dg(t,e){var s,n;const{db:r,auth:i,realtime:a,global:o}=t,{db:l,auth:c,realtime:u,global:h}=e,d={db:B(B({},l),r),auth:B(B({},c),i),realtime:B(B({},u),a),storage:{},global:B(B(B({},h),o),{},{headers:B(B({},(s=h==null?void 0:h.headers)!==null&&s!==void 0?s:{}),(n=o==null?void 0:o.headers)!==null&&n!==void 0?n:{})}),accessToken:async()=>""};return t.accessToken?d.accessToken=t.accessToken:delete d.accessToken,d}function Ig(t){const e=t==null?void 0:t.trim();if(!e)throw new Error("supabaseUrl is required.");if(!e.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(Og(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var Ng=class extends wg{constructor(t){super(t)}},Mg=class{constructor(t,e,s){var n,r;this.supabaseUrl=t,this.supabaseKey=e;const i=Ig(t);if(!e)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",i),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",i),this.storageUrl=new URL("storage/v1",i),this.functionsUrl=new URL("functions/v1",i);const a=`sb-${i.hostname.split(".")[0]}-auth-token`,o={db:Sg,realtime:kg,auth:B(B({},Tg),{},{storageKey:a}),global:_g},l=Dg(s??{},o);if(this.storageKey=(n=l.auth.storageKey)!==null&&n!==void 0?n:"",this.headers=(r=l.global.headers)!==null&&r!==void 0?r:{},l.accessToken)this.accessToken=l.accessToken,this.auth=new Proxy({},{get:(u,h)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(h)} is not possible`)}});else{var c;this.auth=this._initSupabaseAuthClient((c=l.auth)!==null&&c!==void 0?c:{},this.headers,l.global.fetch)}this.fetch=jg(e,this._getAccessToken.bind(this),l.global.fetch),this.realtime=this._initRealtimeClient(B({headers:this.headers,accessToken:this._getAccessToken.bind(this)},l.realtime)),this.accessToken&&this.accessToken().then(u=>this.realtime.setAuth(u)).catch(u=>console.warn("Failed to set initial Realtime auth token:",u)),this.rest=new mp(new URL("rest/v1",i).href,{headers:this.headers,schema:l.db.schema,fetch:this.fetch}),this.storage=new dm(this.storageUrl.href,this.headers,this.fetch,s==null?void 0:s.storage),l.accessToken||this._listenForAuthEvents()}get functions(){return new up(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(t){return this.rest.from(t)}schema(t){return this.rest.schema(t)}rpc(t,e={},s={head:!1,get:!1,count:void 0}){return this.rest.rpc(t,e,s)}channel(t,e={config:{}}){return this.realtime.channel(t,e)}getChannels(){return this.realtime.getChannels()}removeChannel(t){return this.realtime.removeChannel(t)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var t=this,e,s;if(t.accessToken)return await t.accessToken();const{data:n}=await t.auth.getSession();return(e=(s=n.session)===null||s===void 0?void 0:s.access_token)!==null&&e!==void 0?e:t.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:t,persistSession:e,detectSessionInUrl:s,storage:n,userStorage:r,storageKey:i,flowType:a,lock:o,debug:l,throwOnError:c},u,h){const d={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new Ng({url:this.authUrl.href,headers:B(B({},d),u),storageKey:i,autoRefreshToken:t,persistSession:e,detectSessionInUrl:s,storage:n,userStorage:r,flowType:a,lock:o,debug:l,throwOnError:c,fetch:h,hasCustomAuthorizationHeader:Object.keys(this.headers).some(f=>f.toLowerCase()==="authorization")})}_initRealtimeClient(t){return new Op(this.realtimeUrl.href,B(B({},t),{},{params:B(B({},{apikey:this.supabaseKey}),t==null?void 0:t.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((t,e)=>{this._handleTokenChanged(t,"CLIENT",e==null?void 0:e.access_token)})}_handleTokenChanged(t,e,s){(t==="TOKEN_REFRESHED"||t==="SIGNED_IN")&&this.changedAccessToken!==s?(this.changedAccessToken=s,this.realtime.setAuth(s)):t==="SIGNED_OUT"&&(this.realtime.setAuth(),e=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};const $g=(t,e,s)=>new Mg(t,e,s);function Lg(){if(typeof window<"u"||typeof process>"u")return!1;const t=process.version;if(t==null)return!1;const e=t.match(/^v(\d+)\./);return e?parseInt(e[1],10)<=18:!1}Lg()&&console.warn("⚠️  Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217");const Bg="https://woqsriglllgyushlflxh.supabase.co",Vg="sb_publishable_HDPOzEpyVotVL_y52W_6XA_lmgomhSu",Ne=$g(Bg,Vg,{auth:{storage:localStorage,persistSession:!0,autoRefreshToken:!0}}),qt="id, slug, title, excerpt, category, tags, author_name, author_photo_url, published_at, read_time, featured_image_url, featured_image_alt";function Ug(){return vt({queryKey:["blog_posts"],queryFn:async()=>{const{data:t,error:e}=await Ne.from("blog_posts").select(qt).eq("is_published",!0).order("published_at",{ascending:!1});if(e)throw new Error(e.message);return(t??[]).map(s=>({...s,tags:s.tags??[]}))},staleTime:1e3*60*5})}function Dy({page:t,pageSize:e=9,tag:s,search:n,sortOrder:r="newest"}){return vt({queryKey:["blog_posts_paginated",t,e,s,n,r],queryFn:async()=>{const i=(t-1)*e,a=i+e-1;let o=Ne.from("blog_posts").select(qt,{count:"exact"}).eq("is_published",!0);if(r==="oldest"?o=o.order("published_at",{ascending:!0}):r==="a-z"?o=o.order("title",{ascending:!0}):o=o.order("published_at",{ascending:!1}),s&&(o=o.contains("tags",[s])),n!=null&&n.trim()){const d=n.trim();o=o.or(`title.ilike.%${d}%,excerpt.ilike.%${d}%,author_name.ilike.%${d}%`)}o=o.range(i,a);const{data:l,error:c,count:u}=await o;if(c)throw new Error(c.message);const h=u??0;return{posts:(l??[]).map(d=>({...d,tags:d.tags??[]})),total:h,totalPages:Math.ceil(h/e)}},staleTime:1e3*60*5})}function Iy(){return vt({queryKey:["blog_tags"],queryFn:async()=>{const{data:t,error:e}=await Ne.from("blog_posts").select("tags").eq("is_published",!0);if(e)throw new Error(e.message);const s=new Set;return(t??[]).forEach(n=>(n.tags??[]).forEach(r=>s.add(r))),Array.from(s).sort()},staleTime:1e3*60*10})}function Ny(t){return vt({queryKey:["blog_posts",t],enabled:!!t,queryFn:async()=>{const{data:e,error:s}=await Ne.from("blog_posts").select("*").eq("slug",t).eq("is_published",!0).maybeSingle();if(s)throw new Error(s.message);if(!e)throw new Error("Post not found");return{...e,tags:e.tags??[]}},retry:!1,staleTime:1e3*60*5})}function My(t,e,s=3){return vt({queryKey:["blog_posts","related",t,e],enabled:!!t&&!!e,queryFn:async()=>{const{data:n,error:r}=await Ne.from("blog_posts").select(qt).eq("is_published",!0).eq("category",t).neq("slug",e).order("published_at",{ascending:!1}).limit(s);if(r)throw new Error(r.message);const i=(n??[]).map(a=>({...a,tags:a.tags??[]}));if(i.length<s){const{data:a}=await Ne.from("blog_posts").select(qt).eq("is_published",!0).neq("slug",e).order("published_at",{ascending:!1}).limit(s),o=new Set(i.map(c=>c.slug));return[...i,...(a??[]).map(c=>({...c,tags:c.tags??[]})).filter(c=>!o.has(c.slug))].slice(0,s)}return i},staleTime:1e3*60*5})}function $y(t,e=3){return vt({queryKey:["blog_posts","by_tags",t,e],enabled:t.length>0,queryFn:async()=>{const{data:s,error:n}=await Ne.from("blog_posts").select(qt).eq("is_published",!0).overlaps("tags",t).order("published_at",{ascending:!1}).limit(e);if(n)throw new Error(n.message);return(s??[]).map(r=>({...r,tags:r.tags??[]}))},staleTime:1e3*60*5})}const Fg=[{title:"Home",desc:"Contemporary Psychology — Melbourne psychologists",href:"/"},{title:"Book Online",desc:"Request an appointment or enquire",href:"/book-online"},{title:"Contact",desc:"Get in touch with our team",href:"/contact"},{title:"Our Team",desc:"Meet our psychologists",href:"/our-team"},{title:"Services",desc:"What we offer",href:"/services"},{title:"What We Help With",desc:"Presentations and conditions we support",href:"/what-we-help-with"},{title:"Pricing & Fees",desc:"Session costs and Medicare rebates",href:"/book-online#pricing"},{title:"FAQs",desc:"Common questions about getting started",href:"/faq"},{title:"Resources",desc:"Articles, guides and tools",href:"/resources"},{title:"Individual Therapy",desc:"One-on-one psychological support",href:"/services/psychology"},{title:"Couples Counselling",desc:"Gottman Method couples therapy",href:"/services/couples-counselling"},{title:"ADHD Assessment",desc:"Comprehensive ADHD assessment for adults",href:"/services/adhd-assessment"},{title:"ASD Assessment",desc:"Autism spectrum assessment for adults",href:"/services/autism-assessment"},{title:"Mental Health Assessment",desc:"Psychological and neuropsychological assessment",href:"/services/mental-health-assessment"},{title:"Coaching",desc:"Psychology-informed coaching for professionals",href:"/services/coaching"},{title:"WorkCover & TAC",desc:"Funded psychology for workplace and transport injuries",href:"/services/workcover-tac"},{title:"Online Counselling",desc:"Telehealth psychology across Australia",href:"/services/online-counselling"},{title:"Adolescent Psychology",desc:"Support for young people aged 13–17",href:"/services/adolescent-psychology"},{title:"Anxiety",desc:"Help with anxiety, worry, panic and phobias",href:"/what-we-help-with/anxiety"},{title:"Depression",desc:"Support for depression and low mood",href:"/what-we-help-with/depression"},{title:"Trauma & PTSD",desc:"Trauma-informed treatment",href:"/what-we-help-with/trauma-and-acute-stress"},{title:"ADHD & Impulsivity",desc:"Understanding and managing ADHD",href:"/what-we-help-with/adhd"},{title:"Addictions",desc:"Support for substance use and behavioural addictions",href:"/what-we-help-with/addictions"},{title:"Sleep Disturbance",desc:"CBT-I and sleep therapy",href:"/what-we-help-with/sleep-disturbance"},{title:"Work Issues & Burnout",desc:"Burnout, workplace stress and career challenges",href:"/what-we-help-with/work-issues-burnout"},{title:"LGBTIQA+ Counselling",desc:"Affirming psychological support",href:"/what-we-help-with/lgbtiqa-counselling"},{title:"Relationships & Attachment",desc:"Relationship difficulties and attachment patterns",href:"/what-we-help-with/relationships-and-attachment"},{title:"Disordered Eating",desc:"Support for eating and body image concerns",href:"/what-we-help-with/disordered-eating"},{title:"Autism Support",desc:"Neuroaffirming support for autistic adults",href:"/what-we-help-with/autism"}];function qg(t){const e=[];return Fg.forEach(s=>e.push({type:"page",title:s.title,subtitle:s.desc,href:s.href})),ip.filter(s=>s.isPsychologist).forEach(s=>{var n;return e.push({type:"team",title:s.name,subtitle:s.title+((n=s.tags)!=null&&n.length?" · "+s.tags.slice(0,3).join(", "):""),href:`/our-team/${s.slug}`})}),t.forEach(s=>{var n;return e.push({type:"blog",title:s.title,subtitle:((n=s.excerpt)==null?void 0:n.slice(0,80))+"…",href:`/${s.slug}`})}),ap.forEach(s=>{var n;return e.push({type:"faq",title:s.question,subtitle:((n=s.answer)==null?void 0:n.slice(0,80))+"…",href:"/faq"})}),e}const Wg={page:"Page",team:"Team",blog:"Article",faq:"FAQ"},Hg={page:ec,team:ic,blog:Ql,faq:Zl},ln=["page","team","blog","faq"],Kg=[{id:"all",label:"All"},{id:"page",label:"Pages"},{id:"team",label:"Team"},{id:"blog",label:"Articles"},{id:"faq",label:"FAQs"}];function Gg(t,e,s){if(!e.trim())return[];const n=e.toLowerCase();return t.filter(r=>s!=="all"&&r.type!==s?!1:r.title.toLowerCase().includes(n)||r.subtitle.toLowerCase().includes(n)).slice(0,20)}function zg(){const t=Jn(),[e,s]=_.useState(!1),[n,r]=_.useState(""),[i,a]=_.useState("all"),[o,l]=_.useState(0),c=_.useRef(null),u=Kl(),{data:h}=Ug(),d=_.useMemo(()=>qg(h??[]),[h]),f=Gg(d,n,i),m=ln.reduce((b,S)=>{const T=f.filter(j=>j.type===S);return T.length&&(b[S]=T),b},{}),y=ln.flatMap(b=>m[b]??[]),g=_.useCallback(()=>{s(!1),r(""),a("all"),l(0)},[]),v=_.useCallback((b,S)=>{n.trim()&&(t==null||t.capture("site_search_performed",{query:n.trim(),result_count:f.length,selected_result_type:S==null?void 0:S.type})),g(),u(b)},[g,u,t,n,f.length]);_.useEffect(()=>{const b=S=>{(S.metaKey||S.ctrlKey)&&S.key==="k"&&(S.preventDefault(),s(T=>!T)),S.key==="Escape"&&g()};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[g]),_.useEffect(()=>{e&&setTimeout(()=>{var b;return(b=c.current)==null?void 0:b.focus()},50)},[e]),_.useEffect(()=>{l(0)},[n,i]);function x(b){b.key==="ArrowDown"?(b.preventDefault(),l(S=>Math.min(S+1,y.length-1))):b.key==="ArrowUp"?(b.preventDefault(),l(S=>Math.max(S-1,0))):b.key==="Enter"&&y[o]&&v(y[o].href,y[o])}let w=0;return p.jsxs(p.Fragment,{children:[p.jsx("button",{onClick:()=>s(!0),"aria-label":"Search",className:"hidden md:flex items-center justify-center w-9 h-9 rounded-full text-[#3D3D5C] hover:text-brand-pink hover:bg-surface-pink transition-colors",children:p.jsx(Dr,{className:"h-4 w-4"})}),Hl.createPortal(p.jsx(Dn,{children:e&&p.jsxs(Ce.div,{className:"fixed inset-0 z-[200] flex items-center justify-center px-4",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[p.jsx("div",{className:"absolute inset-0 bg-[#071B27]/50 backdrop-blur-sm",onClick:g}),p.jsxs(Ce.div,{className:"relative w-full max-w-xl bg-white rounded-2xl shadow-2xl overflow-hidden border border-cp-rule",initial:{opacity:0,scale:.95,y:-12},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-12},transition:{type:"spring",damping:28,stiffness:350},children:[p.jsxs("div",{className:"flex items-center gap-3 px-4 py-3.5 border-b border-cp-rule",children:[p.jsx(Dr,{className:"h-4 w-4 text-cp-muted flex-shrink-0"}),p.jsx("input",{ref:c,value:n,onChange:b=>r(b.target.value),onKeyDown:x,placeholder:"Search pages, team, articles, FAQs…",className:"flex-1 text-sm font-poppins text-[#071B27] placeholder:text-cp-muted outline-none bg-transparent"}),n&&p.jsx("button",{onClick:()=>r(""),className:"text-cp-muted hover:text-cp-body transition-colors",children:p.jsx(ps,{className:"h-4 w-4"})}),p.jsx("kbd",{className:"hidden sm:inline-flex items-center text-[10px] font-poppins text-cp-muted border border-cp-rule rounded px-1.5 py-0.5",children:"ESC"})]}),p.jsx("div",{className:"flex items-center gap-1.5 px-4 py-2.5 border-b border-cp-rule overflow-x-auto",children:Kg.map(b=>p.jsx("button",{onClick:()=>a(b.id),className:`flex-shrink-0 rounded-full px-3 py-1 text-xs font-medium font-poppins transition-colors ${i===b.id?"bg-brand-pink text-white":"bg-surface-warm text-cp-muted hover:text-cp-body hover:bg-surface-pink"}`,children:b.label},b.id))}),p.jsxs("div",{className:"max-h-[55vh] overflow-y-auto",children:[!n&&p.jsx("p",{className:"text-xs text-cp-muted font-poppins text-center py-8",children:"Start typing to search…"}),n&&f.length===0&&p.jsxs("p",{className:"text-xs text-cp-muted font-poppins text-center py-8",children:['No results for "',n,'"']}),ln.map(b=>{const S=m[b];return S?p.jsxs("div",{children:[p.jsx("p",{className:"text-[10px] font-bold font-poppins tracking-widest text-cp-muted uppercase px-4 pt-4 pb-1.5",children:Wg[b]}),S.map(T=>{const j=Hg[T.type],E=y[o]===T,O=w++;return p.jsxs("button",{onClick:()=>v(T.href,T),onMouseEnter:()=>l(O),className:`w-full flex items-center gap-3 px-4 py-2.5 text-left transition-colors ${E?"bg-surface-pink":"hover:bg-surface-warm"}`,children:[p.jsx("div",{className:`w-7 h-7 rounded-lg flex items-center justify-center flex-shrink-0 transition-colors border ${E?"bg-brand-pink border-brand-pink":"bg-surface-warm border-cp-rule"}`,children:p.jsx(j,{className:`h-3.5 w-3.5 transition-colors ${E?"text-white":"text-cp-muted"}`})}),p.jsxs("div",{className:"min-w-0",children:[p.jsx("p",{className:`text-sm font-semibold font-poppins truncate transition-colors ${E?"text-brand-pink":"text-[#071B27]"}`,children:T.title}),p.jsx("p",{className:"text-xs text-cp-muted font-poppins leading-snug line-clamp-1",children:T.subtitle})]})]},T.href+T.title)})]},b):null})]}),f.length>0&&p.jsxs("div",{className:"flex items-center justify-between border-t border-cp-rule px-4 py-2.5",children:[p.jsxs("span",{className:"text-[10px] text-cp-muted font-poppins",children:[f.length," result",f.length!==1?"s":""]}),p.jsxs("div",{className:"flex items-center gap-3 text-[10px] text-cp-muted font-poppins",children:[p.jsxs("span",{className:"flex items-center gap-1",children:[p.jsx("kbd",{className:"border border-cp-rule rounded px-1 py-0.5 text-[9px]",children:"↑"}),p.jsx("kbd",{className:"border border-cp-rule rounded px-1 py-0.5 text-[9px]",children:"↓"}),"navigate"]}),p.jsxs("span",{className:"flex items-center gap-1",children:[p.jsx("kbd",{className:"border border-cp-rule rounded px-1 py-0.5 text-[9px]",children:"↵"}),"open"]})]})]})]})]})}),document.body)]})}const ft="/assets/logo-C1kM2SaN.png";var jl={exports:{}},Ol={};/**
 * @license React
 * use-sync-external-store-shim.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var yt=_;function Jg(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var Yg=typeof Object.is=="function"?Object.is:Jg,Xg=yt.useState,Qg=yt.useEffect,Zg=yt.useLayoutEffect,ey=yt.useDebugValue;function ty(t,e){var s=e(),n=Xg({inst:{value:s,getSnapshot:e}}),r=n[0].inst,i=n[1];return Zg(function(){r.value=s,r.getSnapshot=e,cn(r)&&i({inst:r})},[t,s,e]),Qg(function(){return cn(r)&&i({inst:r}),t(function(){cn(r)&&i({inst:r})})},[t]),ey(s),s}function cn(t){var e=t.getSnapshot;t=t.value;try{var s=e();return!Yg(t,s)}catch{return!0}}function sy(t,e){return e()}var ny=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?sy:ty;Ol.useSyncExternalStore=yt.useSyncExternalStore!==void 0?yt.useSyncExternalStore:ny;jl.exports=Ol;var ry=jl.exports;function iy(){return ry.useSyncExternalStore(ay,()=>!0,()=>!1)}function ay(){return()=>{}}var Rr="Avatar",[oy,Ly]=zl(Rr),[ly,Dl]=oy(Rr),Il=_.forwardRef((t,e)=>{const{__scopeAvatar:s,...n}=t,[r,i]=_.useState("idle");return p.jsx(ly,{scope:s,imageLoadingStatus:r,onImageLoadingStatusChange:i,children:p.jsx(Yn.span,{...n,ref:e})})});Il.displayName=Rr;var Nl="AvatarImage",Ml=_.forwardRef((t,e)=>{const{__scopeAvatar:s,src:n,onLoadingStatusChange:r=()=>{},...i}=t,a=Dl(Nl,s),o=cy(n,i),l=Jl(c=>{r(c),a.onImageLoadingStatusChange(c)});return un(()=>{o!=="idle"&&l(o)},[o,l]),o==="loaded"?p.jsx(Yn.img,{...i,ref:e,src:n}):null});Ml.displayName=Nl;var $l="AvatarFallback",Ll=_.forwardRef((t,e)=>{const{__scopeAvatar:s,delayMs:n,...r}=t,i=Dl($l,s),[a,o]=_.useState(n===void 0);return _.useEffect(()=>{if(n!==void 0){const l=window.setTimeout(()=>o(!0),n);return()=>window.clearTimeout(l)}},[n]),a&&i.imageLoadingStatus!=="loaded"?p.jsx(Yn.span,{...r,ref:e}):null});Ll.displayName=$l;function _a(t,e){return t?e?(t.src!==e&&(t.src=e),t.complete&&t.naturalWidth>0?"loaded":"loading"):"error":"idle"}function cy(t,{referrerPolicy:e,crossOrigin:s}){const n=iy(),r=_.useRef(null),i=n?(r.current||(r.current=new window.Image),r.current):null,[a,o]=_.useState(()=>_a(i,t));return un(()=>{o(_a(i,t))},[i,t]),un(()=>{const l=h=>()=>{o(h)};if(!i)return;const c=l("loaded"),u=l("error");return i.addEventListener("load",c),i.addEventListener("error",u),e&&(i.referrerPolicy=e),typeof s=="string"&&(i.crossOrigin=s),()=>{i.removeEventListener("load",c),i.removeEventListener("error",u)}},[i,s,e]),a}var Bl=Il,Vl=Ml,Ul=Ll;const jt=_.forwardRef(({className:t,...e},s)=>p.jsx(Bl,{ref:s,className:ze("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",t),...e}));jt.displayName=Bl.displayName;const uy=_.forwardRef(({className:t,...e},s)=>p.jsx(Vl,{ref:s,className:ze("aspect-square h-full w-full",t),...e}));uy.displayName=Vl.displayName;const Ot=_.forwardRef(({className:t,...e},s)=>p.jsx(Ul,{ref:s,className:ze("flex h-full w-full items-center justify-center rounded-full bg-muted",t),...e}));Ot.displayName=Ul.displayName;const hy=Yl("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),Gn=_.forwardRef(({className:t,variant:e,size:s,asChild:n=!1,...r},i)=>{const a=n?Xl:"button";return p.jsx(a,{className:ze(hy({variant:e,size:s,className:t})),ref:i,...r})});Gn.displayName="Button";const Se="#F2506A",ge="#B67AEC",Sa="#27BBE9",dy={hidden:{opacity:0,y:20,scale:.95,transformOrigin:"bottom right"},visible:{opacity:1,y:0,scale:1,transition:{type:"spring",damping:25,stiffness:300}},exit:{opacity:0,y:20,scale:.95,transition:{duration:.18}}},Ta={hidden:{opacity:0,y:8},visible:{opacity:1,y:0,transition:{type:"spring",stiffness:500,damping:30}}};function fy(){return p.jsxs("div",{className:"flex gap-3",children:[p.jsx(jt,{className:"h-7 w-7 flex-shrink-0",children:p.jsx(Ot,{style:{background:`linear-gradient(135deg, ${Se}, ${ge})`},children:p.jsx("img",{src:ft,alt:"CP",className:"h-4 w-4 object-contain"})})}),p.jsx("div",{className:"rounded-2xl rounded-tl-none bg-white/10 border border-white/10 px-4 py-3 flex items-center gap-1",children:["-0.3s","-0.15s","0s"].map((t,e)=>p.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-white/50 animate-bounce",style:{animationDelay:t}},e))})]})}const py=/(https?:\/\/[^\s]+|[\w.+-]+@[\w-]+\.[a-z]{2,}|(?:(?:\+61|0)[0-9][\s0-9]{7,10}))/gi;function my(t){return t.split(py).map((s,n)=>{if(/^https?:\/\//i.test(s)){const r=s.replace(/^https?:\/\/(www\.)?/,"").replace(/\/$/,"");return p.jsx("a",{href:s,target:"_blank",rel:"noopener noreferrer",className:"underline underline-offset-2 opacity-80 hover:opacity-100 break-all",children:r},n)}return/^[\w.+-]+@[\w-]+\.[a-z]{2,}$/i.test(s)?p.jsx("a",{href:`mailto:${s}`,className:"underline underline-offset-2 opacity-80 hover:opacity-100",children:s},n):/^(?:\+61|0)[0-9][\s0-9]{7,10}$/.test(s.trim())?p.jsx("a",{href:`tel:${s.replace(/\s/g,"")}`,className:"underline underline-offset-2 opacity-80 hover:opacity-100",children:s},n):s})}function gy(){const t=Jn(),e=_.useRef(!1),[s,n]=_.useState(!1),[r,i]=_.useState([]),[a,o]=_.useState(""),[l,c]=_.useState(!1),[u,h]=_.useState(null),d=_.useRef(null),f=_.useRef(null);_.useEffect(()=>{d.current&&(d.current.scrollTop=d.current.scrollHeight)},[r,l]),_.useEffect(()=>{s&&setTimeout(()=>{var g;return(g=f.current)==null?void 0:g.focus()},300)},[s]);const m=_.useCallback(()=>{n(g=>{const v=!g;return v&&!e.current&&(e.current=!0,t==null||t.capture("chat_widget_opened")),v})},[t]),y=async g=>{g.preventDefault();const v=a.trim();if(!v||l)return;const x={role:"user",content:v},w=[...r,x];i(w),o(""),c(!0),h(null);try{const{data:b,error:S}=await Ne.functions.invoke("chat-bot",{body:{messages:w}});if(S)throw console.error("[chat-bot] function error:",S),S;if(!(b!=null&&b.reply))throw console.error("[chat-bot] unexpected response:",b),new Error("No reply in response");i(T=>[...T,{role:"assistant",content:b.reply}])}catch(b){console.error("[chat-bot] catch:",b),h("Sorry, I couldn't connect right now. Please call us on 03 9081 4270.")}finally{c(!1)}};return p.jsxs("div",{className:"fixed bottom-6 right-6 z-50 flex flex-col items-end gap-4",children:[p.jsx(Dn,{children:s&&p.jsxs(Ce.div,{variants:dy,initial:"hidden",animate:"visible",exit:"exit",className:"w-[360px] sm:w-[400px] overflow-hidden rounded-2xl shadow-2xl",style:{background:"rgba(26,26,46,0.96)",border:"1px solid rgba(255,255,255,0.10)",backdropFilter:"blur(24px)",WebkitBackdropFilter:"blur(24px)"},children:[p.jsxs("div",{className:"relative p-4 flex items-center justify-between overflow-hidden",style:{borderBottom:"1px solid rgba(255,255,255,0.08)"},children:[p.jsx("div",{className:"absolute left-0 top-0 bottom-0 w-[4px]",style:{background:`linear-gradient(to bottom, ${Se}, ${ge}, ${Sa})`}}),p.jsx("div",{className:"absolute inset-0 pointer-events-none",style:{background:"radial-gradient(ellipse at 30% 50%, rgba(242,80,106,0.08) 0%, transparent 60%)"}}),p.jsxs("div",{className:"flex items-center gap-3 pl-3 relative z-10",children:[p.jsxs("div",{className:"relative",children:[p.jsx("div",{className:"h-10 w-10 rounded-xl flex items-center justify-center overflow-hidden",style:{background:`linear-gradient(135deg, ${Se}, ${ge})`},children:p.jsx("img",{src:ft,alt:"CP",className:"h-7 w-7 object-contain"})}),p.jsx("span",{className:"absolute -bottom-0.5 -right-0.5 h-3 w-3 rounded-full bg-emerald-500 border-2 border-[#1A1A2E]"})]}),p.jsxs("div",{children:[p.jsx("p",{className:"text-sm font-semibold text-white leading-tight",children:"Contemporary Psychology"}),p.jsx("p",{className:"text-[11px] text-white/50",children:"Ask me anything about our services"})]})]}),p.jsx(Gn,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-full relative z-10 hover:bg-white/10 text-white/60 hover:text-white",onClick:()=>n(!1),children:p.jsx(ps,{className:"h-4 w-4"})})]}),p.jsxs("div",{ref:d,className:"flex flex-col gap-4 overflow-y-auto p-4",style:{height:340},children:[p.jsxs(Ce.div,{variants:Ta,initial:"hidden",animate:"visible",className:"flex gap-3",children:[p.jsx(jt,{className:"h-7 w-7 flex-shrink-0",children:p.jsx(Ot,{style:{background:`linear-gradient(135deg, ${Se}, ${ge})`},children:p.jsx("img",{src:ft,alt:"CP",className:"h-4 w-4 object-contain"})})}),p.jsxs("div",{className:"flex flex-col gap-1 max-w-[85%]",children:[p.jsx("span",{className:"text-[11px] font-medium text-white/40",children:"CP Assistant"}),p.jsx("div",{className:"rounded-2xl rounded-tl-none px-4 py-2.5 text-sm text-white/90 leading-relaxed",style:{background:"rgba(255,255,255,0.07)",border:"1px solid rgba(255,255,255,0.08)"},children:"Hi! I'm here to help with questions about our services, fees, team, and how to get started. What can I help you with?"})]})]}),r.map((g,v)=>p.jsxs(Ce.div,{variants:Ta,initial:"hidden",animate:"visible",className:ze("flex gap-3",g.role==="user"&&"flex-row-reverse"),children:[g.role==="assistant"?p.jsx(jt,{className:"h-7 w-7 flex-shrink-0",children:p.jsx(Ot,{style:{background:`linear-gradient(135deg, ${Se}, ${ge})`},children:p.jsx("img",{src:ft,alt:"CP",className:"h-4 w-4 object-contain"})})}):p.jsx(jt,{className:"h-7 w-7 flex-shrink-0",children:p.jsx(Ot,{style:{background:`linear-gradient(135deg, ${Sa}, ${ge})`},children:p.jsx("span",{className:"text-[10px] font-bold text-white",children:"You"})})}),p.jsxs("div",{className:ze("flex flex-col gap-1 max-w-[85%]",g.role==="user"&&"items-end"),children:[g.role==="assistant"&&p.jsx("span",{className:"text-[11px] font-medium text-white/40",children:"CP Assistant"}),p.jsx("div",{className:ze("px-4 py-2.5 text-sm leading-relaxed break-words",g.role==="assistant"?"rounded-2xl rounded-tl-none text-white/90":"rounded-2xl rounded-tr-none text-white"),style:g.role==="assistant"?{background:"rgba(255,255,255,0.07)",border:"1px solid rgba(255,255,255,0.08)",whiteSpace:"pre-wrap"}:{background:`linear-gradient(135deg, ${Se}, ${ge})`,whiteSpace:"pre-wrap"},children:my(g.content)})]})]},v)),l&&p.jsx(fy,{}),u&&p.jsx("div",{className:"text-xs text-red-400/80 text-center px-4",children:u})]}),p.jsxs("form",{onSubmit:y,className:"flex items-center gap-2 p-3",style:{borderTop:"1px solid rgba(255,255,255,0.08)",background:"rgba(255,255,255,0.03)"},children:[p.jsx("input",{ref:f,type:"text",value:a,onChange:g=>o(g.target.value),placeholder:"Ask about services, fees, booking…",disabled:l,className:"flex-1 rounded-full px-4 py-2.5 text-sm text-white placeholder:text-white/30 outline-none transition-all disabled:opacity-50",style:{background:"rgba(255,255,255,0.06)",border:"1px solid rgba(255,255,255,0.10)"},onFocus:g=>g.currentTarget.style.borderColor="rgba(242,80,106,0.5)",onBlur:g=>g.currentTarget.style.borderColor="rgba(255,255,255,0.10)"}),p.jsx(Gn,{type:"submit",size:"icon",disabled:!a.trim()||l,className:"h-10 w-10 rounded-full flex-shrink-0 disabled:opacity-40 transition-transform hover:scale-105",style:{background:`linear-gradient(135deg, ${Se}, ${ge})`},children:p.jsx(rc,{className:"h-4 w-4 text-white"})})]}),p.jsxs("p",{className:"text-center text-[10px] text-white/20 pb-2.5 px-4",children:["Not medical advice · For clinical support, please"," ",p.jsx("a",{href:"tel:0390814270",className:"underline hover:text-white/40 transition-colors",children:"call us"})]})]},"chat-window")}),p.jsxs(Ce.button,{whileHover:{scale:1.06},whileTap:{scale:.94},onClick:m,className:"relative group flex h-14 w-14 items-center justify-center rounded-full shadow-2xl cursor-pointer transition-all duration-300",style:{background:s?"#6B7280":`linear-gradient(135deg, ${Se}, ${ge})`},"aria-label":s?"Close chat":"Open chat",children:[p.jsx("span",{className:"absolute inset-0 -z-10 rounded-full opacity-30 blur-xl transition-opacity group-hover:opacity-50",style:{background:`linear-gradient(135deg, ${Se}, ${ge})`}}),p.jsx(Dn,{mode:"wait",children:s?p.jsx(Ce.span,{initial:{rotate:-90,opacity:0},animate:{rotate:0,opacity:1},exit:{rotate:90,opacity:0},transition:{duration:.18},children:p.jsx(ps,{className:"h-6 w-6 text-white"})},"close"):p.jsx(Ce.span,{initial:{rotate:90,opacity:0},animate:{rotate:0,opacity:1},exit:{rotate:-90,opacity:0},transition:{duration:.18},children:p.jsx(nc,{className:"h-6 w-6 text-white"})},"open")})]})]})}const zn="/book-online",yy="https://clientportal.zandahealth.com/clientportal/contemporarypsychology",Ee="03 9081 4270",is="reception@contemporarypsychology.com.au",vy="G06-G07/22 St Kilda Road, St Kilda VIC 3182",ka=[{label:"LinkedIn",href:"https://www.linkedin.com/company/contemporary-psychology/posts/?feedView=all",icon:p.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:"h-4 w-4","aria-hidden":"true",children:p.jsx("path",{d:"M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433a2.062 2.062 0 0 1-2.063-2.065 2.064 2.064 0 1 1 2.063 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z"})})},{label:"Instagram",href:"https://www.instagram.com/contemporarypsychology/",icon:p.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:"h-4 w-4","aria-hidden":"true",children:p.jsx("path",{d:"M12 2.163c3.204 0 3.584.012 4.85.07 3.252.148 4.771 1.691 4.919 4.919.058 1.265.069 1.645.069 4.849 0 3.205-.012 3.584-.069 4.849-.149 3.225-1.664 4.771-4.919 4.919-1.266.058-1.644.07-4.85.07-3.204 0-3.584-.012-4.849-.07-3.26-.149-4.771-1.699-4.919-4.92-.058-1.265-.07-1.644-.07-4.849 0-3.204.013-3.583.07-4.849.149-3.227 1.664-4.771 4.919-4.919 1.266-.057 1.645-.069 4.849-.069zm0-2.163c-3.259 0-3.667.014-4.947.072-4.358.2-6.78 2.618-6.98 6.98-.059 1.281-.073 1.689-.073 4.948 0 3.259.014 3.668.072 4.948.2 4.358 2.618 6.78 6.98 6.98 1.281.058 1.689.072 4.948.072 3.259 0 3.668-.014 4.948-.072 4.354-.2 6.782-2.618 6.979-6.98.059-1.28.073-1.689.073-4.948 0-3.259-.014-3.667-.072-4.947-.196-4.354-2.617-6.78-6.979-6.98-1.281-.059-1.69-.073-4.949-.073zm0 5.838a6.162 6.162 0 1 0 0 12.324 6.162 6.162 0 0 0 0-12.324zM12 16a4 4 0 1 1 0-8 4 4 0 0 1 0 8zm6.406-11.845a1.44 1.44 0 1 0 0 2.881 1.44 1.44 0 0 0 0-2.881z"})})},{label:"Facebook",href:"https://www.facebook.com/contemporarypsychology.com.au",icon:p.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:"h-4 w-4","aria-hidden":"true",children:p.jsx("path",{d:"M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z"})})}],Ea=[{label:"About Us",href:"/about-us",children:[{label:"Meet the Team",href:"/our-team"},{label:"Join Our Team",href:"/our-team/join-our-team"}]},{label:"What We Help With",href:"/what-we-help-with",wide:!0,children:[{label:"ADHD & Impulsivity",href:"/what-we-help-with/adhd"},{label:"Addictions",href:"/what-we-help-with/addictions"},{label:"Anxiety Disorders",href:"/what-we-help-with/anxiety-disorders"},{label:"Attachment & Relationships",href:"/what-we-help-with/attachment-relationships"},{label:"Autism",href:"/what-we-help-with/autism"},{label:"Depression",href:"/what-we-help-with/depression"},{label:"Disordered Eating & Body Image",href:"/what-we-help-with/disordered-eating-body-image"},{label:"LGBTIQA+ Counselling",href:"/what-we-help-with/lgbtiqa-counselling"},{label:"PMDD, PCOS & Menopause",href:"/what-we-help-with/pmdd-pcos-menopause"},{label:"Postnatal Depression & Anxiety",href:"/what-we-help-with/postnatal-depression-and-anxiety"},{label:"Sleep Disturbance",href:"/what-we-help-with/sleep-disturbance"},{label:"Trauma & Acute Stress",href:"/what-we-help-with/trauma-and-acute-stress"},{label:"Work Issues & Burnout",href:"/what-we-help-with/work-issues-burnout"}]},{label:"Services",href:"/services",children:[{label:"Psychological Counselling",href:"/services/psychology"},{label:"Online Counselling",href:"/services/online-counselling"},{label:"Mental Health Assessment",href:"/services/mental-health-assessment"},{label:"ADHD Assessment & Coaching",href:"/services/adhd-assessment-and-coaching-program"},{label:"ASD Assessments",href:"/services/asd-assessments"},{label:"Autism Support & Growth Program",href:"/services/autism-support-program"},{label:"Adolescent Psychology",href:"/services/adolescent-psychology"},{label:"Couples Counselling",href:"/services/couples-counselling"},{label:"WorkCover & TAC",href:"/services/workcover-tac"},{label:"For GPs & Referrers",href:"/for-gps"}]},{label:"Pricing & Rebates",href:"/pricing-rebates"},{label:"Contact",href:"/contact"},{label:"More",href:"#",children:[{label:"Blog",href:"/blog"},{label:"FAQ",href:"/faq"},{label:"Resources",href:"/resources"},{label:"For GPs",href:"/for-gps"}]}],wy=[{label:"ADHD Assessment & Coaching",href:"/services/adhd-assessment-and-coaching-program"},{label:"ASD Assessments",href:"/services/asd-assessments"},{label:"Individual Therapy",href:"/services/psychology"},{label:"Couples Counselling",href:"/services/couples-counselling"},{label:"WorkCover & TAC",href:"/services/workcover-tac"}],by=[{label:"About Us",href:"/about-us"},{label:"Our Team",href:"/our-team"},{label:"Join Our Team",href:"/our-team/join-our-team"},{label:"Resources",href:"/resources"},{label:"Blog",href:"/blog"},{label:"FAQ",href:"/faq"}],xy=[{label:"Book Online",href:zn},{label:"Pricing & Rebates",href:"/pricing-rebates"},{label:"For GPs & Referring Practitioners",href:"/for-gps"},{label:"Contact Us",href:"/contact"},{label:"Privacy Policy",href:"/privacy-policy"}],_y=[[5,28],[12,18],[8,42],[18,32],[15,50],[22,24],[25,42],[10,60],[20,65],[28,55],[35,35],[40,50],[45,28],[42,65],[48,42],[50,20],[55,58],[62,30],[68,20],[72,42],[65,52],[75,35],[80,52],[78,22],[85,40],[88,28],[90,52],[82,62],[5,75],[15,80],[28,80],[38,75],[50,80],[62,75],[75,78],[88,70],[95,46],[95,22],[5,10],[20,8],[40,10],[60,10],[80,8],[93,12]],Fl=1400,ql=600,ce=_y.map(([t,e])=>[t/100*Fl,e/100*ql]),Sy=(()=>{const e=[];for(let s=0;s<ce.length;s++)for(let n=s+1;n<ce.length;n++){const r=ce[s][0]-ce[n][0],i=ce[s][1]-ce[n][1];r*r+i*i<21025&&e.push([ce[s][0],ce[s][1],ce[n][0],ce[n][1]])}return e})();function Ty(){return p.jsxs("svg",{"aria-hidden":"true",className:"absolute inset-0 w-full h-full pointer-events-none select-none",viewBox:`0 0 ${Fl} ${ql}`,preserveAspectRatio:"xMidYMid slice",xmlns:"http://www.w3.org/2000/svg",children:[Sy.map(([t,e,s,n],r)=>p.jsx("line",{x1:t,y1:e,x2:s,y2:n,stroke:"#1a7aad",strokeWidth:"0.9",opacity:"0.18"},r)),ce.map(([t,e],s)=>p.jsx("circle",{cx:t,cy:e,r:s%6===0?4:2.2,fill:"#1a7aad",opacity:s%6===0?.38:.25},s))]})}function By({children:t}){const[e,s]=_.useState(!1),[n,r]=_.useState(null),[i,a]=_.useState(null),o=_.useRef(null),l=Gl(),c=Jn();function u(f){c==null||c.capture("phone_number_clicked",{placement:f})}const h=f=>{o.current&&clearTimeout(o.current),r(f)},d=()=>{o.current=setTimeout(()=>r(null),120)};return p.jsxs("div",{className:"min-h-screen flex flex-col font-poppins bg-[#FAFAF8] text-[#3D3D5C]",children:[p.jsx("div",{className:"bg-[#b2defd] text-[#071B27] text-xs py-2.5 px-4",children:p.jsxs("div",{className:"max-w-7xl mx-auto flex flex-col sm:flex-row items-center justify-between gap-1.5",children:[p.jsx("span",{className:"text-[#071B27]/70 text-center sm:text-left",children:"Celebrating 11 Years of Clinical Practice in Melbourne"}),p.jsxs("div",{className:"flex items-center gap-4 text-[#071B27]/80",children:[p.jsxs("a",{href:`tel:${Ee.replace(/\s/g,"")}`,onClick:()=>u("meta-bar"),className:"hover:text-[#071B27] transition-colors flex items-center gap-1.5",children:[p.jsx(Jt,{className:"h-3 w-3"}),Ee]}),p.jsx("span",{className:"hidden sm:block text-[#071B27]/30",children:"·"}),p.jsxs("a",{href:`mailto:${is}`,className:"hover:text-[#071B27] transition-colors hidden sm:flex items-center gap-1.5",children:[p.jsx(Or,{className:"h-3 w-3"}),is]}),p.jsx("span",{className:"hidden sm:block text-[#071B27]/30",children:"·"}),p.jsx("div",{className:"hidden sm:flex items-center gap-2.5",children:ka.map(f=>p.jsx("a",{href:f.href,target:"_blank",rel:"noopener noreferrer","aria-label":`Follow us on ${f.label}`,className:"text-[#071B27]/50 hover:text-[#071B27] transition-colors",children:f.icon},f.label))})]})]})}),p.jsxs("header",{className:"sticky top-0 z-50 bg-white/97 backdrop-blur-md border-b border-[#E2DCEF] shadow-sm",children:[p.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:p.jsxs("div",{className:"flex items-center justify-between h-16",children:[p.jsxs(ne,{to:"/",className:"flex items-center gap-3 flex-shrink-0",children:[p.jsx("img",{src:ft,alt:"Contemporary Psychology",className:"h-10 w-auto"}),p.jsxs("span",{className:"hidden sm:block font-bold text-[#1A1A2E] text-sm leading-tight font-lora",children:["Contemporary",p.jsx("br",{}),"Psychology"]})]}),p.jsx("nav",{className:"hidden lg:flex items-center gap-0.5",children:Ea.map(f=>p.jsxs("div",{className:"relative",onMouseEnter:()=>f.children&&h(f.label),onMouseLeave:()=>f.children&&d(),children:[p.jsxs(ne,{to:f.href,className:`flex items-center gap-1 px-3.5 py-2 rounded-md text-sm font-medium transition-colors font-poppins ${l.pathname.startsWith(f.href)&&f.href!=="/"?"text-[#F2506A] bg-[#FDF0F4]":"text-[#3D3D5C] hover:text-[#1A1A2E] hover:bg-[#F8F7FD]"}`,children:[f.label,f.children&&p.jsx(jr,{className:`h-3.5 w-3.5 transition-transform duration-200 ${n===f.label?"rotate-180":""}`})]}),f.children&&p.jsx("div",{className:"absolute top-full left-1/2 -translate-x-1/2 pt-1 z-50",style:{visibility:n===f.label?"visible":"hidden",pointerEvents:n===f.label?"auto":"none"},children:p.jsx("div",{className:`bg-white border border-[#E2DCEF] rounded-xl shadow-lg py-1.5 ${f.wide?"w-[min(580px,calc(100vw-2rem))] grid grid-cols-2":"min-w-[200px]"}`,children:f.children.map(m=>p.jsx(ne,{to:m.href,onClick:()=>r(null),className:`block px-4 py-2 text-sm font-poppins text-left transition-colors whitespace-nowrap ${l.pathname===m.href?"text-[#F2506A] bg-[#FDF0F4]":"text-[#3D3D5C] hover:text-[#1A1A2E] hover:bg-[#F8F7FD]"}`,children:m.label},m.label))})})]},f.label))}),p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx(zg,{}),p.jsx("a",{href:yy,target:"_blank",rel:"noopener noreferrer",className:"hidden md:inline-flex items-center rounded-full text-sm font-semibold px-4 py-2 border border-cp-rule text-[#3D3D5C] hover:border-brand-pink hover:text-brand-pink transition-colors font-poppins",children:"Client Login"}),p.jsx(ne,{to:zn,className:"hidden md:inline-flex items-center rounded-full text-white text-sm font-semibold px-5 py-2 transition-opacity hover:opacity-90 cp-gradient-bg",children:"Book Online"}),p.jsx("button",{className:"lg:hidden p-2 rounded-md text-[#3D3D5C] hover:text-[#1A1A2E] hover:bg-[#F8F7FD] transition-colors",onClick:()=>s(!e),"aria-label":"Toggle menu",children:e?p.jsx(ps,{className:"h-5 w-5"}):p.jsx(sc,{className:"h-5 w-5"})})]})]})}),e&&p.jsxs("div",{className:"lg:hidden border-t border-[#E2DCEF] bg-white px-4 py-3 space-y-1",children:[Ea.map(f=>p.jsx("div",{children:f.children?p.jsxs(p.Fragment,{children:[p.jsxs("button",{onClick:()=>a(i===f.label?null:f.label),className:"w-full flex items-center justify-between px-3 py-2.5 rounded-md text-sm font-medium text-[#3D3D5C] hover:text-[#1A1A2E] hover:bg-[#F8F7FD] transition-colors",children:[f.label,p.jsx(jr,{className:`h-4 w-4 transition-transform duration-200 ${i===f.label?"rotate-180":""}`})]}),i===f.label&&p.jsxs("div",{className:"ml-3 border-l border-[#E2DCEF] pl-3 space-y-1 mt-1 mb-1",children:[p.jsx(ne,{to:f.href,onClick:()=>{s(!1),a(null)},className:"block px-3 py-2 rounded-md text-sm text-[#3D3D5C] hover:text-[#1A1A2E] hover:bg-[#F8F7FD] transition-colors",children:"Overview"}),f.children.map(m=>p.jsx(ne,{to:m.href,onClick:()=>{s(!1),a(null)},className:"block px-3 py-2 rounded-md text-sm text-[#3D3D5C] hover:text-[#1A1A2E] hover:bg-[#F8F7FD] transition-colors",children:m.label},m.label))]})]}):p.jsx(ne,{to:f.href,onClick:()=>s(!1),className:"block px-3 py-2.5 rounded-md text-sm font-medium text-[#3D3D5C] hover:text-[#1A1A2E] hover:bg-[#F8F7FD] transition-colors",children:f.label})},f.label)),p.jsxs("div",{className:"pt-3 border-t border-[#E2DCEF] flex flex-col gap-2",children:[p.jsxs("a",{href:`tel:${Ee.replace(/\s/g,"")}`,onClick:()=>{u("mobile-nav"),s(!1)},className:"flex items-center justify-center gap-2 rounded-full text-white text-sm font-semibold px-5 py-2.5 cp-gradient-bg",children:[p.jsx(Jt,{className:"h-4 w-4"}),"Call ",Ee]}),p.jsx(ne,{to:zn,onClick:()=>s(!1),className:"block text-center rounded-full text-sm font-semibold px-5 py-2.5 border-2 border-[#1A1A2E] text-[#1A1A2E]",children:"Book Online"})]})]})]}),p.jsx("main",{className:"flex-1",children:t}),p.jsx(gy,{}),p.jsxs("footer",{className:"text-[#071B27]/70",style:{backgroundColor:"#b2defd"},children:[p.jsx("div",{className:"h-[3px] w-full",style:{background:"linear-gradient(to right, #F2506A, #B67AEC, #27BBE9)"}}),p.jsx("div",{className:"border-b border-[#071B27]/10 bg-[#071B27]/05",children:p.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-5 flex flex-col sm:flex-row items-center justify-between gap-4",children:[p.jsxs("div",{children:[p.jsx("p",{className:"font-lora font-bold text-[#071B27] text-base",children:"The easiest way to book is to call us."}),p.jsx("p",{className:"text-xs text-[#071B27]/60 font-poppins mt-0.5",children:"Our admin team will match you with the right psychologist and get you booked in."})]}),p.jsxs("a",{href:`tel:${Ee.replace(/\s/g,"")}`,onClick:()=>u("footer-cta-strip"),className:"flex-shrink-0 inline-flex items-center gap-2 rounded-full text-white font-semibold font-poppins px-6 py-2.5 text-sm transition-opacity hover:opacity-90 cp-gradient-bg",children:[p.jsx(Jt,{className:"h-4 w-4"}),Ee]})]})}),p.jsxs("div",{className:"relative overflow-hidden",children:[p.jsx(Ty,{}),p.jsxs("div",{className:"relative z-10 max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-14",children:[p.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 lg:grid-cols-5 gap-10",children:[p.jsxs("div",{className:"md:col-span-3 lg:col-span-2 space-y-4",children:[p.jsx("img",{src:ft,alt:"Contemporary Psychology",className:"h-10 w-auto brightness-0 opacity-70"}),p.jsx("p",{className:"text-[#071B27] font-semibold text-sm leading-snug font-lora italic",children:"Leading Psychologists. Grounded in Neuroscience. Built for Your Story."}),p.jsx("p",{className:"text-xs text-[#071B27]/60 leading-relaxed",children:"Evidence-based psychological support for individuals, couples, and families across Melbourne."}),p.jsxs("div",{className:"space-y-2 text-xs",children:[p.jsxs("div",{className:"flex items-start gap-2",children:[p.jsx(tc,{className:"h-3.5 w-3.5 mt-0.5 text-[#F2506A] flex-shrink-0"}),p.jsx("a",{href:"https://maps.google.com/?q=G06-G07/22+St+Kilda+Road+St+Kilda+VIC+3182",target:"_blank",rel:"noopener noreferrer",className:"hover:text-[#071B27] transition-colors",children:vy})]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(Jt,{className:"h-3.5 w-3.5 text-[#F2506A] flex-shrink-0"}),p.jsx("a",{href:`tel:${Ee.replace(/\s/g,"")}`,onClick:()=>u("footer"),className:"hover:text-[#071B27] transition-colors",children:Ee})]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(Or,{className:"h-3.5 w-3.5 text-[#F2506A] flex-shrink-0"}),p.jsx("a",{href:`mailto:${is}`,className:"hover:text-[#071B27] transition-colors text-xs whitespace-nowrap",children:is})]})]}),p.jsx("div",{className:"flex items-center gap-3 pt-1",children:ka.map(f=>p.jsx("a",{href:f.href,target:"_blank",rel:"noopener noreferrer","aria-label":`Follow us on ${f.label}`,className:"w-8 h-8 rounded-full bg-[#071B27]/10 hover:bg-[#F2506A] flex items-center justify-center text-[#071B27]/60 hover:text-white transition-all duration-200",children:f.icon},f.label))})]}),p.jsxs("div",{className:"space-y-3",children:[p.jsx("h3",{className:"text-[#071B27] font-semibold text-xs uppercase tracking-widest",children:"About"}),p.jsx("ul",{className:"space-y-2",children:by.map(f=>p.jsx("li",{children:p.jsx(ne,{to:f.href,className:"text-sm text-[#071B27]/65 hover:text-[#071B27] transition-colors",children:f.label})},f.label))})]}),p.jsxs("div",{className:"space-y-3",children:[p.jsx("h3",{className:"text-[#071B27] font-semibold text-xs uppercase tracking-widest",children:"Services"}),p.jsx("ul",{className:"space-y-2",children:wy.map(f=>p.jsx("li",{children:p.jsx(ne,{to:f.href,className:"text-sm text-[#071B27]/65 hover:text-[#071B27] transition-colors",children:f.label})},f.label))})]}),p.jsxs("div",{className:"space-y-3 flex flex-col",children:[p.jsx("h3",{className:"text-[#071B27] font-semibold text-xs uppercase tracking-widest",children:"Support"}),p.jsx("ul",{className:"space-y-2",children:xy.map(f=>p.jsx("li",{children:f.external?p.jsx("a",{href:f.href,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-[#071B27]/65 hover:text-[#071B27] transition-colors",children:f.label}):p.jsx(ne,{to:f.href,className:"text-sm text-[#071B27]/65 hover:text-[#071B27] transition-colors",children:f.label})},f.label))}),p.jsx("div",{className:"mt-auto pt-6",children:p.jsx("a",{href:"https://www.psychologytoday.com/profile/918210",target:"_blank",rel:"noopener noreferrer",children:p.jsx("img",{src:"/images/psychtoday.png",alt:"Contemporary Psychology on Psychology Today",className:"h-14 w-auto"})})})]})]}),p.jsxs("div",{className:"border-t border-[#071B27]/15 mt-12 pt-6",children:[p.jsx("p",{className:"text-xs text-[#071B27]/50 leading-relaxed max-w-3xl mb-4",children:"All psychological services are provided by AHPRA-registered psychologists. Medicare rebates are available for eligible clients with a valid Mental Health Treatment Plan or equivalent referral."}),p.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-3 text-xs text-[#071B27]/40",children:[p.jsxs("p",{children:["© ",new Date().getFullYear()," Contemporary Psychology · All rights reserved."]}),p.jsx(ne,{to:"/privacy-policy",className:"hover:text-[#071B27]/60 transition-colors",children:"Privacy Policy"})]})]})]})]})]})]})}export{Gn as B,jr as C,ec as F,tc as M,By as P,rc as S,ic as U,Qi as _,Jt as a,nc as b,Or as c,Ds as d,Oy as e,Ql as f,Dr as g,ap as h,Iy as i,Dy as j,Ny as k,My as l,Ce as m,Zl as n,Ne as s,ip as t,$y as u};