import{j as m}from"./vendor-query-Dz__kayo.js";import{r as _,a as Ul}from"./vendor-react-DszrpDkA.js";import{b as Fl,u as Wl,L as ne}from"./vendor-router-DVl9jod2.js";import{c as ae,X as hs,b as ql,P as Kn,u as Hl,d as on,a as ze,e as Kl,S as zl}from"./index-Dk8L4sRW.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 Gl=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 Er=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 Jl=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 Yl=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 Pr=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 Xl=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 Zl=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 Ql=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 Kt=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 Cr=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 ec=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 tc=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"}]]),zn=_.createContext({});function Gn(t){const e=_.useRef(null);return e.current===null&&(e.current=t()),e.current}const sc=typeof window<"u",Sa=sc?_.useLayoutEffect:_.useEffect,Ts=_.createContext(null);function Jn(t,e){t.indexOf(e)===-1&&t.push(e)}function ds(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 ks=()=>{},ft=()=>{};const De={},Ta=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t);function ka(t){return typeof t=="object"&&t!==null}const Aa=t=>/^0[^.\s]+$/u.test(t);function Ea(t){let e;return()=>(e===void 0&&(e=t()),e)}const ie=t=>t,nc=(t,e)=>s=>e(t(s)),Ut=(...t)=>t.reduce(nc),jt=(t,e,s)=>{const n=e-t;return n===0?1:(s-t)/n};class Yn{constructor(){this.subscriptions=[]}add(e){return Jn(this.subscriptions,e),()=>ds(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 Z=t=>t*1e3,re=t=>t/1e3;function Pa(t,e){return e?t*(1e3/e):0}const Ca=(t,e,s)=>(((1-3*s+3*e)*t+(3*s-6*e))*t+3*e)*t,rc=1e-7,ic=12;function ac(t,e,s,n,r){let i,a,o=0;do a=e+(s-e)/2,i=Ca(a,n,r)-t,i>0?s=a:e=a;while(Math.abs(i)>rc&&++o<ic);return a}function Ft(t,e,s,n){if(t===e&&s===n)return ie;const r=i=>ac(i,0,1,t,s);return i=>i===0||i===1?i:Ca(r(i),e,n)}const Ra=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,ja=t=>e=>1-t(1-e),Oa=Ft(.33,1.53,.69,.99),Xn=ja(Oa),Da=Ra(Xn),Ia=t=>t>=1?1:(t*=2)<1?.5*Xn(t):.5*(2-Math.pow(2,-10*(t-1))),Zn=t=>1-Math.sin(Math.acos(t)),Na=ja(Zn),Ma=Ra(Zn),oc=Ft(.42,0,1,1),lc=Ft(0,0,.58,1),$a=Ft(.42,0,.58,1),cc=t=>Array.isArray(t)&&typeof t[0]!="number",La=t=>Array.isArray(t)&&typeof t[0]=="number",Rr={linear:ie,easeIn:oc,easeInOut:$a,easeOut:lc,circIn:Zn,circInOut:Ma,circOut:Na,backIn:Xn,backInOut:Da,backOut:Oa,anticipate:Ia},uc=t=>typeof t=="string",jr=t=>{if(La(t)){ft(t.length===4,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");const[e,s,n,r]=t;return Ft(e,s,n,r)}else if(uc(t))return ft(Rr[t]!==void 0,`Invalid easing type '${t}'`,"invalid-easing-type"),Rr[t];return t},zt=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"],Or={value:null,addProjectionMetrics:null};function hc(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 g=f&&r?s:n;return d&&a.add(h),g.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&&Or.value&&Or.value.frameloop[e].push(l),l=0,s.clear(),r=!1,i&&(i=!1,u.process(h))}};return u}const dc=40;function Ba(t,e){let s=!1,n=!0;const r={delta:0,timestamp:0,isProcessing:!1},i=()=>s=!0,a=zt.reduce((w,x)=>(w[x]=hc(i,e?x:void 0),w),{}),{setup:o,read:l,resolveKeyframes:c,preUpdate:u,update:h,preRender:d,render:f,postRender:p}=a,g=()=>{const w=De.useManualTiming,x=w?r.timestamp:performance.now();s=!1,w||(r.delta=n?1e3/60:Math.max(Math.min(x-r.timestamp,dc),1)),r.timestamp=x,r.isProcessing=!0,o.process(r),l.process(r),c.process(r),u.process(r),h.process(r),d.process(r),f.process(r),p.process(r),r.isProcessing=!1,s&&e&&(n=!1,t(g))},v=()=>{s=!0,n=!0,r.isProcessing||t(g)};return{schedule:zt.reduce((w,x)=>{const S=a[x];return w[x]=(A,O=!1,E=!1)=>(s||v(),S.schedule(A,O,E)),w},{}),cancel:w=>{for(let x=0;x<zt.length;x++)a[zt[x]].cancel(w)},state:r,steps:a}}const{schedule:D,cancel:Ie,state:G,steps:Ds}=Ba(typeof requestAnimationFrame<"u"?requestAnimationFrame:ie,!0);let ns;function fc(){ns=void 0}const Y={now:()=>(ns===void 0&&Y.set(G.isProcessing||De.useManualTiming?G.timestamp:performance.now()),ns),set:t=>{ns=t,queueMicrotask(fc)}},Va=t=>e=>typeof e=="string"&&e.startsWith(t),Ua=Va("--"),pc=Va("var(--"),Qn=t=>pc(t)?mc.test(t.split("/*")[0].trim()):!1,mc=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function Dr(t){return typeof t!="string"?!1:t.split("/*")[0].includes("var(--")}const yt={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},Ot={...yt,transform:t=>be(0,1,t)},Gt={...yt,default:1},St=t=>Math.round(t*1e5)/1e5,er=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function gc(t){return t==null}const yc=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,tr=(t,e)=>s=>!!(typeof s=="string"&&yc.test(s)&&s.startsWith(t)||e&&!gc(s)&&Object.prototype.hasOwnProperty.call(s,e)),Fa=(t,e,s)=>n=>{if(typeof n!="string")return n;const[r,i,a,o]=n.match(er);return{[t]:parseFloat(r),[e]:parseFloat(i),[s]:parseFloat(a),alpha:o!==void 0?parseFloat(o):1}},vc=t=>be(0,255,t),Is={...yt,transform:t=>Math.round(vc(t))},qe={test:tr("rgb","red"),parse:Fa("red","green","blue"),transform:({red:t,green:e,blue:s,alpha:n=1})=>"rgba("+Is.transform(t)+", "+Is.transform(e)+", "+Is.transform(s)+", "+St(Ot.transform(n))+")"};function wc(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 ln={test:tr("#"),parse:wc,transform:qe.transform},Wt=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),Ee=Wt("deg"),we=Wt("%"),T=Wt("px"),bc=Wt("vh"),xc=Wt("vw"),Ir={...we,parse:t=>we.parse(t)/100,transform:t=>we.transform(t*100)},ot={test:tr("hsl","hue"),parse:Fa("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:s,alpha:n=1})=>"hsla("+Math.round(t)+", "+we.transform(St(e))+", "+we.transform(St(s))+", "+St(Ot.transform(n))+")"},U={test:t=>qe.test(t)||ln.test(t)||ot.test(t),parse:t=>qe.test(t)?qe.parse(t):ot.test(t)?ot.parse(t):ln.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?qe.transform(t):ot.transform(t),getAnimatableNone:t=>{const e=U.parse(t);return e.alpha=0,U.transform(e)}},_c=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function Sc(t){var e,s;return isNaN(t)&&typeof t=="string"&&(((e=t.match(er))==null?void 0:e.length)||0)+(((s=t.match(_c))==null?void 0:s.length)||0)>0}const Wa="number",qa="color",Tc="var",kc="var(",Nr="${}",Ac=/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 pt(t){const e=t.toString(),s=[],n={color:[],number:[],var:[]},r=[];let i=0;const o=e.replace(Ac,l=>(U.test(l)?(n.color.push(i),r.push(qa),s.push(U.parse(l))):l.startsWith(kc)?(n.var.push(i),r.push(Tc),s.push(l)):(n.number.push(i),r.push(Wa),s.push(parseFloat(l))),++i,Nr)).split(Nr);return{values:s,split:o,indexes:n,types:r}}function Ec(t){return pt(t).values}function Ha({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===Wa?r+=St(n[i]):a===qa?r+=U.transform(n[i]):r+=n[i]}return r}}function Pc(t){return Ha(pt(t))}const Cc=t=>typeof t=="number"?0:U.test(t)?U.getAnimatableNone(t):t,Rc=(t,e)=>typeof t=="number"?e!=null&&e.trim().endsWith("/")?t:0:Cc(t);function jc(t){const e=pt(t);return Ha(e)(e.values.map((n,r)=>Rc(n,e.split[r])))}const fe={test:Sc,parse:Ec,createTransformer:Pc,getAnimatableNone:jc};function Ns(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 Oc({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=Ns(l,o,t+1/3),i=Ns(l,o,t),a=Ns(l,o,t-1/3)}return{red:Math.round(r*255),green:Math.round(i*255),blue:Math.round(a*255),alpha:n}}function fs(t,e){return s=>s>0?e:t}const N=(t,e,s)=>t+(e-t)*s,Ms=(t,e,s)=>{const n=t*t,r=s*(e*e-n)+n;return r<0?0:Math.sqrt(r)},Dc=[ln,qe,ot],Ic=t=>Dc.find(e=>e.test(t));function Mr(t){const e=Ic(t);if(ks(!!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===ot&&(s=Oc(s)),s}const $r=(t,e)=>{const s=Mr(t),n=Mr(e);if(!s||!n)return fs(t,e);const r={...s};return i=>(r.red=Ms(s.red,n.red,i),r.green=Ms(s.green,n.green,i),r.blue=Ms(s.blue,n.blue,i),r.alpha=N(s.alpha,n.alpha,i),qe.transform(r))},cn=new Set(["none","hidden"]);function Nc(t,e){return cn.has(t)?s=>s<=0?t:e:s=>s>=1?e:t}function Mc(t,e){return s=>N(t,e,s)}function sr(t){return typeof t=="number"?Mc:typeof t=="string"?Qn(t)?fs:U.test(t)?$r:Bc:Array.isArray(t)?Ka:typeof t=="object"?U.test(t)?$r:$c:fs}function Ka(t,e){const s=[...t],n=s.length,r=t.map((i,a)=>sr(i)(i,e[a]));return i=>{for(let a=0;a<n;a++)s[a]=r[a](i);return s}}function $c(t,e){const s={...t,...e},n={};for(const r in s)t[r]!==void 0&&e[r]!==void 0&&(n[r]=sr(t[r])(t[r],e[r]));return r=>{for(const i in n)s[i]=n[i](r);return s}}function Lc(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 Bc=(t,e)=>{const s=fe.createTransformer(e),n=pt(t),r=pt(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?cn.has(t)&&!r.values.length||cn.has(e)&&!n.values.length?Nc(t,e):Ut(Ka(Lc(n,r),r.values),s):(ks(!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"),fs(t,e))};function za(t,e,s){return typeof t=="number"&&typeof e=="number"&&typeof s=="number"?N(t,e,s):sr(t)(t,e)}const Vc=t=>{const e=({timestamp:s})=>t(s);return{start:(s=!0)=>D.update(e,s),stop:()=>Ie(e),now:()=>G.isProcessing?G.timestamp:Y.now()}},Ga=(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)})`},ps=2e4;function nr(t){let e=0;const s=50;let n=t.next(e);for(;!n.done&&e<ps;)e+=s,n=t.next(e);return e>=ps?1/0:e}function Uc(t,e=100,s){const n=s({...t,keyframes:[0,e]}),r=Math.min(nr(n),ps);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 un(t,e){return t*Math.sqrt(1-e*e)}const Fc=12;function Wc(t,e,s){let n=s;for(let r=1;r<Fc;r++)n=n-t(n)/e(n);return n}const $s=.001;function qc({duration:t=L.duration,bounce:e=L.bounce,velocity:s=L.velocity,mass:n=L.mass}){let r,i;ks(t<=Z(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=un(c,a),p=Math.exp(-h);return $s-d/f*p},i=c=>{const h=c*a*t,d=h*s+s,f=Math.pow(a,2)*Math.pow(c,2)*t,p=Math.exp(-h),g=un(Math.pow(c,2),a);return(-r(c)+$s>0?-1:1)*((d-f)*p)/g}):(r=c=>{const u=Math.exp(-c*t),h=(c-s)*t+1;return-$s+u*h},i=c=>{const u=Math.exp(-c*t),h=(s-c)*(t*t);return u*h});const o=5/t,l=Wc(r,i,o);if(t=Z(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 Hc=["duration","bounce"],Kc=["stiffness","damping","mass"];function Lr(t,e){return e.some(s=>t[s]!==void 0)}function zc(t){let e={velocity:L.velocity,stiffness:L.stiffness,damping:L.damping,mass:L.mass,isResolvedFromDuration:!1,...t};if(!Lr(t,Kc)&&Lr(t,Hc))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=qc({...t,velocity:0});e={...e,...s,mass:L.mass},e.isResolvedFromDuration=!0}return e}function ms(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}=zc({...s,velocity:-re(s.velocity||0)}),p=d||0,g=c/(2*Math.sqrt(l*u)),v=a-i,y=re(Math.sqrt(l/u)),b=Math.abs(v)<5;n||(n=b?L.restSpeed.granular:L.restSpeed.default),r||(r=b?L.restDelta.granular:L.restDelta.default);let w,x,S,A,O,E;if(g<1)S=un(y,g),A=(p+g*y*v)/S,w=P=>{const M=Math.exp(-g*y*P);return a-M*(A*Math.sin(S*P)+v*Math.cos(S*P))},O=g*y*A+v*S,E=g*y*v-A*S,x=P=>Math.exp(-g*y*P)*(O*Math.sin(S*P)+E*Math.cos(S*P));else if(g===1){w=M=>a-Math.exp(-y*M)*(v+(p+y*v)*M);const P=p+y*v;x=M=>Math.exp(-y*M)*(y*P*M-p)}else{const P=y*Math.sqrt(g*g-1);w=pe=>{const _e=Math.exp(-g*y*pe),me=Math.min(P*pe,300);return a-_e*((p+g*y*v)*Math.sinh(me)+P*v*Math.cosh(me))/P};const M=(p+g*y*v)/P,q=g*y*M-v*P,xe=g*y*v-M*P;x=pe=>{const _e=Math.exp(-g*y*pe),me=Math.min(P*pe,300);return _e*(q*Math.sinh(me)+xe*Math.cosh(me))}}const j={calculatedDuration:f&&h||null,velocity:P=>Z(x(P)),next:P=>{if(!f&&g<1){const q=Math.exp(-g*y*P),xe=Math.sin(S*P),pe=Math.cos(S*P),_e=a-q*(A*xe+v*pe),me=Z(q*(O*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 q=Z(x(P));o.done=Math.abs(q)<=n&&Math.abs(a-M)<=r}return o.value=o.done?a:M,o},toString:()=>{const P=Math.min(nr(j),ps),M=Ga(q=>j.next(P*q).value,P,30);return P+"ms "+M},toTransition:()=>{}};return j}ms.applyToOptions=t=>{const e=Uc(t,100,ms);return t.ease=e.ease,t.duration=Z(e.duration),t.type="keyframes",t};const Gc=5;function Ja(t,e,s){const n=Math.max(e-Gc,0);return Pa(s-t(n),e-n)}function hn({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,p=E=>o===void 0?l:l===void 0||Math.abs(o-E)<Math.abs(l-E)?o:l;let g=s*e;const v=h+g,y=a===void 0?v:a(v);y!==v&&(g=y-h);const b=E=>-g*Math.exp(-E/n),w=E=>y+b(E),x=E=>{const j=b(E),P=w(E);d.done=Math.abs(j)<=c,d.value=d.done?y:P};let S,A;const O=E=>{f(d.value)&&(S=E,A=ms({keyframes:[d.value,p(d.value)],velocity:Ja(w,E,d.value),damping:r,stiffness:i,restDelta:c,restSpeed:u}))};return O(0),{calculatedDuration:null,next:E=>{let j=!1;return!A&&S===void 0&&(j=!0,x(E),O(E)),S!==void 0&&E>=S?A.next(E-S):(!j&&x(E),d)}}}function Jc(t,e,s){const n=[],r=s||De.mix||za,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=Ut(l,o)}n.push(o)}return n}function Yc(t,e,{clamp:s=!0,ease:n,mixer:r}={}){const i=t.length;if(ft(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=Jc(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=jt(t[h],t[h+1],u);return o[h](d)};return s?u=>c(be(t[0],t[i-1],u)):c}function Xc(t,e){const s=t[t.length-1];for(let n=1;n<=e;n++){const r=jt(0,e,n);t.push(N(s,1,r))}}function Zc(t){const e=[0];return Xc(e,t.length-1),e}function Qc(t,e){return t.map(s=>s*e)}function eu(t,e){return t.map(()=>e||$a).splice(0,t.length-1)}function Tt({duration:t=300,keyframes:e,times:s,ease:n="easeInOut"}){const r=cc(n)?n.map(jr):jr(n),i={done:!1,value:e[0]},a=Qc(s&&s.length===e.length?s:Zc(e),t),o=Yc(a,e,{ease:Array.isArray(r)?r:eu(e,r)});return{calculatedDuration:t,next:l=>(i.value=o(l),i.done=l>=t,i)}}const tu=t=>t!==null;function As(t,{repeat:e,repeatType:s="loop"},n,r=1){const i=t.filter(tu),o=r<0||e&&s!=="loop"&&e%2===1?0:i.length-1;return!o||n===void 0?i[o]:n}const su={decay:hn,inertia:hn,tween:Tt,keyframes:Tt,spring:ms};function Ya(t){typeof t.type=="string"&&(t.type=su[t.type])}class rr{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 nu=t=>t/100;class gs extends rr{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;Ya(e);const{type:s=Tt,repeat:n=0,repeatDelay:r=0,repeatType:i,velocity:a=0}=e;let{keyframes:o}=e;const l=s||Tt;l!==Tt&&typeof o[0]!="number"&&(this.mixKeyframes=Ut(nu,za(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=nr(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:p,onUpdate:g,finalKeyframe:v}=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 y=this.currentTime-c*(this.playbackSpeed>=0?1:-1),b=this.playbackSpeed>=0?y<0:y>r;this.currentTime=Math.max(y,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=r);let w=this.currentTime,x=n;if(h){const E=Math.min(this.currentTime,r)/o;let j=Math.floor(E),P=E%1;!P&&E>=1&&(P=1),P===1&&j--,j=Math.min(j,h+1),!!(j%2)&&(d==="reverse"?(P=1-P,f&&(P-=f/o)):d==="mirror"&&(x=a)),w=be(0,1,P)*o}let S;b?(this.delayState.value=u[0],S=this.delayState):S=x.next(w),i&&!b&&(S.value=i(S.value));let{done:A}=S;!b&&l!==null&&(A=this.playbackSpeed>=0?this.currentTime>=r:this.currentTime<=0);const O=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&A);return O&&p!==hn&&(S.value=As(u,this.options,v,this.speed)),g&&g(S.value),O&&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=Z(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 Ja(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=Vc,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 ru(t){for(let e=1;e<t.length;e++)t[e]??(t[e]=t[e-1])}const He=t=>t*180/Math.PI,dn=t=>{const e=He(Math.atan2(t[1],t[0]));return fn(e)},iu={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:dn,rotateZ:dn,skewX:t=>He(Math.atan(t[1])),skewY:t=>He(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},fn=t=>(t=t%360,t<0&&(t+=360),t),Br=dn,Vr=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),Ur=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),au={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Vr,scaleY:Ur,scale:t=>(Vr(t)+Ur(t))/2,rotateX:t=>fn(He(Math.atan2(t[6],t[5]))),rotateY:t=>fn(He(Math.atan2(-t[2],t[0]))),rotateZ:Br,rotate:Br,skewX:t=>He(Math.atan(t[4])),skewY:t=>He(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function pn(t){return t.includes("scale")?1:0}function mn(t,e){if(!t||t==="none")return pn(e);const s=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let n,r;if(s)n=au,r=s;else{const o=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);n=iu,r=o}if(!r)return pn(e);const i=n[e],a=r[1].split(",").map(lu);return typeof i=="function"?i(a):a[i]}const ou=(t,e)=>{const{transform:s="none"}=getComputedStyle(t);return mn(s,e)};function lu(t){return parseFloat(t.trim())}const vt=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],wt=new Set(vt),Fr=t=>t===yt||t===T,cu=new Set(["x","y","z"]),uu=vt.filter(t=>!cu.has(t));function hu(t){const e=[];return uu.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})=>mn(e,"x"),y:(t,{transform:e})=>mn(e,"y")};Oe.translateX=Oe.x;Oe.translateY=Oe.y;const Ge=new Set;let gn=!1,yn=!1,vn=!1;function Xa(){if(yn){const t=Array.from(Ge).filter(n=>n.needsMeasurement),e=new Set(t.map(n=>n.element)),s=new Map;e.forEach(n=>{const r=hu(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)})}yn=!1,gn=!1,Ge.forEach(t=>t.complete(vn)),Ge.clear()}function Za(){Ge.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(yn=!0)})}function du(){vn=!0,Za(),Xa(),vn=!1}class ir{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?(Ge.add(this),gn||(gn=!0,D.read(Za),D.resolveKeyframes(Xa))):(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])}ru(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),Ge.delete(this)}cancel(){this.state==="scheduled"&&(Ge.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const fu=t=>t.startsWith("--");function Qa(t,e,s){fu(e)?t.style.setProperty(e,s):t.style[e]=s}const pu={};function eo(t,e){const s=Ea(t);return()=>pu[e]??s()}const mu=eo(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),to=eo(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),xt=([t,e,s,n])=>`cubic-bezier(${t}, ${e}, ${s}, ${n})`,Wr={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:xt([0,.65,.55,1]),circOut:xt([.55,0,1,.45]),backIn:xt([.31,.01,.66,-.59]),backOut:xt([.33,1.53,.69,.99])};function so(t,e){if(t)return typeof t=="function"?to()?Ga(t,e):"ease-out":La(t)?xt(t):Array.isArray(t)?t.map(s=>so(s,e)||Wr.easeOut):Wr[t]}function gu(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=so(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 no(t){return typeof t=="function"&&"applyToOptions"in t}function yu({type:t,...e}){return no(t)&&to()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}class ro extends rr{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,ft(typeof e.type!="string",`Mini animate() doesn't support "type" as a string.`,"mini-spring");const c=yu(e);this.animation=gu(s,n,r,c,i),c.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){const u=As(r,this.options,o,this.speed);this.updateMotionValue&&this.updateMotionValue(u),Qa(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=Z(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&&mu()?(this.animation.timeline=e,s&&(this.animation.rangeStart=s),n&&(this.animation.rangeEnd=n),ie):r(this)}}const io={anticipate:Ia,backInOut:Da,circInOut:Ma};function vu(t){return t in io}function wu(t){typeof t.ease=="string"&&vu(t.ease)&&(t.ease=io[t.ease])}const Ls=10;class bu extends ro{constructor(e){wu(e),Ya(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 gs({...a,autoplay:!1}),l=Math.max(Ls,Y.now()-this.startTime),c=be(0,Ls,l-Ls),u=o.sample(l).value,{name:h}=this.options;i&&h&&Qa(i,h,u),s.setWithVelocity(o.sample(Math.max(0,l-c)).value,u,c),o.stop()}}const qr=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(fe.test(t)||t==="0")&&!t.startsWith("url("));function xu(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 _u(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=qr(r,e),o=qr(i,e);return ks(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:xu(t)||(s==="spring"||no(s))&&n}function wn(t){t.duration=0,t.type="keyframes"}const ao=new Set(["opacity","clipPath","filter","transform"]),Su=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function Tu(t){for(let e=0;e<t.length;e++)if(typeof t[e]=="string"&&Su.test(t[e]))return!0;return!1}const ku=new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),Au=Ea(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function Eu(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 Au()&&s&&(ao.has(s)||ku.has(s)&&Tu(o))&&(s!=="transform"||!u)&&!c&&!n&&r!=="mirror"&&i!==0&&a!=="inertia"}const Pu=40;class Cu extends rr{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 p;super(),this.stop=()=>{var g,v;this._animation&&(this._animation.stop(),(g=this.stopTimeline)==null||g.call(this)),(v=this.keyframeResolver)==null||v.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)||ir;this.keyframeResolver=new f(o,(g,v,y)=>this.onKeyframesResolved(g,v,d,!y),l,c,u),(p=this.keyframeResolver)==null||p.scheduleResolve()}onKeyframesResolved(e,s,n,r){var y,b;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;_u(e,i,a,o)||(h=!1,(De.instantAnimations||!l)&&(u==null||u(As(e,n,s))),e[0]=e[e.length-1],wn(n),n.repeat=0);const f={startTime:r?this.resolvedAt?this.resolvedAt-this.createdAt>Pu?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:s,...n,keyframes:e},p=h&&!c&&Eu(f),g=(b=(y=f.motionValue)==null?void 0:y.owner)==null?void 0:b.current;let v;if(p)try{v=new bu({...f,element:g})}catch{v=new gs(f)}else v=new gs(f);v.finished.then(()=>{this.notifyFinished()}).catch(ie),this.pendingTimeline&&(this.stopTimeline=v.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=v}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(),du()),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 oo(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 Ru=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function ju(t){const e=Ru.exec(t);if(!e)return[,];const[,s,n,r]=e;return[`--${s??n}`,r]}const Ou=4;function lo(t,e,s=1){ft(s<=Ou,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`,"max-css-var-depth");const[n,r]=ju(t);if(!n)return;const i=window.getComputedStyle(e).getPropertyValue(n);if(i){const a=i.trim();return Ta(a)?parseFloat(a):a}return Qn(r)?lo(r,e,s+1):r}const Du={type:"spring",stiffness:500,damping:25,restSpeed:10},Iu=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),Nu={type:"keyframes",duration:.8},Mu={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},$u=(t,{keyframes:e})=>e.length>2?Nu:wt.has(t)?t.startsWith("scale")?Iu(e[1]):Du:Mu;function co(t,e){if(t!=null&&t.inherit&&e){const{inherit:s,...n}=t;return{...e,...n}}return t}function ar(t,e){const s=(t==null?void 0:t[e])??(t==null?void 0:t.default)??t;return s!==t?co(s,t):s}const Lu=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);function Bu(t){for(const e in t)if(!Lu.has(e))return!0;return!1}const or=(t,e,s,n={},r,i)=>a=>{const o=ar(n,t)||{},l=o.delay||n.delay||0;let{elapsed:c=0}=n;c=c-Z(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};Bu(o)||Object.assign(u,$u(t,u)),u.duration&&(u.duration=Z(u.duration)),u.repeatDelay&&(u.repeatDelay=Z(u.repeatDelay)),u.from!==void 0&&(u.keyframes[0]=u.from);let h=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(wn(u),u.delay===0&&(h=!0)),(De.instantAnimations||De.skipAnimations||r!=null&&r.shouldSkipAnimations)&&(h=!0,wn(u),u.delay=0),u.allowFlatten=!o.type&&!o.ease,h&&!i&&e.get()!==void 0){const d=As(u.keyframes,o);if(d!==void 0){D.update(()=>{u.onUpdate(d),u.onComplete()});return}}return o.isSync?new gs(u):new Cu(u)};function Hr(t){const e=[{},{}];return t==null||t.values.forEach((s,n)=>{e[0][n]=s.get(),e[1][n]=s.getVelocity()}),e}function lr(t,e,s,n){if(typeof e=="function"){const[r,i]=Hr(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]=Hr(n);e=e(s!==void 0?s:t.custom,r,i)}return e}function Je(t,e,s){const n=t.getProps();return lr(n,e,s!==void 0?s:n.custom,t)}const uo=new Set(["width","height","top","left","right","bottom",...vt]),Kr=30,Vu=t=>!isNaN(parseFloat(t));class Uu{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=Vu(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 Yn);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>Kr)return 0;const s=Math.min(this.updatedAt-this.prevUpdatedAt,Kr);return Pa(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 mt(t,e){return new Uu(t,e)}const bn=t=>Array.isArray(t);function Fu(t,e,s){t.hasValue(e)?t.getValue(e).set(s):t.addValue(e,mt(s))}function Wu(t){return bn(t)?t[t.length-1]||0:t}function qu(t,e){const s=Je(t,e);let{transitionEnd:n={},transition:r={},...i}=s||{};i={...i,...n};for(const a in i){const o=Wu(i[a]);Fu(t,a,o)}}const J=t=>!!(t&&t.getVelocity);function Hu(t){return!!(J(t)&&t.add)}function xn(t,e){const s=t.getValue("willChange");if(Hu(s))return s.add(e);if(!s&&De.WillChange){const n=new De.WillChange("auto");t.addValue("willChange",n),n.add(e)}}function cr(t){return t.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}const Ku="framerAppearId",ho="data-"+cr(Ku);function fo(t){return t.props[ho]}function zu({protectedKeys:t,needsAnimating:e},s){const n=t.hasOwnProperty(s)&&e[s]!==!0;return e[s]=!1,n}function po(t,e,{delay:s=0,transitionOverride:n,type:r}={}){let{transition:i,transitionEnd:a,...o}=e;const l=t.getDefaultTransition();i=i?co(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),p=o[d];if(p===void 0||h&&zu(h,d))continue;const g={delay:s,...ar(i||{},d)},v=f.get();if(v!==void 0&&!f.isAnimating()&&!Array.isArray(p)&&p===v&&!g.velocity){D.update(()=>f.set(p));continue}let y=!1;if(window.MotionHandoffAnimation){const x=fo(t);if(x){const S=window.MotionHandoffAnimation(x,d,D);S!==null&&(g.startTime=S,y=!0)}}xn(t,d);const b=c??t.shouldReduceMotion;f.start(or(d,f,p,b&&uo.has(d)?{type:!1}:g,t,y));const w=f.animation;w&&u.push(w)}if(a){const d=()=>D.update(()=>{a&&qu(t,a)});u.length?Promise.all(u).then(d):d()}return u}function _n(t,e,s={}){var l;const n=Je(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(po(t,n,s)):()=>Promise.resolve(),a=t.variantChildren&&t.variantChildren.size?(c=0)=>{const{delayChildren:u=0,staggerChildren:h,staggerDirection:d}=r;return Gu(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 Gu(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(_n(l,e,{...a,delay:s+(typeof n=="function"?0:n)+oo(t.variantChildren,l,n,r,i)}).then(()=>l.notify("AnimationComplete",e)));return Promise.all(o)}function Ju(t,e,s={}){t.notify("AnimationStart",e);let n;if(Array.isArray(e)){const r=e.map(i=>_n(t,i,s));n=Promise.all(r)}else if(typeof e=="string")n=_n(t,e,s);else{const r=typeof e=="function"?Je(t,e,s.custom):e;n=Promise.all(po(t,r,s))}return n.then(()=>{t.notify("AnimationComplete",e)})}const Yu={test:t=>t==="auto",parse:t=>t},mo=t=>e=>e.test(t),go=[yt,T,we,Ee,xc,bc,Yu],zr=t=>go.find(mo(t));function Xu(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||Aa(t):!0}const Zu=new Set(["brightness","contrast","saturate","opacity"]);function Qu(t){const[e,s]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[n]=s.match(er)||[];if(!n)return t;const r=s.replace(n,"");let i=Zu.has(e)?1:0;return n!==s&&(i*=100),e+"("+i+r+")"}const eh=/\b([a-z-]*)\(.*?\)/gu,Sn={...fe,getAnimatableNone:t=>{const e=t.match(eh);return e?e.map(Qu).join(" "):t}},Tn={...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))}},Gr={...yt,transform:Math.round},th={rotate:Ee,rotateX:Ee,rotateY:Ee,rotateZ:Ee,scale:Gt,scaleX:Gt,scaleY:Gt,scaleZ:Gt,skew:Ee,skewX:Ee,skewY:Ee,distance:T,translateX:T,translateY:T,translateZ:T,x:T,y:T,z:T,perspective:T,transformPerspective:T,opacity:Ot,originX:Ir,originY:Ir,originZ:T},ur={borderWidth:T,borderTopWidth:T,borderRightWidth:T,borderBottomWidth:T,borderLeftWidth:T,borderRadius:T,borderTopLeftRadius:T,borderTopRightRadius:T,borderBottomRightRadius:T,borderBottomLeftRadius:T,width:T,maxWidth:T,height:T,maxHeight:T,top:T,right:T,bottom:T,left:T,inset:T,insetBlock:T,insetBlockStart:T,insetBlockEnd:T,insetInline:T,insetInlineStart:T,insetInlineEnd:T,padding:T,paddingTop:T,paddingRight:T,paddingBottom:T,paddingLeft:T,paddingBlock:T,paddingBlockStart:T,paddingBlockEnd:T,paddingInline:T,paddingInlineStart:T,paddingInlineEnd:T,margin:T,marginTop:T,marginRight:T,marginBottom:T,marginLeft:T,marginBlock:T,marginBlockStart:T,marginBlockEnd:T,marginInline:T,marginInlineStart:T,marginInlineEnd:T,fontSize:T,backgroundPositionX:T,backgroundPositionY:T,...th,zIndex:Gr,fillOpacity:Ot,strokeOpacity:Ot,numOctaves:Gr},sh={...ur,color:U,backgroundColor:U,outlineColor:U,fill:U,stroke:U,borderColor:U,borderTopColor:U,borderRightColor:U,borderBottomColor:U,borderLeftColor:U,filter:Sn,WebkitFilter:Sn,mask:Tn,WebkitMask:Tn},yo=t=>sh[t],nh=new Set([Sn,Tn]);function vo(t,e){let s=yo(t);return nh.has(s)||(s=fe),s.getAnimatableNone?s.getAnimatableNone(e):void 0}const rh=new Set(["auto","none","0"]);function ih(t,e,s){let n=0,r;for(;n<t.length&&!r;){const i=t[n];typeof i=="string"&&!rh.has(i)&&pt(i).values.length&&(r=t[n]),n++}if(r&&s)for(const i of e)t[i]=vo(s,r)}class ah extends ir{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(),Qn(h))){const d=lo(h,s.current);d!==void 0&&(e[u]=d),u===e.length-1&&(this.finalKeyframe=h)}}if(this.resolveNoneKeyframes(),!uo.has(n)||e.length!==2)return;const[r,i]=e,a=zr(r),o=zr(i),l=Dr(r),c=Dr(i);if(l!==c&&Oe[n]){this.needsMeasurement=!0;return}if(a!==o)if(Fr(a)&&Fr(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||Xu(e[r]))&&n.push(r);n.length&&ih(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 wo(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 bo=(t,e)=>e&&typeof t=="number"?e.transform(t):t;function rs(t){return ka(t)&&"offsetHeight"in t&&!("ownerSVGElement"in t)}const{schedule:hr,cancel:Py}=Ba(queueMicrotask,!1),ue={x:!1,y:!1};function xo(){return ue.x||ue.y}function oh(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 _o(t,e){const s=wo(t),n=new AbortController,r={passive:!0,...e,signal:n.signal};return[s,r,()=>n.abort()]}function lh(t){return!(t.pointerType==="touch"||xo())}function ch(t,e,s={}){const[n,r,i]=_o(t,s);return n.forEach(a=>{let o=!1,l=!1,c;const u=()=>{a.removeEventListener("pointerleave",p)},h=v=>{c&&(c(v),c=void 0),u()},d=v=>{o=!1,window.removeEventListener("pointerup",d),window.removeEventListener("pointercancel",d),l&&(l=!1,h(v))},f=()=>{o=!0,window.addEventListener("pointerup",d,r),window.addEventListener("pointercancel",d,r)},p=v=>{if(v.pointerType!=="touch"){if(o){l=!0;return}h(v)}},g=v=>{if(!lh(v))return;l=!1;const y=e(a,v);typeof y=="function"&&(c=y,a.addEventListener("pointerleave",p,r))};a.addEventListener("pointerenter",g,r),a.addEventListener("pointerdown",f,r)}),i}const So=(t,e)=>e?t===e?!0:So(t,e.parentElement):!1,dr=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1,uh=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function hh(t){return uh.has(t.tagName)||t.isContentEditable===!0}const dh=new Set(["INPUT","SELECT","TEXTAREA"]);function fh(t){return dh.has(t.tagName)||t.isContentEditable===!0}const is=new WeakSet;function Jr(t){return e=>{e.key==="Enter"&&t(e)}}function Bs(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const ph=(t,e)=>{const s=t.currentTarget;if(!s)return;const n=Jr(()=>{if(is.has(s))return;Bs(s,"down");const r=Jr(()=>{Bs(s,"up")}),i=()=>Bs(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 Yr(t){return dr(t)&&!xo()}const Xr=new WeakSet;function mh(t,e,s={}){const[n,r,i]=_o(t,s),a=o=>{const l=o.currentTarget;if(!Yr(o)||Xr.has(o))return;is.add(l),s.stopPropagation&&Xr.add(o);const c=e(l,o),u=(f,p)=>{window.removeEventListener("pointerup",h),window.removeEventListener("pointercancel",d),is.has(l)&&is.delete(l),Yr(f)&&typeof c=="function"&&c(f,{success:p})},h=f=>{u(f,l===window||l===document||s.useGlobalTarget||So(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),rs(o)&&(o.addEventListener("focus",c=>ph(c,r)),!hh(o)&&!o.hasAttribute("tabindex")&&(o.tabIndex=0))}),i}function fr(t){return ka(t)&&"ownerSVGElement"in t}const as=new WeakMap;let Pe;const To=(t,e,s)=>(n,r)=>r&&r[0]?r[0][t+"Size"]:fr(n)&&"getBBox"in n?n.getBBox()[e]:n[s],gh=To("inline","width","offsetWidth"),yh=To("block","height","offsetHeight");function vh({target:t,borderBoxSize:e}){var s;(s=as.get(t))==null||s.forEach(n=>{n(t,{get width(){return gh(t,e)},get height(){return yh(t,e)}})})}function wh(t){t.forEach(vh)}function bh(){typeof ResizeObserver>"u"||(Pe=new ResizeObserver(wh))}function xh(t,e){Pe||bh();const s=wo(t);return s.forEach(n=>{let r=as.get(n);r||(r=new Set,as.set(n,r)),r.add(e),Pe==null||Pe.observe(n)}),()=>{s.forEach(n=>{const r=as.get(n);r==null||r.delete(e),r!=null&&r.size||Pe==null||Pe.unobserve(n)})}}const os=new Set;let lt;function _h(){lt=()=>{const t={get width(){return window.innerWidth},get height(){return window.innerHeight}};os.forEach(e=>e(t))},window.addEventListener("resize",lt)}function Sh(t){return os.add(t),lt||_h(),()=>{os.delete(t),!os.size&&typeof lt=="function"&&(window.removeEventListener("resize",lt),lt=void 0)}}function Zr(t,e){return typeof t=="function"?Sh(t):xh(t,e)}function Th(t){return fr(t)&&t.tagName==="svg"}const kh=[...go,U,fe],Ah=t=>kh.find(mo(t)),Qr=()=>({translate:0,scale:1,origin:0,originPoint:0}),ct=()=>({x:Qr(),y:Qr()}),ei=()=>({min:0,max:0}),W=()=>({x:ei(),y:ei()}),Eh=new WeakMap;function Es(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}function Dt(t){return typeof t=="string"||Array.isArray(t)}const pr=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],mr=["initial",...pr];function Ps(t){return Es(t.animate)||mr.some(e=>Dt(t[e]))}function ko(t){return!!(Ps(t)||t.variants)}function Ph(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,mt(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,mt(a!==void 0?a:r,{owner:t}))}}for(const n in s)e[n]===void 0&&t.removeValue(n);return e}const kn={current:null},Ao={current:!1},Ch=typeof window<"u";function Rh(){if(Ao.current=!0,!!Ch)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>kn.current=t.matches;t.addEventListener("change",e),e()}else kn.current=!1}const ti=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let ys={};function Eo(t){ys=t}function jh(){return ys}class Oh{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=ir,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=Ps(s),this.isVariantNode=ko(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 p=d[f];c[f]!==void 0&&J(p)&&p.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,Eh.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:(Ao.current||Rh(),this.shouldReduceMotion=kn.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&&ao.has(e)&&this.current instanceof HTMLElement){const{factory:a,keyframes:o,times:l,ease:c,duration:u}=s.accelerate,h=new ro({element:this.current,name:e,keyframes:o,times:l,ease:c,duration:Z(u)}),d=a(h);this.valueSubscriptions.set(e,()=>{d(),h.cancel()});return}const n=wt.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 ys){const s=ys[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):W()}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<ti.length;n++){const r=ti[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=Ph(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=mt(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"&&(Ta(n)||Aa(n))?n=parseFloat(n):!Ah(n)&&fe.test(s)&&(n=vo(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=lr(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 Yn),this.events[e].add(s)}notify(e,...s){this.events[e]&&this.events[e].notify(...s)}scheduleRenderMicrotask(){hr.render(this.render)}}class Po extends Oh{constructor(){super(...arguments),this.KeyframeResolver=ah}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 Ne{constructor(e){this.isMounted=!1,this.node=e}update(){}}function Co({top:t,left:e,right:s,bottom:n}){return{x:{min:e,max:s},y:{min:t,max:n}}}function Dh({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function Ih(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 Vs(t){return t===void 0||t===1}function An({scale:t,scaleX:e,scaleY:s}){return!Vs(t)||!Vs(e)||!Vs(s)}function Ve(t){return An(t)||Ro(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function Ro(t){return si(t.x)||si(t.y)}function si(t){return t&&t!=="0%"}function vs(t,e,s){const n=t-s,r=e*n;return s+r}function ni(t,e,s,n,r){return r!==void 0&&(t=vs(t,r,n)),vs(t,s,n)+e}function En(t,e=0,s=1,n,r){t.min=ni(t.min,e,s,n,r),t.max=ni(t.max,e,s,n,r)}function jo(t,{x:e,y:s}){En(t.x,e.translate,e.scale,e.originPoint),En(t.y,s.translate,s.scale,s.originPoint)}const ri=.999999999999,ii=1.0000000000001;function Nh(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,jo(t,a)),n&&Ve(i.latestValues)&&ls(t,i.latestValues,(o=i.layout)==null?void 0:o.layoutBox))}e.x<ii&&e.x>ri&&(e.x=1),e.y<ii&&e.y>ri&&(e.y=1)}function ve(t,e){t.min+=e,t.max+=e}function ai(t,e,s,n,r=.5){const i=N(t.min,t.max,r);En(t,e,s,i,n)}function oi(t,e){return typeof t=="string"?parseFloat(t)/100*(e.max-e.min):t}function ls(t,e,s){const n=s??t;ai(t.x,oi(e.x,n.x),e.scaleX,e.scale,e.originX),ai(t.y,oi(e.y,n.y),e.scaleY,e.scale,e.originY)}function Oo(t,e){return Co(Ih(t.getBoundingClientRect(),e))}function Mh(t,e,s){const n=Oo(t,s),{scroll:r}=e;return r&&(ve(n.x,r.offset.x),ve(n.y,r.offset.y)),n}const $h={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},Lh=vt.length;function Bh(t,e,s){let n="",r=!0;for(let i=0;i<Lh;i++){const a=vt[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=bo(o,ur[a]);if(!l){r=!1;const u=$h[a]||a;n+=`${u}(${c}) `}s&&(e[a]=c)}}return n=n.trim(),s?n=s(e,r?"":n):r&&(n="none"),n}function gr(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(wt.has(l)){a=!0;continue}else if(Ua(l)){r[l]=c;continue}else{const u=bo(c,ur[l]);l.startsWith("origin")?(o=!0,i[l]=u):n[l]=u}}if(e.transform||(a||s?n.transform=Bh(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 Do(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 li(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const bt={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(T.test(t))t=parseFloat(t);else return t;const s=li(t,e.target.x),n=li(t,e.target.y);return`${s}% ${n}%`}},Vh={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)}},Pn={borderRadius:{...bt,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:bt,borderTopRightRadius:bt,borderBottomLeftRadius:bt,borderBottomRightRadius:bt,boxShadow:Vh};function Io(t,{layout:e,layoutId:s}){return wt.has(t)||t.startsWith("origin")||(e||s!==void 0)&&(!!Pn[t]||t==="opacity")}function yr(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])||Io(o,t)||((a=s==null?void 0:s.getValue(o))==null?void 0:a.liveStyle)!==void 0)&&(i[o]=n[o]);return i}function Uh(t){return window.getComputedStyle(t)}class Fh extends Po{constructor(){super(...arguments),this.type="html",this.renderInstance=Do}readValueFromInstance(e,s){var n;if(wt.has(s))return(n=this.projection)!=null&&n.isProjecting?pn(s):ou(e,s);{const r=Uh(e),i=(Ua(s)?r.getPropertyValue(s):r[s])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(e,{transformPagePoint:s}){return Oo(e,s)}build(e,s,n){gr(e,s,n.transformTemplate)}scrapeMotionValuesFromProps(e,s,n){return yr(e,s,n)}}const Wh={offset:"stroke-dashoffset",array:"stroke-dasharray"},qh={offset:"strokeDashoffset",array:"strokeDasharray"};function Hh(t,e,s=1,n=0,r=!0){t.pathLength=1;const i=r?Wh:qh;t[i.offset]=`${-n}`,t[i.array]=`${e} ${s}`}const Kh=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function No(t,{attrX:e,attrY:s,attrScale:n,pathLength:r,pathSpacing:i=1,pathOffset:a=0,...o},l,c,u){if(gr(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 Kh)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&&Hh(h,r,i,a,!1)}const Mo=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"]),$o=t=>typeof t=="string"&&t.toLowerCase()==="svg";function zh(t,e,s,n){Do(t,e,void 0,n);for(const r in e.attrs)t.setAttribute(Mo.has(r)?r:cr(r),e.attrs[r])}function Lo(t,e,s){const n=yr(t,e,s);for(const r in t)if(J(t[r])||J(e[r])){const i=vt.indexOf(r)!==-1?"attr"+r.charAt(0).toUpperCase()+r.substring(1):r;n[i]=t[r]}return n}class Gh extends Po{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=W}getBaseTargetFromProps(e,s){return e[s]}readValueFromInstance(e,s){if(wt.has(s)){const n=yo(s);return n&&n.default||0}return s=Mo.has(s)?s:cr(s),e.getAttribute(s)}scrapeMotionValuesFromProps(e,s,n){return Lo(e,s,n)}build(e,s,n){No(e,s,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(e,s,n,r){zh(e,s,n,r)}mount(e){this.isSVGTag=$o(e.tagName),super.mount(e)}}const Jh=mr.length;function Bo(t){if(!t)return;if(!t.isControllingVariants){const s=t.parent?Bo(t.parent)||{}:{};return t.props.initial!==void 0&&(s.initial=t.props.initial),s}const e={};for(let s=0;s<Jh;s++){const n=mr[s],r=t.props[n];(Dt(r)||r===!1)&&(e[n]=r)}return e}function Vo(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 Yh=[...pr].reverse(),Xh=pr.length;function Zh(t){return e=>Promise.all(e.map(({animation:s,options:n})=>Ju(t,s,n)))}function Qh(t){let e=Zh(t),s=ci(),n=!0,r=!1;const i=c=>(u,h)=>{var f;const d=Je(t,h,c==="exit"?(f=t.presenceContext)==null?void 0:f.custom:void 0);if(d){const{transition:p,transitionEnd:g,...v}=d;u={...u,...v,...g}}return u};function a(c){e=c(t)}function o(c){const{props:u}=t,h=Bo(t.parent)||{},d=[],f=new Set;let p={},g=1/0;for(let y=0;y<Xh;y++){const b=Yh[y],w=s[b],x=u[b]!==void 0?u[b]:h[b],S=Dt(x),A=b===c?w.isActive:null;A===!1&&(g=y);let O=x===h[b]&&x!==u[b]&&S;if(O&&(n||r)&&t.manuallyAnimateOnMount&&(O=!1),w.protectedKeys={...p},!w.isActive&&A===null||!x&&!w.prevProp||Es(x)||typeof x=="boolean")continue;if(b==="exit"&&w.isActive&&A!==!0){w.prevResolvedValues&&(p={...p,...w.prevResolvedValues});continue}const E=ed(w.prevProp,x);let j=E||b===c&&w.isActive&&!O&&S||y>g&&S,P=!1;const M=Array.isArray(x)?x:[x];let q=M.reduce(i(b),{});A===!1&&(q={});const{prevResolvedValues:xe={}}=w,pe={...xe,...q},_e=H=>{j=!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=q[H],Me=xe[H];if(p.hasOwnProperty(H))continue;let Ye=!1;bn(se)&&bn(Me)?Ye=!Vo(se,Me):Ye=se!==Me,Ye?se!=null?_e(H):f.add(H):se!==void 0&&f.has(H)?_e(H):w.protectedKeys[H]=!0}w.prevProp=x,w.prevResolvedValues=q,w.isActive&&(p={...p,...q}),(n||r)&&t.blockInitialAnimation&&(j=!1);const me=O&&E;j&&(!me||P)&&d.push(...M.map(H=>{const se={type:b};if(typeof H=="string"&&(n||r)&&!me&&t.manuallyAnimateOnMount&&t.parent){const{parent:Me}=t,Ye=Je(Me,H);if(Me.enteringChildren&&Ye){const{delayChildren:Vl}=Ye.transition||{};se.delay=oo(Me.enteringChildren,t,Vl)}}return{animation:H,options:se}}))}if(f.size){const y={};if(typeof u.initial!="boolean"){const b=Je(t,Array.isArray(u.initial)?u.initial[0]:u.initial);b&&b.transition&&(y.transition=b.transition)}f.forEach(b=>{const w=t.getBaseTarget(b),x=t.getValue(b);x&&(x.liveStyle=!0),y[b]=w??null}),d.push({animation:y})}let v=!!d.length;return n&&(u.initial===!1||u.initial===u.animate)&&!t.manuallyAnimateOnMount&&(v=!1),n=!1,r=!1,v?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 p;return(p=f.animationState)==null?void 0:p.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=ci(),r=!0}}}function ed(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!Vo(e,t):!1}function $e(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function ci(){return{animate:$e(!0),whileInView:$e(),whileHover:$e(),whileTap:$e(),whileDrag:$e(),whileFocus:$e(),exit:$e()}}function Cn(t,e){t.min=e.min,t.max=e.max}function oe(t,e){Cn(t.x,e.x),Cn(t.y,e.y)}function ui(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}const Uo=1e-4,td=1-Uo,sd=1+Uo,Fo=.01,nd=0-Fo,rd=0+Fo;function X(t){return t.max-t.min}function id(t,e,s){return Math.abs(t-e)<=s}function hi(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>=td&&t.scale<=sd||isNaN(t.scale))&&(t.scale=1),(t.translate>=nd&&t.translate<=rd||isNaN(t.translate))&&(t.translate=0)}function kt(t,e,s,n){hi(t.x,e.x,s.x,n?n.originX:void 0),hi(t.y,e.y,s.y,n?n.originY:void 0)}function di(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 ad(t,e,s,n){di(t.x,e.x,s.x,n==null?void 0:n.x),di(t.y,e.y,s.y,n==null?void 0:n.y)}function fi(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 ws(t,e,s,n){fi(t.x,e.x,s.x,n==null?void 0:n.x),fi(t.y,e.y,s.y,n==null?void 0:n.y)}function pi(t,e,s,n,r){return t-=e,t=vs(t,1/s,n),r!==void 0&&(t=vs(t,1/r,n)),t}function od(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=pi(t.min,e,s,o,r),t.max=pi(t.max,e,s,o,r)}function mi(t,e,[s,n,r],i,a){od(t,e[s],e[n],e[r],e.scale,i,a)}const ld=["x","scaleX","originX"],cd=["y","scaleY","originY"];function gi(t,e,s,n){mi(t.x,e,ld,s?s.x:void 0,n?n.x:void 0),mi(t.y,e,cd,s?s.y:void 0,n?n.y:void 0)}function yi(t){return t.translate===0&&t.scale===1}function Wo(t){return yi(t.x)&&yi(t.y)}function vi(t,e){return t.min===e.min&&t.max===e.max}function ud(t,e){return vi(t.x,e.x)&&vi(t.y,e.y)}function wi(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function qo(t,e){return wi(t.x,e.x)&&wi(t.y,e.y)}function bi(t){return X(t.x)/X(t.y)}function xi(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}function ye(t){return[t("x"),t("y")]}function hd(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:p}=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) `),p&&(n+=`skewY(${p}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 Ho=["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"],dd=Ho.length,_i=t=>typeof t=="string"?parseFloat(t):t,Si=t=>typeof t=="number"||T.test(t);function fd(t,e,s,n,r,i){r?(t.opacity=N(0,s.opacity??1,pd(n)),t.opacityExit=N(e.opacity??1,0,md(n))):i&&(t.opacity=N(e.opacity??1,s.opacity??1,n));for(let a=0;a<dd;a++){const o=Ho[a];let l=Ti(e,o),c=Ti(s,o);if(l===void 0&&c===void 0)continue;l||(l=0),c||(c=0),l===0||c===0||Si(l)===Si(c)?(t[o]=Math.max(N(_i(l),_i(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 Ti(t,e){return t[e]!==void 0?t[e]:t.borderRadius}const pd=Ko(0,.5,Na),md=Ko(.5,.95,ie);function Ko(t,e,s){return n=>n<t?0:n>e?1:s(jt(t,e,n))}function gd(t,e,s){const n=J(t)?t:mt(t);return n.start(or("",n,e,s)),n.animation}function It(t,e,s,n={passive:!0}){return t.addEventListener(e,s,n),()=>t.removeEventListener(e,s)}const yd=(t,e)=>t.depth-e.depth;class vd{constructor(){this.children=[],this.isDirty=!1}add(e){Jn(this.children,e),this.isDirty=!0}remove(e){ds(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(yd),this.isDirty=!1,this.children.forEach(e)}}function wd(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 cs(t){return J(t)?t.get():t}class bd{constructor(){this.members=[]}add(e){Jn(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&&(ds(this.members,n),n.unmount())}e.scheduleRender()}remove(e){if(ds(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 us={hasAnimatedSinceResize:!0,hasEverUpdated:!1},Us=["","X","Y","Z"],xd=1e3;let _d=0;function Fs(t,e,s,n){const{latestValues:r}=e;r[t]&&(s[t]=r[t],e.setStaticValue(t,0),n&&(n[t]=0))}function zo(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const s=fo(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&&zo(n)}function Go({attachResizeListener:t,defaultParent:e,measureScroll:s,checkIsScrollRoot:n,resetTransform:r}){return class{constructor(a={},o=e==null?void 0:e()){this.id=_d++,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(kd),this.nodes.forEach(jd),this.nodes.forEach(Od),this.nodes.forEach(Ad)},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 vd)}addEventListener(a,o){return this.eventHandlers.has(a)||this.eventHandlers.set(a,new Yn),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=fr(a)&&!Th(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=wd(d,250),us.hasAnimatedSinceResize&&(us.hasAnimatedSinceResize=!1,this.nodes.forEach(Ei)))})}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 p=this.options.transition||c.getDefaultTransition()||$d,{onLayoutAnimationStart:g,onLayoutAnimationComplete:v}=c.getProps(),y=!this.targetLayout||!qo(this.targetLayout,f),b=!h&&d;if(this.options.layoutRoot||this.resumeFrom||b||h&&(y||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const w={...ar(p,"layout"),onPlay:g,onComplete:v};(c.shouldReduceMotion||this.options.layoutRoot)&&(w.delay=0,w.type=!1),this.startAnimation(w),this.setAnimationOrigin(u,b)}else h||Ei(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(Dd),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&&zo(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(Pd),this.nodes.forEach(ki);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(Ai);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(Cd),this.nodes.forEach(Rd),this.nodes.forEach(Sd),this.nodes.forEach(Td)):this.nodes.forEach(Ai),this.clearAllSnapshots();const o=Y.now();G.delta=be(0,1e3/60,o-G.timestamp),G.timestamp=o,G.isProcessing=!0,Ds.update.process(G),Ds.preRender.process(G),Ds.render.process(G),G.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,hr.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(Ed),this.sharedNodes.forEach(Id)}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=W()),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&&!Wo(this.projectionDelta),l=this.getTransformTemplate(),c=l?l(this.latestValues,""):void 0,u=c!==this.prevTransformTemplateValue;a&&this.instance&&(o||Ve(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)),Ld(l),{animationId:this.root.animationId,measuredBox:o,layoutBox:l,latestValues:{},source:this.id}}measurePageBox(){var c;const{visualElement:a}=this.options;if(!a)return W();const o=a.measureViewportBox();if(!(((c=this.scroll)==null?void 0:c.wasRoot)||this.path.some(Bd))){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=W();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||W();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)),Ve(f.latestValues)&&ls(c,f.latestValues,(u=f.layout)==null?void 0:u.layoutBox)}return Ve(this.latestValues)&&ls(c,this.latestValues,(h=this.layout)==null?void 0:h.layoutBox),c}removeTransform(a){var l;const o=W();oe(o,a);for(let c=0;c<this.path.length;c++){const u=this.path[c];if(!Ve(u.latestValues))continue;let h;u.instance&&(An(u.latestValues)&&u.updateSnapshot(),h=W(),oe(h,u.measurePageBox())),gi(o,u.latestValues,(l=u.snapshot)==null?void 0:l.layoutBox,h)}return Ve(this.latestValues)&&gi(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!==G.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=G.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=W(),this.targetWithTransforms=W()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),ad(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),jo(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||An(this.parent.latestValues)||Ro(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=W(),this.relativeTargetOrigin=W(),ws(this.relativeTargetOrigin,o,l,this.options.layoutAnchor||void 0),oe(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){var p;const a=this.getLead(),o=!!this.resumingFrom||this!==a;let l=!0;if((this.isProjectionDirty||(p=this.parent)!=null&&p.isProjectionDirty)&&(l=!1),o&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(l=!1),this.resolvedRelativeTargetAt===G.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;Nh(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=W());const{target:f}=a;if(!f){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(ui(this.prevProjectionDelta.x,this.projectionDelta.x),ui(this.prevProjectionDelta.y,this.projectionDelta.y)),kt(this.projectionDelta,this.layoutCorrected,f,this.latestValues),(this.treeScale.x!==h||this.treeScale.y!==d||!xi(this.projectionDelta.x,this.prevProjectionDelta.x)||!xi(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=ct(),this.projectionDelta=ct(),this.projectionDeltaWithTransform=ct()}setAnimationOrigin(a,o=!1){const l=this.snapshot,c=l?l.latestValues:{},u={...this.latestValues},h=ct();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!o;const d=W(),f=l?l.source:void 0,p=this.layout?this.layout.source:void 0,g=f!==p,v=this.getStack(),y=!v||v.members.length<=1,b=!!(g&&!y&&this.options.crossfade===!0&&!this.path.some(Md));this.animationProgress=0;let w;this.mixTargetDelta=x=>{const S=x/1e3;Pi(h.x,a.x,S),Pi(h.y,a.y,S),this.setTargetDelta(h),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(ws(d,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),Nd(this.relativeTarget,this.relativeTargetOrigin,d,S),w&&ud(this.relativeTarget,w)&&(this.isProjectionDirty=!1),w||(w=W()),oe(w,this.relativeTarget)),g&&(this.animationValues=u,fd(u,c,this.latestValues,S,b,y)),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(()=>{us.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=mt(0)),this.motionValue.jump(0,!1),this.currentAnimation=gd(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(xd),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&&Jo(this.options.animationType,this.layout.layoutBox,c.layoutBox)){l=this.target||W();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),ls(o,u),kt(this.projectionDeltaWithTransform,this.layoutCorrected,o,u)}}registerSharedNode(a,o){this.sharedNodes.has(a)||this.sharedNodes.set(a,new bd),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&&Fs("z",a,c,this.animationValues);for(let u=0;u<Us.length;u++)Fs(`rotate${Us[u]}`,a,c,this.animationValues),Fs(`skew${Us[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=cs(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=cs(o==null?void 0:o.pointerEvents)||""),this.hasProjected&&!Ve(this.latestValues)&&(a.transform=l?l({},""):"none",this.hasProjected=!1);return}a.visibility="";const u=c.animationValues||c.latestValues;this.applyTransformsToTarget();let h=hd(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 p in Pn){if(u[p]===void 0)continue;const{correct:g,applyTo:v,isCSSVariable:y}=Pn[p],b=h==="none"?u[p]:g(u[p],c);if(v){const w=v.length;for(let x=0;x<w;x++)a[v[x]]=b}else y?this.options.visualElement.renderState.vars[p]=b:a[p]=b}this.options.layoutId&&(a.pointerEvents=c===this?cs(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(ki),this.root.sharedNodes.clear()}}}function Sd(t){t.updateLayout()}function Td(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";Cn(a?e.measuredBox[h]:e.layoutBox[h],n[h])}else Jo(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=ct();kt(o,n,e.layoutBox);const l=ct();a?kt(l,t.applyTransform(r,!0),e.measuredBox):kt(l,n,e.layoutBox);const c=!Wo(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 p=t.options.layoutAnchor||void 0,g=W();ws(g,e.layoutBox,d.layoutBox,p);const v=W();ws(v,n,f.layoutBox,p),qo(g,v)||(u=!0),h.options.layoutRoot&&(t.relativeTarget=v,t.relativeTargetOrigin=g,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 kd(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 Ad(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function Ed(t){t.clearSnapshot()}function ki(t){t.clearMeasurements()}function Pd(t){t.isLayoutDirty=!0,t.updateLayout()}function Ai(t){t.isLayoutDirty=!1}function Cd(t){t.isAnimationBlocked&&t.layout&&!t.isLayoutDirty&&(t.snapshot=t.layout,t.isLayoutDirty=!0)}function Rd(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function Ei(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function jd(t){t.resolveTargetDelta()}function Od(t){t.calcProjection()}function Dd(t){t.resetSkewAndRotation()}function Id(t){t.removeLeadSnapshot()}function Pi(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 Ci(t,e,s,n){t.min=N(e.min,s.min,n),t.max=N(e.max,s.max,n)}function Nd(t,e,s,n){Ci(t.x,e.x,s.x,n),Ci(t.y,e.y,s.y,n)}function Md(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const $d={duration:.45,ease:[.4,0,.1,1]},Ri=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),ji=Ri("applewebkit/")&&!Ri("chrome/")?Math.round:ie;function Oi(t){t.min=ji(t.min),t.max=ji(t.max)}function Ld(t){Oi(t.x),Oi(t.y)}function Jo(t,e,s){return t==="position"||t==="preserve-aspect"&&!id(bi(e),bi(s),.2)}function Bd(t){var e;return t!==t.root&&((e=t.scroll)==null?void 0:e.wasRoot)}const Vd=Go({attachResizeListener:(t,e)=>It(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}),Ws={current:void 0},Yo=Go({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!Ws.current){const t=new Vd({});t.mount(window),t.setOptions({layoutScroll:!0}),Ws.current=t}return Ws.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),vr=_.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});function Di(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Ud(...t){return e=>{let s=!1;const n=t.map(r=>{const i=Di(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():Di(t[r],null)}}}}function Fd(...t){return _.useCallback(Ud(...t),t)}class Wd extends _.Component{getSnapshotBeforeUpdate(e){const s=this.props.childRef.current;if(rs(s)&&e.isPresent&&!this.props.isPresent&&this.props.pop!==!1){const n=s.offsetParent,r=rs(n)&&n.offsetWidth||0,i=rs(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 qd({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(vr),u=((d=t.props)==null?void 0:d.ref)??(t==null?void 0:t.ref),h=Fd(o,u);return _.useInsertionEffect(()=>{const{width:f,height:p,top:g,left:v,right:y,bottom:b}=l.current;if(e||i===!1||!o.current||!f||!p)return;const w=s==="left"?`left: ${v}`:`right: ${y}`,x=n==="bottom"?`bottom: ${b}`:`top: ${g}`;o.current.dataset.motionPopId=a;const S=document.createElement("style");c&&(S.nonce=c);const A=r??document.head;return A.appendChild(S),S.sheet&&S.sheet.insertRule(`
          [data-motion-pop-id="${a}"] {
            position: absolute !important;
            width: ${f}px !important;
            height: ${p}px !important;
            ${w}px !important;
            ${x}px !important;
          }
        `),()=>{var O;(O=o.current)==null||O.removeAttribute("data-motion-pop-id"),A.contains(S)&&A.removeChild(S)}},[e]),m.jsx(Wd,{isPresent:e,childRef:o,sizeRef:l,pop:i,children:i===!1?t:_.cloneElement(t,{ref:h})})}const Hd=({children:t,initial:e,isPresent:s,onExitComplete:n,custom:r,presenceAffectsLayout:i,mode:a,anchorX:o,anchorY:l,root:c})=>{const u=Gn(Kd),h=_.useId();let d=!0,f=_.useMemo(()=>(d=!1,{id:h,initial:e,isPresent:s,custom:r,onExitComplete:p=>{u.set(p,!0);for(const g of u.values())if(!g)return;n&&n()},register:p=>(u.set(p,!1),()=>u.delete(p))}),[s,u,n]);return i&&d&&(f={...f}),_.useMemo(()=>{u.forEach((p,g)=>u.set(g,!1))},[s]),_.useEffect(()=>{!s&&!u.size&&n&&n()},[s]),t=m.jsx(qd,{pop:a==="popLayout",isPresent:s,anchorX:o,anchorY:l,root:c,children:t}),m.jsx(Ts.Provider,{value:f,children:t})};function Kd(){return new Map}function Xo(t=!0){const e=_.useContext(Ts);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 Jt=t=>t.key||"";function Ii(t){const e=[];return _.Children.forEach(t,s=>{_.isValidElement(s)&&e.push(s)}),e}const Rn=({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]=Xo(a),d=_.useMemo(()=>Ii(t),[t]),f=a&&!u?[]:d.map(Jt),p=_.useRef(!0),g=_.useRef(d),v=Gn(()=>new Map),y=_.useRef(new Set),[b,w]=_.useState(d),[x,S]=_.useState(d);Sa(()=>{p.current=!1,g.current=d;for(let E=0;E<x.length;E++){const j=Jt(x[E]);f.includes(j)?(v.delete(j),y.current.delete(j)):v.get(j)!==!0&&v.set(j,!1)}},[x,f.length,f.join("-")]);const A=[];if(d!==b){let E=[...d];for(let j=0;j<x.length;j++){const P=x[j],M=Jt(P);f.includes(M)||(E.splice(j,0,P),A.push(P))}return i==="wait"&&A.length&&(E=A),S(Ii(E)),w(d),null}const{forceRender:O}=_.useContext(zn);return m.jsx(m.Fragment,{children:x.map(E=>{const j=Jt(E),P=a&&!u?!1:d===x||f.includes(j),M=()=>{if(y.current.has(j))return;if(v.has(j))y.current.add(j),v.set(j,!0);else return;let q=!0;v.forEach(xe=>{xe||(q=!1)}),q&&(O==null||O(),S(g.current),a&&(h==null||h()),n&&n())};return m.jsx(Hd,{isPresent:P,initial:!p.current||s?void 0:!1,custom:e,presenceAffectsLayout:r,mode:i,root:c,onExitComplete:P?void 0:M,anchorX:o,anchorY:l,children:E},j)})})},Zo=_.createContext({strict:!1}),Ni={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 Mi=!1;function zd(){if(Mi)return;const t={};for(const e in Ni)t[e]={isEnabled:s=>Ni[e].some(n=>!!s[n])};Eo(t),Mi=!0}function Qo(){return zd(),jh()}function Gd(t){const e=Qo();for(const s in t)e[s]={...e[s],...t[s]};Eo(e)}const Jd=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 bs(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||Jd.has(t)}let el=t=>!bs(t);function Yd(t){typeof t=="function"&&(el=e=>e.startsWith("on")?!bs(e):t(e))}try{Yd(require("@emotion/is-prop-valid").default)}catch{}function Xd(t,e,s){const n={};for(const r in t)r==="values"&&typeof t.values=="object"||J(t[r])||(el(r)||s===!0&&bs(r)||!e&&!bs(r)||t.draggable&&r.startsWith("onDrag"))&&(n[r]=t[r]);return n}const Cs=_.createContext({});function Zd(t,e){if(Ps(t)){const{initial:s,animate:n}=t;return{initial:s===!1||Dt(s)?s:void 0,animate:Dt(n)?n:void 0}}return t.inherit!==!1?e:{}}function Qd(t){const{initial:e,animate:s}=Zd(t,_.useContext(Cs));return _.useMemo(()=>({initial:e,animate:s}),[$i(e),$i(s)])}function $i(t){return Array.isArray(t)?t.join(" "):t}const wr=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function tl(t,e,s){for(const n in e)!J(e[n])&&!Io(n,s)&&(t[n]=e[n])}function ef({transformTemplate:t},e){return _.useMemo(()=>{const s=wr();return gr(s,e,t),Object.assign({},s.vars,s.style)},[e])}function tf(t,e){const s=t.style||{},n={};return tl(n,s,t),Object.assign(n,ef(t,e)),n}function sf(t,e){const s={},n=tf(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 sl=()=>({...wr(),attrs:{}});function nf(t,e,s,n){const r=_.useMemo(()=>{const i=sl();return No(i,e,$o(n),t.transformTemplate,t.style),{...i.attrs,style:{...i.style}}},[e]);if(t.style){const i={};tl(i,t.style,t),r.style={...i,...r.style}}return r}const rf=["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 br(t){return typeof t!="string"||t.includes("-")?!1:!!(rf.indexOf(t)>-1||/[A-Z]/u.test(t))}function af(t,e,s,{latestValues:n},r,i=!1,a){const l=(a??br(t)?nf:sf)(e,n,r,t),c=Xd(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 of({scrapeMotionValuesFromProps:t,createRenderState:e},s,n,r){return{latestValues:lf(s,n,r,t),renderState:e()}}function lf(t,e,s,n){const r={},i=n(t,{});for(const d in i)r[d]=cs(i[d]);let{initial:a,animate:o}=t;const l=Ps(t),c=ko(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"&&!Es(h)){const d=Array.isArray(h)?h:[h];for(let f=0;f<d.length;f++){const p=lr(t,d[f]);if(p){const{transitionEnd:g,transition:v,...y}=p;for(const b in y){let w=y[b];if(Array.isArray(w)){const x=u?w.length-1:0;w=w[x]}w!==null&&(r[b]=w)}for(const b in g)r[b]=g[b]}}}return r}const nl=t=>(e,s)=>{const n=_.useContext(Cs),r=_.useContext(Ts),i=()=>of(t,e,n,r);return s?i():Gn(i)},cf=nl({scrapeMotionValuesFromProps:yr,createRenderState:wr}),uf=nl({scrapeMotionValuesFromProps:Lo,createRenderState:sl}),hf=Symbol.for("motionComponentSymbol");function df(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 rl=_.createContext({});function nt(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function ff(t,e,s,n,r,i){var w,x;const{visualElement:a}=_.useContext(Cs),o=_.useContext(Zo),l=_.useContext(Ts),c=_.useContext(vr),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 p=d.current,g=_.useContext(rl);p&&!p.projection&&r&&(p.type==="html"||p.type==="svg")&&pf(d.current,s,r,g);const v=_.useRef(!1);_.useInsertionEffect(()=>{p&&v.current&&p.update(s,l)});const y=s[ho],b=_.useRef(!!y&&typeof window<"u"&&!((w=window.MotionHandoffIsComplete)!=null&&w.call(window,y))&&((x=window.MotionHasOptimisedAnimation)==null?void 0:x.call(window,y)));return Sa(()=>{f.current=!0,p&&(v.current=!0,window.MotionIsMounted=!0,p.updateFeatures(),p.scheduleRenderMicrotask(),b.current&&p.animationState&&p.animationState.animateChanges())}),_.useEffect(()=>{p&&(!b.current&&p.animationState&&p.animationState.animateChanges(),b.current&&(queueMicrotask(()=>{var S;(S=window.MotionHandoffMarkAsComplete)==null||S.call(window,y)}),b.current=!1),p.enteringChildren=void 0)}),p}function pf(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:il(t.parent)),t.projection.setOptions({layoutId:r,layout:i,alwaysMeasureLayout:!!a||o&&nt(o),visualElement:t,animationType:typeof i=="string"?i:"both",initialPromotionConfig:n,crossfade:h,layoutScroll:l,layoutRoot:c,layoutAnchor:u})}function il(t){if(t)return t.options.allowProjection!==!1?t.projection:il(t.parent)}function qs(t,{forwardMotionProps:e=!1,type:s}={},n,r){n&&Gd(n);const i=s?s==="svg":br(t),a=i?uf:cf;function o(c,u){let h;const d={..._.useContext(vr),...c,layoutId:mf(c)},{isStatic:f}=d,p=Qd(c),g=a(c,f);if(!f&&typeof window<"u"){gf();const v=yf(d);h=v.MeasureLayout,p.visualElement=ff(t,g,d,r,v.ProjectionNode,i)}return m.jsxs(Cs.Provider,{value:p,children:[h&&p.visualElement?m.jsx(h,{visualElement:p.visualElement,...d}):null,af(t,c,df(g,p.visualElement,u),g,f,e,i)]})}o.displayName=`motion.${typeof t=="string"?t:`create(${t.displayName??t.name??""})`}`;const l=_.forwardRef(o);return l[hf]=t,l}function mf({layoutId:t}){const e=_.useContext(zn).id;return e&&t!==void 0?e+"-"+t:t}function gf(t,e){_.useContext(Zo).strict}function yf(t){const e=Qo(),{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 vf(t,e){if(typeof Proxy>"u")return qs;const s=new Map,n=(i,a)=>qs(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,qs(a,void 0,t,e)),s.get(a))})}const wf=(t,e)=>e.isSVG??br(t)?new Gh(e):new Fh(e,{allowProjection:t!==_.Fragment});class bf extends Ne{constructor(e){super(e),e.animationState||(e.animationState=Qh(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();Es(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 xf=0;class _f extends Ne{constructor(){super(...arguments),this.id=xf++,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=Je(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 Sf={animation:{Feature:bf},exit:{Feature:_f}};function qt(t){return{point:{x:t.pageX,y:t.pageY}}}const Tf=t=>e=>dr(e)&&t(e,qt(e));function At(t,e,s,n){return It(t,e,Tf(s),n)}const al=({current:t})=>t?t.ownerDocument.defaultView:null,Li=(t,e)=>Math.abs(t-e);function kf(t,e){const s=Li(t.x,e.x),n=Li(t.y,e.y);return Math.sqrt(s**2+n**2)}const Bi=new Set(["auto","scroll"]);class ol{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=Yt(this.lastRawMoveEventInfo,this.transformPagePoint));const f=Hs(this.lastMoveEventInfo,this.history),p=this.startEvent!==null,g=kf(f.offset,{x:0,y:0})>=this.distanceThreshold;if(!p&&!g)return;const{point:v}=f,{timestamp:y}=G;this.history.push({...v,timestamp:y});const{onStart:b,onMove:w}=this.handlers;p||(b&&b(this.lastMoveEvent,f),this.startEvent=this.lastMoveEvent),w&&w(this.lastMoveEvent,f)},this.handlePointerMove=(f,p)=>{this.lastMoveEvent=f,this.lastRawMoveEventInfo=p,this.lastMoveEventInfo=Yt(p,this.transformPagePoint),D.update(this.updatePoint,!0)},this.handlePointerUp=(f,p)=>{this.end();const{onEnd:g,onSessionEnd:v,resumeAnimation:y}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&y&&y(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const b=Hs(f.type==="pointercancel"?this.lastMoveEventInfo:Yt(p,this.transformPagePoint),this.history);this.startEvent&&g&&g(f,b),v&&v(f,b)},!dr(e))return;this.dragSnapToOrigin=i,this.handlers=s,this.transformPagePoint=n,this.distanceThreshold=a,this.contextWindow=r||window;const l=qt(e),c=Yt(l,this.transformPagePoint),{point:u}=c,{timestamp:h}=G;this.history=[{...u,timestamp:h}];const{onSessionStart:d}=s;d&&d(e,Hs(c,this.history)),this.removeListeners=Ut(At(this.contextWindow,"pointermove",this.handlePointerMove),At(this.contextWindow,"pointerup",this.handlePointerUp),At(this.contextWindow,"pointercancel",this.handlePointerUp)),o&&this.startScrollTracking(o)}startScrollTracking(e){let s=e.parentElement;for(;s;){const n=getComputedStyle(s);(Bi.has(n.overflowX)||Bi.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 Yt(t,e){return e?{point:e(t.point)}:t}function Vi(t,e){return{x:t.x-e.x,y:t.y-e.y}}function Hs({point:t},e){return{point:t,delta:Vi(t,ll(e)),offset:Vi(t,Af(e)),velocity:Ef(e,.1)}}function Af(t){return t[0]}function ll(t){return t[t.length-1]}function Ef(t,e){if(t.length<2)return{x:0,y:0};let s=t.length-1,n=null;const r=ll(t);for(;s>=0&&(n=t[s],!(r.timestamp-n.timestamp>Z(e)));)s--;if(!n)return{x:0,y:0};n===t[0]&&t.length>2&&r.timestamp-n.timestamp>Z(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 Pf(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 Ui(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 Cf(t,{top:e,left:s,bottom:n,right:r}){return{x:Ui(t.x,s,r),y:Ui(t.y,e,n)}}function Fi(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 Rf(t,e){return{x:Fi(t.x,e.x),y:Fi(t.y,e.y)}}function jf(t,e){let s=.5;const n=X(t),r=X(e);return r>n?s=jt(e.min,e.max-n,t.min):n>r&&(s=jt(t.min,t.max-r,e.min)),be(0,1,s)}function Of(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 jn=.35;function Df(t=jn){return t===!1?t=0:t===!0&&(t=jn),{x:Wi(t,"left","right"),y:Wi(t,"top","bottom")}}function Wi(t,e,s){return{min:qi(t,e),max:qi(t,s)}}function qi(t,e){return typeof t=="number"?t:t[e]||0}const If=new WeakMap;class Nf{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=W(),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(qt(h).point),this.stopAnimation()},a=(h,d)=>{const{drag:f,dragPropagation:p,onDragStart:g}=this.getProps();if(f&&!p&&(this.openDragLock&&this.openDragLock(),this.openDragLock=oh(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(y=>{let b=this.getAxisMotionValue(y).get()||0;if(we.test(b)){const{projection:w}=this.visualElement;if(w&&w.layout){const x=w.layout.layoutBox[y];x&&(b=X(x)*(parseFloat(b)/100))}}this.originPoint[y]=b}),g&&D.update(()=>g(h,d),!1,!0),xn(this.visualElement,"transform");const{animationState:v}=this.visualElement;v&&v.setActive("whileDrag",!0)},o=(h,d)=>{this.latestPointerEvent=h,this.latestPanInfo=d;const{dragPropagation:f,dragDirectionLock:p,onDirectionLock:g,onDrag:v}=this.getProps();if(!f&&!this.openDragLock)return;const{offset:y}=d;if(p&&this.currentDirection===null){this.currentDirection=$f(y),this.currentDirection!==null&&g&&g(this.currentDirection);return}this.updateAxis("x",d.point,y),this.updateAxis("y",d.point,y),this.visualElement.render(),v&&D.update(()=>v(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 ol(e,{onSessionStart:i,onStart:a,onMove:o,onSessionEnd:l,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,distanceThreshold:n,contextWindow:al(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||!Xt(e,r,this.currentDirection))return;const i=this.getAxisMotionValue(e);let a=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(a=Pf(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&&nt(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&n?this.constraints=Cf(n.layoutBox,e):this.constraints=!1,this.elastic=Df(s),r!==this.constraints&&!nt(e)&&n&&this.constraints&&!this.hasMutatedConstraints&&ye(a=>{this.constraints!==!1&&this.getAxisMotionValue(a)&&(this.constraints[a]=Of(n.layoutBox[a],this.constraints[a]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:s}=this.getProps();if(!e||!nt(e))return!1;const n=e.current;ft(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=Mh(n,r.root,this.visualElement.getTransformPagePoint());let a=Rf(r.layout.layoutBox,i);if(s){const o=s(Dh(a));this.hasMutatedConstraints=!!o,o&&(a=Co(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(!Xt(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,p={type:"inertia",velocity:n?e[u]:0,bounceStiffness:d,bounceDamping:f,timeConstant:750,restDelta:1,restSpeed:10,...i,...h};return this.startAxisValueAnimation(u,p)});return Promise.all(c).then(o)}startAxisValueAnimation(e,s){const n=this.getAxisMotionValue(e);return xn(this.visualElement,e),n.start(or(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(!Xt(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(!nt(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]=jf({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(!Xt(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;If.set(this.visualElement,this);const e=this.visualElement.current,s=At(e,"pointerdown",c=>{const{drag:u,dragListener:h=!0}=this.getProps(),d=c.target,f=d!==e&&fh(d);u&&h&&!f&&this.start(c)});let n;const r=()=>{const{dragConstraints:c}=this.getProps();nt(c)&&c.current&&(this.constraints=this.resolveRefConstraints(),n||(n=Mf(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=It(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=jn,dragMomentum:o=!0}=e;return{...e,drag:s,dragDirectionLock:n,dragPropagation:r,dragConstraints:i,dragElastic:a,dragMomentum:o}}}function Hi(t){let e=!0;return()=>{if(e){e=!1;return}t()}}function Mf(t,e,s){const n=Zr(t,Hi(s)),r=Zr(e,Hi(s));return()=>{n(),r()}}function Xt(t,e,s){return(e===!0||e===t)&&(s===null||s===t)}function $f(t,e=10){let s=null;return Math.abs(t.y)>e?s="y":Math.abs(t.x)>e&&(s="x"),s}class Lf extends Ne{constructor(e){super(e),this.removeGroupControls=ie,this.removeListeners=ie,this.controls=new Nf(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 Ks=t=>(e,s)=>{t&&D.update(()=>t(e,s),!1,!0)};class Bf extends Ne{constructor(){super(...arguments),this.removePointerDownListener=ie}onPointerDown(e){this.session=new ol(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:al(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:s,onPan:n,onPanEnd:r}=this.node.getProps();return{onSessionStart:Ks(e),onStart:Ks(s),onMove:Ks(n),onEnd:(i,a)=>{delete this.session,r&&D.postRender(()=>r(i,a))}}}mount(){this.removePointerDownListener=At(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 zs=!1;class Vf 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),zs&&i.root.didUpdate(),i.addEventListener("animationComplete",()=>{this.safeToRemove()}),i.setOptions({...i.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),us.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}),zs=!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(),hr.postRender(()=>{!n.currentAnimation&&n.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:s,switchLayoutGroup:n}=this.props,{projection:r}=e;zs=!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 cl(t){const[e,s]=Xo(),n=_.useContext(zn);return m.jsx(Vf,{...t,layoutGroup:n,switchLayoutGroup:_.useContext(rl),isPresent:e,safeToRemove:s})}const Uf={pan:{Feature:Bf},drag:{Feature:Lf,ProjectionNode:Yo,MeasureLayout:cl}};function Ki(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,qt(e)))}class Ff extends Ne{mount(){const{current:e}=this.node;e&&(this.unmount=ch(e,(s,n)=>(Ki(this.node,n,"Start"),r=>Ki(this.node,r,"End"))))}unmount(){}}class Wf extends Ne{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=Ut(It(this.node.current,"focus",()=>this.onFocus()),It(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function zi(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,qt(e)))}class qf extends Ne{mount(){const{current:e}=this.node;if(!e)return;const{globalTapTarget:s,propagate:n}=this.node.props;this.unmount=mh(e,(r,i)=>(zi(this.node,i,"Start"),(a,{success:o})=>zi(this.node,a,o?"End":"Cancel")),{useGlobalTarget:s,stopPropagation:(n==null?void 0:n.tap)===!1})}unmount(){}}const On=new WeakMap,Gs=new WeakMap,Hf=t=>{const e=On.get(t.target);e&&e(t)},Kf=t=>{t.forEach(Hf)};function zf({root:t,...e}){const s=t||document;Gs.has(s)||Gs.set(s,{});const n=Gs.get(s),r=JSON.stringify(e);return n[r]||(n[r]=new IntersectionObserver(Kf,{root:t,...e})),n[r]}function Gf(t,e,s){const n=zf(e);return On.set(t,s),n.observe(t),()=>{On.delete(t),n.unobserve(t)}}const Jf={some:0,all:1};class Yf extends Ne{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:Jf[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=Gf(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(Xf(e,s))&&this.startObserver()}unmount(){var e;(e=this.stopObserver)==null||e.call(this),this.hasEnteredView=!1,this.isInView=!1}}function Xf({viewport:t={}},{viewport:e={}}={}){return s=>t[s]!==e[s]}const Zf={inView:{Feature:Yf},tap:{Feature:qf},focus:{Feature:Wf},hover:{Feature:Ff}},Qf={layout:{ProjectionNode:Yo,MeasureLayout:cl}},ep={...Sf,...Zf,...Uf,...Qf},Ce=vf(ep,wf),tp=[{slug:"claudia-hounslow",name:"Claudia Hounslow",title:"Director & Psychologist",photo:"/images/team/claudia.png",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",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",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",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",photo:"/images/team/david.png",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",photo:"/images/team/bridget.png",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}],sp=[{slug:"what-to-expect-first-psychology-session",title:"What to Expect from Your First Psychology Session",excerpt:"Many people feel uncertain or anxious before their first appointment. Here is what a first psychology session typically involves, and how to make the most of it.",date:"2025-03-12",category:"Getting Started",readTime:"4 min read",body:["It is completely normal to feel nervous before your first session with a psychologist. You may not know what to say, worry about being judged, or wonder whether therapy will be useful for you. These feelings are understandable, and most psychologists are very familiar with them.","A first session is primarily about your psychologist getting to know you. They will ask about what has brought you in, your history, your current circumstances, and what you are hoping to get from the process. It tends to feel more like a structured conversation than anything clinical or confronting.","You do not need to prepare anything in advance. It can help to have thought about what you most want your psychologist to understand about your situation, but there is no script and no wrong answers. The first session is also a chance to assess whether you feel comfortable with your psychologist. Fit matters, and it is okay to raise concerns or request a different clinician."]},{slug:"understanding-adhd-in-adults",title:"Understanding ADHD in Adults: Beyond the Stereotypes",excerpt:"ADHD in adulthood often looks very different from the hyperactive child stereotype. We explore what adult ADHD can look like, and why so many people are identified later in life.",date:"2025-02-28",category:"ADHD",readTime:"6 min read",body:["When most people think of ADHD, they picture a hyperactive young boy who can't sit still in class. But this stereotype misses the majority of adults who live with ADHD, many of whom were never identified as children, and many of whom are women.","In adults, ADHD often presents as chronic disorganisation, difficulty completing tasks, time blindness, emotional dysregulation, and a persistent sense of underachievement despite significant effort. Hyperactivity may be internalised as mental restlessness or racing thoughts rather than physical movement.","The reasons for late identification are complex. Higher intelligence, strong coping strategies, and supportive environments can mask ADHD symptoms until demands increase, particularly in tertiary education, early career, or parenthood. For many women, ADHD presents primarily through inattention rather than hyperactivity, which is more easily overlooked.","A formal assessment can provide clarity and open access to strategies, support services, and where relevant, medical treatment. It can also be a significant source of self-understanding for people who have long felt something was different about the way their brain works."]},{slug:"the-science-of-anxiety",title:"The Science of Anxiety: Why Your Brain Works the Way It Does",excerpt:"Anxiety is not a character flaw or a sign of weakness. It is your nervous system doing exactly what it was designed to do. Understanding the neuroscience can help.",date:"2025-02-10",category:"Anxiety",readTime:"5 min read",body:["Anxiety is one of the most fundamental responses in the human nervous system. It evolved to protect us from danger, triggering a cascade of physiological changes that prepare the body to fight, flee, or freeze when threat is perceived. In short bursts, anxiety is adaptive. It sharpens attention, increases physical readiness, and motivates action.","The problem is that the brain's threat detection system does not reliably distinguish between a predator and a presentation at work. The amygdala, a structure deep in the brain involved in processing emotional responses, can be activated by social or psychological threats in much the same way it would respond to physical danger.","When anxiety becomes chronic or disproportionate, this suggests that the threat detection system is calibrated too sensitively, often due to past learning experiences, trauma, or biological predisposition. Understanding this does not eliminate anxiety, but it can fundamentally change how you relate to it, shifting from 'there is something wrong with me' to 'my nervous system learned this, and it can be retrained'."]},{slug:"autism-assessment-in-adulthood",title:"Autism Assessment in Adulthood: What the Process Looks Like",excerpt:"More adults are seeking autism assessments than ever before. Here is what the assessment process typically involves, what you might receive at the end, and who can benefit.",date:"2025-01-22",category:"Autism",readTime:"5 min read",body:["In recent years, there has been a significant increase in adults seeking autism assessment, particularly women, older adults, and people who were missed or dismissed during childhood. Many describe a lifelong sense of being different, of struggling in social situations that others seem to navigate effortlessly, or of exhaustion from years of masking.","A comprehensive autism assessment typically involves a detailed clinical interview covering your developmental history, current presentation, strengths and challenges; standardised psychometric tools; and sometimes collateral information from a person who knows you well. The process may take place over multiple sessions.","At the end of the assessment, you receive a written report summarising the findings. This report can support workplace adjustments, academic accommodations, and other forms of support. Importantly, it can also provide a framework for understanding your own experience, something many adults describe as profoundly validating.","An assessment does not change who you are. For many people, it provides language for experiences they have always had, and opens doors to community, support, and self-compassion."]},{slug:"mental-health-treatment-plan-guide",title:"How to Talk to Your GP About Getting a Mental Health Treatment Plan",excerpt:"A Mental Health Treatment Plan from your GP can give you access to Medicare rebates for psychology. Here is how to have that conversation.",date:"2025-01-08",category:"Practical Guides",readTime:"4 min read",body:["If you are considering seeing a psychologist, you may be eligible for a Medicare rebate, but to access it, you need a Mental Health Care Plan (MHCP) from your GP. Many people are unsure how to raise this in a GP appointment. Here is a straightforward guide.","Book a longer appointment with your GP, specifically for a mental health review. When you arrive, be honest about what you have been experiencing. You do not need to have a formal diagnosis or use clinical language. Describing how you have been feeling, how long it has been going on, and how it is affecting your daily life is enough.","Your GP will assess whether you meet criteria for a mental health condition and, if so, complete the MHCP. This plan entitles you to up to 10 rebatable psychology sessions per calendar year. The current Medicare rebate is $101.55 per session. You can bring the plan to your appointment with us and we will process the rebate on the spot.","Note: You do not need an MHCP to see a psychologist at Contemporary Psychology. You can book and attend without one, paying the full fee. The MHCP is only relevant if you want to access the Medicare rebate."]},{slug:"what-is-evidence-based-therapy",title:"What Does Evidence-Based Therapy Actually Mean?",excerpt:"You will often hear psychology practices describe themselves as 'evidence-based'. But what does this actually mean, and why does it matter for you as a client?",date:"2024-12-15",category:"About Psychology",readTime:"5 min read",body:["'Evidence-based' is a term used widely in psychology, but it can mean different things depending on context. At its core, evidence-based practice means drawing on the best available scientific research to inform clinical decisions, rather than relying solely on tradition, personal preference, or anecdote.","In practice, this means that the therapeutic approaches your psychologist uses have been tested in rigorous clinical research, typically randomised controlled trials, and found to produce meaningful outcomes for people with similar presentations to yours. Cognitive-behavioural therapy (CBT), for example, has an extensive evidence base for anxiety and depression. EMDR has strong evidence for PTSD. CBT-I has strong evidence for insomnia.","Evidence-based practice is not the same as applying a rigid protocol. Effective therapy requires the psychologist to integrate research evidence with their clinical expertise and your individual circumstances, preferences, and values. The best outcome is typically achieved when these three elements are in dialogue.","When you choose a psychologist, asking about their approach and the evidence that supports it is entirely reasonable. A good clinician will welcome this question."]}],np=[{question:"How do I find the right psychologist for me?",answer:"Finding the right fit is important. When you contact us, our admin team will speak with you to understand your needs, preferences, and goals before matching you with a psychologist. We consider factors including your presenting concerns, preferred appointment times, and any preferences regarding the psychologist's experience or approach. After your first session, we check in to make sure you felt the match was right. If it wasn't, we can arrange a different clinician."},{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."},{question:"Why should I go to therapy?",answer:"People seek psychological support for many reasons, from a specific episode of distress to longer-standing patterns that they want to understand and change. You do not need to be in crisis to benefit from psychology. Therapy can be a useful space for self-understanding, building coping skills, working through difficult experiences, improving relationships, and making decisions aligned with your values. Many people find that it helps them function better in daily life, though we cannot guarantee specific outcomes."},{question:"How do I know if I need an assessment?",answer:"An assessment may be worth considering if you are seeking clarity about your mental health, want to understand whether you may have ADHD or autism, have been referred by a GP or psychiatrist, or simply want a clear clinical picture to inform your treatment. Our team can help you decide whether assessment is appropriate during your initial conversation. Assessments are not required before accessing therapy."},{question:"What can I expect in my first session?",answer:"Your first session is largely about us understanding you. Your psychologist will ask questions about what has brought you in, your history, your current life and 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. Just come as you are. Most clients find that the first session feels more like a conversation than anything clinical."},{question:"What is the difference between a psychologist and a psychiatrist?",answer:"Both psychologists and psychiatrists are trained mental health professionals, but their training and roles differ. Psychiatrists are medical doctors who have completed specialist training in psychiatry, and they can prescribe medication and manage complex or treatment-resistant presentations. Psychologists have postgraduate training (typically a master's or doctoral degree) in psychological assessment and therapy, and 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) concurrently."},{question:"I've tried therapy before and it didn't help. Should I try again?",answer:"It is unfortunately common for people to have had unhelpful therapy experiences, sometimes because of a poor fit with the therapist, an approach that wasn't well-matched to the presenting concern, or simply that the timing wasn't right. Previous unhelpful experience does not mean that psychological support cannot be effective for you. When you contact us, we encourage you to share what did and didn't work previously. This helps us match you more carefully and approach the work in a way that is more likely to be useful."},{question:"Do you offer bulk billing?",answer:"We do not offer bulk billing. Our fees range from $165–$300 depending on service and clinician. If you have a valid Mental Health Treatment Plan from your GP, a Medicare rebate of $101.55 is available per session (up to 10 sessions per calendar year). We process the rebate on the spot, meaning you pay the gap only. Private health insurance may also provide a partial rebate depending on your policy. Please contact us if you have questions about costs."},{question:"Do I need a GP referral to book?",answer:"No. You can book directly with us without a referral. However, if you want to access a Medicare rebate, you will need a valid Mental Health Treatment Plan from your GP or a psychiatrist's referral. We can see you without one, but you would pay the full fee. If you are unsure, our admin team can help you understand your options before you book."}],rp=[{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 ip(){const t=[];return rp.forEach(e=>t.push({type:"page",title:e.title,subtitle:e.desc,href:e.href})),tp.filter(e=>e.isPsychologist).forEach(e=>{var s;return t.push({type:"team",title:e.name,subtitle:e.title+((s=e.tags)!=null&&s.length?" · "+e.tags.slice(0,3).join(", "):""),href:`/our-team/${e.slug}`})}),sp.forEach(e=>{var s;return t.push({type:"blog",title:e.title,subtitle:((s=e.excerpt)==null?void 0:s.slice(0,80))+"…",href:`/blog/${e.slug}`})}),np.forEach(e=>{var s;return t.push({type:"faq",title:e.question,subtitle:((s=e.answer)==null?void 0:s.slice(0,80))+"…",href:"/faq"})}),t}const ap=ip(),op={page:"Page",team:"Team",blog:"Article",faq:"FAQ"},lp={page:Yl,team:tc,blog:Gl,faq:Jl},Js=["page","team","blog","faq"],cp=[{id:"all",label:"All"},{id:"page",label:"Pages"},{id:"team",label:"Team"},{id:"blog",label:"Articles"},{id:"faq",label:"FAQs"}];function up(t,e){if(!t.trim())return[];const s=t.toLowerCase();return ap.filter(n=>e!=="all"&&n.type!==e?!1:n.title.toLowerCase().includes(s)||n.subtitle.toLowerCase().includes(s)).slice(0,20)}function hp(){const[t,e]=_.useState(!1),[s,n]=_.useState(""),[r,i]=_.useState("all"),[a,o]=_.useState(0),l=_.useRef(null),c=Fl(),u=up(s,r),h=Js.reduce((y,b)=>{const w=u.filter(x=>x.type===b);return w.length&&(y[b]=w),y},{}),d=Js.flatMap(y=>h[y]??[]),f=_.useCallback(()=>{e(!1),n(""),i("all"),o(0)},[]),p=_.useCallback(y=>{f(),c(y)},[f,c]);_.useEffect(()=>{const y=b=>{(b.metaKey||b.ctrlKey)&&b.key==="k"&&(b.preventDefault(),e(w=>!w)),b.key==="Escape"&&f()};return window.addEventListener("keydown",y),()=>window.removeEventListener("keydown",y)},[f]),_.useEffect(()=>{t&&setTimeout(()=>{var y;return(y=l.current)==null?void 0:y.focus()},50)},[t]),_.useEffect(()=>{o(0)},[s,r]);function g(y){y.key==="ArrowDown"?(y.preventDefault(),o(b=>Math.min(b+1,d.length-1))):y.key==="ArrowUp"?(y.preventDefault(),o(b=>Math.max(b-1,0))):y.key==="Enter"&&d[a]&&p(d[a].href)}let v=0;return m.jsxs(m.Fragment,{children:[m.jsx("button",{onClick:()=>e(!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:m.jsx(Cr,{className:"h-4 w-4"})}),Ul.createPortal(m.jsx(Rn,{children:t&&m.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:[m.jsx("div",{className:"absolute inset-0 bg-[#071B27]/50 backdrop-blur-sm",onClick:f}),m.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:[m.jsxs("div",{className:"flex items-center gap-3 px-4 py-3.5 border-b border-cp-rule",children:[m.jsx(Cr,{className:"h-4 w-4 text-cp-muted flex-shrink-0"}),m.jsx("input",{ref:l,value:s,onChange:y=>n(y.target.value),onKeyDown:g,placeholder:"Search pages, team, articles, FAQs…",className:"flex-1 text-sm font-poppins text-[#071B27] placeholder:text-cp-muted outline-none bg-transparent"}),s&&m.jsx("button",{onClick:()=>n(""),className:"text-cp-muted hover:text-cp-body transition-colors",children:m.jsx(hs,{className:"h-4 w-4"})}),m.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"})]}),m.jsx("div",{className:"flex items-center gap-1.5 px-4 py-2.5 border-b border-cp-rule overflow-x-auto",children:cp.map(y=>m.jsx("button",{onClick:()=>i(y.id),className:`flex-shrink-0 rounded-full px-3 py-1 text-xs font-medium font-poppins transition-colors ${r===y.id?"bg-brand-pink text-white":"bg-surface-warm text-cp-muted hover:text-cp-body hover:bg-surface-pink"}`,children:y.label},y.id))}),m.jsxs("div",{className:"max-h-[55vh] overflow-y-auto",children:[!s&&m.jsx("p",{className:"text-xs text-cp-muted font-poppins text-center py-8",children:"Start typing to search…"}),s&&u.length===0&&m.jsxs("p",{className:"text-xs text-cp-muted font-poppins text-center py-8",children:['No results for "',s,'"']}),Js.map(y=>{const b=h[y];return b?m.jsxs("div",{children:[m.jsx("p",{className:"text-[10px] font-bold font-poppins tracking-widest text-cp-muted uppercase px-4 pt-4 pb-1.5",children:op[y]}),b.map(w=>{const x=lp[w.type],S=d[a]===w,A=v++;return m.jsxs("button",{onClick:()=>p(w.href),onMouseEnter:()=>o(A),className:`w-full flex items-center gap-3 px-4 py-2.5 text-left transition-colors ${S?"bg-surface-pink":"hover:bg-surface-warm"}`,children:[m.jsx("div",{className:`w-7 h-7 rounded-lg flex items-center justify-center flex-shrink-0 transition-colors border ${S?"bg-brand-pink border-brand-pink":"bg-surface-warm border-cp-rule"}`,children:m.jsx(x,{className:`h-3.5 w-3.5 transition-colors ${S?"text-white":"text-cp-muted"}`})}),m.jsxs("div",{className:"min-w-0",children:[m.jsx("p",{className:`text-sm font-semibold font-poppins truncate transition-colors ${S?"text-brand-pink":"text-[#071B27]"}`,children:w.title}),m.jsx("p",{className:"text-xs text-cp-muted font-poppins leading-snug line-clamp-1",children:w.subtitle})]})]},w.href+w.title)})]},y):null})]}),u.length>0&&m.jsxs("div",{className:"flex items-center justify-between border-t border-cp-rule px-4 py-2.5",children:[m.jsxs("span",{className:"text-[10px] text-cp-muted font-poppins",children:[u.length," result",u.length!==1?"s":""]}),m.jsxs("div",{className:"flex items-center gap-3 text-[10px] text-cp-muted font-poppins",children:[m.jsxs("span",{className:"flex items-center gap-1",children:[m.jsx("kbd",{className:"border border-cp-rule rounded px-1 py-0.5 text-[9px]",children:"↑"}),m.jsx("kbd",{className:"border border-cp-rule rounded px-1 py-0.5 text-[9px]",children:"↓"}),"navigate"]}),m.jsxs("span",{className:"flex items-center gap-1",children:[m.jsx("kbd",{className:"border border-cp-rule rounded px-1 py-0.5 text-[9px]",children:"↵"}),"open"]})]})]})]})]})}),document.body)]})}const ht="/assets/logo-C1kM2SaN.png";var ul={exports:{}},hl={};/**
 * @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 gt=_;function dp(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var fp=typeof Object.is=="function"?Object.is:dp,pp=gt.useState,mp=gt.useEffect,gp=gt.useLayoutEffect,yp=gt.useDebugValue;function vp(t,e){var s=e(),n=pp({inst:{value:s,getSnapshot:e}}),r=n[0].inst,i=n[1];return gp(function(){r.value=s,r.getSnapshot=e,Ys(r)&&i({inst:r})},[t,s,e]),mp(function(){return Ys(r)&&i({inst:r}),t(function(){Ys(r)&&i({inst:r})})},[t]),yp(s),s}function Ys(t){var e=t.getSnapshot;t=t.value;try{var s=e();return!fp(t,s)}catch{return!0}}function wp(t,e){return e()}var bp=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?wp:vp;hl.useSyncExternalStore=gt.useSyncExternalStore!==void 0?gt.useSyncExternalStore:bp;ul.exports=hl;var xp=ul.exports;function _p(){return xp.useSyncExternalStore(Sp,()=>!0,()=>!1)}function Sp(){return()=>{}}var xr="Avatar",[Tp,Ry]=ql(xr),[kp,dl]=Tp(xr),fl=_.forwardRef((t,e)=>{const{__scopeAvatar:s,...n}=t,[r,i]=_.useState("idle");return m.jsx(kp,{scope:s,imageLoadingStatus:r,onImageLoadingStatusChange:i,children:m.jsx(Kn.span,{...n,ref:e})})});fl.displayName=xr;var pl="AvatarImage",ml=_.forwardRef((t,e)=>{const{__scopeAvatar:s,src:n,onLoadingStatusChange:r=()=>{},...i}=t,a=dl(pl,s),o=Ap(n,i),l=Hl(c=>{r(c),a.onImageLoadingStatusChange(c)});return on(()=>{o!=="idle"&&l(o)},[o,l]),o==="loaded"?m.jsx(Kn.img,{...i,ref:e,src:n}):null});ml.displayName=pl;var gl="AvatarFallback",yl=_.forwardRef((t,e)=>{const{__scopeAvatar:s,delayMs:n,...r}=t,i=dl(gl,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"?m.jsx(Kn.span,{...r,ref:e}):null});yl.displayName=gl;function Gi(t,e){return t?e?(t.src!==e&&(t.src=e),t.complete&&t.naturalWidth>0?"loaded":"loading"):"error":"idle"}function Ap(t,{referrerPolicy:e,crossOrigin:s}){const n=_p(),r=_.useRef(null),i=n?(r.current||(r.current=new window.Image),r.current):null,[a,o]=_.useState(()=>Gi(i,t));return on(()=>{o(Gi(i,t))},[i,t]),on(()=>{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 vl=fl,wl=ml,bl=yl;const Et=_.forwardRef(({className:t,...e},s)=>m.jsx(vl,{ref:s,className:ze("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",t),...e}));Et.displayName=vl.displayName;const Ep=_.forwardRef(({className:t,...e},s)=>m.jsx(wl,{ref:s,className:ze("aspect-square h-full w-full",t),...e}));Ep.displayName=wl.displayName;const Pt=_.forwardRef(({className:t,...e},s)=>m.jsx(bl,{ref:s,className:ze("flex h-full w-full items-center justify-center rounded-full bg-muted",t),...e}));Pt.displayName=bl.displayName;const Pp=Kl("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"}}),Dn=_.forwardRef(({className:t,variant:e,size:s,asChild:n=!1,...r},i)=>{const a=n?zl:"button";return m.jsx(a,{className:ze(Pp({variant:e,size:s,className:t})),ref:i,...r})});Dn.displayName="Button";var Ji=function(){return Ji=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},Ji.apply(this,arguments)};function Rs(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 Cp(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 jy(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 Rp=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);class _r extends Error{constructor(e,s="FunctionsError",n){super(e),this.name=s,this.context=n}}class jp extends _r{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class Yi extends _r{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class Xi extends _r{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}var In;(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"})(In||(In={}));class Op{constructor(e,{headers:s={},customFetch:n,region:r=In.Any}={}){this.url=e,this.headers=s,this.region=r,this.fetch=Rp(n)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return Cp(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 p=new URL(`${this.url}/${s}`);f&&f!=="any"&&(d["x-region"]=f,p.searchParams.set("forceFunctionRegion",f));let g;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",g=c):typeof c=="string"?(d["Content-Type"]="text/plain",g=c):typeof FormData<"u"&&c instanceof FormData?g=c:(d["Content-Type"]="application/json",g=JSON.stringify(c)):g=c;let v=u;h&&(a=new AbortController,i=setTimeout(()=>a.abort(),h),u?(v=a.signal,u.addEventListener("abort",()=>a.abort())):v=a.signal);const y=yield this.fetch(p.toString(),{method:l||"POST",headers:Object.assign(Object.assign(Object.assign({},d),this.headers),o),body:g,signal:v}).catch(S=>{throw new jp(S)}),b=y.headers.get("x-relay-error");if(b&&b==="true")throw new Yi(y);if(!y.ok)throw new Xi(y);let w=((r=y.headers.get("Content-Type"))!==null&&r!==void 0?r:"text/plain").split(";")[0].trim(),x;return w==="application/json"?x=yield y.json():w==="application/octet-stream"||w==="application/pdf"?x=yield y.blob():w==="text/event-stream"?x=y:w==="multipart/form-data"?x=yield y.formData():x=yield y.text(),{data:x,error:null,response:y}}catch(o){return{data:null,error:o,response:o instanceof Xi||o instanceof Yi?o.context:void 0}}finally{i&&clearTimeout(i)}})}}var Dp=class extends Error{constructor(t){super(t.message),this.name="PostgrestError",this.details=t.details,this.hint=t.hint,this.code=t.code}},Ip=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 y=await i.text();y===""||(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=y:o=JSON.parse(y))}const g=(h=s.headers.get("Prefer"))===null||h===void 0?void 0:h.match(/count=(exact|planned|estimated)/),v=(d=i.headers.get("content-range"))===null||d===void 0?void 0:d.split("/");g&&v&&v.length>1&&(l=parseInt(v[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 p;const g=await i.text();try{a=JSON.parse(g),Array.isArray(a)&&i.status===404&&(o=[],a=null,c=200,u="OK")}catch{i.status===404&&g===""?(c=204,u="No Content"):a={message:g}}if(a&&s.isMaybeSingle&&(!(a==null||(p=a.details)===null||p===void 0)&&p.includes("0 rows"))&&(a=null,c=200,u="OK"),a&&s.shouldThrowOnError)throw new Dp(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 p=(c=l==null?void 0:l.message)!==null&&c!==void 0?c:"",g=(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"}: ${p}`,g&&(o+=` (${g})`),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}},Np=class extends Ip{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 Zi=new RegExp("[,()]");var rt=class extends Np{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"&&Zi.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"&&Zi.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}},Mp=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 rt({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 rt({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 rt({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 rt({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 rt({method:s,url:this.url,headers:this.headers,schema:this.schema,fetch:(e=this.fetch)!==null&&e!==void 0?e:fetch})}},$p=class xl{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 Mp(new URL(`${this.url}/${e}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(e){return new xl(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 rt({method:o,url:l,headers:u,schema:this.schemaName,body:c,fetch:(a=this.fetch)!==null&&a!==void 0?a:fetch})}};class Lp{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 Bp="2.88.0",Vp=`realtime-js/${Bp}`,_l="1.0.0",Up="2.0.0",Qi=_l,Nn=1e4,Fp=1e3,Wp=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 Mn;(function(t){t.websocket="websocket"})(Mn||(Mn={}));var Fe;(function(t){t.Connecting="connecting",t.Open="open",t.Closing="closing",t.Closed="closed"})(Fe||(Fe={}));class qp{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 p=new DataView(f),g=0;p.setUint8(g++,this.KINDS.userBroadcastPush),p.setUint8(g++,l.length),p.setUint8(g++,o.length),p.setUint8(g++,a.length),p.setUint8(g++,c.length),p.setUint8(g++,h.length),p.setUint8(g++,s),Array.from(l,y=>p.setUint8(g++,y.charCodeAt(0))),Array.from(o,y=>p.setUint8(g++,y.charCodeAt(0))),Array.from(a,y=>p.setUint8(g++,y.charCodeAt(0))),Array.from(c,y=>p.setUint8(g++,y.charCodeAt(0))),Array.from(h,y=>p.setUint8(g++,y.charCodeAt(0)));var v=new Uint8Array(f.byteLength+n.byteLength);return v.set(new Uint8Array(f),0),v.set(new Uint8Array(n),f.byteLength),v.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,p={type:this.BROADCAST_EVENT,event:u,payload:f};return a>0&&(p.meta=JSON.parse(h)),{join_ref:null,ref:null,topic:c,event:this.BROADCAST_EVENT,payload:p}}_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 Sl{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 ea=(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]=Hp(a,t,e,r),i),{}):{}},Hp=(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)?Tl(i,a):$n(a)},Tl=(t,e)=>{if(t.charAt(0)==="_"){const s=t.slice(1,t.length);return Jp(e,s)}switch(t){case I.bool:return Kp(e);case I.float4:case I.float8:case I.int2:case I.int4:case I.int8:case I.numeric:case I.oid:return zp(e);case I.json:case I.jsonb:return Gp(e);case I.timestamp:return Yp(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 $n(e);default:return $n(e)}},$n=t=>t,Kp=t=>{switch(t){case"t":return!0;case"f":return!1;default:return t}},zp=t=>{if(typeof t=="string"){const e=parseFloat(t);if(!Number.isNaN(e))return e}return t},Gp=t=>{if(typeof t=="string")try{return JSON.parse(t)}catch{return t}return t},Jp=(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=>Tl(e,o))}return t},Yp=t=>typeof t=="string"?t.replace(" ","T"):t,kl=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 Xs{constructor(e,s,n={},r=Nn){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 ta;(function(t){t.SYNC="sync",t.JOIN="join",t.LEAVE="leave"})(ta||(ta={}));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(v=>v.presence_ref),f=h.map(v=>v.presence_ref),p=u.filter(v=>f.indexOf(v.presence_ref)<0),g=h.filter(v=>d.indexOf(v.presence_ref)<0);p.length>0&&(o[c]=p),g.length>0&&(l[c]=g)}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 sa;(function(t){t.ALL="*",t.INSERT="INSERT",t.UPDATE="UPDATE",t.DELETE="DELETE"})(sa||(sa={}));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 ut{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 Xs(this,de.join,this.params,this.timeout),this.rejoinTimer=new Sl(()=>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=kl(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 p;if(this.socket._isManualToken()||this.socket.setAuth(),f===void 0){e==null||e(Te.SUBSCRIBED);return}else{const g=this.bindings.postgres_changes,v=(p=g==null?void 0:g.length)!==null&&p!==void 0?p:0,y=[];for(let b=0;b<v;b++){const w=g[b],{filter:{event:x,schema:S,table:A,filter:O}}=w,E=f&&f[b];if(E&&E.event===x&&ut.isFilterValueEqual(E.schema,S)&&ut.isFilterValueEqual(E.table,A)&&ut.isFilterValueEqual(E.filter,O))y.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=y,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 Xs(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 Xs(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>Wp){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 p,g,v;return((p=f.filter)===null||p===void 0?void 0:p.event)==="*"||((v=(g=f.filter)===null||g===void 0?void 0:g.event)===null||v===void 0?void 0:v.toLocaleLowerCase())===a}).map(f=>f.callback(d,n)):(i=this.bindings[a])===null||i===void 0||i.filter(f=>{var p,g,v,y,b,w;if(["broadcast","presence","postgres_changes"].includes(a))if("id"in f){const x=f.id,S=(p=f.filter)===null||p===void 0?void 0:p.event;return x&&((g=s.ids)===null||g===void 0?void 0:g.includes(x))&&(S==="*"||(S==null?void 0:S.toLocaleLowerCase())===((v=s.data)===null||v===void 0?void 0:v.type.toLocaleLowerCase()))}else{const x=(b=(y=f==null?void 0:f.filter)===null||y===void 0?void 0:y.event)===null||b===void 0?void 0:b.toLocaleLowerCase();return x==="*"||x===((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 p=d.data,{schema:g,table:v,commit_timestamp:y,type:b,errors:w}=p;d=Object.assign(Object.assign({},{schema:g,table:v,commit_timestamp:y,eventType:b,new:{},old:{},errors:w}),this._getPayloadRecords(p))}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&&ut.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=ea(e.columns,e.record)),(e.type==="UPDATE"||e.type==="DELETE")&&(s.old=ea(e.columns,e.old_record)),s}}const Zs=()=>{},Zt={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},Xp=[1e3,2e3,5e3,1e4],Zp=1e4,Qp=`
  addEventListener("message", (e) => {
    if (e.data.event === "start") {
      setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
    }
  });`;class em{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=Nn,this.transport=null,this.heartbeatIntervalMs=Zt.HEARTBEAT_INTERVAL,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.heartbeatCallback=Zs,this.ref=0,this.reconnectTimer=null,this.vsn=Qi,this.logger=Zs,this.conn=null,this.sendBuffer=[],this.serializer=new qp,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}/${Mn.websocket}`,this.httpEndpoint=kl(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=Lp.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 Fe.Connecting;case Re.open:return Fe.Open;case Re.closing:return Fe.Closing;default:return Fe.Closed}}isConnected(){return this.connectionState()===Fe.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 ut(`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(Fp,"heartbeat timeout"),setTimeout(()=>{var s;this.isConnected()||(s=this.reconnectTimer)===null||s===void 0||s.scheduleTimeout()},Zt.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([Qp],{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 Sl(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},Zt.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:Nn,this.heartbeatIntervalMs=(r=e==null?void 0:e.heartbeatIntervalMs)!==null&&r!==void 0?r:Zt.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:Qi,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:p=>Xp[p-1]||Zp,this.vsn){case _l:this.encode=(u=e==null?void 0:e.encode)!==null&&u!==void 0?u:(p,g)=>g(JSON.stringify(p)),this.decode=(h=e==null?void 0:e.decode)!==null&&h!==void 0?h:(p,g)=>g(JSON.parse(p));break;case Up: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 Nt=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 tm(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 sm(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 nm(t){const e=t.fetchImpl??globalThis.fetch;return{async request({method:s,path:n,query:r,body:i,headers:a}){const o=tm(t.baseUrl,n,r),l=await sm(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,p=f==null?void 0:f.error;throw new Nt((p==null?void 0:p.message)??`Request failed with status ${c.status}`,{status:c.status,icebergType:p==null?void 0:p.type,icebergCode:p==null?void 0:p.code,details:f})}return{status:c.status,headers:c.headers,data:d}}}}function Qt(t){return t.join("")}var rm=class{constructor(t,e=""){this.client=t,this.prefix=e}async listNamespaces(t){const e=t?{parent:Qt(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/${Qt(t.namespace)}`})}async loadNamespaceMetadata(t){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Qt(t.namespace)}`})).data.properties}}async namespaceExists(t){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${Qt(t.namespace)}`}),!0}catch(e){if(e instanceof Nt&&e.status===404)return!1;throw e}}async createNamespaceIfNotExists(t,e){try{return await this.createNamespace(t,e)}catch(s){if(s instanceof Nt&&s.status===409)return;throw s}}};function Xe(t){return t.join("")}var im=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/${Xe(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/${Xe(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/${Xe(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/${Xe(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/${Xe(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/${Xe(t.namespace)}/tables/${t.name}`,headers:e}),!0}catch(s){if(s instanceof Nt&&s.status===404)return!1;throw s}}async createTableIfNotExists(t,e){try{return await this.createTable(t,e)}catch(s){if(s instanceof Nt&&s.status===409)return await this.loadTable({namespace:t.namespace,name:e.name});throw s}}},am=class{constructor(t){var n;let e="v1";t.catalogName&&(e+=`/${t.catalogName}`);const s=t.baseUrl.endsWith("/")?t.baseUrl:`${t.baseUrl}/`;this.client=nm({baseUrl:s,auth:t.auth,fetchImpl:t.fetch}),this.accessDelegation=(n=t.accessDelegation)==null?void 0:n.join(","),this.namespaceOps=new rm(this.client,e),this.tableOps=new im(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)}},js=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 om=class extends js{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}}},Ln=class extends js{constructor(t,e){super(t),this.name="StorageUnknownError",this.originalError=e}};const Sr=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),lm=()=>Response,Bn=t=>{if(Array.isArray(t))return t.map(s=>Bn(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]=Bn(n)}),e},cm=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)},um=t=>!t||typeof t!="string"||t.length===0||t.length>100||t.trim()!==t||t.includes("/")||t.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(t);function Mt(t){"@babel/helpers - typeof";return Mt=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},Mt(t)}function hm(t,e){if(Mt(t)!="object"||!t)return t;var s=t[Symbol.toPrimitive];if(s!==void 0){var n=s.call(t,e||"default");if(Mt(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function dm(t){var e=hm(t,"string");return Mt(e)=="symbol"?e:e+""}function fm(t,e,s){return(e=dm(e))in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}function na(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?na(Object(s),!0).forEach(function(n){fm(t,n,s[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(s)):na(Object(s)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(s,n))})}return t}const Qs=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)},pm=async(t,e,s)=>{t instanceof await lm()&&!(s!=null&&s.noResolveJson)?t.json().then(n=>{const r=t.status||500,i=(n==null?void 0:n.statusCode)||r+"";e(new om(Qs(n),r,i))}).catch(n=>{e(new Ln(Qs(n),n))}):e(new Ln(Qs(t),t))},mm=(t,e,s,n)=>{const r={method:t,headers:(e==null?void 0:e.headers)||{}};return t==="GET"||!n?r:(cm(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 Ht(t,e,s,n,r,i){return new Promise((a,o)=>{t(s,mm(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=>pm(l,o,n))})}async function $t(t,e,s,n){return Ht(t,"GET",e,s,n)}async function he(t,e,s,n,r){return Ht(t,"POST",e,n,r,s)}async function Vn(t,e,s,n,r){return Ht(t,"PUT",e,n,r,s)}async function gm(t,e,s,n){return Ht(t,"HEAD",e,R(R({},s),{},{noResolveJson:!0}),n)}async function Tr(t,e,s,n,r){return Ht(t,"DELETE",e,n,r,s)}var ym=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 Al;Al=Symbol.toStringTag;var vm=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e,this[Al]="BlobDownloadBuilder",this.promise=null}asStream(){return new ym(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 wm={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},ra={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var bm=class{constructor(t,e={},s,n){this.shouldThrowOnError=!1,this.url=t,this.headers=e,this.bucketId=s,this.fetch=Sr(n)}throwOnError(){return this.shouldThrowOnError=!0,this}async uploadOrUpdate(t,e,s,n){var r=this;try{let i;const a=R(R({},ra),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"?Vn: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:ra.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 Vn(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 js("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=()=>$t(this.fetch,`${this.url}/${s}/${i}${r}`,{headers:this.headers,noResolveJson:!0});return new vm(a,this.shouldThrowOnError)}async info(t){var e=this;const s=e._getFinalPath(t);try{return{data:Bn(await $t(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 gm(e.fetch,`${e.url}/object/${s}`,{headers:e.headers}),{data:!0,error:null}}catch(n){if(e.shouldThrowOnError)throw n;if($(n)&&n instanceof Ln){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 Tr(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({},wm),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 El="2.88.0",Pl={"X-Client-Info":`storage-js/${El}`};var xm=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({},Pl),e),this.fetch=Sr(s)}throwOnError(){return this.shouldThrowOnError=!0,this}async listBuckets(t){var e=this;try{const s=e.listBucketOptionsToQueryString(t);return{data:await $t(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 $t(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 Vn(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 Tr(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():""}},_m=class{constructor(t,e={},s){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=R(R({},Pl),e),this.fetch=Sr(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 $t(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 Tr(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(!um(t))throw new js("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 am({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 kr={"X-Client-Info":`storage-js/${El}`,"Content-Type":"application/json"};var Cl=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 en=class extends Cl{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}}},Sm=class extends Cl{constructor(t,e){super(t),this.name="StorageVectorsUnknownError",this.originalError=e}};const Ar=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),Tm=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)},ia=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),km=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 en(ia(i),n,a))}).catch(()=>{const i=n+"";e(new en(r.statusText||`HTTP ${n} error`,n,i))});else{const i=n+"";e(new en(r.statusText||`HTTP ${n} error`,n,i))}}else e(new Sm(ia(t),t))},Am=(t,e,s,n)=>{const r={method:t,headers:(e==null?void 0:e.headers)||{}};return n?(Tm(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 Em(t,e,s,n,r,i){return new Promise((a,o)=>{t(s,Am(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=>km(l,o,n))})}async function te(t,e,s,n,r){return Em(t,"POST",e,n,r,s)}var Pm=class{constructor(t,e={},s){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=R(R({},kr),e),this.fetch=Ar(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}}},Cm=class{constructor(t,e={},s){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=R(R({},kr),e),this.fetch=Ar(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}}},Rm=class{constructor(t,e={},s){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=R(R({},kr),e),this.fetch=Ar(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}}},jm=class extends Rm{constructor(t,e={}){super(t,e.headers||{},e.fetch)}from(t){return new Om(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)}},Om=class extends Pm{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 Dm(this.url,this.headers,this.vectorBucketName,t,this.fetch)}},Dm=class extends Cm{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}))}},Im=class extends xm{constructor(t,e={},s,n){super(t,e,s,n)}from(t){return new bm(this.url,this.headers,t,this.fetch)}get vectors(){return new jm(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new _m(this.url+"/iceberg",this.headers,this.fetch)}};const Rl="2.88.0",it=30*1e3,Un=3,tn=Un*it,Nm="http://localhost:9999",Mm="supabase.auth.token",$m={"X-Client-Info":`gotrue-js/${Rl}`},Fn="X-Supabase-Api-Version",jl={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},Lm=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,Bm=10*60*1e3;class Lt extends Error{constructor(e,s,n){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=s,this.code=n}}function k(t){return typeof t=="object"&&t!==null&&"__isAuthError"in t}class Vm extends Lt{constructor(e,s,n){super(e,s,n),this.name="AuthApiError",this.status=s,this.code=n}}function Um(t){return k(t)&&t.name==="AuthApiError"}class We extends Lt{constructor(e,s){super(e),this.name="AuthUnknownError",this.originalError=s}}class ke extends Lt{constructor(e,s,n,r){super(e,n,r),this.name=s,this.status=n}}class Q extends ke{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function Fm(t){return k(t)&&t.name==="AuthSessionMissingError"}class Ze extends ke{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class es extends ke{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}}class ts 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 Wm(t){return k(t)&&t.name==="AuthImplicitGrantRedirectError"}class aa 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 qm 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 Wn extends ke{constructor(e,s){super(e,"AuthRetryableFetchError",s,void 0)}}function sn(t){return k(t)&&t.name==="AuthRetryableFetchError"}class oa extends ke{constructor(e,s,n){super(e,"AuthWeakPasswordError",s,"weak_password"),this.reasons=n}}class qn extends ke{constructor(e){super(e,"AuthInvalidJwtError",400,"invalid_jwt")}}const xs="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),la=` 	
\r=`.split(""),Hm=(()=>{const t=new Array(128);for(let e=0;e<t.length;e+=1)t[e]=-1;for(let e=0;e<la.length;e+=1)t[la[e].charCodeAt(0)]=-2;for(let e=0;e<xs.length;e+=1)t[xs[e].charCodeAt(0)]=e;return t})();function ca(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(xs[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(xs[n]),e.queuedBits-=6}}function Ol(t,e,s){const n=Hm[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 ua(t){const e=[],s=a=>{e.push(String.fromCodePoint(a))},n={utf8seq:0,codepoint:0},r={queue:0,queuedBits:0},i=a=>{Gm(a,n,s)};for(let a=0;a<t.length;a+=1)Ol(t.charCodeAt(a),r,i);return e.join("")}function Km(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 zm(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}Km(n,e)}}function Gm(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)Ol(t.charCodeAt(r),s,n);return new Uint8Array(e)}function Jm(t){const e=[];return zm(t,s=>e.push(s)),new Uint8Array(e)}function Ke(t){const e=[],s={queue:0,queuedBits:0},n=r=>{e.push(r)};return t.forEach(r=>ca(r,s,n)),ca(null,s,n),e.join("")}function Ym(t){return Math.round(Date.now()/1e3)+t}function Xm(){return Symbol("auth-callback")}const z=()=>typeof window<"u"&&typeof document<"u",Le={tested:!1,writable:!1},Dl=()=>{if(!z())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(Le.tested)return Le.writable;const t=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(t,t),globalThis.localStorage.removeItem(t),Le.tested=!0,Le.writable=!0}catch{Le.tested=!0,Le.writable=!1}return Le.writable};function Zm(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 Il=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),Qm=t=>typeof t=="object"&&t!==null&&"status"in t&&"ok"in t&&"json"in t&&typeof t.json=="function",at=async(t,e,s)=>{await t.setItem(e,JSON.stringify(s))},Be=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 Os{constructor(){this.promise=new Os.promiseConstructor((e,s)=>{this.resolve=e,this.reject=s})}}Os.promiseConstructor=Promise;function nn(t){const e=t.split(".");if(e.length!==3)throw new qn("Invalid JWT structure");for(let n=0;n<e.length;n++)if(!Lm.test(e[n]))throw new qn("JWT not in base64url format");return{header:JSON.parse(ua(e[0])),payload:JSON.parse(ua(e[1])),signature:dt(e[2]),raw:{header:e[0],payload:e[1]}}}async function eg(t){return await new Promise(e=>{setTimeout(()=>e(null),t)})}function tg(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 sg(t){return("0"+t.toString(16)).substr(-2)}function ng(){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,sg).join("")}async function rg(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 ig(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 rg(t);return btoa(s).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function Qe(t,e,s=!1){const n=ng();let r=n;s&&(r+="/PASSWORD_RECOVERY"),await at(t,`${e}-code-verifier`,r);const i=await ig(n);return[i,n===i?"plain":"s256"]}const ag=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function og(t){const e=t.headers.get(Fn);if(!e||!e.match(ag))return null;try{return new Date(`${e}T00:00:00.0Z`)}catch{return null}}function lg(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 cg(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 ug=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function et(t){if(!ug.test(t))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function rn(){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 hg(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 ha(t){return JSON.parse(JSON.stringify(t))}const Ue=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),dg=[502,503,504];async function da(t){var e;if(!Qm(t))throw new Wn(Ue(t),0);if(dg.includes(t.status))throw new Wn(Ue(t),t.status);let s;try{s=await t.json()}catch(i){throw new We(Ue(i),i)}let n;const r=og(t);if(r&&r.getTime()>=jl["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 oa(Ue(s),t.status,((e=s.weak_password)===null||e===void 0?void 0:e.reasons)||[]);if(n==="session_not_found")throw new Q}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 oa(Ue(s),t.status,s.weak_password.reasons);throw new Vm(Ue(s),t.status||500,n)}const fg=(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[Fn]||(i[Fn]=jl["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 pg(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 pg(t,e,s,n,r,i){const a=fg(e,n,r,i);let o;try{o=await t(s,Object.assign({},a))}catch(l){throw console.error(l),new Wn(Ue(l),0)}if(o.ok||await da(o),n!=null&&n.noResolveJson)return o;try{return await o.json()}catch(l){await da(l)}}function le(t){var e;let s=null;yg(t)&&(s=Object.assign({},t),t.expires_at||(s.expires_at=Ym(t.expires_in)));const n=(e=t.user)!==null&&e!==void 0?e:t;return{data:{session:s,user:n},error:null}}function fa(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 mg(t){return{data:t,error:null}}function gg(t){const{action_link:e,email_otp:s,hashed_token:n,redirect_to:r,verification_type:i}=t,a=Rs(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 pa(t){return t}function yg(t){return t.access_token&&t.refresh_token&&t.expires_in}const an=["global","local","others"];class vg{constructor({url:e="",headers:s={},fetch:n}){this.url=e,this.headers=s,this.fetch=Il(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=an[0]){if(an.indexOf(s)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${an.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(k(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(k(n))return{data:{user:null},error:n};throw n}}async generateLink(e){try{const{options:s}=e,n=Rs(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:gg,redirectTo:s==null?void 0:s.redirectTo})}catch(s){if(k(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(k(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:pa});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(p=>{const g=parseInt(p.split(";")[0].split("=")[1].substring(0,1)),v=JSON.parse(p.split(";")[1].split("=")[1]);c[`${v}Page`]=g}),c.total=parseInt(d)),{data:Object.assign(Object.assign({},h),c),error:null}}catch(c){if(k(c))return{data:{users:[]},error:c};throw c}}async getUserById(e){et(e);try{return await C(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:je})}catch(s){if(k(s))return{data:{user:null},error:s};throw s}}async updateUserById(e,s){et(e);try{return await C(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:s,headers:this.headers,xform:je})}catch(n){if(k(n))return{data:{user:null},error:n};throw n}}async deleteUser(e,s=!1){et(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(k(n))return{data:{user:null},error:n};throw n}}async _listFactors(e){et(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(k(s))return{data:null,error:s};throw s}}async _deleteFactor(e){et(e.userId),et(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(k(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:pa});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(p=>{const g=parseInt(p.split(";")[0].split("=")[1].substring(0,1)),v=JSON.parse(p.split(";")[1].split("=")[1]);c[`${v}Page`]=g}),c.total=parseInt(d)),{data:Object.assign(Object.assign({},h),c),error:null}}catch(c){if(k(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(k(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(k(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(k(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(k(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(k(s))return{data:null,error:s};throw s}}}function ma(t={}){return{getItem:e=>t[e]||null,setItem:(e,s)=>{t[e]=s},removeItem:e=>{delete t[e]}}}const tt={debug:!!(globalThis&&Dl()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class Nl extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class wg extends Nl{}async function bg(t,e,s){tt.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",t,e);const n=new globalThis.AbortController;return e>0&&setTimeout(()=>{n.abort(),tt.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){tt.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",t,r.name);try{return await s()}finally{tt.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",t,r.name)}}else{if(e===0)throw tt.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",t),new wg(`Acquiring an exclusive Navigator LockManager lock "${t}" immediately failed`);if(tt.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 xg(){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 Ml(t){if(!/^0x[a-fA-F0-9]{40}$/.test(t))throw new Error(`@supabase/auth-js: Address "${t}" is invalid.`);return t.toLowerCase()}function _g(t){return parseInt(t,16)}function Sg(t){const e=new TextEncoder().encode(t);return"0x"+Array.from(e,n=>n.toString(16).padStart(2,"0")).join("")}function Tg(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=Ml(t.address),p=u?`${u}://${n}`:n,g=t.statement?`${t.statement}
`:"",v=`${p} wants you to sign in with your Ethereum account:
${f}

${g}`;let y=`URI: ${h}
Version: ${d}
Chain ID: ${s}${a?`
Nonce: ${a}`:""}
Issued At: ${i.toISOString()}`;if(r&&(y+=`
Expiration Time: ${r.toISOString()}`),o&&(y+=`
Not Before: ${o.toISOString()}`),l&&(y+=`
Request ID: ${l}`),c){let b=`
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}`);b+=`
- ${w}`}y+=b}return`${v}
${y}`}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 _s extends V{constructor(e,s){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:s,message:e}),this.name="WebAuthnUnknownError",this.originalError=s}}function kg({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($l(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 Ag({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($l(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 Eg{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 Pg=new Eg;function Cg(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=Rs(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 Rg(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=Rs(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 jg(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:Ke(new Uint8Array(t.response.attestationObject)),clientDataJSON:Ke(new Uint8Array(t.response.clientDataJSON))},type:"public-key",clientExtensionResults:t.getClientExtensionResults(),authenticatorAttachment:(e=s.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function Og(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:Ke(new Uint8Array(r.authenticatorData)),clientDataJSON:Ke(new Uint8Array(r.clientDataJSON)),signature:Ke(new Uint8Array(r.signature)),userHandle:r.userHandle?Ke(new Uint8Array(r.userHandle)):void 0},type:"public-key",clientExtensionResults:n,authenticatorAttachment:(e=s.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function $l(t){return t==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(t)}function ga(){var t,e;return!!(z()&&"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 Dg(t){try{const e=await navigator.credentials.create(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new _s("Browser returned unexpected credential type",e)}:{data:null,error:new _s("Empty credential response",e)}}catch(e){return{data:null,error:kg({error:e,options:t})}}}async function Ig(t){try{const e=await navigator.credentials.get(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new _s("Browser returned unexpected credential type",e)}:{data:null,error:new _s("Empty credential response",e)}}catch(e){return{data:null,error:Ag({error:e,options:t})}}}const Ng={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},Mg={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function Ss(...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]=Ss(o,a):n[i]=Ss(a)}else n[i]=a}return n}function $g(t,e){return Ss(Ng,t,e||{})}function Lg(t,e){return Ss(Mg,t,e||{})}class Bg{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??Pg.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=$g(a.webauthn.credential_options.publicKey,i==null?void 0:i.create),{data:u,error:h}=await Dg({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=Lg(a.webauthn.credential_options.publicKey,i==null?void 0:i.request),{data:u,error:h}=await Ig(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 k(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 Lt("rpId is required for WebAuthn authentication")};try{if(!ga())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 k(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 Lt("rpId is required for WebAuthn registration")};try{if(!ga())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 k(a)?{data:null,error:a}:{data:null,error:new We("Unexpected error in register",a)}}}}xg();const Vg={url:Nm,storageKey:Mm,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:$m,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1};async function ya(t,e,s){return await s()}const st={};class Bt{get jwks(){var e,s;return(s=(e=st[this.storageKey])===null||e===void 0?void 0:e.jwks)!==null&&s!==void 0?s:{keys:[]}}set jwks(e){st[this.storageKey]=Object.assign(Object.assign({},st[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,s;return(s=(e=st[this.storageKey])===null||e===void 0?void 0:e.cachedAt)!==null&&s!==void 0?s:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){st[this.storageKey]=Object.assign(Object.assign({},st[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=Bt.nextInstanceID[this.storageKey])!==null&&s!==void 0?s:0,Bt.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!i.debug,typeof i.debug=="function"&&(this.logger=i.debug),this.instanceID>0&&z()){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 vg({url:i.url,headers:i.headers,fetch:i.fetch}),this.url=i.url,this.headers=i.headers,this.fetch=Il(i.fetch),this.lock=i.lock||ya,this.detectSessionInUrl=i.detectSessionInUrl,this.flowType=i.flowType,this.hasCustomAuthorizationHeader=i.hasCustomAuthorizationHeader,this.throwOnError=i.throwOnError,i.lock?this.lock=i.lock:this.persistSession&&z()&&(!((n=globalThis==null?void 0:globalThis.navigator)===null||n===void 0)&&n.locks)?this.lock=bg:this.lock=ya,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 Bg(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:Dl()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=ma(this.memoryStorage)),i.userStorage&&(this.userStorage=i.userStorage)):(this.memoryStorage={},this.storage=ma(this.memoryStorage)),z()&&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} (${Rl}) ${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(z()&&(s=Zm(window.location.href),this._isImplicitGrantCallback(s)?n="implicit":await this._isPKCECallback(s)&&(n="pkce")),z()&&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),Wm(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 k(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(k(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,p=null;this.flowType==="pkce"&&([f,p]=await Qe(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:p},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 es("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`),k(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:fa})}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:fa})}else throw new es("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(k(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,p;if("message"in e)f=e.message,p=e.signature;else{const{chain:g,wallet:v,statement:y,options:b}=e;let w;if(z())if(typeof v=="object")w=v;else{const j=window;if("ethereum"in j&&typeof j.ethereum=="object"&&"request"in j.ethereum&&typeof j.ethereum.request=="function")w=j.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 v!="object"||!(b!=null&&b.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");w=v}const x=new URL((s=b==null?void 0:b.url)!==null&&s!==void 0?s:window.location.href),S=await w.request({method:"eth_requestAccounts"}).then(j=>j).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 A=Ml(S[0]);let O=(n=b==null?void 0:b.signInWithEthereum)===null||n===void 0?void 0:n.chainId;if(!O){const j=await w.request({method:"eth_chainId"});O=_g(j)}const E={domain:x.host,address:A,statement:y,uri:x.href,version:"1",chainId:O,nonce:(r=b==null?void 0:b.signInWithEthereum)===null||r===void 0?void 0:r.nonce,issuedAt:(a=(i=b==null?void 0:b.signInWithEthereum)===null||i===void 0?void 0:i.issuedAt)!==null&&a!==void 0?a:new Date,expirationTime:(o=b==null?void 0:b.signInWithEthereum)===null||o===void 0?void 0:o.expirationTime,notBefore:(l=b==null?void 0:b.signInWithEthereum)===null||l===void 0?void 0:l.notBefore,requestId:(c=b==null?void 0:b.signInWithEthereum)===null||c===void 0?void 0:c.requestId,resources:(u=b==null?void 0:b.signInWithEthereum)===null||u===void 0?void 0:u.resources};f=Tg(E),p=await w.request({method:"personal_sign",params:[Sg(f),A]})}try{const{data:g,error:v}=await C(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:f,signature:p},!((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(v)throw v;if(!g||!g.session||!g.user){const y=new Ze;return this._returnResult({data:{user:null,session:null},error:y})}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(k(g))return this._returnResult({data:{user:null,session:null},error:g});throw g}}async signInWithSolana(e){var s,n,r,i,a,o,l,c,u,h,d,f;let p,g;if("message"in e)p=e.message,g=e.signature;else{const{chain:v,wallet:y,statement:b,options:w}=e;let x;if(z())if(typeof y=="object")x=y;else{const A=window;if("solana"in A&&typeof A.solana=="object"&&("signIn"in A.solana&&typeof A.solana.signIn=="function"||"signMessage"in A.solana&&typeof A.solana.signMessage=="function"))x=A.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 y!="object"||!(w!=null&&w.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");x=y}const S=new URL((s=w==null?void 0:w.url)!==null&&s!==void 0?s:window.location.href);if("signIn"in x&&x.signIn){const A=await x.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}),b?{statement:b}:null));let O;if(Array.isArray(A)&&A[0]&&typeof A[0]=="object")O=A[0];else if(A&&typeof A=="object"&&"signedMessage"in A&&"signature"in A)O=A;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in O&&"signature"in O&&(typeof O.signedMessage=="string"||O.signedMessage instanceof Uint8Array)&&O.signature instanceof Uint8Array)p=typeof O.signedMessage=="string"?O.signedMessage:new TextDecoder().decode(O.signedMessage),g=O.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in x)||typeof x.signMessage!="function"||!("publicKey"in x)||typeof x!="object"||!x.publicKey||!("toBase58"in x.publicKey)||typeof x.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");p=[`${S.host} wants you to sign in with your Solana account:`,x.publicKey.toBase58(),...b?["",b,""]:[""],"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(O=>`- ${O}`)]:[]].join(`
`);const A=await x.signMessage(new TextEncoder().encode(p),"utf8");if(!A||!(A instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");g=A}}try{const{data:v,error:y}=await C(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:p,signature:Ke(g)},!((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(y)throw y;if(!v||!v.session||!v.user){const b=new Ze;return this._returnResult({data:{user:null,session:null},error:b})}return v.session&&(await this._saveSession(v.session),await this._notifyAllSubscribers("SIGNED_IN",v.session)),this._returnResult({data:Object.assign({},v),error:y})}catch(v){if(k(v))return this._returnResult({data:{user:null,session:null},error:v});throw v}}async _exchangeCodeForSession(e){const s=await Be(this.storage,`${this.storageKey}-code-verifier`),[n,r]=(s??"").split("/");try{if(!n&&this.flowType==="pkce")throw new qm;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`),k(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(k(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 Qe(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 es("You must provide either an email or phone number.")}catch(o){if(await K(this.storage,`${this.storageKey}-code-verifier`),k(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(k(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 Qe(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:mg});return!((i=c.data)===null||i===void 0)&&i.url&&z()&&!(!((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`),k(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 Q;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(k(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 es("You must provide either an email or phone number and a type")}catch(s){if(k(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 Be(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()<tn:!1;if(this._debug("#__loadSession()",`session has${n?"":" not"} expired`,"expires_at",e.expires_at),!n){if(this.userStorage){const a=await Be(this.userStorage,this.storageKey+"-user");a!=null&&a.user?e.user=a.user:e.user=rn()}if(this.storage.isServer&&e.user&&!e.user.__isUserNotAvailableProxy){const a={value:this.suppressGetSessionWarning};e.user=hg(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 Q}: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(k(s))return Fm(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 Q;const a=r.session;let o=null,l=null;this.flowType==="pkce"&&e.email!=null&&([o,l]=await Qe(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`),k(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 Q;const s=Date.now()/1e3;let n=s,r=!0,i=null;const{payload:a}=nn(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(k(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 Q;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(k(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async _getSessionFromURL(e,s){try{if(!z())throw new ts("No browser detected.");if(e.error||e.error_description||e.error_code)throw new ts(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 aa("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new ts("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 aa("No code detected.");const{data:b,error:w}=await this._exchangeCodeForSession(e.code);if(w)throw w;const x=new URL(window.location.href);return x.searchParams.delete("code"),window.history.replaceState(window.history.state,"",x.toString()),{data:{session:b.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 ts("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<=it&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${f}s, should have been closer to ${h}s`);const p=d-h;u-p>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",p,d,u):u-p<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",p,d,u);const{data:g,error:v}=await this._getUser(i);if(v)throw v;const y={provider_token:n,provider_refresh_token:r,access_token:i,expires_in:h,expires_at:d,refresh_token:a,token_type:c,user:g.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:y,redirectType:e.type},error:null})}catch(n){if(k(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 Be(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&&!(Um(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=Xm(),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 Qe(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`),k(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(k(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 z()&&!(!((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(k(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`),k(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(k(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 tg(async r=>(r>0&&await eg(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&&sn(i)&&Date.now()+a-n<it})}catch(n){if(this._debug(s,"error",n),k(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),z()&&!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 Be(this.storage,this.storageKey);if(r&&this.userStorage){let a=await Be(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!a&&(a={user:r.user},await at(this.userStorage,this.storageKey+"-user",a)),r.user=(e=a==null?void 0:a.user)!==null&&e!==void 0?e:rn()}else if(r&&!r.user&&!r.user){const a=await Be(this.storage,this.storageKey+"-user");a&&(a!=null&&a.user)?(r.user=a.user,await K(this.storage,this.storageKey+"-user"),await at(this.storage,this.storageKey,r)):r.user=rn()}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()<tn;if(this._debug(n,`session has${i?"":" not"} expired with margin of ${tn}s`),i){if(this.autoRefreshToken&&r.refresh_token){const{error:a}=await this._callRefreshToken(r.refresh_token);a&&(console.error(a),sn(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 Q;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const r=`#_callRefreshToken(${e.substring(0,5)}...)`;this._debug(r,"begin");try{this.refreshingDeferred=new Os;const{data:i,error:a}=await this._refreshAccessToken(e);if(a)throw a;if(!i.session)throw new Q;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),k(i)){const a={data:null,error:i};return sn(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 at(this.userStorage,this.storageKey+"-user",{user:s.user});const r=Object.assign({},s);delete r.user;const i=ha(r);await at(this.storage,this.storageKey,i)}else{const r=ha(s);await at(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&&z()&&(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(),it);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)/it);this._debug("#_autoRefreshTokenTick()",`access token expires in ${r} ticks, a tick lasts ${it}ms, refresh threshold is ${Un} ticks`),r<=Un&&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 Nl)this._debug("auto refresh token tick lock not available");else throw e}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!z()||!(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 Qe(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(k(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(k(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"?jg(e.webauthn.credential_response):Og(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(k(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:Cg(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:Rg(o.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(s){if(k(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}=nn(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 Q})})}catch(s){if(k(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 Q});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&&z()&&!(s!=null&&s.skipBrowserRedirect)&&window.location.assign(a.data.redirect_url),a})}catch(n){if(k(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 Q});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&&z()&&!(s!=null&&s.skipBrowserRedirect)&&window.location.assign(a.data.redirect_url),a})}catch(n){if(k(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 Q})})}catch(e){if(k(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 Q})})}catch(s){if(k(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+Bm>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:p}=await this.getSession();if(p||!f.session)return this._returnResult({data:null,error:p});n=f.session.access_token}const{header:r,payload:i,signature:a,raw:{header:o,payload:l}}=nn(n);s!=null&&s.allowExpired||lg(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=cg(r.alg),h=await crypto.subtle.importKey("jwk",c,u,!0,["verify"]);if(!await crypto.subtle.verify(u,h,a,Jm(`${o}.${l}`)))throw new qn("Invalid JWT signature");return{data:{claims:i,header:r,signature:a},error:null}}catch(n){if(k(n))return this._returnResult({data:null,error:n});throw n}}}Bt.nextInstanceID={};const Ug=Bt,Fg="2.88.0";let _t="";typeof Deno<"u"?_t="deno":typeof document<"u"?_t="web":typeof navigator<"u"&&navigator.product==="ReactNative"?_t="react-native":_t="node";const Wg={"X-Client-Info":`supabase-js-${_t}/${Fg}`},qg={headers:Wg},Hg={schema:"public"},Kg={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},zg={};function Vt(t){"@babel/helpers - typeof";return Vt=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},Vt(t)}function Gg(t,e){if(Vt(t)!="object"||!t)return t;var s=t[Symbol.toPrimitive];if(s!==void 0){var n=s.call(t,e||"default");if(Vt(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Jg(t){var e=Gg(t,"string");return Vt(e)=="symbol"?e:e+""}function Yg(t,e,s){return(e=Jg(e))in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}function va(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?va(Object(s),!0).forEach(function(n){Yg(t,n,s[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(s)):va(Object(s)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(s,n))})}return t}const Xg=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),Zg=()=>Headers,Qg=(t,e,s)=>{const n=Xg(s),r=Zg();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 ey(t){return t.endsWith("/")?t:t+"/"}function ty(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 sy(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(ey(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var ny=class extends Ug{constructor(t){super(t)}},ry=class{constructor(t,e,s){var n,r;this.supabaseUrl=t,this.supabaseKey=e;const i=sy(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:Hg,realtime:zg,auth:B(B({},Kg),{},{storageKey:a}),global:qg},l=ty(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=Qg(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 $p(new URL("rest/v1",i).href,{headers:this.headers,schema:l.db.schema,fetch:this.fetch}),this.storage=new Im(this.storageUrl.href,this.headers,this.fetch,s==null?void 0:s.storage),l.accessToken||this._listenForAuthEvents()}get functions(){return new Op(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 ny({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 em(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 iy=(t,e,s)=>new ry(t,e,s);function ay(){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}ay()&&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 oy="https://woqsriglllgyushlflxh.supabase.co",ly="sb_publishable_HDPOzEpyVotVL_y52W_6XA_lmgomhSu",cy=iy(oy,ly,{auth:{storage:localStorage,persistSession:!0,autoRefreshToken:!0}}),Se="#F2506A",ge="#B67AEC",wa="#27BBE9",uy={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}}},ba={hidden:{opacity:0,y:8},visible:{opacity:1,y:0,transition:{type:"spring",stiffness:500,damping:30}}};function hy(){return m.jsxs("div",{className:"flex gap-3",children:[m.jsx(Et,{className:"h-7 w-7 flex-shrink-0",children:m.jsx(Pt,{style:{background:`linear-gradient(135deg, ${Se}, ${ge})`},children:m.jsx("img",{src:ht,alt:"CP",className:"h-4 w-4 object-contain"})})}),m.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)=>m.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-white/50 animate-bounce",style:{animationDelay:t}},e))})]})}const dy=/(https?:\/\/[^\s]+|[\w.+-]+@[\w-]+\.[a-z]{2,}|(?:(?:\+61|0)[0-9][\s0-9]{7,10}))/gi;function fy(t){return t.split(dy).map((s,n)=>{if(/^https?:\/\//i.test(s)){const r=s.replace(/^https?:\/\/(www\.)?/,"").replace(/\/$/,"");return m.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)?m.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())?m.jsx("a",{href:`tel:${s.replace(/\s/g,"")}`,className:"underline underline-offset-2 opacity-80 hover:opacity-100",children:s},n):s})}function py(){const[t,e]=_.useState(!1),[s,n]=_.useState([]),[r,i]=_.useState(""),[a,o]=_.useState(!1),[l,c]=_.useState(null),u=_.useRef(null),h=_.useRef(null);_.useEffect(()=>{u.current&&(u.current.scrollTop=u.current.scrollHeight)},[s,a]),_.useEffect(()=>{t&&setTimeout(()=>{var p;return(p=h.current)==null?void 0:p.focus()},300)},[t]);const d=_.useCallback(()=>e(p=>!p),[]),f=async p=>{p.preventDefault();const g=r.trim();if(!g||a)return;const v={role:"user",content:g},y=[...s,v];n(y),i(""),o(!0),c(null);try{const{data:b,error:w}=await cy.functions.invoke("chat-bot",{body:{messages:y}});if(w)throw console.error("[chat-bot] function error:",w),w;if(!(b!=null&&b.reply))throw console.error("[chat-bot] unexpected response:",b),new Error("No reply in response");n(x=>[...x,{role:"assistant",content:b.reply}])}catch(b){console.error("[chat-bot] catch:",b),c("Sorry, I couldn't connect right now. Please call us on 03 9081 4270.")}finally{o(!1)}};return m.jsxs("div",{className:"fixed bottom-6 right-6 z-50 flex flex-col items-end gap-4",children:[m.jsx(Rn,{children:t&&m.jsxs(Ce.div,{variants:uy,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:[m.jsxs("div",{className:"relative p-4 flex items-center justify-between overflow-hidden",style:{borderBottom:"1px solid rgba(255,255,255,0.08)"},children:[m.jsx("div",{className:"absolute left-0 top-0 bottom-0 w-[4px]",style:{background:`linear-gradient(to bottom, ${Se}, ${ge}, ${wa})`}}),m.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%)"}}),m.jsxs("div",{className:"flex items-center gap-3 pl-3 relative z-10",children:[m.jsxs("div",{className:"relative",children:[m.jsx("div",{className:"h-10 w-10 rounded-xl flex items-center justify-center overflow-hidden",style:{background:`linear-gradient(135deg, ${Se}, ${ge})`},children:m.jsx("img",{src:ht,alt:"CP",className:"h-7 w-7 object-contain"})}),m.jsx("span",{className:"absolute -bottom-0.5 -right-0.5 h-3 w-3 rounded-full bg-emerald-500 border-2 border-[#1A1A2E]"})]}),m.jsxs("div",{children:[m.jsx("p",{className:"text-sm font-semibold text-white leading-tight",children:"Contemporary Psychology"}),m.jsx("p",{className:"text-[11px] text-white/50",children:"Ask me anything about our services"})]})]}),m.jsx(Dn,{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:()=>e(!1),children:m.jsx(hs,{className:"h-4 w-4"})})]}),m.jsxs("div",{ref:u,className:"flex flex-col gap-4 overflow-y-auto p-4",style:{height:340},children:[m.jsxs(Ce.div,{variants:ba,initial:"hidden",animate:"visible",className:"flex gap-3",children:[m.jsx(Et,{className:"h-7 w-7 flex-shrink-0",children:m.jsx(Pt,{style:{background:`linear-gradient(135deg, ${Se}, ${ge})`},children:m.jsx("img",{src:ht,alt:"CP",className:"h-4 w-4 object-contain"})})}),m.jsxs("div",{className:"flex flex-col gap-1 max-w-[85%]",children:[m.jsx("span",{className:"text-[11px] font-medium text-white/40",children:"CP Assistant"}),m.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?"})]})]}),s.map((p,g)=>m.jsxs(Ce.div,{variants:ba,initial:"hidden",animate:"visible",className:ze("flex gap-3",p.role==="user"&&"flex-row-reverse"),children:[p.role==="assistant"?m.jsx(Et,{className:"h-7 w-7 flex-shrink-0",children:m.jsx(Pt,{style:{background:`linear-gradient(135deg, ${Se}, ${ge})`},children:m.jsx("img",{src:ht,alt:"CP",className:"h-4 w-4 object-contain"})})}):m.jsx(Et,{className:"h-7 w-7 flex-shrink-0",children:m.jsx(Pt,{style:{background:`linear-gradient(135deg, ${wa}, ${ge})`},children:m.jsx("span",{className:"text-[10px] font-bold text-white",children:"You"})})}),m.jsxs("div",{className:ze("flex flex-col gap-1 max-w-[85%]",p.role==="user"&&"items-end"),children:[p.role==="assistant"&&m.jsx("span",{className:"text-[11px] font-medium text-white/40",children:"CP Assistant"}),m.jsx("div",{className:ze("px-4 py-2.5 text-sm leading-relaxed break-words",p.role==="assistant"?"rounded-2xl rounded-tl-none text-white/90":"rounded-2xl rounded-tr-none text-white"),style:p.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:fy(p.content)})]})]},g)),a&&m.jsx(hy,{}),l&&m.jsx("div",{className:"text-xs text-red-400/80 text-center px-4",children:l})]}),m.jsxs("form",{onSubmit:f,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:[m.jsx("input",{ref:h,type:"text",value:r,onChange:p=>i(p.target.value),placeholder:"Ask about services, fees, booking…",disabled:a,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:p=>p.currentTarget.style.borderColor="rgba(242,80,106,0.5)",onBlur:p=>p.currentTarget.style.borderColor="rgba(255,255,255,0.10)"}),m.jsx(Dn,{type:"submit",size:"icon",disabled:!r.trim()||a,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:m.jsx(ec,{className:"h-4 w-4 text-white"})})]}),m.jsxs("p",{className:"text-center text-[10px] text-white/20 pb-2.5 px-4",children:["Not medical advice · For clinical support, please"," ",m.jsx("a",{href:"tel:0390814270",className:"underline hover:text-white/40 transition-colors",children:"call us"})]})]},"chat-window")}),m.jsxs(Ce.button,{whileHover:{scale:1.06},whileTap:{scale:.94},onClick:d,className:"relative group flex h-14 w-14 items-center justify-center rounded-full shadow-2xl cursor-pointer transition-all duration-300",style:{background:t?"#6B7280":`linear-gradient(135deg, ${Se}, ${ge})`},"aria-label":t?"Close chat":"Open chat",children:[m.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})`}}),m.jsx(Rn,{mode:"wait",children:t?m.jsx(Ce.span,{initial:{rotate:-90,opacity:0},animate:{rotate:0,opacity:1},exit:{rotate:90,opacity:0},transition:{duration:.18},children:m.jsx(hs,{className:"h-6 w-6 text-white"})},"close"):m.jsx(Ce.span,{initial:{rotate:90,opacity:0},animate:{rotate:0,opacity:1},exit:{rotate:-90,opacity:0},transition:{duration:.18},children:m.jsx(Ql,{className:"h-6 w-6 text-white"})},"open")})]})]})}const Hn="/book-online",my="https://clientportal.zandahealth.com/clientportal/contemporarypsychology",Ae="03 9081 4270",ss="reception@contemporarypsychology.com.au",gy="G06-G07/22 St Kilda Road, St Kilda VIC 3182",xa=[{label:"LinkedIn",href:"https://www.linkedin.com/company/contemporary-psychology/posts/?feedView=all",icon:m.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:"h-4 w-4","aria-hidden":"true",children:m.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:m.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:"h-4 w-4","aria-hidden":"true",children:m.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:m.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:"h-4 w-4","aria-hidden":"true",children:m.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"})})}],_a=[{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:"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"}]}],yy=[{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"}],vy=[{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"}],wy=[{label:"Book Online",href:Hn},{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"}],by=[[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]],Ll=1400,Bl=600,ce=by.map(([t,e])=>[t/100*Ll,e/100*Bl]),xy=(()=>{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 _y(){return m.jsxs("svg",{"aria-hidden":"true",className:"absolute inset-0 w-full h-full pointer-events-none select-none",viewBox:`0 0 ${Ll} ${Bl}`,preserveAspectRatio:"xMidYMid slice",xmlns:"http://www.w3.org/2000/svg",children:[xy.map(([t,e,s,n],r)=>m.jsx("line",{x1:t,y1:e,x2:s,y2:n,stroke:"#1a7aad",strokeWidth:"0.9",opacity:"0.18"},r)),ce.map(([t,e],s)=>m.jsx("circle",{cx:t,cy:e,r:s%6===0?4:2.2,fill:"#1a7aad",opacity:s%6===0?.38:.25},s))]})}function Oy({children:t}){const[e,s]=_.useState(!1),[n,r]=_.useState(null),[i,a]=_.useState(null),o=_.useRef(null),l=Wl(),c=h=>{o.current&&clearTimeout(o.current),r(h)},u=()=>{o.current=setTimeout(()=>r(null),120)};return m.jsxs("div",{className:"min-h-screen flex flex-col font-poppins bg-[#FAFAF8] text-[#3D3D5C]",children:[m.jsx("div",{className:"bg-[#b2defd] text-[#071B27] text-xs py-2.5 px-4",children:m.jsxs("div",{className:"max-w-7xl mx-auto flex flex-col sm:flex-row items-center justify-between gap-1.5",children:[m.jsx("span",{className:"text-[#071B27]/70 text-center sm:text-left",children:"Celebrating 11 Years of Clinical Practice in Melbourne"}),m.jsxs("div",{className:"flex items-center gap-4 text-[#071B27]/80",children:[m.jsxs("a",{href:`tel:${Ae.replace(/\s/g,"")}`,className:"hover:text-[#071B27] transition-colors flex items-center gap-1.5",children:[m.jsx(Kt,{className:"h-3 w-3"}),Ae]}),m.jsx("span",{className:"hidden sm:block text-[#071B27]/30",children:"·"}),m.jsxs("a",{href:`mailto:${ss}`,className:"hover:text-[#071B27] transition-colors hidden sm:flex items-center gap-1.5",children:[m.jsx(Pr,{className:"h-3 w-3"}),ss]}),m.jsx("span",{className:"hidden sm:block text-[#071B27]/30",children:"·"}),m.jsx("div",{className:"hidden sm:flex items-center gap-2.5",children:xa.map(h=>m.jsx("a",{href:h.href,target:"_blank",rel:"noopener noreferrer","aria-label":`Follow us on ${h.label}`,className:"text-[#071B27]/50 hover:text-[#071B27] transition-colors",children:h.icon},h.label))})]})]})}),m.jsxs("header",{className:"sticky top-0 z-50 bg-white/97 backdrop-blur-md border-b border-[#E2DCEF] shadow-sm",children:[m.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:m.jsxs("div",{className:"flex items-center justify-between h-16",children:[m.jsxs(ne,{to:"/",className:"flex items-center gap-3 flex-shrink-0",children:[m.jsx("img",{src:ht,alt:"Contemporary Psychology",className:"h-10 w-auto"}),m.jsxs("span",{className:"hidden sm:block font-bold text-[#1A1A2E] text-sm leading-tight font-lora",children:["Contemporary",m.jsx("br",{}),"Psychology"]})]}),m.jsx("nav",{className:"hidden lg:flex items-center gap-0.5",children:_a.map(h=>m.jsxs("div",{className:"relative",onMouseEnter:()=>h.children&&c(h.label),onMouseLeave:()=>h.children&&u(),children:[m.jsxs(ne,{to:h.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(h.href)&&h.href!=="/"?"text-[#F2506A] bg-[#FDF0F4]":"text-[#3D3D5C] hover:text-[#1A1A2E] hover:bg-[#F8F7FD]"}`,children:[h.label,h.children&&m.jsx(Er,{className:`h-3.5 w-3.5 transition-transform duration-200 ${n===h.label?"rotate-180":""}`})]}),h.children&&n===h.label&&m.jsx("div",{className:"absolute top-full left-1/2 -translate-x-1/2 pt-1 z-50",children:m.jsx("div",{className:`bg-white border border-[#E2DCEF] rounded-xl shadow-lg py-1.5 ${h.wide?"w-[min(580px,calc(100vw-2rem))] grid grid-cols-2":"min-w-[200px]"}`,children:h.children.map(d=>m.jsx(ne,{to:d.href,onClick:()=>r(null),className:`block px-4 py-2 text-sm font-poppins text-left transition-colors whitespace-nowrap ${l.pathname===d.href?"text-[#F2506A] bg-[#FDF0F4]":"text-[#3D3D5C] hover:text-[#1A1A2E] hover:bg-[#F8F7FD]"}`,children:d.label},d.label))})})]},h.label))}),m.jsxs("div",{className:"flex items-center gap-3",children:[m.jsx(hp,{}),m.jsx("a",{href:my,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"}),m.jsx(ne,{to:Hn,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"}),m.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?m.jsx(hs,{className:"h-5 w-5"}):m.jsx(Zl,{className:"h-5 w-5"})})]})]})}),e&&m.jsxs("div",{className:"lg:hidden border-t border-[#E2DCEF] bg-white px-4 py-3 space-y-1",children:[_a.map(h=>m.jsx("div",{children:h.children?m.jsxs(m.Fragment,{children:[m.jsxs("button",{onClick:()=>a(i===h.label?null:h.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:[h.label,m.jsx(Er,{className:`h-4 w-4 transition-transform duration-200 ${i===h.label?"rotate-180":""}`})]}),i===h.label&&m.jsxs("div",{className:"ml-3 border-l border-[#E2DCEF] pl-3 space-y-1 mt-1 mb-1",children:[m.jsx(ne,{to:h.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"}),h.children.map(d=>m.jsx(ne,{to:d.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:d.label},d.label))]})]}):m.jsx(ne,{to:h.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:h.label})},h.label)),m.jsxs("div",{className:"pt-3 border-t border-[#E2DCEF] flex flex-col gap-2",children:[m.jsxs("a",{href:`tel:${Ae.replace(/\s/g,"")}`,onClick:()=>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:[m.jsx(Kt,{className:"h-4 w-4"}),"Call ",Ae]}),m.jsx(ne,{to:Hn,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"})]})]})]}),m.jsx("main",{className:"flex-1",children:t}),m.jsx(py,{}),m.jsxs("footer",{className:"text-[#071B27]/70",style:{backgroundColor:"#b2defd"},children:[m.jsx("div",{className:"h-[3px] w-full",style:{background:"linear-gradient(to right, #F2506A, #B67AEC, #27BBE9)"}}),m.jsx("div",{className:"border-b border-[#071B27]/10 bg-[#071B27]/05",children:m.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:[m.jsxs("div",{children:[m.jsx("p",{className:"font-lora font-bold text-[#071B27] text-base",children:"The easiest way to book is to call us."}),m.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."})]}),m.jsxs("a",{href:`tel:${Ae.replace(/\s/g,"")}`,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:[m.jsx(Kt,{className:"h-4 w-4"}),Ae]})]})}),m.jsxs("div",{className:"relative overflow-hidden",children:[m.jsx(_y,{}),m.jsxs("div",{className:"relative z-10 max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-14",children:[m.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 lg:grid-cols-5 gap-10",children:[m.jsxs("div",{className:"md:col-span-3 lg:col-span-2 space-y-4",children:[m.jsx("img",{src:ht,alt:"Contemporary Psychology",className:"h-10 w-auto brightness-0 opacity-70"}),m.jsx("p",{className:"text-[#071B27] font-semibold text-sm leading-snug font-lora italic",children:"Leading Psychologists. Grounded in Neuroscience. Built for Your Story."}),m.jsx("p",{className:"text-xs text-[#071B27]/60 leading-relaxed",children:"Evidence-based psychological support for individuals, couples, and families across Melbourne."}),m.jsxs("div",{className:"space-y-2 text-xs",children:[m.jsxs("div",{className:"flex items-start gap-2",children:[m.jsx(Xl,{className:"h-3.5 w-3.5 mt-0.5 text-[#F2506A] flex-shrink-0"}),m.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:gy})]}),m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx(Kt,{className:"h-3.5 w-3.5 text-[#F2506A] flex-shrink-0"}),m.jsx("a",{href:`tel:${Ae.replace(/\s/g,"")}`,className:"hover:text-[#071B27] transition-colors",children:Ae})]}),m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx(Pr,{className:"h-3.5 w-3.5 text-[#F2506A] flex-shrink-0"}),m.jsx("a",{href:`mailto:${ss}`,className:"hover:text-[#071B27] transition-colors text-xs whitespace-nowrap",children:ss})]})]}),m.jsx("div",{className:"flex items-center gap-3 pt-1",children:xa.map(h=>m.jsx("a",{href:h.href,target:"_blank",rel:"noopener noreferrer","aria-label":`Follow us on ${h.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:h.icon},h.label))})]}),m.jsxs("div",{className:"space-y-3",children:[m.jsx("h3",{className:"text-[#071B27] font-semibold text-xs uppercase tracking-widest",children:"About"}),m.jsx("ul",{className:"space-y-2",children:vy.map(h=>m.jsx("li",{children:m.jsx(ne,{to:h.href,className:"text-sm text-[#071B27]/65 hover:text-[#071B27] transition-colors",children:h.label})},h.label))})]}),m.jsxs("div",{className:"space-y-3",children:[m.jsx("h3",{className:"text-[#071B27] font-semibold text-xs uppercase tracking-widest",children:"Services"}),m.jsx("ul",{className:"space-y-2",children:yy.map(h=>m.jsx("li",{children:m.jsx(ne,{to:h.href,className:"text-sm text-[#071B27]/65 hover:text-[#071B27] transition-colors",children:h.label})},h.label))})]}),m.jsxs("div",{className:"space-y-3 flex flex-col",children:[m.jsx("h3",{className:"text-[#071B27] font-semibold text-xs uppercase tracking-widest",children:"Support"}),m.jsx("ul",{className:"space-y-2",children:wy.map(h=>m.jsx("li",{children:h.external?m.jsx("a",{href:h.href,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-[#071B27]/65 hover:text-[#071B27] transition-colors",children:h.label}):m.jsx(ne,{to:h.href,className:"text-sm text-[#071B27]/65 hover:text-[#071B27] transition-colors",children:h.label})},h.label))}),m.jsx("div",{className:"mt-auto pt-6",children:m.jsx("a",{href:"https://www.psychologytoday.com/profile/918210",target:"_blank",rel:"noopener noreferrer",children:m.jsx("img",{src:"/images/psychtoday.png",alt:"Contemporary Psychology on Psychology Today",className:"h-14 w-auto"})})})]})]}),m.jsxs("div",{className:"border-t border-[#071B27]/15 mt-12 pt-6",children:[m.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."}),m.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-3 text-xs text-[#071B27]/40",children:[m.jsxs("p",{children:["© ",new Date().getFullYear()," Contemporary Psychology · All rights reserved."]}),m.jsx(ne,{to:"/privacy-policy",className:"hover:text-[#071B27]/60 transition-colors",children:"Privacy Policy"})]})]})]})]})]})]})}export{Dn as B,Er as C,Yl as F,Xl as M,Oy as P,ec as S,tc as U,Ji as _,Kt as a,Ql as b,Pr as c,Rs as d,jy as e,Gl as f,Cr as g,np as h,Jl as i,Ce as m,cy as s,tp as t};