@freeday-ai/webchat 2026.1.1-5.3.46.12337 → 2026.1.1-5.6.7.12363

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),ju(c)||(n>t&&(s+=e.substring(t,n)),s+=c,t=n=a+1)}return n>t&&(s+=e.substring(t,e.length)),s},wV=!!wS||!!ES,F6="text/plain",kb=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=_j(l);return h&&c.push(h),a+"?"+c.join("&")},B0=(e,t)=>JSON.stringify(e,((n,r)=>typeof r=="bigint"?r.toString():r),t),sC=e=>{var{data:t,compression:n}=e;if(t){if(n===Wu.GZipJS){var r=bV((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 P6(y,0,w)})(B0(t)),{mtime:0}),a=new Blob([r],{type:F6});return{contentType:F6,body:a,estimatedSize:a.size}}if(n===Wu.Base64){var s=(function(h){var p,v,y,w,T,A="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",R=0,N=0,O="",M=[];if(!h)return h;h=EV(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})(B0(t)),l=(h=>"data="+encodeURIComponent(typeof h=="string"?h:B0(h)))(s);return{contentType:"application/x-www-form-urlencoded",body:l,estimatedSize:new Blob([l]).size}}var c=B0(t);return{contentType:"application/json",body:c,estimatedSize:new Blob([c]).size}}},Rb=[];ES&&Rb.push({transport:"fetch",method:e=>{var t,n,{contentType:r,body:a,estimatedSize:s}=(t=sC(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($4){var p=new $4;h={signal:p.signal,timeout:setTimeout((()=>p.abort()),e.timeout)}}ES(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))}}),wS&&Rb.push({transport:"XHR",method:e=>{var t,n=new wS;n.open(e.method||"GET",e.url,!0);var{contentType:r,body:a}=(t=sC(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&&Rb.push({transport:"sendBeacon",method:e=>{var t=kb(e.url,{beacon:"1"});try{var n,{contentType:r,body:a}=(n=sC(e))!==null&&n!==void 0?n:{},s=typeof a=="string"?new Blob([a],{type:r}):a;Go.sendBeacon(t,s)}catch{}}});var Db=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 B6(e,t,n){return B0({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:n})}var H6={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=>Db(n,r))))),not_regex:(e,t)=>t.every((n=>e.every((r=>!Db(n,r))))),icontains:(e,t)=>t.map(Lb).some((n=>e.map(Lb).some((r=>n.includes(r))))),not_icontains:(e,t)=>t.map(Lb).every((n=>e.map(Lb).every((r=>!n.includes(r)))))},Lb=e=>e.toLowerCase();function U6(e,t){return!e||Object.entries(e).every((n=>{var[r,a]=n,s=t?.[r];if(ft(s)||ju(s))return!1;var l=[String(s)],c=H6[a.operator];return!!c&&c(a.values,l)}))}var lC=Ei("[Error tracking]");class xV{constructor(t){var n,r;this.Jt=[],this.Kt=new qz([new tj,new cj,new rj,new nj,new lj,new sj,new aj,new uj],ej("web:javascript",Xz,$z)),this._instance=t,this.Jt=(n=(r=this._instance.persistence)==null?void 0:r.get_property(DS))!==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({[DS]:this.Jt,[bD]:l})}get Yt(){var t,n=!!this._instance.get_property(bD),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 lC.info("Skipping exception capture because a suppression rule matched");if(!this.Yt&&this.Zt(n))return void lC.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.ti(n))return void lC.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=H6[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]"),H0=Ei("[FeatureFlags]",{debugEnabled:!0}),uC="$active_feature_flags",_p="$override_feature_flags",z6="$feature_flag_payloads",U0="$override_feature_flag_payloads",j6="$feature_flag_request_id",V6="$feature_flag_evaluated_at",W6=e=>{var t={};for(var[n,r]of cb(e||{}))r&&(t[n]=r);return t},TV=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},SV=(function(e){return e.FeatureFlags="feature_flags",e.Recordings="recordings",e})({});class CV{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(OS),n=this._instance.get_property(_p),r=this._instance.get_property(U0);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(Ep),n=this._instance.get_property(_p);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(z6),n=this._instance.get_property(U0);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(x0)||{}),group_properties:this._instance.get_property(kf)};(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=C6()),this.ri=!0,this._instance.ci({method:"POST",url:c,data:r,compression:this._instance.config.disable_compression?void 0:Wu.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(SV.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(j6)||void 0,l=this._instance.get_property(V6)||void 0,c=this._instance.get_property(hb)||{};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({[hb]: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:Wu.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=TV(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({[uC]:T,[Ep]: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({[uC]:Object.keys(W6(H)),[Ep]:H||{},[z6]:V||{},[OS]:K||{}},R?{[j6]:R}:{},N?{[V6]: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(_p),this._instance.persistence.unregister(U0),this.pi(),H0.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(_p),H0.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({[_p]:a})}else this._instance.persistence.register({[_p]:r.flags});H0.info("Flag overrides set",{flags:r.flags})}}return"payloads"in r&&(r.payloads===!1?(this._instance.persistence.unregister(U0),H0.info("Payload overrides cleared")):r.payloads&&(this._instance.persistence.register({[U0]:r.payloads}),H0.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(w0)||[]).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({[uC]:Object.keys(W6(h)),[Ep]:h}),this.pi()}getEarlyAccessFeatures(t,n,r){n===void 0&&(n=!1);var a=this._instance.get_property(w0),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(w0),(h=this._instance.persistence)==null||h.register({[w0]: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(x0)||{};this._instance.register({[x0]:Lt({},r,t)}),n&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(x0)}setGroupPropertiesForFlags(t,n){n===void 0&&(n=!0);var r=this._instance.get_property(kf)||{};Object.keys(r).length!==0&&Object.keys(r).forEach((a=>{r[a]=Lt({},r[a],t[a]),delete t[a]})),this._instance.register({[kf]:Lt({},r,t)}),n&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var n=this._instance.get_property(kf)||{};this._instance.register({[kf]:Lt({},n,{[t]:{}})})}else this._instance.unregister(kf)}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 _V=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class cC{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){_V.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"&&xb.H()?xb:n==="sessionstorage"&&ca.H()?ca:n==="memory"?Fj:n==="cookie"?Nl:xb.H()?xb:Nl}properties(){var t={};return _r(this.props,(function(n,r){if(r===Ep&&$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,(ju(l=gj)?h:J4&&l.indexOf===J4?l.indexOf(c)!=-1:(_r(l,(function(p){if(h||(h=p===c))return ub})),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=y6(this.I.custom_campaign_params,this.I.mask_personal_data_properties,this.I.custom_personal_data_properties);vp(kS(t))||this.register(t),this.mi=!0}}update_search_keyword(){var t;this.register((t=vt?.referrer)?E6(t):{})}update_referrer_info(){var t;this.register_once({$referrer:x6(),$referring_domain:vt!=null&&vt.referrer&&((t=yb(vt.referrer))==null?void 0:t.host)||"$direct"},void 0)}set_initial_person_info(){this.props[MS]||this.props[FS]||this.register_once({[pb]:T6(this.I.mask_personal_data_properties,this.I.custom_personal_data_properties)},void 0)}get_initial_props(){var t={};_r([FS,MS],(l=>{var c=this.props[l];c&&_r(c,(function(h,p){t["$initial_"+xS(p)]=h}))}));var n,r,a=this.props[pb];if(a){var s=(n=S6(a),r={},_r(n,(function(l,c){r["$initial_"+xS(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[E0]||{};r[t]=n,this.props[E0]=r,this.save()}remove_event_timer(t){var n=(this.props[E0]||{})[t];return ft(n)||(delete this.props[E0][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]"),dC="ph_product_tours";class AV{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[dC];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({[dC]: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(dC)}resetTour(t){var n;(n=this.Pi)==null||n.resetTour(t)}resetAllTours(){var t;(t=this.Pi)==null||t.resetAllTours()}}var z0=(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 fC=(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 Ob=(function(e){return e.SHOWN="survey shown",e.DISMISSED="survey dismissed",e.SENT="survey sent",e})({}),Y6=(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})({}),q6=(function(e){return e.Popover="popover",e.Inline="inline",e})({});class hC{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 Ap(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 kV{constructor(t){this.Fi=new hC,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"||!Ap(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=>Ap(c.href,n.href,n.href_matching||"exact")));var s,l=(t==null||(r=t.properties)==null?void 0:r.$elements_chain)||"";return!!l&&Ap((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=>Ap(p.text,n.text,n.text_matching||"exact")||Ap(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=>Ap(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||U6(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]"),pC="seenSurvey_",RV=(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},G6=e=>{var t=""+pC+e.id;return e.current_iteration&&e.current_iteration>0&&(t=""+pC+e.id+"_"+e.current_iteration),t},DV=[fC.Popover,fC.Widget,fC.API],LV={ignoreConditions:!1,ignoreDelay:!1,displayType:q6.Popover};class OV{constructor(t){this._instance=t,this.Vi=new Map,this.Ji=new Map,this.Ki=new Map}Yi(t,n){return!!t&&U6(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===z0.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 kV(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,z0.Activation),this.Ji=this.Xi(t,z0.Cancellation))}onEvent(t,n){var r,a=((r=this._instance)==null||(r=r.persistence)==null?void 0:r.props[fb])||[];if(Ob.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,z0.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,z0.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[fb])||[];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({[fb]:[...new Set(t)]})}getSurveys(){var t,n=(t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[fb];return n||[]}getEventToSurveys(){return this.Vi}re(){return this.ie}}class NV{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(pC)||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 OV(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(NS);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({[NS]: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(DV.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!==q6.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 K6=Ei("[RateLimiter]");class PV{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=>{K6.info((l||"events")+" is quota limited."),this.serverLimits[l]=new Date().getTime()+6e4}))}catch(l){return void K6.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(IS))!==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(IS,l),{isRateLimited:c,remainingTokens:l.tokens}}isServerRateLimited(t){var n=this.serverLimits[t||"events"]||!1;return n!==!1&&new Date().getTime()<n}}var Nf=Ei("[RemoteConfig]");class IV{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))):(Nf.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 Nf.info("Using preloaded remote config",this.remoteConfig),void this.fi(this.remoteConfig);if(this._instance.O())return void Nf.warn("Remote config is disabled. Falling back to local config.");this.ce((t=>{if(!t)return Nf.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){Nf.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()):Nf.info("__preview_remote_config is disabled. Logging config instead",t):Nf.error("Failed to fetch remote config from PostHog.")}}var mC=3e3;class MV{constructor(t,n){this.pe=!0,this.ge=[],this._e=Ol(n?.flush_interval_ms||mC,250,5e3,yt.createLogger("flush interval"),mC),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 FV=["retriesPerformedSoFar"];class BV{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=nD(t,FV);Ll(n)&&n>0&&(r.url=kb(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 HV{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 UV=e=>T6(e?.config.mask_personal_data_properties,e?.config.custom_personal_data_properties);class Q6{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({[PS]:c})}},this._instance=t,this.je=n,this.De=r,this.Ae=a||UV,this.je.onSessionId(this.Me)}Oe(){return this.De.props[PS]}getSetOnceProps(){var t,n=(t=this.Oe())==null?void 0:t.props;return n?"r"in n?S6(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(kS(this.getSetOnceProps()),((n,r)=>{r==="$current_url"&&(r="url"),t["$session_entry_"+xS(r)]=n})),t}}var gC=Ei("[SessionId]");class X6{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 hC,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||$c,this.We=r||$c;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,gC.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){gC.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({[db]:[n,t,r]}))}tr(){var t=this.De.props[db];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(),gC.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 zV=["$set_once","$set"],nd=Ei("[SiteApps]");class jV{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({},nD(t,zV),{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&&(nd.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,nd.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){nd.error("Error while initializing PostHog app with config id "+t.id,c),s(!1)}if(a&&n.loaded)try{r()}catch(c){nd.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){nd.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 nd.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 nd.error("Error while initializing PostHog app with config id "+p,y)}))};for(var{id:c,url:h}of t.siteApps)l(c)}else nd.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}var Z6=function(e,t){if(!e)return!1;var n=e.userAgent;if(n&&rD(n,t))return!0;try{var r=e?.userAgentData;if(r!=null&&r.brands&&r.brands.some((a=>rD(a?.brand,t))))return!0}catch{}return!!e.webdriver},j0=(function(e){return e.US="us",e.EU="eu",e.CUSTOM="custom",e})({}),J6="i.posthog.com";class VV{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("."+J6,".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]=j0.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.lr[this.apiHost]=j0.EU:this.lr[this.apiHost]=j0.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===j0.CUSTOM)return this.apiHost+n;var r=J6+n;switch(t){case"assets":return"https://"+this.region+"-assets."+r;case"api":return"https://"+this.region+"."+r}}}var WV={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&&Db(t.href,e),not_regex:(e,t)=>!!Ne&&!Db(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=bb(t?.search,"__experiment_id"),r=bb(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||WV[(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=y6();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?Z6(Go,this._instance.config.custom_blocked_useragents):void 0}}var YV=Ei("[PostHog ExternalIntegrations]"),qV={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class GV{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 YV.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(qV[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 vC="[SessionRecording]",V0=Ei(vC);class $6{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 V0.error("started without valid sessionManager"),new Error(vC+" started without valid sessionManager. This is a bug.");if(this._instance.config.cookieless_mode==="always")throw new Error(vC+' cannot be used with cookieless_mode="always"')}get yr(){var t,n=!((t=this._instance.get_property(LS))==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),V0.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 V0.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(TD)}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({[LS]: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:V0.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):V0.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(LS);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 W0={},yC=()=>{},kp="posthog",eL=!wV&&xo?.indexOf("MSIE")===-1&&xo?.indexOf("Mozilla")===-1,tL=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:mj(vt?.location),persistence:"localStorage+cookie",persistence_name:"",loaded:yC,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:mC},error_tracking:{},_onCapture:yC,__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))},nL=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 KV{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 Nb{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 KV,this.Tr=!1,this.version=zu.LIB_VERSION,this.Rr=new hC,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=tL(),this.SentryIntegration=Wj,this.sentryIntegration=t=>(function(n,r){var a=XD(n,r);return{name:QD,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 CV(this),this.toolbar=new qj(this),this.scrollManager=new HV(this),this.pageViewManager=new fV(this),this.surveys=new NV(this),this.productTours=new AV(this),this.experiments=new Aa(this),this.exceptions=new xV(this),this.rateLimiter=new PV(this),this.requestRouter=new VV(this),this.consent=new Bj(this),this.externalIntegrations=new GV(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!==kp){var a,s=(a=W0[r])!==null&&a!==void 0?a:new Nb;return s._init(t,n,r),W0[r]=s,W0[kp][r]=s,s}return this._init(t,n,r)}_init(t,n,r){var a;if(n===void 0&&(n={}),ft(t)||TS(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({},tL(n.defaults),nL(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:Wu.GZipJS;var s=this.jr();this.persistence=new cC(this.config,s),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new cC(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 MV((M=>this.Nr(M)),this.config.request_queue_config),this.Ur=new BV(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 X6(this),this.sessionPropsManager=new Q6(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)),zu.DEBUG=zu.DEBUG||this.config.debug,zu.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($c()),w=(p=n.bootstrap)!=null&&p.isIdentifiedID?y:n.bootstrap.distinctID;this.persistence.set_property(Vu,(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:T0,$device_id:null},"");else if(!this.get_distinct_id()){var O=this.config.get_device_id($c());this.register_once({distinct_id:O,$device_id:O},""),this.persistence.set_property(Vu,"anonymous")}return wi(Ne,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),n.segment?Vj(this,(()=>this.Br())):this.Br(),Qc(this.config._onCapture)&&this.config._onCapture!==yC&&(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 jj(this),this.historyAutocapture.startIfEnabled();var r=[];r.push((()=>{new Kj(this).startIfEnabledOrStop()})),r.push((()=>{var a;this.siteApps=new jV(this),(a=this.siteApps)==null||a.init()})),t||r.push((()=>{this.sessionRecording=new $6(this),this.sessionRecording.startIfEnabledOrStop()})),this.config.disable_scroll_properties||r.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),r.push((()=>{this.autocapture=new Dj(this),this.autocapture.startIfEnabled()})),r.push((()=>{this.surveys.loadIfEnabled()})),r.push((()=>{this.productTours.loadIfEnabled()})),r.push((()=>{this.heatmaps=new dV(this),this.heatmaps.startIfEnabled()})),r.push((()=>{this.webVitalsAutocapture=new uV(this)})),r.push((()=>{this.exceptionObserver=new zj(this),this.exceptionObserver.startIfEnabled()})),r.push((()=>{this.deadClicksAutocapture=new GD(this,Uj),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,Wu.GZipJS)?Wu.GZipJS:In(t.supportedCompression,Wu.Base64)?Wu.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 IV(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()&&Zc(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&&(eL?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)||(t.transport=t.transport||this.config.api_transport,t.url=kb(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=kb(l.url,{_:new Date().getTime().toString(),ver:zu.LIB_VERSION,compression:l.compression});var c=(r=l.transport)!==null&&r!==void 0?r:"fetch",h=Rb.filter((v=>!l.disableTransport||!v.transport||!l.disableTransport.includes(v.transport))),p=(a=(s=mD(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=[];Zc(t,(c=>{c&&(n=c[0],ar(n)?s.push(c):Qc(c)?c.call(this):ar(c)&&n==="alias"?r.push(c):ar(c)&&n.indexOf("capture")!==-1&&Qc(this[n])?s.push(c):a.push(c))}));var l=function(c,h){Zc(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=$c(),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=hj(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===Ob.DISMISSED||t===Ob.SENT){var T=n?.[Y6.SURVEY_ID],A=n?.[Y6.SURVEY_ITERATION];y={id:T,current_iteration:A},localStorage.getItem(G6(y))||localStorage.setItem(G6(y),"true"),v.$set=Lt({},v.$set,{[RV({id:T,current_iteration:A},t===Ob.SENT?"responded":"dismissed")]:!0})}var R=Lt({},v.properties.$set,v.$set);if(vp(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)||TS(c.distinct_id))&&yt.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),c}var p,v=lV(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===j0.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,vp(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=LV),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!==T0){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(b0)&&(this.unregister(b0),this.register({distinct_id:t}));var l=(this.persistence.get_property(Vu)||"anonymous")==="anonymous";t!==a&&l?(this.persistence.set_property(Vu,"identified"),this.setPersonPropertiesForFlags(Lt({},r||{},n||{}),!1),this.capture("$identify",{distinct_id:t,$anon_distinct_id:a},{$set:n||{},$set_once:r||{}}),this.Mr=B6(t,n,r),this.featureFlags.setAnonymousDistinctId(a)):(n||r)&&this.setPersonProperties(n,r),t!==a&&(this.reloadFeatureFlags(),this.unregister(hb))}}else yt.critical('The string "'+T0+'" 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=B6(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(Vu,"anonymous"),(s=this.sessionManager)==null||s.resetSessionId(),this.Mr=null,this.config.cookieless_mode==="always")this.register_once({distinct_id:T0,$device_id:null},"");else{var c=this.config.get_device_id($c());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(gD)?(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(b0,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,nL(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 cC(Lt({},this.config,{persistence:"sessionStorage"}),h);var p=this.Or(this.config.debug);Xc(p)&&(this.config.debug=p),Xc(this.config.debug)&&(this.config.debug?(zu.DEBUG=!0,qr.H()&&qr.G("ph_debug","true"),yt.info("set_config",{config:t,oldConfig:n,newConfig:Lt({},this.config)})):(zu.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:kp;return n!==kp&&(n=kp+"."+n),n}_isIdentified(){var t,n;return((t=this.persistence)==null?void 0:t.get_property(Vu))==="identified"||((n=this.sessionPersistence)==null?void 0:n.get_property(Vu))==="identified"}Xr(){var t,n;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&vp(this.getGroups())&&((t=this.persistence)==null||(t=t.props)==null||!t[b0])&&((n=this.persistence)==null||(n=n.props)==null||!n[mb]))}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(mb,!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 X6(this),this.persistence&&(this.sessionPropsManager=new Q6(this,this.sessionManager,this.persistence)),this.sessionRecording=new $6(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:T0,$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===Yu.GRANTED?"granted":t===Yu.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?Z6(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 Uz(t.event)?yt.warn(s+". This can cause unexpected behavior."):yt.info(s),null}r.properties&&!vp(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=Xc(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]]=fj(e.prototype[t[n]])})(Nb,["identify"]);var rL,ys=(rL=W0[kp]=new Nb,(function(){function e(){e.done||(e.done=!0,eL=!1,_r(W0,(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")})(),rL);const Pf=(e,t)=>{ys.capture(e,t)},QV=Object.values(Object.assign({"/src/components/Banner/Banner.module.css":jU,"/src/components/Feedback/FeedbackModal.module.css":VU,"/src/components/Header/Header.module.css":WU,"/src/components/Header/HeaderDetails.module.css":YU,"/src/components/RateConversation/FeedbackForm.module.css":qU,"/src/components/StartView/ChatBarButton.module.css":GU,"/src/components/StartView/ChatButton.module.css":KU,"/src/components/StartView/FoldableChatButton.module.css":QU,"/src/components/attachments/AttachmentPreview.module.css":XU,"/src/components/attachments/UploadAttachmentButton.module.css":ZU,"/src/components/chat/ChatFooter.module.css":JU,"/src/components/chat/ChatInput.module.css":$U,"/src/components/chat/ChatIntro.module.css":ez,"/src/components/chat/ChatListDisclaimer.module.css":tz,"/src/components/chat/CloseChatModal.module.css":nz,"/src/components/chat/FeedbackButtons.module.css":rz,"/src/components/shared/Button.module.css":iz,"/src/components/shared/MinimalMarkdown.module.css":az,"/src/components/shared/Modal.module.css":oz,"/src/components/shared/Textarea.module.css":sz,"/src/components/shared/Typography.module.css":lz,"/src/components/ui/Spinner/Spinner.module.css":uz,"/src/components/ui/chat/Message.module.css":cz,"/src/components/ui/chat/MessageContainer.module.css":dz,"/src/components/ui/chat/MessageLoading.module.css":fz,"/src/components/ui/chat/blocks/ButtonGroupBlock.module.css":hz,"/src/components/ui/chat/blocks/ImageReferenceBlock.module.css":pz,"/src/components/ui/chat/blocks/MarkdownBlock.module.css":mz,"/src/components/ui/chat/blocks/SourceGroupBlock.module.css":gz,"/src/components/ui/chat/blocks/TextBlock.module.css":vz,"/src/widget/freedayWidget.module.css":yz})).join(`
169
169
  `);function XV(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=Lz+Oz+Nz+Pz+QV;s.replaceSync(l.replaceAll(":root",":host")),a.adoptedStyleSheets=[s],this.root=Dz.createRoot(a)}openChat(a){Pf("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 iL(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function bC(...e){return t=>{let n=!1;const r=e.map(a=>{const s=iL(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():iL(e[a],null)}}}}function qs(...e){return _.useCallback(bC(...e),e)}function ZV(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 EC(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,JV(a,...t)]}function JV(...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 Pb=G4();const aL=h0(Pb);function oL(e){const t=$V(e),n=_.forwardRef((r,a)=>{const{children:s,...l}=r,c=_.Children.toArray(s),h=c.find(tW);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 $V(e){const t=_.forwardRef((n,r)=>{const{children:a,...s}=n;if(_.isValidElement(a)){const l=rW(a),c=nW(s,a.props);return a.type!==_.Fragment&&(c.ref=r?bC(r,l):l),_.cloneElement(a,c)}return _.Children.count(a)>1?_.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var sL=Symbol("radix.slottable");function eW(e){const t=({children:n})=>F.jsx(F.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=sL,t}function tW(e){return _.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===sL}function nW(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 rW(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 iW=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Co=iW.reduce((e,t)=>{const n=oL(`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 aW(e,t){e&&Pb.flushSync(()=>e.dispatchEvent(t))}function Rp(e){const t=_.useRef(e);return _.useEffect(()=>{t.current=e}),_.useMemo(()=>(...n)=>t.current?.(...n),[])}function oW(e,t=globalThis?.document){const n=Rp(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 sW="DismissableLayer",wC="dismissableLayer.update",lW="dismissableLayer.pointerDownOutside",uW="dismissableLayer.focusOutside",lL,uL=_.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),xC=_.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:a,onFocusOutside:s,onInteractOutside:l,onDismiss:c,...h}=e,p=_.useContext(uL),[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=fW(Z=>{const X=Z.target,ce=[...p.branches].some(W=>W.contains(X));!V||ce||(a?.(Z),l?.(Z),Z.defaultPrevented||c?.())},w),Y=hW(Z=>{const X=Z.target;[...p.branches].some(W=>W.contains(X))||(s?.(Z),l?.(Z),Z.defaultPrevented||c?.())},w);return oW(Z=>{M===p.layers.size-1&&(r?.(Z),!Z.defaultPrevented&&c&&(Z.preventDefault(),c()))},w),_.useEffect(()=>{if(v)return n&&(p.layersWithOutsidePointerEventsDisabled.size===0&&(lL=w.body.style.pointerEvents,w.body.style.pointerEvents="none"),p.layersWithOutsidePointerEventsDisabled.add(v)),p.layers.add(v),cL(),()=>{n&&p.layersWithOutsidePointerEventsDisabled.size===1&&(w.body.style.pointerEvents=lL)}},[v,w,n,p]),_.useEffect(()=>()=>{v&&(p.layers.delete(v),p.layersWithOutsidePointerEventsDisabled.delete(v),cL())},[v,p]),_.useEffect(()=>{const Z=()=>T({});return document.addEventListener(wC,Z),()=>document.removeEventListener(wC,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)})});xC.displayName=sW;var cW="DismissableLayerBranch",dW=_.forwardRef((e,t)=>{const n=_.useContext(uL),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})});dW.displayName=cW;function fW(e,t=globalThis?.document){const n=Rp(e),r=_.useRef(!1),a=_.useRef(()=>{});return _.useEffect(()=>{const s=c=>{if(c.target&&!r.current){let h=function(){dL(lW,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 hW(e,t=globalThis?.document){const n=Rp(e),r=_.useRef(!1);return _.useEffect(()=>{const a=s=>{s.target&&!r.current&&dL(uW,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 cL(){const e=new CustomEvent(wC);document.dispatchEvent(e)}function dL(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?aW(a,s):a.dispatchEvent(s)}var rd=globalThis?.document?_.useLayoutEffect:()=>{},pW=vS[" useId ".trim().toString()]||(()=>{}),mW=0;function Ib(e){const[t,n]=_.useState(pW());return rd(()=>{n(r=>r??String(mW++))},[e]),e||(t?`radix-${t}`:"")}const gW=["top","right","bottom","left"],id=Math.min,Ko=Math.max,Mb=Math.round,Fb=Math.floor,Il=e=>({x:e,y:e}),vW={left:"right",right:"left",bottom:"top",top:"bottom"},yW={start:"end",end:"start"};function TC(e,t,n){return Ko(e,id(t,n))}function Gu(e,t){return typeof e=="function"?e(t):e}function Ku(e){return e.split("-")[0]}function Dp(e){return e.split("-")[1]}function SC(e){return e==="x"?"y":"x"}function CC(e){return e==="y"?"height":"width"}const bW=new Set(["top","bottom"]);function Ml(e){return bW.has(Ku(e))?"y":"x"}function _C(e){return SC(Ml(e))}function EW(e,t,n){n===void 0&&(n=!1);const r=Dp(e),a=_C(e),s=CC(a);let l=a==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(l=Bb(l)),[l,Bb(l)]}function wW(e){const t=Bb(e);return[AC(e),t,AC(t)]}function AC(e){return e.replace(/start|end/g,t=>yW[t])}const fL=["left","right"],hL=["right","left"],xW=["top","bottom"],TW=["bottom","top"];function SW(e,t,n){switch(e){case"top":case"bottom":return n?t?hL:fL:t?fL:hL;case"left":case"right":return t?xW:TW;default:return[]}}function CW(e,t,n,r){const a=Dp(e);let s=SW(Ku(e),n==="start",r);return a&&(s=s.map(l=>l+"-"+a),t&&(s=s.concat(s.map(AC)))),s}function Bb(e){return e.replace(/left|right|bottom|top/g,t=>vW[t])}function _W(e){return{top:0,right:0,bottom:0,left:0,...e}}function pL(e){return typeof e!="number"?_W(e):{top:e,right:e,bottom:e,left:e}}function Hb(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 mL(e,t,n){let{reference:r,floating:a}=e;const s=Ml(t),l=_C(t),c=CC(l),h=Ku(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(Dp(t)){case"start":T[l]-=w*(n&&p?-1:1);break;case"end":T[l]+=w*(n&&p?-1:1);break}return T}const AW=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}=mL(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}=mL(p,w,h)),R=-1)}return{x:v,y,placement:w,strategy:a,middlewareData:T}};async function Y0(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}=Gu(t,e),A=pL(T),N=c[w?y==="floating"?"reference":"floating":y],O=Hb(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=Hb(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 kW=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}=Gu(e,t)||{};if(p==null)return{};const y=pL(v),w={x:n,y:r},T=_C(a),A=CC(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=id(y[O],ce),me=id(y[M],ce),oe=W,te=Z-R[A]-me,le=Z/2-R[A]/2+X,Ae=TC(oe,le,te),_e=!h.arrow&&Dp(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}}}),RW=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}=Gu(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const O=Ku(a),M=Ml(c),H=Ku(c)===c,V=await(h.isRTL==null?void 0:h.isRTL(p.floating)),K=w||(H||!R?[Bb(c)]:wW(c)),Y=A!=="none";!w&&Y&&K.push(...CW(c,R,A,V));const Z=[c,...K],X=await Y0(t,N),ce=[];let W=((r=s.flip)==null?void 0:r.overflows)||[];if(v&&ce.push(X[O]),y){const le=EW(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 gL(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function vL(e){return gW.some(t=>e[t]>=0)}const DW=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...a}=Gu(e,t);switch(r){case"referenceHidden":{const s=await Y0(t,{...a,elementContext:"reference"}),l=gL(s,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:vL(l)}}}case"escaped":{const s=await Y0(t,{...a,altBoundary:!0}),l=gL(s,n.floating);return{data:{escapedOffsets:l,escaped:vL(l)}}}default:return{}}}}},yL=new Set(["left","top"]);async function LW(e,t){const{placement:n,platform:r,elements:a}=e,s=await(r.isRTL==null?void 0:r.isRTL(a.floating)),l=Ku(n),c=Dp(n),h=Ml(n)==="y",p=yL.has(l)?-1:1,v=s&&h?-1:1,y=Gu(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 OW=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 LW(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}}}}},NW=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}=Gu(e,t),p={x:n,y:r},v=await Y0(t,h),y=Ml(Ku(a)),w=SC(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=TC(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=TC(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}}}}}},PW=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}=Gu(e,t),v={x:n,y:r},y=Ml(a),w=SC(y);let T=v[w],A=v[y];const R=Gu(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=yL.has(Ku(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}}}},IW=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}=Gu(e,t),v=await Y0(t,p),y=Ku(a),w=Dp(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=id(R-v[N],M),K=id(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 Ub(){return typeof window<"u"}function Lp(e){return bL(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=(bL(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function bL(e){return Ub()?e instanceof Node||e instanceof Qo(e).Node:!1}function Gs(e){return Ub()?e instanceof Element||e instanceof Qo(e).Element:!1}function Bl(e){return Ub()?e instanceof HTMLElement||e instanceof Qo(e).HTMLElement:!1}function EL(e){return!Ub()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Qo(e).ShadowRoot}const MW=new Set(["inline","contents"]);function q0(e){const{overflow:t,overflowX:n,overflowY:r,display:a}=Ks(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!MW.has(a)}const FW=new Set(["table","td","th"]);function BW(e){return FW.has(Lp(e))}const HW=[":popover-open",":modal"];function zb(e){return HW.some(t=>{try{return e.matches(t)}catch{return!1}})}const UW=["transform","translate","scale","rotate","perspective"],zW=["transform","translate","scale","rotate","perspective","filter"],jW=["paint","layout","strict","content"];function kC(e){const t=RC(),n=Gs(e)?Ks(e):e;return UW.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)||zW.some(r=>(n.willChange||"").includes(r))||jW.some(r=>(n.contain||"").includes(r))}function VW(e){let t=ad(e);for(;Bl(t)&&!Op(t);){if(kC(t))return t;if(zb(t))return null;t=ad(t)}return null}function RC(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const WW=new Set(["html","body","#document"]);function Op(e){return WW.has(Lp(e))}function Ks(e){return Qo(e).getComputedStyle(e)}function jb(e){return Gs(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ad(e){if(Lp(e)==="html")return e;const t=e.assignedSlot||e.parentNode||EL(e)&&e.host||Fl(e);return EL(t)?t.host:t}function wL(e){const t=ad(e);return Op(t)?e.ownerDocument?e.ownerDocument.body:e.body:Bl(t)&&q0(t)?t:wL(t)}function G0(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const a=wL(e),s=a===((r=e.ownerDocument)==null?void 0:r.body),l=Qo(a);if(s){const c=DC(l);return t.concat(l,l.visualViewport||[],q0(a)?a:[],c&&n?G0(c):[])}return t.concat(a,G0(a,[],n))}function DC(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function xL(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=Mb(n)!==s||Mb(r)!==l;return c&&(n=s,r=l),{width:n,height:r,$:c}}function LC(e){return Gs(e)?e:e.contextElement}function Np(e){const t=LC(e);if(!Bl(t))return Il(1);const n=t.getBoundingClientRect(),{width:r,height:a,$:s}=xL(t);let l=(s?Mb(n.width):n.width)/r,c=(s?Mb(n.height):n.height)/a;return(!l||!Number.isFinite(l))&&(l=1),(!c||!Number.isFinite(c))&&(c=1),{x:l,y:c}}const YW=Il(0);function TL(e){const t=Qo(e);return!RC()||!t.visualViewport?YW:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function qW(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Qo(e)?!1:t}function If(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const a=e.getBoundingClientRect(),s=LC(e);let l=Il(1);t&&(r?Gs(r)&&(l=Np(r)):l=Np(e));const c=qW(s,n,r)?TL(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=DC(A);for(;R&&r&&T!==A;){const N=Np(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=DC(A)}}return Hb({width:v,height:y,x:h,y:p})}function Vb(e,t){const n=jb(e).scrollLeft;return t?t.left+n:If(Fl(e)).left+n}function SL(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Vb(e,n),a=n.top+t.scrollTop;return{x:r,y:a}}function GW(e){let{elements:t,rect:n,offsetParent:r,strategy:a}=e;const s=a==="fixed",l=Fl(r),c=t?zb(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)&&((Lp(r)!=="body"||q0(l))&&(h=jb(r)),Bl(r))){const T=If(r);p=Np(r),v.x=T.x+r.clientLeft,v.y=T.y+r.clientTop}const w=l&&!y&&!s?SL(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 KW(e){return Array.from(e.getClientRects())}function QW(e){const t=Fl(e),n=jb(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+Vb(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 CL=25;function XW(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=RC();(!v||v&&t==="fixed")&&(c=a.offsetLeft,h=a.offsetTop)}const p=Vb(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<=CL&&(s-=A)}else p<=CL&&(s+=p);return{width:s,height:l,x:c,y:h}}const ZW=new Set(["absolute","fixed"]);function JW(e,t){const n=If(e,!0,t==="fixed"),r=n.top+e.clientTop,a=n.left+e.clientLeft,s=Bl(e)?Np(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 _L(e,t,n){let r;if(t==="viewport")r=XW(e,n);else if(t==="document")r=QW(Fl(e));else if(Gs(t))r=JW(t,n);else{const a=TL(e);r={x:t.x-a.x,y:t.y-a.y,width:t.width,height:t.height}}return Hb(r)}function AL(e,t){const n=ad(e);return n===t||!Gs(n)||Op(n)?!1:Ks(n).position==="fixed"||AL(n,t)}function $W(e,t){const n=t.get(e);if(n)return n;let r=G0(e,[],!1).filter(c=>Gs(c)&&Lp(c)!=="body"),a=null;const s=Ks(e).position==="fixed";let l=s?ad(e):e;for(;Gs(l)&&!Op(l);){const c=Ks(l),h=kC(l);!h&&c.position==="fixed"&&(a=null),(s?!h&&!a:!h&&c.position==="static"&&!!a&&ZW.has(a.position)||q0(l)&&!h&&AL(e,l))?r=r.filter(v=>v!==l):a=c,l=ad(l)}return t.set(e,r),r}function eY(e){let{element:t,boundary:n,rootBoundary:r,strategy:a}=e;const l=[...n==="clippingAncestors"?zb(t)?[]:$W(t,this._c):[].concat(n),r],c=l[0],h=l.reduce((p,v)=>{const y=_L(t,v,a);return p.top=Ko(y.top,p.top),p.right=id(y.right,p.right),p.bottom=id(y.bottom,p.bottom),p.left=Ko(y.left,p.left),p},_L(t,c,a));return{width:h.right-h.left,height:h.bottom-h.top,x:h.left,y:h.top}}function tY(e){const{width:t,height:n}=xL(e);return{width:t,height:n}}function nY(e,t,n){const r=Bl(t),a=Fl(t),s=n==="fixed",l=If(e,!0,s,t);let c={scrollLeft:0,scrollTop:0};const h=Il(0);function p(){h.x=Vb(a)}if(r||!r&&!s)if((Lp(t)!=="body"||q0(a))&&(c=jb(t)),r){const T=If(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?SL(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 OC(e){return Ks(e).position==="static"}function kL(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 RL(e,t){const n=Qo(e);if(zb(e))return n;if(!Bl(e)){let a=ad(e);for(;a&&!Op(a);){if(Gs(a)&&!OC(a))return a;a=ad(a)}return n}let r=kL(e,t);for(;r&&BW(r)&&OC(r);)r=kL(r,t);return r&&Op(r)&&OC(r)&&!kC(r)?n:r||VW(e)||n}const rY=async function(e){const t=this.getOffsetParent||RL,n=this.getDimensions,r=await n(e.floating);return{reference:nY(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function iY(e){return Ks(e).direction==="rtl"}const aY={convertOffsetParentRelativeRectToViewportRelativeRect:GW,getDocumentElement:Fl,getClippingRect:eY,getOffsetParent:RL,getElementRects:rY,getClientRects:KW,getDimensions:tY,getScale:Np,isElement:Gs,isRTL:iY};function DL(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function oY(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=Fb(y),R=Fb(a.clientWidth-(v+w)),N=Fb(a.clientHeight-(y+T)),O=Fb(v),H={rootMargin:-A+"px "+-R+"px "+-N+"px "+-O+"px",threshold:Ko(0,id(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&&!DL(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 sY(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=LC(e),v=a||s?[...p?G0(p):[],...G0(t)]:[];v.forEach(O=>{a&&O.addEventListener("scroll",n,{passive:!0}),s&&O.addEventListener("resize",n)});const y=p&&c?oY(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?If(e):null;h&&N();function N(){const O=If(e);R&&!DL(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 lY=OW,uY=NW,cY=RW,dY=IW,fY=DW,LL=kW,hY=PW,pY=(e,t,n)=>{const r=new Map,a={platform:aY,...n},s={...a.platform,_c:r};return AW(e,t,{...a,platform:s})};var mY=typeof document<"u",gY=function(){},Wb=mY?_.useLayoutEffect:gY;function Yb(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(!Yb(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)&&!Yb(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function OL(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function NL(e,t){const n=OL(e);return Math.round(t*n)/n}function NC(e){const t=_.useRef(e);return Wb(()=>{t.current=e}),t}function vY(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);Yb(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=NC(h),me=NC(a),oe=NC(p),te=_.useCallback(()=>{if(!Y.current||!Z.current)return;const se={placement:t,strategy:n,middleware:w};me.current&&(se.platform=me.current),pY(Y.current,Z.current,se).then(De=>{const U={...De,isPositioned:oe.current!==!1};le.current&&!Yb(X.current,U)&&(X.current=U,Pb.flushSync(()=>{y(U)}))})},[w,t,n,me,oe]);Wb(()=>{p===!1&&X.current.isPositioned&&(X.current.isPositioned=!1,y(se=>({...se,isPositioned:!1})))},[p]);const le=_.useRef(!1);Wb(()=>(le.current=!0,()=>{le.current=!1}),[]),Wb(()=>{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=NL(_e.floating,v.x),U=NL(_e.floating,v.y);return c?{...se,transform:"translate("+De+"px, "+U+"px)",...OL(_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 yY=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?LL({element:r.current,padding:a}).fn(n):{}:r?LL({element:r,padding:a}).fn(n):{}}}},bY=(e,t)=>({...lY(e),options:[e,t]}),EY=(e,t)=>({...uY(e),options:[e,t]}),wY=(e,t)=>({...hY(e),options:[e,t]}),xY=(e,t)=>({...cY(e),options:[e,t]}),TY=(e,t)=>({...dY(e),options:[e,t]}),SY=(e,t)=>({...fY(e),options:[e,t]}),CY=(e,t)=>({...yY(e),options:[e,t]});var _Y="Arrow",PL=_.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"})})});PL.displayName=_Y;var AY=PL;function kY(e){const[t,n]=_.useState(void 0);return rd(()=>{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 PC="Popper",[IL,ML]=EC(PC),[RY,FL]=IL(PC),BL=e=>{const{__scopePopper:t,children:n}=e,[r,a]=_.useState(null);return F.jsx(RY,{scope:t,anchor:r,onAnchorChange:a,children:n})};BL.displayName=PC;var HL="PopperAnchor",UL=_.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...a}=e,s=FL(HL,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})});UL.displayName=HL;var IC="PopperContent",[DY,LY]=IL(IC),zL=_.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=FL(IC,n),[O,M]=_.useState(null),H=qs(t,St=>M(St)),[V,K]=_.useState(null),Y=kY(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(NY),altBoundary:oe},{refs:le,floatingStyles:Ae,placement:_e,isPositioned:ve,middlewareData:se}=vY({strategy:"fixed",placement:ce,whileElementsMounted:(...St)=>sY(...St,{animationFrame:T==="always"}),elements:{reference:N.anchor},middleware:[bY({mainAxis:a+X,alignmentAxis:l}),h&&EY({mainAxis:!0,crossAxis:!1,limiter:y==="partial"?wY():void 0,...te}),h&&xY({...te}),TY({...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&&CY({element:V,padding:c}),PY({arrowWidth:Z,arrowHeight:X}),w&&SY({strategy:"referenceHidden",...te})]}),[De,U]=WL(_e),$=Rp(A);rd(()=>{ve&&$?.()},[ve,$]);const be=se.arrow?.x,j=se.arrow?.y,Ue=se.arrow?.centerOffset!==0,[Ke,Qe]=_.useState();return rd(()=>{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(DY,{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"}})})})});zL.displayName=IC;var jL="PopperArrow",OY={top:"bottom",right:"left",bottom:"top",left:"right"},VL=_.forwardRef(function(t,n){const{__scopePopper:r,...a}=t,s=LY(jL,r),l=OY[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(AY,{...a,ref:n,style:{...a.style,display:"block"}})})});VL.displayName=jL;function NY(e){return e!==null}var PY=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]=WL(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 WL(e){const[t,n="center"]=e.split("-");return[t,n]}var IY=BL,MY=UL,FY=zL,BY=VL,HY="Portal",MC=_.forwardRef((e,t)=>{const{container:n,...r}=e,[a,s]=_.useState(!1);rd(()=>s(!0),[]);const l=n||a&&globalThis?.document?.body;return l?aL.createPortal(F.jsx(Co.div,{...r,ref:t}),l):null});MC.displayName=HY;function UY(e,t){return _.useReducer((n,r)=>t[n][r]??n,e)}var Pp=e=>{const{present:t,children:n}=e,r=zY(t),a=typeof n=="function"?n({present:r.isPresent}):_.Children.only(n),s=qs(r.ref,jY(a));return typeof n=="function"||r.isPresent?_.cloneElement(a,{ref:s}):null};Pp.displayName="Presence";function zY(e){const[t,n]=_.useState(),r=_.useRef(null),a=_.useRef(e),s=_.useRef("none"),l=e?"mounted":"unmounted",[c,h]=UY(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return _.useEffect(()=>{const p=qb(r.current);s.current=c==="mounted"?p:"none"},[c]),rd(()=>{const p=r.current,v=a.current;if(v!==e){const w=s.current,T=qb(p);e?h("MOUNT"):T==="none"||p?.display==="none"?h("UNMOUNT"):h(v&&w!==T?"ANIMATION_OUT":"UNMOUNT"),a.current=e}},[e,h]),rd(()=>{if(t){let p;const v=t.ownerDocument.defaultView??window,y=T=>{const R=qb(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=qb(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 qb(e){return e?.animationName||"none"}function jY(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 VY=vS[" useInsertionEffect ".trim().toString()]||rd;function YL({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[a,s,l]=WY({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=YY(v)?v(e):v;y!==e&&l.current?.(y)}else s(v)},[c,e,s,l]);return[h,p]}function WY({defaultProp:e,onChange:t}){const[n,r]=_.useState(e),a=_.useRef(n),s=_.useRef(t);return VY(()=>{s.current=t},[t]),_.useEffect(()=>{a.current!==n&&(s.current?.(n),a.current=n)},[n,a]),[n,r,s]}function YY(e){return typeof e=="function"}var qY=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"}),GY="VisuallyHidden",qL=_.forwardRef((e,t)=>F.jsx(Co.span,{...e,ref:t,style:{...qY,...e.style}}));qL.displayName=GY;var KY=qL,[Gb]=EC("Tooltip",[ML]),Kb=ML(),GL="TooltipProvider",QY=700,FC="tooltip.open",[XY,BC]=Gb(GL),KL=e=>{const{__scopeTooltip:t,delayDuration:n=QY,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(XY,{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})};KL.displayName=GL;var K0="Tooltip",[ZY,Q0]=Gb(K0),QL=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:a,onOpenChange:s,disableHoverableContent:l,delayDuration:c}=e,h=BC(K0,e.__scopeTooltip),p=Kb(t),[v,y]=_.useState(null),w=Ib(),T=_.useRef(0),A=l??h.disableHoverableContent,R=c??h.delayDuration,N=_.useRef(!1),[O,M]=YL({prop:r,defaultProp:a??!1,onChange:Z=>{Z?(h.onOpen(),document.dispatchEvent(new CustomEvent(FC))):h.onClose(),s?.(Z)},caller:K0}),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(IY,{...p,children:F.jsx(ZY,{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})})};QL.displayName=K0;var HC="TooltipTrigger",XL=_.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,a=Q0(HC,n),s=BC(HC,n),l=Kb(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(MY,{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)})})});XL.displayName=HC;var UC="TooltipPortal",[JY,$Y]=Gb(UC,{forceMount:void 0}),ZL=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:a}=e,s=Q0(UC,t);return F.jsx(JY,{scope:t,forceMount:n,children:F.jsx(Pp,{present:n||s.open,children:F.jsx(MC,{asChild:!0,container:a,children:r})})})};ZL.displayName=UC;var Ip="TooltipContent",JL=_.forwardRef((e,t)=>{const n=$Y(Ip,e.__scopeTooltip),{forceMount:r=n.forceMount,side:a="top",...s}=e,l=Q0(Ip,e.__scopeTooltip);return F.jsx(Pp,{present:r||l.open,children:l.disableHoverableContent?F.jsx($L,{side:a,...s,ref:t}):F.jsx(eq,{side:a,...s,ref:t})})}),eq=_.forwardRef((e,t)=>{const n=Q0(Ip,e.__scopeTooltip),r=BC(Ip,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=aq(O,N.getBoundingClientRect()),H=oq(O,M),V=sq(R.getBoundingClientRect()),K=uq([...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=!lq(O,l);M?w():H&&(w(),p())};return document.addEventListener("pointermove",A),()=>document.removeEventListener("pointermove",A)}},[h,v,l,p,w]),F.jsx($L,{...e,ref:s})}),[tq,nq]=Gb(K0,{isInside:!1}),rq=eW("TooltipContent"),$L=_.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":a,onEscapeKeyDown:s,onPointerDownOutside:l,...c}=e,h=Q0(Ip,n),p=Kb(n),{onClose:v}=h;return _.useEffect(()=>(document.addEventListener(FC,v),()=>document.removeEventListener(FC,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(xC,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:l,onFocusOutside:y=>y.preventDefault(),onDismiss:v,children:F.jsxs(FY,{"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(rq,{children:r}),F.jsx(tq,{scope:n,isInside:!0,children:F.jsx(KY,{id:h.contentId,role:"tooltip",children:a||r})})]})})});JL.displayName=Ip;var eO="TooltipArrow",iq=_.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,a=Kb(n);return nq(eO,n).isInside?null:F.jsx(BY,{...a,...r,ref:t})});iq.displayName=eO;function aq(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 oq(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 sq(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 lq(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 uq(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),cq(t)}function cq(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 dq=KL,fq=QL,hq=XL,pq=ZL,zC=JL;function tO(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=tO(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=tO(e))&&(r&&(r+=" "),r+=t);return r}const jC="-",mq=e=>{const t=vq(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:l=>{const c=l.split(jC);return c[0]===""&&c.length!==1&&c.shift(),nO(c,t)||gq(l)},getConflictingClassGroupIds:(l,c)=>{const h=n[l]||[];return c&&r[l]?[...h,...r[l]]:h}}},nO=(e,t)=>{if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),a=r?nO(e.slice(1),r):void 0;if(a)return a;if(t.validators.length===0)return;const s=e.join(jC);return t.validators.find(({validator:l})=>l(s))?.classGroupId},rO=/^\[(.+)\]$/,gq=e=>{if(rO.test(e)){const t=rO.exec(e)[1],n=t?.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},vq=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return bq(Object.entries(e.classGroups),n).forEach(([s,l])=>{VC(l,r,s,t)}),r},VC=(e,t,n,r)=>{e.forEach(a=>{if(typeof a=="string"){const s=a===""?t:iO(t,a);s.classGroupId=n;return}if(typeof a=="function"){if(yq(a)){VC(a(r),t,n,r);return}t.validators.push({validator:a,classGroupId:n});return}Object.entries(a).forEach(([s,l])=>{VC(l,iO(t,s),n,r)})})},iO=(e,t)=>{let n=e;return t.split(jC).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},yq=e=>e.isThemeGetter,bq=(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,Eq=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)}}},aO="!",wq=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(aO),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},xq=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},Tq=e=>({cache:Eq(e.cacheSize),parseClassName:wq(e),...mq(e)}),Sq=/\s+/,Cq=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:a}=t,s=[],l=e.trim().split(Sq);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=xq(v).join(":"),O=y?N+aO: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 _q(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=oO(t))&&(r&&(r+=" "),r+=n);return r}const oO=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=oO(e[r]))&&(n&&(n+=" "),n+=t);return n};function Aq(e,...t){let n,r,a,s=l;function l(h){const p=t.reduce((v,y)=>y(v),e());return n=Tq(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=Cq(h,n);return a(h,v),v}return function(){return s(_q.apply(null,arguments))}}const Ir=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},sO=/^\[(?:([a-z-]+):)?(.+)\]$/i,kq=/^\d+\/\d+$/,Rq=new Set(["px","full","screen"]),Dq=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Lq=/\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$/,Oq=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,Nq=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Pq=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Qu=e=>Mp(e)||Rq.has(e)||kq.test(e),od=e=>Fp(e,"length",jq),Mp=e=>!!e&&!Number.isNaN(Number(e)),WC=e=>Fp(e,"number",Mp),X0=e=>!!e&&Number.isInteger(Number(e)),Iq=e=>e.endsWith("%")&&Mp(e.slice(0,-1)),wn=e=>sO.test(e),sd=e=>Dq.test(e),Mq=new Set(["length","size","percentage"]),Fq=e=>Fp(e,Mq,lO),Bq=e=>Fp(e,"position",lO),Hq=new Set(["image","url"]),Uq=e=>Fp(e,Hq,Wq),zq=e=>Fp(e,"",Vq),Z0=()=>!0,Fp=(e,t,n)=>{const r=sO.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},jq=e=>Lq.test(e)&&!Oq.test(e),lO=()=>!1,Vq=e=>Nq.test(e),Wq=e=>Pq.test(e),Yq=Aq(()=>{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=()=>["",Qu,od],le=()=>["auto",Mp,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"],$=()=>[Mp,wn];return{cacheSize:500,separator:":",theme:{colors:[Z0],spacing:[Qu,od],blur:["none","",sd,wn],brightness:$(),borderColor:[e],borderRadius:["none","","full",sd,wn],borderSpacing:oe(),borderWidth:te(),contrast:$(),grayscale:De(),hueRotate:$(),invert:De(),gap:oe(),gradientColorStops:[e],gradientColorStopPositions:[Iq,od],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:[sd]}],"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",X0,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",X0,wn]}],"grid-cols":[{"grid-cols":[Z0]}],"col-start-end":[{col:["auto",{span:["full",X0,wn]},wn]}],"col-start":[{"col-start":le()}],"col-end":[{"col-end":le()}],"grid-rows":[{"grid-rows":[Z0]}],"row-start-end":[{row:["auto",{span:[X0,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:[sd]},sd]}],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",sd,od]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",WC]}],"font-family":[{font:[Z0]}],"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",Mp,WC]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Qu,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",Qu,od]}],"underline-offset":[{"underline-offset":["auto",Qu,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(),Bq]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",Fq]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},Uq]}],"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":[Qu,wn]}],"outline-w":[{outline:[Qu,od]}],"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":[Qu,od]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",sd,zq]}],"shadow-color":[{shadow:[Z0]}],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",sd,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:[X0,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:[Qu,od,WC]}],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 uO(){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 Yq(hi(e))}function YC(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 qC=()=>{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 cO{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",J0=()=>{let e,t;const n=new Promise((r,a)=>{e=r,t=a});return n.resolve=e,n.reject=t,n},dO=e=>e==null?"":""+e,qq=(e,t,n)=>{e.forEach(r=>{t[r]&&(n[r]=t[r])})},Gq=/###/g,fO=e=>e&&e.indexOf("###")>-1?e.replace(Gq,"."):e,hO=e=>!e||ln(e),$0=(e,t,n)=>{const r=ln(t)?t.split("."):t;let a=0;for(;a<r.length-1;){if(hO(e))return{};const s=fO(r[a]);!e[s]&&n&&(e[s]=new n),Object.prototype.hasOwnProperty.call(e,s)?e=e[s]:e={},++a}return hO(e)?{}:{obj:e,k:fO(r[a])}},pO=(e,t,n)=>{const{obj:r,k:a}=$0(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=$0(e,l,Object);for(;c.obj===void 0&&l.length;)s=`${l[l.length-1]}.${s}`,l=l.slice(0,l.length-1),c=$0(e,l,Object),c?.obj&&typeof c.obj[`${c.k}.${s}`]<"u"&&(c.obj=void 0);c.obj[`${c.k}.${s}`]=n},Kq=(e,t,n,r)=>{const{obj:a,k:s}=$0(e,t,Object);a[s]=a[s]||[],a[s].push(n)},Qb=(e,t)=>{const{obj:n,k:r}=$0(e,t);if(n&&Object.prototype.hasOwnProperty.call(n,r))return n[r]},Qq=(e,t,n)=>{const r=Qb(e,n);return r!==void 0?r:Qb(t,n)},mO=(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]):mO(e[r],t[r],n):e[r]=t[r]);return e},Bp=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var Xq={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};const Zq=e=>ln(e)?e.replace(/[&<>"'\/]/g,t=>Xq[t]):e;class Jq{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 $q=[" ",",","?","!",";"],eG=new Jq(20),tG=(e,t,n)=>{t=t||"",n=n||"";const r=$q.filter(l=>t.indexOf(l)<0&&n.indexOf(l)<0);if(r.length===0)return!0;const a=eG.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},GC=(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},ev=e=>e?.replace("_","-"),nG={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 Xb{constructor(t,n={}){this.init(t,n)}init(t,n={}){this.prefix=n.prefix||"i18next:",this.logger=t||nG,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 Xb(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t=t||this.options,t.prefix=t.prefix||this.prefix,new Xb(this.logger,t)}}var Hl=new Xb;class Zb{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 gO extends Zb{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:GC(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),pO(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?mO(h,r,s):h={...h,...r},pO(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 vO={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 yO=Symbol("i18next/PATH_KEY");function rG(){const e=[],t=Object.create(null);let n;return t.get=(r,a)=>(n?.revoke?.(),a===yO?e:(e.push(a),n=Proxy.revocable(r,t),n.proxy)),Proxy.revocable(Object.create(null),t).proxy}function KC(e,t){const{[yO]:n}=e(rG());return n.join(t?.keySeparator??".")}const bO={},QC=e=>!ln(e)&&typeof e!="boolean"&&typeof e!="number";class Jb extends Zb{constructor(t,n={}){super(),qq(["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=QC(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&&!tG(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=KC(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=Jb.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=QC(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:QC(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=vO.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,!bO[`${R[0]}-${N}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(c)&&(bO[`${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 EO{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Hl.create("languageUtils")}getScriptPartFromCode(t){if(t=ev(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=ev(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 wO={zero:0,one:1,two:2,few:3,many:4,other:5},xO={select:e=>e===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class iG{constructor(t,n={}){this.languageUtils=t,this.options=n,this.logger=Hl.create("pluralResolver"),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(t,n={}){const r=ev(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!"),xO;if(!t.match(/-|_/))return xO;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)=>wO[a]-wO[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 TO=(e,t,n,r=".",a=!0)=>{let s=Qq(e,t,n);return!s&&a&&ln(n)&&(s=GC(e,n,r),s===void 0&&(s=GC(t,n,r))),s},XC=e=>e.replace(/\$/g,"$$$$");class SO{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:Zq,this.escapeValue=r!==void 0?r:!0,this.useRawValueToEscape=a!==void 0?a:!1,this.prefix=s?Bp(s):l||"{{",this.suffix=c?Bp(c):h||"}}",this.formatSeparator=p||",",this.unescapePrefix=v?"":y||"-",this.unescapeSuffix=this.unescapePrefix?"":v||"",this.nestingPrefix=w?Bp(w):T||Bp("$t("),this.nestingSuffix=A?Bp(A):R||Bp(")"),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=TO(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(TO(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=>XC(T)},{regex:this.regexp,safeValue:T=>this.escapeValue?XC(this.escape(T)):XC(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=dO(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=dO(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 aG=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}},CO=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(ev(r),a),t[l]=c),c(n)}},oG=e=>(t,n,r)=>e(ev(n),r)(t);class sG{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?CO:oG;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()]=CO(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}=aG(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 lG=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)};class uG extends Zb{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=>{Kq(h.loaded,[s],l),lG(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 ZC=()=>({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}),_O=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),$b=()=>{},cG=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(n=>{typeof e[n]=="function"&&(e[n]=e[n].bind(e))})};class tv extends Zb{constructor(t={},n){if(super(),this.options=_O(t),this.services={},this.logger=Hl,this.modules={external:[]},cG(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=ZC();this.options={...r,...this.options,..._O(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=sG;const v=new EO(this.options);this.store=new gO(this.options.resources,this.options);const y=this.services;y.logger=Hl,y.resourceStore=this.store,y.languageUtils=v,y.pluralResolver=new iG(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 SO(this.options),y.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},y.backendConnector=new uG(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 Jb(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=$b),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=J0(),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=$b){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=J0();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=$b),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"&&vO.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=J0();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=KC(y,{...this.options,...l})),`${h.keyPrefix}${p}${y}`)):(typeof s=="function"&&(s=KC(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=J0();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=J0();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 EO(ZC());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 tv(t,n);return r.createInstance=tv.createInstance,r}cloneInstance(t={},n=$b){const r=t.forkResourceStore;r&&delete t.forkResourceStore;const a={...this.options,...t,isClone:!0},s=new tv(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 gO(c,a),s.services.resourceStore=s.store}if(t.interpolation){const h={...ZC().interpolation,...this.options.interpolation,...t.interpolation},p={...a,interpolation:h};s.services.interpolator=new SO(p)}return s.translator=new Jb(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=tv.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 dG=(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);Mf(a[0])&&(a[0]=`react-i18next:: ${a[0]}`),e?.services?.logger?.warn?e.services.logger.warn(...a):console?.warn&&console.warn(...a)},AO={},kO=(e,t,n,r)=>{Mf(n)&&AO[n]||(Mf(n)&&(AO[n]=new Date),dG(e,t,n,r))},RO=(e,t)=>()=>{if(e.isInitialized)t();else{const n=()=>{setTimeout(()=>{e.off("initialized",n)},0),t()};e.on("initialized",n)}},JC=(e,t,n)=>{e.loadNamespaces(t,RO(e,n))},DO=(e,t,n,r)=>{if(Mf(n)&&(n=[n]),e.options.preload&&e.options.preload.indexOf(t)>-1)return JC(e,n,r);n.forEach(a=>{e.options.ns.indexOf(a)<0&&e.options.ns.push(a)}),e.loadLanguages(t,RO(e,r))},fG=(e,t,n={})=>!t.languages||!t.languages.length?(kO(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}}),Mf=e=>typeof e=="string",hG=e=>typeof e=="object"&&e!==null,pG=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,mG={"&amp;":"&","&#38;":"&","&lt;":"<","&#60;":"<","&gt;":">","&#62;":">","&apos;":"'","&#39;":"'","&quot;":'"',"&#34;":'"',"&nbsp;":" ","&#160;":" ","&copy;":"©","&#169;":"©","&reg;":"®","&#174;":"®","&hellip;":"…","&#8230;":"…","&#x2F;":"/","&#47;":"/"},gG=e=>mG[e];let $C={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:e=>e.replace(pG,gG),transDefaultProps:void 0};const vG=(e={})=>{$C={...$C,...e}},yG=()=>$C;let LO;const bG=e=>{LO=e},EG=()=>LO,wG={type:"3rdParty",init(e){vG(e.options.react),bG(e)}},OO=_.createContext();class xG{constructor(){this.usedNamespaces={}}addUsedNamespaces(t){t.forEach(n=>{this.usedNamespaces[n]||(this.usedNamespaces[n]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}var eE={exports:{}},e_={};var NO;function TG(){if(NO)return e_;NO=1;var e=_f();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 e_.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:v,e_}var t_={},PO;function SG(){if(PO)return t_;PO=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=_f(),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;t_.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())})(),t_}var IO;function CG(){if(IO)return eE.exports;IO=1;var e={};return e.NODE_ENV==="production"?eE.exports=TG():eE.exports=SG(),eE.exports}var _G=CG();const AG={t:(e,t)=>Mf(t)?t:hG(t)&&Mf(t.defaultValue)?t.defaultValue:Array.isArray(e)?e[e.length-1]:e,ready:!1},kG=()=>()=>{},Gr=(e,t={})=>{const{i18n:n}=t,{i18n:r,defaultNS:a}=_.useContext(OO)||{},s=n||r||EG();s&&!s.reportNamespaces&&(s.reportNamespaces=new xG),s||kO(s,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const l=_.useMemo(()=>({...yG(),...s?.options?.react,...t}),[s,t]),{useSuspense:c,keyPrefix:h}=l,p=e||a||s?.options?.defaultNS,v=Mf(p)?[p]:p||["translation"],y=_.useMemo(()=>v,v);s?.reportNamespaces?.addUsedNamespaces?.(y);const w=_.useRef(0),T=_.useCallback(ce=>{if(!s)return kG;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 AG;const ce=!!(s.isInitialized||s.initializedStoreOnce)&&y.every(Ae=>fG(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}=_G.useSyncExternalStore(T,R,R);_.useEffect(()=>{if(s&&!H&&!c){const ce=()=>O(W=>W+1);t.lng?DO(s,t.lng,y,ce):JC(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?DO(s,t.lng,y,W):JC(s,y,W)});return X};function RG({i18n:e,defaultNS:t,children:n}){const r=_.useMemo(()=>({i18n:e,defaultNS:t}),[e,t]);return _.createElement(OO.Provider,{value:r},n)}const MO=_.createContext(void 0),tE=()=>{const e=_.useContext(MO);if(!e)throw new Error("useEventSubscriber must be used within an EventSubscriberProvider");return e},DG=({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(MO.Provider,{value:l,children:e})},n_={"--primary":"hsl(0, 0%, 0%)","--secondary":void 0,"--font-family":void 0},FO=_.createContext(void 0),LG=()=>{const e=_.useContext(FO);if(!e)throw new Error("useTheme must be used within a ThemeProvider");return e},OG=()=>{const e=document.querySelector("freeday-widget");return e?.shadowRoot?e:document.documentElement},BO=({children:e,primaryColor:t=n_["--primary"],secondaryColor:n=n_["--secondary"],fontFamily:r=n_["--font-family"]})=>{const a=(h,p,v)=>({"--primary":h?YC(h):"hsl(0, 0%, 0%)","--secondary":p?YC(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=OG();Object.entries(s).forEach(([p,v])=>{v&&(h.style.setProperty(p,v),document.documentElement.style.setProperty(p,v))})},[s]),F.jsx(FO.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 NG{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 nv=e=>typeof e=="function"?e:function(){return e},PG=typeof self<"u"?self:null,Hp=typeof window<"u"?window:null,Ul=PG||Hp||globalThis,IG="2.0.0",zl={connecting:0,open:1,closing:2,closed:3},MG=1e4,FG=1e3,Xo={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},Xu={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},r_={longpoll:"longpoll",websocket:"websocket"},BG={complete:4},i_="base64url.bearer.phx.",nE=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})}},HO=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))}},HG=class{constructor(e,t,n){this.state=Xo.closed,this.topic=e,this.params=nv(t||{}),this.socket=n,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new nE(this,Xu.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new HO(()=>{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 nE(this,Xu.leave,nv({}),this.timeout).send(),this.state=Xo.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(Xu.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(Xu.close,e)}onError(e){return this.on(Xu.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 nE(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(Xu.close,"leave")},n=new nE(this,Xu.leave,nv({}),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}},rE=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===BG.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)}`}},UG=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)},rv=class{constructor(e,t){t&&t.length===2&&t[1].startsWith(i_)&&(this.authToken=atob(t[1].slice(i_.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("(.*)/"+r_.websocket),"$1/"+r_.longpoll)}endpointURL(){return rE.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=UG(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=rE.request(e,this.endpointURL(),t,n,this.timeout,l,c=>{this.reqs.delete(s),this.isActive()&&a(c)}),this.reqs.add(s)}},iE={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:Xu.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}}},zG=class{constructor(e,t={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=t.timeout||MG,this.transport=t.transport||Ul.WebSocket||rv,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=t.longPollFallbackMs,this.fallbackTimer=null,this.sessionStore=t.sessionStorage||Ul&&Ul.sessionStorage,this.establishedConnections=0,this.defaultEncoder=iE.encode.bind(iE),this.defaultDecoder=iE.decode.bind(iE),this.closeWasClean=!1,this.disconnecting=!1,this.binaryType=t.binaryType||"arraybuffer",this.connectClock=1,this.pageHidden=!1,this.transport!==rv?(this.encode=t.encode||this.defaultEncoder,this.decode=t.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let n=null;Hp&&Hp.addEventListener&&(Hp.addEventListener("pagehide",r=>{this.conn&&(this.disconnect(),n=this.connectClock)}),Hp.addEventListener("pageshow",r=>{n===this.connectClock&&(n=null,this.connect())}),Hp.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=nv(t.params||{}),this.endPoint=`${e}/${r_.websocket}`,this.vsn=t.vsn||IG,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new HO(()=>{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 rv}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=rE.appendParams(rE.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=nv(e)),!(this.conn&&!this.disconnecting)&&(this.longPollFallbackMs&&this.transport!==rv?this.connectWithFallback(rv,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",`${i_}${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(),FG,"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(Xu.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 HG(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 jG=e=>{switch(e){case y0.USER:return Uu.USER;case y0.BOT:return Uu.DIGITAL_EMPLOYEE;case y0.INTEGRATION:return Uu.AGENT;case y0.SYSTEM:return Uu.SYSTEM;default:return console.warn(`Unknown sender type: ${e}`),Uu.DIGITAL_EMPLOYEE}},aE=(e,t,n)=>({message_id:e.id,participant_from:{role:jG(e.sender_type),name:e.sender_name||""},blocks:e.blocks,interaction_id:crypto.randomUUID(),channel_id_from:t,sender_id:e.sender_id,sent_at:e.sent_at,status:Q4.COMPLETE,trace_id:crypto.randomUUID(),conversation_id:n,request_user_feedback:e.request_user_feedback,user_feedback_value:e.user_feedback_value}),VG=e=>{const t=e||uO(),[n,r]=t.split("://");return`${n==="https"?"wss":"ws"}://${r}/socket`},a_=crypto.randomUUID();class WG extends NG{constructor(t){super(),this.config=t,this.channel=null,this.reconnectTimer=null,this.subscribeOptions=null,this.currentConversationId=null;const n=VG(t.baseUrl);typeof WebSocket>"u"&&Da(new Error("Failed to create WebSocket connection: WebSocket is not supported in this environment")),this.socket=new zG(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(aE(r,this.config.channelId,this.currentConversationId??a_))}),this.channel.on("stream_event",r=>{this.notifyMessage(aE(r,this.config.channelId,this.currentConversationId??a_))}),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(aE(a[0],this.config.channelId,this.currentConversationId??a_)),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 UO=_.createContext(null),YG=({children:e,config:t})=>{const n=_.useMemo(()=>{const r={type:"phoenix",channelId:t.channelId,baseUrl:t.baseUrl,debug:t.debug};return new WG(r)},[t.channelId,t.baseUrl,t.debug]);return _.useEffect(()=>()=>{n.disconnect()},[n]),F.jsx(UO.Provider,{value:n,children:e})},o_=()=>{const e=_.useContext(UO);if(!e)throw new Error("useWebsocketClient must be used within a WebsocketClientProvider");return e},qG=(e=[])=>{const t=o_(),[n,r]=_.useState(e);_.useEffect(()=>t.onMessage(l=>{r(c=>GG(c,l))}),[t]);const a=_.useCallback(()=>{r([])},[]);return{messages:n,setMessages:r,resetMessages:a}},GG=(e,t)=>{const n=e.findIndex(r=>r.message_id===t.message_id&&r.sender_id===t.sender_id);return n>=0?e.map((r,a)=>a===n?t:r):[...e,t]},KG="freeday:",QG=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 XG(e){const t=QG(e),n=l=>`${KG}${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 ZG extends Error{constructor(t,n){super(t),this.name="ApiError",this.statusCode=n}}class oE{constructor(t=Iz){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 ZG(`${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 JG{constructor(t,n){this.token=t,this.http=new oE(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 s_{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??v0.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 $G=({channelId:e})=>{const t=_.useMemo(()=>XG(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 JG(e,uO()),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 s_(e,new oE(qC())).fetchConversationById(n)).events.map(T=>aE(T,e,n))}catch(y){return Da(y,"Error fetching conversation events"),null}},[n,e]),v=_.useCallback(()=>{r(null),t.removeConversationId()},[t]);return{conversationId:n,userId:a,isInitializing:l,createConversation:h,resumeConversation:p,resetConversation:v}},eK=()=>{const e=o_(),[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}},tK=()=>{const e=o_(),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}},nK=e=>{const t=e.flatMap(r=>r.blocks.filter(a=>a.type==="typing")),n=t[t.length-1];return!!n&&n.typing},zO=_.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(zO);function rK({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}=qG(t?.messages||[]),{conversationId:y,userId:w,createConversation:T,resumeConversation:A,resetConversation:R}=$G({channelId:t.channelId}),{connect:N,disconnect:O,subscribe:M,unsubscribe:H}=eK(),{sendMessageEvent:V,sendActionEvent:K,sendConversationRatingEvent:Y,sendConversationClosedEvent:Z}=tK(),{updateCssVariables:X}=LG(),{emit:ce,subscribe:W,unsubscribe:me}=tE(),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&&!Af(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),Ue(!0)),await Ke(y,w||"")}else await Qe();Pf("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":YC(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=>Af(yr,w))||Pf("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(()=>nK(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(zO.Provider,{value:qn,children:F.jsx(BO,{primaryColor:ut.settings?.primaryColor||t.primaryColor,children:e})})}const iK=dq,aK=fq,oK=hq,jO=_.forwardRef(({className:e,sideOffset:t=4,...n},r)=>{const{state:a}=ai();return a?.inShadowDom?F.jsx(zC,{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(pq,{children:F.jsx(zC,{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})})});jO.displayName=zC.displayName;const sK={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(wG).init({resources:sK,lng:"en",fallbackLng:"en",interpolation:{escapeValue:!1}});const VO={posthog:{project_key:"phc_JeeePECzKqZPUbgQd1Voo3CsQta7ggHpKxPPlpKg1Fz",api_host:"https://eu.posthog.com"}};var WO=_.createContext({client:ys,bootstrap:void 0});function YO(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)||!YO(e[c],t[c],n))return!1}return!0}function lK(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&&!YO(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(WO.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 l_=function(e){return typeof e=="function"},u_=function(e,t){return u_=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])},u_(e,t)};function uK(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");u_(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 cK={componentStack:null,exceptionEvent:null,error:null},dK={INVALID_FALLBACK:"[PostHog.js][PostHogErrorBoundary] Invalid fallback prop, provide a valid React element or a function that returns a valid React element."};(function(e){uK(t,e);function t(n){var r=e.call(this,n)||this;return r.state=cK,r}return t.prototype.componentDidCatch=function(n,r){var a=this.props.additionalProperties,s;l_(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 l_(r)?r():r;var l=l_(a)?ge.createElement(a,{error:s.error,componentStack:s.componentStack,exceptionEvent:s.exceptionEvent}):a;return ge.isValidElement(l)?l:(console.warn(dK.INVALID_FALLBACK),ge.createElement(ge.Fragment,null))},t.contextType=WO,t})(ge.Component);const fK=["freeday-app-beta.web.app","freeday-app-beta.firebaseapp.com","beta-chat.freeday.ai"],hK=()=>{typeof window<"u"&&!fK.includes(window.location.hostname)&&ys.init(VO.posthog.project_key,{cookieless_mode:"always",api_host:VO.posthog.api_host,autocapture:!1,disable_session_recording:!0,capture_pageview:!1,capture_pageleave:!1,advanced_disable_feature_flags_on_first_load:!0})},pK=({children:e})=>(_.useEffect(()=>{hK()},[]),F.jsx(lK,{client:ys,children:e})),qO=_.createContext(void 0),mK=({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(qO.Provider,{value:T,children:e})},iv=()=>{const e=_.useContext(qO);if(e===void 0)throw new Error("useUploadState must be used within an UploadStateProvider");return e},gK=({children:e,config:t,inShadowDom:n=!1})=>{if(!t?.channelId)return F.jsx("div",{children:"No channelId provided..."});let r=F.jsx(YG,{config:{channelId:t.channelId,baseUrl:t.baseUrl},children:F.jsx(BO,{primaryColor:t.primaryColor,children:F.jsx(RG,{i18n:Ra,children:F.jsx(iK,{children:F.jsx(DG,{children:F.jsx(rK,{config:t,inShadowDom:n,children:F.jsx(mK,{children:e})})})})})})});return t.analyticsEnabled&&(r=F.jsx(pK,{children:r})),r},sE=({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"})]}),vK={button:"_button_14uy3_1"},yK=({onToggleWidget:e})=>{const{t}=Gr(),n=r=>{r.stopPropagation(),e()};return F.jsx("button",{className:vK.button,onClick:n,"aria-label":t("common:openChat"),"data-testid":"chat-button",children:F.jsx(sE,{})})};function lE(e,t){window.dispatchEvent(new StorageEvent("storage",{key:e,newValue:t}))}const GO=(e,t)=>{const n=JSON.stringify(t);window.localStorage.setItem(e,n),lE(e,n)},bK=e=>{window.localStorage.removeItem(e),lE(e,null)},KO=e=>window.localStorage.getItem(e),EK=e=>(window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)),wK=()=>{throw Error("useLocalStorage is a client-only hook")};function QO(e,t){const n=()=>KO(e),r=_.useSyncExternalStore(EK,n,wK),a=_.useCallback(s=>{try{const l=typeof s=="function"?s(JSON.parse(r)):s;l==null?bK(e):GO(e,l)}catch(l){console.warn(l)}},[e,r]);return _.useEffect(()=>{KO(e)===null&&typeof t<"u"&&GO(e,t)},[e,t]),[r?JSON.parse(r):t,a]}const XO=(e,t)=>{const n=JSON.stringify(t);window.sessionStorage.setItem(e,n),lE(e,n)},xK=e=>{window.sessionStorage.removeItem(e),lE(e,null)},ZO=e=>window.sessionStorage.getItem(e),TK=e=>(window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)),SK=()=>{throw Error("useSessionStorage is a client-only hook")};function CK(e,t){const n=()=>ZO(e),r=_.useSyncExternalStore(TK,n,SK),a=_.useCallback(s=>{try{const l=typeof s=="function"?s(JSON.parse(r)):s;l==null?xK(e):XO(e,l)}catch(l){console.warn(l)}},[e,r]);return _.useEffect(()=>{ZO(e)===null&&typeof t<"u"&&XO(e,t)},[e,t]),[r?JSON.parse(r):t,a]}const c_=_.createContext({});function d_(e){const t=_.useRef(null);return t.current===null&&(t.current=e()),t.current}const f_=typeof window<"u",JO=f_?_.useLayoutEffect:_.useEffect,uE=_.createContext(null);function h_(e,t){e.indexOf(t)===-1&&e.push(t)}function p_(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 m_(e,t){return t?`${e}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${t}`:e}var _K={};let Up=()=>{},Zu=()=>{};typeof process<"u"&&_K?.NODE_ENV!=="production"&&(Up=(e,t,n)=>{!e&&typeof console<"u"&&console.warn(m_(t,n))},Zu=(e,t,n)=>{if(!e)throw new Error(m_(t,n))});const Ju={},$O=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function eN(e){return typeof e=="object"&&e!==null}const tN=e=>/^0[^.\s]+$/u.test(e);function g_(e){let t;return()=>(t===void 0&&(t=e()),t)}const bs=e=>e,AK=(e,t)=>n=>t(e(n)),av=(...e)=>e.reduce(AK),ov=(e,t,n)=>{const r=t-e;return r===0?1:(n-e)/r};class v_{constructor(){this.subscriptions=[]}add(t){return h_(this.subscriptions,t),()=>p_(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 nN(e,t){return t?e*(1e3/t):0}const rN=new Set;function y_(e,t,n){e||rN.has(t)||(console.warn(m_(t,n)),rN.add(t))}const iN=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,kK=1e-7,RK=12;function DK(e,t,n,r,a){let s,l,c=0;do l=t+(n-t)/2,s=iN(l,r,a)-e,s>0?n=l:t=l;while(Math.abs(s)>kK&&++c<RK);return l}function sv(e,t,n,r){if(e===t&&n===r)return bs;const a=s=>DK(s,0,1,e,n);return s=>s===0||s===1?s:iN(a(s),t,r)}const aN=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,oN=e=>t=>1-e(1-t),sN=sv(.33,1.53,.69,.99),b_=oN(sN),lN=aN(b_),uN=e=>(e*=2)<1?.5*b_(e):.5*(2-Math.pow(2,-10*(e-1))),E_=e=>1-Math.sin(Math.acos(e)),cN=oN(E_),dN=aN(E_),LK=sv(.42,0,1,1),OK=sv(0,0,.58,1),fN=sv(.42,0,.58,1),NK=e=>Array.isArray(e)&&typeof e[0]!="number",hN=e=>Array.isArray(e)&&typeof e[0]=="number",pN={linear:bs,easeIn:LK,easeInOut:fN,easeOut:OK,circIn:E_,circInOut:dN,circOut:cN,backIn:b_,backInOut:lN,backOut:sN,anticipate:uN},PK=e=>typeof e=="string",mN=e=>{if(hN(e)){Zu(e.length===4,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");const[t,n,r,a]=e;return sv(t,n,r,a)}else if(PK(e))return Zu(pN[e]!==void 0,`Invalid easing type '${e}'`,"invalid-easing-type"),pN[e];return e},cE=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function IK(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 MK=40;function gN(e,t){let n=!1,r=!0;const a={delta:0,timestamp:0,isProcessing:!1},s=()=>n=!0,l=cE.reduce((H,V)=>(H[V]=IK(s),H),{}),{setup:c,read:h,resolveKeyframes:p,preUpdate:v,update:y,preRender:w,render:T,postRender:A}=l,R=()=>{const H=Ju.useManualTiming?a.timestamp:performance.now();n=!1,Ju.useManualTiming||(a.delta=r?1e3/60:Math.max(Math.min(H-a.timestamp,MK),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:cE.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<cE.length;V++)l[cE[V]].cancel(H)},state:a,steps:l}}const{schedule:Mr,cancel:ld,state:da,steps:w_}=gN(typeof requestAnimationFrame<"u"?requestAnimationFrame:bs,!0);let dE;function FK(){dE=void 0}const to={now:()=>(dE===void 0&&to.set(da.isProcessing||Ju.useManualTiming?da.timestamp:performance.now()),dE),set:e=>{dE=e,queueMicrotask(FK)}},vN=e=>t=>typeof t=="string"&&t.startsWith(e),yN=vN("--"),BK=vN("var(--"),x_=e=>BK(e)?HK.test(e.split("/*")[0].trim()):!1,HK=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function bN(e){return typeof e!="string"?!1:e.split("/*")[0].includes("var(--")}const zp={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},lv={...zp,transform:e=>jl(0,1,e)},fE={...zp,default:1},uv=e=>Math.round(e*1e5)/1e5,T_=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function UK(e){return e==null}const zK=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,S_=(e,t)=>n=>!!(typeof n=="string"&&zK.test(n)&&n.startsWith(e)||t&&!UK(n)&&Object.prototype.hasOwnProperty.call(n,t)),EN=(e,t,n)=>r=>{if(typeof r!="string")return r;const[a,s,l,c]=r.match(T_);return{[e]:parseFloat(a),[t]:parseFloat(s),[n]:parseFloat(l),alpha:c!==void 0?parseFloat(c):1}},jK=e=>jl(0,255,e),C_={...zp,transform:e=>Math.round(jK(e))},Ff={test:S_("rgb","red"),parse:EN("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+C_.transform(e)+", "+C_.transform(t)+", "+C_.transform(n)+", "+uv(lv.transform(r))+")"};function VK(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 __={test:S_("#"),parse:VK,transform:Ff.transform},cv=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),ud=cv("deg"),Wl=cv("%"),kt=cv("px"),WK=cv("vh"),YK=cv("vw"),wN={...Wl,parse:e=>Wl.parse(e)/100,transform:e=>Wl.transform(e*100)},jp={test:S_("hsl","hue"),parse:EN("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+Wl.transform(uv(t))+", "+Wl.transform(uv(n))+", "+uv(lv.transform(r))+")"},xi={test:e=>Ff.test(e)||__.test(e)||jp.test(e),parse:e=>Ff.test(e)?Ff.parse(e):jp.test(e)?jp.parse(e):__.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?Ff.transform(e):jp.transform(e),getAnimatableNone:e=>{const t=xi.parse(e);return t.alpha=0,xi.transform(t)}},qK=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function GK(e){return isNaN(e)&&typeof e=="string"&&(e.match(T_)?.length||0)+(e.match(qK)?.length||0)>0}const xN="number",TN="color",KK="var",QK="var(",SN="${}",XK=/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 dv(e){const t=e.toString(),n=[],r={color:[],number:[],var:[]},a=[];let s=0;const c=t.replace(XK,h=>(xi.test(h)?(r.color.push(s),a.push(TN),n.push(xi.parse(h))):h.startsWith(QK)?(r.var.push(s),a.push(KK),n.push(h)):(r.number.push(s),a.push(xN),n.push(parseFloat(h))),++s,SN)).split(SN);return{values:n,split:c,indexes:r,types:a}}function CN(e){return dv(e).values}function _N(e){const{split:t,types:n}=dv(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===xN?s+=uv(a[l]):c===TN?s+=xi.transform(a[l]):s+=a[l]}return s}}const ZK=e=>typeof e=="number"?0:xi.test(e)?xi.getAnimatableNone(e):e;function JK(e){const t=CN(e);return _N(e)(t.map(ZK))}const cd={test:GK,parse:CN,createTransformer:_N,getAnimatableNone:JK};function A_(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 $K({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=A_(h,c,e+.3333333333333333),s=A_(h,c,e),l=A_(h,c,e-.3333333333333333)}return{red:Math.round(a*255),green:Math.round(s*255),blue:Math.round(l*255),alpha:r}}function hE(e,t){return n=>n>0?t:e}const Kr=(e,t,n)=>e+(t-e)*n,k_=(e,t,n)=>{const r=e*e,a=n*(t*t-r)+r;return a<0?0:Math.sqrt(a)},eQ=[__,Ff,jp],tQ=e=>eQ.find(t=>t.test(e));function AN(e){const t=tQ(e);if(Up(!!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===jp&&(n=$K(n)),n}const kN=(e,t)=>{const n=AN(e),r=AN(t);if(!n||!r)return hE(e,t);const a={...n};return s=>(a.red=k_(n.red,r.red,s),a.green=k_(n.green,r.green,s),a.blue=k_(n.blue,r.blue,s),a.alpha=Kr(n.alpha,r.alpha,s),Ff.transform(a))},R_=new Set(["none","hidden"]);function nQ(e,t){return R_.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function rQ(e,t){return n=>Kr(e,t,n)}function D_(e){return typeof e=="number"?rQ:typeof e=="string"?x_(e)?hE:xi.test(e)?kN:oQ:Array.isArray(e)?RN:typeof e=="object"?xi.test(e)?kN:iQ:hE}function RN(e,t){const n=[...e],r=n.length,a=e.map((s,l)=>D_(s)(s,t[l]));return s=>{for(let l=0;l<r;l++)n[l]=a[l](s);return n}}function iQ(e,t){const n={...e,...t},r={};for(const a in n)e[a]!==void 0&&t[a]!==void 0&&(r[a]=D_(e[a])(e[a],t[a]));return a=>{for(const s in r)n[s]=r[s](a);return n}}function aQ(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 oQ=(e,t)=>{const n=cd.createTransformer(t),r=dv(e),a=dv(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?R_.has(e)&&!a.values.length||R_.has(t)&&!r.values.length?nQ(e,t):av(RN(aQ(r,a),a.values),n):(Up(!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"),hE(e,t))};function DN(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?Kr(e,t,n):D_(e)(e,t)}const sQ=e=>{const t=({timestamp:n})=>e(n);return{start:(n=!0)=>Mr.update(t,n),stop:()=>ld(t),now:()=>da.isProcessing?da.timestamp:to.now()}},LN=(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)})`},pE=2e4;function L_(e){let t=0;const n=50;let r=e.next(t);for(;!r.done&&t<pE;)t+=n,r=e.next(t);return t>=pE?1/0:t}function lQ(e,t=100,n){const r=n({...e,keyframes:[0,t]}),a=Math.min(L_(r),pE);return{type:"keyframes",ease:s=>r.next(a*s).value/t,duration:Es(a)}}const uQ=5;function ON(e,t,n){const r=Math.max(t-uQ,0);return nN(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},O_=.001;function cQ({duration:e=Qr.duration,bounce:t=Qr.bounce,velocity:n=Qr.velocity,mass:r=Qr.mass}){let a,s;Up(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=N_(p,l),A=Math.exp(-y);return O_-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=N_(Math.pow(p,2),l);return(-a(p)+O_>0?-1:1)*((w-T)*A)/R}):(a=p=>{const v=Math.exp(-p*e),y=(p-n)*e+1;return-O_+v*y},s=p=>{const v=Math.exp(-p*e),y=(n-p)*(e*e);return v*y});const c=5/e,h=fQ(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 dQ=12;function fQ(e,t,n){let r=n;for(let a=1;a<dQ;a++)r=r-e(r)/t(r);return r}function N_(e,t){return e*Math.sqrt(1-t*t)}const hQ=["duration","bounce"],pQ=["stiffness","damping","mass"];function NN(e,t){return t.some(n=>e[n]!==void 0)}function mQ(e){let t={velocity:Qr.velocity,stiffness:Qr.stiffness,damping:Qr.damping,mass:Qr.mass,isResolvedFromDuration:!1,...e};if(!NN(e,pQ)&&NN(e,hQ))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=cQ(e);t={...t,...n,mass:Qr.mass},t.isResolvedFromDuration=!0}return t}function mE(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}=mQ({...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=N_(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):ON(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(L_(V),pE),Y=LN(Z=>V.next(K*Z).value,K,30);return K+"ms "+Y},toTransition:()=>{}};return V}mE.applyToOptions=e=>{const t=lQ(e,100,mE);return e.ease=t.ease,e.duration=Vl(t.duration),e.type="keyframes",e};function P_({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=mE({keyframes:[w.value,A(w.value)],velocity:ON(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 gQ(e,t,n){const r=[],a=n||Ju.mix||DN,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=av(h,c)}r.push(c)}return r}function vQ(e,t,{clamp:n=!0,ease:r,mixer:a}={}){const s=e.length;if(Zu(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=gQ(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=ov(e[y],e[y+1],v);return c[y](w)};return n?v=>p(jl(e[0],e[s-1],v)):p}function yQ(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const a=ov(0,t,r);e.push(Kr(n,1,a))}}function bQ(e){const t=[0];return yQ(t,e.length-1),t}function EQ(e,t){return e.map(n=>n*t)}function wQ(e,t){return e.map(()=>t||fN).splice(0,e.length-1)}function Vp({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const a=NK(r)?r.map(mN):mN(r),s={done:!1,value:t[0]},l=EQ(n&&n.length===t.length?n:bQ(t),e),c=vQ(l,t,{ease:Array.isArray(a)?a:wQ(t,a)});return{calculatedDuration:e,next:h=>(s.value=c(h),s.done=h>=e,s)}}const xQ=e=>e!==null;function I_(e,{repeat:t,repeatType:n="loop"},r,a=1){const s=e.filter(xQ),c=a<0||t&&n!=="loop"&&t%2===1?0:s.length-1;return!c||r===void 0?s[c]:r}const TQ={decay:P_,inertia:P_,tween:Vp,keyframes:Vp,spring:mE};function PN(e){typeof e.type=="string"&&(e.type=TQ[e.type])}class M_{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 SQ={};const CQ=e=>e/100;class F_ extends M_{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;PN(t);const{type:n=Vp,repeat:r=0,repeatDelay:a=0,repeatType:s,velocity:l=0}=t;let{keyframes:c}=t;const h=n||Vp;SQ.NODE_ENV!=="production"&&h!==Vp&&Zu(c.length<=2,`Only two keyframes currently supported with spring and inertia animations. Trying to animate ${c}`,"spring-two-frames"),h!==Vp&&typeof c[0]!="number"&&(this.mixKeyframes=av(CQ,DN(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=L_(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!==P_&&(K.value=I_(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=sQ,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 _Q(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}const Bf=e=>e*180/Math.PI,B_=e=>{const t=Bf(Math.atan2(e[1],e[0]));return H_(t)},AQ={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:B_,rotateZ:B_,skewX:e=>Bf(Math.atan(e[1])),skewY:e=>Bf(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},H_=e=>(e=e%360,e<0&&(e+=360),e),IN=B_,MN=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),FN=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),kQ={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:MN,scaleY:FN,scale:e=>(MN(e)+FN(e))/2,rotateX:e=>H_(Bf(Math.atan2(e[6],e[5]))),rotateY:e=>H_(Bf(Math.atan2(-e[2],e[0]))),rotateZ:IN,rotate:IN,skewX:e=>Bf(Math.atan(e[4])),skewY:e=>Bf(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function U_(e){return e.includes("scale")?1:0}function z_(e,t){if(!e||e==="none")return U_(t);const n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let r,a;if(n)r=kQ,a=n;else{const c=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=AQ,a=c}if(!a)return U_(t);const s=r[t],l=a[1].split(",").map(DQ);return typeof s=="function"?s(l):l[s]}const RQ=(e,t)=>{const{transform:n="none"}=getComputedStyle(e);return z_(n,t)};function DQ(e){return parseFloat(e.trim())}const Wp=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Yp=new Set(Wp),BN=e=>e===zp||e===kt,LQ=new Set(["x","y","z"]),OQ=Wp.filter(e=>!LQ.has(e));function NQ(e){const t=[];return OQ.forEach(n=>{const r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),t}const dd={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})=>z_(t,"x"),y:(e,{transform:t})=>z_(t,"y")};dd.translateX=dd.x,dd.translateY=dd.y;const Hf=new Set;let j_=!1,V_=!1,W_=!1;function HN(){if(V_){const e=Array.from(Hf).filter(r=>r.needsMeasurement),t=new Set(e.map(r=>r.element)),n=new Map;t.forEach(r=>{const a=NQ(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)})}V_=!1,j_=!1,Hf.forEach(e=>e.complete(W_)),Hf.clear()}function UN(){Hf.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(V_=!0)})}function PQ(){W_=!0,UN(),HN(),W_=!1}class Y_{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?(Hf.add(this),j_||(j_=!0,Mr.read(UN),Mr.resolveKeyframes(HN))):(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])}_Q(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),Hf.delete(this)}cancel(){this.state==="scheduled"&&(Hf.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const IQ=e=>e.startsWith("--");function MQ(e,t,n){IQ(t)?e.style.setProperty(t,n):e.style[t]=n}const FQ=g_(()=>window.ScrollTimeline!==void 0),BQ={};function HQ(e,t){const n=g_(e);return()=>BQ[t]??n()}const zN=HQ(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),fv=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,jN={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:fv([0,.65,.55,1]),circOut:fv([.55,0,1,.45]),backIn:fv([.31,.01,.66,-.59]),backOut:fv([.33,1.53,.69,.99])};function VN(e,t){if(e)return typeof e=="function"?zN()?LN(e,t):"ease-out":hN(e)?fv(e):Array.isArray(e)?e.map(n=>VN(n,t)||jN.easeOut):jN[e]}function UQ(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=VN(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 WN(e){return typeof e=="function"&&"applyToOptions"in e}function zQ({type:e,...t}){return WN(e)&&zN()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class jQ extends M_{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,Zu(typeof t.type!="string",`Mini animate() doesn't support "type" as a string.`,"mini-spring");const p=zQ(t);this.animation=UQ(n,r,a,p,s),p.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!s){const v=I_(a,this.options,c,this.speed);this.updateMotionValue?this.updateMotionValue(v):MQ(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&&FQ()?(this.animation.timeline=t,bs):n(this)}}const YN={anticipate:uN,backInOut:lN,circInOut:dN};function VQ(e){return e in YN}function WQ(e){typeof e.ease=="string"&&VQ(e.ease)&&(e.ease=YN[e.ease])}const q_=10;class YQ extends jQ{constructor(t){WQ(t),PN(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 F_({...l,autoplay:!1}),h=Math.max(q_,to.now()-this.startTime),p=jl(0,q_,h-q_);n.setWithVelocity(c.sample(Math.max(0,h-p)).value,c.sample(h).value,p),c.stop()}}const qN=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(cd.test(e)||e==="0")&&!e.startsWith("url("));function qQ(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 GQ(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=qN(a,t),c=qN(s,t);return Up(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:qQ(e)||(n==="spring"||WN(n))&&r}function G_(e){e.duration=0,e.type="keyframes"}const KQ=new Set(["opacity","clipPath","filter","transform"]),QQ=g_(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function XQ(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 QQ()&&n&&KQ.has(n)&&(n!=="transform"||!p)&&!h&&!r&&a!=="mirror"&&s!==0&&l!=="inertia"}const ZQ=40;class JQ extends M_{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||Y_;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(),GQ(t,s,l,c)||((Ju.instantAnimations||!h)&&v?.(I_(t,r,n)),t[0]=t[t.length-1],G_(r),r.repeat=0);const w={startTime:a?this.resolvedAt?this.resolvedAt-this.createdAt>ZQ?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...r,keyframes:t},T=!p&&XQ(w)?new YQ({...w,element:w.motionValue.owner.current}):new F_(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(),PQ()),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 $Q=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function eX(e){const t=$Q.exec(e);if(!t)return[,];const[,n,r,a]=t;return[`--${n??r}`,a]}const tX=4;function GN(e,t,n=1){Zu(n<=tX,`Max CSS variable fallback depth detected in property "${e}". This may indicate a circular fallback dependency.`,"max-css-var-depth");const[r,a]=eX(e);if(!r)return;const s=window.getComputedStyle(t).getPropertyValue(r);if(s){const l=s.trim();return $O(l)?parseFloat(l):l}return x_(a)?GN(a,t,n+1):a}function K_(e,t){return e?.[t]??e?.default??e}const KN=new Set(["width","height","top","left","right","bottom",...Wp]);var nX={};const QN=30,rX=e=>!isNaN(parseFloat(e));class iX{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=rX(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return nX.NODE_ENV!=="production"&&y_(!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 v_);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>QN)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,QN);return nN(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 qp(e,t){return new iX(e,t)}const La=e=>!!(e&&e.getVelocity),aX={test:e=>e==="auto",parse:e=>e},XN=e=>t=>t.test(e),ZN=[zp,kt,Wl,ud,YK,WK,aX],JN=e=>ZN.find(XN(e));function oX(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||tN(e):!0}const sX=new Set(["brightness","contrast","saturate","opacity"]);function lX(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=n.match(T_)||[];if(!r)return e;const a=n.replace(r,"");let s=sX.has(t)?1:0;return r!==n&&(s*=100),t+"("+s+a+")"}const uX=/\b([a-z-]*)\(.*?\)/gu,Q_={...cd,getAnimatableNone:e=>{const t=e.match(uX);return t?t.map(lX).join(" "):e}},$N={...zp,transform:Math.round},X_={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:ud,rotateX:ud,rotateY:ud,rotateZ:ud,scale:fE,scaleX:fE,scaleY:fE,scaleZ:fE,skew:ud,skewX:ud,skewY:ud,distance:kt,translateX:kt,translateY:kt,translateZ:kt,x:kt,y:kt,z:kt,perspective:kt,transformPerspective:kt,opacity:lv,originX:wN,originY:wN,originZ:kt},zIndex:$N,fillOpacity:lv,strokeOpacity:lv,numOctaves:$N},cX={...X_,color:xi,backgroundColor:xi,outlineColor:xi,fill:xi,stroke:xi,borderColor:xi,borderTopColor:xi,borderRightColor:xi,borderBottomColor:xi,borderLeftColor:xi,filter:Q_,WebkitFilter:Q_},e8=e=>cX[e];function t8(e,t){let n=e8(e);return n!==Q_&&(n=cd),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const dX=new Set(["auto","none","0"]);function fX(e,t,n){let r=0,a;for(;r<e.length&&!a;){const s=e[r];typeof s=="string"&&!dX.has(s)&&dv(s).values.length&&(a=e[r]),r++}if(a&&n)for(const s of t)e[s]=t8(n,a)}class hX extends Y_{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(),x_(y))){const w=GN(y,n.current);w!==void 0&&(t[v]=w),v===t.length-1&&(this.finalKeyframe=y)}}if(this.resolveNoneKeyframes(),!KN.has(r)||t.length!==2)return;const[a,s]=t,l=JN(a),c=JN(s),h=bN(a),p=bN(s);if(h!==p&&dd[r]){this.needsMeasurement=!0;return}if(l!==c)if(BN(l)&&BN(c))for(let v=0;v<t.length;v++){const y=t[v];typeof y=="string"&&(t[v]=parseFloat(y))}else dd[r]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:n}=this,r=[];for(let a=0;a<t.length;a++)(t[a]===null||oX(t[a]))&&r.push(a);r.length&&fX(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=dd[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]=dd[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 pX(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 n8=(e,t)=>t&&typeof e=="number"?t.transform(e):e;function r8(e){return eN(e)&&"offsetHeight"in e}const{schedule:Z_}=gN(queueMicrotask,!1),Qs={x:!1,y:!1};function i8(){return Qs.x||Qs.y}function mX(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 a8(e,t){const n=pX(e),r=new AbortController,a={passive:!0,...t,signal:r.signal};return[n,a,()=>r.abort()]}function o8(e){return!(e.pointerType==="touch"||i8())}function gX(e,t,n={}){const[r,a,s]=a8(e,n),l=c=>{if(!o8(c))return;const{target:h}=c,p=t(h,c);if(typeof p!="function"||!h)return;const v=y=>{o8(y)&&(p(y),h.removeEventListener("pointerleave",v))};h.addEventListener("pointerleave",v,a)};return r.forEach(c=>{c.addEventListener("pointerenter",l,a)}),s}const s8=(e,t)=>t?e===t?!0:s8(e,t.parentElement):!1,J_=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,vX=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function l8(e){return vX.has(e.tagName)||e.isContentEditable===!0}const gE=new WeakSet;function u8(e){return t=>{t.key==="Enter"&&e(t)}}function $_(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const yX=(e,t)=>{const n=e.currentTarget;if(!n)return;const r=u8(()=>{if(gE.has(n))return;$_(n,"down");const a=u8(()=>{$_(n,"up")}),s=()=>$_(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 c8(e){return J_(e)&&!i8()}function bX(e,t,n={}){const[r,a,s]=a8(e,n),l=c=>{const h=c.currentTarget;if(!c8(c))return;gE.add(h);const p=t(h,c),v=(T,A)=>{window.removeEventListener("pointerup",y),window.removeEventListener("pointercancel",w),gE.has(h)&&gE.delete(h),c8(T)&&typeof p=="function"&&p(T,{success:A})},y=T=>{v(T,h===window||h===document||n.useGlobalTarget||s8(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),r8(c)&&(c.addEventListener("focus",p=>yX(p,a)),!l8(c)&&!c.hasAttribute("tabindex")&&(c.tabIndex=0))}),s}function d8(e){return eN(e)&&"ownerSVGElement"in e}function EX(e){return d8(e)&&e.tagName==="svg"}const wX=[...ZN,xi,cd],xX=e=>wX.find(XN(e)),eA=_.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function f8(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function TX(...e){return t=>{let n=!1;const r=e.map(a=>{const s=f8(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():f8(e[a],null)}}}}function SX(...e){return _.useCallback(TX(...e),e)}class CX extends _.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(n&&t.isPresent&&!this.props.isPresent){const r=n.offsetParent,a=r8(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 _X({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(eA),h=e.props?.ref??e?.ref,p=SX(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=rE.request(e,this.endpointURL(),t,n,this.timeout,l,c=>{this.reqs.delete(s),this.isActive()&&a(c)}),this.reqs.add(s)}},iE={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:Xu.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}}},zG=class{constructor(e,t={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=t.timeout||MG,this.transport=t.transport||Ul.WebSocket||rv,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=t.longPollFallbackMs,this.fallbackTimer=null,this.sessionStore=t.sessionStorage||Ul&&Ul.sessionStorage,this.establishedConnections=0,this.defaultEncoder=iE.encode.bind(iE),this.defaultDecoder=iE.decode.bind(iE),this.closeWasClean=!1,this.disconnecting=!1,this.binaryType=t.binaryType||"arraybuffer",this.connectClock=1,this.pageHidden=!1,this.transport!==rv?(this.encode=t.encode||this.defaultEncoder,this.decode=t.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let n=null;Hp&&Hp.addEventListener&&(Hp.addEventListener("pagehide",r=>{this.conn&&(this.disconnect(),n=this.connectClock)}),Hp.addEventListener("pageshow",r=>{n===this.connectClock&&(n=null,this.connect())}),Hp.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=nv(t.params||{}),this.endPoint=`${e}/${r_.websocket}`,this.vsn=t.vsn||IG,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new HO(()=>{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 rv}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=rE.appendParams(rE.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=nv(e)),!(this.conn&&!this.disconnecting)&&(this.longPollFallbackMs&&this.transport!==rv?this.connectWithFallback(rv,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",`${i_}${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(),FG,"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(Xu.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 HG(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 jG=e=>{switch(e){case y0.USER:return Uu.USER;case y0.BOT:return Uu.DIGITAL_EMPLOYEE;case y0.INTEGRATION:return Uu.AGENT;case y0.SYSTEM:return Uu.SYSTEM;default:return console.warn(`Unknown sender type: ${e}`),Uu.DIGITAL_EMPLOYEE}},aE=(e,t,n)=>({message_id:e.id,participant_from:{role:jG(e.sender_type),name:e.sender_name||""},blocks:e.blocks,interaction_id:crypto.randomUUID(),channel_id_from:t,sender_id:e.sender_id,sent_at:e.sent_at,status:Q4.COMPLETE,trace_id:crypto.randomUUID(),conversation_id:n,request_user_feedback:e.request_user_feedback,user_feedback_value:e.user_feedback_value}),VG=e=>{const t=e||uO(),[n,r]=t.split("://");return`${n==="https"?"wss":"ws"}://${r}/socket`},a_=crypto.randomUUID();class WG extends NG{constructor(t){super(),this.config=t,this.channel=null,this.reconnectTimer=null,this.subscribeOptions=null,this.currentConversationId=null;const n=VG(t.baseUrl);typeof WebSocket>"u"&&Da(new Error("Failed to create WebSocket connection: WebSocket is not supported in this environment")),this.socket=new zG(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(aE(r,this.config.channelId,this.currentConversationId??a_))}),this.channel.on("stream_event",r=>{this.notifyMessage(aE(r,this.config.channelId,this.currentConversationId??a_))}),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(aE(a[0],this.config.channelId,this.currentConversationId??a_)),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 UO=_.createContext(null),YG=({children:e,config:t})=>{const n=_.useMemo(()=>{const r={type:"phoenix",channelId:t.channelId,baseUrl:t.baseUrl,debug:t.debug};return new WG(r)},[t.channelId,t.baseUrl,t.debug]);return _.useEffect(()=>()=>{n.disconnect()},[n]),F.jsx(UO.Provider,{value:n,children:e})},o_=()=>{const e=_.useContext(UO);if(!e)throw new Error("useWebsocketClient must be used within a WebsocketClientProvider");return e},qG=(e=[])=>{const t=o_(),[n,r]=_.useState(e);_.useEffect(()=>t.onMessage(l=>{r(c=>GG(c,l))}),[t]);const a=_.useCallback(()=>{r([])},[]);return{messages:n,setMessages:r,resetMessages:a}},GG=(e,t)=>{const n=e.findIndex(r=>r.message_id===t.message_id&&r.sender_id===t.sender_id);return n>=0?e.map((r,a)=>a===n?t:r):[...e,t]},KG="freeday:",QG=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 XG(e){const t=QG(e),n=l=>`${KG}${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 ZG extends Error{constructor(t,n){super(t),this.name="ApiError",this.statusCode=n}}class oE{constructor(t=Iz){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 ZG(`${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 JG{constructor(t,n){this.token=t,this.http=new oE(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 s_{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,companyId:t.company_id,intro:{type:t.intro_type??v0.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 $G=({channelId:e})=>{const t=_.useMemo(()=>XG(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 JG(e,uO()),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 s_(e,new oE(qC())).fetchConversationById(n)).events.map(T=>aE(T,e,n))}catch(y){return Da(y,"Error fetching conversation events"),null}},[n,e]),v=_.useCallback(()=>{r(null),t.removeConversationId()},[t]);return{conversationId:n,userId:a,isInitializing:l,createConversation:h,resumeConversation:p,resetConversation:v}},eK=()=>{const e=o_(),[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}},tK=()=>{const e=o_(),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}},nK=e=>{const t=e.flatMap(r=>r.blocks.filter(a=>a.type==="typing")),n=t[t.length-1];return!!n&&n.typing},zO=_.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(zO);function rK({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}=qG(t?.messages||[]),{conversationId:y,userId:w,createConversation:T,resumeConversation:A,resetConversation:R}=$G({channelId:t.channelId}),{connect:N,disconnect:O,subscribe:M,unsubscribe:H}=eK(),{sendMessageEvent:V,sendActionEvent:K,sendConversationRatingEvent:Y,sendConversationClosedEvent:Z}=tK(),{updateCssVariables:X}=LG(),{emit:ce,subscribe:W,unsubscribe:me}=tE(),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&&!Af(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),Ue(!0)),await Ke(y,w||"")}else await Qe();Pf("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":YC(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=>Af(yr,w))||Pf("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(()=>nK(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(zO.Provider,{value:qn,children:F.jsx(BO,{primaryColor:ut.settings?.primaryColor||t.primaryColor,children:e})})}const iK=dq,aK=fq,oK=hq,jO=_.forwardRef(({className:e,sideOffset:t=4,...n},r)=>{const{state:a}=ai();return a?.inShadowDom?F.jsx(zC,{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(pq,{children:F.jsx(zC,{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})})});jO.displayName=zC.displayName;const sK={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(wG).init({resources:sK,lng:"en",fallbackLng:"en",interpolation:{escapeValue:!1}});const VO={posthog:{project_key:"phc_JeeePECzKqZPUbgQd1Voo3CsQta7ggHpKxPPlpKg1Fz",api_host:"https://eu.posthog.com"}};var WO=_.createContext({client:ys,bootstrap:void 0});function YO(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)||!YO(e[c],t[c],n))return!1}return!0}function lK(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&&!YO(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(WO.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 l_=function(e){return typeof e=="function"},u_=function(e,t){return u_=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])},u_(e,t)};function uK(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");u_(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 cK={componentStack:null,exceptionEvent:null,error:null},dK={INVALID_FALLBACK:"[PostHog.js][PostHogErrorBoundary] Invalid fallback prop, provide a valid React element or a function that returns a valid React element."};(function(e){uK(t,e);function t(n){var r=e.call(this,n)||this;return r.state=cK,r}return t.prototype.componentDidCatch=function(n,r){var a=this.props.additionalProperties,s;l_(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 l_(r)?r():r;var l=l_(a)?ge.createElement(a,{error:s.error,componentStack:s.componentStack,exceptionEvent:s.exceptionEvent}):a;return ge.isValidElement(l)?l:(console.warn(dK.INVALID_FALLBACK),ge.createElement(ge.Fragment,null))},t.contextType=WO,t})(ge.Component);const fK=["freeday-app-beta.web.app","freeday-app-beta.firebaseapp.com","beta-chat.freeday.ai"],hK=()=>{typeof window<"u"&&!fK.includes(window.location.hostname)&&ys.init(VO.posthog.project_key,{cookieless_mode:"always",api_host:VO.posthog.api_host,autocapture:!1,disable_session_recording:!0,capture_pageview:!1,capture_pageleave:!1,advanced_disable_feature_flags_on_first_load:!0})},pK=({children:e})=>(_.useEffect(()=>{hK()},[]),F.jsx(lK,{client:ys,children:e})),qO=_.createContext(void 0),mK=({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(qO.Provider,{value:T,children:e})},iv=()=>{const e=_.useContext(qO);if(e===void 0)throw new Error("useUploadState must be used within an UploadStateProvider");return e},gK=({children:e,config:t,inShadowDom:n=!1})=>{if(!t?.channelId)return F.jsx("div",{children:"No channelId provided..."});let r=F.jsx(YG,{config:{channelId:t.channelId,baseUrl:t.baseUrl},children:F.jsx(BO,{primaryColor:t.primaryColor,children:F.jsx(RG,{i18n:Ra,children:F.jsx(iK,{children:F.jsx(DG,{children:F.jsx(rK,{config:t,inShadowDom:n,children:F.jsx(mK,{children:e})})})})})})});return t.analyticsEnabled&&(r=F.jsx(pK,{children:r})),r},sE=({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"})]}),vK={button:"_button_14uy3_1"},yK=({onToggleWidget:e})=>{const{t}=Gr(),n=r=>{r.stopPropagation(),e()};return F.jsx("button",{className:vK.button,onClick:n,"aria-label":t("common:openChat"),"data-testid":"chat-button",children:F.jsx(sE,{})})};function lE(e,t){window.dispatchEvent(new StorageEvent("storage",{key:e,newValue:t}))}const GO=(e,t)=>{const n=JSON.stringify(t);window.localStorage.setItem(e,n),lE(e,n)},bK=e=>{window.localStorage.removeItem(e),lE(e,null)},KO=e=>window.localStorage.getItem(e),EK=e=>(window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)),wK=()=>{throw Error("useLocalStorage is a client-only hook")};function QO(e,t){const n=()=>KO(e),r=_.useSyncExternalStore(EK,n,wK),a=_.useCallback(s=>{try{const l=typeof s=="function"?s(JSON.parse(r)):s;l==null?bK(e):GO(e,l)}catch(l){console.warn(l)}},[e,r]);return _.useEffect(()=>{KO(e)===null&&typeof t<"u"&&GO(e,t)},[e,t]),[r?JSON.parse(r):t,a]}const XO=(e,t)=>{const n=JSON.stringify(t);window.sessionStorage.setItem(e,n),lE(e,n)},xK=e=>{window.sessionStorage.removeItem(e),lE(e,null)},ZO=e=>window.sessionStorage.getItem(e),TK=e=>(window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)),SK=()=>{throw Error("useSessionStorage is a client-only hook")};function CK(e,t){const n=()=>ZO(e),r=_.useSyncExternalStore(TK,n,SK),a=_.useCallback(s=>{try{const l=typeof s=="function"?s(JSON.parse(r)):s;l==null?xK(e):XO(e,l)}catch(l){console.warn(l)}},[e,r]);return _.useEffect(()=>{ZO(e)===null&&typeof t<"u"&&XO(e,t)},[e,t]),[r?JSON.parse(r):t,a]}const c_=_.createContext({});function d_(e){const t=_.useRef(null);return t.current===null&&(t.current=e()),t.current}const f_=typeof window<"u",JO=f_?_.useLayoutEffect:_.useEffect,uE=_.createContext(null);function h_(e,t){e.indexOf(t)===-1&&e.push(t)}function p_(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 m_(e,t){return t?`${e}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${t}`:e}var _K={};let Up=()=>{},Zu=()=>{};typeof process<"u"&&_K?.NODE_ENV!=="production"&&(Up=(e,t,n)=>{!e&&typeof console<"u"&&console.warn(m_(t,n))},Zu=(e,t,n)=>{if(!e)throw new Error(m_(t,n))});const Ju={},$O=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function eN(e){return typeof e=="object"&&e!==null}const tN=e=>/^0[^.\s]+$/u.test(e);function g_(e){let t;return()=>(t===void 0&&(t=e()),t)}const bs=e=>e,AK=(e,t)=>n=>t(e(n)),av=(...e)=>e.reduce(AK),ov=(e,t,n)=>{const r=t-e;return r===0?1:(n-e)/r};class v_{constructor(){this.subscriptions=[]}add(t){return h_(this.subscriptions,t),()=>p_(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 nN(e,t){return t?e*(1e3/t):0}const rN=new Set;function y_(e,t,n){e||rN.has(t)||(console.warn(m_(t,n)),rN.add(t))}const iN=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,kK=1e-7,RK=12;function DK(e,t,n,r,a){let s,l,c=0;do l=t+(n-t)/2,s=iN(l,r,a)-e,s>0?n=l:t=l;while(Math.abs(s)>kK&&++c<RK);return l}function sv(e,t,n,r){if(e===t&&n===r)return bs;const a=s=>DK(s,0,1,e,n);return s=>s===0||s===1?s:iN(a(s),t,r)}const aN=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,oN=e=>t=>1-e(1-t),sN=sv(.33,1.53,.69,.99),b_=oN(sN),lN=aN(b_),uN=e=>(e*=2)<1?.5*b_(e):.5*(2-Math.pow(2,-10*(e-1))),E_=e=>1-Math.sin(Math.acos(e)),cN=oN(E_),dN=aN(E_),LK=sv(.42,0,1,1),OK=sv(0,0,.58,1),fN=sv(.42,0,.58,1),NK=e=>Array.isArray(e)&&typeof e[0]!="number",hN=e=>Array.isArray(e)&&typeof e[0]=="number",pN={linear:bs,easeIn:LK,easeInOut:fN,easeOut:OK,circIn:E_,circInOut:dN,circOut:cN,backIn:b_,backInOut:lN,backOut:sN,anticipate:uN},PK=e=>typeof e=="string",mN=e=>{if(hN(e)){Zu(e.length===4,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");const[t,n,r,a]=e;return sv(t,n,r,a)}else if(PK(e))return Zu(pN[e]!==void 0,`Invalid easing type '${e}'`,"invalid-easing-type"),pN[e];return e},cE=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function IK(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 MK=40;function gN(e,t){let n=!1,r=!0;const a={delta:0,timestamp:0,isProcessing:!1},s=()=>n=!0,l=cE.reduce((H,V)=>(H[V]=IK(s),H),{}),{setup:c,read:h,resolveKeyframes:p,preUpdate:v,update:y,preRender:w,render:T,postRender:A}=l,R=()=>{const H=Ju.useManualTiming?a.timestamp:performance.now();n=!1,Ju.useManualTiming||(a.delta=r?1e3/60:Math.max(Math.min(H-a.timestamp,MK),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:cE.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<cE.length;V++)l[cE[V]].cancel(H)},state:a,steps:l}}const{schedule:Mr,cancel:ld,state:da,steps:w_}=gN(typeof requestAnimationFrame<"u"?requestAnimationFrame:bs,!0);let dE;function FK(){dE=void 0}const to={now:()=>(dE===void 0&&to.set(da.isProcessing||Ju.useManualTiming?da.timestamp:performance.now()),dE),set:e=>{dE=e,queueMicrotask(FK)}},vN=e=>t=>typeof t=="string"&&t.startsWith(e),yN=vN("--"),BK=vN("var(--"),x_=e=>BK(e)?HK.test(e.split("/*")[0].trim()):!1,HK=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function bN(e){return typeof e!="string"?!1:e.split("/*")[0].includes("var(--")}const zp={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},lv={...zp,transform:e=>jl(0,1,e)},fE={...zp,default:1},uv=e=>Math.round(e*1e5)/1e5,T_=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function UK(e){return e==null}const zK=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,S_=(e,t)=>n=>!!(typeof n=="string"&&zK.test(n)&&n.startsWith(e)||t&&!UK(n)&&Object.prototype.hasOwnProperty.call(n,t)),EN=(e,t,n)=>r=>{if(typeof r!="string")return r;const[a,s,l,c]=r.match(T_);return{[e]:parseFloat(a),[t]:parseFloat(s),[n]:parseFloat(l),alpha:c!==void 0?parseFloat(c):1}},jK=e=>jl(0,255,e),C_={...zp,transform:e=>Math.round(jK(e))},Ff={test:S_("rgb","red"),parse:EN("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+C_.transform(e)+", "+C_.transform(t)+", "+C_.transform(n)+", "+uv(lv.transform(r))+")"};function VK(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 __={test:S_("#"),parse:VK,transform:Ff.transform},cv=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),ud=cv("deg"),Wl=cv("%"),kt=cv("px"),WK=cv("vh"),YK=cv("vw"),wN={...Wl,parse:e=>Wl.parse(e)/100,transform:e=>Wl.transform(e*100)},jp={test:S_("hsl","hue"),parse:EN("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+Wl.transform(uv(t))+", "+Wl.transform(uv(n))+", "+uv(lv.transform(r))+")"},xi={test:e=>Ff.test(e)||__.test(e)||jp.test(e),parse:e=>Ff.test(e)?Ff.parse(e):jp.test(e)?jp.parse(e):__.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?Ff.transform(e):jp.transform(e),getAnimatableNone:e=>{const t=xi.parse(e);return t.alpha=0,xi.transform(t)}},qK=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function GK(e){return isNaN(e)&&typeof e=="string"&&(e.match(T_)?.length||0)+(e.match(qK)?.length||0)>0}const xN="number",TN="color",KK="var",QK="var(",SN="${}",XK=/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 dv(e){const t=e.toString(),n=[],r={color:[],number:[],var:[]},a=[];let s=0;const c=t.replace(XK,h=>(xi.test(h)?(r.color.push(s),a.push(TN),n.push(xi.parse(h))):h.startsWith(QK)?(r.var.push(s),a.push(KK),n.push(h)):(r.number.push(s),a.push(xN),n.push(parseFloat(h))),++s,SN)).split(SN);return{values:n,split:c,indexes:r,types:a}}function CN(e){return dv(e).values}function _N(e){const{split:t,types:n}=dv(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===xN?s+=uv(a[l]):c===TN?s+=xi.transform(a[l]):s+=a[l]}return s}}const ZK=e=>typeof e=="number"?0:xi.test(e)?xi.getAnimatableNone(e):e;function JK(e){const t=CN(e);return _N(e)(t.map(ZK))}const cd={test:GK,parse:CN,createTransformer:_N,getAnimatableNone:JK};function A_(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 $K({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=A_(h,c,e+.3333333333333333),s=A_(h,c,e),l=A_(h,c,e-.3333333333333333)}return{red:Math.round(a*255),green:Math.round(s*255),blue:Math.round(l*255),alpha:r}}function hE(e,t){return n=>n>0?t:e}const Kr=(e,t,n)=>e+(t-e)*n,k_=(e,t,n)=>{const r=e*e,a=n*(t*t-r)+r;return a<0?0:Math.sqrt(a)},eQ=[__,Ff,jp],tQ=e=>eQ.find(t=>t.test(e));function AN(e){const t=tQ(e);if(Up(!!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===jp&&(n=$K(n)),n}const kN=(e,t)=>{const n=AN(e),r=AN(t);if(!n||!r)return hE(e,t);const a={...n};return s=>(a.red=k_(n.red,r.red,s),a.green=k_(n.green,r.green,s),a.blue=k_(n.blue,r.blue,s),a.alpha=Kr(n.alpha,r.alpha,s),Ff.transform(a))},R_=new Set(["none","hidden"]);function nQ(e,t){return R_.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function rQ(e,t){return n=>Kr(e,t,n)}function D_(e){return typeof e=="number"?rQ:typeof e=="string"?x_(e)?hE:xi.test(e)?kN:oQ:Array.isArray(e)?RN:typeof e=="object"?xi.test(e)?kN:iQ:hE}function RN(e,t){const n=[...e],r=n.length,a=e.map((s,l)=>D_(s)(s,t[l]));return s=>{for(let l=0;l<r;l++)n[l]=a[l](s);return n}}function iQ(e,t){const n={...e,...t},r={};for(const a in n)e[a]!==void 0&&t[a]!==void 0&&(r[a]=D_(e[a])(e[a],t[a]));return a=>{for(const s in r)n[s]=r[s](a);return n}}function aQ(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 oQ=(e,t)=>{const n=cd.createTransformer(t),r=dv(e),a=dv(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?R_.has(e)&&!a.values.length||R_.has(t)&&!r.values.length?nQ(e,t):av(RN(aQ(r,a),a.values),n):(Up(!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"),hE(e,t))};function DN(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?Kr(e,t,n):D_(e)(e,t)}const sQ=e=>{const t=({timestamp:n})=>e(n);return{start:(n=!0)=>Mr.update(t,n),stop:()=>ld(t),now:()=>da.isProcessing?da.timestamp:to.now()}},LN=(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)})`},pE=2e4;function L_(e){let t=0;const n=50;let r=e.next(t);for(;!r.done&&t<pE;)t+=n,r=e.next(t);return t>=pE?1/0:t}function lQ(e,t=100,n){const r=n({...e,keyframes:[0,t]}),a=Math.min(L_(r),pE);return{type:"keyframes",ease:s=>r.next(a*s).value/t,duration:Es(a)}}const uQ=5;function ON(e,t,n){const r=Math.max(t-uQ,0);return nN(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},O_=.001;function cQ({duration:e=Qr.duration,bounce:t=Qr.bounce,velocity:n=Qr.velocity,mass:r=Qr.mass}){let a,s;Up(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=N_(p,l),A=Math.exp(-y);return O_-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=N_(Math.pow(p,2),l);return(-a(p)+O_>0?-1:1)*((w-T)*A)/R}):(a=p=>{const v=Math.exp(-p*e),y=(p-n)*e+1;return-O_+v*y},s=p=>{const v=Math.exp(-p*e),y=(n-p)*(e*e);return v*y});const c=5/e,h=fQ(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 dQ=12;function fQ(e,t,n){let r=n;for(let a=1;a<dQ;a++)r=r-e(r)/t(r);return r}function N_(e,t){return e*Math.sqrt(1-t*t)}const hQ=["duration","bounce"],pQ=["stiffness","damping","mass"];function NN(e,t){return t.some(n=>e[n]!==void 0)}function mQ(e){let t={velocity:Qr.velocity,stiffness:Qr.stiffness,damping:Qr.damping,mass:Qr.mass,isResolvedFromDuration:!1,...e};if(!NN(e,pQ)&&NN(e,hQ))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=cQ(e);t={...t,...n,mass:Qr.mass},t.isResolvedFromDuration=!0}return t}function mE(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}=mQ({...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=N_(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):ON(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(L_(V),pE),Y=LN(Z=>V.next(K*Z).value,K,30);return K+"ms "+Y},toTransition:()=>{}};return V}mE.applyToOptions=e=>{const t=lQ(e,100,mE);return e.ease=t.ease,e.duration=Vl(t.duration),e.type="keyframes",e};function P_({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=mE({keyframes:[w.value,A(w.value)],velocity:ON(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 gQ(e,t,n){const r=[],a=n||Ju.mix||DN,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=av(h,c)}r.push(c)}return r}function vQ(e,t,{clamp:n=!0,ease:r,mixer:a}={}){const s=e.length;if(Zu(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=gQ(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=ov(e[y],e[y+1],v);return c[y](w)};return n?v=>p(jl(e[0],e[s-1],v)):p}function yQ(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const a=ov(0,t,r);e.push(Kr(n,1,a))}}function bQ(e){const t=[0];return yQ(t,e.length-1),t}function EQ(e,t){return e.map(n=>n*t)}function wQ(e,t){return e.map(()=>t||fN).splice(0,e.length-1)}function Vp({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const a=NK(r)?r.map(mN):mN(r),s={done:!1,value:t[0]},l=EQ(n&&n.length===t.length?n:bQ(t),e),c=vQ(l,t,{ease:Array.isArray(a)?a:wQ(t,a)});return{calculatedDuration:e,next:h=>(s.value=c(h),s.done=h>=e,s)}}const xQ=e=>e!==null;function I_(e,{repeat:t,repeatType:n="loop"},r,a=1){const s=e.filter(xQ),c=a<0||t&&n!=="loop"&&t%2===1?0:s.length-1;return!c||r===void 0?s[c]:r}const TQ={decay:P_,inertia:P_,tween:Vp,keyframes:Vp,spring:mE};function PN(e){typeof e.type=="string"&&(e.type=TQ[e.type])}class M_{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 SQ={};const CQ=e=>e/100;class F_ extends M_{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;PN(t);const{type:n=Vp,repeat:r=0,repeatDelay:a=0,repeatType:s,velocity:l=0}=t;let{keyframes:c}=t;const h=n||Vp;SQ.NODE_ENV!=="production"&&h!==Vp&&Zu(c.length<=2,`Only two keyframes currently supported with spring and inertia animations. Trying to animate ${c}`,"spring-two-frames"),h!==Vp&&typeof c[0]!="number"&&(this.mixKeyframes=av(CQ,DN(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=L_(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!==P_&&(K.value=I_(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=sQ,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 _Q(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}const Bf=e=>e*180/Math.PI,B_=e=>{const t=Bf(Math.atan2(e[1],e[0]));return H_(t)},AQ={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:B_,rotateZ:B_,skewX:e=>Bf(Math.atan(e[1])),skewY:e=>Bf(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},H_=e=>(e=e%360,e<0&&(e+=360),e),IN=B_,MN=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),FN=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),kQ={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:MN,scaleY:FN,scale:e=>(MN(e)+FN(e))/2,rotateX:e=>H_(Bf(Math.atan2(e[6],e[5]))),rotateY:e=>H_(Bf(Math.atan2(-e[2],e[0]))),rotateZ:IN,rotate:IN,skewX:e=>Bf(Math.atan(e[4])),skewY:e=>Bf(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function U_(e){return e.includes("scale")?1:0}function z_(e,t){if(!e||e==="none")return U_(t);const n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let r,a;if(n)r=kQ,a=n;else{const c=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=AQ,a=c}if(!a)return U_(t);const s=r[t],l=a[1].split(",").map(DQ);return typeof s=="function"?s(l):l[s]}const RQ=(e,t)=>{const{transform:n="none"}=getComputedStyle(e);return z_(n,t)};function DQ(e){return parseFloat(e.trim())}const Wp=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Yp=new Set(Wp),BN=e=>e===zp||e===kt,LQ=new Set(["x","y","z"]),OQ=Wp.filter(e=>!LQ.has(e));function NQ(e){const t=[];return OQ.forEach(n=>{const r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),t}const dd={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})=>z_(t,"x"),y:(e,{transform:t})=>z_(t,"y")};dd.translateX=dd.x,dd.translateY=dd.y;const Hf=new Set;let j_=!1,V_=!1,W_=!1;function HN(){if(V_){const e=Array.from(Hf).filter(r=>r.needsMeasurement),t=new Set(e.map(r=>r.element)),n=new Map;t.forEach(r=>{const a=NQ(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)})}V_=!1,j_=!1,Hf.forEach(e=>e.complete(W_)),Hf.clear()}function UN(){Hf.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(V_=!0)})}function PQ(){W_=!0,UN(),HN(),W_=!1}class Y_{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?(Hf.add(this),j_||(j_=!0,Mr.read(UN),Mr.resolveKeyframes(HN))):(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])}_Q(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),Hf.delete(this)}cancel(){this.state==="scheduled"&&(Hf.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const IQ=e=>e.startsWith("--");function MQ(e,t,n){IQ(t)?e.style.setProperty(t,n):e.style[t]=n}const FQ=g_(()=>window.ScrollTimeline!==void 0),BQ={};function HQ(e,t){const n=g_(e);return()=>BQ[t]??n()}const zN=HQ(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),fv=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,jN={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:fv([0,.65,.55,1]),circOut:fv([.55,0,1,.45]),backIn:fv([.31,.01,.66,-.59]),backOut:fv([.33,1.53,.69,.99])};function VN(e,t){if(e)return typeof e=="function"?zN()?LN(e,t):"ease-out":hN(e)?fv(e):Array.isArray(e)?e.map(n=>VN(n,t)||jN.easeOut):jN[e]}function UQ(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=VN(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 WN(e){return typeof e=="function"&&"applyToOptions"in e}function zQ({type:e,...t}){return WN(e)&&zN()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class jQ extends M_{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,Zu(typeof t.type!="string",`Mini animate() doesn't support "type" as a string.`,"mini-spring");const p=zQ(t);this.animation=UQ(n,r,a,p,s),p.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!s){const v=I_(a,this.options,c,this.speed);this.updateMotionValue?this.updateMotionValue(v):MQ(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&&FQ()?(this.animation.timeline=t,bs):n(this)}}const YN={anticipate:uN,backInOut:lN,circInOut:dN};function VQ(e){return e in YN}function WQ(e){typeof e.ease=="string"&&VQ(e.ease)&&(e.ease=YN[e.ease])}const q_=10;class YQ extends jQ{constructor(t){WQ(t),PN(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 F_({...l,autoplay:!1}),h=Math.max(q_,to.now()-this.startTime),p=jl(0,q_,h-q_);n.setWithVelocity(c.sample(Math.max(0,h-p)).value,c.sample(h).value,p),c.stop()}}const qN=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(cd.test(e)||e==="0")&&!e.startsWith("url("));function qQ(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 GQ(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=qN(a,t),c=qN(s,t);return Up(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:qQ(e)||(n==="spring"||WN(n))&&r}function G_(e){e.duration=0,e.type="keyframes"}const KQ=new Set(["opacity","clipPath","filter","transform"]),QQ=g_(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function XQ(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 QQ()&&n&&KQ.has(n)&&(n!=="transform"||!p)&&!h&&!r&&a!=="mirror"&&s!==0&&l!=="inertia"}const ZQ=40;class JQ extends M_{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||Y_;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(),GQ(t,s,l,c)||((Ju.instantAnimations||!h)&&v?.(I_(t,r,n)),t[0]=t[t.length-1],G_(r),r.repeat=0);const w={startTime:a?this.resolvedAt?this.resolvedAt-this.createdAt>ZQ?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...r,keyframes:t},T=!p&&XQ(w)?new YQ({...w,element:w.motionValue.owner.current}):new F_(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(),PQ()),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 $Q=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function eX(e){const t=$Q.exec(e);if(!t)return[,];const[,n,r,a]=t;return[`--${n??r}`,a]}const tX=4;function GN(e,t,n=1){Zu(n<=tX,`Max CSS variable fallback depth detected in property "${e}". This may indicate a circular fallback dependency.`,"max-css-var-depth");const[r,a]=eX(e);if(!r)return;const s=window.getComputedStyle(t).getPropertyValue(r);if(s){const l=s.trim();return $O(l)?parseFloat(l):l}return x_(a)?GN(a,t,n+1):a}function K_(e,t){return e?.[t]??e?.default??e}const KN=new Set(["width","height","top","left","right","bottom",...Wp]);var nX={};const QN=30,rX=e=>!isNaN(parseFloat(e));class iX{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=rX(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return nX.NODE_ENV!=="production"&&y_(!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 v_);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>QN)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,QN);return nN(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 qp(e,t){return new iX(e,t)}const La=e=>!!(e&&e.getVelocity),aX={test:e=>e==="auto",parse:e=>e},XN=e=>t=>t.test(e),ZN=[zp,kt,Wl,ud,YK,WK,aX],JN=e=>ZN.find(XN(e));function oX(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||tN(e):!0}const sX=new Set(["brightness","contrast","saturate","opacity"]);function lX(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=n.match(T_)||[];if(!r)return e;const a=n.replace(r,"");let s=sX.has(t)?1:0;return r!==n&&(s*=100),t+"("+s+a+")"}const uX=/\b([a-z-]*)\(.*?\)/gu,Q_={...cd,getAnimatableNone:e=>{const t=e.match(uX);return t?t.map(lX).join(" "):e}},$N={...zp,transform:Math.round},X_={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:ud,rotateX:ud,rotateY:ud,rotateZ:ud,scale:fE,scaleX:fE,scaleY:fE,scaleZ:fE,skew:ud,skewX:ud,skewY:ud,distance:kt,translateX:kt,translateY:kt,translateZ:kt,x:kt,y:kt,z:kt,perspective:kt,transformPerspective:kt,opacity:lv,originX:wN,originY:wN,originZ:kt},zIndex:$N,fillOpacity:lv,strokeOpacity:lv,numOctaves:$N},cX={...X_,color:xi,backgroundColor:xi,outlineColor:xi,fill:xi,stroke:xi,borderColor:xi,borderTopColor:xi,borderRightColor:xi,borderBottomColor:xi,borderLeftColor:xi,filter:Q_,WebkitFilter:Q_},e8=e=>cX[e];function t8(e,t){let n=e8(e);return n!==Q_&&(n=cd),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const dX=new Set(["auto","none","0"]);function fX(e,t,n){let r=0,a;for(;r<e.length&&!a;){const s=e[r];typeof s=="string"&&!dX.has(s)&&dv(s).values.length&&(a=e[r]),r++}if(a&&n)for(const s of t)e[s]=t8(n,a)}class hX extends Y_{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(),x_(y))){const w=GN(y,n.current);w!==void 0&&(t[v]=w),v===t.length-1&&(this.finalKeyframe=y)}}if(this.resolveNoneKeyframes(),!KN.has(r)||t.length!==2)return;const[a,s]=t,l=JN(a),c=JN(s),h=bN(a),p=bN(s);if(h!==p&&dd[r]){this.needsMeasurement=!0;return}if(l!==c)if(BN(l)&&BN(c))for(let v=0;v<t.length;v++){const y=t[v];typeof y=="string"&&(t[v]=parseFloat(y))}else dd[r]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:n}=this,r=[];for(let a=0;a<t.length;a++)(t[a]===null||oX(t[a]))&&r.push(a);r.length&&fX(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=dd[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]=dd[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 pX(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 n8=(e,t)=>t&&typeof e=="number"?t.transform(e):e;function r8(e){return eN(e)&&"offsetHeight"in e}const{schedule:Z_}=gN(queueMicrotask,!1),Qs={x:!1,y:!1};function i8(){return Qs.x||Qs.y}function mX(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 a8(e,t){const n=pX(e),r=new AbortController,a={passive:!0,...t,signal:r.signal};return[n,a,()=>r.abort()]}function o8(e){return!(e.pointerType==="touch"||i8())}function gX(e,t,n={}){const[r,a,s]=a8(e,n),l=c=>{if(!o8(c))return;const{target:h}=c,p=t(h,c);if(typeof p!="function"||!h)return;const v=y=>{o8(y)&&(p(y),h.removeEventListener("pointerleave",v))};h.addEventListener("pointerleave",v,a)};return r.forEach(c=>{c.addEventListener("pointerenter",l,a)}),s}const s8=(e,t)=>t?e===t?!0:s8(e,t.parentElement):!1,J_=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,vX=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function l8(e){return vX.has(e.tagName)||e.isContentEditable===!0}const gE=new WeakSet;function u8(e){return t=>{t.key==="Enter"&&e(t)}}function $_(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const yX=(e,t)=>{const n=e.currentTarget;if(!n)return;const r=u8(()=>{if(gE.has(n))return;$_(n,"down");const a=u8(()=>{$_(n,"up")}),s=()=>$_(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 c8(e){return J_(e)&&!i8()}function bX(e,t,n={}){const[r,a,s]=a8(e,n),l=c=>{const h=c.currentTarget;if(!c8(c))return;gE.add(h);const p=t(h,c),v=(T,A)=>{window.removeEventListener("pointerup",y),window.removeEventListener("pointercancel",w),gE.has(h)&&gE.delete(h),c8(T)&&typeof p=="function"&&p(T,{success:A})},y=T=>{v(T,h===window||h===document||n.useGlobalTarget||s8(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),r8(c)&&(c.addEventListener("focus",p=>yX(p,a)),!l8(c)&&!c.hasAttribute("tabindex")&&(c.tabIndex=0))}),s}function d8(e){return eN(e)&&"ownerSVGElement"in e}function EX(e){return d8(e)&&e.tagName==="svg"}const wX=[...ZN,xi,cd],xX=e=>wX.find(XN(e)),eA=_.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function f8(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function TX(...e){return t=>{let n=!1;const r=e.map(a=>{const s=f8(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():f8(e[a],null)}}}}function SX(...e){return _.useCallback(TX(...e),e)}class CX extends _.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(n&&t.isPresent&&!this.props.isPresent){const r=n.offsetParent,a=r8(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 _X({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(eA),h=e.props?.ref??e?.ref,p=SX(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
@@ -33333,6 +33333,7 @@ class pR {
33333
33333
  noAnswerFallback: t.no_answer_fallback,
33334
33334
  analyticsEnabled: t.analytics_enabled,
33335
33335
  enableCentrifugo: t.enable_centrifugo,
33336
+ companyId: t.company_id,
33336
33337
  intro: {
33337
33338
  type: t.intro_type ?? $y.NONE,
33338
33339
  title: t.intro_title,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@freeday-ai/webchat",
3
- "version": "2026.01.15.03.46.12337",
3
+ "version": "2026.01.15.06.07.12363",
4
4
  "private": false,
5
5
  "files": [
6
6
  "dist"