@freeday-ai/webchat 2026.1.1-4.8.42.12361 → 2026.1.1-4.9.42.12362

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -167,7 +167,7 @@ You might need to use a local HTTP server (instead of file://): https://reactjs.
167
167
  `).replace(/\r/g,`
168
168
  `)).length,a=0;a<r;a++){var l=e.charCodeAt(a),c=null;l<128?n++:c=l>127&&l<2048?String.fromCharCode(l>>6|192,63&l|128):String.fromCharCode(l>>12|224,l>>6&63|128,63&l|128),zu(c)||(n>t&&(s+=e.substring(t,n)),s+=c,t=n=a+1)}return n>t&&(s+=e.substring(t,e.length)),s},mV=!!vS||!!gS,L6="text/plain",Cb=function(e,t,n){var r;n===void 0&&(n=!0);var[a,s]=e.split("?"),l=Lt({},t),c=(r=s?.split("&").map((p=>{var v,[y,w]=p.split("="),T=n&&(v=l[y])!==null&&v!==void 0?v:w;return delete l[y],y+"="+T})))!==null&&r!==void 0?r:[],h=Ej(l);return h&&c.push(h),a+"?"+c.join("&")},I0=(e,t)=>JSON.stringify(e,((n,r)=>typeof r=="bigint"?r.toString():r),t),rC=e=>{var{data:t,compression:n}=e;if(t){if(n===Vu.GZipJS){var r=hV((function(h,p){var v=h.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(h);for(var y=new vs(h.length+(h.length>>>1)),w=0,T=function(O){y[w++]=O},A=0;A<v;++A){if(w+5>y.length){var R=new vs(w+8+(v-A<<1));R.set(y),y=R}var N=h.charCodeAt(A);N<128||p?T(N):N<2048?(T(192|N>>>6),T(128|63&N)):N>55295&&N<57344?(T(240|(N=65536+(1047552&N)|1023&h.charCodeAt(++A))>>>18),T(128|N>>>12&63),T(128|N>>>6&63),T(128|63&N)):(T(224|N>>>12),T(128|N>>>6&63),T(128|63&N))}return k6(y,0,w)})(I0(t)),{mtime:0}),a=new Blob([r],{type:L6});return{contentType:L6,body:a,estimatedSize:a.size}}if(n===Vu.Base64){var s=(function(h){var p,v,y,w,T,A="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",R=0,N=0,O="",M=[];if(!h)return h;h=pV(h);do p=(T=h.charCodeAt(R++)<<16|h.charCodeAt(R++)<<8|h.charCodeAt(R++))>>18&63,v=T>>12&63,y=T>>6&63,w=63&T,M[N++]=A.charAt(p)+A.charAt(v)+A.charAt(y)+A.charAt(w);while(R<h.length);switch(O=M.join(""),h.length%3){case 1:O=O.slice(0,-2)+"==";break;case 2:O=O.slice(0,-1)+"="}return O})(I0(t)),l=(h=>"data="+encodeURIComponent(typeof h=="string"?h:I0(h)))(s);return{contentType:"application/x-www-form-urlencoded",body:l,estimatedSize:new Blob([l]).size}}var c=I0(t);return{contentType:"application/json",body:c,estimatedSize:new Blob([c]).size}}},_b=[];gS&&_b.push({transport:"fetch",method:e=>{var t,n,{contentType:r,body:a,estimatedSize:s}=(t=rC(e))!==null&&t!==void 0?t:{},l=new Headers;_r(e.headers,(function(v,y){l.append(y,v)})),r&&l.append("Content-Type",r);var c=e.url,h=null;if(G4){var p=new G4;h={signal:p.signal,timeout:setTimeout((()=>p.abort()),e.timeout)}}gS(c,Lt({method:e?.method||"GET",headers:l,keepalive:e.method==="POST"&&(s||0)<52428.8,body:a,signal:(n=h)==null?void 0:n.signal},e.fetchOptions)).then((v=>v.text().then((y=>{var w={statusCode:v.status,text:y};if(v.status===200)try{w.json=JSON.parse(y)}catch(T){yt.error(T)}e.callback==null||e.callback(w)})))).catch((v=>{yt.error(v),e.callback==null||e.callback({statusCode:0,text:v})})).finally((()=>h?clearTimeout(h.timeout):null))}}),vS&&_b.push({transport:"XHR",method:e=>{var t,n=new vS;n.open(e.method||"GET",e.url,!0);var{contentType:r,body:a}=(t=rC(e))!==null&&t!==void 0?t:{};_r(e.headers,(function(s,l){n.setRequestHeader(l,s)})),r&&n.setRequestHeader("Content-Type",r),e.timeout&&(n.timeout=e.timeout),e.disableXHRCredentials||(n.withCredentials=!0),n.onreadystatechange=()=>{if(n.readyState===4){var s={statusCode:n.status,text:n.responseText};if(n.status===200)try{s.json=JSON.parse(n.responseText)}catch{}e.callback==null||e.callback(s)}},n.send(a)}}),Go!=null&&Go.sendBeacon&&_b.push({transport:"sendBeacon",method:e=>{var t=Cb(e.url,{beacon:"1"});try{var n,{contentType:r,body:a}=(n=rC(e))!==null&&n!==void 0?n:{},s=typeof a=="string"?new Blob([a],{type:r}):a;Go.sendBeacon(t,s)}catch{}}});var Ab=function(e,t){if(!(function(n){try{new RegExp(n)}catch{return!1}return!0})(t))return!1;try{return new RegExp(t).test(e)}catch{return!1}};function O6(e,t,n){return I0({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:n})}var N6={exact:(e,t)=>t.some((n=>e.some((r=>n===r)))),is_not:(e,t)=>t.every((n=>e.every((r=>n!==r)))),regex:(e,t)=>t.some((n=>e.some((r=>Ab(n,r))))),not_regex:(e,t)=>t.every((n=>e.every((r=>!Ab(n,r))))),icontains:(e,t)=>t.map(kb).some((n=>e.map(kb).some((r=>n.includes(r))))),not_icontains:(e,t)=>t.map(kb).every((n=>e.map(kb).every((r=>!n.includes(r)))))},kb=e=>e.toLowerCase();function P6(e,t){return!e||Object.entries(e).every((n=>{var[r,a]=n,s=t?.[r];if(ft(s)||zu(s))return!1;var l=[String(s)],c=N6[a.operator];return!!c&&c(a.values,l)}))}var iC=Ei("[Error tracking]");class gV{constructor(t){var n,r;this.Jt=[],this.Kt=new Uz([new Qz,new ij,new Zz,new Xz,new nj,new tj,new $z,new rj],Kz("web:javascript",Wz,Gz)),this._instance=t,this.Jt=(n=(r=this._instance.persistence)==null?void 0:r.get_property(_S))!==null&&n!==void 0?n:[]}onRemoteConfig(t){var n,r,a,s=(n=(r=t.errorTracking)==null?void 0:r.suppressionRules)!==null&&n!==void 0?n:[],l=(a=t.errorTracking)==null?void 0:a.captureExtensionExceptions;this.Jt=s,this._instance.persistence&&this._instance.persistence.register({[_S]:this.Jt,[hD]:l})}get Yt(){var t,n=!!this._instance.get_property(hD),r=this._instance.config.error_tracking.captureExtensionExceptions;return(t=r??n)!==null&&t!==void 0&&t}buildProperties(t,n){return this.Kt.buildFromUnknown(t,{syntheticException:n?.syntheticException,mechanism:{handled:n?.handled}})}sendExceptionEvent(t){var n=t.$exception_list;if(this.Xt(n)){if(this.Qt(n))return void iC.info("Skipping exception capture because a suppression rule matched");if(!this.Yt&&this.Zt(n))return void iC.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.ti(n))return void iC.info("Skipping exception capture because it was thrown by the PostHog SDK")}return this._instance.capture("$exception",t,{_noTruncate:!0,_batchKey:"exceptionEvent"})}Qt(t){if(t.length===0)return!1;var n=t.reduce(((r,a)=>{var{type:s,value:l}=a;return Ii(s)&&s.length>0&&r.$exception_types.push(s),Ii(l)&&l.length>0&&r.$exception_values.push(l),r}),{$exception_types:[],$exception_values:[]});return this.Jt.some((r=>{var a=r.values.map((s=>{var l,c=N6[s.operator],h=ar(s.value)?s.value:[s.value],p=(l=n[s.key])!==null&&l!==void 0?l:[];return h.length>0&&c(h,p)}));return r.type==="OR"?a.some(Boolean):a.every(Boolean)}))}Zt(t){return t.flatMap((n=>{var r,a;return(r=(a=n.stacktrace)==null?void 0:a.frames)!==null&&r!==void 0?r:[]})).some((n=>n.filename&&n.filename.startsWith("chrome-extension://")))}ti(t){if(t.length>0){var n,r,a,s,l=(n=(r=t[0].stacktrace)==null?void 0:r.frames)!==null&&n!==void 0?n:[],c=l[l.length-1];return(a=c==null||(s=c.filename)==null?void 0:s.includes("posthog.com/static"))!==null&&a!==void 0&&a}return!1}Xt(t){return!or(t)&&ar(t)}}var Ys=Ei("[FeatureFlags]"),M0=Ei("[FeatureFlags]",{debugEnabled:!0}),aC="$active_feature_flags",Sp="$override_feature_flags",I6="$feature_flag_payloads",F0="$override_feature_flag_payloads",M6="$feature_flag_request_id",F6="$feature_flag_evaluated_at",B6=e=>{var t={};for(var[n,r]of sb(e||{}))r&&(t[n]=r);return t},vV=e=>{var t=e.flags;return t?(e.featureFlags=Object.fromEntries(Object.keys(t).map((n=>{var r;return[n,(r=t[n].variant)!==null&&r!==void 0?r:t[n].enabled]}))),e.featureFlagPayloads=Object.fromEntries(Object.keys(t).filter((n=>t[n].enabled)).filter((n=>{var r;return(r=t[n].metadata)==null?void 0:r.payload})).map((n=>{var r;return[n,(r=t[n].metadata)==null?void 0:r.payload]})))):Ys.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),e},yV=(function(e){return e.FeatureFlags="feature_flags",e.Recordings="recordings",e})({});class bV{constructor(t){this.ii=!1,this.ei=!1,this.ri=!1,this.si=!1,this.ni=!1,this.oi=!1,this.ai=!1,this._instance=t,this.featureFlagEventHandlers=[]}li(){var t=this._instance.config.evaluation_environments;return t!=null&&t.length?t.filter((n=>{var r=n&&typeof n=="string"&&n.trim().length>0;return r||Ys.error("Invalid evaluation environment found:",n,"Expected non-empty string"),r})):[]}ui(){return this.li().length>0}flags(){if(this._instance.config.__preview_remote_config)this.oi=!0;else{var t=!this.hi&&(this._instance.config.advanced_disable_feature_flags||this._instance.config.advanced_disable_feature_flags_on_first_load);this.di({disableFlags:t})}}get hasLoadedFlags(){return this.ei}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this._instance.get_property(kS),n=this._instance.get_property(Sp),r=this._instance.get_property(F0);if(!r&&!n)return t||{};var a=fi({},t||{}),s=[...new Set([...Object.keys(r||{}),...Object.keys(n||{})])];for(var l of s){var c,h,p=a[l],v=n?.[l],y=ft(v)?(c=p?.enabled)!==null&&c!==void 0&&c:!!v,w=ft(v)?p.variant:typeof v=="string"?v:void 0,T=r?.[l],A=Lt({},p,{enabled:y,variant:y?w??p?.variant:void 0});y!==p?.enabled&&(A.original_enabled=p?.enabled),w!==p?.variant&&(A.original_variant=p?.variant),T&&(A.metadata=Lt({},p?.metadata,{payload:T,original_payload:p==null||(h=p.metadata)==null?void 0:h.payload})),a[l]=A}return this.ii||(Ys.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:r,finalDetails:a}),this.ii=!0),a}getFlagVariants(){var t=this._instance.get_property(yp),n=this._instance.get_property(Sp);if(!n)return t||{};for(var r=fi({},t),a=Object.keys(n),s=0;s<a.length;s++)r[a[s]]=n[a[s]];return this.ii||(Ys.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:n,finalFlags:r}),this.ii=!0),r}getFlagPayloads(){var t=this._instance.get_property(I6),n=this._instance.get_property(F0);if(!n)return t||{};for(var r=fi({},t||{}),a=Object.keys(n),s=0;s<a.length;s++)r[a[s]]=n[a[s]];return this.ii||(Ys.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:n,finalPayloads:r}),this.ii=!0),r}reloadFeatureFlags(){this.si||this._instance.config.advanced_disable_feature_flags||this.hi||(this.hi=setTimeout((()=>{this.di()}),5))}vi(){clearTimeout(this.hi),this.hi=void 0}ensureFlagsLoaded(){this.ei||this.ri||this.hi||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.si=t}di(t){var n;if(this.vi(),!this._instance.O())if(this.ri)this.ni=!0;else{var r={token:this._instance.config.token,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:Lt({},((n=this._instance.persistence)==null?void 0:n.get_initial_props())||{},this._instance.get_property(b0)||{}),group_properties:this._instance.get_property(_f)};(t!=null&&t.disableFlags||this._instance.config.advanced_disable_feature_flags)&&(r.disable_flags=!0),this.ui()&&(r.evaluation_environments=this.li());var a=this._instance.config.__preview_remote_config,s=a?"/flags/?v=2":"/flags/?v=2&config=true",l=this._instance.config.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":"",c=this._instance.requestRouter.endpointFor("flags",s+l);a&&(r.timezone=b6()),this.ri=!0,this._instance.ci({method:"POST",url:c,data:r,compression:this._instance.config.disable_compression?void 0:Vu.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:h=>{var p,v,y=!0;if(h.statusCode===200&&(this.ni||(this.$anon_distinct_id=void 0),y=!1),this.ri=!1,this.oi||(this.oi=!0,this._instance.fi((v=h.json)!==null&&v!==void 0?v:{})),!r.disable_flags||this.ni)if(this.ai=!y,h.json&&(p=h.json.quotaLimited)!=null&&p.includes(yV.FeatureFlags))Ys.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more.");else{var w;r.disable_flags||this.receivedFeatureFlags((w=h.json)!==null&&w!==void 0?w:{},y),this.ni&&(this.ni=!1,this.di())}}})}}getFeatureFlag(t,n){if(n===void 0&&(n={}),this.ei||this.getFlags()&&this.getFlags().length>0){var r=this.getFlagVariants()[t],a=""+r,s=this._instance.get_property(M6)||void 0,l=this._instance.get_property(F6)||void 0,c=this._instance.get_property(cb)||{};if((n.send_event||!("send_event"in n))&&(!(t in c)||!c[t].includes(a))){var h,p,v,y,w,T,A,R,N;ar(c[t])?c[t].push(a):c[t]=[a],(h=this._instance.persistence)==null||h.register({[cb]:c});var O=this.getFeatureFlagDetails(t),M={$feature_flag:t,$feature_flag_response:r,$feature_flag_payload:this.getFeatureFlagPayload(t)||null,$feature_flag_request_id:s,$feature_flag_evaluated_at:l,$feature_flag_bootstrapped_response:((p=this._instance.config.bootstrap)==null||(p=p.featureFlags)==null?void 0:p[t])||null,$feature_flag_bootstrapped_payload:((v=this._instance.config.bootstrap)==null||(v=v.featureFlagPayloads)==null?void 0:v[t])||null,$used_bootstrap_value:!this.ai};ft(O==null||(y=O.metadata)==null?void 0:y.version)||(M.$feature_flag_version=O.metadata.version);var H,V=(w=O==null||(T=O.reason)==null?void 0:T.description)!==null&&w!==void 0?w:O==null||(A=O.reason)==null?void 0:A.code;V&&(M.$feature_flag_reason=V),O!=null&&(R=O.metadata)!=null&&R.id&&(M.$feature_flag_id=O.metadata.id),ft(O?.original_variant)&&ft(O?.original_enabled)||(M.$feature_flag_original_response=ft(O.original_variant)?O.original_enabled:O.original_variant),O!=null&&(N=O.metadata)!=null&&N.original_payload&&(M.$feature_flag_original_payload=O==null||(H=O.metadata)==null?void 0:H.original_payload),this._instance.capture("$feature_flag_called",M)}return r}Ys.warn('getFeatureFlag for key "'+t+`" failed. Feature flags didn't load in time.`)}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){return this.getFlagPayloads()[t]}getRemoteConfigPayload(t,n){var r=this._instance.config.token,a={distinct_id:this._instance.get_distinct_id(),token:r};this.ui()&&(a.evaluation_environments=this.li()),this._instance.ci({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2&config=true"),data:a,compression:this._instance.config.disable_compression?void 0:Vu.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:s=>{var l,c=(l=s.json)==null?void 0:l.featureFlagPayloads;n(c?.[t]||void 0)}})}isFeatureEnabled(t,n){if(n===void 0&&(n={}),this.ei||this.getFlags()&&this.getFlags().length>0){var r=this.getFeatureFlag(t,n);return ft(r)?void 0:!!r}Ys.warn('isFeatureEnabled for key "'+t+`" failed. Feature flags didn't load in time.`)}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((n=>n!==t))}receivedFeatureFlags(t,n){if(this._instance.persistence){this.ei=!0;var r=this.getFlagVariants(),a=this.getFlagPayloads(),s=this.getFlagsWithDetails();(function(l,c,h,p,v){h===void 0&&(h={}),p===void 0&&(p={}),v===void 0&&(v={});var y=vV(l),w=y.flags,T=y.featureFlags,A=y.featureFlagPayloads;if(T){var R=l.requestId,N=l.evaluatedAt;if(ar(T)){Ys.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var O={};if(T)for(var M=0;M<T.length;M++)O[T[M]]=!0;c&&c.register({[aC]:T,[yp]:O})}else{var H=T,V=A,K=w;l.errorsWhileComputingFlags&&(H=Lt({},h,H),V=Lt({},p,V),K=Lt({},v,K)),c&&c.register(Lt({[aC]:Object.keys(B6(H)),[yp]:H||{},[I6]:V||{},[kS]:K||{}},R?{[M6]:R}:{},N?{[F6]:N}:{}))}}})(t,this._instance.persistence,r,a,s),this.pi(n)}}override(t,n){n===void 0&&(n=!1),Ys.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:n})}overrideFeatureFlags(t){if(!this._instance.__loaded||!this._instance.persistence)return Ys.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(t===!1)return this._instance.persistence.unregister(Sp),this._instance.persistence.unregister(F0),this.pi(),M0.info("All overrides cleared");if(t&&typeof t=="object"&&("flags"in t||"payloads"in t)){var n,r=t;if(this.ii=!!((n=r.suppressWarning)!==null&&n!==void 0&&n),"flags"in r){if(r.flags===!1)this._instance.persistence.unregister(Sp),M0.info("Flag overrides cleared");else if(r.flags){if(ar(r.flags)){for(var a={},s=0;s<r.flags.length;s++)a[r.flags[s]]=!0;this._instance.persistence.register({[Sp]:a})}else this._instance.persistence.register({[Sp]:r.flags});M0.info("Flag overrides set",{flags:r.flags})}}return"payloads"in r&&(r.payloads===!1?(this._instance.persistence.unregister(F0),M0.info("Payload overrides cleared")):r.payloads&&(this._instance.persistence.register({[F0]:r.payloads}),M0.info("Payload overrides set",{payloads:r.payloads}))),void this.pi()}this.pi()}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.ei){var{flags:n,flagVariants:r}=this.gi();t(n,r)}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,n,r){var a,s=(this._instance.get_property(y0)||[]).find((p=>p.flagKey===t)),l={["$feature_enrollment/"+t]:n},c={$feature_flag:t,$feature_enrollment:n,$set:l};s&&(c.$early_access_feature_name=s.name),r&&(c.$feature_enrollment_stage=r),this._instance.capture("$feature_enrollment_update",c),this.setPersonPropertiesForFlags(l,!1);var h=Lt({},this.getFlagVariants(),{[t]:n});(a=this._instance.persistence)==null||a.register({[aC]:Object.keys(B6(h)),[yp]:h}),this.pi()}getEarlyAccessFeatures(t,n,r){n===void 0&&(n=!1);var a=this._instance.get_property(y0),s=r?"&"+r.map((l=>"stage="+l)).join("&"):"";if(a&&!n)return t(a);this._instance.ci({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this._instance.config.token+s),method:"GET",callback:l=>{var c,h;if(l.json){var p=l.json.earlyAccessFeatures;return(c=this._instance.persistence)==null||c.unregister(y0),(h=this._instance.persistence)==null||h.register({[y0]:p}),t(p)}}})}gi(){var t=this.getFlags(),n=this.getFlagVariants();return{flags:t.filter((r=>n[r])),flagVariants:Object.keys(n).filter((r=>n[r])).reduce(((r,a)=>(r[a]=n[a],r)),{})}}pi(t){var{flags:n,flagVariants:r}=this.gi();this.featureFlagEventHandlers.forEach((a=>a(n,r,{errorsLoading:t})))}setPersonPropertiesForFlags(t,n){n===void 0&&(n=!0);var r=this._instance.get_property(b0)||{};this._instance.register({[b0]:Lt({},r,t)}),n&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(b0)}setGroupPropertiesForFlags(t,n){n===void 0&&(n=!0);var r=this._instance.get_property(_f)||{};Object.keys(r).length!==0&&Object.keys(r).forEach((a=>{r[a]=Lt({},r[a],t[a]),delete t[a]})),this._instance.register({[_f]:Lt({},r,t)}),n&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var n=this._instance.get_property(_f)||{};this._instance.register({[_f]:Lt({},n,{[t]:{}})})}else this._instance.unregister(_f)}reset(){this.ei=!1,this.ri=!1,this.si=!1,this.ni=!1,this.oi=!1,this.ai=!1,this.$anon_distinct_id=void 0,this.vi(),this.ii=!1}}var EV=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class oC{constructor(t,n){this.I=t,this.props={},this.mi=!1,this.yi=(r=>{var a="";return r.token&&(a=r.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),r.persistence_name?"ph_"+r.persistence_name:"ph_"+a+"_posthog"})(t),this.Y=this.bi(t),this.load(),t.debug&&yt.info("Persistence loaded",t.persistence,Lt({},this.props)),this.update_config(t,t,n),this.save()}isDisabled(){return!!this.wi}bi(t){EV.indexOf(t.persistence.toLowerCase())===-1&&(yt.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");var n=t.persistence.toLowerCase();return n==="localstorage"&&qr.H()?qr:n==="localstorage+cookie"&&bb.H()?bb:n==="sessionstorage"&&ca.H()?ca:n==="memory"?Lj:n==="cookie"?Nl:bb.H()?bb:Nl}properties(){var t={};return _r(this.props,(function(n,r){if(r===yp&&$i(n))for(var a=Object.keys(n),s=0;s<a.length;s++)t["$feature/"+a[s]]=n[a[s]];else c=r,h=!1,(zu(l=cj)?h:q4&&l.indexOf===q4?l.indexOf(c)!=-1:(_r(l,(function(p){if(h||(h=p===c))return ob})),h))||(t[r]=n);var l,c,h})),t}load(){if(!this.wi){var t=this.Y.W(this.yi);t&&(this.props=fi({},t))}}save(){this.wi||this.Y.G(this.yi,this.props,this.xi,this.Ei,this.Si,this.I.debug)}remove(){this.Y.V(this.yi,!1),this.Y.V(this.yi,!0)}clear(){this.remove(),this.props={}}register_once(t,n,r){if($i(t)){ft(n)&&(n="None"),this.xi=ft(r)?this.$i:r;var a=!1;if(_r(t,((s,l)=>{this.props.hasOwnProperty(l)&&this.props[l]!==n||(this.props[l]=s,a=!0)})),a)return this.save(),!0}return!1}register(t,n){if($i(t)){this.xi=ft(n)?this.$i:n;var r=!1;if(_r(t,((a,s)=>{t.hasOwnProperty(s)&&this.props[s]!==a&&(this.props[s]=a,r=!0)})),r)return this.save(),!0}return!1}unregister(t){t in this.props&&(delete this.props[t],this.save())}update_campaign_params(){if(!this.mi){var t=f6(this.I.custom_campaign_params,this.I.mask_personal_data_properties,this.I.custom_personal_data_properties);mp(SS(t))||this.register(t),this.mi=!0}}update_search_keyword(){var t;this.register((t=vt?.referrer)?p6(t):{})}update_referrer_info(){var t;this.register_once({$referrer:g6(),$referring_domain:vt!=null&&vt.referrer&&((t=mb(vt.referrer))==null?void 0:t.host)||"$direct"},void 0)}set_initial_person_info(){this.props[OS]||this.props[NS]||this.register_once({[db]:v6(this.I.mask_personal_data_properties,this.I.custom_personal_data_properties)},void 0)}get_initial_props(){var t={};_r([NS,OS],(l=>{var c=this.props[l];c&&_r(c,(function(h,p){t["$initial_"+yS(p)]=h}))}));var n,r,a=this.props[db];if(a){var s=(n=y6(a),r={},_r(n,(function(l,c){r["$initial_"+yS(c)]=l})),r);fi(t,s)}return t}safe_merge(t){return _r(this.props,(function(n,r){r in t||(t[r]=n)})),t}update_config(t,n,r){if(this.$i=this.xi=t.cookie_expiration,this.set_disabled(t.disable_persistence||!!r),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),t.persistence!==n.persistence){var a=this.bi(t),s=this.props;this.clear(),this.Y=a,this.props=s,this.save()}}set_disabled(t){this.wi=t,this.wi?this.remove():this.save()}set_cross_subdomain(t){t!==this.Ei&&(this.Ei=t,this.remove(),this.save())}set_secure(t){t!==this.Si&&(this.Si=t,this.remove(),this.save())}set_event_timer(t,n){var r=this.props[v0]||{};r[t]=n,this.props[v0]=r,this.save()}remove_event_timer(t){var n=(this.props[v0]||{})[t];return ft(n)||(delete this.props[v0][t],this.save()),n}get_property(t){return this.props[t]}set_property(t,n){this.props[t]=n,this.save()}}var eo=Ei("[Product Tours]"),sC="ph_product_tours";class wV{constructor(t){this.ki=null,this.Pi=null,this.Ti=void 0,this.Ri=!1,this._instance=t}onRemoteConfig(t){if(this._instance.config.disable_product_tours)eo.info("Product tours disabled via config");else{var n=t.productTours;or(n)?eo.info("Product tours not enabled in remote config"):(this.Ti=n,eo.info("Remote config received, isProductToursEnabled: "+this.Ti),this.loadIfEnabled())}}loadIfEnabled(){var t;if(!this.Pi)if(this.Ri)eo.info("Already initializing product tours, skipping...");else if(this._instance.config.disable_product_tours)eo.info("Product tours disabled via config");else{var n=$t?.__PosthogExtensions__;if(n){var r=(t=this._instance.featureFlags)==null?void 0:t.isFeatureEnabled("product-tours-2025");if(!ft(this.Ti)||r){var a=this.Ti||r;if(a){this.Ri=!0;try{var s=n.generateProductTours;if(s)return void this.Ci(s,a);var l=n.loadExternalDependency;if(!l)return eo.error("PostHog loadExternalDependency extension not found."),void(this.Ri=!1);l(this._instance,"product-tours",(c=>{c||!n.generateProductTours?eo.error("Could not load product tours script",c):this.Ci(n.generateProductTours,a),this.Ri=!1}))}catch(c){eo.error("Error initializing product tours",c),this.Ri=!1}}else eo.info("Product tours not enabled")}else eo.info("Waiting for remote config or feature flag to enable product tours")}else eo.error("PostHog Extensions not found.")}}Ci(t,n){this.Pi=t(this._instance,n)||null,eo.info("Product tours loaded successfully")}getProductTours(t,n){if(n===void 0&&(n=!1),!ar(this.ki)||n){var r=this._instance.persistence;if(r){var a=r.props[sC];if(ar(a)&&!n)return this.ki=a,void t(a,{isLoaded:!0})}this._instance.ci({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",callback:s=>{var l=s.statusCode;if(l!==200||!s.json){var c="Product Tours API could not be loaded, status: "+l;return eo.error(c),void t([],{isLoaded:!1,error:c})}var h=ar(s.json.product_tours)?s.json.product_tours:[];this.ki=h,r&&r.register({[sC]:h}),t(h,{isLoaded:!0})}})}else t(this.ki,{isLoaded:!0})}getActiveProductTours(t){if(or(this.Pi))return eo.warn("Product tours not loaded yet"),void t([],{isLoaded:!1,error:"Product tours not loaded"});this.Pi.getActiveProductTours(t)}showProductTour(t){var n;eo.info("showProductTour("+t+")"),(n=this.Pi)==null||n.showTourById(t)}dismissProductTour(){var t;(t=this.Pi)==null||t.dismissTour("user_clicked_skip")}nextStep(){var t;(t=this.Pi)==null||t.nextStep()}previousStep(){var t;(t=this.Pi)==null||t.previousStep()}clearCache(){this.ki=null;var t=this._instance.persistence;t&&t.unregister(sC)}resetTour(t){var n;(n=this.Pi)==null||n.resetTour(t)}resetAllTours(){var t;(t=this.Pi)==null||t.resetAllTours()}}var B0=(function(e){return e.Activation="events",e.Cancellation="cancelEvents",e})({});(function(e){return e.Button="button",e.Tab="tab",e.Selector="selector",e})({}),(function(e){return e.TopLeft="top_left",e.TopRight="top_right",e.TopCenter="top_center",e.MiddleLeft="middle_left",e.MiddleRight="middle_right",e.MiddleCenter="middle_center",e.Left="left",e.Center="center",e.Right="right",e.NextToTrigger="next_to_trigger",e})({}),(function(e){return e.Top="top",e.Left="left",e.Right="right",e.Bottom="bottom",e})({});var lC=(function(e){return e.Popover="popover",e.API="api",e.Widget="widget",e.ExternalSurvey="external_survey",e})({});(function(e){return e.Open="open",e.MultipleChoice="multiple_choice",e.SingleChoice="single_choice",e.Rating="rating",e.Link="link",e})({}),(function(e){return e.NextQuestion="next_question",e.End="end",e.ResponseBased="response_based",e.SpecificQuestion="specific_question",e})({}),(function(e){return e.Once="once",e.Recurring="recurring",e.Always="always",e})({});var Rb=(function(e){return e.SHOWN="survey shown",e.DISMISSED="survey dismissed",e.SENT="survey sent",e})({}),H6=(function(e){return e.SURVEY_ID="$survey_id",e.SURVEY_NAME="$survey_name",e.SURVEY_RESPONSE="$survey_response",e.SURVEY_ITERATION="$survey_iteration",e.SURVEY_ITERATION_START_DATE="$survey_iteration_start_date",e.SURVEY_PARTIALLY_COMPLETED="$survey_partially_completed",e.SURVEY_SUBMISSION_ID="$survey_submission_id",e.SURVEY_QUESTIONS="$survey_questions",e.SURVEY_COMPLETED="$survey_completed",e})({}),U6=(function(e){return e.Popover="popover",e.Inline="inline",e})({});class uC{constructor(){this.Ii={},this.Ii={}}on(t,n){return this.Ii[t]||(this.Ii[t]=[]),this.Ii[t].push(n),()=>{this.Ii[t]=this.Ii[t].filter((r=>r!==n))}}emit(t,n){for(var r of this.Ii[t]||[])r(n);for(var a of this.Ii["*"]||[])a(t,n)}}function Cp(e,t,n){if(or(e))return!1;switch(n){case"exact":return e===t;case"contains":var r=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(r,"i").test(e);case"regex":try{return new RegExp(t).test(e)}catch{return!1}default:return!1}}class xV{constructor(t){this.Fi=new uC,this.Mi=(n,r)=>this.Oi(n,r)&&this.Ai(n,r)&&this.Di(n,r)&&this.ji(n,r),this.Oi=(n,r)=>r==null||!r.event||n?.event===r?.event,this._instance=t,this.Li=new Set,this.Ni=new Set}init(){var t;if(!ft((t=this._instance)==null?void 0:t.Ui)){var n;(n=this._instance)==null||n.Ui(((r,a)=>{this.on(r,a)}))}}register(t){var n,r;if(!ft((n=this._instance)==null?void 0:n.Ui)&&(t.forEach((l=>{var c,h;(c=this.Ni)==null||c.add(l),(h=l.steps)==null||h.forEach((p=>{var v;(v=this.Li)==null||v.add(p?.event||"")}))})),(r=this._instance)!=null&&r.autocapture)){var a,s=new Set;t.forEach((l=>{var c;(c=l.steps)==null||c.forEach((h=>{h!=null&&h.selector&&s.add(h?.selector)}))})),(a=this._instance)==null||a.autocapture.setElementSelectors(s)}}on(t,n){var r;n!=null&&t.length!=0&&(this.Li.has(t)||this.Li.has(n?.event))&&this.Ni&&((r=this.Ni)==null?void 0:r.size)>0&&this.Ni.forEach((a=>{this.zi(n,a)&&this.Fi.emit("actionCaptured",a.name)}))}Hi(t){this.onAction("actionCaptured",(n=>t(n)))}zi(t,n){if(n?.steps==null)return!1;for(var r of n.steps)if(this.Mi(t,r))return!0;return!1}onAction(t,n){return this.Fi.on(t,n)}Ai(t,n){if(n!=null&&n.url){var r,a=t==null||(r=t.properties)==null?void 0:r.$current_url;if(!a||typeof a!="string"||!Cp(a,n.url,n.url_matching||"contains"))return!1}return!0}Di(t,n){return!!this.Bi(t,n)&&!!this.qi(t,n)&&!!this.Wi(t,n)}Bi(t,n){var r;if(n==null||!n.href)return!0;var a=this.Gi(t);if(a.length>0)return a.some((c=>Cp(c.href,n.href,n.href_matching||"exact")));var s,l=(t==null||(r=t.properties)==null?void 0:r.$elements_chain)||"";return!!l&&Cp((s=l.match(/(?::|")href="(.*?)"/))?s[1]:"",n.href,n.href_matching||"exact")}qi(t,n){var r;if(n==null||!n.text)return!0;var a=this.Gi(t);if(a.length>0)return a.some((p=>Cp(p.text,n.text,n.text_matching||"exact")||Cp(p.$el_text,n.text,n.text_matching||"exact")));var s,l,c,h=(t==null||(r=t.properties)==null?void 0:r.$elements_chain)||"";return!!h&&(s=(function(p){for(var v,y=[],w=/(?::|")text="(.*?)"/g;!or(v=w.exec(p));)y.includes(v[1])||y.push(v[1]);return y})(h),l=n.text,c=n.text_matching||"exact",s.some((p=>Cp(p,l,c))))}Wi(t,n){var r,a;if(n==null||!n.selector)return!0;var s=t==null||(r=t.properties)==null?void 0:r.$element_selectors;if(s!=null&&s.includes(n.selector))return!0;var l=(t==null||(a=t.properties)==null?void 0:a.$elements_chain)||"";if(n.selector_regex&&l)try{return new RegExp(n.selector_regex).test(l)}catch{return!1}return!1}Gi(t){var n;return(t==null||(n=t.properties)==null?void 0:n.$elements)==null?[]:t?.properties.$elements}ji(t,n){return n==null||!n.properties||n.properties.length===0||P6(n.properties.reduce(((r,a)=>{var s=ar(a.value)?a.value.map(String):a.value!=null?[String(a.value)]:[];return r[a.key]={values:s,operator:a.operator||"exact"},r}),{}),t?.properties)}}var hr=Ei("[Surveys]"),cC="seenSurvey_",TV=(e,t)=>{var n="$survey_"+t+"/"+e.id;return e.current_iteration&&e.current_iteration>0&&(n="$survey_"+t+"/"+e.id+"/"+e.current_iteration),n},z6=e=>{var t=""+cC+e.id;return e.current_iteration&&e.current_iteration>0&&(t=""+cC+e.id+"_"+e.current_iteration),t},SV=[lC.Popover,lC.Widget,lC.API],CV={ignoreConditions:!1,ignoreDelay:!1,displayType:U6.Popover};class _V{constructor(t){this._instance=t,this.Vi=new Map,this.Ji=new Map,this.Ki=new Map}Yi(t,n){return!!t&&P6(t.propertyFilters,n?.properties)}Xi(t,n){var r=new Map;return t.forEach((a=>{var s;(s=a.conditions)==null||(s=s[n])==null||(s=s.values)==null||s.forEach((l=>{if(l!=null&&l.name){var c=r.get(l.name)||[];c.push(a.id),r.set(l.name,c)}}))})),r}Qi(t,n,r){var a,s=(r===B0.Activation?this.Vi:this.Ji).get(t),l=[];return(a=this._instance)==null||a.getSurveys((c=>{l=c.filter((h=>s?.includes(h.id)))})),l.filter((c=>{var h,p=(h=c.conditions)==null||(h=h[r])==null||(h=h.values)==null?void 0:h.find((v=>v.name===t));return this.Yi(p,n)}))}register(t){var n;ft((n=this._instance)==null?void 0:n.Ui)||(this.Zi(t),this.te(t))}te(t){var n=t.filter((r=>{var a,s;return((a=r.conditions)==null?void 0:a.actions)&&((s=r.conditions)==null||(s=s.actions)==null||(s=s.values)==null?void 0:s.length)>0}));n.length!==0&&(this.ie==null&&(this.ie=new xV(this._instance),this.ie.init(),this.ie.Hi((r=>{this.onAction(r)}))),n.forEach((r=>{var a,s,l,c,h;r.conditions&&(a=r.conditions)!=null&&a.actions&&(s=r.conditions)!=null&&(s=s.actions)!=null&&s.values&&((l=r.conditions)==null||(l=l.actions)==null||(l=l.values)==null?void 0:l.length)>0&&((c=this.ie)==null||c.register(r.conditions.actions.values),(h=r.conditions)==null||(h=h.actions)==null||(h=h.values)==null||h.forEach((p=>{if(p&&p.name){var v=this.Ki.get(p.name);v&&v.push(r.id),this.Ki.set(p.name,v||[r.id])}})))})))}Zi(t){var n,r=t.filter((s=>{var l,c;return((l=s.conditions)==null?void 0:l.events)&&((c=s.conditions)==null||(c=c.events)==null||(c=c.values)==null?void 0:c.length)>0})),a=t.filter((s=>{var l,c;return((l=s.conditions)==null?void 0:l.cancelEvents)&&((c=s.conditions)==null||(c=c.cancelEvents)==null||(c=c.values)==null?void 0:c.length)>0}));(r.length!==0||a.length!==0)&&((n=this._instance)==null||n.Ui(((s,l)=>{this.onEvent(s,l)})),this.Vi=this.Xi(t,B0.Activation),this.Ji=this.Xi(t,B0.Cancellation))}onEvent(t,n){var r,a=((r=this._instance)==null||(r=r.persistence)==null?void 0:r.props[ub])||[];if(Rb.SHOWN===t&&n&&a.length>0){var s;hr.info("survey event matched, removing survey from activated surveys",{event:t,eventPayload:n,existingActivatedSurveys:a});var l=n==null||(s=n.properties)==null?void 0:s.$survey_id;if(l){var c=a.indexOf(l);c>=0&&(a.splice(c,1),this.ee(a))}}else{if(this.Ji.has(t)){var h=this.Qi(t,n,B0.Cancellation);h.length>0&&(hr.info("cancel event matched, cancelling surveys",{event:t,surveysToCancel:h.map((v=>v.id))}),h.forEach((v=>{var y,w=a.indexOf(v.id);w>=0&&a.splice(w,1),(y=this._instance)==null||y.cancelPendingSurvey(v.id)})),this.ee(a))}if(this.Vi.has(t)){hr.info("survey event name matched",{event:t,eventPayload:n,surveys:this.Vi.get(t)});var p=this.Qi(t,n,B0.Activation);this.ee(a.concat(p.map((v=>v.id))||[]))}}}onAction(t){var n,r=((n=this._instance)==null||(n=n.persistence)==null?void 0:n.props[ub])||[];this.Ki.has(t)&&this.ee(r.concat(this.Ki.get(t)||[]))}ee(t){var n;hr.info("updating activated surveys",{activatedSurveys:t}),(n=this._instance)==null||(n=n.persistence)==null||n.register({[ub]:[...new Set(t)]})}getSurveys(){var t,n=(t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[ub];return n||[]}getEventToSurveys(){return this.Vi}re(){return this.ie}}class AV{constructor(t){this.se=void 0,this._surveyManager=null,this.ne=!1,this.oe=!1,this.ae=[],this._instance=t,this._surveyEventReceiver=null}onRemoteConfig(t){if(!this._instance.config.disable_surveys){var n=t.surveys;if(or(n))return hr.warn("Flags not loaded yet. Not loading surveys.");var r=ar(n);this.se=r?n.length>0:n,hr.info("flags response received, isSurveysEnabled: "+this.se),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var t=[],n=0;n<localStorage.length;n++){var r=localStorage.key(n);(r!=null&&r.startsWith(cC)||r!=null&&r.startsWith("inProgressSurvey_"))&&t.push(r)}t.forEach((a=>localStorage.removeItem(a)))}loadIfEnabled(){if(!this._surveyManager)if(this.oe)hr.info("Already initializing surveys, skipping...");else if(this._instance.config.disable_surveys)hr.info("Disabled. Not loading surveys.");else if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())hr.info("Not loading surveys in cookieless mode without consent.");else{var t=$t?.__PosthogExtensions__;if(t){if(!ft(this.se)||this._instance.config.advanced_enable_surveys){var n=this.se||this._instance.config.advanced_enable_surveys;this.oe=!0;try{var r=t.generateSurveys;if(r)return void this.le(r,n);var a=t.loadExternalDependency;if(!a)return void this.ue("PostHog loadExternalDependency extension not found.");a(this._instance,"surveys",(s=>{s||!t.generateSurveys?this.ue("Could not load surveys script",s):this.le(t.generateSurveys,n)}))}catch(s){throw this.ue("Error initializing surveys",s),s}finally{this.oe=!1}}}else hr.error("PostHog Extensions not found.")}}le(t,n){this._surveyManager=t(this._instance,n),this._surveyEventReceiver=new _V(this._instance),hr.info("Surveys loaded successfully"),this.he({isLoaded:!0})}ue(t,n){hr.error(t,n),this.he({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.ae.push(t),this._surveyManager&&this.he({isLoaded:!0}),()=>{this.ae=this.ae.filter((n=>n!==t))}}getSurveys(t,n){if(n===void 0&&(n=!1),this._instance.config.disable_surveys)return hr.info("Disabled. Not loading surveys."),t([]);var r=this._instance.get_property(RS);if(r&&!n)return t(r,{isLoaded:!0});if(this.ne)return t([],{isLoaded:!1,error:"Surveys are already being loaded"});try{this.ne=!0,this._instance.ci({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this._instance.config.token),method:"GET",timeout:this._instance.config.surveys_request_timeout_ms,callback:a=>{var s;this.ne=!1;var l=a.statusCode;if(l!==200||!a.json){var c="Surveys API could not be loaded, status: "+l;return hr.error(c),t([],{isLoaded:!1,error:c})}var h,p=a.json.surveys||[],v=p.filter((y=>(function(w){return!(!w.start_date||w.end_date)})(y)&&((function(w){var T;return!((T=w.conditions)==null||(T=T.events)==null||(T=T.values)==null||!T.length)})(y)||(function(w){var T;return!((T=w.conditions)==null||(T=T.actions)==null||(T=T.values)==null||!T.length)})(y))));return v.length>0&&((h=this._surveyEventReceiver)==null||h.register(v)),(s=this._instance.persistence)==null||s.register({[RS]:p}),t(p,{isLoaded:!0})}})}catch(a){throw this.ne=!1,a}}he(t){for(var n of this.ae)try{if(!t.isLoaded)return n([],t);this.getSurveys(n)}catch(r){hr.error("Error in survey callback",r)}}getActiveMatchingSurveys(t,n){if(n===void 0&&(n=!1),!or(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,n);hr.warn("init was not called")}de(t){var n=null;return this.getSurveys((r=>{var a;n=(a=r.find((s=>s.id===t)))!==null&&a!==void 0?a:null})),n}ve(t){if(or(this._surveyManager))return{eligible:!1,reason:"SDK is not enabled or survey functionality is not yet loaded"};var n=typeof t=="string"?this.de(t):t;return n?this._surveyManager.checkSurveyEligibility(n):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(or(this._surveyManager))return hr.warn("init was not called"),{visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"};var n=this.ve(t);return{visible:n.eligible,disabledReason:n.reason}}canRenderSurveyAsync(t,n){return or(this._surveyManager)?(hr.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"})):new Promise((r=>{this.getSurveys((a=>{var s,l=(s=a.find((h=>h.id===t)))!==null&&s!==void 0?s:null;if(l){var c=this.ve(l);r({visible:c.eligible,disabledReason:c.reason})}else r({visible:!1,disabledReason:"Survey not found"})}),n)}))}renderSurvey(t,n){var r;if(or(this._surveyManager))hr.warn("init was not called");else{var a=typeof t=="string"?this.de(t):t;if(a!=null&&a.id)if(SV.includes(a.type)){var s=vt?.querySelector(n);if(s)return(r=a.appearance)!=null&&r.surveyPopupDelaySeconds?(hr.info("Rendering survey "+a.id+" with delay of "+a.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var l,c;hr.info("Rendering survey "+a.id+" with delay of "+((l=a.appearance)==null?void 0:l.surveyPopupDelaySeconds)+" seconds"),(c=this._surveyManager)==null||c.renderSurvey(a,s),hr.info("Survey "+a.id+" rendered")}),1e3*a.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(a,s);hr.warn("Survey element not found")}else hr.warn("Surveys of type "+a.type+" cannot be rendered in the app");else hr.warn("Survey not found")}}displaySurvey(t,n){var r;if(or(this._surveyManager))hr.warn("init was not called");else{var a=this.de(t);if(a){var s=a;if((r=a.appearance)!=null&&r.surveyPopupDelaySeconds&&n.ignoreDelay&&(s=Lt({},a,{appearance:Lt({},a.appearance,{surveyPopupDelaySeconds:0})})),n.ignoreConditions===!1){var l=this.canRenderSurvey(a);if(!l.visible)return void hr.warn("Survey is not eligible to be displayed: ",l.disabledReason)}n.displayType!==U6.Inline?this._surveyManager.handlePopoverSurvey(s):this.renderSurvey(s,n.selector)}else hr.warn("Survey not found")}}cancelPendingSurvey(t){or(this._surveyManager)?hr.warn("init was not called"):this._surveyManager.cancelSurvey(t)}}var j6=Ei("[RateLimiter]");class kV{constructor(t){var n,r;this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=a=>{var s=a.text;if(s&&s.length)try{(JSON.parse(s).quota_limited||[]).forEach((l=>{j6.info((l||"events")+" is quota limited."),this.serverLimits[l]=new Date().getTime()+6e4}))}catch(l){return void j6.warn('could not rate limit - continuing. Error: "'+l?.message+'"',{text:s})}},this.instance=t,this.captureEventsPerSecond=((n=t.config.rate_limiting)==null?void 0:n.events_per_second)||10,this.captureEventsBurstLimit=Math.max(((r=t.config.rate_limiting)==null?void 0:r.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond),this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}clientRateLimitContext(t){var n,r,a;t===void 0&&(t=!1);var s=new Date().getTime(),l=(n=(r=this.instance.persistence)==null?void 0:r.get_property(LS))!==null&&n!==void 0?n:{tokens:this.captureEventsBurstLimit,last:s};l.tokens+=(s-l.last)/1e3*this.captureEventsPerSecond,l.last=s,l.tokens>this.captureEventsBurstLimit&&(l.tokens=this.captureEventsBurstLimit);var c=l.tokens<1;return c||t||(l.tokens=Math.max(0,l.tokens-1)),!c||this.lastEventRateLimited||t||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+this.captureEventsPerSecond+" events per second and "+this.captureEventsBurstLimit+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=c,(a=this.instance.persistence)==null||a.set_property(LS,l),{isRateLimited:c,remainingTokens:l.tokens}}isServerRateLimited(t){var n=this.serverLimits[t||"events"]||!1;return n!==!1&&new Date().getTime()<n}}var Lf=Ei("[RemoteConfig]");class RV{constructor(t){this._instance=t}get remoteConfig(){var t;return(t=$t._POSTHOG_REMOTE_CONFIG)==null||(t=t[this._instance.config.token])==null?void 0:t.config}ce(t){var n,r;(n=$t.__PosthogExtensions__)!=null&&n.loadExternalDependency?(r=$t.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,"remote-config",(()=>t(this.remoteConfig))):(Lf.error("PostHog Extensions not found. Cannot load remote config."),t())}fe(t){this._instance.ci({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:n=>{t(n.json)}})}load(){try{if(this.remoteConfig)return Lf.info("Using preloaded remote config",this.remoteConfig),void this.fi(this.remoteConfig);if(this._instance.O())return void Lf.warn("Remote config is disabled. Falling back to local config.");this.ce((t=>{if(!t)return Lf.info("No config found after loading remote JS config. Falling back to JSON."),void this.fe((n=>{this.fi(n)}));this.fi(t)}))}catch(t){Lf.error("Error loading remote config",t)}}fi(t){t?this._instance.config.__preview_remote_config?(this._instance.fi(t),t.hasFeatureFlags!==!1&&this._instance.featureFlags.ensureFlagsLoaded()):Lf.info("__preview_remote_config is disabled. Logging config instead",t):Lf.error("Failed to fetch remote config from PostHog.")}}var dC=3e3;class DV{constructor(t,n){this.pe=!0,this.ge=[],this._e=Ol(n?.flush_interval_ms||dC,250,5e3,yt.createLogger("flush interval"),dC),this.me=t}enqueue(t){this.ge.push(t),this.ye||this.be()}unload(){this.we();var t=this.ge.length>0?this.xe():{},n=Object.values(t);[...n.filter((r=>r.url.indexOf("/e")===0)),...n.filter((r=>r.url.indexOf("/e")!==0))].map((r=>{this.me(Lt({},r,{transport:"sendBeacon"}))}))}enable(){this.pe=!1,this.be()}be(){var t=this;this.pe||(this.ye=setTimeout((()=>{if(this.we(),this.ge.length>0){var n=this.xe(),r=function(){var s=n[a],l=new Date().getTime();s.data&&ar(s.data)&&_r(s.data,(c=>{c.offset=Math.abs(c.timestamp-l),delete c.timestamp})),t.me(s)};for(var a in n)r()}}),this._e))}we(){clearTimeout(this.ye),this.ye=void 0}xe(){var t={};return _r(this.ge,(n=>{var r,a=n,s=(a?a.batchKey:null)||a.url;ft(t[s])&&(t[s]=Lt({},a,{data:[]})),(r=t[s].data)==null||r.push(a.data)})),this.ge=[],t}}var LV=["retriesPerformedSoFar"];class OV{constructor(t){this.Ee=!1,this.Se=3e3,this.ge=[],this._instance=t,this.ge=[],this.$e=!0,!ft(Ne)&&"onLine"in Ne.navigator&&(this.$e=Ne.navigator.onLine,this.ke=()=>{this.$e=!0,this.Dt()},this.Pe=()=>{this.$e=!1},wi(Ne,"online",this.ke),wi(Ne,"offline",this.Pe))}get length(){return this.ge.length}retriableRequest(t){var{retriesPerformedSoFar:n}=t,r=X4(t,LV);Ll(n)&&n>0&&(r.url=Cb(r.url,{retry_count:n})),this._instance.ci(Lt({},r,{callback:a=>{a.statusCode!==200&&(a.statusCode<400||a.statusCode>=500)&&(n??0)<10?this.Te(Lt({retriesPerformedSoFar:n},r)):r.callback==null||r.callback(a)}}))}Te(t){var n=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=n+1;var r=(function(l){var c=3e3*Math.pow(2,l),h=c/2,p=Math.min(18e5,c),v=(Math.random()-.5)*(p-h);return Math.ceil(p+v)})(n),a=Date.now()+r;this.ge.push({retryAt:a,requestOptions:t});var s="Enqueued failed request for retry in "+r;navigator.onLine||(s+=" (Browser is offline)"),yt.warn(s),this.Ee||(this.Ee=!0,this.Re())}Re(){if(this.Ce&&clearTimeout(this.Ce),this.ge.length===0)return this.Ee=!1,void(this.Ce=void 0);this.Ce=setTimeout((()=>{this.$e&&this.ge.length>0&&this.Dt(),this.Re()}),this.Se)}Dt(){var t=Date.now(),n=[],r=this.ge.filter((s=>s.retryAt<t||(n.push(s),!1)));if(this.ge=n,r.length>0)for(var{requestOptions:a}of r)this.retriableRequest(a)}unload(){for(var{requestOptions:t}of(this.Ce&&(clearTimeout(this.Ce),this.Ce=void 0),this.Ee=!1,ft(Ne)||(this.ke&&(Ne.removeEventListener("online",this.ke),this.ke=void 0),this.Pe&&(Ne.removeEventListener("offline",this.Pe),this.Pe=void 0)),this.ge))try{this._instance.ci(Lt({},t,{transport:"sendBeacon"}))}catch(n){yt.error(n)}this.ge=[]}}class NV{constructor(t){this.Ie=()=>{var n,r,a,s;this.Fe||(this.Fe={});var l=this.scrollElement(),c=this.scrollY(),h=l?Math.max(0,l.scrollHeight-l.clientHeight):0,p=c+(l?.clientHeight||0),v=l?.scrollHeight||0;this.Fe.lastScrollY=Math.ceil(c),this.Fe.maxScrollY=Math.max(c,(n=this.Fe.maxScrollY)!==null&&n!==void 0?n:0),this.Fe.maxScrollHeight=Math.max(h,(r=this.Fe.maxScrollHeight)!==null&&r!==void 0?r:0),this.Fe.lastContentY=p,this.Fe.maxContentY=Math.max(p,(a=this.Fe.maxContentY)!==null&&a!==void 0?a:0),this.Fe.maxContentHeight=Math.max(v,(s=this.Fe.maxContentHeight)!==null&&s!==void 0?s:0)},this._instance=t}getContext(){return this.Fe}resetContext(){var t=this.Fe;return setTimeout(this.Ie,0),t}startMeasuringScrollPosition(){wi(Ne,"scroll",this.Ie,{capture:!0}),wi(Ne,"scrollend",this.Ie,{capture:!0}),wi(Ne,"resize",this.Ie)}scrollElement(){if(!this._instance.config.scroll_root_selector)return Ne?.document.documentElement;var t=ar(this._instance.config.scroll_root_selector)?this._instance.config.scroll_root_selector:[this._instance.config.scroll_root_selector];for(var n of t){var r=Ne?.document.querySelector(n);if(r)return r}}scrollY(){if(this._instance.config.scroll_root_selector){var t=this.scrollElement();return t&&t.scrollTop||0}return Ne&&(Ne.scrollY||Ne.pageYOffset||Ne.document.documentElement.scrollTop)||0}scrollX(){if(this._instance.config.scroll_root_selector){var t=this.scrollElement();return t&&t.scrollLeft||0}return Ne&&(Ne.scrollX||Ne.pageXOffset||Ne.document.documentElement.scrollLeft)||0}}var PV=e=>v6(e?.config.mask_personal_data_properties,e?.config.custom_personal_data_properties);class V6{constructor(t,n,r,a){this.Me=s=>{var l=this.Oe();if(!l||l.sessionId!==s){var c={sessionId:s,props:this.Ae(this._instance)};this.De.register({[DS]:c})}},this._instance=t,this.je=n,this.De=r,this.Ae=a||PV,this.je.onSessionId(this.Me)}Oe(){return this.De.props[DS]}getSetOnceProps(){var t,n=(t=this.Oe())==null?void 0:t.props;return n?"r"in n?y6(n):{$referring_domain:n.referringDomain,$pathname:n.initialPathName,utm_source:n.utm_source,utm_campaign:n.utm_campaign,utm_medium:n.utm_medium,utm_content:n.utm_content,utm_term:n.utm_term}:{}}getSessionProps(){var t={};return _r(SS(this.getSetOnceProps()),((n,r)=>{r==="$current_url"&&(r="url"),t["$session_entry_"+yS(r)]=n})),t}}var fC=Ei("[SessionId]");class W6{on(t,n){return this.Le.on(t,n)}constructor(t,n,r){var a;if(this.Ne=[],this.Ue=void 0,this.Le=new uC,this.ze=(v,y)=>Math.abs(v-y)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode==="always")throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.I=t.config,this.De=t.persistence,this.He=void 0,this.Be=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.qe=n||Zc,this.We=r||Zc;var s=this.I.persistence_name||this.I.token,l=this.I.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*Ol(l,60,36e3,fC.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Ge(),this.Ve="ph_"+s+"_window_id",this.Je="ph_"+s+"_primary_window_exists",this.Ke()){var c=ca.W(this.Ve),h=ca.W(this.Je);c&&!h?this.He=c:ca.V(this.Ve),ca.G(this.Je,!0)}if((a=this.I.bootstrap)!=null&&a.sessionID)try{var p=(v=>{var y=v.replace(/-/g,"");if(y.length!==32)throw new Error("Not a valid UUID");if(y[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(y.substring(0,12),16)})(this.I.bootstrap.sessionID);this.Ye(this.I.bootstrap.sessionID,new Date().getTime(),p)}catch(v){fC.error("Invalid sessionID in bootstrap",v)}this.Xe()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return ft(this.Ne)&&(this.Ne=[]),this.Ne.push(t),this.Be&&t(this.Be,this.He),()=>{this.Ne=this.Ne.filter((n=>n!==t))}}Ke(){return this.I.persistence!=="memory"&&!this.De.wi&&ca.H()}Qe(t){t!==this.He&&(this.He=t,this.Ke()&&ca.G(this.Ve,t))}Ze(){return this.He?this.He:this.Ke()?ca.W(this.Ve):null}Ye(t,n,r){t===this.Be&&n===this._sessionActivityTimestamp&&r===this._sessionStartTimestamp||(this._sessionStartTimestamp=r,this._sessionActivityTimestamp=n,this.Be=t,this.De.register({[lb]:[n,t,r]}))}tr(){var t=this.De.props[lb];return ar(t)&&t.length===2&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.Ye(null,null,null)}destroy(){clearTimeout(this.ir),this.ir=void 0,this.Ue&&Ne&&(Ne.removeEventListener("beforeunload",this.Ue,{capture:!1}),this.Ue=void 0),this.Ne=[]}Xe(){this.Ue=()=>{this.Ke()&&ca.V(this.Je)},wi(Ne,"beforeunload",this.Ue,{capture:!1})}checkAndGetSessionAndWindowId(t,n){if(t===void 0&&(t=!1),n===void 0&&(n=null),this.I.cookieless_mode==="always")throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var r=n||new Date().getTime(),[a,s,l]=this.tr(),c=this.Ze(),h=Ll(l)&&l>0&&Math.abs(r-l)>864e5,p=!1,v=!s,y=!v&&!t&&this.ze(r,a);v||y||h?(s=this.qe(),c=this.We(),fC.info("new session ID generated",{sessionId:s,windowId:c,changeReason:{noSessionId:v,activityTimeout:y,sessionPastMaximumLength:h}}),l=r,p=!0):c||(c=this.We(),p=!0);var w=a===0||!t||h?r:a,T=l===0?new Date().getTime():l;return this.Qe(c),this.Ye(s,w,T),t||this.Ge(),p&&this.Ne.forEach((A=>A(s,c,p?{noSessionId:v,activityTimeout:y,sessionPastMaximumLength:h}:void 0))),{sessionId:s,windowId:c,sessionStartTimestamp:T,changeReason:p?{noSessionId:v,activityTimeout:y,sessionPastMaximumLength:h}:void 0,lastActivityTimestamp:a}}Ge(){clearTimeout(this.ir),this.ir=setTimeout((()=>{var[t]=this.tr();if(this.ze(new Date().getTime(),t)){var n=this.Be;this.resetSessionId(),this.Le.emit("forcedIdleReset",{idleSessionId:n})}}),1.1*this.sessionTimeoutMs)}}var IV=["$set_once","$set"],ed=Ei("[SiteApps]");class MV{constructor(t){this._instance=t,this.er=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}rr(t,n){if(n){var r=this.globalsForEvent(n);this.er.push(r),this.er.length>1e3&&(this.er=this.er.slice(10))}}get siteAppLoaders(){var t;return(t=$t._POSTHOG_REMOTE_CONFIG)==null||(t=t[this._instance.config.token])==null?void 0:t.siteApps}init(){if(this.isEnabled){var t=this._instance.Ui(this.rr.bind(this));this.sr=()=>{t(),this.er=[],this.sr=void 0}}}globalsForEvent(t){var n,r,a,s,l,c,h;if(!t)throw new Error("Event payload is required");var p={},v=this._instance.get_property("$groups")||[],y=this._instance.get_property("$stored_group_properties")||{};for(var[w,T]of Object.entries(y))p[w]={id:v[w],type:w,properties:T};var{$set_once:A,$set:R}=t;return{event:Lt({},X4(t,IV),{properties:Lt({},t.properties,R?{$set:Lt({},(n=(r=t.properties)==null?void 0:r.$set)!==null&&n!==void 0?n:{},R)}:{},A?{$set_once:Lt({},(a=(s=t.properties)==null?void 0:s.$set_once)!==null&&a!==void 0?a:{},A)}:{}),elements_chain:(l=(c=t.properties)==null?void 0:c.$elements_chain)!==null&&l!==void 0?l:"",distinct_id:(h=t.properties)==null?void 0:h.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:p}}setupSiteApp(t){var n=this.apps[t.id],r=()=>{var c;!n.errored&&this.er.length&&(ed.info("Processing "+this.er.length+" events for site app with id "+t.id),this.er.forEach((h=>n.processEvent==null?void 0:n.processEvent(h))),n.processedBuffer=!0),Object.values(this.apps).every((h=>h.processedBuffer||h.errored))&&((c=this.sr)==null||c.call(this))},a=!1,s=c=>{n.errored=!c,n.loaded=!0,ed.info("Site app with id "+t.id+" "+(c?"loaded":"errored")),a&&r()};try{var{processEvent:l}=t.init({posthog:this._instance,callback:c=>{s(c)}});l&&(n.processEvent=l),a=!0}catch(c){ed.error("Error while initializing PostHog app with config id "+t.id,c),s(!1)}if(a&&n.loaded)try{r()}catch(c){ed.error("Error while processing buffered events PostHog app with config id "+t.id,c),n.errored=!0}}nr(){var t=this.siteAppLoaders||[];for(var n of t)this.apps[n.id]={id:n.id,loaded:!1,errored:!1,processedBuffer:!1};for(var r of t)this.setupSiteApp(r)}ar(t){if(Object.keys(this.apps).length!==0){var n=this.globalsForEvent(t);for(var r of Object.values(this.apps))try{r.processEvent==null||r.processEvent(n)}catch(a){ed.error("Error while processing event "+t.event+" for site app "+r.id,a)}}}onRemoteConfig(t){var n,r,a,s=this;if((n=this.siteAppLoaders)!=null&&n.length)return this.isEnabled?(this.nr(),void this._instance.on("eventCaptured",(p=>this.ar(p)))):void ed.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((r=this.sr)==null||r.call(this),(a=t.siteApps)!=null&&a.length)if(this.isEnabled){var l=function(p){var v;$t["__$$ph_site_app_"+p]=s._instance,(v=$t.__PosthogExtensions__)==null||v.loadSiteApp==null||v.loadSiteApp(s._instance,h,(y=>{if(y)return ed.error("Error while initializing PostHog app with config id "+p,y)}))};for(var{id:c,url:h}of t.siteApps)l(c)}else ed.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}var Y6=function(e,t){if(!e)return!1;var n=e.userAgent;if(n&&Z4(n,t))return!0;try{var r=e?.userAgentData;if(r!=null&&r.brands&&r.brands.some((a=>Z4(a?.brand,t))))return!0}catch{}return!!e.webdriver},H0=(function(e){return e.US="us",e.EU="eu",e.CUSTOM="custom",e})({}),q6="i.posthog.com";class FV{constructor(t){this.lr={},this.instance=t}get apiHost(){var t=this.instance.config.api_host.trim().replace(/\/$/,"");return t==="https://app.posthog.com"?"https://us.i.posthog.com":t}get flagsApiHost(){var t=this.instance.config.flags_api_host;return t?t.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var t,n=(t=this.instance.config.ui_host)==null?void 0:t.replace(/\/$/,"");return n||(n=this.apiHost.replace("."+q6,".posthog.com")),n==="https://app.posthog.com"?"https://us.posthog.com":n}get region(){return this.lr[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.lr[this.apiHost]=H0.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.lr[this.apiHost]=H0.EU:this.lr[this.apiHost]=H0.CUSTOM),this.lr[this.apiHost]}endpointFor(t,n){if(n===void 0&&(n=""),n&&(n=n[0]==="/"?n:"/"+n),t==="ui")return this.uiHost+n;if(t==="flags")return this.flagsApiHost+n;if(this.region===H0.CUSTOM)return this.apiHost+n;var r=q6+n;switch(t){case"assets":return"https://"+this.region+"-assets."+r;case"api":return"https://"+this.region+"."+r}}}var BV={icontains:(e,t)=>!!Ne&&t.href.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>!!Ne&&t.href.toLowerCase().indexOf(e.toLowerCase())===-1,regex:(e,t)=>!!Ne&&Ab(t.href,e),not_regex:(e,t)=>!!Ne&&!Ab(t.href,e),exact:(e,t)=>t.href===e,is_not:(e,t)=>t.href!==e};class Aa{constructor(t){var n=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(r){r===void 0&&(r=!1),n.getWebExperiments((a=>{Aa.ur("retrieved web experiments from the server"),n.hr=new Map,a.forEach((s=>{if(s.feature_flag_key){var l;n.hr&&(Aa.ur("setting flag key ",s.feature_flag_key," to web experiment ",s),(l=n.hr)==null||l.set(s.feature_flag_key,s));var c=n._instance.getFeatureFlag(s.feature_flag_key);Ii(c)&&s.variants[c]&&n.dr(s.name,c,s.variants[c].transforms)}else if(s.variants)for(var h in s.variants){var p=s.variants[h];Aa.vr(p)&&n.dr(s.name,h,p.transforms)}}))}),r)},this._instance=t,this._instance.onFeatureFlags((r=>{this.onFeatureFlags(r)}))}onFeatureFlags(t){if(this._is_bot())Aa.ur("Refusing to render web experiment since the viewer is a likely bot");else if(!this._instance.config.disable_web_experiments){if(or(this.hr))return this.hr=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Aa.ur("applying feature flags",t),t.forEach((n=>{var r;if(this.hr&&(r=this.hr)!=null&&r.has(n)){var a,s=this._instance.getFeatureFlag(n),l=(a=this.hr)==null?void 0:a.get(n);s&&l!=null&&l.variants[s]&&this.dr(l.name,s,l.variants[s].transforms)}}))}}previewWebExperiment(){var t=Aa.getWindowLocation();if(t!=null&&t.search){var n=gb(t?.search,"__experiment_id"),r=gb(t?.search,"__experiment_variant");n&&r&&(Aa.ur("previewing web experiments "+n+" && "+r),this.getWebExperiments((a=>{this.cr(parseInt(n),r,a)}),!1,!0))}}loadIfEnabled(){this._instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,n,r){if(this._instance.config.disable_web_experiments&&!r)return t([]);var a=this._instance.get_property("$web_experiments");if(a&&!n)return t(a);this._instance.ci({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this._instance.config.token),method:"GET",callback:s=>{if(s.statusCode!==200||!s.json)return t([]);var l=s.json.experiments||[];return t(l)}})}cr(t,n,r){var a=r.filter((s=>s.id===t));a&&a.length>0&&(Aa.ur("Previewing web experiment ["+a[0].name+"] with variant ["+n+"]"),this.dr(a[0].name,n,a[0].variants[n].transforms))}static vr(t){return!or(t.conditions)&&Aa.pr(t)&&Aa.gr(t)}static pr(t){var n;if(or(t.conditions)||or((n=t.conditions)==null?void 0:n.url))return!0;var r,a,s,l=Aa.getWindowLocation();return!!l&&((r=t.conditions)==null||!r.url||BV[(a=(s=t.conditions)==null?void 0:s.urlMatchType)!==null&&a!==void 0?a:"icontains"](t.conditions.url,l))}static getWindowLocation(){return Ne?.location}static gr(t){var n;if(or(t.conditions)||or((n=t.conditions)==null?void 0:n.utm))return!0;var r=f6();if(r.utm_source){var a,s,l,c,h,p,v,y,w=(a=t.conditions)==null||(a=a.utm)==null||!a.utm_campaign||((s=t.conditions)==null||(s=s.utm)==null?void 0:s.utm_campaign)==r.utm_campaign,T=(l=t.conditions)==null||(l=l.utm)==null||!l.utm_source||((c=t.conditions)==null||(c=c.utm)==null?void 0:c.utm_source)==r.utm_source,A=(h=t.conditions)==null||(h=h.utm)==null||!h.utm_medium||((p=t.conditions)==null||(p=p.utm)==null?void 0:p.utm_medium)==r.utm_medium,R=(v=t.conditions)==null||(v=v.utm)==null||!v.utm_term||((y=t.conditions)==null||(y=y.utm)==null?void 0:y.utm_term)==r.utm_term;return w&&A&&R&&T}return!1}static ur(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];yt.info("[WebExperiments] "+t,r)}dr(t,n,r){this._is_bot()?Aa.ur("Refusing to render web experiment since the viewer is a likely bot"):n!=="control"?r.forEach((a=>{if(a.selector){var s;Aa.ur("applying transform of variant "+n+" for experiment "+t+" ",a);var l=(s=document)==null?void 0:s.querySelectorAll(a.selector);l?.forEach((c=>{var h=c;a.html&&(h.innerHTML=a.html),a.css&&h.setAttribute("style",a.css)}))}})):Aa.ur("Control variants leave the page unmodified.")}_is_bot(){return Go&&this._instance?Y6(Go,this._instance.config.custom_blocked_useragents):void 0}}var HV=Ei("[PostHog ExternalIntegrations]"),UV={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class zV{constructor(t){this._instance=t}it(t,n){var r;(r=$t.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,t,(a=>{if(a)return HV.error("failed to load script",a);n()}))}startIfEnabledOrStop(){var t=this,n=function(l){var c,h,p;!a||(c=$t.__PosthogExtensions__)!=null&&(c=c.integrations)!=null&&c[l]||t.it(UV[l],(()=>{var v;(v=$t.__PosthogExtensions__)==null||(v=v.integrations)==null||(v=v[l])==null||v.start(t._instance)})),!a&&(h=$t.__PosthogExtensions__)!=null&&(h=h.integrations)!=null&&h[l]&&((p=$t.__PosthogExtensions__)==null||(p=p.integrations)==null||(p=p[l])==null||p.stop())};for(var[r,a]of Object.entries((s=this._instance.config.integrations)!==null&&s!==void 0?s:{})){var s;n(r)}}}var hC="[SessionRecording]",U0=Ei(hC);class G6{get started(){var t;return!((t=this._r)==null||!t.isStarted)}get status(){return this._r?this._r.status:this.mr&&!this.yr?"disabled":"lazy_loading"}constructor(t){if(this._forceAllowLocalhostNetworkCapture=!1,this.mr=!1,this.br=void 0,this._instance=t,!this._instance.sessionManager)throw U0.error("started without valid sessionManager"),new Error(hC+" started without valid sessionManager. This is a bug.");if(this._instance.config.cookieless_mode==="always")throw new Error(hC+' cannot be used with cookieless_mode="always"')}get yr(){var t,n=!((t=this._instance.get_property(AS))==null||!t.enabled),r=!this._instance.config.disable_session_recording,a=this._instance.config.disable_session_recording||this._instance.consent.isOptedOut();return Ne&&n&&r&&!a}startIfEnabledOrStop(t){var n;if(!this.yr||(n=this._r)==null||!n.isStarted){var r=!ft(Object.assign)&&!ft(Array.from);this.yr&&r?(this.wr(t),U0.info("starting")):this.stopRecording()}}wr(t){var n,r,a;this.yr&&($t!=null&&(n=$t.__PosthogExtensions__)!=null&&(n=n.rrweb)!=null&&n.record&&(r=$t.__PosthogExtensions__)!=null&&r.initSessionRecording?this.Er(t):(a=$t.__PosthogExtensions__)==null||a.loadExternalDependency==null||a.loadExternalDependency(this._instance,this.Sr,(s=>{if(s)return U0.error("could not load recorder",s);this.Er(t)})))}stopRecording(){var t,n;(t=this.br)==null||t.call(this),this.br=void 0,(n=this._r)==null||n.stop()}$r(){var t;(t=this._instance.persistence)==null||t.unregister(vD)}kr(t){if(this._instance.persistence){var n,r,a=this._instance.persistence,s=()=>{var l=t.sessionRecording===!1?void 0:t.sessionRecording,c=l?.sampleRate,h=or(c)?null:parseFloat(c);or(h)&&this.$r();var p=l?.minimumDurationMilliseconds;a.register({[AS]:Lt({enabled:!!l},l,{networkPayloadCapture:Lt({capturePerformance:t.capturePerformance},l?.networkPayloadCapture),canvasRecording:{enabled:l?.recordCanvas,fps:l?.canvasFps,quality:l?.canvasQuality},sampleRate:h,minimumDurationMilliseconds:ft(p)?null:p,endpoint:l?.endpoint,triggerMatchType:l?.triggerMatchType,masking:l?.masking,urlTriggers:l?.urlTriggers})})};s(),(n=this.br)==null||n.call(this),this.br=(r=this._instance.sessionManager)==null?void 0:r.onSessionId(s)}}onRemoteConfig(t){"sessionRecording"in t?t.sessionRecording!==!1?(this.kr(t),this.mr=!0,this.startIfEnabledOrStop()):this.mr=!0:U0.info("skipping remote config with no sessionRecording",t)}log(t,n){var r;n===void 0&&(n="log"),(r=this._r)!=null&&r.log?this._r.log(t,n):U0.warn("log called before recorder was ready")}get Sr(){var t,n,r=(t=this._instance)==null||(t=t.persistence)==null?void 0:t.get_property(AS);return(r==null||(n=r.scriptConfig)==null?void 0:n.script)||"lazy-recorder"}Er(t){var n,r;if((n=$t.__PosthogExtensions__)==null||!n.initSessionRecording)throw Error("Called on script loaded before session recording is available");this._r||(this._r=(r=$t.__PosthogExtensions__)==null?void 0:r.initSessionRecording(this._instance),this._r._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),this._r.start(t)}onRRwebEmit(t){var n;(n=this._r)==null||n.onRRwebEmit==null||n.onRRwebEmit(t)}overrideLinkedFlag(){var t,n;this._r||(n=this._instance.persistence)==null||n.register({$replay_override_linked_flag:!0}),(t=this._r)==null||t.overrideLinkedFlag()}overrideSampling(){var t,n;this._r||(n=this._instance.persistence)==null||n.register({$replay_override_sampling:!0}),(t=this._r)==null||t.overrideSampling()}overrideTrigger(t){var n,r;this._r||(r=this._instance.persistence)==null||r.register({[t==="url"?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),(n=this._r)==null||n.overrideTrigger(t)}get sdkDebugProperties(){var t;return((t=this._r)==null?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,n){var r;return!((r=this._r)==null||!r.tryAddCustomEvent(t,n))}}var z0={},pC=()=>{},_p="posthog",K6=!mV&&xo?.indexOf("MSIE")===-1&&xo?.indexOf("Mozilla")===-1,Q6=e=>{var t;return Lt({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:uj(vt?.location),persistence:"localStorage+cookie",persistence_name:"",loaded:pC,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:e??"unset",__preview_deferred_init_extensions:!1,debug:wo&&Ii(wo?.search)&&wo.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_product_tours:!0,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:(Ne==null||(t=Ne.location)==null?void 0:t.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error:n=>{var r="Bad HTTP status: "+n.statusCode+" "+n.text;yt.error(r)},get_device_id:n=>n,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:"identified_only",before_send:void 0,request_queue_config:{flush_interval_ms:dC},error_tracking:{},_onCapture:pC,__preview_eager_load_replay:!1},(n=>({rageclick:!(n&&n>="2025-11-30")||{content_ignorelist:!0},capture_pageview:!(n&&n>="2025-05-24")||"history_change",session_recording:n&&n>="2025-11-30"?{strictMinimumDuration:!0}:{}}))(e))},X6=e=>{var t={};ft(e.process_person)||(t.person_profiles=e.process_person),ft(e.xhr_headers)||(t.request_headers=e.xhr_headers),ft(e.cookie_name)||(t.persistence_name=e.cookie_name),ft(e.disable_cookie)||(t.disable_persistence=e.disable_cookie),ft(e.store_google)||(t.save_campaign_params=e.store_google),ft(e.verbose)||(t.debug=e.verbose);var n=fi({},t,e);return ar(e.property_blacklist)&&(ft(e.property_denylist)?n.property_denylist=e.property_blacklist:ar(e.property_denylist)?n.property_denylist=[...e.property_blacklist,...e.property_denylist]:yt.error("Invalid value for property_denylist config: "+e.property_denylist)),n};class jV{constructor(){this.__forceAllowLocalhost=!1}get Pr(){return this.__forceAllowLocalhost}set Pr(t){yt.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class Db{get decideEndpointWasHit(){var t,n;return(t=(n=this.featureFlags)==null?void 0:n.hasLoadedFlags)!==null&&t!==void 0&&t}get flagsEndpointWasHit(){var t,n;return(t=(n=this.featureFlags)==null?void 0:n.hasLoadedFlags)!==null&&t!==void 0&&t}constructor(){this.webPerformance=new jV,this.Tr=!1,this.version=Uu.LIB_VERSION,this.Rr=new uC,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Q6(),this.SentryIntegration=Bj,this.sentryIntegration=t=>(function(n,r){var a=WD(n,r);return{name:VD,processEvent:s=>a(s)}})(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Cr=!1,this.Ir=null,this.Fr=null,this.Mr=null,this.featureFlags=new bV(this),this.toolbar=new Uj(this),this.scrollManager=new NV(this),this.pageViewManager=new oV(this),this.surveys=new AV(this),this.productTours=new wV(this),this.experiments=new Aa(this),this.exceptions=new gV(this),this.rateLimiter=new kV(this),this.requestRouter=new FV(this),this.consent=new Oj(this),this.externalIntegrations=new zV(this),this.people={set:(t,n,r)=>{var a=Ii(t)?{[t]:n}:t;this.setPersonProperties(a),r?.({})},set_once:(t,n,r)=>{var a=Ii(t)?{[t]:n}:t;this.setPersonProperties(void 0,a),r?.({})}},this.on("eventCaptured",(t=>yt.info('send "'+t?.event+'"',t)))}init(t,n,r){if(r&&r!==_p){var a,s=(a=z0[r])!==null&&a!==void 0?a:new Db;return s._init(t,n,r),z0[r]=s,z0[_p][r]=s,s}return this._init(t,n,r)}_init(t,n,r){var a;if(n===void 0&&(n={}),ft(t)||bS(t))return yt.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},n.debug=this.Or(n.debug),this.Ar=n,this.Dr=[],n.person_profiles&&(this.Fr=n.person_profiles),this.set_config(fi({},Q6(n.defaults),X6(n),{name:r,token:t})),this.config.on_xhr_error&&yt.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=n.disable_compression?void 0:Vu.GZipJS;var s=this.jr();this.persistence=new oC(this.config,s),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new oC(Lt({},this.config,{persistence:"sessionStorage"}),s);var l=Lt({},this.persistence.props),c=Lt({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Lr=new DV((M=>this.Nr(M)),this.config.request_queue_config),this.Ur=new OV(this),this.__request_queue=[];var h=this.config.cookieless_mode==="always"||this.config.cookieless_mode==="on_reject"&&this.consent.isExplicitlyOptedOut();if(h||(this.sessionManager=new W6(this),this.sessionPropsManager=new V6(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(yt.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.zr(h)}),0)):(yt.info("Initializing extensions synchronously"),this.zr(h)),Uu.DEBUG=Uu.DEBUG||this.config.debug,Uu.DEBUG&&yt.info("Starting in debug mode",{this:this,config:n,thisC:Lt({},this.config),p:l,s:c}),((a=n.bootstrap)==null?void 0:a.distinctID)!==void 0){var p,v,y=this.config.get_device_id(Zc()),w=(p=n.bootstrap)!=null&&p.isIdentifiedID?y:n.bootstrap.distinctID;this.persistence.set_property(ju,(v=n.bootstrap)!=null&&v.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:n.bootstrap.distinctID,$device_id:w})}if(this.Hr()){var T,A,R=Object.keys(((T=n.bootstrap)==null?void 0:T.featureFlags)||{}).filter((M=>{var H;return!((H=n.bootstrap)==null||(H=H.featureFlags)==null||!H[M])})).reduce(((M,H)=>{var V;return M[H]=((V=n.bootstrap)==null||(V=V.featureFlags)==null?void 0:V[H])||!1,M}),{}),N=Object.keys(((A=n.bootstrap)==null?void 0:A.featureFlagPayloads)||{}).filter((M=>R[M])).reduce(((M,H)=>{var V,K;return(V=n.bootstrap)!=null&&(V=V.featureFlagPayloads)!=null&&V[H]&&(M[H]=(K=n.bootstrap)==null||(K=K.featureFlagPayloads)==null?void 0:K[H]),M}),{});this.featureFlags.receivedFeatureFlags({featureFlags:R,featureFlagPayloads:N})}if(h)this.register_once({distinct_id:E0,$device_id:null},"");else if(!this.get_distinct_id()){var O=this.config.get_device_id(Zc());this.register_once({distinct_id:O,$device_id:O},""),this.persistence.set_property(ju,"anonymous")}return wi(Ne,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),n.segment?Fj(this,(()=>this.Br())):this.Br(),Gc(this.config._onCapture)&&this.config._onCapture!==pC&&(yt.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(M=>this.config._onCapture(M.event,M)))),this.config.ip&&yt.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this}zr(t){var n=performance.now();this.historyAutocapture=new Mj(this),this.historyAutocapture.startIfEnabled();var r=[];r.push((()=>{new jj(this).startIfEnabledOrStop()})),r.push((()=>{var a;this.siteApps=new MV(this),(a=this.siteApps)==null||a.init()})),t||r.push((()=>{this.sessionRecording=new G6(this),this.sessionRecording.startIfEnabledOrStop()})),this.config.disable_scroll_properties||r.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),r.push((()=>{this.autocapture=new Sj(this),this.autocapture.startIfEnabled()})),r.push((()=>{this.surveys.loadIfEnabled()})),r.push((()=>{this.productTours.loadIfEnabled()})),r.push((()=>{this.heatmaps=new aV(this),this.heatmaps.startIfEnabled()})),r.push((()=>{this.webVitalsAutocapture=new rV(this)})),r.push((()=>{this.exceptionObserver=new Ij(this),this.exceptionObserver.startIfEnabled()})),r.push((()=>{this.deadClicksAutocapture=new zD(this,Pj),this.deadClicksAutocapture.startIfEnabled()})),r.push((()=>{if(this.qr){var a=this.qr;this.qr=void 0,this.fi(a)}})),this.Wr(r,n)}Wr(t,n){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-n>=30&&t.length>0)return void setTimeout((()=>{this.Wr(t,n)}),0);var r=t.shift();if(r)try{r()}catch(s){yt.error("Error initializing extension:",s)}}var a=Math.round(performance.now()-n);this.register_for_session({$sdk_debug_extensions_init_method:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",$sdk_debug_extensions_init_time_ms:a}),this.config.__preview_deferred_init_extensions&&yt.info("PostHog extensions initialized ("+a+"ms)")}fi(t){var n,r,a,s,l,c,h,p;if(!vt||!vt.body)return yt.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.fi(t)}),500);this.config.__preview_deferred_init_extensions&&(this.qr=t),this.compression=void 0,t.supportedCompression&&!this.config.disable_compression&&(this.compression=In(t.supportedCompression,Vu.GZipJS)?Vu.GZipJS:In(t.supportedCompression,Vu.Base64)?Vu.Base64:void 0),(n=t.analytics)!=null&&n.endpoint&&(this.analyticsDefaultEndpoint=t.analytics.endpoint),this.set_config({person_profiles:this.Fr?this.Fr:"identified_only"}),(r=this.siteApps)==null||r.onRemoteConfig(t),(a=this.sessionRecording)==null||a.onRemoteConfig(t),(s=this.autocapture)==null||s.onRemoteConfig(t),(l=this.heatmaps)==null||l.onRemoteConfig(t),this.surveys.onRemoteConfig(t),this.productTours.onRemoteConfig(t),(c=this.webVitalsAutocapture)==null||c.onRemoteConfig(t),(h=this.exceptionObserver)==null||h.onRemoteConfig(t),this.exceptions.onRemoteConfig(t),(p=this.deadClicksAutocapture)==null||p.onRemoteConfig(t)}Br(){try{this.config.loaded(this)}catch(t){yt.critical("`loaded` function failed",t)}this.Gr(),this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.config.cookieless_mode==="always")&&this.Vr()}),1),new RV(this).load(),this.featureFlags.flags()}Gr(){var t;this.is_capturing()&&this.config.request_batching&&((t=this.Lr)==null||t.enable())}_dom_loaded(){this.is_capturing()&&Qc(this.__request_queue,(t=>this.Nr(t))),this.__request_queue=[],this.Gr()}_handle_unload(){var t,n;this.config.request_batching?(this.Jr()&&this.capture("$pageleave"),(t=this.Lr)==null||t.unload(),(n=this.Ur)==null||n.unload()):this.Jr()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}ci(t){this.__loaded&&(K6?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)||(t.transport=t.transport||this.config.api_transport,t.url=Cb(t.url,{ip:this.config.ip?1:0}),t.headers=Lt({},this.config.request_headers),t.compression=t.compression==="best-available"?this.compression:t.compression,t.disableXHRCredentials=this.config.__preview_disable_xhr_credentials,this.config.__preview_disable_beacon&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||this.config.fetch_options,(n=>{var r,a,s,l=Lt({},n);l.timeout=l.timeout||6e4,l.url=Cb(l.url,{_:new Date().getTime().toString(),ver:Uu.LIB_VERSION,compression:l.compression});var c=(r=l.transport)!==null&&r!==void 0?r:"fetch",h=_b.filter((v=>!l.disableTransport||!v.transport||!l.disableTransport.includes(v.transport))),p=(a=(s=uD(h,(v=>v.transport===c)))==null?void 0:s.method)!==null&&a!==void 0?a:h[0].method;if(!p)throw new Error("No available transport method");p(l)})(Lt({},t,{callback:n=>{var r,a;this.rateLimiter.checkForLimiting(n),n.statusCode>=400&&((r=(a=this.config).on_request_error)==null||r.call(a,n)),t.callback==null||t.callback(n)}}))))}Nr(t){this.Ur?this.Ur.retriableRequest(t):this.ci(t)}_execute_array(t){var n,r=[],a=[],s=[];Qc(t,(c=>{c&&(n=c[0],ar(n)?s.push(c):Gc(c)?c.call(this):ar(c)&&n==="alias"?r.push(c):ar(c)&&n.indexOf("capture")!==-1&&Gc(this[n])?s.push(c):a.push(c))}));var l=function(c,h){Qc(c,(function(p){if(ar(p[0])){var v=h;_r(p,(function(y){v=v[y[0]].apply(v,y.slice(1))}))}else this[p[0]].apply(this,p.slice(1))}),h)};l(r,this),l(a,this),l(s,this)}Hr(){var t,n;return((t=this.config.bootstrap)==null?void 0:t.featureFlags)&&Object.keys((n=this.config.bootstrap)==null?void 0:n.featureFlags).length>0||!1}push(t){this._execute_array([t])}capture(t,n,r){var a;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Lr){if(this.is_capturing())if(!ft(t)&&Ii(t)){var s=!this.config.opt_out_useragent_filter&&this._is_bot();if(!(s&&!this.config.__preview_capture_bot_pageviews)){var l=r!=null&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(l==null||!l.isRateLimited){n!=null&&n.$current_url&&!Ii(n?.$current_url)&&(yt.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),n==null||delete n.$current_url),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var c=new Date,h=r?.timestamp||c,p=Zc(),v={uuid:p,event:t,properties:this.calculateEventProperties(t,n||{},h,p)};t==="$pageview"&&this.config.__preview_capture_bot_pageviews&&s&&(v.event="$bot_pageview",v.properties.$browser_type="bot"),l&&(v.properties.$lib_rate_limit_remaining_tokens=l.remainingTokens),r?.$set&&(v.$set=r?.$set);var y,w=this.Kr(r?.$set_once);if(w&&(v.$set_once=w),(v=sj(v,r!=null&&r._noTruncate?null:this.config.properties_string_max_length)).timestamp=h,ft(r?.timestamp)||(v.properties.$event_time_override_provided=!0,v.properties.$event_time_override_system_time=c),t===Rb.DISMISSED||t===Rb.SENT){var T=n?.[H6.SURVEY_ID],A=n?.[H6.SURVEY_ITERATION];y={id:T,current_iteration:A},localStorage.getItem(z6(y))||localStorage.setItem(z6(y),"true"),v.$set=Lt({},v.$set,{[TV({id:T,current_iteration:A},t===Rb.SENT?"responded":"dismissed")]:!0})}var R=Lt({},v.properties.$set,v.$set);if(mp(R)||this.setPersonPropertiesForFlags(R),!or(this.config.before_send)){var N=this.Yr(v);if(!N)return;v=N}this.Rr.emit("eventCaptured",v);var O={method:"POST",url:(a=r?._url)!==null&&a!==void 0?a:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:v,compression:"best-available",batchKey:r?._batchKey};return!this.config.request_batching||r&&(r==null||!r._batchKey)||r!=null&&r.send_instantly?this.Nr(O):this.Lr.enqueue(O),v}yt.critical("This capture call is ignored due to client rate limiting.")}}else yt.error("No event name provided to posthog.capture")}else yt.uninitializedWarning("posthog.capture")}Ui(t){return this.on("eventCaptured",(n=>t(n.event,n)))}calculateEventProperties(t,n,r,a,s){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return n;var l=s?void 0:this.persistence.remove_event_timer(t),c=Lt({},n);if(c.token=this.config.token,c.$config_defaults=this.config.defaults,(this.config.cookieless_mode=="always"||this.config.cookieless_mode=="on_reject"&&this.consent.isExplicitlyOptedOut())&&(c.$cookieless_mode=!0),t==="$snapshot"){var h=Lt({},this.persistence.properties(),this.sessionPersistence.properties());return c.distinct_id=h.distinct_id,(!Ii(c.distinct_id)&&!Ll(c.distinct_id)||bS(c.distinct_id))&&yt.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),c}var p,v=nV(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:y,windowId:w}=this.sessionManager.checkAndGetSessionAndWindowId(s,r.getTime());c.$session_id=y,c.$window_id=w}this.sessionPropsManager&&fi(c,this.sessionPropsManager.getSessionProps());try{var T;this.sessionRecording&&fi(c,this.sessionRecording.sdkDebugProperties),c.$sdk_debug_retry_queue_size=(T=this.Ur)==null?void 0:T.length}catch(O){c.$sdk_debug_error_capturing_properties=String(O)}if(this.requestRouter.region===H0.CUSTOM&&(c.$lib_custom_api_host=this.config.api_host),p=t!=="$pageview"||s?t!=="$pageleave"||s?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,a),c=fi(c,p),t==="$pageview"&&vt&&(c.title=vt.title),!ft(l)){var A=r.getTime()-l;c.$duration=parseFloat((A/1e3).toFixed(3))}xo&&this.config.opt_out_useragent_filter&&(c.$browser_type=this._is_bot()?"bot":"browser"),(c=fi({},v,this.persistence.properties(),this.sessionPersistence.properties(),c)).$is_identified=this._isIdentified(),ar(this.config.property_denylist)?_r(this.config.property_denylist,(function(O){delete c[O]})):yt.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var R=this.config.sanitize_properties;R&&(yt.error("sanitize_properties is deprecated. Use before_send instead"),c=R(c,t));var N=this.Xr();return c.$process_person_profile=N,N&&!s&&this.Qr("_calculate_event_properties"),c}Kr(t){var n;if(!this.persistence||!this.Xr()||this.Tr)return t;var r=this.persistence.get_initial_props(),a=(n=this.sessionPropsManager)==null?void 0:n.getSetOnceProps(),s=fi({},r,a||{},t||{}),l=this.config.sanitize_properties;return l&&(yt.error("sanitize_properties is deprecated. Use before_send instead"),s=l(s,"$set_once")),this.Tr=!0,mp(s)?void 0:s}register(t,n){var r;(r=this.persistence)==null||r.register(t,n)}register_once(t,n,r){var a;(a=this.persistence)==null||a.register_once(t,n,r)}register_for_session(t){var n;(n=this.sessionPersistence)==null||n.register(t)}unregister(t){var n;(n=this.persistence)==null||n.unregister(t)}unregister_for_session(t){var n;(n=this.sessionPersistence)==null||n.unregister(t)}Zr(t,n){this.register({[t]:n})}getFeatureFlag(t,n){return this.featureFlags.getFeatureFlag(t,n)}getFeatureFlagPayload(t){var n=this.featureFlags.getFeatureFlagPayload(t);try{return JSON.parse(n)}catch{return n}}isFeatureEnabled(t,n){return this.featureFlags.isFeatureEnabled(t,n)}reloadFeatureFlags(){this.featureFlags.reloadFeatureFlags()}updateEarlyAccessFeatureEnrollment(t,n,r){this.featureFlags.updateEarlyAccessFeatureEnrollment(t,n,r)}getEarlyAccessFeatures(t,n,r){return n===void 0&&(n=!1),this.featureFlags.getEarlyAccessFeatures(t,n,r)}on(t,n){return this.Rr.on(t,n)}onFeatureFlags(t){return this.featureFlags.onFeatureFlags(t)}onSurveysLoaded(t){return this.surveys.onSurveysLoaded(t)}onSessionId(t){var n,r;return(n=(r=this.sessionManager)==null?void 0:r.onSessionId(t))!==null&&n!==void 0?n:()=>{}}getSurveys(t,n){n===void 0&&(n=!1),this.surveys.getSurveys(t,n)}getActiveMatchingSurveys(t,n){n===void 0&&(n=!1),this.surveys.getActiveMatchingSurveys(t,n)}renderSurvey(t,n){this.surveys.renderSurvey(t,n)}displaySurvey(t,n){n===void 0&&(n=CV),this.surveys.displaySurvey(t,n)}cancelPendingSurvey(t){this.surveys.cancelPendingSurvey(t)}canRenderSurvey(t){return this.surveys.canRenderSurvey(t)}canRenderSurveyAsync(t,n){return n===void 0&&(n=!1),this.surveys.canRenderSurveyAsync(t,n)}identify(t,n,r){if(!this.__loaded||!this.persistence)return yt.uninitializedWarning("posthog.identify");if(Ll(t)&&(t=t.toString(),yt.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),t)if(["distinct_id","distinctid"].includes(t.toLowerCase()))yt.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.');else if(t!==E0){if(this.Qr("posthog.identify")){var a=this.get_distinct_id();if(this.register({$user_id:t}),!this.get_property("$device_id")){var s=a;this.register_once({$had_persisted_distinct_id:!0,$device_id:s},"")}t!==a&&t!==this.get_property(g0)&&(this.unregister(g0),this.register({distinct_id:t}));var l=(this.persistence.get_property(ju)||"anonymous")==="anonymous";t!==a&&l?(this.persistence.set_property(ju,"identified"),this.setPersonPropertiesForFlags(Lt({},r||{},n||{}),!1),this.capture("$identify",{distinct_id:t,$anon_distinct_id:a},{$set:n||{},$set_once:r||{}}),this.Mr=O6(t,n,r),this.featureFlags.setAnonymousDistinctId(a)):(n||r)&&this.setPersonProperties(n,r),t!==a&&(this.reloadFeatureFlags(),this.unregister(cb))}}else yt.critical('The string "'+E0+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.');else yt.error("Unique user id has not been set in posthog.identify")}setPersonProperties(t,n){if((t||n)&&this.Qr("posthog.setPersonProperties")){var r=O6(this.get_distinct_id(),t,n);this.Mr!==r?(this.setPersonPropertiesForFlags(Lt({},n||{},t||{})),this.capture("$set",{$set:t||{},$set_once:n||{}}),this.Mr=r):yt.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(t,n,r){if(t&&n){if(this.Qr("posthog.group")){var a=this.getGroups();a[t]!==n&&this.resetGroupPropertiesForFlags(t),this.register({$groups:Lt({},a,{[t]:n})}),r&&(this.capture("$groupidentify",{$group_type:t,$group_key:n,$group_set:r}),this.setGroupPropertiesForFlags({[t]:r})),a[t]===n||r||this.reloadFeatureFlags()}}else yt.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,n){n===void 0&&(n=!0),this.featureFlags.setPersonPropertiesForFlags(t,n)}resetPersonPropertiesForFlags(){this.featureFlags.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(t,n){n===void 0&&(n=!0),this.Qr("posthog.setGroupPropertiesForFlags")&&this.featureFlags.setGroupPropertiesForFlags(t,n)}resetGroupPropertiesForFlags(t){this.featureFlags.resetGroupPropertiesForFlags(t)}reset(t){var n,r,a,s;if(yt.info("reset"),!this.__loaded)return yt.uninitializedWarning("posthog.reset");var l=this.get_property("$device_id");if(this.consent.reset(),(n=this.persistence)==null||n.clear(),(r=this.sessionPersistence)==null||r.clear(),this.surveys.reset(),this.featureFlags.reset(),(a=this.persistence)==null||a.set_property(ju,"anonymous"),(s=this.sessionManager)==null||s.resetSessionId(),this.Mr=null,this.config.cookieless_mode==="always")this.register_once({distinct_id:E0,$device_id:null},"");else{var c=this.config.get_device_id(Zc());this.register_once({distinct_id:c,$device_id:t?c:l},"")}this.register({$last_posthog_reset:new Date().toISOString()},1)}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,n;return(t=(n=this.sessionManager)==null?void 0:n.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&t!==void 0?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";var{sessionId:n,sessionStartTimestamp:r}=this.sessionManager.checkAndGetSessionAndWindowId(!0),a=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+n);if(t!=null&&t.withTimestamp&&r){var s,l=(s=t.timestampLookBack)!==null&&s!==void 0?s:10;if(!r)return a;a+="?t="+Math.max(Math.floor((new Date().getTime()-r)/1e3)-l,0)}return a}alias(t,n){return t===this.get_property(cD)?(yt.critical("Attempting to create alias for existing People user - aborting."),-2):this.Qr("posthog.alias")?(ft(n)&&(n=this.get_distinct_id()),t!==n?(this.Zr(g0,t),this.capture("$create_alias",{alias:t,distinct_id:n})):(yt.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var n=Lt({},this.config);if($i(t)){var r,a,s,l,c;fi(this.config,X6(t));var h=this.jr();(r=this.persistence)==null||r.update_config(this.config,n,h),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new oC(Lt({},this.config,{persistence:"sessionStorage"}),h);var p=this.Or(this.config.debug);Kc(p)&&(this.config.debug=p),Kc(this.config.debug)&&(this.config.debug?(Uu.DEBUG=!0,qr.H()&&qr.G("ph_debug","true"),yt.info("set_config",{config:t,oldConfig:n,newConfig:Lt({},this.config)})):(Uu.DEBUG=!1,qr.H()&&qr.V("ph_debug"))),(a=this.sessionRecording)==null||a.startIfEnabledOrStop(),(s=this.autocapture)==null||s.startIfEnabled(),(l=this.heatmaps)==null||l.startIfEnabled(),this.surveys.loadIfEnabled(),this.ts(),(c=this.externalIntegrations)==null||c.startIfEnabledOrStop()}}startSessionRecording(t){var n=t===!0,r={sampling:n||!(t==null||!t.sampling),linked_flag:n||!(t==null||!t.linked_flag),url_trigger:n||!(t==null||!t.url_trigger),event_trigger:n||!(t==null||!t.event_trigger)};if(Object.values(r).some(Boolean)){var a,s,l,c,h;(a=this.sessionManager)==null||a.checkAndGetSessionAndWindowId(),r.sampling&&((s=this.sessionRecording)==null||s.overrideSampling()),r.linked_flag&&((l=this.sessionRecording)==null||l.overrideLinkedFlag()),r.url_trigger&&((c=this.sessionRecording)==null||c.overrideTrigger("url")),r.event_trigger&&((h=this.sessionRecording)==null||h.overrideTrigger("event"))}this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!((t=this.sessionRecording)==null||!t.started)}captureException(t,n){var r=new Error("PostHog syntheticException"),a=this.exceptions.buildProperties(t,{handled:!0,syntheticException:r});return this.exceptions.sendExceptionEvent(Lt({},a,n))}loadToolbar(t){return this.toolbar.loadToolbar(t)}get_property(t){var n;return(n=this.persistence)==null?void 0:n.props[t]}getSessionProperty(t){var n;return(n=this.sessionPersistence)==null?void 0:n.props[t]}toString(){var t,n=(t=this.config.name)!==null&&t!==void 0?t:_p;return n!==_p&&(n=_p+"."+n),n}_isIdentified(){var t,n;return((t=this.persistence)==null?void 0:t.get_property(ju))==="identified"||((n=this.sessionPersistence)==null?void 0:n.get_property(ju))==="identified"}Xr(){var t,n;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&mp(this.getGroups())&&((t=this.persistence)==null||(t=t.props)==null||!t[g0])&&((n=this.persistence)==null||(n=n.props)==null||!n[fb]))}Jr(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&(this.config.capture_pageview===!0||this.config.capture_pageview==="history_change")}createPersonProfile(){this.Xr()||this.Qr("posthog.createPersonProfile")&&this.setPersonProperties({},{})}Qr(t){return this.config.person_profiles==="never"?(yt.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Zr(fb,!0),!0)}jr(){if(this.config.cookieless_mode==="always")return!0;var t=this.consent.isOptedOut(),n=this.config.opt_out_persistence_by_default||this.config.cookieless_mode==="on_reject";return this.config.disable_persistence||t&&!!n}ts(){var t,n,r,a,s=this.jr();return((t=this.persistence)==null?void 0:t.wi)!==s&&((r=this.persistence)==null||r.set_disabled(s)),((n=this.sessionPersistence)==null?void 0:n.wi)!==s&&((a=this.sessionPersistence)==null||a.set_disabled(s)),s}opt_in_capturing(t){var n;if(this.config.cookieless_mode!=="always"){var r,a;this.config.cookieless_mode==="on_reject"&&this.consent.isExplicitlyOptedOut()&&(this.reset(!0),(r=this.sessionManager)==null||r.destroy(),this.sessionManager=new W6(this),this.persistence&&(this.sessionPropsManager=new V6(this,this.sessionManager,this.persistence)),this.sessionRecording=new G6(this),this.sessionRecording.startIfEnabledOrStop()),this.consent.optInOut(!0),this.ts(),this.Gr(),(n=this.sessionRecording)==null||n.startIfEnabledOrStop(),this.config.cookieless_mode=="on_reject"&&this.surveys.loadIfEnabled(),(ft(t?.captureEventName)||t!=null&&t.captureEventName)&&this.capture((a=t?.captureEventName)!==null&&a!==void 0?a:"$opt_in",t?.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Vr()}else yt.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}opt_out_capturing(){var t,n;this.config.cookieless_mode!=="always"?(this.config.cookieless_mode==="on_reject"&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.ts(),this.config.cookieless_mode==="on_reject"&&(this.register({distinct_id:E0,$device_id:null}),(t=this.sessionManager)==null||t.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,(n=this.sessionRecording)==null||n.stopRecording(),this.sessionRecording=void 0,this.Vr())):yt.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var t=this.consent.consent;return t===Wu.GRANTED?"granted":t===Wu.DENIED?"denied":"pending"}is_capturing(){return this.config.cookieless_mode==="always"||(this.config.cookieless_mode==="on_reject"?this.consent.isExplicitlyOptedOut()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.ts()}_is_bot(){return Go?Y6(Go,this.config.custom_blocked_useragents):void 0}Vr(){vt&&(vt.visibilityState==="visible"?this.Cr||(this.Cr=!0,this.capture("$pageview",{title:vt.title},{send_instantly:!0}),this.Ir&&(vt.removeEventListener("visibilitychange",this.Ir),this.Ir=null)):this.Ir||(this.Ir=this.Vr.bind(this),wi(vt,"visibilitychange",this.Ir)))}debug(t){t===!1?(Ne?.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(Ne?.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}O(){var t,n,r,a,s,l,c,h=this.Ar||{};return"advanced_disable_flags"in h?!!h.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(yt.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(r="advanced_disable_decide",a=!1,s=yt,l=(n="advanced_disable_flags")in(t=h)&&!ft(t[n]),c=r in t&&!ft(t[r]),l?t[n]:c?(s&&s.warn("Config field '"+r+"' is deprecated. Please use '"+n+"' instead. The old field will be removed in a future major version."),t[r]):a)}Yr(t){if(or(this.config.before_send))return t;var n=ar(this.config.before_send)?this.config.before_send:[this.config.before_send],r=t;for(var a of n){if(r=a(r),or(r)){var s="Event '"+t.event+"' was rejected in beforeSend function";return Pz(t.event)?yt.warn(s+". This can cause unexpected behavior."):yt.info(s),null}r.properties&&!mp(r.properties)||yt.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}return r}getPageViewId(){var t;return(t=this.pageViewManager.Vt)==null?void 0:t.pageViewId}captureTraceFeedback(t,n){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:n})}captureTraceMetric(t,n,r){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:n,$ai_metric_value:String(r)})}Or(t){var n=Kc(t)&&!t,r=qr.H()&&qr.q("ph_debug")==="true";return!n&&(!!r||t)}}(function(e,t){for(var n=0;n<t.length;n++)e.prototype[t[n]]=oj(e.prototype[t[n]])})(Db,["identify"]);var Z6,ys=(Z6=z0[_p]=new Db,(function(){function e(){e.done||(e.done=!0,K6=!1,_r(z0,(function(t){t._dom_loaded()})))}vt!=null&&vt.addEventListener?vt.readyState==="complete"?e():wi(vt,"DOMContentLoaded",e,{capture:!1}):Ne&&yt.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),Z6);const Of=(e,t)=>{ys.capture(e,t)},VV=Object.values(Object.assign({"/src/components/Banner/Banner.module.css":MU,"/src/components/Feedback/FeedbackModal.module.css":FU,"/src/components/Header/Header.module.css":BU,"/src/components/Header/HeaderDetails.module.css":HU,"/src/components/RateConversation/FeedbackForm.module.css":UU,"/src/components/StartView/ChatBarButton.module.css":zU,"/src/components/StartView/ChatButton.module.css":jU,"/src/components/StartView/FoldableChatButton.module.css":VU,"/src/components/attachments/AttachmentPreview.module.css":WU,"/src/components/attachments/UploadAttachmentButton.module.css":YU,"/src/components/chat/ChatFooter.module.css":qU,"/src/components/chat/ChatInput.module.css":GU,"/src/components/chat/ChatIntro.module.css":KU,"/src/components/chat/ChatListDisclaimer.module.css":QU,"/src/components/chat/CloseChatModal.module.css":XU,"/src/components/chat/FeedbackButtons.module.css":ZU,"/src/components/shared/Button.module.css":JU,"/src/components/shared/MinimalMarkdown.module.css":$U,"/src/components/shared/Modal.module.css":ez,"/src/components/shared/Textarea.module.css":tz,"/src/components/shared/Typography.module.css":nz,"/src/components/ui/Spinner/Spinner.module.css":rz,"/src/components/ui/chat/Message.module.css":iz,"/src/components/ui/chat/MessageContainer.module.css":az,"/src/components/ui/chat/MessageLoading.module.css":oz,"/src/components/ui/chat/blocks/ButtonGroupBlock.module.css":sz,"/src/components/ui/chat/blocks/ImageReferenceBlock.module.css":lz,"/src/components/ui/chat/blocks/MarkdownBlock.module.css":uz,"/src/components/ui/chat/blocks/SourceGroupBlock.module.css":cz,"/src/components/ui/chat/blocks/TextBlock.module.css":dz,"/src/widget/freedayWidget.module.css":fz})).join(`
169
169
  `);function WV(e,t,n){if(!customElements.get(e)){const r=class extends HTMLElement{constructor(){super();const a=this.attachShadow({mode:"open"});this._loadFonts();const s=new CSSStyleSheet,l=Cz+_z+Az+kz+VV;s.replaceSync(l.replaceAll(":root",":host")),a.adoptedStyleSheets=[s],this.root=Sz.createRoot(a)}openChat(a){Of("widget:opened",{start_view:void 0,source:"external"}),globalThis.postMessage({event:Nr.START,payload:{suggestionMessage:a?.message}},globalThis.location.origin),globalThis.dispatchEvent(new Event(Nr.OPEN))}_loadFonts(){const a=document.createElement("link");a.rel="stylesheet",a.href="https://fonts.googleapis.com/css2?family=Nunito:wght@400;700&family=Space+Grotesk:wght@400;700&display=swap",document.head.appendChild(a)}_renderReactComponent(){const a={};n.forEach(s=>{a[s]=this.getAttribute(s)??""}),this.root.render(F.jsx(t,{...a}))}static get observedAttributes(){return n}attributeChangedCallback(a,s,l){s!==l&&this._renderReactComponent()}connectedCallback(){this._renderReactComponent()}disconnectedCallback(){this.root.unmount()}};customElements.define(e,r)}}function So(e,t,{checkForDefaultPrevented:n=!0}={}){return function(a){if(e?.(a),n===!1||!a.defaultPrevented)return t?.(a)}}function J6(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function mC(...e){return t=>{let n=!1;const r=e.map(a=>{const s=J6(a,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let a=0;a<r.length;a++){const s=r[a];typeof s=="function"?s():J6(e[a],null)}}}}function qs(...e){return _.useCallback(mC(...e),e)}function YV(e,t){const n=_.createContext(t),r=s=>{const{children:l,...c}=s,h=_.useMemo(()=>c,Object.values(c));return F.jsx(n.Provider,{value:h,children:l})};r.displayName=e+"Provider";function a(s){const l=_.useContext(n);if(l)return l;if(t!==void 0)return t;throw new Error(`\`${s}\` must be used within \`${e}\``)}return[r,a]}function gC(e,t=[]){let n=[];function r(s,l){const c=_.createContext(l),h=n.length;n=[...n,l];const p=y=>{const{scope:w,children:T,...A}=y,R=w?.[e]?.[h]||c,N=_.useMemo(()=>A,Object.values(A));return F.jsx(R.Provider,{value:N,children:T})};p.displayName=s+"Provider";function v(y,w){const T=w?.[e]?.[h]||c,A=_.useContext(T);if(A)return A;if(l!==void 0)return l;throw new Error(`\`${y}\` must be used within \`${s}\``)}return[p,v]}const a=()=>{const s=n.map(l=>_.createContext(l));return function(c){const h=c?.[e]||s;return _.useMemo(()=>({[`__scope${e}`]:{...c,[e]:h}}),[c,h])}};return a.scopeName=e,[r,qV(a,...t)]}function qV(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(s){const l=r.reduce((c,{useScope:h,scopeName:p})=>{const y=h(s)[`__scope${p}`];return{...c,...y}},{});return _.useMemo(()=>({[`__scope${t.scopeName}`]:l}),[l])}};return n.scopeName=t.scopeName,n}var Lb=j4();const $6=d0(Lb);function eL(e){const t=GV(e),n=_.forwardRef((r,a)=>{const{children:s,...l}=r,c=_.Children.toArray(s),h=c.find(QV);if(h){const p=h.props.children,v=c.map(y=>y===h?_.Children.count(p)>1?_.Children.only(null):_.isValidElement(p)?p.props.children:null:y);return F.jsx(t,{...l,ref:a,children:_.isValidElement(p)?_.cloneElement(p,void 0,v):null})}return F.jsx(t,{...l,ref:a,children:s})});return n.displayName=`${e}.Slot`,n}function GV(e){const t=_.forwardRef((n,r)=>{const{children:a,...s}=n;if(_.isValidElement(a)){const l=ZV(a),c=XV(s,a.props);return a.type!==_.Fragment&&(c.ref=r?mC(r,l):l),_.cloneElement(a,c)}return _.Children.count(a)>1?_.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var tL=Symbol("radix.slottable");function KV(e){const t=({children:n})=>F.jsx(F.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=tL,t}function QV(e){return _.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===tL}function XV(e,t){const n={...t};for(const r in t){const a=e[r],s=t[r];/^on[A-Z]/.test(r)?a&&s?n[r]=(...c)=>{const h=s(...c);return a(...c),h}:a&&(n[r]=a):r==="style"?n[r]={...a,...s}:r==="className"&&(n[r]=[a,s].filter(Boolean).join(" "))}return{...e,...n}}function ZV(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var JV=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Co=JV.reduce((e,t)=>{const n=eL(`Primitive.${t}`),r=_.forwardRef((a,s)=>{const{asChild:l,...c}=a,h=l?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),F.jsx(h,{...c,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function $V(e,t){e&&Lb.flushSync(()=>e.dispatchEvent(t))}function Ap(e){const t=_.useRef(e);return _.useEffect(()=>{t.current=e}),_.useMemo(()=>(...n)=>t.current?.(...n),[])}function eW(e,t=globalThis?.document){const n=Ap(e);_.useEffect(()=>{const r=a=>{a.key==="Escape"&&n(a)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var tW="DismissableLayer",vC="dismissableLayer.update",nW="dismissableLayer.pointerDownOutside",rW="dismissableLayer.focusOutside",nL,rL=_.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),yC=_.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:a,onFocusOutside:s,onInteractOutside:l,onDismiss:c,...h}=e,p=_.useContext(rL),[v,y]=_.useState(null),w=v?.ownerDocument??globalThis?.document,[,T]=_.useState({}),A=qs(t,Z=>y(Z)),R=Array.from(p.layers),[N]=[...p.layersWithOutsidePointerEventsDisabled].slice(-1),O=R.indexOf(N),M=v?R.indexOf(v):-1,H=p.layersWithOutsidePointerEventsDisabled.size>0,V=M>=O,K=oW(Z=>{const X=Z.target,ce=[...p.branches].some(W=>W.contains(X));!V||ce||(a?.(Z),l?.(Z),Z.defaultPrevented||c?.())},w),Y=sW(Z=>{const X=Z.target;[...p.branches].some(W=>W.contains(X))||(s?.(Z),l?.(Z),Z.defaultPrevented||c?.())},w);return eW(Z=>{M===p.layers.size-1&&(r?.(Z),!Z.defaultPrevented&&c&&(Z.preventDefault(),c()))},w),_.useEffect(()=>{if(v)return n&&(p.layersWithOutsidePointerEventsDisabled.size===0&&(nL=w.body.style.pointerEvents,w.body.style.pointerEvents="none"),p.layersWithOutsidePointerEventsDisabled.add(v)),p.layers.add(v),iL(),()=>{n&&p.layersWithOutsidePointerEventsDisabled.size===1&&(w.body.style.pointerEvents=nL)}},[v,w,n,p]),_.useEffect(()=>()=>{v&&(p.layers.delete(v),p.layersWithOutsidePointerEventsDisabled.delete(v),iL())},[v,p]),_.useEffect(()=>{const Z=()=>T({});return document.addEventListener(vC,Z),()=>document.removeEventListener(vC,Z)},[]),F.jsx(Co.div,{...h,ref:A,style:{pointerEvents:H?V?"auto":"none":void 0,...e.style},onFocusCapture:So(e.onFocusCapture,Y.onFocusCapture),onBlurCapture:So(e.onBlurCapture,Y.onBlurCapture),onPointerDownCapture:So(e.onPointerDownCapture,K.onPointerDownCapture)})});yC.displayName=tW;var iW="DismissableLayerBranch",aW=_.forwardRef((e,t)=>{const n=_.useContext(rL),r=_.useRef(null),a=qs(t,r);return _.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),F.jsx(Co.div,{...e,ref:a})});aW.displayName=iW;function oW(e,t=globalThis?.document){const n=Ap(e),r=_.useRef(!1),a=_.useRef(()=>{});return _.useEffect(()=>{const s=c=>{if(c.target&&!r.current){let h=function(){aL(nW,n,p,{discrete:!0})};const p={originalEvent:c};c.pointerType==="touch"?(t.removeEventListener("click",a.current),a.current=h,t.addEventListener("click",a.current,{once:!0})):h()}else t.removeEventListener("click",a.current);r.current=!1},l=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(l),t.removeEventListener("pointerdown",s),t.removeEventListener("click",a.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function sW(e,t=globalThis?.document){const n=Ap(e),r=_.useRef(!1);return _.useEffect(()=>{const a=s=>{s.target&&!r.current&&aL(rW,n,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",a),()=>t.removeEventListener("focusin",a)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function iL(){const e=new CustomEvent(vC);document.dispatchEvent(e)}function aL(e,t,n,{discrete:r}){const a=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&a.addEventListener(e,t,{once:!0}),r?$V(a,s):a.dispatchEvent(s)}var td=globalThis?.document?_.useLayoutEffect:()=>{},lW=hS[" useId ".trim().toString()]||(()=>{}),uW=0;function Ob(e){const[t,n]=_.useState(lW());return td(()=>{n(r=>r??String(uW++))},[e]),e||(t?`radix-${t}`:"")}const cW=["top","right","bottom","left"],nd=Math.min,Ko=Math.max,Nb=Math.round,Pb=Math.floor,Il=e=>({x:e,y:e}),dW={left:"right",right:"left",bottom:"top",top:"bottom"},fW={start:"end",end:"start"};function bC(e,t,n){return Ko(e,nd(t,n))}function qu(e,t){return typeof e=="function"?e(t):e}function Gu(e){return e.split("-")[0]}function kp(e){return e.split("-")[1]}function EC(e){return e==="x"?"y":"x"}function wC(e){return e==="y"?"height":"width"}const hW=new Set(["top","bottom"]);function Ml(e){return hW.has(Gu(e))?"y":"x"}function xC(e){return EC(Ml(e))}function pW(e,t,n){n===void 0&&(n=!1);const r=kp(e),a=xC(e),s=wC(a);let l=a==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(l=Ib(l)),[l,Ib(l)]}function mW(e){const t=Ib(e);return[TC(e),t,TC(t)]}function TC(e){return e.replace(/start|end/g,t=>fW[t])}const oL=["left","right"],sL=["right","left"],gW=["top","bottom"],vW=["bottom","top"];function yW(e,t,n){switch(e){case"top":case"bottom":return n?t?sL:oL:t?oL:sL;case"left":case"right":return t?gW:vW;default:return[]}}function bW(e,t,n,r){const a=kp(e);let s=yW(Gu(e),n==="start",r);return a&&(s=s.map(l=>l+"-"+a),t&&(s=s.concat(s.map(TC)))),s}function Ib(e){return e.replace(/left|right|bottom|top/g,t=>dW[t])}function EW(e){return{top:0,right:0,bottom:0,left:0,...e}}function lL(e){return typeof e!="number"?EW(e):{top:e,right:e,bottom:e,left:e}}function Mb(e){const{x:t,y:n,width:r,height:a}=e;return{width:r,height:a,top:n,left:t,right:t+r,bottom:n+a,x:t,y:n}}function uL(e,t,n){let{reference:r,floating:a}=e;const s=Ml(t),l=xC(t),c=wC(l),h=Gu(t),p=s==="y",v=r.x+r.width/2-a.width/2,y=r.y+r.height/2-a.height/2,w=r[c]/2-a[c]/2;let T;switch(h){case"top":T={x:v,y:r.y-a.height};break;case"bottom":T={x:v,y:r.y+r.height};break;case"right":T={x:r.x+r.width,y};break;case"left":T={x:r.x-a.width,y};break;default:T={x:r.x,y:r.y}}switch(kp(t)){case"start":T[l]-=w*(n&&p?-1:1);break;case"end":T[l]+=w*(n&&p?-1:1);break}return T}const wW=async(e,t,n)=>{const{placement:r="bottom",strategy:a="absolute",middleware:s=[],platform:l}=n,c=s.filter(Boolean),h=await(l.isRTL==null?void 0:l.isRTL(t));let p=await l.getElementRects({reference:e,floating:t,strategy:a}),{x:v,y}=uL(p,r,h),w=r,T={},A=0;for(let R=0;R<c.length;R++){const{name:N,fn:O}=c[R],{x:M,y:H,data:V,reset:K}=await O({x:v,y,initialPlacement:r,placement:w,strategy:a,middlewareData:T,rects:p,platform:l,elements:{reference:e,floating:t}});v=M??v,y=H??y,T={...T,[N]:{...T[N],...V}},K&&A<=50&&(A++,typeof K=="object"&&(K.placement&&(w=K.placement),K.rects&&(p=K.rects===!0?await l.getElementRects({reference:e,floating:t,strategy:a}):K.rects),{x:v,y}=uL(p,w,h)),R=-1)}return{x:v,y,placement:w,strategy:a,middlewareData:T}};async function j0(e,t){var n;t===void 0&&(t={});const{x:r,y:a,platform:s,rects:l,elements:c,strategy:h}=e,{boundary:p="clippingAncestors",rootBoundary:v="viewport",elementContext:y="floating",altBoundary:w=!1,padding:T=0}=qu(t,e),A=lL(T),N=c[w?y==="floating"?"reference":"floating":y],O=Mb(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(N)))==null||n?N:N.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(c.floating)),boundary:p,rootBoundary:v,strategy:h})),M=y==="floating"?{x:r,y:a,width:l.floating.width,height:l.floating.height}:l.reference,H=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating)),V=await(s.isElement==null?void 0:s.isElement(H))?await(s.getScale==null?void 0:s.getScale(H))||{x:1,y:1}:{x:1,y:1},K=Mb(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:M,offsetParent:H,strategy:h}):M);return{top:(O.top-K.top+A.top)/V.y,bottom:(K.bottom-O.bottom+A.bottom)/V.y,left:(O.left-K.left+A.left)/V.x,right:(K.right-O.right+A.right)/V.x}}const xW=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:a,rects:s,platform:l,elements:c,middlewareData:h}=t,{element:p,padding:v=0}=qu(e,t)||{};if(p==null)return{};const y=lL(v),w={x:n,y:r},T=xC(a),A=wC(T),R=await l.getDimensions(p),N=T==="y",O=N?"top":"left",M=N?"bottom":"right",H=N?"clientHeight":"clientWidth",V=s.reference[A]+s.reference[T]-w[T]-s.floating[A],K=w[T]-s.reference[T],Y=await(l.getOffsetParent==null?void 0:l.getOffsetParent(p));let Z=Y?Y[H]:0;(!Z||!await(l.isElement==null?void 0:l.isElement(Y)))&&(Z=c.floating[H]||s.floating[A]);const X=V/2-K/2,ce=Z/2-R[A]/2-1,W=nd(y[O],ce),me=nd(y[M],ce),oe=W,te=Z-R[A]-me,le=Z/2-R[A]/2+X,Ae=bC(oe,le,te),_e=!h.arrow&&kp(a)!=null&&le!==Ae&&s.reference[A]/2-(le<oe?W:me)-R[A]/2<0,ve=_e?le<oe?le-oe:le-te:0;return{[T]:w[T]+ve,data:{[T]:Ae,centerOffset:le-Ae-ve,..._e&&{alignmentOffset:ve}},reset:_e}}}),TW=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:a,middlewareData:s,rects:l,initialPlacement:c,platform:h,elements:p}=t,{mainAxis:v=!0,crossAxis:y=!0,fallbackPlacements:w,fallbackStrategy:T="bestFit",fallbackAxisSideDirection:A="none",flipAlignment:R=!0,...N}=qu(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const O=Gu(a),M=Ml(c),H=Gu(c)===c,V=await(h.isRTL==null?void 0:h.isRTL(p.floating)),K=w||(H||!R?[Ib(c)]:mW(c)),Y=A!=="none";!w&&Y&&K.push(...bW(c,R,A,V));const Z=[c,...K],X=await j0(t,N),ce=[];let W=((r=s.flip)==null?void 0:r.overflows)||[];if(v&&ce.push(X[O]),y){const le=pW(a,l,V);ce.push(X[le[0]],X[le[1]])}if(W=[...W,{placement:a,overflows:ce}],!ce.every(le=>le<=0)){var me,oe;const le=(((me=s.flip)==null?void 0:me.index)||0)+1,Ae=Z[le];if(Ae&&(!(y==="alignment"?M!==Ml(Ae):!1)||W.every(se=>Ml(se.placement)===M?se.overflows[0]>0:!0)))return{data:{index:le,overflows:W},reset:{placement:Ae}};let _e=(oe=W.filter(ve=>ve.overflows[0]<=0).sort((ve,se)=>ve.overflows[1]-se.overflows[1])[0])==null?void 0:oe.placement;if(!_e)switch(T){case"bestFit":{var te;const ve=(te=W.filter(se=>{if(Y){const De=Ml(se.placement);return De===M||De==="y"}return!0}).map(se=>[se.placement,se.overflows.filter(De=>De>0).reduce((De,U)=>De+U,0)]).sort((se,De)=>se[1]-De[1])[0])==null?void 0:te[0];ve&&(_e=ve);break}case"initialPlacement":_e=c;break}if(a!==_e)return{reset:{placement:_e}}}return{}}}};function cL(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function dL(e){return cW.some(t=>e[t]>=0)}const SW=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...a}=qu(e,t);switch(r){case"referenceHidden":{const s=await j0(t,{...a,elementContext:"reference"}),l=cL(s,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:dL(l)}}}case"escaped":{const s=await j0(t,{...a,altBoundary:!0}),l=cL(s,n.floating);return{data:{escapedOffsets:l,escaped:dL(l)}}}default:return{}}}}},fL=new Set(["left","top"]);async function CW(e,t){const{placement:n,platform:r,elements:a}=e,s=await(r.isRTL==null?void 0:r.isRTL(a.floating)),l=Gu(n),c=kp(n),h=Ml(n)==="y",p=fL.has(l)?-1:1,v=s&&h?-1:1,y=qu(t,e);let{mainAxis:w,crossAxis:T,alignmentAxis:A}=typeof y=="number"?{mainAxis:y,crossAxis:0,alignmentAxis:null}:{mainAxis:y.mainAxis||0,crossAxis:y.crossAxis||0,alignmentAxis:y.alignmentAxis};return c&&typeof A=="number"&&(T=c==="end"?A*-1:A),h?{x:T*v,y:w*p}:{x:w*p,y:T*v}}const _W=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:a,y:s,placement:l,middlewareData:c}=t,h=await CW(t,e);return l===((n=c.offset)==null?void 0:n.placement)&&(r=c.arrow)!=null&&r.alignmentOffset?{}:{x:a+h.x,y:s+h.y,data:{...h,placement:l}}}}},AW=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:a}=t,{mainAxis:s=!0,crossAxis:l=!1,limiter:c={fn:N=>{let{x:O,y:M}=N;return{x:O,y:M}}},...h}=qu(e,t),p={x:n,y:r},v=await j0(t,h),y=Ml(Gu(a)),w=EC(y);let T=p[w],A=p[y];if(s){const N=w==="y"?"top":"left",O=w==="y"?"bottom":"right",M=T+v[N],H=T-v[O];T=bC(M,T,H)}if(l){const N=y==="y"?"top":"left",O=y==="y"?"bottom":"right",M=A+v[N],H=A-v[O];A=bC(M,A,H)}const R=c.fn({...t,[w]:T,[y]:A});return{...R,data:{x:R.x-n,y:R.y-r,enabled:{[w]:s,[y]:l}}}}}},kW=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:a,rects:s,middlewareData:l}=t,{offset:c=0,mainAxis:h=!0,crossAxis:p=!0}=qu(e,t),v={x:n,y:r},y=Ml(a),w=EC(y);let T=v[w],A=v[y];const R=qu(c,t),N=typeof R=="number"?{mainAxis:R,crossAxis:0}:{mainAxis:0,crossAxis:0,...R};if(h){const H=w==="y"?"height":"width",V=s.reference[w]-s.floating[H]+N.mainAxis,K=s.reference[w]+s.reference[H]-N.mainAxis;T<V?T=V:T>K&&(T=K)}if(p){var O,M;const H=w==="y"?"width":"height",V=fL.has(Gu(a)),K=s.reference[y]-s.floating[H]+(V&&((O=l.offset)==null?void 0:O[y])||0)+(V?0:N.crossAxis),Y=s.reference[y]+s.reference[H]+(V?0:((M=l.offset)==null?void 0:M[y])||0)-(V?N.crossAxis:0);A<K?A=K:A>Y&&(A=Y)}return{[w]:T,[y]:A}}}},RW=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:a,rects:s,platform:l,elements:c}=t,{apply:h=()=>{},...p}=qu(e,t),v=await j0(t,p),y=Gu(a),w=kp(a),T=Ml(a)==="y",{width:A,height:R}=s.floating;let N,O;y==="top"||y==="bottom"?(N=y,O=w===(await(l.isRTL==null?void 0:l.isRTL(c.floating))?"start":"end")?"left":"right"):(O=y,N=w==="end"?"top":"bottom");const M=R-v.top-v.bottom,H=A-v.left-v.right,V=nd(R-v[N],M),K=nd(A-v[O],H),Y=!t.middlewareData.shift;let Z=V,X=K;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(X=H),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(Z=M),Y&&!w){const W=Ko(v.left,0),me=Ko(v.right,0),oe=Ko(v.top,0),te=Ko(v.bottom,0);T?X=A-2*(W!==0||me!==0?W+me:Ko(v.left,v.right)):Z=R-2*(oe!==0||te!==0?oe+te:Ko(v.top,v.bottom))}await h({...t,availableWidth:X,availableHeight:Z});const ce=await l.getDimensions(c.floating);return A!==ce.width||R!==ce.height?{reset:{rects:!0}}:{}}}};function Fb(){return typeof window<"u"}function Rp(e){return hL(e)?(e.nodeName||"").toLowerCase():"#document"}function Qo(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Fl(e){var t;return(t=(hL(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function hL(e){return Fb()?e instanceof Node||e instanceof Qo(e).Node:!1}function Gs(e){return Fb()?e instanceof Element||e instanceof Qo(e).Element:!1}function Bl(e){return Fb()?e instanceof HTMLElement||e instanceof Qo(e).HTMLElement:!1}function pL(e){return!Fb()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Qo(e).ShadowRoot}const DW=new Set(["inline","contents"]);function V0(e){const{overflow:t,overflowX:n,overflowY:r,display:a}=Ks(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!DW.has(a)}const LW=new Set(["table","td","th"]);function OW(e){return LW.has(Rp(e))}const NW=[":popover-open",":modal"];function Bb(e){return NW.some(t=>{try{return e.matches(t)}catch{return!1}})}const PW=["transform","translate","scale","rotate","perspective"],IW=["transform","translate","scale","rotate","perspective","filter"],MW=["paint","layout","strict","content"];function SC(e){const t=CC(),n=Gs(e)?Ks(e):e;return PW.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||IW.some(r=>(n.willChange||"").includes(r))||MW.some(r=>(n.contain||"").includes(r))}function FW(e){let t=rd(e);for(;Bl(t)&&!Dp(t);){if(SC(t))return t;if(Bb(t))return null;t=rd(t)}return null}function CC(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const BW=new Set(["html","body","#document"]);function Dp(e){return BW.has(Rp(e))}function Ks(e){return Qo(e).getComputedStyle(e)}function Hb(e){return Gs(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function rd(e){if(Rp(e)==="html")return e;const t=e.assignedSlot||e.parentNode||pL(e)&&e.host||Fl(e);return pL(t)?t.host:t}function mL(e){const t=rd(e);return Dp(t)?e.ownerDocument?e.ownerDocument.body:e.body:Bl(t)&&V0(t)?t:mL(t)}function W0(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const a=mL(e),s=a===((r=e.ownerDocument)==null?void 0:r.body),l=Qo(a);if(s){const c=_C(l);return t.concat(l,l.visualViewport||[],V0(a)?a:[],c&&n?W0(c):[])}return t.concat(a,W0(a,[],n))}function _C(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function gL(e){const t=Ks(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const a=Bl(e),s=a?e.offsetWidth:n,l=a?e.offsetHeight:r,c=Nb(n)!==s||Nb(r)!==l;return c&&(n=s,r=l),{width:n,height:r,$:c}}function AC(e){return Gs(e)?e:e.contextElement}function Lp(e){const t=AC(e);if(!Bl(t))return Il(1);const n=t.getBoundingClientRect(),{width:r,height:a,$:s}=gL(t);let l=(s?Nb(n.width):n.width)/r,c=(s?Nb(n.height):n.height)/a;return(!l||!Number.isFinite(l))&&(l=1),(!c||!Number.isFinite(c))&&(c=1),{x:l,y:c}}const HW=Il(0);function vL(e){const t=Qo(e);return!CC()||!t.visualViewport?HW:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function UW(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Qo(e)?!1:t}function Nf(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const a=e.getBoundingClientRect(),s=AC(e);let l=Il(1);t&&(r?Gs(r)&&(l=Lp(r)):l=Lp(e));const c=UW(s,n,r)?vL(s):Il(0);let h=(a.left+c.x)/l.x,p=(a.top+c.y)/l.y,v=a.width/l.x,y=a.height/l.y;if(s){const w=Qo(s),T=r&&Gs(r)?Qo(r):r;let A=w,R=_C(A);for(;R&&r&&T!==A;){const N=Lp(R),O=R.getBoundingClientRect(),M=Ks(R),H=O.left+(R.clientLeft+parseFloat(M.paddingLeft))*N.x,V=O.top+(R.clientTop+parseFloat(M.paddingTop))*N.y;h*=N.x,p*=N.y,v*=N.x,y*=N.y,h+=H,p+=V,A=Qo(R),R=_C(A)}}return Mb({width:v,height:y,x:h,y:p})}function Ub(e,t){const n=Hb(e).scrollLeft;return t?t.left+n:Nf(Fl(e)).left+n}function yL(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Ub(e,n),a=n.top+t.scrollTop;return{x:r,y:a}}function zW(e){let{elements:t,rect:n,offsetParent:r,strategy:a}=e;const s=a==="fixed",l=Fl(r),c=t?Bb(t.floating):!1;if(r===l||c&&s)return n;let h={scrollLeft:0,scrollTop:0},p=Il(1);const v=Il(0),y=Bl(r);if((y||!y&&!s)&&((Rp(r)!=="body"||V0(l))&&(h=Hb(r)),Bl(r))){const T=Nf(r);p=Lp(r),v.x=T.x+r.clientLeft,v.y=T.y+r.clientTop}const w=l&&!y&&!s?yL(l,h):Il(0);return{width:n.width*p.x,height:n.height*p.y,x:n.x*p.x-h.scrollLeft*p.x+v.x+w.x,y:n.y*p.y-h.scrollTop*p.y+v.y+w.y}}function jW(e){return Array.from(e.getClientRects())}function VW(e){const t=Fl(e),n=Hb(e),r=e.ownerDocument.body,a=Ko(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=Ko(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let l=-n.scrollLeft+Ub(e);const c=-n.scrollTop;return Ks(r).direction==="rtl"&&(l+=Ko(t.clientWidth,r.clientWidth)-a),{width:a,height:s,x:l,y:c}}const bL=25;function WW(e,t){const n=Qo(e),r=Fl(e),a=n.visualViewport;let s=r.clientWidth,l=r.clientHeight,c=0,h=0;if(a){s=a.width,l=a.height;const v=CC();(!v||v&&t==="fixed")&&(c=a.offsetLeft,h=a.offsetTop)}const p=Ub(r);if(p<=0){const v=r.ownerDocument,y=v.body,w=getComputedStyle(y),T=v.compatMode==="CSS1Compat"&&parseFloat(w.marginLeft)+parseFloat(w.marginRight)||0,A=Math.abs(r.clientWidth-y.clientWidth-T);A<=bL&&(s-=A)}else p<=bL&&(s+=p);return{width:s,height:l,x:c,y:h}}const YW=new Set(["absolute","fixed"]);function qW(e,t){const n=Nf(e,!0,t==="fixed"),r=n.top+e.clientTop,a=n.left+e.clientLeft,s=Bl(e)?Lp(e):Il(1),l=e.clientWidth*s.x,c=e.clientHeight*s.y,h=a*s.x,p=r*s.y;return{width:l,height:c,x:h,y:p}}function EL(e,t,n){let r;if(t==="viewport")r=WW(e,n);else if(t==="document")r=VW(Fl(e));else if(Gs(t))r=qW(t,n);else{const a=vL(e);r={x:t.x-a.x,y:t.y-a.y,width:t.width,height:t.height}}return Mb(r)}function wL(e,t){const n=rd(e);return n===t||!Gs(n)||Dp(n)?!1:Ks(n).position==="fixed"||wL(n,t)}function GW(e,t){const n=t.get(e);if(n)return n;let r=W0(e,[],!1).filter(c=>Gs(c)&&Rp(c)!=="body"),a=null;const s=Ks(e).position==="fixed";let l=s?rd(e):e;for(;Gs(l)&&!Dp(l);){const c=Ks(l),h=SC(l);!h&&c.position==="fixed"&&(a=null),(s?!h&&!a:!h&&c.position==="static"&&!!a&&YW.has(a.position)||V0(l)&&!h&&wL(e,l))?r=r.filter(v=>v!==l):a=c,l=rd(l)}return t.set(e,r),r}function KW(e){let{element:t,boundary:n,rootBoundary:r,strategy:a}=e;const l=[...n==="clippingAncestors"?Bb(t)?[]:GW(t,this._c):[].concat(n),r],c=l[0],h=l.reduce((p,v)=>{const y=EL(t,v,a);return p.top=Ko(y.top,p.top),p.right=nd(y.right,p.right),p.bottom=nd(y.bottom,p.bottom),p.left=Ko(y.left,p.left),p},EL(t,c,a));return{width:h.right-h.left,height:h.bottom-h.top,x:h.left,y:h.top}}function QW(e){const{width:t,height:n}=gL(e);return{width:t,height:n}}function XW(e,t,n){const r=Bl(t),a=Fl(t),s=n==="fixed",l=Nf(e,!0,s,t);let c={scrollLeft:0,scrollTop:0};const h=Il(0);function p(){h.x=Ub(a)}if(r||!r&&!s)if((Rp(t)!=="body"||V0(a))&&(c=Hb(t)),r){const T=Nf(t,!0,s,t);h.x=T.x+t.clientLeft,h.y=T.y+t.clientTop}else a&&p();s&&!r&&a&&p();const v=a&&!r&&!s?yL(a,c):Il(0),y=l.left+c.scrollLeft-h.x-v.x,w=l.top+c.scrollTop-h.y-v.y;return{x:y,y:w,width:l.width,height:l.height}}function kC(e){return Ks(e).position==="static"}function xL(e,t){if(!Bl(e)||Ks(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Fl(e)===n&&(n=n.ownerDocument.body),n}function TL(e,t){const n=Qo(e);if(Bb(e))return n;if(!Bl(e)){let a=rd(e);for(;a&&!Dp(a);){if(Gs(a)&&!kC(a))return a;a=rd(a)}return n}let r=xL(e,t);for(;r&&OW(r)&&kC(r);)r=xL(r,t);return r&&Dp(r)&&kC(r)&&!SC(r)?n:r||FW(e)||n}const ZW=async function(e){const t=this.getOffsetParent||TL,n=this.getDimensions,r=await n(e.floating);return{reference:XW(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function JW(e){return Ks(e).direction==="rtl"}const $W={convertOffsetParentRelativeRectToViewportRelativeRect:zW,getDocumentElement:Fl,getClippingRect:KW,getOffsetParent:TL,getElementRects:ZW,getClientRects:jW,getDimensions:QW,getScale:Lp,isElement:Gs,isRTL:JW};function SL(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function eY(e,t){let n=null,r;const a=Fl(e);function s(){var c;clearTimeout(r),(c=n)==null||c.disconnect(),n=null}function l(c,h){c===void 0&&(c=!1),h===void 0&&(h=1),s();const p=e.getBoundingClientRect(),{left:v,top:y,width:w,height:T}=p;if(c||t(),!w||!T)return;const A=Pb(y),R=Pb(a.clientWidth-(v+w)),N=Pb(a.clientHeight-(y+T)),O=Pb(v),H={rootMargin:-A+"px "+-R+"px "+-N+"px "+-O+"px",threshold:Ko(0,nd(1,h))||1};let V=!0;function K(Y){const Z=Y[0].intersectionRatio;if(Z!==h){if(!V)return l();Z?l(!1,Z):r=setTimeout(()=>{l(!1,1e-7)},1e3)}Z===1&&!SL(p,e.getBoundingClientRect())&&l(),V=!1}try{n=new IntersectionObserver(K,{...H,root:a.ownerDocument})}catch{n=new IntersectionObserver(K,H)}n.observe(e)}return l(!0),s}function tY(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:a=!0,ancestorResize:s=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:h=!1}=r,p=AC(e),v=a||s?[...p?W0(p):[],...W0(t)]:[];v.forEach(O=>{a&&O.addEventListener("scroll",n,{passive:!0}),s&&O.addEventListener("resize",n)});const y=p&&c?eY(p,n):null;let w=-1,T=null;l&&(T=new ResizeObserver(O=>{let[M]=O;M&&M.target===p&&T&&(T.unobserve(t),cancelAnimationFrame(w),w=requestAnimationFrame(()=>{var H;(H=T)==null||H.observe(t)})),n()}),p&&!h&&T.observe(p),T.observe(t));let A,R=h?Nf(e):null;h&&N();function N(){const O=Nf(e);R&&!SL(R,O)&&n(),R=O,A=requestAnimationFrame(N)}return n(),()=>{var O;v.forEach(M=>{a&&M.removeEventListener("scroll",n),s&&M.removeEventListener("resize",n)}),y?.(),(O=T)==null||O.disconnect(),T=null,h&&cancelAnimationFrame(A)}}const nY=_W,rY=AW,iY=TW,aY=RW,oY=SW,CL=xW,sY=kW,lY=(e,t,n)=>{const r=new Map,a={platform:$W,...n},s={...a.platform,_c:r};return wW(e,t,{...a,platform:s})};var uY=typeof document<"u",cY=function(){},zb=uY?_.useLayoutEffect:cY;function jb(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,a;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!jb(e[r],t[r]))return!1;return!0}if(a=Object.keys(e),n=a.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,a[r]))return!1;for(r=n;r--!==0;){const s=a[r];if(!(s==="_owner"&&e.$$typeof)&&!jb(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function _L(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function AL(e,t){const n=_L(e);return Math.round(t*n)/n}function RC(e){const t=_.useRef(e);return zb(()=>{t.current=e}),t}function dY(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:a,elements:{reference:s,floating:l}={},transform:c=!0,whileElementsMounted:h,open:p}=e,[v,y]=_.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[w,T]=_.useState(r);jb(w,r)||T(r);const[A,R]=_.useState(null),[N,O]=_.useState(null),M=_.useCallback(se=>{se!==Y.current&&(Y.current=se,R(se))},[]),H=_.useCallback(se=>{se!==Z.current&&(Z.current=se,O(se))},[]),V=s||A,K=l||N,Y=_.useRef(null),Z=_.useRef(null),X=_.useRef(v),ce=h!=null,W=RC(h),me=RC(a),oe=RC(p),te=_.useCallback(()=>{if(!Y.current||!Z.current)return;const se={placement:t,strategy:n,middleware:w};me.current&&(se.platform=me.current),lY(Y.current,Z.current,se).then(De=>{const U={...De,isPositioned:oe.current!==!1};le.current&&!jb(X.current,U)&&(X.current=U,Lb.flushSync(()=>{y(U)}))})},[w,t,n,me,oe]);zb(()=>{p===!1&&X.current.isPositioned&&(X.current.isPositioned=!1,y(se=>({...se,isPositioned:!1})))},[p]);const le=_.useRef(!1);zb(()=>(le.current=!0,()=>{le.current=!1}),[]),zb(()=>{if(V&&(Y.current=V),K&&(Z.current=K),V&&K){if(W.current)return W.current(V,K,te);te()}},[V,K,te,W,ce]);const Ae=_.useMemo(()=>({reference:Y,floating:Z,setReference:M,setFloating:H}),[M,H]),_e=_.useMemo(()=>({reference:V,floating:K}),[V,K]),ve=_.useMemo(()=>{const se={position:n,left:0,top:0};if(!_e.floating)return se;const De=AL(_e.floating,v.x),U=AL(_e.floating,v.y);return c?{...se,transform:"translate("+De+"px, "+U+"px)",..._L(_e.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:De,top:U}},[n,c,_e.floating,v.x,v.y]);return _.useMemo(()=>({...v,update:te,refs:Ae,elements:_e,floatingStyles:ve}),[v,te,Ae,_e,ve])}const fY=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:a}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?CL({element:r.current,padding:a}).fn(n):{}:r?CL({element:r,padding:a}).fn(n):{}}}},hY=(e,t)=>({...nY(e),options:[e,t]}),pY=(e,t)=>({...rY(e),options:[e,t]}),mY=(e,t)=>({...sY(e),options:[e,t]}),gY=(e,t)=>({...iY(e),options:[e,t]}),vY=(e,t)=>({...aY(e),options:[e,t]}),yY=(e,t)=>({...oY(e),options:[e,t]}),bY=(e,t)=>({...fY(e),options:[e,t]});var EY="Arrow",kL=_.forwardRef((e,t)=>{const{children:n,width:r=10,height:a=5,...s}=e;return F.jsx(Co.svg,{...s,ref:t,width:r,height:a,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:F.jsx("polygon",{points:"0,0 30,0 15,10"})})});kL.displayName=EY;var wY=kL;function xY(e){const[t,n]=_.useState(void 0);return td(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(a=>{if(!Array.isArray(a)||!a.length)return;const s=a[0];let l,c;if("borderBoxSize"in s){const h=s.borderBoxSize,p=Array.isArray(h)?h[0]:h;l=p.inlineSize,c=p.blockSize}else l=e.offsetWidth,c=e.offsetHeight;n({width:l,height:c})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var DC="Popper",[RL,DL]=gC(DC),[TY,LL]=RL(DC),OL=e=>{const{__scopePopper:t,children:n}=e,[r,a]=_.useState(null);return F.jsx(TY,{scope:t,anchor:r,onAnchorChange:a,children:n})};OL.displayName=DC;var NL="PopperAnchor",PL=_.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...a}=e,s=LL(NL,n),l=_.useRef(null),c=qs(t,l),h=_.useRef(null);return _.useEffect(()=>{const p=h.current;h.current=r?.current||l.current,p!==h.current&&s.onAnchorChange(h.current)}),r?null:F.jsx(Co.div,{...a,ref:c})});PL.displayName=NL;var LC="PopperContent",[SY,CY]=RL(LC),IL=_.forwardRef((e,t)=>{const{__scopePopper:n,side:r="bottom",sideOffset:a=0,align:s="center",alignOffset:l=0,arrowPadding:c=0,avoidCollisions:h=!0,collisionBoundary:p=[],collisionPadding:v=0,sticky:y="partial",hideWhenDetached:w=!1,updatePositionStrategy:T="optimized",onPlaced:A,...R}=e,N=LL(LC,n),[O,M]=_.useState(null),H=qs(t,St=>M(St)),[V,K]=_.useState(null),Y=xY(V),Z=Y?.width??0,X=Y?.height??0,ce=r+(s!=="center"?"-"+s:""),W=typeof v=="number"?v:{top:0,right:0,bottom:0,left:0,...v},me=Array.isArray(p)?p:[p],oe=me.length>0,te={padding:W,boundary:me.filter(AY),altBoundary:oe},{refs:le,floatingStyles:Ae,placement:_e,isPositioned:ve,middlewareData:se}=dY({strategy:"fixed",placement:ce,whileElementsMounted:(...St)=>tY(...St,{animationFrame:T==="always"}),elements:{reference:N.anchor},middleware:[hY({mainAxis:a+X,alignmentAxis:l}),h&&pY({mainAxis:!0,crossAxis:!1,limiter:y==="partial"?mY():void 0,...te}),h&&gY({...te}),vY({...te,apply:({elements:St,rects:qe,availableWidth:Rt,availableHeight:_t})=>{const{width:Zt,height:pn}=qe.reference,xn=St.floating.style;xn.setProperty("--radix-popper-available-width",`${Rt}px`),xn.setProperty("--radix-popper-available-height",`${_t}px`),xn.setProperty("--radix-popper-anchor-width",`${Zt}px`),xn.setProperty("--radix-popper-anchor-height",`${pn}px`)}}),V&&bY({element:V,padding:c}),kY({arrowWidth:Z,arrowHeight:X}),w&&yY({strategy:"referenceHidden",...te})]}),[De,U]=BL(_e),$=Ap(A);td(()=>{ve&&$?.()},[ve,$]);const be=se.arrow?.x,j=se.arrow?.y,Ue=se.arrow?.centerOffset!==0,[Ke,Qe]=_.useState();return td(()=>{O&&Qe(window.getComputedStyle(O).zIndex)},[O]),F.jsx("div",{ref:le.setFloating,"data-radix-popper-content-wrapper":"",style:{...Ae,transform:ve?Ae.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Ke,"--radix-popper-transform-origin":[se.transformOrigin?.x,se.transformOrigin?.y].join(" "),...se.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:F.jsx(SY,{scope:n,placedSide:De,onArrowChange:K,arrowX:be,arrowY:j,shouldHideArrow:Ue,children:F.jsx(Co.div,{"data-side":De,"data-align":U,...R,ref:H,style:{...R.style,animation:ve?void 0:"none"}})})})});IL.displayName=LC;var ML="PopperArrow",_Y={top:"bottom",right:"left",bottom:"top",left:"right"},FL=_.forwardRef(function(t,n){const{__scopePopper:r,...a}=t,s=CY(ML,r),l=_Y[s.placedSide];return F.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[l]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:F.jsx(wY,{...a,ref:n,style:{...a.style,display:"block"}})})});FL.displayName=ML;function AY(e){return e!==null}var kY=e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:r,middlewareData:a}=t,l=a.arrow?.centerOffset!==0,c=l?0:e.arrowWidth,h=l?0:e.arrowHeight,[p,v]=BL(n),y={start:"0%",center:"50%",end:"100%"}[v],w=(a.arrow?.x??0)+c/2,T=(a.arrow?.y??0)+h/2;let A="",R="";return p==="bottom"?(A=l?y:`${w}px`,R=`${-h}px`):p==="top"?(A=l?y:`${w}px`,R=`${r.floating.height+h}px`):p==="right"?(A=`${-h}px`,R=l?y:`${T}px`):p==="left"&&(A=`${r.floating.width+h}px`,R=l?y:`${T}px`),{data:{x:A,y:R}}}});function BL(e){const[t,n="center"]=e.split("-");return[t,n]}var RY=OL,DY=PL,LY=IL,OY=FL,NY="Portal",OC=_.forwardRef((e,t)=>{const{container:n,...r}=e,[a,s]=_.useState(!1);td(()=>s(!0),[]);const l=n||a&&globalThis?.document?.body;return l?$6.createPortal(F.jsx(Co.div,{...r,ref:t}),l):null});OC.displayName=NY;function PY(e,t){return _.useReducer((n,r)=>t[n][r]??n,e)}var Op=e=>{const{present:t,children:n}=e,r=IY(t),a=typeof n=="function"?n({present:r.isPresent}):_.Children.only(n),s=qs(r.ref,MY(a));return typeof n=="function"||r.isPresent?_.cloneElement(a,{ref:s}):null};Op.displayName="Presence";function IY(e){const[t,n]=_.useState(),r=_.useRef(null),a=_.useRef(e),s=_.useRef("none"),l=e?"mounted":"unmounted",[c,h]=PY(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return _.useEffect(()=>{const p=Vb(r.current);s.current=c==="mounted"?p:"none"},[c]),td(()=>{const p=r.current,v=a.current;if(v!==e){const w=s.current,T=Vb(p);e?h("MOUNT"):T==="none"||p?.display==="none"?h("UNMOUNT"):h(v&&w!==T?"ANIMATION_OUT":"UNMOUNT"),a.current=e}},[e,h]),td(()=>{if(t){let p;const v=t.ownerDocument.defaultView??window,y=T=>{const R=Vb(r.current).includes(CSS.escape(T.animationName));if(T.target===t&&R&&(h("ANIMATION_END"),!a.current)){const N=t.style.animationFillMode;t.style.animationFillMode="forwards",p=v.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=N)})}},w=T=>{T.target===t&&(s.current=Vb(r.current))};return t.addEventListener("animationstart",w),t.addEventListener("animationcancel",y),t.addEventListener("animationend",y),()=>{v.clearTimeout(p),t.removeEventListener("animationstart",w),t.removeEventListener("animationcancel",y),t.removeEventListener("animationend",y)}}else h("ANIMATION_END")},[t,h]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:_.useCallback(p=>{r.current=p?getComputedStyle(p):null,n(p)},[])}}function Vb(e){return e?.animationName||"none"}function MY(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var FY=hS[" useInsertionEffect ".trim().toString()]||td;function HL({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[a,s,l]=BY({defaultProp:t,onChange:n}),c=e!==void 0,h=c?e:a;{const v=_.useRef(e!==void 0);_.useEffect(()=>{const y=v.current;y!==c&&console.warn(`${r} is changing from ${y?"controlled":"uncontrolled"} to ${c?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),v.current=c},[c,r])}const p=_.useCallback(v=>{if(c){const y=HY(v)?v(e):v;y!==e&&l.current?.(y)}else s(v)},[c,e,s,l]);return[h,p]}function BY({defaultProp:e,onChange:t}){const[n,r]=_.useState(e),a=_.useRef(n),s=_.useRef(t);return FY(()=>{s.current=t},[t]),_.useEffect(()=>{a.current!==n&&(s.current?.(n),a.current=n)},[n,a]),[n,r,s]}function HY(e){return typeof e=="function"}var UY=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),zY="VisuallyHidden",UL=_.forwardRef((e,t)=>F.jsx(Co.span,{...e,ref:t,style:{...UY,...e.style}}));UL.displayName=zY;var jY=UL,[Wb]=gC("Tooltip",[DL]),Yb=DL(),zL="TooltipProvider",VY=700,NC="tooltip.open",[WY,PC]=Wb(zL),jL=e=>{const{__scopeTooltip:t,delayDuration:n=VY,skipDelayDuration:r=300,disableHoverableContent:a=!1,children:s}=e,l=_.useRef(!0),c=_.useRef(!1),h=_.useRef(0);return _.useEffect(()=>{const p=h.current;return()=>window.clearTimeout(p)},[]),F.jsx(WY,{scope:t,isOpenDelayedRef:l,delayDuration:n,onOpen:_.useCallback(()=>{window.clearTimeout(h.current),l.current=!1},[]),onClose:_.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>l.current=!0,r)},[r]),isPointerInTransitRef:c,onPointerInTransitChange:_.useCallback(p=>{c.current=p},[]),disableHoverableContent:a,children:s})};jL.displayName=zL;var Y0="Tooltip",[YY,q0]=Wb(Y0),VL=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:a,onOpenChange:s,disableHoverableContent:l,delayDuration:c}=e,h=PC(Y0,e.__scopeTooltip),p=Yb(t),[v,y]=_.useState(null),w=Ob(),T=_.useRef(0),A=l??h.disableHoverableContent,R=c??h.delayDuration,N=_.useRef(!1),[O,M]=HL({prop:r,defaultProp:a??!1,onChange:Z=>{Z?(h.onOpen(),document.dispatchEvent(new CustomEvent(NC))):h.onClose(),s?.(Z)},caller:Y0}),H=_.useMemo(()=>O?N.current?"delayed-open":"instant-open":"closed",[O]),V=_.useCallback(()=>{window.clearTimeout(T.current),T.current=0,N.current=!1,M(!0)},[M]),K=_.useCallback(()=>{window.clearTimeout(T.current),T.current=0,M(!1)},[M]),Y=_.useCallback(()=>{window.clearTimeout(T.current),T.current=window.setTimeout(()=>{N.current=!0,M(!0),T.current=0},R)},[R,M]);return _.useEffect(()=>()=>{T.current&&(window.clearTimeout(T.current),T.current=0)},[]),F.jsx(RY,{...p,children:F.jsx(YY,{scope:t,contentId:w,open:O,stateAttribute:H,trigger:v,onTriggerChange:y,onTriggerEnter:_.useCallback(()=>{h.isOpenDelayedRef.current?Y():V()},[h.isOpenDelayedRef,Y,V]),onTriggerLeave:_.useCallback(()=>{A?K():(window.clearTimeout(T.current),T.current=0)},[K,A]),onOpen:V,onClose:K,disableHoverableContent:A,children:n})})};VL.displayName=Y0;var IC="TooltipTrigger",WL=_.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,a=q0(IC,n),s=PC(IC,n),l=Yb(n),c=_.useRef(null),h=qs(t,c,a.onTriggerChange),p=_.useRef(!1),v=_.useRef(!1),y=_.useCallback(()=>p.current=!1,[]);return _.useEffect(()=>()=>document.removeEventListener("pointerup",y),[y]),F.jsx(DY,{asChild:!0,...l,children:F.jsx(Co.button,{"aria-describedby":a.open?a.contentId:void 0,"data-state":a.stateAttribute,...r,ref:h,onPointerMove:So(e.onPointerMove,w=>{w.pointerType!=="touch"&&!v.current&&!s.isPointerInTransitRef.current&&(a.onTriggerEnter(),v.current=!0)}),onPointerLeave:So(e.onPointerLeave,()=>{a.onTriggerLeave(),v.current=!1}),onPointerDown:So(e.onPointerDown,()=>{a.open&&a.onClose(),p.current=!0,document.addEventListener("pointerup",y,{once:!0})}),onFocus:So(e.onFocus,()=>{p.current||a.onOpen()}),onBlur:So(e.onBlur,a.onClose),onClick:So(e.onClick,a.onClose)})})});WL.displayName=IC;var MC="TooltipPortal",[qY,GY]=Wb(MC,{forceMount:void 0}),YL=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:a}=e,s=q0(MC,t);return F.jsx(qY,{scope:t,forceMount:n,children:F.jsx(Op,{present:n||s.open,children:F.jsx(OC,{asChild:!0,container:a,children:r})})})};YL.displayName=MC;var Np="TooltipContent",qL=_.forwardRef((e,t)=>{const n=GY(Np,e.__scopeTooltip),{forceMount:r=n.forceMount,side:a="top",...s}=e,l=q0(Np,e.__scopeTooltip);return F.jsx(Op,{present:r||l.open,children:l.disableHoverableContent?F.jsx(GL,{side:a,...s,ref:t}):F.jsx(KY,{side:a,...s,ref:t})})}),KY=_.forwardRef((e,t)=>{const n=q0(Np,e.__scopeTooltip),r=PC(Np,e.__scopeTooltip),a=_.useRef(null),s=qs(t,a),[l,c]=_.useState(null),{trigger:h,onClose:p}=n,v=a.current,{onPointerInTransitChange:y}=r,w=_.useCallback(()=>{c(null),y(!1)},[y]),T=_.useCallback((A,R)=>{const N=A.currentTarget,O={x:A.clientX,y:A.clientY},M=$Y(O,N.getBoundingClientRect()),H=eq(O,M),V=tq(R.getBoundingClientRect()),K=rq([...H,...V]);c(K),y(!0)},[y]);return _.useEffect(()=>()=>w(),[w]),_.useEffect(()=>{if(h&&v){const A=N=>T(N,v),R=N=>T(N,h);return h.addEventListener("pointerleave",A),v.addEventListener("pointerleave",R),()=>{h.removeEventListener("pointerleave",A),v.removeEventListener("pointerleave",R)}}},[h,v,T,w]),_.useEffect(()=>{if(l){const A=R=>{const N=R.target,O={x:R.clientX,y:R.clientY},M=h?.contains(N)||v?.contains(N),H=!nq(O,l);M?w():H&&(w(),p())};return document.addEventListener("pointermove",A),()=>document.removeEventListener("pointermove",A)}},[h,v,l,p,w]),F.jsx(GL,{...e,ref:s})}),[QY,XY]=Wb(Y0,{isInside:!1}),ZY=KV("TooltipContent"),GL=_.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":a,onEscapeKeyDown:s,onPointerDownOutside:l,...c}=e,h=q0(Np,n),p=Yb(n),{onClose:v}=h;return _.useEffect(()=>(document.addEventListener(NC,v),()=>document.removeEventListener(NC,v)),[v]),_.useEffect(()=>{if(h.trigger){const y=w=>{w.target?.contains(h.trigger)&&v()};return window.addEventListener("scroll",y,{capture:!0}),()=>window.removeEventListener("scroll",y,{capture:!0})}},[h.trigger,v]),F.jsx(yC,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:l,onFocusOutside:y=>y.preventDefault(),onDismiss:v,children:F.jsxs(LY,{"data-state":h.stateAttribute,...p,...c,ref:t,style:{...c.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[F.jsx(ZY,{children:r}),F.jsx(QY,{scope:n,isInside:!0,children:F.jsx(jY,{id:h.contentId,role:"tooltip",children:a||r})})]})})});qL.displayName=Np;var KL="TooltipArrow",JY=_.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,a=Yb(n);return XY(KL,n).isInside?null:F.jsx(OY,{...a,...r,ref:t})});JY.displayName=KL;function $Y(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),a=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(n,r,a,s)){case s:return"left";case a:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function eq(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function tq(e){const{top:t,right:n,bottom:r,left:a}=e;return[{x:a,y:t},{x:n,y:t},{x:n,y:r},{x:a,y:r}]}function nq(e,t){const{x:n,y:r}=e;let a=!1;for(let s=0,l=t.length-1;s<t.length;l=s++){const c=t[s],h=t[l],p=c.x,v=c.y,y=h.x,w=h.y;v>r!=w>r&&n<(y-p)*(r-v)/(w-v)+p&&(a=!a)}return a}function rq(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),iq(t)}function iq(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const a=e[r];for(;t.length>=2;){const s=t[t.length-1],l=t[t.length-2];if((s.x-l.x)*(a.y-l.y)>=(s.y-l.y)*(a.x-l.x))t.pop();else break}t.push(a)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const a=e[r];for(;n.length>=2;){const s=n[n.length-1],l=n[n.length-2];if((s.x-l.x)*(a.y-l.y)>=(s.y-l.y)*(a.x-l.x))n.pop();else break}n.push(a)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var aq=jL,oq=VL,sq=WL,lq=YL,FC=qL;function QL(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(n=QL(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function hi(){for(var e,t,n=0,r="",a=arguments.length;n<a;n++)(e=arguments[n])&&(t=QL(e))&&(r&&(r+=" "),r+=t);return r}const BC="-",uq=e=>{const t=dq(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:l=>{const c=l.split(BC);return c[0]===""&&c.length!==1&&c.shift(),XL(c,t)||cq(l)},getConflictingClassGroupIds:(l,c)=>{const h=n[l]||[];return c&&r[l]?[...h,...r[l]]:h}}},XL=(e,t)=>{if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),a=r?XL(e.slice(1),r):void 0;if(a)return a;if(t.validators.length===0)return;const s=e.join(BC);return t.validators.find(({validator:l})=>l(s))?.classGroupId},ZL=/^\[(.+)\]$/,cq=e=>{if(ZL.test(e)){const t=ZL.exec(e)[1],n=t?.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},dq=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return hq(Object.entries(e.classGroups),n).forEach(([s,l])=>{HC(l,r,s,t)}),r},HC=(e,t,n,r)=>{e.forEach(a=>{if(typeof a=="string"){const s=a===""?t:JL(t,a);s.classGroupId=n;return}if(typeof a=="function"){if(fq(a)){HC(a(r),t,n,r);return}t.validators.push({validator:a,classGroupId:n});return}Object.entries(a).forEach(([s,l])=>{HC(l,JL(t,s),n,r)})})},JL=(e,t)=>{let n=e;return t.split(BC).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},fq=e=>e.isThemeGetter,hq=(e,t)=>t?e.map(([n,r])=>{const a=r.map(s=>typeof s=="string"?t+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([l,c])=>[t+l,c])):s);return[n,a]}):e,pq=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const a=(s,l)=>{n.set(s,l),t++,t>e&&(t=0,r=n,n=new Map)};return{get(s){let l=n.get(s);if(l!==void 0)return l;if((l=r.get(s))!==void 0)return a(s,l),l},set(s,l){n.has(s)?n.set(s,l):a(s,l)}}},$L="!",mq=e=>{const{separator:t,experimentalParseClassName:n}=e,r=t.length===1,a=t[0],s=t.length,l=c=>{const h=[];let p=0,v=0,y;for(let N=0;N<c.length;N++){let O=c[N];if(p===0){if(O===a&&(r||c.slice(N,N+s)===t)){h.push(c.slice(v,N)),v=N+s;continue}if(O==="/"){y=N;continue}}O==="["?p++:O==="]"&&p--}const w=h.length===0?c:c.substring(v),T=w.startsWith($L),A=T?w.substring(1):w,R=y&&y>v?y-v:void 0;return{modifiers:h,hasImportantModifier:T,baseClassName:A,maybePostfixModifierPosition:R}};return n?c=>n({className:c,parseClassName:l}):l},gq=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r)}),t.push(...n.sort()),t},vq=e=>({cache:pq(e.cacheSize),parseClassName:mq(e),...uq(e)}),yq=/\s+/,bq=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:a}=t,s=[],l=e.trim().split(yq);let c="";for(let h=l.length-1;h>=0;h-=1){const p=l[h],{modifiers:v,hasImportantModifier:y,baseClassName:w,maybePostfixModifierPosition:T}=n(p);let A=!!T,R=r(A?w.substring(0,T):w);if(!R){if(!A){c=p+(c.length>0?" "+c:c);continue}if(R=r(w),!R){c=p+(c.length>0?" "+c:c);continue}A=!1}const N=gq(v).join(":"),O=y?N+$L:N,M=O+R;if(s.includes(M))continue;s.push(M);const H=a(R,A);for(let V=0;V<H.length;++V){const K=H[V];s.push(O+K)}c=p+(c.length>0?" "+c:c)}return c};function Eq(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=eO(t))&&(r&&(r+=" "),r+=n);return r}const eO=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=eO(e[r]))&&(n&&(n+=" "),n+=t);return n};function wq(e,...t){let n,r,a,s=l;function l(h){const p=t.reduce((v,y)=>y(v),e());return n=vq(p),r=n.cache.get,a=n.cache.set,s=c,c(h)}function c(h){const p=r(h);if(p)return p;const v=bq(h,n);return a(h,v),v}return function(){return s(Eq.apply(null,arguments))}}const Ir=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},tO=/^\[(?:([a-z-]+):)?(.+)\]$/i,xq=/^\d+\/\d+$/,Tq=new Set(["px","full","screen"]),Sq=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Cq=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,_q=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,Aq=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,kq=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ku=e=>Pp(e)||Tq.has(e)||xq.test(e),id=e=>Ip(e,"length",Mq),Pp=e=>!!e&&!Number.isNaN(Number(e)),UC=e=>Ip(e,"number",Pp),G0=e=>!!e&&Number.isInteger(Number(e)),Rq=e=>e.endsWith("%")&&Pp(e.slice(0,-1)),wn=e=>tO.test(e),ad=e=>Sq.test(e),Dq=new Set(["length","size","percentage"]),Lq=e=>Ip(e,Dq,nO),Oq=e=>Ip(e,"position",nO),Nq=new Set(["image","url"]),Pq=e=>Ip(e,Nq,Bq),Iq=e=>Ip(e,"",Fq),K0=()=>!0,Ip=(e,t,n)=>{const r=tO.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},Mq=e=>Cq.test(e)&&!_q.test(e),nO=()=>!1,Fq=e=>Aq.test(e),Bq=e=>kq.test(e),Hq=wq(()=>{const e=Ir("colors"),t=Ir("spacing"),n=Ir("blur"),r=Ir("brightness"),a=Ir("borderColor"),s=Ir("borderRadius"),l=Ir("borderSpacing"),c=Ir("borderWidth"),h=Ir("contrast"),p=Ir("grayscale"),v=Ir("hueRotate"),y=Ir("invert"),w=Ir("gap"),T=Ir("gradientColorStops"),A=Ir("gradientColorStopPositions"),R=Ir("inset"),N=Ir("margin"),O=Ir("opacity"),M=Ir("padding"),H=Ir("saturate"),V=Ir("scale"),K=Ir("sepia"),Y=Ir("skew"),Z=Ir("space"),X=Ir("translate"),ce=()=>["auto","contain","none"],W=()=>["auto","hidden","clip","visible","scroll"],me=()=>["auto",wn,t],oe=()=>[wn,t],te=()=>["",Ku,id],le=()=>["auto",Pp,wn],Ae=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],_e=()=>["solid","dashed","dotted","double","none"],ve=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],se=()=>["start","end","center","between","around","evenly","stretch"],De=()=>["","0",wn],U=()=>["auto","avoid","all","avoid-page","page","left","right","column"],$=()=>[Pp,wn];return{cacheSize:500,separator:":",theme:{colors:[K0],spacing:[Ku,id],blur:["none","",ad,wn],brightness:$(),borderColor:[e],borderRadius:["none","","full",ad,wn],borderSpacing:oe(),borderWidth:te(),contrast:$(),grayscale:De(),hueRotate:$(),invert:De(),gap:oe(),gradientColorStops:[e],gradientColorStopPositions:[Rq,id],inset:me(),margin:me(),opacity:$(),padding:oe(),saturate:$(),scale:$(),sepia:De(),skew:$(),space:oe(),translate:oe()},classGroups:{aspect:[{aspect:["auto","square","video",wn]}],container:["container"],columns:[{columns:[ad]}],"break-after":[{"break-after":U()}],"break-before":[{"break-before":U()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...Ae(),wn]}],overflow:[{overflow:W()}],"overflow-x":[{"overflow-x":W()}],"overflow-y":[{"overflow-y":W()}],overscroll:[{overscroll:ce()}],"overscroll-x":[{"overscroll-x":ce()}],"overscroll-y":[{"overscroll-y":ce()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[R]}],"inset-x":[{"inset-x":[R]}],"inset-y":[{"inset-y":[R]}],start:[{start:[R]}],end:[{end:[R]}],top:[{top:[R]}],right:[{right:[R]}],bottom:[{bottom:[R]}],left:[{left:[R]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",G0,wn]}],basis:[{basis:me()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",wn]}],grow:[{grow:De()}],shrink:[{shrink:De()}],order:[{order:["first","last","none",G0,wn]}],"grid-cols":[{"grid-cols":[K0]}],"col-start-end":[{col:["auto",{span:["full",G0,wn]},wn]}],"col-start":[{"col-start":le()}],"col-end":[{"col-end":le()}],"grid-rows":[{"grid-rows":[K0]}],"row-start-end":[{row:["auto",{span:[G0,wn]},wn]}],"row-start":[{"row-start":le()}],"row-end":[{"row-end":le()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",wn]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",wn]}],gap:[{gap:[w]}],"gap-x":[{"gap-x":[w]}],"gap-y":[{"gap-y":[w]}],"justify-content":[{justify:["normal",...se()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...se(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...se(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[M]}],px:[{px:[M]}],py:[{py:[M]}],ps:[{ps:[M]}],pe:[{pe:[M]}],pt:[{pt:[M]}],pr:[{pr:[M]}],pb:[{pb:[M]}],pl:[{pl:[M]}],m:[{m:[N]}],mx:[{mx:[N]}],my:[{my:[N]}],ms:[{ms:[N]}],me:[{me:[N]}],mt:[{mt:[N]}],mr:[{mr:[N]}],mb:[{mb:[N]}],ml:[{ml:[N]}],"space-x":[{"space-x":[Z]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[Z]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",wn,t]}],"min-w":[{"min-w":[wn,t,"min","max","fit"]}],"max-w":[{"max-w":[wn,t,"none","full","min","max","fit","prose",{screen:[ad]},ad]}],h:[{h:[wn,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[wn,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[wn,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[wn,t,"auto","min","max","fit"]}],"font-size":[{text:["base",ad,id]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",UC]}],"font-family":[{font:[K0]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",wn]}],"line-clamp":[{"line-clamp":["none",Pp,UC]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Ku,wn]}],"list-image":[{"list-image":["none",wn]}],"list-style-type":[{list:["none","disc","decimal",wn]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[O]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[O]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[..._e(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Ku,id]}],"underline-offset":[{"underline-offset":["auto",Ku,wn]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:oe()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",wn]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",wn]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[O]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...Ae(),Oq]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",Lq]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},Pq]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[A]}],"gradient-via-pos":[{via:[A]}],"gradient-to-pos":[{to:[A]}],"gradient-from":[{from:[T]}],"gradient-via":[{via:[T]}],"gradient-to":[{to:[T]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[c]}],"border-w-x":[{"border-x":[c]}],"border-w-y":[{"border-y":[c]}],"border-w-s":[{"border-s":[c]}],"border-w-e":[{"border-e":[c]}],"border-w-t":[{"border-t":[c]}],"border-w-r":[{"border-r":[c]}],"border-w-b":[{"border-b":[c]}],"border-w-l":[{"border-l":[c]}],"border-opacity":[{"border-opacity":[O]}],"border-style":[{border:[..._e(),"hidden"]}],"divide-x":[{"divide-x":[c]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[c]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[O]}],"divide-style":[{divide:_e()}],"border-color":[{border:[a]}],"border-color-x":[{"border-x":[a]}],"border-color-y":[{"border-y":[a]}],"border-color-s":[{"border-s":[a]}],"border-color-e":[{"border-e":[a]}],"border-color-t":[{"border-t":[a]}],"border-color-r":[{"border-r":[a]}],"border-color-b":[{"border-b":[a]}],"border-color-l":[{"border-l":[a]}],"divide-color":[{divide:[a]}],"outline-style":[{outline:["",..._e()]}],"outline-offset":[{"outline-offset":[Ku,wn]}],"outline-w":[{outline:[Ku,id]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:te()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[O]}],"ring-offset-w":[{"ring-offset":[Ku,id]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",ad,Iq]}],"shadow-color":[{shadow:[K0]}],opacity:[{opacity:[O]}],"mix-blend":[{"mix-blend":[...ve(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":ve()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[h]}],"drop-shadow":[{"drop-shadow":["","none",ad,wn]}],grayscale:[{grayscale:[p]}],"hue-rotate":[{"hue-rotate":[v]}],invert:[{invert:[y]}],saturate:[{saturate:[H]}],sepia:[{sepia:[K]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[h]}],"backdrop-grayscale":[{"backdrop-grayscale":[p]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[v]}],"backdrop-invert":[{"backdrop-invert":[y]}],"backdrop-opacity":[{"backdrop-opacity":[O]}],"backdrop-saturate":[{"backdrop-saturate":[H]}],"backdrop-sepia":[{"backdrop-sepia":[K]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[l]}],"border-spacing-x":[{"border-spacing-x":[l]}],"border-spacing-y":[{"border-spacing-y":[l]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",wn]}],duration:[{duration:$()}],ease:[{ease:["linear","in","out","in-out",wn]}],delay:[{delay:$()}],animate:[{animate:["none","spin","ping","pulse","bounce",wn]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[V]}],"scale-x":[{"scale-x":[V]}],"scale-y":[{"scale-y":[V]}],rotate:[{rotate:[G0,wn]}],"translate-x":[{"translate-x":[X]}],"translate-y":[{"translate-y":[X]}],"skew-x":[{"skew-x":[Y]}],"skew-y":[{"skew-y":[Y]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",wn]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",wn]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":oe()}],"scroll-mx":[{"scroll-mx":oe()}],"scroll-my":[{"scroll-my":oe()}],"scroll-ms":[{"scroll-ms":oe()}],"scroll-me":[{"scroll-me":oe()}],"scroll-mt":[{"scroll-mt":oe()}],"scroll-mr":[{"scroll-mr":oe()}],"scroll-mb":[{"scroll-mb":oe()}],"scroll-ml":[{"scroll-ml":oe()}],"scroll-p":[{"scroll-p":oe()}],"scroll-px":[{"scroll-px":oe()}],"scroll-py":[{"scroll-py":oe()}],"scroll-ps":[{"scroll-ps":oe()}],"scroll-pe":[{"scroll-pe":oe()}],"scroll-pt":[{"scroll-pt":oe()}],"scroll-pr":[{"scroll-pr":oe()}],"scroll-pb":[{"scroll-pb":oe()}],"scroll-pl":[{"scroll-pl":oe()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",wn]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Ku,id,UC]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}});function rO(){const e=window.location.host;return e.includes("localhost")?"http://localhost:4000":e.includes("freeday-beta-webchat-app")||e.includes("freeday-app-beta")||e.includes("beta-chat.freeday.ai")?"https://beta-webchat.freeday.chat":"https://webchat.freeday.chat"}function ka(...e){return Hq(hi(e))}function zC(e){if(!e||typeof e!="string")return"0 0% 0%";let t=e;if(!t.startsWith("#"))return"0 0% 0%";t=t.substring(1);let n=0,r=0,a=0;if(t.length===3)n=parseInt(t[0]+t[0],16),r=parseInt(t[1]+t[1],16),a=parseInt(t[2]+t[2],16);else if(t.length===6)n=parseInt(t[0]+t[1],16),r=parseInt(t[2]+t[3],16),a=parseInt(t[4]+t[5],16);else return"0 0% 0%";if(isNaN(n)||isNaN(r)||isNaN(a))return"0 0% 0%";n/=255,r/=255,a/=255;const s=Math.min(n,r,a),l=Math.max(n,r,a),c=l-s;let h=0,p=0,v=(l+s)/2;return c!==0&&(l===n?h=(r-a)/c%6:l===r?h=(a-n)/c+2:h=(n-r)/c+4,h=Math.round(h*60),h<0&&(h+=360)),p=c===0?0:c/(1-Math.abs(2*v-1)),p=+(p*100).toFixed(1),v=+(v*100).toFixed(1),`${h} ${p}% ${v}%`}const jC=()=>{const e=window.location.host;return e.includes("localhost")?"http://localhost:8001":e.includes("preview-beta")||e.includes("freeday-app-beta")||e.includes("beta-chat.freeday.ai")?"https://beta-api.freeday.ai":"https://api.freeday.ai"};class iO{static setValue(t,n){sessionStorage.setItem(t,JSON.stringify(n))}static getValue(t){const n=sessionStorage.getItem(t);return n?JSON.parse(n):null}}const ln=e=>typeof e=="string",Q0=()=>{let e,t;const n=new Promise((r,a)=>{e=r,t=a});return n.resolve=e,n.reject=t,n},aO=e=>e==null?"":""+e,Uq=(e,t,n)=>{e.forEach(r=>{t[r]&&(n[r]=t[r])})},zq=/###/g,oO=e=>e&&e.indexOf("###")>-1?e.replace(zq,"."):e,sO=e=>!e||ln(e),X0=(e,t,n)=>{const r=ln(t)?t.split("."):t;let a=0;for(;a<r.length-1;){if(sO(e))return{};const s=oO(r[a]);!e[s]&&n&&(e[s]=new n),Object.prototype.hasOwnProperty.call(e,s)?e=e[s]:e={},++a}return sO(e)?{}:{obj:e,k:oO(r[a])}},lO=(e,t,n)=>{const{obj:r,k:a}=X0(e,t,Object);if(r!==void 0||t.length===1){r[a]=n;return}let s=t[t.length-1],l=t.slice(0,t.length-1),c=X0(e,l,Object);for(;c.obj===void 0&&l.length;)s=`${l[l.length-1]}.${s}`,l=l.slice(0,l.length-1),c=X0(e,l,Object),c?.obj&&typeof c.obj[`${c.k}.${s}`]<"u"&&(c.obj=void 0);c.obj[`${c.k}.${s}`]=n},jq=(e,t,n,r)=>{const{obj:a,k:s}=X0(e,t,Object);a[s]=a[s]||[],a[s].push(n)},qb=(e,t)=>{const{obj:n,k:r}=X0(e,t);if(n&&Object.prototype.hasOwnProperty.call(n,r))return n[r]},Vq=(e,t,n)=>{const r=qb(e,n);return r!==void 0?r:qb(t,n)},uO=(e,t,n)=>{for(const r in t)r!=="__proto__"&&r!=="constructor"&&(r in e?ln(e[r])||e[r]instanceof String||ln(t[r])||t[r]instanceof String?n&&(e[r]=t[r]):uO(e[r],t[r],n):e[r]=t[r]);return e},Mp=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var Wq={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};const Yq=e=>ln(e)?e.replace(/[&<>"'\/]/g,t=>Wq[t]):e;class qq{constructor(t){this.capacity=t,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(t){const n=this.regExpMap.get(t);if(n!==void 0)return n;const r=new RegExp(t);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(t,r),this.regExpQueue.push(t),r}}const Gq=[" ",",","?","!",";"],Kq=new qq(20),Qq=(e,t,n)=>{t=t||"",n=n||"";const r=Gq.filter(l=>t.indexOf(l)<0&&n.indexOf(l)<0);if(r.length===0)return!0;const a=Kq.getRegExp(`(${r.map(l=>l==="?"?"\\?":l).join("|")})`);let s=!a.test(e);if(!s){const l=e.indexOf(n);l>0&&!a.test(e.substring(0,l))&&(s=!0)}return s},VC=(e,t,n=".")=>{if(!e)return;if(e[t])return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0;const r=t.split(n);let a=e;for(let s=0;s<r.length;){if(!a||typeof a!="object")return;let l,c="";for(let h=s;h<r.length;++h)if(h!==s&&(c+=n),c+=r[h],l=a[c],l!==void 0){if(["string","number","boolean"].indexOf(typeof l)>-1&&h<r.length-1)continue;s+=h-s+1;break}a=l}return a},Z0=e=>e?.replace("_","-"),Xq={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){console?.[e]?.apply?.(console,t)}};class Gb{constructor(t,n={}){this.init(t,n)}init(t,n={}){this.prefix=n.prefix||"i18next:",this.logger=t||Xq,this.options=n,this.debug=n.debug}log(...t){return this.forward(t,"log","",!0)}warn(...t){return this.forward(t,"warn","",!0)}error(...t){return this.forward(t,"error","")}deprecate(...t){return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}forward(t,n,r,a){return a&&!this.debug?null:(ln(t[0])&&(t[0]=`${r}${this.prefix} ${t[0]}`),this.logger[n](t))}create(t){return new Gb(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t=t||this.options,t.prefix=t.prefix||this.prefix,new Gb(this.logger,t)}}var Hl=new Gb;class Kb{constructor(){this.observers={}}on(t,n){return t.split(" ").forEach(r=>{this.observers[r]||(this.observers[r]=new Map);const a=this.observers[r].get(n)||0;this.observers[r].set(n,a+1)}),this}off(t,n){if(this.observers[t]){if(!n){delete this.observers[t];return}this.observers[t].delete(n)}}emit(t,...n){this.observers[t]&&Array.from(this.observers[t].entries()).forEach(([a,s])=>{for(let l=0;l<s;l++)a(...n)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([a,s])=>{for(let l=0;l<s;l++)a.apply(a,[t,...n])})}}class cO extends Kb{constructor(t,n={ns:["translation"],defaultNS:"translation"}){super(),this.data=t||{},this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(t){this.options.ns.indexOf(t)<0&&this.options.ns.push(t)}removeNamespaces(t){const n=this.options.ns.indexOf(t);n>-1&&this.options.ns.splice(n,1)}getResource(t,n,r,a={}){const s=a.keySeparator!==void 0?a.keySeparator:this.options.keySeparator,l=a.ignoreJSONStructure!==void 0?a.ignoreJSONStructure:this.options.ignoreJSONStructure;let c;t.indexOf(".")>-1?c=t.split("."):(c=[t,n],r&&(Array.isArray(r)?c.push(...r):ln(r)&&s?c.push(...r.split(s)):c.push(r)));const h=qb(this.data,c);return!h&&!n&&!r&&t.indexOf(".")>-1&&(t=c[0],n=c[1],r=c.slice(2).join(".")),h||!l||!ln(r)?h:VC(this.data?.[t]?.[n],r,s)}addResource(t,n,r,a,s={silent:!1}){const l=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator;let c=[t,n];r&&(c=c.concat(l?r.split(l):r)),t.indexOf(".")>-1&&(c=t.split("."),a=n,n=c[1]),this.addNamespaces(n),lO(this.data,c,a),s.silent||this.emit("added",t,n,r,a)}addResources(t,n,r,a={silent:!1}){for(const s in r)(ln(r[s])||Array.isArray(r[s]))&&this.addResource(t,n,s,r[s],{silent:!0});a.silent||this.emit("added",t,n,r)}addResourceBundle(t,n,r,a,s,l={silent:!1,skipCopy:!1}){let c=[t,n];t.indexOf(".")>-1&&(c=t.split("."),a=r,r=n,n=c[1]),this.addNamespaces(n);let h=qb(this.data,c)||{};l.skipCopy||(r=JSON.parse(JSON.stringify(r))),a?uO(h,r,s):h={...h,...r},lO(this.data,c,h),l.silent||this.emit("added",t,n,r)}removeResourceBundle(t,n){this.hasResourceBundle(t,n)&&delete this.data[t][n],this.removeNamespaces(n),this.emit("removed",t,n)}hasResourceBundle(t,n){return this.getResource(t,n)!==void 0}getResourceBundle(t,n){return n||(n=this.options.defaultNS),this.getResource(t,n)}getDataByLanguage(t){return this.data[t]}hasLanguageSomeTranslations(t){const n=this.getDataByLanguage(t);return!!(n&&Object.keys(n)||[]).find(a=>n[a]&&Object.keys(n[a]).length>0)}toJSON(){return this.data}}var dO={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,r,a){return e.forEach(s=>{t=this.processors[s]?.process(t,n,r,a)??t}),t}};const fO=Symbol("i18next/PATH_KEY");function Zq(){const e=[],t=Object.create(null);let n;return t.get=(r,a)=>(n?.revoke?.(),a===fO?e:(e.push(a),n=Proxy.revocable(r,t),n.proxy)),Proxy.revocable(Object.create(null),t).proxy}function WC(e,t){const{[fO]:n}=e(Zq());return n.join(t?.keySeparator??".")}const hO={},YC=e=>!ln(e)&&typeof e!="boolean"&&typeof e!="number";class Qb extends Kb{constructor(t,n={}){super(),Uq(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Hl.create("translator")}changeLanguage(t){t&&(this.language=t)}exists(t,n={interpolation:{}}){const r={...n};if(t==null)return!1;const a=this.resolve(t,r);if(a?.res===void 0)return!1;const s=YC(a.res);return!(r.returnObjects===!1&&s)}extractFromKey(t,n){let r=n.nsSeparator!==void 0?n.nsSeparator:this.options.nsSeparator;r===void 0&&(r=":");const a=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let s=n.ns||this.options.defaultNS||[];const l=r&&t.indexOf(r)>-1,c=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!Qq(t,r,a);if(l&&!c){const h=t.match(this.interpolator.nestingRegexp);if(h&&h.length>0)return{key:t,namespaces:ln(s)?[s]:s};const p=t.split(r);(r!==a||r===a&&this.options.ns.indexOf(p[0])>-1)&&(s=p.shift()),t=p.join(a)}return{key:t,namespaces:ln(s)?[s]:s}}translate(t,n,r){let a=typeof n=="object"?{...n}:n;if(typeof a!="object"&&this.options.overloadTranslationOptionHandler&&(a=this.options.overloadTranslationOptionHandler(arguments)),typeof a=="object"&&(a={...a}),a||(a={}),t==null)return"";typeof t=="function"&&(t=WC(t,{...this.options,...a})),Array.isArray(t)||(t=[String(t)]);const s=a.returnDetails!==void 0?a.returnDetails:this.options.returnDetails,l=a.keySeparator!==void 0?a.keySeparator:this.options.keySeparator,{key:c,namespaces:h}=this.extractFromKey(t[t.length-1],a),p=h[h.length-1];let v=a.nsSeparator!==void 0?a.nsSeparator:this.options.nsSeparator;v===void 0&&(v=":");const y=a.lng||this.language,w=a.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(y?.toLowerCase()==="cimode")return w?s?{res:`${p}${v}${c}`,usedKey:c,exactUsedKey:c,usedLng:y,usedNS:p,usedParams:this.getUsedParamsDetails(a)}:`${p}${v}${c}`:s?{res:c,usedKey:c,exactUsedKey:c,usedLng:y,usedNS:p,usedParams:this.getUsedParamsDetails(a)}:c;const T=this.resolve(t,a);let A=T?.res;const R=T?.usedKey||c,N=T?.exactUsedKey||c,O=["[object Number]","[object Function]","[object RegExp]"],M=a.joinArrays!==void 0?a.joinArrays:this.options.joinArrays,H=!this.i18nFormat||this.i18nFormat.handleAsObject,V=a.count!==void 0&&!ln(a.count),K=Qb.hasDefaultValue(a),Y=V?this.pluralResolver.getSuffix(y,a.count,a):"",Z=a.ordinal&&V?this.pluralResolver.getSuffix(y,a.count,{ordinal:!1}):"",X=V&&!a.ordinal&&a.count===0,ce=X&&a[`defaultValue${this.options.pluralSeparator}zero`]||a[`defaultValue${Y}`]||a[`defaultValue${Z}`]||a.defaultValue;let W=A;H&&!A&&K&&(W=ce);const me=YC(W),oe=Object.prototype.toString.apply(W);if(H&&W&&me&&O.indexOf(oe)<0&&!(ln(M)&&Array.isArray(W))){if(!a.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const te=this.options.returnedObjectHandler?this.options.returnedObjectHandler(R,W,{...a,ns:h}):`key '${c} (${this.language})' returned an object instead of string.`;return s?(T.res=te,T.usedParams=this.getUsedParamsDetails(a),T):te}if(l){const te=Array.isArray(W),le=te?[]:{},Ae=te?N:R;for(const _e in W)if(Object.prototype.hasOwnProperty.call(W,_e)){const ve=`${Ae}${l}${_e}`;K&&!A?le[_e]=this.translate(ve,{...a,defaultValue:YC(ce)?ce[_e]:void 0,joinArrays:!1,ns:h}):le[_e]=this.translate(ve,{...a,joinArrays:!1,ns:h}),le[_e]===ve&&(le[_e]=W[_e])}A=le}}else if(H&&ln(M)&&Array.isArray(A))A=A.join(M),A&&(A=this.extendTranslation(A,t,a,r));else{let te=!1,le=!1;!this.isValidLookup(A)&&K&&(te=!0,A=ce),this.isValidLookup(A)||(le=!0,A=c);const _e=(a.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&le?void 0:A,ve=K&&ce!==A&&this.options.updateMissing;if(le||te||ve){if(this.logger.log(ve?"updateKey":"missingKey",y,p,c,ve?ce:A),l){const $=this.resolve(c,{...a,keySeparator:!1});$&&$.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let se=[];const De=this.languageUtils.getFallbackCodes(this.options.fallbackLng,a.lng||this.language);if(this.options.saveMissingTo==="fallback"&&De&&De[0])for(let $=0;$<De.length;$++)se.push(De[$]);else this.options.saveMissingTo==="all"?se=this.languageUtils.toResolveHierarchy(a.lng||this.language):se.push(a.lng||this.language);const U=($,be,j)=>{const Ue=K&&j!==A?j:_e;this.options.missingKeyHandler?this.options.missingKeyHandler($,p,be,Ue,ve,a):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing($,p,be,Ue,ve,a),this.emit("missingKey",$,p,be,A)};this.options.saveMissing&&(this.options.saveMissingPlurals&&V?se.forEach($=>{const be=this.pluralResolver.getSuffixes($,a);X&&a[`defaultValue${this.options.pluralSeparator}zero`]&&be.indexOf(`${this.options.pluralSeparator}zero`)<0&&be.push(`${this.options.pluralSeparator}zero`),be.forEach(j=>{U([$],c+j,a[`defaultValue${j}`]||ce)})}):U(se,c,ce))}A=this.extendTranslation(A,t,a,T,r),le&&A===c&&this.options.appendNamespaceToMissingKey&&(A=`${p}${v}${c}`),(le||te)&&this.options.parseMissingKeyHandler&&(A=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${p}${v}${c}`:c,te?A:void 0,a))}return s?(T.res=A,T.usedParams=this.getUsedParamsDetails(a),T):A}extendTranslation(t,n,r,a,s){if(this.i18nFormat?.parse)t=this.i18nFormat.parse(t,{...this.options.interpolation.defaultVariables,...r},r.lng||this.language||a.usedLng,a.usedNS,a.usedKey,{resolved:a});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init({...r,interpolation:{...this.options.interpolation,...r.interpolation}});const h=ln(t)&&(r?.interpolation?.skipOnVariables!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let p;if(h){const y=t.match(this.interpolator.nestingRegexp);p=y&&y.length}let v=r.replace&&!ln(r.replace)?r.replace:r;if(this.options.interpolation.defaultVariables&&(v={...this.options.interpolation.defaultVariables,...v}),t=this.interpolator.interpolate(t,v,r.lng||this.language||a.usedLng,r),h){const y=t.match(this.interpolator.nestingRegexp),w=y&&y.length;p<w&&(r.nest=!1)}!r.lng&&a&&a.res&&(r.lng=this.language||a.usedLng),r.nest!==!1&&(t=this.interpolator.nest(t,(...y)=>s?.[0]===y[0]&&!r.context?(this.logger.warn(`It seems you are nesting recursively key: ${y[0]} in key: ${n[0]}`),null):this.translate(...y,n),r)),r.interpolation&&this.interpolator.reset()}const l=r.postProcess||this.options.postProcess,c=ln(l)?[l]:l;return t!=null&&c?.length&&r.applyPostProcessor!==!1&&(t=dO.handle(c,t,n,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...a,usedParams:this.getUsedParamsDetails(r)},...r}:r,this)),t}resolve(t,n={}){let r,a,s,l,c;return ln(t)&&(t=[t]),t.forEach(h=>{if(this.isValidLookup(r))return;const p=this.extractFromKey(h,n),v=p.key;a=v;let y=p.namespaces;this.options.fallbackNS&&(y=y.concat(this.options.fallbackNS));const w=n.count!==void 0&&!ln(n.count),T=w&&!n.ordinal&&n.count===0,A=n.context!==void 0&&(ln(n.context)||typeof n.context=="number")&&n.context!=="",R=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);y.forEach(N=>{this.isValidLookup(r)||(c=N,!hO[`${R[0]}-${N}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(c)&&(hO[`${R[0]}-${N}`]=!0,this.logger.warn(`key "${a}" for languages "${R.join(", ")}" won't get resolved as namespace "${c}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),R.forEach(O=>{if(this.isValidLookup(r))return;l=O;const M=[v];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(M,v,O,N,n);else{let V;w&&(V=this.pluralResolver.getSuffix(O,n.count,n));const K=`${this.options.pluralSeparator}zero`,Y=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(w&&(n.ordinal&&V.indexOf(Y)===0&&M.push(v+V.replace(Y,this.options.pluralSeparator)),M.push(v+V),T&&M.push(v+K)),A){const Z=`${v}${this.options.contextSeparator||"_"}${n.context}`;M.push(Z),w&&(n.ordinal&&V.indexOf(Y)===0&&M.push(Z+V.replace(Y,this.options.pluralSeparator)),M.push(Z+V),T&&M.push(Z+K))}}let H;for(;H=M.pop();)this.isValidLookup(r)||(s=H,r=this.getResource(O,N,H,n))}))})}),{res:r,usedKey:a,exactUsedKey:s,usedLng:l,usedNS:c}}isValidLookup(t){return t!==void 0&&!(!this.options.returnNull&&t===null)&&!(!this.options.returnEmptyString&&t==="")}getResource(t,n,r,a={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(t,n,r,a):this.resourceStore.getResource(t,n,r,a)}getUsedParamsDetails(t={}){const n=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],r=t.replace&&!ln(t.replace);let a=r?t.replace:t;if(r&&typeof t.count<"u"&&(a.count=t.count),this.options.interpolation.defaultVariables&&(a={...this.options.interpolation.defaultVariables,...a}),!r){a={...a};for(const s of n)delete a[s]}return a}static hasDefaultValue(t){const n="defaultValue";for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&n===r.substring(0,n.length)&&t[r]!==void 0)return!0;return!1}}class pO{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Hl.create("languageUtils")}getScriptPartFromCode(t){if(t=Z0(t),!t||t.indexOf("-")<0)return null;const n=t.split("-");return n.length===2||(n.pop(),n[n.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(n.join("-"))}getLanguagePartFromCode(t){if(t=Z0(t),!t||t.indexOf("-")<0)return t;const n=t.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(t){if(ln(t)&&t.indexOf("-")>-1){let n;try{n=Intl.getCanonicalLocales(t)[0]}catch{}return n&&this.options.lowerCaseLng&&(n=n.toLowerCase()),n||(this.options.lowerCaseLng?t.toLowerCase():t)}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}isSupportedCode(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(t)>-1}getBestMatchFromCodes(t){if(!t)return null;let n;return t.forEach(r=>{if(n)return;const a=this.formatLanguageCode(r);(!this.options.supportedLngs||this.isSupportedCode(a))&&(n=a)}),!n&&this.options.supportedLngs&&t.forEach(r=>{if(n)return;const a=this.getScriptPartFromCode(r);if(this.isSupportedCode(a))return n=a;const s=this.getLanguagePartFromCode(r);if(this.isSupportedCode(s))return n=s;n=this.options.supportedLngs.find(l=>{if(l===s)return l;if(!(l.indexOf("-")<0&&s.indexOf("-")<0)&&(l.indexOf("-")>0&&s.indexOf("-")<0&&l.substring(0,l.indexOf("-"))===s||l.indexOf(s)===0&&s.length>1))return l})}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(t,n){if(!t)return[];if(typeof t=="function"&&(t=t(n)),ln(t)&&(t=[t]),Array.isArray(t))return t;if(!n)return t.default||[];let r=t[n];return r||(r=t[this.getScriptPartFromCode(n)]),r||(r=t[this.formatLanguageCode(n)]),r||(r=t[this.getLanguagePartFromCode(n)]),r||(r=t.default),r||[]}toResolveHierarchy(t,n){const r=this.getFallbackCodes((n===!1?[]:n)||this.options.fallbackLng||[],t),a=[],s=l=>{l&&(this.isSupportedCode(l)?a.push(l):this.logger.warn(`rejecting language code not found in supportedLngs: ${l}`))};return ln(t)&&(t.indexOf("-")>-1||t.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&s(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&s(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&s(this.getLanguagePartFromCode(t))):ln(t)&&s(this.formatLanguageCode(t)),r.forEach(l=>{a.indexOf(l)<0&&s(this.formatLanguageCode(l))}),a}}const mO={zero:0,one:1,two:2,few:3,many:4,other:5},gO={select:e=>e===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class Jq{constructor(t,n={}){this.languageUtils=t,this.options=n,this.logger=Hl.create("pluralResolver"),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(t,n={}){const r=Z0(t==="dev"?"en":t),a=n.ordinal?"ordinal":"cardinal",s=JSON.stringify({cleanedCode:r,type:a});if(s in this.pluralRulesCache)return this.pluralRulesCache[s];let l;try{l=new Intl.PluralRules(r,{type:a})}catch{if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),gO;if(!t.match(/-|_/))return gO;const h=this.languageUtils.getLanguagePartFromCode(t);l=this.getRule(h,n)}return this.pluralRulesCache[s]=l,l}needsPlural(t,n={}){let r=this.getRule(t,n);return r||(r=this.getRule("dev",n)),r?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(t,n,r={}){return this.getSuffixes(t,r).map(a=>`${n}${a}`)}getSuffixes(t,n={}){let r=this.getRule(t,n);return r||(r=this.getRule("dev",n)),r?r.resolvedOptions().pluralCategories.sort((a,s)=>mO[a]-mO[s]).map(a=>`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${a}`):[]}getSuffix(t,n,r={}){const a=this.getRule(t,r);return a?`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${a.select(n)}`:(this.logger.warn(`no plural rule found for: ${t}`),this.getSuffix("dev",n,r))}}const vO=(e,t,n,r=".",a=!0)=>{let s=Vq(e,t,n);return!s&&a&&ln(n)&&(s=VC(e,n,r),s===void 0&&(s=VC(t,n,r))),s},qC=e=>e.replace(/\$/g,"$$$$");class yO{constructor(t={}){this.logger=Hl.create("interpolator"),this.options=t,this.format=t?.interpolation?.format||(n=>n),this.init(t)}init(t={}){t.interpolation||(t.interpolation={escapeValue:!0});const{escape:n,escapeValue:r,useRawValueToEscape:a,prefix:s,prefixEscaped:l,suffix:c,suffixEscaped:h,formatSeparator:p,unescapeSuffix:v,unescapePrefix:y,nestingPrefix:w,nestingPrefixEscaped:T,nestingSuffix:A,nestingSuffixEscaped:R,nestingOptionsSeparator:N,maxReplaces:O,alwaysFormat:M}=t.interpolation;this.escape=n!==void 0?n:Yq,this.escapeValue=r!==void 0?r:!0,this.useRawValueToEscape=a!==void 0?a:!1,this.prefix=s?Mp(s):l||"{{",this.suffix=c?Mp(c):h||"}}",this.formatSeparator=p||",",this.unescapePrefix=v?"":y||"-",this.unescapeSuffix=this.unescapePrefix?"":v||"",this.nestingPrefix=w?Mp(w):T||Mp("$t("),this.nestingSuffix=A?Mp(A):R||Mp(")"),this.nestingOptionsSeparator=N||",",this.maxReplaces=O||1e3,this.alwaysFormat=M!==void 0?M:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const t=(n,r)=>n?.source===r?(n.lastIndex=0,n):new RegExp(r,"g");this.regexp=t(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=t(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=t(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(t,n,r,a){let s,l,c;const h=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},p=T=>{if(T.indexOf(this.formatSeparator)<0){const O=vO(n,h,T,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(O,void 0,r,{...a,...n,interpolationkey:T}):O}const A=T.split(this.formatSeparator),R=A.shift().trim(),N=A.join(this.formatSeparator).trim();return this.format(vO(n,h,R,this.options.keySeparator,this.options.ignoreJSONStructure),N,r,{...a,...n,interpolationkey:R})};this.resetRegExp();const v=a?.missingInterpolationHandler||this.options.missingInterpolationHandler,y=a?.interpolation?.skipOnVariables!==void 0?a.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:T=>qC(T)},{regex:this.regexp,safeValue:T=>this.escapeValue?qC(this.escape(T)):qC(T)}].forEach(T=>{for(c=0;s=T.regex.exec(t);){const A=s[1].trim();if(l=p(A),l===void 0)if(typeof v=="function"){const N=v(t,s,a);l=ln(N)?N:""}else if(a&&Object.prototype.hasOwnProperty.call(a,A))l="";else if(y){l=s[0];continue}else this.logger.warn(`missed to pass in variable ${A} for interpolating ${t}`),l="";else!ln(l)&&!this.useRawValueToEscape&&(l=aO(l));const R=T.safeValue(l);if(t=t.replace(s[0],R),y?(T.regex.lastIndex+=l.length,T.regex.lastIndex-=s[0].length):T.regex.lastIndex=0,c++,c>=this.maxReplaces)break}}),t}nest(t,n,r={}){let a,s,l;const c=(h,p)=>{const v=this.nestingOptionsSeparator;if(h.indexOf(v)<0)return h;const y=h.split(new RegExp(`${v}[ ]*{`));let w=`{${y[1]}`;h=y[0],w=this.interpolate(w,l);const T=w.match(/'/g),A=w.match(/"/g);((T?.length??0)%2===0&&!A||A.length%2!==0)&&(w=w.replace(/'/g,'"'));try{l=JSON.parse(w),p&&(l={...p,...l})}catch(R){return this.logger.warn(`failed parsing options string in nesting for key ${h}`,R),`${h}${v}${w}`}return l.defaultValue&&l.defaultValue.indexOf(this.prefix)>-1&&delete l.defaultValue,h};for(;a=this.nestingRegexp.exec(t);){let h=[];l={...r},l=l.replace&&!ln(l.replace)?l.replace:l,l.applyPostProcessor=!1,delete l.defaultValue;const p=/{.*}/.test(a[1])?a[1].lastIndexOf("}")+1:a[1].indexOf(this.formatSeparator);if(p!==-1&&(h=a[1].slice(p).split(this.formatSeparator).map(v=>v.trim()).filter(Boolean),a[1]=a[1].slice(0,p)),s=n(c.call(this,a[1].trim(),l),l),s&&a[0]===t&&!ln(s))return s;ln(s)||(s=aO(s)),s||(this.logger.warn(`missed to resolve ${a[1]} for nesting ${t}`),s=""),h.length&&(s=h.reduce((v,y)=>this.format(v,y,r.lng,{...r,interpolationkey:a[1].trim()}),s.trim())),t=t.replace(a[0],s),this.regexp.lastIndex=0}return t}}const $q=e=>{let t=e.toLowerCase().trim();const n={};if(e.indexOf("(")>-1){const r=e.split("(");t=r[0].toLowerCase().trim();const a=r[1].substring(0,r[1].length-1);t==="currency"&&a.indexOf(":")<0?n.currency||(n.currency=a.trim()):t==="relativetime"&&a.indexOf(":")<0?n.range||(n.range=a.trim()):a.split(";").forEach(l=>{if(l){const[c,...h]=l.split(":"),p=h.join(":").trim().replace(/^'+|'+$/g,""),v=c.trim();n[v]||(n[v]=p),p==="false"&&(n[v]=!1),p==="true"&&(n[v]=!0),isNaN(p)||(n[v]=parseInt(p,10))}})}return{formatName:t,formatOptions:n}},bO=e=>{const t={};return(n,r,a)=>{let s=a;a&&a.interpolationkey&&a.formatParams&&a.formatParams[a.interpolationkey]&&a[a.interpolationkey]&&(s={...s,[a.interpolationkey]:void 0});const l=r+JSON.stringify(s);let c=t[l];return c||(c=e(Z0(r),a),t[l]=c),c(n)}},eG=e=>(t,n,r)=>e(Z0(n),r)(t);class tG{constructor(t={}){this.logger=Hl.create("formatter"),this.options=t,this.init(t)}init(t,n={interpolation:{}}){this.formatSeparator=n.interpolation.formatSeparator||",";const r=n.cacheInBuiltFormats?bO:eG;this.formats={number:r((a,s)=>{const l=new Intl.NumberFormat(a,{...s});return c=>l.format(c)}),currency:r((a,s)=>{const l=new Intl.NumberFormat(a,{...s,style:"currency"});return c=>l.format(c)}),datetime:r((a,s)=>{const l=new Intl.DateTimeFormat(a,{...s});return c=>l.format(c)}),relativetime:r((a,s)=>{const l=new Intl.RelativeTimeFormat(a,{...s});return c=>l.format(c,s.range||"day")}),list:r((a,s)=>{const l=new Intl.ListFormat(a,{...s});return c=>l.format(c)})}}add(t,n){this.formats[t.toLowerCase().trim()]=n}addCached(t,n){this.formats[t.toLowerCase().trim()]=bO(n)}format(t,n,r,a={}){const s=n.split(this.formatSeparator);if(s.length>1&&s[0].indexOf("(")>1&&s[0].indexOf(")")<0&&s.find(c=>c.indexOf(")")>-1)){const c=s.findIndex(h=>h.indexOf(")")>-1);s[0]=[s[0],...s.splice(1,c)].join(this.formatSeparator)}return s.reduce((c,h)=>{const{formatName:p,formatOptions:v}=$q(h);if(this.formats[p]){let y=c;try{const w=a?.formatParams?.[a.interpolationkey]||{},T=w.locale||w.lng||a.locale||a.lng||r;y=this.formats[p](c,T,{...v,...a,...w})}catch(w){this.logger.warn(w)}return y}else this.logger.warn(`there was no format function for ${p}`);return c},t)}}const nG=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)};class rG extends Kb{constructor(t,n,r,a={}){super(),this.backend=t,this.store=n,this.services=r,this.languageUtils=r.languageUtils,this.options=a,this.logger=Hl.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=a.maxParallelReads||10,this.readingCalls=0,this.maxRetries=a.maxRetries>=0?a.maxRetries:5,this.retryTimeout=a.retryTimeout>=1?a.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(r,a.backend,a)}queueLoad(t,n,r,a){const s={},l={},c={},h={};return t.forEach(p=>{let v=!0;n.forEach(y=>{const w=`${p}|${y}`;!r.reload&&this.store.hasResourceBundle(p,y)?this.state[w]=2:this.state[w]<0||(this.state[w]===1?l[w]===void 0&&(l[w]=!0):(this.state[w]=1,v=!1,l[w]===void 0&&(l[w]=!0),s[w]===void 0&&(s[w]=!0),h[y]===void 0&&(h[y]=!0)))}),v||(c[p]=!0)}),(Object.keys(s).length||Object.keys(l).length)&&this.queue.push({pending:l,pendingCount:Object.keys(l).length,loaded:{},errors:[],callback:a}),{toLoad:Object.keys(s),pending:Object.keys(l),toLoadLanguages:Object.keys(c),toLoadNamespaces:Object.keys(h)}}loaded(t,n,r){const a=t.split("|"),s=a[0],l=a[1];n&&this.emit("failedLoading",s,l,n),!n&&r&&this.store.addResourceBundle(s,l,r,void 0,void 0,{skipCopy:!0}),this.state[t]=n?-1:2,n&&r&&(this.state[t]=0);const c={};this.queue.forEach(h=>{jq(h.loaded,[s],l),nG(h,t),n&&h.errors.push(n),h.pendingCount===0&&!h.done&&(Object.keys(h.loaded).forEach(p=>{c[p]||(c[p]={});const v=h.loaded[p];v.length&&v.forEach(y=>{c[p][y]===void 0&&(c[p][y]=!0)})}),h.done=!0,h.errors.length?h.callback(h.errors):h.callback())}),this.emit("loaded",c),this.queue=this.queue.filter(h=>!h.done)}read(t,n,r,a=0,s=this.retryTimeout,l){if(!t.length)return l(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:t,ns:n,fcName:r,tried:a,wait:s,callback:l});return}this.readingCalls++;const c=(p,v)=>{if(this.readingCalls--,this.waitingReads.length>0){const y=this.waitingReads.shift();this.read(y.lng,y.ns,y.fcName,y.tried,y.wait,y.callback)}if(p&&v&&a<this.maxRetries){setTimeout(()=>{this.read.call(this,t,n,r,a+1,s*2,l)},s);return}l(p,v)},h=this.backend[r].bind(this.backend);if(h.length===2){try{const p=h(t,n);p&&typeof p.then=="function"?p.then(v=>c(null,v)).catch(c):c(null,p)}catch(p){c(p)}return}return h(t,n,c)}prepareLoading(t,n,r={},a){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),a&&a();ln(t)&&(t=this.languageUtils.toResolveHierarchy(t)),ln(n)&&(n=[n]);const s=this.queueLoad(t,n,r,a);if(!s.toLoad.length)return s.pending.length||a(),null;s.toLoad.forEach(l=>{this.loadOne(l)})}load(t,n,r){this.prepareLoading(t,n,{},r)}reload(t,n,r){this.prepareLoading(t,n,{reload:!0},r)}loadOne(t,n=""){const r=t.split("|"),a=r[0],s=r[1];this.read(a,s,"read",void 0,void 0,(l,c)=>{l&&this.logger.warn(`${n}loading namespace ${s} for language ${a} failed`,l),!l&&c&&this.logger.log(`${n}loaded namespace ${s} for language ${a}`,c),this.loaded(t,l,c)})}saveMissing(t,n,r,a,s,l={},c=()=>{}){if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(n)){this.logger.warn(`did not save key "${r}" as the namespace "${n}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(r==null||r==="")){if(this.backend?.create){const h={...l,isUpdate:s},p=this.backend.create.bind(this.backend);if(p.length<6)try{let v;p.length===5?v=p(t,n,r,a,h):v=p(t,n,r,a),v&&typeof v.then=="function"?v.then(y=>c(null,y)).catch(c):c(null,v)}catch(v){c(v)}else p(t,n,r,a,c,h)}!t||!t[0]||this.store.addResource(t[0],n,r,a)}}}const GC=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if(typeof e[1]=="object"&&(t=e[1]),ln(e[1])&&(t.defaultValue=e[1]),ln(e[2])&&(t.tDescription=e[2]),typeof e[2]=="object"||typeof e[3]=="object"){const n=e[3]||e[2];Object.keys(n).forEach(r=>{t[r]=n[r]})}return t},interpolation:{escapeValue:!0,format:e=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),EO=e=>(ln(e.ns)&&(e.ns=[e.ns]),ln(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),ln(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs?.indexOf?.("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),typeof e.initImmediate=="boolean"&&(e.initAsync=e.initImmediate),e),Xb=()=>{},iG=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(n=>{typeof e[n]=="function"&&(e[n]=e[n].bind(e))})};class J0 extends Kb{constructor(t={},n){if(super(),this.options=EO(t),this.services={},this.logger=Hl,this.modules={external:[]},iG(this),n&&!this.isInitialized&&!t.isClone){if(!this.options.initAsync)return this.init(t,n),this;setTimeout(()=>{this.init(t,n)},0)}}init(t={},n){this.isInitializing=!0,typeof t=="function"&&(n=t,t={}),t.defaultNS==null&&t.ns&&(ln(t.ns)?t.defaultNS=t.ns:t.ns.indexOf("translation")<0&&(t.defaultNS=t.ns[0]));const r=GC();this.options={...r,...this.options,...EO(t)},this.options.interpolation={...r.interpolation,...this.options.interpolation},t.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=t.keySeparator),t.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=t.nsSeparator),typeof this.options.overloadTranslationOptionHandler!="function"&&(this.options.overloadTranslationOptionHandler=r.overloadTranslationOptionHandler);const a=p=>p?typeof p=="function"?new p:p:null;if(!this.options.isClone){this.modules.logger?Hl.init(a(this.modules.logger),this.options):Hl.init(null,this.options);let p;this.modules.formatter?p=this.modules.formatter:p=tG;const v=new pO(this.options);this.store=new cO(this.options.resources,this.options);const y=this.services;y.logger=Hl,y.resourceStore=this.store,y.languageUtils=v,y.pluralResolver=new Jq(v,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),this.options.interpolation.format&&this.options.interpolation.format!==r.interpolation.format&&this.logger.deprecate("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"),p&&(!this.options.interpolation.format||this.options.interpolation.format===r.interpolation.format)&&(y.formatter=a(p),y.formatter.init&&y.formatter.init(y,this.options),this.options.interpolation.format=y.formatter.format.bind(y.formatter)),y.interpolator=new yO(this.options),y.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},y.backendConnector=new rG(a(this.modules.backend),y.resourceStore,y,this.options),y.backendConnector.on("*",(T,...A)=>{this.emit(T,...A)}),this.modules.languageDetector&&(y.languageDetector=a(this.modules.languageDetector),y.languageDetector.init&&y.languageDetector.init(y,this.options.detection,this.options)),this.modules.i18nFormat&&(y.i18nFormat=a(this.modules.i18nFormat),y.i18nFormat.init&&y.i18nFormat.init(this)),this.translator=new Qb(this.services,this.options),this.translator.on("*",(T,...A)=>{this.emit(T,...A)}),this.modules.external.forEach(T=>{T.init&&T.init(this)})}if(this.format=this.options.interpolation.format,n||(n=Xb),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const p=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);p.length>0&&p[0]!=="dev"&&(this.options.lng=p[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(p=>{this[p]=(...v)=>this.store[p](...v)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(p=>{this[p]=(...v)=>(this.store[p](...v),this)});const c=Q0(),h=()=>{const p=(v,y)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),c.resolve(y),n(v,y)};if(this.languages&&!this.isInitialized)return p(null,this.t.bind(this));this.changeLanguage(this.options.lng,p)};return this.options.resources||!this.options.initAsync?h():setTimeout(h,0),c}loadResources(t,n=Xb){let r=n;const a=ln(t)?t:this.language;if(typeof t=="function"&&(r=t),!this.options.resources||this.options.partialBundledLanguages){if(a?.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return r();const s=[],l=c=>{if(!c||c==="cimode")return;this.services.languageUtils.toResolveHierarchy(c).forEach(p=>{p!=="cimode"&&s.indexOf(p)<0&&s.push(p)})};a?l(a):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(h=>l(h)),this.options.preload?.forEach?.(c=>l(c)),this.services.backendConnector.load(s,this.options.ns,c=>{!c&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),r(c)})}else r(null)}reloadResources(t,n,r){const a=Q0();return typeof t=="function"&&(r=t,t=void 0),typeof n=="function"&&(r=n,n=void 0),t||(t=this.languages),n||(n=this.options.ns),r||(r=Xb),this.services.backendConnector.reload(t,n,s=>{a.resolve(),r(s)}),a}use(t){if(!t)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!t.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return t.type==="backend"&&(this.modules.backend=t),(t.type==="logger"||t.log&&t.warn&&t.error)&&(this.modules.logger=t),t.type==="languageDetector"&&(this.modules.languageDetector=t),t.type==="i18nFormat"&&(this.modules.i18nFormat=t),t.type==="postProcessor"&&dO.addPostProcessor(t),t.type==="formatter"&&(this.modules.formatter=t),t.type==="3rdParty"&&this.modules.external.push(t),this}setResolvedLanguage(t){if(!(!t||!this.languages)&&!(["cimode","dev"].indexOf(t)>-1)){for(let n=0;n<this.languages.length;n++){const r=this.languages[n];if(!(["cimode","dev"].indexOf(r)>-1)&&this.store.hasLanguageSomeTranslations(r)){this.resolvedLanguage=r;break}}!this.resolvedLanguage&&this.languages.indexOf(t)<0&&this.store.hasLanguageSomeTranslations(t)&&(this.resolvedLanguage=t,this.languages.unshift(t))}}changeLanguage(t,n){this.isLanguageChangingTo=t;const r=Q0();this.emit("languageChanging",t);const a=c=>{this.language=c,this.languages=this.services.languageUtils.toResolveHierarchy(c),this.resolvedLanguage=void 0,this.setResolvedLanguage(c)},s=(c,h)=>{h?this.isLanguageChangingTo===t&&(a(h),this.translator.changeLanguage(h),this.isLanguageChangingTo=void 0,this.emit("languageChanged",h),this.logger.log("languageChanged",h)):this.isLanguageChangingTo=void 0,r.resolve((...p)=>this.t(...p)),n&&n(c,(...p)=>this.t(...p))},l=c=>{!t&&!c&&this.services.languageDetector&&(c=[]);const h=ln(c)?c:c&&c[0],p=this.store.hasLanguageSomeTranslations(h)?h:this.services.languageUtils.getBestMatchFromCodes(ln(c)?[c]:c);p&&(this.language||a(p),this.translator.language||this.translator.changeLanguage(p),this.services.languageDetector?.cacheUserLanguage?.(p)),this.loadResources(p,v=>{s(v,p)})};return!t&&this.services.languageDetector&&!this.services.languageDetector.async?l(this.services.languageDetector.detect()):!t&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(l):this.services.languageDetector.detect(l):l(t),r}getFixedT(t,n,r){const a=(s,l,...c)=>{let h;typeof l!="object"?h=this.options.overloadTranslationOptionHandler([s,l].concat(c)):h={...l},h.lng=h.lng||a.lng,h.lngs=h.lngs||a.lngs,h.ns=h.ns||a.ns,h.keyPrefix!==""&&(h.keyPrefix=h.keyPrefix||r||a.keyPrefix);const p=this.options.keySeparator||".";let v;return h.keyPrefix&&Array.isArray(s)?v=s.map(y=>(typeof y=="function"&&(y=WC(y,{...this.options,...l})),`${h.keyPrefix}${p}${y}`)):(typeof s=="function"&&(s=WC(s,{...this.options,...l})),v=h.keyPrefix?`${h.keyPrefix}${p}${s}`:s),this.t(v,h)};return ln(t)?a.lng=t:a.lngs=t,a.ns=n,a.keyPrefix=r,a}t(...t){return this.translator?.translate(...t)}exists(...t){return this.translator?.exists(...t)}setDefaultNamespace(t){this.options.defaultNS=t}hasLoadedNamespace(t,n={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const r=n.lng||this.resolvedLanguage||this.languages[0],a=this.options?this.options.fallbackLng:!1,s=this.languages[this.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const l=(c,h)=>{const p=this.services.backendConnector.state[`${c}|${h}`];return p===-1||p===0||p===2};if(n.precheck){const c=n.precheck(this,l);if(c!==void 0)return c}return!!(this.hasResourceBundle(r,t)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||l(r,t)&&(!a||l(s,t)))}loadNamespaces(t,n){const r=Q0();return this.options.ns?(ln(t)&&(t=[t]),t.forEach(a=>{this.options.ns.indexOf(a)<0&&this.options.ns.push(a)}),this.loadResources(a=>{r.resolve(),n&&n(a)}),r):(n&&n(),Promise.resolve())}loadLanguages(t,n){const r=Q0();ln(t)&&(t=[t]);const a=this.options.preload||[],s=t.filter(l=>a.indexOf(l)<0&&this.services.languageUtils.isSupportedCode(l));return s.length?(this.options.preload=a.concat(s),this.loadResources(l=>{r.resolve(),n&&n(l)}),r):(n&&n(),Promise.resolve())}dir(t){if(t||(t=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language)),!t)return"rtl";try{const a=new Intl.Locale(t);if(a&&a.getTextInfo){const s=a.getTextInfo();if(s&&s.direction)return s.direction}}catch{}const n=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],r=this.services?.languageUtils||new pO(GC());return t.toLowerCase().indexOf("-latn")>1?"ltr":n.indexOf(r.getLanguagePartFromCode(t))>-1||t.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(t={},n){const r=new J0(t,n);return r.createInstance=J0.createInstance,r}cloneInstance(t={},n=Xb){const r=t.forkResourceStore;r&&delete t.forkResourceStore;const a={...this.options,...t,isClone:!0},s=new J0(a);if((t.debug!==void 0||t.prefix!==void 0)&&(s.logger=s.logger.clone(t)),["store","services","language"].forEach(c=>{s[c]=this[c]}),s.services={...this.services},s.services.utils={hasLoadedNamespace:s.hasLoadedNamespace.bind(s)},r){const c=Object.keys(this.store.data).reduce((h,p)=>(h[p]={...this.store.data[p]},h[p]=Object.keys(h[p]).reduce((v,y)=>(v[y]={...h[p][y]},v),h[p]),h),{});s.store=new cO(c,a),s.services.resourceStore=s.store}if(t.interpolation){const h={...GC().interpolation,...this.options.interpolation,...t.interpolation},p={...a,interpolation:h};s.services.interpolator=new yO(p)}return s.translator=new Qb(s.services,a),s.translator.on("*",(c,...h)=>{s.emit(c,...h)}),s.init(a,n),s.translator.options=a,s.translator.backendConnector.services.utils={hasLoadedNamespace:s.hasLoadedNamespace.bind(s)},s}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const Ra=J0.createInstance();Ra.createInstance,Ra.dir,Ra.init,Ra.loadResources,Ra.reloadResources,Ra.use,Ra.changeLanguage,Ra.getFixedT,Ra.t,Ra.exists,Ra.setDefaultNamespace,Ra.hasLoadedNamespace,Ra.loadNamespaces,Ra.loadLanguages;const aG=(e,t,n,r)=>{const a=[n,{code:t,...r||{}}];if(e?.services?.logger?.forward)return e.services.logger.forward(a,"warn","react-i18next::",!0);Pf(a[0])&&(a[0]=`react-i18next:: ${a[0]}`),e?.services?.logger?.warn?e.services.logger.warn(...a):console?.warn&&console.warn(...a)},wO={},xO=(e,t,n,r)=>{Pf(n)&&wO[n]||(Pf(n)&&(wO[n]=new Date),aG(e,t,n,r))},TO=(e,t)=>()=>{if(e.isInitialized)t();else{const n=()=>{setTimeout(()=>{e.off("initialized",n)},0),t()};e.on("initialized",n)}},KC=(e,t,n)=>{e.loadNamespaces(t,TO(e,n))},SO=(e,t,n,r)=>{if(Pf(n)&&(n=[n]),e.options.preload&&e.options.preload.indexOf(t)>-1)return KC(e,n,r);n.forEach(a=>{e.options.ns.indexOf(a)<0&&e.options.ns.push(a)}),e.loadLanguages(t,TO(e,r))},oG=(e,t,n={})=>!t.languages||!t.languages.length?(xO(t,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:t.languages}),!0):t.hasLoadedNamespace(e,{lng:n.lng,precheck:(r,a)=>{if(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&r.services.backendConnector.backend&&r.isLanguageChangingTo&&!a(r.isLanguageChangingTo,e))return!1}}),Pf=e=>typeof e=="string",sG=e=>typeof e=="object"&&e!==null,lG=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,uG={"&amp;":"&","&#38;":"&","&lt;":"<","&#60;":"<","&gt;":">","&#62;":">","&apos;":"'","&#39;":"'","&quot;":'"',"&#34;":'"',"&nbsp;":" ","&#160;":" ","&copy;":"©","&#169;":"©","&reg;":"®","&#174;":"®","&hellip;":"…","&#8230;":"…","&#x2F;":"/","&#47;":"/"},cG=e=>uG[e];let QC={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:e=>e.replace(lG,cG),transDefaultProps:void 0};const dG=(e={})=>{QC={...QC,...e}},fG=()=>QC;let CO;const hG=e=>{CO=e},pG=()=>CO,mG={type:"3rdParty",init(e){dG(e.options.react),hG(e)}},_O=_.createContext();class gG{constructor(){this.usedNamespaces={}}addUsedNamespaces(t){t.forEach(n=>{this.usedNamespaces[n]||(this.usedNamespaces[n]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}var Zb={exports:{}},XC={};var AO;function vG(){if(AO)return XC;AO=1;var e=Sf();function t(y,w){return y===w&&(y!==0||1/y===1/w)||y!==y&&w!==w}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,a=e.useEffect,s=e.useLayoutEffect,l=e.useDebugValue;function c(y,w){var T=w(),A=r({inst:{value:T,getSnapshot:w}}),R=A[0].inst,N=A[1];return s(function(){R.value=T,R.getSnapshot=w,h(R)&&N({inst:R})},[y,T,w]),a(function(){return h(R)&&N({inst:R}),y(function(){h(R)&&N({inst:R})})},[y]),l(T),T}function h(y){var w=y.getSnapshot;y=y.value;try{var T=w();return!n(y,T)}catch{return!0}}function p(y,w){return w()}var v=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?p:c;return XC.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:v,XC}var ZC={},kO;function yG(){if(kO)return ZC;kO=1;var e={};return e.NODE_ENV!=="production"&&(function(){function t(A,R){return A===R&&(A!==0||1/A===1/R)||A!==A&&R!==R}function n(A,R){y||s.startTransition===void 0||(y=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var N=R();if(!w){var O=R();l(N,O)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),w=!0)}O=c({inst:{value:N,getSnapshot:R}});var M=O[0].inst,H=O[1];return p(function(){M.value=N,M.getSnapshot=R,r(M)&&H({inst:M})},[A,N,R]),h(function(){return r(M)&&H({inst:M}),A(function(){r(M)&&H({inst:M})})},[A]),v(N),N}function r(A){var R=A.getSnapshot;A=A.value;try{var N=R();return!l(A,N)}catch{return!0}}function a(A,R){return R()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var s=Sf(),l=typeof Object.is=="function"?Object.is:t,c=s.useState,h=s.useEffect,p=s.useLayoutEffect,v=s.useDebugValue,y=!1,w=!1,T=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?a:n;ZC.useSyncExternalStore=s.useSyncExternalStore!==void 0?s.useSyncExternalStore:T,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})(),ZC}var RO;function bG(){if(RO)return Zb.exports;RO=1;var e={};return e.NODE_ENV==="production"?Zb.exports=vG():Zb.exports=yG(),Zb.exports}var EG=bG();const wG={t:(e,t)=>Pf(t)?t:sG(t)&&Pf(t.defaultValue)?t.defaultValue:Array.isArray(e)?e[e.length-1]:e,ready:!1},xG=()=>()=>{},Gr=(e,t={})=>{const{i18n:n}=t,{i18n:r,defaultNS:a}=_.useContext(_O)||{},s=n||r||pG();s&&!s.reportNamespaces&&(s.reportNamespaces=new gG),s||xO(s,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const l=_.useMemo(()=>({...fG(),...s?.options?.react,...t}),[s,t]),{useSuspense:c,keyPrefix:h}=l,p=e||a||s?.options?.defaultNS,v=Pf(p)?[p]:p||["translation"],y=_.useMemo(()=>v,v);s?.reportNamespaces?.addUsedNamespaces?.(y);const w=_.useRef(0),T=_.useCallback(ce=>{if(!s)return xG;const{bindI18n:W,bindI18nStore:me}=l,oe=()=>{w.current+=1,ce()};return W&&s.on(W,oe),me&&s.store.on(me,oe),()=>{W&&W.split(" ").forEach(te=>s.off(te,oe)),me&&me.split(" ").forEach(te=>s.store.off(te,oe))}},[s,l]),A=_.useRef(),R=_.useCallback(()=>{if(!s)return wG;const ce=!!(s.isInitialized||s.initializedStoreOnce)&&y.every(Ae=>oG(Ae,s,l)),W=t.lng||s.language,me=w.current,oe=A.current;if(oe&&oe.ready===ce&&oe.lng===W&&oe.keyPrefix===h&&oe.revision===me)return oe;const le={t:s.getFixedT(W,l.nsMode==="fallback"?y:y[0],h),ready:ce,lng:W,keyPrefix:h,revision:me};return A.current=le,le},[s,y,h,l,t.lng]),[N,O]=_.useState(0),{t:M,ready:H}=EG.useSyncExternalStore(T,R,R);_.useEffect(()=>{if(s&&!H&&!c){const ce=()=>O(W=>W+1);t.lng?SO(s,t.lng,y,ce):KC(s,y,ce)}},[s,t.lng,y,H,c,N]);const V=s||{},K=_.useRef(null),Y=_.useRef(),Z=ce=>{const W=Object.getOwnPropertyDescriptors(ce);W.__original&&delete W.__original;const me=Object.create(Object.getPrototypeOf(ce),W);if(!Object.prototype.hasOwnProperty.call(me,"__original"))try{Object.defineProperty(me,"__original",{value:ce,writable:!1,enumerable:!1,configurable:!1})}catch{}return me},X=_.useMemo(()=>{const ce=V,W=ce?.language;let me=ce;ce&&(K.current&&K.current.__original===ce?Y.current!==W?(me=Z(ce),K.current=me,Y.current=W):me=K.current:(me=Z(ce),K.current=me,Y.current=W));const oe=[M,me,H];return oe.t=M,oe.i18n=me,oe.ready=H,oe},[M,V,H,V.resolvedLanguage,V.language,V.languages]);if(s&&c&&!H)throw new Promise(ce=>{const W=()=>ce();t.lng?SO(s,t.lng,y,W):KC(s,y,W)});return X};function TG({i18n:e,defaultNS:t,children:n}){const r=_.useMemo(()=>({i18n:e,defaultNS:t}),[e,t]);return _.createElement(_O.Provider,{value:r},n)}const DO=_.createContext(void 0),Jb=()=>{const e=_.useContext(DO);if(!e)throw new Error("useEventSubscriber must be used within an EventSubscriberProvider");return e},SG=({children:e})=>{const t=_.useRef({}),n=_.useCallback((c,h={})=>{window.ReactNativeWebView?window.ReactNativeWebView.postMessage(JSON.stringify({event:c,payload:h})):parent.postMessage({event:c,payload:h},"*")},[]),r=_.useCallback((c,h)=>{t.current[c]||(t.current[c]=[]),t.current[c].push(h)},[]),a=_.useCallback((c,h)=>{t.current[c]&&(t.current[c]=t.current[c].filter(p=>p!==h))},[]),s=_.useCallback(c=>{let h;try{if(typeof c=="string")h=JSON.parse(c);else if(c instanceof MessageEvent)h=typeof c.data=="string"?JSON.parse(c.data):c.data;else throw new Error("Unknown event type");const{event:p,payload:v}=h;p&&t.current[p]&&t.current[p].forEach(y=>y(v))}catch(p){console.error("Event handling failed:",p)}},[]);_.useEffect(()=>{const c=window;if(window.addEventListener)return window.addEventListener("message",s),()=>{window.removeEventListener("message",s)};if(c.attachEvent)return c.attachEvent("onmessage",s),()=>{c.detachEvent?.("onmessage",s)}},[s]);const l={emit:n,subscribe:r,unsubscribe:a};return F.jsx(DO.Provider,{value:l,children:e})},JC={"--primary":"hsl(0, 0%, 0%)","--secondary":void 0,"--font-family":void 0},LO=_.createContext(void 0),CG=()=>{const e=_.useContext(LO);if(!e)throw new Error("useTheme must be used within a ThemeProvider");return e},_G=()=>{const e=document.querySelector("freeday-widget");return e?.shadowRoot?e:document.documentElement},OO=({children:e,primaryColor:t=JC["--primary"],secondaryColor:n=JC["--secondary"],fontFamily:r=JC["--font-family"]})=>{const a=(h,p,v)=>({"--primary":h?zC(h):"hsl(0, 0%, 0%)","--secondary":p?zC(p):void 0,"--font-family":v}),[s,l]=_.useState(a(t,n,r)),c=h=>{const p={...s,...h};l(p)};return _.useEffect(()=>{const h=_G();Object.entries(s).forEach(([p,v])=>{v&&(h.style.setProperty(p,v),document.documentElement.style.setProperty(p,v))})},[s]),F.jsx(LO.Provider,{value:{cssVariables:s,updateCssVariables:c},children:e})},Da=(e,t,n)=>{if(console.error("[Freeday webchat]",t,e),!ys||typeof ys.captureException!="function")return;const r=e instanceof Error;ys.captureException(e,{...n,name:r?e.name:"Unknown error",message:t??(r?e.message:"Unknown error"),...r&&{stack:e.stack,cause:e.cause}})};class AG{constructor(){this.messageHandlers=new Set,this.connectionStateHandlers=new Set,this.errorHandlers=new Set,this._connectionState="disconnected"}get connectionState(){return this._connectionState}onMessage(t){return this.messageHandlers.add(t),()=>this.messageHandlers.delete(t)}onConnectionStateChange(t){return this.connectionStateHandlers.add(t),()=>this.connectionStateHandlers.delete(t)}onError(t){return this.errorHandlers.add(t),()=>this.errorHandlers.delete(t)}setConnectionState(t){this._connectionState=t,this.connectionStateHandlers.forEach(n=>n(t))}notifyMessage(t){this.messageHandlers.forEach(n=>n(t))}notifyError(t){Da(t),this.errorHandlers.forEach(n=>n(t))}}var $0=e=>typeof e=="function"?e:function(){return e},kG=typeof self<"u"?self:null,Fp=typeof window<"u"?window:null,Ul=kG||Fp||globalThis,RG="2.0.0",zl={connecting:0,open:1,closing:2,closed:3},DG=1e4,LG=1e3,Xo={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},Qu={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},$C={longpoll:"longpoll",websocket:"websocket"},OG={complete:4},e_="base64url.bearer.phx.",$b=class{constructor(e,t,n,r){this.channel=e,this.event=t,this.payload=n||function(){return{}},this.receivedResp=null,this.timeout=r,this.timeoutTimer=null,this.recHooks=[],this.sent=!1}resend(e){this.timeout=e,this.reset(),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()}))}receive(e,t){return this.hasReceived(e)&&t(this.receivedResp.response),this.recHooks.push({status:e,callback:t}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}matchReceive({status:e,response:t,_ref:n}){this.recHooks.filter(r=>r.status===e).forEach(r=>r.callback(t))}cancelRefEvent(){this.refEvent&&this.channel.off(this.refEvent)}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}startTimeout(){this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,e=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=e,this.matchReceive(e)}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}trigger(e,t){this.channel.trigger(this.refEvent,{status:e,response:t})}},NO=class{constructor(e,t){this.callback=e,this.timerCalc=t,this.timer=null,this.tries=0}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}},NG=class{constructor(e,t,n){this.state=Xo.closed,this.topic=e,this.params=$0(t||{}),this.socket=n,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new $b(this,Qu.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new NO(()=>{this.socket.isConnected()&&this.rejoin()},this.socket.rejoinAfterMs),this.stateChangeRefs.push(this.socket.onError(()=>this.rejoinTimer.reset())),this.stateChangeRefs.push(this.socket.onOpen(()=>{this.rejoinTimer.reset(),this.isErrored()&&this.rejoin()})),this.joinPush.receive("ok",()=>{this.state=Xo.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(r=>r.send()),this.pushBuffer=[]}),this.joinPush.receive("error",()=>{this.state=Xo.errored,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.onClose(()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic} ${this.joinRef()}`),this.state=Xo.closed,this.socket.remove(this)}),this.onError(r=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,r),this.isJoining()&&this.joinPush.reset(),this.state=Xo.errored,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.joinPush.receive("timeout",()=>{this.socket.hasLogger()&&this.socket.log("channel",`timeout ${this.topic} (${this.joinRef()})`,this.joinPush.timeout),new $b(this,Qu.leave,$0({}),this.timeout).send(),this.state=Xo.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(Qu.reply,(r,a)=>{this.trigger(this.replyEventName(a),r)})}join(e=this.timeout){if(this.joinedOnce)throw new Error("tried to join multiple times. 'join' can only be called a single time per channel instance");return this.timeout=e,this.joinedOnce=!0,this.rejoin(),this.joinPush}onClose(e){this.on(Qu.close,e)}onError(e){return this.on(Qu.error,t=>e(t))}on(e,t){let n=this.bindingRef++;return this.bindings.push({event:e,ref:n,callback:t}),n}off(e,t){this.bindings=this.bindings.filter(n=>!(n.event===e&&(typeof t>"u"||t===n.ref)))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(e,t,n=this.timeout){if(t=t||{},!this.joinedOnce)throw new Error(`tried to push '${e}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let r=new $b(this,e,function(){return t},n);return this.canPush()?r.send():(r.startTimeout(),this.pushBuffer.push(r)),r}leave(e=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=Xo.leaving;let t=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(Qu.close,"leave")},n=new $b(this,Qu.leave,$0({}),e);return n.receive("ok",()=>t()).receive("timeout",()=>t()),n.send(),this.canPush()||n.trigger("ok",{}),n}onMessage(e,t,n){return t}isMember(e,t,n,r){return this.topic!==e?!1:r&&r!==this.joinRef()?(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:e,event:t,payload:n,joinRef:r}),!1):!0}joinRef(){return this.joinPush.ref}rejoin(e=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=Xo.joining,this.joinPush.resend(e))}trigger(e,t,n,r){let a=this.onMessage(e,t,n,r);if(t&&!a)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let s=this.bindings.filter(l=>l.event===e);for(let l=0;l<s.length;l++)s[l].callback(a,n,r||this.joinRef())}replyEventName(e){return`chan_reply_${e}`}isClosed(){return this.state===Xo.closed}isErrored(){return this.state===Xo.errored}isJoined(){return this.state===Xo.joined}isJoining(){return this.state===Xo.joining}isLeaving(){return this.state===Xo.leaving}},eE=class{static request(e,t,n,r,a,s,l){if(Ul.XDomainRequest){let c=new Ul.XDomainRequest;return this.xdomainRequest(c,e,t,r,a,s,l)}else if(Ul.XMLHttpRequest){let c=new Ul.XMLHttpRequest;return this.xhrRequest(c,e,t,n,r,a,s,l)}else{if(Ul.fetch&&Ul.AbortController)return this.fetchRequest(e,t,n,r,a,s,l);throw new Error("No suitable XMLHttpRequest implementation found")}}static fetchRequest(e,t,n,r,a,s,l){let c={method:e,headers:n,body:r},h=null;return a&&(h=new AbortController,setTimeout(()=>h.abort(),a),c.signal=h.signal),Ul.fetch(t,c).then(p=>p.text()).then(p=>this.parseJSON(p)).then(p=>l&&l(p)).catch(p=>{p.name==="AbortError"&&s?s():l&&l(null)}),h}static xdomainRequest(e,t,n,r,a,s,l){return e.timeout=a,e.open(t,n),e.onload=()=>{let c=this.parseJSON(e.responseText);l&&l(c)},s&&(e.ontimeout=s),e.onprogress=()=>{},e.send(r),e}static xhrRequest(e,t,n,r,a,s,l,c){e.open(t,n,!0),e.timeout=s;for(let[h,p]of Object.entries(r))e.setRequestHeader(h,p);return e.onerror=()=>c&&c(null),e.onreadystatechange=()=>{if(e.readyState===OG.complete&&c){let h=this.parseJSON(e.responseText);c(h)}},l&&(e.ontimeout=l),e.send(a),e}static parseJSON(e){if(!e||e==="")return null;try{return JSON.parse(e)}catch{return console&&console.log("failed to parse JSON response",e),null}}static serialize(e,t){let n=[];for(var r in e){if(!Object.prototype.hasOwnProperty.call(e,r))continue;let a=t?`${t}[${r}]`:r,s=e[r];typeof s=="object"?n.push(this.serialize(s,a)):n.push(encodeURIComponent(a)+"="+encodeURIComponent(s))}return n.join("&")}static appendParams(e,t){if(Object.keys(t).length===0)return e;let n=e.match(/\?/)?"&":"?";return`${e}${n}${this.serialize(t)}`}},PG=e=>{let t="",n=new Uint8Array(e),r=n.byteLength;for(let a=0;a<r;a++)t+=String.fromCharCode(n[a]);return btoa(t)},ev=class{constructor(e,t){t&&t.length===2&&t[1].startsWith(e_)&&(this.authToken=atob(t[1].slice(e_.length))),this.endPoint=null,this.token=null,this.skipHeartbeat=!0,this.reqs=new Set,this.awaitingBatchAck=!1,this.currentBatch=null,this.currentBatchTimer=null,this.batchBuffer=[],this.onopen=function(){},this.onerror=function(){},this.onmessage=function(){},this.onclose=function(){},this.pollEndpoint=this.normalizeEndpoint(e),this.readyState=zl.connecting,setTimeout(()=>this.poll(),0)}normalizeEndpoint(e){return e.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+$C.websocket),"$1/"+$C.longpoll)}endpointURL(){return eE.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(e,t,n){this.close(e,t,n),this.readyState=zl.connecting}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===zl.open||this.readyState===zl.connecting}poll(){const e={Accept:"application/json"};this.authToken&&(e["X-Phoenix-AuthToken"]=this.authToken),this.ajax("GET",e,null,()=>this.ontimeout(),t=>{if(t){var{status:n,token:r,messages:a}=t;if(n===410&&this.token!==null){this.onerror(410),this.closeAndRetry(3410,"session_gone",!1);return}this.token=r}else n=0;switch(n){case 200:a.forEach(s=>{setTimeout(()=>this.onmessage({data:s}),0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=zl.open,this.onopen({}),this.poll();break;case 403:this.onerror(403),this.close(1008,"forbidden",!1);break;case 0:case 500:this.onerror(500),this.closeAndRetry(1011,"internal server error",500);break;default:throw new Error(`unhandled poll status ${n}`)}})}send(e){typeof e!="string"&&(e=PG(e)),this.currentBatch?this.currentBatch.push(e):this.awaitingBatchAck?this.batchBuffer.push(e):(this.currentBatch=[e],this.currentBatchTimer=setTimeout(()=>{this.batchSend(this.currentBatch),this.currentBatch=null},0))}batchSend(e){this.awaitingBatchAck=!0,this.ajax("POST",{"Content-Type":"application/x-ndjson"},e.join(`
170
- `),()=>this.onerror("timeout"),t=>{this.awaitingBatchAck=!1,!t||t.status!==200?(this.onerror(t&&t.status),this.closeAndRetry(1011,"internal server error",!1)):this.batchBuffer.length>0&&(this.batchSend(this.batchBuffer),this.batchBuffer=[])})}close(e,t,n){for(let a of this.reqs)a.abort();this.readyState=zl.closed;let r=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:e,reason:t,wasClean:n});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,typeof CloseEvent<"u"?this.onclose(new CloseEvent("close",r)):this.onclose(r)}ajax(e,t,n,r,a){let s,l=()=>{this.reqs.delete(s),r()};s=eE.request(e,this.endpointURL(),t,n,this.timeout,l,c=>{this.reqs.delete(s),this.isActive()&&a(c)}),this.reqs.add(s)}},tE={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(e,t){if(e.payload.constructor===ArrayBuffer)return t(this.binaryEncode(e));{let n=[e.join_ref,e.ref,e.topic,e.event,e.payload];return t(JSON.stringify(n))}},decode(e,t){if(e.constructor===ArrayBuffer)return t(this.binaryDecode(e));{let[n,r,a,s,l]=JSON.parse(e);return t({join_ref:n,ref:r,topic:a,event:s,payload:l})}},binaryEncode(e){let{join_ref:t,ref:n,event:r,topic:a,payload:s}=e,l=this.META_LENGTH+t.length+n.length+a.length+r.length,c=new ArrayBuffer(this.HEADER_LENGTH+l),h=new DataView(c),p=0;h.setUint8(p++,this.KINDS.push),h.setUint8(p++,t.length),h.setUint8(p++,n.length),h.setUint8(p++,a.length),h.setUint8(p++,r.length),Array.from(t,y=>h.setUint8(p++,y.charCodeAt(0))),Array.from(n,y=>h.setUint8(p++,y.charCodeAt(0))),Array.from(a,y=>h.setUint8(p++,y.charCodeAt(0))),Array.from(r,y=>h.setUint8(p++,y.charCodeAt(0)));var v=new Uint8Array(c.byteLength+s.byteLength);return v.set(new Uint8Array(c),0),v.set(new Uint8Array(s),c.byteLength),v.buffer},binaryDecode(e){let t=new DataView(e),n=t.getUint8(0),r=new TextDecoder;switch(n){case this.KINDS.push:return this.decodePush(e,t,r);case this.KINDS.reply:return this.decodeReply(e,t,r);case this.KINDS.broadcast:return this.decodeBroadcast(e,t,r)}},decodePush(e,t,n){let r=t.getUint8(1),a=t.getUint8(2),s=t.getUint8(3),l=this.HEADER_LENGTH+this.META_LENGTH-1,c=n.decode(e.slice(l,l+r));l=l+r;let h=n.decode(e.slice(l,l+a));l=l+a;let p=n.decode(e.slice(l,l+s));l=l+s;let v=e.slice(l,e.byteLength);return{join_ref:c,ref:null,topic:h,event:p,payload:v}},decodeReply(e,t,n){let r=t.getUint8(1),a=t.getUint8(2),s=t.getUint8(3),l=t.getUint8(4),c=this.HEADER_LENGTH+this.META_LENGTH,h=n.decode(e.slice(c,c+r));c=c+r;let p=n.decode(e.slice(c,c+a));c=c+a;let v=n.decode(e.slice(c,c+s));c=c+s;let y=n.decode(e.slice(c,c+l));c=c+l;let w=e.slice(c,e.byteLength),T={status:y,response:w};return{join_ref:h,ref:p,topic:v,event:Qu.reply,payload:T}},decodeBroadcast(e,t,n){let r=t.getUint8(1),a=t.getUint8(2),s=this.HEADER_LENGTH+2,l=n.decode(e.slice(s,s+r));s=s+r;let c=n.decode(e.slice(s,s+a));s=s+a;let h=e.slice(s,e.byteLength);return{join_ref:null,ref:null,topic:l,event:c,payload:h}}},IG=class{constructor(e,t={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=t.timeout||DG,this.transport=t.transport||Ul.WebSocket||ev,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=t.longPollFallbackMs,this.fallbackTimer=null,this.sessionStore=t.sessionStorage||Ul&&Ul.sessionStorage,this.establishedConnections=0,this.defaultEncoder=tE.encode.bind(tE),this.defaultDecoder=tE.decode.bind(tE),this.closeWasClean=!1,this.disconnecting=!1,this.binaryType=t.binaryType||"arraybuffer",this.connectClock=1,this.pageHidden=!1,this.transport!==ev?(this.encode=t.encode||this.defaultEncoder,this.decode=t.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let n=null;Fp&&Fp.addEventListener&&(Fp.addEventListener("pagehide",r=>{this.conn&&(this.disconnect(),n=this.connectClock)}),Fp.addEventListener("pageshow",r=>{n===this.connectClock&&(n=null,this.connect())}),Fp.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"?this.pageHidden=!0:(this.pageHidden=!1,this.isConnected()||this.teardown(()=>this.connect()))})),this.heartbeatIntervalMs=t.heartbeatIntervalMs||3e4,this.rejoinAfterMs=r=>t.rejoinAfterMs?t.rejoinAfterMs(r):[1e3,2e3,5e3][r-1]||1e4,this.reconnectAfterMs=r=>t.reconnectAfterMs?t.reconnectAfterMs(r):[10,50,100,150,200,250,500,1e3,2e3][r-1]||5e3,this.logger=t.logger||null,!this.logger&&t.debug&&(this.logger=(r,a,s)=>{console.log(`${r}: ${a}`,s)}),this.longpollerTimeout=t.longpollerTimeout||2e4,this.params=$0(t.params||{}),this.endPoint=`${e}/${$C.websocket}`,this.vsn=t.vsn||RG,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new NO(()=>{if(this.pageHidden){this.log("Not reconnecting as page is hidden!"),this.teardown();return}this.teardown(()=>this.connect())},this.reconnectAfterMs),this.authToken=t.authToken}getLongPollTransport(){return ev}replaceTransport(e){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.conn&&(this.conn.close(),this.conn=null),this.transport=e}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let e=eE.appendParams(eE.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return e.charAt(0)!=="/"?e:e.charAt(1)==="/"?`${this.protocol()}:${e}`:`${this.protocol()}://${location.host}${e}`}disconnect(e,t,n){this.connectClock++,this.disconnecting=!0,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(()=>{this.disconnecting=!1,e&&e()},t,n)}connect(e){e&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=$0(e)),!(this.conn&&!this.disconnecting)&&(this.longPollFallbackMs&&this.transport!==ev?this.connectWithFallback(ev,this.longPollFallbackMs):this.transportConnect())}log(e,t,n){this.logger&&this.logger(e,t,n)}hasLogger(){return this.logger!==null}onOpen(e){let t=this.makeRef();return this.stateChangeCallbacks.open.push([t,e]),t}onClose(e){let t=this.makeRef();return this.stateChangeCallbacks.close.push([t,e]),t}onError(e){let t=this.makeRef();return this.stateChangeCallbacks.error.push([t,e]),t}onMessage(e){let t=this.makeRef();return this.stateChangeCallbacks.message.push([t,e]),t}ping(e){if(!this.isConnected())return!1;let t=this.makeRef(),n=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:t});let r=this.onMessage(a=>{a.ref===t&&(this.off([r]),e(Date.now()-n))});return!0}transportConnect(){this.connectClock++,this.closeWasClean=!1;let e;this.authToken&&(e=["phoenix",`${e_}${btoa(this.authToken).replace(/=/g,"")}`]),this.conn=new this.transport(this.endPointURL(),e),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=t=>this.onConnError(t),this.conn.onmessage=t=>this.onConnMessage(t),this.conn.onclose=t=>this.onConnClose(t)}getSession(e){return this.sessionStore&&this.sessionStore.getItem(e)}storeSession(e,t){this.sessionStore&&this.sessionStore.setItem(e,t)}connectWithFallback(e,t=2500){clearTimeout(this.fallbackTimer);let n=!1,r=!0,a,s,l=c=>{this.log("transport",`falling back to ${e.name}...`,c),this.off([a,s]),r=!1,this.replaceTransport(e),this.transportConnect()};if(this.getSession(`phx:fallback:${e.name}`))return l("memorized");this.fallbackTimer=setTimeout(l,t),s=this.onError(c=>{this.log("transport","error",c),r&&!n&&(clearTimeout(this.fallbackTimer),l(c))}),this.fallbackRef&&this.off([this.fallbackRef]),this.fallbackRef=this.onOpen(()=>{if(n=!0,!r)return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${e.name}`,"true"),this.log("transport",`established ${e.name} fallback`);clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(l,t),this.ping(c=>{this.log("transport","connected to primary after",c),this.primaryPassedHealthCheck=!0,clearTimeout(this.fallbackTimer)})}),this.transportConnect()}clearHeartbeats(){clearTimeout(this.heartbeatTimer),clearTimeout(this.heartbeatTimeoutTimer)}onConnOpen(){this.hasLogger()&&this.log("transport",`${this.transport.name} connected to ${this.endPointURL()}`),this.closeWasClean=!1,this.disconnecting=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.resetHeartbeat(),this.stateChangeCallbacks.open.forEach(([,e])=>e())}heartbeatTimeout(){this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection"),this.triggerChanError(),this.closeWasClean=!1,this.teardown(()=>this.reconnectTimer.scheduleTimeout(),LG,"heartbeat timeout"))}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}teardown(e,t,n){if(!this.conn)return e&&e();let r=this.connectClock;this.waitForBufferDone(()=>{r===this.connectClock&&(this.conn&&(t?this.conn.close(t,n||""):this.conn.close()),this.waitForSocketClosed(()=>{r===this.connectClock&&(this.conn&&(this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){},this.conn.onclose=function(){},this.conn=null),e&&e())}))})}waitForBufferDone(e,t=1){if(t===5||!this.conn||!this.conn.bufferedAmount){e();return}setTimeout(()=>{this.waitForBufferDone(e,t+1)},150*t)}waitForSocketClosed(e,t=1){if(t===5||!this.conn||this.conn.readyState===zl.closed){e();return}setTimeout(()=>{this.waitForSocketClosed(e,t+1)},150*t)}onConnClose(e){this.conn&&(this.conn.onclose=()=>{});let t=e&&e.code;this.hasLogger()&&this.log("transport","close",e),this.triggerChanError(),this.clearHeartbeats(),!this.closeWasClean&&t!==1e3&&this.reconnectTimer.scheduleTimeout(),this.stateChangeCallbacks.close.forEach(([,n])=>n(e))}onConnError(e){this.hasLogger()&&this.log("transport",e);let t=this.transport,n=this.establishedConnections;this.stateChangeCallbacks.error.forEach(([,r])=>{r(e,t,n)}),(t===this.transport||n>0)&&this.triggerChanError()}triggerChanError(){this.channels.forEach(e=>{e.isErrored()||e.isLeaving()||e.isClosed()||e.trigger(Qu.error)})}connectionState(){switch(this.conn&&this.conn.readyState){case zl.connecting:return"connecting";case zl.open:return"open";case zl.closing:return"closing";default:return"closed"}}isConnected(){return this.connectionState()==="open"}remove(e){this.off(e.stateChangeRefs),this.channels=this.channels.filter(t=>t!==e)}off(e){for(let t in this.stateChangeCallbacks)this.stateChangeCallbacks[t]=this.stateChangeCallbacks[t].filter(([n])=>e.indexOf(n)===-1)}channel(e,t={}){let n=new NG(e,t,this);return this.channels.push(n),n}push(e){if(this.hasLogger()){let{topic:t,event:n,payload:r,ref:a,join_ref:s}=e;this.log("push",`${t} ${n} (${s}, ${a})`,r)}this.isConnected()?this.encode(e,t=>this.conn.send(t)):this.sendBuffer.push(()=>this.encode(e,t=>this.conn.send(t)))}makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}sendHeartbeat(){this.pendingHeartbeatRef&&!this.isConnected()||(this.pendingHeartbeatRef=this.makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef}),this.heartbeatTimeoutTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs))}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}onConnMessage(e){this.decode(e.data,t=>{let{topic:n,event:r,payload:a,ref:s,join_ref:l}=t;s&&s===this.pendingHeartbeatRef&&(this.clearHeartbeats(),this.pendingHeartbeatRef=null,this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)),this.hasLogger()&&this.log("receive",`${a.status||""} ${n} ${r} ${s&&"("+s+")"||""}`,a);for(let c=0;c<this.channels.length;c++){const h=this.channels[c];h.isMember(n,r,a,l)&&h.trigger(r,a,s,l)}for(let c=0;c<this.stateChangeCallbacks.message.length;c++){let[,h]=this.stateChangeCallbacks.message[c];h(t)}})}leaveOpenTopic(e){let t=this.channels.find(n=>n.topic===e&&(n.isJoined()||n.isJoining()));t&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${e}"`),t.leave())}};const MG=e=>{const t=e||rO(),[n,r]=t.split("://");return`${n==="https"?"wss":"ws"}://${r}/socket`};class FG extends AG{constructor(t){super(),this.config=t,this.channel=null,this.reconnectTimer=null,this.subscribeOptions=null,this.currentConversationId=null;const n=MG(t.baseUrl);typeof WebSocket>"u"&&Da(new Error("Failed to create WebSocket connection: WebSocket is not supported in this environment")),this.socket=new IG(n,{params:{token:t.channelId},heartbeatIntervalMs:3e4,longPollFallbackMs:2500,longpollerTimeout:3e4,reconnectAfterMs:r=>[1e3,2e3,4e3,8e3,16e3][r-1]||3e4}),this.socket.onOpen(()=>{this.setConnectionState("connected")}),this.socket.onError(r=>{Da(new Error(`WebSocket error occurred: ${JSON.stringify(r)}`)),this.handleSocketDisconnect()}),this.socket.onClose(()=>{this.setConnectionState("disconnected"),this.handleSocketDisconnect()})}async connect(){return new Promise(t=>{this.socket.connect();const n=()=>{this.socket.isConnected()?t():setTimeout(n,100)};n()})}disconnect(){this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.channel&&(this.channel.leave(),this.channel=null),this.socket&&this.socket.disconnect(),this.setConnectionState("disconnected")}async subscribe(t,n){this.currentConversationId=t,this.subscribeOptions=n,this.channel&&this.channel.leave(),this.channel=this.socket.channel(`conversations:${t}`,{user_id:n.userId,metadata:n.metadata,locale:n.locale,no_answer_fallback:n.noAnswerFallback,inactivity_timeout:0}),this.channel.on("phx_error",r=>{this.notifyError(new Error(`PHX error: ${JSON.stringify(r)}`))}),this.channel.on("stream_message",r=>{this.notifyMessage(r)}),this.channel.on("stream_event",r=>{this.notifyMessage(r)}),this.channel.on("loading",()=>{}),this.channel.join().receive("ok",()=>{}).receive("error",r=>{this.notifyError(new Error(`Unable to join conversation: ${JSON.stringify(r)}`))}).receive("timeout",()=>{this.notifyError(new Error("Channel join attempt timed out")),setTimeout(()=>this.subscribe(t,n),5e3)})}unsubscribe(){this.channel&&(this.channel.leave(),this.channel=null),this.currentConversationId=null,this.subscribeOptions=null}async sendMessageEvent(t){return new Promise((n,r)=>{if(!this.channel){r(new Error("No channel available"));return}this.channel.push("new_text",t).receive("ok",a=>{a[0]&&this.notifyMessage(a[0]),n()}).receive("error",a=>{const s=new Error(`Error sending message: ${JSON.stringify(a)}`);Da(s),r(s)}).receive("timeout",()=>{const a=new Error("Push request timed out");Da(a),r(a)})})}async sendActionEvent(t,n){return new Promise((r,a)=>{if(!this.channel){a(new Error("No channel available"));return}this.channel.push("action-event",{name:t,...n}).receive("ok",()=>{r()}).receive("error",()=>{a(new Error("Failed to send action event"))}).receive("timeout",()=>{a(new Error("Action event timed out"))})})}async sendConversationRatingEvent(t){return new Promise((n,r)=>{if(!this.channel){r(new Error("No channel available"));return}this.channel.push("conversation_rating",t).receive("ok",()=>{n()}).receive("error",a=>{const s=new Error(`Error sending conversation rating: ${JSON.stringify(a)}`);Da(s),r(s)}).receive("timeout",()=>{const a=new Error("Conversation rating request timed out");Da(a),r(a)})})}async sendConversationClosedEvent(t){return new Promise((n,r)=>{if(!this.channel){r(new Error("No channel available"));return}this.channel.push("conversation_closed",{reasoning:t}).receive("ok",()=>{n()}).receive("error",a=>{const s=new Error(`Error sending conversation closed event: ${JSON.stringify(a)}`);Da(s),r(s)}).receive("timeout",()=>{const a=new Error("Conversation closed event timed out");Da(a),r(a)})})}handleSocketDisconnect(){if(this.reconnectTimer)return;let t=0;const n=10,r=async()=>{if(this.socket.isConnected()){this.reconnectTimer=null,this.currentConversationId&&this.subscribeOptions&&await this.subscribe(this.currentConversationId,this.subscribeOptions);return}if(t+=1,t>n){this.reconnectTimer=null,this.setConnectionState("error"),this.notifyError(new Error("Maximum reconnection attempts exceeded."));return}this.setConnectionState("connecting"),this.socket.connect();const a=Math.min(1e3*Math.pow(2,t),3e4);this.reconnectTimer=setTimeout(r,a)};r()}}const PO=_.createContext(null),BG=({children:e,config:t})=>{const n=_.useMemo(()=>{const r={type:"phoenix",channelId:t.channelId,baseUrl:t.baseUrl,debug:t.debug};return new FG(r)},[t.channelId,t.baseUrl,t.debug]);return _.useEffect(()=>()=>{n.disconnect()},[n]),F.jsx(PO.Provider,{value:n,children:e})},t_=()=>{const e=_.useContext(PO);if(!e)throw new Error("useWebsocketClient must be used within a WebsocketClientProvider");return e},HG=(e=[])=>{const t=t_(),[n,r]=_.useState(e);_.useEffect(()=>t.onMessage(l=>{r(c=>UG(c,l))}),[t]);const a=_.useCallback(()=>{r([])},[]);return{messages:n,setMessages:r,resetMessages:a}},UG=(e,t)=>{const n=e.findIndex(r=>r.id===t.id&&r.sender_id===t.sender_id);return n>=0?e.map((r,a)=>a===n?t:r):[...e,t]},zG="freeday:",jG=e=>{try{return e&&(e.localStorage||e.sessionStorage)}catch{return{_db:{},getItem(n){return this._db[n]||null},setItem(n,r){this._db[n]=r},removeItem(n){delete this._db[n]}}}};function VG(e){const t=jG(e),n=l=>`${zG}${l}`,r=l=>{const c=t.getItem(n(l));if(!c)return null;try{return JSON.parse(c)}catch{return c}},a=(l,c)=>{t.setItem(n(l),JSON.stringify(c))},s=l=>{t.removeItem(n(l))};return{getUserId:()=>r("user_id"),setUserId:l=>a("user_id",l),removeUserId:()=>s("user_id"),setConversationId:l=>a("conversation_id",l),getConversationId:()=>r("conversation_id"),removeConversationId:()=>s("conversation_id"),setChannelId:l=>a("channel_id",l),getChannelId:()=>r("channel_id")}}class WG extends Error{constructor(t,n){super(t),this.name="ApiError",this.statusCode=n}}class nE{constructor(t=Rz){this.baseUrl=t}getDefaultOptions(t,n){return n instanceof FormData?{method:t,body:n}:{method:t,headers:{"Content-Type":"application/json"},body:n?JSON.stringify(n):void 0}}async fetch(t,n,r){try{const a=await fetch(t,this.getDefaultOptions(n,r));if(!a.ok)throw new WG(`${n} request failed: ${a.statusText}`,a.status);return a.json()}catch(a){throw Da(a),a}}async get(t,n={}){const r=new URLSearchParams(n).toString(),a=`${this.baseUrl}${t}?${r}`;return this.fetch(a,"GET")}async post(t,n){const r=`${this.baseUrl}${t}`;return this.fetch(r,"POST",n)}async put(t,n){const r=`${this.baseUrl}${t}`;return this.fetch(r,"PUT",n)}}class YG{constructor(t,n){this.token=t,this.http=new nE(n)}async healthCheck(){return this.http.get("/api/health-check").then(t=>t.status)}async updateWidgetSettingsMetadata(t){return this.http.put(`/api/widget/settings/${this.token}/metadata`,t)}async createNewUser(t={}){return this.http.post("/api/users",{user:{...t,first_seen:new Date().toISOString(),last_seen_at:new Date().toISOString()}}).then(n=>n.data)}async createNewConversation(t,n){return this.http.post("/api/conversations",{conversation:{user_id:t,token:n}}).then(r=>r.data)}}class n_{constructor(t,n){this.WEBCHAT_URL_PATH="/webchat/v1",this.channelId=t,this.http=n}mapToWidgetSettings(t){return{channelId:this.channelId,subtitle:t.subtitle,title:t.title,theme:t.theme,primaryColor:t.primary_color,digitalEmployeeName:t.bot_name,avatar:t.avatar,newMessagePlaceholder:t.new_message_placeholder,showFreedayBranding:t.show_freeday_branding,language:t.locale,disclaimer:t.disclaimer,bannerTitle:t.popup_title,bannerMessage:t.popup_message,enableCsat:t.enable_csat,enableAttachments:t.enable_attachments,startView:t.start_view_type,suggestions:t.start_view_suggestions,foldableStartViewTitle:t.foldable_start_view_title,foldableStartViewSubtitle:t.foldable_start_view_subtitle,noAnswerFallback:t.no_answer_fallback,analyticsEnabled:t.analytics_enabled,intro:{type:t.intro_type??m0.NONE,title:t.intro_title,description:t.intro_description}}}async fetchWidgetSettings(){return this.http.get(`${this.WEBCHAT_URL_PATH}/widget/${this.channelId}/settings`).then(t=>this.mapToWidgetSettings(t))}async fetchConversationById(t){return this.http.get(`${this.WEBCHAT_URL_PATH}/widget/${this.channelId}/conversations/${t}/events`)}async uploadAttachment(t){const n=new FormData;return n.append("file",t),this.http.post(`${this.WEBCHAT_URL_PATH}/widget/${this.channelId}/attachment`,n)}}const qG=({channelId:e})=>{const t=_.useMemo(()=>VG(globalThis),[]),[n,r]=_.useState(()=>t.getConversationId()??null),[a,s]=_.useState(()=>t.getUserId()??null),[l,c]=_.useState(!1);_.useEffect(()=>{t.getChannelId()!==e&&(t.removeConversationId(),r(null)),t.setChannelId(e)},[e,t]);const h=_.useCallback(async()=>{c(!0);const y=new YG(e,rO()),w=async()=>(await y.createNewUser({})).id;try{const T=a??await w(),A=await y.createNewConversation(T,e);return r(A.id),t.setConversationId(A.id),s(T),t.setUserId(T),{conversationId:A.id,userId:T}}catch(T){return Da(T,"Failed to create conversation"),null}finally{c(!1)}},[t,a,e]),p=_.useCallback(async()=>{if(!n)return null;try{return await new n_(e,new nE(jC())).fetchConversationById(n)}catch(y){return Da(y,"Error fetching conversation events"),null}},[n]),v=_.useCallback(()=>{r(null),t.removeConversationId()},[t]);return{conversationId:n,userId:a,isInitializing:l,createConversation:h,resumeConversation:p,resetConversation:v}},GG=()=>{const e=t_(),[t,n]=_.useState(()=>e.connectionState);_.useEffect(()=>{const c=e.onConnectionStateChange(h=>{n(h)});return n(e.connectionState),c},[e]);const r=_.useCallback(async()=>{await e.connect()},[e]),a=_.useCallback(()=>{e.disconnect()},[e]),s=_.useCallback(async(c,h)=>{await e.subscribe(c,h)},[e]),l=_.useCallback(()=>{e.unsubscribe()},[e]);return{connectionState:t,isConnected:t==="connected",connect:r,disconnect:a,subscribe:s,unsubscribe:l}},KG=()=>{const e=t_(),t=_.useCallback(async s=>{(s.text?.trim().length>0||s.image)&&await e.sendMessageEvent(s)},[e]),n=_.useCallback(async(s,l)=>{await e.sendActionEvent(s,l)},[e]),r=_.useCallback(async s=>{await e.sendConversationRatingEvent(s)},[e]),a=_.useCallback(async s=>{await e.sendConversationClosedEvent(s)},[e]);return{sendMessageEvent:t,sendActionEvent:n,sendConversationRatingEvent:r,sendConversationClosedEvent:a}},QG=e=>{const t=e.flatMap(r=>r.blocks.filter(a=>a.type==="typing")),n=t[t.length-1];return!!n&&n.typing},IO=_.createContext({scrollableDivRef:{current:null},endDivRef:{current:null},buttonGroupPortalRef:{current:null},chatWindowRef:{current:null},chatWindowContentRef:{current:null},state:{messages:[],userId:null,conversationId:null,settings:{},isWaitingOnFirstStream:!1,hasSentMessageThisSession:!1,hasResumedConversation:!1,isOpen:!1,isTyping:!1,shouldDisplayBranding:!1,showFeedbackModal:!1,inShadowDom:!0},sendNewMessage:async()=>{},sendConversationRating:async()=>{},sendConversationClosed:async()=>{},handleRestart:()=>{},handleEnd:()=>{},handleActionEvent:()=>{}}),ai=()=>_.useContext(IO);function XG({children:e,config:t,inShadowDom:n=!1}){const{i18n:r}=Gr(["menu"]),a=_.useRef(!1),s={title:"Welcome!",subtitle:"How can we help you?",primaryColor:"#1890ff",dropdownItems:[],closeable:!0,debug:!1,version:"1.2.0"},[l,c]=_.useState({...s,...t}),{messages:h,setMessages:p,resetMessages:v}=HG(t?.messages||[]),{conversationId:y,userId:w,createConversation:T,resumeConversation:A,resetConversation:R}=qG({channelId:t.channelId}),{connect:N,disconnect:O,subscribe:M,unsubscribe:H}=GG(),{sendMessageEvent:V,sendActionEvent:K,sendConversationRatingEvent:Y,sendConversationClosedEvent:Z}=KG(),{updateCssVariables:X}=CG(),{emit:ce,subscribe:W,unsubscribe:me}=Jb(),oe=_.useRef(null),te=_.useRef(null),le=_.useRef(null),Ae=_.useRef(null),_e=_.useRef(null),[ve,se]=_.useState(!1),[De,U]=_.useState(!1),[$,be]=_.useState(!1),[j,Ue]=_.useState(!1);_.useEffect(()=>{if(h.length>0&&$){const Bt=h.at(-1);Bt&&!Cf(Bt,w)&&be(!1)}},[h,w,$]);const Ke=_.useCallback(async(Bt,Jt)=>{await M(Bt,{userId:Jt,metadata:l.metadata,locale:l.language,noAnswerFallback:l.noAnswerFallback})},[M,l]),Qe=_.useCallback(async()=>{const Bt=await T();return Bt&&await Ke(Bt.conversationId,Bt.userId),Bt},[T,M,l]),St=_.useCallback(async()=>{try{if(await N(),y){const Bt=await A();Bt&&(p(Bt.events),Ue(!0)),await Ke(y,w||"")}else await Qe();Of("chat:loaded",{start_view:l.startView}),ce("chat:loaded")}catch(Bt){Da(Bt,"Failed to initialize chat")}},[N,y,A,p,M,w,l,Qe,Ke,ce]);_.useEffect(()=>{a.current||(a.current=!0)},[]),_.useEffect(()=>()=>{O()},[O]);const qe=_.useCallback(async Bt=>{const Jt=Bt;c(yr=>({...yr,...Jt,metadata:Jt.metadata??{}})),Jt.primaryColor&&X({"--primary":zC(Jt.primaryColor)}),await r.changeLanguage(Jt.language),await St(),Bt.suggestionMessage&&setTimeout(async()=>{await pn({text:Bt.suggestionMessage})},1e3)},[X,r,St]),Rt=_.useCallback(Bt=>{se(!!Bt.isOpen)},[]),_t=_.useCallback(async()=>{await Z("user restarted the chat"),H(),v(),R(),await Qe()},[Z,H,v,R,Qe]),Zt=_.useCallback(()=>{H(),O(),v(),R(),localStorage.removeItem("freeday:intro_seen")},[H,O,v,R]);_.useEffect(()=>(W(Nr.START,qe),W(Nr.TOGGLE,Rt),W(Nr.RESTART,_t),()=>{me(Nr.START,qe),me(Nr.TOGGLE,Rt),me(Nr.RESTART,_t)}),[W,me,qe,Rt,_t]);const pn=_.useCallback(async Bt=>{U(!0),be(!0),h.some(yr=>Cf(yr,w))||Of("conversation:started",{start_view:l.startView}),ce("message:sent",{text:Bt.text,hasImage:!!Bt.image}),y||await Qe(),await V(Bt)},[h,w,l,ce,y,Qe,V]),xn=_.useMemo(()=>QG(h),[h]),ut=_.useMemo(()=>({messages:h,userId:w,conversationId:y,settings:l,isWaitingOnFirstStream:$,hasSentMessageThisSession:De,hasResumedConversation:j,isTyping:xn,isOpen:ve,shouldDisplayBranding:l?.showFreedayBranding??!1,showFeedbackModal:!1,inShadowDom:n}),[h,w,y,l,$,De,j,xn,ve,n]),qn=_.useMemo(()=>({state:ut,sendNewMessage:pn,handleRestart:_t,handleEnd:Zt,scrollableDivRef:oe,endDivRef:te,handleActionEvent:K,sendConversationRating:Y,sendConversationClosed:Z,buttonGroupPortalRef:le,chatWindowRef:Ae,chatWindowContentRef:_e}),[ut,pn,_t,Zt,K,Y,Z]);return F.jsx(IO.Provider,{value:qn,children:F.jsx(OO,{primaryColor:ut.settings?.primaryColor||t.primaryColor,children:e})})}const ZG=aq,JG=oq,$G=sq,MO=_.forwardRef(({className:e,sideOffset:t=4,...n},r)=>{const{state:a}=ai();return a?.inShadowDom?F.jsx(FC,{ref:r,sideOffset:t,className:ka("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n}):F.jsx(lq,{children:F.jsx(FC,{ref:r,sideOffset:t,className:ka("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})})});MO.displayName=FC.displayName;const eK={en:{common:{sourceCallToActionLabel:"View",sending:"Sending...",isThinking:"Is thinking...",send:"Send",openChat:"Open chat",closeNotification:"Close notification",bot:"The bot"},intro:{startChat:"Start chat"},header:{tooltipMinimizeChat:"Minimize chat",tooltipClose:"Close",tooltipOptions:"Options",typing:" is typing..."},feedback:{thumbsUp:"Helpful",thumbsDown:"Not helpful",modalPlaceholder:"Please provide your feedback here",modalTitle:"How could we improve our response?",modalDescription:"Can you tell us what went wrong?",modalSubmit:"Send",modalSubmittedTitle:"Thank you for your feedback",modalSubmittedDescription:"Your feedback will help us to enhance our service!"},menu:{menuTitle:"Options",restartConversationLabel:"Start new conversation"},footer:{newMessagePlaceholder:"Type a message..."},upload:{uploadImageButton:"Upload Image",uploadingText:"Uploading...",invalidFileType:"Please select a valid image file (JPEG, PNG, GIF or WebP)",fileSizeExceeded:"File size must be less than {{maxSize}}MB",processingError:"Failed to process image. Please try again.",imageLoadError:"Image unavailable",removeAttachment:"Remove attachment"},rateConversation:{header:"Rate your conversation",feedbackMessagePlacholder:"Share additional feedback (optional)",submittedTitle:"Thank you for your feedback!",submittedDescription:"Your feedback will help us to enhance our service!",submitFeedbackMessage:"Send",submittingFeedbackMessage:"Sending...",noFeedback:"No feedback"},resumeChat:{title:"Welcome back 👋!",subtitle:"Want to continue where you left off?",continueButton:"Yes, continue my conversation",startNewButton:"Start a new conversation"},closeChat:{title:"Do you want to end this chat?",description:"Once you close it, you won't be able to continue the conversation.",confirmButton:"Yes, I am done",cancelButton:"No, take me back"},modal:{close:"Close",back:"Back"}},nl:{common:{sourceCallToActionLabel:"Bekijk",sending:"Verzenden...",isThinking:"Is aan het denken...",send:"Versturen",openChat:"Open chat",closeNotification:"Sluit melding",bot:"De bot"},intro:{startChat:"Chat starten"},header:{tooltipMinimizeChat:"Minimaliseer chat",tooltipClose:"Sluit",tooltipOptions:"Opties",typing:" is aan het typen..."},feedback:{thumbsUp:"Nuttig",thumbsDown:"Niet nuttig",modalPlaceholder:"Deel hier jouw feedback",modalTitle:"Hoe kunnen we jouw ervaring verbeteren?",modalDescription:"Kun je ons vertellen wat er mis ging?",modalSubmit:"Deel feedback",modalSubmittedTitle:"Bedankt voor jouw feedback",modalSubmittedDescription:"Jouw feedback helpt ons om onze service te verbeteren!"},menu:{menuTitle:"Opties",restartConversationLabel:"Start nieuw gesprek"},footer:{newMessagePlaceholder:"Schrijf hier je bericht"},upload:{uploadImageButton:"Afbeelding uploaden",uploadingText:"Bezig met uploaden...",invalidFileType:"Selecteer een geldig afbeeldingsbestand (JPEG, PNG, GIF of WebP)",fileSizeExceeded:"Bestandsgrootte moet kleiner zijn dan {{maxSize}}MB",processingError:"Afbeelding verwerken mislukt. Probeer het opnieuw.",imageLoadError:"Afbeelding niet beschikbaar",removeAttachment:"Bijlage verwijderen"},rateConversation:{header:"Hoe was jouw gesprek?",feedbackMessagePlacholder:"Deel hier jouw feedback (optioneel)",submittedTitle:"Bedankt voor de feedback!",submittedDescription:"Dit helpt ons enorm om onze service te verbeteren.",submitFeedbackMessage:"Verstuur",submittingFeedbackMessage:"Bezig met versturen...",noFeedback:"Geen feedback"},resumeChat:{title:"Welkom terug 👋!",subtitle:"Wil je verdergaan waar je was gebleven?",continueButton:"Ja, ga verder met mijn gesprek",startNewButton:"Start een nieuw gesprek"},closeChat:{title:"Wil je deze chat beëindigen?",description:"Zodra je de chat sluit, kun je het gesprek niet meer voortzetten.",confirmButton:"Ja, ik ben klaar",cancelButton:"Nee, ga terug"},modal:{close:"Sluit",back:"Terug"}},fr:{common:{sourceCallToActionLabel:"Voir",sending:"Envoi...",isThinking:"Est en train de penser...",send:"Envoyer",openChat:"Ouvrir le chat",closeNotification:"Fermer la notification",bot:"Le bot"},intro:{startChat:"Ouvrir le chat"},header:{tooltipMinimizeChat:"Minimiser le chat",tooltipClose:"Fermer",tooltipOptions:"Options",typing:" est en train d’écrire..."},feedback:{thumbsUp:"Utile",thumbsDown:"Pas utile",modalPlaceholder:"Veuillez fournir vos commentaires ici",modalTitle:"Comment pouvons-nous améliorer notre réponse ?",modalDescription:"Pouvez-vous nous dire ce qui n’a pas fonctionné ?",modalSubmit:"Envoyer",modalSubmittedTitle:"Merci pour votre retour",modalSubmittedDescription:"Vos commentaires nous aideront à améliorer notre service !"},menu:{menuTitle:"Options",restartConversationLabel:"Démarrer une nouvelle conversation"},footer:{newMessagePlaceholder:"Tapez un message..."},upload:{uploadImageButton:"Télécharger une image",uploadingText:"Téléchargement...",invalidFileType:"Veuillez sélectionner un fichier image valide (JPEG, PNG, GIF ou WebP)",fileSizeExceeded:"La taille du fichier doit être inférieure à {{maxSize}}MB",processingError:"Échec du traitement de l'image. Veuillez réessayer.",imageLoadError:"Image non disponible",removeAttachment:"Supprimer la pièce jointe"},rateConversation:{header:"Comment s'est déroulée votre entretien?",feedbackMessagePlacholder:"Partagez vos commentaires ici (optionnel)",submittedTitle:"Merci pour le retour d'information!",submittedDescription:"Vos commentaires nous aideront à améliorer notre service.",submitFeedbackMessage:"Envoyer",submittingFeedbackMessage:"Envoi en cours...",noFeedback:"Pas de commentaire"},resumeChat:{title:"Bon retour 👋!",subtitle:"Voulez-vous reprendre où vous vous êtes arrêté?",continueButton:"Oui, continuer ma conversation",startNewButton:"Démarrer une nouvelle conversation"},closeChat:{title:"Voulez-vous terminer cette conversation?",description:"Une fois fermée, vous ne pourrez plus continuer la conversation.",confirmButton:"Oui, j'ai terminé",cancelButton:"Non, revenir en arrière"},modal:{close:"Fermer",back:"Retour"}},it:{common:{sourceCallToActionLabel:"Visualizza",sending:"Invio in corso...",isThinking:"Sta pensando...",send:"Invia",openChat:"Apri chat",closeNotification:"Chiudi notifica",bot:"Il bot"},intro:{startChat:"Apri chat"},header:{tooltipMinimizeChat:"Minimizza la chat",tooltipClose:"Chiudi",tooltipOptions:"Opzioni",typing:" sta scrivendo..."},feedback:{thumbsUp:"Utile",thumbsDown:"Non utile",modalPlaceholder:"Fornisci il tuo feedback qui",modalTitle:"Come possiamo migliorare la nostra risposta?",modalDescription:"Puoi dirci cosa non ha funzionato?",modalSubmit:"Invia",modalSubmittedTitle:"Grazie per il tuo feedback",modalSubmittedDescription:"Il tuo feedback ci aiuterà a migliorare il nostro servizio!"},menu:{menuTitle:"Opzioni",restartConversationLabel:"Inizia una nuova conversazione"},footer:{newMessagePlaceholder:"Scrivi un messaggio..."},upload:{uploadImageButton:"Carica immagine",uploadingText:"Caricamento...",invalidFileType:"Seleziona un file immagine valido (JPEG, PNG, GIF o WebP)",fileSizeExceeded:"La dimensione del file deve essere inferiore a {{maxSize}}MB",processingError:"Elaborazione dell'immagine non riuscita. Riprova.",imageLoadError:"Immagine non disponibile",removeAttachment:"Rimuovi allegato"},rateConversation:{header:"Valuta la tua conversazione",feedbackMessagePlacholder:"Condividi un feedback aggiuntivo (opzionale)",submittedTitle:"Grazie per il tuo feedback!",submittedDescription:"Il tuo feedback ci aiuterà a migliorare il nostro servizio!",submitFeedbackMessage:"Invia",submittingFeedbackMessage:"Invio in corso...",noFeedback:"Nessun feedback"},resumeChat:{title:"Bentornato 👋!",subtitle:"Vuoi continuare da dove eri rimasto?",continueButton:"Sì, continua la mia conversazione",startNewButton:"Inizia una nuova conversazione"},closeChat:{title:"Vuoi terminare questa chat?",description:"Una volta chiusa, non potrai più continuare la conversazione.",confirmButton:"Sì, ho finito",cancelButton:"No, torna indietro"},modal:{close:"Chiudi",back:"Indietro"}},de:{common:{sourceCallToActionLabel:"Ansehen",sending:"Wird gesendet...",isThinking:"Denkt nach...",send:"Senden",openChat:"Chat öffnen",closeNotification:"Benachrichtigung schließen",bot:"Der Bot"},intro:{startChat:"Chat starten"},header:{tooltipMinimizeChat:"Chat minimieren",tooltipClose:"Schließen",tooltipOptions:"Optionen",typing:" schreibt..."},feedback:{thumbsUp:"Hilfreich",thumbsDown:"Nicht hilfreich",modalPlaceholder:"Bitte gib hier Dein Feedback ein",modalTitle:"Wie können wir unsere Antwort verbessern?",modalDescription:"Was ist schiefgelaufen? Teile uns Dein Feedback mit.",modalSubmit:"Senden",modalSubmittedTitle:"Danke für Dein Feedback",modalSubmittedDescription:"Dein Feedback hilft uns, unseren Service zu verbessern!"},menu:{menuTitle:"Optionen",restartConversationLabel:"Neue Konversation starten"},footer:{newMessagePlaceholder:"Nachricht eingeben..."},upload:{uploadImageButton:"Bild hochladen",uploadingText:"Hochladen...",invalidFileType:"Bitte wähle eine gültige Bilddatei (JPEG, PNG, GIF oder WebP)",fileSizeExceeded:"Dateigröße muss kleiner als {{maxSize}}MB sein",processingError:"Bildverarbeitung fehlgeschlagen. Bitte versuche es erneut.",imageLoadError:"Bild nicht verfügbar",removeAttachment:"Anhang entfernen"},rateConversation:{header:"Bewerte Deine Konversation",feedbackMessagePlacholder:"Zusätzliches Feedback teilen (optional)",submittedTitle:"Danke für Dein Feedback!",submittedDescription:"Dein Feedback hilft uns, unseren Service zu verbessern!",submitFeedbackMessage:"Senden",submittingFeedbackMessage:"Wird gesendet...",noFeedback:"Kein Feedback"},resumeChat:{title:"Willkommen zurück 👋!",subtitle:"Möchtest Du dort weitermachen, wo Du aufgehört hast?",continueButton:"Ja, meine Unterhaltung fortsetzen",startNewButton:"Neue Unterhaltung starten"},closeChat:{title:"Möchtest Du diesen Chat beenden?",description:"Sobald Du ihn schließt, kannst Du die Unterhaltung nicht fortsetzen.",confirmButton:"Ja, ich bin fertig",cancelButton:"Nein, zurück"},modal:{close:"Schließen",back:"Zurück"}},es:{common:{sourceCallToActionLabel:"Ver",sending:"Enviando...",isThinking:"Está pensando...",send:"Enviar",openChat:"Abrir chat",closeNotification:"Cerrar notificación",bot:"El bot"},intro:{startChat:"Abrir chat"},header:{tooltipMinimizeChat:"Minimizar chat",tooltipClose:"Cerrar",tooltipOptions:"Opciones",typing:" está escribiendo..."},feedback:{thumbsUp:"Útil",thumbsDown:"No útil",modalPlaceholder:"Por favor, proporciona tu comentario aquí",modalTitle:"¿Cómo podemos mejorar nuestra respuesta?",modalDescription:"¿Puedes contarnos qué salió mal?",modalSubmit:"Enviar",modalSubmittedTitle:"Gracias por tu comentario",modalSubmittedDescription:"¡Tu opinión nos ayudará a mejorar nuestro servicio!"},menu:{menuTitle:"Opciones",restartConversationLabel:"Iniciar una nueva conversación"},footer:{newMessagePlaceholder:"Escribe un mensaje..."},upload:{uploadImageButton:"Subir imagen",uploadingText:"Subiendo...",invalidFileType:"Por favor, selecciona un archivo de imagen válido (JPEG, PNG, GIF o WebP)",fileSizeExceeded:"El tamaño del archivo debe ser menor a {{maxSize}}MB",processingError:"Error al procesar la imagen. Por favor, inténtalo de nuevo.",imageLoadError:"Imagen no disponible",removeAttachment:"Eliminar adjunto"},rateConversation:{header:"Valora tu conversación",feedbackMessagePlacholder:"Comparte comentarios adicionales (opcional)",submittedTitle:"¡Gracias por tu comentario!",submittedDescription:"Tu opinión nos ayudará a mejorar nuestro servicio.",submitFeedbackMessage:"Enviar",submittingFeedbackMessage:"Enviando...",noFeedback:"Sin comentarios"},resumeChat:{title:"¡Bienvenido de nuevo 👋!",subtitle:"¿Quieres continuar donde lo dejaste?",continueButton:"Sí, continuar mi conversación",startNewButton:"Iniciar una nueva conversación"},closeChat:{title:"¿Quieres terminar este chat?",description:"Una vez que lo cierres, no podrás continuar la conversación.",confirmButton:"Sí, he terminado",cancelButton:"No, volver atrás"},modal:{close:"Cerrar",back:"Volver"}}};Ra.use(mG).init({resources:eK,lng:"en",fallbackLng:"en",interpolation:{escapeValue:!1}});const FO={posthog:{project_key:"phc_JeeePECzKqZPUbgQd1Voo3CsQta7ggHpKxPPlpKg1Fz",api_host:"https://eu.posthog.com"}};var BO=_.createContext({client:ys,bootstrap:void 0});function HO(e,t,n){if(n===void 0&&(n=new WeakMap),e===t)return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(n.has(e)&&n.get(e)===t)return!0;n.set(e,t);var r=Object.keys(e),a=Object.keys(t);if(r.length!==a.length)return!1;for(var s=0,l=r;s<l.length;s++){var c=l[s];if(!a.includes(c)||!HO(e[c],t[c],n))return!1}return!0}function tK(e){var t,n,r=e.children,a=e.client,s=e.apiKey,l=e.options,c=_.useRef(null),h=_.useMemo(function(){return a?(s&&console.warn("[PostHog.js] You have provided both `client` and `apiKey` to `PostHogProvider`. `apiKey` will be ignored in favour of `client`."),l&&console.warn("[PostHog.js] You have provided both `client` and `options` to `PostHogProvider`. `options` will be ignored in favour of `client`."),a):(s||console.warn("[PostHog.js] No `apiKey` or `client` were provided to `PostHogProvider`. Using default global `window.posthog` instance. You must initialize it manually. This is not recommended behavior."),ys)},[a,s,JSON.stringify(l)]);return _.useEffect(function(){if(!a){var p=c.current;p?(s!==p.apiKey&&console.warn("[PostHog.js] You have provided a different `apiKey` to `PostHogProvider` than the one that was already initialized. This is not supported by our provider and we'll keep using the previous key. If you need to toggle between API Keys you need to control the `client` yourself and pass it in as a prop rather than an `apiKey` prop."),l&&!HO(l,p.options)&&ys.set_config(l),c.current={apiKey:s,options:l??{}}):(ys.__loaded&&console.warn("[PostHog.js] `posthog` was already loaded elsewhere. This may cause issues."),ys.init(s,l),c.current={apiKey:s,options:l??{}})}},[a,s,JSON.stringify(l)]),ge.createElement(BO.Provider,{value:{client:h,bootstrap:(t=l?.bootstrap)!==null&&t!==void 0?t:(n=a?.config)===null||n===void 0?void 0:n.bootstrap}},r)}var r_=function(e){return typeof e=="function"},i_=function(e,t){return i_=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(n[a]=r[a])},i_(e,t)};function nK(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");i_(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}typeof SuppressedError=="function"&&SuppressedError;var rK={componentStack:null,exceptionEvent:null,error:null},iK={INVALID_FALLBACK:"[PostHog.js][PostHogErrorBoundary] Invalid fallback prop, provide a valid React element or a function that returns a valid React element."};(function(e){nK(t,e);function t(n){var r=e.call(this,n)||this;return r.state=rK,r}return t.prototype.componentDidCatch=function(n,r){var a=this.props.additionalProperties,s;r_(a)?s=a(n):typeof a=="object"&&(s=a);var l=this.context.client,c=l.captureException(n,s),h=r.componentStack;this.setState({error:n,componentStack:h??null,exceptionEvent:c})},t.prototype.render=function(){var n=this.props,r=n.children,a=n.fallback,s=this.state;if(s.componentStack==null)return r_(r)?r():r;var l=r_(a)?ge.createElement(a,{error:s.error,componentStack:s.componentStack,exceptionEvent:s.exceptionEvent}):a;return ge.isValidElement(l)?l:(console.warn(iK.INVALID_FALLBACK),ge.createElement(ge.Fragment,null))},t.contextType=BO,t})(ge.Component);const aK=["freeday-app-beta.web.app","freeday-app-beta.firebaseapp.com","beta-chat.freeday.ai"],oK=()=>{typeof window<"u"&&!aK.includes(window.location.hostname)&&ys.init(FO.posthog.project_key,{cookieless_mode:"always",api_host:FO.posthog.api_host,autocapture:!1,disable_session_recording:!0,capture_pageview:!1,capture_pageleave:!1,advanced_disable_feature_flags_on_first_load:!0})},sK=({children:e})=>(_.useEffect(()=>{oK()},[]),F.jsx(tK,{client:ys,children:e})),UO=_.createContext(void 0),lK=({children:e})=>{const t=_.useRef(null),[n,r]=_.useState(null),[a,s]=_.useState(null),[l,c]=_.useState(null),[h,p]=_.useState(!1),v=_.useMemo(()=>!!l||h,[l,h]),y=_.useCallback(A=>{a&&URL.revokeObjectURL(a),r(A),c(null),s(A?URL.createObjectURL(A):null)},[a]),w=_.useCallback(()=>{t.current&&(t.current.value=""),a&&URL.revokeObjectURL(a),r(null),s(null),c(null),p(!1)},[a]),T=_.useMemo(()=>({fileInputRef:t,selectedFile:n,setSelectedFile:y,previewUrl:a,error:l,setError:c,isLoading:h,setIsLoading:p,hasUploadState:v,clearUploadedFile:w}),[t,l,h,v,w]);return F.jsx(UO.Provider,{value:T,children:e})},tv=()=>{const e=_.useContext(UO);if(e===void 0)throw new Error("useUploadState must be used within an UploadStateProvider");return e},uK=({children:e,config:t,inShadowDom:n=!1})=>{if(!t?.channelId)return F.jsx("div",{children:"No channelId provided..."});let r=F.jsx(BG,{config:{channelId:t.channelId,baseUrl:t.baseUrl},children:F.jsx(OO,{primaryColor:t.primaryColor,children:F.jsx(TG,{i18n:Ra,children:F.jsx(ZG,{children:F.jsx(SG,{children:F.jsx(XG,{config:t,inShadowDom:n,children:F.jsx(lK,{children:e})})})})})})});return t.analyticsEnabled&&(r=F.jsx(sK,{children:r})),r},rE=({size:e=24})=>F.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,fill:"none",viewBox:"0 0 32 32",children:[F.jsx("path",{fill:"currentColor",d:"M15 6v2H5v16h8.116a1 1 0 0 1 .875.5l2 3.5 2-3.5a1.001 1.001 0 0 1 .875-.5H27v-7h2v7a2 2 0 0 1-2 2h-7.554l-1.71 2.992a2 2 0 0 1-3.472 0L12.554 26H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h10Z"}),F.jsx("path",{fill:"currentColor",d:"M29.898 8.95a.978.978 0 0 1-.646.926l-3.196 1.18-1.177 3.198a.987.987 0 0 1-1.85 0l-1.185-3.198-3.198-1.177a.987.987 0 0 1 0-1.85l3.198-1.185 1.177-3.198a.986.986 0 0 1 1.85 0l1.185 3.198 3.198 1.177a.978.978 0 0 1 .643.929Z"})]}),cK={button:"_button_14uy3_1"},dK=({onToggleWidget:e})=>{const{t}=Gr(),n=r=>{r.stopPropagation(),e()};return F.jsx("button",{className:cK.button,onClick:n,"aria-label":t("common:openChat"),"data-testid":"chat-button",children:F.jsx(rE,{})})};function iE(e,t){window.dispatchEvent(new StorageEvent("storage",{key:e,newValue:t}))}const zO=(e,t)=>{const n=JSON.stringify(t);window.localStorage.setItem(e,n),iE(e,n)},fK=e=>{window.localStorage.removeItem(e),iE(e,null)},jO=e=>window.localStorage.getItem(e),hK=e=>(window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)),pK=()=>{throw Error("useLocalStorage is a client-only hook")};function VO(e,t){const n=()=>jO(e),r=_.useSyncExternalStore(hK,n,pK),a=_.useCallback(s=>{try{const l=typeof s=="function"?s(JSON.parse(r)):s;l==null?fK(e):zO(e,l)}catch(l){console.warn(l)}},[e,r]);return _.useEffect(()=>{jO(e)===null&&typeof t<"u"&&zO(e,t)},[e,t]),[r?JSON.parse(r):t,a]}const WO=(e,t)=>{const n=JSON.stringify(t);window.sessionStorage.setItem(e,n),iE(e,n)},mK=e=>{window.sessionStorage.removeItem(e),iE(e,null)},YO=e=>window.sessionStorage.getItem(e),gK=e=>(window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)),vK=()=>{throw Error("useSessionStorage is a client-only hook")};function yK(e,t){const n=()=>YO(e),r=_.useSyncExternalStore(gK,n,vK),a=_.useCallback(s=>{try{const l=typeof s=="function"?s(JSON.parse(r)):s;l==null?mK(e):WO(e,l)}catch(l){console.warn(l)}},[e,r]);return _.useEffect(()=>{YO(e)===null&&typeof t<"u"&&WO(e,t)},[e,t]),[r?JSON.parse(r):t,a]}const a_=_.createContext({});function o_(e){const t=_.useRef(null);return t.current===null&&(t.current=e()),t.current}const s_=typeof window<"u",qO=s_?_.useLayoutEffect:_.useEffect,aE=_.createContext(null);function l_(e,t){e.indexOf(t)===-1&&e.push(t)}function u_(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}const jl=(e,t,n)=>n>t?t:n<e?e:n;function c_(e,t){return t?`${e}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${t}`:e}var bK={};let Bp=()=>{},Xu=()=>{};typeof process<"u"&&bK?.NODE_ENV!=="production"&&(Bp=(e,t,n)=>{!e&&typeof console<"u"&&console.warn(c_(t,n))},Xu=(e,t,n)=>{if(!e)throw new Error(c_(t,n))});const Zu={},GO=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function KO(e){return typeof e=="object"&&e!==null}const QO=e=>/^0[^.\s]+$/u.test(e);function d_(e){let t;return()=>(t===void 0&&(t=e()),t)}const bs=e=>e,EK=(e,t)=>n=>t(e(n)),nv=(...e)=>e.reduce(EK),rv=(e,t,n)=>{const r=t-e;return r===0?1:(n-e)/r};class f_{constructor(){this.subscriptions=[]}add(t){return l_(this.subscriptions,t),()=>u_(this.subscriptions,t)}notify(t,n,r){const a=this.subscriptions.length;if(a)if(a===1)this.subscriptions[0](t,n,r);else for(let s=0;s<a;s++){const l=this.subscriptions[s];l&&l(t,n,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const Vl=e=>e*1e3,Es=e=>e/1e3;function XO(e,t){return t?e*(1e3/t):0}const ZO=new Set;function h_(e,t,n){e||ZO.has(t)||(console.warn(c_(t,n)),ZO.add(t))}const JO=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,wK=1e-7,xK=12;function TK(e,t,n,r,a){let s,l,c=0;do l=t+(n-t)/2,s=JO(l,r,a)-e,s>0?n=l:t=l;while(Math.abs(s)>wK&&++c<xK);return l}function iv(e,t,n,r){if(e===t&&n===r)return bs;const a=s=>TK(s,0,1,e,n);return s=>s===0||s===1?s:JO(a(s),t,r)}const $O=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,eN=e=>t=>1-e(1-t),tN=iv(.33,1.53,.69,.99),p_=eN(tN),nN=$O(p_),rN=e=>(e*=2)<1?.5*p_(e):.5*(2-Math.pow(2,-10*(e-1))),m_=e=>1-Math.sin(Math.acos(e)),iN=eN(m_),aN=$O(m_),SK=iv(.42,0,1,1),CK=iv(0,0,.58,1),oN=iv(.42,0,.58,1),_K=e=>Array.isArray(e)&&typeof e[0]!="number",sN=e=>Array.isArray(e)&&typeof e[0]=="number",lN={linear:bs,easeIn:SK,easeInOut:oN,easeOut:CK,circIn:m_,circInOut:aN,circOut:iN,backIn:p_,backInOut:nN,backOut:tN,anticipate:rN},AK=e=>typeof e=="string",uN=e=>{if(sN(e)){Xu(e.length===4,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");const[t,n,r,a]=e;return iv(t,n,r,a)}else if(AK(e))return Xu(lN[e]!==void 0,`Invalid easing type '${e}'`,"invalid-easing-type"),lN[e];return e},oE=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function kK(e,t){let n=new Set,r=new Set,a=!1,s=!1;const l=new WeakSet;let c={delta:0,timestamp:0,isProcessing:!1};function h(v){l.has(v)&&(p.schedule(v),e()),v(c)}const p={schedule:(v,y=!1,w=!1)=>{const A=w&&a?n:r;return y&&l.add(v),A.has(v)||A.add(v),v},cancel:v=>{r.delete(v),l.delete(v)},process:v=>{if(c=v,a){s=!0;return}a=!0,[n,r]=[r,n],n.forEach(h),n.clear(),a=!1,s&&(s=!1,p.process(v))}};return p}const RK=40;function cN(e,t){let n=!1,r=!0;const a={delta:0,timestamp:0,isProcessing:!1},s=()=>n=!0,l=oE.reduce((H,V)=>(H[V]=kK(s),H),{}),{setup:c,read:h,resolveKeyframes:p,preUpdate:v,update:y,preRender:w,render:T,postRender:A}=l,R=()=>{const H=Zu.useManualTiming?a.timestamp:performance.now();n=!1,Zu.useManualTiming||(a.delta=r?1e3/60:Math.max(Math.min(H-a.timestamp,RK),1)),a.timestamp=H,a.isProcessing=!0,c.process(a),h.process(a),p.process(a),v.process(a),y.process(a),w.process(a),T.process(a),A.process(a),a.isProcessing=!1,n&&t&&(r=!1,e(R))},N=()=>{n=!0,r=!0,a.isProcessing||e(R)};return{schedule:oE.reduce((H,V)=>{const K=l[V];return H[V]=(Y,Z=!1,X=!1)=>(n||N(),K.schedule(Y,Z,X)),H},{}),cancel:H=>{for(let V=0;V<oE.length;V++)l[oE[V]].cancel(H)},state:a,steps:l}}const{schedule:Mr,cancel:od,state:da,steps:g_}=cN(typeof requestAnimationFrame<"u"?requestAnimationFrame:bs,!0);let sE;function DK(){sE=void 0}const to={now:()=>(sE===void 0&&to.set(da.isProcessing||Zu.useManualTiming?da.timestamp:performance.now()),sE),set:e=>{sE=e,queueMicrotask(DK)}},dN=e=>t=>typeof t=="string"&&t.startsWith(e),fN=dN("--"),LK=dN("var(--"),v_=e=>LK(e)?OK.test(e.split("/*")[0].trim()):!1,OK=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function hN(e){return typeof e!="string"?!1:e.split("/*")[0].includes("var(--")}const Hp={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},av={...Hp,transform:e=>jl(0,1,e)},lE={...Hp,default:1},ov=e=>Math.round(e*1e5)/1e5,y_=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function NK(e){return e==null}const PK=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,b_=(e,t)=>n=>!!(typeof n=="string"&&PK.test(n)&&n.startsWith(e)||t&&!NK(n)&&Object.prototype.hasOwnProperty.call(n,t)),pN=(e,t,n)=>r=>{if(typeof r!="string")return r;const[a,s,l,c]=r.match(y_);return{[e]:parseFloat(a),[t]:parseFloat(s),[n]:parseFloat(l),alpha:c!==void 0?parseFloat(c):1}},IK=e=>jl(0,255,e),E_={...Hp,transform:e=>Math.round(IK(e))},If={test:b_("rgb","red"),parse:pN("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+E_.transform(e)+", "+E_.transform(t)+", "+E_.transform(n)+", "+ov(av.transform(r))+")"};function MK(e){let t="",n="",r="",a="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),a=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),a=e.substring(4,5),t+=t,n+=n,r+=r,a+=a),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:a?parseInt(a,16)/255:1}}const w_={test:b_("#"),parse:MK,transform:If.transform},sv=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),sd=sv("deg"),Wl=sv("%"),kt=sv("px"),FK=sv("vh"),BK=sv("vw"),mN={...Wl,parse:e=>Wl.parse(e)/100,transform:e=>Wl.transform(e*100)},Up={test:b_("hsl","hue"),parse:pN("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+Wl.transform(ov(t))+", "+Wl.transform(ov(n))+", "+ov(av.transform(r))+")"},xi={test:e=>If.test(e)||w_.test(e)||Up.test(e),parse:e=>If.test(e)?If.parse(e):Up.test(e)?Up.parse(e):w_.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?If.transform(e):Up.transform(e),getAnimatableNone:e=>{const t=xi.parse(e);return t.alpha=0,xi.transform(t)}},HK=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function UK(e){return isNaN(e)&&typeof e=="string"&&(e.match(y_)?.length||0)+(e.match(HK)?.length||0)>0}const gN="number",vN="color",zK="var",jK="var(",yN="${}",VK=/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 lv(e){const t=e.toString(),n=[],r={color:[],number:[],var:[]},a=[];let s=0;const c=t.replace(VK,h=>(xi.test(h)?(r.color.push(s),a.push(vN),n.push(xi.parse(h))):h.startsWith(jK)?(r.var.push(s),a.push(zK),n.push(h)):(r.number.push(s),a.push(gN),n.push(parseFloat(h))),++s,yN)).split(yN);return{values:n,split:c,indexes:r,types:a}}function bN(e){return lv(e).values}function EN(e){const{split:t,types:n}=lv(e),r=t.length;return a=>{let s="";for(let l=0;l<r;l++)if(s+=t[l],a[l]!==void 0){const c=n[l];c===gN?s+=ov(a[l]):c===vN?s+=xi.transform(a[l]):s+=a[l]}return s}}const WK=e=>typeof e=="number"?0:xi.test(e)?xi.getAnimatableNone(e):e;function YK(e){const t=bN(e);return EN(e)(t.map(WK))}const ld={test:UK,parse:bN,createTransformer:EN,getAnimatableNone:YK};function x_(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<.16666666666666666?e+(t-e)*6*n:n<.5?t:n<.6666666666666666?e+(t-e)*(.6666666666666666-n)*6:e}function qK({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let a=0,s=0,l=0;if(!t)a=s=l=n;else{const c=n<.5?n*(1+t):n+t-n*t,h=2*n-c;a=x_(h,c,e+.3333333333333333),s=x_(h,c,e),l=x_(h,c,e-.3333333333333333)}return{red:Math.round(a*255),green:Math.round(s*255),blue:Math.round(l*255),alpha:r}}function uE(e,t){return n=>n>0?t:e}const Kr=(e,t,n)=>e+(t-e)*n,T_=(e,t,n)=>{const r=e*e,a=n*(t*t-r)+r;return a<0?0:Math.sqrt(a)},GK=[w_,If,Up],KK=e=>GK.find(t=>t.test(e));function wN(e){const t=KK(e);if(Bp(!!t,`'${e}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!t)return!1;let n=t.parse(e);return t===Up&&(n=qK(n)),n}const xN=(e,t)=>{const n=wN(e),r=wN(t);if(!n||!r)return uE(e,t);const a={...n};return s=>(a.red=T_(n.red,r.red,s),a.green=T_(n.green,r.green,s),a.blue=T_(n.blue,r.blue,s),a.alpha=Kr(n.alpha,r.alpha,s),If.transform(a))},S_=new Set(["none","hidden"]);function QK(e,t){return S_.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function XK(e,t){return n=>Kr(e,t,n)}function C_(e){return typeof e=="number"?XK:typeof e=="string"?v_(e)?uE:xi.test(e)?xN:$K:Array.isArray(e)?TN:typeof e=="object"?xi.test(e)?xN:ZK:uE}function TN(e,t){const n=[...e],r=n.length,a=e.map((s,l)=>C_(s)(s,t[l]));return s=>{for(let l=0;l<r;l++)n[l]=a[l](s);return n}}function ZK(e,t){const n={...e,...t},r={};for(const a in n)e[a]!==void 0&&t[a]!==void 0&&(r[a]=C_(e[a])(e[a],t[a]));return a=>{for(const s in r)n[s]=r[s](a);return n}}function JK(e,t){const n=[],r={color:0,var:0,number:0};for(let a=0;a<t.values.length;a++){const s=t.types[a],l=e.indexes[s][r[s]],c=e.values[l]??0;n[a]=c,r[s]++}return n}const $K=(e,t)=>{const n=ld.createTransformer(t),r=lv(e),a=lv(t);return r.indexes.var.length===a.indexes.var.length&&r.indexes.color.length===a.indexes.color.length&&r.indexes.number.length>=a.indexes.number.length?S_.has(e)&&!a.values.length||S_.has(t)&&!r.values.length?QK(e,t):nv(TN(JK(r,a),a.values),n):(Bp(!0,`Complex values '${e}' and '${t}' 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"),uE(e,t))};function SN(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?Kr(e,t,n):C_(e)(e,t)}const eQ=e=>{const t=({timestamp:n})=>e(n);return{start:(n=!0)=>Mr.update(t,n),stop:()=>od(t),now:()=>da.isProcessing?da.timestamp:to.now()}},CN=(e,t,n=10)=>{let r="";const a=Math.max(Math.round(t/n),2);for(let s=0;s<a;s++)r+=Math.round(e(s/(a-1))*1e4)/1e4+", ";return`linear(${r.substring(0,r.length-2)})`},cE=2e4;function __(e){let t=0;const n=50;let r=e.next(t);for(;!r.done&&t<cE;)t+=n,r=e.next(t);return t>=cE?1/0:t}function tQ(e,t=100,n){const r=n({...e,keyframes:[0,t]}),a=Math.min(__(r),cE);return{type:"keyframes",ease:s=>r.next(a*s).value/t,duration:Es(a)}}const nQ=5;function _N(e,t,n){const r=Math.max(t-nQ,0);return XO(n-e(r),t-r)}const Qr={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},A_=.001;function rQ({duration:e=Qr.duration,bounce:t=Qr.bounce,velocity:n=Qr.velocity,mass:r=Qr.mass}){let a,s;Bp(e<=Vl(Qr.maxDuration),"Spring duration must be 10 seconds or less","spring-duration-limit");let l=1-t;l=jl(Qr.minDamping,Qr.maxDamping,l),e=jl(Qr.minDuration,Qr.maxDuration,Es(e)),l<1?(a=p=>{const v=p*l,y=v*e,w=v-n,T=k_(p,l),A=Math.exp(-y);return A_-w/T*A},s=p=>{const y=p*l*e,w=y*n+n,T=Math.pow(l,2)*Math.pow(p,2)*e,A=Math.exp(-y),R=k_(Math.pow(p,2),l);return(-a(p)+A_>0?-1:1)*((w-T)*A)/R}):(a=p=>{const v=Math.exp(-p*e),y=(p-n)*e+1;return-A_+v*y},s=p=>{const v=Math.exp(-p*e),y=(n-p)*(e*e);return v*y});const c=5/e,h=aQ(a,s,c);if(e=Vl(e),isNaN(h))return{stiffness:Qr.stiffness,damping:Qr.damping,duration:e};{const p=Math.pow(h,2)*r;return{stiffness:p,damping:l*2*Math.sqrt(r*p),duration:e}}}const iQ=12;function aQ(e,t,n){let r=n;for(let a=1;a<iQ;a++)r=r-e(r)/t(r);return r}function k_(e,t){return e*Math.sqrt(1-t*t)}const oQ=["duration","bounce"],sQ=["stiffness","damping","mass"];function AN(e,t){return t.some(n=>e[n]!==void 0)}function lQ(e){let t={velocity:Qr.velocity,stiffness:Qr.stiffness,damping:Qr.damping,mass:Qr.mass,isResolvedFromDuration:!1,...e};if(!AN(e,sQ)&&AN(e,oQ))if(e.visualDuration){const n=e.visualDuration,r=2*Math.PI/(n*1.2),a=r*r,s=2*jl(.05,1,1-(e.bounce||0))*Math.sqrt(a);t={...t,mass:Qr.mass,stiffness:a,damping:s}}else{const n=rQ(e);t={...t,...n,mass:Qr.mass},t.isResolvedFromDuration=!0}return t}function dE(e=Qr.visualDuration,t=Qr.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:r,restDelta:a}=n;const s=n.keyframes[0],l=n.keyframes[n.keyframes.length-1],c={done:!1,value:s},{stiffness:h,damping:p,mass:v,duration:y,velocity:w,isResolvedFromDuration:T}=lQ({...n,velocity:-Es(n.velocity||0)}),A=w||0,R=p/(2*Math.sqrt(h*v)),N=l-s,O=Es(Math.sqrt(h/v)),M=Math.abs(N)<5;r||(r=M?Qr.restSpeed.granular:Qr.restSpeed.default),a||(a=M?Qr.restDelta.granular:Qr.restDelta.default);let H;if(R<1){const K=k_(O,R);H=Y=>{const Z=Math.exp(-R*O*Y);return l-Z*((A+R*O*N)/K*Math.sin(K*Y)+N*Math.cos(K*Y))}}else if(R===1)H=K=>l-Math.exp(-O*K)*(N+(A+O*N)*K);else{const K=O*Math.sqrt(R*R-1);H=Y=>{const Z=Math.exp(-R*O*Y),X=Math.min(K*Y,300);return l-Z*((A+R*O*N)*Math.sinh(X)+K*N*Math.cosh(X))/K}}const V={calculatedDuration:T&&y||null,next:K=>{const Y=H(K);if(T)c.done=K>=y;else{let Z=K===0?A:0;R<1&&(Z=K===0?Vl(A):_N(H,K,Y));const X=Math.abs(Z)<=r,ce=Math.abs(l-Y)<=a;c.done=X&&ce}return c.value=c.done?l:Y,c},toString:()=>{const K=Math.min(__(V),cE),Y=CN(Z=>V.next(K*Z).value,K,30);return K+"ms "+Y},toTransition:()=>{}};return V}dE.applyToOptions=e=>{const t=tQ(e,100,dE);return e.ease=t.ease,e.duration=Vl(t.duration),e.type="keyframes",e};function R_({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:a=10,bounceStiffness:s=500,modifyTarget:l,min:c,max:h,restDelta:p=.5,restSpeed:v}){const y=e[0],w={done:!1,value:y},T=X=>c!==void 0&&X<c||h!==void 0&&X>h,A=X=>c===void 0?h:h===void 0||Math.abs(c-X)<Math.abs(h-X)?c:h;let R=n*t;const N=y+R,O=l===void 0?N:l(N);O!==N&&(R=O-y);const M=X=>-R*Math.exp(-X/r),H=X=>O+M(X),V=X=>{const ce=M(X),W=H(X);w.done=Math.abs(ce)<=p,w.value=w.done?O:W};let K,Y;const Z=X=>{T(w.value)&&(K=X,Y=dE({keyframes:[w.value,A(w.value)],velocity:_N(H,X,w.value),damping:a,stiffness:s,restDelta:p,restSpeed:v}))};return Z(0),{calculatedDuration:null,next:X=>{let ce=!1;return!Y&&K===void 0&&(ce=!0,V(X),Z(X)),K!==void 0&&X>=K?Y.next(X-K):(!ce&&V(X),w)}}}function uQ(e,t,n){const r=[],a=n||Zu.mix||SN,s=e.length-1;for(let l=0;l<s;l++){let c=a(e[l],e[l+1]);if(t){const h=Array.isArray(t)?t[l]||bs:t;c=nv(h,c)}r.push(c)}return r}function cQ(e,t,{clamp:n=!0,ease:r,mixer:a}={}){const s=e.length;if(Xu(s===t.length,"Both input and output ranges must be the same length","range-length"),s===1)return()=>t[0];if(s===2&&t[0]===t[1])return()=>t[1];const l=e[0]===e[1];e[0]>e[s-1]&&(e=[...e].reverse(),t=[...t].reverse());const c=uQ(t,r,a),h=c.length,p=v=>{if(l&&v<e[0])return t[0];let y=0;if(h>1)for(;y<e.length-2&&!(v<e[y+1]);y++);const w=rv(e[y],e[y+1],v);return c[y](w)};return n?v=>p(jl(e[0],e[s-1],v)):p}function dQ(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const a=rv(0,t,r);e.push(Kr(n,1,a))}}function fQ(e){const t=[0];return dQ(t,e.length-1),t}function hQ(e,t){return e.map(n=>n*t)}function pQ(e,t){return e.map(()=>t||oN).splice(0,e.length-1)}function zp({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const a=_K(r)?r.map(uN):uN(r),s={done:!1,value:t[0]},l=hQ(n&&n.length===t.length?n:fQ(t),e),c=cQ(l,t,{ease:Array.isArray(a)?a:pQ(t,a)});return{calculatedDuration:e,next:h=>(s.value=c(h),s.done=h>=e,s)}}const mQ=e=>e!==null;function D_(e,{repeat:t,repeatType:n="loop"},r,a=1){const s=e.filter(mQ),c=a<0||t&&n!=="loop"&&t%2===1?0:s.length-1;return!c||r===void 0?s[c]:r}const gQ={decay:R_,inertia:R_,tween:zp,keyframes:zp,spring:dE};function kN(e){typeof e.type=="string"&&(e.type=gQ[e.type])}class L_{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(t=>{this.resolve=t})}notifyFinished(){this.resolve()}then(t,n){return this.finished.then(t,n)}}var vQ={};const yQ=e=>e/100;class O_ extends L_{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{const{motionValue:n}=this.options;n&&n.updatedAt!==to.now()&&this.tick(to.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),this.options.onStop?.())},this.options=t,this.initAnimation(),this.play(),t.autoplay===!1&&this.pause()}initAnimation(){const{options:t}=this;kN(t);const{type:n=zp,repeat:r=0,repeatDelay:a=0,repeatType:s,velocity:l=0}=t;let{keyframes:c}=t;const h=n||zp;vQ.NODE_ENV!=="production"&&h!==zp&&Xu(c.length<=2,`Only two keyframes currently supported with spring and inertia animations. Trying to animate ${c}`,"spring-two-frames"),h!==zp&&typeof c[0]!="number"&&(this.mixKeyframes=nv(yQ,SN(c[0],c[1])),c=[0,100]);const p=h({...t,keyframes:c});s==="mirror"&&(this.mirroredGenerator=h({...t,keyframes:[...c].reverse(),velocity:-l})),p.calculatedDuration===null&&(p.calculatedDuration=__(p));const{calculatedDuration:v}=p;this.calculatedDuration=v,this.resolvedDuration=v+a,this.totalDuration=this.resolvedDuration*(r+1)-a,this.generator=p}updateTime(t){const n=Math.round(t-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=n}tick(t,n=!1){const{generator:r,totalDuration:a,mixKeyframes:s,mirroredGenerator:l,resolvedDuration:c,calculatedDuration:h}=this;if(this.startTime===null)return r.next(0);const{delay:p=0,keyframes:v,repeat:y,repeatType:w,repeatDelay:T,type:A,onUpdate:R,finalKeyframe:N}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-a/this.speed,this.startTime)),n?this.currentTime=t:this.updateTime(t);const O=this.currentTime-p*(this.playbackSpeed>=0?1:-1),M=this.playbackSpeed>=0?O<0:O>a;this.currentTime=Math.max(O,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=a);let H=this.currentTime,V=r;if(y){const X=Math.min(this.currentTime,a)/c;let ce=Math.floor(X),W=X%1;!W&&X>=1&&(W=1),W===1&&ce--,ce=Math.min(ce,y+1),ce%2&&(w==="reverse"?(W=1-W,T&&(W-=T/c)):w==="mirror"&&(V=l)),H=jl(0,1,W)*c}const K=M?{done:!1,value:v[0]}:V.next(H);s&&(K.value=s(K.value));let{done:Y}=K;!M&&h!==null&&(Y=this.playbackSpeed>=0?this.currentTime>=a:this.currentTime<=0);const Z=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&Y);return Z&&A!==R_&&(K.value=D_(v,this.options,N,this.speed)),R&&R(K.value),Z&&this.finish(),K}then(t,n){return this.finished.then(t,n)}get duration(){return Es(this.calculatedDuration)}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+Es(t)}get time(){return Es(this.currentTime)}set time(t){t=Vl(t),this.currentTime=t,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.playbackSpeed),this.driver?.start(!1)}get speed(){return this.playbackSpeed}set speed(t){this.updateTime(to.now());const n=this.playbackSpeed!==t;this.playbackSpeed=t,n&&(this.time=Es(this.currentTime))}play(){if(this.isStopped)return;const{driver:t=eQ,startTime:n}=this.options;this.driver||(this.driver=t(a=>this.tick(a))),this.options.onPlay?.();const r=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=r):this.holdTime!==null?this.startTime=r-this.holdTime:this.startTime||(this.startTime=n??r),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(to.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}attachTimeline(t){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),t.observe(this)}}function bQ(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}const Mf=e=>e*180/Math.PI,N_=e=>{const t=Mf(Math.atan2(e[1],e[0]));return P_(t)},EQ={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:N_,rotateZ:N_,skewX:e=>Mf(Math.atan(e[1])),skewY:e=>Mf(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},P_=e=>(e=e%360,e<0&&(e+=360),e),RN=N_,DN=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),LN=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),wQ={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:DN,scaleY:LN,scale:e=>(DN(e)+LN(e))/2,rotateX:e=>P_(Mf(Math.atan2(e[6],e[5]))),rotateY:e=>P_(Mf(Math.atan2(-e[2],e[0]))),rotateZ:RN,rotate:RN,skewX:e=>Mf(Math.atan(e[4])),skewY:e=>Mf(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function I_(e){return e.includes("scale")?1:0}function M_(e,t){if(!e||e==="none")return I_(t);const n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let r,a;if(n)r=wQ,a=n;else{const c=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=EQ,a=c}if(!a)return I_(t);const s=r[t],l=a[1].split(",").map(TQ);return typeof s=="function"?s(l):l[s]}const xQ=(e,t)=>{const{transform:n="none"}=getComputedStyle(e);return M_(n,t)};function TQ(e){return parseFloat(e.trim())}const jp=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Vp=new Set(jp),ON=e=>e===Hp||e===kt,SQ=new Set(["x","y","z"]),CQ=jp.filter(e=>!SQ.has(e));function _Q(e){const t=[];return CQ.forEach(n=>{const r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),t}const ud={width:({x:e},{paddingLeft:t="0",paddingRight:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t="0",paddingBottom:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>M_(t,"x"),y:(e,{transform:t})=>M_(t,"y")};ud.translateX=ud.x,ud.translateY=ud.y;const Ff=new Set;let F_=!1,B_=!1,H_=!1;function NN(){if(B_){const e=Array.from(Ff).filter(r=>r.needsMeasurement),t=new Set(e.map(r=>r.element)),n=new Map;t.forEach(r=>{const a=_Q(r);a.length&&(n.set(r,a),r.render())}),e.forEach(r=>r.measureInitialState()),t.forEach(r=>{r.render();const a=n.get(r);a&&a.forEach(([s,l])=>{r.getValue(s)?.set(l)})}),e.forEach(r=>r.measureEndState()),e.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}B_=!1,F_=!1,Ff.forEach(e=>e.complete(H_)),Ff.clear()}function PN(){Ff.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(B_=!0)})}function AQ(){H_=!0,PN(),NN(),H_=!1}class U_{constructor(t,n,r,a,s,l=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=r,this.motionValue=a,this.element=s,this.isAsync=l}scheduleResolve(){this.state="scheduled",this.isAsync?(Ff.add(this),F_||(F_=!0,Mr.read(PN),Mr.resolveKeyframes(NN))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:r,motionValue:a}=this;if(t[0]===null){const s=a?.get(),l=t[t.length-1];if(s!==void 0)t[0]=s;else if(r&&n){const c=r.readValue(n,l);c!=null&&(t[0]=c)}t[0]===void 0&&(t[0]=l),a&&s===void 0&&a.set(t[0])}bQ(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),Ff.delete(this)}cancel(){this.state==="scheduled"&&(Ff.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const kQ=e=>e.startsWith("--");function RQ(e,t,n){kQ(t)?e.style.setProperty(t,n):e.style[t]=n}const DQ=d_(()=>window.ScrollTimeline!==void 0),LQ={};function OQ(e,t){const n=d_(e);return()=>LQ[t]??n()}const IN=OQ(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),uv=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,MN={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:uv([0,.65,.55,1]),circOut:uv([.55,0,1,.45]),backIn:uv([.31,.01,.66,-.59]),backOut:uv([.33,1.53,.69,.99])};function FN(e,t){if(e)return typeof e=="function"?IN()?CN(e,t):"ease-out":sN(e)?uv(e):Array.isArray(e)?e.map(n=>FN(n,t)||MN.easeOut):MN[e]}function NQ(e,t,n,{delay:r=0,duration:a=300,repeat:s=0,repeatType:l="loop",ease:c="easeOut",times:h}={},p=void 0){const v={[t]:n};h&&(v.offset=h);const y=FN(c,a);Array.isArray(y)&&(v.easing=y);const w={delay:r,duration:a,easing:Array.isArray(y)?"linear":y,fill:"both",iterations:s+1,direction:l==="reverse"?"alternate":"normal"};return p&&(w.pseudoElement=p),e.animate(v,w)}function BN(e){return typeof e=="function"&&"applyToOptions"in e}function PQ({type:e,...t}){return BN(e)&&IN()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class IQ extends L_{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!t)return;const{element:n,name:r,keyframes:a,pseudoElement:s,allowFlatten:l=!1,finalKeyframe:c,onComplete:h}=t;this.isPseudoElement=!!s,this.allowFlatten=l,this.options=t,Xu(typeof t.type!="string",`Mini animate() doesn't support "type" as a string.`,"mini-spring");const p=PQ(t);this.animation=NQ(n,r,a,p,s),p.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!s){const v=D_(a,this.options,c,this.speed);this.updateMotionValue?this.updateMotionValue(v):RQ(n,r,v),this.animation.cancel()}h?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;t==="idle"||t==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){this.isPseudoElement||this.animation.commitStyles?.()}get duration(){const t=this.animation.effect?.getComputedTiming?.().duration||0;return Es(Number(t))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+Es(t)}get time(){return Es(Number(this.animation.currentTime)||0)}set time(t){this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Vl(t)}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(t){this.manualStartTime=this.animation.startTime=t}attachTimeline({timeline:t,observe:n}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,t&&DQ()?(this.animation.timeline=t,bs):n(this)}}const HN={anticipate:rN,backInOut:nN,circInOut:aN};function MQ(e){return e in HN}function FQ(e){typeof e.ease=="string"&&MQ(e.ease)&&(e.ease=HN[e.ease])}const z_=10;class BQ extends IQ{constructor(t){FQ(t),kN(t),super(t),t.startTime!==void 0&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:n,onUpdate:r,onComplete:a,element:s,...l}=this.options;if(!n)return;if(t!==void 0){n.set(t);return}const c=new O_({...l,autoplay:!1}),h=Math.max(z_,to.now()-this.startTime),p=jl(0,z_,h-z_);n.setWithVelocity(c.sample(Math.max(0,h-p)).value,c.sample(h).value,p),c.stop()}}const UN=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(ld.test(e)||e==="0")&&!e.startsWith("url("));function HQ(e){const t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function UQ(e,t,n,r){const a=e[0];if(a===null)return!1;if(t==="display"||t==="visibility")return!0;const s=e[e.length-1],l=UN(a,t),c=UN(s,t);return Bp(l===c,`You are trying to animate ${t} from "${a}" to "${s}". "${l?s:a}" is not an animatable value.`,"value-not-animatable"),!l||!c?!1:HQ(e)||(n==="spring"||BN(n))&&r}function j_(e){e.duration=0,e.type="keyframes"}const zQ=new Set(["opacity","clipPath","filter","transform"]),jQ=d_(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function VQ(e){const{motionValue:t,name:n,repeatDelay:r,repeatType:a,damping:s,type:l}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;const{onUpdate:h,transformTemplate:p}=t.owner.getProps();return jQ()&&n&&zQ.has(n)&&(n!=="transform"||!p)&&!h&&!r&&a!=="mirror"&&s!==0&&l!=="inertia"}const WQ=40;class YQ extends L_{constructor({autoplay:t=!0,delay:n=0,type:r="keyframes",repeat:a=0,repeatDelay:s=0,repeatType:l="loop",keyframes:c,name:h,motionValue:p,element:v,...y}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=to.now();const w={autoplay:t,delay:n,type:r,repeat:a,repeatDelay:s,repeatType:l,name:h,motionValue:p,element:v,...y},T=v?.KeyframeResolver||U_;this.keyframeResolver=new T(c,(A,R,N)=>this.onKeyframesResolved(A,R,w,!N),h,p,v),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(t,n,r,a){this.keyframeResolver=void 0;const{name:s,type:l,velocity:c,delay:h,isHandoff:p,onUpdate:v}=r;this.resolvedAt=to.now(),UQ(t,s,l,c)||((Zu.instantAnimations||!h)&&v?.(D_(t,r,n)),t[0]=t[t.length-1],j_(r),r.repeat=0);const w={startTime:a?this.resolvedAt?this.resolvedAt-this.createdAt>WQ?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...r,keyframes:t},T=!p&&VQ(w)?new BQ({...w,element:w.motionValue.owner.current}):new O_(w);T.finished.then(()=>this.notifyFinished()).catch(bs),this.pendingTimeline&&(this.stopTimeline=T.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=T}get finished(){return this._animation?this.animation.finished:this._finished}then(t,n){return this.finished.finally(t).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),AQ()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(t){this.animation.time=t}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(t){this.animation.speed=t}get startTime(){return this.animation.startTime}attachTimeline(t){return this._animation?this.stopTimeline=this.animation.attachTimeline(t):this.pendingTimeline=t,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}const qQ=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function GQ(e){const t=qQ.exec(e);if(!t)return[,];const[,n,r,a]=t;return[`--${n??r}`,a]}const KQ=4;function zN(e,t,n=1){Xu(n<=KQ,`Max CSS variable fallback depth detected in property "${e}". This may indicate a circular fallback dependency.`,"max-css-var-depth");const[r,a]=GQ(e);if(!r)return;const s=window.getComputedStyle(t).getPropertyValue(r);if(s){const l=s.trim();return GO(l)?parseFloat(l):l}return v_(a)?zN(a,t,n+1):a}function V_(e,t){return e?.[t]??e?.default??e}const jN=new Set(["width","height","top","left","right","bottom",...jp]);var QQ={};const VN=30,XQ=e=>!isNaN(parseFloat(e));class ZQ{constructor(t,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=r=>{const a=to.now();if(this.updatedAt!==a&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const s of this.dependents)s.dirty()},this.hasAnimated=!1,this.setCurrent(t),this.owner=n.owner}setCurrent(t){this.current=t,this.updatedAt=to.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=XQ(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return QQ.NODE_ENV!=="production"&&h_(!1,'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'),this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new f_);const r=this.events[t].add(n);return t==="change"?()=>{r(),Mr.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t){this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t)}setWithVelocity(t,n,r){this.set(n),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-r}jump(t,n=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=to.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>VN)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,VN);return XO(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),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(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Wp(e,t){return new ZQ(e,t)}const La=e=>!!(e&&e.getVelocity),JQ={test:e=>e==="auto",parse:e=>e},WN=e=>t=>t.test(e),YN=[Hp,kt,Wl,sd,BK,FK,JQ],qN=e=>YN.find(WN(e));function $Q(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||QO(e):!0}const eX=new Set(["brightness","contrast","saturate","opacity"]);function tX(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=n.match(y_)||[];if(!r)return e;const a=n.replace(r,"");let s=eX.has(t)?1:0;return r!==n&&(s*=100),t+"("+s+a+")"}const nX=/\b([a-z-]*)\(.*?\)/gu,W_={...ld,getAnimatableNone:e=>{const t=e.match(nX);return t?t.map(tX).join(" "):e}},GN={...Hp,transform:Math.round},Y_={borderWidth:kt,borderTopWidth:kt,borderRightWidth:kt,borderBottomWidth:kt,borderLeftWidth:kt,borderRadius:kt,radius:kt,borderTopLeftRadius:kt,borderTopRightRadius:kt,borderBottomRightRadius:kt,borderBottomLeftRadius:kt,width:kt,maxWidth:kt,height:kt,maxHeight:kt,top:kt,right:kt,bottom:kt,left:kt,inset:kt,insetBlock:kt,insetBlockStart:kt,insetBlockEnd:kt,insetInline:kt,insetInlineStart:kt,insetInlineEnd:kt,padding:kt,paddingTop:kt,paddingRight:kt,paddingBottom:kt,paddingLeft:kt,paddingBlock:kt,paddingBlockStart:kt,paddingBlockEnd:kt,paddingInline:kt,paddingInlineStart:kt,paddingInlineEnd:kt,margin:kt,marginTop:kt,marginRight:kt,marginBottom:kt,marginLeft:kt,marginBlock:kt,marginBlockStart:kt,marginBlockEnd:kt,marginInline:kt,marginInlineStart:kt,marginInlineEnd:kt,backgroundPositionX:kt,backgroundPositionY:kt,...{rotate:sd,rotateX:sd,rotateY:sd,rotateZ:sd,scale:lE,scaleX:lE,scaleY:lE,scaleZ:lE,skew:sd,skewX:sd,skewY:sd,distance:kt,translateX:kt,translateY:kt,translateZ:kt,x:kt,y:kt,z:kt,perspective:kt,transformPerspective:kt,opacity:av,originX:mN,originY:mN,originZ:kt},zIndex:GN,fillOpacity:av,strokeOpacity:av,numOctaves:GN},rX={...Y_,color:xi,backgroundColor:xi,outlineColor:xi,fill:xi,stroke:xi,borderColor:xi,borderTopColor:xi,borderRightColor:xi,borderBottomColor:xi,borderLeftColor:xi,filter:W_,WebkitFilter:W_},KN=e=>rX[e];function QN(e,t){let n=KN(e);return n!==W_&&(n=ld),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const iX=new Set(["auto","none","0"]);function aX(e,t,n){let r=0,a;for(;r<e.length&&!a;){const s=e[r];typeof s=="string"&&!iX.has(s)&&lv(s).values.length&&(a=e[r]),r++}if(a&&n)for(const s of t)e[s]=QN(n,a)}class oX extends U_{constructor(t,n,r,a,s){super(t,n,r,a,s,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:n,name:r}=this;if(!n||!n.current)return;super.readKeyframes();for(let v=0;v<t.length;v++){let y=t[v];if(typeof y=="string"&&(y=y.trim(),v_(y))){const w=zN(y,n.current);w!==void 0&&(t[v]=w),v===t.length-1&&(this.finalKeyframe=y)}}if(this.resolveNoneKeyframes(),!jN.has(r)||t.length!==2)return;const[a,s]=t,l=qN(a),c=qN(s),h=hN(a),p=hN(s);if(h!==p&&ud[r]){this.needsMeasurement=!0;return}if(l!==c)if(ON(l)&&ON(c))for(let v=0;v<t.length;v++){const y=t[v];typeof y=="string"&&(t[v]=parseFloat(y))}else ud[r]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:n}=this,r=[];for(let a=0;a<t.length;a++)(t[a]===null||$Q(t[a]))&&r.push(a);r.length&&aX(t,r,n)}measureInitialState(){const{element:t,unresolvedKeyframes:n,name:r}=this;if(!t||!t.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=ud[r](t.measureViewportBox(),window.getComputedStyle(t.current)),n[0]=this.measuredOrigin;const a=n[n.length-1];a!==void 0&&t.getValue(r,a).jump(a,!1)}measureEndState(){const{element:t,name:n,unresolvedKeyframes:r}=this;if(!t||!t.current)return;const a=t.getValue(n);a&&a.jump(this.measuredOrigin,!1);const s=r.length-1,l=r[s];r[s]=ud[n](t.measureViewportBox(),window.getComputedStyle(t.current)),l!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=l),this.removedTransforms?.length&&this.removedTransforms.forEach(([c,h])=>{t.getValue(c).set(h)}),this.resolveNoneKeyframes()}}function sX(e,t,n){if(e instanceof EventTarget)return[e];if(typeof e=="string"){let r=document;const a=n?.[e]??r.querySelectorAll(e);return a?Array.from(a):[]}return Array.from(e)}const XN=(e,t)=>t&&typeof e=="number"?t.transform(e):e;function ZN(e){return KO(e)&&"offsetHeight"in e}const{schedule:q_}=cN(queueMicrotask,!1),Qs={x:!1,y:!1};function JN(){return Qs.x||Qs.y}function lX(e){return e==="x"||e==="y"?Qs[e]?null:(Qs[e]=!0,()=>{Qs[e]=!1}):Qs.x||Qs.y?null:(Qs.x=Qs.y=!0,()=>{Qs.x=Qs.y=!1})}function $N(e,t){const n=sX(e),r=new AbortController,a={passive:!0,...t,signal:r.signal};return[n,a,()=>r.abort()]}function e8(e){return!(e.pointerType==="touch"||JN())}function uX(e,t,n={}){const[r,a,s]=$N(e,n),l=c=>{if(!e8(c))return;const{target:h}=c,p=t(h,c);if(typeof p!="function"||!h)return;const v=y=>{e8(y)&&(p(y),h.removeEventListener("pointerleave",v))};h.addEventListener("pointerleave",v,a)};return r.forEach(c=>{c.addEventListener("pointerenter",l,a)}),s}const t8=(e,t)=>t?e===t?!0:t8(e,t.parentElement):!1,G_=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,cX=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function n8(e){return cX.has(e.tagName)||e.isContentEditable===!0}const fE=new WeakSet;function r8(e){return t=>{t.key==="Enter"&&e(t)}}function K_(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const dX=(e,t)=>{const n=e.currentTarget;if(!n)return;const r=r8(()=>{if(fE.has(n))return;K_(n,"down");const a=r8(()=>{K_(n,"up")}),s=()=>K_(n,"cancel");n.addEventListener("keyup",a,t),n.addEventListener("blur",s,t)});n.addEventListener("keydown",r,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),t)};function i8(e){return G_(e)&&!JN()}function fX(e,t,n={}){const[r,a,s]=$N(e,n),l=c=>{const h=c.currentTarget;if(!i8(c))return;fE.add(h);const p=t(h,c),v=(T,A)=>{window.removeEventListener("pointerup",y),window.removeEventListener("pointercancel",w),fE.has(h)&&fE.delete(h),i8(T)&&typeof p=="function"&&p(T,{success:A})},y=T=>{v(T,h===window||h===document||n.useGlobalTarget||t8(h,T.target))},w=T=>{v(T,!1)};window.addEventListener("pointerup",y,a),window.addEventListener("pointercancel",w,a)};return r.forEach(c=>{(n.useGlobalTarget?window:c).addEventListener("pointerdown",l,a),ZN(c)&&(c.addEventListener("focus",p=>dX(p,a)),!n8(c)&&!c.hasAttribute("tabindex")&&(c.tabIndex=0))}),s}function a8(e){return KO(e)&&"ownerSVGElement"in e}function hX(e){return a8(e)&&e.tagName==="svg"}const pX=[...YN,xi,ld],mX=e=>pX.find(WN(e)),Q_=_.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function o8(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function gX(...e){return t=>{let n=!1;const r=e.map(a=>{const s=o8(a,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let a=0;a<r.length;a++){const s=r[a];typeof s=="function"?s():o8(e[a],null)}}}}function vX(...e){return _.useCallback(gX(...e),e)}class yX extends _.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(n&&t.isPresent&&!this.props.isPresent){const r=n.offsetParent,a=ZN(r)&&r.offsetWidth||0,s=this.props.sizeRef.current;s.height=n.offsetHeight||0,s.width=n.offsetWidth||0,s.top=n.offsetTop,s.left=n.offsetLeft,s.right=a-s.width-s.left}return null}componentDidUpdate(){}render(){return this.props.children}}function bX({children:e,isPresent:t,anchorX:n,root:r}){const a=_.useId(),s=_.useRef(null),l=_.useRef({width:0,height:0,top:0,left:0,right:0}),{nonce:c}=_.useContext(Q_),h=e.props?.ref??e?.ref,p=vX(s,h);return _.useInsertionEffect(()=>{const{width:v,height:y,top:w,left:T,right:A}=l.current;if(t||!s.current||!v||!y)return;const R=n==="left"?`left: ${T}`:`right: ${A}`;s.current.dataset.motionPopId=a;const N=document.createElement("style");c&&(N.nonce=c);const O=r??document.head;return O.appendChild(N),N.sheet&&N.sheet.insertRule(`
170
+ `),()=>this.onerror("timeout"),t=>{this.awaitingBatchAck=!1,!t||t.status!==200?(this.onerror(t&&t.status),this.closeAndRetry(1011,"internal server error",!1)):this.batchBuffer.length>0&&(this.batchSend(this.batchBuffer),this.batchBuffer=[])})}close(e,t,n){for(let a of this.reqs)a.abort();this.readyState=zl.closed;let r=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:e,reason:t,wasClean:n});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,typeof CloseEvent<"u"?this.onclose(new CloseEvent("close",r)):this.onclose(r)}ajax(e,t,n,r,a){let s,l=()=>{this.reqs.delete(s),r()};s=eE.request(e,this.endpointURL(),t,n,this.timeout,l,c=>{this.reqs.delete(s),this.isActive()&&a(c)}),this.reqs.add(s)}},tE={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(e,t){if(e.payload.constructor===ArrayBuffer)return t(this.binaryEncode(e));{let n=[e.join_ref,e.ref,e.topic,e.event,e.payload];return t(JSON.stringify(n))}},decode(e,t){if(e.constructor===ArrayBuffer)return t(this.binaryDecode(e));{let[n,r,a,s,l]=JSON.parse(e);return t({join_ref:n,ref:r,topic:a,event:s,payload:l})}},binaryEncode(e){let{join_ref:t,ref:n,event:r,topic:a,payload:s}=e,l=this.META_LENGTH+t.length+n.length+a.length+r.length,c=new ArrayBuffer(this.HEADER_LENGTH+l),h=new DataView(c),p=0;h.setUint8(p++,this.KINDS.push),h.setUint8(p++,t.length),h.setUint8(p++,n.length),h.setUint8(p++,a.length),h.setUint8(p++,r.length),Array.from(t,y=>h.setUint8(p++,y.charCodeAt(0))),Array.from(n,y=>h.setUint8(p++,y.charCodeAt(0))),Array.from(a,y=>h.setUint8(p++,y.charCodeAt(0))),Array.from(r,y=>h.setUint8(p++,y.charCodeAt(0)));var v=new Uint8Array(c.byteLength+s.byteLength);return v.set(new Uint8Array(c),0),v.set(new Uint8Array(s),c.byteLength),v.buffer},binaryDecode(e){let t=new DataView(e),n=t.getUint8(0),r=new TextDecoder;switch(n){case this.KINDS.push:return this.decodePush(e,t,r);case this.KINDS.reply:return this.decodeReply(e,t,r);case this.KINDS.broadcast:return this.decodeBroadcast(e,t,r)}},decodePush(e,t,n){let r=t.getUint8(1),a=t.getUint8(2),s=t.getUint8(3),l=this.HEADER_LENGTH+this.META_LENGTH-1,c=n.decode(e.slice(l,l+r));l=l+r;let h=n.decode(e.slice(l,l+a));l=l+a;let p=n.decode(e.slice(l,l+s));l=l+s;let v=e.slice(l,e.byteLength);return{join_ref:c,ref:null,topic:h,event:p,payload:v}},decodeReply(e,t,n){let r=t.getUint8(1),a=t.getUint8(2),s=t.getUint8(3),l=t.getUint8(4),c=this.HEADER_LENGTH+this.META_LENGTH,h=n.decode(e.slice(c,c+r));c=c+r;let p=n.decode(e.slice(c,c+a));c=c+a;let v=n.decode(e.slice(c,c+s));c=c+s;let y=n.decode(e.slice(c,c+l));c=c+l;let w=e.slice(c,e.byteLength),T={status:y,response:w};return{join_ref:h,ref:p,topic:v,event:Qu.reply,payload:T}},decodeBroadcast(e,t,n){let r=t.getUint8(1),a=t.getUint8(2),s=this.HEADER_LENGTH+2,l=n.decode(e.slice(s,s+r));s=s+r;let c=n.decode(e.slice(s,s+a));s=s+a;let h=e.slice(s,e.byteLength);return{join_ref:null,ref:null,topic:l,event:c,payload:h}}},IG=class{constructor(e,t={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=t.timeout||DG,this.transport=t.transport||Ul.WebSocket||ev,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=t.longPollFallbackMs,this.fallbackTimer=null,this.sessionStore=t.sessionStorage||Ul&&Ul.sessionStorage,this.establishedConnections=0,this.defaultEncoder=tE.encode.bind(tE),this.defaultDecoder=tE.decode.bind(tE),this.closeWasClean=!1,this.disconnecting=!1,this.binaryType=t.binaryType||"arraybuffer",this.connectClock=1,this.pageHidden=!1,this.transport!==ev?(this.encode=t.encode||this.defaultEncoder,this.decode=t.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let n=null;Fp&&Fp.addEventListener&&(Fp.addEventListener("pagehide",r=>{this.conn&&(this.disconnect(),n=this.connectClock)}),Fp.addEventListener("pageshow",r=>{n===this.connectClock&&(n=null,this.connect())}),Fp.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"?this.pageHidden=!0:(this.pageHidden=!1,this.isConnected()||this.teardown(()=>this.connect()))})),this.heartbeatIntervalMs=t.heartbeatIntervalMs||3e4,this.rejoinAfterMs=r=>t.rejoinAfterMs?t.rejoinAfterMs(r):[1e3,2e3,5e3][r-1]||1e4,this.reconnectAfterMs=r=>t.reconnectAfterMs?t.reconnectAfterMs(r):[10,50,100,150,200,250,500,1e3,2e3][r-1]||5e3,this.logger=t.logger||null,!this.logger&&t.debug&&(this.logger=(r,a,s)=>{console.log(`${r}: ${a}`,s)}),this.longpollerTimeout=t.longpollerTimeout||2e4,this.params=$0(t.params||{}),this.endPoint=`${e}/${$C.websocket}`,this.vsn=t.vsn||RG,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new NO(()=>{if(this.pageHidden){this.log("Not reconnecting as page is hidden!"),this.teardown();return}this.teardown(()=>this.connect())},this.reconnectAfterMs),this.authToken=t.authToken}getLongPollTransport(){return ev}replaceTransport(e){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.conn&&(this.conn.close(),this.conn=null),this.transport=e}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let e=eE.appendParams(eE.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return e.charAt(0)!=="/"?e:e.charAt(1)==="/"?`${this.protocol()}:${e}`:`${this.protocol()}://${location.host}${e}`}disconnect(e,t,n){this.connectClock++,this.disconnecting=!0,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(()=>{this.disconnecting=!1,e&&e()},t,n)}connect(e){e&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=$0(e)),!(this.conn&&!this.disconnecting)&&(this.longPollFallbackMs&&this.transport!==ev?this.connectWithFallback(ev,this.longPollFallbackMs):this.transportConnect())}log(e,t,n){this.logger&&this.logger(e,t,n)}hasLogger(){return this.logger!==null}onOpen(e){let t=this.makeRef();return this.stateChangeCallbacks.open.push([t,e]),t}onClose(e){let t=this.makeRef();return this.stateChangeCallbacks.close.push([t,e]),t}onError(e){let t=this.makeRef();return this.stateChangeCallbacks.error.push([t,e]),t}onMessage(e){let t=this.makeRef();return this.stateChangeCallbacks.message.push([t,e]),t}ping(e){if(!this.isConnected())return!1;let t=this.makeRef(),n=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:t});let r=this.onMessage(a=>{a.ref===t&&(this.off([r]),e(Date.now()-n))});return!0}transportConnect(){this.connectClock++,this.closeWasClean=!1;let e;this.authToken&&(e=["phoenix",`${e_}${btoa(this.authToken).replace(/=/g,"")}`]),this.conn=new this.transport(this.endPointURL(),e),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=t=>this.onConnError(t),this.conn.onmessage=t=>this.onConnMessage(t),this.conn.onclose=t=>this.onConnClose(t)}getSession(e){return this.sessionStore&&this.sessionStore.getItem(e)}storeSession(e,t){this.sessionStore&&this.sessionStore.setItem(e,t)}connectWithFallback(e,t=2500){clearTimeout(this.fallbackTimer);let n=!1,r=!0,a,s,l=c=>{this.log("transport",`falling back to ${e.name}...`,c),this.off([a,s]),r=!1,this.replaceTransport(e),this.transportConnect()};if(this.getSession(`phx:fallback:${e.name}`))return l("memorized");this.fallbackTimer=setTimeout(l,t),s=this.onError(c=>{this.log("transport","error",c),r&&!n&&(clearTimeout(this.fallbackTimer),l(c))}),this.fallbackRef&&this.off([this.fallbackRef]),this.fallbackRef=this.onOpen(()=>{if(n=!0,!r)return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${e.name}`,"true"),this.log("transport",`established ${e.name} fallback`);clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(l,t),this.ping(c=>{this.log("transport","connected to primary after",c),this.primaryPassedHealthCheck=!0,clearTimeout(this.fallbackTimer)})}),this.transportConnect()}clearHeartbeats(){clearTimeout(this.heartbeatTimer),clearTimeout(this.heartbeatTimeoutTimer)}onConnOpen(){this.hasLogger()&&this.log("transport",`${this.transport.name} connected to ${this.endPointURL()}`),this.closeWasClean=!1,this.disconnecting=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.resetHeartbeat(),this.stateChangeCallbacks.open.forEach(([,e])=>e())}heartbeatTimeout(){this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection"),this.triggerChanError(),this.closeWasClean=!1,this.teardown(()=>this.reconnectTimer.scheduleTimeout(),LG,"heartbeat timeout"))}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}teardown(e,t,n){if(!this.conn)return e&&e();let r=this.connectClock;this.waitForBufferDone(()=>{r===this.connectClock&&(this.conn&&(t?this.conn.close(t,n||""):this.conn.close()),this.waitForSocketClosed(()=>{r===this.connectClock&&(this.conn&&(this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){},this.conn.onclose=function(){},this.conn=null),e&&e())}))})}waitForBufferDone(e,t=1){if(t===5||!this.conn||!this.conn.bufferedAmount){e();return}setTimeout(()=>{this.waitForBufferDone(e,t+1)},150*t)}waitForSocketClosed(e,t=1){if(t===5||!this.conn||this.conn.readyState===zl.closed){e();return}setTimeout(()=>{this.waitForSocketClosed(e,t+1)},150*t)}onConnClose(e){this.conn&&(this.conn.onclose=()=>{});let t=e&&e.code;this.hasLogger()&&this.log("transport","close",e),this.triggerChanError(),this.clearHeartbeats(),!this.closeWasClean&&t!==1e3&&this.reconnectTimer.scheduleTimeout(),this.stateChangeCallbacks.close.forEach(([,n])=>n(e))}onConnError(e){this.hasLogger()&&this.log("transport",e);let t=this.transport,n=this.establishedConnections;this.stateChangeCallbacks.error.forEach(([,r])=>{r(e,t,n)}),(t===this.transport||n>0)&&this.triggerChanError()}triggerChanError(){this.channels.forEach(e=>{e.isErrored()||e.isLeaving()||e.isClosed()||e.trigger(Qu.error)})}connectionState(){switch(this.conn&&this.conn.readyState){case zl.connecting:return"connecting";case zl.open:return"open";case zl.closing:return"closing";default:return"closed"}}isConnected(){return this.connectionState()==="open"}remove(e){this.off(e.stateChangeRefs),this.channels=this.channels.filter(t=>t!==e)}off(e){for(let t in this.stateChangeCallbacks)this.stateChangeCallbacks[t]=this.stateChangeCallbacks[t].filter(([n])=>e.indexOf(n)===-1)}channel(e,t={}){let n=new NG(e,t,this);return this.channels.push(n),n}push(e){if(this.hasLogger()){let{topic:t,event:n,payload:r,ref:a,join_ref:s}=e;this.log("push",`${t} ${n} (${s}, ${a})`,r)}this.isConnected()?this.encode(e,t=>this.conn.send(t)):this.sendBuffer.push(()=>this.encode(e,t=>this.conn.send(t)))}makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}sendHeartbeat(){this.pendingHeartbeatRef&&!this.isConnected()||(this.pendingHeartbeatRef=this.makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef}),this.heartbeatTimeoutTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs))}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}onConnMessage(e){this.decode(e.data,t=>{let{topic:n,event:r,payload:a,ref:s,join_ref:l}=t;s&&s===this.pendingHeartbeatRef&&(this.clearHeartbeats(),this.pendingHeartbeatRef=null,this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)),this.hasLogger()&&this.log("receive",`${a.status||""} ${n} ${r} ${s&&"("+s+")"||""}`,a);for(let c=0;c<this.channels.length;c++){const h=this.channels[c];h.isMember(n,r,a,l)&&h.trigger(r,a,s,l)}for(let c=0;c<this.stateChangeCallbacks.message.length;c++){let[,h]=this.stateChangeCallbacks.message[c];h(t)}})}leaveOpenTopic(e){let t=this.channels.find(n=>n.topic===e&&(n.isJoined()||n.isJoining()));t&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${e}"`),t.leave())}};const MG=e=>{const t=e||rO(),[n,r]=t.split("://");return`${n==="https"?"wss":"ws"}://${r}/socket`};class FG extends AG{constructor(t){super(),this.config=t,this.channel=null,this.reconnectTimer=null,this.subscribeOptions=null,this.currentConversationId=null;const n=MG(t.baseUrl);typeof WebSocket>"u"&&Da(new Error("Failed to create WebSocket connection: WebSocket is not supported in this environment")),this.socket=new IG(n,{params:{token:t.channelId},heartbeatIntervalMs:3e4,longPollFallbackMs:2500,longpollerTimeout:3e4,reconnectAfterMs:r=>[1e3,2e3,4e3,8e3,16e3][r-1]||3e4}),this.socket.onOpen(()=>{this.setConnectionState("connected")}),this.socket.onError(r=>{Da(new Error(`WebSocket error occurred: ${JSON.stringify(r)}`)),this.handleSocketDisconnect()}),this.socket.onClose(()=>{this.setConnectionState("disconnected"),this.handleSocketDisconnect()})}async connect(){return new Promise(t=>{this.socket.connect();const n=()=>{this.socket.isConnected()?t():setTimeout(n,100)};n()})}disconnect(){this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.channel&&(this.channel.leave(),this.channel=null),this.socket&&this.socket.disconnect(),this.setConnectionState("disconnected")}async subscribe(t,n){this.currentConversationId=t,this.subscribeOptions=n,this.channel&&this.channel.leave(),this.channel=this.socket.channel(`conversations:${t}`,{user_id:n.userId,metadata:n.metadata,locale:n.locale,no_answer_fallback:n.noAnswerFallback,inactivity_timeout:0}),this.channel.on("phx_error",r=>{this.notifyError(new Error(`PHX error: ${JSON.stringify(r)}`))}),this.channel.on("stream_message",r=>{this.notifyMessage(r)}),this.channel.on("stream_event",r=>{this.notifyMessage(r)}),this.channel.on("loading",()=>{}),this.channel.join().receive("ok",()=>{}).receive("error",r=>{this.notifyError(new Error(`Unable to join conversation: ${JSON.stringify(r)}`))}).receive("timeout",()=>{this.notifyError(new Error("Channel join attempt timed out")),setTimeout(()=>this.subscribe(t,n),5e3)})}unsubscribe(){this.channel&&(this.channel.leave(),this.channel=null),this.currentConversationId=null,this.subscribeOptions=null}async sendMessageEvent(t){return new Promise((n,r)=>{if(!this.channel){r(new Error("No channel available"));return}this.channel.push("new_text",t).receive("ok",a=>{a[0]&&this.notifyMessage(a[0]),n()}).receive("error",a=>{const s=new Error(`Error sending message: ${JSON.stringify(a)}`);Da(s),r(s)}).receive("timeout",()=>{const a=new Error("Push request timed out");Da(a),r(a)})})}async sendActionEvent(t,n){return new Promise((r,a)=>{if(!this.channel){a(new Error("No channel available"));return}this.channel.push("action-event",{name:t,...n}).receive("ok",()=>{r()}).receive("error",()=>{a(new Error("Failed to send action event"))}).receive("timeout",()=>{a(new Error("Action event timed out"))})})}async sendConversationRatingEvent(t){return new Promise((n,r)=>{if(!this.channel){r(new Error("No channel available"));return}this.channel.push("conversation_rating",t).receive("ok",()=>{n()}).receive("error",a=>{const s=new Error(`Error sending conversation rating: ${JSON.stringify(a)}`);Da(s),r(s)}).receive("timeout",()=>{const a=new Error("Conversation rating request timed out");Da(a),r(a)})})}async sendConversationClosedEvent(t){return new Promise((n,r)=>{if(!this.channel){r(new Error("No channel available"));return}this.channel.push("conversation_closed",{reasoning:t}).receive("ok",()=>{n()}).receive("error",a=>{const s=new Error(`Error sending conversation closed event: ${JSON.stringify(a)}`);Da(s),r(s)}).receive("timeout",()=>{const a=new Error("Conversation closed event timed out");Da(a),r(a)})})}handleSocketDisconnect(){if(this.reconnectTimer)return;let t=0;const n=10,r=async()=>{if(this.socket.isConnected()){this.reconnectTimer=null,this.currentConversationId&&this.subscribeOptions&&await this.subscribe(this.currentConversationId,this.subscribeOptions);return}if(t+=1,t>n){this.reconnectTimer=null,this.setConnectionState("error"),this.notifyError(new Error("Maximum reconnection attempts exceeded."));return}this.setConnectionState("connecting"),this.socket.connect();const a=Math.min(1e3*Math.pow(2,t),3e4);this.reconnectTimer=setTimeout(r,a)};r()}}const PO=_.createContext(null),BG=({children:e,config:t})=>{const n=_.useMemo(()=>{const r={type:"phoenix",channelId:t.channelId,baseUrl:t.baseUrl,debug:t.debug};return new FG(r)},[t.channelId,t.baseUrl,t.debug]);return _.useEffect(()=>()=>{n.disconnect()},[n]),F.jsx(PO.Provider,{value:n,children:e})},t_=()=>{const e=_.useContext(PO);if(!e)throw new Error("useWebsocketClient must be used within a WebsocketClientProvider");return e},HG=(e=[])=>{const t=t_(),[n,r]=_.useState(e);_.useEffect(()=>t.onMessage(l=>{r(c=>UG(c,l))}),[t]);const a=_.useCallback(()=>{r([])},[]);return{messages:n,setMessages:r,resetMessages:a}},UG=(e,t)=>{const n=e.findIndex(r=>r.id===t.id&&r.sender_id===t.sender_id);return n>=0?e.map((r,a)=>a===n?t:r):[...e,t]},zG="freeday:",jG=e=>{try{return e&&(e.localStorage||e.sessionStorage)}catch{return{_db:{},getItem(n){return this._db[n]||null},setItem(n,r){this._db[n]=r},removeItem(n){delete this._db[n]}}}};function VG(e){const t=jG(e),n=l=>`${zG}${l}`,r=l=>{const c=t.getItem(n(l));if(!c)return null;try{return JSON.parse(c)}catch{return c}},a=(l,c)=>{t.setItem(n(l),JSON.stringify(c))},s=l=>{t.removeItem(n(l))};return{getUserId:()=>r("user_id"),setUserId:l=>a("user_id",l),removeUserId:()=>s("user_id"),setConversationId:l=>a("conversation_id",l),getConversationId:()=>r("conversation_id"),removeConversationId:()=>s("conversation_id"),setChannelId:l=>a("channel_id",l),getChannelId:()=>r("channel_id")}}class WG extends Error{constructor(t,n){super(t),this.name="ApiError",this.statusCode=n}}class nE{constructor(t=Rz){this.baseUrl=t}getDefaultOptions(t,n){return n instanceof FormData?{method:t,body:n}:{method:t,headers:{"Content-Type":"application/json"},body:n?JSON.stringify(n):void 0}}async fetch(t,n,r){try{const a=await fetch(t,this.getDefaultOptions(n,r));if(!a.ok)throw new WG(`${n} request failed: ${a.statusText}`,a.status);return a.json()}catch(a){throw Da(a),a}}async get(t,n={}){const r=new URLSearchParams(n).toString(),a=`${this.baseUrl}${t}?${r}`;return this.fetch(a,"GET")}async post(t,n){const r=`${this.baseUrl}${t}`;return this.fetch(r,"POST",n)}async put(t,n){const r=`${this.baseUrl}${t}`;return this.fetch(r,"PUT",n)}}class YG{constructor(t,n){this.token=t,this.http=new nE(n)}async healthCheck(){return this.http.get("/api/health-check").then(t=>t.status)}async updateWidgetSettingsMetadata(t){return this.http.put(`/api/widget/settings/${this.token}/metadata`,t)}async createNewUser(t={}){return this.http.post("/api/users",{user:{...t,first_seen:new Date().toISOString(),last_seen_at:new Date().toISOString()}}).then(n=>n.data)}async createNewConversation(t,n){return this.http.post("/api/conversations",{conversation:{user_id:t,token:n}}).then(r=>r.data)}}class n_{constructor(t,n){this.WEBCHAT_URL_PATH="/webchat/v1",this.channelId=t,this.http=n}mapToWidgetSettings(t){return{channelId:this.channelId,subtitle:t.subtitle,title:t.title,theme:t.theme,primaryColor:t.primary_color,digitalEmployeeName:t.bot_name,avatar:t.avatar,newMessagePlaceholder:t.new_message_placeholder,showFreedayBranding:t.show_freeday_branding,language:t.locale,disclaimer:t.disclaimer,bannerTitle:t.popup_title,bannerMessage:t.popup_message,enableCsat:t.enable_csat,enableAttachments:t.enable_attachments,startView:t.start_view_type,suggestions:t.start_view_suggestions,foldableStartViewTitle:t.foldable_start_view_title,foldableStartViewSubtitle:t.foldable_start_view_subtitle,noAnswerFallback:t.no_answer_fallback,analyticsEnabled:t.analytics_enabled,enableCentrifugo:t.enable_centrifugo,intro:{type:t.intro_type??m0.NONE,title:t.intro_title,description:t.intro_description}}}async fetchWidgetSettings(){return this.http.get(`${this.WEBCHAT_URL_PATH}/widget/${this.channelId}/settings`).then(t=>this.mapToWidgetSettings(t))}async fetchConversationById(t){return this.http.get(`${this.WEBCHAT_URL_PATH}/widget/${this.channelId}/conversations/${t}/events`)}async uploadAttachment(t){const n=new FormData;return n.append("file",t),this.http.post(`${this.WEBCHAT_URL_PATH}/widget/${this.channelId}/attachment`,n)}}const qG=({channelId:e})=>{const t=_.useMemo(()=>VG(globalThis),[]),[n,r]=_.useState(()=>t.getConversationId()??null),[a,s]=_.useState(()=>t.getUserId()??null),[l,c]=_.useState(!1);_.useEffect(()=>{t.getChannelId()!==e&&(t.removeConversationId(),r(null)),t.setChannelId(e)},[e,t]);const h=_.useCallback(async()=>{c(!0);const y=new YG(e,rO()),w=async()=>(await y.createNewUser({})).id;try{const T=a??await w(),A=await y.createNewConversation(T,e);return r(A.id),t.setConversationId(A.id),s(T),t.setUserId(T),{conversationId:A.id,userId:T}}catch(T){return Da(T,"Failed to create conversation"),null}finally{c(!1)}},[t,a,e]),p=_.useCallback(async()=>{if(!n)return null;try{return await new n_(e,new nE(jC())).fetchConversationById(n)}catch(y){return Da(y,"Error fetching conversation events"),null}},[n]),v=_.useCallback(()=>{r(null),t.removeConversationId()},[t]);return{conversationId:n,userId:a,isInitializing:l,createConversation:h,resumeConversation:p,resetConversation:v}},GG=()=>{const e=t_(),[t,n]=_.useState(()=>e.connectionState);_.useEffect(()=>{const c=e.onConnectionStateChange(h=>{n(h)});return n(e.connectionState),c},[e]);const r=_.useCallback(async()=>{await e.connect()},[e]),a=_.useCallback(()=>{e.disconnect()},[e]),s=_.useCallback(async(c,h)=>{await e.subscribe(c,h)},[e]),l=_.useCallback(()=>{e.unsubscribe()},[e]);return{connectionState:t,isConnected:t==="connected",connect:r,disconnect:a,subscribe:s,unsubscribe:l}},KG=()=>{const e=t_(),t=_.useCallback(async s=>{(s.text?.trim().length>0||s.image)&&await e.sendMessageEvent(s)},[e]),n=_.useCallback(async(s,l)=>{await e.sendActionEvent(s,l)},[e]),r=_.useCallback(async s=>{await e.sendConversationRatingEvent(s)},[e]),a=_.useCallback(async s=>{await e.sendConversationClosedEvent(s)},[e]);return{sendMessageEvent:t,sendActionEvent:n,sendConversationRatingEvent:r,sendConversationClosedEvent:a}},QG=e=>{const t=e.flatMap(r=>r.blocks.filter(a=>a.type==="typing")),n=t[t.length-1];return!!n&&n.typing},IO=_.createContext({scrollableDivRef:{current:null},endDivRef:{current:null},buttonGroupPortalRef:{current:null},chatWindowRef:{current:null},chatWindowContentRef:{current:null},state:{messages:[],userId:null,conversationId:null,settings:{},isWaitingOnFirstStream:!1,hasSentMessageThisSession:!1,hasResumedConversation:!1,isOpen:!1,isTyping:!1,shouldDisplayBranding:!1,showFeedbackModal:!1,inShadowDom:!0},sendNewMessage:async()=>{},sendConversationRating:async()=>{},sendConversationClosed:async()=>{},handleRestart:()=>{},handleEnd:()=>{},handleActionEvent:()=>{}}),ai=()=>_.useContext(IO);function XG({children:e,config:t,inShadowDom:n=!1}){const{i18n:r}=Gr(["menu"]),a=_.useRef(!1),s={title:"Welcome!",subtitle:"How can we help you?",primaryColor:"#1890ff",dropdownItems:[],closeable:!0,debug:!1,version:"1.2.0"},[l,c]=_.useState({...s,...t}),{messages:h,setMessages:p,resetMessages:v}=HG(t?.messages||[]),{conversationId:y,userId:w,createConversation:T,resumeConversation:A,resetConversation:R}=qG({channelId:t.channelId}),{connect:N,disconnect:O,subscribe:M,unsubscribe:H}=GG(),{sendMessageEvent:V,sendActionEvent:K,sendConversationRatingEvent:Y,sendConversationClosedEvent:Z}=KG(),{updateCssVariables:X}=CG(),{emit:ce,subscribe:W,unsubscribe:me}=Jb(),oe=_.useRef(null),te=_.useRef(null),le=_.useRef(null),Ae=_.useRef(null),_e=_.useRef(null),[ve,se]=_.useState(!1),[De,U]=_.useState(!1),[$,be]=_.useState(!1),[j,Ue]=_.useState(!1);_.useEffect(()=>{if(h.length>0&&$){const Bt=h.at(-1);Bt&&!Cf(Bt,w)&&be(!1)}},[h,w,$]);const Ke=_.useCallback(async(Bt,Jt)=>{await M(Bt,{userId:Jt,metadata:l.metadata,locale:l.language,noAnswerFallback:l.noAnswerFallback})},[M,l]),Qe=_.useCallback(async()=>{const Bt=await T();return Bt&&await Ke(Bt.conversationId,Bt.userId),Bt},[T,M,l]),St=_.useCallback(async()=>{try{if(await N(),y){const Bt=await A();Bt&&(p(Bt.events),Ue(!0)),await Ke(y,w||"")}else await Qe();Of("chat:loaded",{start_view:l.startView}),ce("chat:loaded")}catch(Bt){Da(Bt,"Failed to initialize chat")}},[N,y,A,p,M,w,l,Qe,Ke,ce]);_.useEffect(()=>{a.current||(a.current=!0)},[]),_.useEffect(()=>()=>{O()},[O]);const qe=_.useCallback(async Bt=>{const Jt=Bt;c(yr=>({...yr,...Jt,metadata:Jt.metadata??{}})),Jt.primaryColor&&X({"--primary":zC(Jt.primaryColor)}),await r.changeLanguage(Jt.language),await St(),Bt.suggestionMessage&&setTimeout(async()=>{await pn({text:Bt.suggestionMessage})},1e3)},[X,r,St]),Rt=_.useCallback(Bt=>{se(!!Bt.isOpen)},[]),_t=_.useCallback(async()=>{await Z("user restarted the chat"),H(),v(),R(),await Qe()},[Z,H,v,R,Qe]),Zt=_.useCallback(()=>{H(),O(),v(),R(),localStorage.removeItem("freeday:intro_seen")},[H,O,v,R]);_.useEffect(()=>(W(Nr.START,qe),W(Nr.TOGGLE,Rt),W(Nr.RESTART,_t),()=>{me(Nr.START,qe),me(Nr.TOGGLE,Rt),me(Nr.RESTART,_t)}),[W,me,qe,Rt,_t]);const pn=_.useCallback(async Bt=>{U(!0),be(!0),h.some(yr=>Cf(yr,w))||Of("conversation:started",{start_view:l.startView}),ce("message:sent",{text:Bt.text,hasImage:!!Bt.image}),y||await Qe(),await V(Bt)},[h,w,l,ce,y,Qe,V]),xn=_.useMemo(()=>QG(h),[h]),ut=_.useMemo(()=>({messages:h,userId:w,conversationId:y,settings:l,isWaitingOnFirstStream:$,hasSentMessageThisSession:De,hasResumedConversation:j,isTyping:xn,isOpen:ve,shouldDisplayBranding:l?.showFreedayBranding??!1,showFeedbackModal:!1,inShadowDom:n}),[h,w,y,l,$,De,j,xn,ve,n]),qn=_.useMemo(()=>({state:ut,sendNewMessage:pn,handleRestart:_t,handleEnd:Zt,scrollableDivRef:oe,endDivRef:te,handleActionEvent:K,sendConversationRating:Y,sendConversationClosed:Z,buttonGroupPortalRef:le,chatWindowRef:Ae,chatWindowContentRef:_e}),[ut,pn,_t,Zt,K,Y,Z]);return F.jsx(IO.Provider,{value:qn,children:F.jsx(OO,{primaryColor:ut.settings?.primaryColor||t.primaryColor,children:e})})}const ZG=aq,JG=oq,$G=sq,MO=_.forwardRef(({className:e,sideOffset:t=4,...n},r)=>{const{state:a}=ai();return a?.inShadowDom?F.jsx(FC,{ref:r,sideOffset:t,className:ka("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n}):F.jsx(lq,{children:F.jsx(FC,{ref:r,sideOffset:t,className:ka("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})})});MO.displayName=FC.displayName;const eK={en:{common:{sourceCallToActionLabel:"View",sending:"Sending...",isThinking:"Is thinking...",send:"Send",openChat:"Open chat",closeNotification:"Close notification",bot:"The bot"},intro:{startChat:"Start chat"},header:{tooltipMinimizeChat:"Minimize chat",tooltipClose:"Close",tooltipOptions:"Options",typing:" is typing..."},feedback:{thumbsUp:"Helpful",thumbsDown:"Not helpful",modalPlaceholder:"Please provide your feedback here",modalTitle:"How could we improve our response?",modalDescription:"Can you tell us what went wrong?",modalSubmit:"Send",modalSubmittedTitle:"Thank you for your feedback",modalSubmittedDescription:"Your feedback will help us to enhance our service!"},menu:{menuTitle:"Options",restartConversationLabel:"Start new conversation"},footer:{newMessagePlaceholder:"Type a message..."},upload:{uploadImageButton:"Upload Image",uploadingText:"Uploading...",invalidFileType:"Please select a valid image file (JPEG, PNG, GIF or WebP)",fileSizeExceeded:"File size must be less than {{maxSize}}MB",processingError:"Failed to process image. Please try again.",imageLoadError:"Image unavailable",removeAttachment:"Remove attachment"},rateConversation:{header:"Rate your conversation",feedbackMessagePlacholder:"Share additional feedback (optional)",submittedTitle:"Thank you for your feedback!",submittedDescription:"Your feedback will help us to enhance our service!",submitFeedbackMessage:"Send",submittingFeedbackMessage:"Sending...",noFeedback:"No feedback"},resumeChat:{title:"Welcome back 👋!",subtitle:"Want to continue where you left off?",continueButton:"Yes, continue my conversation",startNewButton:"Start a new conversation"},closeChat:{title:"Do you want to end this chat?",description:"Once you close it, you won't be able to continue the conversation.",confirmButton:"Yes, I am done",cancelButton:"No, take me back"},modal:{close:"Close",back:"Back"}},nl:{common:{sourceCallToActionLabel:"Bekijk",sending:"Verzenden...",isThinking:"Is aan het denken...",send:"Versturen",openChat:"Open chat",closeNotification:"Sluit melding",bot:"De bot"},intro:{startChat:"Chat starten"},header:{tooltipMinimizeChat:"Minimaliseer chat",tooltipClose:"Sluit",tooltipOptions:"Opties",typing:" is aan het typen..."},feedback:{thumbsUp:"Nuttig",thumbsDown:"Niet nuttig",modalPlaceholder:"Deel hier jouw feedback",modalTitle:"Hoe kunnen we jouw ervaring verbeteren?",modalDescription:"Kun je ons vertellen wat er mis ging?",modalSubmit:"Deel feedback",modalSubmittedTitle:"Bedankt voor jouw feedback",modalSubmittedDescription:"Jouw feedback helpt ons om onze service te verbeteren!"},menu:{menuTitle:"Opties",restartConversationLabel:"Start nieuw gesprek"},footer:{newMessagePlaceholder:"Schrijf hier je bericht"},upload:{uploadImageButton:"Afbeelding uploaden",uploadingText:"Bezig met uploaden...",invalidFileType:"Selecteer een geldig afbeeldingsbestand (JPEG, PNG, GIF of WebP)",fileSizeExceeded:"Bestandsgrootte moet kleiner zijn dan {{maxSize}}MB",processingError:"Afbeelding verwerken mislukt. Probeer het opnieuw.",imageLoadError:"Afbeelding niet beschikbaar",removeAttachment:"Bijlage verwijderen"},rateConversation:{header:"Hoe was jouw gesprek?",feedbackMessagePlacholder:"Deel hier jouw feedback (optioneel)",submittedTitle:"Bedankt voor de feedback!",submittedDescription:"Dit helpt ons enorm om onze service te verbeteren.",submitFeedbackMessage:"Verstuur",submittingFeedbackMessage:"Bezig met versturen...",noFeedback:"Geen feedback"},resumeChat:{title:"Welkom terug 👋!",subtitle:"Wil je verdergaan waar je was gebleven?",continueButton:"Ja, ga verder met mijn gesprek",startNewButton:"Start een nieuw gesprek"},closeChat:{title:"Wil je deze chat beëindigen?",description:"Zodra je de chat sluit, kun je het gesprek niet meer voortzetten.",confirmButton:"Ja, ik ben klaar",cancelButton:"Nee, ga terug"},modal:{close:"Sluit",back:"Terug"}},fr:{common:{sourceCallToActionLabel:"Voir",sending:"Envoi...",isThinking:"Est en train de penser...",send:"Envoyer",openChat:"Ouvrir le chat",closeNotification:"Fermer la notification",bot:"Le bot"},intro:{startChat:"Ouvrir le chat"},header:{tooltipMinimizeChat:"Minimiser le chat",tooltipClose:"Fermer",tooltipOptions:"Options",typing:" est en train d’écrire..."},feedback:{thumbsUp:"Utile",thumbsDown:"Pas utile",modalPlaceholder:"Veuillez fournir vos commentaires ici",modalTitle:"Comment pouvons-nous améliorer notre réponse ?",modalDescription:"Pouvez-vous nous dire ce qui n’a pas fonctionné ?",modalSubmit:"Envoyer",modalSubmittedTitle:"Merci pour votre retour",modalSubmittedDescription:"Vos commentaires nous aideront à améliorer notre service !"},menu:{menuTitle:"Options",restartConversationLabel:"Démarrer une nouvelle conversation"},footer:{newMessagePlaceholder:"Tapez un message..."},upload:{uploadImageButton:"Télécharger une image",uploadingText:"Téléchargement...",invalidFileType:"Veuillez sélectionner un fichier image valide (JPEG, PNG, GIF ou WebP)",fileSizeExceeded:"La taille du fichier doit être inférieure à {{maxSize}}MB",processingError:"Échec du traitement de l'image. Veuillez réessayer.",imageLoadError:"Image non disponible",removeAttachment:"Supprimer la pièce jointe"},rateConversation:{header:"Comment s'est déroulée votre entretien?",feedbackMessagePlacholder:"Partagez vos commentaires ici (optionnel)",submittedTitle:"Merci pour le retour d'information!",submittedDescription:"Vos commentaires nous aideront à améliorer notre service.",submitFeedbackMessage:"Envoyer",submittingFeedbackMessage:"Envoi en cours...",noFeedback:"Pas de commentaire"},resumeChat:{title:"Bon retour 👋!",subtitle:"Voulez-vous reprendre où vous vous êtes arrêté?",continueButton:"Oui, continuer ma conversation",startNewButton:"Démarrer une nouvelle conversation"},closeChat:{title:"Voulez-vous terminer cette conversation?",description:"Une fois fermée, vous ne pourrez plus continuer la conversation.",confirmButton:"Oui, j'ai terminé",cancelButton:"Non, revenir en arrière"},modal:{close:"Fermer",back:"Retour"}},it:{common:{sourceCallToActionLabel:"Visualizza",sending:"Invio in corso...",isThinking:"Sta pensando...",send:"Invia",openChat:"Apri chat",closeNotification:"Chiudi notifica",bot:"Il bot"},intro:{startChat:"Apri chat"},header:{tooltipMinimizeChat:"Minimizza la chat",tooltipClose:"Chiudi",tooltipOptions:"Opzioni",typing:" sta scrivendo..."},feedback:{thumbsUp:"Utile",thumbsDown:"Non utile",modalPlaceholder:"Fornisci il tuo feedback qui",modalTitle:"Come possiamo migliorare la nostra risposta?",modalDescription:"Puoi dirci cosa non ha funzionato?",modalSubmit:"Invia",modalSubmittedTitle:"Grazie per il tuo feedback",modalSubmittedDescription:"Il tuo feedback ci aiuterà a migliorare il nostro servizio!"},menu:{menuTitle:"Opzioni",restartConversationLabel:"Inizia una nuova conversazione"},footer:{newMessagePlaceholder:"Scrivi un messaggio..."},upload:{uploadImageButton:"Carica immagine",uploadingText:"Caricamento...",invalidFileType:"Seleziona un file immagine valido (JPEG, PNG, GIF o WebP)",fileSizeExceeded:"La dimensione del file deve essere inferiore a {{maxSize}}MB",processingError:"Elaborazione dell'immagine non riuscita. Riprova.",imageLoadError:"Immagine non disponibile",removeAttachment:"Rimuovi allegato"},rateConversation:{header:"Valuta la tua conversazione",feedbackMessagePlacholder:"Condividi un feedback aggiuntivo (opzionale)",submittedTitle:"Grazie per il tuo feedback!",submittedDescription:"Il tuo feedback ci aiuterà a migliorare il nostro servizio!",submitFeedbackMessage:"Invia",submittingFeedbackMessage:"Invio in corso...",noFeedback:"Nessun feedback"},resumeChat:{title:"Bentornato 👋!",subtitle:"Vuoi continuare da dove eri rimasto?",continueButton:"Sì, continua la mia conversazione",startNewButton:"Inizia una nuova conversazione"},closeChat:{title:"Vuoi terminare questa chat?",description:"Una volta chiusa, non potrai più continuare la conversazione.",confirmButton:"Sì, ho finito",cancelButton:"No, torna indietro"},modal:{close:"Chiudi",back:"Indietro"}},de:{common:{sourceCallToActionLabel:"Ansehen",sending:"Wird gesendet...",isThinking:"Denkt nach...",send:"Senden",openChat:"Chat öffnen",closeNotification:"Benachrichtigung schließen",bot:"Der Bot"},intro:{startChat:"Chat starten"},header:{tooltipMinimizeChat:"Chat minimieren",tooltipClose:"Schließen",tooltipOptions:"Optionen",typing:" schreibt..."},feedback:{thumbsUp:"Hilfreich",thumbsDown:"Nicht hilfreich",modalPlaceholder:"Bitte gib hier Dein Feedback ein",modalTitle:"Wie können wir unsere Antwort verbessern?",modalDescription:"Was ist schiefgelaufen? Teile uns Dein Feedback mit.",modalSubmit:"Senden",modalSubmittedTitle:"Danke für Dein Feedback",modalSubmittedDescription:"Dein Feedback hilft uns, unseren Service zu verbessern!"},menu:{menuTitle:"Optionen",restartConversationLabel:"Neue Konversation starten"},footer:{newMessagePlaceholder:"Nachricht eingeben..."},upload:{uploadImageButton:"Bild hochladen",uploadingText:"Hochladen...",invalidFileType:"Bitte wähle eine gültige Bilddatei (JPEG, PNG, GIF oder WebP)",fileSizeExceeded:"Dateigröße muss kleiner als {{maxSize}}MB sein",processingError:"Bildverarbeitung fehlgeschlagen. Bitte versuche es erneut.",imageLoadError:"Bild nicht verfügbar",removeAttachment:"Anhang entfernen"},rateConversation:{header:"Bewerte Deine Konversation",feedbackMessagePlacholder:"Zusätzliches Feedback teilen (optional)",submittedTitle:"Danke für Dein Feedback!",submittedDescription:"Dein Feedback hilft uns, unseren Service zu verbessern!",submitFeedbackMessage:"Senden",submittingFeedbackMessage:"Wird gesendet...",noFeedback:"Kein Feedback"},resumeChat:{title:"Willkommen zurück 👋!",subtitle:"Möchtest Du dort weitermachen, wo Du aufgehört hast?",continueButton:"Ja, meine Unterhaltung fortsetzen",startNewButton:"Neue Unterhaltung starten"},closeChat:{title:"Möchtest Du diesen Chat beenden?",description:"Sobald Du ihn schließt, kannst Du die Unterhaltung nicht fortsetzen.",confirmButton:"Ja, ich bin fertig",cancelButton:"Nein, zurück"},modal:{close:"Schließen",back:"Zurück"}},es:{common:{sourceCallToActionLabel:"Ver",sending:"Enviando...",isThinking:"Está pensando...",send:"Enviar",openChat:"Abrir chat",closeNotification:"Cerrar notificación",bot:"El bot"},intro:{startChat:"Abrir chat"},header:{tooltipMinimizeChat:"Minimizar chat",tooltipClose:"Cerrar",tooltipOptions:"Opciones",typing:" está escribiendo..."},feedback:{thumbsUp:"Útil",thumbsDown:"No útil",modalPlaceholder:"Por favor, proporciona tu comentario aquí",modalTitle:"¿Cómo podemos mejorar nuestra respuesta?",modalDescription:"¿Puedes contarnos qué salió mal?",modalSubmit:"Enviar",modalSubmittedTitle:"Gracias por tu comentario",modalSubmittedDescription:"¡Tu opinión nos ayudará a mejorar nuestro servicio!"},menu:{menuTitle:"Opciones",restartConversationLabel:"Iniciar una nueva conversación"},footer:{newMessagePlaceholder:"Escribe un mensaje..."},upload:{uploadImageButton:"Subir imagen",uploadingText:"Subiendo...",invalidFileType:"Por favor, selecciona un archivo de imagen válido (JPEG, PNG, GIF o WebP)",fileSizeExceeded:"El tamaño del archivo debe ser menor a {{maxSize}}MB",processingError:"Error al procesar la imagen. Por favor, inténtalo de nuevo.",imageLoadError:"Imagen no disponible",removeAttachment:"Eliminar adjunto"},rateConversation:{header:"Valora tu conversación",feedbackMessagePlacholder:"Comparte comentarios adicionales (opcional)",submittedTitle:"¡Gracias por tu comentario!",submittedDescription:"Tu opinión nos ayudará a mejorar nuestro servicio.",submitFeedbackMessage:"Enviar",submittingFeedbackMessage:"Enviando...",noFeedback:"Sin comentarios"},resumeChat:{title:"¡Bienvenido de nuevo 👋!",subtitle:"¿Quieres continuar donde lo dejaste?",continueButton:"Sí, continuar mi conversación",startNewButton:"Iniciar una nueva conversación"},closeChat:{title:"¿Quieres terminar este chat?",description:"Una vez que lo cierres, no podrás continuar la conversación.",confirmButton:"Sí, he terminado",cancelButton:"No, volver atrás"},modal:{close:"Cerrar",back:"Volver"}}};Ra.use(mG).init({resources:eK,lng:"en",fallbackLng:"en",interpolation:{escapeValue:!1}});const FO={posthog:{project_key:"phc_JeeePECzKqZPUbgQd1Voo3CsQta7ggHpKxPPlpKg1Fz",api_host:"https://eu.posthog.com"}};var BO=_.createContext({client:ys,bootstrap:void 0});function HO(e,t,n){if(n===void 0&&(n=new WeakMap),e===t)return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(n.has(e)&&n.get(e)===t)return!0;n.set(e,t);var r=Object.keys(e),a=Object.keys(t);if(r.length!==a.length)return!1;for(var s=0,l=r;s<l.length;s++){var c=l[s];if(!a.includes(c)||!HO(e[c],t[c],n))return!1}return!0}function tK(e){var t,n,r=e.children,a=e.client,s=e.apiKey,l=e.options,c=_.useRef(null),h=_.useMemo(function(){return a?(s&&console.warn("[PostHog.js] You have provided both `client` and `apiKey` to `PostHogProvider`. `apiKey` will be ignored in favour of `client`."),l&&console.warn("[PostHog.js] You have provided both `client` and `options` to `PostHogProvider`. `options` will be ignored in favour of `client`."),a):(s||console.warn("[PostHog.js] No `apiKey` or `client` were provided to `PostHogProvider`. Using default global `window.posthog` instance. You must initialize it manually. This is not recommended behavior."),ys)},[a,s,JSON.stringify(l)]);return _.useEffect(function(){if(!a){var p=c.current;p?(s!==p.apiKey&&console.warn("[PostHog.js] You have provided a different `apiKey` to `PostHogProvider` than the one that was already initialized. This is not supported by our provider and we'll keep using the previous key. If you need to toggle between API Keys you need to control the `client` yourself and pass it in as a prop rather than an `apiKey` prop."),l&&!HO(l,p.options)&&ys.set_config(l),c.current={apiKey:s,options:l??{}}):(ys.__loaded&&console.warn("[PostHog.js] `posthog` was already loaded elsewhere. This may cause issues."),ys.init(s,l),c.current={apiKey:s,options:l??{}})}},[a,s,JSON.stringify(l)]),ge.createElement(BO.Provider,{value:{client:h,bootstrap:(t=l?.bootstrap)!==null&&t!==void 0?t:(n=a?.config)===null||n===void 0?void 0:n.bootstrap}},r)}var r_=function(e){return typeof e=="function"},i_=function(e,t){return i_=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(n[a]=r[a])},i_(e,t)};function nK(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");i_(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}typeof SuppressedError=="function"&&SuppressedError;var rK={componentStack:null,exceptionEvent:null,error:null},iK={INVALID_FALLBACK:"[PostHog.js][PostHogErrorBoundary] Invalid fallback prop, provide a valid React element or a function that returns a valid React element."};(function(e){nK(t,e);function t(n){var r=e.call(this,n)||this;return r.state=rK,r}return t.prototype.componentDidCatch=function(n,r){var a=this.props.additionalProperties,s;r_(a)?s=a(n):typeof a=="object"&&(s=a);var l=this.context.client,c=l.captureException(n,s),h=r.componentStack;this.setState({error:n,componentStack:h??null,exceptionEvent:c})},t.prototype.render=function(){var n=this.props,r=n.children,a=n.fallback,s=this.state;if(s.componentStack==null)return r_(r)?r():r;var l=r_(a)?ge.createElement(a,{error:s.error,componentStack:s.componentStack,exceptionEvent:s.exceptionEvent}):a;return ge.isValidElement(l)?l:(console.warn(iK.INVALID_FALLBACK),ge.createElement(ge.Fragment,null))},t.contextType=BO,t})(ge.Component);const aK=["freeday-app-beta.web.app","freeday-app-beta.firebaseapp.com","beta-chat.freeday.ai"],oK=()=>{typeof window<"u"&&!aK.includes(window.location.hostname)&&ys.init(FO.posthog.project_key,{cookieless_mode:"always",api_host:FO.posthog.api_host,autocapture:!1,disable_session_recording:!0,capture_pageview:!1,capture_pageleave:!1,advanced_disable_feature_flags_on_first_load:!0})},sK=({children:e})=>(_.useEffect(()=>{oK()},[]),F.jsx(tK,{client:ys,children:e})),UO=_.createContext(void 0),lK=({children:e})=>{const t=_.useRef(null),[n,r]=_.useState(null),[a,s]=_.useState(null),[l,c]=_.useState(null),[h,p]=_.useState(!1),v=_.useMemo(()=>!!l||h,[l,h]),y=_.useCallback(A=>{a&&URL.revokeObjectURL(a),r(A),c(null),s(A?URL.createObjectURL(A):null)},[a]),w=_.useCallback(()=>{t.current&&(t.current.value=""),a&&URL.revokeObjectURL(a),r(null),s(null),c(null),p(!1)},[a]),T=_.useMemo(()=>({fileInputRef:t,selectedFile:n,setSelectedFile:y,previewUrl:a,error:l,setError:c,isLoading:h,setIsLoading:p,hasUploadState:v,clearUploadedFile:w}),[t,l,h,v,w]);return F.jsx(UO.Provider,{value:T,children:e})},tv=()=>{const e=_.useContext(UO);if(e===void 0)throw new Error("useUploadState must be used within an UploadStateProvider");return e},uK=({children:e,config:t,inShadowDom:n=!1})=>{if(!t?.channelId)return F.jsx("div",{children:"No channelId provided..."});let r=F.jsx(BG,{config:{channelId:t.channelId,baseUrl:t.baseUrl},children:F.jsx(OO,{primaryColor:t.primaryColor,children:F.jsx(TG,{i18n:Ra,children:F.jsx(ZG,{children:F.jsx(SG,{children:F.jsx(XG,{config:t,inShadowDom:n,children:F.jsx(lK,{children:e})})})})})})});return t.analyticsEnabled&&(r=F.jsx(sK,{children:r})),r},rE=({size:e=24})=>F.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,fill:"none",viewBox:"0 0 32 32",children:[F.jsx("path",{fill:"currentColor",d:"M15 6v2H5v16h8.116a1 1 0 0 1 .875.5l2 3.5 2-3.5a1.001 1.001 0 0 1 .875-.5H27v-7h2v7a2 2 0 0 1-2 2h-7.554l-1.71 2.992a2 2 0 0 1-3.472 0L12.554 26H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h10Z"}),F.jsx("path",{fill:"currentColor",d:"M29.898 8.95a.978.978 0 0 1-.646.926l-3.196 1.18-1.177 3.198a.987.987 0 0 1-1.85 0l-1.185-3.198-3.198-1.177a.987.987 0 0 1 0-1.85l3.198-1.185 1.177-3.198a.986.986 0 0 1 1.85 0l1.185 3.198 3.198 1.177a.978.978 0 0 1 .643.929Z"})]}),cK={button:"_button_14uy3_1"},dK=({onToggleWidget:e})=>{const{t}=Gr(),n=r=>{r.stopPropagation(),e()};return F.jsx("button",{className:cK.button,onClick:n,"aria-label":t("common:openChat"),"data-testid":"chat-button",children:F.jsx(rE,{})})};function iE(e,t){window.dispatchEvent(new StorageEvent("storage",{key:e,newValue:t}))}const zO=(e,t)=>{const n=JSON.stringify(t);window.localStorage.setItem(e,n),iE(e,n)},fK=e=>{window.localStorage.removeItem(e),iE(e,null)},jO=e=>window.localStorage.getItem(e),hK=e=>(window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)),pK=()=>{throw Error("useLocalStorage is a client-only hook")};function VO(e,t){const n=()=>jO(e),r=_.useSyncExternalStore(hK,n,pK),a=_.useCallback(s=>{try{const l=typeof s=="function"?s(JSON.parse(r)):s;l==null?fK(e):zO(e,l)}catch(l){console.warn(l)}},[e,r]);return _.useEffect(()=>{jO(e)===null&&typeof t<"u"&&zO(e,t)},[e,t]),[r?JSON.parse(r):t,a]}const WO=(e,t)=>{const n=JSON.stringify(t);window.sessionStorage.setItem(e,n),iE(e,n)},mK=e=>{window.sessionStorage.removeItem(e),iE(e,null)},YO=e=>window.sessionStorage.getItem(e),gK=e=>(window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)),vK=()=>{throw Error("useSessionStorage is a client-only hook")};function yK(e,t){const n=()=>YO(e),r=_.useSyncExternalStore(gK,n,vK),a=_.useCallback(s=>{try{const l=typeof s=="function"?s(JSON.parse(r)):s;l==null?mK(e):WO(e,l)}catch(l){console.warn(l)}},[e,r]);return _.useEffect(()=>{YO(e)===null&&typeof t<"u"&&WO(e,t)},[e,t]),[r?JSON.parse(r):t,a]}const a_=_.createContext({});function o_(e){const t=_.useRef(null);return t.current===null&&(t.current=e()),t.current}const s_=typeof window<"u",qO=s_?_.useLayoutEffect:_.useEffect,aE=_.createContext(null);function l_(e,t){e.indexOf(t)===-1&&e.push(t)}function u_(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}const jl=(e,t,n)=>n>t?t:n<e?e:n;function c_(e,t){return t?`${e}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${t}`:e}var bK={};let Bp=()=>{},Xu=()=>{};typeof process<"u"&&bK?.NODE_ENV!=="production"&&(Bp=(e,t,n)=>{!e&&typeof console<"u"&&console.warn(c_(t,n))},Xu=(e,t,n)=>{if(!e)throw new Error(c_(t,n))});const Zu={},GO=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function KO(e){return typeof e=="object"&&e!==null}const QO=e=>/^0[^.\s]+$/u.test(e);function d_(e){let t;return()=>(t===void 0&&(t=e()),t)}const bs=e=>e,EK=(e,t)=>n=>t(e(n)),nv=(...e)=>e.reduce(EK),rv=(e,t,n)=>{const r=t-e;return r===0?1:(n-e)/r};class f_{constructor(){this.subscriptions=[]}add(t){return l_(this.subscriptions,t),()=>u_(this.subscriptions,t)}notify(t,n,r){const a=this.subscriptions.length;if(a)if(a===1)this.subscriptions[0](t,n,r);else for(let s=0;s<a;s++){const l=this.subscriptions[s];l&&l(t,n,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const Vl=e=>e*1e3,Es=e=>e/1e3;function XO(e,t){return t?e*(1e3/t):0}const ZO=new Set;function h_(e,t,n){e||ZO.has(t)||(console.warn(c_(t,n)),ZO.add(t))}const JO=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,wK=1e-7,xK=12;function TK(e,t,n,r,a){let s,l,c=0;do l=t+(n-t)/2,s=JO(l,r,a)-e,s>0?n=l:t=l;while(Math.abs(s)>wK&&++c<xK);return l}function iv(e,t,n,r){if(e===t&&n===r)return bs;const a=s=>TK(s,0,1,e,n);return s=>s===0||s===1?s:JO(a(s),t,r)}const $O=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,eN=e=>t=>1-e(1-t),tN=iv(.33,1.53,.69,.99),p_=eN(tN),nN=$O(p_),rN=e=>(e*=2)<1?.5*p_(e):.5*(2-Math.pow(2,-10*(e-1))),m_=e=>1-Math.sin(Math.acos(e)),iN=eN(m_),aN=$O(m_),SK=iv(.42,0,1,1),CK=iv(0,0,.58,1),oN=iv(.42,0,.58,1),_K=e=>Array.isArray(e)&&typeof e[0]!="number",sN=e=>Array.isArray(e)&&typeof e[0]=="number",lN={linear:bs,easeIn:SK,easeInOut:oN,easeOut:CK,circIn:m_,circInOut:aN,circOut:iN,backIn:p_,backInOut:nN,backOut:tN,anticipate:rN},AK=e=>typeof e=="string",uN=e=>{if(sN(e)){Xu(e.length===4,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");const[t,n,r,a]=e;return iv(t,n,r,a)}else if(AK(e))return Xu(lN[e]!==void 0,`Invalid easing type '${e}'`,"invalid-easing-type"),lN[e];return e},oE=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function kK(e,t){let n=new Set,r=new Set,a=!1,s=!1;const l=new WeakSet;let c={delta:0,timestamp:0,isProcessing:!1};function h(v){l.has(v)&&(p.schedule(v),e()),v(c)}const p={schedule:(v,y=!1,w=!1)=>{const A=w&&a?n:r;return y&&l.add(v),A.has(v)||A.add(v),v},cancel:v=>{r.delete(v),l.delete(v)},process:v=>{if(c=v,a){s=!0;return}a=!0,[n,r]=[r,n],n.forEach(h),n.clear(),a=!1,s&&(s=!1,p.process(v))}};return p}const RK=40;function cN(e,t){let n=!1,r=!0;const a={delta:0,timestamp:0,isProcessing:!1},s=()=>n=!0,l=oE.reduce((H,V)=>(H[V]=kK(s),H),{}),{setup:c,read:h,resolveKeyframes:p,preUpdate:v,update:y,preRender:w,render:T,postRender:A}=l,R=()=>{const H=Zu.useManualTiming?a.timestamp:performance.now();n=!1,Zu.useManualTiming||(a.delta=r?1e3/60:Math.max(Math.min(H-a.timestamp,RK),1)),a.timestamp=H,a.isProcessing=!0,c.process(a),h.process(a),p.process(a),v.process(a),y.process(a),w.process(a),T.process(a),A.process(a),a.isProcessing=!1,n&&t&&(r=!1,e(R))},N=()=>{n=!0,r=!0,a.isProcessing||e(R)};return{schedule:oE.reduce((H,V)=>{const K=l[V];return H[V]=(Y,Z=!1,X=!1)=>(n||N(),K.schedule(Y,Z,X)),H},{}),cancel:H=>{for(let V=0;V<oE.length;V++)l[oE[V]].cancel(H)},state:a,steps:l}}const{schedule:Mr,cancel:od,state:da,steps:g_}=cN(typeof requestAnimationFrame<"u"?requestAnimationFrame:bs,!0);let sE;function DK(){sE=void 0}const to={now:()=>(sE===void 0&&to.set(da.isProcessing||Zu.useManualTiming?da.timestamp:performance.now()),sE),set:e=>{sE=e,queueMicrotask(DK)}},dN=e=>t=>typeof t=="string"&&t.startsWith(e),fN=dN("--"),LK=dN("var(--"),v_=e=>LK(e)?OK.test(e.split("/*")[0].trim()):!1,OK=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function hN(e){return typeof e!="string"?!1:e.split("/*")[0].includes("var(--")}const Hp={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},av={...Hp,transform:e=>jl(0,1,e)},lE={...Hp,default:1},ov=e=>Math.round(e*1e5)/1e5,y_=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function NK(e){return e==null}const PK=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,b_=(e,t)=>n=>!!(typeof n=="string"&&PK.test(n)&&n.startsWith(e)||t&&!NK(n)&&Object.prototype.hasOwnProperty.call(n,t)),pN=(e,t,n)=>r=>{if(typeof r!="string")return r;const[a,s,l,c]=r.match(y_);return{[e]:parseFloat(a),[t]:parseFloat(s),[n]:parseFloat(l),alpha:c!==void 0?parseFloat(c):1}},IK=e=>jl(0,255,e),E_={...Hp,transform:e=>Math.round(IK(e))},If={test:b_("rgb","red"),parse:pN("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+E_.transform(e)+", "+E_.transform(t)+", "+E_.transform(n)+", "+ov(av.transform(r))+")"};function MK(e){let t="",n="",r="",a="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),a=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),a=e.substring(4,5),t+=t,n+=n,r+=r,a+=a),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:a?parseInt(a,16)/255:1}}const w_={test:b_("#"),parse:MK,transform:If.transform},sv=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),sd=sv("deg"),Wl=sv("%"),kt=sv("px"),FK=sv("vh"),BK=sv("vw"),mN={...Wl,parse:e=>Wl.parse(e)/100,transform:e=>Wl.transform(e*100)},Up={test:b_("hsl","hue"),parse:pN("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+Wl.transform(ov(t))+", "+Wl.transform(ov(n))+", "+ov(av.transform(r))+")"},xi={test:e=>If.test(e)||w_.test(e)||Up.test(e),parse:e=>If.test(e)?If.parse(e):Up.test(e)?Up.parse(e):w_.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?If.transform(e):Up.transform(e),getAnimatableNone:e=>{const t=xi.parse(e);return t.alpha=0,xi.transform(t)}},HK=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function UK(e){return isNaN(e)&&typeof e=="string"&&(e.match(y_)?.length||0)+(e.match(HK)?.length||0)>0}const gN="number",vN="color",zK="var",jK="var(",yN="${}",VK=/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 lv(e){const t=e.toString(),n=[],r={color:[],number:[],var:[]},a=[];let s=0;const c=t.replace(VK,h=>(xi.test(h)?(r.color.push(s),a.push(vN),n.push(xi.parse(h))):h.startsWith(jK)?(r.var.push(s),a.push(zK),n.push(h)):(r.number.push(s),a.push(gN),n.push(parseFloat(h))),++s,yN)).split(yN);return{values:n,split:c,indexes:r,types:a}}function bN(e){return lv(e).values}function EN(e){const{split:t,types:n}=lv(e),r=t.length;return a=>{let s="";for(let l=0;l<r;l++)if(s+=t[l],a[l]!==void 0){const c=n[l];c===gN?s+=ov(a[l]):c===vN?s+=xi.transform(a[l]):s+=a[l]}return s}}const WK=e=>typeof e=="number"?0:xi.test(e)?xi.getAnimatableNone(e):e;function YK(e){const t=bN(e);return EN(e)(t.map(WK))}const ld={test:UK,parse:bN,createTransformer:EN,getAnimatableNone:YK};function x_(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<.16666666666666666?e+(t-e)*6*n:n<.5?t:n<.6666666666666666?e+(t-e)*(.6666666666666666-n)*6:e}function qK({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let a=0,s=0,l=0;if(!t)a=s=l=n;else{const c=n<.5?n*(1+t):n+t-n*t,h=2*n-c;a=x_(h,c,e+.3333333333333333),s=x_(h,c,e),l=x_(h,c,e-.3333333333333333)}return{red:Math.round(a*255),green:Math.round(s*255),blue:Math.round(l*255),alpha:r}}function uE(e,t){return n=>n>0?t:e}const Kr=(e,t,n)=>e+(t-e)*n,T_=(e,t,n)=>{const r=e*e,a=n*(t*t-r)+r;return a<0?0:Math.sqrt(a)},GK=[w_,If,Up],KK=e=>GK.find(t=>t.test(e));function wN(e){const t=KK(e);if(Bp(!!t,`'${e}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!t)return!1;let n=t.parse(e);return t===Up&&(n=qK(n)),n}const xN=(e,t)=>{const n=wN(e),r=wN(t);if(!n||!r)return uE(e,t);const a={...n};return s=>(a.red=T_(n.red,r.red,s),a.green=T_(n.green,r.green,s),a.blue=T_(n.blue,r.blue,s),a.alpha=Kr(n.alpha,r.alpha,s),If.transform(a))},S_=new Set(["none","hidden"]);function QK(e,t){return S_.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function XK(e,t){return n=>Kr(e,t,n)}function C_(e){return typeof e=="number"?XK:typeof e=="string"?v_(e)?uE:xi.test(e)?xN:$K:Array.isArray(e)?TN:typeof e=="object"?xi.test(e)?xN:ZK:uE}function TN(e,t){const n=[...e],r=n.length,a=e.map((s,l)=>C_(s)(s,t[l]));return s=>{for(let l=0;l<r;l++)n[l]=a[l](s);return n}}function ZK(e,t){const n={...e,...t},r={};for(const a in n)e[a]!==void 0&&t[a]!==void 0&&(r[a]=C_(e[a])(e[a],t[a]));return a=>{for(const s in r)n[s]=r[s](a);return n}}function JK(e,t){const n=[],r={color:0,var:0,number:0};for(let a=0;a<t.values.length;a++){const s=t.types[a],l=e.indexes[s][r[s]],c=e.values[l]??0;n[a]=c,r[s]++}return n}const $K=(e,t)=>{const n=ld.createTransformer(t),r=lv(e),a=lv(t);return r.indexes.var.length===a.indexes.var.length&&r.indexes.color.length===a.indexes.color.length&&r.indexes.number.length>=a.indexes.number.length?S_.has(e)&&!a.values.length||S_.has(t)&&!r.values.length?QK(e,t):nv(TN(JK(r,a),a.values),n):(Bp(!0,`Complex values '${e}' and '${t}' 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"),uE(e,t))};function SN(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?Kr(e,t,n):C_(e)(e,t)}const eQ=e=>{const t=({timestamp:n})=>e(n);return{start:(n=!0)=>Mr.update(t,n),stop:()=>od(t),now:()=>da.isProcessing?da.timestamp:to.now()}},CN=(e,t,n=10)=>{let r="";const a=Math.max(Math.round(t/n),2);for(let s=0;s<a;s++)r+=Math.round(e(s/(a-1))*1e4)/1e4+", ";return`linear(${r.substring(0,r.length-2)})`},cE=2e4;function __(e){let t=0;const n=50;let r=e.next(t);for(;!r.done&&t<cE;)t+=n,r=e.next(t);return t>=cE?1/0:t}function tQ(e,t=100,n){const r=n({...e,keyframes:[0,t]}),a=Math.min(__(r),cE);return{type:"keyframes",ease:s=>r.next(a*s).value/t,duration:Es(a)}}const nQ=5;function _N(e,t,n){const r=Math.max(t-nQ,0);return XO(n-e(r),t-r)}const Qr={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},A_=.001;function rQ({duration:e=Qr.duration,bounce:t=Qr.bounce,velocity:n=Qr.velocity,mass:r=Qr.mass}){let a,s;Bp(e<=Vl(Qr.maxDuration),"Spring duration must be 10 seconds or less","spring-duration-limit");let l=1-t;l=jl(Qr.minDamping,Qr.maxDamping,l),e=jl(Qr.minDuration,Qr.maxDuration,Es(e)),l<1?(a=p=>{const v=p*l,y=v*e,w=v-n,T=k_(p,l),A=Math.exp(-y);return A_-w/T*A},s=p=>{const y=p*l*e,w=y*n+n,T=Math.pow(l,2)*Math.pow(p,2)*e,A=Math.exp(-y),R=k_(Math.pow(p,2),l);return(-a(p)+A_>0?-1:1)*((w-T)*A)/R}):(a=p=>{const v=Math.exp(-p*e),y=(p-n)*e+1;return-A_+v*y},s=p=>{const v=Math.exp(-p*e),y=(n-p)*(e*e);return v*y});const c=5/e,h=aQ(a,s,c);if(e=Vl(e),isNaN(h))return{stiffness:Qr.stiffness,damping:Qr.damping,duration:e};{const p=Math.pow(h,2)*r;return{stiffness:p,damping:l*2*Math.sqrt(r*p),duration:e}}}const iQ=12;function aQ(e,t,n){let r=n;for(let a=1;a<iQ;a++)r=r-e(r)/t(r);return r}function k_(e,t){return e*Math.sqrt(1-t*t)}const oQ=["duration","bounce"],sQ=["stiffness","damping","mass"];function AN(e,t){return t.some(n=>e[n]!==void 0)}function lQ(e){let t={velocity:Qr.velocity,stiffness:Qr.stiffness,damping:Qr.damping,mass:Qr.mass,isResolvedFromDuration:!1,...e};if(!AN(e,sQ)&&AN(e,oQ))if(e.visualDuration){const n=e.visualDuration,r=2*Math.PI/(n*1.2),a=r*r,s=2*jl(.05,1,1-(e.bounce||0))*Math.sqrt(a);t={...t,mass:Qr.mass,stiffness:a,damping:s}}else{const n=rQ(e);t={...t,...n,mass:Qr.mass},t.isResolvedFromDuration=!0}return t}function dE(e=Qr.visualDuration,t=Qr.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:r,restDelta:a}=n;const s=n.keyframes[0],l=n.keyframes[n.keyframes.length-1],c={done:!1,value:s},{stiffness:h,damping:p,mass:v,duration:y,velocity:w,isResolvedFromDuration:T}=lQ({...n,velocity:-Es(n.velocity||0)}),A=w||0,R=p/(2*Math.sqrt(h*v)),N=l-s,O=Es(Math.sqrt(h/v)),M=Math.abs(N)<5;r||(r=M?Qr.restSpeed.granular:Qr.restSpeed.default),a||(a=M?Qr.restDelta.granular:Qr.restDelta.default);let H;if(R<1){const K=k_(O,R);H=Y=>{const Z=Math.exp(-R*O*Y);return l-Z*((A+R*O*N)/K*Math.sin(K*Y)+N*Math.cos(K*Y))}}else if(R===1)H=K=>l-Math.exp(-O*K)*(N+(A+O*N)*K);else{const K=O*Math.sqrt(R*R-1);H=Y=>{const Z=Math.exp(-R*O*Y),X=Math.min(K*Y,300);return l-Z*((A+R*O*N)*Math.sinh(X)+K*N*Math.cosh(X))/K}}const V={calculatedDuration:T&&y||null,next:K=>{const Y=H(K);if(T)c.done=K>=y;else{let Z=K===0?A:0;R<1&&(Z=K===0?Vl(A):_N(H,K,Y));const X=Math.abs(Z)<=r,ce=Math.abs(l-Y)<=a;c.done=X&&ce}return c.value=c.done?l:Y,c},toString:()=>{const K=Math.min(__(V),cE),Y=CN(Z=>V.next(K*Z).value,K,30);return K+"ms "+Y},toTransition:()=>{}};return V}dE.applyToOptions=e=>{const t=tQ(e,100,dE);return e.ease=t.ease,e.duration=Vl(t.duration),e.type="keyframes",e};function R_({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:a=10,bounceStiffness:s=500,modifyTarget:l,min:c,max:h,restDelta:p=.5,restSpeed:v}){const y=e[0],w={done:!1,value:y},T=X=>c!==void 0&&X<c||h!==void 0&&X>h,A=X=>c===void 0?h:h===void 0||Math.abs(c-X)<Math.abs(h-X)?c:h;let R=n*t;const N=y+R,O=l===void 0?N:l(N);O!==N&&(R=O-y);const M=X=>-R*Math.exp(-X/r),H=X=>O+M(X),V=X=>{const ce=M(X),W=H(X);w.done=Math.abs(ce)<=p,w.value=w.done?O:W};let K,Y;const Z=X=>{T(w.value)&&(K=X,Y=dE({keyframes:[w.value,A(w.value)],velocity:_N(H,X,w.value),damping:a,stiffness:s,restDelta:p,restSpeed:v}))};return Z(0),{calculatedDuration:null,next:X=>{let ce=!1;return!Y&&K===void 0&&(ce=!0,V(X),Z(X)),K!==void 0&&X>=K?Y.next(X-K):(!ce&&V(X),w)}}}function uQ(e,t,n){const r=[],a=n||Zu.mix||SN,s=e.length-1;for(let l=0;l<s;l++){let c=a(e[l],e[l+1]);if(t){const h=Array.isArray(t)?t[l]||bs:t;c=nv(h,c)}r.push(c)}return r}function cQ(e,t,{clamp:n=!0,ease:r,mixer:a}={}){const s=e.length;if(Xu(s===t.length,"Both input and output ranges must be the same length","range-length"),s===1)return()=>t[0];if(s===2&&t[0]===t[1])return()=>t[1];const l=e[0]===e[1];e[0]>e[s-1]&&(e=[...e].reverse(),t=[...t].reverse());const c=uQ(t,r,a),h=c.length,p=v=>{if(l&&v<e[0])return t[0];let y=0;if(h>1)for(;y<e.length-2&&!(v<e[y+1]);y++);const w=rv(e[y],e[y+1],v);return c[y](w)};return n?v=>p(jl(e[0],e[s-1],v)):p}function dQ(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const a=rv(0,t,r);e.push(Kr(n,1,a))}}function fQ(e){const t=[0];return dQ(t,e.length-1),t}function hQ(e,t){return e.map(n=>n*t)}function pQ(e,t){return e.map(()=>t||oN).splice(0,e.length-1)}function zp({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const a=_K(r)?r.map(uN):uN(r),s={done:!1,value:t[0]},l=hQ(n&&n.length===t.length?n:fQ(t),e),c=cQ(l,t,{ease:Array.isArray(a)?a:pQ(t,a)});return{calculatedDuration:e,next:h=>(s.value=c(h),s.done=h>=e,s)}}const mQ=e=>e!==null;function D_(e,{repeat:t,repeatType:n="loop"},r,a=1){const s=e.filter(mQ),c=a<0||t&&n!=="loop"&&t%2===1?0:s.length-1;return!c||r===void 0?s[c]:r}const gQ={decay:R_,inertia:R_,tween:zp,keyframes:zp,spring:dE};function kN(e){typeof e.type=="string"&&(e.type=gQ[e.type])}class L_{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(t=>{this.resolve=t})}notifyFinished(){this.resolve()}then(t,n){return this.finished.then(t,n)}}var vQ={};const yQ=e=>e/100;class O_ extends L_{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{const{motionValue:n}=this.options;n&&n.updatedAt!==to.now()&&this.tick(to.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),this.options.onStop?.())},this.options=t,this.initAnimation(),this.play(),t.autoplay===!1&&this.pause()}initAnimation(){const{options:t}=this;kN(t);const{type:n=zp,repeat:r=0,repeatDelay:a=0,repeatType:s,velocity:l=0}=t;let{keyframes:c}=t;const h=n||zp;vQ.NODE_ENV!=="production"&&h!==zp&&Xu(c.length<=2,`Only two keyframes currently supported with spring and inertia animations. Trying to animate ${c}`,"spring-two-frames"),h!==zp&&typeof c[0]!="number"&&(this.mixKeyframes=nv(yQ,SN(c[0],c[1])),c=[0,100]);const p=h({...t,keyframes:c});s==="mirror"&&(this.mirroredGenerator=h({...t,keyframes:[...c].reverse(),velocity:-l})),p.calculatedDuration===null&&(p.calculatedDuration=__(p));const{calculatedDuration:v}=p;this.calculatedDuration=v,this.resolvedDuration=v+a,this.totalDuration=this.resolvedDuration*(r+1)-a,this.generator=p}updateTime(t){const n=Math.round(t-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=n}tick(t,n=!1){const{generator:r,totalDuration:a,mixKeyframes:s,mirroredGenerator:l,resolvedDuration:c,calculatedDuration:h}=this;if(this.startTime===null)return r.next(0);const{delay:p=0,keyframes:v,repeat:y,repeatType:w,repeatDelay:T,type:A,onUpdate:R,finalKeyframe:N}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-a/this.speed,this.startTime)),n?this.currentTime=t:this.updateTime(t);const O=this.currentTime-p*(this.playbackSpeed>=0?1:-1),M=this.playbackSpeed>=0?O<0:O>a;this.currentTime=Math.max(O,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=a);let H=this.currentTime,V=r;if(y){const X=Math.min(this.currentTime,a)/c;let ce=Math.floor(X),W=X%1;!W&&X>=1&&(W=1),W===1&&ce--,ce=Math.min(ce,y+1),ce%2&&(w==="reverse"?(W=1-W,T&&(W-=T/c)):w==="mirror"&&(V=l)),H=jl(0,1,W)*c}const K=M?{done:!1,value:v[0]}:V.next(H);s&&(K.value=s(K.value));let{done:Y}=K;!M&&h!==null&&(Y=this.playbackSpeed>=0?this.currentTime>=a:this.currentTime<=0);const Z=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&Y);return Z&&A!==R_&&(K.value=D_(v,this.options,N,this.speed)),R&&R(K.value),Z&&this.finish(),K}then(t,n){return this.finished.then(t,n)}get duration(){return Es(this.calculatedDuration)}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+Es(t)}get time(){return Es(this.currentTime)}set time(t){t=Vl(t),this.currentTime=t,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.playbackSpeed),this.driver?.start(!1)}get speed(){return this.playbackSpeed}set speed(t){this.updateTime(to.now());const n=this.playbackSpeed!==t;this.playbackSpeed=t,n&&(this.time=Es(this.currentTime))}play(){if(this.isStopped)return;const{driver:t=eQ,startTime:n}=this.options;this.driver||(this.driver=t(a=>this.tick(a))),this.options.onPlay?.();const r=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=r):this.holdTime!==null?this.startTime=r-this.holdTime:this.startTime||(this.startTime=n??r),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(to.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}attachTimeline(t){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),t.observe(this)}}function bQ(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}const Mf=e=>e*180/Math.PI,N_=e=>{const t=Mf(Math.atan2(e[1],e[0]));return P_(t)},EQ={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:N_,rotateZ:N_,skewX:e=>Mf(Math.atan(e[1])),skewY:e=>Mf(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},P_=e=>(e=e%360,e<0&&(e+=360),e),RN=N_,DN=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),LN=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),wQ={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:DN,scaleY:LN,scale:e=>(DN(e)+LN(e))/2,rotateX:e=>P_(Mf(Math.atan2(e[6],e[5]))),rotateY:e=>P_(Mf(Math.atan2(-e[2],e[0]))),rotateZ:RN,rotate:RN,skewX:e=>Mf(Math.atan(e[4])),skewY:e=>Mf(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function I_(e){return e.includes("scale")?1:0}function M_(e,t){if(!e||e==="none")return I_(t);const n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let r,a;if(n)r=wQ,a=n;else{const c=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=EQ,a=c}if(!a)return I_(t);const s=r[t],l=a[1].split(",").map(TQ);return typeof s=="function"?s(l):l[s]}const xQ=(e,t)=>{const{transform:n="none"}=getComputedStyle(e);return M_(n,t)};function TQ(e){return parseFloat(e.trim())}const jp=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Vp=new Set(jp),ON=e=>e===Hp||e===kt,SQ=new Set(["x","y","z"]),CQ=jp.filter(e=>!SQ.has(e));function _Q(e){const t=[];return CQ.forEach(n=>{const r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),t}const ud={width:({x:e},{paddingLeft:t="0",paddingRight:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t="0",paddingBottom:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>M_(t,"x"),y:(e,{transform:t})=>M_(t,"y")};ud.translateX=ud.x,ud.translateY=ud.y;const Ff=new Set;let F_=!1,B_=!1,H_=!1;function NN(){if(B_){const e=Array.from(Ff).filter(r=>r.needsMeasurement),t=new Set(e.map(r=>r.element)),n=new Map;t.forEach(r=>{const a=_Q(r);a.length&&(n.set(r,a),r.render())}),e.forEach(r=>r.measureInitialState()),t.forEach(r=>{r.render();const a=n.get(r);a&&a.forEach(([s,l])=>{r.getValue(s)?.set(l)})}),e.forEach(r=>r.measureEndState()),e.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}B_=!1,F_=!1,Ff.forEach(e=>e.complete(H_)),Ff.clear()}function PN(){Ff.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(B_=!0)})}function AQ(){H_=!0,PN(),NN(),H_=!1}class U_{constructor(t,n,r,a,s,l=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=r,this.motionValue=a,this.element=s,this.isAsync=l}scheduleResolve(){this.state="scheduled",this.isAsync?(Ff.add(this),F_||(F_=!0,Mr.read(PN),Mr.resolveKeyframes(NN))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:r,motionValue:a}=this;if(t[0]===null){const s=a?.get(),l=t[t.length-1];if(s!==void 0)t[0]=s;else if(r&&n){const c=r.readValue(n,l);c!=null&&(t[0]=c)}t[0]===void 0&&(t[0]=l),a&&s===void 0&&a.set(t[0])}bQ(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),Ff.delete(this)}cancel(){this.state==="scheduled"&&(Ff.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const kQ=e=>e.startsWith("--");function RQ(e,t,n){kQ(t)?e.style.setProperty(t,n):e.style[t]=n}const DQ=d_(()=>window.ScrollTimeline!==void 0),LQ={};function OQ(e,t){const n=d_(e);return()=>LQ[t]??n()}const IN=OQ(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),uv=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,MN={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:uv([0,.65,.55,1]),circOut:uv([.55,0,1,.45]),backIn:uv([.31,.01,.66,-.59]),backOut:uv([.33,1.53,.69,.99])};function FN(e,t){if(e)return typeof e=="function"?IN()?CN(e,t):"ease-out":sN(e)?uv(e):Array.isArray(e)?e.map(n=>FN(n,t)||MN.easeOut):MN[e]}function NQ(e,t,n,{delay:r=0,duration:a=300,repeat:s=0,repeatType:l="loop",ease:c="easeOut",times:h}={},p=void 0){const v={[t]:n};h&&(v.offset=h);const y=FN(c,a);Array.isArray(y)&&(v.easing=y);const w={delay:r,duration:a,easing:Array.isArray(y)?"linear":y,fill:"both",iterations:s+1,direction:l==="reverse"?"alternate":"normal"};return p&&(w.pseudoElement=p),e.animate(v,w)}function BN(e){return typeof e=="function"&&"applyToOptions"in e}function PQ({type:e,...t}){return BN(e)&&IN()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class IQ extends L_{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!t)return;const{element:n,name:r,keyframes:a,pseudoElement:s,allowFlatten:l=!1,finalKeyframe:c,onComplete:h}=t;this.isPseudoElement=!!s,this.allowFlatten=l,this.options=t,Xu(typeof t.type!="string",`Mini animate() doesn't support "type" as a string.`,"mini-spring");const p=PQ(t);this.animation=NQ(n,r,a,p,s),p.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!s){const v=D_(a,this.options,c,this.speed);this.updateMotionValue?this.updateMotionValue(v):RQ(n,r,v),this.animation.cancel()}h?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;t==="idle"||t==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){this.isPseudoElement||this.animation.commitStyles?.()}get duration(){const t=this.animation.effect?.getComputedTiming?.().duration||0;return Es(Number(t))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+Es(t)}get time(){return Es(Number(this.animation.currentTime)||0)}set time(t){this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Vl(t)}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(t){this.manualStartTime=this.animation.startTime=t}attachTimeline({timeline:t,observe:n}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,t&&DQ()?(this.animation.timeline=t,bs):n(this)}}const HN={anticipate:rN,backInOut:nN,circInOut:aN};function MQ(e){return e in HN}function FQ(e){typeof e.ease=="string"&&MQ(e.ease)&&(e.ease=HN[e.ease])}const z_=10;class BQ extends IQ{constructor(t){FQ(t),kN(t),super(t),t.startTime!==void 0&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:n,onUpdate:r,onComplete:a,element:s,...l}=this.options;if(!n)return;if(t!==void 0){n.set(t);return}const c=new O_({...l,autoplay:!1}),h=Math.max(z_,to.now()-this.startTime),p=jl(0,z_,h-z_);n.setWithVelocity(c.sample(Math.max(0,h-p)).value,c.sample(h).value,p),c.stop()}}const UN=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(ld.test(e)||e==="0")&&!e.startsWith("url("));function HQ(e){const t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function UQ(e,t,n,r){const a=e[0];if(a===null)return!1;if(t==="display"||t==="visibility")return!0;const s=e[e.length-1],l=UN(a,t),c=UN(s,t);return Bp(l===c,`You are trying to animate ${t} from "${a}" to "${s}". "${l?s:a}" is not an animatable value.`,"value-not-animatable"),!l||!c?!1:HQ(e)||(n==="spring"||BN(n))&&r}function j_(e){e.duration=0,e.type="keyframes"}const zQ=new Set(["opacity","clipPath","filter","transform"]),jQ=d_(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function VQ(e){const{motionValue:t,name:n,repeatDelay:r,repeatType:a,damping:s,type:l}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;const{onUpdate:h,transformTemplate:p}=t.owner.getProps();return jQ()&&n&&zQ.has(n)&&(n!=="transform"||!p)&&!h&&!r&&a!=="mirror"&&s!==0&&l!=="inertia"}const WQ=40;class YQ extends L_{constructor({autoplay:t=!0,delay:n=0,type:r="keyframes",repeat:a=0,repeatDelay:s=0,repeatType:l="loop",keyframes:c,name:h,motionValue:p,element:v,...y}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=to.now();const w={autoplay:t,delay:n,type:r,repeat:a,repeatDelay:s,repeatType:l,name:h,motionValue:p,element:v,...y},T=v?.KeyframeResolver||U_;this.keyframeResolver=new T(c,(A,R,N)=>this.onKeyframesResolved(A,R,w,!N),h,p,v),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(t,n,r,a){this.keyframeResolver=void 0;const{name:s,type:l,velocity:c,delay:h,isHandoff:p,onUpdate:v}=r;this.resolvedAt=to.now(),UQ(t,s,l,c)||((Zu.instantAnimations||!h)&&v?.(D_(t,r,n)),t[0]=t[t.length-1],j_(r),r.repeat=0);const w={startTime:a?this.resolvedAt?this.resolvedAt-this.createdAt>WQ?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...r,keyframes:t},T=!p&&VQ(w)?new BQ({...w,element:w.motionValue.owner.current}):new O_(w);T.finished.then(()=>this.notifyFinished()).catch(bs),this.pendingTimeline&&(this.stopTimeline=T.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=T}get finished(){return this._animation?this.animation.finished:this._finished}then(t,n){return this.finished.finally(t).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),AQ()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(t){this.animation.time=t}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(t){this.animation.speed=t}get startTime(){return this.animation.startTime}attachTimeline(t){return this._animation?this.stopTimeline=this.animation.attachTimeline(t):this.pendingTimeline=t,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}const qQ=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function GQ(e){const t=qQ.exec(e);if(!t)return[,];const[,n,r,a]=t;return[`--${n??r}`,a]}const KQ=4;function zN(e,t,n=1){Xu(n<=KQ,`Max CSS variable fallback depth detected in property "${e}". This may indicate a circular fallback dependency.`,"max-css-var-depth");const[r,a]=GQ(e);if(!r)return;const s=window.getComputedStyle(t).getPropertyValue(r);if(s){const l=s.trim();return GO(l)?parseFloat(l):l}return v_(a)?zN(a,t,n+1):a}function V_(e,t){return e?.[t]??e?.default??e}const jN=new Set(["width","height","top","left","right","bottom",...jp]);var QQ={};const VN=30,XQ=e=>!isNaN(parseFloat(e));class ZQ{constructor(t,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=r=>{const a=to.now();if(this.updatedAt!==a&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const s of this.dependents)s.dirty()},this.hasAnimated=!1,this.setCurrent(t),this.owner=n.owner}setCurrent(t){this.current=t,this.updatedAt=to.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=XQ(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return QQ.NODE_ENV!=="production"&&h_(!1,'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'),this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new f_);const r=this.events[t].add(n);return t==="change"?()=>{r(),Mr.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t){this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t)}setWithVelocity(t,n,r){this.set(n),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-r}jump(t,n=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=to.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>VN)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,VN);return XO(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),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(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Wp(e,t){return new ZQ(e,t)}const La=e=>!!(e&&e.getVelocity),JQ={test:e=>e==="auto",parse:e=>e},WN=e=>t=>t.test(e),YN=[Hp,kt,Wl,sd,BK,FK,JQ],qN=e=>YN.find(WN(e));function $Q(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||QO(e):!0}const eX=new Set(["brightness","contrast","saturate","opacity"]);function tX(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=n.match(y_)||[];if(!r)return e;const a=n.replace(r,"");let s=eX.has(t)?1:0;return r!==n&&(s*=100),t+"("+s+a+")"}const nX=/\b([a-z-]*)\(.*?\)/gu,W_={...ld,getAnimatableNone:e=>{const t=e.match(nX);return t?t.map(tX).join(" "):e}},GN={...Hp,transform:Math.round},Y_={borderWidth:kt,borderTopWidth:kt,borderRightWidth:kt,borderBottomWidth:kt,borderLeftWidth:kt,borderRadius:kt,radius:kt,borderTopLeftRadius:kt,borderTopRightRadius:kt,borderBottomRightRadius:kt,borderBottomLeftRadius:kt,width:kt,maxWidth:kt,height:kt,maxHeight:kt,top:kt,right:kt,bottom:kt,left:kt,inset:kt,insetBlock:kt,insetBlockStart:kt,insetBlockEnd:kt,insetInline:kt,insetInlineStart:kt,insetInlineEnd:kt,padding:kt,paddingTop:kt,paddingRight:kt,paddingBottom:kt,paddingLeft:kt,paddingBlock:kt,paddingBlockStart:kt,paddingBlockEnd:kt,paddingInline:kt,paddingInlineStart:kt,paddingInlineEnd:kt,margin:kt,marginTop:kt,marginRight:kt,marginBottom:kt,marginLeft:kt,marginBlock:kt,marginBlockStart:kt,marginBlockEnd:kt,marginInline:kt,marginInlineStart:kt,marginInlineEnd:kt,backgroundPositionX:kt,backgroundPositionY:kt,...{rotate:sd,rotateX:sd,rotateY:sd,rotateZ:sd,scale:lE,scaleX:lE,scaleY:lE,scaleZ:lE,skew:sd,skewX:sd,skewY:sd,distance:kt,translateX:kt,translateY:kt,translateZ:kt,x:kt,y:kt,z:kt,perspective:kt,transformPerspective:kt,opacity:av,originX:mN,originY:mN,originZ:kt},zIndex:GN,fillOpacity:av,strokeOpacity:av,numOctaves:GN},rX={...Y_,color:xi,backgroundColor:xi,outlineColor:xi,fill:xi,stroke:xi,borderColor:xi,borderTopColor:xi,borderRightColor:xi,borderBottomColor:xi,borderLeftColor:xi,filter:W_,WebkitFilter:W_},KN=e=>rX[e];function QN(e,t){let n=KN(e);return n!==W_&&(n=ld),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const iX=new Set(["auto","none","0"]);function aX(e,t,n){let r=0,a;for(;r<e.length&&!a;){const s=e[r];typeof s=="string"&&!iX.has(s)&&lv(s).values.length&&(a=e[r]),r++}if(a&&n)for(const s of t)e[s]=QN(n,a)}class oX extends U_{constructor(t,n,r,a,s){super(t,n,r,a,s,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:n,name:r}=this;if(!n||!n.current)return;super.readKeyframes();for(let v=0;v<t.length;v++){let y=t[v];if(typeof y=="string"&&(y=y.trim(),v_(y))){const w=zN(y,n.current);w!==void 0&&(t[v]=w),v===t.length-1&&(this.finalKeyframe=y)}}if(this.resolveNoneKeyframes(),!jN.has(r)||t.length!==2)return;const[a,s]=t,l=qN(a),c=qN(s),h=hN(a),p=hN(s);if(h!==p&&ud[r]){this.needsMeasurement=!0;return}if(l!==c)if(ON(l)&&ON(c))for(let v=0;v<t.length;v++){const y=t[v];typeof y=="string"&&(t[v]=parseFloat(y))}else ud[r]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:n}=this,r=[];for(let a=0;a<t.length;a++)(t[a]===null||$Q(t[a]))&&r.push(a);r.length&&aX(t,r,n)}measureInitialState(){const{element:t,unresolvedKeyframes:n,name:r}=this;if(!t||!t.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=ud[r](t.measureViewportBox(),window.getComputedStyle(t.current)),n[0]=this.measuredOrigin;const a=n[n.length-1];a!==void 0&&t.getValue(r,a).jump(a,!1)}measureEndState(){const{element:t,name:n,unresolvedKeyframes:r}=this;if(!t||!t.current)return;const a=t.getValue(n);a&&a.jump(this.measuredOrigin,!1);const s=r.length-1,l=r[s];r[s]=ud[n](t.measureViewportBox(),window.getComputedStyle(t.current)),l!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=l),this.removedTransforms?.length&&this.removedTransforms.forEach(([c,h])=>{t.getValue(c).set(h)}),this.resolveNoneKeyframes()}}function sX(e,t,n){if(e instanceof EventTarget)return[e];if(typeof e=="string"){let r=document;const a=n?.[e]??r.querySelectorAll(e);return a?Array.from(a):[]}return Array.from(e)}const XN=(e,t)=>t&&typeof e=="number"?t.transform(e):e;function ZN(e){return KO(e)&&"offsetHeight"in e}const{schedule:q_}=cN(queueMicrotask,!1),Qs={x:!1,y:!1};function JN(){return Qs.x||Qs.y}function lX(e){return e==="x"||e==="y"?Qs[e]?null:(Qs[e]=!0,()=>{Qs[e]=!1}):Qs.x||Qs.y?null:(Qs.x=Qs.y=!0,()=>{Qs.x=Qs.y=!1})}function $N(e,t){const n=sX(e),r=new AbortController,a={passive:!0,...t,signal:r.signal};return[n,a,()=>r.abort()]}function e8(e){return!(e.pointerType==="touch"||JN())}function uX(e,t,n={}){const[r,a,s]=$N(e,n),l=c=>{if(!e8(c))return;const{target:h}=c,p=t(h,c);if(typeof p!="function"||!h)return;const v=y=>{e8(y)&&(p(y),h.removeEventListener("pointerleave",v))};h.addEventListener("pointerleave",v,a)};return r.forEach(c=>{c.addEventListener("pointerenter",l,a)}),s}const t8=(e,t)=>t?e===t?!0:t8(e,t.parentElement):!1,G_=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,cX=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function n8(e){return cX.has(e.tagName)||e.isContentEditable===!0}const fE=new WeakSet;function r8(e){return t=>{t.key==="Enter"&&e(t)}}function K_(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const dX=(e,t)=>{const n=e.currentTarget;if(!n)return;const r=r8(()=>{if(fE.has(n))return;K_(n,"down");const a=r8(()=>{K_(n,"up")}),s=()=>K_(n,"cancel");n.addEventListener("keyup",a,t),n.addEventListener("blur",s,t)});n.addEventListener("keydown",r,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),t)};function i8(e){return G_(e)&&!JN()}function fX(e,t,n={}){const[r,a,s]=$N(e,n),l=c=>{const h=c.currentTarget;if(!i8(c))return;fE.add(h);const p=t(h,c),v=(T,A)=>{window.removeEventListener("pointerup",y),window.removeEventListener("pointercancel",w),fE.has(h)&&fE.delete(h),i8(T)&&typeof p=="function"&&p(T,{success:A})},y=T=>{v(T,h===window||h===document||n.useGlobalTarget||t8(h,T.target))},w=T=>{v(T,!1)};window.addEventListener("pointerup",y,a),window.addEventListener("pointercancel",w,a)};return r.forEach(c=>{(n.useGlobalTarget?window:c).addEventListener("pointerdown",l,a),ZN(c)&&(c.addEventListener("focus",p=>dX(p,a)),!n8(c)&&!c.hasAttribute("tabindex")&&(c.tabIndex=0))}),s}function a8(e){return KO(e)&&"ownerSVGElement"in e}function hX(e){return a8(e)&&e.tagName==="svg"}const pX=[...YN,xi,ld],mX=e=>pX.find(WN(e)),Q_=_.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function o8(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function gX(...e){return t=>{let n=!1;const r=e.map(a=>{const s=o8(a,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let a=0;a<r.length;a++){const s=r[a];typeof s=="function"?s():o8(e[a],null)}}}}function vX(...e){return _.useCallback(gX(...e),e)}class yX extends _.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(n&&t.isPresent&&!this.props.isPresent){const r=n.offsetParent,a=ZN(r)&&r.offsetWidth||0,s=this.props.sizeRef.current;s.height=n.offsetHeight||0,s.width=n.offsetWidth||0,s.top=n.offsetTop,s.left=n.offsetLeft,s.right=a-s.width-s.left}return null}componentDidUpdate(){}render(){return this.props.children}}function bX({children:e,isPresent:t,anchorX:n,root:r}){const a=_.useId(),s=_.useRef(null),l=_.useRef({width:0,height:0,top:0,left:0,right:0}),{nonce:c}=_.useContext(Q_),h=e.props?.ref??e?.ref,p=vX(s,h);return _.useInsertionEffect(()=>{const{width:v,height:y,top:w,left:T,right:A}=l.current;if(t||!s.current||!v||!y)return;const R=n==="left"?`left: ${T}`:`right: ${A}`;s.current.dataset.motionPopId=a;const N=document.createElement("style");c&&(N.nonce=c);const O=r??document.head;return O.appendChild(N),N.sheet&&N.sheet.insertRule(`
171
171
  [data-motion-pop-id="${a}"] {
172
172
  position: absolute !important;
173
173
  width: ${v}px !important;
package/dist/webchat.mjs CHANGED
@@ -33285,6 +33285,7 @@ class uR {
33285
33285
  foldableStartViewSubtitle: t.foldable_start_view_subtitle,
33286
33286
  noAnswerFallback: t.no_answer_fallback,
33287
33287
  analyticsEnabled: t.analytics_enabled,
33288
+ enableCentrifugo: t.enable_centrifugo,
33288
33289
  intro: {
33289
33290
  type: t.intro_type ?? Xy.NONE,
33290
33291
  title: t.intro_title,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@freeday-ai/webchat",
3
- "version": "2026.01.14.08.42.12361",
3
+ "version": "2026.01.14.09.42.12362",
4
4
  "private": false,
5
5
  "files": [
6
6
  "dist"
@@ -13,7 +13,7 @@
13
13
  "@radix-ui/react-tooltip": "^1.1.4",
14
14
  "@tailwindcss/typography": "^0.5.15",
15
15
  "@types/i18next": "^13.0.0",
16
- "@types/phoenix": "^1.6.6",
16
+ "@types/phoenix": "^1.6.7",
17
17
  "@uidotdev/usehooks": "^2.4.1",
18
18
  "class-variance-authority": "^0.7.0",
19
19
  "clsx": "^2.1.1",
@@ -21,7 +21,7 @@
21
21
  "framer-motion": "^12.0.0",
22
22
  "i18next": "^25.0.0",
23
23
  "next-themes": "^0.4.4",
24
- "phoenix": "^1.7.20",
24
+ "phoenix": "^1.8.3",
25
25
  "posthog-js": "^1.215.3",
26
26
  "react": "^18",
27
27
  "react-canvas-confetti": "^2.0.7",